@vue/runtime-dom 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.
@@ -402,6 +402,11 @@ function initVShowForSSR() {
402
402
  };
403
403
  }
404
404
 
405
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
406
+ function useCssVars(getter) {
407
+ return;
408
+ }
409
+
405
410
  function patchStyle(el, prev, next) {
406
411
  const style = el.style;
407
412
  const isCssString = shared.isString(next);
@@ -420,6 +425,10 @@ function patchStyle(el, prev, next) {
420
425
  const currentDisplay = style.display;
421
426
  if (isCssString) {
422
427
  if (prev !== next) {
428
+ const cssVarText = style[CSS_VAR_TEXT];
429
+ if (cssVarText) {
430
+ next += ";" + cssVarText;
431
+ }
423
432
  style.cssText = next;
424
433
  }
425
434
  } else if (prev) {
@@ -673,7 +682,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
673
682
  }
674
683
  if (key === "width" || key === "height") {
675
684
  const tag = el.tagName;
676
- return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
685
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
686
+ return false;
687
+ }
677
688
  }
678
689
  if (isNativeOn(key) && shared.isString(value)) {
679
690
  return false;
@@ -924,10 +935,6 @@ function useCssModule(name = "$style") {
924
935
  }
925
936
  }
926
937
 
927
- function useCssVars(getter) {
928
- return;
929
- }
930
-
931
938
  const positionMap = /* @__PURE__ */ new WeakMap();
932
939
  const newPositionMap = /* @__PURE__ */ new WeakMap();
933
940
  const moveCbKey = Symbol("_moveCb");
@@ -399,6 +399,11 @@ function initVShowForSSR() {
399
399
  };
400
400
  }
401
401
 
402
+ const CSS_VAR_TEXT = Symbol("");
403
+ function useCssVars(getter) {
404
+ return;
405
+ }
406
+
402
407
  function patchStyle(el, prev, next) {
403
408
  const style = el.style;
404
409
  const isCssString = shared.isString(next);
@@ -417,6 +422,10 @@ function patchStyle(el, prev, next) {
417
422
  const currentDisplay = style.display;
418
423
  if (isCssString) {
419
424
  if (prev !== next) {
425
+ const cssVarText = style[CSS_VAR_TEXT];
426
+ if (cssVarText) {
427
+ next += ";" + cssVarText;
428
+ }
420
429
  style.cssText = next;
421
430
  }
422
431
  } else if (prev) {
@@ -656,7 +665,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
656
665
  }
657
666
  if (key === "width" || key === "height") {
658
667
  const tag = el.tagName;
659
- return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
668
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
669
+ return false;
670
+ }
660
671
  }
661
672
  if (isNativeOn(key) && shared.isString(value)) {
662
673
  return false;
@@ -885,10 +896,6 @@ function useCssModule(name = "$style") {
885
896
  }
886
897
  }
887
898
 
888
- function useCssVars(getter) {
889
- return;
890
- }
891
-
892
899
  const positionMap = /* @__PURE__ */ new WeakMap();
893
900
  const newPositionMap = /* @__PURE__ */ new WeakMap();
894
901
  const moveCbKey = Symbol("_moveCb");
@@ -1012,6 +1012,7 @@ export interface SVGAttributes extends AriaAttributes, EventHandlers<Events> {
1012
1012
  xlinkTitle?: string;
1013
1013
  xlinkType?: string;
1014
1014
  xmlns?: string;
1015
+ xmlnsXlink?: string;
1015
1016
  y1?: Numberish;
1016
1017
  y2?: Numberish;
1017
1018
  y?: Numberish;
@@ -235,20 +235,29 @@ const replacer = (_key, val) => {
235
235
  return replacer(_key, val.value);
236
236
  } else if (isMap(val)) {
237
237
  return {
238
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
239
- entries[`${key} =>`] = val2;
240
- return entries;
241
- }, {})
238
+ [`Map(${val.size})`]: [...val.entries()].reduce(
239
+ (entries, [key, val2], i) => {
240
+ entries[stringifySymbol(key, i) + " =>"] = val2;
241
+ return entries;
242
+ },
243
+ {}
244
+ )
242
245
  };
243
246
  } else if (isSet(val)) {
244
247
  return {
245
- [`Set(${val.size})`]: [...val.values()]
248
+ [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
246
249
  };
250
+ } else if (isSymbol(val)) {
251
+ return stringifySymbol(val);
247
252
  } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
248
253
  return String(val);
249
254
  }
250
255
  return val;
251
256
  };
257
+ const stringifySymbol = (v, i = "") => {
258
+ var _a;
259
+ return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
260
+ };
252
261
 
253
262
  function warn$1(msg, ...args) {
254
263
  console.warn(`[Vue warn] ${msg}`, ...args);
@@ -672,8 +681,13 @@ class BaseReactiveHandler {
672
681
  return isReadonly2;
673
682
  } else if (key === "__v_isShallow") {
674
683
  return shallow;
675
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
676
- return target;
684
+ } else if (key === "__v_raw") {
685
+ if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
686
+ // this means the reciever is a user proxy of the reactive proxy
687
+ Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
688
+ return target;
689
+ }
690
+ return;
677
691
  }
678
692
  const targetIsArray = isArray(target);
679
693
  if (!isReadonly2) {
@@ -709,17 +723,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
709
723
  }
710
724
  set(target, key, value, receiver) {
711
725
  let oldValue = target[key];
712
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
713
- return false;
714
- }
715
726
  if (!this._shallow) {
727
+ const isOldValueReadonly = isReadonly(oldValue);
716
728
  if (!isShallow(value) && !isReadonly(value)) {
717
729
  oldValue = toRaw(oldValue);
718
730
  value = toRaw(value);
719
731
  }
720
732
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
721
- oldValue.value = value;
722
- return true;
733
+ if (isOldValueReadonly) {
734
+ return false;
735
+ } else {
736
+ oldValue.value = value;
737
+ return true;
738
+ }
723
739
  }
724
740
  }
725
741
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -1684,13 +1700,16 @@ function queuePostFlushCb(cb) {
1684
1700
  }
1685
1701
  queueFlush();
1686
1702
  }
1687
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
1703
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1688
1704
  {
1689
1705
  seen = seen || /* @__PURE__ */ new Map();
1690
1706
  }
1691
1707
  for (; i < queue.length; i++) {
1692
1708
  const cb = queue[i];
1693
1709
  if (cb && cb.pre) {
1710
+ if (instance && cb.id !== instance.uid) {
1711
+ continue;
1712
+ }
1694
1713
  if (checkRecursiveUpdates(seen, cb)) {
1695
1714
  continue;
1696
1715
  }
@@ -2796,7 +2815,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2796
2815
  timeout: typeof timeout === "number" ? timeout : -1,
2797
2816
  activeBranch: null,
2798
2817
  pendingBranch: null,
2799
- isInFallback: true,
2818
+ isInFallback: !isHydrating,
2800
2819
  isHydrating,
2801
2820
  isUnmounted: false,
2802
2821
  effects: [],
@@ -2882,6 +2901,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2882
2901
  }
2883
2902
  const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
2884
2903
  triggerEvent(vnode2, "onFallback");
2904
+ const anchor2 = next(activeBranch);
2885
2905
  const mountFallback = () => {
2886
2906
  if (!suspense.isInFallback) {
2887
2907
  return;
@@ -2890,7 +2910,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2890
2910
  null,
2891
2911
  fallbackVNode,
2892
2912
  container2,
2893
- next(activeBranch),
2913
+ anchor2,
2894
2914
  parentComponent2,
2895
2915
  null,
2896
2916
  // fallback tree will not have suspense context
@@ -6105,6 +6125,16 @@ function createHydrationFunctions(rendererInternals) {
6105
6125
  if (dirs) {
6106
6126
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6107
6127
  }
6128
+ let needCallTransitionHooks = false;
6129
+ if (isTemplateNode(el)) {
6130
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6131
+ const content = el.content.firstChild;
6132
+ if (needCallTransitionHooks) {
6133
+ transition.beforeEnter(content);
6134
+ }
6135
+ replaceNode(content, el, parentComponent);
6136
+ vnode.el = el = content;
6137
+ }
6108
6138
  if (props) {
6109
6139
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6110
6140
  for (const key in props) {
@@ -6137,16 +6167,6 @@ function createHydrationFunctions(rendererInternals) {
6137
6167
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6138
6168
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6139
6169
  }
6140
- let needCallTransitionHooks = false;
6141
- if (isTemplateNode(el)) {
6142
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6143
- const content = el.content.firstChild;
6144
- if (needCallTransitionHooks) {
6145
- transition.beforeEnter(content);
6146
- }
6147
- replaceNode(content, el, parentComponent);
6148
- vnode.el = el = content;
6149
- }
6150
6170
  if (dirs) {
6151
6171
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6152
6172
  }
@@ -7236,7 +7256,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7236
7256
  updateProps(instance, nextVNode.props, prevProps, optimized);
7237
7257
  updateSlots(instance, nextVNode.children, optimized);
7238
7258
  pauseTracking();
7239
- flushPreFlushCbs();
7259
+ flushPreFlushCbs(instance);
7240
7260
  resetTracking();
7241
7261
  };
7242
7262
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
@@ -9109,7 +9129,7 @@ function isMemoSame(cached, memo) {
9109
9129
  return true;
9110
9130
  }
9111
9131
 
9112
- const version = "3.3.10";
9132
+ const version = "3.3.12";
9113
9133
  const ssrUtils = null;
9114
9134
  const resolveFilter = null;
9115
9135
  const compatUtils = null;
@@ -9504,6 +9524,69 @@ function setDisplay(el, value) {
9504
9524
  el.style.display = value ? el[vShowOldKey] : "none";
9505
9525
  }
9506
9526
 
9527
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
9528
+ function useCssVars(getter) {
9529
+ const instance = getCurrentInstance();
9530
+ if (!instance) {
9531
+ warn(`useCssVars is called without current active component instance.`);
9532
+ return;
9533
+ }
9534
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
9535
+ Array.from(
9536
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
9537
+ ).forEach((node) => setVarsOnNode(node, vars));
9538
+ };
9539
+ const setVars = () => {
9540
+ const vars = getter(instance.proxy);
9541
+ setVarsOnVNode(instance.subTree, vars);
9542
+ updateTeleports(vars);
9543
+ };
9544
+ watchPostEffect(setVars);
9545
+ onMounted(() => {
9546
+ const ob = new MutationObserver(setVars);
9547
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
9548
+ onUnmounted(() => ob.disconnect());
9549
+ });
9550
+ }
9551
+ function setVarsOnVNode(vnode, vars) {
9552
+ if (vnode.shapeFlag & 128) {
9553
+ const suspense = vnode.suspense;
9554
+ vnode = suspense.activeBranch;
9555
+ if (suspense.pendingBranch && !suspense.isHydrating) {
9556
+ suspense.effects.push(() => {
9557
+ setVarsOnVNode(suspense.activeBranch, vars);
9558
+ });
9559
+ }
9560
+ }
9561
+ while (vnode.component) {
9562
+ vnode = vnode.component.subTree;
9563
+ }
9564
+ if (vnode.shapeFlag & 1 && vnode.el) {
9565
+ setVarsOnNode(vnode.el, vars);
9566
+ } else if (vnode.type === Fragment) {
9567
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
9568
+ } else if (vnode.type === Static) {
9569
+ let { el, anchor } = vnode;
9570
+ while (el) {
9571
+ setVarsOnNode(el, vars);
9572
+ if (el === anchor)
9573
+ break;
9574
+ el = el.nextSibling;
9575
+ }
9576
+ }
9577
+ }
9578
+ function setVarsOnNode(el, vars) {
9579
+ if (el.nodeType === 1) {
9580
+ const style = el.style;
9581
+ let cssText = "";
9582
+ for (const key in vars) {
9583
+ style.setProperty(`--${key}`, vars[key]);
9584
+ cssText += `--${key}: ${vars[key]};`;
9585
+ }
9586
+ style[CSS_VAR_TEXT] = cssText;
9587
+ }
9588
+ }
9589
+
9507
9590
  function patchStyle(el, prev, next) {
9508
9591
  const style = el.style;
9509
9592
  const isCssString = isString(next);
@@ -9522,6 +9605,10 @@ function patchStyle(el, prev, next) {
9522
9605
  const currentDisplay = style.display;
9523
9606
  if (isCssString) {
9524
9607
  if (prev !== next) {
9608
+ const cssVarText = style[CSS_VAR_TEXT];
9609
+ if (cssVarText) {
9610
+ next += ";" + cssVarText;
9611
+ }
9525
9612
  style.cssText = next;
9526
9613
  }
9527
9614
  } else if (prev) {
@@ -9775,7 +9862,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
9775
9862
  }
9776
9863
  if (key === "width" || key === "height") {
9777
9864
  const tag = el.tagName;
9778
- return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
9865
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
9866
+ return false;
9867
+ }
9779
9868
  }
9780
9869
  if (isNativeOn(key) && isString(value)) {
9781
9870
  return false;
@@ -10026,65 +10115,6 @@ function useCssModule(name = "$style") {
10026
10115
  }
10027
10116
  }
10028
10117
 
10029
- function useCssVars(getter) {
10030
- const instance = getCurrentInstance();
10031
- if (!instance) {
10032
- warn(`useCssVars is called without current active component instance.`);
10033
- return;
10034
- }
10035
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10036
- Array.from(
10037
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10038
- ).forEach((node) => setVarsOnNode(node, vars));
10039
- };
10040
- const setVars = () => {
10041
- const vars = getter(instance.proxy);
10042
- setVarsOnVNode(instance.subTree, vars);
10043
- updateTeleports(vars);
10044
- };
10045
- watchPostEffect(setVars);
10046
- onMounted(() => {
10047
- const ob = new MutationObserver(setVars);
10048
- ob.observe(instance.subTree.el.parentNode, { childList: true });
10049
- onUnmounted(() => ob.disconnect());
10050
- });
10051
- }
10052
- function setVarsOnVNode(vnode, vars) {
10053
- if (vnode.shapeFlag & 128) {
10054
- const suspense = vnode.suspense;
10055
- vnode = suspense.activeBranch;
10056
- if (suspense.pendingBranch && !suspense.isHydrating) {
10057
- suspense.effects.push(() => {
10058
- setVarsOnVNode(suspense.activeBranch, vars);
10059
- });
10060
- }
10061
- }
10062
- while (vnode.component) {
10063
- vnode = vnode.component.subTree;
10064
- }
10065
- if (vnode.shapeFlag & 1 && vnode.el) {
10066
- setVarsOnNode(vnode.el, vars);
10067
- } else if (vnode.type === Fragment) {
10068
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10069
- } else if (vnode.type === Static) {
10070
- let { el, anchor } = vnode;
10071
- while (el) {
10072
- setVarsOnNode(el, vars);
10073
- if (el === anchor)
10074
- break;
10075
- el = el.nextSibling;
10076
- }
10077
- }
10078
- }
10079
- function setVarsOnNode(el, vars) {
10080
- if (el.nodeType === 1) {
10081
- const style = el.style;
10082
- for (const key in vars) {
10083
- style.setProperty(`--${key}`, vars[key]);
10084
- }
10085
- }
10086
- }
10087
-
10088
10118
  const positionMap = /* @__PURE__ */ new WeakMap();
10089
10119
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10090
10120
  const moveCbKey = Symbol("_moveCb");