@vue/compat 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,13 +1,14 @@
1
1
  /**
2
- * @vue/compat v3.5.3
2
+ * @vue/compat v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
6
  /*! #__NO_SIDE_EFFECTS__ */
7
7
  // @__NO_SIDE_EFFECTS__
8
- function makeMap(str, expectsLowerCase) {
9
- const set = new Set(str.split(","));
10
- return (val) => set.has(val);
8
+ function makeMap(str) {
9
+ const map = /* @__PURE__ */ Object.create(null);
10
+ for (const key of str.split(",")) map[key] = 1;
11
+ return (val) => val in map;
11
12
  }
12
13
 
13
14
  const EMPTY_OBJ = Object.freeze({}) ;
@@ -595,9 +596,11 @@ function prepareDeps(sub) {
595
596
  function cleanupDeps(sub) {
596
597
  let head;
597
598
  let tail = sub.depsTail;
598
- for (let link = tail; link; link = link.prevDep) {
599
+ let link = tail;
600
+ while (link) {
601
+ const prev = link.prevDep;
599
602
  if (link.version === -1) {
600
- if (link === tail) tail = link.prevDep;
603
+ if (link === tail) tail = prev;
601
604
  removeSub(link);
602
605
  removeDep(link);
603
606
  } else {
@@ -605,13 +608,14 @@ function cleanupDeps(sub) {
605
608
  }
606
609
  link.dep.activeLink = link.prevActiveLink;
607
610
  link.prevActiveLink = void 0;
611
+ link = prev;
608
612
  }
609
613
  sub.deps = head;
610
614
  sub.depsTail = tail;
611
615
  }
612
616
  function isDirty(sub) {
613
617
  for (let link = sub.deps; link; link = link.nextDep) {
614
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
618
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
615
619
  return true;
616
620
  }
617
621
  }
@@ -621,9 +625,6 @@ function isDirty(sub) {
621
625
  return false;
622
626
  }
623
627
  function refreshComputed(computed) {
624
- if (computed.flags & 2) {
625
- return false;
626
- }
627
628
  if (computed.flags & 4 && !(computed.flags & 16)) {
628
629
  return;
629
630
  }
@@ -736,6 +737,14 @@ function cleanupEffect(e) {
736
737
  }
737
738
 
738
739
  let globalVersion = 0;
740
+ class Link {
741
+ constructor(sub, dep) {
742
+ this.sub = sub;
743
+ this.dep = dep;
744
+ this.version = dep.version;
745
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
746
+ }
747
+ }
739
748
  class Dep {
740
749
  constructor(computed) {
741
750
  this.computed = computed;
@@ -758,16 +767,7 @@ class Dep {
758
767
  }
759
768
  let link = this.activeLink;
760
769
  if (link === void 0 || link.sub !== activeSub) {
761
- link = this.activeLink = {
762
- dep: this,
763
- sub: activeSub,
764
- version: this.version,
765
- nextDep: void 0,
766
- prevDep: void 0,
767
- nextSub: void 0,
768
- prevSub: void 0,
769
- prevActiveLink: void 0
770
- };
770
+ link = this.activeLink = new Link(activeSub, this);
771
771
  if (!activeSub.deps) {
772
772
  activeSub.deps = activeSub.depsTail = link;
773
773
  } else {
@@ -890,9 +890,23 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
890
890
  globalVersion++;
891
891
  return;
892
892
  }
893
- let deps = [];
893
+ const run = (dep) => {
894
+ if (dep) {
895
+ {
896
+ dep.trigger({
897
+ target,
898
+ type,
899
+ key,
900
+ newValue,
901
+ oldValue,
902
+ oldTarget
903
+ });
904
+ }
905
+ }
906
+ };
907
+ startBatch();
894
908
  if (type === "clear") {
895
- deps = [...depsMap.values()];
909
+ depsMap.forEach(run);
896
910
  } else {
897
911
  const targetIsArray = isArray(target);
898
912
  const isArrayIndex = targetIsArray && isIntegerKey(key);
@@ -900,57 +914,43 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
900
914
  const newLength = Number(newValue);
901
915
  depsMap.forEach((dep, key2) => {
902
916
  if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
903
- deps.push(dep);
917
+ run(dep);
904
918
  }
905
919
  });
906
920
  } else {
907
- const push = (dep) => dep && deps.push(dep);
908
921
  if (key !== void 0) {
909
- push(depsMap.get(key));
922
+ run(depsMap.get(key));
910
923
  }
911
924
  if (isArrayIndex) {
912
- push(depsMap.get(ARRAY_ITERATE_KEY));
925
+ run(depsMap.get(ARRAY_ITERATE_KEY));
913
926
  }
914
927
  switch (type) {
915
928
  case "add":
916
929
  if (!targetIsArray) {
917
- push(depsMap.get(ITERATE_KEY));
930
+ run(depsMap.get(ITERATE_KEY));
918
931
  if (isMap(target)) {
919
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
932
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
920
933
  }
921
934
  } else if (isArrayIndex) {
922
- push(depsMap.get("length"));
935
+ run(depsMap.get("length"));
923
936
  }
924
937
  break;
925
938
  case "delete":
926
939
  if (!targetIsArray) {
927
- push(depsMap.get(ITERATE_KEY));
940
+ run(depsMap.get(ITERATE_KEY));
928
941
  if (isMap(target)) {
929
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
942
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
930
943
  }
931
944
  }
932
945
  break;
933
946
  case "set":
934
947
  if (isMap(target)) {
935
- push(depsMap.get(ITERATE_KEY));
948
+ run(depsMap.get(ITERATE_KEY));
936
949
  }
937
950
  break;
938
951
  }
939
952
  }
940
953
  }
941
- startBatch();
942
- for (const dep of deps) {
943
- {
944
- dep.trigger({
945
- target,
946
- type,
947
- key,
948
- newValue,
949
- oldValue,
950
- oldTarget
951
- });
952
- }
953
- }
954
954
  endBatch();
955
955
  }
956
956
  function getDepFromReactive(object, key) {
@@ -1688,7 +1688,7 @@ function toRaw(observed) {
1688
1688
  return raw ? toRaw(raw) : observed;
1689
1689
  }
1690
1690
  function markRaw(value) {
1691
- if (Object.isExtensible(value)) {
1691
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1692
1692
  def(value, "__v_skip", true);
1693
1693
  }
1694
1694
  return value;
@@ -1898,8 +1898,8 @@ class ComputedRefImpl {
1898
1898
  * @internal
1899
1899
  */
1900
1900
  notify() {
1901
+ this.flags |= 16;
1901
1902
  if (activeSub !== this) {
1902
- this.flags |= 16;
1903
1903
  this.dep.notify();
1904
1904
  }
1905
1905
  }
@@ -2587,23 +2587,19 @@ function flushJobs(seen) {
2587
2587
  }
2588
2588
  }
2589
2589
  function checkRecursiveUpdates(seen, fn) {
2590
- if (!seen.has(fn)) {
2591
- seen.set(fn, 1);
2592
- } else {
2593
- const count = seen.get(fn);
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;
2603
- } else {
2604
- seen.set(fn, count + 1);
2605
- }
2590
+ const count = seen.get(fn) || 0;
2591
+ if (count > RECURSION_LIMIT) {
2592
+ const instance = fn.i;
2593
+ const componentName = instance && getComponentName(instance.type);
2594
+ handleError(
2595
+ `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.`,
2596
+ null,
2597
+ 10
2598
+ );
2599
+ return true;
2606
2600
  }
2601
+ seen.set(fn, count + 1);
2602
+ return false;
2607
2603
  }
2608
2604
 
2609
2605
  let isHmrUpdating = false;
@@ -2684,7 +2680,9 @@ function reload(id, newComp) {
2684
2680
  dirtyInstances.delete(instance);
2685
2681
  } else if (instance.parent) {
2686
2682
  queueJob(() => {
2683
+ isHmrUpdating = true;
2687
2684
  instance.parent.update();
2685
+ isHmrUpdating = false;
2688
2686
  dirtyInstances.delete(instance);
2689
2687
  });
2690
2688
  } else if (instance.appContext.reload) {
@@ -3503,6 +3501,9 @@ const TeleportImpl = {
3503
3501
  insert(mainAnchor, container, anchor);
3504
3502
  const mount = (container2, anchor2) => {
3505
3503
  if (shapeFlag & 16) {
3504
+ if (parentComponent && parentComponent.isCE) {
3505
+ parentComponent.ce._teleportTarget = container2;
3506
+ }
3506
3507
  mountChildren(
3507
3508
  children,
3508
3509
  container2,
@@ -4536,7 +4537,11 @@ Server rendered element contains more child nodes than client vdom.`
4536
4537
  remove(cur);
4537
4538
  }
4538
4539
  } else if (shapeFlag & 8) {
4539
- if (el.textContent !== vnode.children) {
4540
+ let clientText = vnode.children;
4541
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4542
+ clientText = clientText.slice(1);
4543
+ }
4544
+ if (el.textContent !== clientText) {
4540
4545
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4541
4546
  warn$1(
4542
4547
  `Hydration text content mismatch on`,
@@ -4735,7 +4740,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4735
4740
  }
4736
4741
  };
4737
4742
  const isTemplateNode = (node) => {
4738
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4743
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4739
4744
  };
4740
4745
  return [hydrate, hydrateNode];
4741
4746
  }
@@ -5087,7 +5092,7 @@ function defineAsyncComponent(source) {
5087
5092
  load().then(() => {
5088
5093
  loaded.value = true;
5089
5094
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5090
- queueJob(instance.parent.update);
5095
+ instance.parent.update();
5091
5096
  }
5092
5097
  }).catch((err) => {
5093
5098
  onError(err);
@@ -5779,13 +5784,15 @@ function renderList(source, renderItem, cache, index) {
5779
5784
  const sourceIsArray = isArray(source);
5780
5785
  if (sourceIsArray || isString(source)) {
5781
5786
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5787
+ let needsWrap = false;
5782
5788
  if (sourceIsReactiveArray) {
5789
+ needsWrap = !isShallow(source);
5783
5790
  source = shallowReadArray(source);
5784
5791
  }
5785
5792
  ret = new Array(source.length);
5786
5793
  for (let i = 0, l = source.length; i < l; i++) {
5787
5794
  ret[i] = renderItem(
5788
- sourceIsReactiveArray ? toReactive(source[i]) : source[i],
5795
+ needsWrap ? toReactive(source[i]) : source[i],
5789
5796
  i,
5790
5797
  void 0,
5791
5798
  cached && cached[i]
@@ -7036,7 +7043,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7036
7043
  return vm;
7037
7044
  }
7038
7045
  }
7039
- Vue.version = `2.6.14-compat:${"3.5.3"}`;
7046
+ Vue.version = `2.6.14-compat:${"3.5.5"}`;
7040
7047
  Vue.config = singletonApp.config;
7041
7048
  Vue.use = (plugin, ...options) => {
7042
7049
  if (plugin && isFunction(plugin.install)) {
@@ -8858,6 +8865,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8858
8865
  }
8859
8866
  }
8860
8867
  if (instance.asyncDep) {
8868
+ if (isHmrUpdating) initialVNode.el = null;
8861
8869
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8862
8870
  if (!initialVNode.el) {
8863
8871
  const placeholder = instance.subTree = createVNode(Comment);
@@ -12149,7 +12157,7 @@ function isMemoSame(cached, memo) {
12149
12157
  return true;
12150
12158
  }
12151
12159
 
12152
- const version = "3.5.3";
12160
+ const version = "3.5.5";
12153
12161
  const warn = warn$1 ;
12154
12162
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12155
12163
  const devtools = devtools$1 ;
@@ -13137,6 +13145,7 @@ class VueElement extends BaseClass {
13137
13145
  }
13138
13146
  }
13139
13147
  connectedCallback() {
13148
+ if (!this.isConnected) return;
13140
13149
  if (!this.shadowRoot) {
13141
13150
  this._parseSlots();
13142
13151
  }
@@ -13179,7 +13188,7 @@ class VueElement extends BaseClass {
13179
13188
  this._ob = null;
13180
13189
  }
13181
13190
  this._app && this._app.unmount();
13182
- this._instance.ce = void 0;
13191
+ if (this._instance) this._instance.ce = void 0;
13183
13192
  this._app = this._instance = null;
13184
13193
  }
13185
13194
  });
@@ -13398,7 +13407,7 @@ class VueElement extends BaseClass {
13398
13407
  }
13399
13408
  }
13400
13409
  /**
13401
- * Only called when shaddowRoot is false
13410
+ * Only called when shadowRoot is false
13402
13411
  */
13403
13412
  _parseSlots() {
13404
13413
  const slots = this._slots = {};
@@ -13410,10 +13419,10 @@ class VueElement extends BaseClass {
13410
13419
  }
13411
13420
  }
13412
13421
  /**
13413
- * Only called when shaddowRoot is false
13422
+ * Only called when shadowRoot is false
13414
13423
  */
13415
13424
  _renderSlots() {
13416
- const outlets = this.querySelectorAll("slot");
13425
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13417
13426
  const scopeId = this._instance.type.__scopeId;
13418
13427
  for (let i = 0; i < outlets.length; i++) {
13419
13428
  const o = outlets[i];
@@ -13601,7 +13610,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13601
13610
  child,
13602
13611
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
13603
13612
  );
13604
- } else {
13613
+ } else if (child.type !== Text) {
13605
13614
  warn(`<TransitionGroup> children must be keyed.`);
13606
13615
  }
13607
13616
  }