@vue/runtime-core 3.4.25 → 3.5.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 +99 -72
- package/dist/runtime-core.cjs.prod.js +86 -58
- package/dist/runtime-core.d.ts +476 -396
- package/dist/runtime-core.esm-bundler.js +102 -75
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-core v3.
|
|
2
|
+
* @vue/runtime-core v3.5.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -160,7 +160,7 @@ function findInsertionIndex(id) {
|
|
|
160
160
|
const middle = start + end >>> 1;
|
|
161
161
|
const middleJob = queue[middle];
|
|
162
162
|
const middleJobId = getId(middleJob);
|
|
163
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
163
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
164
164
|
start = middle + 1;
|
|
165
165
|
} else {
|
|
166
166
|
end = middle;
|
|
@@ -169,15 +169,21 @@ function findInsertionIndex(id) {
|
|
|
169
169
|
return start;
|
|
170
170
|
}
|
|
171
171
|
function queueJob(job) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
175
|
-
)) {
|
|
172
|
+
var _a;
|
|
173
|
+
if (!(job.flags & 1)) {
|
|
176
174
|
if (job.id == null) {
|
|
177
175
|
queue.push(job);
|
|
176
|
+
} else if (
|
|
177
|
+
// fast path when the job id is larger than the tail
|
|
178
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
179
|
+
) {
|
|
180
|
+
queue.push(job);
|
|
178
181
|
} else {
|
|
179
182
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
180
183
|
}
|
|
184
|
+
if (!(job.flags & 4)) {
|
|
185
|
+
job.flags |= 1;
|
|
186
|
+
}
|
|
181
187
|
queueFlush();
|
|
182
188
|
}
|
|
183
189
|
}
|
|
@@ -195,11 +201,11 @@ function invalidateJob(job) {
|
|
|
195
201
|
}
|
|
196
202
|
function queuePostFlushCb(cb) {
|
|
197
203
|
if (!shared.isArray(cb)) {
|
|
198
|
-
if (!
|
|
199
|
-
cb,
|
|
200
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
201
|
-
)) {
|
|
204
|
+
if (!(cb.flags & 1)) {
|
|
202
205
|
pendingPostFlushCbs.push(cb);
|
|
206
|
+
if (!(cb.flags & 4)) {
|
|
207
|
+
cb.flags |= 1;
|
|
208
|
+
}
|
|
203
209
|
}
|
|
204
210
|
} else {
|
|
205
211
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -209,13 +215,14 @@ function queuePostFlushCb(cb) {
|
|
|
209
215
|
function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
210
216
|
for (; i < queue.length; i++) {
|
|
211
217
|
const cb = queue[i];
|
|
212
|
-
if (cb && cb.
|
|
218
|
+
if (cb && cb.flags & 2) {
|
|
213
219
|
if (instance && cb.id !== instance.uid) {
|
|
214
220
|
continue;
|
|
215
221
|
}
|
|
216
222
|
queue.splice(i, 1);
|
|
217
223
|
i--;
|
|
218
224
|
cb();
|
|
225
|
+
cb.flags &= ~1;
|
|
219
226
|
}
|
|
220
227
|
}
|
|
221
228
|
}
|
|
@@ -232,6 +239,7 @@ function flushPostFlushCbs(seen) {
|
|
|
232
239
|
activePostFlushCbs = deduped;
|
|
233
240
|
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
|
234
241
|
activePostFlushCbs[postFlushIndex]();
|
|
242
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
235
243
|
}
|
|
236
244
|
activePostFlushCbs = null;
|
|
237
245
|
postFlushIndex = 0;
|
|
@@ -241,9 +249,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
|
|
|
241
249
|
const comparator = (a, b) => {
|
|
242
250
|
const diff = getId(a) - getId(b);
|
|
243
251
|
if (diff === 0) {
|
|
244
|
-
|
|
252
|
+
const isAPre = a.flags & 2;
|
|
253
|
+
const isBPre = b.flags & 2;
|
|
254
|
+
if (isAPre && !isBPre)
|
|
245
255
|
return -1;
|
|
246
|
-
if (
|
|
256
|
+
if (isBPre && !isAPre)
|
|
247
257
|
return 1;
|
|
248
258
|
}
|
|
249
259
|
return diff;
|
|
@@ -255,9 +265,10 @@ function flushJobs(seen) {
|
|
|
255
265
|
try {
|
|
256
266
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
257
267
|
const job = queue[flushIndex];
|
|
258
|
-
if (job && job.
|
|
268
|
+
if (job && !(job.flags & 8)) {
|
|
259
269
|
if (false) ;
|
|
260
270
|
callWithErrorHandling(job, null, 14);
|
|
271
|
+
job.flags &= ~1;
|
|
261
272
|
}
|
|
262
273
|
}
|
|
263
274
|
} finally {
|
|
@@ -1352,8 +1363,8 @@ function doWatch(source, cb, {
|
|
|
1352
1363
|
}
|
|
1353
1364
|
}
|
|
1354
1365
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1355
|
-
const job = () => {
|
|
1356
|
-
if (!effect.
|
|
1366
|
+
const job = (immediateFirstRun) => {
|
|
1367
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
1357
1368
|
return;
|
|
1358
1369
|
}
|
|
1359
1370
|
if (cb) {
|
|
@@ -1374,19 +1385,22 @@ function doWatch(source, cb, {
|
|
|
1374
1385
|
effect.run();
|
|
1375
1386
|
}
|
|
1376
1387
|
};
|
|
1377
|
-
|
|
1388
|
+
if (cb)
|
|
1389
|
+
job.flags |= 4;
|
|
1390
|
+
const effect = new reactivity.ReactiveEffect(getter);
|
|
1378
1391
|
let scheduler;
|
|
1379
1392
|
if (flush === "sync") {
|
|
1393
|
+
effect.flags |= 64;
|
|
1380
1394
|
scheduler = job;
|
|
1381
1395
|
} else if (flush === "post") {
|
|
1382
1396
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
1383
1397
|
} else {
|
|
1384
|
-
job.
|
|
1398
|
+
job.flags |= 2;
|
|
1385
1399
|
if (instance)
|
|
1386
1400
|
job.id = instance.uid;
|
|
1387
1401
|
scheduler = () => queueJob(job);
|
|
1388
1402
|
}
|
|
1389
|
-
|
|
1403
|
+
effect.scheduler = scheduler;
|
|
1390
1404
|
const scope = reactivity.getCurrentScope();
|
|
1391
1405
|
const unwatch = () => {
|
|
1392
1406
|
effect.stop();
|
|
@@ -1396,7 +1410,7 @@ function doWatch(source, cb, {
|
|
|
1396
1410
|
};
|
|
1397
1411
|
if (cb) {
|
|
1398
1412
|
if (immediate) {
|
|
1399
|
-
job();
|
|
1413
|
+
job(true);
|
|
1400
1414
|
} else {
|
|
1401
1415
|
oldValue = effect.run();
|
|
1402
1416
|
}
|
|
@@ -1571,21 +1585,13 @@ const BaseTransitionImpl = {
|
|
|
1571
1585
|
if (!children || !children.length) {
|
|
1572
1586
|
return;
|
|
1573
1587
|
}
|
|
1574
|
-
|
|
1575
|
-
if (children.length > 1) {
|
|
1576
|
-
for (const c of children) {
|
|
1577
|
-
if (c.type !== Comment) {
|
|
1578
|
-
child = c;
|
|
1579
|
-
break;
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1588
|
+
const child = findNonCommentChild(children);
|
|
1583
1589
|
const rawProps = reactivity.toRaw(props);
|
|
1584
1590
|
const { mode } = rawProps;
|
|
1585
1591
|
if (state.isLeaving) {
|
|
1586
1592
|
return emptyPlaceholder(child);
|
|
1587
1593
|
}
|
|
1588
|
-
const innerChild =
|
|
1594
|
+
const innerChild = getInnerChild$1(child);
|
|
1589
1595
|
if (!innerChild) {
|
|
1590
1596
|
return emptyPlaceholder(child);
|
|
1591
1597
|
}
|
|
@@ -1597,7 +1603,7 @@ const BaseTransitionImpl = {
|
|
|
1597
1603
|
);
|
|
1598
1604
|
setTransitionHooks(innerChild, enterHooks);
|
|
1599
1605
|
const oldChild = instance.subTree;
|
|
1600
|
-
const oldInnerChild = oldChild &&
|
|
1606
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
1601
1607
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
1602
1608
|
const leavingHooks = resolveTransitionHooks(
|
|
1603
1609
|
oldInnerChild,
|
|
@@ -1610,8 +1616,7 @@ const BaseTransitionImpl = {
|
|
|
1610
1616
|
state.isLeaving = true;
|
|
1611
1617
|
leavingHooks.afterLeave = () => {
|
|
1612
1618
|
state.isLeaving = false;
|
|
1613
|
-
if (instance.
|
|
1614
|
-
instance.effect.dirty = true;
|
|
1619
|
+
if (!(instance.job.flags & 8)) {
|
|
1615
1620
|
instance.update();
|
|
1616
1621
|
}
|
|
1617
1622
|
};
|
|
@@ -1636,6 +1641,18 @@ const BaseTransitionImpl = {
|
|
|
1636
1641
|
};
|
|
1637
1642
|
}
|
|
1638
1643
|
};
|
|
1644
|
+
function findNonCommentChild(children) {
|
|
1645
|
+
let child = children[0];
|
|
1646
|
+
if (children.length > 1) {
|
|
1647
|
+
for (const c of children) {
|
|
1648
|
+
if (c.type !== Comment) {
|
|
1649
|
+
child = c;
|
|
1650
|
+
break;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
return child;
|
|
1655
|
+
}
|
|
1639
1656
|
const BaseTransition = BaseTransitionImpl;
|
|
1640
1657
|
function getLeavingNodesForType(state, vnode) {
|
|
1641
1658
|
const { leavingVNodes } = state;
|
|
@@ -1790,8 +1807,11 @@ function emptyPlaceholder(vnode) {
|
|
|
1790
1807
|
return vnode;
|
|
1791
1808
|
}
|
|
1792
1809
|
}
|
|
1793
|
-
function
|
|
1810
|
+
function getInnerChild$1(vnode) {
|
|
1794
1811
|
if (!isKeepAlive(vnode)) {
|
|
1812
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
1813
|
+
return findNonCommentChild(vnode.children);
|
|
1814
|
+
}
|
|
1795
1815
|
return vnode;
|
|
1796
1816
|
}
|
|
1797
1817
|
const { shapeFlag, children } = vnode;
|
|
@@ -1949,7 +1969,6 @@ function defineAsyncComponent(source) {
|
|
|
1949
1969
|
load().then(() => {
|
|
1950
1970
|
loaded.value = true;
|
|
1951
1971
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
1952
|
-
instance.parent.effect.dirty = true;
|
|
1953
1972
|
queueJob(instance.parent.update);
|
|
1954
1973
|
}
|
|
1955
1974
|
}).catch((err) => {
|
|
@@ -2263,10 +2282,20 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
2263
2282
|
function renderList(source, renderItem, cache, index) {
|
|
2264
2283
|
let ret;
|
|
2265
2284
|
const cached = cache && cache[index];
|
|
2266
|
-
|
|
2285
|
+
const sourceIsArray = shared.isArray(source);
|
|
2286
|
+
const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source);
|
|
2287
|
+
if (sourceIsArray || shared.isString(source)) {
|
|
2288
|
+
if (sourceIsReactiveArray) {
|
|
2289
|
+
source = reactivity.shallowReadArray(source);
|
|
2290
|
+
}
|
|
2267
2291
|
ret = new Array(source.length);
|
|
2268
2292
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
2269
|
-
ret[i] = renderItem(
|
|
2293
|
+
ret[i] = renderItem(
|
|
2294
|
+
sourceIsReactiveArray ? reactivity.toReactive(source[i]) : source[i],
|
|
2295
|
+
i,
|
|
2296
|
+
void 0,
|
|
2297
|
+
cached && cached[i]
|
|
2298
|
+
);
|
|
2270
2299
|
}
|
|
2271
2300
|
} else if (typeof source === "number") {
|
|
2272
2301
|
ret = new Array(source);
|
|
@@ -2388,7 +2417,6 @@ const publicPropertiesMap = (
|
|
|
2388
2417
|
$emit: (i) => i.emit,
|
|
2389
2418
|
$options: (i) => resolveMergedOptions(i) ,
|
|
2390
2419
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
2391
|
-
i.effect.dirty = true;
|
|
2392
2420
|
queueJob(i.update);
|
|
2393
2421
|
}),
|
|
2394
2422
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -4549,7 +4577,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4549
4577
|
} else {
|
|
4550
4578
|
instance.next = n2;
|
|
4551
4579
|
invalidateJob(instance.update);
|
|
4552
|
-
instance.effect.dirty = true;
|
|
4553
4580
|
instance.update();
|
|
4554
4581
|
}
|
|
4555
4582
|
} else {
|
|
@@ -4684,19 +4711,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4684
4711
|
}
|
|
4685
4712
|
}
|
|
4686
4713
|
};
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
);
|
|
4694
|
-
const update = instance.update = () => {
|
|
4695
|
-
if (effect.dirty) {
|
|
4696
|
-
effect.run();
|
|
4697
|
-
}
|
|
4698
|
-
};
|
|
4699
|
-
update.id = instance.uid;
|
|
4714
|
+
instance.scope.on();
|
|
4715
|
+
const effect = instance.effect = new reactivity.ReactiveEffect(componentUpdateFn);
|
|
4716
|
+
instance.scope.off();
|
|
4717
|
+
const update = instance.update = effect.run.bind(effect);
|
|
4718
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
4719
|
+
job.id = instance.uid;
|
|
4720
|
+
effect.scheduler = () => queueJob(job);
|
|
4700
4721
|
toggleRecurse(instance, true);
|
|
4701
4722
|
update();
|
|
4702
4723
|
};
|
|
@@ -5145,13 +5166,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5145
5166
|
hostRemove(end);
|
|
5146
5167
|
};
|
|
5147
5168
|
const unmountComponent = (instance, parentSuspense, doRemove) => {
|
|
5148
|
-
const { bum, scope,
|
|
5169
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
5149
5170
|
if (bum) {
|
|
5150
5171
|
shared.invokeArrayFns(bum);
|
|
5151
5172
|
}
|
|
5152
5173
|
scope.stop();
|
|
5153
|
-
if (
|
|
5154
|
-
|
|
5174
|
+
if (job) {
|
|
5175
|
+
job.flags |= 8;
|
|
5155
5176
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
5156
5177
|
}
|
|
5157
5178
|
if (um) {
|
|
@@ -5234,8 +5255,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5234
5255
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
5235
5256
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
5236
5257
|
}
|
|
5237
|
-
function toggleRecurse({ effect,
|
|
5238
|
-
|
|
5258
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
5259
|
+
if (allowed) {
|
|
5260
|
+
effect.flags |= 32;
|
|
5261
|
+
job.flags |= 4;
|
|
5262
|
+
} else {
|
|
5263
|
+
effect.flags &= ~32;
|
|
5264
|
+
job.flags &= ~4;
|
|
5265
|
+
}
|
|
5239
5266
|
}
|
|
5240
5267
|
function needTransition(parentSuspense, transition) {
|
|
5241
5268
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -5912,6 +5939,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
5912
5939
|
effect: null,
|
|
5913
5940
|
update: null,
|
|
5914
5941
|
// will be set synchronously right after creation
|
|
5942
|
+
job: null,
|
|
5915
5943
|
scope: new reactivity.EffectScope(
|
|
5916
5944
|
true
|
|
5917
5945
|
/* detached */
|
|
@@ -6280,7 +6308,7 @@ function isMemoSame(cached, memo) {
|
|
|
6280
6308
|
return true;
|
|
6281
6309
|
}
|
|
6282
6310
|
|
|
6283
|
-
const version = "3.
|
|
6311
|
+
const version = "3.5.0-alpha.1";
|
|
6284
6312
|
const warn$1 = shared.NOOP;
|
|
6285
6313
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
6286
6314
|
const devtools = void 0;
|