@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 = !!(process.env.NODE_ENV !== "production") ? 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 {
@@ -892,9 +892,25 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
892
892
  globalVersion++;
893
893
  return;
894
894
  }
895
- let deps = [];
895
+ const run = (dep) => {
896
+ if (dep) {
897
+ if (!!(process.env.NODE_ENV !== "production")) {
898
+ dep.trigger({
899
+ target,
900
+ type,
901
+ key,
902
+ newValue,
903
+ oldValue,
904
+ oldTarget
905
+ });
906
+ } else {
907
+ dep.trigger();
908
+ }
909
+ }
910
+ };
911
+ startBatch();
896
912
  if (type === "clear") {
897
- deps = [...depsMap.values()];
913
+ depsMap.forEach(run);
898
914
  } else {
899
915
  const targetIsArray = isArray(target);
900
916
  const isArrayIndex = targetIsArray && isIntegerKey(key);
@@ -902,59 +918,43 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
902
918
  const newLength = Number(newValue);
903
919
  depsMap.forEach((dep, key2) => {
904
920
  if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
905
- deps.push(dep);
921
+ run(dep);
906
922
  }
907
923
  });
908
924
  } else {
909
- const push = (dep) => dep && deps.push(dep);
910
925
  if (key !== void 0) {
911
- push(depsMap.get(key));
926
+ run(depsMap.get(key));
912
927
  }
913
928
  if (isArrayIndex) {
914
- push(depsMap.get(ARRAY_ITERATE_KEY));
929
+ run(depsMap.get(ARRAY_ITERATE_KEY));
915
930
  }
916
931
  switch (type) {
917
932
  case "add":
918
933
  if (!targetIsArray) {
919
- push(depsMap.get(ITERATE_KEY));
934
+ run(depsMap.get(ITERATE_KEY));
920
935
  if (isMap(target)) {
921
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
936
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
922
937
  }
923
938
  } else if (isArrayIndex) {
924
- push(depsMap.get("length"));
939
+ run(depsMap.get("length"));
925
940
  }
926
941
  break;
927
942
  case "delete":
928
943
  if (!targetIsArray) {
929
- push(depsMap.get(ITERATE_KEY));
944
+ run(depsMap.get(ITERATE_KEY));
930
945
  if (isMap(target)) {
931
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
946
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
932
947
  }
933
948
  }
934
949
  break;
935
950
  case "set":
936
951
  if (isMap(target)) {
937
- push(depsMap.get(ITERATE_KEY));
952
+ run(depsMap.get(ITERATE_KEY));
938
953
  }
939
954
  break;
940
955
  }
941
956
  }
942
957
  }
943
- startBatch();
944
- for (const dep of deps) {
945
- if (!!(process.env.NODE_ENV !== "production")) {
946
- dep.trigger({
947
- target,
948
- type,
949
- key,
950
- newValue,
951
- oldValue,
952
- oldTarget
953
- });
954
- } else {
955
- dep.trigger();
956
- }
957
- }
958
958
  endBatch();
959
959
  }
960
960
  function getDepFromReactive(object, key) {
@@ -1692,7 +1692,7 @@ function toRaw(observed) {
1692
1692
  return raw ? toRaw(raw) : observed;
1693
1693
  }
1694
1694
  function markRaw(value) {
1695
- if (Object.isExtensible(value)) {
1695
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1696
1696
  def(value, "__v_skip", true);
1697
1697
  }
1698
1698
  return value;
@@ -1908,8 +1908,8 @@ class ComputedRefImpl {
1908
1908
  * @internal
1909
1909
  */
1910
1910
  notify() {
1911
+ this.flags |= 16;
1911
1912
  if (activeSub !== this) {
1912
- this.flags |= 16;
1913
1913
  this.dep.notify();
1914
1914
  } else if (!!(process.env.NODE_ENV !== "production")) ;
1915
1915
  }
@@ -2602,23 +2602,19 @@ function flushJobs(seen) {
2602
2602
  }
2603
2603
  }
2604
2604
  function checkRecursiveUpdates(seen, fn) {
2605
- if (!seen.has(fn)) {
2606
- seen.set(fn, 1);
2607
- } else {
2608
- const count = seen.get(fn);
2609
- if (count > RECURSION_LIMIT) {
2610
- const instance = fn.i;
2611
- const componentName = instance && getComponentName(instance.type);
2612
- handleError(
2613
- `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.`,
2614
- null,
2615
- 10
2616
- );
2617
- return true;
2618
- } else {
2619
- seen.set(fn, count + 1);
2620
- }
2605
+ const count = seen.get(fn) || 0;
2606
+ if (count > RECURSION_LIMIT) {
2607
+ const instance = fn.i;
2608
+ const componentName = instance && getComponentName(instance.type);
2609
+ handleError(
2610
+ `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.`,
2611
+ null,
2612
+ 10
2613
+ );
2614
+ return true;
2621
2615
  }
2616
+ seen.set(fn, count + 1);
2617
+ return false;
2622
2618
  }
2623
2619
 
2624
2620
  let isHmrUpdating = false;
@@ -2699,7 +2695,9 @@ function reload(id, newComp) {
2699
2695
  dirtyInstances.delete(instance);
2700
2696
  } else if (instance.parent) {
2701
2697
  queueJob(() => {
2698
+ isHmrUpdating = true;
2702
2699
  instance.parent.update();
2700
+ isHmrUpdating = false;
2703
2701
  dirtyInstances.delete(instance);
2704
2702
  });
2705
2703
  } else if (instance.appContext.reload) {
@@ -3521,6 +3519,9 @@ const TeleportImpl = {
3521
3519
  insert(mainAnchor, container, anchor);
3522
3520
  const mount = (container2, anchor2) => {
3523
3521
  if (shapeFlag & 16) {
3522
+ if (parentComponent && parentComponent.isCE) {
3523
+ parentComponent.ce._teleportTarget = container2;
3524
+ }
3524
3525
  mountChildren(
3525
3526
  children,
3526
3527
  container2,
@@ -4555,7 +4556,11 @@ Server rendered element contains more child nodes than client vdom.`
4555
4556
  remove(cur);
4556
4557
  }
4557
4558
  } else if (shapeFlag & 8) {
4558
- if (el.textContent !== vnode.children) {
4559
+ let clientText = vnode.children;
4560
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4561
+ clientText = clientText.slice(1);
4562
+ }
4563
+ if (el.textContent !== clientText) {
4559
4564
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4560
4565
  (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
4561
4566
  `Hydration text content mismatch on`,
@@ -4765,7 +4770,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4765
4770
  }
4766
4771
  };
4767
4772
  const isTemplateNode = (node) => {
4768
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4773
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4769
4774
  };
4770
4775
  return [hydrate, hydrateNode];
4771
4776
  }
@@ -5117,7 +5122,7 @@ function defineAsyncComponent(source) {
5117
5122
  load().then(() => {
5118
5123
  loaded.value = true;
5119
5124
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5120
- queueJob(instance.parent.update);
5125
+ instance.parent.update();
5121
5126
  }
5122
5127
  }).catch((err) => {
5123
5128
  onError(err);
@@ -5809,13 +5814,15 @@ function renderList(source, renderItem, cache, index) {
5809
5814
  const sourceIsArray = isArray(source);
5810
5815
  if (sourceIsArray || isString(source)) {
5811
5816
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5817
+ let needsWrap = false;
5812
5818
  if (sourceIsReactiveArray) {
5819
+ needsWrap = !isShallow(source);
5813
5820
  source = shallowReadArray(source);
5814
5821
  }
5815
5822
  ret = new Array(source.length);
5816
5823
  for (let i = 0, l = source.length; i < l; i++) {
5817
5824
  ret[i] = renderItem(
5818
- sourceIsReactiveArray ? toReactive(source[i]) : source[i],
5825
+ needsWrap ? toReactive(source[i]) : source[i],
5819
5826
  i,
5820
5827
  void 0,
5821
5828
  cached && cached[i]
@@ -7068,7 +7075,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7068
7075
  return vm;
7069
7076
  }
7070
7077
  }
7071
- Vue.version = `2.6.14-compat:${"3.5.3"}`;
7078
+ Vue.version = `2.6.14-compat:${"3.5.5"}`;
7072
7079
  Vue.config = singletonApp.config;
7073
7080
  Vue.use = (plugin, ...options) => {
7074
7081
  if (plugin && isFunction(plugin.install)) {
@@ -8930,6 +8937,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8930
8937
  }
8931
8938
  }
8932
8939
  if (instance.asyncDep) {
8940
+ if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) initialVNode.el = null;
8933
8941
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8934
8942
  if (!initialVNode.el) {
8935
8943
  const placeholder = instance.subTree = createVNode(Comment);
@@ -12235,7 +12243,7 @@ function isMemoSame(cached, memo) {
12235
12243
  return true;
12236
12244
  }
12237
12245
 
12238
- const version = "3.5.3";
12246
+ const version = "3.5.5";
12239
12247
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12240
12248
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12241
12249
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13223,6 +13231,7 @@ class VueElement extends BaseClass {
13223
13231
  }
13224
13232
  }
13225
13233
  connectedCallback() {
13234
+ if (!this.isConnected) return;
13226
13235
  if (!this.shadowRoot) {
13227
13236
  this._parseSlots();
13228
13237
  }
@@ -13265,7 +13274,7 @@ class VueElement extends BaseClass {
13265
13274
  this._ob = null;
13266
13275
  }
13267
13276
  this._app && this._app.unmount();
13268
- this._instance.ce = void 0;
13277
+ if (this._instance) this._instance.ce = void 0;
13269
13278
  this._app = this._instance = null;
13270
13279
  }
13271
13280
  });
@@ -13484,7 +13493,7 @@ class VueElement extends BaseClass {
13484
13493
  }
13485
13494
  }
13486
13495
  /**
13487
- * Only called when shaddowRoot is false
13496
+ * Only called when shadowRoot is false
13488
13497
  */
13489
13498
  _parseSlots() {
13490
13499
  const slots = this._slots = {};
@@ -13496,10 +13505,10 @@ class VueElement extends BaseClass {
13496
13505
  }
13497
13506
  }
13498
13507
  /**
13499
- * Only called when shaddowRoot is false
13508
+ * Only called when shadowRoot is false
13500
13509
  */
13501
13510
  _renderSlots() {
13502
- const outlets = this.querySelectorAll("slot");
13511
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13503
13512
  const scopeId = this._instance.type.__scopeId;
13504
13513
  for (let i = 0; i < outlets.length; i++) {
13505
13514
  const o = outlets[i];
@@ -13687,7 +13696,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13687
13696
  child,
13688
13697
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
13689
13698
  );
13690
- } else if (!!(process.env.NODE_ENV !== "production")) {
13699
+ } else if (!!(process.env.NODE_ENV !== "production") && child.type !== Text) {
13691
13700
  warn(`<TransitionGroup> children must be keyed.`);
13692
13701
  }
13693
13702
  }