@vue/runtime-core 3.5.17 → 3.6.0-alpha.1
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/runtime-core.cjs.js +867 -582
- package/dist/runtime-core.cjs.prod.js +696 -435
- package/dist/runtime-core.d.ts +121 -55
- package/dist/runtime-core.esm-bundler.js +885 -586
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-core v3.
|
|
2
|
+
* @vue/runtime-core v3.6.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
var reactivity = require('@vue/reactivity');
|
|
11
11
|
var shared = require('@vue/shared');
|
|
12
12
|
|
|
13
|
-
function pushWarningContext(
|
|
13
|
+
function pushWarningContext(ctx) {
|
|
14
14
|
}
|
|
15
15
|
function popWarningContext() {
|
|
16
16
|
}
|
|
@@ -107,11 +107,10 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
function handleError(err, instance, type, throwInDev = true) {
|
|
110
|
-
const contextVNode = instance ? instance.vnode : null;
|
|
111
110
|
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || shared.EMPTY_OBJ;
|
|
112
111
|
if (instance) {
|
|
113
112
|
let cur = instance.parent;
|
|
114
|
-
const exposedInstance = instance.proxy;
|
|
113
|
+
const exposedInstance = instance.proxy || instance;
|
|
115
114
|
const errorInfo = `https://vuejs.org/error-reference/#runtime-${type}`;
|
|
116
115
|
while (cur) {
|
|
117
116
|
const errorCapturedHooks = cur.ec;
|
|
@@ -125,19 +124,19 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
125
124
|
cur = cur.parent;
|
|
126
125
|
}
|
|
127
126
|
if (errorHandler) {
|
|
128
|
-
reactivity.
|
|
127
|
+
const prevSub = reactivity.setActiveSub();
|
|
129
128
|
callWithErrorHandling(errorHandler, null, 10, [
|
|
130
129
|
err,
|
|
131
130
|
exposedInstance,
|
|
132
131
|
errorInfo
|
|
133
132
|
]);
|
|
134
|
-
reactivity.
|
|
133
|
+
reactivity.setActiveSub(prevSub);
|
|
135
134
|
return;
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
|
-
logError(err, type,
|
|
137
|
+
logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
|
|
139
138
|
}
|
|
140
|
-
function logError(err, type,
|
|
139
|
+
function logError(err, type, instance, throwInDev = true, throwInProd = false) {
|
|
141
140
|
if (throwInProd) {
|
|
142
141
|
throw err;
|
|
143
142
|
} else {
|
|
@@ -145,25 +144,22 @@ function logError(err, type, contextVNode, throwInDev = true, throwInProd = fals
|
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
146
|
|
|
148
|
-
const
|
|
149
|
-
let
|
|
150
|
-
|
|
151
|
-
let
|
|
147
|
+
const jobs = [];
|
|
148
|
+
let postJobs = [];
|
|
149
|
+
let activePostJobs = null;
|
|
150
|
+
let currentFlushPromise = null;
|
|
151
|
+
let jobsLength = 0;
|
|
152
|
+
let flushIndex = 0;
|
|
152
153
|
let postFlushIndex = 0;
|
|
153
154
|
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
154
|
-
let currentFlushPromise = null;
|
|
155
155
|
function nextTick(fn) {
|
|
156
156
|
const p = currentFlushPromise || resolvedPromise;
|
|
157
157
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
158
158
|
}
|
|
159
|
-
function findInsertionIndex(
|
|
160
|
-
let start = flushIndex + 1;
|
|
161
|
-
let end = queue.length;
|
|
159
|
+
function findInsertionIndex(order, queue, start, end) {
|
|
162
160
|
while (start < end) {
|
|
163
161
|
const middle = start + end >>> 1;
|
|
164
|
-
|
|
165
|
-
const middleJobId = getId(middleJob);
|
|
166
|
-
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
162
|
+
if (queue[middle].order <= order) {
|
|
167
163
|
start = middle + 1;
|
|
168
164
|
} else {
|
|
169
165
|
end = middle;
|
|
@@ -171,112 +167,151 @@ function findInsertionIndex(id) {
|
|
|
171
167
|
}
|
|
172
168
|
return start;
|
|
173
169
|
}
|
|
174
|
-
function queueJob(job) {
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
170
|
+
function queueJob(job, id, isPre = false) {
|
|
171
|
+
if (queueJobWorker(
|
|
172
|
+
job,
|
|
173
|
+
id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
|
|
174
|
+
jobs,
|
|
175
|
+
jobsLength,
|
|
176
|
+
flushIndex
|
|
177
|
+
)) {
|
|
178
|
+
jobsLength++;
|
|
179
|
+
queueFlush();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function queueJobWorker(job, order, queue, length, flushIndex2) {
|
|
183
|
+
const flags = job.flags;
|
|
184
|
+
if (!(flags & 1)) {
|
|
185
|
+
job.flags = flags | 1;
|
|
186
|
+
job.order = order;
|
|
187
|
+
if (flushIndex2 === length || // fast path when the job id is larger than the tail
|
|
188
|
+
order >= queue[length - 1].order) {
|
|
189
|
+
queue[length] = job;
|
|
181
190
|
} else {
|
|
182
|
-
queue.splice(findInsertionIndex(
|
|
191
|
+
queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
|
|
183
192
|
}
|
|
184
|
-
|
|
185
|
-
queueFlush();
|
|
193
|
+
return true;
|
|
186
194
|
}
|
|
195
|
+
return false;
|
|
187
196
|
}
|
|
197
|
+
const doFlushJobs = () => {
|
|
198
|
+
try {
|
|
199
|
+
flushJobs();
|
|
200
|
+
} catch (e) {
|
|
201
|
+
currentFlushPromise = null;
|
|
202
|
+
throw e;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
188
205
|
function queueFlush() {
|
|
189
206
|
if (!currentFlushPromise) {
|
|
190
|
-
currentFlushPromise = resolvedPromise.then(
|
|
207
|
+
currentFlushPromise = resolvedPromise.then(doFlushJobs);
|
|
191
208
|
}
|
|
192
209
|
}
|
|
193
|
-
function queuePostFlushCb(
|
|
194
|
-
if (!shared.isArray(
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
} else
|
|
198
|
-
|
|
199
|
-
cb.flags |= 1;
|
|
210
|
+
function queuePostFlushCb(jobs2, id = Infinity) {
|
|
211
|
+
if (!shared.isArray(jobs2)) {
|
|
212
|
+
if (activePostJobs && id === -1) {
|
|
213
|
+
activePostJobs.splice(postFlushIndex, 0, jobs2);
|
|
214
|
+
} else {
|
|
215
|
+
queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
|
|
200
216
|
}
|
|
201
217
|
} else {
|
|
202
|
-
|
|
218
|
+
for (const job of jobs2) {
|
|
219
|
+
queueJobWorker(job, id, postJobs, postJobs.length, 0);
|
|
220
|
+
}
|
|
203
221
|
}
|
|
204
222
|
queueFlush();
|
|
205
223
|
}
|
|
206
|
-
function flushPreFlushCbs(instance, seen
|
|
207
|
-
for (; i <
|
|
208
|
-
const cb =
|
|
209
|
-
if (cb
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
224
|
+
function flushPreFlushCbs(instance, seen) {
|
|
225
|
+
for (let i = flushIndex; i < jobsLength; i++) {
|
|
226
|
+
const cb = jobs[i];
|
|
227
|
+
if (cb.order & 1 || cb.order === Infinity) {
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if (instance && cb.order !== instance.uid * 2) {
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
jobs.splice(i, 1);
|
|
234
|
+
i--;
|
|
235
|
+
jobsLength--;
|
|
236
|
+
if (cb.flags & 2) {
|
|
237
|
+
cb.flags &= -2;
|
|
238
|
+
}
|
|
239
|
+
cb();
|
|
240
|
+
if (!(cb.flags & 2)) {
|
|
241
|
+
cb.flags &= -2;
|
|
222
242
|
}
|
|
223
243
|
}
|
|
224
244
|
}
|
|
225
245
|
function flushPostFlushCbs(seen) {
|
|
226
|
-
if (
|
|
227
|
-
|
|
228
|
-
(
|
|
229
|
-
|
|
230
|
-
pendingPostFlushCbs.length = 0;
|
|
231
|
-
if (activePostFlushCbs) {
|
|
232
|
-
activePostFlushCbs.push(...deduped);
|
|
246
|
+
if (postJobs.length) {
|
|
247
|
+
if (activePostJobs) {
|
|
248
|
+
activePostJobs.push(...postJobs);
|
|
249
|
+
postJobs.length = 0;
|
|
233
250
|
return;
|
|
234
251
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
252
|
+
activePostJobs = postJobs;
|
|
253
|
+
postJobs = [];
|
|
254
|
+
while (postFlushIndex < activePostJobs.length) {
|
|
255
|
+
const cb = activePostJobs[postFlushIndex++];
|
|
256
|
+
if (cb.flags & 2) {
|
|
239
257
|
cb.flags &= -2;
|
|
240
258
|
}
|
|
241
|
-
if (!(cb.flags &
|
|
242
|
-
|
|
259
|
+
if (!(cb.flags & 4)) {
|
|
260
|
+
try {
|
|
261
|
+
cb();
|
|
262
|
+
} finally {
|
|
263
|
+
cb.flags &= -2;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
243
266
|
}
|
|
244
|
-
|
|
267
|
+
activePostJobs = null;
|
|
245
268
|
postFlushIndex = 0;
|
|
246
269
|
}
|
|
247
270
|
}
|
|
248
|
-
|
|
271
|
+
let isFlushing = false;
|
|
272
|
+
function flushOnAppMount() {
|
|
273
|
+
if (!isFlushing) {
|
|
274
|
+
isFlushing = true;
|
|
275
|
+
flushPreFlushCbs();
|
|
276
|
+
flushPostFlushCbs();
|
|
277
|
+
isFlushing = false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
249
280
|
function flushJobs(seen) {
|
|
250
281
|
try {
|
|
251
|
-
|
|
252
|
-
const job =
|
|
253
|
-
|
|
282
|
+
while (flushIndex < jobsLength) {
|
|
283
|
+
const job = jobs[flushIndex];
|
|
284
|
+
jobs[flushIndex++] = void 0;
|
|
285
|
+
if (!(job.flags & 4)) {
|
|
254
286
|
if (false) ;
|
|
255
|
-
if (job.flags &
|
|
287
|
+
if (job.flags & 2) {
|
|
256
288
|
job.flags &= ~1;
|
|
257
289
|
}
|
|
258
|
-
|
|
259
|
-
job
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
290
|
+
try {
|
|
291
|
+
job();
|
|
292
|
+
} catch (err) {
|
|
293
|
+
handleError(
|
|
294
|
+
err,
|
|
295
|
+
job.i,
|
|
296
|
+
job.i ? 15 : 14
|
|
297
|
+
);
|
|
298
|
+
} finally {
|
|
299
|
+
if (!(job.flags & 2)) {
|
|
300
|
+
job.flags &= ~1;
|
|
301
|
+
}
|
|
265
302
|
}
|
|
266
303
|
}
|
|
267
304
|
}
|
|
268
305
|
} finally {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
job.flags &= -2;
|
|
273
|
-
}
|
|
306
|
+
while (flushIndex < jobsLength) {
|
|
307
|
+
jobs[flushIndex].flags &= -2;
|
|
308
|
+
jobs[flushIndex++] = void 0;
|
|
274
309
|
}
|
|
275
|
-
flushIndex =
|
|
276
|
-
|
|
310
|
+
flushIndex = 0;
|
|
311
|
+
jobsLength = 0;
|
|
277
312
|
flushPostFlushCbs();
|
|
278
313
|
currentFlushPromise = null;
|
|
279
|
-
if (
|
|
314
|
+
if (jobsLength || postJobs.length) {
|
|
280
315
|
flushJobs();
|
|
281
316
|
}
|
|
282
317
|
}
|
|
@@ -364,14 +399,14 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
364
399
|
}
|
|
365
400
|
let hook = binding.dir[name];
|
|
366
401
|
if (hook) {
|
|
367
|
-
reactivity.
|
|
402
|
+
const prevSub = reactivity.setActiveSub();
|
|
368
403
|
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
369
404
|
vnode.el,
|
|
370
405
|
binding,
|
|
371
406
|
vnode,
|
|
372
407
|
prevVNode
|
|
373
408
|
]);
|
|
374
|
-
reactivity.
|
|
409
|
+
reactivity.setActiveSub(prevSub);
|
|
375
410
|
}
|
|
376
411
|
}
|
|
377
412
|
}
|
|
@@ -450,29 +485,37 @@ const TeleportImpl = {
|
|
|
450
485
|
}
|
|
451
486
|
if (isTeleportDeferred(n2.props)) {
|
|
452
487
|
n2.el.__isMounted = false;
|
|
453
|
-
queuePostRenderEffect(
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
488
|
+
queuePostRenderEffect(
|
|
489
|
+
() => {
|
|
490
|
+
mountToTarget();
|
|
491
|
+
delete n2.el.__isMounted;
|
|
492
|
+
},
|
|
493
|
+
void 0,
|
|
494
|
+
parentSuspense
|
|
495
|
+
);
|
|
457
496
|
} else {
|
|
458
497
|
mountToTarget();
|
|
459
498
|
}
|
|
460
499
|
} else {
|
|
461
500
|
if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
|
|
462
|
-
queuePostRenderEffect(
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
501
|
+
queuePostRenderEffect(
|
|
502
|
+
() => {
|
|
503
|
+
TeleportImpl.process(
|
|
504
|
+
n1,
|
|
505
|
+
n2,
|
|
506
|
+
container,
|
|
507
|
+
anchor,
|
|
508
|
+
parentComponent,
|
|
509
|
+
parentSuspense,
|
|
510
|
+
namespace,
|
|
511
|
+
slotScopeIds,
|
|
512
|
+
optimized,
|
|
513
|
+
internals
|
|
514
|
+
);
|
|
515
|
+
},
|
|
516
|
+
void 0,
|
|
517
|
+
parentSuspense
|
|
518
|
+
);
|
|
476
519
|
return;
|
|
477
520
|
}
|
|
478
521
|
n2.el = n1.el;
|
|
@@ -519,6 +562,7 @@ const TeleportImpl = {
|
|
|
519
562
|
container,
|
|
520
563
|
mainAnchor,
|
|
521
564
|
internals,
|
|
565
|
+
parentComponent,
|
|
522
566
|
1
|
|
523
567
|
);
|
|
524
568
|
} else {
|
|
@@ -538,6 +582,7 @@ const TeleportImpl = {
|
|
|
538
582
|
nextTarget,
|
|
539
583
|
null,
|
|
540
584
|
internals,
|
|
585
|
+
parentComponent,
|
|
541
586
|
0
|
|
542
587
|
);
|
|
543
588
|
}
|
|
@@ -547,6 +592,7 @@ const TeleportImpl = {
|
|
|
547
592
|
target,
|
|
548
593
|
targetAnchor,
|
|
549
594
|
internals,
|
|
595
|
+
parentComponent,
|
|
550
596
|
1
|
|
551
597
|
);
|
|
552
598
|
}
|
|
@@ -586,7 +632,7 @@ const TeleportImpl = {
|
|
|
586
632
|
move: moveTeleport,
|
|
587
633
|
hydrate: hydrateTeleport
|
|
588
634
|
};
|
|
589
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
|
635
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, parentComponent, moveType = 2) {
|
|
590
636
|
if (moveType === 0) {
|
|
591
637
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
592
638
|
}
|
|
@@ -602,7 +648,8 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
602
648
|
children[i],
|
|
603
649
|
container,
|
|
604
650
|
parentAnchor,
|
|
605
|
-
2
|
|
651
|
+
2,
|
|
652
|
+
parentComponent
|
|
606
653
|
);
|
|
607
654
|
}
|
|
608
655
|
}
|
|
@@ -784,7 +831,7 @@ const BaseTransitionImpl = {
|
|
|
784
831
|
state.isLeaving = true;
|
|
785
832
|
leavingHooks.afterLeave = () => {
|
|
786
833
|
state.isLeaving = false;
|
|
787
|
-
if (!(instance.job.flags &
|
|
834
|
+
if (!(instance.job.flags & 4)) {
|
|
788
835
|
instance.update();
|
|
789
836
|
}
|
|
790
837
|
delete leavingHooks.afterLeave;
|
|
@@ -1056,7 +1103,7 @@ function defineComponent(options, extraOptions) {
|
|
|
1056
1103
|
}
|
|
1057
1104
|
|
|
1058
1105
|
function useId() {
|
|
1059
|
-
const i =
|
|
1106
|
+
const i = getCurrentGenericInstance();
|
|
1060
1107
|
if (i) {
|
|
1061
1108
|
return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
|
|
1062
1109
|
}
|
|
@@ -1067,7 +1114,7 @@ function markAsyncBoundary(instance) {
|
|
|
1067
1114
|
}
|
|
1068
1115
|
|
|
1069
1116
|
function useTemplateRef(key) {
|
|
1070
|
-
const i =
|
|
1117
|
+
const i = getCurrentGenericInstance();
|
|
1071
1118
|
const r = reactivity.shallowRef(null);
|
|
1072
1119
|
if (i) {
|
|
1073
1120
|
const refs = i.refs === shared.EMPTY_OBJ ? i.refs = {} : i.refs;
|
|
@@ -1159,8 +1206,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
1159
1206
|
} else ;
|
|
1160
1207
|
};
|
|
1161
1208
|
if (value) {
|
|
1162
|
-
doSet
|
|
1163
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
1209
|
+
queuePostRenderEffect(doSet, -1, parentSuspense);
|
|
1164
1210
|
} else {
|
|
1165
1211
|
doSet();
|
|
1166
1212
|
}
|
|
@@ -1310,6 +1356,9 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1310
1356
|
);
|
|
1311
1357
|
}
|
|
1312
1358
|
} else if (shapeFlag & 6) {
|
|
1359
|
+
if (vnode.type.__vapor) {
|
|
1360
|
+
throw new Error("Vapor component hydration is not supported yet.");
|
|
1361
|
+
}
|
|
1313
1362
|
vnode.slotScopeIds = slotScopeIds;
|
|
1314
1363
|
const container = parentNode(node);
|
|
1315
1364
|
if (isFragmentStart) {
|
|
@@ -1458,11 +1507,15 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1458
1507
|
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
1459
1508
|
}
|
|
1460
1509
|
if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
|
1461
|
-
queueEffectWithSuspense(
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1510
|
+
queueEffectWithSuspense(
|
|
1511
|
+
() => {
|
|
1512
|
+
vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
|
1513
|
+
needCallTransitionHooks && transition.enter(el);
|
|
1514
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
1515
|
+
},
|
|
1516
|
+
void 0,
|
|
1517
|
+
parentSuspense
|
|
1518
|
+
);
|
|
1466
1519
|
}
|
|
1467
1520
|
}
|
|
1468
1521
|
return el.nextSibling;
|
|
@@ -1849,7 +1902,7 @@ function defineAsyncComponent(source) {
|
|
|
1849
1902
|
}
|
|
1850
1903
|
load().then(() => {
|
|
1851
1904
|
loaded.value = true;
|
|
1852
|
-
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
1905
|
+
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
|
|
1853
1906
|
instance.parent.update();
|
|
1854
1907
|
}
|
|
1855
1908
|
}).catch((err) => {
|
|
@@ -1892,8 +1945,8 @@ const KeepAliveImpl = {
|
|
|
1892
1945
|
max: [String, Number]
|
|
1893
1946
|
},
|
|
1894
1947
|
setup(props, { slots }) {
|
|
1895
|
-
const
|
|
1896
|
-
const sharedContext =
|
|
1948
|
+
const keepAliveInstance = getCurrentInstance();
|
|
1949
|
+
const sharedContext = keepAliveInstance.ctx;
|
|
1897
1950
|
if (!sharedContext.renderer) {
|
|
1898
1951
|
return () => {
|
|
1899
1952
|
const children = slots.default && slots.default();
|
|
@@ -1903,7 +1956,7 @@ const KeepAliveImpl = {
|
|
|
1903
1956
|
const cache = /* @__PURE__ */ new Map();
|
|
1904
1957
|
const keys = /* @__PURE__ */ new Set();
|
|
1905
1958
|
let current = null;
|
|
1906
|
-
const parentSuspense =
|
|
1959
|
+
const parentSuspense = keepAliveInstance.suspense;
|
|
1907
1960
|
const {
|
|
1908
1961
|
renderer: {
|
|
1909
1962
|
p: patch,
|
|
@@ -1914,49 +1967,71 @@ const KeepAliveImpl = {
|
|
|
1914
1967
|
} = sharedContext;
|
|
1915
1968
|
const storageContainer = createElement("div");
|
|
1916
1969
|
sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
|
1917
|
-
const
|
|
1918
|
-
move(
|
|
1970
|
+
const instance = vnode.component;
|
|
1971
|
+
move(
|
|
1972
|
+
vnode,
|
|
1973
|
+
container,
|
|
1974
|
+
anchor,
|
|
1975
|
+
0,
|
|
1976
|
+
keepAliveInstance,
|
|
1977
|
+
parentSuspense
|
|
1978
|
+
);
|
|
1919
1979
|
patch(
|
|
1920
|
-
|
|
1980
|
+
instance.vnode,
|
|
1921
1981
|
vnode,
|
|
1922
1982
|
container,
|
|
1923
1983
|
anchor,
|
|
1924
|
-
|
|
1984
|
+
instance,
|
|
1925
1985
|
parentSuspense,
|
|
1926
1986
|
namespace,
|
|
1927
1987
|
vnode.slotScopeIds,
|
|
1928
1988
|
optimized
|
|
1929
1989
|
);
|
|
1930
|
-
queuePostRenderEffect(
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1990
|
+
queuePostRenderEffect(
|
|
1991
|
+
() => {
|
|
1992
|
+
instance.isDeactivated = false;
|
|
1993
|
+
if (instance.a) {
|
|
1994
|
+
shared.invokeArrayFns(instance.a);
|
|
1995
|
+
}
|
|
1996
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
|
1997
|
+
if (vnodeHook) {
|
|
1998
|
+
invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
|
1999
|
+
}
|
|
2000
|
+
},
|
|
2001
|
+
void 0,
|
|
2002
|
+
parentSuspense
|
|
2003
|
+
);
|
|
1940
2004
|
};
|
|
1941
2005
|
sharedContext.deactivate = (vnode) => {
|
|
1942
|
-
const
|
|
1943
|
-
invalidateMount(
|
|
1944
|
-
invalidateMount(
|
|
1945
|
-
move(
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
2006
|
+
const instance = vnode.component;
|
|
2007
|
+
invalidateMount(instance.m);
|
|
2008
|
+
invalidateMount(instance.a);
|
|
2009
|
+
move(
|
|
2010
|
+
vnode,
|
|
2011
|
+
storageContainer,
|
|
2012
|
+
null,
|
|
2013
|
+
1,
|
|
2014
|
+
keepAliveInstance,
|
|
2015
|
+
parentSuspense
|
|
2016
|
+
);
|
|
2017
|
+
queuePostRenderEffect(
|
|
2018
|
+
() => {
|
|
2019
|
+
if (instance.da) {
|
|
2020
|
+
shared.invokeArrayFns(instance.da);
|
|
2021
|
+
}
|
|
2022
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
|
2023
|
+
if (vnodeHook) {
|
|
2024
|
+
invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
|
2025
|
+
}
|
|
2026
|
+
instance.isDeactivated = true;
|
|
2027
|
+
},
|
|
2028
|
+
void 0,
|
|
2029
|
+
parentSuspense
|
|
2030
|
+
);
|
|
1956
2031
|
};
|
|
1957
2032
|
function unmount(vnode) {
|
|
1958
2033
|
resetShapeFlag(vnode);
|
|
1959
|
-
_unmount(vnode,
|
|
2034
|
+
_unmount(vnode, keepAliveInstance, parentSuspense, true);
|
|
1960
2035
|
}
|
|
1961
2036
|
function pruneCache(filter) {
|
|
1962
2037
|
cache.forEach((vnode, key) => {
|
|
@@ -1988,12 +2063,19 @@ const KeepAliveImpl = {
|
|
|
1988
2063
|
let pendingCacheKey = null;
|
|
1989
2064
|
const cacheSubtree = () => {
|
|
1990
2065
|
if (pendingCacheKey != null) {
|
|
1991
|
-
if (isSuspense(
|
|
1992
|
-
queuePostRenderEffect(
|
|
1993
|
-
|
|
1994
|
-
|
|
2066
|
+
if (isSuspense(keepAliveInstance.subTree.type)) {
|
|
2067
|
+
queuePostRenderEffect(
|
|
2068
|
+
() => {
|
|
2069
|
+
cache.set(
|
|
2070
|
+
pendingCacheKey,
|
|
2071
|
+
getInnerChild(keepAliveInstance.subTree)
|
|
2072
|
+
);
|
|
2073
|
+
},
|
|
2074
|
+
void 0,
|
|
2075
|
+
keepAliveInstance.subTree.suspense
|
|
2076
|
+
);
|
|
1995
2077
|
} else {
|
|
1996
|
-
cache.set(pendingCacheKey, getInnerChild(
|
|
2078
|
+
cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
|
|
1997
2079
|
}
|
|
1998
2080
|
}
|
|
1999
2081
|
};
|
|
@@ -2001,12 +2083,12 @@ const KeepAliveImpl = {
|
|
|
2001
2083
|
onUpdated(cacheSubtree);
|
|
2002
2084
|
onBeforeUnmount(() => {
|
|
2003
2085
|
cache.forEach((cached) => {
|
|
2004
|
-
const { subTree, suspense } =
|
|
2086
|
+
const { subTree, suspense } = keepAliveInstance;
|
|
2005
2087
|
const vnode = getInnerChild(subTree);
|
|
2006
2088
|
if (cached.type === vnode.type && cached.key === vnode.key) {
|
|
2007
2089
|
resetShapeFlag(vnode);
|
|
2008
2090
|
const da = vnode.component.da;
|
|
2009
|
-
da && queuePostRenderEffect(da, suspense);
|
|
2091
|
+
da && queuePostRenderEffect(da, void 0, suspense);
|
|
2010
2092
|
return;
|
|
2011
2093
|
}
|
|
2012
2094
|
unmount(cached);
|
|
@@ -2089,7 +2171,7 @@ function onActivated(hook, target) {
|
|
|
2089
2171
|
function onDeactivated(hook, target) {
|
|
2090
2172
|
registerKeepAliveHook(hook, "da", target);
|
|
2091
2173
|
}
|
|
2092
|
-
function registerKeepAliveHook(hook, type, target =
|
|
2174
|
+
function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
|
|
2093
2175
|
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
2094
2176
|
let current = target;
|
|
2095
2177
|
while (current) {
|
|
@@ -2103,7 +2185,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
2103
2185
|
injectHook(type, wrappedHook, target);
|
|
2104
2186
|
if (target) {
|
|
2105
2187
|
let current = target.parent;
|
|
2106
|
-
while (current && current.parent) {
|
|
2188
|
+
while (current && current.parent && current.parent.vnode) {
|
|
2107
2189
|
if (isKeepAlive(current.parent.vnode)) {
|
|
2108
2190
|
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
2109
2191
|
}
|
|
@@ -2135,12 +2217,14 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2135
2217
|
if (target) {
|
|
2136
2218
|
const hooks = target[type] || (target[type] = []);
|
|
2137
2219
|
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
2138
|
-
reactivity.
|
|
2139
|
-
const
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2220
|
+
const prevSub = reactivity.setActiveSub();
|
|
2221
|
+
const prev = setCurrentInstance(target);
|
|
2222
|
+
try {
|
|
2223
|
+
return callWithAsyncErrorHandling(hook, target, type, args);
|
|
2224
|
+
} finally {
|
|
2225
|
+
setCurrentInstance(...prev);
|
|
2226
|
+
reactivity.setActiveSub(prevSub);
|
|
2227
|
+
}
|
|
2144
2228
|
});
|
|
2145
2229
|
if (prepend) {
|
|
2146
2230
|
hooks.unshift(wrappedHook);
|
|
@@ -2206,7 +2290,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
2206
2290
|
const res = (
|
|
2207
2291
|
// local registration
|
|
2208
2292
|
// check instance[type] first which is resolved for options API
|
|
2209
|
-
resolve(
|
|
2293
|
+
resolve(
|
|
2294
|
+
instance[type] || Component[type],
|
|
2295
|
+
name
|
|
2296
|
+
) || // global registration
|
|
2297
|
+
// @ts-expect-error filters only exist in compat mode
|
|
2210
2298
|
resolve(instance.appContext[type], name)
|
|
2211
2299
|
);
|
|
2212
2300
|
if (!res && maybeSelfReference) {
|
|
@@ -2288,7 +2376,13 @@ function createSlots(slots, dynamicSlots) {
|
|
|
2288
2376
|
}
|
|
2289
2377
|
|
|
2290
2378
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
2291
|
-
|
|
2379
|
+
let slot = slots[name];
|
|
2380
|
+
if (slot && slot.__vapor) {
|
|
2381
|
+
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
2382
|
+
ret.vs = { slot, fallback };
|
|
2383
|
+
return ret;
|
|
2384
|
+
}
|
|
2385
|
+
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
2292
2386
|
if (name !== "default") props.name = name;
|
|
2293
2387
|
return openBlock(), createBlock(
|
|
2294
2388
|
Fragment,
|
|
@@ -2297,7 +2391,6 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
2297
2391
|
64
|
|
2298
2392
|
);
|
|
2299
2393
|
}
|
|
2300
|
-
let slot = slots[name];
|
|
2301
2394
|
if (slot && slot._c) {
|
|
2302
2395
|
slot._d = false;
|
|
2303
2396
|
}
|
|
@@ -2342,8 +2435,9 @@ function toHandlers(obj, preserveCaseIfNecessary) {
|
|
|
2342
2435
|
}
|
|
2343
2436
|
|
|
2344
2437
|
const getPublicInstance = (i) => {
|
|
2345
|
-
if (!i) return null;
|
|
2346
|
-
if (isStatefulComponent(i))
|
|
2438
|
+
if (!i || i.vapor) return null;
|
|
2439
|
+
if (isStatefulComponent(i))
|
|
2440
|
+
return getComponentPublicInstance(i);
|
|
2347
2441
|
return getPublicInstance(i.parent);
|
|
2348
2442
|
};
|
|
2349
2443
|
const publicPropertiesMap = (
|
|
@@ -2507,8 +2601,13 @@ function useAttrs() {
|
|
|
2507
2601
|
return getContext().attrs;
|
|
2508
2602
|
}
|
|
2509
2603
|
function getContext() {
|
|
2510
|
-
const i =
|
|
2511
|
-
|
|
2604
|
+
const i = getCurrentGenericInstance();
|
|
2605
|
+
if (i.vapor) {
|
|
2606
|
+
return i;
|
|
2607
|
+
} else {
|
|
2608
|
+
const ii = i;
|
|
2609
|
+
return ii.setupContext || (ii.setupContext = createSetupContext(ii));
|
|
2610
|
+
}
|
|
2512
2611
|
}
|
|
2513
2612
|
function normalizePropsOrEmits(props) {
|
|
2514
2613
|
return shared.isArray(props) ? props.reduce(
|
|
@@ -2554,9 +2653,9 @@ function createPropsRestProxy(props, excludedKeys) {
|
|
|
2554
2653
|
return ret;
|
|
2555
2654
|
}
|
|
2556
2655
|
function withAsyncContext(getAwaitable) {
|
|
2557
|
-
const ctx =
|
|
2656
|
+
const ctx = getCurrentGenericInstance();
|
|
2558
2657
|
let awaitable = getAwaitable();
|
|
2559
|
-
|
|
2658
|
+
setCurrentInstance(null, void 0);
|
|
2560
2659
|
if (shared.isPromise(awaitable)) {
|
|
2561
2660
|
awaitable = awaitable.catch((e) => {
|
|
2562
2661
|
setCurrentInstance(ctx);
|
|
@@ -2925,7 +3024,7 @@ function createAppContext() {
|
|
|
2925
3024
|
};
|
|
2926
3025
|
}
|
|
2927
3026
|
let uid$1 = 0;
|
|
2928
|
-
function createAppAPI(
|
|
3027
|
+
function createAppAPI(mount, unmount, getPublicInstance, render) {
|
|
2929
3028
|
return function createApp(rootComponent, rootProps = null) {
|
|
2930
3029
|
if (!shared.isFunction(rootComponent)) {
|
|
2931
3030
|
rootComponent = shared.extend({}, rootComponent);
|
|
@@ -2984,22 +3083,11 @@ function createAppAPI(render, hydrate) {
|
|
|
2984
3083
|
},
|
|
2985
3084
|
mount(rootContainer, isHydrate, namespace) {
|
|
2986
3085
|
if (!isMounted) {
|
|
2987
|
-
const
|
|
2988
|
-
vnode.appContext = context;
|
|
2989
|
-
if (namespace === true) {
|
|
2990
|
-
namespace = "svg";
|
|
2991
|
-
} else if (namespace === false) {
|
|
2992
|
-
namespace = void 0;
|
|
2993
|
-
}
|
|
2994
|
-
if (isHydrate && hydrate) {
|
|
2995
|
-
hydrate(vnode, rootContainer);
|
|
2996
|
-
} else {
|
|
2997
|
-
render(vnode, rootContainer, namespace);
|
|
2998
|
-
}
|
|
3086
|
+
const instance = mount(app, rootContainer, isHydrate, namespace);
|
|
2999
3087
|
isMounted = true;
|
|
3000
3088
|
app._container = rootContainer;
|
|
3001
3089
|
rootContainer.__vue_app__ = app;
|
|
3002
|
-
return
|
|
3090
|
+
return getPublicInstance(instance);
|
|
3003
3091
|
}
|
|
3004
3092
|
},
|
|
3005
3093
|
onUnmount(cleanupFn) {
|
|
@@ -3012,7 +3100,7 @@ function createAppAPI(render, hydrate) {
|
|
|
3012
3100
|
app._instance,
|
|
3013
3101
|
16
|
|
3014
3102
|
);
|
|
3015
|
-
|
|
3103
|
+
unmount(app);
|
|
3016
3104
|
delete app._container.__vue_app__;
|
|
3017
3105
|
}
|
|
3018
3106
|
},
|
|
@@ -3036,6 +3124,7 @@ function createAppAPI(render, hydrate) {
|
|
|
3036
3124
|
let currentApp = null;
|
|
3037
3125
|
|
|
3038
3126
|
function provide(key, value) {
|
|
3127
|
+
const currentInstance = getCurrentGenericInstance();
|
|
3039
3128
|
if (!currentInstance) ; else {
|
|
3040
3129
|
let provides = currentInstance.provides;
|
|
3041
3130
|
const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
|
@@ -3046,9 +3135,9 @@ function provide(key, value) {
|
|
|
3046
3135
|
}
|
|
3047
3136
|
}
|
|
3048
3137
|
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
3049
|
-
const instance =
|
|
3138
|
+
const instance = getCurrentGenericInstance();
|
|
3050
3139
|
if (instance || currentApp) {
|
|
3051
|
-
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.
|
|
3140
|
+
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
|
|
3052
3141
|
if (provides && key in provides) {
|
|
3053
3142
|
return provides[key];
|
|
3054
3143
|
} else if (arguments.length > 1) {
|
|
@@ -3057,7 +3146,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
|
3057
3146
|
}
|
|
3058
3147
|
}
|
|
3059
3148
|
function hasInjectionContext() {
|
|
3060
|
-
return !!(
|
|
3149
|
+
return !!(getCurrentGenericInstance() || currentApp);
|
|
3061
3150
|
}
|
|
3062
3151
|
|
|
3063
3152
|
const internalObjectProto = {};
|
|
@@ -3065,7 +3154,7 @@ const createInternalObject = () => Object.create(internalObjectProto);
|
|
|
3065
3154
|
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
3066
3155
|
|
|
3067
3156
|
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
3068
|
-
const props = {};
|
|
3157
|
+
const props = instance.props = {};
|
|
3069
3158
|
const attrs = createInternalObject();
|
|
3070
3159
|
instance.propsDefaults = /* @__PURE__ */ Object.create(null);
|
|
3071
3160
|
setFullProps(instance, rawProps, props, attrs);
|
|
@@ -3118,11 +3207,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3118
3207
|
const camelizedKey = shared.camelize(key);
|
|
3119
3208
|
props[camelizedKey] = resolvePropValue(
|
|
3120
3209
|
options,
|
|
3121
|
-
rawCurrentProps,
|
|
3122
3210
|
camelizedKey,
|
|
3123
3211
|
value,
|
|
3124
3212
|
instance,
|
|
3125
|
-
|
|
3213
|
+
baseResolveDefault
|
|
3126
3214
|
);
|
|
3127
3215
|
}
|
|
3128
3216
|
} else {
|
|
@@ -3149,10 +3237,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3149
3237
|
rawPrevProps[kebabKey] !== void 0)) {
|
|
3150
3238
|
props[key] = resolvePropValue(
|
|
3151
3239
|
options,
|
|
3152
|
-
rawCurrentProps,
|
|
3153
3240
|
key,
|
|
3154
3241
|
void 0,
|
|
3155
3242
|
instance,
|
|
3243
|
+
baseResolveDefault,
|
|
3156
3244
|
true
|
|
3157
3245
|
);
|
|
3158
3246
|
}
|
|
@@ -3200,39 +3288,37 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
3200
3288
|
}
|
|
3201
3289
|
}
|
|
3202
3290
|
if (needCastKeys) {
|
|
3203
|
-
const rawCurrentProps = reactivity.toRaw(props);
|
|
3204
3291
|
const castValues = rawCastValues || shared.EMPTY_OBJ;
|
|
3205
3292
|
for (let i = 0; i < needCastKeys.length; i++) {
|
|
3206
3293
|
const key = needCastKeys[i];
|
|
3207
3294
|
props[key] = resolvePropValue(
|
|
3208
3295
|
options,
|
|
3209
|
-
rawCurrentProps,
|
|
3210
3296
|
key,
|
|
3211
3297
|
castValues[key],
|
|
3212
3298
|
instance,
|
|
3299
|
+
baseResolveDefault,
|
|
3213
3300
|
!shared.hasOwn(castValues, key)
|
|
3214
3301
|
);
|
|
3215
3302
|
}
|
|
3216
3303
|
}
|
|
3217
3304
|
return hasAttrsChanged;
|
|
3218
3305
|
}
|
|
3219
|
-
function resolvePropValue(options,
|
|
3306
|
+
function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
|
|
3220
3307
|
const opt = options[key];
|
|
3221
3308
|
if (opt != null) {
|
|
3222
3309
|
const hasDefault = shared.hasOwn(opt, "default");
|
|
3223
3310
|
if (hasDefault && value === void 0) {
|
|
3224
3311
|
const defaultValue = opt.default;
|
|
3225
3312
|
if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
|
|
3226
|
-
const
|
|
3227
|
-
if (key
|
|
3228
|
-
value =
|
|
3313
|
+
const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
|
|
3314
|
+
if (shared.hasOwn(cachedDefaults, key)) {
|
|
3315
|
+
value = cachedDefaults[key];
|
|
3229
3316
|
} else {
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3317
|
+
value = cachedDefaults[key] = resolveDefault(
|
|
3318
|
+
defaultValue,
|
|
3319
|
+
instance,
|
|
3320
|
+
key
|
|
3234
3321
|
);
|
|
3235
|
-
reset();
|
|
3236
3322
|
}
|
|
3237
3323
|
} else {
|
|
3238
3324
|
value = defaultValue;
|
|
@@ -3251,6 +3337,17 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
3251
3337
|
}
|
|
3252
3338
|
return value;
|
|
3253
3339
|
}
|
|
3340
|
+
function baseResolveDefault(factory, instance, key) {
|
|
3341
|
+
let value;
|
|
3342
|
+
const prev = setCurrentInstance(instance);
|
|
3343
|
+
const props = reactivity.toRaw(instance.props);
|
|
3344
|
+
value = factory.call(
|
|
3345
|
+
null,
|
|
3346
|
+
props
|
|
3347
|
+
);
|
|
3348
|
+
setCurrentInstance(...prev);
|
|
3349
|
+
return value;
|
|
3350
|
+
}
|
|
3254
3351
|
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
3255
3352
|
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
3256
3353
|
const cache = asMixin ? mixinPropsCache : appContext.propsCache;
|
|
@@ -3285,6 +3382,14 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3285
3382
|
}
|
|
3286
3383
|
return shared.EMPTY_ARR;
|
|
3287
3384
|
}
|
|
3385
|
+
baseNormalizePropsOptions(raw, normalized, needCastKeys);
|
|
3386
|
+
const res = [normalized, needCastKeys];
|
|
3387
|
+
if (shared.isObject(comp)) {
|
|
3388
|
+
cache.set(comp, res);
|
|
3389
|
+
}
|
|
3390
|
+
return res;
|
|
3391
|
+
}
|
|
3392
|
+
function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
|
|
3288
3393
|
if (shared.isArray(raw)) {
|
|
3289
3394
|
for (let i = 0; i < raw.length; i++) {
|
|
3290
3395
|
const normalizedKey = shared.camelize(raw[i]);
|
|
@@ -3323,11 +3428,6 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3323
3428
|
}
|
|
3324
3429
|
}
|
|
3325
3430
|
}
|
|
3326
|
-
const res = [normalized, needCastKeys];
|
|
3327
|
-
if (shared.isObject(comp)) {
|
|
3328
|
-
cache.set(comp, res);
|
|
3329
|
-
}
|
|
3330
|
-
return res;
|
|
3331
3431
|
}
|
|
3332
3432
|
function validatePropName(key) {
|
|
3333
3433
|
if (key[0] !== "$" && !shared.isReservedProp(key)) {
|
|
@@ -3484,6 +3584,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3484
3584
|
optimized
|
|
3485
3585
|
);
|
|
3486
3586
|
break;
|
|
3587
|
+
case VaporSlot:
|
|
3588
|
+
getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
|
|
3589
|
+
break;
|
|
3487
3590
|
default:
|
|
3488
3591
|
if (shapeFlag & 1) {
|
|
3489
3592
|
processElement(
|
|
@@ -3675,11 +3778,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3675
3778
|
}
|
|
3676
3779
|
hostInsert(el, container, anchor);
|
|
3677
3780
|
if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
|
|
3678
|
-
queuePostRenderEffect(
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3781
|
+
queuePostRenderEffect(
|
|
3782
|
+
() => {
|
|
3783
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
3784
|
+
needCallTransitionHooks && transition.enter(el);
|
|
3785
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
3786
|
+
},
|
|
3787
|
+
void 0,
|
|
3788
|
+
parentSuspense
|
|
3789
|
+
);
|
|
3683
3790
|
}
|
|
3684
3791
|
};
|
|
3685
3792
|
const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
|
@@ -3691,8 +3798,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3691
3798
|
hostSetScopeId(el, slotScopeIds[i]);
|
|
3692
3799
|
}
|
|
3693
3800
|
}
|
|
3694
|
-
|
|
3695
|
-
|
|
3801
|
+
let subTree = parentComponent && parentComponent.subTree;
|
|
3802
|
+
if (subTree) {
|
|
3696
3803
|
if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
|
|
3697
3804
|
const parentVNode = parentComponent.vnode;
|
|
3698
3805
|
setScopeId(
|
|
@@ -3795,10 +3902,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3795
3902
|
patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
3796
3903
|
}
|
|
3797
3904
|
if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
|
3798
|
-
queuePostRenderEffect(
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3905
|
+
queuePostRenderEffect(
|
|
3906
|
+
() => {
|
|
3907
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
3908
|
+
dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
3909
|
+
},
|
|
3910
|
+
void 0,
|
|
3911
|
+
parentSuspense
|
|
3912
|
+
);
|
|
3802
3913
|
}
|
|
3803
3914
|
};
|
|
3804
3915
|
const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
|
|
@@ -3929,7 +4040,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3929
4040
|
};
|
|
3930
4041
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
3931
4042
|
n2.slotScopeIds = slotScopeIds;
|
|
3932
|
-
if (
|
|
4043
|
+
if (n2.type.__vapor) {
|
|
4044
|
+
if (n1 == null) {
|
|
4045
|
+
getVaporInterface(parentComponent, n2).mount(
|
|
4046
|
+
n2,
|
|
4047
|
+
container,
|
|
4048
|
+
anchor,
|
|
4049
|
+
parentComponent
|
|
4050
|
+
);
|
|
4051
|
+
} else {
|
|
4052
|
+
getVaporInterface(parentComponent, n2).update(
|
|
4053
|
+
n1,
|
|
4054
|
+
n2,
|
|
4055
|
+
shouldUpdateComponent(n1, n2, optimized)
|
|
4056
|
+
);
|
|
4057
|
+
}
|
|
4058
|
+
} else if (n1 == null) {
|
|
3933
4059
|
if (n2.shapeFlag & 512) {
|
|
3934
4060
|
parentComponent.ctx.activate(
|
|
3935
4061
|
n2,
|
|
@@ -3991,15 +4117,48 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3991
4117
|
return;
|
|
3992
4118
|
} else {
|
|
3993
4119
|
instance.next = n2;
|
|
3994
|
-
instance.
|
|
4120
|
+
instance.effect.run();
|
|
3995
4121
|
}
|
|
3996
4122
|
} else {
|
|
3997
4123
|
n2.el = n1.el;
|
|
3998
4124
|
instance.vnode = n2;
|
|
3999
4125
|
}
|
|
4000
4126
|
};
|
|
4001
|
-
|
|
4002
|
-
|
|
4127
|
+
class SetupRenderEffect extends reactivity.ReactiveEffect {
|
|
4128
|
+
constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
|
|
4129
|
+
const prevScope = reactivity.setCurrentScope(instance.scope);
|
|
4130
|
+
super();
|
|
4131
|
+
this.instance = instance;
|
|
4132
|
+
this.initialVNode = initialVNode;
|
|
4133
|
+
this.container = container;
|
|
4134
|
+
this.anchor = anchor;
|
|
4135
|
+
this.parentSuspense = parentSuspense;
|
|
4136
|
+
this.namespace = namespace;
|
|
4137
|
+
this.optimized = optimized;
|
|
4138
|
+
reactivity.setCurrentScope(prevScope);
|
|
4139
|
+
this.job = instance.job = () => {
|
|
4140
|
+
if (this.dirty) {
|
|
4141
|
+
this.run();
|
|
4142
|
+
}
|
|
4143
|
+
};
|
|
4144
|
+
this.job.i = instance;
|
|
4145
|
+
}
|
|
4146
|
+
notify() {
|
|
4147
|
+
if (!(this.flags & 256)) {
|
|
4148
|
+
const job = this.job;
|
|
4149
|
+
queueJob(job, job.i.uid);
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
fn() {
|
|
4153
|
+
const {
|
|
4154
|
+
instance,
|
|
4155
|
+
initialVNode,
|
|
4156
|
+
container,
|
|
4157
|
+
anchor,
|
|
4158
|
+
parentSuspense,
|
|
4159
|
+
namespace,
|
|
4160
|
+
optimized
|
|
4161
|
+
} = this;
|
|
4003
4162
|
if (!instance.isMounted) {
|
|
4004
4163
|
let vnodeHook;
|
|
4005
4164
|
const { el, props } = initialVNode;
|
|
@@ -4051,20 +4210,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4051
4210
|
initialVNode.el = subTree.el;
|
|
4052
4211
|
}
|
|
4053
4212
|
if (m) {
|
|
4054
|
-
queuePostRenderEffect(m, parentSuspense);
|
|
4213
|
+
queuePostRenderEffect(m, void 0, parentSuspense);
|
|
4055
4214
|
}
|
|
4056
4215
|
if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
|
|
4057
4216
|
const scopedInitialVNode = initialVNode;
|
|
4058
4217
|
queuePostRenderEffect(
|
|
4059
4218
|
() => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
|
|
4219
|
+
void 0,
|
|
4060
4220
|
parentSuspense
|
|
4061
4221
|
);
|
|
4062
4222
|
}
|
|
4063
|
-
if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
|
4064
|
-
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
4223
|
+
if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
|
4224
|
+
instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
|
|
4065
4225
|
}
|
|
4066
4226
|
instance.isMounted = true;
|
|
4067
|
-
initialVNode = container = anchor = null;
|
|
4227
|
+
this.initialVNode = this.container = this.anchor = null;
|
|
4068
4228
|
} else {
|
|
4069
4229
|
let { next, bu, u, parent, vnode } = instance;
|
|
4070
4230
|
{
|
|
@@ -4076,7 +4236,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4076
4236
|
}
|
|
4077
4237
|
nonHydratedAsyncRoot.asyncDep.then(() => {
|
|
4078
4238
|
if (!instance.isUnmounted) {
|
|
4079
|
-
|
|
4239
|
+
this.fn();
|
|
4080
4240
|
}
|
|
4081
4241
|
});
|
|
4082
4242
|
return;
|
|
@@ -4117,26 +4277,31 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4117
4277
|
updateHOCHostEl(instance, nextTree.el);
|
|
4118
4278
|
}
|
|
4119
4279
|
if (u) {
|
|
4120
|
-
queuePostRenderEffect(u, parentSuspense);
|
|
4280
|
+
queuePostRenderEffect(u, void 0, parentSuspense);
|
|
4121
4281
|
}
|
|
4122
4282
|
if (vnodeHook = next.props && next.props.onVnodeUpdated) {
|
|
4123
4283
|
queuePostRenderEffect(
|
|
4124
4284
|
() => invokeVNodeHook(vnodeHook, parent, next, vnode),
|
|
4285
|
+
void 0,
|
|
4125
4286
|
parentSuspense
|
|
4126
4287
|
);
|
|
4127
4288
|
}
|
|
4128
4289
|
}
|
|
4129
|
-
}
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
instance.
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4290
|
+
}
|
|
4291
|
+
}
|
|
4292
|
+
const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
|
|
4293
|
+
const effect = instance.effect = new SetupRenderEffect(
|
|
4294
|
+
instance,
|
|
4295
|
+
initialVNode,
|
|
4296
|
+
container,
|
|
4297
|
+
anchor,
|
|
4298
|
+
parentSuspense,
|
|
4299
|
+
namespace,
|
|
4300
|
+
optimized
|
|
4301
|
+
);
|
|
4302
|
+
instance.update = effect.run.bind(effect);
|
|
4138
4303
|
toggleRecurse(instance, true);
|
|
4139
|
-
|
|
4304
|
+
effect.run();
|
|
4140
4305
|
};
|
|
4141
4306
|
const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
|
4142
4307
|
nextVNode.component = instance;
|
|
@@ -4145,9 +4310,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4145
4310
|
instance.next = null;
|
|
4146
4311
|
updateProps(instance, nextVNode.props, prevProps, optimized);
|
|
4147
4312
|
updateSlots(instance, nextVNode.children, optimized);
|
|
4148
|
-
reactivity.
|
|
4313
|
+
const prevSub = reactivity.setActiveSub();
|
|
4149
4314
|
flushPreFlushCbs(instance);
|
|
4150
|
-
reactivity.
|
|
4315
|
+
reactivity.setActiveSub(prevSub);
|
|
4151
4316
|
};
|
|
4152
4317
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
|
|
4153
4318
|
const c1 = n1 && n1.children;
|
|
@@ -4397,7 +4562,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4397
4562
|
patched++;
|
|
4398
4563
|
}
|
|
4399
4564
|
}
|
|
4400
|
-
const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
|
|
4565
|
+
const increasingNewIndexSequence = moved ? shared.getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
|
|
4401
4566
|
j = increasingNewIndexSequence.length - 1;
|
|
4402
4567
|
for (i = toBePatched - 1; i >= 0; i--) {
|
|
4403
4568
|
const nextIndex = s2 + i;
|
|
@@ -4417,7 +4582,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4417
4582
|
);
|
|
4418
4583
|
} else if (moved) {
|
|
4419
4584
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
4420
|
-
move(
|
|
4585
|
+
move(
|
|
4586
|
+
nextChild,
|
|
4587
|
+
container,
|
|
4588
|
+
anchor,
|
|
4589
|
+
2,
|
|
4590
|
+
parentComponent
|
|
4591
|
+
);
|
|
4421
4592
|
} else {
|
|
4422
4593
|
j--;
|
|
4423
4594
|
}
|
|
@@ -4425,10 +4596,20 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4425
4596
|
}
|
|
4426
4597
|
}
|
|
4427
4598
|
};
|
|
4428
|
-
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
4599
|
+
const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
|
|
4429
4600
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
4430
4601
|
if (shapeFlag & 6) {
|
|
4431
|
-
|
|
4602
|
+
if (type.__vapor) {
|
|
4603
|
+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
|
|
4604
|
+
} else {
|
|
4605
|
+
move(
|
|
4606
|
+
vnode.component.subTree,
|
|
4607
|
+
container,
|
|
4608
|
+
anchor,
|
|
4609
|
+
moveType,
|
|
4610
|
+
parentComponent
|
|
4611
|
+
);
|
|
4612
|
+
}
|
|
4432
4613
|
return;
|
|
4433
4614
|
}
|
|
4434
4615
|
if (shapeFlag & 128) {
|
|
@@ -4436,13 +4617,25 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4436
4617
|
return;
|
|
4437
4618
|
}
|
|
4438
4619
|
if (shapeFlag & 64) {
|
|
4439
|
-
type.move(
|
|
4620
|
+
type.move(
|
|
4621
|
+
vnode,
|
|
4622
|
+
container,
|
|
4623
|
+
anchor,
|
|
4624
|
+
internals,
|
|
4625
|
+
parentComponent
|
|
4626
|
+
);
|
|
4440
4627
|
return;
|
|
4441
4628
|
}
|
|
4442
4629
|
if (type === Fragment) {
|
|
4443
4630
|
hostInsert(el, container, anchor);
|
|
4444
4631
|
for (let i = 0; i < children.length; i++) {
|
|
4445
|
-
move(
|
|
4632
|
+
move(
|
|
4633
|
+
children[i],
|
|
4634
|
+
container,
|
|
4635
|
+
anchor,
|
|
4636
|
+
moveType,
|
|
4637
|
+
parentComponent
|
|
4638
|
+
);
|
|
4446
4639
|
}
|
|
4447
4640
|
hostInsert(vnode.anchor, container, anchor);
|
|
4448
4641
|
return;
|
|
@@ -4456,7 +4649,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4456
4649
|
if (moveType === 0) {
|
|
4457
4650
|
transition.beforeEnter(el);
|
|
4458
4651
|
hostInsert(el, container, anchor);
|
|
4459
|
-
queuePostRenderEffect(
|
|
4652
|
+
queuePostRenderEffect(
|
|
4653
|
+
() => transition.enter(el),
|
|
4654
|
+
void 0,
|
|
4655
|
+
parentSuspense
|
|
4656
|
+
);
|
|
4460
4657
|
} else {
|
|
4461
4658
|
const { leave, delayLeave, afterLeave } = transition;
|
|
4462
4659
|
const remove2 = () => {
|
|
@@ -4498,9 +4695,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4498
4695
|
optimized = false;
|
|
4499
4696
|
}
|
|
4500
4697
|
if (ref != null) {
|
|
4501
|
-
reactivity.
|
|
4698
|
+
const prevSub = reactivity.setActiveSub();
|
|
4502
4699
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
4503
|
-
reactivity.
|
|
4700
|
+
reactivity.setActiveSub(prevSub);
|
|
4504
4701
|
}
|
|
4505
4702
|
if (cacheIndex != null) {
|
|
4506
4703
|
parentComponent.renderCache[cacheIndex] = void 0;
|
|
@@ -4516,7 +4713,12 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4516
4713
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4517
4714
|
}
|
|
4518
4715
|
if (shapeFlag & 6) {
|
|
4519
|
-
|
|
4716
|
+
if (type.__vapor) {
|
|
4717
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
4718
|
+
return;
|
|
4719
|
+
} else {
|
|
4720
|
+
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
4721
|
+
}
|
|
4520
4722
|
} else {
|
|
4521
4723
|
if (shapeFlag & 128) {
|
|
4522
4724
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
@@ -4550,15 +4752,23 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4550
4752
|
} else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
|
|
4551
4753
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
4552
4754
|
}
|
|
4755
|
+
if (type === VaporSlot) {
|
|
4756
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
4757
|
+
return;
|
|
4758
|
+
}
|
|
4553
4759
|
if (doRemove) {
|
|
4554
4760
|
remove(vnode);
|
|
4555
4761
|
}
|
|
4556
4762
|
}
|
|
4557
4763
|
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
|
4558
|
-
queuePostRenderEffect(
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4764
|
+
queuePostRenderEffect(
|
|
4765
|
+
() => {
|
|
4766
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4767
|
+
shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
4768
|
+
},
|
|
4769
|
+
void 0,
|
|
4770
|
+
parentSuspense
|
|
4771
|
+
);
|
|
4562
4772
|
}
|
|
4563
4773
|
};
|
|
4564
4774
|
const remove = (vnode) => {
|
|
@@ -4604,7 +4814,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4604
4814
|
const {
|
|
4605
4815
|
bum,
|
|
4606
4816
|
scope,
|
|
4607
|
-
|
|
4817
|
+
effect,
|
|
4608
4818
|
subTree,
|
|
4609
4819
|
um,
|
|
4610
4820
|
m,
|
|
@@ -4623,16 +4833,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4623
4833
|
});
|
|
4624
4834
|
}
|
|
4625
4835
|
scope.stop();
|
|
4626
|
-
if (
|
|
4627
|
-
|
|
4836
|
+
if (effect) {
|
|
4837
|
+
effect.stop();
|
|
4628
4838
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
4629
4839
|
}
|
|
4630
4840
|
if (um) {
|
|
4631
|
-
queuePostRenderEffect(um, parentSuspense);
|
|
4841
|
+
queuePostRenderEffect(um, void 0, parentSuspense);
|
|
4632
4842
|
}
|
|
4633
|
-
queuePostRenderEffect(
|
|
4634
|
-
instance.isUnmounted = true
|
|
4635
|
-
|
|
4843
|
+
queuePostRenderEffect(
|
|
4844
|
+
() => instance.isUnmounted = true,
|
|
4845
|
+
void 0,
|
|
4846
|
+
parentSuspense
|
|
4847
|
+
);
|
|
4636
4848
|
if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
|
|
4637
4849
|
parentSuspense.deps--;
|
|
4638
4850
|
if (parentSuspense.deps === 0) {
|
|
@@ -4647,6 +4859,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4647
4859
|
};
|
|
4648
4860
|
const getNextHostNode = (vnode) => {
|
|
4649
4861
|
if (vnode.shapeFlag & 6) {
|
|
4862
|
+
if (vnode.type.__vapor) {
|
|
4863
|
+
return hostNextSibling(vnode.component.block);
|
|
4864
|
+
}
|
|
4650
4865
|
return getNextHostNode(vnode.component.subTree);
|
|
4651
4866
|
}
|
|
4652
4867
|
if (vnode.shapeFlag & 128) {
|
|
@@ -4656,7 +4871,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4656
4871
|
const teleportEnd = el && el[TeleportEndKey];
|
|
4657
4872
|
return teleportEnd ? hostNextSibling(teleportEnd) : el;
|
|
4658
4873
|
};
|
|
4659
|
-
let isFlushing = false;
|
|
4660
4874
|
const render = (vnode, container, namespace) => {
|
|
4661
4875
|
if (vnode == null) {
|
|
4662
4876
|
if (container._vnode) {
|
|
@@ -4674,12 +4888,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4674
4888
|
);
|
|
4675
4889
|
}
|
|
4676
4890
|
container._vnode = vnode;
|
|
4677
|
-
|
|
4678
|
-
isFlushing = true;
|
|
4679
|
-
flushPreFlushCbs();
|
|
4680
|
-
flushPostFlushCbs();
|
|
4681
|
-
isFlushing = false;
|
|
4682
|
-
}
|
|
4891
|
+
flushOnAppMount();
|
|
4683
4892
|
};
|
|
4684
4893
|
const internals = {
|
|
4685
4894
|
p: patch,
|
|
@@ -4687,6 +4896,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4687
4896
|
m: move,
|
|
4688
4897
|
r: remove,
|
|
4689
4898
|
mt: mountComponent,
|
|
4899
|
+
umt: unmountComponent,
|
|
4690
4900
|
mc: mountChildren,
|
|
4691
4901
|
pc: patchChildren,
|
|
4692
4902
|
pbc: patchBlockChildren,
|
|
@@ -4700,22 +4910,46 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4700
4910
|
internals
|
|
4701
4911
|
);
|
|
4702
4912
|
}
|
|
4913
|
+
const mountApp = (app, container, isHydrate, namespace) => {
|
|
4914
|
+
const vnode = app._ceVNode || createVNode(app._component, app._props);
|
|
4915
|
+
vnode.appContext = app._context;
|
|
4916
|
+
if (namespace === true) {
|
|
4917
|
+
namespace = "svg";
|
|
4918
|
+
} else if (namespace === false) {
|
|
4919
|
+
namespace = void 0;
|
|
4920
|
+
}
|
|
4921
|
+
if (isHydrate && hydrate) {
|
|
4922
|
+
hydrate(vnode, container);
|
|
4923
|
+
} else {
|
|
4924
|
+
render(vnode, container, namespace);
|
|
4925
|
+
}
|
|
4926
|
+
return vnode.component;
|
|
4927
|
+
};
|
|
4928
|
+
const unmountApp = (app) => {
|
|
4929
|
+
render(null, app._container);
|
|
4930
|
+
};
|
|
4703
4931
|
return {
|
|
4704
4932
|
render,
|
|
4705
4933
|
hydrate,
|
|
4706
|
-
|
|
4934
|
+
internals,
|
|
4935
|
+
createApp: createAppAPI(
|
|
4936
|
+
mountApp,
|
|
4937
|
+
unmountApp,
|
|
4938
|
+
getComponentPublicInstance)
|
|
4707
4939
|
};
|
|
4708
4940
|
}
|
|
4709
4941
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
4710
4942
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
4711
4943
|
}
|
|
4712
|
-
function toggleRecurse({ effect, job }, allowed) {
|
|
4713
|
-
if (
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4944
|
+
function toggleRecurse({ effect, job, vapor }, allowed) {
|
|
4945
|
+
if (!vapor) {
|
|
4946
|
+
if (allowed) {
|
|
4947
|
+
effect.flags |= 128;
|
|
4948
|
+
job.flags |= 2;
|
|
4949
|
+
} else {
|
|
4950
|
+
effect.flags &= -129;
|
|
4951
|
+
job.flags &= -3;
|
|
4952
|
+
}
|
|
4719
4953
|
}
|
|
4720
4954
|
}
|
|
4721
4955
|
function needTransition(parentSuspense, transition) {
|
|
@@ -4745,46 +4979,6 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
4745
4979
|
}
|
|
4746
4980
|
}
|
|
4747
4981
|
}
|
|
4748
|
-
function getSequence(arr) {
|
|
4749
|
-
const p = arr.slice();
|
|
4750
|
-
const result = [0];
|
|
4751
|
-
let i, j, u, v, c;
|
|
4752
|
-
const len = arr.length;
|
|
4753
|
-
for (i = 0; i < len; i++) {
|
|
4754
|
-
const arrI = arr[i];
|
|
4755
|
-
if (arrI !== 0) {
|
|
4756
|
-
j = result[result.length - 1];
|
|
4757
|
-
if (arr[j] < arrI) {
|
|
4758
|
-
p[i] = j;
|
|
4759
|
-
result.push(i);
|
|
4760
|
-
continue;
|
|
4761
|
-
}
|
|
4762
|
-
u = 0;
|
|
4763
|
-
v = result.length - 1;
|
|
4764
|
-
while (u < v) {
|
|
4765
|
-
c = u + v >> 1;
|
|
4766
|
-
if (arr[result[c]] < arrI) {
|
|
4767
|
-
u = c + 1;
|
|
4768
|
-
} else {
|
|
4769
|
-
v = c;
|
|
4770
|
-
}
|
|
4771
|
-
}
|
|
4772
|
-
if (arrI < arr[result[u]]) {
|
|
4773
|
-
if (u > 0) {
|
|
4774
|
-
p[i] = result[u - 1];
|
|
4775
|
-
}
|
|
4776
|
-
result[u] = i;
|
|
4777
|
-
}
|
|
4778
|
-
}
|
|
4779
|
-
}
|
|
4780
|
-
u = result.length;
|
|
4781
|
-
v = result[u - 1];
|
|
4782
|
-
while (u-- > 0) {
|
|
4783
|
-
result[u] = v;
|
|
4784
|
-
v = p[v];
|
|
4785
|
-
}
|
|
4786
|
-
return result;
|
|
4787
|
-
}
|
|
4788
4982
|
function locateNonHydratedAsyncRoot(instance) {
|
|
4789
4983
|
const subComponent = instance.subTree.component;
|
|
4790
4984
|
if (subComponent) {
|
|
@@ -4798,9 +4992,14 @@ function locateNonHydratedAsyncRoot(instance) {
|
|
|
4798
4992
|
function invalidateMount(hooks) {
|
|
4799
4993
|
if (hooks) {
|
|
4800
4994
|
for (let i = 0; i < hooks.length; i++)
|
|
4801
|
-
hooks[i].flags |=
|
|
4995
|
+
hooks[i].flags |= 4;
|
|
4802
4996
|
}
|
|
4803
4997
|
}
|
|
4998
|
+
function getVaporInterface(instance, vnode) {
|
|
4999
|
+
const ctx = instance ? instance.appContext : vnode.appContext;
|
|
5000
|
+
const res = ctx && ctx.vapor;
|
|
5001
|
+
return res;
|
|
5002
|
+
}
|
|
4804
5003
|
|
|
4805
5004
|
const ssrContextKey = Symbol.for("v-scx");
|
|
4806
5005
|
const useSSRContext = () => {
|
|
@@ -4830,8 +5029,41 @@ function watchSyncEffect(effect, options) {
|
|
|
4830
5029
|
function watch(source, cb, options) {
|
|
4831
5030
|
return doWatch(source, cb, options);
|
|
4832
5031
|
}
|
|
5032
|
+
class RenderWatcherEffect extends reactivity.WatcherEffect {
|
|
5033
|
+
constructor(instance, source, cb, options, flush) {
|
|
5034
|
+
super(source, cb, options);
|
|
5035
|
+
this.flush = flush;
|
|
5036
|
+
const job = () => {
|
|
5037
|
+
if (this.dirty) {
|
|
5038
|
+
this.run();
|
|
5039
|
+
}
|
|
5040
|
+
};
|
|
5041
|
+
if (cb) {
|
|
5042
|
+
this.flags |= 128;
|
|
5043
|
+
job.flags |= 2;
|
|
5044
|
+
}
|
|
5045
|
+
if (instance) {
|
|
5046
|
+
job.i = instance;
|
|
5047
|
+
}
|
|
5048
|
+
this.job = job;
|
|
5049
|
+
}
|
|
5050
|
+
notify() {
|
|
5051
|
+
const flags = this.flags;
|
|
5052
|
+
if (!(flags & 256)) {
|
|
5053
|
+
const flush = this.flush;
|
|
5054
|
+
const job = this.job;
|
|
5055
|
+
if (flush === "post") {
|
|
5056
|
+
queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
|
|
5057
|
+
} else if (flush === "pre") {
|
|
5058
|
+
queueJob(job, job.i ? job.i.uid : void 0, true);
|
|
5059
|
+
} else {
|
|
5060
|
+
job();
|
|
5061
|
+
}
|
|
5062
|
+
}
|
|
5063
|
+
}
|
|
5064
|
+
}
|
|
4833
5065
|
function doWatch(source, cb, options = shared.EMPTY_OBJ) {
|
|
4834
|
-
const { immediate, deep, flush, once } = options;
|
|
5066
|
+
const { immediate, deep, flush = "pre", once } = options;
|
|
4835
5067
|
const baseWatchOptions = shared.extend({}, options);
|
|
4836
5068
|
const runsImmediately = cb && immediate || !cb && flush !== "post";
|
|
4837
5069
|
let ssrCleanup;
|
|
@@ -4850,42 +5082,32 @@ function doWatch(source, cb, options = shared.EMPTY_OBJ) {
|
|
|
4850
5082
|
}
|
|
4851
5083
|
const instance = currentInstance;
|
|
4852
5084
|
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
};
|
|
5085
|
+
const effect = new RenderWatcherEffect(
|
|
5086
|
+
instance,
|
|
5087
|
+
source,
|
|
5088
|
+
cb,
|
|
5089
|
+
baseWatchOptions,
|
|
5090
|
+
flush
|
|
5091
|
+
);
|
|
5092
|
+
if (cb) {
|
|
5093
|
+
effect.run(true);
|
|
5094
|
+
} else if (flush === "post") {
|
|
5095
|
+
queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
|
|
5096
|
+
} else {
|
|
5097
|
+
effect.run(true);
|
|
4867
5098
|
}
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
if (isPre) {
|
|
4873
|
-
job.flags |= 2;
|
|
4874
|
-
if (instance) {
|
|
4875
|
-
job.id = instance.uid;
|
|
4876
|
-
job.i = instance;
|
|
4877
|
-
}
|
|
4878
|
-
}
|
|
4879
|
-
};
|
|
4880
|
-
const watchHandle = reactivity.watch(source, cb, baseWatchOptions);
|
|
5099
|
+
const stop = effect.stop.bind(effect);
|
|
5100
|
+
stop.pause = effect.pause.bind(effect);
|
|
5101
|
+
stop.resume = effect.resume.bind(effect);
|
|
5102
|
+
stop.stop = stop;
|
|
4881
5103
|
if (isInSSRComponentSetup) {
|
|
4882
5104
|
if (ssrCleanup) {
|
|
4883
|
-
ssrCleanup.push(
|
|
5105
|
+
ssrCleanup.push(stop);
|
|
4884
5106
|
} else if (runsImmediately) {
|
|
4885
|
-
|
|
5107
|
+
stop();
|
|
4886
5108
|
}
|
|
4887
5109
|
}
|
|
4888
|
-
return
|
|
5110
|
+
return stop;
|
|
4889
5111
|
}
|
|
4890
5112
|
function instanceWatch(source, value, options) {
|
|
4891
5113
|
const publicThis = this.proxy;
|
|
@@ -4897,9 +5119,9 @@ function instanceWatch(source, value, options) {
|
|
|
4897
5119
|
cb = value.handler;
|
|
4898
5120
|
options = value;
|
|
4899
5121
|
}
|
|
4900
|
-
const
|
|
5122
|
+
const prev = setCurrentInstance(this);
|
|
4901
5123
|
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
4902
|
-
|
|
5124
|
+
setCurrentInstance(...prev);
|
|
4903
5125
|
return res;
|
|
4904
5126
|
}
|
|
4905
5127
|
function createPathGetter(ctx, path) {
|
|
@@ -4914,10 +5136,10 @@ function createPathGetter(ctx, path) {
|
|
|
4914
5136
|
}
|
|
4915
5137
|
|
|
4916
5138
|
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
4917
|
-
const i =
|
|
5139
|
+
const i = getCurrentGenericInstance();
|
|
4918
5140
|
const camelizedName = shared.camelize(name);
|
|
4919
5141
|
const hyphenatedName = shared.hyphenate(name);
|
|
4920
|
-
const modifiers = getModelModifiers(props, camelizedName);
|
|
5142
|
+
const modifiers = getModelModifiers(props, camelizedName, defaultPropGetter);
|
|
4921
5143
|
const res = reactivity.customRef((track, trigger) => {
|
|
4922
5144
|
let localValue;
|
|
4923
5145
|
let prevSetValue = shared.EMPTY_OBJ;
|
|
@@ -4939,9 +5161,25 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
|
4939
5161
|
if (!shared.hasChanged(emittedValue, localValue) && !(prevSetValue !== shared.EMPTY_OBJ && shared.hasChanged(value, prevSetValue))) {
|
|
4940
5162
|
return;
|
|
4941
5163
|
}
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
5164
|
+
let rawPropKeys;
|
|
5165
|
+
let parentPassedModelValue = false;
|
|
5166
|
+
let parentPassedModelUpdater = false;
|
|
5167
|
+
if (i.rawKeys) {
|
|
5168
|
+
rawPropKeys = i.rawKeys();
|
|
5169
|
+
} else {
|
|
5170
|
+
const rawProps = i.vnode.props;
|
|
5171
|
+
rawPropKeys = rawProps && Object.keys(rawProps);
|
|
5172
|
+
}
|
|
5173
|
+
if (rawPropKeys) {
|
|
5174
|
+
for (const key of rawPropKeys) {
|
|
5175
|
+
if (key === name || key === camelizedName || key === hyphenatedName) {
|
|
5176
|
+
parentPassedModelValue = true;
|
|
5177
|
+
} else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) {
|
|
5178
|
+
parentPassedModelUpdater = true;
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
}
|
|
5182
|
+
if (!parentPassedModelValue || !parentPassedModelUpdater) {
|
|
4945
5183
|
localValue = value;
|
|
4946
5184
|
trigger();
|
|
4947
5185
|
}
|
|
@@ -4968,16 +5206,24 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
|
4968
5206
|
};
|
|
4969
5207
|
return res;
|
|
4970
5208
|
}
|
|
4971
|
-
const getModelModifiers = (props, modelName) => {
|
|
4972
|
-
return modelName === "modelValue" || modelName === "model-value" ? props
|
|
5209
|
+
const getModelModifiers = (props, modelName, getter) => {
|
|
5210
|
+
return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${shared.camelize(modelName)}Modifiers`) || getter(props, `${shared.hyphenate(modelName)}Modifiers`);
|
|
4973
5211
|
};
|
|
4974
5212
|
|
|
4975
5213
|
function emit(instance, event, ...rawArgs) {
|
|
5214
|
+
return baseEmit(
|
|
5215
|
+
instance,
|
|
5216
|
+
instance.vnode.props || shared.EMPTY_OBJ,
|
|
5217
|
+
defaultPropGetter,
|
|
5218
|
+
event,
|
|
5219
|
+
...rawArgs
|
|
5220
|
+
);
|
|
5221
|
+
}
|
|
5222
|
+
function baseEmit(instance, props, getter, event, ...rawArgs) {
|
|
4976
5223
|
if (instance.isUnmounted) return;
|
|
4977
|
-
const props = instance.vnode.props || shared.EMPTY_OBJ;
|
|
4978
5224
|
let args = rawArgs;
|
|
4979
5225
|
const isModelListener = event.startsWith("update:");
|
|
4980
|
-
const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
|
|
5226
|
+
const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
|
|
4981
5227
|
if (modifiers) {
|
|
4982
5228
|
if (modifiers.trim) {
|
|
4983
5229
|
args = rawArgs.map((a) => shared.isString(a) ? a.trim() : a);
|
|
@@ -4987,10 +5233,10 @@ function emit(instance, event, ...rawArgs) {
|
|
|
4987
5233
|
}
|
|
4988
5234
|
}
|
|
4989
5235
|
let handlerName;
|
|
4990
|
-
let handler = props
|
|
4991
|
-
props
|
|
5236
|
+
let handler = getter(props, handlerName = shared.toHandlerKey(event)) || // also try camelCase event handler (#2249)
|
|
5237
|
+
getter(props, handlerName = shared.toHandlerKey(shared.camelize(event)));
|
|
4992
5238
|
if (!handler && isModelListener) {
|
|
4993
|
-
handler = props
|
|
5239
|
+
handler = getter(props, handlerName = shared.toHandlerKey(shared.hyphenate(event)));
|
|
4994
5240
|
}
|
|
4995
5241
|
if (handler) {
|
|
4996
5242
|
callWithAsyncErrorHandling(
|
|
@@ -5000,7 +5246,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
5000
5246
|
args
|
|
5001
5247
|
);
|
|
5002
5248
|
}
|
|
5003
|
-
const onceHandler = props
|
|
5249
|
+
const onceHandler = getter(props, handlerName + `Once`);
|
|
5004
5250
|
if (onceHandler) {
|
|
5005
5251
|
if (!instance.emitted) {
|
|
5006
5252
|
instance.emitted = {};
|
|
@@ -5016,6 +5262,9 @@ function emit(instance, event, ...rawArgs) {
|
|
|
5016
5262
|
);
|
|
5017
5263
|
}
|
|
5018
5264
|
}
|
|
5265
|
+
function defaultPropGetter(props, key) {
|
|
5266
|
+
return props[key];
|
|
5267
|
+
}
|
|
5019
5268
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
5020
5269
|
const cache = appContext.emitsCache;
|
|
5021
5270
|
const cached = cache.get(comp);
|
|
@@ -5264,7 +5513,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
|
5264
5513
|
return false;
|
|
5265
5514
|
}
|
|
5266
5515
|
function updateHOCHostEl({ vnode, parent }, el) {
|
|
5267
|
-
while (parent) {
|
|
5516
|
+
while (parent && !parent.vapor) {
|
|
5268
5517
|
const root = parent.subTree;
|
|
5269
5518
|
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
5270
5519
|
root.el = vnode.el;
|
|
@@ -5593,7 +5842,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5593
5842
|
pendingBranch,
|
|
5594
5843
|
container2,
|
|
5595
5844
|
anchor === initialAnchor ? next(activeBranch) : anchor,
|
|
5596
|
-
0
|
|
5845
|
+
0,
|
|
5846
|
+
parentComponent2
|
|
5597
5847
|
);
|
|
5598
5848
|
queuePostFlushCb(effects);
|
|
5599
5849
|
}
|
|
@@ -5606,7 +5856,13 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5606
5856
|
unmount(activeBranch, parentComponent2, suspense, true);
|
|
5607
5857
|
}
|
|
5608
5858
|
if (!delayEnter) {
|
|
5609
|
-
move(
|
|
5859
|
+
move(
|
|
5860
|
+
pendingBranch,
|
|
5861
|
+
container2,
|
|
5862
|
+
anchor,
|
|
5863
|
+
0,
|
|
5864
|
+
parentComponent2
|
|
5865
|
+
);
|
|
5610
5866
|
}
|
|
5611
5867
|
}
|
|
5612
5868
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -5679,7 +5935,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5679
5935
|
}
|
|
5680
5936
|
},
|
|
5681
5937
|
move(container2, anchor2, type) {
|
|
5682
|
-
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
|
5938
|
+
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type, parentComponent);
|
|
5683
5939
|
suspense.container = container2;
|
|
5684
5940
|
},
|
|
5685
5941
|
next() {
|
|
@@ -5810,7 +6066,7 @@ function normalizeSuspenseSlot(s) {
|
|
|
5810
6066
|
}
|
|
5811
6067
|
return s;
|
|
5812
6068
|
}
|
|
5813
|
-
function queueEffectWithSuspense(fn, suspense) {
|
|
6069
|
+
function queueEffectWithSuspense(fn, id, suspense) {
|
|
5814
6070
|
if (suspense && suspense.pendingBranch) {
|
|
5815
6071
|
if (shared.isArray(fn)) {
|
|
5816
6072
|
suspense.effects.push(...fn);
|
|
@@ -5818,7 +6074,7 @@ function queueEffectWithSuspense(fn, suspense) {
|
|
|
5818
6074
|
suspense.effects.push(fn);
|
|
5819
6075
|
}
|
|
5820
6076
|
} else {
|
|
5821
|
-
queuePostFlushCb(fn);
|
|
6077
|
+
queuePostFlushCb(fn, id);
|
|
5822
6078
|
}
|
|
5823
6079
|
}
|
|
5824
6080
|
function setActiveBranch(suspense, branch) {
|
|
@@ -5844,6 +6100,7 @@ const Fragment = Symbol.for("v-fgt");
|
|
|
5844
6100
|
const Text = Symbol.for("v-txt");
|
|
5845
6101
|
const Comment = Symbol.for("v-cmt");
|
|
5846
6102
|
const Static = Symbol.for("v-stc");
|
|
6103
|
+
const VaporSlot = Symbol.for("v-vps");
|
|
5847
6104
|
const blockStack = [];
|
|
5848
6105
|
let currentBlock = null;
|
|
5849
6106
|
function openBlock(disableTracking = false) {
|
|
@@ -6180,6 +6437,40 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
|
6180
6437
|
]);
|
|
6181
6438
|
}
|
|
6182
6439
|
|
|
6440
|
+
let currentInstance = null;
|
|
6441
|
+
const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
|
|
6442
|
+
const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
|
|
6443
|
+
let isInSSRComponentSetup = false;
|
|
6444
|
+
let setInSSRSetupState;
|
|
6445
|
+
let simpleSetCurrentInstance;
|
|
6446
|
+
{
|
|
6447
|
+
const g = shared.getGlobalThis();
|
|
6448
|
+
const registerGlobalSetter = (key, setter) => {
|
|
6449
|
+
let setters;
|
|
6450
|
+
if (!(setters = g[key])) setters = g[key] = [];
|
|
6451
|
+
setters.push(setter);
|
|
6452
|
+
return (v) => {
|
|
6453
|
+
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
6454
|
+
else setters[0](v);
|
|
6455
|
+
};
|
|
6456
|
+
};
|
|
6457
|
+
simpleSetCurrentInstance = registerGlobalSetter(
|
|
6458
|
+
`__VUE_INSTANCE_SETTERS__`,
|
|
6459
|
+
(v) => currentInstance = v
|
|
6460
|
+
);
|
|
6461
|
+
setInSSRSetupState = registerGlobalSetter(
|
|
6462
|
+
`__VUE_SSR_SETTERS__`,
|
|
6463
|
+
(v) => isInSSRComponentSetup = v
|
|
6464
|
+
);
|
|
6465
|
+
}
|
|
6466
|
+
const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
|
|
6467
|
+
try {
|
|
6468
|
+
return [currentInstance, reactivity.setCurrentScope(scope)];
|
|
6469
|
+
} finally {
|
|
6470
|
+
simpleSetCurrentInstance(instance);
|
|
6471
|
+
}
|
|
6472
|
+
};
|
|
6473
|
+
|
|
6183
6474
|
const emptyAppContext = createAppContext();
|
|
6184
6475
|
let uid = 0;
|
|
6185
6476
|
function createComponentInstance(vnode, parent, suspense) {
|
|
@@ -6224,7 +6515,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
6224
6515
|
// to be set immediately
|
|
6225
6516
|
emitted: null,
|
|
6226
6517
|
// props default value
|
|
6227
|
-
propsDefaults:
|
|
6518
|
+
propsDefaults: null,
|
|
6228
6519
|
// inheritAttrs
|
|
6229
6520
|
inheritAttrs: type.inheritAttrs,
|
|
6230
6521
|
// state
|
|
@@ -6271,53 +6562,19 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
6271
6562
|
}
|
|
6272
6563
|
return instance;
|
|
6273
6564
|
}
|
|
6274
|
-
let currentInstance = null;
|
|
6275
|
-
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
6276
|
-
let internalSetCurrentInstance;
|
|
6277
|
-
let setInSSRSetupState;
|
|
6278
|
-
{
|
|
6279
|
-
const g = shared.getGlobalThis();
|
|
6280
|
-
const registerGlobalSetter = (key, setter) => {
|
|
6281
|
-
let setters;
|
|
6282
|
-
if (!(setters = g[key])) setters = g[key] = [];
|
|
6283
|
-
setters.push(setter);
|
|
6284
|
-
return (v) => {
|
|
6285
|
-
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
6286
|
-
else setters[0](v);
|
|
6287
|
-
};
|
|
6288
|
-
};
|
|
6289
|
-
internalSetCurrentInstance = registerGlobalSetter(
|
|
6290
|
-
`__VUE_INSTANCE_SETTERS__`,
|
|
6291
|
-
(v) => currentInstance = v
|
|
6292
|
-
);
|
|
6293
|
-
setInSSRSetupState = registerGlobalSetter(
|
|
6294
|
-
`__VUE_SSR_SETTERS__`,
|
|
6295
|
-
(v) => isInSSRComponentSetup = v
|
|
6296
|
-
);
|
|
6297
|
-
}
|
|
6298
|
-
const setCurrentInstance = (instance) => {
|
|
6299
|
-
const prev = currentInstance;
|
|
6300
|
-
internalSetCurrentInstance(instance);
|
|
6301
|
-
instance.scope.on();
|
|
6302
|
-
return () => {
|
|
6303
|
-
instance.scope.off();
|
|
6304
|
-
internalSetCurrentInstance(prev);
|
|
6305
|
-
};
|
|
6306
|
-
};
|
|
6307
|
-
const unsetCurrentInstance = () => {
|
|
6308
|
-
currentInstance && currentInstance.scope.off();
|
|
6309
|
-
internalSetCurrentInstance(null);
|
|
6310
|
-
};
|
|
6311
6565
|
function isStatefulComponent(instance) {
|
|
6312
6566
|
return instance.vnode.shapeFlag & 4;
|
|
6313
6567
|
}
|
|
6314
|
-
let isInSSRComponentSetup = false;
|
|
6315
6568
|
function setupComponent(instance, isSSR = false, optimized = false) {
|
|
6316
6569
|
isSSR && setInSSRSetupState(isSSR);
|
|
6317
|
-
const { props, children } = instance.vnode;
|
|
6570
|
+
const { props, children, vi } = instance.vnode;
|
|
6318
6571
|
const isStateful = isStatefulComponent(instance);
|
|
6319
|
-
|
|
6320
|
-
|
|
6572
|
+
if (vi) {
|
|
6573
|
+
vi(instance);
|
|
6574
|
+
} else {
|
|
6575
|
+
initProps(instance, props, isStateful, isSSR);
|
|
6576
|
+
initSlots(instance, children, optimized || isSSR);
|
|
6577
|
+
}
|
|
6321
6578
|
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
|
6322
6579
|
isSSR && setInSSRSetupState(false);
|
|
6323
6580
|
return setupResult;
|
|
@@ -6328,9 +6585,9 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6328
6585
|
instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
|
|
6329
6586
|
const { setup } = Component;
|
|
6330
6587
|
if (setup) {
|
|
6331
|
-
reactivity.
|
|
6588
|
+
const prevSub = reactivity.setActiveSub();
|
|
6332
6589
|
const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
|
6333
|
-
const
|
|
6590
|
+
const prev = setCurrentInstance(instance);
|
|
6334
6591
|
const setupResult = callWithErrorHandling(
|
|
6335
6592
|
setup,
|
|
6336
6593
|
instance,
|
|
@@ -6341,12 +6598,15 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6341
6598
|
]
|
|
6342
6599
|
);
|
|
6343
6600
|
const isAsyncSetup = shared.isPromise(setupResult);
|
|
6344
|
-
reactivity.
|
|
6345
|
-
|
|
6601
|
+
reactivity.setActiveSub(prevSub);
|
|
6602
|
+
setCurrentInstance(...prev);
|
|
6346
6603
|
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
|
|
6347
6604
|
markAsyncBoundary(instance);
|
|
6348
6605
|
}
|
|
6349
6606
|
if (isAsyncSetup) {
|
|
6607
|
+
const unsetCurrentInstance = () => {
|
|
6608
|
+
setCurrentInstance(null, void 0);
|
|
6609
|
+
};
|
|
6350
6610
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
6351
6611
|
if (isSSR) {
|
|
6352
6612
|
return setupResult.then((resolvedResult) => {
|
|
@@ -6414,13 +6674,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
6414
6674
|
}
|
|
6415
6675
|
}
|
|
6416
6676
|
{
|
|
6417
|
-
const
|
|
6418
|
-
reactivity.
|
|
6677
|
+
const prevInstance = setCurrentInstance(instance);
|
|
6678
|
+
const prevSub = reactivity.setActiveSub();
|
|
6419
6679
|
try {
|
|
6420
6680
|
applyOptions(instance);
|
|
6421
6681
|
} finally {
|
|
6422
|
-
reactivity.
|
|
6423
|
-
|
|
6682
|
+
reactivity.setActiveSub(prevSub);
|
|
6683
|
+
setCurrentInstance(...prevInstance);
|
|
6424
6684
|
}
|
|
6425
6685
|
}
|
|
6426
6686
|
}
|
|
@@ -6431,18 +6691,18 @@ const attrsProxyHandlers = {
|
|
|
6431
6691
|
}
|
|
6432
6692
|
};
|
|
6433
6693
|
function createSetupContext(instance) {
|
|
6434
|
-
const expose = (exposed) => {
|
|
6435
|
-
instance.exposed = exposed || {};
|
|
6436
|
-
};
|
|
6437
6694
|
{
|
|
6438
6695
|
return {
|
|
6439
6696
|
attrs: new Proxy(instance.attrs, attrsProxyHandlers),
|
|
6440
6697
|
slots: instance.slots,
|
|
6441
6698
|
emit: instance.emit,
|
|
6442
|
-
expose
|
|
6699
|
+
expose: (exposed) => expose(instance, exposed)
|
|
6443
6700
|
};
|
|
6444
6701
|
}
|
|
6445
6702
|
}
|
|
6703
|
+
function expose(instance, exposed) {
|
|
6704
|
+
instance.exposed = exposed || {};
|
|
6705
|
+
}
|
|
6446
6706
|
function getComponentPublicInstance(instance) {
|
|
6447
6707
|
if (instance.exposed) {
|
|
6448
6708
|
return instance.exposeProxy || (instance.exposeProxy = new Proxy(reactivity.proxyRefs(reactivity.markRaw(instance.exposed)), {
|
|
@@ -6450,7 +6710,9 @@ function getComponentPublicInstance(instance) {
|
|
|
6450
6710
|
if (key in target) {
|
|
6451
6711
|
return target[key];
|
|
6452
6712
|
} else if (key in publicPropertiesMap) {
|
|
6453
|
-
return publicPropertiesMap[key](
|
|
6713
|
+
return publicPropertiesMap[key](
|
|
6714
|
+
instance
|
|
6715
|
+
);
|
|
6454
6716
|
}
|
|
6455
6717
|
},
|
|
6456
6718
|
has(target, key) {
|
|
@@ -6469,8 +6731,7 @@ function isClassComponent(value) {
|
|
|
6469
6731
|
}
|
|
6470
6732
|
|
|
6471
6733
|
const computed = (getterOrOptions, debugOptions) => {
|
|
6472
|
-
|
|
6473
|
-
return c;
|
|
6734
|
+
return reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
6474
6735
|
};
|
|
6475
6736
|
|
|
6476
6737
|
function h(type, propsOrChildren, children) {
|
|
@@ -6526,7 +6787,7 @@ function isMemoSame(cached, memo) {
|
|
|
6526
6787
|
return true;
|
|
6527
6788
|
}
|
|
6528
6789
|
|
|
6529
|
-
const version = "3.
|
|
6790
|
+
const version = "3.6.0-alpha.1";
|
|
6530
6791
|
const warn$1 = shared.NOOP;
|
|
6531
6792
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
6532
6793
|
const devtools = void 0;
|