@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,5 +1,5 @@
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
  **/
@@ -12,9 +12,10 @@ var sourceMapJs = require('source-map-js');
12
12
 
13
13
  /*! #__NO_SIDE_EFFECTS__ */
14
14
  // @__NO_SIDE_EFFECTS__
15
- function makeMap(str, expectsLowerCase) {
16
- const set = new Set(str.split(","));
17
- return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
15
+ function makeMap(str) {
16
+ const map = /* @__PURE__ */ Object.create(null);
17
+ for (const key of str.split(",")) map[key] = 1;
18
+ return (val) => val in map;
18
19
  }
19
20
 
20
21
  const EMPTY_OBJ = {};
@@ -618,9 +619,11 @@ function prepareDeps(sub) {
618
619
  function cleanupDeps(sub) {
619
620
  let head;
620
621
  let tail = sub.depsTail;
621
- for (let link = tail; link; link = link.prevDep) {
622
+ let link = tail;
623
+ while (link) {
624
+ const prev = link.prevDep;
622
625
  if (link.version === -1) {
623
- if (link === tail) tail = link.prevDep;
626
+ if (link === tail) tail = prev;
624
627
  removeSub(link);
625
628
  removeDep(link);
626
629
  } else {
@@ -628,13 +631,14 @@ function cleanupDeps(sub) {
628
631
  }
629
632
  link.dep.activeLink = link.prevActiveLink;
630
633
  link.prevActiveLink = void 0;
634
+ link = prev;
631
635
  }
632
636
  sub.deps = head;
633
637
  sub.depsTail = tail;
634
638
  }
635
639
  function isDirty(sub) {
636
640
  for (let link = sub.deps; link; link = link.nextDep) {
637
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
641
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
638
642
  return true;
639
643
  }
640
644
  }
@@ -644,9 +648,6 @@ function isDirty(sub) {
644
648
  return false;
645
649
  }
646
650
  function refreshComputed(computed) {
647
- if (computed.flags & 2) {
648
- return false;
649
- }
650
651
  if (computed.flags & 4 && !(computed.flags & 16)) {
651
652
  return;
652
653
  }
@@ -759,6 +760,14 @@ function cleanupEffect(e) {
759
760
  }
760
761
 
761
762
  let globalVersion = 0;
763
+ class Link {
764
+ constructor(sub, dep) {
765
+ this.sub = sub;
766
+ this.dep = dep;
767
+ this.version = dep.version;
768
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
769
+ }
770
+ }
762
771
  class Dep {
763
772
  constructor(computed) {
764
773
  this.computed = computed;
@@ -778,16 +787,7 @@ class Dep {
778
787
  }
779
788
  let link = this.activeLink;
780
789
  if (link === void 0 || link.sub !== activeSub) {
781
- link = this.activeLink = {
782
- dep: this,
783
- sub: activeSub,
784
- version: this.version,
785
- nextDep: void 0,
786
- prevDep: void 0,
787
- nextSub: void 0,
788
- prevSub: void 0,
789
- prevActiveLink: void 0
790
- };
790
+ link = this.activeLink = new Link(activeSub, this);
791
791
  if (!activeSub.deps) {
792
792
  activeSub.deps = activeSub.depsTail = link;
793
793
  } else {
@@ -880,9 +880,16 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
880
880
  globalVersion++;
881
881
  return;
882
882
  }
883
- let deps = [];
883
+ const run = (dep) => {
884
+ if (dep) {
885
+ {
886
+ dep.trigger();
887
+ }
888
+ }
889
+ };
890
+ startBatch();
884
891
  if (type === "clear") {
885
- deps = [...depsMap.values()];
892
+ depsMap.forEach(run);
886
893
  } else {
887
894
  const targetIsArray = isArray(target);
888
895
  const isArrayIndex = targetIsArray && isIntegerKey(key);
@@ -890,50 +897,43 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
890
897
  const newLength = Number(newValue);
891
898
  depsMap.forEach((dep, key2) => {
892
899
  if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
893
- deps.push(dep);
900
+ run(dep);
894
901
  }
895
902
  });
896
903
  } else {
897
- const push = (dep) => dep && deps.push(dep);
898
904
  if (key !== void 0) {
899
- push(depsMap.get(key));
905
+ run(depsMap.get(key));
900
906
  }
901
907
  if (isArrayIndex) {
902
- push(depsMap.get(ARRAY_ITERATE_KEY));
908
+ run(depsMap.get(ARRAY_ITERATE_KEY));
903
909
  }
904
910
  switch (type) {
905
911
  case "add":
906
912
  if (!targetIsArray) {
907
- push(depsMap.get(ITERATE_KEY));
913
+ run(depsMap.get(ITERATE_KEY));
908
914
  if (isMap(target)) {
909
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
915
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
910
916
  }
911
917
  } else if (isArrayIndex) {
912
- push(depsMap.get("length"));
918
+ run(depsMap.get("length"));
913
919
  }
914
920
  break;
915
921
  case "delete":
916
922
  if (!targetIsArray) {
917
- push(depsMap.get(ITERATE_KEY));
923
+ run(depsMap.get(ITERATE_KEY));
918
924
  if (isMap(target)) {
919
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
925
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
920
926
  }
921
927
  }
922
928
  break;
923
929
  case "set":
924
930
  if (isMap(target)) {
925
- push(depsMap.get(ITERATE_KEY));
931
+ run(depsMap.get(ITERATE_KEY));
926
932
  }
927
933
  break;
928
934
  }
929
935
  }
930
936
  }
931
- startBatch();
932
- for (const dep of deps) {
933
- {
934
- dep.trigger();
935
- }
936
- }
937
937
  endBatch();
938
938
  }
939
939
  function getDepFromReactive(object, key) {
@@ -1631,7 +1631,7 @@ function toRaw(observed) {
1631
1631
  return raw ? toRaw(raw) : observed;
1632
1632
  }
1633
1633
  function markRaw(value) {
1634
- if (Object.isExtensible(value)) {
1634
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1635
1635
  def(value, "__v_skip", true);
1636
1636
  }
1637
1637
  return value;
@@ -1823,8 +1823,8 @@ class ComputedRefImpl {
1823
1823
  * @internal
1824
1824
  */
1825
1825
  notify() {
1826
+ this.flags |= 16;
1826
1827
  if (activeSub !== this) {
1827
- this.flags |= 16;
1828
1828
  this.dep.notify();
1829
1829
  }
1830
1830
  }
@@ -2727,6 +2727,9 @@ const TeleportImpl = {
2727
2727
  insert(mainAnchor, container, anchor);
2728
2728
  const mount = (container2, anchor2) => {
2729
2729
  if (shapeFlag & 16) {
2730
+ if (parentComponent && parentComponent.isCE) {
2731
+ parentComponent.ce._teleportTarget = container2;
2732
+ }
2730
2733
  mountChildren(
2731
2734
  children,
2732
2735
  container2,
@@ -3679,7 +3682,11 @@ function createHydrationFunctions(rendererInternals) {
3679
3682
  remove(cur);
3680
3683
  }
3681
3684
  } else if (shapeFlag & 8) {
3682
- if (el.textContent !== vnode.children) {
3685
+ let clientText = vnode.children;
3686
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
3687
+ clientText = clientText.slice(1);
3688
+ }
3689
+ if (el.textContent !== clientText) {
3683
3690
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
3684
3691
  logMismatchError();
3685
3692
  }
@@ -3858,7 +3865,7 @@ function createHydrationFunctions(rendererInternals) {
3858
3865
  }
3859
3866
  };
3860
3867
  const isTemplateNode = (node) => {
3861
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
3868
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
3862
3869
  };
3863
3870
  return [hydrate, hydrateNode];
3864
3871
  }
@@ -4082,7 +4089,7 @@ function defineAsyncComponent(source) {
4082
4089
  load().then(() => {
4083
4090
  loaded.value = true;
4084
4091
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4085
- queueJob(instance.parent.update);
4092
+ instance.parent.update();
4086
4093
  }
4087
4094
  }).catch((err) => {
4088
4095
  onError(err);
@@ -4748,13 +4755,15 @@ function renderList(source, renderItem, cache, index) {
4748
4755
  const sourceIsArray = isArray(source);
4749
4756
  if (sourceIsArray || isString(source)) {
4750
4757
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
4758
+ let needsWrap = false;
4751
4759
  if (sourceIsReactiveArray) {
4760
+ needsWrap = !isShallow(source);
4752
4761
  source = shallowReadArray(source);
4753
4762
  }
4754
4763
  ret = new Array(source.length);
4755
4764
  for (let i = 0, l = source.length; i < l; i++) {
4756
4765
  ret[i] = renderItem(
4757
- sourceIsReactiveArray ? toReactive(source[i]) : source[i],
4766
+ needsWrap ? toReactive(source[i]) : source[i],
4758
4767
  i,
4759
4768
  void 0,
4760
4769
  cached && cached[i]
@@ -5743,7 +5752,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5743
5752
  return vm;
5744
5753
  }
5745
5754
  }
5746
- Vue.version = `2.6.14-compat:${"3.5.3"}`;
5755
+ Vue.version = `2.6.14-compat:${"3.5.5"}`;
5747
5756
  Vue.config = singletonApp.config;
5748
5757
  Vue.use = (plugin, ...options) => {
5749
5758
  if (plugin && isFunction(plugin.install)) {
@@ -9863,7 +9872,7 @@ function isMemoSame(cached, memo) {
9863
9872
  return true;
9864
9873
  }
9865
9874
 
9866
- const version = "3.5.3";
9875
+ const version = "3.5.5";
9867
9876
  const warn$1 = NOOP;
9868
9877
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9869
9878
  const devtools = void 0;
@@ -10744,6 +10753,7 @@ class VueElement extends BaseClass {
10744
10753
  }
10745
10754
  }
10746
10755
  connectedCallback() {
10756
+ if (!this.isConnected) return;
10747
10757
  if (!this.shadowRoot) {
10748
10758
  this._parseSlots();
10749
10759
  }
@@ -10786,7 +10796,7 @@ class VueElement extends BaseClass {
10786
10796
  this._ob = null;
10787
10797
  }
10788
10798
  this._app && this._app.unmount();
10789
- this._instance.ce = void 0;
10799
+ if (this._instance) this._instance.ce = void 0;
10790
10800
  this._app = this._instance = null;
10791
10801
  }
10792
10802
  });
@@ -10971,7 +10981,7 @@ class VueElement extends BaseClass {
10971
10981
  }
10972
10982
  }
10973
10983
  /**
10974
- * Only called when shaddowRoot is false
10984
+ * Only called when shadowRoot is false
10975
10985
  */
10976
10986
  _parseSlots() {
10977
10987
  const slots = this._slots = {};
@@ -10983,10 +10993,10 @@ class VueElement extends BaseClass {
10983
10993
  }
10984
10994
  }
10985
10995
  /**
10986
- * Only called when shaddowRoot is false
10996
+ * Only called when shadowRoot is false
10987
10997
  */
10988
10998
  _renderSlots() {
10989
- const outlets = this.querySelectorAll("slot");
10999
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
10990
11000
  const scopeId = this._instance.type.__scopeId;
10991
11001
  for (let i = 0; i < outlets.length; i++) {
10992
11002
  const o = outlets[i];
@@ -12312,7 +12322,7 @@ class Tokenizer {
12312
12322
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
12313
12323
  if (c === 38) {
12314
12324
  this.startEntity();
12315
- } else if (c === this.delimiterOpen[0]) {
12325
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
12316
12326
  this.state = 2;
12317
12327
  this.delimiterIndex = 0;
12318
12328
  this.stateInterpolationOpen(c);
@@ -13661,6 +13671,7 @@ const defaultParserOptions = {
13661
13671
  getNamespace: () => 0,
13662
13672
  isVoidTag: NO,
13663
13673
  isPreTag: NO,
13674
+ isIgnoreNewlineTag: NO,
13664
13675
  isCustomElement: NO,
13665
13676
  onError: defaultOnError,
13666
13677
  onWarn: defaultOnWarn,
@@ -14100,7 +14111,7 @@ function onCloseTag(el, end, isImplied = false) {
14100
14111
  el.innerLoc.end.offset
14101
14112
  );
14102
14113
  }
14103
- const { tag, ns } = el;
14114
+ const { tag, ns, children } = el;
14104
14115
  if (!inVPre) {
14105
14116
  if (tag === "slot") {
14106
14117
  el.tagType = 2;
@@ -14111,7 +14122,13 @@ function onCloseTag(el, end, isImplied = false) {
14111
14122
  }
14112
14123
  }
14113
14124
  if (!tokenizer.inRCDATA) {
14114
- el.children = condenseWhitespace(el.children, el.tag);
14125
+ el.children = condenseWhitespace(children);
14126
+ }
14127
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
14128
+ const first = children[0];
14129
+ if (first && first.type === 2) {
14130
+ first.content = first.content.replace(/^\r?\n/, "");
14131
+ }
14115
14132
  }
14116
14133
  if (ns === 0 && currentOptions.isPreTag(tag)) {
14117
14134
  inPre--;
@@ -14233,12 +14250,6 @@ function condenseWhitespace(nodes, tag) {
14233
14250
  }
14234
14251
  }
14235
14252
  }
14236
- if (inPre && tag && currentOptions.isPreTag(tag)) {
14237
- const first = nodes[0];
14238
- if (first && first.type === 2) {
14239
- first.content = first.content.replace(/^\r?\n/, "");
14240
- }
14241
- }
14242
14253
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
14243
14254
  }
14244
14255
  function isAllWhitespace(str) {
@@ -17995,6 +18006,7 @@ const parserOptions = {
17995
18006
  isVoidTag,
17996
18007
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
17997
18008
  isPreTag: (tag) => tag === "pre",
18009
+ isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
17998
18010
  decodeEntities: void 0,
17999
18011
  isBuiltInComponent: (tag) => {
18000
18012
  if (tag === "Transition" || tag === "transition") {
@@ -18204,10 +18216,7 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
18204
18216
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
18205
18217
  );
18206
18218
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
18207
- const isKeyboardEvent = /* @__PURE__ */ makeMap(
18208
- `onkeyup,onkeydown,onkeypress`,
18209
- true
18210
- );
18219
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
18211
18220
  const resolveModifiers = (key, modifiers, context, loc) => {
18212
18221
  const keyModifiers = [];
18213
18222
  const nonKeyModifiers = [];
@@ -18223,7 +18232,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
18223
18232
  } else {
18224
18233
  if (maybeKeyModifier(modifier)) {
18225
18234
  if (isStaticExp(key)) {
18226
- if (isKeyboardEvent(key.content)) {
18235
+ if (isKeyboardEvent(key.content.toLowerCase())) {
18227
18236
  keyModifiers.push(modifier);
18228
18237
  } else {
18229
18238
  nonKeyModifiers.push(modifier);
@@ -18276,7 +18285,7 @@ const transformOn = (dir, node, context) => {
18276
18285
  ]);
18277
18286
  }
18278
18287
  if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
18279
- (!isStaticExp(key) || isKeyboardEvent(key.content))) {
18288
+ (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
18280
18289
  handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
18281
18290
  handlerExp,
18282
18291
  JSON.stringify(keyModifiers)
@@ -18324,12 +18333,17 @@ const stringifyStatic = (children, context, parent) => {
18324
18333
  // will insert / hydrate
18325
18334
  String(currentChunk.length)
18326
18335
  ]);
18336
+ const deleteCount = currentChunk.length - 1;
18327
18337
  if (isParentCached) {
18328
- parent.codegenNode.children.value = createArrayExpression([staticCall]);
18338
+ children.splice(
18339
+ currentIndex - currentChunk.length,
18340
+ currentChunk.length,
18341
+ // @ts-expect-error
18342
+ staticCall
18343
+ );
18329
18344
  } else {
18330
18345
  currentChunk[0].codegenNode.value = staticCall;
18331
18346
  if (currentChunk.length > 1) {
18332
- const deleteCount = currentChunk.length - 1;
18333
18347
  children.splice(currentIndex - currentChunk.length + 1, deleteCount);
18334
18348
  const cacheIndex = context.cached.indexOf(
18335
18349
  currentChunk[currentChunk.length - 1].codegenNode
@@ -18341,9 +18355,9 @@ const stringifyStatic = (children, context, parent) => {
18341
18355
  }
18342
18356
  context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
18343
18357
  }
18344
- return deleteCount;
18345
18358
  }
18346
18359
  }
18360
+ return deleteCount;
18347
18361
  }
18348
18362
  return 0;
18349
18363
  };