@vue/runtime-dom 3.3.9 → 3.4.0-alpha.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.
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
function makeMap(str, expectsLowerCase) {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
for (let i = 0; i < list.length; i++) {
|
|
5
|
-
map[list[i]] = true;
|
|
6
|
-
}
|
|
7
|
-
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
2
|
+
const set = new Set(str.split(","));
|
|
3
|
+
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
|
|
8
4
|
}
|
|
9
5
|
|
|
10
6
|
const EMPTY_OBJ = Object.freeze({}) ;
|
|
@@ -354,117 +350,120 @@ function onScopeDispose(fn) {
|
|
|
354
350
|
}
|
|
355
351
|
}
|
|
356
352
|
|
|
357
|
-
const createDep = (effects) => {
|
|
358
|
-
const dep = new Set(effects);
|
|
359
|
-
dep.w = 0;
|
|
360
|
-
dep.n = 0;
|
|
361
|
-
return dep;
|
|
362
|
-
};
|
|
363
|
-
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
|
|
364
|
-
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
|
|
365
|
-
const initDepMarkers = ({ deps }) => {
|
|
366
|
-
if (deps.length) {
|
|
367
|
-
for (let i = 0; i < deps.length; i++) {
|
|
368
|
-
deps[i].w |= trackOpBit;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
const finalizeDepMarkers = (effect) => {
|
|
373
|
-
const { deps } = effect;
|
|
374
|
-
if (deps.length) {
|
|
375
|
-
let ptr = 0;
|
|
376
|
-
for (let i = 0; i < deps.length; i++) {
|
|
377
|
-
const dep = deps[i];
|
|
378
|
-
if (wasTracked(dep) && !newTracked(dep)) {
|
|
379
|
-
dep.delete(effect);
|
|
380
|
-
} else {
|
|
381
|
-
deps[ptr++] = dep;
|
|
382
|
-
}
|
|
383
|
-
dep.w &= ~trackOpBit;
|
|
384
|
-
dep.n &= ~trackOpBit;
|
|
385
|
-
}
|
|
386
|
-
deps.length = ptr;
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
391
|
-
let effectTrackDepth = 0;
|
|
392
|
-
let trackOpBit = 1;
|
|
393
|
-
const maxMarkerBits = 30;
|
|
394
353
|
let activeEffect;
|
|
395
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
396
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
|
|
397
354
|
class ReactiveEffect {
|
|
398
|
-
constructor(fn, scheduler
|
|
355
|
+
constructor(fn, trigger, scheduler, scope) {
|
|
399
356
|
this.fn = fn;
|
|
357
|
+
this.trigger = trigger;
|
|
400
358
|
this.scheduler = scheduler;
|
|
401
359
|
this.active = true;
|
|
402
360
|
this.deps = [];
|
|
403
|
-
|
|
361
|
+
/**
|
|
362
|
+
* @internal
|
|
363
|
+
*/
|
|
364
|
+
this._dirtyLevel = 3;
|
|
365
|
+
/**
|
|
366
|
+
* @internal
|
|
367
|
+
*/
|
|
368
|
+
this._trackId = 0;
|
|
369
|
+
/**
|
|
370
|
+
* @internal
|
|
371
|
+
*/
|
|
372
|
+
this._runnings = 0;
|
|
373
|
+
/**
|
|
374
|
+
* @internal
|
|
375
|
+
*/
|
|
376
|
+
this._queryings = 0;
|
|
377
|
+
/**
|
|
378
|
+
* @internal
|
|
379
|
+
*/
|
|
380
|
+
this._depsLength = 0;
|
|
404
381
|
recordEffectScope(this, scope);
|
|
405
382
|
}
|
|
383
|
+
get dirty() {
|
|
384
|
+
if (this._dirtyLevel === 1) {
|
|
385
|
+
this._dirtyLevel = 0;
|
|
386
|
+
this._queryings++;
|
|
387
|
+
pauseTracking();
|
|
388
|
+
for (const dep of this.deps) {
|
|
389
|
+
if (dep.computed) {
|
|
390
|
+
triggerComputed(dep.computed);
|
|
391
|
+
if (this._dirtyLevel >= 2) {
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
resetTracking();
|
|
397
|
+
this._queryings--;
|
|
398
|
+
}
|
|
399
|
+
return this._dirtyLevel >= 2;
|
|
400
|
+
}
|
|
401
|
+
set dirty(v) {
|
|
402
|
+
this._dirtyLevel = v ? 3 : 0;
|
|
403
|
+
}
|
|
406
404
|
run() {
|
|
405
|
+
this._dirtyLevel = 0;
|
|
407
406
|
if (!this.active) {
|
|
408
407
|
return this.fn();
|
|
409
408
|
}
|
|
410
|
-
let parent = activeEffect;
|
|
411
409
|
let lastShouldTrack = shouldTrack;
|
|
412
|
-
|
|
413
|
-
if (parent === this) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
parent = parent.parent;
|
|
417
|
-
}
|
|
410
|
+
let lastEffect = activeEffect;
|
|
418
411
|
try {
|
|
419
|
-
this.parent = activeEffect;
|
|
420
|
-
activeEffect = this;
|
|
421
412
|
shouldTrack = true;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
} else {
|
|
426
|
-
cleanupEffect(this);
|
|
427
|
-
}
|
|
413
|
+
activeEffect = this;
|
|
414
|
+
this._runnings++;
|
|
415
|
+
preCleanupEffect(this);
|
|
428
416
|
return this.fn();
|
|
429
417
|
} finally {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
trackOpBit = 1 << --effectTrackDepth;
|
|
434
|
-
activeEffect = this.parent;
|
|
418
|
+
postCleanupEffect(this);
|
|
419
|
+
this._runnings--;
|
|
420
|
+
activeEffect = lastEffect;
|
|
435
421
|
shouldTrack = lastShouldTrack;
|
|
436
|
-
this.parent = void 0;
|
|
437
|
-
if (this.deferStop) {
|
|
438
|
-
this.stop();
|
|
439
|
-
}
|
|
440
422
|
}
|
|
441
423
|
}
|
|
442
424
|
stop() {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
this.onStop();
|
|
449
|
-
}
|
|
425
|
+
var _a;
|
|
426
|
+
if (this.active) {
|
|
427
|
+
preCleanupEffect(this);
|
|
428
|
+
postCleanupEffect(this);
|
|
429
|
+
(_a = this.onStop) == null ? void 0 : _a.call(this);
|
|
450
430
|
this.active = false;
|
|
451
431
|
}
|
|
452
432
|
}
|
|
453
433
|
}
|
|
454
|
-
function
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
434
|
+
function triggerComputed(computed) {
|
|
435
|
+
return computed.value;
|
|
436
|
+
}
|
|
437
|
+
function preCleanupEffect(effect2) {
|
|
438
|
+
effect2._trackId++;
|
|
439
|
+
effect2._depsLength = 0;
|
|
440
|
+
}
|
|
441
|
+
function postCleanupEffect(effect2) {
|
|
442
|
+
if (effect2.deps && effect2.deps.length > effect2._depsLength) {
|
|
443
|
+
for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
|
|
444
|
+
cleanupDepEffect(effect2.deps[i], effect2);
|
|
445
|
+
}
|
|
446
|
+
effect2.deps.length = effect2._depsLength;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
function cleanupDepEffect(dep, effect2) {
|
|
450
|
+
const trackId = dep.get(effect2);
|
|
451
|
+
if (trackId !== void 0 && effect2._trackId !== trackId) {
|
|
452
|
+
dep.delete(effect2);
|
|
453
|
+
if (dep.size === 0) {
|
|
454
|
+
dep.cleanup();
|
|
459
455
|
}
|
|
460
|
-
deps.length = 0;
|
|
461
456
|
}
|
|
462
457
|
}
|
|
463
458
|
function effect(fn, options) {
|
|
464
459
|
if (fn.effect instanceof ReactiveEffect) {
|
|
465
460
|
fn = fn.effect.fn;
|
|
466
461
|
}
|
|
467
|
-
const _effect = new ReactiveEffect(fn)
|
|
462
|
+
const _effect = new ReactiveEffect(fn, NOOP, () => {
|
|
463
|
+
if (_effect.dirty) {
|
|
464
|
+
_effect.run();
|
|
465
|
+
}
|
|
466
|
+
});
|
|
468
467
|
if (options) {
|
|
469
468
|
extend(_effect, options);
|
|
470
469
|
if (options.scope)
|
|
@@ -481,6 +480,7 @@ function stop(runner) {
|
|
|
481
480
|
runner.effect.stop();
|
|
482
481
|
}
|
|
483
482
|
let shouldTrack = true;
|
|
483
|
+
let pauseScheduleStack = 0;
|
|
484
484
|
const trackStack = [];
|
|
485
485
|
function pauseTracking() {
|
|
486
486
|
trackStack.push(shouldTrack);
|
|
@@ -490,6 +490,68 @@ function resetTracking() {
|
|
|
490
490
|
const last = trackStack.pop();
|
|
491
491
|
shouldTrack = last === void 0 ? true : last;
|
|
492
492
|
}
|
|
493
|
+
function pauseScheduling() {
|
|
494
|
+
pauseScheduleStack++;
|
|
495
|
+
}
|
|
496
|
+
function resetScheduling() {
|
|
497
|
+
pauseScheduleStack--;
|
|
498
|
+
while (!pauseScheduleStack && queueEffectSchedulers.length) {
|
|
499
|
+
queueEffectSchedulers.shift()();
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function trackEffect(effect2, dep, debuggerEventExtraInfo) {
|
|
503
|
+
var _a;
|
|
504
|
+
if (dep.get(effect2) !== effect2._trackId) {
|
|
505
|
+
dep.set(effect2, effect2._trackId);
|
|
506
|
+
const oldDep = effect2.deps[effect2._depsLength];
|
|
507
|
+
if (oldDep !== dep) {
|
|
508
|
+
if (oldDep) {
|
|
509
|
+
cleanupDepEffect(oldDep, effect2);
|
|
510
|
+
}
|
|
511
|
+
effect2.deps[effect2._depsLength++] = dep;
|
|
512
|
+
} else {
|
|
513
|
+
effect2._depsLength++;
|
|
514
|
+
}
|
|
515
|
+
{
|
|
516
|
+
(_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
const queueEffectSchedulers = [];
|
|
521
|
+
function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
|
|
522
|
+
var _a;
|
|
523
|
+
pauseScheduling();
|
|
524
|
+
for (const effect2 of dep.keys()) {
|
|
525
|
+
if (!effect2.allowRecurse && effect2._runnings) {
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
528
|
+
if (effect2._dirtyLevel < dirtyLevel && (!effect2._runnings || dirtyLevel !== 2)) {
|
|
529
|
+
const lastDirtyLevel = effect2._dirtyLevel;
|
|
530
|
+
effect2._dirtyLevel = dirtyLevel;
|
|
531
|
+
if (lastDirtyLevel === 0 && (!effect2._queryings || dirtyLevel !== 2)) {
|
|
532
|
+
{
|
|
533
|
+
(_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
534
|
+
}
|
|
535
|
+
effect2.trigger();
|
|
536
|
+
if (effect2.scheduler) {
|
|
537
|
+
queueEffectSchedulers.push(effect2.scheduler);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
resetScheduling();
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
const createDep = (cleanup, computed) => {
|
|
546
|
+
const dep = /* @__PURE__ */ new Map();
|
|
547
|
+
dep.cleanup = cleanup;
|
|
548
|
+
dep.computed = computed;
|
|
549
|
+
return dep;
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
553
|
+
const ITERATE_KEY = Symbol("iterate" );
|
|
554
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
|
|
493
555
|
function track(target, type, key) {
|
|
494
556
|
if (shouldTrack && activeEffect) {
|
|
495
557
|
let depsMap = targetMap.get(target);
|
|
@@ -498,35 +560,17 @@ function track(target, type, key) {
|
|
|
498
560
|
}
|
|
499
561
|
let dep = depsMap.get(key);
|
|
500
562
|
if (!dep) {
|
|
501
|
-
depsMap.set(key, dep = createDep());
|
|
502
|
-
}
|
|
503
|
-
const eventInfo = { effect: activeEffect, target, type, key } ;
|
|
504
|
-
trackEffects(dep, eventInfo);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
function trackEffects(dep, debuggerEventExtraInfo) {
|
|
508
|
-
let shouldTrack2 = false;
|
|
509
|
-
if (effectTrackDepth <= maxMarkerBits) {
|
|
510
|
-
if (!newTracked(dep)) {
|
|
511
|
-
dep.n |= trackOpBit;
|
|
512
|
-
shouldTrack2 = !wasTracked(dep);
|
|
513
|
-
}
|
|
514
|
-
} else {
|
|
515
|
-
shouldTrack2 = !dep.has(activeEffect);
|
|
516
|
-
}
|
|
517
|
-
if (shouldTrack2) {
|
|
518
|
-
dep.add(activeEffect);
|
|
519
|
-
activeEffect.deps.push(dep);
|
|
520
|
-
if (activeEffect.onTrack) {
|
|
521
|
-
activeEffect.onTrack(
|
|
522
|
-
extend(
|
|
523
|
-
{
|
|
524
|
-
effect: activeEffect
|
|
525
|
-
},
|
|
526
|
-
debuggerEventExtraInfo
|
|
527
|
-
)
|
|
528
|
-
);
|
|
563
|
+
depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
|
|
529
564
|
}
|
|
565
|
+
trackEffect(
|
|
566
|
+
activeEffect,
|
|
567
|
+
dep,
|
|
568
|
+
{
|
|
569
|
+
target,
|
|
570
|
+
type,
|
|
571
|
+
key
|
|
572
|
+
}
|
|
573
|
+
);
|
|
530
574
|
}
|
|
531
575
|
}
|
|
532
576
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
@@ -574,49 +618,24 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
574
618
|
break;
|
|
575
619
|
}
|
|
576
620
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
if (
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
triggerEffects(createDep(effects), eventInfo);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
597
|
-
const effects = isArray(dep) ? dep : [...dep];
|
|
598
|
-
for (const effect2 of effects) {
|
|
599
|
-
if (effect2.computed) {
|
|
600
|
-
triggerEffect(effect2, debuggerEventExtraInfo);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
for (const effect2 of effects) {
|
|
604
|
-
if (!effect2.computed) {
|
|
605
|
-
triggerEffect(effect2, debuggerEventExtraInfo);
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
function triggerEffect(effect2, debuggerEventExtraInfo) {
|
|
610
|
-
if (effect2 !== activeEffect || effect2.allowRecurse) {
|
|
611
|
-
if (effect2.onTrigger) {
|
|
612
|
-
effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
613
|
-
}
|
|
614
|
-
if (effect2.scheduler) {
|
|
615
|
-
effect2.scheduler();
|
|
616
|
-
} else {
|
|
617
|
-
effect2.run();
|
|
621
|
+
pauseScheduling();
|
|
622
|
+
for (const dep of deps) {
|
|
623
|
+
if (dep) {
|
|
624
|
+
triggerEffects(
|
|
625
|
+
dep,
|
|
626
|
+
3,
|
|
627
|
+
{
|
|
628
|
+
target,
|
|
629
|
+
type,
|
|
630
|
+
key,
|
|
631
|
+
newValue,
|
|
632
|
+
oldValue,
|
|
633
|
+
oldTarget
|
|
634
|
+
}
|
|
635
|
+
);
|
|
618
636
|
}
|
|
619
637
|
}
|
|
638
|
+
resetScheduling();
|
|
620
639
|
}
|
|
621
640
|
function getDepFromReactive(object, key) {
|
|
622
641
|
var _a;
|
|
@@ -647,7 +666,9 @@ function createArrayInstrumentations() {
|
|
|
647
666
|
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
648
667
|
instrumentations[key] = function(...args) {
|
|
649
668
|
pauseTracking();
|
|
669
|
+
pauseScheduling();
|
|
650
670
|
const res = toRaw(this)[key].apply(this, args);
|
|
671
|
+
resetScheduling();
|
|
651
672
|
resetTracking();
|
|
652
673
|
return res;
|
|
653
674
|
};
|
|
@@ -1186,30 +1207,94 @@ function markRaw(value) {
|
|
|
1186
1207
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1187
1208
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1188
1209
|
|
|
1210
|
+
class ComputedRefImpl {
|
|
1211
|
+
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1212
|
+
this._setter = _setter;
|
|
1213
|
+
this.dep = void 0;
|
|
1214
|
+
this.__v_isRef = true;
|
|
1215
|
+
this["__v_isReadonly"] = false;
|
|
1216
|
+
this.effect = new ReactiveEffect(
|
|
1217
|
+
() => getter(this._value),
|
|
1218
|
+
() => triggerRefValue(this, 1)
|
|
1219
|
+
);
|
|
1220
|
+
this.effect.computed = this;
|
|
1221
|
+
this.effect.active = this._cacheable = !isSSR;
|
|
1222
|
+
this["__v_isReadonly"] = isReadonly;
|
|
1223
|
+
}
|
|
1224
|
+
get value() {
|
|
1225
|
+
const self = toRaw(this);
|
|
1226
|
+
trackRefValue(self);
|
|
1227
|
+
if (!self._cacheable || self.effect.dirty) {
|
|
1228
|
+
if (hasChanged(self._value, self._value = self.effect.run())) {
|
|
1229
|
+
triggerRefValue(self, 2);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
return self._value;
|
|
1233
|
+
}
|
|
1234
|
+
set value(newValue) {
|
|
1235
|
+
this._setter(newValue);
|
|
1236
|
+
}
|
|
1237
|
+
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1238
|
+
get _dirty() {
|
|
1239
|
+
return this.effect.dirty;
|
|
1240
|
+
}
|
|
1241
|
+
set _dirty(v) {
|
|
1242
|
+
this.effect.dirty = v;
|
|
1243
|
+
}
|
|
1244
|
+
// #endregion
|
|
1245
|
+
}
|
|
1246
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1247
|
+
let getter;
|
|
1248
|
+
let setter;
|
|
1249
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
1250
|
+
if (onlyGetter) {
|
|
1251
|
+
getter = getterOrOptions;
|
|
1252
|
+
setter = () => {
|
|
1253
|
+
console.warn("Write operation failed: computed value is readonly");
|
|
1254
|
+
} ;
|
|
1255
|
+
} else {
|
|
1256
|
+
getter = getterOrOptions.get;
|
|
1257
|
+
setter = getterOrOptions.set;
|
|
1258
|
+
}
|
|
1259
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1260
|
+
if (debugOptions && !isSSR) {
|
|
1261
|
+
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1262
|
+
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1263
|
+
}
|
|
1264
|
+
return cRef;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1189
1267
|
function trackRefValue(ref2) {
|
|
1190
1268
|
if (shouldTrack && activeEffect) {
|
|
1191
1269
|
ref2 = toRaw(ref2);
|
|
1192
|
-
|
|
1193
|
-
|
|
1270
|
+
trackEffect(
|
|
1271
|
+
activeEffect,
|
|
1272
|
+
ref2.dep || (ref2.dep = createDep(
|
|
1273
|
+
() => ref2.dep = void 0,
|
|
1274
|
+
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1275
|
+
)),
|
|
1276
|
+
{
|
|
1194
1277
|
target: ref2,
|
|
1195
1278
|
type: "get",
|
|
1196
1279
|
key: "value"
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1280
|
+
}
|
|
1281
|
+
);
|
|
1199
1282
|
}
|
|
1200
1283
|
}
|
|
1201
|
-
function triggerRefValue(ref2, newVal) {
|
|
1284
|
+
function triggerRefValue(ref2, dirtyLevel = 3, newVal) {
|
|
1202
1285
|
ref2 = toRaw(ref2);
|
|
1203
1286
|
const dep = ref2.dep;
|
|
1204
1287
|
if (dep) {
|
|
1205
|
-
|
|
1206
|
-
|
|
1288
|
+
triggerEffects(
|
|
1289
|
+
dep,
|
|
1290
|
+
dirtyLevel,
|
|
1291
|
+
{
|
|
1207
1292
|
target: ref2,
|
|
1208
1293
|
type: "set",
|
|
1209
1294
|
key: "value",
|
|
1210
1295
|
newValue: newVal
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1296
|
+
}
|
|
1297
|
+
);
|
|
1213
1298
|
}
|
|
1214
1299
|
}
|
|
1215
1300
|
function isRef(r) {
|
|
@@ -1245,12 +1330,12 @@ class RefImpl {
|
|
|
1245
1330
|
if (hasChanged(newVal, this._rawValue)) {
|
|
1246
1331
|
this._rawValue = newVal;
|
|
1247
1332
|
this._value = useDirectValue ? newVal : toReactive(newVal);
|
|
1248
|
-
triggerRefValue(this, newVal);
|
|
1333
|
+
triggerRefValue(this, 3, newVal);
|
|
1249
1334
|
}
|
|
1250
1335
|
}
|
|
1251
1336
|
}
|
|
1252
1337
|
function triggerRef(ref2) {
|
|
1253
|
-
triggerRefValue(ref2, ref2.value );
|
|
1338
|
+
triggerRefValue(ref2, 3, ref2.value );
|
|
1254
1339
|
}
|
|
1255
1340
|
function unref(ref2) {
|
|
1256
1341
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1348,57 +1433,6 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1348
1433
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1349
1434
|
}
|
|
1350
1435
|
|
|
1351
|
-
class ComputedRefImpl {
|
|
1352
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1353
|
-
this._setter = _setter;
|
|
1354
|
-
this.dep = void 0;
|
|
1355
|
-
this.__v_isRef = true;
|
|
1356
|
-
this["__v_isReadonly"] = false;
|
|
1357
|
-
this._dirty = true;
|
|
1358
|
-
this.effect = new ReactiveEffect(getter, () => {
|
|
1359
|
-
if (!this._dirty) {
|
|
1360
|
-
this._dirty = true;
|
|
1361
|
-
triggerRefValue(this);
|
|
1362
|
-
}
|
|
1363
|
-
});
|
|
1364
|
-
this.effect.computed = this;
|
|
1365
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1366
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1367
|
-
}
|
|
1368
|
-
get value() {
|
|
1369
|
-
const self = toRaw(this);
|
|
1370
|
-
trackRefValue(self);
|
|
1371
|
-
if (self._dirty || !self._cacheable) {
|
|
1372
|
-
self._dirty = false;
|
|
1373
|
-
self._value = self.effect.run();
|
|
1374
|
-
}
|
|
1375
|
-
return self._value;
|
|
1376
|
-
}
|
|
1377
|
-
set value(newValue) {
|
|
1378
|
-
this._setter(newValue);
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1382
|
-
let getter;
|
|
1383
|
-
let setter;
|
|
1384
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1385
|
-
if (onlyGetter) {
|
|
1386
|
-
getter = getterOrOptions;
|
|
1387
|
-
setter = () => {
|
|
1388
|
-
console.warn("Write operation failed: computed value is readonly");
|
|
1389
|
-
} ;
|
|
1390
|
-
} else {
|
|
1391
|
-
getter = getterOrOptions.get;
|
|
1392
|
-
setter = getterOrOptions.set;
|
|
1393
|
-
}
|
|
1394
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1395
|
-
if (debugOptions && !isSSR) {
|
|
1396
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1397
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1398
|
-
}
|
|
1399
|
-
return cRef;
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
1436
|
const stack = [];
|
|
1403
1437
|
function pushWarningContext(vnode) {
|
|
1404
1438
|
stack.push(vnode);
|
|
@@ -1513,7 +1547,7 @@ function assertNumber(val, type) {
|
|
|
1513
1547
|
}
|
|
1514
1548
|
}
|
|
1515
1549
|
|
|
1516
|
-
const ErrorTypeStrings = {
|
|
1550
|
+
const ErrorTypeStrings$1 = {
|
|
1517
1551
|
["sp"]: "serverPrefetch hook",
|
|
1518
1552
|
["bc"]: "beforeCreate hook",
|
|
1519
1553
|
["c"]: "created hook",
|
|
@@ -1574,7 +1608,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1574
1608
|
if (instance) {
|
|
1575
1609
|
let cur = instance.parent;
|
|
1576
1610
|
const exposedInstance = instance.proxy;
|
|
1577
|
-
const errorInfo = ErrorTypeStrings[type] ;
|
|
1611
|
+
const errorInfo = ErrorTypeStrings$1[type] ;
|
|
1578
1612
|
while (cur) {
|
|
1579
1613
|
const errorCapturedHooks = cur.ec;
|
|
1580
1614
|
if (errorCapturedHooks) {
|
|
@@ -1601,7 +1635,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1601
1635
|
}
|
|
1602
1636
|
function logError(err, type, contextVNode, throwInDev = true) {
|
|
1603
1637
|
{
|
|
1604
|
-
const info = ErrorTypeStrings[type];
|
|
1638
|
+
const info = ErrorTypeStrings$1[type];
|
|
1605
1639
|
if (contextVNode) {
|
|
1606
1640
|
pushWarningContext(contextVNode);
|
|
1607
1641
|
}
|
|
@@ -1829,6 +1863,7 @@ function rerender(id, newRender) {
|
|
|
1829
1863
|
}
|
|
1830
1864
|
instance.renderCache = [];
|
|
1831
1865
|
isHmrUpdating = true;
|
|
1866
|
+
instance.effect.dirty = true;
|
|
1832
1867
|
instance.update();
|
|
1833
1868
|
isHmrUpdating = false;
|
|
1834
1869
|
});
|
|
@@ -1856,6 +1891,7 @@ function reload(id, newComp) {
|
|
|
1856
1891
|
instance.ceReload(newComp.styles);
|
|
1857
1892
|
hmrDirtyComponents.delete(oldComp);
|
|
1858
1893
|
} else if (instance.parent) {
|
|
1894
|
+
instance.parent.effect.dirty = true;
|
|
1859
1895
|
queueJob(instance.parent.update);
|
|
1860
1896
|
} else if (instance.appContext.reload) {
|
|
1861
1897
|
instance.appContext.reload();
|
|
@@ -3105,8 +3141,15 @@ function watch(source, cb, options) {
|
|
|
3105
3141
|
}
|
|
3106
3142
|
return doWatch(source, cb, options);
|
|
3107
3143
|
}
|
|
3108
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
3144
|
+
function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
3109
3145
|
var _a;
|
|
3146
|
+
if (cb && once) {
|
|
3147
|
+
const _cb = cb;
|
|
3148
|
+
cb = (...args) => {
|
|
3149
|
+
_cb(...args);
|
|
3150
|
+
unwatch();
|
|
3151
|
+
};
|
|
3152
|
+
}
|
|
3110
3153
|
if (!cb) {
|
|
3111
3154
|
if (immediate !== void 0) {
|
|
3112
3155
|
warn(
|
|
@@ -3118,6 +3161,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3118
3161
|
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3119
3162
|
);
|
|
3120
3163
|
}
|
|
3164
|
+
if (once !== void 0) {
|
|
3165
|
+
warn(
|
|
3166
|
+
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3167
|
+
);
|
|
3168
|
+
}
|
|
3121
3169
|
}
|
|
3122
3170
|
const warnInvalidSource = (s) => {
|
|
3123
3171
|
warn(
|
|
@@ -3186,7 +3234,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3186
3234
|
};
|
|
3187
3235
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3188
3236
|
const job = () => {
|
|
3189
|
-
if (!effect.active) {
|
|
3237
|
+
if (!effect.active || !effect.dirty) {
|
|
3190
3238
|
return;
|
|
3191
3239
|
}
|
|
3192
3240
|
if (cb) {
|
|
@@ -3219,7 +3267,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3219
3267
|
job.id = instance.uid;
|
|
3220
3268
|
scheduler = () => queueJob(job);
|
|
3221
3269
|
}
|
|
3222
|
-
const effect = new ReactiveEffect(getter, scheduler);
|
|
3270
|
+
const effect = new ReactiveEffect(getter, NOOP, scheduler);
|
|
3271
|
+
const unwatch = () => {
|
|
3272
|
+
effect.stop();
|
|
3273
|
+
if (instance && instance.scope) {
|
|
3274
|
+
remove(instance.scope.effects, effect);
|
|
3275
|
+
}
|
|
3276
|
+
};
|
|
3223
3277
|
{
|
|
3224
3278
|
effect.onTrack = onTrack;
|
|
3225
3279
|
effect.onTrigger = onTrigger;
|
|
@@ -3238,12 +3292,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3238
3292
|
} else {
|
|
3239
3293
|
effect.run();
|
|
3240
3294
|
}
|
|
3241
|
-
const unwatch = () => {
|
|
3242
|
-
effect.stop();
|
|
3243
|
-
if (instance && instance.scope) {
|
|
3244
|
-
remove(instance.scope.effects, effect);
|
|
3245
|
-
}
|
|
3246
|
-
};
|
|
3247
3295
|
return unwatch;
|
|
3248
3296
|
}
|
|
3249
3297
|
function instanceWatch(source, value, options) {
|
|
@@ -3473,6 +3521,7 @@ const BaseTransitionImpl = {
|
|
|
3473
3521
|
leavingHooks.afterLeave = () => {
|
|
3474
3522
|
state.isLeaving = false;
|
|
3475
3523
|
if (instance.update.active !== false) {
|
|
3524
|
+
instance.effect.dirty = true;
|
|
3476
3525
|
instance.update();
|
|
3477
3526
|
}
|
|
3478
3527
|
};
|
|
@@ -3812,6 +3861,7 @@ function defineAsyncComponent(source) {
|
|
|
3812
3861
|
load().then(() => {
|
|
3813
3862
|
loaded.value = true;
|
|
3814
3863
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
3864
|
+
instance.parent.effect.dirty = true;
|
|
3815
3865
|
queueJob(instance.parent.update);
|
|
3816
3866
|
}
|
|
3817
3867
|
}).catch((err) => {
|
|
@@ -4106,7 +4156,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
4106
4156
|
}
|
|
4107
4157
|
return wrappedHook;
|
|
4108
4158
|
} else {
|
|
4109
|
-
const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
|
|
4159
|
+
const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
4110
4160
|
warn(
|
|
4111
4161
|
`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
|
|
4112
4162
|
);
|
|
@@ -4273,7 +4323,10 @@ const publicPropertiesMap = (
|
|
|
4273
4323
|
$root: (i) => getPublicInstance(i.root),
|
|
4274
4324
|
$emit: (i) => i.emit,
|
|
4275
4325
|
$options: (i) => resolveMergedOptions(i) ,
|
|
4276
|
-
$forceUpdate: (i) => i.f || (i.f = () =>
|
|
4326
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
4327
|
+
i.effect.dirty = true;
|
|
4328
|
+
queueJob(i.update);
|
|
4329
|
+
}),
|
|
4277
4330
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
4278
4331
|
$watch: (i) => instanceWatch.bind(i)
|
|
4279
4332
|
})
|
|
@@ -7041,6 +7094,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7041
7094
|
} else {
|
|
7042
7095
|
instance.next = n2;
|
|
7043
7096
|
invalidateJob(instance.update);
|
|
7097
|
+
instance.effect.dirty = true;
|
|
7044
7098
|
instance.update();
|
|
7045
7099
|
}
|
|
7046
7100
|
} else {
|
|
@@ -7210,11 +7264,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7210
7264
|
};
|
|
7211
7265
|
const effect = instance.effect = new ReactiveEffect(
|
|
7212
7266
|
componentUpdateFn,
|
|
7267
|
+
NOOP,
|
|
7213
7268
|
() => queueJob(update),
|
|
7214
7269
|
instance.scope
|
|
7215
7270
|
// track it in component's effect scope
|
|
7216
7271
|
);
|
|
7217
|
-
const update = instance.update = () =>
|
|
7272
|
+
const update = instance.update = () => {
|
|
7273
|
+
if (effect.dirty) {
|
|
7274
|
+
effect.run();
|
|
7275
|
+
}
|
|
7276
|
+
};
|
|
7218
7277
|
update.id = instance.uid;
|
|
7219
7278
|
toggleRecurse(instance, true);
|
|
7220
7279
|
{
|
|
@@ -9105,7 +9164,8 @@ function isMemoSame(cached, memo) {
|
|
|
9105
9164
|
return true;
|
|
9106
9165
|
}
|
|
9107
9166
|
|
|
9108
|
-
const version = "3.
|
|
9167
|
+
const version = "3.4.0-alpha.2";
|
|
9168
|
+
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
9109
9169
|
const ssrUtils = null;
|
|
9110
9170
|
const resolveFilter = null;
|
|
9111
9171
|
const compatUtils = null;
|
|
@@ -10590,4 +10650,4 @@ function normalizeContainer(container) {
|
|
|
10590
10650
|
}
|
|
10591
10651
|
const initDirectivesForSSR = NOOP;
|
|
10592
10652
|
|
|
10593
|
-
export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
|
|
10653
|
+
export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
|