patch.ts — vue Source File
Architecture documentation for patch.ts, a typescript file in the vue codebase. 10 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 020681fa_600e_5c84_6a4e_f1289077cc78["patch.ts"] 5164a61d_92b2_9c7f_8acb_b18093afdb59["vnode.ts"] 020681fa_600e_5c84_6a4e_f1289077cc78 --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 81a11719_3457_ecad_7c86_c586d804debb["config.ts"] 020681fa_600e_5c84_6a4e_f1289077cc78 --> 81a11719_3457_ecad_7c86_c586d804debb b4d64c20_18f0_552d_559e_065753ef82cd["template-ref.ts"] 020681fa_600e_5c84_6a4e_f1289077cc78 --> b4d64c20_18f0_552d_559e_065753ef82cd ac2a5d8a_d8a3_117c_7f0d_cb9b1b084b59["registerRef"] 020681fa_600e_5c84_6a4e_f1289077cc78 --> ac2a5d8a_d8a3_117c_7f0d_cb9b1b084b59 19a79cc7_5fb4_4746_0453_f0f304dd29a7["traverse.ts"] 020681fa_600e_5c84_6a4e_f1289077cc78 --> 19a79cc7_5fb4_4746_0453_f0f304dd29a7 1590b3d4_b603_9a95_ff78_1330c383e860["traverse"] 020681fa_600e_5c84_6a4e_f1289077cc78 --> 1590b3d4_b603_9a95_ff78_1330c383e860 d937f76e_061f_a631_9587_336503c9a15c["lifecycle.ts"] 020681fa_600e_5c84_6a4e_f1289077cc78 --> d937f76e_061f_a631_9587_336503c9a15c 76672dd6_4e87_4468_a48b_f4da793fd211["index.ts"] 020681fa_600e_5c84_6a4e_f1289077cc78 --> 76672dd6_4e87_4468_a48b_f4da793fd211 ab8fc425_80ef_461f_288a_985447c26d02["constants"] 020681fa_600e_5c84_6a4e_f1289077cc78 --> ab8fc425_80ef_461f_288a_985447c26d02 0f9c49cb_fc8a_5f02_c6c9_10188c13531b["element"] 020681fa_600e_5c84_6a4e_f1289077cc78 --> 0f9c49cb_fc8a_5f02_c6c9_10188c13531b style 020681fa_600e_5c84_6a4e_f1289077cc78 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Virtual DOM patching algorithm based on Snabbdom by
* Simon Friis Vindum (@paldepind)
* Licensed under the MIT License
* https://github.com/paldepind/snabbdom/blob/master/LICENSE
*
* modified by Evan You (@yyx990803)
*
* Not type-checking this because this file is perf-critical and the cost
* of making flow understand it is not worth it.
*/
import VNode, { cloneVNode } from './vnode'
import config from '../config'
import { SSR_ATTR } from 'shared/constants'
import { registerRef } from './modules/template-ref'
import { traverse } from '../observer/traverse'
import { activeInstance } from '../instance/lifecycle'
import { isTextInputType } from 'web/util/element'
import {
warn,
isDef,
isUndef,
isTrue,
isArray,
makeMap,
isRegExp,
isPrimitive
} from '../util/index'
export const emptyNode = new VNode('', {}, [])
const hooks = ['create', 'activate', 'update', 'remove', 'destroy']
function sameVnode(a, b) {
return (
a.key === b.key &&
a.asyncFactory === b.asyncFactory &&
((a.tag === b.tag &&
a.isComment === b.isComment &&
isDef(a.data) === isDef(b.data) &&
sameInputType(a, b)) ||
(isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error)))
)
}
function sameInputType(a, b) {
if (a.tag !== 'input') return true
let i
const typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type
const typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type
return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB))
}
function createKeyToOldIdx(children, beginIdx, endIdx) {
let i, key
const map = {}
for (i = beginIdx; i <= endIdx; ++i) {
key = children[i].key
// ... (848 more lines)
Domain
Subdomains
Dependencies
Source
Frequently Asked Questions
What does patch.ts do?
patch.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, Observer subdomain.
What functions are defined in patch.ts?
patch.ts defines 4 function(s): createKeyToOldIdx, createPatchFunction, sameInputType, sameVnode.
What does patch.ts depend on?
patch.ts imports 10 module(s): config.ts, constants, element, index.ts, lifecycle.ts, registerRef, template-ref.ts, traverse, and 2 more.
Where is patch.ts in the architecture?
patch.ts is located at src/core/vdom/patch.ts (domain: VueCore, subdomain: Observer, directory: src/core/vdom).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free