@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -117,6 +117,12 @@ const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
117
117
  function genPropsAccessExp(name) {
118
118
  return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
119
119
  }
120
+ function genCacheKey(source, options) {
121
+ return source + JSON.stringify(
122
+ options,
123
+ (_, val) => typeof val === "function" ? val.toString() : val
124
+ );
125
+ }
120
126
 
121
127
  const PatchFlagNames = {
122
128
  [1]: `TEXT`,
@@ -692,9 +698,17 @@ function endBatch() {
692
698
  let error;
693
699
  while (batchedSub) {
694
700
  let e = batchedSub;
701
+ let next;
702
+ while (e) {
703
+ if (!(e.flags & 1)) {
704
+ e.flags &= ~8;
705
+ }
706
+ e = e.next;
707
+ }
708
+ e = batchedSub;
695
709
  batchedSub = void 0;
696
710
  while (e) {
697
- const next = e.next;
711
+ next = e.next;
698
712
  e.next = void 0;
699
713
  e.flags &= ~8;
700
714
  if (e.flags & 1) {
@@ -717,7 +731,7 @@ function prepareDeps(sub) {
717
731
  link.dep.activeLink = link;
718
732
  }
719
733
  }
720
- function cleanupDeps(sub, fromComputed = false) {
734
+ function cleanupDeps(sub) {
721
735
  let head;
722
736
  let tail = sub.depsTail;
723
737
  let link = tail;
@@ -725,7 +739,7 @@ function cleanupDeps(sub, fromComputed = false) {
725
739
  const prev = link.prevDep;
726
740
  if (link.version === -1) {
727
741
  if (link === tail) tail = prev;
728
- removeSub(link, fromComputed);
742
+ removeSub(link);
729
743
  removeDep(link);
730
744
  } else {
731
745
  head = link;
@@ -780,11 +794,11 @@ function refreshComputed(computed) {
780
794
  } finally {
781
795
  activeSub = prevSub;
782
796
  shouldTrack = prevShouldTrack;
783
- cleanupDeps(computed, true);
797
+ cleanupDeps(computed);
784
798
  computed.flags &= ~2;
785
799
  }
786
800
  }
787
- function removeSub(link, fromComputed = false) {
801
+ function removeSub(link, soft = false) {
788
802
  const { dep, prevSub, nextSub } = link;
789
803
  if (prevSub) {
790
804
  prevSub.nextSub = nextSub;
@@ -800,17 +814,15 @@ function removeSub(link, fromComputed = false) {
800
814
  if (dep.subsHead === link) {
801
815
  dep.subsHead = nextSub;
802
816
  }
803
- if (!dep.subs) {
804
- if (dep.computed) {
805
- dep.computed.flags &= ~4;
806
- for (let l = dep.computed.deps; l; l = l.nextDep) {
807
- removeSub(l, true);
808
- }
809
- } else if (dep.map && !fromComputed) {
810
- dep.map.delete(dep.key);
811
- if (!dep.map.size) targetMap.delete(dep.target);
817
+ if (!dep.subs && dep.computed) {
818
+ dep.computed.flags &= ~4;
819
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
820
+ removeSub(l, true);
812
821
  }
813
822
  }
823
+ if (!soft && !--dep.sc && dep.map) {
824
+ dep.map.delete(dep.key);
825
+ }
814
826
  }
815
827
  function removeDep(link) {
816
828
  const { prevDep, nextDep } = link;
@@ -895,6 +907,10 @@ class Dep {
895
907
  this.target = void 0;
896
908
  this.map = void 0;
897
909
  this.key = void 0;
910
+ /**
911
+ * Subscriber counter
912
+ */
913
+ this.sc = 0;
898
914
  {
899
915
  this.subsHead = void 0;
900
916
  }
@@ -913,9 +929,7 @@ class Dep {
913
929
  activeSub.depsTail.nextDep = link;
914
930
  activeSub.depsTail = link;
915
931
  }
916
- if (activeSub.flags & 4) {
917
- addSub(link);
918
- }
932
+ addSub(link);
919
933
  } else if (link.version === -1) {
920
934
  link.version = this.version;
921
935
  if (link.nextDep) {
@@ -979,22 +993,25 @@ class Dep {
979
993
  }
980
994
  }
981
995
  function addSub(link) {
982
- const computed = link.dep.computed;
983
- if (computed && !link.dep.subs) {
984
- computed.flags |= 4 | 16;
985
- for (let l = computed.deps; l; l = l.nextDep) {
986
- addSub(l);
996
+ link.dep.sc++;
997
+ if (link.sub.flags & 4) {
998
+ const computed = link.dep.computed;
999
+ if (computed && !link.dep.subs) {
1000
+ computed.flags |= 4 | 16;
1001
+ for (let l = computed.deps; l; l = l.nextDep) {
1002
+ addSub(l);
1003
+ }
987
1004
  }
1005
+ const currentTail = link.dep.subs;
1006
+ if (currentTail !== link) {
1007
+ link.prevSub = currentTail;
1008
+ if (currentTail) currentTail.nextSub = link;
1009
+ }
1010
+ if (link.dep.subsHead === void 0) {
1011
+ link.dep.subsHead = link;
1012
+ }
1013
+ link.dep.subs = link;
988
1014
  }
989
- const currentTail = link.dep.subs;
990
- if (currentTail !== link) {
991
- link.prevSub = currentTail;
992
- if (currentTail) currentTail.nextSub = link;
993
- }
994
- if (link.dep.subsHead === void 0) {
995
- link.dep.subsHead = link;
996
- }
997
- link.dep.subs = link;
998
1015
  }
999
1016
  const targetMap = /* @__PURE__ */ new WeakMap();
1000
1017
  const ITERATE_KEY = Symbol(
@@ -1098,8 +1115,8 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
1098
1115
  endBatch();
1099
1116
  }
1100
1117
  function getDepFromReactive(object, key) {
1101
- var _a;
1102
- return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
1118
+ const depMap = targetMap.get(object);
1119
+ return depMap && depMap.get(key);
1103
1120
  }
1104
1121
 
1105
1122
  function reactiveReadArray(array) {
@@ -2035,6 +2052,10 @@ class ComputedRefImpl {
2035
2052
  * @internal
2036
2053
  */
2037
2054
  this.globalVersion = globalVersion - 1;
2055
+ /**
2056
+ * @internal
2057
+ */
2058
+ this.next = void 0;
2038
2059
  // for backwards compat
2039
2060
  this.effect = this;
2040
2061
  this["__v_isReadonly"] = !setter;
@@ -4282,6 +4303,7 @@ function useId() {
4282
4303
  `useId() is called when there is no active component instance to be associated with.`
4283
4304
  );
4284
4305
  }
4306
+ return "";
4285
4307
  }
4286
4308
  function markAsyncBoundary(instance) {
4287
4309
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
@@ -7203,7 +7225,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7203
7225
  return vm;
7204
7226
  }
7205
7227
  }
7206
- Vue.version = `2.6.14-compat:${"3.5.8"}`;
7228
+ Vue.version = `2.6.14-compat:${"3.5.10"}`;
7207
7229
  Vue.config = singletonApp.config;
7208
7230
  Vue.use = (plugin, ...options) => {
7209
7231
  if (plugin && isFunction(plugin.install)) {
@@ -11561,7 +11583,7 @@ function normalizeVNode(child) {
11561
11583
  // #3666, avoid reference pollution when reusing vnode
11562
11584
  child.slice()
11563
11585
  );
11564
- } else if (typeof child === "object") {
11586
+ } else if (isVNode(child)) {
11565
11587
  return cloneIfMounted(child);
11566
11588
  } else {
11567
11589
  return createVNode(Text, null, String(child));
@@ -12318,7 +12340,7 @@ function isMemoSame(cached, memo) {
12318
12340
  return true;
12319
12341
  }
12320
12342
 
12321
- const version = "3.5.8";
12343
+ const version = "3.5.10";
12322
12344
  const warn = warn$1 ;
12323
12345
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12324
12346
  const devtools = devtools$1 ;
@@ -13127,6 +13149,11 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
13127
13149
  if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
13128
13150
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
13129
13151
  }
13152
+ } else if (
13153
+ // #11081 force set props for possible async custom element
13154
+ el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
13155
+ ) {
13156
+ patchDOMProp(el, camelize(key), nextValue, parentComponent);
13130
13157
  } else {
13131
13158
  if (key === "true-value") {
13132
13159
  el._trueValue = nextValue;
@@ -13167,13 +13194,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
13167
13194
  if (isNativeOn(key) && isString(value)) {
13168
13195
  return false;
13169
13196
  }
13170
- if (key in el) {
13171
- return true;
13172
- }
13173
- if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
13174
- return true;
13175
- }
13176
- return false;
13197
+ return key in el;
13177
13198
  }
13178
13199
 
13179
13200
  const REMOVAL = {};
@@ -13859,7 +13880,7 @@ const vModelCheckbox = {
13859
13880
  setChecked(el, binding, vnode);
13860
13881
  }
13861
13882
  };
13862
- function setChecked(el, { value, oldValue }, vnode) {
13883
+ function setChecked(el, { value }, vnode) {
13863
13884
  el._modelValue = value;
13864
13885
  let checked;
13865
13886
  if (isArray(value)) {
@@ -13909,19 +13930,19 @@ const vModelSelect = {
13909
13930
  },
13910
13931
  // set value in mounted & updated because <select> relies on its children
13911
13932
  // <option>s.
13912
- mounted(el, { value, modifiers: { number } }) {
13933
+ mounted(el, { value }) {
13913
13934
  setSelected(el, value);
13914
13935
  },
13915
13936
  beforeUpdate(el, _binding, vnode) {
13916
13937
  el[assignKey] = getModelAssigner(vnode);
13917
13938
  },
13918
- updated(el, { value, modifiers: { number } }) {
13939
+ updated(el, { value }) {
13919
13940
  if (!el._assigning) {
13920
13941
  setSelected(el, value);
13921
13942
  }
13922
13943
  }
13923
13944
  };
13924
- function setSelected(el, value, number) {
13945
+ function setSelected(el, value) {
13925
13946
  const isMultiple = el.multiple;
13926
13947
  const isArrayValue = isArray(value);
13927
13948
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -21635,7 +21656,7 @@ function compileToFunction(template, options) {
21635
21656
  return NOOP;
21636
21657
  }
21637
21658
  }
21638
- const key = template;
21659
+ const key = genCacheKey(template, options);
21639
21660
  const cached = compileCache[key];
21640
21661
  if (cached) {
21641
21662
  return cached;
@@ -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
  **/
@@ -117,6 +117,12 @@ const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
117
117
  function genPropsAccessExp(name) {
118
118
  return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
119
119
  }
120
+ function genCacheKey(source, options) {
121
+ return source + JSON.stringify(
122
+ options,
123
+ (_, val) => typeof val === "function" ? val.toString() : val
124
+ );
125
+ }
120
126
 
121
127
  const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
122
128
  const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
@@ -598,9 +604,17 @@ function endBatch() {
598
604
  let error;
599
605
  while (batchedSub) {
600
606
  let e = batchedSub;
607
+ let next;
608
+ while (e) {
609
+ if (!(e.flags & 1)) {
610
+ e.flags &= ~8;
611
+ }
612
+ e = e.next;
613
+ }
614
+ e = batchedSub;
601
615
  batchedSub = void 0;
602
616
  while (e) {
603
- const next = e.next;
617
+ next = e.next;
604
618
  e.next = void 0;
605
619
  e.flags &= ~8;
606
620
  if (e.flags & 1) {
@@ -623,7 +637,7 @@ function prepareDeps(sub) {
623
637
  link.dep.activeLink = link;
624
638
  }
625
639
  }
626
- function cleanupDeps(sub, fromComputed = false) {
640
+ function cleanupDeps(sub) {
627
641
  let head;
628
642
  let tail = sub.depsTail;
629
643
  let link = tail;
@@ -631,7 +645,7 @@ function cleanupDeps(sub, fromComputed = false) {
631
645
  const prev = link.prevDep;
632
646
  if (link.version === -1) {
633
647
  if (link === tail) tail = prev;
634
- removeSub(link, fromComputed);
648
+ removeSub(link);
635
649
  removeDep(link);
636
650
  } else {
637
651
  head = link;
@@ -686,11 +700,11 @@ function refreshComputed(computed) {
686
700
  } finally {
687
701
  activeSub = prevSub;
688
702
  shouldTrack = prevShouldTrack;
689
- cleanupDeps(computed, true);
703
+ cleanupDeps(computed);
690
704
  computed.flags &= ~2;
691
705
  }
692
706
  }
693
- function removeSub(link, fromComputed = false) {
707
+ function removeSub(link, soft = false) {
694
708
  const { dep, prevSub, nextSub } = link;
695
709
  if (prevSub) {
696
710
  prevSub.nextSub = nextSub;
@@ -703,17 +717,15 @@ function removeSub(link, fromComputed = false) {
703
717
  if (dep.subs === link) {
704
718
  dep.subs = prevSub;
705
719
  }
706
- if (!dep.subs) {
707
- if (dep.computed) {
708
- dep.computed.flags &= ~4;
709
- for (let l = dep.computed.deps; l; l = l.nextDep) {
710
- removeSub(l, true);
711
- }
712
- } else if (dep.map && !fromComputed) {
713
- dep.map.delete(dep.key);
714
- if (!dep.map.size) targetMap.delete(dep.target);
720
+ if (!dep.subs && dep.computed) {
721
+ dep.computed.flags &= ~4;
722
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
723
+ removeSub(l, true);
715
724
  }
716
725
  }
726
+ if (!soft && !--dep.sc && dep.map) {
727
+ dep.map.delete(dep.key);
728
+ }
717
729
  }
718
730
  function removeDep(link) {
719
731
  const { prevDep, nextDep } = link;
@@ -798,6 +810,10 @@ class Dep {
798
810
  this.target = void 0;
799
811
  this.map = void 0;
800
812
  this.key = void 0;
813
+ /**
814
+ * Subscriber counter
815
+ */
816
+ this.sc = 0;
801
817
  }
802
818
  track(debugInfo) {
803
819
  if (!activeSub || !shouldTrack || activeSub === this.computed) {
@@ -813,9 +829,7 @@ class Dep {
813
829
  activeSub.depsTail.nextDep = link;
814
830
  activeSub.depsTail = link;
815
831
  }
816
- if (activeSub.flags & 4) {
817
- addSub(link);
818
- }
832
+ addSub(link);
819
833
  } else if (link.version === -1) {
820
834
  link.version = this.version;
821
835
  if (link.nextDep) {
@@ -856,19 +870,22 @@ class Dep {
856
870
  }
857
871
  }
858
872
  function addSub(link) {
859
- const computed = link.dep.computed;
860
- if (computed && !link.dep.subs) {
861
- computed.flags |= 4 | 16;
862
- for (let l = computed.deps; l; l = l.nextDep) {
863
- addSub(l);
873
+ link.dep.sc++;
874
+ if (link.sub.flags & 4) {
875
+ const computed = link.dep.computed;
876
+ if (computed && !link.dep.subs) {
877
+ computed.flags |= 4 | 16;
878
+ for (let l = computed.deps; l; l = l.nextDep) {
879
+ addSub(l);
880
+ }
864
881
  }
882
+ const currentTail = link.dep.subs;
883
+ if (currentTail !== link) {
884
+ link.prevSub = currentTail;
885
+ if (currentTail) currentTail.nextSub = link;
886
+ }
887
+ link.dep.subs = link;
865
888
  }
866
- const currentTail = link.dep.subs;
867
- if (currentTail !== link) {
868
- link.prevSub = currentTail;
869
- if (currentTail) currentTail.nextSub = link;
870
- }
871
- link.dep.subs = link;
872
889
  }
873
890
  const targetMap = /* @__PURE__ */ new WeakMap();
874
891
  const ITERATE_KEY = Symbol(
@@ -961,8 +978,8 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
961
978
  endBatch();
962
979
  }
963
980
  function getDepFromReactive(object, key) {
964
- var _a;
965
- return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
981
+ const depMap = targetMap.get(object);
982
+ return depMap && depMap.get(key);
966
983
  }
967
984
 
968
985
  function reactiveReadArray(array) {
@@ -1840,6 +1857,10 @@ class ComputedRefImpl {
1840
1857
  * @internal
1841
1858
  */
1842
1859
  this.globalVersion = globalVersion - 1;
1860
+ /**
1861
+ * @internal
1862
+ */
1863
+ this.next = void 0;
1843
1864
  // for backwards compat
1844
1865
  this.effect = this;
1845
1866
  this["__v_isReadonly"] = !setter;
@@ -3359,6 +3380,7 @@ function useId() {
3359
3380
  if (i) {
3360
3381
  return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
3361
3382
  }
3383
+ return "";
3362
3384
  }
3363
3385
  function markAsyncBoundary(instance) {
3364
3386
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
@@ -5792,7 +5814,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5792
5814
  return vm;
5793
5815
  }
5794
5816
  }
5795
- Vue.version = `2.6.14-compat:${"3.5.8"}`;
5817
+ Vue.version = `2.6.14-compat:${"3.5.10"}`;
5796
5818
  Vue.config = singletonApp.config;
5797
5819
  Vue.use = (plugin, ...options) => {
5798
5820
  if (plugin && isFunction(plugin.install)) {
@@ -9476,7 +9498,7 @@ function normalizeVNode(child) {
9476
9498
  // #3666, avoid reference pollution when reusing vnode
9477
9499
  child.slice()
9478
9500
  );
9479
- } else if (typeof child === "object") {
9501
+ } else if (isVNode(child)) {
9480
9502
  return cloneIfMounted(child);
9481
9503
  } else {
9482
9504
  return createVNode(Text, null, String(child));
@@ -9913,7 +9935,7 @@ function isMemoSame(cached, memo) {
9913
9935
  return true;
9914
9936
  }
9915
9937
 
9916
- const version = "3.5.8";
9938
+ const version = "3.5.10";
9917
9939
  const warn$1 = NOOP;
9918
9940
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9919
9941
  const devtools = void 0;
@@ -10686,6 +10708,11 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
10686
10708
  if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
10687
10709
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
10688
10710
  }
10711
+ } else if (
10712
+ // #11081 force set props for possible async custom element
10713
+ el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
10714
+ ) {
10715
+ patchDOMProp(el, camelize(key), nextValue, parentComponent);
10689
10716
  } else {
10690
10717
  if (key === "true-value") {
10691
10718
  el._trueValue = nextValue;
@@ -10726,13 +10753,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
10726
10753
  if (isNativeOn(key) && isString(value)) {
10727
10754
  return false;
10728
10755
  }
10729
- if (key in el) {
10730
- return true;
10731
- }
10732
- if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
10733
- return true;
10734
- }
10735
- return false;
10756
+ return key in el;
10736
10757
  }
10737
10758
 
10738
10759
  const REMOVAL = {};
@@ -11354,7 +11375,7 @@ const vModelCheckbox = {
11354
11375
  setChecked(el, binding, vnode);
11355
11376
  }
11356
11377
  };
11357
- function setChecked(el, { value, oldValue }, vnode) {
11378
+ function setChecked(el, { value }, vnode) {
11358
11379
  el._modelValue = value;
11359
11380
  let checked;
11360
11381
  if (isArray(value)) {
@@ -11404,19 +11425,19 @@ const vModelSelect = {
11404
11425
  },
11405
11426
  // set value in mounted & updated because <select> relies on its children
11406
11427
  // <option>s.
11407
- mounted(el, { value, modifiers: { number } }) {
11428
+ mounted(el, { value }) {
11408
11429
  setSelected(el, value);
11409
11430
  },
11410
11431
  beforeUpdate(el, _binding, vnode) {
11411
11432
  el[assignKey] = getModelAssigner(vnode);
11412
11433
  },
11413
- updated(el, { value, modifiers: { number } }) {
11434
+ updated(el, { value }) {
11414
11435
  if (!el._assigning) {
11415
11436
  setSelected(el, value);
11416
11437
  }
11417
11438
  }
11418
11439
  };
11419
- function setSelected(el, value, number) {
11440
+ function setSelected(el, value) {
11420
11441
  const isMultiple = el.multiple;
11421
11442
  const isArrayValue = isArray(value);
11422
11443
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -18637,7 +18658,7 @@ function compileToFunction(template, options) {
18637
18658
  return NOOP;
18638
18659
  }
18639
18660
  }
18640
- const key = template;
18661
+ const key = genCacheKey(template, options);
18641
18662
  const cached = compileCache[key];
18642
18663
  if (cached) {
18643
18664
  return cached;