vue 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.
@@ -280,13 +280,15 @@ var Vue = (function (exports) {
280
280
  * @private
281
281
  */
282
282
  const toDisplayString = (val) => {
283
- return val == null
284
- ? ''
285
- : isArray(val) ||
286
- (isObject(val) &&
287
- (val.toString === objectToString || !isFunction(val.toString)))
288
- ? JSON.stringify(val, replacer, 2)
289
- : String(val);
283
+ return isString(val)
284
+ ? val
285
+ : val == null
286
+ ? ''
287
+ : isArray(val) ||
288
+ (isObject(val) &&
289
+ (val.toString === objectToString || !isFunction(val.toString)))
290
+ ? JSON.stringify(val, replacer, 2)
291
+ : String(val);
290
292
  };
291
293
  const replacer = (_key, val) => {
292
294
  // can't use isRef here since @vue/shared has no deps
@@ -360,6 +362,7 @@ var Vue = (function (exports) {
360
362
  'onVnodeBeforeMount,onVnodeMounted,' +
361
363
  'onVnodeBeforeUpdate,onVnodeUpdated,' +
362
364
  'onVnodeBeforeUnmount,onVnodeUnmounted');
365
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
363
366
  const cacheStringFunction = (fn) => {
364
367
  const cache = Object.create(null);
365
368
  return ((str) => {
@@ -425,7 +428,6 @@ var Vue = (function (exports) {
425
428
  }
426
429
 
427
430
  let activeEffectScope;
428
- const effectScopeStack = [];
429
431
  class EffectScope {
430
432
  constructor(detached = false) {
431
433
  this.active = true;
@@ -440,11 +442,11 @@ var Vue = (function (exports) {
440
442
  run(fn) {
441
443
  if (this.active) {
442
444
  try {
443
- this.on();
445
+ activeEffectScope = this;
444
446
  return fn();
445
447
  }
446
448
  finally {
447
- this.off();
449
+ activeEffectScope = this.parent;
448
450
  }
449
451
  }
450
452
  else {
@@ -452,23 +454,24 @@ var Vue = (function (exports) {
452
454
  }
453
455
  }
454
456
  on() {
455
- if (this.active) {
456
- effectScopeStack.push(this);
457
- activeEffectScope = this;
458
- }
457
+ activeEffectScope = this;
459
458
  }
460
459
  off() {
461
- if (this.active) {
462
- effectScopeStack.pop();
463
- activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
464
- }
460
+ activeEffectScope = this.parent;
465
461
  }
466
462
  stop(fromParent) {
467
463
  if (this.active) {
468
- this.effects.forEach(e => e.stop());
469
- this.cleanups.forEach(cleanup => cleanup());
464
+ let i, l;
465
+ for (i = 0, l = this.effects.length; i < l; i++) {
466
+ this.effects[i].stop();
467
+ }
468
+ for (i = 0, l = this.cleanups.length; i < l; i++) {
469
+ this.cleanups[i]();
470
+ }
470
471
  if (this.scopes) {
471
- this.scopes.forEach(e => e.stop(true));
472
+ for (i = 0, l = this.scopes.length; i < l; i++) {
473
+ this.scopes[i].stop(true);
474
+ }
472
475
  }
473
476
  // nested scope, dereference from parent to avoid memory leaks
474
477
  if (this.parent && !fromParent) {
@@ -486,8 +489,7 @@ var Vue = (function (exports) {
486
489
  function effectScope(detached) {
487
490
  return new EffectScope(detached);
488
491
  }
489
- function recordEffectScope(effect, scope) {
490
- scope = scope || activeEffectScope;
492
+ function recordEffectScope(effect, scope = activeEffectScope) {
491
493
  if (scope && scope.active) {
492
494
  scope.effects.push(effect);
493
495
  }
@@ -550,7 +552,6 @@ var Vue = (function (exports) {
550
552
  * When recursion depth is greater, fall back to using a full cleanup.
551
553
  */
552
554
  const maxMarkerBits = 30;
553
- const effectStack = [];
554
555
  let activeEffect;
555
556
  const ITERATE_KEY = Symbol('iterate' );
556
557
  const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
@@ -560,35 +561,42 @@ var Vue = (function (exports) {
560
561
  this.scheduler = scheduler;
561
562
  this.active = true;
562
563
  this.deps = [];
564
+ this.parent = undefined;
563
565
  recordEffectScope(this, scope);
564
566
  }
565
567
  run() {
566
568
  if (!this.active) {
567
569
  return this.fn();
568
570
  }
569
- if (!effectStack.length || !effectStack.includes(this)) {
570
- try {
571
- effectStack.push((activeEffect = this));
572
- enableTracking();
573
- trackOpBit = 1 << ++effectTrackDepth;
574
- if (effectTrackDepth <= maxMarkerBits) {
575
- initDepMarkers(this);
576
- }
577
- else {
578
- cleanupEffect(this);
579
- }
580
- return this.fn();
571
+ let parent = activeEffect;
572
+ let lastShouldTrack = shouldTrack;
573
+ while (parent) {
574
+ if (parent === this) {
575
+ return;
581
576
  }
582
- finally {
583
- if (effectTrackDepth <= maxMarkerBits) {
584
- finalizeDepMarkers(this);
585
- }
586
- trackOpBit = 1 << --effectTrackDepth;
587
- resetTracking();
588
- effectStack.pop();
589
- const n = effectStack.length;
590
- activeEffect = n > 0 ? effectStack[n - 1] : undefined;
577
+ parent = parent.parent;
578
+ }
579
+ try {
580
+ this.parent = activeEffect;
581
+ activeEffect = this;
582
+ shouldTrack = true;
583
+ trackOpBit = 1 << ++effectTrackDepth;
584
+ if (effectTrackDepth <= maxMarkerBits) {
585
+ initDepMarkers(this);
591
586
  }
587
+ else {
588
+ cleanupEffect(this);
589
+ }
590
+ return this.fn();
591
+ }
592
+ finally {
593
+ if (effectTrackDepth <= maxMarkerBits) {
594
+ finalizeDepMarkers(this);
595
+ }
596
+ trackOpBit = 1 << --effectTrackDepth;
597
+ activeEffect = this.parent;
598
+ shouldTrack = lastShouldTrack;
599
+ this.parent = undefined;
592
600
  }
593
601
  }
594
602
  stop() {
@@ -636,32 +644,24 @@ var Vue = (function (exports) {
636
644
  trackStack.push(shouldTrack);
637
645
  shouldTrack = false;
638
646
  }
639
- function enableTracking() {
640
- trackStack.push(shouldTrack);
641
- shouldTrack = true;
642
- }
643
647
  function resetTracking() {
644
648
  const last = trackStack.pop();
645
649
  shouldTrack = last === undefined ? true : last;
646
650
  }
647
651
  function track(target, type, key) {
648
- if (!isTracking()) {
649
- return;
650
- }
651
- let depsMap = targetMap.get(target);
652
- if (!depsMap) {
653
- targetMap.set(target, (depsMap = new Map()));
654
- }
655
- let dep = depsMap.get(key);
656
- if (!dep) {
657
- depsMap.set(key, (dep = createDep()));
652
+ if (shouldTrack && activeEffect) {
653
+ let depsMap = targetMap.get(target);
654
+ if (!depsMap) {
655
+ targetMap.set(target, (depsMap = new Map()));
656
+ }
657
+ let dep = depsMap.get(key);
658
+ if (!dep) {
659
+ depsMap.set(key, (dep = createDep()));
660
+ }
661
+ const eventInfo = { effect: activeEffect, target, type, key }
662
+ ;
663
+ trackEffects(dep, eventInfo);
658
664
  }
659
- const eventInfo = { effect: activeEffect, target, type, key }
660
- ;
661
- trackEffects(dep, eventInfo);
662
- }
663
- function isTracking() {
664
- return shouldTrack && activeEffect !== undefined;
665
665
  }
666
666
  function trackEffects(dep, debuggerEventExtraInfo) {
667
667
  let shouldTrack = false;
@@ -1346,13 +1346,10 @@ var Vue = (function (exports) {
1346
1346
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1347
1347
 
1348
1348
  function trackRefValue(ref) {
1349
- if (isTracking()) {
1349
+ if (shouldTrack && activeEffect) {
1350
1350
  ref = toRaw(ref);
1351
- if (!ref.dep) {
1352
- ref.dep = createDep();
1353
- }
1354
1351
  {
1355
- trackEffects(ref.dep, {
1352
+ trackEffects(ref.dep || (ref.dep = createDep()), {
1356
1353
  target: ref,
1357
1354
  type: "get" /* GET */,
1358
1355
  key: 'value'
@@ -1374,7 +1371,7 @@ var Vue = (function (exports) {
1374
1371
  }
1375
1372
  }
1376
1373
  function isRef(r) {
1377
- return Boolean(r && r.__v_isRef === true);
1374
+ return !!(r && r.__v_isRef === true);
1378
1375
  }
1379
1376
  function ref(value) {
1380
1377
  return createRef(value, false);
@@ -5186,7 +5183,6 @@ var Vue = (function (exports) {
5186
5183
  [bar, this.y]
5187
5184
  ])
5188
5185
  */
5189
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
5190
5186
  function validateDirectiveName(name) {
5191
5187
  if (isBuiltInDirective(name)) {
5192
5188
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -9107,7 +9103,7 @@ var Vue = (function (exports) {
9107
9103
  }
9108
9104
 
9109
9105
  // Core API ------------------------------------------------------------------
9110
- const version = "3.2.29";
9106
+ const version = "3.2.30";
9111
9107
  /**
9112
9108
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9113
9109
  * @internal
@@ -11375,13 +11371,13 @@ var Vue = (function (exports) {
11375
11371
  message: `Platform-native elements with "is" prop will no longer be ` +
11376
11372
  `treated as components in Vue 3 unless the "is" value is explicitly ` +
11377
11373
  `prefixed with "vue:".`,
11378
- link: `https://v3.vuejs.org/guide/migration/custom-elements-interop.html`
11374
+ link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
11379
11375
  },
11380
11376
  ["COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */]: {
11381
11377
  message: key => `.sync modifier for v-bind has been removed. Use v-model with ` +
11382
11378
  `argument instead. \`v-bind:${key}.sync\` should be changed to ` +
11383
11379
  `\`v-model:${key}\`.`,
11384
- link: `https://v3.vuejs.org/guide/migration/v-model.html`
11380
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
11385
11381
  },
11386
11382
  ["COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */]: {
11387
11383
  message: `.prop modifier for v-bind has been removed and no longer necessary. ` +
@@ -11393,11 +11389,11 @@ var Vue = (function (exports) {
11393
11389
  `that appears before v-bind in the case of conflict. ` +
11394
11390
  `To retain 2.x behavior, move v-bind to make it the first attribute. ` +
11395
11391
  `You can also suppress this warning if the usage is intended.`,
11396
- link: `https://v3.vuejs.org/guide/migration/v-bind.html`
11392
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
11397
11393
  },
11398
11394
  ["COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */]: {
11399
11395
  message: `.native modifier for v-on has been removed as is no longer necessary.`,
11400
- link: `https://v3.vuejs.org/guide/migration/v-on-native-modifier-removed.html`
11396
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
11401
11397
  },
11402
11398
  ["COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */]: {
11403
11399
  message: `v-if / v-for precedence when used on the same element has changed ` +
@@ -11405,7 +11401,7 @@ var Vue = (function (exports) {
11405
11401
  `access to v-for scope variables. It is best to avoid the ambiguity ` +
11406
11402
  `with <template> tags or use a computed property that filters v-for ` +
11407
11403
  `data source.`,
11408
- link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
11404
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
11409
11405
  },
11410
11406
  ["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
11411
11407
  message: `<template> with no special directives will render as a native template ` +
@@ -11413,13 +11409,13 @@ var Vue = (function (exports) {
11413
11409
  },
11414
11410
  ["COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */]: {
11415
11411
  message: `"inline-template" has been removed in Vue 3.`,
11416
- link: `https://v3.vuejs.org/guide/migration/inline-template-attribute.html`
11412
+ link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
11417
11413
  },
11418
11414
  ["COMPILER_FILTER" /* COMPILER_FILTERS */]: {
11419
11415
  message: `filters have been removed in Vue 3. ` +
11420
11416
  `The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
11421
11417
  `Use method calls or computed properties instead.`,
11422
- link: `https://v3.vuejs.org/guide/migration/filters.html`
11418
+ link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
11423
11419
  }
11424
11420
  };
11425
11421
  function getCompatValue(key, context) {
@@ -14423,7 +14419,7 @@ var Vue = (function (exports) {
14423
14419
  }
14424
14420
  }
14425
14421
  }
14426
- else {
14422
+ else if (!isBuiltInDirective(name)) {
14427
14423
  // no built-in transform, this is a user custom directive.
14428
14424
  runtimeDirectives.push(prop);
14429
14425
  // custom dirs may use beforeUpdate so they need to force blocks