1 | /**
|
---|
2 | * @vue/runtime-core v3.5.13
|
---|
3 | * (c) 2018-present Yuxi (Evan) You and Vue contributors
|
---|
4 | * @license MIT
|
---|
5 | **/
|
---|
6 | 'use strict';
|
---|
7 |
|
---|
8 | Object.defineProperty(exports, '__esModule', { value: true });
|
---|
9 |
|
---|
10 | var reactivity = require('@vue/reactivity');
|
---|
11 | var shared = require('@vue/shared');
|
---|
12 |
|
---|
13 | function pushWarningContext(vnode) {
|
---|
14 | }
|
---|
15 | function popWarningContext() {
|
---|
16 | }
|
---|
17 | function assertNumber(val, type) {
|
---|
18 | return;
|
---|
19 | }
|
---|
20 |
|
---|
21 | const ErrorCodes = {
|
---|
22 | "SETUP_FUNCTION": 0,
|
---|
23 | "0": "SETUP_FUNCTION",
|
---|
24 | "RENDER_FUNCTION": 1,
|
---|
25 | "1": "RENDER_FUNCTION",
|
---|
26 | "NATIVE_EVENT_HANDLER": 5,
|
---|
27 | "5": "NATIVE_EVENT_HANDLER",
|
---|
28 | "COMPONENT_EVENT_HANDLER": 6,
|
---|
29 | "6": "COMPONENT_EVENT_HANDLER",
|
---|
30 | "VNODE_HOOK": 7,
|
---|
31 | "7": "VNODE_HOOK",
|
---|
32 | "DIRECTIVE_HOOK": 8,
|
---|
33 | "8": "DIRECTIVE_HOOK",
|
---|
34 | "TRANSITION_HOOK": 9,
|
---|
35 | "9": "TRANSITION_HOOK",
|
---|
36 | "APP_ERROR_HANDLER": 10,
|
---|
37 | "10": "APP_ERROR_HANDLER",
|
---|
38 | "APP_WARN_HANDLER": 11,
|
---|
39 | "11": "APP_WARN_HANDLER",
|
---|
40 | "FUNCTION_REF": 12,
|
---|
41 | "12": "FUNCTION_REF",
|
---|
42 | "ASYNC_COMPONENT_LOADER": 13,
|
---|
43 | "13": "ASYNC_COMPONENT_LOADER",
|
---|
44 | "SCHEDULER": 14,
|
---|
45 | "14": "SCHEDULER",
|
---|
46 | "COMPONENT_UPDATE": 15,
|
---|
47 | "15": "COMPONENT_UPDATE",
|
---|
48 | "APP_UNMOUNT_CLEANUP": 16,
|
---|
49 | "16": "APP_UNMOUNT_CLEANUP"
|
---|
50 | };
|
---|
51 | const ErrorTypeStrings$1 = {
|
---|
52 | ["sp"]: "serverPrefetch hook",
|
---|
53 | ["bc"]: "beforeCreate hook",
|
---|
54 | ["c"]: "created hook",
|
---|
55 | ["bm"]: "beforeMount hook",
|
---|
56 | ["m"]: "mounted hook",
|
---|
57 | ["bu"]: "beforeUpdate hook",
|
---|
58 | ["u"]: "updated",
|
---|
59 | ["bum"]: "beforeUnmount hook",
|
---|
60 | ["um"]: "unmounted hook",
|
---|
61 | ["a"]: "activated hook",
|
---|
62 | ["da"]: "deactivated hook",
|
---|
63 | ["ec"]: "errorCaptured hook",
|
---|
64 | ["rtc"]: "renderTracked hook",
|
---|
65 | ["rtg"]: "renderTriggered hook",
|
---|
66 | [0]: "setup function",
|
---|
67 | [1]: "render function",
|
---|
68 | [2]: "watcher getter",
|
---|
69 | [3]: "watcher callback",
|
---|
70 | [4]: "watcher cleanup function",
|
---|
71 | [5]: "native event handler",
|
---|
72 | [6]: "component event handler",
|
---|
73 | [7]: "vnode hook",
|
---|
74 | [8]: "directive hook",
|
---|
75 | [9]: "transition hook",
|
---|
76 | [10]: "app errorHandler",
|
---|
77 | [11]: "app warnHandler",
|
---|
78 | [12]: "ref function",
|
---|
79 | [13]: "async component loader",
|
---|
80 | [14]: "scheduler flush",
|
---|
81 | [15]: "component update",
|
---|
82 | [16]: "app unmount cleanup function"
|
---|
83 | };
|
---|
84 | function callWithErrorHandling(fn, instance, type, args) {
|
---|
85 | try {
|
---|
86 | return args ? fn(...args) : fn();
|
---|
87 | } catch (err) {
|
---|
88 | handleError(err, instance, type);
|
---|
89 | }
|
---|
90 | }
|
---|
91 | function callWithAsyncErrorHandling(fn, instance, type, args) {
|
---|
92 | if (shared.isFunction(fn)) {
|
---|
93 | const res = callWithErrorHandling(fn, instance, type, args);
|
---|
94 | if (res && shared.isPromise(res)) {
|
---|
95 | res.catch((err) => {
|
---|
96 | handleError(err, instance, type);
|
---|
97 | });
|
---|
98 | }
|
---|
99 | return res;
|
---|
100 | }
|
---|
101 | if (shared.isArray(fn)) {
|
---|
102 | const values = [];
|
---|
103 | for (let i = 0; i < fn.length; i++) {
|
---|
104 | values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
---|
105 | }
|
---|
106 | return values;
|
---|
107 | }
|
---|
108 | }
|
---|
109 | function handleError(err, instance, type, throwInDev = true) {
|
---|
110 | const contextVNode = instance ? instance.vnode : null;
|
---|
111 | const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || shared.EMPTY_OBJ;
|
---|
112 | if (instance) {
|
---|
113 | let cur = instance.parent;
|
---|
114 | const exposedInstance = instance.proxy;
|
---|
115 | const errorInfo = `https://vuejs.org/error-reference/#runtime-${type}`;
|
---|
116 | while (cur) {
|
---|
117 | const errorCapturedHooks = cur.ec;
|
---|
118 | if (errorCapturedHooks) {
|
---|
119 | for (let i = 0; i < errorCapturedHooks.length; i++) {
|
---|
120 | if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
---|
121 | return;
|
---|
122 | }
|
---|
123 | }
|
---|
124 | }
|
---|
125 | cur = cur.parent;
|
---|
126 | }
|
---|
127 | if (errorHandler) {
|
---|
128 | reactivity.pauseTracking();
|
---|
129 | callWithErrorHandling(errorHandler, null, 10, [
|
---|
130 | err,
|
---|
131 | exposedInstance,
|
---|
132 | errorInfo
|
---|
133 | ]);
|
---|
134 | reactivity.resetTracking();
|
---|
135 | return;
|
---|
136 | }
|
---|
137 | }
|
---|
138 | logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
|
---|
139 | }
|
---|
140 | function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
|
---|
141 | if (throwInProd) {
|
---|
142 | throw err;
|
---|
143 | } else {
|
---|
144 | console.error(err);
|
---|
145 | }
|
---|
146 | }
|
---|
147 |
|
---|
148 | const queue = [];
|
---|
149 | let flushIndex = -1;
|
---|
150 | const pendingPostFlushCbs = [];
|
---|
151 | let activePostFlushCbs = null;
|
---|
152 | let postFlushIndex = 0;
|
---|
153 | const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
---|
154 | let currentFlushPromise = null;
|
---|
155 | function nextTick(fn) {
|
---|
156 | const p = currentFlushPromise || resolvedPromise;
|
---|
157 | return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
---|
158 | }
|
---|
159 | function findInsertionIndex(id) {
|
---|
160 | let start = flushIndex + 1;
|
---|
161 | let end = queue.length;
|
---|
162 | while (start < end) {
|
---|
163 | const middle = start + end >>> 1;
|
---|
164 | const middleJob = queue[middle];
|
---|
165 | const middleJobId = getId(middleJob);
|
---|
166 | if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
---|
167 | start = middle + 1;
|
---|
168 | } else {
|
---|
169 | end = middle;
|
---|
170 | }
|
---|
171 | }
|
---|
172 | return start;
|
---|
173 | }
|
---|
174 | function queueJob(job) {
|
---|
175 | if (!(job.flags & 1)) {
|
---|
176 | const jobId = getId(job);
|
---|
177 | const lastJob = queue[queue.length - 1];
|
---|
178 | if (!lastJob || // fast path when the job id is larger than the tail
|
---|
179 | !(job.flags & 2) && jobId >= getId(lastJob)) {
|
---|
180 | queue.push(job);
|
---|
181 | } else {
|
---|
182 | queue.splice(findInsertionIndex(jobId), 0, job);
|
---|
183 | }
|
---|
184 | job.flags |= 1;
|
---|
185 | queueFlush();
|
---|
186 | }
|
---|
187 | }
|
---|
188 | function queueFlush() {
|
---|
189 | if (!currentFlushPromise) {
|
---|
190 | currentFlushPromise = resolvedPromise.then(flushJobs);
|
---|
191 | }
|
---|
192 | }
|
---|
193 | function queuePostFlushCb(cb) {
|
---|
194 | if (!shared.isArray(cb)) {
|
---|
195 | if (activePostFlushCbs && cb.id === -1) {
|
---|
196 | activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
|
---|
197 | } else if (!(cb.flags & 1)) {
|
---|
198 | pendingPostFlushCbs.push(cb);
|
---|
199 | cb.flags |= 1;
|
---|
200 | }
|
---|
201 | } else {
|
---|
202 | pendingPostFlushCbs.push(...cb);
|
---|
203 | }
|
---|
204 | queueFlush();
|
---|
205 | }
|
---|
206 | function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
|
---|
207 | for (; i < queue.length; i++) {
|
---|
208 | const cb = queue[i];
|
---|
209 | if (cb && cb.flags & 2) {
|
---|
210 | if (instance && cb.id !== instance.uid) {
|
---|
211 | continue;
|
---|
212 | }
|
---|
213 | queue.splice(i, 1);
|
---|
214 | i--;
|
---|
215 | if (cb.flags & 4) {
|
---|
216 | cb.flags &= ~1;
|
---|
217 | }
|
---|
218 | cb();
|
---|
219 | if (!(cb.flags & 4)) {
|
---|
220 | cb.flags &= ~1;
|
---|
221 | }
|
---|
222 | }
|
---|
223 | }
|
---|
224 | }
|
---|
225 | function flushPostFlushCbs(seen) {
|
---|
226 | if (pendingPostFlushCbs.length) {
|
---|
227 | const deduped = [...new Set(pendingPostFlushCbs)].sort(
|
---|
228 | (a, b) => getId(a) - getId(b)
|
---|
229 | );
|
---|
230 | pendingPostFlushCbs.length = 0;
|
---|
231 | if (activePostFlushCbs) {
|
---|
232 | activePostFlushCbs.push(...deduped);
|
---|
233 | return;
|
---|
234 | }
|
---|
235 | activePostFlushCbs = deduped;
|
---|
236 | for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
---|
237 | const cb = activePostFlushCbs[postFlushIndex];
|
---|
238 | if (cb.flags & 4) {
|
---|
239 | cb.flags &= ~1;
|
---|
240 | }
|
---|
241 | if (!(cb.flags & 8)) cb();
|
---|
242 | cb.flags &= ~1;
|
---|
243 | }
|
---|
244 | activePostFlushCbs = null;
|
---|
245 | postFlushIndex = 0;
|
---|
246 | }
|
---|
247 | }
|
---|
248 | const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
---|
249 | function flushJobs(seen) {
|
---|
250 | try {
|
---|
251 | for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
---|
252 | const job = queue[flushIndex];
|
---|
253 | if (job && !(job.flags & 8)) {
|
---|
254 | if (false) ;
|
---|
255 | if (job.flags & 4) {
|
---|
256 | job.flags &= ~1;
|
---|
257 | }
|
---|
258 | callWithErrorHandling(
|
---|
259 | job,
|
---|
260 | job.i,
|
---|
261 | job.i ? 15 : 14
|
---|
262 | );
|
---|
263 | if (!(job.flags & 4)) {
|
---|
264 | job.flags &= ~1;
|
---|
265 | }
|
---|
266 | }
|
---|
267 | }
|
---|
268 | } finally {
|
---|
269 | for (; flushIndex < queue.length; flushIndex++) {
|
---|
270 | const job = queue[flushIndex];
|
---|
271 | if (job) {
|
---|
272 | job.flags &= ~1;
|
---|
273 | }
|
---|
274 | }
|
---|
275 | flushIndex = -1;
|
---|
276 | queue.length = 0;
|
---|
277 | flushPostFlushCbs();
|
---|
278 | currentFlushPromise = null;
|
---|
279 | if (queue.length || pendingPostFlushCbs.length) {
|
---|
280 | flushJobs();
|
---|
281 | }
|
---|
282 | }
|
---|
283 | }
|
---|
284 |
|
---|
285 | let currentRenderingInstance = null;
|
---|
286 | let currentScopeId = null;
|
---|
287 | function setCurrentRenderingInstance(instance) {
|
---|
288 | const prev = currentRenderingInstance;
|
---|
289 | currentRenderingInstance = instance;
|
---|
290 | currentScopeId = instance && instance.type.__scopeId || null;
|
---|
291 | return prev;
|
---|
292 | }
|
---|
293 | function pushScopeId(id) {
|
---|
294 | currentScopeId = id;
|
---|
295 | }
|
---|
296 | function popScopeId() {
|
---|
297 | currentScopeId = null;
|
---|
298 | }
|
---|
299 | const withScopeId = (_id) => withCtx;
|
---|
300 | function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
---|
301 | if (!ctx) return fn;
|
---|
302 | if (fn._n) {
|
---|
303 | return fn;
|
---|
304 | }
|
---|
305 | const renderFnWithContext = (...args) => {
|
---|
306 | if (renderFnWithContext._d) {
|
---|
307 | setBlockTracking(-1);
|
---|
308 | }
|
---|
309 | const prevInstance = setCurrentRenderingInstance(ctx);
|
---|
310 | let res;
|
---|
311 | try {
|
---|
312 | res = fn(...args);
|
---|
313 | } finally {
|
---|
314 | setCurrentRenderingInstance(prevInstance);
|
---|
315 | if (renderFnWithContext._d) {
|
---|
316 | setBlockTracking(1);
|
---|
317 | }
|
---|
318 | }
|
---|
319 | return res;
|
---|
320 | };
|
---|
321 | renderFnWithContext._n = true;
|
---|
322 | renderFnWithContext._c = true;
|
---|
323 | renderFnWithContext._d = true;
|
---|
324 | return renderFnWithContext;
|
---|
325 | }
|
---|
326 |
|
---|
327 | function withDirectives(vnode, directives) {
|
---|
328 | if (currentRenderingInstance === null) {
|
---|
329 | return vnode;
|
---|
330 | }
|
---|
331 | const instance = getComponentPublicInstance(currentRenderingInstance);
|
---|
332 | const bindings = vnode.dirs || (vnode.dirs = []);
|
---|
333 | for (let i = 0; i < directives.length; i++) {
|
---|
334 | let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
|
---|
335 | if (dir) {
|
---|
336 | if (shared.isFunction(dir)) {
|
---|
337 | dir = {
|
---|
338 | mounted: dir,
|
---|
339 | updated: dir
|
---|
340 | };
|
---|
341 | }
|
---|
342 | if (dir.deep) {
|
---|
343 | reactivity.traverse(value);
|
---|
344 | }
|
---|
345 | bindings.push({
|
---|
346 | dir,
|
---|
347 | instance,
|
---|
348 | value,
|
---|
349 | oldValue: void 0,
|
---|
350 | arg,
|
---|
351 | modifiers
|
---|
352 | });
|
---|
353 | }
|
---|
354 | }
|
---|
355 | return vnode;
|
---|
356 | }
|
---|
357 | function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
---|
358 | const bindings = vnode.dirs;
|
---|
359 | const oldBindings = prevVNode && prevVNode.dirs;
|
---|
360 | for (let i = 0; i < bindings.length; i++) {
|
---|
361 | const binding = bindings[i];
|
---|
362 | if (oldBindings) {
|
---|
363 | binding.oldValue = oldBindings[i].value;
|
---|
364 | }
|
---|
365 | let hook = binding.dir[name];
|
---|
366 | if (hook) {
|
---|
367 | reactivity.pauseTracking();
|
---|
368 | callWithAsyncErrorHandling(hook, instance, 8, [
|
---|
369 | vnode.el,
|
---|
370 | binding,
|
---|
371 | vnode,
|
---|
372 | prevVNode
|
---|
373 | ]);
|
---|
374 | reactivity.resetTracking();
|
---|
375 | }
|
---|
376 | }
|
---|
377 | }
|
---|
378 |
|
---|
379 | const TeleportEndKey = Symbol("_vte");
|
---|
380 | const isTeleport = (type) => type.__isTeleport;
|
---|
381 | const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
---|
382 | const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
|
---|
383 | const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
|
---|
384 | const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
|
---|
385 | const resolveTarget = (props, select) => {
|
---|
386 | const targetSelector = props && props.to;
|
---|
387 | if (shared.isString(targetSelector)) {
|
---|
388 | if (!select) {
|
---|
389 | return null;
|
---|
390 | } else {
|
---|
391 | const target = select(targetSelector);
|
---|
392 | return target;
|
---|
393 | }
|
---|
394 | } else {
|
---|
395 | return targetSelector;
|
---|
396 | }
|
---|
397 | };
|
---|
398 | const TeleportImpl = {
|
---|
399 | name: "Teleport",
|
---|
400 | __isTeleport: true,
|
---|
401 | process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
---|
402 | const {
|
---|
403 | mc: mountChildren,
|
---|
404 | pc: patchChildren,
|
---|
405 | pbc: patchBlockChildren,
|
---|
406 | o: { insert, querySelector, createText, createComment }
|
---|
407 | } = internals;
|
---|
408 | const disabled = isTeleportDisabled(n2.props);
|
---|
409 | let { shapeFlag, children, dynamicChildren } = n2;
|
---|
410 | if (n1 == null) {
|
---|
411 | const placeholder = n2.el = createText("");
|
---|
412 | const mainAnchor = n2.anchor = createText("");
|
---|
413 | insert(placeholder, container, anchor);
|
---|
414 | insert(mainAnchor, container, anchor);
|
---|
415 | const mount = (container2, anchor2) => {
|
---|
416 | if (shapeFlag & 16) {
|
---|
417 | if (parentComponent && parentComponent.isCE) {
|
---|
418 | parentComponent.ce._teleportTarget = container2;
|
---|
419 | }
|
---|
420 | mountChildren(
|
---|
421 | children,
|
---|
422 | container2,
|
---|
423 | anchor2,
|
---|
424 | parentComponent,
|
---|
425 | parentSuspense,
|
---|
426 | namespace,
|
---|
427 | slotScopeIds,
|
---|
428 | optimized
|
---|
429 | );
|
---|
430 | }
|
---|
431 | };
|
---|
432 | const mountToTarget = () => {
|
---|
433 | const target = n2.target = resolveTarget(n2.props, querySelector);
|
---|
434 | const targetAnchor = prepareAnchor(target, n2, createText, insert);
|
---|
435 | if (target) {
|
---|
436 | if (namespace !== "svg" && isTargetSVG(target)) {
|
---|
437 | namespace = "svg";
|
---|
438 | } else if (namespace !== "mathml" && isTargetMathML(target)) {
|
---|
439 | namespace = "mathml";
|
---|
440 | }
|
---|
441 | if (!disabled) {
|
---|
442 | mount(target, targetAnchor);
|
---|
443 | updateCssVars(n2, false);
|
---|
444 | }
|
---|
445 | }
|
---|
446 | };
|
---|
447 | if (disabled) {
|
---|
448 | mount(container, mainAnchor);
|
---|
449 | updateCssVars(n2, true);
|
---|
450 | }
|
---|
451 | if (isTeleportDeferred(n2.props)) {
|
---|
452 | queuePostRenderEffect(() => {
|
---|
453 | mountToTarget();
|
---|
454 | n2.el.__isMounted = true;
|
---|
455 | }, parentSuspense);
|
---|
456 | } else {
|
---|
457 | mountToTarget();
|
---|
458 | }
|
---|
459 | } else {
|
---|
460 | if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) {
|
---|
461 | queuePostRenderEffect(() => {
|
---|
462 | TeleportImpl.process(
|
---|
463 | n1,
|
---|
464 | n2,
|
---|
465 | container,
|
---|
466 | anchor,
|
---|
467 | parentComponent,
|
---|
468 | parentSuspense,
|
---|
469 | namespace,
|
---|
470 | slotScopeIds,
|
---|
471 | optimized,
|
---|
472 | internals
|
---|
473 | );
|
---|
474 | delete n1.el.__isMounted;
|
---|
475 | }, parentSuspense);
|
---|
476 | return;
|
---|
477 | }
|
---|
478 | n2.el = n1.el;
|
---|
479 | n2.targetStart = n1.targetStart;
|
---|
480 | const mainAnchor = n2.anchor = n1.anchor;
|
---|
481 | const target = n2.target = n1.target;
|
---|
482 | const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
---|
483 | const wasDisabled = isTeleportDisabled(n1.props);
|
---|
484 | const currentContainer = wasDisabled ? container : target;
|
---|
485 | const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
---|
486 | if (namespace === "svg" || isTargetSVG(target)) {
|
---|
487 | namespace = "svg";
|
---|
488 | } else if (namespace === "mathml" || isTargetMathML(target)) {
|
---|
489 | namespace = "mathml";
|
---|
490 | }
|
---|
491 | if (dynamicChildren) {
|
---|
492 | patchBlockChildren(
|
---|
493 | n1.dynamicChildren,
|
---|
494 | dynamicChildren,
|
---|
495 | currentContainer,
|
---|
496 | parentComponent,
|
---|
497 | parentSuspense,
|
---|
498 | namespace,
|
---|
499 | slotScopeIds
|
---|
500 | );
|
---|
501 | traverseStaticChildren(n1, n2, true);
|
---|
502 | } else if (!optimized) {
|
---|
503 | patchChildren(
|
---|
504 | n1,
|
---|
505 | n2,
|
---|
506 | currentContainer,
|
---|
507 | currentAnchor,
|
---|
508 | parentComponent,
|
---|
509 | parentSuspense,
|
---|
510 | namespace,
|
---|
511 | slotScopeIds,
|
---|
512 | false
|
---|
513 | );
|
---|
514 | }
|
---|
515 | if (disabled) {
|
---|
516 | if (!wasDisabled) {
|
---|
517 | moveTeleport(
|
---|
518 | n2,
|
---|
519 | container,
|
---|
520 | mainAnchor,
|
---|
521 | internals,
|
---|
522 | 1
|
---|
523 | );
|
---|
524 | } else {
|
---|
525 | if (n2.props && n1.props && n2.props.to !== n1.props.to) {
|
---|
526 | n2.props.to = n1.props.to;
|
---|
527 | }
|
---|
528 | }
|
---|
529 | } else {
|
---|
530 | if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
---|
531 | const nextTarget = n2.target = resolveTarget(
|
---|
532 | n2.props,
|
---|
533 | querySelector
|
---|
534 | );
|
---|
535 | if (nextTarget) {
|
---|
536 | moveTeleport(
|
---|
537 | n2,
|
---|
538 | nextTarget,
|
---|
539 | null,
|
---|
540 | internals,
|
---|
541 | 0
|
---|
542 | );
|
---|
543 | }
|
---|
544 | } else if (wasDisabled) {
|
---|
545 | moveTeleport(
|
---|
546 | n2,
|
---|
547 | target,
|
---|
548 | targetAnchor,
|
---|
549 | internals,
|
---|
550 | 1
|
---|
551 | );
|
---|
552 | }
|
---|
553 | }
|
---|
554 | updateCssVars(n2, disabled);
|
---|
555 | }
|
---|
556 | },
|
---|
557 | remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
---|
558 | const {
|
---|
559 | shapeFlag,
|
---|
560 | children,
|
---|
561 | anchor,
|
---|
562 | targetStart,
|
---|
563 | targetAnchor,
|
---|
564 | target,
|
---|
565 | props
|
---|
566 | } = vnode;
|
---|
567 | if (target) {
|
---|
568 | hostRemove(targetStart);
|
---|
569 | hostRemove(targetAnchor);
|
---|
570 | }
|
---|
571 | doRemove && hostRemove(anchor);
|
---|
572 | if (shapeFlag & 16) {
|
---|
573 | const shouldRemove = doRemove || !isTeleportDisabled(props);
|
---|
574 | for (let i = 0; i < children.length; i++) {
|
---|
575 | const child = children[i];
|
---|
576 | unmount(
|
---|
577 | child,
|
---|
578 | parentComponent,
|
---|
579 | parentSuspense,
|
---|
580 | shouldRemove,
|
---|
581 | !!child.dynamicChildren
|
---|
582 | );
|
---|
583 | }
|
---|
584 | }
|
---|
585 | },
|
---|
586 | move: moveTeleport,
|
---|
587 | hydrate: hydrateTeleport
|
---|
588 | };
|
---|
589 | function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
---|
590 | if (moveType === 0) {
|
---|
591 | insert(vnode.targetAnchor, container, parentAnchor);
|
---|
592 | }
|
---|
593 | const { el, anchor, shapeFlag, children, props } = vnode;
|
---|
594 | const isReorder = moveType === 2;
|
---|
595 | if (isReorder) {
|
---|
596 | insert(el, container, parentAnchor);
|
---|
597 | }
|
---|
598 | if (!isReorder || isTeleportDisabled(props)) {
|
---|
599 | if (shapeFlag & 16) {
|
---|
600 | for (let i = 0; i < children.length; i++) {
|
---|
601 | move(
|
---|
602 | children[i],
|
---|
603 | container,
|
---|
604 | parentAnchor,
|
---|
605 | 2
|
---|
606 | );
|
---|
607 | }
|
---|
608 | }
|
---|
609 | }
|
---|
610 | if (isReorder) {
|
---|
611 | insert(anchor, container, parentAnchor);
|
---|
612 | }
|
---|
613 | }
|
---|
614 | function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
|
---|
615 | o: { nextSibling, parentNode, querySelector, insert, createText }
|
---|
616 | }, hydrateChildren) {
|
---|
617 | const target = vnode.target = resolveTarget(
|
---|
618 | vnode.props,
|
---|
619 | querySelector
|
---|
620 | );
|
---|
621 | if (target) {
|
---|
622 | const disabled = isTeleportDisabled(vnode.props);
|
---|
623 | const targetNode = target._lpa || target.firstChild;
|
---|
624 | if (vnode.shapeFlag & 16) {
|
---|
625 | if (disabled) {
|
---|
626 | vnode.anchor = hydrateChildren(
|
---|
627 | nextSibling(node),
|
---|
628 | vnode,
|
---|
629 | parentNode(node),
|
---|
630 | parentComponent,
|
---|
631 | parentSuspense,
|
---|
632 | slotScopeIds,
|
---|
633 | optimized
|
---|
634 | );
|
---|
635 | vnode.targetStart = targetNode;
|
---|
636 | vnode.targetAnchor = targetNode && nextSibling(targetNode);
|
---|
637 | } else {
|
---|
638 | vnode.anchor = nextSibling(node);
|
---|
639 | let targetAnchor = targetNode;
|
---|
640 | while (targetAnchor) {
|
---|
641 | if (targetAnchor && targetAnchor.nodeType === 8) {
|
---|
642 | if (targetAnchor.data === "teleport start anchor") {
|
---|
643 | vnode.targetStart = targetAnchor;
|
---|
644 | } else if (targetAnchor.data === "teleport anchor") {
|
---|
645 | vnode.targetAnchor = targetAnchor;
|
---|
646 | target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
---|
647 | break;
|
---|
648 | }
|
---|
649 | }
|
---|
650 | targetAnchor = nextSibling(targetAnchor);
|
---|
651 | }
|
---|
652 | if (!vnode.targetAnchor) {
|
---|
653 | prepareAnchor(target, vnode, createText, insert);
|
---|
654 | }
|
---|
655 | hydrateChildren(
|
---|
656 | targetNode && nextSibling(targetNode),
|
---|
657 | vnode,
|
---|
658 | target,
|
---|
659 | parentComponent,
|
---|
660 | parentSuspense,
|
---|
661 | slotScopeIds,
|
---|
662 | optimized
|
---|
663 | );
|
---|
664 | }
|
---|
665 | }
|
---|
666 | updateCssVars(vnode, disabled);
|
---|
667 | }
|
---|
668 | return vnode.anchor && nextSibling(vnode.anchor);
|
---|
669 | }
|
---|
670 | const Teleport = TeleportImpl;
|
---|
671 | function updateCssVars(vnode, isDisabled) {
|
---|
672 | const ctx = vnode.ctx;
|
---|
673 | if (ctx && ctx.ut) {
|
---|
674 | let node, anchor;
|
---|
675 | if (isDisabled) {
|
---|
676 | node = vnode.el;
|
---|
677 | anchor = vnode.anchor;
|
---|
678 | } else {
|
---|
679 | node = vnode.targetStart;
|
---|
680 | anchor = vnode.targetAnchor;
|
---|
681 | }
|
---|
682 | while (node && node !== anchor) {
|
---|
683 | if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
|
---|
684 | node = node.nextSibling;
|
---|
685 | }
|
---|
686 | ctx.ut();
|
---|
687 | }
|
---|
688 | }
|
---|
689 | function prepareAnchor(target, vnode, createText, insert) {
|
---|
690 | const targetStart = vnode.targetStart = createText("");
|
---|
691 | const targetAnchor = vnode.targetAnchor = createText("");
|
---|
692 | targetStart[TeleportEndKey] = targetAnchor;
|
---|
693 | if (target) {
|
---|
694 | insert(targetStart, target);
|
---|
695 | insert(targetAnchor, target);
|
---|
696 | }
|
---|
697 | return targetAnchor;
|
---|
698 | }
|
---|
699 |
|
---|
700 | const leaveCbKey = Symbol("_leaveCb");
|
---|
701 | const enterCbKey = Symbol("_enterCb");
|
---|
702 | function useTransitionState() {
|
---|
703 | const state = {
|
---|
704 | isMounted: false,
|
---|
705 | isLeaving: false,
|
---|
706 | isUnmounting: false,
|
---|
707 | leavingVNodes: /* @__PURE__ */ new Map()
|
---|
708 | };
|
---|
709 | onMounted(() => {
|
---|
710 | state.isMounted = true;
|
---|
711 | });
|
---|
712 | onBeforeUnmount(() => {
|
---|
713 | state.isUnmounting = true;
|
---|
714 | });
|
---|
715 | return state;
|
---|
716 | }
|
---|
717 | const TransitionHookValidator = [Function, Array];
|
---|
718 | const BaseTransitionPropsValidators = {
|
---|
719 | mode: String,
|
---|
720 | appear: Boolean,
|
---|
721 | persisted: Boolean,
|
---|
722 | // enter
|
---|
723 | onBeforeEnter: TransitionHookValidator,
|
---|
724 | onEnter: TransitionHookValidator,
|
---|
725 | onAfterEnter: TransitionHookValidator,
|
---|
726 | onEnterCancelled: TransitionHookValidator,
|
---|
727 | // leave
|
---|
728 | onBeforeLeave: TransitionHookValidator,
|
---|
729 | onLeave: TransitionHookValidator,
|
---|
730 | onAfterLeave: TransitionHookValidator,
|
---|
731 | onLeaveCancelled: TransitionHookValidator,
|
---|
732 | // appear
|
---|
733 | onBeforeAppear: TransitionHookValidator,
|
---|
734 | onAppear: TransitionHookValidator,
|
---|
735 | onAfterAppear: TransitionHookValidator,
|
---|
736 | onAppearCancelled: TransitionHookValidator
|
---|
737 | };
|
---|
738 | const recursiveGetSubtree = (instance) => {
|
---|
739 | const subTree = instance.subTree;
|
---|
740 | return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
|
---|
741 | };
|
---|
742 | const BaseTransitionImpl = {
|
---|
743 | name: `BaseTransition`,
|
---|
744 | props: BaseTransitionPropsValidators,
|
---|
745 | setup(props, { slots }) {
|
---|
746 | const instance = getCurrentInstance();
|
---|
747 | const state = useTransitionState();
|
---|
748 | return () => {
|
---|
749 | const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
---|
750 | if (!children || !children.length) {
|
---|
751 | return;
|
---|
752 | }
|
---|
753 | const child = findNonCommentChild(children);
|
---|
754 | const rawProps = reactivity.toRaw(props);
|
---|
755 | const { mode } = rawProps;
|
---|
756 | if (state.isLeaving) {
|
---|
757 | return emptyPlaceholder(child);
|
---|
758 | }
|
---|
759 | const innerChild = getInnerChild$1(child);
|
---|
760 | if (!innerChild) {
|
---|
761 | return emptyPlaceholder(child);
|
---|
762 | }
|
---|
763 | let enterHooks = resolveTransitionHooks(
|
---|
764 | innerChild,
|
---|
765 | rawProps,
|
---|
766 | state,
|
---|
767 | instance,
|
---|
768 | // #11061, ensure enterHooks is fresh after clone
|
---|
769 | (hooks) => enterHooks = hooks
|
---|
770 | );
|
---|
771 | if (innerChild.type !== Comment) {
|
---|
772 | setTransitionHooks(innerChild, enterHooks);
|
---|
773 | }
|
---|
774 | let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
|
---|
775 | if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
|
---|
776 | let leavingHooks = resolveTransitionHooks(
|
---|
777 | oldInnerChild,
|
---|
778 | rawProps,
|
---|
779 | state,
|
---|
780 | instance
|
---|
781 | );
|
---|
782 | setTransitionHooks(oldInnerChild, leavingHooks);
|
---|
783 | if (mode === "out-in" && innerChild.type !== Comment) {
|
---|
784 | state.isLeaving = true;
|
---|
785 | leavingHooks.afterLeave = () => {
|
---|
786 | state.isLeaving = false;
|
---|
787 | if (!(instance.job.flags & 8)) {
|
---|
788 | instance.update();
|
---|
789 | }
|
---|
790 | delete leavingHooks.afterLeave;
|
---|
791 | oldInnerChild = void 0;
|
---|
792 | };
|
---|
793 | return emptyPlaceholder(child);
|
---|
794 | } else if (mode === "in-out" && innerChild.type !== Comment) {
|
---|
795 | leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
---|
796 | const leavingVNodesCache = getLeavingNodesForType(
|
---|
797 | state,
|
---|
798 | oldInnerChild
|
---|
799 | );
|
---|
800 | leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
---|
801 | el[leaveCbKey] = () => {
|
---|
802 | earlyRemove();
|
---|
803 | el[leaveCbKey] = void 0;
|
---|
804 | delete enterHooks.delayedLeave;
|
---|
805 | oldInnerChild = void 0;
|
---|
806 | };
|
---|
807 | enterHooks.delayedLeave = () => {
|
---|
808 | delayedLeave();
|
---|
809 | delete enterHooks.delayedLeave;
|
---|
810 | oldInnerChild = void 0;
|
---|
811 | };
|
---|
812 | };
|
---|
813 | } else {
|
---|
814 | oldInnerChild = void 0;
|
---|
815 | }
|
---|
816 | } else if (oldInnerChild) {
|
---|
817 | oldInnerChild = void 0;
|
---|
818 | }
|
---|
819 | return child;
|
---|
820 | };
|
---|
821 | }
|
---|
822 | };
|
---|
823 | function findNonCommentChild(children) {
|
---|
824 | let child = children[0];
|
---|
825 | if (children.length > 1) {
|
---|
826 | for (const c of children) {
|
---|
827 | if (c.type !== Comment) {
|
---|
828 | child = c;
|
---|
829 | break;
|
---|
830 | }
|
---|
831 | }
|
---|
832 | }
|
---|
833 | return child;
|
---|
834 | }
|
---|
835 | const BaseTransition = BaseTransitionImpl;
|
---|
836 | function getLeavingNodesForType(state, vnode) {
|
---|
837 | const { leavingVNodes } = state;
|
---|
838 | let leavingVNodesCache = leavingVNodes.get(vnode.type);
|
---|
839 | if (!leavingVNodesCache) {
|
---|
840 | leavingVNodesCache = /* @__PURE__ */ Object.create(null);
|
---|
841 | leavingVNodes.set(vnode.type, leavingVNodesCache);
|
---|
842 | }
|
---|
843 | return leavingVNodesCache;
|
---|
844 | }
|
---|
845 | function resolveTransitionHooks(vnode, props, state, instance, postClone) {
|
---|
846 | const {
|
---|
847 | appear,
|
---|
848 | mode,
|
---|
849 | persisted = false,
|
---|
850 | onBeforeEnter,
|
---|
851 | onEnter,
|
---|
852 | onAfterEnter,
|
---|
853 | onEnterCancelled,
|
---|
854 | onBeforeLeave,
|
---|
855 | onLeave,
|
---|
856 | onAfterLeave,
|
---|
857 | onLeaveCancelled,
|
---|
858 | onBeforeAppear,
|
---|
859 | onAppear,
|
---|
860 | onAfterAppear,
|
---|
861 | onAppearCancelled
|
---|
862 | } = props;
|
---|
863 | const key = String(vnode.key);
|
---|
864 | const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
---|
865 | const callHook = (hook, args) => {
|
---|
866 | hook && callWithAsyncErrorHandling(
|
---|
867 | hook,
|
---|
868 | instance,
|
---|
869 | 9,
|
---|
870 | args
|
---|
871 | );
|
---|
872 | };
|
---|
873 | const callAsyncHook = (hook, args) => {
|
---|
874 | const done = args[1];
|
---|
875 | callHook(hook, args);
|
---|
876 | if (shared.isArray(hook)) {
|
---|
877 | if (hook.every((hook2) => hook2.length <= 1)) done();
|
---|
878 | } else if (hook.length <= 1) {
|
---|
879 | done();
|
---|
880 | }
|
---|
881 | };
|
---|
882 | const hooks = {
|
---|
883 | mode,
|
---|
884 | persisted,
|
---|
885 | beforeEnter(el) {
|
---|
886 | let hook = onBeforeEnter;
|
---|
887 | if (!state.isMounted) {
|
---|
888 | if (appear) {
|
---|
889 | hook = onBeforeAppear || onBeforeEnter;
|
---|
890 | } else {
|
---|
891 | return;
|
---|
892 | }
|
---|
893 | }
|
---|
894 | if (el[leaveCbKey]) {
|
---|
895 | el[leaveCbKey](
|
---|
896 | true
|
---|
897 | /* cancelled */
|
---|
898 | );
|
---|
899 | }
|
---|
900 | const leavingVNode = leavingVNodesCache[key];
|
---|
901 | if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
|
---|
902 | leavingVNode.el[leaveCbKey]();
|
---|
903 | }
|
---|
904 | callHook(hook, [el]);
|
---|
905 | },
|
---|
906 | enter(el) {
|
---|
907 | let hook = onEnter;
|
---|
908 | let afterHook = onAfterEnter;
|
---|
909 | let cancelHook = onEnterCancelled;
|
---|
910 | if (!state.isMounted) {
|
---|
911 | if (appear) {
|
---|
912 | hook = onAppear || onEnter;
|
---|
913 | afterHook = onAfterAppear || onAfterEnter;
|
---|
914 | cancelHook = onAppearCancelled || onEnterCancelled;
|
---|
915 | } else {
|
---|
916 | return;
|
---|
917 | }
|
---|
918 | }
|
---|
919 | let called = false;
|
---|
920 | const done = el[enterCbKey] = (cancelled) => {
|
---|
921 | if (called) return;
|
---|
922 | called = true;
|
---|
923 | if (cancelled) {
|
---|
924 | callHook(cancelHook, [el]);
|
---|
925 | } else {
|
---|
926 | callHook(afterHook, [el]);
|
---|
927 | }
|
---|
928 | if (hooks.delayedLeave) {
|
---|
929 | hooks.delayedLeave();
|
---|
930 | }
|
---|
931 | el[enterCbKey] = void 0;
|
---|
932 | };
|
---|
933 | if (hook) {
|
---|
934 | callAsyncHook(hook, [el, done]);
|
---|
935 | } else {
|
---|
936 | done();
|
---|
937 | }
|
---|
938 | },
|
---|
939 | leave(el, remove) {
|
---|
940 | const key2 = String(vnode.key);
|
---|
941 | if (el[enterCbKey]) {
|
---|
942 | el[enterCbKey](
|
---|
943 | true
|
---|
944 | /* cancelled */
|
---|
945 | );
|
---|
946 | }
|
---|
947 | if (state.isUnmounting) {
|
---|
948 | return remove();
|
---|
949 | }
|
---|
950 | callHook(onBeforeLeave, [el]);
|
---|
951 | let called = false;
|
---|
952 | const done = el[leaveCbKey] = (cancelled) => {
|
---|
953 | if (called) return;
|
---|
954 | called = true;
|
---|
955 | remove();
|
---|
956 | if (cancelled) {
|
---|
957 | callHook(onLeaveCancelled, [el]);
|
---|
958 | } else {
|
---|
959 | callHook(onAfterLeave, [el]);
|
---|
960 | }
|
---|
961 | el[leaveCbKey] = void 0;
|
---|
962 | if (leavingVNodesCache[key2] === vnode) {
|
---|
963 | delete leavingVNodesCache[key2];
|
---|
964 | }
|
---|
965 | };
|
---|
966 | leavingVNodesCache[key2] = vnode;
|
---|
967 | if (onLeave) {
|
---|
968 | callAsyncHook(onLeave, [el, done]);
|
---|
969 | } else {
|
---|
970 | done();
|
---|
971 | }
|
---|
972 | },
|
---|
973 | clone(vnode2) {
|
---|
974 | const hooks2 = resolveTransitionHooks(
|
---|
975 | vnode2,
|
---|
976 | props,
|
---|
977 | state,
|
---|
978 | instance,
|
---|
979 | postClone
|
---|
980 | );
|
---|
981 | if (postClone) postClone(hooks2);
|
---|
982 | return hooks2;
|
---|
983 | }
|
---|
984 | };
|
---|
985 | return hooks;
|
---|
986 | }
|
---|
987 | function emptyPlaceholder(vnode) {
|
---|
988 | if (isKeepAlive(vnode)) {
|
---|
989 | vnode = cloneVNode(vnode);
|
---|
990 | vnode.children = null;
|
---|
991 | return vnode;
|
---|
992 | }
|
---|
993 | }
|
---|
994 | function getInnerChild$1(vnode) {
|
---|
995 | if (!isKeepAlive(vnode)) {
|
---|
996 | if (isTeleport(vnode.type) && vnode.children) {
|
---|
997 | return findNonCommentChild(vnode.children);
|
---|
998 | }
|
---|
999 | return vnode;
|
---|
1000 | }
|
---|
1001 | const { shapeFlag, children } = vnode;
|
---|
1002 | if (children) {
|
---|
1003 | if (shapeFlag & 16) {
|
---|
1004 | return children[0];
|
---|
1005 | }
|
---|
1006 | if (shapeFlag & 32 && shared.isFunction(children.default)) {
|
---|
1007 | return children.default();
|
---|
1008 | }
|
---|
1009 | }
|
---|
1010 | }
|
---|
1011 | function setTransitionHooks(vnode, hooks) {
|
---|
1012 | if (vnode.shapeFlag & 6 && vnode.component) {
|
---|
1013 | vnode.transition = hooks;
|
---|
1014 | setTransitionHooks(vnode.component.subTree, hooks);
|
---|
1015 | } else if (vnode.shapeFlag & 128) {
|
---|
1016 | vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
---|
1017 | vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
---|
1018 | } else {
|
---|
1019 | vnode.transition = hooks;
|
---|
1020 | }
|
---|
1021 | }
|
---|
1022 | function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
---|
1023 | let ret = [];
|
---|
1024 | let keyedFragmentCount = 0;
|
---|
1025 | for (let i = 0; i < children.length; i++) {
|
---|
1026 | let child = children[i];
|
---|
1027 | const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
|
---|
1028 | if (child.type === Fragment) {
|
---|
1029 | if (child.patchFlag & 128) keyedFragmentCount++;
|
---|
1030 | ret = ret.concat(
|
---|
1031 | getTransitionRawChildren(child.children, keepComment, key)
|
---|
1032 | );
|
---|
1033 | } else if (keepComment || child.type !== Comment) {
|
---|
1034 | ret.push(key != null ? cloneVNode(child, { key }) : child);
|
---|
1035 | }
|
---|
1036 | }
|
---|
1037 | if (keyedFragmentCount > 1) {
|
---|
1038 | for (let i = 0; i < ret.length; i++) {
|
---|
1039 | ret[i].patchFlag = -2;
|
---|
1040 | }
|
---|
1041 | }
|
---|
1042 | return ret;
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 | /*! #__NO_SIDE_EFFECTS__ */
|
---|
1046 | // @__NO_SIDE_EFFECTS__
|
---|
1047 | function defineComponent(options, extraOptions) {
|
---|
1048 | return shared.isFunction(options) ? (
|
---|
1049 | // #8236: extend call and options.name access are considered side-effects
|
---|
1050 | // by Rollup, so we have to wrap it in a pure-annotated IIFE.
|
---|
1051 | /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
|
---|
1052 | ) : options;
|
---|
1053 | }
|
---|
1054 |
|
---|
1055 | function useId() {
|
---|
1056 | const i = getCurrentInstance();
|
---|
1057 | if (i) {
|
---|
1058 | return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
|
---|
1059 | }
|
---|
1060 | return "";
|
---|
1061 | }
|
---|
1062 | function markAsyncBoundary(instance) {
|
---|
1063 | instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
|
---|
1064 | }
|
---|
1065 |
|
---|
1066 | function useTemplateRef(key) {
|
---|
1067 | const i = getCurrentInstance();
|
---|
1068 | const r = reactivity.shallowRef(null);
|
---|
1069 | if (i) {
|
---|
1070 | const refs = i.refs === shared.EMPTY_OBJ ? i.refs = {} : i.refs;
|
---|
1071 | {
|
---|
1072 | Object.defineProperty(refs, key, {
|
---|
1073 | enumerable: true,
|
---|
1074 | get: () => r.value,
|
---|
1075 | set: (val) => r.value = val
|
---|
1076 | });
|
---|
1077 | }
|
---|
1078 | }
|
---|
1079 | const ret = r;
|
---|
1080 | return ret;
|
---|
1081 | }
|
---|
1082 |
|
---|
1083 | function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
---|
1084 | if (shared.isArray(rawRef)) {
|
---|
1085 | rawRef.forEach(
|
---|
1086 | (r, i) => setRef(
|
---|
1087 | r,
|
---|
1088 | oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
|
---|
1089 | parentSuspense,
|
---|
1090 | vnode,
|
---|
1091 | isUnmount
|
---|
1092 | )
|
---|
1093 | );
|
---|
1094 | return;
|
---|
1095 | }
|
---|
1096 | if (isAsyncWrapper(vnode) && !isUnmount) {
|
---|
1097 | if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
|
---|
1098 | setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
|
---|
1099 | }
|
---|
1100 | return;
|
---|
1101 | }
|
---|
1102 | const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
|
---|
1103 | const value = isUnmount ? null : refValue;
|
---|
1104 | const { i: owner, r: ref } = rawRef;
|
---|
1105 | const oldRef = oldRawRef && oldRawRef.r;
|
---|
1106 | const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
|
---|
1107 | const setupState = owner.setupState;
|
---|
1108 | const rawSetupState = reactivity.toRaw(setupState);
|
---|
1109 | const canSetSetupRef = setupState === shared.EMPTY_OBJ ? () => false : (key) => {
|
---|
1110 | return shared.hasOwn(rawSetupState, key);
|
---|
1111 | };
|
---|
1112 | if (oldRef != null && oldRef !== ref) {
|
---|
1113 | if (shared.isString(oldRef)) {
|
---|
1114 | refs[oldRef] = null;
|
---|
1115 | if (canSetSetupRef(oldRef)) {
|
---|
1116 | setupState[oldRef] = null;
|
---|
1117 | }
|
---|
1118 | } else if (reactivity.isRef(oldRef)) {
|
---|
1119 | oldRef.value = null;
|
---|
1120 | }
|
---|
1121 | }
|
---|
1122 | if (shared.isFunction(ref)) {
|
---|
1123 | callWithErrorHandling(ref, owner, 12, [value, refs]);
|
---|
1124 | } else {
|
---|
1125 | const _isString = shared.isString(ref);
|
---|
1126 | const _isRef = reactivity.isRef(ref);
|
---|
1127 | if (_isString || _isRef) {
|
---|
1128 | const doSet = () => {
|
---|
1129 | if (rawRef.f) {
|
---|
1130 | const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
|
---|
1131 | if (isUnmount) {
|
---|
1132 | shared.isArray(existing) && shared.remove(existing, refValue);
|
---|
1133 | } else {
|
---|
1134 | if (!shared.isArray(existing)) {
|
---|
1135 | if (_isString) {
|
---|
1136 | refs[ref] = [refValue];
|
---|
1137 | if (canSetSetupRef(ref)) {
|
---|
1138 | setupState[ref] = refs[ref];
|
---|
1139 | }
|
---|
1140 | } else {
|
---|
1141 | ref.value = [refValue];
|
---|
1142 | if (rawRef.k) refs[rawRef.k] = ref.value;
|
---|
1143 | }
|
---|
1144 | } else if (!existing.includes(refValue)) {
|
---|
1145 | existing.push(refValue);
|
---|
1146 | }
|
---|
1147 | }
|
---|
1148 | } else if (_isString) {
|
---|
1149 | refs[ref] = value;
|
---|
1150 | if (canSetSetupRef(ref)) {
|
---|
1151 | setupState[ref] = value;
|
---|
1152 | }
|
---|
1153 | } else if (_isRef) {
|
---|
1154 | ref.value = value;
|
---|
1155 | if (rawRef.k) refs[rawRef.k] = value;
|
---|
1156 | } else ;
|
---|
1157 | };
|
---|
1158 | if (value) {
|
---|
1159 | doSet.id = -1;
|
---|
1160 | queuePostRenderEffect(doSet, parentSuspense);
|
---|
1161 | } else {
|
---|
1162 | doSet();
|
---|
1163 | }
|
---|
1164 | }
|
---|
1165 | }
|
---|
1166 | }
|
---|
1167 |
|
---|
1168 | let hasLoggedMismatchError = false;
|
---|
1169 | const logMismatchError = () => {
|
---|
1170 | if (hasLoggedMismatchError) {
|
---|
1171 | return;
|
---|
1172 | }
|
---|
1173 | console.error("Hydration completed but contains mismatches.");
|
---|
1174 | hasLoggedMismatchError = true;
|
---|
1175 | };
|
---|
1176 | const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
|
---|
1177 | const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
|
---|
1178 | const getContainerType = (container) => {
|
---|
1179 | if (container.nodeType !== 1) return void 0;
|
---|
1180 | if (isSVGContainer(container)) return "svg";
|
---|
1181 | if (isMathMLContainer(container)) return "mathml";
|
---|
1182 | return void 0;
|
---|
1183 | };
|
---|
1184 | const isComment = (node) => node.nodeType === 8;
|
---|
1185 | function createHydrationFunctions(rendererInternals) {
|
---|
1186 | const {
|
---|
1187 | mt: mountComponent,
|
---|
1188 | p: patch,
|
---|
1189 | o: {
|
---|
1190 | patchProp,
|
---|
1191 | createText,
|
---|
1192 | nextSibling,
|
---|
1193 | parentNode,
|
---|
1194 | remove,
|
---|
1195 | insert,
|
---|
1196 | createComment
|
---|
1197 | }
|
---|
1198 | } = rendererInternals;
|
---|
1199 | const hydrate = (vnode, container) => {
|
---|
1200 | if (!container.hasChildNodes()) {
|
---|
1201 | patch(null, vnode, container);
|
---|
1202 | flushPostFlushCbs();
|
---|
1203 | container._vnode = vnode;
|
---|
1204 | return;
|
---|
1205 | }
|
---|
1206 | hydrateNode(container.firstChild, vnode, null, null, null);
|
---|
1207 | flushPostFlushCbs();
|
---|
1208 | container._vnode = vnode;
|
---|
1209 | };
|
---|
1210 | const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
---|
1211 | optimized = optimized || !!vnode.dynamicChildren;
|
---|
1212 | const isFragmentStart = isComment(node) && node.data === "[";
|
---|
1213 | const onMismatch = () => handleMismatch(
|
---|
1214 | node,
|
---|
1215 | vnode,
|
---|
1216 | parentComponent,
|
---|
1217 | parentSuspense,
|
---|
1218 | slotScopeIds,
|
---|
1219 | isFragmentStart
|
---|
1220 | );
|
---|
1221 | const { type, ref, shapeFlag, patchFlag } = vnode;
|
---|
1222 | let domType = node.nodeType;
|
---|
1223 | vnode.el = node;
|
---|
1224 | if (patchFlag === -2) {
|
---|
1225 | optimized = false;
|
---|
1226 | vnode.dynamicChildren = null;
|
---|
1227 | }
|
---|
1228 | let nextNode = null;
|
---|
1229 | switch (type) {
|
---|
1230 | case Text:
|
---|
1231 | if (domType !== 3) {
|
---|
1232 | if (vnode.children === "") {
|
---|
1233 | insert(vnode.el = createText(""), parentNode(node), node);
|
---|
1234 | nextNode = node;
|
---|
1235 | } else {
|
---|
1236 | nextNode = onMismatch();
|
---|
1237 | }
|
---|
1238 | } else {
|
---|
1239 | if (node.data !== vnode.children) {
|
---|
1240 | logMismatchError();
|
---|
1241 | node.data = vnode.children;
|
---|
1242 | }
|
---|
1243 | nextNode = nextSibling(node);
|
---|
1244 | }
|
---|
1245 | break;
|
---|
1246 | case Comment:
|
---|
1247 | if (isTemplateNode(node)) {
|
---|
1248 | nextNode = nextSibling(node);
|
---|
1249 | replaceNode(
|
---|
1250 | vnode.el = node.content.firstChild,
|
---|
1251 | node,
|
---|
1252 | parentComponent
|
---|
1253 | );
|
---|
1254 | } else if (domType !== 8 || isFragmentStart) {
|
---|
1255 | nextNode = onMismatch();
|
---|
1256 | } else {
|
---|
1257 | nextNode = nextSibling(node);
|
---|
1258 | }
|
---|
1259 | break;
|
---|
1260 | case Static:
|
---|
1261 | if (isFragmentStart) {
|
---|
1262 | node = nextSibling(node);
|
---|
1263 | domType = node.nodeType;
|
---|
1264 | }
|
---|
1265 | if (domType === 1 || domType === 3) {
|
---|
1266 | nextNode = node;
|
---|
1267 | const needToAdoptContent = !vnode.children.length;
|
---|
1268 | for (let i = 0; i < vnode.staticCount; i++) {
|
---|
1269 | if (needToAdoptContent)
|
---|
1270 | vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
|
---|
1271 | if (i === vnode.staticCount - 1) {
|
---|
1272 | vnode.anchor = nextNode;
|
---|
1273 | }
|
---|
1274 | nextNode = nextSibling(nextNode);
|
---|
1275 | }
|
---|
1276 | return isFragmentStart ? nextSibling(nextNode) : nextNode;
|
---|
1277 | } else {
|
---|
1278 | onMismatch();
|
---|
1279 | }
|
---|
1280 | break;
|
---|
1281 | case Fragment:
|
---|
1282 | if (!isFragmentStart) {
|
---|
1283 | nextNode = onMismatch();
|
---|
1284 | } else {
|
---|
1285 | nextNode = hydrateFragment(
|
---|
1286 | node,
|
---|
1287 | vnode,
|
---|
1288 | parentComponent,
|
---|
1289 | parentSuspense,
|
---|
1290 | slotScopeIds,
|
---|
1291 | optimized
|
---|
1292 | );
|
---|
1293 | }
|
---|
1294 | break;
|
---|
1295 | default:
|
---|
1296 | if (shapeFlag & 1) {
|
---|
1297 | if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
|
---|
1298 | nextNode = onMismatch();
|
---|
1299 | } else {
|
---|
1300 | nextNode = hydrateElement(
|
---|
1301 | node,
|
---|
1302 | vnode,
|
---|
1303 | parentComponent,
|
---|
1304 | parentSuspense,
|
---|
1305 | slotScopeIds,
|
---|
1306 | optimized
|
---|
1307 | );
|
---|
1308 | }
|
---|
1309 | } else if (shapeFlag & 6) {
|
---|
1310 | vnode.slotScopeIds = slotScopeIds;
|
---|
1311 | const container = parentNode(node);
|
---|
1312 | if (isFragmentStart) {
|
---|
1313 | nextNode = locateClosingAnchor(node);
|
---|
1314 | } else if (isComment(node) && node.data === "teleport start") {
|
---|
1315 | nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
---|
1316 | } else {
|
---|
1317 | nextNode = nextSibling(node);
|
---|
1318 | }
|
---|
1319 | mountComponent(
|
---|
1320 | vnode,
|
---|
1321 | container,
|
---|
1322 | null,
|
---|
1323 | parentComponent,
|
---|
1324 | parentSuspense,
|
---|
1325 | getContainerType(container),
|
---|
1326 | optimized
|
---|
1327 | );
|
---|
1328 | if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
|
---|
1329 | let subTree;
|
---|
1330 | if (isFragmentStart) {
|
---|
1331 | subTree = createVNode(Fragment);
|
---|
1332 | subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
---|
1333 | } else {
|
---|
1334 | subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
|
---|
1335 | }
|
---|
1336 | subTree.el = node;
|
---|
1337 | vnode.component.subTree = subTree;
|
---|
1338 | }
|
---|
1339 | } else if (shapeFlag & 64) {
|
---|
1340 | if (domType !== 8) {
|
---|
1341 | nextNode = onMismatch();
|
---|
1342 | } else {
|
---|
1343 | nextNode = vnode.type.hydrate(
|
---|
1344 | node,
|
---|
1345 | vnode,
|
---|
1346 | parentComponent,
|
---|
1347 | parentSuspense,
|
---|
1348 | slotScopeIds,
|
---|
1349 | optimized,
|
---|
1350 | rendererInternals,
|
---|
1351 | hydrateChildren
|
---|
1352 | );
|
---|
1353 | }
|
---|
1354 | } else if (shapeFlag & 128) {
|
---|
1355 | nextNode = vnode.type.hydrate(
|
---|
1356 | node,
|
---|
1357 | vnode,
|
---|
1358 | parentComponent,
|
---|
1359 | parentSuspense,
|
---|
1360 | getContainerType(parentNode(node)),
|
---|
1361 | slotScopeIds,
|
---|
1362 | optimized,
|
---|
1363 | rendererInternals,
|
---|
1364 | hydrateNode
|
---|
1365 | );
|
---|
1366 | } else ;
|
---|
1367 | }
|
---|
1368 | if (ref != null) {
|
---|
1369 | setRef(ref, null, parentSuspense, vnode);
|
---|
1370 | }
|
---|
1371 | return nextNode;
|
---|
1372 | };
|
---|
1373 | const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
---|
1374 | optimized = optimized || !!vnode.dynamicChildren;
|
---|
1375 | const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
---|
1376 | const forcePatch = type === "input" || type === "option";
|
---|
1377 | if (forcePatch || patchFlag !== -1) {
|
---|
1378 | if (dirs) {
|
---|
1379 | invokeDirectiveHook(vnode, null, parentComponent, "created");
|
---|
1380 | }
|
---|
1381 | let needCallTransitionHooks = false;
|
---|
1382 | if (isTemplateNode(el)) {
|
---|
1383 | needCallTransitionHooks = needTransition(
|
---|
1384 | null,
|
---|
1385 | // no need check parentSuspense in hydration
|
---|
1386 | transition
|
---|
1387 | ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
|
---|
1388 | const content = el.content.firstChild;
|
---|
1389 | if (needCallTransitionHooks) {
|
---|
1390 | transition.beforeEnter(content);
|
---|
1391 | }
|
---|
1392 | replaceNode(content, el, parentComponent);
|
---|
1393 | vnode.el = el = content;
|
---|
1394 | }
|
---|
1395 | if (shapeFlag & 16 && // skip if element has innerHTML / textContent
|
---|
1396 | !(props && (props.innerHTML || props.textContent))) {
|
---|
1397 | let next = hydrateChildren(
|
---|
1398 | el.firstChild,
|
---|
1399 | vnode,
|
---|
1400 | el,
|
---|
1401 | parentComponent,
|
---|
1402 | parentSuspense,
|
---|
1403 | slotScopeIds,
|
---|
1404 | optimized
|
---|
1405 | );
|
---|
1406 | while (next) {
|
---|
1407 | if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
|
---|
1408 | logMismatchError();
|
---|
1409 | }
|
---|
1410 | const cur = next;
|
---|
1411 | next = next.nextSibling;
|
---|
1412 | remove(cur);
|
---|
1413 | }
|
---|
1414 | } else if (shapeFlag & 8) {
|
---|
1415 | let clientText = vnode.children;
|
---|
1416 | if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
|
---|
1417 | clientText = clientText.slice(1);
|
---|
1418 | }
|
---|
1419 | if (el.textContent !== clientText) {
|
---|
1420 | if (!isMismatchAllowed(el, 0 /* TEXT */)) {
|
---|
1421 | logMismatchError();
|
---|
1422 | }
|
---|
1423 | el.textContent = vnode.children;
|
---|
1424 | }
|
---|
1425 | }
|
---|
1426 | if (props) {
|
---|
1427 | if (forcePatch || !optimized || patchFlag & (16 | 32)) {
|
---|
1428 | const isCustomElement = el.tagName.includes("-");
|
---|
1429 | for (const key in props) {
|
---|
1430 | if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
|
---|
1431 | key[0] === "." || isCustomElement) {
|
---|
1432 | patchProp(el, key, null, props[key], void 0, parentComponent);
|
---|
1433 | }
|
---|
1434 | }
|
---|
1435 | } else if (props.onClick) {
|
---|
1436 | patchProp(
|
---|
1437 | el,
|
---|
1438 | "onClick",
|
---|
1439 | null,
|
---|
1440 | props.onClick,
|
---|
1441 | void 0,
|
---|
1442 | parentComponent
|
---|
1443 | );
|
---|
1444 | } else if (patchFlag & 4 && reactivity.isReactive(props.style)) {
|
---|
1445 | for (const key in props.style) props.style[key];
|
---|
1446 | }
|
---|
1447 | }
|
---|
1448 | let vnodeHooks;
|
---|
1449 | if (vnodeHooks = props && props.onVnodeBeforeMount) {
|
---|
1450 | invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
---|
1451 | }
|
---|
1452 | if (dirs) {
|
---|
1453 | invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
---|
1454 | }
|
---|
1455 | if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
---|
1456 | queueEffectWithSuspense(() => {
|
---|
1457 | vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
---|
1458 | needCallTransitionHooks && transition.enter(el);
|
---|
1459 | dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
---|
1460 | }, parentSuspense);
|
---|
1461 | }
|
---|
1462 | }
|
---|
1463 | return el.nextSibling;
|
---|
1464 | };
|
---|
1465 | const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
---|
1466 | optimized = optimized || !!parentVNode.dynamicChildren;
|
---|
1467 | const children = parentVNode.children;
|
---|
1468 | const l = children.length;
|
---|
1469 | for (let i = 0; i < l; i++) {
|
---|
1470 | const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
---|
1471 | const isText = vnode.type === Text;
|
---|
1472 | if (node) {
|
---|
1473 | if (isText && !optimized) {
|
---|
1474 | if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
|
---|
1475 | insert(
|
---|
1476 | createText(
|
---|
1477 | node.data.slice(vnode.children.length)
|
---|
1478 | ),
|
---|
1479 | container,
|
---|
1480 | nextSibling(node)
|
---|
1481 | );
|
---|
1482 | node.data = vnode.children;
|
---|
1483 | }
|
---|
1484 | }
|
---|
1485 | node = hydrateNode(
|
---|
1486 | node,
|
---|
1487 | vnode,
|
---|
1488 | parentComponent,
|
---|
1489 | parentSuspense,
|
---|
1490 | slotScopeIds,
|
---|
1491 | optimized
|
---|
1492 | );
|
---|
1493 | } else if (isText && !vnode.children) {
|
---|
1494 | insert(vnode.el = createText(""), container);
|
---|
1495 | } else {
|
---|
1496 | if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
|
---|
1497 | logMismatchError();
|
---|
1498 | }
|
---|
1499 | patch(
|
---|
1500 | null,
|
---|
1501 | vnode,
|
---|
1502 | container,
|
---|
1503 | null,
|
---|
1504 | parentComponent,
|
---|
1505 | parentSuspense,
|
---|
1506 | getContainerType(container),
|
---|
1507 | slotScopeIds
|
---|
1508 | );
|
---|
1509 | }
|
---|
1510 | }
|
---|
1511 | return node;
|
---|
1512 | };
|
---|
1513 | const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
---|
1514 | const { slotScopeIds: fragmentSlotScopeIds } = vnode;
|
---|
1515 | if (fragmentSlotScopeIds) {
|
---|
1516 | slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
---|
1517 | }
|
---|
1518 | const container = parentNode(node);
|
---|
1519 | const next = hydrateChildren(
|
---|
1520 | nextSibling(node),
|
---|
1521 | vnode,
|
---|
1522 | container,
|
---|
1523 | parentComponent,
|
---|
1524 | parentSuspense,
|
---|
1525 | slotScopeIds,
|
---|
1526 | optimized
|
---|
1527 | );
|
---|
1528 | if (next && isComment(next) && next.data === "]") {
|
---|
1529 | return nextSibling(vnode.anchor = next);
|
---|
1530 | } else {
|
---|
1531 | logMismatchError();
|
---|
1532 | insert(vnode.anchor = createComment(`]`), container, next);
|
---|
1533 | return next;
|
---|
1534 | }
|
---|
1535 | };
|
---|
1536 | const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
---|
1537 | if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
|
---|
1538 | logMismatchError();
|
---|
1539 | }
|
---|
1540 | vnode.el = null;
|
---|
1541 | if (isFragment) {
|
---|
1542 | const end = locateClosingAnchor(node);
|
---|
1543 | while (true) {
|
---|
1544 | const next2 = nextSibling(node);
|
---|
1545 | if (next2 && next2 !== end) {
|
---|
1546 | remove(next2);
|
---|
1547 | } else {
|
---|
1548 | break;
|
---|
1549 | }
|
---|
1550 | }
|
---|
1551 | }
|
---|
1552 | const next = nextSibling(node);
|
---|
1553 | const container = parentNode(node);
|
---|
1554 | remove(node);
|
---|
1555 | patch(
|
---|
1556 | null,
|
---|
1557 | vnode,
|
---|
1558 | container,
|
---|
1559 | next,
|
---|
1560 | parentComponent,
|
---|
1561 | parentSuspense,
|
---|
1562 | getContainerType(container),
|
---|
1563 | slotScopeIds
|
---|
1564 | );
|
---|
1565 | if (parentComponent) {
|
---|
1566 | parentComponent.vnode.el = vnode.el;
|
---|
1567 | updateHOCHostEl(parentComponent, vnode.el);
|
---|
1568 | }
|
---|
1569 | return next;
|
---|
1570 | };
|
---|
1571 | const locateClosingAnchor = (node, open = "[", close = "]") => {
|
---|
1572 | let match = 0;
|
---|
1573 | while (node) {
|
---|
1574 | node = nextSibling(node);
|
---|
1575 | if (node && isComment(node)) {
|
---|
1576 | if (node.data === open) match++;
|
---|
1577 | if (node.data === close) {
|
---|
1578 | if (match === 0) {
|
---|
1579 | return nextSibling(node);
|
---|
1580 | } else {
|
---|
1581 | match--;
|
---|
1582 | }
|
---|
1583 | }
|
---|
1584 | }
|
---|
1585 | }
|
---|
1586 | return node;
|
---|
1587 | };
|
---|
1588 | const replaceNode = (newNode, oldNode, parentComponent) => {
|
---|
1589 | const parentNode2 = oldNode.parentNode;
|
---|
1590 | if (parentNode2) {
|
---|
1591 | parentNode2.replaceChild(newNode, oldNode);
|
---|
1592 | }
|
---|
1593 | let parent = parentComponent;
|
---|
1594 | while (parent) {
|
---|
1595 | if (parent.vnode.el === oldNode) {
|
---|
1596 | parent.vnode.el = parent.subTree.el = newNode;
|
---|
1597 | }
|
---|
1598 | parent = parent.parent;
|
---|
1599 | }
|
---|
1600 | };
|
---|
1601 | const isTemplateNode = (node) => {
|
---|
1602 | return node.nodeType === 1 && node.tagName === "TEMPLATE";
|
---|
1603 | };
|
---|
1604 | return [hydrate, hydrateNode];
|
---|
1605 | }
|
---|
1606 | const allowMismatchAttr = "data-allow-mismatch";
|
---|
1607 | const MismatchTypeString = {
|
---|
1608 | [0 /* TEXT */]: "text",
|
---|
1609 | [1 /* CHILDREN */]: "children",
|
---|
1610 | [2 /* CLASS */]: "class",
|
---|
1611 | [3 /* STYLE */]: "style",
|
---|
1612 | [4 /* ATTRIBUTE */]: "attribute"
|
---|
1613 | };
|
---|
1614 | function isMismatchAllowed(el, allowedType) {
|
---|
1615 | if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
|
---|
1616 | while (el && !el.hasAttribute(allowMismatchAttr)) {
|
---|
1617 | el = el.parentElement;
|
---|
1618 | }
|
---|
1619 | }
|
---|
1620 | const allowedAttr = el && el.getAttribute(allowMismatchAttr);
|
---|
1621 | if (allowedAttr == null) {
|
---|
1622 | return false;
|
---|
1623 | } else if (allowedAttr === "") {
|
---|
1624 | return true;
|
---|
1625 | } else {
|
---|
1626 | const list = allowedAttr.split(",");
|
---|
1627 | if (allowedType === 0 /* TEXT */ && list.includes("children")) {
|
---|
1628 | return true;
|
---|
1629 | }
|
---|
1630 | return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
|
---|
1631 | }
|
---|
1632 | }
|
---|
1633 |
|
---|
1634 | const requestIdleCallback = shared.getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
|
---|
1635 | const cancelIdleCallback = shared.getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
|
---|
1636 | const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
|
---|
1637 | const id = requestIdleCallback(hydrate, { timeout });
|
---|
1638 | return () => cancelIdleCallback(id);
|
---|
1639 | };
|
---|
1640 | function elementIsVisibleInViewport(el) {
|
---|
1641 | const { top, left, bottom, right } = el.getBoundingClientRect();
|
---|
1642 | const { innerHeight, innerWidth } = window;
|
---|
1643 | return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
|
---|
1644 | }
|
---|
1645 | const hydrateOnVisible = (opts) => (hydrate, forEach) => {
|
---|
1646 | const ob = new IntersectionObserver((entries) => {
|
---|
1647 | for (const e of entries) {
|
---|
1648 | if (!e.isIntersecting) continue;
|
---|
1649 | ob.disconnect();
|
---|
1650 | hydrate();
|
---|
1651 | break;
|
---|
1652 | }
|
---|
1653 | }, opts);
|
---|
1654 | forEach((el) => {
|
---|
1655 | if (!(el instanceof Element)) return;
|
---|
1656 | if (elementIsVisibleInViewport(el)) {
|
---|
1657 | hydrate();
|
---|
1658 | ob.disconnect();
|
---|
1659 | return false;
|
---|
1660 | }
|
---|
1661 | ob.observe(el);
|
---|
1662 | });
|
---|
1663 | return () => ob.disconnect();
|
---|
1664 | };
|
---|
1665 | const hydrateOnMediaQuery = (query) => (hydrate) => {
|
---|
1666 | if (query) {
|
---|
1667 | const mql = matchMedia(query);
|
---|
1668 | if (mql.matches) {
|
---|
1669 | hydrate();
|
---|
1670 | } else {
|
---|
1671 | mql.addEventListener("change", hydrate, { once: true });
|
---|
1672 | return () => mql.removeEventListener("change", hydrate);
|
---|
1673 | }
|
---|
1674 | }
|
---|
1675 | };
|
---|
1676 | const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
|
---|
1677 | if (shared.isString(interactions)) interactions = [interactions];
|
---|
1678 | let hasHydrated = false;
|
---|
1679 | const doHydrate = (e) => {
|
---|
1680 | if (!hasHydrated) {
|
---|
1681 | hasHydrated = true;
|
---|
1682 | teardown();
|
---|
1683 | hydrate();
|
---|
1684 | e.target.dispatchEvent(new e.constructor(e.type, e));
|
---|
1685 | }
|
---|
1686 | };
|
---|
1687 | const teardown = () => {
|
---|
1688 | forEach((el) => {
|
---|
1689 | for (const i of interactions) {
|
---|
1690 | el.removeEventListener(i, doHydrate);
|
---|
1691 | }
|
---|
1692 | });
|
---|
1693 | };
|
---|
1694 | forEach((el) => {
|
---|
1695 | for (const i of interactions) {
|
---|
1696 | el.addEventListener(i, doHydrate, { once: true });
|
---|
1697 | }
|
---|
1698 | });
|
---|
1699 | return teardown;
|
---|
1700 | };
|
---|
1701 | function forEachElement(node, cb) {
|
---|
1702 | if (isComment(node) && node.data === "[") {
|
---|
1703 | let depth = 1;
|
---|
1704 | let next = node.nextSibling;
|
---|
1705 | while (next) {
|
---|
1706 | if (next.nodeType === 1) {
|
---|
1707 | const result = cb(next);
|
---|
1708 | if (result === false) {
|
---|
1709 | break;
|
---|
1710 | }
|
---|
1711 | } else if (isComment(next)) {
|
---|
1712 | if (next.data === "]") {
|
---|
1713 | if (--depth === 0) break;
|
---|
1714 | } else if (next.data === "[") {
|
---|
1715 | depth++;
|
---|
1716 | }
|
---|
1717 | }
|
---|
1718 | next = next.nextSibling;
|
---|
1719 | }
|
---|
1720 | } else {
|
---|
1721 | cb(node);
|
---|
1722 | }
|
---|
1723 | }
|
---|
1724 |
|
---|
1725 | const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
---|
1726 | /*! #__NO_SIDE_EFFECTS__ */
|
---|
1727 | // @__NO_SIDE_EFFECTS__
|
---|
1728 | function defineAsyncComponent(source) {
|
---|
1729 | if (shared.isFunction(source)) {
|
---|
1730 | source = { loader: source };
|
---|
1731 | }
|
---|
1732 | const {
|
---|
1733 | loader,
|
---|
1734 | loadingComponent,
|
---|
1735 | errorComponent,
|
---|
1736 | delay = 200,
|
---|
1737 | hydrate: hydrateStrategy,
|
---|
1738 | timeout,
|
---|
1739 | // undefined = never times out
|
---|
1740 | suspensible = true,
|
---|
1741 | onError: userOnError
|
---|
1742 | } = source;
|
---|
1743 | let pendingRequest = null;
|
---|
1744 | let resolvedComp;
|
---|
1745 | let retries = 0;
|
---|
1746 | const retry = () => {
|
---|
1747 | retries++;
|
---|
1748 | pendingRequest = null;
|
---|
1749 | return load();
|
---|
1750 | };
|
---|
1751 | const load = () => {
|
---|
1752 | let thisRequest;
|
---|
1753 | return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
|
---|
1754 | err = err instanceof Error ? err : new Error(String(err));
|
---|
1755 | if (userOnError) {
|
---|
1756 | return new Promise((resolve, reject) => {
|
---|
1757 | const userRetry = () => resolve(retry());
|
---|
1758 | const userFail = () => reject(err);
|
---|
1759 | userOnError(err, userRetry, userFail, retries + 1);
|
---|
1760 | });
|
---|
1761 | } else {
|
---|
1762 | throw err;
|
---|
1763 | }
|
---|
1764 | }).then((comp) => {
|
---|
1765 | if (thisRequest !== pendingRequest && pendingRequest) {
|
---|
1766 | return pendingRequest;
|
---|
1767 | }
|
---|
1768 | if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
|
---|
1769 | comp = comp.default;
|
---|
1770 | }
|
---|
1771 | resolvedComp = comp;
|
---|
1772 | return comp;
|
---|
1773 | }));
|
---|
1774 | };
|
---|
1775 | return defineComponent({
|
---|
1776 | name: "AsyncComponentWrapper",
|
---|
1777 | __asyncLoader: load,
|
---|
1778 | __asyncHydrate(el, instance, hydrate) {
|
---|
1779 | const doHydrate = hydrateStrategy ? () => {
|
---|
1780 | const teardown = hydrateStrategy(
|
---|
1781 | hydrate,
|
---|
1782 | (cb) => forEachElement(el, cb)
|
---|
1783 | );
|
---|
1784 | if (teardown) {
|
---|
1785 | (instance.bum || (instance.bum = [])).push(teardown);
|
---|
1786 | }
|
---|
1787 | } : hydrate;
|
---|
1788 | if (resolvedComp) {
|
---|
1789 | doHydrate();
|
---|
1790 | } else {
|
---|
1791 | load().then(() => !instance.isUnmounted && doHydrate());
|
---|
1792 | }
|
---|
1793 | },
|
---|
1794 | get __asyncResolved() {
|
---|
1795 | return resolvedComp;
|
---|
1796 | },
|
---|
1797 | setup() {
|
---|
1798 | const instance = currentInstance;
|
---|
1799 | markAsyncBoundary(instance);
|
---|
1800 | if (resolvedComp) {
|
---|
1801 | return () => createInnerComp(resolvedComp, instance);
|
---|
1802 | }
|
---|
1803 | const onError = (err) => {
|
---|
1804 | pendingRequest = null;
|
---|
1805 | handleError(
|
---|
1806 | err,
|
---|
1807 | instance,
|
---|
1808 | 13,
|
---|
1809 | !errorComponent
|
---|
1810 | );
|
---|
1811 | };
|
---|
1812 | if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
---|
1813 | return load().then((comp) => {
|
---|
1814 | return () => createInnerComp(comp, instance);
|
---|
1815 | }).catch((err) => {
|
---|
1816 | onError(err);
|
---|
1817 | return () => errorComponent ? createVNode(errorComponent, {
|
---|
1818 | error: err
|
---|
1819 | }) : null;
|
---|
1820 | });
|
---|
1821 | }
|
---|
1822 | const loaded = reactivity.ref(false);
|
---|
1823 | const error = reactivity.ref();
|
---|
1824 | const delayed = reactivity.ref(!!delay);
|
---|
1825 | if (delay) {
|
---|
1826 | setTimeout(() => {
|
---|
1827 | delayed.value = false;
|
---|
1828 | }, delay);
|
---|
1829 | }
|
---|
1830 | if (timeout != null) {
|
---|
1831 | setTimeout(() => {
|
---|
1832 | if (!loaded.value && !error.value) {
|
---|
1833 | const err = new Error(
|
---|
1834 | `Async component timed out after ${timeout}ms.`
|
---|
1835 | );
|
---|
1836 | onError(err);
|
---|
1837 | error.value = err;
|
---|
1838 | }
|
---|
1839 | }, timeout);
|
---|
1840 | }
|
---|
1841 | load().then(() => {
|
---|
1842 | loaded.value = true;
|
---|
1843 | if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
---|
1844 | instance.parent.update();
|
---|
1845 | }
|
---|
1846 | }).catch((err) => {
|
---|
1847 | onError(err);
|
---|
1848 | error.value = err;
|
---|
1849 | });
|
---|
1850 | return () => {
|
---|
1851 | if (loaded.value && resolvedComp) {
|
---|
1852 | return createInnerComp(resolvedComp, instance);
|
---|
1853 | } else if (error.value && errorComponent) {
|
---|
1854 | return createVNode(errorComponent, {
|
---|
1855 | error: error.value
|
---|
1856 | });
|
---|
1857 | } else if (loadingComponent && !delayed.value) {
|
---|
1858 | return createVNode(loadingComponent);
|
---|
1859 | }
|
---|
1860 | };
|
---|
1861 | }
|
---|
1862 | });
|
---|
1863 | }
|
---|
1864 | function createInnerComp(comp, parent) {
|
---|
1865 | const { ref: ref2, props, children, ce } = parent.vnode;
|
---|
1866 | const vnode = createVNode(comp, props, children);
|
---|
1867 | vnode.ref = ref2;
|
---|
1868 | vnode.ce = ce;
|
---|
1869 | delete parent.vnode.ce;
|
---|
1870 | return vnode;
|
---|
1871 | }
|
---|
1872 |
|
---|
1873 | const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
---|
1874 | const KeepAliveImpl = {
|
---|
1875 | name: `KeepAlive`,
|
---|
1876 | // Marker for special handling inside the renderer. We are not using a ===
|
---|
1877 | // check directly on KeepAlive in the renderer, because importing it directly
|
---|
1878 | // would prevent it from being tree-shaken.
|
---|
1879 | __isKeepAlive: true,
|
---|
1880 | props: {
|
---|
1881 | include: [String, RegExp, Array],
|
---|
1882 | exclude: [String, RegExp, Array],
|
---|
1883 | max: [String, Number]
|
---|
1884 | },
|
---|
1885 | setup(props, { slots }) {
|
---|
1886 | const instance = getCurrentInstance();
|
---|
1887 | const sharedContext = instance.ctx;
|
---|
1888 | if (!sharedContext.renderer) {
|
---|
1889 | return () => {
|
---|
1890 | const children = slots.default && slots.default();
|
---|
1891 | return children && children.length === 1 ? children[0] : children;
|
---|
1892 | };
|
---|
1893 | }
|
---|
1894 | const cache = /* @__PURE__ */ new Map();
|
---|
1895 | const keys = /* @__PURE__ */ new Set();
|
---|
1896 | let current = null;
|
---|
1897 | const parentSuspense = instance.suspense;
|
---|
1898 | const {
|
---|
1899 | renderer: {
|
---|
1900 | p: patch,
|
---|
1901 | m: move,
|
---|
1902 | um: _unmount,
|
---|
1903 | o: { createElement }
|
---|
1904 | }
|
---|
1905 | } = sharedContext;
|
---|
1906 | const storageContainer = createElement("div");
|
---|
1907 | sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
---|
1908 | const instance2 = vnode.component;
|
---|
1909 | move(vnode, container, anchor, 0, parentSuspense);
|
---|
1910 | patch(
|
---|
1911 | instance2.vnode,
|
---|
1912 | vnode,
|
---|
1913 | container,
|
---|
1914 | anchor,
|
---|
1915 | instance2,
|
---|
1916 | parentSuspense,
|
---|
1917 | namespace,
|
---|
1918 | vnode.slotScopeIds,
|
---|
1919 | optimized
|
---|
1920 | );
|
---|
1921 | queuePostRenderEffect(() => {
|
---|
1922 | instance2.isDeactivated = false;
|
---|
1923 | if (instance2.a) {
|
---|
1924 | shared.invokeArrayFns(instance2.a);
|
---|
1925 | }
|
---|
1926 | const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
---|
1927 | if (vnodeHook) {
|
---|
1928 | invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
---|
1929 | }
|
---|
1930 | }, parentSuspense);
|
---|
1931 | };
|
---|
1932 | sharedContext.deactivate = (vnode) => {
|
---|
1933 | const instance2 = vnode.component;
|
---|
1934 | invalidateMount(instance2.m);
|
---|
1935 | invalidateMount(instance2.a);
|
---|
1936 | move(vnode, storageContainer, null, 1, parentSuspense);
|
---|
1937 | queuePostRenderEffect(() => {
|
---|
1938 | if (instance2.da) {
|
---|
1939 | shared.invokeArrayFns(instance2.da);
|
---|
1940 | }
|
---|
1941 | const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
---|
1942 | if (vnodeHook) {
|
---|
1943 | invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
---|
1944 | }
|
---|
1945 | instance2.isDeactivated = true;
|
---|
1946 | }, parentSuspense);
|
---|
1947 | };
|
---|
1948 | function unmount(vnode) {
|
---|
1949 | resetShapeFlag(vnode);
|
---|
1950 | _unmount(vnode, instance, parentSuspense, true);
|
---|
1951 | }
|
---|
1952 | function pruneCache(filter) {
|
---|
1953 | cache.forEach((vnode, key) => {
|
---|
1954 | const name = getComponentName(vnode.type);
|
---|
1955 | if (name && !filter(name)) {
|
---|
1956 | pruneCacheEntry(key);
|
---|
1957 | }
|
---|
1958 | });
|
---|
1959 | }
|
---|
1960 | function pruneCacheEntry(key) {
|
---|
1961 | const cached = cache.get(key);
|
---|
1962 | if (cached && (!current || !isSameVNodeType(cached, current))) {
|
---|
1963 | unmount(cached);
|
---|
1964 | } else if (current) {
|
---|
1965 | resetShapeFlag(current);
|
---|
1966 | }
|
---|
1967 | cache.delete(key);
|
---|
1968 | keys.delete(key);
|
---|
1969 | }
|
---|
1970 | watch(
|
---|
1971 | () => [props.include, props.exclude],
|
---|
1972 | ([include, exclude]) => {
|
---|
1973 | include && pruneCache((name) => matches(include, name));
|
---|
1974 | exclude && pruneCache((name) => !matches(exclude, name));
|
---|
1975 | },
|
---|
1976 | // prune post-render after `current` has been updated
|
---|
1977 | { flush: "post", deep: true }
|
---|
1978 | );
|
---|
1979 | let pendingCacheKey = null;
|
---|
1980 | const cacheSubtree = () => {
|
---|
1981 | if (pendingCacheKey != null) {
|
---|
1982 | if (isSuspense(instance.subTree.type)) {
|
---|
1983 | queuePostRenderEffect(() => {
|
---|
1984 | cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
---|
1985 | }, instance.subTree.suspense);
|
---|
1986 | } else {
|
---|
1987 | cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
---|
1988 | }
|
---|
1989 | }
|
---|
1990 | };
|
---|
1991 | onMounted(cacheSubtree);
|
---|
1992 | onUpdated(cacheSubtree);
|
---|
1993 | onBeforeUnmount(() => {
|
---|
1994 | cache.forEach((cached) => {
|
---|
1995 | const { subTree, suspense } = instance;
|
---|
1996 | const vnode = getInnerChild(subTree);
|
---|
1997 | if (cached.type === vnode.type && cached.key === vnode.key) {
|
---|
1998 | resetShapeFlag(vnode);
|
---|
1999 | const da = vnode.component.da;
|
---|
2000 | da && queuePostRenderEffect(da, suspense);
|
---|
2001 | return;
|
---|
2002 | }
|
---|
2003 | unmount(cached);
|
---|
2004 | });
|
---|
2005 | });
|
---|
2006 | return () => {
|
---|
2007 | pendingCacheKey = null;
|
---|
2008 | if (!slots.default) {
|
---|
2009 | return current = null;
|
---|
2010 | }
|
---|
2011 | const children = slots.default();
|
---|
2012 | const rawVNode = children[0];
|
---|
2013 | if (children.length > 1) {
|
---|
2014 | current = null;
|
---|
2015 | return children;
|
---|
2016 | } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
|
---|
2017 | current = null;
|
---|
2018 | return rawVNode;
|
---|
2019 | }
|
---|
2020 | let vnode = getInnerChild(rawVNode);
|
---|
2021 | if (vnode.type === Comment) {
|
---|
2022 | current = null;
|
---|
2023 | return vnode;
|
---|
2024 | }
|
---|
2025 | const comp = vnode.type;
|
---|
2026 | const name = getComponentName(
|
---|
2027 | isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
|
---|
2028 | );
|
---|
2029 | const { include, exclude, max } = props;
|
---|
2030 | if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
|
---|
2031 | vnode.shapeFlag &= ~256;
|
---|
2032 | current = vnode;
|
---|
2033 | return rawVNode;
|
---|
2034 | }
|
---|
2035 | const key = vnode.key == null ? comp : vnode.key;
|
---|
2036 | const cachedVNode = cache.get(key);
|
---|
2037 | if (vnode.el) {
|
---|
2038 | vnode = cloneVNode(vnode);
|
---|
2039 | if (rawVNode.shapeFlag & 128) {
|
---|
2040 | rawVNode.ssContent = vnode;
|
---|
2041 | }
|
---|
2042 | }
|
---|
2043 | pendingCacheKey = key;
|
---|
2044 | if (cachedVNode) {
|
---|
2045 | vnode.el = cachedVNode.el;
|
---|
2046 | vnode.component = cachedVNode.component;
|
---|
2047 | if (vnode.transition) {
|
---|
2048 | setTransitionHooks(vnode, vnode.transition);
|
---|
2049 | }
|
---|
2050 | vnode.shapeFlag |= 512;
|
---|
2051 | keys.delete(key);
|
---|
2052 | keys.add(key);
|
---|
2053 | } else {
|
---|
2054 | keys.add(key);
|
---|
2055 | if (max && keys.size > parseInt(max, 10)) {
|
---|
2056 | pruneCacheEntry(keys.values().next().value);
|
---|
2057 | }
|
---|
2058 | }
|
---|
2059 | vnode.shapeFlag |= 256;
|
---|
2060 | current = vnode;
|
---|
2061 | return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
---|
2062 | };
|
---|
2063 | }
|
---|
2064 | };
|
---|
2065 | const KeepAlive = KeepAliveImpl;
|
---|
2066 | function matches(pattern, name) {
|
---|
2067 | if (shared.isArray(pattern)) {
|
---|
2068 | return pattern.some((p) => matches(p, name));
|
---|
2069 | } else if (shared.isString(pattern)) {
|
---|
2070 | return pattern.split(",").includes(name);
|
---|
2071 | } else if (shared.isRegExp(pattern)) {
|
---|
2072 | pattern.lastIndex = 0;
|
---|
2073 | return pattern.test(name);
|
---|
2074 | }
|
---|
2075 | return false;
|
---|
2076 | }
|
---|
2077 | function onActivated(hook, target) {
|
---|
2078 | registerKeepAliveHook(hook, "a", target);
|
---|
2079 | }
|
---|
2080 | function onDeactivated(hook, target) {
|
---|
2081 | registerKeepAliveHook(hook, "da", target);
|
---|
2082 | }
|
---|
2083 | function registerKeepAliveHook(hook, type, target = currentInstance) {
|
---|
2084 | const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
---|
2085 | let current = target;
|
---|
2086 | while (current) {
|
---|
2087 | if (current.isDeactivated) {
|
---|
2088 | return;
|
---|
2089 | }
|
---|
2090 | current = current.parent;
|
---|
2091 | }
|
---|
2092 | return hook();
|
---|
2093 | });
|
---|
2094 | injectHook(type, wrappedHook, target);
|
---|
2095 | if (target) {
|
---|
2096 | let current = target.parent;
|
---|
2097 | while (current && current.parent) {
|
---|
2098 | if (isKeepAlive(current.parent.vnode)) {
|
---|
2099 | injectToKeepAliveRoot(wrappedHook, type, target, current);
|
---|
2100 | }
|
---|
2101 | current = current.parent;
|
---|
2102 | }
|
---|
2103 | }
|
---|
2104 | }
|
---|
2105 | function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
---|
2106 | const injected = injectHook(
|
---|
2107 | type,
|
---|
2108 | hook,
|
---|
2109 | keepAliveRoot,
|
---|
2110 | true
|
---|
2111 | /* prepend */
|
---|
2112 | );
|
---|
2113 | onUnmounted(() => {
|
---|
2114 | shared.remove(keepAliveRoot[type], injected);
|
---|
2115 | }, target);
|
---|
2116 | }
|
---|
2117 | function resetShapeFlag(vnode) {
|
---|
2118 | vnode.shapeFlag &= ~256;
|
---|
2119 | vnode.shapeFlag &= ~512;
|
---|
2120 | }
|
---|
2121 | function getInnerChild(vnode) {
|
---|
2122 | return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
---|
2123 | }
|
---|
2124 |
|
---|
2125 | function injectHook(type, hook, target = currentInstance, prepend = false) {
|
---|
2126 | if (target) {
|
---|
2127 | const hooks = target[type] || (target[type] = []);
|
---|
2128 | const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
---|
2129 | reactivity.pauseTracking();
|
---|
2130 | const reset = setCurrentInstance(target);
|
---|
2131 | const res = callWithAsyncErrorHandling(hook, target, type, args);
|
---|
2132 | reset();
|
---|
2133 | reactivity.resetTracking();
|
---|
2134 | return res;
|
---|
2135 | });
|
---|
2136 | if (prepend) {
|
---|
2137 | hooks.unshift(wrappedHook);
|
---|
2138 | } else {
|
---|
2139 | hooks.push(wrappedHook);
|
---|
2140 | }
|
---|
2141 | return wrappedHook;
|
---|
2142 | }
|
---|
2143 | }
|
---|
2144 | const createHook = (lifecycle) => (hook, target = currentInstance) => {
|
---|
2145 | if (!isInSSRComponentSetup || lifecycle === "sp") {
|
---|
2146 | injectHook(lifecycle, (...args) => hook(...args), target);
|
---|
2147 | }
|
---|
2148 | };
|
---|
2149 | const onBeforeMount = createHook("bm");
|
---|
2150 | const onMounted = createHook("m");
|
---|
2151 | const onBeforeUpdate = createHook(
|
---|
2152 | "bu"
|
---|
2153 | );
|
---|
2154 | const onUpdated = createHook("u");
|
---|
2155 | const onBeforeUnmount = createHook(
|
---|
2156 | "bum"
|
---|
2157 | );
|
---|
2158 | const onUnmounted = createHook("um");
|
---|
2159 | const onServerPrefetch = createHook(
|
---|
2160 | "sp"
|
---|
2161 | );
|
---|
2162 | const onRenderTriggered = createHook("rtg");
|
---|
2163 | const onRenderTracked = createHook("rtc");
|
---|
2164 | function onErrorCaptured(hook, target = currentInstance) {
|
---|
2165 | injectHook("ec", hook, target);
|
---|
2166 | }
|
---|
2167 |
|
---|
2168 | const COMPONENTS = "components";
|
---|
2169 | const DIRECTIVES = "directives";
|
---|
2170 | function resolveComponent(name, maybeSelfReference) {
|
---|
2171 | return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
---|
2172 | }
|
---|
2173 | const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
---|
2174 | function resolveDynamicComponent(component) {
|
---|
2175 | if (shared.isString(component)) {
|
---|
2176 | return resolveAsset(COMPONENTS, component, false) || component;
|
---|
2177 | } else {
|
---|
2178 | return component || NULL_DYNAMIC_COMPONENT;
|
---|
2179 | }
|
---|
2180 | }
|
---|
2181 | function resolveDirective(name) {
|
---|
2182 | return resolveAsset(DIRECTIVES, name);
|
---|
2183 | }
|
---|
2184 | function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
---|
2185 | const instance = currentRenderingInstance || currentInstance;
|
---|
2186 | if (instance) {
|
---|
2187 | const Component = instance.type;
|
---|
2188 | if (type === COMPONENTS) {
|
---|
2189 | const selfName = getComponentName(
|
---|
2190 | Component,
|
---|
2191 | false
|
---|
2192 | );
|
---|
2193 | if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
|
---|
2194 | return Component;
|
---|
2195 | }
|
---|
2196 | }
|
---|
2197 | const res = (
|
---|
2198 | // local registration
|
---|
2199 | // check instance[type] first which is resolved for options API
|
---|
2200 | resolve(instance[type] || Component[type], name) || // global registration
|
---|
2201 | resolve(instance.appContext[type], name)
|
---|
2202 | );
|
---|
2203 | if (!res && maybeSelfReference) {
|
---|
2204 | return Component;
|
---|
2205 | }
|
---|
2206 | return res;
|
---|
2207 | }
|
---|
2208 | }
|
---|
2209 | function resolve(registry, name) {
|
---|
2210 | return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
|
---|
2211 | }
|
---|
2212 |
|
---|
2213 | function renderList(source, renderItem, cache, index) {
|
---|
2214 | let ret;
|
---|
2215 | const cached = cache && cache[index];
|
---|
2216 | const sourceIsArray = shared.isArray(source);
|
---|
2217 | if (sourceIsArray || shared.isString(source)) {
|
---|
2218 | const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source);
|
---|
2219 | let needsWrap = false;
|
---|
2220 | if (sourceIsReactiveArray) {
|
---|
2221 | needsWrap = !reactivity.isShallow(source);
|
---|
2222 | source = reactivity.shallowReadArray(source);
|
---|
2223 | }
|
---|
2224 | ret = new Array(source.length);
|
---|
2225 | for (let i = 0, l = source.length; i < l; i++) {
|
---|
2226 | ret[i] = renderItem(
|
---|
2227 | needsWrap ? reactivity.toReactive(source[i]) : source[i],
|
---|
2228 | i,
|
---|
2229 | void 0,
|
---|
2230 | cached && cached[i]
|
---|
2231 | );
|
---|
2232 | }
|
---|
2233 | } else if (typeof source === "number") {
|
---|
2234 | ret = new Array(source);
|
---|
2235 | for (let i = 0; i < source; i++) {
|
---|
2236 | ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
|
---|
2237 | }
|
---|
2238 | } else if (shared.isObject(source)) {
|
---|
2239 | if (source[Symbol.iterator]) {
|
---|
2240 | ret = Array.from(
|
---|
2241 | source,
|
---|
2242 | (item, i) => renderItem(item, i, void 0, cached && cached[i])
|
---|
2243 | );
|
---|
2244 | } else {
|
---|
2245 | const keys = Object.keys(source);
|
---|
2246 | ret = new Array(keys.length);
|
---|
2247 | for (let i = 0, l = keys.length; i < l; i++) {
|
---|
2248 | const key = keys[i];
|
---|
2249 | ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
---|
2250 | }
|
---|
2251 | }
|
---|
2252 | } else {
|
---|
2253 | ret = [];
|
---|
2254 | }
|
---|
2255 | if (cache) {
|
---|
2256 | cache[index] = ret;
|
---|
2257 | }
|
---|
2258 | return ret;
|
---|
2259 | }
|
---|
2260 |
|
---|
2261 | function createSlots(slots, dynamicSlots) {
|
---|
2262 | for (let i = 0; i < dynamicSlots.length; i++) {
|
---|
2263 | const slot = dynamicSlots[i];
|
---|
2264 | if (shared.isArray(slot)) {
|
---|
2265 | for (let j = 0; j < slot.length; j++) {
|
---|
2266 | slots[slot[j].name] = slot[j].fn;
|
---|
2267 | }
|
---|
2268 | } else if (slot) {
|
---|
2269 | slots[slot.name] = slot.key ? (...args) => {
|
---|
2270 | const res = slot.fn(...args);
|
---|
2271 | if (res) res.key = slot.key;
|
---|
2272 | return res;
|
---|
2273 | } : slot.fn;
|
---|
2274 | }
|
---|
2275 | }
|
---|
2276 | return slots;
|
---|
2277 | }
|
---|
2278 |
|
---|
2279 | function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
---|
2280 | if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
|
---|
2281 | if (name !== "default") props.name = name;
|
---|
2282 | return openBlock(), createBlock(
|
---|
2283 | Fragment,
|
---|
2284 | null,
|
---|
2285 | [createVNode("slot", props, fallback && fallback())],
|
---|
2286 | 64
|
---|
2287 | );
|
---|
2288 | }
|
---|
2289 | let slot = slots[name];
|
---|
2290 | if (slot && slot._c) {
|
---|
2291 | slot._d = false;
|
---|
2292 | }
|
---|
2293 | openBlock();
|
---|
2294 | const validSlotContent = slot && ensureValidVNode(slot(props));
|
---|
2295 | const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
|
---|
2296 | // key attached in the `createSlots` helper, respect that
|
---|
2297 | validSlotContent && validSlotContent.key;
|
---|
2298 | const rendered = createBlock(
|
---|
2299 | Fragment,
|
---|
2300 | {
|
---|
2301 | key: (slotKey && !shared.isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
|
---|
2302 | (!validSlotContent && fallback ? "_fb" : "")
|
---|
2303 | },
|
---|
2304 | validSlotContent || (fallback ? fallback() : []),
|
---|
2305 | validSlotContent && slots._ === 1 ? 64 : -2
|
---|
2306 | );
|
---|
2307 | if (!noSlotted && rendered.scopeId) {
|
---|
2308 | rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
---|
2309 | }
|
---|
2310 | if (slot && slot._c) {
|
---|
2311 | slot._d = true;
|
---|
2312 | }
|
---|
2313 | return rendered;
|
---|
2314 | }
|
---|
2315 | function ensureValidVNode(vnodes) {
|
---|
2316 | return vnodes.some((child) => {
|
---|
2317 | if (!isVNode(child)) return true;
|
---|
2318 | if (child.type === Comment) return false;
|
---|
2319 | if (child.type === Fragment && !ensureValidVNode(child.children))
|
---|
2320 | return false;
|
---|
2321 | return true;
|
---|
2322 | }) ? vnodes : null;
|
---|
2323 | }
|
---|
2324 |
|
---|
2325 | function toHandlers(obj, preserveCaseIfNecessary) {
|
---|
2326 | const ret = {};
|
---|
2327 | for (const key in obj) {
|
---|
2328 | ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : shared.toHandlerKey(key)] = obj[key];
|
---|
2329 | }
|
---|
2330 | return ret;
|
---|
2331 | }
|
---|
2332 |
|
---|
2333 | const getPublicInstance = (i) => {
|
---|
2334 | if (!i) return null;
|
---|
2335 | if (isStatefulComponent(i)) return getComponentPublicInstance(i);
|
---|
2336 | return getPublicInstance(i.parent);
|
---|
2337 | };
|
---|
2338 | const publicPropertiesMap = (
|
---|
2339 | // Move PURE marker to new line to workaround compiler discarding it
|
---|
2340 | // due to type annotation
|
---|
2341 | /* @__PURE__ */ shared.extend(/* @__PURE__ */ Object.create(null), {
|
---|
2342 | $: (i) => i,
|
---|
2343 | $el: (i) => i.vnode.el,
|
---|
2344 | $data: (i) => i.data,
|
---|
2345 | $props: (i) => i.props,
|
---|
2346 | $attrs: (i) => i.attrs,
|
---|
2347 | $slots: (i) => i.slots,
|
---|
2348 | $refs: (i) => i.refs,
|
---|
2349 | $parent: (i) => getPublicInstance(i.parent),
|
---|
2350 | $root: (i) => getPublicInstance(i.root),
|
---|
2351 | $host: (i) => i.ce,
|
---|
2352 | $emit: (i) => i.emit,
|
---|
2353 | $options: (i) => resolveMergedOptions(i) ,
|
---|
2354 | $forceUpdate: (i) => i.f || (i.f = () => {
|
---|
2355 | queueJob(i.update);
|
---|
2356 | }),
|
---|
2357 | $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
---|
2358 | $watch: (i) => instanceWatch.bind(i)
|
---|
2359 | })
|
---|
2360 | );
|
---|
2361 | const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
|
---|
2362 | const PublicInstanceProxyHandlers = {
|
---|
2363 | get({ _: instance }, key) {
|
---|
2364 | if (key === "__v_skip") {
|
---|
2365 | return true;
|
---|
2366 | }
|
---|
2367 | const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
---|
2368 | let normalizedProps;
|
---|
2369 | if (key[0] !== "$") {
|
---|
2370 | const n = accessCache[key];
|
---|
2371 | if (n !== void 0) {
|
---|
2372 | switch (n) {
|
---|
2373 | case 1 /* SETUP */:
|
---|
2374 | return setupState[key];
|
---|
2375 | case 2 /* DATA */:
|
---|
2376 | return data[key];
|
---|
2377 | case 4 /* CONTEXT */:
|
---|
2378 | return ctx[key];
|
---|
2379 | case 3 /* PROPS */:
|
---|
2380 | return props[key];
|
---|
2381 | }
|
---|
2382 | } else if (hasSetupBinding(setupState, key)) {
|
---|
2383 | accessCache[key] = 1 /* SETUP */;
|
---|
2384 | return setupState[key];
|
---|
2385 | } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
---|
2386 | accessCache[key] = 2 /* DATA */;
|
---|
2387 | return data[key];
|
---|
2388 | } else if (
|
---|
2389 | // only cache other properties when instance has declared (thus stable)
|
---|
2390 | // props
|
---|
2391 | (normalizedProps = instance.propsOptions[0]) && shared.hasOwn(normalizedProps, key)
|
---|
2392 | ) {
|
---|
2393 | accessCache[key] = 3 /* PROPS */;
|
---|
2394 | return props[key];
|
---|
2395 | } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
---|
2396 | accessCache[key] = 4 /* CONTEXT */;
|
---|
2397 | return ctx[key];
|
---|
2398 | } else if (shouldCacheAccess) {
|
---|
2399 | accessCache[key] = 0 /* OTHER */;
|
---|
2400 | }
|
---|
2401 | }
|
---|
2402 | const publicGetter = publicPropertiesMap[key];
|
---|
2403 | let cssModule, globalProperties;
|
---|
2404 | if (publicGetter) {
|
---|
2405 | if (key === "$attrs") {
|
---|
2406 | reactivity.track(instance.attrs, "get", "");
|
---|
2407 | }
|
---|
2408 | return publicGetter(instance);
|
---|
2409 | } else if (
|
---|
2410 | // css module (injected by vue-loader)
|
---|
2411 | (cssModule = type.__cssModules) && (cssModule = cssModule[key])
|
---|
2412 | ) {
|
---|
2413 | return cssModule;
|
---|
2414 | } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
---|
2415 | accessCache[key] = 4 /* CONTEXT */;
|
---|
2416 | return ctx[key];
|
---|
2417 | } else if (
|
---|
2418 | // global properties
|
---|
2419 | globalProperties = appContext.config.globalProperties, shared.hasOwn(globalProperties, key)
|
---|
2420 | ) {
|
---|
2421 | {
|
---|
2422 | return globalProperties[key];
|
---|
2423 | }
|
---|
2424 | } else ;
|
---|
2425 | },
|
---|
2426 | set({ _: instance }, key, value) {
|
---|
2427 | const { data, setupState, ctx } = instance;
|
---|
2428 | if (hasSetupBinding(setupState, key)) {
|
---|
2429 | setupState[key] = value;
|
---|
2430 | return true;
|
---|
2431 | } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
---|
2432 | data[key] = value;
|
---|
2433 | return true;
|
---|
2434 | } else if (shared.hasOwn(instance.props, key)) {
|
---|
2435 | return false;
|
---|
2436 | }
|
---|
2437 | if (key[0] === "$" && key.slice(1) in instance) {
|
---|
2438 | return false;
|
---|
2439 | } else {
|
---|
2440 | {
|
---|
2441 | ctx[key] = value;
|
---|
2442 | }
|
---|
2443 | }
|
---|
2444 | return true;
|
---|
2445 | },
|
---|
2446 | has({
|
---|
2447 | _: { data, setupState, accessCache, ctx, appContext, propsOptions }
|
---|
2448 | }, key) {
|
---|
2449 | let normalizedProps;
|
---|
2450 | return !!accessCache[key] || data !== shared.EMPTY_OBJ && shared.hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key) || shared.hasOwn(ctx, key) || shared.hasOwn(publicPropertiesMap, key) || shared.hasOwn(appContext.config.globalProperties, key);
|
---|
2451 | },
|
---|
2452 | defineProperty(target, key, descriptor) {
|
---|
2453 | if (descriptor.get != null) {
|
---|
2454 | target._.accessCache[key] = 0;
|
---|
2455 | } else if (shared.hasOwn(descriptor, "value")) {
|
---|
2456 | this.set(target, key, descriptor.value, null);
|
---|
2457 | }
|
---|
2458 | return Reflect.defineProperty(target, key, descriptor);
|
---|
2459 | }
|
---|
2460 | };
|
---|
2461 | const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ shared.extend({}, PublicInstanceProxyHandlers, {
|
---|
2462 | get(target, key) {
|
---|
2463 | if (key === Symbol.unscopables) {
|
---|
2464 | return;
|
---|
2465 | }
|
---|
2466 | return PublicInstanceProxyHandlers.get(target, key, target);
|
---|
2467 | },
|
---|
2468 | has(_, key) {
|
---|
2469 | const has = key[0] !== "_" && !shared.isGloballyAllowed(key);
|
---|
2470 | return has;
|
---|
2471 | }
|
---|
2472 | });
|
---|
2473 |
|
---|
2474 | function defineProps() {
|
---|
2475 | return null;
|
---|
2476 | }
|
---|
2477 | function defineEmits() {
|
---|
2478 | return null;
|
---|
2479 | }
|
---|
2480 | function defineExpose(exposed) {
|
---|
2481 | }
|
---|
2482 | function defineOptions(options) {
|
---|
2483 | }
|
---|
2484 | function defineSlots() {
|
---|
2485 | return null;
|
---|
2486 | }
|
---|
2487 | function defineModel() {
|
---|
2488 | }
|
---|
2489 | function withDefaults(props, defaults) {
|
---|
2490 | return null;
|
---|
2491 | }
|
---|
2492 | function useSlots() {
|
---|
2493 | return getContext().slots;
|
---|
2494 | }
|
---|
2495 | function useAttrs() {
|
---|
2496 | return getContext().attrs;
|
---|
2497 | }
|
---|
2498 | function getContext() {
|
---|
2499 | const i = getCurrentInstance();
|
---|
2500 | return i.setupContext || (i.setupContext = createSetupContext(i));
|
---|
2501 | }
|
---|
2502 | function normalizePropsOrEmits(props) {
|
---|
2503 | return shared.isArray(props) ? props.reduce(
|
---|
2504 | (normalized, p) => (normalized[p] = null, normalized),
|
---|
2505 | {}
|
---|
2506 | ) : props;
|
---|
2507 | }
|
---|
2508 | function mergeDefaults(raw, defaults) {
|
---|
2509 | const props = normalizePropsOrEmits(raw);
|
---|
2510 | for (const key in defaults) {
|
---|
2511 | if (key.startsWith("__skip")) continue;
|
---|
2512 | let opt = props[key];
|
---|
2513 | if (opt) {
|
---|
2514 | if (shared.isArray(opt) || shared.isFunction(opt)) {
|
---|
2515 | opt = props[key] = { type: opt, default: defaults[key] };
|
---|
2516 | } else {
|
---|
2517 | opt.default = defaults[key];
|
---|
2518 | }
|
---|
2519 | } else if (opt === null) {
|
---|
2520 | opt = props[key] = { default: defaults[key] };
|
---|
2521 | } else ;
|
---|
2522 | if (opt && defaults[`__skip_${key}`]) {
|
---|
2523 | opt.skipFactory = true;
|
---|
2524 | }
|
---|
2525 | }
|
---|
2526 | return props;
|
---|
2527 | }
|
---|
2528 | function mergeModels(a, b) {
|
---|
2529 | if (!a || !b) return a || b;
|
---|
2530 | if (shared.isArray(a) && shared.isArray(b)) return a.concat(b);
|
---|
2531 | return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
|
---|
2532 | }
|
---|
2533 | function createPropsRestProxy(props, excludedKeys) {
|
---|
2534 | const ret = {};
|
---|
2535 | for (const key in props) {
|
---|
2536 | if (!excludedKeys.includes(key)) {
|
---|
2537 | Object.defineProperty(ret, key, {
|
---|
2538 | enumerable: true,
|
---|
2539 | get: () => props[key]
|
---|
2540 | });
|
---|
2541 | }
|
---|
2542 | }
|
---|
2543 | return ret;
|
---|
2544 | }
|
---|
2545 | function withAsyncContext(getAwaitable) {
|
---|
2546 | const ctx = getCurrentInstance();
|
---|
2547 | let awaitable = getAwaitable();
|
---|
2548 | unsetCurrentInstance();
|
---|
2549 | if (shared.isPromise(awaitable)) {
|
---|
2550 | awaitable = awaitable.catch((e) => {
|
---|
2551 | setCurrentInstance(ctx);
|
---|
2552 | throw e;
|
---|
2553 | });
|
---|
2554 | }
|
---|
2555 | return [awaitable, () => setCurrentInstance(ctx)];
|
---|
2556 | }
|
---|
2557 |
|
---|
2558 | let shouldCacheAccess = true;
|
---|
2559 | function applyOptions(instance) {
|
---|
2560 | const options = resolveMergedOptions(instance);
|
---|
2561 | const publicThis = instance.proxy;
|
---|
2562 | const ctx = instance.ctx;
|
---|
2563 | shouldCacheAccess = false;
|
---|
2564 | if (options.beforeCreate) {
|
---|
2565 | callHook(options.beforeCreate, instance, "bc");
|
---|
2566 | }
|
---|
2567 | const {
|
---|
2568 | // state
|
---|
2569 | data: dataOptions,
|
---|
2570 | computed: computedOptions,
|
---|
2571 | methods,
|
---|
2572 | watch: watchOptions,
|
---|
2573 | provide: provideOptions,
|
---|
2574 | inject: injectOptions,
|
---|
2575 | // lifecycle
|
---|
2576 | created,
|
---|
2577 | beforeMount,
|
---|
2578 | mounted,
|
---|
2579 | beforeUpdate,
|
---|
2580 | updated,
|
---|
2581 | activated,
|
---|
2582 | deactivated,
|
---|
2583 | beforeDestroy,
|
---|
2584 | beforeUnmount,
|
---|
2585 | destroyed,
|
---|
2586 | unmounted,
|
---|
2587 | render,
|
---|
2588 | renderTracked,
|
---|
2589 | renderTriggered,
|
---|
2590 | errorCaptured,
|
---|
2591 | serverPrefetch,
|
---|
2592 | // public API
|
---|
2593 | expose,
|
---|
2594 | inheritAttrs,
|
---|
2595 | // assets
|
---|
2596 | components,
|
---|
2597 | directives,
|
---|
2598 | filters
|
---|
2599 | } = options;
|
---|
2600 | const checkDuplicateProperties = null;
|
---|
2601 | if (injectOptions) {
|
---|
2602 | resolveInjections(injectOptions, ctx, checkDuplicateProperties);
|
---|
2603 | }
|
---|
2604 | if (methods) {
|
---|
2605 | for (const key in methods) {
|
---|
2606 | const methodHandler = methods[key];
|
---|
2607 | if (shared.isFunction(methodHandler)) {
|
---|
2608 | {
|
---|
2609 | ctx[key] = methodHandler.bind(publicThis);
|
---|
2610 | }
|
---|
2611 | }
|
---|
2612 | }
|
---|
2613 | }
|
---|
2614 | if (dataOptions) {
|
---|
2615 | const data = dataOptions.call(publicThis, publicThis);
|
---|
2616 | if (!shared.isObject(data)) ; else {
|
---|
2617 | instance.data = reactivity.reactive(data);
|
---|
2618 | }
|
---|
2619 | }
|
---|
2620 | shouldCacheAccess = true;
|
---|
2621 | if (computedOptions) {
|
---|
2622 | for (const key in computedOptions) {
|
---|
2623 | const opt = computedOptions[key];
|
---|
2624 | const get = shared.isFunction(opt) ? opt.bind(publicThis, publicThis) : shared.isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : shared.NOOP;
|
---|
2625 | const set = !shared.isFunction(opt) && shared.isFunction(opt.set) ? opt.set.bind(publicThis) : shared.NOOP;
|
---|
2626 | const c = computed({
|
---|
2627 | get,
|
---|
2628 | set
|
---|
2629 | });
|
---|
2630 | Object.defineProperty(ctx, key, {
|
---|
2631 | enumerable: true,
|
---|
2632 | configurable: true,
|
---|
2633 | get: () => c.value,
|
---|
2634 | set: (v) => c.value = v
|
---|
2635 | });
|
---|
2636 | }
|
---|
2637 | }
|
---|
2638 | if (watchOptions) {
|
---|
2639 | for (const key in watchOptions) {
|
---|
2640 | createWatcher(watchOptions[key], ctx, publicThis, key);
|
---|
2641 | }
|
---|
2642 | }
|
---|
2643 | if (provideOptions) {
|
---|
2644 | const provides = shared.isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
|
---|
2645 | Reflect.ownKeys(provides).forEach((key) => {
|
---|
2646 | provide(key, provides[key]);
|
---|
2647 | });
|
---|
2648 | }
|
---|
2649 | if (created) {
|
---|
2650 | callHook(created, instance, "c");
|
---|
2651 | }
|
---|
2652 | function registerLifecycleHook(register, hook) {
|
---|
2653 | if (shared.isArray(hook)) {
|
---|
2654 | hook.forEach((_hook) => register(_hook.bind(publicThis)));
|
---|
2655 | } else if (hook) {
|
---|
2656 | register(hook.bind(publicThis));
|
---|
2657 | }
|
---|
2658 | }
|
---|
2659 | registerLifecycleHook(onBeforeMount, beforeMount);
|
---|
2660 | registerLifecycleHook(onMounted, mounted);
|
---|
2661 | registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
---|
2662 | registerLifecycleHook(onUpdated, updated);
|
---|
2663 | registerLifecycleHook(onActivated, activated);
|
---|
2664 | registerLifecycleHook(onDeactivated, deactivated);
|
---|
2665 | registerLifecycleHook(onErrorCaptured, errorCaptured);
|
---|
2666 | registerLifecycleHook(onRenderTracked, renderTracked);
|
---|
2667 | registerLifecycleHook(onRenderTriggered, renderTriggered);
|
---|
2668 | registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
---|
2669 | registerLifecycleHook(onUnmounted, unmounted);
|
---|
2670 | registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
---|
2671 | if (shared.isArray(expose)) {
|
---|
2672 | if (expose.length) {
|
---|
2673 | const exposed = instance.exposed || (instance.exposed = {});
|
---|
2674 | expose.forEach((key) => {
|
---|
2675 | Object.defineProperty(exposed, key, {
|
---|
2676 | get: () => publicThis[key],
|
---|
2677 | set: (val) => publicThis[key] = val
|
---|
2678 | });
|
---|
2679 | });
|
---|
2680 | } else if (!instance.exposed) {
|
---|
2681 | instance.exposed = {};
|
---|
2682 | }
|
---|
2683 | }
|
---|
2684 | if (render && instance.render === shared.NOOP) {
|
---|
2685 | instance.render = render;
|
---|
2686 | }
|
---|
2687 | if (inheritAttrs != null) {
|
---|
2688 | instance.inheritAttrs = inheritAttrs;
|
---|
2689 | }
|
---|
2690 | if (components) instance.components = components;
|
---|
2691 | if (directives) instance.directives = directives;
|
---|
2692 | if (serverPrefetch) {
|
---|
2693 | markAsyncBoundary(instance);
|
---|
2694 | }
|
---|
2695 | }
|
---|
2696 | function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
|
---|
2697 | if (shared.isArray(injectOptions)) {
|
---|
2698 | injectOptions = normalizeInject(injectOptions);
|
---|
2699 | }
|
---|
2700 | for (const key in injectOptions) {
|
---|
2701 | const opt = injectOptions[key];
|
---|
2702 | let injected;
|
---|
2703 | if (shared.isObject(opt)) {
|
---|
2704 | if ("default" in opt) {
|
---|
2705 | injected = inject(
|
---|
2706 | opt.from || key,
|
---|
2707 | opt.default,
|
---|
2708 | true
|
---|
2709 | );
|
---|
2710 | } else {
|
---|
2711 | injected = inject(opt.from || key);
|
---|
2712 | }
|
---|
2713 | } else {
|
---|
2714 | injected = inject(opt);
|
---|
2715 | }
|
---|
2716 | if (reactivity.isRef(injected)) {
|
---|
2717 | Object.defineProperty(ctx, key, {
|
---|
2718 | enumerable: true,
|
---|
2719 | configurable: true,
|
---|
2720 | get: () => injected.value,
|
---|
2721 | set: (v) => injected.value = v
|
---|
2722 | });
|
---|
2723 | } else {
|
---|
2724 | ctx[key] = injected;
|
---|
2725 | }
|
---|
2726 | }
|
---|
2727 | }
|
---|
2728 | function callHook(hook, instance, type) {
|
---|
2729 | callWithAsyncErrorHandling(
|
---|
2730 | shared.isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
|
---|
2731 | instance,
|
---|
2732 | type
|
---|
2733 | );
|
---|
2734 | }
|
---|
2735 | function createWatcher(raw, ctx, publicThis, key) {
|
---|
2736 | let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
|
---|
2737 | if (shared.isString(raw)) {
|
---|
2738 | const handler = ctx[raw];
|
---|
2739 | if (shared.isFunction(handler)) {
|
---|
2740 | {
|
---|
2741 | watch(getter, handler);
|
---|
2742 | }
|
---|
2743 | }
|
---|
2744 | } else if (shared.isFunction(raw)) {
|
---|
2745 | {
|
---|
2746 | watch(getter, raw.bind(publicThis));
|
---|
2747 | }
|
---|
2748 | } else if (shared.isObject(raw)) {
|
---|
2749 | if (shared.isArray(raw)) {
|
---|
2750 | raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
---|
2751 | } else {
|
---|
2752 | const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
---|
2753 | if (shared.isFunction(handler)) {
|
---|
2754 | watch(getter, handler, raw);
|
---|
2755 | }
|
---|
2756 | }
|
---|
2757 | } else ;
|
---|
2758 | }
|
---|
2759 | function resolveMergedOptions(instance) {
|
---|
2760 | const base = instance.type;
|
---|
2761 | const { mixins, extends: extendsOptions } = base;
|
---|
2762 | const {
|
---|
2763 | mixins: globalMixins,
|
---|
2764 | optionsCache: cache,
|
---|
2765 | config: { optionMergeStrategies }
|
---|
2766 | } = instance.appContext;
|
---|
2767 | const cached = cache.get(base);
|
---|
2768 | let resolved;
|
---|
2769 | if (cached) {
|
---|
2770 | resolved = cached;
|
---|
2771 | } else if (!globalMixins.length && !mixins && !extendsOptions) {
|
---|
2772 | {
|
---|
2773 | resolved = base;
|
---|
2774 | }
|
---|
2775 | } else {
|
---|
2776 | resolved = {};
|
---|
2777 | if (globalMixins.length) {
|
---|
2778 | globalMixins.forEach(
|
---|
2779 | (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
|
---|
2780 | );
|
---|
2781 | }
|
---|
2782 | mergeOptions(resolved, base, optionMergeStrategies);
|
---|
2783 | }
|
---|
2784 | if (shared.isObject(base)) {
|
---|
2785 | cache.set(base, resolved);
|
---|
2786 | }
|
---|
2787 | return resolved;
|
---|
2788 | }
|
---|
2789 | function mergeOptions(to, from, strats, asMixin = false) {
|
---|
2790 | const { mixins, extends: extendsOptions } = from;
|
---|
2791 | if (extendsOptions) {
|
---|
2792 | mergeOptions(to, extendsOptions, strats, true);
|
---|
2793 | }
|
---|
2794 | if (mixins) {
|
---|
2795 | mixins.forEach(
|
---|
2796 | (m) => mergeOptions(to, m, strats, true)
|
---|
2797 | );
|
---|
2798 | }
|
---|
2799 | for (const key in from) {
|
---|
2800 | if (asMixin && key === "expose") ; else {
|
---|
2801 | const strat = internalOptionMergeStrats[key] || strats && strats[key];
|
---|
2802 | to[key] = strat ? strat(to[key], from[key]) : from[key];
|
---|
2803 | }
|
---|
2804 | }
|
---|
2805 | return to;
|
---|
2806 | }
|
---|
2807 | const internalOptionMergeStrats = {
|
---|
2808 | data: mergeDataFn,
|
---|
2809 | props: mergeEmitsOrPropsOptions,
|
---|
2810 | emits: mergeEmitsOrPropsOptions,
|
---|
2811 | // objects
|
---|
2812 | methods: mergeObjectOptions,
|
---|
2813 | computed: mergeObjectOptions,
|
---|
2814 | // lifecycle
|
---|
2815 | beforeCreate: mergeAsArray,
|
---|
2816 | created: mergeAsArray,
|
---|
2817 | beforeMount: mergeAsArray,
|
---|
2818 | mounted: mergeAsArray,
|
---|
2819 | beforeUpdate: mergeAsArray,
|
---|
2820 | updated: mergeAsArray,
|
---|
2821 | beforeDestroy: mergeAsArray,
|
---|
2822 | beforeUnmount: mergeAsArray,
|
---|
2823 | destroyed: mergeAsArray,
|
---|
2824 | unmounted: mergeAsArray,
|
---|
2825 | activated: mergeAsArray,
|
---|
2826 | deactivated: mergeAsArray,
|
---|
2827 | errorCaptured: mergeAsArray,
|
---|
2828 | serverPrefetch: mergeAsArray,
|
---|
2829 | // assets
|
---|
2830 | components: mergeObjectOptions,
|
---|
2831 | directives: mergeObjectOptions,
|
---|
2832 | // watch
|
---|
2833 | watch: mergeWatchOptions,
|
---|
2834 | // provide / inject
|
---|
2835 | provide: mergeDataFn,
|
---|
2836 | inject: mergeInject
|
---|
2837 | };
|
---|
2838 | function mergeDataFn(to, from) {
|
---|
2839 | if (!from) {
|
---|
2840 | return to;
|
---|
2841 | }
|
---|
2842 | if (!to) {
|
---|
2843 | return from;
|
---|
2844 | }
|
---|
2845 | return function mergedDataFn() {
|
---|
2846 | return (shared.extend)(
|
---|
2847 | shared.isFunction(to) ? to.call(this, this) : to,
|
---|
2848 | shared.isFunction(from) ? from.call(this, this) : from
|
---|
2849 | );
|
---|
2850 | };
|
---|
2851 | }
|
---|
2852 | function mergeInject(to, from) {
|
---|
2853 | return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
---|
2854 | }
|
---|
2855 | function normalizeInject(raw) {
|
---|
2856 | if (shared.isArray(raw)) {
|
---|
2857 | const res = {};
|
---|
2858 | for (let i = 0; i < raw.length; i++) {
|
---|
2859 | res[raw[i]] = raw[i];
|
---|
2860 | }
|
---|
2861 | return res;
|
---|
2862 | }
|
---|
2863 | return raw;
|
---|
2864 | }
|
---|
2865 | function mergeAsArray(to, from) {
|
---|
2866 | return to ? [...new Set([].concat(to, from))] : from;
|
---|
2867 | }
|
---|
2868 | function mergeObjectOptions(to, from) {
|
---|
2869 | return to ? shared.extend(/* @__PURE__ */ Object.create(null), to, from) : from;
|
---|
2870 | }
|
---|
2871 | function mergeEmitsOrPropsOptions(to, from) {
|
---|
2872 | if (to) {
|
---|
2873 | if (shared.isArray(to) && shared.isArray(from)) {
|
---|
2874 | return [.../* @__PURE__ */ new Set([...to, ...from])];
|
---|
2875 | }
|
---|
2876 | return shared.extend(
|
---|
2877 | /* @__PURE__ */ Object.create(null),
|
---|
2878 | normalizePropsOrEmits(to),
|
---|
2879 | normalizePropsOrEmits(from != null ? from : {})
|
---|
2880 | );
|
---|
2881 | } else {
|
---|
2882 | return from;
|
---|
2883 | }
|
---|
2884 | }
|
---|
2885 | function mergeWatchOptions(to, from) {
|
---|
2886 | if (!to) return from;
|
---|
2887 | if (!from) return to;
|
---|
2888 | const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
|
---|
2889 | for (const key in from) {
|
---|
2890 | merged[key] = mergeAsArray(to[key], from[key]);
|
---|
2891 | }
|
---|
2892 | return merged;
|
---|
2893 | }
|
---|
2894 |
|
---|
2895 | function createAppContext() {
|
---|
2896 | return {
|
---|
2897 | app: null,
|
---|
2898 | config: {
|
---|
2899 | isNativeTag: shared.NO,
|
---|
2900 | performance: false,
|
---|
2901 | globalProperties: {},
|
---|
2902 | optionMergeStrategies: {},
|
---|
2903 | errorHandler: void 0,
|
---|
2904 | warnHandler: void 0,
|
---|
2905 | compilerOptions: {}
|
---|
2906 | },
|
---|
2907 | mixins: [],
|
---|
2908 | components: {},
|
---|
2909 | directives: {},
|
---|
2910 | provides: /* @__PURE__ */ Object.create(null),
|
---|
2911 | optionsCache: /* @__PURE__ */ new WeakMap(),
|
---|
2912 | propsCache: /* @__PURE__ */ new WeakMap(),
|
---|
2913 | emitsCache: /* @__PURE__ */ new WeakMap()
|
---|
2914 | };
|
---|
2915 | }
|
---|
2916 | let uid$1 = 0;
|
---|
2917 | function createAppAPI(render, hydrate) {
|
---|
2918 | return function createApp(rootComponent, rootProps = null) {
|
---|
2919 | if (!shared.isFunction(rootComponent)) {
|
---|
2920 | rootComponent = shared.extend({}, rootComponent);
|
---|
2921 | }
|
---|
2922 | if (rootProps != null && !shared.isObject(rootProps)) {
|
---|
2923 | rootProps = null;
|
---|
2924 | }
|
---|
2925 | const context = createAppContext();
|
---|
2926 | const installedPlugins = /* @__PURE__ */ new WeakSet();
|
---|
2927 | const pluginCleanupFns = [];
|
---|
2928 | let isMounted = false;
|
---|
2929 | const app = context.app = {
|
---|
2930 | _uid: uid$1++,
|
---|
2931 | _component: rootComponent,
|
---|
2932 | _props: rootProps,
|
---|
2933 | _container: null,
|
---|
2934 | _context: context,
|
---|
2935 | _instance: null,
|
---|
2936 | version,
|
---|
2937 | get config() {
|
---|
2938 | return context.config;
|
---|
2939 | },
|
---|
2940 | set config(v) {
|
---|
2941 | },
|
---|
2942 | use(plugin, ...options) {
|
---|
2943 | if (installedPlugins.has(plugin)) ; else if (plugin && shared.isFunction(plugin.install)) {
|
---|
2944 | installedPlugins.add(plugin);
|
---|
2945 | plugin.install(app, ...options);
|
---|
2946 | } else if (shared.isFunction(plugin)) {
|
---|
2947 | installedPlugins.add(plugin);
|
---|
2948 | plugin(app, ...options);
|
---|
2949 | } else ;
|
---|
2950 | return app;
|
---|
2951 | },
|
---|
2952 | mixin(mixin) {
|
---|
2953 | {
|
---|
2954 | if (!context.mixins.includes(mixin)) {
|
---|
2955 | context.mixins.push(mixin);
|
---|
2956 | }
|
---|
2957 | }
|
---|
2958 | return app;
|
---|
2959 | },
|
---|
2960 | component(name, component) {
|
---|
2961 | if (!component) {
|
---|
2962 | return context.components[name];
|
---|
2963 | }
|
---|
2964 | context.components[name] = component;
|
---|
2965 | return app;
|
---|
2966 | },
|
---|
2967 | directive(name, directive) {
|
---|
2968 | if (!directive) {
|
---|
2969 | return context.directives[name];
|
---|
2970 | }
|
---|
2971 | context.directives[name] = directive;
|
---|
2972 | return app;
|
---|
2973 | },
|
---|
2974 | mount(rootContainer, isHydrate, namespace) {
|
---|
2975 | if (!isMounted) {
|
---|
2976 | const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
|
---|
2977 | vnode.appContext = context;
|
---|
2978 | if (namespace === true) {
|
---|
2979 | namespace = "svg";
|
---|
2980 | } else if (namespace === false) {
|
---|
2981 | namespace = void 0;
|
---|
2982 | }
|
---|
2983 | if (isHydrate && hydrate) {
|
---|
2984 | hydrate(vnode, rootContainer);
|
---|
2985 | } else {
|
---|
2986 | render(vnode, rootContainer, namespace);
|
---|
2987 | }
|
---|
2988 | isMounted = true;
|
---|
2989 | app._container = rootContainer;
|
---|
2990 | rootContainer.__vue_app__ = app;
|
---|
2991 | return getComponentPublicInstance(vnode.component);
|
---|
2992 | }
|
---|
2993 | },
|
---|
2994 | onUnmount(cleanupFn) {
|
---|
2995 | pluginCleanupFns.push(cleanupFn);
|
---|
2996 | },
|
---|
2997 | unmount() {
|
---|
2998 | if (isMounted) {
|
---|
2999 | callWithAsyncErrorHandling(
|
---|
3000 | pluginCleanupFns,
|
---|
3001 | app._instance,
|
---|
3002 | 16
|
---|
3003 | );
|
---|
3004 | render(null, app._container);
|
---|
3005 | delete app._container.__vue_app__;
|
---|
3006 | }
|
---|
3007 | },
|
---|
3008 | provide(key, value) {
|
---|
3009 | context.provides[key] = value;
|
---|
3010 | return app;
|
---|
3011 | },
|
---|
3012 | runWithContext(fn) {
|
---|
3013 | const lastApp = currentApp;
|
---|
3014 | currentApp = app;
|
---|
3015 | try {
|
---|
3016 | return fn();
|
---|
3017 | } finally {
|
---|
3018 | currentApp = lastApp;
|
---|
3019 | }
|
---|
3020 | }
|
---|
3021 | };
|
---|
3022 | return app;
|
---|
3023 | };
|
---|
3024 | }
|
---|
3025 | let currentApp = null;
|
---|
3026 |
|
---|
3027 | function provide(key, value) {
|
---|
3028 | if (!currentInstance) ; else {
|
---|
3029 | let provides = currentInstance.provides;
|
---|
3030 | const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
---|
3031 | if (parentProvides === provides) {
|
---|
3032 | provides = currentInstance.provides = Object.create(parentProvides);
|
---|
3033 | }
|
---|
3034 | provides[key] = value;
|
---|
3035 | }
|
---|
3036 | }
|
---|
3037 | function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
---|
3038 | const instance = currentInstance || currentRenderingInstance;
|
---|
3039 | if (instance || currentApp) {
|
---|
3040 | const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
|
---|
3041 | if (provides && key in provides) {
|
---|
3042 | return provides[key];
|
---|
3043 | } else if (arguments.length > 1) {
|
---|
3044 | return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
---|
3045 | } else ;
|
---|
3046 | }
|
---|
3047 | }
|
---|
3048 | function hasInjectionContext() {
|
---|
3049 | return !!(currentInstance || currentRenderingInstance || currentApp);
|
---|
3050 | }
|
---|
3051 |
|
---|
3052 | const internalObjectProto = {};
|
---|
3053 | const createInternalObject = () => Object.create(internalObjectProto);
|
---|
3054 | const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
---|
3055 |
|
---|
3056 | function initProps(instance, rawProps, isStateful, isSSR = false) {
|
---|
3057 | const props = {};
|
---|
3058 | const attrs = createInternalObject();
|
---|
3059 | instance.propsDefaults = /* @__PURE__ */ Object.create(null);
|
---|
3060 | setFullProps(instance, rawProps, props, attrs);
|
---|
3061 | for (const key in instance.propsOptions[0]) {
|
---|
3062 | if (!(key in props)) {
|
---|
3063 | props[key] = void 0;
|
---|
3064 | }
|
---|
3065 | }
|
---|
3066 | if (isStateful) {
|
---|
3067 | instance.props = isSSR ? props : reactivity.shallowReactive(props);
|
---|
3068 | } else {
|
---|
3069 | if (!instance.type.props) {
|
---|
3070 | instance.props = attrs;
|
---|
3071 | } else {
|
---|
3072 | instance.props = props;
|
---|
3073 | }
|
---|
3074 | }
|
---|
3075 | instance.attrs = attrs;
|
---|
3076 | }
|
---|
3077 | function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
---|
3078 | const {
|
---|
3079 | props,
|
---|
3080 | attrs,
|
---|
3081 | vnode: { patchFlag }
|
---|
3082 | } = instance;
|
---|
3083 | const rawCurrentProps = reactivity.toRaw(props);
|
---|
3084 | const [options] = instance.propsOptions;
|
---|
3085 | let hasAttrsChanged = false;
|
---|
3086 | if (
|
---|
3087 | // always force full diff in dev
|
---|
3088 | // - #1942 if hmr is enabled with sfc component
|
---|
3089 | // - vite#872 non-sfc component used by sfc component
|
---|
3090 | (optimized || patchFlag > 0) && !(patchFlag & 16)
|
---|
3091 | ) {
|
---|
3092 | if (patchFlag & 8) {
|
---|
3093 | const propsToUpdate = instance.vnode.dynamicProps;
|
---|
3094 | for (let i = 0; i < propsToUpdate.length; i++) {
|
---|
3095 | let key = propsToUpdate[i];
|
---|
3096 | if (isEmitListener(instance.emitsOptions, key)) {
|
---|
3097 | continue;
|
---|
3098 | }
|
---|
3099 | const value = rawProps[key];
|
---|
3100 | if (options) {
|
---|
3101 | if (shared.hasOwn(attrs, key)) {
|
---|
3102 | if (value !== attrs[key]) {
|
---|
3103 | attrs[key] = value;
|
---|
3104 | hasAttrsChanged = true;
|
---|
3105 | }
|
---|
3106 | } else {
|
---|
3107 | const camelizedKey = shared.camelize(key);
|
---|
3108 | props[camelizedKey] = resolvePropValue(
|
---|
3109 | options,
|
---|
3110 | rawCurrentProps,
|
---|
3111 | camelizedKey,
|
---|
3112 | value,
|
---|
3113 | instance,
|
---|
3114 | false
|
---|
3115 | );
|
---|
3116 | }
|
---|
3117 | } else {
|
---|
3118 | if (value !== attrs[key]) {
|
---|
3119 | attrs[key] = value;
|
---|
3120 | hasAttrsChanged = true;
|
---|
3121 | }
|
---|
3122 | }
|
---|
3123 | }
|
---|
3124 | }
|
---|
3125 | } else {
|
---|
3126 | if (setFullProps(instance, rawProps, props, attrs)) {
|
---|
3127 | hasAttrsChanged = true;
|
---|
3128 | }
|
---|
3129 | let kebabKey;
|
---|
3130 | for (const key in rawCurrentProps) {
|
---|
3131 | if (!rawProps || // for camelCase
|
---|
3132 | !shared.hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
|
---|
3133 | // and converted to camelCase (#955)
|
---|
3134 | ((kebabKey = shared.hyphenate(key)) === key || !shared.hasOwn(rawProps, kebabKey))) {
|
---|
3135 | if (options) {
|
---|
3136 | if (rawPrevProps && // for camelCase
|
---|
3137 | (rawPrevProps[key] !== void 0 || // for kebab-case
|
---|
3138 | rawPrevProps[kebabKey] !== void 0)) {
|
---|
3139 | props[key] = resolvePropValue(
|
---|
3140 | options,
|
---|
3141 | rawCurrentProps,
|
---|
3142 | key,
|
---|
3143 | void 0,
|
---|
3144 | instance,
|
---|
3145 | true
|
---|
3146 | );
|
---|
3147 | }
|
---|
3148 | } else {
|
---|
3149 | delete props[key];
|
---|
3150 | }
|
---|
3151 | }
|
---|
3152 | }
|
---|
3153 | if (attrs !== rawCurrentProps) {
|
---|
3154 | for (const key in attrs) {
|
---|
3155 | if (!rawProps || !shared.hasOwn(rawProps, key) && true) {
|
---|
3156 | delete attrs[key];
|
---|
3157 | hasAttrsChanged = true;
|
---|
3158 | }
|
---|
3159 | }
|
---|
3160 | }
|
---|
3161 | }
|
---|
3162 | if (hasAttrsChanged) {
|
---|
3163 | reactivity.trigger(instance.attrs, "set", "");
|
---|
3164 | }
|
---|
3165 | }
|
---|
3166 | function setFullProps(instance, rawProps, props, attrs) {
|
---|
3167 | const [options, needCastKeys] = instance.propsOptions;
|
---|
3168 | let hasAttrsChanged = false;
|
---|
3169 | let rawCastValues;
|
---|
3170 | if (rawProps) {
|
---|
3171 | for (let key in rawProps) {
|
---|
3172 | if (shared.isReservedProp(key)) {
|
---|
3173 | continue;
|
---|
3174 | }
|
---|
3175 | const value = rawProps[key];
|
---|
3176 | let camelKey;
|
---|
3177 | if (options && shared.hasOwn(options, camelKey = shared.camelize(key))) {
|
---|
3178 | if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
---|
3179 | props[camelKey] = value;
|
---|
3180 | } else {
|
---|
3181 | (rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
---|
3182 | }
|
---|
3183 | } else if (!isEmitListener(instance.emitsOptions, key)) {
|
---|
3184 | if (!(key in attrs) || value !== attrs[key]) {
|
---|
3185 | attrs[key] = value;
|
---|
3186 | hasAttrsChanged = true;
|
---|
3187 | }
|
---|
3188 | }
|
---|
3189 | }
|
---|
3190 | }
|
---|
3191 | if (needCastKeys) {
|
---|
3192 | const rawCurrentProps = reactivity.toRaw(props);
|
---|
3193 | const castValues = rawCastValues || shared.EMPTY_OBJ;
|
---|
3194 | for (let i = 0; i < needCastKeys.length; i++) {
|
---|
3195 | const key = needCastKeys[i];
|
---|
3196 | props[key] = resolvePropValue(
|
---|
3197 | options,
|
---|
3198 | rawCurrentProps,
|
---|
3199 | key,
|
---|
3200 | castValues[key],
|
---|
3201 | instance,
|
---|
3202 | !shared.hasOwn(castValues, key)
|
---|
3203 | );
|
---|
3204 | }
|
---|
3205 | }
|
---|
3206 | return hasAttrsChanged;
|
---|
3207 | }
|
---|
3208 | function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
---|
3209 | const opt = options[key];
|
---|
3210 | if (opt != null) {
|
---|
3211 | const hasDefault = shared.hasOwn(opt, "default");
|
---|
3212 | if (hasDefault && value === void 0) {
|
---|
3213 | const defaultValue = opt.default;
|
---|
3214 | if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
|
---|
3215 | const { propsDefaults } = instance;
|
---|
3216 | if (key in propsDefaults) {
|
---|
3217 | value = propsDefaults[key];
|
---|
3218 | } else {
|
---|
3219 | const reset = setCurrentInstance(instance);
|
---|
3220 | value = propsDefaults[key] = defaultValue.call(
|
---|
3221 | null,
|
---|
3222 | props
|
---|
3223 | );
|
---|
3224 | reset();
|
---|
3225 | }
|
---|
3226 | } else {
|
---|
3227 | value = defaultValue;
|
---|
3228 | }
|
---|
3229 | if (instance.ce) {
|
---|
3230 | instance.ce._setProp(key, value);
|
---|
3231 | }
|
---|
3232 | }
|
---|
3233 | if (opt[0 /* shouldCast */]) {
|
---|
3234 | if (isAbsent && !hasDefault) {
|
---|
3235 | value = false;
|
---|
3236 | } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === shared.hyphenate(key))) {
|
---|
3237 | value = true;
|
---|
3238 | }
|
---|
3239 | }
|
---|
3240 | }
|
---|
3241 | return value;
|
---|
3242 | }
|
---|
3243 | const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
---|
3244 | function normalizePropsOptions(comp, appContext, asMixin = false) {
|
---|
3245 | const cache = asMixin ? mixinPropsCache : appContext.propsCache;
|
---|
3246 | const cached = cache.get(comp);
|
---|
3247 | if (cached) {
|
---|
3248 | return cached;
|
---|
3249 | }
|
---|
3250 | const raw = comp.props;
|
---|
3251 | const normalized = {};
|
---|
3252 | const needCastKeys = [];
|
---|
3253 | let hasExtends = false;
|
---|
3254 | if (!shared.isFunction(comp)) {
|
---|
3255 | const extendProps = (raw2) => {
|
---|
3256 | hasExtends = true;
|
---|
3257 | const [props, keys] = normalizePropsOptions(raw2, appContext, true);
|
---|
3258 | shared.extend(normalized, props);
|
---|
3259 | if (keys) needCastKeys.push(...keys);
|
---|
3260 | };
|
---|
3261 | if (!asMixin && appContext.mixins.length) {
|
---|
3262 | appContext.mixins.forEach(extendProps);
|
---|
3263 | }
|
---|
3264 | if (comp.extends) {
|
---|
3265 | extendProps(comp.extends);
|
---|
3266 | }
|
---|
3267 | if (comp.mixins) {
|
---|
3268 | comp.mixins.forEach(extendProps);
|
---|
3269 | }
|
---|
3270 | }
|
---|
3271 | if (!raw && !hasExtends) {
|
---|
3272 | if (shared.isObject(comp)) {
|
---|
3273 | cache.set(comp, shared.EMPTY_ARR);
|
---|
3274 | }
|
---|
3275 | return shared.EMPTY_ARR;
|
---|
3276 | }
|
---|
3277 | if (shared.isArray(raw)) {
|
---|
3278 | for (let i = 0; i < raw.length; i++) {
|
---|
3279 | const normalizedKey = shared.camelize(raw[i]);
|
---|
3280 | if (validatePropName(normalizedKey)) {
|
---|
3281 | normalized[normalizedKey] = shared.EMPTY_OBJ;
|
---|
3282 | }
|
---|
3283 | }
|
---|
3284 | } else if (raw) {
|
---|
3285 | for (const key in raw) {
|
---|
3286 | const normalizedKey = shared.camelize(key);
|
---|
3287 | if (validatePropName(normalizedKey)) {
|
---|
3288 | const opt = raw[key];
|
---|
3289 | const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
|
---|
3290 | const propType = prop.type;
|
---|
3291 | let shouldCast = false;
|
---|
3292 | let shouldCastTrue = true;
|
---|
3293 | if (shared.isArray(propType)) {
|
---|
3294 | for (let index = 0; index < propType.length; ++index) {
|
---|
3295 | const type = propType[index];
|
---|
3296 | const typeName = shared.isFunction(type) && type.name;
|
---|
3297 | if (typeName === "Boolean") {
|
---|
3298 | shouldCast = true;
|
---|
3299 | break;
|
---|
3300 | } else if (typeName === "String") {
|
---|
3301 | shouldCastTrue = false;
|
---|
3302 | }
|
---|
3303 | }
|
---|
3304 | } else {
|
---|
3305 | shouldCast = shared.isFunction(propType) && propType.name === "Boolean";
|
---|
3306 | }
|
---|
3307 | prop[0 /* shouldCast */] = shouldCast;
|
---|
3308 | prop[1 /* shouldCastTrue */] = shouldCastTrue;
|
---|
3309 | if (shouldCast || shared.hasOwn(prop, "default")) {
|
---|
3310 | needCastKeys.push(normalizedKey);
|
---|
3311 | }
|
---|
3312 | }
|
---|
3313 | }
|
---|
3314 | }
|
---|
3315 | const res = [normalized, needCastKeys];
|
---|
3316 | if (shared.isObject(comp)) {
|
---|
3317 | cache.set(comp, res);
|
---|
3318 | }
|
---|
3319 | return res;
|
---|
3320 | }
|
---|
3321 | function validatePropName(key) {
|
---|
3322 | if (key[0] !== "$" && !shared.isReservedProp(key)) {
|
---|
3323 | return true;
|
---|
3324 | }
|
---|
3325 | return false;
|
---|
3326 | }
|
---|
3327 |
|
---|
3328 | const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
---|
3329 | const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
|
---|
3330 | const normalizeSlot = (key, rawSlot, ctx) => {
|
---|
3331 | if (rawSlot._n) {
|
---|
3332 | return rawSlot;
|
---|
3333 | }
|
---|
3334 | const normalized = withCtx((...args) => {
|
---|
3335 | if (false) ;
|
---|
3336 | return normalizeSlotValue(rawSlot(...args));
|
---|
3337 | }, ctx);
|
---|
3338 | normalized._c = false;
|
---|
3339 | return normalized;
|
---|
3340 | };
|
---|
3341 | const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
---|
3342 | const ctx = rawSlots._ctx;
|
---|
3343 | for (const key in rawSlots) {
|
---|
3344 | if (isInternalKey(key)) continue;
|
---|
3345 | const value = rawSlots[key];
|
---|
3346 | if (shared.isFunction(value)) {
|
---|
3347 | slots[key] = normalizeSlot(key, value, ctx);
|
---|
3348 | } else if (value != null) {
|
---|
3349 | const normalized = normalizeSlotValue(value);
|
---|
3350 | slots[key] = () => normalized;
|
---|
3351 | }
|
---|
3352 | }
|
---|
3353 | };
|
---|
3354 | const normalizeVNodeSlots = (instance, children) => {
|
---|
3355 | const normalized = normalizeSlotValue(children);
|
---|
3356 | instance.slots.default = () => normalized;
|
---|
3357 | };
|
---|
3358 | const assignSlots = (slots, children, optimized) => {
|
---|
3359 | for (const key in children) {
|
---|
3360 | if (optimized || key !== "_") {
|
---|
3361 | slots[key] = children[key];
|
---|
3362 | }
|
---|
3363 | }
|
---|
3364 | };
|
---|
3365 | const initSlots = (instance, children, optimized) => {
|
---|
3366 | const slots = instance.slots = createInternalObject();
|
---|
3367 | if (instance.vnode.shapeFlag & 32) {
|
---|
3368 | const type = children._;
|
---|
3369 | if (type) {
|
---|
3370 | assignSlots(slots, children, optimized);
|
---|
3371 | if (optimized) {
|
---|
3372 | shared.def(slots, "_", type, true);
|
---|
3373 | }
|
---|
3374 | } else {
|
---|
3375 | normalizeObjectSlots(children, slots);
|
---|
3376 | }
|
---|
3377 | } else if (children) {
|
---|
3378 | normalizeVNodeSlots(instance, children);
|
---|
3379 | }
|
---|
3380 | };
|
---|
3381 | const updateSlots = (instance, children, optimized) => {
|
---|
3382 | const { vnode, slots } = instance;
|
---|
3383 | let needDeletionCheck = true;
|
---|
3384 | let deletionComparisonTarget = shared.EMPTY_OBJ;
|
---|
3385 | if (vnode.shapeFlag & 32) {
|
---|
3386 | const type = children._;
|
---|
3387 | if (type) {
|
---|
3388 | if (optimized && type === 1) {
|
---|
3389 | needDeletionCheck = false;
|
---|
3390 | } else {
|
---|
3391 | assignSlots(slots, children, optimized);
|
---|
3392 | }
|
---|
3393 | } else {
|
---|
3394 | needDeletionCheck = !children.$stable;
|
---|
3395 | normalizeObjectSlots(children, slots);
|
---|
3396 | }
|
---|
3397 | deletionComparisonTarget = children;
|
---|
3398 | } else if (children) {
|
---|
3399 | normalizeVNodeSlots(instance, children);
|
---|
3400 | deletionComparisonTarget = { default: 1 };
|
---|
3401 | }
|
---|
3402 | if (needDeletionCheck) {
|
---|
3403 | for (const key in slots) {
|
---|
3404 | if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
|
---|
3405 | delete slots[key];
|
---|
3406 | }
|
---|
3407 | }
|
---|
3408 | }
|
---|
3409 | };
|
---|
3410 |
|
---|
3411 | const queuePostRenderEffect = queueEffectWithSuspense ;
|
---|
3412 | function createRenderer(options) {
|
---|
3413 | return baseCreateRenderer(options);
|
---|
3414 | }
|
---|
3415 | function createHydrationRenderer(options) {
|
---|
3416 | return baseCreateRenderer(options, createHydrationFunctions);
|
---|
3417 | }
|
---|
3418 | function baseCreateRenderer(options, createHydrationFns) {
|
---|
3419 | const target = shared.getGlobalThis();
|
---|
3420 | target.__VUE__ = true;
|
---|
3421 | const {
|
---|
3422 | insert: hostInsert,
|
---|
3423 | remove: hostRemove,
|
---|
3424 | patchProp: hostPatchProp,
|
---|
3425 | createElement: hostCreateElement,
|
---|
3426 | createText: hostCreateText,
|
---|
3427 | createComment: hostCreateComment,
|
---|
3428 | setText: hostSetText,
|
---|
3429 | setElementText: hostSetElementText,
|
---|
3430 | parentNode: hostParentNode,
|
---|
3431 | nextSibling: hostNextSibling,
|
---|
3432 | setScopeId: hostSetScopeId = shared.NOOP,
|
---|
3433 | insertStaticContent: hostInsertStaticContent
|
---|
3434 | } = options;
|
---|
3435 | const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = !!n2.dynamicChildren) => {
|
---|
3436 | if (n1 === n2) {
|
---|
3437 | return;
|
---|
3438 | }
|
---|
3439 | if (n1 && !isSameVNodeType(n1, n2)) {
|
---|
3440 | anchor = getNextHostNode(n1);
|
---|
3441 | unmount(n1, parentComponent, parentSuspense, true);
|
---|
3442 | n1 = null;
|
---|
3443 | }
|
---|
3444 | if (n2.patchFlag === -2) {
|
---|
3445 | optimized = false;
|
---|
3446 | n2.dynamicChildren = null;
|
---|
3447 | }
|
---|
3448 | const { type, ref, shapeFlag } = n2;
|
---|
3449 | switch (type) {
|
---|
3450 | case Text:
|
---|
3451 | processText(n1, n2, container, anchor);
|
---|
3452 | break;
|
---|
3453 | case Comment:
|
---|
3454 | processCommentNode(n1, n2, container, anchor);
|
---|
3455 | break;
|
---|
3456 | case Static:
|
---|
3457 | if (n1 == null) {
|
---|
3458 | mountStaticNode(n2, container, anchor, namespace);
|
---|
3459 | }
|
---|
3460 | break;
|
---|
3461 | case Fragment:
|
---|
3462 | processFragment(
|
---|
3463 | n1,
|
---|
3464 | n2,
|
---|
3465 | container,
|
---|
3466 | anchor,
|
---|
3467 | parentComponent,
|
---|
3468 | parentSuspense,
|
---|
3469 | namespace,
|
---|
3470 | slotScopeIds,
|
---|
3471 | optimized
|
---|
3472 | );
|
---|
3473 | break;
|
---|
3474 | default:
|
---|
3475 | if (shapeFlag & 1) {
|
---|
3476 | processElement(
|
---|
3477 | n1,
|
---|
3478 | n2,
|
---|
3479 | container,
|
---|
3480 | anchor,
|
---|
3481 | parentComponent,
|
---|
3482 | parentSuspense,
|
---|
3483 | namespace,
|
---|
3484 | slotScopeIds,
|
---|
3485 | optimized
|
---|
3486 | );
|
---|
3487 | } else if (shapeFlag & 6) {
|
---|
3488 | processComponent(
|
---|
3489 | n1,
|
---|
3490 | n2,
|
---|
3491 | container,
|
---|
3492 | anchor,
|
---|
3493 | parentComponent,
|
---|
3494 | parentSuspense,
|
---|
3495 | namespace,
|
---|
3496 | slotScopeIds,
|
---|
3497 | optimized
|
---|
3498 | );
|
---|
3499 | } else if (shapeFlag & 64) {
|
---|
3500 | type.process(
|
---|
3501 | n1,
|
---|
3502 | n2,
|
---|
3503 | container,
|
---|
3504 | anchor,
|
---|
3505 | parentComponent,
|
---|
3506 | parentSuspense,
|
---|
3507 | namespace,
|
---|
3508 | slotScopeIds,
|
---|
3509 | optimized,
|
---|
3510 | internals
|
---|
3511 | );
|
---|
3512 | } else if (shapeFlag & 128) {
|
---|
3513 | type.process(
|
---|
3514 | n1,
|
---|
3515 | n2,
|
---|
3516 | container,
|
---|
3517 | anchor,
|
---|
3518 | parentComponent,
|
---|
3519 | parentSuspense,
|
---|
3520 | namespace,
|
---|
3521 | slotScopeIds,
|
---|
3522 | optimized,
|
---|
3523 | internals
|
---|
3524 | );
|
---|
3525 | } else ;
|
---|
3526 | }
|
---|
3527 | if (ref != null && parentComponent) {
|
---|
3528 | setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
|
---|
3529 | }
|
---|
3530 | };
|
---|
3531 | const processText = (n1, n2, container, anchor) => {
|
---|
3532 | if (n1 == null) {
|
---|
3533 | hostInsert(
|
---|
3534 | n2.el = hostCreateText(n2.children),
|
---|
3535 | container,
|
---|
3536 | anchor
|
---|
3537 | );
|
---|
3538 | } else {
|
---|
3539 | const el = n2.el = n1.el;
|
---|
3540 | if (n2.children !== n1.children) {
|
---|
3541 | hostSetText(el, n2.children);
|
---|
3542 | }
|
---|
3543 | }
|
---|
3544 | };
|
---|
3545 | const processCommentNode = (n1, n2, container, anchor) => {
|
---|
3546 | if (n1 == null) {
|
---|
3547 | hostInsert(
|
---|
3548 | n2.el = hostCreateComment(n2.children || ""),
|
---|
3549 | container,
|
---|
3550 | anchor
|
---|
3551 | );
|
---|
3552 | } else {
|
---|
3553 | n2.el = n1.el;
|
---|
3554 | }
|
---|
3555 | };
|
---|
3556 | const mountStaticNode = (n2, container, anchor, namespace) => {
|
---|
3557 | [n2.el, n2.anchor] = hostInsertStaticContent(
|
---|
3558 | n2.children,
|
---|
3559 | container,
|
---|
3560 | anchor,
|
---|
3561 | namespace,
|
---|
3562 | n2.el,
|
---|
3563 | n2.anchor
|
---|
3564 | );
|
---|
3565 | };
|
---|
3566 | const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
|
---|
3567 | let next;
|
---|
3568 | while (el && el !== anchor) {
|
---|
3569 | next = hostNextSibling(el);
|
---|
3570 | hostInsert(el, container, nextSibling);
|
---|
3571 | el = next;
|
---|
3572 | }
|
---|
3573 | hostInsert(anchor, container, nextSibling);
|
---|
3574 | };
|
---|
3575 | const removeStaticNode = ({ el, anchor }) => {
|
---|
3576 | let next;
|
---|
3577 | while (el && el !== anchor) {
|
---|
3578 | next = hostNextSibling(el);
|
---|
3579 | hostRemove(el);
|
---|
3580 | el = next;
|
---|
3581 | }
|
---|
3582 | hostRemove(anchor);
|
---|
3583 | };
|
---|
3584 | const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
---|
3585 | if (n2.type === "svg") {
|
---|
3586 | namespace = "svg";
|
---|
3587 | } else if (n2.type === "math") {
|
---|
3588 | namespace = "mathml";
|
---|
3589 | }
|
---|
3590 | if (n1 == null) {
|
---|
3591 | mountElement(
|
---|
3592 | n2,
|
---|
3593 | container,
|
---|
3594 | anchor,
|
---|
3595 | parentComponent,
|
---|
3596 | parentSuspense,
|
---|
3597 | namespace,
|
---|
3598 | slotScopeIds,
|
---|
3599 | optimized
|
---|
3600 | );
|
---|
3601 | } else {
|
---|
3602 | patchElement(
|
---|
3603 | n1,
|
---|
3604 | n2,
|
---|
3605 | parentComponent,
|
---|
3606 | parentSuspense,
|
---|
3607 | namespace,
|
---|
3608 | slotScopeIds,
|
---|
3609 | optimized
|
---|
3610 | );
|
---|
3611 | }
|
---|
3612 | };
|
---|
3613 | const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
---|
3614 | let el;
|
---|
3615 | let vnodeHook;
|
---|
3616 | const { props, shapeFlag, transition, dirs } = vnode;
|
---|
3617 | el = vnode.el = hostCreateElement(
|
---|
3618 | vnode.type,
|
---|
3619 | namespace,
|
---|
3620 | props && props.is,
|
---|
3621 | props
|
---|
3622 | );
|
---|
3623 | if (shapeFlag & 8) {
|
---|
3624 | hostSetElementText(el, vnode.children);
|
---|
3625 | } else if (shapeFlag & 16) {
|
---|
3626 | mountChildren(
|
---|
3627 | vnode.children,
|
---|
3628 | el,
|
---|
3629 | null,
|
---|
3630 | parentComponent,
|
---|
3631 | parentSuspense,
|
---|
3632 | resolveChildrenNamespace(vnode, namespace),
|
---|
3633 | slotScopeIds,
|
---|
3634 | optimized
|
---|
3635 | );
|
---|
3636 | }
|
---|
3637 | if (dirs) {
|
---|
3638 | invokeDirectiveHook(vnode, null, parentComponent, "created");
|
---|
3639 | }
|
---|
3640 | setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
---|
3641 | if (props) {
|
---|
3642 | for (const key in props) {
|
---|
3643 | if (key !== "value" && !shared.isReservedProp(key)) {
|
---|
3644 | hostPatchProp(el, key, null, props[key], namespace, parentComponent);
|
---|
3645 | }
|
---|
3646 | }
|
---|
3647 | if ("value" in props) {
|
---|
3648 | hostPatchProp(el, "value", null, props.value, namespace);
|
---|
3649 | }
|
---|
3650 | if (vnodeHook = props.onVnodeBeforeMount) {
|
---|
3651 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
---|
3652 | }
|
---|
3653 | }
|
---|
3654 | if (dirs) {
|
---|
3655 | invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
---|
3656 | }
|
---|
3657 | const needCallTransitionHooks = needTransition(parentSuspense, transition);
|
---|
3658 | if (needCallTransitionHooks) {
|
---|
3659 | transition.beforeEnter(el);
|
---|
3660 | }
|
---|
3661 | hostInsert(el, container, anchor);
|
---|
3662 | if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
|
---|
3663 | queuePostRenderEffect(() => {
|
---|
3664 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
---|
3665 | needCallTransitionHooks && transition.enter(el);
|
---|
3666 | dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
---|
3667 | }, parentSuspense);
|
---|
3668 | }
|
---|
3669 | };
|
---|
3670 | const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
---|
3671 | if (scopeId) {
|
---|
3672 | hostSetScopeId(el, scopeId);
|
---|
3673 | }
|
---|
3674 | if (slotScopeIds) {
|
---|
3675 | for (let i = 0; i < slotScopeIds.length; i++) {
|
---|
3676 | hostSetScopeId(el, slotScopeIds[i]);
|
---|
3677 | }
|
---|
3678 | }
|
---|
3679 | if (parentComponent) {
|
---|
3680 | let subTree = parentComponent.subTree;
|
---|
3681 | if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
|
---|
3682 | const parentVNode = parentComponent.vnode;
|
---|
3683 | setScopeId(
|
---|
3684 | el,
|
---|
3685 | parentVNode,
|
---|
3686 | parentVNode.scopeId,
|
---|
3687 | parentVNode.slotScopeIds,
|
---|
3688 | parentComponent.parent
|
---|
3689 | );
|
---|
3690 | }
|
---|
3691 | }
|
---|
3692 | };
|
---|
3693 | const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
|
---|
3694 | for (let i = start; i < children.length; i++) {
|
---|
3695 | const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
|
---|
3696 | patch(
|
---|
3697 | null,
|
---|
3698 | child,
|
---|
3699 | container,
|
---|
3700 | anchor,
|
---|
3701 | parentComponent,
|
---|
3702 | parentSuspense,
|
---|
3703 | namespace,
|
---|
3704 | slotScopeIds,
|
---|
3705 | optimized
|
---|
3706 | );
|
---|
3707 | }
|
---|
3708 | };
|
---|
3709 | const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
---|
3710 | const el = n2.el = n1.el;
|
---|
3711 | let { patchFlag, dynamicChildren, dirs } = n2;
|
---|
3712 | patchFlag |= n1.patchFlag & 16;
|
---|
3713 | const oldProps = n1.props || shared.EMPTY_OBJ;
|
---|
3714 | const newProps = n2.props || shared.EMPTY_OBJ;
|
---|
3715 | let vnodeHook;
|
---|
3716 | parentComponent && toggleRecurse(parentComponent, false);
|
---|
3717 | if (vnodeHook = newProps.onVnodeBeforeUpdate) {
|
---|
3718 | invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
---|
3719 | }
|
---|
3720 | if (dirs) {
|
---|
3721 | invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
---|
3722 | }
|
---|
3723 | parentComponent && toggleRecurse(parentComponent, true);
|
---|
3724 | if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
|
---|
3725 | hostSetElementText(el, "");
|
---|
3726 | }
|
---|
3727 | if (dynamicChildren) {
|
---|
3728 | patchBlockChildren(
|
---|
3729 | n1.dynamicChildren,
|
---|
3730 | dynamicChildren,
|
---|
3731 | el,
|
---|
3732 | parentComponent,
|
---|
3733 | parentSuspense,
|
---|
3734 | resolveChildrenNamespace(n2, namespace),
|
---|
3735 | slotScopeIds
|
---|
3736 | );
|
---|
3737 | } else if (!optimized) {
|
---|
3738 | patchChildren(
|
---|
3739 | n1,
|
---|
3740 | n2,
|
---|
3741 | el,
|
---|
3742 | null,
|
---|
3743 | parentComponent,
|
---|
3744 | parentSuspense,
|
---|
3745 | resolveChildrenNamespace(n2, namespace),
|
---|
3746 | slotScopeIds,
|
---|
3747 | false
|
---|
3748 | );
|
---|
3749 | }
|
---|
3750 | if (patchFlag > 0) {
|
---|
3751 | if (patchFlag & 16) {
|
---|
3752 | patchProps(el, oldProps, newProps, parentComponent, namespace);
|
---|
3753 | } else {
|
---|
3754 | if (patchFlag & 2) {
|
---|
3755 | if (oldProps.class !== newProps.class) {
|
---|
3756 | hostPatchProp(el, "class", null, newProps.class, namespace);
|
---|
3757 | }
|
---|
3758 | }
|
---|
3759 | if (patchFlag & 4) {
|
---|
3760 | hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
|
---|
3761 | }
|
---|
3762 | if (patchFlag & 8) {
|
---|
3763 | const propsToUpdate = n2.dynamicProps;
|
---|
3764 | for (let i = 0; i < propsToUpdate.length; i++) {
|
---|
3765 | const key = propsToUpdate[i];
|
---|
3766 | const prev = oldProps[key];
|
---|
3767 | const next = newProps[key];
|
---|
3768 | if (next !== prev || key === "value") {
|
---|
3769 | hostPatchProp(el, key, prev, next, namespace, parentComponent);
|
---|
3770 | }
|
---|
3771 | }
|
---|
3772 | }
|
---|
3773 | }
|
---|
3774 | if (patchFlag & 1) {
|
---|
3775 | if (n1.children !== n2.children) {
|
---|
3776 | hostSetElementText(el, n2.children);
|
---|
3777 | }
|
---|
3778 | }
|
---|
3779 | } else if (!optimized && dynamicChildren == null) {
|
---|
3780 | patchProps(el, oldProps, newProps, parentComponent, namespace);
|
---|
3781 | }
|
---|
3782 | if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
---|
3783 | queuePostRenderEffect(() => {
|
---|
3784 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
---|
3785 | dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
---|
3786 | }, parentSuspense);
|
---|
3787 | }
|
---|
3788 | };
|
---|
3789 | const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
|
---|
3790 | for (let i = 0; i < newChildren.length; i++) {
|
---|
3791 | const oldVNode = oldChildren[i];
|
---|
3792 | const newVNode = newChildren[i];
|
---|
3793 | const container = (
|
---|
3794 | // oldVNode may be an errored async setup() component inside Suspense
|
---|
3795 | // which will not have a mounted element
|
---|
3796 | oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
|
---|
3797 | // of the Fragment itself so it can move its children.
|
---|
3798 | (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
|
---|
3799 | // which also requires the correct parent container
|
---|
3800 | !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
|
---|
3801 | oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
|
---|
3802 | // In other cases, the parent container is not actually used so we
|
---|
3803 | // just pass the block element here to avoid a DOM parentNode call.
|
---|
3804 | fallbackContainer
|
---|
3805 | )
|
---|
3806 | );
|
---|
3807 | patch(
|
---|
3808 | oldVNode,
|
---|
3809 | newVNode,
|
---|
3810 | container,
|
---|
3811 | null,
|
---|
3812 | parentComponent,
|
---|
3813 | parentSuspense,
|
---|
3814 | namespace,
|
---|
3815 | slotScopeIds,
|
---|
3816 | true
|
---|
3817 | );
|
---|
3818 | }
|
---|
3819 | };
|
---|
3820 | const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
|
---|
3821 | if (oldProps !== newProps) {
|
---|
3822 | if (oldProps !== shared.EMPTY_OBJ) {
|
---|
3823 | for (const key in oldProps) {
|
---|
3824 | if (!shared.isReservedProp(key) && !(key in newProps)) {
|
---|
3825 | hostPatchProp(
|
---|
3826 | el,
|
---|
3827 | key,
|
---|
3828 | oldProps[key],
|
---|
3829 | null,
|
---|
3830 | namespace,
|
---|
3831 | parentComponent
|
---|
3832 | );
|
---|
3833 | }
|
---|
3834 | }
|
---|
3835 | }
|
---|
3836 | for (const key in newProps) {
|
---|
3837 | if (shared.isReservedProp(key)) continue;
|
---|
3838 | const next = newProps[key];
|
---|
3839 | const prev = oldProps[key];
|
---|
3840 | if (next !== prev && key !== "value") {
|
---|
3841 | hostPatchProp(el, key, prev, next, namespace, parentComponent);
|
---|
3842 | }
|
---|
3843 | }
|
---|
3844 | if ("value" in newProps) {
|
---|
3845 | hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
|
---|
3846 | }
|
---|
3847 | }
|
---|
3848 | };
|
---|
3849 | const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
---|
3850 | const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
|
---|
3851 | const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
|
---|
3852 | let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
---|
3853 | if (fragmentSlotScopeIds) {
|
---|
3854 | slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
---|
3855 | }
|
---|
3856 | if (n1 == null) {
|
---|
3857 | hostInsert(fragmentStartAnchor, container, anchor);
|
---|
3858 | hostInsert(fragmentEndAnchor, container, anchor);
|
---|
3859 | mountChildren(
|
---|
3860 | // #10007
|
---|
3861 | // such fragment like `<></>` will be compiled into
|
---|
3862 | // a fragment which doesn't have a children.
|
---|
3863 | // In this case fallback to an empty array
|
---|
3864 | n2.children || [],
|
---|
3865 | container,
|
---|
3866 | fragmentEndAnchor,
|
---|
3867 | parentComponent,
|
---|
3868 | parentSuspense,
|
---|
3869 | namespace,
|
---|
3870 | slotScopeIds,
|
---|
3871 | optimized
|
---|
3872 | );
|
---|
3873 | } else {
|
---|
3874 | if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
|
---|
3875 | // of renderSlot() with no valid children
|
---|
3876 | n1.dynamicChildren) {
|
---|
3877 | patchBlockChildren(
|
---|
3878 | n1.dynamicChildren,
|
---|
3879 | dynamicChildren,
|
---|
3880 | container,
|
---|
3881 | parentComponent,
|
---|
3882 | parentSuspense,
|
---|
3883 | namespace,
|
---|
3884 | slotScopeIds
|
---|
3885 | );
|
---|
3886 | if (
|
---|
3887 | // #2080 if the stable fragment has a key, it's a <template v-for> that may
|
---|
3888 | // get moved around. Make sure all root level vnodes inherit el.
|
---|
3889 | // #2134 or if it's a component root, it may also get moved around
|
---|
3890 | // as the component is being moved.
|
---|
3891 | n2.key != null || parentComponent && n2 === parentComponent.subTree
|
---|
3892 | ) {
|
---|
3893 | traverseStaticChildren(
|
---|
3894 | n1,
|
---|
3895 | n2,
|
---|
3896 | true
|
---|
3897 | /* shallow */
|
---|
3898 | );
|
---|
3899 | }
|
---|
3900 | } else {
|
---|
3901 | patchChildren(
|
---|
3902 | n1,
|
---|
3903 | n2,
|
---|
3904 | container,
|
---|
3905 | fragmentEndAnchor,
|
---|
3906 | parentComponent,
|
---|
3907 | parentSuspense,
|
---|
3908 | namespace,
|
---|
3909 | slotScopeIds,
|
---|
3910 | optimized
|
---|
3911 | );
|
---|
3912 | }
|
---|
3913 | }
|
---|
3914 | };
|
---|
3915 | const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
---|
3916 | n2.slotScopeIds = slotScopeIds;
|
---|
3917 | if (n1 == null) {
|
---|
3918 | if (n2.shapeFlag & 512) {
|
---|
3919 | parentComponent.ctx.activate(
|
---|
3920 | n2,
|
---|
3921 | container,
|
---|
3922 | anchor,
|
---|
3923 | namespace,
|
---|
3924 | optimized
|
---|
3925 | );
|
---|
3926 | } else {
|
---|
3927 | mountComponent(
|
---|
3928 | n2,
|
---|
3929 | container,
|
---|
3930 | anchor,
|
---|
3931 | parentComponent,
|
---|
3932 | parentSuspense,
|
---|
3933 | namespace,
|
---|
3934 | optimized
|
---|
3935 | );
|
---|
3936 | }
|
---|
3937 | } else {
|
---|
3938 | updateComponent(n1, n2, optimized);
|
---|
3939 | }
|
---|
3940 | };
|
---|
3941 | const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
|
---|
3942 | const instance = (initialVNode.component = createComponentInstance(
|
---|
3943 | initialVNode,
|
---|
3944 | parentComponent,
|
---|
3945 | parentSuspense
|
---|
3946 | ));
|
---|
3947 | if (isKeepAlive(initialVNode)) {
|
---|
3948 | instance.ctx.renderer = internals;
|
---|
3949 | }
|
---|
3950 | {
|
---|
3951 | setupComponent(instance, false, optimized);
|
---|
3952 | }
|
---|
3953 | if (instance.asyncDep) {
|
---|
3954 | parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
|
---|
3955 | if (!initialVNode.el) {
|
---|
3956 | const placeholder = instance.subTree = createVNode(Comment);
|
---|
3957 | processCommentNode(null, placeholder, container, anchor);
|
---|
3958 | }
|
---|
3959 | } else {
|
---|
3960 | setupRenderEffect(
|
---|
3961 | instance,
|
---|
3962 | initialVNode,
|
---|
3963 | container,
|
---|
3964 | anchor,
|
---|
3965 | parentSuspense,
|
---|
3966 | namespace,
|
---|
3967 | optimized
|
---|
3968 | );
|
---|
3969 | }
|
---|
3970 | };
|
---|
3971 | const updateComponent = (n1, n2, optimized) => {
|
---|
3972 | const instance = n2.component = n1.component;
|
---|
3973 | if (shouldUpdateComponent(n1, n2, optimized)) {
|
---|
3974 | if (instance.asyncDep && !instance.asyncResolved) {
|
---|
3975 | updateComponentPreRender(instance, n2, optimized);
|
---|
3976 | return;
|
---|
3977 | } else {
|
---|
3978 | instance.next = n2;
|
---|
3979 | instance.update();
|
---|
3980 | }
|
---|
3981 | } else {
|
---|
3982 | n2.el = n1.el;
|
---|
3983 | instance.vnode = n2;
|
---|
3984 | }
|
---|
3985 | };
|
---|
3986 | const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
|
---|
3987 | const componentUpdateFn = () => {
|
---|
3988 | if (!instance.isMounted) {
|
---|
3989 | let vnodeHook;
|
---|
3990 | const { el, props } = initialVNode;
|
---|
3991 | const { bm, m, parent, root, type } = instance;
|
---|
3992 | const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
---|
3993 | toggleRecurse(instance, false);
|
---|
3994 | if (bm) {
|
---|
3995 | shared.invokeArrayFns(bm);
|
---|
3996 | }
|
---|
3997 | if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
|
---|
3998 | invokeVNodeHook(vnodeHook, parent, initialVNode);
|
---|
3999 | }
|
---|
4000 | toggleRecurse(instance, true);
|
---|
4001 | if (el && hydrateNode) {
|
---|
4002 | const hydrateSubTree = () => {
|
---|
4003 | instance.subTree = renderComponentRoot(instance);
|
---|
4004 | hydrateNode(
|
---|
4005 | el,
|
---|
4006 | instance.subTree,
|
---|
4007 | instance,
|
---|
4008 | parentSuspense,
|
---|
4009 | null
|
---|
4010 | );
|
---|
4011 | };
|
---|
4012 | if (isAsyncWrapperVNode && type.__asyncHydrate) {
|
---|
4013 | type.__asyncHydrate(
|
---|
4014 | el,
|
---|
4015 | instance,
|
---|
4016 | hydrateSubTree
|
---|
4017 | );
|
---|
4018 | } else {
|
---|
4019 | hydrateSubTree();
|
---|
4020 | }
|
---|
4021 | } else {
|
---|
4022 | if (root.ce) {
|
---|
4023 | root.ce._injectChildStyle(type);
|
---|
4024 | }
|
---|
4025 | const subTree = instance.subTree = renderComponentRoot(instance);
|
---|
4026 | patch(
|
---|
4027 | null,
|
---|
4028 | subTree,
|
---|
4029 | container,
|
---|
4030 | anchor,
|
---|
4031 | instance,
|
---|
4032 | parentSuspense,
|
---|
4033 | namespace
|
---|
4034 | );
|
---|
4035 | initialVNode.el = subTree.el;
|
---|
4036 | }
|
---|
4037 | if (m) {
|
---|
4038 | queuePostRenderEffect(m, parentSuspense);
|
---|
4039 | }
|
---|
4040 | if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
|
---|
4041 | const scopedInitialVNode = initialVNode;
|
---|
4042 | queuePostRenderEffect(
|
---|
4043 | () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
|
---|
4044 | parentSuspense
|
---|
4045 | );
|
---|
4046 | }
|
---|
4047 | if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
---|
4048 | instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
---|
4049 | }
|
---|
4050 | instance.isMounted = true;
|
---|
4051 | initialVNode = container = anchor = null;
|
---|
4052 | } else {
|
---|
4053 | let { next, bu, u, parent, vnode } = instance;
|
---|
4054 | {
|
---|
4055 | const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
|
---|
4056 | if (nonHydratedAsyncRoot) {
|
---|
4057 | if (next) {
|
---|
4058 | next.el = vnode.el;
|
---|
4059 | updateComponentPreRender(instance, next, optimized);
|
---|
4060 | }
|
---|
4061 | nonHydratedAsyncRoot.asyncDep.then(() => {
|
---|
4062 | if (!instance.isUnmounted) {
|
---|
4063 | componentUpdateFn();
|
---|
4064 | }
|
---|
4065 | });
|
---|
4066 | return;
|
---|
4067 | }
|
---|
4068 | }
|
---|
4069 | let originNext = next;
|
---|
4070 | let vnodeHook;
|
---|
4071 | toggleRecurse(instance, false);
|
---|
4072 | if (next) {
|
---|
4073 | next.el = vnode.el;
|
---|
4074 | updateComponentPreRender(instance, next, optimized);
|
---|
4075 | } else {
|
---|
4076 | next = vnode;
|
---|
4077 | }
|
---|
4078 | if (bu) {
|
---|
4079 | shared.invokeArrayFns(bu);
|
---|
4080 | }
|
---|
4081 | if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
|
---|
4082 | invokeVNodeHook(vnodeHook, parent, next, vnode);
|
---|
4083 | }
|
---|
4084 | toggleRecurse(instance, true);
|
---|
4085 | const nextTree = renderComponentRoot(instance);
|
---|
4086 | const prevTree = instance.subTree;
|
---|
4087 | instance.subTree = nextTree;
|
---|
4088 | patch(
|
---|
4089 | prevTree,
|
---|
4090 | nextTree,
|
---|
4091 | // parent may have changed if it's in a teleport
|
---|
4092 | hostParentNode(prevTree.el),
|
---|
4093 | // anchor may have changed if it's in a fragment
|
---|
4094 | getNextHostNode(prevTree),
|
---|
4095 | instance,
|
---|
4096 | parentSuspense,
|
---|
4097 | namespace
|
---|
4098 | );
|
---|
4099 | next.el = nextTree.el;
|
---|
4100 | if (originNext === null) {
|
---|
4101 | updateHOCHostEl(instance, nextTree.el);
|
---|
4102 | }
|
---|
4103 | if (u) {
|
---|
4104 | queuePostRenderEffect(u, parentSuspense);
|
---|
4105 | }
|
---|
4106 | if (vnodeHook = next.props && next.props.onVnodeUpdated) {
|
---|
4107 | queuePostRenderEffect(
|
---|
4108 | () => invokeVNodeHook(vnodeHook, parent, next, vnode),
|
---|
4109 | parentSuspense
|
---|
4110 | );
|
---|
4111 | }
|
---|
4112 | }
|
---|
4113 | };
|
---|
4114 | instance.scope.on();
|
---|
4115 | const effect = instance.effect = new reactivity.ReactiveEffect(componentUpdateFn);
|
---|
4116 | instance.scope.off();
|
---|
4117 | const update = instance.update = effect.run.bind(effect);
|
---|
4118 | const job = instance.job = effect.runIfDirty.bind(effect);
|
---|
4119 | job.i = instance;
|
---|
4120 | job.id = instance.uid;
|
---|
4121 | effect.scheduler = () => queueJob(job);
|
---|
4122 | toggleRecurse(instance, true);
|
---|
4123 | update();
|
---|
4124 | };
|
---|
4125 | const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
---|
4126 | nextVNode.component = instance;
|
---|
4127 | const prevProps = instance.vnode.props;
|
---|
4128 | instance.vnode = nextVNode;
|
---|
4129 | instance.next = null;
|
---|
4130 | updateProps(instance, nextVNode.props, prevProps, optimized);
|
---|
4131 | updateSlots(instance, nextVNode.children, optimized);
|
---|
4132 | reactivity.pauseTracking();
|
---|
4133 | flushPreFlushCbs(instance);
|
---|
4134 | reactivity.resetTracking();
|
---|
4135 | };
|
---|
4136 | const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
|
---|
4137 | const c1 = n1 && n1.children;
|
---|
4138 | const prevShapeFlag = n1 ? n1.shapeFlag : 0;
|
---|
4139 | const c2 = n2.children;
|
---|
4140 | const { patchFlag, shapeFlag } = n2;
|
---|
4141 | if (patchFlag > 0) {
|
---|
4142 | if (patchFlag & 128) {
|
---|
4143 | patchKeyedChildren(
|
---|
4144 | c1,
|
---|
4145 | c2,
|
---|
4146 | container,
|
---|
4147 | anchor,
|
---|
4148 | parentComponent,
|
---|
4149 | parentSuspense,
|
---|
4150 | namespace,
|
---|
4151 | slotScopeIds,
|
---|
4152 | optimized
|
---|
4153 | );
|
---|
4154 | return;
|
---|
4155 | } else if (patchFlag & 256) {
|
---|
4156 | patchUnkeyedChildren(
|
---|
4157 | c1,
|
---|
4158 | c2,
|
---|
4159 | container,
|
---|
4160 | anchor,
|
---|
4161 | parentComponent,
|
---|
4162 | parentSuspense,
|
---|
4163 | namespace,
|
---|
4164 | slotScopeIds,
|
---|
4165 | optimized
|
---|
4166 | );
|
---|
4167 | return;
|
---|
4168 | }
|
---|
4169 | }
|
---|
4170 | if (shapeFlag & 8) {
|
---|
4171 | if (prevShapeFlag & 16) {
|
---|
4172 | unmountChildren(c1, parentComponent, parentSuspense);
|
---|
4173 | }
|
---|
4174 | if (c2 !== c1) {
|
---|
4175 | hostSetElementText(container, c2);
|
---|
4176 | }
|
---|
4177 | } else {
|
---|
4178 | if (prevShapeFlag & 16) {
|
---|
4179 | if (shapeFlag & 16) {
|
---|
4180 | patchKeyedChildren(
|
---|
4181 | c1,
|
---|
4182 | c2,
|
---|
4183 | container,
|
---|
4184 | anchor,
|
---|
4185 | parentComponent,
|
---|
4186 | parentSuspense,
|
---|
4187 | namespace,
|
---|
4188 | slotScopeIds,
|
---|
4189 | optimized
|
---|
4190 | );
|
---|
4191 | } else {
|
---|
4192 | unmountChildren(c1, parentComponent, parentSuspense, true);
|
---|
4193 | }
|
---|
4194 | } else {
|
---|
4195 | if (prevShapeFlag & 8) {
|
---|
4196 | hostSetElementText(container, "");
|
---|
4197 | }
|
---|
4198 | if (shapeFlag & 16) {
|
---|
4199 | mountChildren(
|
---|
4200 | c2,
|
---|
4201 | container,
|
---|
4202 | anchor,
|
---|
4203 | parentComponent,
|
---|
4204 | parentSuspense,
|
---|
4205 | namespace,
|
---|
4206 | slotScopeIds,
|
---|
4207 | optimized
|
---|
4208 | );
|
---|
4209 | }
|
---|
4210 | }
|
---|
4211 | }
|
---|
4212 | };
|
---|
4213 | const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
---|
4214 | c1 = c1 || shared.EMPTY_ARR;
|
---|
4215 | c2 = c2 || shared.EMPTY_ARR;
|
---|
4216 | const oldLength = c1.length;
|
---|
4217 | const newLength = c2.length;
|
---|
4218 | const commonLength = Math.min(oldLength, newLength);
|
---|
4219 | let i;
|
---|
4220 | for (i = 0; i < commonLength; i++) {
|
---|
4221 | const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
---|
4222 | patch(
|
---|
4223 | c1[i],
|
---|
4224 | nextChild,
|
---|
4225 | container,
|
---|
4226 | null,
|
---|
4227 | parentComponent,
|
---|
4228 | parentSuspense,
|
---|
4229 | namespace,
|
---|
4230 | slotScopeIds,
|
---|
4231 | optimized
|
---|
4232 | );
|
---|
4233 | }
|
---|
4234 | if (oldLength > newLength) {
|
---|
4235 | unmountChildren(
|
---|
4236 | c1,
|
---|
4237 | parentComponent,
|
---|
4238 | parentSuspense,
|
---|
4239 | true,
|
---|
4240 | false,
|
---|
4241 | commonLength
|
---|
4242 | );
|
---|
4243 | } else {
|
---|
4244 | mountChildren(
|
---|
4245 | c2,
|
---|
4246 | container,
|
---|
4247 | anchor,
|
---|
4248 | parentComponent,
|
---|
4249 | parentSuspense,
|
---|
4250 | namespace,
|
---|
4251 | slotScopeIds,
|
---|
4252 | optimized,
|
---|
4253 | commonLength
|
---|
4254 | );
|
---|
4255 | }
|
---|
4256 | };
|
---|
4257 | const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
---|
4258 | let i = 0;
|
---|
4259 | const l2 = c2.length;
|
---|
4260 | let e1 = c1.length - 1;
|
---|
4261 | let e2 = l2 - 1;
|
---|
4262 | while (i <= e1 && i <= e2) {
|
---|
4263 | const n1 = c1[i];
|
---|
4264 | const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
---|
4265 | if (isSameVNodeType(n1, n2)) {
|
---|
4266 | patch(
|
---|
4267 | n1,
|
---|
4268 | n2,
|
---|
4269 | container,
|
---|
4270 | null,
|
---|
4271 | parentComponent,
|
---|
4272 | parentSuspense,
|
---|
4273 | namespace,
|
---|
4274 | slotScopeIds,
|
---|
4275 | optimized
|
---|
4276 | );
|
---|
4277 | } else {
|
---|
4278 | break;
|
---|
4279 | }
|
---|
4280 | i++;
|
---|
4281 | }
|
---|
4282 | while (i <= e1 && i <= e2) {
|
---|
4283 | const n1 = c1[e1];
|
---|
4284 | const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
|
---|
4285 | if (isSameVNodeType(n1, n2)) {
|
---|
4286 | patch(
|
---|
4287 | n1,
|
---|
4288 | n2,
|
---|
4289 | container,
|
---|
4290 | null,
|
---|
4291 | parentComponent,
|
---|
4292 | parentSuspense,
|
---|
4293 | namespace,
|
---|
4294 | slotScopeIds,
|
---|
4295 | optimized
|
---|
4296 | );
|
---|
4297 | } else {
|
---|
4298 | break;
|
---|
4299 | }
|
---|
4300 | e1--;
|
---|
4301 | e2--;
|
---|
4302 | }
|
---|
4303 | if (i > e1) {
|
---|
4304 | if (i <= e2) {
|
---|
4305 | const nextPos = e2 + 1;
|
---|
4306 | const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
|
---|
4307 | while (i <= e2) {
|
---|
4308 | patch(
|
---|
4309 | null,
|
---|
4310 | c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
|
---|
4311 | container,
|
---|
4312 | anchor,
|
---|
4313 | parentComponent,
|
---|
4314 | parentSuspense,
|
---|
4315 | namespace,
|
---|
4316 | slotScopeIds,
|
---|
4317 | optimized
|
---|
4318 | );
|
---|
4319 | i++;
|
---|
4320 | }
|
---|
4321 | }
|
---|
4322 | } else if (i > e2) {
|
---|
4323 | while (i <= e1) {
|
---|
4324 | unmount(c1[i], parentComponent, parentSuspense, true);
|
---|
4325 | i++;
|
---|
4326 | }
|
---|
4327 | } else {
|
---|
4328 | const s1 = i;
|
---|
4329 | const s2 = i;
|
---|
4330 | const keyToNewIndexMap = /* @__PURE__ */ new Map();
|
---|
4331 | for (i = s2; i <= e2; i++) {
|
---|
4332 | const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
---|
4333 | if (nextChild.key != null) {
|
---|
4334 | keyToNewIndexMap.set(nextChild.key, i);
|
---|
4335 | }
|
---|
4336 | }
|
---|
4337 | let j;
|
---|
4338 | let patched = 0;
|
---|
4339 | const toBePatched = e2 - s2 + 1;
|
---|
4340 | let moved = false;
|
---|
4341 | let maxNewIndexSoFar = 0;
|
---|
4342 | const newIndexToOldIndexMap = new Array(toBePatched);
|
---|
4343 | for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
|
---|
4344 | for (i = s1; i <= e1; i++) {
|
---|
4345 | const prevChild = c1[i];
|
---|
4346 | if (patched >= toBePatched) {
|
---|
4347 | unmount(prevChild, parentComponent, parentSuspense, true);
|
---|
4348 | continue;
|
---|
4349 | }
|
---|
4350 | let newIndex;
|
---|
4351 | if (prevChild.key != null) {
|
---|
4352 | newIndex = keyToNewIndexMap.get(prevChild.key);
|
---|
4353 | } else {
|
---|
4354 | for (j = s2; j <= e2; j++) {
|
---|
4355 | if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
|
---|
4356 | newIndex = j;
|
---|
4357 | break;
|
---|
4358 | }
|
---|
4359 | }
|
---|
4360 | }
|
---|
4361 | if (newIndex === void 0) {
|
---|
4362 | unmount(prevChild, parentComponent, parentSuspense, true);
|
---|
4363 | } else {
|
---|
4364 | newIndexToOldIndexMap[newIndex - s2] = i + 1;
|
---|
4365 | if (newIndex >= maxNewIndexSoFar) {
|
---|
4366 | maxNewIndexSoFar = newIndex;
|
---|
4367 | } else {
|
---|
4368 | moved = true;
|
---|
4369 | }
|
---|
4370 | patch(
|
---|
4371 | prevChild,
|
---|
4372 | c2[newIndex],
|
---|
4373 | container,
|
---|
4374 | null,
|
---|
4375 | parentComponent,
|
---|
4376 | parentSuspense,
|
---|
4377 | namespace,
|
---|
4378 | slotScopeIds,
|
---|
4379 | optimized
|
---|
4380 | );
|
---|
4381 | patched++;
|
---|
4382 | }
|
---|
4383 | }
|
---|
4384 | const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
|
---|
4385 | j = increasingNewIndexSequence.length - 1;
|
---|
4386 | for (i = toBePatched - 1; i >= 0; i--) {
|
---|
4387 | const nextIndex = s2 + i;
|
---|
4388 | const nextChild = c2[nextIndex];
|
---|
4389 | const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
|
---|
4390 | if (newIndexToOldIndexMap[i] === 0) {
|
---|
4391 | patch(
|
---|
4392 | null,
|
---|
4393 | nextChild,
|
---|
4394 | container,
|
---|
4395 | anchor,
|
---|
4396 | parentComponent,
|
---|
4397 | parentSuspense,
|
---|
4398 | namespace,
|
---|
4399 | slotScopeIds,
|
---|
4400 | optimized
|
---|
4401 | );
|
---|
4402 | } else if (moved) {
|
---|
4403 | if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
---|
4404 | move(nextChild, container, anchor, 2);
|
---|
4405 | } else {
|
---|
4406 | j--;
|
---|
4407 | }
|
---|
4408 | }
|
---|
4409 | }
|
---|
4410 | }
|
---|
4411 | };
|
---|
4412 | const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
---|
4413 | const { el, type, transition, children, shapeFlag } = vnode;
|
---|
4414 | if (shapeFlag & 6) {
|
---|
4415 | move(vnode.component.subTree, container, anchor, moveType);
|
---|
4416 | return;
|
---|
4417 | }
|
---|
4418 | if (shapeFlag & 128) {
|
---|
4419 | vnode.suspense.move(container, anchor, moveType);
|
---|
4420 | return;
|
---|
4421 | }
|
---|
4422 | if (shapeFlag & 64) {
|
---|
4423 | type.move(vnode, container, anchor, internals);
|
---|
4424 | return;
|
---|
4425 | }
|
---|
4426 | if (type === Fragment) {
|
---|
4427 | hostInsert(el, container, anchor);
|
---|
4428 | for (let i = 0; i < children.length; i++) {
|
---|
4429 | move(children[i], container, anchor, moveType);
|
---|
4430 | }
|
---|
4431 | hostInsert(vnode.anchor, container, anchor);
|
---|
4432 | return;
|
---|
4433 | }
|
---|
4434 | if (type === Static) {
|
---|
4435 | moveStaticNode(vnode, container, anchor);
|
---|
4436 | return;
|
---|
4437 | }
|
---|
4438 | const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
|
---|
4439 | if (needTransition2) {
|
---|
4440 | if (moveType === 0) {
|
---|
4441 | transition.beforeEnter(el);
|
---|
4442 | hostInsert(el, container, anchor);
|
---|
4443 | queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
---|
4444 | } else {
|
---|
4445 | const { leave, delayLeave, afterLeave } = transition;
|
---|
4446 | const remove2 = () => hostInsert(el, container, anchor);
|
---|
4447 | const performLeave = () => {
|
---|
4448 | leave(el, () => {
|
---|
4449 | remove2();
|
---|
4450 | afterLeave && afterLeave();
|
---|
4451 | });
|
---|
4452 | };
|
---|
4453 | if (delayLeave) {
|
---|
4454 | delayLeave(el, remove2, performLeave);
|
---|
4455 | } else {
|
---|
4456 | performLeave();
|
---|
4457 | }
|
---|
4458 | }
|
---|
4459 | } else {
|
---|
4460 | hostInsert(el, container, anchor);
|
---|
4461 | }
|
---|
4462 | };
|
---|
4463 | const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
|
---|
4464 | const {
|
---|
4465 | type,
|
---|
4466 | props,
|
---|
4467 | ref,
|
---|
4468 | children,
|
---|
4469 | dynamicChildren,
|
---|
4470 | shapeFlag,
|
---|
4471 | patchFlag,
|
---|
4472 | dirs,
|
---|
4473 | cacheIndex
|
---|
4474 | } = vnode;
|
---|
4475 | if (patchFlag === -2) {
|
---|
4476 | optimized = false;
|
---|
4477 | }
|
---|
4478 | if (ref != null) {
|
---|
4479 | setRef(ref, null, parentSuspense, vnode, true);
|
---|
4480 | }
|
---|
4481 | if (cacheIndex != null) {
|
---|
4482 | parentComponent.renderCache[cacheIndex] = void 0;
|
---|
4483 | }
|
---|
4484 | if (shapeFlag & 256) {
|
---|
4485 | parentComponent.ctx.deactivate(vnode);
|
---|
4486 | return;
|
---|
4487 | }
|
---|
4488 | const shouldInvokeDirs = shapeFlag & 1 && dirs;
|
---|
4489 | const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
---|
4490 | let vnodeHook;
|
---|
4491 | if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
---|
4492 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
---|
4493 | }
|
---|
4494 | if (shapeFlag & 6) {
|
---|
4495 | unmountComponent(vnode.component, parentSuspense, doRemove);
|
---|
4496 | } else {
|
---|
4497 | if (shapeFlag & 128) {
|
---|
4498 | vnode.suspense.unmount(parentSuspense, doRemove);
|
---|
4499 | return;
|
---|
4500 | }
|
---|
4501 | if (shouldInvokeDirs) {
|
---|
4502 | invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
---|
4503 | }
|
---|
4504 | if (shapeFlag & 64) {
|
---|
4505 | vnode.type.remove(
|
---|
4506 | vnode,
|
---|
4507 | parentComponent,
|
---|
4508 | parentSuspense,
|
---|
4509 | internals,
|
---|
4510 | doRemove
|
---|
4511 | );
|
---|
4512 | } else if (dynamicChildren && // #5154
|
---|
4513 | // when v-once is used inside a block, setBlockTracking(-1) marks the
|
---|
4514 | // parent block with hasOnce: true
|
---|
4515 | // so that it doesn't take the fast path during unmount - otherwise
|
---|
4516 | // components nested in v-once are never unmounted.
|
---|
4517 | !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
|
---|
4518 | (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
|
---|
4519 | unmountChildren(
|
---|
4520 | dynamicChildren,
|
---|
4521 | parentComponent,
|
---|
4522 | parentSuspense,
|
---|
4523 | false,
|
---|
4524 | true
|
---|
4525 | );
|
---|
4526 | } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
|
---|
4527 | unmountChildren(children, parentComponent, parentSuspense);
|
---|
4528 | }
|
---|
4529 | if (doRemove) {
|
---|
4530 | remove(vnode);
|
---|
4531 | }
|
---|
4532 | }
|
---|
4533 | if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
---|
4534 | queuePostRenderEffect(() => {
|
---|
4535 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
---|
4536 | shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
---|
4537 | }, parentSuspense);
|
---|
4538 | }
|
---|
4539 | };
|
---|
4540 | const remove = (vnode) => {
|
---|
4541 | const { type, el, anchor, transition } = vnode;
|
---|
4542 | if (type === Fragment) {
|
---|
4543 | {
|
---|
4544 | removeFragment(el, anchor);
|
---|
4545 | }
|
---|
4546 | return;
|
---|
4547 | }
|
---|
4548 | if (type === Static) {
|
---|
4549 | removeStaticNode(vnode);
|
---|
4550 | return;
|
---|
4551 | }
|
---|
4552 | const performRemove = () => {
|
---|
4553 | hostRemove(el);
|
---|
4554 | if (transition && !transition.persisted && transition.afterLeave) {
|
---|
4555 | transition.afterLeave();
|
---|
4556 | }
|
---|
4557 | };
|
---|
4558 | if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
|
---|
4559 | const { leave, delayLeave } = transition;
|
---|
4560 | const performLeave = () => leave(el, performRemove);
|
---|
4561 | if (delayLeave) {
|
---|
4562 | delayLeave(vnode.el, performRemove, performLeave);
|
---|
4563 | } else {
|
---|
4564 | performLeave();
|
---|
4565 | }
|
---|
4566 | } else {
|
---|
4567 | performRemove();
|
---|
4568 | }
|
---|
4569 | };
|
---|
4570 | const removeFragment = (cur, end) => {
|
---|
4571 | let next;
|
---|
4572 | while (cur !== end) {
|
---|
4573 | next = hostNextSibling(cur);
|
---|
4574 | hostRemove(cur);
|
---|
4575 | cur = next;
|
---|
4576 | }
|
---|
4577 | hostRemove(end);
|
---|
4578 | };
|
---|
4579 | const unmountComponent = (instance, parentSuspense, doRemove) => {
|
---|
4580 | const { bum, scope, job, subTree, um, m, a } = instance;
|
---|
4581 | invalidateMount(m);
|
---|
4582 | invalidateMount(a);
|
---|
4583 | if (bum) {
|
---|
4584 | shared.invokeArrayFns(bum);
|
---|
4585 | }
|
---|
4586 | scope.stop();
|
---|
4587 | if (job) {
|
---|
4588 | job.flags |= 8;
|
---|
4589 | unmount(subTree, instance, parentSuspense, doRemove);
|
---|
4590 | }
|
---|
4591 | if (um) {
|
---|
4592 | queuePostRenderEffect(um, parentSuspense);
|
---|
4593 | }
|
---|
4594 | queuePostRenderEffect(() => {
|
---|
4595 | instance.isUnmounted = true;
|
---|
4596 | }, parentSuspense);
|
---|
4597 | if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
|
---|
4598 | parentSuspense.deps--;
|
---|
4599 | if (parentSuspense.deps === 0) {
|
---|
4600 | parentSuspense.resolve();
|
---|
4601 | }
|
---|
4602 | }
|
---|
4603 | };
|
---|
4604 | const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
|
---|
4605 | for (let i = start; i < children.length; i++) {
|
---|
4606 | unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
|
---|
4607 | }
|
---|
4608 | };
|
---|
4609 | const getNextHostNode = (vnode) => {
|
---|
4610 | if (vnode.shapeFlag & 6) {
|
---|
4611 | return getNextHostNode(vnode.component.subTree);
|
---|
4612 | }
|
---|
4613 | if (vnode.shapeFlag & 128) {
|
---|
4614 | return vnode.suspense.next();
|
---|
4615 | }
|
---|
4616 | const el = hostNextSibling(vnode.anchor || vnode.el);
|
---|
4617 | const teleportEnd = el && el[TeleportEndKey];
|
---|
4618 | return teleportEnd ? hostNextSibling(teleportEnd) : el;
|
---|
4619 | };
|
---|
4620 | let isFlushing = false;
|
---|
4621 | const render = (vnode, container, namespace) => {
|
---|
4622 | if (vnode == null) {
|
---|
4623 | if (container._vnode) {
|
---|
4624 | unmount(container._vnode, null, null, true);
|
---|
4625 | }
|
---|
4626 | } else {
|
---|
4627 | patch(
|
---|
4628 | container._vnode || null,
|
---|
4629 | vnode,
|
---|
4630 | container,
|
---|
4631 | null,
|
---|
4632 | null,
|
---|
4633 | null,
|
---|
4634 | namespace
|
---|
4635 | );
|
---|
4636 | }
|
---|
4637 | container._vnode = vnode;
|
---|
4638 | if (!isFlushing) {
|
---|
4639 | isFlushing = true;
|
---|
4640 | flushPreFlushCbs();
|
---|
4641 | flushPostFlushCbs();
|
---|
4642 | isFlushing = false;
|
---|
4643 | }
|
---|
4644 | };
|
---|
4645 | const internals = {
|
---|
4646 | p: patch,
|
---|
4647 | um: unmount,
|
---|
4648 | m: move,
|
---|
4649 | r: remove,
|
---|
4650 | mt: mountComponent,
|
---|
4651 | mc: mountChildren,
|
---|
4652 | pc: patchChildren,
|
---|
4653 | pbc: patchBlockChildren,
|
---|
4654 | n: getNextHostNode,
|
---|
4655 | o: options
|
---|
4656 | };
|
---|
4657 | let hydrate;
|
---|
4658 | let hydrateNode;
|
---|
4659 | if (createHydrationFns) {
|
---|
4660 | [hydrate, hydrateNode] = createHydrationFns(
|
---|
4661 | internals
|
---|
4662 | );
|
---|
4663 | }
|
---|
4664 | return {
|
---|
4665 | render,
|
---|
4666 | hydrate,
|
---|
4667 | createApp: createAppAPI(render, hydrate)
|
---|
4668 | };
|
---|
4669 | }
|
---|
4670 | function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
---|
4671 | return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
---|
4672 | }
|
---|
4673 | function toggleRecurse({ effect, job }, allowed) {
|
---|
4674 | if (allowed) {
|
---|
4675 | effect.flags |= 32;
|
---|
4676 | job.flags |= 4;
|
---|
4677 | } else {
|
---|
4678 | effect.flags &= ~32;
|
---|
4679 | job.flags &= ~4;
|
---|
4680 | }
|
---|
4681 | }
|
---|
4682 | function needTransition(parentSuspense, transition) {
|
---|
4683 | return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
---|
4684 | }
|
---|
4685 | function traverseStaticChildren(n1, n2, shallow = false) {
|
---|
4686 | const ch1 = n1.children;
|
---|
4687 | const ch2 = n2.children;
|
---|
4688 | if (shared.isArray(ch1) && shared.isArray(ch2)) {
|
---|
4689 | for (let i = 0; i < ch1.length; i++) {
|
---|
4690 | const c1 = ch1[i];
|
---|
4691 | let c2 = ch2[i];
|
---|
4692 | if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
|
---|
4693 | if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
|
---|
4694 | c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
---|
4695 | c2.el = c1.el;
|
---|
4696 | }
|
---|
4697 | if (!shallow && c2.patchFlag !== -2)
|
---|
4698 | traverseStaticChildren(c1, c2);
|
---|
4699 | }
|
---|
4700 | if (c2.type === Text) {
|
---|
4701 | c2.el = c1.el;
|
---|
4702 | }
|
---|
4703 | }
|
---|
4704 | }
|
---|
4705 | }
|
---|
4706 | function getSequence(arr) {
|
---|
4707 | const p = arr.slice();
|
---|
4708 | const result = [0];
|
---|
4709 | let i, j, u, v, c;
|
---|
4710 | const len = arr.length;
|
---|
4711 | for (i = 0; i < len; i++) {
|
---|
4712 | const arrI = arr[i];
|
---|
4713 | if (arrI !== 0) {
|
---|
4714 | j = result[result.length - 1];
|
---|
4715 | if (arr[j] < arrI) {
|
---|
4716 | p[i] = j;
|
---|
4717 | result.push(i);
|
---|
4718 | continue;
|
---|
4719 | }
|
---|
4720 | u = 0;
|
---|
4721 | v = result.length - 1;
|
---|
4722 | while (u < v) {
|
---|
4723 | c = u + v >> 1;
|
---|
4724 | if (arr[result[c]] < arrI) {
|
---|
4725 | u = c + 1;
|
---|
4726 | } else {
|
---|
4727 | v = c;
|
---|
4728 | }
|
---|
4729 | }
|
---|
4730 | if (arrI < arr[result[u]]) {
|
---|
4731 | if (u > 0) {
|
---|
4732 | p[i] = result[u - 1];
|
---|
4733 | }
|
---|
4734 | result[u] = i;
|
---|
4735 | }
|
---|
4736 | }
|
---|
4737 | }
|
---|
4738 | u = result.length;
|
---|
4739 | v = result[u - 1];
|
---|
4740 | while (u-- > 0) {
|
---|
4741 | result[u] = v;
|
---|
4742 | v = p[v];
|
---|
4743 | }
|
---|
4744 | return result;
|
---|
4745 | }
|
---|
4746 | function locateNonHydratedAsyncRoot(instance) {
|
---|
4747 | const subComponent = instance.subTree.component;
|
---|
4748 | if (subComponent) {
|
---|
4749 | if (subComponent.asyncDep && !subComponent.asyncResolved) {
|
---|
4750 | return subComponent;
|
---|
4751 | } else {
|
---|
4752 | return locateNonHydratedAsyncRoot(subComponent);
|
---|
4753 | }
|
---|
4754 | }
|
---|
4755 | }
|
---|
4756 | function invalidateMount(hooks) {
|
---|
4757 | if (hooks) {
|
---|
4758 | for (let i = 0; i < hooks.length; i++)
|
---|
4759 | hooks[i].flags |= 8;
|
---|
4760 | }
|
---|
4761 | }
|
---|
4762 |
|
---|
4763 | const ssrContextKey = Symbol.for("v-scx");
|
---|
4764 | const useSSRContext = () => {
|
---|
4765 | {
|
---|
4766 | const ctx = inject(ssrContextKey);
|
---|
4767 | return ctx;
|
---|
4768 | }
|
---|
4769 | };
|
---|
4770 |
|
---|
4771 | function watchEffect(effect, options) {
|
---|
4772 | return doWatch(effect, null, options);
|
---|
4773 | }
|
---|
4774 | function watchPostEffect(effect, options) {
|
---|
4775 | return doWatch(
|
---|
4776 | effect,
|
---|
4777 | null,
|
---|
4778 | { flush: "post" }
|
---|
4779 | );
|
---|
4780 | }
|
---|
4781 | function watchSyncEffect(effect, options) {
|
---|
4782 | return doWatch(
|
---|
4783 | effect,
|
---|
4784 | null,
|
---|
4785 | { flush: "sync" }
|
---|
4786 | );
|
---|
4787 | }
|
---|
4788 | function watch(source, cb, options) {
|
---|
4789 | return doWatch(source, cb, options);
|
---|
4790 | }
|
---|
4791 | function doWatch(source, cb, options = shared.EMPTY_OBJ) {
|
---|
4792 | const { immediate, deep, flush, once } = options;
|
---|
4793 | const baseWatchOptions = shared.extend({}, options);
|
---|
4794 | const runsImmediately = cb && immediate || !cb && flush !== "post";
|
---|
4795 | let ssrCleanup;
|
---|
4796 | if (isInSSRComponentSetup) {
|
---|
4797 | if (flush === "sync") {
|
---|
4798 | const ctx = useSSRContext();
|
---|
4799 | ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
|
---|
4800 | } else if (!runsImmediately) {
|
---|
4801 | const watchStopHandle = () => {
|
---|
4802 | };
|
---|
4803 | watchStopHandle.stop = shared.NOOP;
|
---|
4804 | watchStopHandle.resume = shared.NOOP;
|
---|
4805 | watchStopHandle.pause = shared.NOOP;
|
---|
4806 | return watchStopHandle;
|
---|
4807 | }
|
---|
4808 | }
|
---|
4809 | const instance = currentInstance;
|
---|
4810 | baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
---|
4811 | let isPre = false;
|
---|
4812 | if (flush === "post") {
|
---|
4813 | baseWatchOptions.scheduler = (job) => {
|
---|
4814 | queuePostRenderEffect(job, instance && instance.suspense);
|
---|
4815 | };
|
---|
4816 | } else if (flush !== "sync") {
|
---|
4817 | isPre = true;
|
---|
4818 | baseWatchOptions.scheduler = (job, isFirstRun) => {
|
---|
4819 | if (isFirstRun) {
|
---|
4820 | job();
|
---|
4821 | } else {
|
---|
4822 | queueJob(job);
|
---|
4823 | }
|
---|
4824 | };
|
---|
4825 | }
|
---|
4826 | baseWatchOptions.augmentJob = (job) => {
|
---|
4827 | if (cb) {
|
---|
4828 | job.flags |= 4;
|
---|
4829 | }
|
---|
4830 | if (isPre) {
|
---|
4831 | job.flags |= 2;
|
---|
4832 | if (instance) {
|
---|
4833 | job.id = instance.uid;
|
---|
4834 | job.i = instance;
|
---|
4835 | }
|
---|
4836 | }
|
---|
4837 | };
|
---|
4838 | const watchHandle = reactivity.watch(source, cb, baseWatchOptions);
|
---|
4839 | if (isInSSRComponentSetup) {
|
---|
4840 | if (ssrCleanup) {
|
---|
4841 | ssrCleanup.push(watchHandle);
|
---|
4842 | } else if (runsImmediately) {
|
---|
4843 | watchHandle();
|
---|
4844 | }
|
---|
4845 | }
|
---|
4846 | return watchHandle;
|
---|
4847 | }
|
---|
4848 | function instanceWatch(source, value, options) {
|
---|
4849 | const publicThis = this.proxy;
|
---|
4850 | const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
|
---|
4851 | let cb;
|
---|
4852 | if (shared.isFunction(value)) {
|
---|
4853 | cb = value;
|
---|
4854 | } else {
|
---|
4855 | cb = value.handler;
|
---|
4856 | options = value;
|
---|
4857 | }
|
---|
4858 | const reset = setCurrentInstance(this);
|
---|
4859 | const res = doWatch(getter, cb.bind(publicThis), options);
|
---|
4860 | reset();
|
---|
4861 | return res;
|
---|
4862 | }
|
---|
4863 | function createPathGetter(ctx, path) {
|
---|
4864 | const segments = path.split(".");
|
---|
4865 | return () => {
|
---|
4866 | let cur = ctx;
|
---|
4867 | for (let i = 0; i < segments.length && cur; i++) {
|
---|
4868 | cur = cur[segments[i]];
|
---|
4869 | }
|
---|
4870 | return cur;
|
---|
4871 | };
|
---|
4872 | }
|
---|
4873 |
|
---|
4874 | function useModel(props, name, options = shared.EMPTY_OBJ) {
|
---|
4875 | const i = getCurrentInstance();
|
---|
4876 | const camelizedName = shared.camelize(name);
|
---|
4877 | const hyphenatedName = shared.hyphenate(name);
|
---|
4878 | const modifiers = getModelModifiers(props, camelizedName);
|
---|
4879 | const res = reactivity.customRef((track, trigger) => {
|
---|
4880 | let localValue;
|
---|
4881 | let prevSetValue = shared.EMPTY_OBJ;
|
---|
4882 | let prevEmittedValue;
|
---|
4883 | watchSyncEffect(() => {
|
---|
4884 | const propValue = props[camelizedName];
|
---|
4885 | if (shared.hasChanged(localValue, propValue)) {
|
---|
4886 | localValue = propValue;
|
---|
4887 | trigger();
|
---|
4888 | }
|
---|
4889 | });
|
---|
4890 | return {
|
---|
4891 | get() {
|
---|
4892 | track();
|
---|
4893 | return options.get ? options.get(localValue) : localValue;
|
---|
4894 | },
|
---|
4895 | set(value) {
|
---|
4896 | const emittedValue = options.set ? options.set(value) : value;
|
---|
4897 | if (!shared.hasChanged(emittedValue, localValue) && !(prevSetValue !== shared.EMPTY_OBJ && shared.hasChanged(value, prevSetValue))) {
|
---|
4898 | return;
|
---|
4899 | }
|
---|
4900 | const rawProps = i.vnode.props;
|
---|
4901 | if (!(rawProps && // check if parent has passed v-model
|
---|
4902 | (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
|
---|
4903 | localValue = value;
|
---|
4904 | trigger();
|
---|
4905 | }
|
---|
4906 | i.emit(`update:${name}`, emittedValue);
|
---|
4907 | if (shared.hasChanged(value, emittedValue) && shared.hasChanged(value, prevSetValue) && !shared.hasChanged(emittedValue, prevEmittedValue)) {
|
---|
4908 | trigger();
|
---|
4909 | }
|
---|
4910 | prevSetValue = value;
|
---|
4911 | prevEmittedValue = emittedValue;
|
---|
4912 | }
|
---|
4913 | };
|
---|
4914 | });
|
---|
4915 | res[Symbol.iterator] = () => {
|
---|
4916 | let i2 = 0;
|
---|
4917 | return {
|
---|
4918 | next() {
|
---|
4919 | if (i2 < 2) {
|
---|
4920 | return { value: i2++ ? modifiers || shared.EMPTY_OBJ : res, done: false };
|
---|
4921 | } else {
|
---|
4922 | return { done: true };
|
---|
4923 | }
|
---|
4924 | }
|
---|
4925 | };
|
---|
4926 | };
|
---|
4927 | return res;
|
---|
4928 | }
|
---|
4929 | const getModelModifiers = (props, modelName) => {
|
---|
4930 | return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${shared.camelize(modelName)}Modifiers`] || props[`${shared.hyphenate(modelName)}Modifiers`];
|
---|
4931 | };
|
---|
4932 |
|
---|
4933 | function emit(instance, event, ...rawArgs) {
|
---|
4934 | if (instance.isUnmounted) return;
|
---|
4935 | const props = instance.vnode.props || shared.EMPTY_OBJ;
|
---|
4936 | let args = rawArgs;
|
---|
4937 | const isModelListener = event.startsWith("update:");
|
---|
4938 | const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
|
---|
4939 | if (modifiers) {
|
---|
4940 | if (modifiers.trim) {
|
---|
4941 | args = rawArgs.map((a) => shared.isString(a) ? a.trim() : a);
|
---|
4942 | }
|
---|
4943 | if (modifiers.number) {
|
---|
4944 | args = rawArgs.map(shared.looseToNumber);
|
---|
4945 | }
|
---|
4946 | }
|
---|
4947 | let handlerName;
|
---|
4948 | let handler = props[handlerName = shared.toHandlerKey(event)] || // also try camelCase event handler (#2249)
|
---|
4949 | props[handlerName = shared.toHandlerKey(shared.camelize(event))];
|
---|
4950 | if (!handler && isModelListener) {
|
---|
4951 | handler = props[handlerName = shared.toHandlerKey(shared.hyphenate(event))];
|
---|
4952 | }
|
---|
4953 | if (handler) {
|
---|
4954 | callWithAsyncErrorHandling(
|
---|
4955 | handler,
|
---|
4956 | instance,
|
---|
4957 | 6,
|
---|
4958 | args
|
---|
4959 | );
|
---|
4960 | }
|
---|
4961 | const onceHandler = props[handlerName + `Once`];
|
---|
4962 | if (onceHandler) {
|
---|
4963 | if (!instance.emitted) {
|
---|
4964 | instance.emitted = {};
|
---|
4965 | } else if (instance.emitted[handlerName]) {
|
---|
4966 | return;
|
---|
4967 | }
|
---|
4968 | instance.emitted[handlerName] = true;
|
---|
4969 | callWithAsyncErrorHandling(
|
---|
4970 | onceHandler,
|
---|
4971 | instance,
|
---|
4972 | 6,
|
---|
4973 | args
|
---|
4974 | );
|
---|
4975 | }
|
---|
4976 | }
|
---|
4977 | function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
---|
4978 | const cache = appContext.emitsCache;
|
---|
4979 | const cached = cache.get(comp);
|
---|
4980 | if (cached !== void 0) {
|
---|
4981 | return cached;
|
---|
4982 | }
|
---|
4983 | const raw = comp.emits;
|
---|
4984 | let normalized = {};
|
---|
4985 | let hasExtends = false;
|
---|
4986 | if (!shared.isFunction(comp)) {
|
---|
4987 | const extendEmits = (raw2) => {
|
---|
4988 | const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
|
---|
4989 | if (normalizedFromExtend) {
|
---|
4990 | hasExtends = true;
|
---|
4991 | shared.extend(normalized, normalizedFromExtend);
|
---|
4992 | }
|
---|
4993 | };
|
---|
4994 | if (!asMixin && appContext.mixins.length) {
|
---|
4995 | appContext.mixins.forEach(extendEmits);
|
---|
4996 | }
|
---|
4997 | if (comp.extends) {
|
---|
4998 | extendEmits(comp.extends);
|
---|
4999 | }
|
---|
5000 | if (comp.mixins) {
|
---|
5001 | comp.mixins.forEach(extendEmits);
|
---|
5002 | }
|
---|
5003 | }
|
---|
5004 | if (!raw && !hasExtends) {
|
---|
5005 | if (shared.isObject(comp)) {
|
---|
5006 | cache.set(comp, null);
|
---|
5007 | }
|
---|
5008 | return null;
|
---|
5009 | }
|
---|
5010 | if (shared.isArray(raw)) {
|
---|
5011 | raw.forEach((key) => normalized[key] = null);
|
---|
5012 | } else {
|
---|
5013 | shared.extend(normalized, raw);
|
---|
5014 | }
|
---|
5015 | if (shared.isObject(comp)) {
|
---|
5016 | cache.set(comp, normalized);
|
---|
5017 | }
|
---|
5018 | return normalized;
|
---|
5019 | }
|
---|
5020 | function isEmitListener(options, key) {
|
---|
5021 | if (!options || !shared.isOn(key)) {
|
---|
5022 | return false;
|
---|
5023 | }
|
---|
5024 | key = key.slice(2).replace(/Once$/, "");
|
---|
5025 | return shared.hasOwn(options, key[0].toLowerCase() + key.slice(1)) || shared.hasOwn(options, shared.hyphenate(key)) || shared.hasOwn(options, key);
|
---|
5026 | }
|
---|
5027 |
|
---|
5028 | function markAttrsAccessed() {
|
---|
5029 | }
|
---|
5030 | function renderComponentRoot(instance) {
|
---|
5031 | const {
|
---|
5032 | type: Component,
|
---|
5033 | vnode,
|
---|
5034 | proxy,
|
---|
5035 | withProxy,
|
---|
5036 | propsOptions: [propsOptions],
|
---|
5037 | slots,
|
---|
5038 | attrs,
|
---|
5039 | emit,
|
---|
5040 | render,
|
---|
5041 | renderCache,
|
---|
5042 | props,
|
---|
5043 | data,
|
---|
5044 | setupState,
|
---|
5045 | ctx,
|
---|
5046 | inheritAttrs
|
---|
5047 | } = instance;
|
---|
5048 | const prev = setCurrentRenderingInstance(instance);
|
---|
5049 | let result;
|
---|
5050 | let fallthroughAttrs;
|
---|
5051 | try {
|
---|
5052 | if (vnode.shapeFlag & 4) {
|
---|
5053 | const proxyToUse = withProxy || proxy;
|
---|
5054 | const thisProxy = false ? new Proxy(proxyToUse, {
|
---|
5055 | get(target, key, receiver) {
|
---|
5056 | warn(
|
---|
5057 | `Property '${String(
|
---|
5058 | key
|
---|
5059 | )}' was accessed via 'this'. Avoid using 'this' in templates.`
|
---|
5060 | );
|
---|
5061 | return Reflect.get(target, key, receiver);
|
---|
5062 | }
|
---|
5063 | }) : proxyToUse;
|
---|
5064 | result = normalizeVNode(
|
---|
5065 | render.call(
|
---|
5066 | thisProxy,
|
---|
5067 | proxyToUse,
|
---|
5068 | renderCache,
|
---|
5069 | false ? shallowReadonly(props) : props,
|
---|
5070 | setupState,
|
---|
5071 | data,
|
---|
5072 | ctx
|
---|
5073 | )
|
---|
5074 | );
|
---|
5075 | fallthroughAttrs = attrs;
|
---|
5076 | } else {
|
---|
5077 | const render2 = Component;
|
---|
5078 | if (false) ;
|
---|
5079 | result = normalizeVNode(
|
---|
5080 | render2.length > 1 ? render2(
|
---|
5081 | false ? shallowReadonly(props) : props,
|
---|
5082 | false ? {
|
---|
5083 | get attrs() {
|
---|
5084 | markAttrsAccessed();
|
---|
5085 | return shallowReadonly(attrs);
|
---|
5086 | },
|
---|
5087 | slots,
|
---|
5088 | emit
|
---|
5089 | } : { attrs, slots, emit }
|
---|
5090 | ) : render2(
|
---|
5091 | false ? shallowReadonly(props) : props,
|
---|
5092 | null
|
---|
5093 | )
|
---|
5094 | );
|
---|
5095 | fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
|
---|
5096 | }
|
---|
5097 | } catch (err) {
|
---|
5098 | blockStack.length = 0;
|
---|
5099 | handleError(err, instance, 1);
|
---|
5100 | result = createVNode(Comment);
|
---|
5101 | }
|
---|
5102 | let root = result;
|
---|
5103 | if (fallthroughAttrs && inheritAttrs !== false) {
|
---|
5104 | const keys = Object.keys(fallthroughAttrs);
|
---|
5105 | const { shapeFlag } = root;
|
---|
5106 | if (keys.length) {
|
---|
5107 | if (shapeFlag & (1 | 6)) {
|
---|
5108 | if (propsOptions && keys.some(shared.isModelListener)) {
|
---|
5109 | fallthroughAttrs = filterModelListeners(
|
---|
5110 | fallthroughAttrs,
|
---|
5111 | propsOptions
|
---|
5112 | );
|
---|
5113 | }
|
---|
5114 | root = cloneVNode(root, fallthroughAttrs, false, true);
|
---|
5115 | }
|
---|
5116 | }
|
---|
5117 | }
|
---|
5118 | if (vnode.dirs) {
|
---|
5119 | root = cloneVNode(root, null, false, true);
|
---|
5120 | root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
---|
5121 | }
|
---|
5122 | if (vnode.transition) {
|
---|
5123 | setTransitionHooks(root, vnode.transition);
|
---|
5124 | }
|
---|
5125 | {
|
---|
5126 | result = root;
|
---|
5127 | }
|
---|
5128 | setCurrentRenderingInstance(prev);
|
---|
5129 | return result;
|
---|
5130 | }
|
---|
5131 | function filterSingleRoot(children, recurse = true) {
|
---|
5132 | let singleRoot;
|
---|
5133 | for (let i = 0; i < children.length; i++) {
|
---|
5134 | const child = children[i];
|
---|
5135 | if (isVNode(child)) {
|
---|
5136 | if (child.type !== Comment || child.children === "v-if") {
|
---|
5137 | if (singleRoot) {
|
---|
5138 | return;
|
---|
5139 | } else {
|
---|
5140 | singleRoot = child;
|
---|
5141 | }
|
---|
5142 | }
|
---|
5143 | } else {
|
---|
5144 | return;
|
---|
5145 | }
|
---|
5146 | }
|
---|
5147 | return singleRoot;
|
---|
5148 | }
|
---|
5149 | const getFunctionalFallthrough = (attrs) => {
|
---|
5150 | let res;
|
---|
5151 | for (const key in attrs) {
|
---|
5152 | if (key === "class" || key === "style" || shared.isOn(key)) {
|
---|
5153 | (res || (res = {}))[key] = attrs[key];
|
---|
5154 | }
|
---|
5155 | }
|
---|
5156 | return res;
|
---|
5157 | };
|
---|
5158 | const filterModelListeners = (attrs, props) => {
|
---|
5159 | const res = {};
|
---|
5160 | for (const key in attrs) {
|
---|
5161 | if (!shared.isModelListener(key) || !(key.slice(9) in props)) {
|
---|
5162 | res[key] = attrs[key];
|
---|
5163 | }
|
---|
5164 | }
|
---|
5165 | return res;
|
---|
5166 | };
|
---|
5167 | function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
---|
5168 | const { props: prevProps, children: prevChildren, component } = prevVNode;
|
---|
5169 | const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
|
---|
5170 | const emits = component.emitsOptions;
|
---|
5171 | if (nextVNode.dirs || nextVNode.transition) {
|
---|
5172 | return true;
|
---|
5173 | }
|
---|
5174 | if (optimized && patchFlag >= 0) {
|
---|
5175 | if (patchFlag & 1024) {
|
---|
5176 | return true;
|
---|
5177 | }
|
---|
5178 | if (patchFlag & 16) {
|
---|
5179 | if (!prevProps) {
|
---|
5180 | return !!nextProps;
|
---|
5181 | }
|
---|
5182 | return hasPropsChanged(prevProps, nextProps, emits);
|
---|
5183 | } else if (patchFlag & 8) {
|
---|
5184 | const dynamicProps = nextVNode.dynamicProps;
|
---|
5185 | for (let i = 0; i < dynamicProps.length; i++) {
|
---|
5186 | const key = dynamicProps[i];
|
---|
5187 | if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
|
---|
5188 | return true;
|
---|
5189 | }
|
---|
5190 | }
|
---|
5191 | }
|
---|
5192 | } else {
|
---|
5193 | if (prevChildren || nextChildren) {
|
---|
5194 | if (!nextChildren || !nextChildren.$stable) {
|
---|
5195 | return true;
|
---|
5196 | }
|
---|
5197 | }
|
---|
5198 | if (prevProps === nextProps) {
|
---|
5199 | return false;
|
---|
5200 | }
|
---|
5201 | if (!prevProps) {
|
---|
5202 | return !!nextProps;
|
---|
5203 | }
|
---|
5204 | if (!nextProps) {
|
---|
5205 | return true;
|
---|
5206 | }
|
---|
5207 | return hasPropsChanged(prevProps, nextProps, emits);
|
---|
5208 | }
|
---|
5209 | return false;
|
---|
5210 | }
|
---|
5211 | function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
---|
5212 | const nextKeys = Object.keys(nextProps);
|
---|
5213 | if (nextKeys.length !== Object.keys(prevProps).length) {
|
---|
5214 | return true;
|
---|
5215 | }
|
---|
5216 | for (let i = 0; i < nextKeys.length; i++) {
|
---|
5217 | const key = nextKeys[i];
|
---|
5218 | if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
|
---|
5219 | return true;
|
---|
5220 | }
|
---|
5221 | }
|
---|
5222 | return false;
|
---|
5223 | }
|
---|
5224 | function updateHOCHostEl({ vnode, parent }, el) {
|
---|
5225 | while (parent) {
|
---|
5226 | const root = parent.subTree;
|
---|
5227 | if (root.suspense && root.suspense.activeBranch === vnode) {
|
---|
5228 | root.el = vnode.el;
|
---|
5229 | }
|
---|
5230 | if (root === vnode) {
|
---|
5231 | (vnode = parent.vnode).el = el;
|
---|
5232 | parent = parent.parent;
|
---|
5233 | } else {
|
---|
5234 | break;
|
---|
5235 | }
|
---|
5236 | }
|
---|
5237 | }
|
---|
5238 |
|
---|
5239 | const isSuspense = (type) => type.__isSuspense;
|
---|
5240 | let suspenseId = 0;
|
---|
5241 | const SuspenseImpl = {
|
---|
5242 | name: "Suspense",
|
---|
5243 | // In order to make Suspense tree-shakable, we need to avoid importing it
|
---|
5244 | // directly in the renderer. The renderer checks for the __isSuspense flag
|
---|
5245 | // on a vnode's type and calls the `process` method, passing in renderer
|
---|
5246 | // internals.
|
---|
5247 | __isSuspense: true,
|
---|
5248 | process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
---|
5249 | if (n1 == null) {
|
---|
5250 | mountSuspense(
|
---|
5251 | n2,
|
---|
5252 | container,
|
---|
5253 | anchor,
|
---|
5254 | parentComponent,
|
---|
5255 | parentSuspense,
|
---|
5256 | namespace,
|
---|
5257 | slotScopeIds,
|
---|
5258 | optimized,
|
---|
5259 | rendererInternals
|
---|
5260 | );
|
---|
5261 | } else {
|
---|
5262 | if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
|
---|
5263 | n2.suspense = n1.suspense;
|
---|
5264 | n2.suspense.vnode = n2;
|
---|
5265 | n2.el = n1.el;
|
---|
5266 | return;
|
---|
5267 | }
|
---|
5268 | patchSuspense(
|
---|
5269 | n1,
|
---|
5270 | n2,
|
---|
5271 | container,
|
---|
5272 | anchor,
|
---|
5273 | parentComponent,
|
---|
5274 | namespace,
|
---|
5275 | slotScopeIds,
|
---|
5276 | optimized,
|
---|
5277 | rendererInternals
|
---|
5278 | );
|
---|
5279 | }
|
---|
5280 | },
|
---|
5281 | hydrate: hydrateSuspense,
|
---|
5282 | normalize: normalizeSuspenseChildren
|
---|
5283 | };
|
---|
5284 | const Suspense = SuspenseImpl ;
|
---|
5285 | function triggerEvent(vnode, name) {
|
---|
5286 | const eventListener = vnode.props && vnode.props[name];
|
---|
5287 | if (shared.isFunction(eventListener)) {
|
---|
5288 | eventListener();
|
---|
5289 | }
|
---|
5290 | }
|
---|
5291 | function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
---|
5292 | const {
|
---|
5293 | p: patch,
|
---|
5294 | o: { createElement }
|
---|
5295 | } = rendererInternals;
|
---|
5296 | const hiddenContainer = createElement("div");
|
---|
5297 | const suspense = vnode.suspense = createSuspenseBoundary(
|
---|
5298 | vnode,
|
---|
5299 | parentSuspense,
|
---|
5300 | parentComponent,
|
---|
5301 | container,
|
---|
5302 | hiddenContainer,
|
---|
5303 | anchor,
|
---|
5304 | namespace,
|
---|
5305 | slotScopeIds,
|
---|
5306 | optimized,
|
---|
5307 | rendererInternals
|
---|
5308 | );
|
---|
5309 | patch(
|
---|
5310 | null,
|
---|
5311 | suspense.pendingBranch = vnode.ssContent,
|
---|
5312 | hiddenContainer,
|
---|
5313 | null,
|
---|
5314 | parentComponent,
|
---|
5315 | suspense,
|
---|
5316 | namespace,
|
---|
5317 | slotScopeIds
|
---|
5318 | );
|
---|
5319 | if (suspense.deps > 0) {
|
---|
5320 | triggerEvent(vnode, "onPending");
|
---|
5321 | triggerEvent(vnode, "onFallback");
|
---|
5322 | patch(
|
---|
5323 | null,
|
---|
5324 | vnode.ssFallback,
|
---|
5325 | container,
|
---|
5326 | anchor,
|
---|
5327 | parentComponent,
|
---|
5328 | null,
|
---|
5329 | // fallback tree will not have suspense context
|
---|
5330 | namespace,
|
---|
5331 | slotScopeIds
|
---|
5332 | );
|
---|
5333 | setActiveBranch(suspense, vnode.ssFallback);
|
---|
5334 | } else {
|
---|
5335 | suspense.resolve(false, true);
|
---|
5336 | }
|
---|
5337 | }
|
---|
5338 | function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
|
---|
5339 | const suspense = n2.suspense = n1.suspense;
|
---|
5340 | suspense.vnode = n2;
|
---|
5341 | n2.el = n1.el;
|
---|
5342 | const newBranch = n2.ssContent;
|
---|
5343 | const newFallback = n2.ssFallback;
|
---|
5344 | const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
|
---|
5345 | if (pendingBranch) {
|
---|
5346 | suspense.pendingBranch = newBranch;
|
---|
5347 | if (isSameVNodeType(newBranch, pendingBranch)) {
|
---|
5348 | patch(
|
---|
5349 | pendingBranch,
|
---|
5350 | newBranch,
|
---|
5351 | suspense.hiddenContainer,
|
---|
5352 | null,
|
---|
5353 | parentComponent,
|
---|
5354 | suspense,
|
---|
5355 | namespace,
|
---|
5356 | slotScopeIds,
|
---|
5357 | optimized
|
---|
5358 | );
|
---|
5359 | if (suspense.deps <= 0) {
|
---|
5360 | suspense.resolve();
|
---|
5361 | } else if (isInFallback) {
|
---|
5362 | if (!isHydrating) {
|
---|
5363 | patch(
|
---|
5364 | activeBranch,
|
---|
5365 | newFallback,
|
---|
5366 | container,
|
---|
5367 | anchor,
|
---|
5368 | parentComponent,
|
---|
5369 | null,
|
---|
5370 | // fallback tree will not have suspense context
|
---|
5371 | namespace,
|
---|
5372 | slotScopeIds,
|
---|
5373 | optimized
|
---|
5374 | );
|
---|
5375 | setActiveBranch(suspense, newFallback);
|
---|
5376 | }
|
---|
5377 | }
|
---|
5378 | } else {
|
---|
5379 | suspense.pendingId = suspenseId++;
|
---|
5380 | if (isHydrating) {
|
---|
5381 | suspense.isHydrating = false;
|
---|
5382 | suspense.activeBranch = pendingBranch;
|
---|
5383 | } else {
|
---|
5384 | unmount(pendingBranch, parentComponent, suspense);
|
---|
5385 | }
|
---|
5386 | suspense.deps = 0;
|
---|
5387 | suspense.effects.length = 0;
|
---|
5388 | suspense.hiddenContainer = createElement("div");
|
---|
5389 | if (isInFallback) {
|
---|
5390 | patch(
|
---|
5391 | null,
|
---|
5392 | newBranch,
|
---|
5393 | suspense.hiddenContainer,
|
---|
5394 | null,
|
---|
5395 | parentComponent,
|
---|
5396 | suspense,
|
---|
5397 | namespace,
|
---|
5398 | slotScopeIds,
|
---|
5399 | optimized
|
---|
5400 | );
|
---|
5401 | if (suspense.deps <= 0) {
|
---|
5402 | suspense.resolve();
|
---|
5403 | } else {
|
---|
5404 | patch(
|
---|
5405 | activeBranch,
|
---|
5406 | newFallback,
|
---|
5407 | container,
|
---|
5408 | anchor,
|
---|
5409 | parentComponent,
|
---|
5410 | null,
|
---|
5411 | // fallback tree will not have suspense context
|
---|
5412 | namespace,
|
---|
5413 | slotScopeIds,
|
---|
5414 | optimized
|
---|
5415 | );
|
---|
5416 | setActiveBranch(suspense, newFallback);
|
---|
5417 | }
|
---|
5418 | } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
---|
5419 | patch(
|
---|
5420 | activeBranch,
|
---|
5421 | newBranch,
|
---|
5422 | container,
|
---|
5423 | anchor,
|
---|
5424 | parentComponent,
|
---|
5425 | suspense,
|
---|
5426 | namespace,
|
---|
5427 | slotScopeIds,
|
---|
5428 | optimized
|
---|
5429 | );
|
---|
5430 | suspense.resolve(true);
|
---|
5431 | } else {
|
---|
5432 | patch(
|
---|
5433 | null,
|
---|
5434 | newBranch,
|
---|
5435 | suspense.hiddenContainer,
|
---|
5436 | null,
|
---|
5437 | parentComponent,
|
---|
5438 | suspense,
|
---|
5439 | namespace,
|
---|
5440 | slotScopeIds,
|
---|
5441 | optimized
|
---|
5442 | );
|
---|
5443 | if (suspense.deps <= 0) {
|
---|
5444 | suspense.resolve();
|
---|
5445 | }
|
---|
5446 | }
|
---|
5447 | }
|
---|
5448 | } else {
|
---|
5449 | if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
---|
5450 | patch(
|
---|
5451 | activeBranch,
|
---|
5452 | newBranch,
|
---|
5453 | container,
|
---|
5454 | anchor,
|
---|
5455 | parentComponent,
|
---|
5456 | suspense,
|
---|
5457 | namespace,
|
---|
5458 | slotScopeIds,
|
---|
5459 | optimized
|
---|
5460 | );
|
---|
5461 | setActiveBranch(suspense, newBranch);
|
---|
5462 | } else {
|
---|
5463 | triggerEvent(n2, "onPending");
|
---|
5464 | suspense.pendingBranch = newBranch;
|
---|
5465 | if (newBranch.shapeFlag & 512) {
|
---|
5466 | suspense.pendingId = newBranch.component.suspenseId;
|
---|
5467 | } else {
|
---|
5468 | suspense.pendingId = suspenseId++;
|
---|
5469 | }
|
---|
5470 | patch(
|
---|
5471 | null,
|
---|
5472 | newBranch,
|
---|
5473 | suspense.hiddenContainer,
|
---|
5474 | null,
|
---|
5475 | parentComponent,
|
---|
5476 | suspense,
|
---|
5477 | namespace,
|
---|
5478 | slotScopeIds,
|
---|
5479 | optimized
|
---|
5480 | );
|
---|
5481 | if (suspense.deps <= 0) {
|
---|
5482 | suspense.resolve();
|
---|
5483 | } else {
|
---|
5484 | const { timeout, pendingId } = suspense;
|
---|
5485 | if (timeout > 0) {
|
---|
5486 | setTimeout(() => {
|
---|
5487 | if (suspense.pendingId === pendingId) {
|
---|
5488 | suspense.fallback(newFallback);
|
---|
5489 | }
|
---|
5490 | }, timeout);
|
---|
5491 | } else if (timeout === 0) {
|
---|
5492 | suspense.fallback(newFallback);
|
---|
5493 | }
|
---|
5494 | }
|
---|
5495 | }
|
---|
5496 | }
|
---|
5497 | }
|
---|
5498 | function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
|
---|
5499 | const {
|
---|
5500 | p: patch,
|
---|
5501 | m: move,
|
---|
5502 | um: unmount,
|
---|
5503 | n: next,
|
---|
5504 | o: { parentNode, remove }
|
---|
5505 | } = rendererInternals;
|
---|
5506 | let parentSuspenseId;
|
---|
5507 | const isSuspensible = isVNodeSuspensible(vnode);
|
---|
5508 | if (isSuspensible) {
|
---|
5509 | if (parentSuspense && parentSuspense.pendingBranch) {
|
---|
5510 | parentSuspenseId = parentSuspense.pendingId;
|
---|
5511 | parentSuspense.deps++;
|
---|
5512 | }
|
---|
5513 | }
|
---|
5514 | const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : void 0;
|
---|
5515 | const initialAnchor = anchor;
|
---|
5516 | const suspense = {
|
---|
5517 | vnode,
|
---|
5518 | parent: parentSuspense,
|
---|
5519 | parentComponent,
|
---|
5520 | namespace,
|
---|
5521 | container,
|
---|
5522 | hiddenContainer,
|
---|
5523 | deps: 0,
|
---|
5524 | pendingId: suspenseId++,
|
---|
5525 | timeout: typeof timeout === "number" ? timeout : -1,
|
---|
5526 | activeBranch: null,
|
---|
5527 | pendingBranch: null,
|
---|
5528 | isInFallback: !isHydrating,
|
---|
5529 | isHydrating,
|
---|
5530 | isUnmounted: false,
|
---|
5531 | effects: [],
|
---|
5532 | resolve(resume = false, sync = false) {
|
---|
5533 | const {
|
---|
5534 | vnode: vnode2,
|
---|
5535 | activeBranch,
|
---|
5536 | pendingBranch,
|
---|
5537 | pendingId,
|
---|
5538 | effects,
|
---|
5539 | parentComponent: parentComponent2,
|
---|
5540 | container: container2
|
---|
5541 | } = suspense;
|
---|
5542 | let delayEnter = false;
|
---|
5543 | if (suspense.isHydrating) {
|
---|
5544 | suspense.isHydrating = false;
|
---|
5545 | } else if (!resume) {
|
---|
5546 | delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
---|
5547 | if (delayEnter) {
|
---|
5548 | activeBranch.transition.afterLeave = () => {
|
---|
5549 | if (pendingId === suspense.pendingId) {
|
---|
5550 | move(
|
---|
5551 | pendingBranch,
|
---|
5552 | container2,
|
---|
5553 | anchor === initialAnchor ? next(activeBranch) : anchor,
|
---|
5554 | 0
|
---|
5555 | );
|
---|
5556 | queuePostFlushCb(effects);
|
---|
5557 | }
|
---|
5558 | };
|
---|
5559 | }
|
---|
5560 | if (activeBranch) {
|
---|
5561 | if (parentNode(activeBranch.el) === container2) {
|
---|
5562 | anchor = next(activeBranch);
|
---|
5563 | }
|
---|
5564 | unmount(activeBranch, parentComponent2, suspense, true);
|
---|
5565 | }
|
---|
5566 | if (!delayEnter) {
|
---|
5567 | move(pendingBranch, container2, anchor, 0);
|
---|
5568 | }
|
---|
5569 | }
|
---|
5570 | setActiveBranch(suspense, pendingBranch);
|
---|
5571 | suspense.pendingBranch = null;
|
---|
5572 | suspense.isInFallback = false;
|
---|
5573 | let parent = suspense.parent;
|
---|
5574 | let hasUnresolvedAncestor = false;
|
---|
5575 | while (parent) {
|
---|
5576 | if (parent.pendingBranch) {
|
---|
5577 | parent.effects.push(...effects);
|
---|
5578 | hasUnresolvedAncestor = true;
|
---|
5579 | break;
|
---|
5580 | }
|
---|
5581 | parent = parent.parent;
|
---|
5582 | }
|
---|
5583 | if (!hasUnresolvedAncestor && !delayEnter) {
|
---|
5584 | queuePostFlushCb(effects);
|
---|
5585 | }
|
---|
5586 | suspense.effects = [];
|
---|
5587 | if (isSuspensible) {
|
---|
5588 | if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
|
---|
5589 | parentSuspense.deps--;
|
---|
5590 | if (parentSuspense.deps === 0 && !sync) {
|
---|
5591 | parentSuspense.resolve();
|
---|
5592 | }
|
---|
5593 | }
|
---|
5594 | }
|
---|
5595 | triggerEvent(vnode2, "onResolve");
|
---|
5596 | },
|
---|
5597 | fallback(fallbackVNode) {
|
---|
5598 | if (!suspense.pendingBranch) {
|
---|
5599 | return;
|
---|
5600 | }
|
---|
5601 | const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
|
---|
5602 | triggerEvent(vnode2, "onFallback");
|
---|
5603 | const anchor2 = next(activeBranch);
|
---|
5604 | const mountFallback = () => {
|
---|
5605 | if (!suspense.isInFallback) {
|
---|
5606 | return;
|
---|
5607 | }
|
---|
5608 | patch(
|
---|
5609 | null,
|
---|
5610 | fallbackVNode,
|
---|
5611 | container2,
|
---|
5612 | anchor2,
|
---|
5613 | parentComponent2,
|
---|
5614 | null,
|
---|
5615 | // fallback tree will not have suspense context
|
---|
5616 | namespace2,
|
---|
5617 | slotScopeIds,
|
---|
5618 | optimized
|
---|
5619 | );
|
---|
5620 | setActiveBranch(suspense, fallbackVNode);
|
---|
5621 | };
|
---|
5622 | const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
---|
5623 | if (delayEnter) {
|
---|
5624 | activeBranch.transition.afterLeave = mountFallback;
|
---|
5625 | }
|
---|
5626 | suspense.isInFallback = true;
|
---|
5627 | unmount(
|
---|
5628 | activeBranch,
|
---|
5629 | parentComponent2,
|
---|
5630 | null,
|
---|
5631 | // no suspense so unmount hooks fire now
|
---|
5632 | true
|
---|
5633 | // shouldRemove
|
---|
5634 | );
|
---|
5635 | if (!delayEnter) {
|
---|
5636 | mountFallback();
|
---|
5637 | }
|
---|
5638 | },
|
---|
5639 | move(container2, anchor2, type) {
|
---|
5640 | suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
---|
5641 | suspense.container = container2;
|
---|
5642 | },
|
---|
5643 | next() {
|
---|
5644 | return suspense.activeBranch && next(suspense.activeBranch);
|
---|
5645 | },
|
---|
5646 | registerDep(instance, setupRenderEffect, optimized2) {
|
---|
5647 | const isInPendingSuspense = !!suspense.pendingBranch;
|
---|
5648 | if (isInPendingSuspense) {
|
---|
5649 | suspense.deps++;
|
---|
5650 | }
|
---|
5651 | const hydratedEl = instance.vnode.el;
|
---|
5652 | instance.asyncDep.catch((err) => {
|
---|
5653 | handleError(err, instance, 0);
|
---|
5654 | }).then((asyncSetupResult) => {
|
---|
5655 | if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
|
---|
5656 | return;
|
---|
5657 | }
|
---|
5658 | instance.asyncResolved = true;
|
---|
5659 | const { vnode: vnode2 } = instance;
|
---|
5660 | handleSetupResult(instance, asyncSetupResult, false);
|
---|
5661 | if (hydratedEl) {
|
---|
5662 | vnode2.el = hydratedEl;
|
---|
5663 | }
|
---|
5664 | const placeholder = !hydratedEl && instance.subTree.el;
|
---|
5665 | setupRenderEffect(
|
---|
5666 | instance,
|
---|
5667 | vnode2,
|
---|
5668 | // component may have been moved before resolve.
|
---|
5669 | // if this is not a hydration, instance.subTree will be the comment
|
---|
5670 | // placeholder.
|
---|
5671 | parentNode(hydratedEl || instance.subTree.el),
|
---|
5672 | // anchor will not be used if this is hydration, so only need to
|
---|
5673 | // consider the comment placeholder case.
|
---|
5674 | hydratedEl ? null : next(instance.subTree),
|
---|
5675 | suspense,
|
---|
5676 | namespace,
|
---|
5677 | optimized2
|
---|
5678 | );
|
---|
5679 | if (placeholder) {
|
---|
5680 | remove(placeholder);
|
---|
5681 | }
|
---|
5682 | updateHOCHostEl(instance, vnode2.el);
|
---|
5683 | if (isInPendingSuspense && --suspense.deps === 0) {
|
---|
5684 | suspense.resolve();
|
---|
5685 | }
|
---|
5686 | });
|
---|
5687 | },
|
---|
5688 | unmount(parentSuspense2, doRemove) {
|
---|
5689 | suspense.isUnmounted = true;
|
---|
5690 | if (suspense.activeBranch) {
|
---|
5691 | unmount(
|
---|
5692 | suspense.activeBranch,
|
---|
5693 | parentComponent,
|
---|
5694 | parentSuspense2,
|
---|
5695 | doRemove
|
---|
5696 | );
|
---|
5697 | }
|
---|
5698 | if (suspense.pendingBranch) {
|
---|
5699 | unmount(
|
---|
5700 | suspense.pendingBranch,
|
---|
5701 | parentComponent,
|
---|
5702 | parentSuspense2,
|
---|
5703 | doRemove
|
---|
5704 | );
|
---|
5705 | }
|
---|
5706 | }
|
---|
5707 | };
|
---|
5708 | return suspense;
|
---|
5709 | }
|
---|
5710 | function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
|
---|
5711 | const suspense = vnode.suspense = createSuspenseBoundary(
|
---|
5712 | vnode,
|
---|
5713 | parentSuspense,
|
---|
5714 | parentComponent,
|
---|
5715 | node.parentNode,
|
---|
5716 | // eslint-disable-next-line no-restricted-globals
|
---|
5717 | document.createElement("div"),
|
---|
5718 | null,
|
---|
5719 | namespace,
|
---|
5720 | slotScopeIds,
|
---|
5721 | optimized,
|
---|
5722 | rendererInternals,
|
---|
5723 | true
|
---|
5724 | );
|
---|
5725 | const result = hydrateNode(
|
---|
5726 | node,
|
---|
5727 | suspense.pendingBranch = vnode.ssContent,
|
---|
5728 | parentComponent,
|
---|
5729 | suspense,
|
---|
5730 | slotScopeIds,
|
---|
5731 | optimized
|
---|
5732 | );
|
---|
5733 | if (suspense.deps === 0) {
|
---|
5734 | suspense.resolve(false, true);
|
---|
5735 | }
|
---|
5736 | return result;
|
---|
5737 | }
|
---|
5738 | function normalizeSuspenseChildren(vnode) {
|
---|
5739 | const { shapeFlag, children } = vnode;
|
---|
5740 | const isSlotChildren = shapeFlag & 32;
|
---|
5741 | vnode.ssContent = normalizeSuspenseSlot(
|
---|
5742 | isSlotChildren ? children.default : children
|
---|
5743 | );
|
---|
5744 | vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
|
---|
5745 | }
|
---|
5746 | function normalizeSuspenseSlot(s) {
|
---|
5747 | let block;
|
---|
5748 | if (shared.isFunction(s)) {
|
---|
5749 | const trackBlock = isBlockTreeEnabled && s._c;
|
---|
5750 | if (trackBlock) {
|
---|
5751 | s._d = false;
|
---|
5752 | openBlock();
|
---|
5753 | }
|
---|
5754 | s = s();
|
---|
5755 | if (trackBlock) {
|
---|
5756 | s._d = true;
|
---|
5757 | block = currentBlock;
|
---|
5758 | closeBlock();
|
---|
5759 | }
|
---|
5760 | }
|
---|
5761 | if (shared.isArray(s)) {
|
---|
5762 | const singleChild = filterSingleRoot(s);
|
---|
5763 | s = singleChild;
|
---|
5764 | }
|
---|
5765 | s = normalizeVNode(s);
|
---|
5766 | if (block && !s.dynamicChildren) {
|
---|
5767 | s.dynamicChildren = block.filter((c) => c !== s);
|
---|
5768 | }
|
---|
5769 | return s;
|
---|
5770 | }
|
---|
5771 | function queueEffectWithSuspense(fn, suspense) {
|
---|
5772 | if (suspense && suspense.pendingBranch) {
|
---|
5773 | if (shared.isArray(fn)) {
|
---|
5774 | suspense.effects.push(...fn);
|
---|
5775 | } else {
|
---|
5776 | suspense.effects.push(fn);
|
---|
5777 | }
|
---|
5778 | } else {
|
---|
5779 | queuePostFlushCb(fn);
|
---|
5780 | }
|
---|
5781 | }
|
---|
5782 | function setActiveBranch(suspense, branch) {
|
---|
5783 | suspense.activeBranch = branch;
|
---|
5784 | const { vnode, parentComponent } = suspense;
|
---|
5785 | let el = branch.el;
|
---|
5786 | while (!el && branch.component) {
|
---|
5787 | branch = branch.component.subTree;
|
---|
5788 | el = branch.el;
|
---|
5789 | }
|
---|
5790 | vnode.el = el;
|
---|
5791 | if (parentComponent && parentComponent.subTree === vnode) {
|
---|
5792 | parentComponent.vnode.el = el;
|
---|
5793 | updateHOCHostEl(parentComponent, el);
|
---|
5794 | }
|
---|
5795 | }
|
---|
5796 | function isVNodeSuspensible(vnode) {
|
---|
5797 | const suspensible = vnode.props && vnode.props.suspensible;
|
---|
5798 | return suspensible != null && suspensible !== false;
|
---|
5799 | }
|
---|
5800 |
|
---|
5801 | const Fragment = Symbol.for("v-fgt");
|
---|
5802 | const Text = Symbol.for("v-txt");
|
---|
5803 | const Comment = Symbol.for("v-cmt");
|
---|
5804 | const Static = Symbol.for("v-stc");
|
---|
5805 | const blockStack = [];
|
---|
5806 | let currentBlock = null;
|
---|
5807 | function openBlock(disableTracking = false) {
|
---|
5808 | blockStack.push(currentBlock = disableTracking ? null : []);
|
---|
5809 | }
|
---|
5810 | function closeBlock() {
|
---|
5811 | blockStack.pop();
|
---|
5812 | currentBlock = blockStack[blockStack.length - 1] || null;
|
---|
5813 | }
|
---|
5814 | let isBlockTreeEnabled = 1;
|
---|
5815 | function setBlockTracking(value, inVOnce = false) {
|
---|
5816 | isBlockTreeEnabled += value;
|
---|
5817 | if (value < 0 && currentBlock && inVOnce) {
|
---|
5818 | currentBlock.hasOnce = true;
|
---|
5819 | }
|
---|
5820 | }
|
---|
5821 | function setupBlock(vnode) {
|
---|
5822 | vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || shared.EMPTY_ARR : null;
|
---|
5823 | closeBlock();
|
---|
5824 | if (isBlockTreeEnabled > 0 && currentBlock) {
|
---|
5825 | currentBlock.push(vnode);
|
---|
5826 | }
|
---|
5827 | return vnode;
|
---|
5828 | }
|
---|
5829 | function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
|
---|
5830 | return setupBlock(
|
---|
5831 | createBaseVNode(
|
---|
5832 | type,
|
---|
5833 | props,
|
---|
5834 | children,
|
---|
5835 | patchFlag,
|
---|
5836 | dynamicProps,
|
---|
5837 | shapeFlag,
|
---|
5838 | true
|
---|
5839 | )
|
---|
5840 | );
|
---|
5841 | }
|
---|
5842 | function createBlock(type, props, children, patchFlag, dynamicProps) {
|
---|
5843 | return setupBlock(
|
---|
5844 | createVNode(
|
---|
5845 | type,
|
---|
5846 | props,
|
---|
5847 | children,
|
---|
5848 | patchFlag,
|
---|
5849 | dynamicProps,
|
---|
5850 | true
|
---|
5851 | )
|
---|
5852 | );
|
---|
5853 | }
|
---|
5854 | function isVNode(value) {
|
---|
5855 | return value ? value.__v_isVNode === true : false;
|
---|
5856 | }
|
---|
5857 | function isSameVNodeType(n1, n2) {
|
---|
5858 | return n1.type === n2.type && n1.key === n2.key;
|
---|
5859 | }
|
---|
5860 | function transformVNodeArgs(transformer) {
|
---|
5861 | }
|
---|
5862 | const normalizeKey = ({ key }) => key != null ? key : null;
|
---|
5863 | const normalizeRef = ({
|
---|
5864 | ref,
|
---|
5865 | ref_key,
|
---|
5866 | ref_for
|
---|
5867 | }) => {
|
---|
5868 | if (typeof ref === "number") {
|
---|
5869 | ref = "" + ref;
|
---|
5870 | }
|
---|
5871 | return ref != null ? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
|
---|
5872 | };
|
---|
5873 | function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
|
---|
5874 | const vnode = {
|
---|
5875 | __v_isVNode: true,
|
---|
5876 | __v_skip: true,
|
---|
5877 | type,
|
---|
5878 | props,
|
---|
5879 | key: props && normalizeKey(props),
|
---|
5880 | ref: props && normalizeRef(props),
|
---|
5881 | scopeId: currentScopeId,
|
---|
5882 | slotScopeIds: null,
|
---|
5883 | children,
|
---|
5884 | component: null,
|
---|
5885 | suspense: null,
|
---|
5886 | ssContent: null,
|
---|
5887 | ssFallback: null,
|
---|
5888 | dirs: null,
|
---|
5889 | transition: null,
|
---|
5890 | el: null,
|
---|
5891 | anchor: null,
|
---|
5892 | target: null,
|
---|
5893 | targetStart: null,
|
---|
5894 | targetAnchor: null,
|
---|
5895 | staticCount: 0,
|
---|
5896 | shapeFlag,
|
---|
5897 | patchFlag,
|
---|
5898 | dynamicProps,
|
---|
5899 | dynamicChildren: null,
|
---|
5900 | appContext: null,
|
---|
5901 | ctx: currentRenderingInstance
|
---|
5902 | };
|
---|
5903 | if (needFullChildrenNormalization) {
|
---|
5904 | normalizeChildren(vnode, children);
|
---|
5905 | if (shapeFlag & 128) {
|
---|
5906 | type.normalize(vnode);
|
---|
5907 | }
|
---|
5908 | } else if (children) {
|
---|
5909 | vnode.shapeFlag |= shared.isString(children) ? 8 : 16;
|
---|
5910 | }
|
---|
5911 | if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
|
---|
5912 | !isBlockNode && // has current parent block
|
---|
5913 | currentBlock && // presence of a patch flag indicates this node needs patching on updates.
|
---|
5914 | // component nodes also should always be patched, because even if the
|
---|
5915 | // component doesn't need to update, it needs to persist the instance on to
|
---|
5916 | // the next vnode so that it can be properly unmounted later.
|
---|
5917 | (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
|
---|
5918 | // vnode should not be considered dynamic due to handler caching.
|
---|
5919 | vnode.patchFlag !== 32) {
|
---|
5920 | currentBlock.push(vnode);
|
---|
5921 | }
|
---|
5922 | return vnode;
|
---|
5923 | }
|
---|
5924 | const createVNode = _createVNode;
|
---|
5925 | function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
---|
5926 | if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
---|
5927 | type = Comment;
|
---|
5928 | }
|
---|
5929 | if (isVNode(type)) {
|
---|
5930 | const cloned = cloneVNode(
|
---|
5931 | type,
|
---|
5932 | props,
|
---|
5933 | true
|
---|
5934 | /* mergeRef: true */
|
---|
5935 | );
|
---|
5936 | if (children) {
|
---|
5937 | normalizeChildren(cloned, children);
|
---|
5938 | }
|
---|
5939 | if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
---|
5940 | if (cloned.shapeFlag & 6) {
|
---|
5941 | currentBlock[currentBlock.indexOf(type)] = cloned;
|
---|
5942 | } else {
|
---|
5943 | currentBlock.push(cloned);
|
---|
5944 | }
|
---|
5945 | }
|
---|
5946 | cloned.patchFlag = -2;
|
---|
5947 | return cloned;
|
---|
5948 | }
|
---|
5949 | if (isClassComponent(type)) {
|
---|
5950 | type = type.__vccOpts;
|
---|
5951 | }
|
---|
5952 | if (props) {
|
---|
5953 | props = guardReactiveProps(props);
|
---|
5954 | let { class: klass, style } = props;
|
---|
5955 | if (klass && !shared.isString(klass)) {
|
---|
5956 | props.class = shared.normalizeClass(klass);
|
---|
5957 | }
|
---|
5958 | if (shared.isObject(style)) {
|
---|
5959 | if (reactivity.isProxy(style) && !shared.isArray(style)) {
|
---|
5960 | style = shared.extend({}, style);
|
---|
5961 | }
|
---|
5962 | props.style = shared.normalizeStyle(style);
|
---|
5963 | }
|
---|
5964 | }
|
---|
5965 | const shapeFlag = shared.isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : shared.isObject(type) ? 4 : shared.isFunction(type) ? 2 : 0;
|
---|
5966 | return createBaseVNode(
|
---|
5967 | type,
|
---|
5968 | props,
|
---|
5969 | children,
|
---|
5970 | patchFlag,
|
---|
5971 | dynamicProps,
|
---|
5972 | shapeFlag,
|
---|
5973 | isBlockNode,
|
---|
5974 | true
|
---|
5975 | );
|
---|
5976 | }
|
---|
5977 | function guardReactiveProps(props) {
|
---|
5978 | if (!props) return null;
|
---|
5979 | return reactivity.isProxy(props) || isInternalObject(props) ? shared.extend({}, props) : props;
|
---|
5980 | }
|
---|
5981 | function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
|
---|
5982 | const { props, ref, patchFlag, children, transition } = vnode;
|
---|
5983 | const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
---|
5984 | const cloned = {
|
---|
5985 | __v_isVNode: true,
|
---|
5986 | __v_skip: true,
|
---|
5987 | type: vnode.type,
|
---|
5988 | props: mergedProps,
|
---|
5989 | key: mergedProps && normalizeKey(mergedProps),
|
---|
5990 | ref: extraProps && extraProps.ref ? (
|
---|
5991 | // #2078 in the case of <component :is="vnode" ref="extra"/>
|
---|
5992 | // if the vnode itself already has a ref, cloneVNode will need to merge
|
---|
5993 | // the refs so the single vnode can be set on multiple refs
|
---|
5994 | mergeRef && ref ? shared.isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
|
---|
5995 | ) : ref,
|
---|
5996 | scopeId: vnode.scopeId,
|
---|
5997 | slotScopeIds: vnode.slotScopeIds,
|
---|
5998 | children: children,
|
---|
5999 | target: vnode.target,
|
---|
6000 | targetStart: vnode.targetStart,
|
---|
6001 | targetAnchor: vnode.targetAnchor,
|
---|
6002 | staticCount: vnode.staticCount,
|
---|
6003 | shapeFlag: vnode.shapeFlag,
|
---|
6004 | // if the vnode is cloned with extra props, we can no longer assume its
|
---|
6005 | // existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
---|
6006 | // note: preserve flag for fragments since they use the flag for children
|
---|
6007 | // fast paths only.
|
---|
6008 | patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
|
---|
6009 | dynamicProps: vnode.dynamicProps,
|
---|
6010 | dynamicChildren: vnode.dynamicChildren,
|
---|
6011 | appContext: vnode.appContext,
|
---|
6012 | dirs: vnode.dirs,
|
---|
6013 | transition,
|
---|
6014 | // These should technically only be non-null on mounted VNodes. However,
|
---|
6015 | // they *should* be copied for kept-alive vnodes. So we just always copy
|
---|
6016 | // them since them being non-null during a mount doesn't affect the logic as
|
---|
6017 | // they will simply be overwritten.
|
---|
6018 | component: vnode.component,
|
---|
6019 | suspense: vnode.suspense,
|
---|
6020 | ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
---|
6021 | ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
---|
6022 | el: vnode.el,
|
---|
6023 | anchor: vnode.anchor,
|
---|
6024 | ctx: vnode.ctx,
|
---|
6025 | ce: vnode.ce
|
---|
6026 | };
|
---|
6027 | if (transition && cloneTransition) {
|
---|
6028 | setTransitionHooks(
|
---|
6029 | cloned,
|
---|
6030 | transition.clone(cloned)
|
---|
6031 | );
|
---|
6032 | }
|
---|
6033 | return cloned;
|
---|
6034 | }
|
---|
6035 | function createTextVNode(text = " ", flag = 0) {
|
---|
6036 | return createVNode(Text, null, text, flag);
|
---|
6037 | }
|
---|
6038 | function createStaticVNode(content, numberOfNodes) {
|
---|
6039 | const vnode = createVNode(Static, null, content);
|
---|
6040 | vnode.staticCount = numberOfNodes;
|
---|
6041 | return vnode;
|
---|
6042 | }
|
---|
6043 | function createCommentVNode(text = "", asBlock = false) {
|
---|
6044 | return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
|
---|
6045 | }
|
---|
6046 | function normalizeVNode(child) {
|
---|
6047 | if (child == null || typeof child === "boolean") {
|
---|
6048 | return createVNode(Comment);
|
---|
6049 | } else if (shared.isArray(child)) {
|
---|
6050 | return createVNode(
|
---|
6051 | Fragment,
|
---|
6052 | null,
|
---|
6053 | // #3666, avoid reference pollution when reusing vnode
|
---|
6054 | child.slice()
|
---|
6055 | );
|
---|
6056 | } else if (isVNode(child)) {
|
---|
6057 | return cloneIfMounted(child);
|
---|
6058 | } else {
|
---|
6059 | return createVNode(Text, null, String(child));
|
---|
6060 | }
|
---|
6061 | }
|
---|
6062 | function cloneIfMounted(child) {
|
---|
6063 | return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
|
---|
6064 | }
|
---|
6065 | function normalizeChildren(vnode, children) {
|
---|
6066 | let type = 0;
|
---|
6067 | const { shapeFlag } = vnode;
|
---|
6068 | if (children == null) {
|
---|
6069 | children = null;
|
---|
6070 | } else if (shared.isArray(children)) {
|
---|
6071 | type = 16;
|
---|
6072 | } else if (typeof children === "object") {
|
---|
6073 | if (shapeFlag & (1 | 64)) {
|
---|
6074 | const slot = children.default;
|
---|
6075 | if (slot) {
|
---|
6076 | slot._c && (slot._d = false);
|
---|
6077 | normalizeChildren(vnode, slot());
|
---|
6078 | slot._c && (slot._d = true);
|
---|
6079 | }
|
---|
6080 | return;
|
---|
6081 | } else {
|
---|
6082 | type = 32;
|
---|
6083 | const slotFlag = children._;
|
---|
6084 | if (!slotFlag && !isInternalObject(children)) {
|
---|
6085 | children._ctx = currentRenderingInstance;
|
---|
6086 | } else if (slotFlag === 3 && currentRenderingInstance) {
|
---|
6087 | if (currentRenderingInstance.slots._ === 1) {
|
---|
6088 | children._ = 1;
|
---|
6089 | } else {
|
---|
6090 | children._ = 2;
|
---|
6091 | vnode.patchFlag |= 1024;
|
---|
6092 | }
|
---|
6093 | }
|
---|
6094 | }
|
---|
6095 | } else if (shared.isFunction(children)) {
|
---|
6096 | children = { default: children, _ctx: currentRenderingInstance };
|
---|
6097 | type = 32;
|
---|
6098 | } else {
|
---|
6099 | children = String(children);
|
---|
6100 | if (shapeFlag & 64) {
|
---|
6101 | type = 16;
|
---|
6102 | children = [createTextVNode(children)];
|
---|
6103 | } else {
|
---|
6104 | type = 8;
|
---|
6105 | }
|
---|
6106 | }
|
---|
6107 | vnode.children = children;
|
---|
6108 | vnode.shapeFlag |= type;
|
---|
6109 | }
|
---|
6110 | function mergeProps(...args) {
|
---|
6111 | const ret = {};
|
---|
6112 | for (let i = 0; i < args.length; i++) {
|
---|
6113 | const toMerge = args[i];
|
---|
6114 | for (const key in toMerge) {
|
---|
6115 | if (key === "class") {
|
---|
6116 | if (ret.class !== toMerge.class) {
|
---|
6117 | ret.class = shared.normalizeClass([ret.class, toMerge.class]);
|
---|
6118 | }
|
---|
6119 | } else if (key === "style") {
|
---|
6120 | ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
|
---|
6121 | } else if (shared.isOn(key)) {
|
---|
6122 | const existing = ret[key];
|
---|
6123 | const incoming = toMerge[key];
|
---|
6124 | if (incoming && existing !== incoming && !(shared.isArray(existing) && existing.includes(incoming))) {
|
---|
6125 | ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
---|
6126 | }
|
---|
6127 | } else if (key !== "") {
|
---|
6128 | ret[key] = toMerge[key];
|
---|
6129 | }
|
---|
6130 | }
|
---|
6131 | }
|
---|
6132 | return ret;
|
---|
6133 | }
|
---|
6134 | function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
---|
6135 | callWithAsyncErrorHandling(hook, instance, 7, [
|
---|
6136 | vnode,
|
---|
6137 | prevVNode
|
---|
6138 | ]);
|
---|
6139 | }
|
---|
6140 |
|
---|
6141 | const emptyAppContext = createAppContext();
|
---|
6142 | let uid = 0;
|
---|
6143 | function createComponentInstance(vnode, parent, suspense) {
|
---|
6144 | const type = vnode.type;
|
---|
6145 | const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
|
---|
6146 | const instance = {
|
---|
6147 | uid: uid++,
|
---|
6148 | vnode,
|
---|
6149 | type,
|
---|
6150 | parent,
|
---|
6151 | appContext,
|
---|
6152 | root: null,
|
---|
6153 | // to be immediately set
|
---|
6154 | next: null,
|
---|
6155 | subTree: null,
|
---|
6156 | // will be set synchronously right after creation
|
---|
6157 | effect: null,
|
---|
6158 | update: null,
|
---|
6159 | // will be set synchronously right after creation
|
---|
6160 | job: null,
|
---|
6161 | scope: new reactivity.EffectScope(
|
---|
6162 | true
|
---|
6163 | /* detached */
|
---|
6164 | ),
|
---|
6165 | render: null,
|
---|
6166 | proxy: null,
|
---|
6167 | exposed: null,
|
---|
6168 | exposeProxy: null,
|
---|
6169 | withProxy: null,
|
---|
6170 | provides: parent ? parent.provides : Object.create(appContext.provides),
|
---|
6171 | ids: parent ? parent.ids : ["", 0, 0],
|
---|
6172 | accessCache: null,
|
---|
6173 | renderCache: [],
|
---|
6174 | // local resolved assets
|
---|
6175 | components: null,
|
---|
6176 | directives: null,
|
---|
6177 | // resolved props and emits options
|
---|
6178 | propsOptions: normalizePropsOptions(type, appContext),
|
---|
6179 | emitsOptions: normalizeEmitsOptions(type, appContext),
|
---|
6180 | // emit
|
---|
6181 | emit: null,
|
---|
6182 | // to be set immediately
|
---|
6183 | emitted: null,
|
---|
6184 | // props default value
|
---|
6185 | propsDefaults: shared.EMPTY_OBJ,
|
---|
6186 | // inheritAttrs
|
---|
6187 | inheritAttrs: type.inheritAttrs,
|
---|
6188 | // state
|
---|
6189 | ctx: shared.EMPTY_OBJ,
|
---|
6190 | data: shared.EMPTY_OBJ,
|
---|
6191 | props: shared.EMPTY_OBJ,
|
---|
6192 | attrs: shared.EMPTY_OBJ,
|
---|
6193 | slots: shared.EMPTY_OBJ,
|
---|
6194 | refs: shared.EMPTY_OBJ,
|
---|
6195 | setupState: shared.EMPTY_OBJ,
|
---|
6196 | setupContext: null,
|
---|
6197 | // suspense related
|
---|
6198 | suspense,
|
---|
6199 | suspenseId: suspense ? suspense.pendingId : 0,
|
---|
6200 | asyncDep: null,
|
---|
6201 | asyncResolved: false,
|
---|
6202 | // lifecycle hooks
|
---|
6203 | // not using enums here because it results in computed properties
|
---|
6204 | isMounted: false,
|
---|
6205 | isUnmounted: false,
|
---|
6206 | isDeactivated: false,
|
---|
6207 | bc: null,
|
---|
6208 | c: null,
|
---|
6209 | bm: null,
|
---|
6210 | m: null,
|
---|
6211 | bu: null,
|
---|
6212 | u: null,
|
---|
6213 | um: null,
|
---|
6214 | bum: null,
|
---|
6215 | da: null,
|
---|
6216 | a: null,
|
---|
6217 | rtg: null,
|
---|
6218 | rtc: null,
|
---|
6219 | ec: null,
|
---|
6220 | sp: null
|
---|
6221 | };
|
---|
6222 | {
|
---|
6223 | instance.ctx = { _: instance };
|
---|
6224 | }
|
---|
6225 | instance.root = parent ? parent.root : instance;
|
---|
6226 | instance.emit = emit.bind(null, instance);
|
---|
6227 | if (vnode.ce) {
|
---|
6228 | vnode.ce(instance);
|
---|
6229 | }
|
---|
6230 | return instance;
|
---|
6231 | }
|
---|
6232 | let currentInstance = null;
|
---|
6233 | const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
---|
6234 | let internalSetCurrentInstance;
|
---|
6235 | let setInSSRSetupState;
|
---|
6236 | {
|
---|
6237 | const g = shared.getGlobalThis();
|
---|
6238 | const registerGlobalSetter = (key, setter) => {
|
---|
6239 | let setters;
|
---|
6240 | if (!(setters = g[key])) setters = g[key] = [];
|
---|
6241 | setters.push(setter);
|
---|
6242 | return (v) => {
|
---|
6243 | if (setters.length > 1) setters.forEach((set) => set(v));
|
---|
6244 | else setters[0](v);
|
---|
6245 | };
|
---|
6246 | };
|
---|
6247 | internalSetCurrentInstance = registerGlobalSetter(
|
---|
6248 | `__VUE_INSTANCE_SETTERS__`,
|
---|
6249 | (v) => currentInstance = v
|
---|
6250 | );
|
---|
6251 | setInSSRSetupState = registerGlobalSetter(
|
---|
6252 | `__VUE_SSR_SETTERS__`,
|
---|
6253 | (v) => isInSSRComponentSetup = v
|
---|
6254 | );
|
---|
6255 | }
|
---|
6256 | const setCurrentInstance = (instance) => {
|
---|
6257 | const prev = currentInstance;
|
---|
6258 | internalSetCurrentInstance(instance);
|
---|
6259 | instance.scope.on();
|
---|
6260 | return () => {
|
---|
6261 | instance.scope.off();
|
---|
6262 | internalSetCurrentInstance(prev);
|
---|
6263 | };
|
---|
6264 | };
|
---|
6265 | const unsetCurrentInstance = () => {
|
---|
6266 | currentInstance && currentInstance.scope.off();
|
---|
6267 | internalSetCurrentInstance(null);
|
---|
6268 | };
|
---|
6269 | function isStatefulComponent(instance) {
|
---|
6270 | return instance.vnode.shapeFlag & 4;
|
---|
6271 | }
|
---|
6272 | let isInSSRComponentSetup = false;
|
---|
6273 | function setupComponent(instance, isSSR = false, optimized = false) {
|
---|
6274 | isSSR && setInSSRSetupState(isSSR);
|
---|
6275 | const { props, children } = instance.vnode;
|
---|
6276 | const isStateful = isStatefulComponent(instance);
|
---|
6277 | initProps(instance, props, isStateful, isSSR);
|
---|
6278 | initSlots(instance, children, optimized);
|
---|
6279 | const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
---|
6280 | isSSR && setInSSRSetupState(false);
|
---|
6281 | return setupResult;
|
---|
6282 | }
|
---|
6283 | function setupStatefulComponent(instance, isSSR) {
|
---|
6284 | const Component = instance.type;
|
---|
6285 | instance.accessCache = /* @__PURE__ */ Object.create(null);
|
---|
6286 | instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
|
---|
6287 | const { setup } = Component;
|
---|
6288 | if (setup) {
|
---|
6289 | reactivity.pauseTracking();
|
---|
6290 | const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
---|
6291 | const reset = setCurrentInstance(instance);
|
---|
6292 | const setupResult = callWithErrorHandling(
|
---|
6293 | setup,
|
---|
6294 | instance,
|
---|
6295 | 0,
|
---|
6296 | [
|
---|
6297 | instance.props,
|
---|
6298 | setupContext
|
---|
6299 | ]
|
---|
6300 | );
|
---|
6301 | const isAsyncSetup = shared.isPromise(setupResult);
|
---|
6302 | reactivity.resetTracking();
|
---|
6303 | reset();
|
---|
6304 | if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
|
---|
6305 | markAsyncBoundary(instance);
|
---|
6306 | }
|
---|
6307 | if (isAsyncSetup) {
|
---|
6308 | setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
---|
6309 | if (isSSR) {
|
---|
6310 | return setupResult.then((resolvedResult) => {
|
---|
6311 | handleSetupResult(instance, resolvedResult, isSSR);
|
---|
6312 | }).catch((e) => {
|
---|
6313 | handleError(e, instance, 0);
|
---|
6314 | });
|
---|
6315 | } else {
|
---|
6316 | instance.asyncDep = setupResult;
|
---|
6317 | }
|
---|
6318 | } else {
|
---|
6319 | handleSetupResult(instance, setupResult, isSSR);
|
---|
6320 | }
|
---|
6321 | } else {
|
---|
6322 | finishComponentSetup(instance, isSSR);
|
---|
6323 | }
|
---|
6324 | }
|
---|
6325 | function handleSetupResult(instance, setupResult, isSSR) {
|
---|
6326 | if (shared.isFunction(setupResult)) {
|
---|
6327 | if (instance.type.__ssrInlineRender) {
|
---|
6328 | instance.ssrRender = setupResult;
|
---|
6329 | } else {
|
---|
6330 | instance.render = setupResult;
|
---|
6331 | }
|
---|
6332 | } else if (shared.isObject(setupResult)) {
|
---|
6333 | instance.setupState = reactivity.proxyRefs(setupResult);
|
---|
6334 | } else ;
|
---|
6335 | finishComponentSetup(instance, isSSR);
|
---|
6336 | }
|
---|
6337 | let compile;
|
---|
6338 | let installWithProxy;
|
---|
6339 | function registerRuntimeCompiler(_compile) {
|
---|
6340 | compile = _compile;
|
---|
6341 | installWithProxy = (i) => {
|
---|
6342 | if (i.render._rc) {
|
---|
6343 | i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
|
---|
6344 | }
|
---|
6345 | };
|
---|
6346 | }
|
---|
6347 | const isRuntimeOnly = () => !compile;
|
---|
6348 | function finishComponentSetup(instance, isSSR, skipOptions) {
|
---|
6349 | const Component = instance.type;
|
---|
6350 | if (!instance.render) {
|
---|
6351 | if (!isSSR && compile && !Component.render) {
|
---|
6352 | const template = Component.template || resolveMergedOptions(instance).template;
|
---|
6353 | if (template) {
|
---|
6354 | const { isCustomElement, compilerOptions } = instance.appContext.config;
|
---|
6355 | const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
---|
6356 | const finalCompilerOptions = shared.extend(
|
---|
6357 | shared.extend(
|
---|
6358 | {
|
---|
6359 | isCustomElement,
|
---|
6360 | delimiters
|
---|
6361 | },
|
---|
6362 | compilerOptions
|
---|
6363 | ),
|
---|
6364 | componentCompilerOptions
|
---|
6365 | );
|
---|
6366 | Component.render = compile(template, finalCompilerOptions);
|
---|
6367 | }
|
---|
6368 | }
|
---|
6369 | instance.render = Component.render || shared.NOOP;
|
---|
6370 | if (installWithProxy) {
|
---|
6371 | installWithProxy(instance);
|
---|
6372 | }
|
---|
6373 | }
|
---|
6374 | {
|
---|
6375 | const reset = setCurrentInstance(instance);
|
---|
6376 | reactivity.pauseTracking();
|
---|
6377 | try {
|
---|
6378 | applyOptions(instance);
|
---|
6379 | } finally {
|
---|
6380 | reactivity.resetTracking();
|
---|
6381 | reset();
|
---|
6382 | }
|
---|
6383 | }
|
---|
6384 | }
|
---|
6385 | const attrsProxyHandlers = {
|
---|
6386 | get(target, key) {
|
---|
6387 | reactivity.track(target, "get", "");
|
---|
6388 | return target[key];
|
---|
6389 | }
|
---|
6390 | };
|
---|
6391 | function createSetupContext(instance) {
|
---|
6392 | const expose = (exposed) => {
|
---|
6393 | instance.exposed = exposed || {};
|
---|
6394 | };
|
---|
6395 | {
|
---|
6396 | return {
|
---|
6397 | attrs: new Proxy(instance.attrs, attrsProxyHandlers),
|
---|
6398 | slots: instance.slots,
|
---|
6399 | emit: instance.emit,
|
---|
6400 | expose
|
---|
6401 | };
|
---|
6402 | }
|
---|
6403 | }
|
---|
6404 | function getComponentPublicInstance(instance) {
|
---|
6405 | if (instance.exposed) {
|
---|
6406 | return instance.exposeProxy || (instance.exposeProxy = new Proxy(reactivity.proxyRefs(reactivity.markRaw(instance.exposed)), {
|
---|
6407 | get(target, key) {
|
---|
6408 | if (key in target) {
|
---|
6409 | return target[key];
|
---|
6410 | } else if (key in publicPropertiesMap) {
|
---|
6411 | return publicPropertiesMap[key](instance);
|
---|
6412 | }
|
---|
6413 | },
|
---|
6414 | has(target, key) {
|
---|
6415 | return key in target || key in publicPropertiesMap;
|
---|
6416 | }
|
---|
6417 | }));
|
---|
6418 | } else {
|
---|
6419 | return instance.proxy;
|
---|
6420 | }
|
---|
6421 | }
|
---|
6422 | function getComponentName(Component, includeInferred = true) {
|
---|
6423 | return shared.isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
|
---|
6424 | }
|
---|
6425 | function isClassComponent(value) {
|
---|
6426 | return shared.isFunction(value) && "__vccOpts" in value;
|
---|
6427 | }
|
---|
6428 |
|
---|
6429 | const computed = (getterOrOptions, debugOptions) => {
|
---|
6430 | const c = reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
---|
6431 | return c;
|
---|
6432 | };
|
---|
6433 |
|
---|
6434 | function h(type, propsOrChildren, children) {
|
---|
6435 | const l = arguments.length;
|
---|
6436 | if (l === 2) {
|
---|
6437 | if (shared.isObject(propsOrChildren) && !shared.isArray(propsOrChildren)) {
|
---|
6438 | if (isVNode(propsOrChildren)) {
|
---|
6439 | return createVNode(type, null, [propsOrChildren]);
|
---|
6440 | }
|
---|
6441 | return createVNode(type, propsOrChildren);
|
---|
6442 | } else {
|
---|
6443 | return createVNode(type, null, propsOrChildren);
|
---|
6444 | }
|
---|
6445 | } else {
|
---|
6446 | if (l > 3) {
|
---|
6447 | children = Array.prototype.slice.call(arguments, 2);
|
---|
6448 | } else if (l === 3 && isVNode(children)) {
|
---|
6449 | children = [children];
|
---|
6450 | }
|
---|
6451 | return createVNode(type, propsOrChildren, children);
|
---|
6452 | }
|
---|
6453 | }
|
---|
6454 |
|
---|
6455 | function initCustomFormatter() {
|
---|
6456 | {
|
---|
6457 | return;
|
---|
6458 | }
|
---|
6459 | }
|
---|
6460 |
|
---|
6461 | function withMemo(memo, render, cache, index) {
|
---|
6462 | const cached = cache[index];
|
---|
6463 | if (cached && isMemoSame(cached, memo)) {
|
---|
6464 | return cached;
|
---|
6465 | }
|
---|
6466 | const ret = render();
|
---|
6467 | ret.memo = memo.slice();
|
---|
6468 | ret.cacheIndex = index;
|
---|
6469 | return cache[index] = ret;
|
---|
6470 | }
|
---|
6471 | function isMemoSame(cached, memo) {
|
---|
6472 | const prev = cached.memo;
|
---|
6473 | if (prev.length != memo.length) {
|
---|
6474 | return false;
|
---|
6475 | }
|
---|
6476 | for (let i = 0; i < prev.length; i++) {
|
---|
6477 | if (shared.hasChanged(prev[i], memo[i])) {
|
---|
6478 | return false;
|
---|
6479 | }
|
---|
6480 | }
|
---|
6481 | if (isBlockTreeEnabled > 0 && currentBlock) {
|
---|
6482 | currentBlock.push(cached);
|
---|
6483 | }
|
---|
6484 | return true;
|
---|
6485 | }
|
---|
6486 |
|
---|
6487 | const version = "3.5.13";
|
---|
6488 | const warn$1 = shared.NOOP;
|
---|
6489 | const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
---|
6490 | const devtools = void 0;
|
---|
6491 | const setDevtoolsHook = shared.NOOP;
|
---|
6492 | const _ssrUtils = {
|
---|
6493 | createComponentInstance,
|
---|
6494 | setupComponent,
|
---|
6495 | renderComponentRoot,
|
---|
6496 | setCurrentRenderingInstance,
|
---|
6497 | isVNode: isVNode,
|
---|
6498 | normalizeVNode,
|
---|
6499 | getComponentPublicInstance,
|
---|
6500 | ensureValidVNode,
|
---|
6501 | pushWarningContext,
|
---|
6502 | popWarningContext
|
---|
6503 | };
|
---|
6504 | const ssrUtils = _ssrUtils ;
|
---|
6505 | const resolveFilter = null;
|
---|
6506 | const compatUtils = null;
|
---|
6507 | const DeprecationTypes = null;
|
---|
6508 |
|
---|
6509 | exports.EffectScope = reactivity.EffectScope;
|
---|
6510 | exports.ReactiveEffect = reactivity.ReactiveEffect;
|
---|
6511 | exports.TrackOpTypes = reactivity.TrackOpTypes;
|
---|
6512 | exports.TriggerOpTypes = reactivity.TriggerOpTypes;
|
---|
6513 | exports.customRef = reactivity.customRef;
|
---|
6514 | exports.effect = reactivity.effect;
|
---|
6515 | exports.effectScope = reactivity.effectScope;
|
---|
6516 | exports.getCurrentScope = reactivity.getCurrentScope;
|
---|
6517 | exports.getCurrentWatcher = reactivity.getCurrentWatcher;
|
---|
6518 | exports.isProxy = reactivity.isProxy;
|
---|
6519 | exports.isReactive = reactivity.isReactive;
|
---|
6520 | exports.isReadonly = reactivity.isReadonly;
|
---|
6521 | exports.isRef = reactivity.isRef;
|
---|
6522 | exports.isShallow = reactivity.isShallow;
|
---|
6523 | exports.markRaw = reactivity.markRaw;
|
---|
6524 | exports.onScopeDispose = reactivity.onScopeDispose;
|
---|
6525 | exports.onWatcherCleanup = reactivity.onWatcherCleanup;
|
---|
6526 | exports.proxyRefs = reactivity.proxyRefs;
|
---|
6527 | exports.reactive = reactivity.reactive;
|
---|
6528 | exports.readonly = reactivity.readonly;
|
---|
6529 | exports.ref = reactivity.ref;
|
---|
6530 | exports.shallowReactive = reactivity.shallowReactive;
|
---|
6531 | exports.shallowReadonly = reactivity.shallowReadonly;
|
---|
6532 | exports.shallowRef = reactivity.shallowRef;
|
---|
6533 | exports.stop = reactivity.stop;
|
---|
6534 | exports.toRaw = reactivity.toRaw;
|
---|
6535 | exports.toRef = reactivity.toRef;
|
---|
6536 | exports.toRefs = reactivity.toRefs;
|
---|
6537 | exports.toValue = reactivity.toValue;
|
---|
6538 | exports.triggerRef = reactivity.triggerRef;
|
---|
6539 | exports.unref = reactivity.unref;
|
---|
6540 | exports.camelize = shared.camelize;
|
---|
6541 | exports.capitalize = shared.capitalize;
|
---|
6542 | exports.normalizeClass = shared.normalizeClass;
|
---|
6543 | exports.normalizeProps = shared.normalizeProps;
|
---|
6544 | exports.normalizeStyle = shared.normalizeStyle;
|
---|
6545 | exports.toDisplayString = shared.toDisplayString;
|
---|
6546 | exports.toHandlerKey = shared.toHandlerKey;
|
---|
6547 | exports.BaseTransition = BaseTransition;
|
---|
6548 | exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
|
---|
6549 | exports.Comment = Comment;
|
---|
6550 | exports.DeprecationTypes = DeprecationTypes;
|
---|
6551 | exports.ErrorCodes = ErrorCodes;
|
---|
6552 | exports.ErrorTypeStrings = ErrorTypeStrings;
|
---|
6553 | exports.Fragment = Fragment;
|
---|
6554 | exports.KeepAlive = KeepAlive;
|
---|
6555 | exports.Static = Static;
|
---|
6556 | exports.Suspense = Suspense;
|
---|
6557 | exports.Teleport = Teleport;
|
---|
6558 | exports.Text = Text;
|
---|
6559 | exports.assertNumber = assertNumber;
|
---|
6560 | exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
|
---|
6561 | exports.callWithErrorHandling = callWithErrorHandling;
|
---|
6562 | exports.cloneVNode = cloneVNode;
|
---|
6563 | exports.compatUtils = compatUtils;
|
---|
6564 | exports.computed = computed;
|
---|
6565 | exports.createBlock = createBlock;
|
---|
6566 | exports.createCommentVNode = createCommentVNode;
|
---|
6567 | exports.createElementBlock = createElementBlock;
|
---|
6568 | exports.createElementVNode = createBaseVNode;
|
---|
6569 | exports.createHydrationRenderer = createHydrationRenderer;
|
---|
6570 | exports.createPropsRestProxy = createPropsRestProxy;
|
---|
6571 | exports.createRenderer = createRenderer;
|
---|
6572 | exports.createSlots = createSlots;
|
---|
6573 | exports.createStaticVNode = createStaticVNode;
|
---|
6574 | exports.createTextVNode = createTextVNode;
|
---|
6575 | exports.createVNode = createVNode;
|
---|
6576 | exports.defineAsyncComponent = defineAsyncComponent;
|
---|
6577 | exports.defineComponent = defineComponent;
|
---|
6578 | exports.defineEmits = defineEmits;
|
---|
6579 | exports.defineExpose = defineExpose;
|
---|
6580 | exports.defineModel = defineModel;
|
---|
6581 | exports.defineOptions = defineOptions;
|
---|
6582 | exports.defineProps = defineProps;
|
---|
6583 | exports.defineSlots = defineSlots;
|
---|
6584 | exports.devtools = devtools;
|
---|
6585 | exports.getCurrentInstance = getCurrentInstance;
|
---|
6586 | exports.getTransitionRawChildren = getTransitionRawChildren;
|
---|
6587 | exports.guardReactiveProps = guardReactiveProps;
|
---|
6588 | exports.h = h;
|
---|
6589 | exports.handleError = handleError;
|
---|
6590 | exports.hasInjectionContext = hasInjectionContext;
|
---|
6591 | exports.hydrateOnIdle = hydrateOnIdle;
|
---|
6592 | exports.hydrateOnInteraction = hydrateOnInteraction;
|
---|
6593 | exports.hydrateOnMediaQuery = hydrateOnMediaQuery;
|
---|
6594 | exports.hydrateOnVisible = hydrateOnVisible;
|
---|
6595 | exports.initCustomFormatter = initCustomFormatter;
|
---|
6596 | exports.inject = inject;
|
---|
6597 | exports.isMemoSame = isMemoSame;
|
---|
6598 | exports.isRuntimeOnly = isRuntimeOnly;
|
---|
6599 | exports.isVNode = isVNode;
|
---|
6600 | exports.mergeDefaults = mergeDefaults;
|
---|
6601 | exports.mergeModels = mergeModels;
|
---|
6602 | exports.mergeProps = mergeProps;
|
---|
6603 | exports.nextTick = nextTick;
|
---|
6604 | exports.onActivated = onActivated;
|
---|
6605 | exports.onBeforeMount = onBeforeMount;
|
---|
6606 | exports.onBeforeUnmount = onBeforeUnmount;
|
---|
6607 | exports.onBeforeUpdate = onBeforeUpdate;
|
---|
6608 | exports.onDeactivated = onDeactivated;
|
---|
6609 | exports.onErrorCaptured = onErrorCaptured;
|
---|
6610 | exports.onMounted = onMounted;
|
---|
6611 | exports.onRenderTracked = onRenderTracked;
|
---|
6612 | exports.onRenderTriggered = onRenderTriggered;
|
---|
6613 | exports.onServerPrefetch = onServerPrefetch;
|
---|
6614 | exports.onUnmounted = onUnmounted;
|
---|
6615 | exports.onUpdated = onUpdated;
|
---|
6616 | exports.openBlock = openBlock;
|
---|
6617 | exports.popScopeId = popScopeId;
|
---|
6618 | exports.provide = provide;
|
---|
6619 | exports.pushScopeId = pushScopeId;
|
---|
6620 | exports.queuePostFlushCb = queuePostFlushCb;
|
---|
6621 | exports.registerRuntimeCompiler = registerRuntimeCompiler;
|
---|
6622 | exports.renderList = renderList;
|
---|
6623 | exports.renderSlot = renderSlot;
|
---|
6624 | exports.resolveComponent = resolveComponent;
|
---|
6625 | exports.resolveDirective = resolveDirective;
|
---|
6626 | exports.resolveDynamicComponent = resolveDynamicComponent;
|
---|
6627 | exports.resolveFilter = resolveFilter;
|
---|
6628 | exports.resolveTransitionHooks = resolveTransitionHooks;
|
---|
6629 | exports.setBlockTracking = setBlockTracking;
|
---|
6630 | exports.setDevtoolsHook = setDevtoolsHook;
|
---|
6631 | exports.setTransitionHooks = setTransitionHooks;
|
---|
6632 | exports.ssrContextKey = ssrContextKey;
|
---|
6633 | exports.ssrUtils = ssrUtils;
|
---|
6634 | exports.toHandlers = toHandlers;
|
---|
6635 | exports.transformVNodeArgs = transformVNodeArgs;
|
---|
6636 | exports.useAttrs = useAttrs;
|
---|
6637 | exports.useId = useId;
|
---|
6638 | exports.useModel = useModel;
|
---|
6639 | exports.useSSRContext = useSSRContext;
|
---|
6640 | exports.useSlots = useSlots;
|
---|
6641 | exports.useTemplateRef = useTemplateRef;
|
---|
6642 | exports.useTransitionState = useTransitionState;
|
---|
6643 | exports.version = version;
|
---|
6644 | exports.warn = warn$1;
|
---|
6645 | exports.watch = watch;
|
---|
6646 | exports.watchEffect = watchEffect;
|
---|
6647 | exports.watchPostEffect = watchPostEffect;
|
---|
6648 | exports.watchSyncEffect = watchSyncEffect;
|
---|
6649 | exports.withAsyncContext = withAsyncContext;
|
---|
6650 | exports.withCtx = withCtx;
|
---|
6651 | exports.withDefaults = withDefaults;
|
---|
6652 | exports.withDirectives = withDirectives;
|
---|
6653 | exports.withMemo = withMemo;
|
---|
6654 | exports.withScopeId = withScopeId;
|
---|