@vue/runtime-dom 3.3.11 → 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.
@@ -726,17 +726,19 @@ var VueRuntimeDOM = (function (exports) {
726
726
  }
727
727
  set(target, key, value, receiver) {
728
728
  let oldValue = target[key];
729
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
730
- return false;
731
- }
732
729
  if (!this._shallow) {
730
+ const isOldValueReadonly = isReadonly(oldValue);
733
731
  if (!isShallow(value) && !isReadonly(value)) {
734
732
  oldValue = toRaw(oldValue);
735
733
  value = toRaw(value);
736
734
  }
737
735
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
738
- oldValue.value = value;
739
- return true;
736
+ if (isOldValueReadonly) {
737
+ return false;
738
+ } else {
739
+ oldValue.value = value;
740
+ return true;
741
+ }
740
742
  }
741
743
  }
742
744
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -2816,7 +2818,7 @@ If this is a native custom element, make sure to exclude it from component resol
2816
2818
  timeout: typeof timeout === "number" ? timeout : -1,
2817
2819
  activeBranch: null,
2818
2820
  pendingBranch: null,
2819
- isInFallback: true,
2821
+ isInFallback: !isHydrating,
2820
2822
  isHydrating,
2821
2823
  isUnmounted: false,
2822
2824
  effects: [],
@@ -6126,6 +6128,16 @@ If you want to remount the same app, move your app creation logic into a factory
6126
6128
  if (dirs) {
6127
6129
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6128
6130
  }
6131
+ let needCallTransitionHooks = false;
6132
+ if (isTemplateNode(el)) {
6133
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6134
+ const content = el.content.firstChild;
6135
+ if (needCallTransitionHooks) {
6136
+ transition.beforeEnter(content);
6137
+ }
6138
+ replaceNode(content, el, parentComponent);
6139
+ vnode.el = el = content;
6140
+ }
6129
6141
  if (props) {
6130
6142
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6131
6143
  for (const key in props) {
@@ -6158,16 +6170,6 @@ If you want to remount the same app, move your app creation logic into a factory
6158
6170
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6159
6171
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6160
6172
  }
6161
- let needCallTransitionHooks = false;
6162
- if (isTemplateNode(el)) {
6163
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6164
- const content = el.content.firstChild;
6165
- if (needCallTransitionHooks) {
6166
- transition.beforeEnter(content);
6167
- }
6168
- replaceNode(content, el, parentComponent);
6169
- vnode.el = el = content;
6170
- }
6171
6173
  if (dirs) {
6172
6174
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6173
6175
  }
@@ -9124,7 +9126,7 @@ Component that was made reactive: `,
9124
9126
  return true;
9125
9127
  }
9126
9128
 
9127
- const version = "3.3.11";
9129
+ const version = "3.3.12";
9128
9130
  const ssrUtils = null;
9129
9131
  const resolveFilter = null;
9130
9132
  const compatUtils = null;
@@ -9519,6 +9521,69 @@ Component that was made reactive: `,
9519
9521
  el.style.display = value ? el[vShowOldKey] : "none";
9520
9522
  }
9521
9523
 
9524
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
9525
+ function useCssVars(getter) {
9526
+ const instance = getCurrentInstance();
9527
+ if (!instance) {
9528
+ warn(`useCssVars is called without current active component instance.`);
9529
+ return;
9530
+ }
9531
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
9532
+ Array.from(
9533
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
9534
+ ).forEach((node) => setVarsOnNode(node, vars));
9535
+ };
9536
+ const setVars = () => {
9537
+ const vars = getter(instance.proxy);
9538
+ setVarsOnVNode(instance.subTree, vars);
9539
+ updateTeleports(vars);
9540
+ };
9541
+ watchPostEffect(setVars);
9542
+ onMounted(() => {
9543
+ const ob = new MutationObserver(setVars);
9544
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
9545
+ onUnmounted(() => ob.disconnect());
9546
+ });
9547
+ }
9548
+ function setVarsOnVNode(vnode, vars) {
9549
+ if (vnode.shapeFlag & 128) {
9550
+ const suspense = vnode.suspense;
9551
+ vnode = suspense.activeBranch;
9552
+ if (suspense.pendingBranch && !suspense.isHydrating) {
9553
+ suspense.effects.push(() => {
9554
+ setVarsOnVNode(suspense.activeBranch, vars);
9555
+ });
9556
+ }
9557
+ }
9558
+ while (vnode.component) {
9559
+ vnode = vnode.component.subTree;
9560
+ }
9561
+ if (vnode.shapeFlag & 1 && vnode.el) {
9562
+ setVarsOnNode(vnode.el, vars);
9563
+ } else if (vnode.type === Fragment) {
9564
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
9565
+ } else if (vnode.type === Static) {
9566
+ let { el, anchor } = vnode;
9567
+ while (el) {
9568
+ setVarsOnNode(el, vars);
9569
+ if (el === anchor)
9570
+ break;
9571
+ el = el.nextSibling;
9572
+ }
9573
+ }
9574
+ }
9575
+ function setVarsOnNode(el, vars) {
9576
+ if (el.nodeType === 1) {
9577
+ const style = el.style;
9578
+ let cssText = "";
9579
+ for (const key in vars) {
9580
+ style.setProperty(`--${key}`, vars[key]);
9581
+ cssText += `--${key}: ${vars[key]};`;
9582
+ }
9583
+ style[CSS_VAR_TEXT] = cssText;
9584
+ }
9585
+ }
9586
+
9522
9587
  function patchStyle(el, prev, next) {
9523
9588
  const style = el.style;
9524
9589
  const isCssString = isString(next);
@@ -9537,6 +9602,10 @@ Component that was made reactive: `,
9537
9602
  const currentDisplay = style.display;
9538
9603
  if (isCssString) {
9539
9604
  if (prev !== next) {
9605
+ const cssVarText = style[CSS_VAR_TEXT];
9606
+ if (cssVarText) {
9607
+ next += ";" + cssVarText;
9608
+ }
9540
9609
  style.cssText = next;
9541
9610
  }
9542
9611
  } else if (prev) {
@@ -10031,65 +10100,6 @@ Component that was made reactive: `,
10031
10100
  }
10032
10101
  }
10033
10102
 
10034
- function useCssVars(getter) {
10035
- const instance = getCurrentInstance();
10036
- if (!instance) {
10037
- warn(`useCssVars is called without current active component instance.`);
10038
- return;
10039
- }
10040
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10041
- Array.from(
10042
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10043
- ).forEach((node) => setVarsOnNode(node, vars));
10044
- };
10045
- const setVars = () => {
10046
- const vars = getter(instance.proxy);
10047
- setVarsOnVNode(instance.subTree, vars);
10048
- updateTeleports(vars);
10049
- };
10050
- watchPostEffect(setVars);
10051
- onMounted(() => {
10052
- const ob = new MutationObserver(setVars);
10053
- ob.observe(instance.subTree.el.parentNode, { childList: true });
10054
- onUnmounted(() => ob.disconnect());
10055
- });
10056
- }
10057
- function setVarsOnVNode(vnode, vars) {
10058
- if (vnode.shapeFlag & 128) {
10059
- const suspense = vnode.suspense;
10060
- vnode = suspense.activeBranch;
10061
- if (suspense.pendingBranch && !suspense.isHydrating) {
10062
- suspense.effects.push(() => {
10063
- setVarsOnVNode(suspense.activeBranch, vars);
10064
- });
10065
- }
10066
- }
10067
- while (vnode.component) {
10068
- vnode = vnode.component.subTree;
10069
- }
10070
- if (vnode.shapeFlag & 1 && vnode.el) {
10071
- setVarsOnNode(vnode.el, vars);
10072
- } else if (vnode.type === Fragment) {
10073
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10074
- } else if (vnode.type === Static) {
10075
- let { el, anchor } = vnode;
10076
- while (el) {
10077
- setVarsOnNode(el, vars);
10078
- if (el === anchor)
10079
- break;
10080
- el = el.nextSibling;
10081
- }
10082
- }
10083
- }
10084
- function setVarsOnNode(el, vars) {
10085
- if (el.nodeType === 1) {
10086
- const style = el.style;
10087
- for (const key in vars) {
10088
- style.setProperty(`--${key}`, vars[key]);
10089
- }
10090
- }
10091
- }
10092
-
10093
10103
  const positionMap = /* @__PURE__ */ new WeakMap();
10094
10104
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10095
10105
  const moveCbKey = Symbol("_moveCb");