Home / File/ class.ts — vue Source File

class.ts — vue Source File

Architecture documentation for class.ts, a typescript file in the vue codebase. 3 imports, 1 dependents.

File typescript WebPlatform WebRuntime 3 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  4e760d0b_e8eb_7d3b_49e7_041e050c9a64["class.ts"]
  09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"]
  4e760d0b_e8eb_7d3b_49e7_041e050c9a64 --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b
  ba925ef2_b0f4_efe3_c23d_fe293c46b2c1["vnode"]
  4e760d0b_e8eb_7d3b_49e7_041e050c9a64 --> ba925ef2_b0f4_efe3_c23d_fe293c46b2c1
  28507de2_df66_4d38_8b45_3af459d16f77["index"]
  4e760d0b_e8eb_7d3b_49e7_041e050c9a64 --> 28507de2_df66_4d38_8b45_3af459d16f77
  7973a695_d0db_6940_134b_f6ff953b9e97["index.ts"]
  7973a695_d0db_6940_134b_f6ff953b9e97 --> 4e760d0b_e8eb_7d3b_49e7_041e050c9a64
  style 4e760d0b_e8eb_7d3b_49e7_041e050c9a64 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { isDef, isUndef } from 'shared/util'
import type { VNodeData } from 'types/vnode'

import { concat, stringifyClass, genClassForVnode } from 'web/util/index'

function updateClass(oldVnode: any, vnode: any) {
  const el = vnode.elm
  const data: VNodeData = vnode.data
  const oldData: VNodeData = oldVnode.data
  if (
    isUndef(data.staticClass) &&
    isUndef(data.class) &&
    (isUndef(oldData) ||
      (isUndef(oldData.staticClass) && isUndef(oldData.class)))
  ) {
    return
  }

  let cls = genClassForVnode(vnode)

  // handle transition classes
  const transitionClass = el._transitionClasses
  if (isDef(transitionClass)) {
    cls = concat(cls, stringifyClass(transitionClass))
  }

  // set the class
  if (cls !== el._prevClass) {
    el.setAttribute('class', cls)
    el._prevClass = cls
  }
}

export default {
  create: updateClass,
  update: updateClass
}

Domain

Subdomains

Functions

Dependencies

  • index
  • util
  • vnode

Frequently Asked Questions

What does class.ts do?
class.ts is a source file in the vue codebase, written in typescript. It belongs to the WebPlatform domain, WebRuntime subdomain.
What functions are defined in class.ts?
class.ts defines 1 function(s): updateClass.
What does class.ts depend on?
class.ts imports 3 module(s): index, util, vnode.
What files import class.ts?
class.ts is imported by 1 file(s): index.ts.
Where is class.ts in the architecture?
class.ts is located at src/platforms/web/runtime/modules/class.ts (domain: WebPlatform, subdomain: WebRuntime, directory: src/platforms/web/runtime/modules).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free