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.
@@ -788,17 +788,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
788
788
  }
789
789
  set(target, key, value, receiver) {
790
790
  let oldValue = target[key];
791
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
792
- return false;
793
- }
794
791
  if (!this._shallow) {
792
+ const isOldValueReadonly = isReadonly(oldValue);
795
793
  if (!isShallow(value) && !isReadonly(value)) {
796
794
  oldValue = toRaw(oldValue);
797
795
  value = toRaw(value);
798
796
  }
799
797
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
800
- oldValue.value = value;
801
- return true;
798
+ if (isOldValueReadonly) {
799
+ return false;
800
+ } else {
801
+ oldValue.value = value;
802
+ return true;
803
+ }
802
804
  }
803
805
  }
804
806
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -2878,7 +2880,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2878
2880
  timeout: typeof timeout === "number" ? timeout : -1,
2879
2881
  activeBranch: null,
2880
2882
  pendingBranch: null,
2881
- isInFallback: true,
2883
+ isInFallback: !isHydrating,
2882
2884
  isHydrating,
2883
2885
  isUnmounted: false,
2884
2886
  effects: [],
@@ -6188,6 +6190,16 @@ function createHydrationFunctions(rendererInternals) {
6188
6190
  if (dirs) {
6189
6191
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6190
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
+ }
6191
6203
  if (props) {
6192
6204
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6193
6205
  for (const key in props) {
@@ -6220,16 +6232,6 @@ function createHydrationFunctions(rendererInternals) {
6220
6232
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6221
6233
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6222
6234
  }
6223
- let needCallTransitionHooks = false;
6224
- if (isTemplateNode(el)) {
6225
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6226
- const content = el.content.firstChild;
6227
- if (needCallTransitionHooks) {
6228
- transition.beforeEnter(content);
6229
- }
6230
- replaceNode(content, el, parentComponent);
6231
- vnode.el = el = content;
6232
- }
6233
6235
  if (dirs) {
6234
6236
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6235
6237
  }
@@ -9192,7 +9194,7 @@ function isMemoSame(cached, memo) {
9192
9194
  return true;
9193
9195
  }
9194
9196
 
9195
- const version = "3.3.11";
9197
+ const version = "3.3.13";
9196
9198
  const ssrUtils = null;
9197
9199
  const resolveFilter = null;
9198
9200
  const compatUtils = null;
@@ -9587,6 +9589,69 @@ function setDisplay(el, value) {
9587
9589
  el.style.display = value ? el[vShowOldKey] : "none";
9588
9590
  }
9589
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
+
9590
9655
  function patchStyle(el, prev, next) {
9591
9656
  const style = el.style;
9592
9657
  const isCssString = isString(next);
@@ -9605,6 +9670,10 @@ function patchStyle(el, prev, next) {
9605
9670
  const currentDisplay = style.display;
9606
9671
  if (isCssString) {
9607
9672
  if (prev !== next) {
9673
+ const cssVarText = style[CSS_VAR_TEXT];
9674
+ if (cssVarText) {
9675
+ next += ";" + cssVarText;
9676
+ }
9608
9677
  style.cssText = next;
9609
9678
  }
9610
9679
  } else if (prev) {
@@ -10111,65 +10180,6 @@ function useCssModule(name = "$style") {
10111
10180
  }
10112
10181
  }
10113
10182
 
10114
- function useCssVars(getter) {
10115
- const instance = getCurrentInstance();
10116
- if (!instance) {
10117
- warn(`useCssVars is called without current active component instance.`);
10118
- return;
10119
- }
10120
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10121
- Array.from(
10122
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10123
- ).forEach((node) => setVarsOnNode(node, vars));
10124
- };
10125
- const setVars = () => {
10126
- const vars = getter(instance.proxy);
10127
- setVarsOnVNode(instance.subTree, vars);
10128
- updateTeleports(vars);
10129
- };
10130
- watchPostEffect(setVars);
10131
- onMounted(() => {
10132
- const ob = new MutationObserver(setVars);
10133
- ob.observe(instance.subTree.el.parentNode, { childList: true });
10134
- onUnmounted(() => ob.disconnect());
10135
- });
10136
- }
10137
- function setVarsOnVNode(vnode, vars) {
10138
- if (vnode.shapeFlag & 128) {
10139
- const suspense = vnode.suspense;
10140
- vnode = suspense.activeBranch;
10141
- if (suspense.pendingBranch && !suspense.isHydrating) {
10142
- suspense.effects.push(() => {
10143
- setVarsOnVNode(suspense.activeBranch, vars);
10144
- });
10145
- }
10146
- }
10147
- while (vnode.component) {
10148
- vnode = vnode.component.subTree;
10149
- }
10150
- if (vnode.shapeFlag & 1 && vnode.el) {
10151
- setVarsOnNode(vnode.el, vars);
10152
- } else if (vnode.type === Fragment) {
10153
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10154
- } else if (vnode.type === Static) {
10155
- let { el, anchor } = vnode;
10156
- while (el) {
10157
- setVarsOnNode(el, vars);
10158
- if (el === anchor)
10159
- break;
10160
- el = el.nextSibling;
10161
- }
10162
- }
10163
- }
10164
- function setVarsOnNode(el, vars) {
10165
- if (el.nodeType === 1) {
10166
- const style = el.style;
10167
- for (const key in vars) {
10168
- style.setProperty(`--${key}`, vars[key]);
10169
- }
10170
- }
10171
- }
10172
-
10173
10183
  const positionMap = /* @__PURE__ */ new WeakMap();
10174
10184
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10175
10185
  const moveCbKey = Symbol("_moveCb");
@@ -10543,7 +10553,9 @@ const modifierGuards = {
10543
10553
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
10544
10554
  };
10545
10555
  const withModifiers = (fn, modifiers) => {
10546
- return fn._withMods || (fn._withMods = (event, ...args) => {
10556
+ const cache = fn._withMods || (fn._withMods = {});
10557
+ const cacheKey = modifiers.join(".");
10558
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
10547
10559
  for (let i = 0; i < modifiers.length; i++) {
10548
10560
  const guard = modifierGuards[modifiers[i]];
10549
10561
  if (guard && guard(event, modifiers))
@@ -10562,7 +10574,9 @@ const keyNames = {
10562
10574
  delete: "backspace"
10563
10575
  };
10564
10576
  const withKeys = (fn, modifiers) => {
10565
- return fn._withKeys || (fn._withKeys = (event) => {
10577
+ const cache = fn._withKeys || (fn._withKeys = {});
10578
+ const cacheKey = modifiers.join(".");
10579
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
10566
10580
  if (!("key" in event)) {
10567
10581
  return;
10568
10582
  }