@vue/compat 3.5.8 → 3.5.10

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/compat v3.5.8
2
+ * @vue/compat v3.5.10
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -106,6 +106,12 @@ let _globalThis;
106
106
  const getGlobalThis = () => {
107
107
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
108
108
  };
109
+ function genCacheKey(source, options) {
110
+ return source + JSON.stringify(
111
+ options,
112
+ (_, val) => typeof val === "function" ? val.toString() : val
113
+ );
114
+ }
109
115
 
110
116
  const PatchFlagNames = {
111
117
  [1]: `TEXT`,
@@ -639,9 +645,17 @@ function endBatch() {
639
645
  let error;
640
646
  while (batchedSub) {
641
647
  let e = batchedSub;
648
+ let next;
649
+ while (e) {
650
+ if (!(e.flags & 1)) {
651
+ e.flags &= ~8;
652
+ }
653
+ e = e.next;
654
+ }
655
+ e = batchedSub;
642
656
  batchedSub = void 0;
643
657
  while (e) {
644
- const next = e.next;
658
+ next = e.next;
645
659
  e.next = void 0;
646
660
  e.flags &= ~8;
647
661
  if (e.flags & 1) {
@@ -664,7 +678,7 @@ function prepareDeps(sub) {
664
678
  link.dep.activeLink = link;
665
679
  }
666
680
  }
667
- function cleanupDeps(sub, fromComputed = false) {
681
+ function cleanupDeps(sub) {
668
682
  let head;
669
683
  let tail = sub.depsTail;
670
684
  let link = tail;
@@ -672,7 +686,7 @@ function cleanupDeps(sub, fromComputed = false) {
672
686
  const prev = link.prevDep;
673
687
  if (link.version === -1) {
674
688
  if (link === tail) tail = prev;
675
- removeSub(link, fromComputed);
689
+ removeSub(link);
676
690
  removeDep(link);
677
691
  } else {
678
692
  head = link;
@@ -727,11 +741,11 @@ function refreshComputed(computed) {
727
741
  } finally {
728
742
  activeSub = prevSub;
729
743
  shouldTrack = prevShouldTrack;
730
- cleanupDeps(computed, true);
744
+ cleanupDeps(computed);
731
745
  computed.flags &= ~2;
732
746
  }
733
747
  }
734
- function removeSub(link, fromComputed = false) {
748
+ function removeSub(link, soft = false) {
735
749
  const { dep, prevSub, nextSub } = link;
736
750
  if (prevSub) {
737
751
  prevSub.nextSub = nextSub;
@@ -747,17 +761,15 @@ function removeSub(link, fromComputed = false) {
747
761
  if (dep.subsHead === link) {
748
762
  dep.subsHead = nextSub;
749
763
  }
750
- if (!dep.subs) {
751
- if (dep.computed) {
752
- dep.computed.flags &= ~4;
753
- for (let l = dep.computed.deps; l; l = l.nextDep) {
754
- removeSub(l, true);
755
- }
756
- } else if (dep.map && !fromComputed) {
757
- dep.map.delete(dep.key);
758
- if (!dep.map.size) targetMap.delete(dep.target);
764
+ if (!dep.subs && dep.computed) {
765
+ dep.computed.flags &= ~4;
766
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
767
+ removeSub(l, true);
759
768
  }
760
769
  }
770
+ if (!soft && !--dep.sc && dep.map) {
771
+ dep.map.delete(dep.key);
772
+ }
761
773
  }
762
774
  function removeDep(link) {
763
775
  const { prevDep, nextDep } = link;
@@ -842,6 +854,10 @@ class Dep {
842
854
  this.target = void 0;
843
855
  this.map = void 0;
844
856
  this.key = void 0;
857
+ /**
858
+ * Subscriber counter
859
+ */
860
+ this.sc = 0;
845
861
  {
846
862
  this.subsHead = void 0;
847
863
  }
@@ -860,9 +876,7 @@ class Dep {
860
876
  activeSub.depsTail.nextDep = link;
861
877
  activeSub.depsTail = link;
862
878
  }
863
- if (activeSub.flags & 4) {
864
- addSub(link);
865
- }
879
+ addSub(link);
866
880
  } else if (link.version === -1) {
867
881
  link.version = this.version;
868
882
  if (link.nextDep) {
@@ -926,22 +940,25 @@ class Dep {
926
940
  }
927
941
  }
928
942
  function addSub(link) {
929
- const computed = link.dep.computed;
930
- if (computed && !link.dep.subs) {
931
- computed.flags |= 4 | 16;
932
- for (let l = computed.deps; l; l = l.nextDep) {
933
- addSub(l);
943
+ link.dep.sc++;
944
+ if (link.sub.flags & 4) {
945
+ const computed = link.dep.computed;
946
+ if (computed && !link.dep.subs) {
947
+ computed.flags |= 4 | 16;
948
+ for (let l = computed.deps; l; l = l.nextDep) {
949
+ addSub(l);
950
+ }
934
951
  }
952
+ const currentTail = link.dep.subs;
953
+ if (currentTail !== link) {
954
+ link.prevSub = currentTail;
955
+ if (currentTail) currentTail.nextSub = link;
956
+ }
957
+ if (link.dep.subsHead === void 0) {
958
+ link.dep.subsHead = link;
959
+ }
960
+ link.dep.subs = link;
935
961
  }
936
- const currentTail = link.dep.subs;
937
- if (currentTail !== link) {
938
- link.prevSub = currentTail;
939
- if (currentTail) currentTail.nextSub = link;
940
- }
941
- if (link.dep.subsHead === void 0) {
942
- link.dep.subsHead = link;
943
- }
944
- link.dep.subs = link;
945
962
  }
946
963
  const targetMap = /* @__PURE__ */ new WeakMap();
947
964
  const ITERATE_KEY = Symbol(
@@ -1045,8 +1062,8 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
1045
1062
  endBatch();
1046
1063
  }
1047
1064
  function getDepFromReactive(object, key) {
1048
- var _a;
1049
- return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
1065
+ const depMap = targetMap.get(object);
1066
+ return depMap && depMap.get(key);
1050
1067
  }
1051
1068
 
1052
1069
  function reactiveReadArray(array) {
@@ -1982,6 +1999,10 @@ class ComputedRefImpl {
1982
1999
  * @internal
1983
2000
  */
1984
2001
  this.globalVersion = globalVersion - 1;
2002
+ /**
2003
+ * @internal
2004
+ */
2005
+ this.next = void 0;
1985
2006
  // for backwards compat
1986
2007
  this.effect = this;
1987
2008
  this["__v_isReadonly"] = !setter;
@@ -4229,6 +4250,7 @@ function useId() {
4229
4250
  `useId() is called when there is no active component instance to be associated with.`
4230
4251
  );
4231
4252
  }
4253
+ return "";
4232
4254
  }
4233
4255
  function markAsyncBoundary(instance) {
4234
4256
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
@@ -7150,7 +7172,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7150
7172
  return vm;
7151
7173
  }
7152
7174
  }
7153
- Vue.version = `2.6.14-compat:${"3.5.8"}`;
7175
+ Vue.version = `2.6.14-compat:${"3.5.10"}`;
7154
7176
  Vue.config = singletonApp.config;
7155
7177
  Vue.use = (plugin, ...options) => {
7156
7178
  if (plugin && isFunction(plugin.install)) {
@@ -11508,7 +11530,7 @@ function normalizeVNode(child) {
11508
11530
  // #3666, avoid reference pollution when reusing vnode
11509
11531
  child.slice()
11510
11532
  );
11511
- } else if (typeof child === "object") {
11533
+ } else if (isVNode(child)) {
11512
11534
  return cloneIfMounted(child);
11513
11535
  } else {
11514
11536
  return createVNode(Text, null, String(child));
@@ -12265,7 +12287,7 @@ function isMemoSame(cached, memo) {
12265
12287
  return true;
12266
12288
  }
12267
12289
 
12268
- const version = "3.5.8";
12290
+ const version = "3.5.10";
12269
12291
  const warn = warn$1 ;
12270
12292
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12271
12293
  const devtools = devtools$1 ;
@@ -13140,6 +13162,11 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
13140
13162
  if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
13141
13163
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
13142
13164
  }
13165
+ } else if (
13166
+ // #11081 force set props for possible async custom element
13167
+ el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
13168
+ ) {
13169
+ patchDOMProp(el, camelize(key), nextValue, parentComponent);
13143
13170
  } else {
13144
13171
  if (key === "true-value") {
13145
13172
  el._trueValue = nextValue;
@@ -13180,13 +13207,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
13180
13207
  if (isNativeOn(key) && isString(value)) {
13181
13208
  return false;
13182
13209
  }
13183
- if (key in el) {
13184
- return true;
13185
- }
13186
- if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
13187
- return true;
13188
- }
13189
- return false;
13210
+ return key in el;
13190
13211
  }
13191
13212
 
13192
13213
  const REMOVAL = {};
@@ -13872,7 +13893,7 @@ const vModelCheckbox = {
13872
13893
  setChecked(el, binding, vnode);
13873
13894
  }
13874
13895
  };
13875
- function setChecked(el, { value, oldValue }, vnode) {
13896
+ function setChecked(el, { value }, vnode) {
13876
13897
  el._modelValue = value;
13877
13898
  let checked;
13878
13899
  if (isArray(value)) {
@@ -13922,19 +13943,19 @@ const vModelSelect = {
13922
13943
  },
13923
13944
  // set value in mounted & updated because <select> relies on its children
13924
13945
  // <option>s.
13925
- mounted(el, { value, modifiers: { number } }) {
13946
+ mounted(el, { value }) {
13926
13947
  setSelected(el, value);
13927
13948
  },
13928
13949
  beforeUpdate(el, _binding, vnode) {
13929
13950
  el[assignKey] = getModelAssigner(vnode);
13930
13951
  },
13931
- updated(el, { value, modifiers: { number } }) {
13952
+ updated(el, { value }) {
13932
13953
  if (!el._assigning) {
13933
13954
  setSelected(el, value);
13934
13955
  }
13935
13956
  }
13936
13957
  };
13937
- function setSelected(el, value, number) {
13958
+ function setSelected(el, value) {
13938
13959
  const isMultiple = el.multiple;
13939
13960
  const isArrayValue = isArray(value);
13940
13961
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -20411,7 +20432,7 @@ function compileToFunction(template, options) {
20411
20432
  return NOOP;
20412
20433
  }
20413
20434
  }
20414
- const key = template;
20435
+ const key = genCacheKey(template, options);
20415
20436
  const cached = compileCache[key];
20416
20437
  if (cached) {
20417
20438
  return cached;