@vue/runtime-dom 3.2.29 → 3.2.30

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.
@@ -201,13 +201,15 @@ var VueRuntimeDOM = (function (exports) {
201
201
  * @private
202
202
  */
203
203
  const toDisplayString = (val) => {
204
- return val == null
205
- ? ''
206
- : isArray(val) ||
207
- (isObject(val) &&
208
- (val.toString === objectToString || !isFunction(val.toString)))
209
- ? JSON.stringify(val, replacer, 2)
210
- : String(val);
204
+ return isString(val)
205
+ ? val
206
+ : val == null
207
+ ? ''
208
+ : isArray(val) ||
209
+ (isObject(val) &&
210
+ (val.toString === objectToString || !isFunction(val.toString)))
211
+ ? JSON.stringify(val, replacer, 2)
212
+ : String(val);
211
213
  };
212
214
  const replacer = (_key, val) => {
213
215
  // can't use isRef here since @vue/shared has no deps
@@ -281,6 +283,7 @@ var VueRuntimeDOM = (function (exports) {
281
283
  'onVnodeBeforeMount,onVnodeMounted,' +
282
284
  'onVnodeBeforeUpdate,onVnodeUpdated,' +
283
285
  'onVnodeBeforeUnmount,onVnodeUnmounted');
286
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
284
287
  const cacheStringFunction = (fn) => {
285
288
  const cache = Object.create(null);
286
289
  return ((str) => {
@@ -346,7 +349,6 @@ var VueRuntimeDOM = (function (exports) {
346
349
  }
347
350
 
348
351
  let activeEffectScope;
349
- const effectScopeStack = [];
350
352
  class EffectScope {
351
353
  constructor(detached = false) {
352
354
  this.active = true;
@@ -361,11 +363,11 @@ var VueRuntimeDOM = (function (exports) {
361
363
  run(fn) {
362
364
  if (this.active) {
363
365
  try {
364
- this.on();
366
+ activeEffectScope = this;
365
367
  return fn();
366
368
  }
367
369
  finally {
368
- this.off();
370
+ activeEffectScope = this.parent;
369
371
  }
370
372
  }
371
373
  else {
@@ -373,23 +375,24 @@ var VueRuntimeDOM = (function (exports) {
373
375
  }
374
376
  }
375
377
  on() {
376
- if (this.active) {
377
- effectScopeStack.push(this);
378
- activeEffectScope = this;
379
- }
378
+ activeEffectScope = this;
380
379
  }
381
380
  off() {
382
- if (this.active) {
383
- effectScopeStack.pop();
384
- activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
385
- }
381
+ activeEffectScope = this.parent;
386
382
  }
387
383
  stop(fromParent) {
388
384
  if (this.active) {
389
- this.effects.forEach(e => e.stop());
390
- this.cleanups.forEach(cleanup => cleanup());
385
+ let i, l;
386
+ for (i = 0, l = this.effects.length; i < l; i++) {
387
+ this.effects[i].stop();
388
+ }
389
+ for (i = 0, l = this.cleanups.length; i < l; i++) {
390
+ this.cleanups[i]();
391
+ }
391
392
  if (this.scopes) {
392
- this.scopes.forEach(e => e.stop(true));
393
+ for (i = 0, l = this.scopes.length; i < l; i++) {
394
+ this.scopes[i].stop(true);
395
+ }
393
396
  }
394
397
  // nested scope, dereference from parent to avoid memory leaks
395
398
  if (this.parent && !fromParent) {
@@ -407,8 +410,7 @@ var VueRuntimeDOM = (function (exports) {
407
410
  function effectScope(detached) {
408
411
  return new EffectScope(detached);
409
412
  }
410
- function recordEffectScope(effect, scope) {
411
- scope = scope || activeEffectScope;
413
+ function recordEffectScope(effect, scope = activeEffectScope) {
412
414
  if (scope && scope.active) {
413
415
  scope.effects.push(effect);
414
416
  }
@@ -471,7 +473,6 @@ var VueRuntimeDOM = (function (exports) {
471
473
  * When recursion depth is greater, fall back to using a full cleanup.
472
474
  */
473
475
  const maxMarkerBits = 30;
474
- const effectStack = [];
475
476
  let activeEffect;
476
477
  const ITERATE_KEY = Symbol('iterate' );
477
478
  const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
@@ -481,35 +482,42 @@ var VueRuntimeDOM = (function (exports) {
481
482
  this.scheduler = scheduler;
482
483
  this.active = true;
483
484
  this.deps = [];
485
+ this.parent = undefined;
484
486
  recordEffectScope(this, scope);
485
487
  }
486
488
  run() {
487
489
  if (!this.active) {
488
490
  return this.fn();
489
491
  }
490
- if (!effectStack.length || !effectStack.includes(this)) {
491
- try {
492
- effectStack.push((activeEffect = this));
493
- enableTracking();
494
- trackOpBit = 1 << ++effectTrackDepth;
495
- if (effectTrackDepth <= maxMarkerBits) {
496
- initDepMarkers(this);
497
- }
498
- else {
499
- cleanupEffect(this);
500
- }
501
- return this.fn();
492
+ let parent = activeEffect;
493
+ let lastShouldTrack = shouldTrack;
494
+ while (parent) {
495
+ if (parent === this) {
496
+ return;
502
497
  }
503
- finally {
504
- if (effectTrackDepth <= maxMarkerBits) {
505
- finalizeDepMarkers(this);
506
- }
507
- trackOpBit = 1 << --effectTrackDepth;
508
- resetTracking();
509
- effectStack.pop();
510
- const n = effectStack.length;
511
- activeEffect = n > 0 ? effectStack[n - 1] : undefined;
498
+ parent = parent.parent;
499
+ }
500
+ try {
501
+ this.parent = activeEffect;
502
+ activeEffect = this;
503
+ shouldTrack = true;
504
+ trackOpBit = 1 << ++effectTrackDepth;
505
+ if (effectTrackDepth <= maxMarkerBits) {
506
+ initDepMarkers(this);
512
507
  }
508
+ else {
509
+ cleanupEffect(this);
510
+ }
511
+ return this.fn();
512
+ }
513
+ finally {
514
+ if (effectTrackDepth <= maxMarkerBits) {
515
+ finalizeDepMarkers(this);
516
+ }
517
+ trackOpBit = 1 << --effectTrackDepth;
518
+ activeEffect = this.parent;
519
+ shouldTrack = lastShouldTrack;
520
+ this.parent = undefined;
513
521
  }
514
522
  }
515
523
  stop() {
@@ -557,32 +565,24 @@ var VueRuntimeDOM = (function (exports) {
557
565
  trackStack.push(shouldTrack);
558
566
  shouldTrack = false;
559
567
  }
560
- function enableTracking() {
561
- trackStack.push(shouldTrack);
562
- shouldTrack = true;
563
- }
564
568
  function resetTracking() {
565
569
  const last = trackStack.pop();
566
570
  shouldTrack = last === undefined ? true : last;
567
571
  }
568
572
  function track(target, type, key) {
569
- if (!isTracking()) {
570
- return;
571
- }
572
- let depsMap = targetMap.get(target);
573
- if (!depsMap) {
574
- targetMap.set(target, (depsMap = new Map()));
575
- }
576
- let dep = depsMap.get(key);
577
- if (!dep) {
578
- depsMap.set(key, (dep = createDep()));
573
+ if (shouldTrack && activeEffect) {
574
+ let depsMap = targetMap.get(target);
575
+ if (!depsMap) {
576
+ targetMap.set(target, (depsMap = new Map()));
577
+ }
578
+ let dep = depsMap.get(key);
579
+ if (!dep) {
580
+ depsMap.set(key, (dep = createDep()));
581
+ }
582
+ const eventInfo = { effect: activeEffect, target, type, key }
583
+ ;
584
+ trackEffects(dep, eventInfo);
579
585
  }
580
- const eventInfo = { effect: activeEffect, target, type, key }
581
- ;
582
- trackEffects(dep, eventInfo);
583
- }
584
- function isTracking() {
585
- return shouldTrack && activeEffect !== undefined;
586
586
  }
587
587
  function trackEffects(dep, debuggerEventExtraInfo) {
588
588
  let shouldTrack = false;
@@ -1267,13 +1267,10 @@ var VueRuntimeDOM = (function (exports) {
1267
1267
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1268
1268
 
1269
1269
  function trackRefValue(ref) {
1270
- if (isTracking()) {
1270
+ if (shouldTrack && activeEffect) {
1271
1271
  ref = toRaw(ref);
1272
- if (!ref.dep) {
1273
- ref.dep = createDep();
1274
- }
1275
1272
  {
1276
- trackEffects(ref.dep, {
1273
+ trackEffects(ref.dep || (ref.dep = createDep()), {
1277
1274
  target: ref,
1278
1275
  type: "get" /* GET */,
1279
1276
  key: 'value'
@@ -1295,7 +1292,7 @@ var VueRuntimeDOM = (function (exports) {
1295
1292
  }
1296
1293
  }
1297
1294
  function isRef(r) {
1298
- return Boolean(r && r.__v_isRef === true);
1295
+ return !!(r && r.__v_isRef === true);
1299
1296
  }
1300
1297
  function ref(value) {
1301
1298
  return createRef(value, false);
@@ -5107,7 +5104,6 @@ var VueRuntimeDOM = (function (exports) {
5107
5104
  [bar, this.y]
5108
5105
  ])
5109
5106
  */
5110
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
5111
5107
  function validateDirectiveName(name) {
5112
5108
  if (isBuiltInDirective(name)) {
5113
5109
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -9028,7 +9024,7 @@ var VueRuntimeDOM = (function (exports) {
9028
9024
  }
9029
9025
 
9030
9026
  // Core API ------------------------------------------------------------------
9031
- const version = "3.2.29";
9027
+ const version = "3.2.30";
9032
9028
  /**
9033
9029
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9034
9030
  * @internal