show.ts — vue Source File
Architecture documentation for show.ts, a typescript file in the vue codebase. 3 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 86b1f556_b1fa_0724_27bc_8fc0c9d9a7e8["show.ts"] f6868225_acf7_afdc_ebd3_15704ddb6566["vnode"] 86b1f556_b1fa_0724_27bc_8fc0c9d9a7e8 --> f6868225_acf7_afdc_ebd3_15704ddb6566 81ed4f13_7d68_6e21_7425_cf978f68576f["vnode"] 86b1f556_b1fa_0724_27bc_8fc0c9d9a7e8 --> 81ed4f13_7d68_6e21_7425_cf978f68576f 14d18c05_30e4_7493_ff6d_32ab1fda6031["transition"] 86b1f556_b1fa_0724_27bc_8fc0c9d9a7e8 --> 14d18c05_30e4_7493_ff6d_32ab1fda6031 72ec008b_b63e_cd79_66ff_0a6020716719["index.ts"] 72ec008b_b63e_cd79_66ff_0a6020716719 --> 86b1f556_b1fa_0724_27bc_8fc0c9d9a7e8 style 86b1f556_b1fa_0724_27bc_8fc0c9d9a7e8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import VNode from 'core/vdom/vnode'
import type { VNodeDirective, VNodeWithData } from 'types/vnode'
import { enter, leave } from 'web/runtime/modules/transition'
// recursively search for possible transition defined inside the component root
function locateNode(vnode: VNode | VNodeWithData): VNodeWithData {
// @ts-expect-error
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
? locateNode(vnode.componentInstance._vnode!)
: vnode
}
export default {
bind(el: any, { value }: VNodeDirective, vnode: VNodeWithData) {
vnode = locateNode(vnode)
const transition = vnode.data && vnode.data.transition
const originalDisplay = (el.__vOriginalDisplay =
el.style.display === 'none' ? '' : el.style.display)
if (value && transition) {
vnode.data.show = true
enter(vnode, () => {
el.style.display = originalDisplay
})
} else {
el.style.display = value ? originalDisplay : 'none'
}
},
update(el: any, { value, oldValue }: VNodeDirective, vnode: VNodeWithData) {
/* istanbul ignore if */
if (!value === !oldValue) return
vnode = locateNode(vnode)
const transition = vnode.data && vnode.data.transition
if (transition) {
vnode.data.show = true
if (value) {
enter(vnode, () => {
el.style.display = el.__vOriginalDisplay
})
} else {
leave(vnode, () => {
el.style.display = 'none'
})
}
} else {
el.style.display = value ? el.__vOriginalDisplay : 'none'
}
},
unbind(
el: any,
binding: VNodeDirective,
vnode: VNodeWithData,
oldVnode: VNodeWithData,
isDestroy: boolean
) {
if (!isDestroy) {
el.style.display = el.__vOriginalDisplay
}
}
}
Domain
Subdomains
Dependencies
- transition
- vnode
- vnode
Imported By
Source
Frequently Asked Questions
What does show.ts do?
show.ts is a source file in the vue codebase, written in typescript. It belongs to the WebPlatform domain, RuntimeModules subdomain.
What functions are defined in show.ts?
show.ts defines 4 function(s): default.bind, default.unbind, default.update, locateNode.
What does show.ts depend on?
show.ts imports 3 module(s): transition, vnode, vnode.
What files import show.ts?
show.ts is imported by 1 file(s): index.ts.
Where is show.ts in the architecture?
show.ts is located at src/platforms/web/runtime/directives/show.ts (domain: WebPlatform, subdomain: RuntimeModules, directory: src/platforms/web/runtime/directives).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free