@vue/server-renderer 3.6.0-beta.9 → 3.6.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server-renderer.cjs.js +60 -300
- package/dist/server-renderer.cjs.prod.js +58 -36
- package/dist/server-renderer.d.ts +3 -3
- package/dist/server-renderer.esm-browser.js +275 -117
- package/dist/server-renderer.esm-browser.prod.js +2 -2
- package/dist/server-renderer.esm-bundler.js +34 -789
- package/package.json +4 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/server-renderer v3.6.0-
|
|
2
|
+
* @vue/server-renderer v3.6.0-rc.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -292,9 +292,14 @@ function escapeHtml(string) {
|
|
|
292
292
|
}
|
|
293
293
|
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
|
294
294
|
}
|
|
295
|
-
const commentStripRE =
|
|
295
|
+
const commentStripRE = /^(?:-?>)+|<!--|-->|--!>|<!-$/g;
|
|
296
296
|
function escapeHtmlComment(src) {
|
|
297
|
-
|
|
297
|
+
let prev;
|
|
298
|
+
do {
|
|
299
|
+
prev = src;
|
|
300
|
+
src = src.replace(commentStripRE, "");
|
|
301
|
+
} while (src !== prev);
|
|
302
|
+
return src;
|
|
298
303
|
}
|
|
299
304
|
//#endregion
|
|
300
305
|
//#region packages/shared/src/looseEqual.ts
|
|
@@ -457,6 +462,13 @@ function warn$2(msg, ...args) {
|
|
|
457
462
|
const notifyBuffer = [];
|
|
458
463
|
let batchDepth = 0;
|
|
459
464
|
let activeSub = void 0;
|
|
465
|
+
let runDepth = 0;
|
|
466
|
+
function incRunDepth() {
|
|
467
|
+
++runDepth;
|
|
468
|
+
}
|
|
469
|
+
function decRunDepth() {
|
|
470
|
+
--runDepth;
|
|
471
|
+
}
|
|
460
472
|
let globalVersion = 0;
|
|
461
473
|
let notifyIndex = 0;
|
|
462
474
|
let notifyBufferLength = 0;
|
|
@@ -530,8 +542,10 @@ function propagate(link) {
|
|
|
530
542
|
const sub = link.sub;
|
|
531
543
|
let flags = sub.flags;
|
|
532
544
|
if (flags & 3) {
|
|
533
|
-
if (!(flags & 60))
|
|
534
|
-
|
|
545
|
+
if (!(flags & 60)) {
|
|
546
|
+
sub.flags = flags | 32;
|
|
547
|
+
if (runDepth) sub.flags |= 8;
|
|
548
|
+
} else if (!(flags & 12)) flags = 0;
|
|
535
549
|
else if (!(flags & 4)) sub.flags = flags & -9 | 32;
|
|
536
550
|
else if (!(flags & 48) && isValidLink(link, sub)) {
|
|
537
551
|
sub.flags = flags | 40;
|
|
@@ -600,13 +614,13 @@ function checkDirty(link, sub) {
|
|
|
600
614
|
let dirty = false;
|
|
601
615
|
if (sub.flags & 16) dirty = true;
|
|
602
616
|
else if ((depFlags & 17) === 17) {
|
|
617
|
+
const subs = dep.subs;
|
|
603
618
|
if (dep.update()) {
|
|
604
|
-
const subs = dep.subs;
|
|
605
619
|
if (subs.nextSub !== void 0) shallowPropagate(subs);
|
|
606
620
|
dirty = true;
|
|
607
621
|
}
|
|
608
622
|
} else if ((depFlags & 33) === 33) {
|
|
609
|
-
|
|
623
|
+
stack = {
|
|
610
624
|
value: link,
|
|
611
625
|
prev: stack
|
|
612
626
|
};
|
|
@@ -621,15 +635,12 @@ function checkDirty(link, sub) {
|
|
|
621
635
|
}
|
|
622
636
|
while (checkDepth) {
|
|
623
637
|
--checkDepth;
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
if (hasMultipleSubs) {
|
|
627
|
-
link = stack.value;
|
|
628
|
-
stack = stack.prev;
|
|
629
|
-
} else link = firstSub;
|
|
638
|
+
link = stack.value;
|
|
639
|
+
stack = stack.prev;
|
|
630
640
|
if (dirty) {
|
|
641
|
+
const subs = sub.subs;
|
|
631
642
|
if (sub.update()) {
|
|
632
|
-
if (
|
|
643
|
+
if (subs.nextSub !== void 0) shallowPropagate(subs);
|
|
633
644
|
sub = link.sub;
|
|
634
645
|
continue;
|
|
635
646
|
}
|
|
@@ -641,7 +652,7 @@ function checkDirty(link, sub) {
|
|
|
641
652
|
}
|
|
642
653
|
dirty = false;
|
|
643
654
|
}
|
|
644
|
-
return dirty;
|
|
655
|
+
return dirty && !!sub.flags;
|
|
645
656
|
} while (true);
|
|
646
657
|
}
|
|
647
658
|
function shallowPropagate(link) {
|
|
@@ -1020,7 +1031,7 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
|
|
|
1020
1031
|
}
|
|
1021
1032
|
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
1022
1033
|
const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);
|
|
1023
|
-
if (target === /* @__PURE__ */ toRaw(receiver)) {
|
|
1034
|
+
if (target === /* @__PURE__ */ toRaw(receiver) && result) {
|
|
1024
1035
|
if (!hadKey) trigger(target, "add", key, value);
|
|
1025
1036
|
else if (hasChanged(value, oldValue)) trigger(target, "set", key, value, oldValue);
|
|
1026
1037
|
}
|
|
@@ -1238,9 +1249,6 @@ function targetTypeMap(rawType) {
|
|
|
1238
1249
|
default: return 0;
|
|
1239
1250
|
}
|
|
1240
1251
|
}
|
|
1241
|
-
function getTargetType(value) {
|
|
1242
|
-
return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
|
|
1243
|
-
}
|
|
1244
1252
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1245
1253
|
function reactive(target) {
|
|
1246
1254
|
if (/* @__PURE__ */ isReadonly(target)) return target;
|
|
@@ -1353,10 +1361,11 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1353
1361
|
return target;
|
|
1354
1362
|
}
|
|
1355
1363
|
if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
|
|
1356
|
-
|
|
1357
|
-
if (targetType === 0) return target;
|
|
1364
|
+
if (target["__v_skip"] || !Object.isExtensible(target)) return target;
|
|
1358
1365
|
const existingProxy = proxyMap.get(target);
|
|
1359
1366
|
if (existingProxy) return existingProxy;
|
|
1367
|
+
const targetType = targetTypeMap(toRawType(target));
|
|
1368
|
+
if (targetType === 0) return target;
|
|
1360
1369
|
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
1361
1370
|
proxyMap.set(target, proxy);
|
|
1362
1371
|
return proxy;
|
|
@@ -1561,9 +1570,11 @@ var ReactiveEffect = class {
|
|
|
1561
1570
|
if (!this.active) return this.fn();
|
|
1562
1571
|
cleanup(this);
|
|
1563
1572
|
const prevSub = startTracking(this);
|
|
1573
|
+
incRunDepth();
|
|
1564
1574
|
try {
|
|
1565
1575
|
return this.fn();
|
|
1566
1576
|
} finally {
|
|
1577
|
+
decRunDepth();
|
|
1567
1578
|
endTracking(this, prevSub);
|
|
1568
1579
|
const flags = this.flags;
|
|
1569
1580
|
if ((flags & 136) === 136) {
|
|
@@ -1855,8 +1866,9 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
1855
1866
|
if (once && cb) {
|
|
1856
1867
|
const _cb = cb;
|
|
1857
1868
|
cb = (...args) => {
|
|
1858
|
-
_cb(...args);
|
|
1869
|
+
const res = _cb(...args);
|
|
1859
1870
|
this.stop();
|
|
1871
|
+
return res;
|
|
1860
1872
|
};
|
|
1861
1873
|
}
|
|
1862
1874
|
this.cb = cb;
|
|
@@ -1870,7 +1882,7 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
1870
1882
|
if (!this.cb) return;
|
|
1871
1883
|
const { immediate, deep, call } = this.options;
|
|
1872
1884
|
if (initialRun && !immediate) return;
|
|
1873
|
-
if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
1885
|
+
if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
1874
1886
|
cleanup(this);
|
|
1875
1887
|
const currentWatcher = activeWatcher;
|
|
1876
1888
|
activeWatcher = this;
|
|
@@ -2139,8 +2151,8 @@ function findInsertionIndex(order, queue, start, end) {
|
|
|
2139
2151
|
/**
|
|
2140
2152
|
* @internal for runtime-vapor only
|
|
2141
2153
|
*/
|
|
2142
|
-
function queueJob(job, id, isPre = false) {
|
|
2143
|
-
if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
|
|
2154
|
+
function queueJob(job, id, isPre = false, order = 0) {
|
|
2155
|
+
if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : order ? id * 2 + 1 + order / (order + 1) : id * 2 + 1, jobs, jobsLength, flushIndex)) {
|
|
2144
2156
|
jobsLength++;
|
|
2145
2157
|
queueFlush();
|
|
2146
2158
|
}
|
|
@@ -2249,6 +2261,7 @@ function flushJobs(seen) {
|
|
|
2249
2261
|
}
|
|
2250
2262
|
flushIndex = 0;
|
|
2251
2263
|
jobsLength = 0;
|
|
2264
|
+
jobs.length = 0;
|
|
2252
2265
|
flushPostFlushCbs(seen);
|
|
2253
2266
|
currentFlushPromise = null;
|
|
2254
2267
|
if (jobsLength || postJobs.length) flushJobs(seen);
|
|
@@ -2306,6 +2319,14 @@ function createRecord(id, initialDef) {
|
|
|
2306
2319
|
function normalizeClassComponent(component) {
|
|
2307
2320
|
return isClassComponent(component) ? component.__vccOpts : component;
|
|
2308
2321
|
}
|
|
2322
|
+
function hasDirtyAncestor(instance, dirtyInstances) {
|
|
2323
|
+
let parent = instance.parent;
|
|
2324
|
+
while (parent) {
|
|
2325
|
+
if (dirtyInstances.has(parent)) return true;
|
|
2326
|
+
parent = parent.parent;
|
|
2327
|
+
}
|
|
2328
|
+
return false;
|
|
2329
|
+
}
|
|
2309
2330
|
function rerender(id, newRender) {
|
|
2310
2331
|
const record = map.get(id);
|
|
2311
2332
|
if (!record) return;
|
|
@@ -2337,42 +2358,69 @@ function reload(id, newComp) {
|
|
|
2337
2358
|
const isVapor = record.initialDef.__vapor;
|
|
2338
2359
|
updateComponentDef(record.initialDef, newComp);
|
|
2339
2360
|
const instances = [...record.instances];
|
|
2340
|
-
if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
|
|
2361
|
+
if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
|
|
2341
2362
|
for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
const
|
|
2345
|
-
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2346
|
-
if (!dirtyInstances) {
|
|
2347
|
-
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
2348
|
-
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
2349
|
-
}
|
|
2350
|
-
dirtyInstances.add(instance);
|
|
2351
|
-
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
2352
|
-
instance.appContext.propsCache.delete(instance.type);
|
|
2353
|
-
instance.appContext.emitsCache.delete(instance.type);
|
|
2354
|
-
instance.appContext.optionsCache.delete(instance.type);
|
|
2355
|
-
if (instance.ceReload) {
|
|
2356
|
-
dirtyInstances.add(instance);
|
|
2357
|
-
instance.ceReload(newComp.styles);
|
|
2358
|
-
dirtyInstances.delete(instance);
|
|
2359
|
-
} else if (instance.parent) queueJob(() => {
|
|
2360
|
-
isHmrUpdating = true;
|
|
2363
|
+
const dirtyInstances = new Set(instances);
|
|
2364
|
+
const rerenderedParents = /* @__PURE__ */ new Set();
|
|
2365
|
+
for (const instance of instances) {
|
|
2361
2366
|
const parent = instance.parent;
|
|
2362
|
-
if (parent
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2367
|
+
if (parent) {
|
|
2368
|
+
if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
|
|
2369
|
+
rerenderedParents.add(parent);
|
|
2370
|
+
parent.hmrRerender();
|
|
2371
|
+
}
|
|
2372
|
+
} else instance.hmrReload(newComp);
|
|
2373
|
+
}
|
|
2374
|
+
} else {
|
|
2375
|
+
const parentUpdates = /* @__PURE__ */ new Map();
|
|
2376
|
+
const dirtyInstanceSet = new Set(instances);
|
|
2377
|
+
for (const instance of instances) {
|
|
2378
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
2379
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2380
|
+
if (!dirtyInstances) {
|
|
2381
|
+
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
2382
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
2366
2383
|
}
|
|
2367
|
-
|
|
2368
|
-
|
|
2384
|
+
dirtyInstances.add(instance);
|
|
2385
|
+
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
2386
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
2387
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
2388
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
2389
|
+
if (instance.ceReload) {
|
|
2390
|
+
dirtyInstances.add(instance);
|
|
2391
|
+
instance.ceReload(newComp.styles);
|
|
2392
|
+
dirtyInstances.delete(instance);
|
|
2393
|
+
} else if (instance.parent) {
|
|
2394
|
+
const parent = instance.parent;
|
|
2395
|
+
if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
|
|
2396
|
+
let updates = parentUpdates.get(parent);
|
|
2397
|
+
if (!updates) parentUpdates.set(parent, updates = []);
|
|
2398
|
+
updates.push([instance, dirtyInstances]);
|
|
2399
|
+
}
|
|
2400
|
+
} else if (instance.appContext.reload) instance.appContext.reload();
|
|
2401
|
+
else if (typeof window !== "undefined") window.location.reload();
|
|
2402
|
+
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
2403
|
+
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
2404
|
+
}
|
|
2405
|
+
parentUpdates.forEach((updates, parent) => {
|
|
2406
|
+
queueJob(() => {
|
|
2407
|
+
isHmrUpdating = true;
|
|
2408
|
+
if (parent.vapor) parent.hmrRerender();
|
|
2409
|
+
else {
|
|
2410
|
+
const i = parent;
|
|
2411
|
+
if (!(i.effect.flags & 1024)) {
|
|
2412
|
+
i.renderCache = [];
|
|
2413
|
+
i.effect.run();
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
nextTick(() => {
|
|
2417
|
+
isHmrUpdating = false;
|
|
2418
|
+
});
|
|
2419
|
+
updates.forEach(([instance, dirtyInstances]) => {
|
|
2420
|
+
dirtyInstances.delete(instance);
|
|
2421
|
+
});
|
|
2369
2422
|
});
|
|
2370
|
-
dirtyInstances.delete(instance);
|
|
2371
2423
|
});
|
|
2372
|
-
else if (instance.appContext.reload) instance.appContext.reload();
|
|
2373
|
-
else if (typeof window !== "undefined") window.location.reload();
|
|
2374
|
-
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
2375
|
-
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
2376
2424
|
}
|
|
2377
2425
|
queuePostFlushCb(() => {
|
|
2378
2426
|
hmrDirtyComponents.clear();
|
|
@@ -2495,10 +2543,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
|
2495
2543
|
const renderFnWithContext = (...args) => {
|
|
2496
2544
|
if (renderFnWithContext._d) setBlockTracking(-1);
|
|
2497
2545
|
const prevInstance = setCurrentRenderingInstance$1(ctx);
|
|
2546
|
+
const prevStackSize = blockStack.length;
|
|
2498
2547
|
let res;
|
|
2499
2548
|
try {
|
|
2500
2549
|
res = fn(...args);
|
|
2501
2550
|
} finally {
|
|
2551
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
2502
2552
|
setCurrentRenderingInstance$1(prevInstance);
|
|
2503
2553
|
if (renderFnWithContext._d) setBlockTracking(1);
|
|
2504
2554
|
}
|
|
@@ -2644,7 +2694,7 @@ function instanceWatch(source, value, options) {
|
|
|
2644
2694
|
}
|
|
2645
2695
|
const prev = setCurrentInstance(this);
|
|
2646
2696
|
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
2647
|
-
|
|
2697
|
+
restoreCurrentInstance(prev);
|
|
2648
2698
|
return res;
|
|
2649
2699
|
}
|
|
2650
2700
|
function createPathGetter(ctx, path) {
|
|
@@ -2663,12 +2713,11 @@ const isTeleport = (type) => type.__isTeleport;
|
|
|
2663
2713
|
//#region packages/runtime-core/src/components/BaseTransition.ts
|
|
2664
2714
|
const leaveCbKey = Symbol("_leaveCb");
|
|
2665
2715
|
function setTransitionHooks(vnode, hooks) {
|
|
2666
|
-
if (vnode.shapeFlag & 6 && vnode.component)
|
|
2667
|
-
else {
|
|
2716
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
2668
2717
|
vnode.transition = hooks;
|
|
2669
|
-
setTransitionHooks(vnode.component
|
|
2670
|
-
|
|
2671
|
-
else if (vnode.shapeFlag & 128) {
|
|
2718
|
+
if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
|
|
2719
|
+
else setTransitionHooks(vnode.component.subTree, hooks);
|
|
2720
|
+
} else if (vnode.shapeFlag & 128) {
|
|
2672
2721
|
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
2673
2722
|
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
2674
2723
|
} else vnode.transition = hooks;
|
|
@@ -2841,7 +2890,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2841
2890
|
try {
|
|
2842
2891
|
return callWithAsyncErrorHandling(hook, target, type, args);
|
|
2843
2892
|
} finally {
|
|
2844
|
-
|
|
2893
|
+
restoreCurrentInstance(prev);
|
|
2845
2894
|
setActiveSub(prevSub);
|
|
2846
2895
|
}
|
|
2847
2896
|
});
|
|
@@ -3520,7 +3569,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
3520
3569
|
*/
|
|
3521
3570
|
function isEmitListener(options, key) {
|
|
3522
3571
|
if (!options || !isOn(key)) return false;
|
|
3523
|
-
key = key.slice(2)
|
|
3572
|
+
key = key.slice(2);
|
|
3573
|
+
key = key === "Once" ? key : key.replace(/Once$/, "");
|
|
3524
3574
|
return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
|
|
3525
3575
|
}
|
|
3526
3576
|
//#endregion
|
|
@@ -3849,7 +3899,7 @@ function baseResolveDefault(factory, instance, key) {
|
|
|
3849
3899
|
const prev = setCurrentInstance(instance);
|
|
3850
3900
|
const props = /* @__PURE__ */ toRaw(instance.props);
|
|
3851
3901
|
value = factory.call(null, props);
|
|
3852
|
-
|
|
3902
|
+
restoreCurrentInstance(prev);
|
|
3853
3903
|
return value;
|
|
3854
3904
|
}
|
|
3855
3905
|
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -3995,7 +4045,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
3995
4045
|
const receivedType = toRawType(value);
|
|
3996
4046
|
const expectedValue = styleValue(value, expectedType);
|
|
3997
4047
|
const receivedValue = styleValue(value, receivedType);
|
|
3998
|
-
if (expectedTypes.length === 1 && isExplicable(expectedType) &&
|
|
4048
|
+
if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
|
|
3999
4049
|
message += `, got ${receivedType} `;
|
|
4000
4050
|
if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
|
|
4001
4051
|
return message;
|
|
@@ -4004,7 +4054,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
4004
4054
|
* dev only
|
|
4005
4055
|
*/
|
|
4006
4056
|
function styleValue(value, type) {
|
|
4007
|
-
if (
|
|
4057
|
+
if (isSymbol(value)) return value.toString();
|
|
4058
|
+
else if (type === "String") return `"${value}"`;
|
|
4008
4059
|
else if (type === "Number") return `${Number(value)}`;
|
|
4009
4060
|
else return `${value}`;
|
|
4010
4061
|
}
|
|
@@ -4021,8 +4072,11 @@ function isExplicable(type) {
|
|
|
4021
4072
|
/**
|
|
4022
4073
|
* dev only
|
|
4023
4074
|
*/
|
|
4024
|
-
function
|
|
4025
|
-
return args.
|
|
4075
|
+
function isCoercible(...args) {
|
|
4076
|
+
return args.every((elem) => {
|
|
4077
|
+
const value = elem.toLowerCase();
|
|
4078
|
+
return value !== "boolean" && value !== "symbol";
|
|
4079
|
+
});
|
|
4026
4080
|
}
|
|
4027
4081
|
//#endregion
|
|
4028
4082
|
//#region packages/runtime-core/src/componentSlots.ts
|
|
@@ -4316,7 +4370,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4316
4370
|
if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
4317
4371
|
if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
4318
4372
|
parentComponent && toggleRecurse(parentComponent, true);
|
|
4319
|
-
if (isHmrUpdating) {
|
|
4373
|
+
if (isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
|
|
4320
4374
|
patchFlag = 0;
|
|
4321
4375
|
optimized = false;
|
|
4322
4376
|
dynamicChildren = null;
|
|
@@ -4394,21 +4448,37 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4394
4448
|
};
|
|
4395
4449
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
4396
4450
|
n2.slotScopeIds = slotScopeIds;
|
|
4397
|
-
if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
|
|
4451
|
+
if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
|
|
4398
4452
|
else {
|
|
4453
|
+
const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
|
|
4399
4454
|
getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
|
|
4400
4455
|
if (n2.dirs) {
|
|
4401
4456
|
invokeDirectiveHook(n2, null, parentComponent, "created");
|
|
4402
4457
|
invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
|
|
4403
4458
|
}
|
|
4459
|
+
}, () => {
|
|
4460
|
+
if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
|
|
4404
4461
|
});
|
|
4405
4462
|
if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
|
|
4463
|
+
const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
|
|
4464
|
+
if (vnodeMountedHook) {
|
|
4465
|
+
const scopedVNode = n2;
|
|
4466
|
+
queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
|
|
4467
|
+
}
|
|
4406
4468
|
}
|
|
4407
4469
|
else {
|
|
4408
|
-
|
|
4470
|
+
const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
|
|
4471
|
+
getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
|
|
4409
4472
|
if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
4473
|
+
}, () => {
|
|
4474
|
+
const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
|
|
4475
|
+
if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
|
|
4410
4476
|
});
|
|
4411
|
-
|
|
4477
|
+
const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
|
|
4478
|
+
if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
|
|
4479
|
+
n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
4480
|
+
vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
|
|
4481
|
+
}, void 0, parentSuspense);
|
|
4412
4482
|
}
|
|
4413
4483
|
else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
|
|
4414
4484
|
else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
|
|
@@ -4721,7 +4791,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4721
4791
|
const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
|
|
4722
4792
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
4723
4793
|
if (isVaporComponent(type) || type === VaporSlot) {
|
|
4724
|
-
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
|
|
4794
|
+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
|
|
4725
4795
|
return;
|
|
4726
4796
|
}
|
|
4727
4797
|
if (shapeFlag & 6) {
|
|
@@ -4754,8 +4824,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4754
4824
|
else hostInsert(el, container, anchor);
|
|
4755
4825
|
};
|
|
4756
4826
|
const performLeave = () => {
|
|
4827
|
+
const wasLeaving = el._isLeaving || !!el[leaveCbKey];
|
|
4757
4828
|
if (el._isLeaving) el[leaveCbKey](true);
|
|
4758
|
-
|
|
4829
|
+
if (transition.persisted && !wasLeaving) remove();
|
|
4830
|
+
else leave(el, () => {
|
|
4759
4831
|
remove();
|
|
4760
4832
|
afterLeave && afterLeave();
|
|
4761
4833
|
});
|
|
@@ -4775,7 +4847,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4775
4847
|
}
|
|
4776
4848
|
if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
|
|
4777
4849
|
if (shapeFlag & 256) {
|
|
4778
|
-
if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
|
|
4850
|
+
if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
|
|
4779
4851
|
else parentComponent.ctx.deactivate(vnode);
|
|
4780
4852
|
return;
|
|
4781
4853
|
}
|
|
@@ -4785,8 +4857,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4785
4857
|
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4786
4858
|
if (shapeFlag & 6) if (isVaporComponent(type)) {
|
|
4787
4859
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
|
4788
|
-
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
4789
|
-
if (
|
|
4860
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
|
|
4861
|
+
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
|
|
4862
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
4863
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4864
|
+
}, void 0, parentSuspense);
|
|
4790
4865
|
return;
|
|
4791
4866
|
} else unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
4792
4867
|
else {
|
|
@@ -4799,7 +4874,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4799
4874
|
else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
4800
4875
|
else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
|
|
4801
4876
|
if (type === VaporSlot) {
|
|
4802
|
-
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
4877
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
|
|
4803
4878
|
return;
|
|
4804
4879
|
}
|
|
4805
4880
|
if (doRemove) remove(vnode);
|
|
@@ -4847,7 +4922,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4847
4922
|
if (effect) {
|
|
4848
4923
|
effect.stop();
|
|
4849
4924
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
4850
|
-
}
|
|
4925
|
+
} else if (doRemove && subTree && instance.vnode.el) remove(subTree);
|
|
4851
4926
|
if (um) queuePostRenderEffect(um, void 0, parentSuspense);
|
|
4852
4927
|
queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
|
|
4853
4928
|
devtoolsComponentRemoved(instance);
|
|
@@ -4973,6 +5048,10 @@ function invalidateMount(hooks) {
|
|
|
4973
5048
|
if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
|
|
4974
5049
|
}
|
|
4975
5050
|
function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
|
|
5051
|
+
if (force && transition.persisted && !el[leaveCbKey]) {
|
|
5052
|
+
insert();
|
|
5053
|
+
return;
|
|
5054
|
+
}
|
|
4976
5055
|
if (force || needTransition(parentSuspense, transition)) {
|
|
4977
5056
|
transition.beforeEnter(el);
|
|
4978
5057
|
insert();
|
|
@@ -5047,6 +5126,11 @@ const Comment = Symbol.for("v-cmt");
|
|
|
5047
5126
|
const Static = Symbol.for("v-stc");
|
|
5048
5127
|
const VaporSlot = Symbol.for("v-vps");
|
|
5049
5128
|
const blockStack = [];
|
|
5129
|
+
let currentBlock = null;
|
|
5130
|
+
function closeBlock() {
|
|
5131
|
+
blockStack.pop();
|
|
5132
|
+
currentBlock = blockStack[blockStack.length - 1] || null;
|
|
5133
|
+
}
|
|
5050
5134
|
let isBlockTreeEnabled = 1;
|
|
5051
5135
|
/**
|
|
5052
5136
|
* Block tracking sometimes needs to be disabled, for example during the
|
|
@@ -5066,6 +5150,7 @@ let isBlockTreeEnabled = 1;
|
|
|
5066
5150
|
*/
|
|
5067
5151
|
function setBlockTracking(value, inVOnce = false) {
|
|
5068
5152
|
isBlockTreeEnabled += value;
|
|
5153
|
+
if (value < 0 && currentBlock && inVOnce) currentBlock.hasOnce = true;
|
|
5069
5154
|
}
|
|
5070
5155
|
function isVNode$2(value) {
|
|
5071
5156
|
return value ? value.__v_isVNode === true : false;
|
|
@@ -5129,6 +5214,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
5129
5214
|
if (shapeFlag & 128) type.normalize(vnode);
|
|
5130
5215
|
} else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;
|
|
5131
5216
|
if (vnode.key !== vnode.key) warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
5217
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) currentBlock.push(vnode);
|
|
5132
5218
|
return vnode;
|
|
5133
5219
|
}
|
|
5134
5220
|
const createVNode = createVNodeWithArgsTransform;
|
|
@@ -5140,6 +5226,8 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5140
5226
|
if (isVNode$2(type)) {
|
|
5141
5227
|
const cloned = cloneVNode(type, props, true);
|
|
5142
5228
|
if (children) normalizeChildren(cloned, children);
|
|
5229
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) if (cloned.shapeFlag & 6) currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
5230
|
+
else currentBlock.push(cloned);
|
|
5143
5231
|
cloned.patchFlag = -2;
|
|
5144
5232
|
return cloned;
|
|
5145
5233
|
}
|
|
@@ -5196,11 +5284,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
5196
5284
|
el: vnode.el,
|
|
5197
5285
|
anchor: vnode.anchor,
|
|
5198
5286
|
ctx: vnode.ctx,
|
|
5199
|
-
ce: vnode.ce
|
|
5287
|
+
ce: vnode.ce,
|
|
5288
|
+
vi: vnode.vi,
|
|
5289
|
+
vs: cloneVaporSlotMeta(vnode),
|
|
5290
|
+
vb: vnode.vb
|
|
5200
5291
|
};
|
|
5201
5292
|
if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
|
|
5202
5293
|
return cloned;
|
|
5203
5294
|
}
|
|
5295
|
+
function cloneVaporSlotMeta(vnode) {
|
|
5296
|
+
const vaporSlot = vnode.vs;
|
|
5297
|
+
if (!vaporSlot) return vaporSlot;
|
|
5298
|
+
const cloned = {
|
|
5299
|
+
slot: vaporSlot.slot,
|
|
5300
|
+
fallback: vaporSlot.fallback,
|
|
5301
|
+
outletFallback: vaporSlot.outletFallback
|
|
5302
|
+
};
|
|
5303
|
+
if (vnode.el) {
|
|
5304
|
+
cloned.state = vaporSlot.state;
|
|
5305
|
+
cloned.ref = vaporSlot.ref;
|
|
5306
|
+
cloned.scope = vaporSlot.scope;
|
|
5307
|
+
}
|
|
5308
|
+
return cloned;
|
|
5309
|
+
}
|
|
5204
5310
|
/**
|
|
5205
5311
|
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
5206
5312
|
* https://github.com/vitejs/vite/issues/2022
|
|
@@ -5249,6 +5355,10 @@ function normalizeChildren(vnode, children) {
|
|
|
5249
5355
|
}
|
|
5250
5356
|
}
|
|
5251
5357
|
else if (isFunction(children)) {
|
|
5358
|
+
if (shapeFlag & 65) {
|
|
5359
|
+
normalizeChildren(vnode, { default: children });
|
|
5360
|
+
return;
|
|
5361
|
+
}
|
|
5252
5362
|
children = {
|
|
5253
5363
|
default: children,
|
|
5254
5364
|
_ctx: currentRenderingInstance
|
|
@@ -5320,6 +5430,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
|
|
|
5320
5430
|
simpleSetCurrentInstance(instance);
|
|
5321
5431
|
}
|
|
5322
5432
|
};
|
|
5433
|
+
/**
|
|
5434
|
+
* Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
|
|
5435
|
+
* `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
|
|
5436
|
+
* verbatim instead of re-triggering the `instance.scope` default.
|
|
5437
|
+
* @internal
|
|
5438
|
+
*/
|
|
5439
|
+
const restoreCurrentInstance = (prev) => {
|
|
5440
|
+
setCurrentScope(prev[1]);
|
|
5441
|
+
simpleSetCurrentInstance(prev[0]);
|
|
5442
|
+
};
|
|
5323
5443
|
//#endregion
|
|
5324
5444
|
//#region packages/runtime-core/src/component.ts
|
|
5325
5445
|
const emptyAppContext = /* @__PURE__ */ createAppContext();
|
|
@@ -5442,7 +5562,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
5442
5562
|
const setupResult = callWithErrorHandling(setup, instance, 0, [/* @__PURE__ */ shallowReadonly(instance.props), setupContext]);
|
|
5443
5563
|
const isAsyncSetup = isPromise(setupResult);
|
|
5444
5564
|
setActiveSub(prevSub);
|
|
5445
|
-
|
|
5565
|
+
restoreCurrentInstance(prev);
|
|
5446
5566
|
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
|
|
5447
5567
|
if (isAsyncSetup) {
|
|
5448
5568
|
const unsetCurrentInstance = () => {
|
|
@@ -5483,7 +5603,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
5483
5603
|
applyOptions(instance);
|
|
5484
5604
|
} finally {
|
|
5485
5605
|
setActiveSub(prevSub);
|
|
5486
|
-
|
|
5606
|
+
restoreCurrentInstance(prevInstance);
|
|
5487
5607
|
}
|
|
5488
5608
|
}
|
|
5489
5609
|
if (!Component.render && instance.render === NOOP && !isSSR) if (Component.template)
|
|
@@ -5593,7 +5713,7 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
5593
5713
|
};
|
|
5594
5714
|
//#endregion
|
|
5595
5715
|
//#region packages/runtime-core/src/index.ts
|
|
5596
|
-
const version = "3.6.0-
|
|
5716
|
+
const version = "3.6.0-rc.2";
|
|
5597
5717
|
const warn = warn$1;
|
|
5598
5718
|
/**
|
|
5599
5719
|
* SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
|
|
@@ -5740,7 +5860,10 @@ function patchStyle(el, prev, next) {
|
|
|
5740
5860
|
}
|
|
5741
5861
|
for (const key in next) {
|
|
5742
5862
|
if (key === "display") hasControlledDisplay = true;
|
|
5743
|
-
|
|
5863
|
+
const value = next[key];
|
|
5864
|
+
if (value != null) {
|
|
5865
|
+
if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
|
|
5866
|
+
} else setStyle(style, key, "");
|
|
5744
5867
|
}
|
|
5745
5868
|
} else if (isCssString) {
|
|
5746
5869
|
if (prev !== next) {
|
|
@@ -5788,6 +5911,14 @@ function autoPrefix(style, rawName) {
|
|
|
5788
5911
|
}
|
|
5789
5912
|
return rawName;
|
|
5790
5913
|
}
|
|
5914
|
+
/**
|
|
5915
|
+
* Browsers update textarea width/height directly during native resize.
|
|
5916
|
+
* Only special-case this common textarea path for now; other resize scenarios
|
|
5917
|
+
* still follow normal vnode style patching.
|
|
5918
|
+
*/
|
|
5919
|
+
function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
|
|
5920
|
+
return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
|
|
5921
|
+
}
|
|
5791
5922
|
//#endregion
|
|
5792
5923
|
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
5793
5924
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
@@ -5846,7 +5977,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
5846
5977
|
const existingInvoker = invokers[rawName];
|
|
5847
5978
|
if (nextValue && existingInvoker) existingInvoker.value = sanitizeEventValue(nextValue, rawName);
|
|
5848
5979
|
else {
|
|
5849
|
-
const [name, options] =
|
|
5980
|
+
const [name, options] = parseEventName(rawName);
|
|
5850
5981
|
if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(sanitizeEventValue(nextValue, rawName), instance), options);
|
|
5851
5982
|
else if (existingInvoker) {
|
|
5852
5983
|
removeEventListener(el, name, existingInvoker, options);
|
|
@@ -5854,16 +5985,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
5854
5985
|
}
|
|
5855
5986
|
}
|
|
5856
5987
|
}
|
|
5857
|
-
const optionsModifierRE = /(
|
|
5858
|
-
|
|
5988
|
+
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
5989
|
+
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
5990
|
+
function parseEventName(name) {
|
|
5859
5991
|
let options;
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
options[m[0].toLowerCase()] = true;
|
|
5866
|
-
}
|
|
5992
|
+
let m;
|
|
5993
|
+
while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
|
|
5994
|
+
if (!options) options = {};
|
|
5995
|
+
name = name.slice(0, name.length - m[1].length);
|
|
5996
|
+
options[m[1].toLowerCase()] = true;
|
|
5867
5997
|
}
|
|
5868
5998
|
return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
|
|
5869
5999
|
}
|
|
@@ -5874,7 +6004,21 @@ function createInvoker(initialValue, instance) {
|
|
|
5874
6004
|
const invoker = (e) => {
|
|
5875
6005
|
if (!e._vts) e._vts = Date.now();
|
|
5876
6006
|
else if (e._vts <= invoker.attached) return;
|
|
5877
|
-
|
|
6007
|
+
const value = invoker.value;
|
|
6008
|
+
if (isArray(value)) {
|
|
6009
|
+
const originalStop = e.stopImmediatePropagation;
|
|
6010
|
+
e.stopImmediatePropagation = () => {
|
|
6011
|
+
originalStop.call(e);
|
|
6012
|
+
e._stopped = true;
|
|
6013
|
+
};
|
|
6014
|
+
const handlers = value.slice();
|
|
6015
|
+
const args = [e];
|
|
6016
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
6017
|
+
if (e._stopped) break;
|
|
6018
|
+
const handler = handlers[i];
|
|
6019
|
+
if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
|
|
6020
|
+
}
|
|
6021
|
+
} else callWithAsyncErrorHandling(value, instance, 5, [e]);
|
|
5878
6022
|
};
|
|
5879
6023
|
invoker.value = initialValue;
|
|
5880
6024
|
invoker.attached = getNow();
|
|
@@ -5885,16 +6029,6 @@ function sanitizeEventValue(value, propName) {
|
|
|
5885
6029
|
warn(`Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof value}.`);
|
|
5886
6030
|
return NOOP;
|
|
5887
6031
|
}
|
|
5888
|
-
function patchStopImmediatePropagation(e, value) {
|
|
5889
|
-
if (isArray(value)) {
|
|
5890
|
-
const originalStop = e.stopImmediatePropagation;
|
|
5891
|
-
e.stopImmediatePropagation = () => {
|
|
5892
|
-
originalStop.call(e);
|
|
5893
|
-
e._stopped = true;
|
|
5894
|
-
};
|
|
5895
|
-
return value.map((fn) => (e) => !e._stopped && fn && fn(e));
|
|
5896
|
-
} else return value;
|
|
5897
|
-
}
|
|
5898
6032
|
//#endregion
|
|
5899
6033
|
//#region packages/runtime-dom/src/patchProp.ts
|
|
5900
6034
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
@@ -6072,7 +6206,8 @@ const vModelSelect = {
|
|
|
6072
6206
|
mounted(el, { value }) {
|
|
6073
6207
|
vModelSetSelected(el, value);
|
|
6074
6208
|
},
|
|
6075
|
-
beforeUpdate(el,
|
|
6209
|
+
beforeUpdate(el, { value }, vnode) {
|
|
6210
|
+
el._modelValue = value;
|
|
6076
6211
|
el[assignKey] = getModelAssigner(vnode);
|
|
6077
6212
|
},
|
|
6078
6213
|
updated(el, { value }) {
|
|
@@ -6083,10 +6218,10 @@ const vModelSelect = {
|
|
|
6083
6218
|
* @internal
|
|
6084
6219
|
*/
|
|
6085
6220
|
const vModelSelectInit = (el, value, number, set) => {
|
|
6086
|
-
|
|
6221
|
+
el._modelValue = value;
|
|
6087
6222
|
addEventListener(el, "change", () => {
|
|
6088
6223
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
|
|
6089
|
-
(set || el[assignKey])(el.multiple ?
|
|
6224
|
+
(set || el[assignKey])(el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]);
|
|
6090
6225
|
el._assigning = true;
|
|
6091
6226
|
nextTick(() => {
|
|
6092
6227
|
el._assigning = false;
|
|
@@ -6097,6 +6232,7 @@ const vModelSelectInit = (el, value, number, set) => {
|
|
|
6097
6232
|
* @internal
|
|
6098
6233
|
*/
|
|
6099
6234
|
const vModelSetSelected = (el, value) => {
|
|
6235
|
+
el._modelValue = value;
|
|
6100
6236
|
if (el._assigning) return;
|
|
6101
6237
|
const isMultiple = el.multiple;
|
|
6102
6238
|
const isArrayValue = isArray(value);
|
|
@@ -6314,6 +6450,11 @@ function ssrResetCssVars(raw) {
|
|
|
6314
6450
|
//#endregion
|
|
6315
6451
|
//#region packages/server-renderer/src/helpers/ssrRenderComponent.ts
|
|
6316
6452
|
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
|
|
6453
|
+
if (isString(comp)) {
|
|
6454
|
+
const { getBuffer, push } = createBuffer();
|
|
6455
|
+
renderVNode(push, createVNode(comp, props, children), parentComponent, slotScopeId);
|
|
6456
|
+
return getBuffer();
|
|
6457
|
+
}
|
|
6317
6458
|
return renderComponentVNode(createVNode(comp, props, children), parentComponent, slotScopeId);
|
|
6318
6459
|
}
|
|
6319
6460
|
//#endregion
|
|
@@ -6387,6 +6528,7 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
|
|
|
6387
6528
|
teleportContent = getBuffer();
|
|
6388
6529
|
}
|
|
6389
6530
|
targetBuffer.splice(bufferIndex, 0, teleportContent);
|
|
6531
|
+
if (isPromise(teleportContent) || isArray(teleportContent) && teleportContent.hasAsync) targetBuffer.hasAsync = true;
|
|
6390
6532
|
parentPush("<!--teleport end-->");
|
|
6391
6533
|
}
|
|
6392
6534
|
//#endregion
|
|
@@ -6405,8 +6547,8 @@ function ssrRenderList(source, renderItem) {
|
|
|
6405
6547
|
}
|
|
6406
6548
|
for (let i = 0; i < source; i++) renderItem(i + 1, i);
|
|
6407
6549
|
} else if (isObject(source)) if (source[Symbol.iterator]) {
|
|
6408
|
-
|
|
6409
|
-
for (
|
|
6550
|
+
let i = 0;
|
|
6551
|
+
for (const item of source) renderItem(item, i++);
|
|
6410
6552
|
} else {
|
|
6411
6553
|
const keys = Object.keys(source);
|
|
6412
6554
|
for (let i = 0, l = keys.length; i < l; i++) {
|
|
@@ -6417,7 +6559,7 @@ function ssrRenderList(source, renderItem) {
|
|
|
6417
6559
|
}
|
|
6418
6560
|
//#endregion
|
|
6419
6561
|
//#region packages/server-renderer/src/helpers/ssrRenderSuspense.ts
|
|
6420
|
-
|
|
6562
|
+
function ssrRenderSuspense(push, { default: renderContent }) {
|
|
6421
6563
|
if (renderContent) renderContent();
|
|
6422
6564
|
else push(`<!---->`);
|
|
6423
6565
|
}
|
|
@@ -6515,7 +6657,11 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
|
|
6515
6657
|
if (hasAsyncSetup) prefetches = instance.sp;
|
|
6516
6658
|
if (prefetches) return Promise.all(prefetches.map((prefetch) => prefetch.call(instance.proxy)));
|
|
6517
6659
|
}).catch(NOOP).then(() => renderComponentSubTree(instance, slotScopeId));
|
|
6518
|
-
else
|
|
6660
|
+
else try {
|
|
6661
|
+
return renderComponentSubTree(instance, slotScopeId);
|
|
6662
|
+
} catch (err) {
|
|
6663
|
+
return Promise.reject(err);
|
|
6664
|
+
}
|
|
6519
6665
|
}
|
|
6520
6666
|
function renderComponentSubTree(instance, slotScopeId) {
|
|
6521
6667
|
pushWarningContext(instance.vnode);
|
|
@@ -6555,6 +6701,8 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
6555
6701
|
const prev = setCurrentRenderingInstance(instance);
|
|
6556
6702
|
try {
|
|
6557
6703
|
ssrRender(instance.proxy, push, instance, attrs, instance.props, instance.setupState, instance.data, instance.ctx);
|
|
6704
|
+
} catch (err) {
|
|
6705
|
+
handleError(err, instance, 1);
|
|
6558
6706
|
} finally {
|
|
6559
6707
|
setCurrentRenderingInstance(prev);
|
|
6560
6708
|
}
|
|
@@ -6601,15 +6749,25 @@ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
6601
6749
|
let { props, children, shapeFlag, scopeId } = vnode;
|
|
6602
6750
|
let openTag = `<${tag}`;
|
|
6603
6751
|
if (props) openTag += ssrRenderAttrs(props, tag);
|
|
6604
|
-
|
|
6752
|
+
const renderedScopeIds = [];
|
|
6753
|
+
const appendScopeId = (id) => {
|
|
6754
|
+
if (id && (!props || !hasOwn(props, id)) && !renderedScopeIds.includes(id)) {
|
|
6755
|
+
openTag += ` ${id}`;
|
|
6756
|
+
renderedScopeIds.push(id);
|
|
6757
|
+
}
|
|
6758
|
+
};
|
|
6759
|
+
if (scopeId) appendScopeId(scopeId);
|
|
6605
6760
|
let curParent = parentComponent;
|
|
6606
6761
|
let curVnode = vnode;
|
|
6607
6762
|
while (curParent && curVnode === curParent.subTree) {
|
|
6608
6763
|
curVnode = curParent.vnode;
|
|
6609
|
-
if (curVnode.scopeId)
|
|
6764
|
+
if (curVnode.scopeId) appendScopeId(curVnode.scopeId);
|
|
6610
6765
|
curParent = curParent.parent;
|
|
6611
6766
|
}
|
|
6612
|
-
if (slotScopeId)
|
|
6767
|
+
if (slotScopeId) {
|
|
6768
|
+
const slotScopeIdList = slotScopeId.trim().split(" ");
|
|
6769
|
+
for (let i = 0; i < slotScopeIdList.length; i++) appendScopeId(slotScopeIdList[i]);
|
|
6770
|
+
}
|
|
6613
6771
|
push(openTag + `>`);
|
|
6614
6772
|
if (!isVoidTag(tag)) {
|
|
6615
6773
|
let hasChildrenOverride = false;
|
|
@@ -6712,7 +6870,7 @@ async function renderToString(input, context = {}) {
|
|
|
6712
6870
|
async function resolveTeleports(context) {
|
|
6713
6871
|
if (context.__teleportBuffers) {
|
|
6714
6872
|
context.teleports = context.teleports || {};
|
|
6715
|
-
for (const key in context.__teleportBuffers) context.teleports[key] = await unrollBuffer$1(
|
|
6873
|
+
for (const key in context.__teleportBuffers) context.teleports[key] = await unrollBuffer$1(context.__teleportBuffers[key]);
|
|
6716
6874
|
}
|
|
6717
6875
|
}
|
|
6718
6876
|
//#endregion
|