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
  1586dac9_809f_7446_6b75_bcf2350bc2bd["class.ts"]
  ae4c513b_1e5d_f408_b254_6ab6e8753481["text-parser"]
  1586dac9_809f_7446_6b75_bcf2350bc2bd --> ae4c513b_1e5d_f408_b254_6ab6e8753481
  a53a30c8_9418_4cc4_6709_164fca9149e1["helpers"]
  1586dac9_809f_7446_6b75_bcf2350bc2bd --> a53a30c8_9418_4cc4_6709_164fca9149e1
  a80b8e3b_d720_9146_3bf6_594d4ee5dd77["compiler"]
  1586dac9_809f_7446_6b75_bcf2350bc2bd --> a80b8e3b_d720_9146_3bf6_594d4ee5dd77
  a85501f5_3770_59af_2f90_3e1b4461f2fc["index.ts"]
  a85501f5_3770_59af_2f90_3e1b4461f2fc --> 1586dac9_809f_7446_6b75_bcf2350bc2bd
  style 1586dac9_809f_7446_6b75_bcf2350bc2bd 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