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 WebCompiler 3 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  9f1e2377_1a47_267a_600f_d240442f70ee["class.ts"]
  58dc275a_2d47_31bd_c15f_4e8cccfdf792["text-parser"]
  9f1e2377_1a47_267a_600f_d240442f70ee --> 58dc275a_2d47_31bd_c15f_4e8cccfdf792
  a0ba3d1b_5fa2_9aa0_10cf_68e933ca762a["helpers"]
  9f1e2377_1a47_267a_600f_d240442f70ee --> a0ba3d1b_5fa2_9aa0_10cf_68e933ca762a
  47ae9f26_59d1_fab2_349f_966f5d15495a["compiler"]
  9f1e2377_1a47_267a_600f_d240442f70ee --> 47ae9f26_59d1_fab2_349f_966f5d15495a
  7a870aa6_cb8c_14d5_7123_6cc7f7056936["index.ts"]
  7a870aa6_cb8c_14d5_7123_6cc7f7056936 --> 9f1e2377_1a47_267a_600f_d240442f70ee
  style 9f1e2377_1a47_267a_600f_d240442f70ee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { parseText } from 'compiler/parser/text-parser'
import { getAndRemoveAttr, getBindingAttr, baseWarn } from 'compiler/helpers'
import { ASTElement, CompilerOptions, ModuleOptions } from 'types/compiler'

function transformNode(el: ASTElement, options: CompilerOptions) {
  const warn = options.warn || baseWarn
  const staticClass = getAndRemoveAttr(el, 'class')
  if (__DEV__ && staticClass) {
    const res = parseText(staticClass, options.delimiters)
    if (res) {
      warn(
        `class="${staticClass}": ` +
          'Interpolation inside attributes has been removed. ' +
          'Use v-bind or the colon shorthand instead. For example, ' +
          'instead of <div class="{{ val }}">, use <div :class="val">.',
        el.rawAttrsMap['class']
      )
    }
  }
  if (staticClass) {
    el.staticClass = JSON.stringify(staticClass.replace(/\s+/g, ' ').trim())
  }
  const classBinding = getBindingAttr(el, 'class', false /* getStatic */)
  if (classBinding) {
    el.classBinding = classBinding
  }
}

function genData(el: ASTElement): string {
  let data = ''
  if (el.staticClass) {
    data += `staticClass:${el.staticClass},`
  }
  if (el.classBinding) {
    data += `class:${el.classBinding},`
  }
  return data
}

export default {
  staticKeys: ['staticClass'],
  transformNode,
  genData
} as ModuleOptions

Domain

Subdomains

Dependencies

  • compiler
  • helpers
  • text-parser

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, WebCompiler subdomain.
What functions are defined in class.ts?
class.ts defines 2 function(s): genData, transformNode.
What does class.ts depend on?
class.ts imports 3 module(s): compiler, helpers, text-parser.
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/compiler/modules/class.ts (domain: WebPlatform, subdomain: WebCompiler, directory: src/platforms/web/compiler/modules).

Analyze Your Own Codebase

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

Try Supermodel Free