directives.ts — vue Source File
Architecture documentation for directives.ts, a typescript file in the vue codebase. 5 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR a07220f3_beb1_7821_9810_d794a7a56504["directives.ts"] 7f2e8dff_3298_ebe0_d86e_250235fb5e75["patch"] a07220f3_beb1_7821_9810_d794a7a56504 --> 7f2e8dff_3298_ebe0_d86e_250235fb5e75 90a2398a_1498_3263_c62e_0c064dd2c9b3["index"] a07220f3_beb1_7821_9810_d794a7a56504 --> 90a2398a_1498_3263_c62e_0c064dd2c9b3 0b94d479_4c91_cb17_f853_bbf7580e667b["index"] a07220f3_beb1_7821_9810_d794a7a56504 --> 0b94d479_4c91_cb17_f853_bbf7580e667b ba925ef2_b0f4_efe3_c23d_fe293c46b2c1["vnode"] a07220f3_beb1_7821_9810_d794a7a56504 --> ba925ef2_b0f4_efe3_c23d_fe293c46b2c1 64c87498_c46a_6944_ab9d_8e45519852a8["component"] a07220f3_beb1_7821_9810_d794a7a56504 --> 64c87498_c46a_6944_ab9d_8e45519852a8 ffbd8cbb_fbc3_c5be_ca89_db209c2d38b1["index.ts"] ffbd8cbb_fbc3_c5be_ca89_db209c2d38b1 --> a07220f3_beb1_7821_9810_d794a7a56504 style a07220f3_beb1_7821_9810_d794a7a56504 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { emptyNode } from 'core/vdom/patch'
import { resolveAsset, handleError } from 'core/util/index'
import { mergeVNodeHook } from 'core/vdom/helpers/index'
import type { VNodeDirective, VNodeWithData } from 'types/vnode'
import type { Component } from 'types/component'
export default {
create: updateDirectives,
update: updateDirectives,
destroy: function unbindDirectives(vnode: VNodeWithData) {
// @ts-expect-error emptyNode is not VNodeWithData
updateDirectives(vnode, emptyNode)
}
}
function updateDirectives(oldVnode: VNodeWithData, vnode: VNodeWithData) {
if (oldVnode.data.directives || vnode.data.directives) {
_update(oldVnode, vnode)
}
}
function _update(oldVnode, vnode) {
const isCreate = oldVnode === emptyNode
const isDestroy = vnode === emptyNode
const oldDirs = normalizeDirectives(
oldVnode.data.directives,
oldVnode.context
)
const newDirs = normalizeDirectives(vnode.data.directives, vnode.context)
const dirsWithInsert: any[] = []
const dirsWithPostpatch: any[] = []
let key, oldDir, dir
for (key in newDirs) {
oldDir = oldDirs[key]
dir = newDirs[key]
if (!oldDir) {
// new directive, bind
callHook(dir, 'bind', vnode, oldVnode)
if (dir.def && dir.def.inserted) {
dirsWithInsert.push(dir)
}
} else {
// existing directive, update
dir.oldValue = oldDir.value
dir.oldArg = oldDir.arg
callHook(dir, 'update', vnode, oldVnode)
if (dir.def && dir.def.componentUpdated) {
dirsWithPostpatch.push(dir)
}
}
}
if (dirsWithInsert.length) {
const callInsert = () => {
for (let i = 0; i < dirsWithInsert.length; i++) {
callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode)
}
}
// ... (78 more lines)
Domain
Subdomains
Functions
Dependencies
- component
- index
- index
- patch
- vnode
Imported By
Source
Frequently Asked Questions
What does directives.ts do?
directives.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, Instance subdomain.
What functions are defined in directives.ts?
directives.ts defines 6 function(s): _update, callHook, default.destroy, getRawDirName, normalizeDirectives, updateDirectives.
What does directives.ts depend on?
directives.ts imports 5 module(s): component, index, index, patch, vnode.
What files import directives.ts?
directives.ts is imported by 1 file(s): index.ts.
Where is directives.ts in the architecture?
directives.ts is located at src/core/vdom/modules/directives.ts (domain: VueCore, subdomain: Instance, directory: src/core/vdom/modules).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free