@vue/runtime-dom 3.5.3 → 3.5.5

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,9 +1,9 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.3
2
+ * @vue/runtime-dom v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- import { warn, h, BaseTransition, assertNumber, BaseTransitionPropsValidators, getCurrentInstance, onBeforeMount, watchPostEffect, onMounted, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
6
+ import { warn, h, BaseTransition, assertNumber, BaseTransitionPropsValidators, getCurrentInstance, onBeforeMount, watchPostEffect, onMounted, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, Text, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
7
7
  export * from '@vue/runtime-core';
8
8
  import { extend, isObject, toNumber, isArray, isString, hyphenate, capitalize, includeBooleanAttr, isSymbol, isSpecialBooleanAttr, isFunction, NOOP, isOn, isModelListener, isPlainObject, hasOwn, camelize as camelize$1, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
9
9
 
@@ -885,6 +885,7 @@ class VueElement extends BaseClass {
885
885
  }
886
886
  }
887
887
  connectedCallback() {
888
+ if (!this.isConnected) return;
888
889
  if (!this.shadowRoot) {
889
890
  this._parseSlots();
890
891
  }
@@ -927,7 +928,7 @@ class VueElement extends BaseClass {
927
928
  this._ob = null;
928
929
  }
929
930
  this._app && this._app.unmount();
930
- this._instance.ce = void 0;
931
+ if (this._instance) this._instance.ce = void 0;
931
932
  this._app = this._instance = null;
932
933
  }
933
934
  });
@@ -1146,7 +1147,7 @@ class VueElement extends BaseClass {
1146
1147
  }
1147
1148
  }
1148
1149
  /**
1149
- * Only called when shaddowRoot is false
1150
+ * Only called when shadowRoot is false
1150
1151
  */
1151
1152
  _parseSlots() {
1152
1153
  const slots = this._slots = {};
@@ -1158,10 +1159,10 @@ class VueElement extends BaseClass {
1158
1159
  }
1159
1160
  }
1160
1161
  /**
1161
- * Only called when shaddowRoot is false
1162
+ * Only called when shadowRoot is false
1162
1163
  */
1163
1164
  _renderSlots() {
1164
- const outlets = this.querySelectorAll("slot");
1165
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
1165
1166
  const scopeId = this._instance.type.__scopeId;
1166
1167
  for (let i = 0; i < outlets.length; i++) {
1167
1168
  const o = outlets[i];
@@ -1340,7 +1341,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1340
1341
  child,
1341
1342
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
1342
1343
  );
1343
- } else if (!!(process.env.NODE_ENV !== "production")) {
1344
+ } else if (!!(process.env.NODE_ENV !== "production") && child.type !== Text) {
1344
1345
  warn(`<TransitionGroup> children must be keyed.`);
1345
1346
  }
1346
1347
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.3
2
+ * @vue/runtime-dom v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -8,9 +8,10 @@ var VueRuntimeDOM = (function (exports) {
8
8
 
9
9
  /*! #__NO_SIDE_EFFECTS__ */
10
10
  // @__NO_SIDE_EFFECTS__
11
- function makeMap(str, expectsLowerCase) {
12
- const set = new Set(str.split(","));
13
- return (val) => set.has(val);
11
+ function makeMap(str) {
12
+ const map = /* @__PURE__ */ Object.create(null);
13
+ for (const key of str.split(",")) map[key] = 1;
14
+ return (val) => val in map;
14
15
  }
15
16
 
16
17
  const EMPTY_OBJ = Object.freeze({}) ;
@@ -598,9 +599,11 @@ var VueRuntimeDOM = (function (exports) {
598
599
  function cleanupDeps(sub) {
599
600
  let head;
600
601
  let tail = sub.depsTail;
601
- for (let link = tail; link; link = link.prevDep) {
602
+ let link = tail;
603
+ while (link) {
604
+ const prev = link.prevDep;
602
605
  if (link.version === -1) {
603
- if (link === tail) tail = link.prevDep;
606
+ if (link === tail) tail = prev;
604
607
  removeSub(link);
605
608
  removeDep(link);
606
609
  } else {
@@ -608,13 +611,14 @@ var VueRuntimeDOM = (function (exports) {
608
611
  }
609
612
  link.dep.activeLink = link.prevActiveLink;
610
613
  link.prevActiveLink = void 0;
614
+ link = prev;
611
615
  }
612
616
  sub.deps = head;
613
617
  sub.depsTail = tail;
614
618
  }
615
619
  function isDirty(sub) {
616
620
  for (let link = sub.deps; link; link = link.nextDep) {
617
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
621
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
618
622
  return true;
619
623
  }
620
624
  }
@@ -624,9 +628,6 @@ var VueRuntimeDOM = (function (exports) {
624
628
  return false;
625
629
  }
626
630
  function refreshComputed(computed) {
627
- if (computed.flags & 2) {
628
- return false;
629
- }
630
631
  if (computed.flags & 4 && !(computed.flags & 16)) {
631
632
  return;
632
633
  }
@@ -739,6 +740,14 @@ var VueRuntimeDOM = (function (exports) {
739
740
  }
740
741
 
741
742
  let globalVersion = 0;
743
+ class Link {
744
+ constructor(sub, dep) {
745
+ this.sub = sub;
746
+ this.dep = dep;
747
+ this.version = dep.version;
748
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
749
+ }
750
+ }
742
751
  class Dep {
743
752
  constructor(computed) {
744
753
  this.computed = computed;
@@ -761,16 +770,7 @@ var VueRuntimeDOM = (function (exports) {
761
770
  }
762
771
  let link = this.activeLink;
763
772
  if (link === void 0 || link.sub !== activeSub) {
764
- link = this.activeLink = {
765
- dep: this,
766
- sub: activeSub,
767
- version: this.version,
768
- nextDep: void 0,
769
- prevDep: void 0,
770
- nextSub: void 0,
771
- prevSub: void 0,
772
- prevActiveLink: void 0
773
- };
773
+ link = this.activeLink = new Link(activeSub, this);
774
774
  if (!activeSub.deps) {
775
775
  activeSub.deps = activeSub.depsTail = link;
776
776
  } else {
@@ -893,9 +893,23 @@ var VueRuntimeDOM = (function (exports) {
893
893
  globalVersion++;
894
894
  return;
895
895
  }
896
- let deps = [];
896
+ const run = (dep) => {
897
+ if (dep) {
898
+ {
899
+ dep.trigger({
900
+ target,
901
+ type,
902
+ key,
903
+ newValue,
904
+ oldValue,
905
+ oldTarget
906
+ });
907
+ }
908
+ }
909
+ };
910
+ startBatch();
897
911
  if (type === "clear") {
898
- deps = [...depsMap.values()];
912
+ depsMap.forEach(run);
899
913
  } else {
900
914
  const targetIsArray = isArray(target);
901
915
  const isArrayIndex = targetIsArray && isIntegerKey(key);
@@ -903,57 +917,43 @@ var VueRuntimeDOM = (function (exports) {
903
917
  const newLength = Number(newValue);
904
918
  depsMap.forEach((dep, key2) => {
905
919
  if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
906
- deps.push(dep);
920
+ run(dep);
907
921
  }
908
922
  });
909
923
  } else {
910
- const push = (dep) => dep && deps.push(dep);
911
924
  if (key !== void 0) {
912
- push(depsMap.get(key));
925
+ run(depsMap.get(key));
913
926
  }
914
927
  if (isArrayIndex) {
915
- push(depsMap.get(ARRAY_ITERATE_KEY));
928
+ run(depsMap.get(ARRAY_ITERATE_KEY));
916
929
  }
917
930
  switch (type) {
918
931
  case "add":
919
932
  if (!targetIsArray) {
920
- push(depsMap.get(ITERATE_KEY));
933
+ run(depsMap.get(ITERATE_KEY));
921
934
  if (isMap(target)) {
922
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
935
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
923
936
  }
924
937
  } else if (isArrayIndex) {
925
- push(depsMap.get("length"));
938
+ run(depsMap.get("length"));
926
939
  }
927
940
  break;
928
941
  case "delete":
929
942
  if (!targetIsArray) {
930
- push(depsMap.get(ITERATE_KEY));
943
+ run(depsMap.get(ITERATE_KEY));
931
944
  if (isMap(target)) {
932
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
945
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
933
946
  }
934
947
  }
935
948
  break;
936
949
  case "set":
937
950
  if (isMap(target)) {
938
- push(depsMap.get(ITERATE_KEY));
951
+ run(depsMap.get(ITERATE_KEY));
939
952
  }
940
953
  break;
941
954
  }
942
955
  }
943
956
  }
944
- startBatch();
945
- for (const dep of deps) {
946
- {
947
- dep.trigger({
948
- target,
949
- type,
950
- key,
951
- newValue,
952
- oldValue,
953
- oldTarget
954
- });
955
- }
956
- }
957
957
  endBatch();
958
958
  }
959
959
  function getDepFromReactive(object, key) {
@@ -1691,7 +1691,7 @@ var VueRuntimeDOM = (function (exports) {
1691
1691
  return raw ? toRaw(raw) : observed;
1692
1692
  }
1693
1693
  function markRaw(value) {
1694
- if (Object.isExtensible(value)) {
1694
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1695
1695
  def(value, "__v_skip", true);
1696
1696
  }
1697
1697
  return value;
@@ -1901,8 +1901,8 @@ var VueRuntimeDOM = (function (exports) {
1901
1901
  * @internal
1902
1902
  */
1903
1903
  notify() {
1904
+ this.flags |= 16;
1904
1905
  if (activeSub !== this) {
1905
- this.flags |= 16;
1906
1906
  this.dep.notify();
1907
1907
  }
1908
1908
  }
@@ -2590,23 +2590,19 @@ var VueRuntimeDOM = (function (exports) {
2590
2590
  }
2591
2591
  }
2592
2592
  function checkRecursiveUpdates(seen, fn) {
2593
- if (!seen.has(fn)) {
2594
- seen.set(fn, 1);
2595
- } else {
2596
- const count = seen.get(fn);
2597
- if (count > RECURSION_LIMIT) {
2598
- const instance = fn.i;
2599
- const componentName = instance && getComponentName(instance.type);
2600
- handleError(
2601
- `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2602
- null,
2603
- 10
2604
- );
2605
- return true;
2606
- } else {
2607
- seen.set(fn, count + 1);
2608
- }
2593
+ const count = seen.get(fn) || 0;
2594
+ if (count > RECURSION_LIMIT) {
2595
+ const instance = fn.i;
2596
+ const componentName = instance && getComponentName(instance.type);
2597
+ handleError(
2598
+ `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2599
+ null,
2600
+ 10
2601
+ );
2602
+ return true;
2609
2603
  }
2604
+ seen.set(fn, count + 1);
2605
+ return false;
2610
2606
  }
2611
2607
 
2612
2608
  let isHmrUpdating = false;
@@ -2687,7 +2683,9 @@ var VueRuntimeDOM = (function (exports) {
2687
2683
  dirtyInstances.delete(instance);
2688
2684
  } else if (instance.parent) {
2689
2685
  queueJob(() => {
2686
+ isHmrUpdating = true;
2690
2687
  instance.parent.update();
2688
+ isHmrUpdating = false;
2691
2689
  dirtyInstances.delete(instance);
2692
2690
  });
2693
2691
  } else if (instance.appContext.reload) {
@@ -2978,6 +2976,9 @@ var VueRuntimeDOM = (function (exports) {
2978
2976
  insert(mainAnchor, container, anchor);
2979
2977
  const mount = (container2, anchor2) => {
2980
2978
  if (shapeFlag & 16) {
2979
+ if (parentComponent && parentComponent.isCE) {
2980
+ parentComponent.ce._teleportTarget = container2;
2981
+ }
2981
2982
  mountChildren(
2982
2983
  children,
2983
2984
  container2,
@@ -4008,7 +4009,11 @@ Server rendered element contains more child nodes than client vdom.`
4008
4009
  remove(cur);
4009
4010
  }
4010
4011
  } else if (shapeFlag & 8) {
4011
- if (el.textContent !== vnode.children) {
4012
+ let clientText = vnode.children;
4013
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4014
+ clientText = clientText.slice(1);
4015
+ }
4016
+ if (el.textContent !== clientText) {
4012
4017
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4013
4018
  warn$1(
4014
4019
  `Hydration text content mismatch on`,
@@ -4207,7 +4212,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4207
4212
  }
4208
4213
  };
4209
4214
  const isTemplateNode = (node) => {
4210
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4215
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4211
4216
  };
4212
4217
  return [hydrate, hydrateNode];
4213
4218
  }
@@ -4559,7 +4564,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4559
4564
  load().then(() => {
4560
4565
  loaded.value = true;
4561
4566
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4562
- queueJob(instance.parent.update);
4567
+ instance.parent.update();
4563
4568
  }
4564
4569
  }).catch((err) => {
4565
4570
  onError(err);
@@ -4954,13 +4959,15 @@ If this is a native custom element, make sure to exclude it from component resol
4954
4959
  const sourceIsArray = isArray(source);
4955
4960
  if (sourceIsArray || isString(source)) {
4956
4961
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
4962
+ let needsWrap = false;
4957
4963
  if (sourceIsReactiveArray) {
4964
+ needsWrap = !isShallow(source);
4958
4965
  source = shallowReadArray(source);
4959
4966
  }
4960
4967
  ret = new Array(source.length);
4961
4968
  for (let i = 0, l = source.length; i < l; i++) {
4962
4969
  ret[i] = renderItem(
4963
- sourceIsReactiveArray ? toReactive(source[i]) : source[i],
4970
+ needsWrap ? toReactive(source[i]) : source[i],
4964
4971
  i,
4965
4972
  void 0,
4966
4973
  cached && cached[i]
@@ -7230,6 +7237,7 @@ If you want to remount the same app, move your app creation logic into a factory
7230
7237
  }
7231
7238
  }
7232
7239
  if (instance.asyncDep) {
7240
+ if (isHmrUpdating) initialVNode.el = null;
7233
7241
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
7234
7242
  if (!initialVNode.el) {
7235
7243
  const placeholder = instance.subTree = createVNode(Comment);
@@ -10345,7 +10353,7 @@ Component that was made reactive: `,
10345
10353
  return true;
10346
10354
  }
10347
10355
 
10348
- const version = "3.5.3";
10356
+ const version = "3.5.5";
10349
10357
  const warn = warn$1 ;
10350
10358
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10351
10359
  const devtools = devtools$1 ;
@@ -11226,6 +11234,7 @@ Expected function or array of functions, received type ${typeof value}.`
11226
11234
  }
11227
11235
  }
11228
11236
  connectedCallback() {
11237
+ if (!this.isConnected) return;
11229
11238
  if (!this.shadowRoot) {
11230
11239
  this._parseSlots();
11231
11240
  }
@@ -11268,7 +11277,7 @@ Expected function or array of functions, received type ${typeof value}.`
11268
11277
  this._ob = null;
11269
11278
  }
11270
11279
  this._app && this._app.unmount();
11271
- this._instance.ce = void 0;
11280
+ if (this._instance) this._instance.ce = void 0;
11272
11281
  this._app = this._instance = null;
11273
11282
  }
11274
11283
  });
@@ -11487,7 +11496,7 @@ Expected function or array of functions, received type ${typeof value}.`
11487
11496
  }
11488
11497
  }
11489
11498
  /**
11490
- * Only called when shaddowRoot is false
11499
+ * Only called when shadowRoot is false
11491
11500
  */
11492
11501
  _parseSlots() {
11493
11502
  const slots = this._slots = {};
@@ -11499,10 +11508,10 @@ Expected function or array of functions, received type ${typeof value}.`
11499
11508
  }
11500
11509
  }
11501
11510
  /**
11502
- * Only called when shaddowRoot is false
11511
+ * Only called when shadowRoot is false
11503
11512
  */
11504
11513
  _renderSlots() {
11505
- const outlets = this.querySelectorAll("slot");
11514
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11506
11515
  const scopeId = this._instance.type.__scopeId;
11507
11516
  for (let i = 0; i < outlets.length; i++) {
11508
11517
  const o = outlets[i];
@@ -11669,7 +11678,7 @@ Expected function or array of functions, received type ${typeof value}.`
11669
11678
  child,
11670
11679
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
11671
11680
  );
11672
- } else {
11681
+ } else if (child.type !== Text) {
11673
11682
  warn(`<TransitionGroup> children must be keyed.`);
11674
11683
  }
11675
11684
  }