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.
@@ -791,17 +791,19 @@ var Vue = (function (exports) {
791
791
  }
792
792
  set(target, key, value, receiver) {
793
793
  let oldValue = target[key];
794
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
795
- return false;
796
- }
797
794
  if (!this._shallow) {
795
+ const isOldValueReadonly = isReadonly(oldValue);
798
796
  if (!isShallow(value) && !isReadonly(value)) {
799
797
  oldValue = toRaw(oldValue);
800
798
  value = toRaw(value);
801
799
  }
802
800
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
803
- oldValue.value = value;
804
- return true;
801
+ if (isOldValueReadonly) {
802
+ return false;
803
+ } else {
804
+ oldValue.value = value;
805
+ return true;
806
+ }
805
807
  }
806
808
  }
807
809
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -2881,7 +2883,7 @@ If this is a native custom element, make sure to exclude it from component resol
2881
2883
  timeout: typeof timeout === "number" ? timeout : -1,
2882
2884
  activeBranch: null,
2883
2885
  pendingBranch: null,
2884
- isInFallback: true,
2886
+ isInFallback: !isHydrating,
2885
2887
  isHydrating,
2886
2888
  isUnmounted: false,
2887
2889
  effects: [],
@@ -6191,6 +6193,16 @@ If you want to remount the same app, move your app creation logic into a factory
6191
6193
  if (dirs) {
6192
6194
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6193
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
+ }
6194
6206
  if (props) {
6195
6207
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6196
6208
  for (const key in props) {
@@ -6223,16 +6235,6 @@ If you want to remount the same app, move your app creation logic into a factory
6223
6235
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6224
6236
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6225
6237
  }
6226
- let needCallTransitionHooks = false;
6227
- if (isTemplateNode(el)) {
6228
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6229
- const content = el.content.firstChild;
6230
- if (needCallTransitionHooks) {
6231
- transition.beforeEnter(content);
6232
- }
6233
- replaceNode(content, el, parentComponent);
6234
- vnode.el = el = content;
6235
- }
6236
6238
  if (dirs) {
6237
6239
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6238
6240
  }
@@ -9189,7 +9191,7 @@ Component that was made reactive: `,
9189
9191
  return true;
9190
9192
  }
9191
9193
 
9192
- const version = "3.3.11";
9194
+ const version = "3.3.13";
9193
9195
  const ssrUtils = null;
9194
9196
  const resolveFilter = null;
9195
9197
  const compatUtils = null;
@@ -9584,6 +9586,69 @@ Component that was made reactive: `,
9584
9586
  el.style.display = value ? el[vShowOldKey] : "none";
9585
9587
  }
9586
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
+
9587
9652
  function patchStyle(el, prev, next) {
9588
9653
  const style = el.style;
9589
9654
  const isCssString = isString(next);
@@ -9602,6 +9667,10 @@ Component that was made reactive: `,
9602
9667
  const currentDisplay = style.display;
9603
9668
  if (isCssString) {
9604
9669
  if (prev !== next) {
9670
+ const cssVarText = style[CSS_VAR_TEXT];
9671
+ if (cssVarText) {
9672
+ next += ";" + cssVarText;
9673
+ }
9605
9674
  style.cssText = next;
9606
9675
  }
9607
9676
  } else if (prev) {
@@ -10096,65 +10165,6 @@ Component that was made reactive: `,
10096
10165
  }
10097
10166
  }
10098
10167
 
10099
- function useCssVars(getter) {
10100
- const instance = getCurrentInstance();
10101
- if (!instance) {
10102
- warn(`useCssVars is called without current active component instance.`);
10103
- return;
10104
- }
10105
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10106
- Array.from(
10107
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10108
- ).forEach((node) => setVarsOnNode(node, vars));
10109
- };
10110
- const setVars = () => {
10111
- const vars = getter(instance.proxy);
10112
- setVarsOnVNode(instance.subTree, vars);
10113
- updateTeleports(vars);
10114
- };
10115
- watchPostEffect(setVars);
10116
- onMounted(() => {
10117
- const ob = new MutationObserver(setVars);
10118
- ob.observe(instance.subTree.el.parentNode, { childList: true });
10119
- onUnmounted(() => ob.disconnect());
10120
- });
10121
- }
10122
- function setVarsOnVNode(vnode, vars) {
10123
- if (vnode.shapeFlag & 128) {
10124
- const suspense = vnode.suspense;
10125
- vnode = suspense.activeBranch;
10126
- if (suspense.pendingBranch && !suspense.isHydrating) {
10127
- suspense.effects.push(() => {
10128
- setVarsOnVNode(suspense.activeBranch, vars);
10129
- });
10130
- }
10131
- }
10132
- while (vnode.component) {
10133
- vnode = vnode.component.subTree;
10134
- }
10135
- if (vnode.shapeFlag & 1 && vnode.el) {
10136
- setVarsOnNode(vnode.el, vars);
10137
- } else if (vnode.type === Fragment) {
10138
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10139
- } else if (vnode.type === Static) {
10140
- let { el, anchor } = vnode;
10141
- while (el) {
10142
- setVarsOnNode(el, vars);
10143
- if (el === anchor)
10144
- break;
10145
- el = el.nextSibling;
10146
- }
10147
- }
10148
- }
10149
- function setVarsOnNode(el, vars) {
10150
- if (el.nodeType === 1) {
10151
- const style = el.style;
10152
- for (const key in vars) {
10153
- style.setProperty(`--${key}`, vars[key]);
10154
- }
10155
- }
10156
- }
10157
-
10158
10168
  const positionMap = /* @__PURE__ */ new WeakMap();
10159
10169
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10160
10170
  const moveCbKey = Symbol("_moveCb");
@@ -10528,7 +10538,9 @@ Component that was made reactive: `,
10528
10538
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
10529
10539
  };
10530
10540
  const withModifiers = (fn, modifiers) => {
10531
- return fn._withMods || (fn._withMods = (event, ...args) => {
10541
+ const cache = fn._withMods || (fn._withMods = {});
10542
+ const cacheKey = modifiers.join(".");
10543
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
10532
10544
  for (let i = 0; i < modifiers.length; i++) {
10533
10545
  const guard = modifierGuards[modifiers[i]];
10534
10546
  if (guard && guard(event, modifiers))
@@ -10547,7 +10559,9 @@ Component that was made reactive: `,
10547
10559
  delete: "backspace"
10548
10560
  };
10549
10561
  const withKeys = (fn, modifiers) => {
10550
- return fn._withKeys || (fn._withKeys = (event) => {
10562
+ const cache = fn._withKeys || (fn._withKeys = {});
10563
+ const cacheKey = modifiers.join(".");
10564
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
10551
10565
  if (!("key" in event)) {
10552
10566
  return;
10553
10567
  }