vue 3.3.10 → 3.3.12

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.
@@ -303,20 +303,29 @@ var Vue = (function (exports) {
303
303
  return replacer(_key, val.value);
304
304
  } else if (isMap(val)) {
305
305
  return {
306
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
307
- entries[`${key} =>`] = val2;
308
- return entries;
309
- }, {})
306
+ [`Map(${val.size})`]: [...val.entries()].reduce(
307
+ (entries, [key, val2], i) => {
308
+ entries[stringifySymbol(key, i) + " =>"] = val2;
309
+ return entries;
310
+ },
311
+ {}
312
+ )
310
313
  };
311
314
  } else if (isSet(val)) {
312
315
  return {
313
- [`Set(${val.size})`]: [...val.values()]
316
+ [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
314
317
  };
318
+ } else if (isSymbol(val)) {
319
+ return stringifySymbol(val);
315
320
  } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
316
321
  return String(val);
317
322
  }
318
323
  return val;
319
324
  };
325
+ const stringifySymbol = (v, i = "") => {
326
+ var _a;
327
+ return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
328
+ };
320
329
 
321
330
  function warn$1(msg, ...args) {
322
331
  console.warn(`[Vue warn] ${msg}`, ...args);
@@ -740,8 +749,13 @@ var Vue = (function (exports) {
740
749
  return isReadonly2;
741
750
  } else if (key === "__v_isShallow") {
742
751
  return shallow;
743
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
744
- return target;
752
+ } else if (key === "__v_raw") {
753
+ if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
754
+ // this means the reciever is a user proxy of the reactive proxy
755
+ Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
756
+ return target;
757
+ }
758
+ return;
745
759
  }
746
760
  const targetIsArray = isArray(target);
747
761
  if (!isReadonly2) {
@@ -777,17 +791,19 @@ var Vue = (function (exports) {
777
791
  }
778
792
  set(target, key, value, receiver) {
779
793
  let oldValue = target[key];
780
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
781
- return false;
782
- }
783
794
  if (!this._shallow) {
795
+ const isOldValueReadonly = isReadonly(oldValue);
784
796
  if (!isShallow(value) && !isReadonly(value)) {
785
797
  oldValue = toRaw(oldValue);
786
798
  value = toRaw(value);
787
799
  }
788
800
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
789
- oldValue.value = value;
790
- return true;
801
+ if (isOldValueReadonly) {
802
+ return false;
803
+ } else {
804
+ oldValue.value = value;
805
+ return true;
806
+ }
791
807
  }
792
808
  }
793
809
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -1752,13 +1768,16 @@ var Vue = (function (exports) {
1752
1768
  }
1753
1769
  queueFlush();
1754
1770
  }
1755
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
1771
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1756
1772
  {
1757
1773
  seen = seen || /* @__PURE__ */ new Map();
1758
1774
  }
1759
1775
  for (; i < queue.length; i++) {
1760
1776
  const cb = queue[i];
1761
1777
  if (cb && cb.pre) {
1778
+ if (instance && cb.id !== instance.uid) {
1779
+ continue;
1780
+ }
1762
1781
  if (checkRecursiveUpdates(seen, cb)) {
1763
1782
  continue;
1764
1783
  }
@@ -2864,7 +2883,7 @@ If this is a native custom element, make sure to exclude it from component resol
2864
2883
  timeout: typeof timeout === "number" ? timeout : -1,
2865
2884
  activeBranch: null,
2866
2885
  pendingBranch: null,
2867
- isInFallback: true,
2886
+ isInFallback: !isHydrating,
2868
2887
  isHydrating,
2869
2888
  isUnmounted: false,
2870
2889
  effects: [],
@@ -2950,6 +2969,7 @@ If this is a native custom element, make sure to exclude it from component resol
2950
2969
  }
2951
2970
  const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
2952
2971
  triggerEvent(vnode2, "onFallback");
2972
+ const anchor2 = next(activeBranch);
2953
2973
  const mountFallback = () => {
2954
2974
  if (!suspense.isInFallback) {
2955
2975
  return;
@@ -2958,7 +2978,7 @@ If this is a native custom element, make sure to exclude it from component resol
2958
2978
  null,
2959
2979
  fallbackVNode,
2960
2980
  container2,
2961
- next(activeBranch),
2981
+ anchor2,
2962
2982
  parentComponent2,
2963
2983
  null,
2964
2984
  // fallback tree will not have suspense context
@@ -6173,6 +6193,16 @@ If you want to remount the same app, move your app creation logic into a factory
6173
6193
  if (dirs) {
6174
6194
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6175
6195
  }
6196
+ let needCallTransitionHooks = false;
6197
+ if (isTemplateNode(el)) {
6198
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6199
+ const content = el.content.firstChild;
6200
+ if (needCallTransitionHooks) {
6201
+ transition.beforeEnter(content);
6202
+ }
6203
+ replaceNode(content, el, parentComponent);
6204
+ vnode.el = el = content;
6205
+ }
6176
6206
  if (props) {
6177
6207
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6178
6208
  for (const key in props) {
@@ -6205,16 +6235,6 @@ If you want to remount the same app, move your app creation logic into a factory
6205
6235
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6206
6236
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6207
6237
  }
6208
- let needCallTransitionHooks = false;
6209
- if (isTemplateNode(el)) {
6210
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6211
- const content = el.content.firstChild;
6212
- if (needCallTransitionHooks) {
6213
- transition.beforeEnter(content);
6214
- }
6215
- replaceNode(content, el, parentComponent);
6216
- vnode.el = el = content;
6217
- }
6218
6238
  if (dirs) {
6219
6239
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6220
6240
  }
@@ -7304,7 +7324,7 @@ If you want to remount the same app, move your app creation logic into a factory
7304
7324
  updateProps(instance, nextVNode.props, prevProps, optimized);
7305
7325
  updateSlots(instance, nextVNode.children, optimized);
7306
7326
  pauseTracking();
7307
- flushPreFlushCbs();
7327
+ flushPreFlushCbs(instance);
7308
7328
  resetTracking();
7309
7329
  };
7310
7330
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
@@ -9171,7 +9191,7 @@ Component that was made reactive: `,
9171
9191
  return true;
9172
9192
  }
9173
9193
 
9174
- const version = "3.3.10";
9194
+ const version = "3.3.12";
9175
9195
  const ssrUtils = null;
9176
9196
  const resolveFilter = null;
9177
9197
  const compatUtils = null;
@@ -9566,6 +9586,69 @@ Component that was made reactive: `,
9566
9586
  el.style.display = value ? el[vShowOldKey] : "none";
9567
9587
  }
9568
9588
 
9589
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
9590
+ function useCssVars(getter) {
9591
+ const instance = getCurrentInstance();
9592
+ if (!instance) {
9593
+ warn(`useCssVars is called without current active component instance.`);
9594
+ return;
9595
+ }
9596
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
9597
+ Array.from(
9598
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
9599
+ ).forEach((node) => setVarsOnNode(node, vars));
9600
+ };
9601
+ const setVars = () => {
9602
+ const vars = getter(instance.proxy);
9603
+ setVarsOnVNode(instance.subTree, vars);
9604
+ updateTeleports(vars);
9605
+ };
9606
+ watchPostEffect(setVars);
9607
+ onMounted(() => {
9608
+ const ob = new MutationObserver(setVars);
9609
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
9610
+ onUnmounted(() => ob.disconnect());
9611
+ });
9612
+ }
9613
+ function setVarsOnVNode(vnode, vars) {
9614
+ if (vnode.shapeFlag & 128) {
9615
+ const suspense = vnode.suspense;
9616
+ vnode = suspense.activeBranch;
9617
+ if (suspense.pendingBranch && !suspense.isHydrating) {
9618
+ suspense.effects.push(() => {
9619
+ setVarsOnVNode(suspense.activeBranch, vars);
9620
+ });
9621
+ }
9622
+ }
9623
+ while (vnode.component) {
9624
+ vnode = vnode.component.subTree;
9625
+ }
9626
+ if (vnode.shapeFlag & 1 && vnode.el) {
9627
+ setVarsOnNode(vnode.el, vars);
9628
+ } else if (vnode.type === Fragment) {
9629
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
9630
+ } else if (vnode.type === Static) {
9631
+ let { el, anchor } = vnode;
9632
+ while (el) {
9633
+ setVarsOnNode(el, vars);
9634
+ if (el === anchor)
9635
+ break;
9636
+ el = el.nextSibling;
9637
+ }
9638
+ }
9639
+ }
9640
+ function setVarsOnNode(el, vars) {
9641
+ if (el.nodeType === 1) {
9642
+ const style = el.style;
9643
+ let cssText = "";
9644
+ for (const key in vars) {
9645
+ style.setProperty(`--${key}`, vars[key]);
9646
+ cssText += `--${key}: ${vars[key]};`;
9647
+ }
9648
+ style[CSS_VAR_TEXT] = cssText;
9649
+ }
9650
+ }
9651
+
9569
9652
  function patchStyle(el, prev, next) {
9570
9653
  const style = el.style;
9571
9654
  const isCssString = isString(next);
@@ -9584,6 +9667,10 @@ Component that was made reactive: `,
9584
9667
  const currentDisplay = style.display;
9585
9668
  if (isCssString) {
9586
9669
  if (prev !== next) {
9670
+ const cssVarText = style[CSS_VAR_TEXT];
9671
+ if (cssVarText) {
9672
+ next += ";" + cssVarText;
9673
+ }
9587
9674
  style.cssText = next;
9588
9675
  }
9589
9676
  } else if (prev) {
@@ -9837,7 +9924,9 @@ Component that was made reactive: `,
9837
9924
  }
9838
9925
  if (key === "width" || key === "height") {
9839
9926
  const tag = el.tagName;
9840
- return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
9927
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
9928
+ return false;
9929
+ }
9841
9930
  }
9842
9931
  if (isNativeOn(key) && isString(value)) {
9843
9932
  return false;
@@ -10076,65 +10165,6 @@ Component that was made reactive: `,
10076
10165
  }
10077
10166
  }
10078
10167
 
10079
- function useCssVars(getter) {
10080
- const instance = getCurrentInstance();
10081
- if (!instance) {
10082
- warn(`useCssVars is called without current active component instance.`);
10083
- return;
10084
- }
10085
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10086
- Array.from(
10087
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10088
- ).forEach((node) => setVarsOnNode(node, vars));
10089
- };
10090
- const setVars = () => {
10091
- const vars = getter(instance.proxy);
10092
- setVarsOnVNode(instance.subTree, vars);
10093
- updateTeleports(vars);
10094
- };
10095
- watchPostEffect(setVars);
10096
- onMounted(() => {
10097
- const ob = new MutationObserver(setVars);
10098
- ob.observe(instance.subTree.el.parentNode, { childList: true });
10099
- onUnmounted(() => ob.disconnect());
10100
- });
10101
- }
10102
- function setVarsOnVNode(vnode, vars) {
10103
- if (vnode.shapeFlag & 128) {
10104
- const suspense = vnode.suspense;
10105
- vnode = suspense.activeBranch;
10106
- if (suspense.pendingBranch && !suspense.isHydrating) {
10107
- suspense.effects.push(() => {
10108
- setVarsOnVNode(suspense.activeBranch, vars);
10109
- });
10110
- }
10111
- }
10112
- while (vnode.component) {
10113
- vnode = vnode.component.subTree;
10114
- }
10115
- if (vnode.shapeFlag & 1 && vnode.el) {
10116
- setVarsOnNode(vnode.el, vars);
10117
- } else if (vnode.type === Fragment) {
10118
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10119
- } else if (vnode.type === Static) {
10120
- let { el, anchor } = vnode;
10121
- while (el) {
10122
- setVarsOnNode(el, vars);
10123
- if (el === anchor)
10124
- break;
10125
- el = el.nextSibling;
10126
- }
10127
- }
10128
- }
10129
- function setVarsOnNode(el, vars) {
10130
- if (el.nodeType === 1) {
10131
- const style = el.style;
10132
- for (const key in vars) {
10133
- style.setProperty(`--${key}`, vars[key]);
10134
- }
10135
- }
10136
- }
10137
-
10138
10168
  const positionMap = /* @__PURE__ */ new WeakMap();
10139
10169
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10140
10170
  const moveCbKey = Symbol("_moveCb");