@vue/runtime-dom 3.4.29 → 3.4.31

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,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.4.29
2
+ * @vue/runtime-dom v3.4.31
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -263,11 +263,14 @@ var VueRuntimeDOM = (function (exports) {
263
263
  return arr.findIndex((item) => looseEqual(item, val));
264
264
  }
265
265
 
266
+ const isRef$1 = (val) => {
267
+ return !!(val && val.__v_isRef === true);
268
+ };
266
269
  const toDisplayString = (val) => {
267
- return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
270
+ return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
268
271
  };
269
272
  const replacer = (_key, val) => {
270
- if (val && val.__v_isRef) {
273
+ if (isRef$1(val)) {
271
274
  return replacer(_key, val.value);
272
275
  } else if (isMap(val)) {
273
276
  return {
@@ -414,7 +417,7 @@ var VueRuntimeDOM = (function (exports) {
414
417
  /**
415
418
  * @internal
416
419
  */
417
- this._dirtyLevel = 5;
420
+ this._dirtyLevel = 4;
418
421
  /**
419
422
  * @internal
420
423
  */
@@ -434,18 +437,14 @@ var VueRuntimeDOM = (function (exports) {
434
437
  recordEffectScope(this, scope);
435
438
  }
436
439
  get dirty() {
437
- if (this._dirtyLevel === 2)
438
- return false;
439
- if (this._dirtyLevel === 3 || this._dirtyLevel === 4) {
440
+ if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
440
441
  this._dirtyLevel = 1;
441
442
  pauseTracking();
442
443
  for (let i = 0; i < this._depsLength; i++) {
443
444
  const dep = this.deps[i];
444
445
  if (dep.computed) {
445
- if (dep.computed.effect._dirtyLevel === 2)
446
- return true;
447
446
  triggerComputed(dep.computed);
448
- if (this._dirtyLevel >= 5) {
447
+ if (this._dirtyLevel >= 4) {
449
448
  break;
450
449
  }
451
450
  }
@@ -455,10 +454,10 @@ var VueRuntimeDOM = (function (exports) {
455
454
  }
456
455
  resetTracking();
457
456
  }
458
- return this._dirtyLevel >= 5;
457
+ return this._dirtyLevel >= 4;
459
458
  }
460
459
  set dirty(v) {
461
- this._dirtyLevel = v ? 5 : 0;
460
+ this._dirtyLevel = v ? 4 : 0;
462
461
  }
463
462
  run() {
464
463
  this._dirtyLevel = 0;
@@ -579,18 +578,9 @@ var VueRuntimeDOM = (function (exports) {
579
578
  var _a;
580
579
  pauseScheduling();
581
580
  for (const effect2 of dep.keys()) {
582
- if (!dep.computed && effect2.computed) {
583
- if (dep.get(effect2) === effect2._trackId && effect2._runnings > 0) {
584
- effect2._dirtyLevel = 2;
585
- continue;
586
- }
587
- }
588
581
  let tracking;
589
582
  if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
590
583
  effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
591
- if (effect2.computed && effect2._dirtyLevel === 2) {
592
- effect2._shouldSchedule = true;
593
- }
594
584
  effect2._dirtyLevel = dirtyLevel;
595
585
  }
596
586
  if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
@@ -598,7 +588,7 @@ var VueRuntimeDOM = (function (exports) {
598
588
  (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
599
589
  }
600
590
  effect2.trigger();
601
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 3) {
591
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
602
592
  effect2._shouldSchedule = false;
603
593
  if (effect2.scheduler) {
604
594
  queueEffectSchedulers.push(effect2.scheduler);
@@ -690,7 +680,7 @@ var VueRuntimeDOM = (function (exports) {
690
680
  if (dep) {
691
681
  triggerEffects(
692
682
  dep,
693
- 5,
683
+ 4,
694
684
  {
695
685
  target,
696
686
  type,
@@ -1293,7 +1283,7 @@ var VueRuntimeDOM = (function (exports) {
1293
1283
  () => getter(this._value),
1294
1284
  () => triggerRefValue(
1295
1285
  this,
1296
- this.effect._dirtyLevel === 3 ? 3 : 4
1286
+ this.effect._dirtyLevel === 2 ? 2 : 3
1297
1287
  )
1298
1288
  );
1299
1289
  this.effect.computed = this;
@@ -1303,7 +1293,7 @@ var VueRuntimeDOM = (function (exports) {
1303
1293
  get value() {
1304
1294
  const self = toRaw(this);
1305
1295
  if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1306
- triggerRefValue(self, 5);
1296
+ triggerRefValue(self, 4);
1307
1297
  }
1308
1298
  trackRefValue(self);
1309
1299
  if (self.effect._dirtyLevel >= 2) {
@@ -1312,7 +1302,7 @@ var VueRuntimeDOM = (function (exports) {
1312
1302
 
1313
1303
  getter: `, this.getter);
1314
1304
  }
1315
- triggerRefValue(self, 3);
1305
+ triggerRefValue(self, 2);
1316
1306
  }
1317
1307
  return self._value;
1318
1308
  }
@@ -1367,7 +1357,7 @@ getter: `, this.getter);
1367
1357
  );
1368
1358
  }
1369
1359
  }
1370
- function triggerRefValue(ref2, dirtyLevel = 5, newVal, oldVal) {
1360
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
1371
1361
  ref2 = toRaw(ref2);
1372
1362
  const dep = ref2.dep;
1373
1363
  if (dep) {
@@ -1418,12 +1408,12 @@ getter: `, this.getter);
1418
1408
  const oldVal = this._rawValue;
1419
1409
  this._rawValue = newVal;
1420
1410
  this._value = useDirectValue ? newVal : toReactive(newVal);
1421
- triggerRefValue(this, 5, newVal, oldVal);
1411
+ triggerRefValue(this, 4, newVal, oldVal);
1422
1412
  }
1423
1413
  }
1424
1414
  }
1425
1415
  function triggerRef(ref2) {
1426
- triggerRefValue(ref2, 5, ref2.value );
1416
+ triggerRefValue(ref2, 4, ref2.value );
1427
1417
  }
1428
1418
  function unref(ref2) {
1429
1419
  return isRef(ref2) ? ref2.value : ref2;
@@ -2751,7 +2741,6 @@ If this is a native custom element, make sure to exclude it from component resol
2751
2741
  }
2752
2742
  },
2753
2743
  hydrate: hydrateSuspense,
2754
- create: createSuspenseBoundary,
2755
2744
  normalize: normalizeSuspenseChildren
2756
2745
  };
2757
2746
  const Suspense = SuspenseImpl ;
@@ -5309,18 +5298,8 @@ If you want to remount the same app, move your app creation logic into a factory
5309
5298
  let domType = node.nodeType;
5310
5299
  vnode.el = node;
5311
5300
  {
5312
- if (!("__vnode" in node)) {
5313
- Object.defineProperty(node, "__vnode", {
5314
- value: vnode,
5315
- enumerable: false
5316
- });
5317
- }
5318
- if (!("__vueParentComponent" in node)) {
5319
- Object.defineProperty(node, "__vueParentComponent", {
5320
- value: parentComponent,
5321
- enumerable: false
5322
- });
5323
- }
5301
+ def(node, "__vnode", vnode, true);
5302
+ def(node, "__vueParentComponent", parentComponent, true);
5324
5303
  }
5325
5304
  if (patchFlag === -2) {
5326
5305
  optimized = false;
@@ -5543,7 +5522,9 @@ Server rendered element contains more child nodes than client vdom.`
5543
5522
  if (props) {
5544
5523
  {
5545
5524
  for (const key in props) {
5546
- if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
5525
+ if (// #11189 skip if this node has directives that have created hooks
5526
+ // as it could have mutated the DOM in any possible way
5527
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
5547
5528
  logMismatchError();
5548
5529
  }
5549
5530
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -5718,7 +5699,6 @@ Server rendered element contains fewer child nodes than client vdom.`
5718
5699
  return [hydrate, hydrateNode];
5719
5700
  }
5720
5701
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5721
- var _a;
5722
5702
  let mismatchType;
5723
5703
  let mismatchKey;
5724
5704
  let actual;
@@ -5741,13 +5721,8 @@ Server rendered element contains fewer child nodes than client vdom.`
5741
5721
  }
5742
5722
  }
5743
5723
  }
5744
- const root = instance == null ? void 0 : instance.subTree;
5745
- if (vnode === root || // eslint-disable-next-line no-restricted-syntax
5746
- (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
5747
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
5748
- for (const key2 in cssVars) {
5749
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
5750
- }
5724
+ if (instance) {
5725
+ resolveCssVars(instance, vnode, expectedMap);
5751
5726
  }
5752
5727
  if (!isMapEqual(actualMap, expectedMap)) {
5753
5728
  mismatchType = mismatchKey = "style";
@@ -5807,8 +5782,8 @@ Server rendered element contains fewer child nodes than client vdom.`
5807
5782
  const styleMap = /* @__PURE__ */ new Map();
5808
5783
  for (const item of str.split(";")) {
5809
5784
  let [key, value] = item.split(":");
5810
- key = key == null ? void 0 : key.trim();
5811
- value = value == null ? void 0 : value.trim();
5785
+ key = key.trim();
5786
+ value = value && value.trim();
5812
5787
  if (key && value) {
5813
5788
  styleMap.set(key, value);
5814
5789
  }
@@ -5826,6 +5801,18 @@ Server rendered element contains fewer child nodes than client vdom.`
5826
5801
  }
5827
5802
  return true;
5828
5803
  }
5804
+ function resolveCssVars(instance, vnode, expectedMap) {
5805
+ const root = instance.subTree;
5806
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
5807
+ const cssVars = instance.getCssVars();
5808
+ for (const key in cssVars) {
5809
+ expectedMap.set(`--${key}`, String(cssVars[key]));
5810
+ }
5811
+ }
5812
+ if (vnode === root && instance.parent) {
5813
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
5814
+ }
5815
+ }
5829
5816
 
5830
5817
  let supported;
5831
5818
  let perf;
@@ -6143,14 +6130,8 @@ Server rendered element contains fewer child nodes than client vdom.`
6143
6130
  }
6144
6131
  }
6145
6132
  {
6146
- Object.defineProperty(el, "__vnode", {
6147
- value: vnode,
6148
- enumerable: false
6149
- });
6150
- Object.defineProperty(el, "__vueParentComponent", {
6151
- value: parentComponent,
6152
- enumerable: false
6153
- });
6133
+ def(el, "__vnode", vnode, true);
6134
+ def(el, "__vueParentComponent", parentComponent, true);
6154
6135
  }
6155
6136
  if (dirs) {
6156
6137
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -6212,6 +6193,9 @@ Server rendered element contains fewer child nodes than client vdom.`
6212
6193
  };
6213
6194
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6214
6195
  const el = n2.el = n1.el;
6196
+ {
6197
+ el.__vnode = n2;
6198
+ }
6215
6199
  let { patchFlag, dynamicChildren, dirs } = n2;
6216
6200
  patchFlag |= n1.patchFlag & 16;
6217
6201
  const oldProps = n1.props || EMPTY_OBJ;
@@ -7106,6 +7090,9 @@ Server rendered element contains fewer child nodes than client vdom.`
7106
7090
  dirs,
7107
7091
  memoIndex
7108
7092
  } = vnode;
7093
+ if (patchFlag === -2) {
7094
+ optimized = false;
7095
+ }
7109
7096
  if (ref != null) {
7110
7097
  setRef(ref, null, parentSuspense, vnode, true);
7111
7098
  }
@@ -7137,7 +7124,6 @@ Server rendered element contains fewer child nodes than client vdom.`
7137
7124
  vnode,
7138
7125
  parentComponent,
7139
7126
  parentSuspense,
7140
- optimized,
7141
7127
  internals,
7142
7128
  doRemove
7143
7129
  );
@@ -8407,7 +8393,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8407
8393
  }
8408
8394
  updateCssVars(n2);
8409
8395
  },
8410
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
8396
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
8411
8397
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
8412
8398
  if (target) {
8413
8399
  hostRemove(targetAnchor);
@@ -9579,7 +9565,7 @@ Component that was made reactive: `,
9579
9565
  return true;
9580
9566
  }
9581
9567
 
9582
- const version = "3.4.29";
9568
+ const version = "3.4.31";
9583
9569
  const warn = warn$1 ;
9584
9570
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9585
9571
  const devtools = devtools$1 ;
@@ -10159,7 +10145,10 @@ Component that was made reactive: `,
10159
10145
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
10160
10146
  el.removeAttribute(key);
10161
10147
  } else {
10162
- el.setAttribute(key, isBoolean ? "" : String(value));
10148
+ el.setAttribute(
10149
+ key,
10150
+ isBoolean ? "" : isSymbol(value) ? String(value) : value
10151
+ );
10163
10152
  }
10164
10153
  }
10165
10154
  }
@@ -10320,7 +10309,7 @@ Expected function or array of functions, received type ${typeof value}.`
10320
10309
  parentSuspense,
10321
10310
  unmountChildren
10322
10311
  );
10323
- if (key === "value" || key === "checked" || key === "selected") {
10312
+ if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
10324
10313
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
10325
10314
  }
10326
10315
  } else {