vue 3.3.11 → 3.3.13

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.
@@ -723,17 +723,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
723
723
  }
724
724
  set(target, key, value, receiver) {
725
725
  let oldValue = target[key];
726
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
727
- return false;
728
- }
729
726
  if (!this._shallow) {
727
+ const isOldValueReadonly = isReadonly(oldValue);
730
728
  if (!isShallow(value) && !isReadonly(value)) {
731
729
  oldValue = toRaw(oldValue);
732
730
  value = toRaw(value);
733
731
  }
734
732
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
735
- oldValue.value = value;
736
- return true;
733
+ if (isOldValueReadonly) {
734
+ return false;
735
+ } else {
736
+ oldValue.value = value;
737
+ return true;
738
+ }
737
739
  }
738
740
  }
739
741
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -2813,7 +2815,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2813
2815
  timeout: typeof timeout === "number" ? timeout : -1,
2814
2816
  activeBranch: null,
2815
2817
  pendingBranch: null,
2816
- isInFallback: true,
2818
+ isInFallback: !isHydrating,
2817
2819
  isHydrating,
2818
2820
  isUnmounted: false,
2819
2821
  effects: [],
@@ -6123,6 +6125,16 @@ function createHydrationFunctions(rendererInternals) {
6123
6125
  if (dirs) {
6124
6126
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6125
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
+ }
6126
6138
  if (props) {
6127
6139
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6128
6140
  for (const key in props) {
@@ -6155,16 +6167,6 @@ function createHydrationFunctions(rendererInternals) {
6155
6167
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6156
6168
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6157
6169
  }
6158
- let needCallTransitionHooks = false;
6159
- if (isTemplateNode(el)) {
6160
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6161
- const content = el.content.firstChild;
6162
- if (needCallTransitionHooks) {
6163
- transition.beforeEnter(content);
6164
- }
6165
- replaceNode(content, el, parentComponent);
6166
- vnode.el = el = content;
6167
- }
6168
6170
  if (dirs) {
6169
6171
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6170
6172
  }
@@ -9127,7 +9129,7 @@ function isMemoSame(cached, memo) {
9127
9129
  return true;
9128
9130
  }
9129
9131
 
9130
- const version = "3.3.11";
9132
+ const version = "3.3.13";
9131
9133
  const ssrUtils = null;
9132
9134
  const resolveFilter = null;
9133
9135
  const compatUtils = null;
@@ -9522,6 +9524,69 @@ function setDisplay(el, value) {
9522
9524
  el.style.display = value ? el[vShowOldKey] : "none";
9523
9525
  }
9524
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
+
9525
9590
  function patchStyle(el, prev, next) {
9526
9591
  const style = el.style;
9527
9592
  const isCssString = isString(next);
@@ -9540,6 +9605,10 @@ function patchStyle(el, prev, next) {
9540
9605
  const currentDisplay = style.display;
9541
9606
  if (isCssString) {
9542
9607
  if (prev !== next) {
9608
+ const cssVarText = style[CSS_VAR_TEXT];
9609
+ if (cssVarText) {
9610
+ next += ";" + cssVarText;
9611
+ }
9543
9612
  style.cssText = next;
9544
9613
  }
9545
9614
  } else if (prev) {
@@ -10046,65 +10115,6 @@ function useCssModule(name = "$style") {
10046
10115
  }
10047
10116
  }
10048
10117
 
10049
- function useCssVars(getter) {
10050
- const instance = getCurrentInstance();
10051
- if (!instance) {
10052
- warn(`useCssVars is called without current active component instance.`);
10053
- return;
10054
- }
10055
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10056
- Array.from(
10057
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10058
- ).forEach((node) => setVarsOnNode(node, vars));
10059
- };
10060
- const setVars = () => {
10061
- const vars = getter(instance.proxy);
10062
- setVarsOnVNode(instance.subTree, vars);
10063
- updateTeleports(vars);
10064
- };
10065
- watchPostEffect(setVars);
10066
- onMounted(() => {
10067
- const ob = new MutationObserver(setVars);
10068
- ob.observe(instance.subTree.el.parentNode, { childList: true });
10069
- onUnmounted(() => ob.disconnect());
10070
- });
10071
- }
10072
- function setVarsOnVNode(vnode, vars) {
10073
- if (vnode.shapeFlag & 128) {
10074
- const suspense = vnode.suspense;
10075
- vnode = suspense.activeBranch;
10076
- if (suspense.pendingBranch && !suspense.isHydrating) {
10077
- suspense.effects.push(() => {
10078
- setVarsOnVNode(suspense.activeBranch, vars);
10079
- });
10080
- }
10081
- }
10082
- while (vnode.component) {
10083
- vnode = vnode.component.subTree;
10084
- }
10085
- if (vnode.shapeFlag & 1 && vnode.el) {
10086
- setVarsOnNode(vnode.el, vars);
10087
- } else if (vnode.type === Fragment) {
10088
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10089
- } else if (vnode.type === Static) {
10090
- let { el, anchor } = vnode;
10091
- while (el) {
10092
- setVarsOnNode(el, vars);
10093
- if (el === anchor)
10094
- break;
10095
- el = el.nextSibling;
10096
- }
10097
- }
10098
- }
10099
- function setVarsOnNode(el, vars) {
10100
- if (el.nodeType === 1) {
10101
- const style = el.style;
10102
- for (const key in vars) {
10103
- style.setProperty(`--${key}`, vars[key]);
10104
- }
10105
- }
10106
- }
10107
-
10108
10118
  const positionMap = /* @__PURE__ */ new WeakMap();
10109
10119
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10110
10120
  const moveCbKey = Symbol("_moveCb");
@@ -10478,7 +10488,9 @@ const modifierGuards = {
10478
10488
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
10479
10489
  };
10480
10490
  const withModifiers = (fn, modifiers) => {
10481
- return fn._withMods || (fn._withMods = (event, ...args) => {
10491
+ const cache = fn._withMods || (fn._withMods = {});
10492
+ const cacheKey = modifiers.join(".");
10493
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
10482
10494
  for (let i = 0; i < modifiers.length; i++) {
10483
10495
  const guard = modifierGuards[modifiers[i]];
10484
10496
  if (guard && guard(event, modifiers))
@@ -10497,7 +10509,9 @@ const keyNames = {
10497
10509
  delete: "backspace"
10498
10510
  };
10499
10511
  const withKeys = (fn, modifiers) => {
10500
- return fn._withKeys || (fn._withKeys = (event) => {
10512
+ const cache = fn._withKeys || (fn._withKeys = {});
10513
+ const cacheKey = modifiers.join(".");
10514
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
10501
10515
  if (!("key" in event)) {
10502
10516
  return;
10503
10517
  }