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 0df06241_48e0_316d_48c2_6f91c7a049b1["patch.ts"] a13b4a2c_7af7_bcfd_03a9_13286f908ca0["vnode.ts"] 0df06241_48e0_316d_48c2_6f91c7a049b1 --> a13b4a2c_7af7_bcfd_03a9_13286f908ca0 d22f3dff_cc24_705a_1193_eec206dcb1d5["config.ts"] 0df06241_48e0_316d_48c2_6f91c7a049b1 --> d22f3dff_cc24_705a_1193_eec206dcb1d5 ceeb9b13_34d7_177d_f00f_e9f463e6ebb5["template-ref.ts"] 0df06241_48e0_316d_48c2_6f91c7a049b1 --> ceeb9b13_34d7_177d_f00f_e9f463e6ebb5 e4d4b46d_5073_fac6_177d_53fc5028052b["registerRef"] 0df06241_48e0_316d_48c2_6f91c7a049b1 --> e4d4b46d_5073_fac6_177d_53fc5028052b e9c21780_b26b_d883_76bb_2657a89bfce1["traverse.ts"] 0df06241_48e0_316d_48c2_6f91c7a049b1 --> e9c21780_b26b_d883_76bb_2657a89bfce1 4b47a246_a6fe_7a21_1238_3f5ce49d861f["traverse"] 0df06241_48e0_316d_48c2_6f91c7a049b1 --> 4b47a246_a6fe_7a21_1238_3f5ce49d861f f3560440_54c1_5663_36f8_c7de54d7310b["lifecycle.ts"] 0df06241_48e0_316d_48c2_6f91c7a049b1 --> f3560440_54c1_5663_36f8_c7de54d7310b 2a298df2_21b8_7e5a_c372_51ba50c9d92d["index.ts"] 0df06241_48e0_316d_48c2_6f91c7a049b1 --> 2a298df2_21b8_7e5a_c372_51ba50c9d92d 19d0b34b_7289_2457_32d9_273105740f2a["constants"] 0df06241_48e0_316d_48c2_6f91c7a049b1 --> 19d0b34b_7289_2457_32d9_273105740f2a 2c8b481d_d43d_0baa_2ed5_d309549d5e69["element"] 0df06241_48e0_316d_48c2_6f91c7a049b1 --> 2c8b481d_d43d_0baa_2ed5_d309549d5e69 style 0df06241_48e0_316d_48c2_6f91c7a049b1 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 CoreRuntime domain, VirtualDOM 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: CoreRuntime, subdomain: VirtualDOM, directory: src/core/vdom).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free