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.
@@ -300,20 +300,29 @@ const replacer = (_key, val) => {
300
300
  return replacer(_key, val.value);
301
301
  } else if (isMap(val)) {
302
302
  return {
303
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
304
- entries[`${key} =>`] = val2;
305
- return entries;
306
- }, {})
303
+ [`Map(${val.size})`]: [...val.entries()].reduce(
304
+ (entries, [key, val2], i) => {
305
+ entries[stringifySymbol(key, i) + " =>"] = val2;
306
+ return entries;
307
+ },
308
+ {}
309
+ )
307
310
  };
308
311
  } else if (isSet(val)) {
309
312
  return {
310
- [`Set(${val.size})`]: [...val.values()]
313
+ [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
311
314
  };
315
+ } else if (isSymbol(val)) {
316
+ return stringifySymbol(val);
312
317
  } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
313
318
  return String(val);
314
319
  }
315
320
  return val;
316
321
  };
322
+ const stringifySymbol = (v, i = "") => {
323
+ var _a;
324
+ return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
325
+ };
317
326
 
318
327
  function warn$1(msg, ...args) {
319
328
  console.warn(`[Vue warn] ${msg}`, ...args);
@@ -737,8 +746,13 @@ class BaseReactiveHandler {
737
746
  return isReadonly2;
738
747
  } else if (key === "__v_isShallow") {
739
748
  return shallow;
740
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
741
- return target;
749
+ } else if (key === "__v_raw") {
750
+ if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
751
+ // this means the reciever is a user proxy of the reactive proxy
752
+ Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
753
+ return target;
754
+ }
755
+ return;
742
756
  }
743
757
  const targetIsArray = isArray(target);
744
758
  if (!isReadonly2) {
@@ -774,17 +788,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
774
788
  }
775
789
  set(target, key, value, receiver) {
776
790
  let oldValue = target[key];
777
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
778
- return false;
779
- }
780
791
  if (!this._shallow) {
792
+ const isOldValueReadonly = isReadonly(oldValue);
781
793
  if (!isShallow(value) && !isReadonly(value)) {
782
794
  oldValue = toRaw(oldValue);
783
795
  value = toRaw(value);
784
796
  }
785
797
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
786
- oldValue.value = value;
787
- return true;
798
+ if (isOldValueReadonly) {
799
+ return false;
800
+ } else {
801
+ oldValue.value = value;
802
+ return true;
803
+ }
788
804
  }
789
805
  }
790
806
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -1749,13 +1765,16 @@ function queuePostFlushCb(cb) {
1749
1765
  }
1750
1766
  queueFlush();
1751
1767
  }
1752
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
1768
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1753
1769
  {
1754
1770
  seen = seen || /* @__PURE__ */ new Map();
1755
1771
  }
1756
1772
  for (; i < queue.length; i++) {
1757
1773
  const cb = queue[i];
1758
1774
  if (cb && cb.pre) {
1775
+ if (instance && cb.id !== instance.uid) {
1776
+ continue;
1777
+ }
1759
1778
  if (checkRecursiveUpdates(seen, cb)) {
1760
1779
  continue;
1761
1780
  }
@@ -2861,7 +2880,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2861
2880
  timeout: typeof timeout === "number" ? timeout : -1,
2862
2881
  activeBranch: null,
2863
2882
  pendingBranch: null,
2864
- isInFallback: true,
2883
+ isInFallback: !isHydrating,
2865
2884
  isHydrating,
2866
2885
  isUnmounted: false,
2867
2886
  effects: [],
@@ -2947,6 +2966,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2947
2966
  }
2948
2967
  const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
2949
2968
  triggerEvent(vnode2, "onFallback");
2969
+ const anchor2 = next(activeBranch);
2950
2970
  const mountFallback = () => {
2951
2971
  if (!suspense.isInFallback) {
2952
2972
  return;
@@ -2955,7 +2975,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2955
2975
  null,
2956
2976
  fallbackVNode,
2957
2977
  container2,
2958
- next(activeBranch),
2978
+ anchor2,
2959
2979
  parentComponent2,
2960
2980
  null,
2961
2981
  // fallback tree will not have suspense context
@@ -6170,6 +6190,16 @@ function createHydrationFunctions(rendererInternals) {
6170
6190
  if (dirs) {
6171
6191
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6172
6192
  }
6193
+ let needCallTransitionHooks = false;
6194
+ if (isTemplateNode(el)) {
6195
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6196
+ const content = el.content.firstChild;
6197
+ if (needCallTransitionHooks) {
6198
+ transition.beforeEnter(content);
6199
+ }
6200
+ replaceNode(content, el, parentComponent);
6201
+ vnode.el = el = content;
6202
+ }
6173
6203
  if (props) {
6174
6204
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6175
6205
  for (const key in props) {
@@ -6202,16 +6232,6 @@ function createHydrationFunctions(rendererInternals) {
6202
6232
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6203
6233
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6204
6234
  }
6205
- let needCallTransitionHooks = false;
6206
- if (isTemplateNode(el)) {
6207
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6208
- const content = el.content.firstChild;
6209
- if (needCallTransitionHooks) {
6210
- transition.beforeEnter(content);
6211
- }
6212
- replaceNode(content, el, parentComponent);
6213
- vnode.el = el = content;
6214
- }
6215
6235
  if (dirs) {
6216
6236
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6217
6237
  }
@@ -7301,7 +7321,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7301
7321
  updateProps(instance, nextVNode.props, prevProps, optimized);
7302
7322
  updateSlots(instance, nextVNode.children, optimized);
7303
7323
  pauseTracking();
7304
- flushPreFlushCbs();
7324
+ flushPreFlushCbs(instance);
7305
7325
  resetTracking();
7306
7326
  };
7307
7327
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
@@ -9174,7 +9194,7 @@ function isMemoSame(cached, memo) {
9174
9194
  return true;
9175
9195
  }
9176
9196
 
9177
- const version = "3.3.10";
9197
+ const version = "3.3.12";
9178
9198
  const ssrUtils = null;
9179
9199
  const resolveFilter = null;
9180
9200
  const compatUtils = null;
@@ -9569,6 +9589,69 @@ function setDisplay(el, value) {
9569
9589
  el.style.display = value ? el[vShowOldKey] : "none";
9570
9590
  }
9571
9591
 
9592
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
9593
+ function useCssVars(getter) {
9594
+ const instance = getCurrentInstance();
9595
+ if (!instance) {
9596
+ warn(`useCssVars is called without current active component instance.`);
9597
+ return;
9598
+ }
9599
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
9600
+ Array.from(
9601
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
9602
+ ).forEach((node) => setVarsOnNode(node, vars));
9603
+ };
9604
+ const setVars = () => {
9605
+ const vars = getter(instance.proxy);
9606
+ setVarsOnVNode(instance.subTree, vars);
9607
+ updateTeleports(vars);
9608
+ };
9609
+ watchPostEffect(setVars);
9610
+ onMounted(() => {
9611
+ const ob = new MutationObserver(setVars);
9612
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
9613
+ onUnmounted(() => ob.disconnect());
9614
+ });
9615
+ }
9616
+ function setVarsOnVNode(vnode, vars) {
9617
+ if (vnode.shapeFlag & 128) {
9618
+ const suspense = vnode.suspense;
9619
+ vnode = suspense.activeBranch;
9620
+ if (suspense.pendingBranch && !suspense.isHydrating) {
9621
+ suspense.effects.push(() => {
9622
+ setVarsOnVNode(suspense.activeBranch, vars);
9623
+ });
9624
+ }
9625
+ }
9626
+ while (vnode.component) {
9627
+ vnode = vnode.component.subTree;
9628
+ }
9629
+ if (vnode.shapeFlag & 1 && vnode.el) {
9630
+ setVarsOnNode(vnode.el, vars);
9631
+ } else if (vnode.type === Fragment) {
9632
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
9633
+ } else if (vnode.type === Static) {
9634
+ let { el, anchor } = vnode;
9635
+ while (el) {
9636
+ setVarsOnNode(el, vars);
9637
+ if (el === anchor)
9638
+ break;
9639
+ el = el.nextSibling;
9640
+ }
9641
+ }
9642
+ }
9643
+ function setVarsOnNode(el, vars) {
9644
+ if (el.nodeType === 1) {
9645
+ const style = el.style;
9646
+ let cssText = "";
9647
+ for (const key in vars) {
9648
+ style.setProperty(`--${key}`, vars[key]);
9649
+ cssText += `--${key}: ${vars[key]};`;
9650
+ }
9651
+ style[CSS_VAR_TEXT] = cssText;
9652
+ }
9653
+ }
9654
+
9572
9655
  function patchStyle(el, prev, next) {
9573
9656
  const style = el.style;
9574
9657
  const isCssString = isString(next);
@@ -9587,6 +9670,10 @@ function patchStyle(el, prev, next) {
9587
9670
  const currentDisplay = style.display;
9588
9671
  if (isCssString) {
9589
9672
  if (prev !== next) {
9673
+ const cssVarText = style[CSS_VAR_TEXT];
9674
+ if (cssVarText) {
9675
+ next += ";" + cssVarText;
9676
+ }
9590
9677
  style.cssText = next;
9591
9678
  }
9592
9679
  } else if (prev) {
@@ -9840,7 +9927,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
9840
9927
  }
9841
9928
  if (key === "width" || key === "height") {
9842
9929
  const tag = el.tagName;
9843
- return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
9930
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
9931
+ return false;
9932
+ }
9844
9933
  }
9845
9934
  if (isNativeOn(key) && isString(value)) {
9846
9935
  return false;
@@ -10091,65 +10180,6 @@ function useCssModule(name = "$style") {
10091
10180
  }
10092
10181
  }
10093
10182
 
10094
- function useCssVars(getter) {
10095
- const instance = getCurrentInstance();
10096
- if (!instance) {
10097
- warn(`useCssVars is called without current active component instance.`);
10098
- return;
10099
- }
10100
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10101
- Array.from(
10102
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10103
- ).forEach((node) => setVarsOnNode(node, vars));
10104
- };
10105
- const setVars = () => {
10106
- const vars = getter(instance.proxy);
10107
- setVarsOnVNode(instance.subTree, vars);
10108
- updateTeleports(vars);
10109
- };
10110
- watchPostEffect(setVars);
10111
- onMounted(() => {
10112
- const ob = new MutationObserver(setVars);
10113
- ob.observe(instance.subTree.el.parentNode, { childList: true });
10114
- onUnmounted(() => ob.disconnect());
10115
- });
10116
- }
10117
- function setVarsOnVNode(vnode, vars) {
10118
- if (vnode.shapeFlag & 128) {
10119
- const suspense = vnode.suspense;
10120
- vnode = suspense.activeBranch;
10121
- if (suspense.pendingBranch && !suspense.isHydrating) {
10122
- suspense.effects.push(() => {
10123
- setVarsOnVNode(suspense.activeBranch, vars);
10124
- });
10125
- }
10126
- }
10127
- while (vnode.component) {
10128
- vnode = vnode.component.subTree;
10129
- }
10130
- if (vnode.shapeFlag & 1 && vnode.el) {
10131
- setVarsOnNode(vnode.el, vars);
10132
- } else if (vnode.type === Fragment) {
10133
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10134
- } else if (vnode.type === Static) {
10135
- let { el, anchor } = vnode;
10136
- while (el) {
10137
- setVarsOnNode(el, vars);
10138
- if (el === anchor)
10139
- break;
10140
- el = el.nextSibling;
10141
- }
10142
- }
10143
- }
10144
- function setVarsOnNode(el, vars) {
10145
- if (el.nodeType === 1) {
10146
- const style = el.style;
10147
- for (const key in vars) {
10148
- style.setProperty(`--${key}`, vars[key]);
10149
- }
10150
- }
10151
- }
10152
-
10153
10183
  const positionMap = /* @__PURE__ */ new WeakMap();
10154
10184
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10155
10185
  const moveCbKey = Symbol("_moveCb");