@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.
@@ -1,4 +1,4 @@
1
- import { h, BaseTransition, BaseTransitionPropsValidators, assertNumber, warn, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, createVNode, getCurrentInstance, watchPostEffect, onMounted, onUnmounted, Fragment, Static, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
1
+ import { h, BaseTransition, BaseTransitionPropsValidators, assertNumber, getCurrentInstance, warn, watchPostEffect, onMounted, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
2
2
  export * from '@vue/runtime-core';
3
3
  import { extend, isObject, toNumber, isArray, isString, hyphenate, capitalize, isSpecialBooleanAttr, includeBooleanAttr, isOn, isModelListener, isFunction, camelize as camelize$1, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag } from '@vue/shared';
4
4
 
@@ -399,6 +399,69 @@ function initVShowForSSR() {
399
399
  };
400
400
  }
401
401
 
402
+ const CSS_VAR_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? "CSS_VAR_TEXT" : "");
403
+ function useCssVars(getter) {
404
+ const instance = getCurrentInstance();
405
+ if (!instance) {
406
+ !!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`);
407
+ return;
408
+ }
409
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
410
+ Array.from(
411
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
412
+ ).forEach((node) => setVarsOnNode(node, vars));
413
+ };
414
+ const setVars = () => {
415
+ const vars = getter(instance.proxy);
416
+ setVarsOnVNode(instance.subTree, vars);
417
+ updateTeleports(vars);
418
+ };
419
+ watchPostEffect(setVars);
420
+ onMounted(() => {
421
+ const ob = new MutationObserver(setVars);
422
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
423
+ onUnmounted(() => ob.disconnect());
424
+ });
425
+ }
426
+ function setVarsOnVNode(vnode, vars) {
427
+ if (vnode.shapeFlag & 128) {
428
+ const suspense = vnode.suspense;
429
+ vnode = suspense.activeBranch;
430
+ if (suspense.pendingBranch && !suspense.isHydrating) {
431
+ suspense.effects.push(() => {
432
+ setVarsOnVNode(suspense.activeBranch, vars);
433
+ });
434
+ }
435
+ }
436
+ while (vnode.component) {
437
+ vnode = vnode.component.subTree;
438
+ }
439
+ if (vnode.shapeFlag & 1 && vnode.el) {
440
+ setVarsOnNode(vnode.el, vars);
441
+ } else if (vnode.type === Fragment) {
442
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
443
+ } else if (vnode.type === Static) {
444
+ let { el, anchor } = vnode;
445
+ while (el) {
446
+ setVarsOnNode(el, vars);
447
+ if (el === anchor)
448
+ break;
449
+ el = el.nextSibling;
450
+ }
451
+ }
452
+ }
453
+ function setVarsOnNode(el, vars) {
454
+ if (el.nodeType === 1) {
455
+ const style = el.style;
456
+ let cssText = "";
457
+ for (const key in vars) {
458
+ style.setProperty(`--${key}`, vars[key]);
459
+ cssText += `--${key}: ${vars[key]};`;
460
+ }
461
+ style[CSS_VAR_TEXT] = cssText;
462
+ }
463
+ }
464
+
402
465
  function patchStyle(el, prev, next) {
403
466
  const style = el.style;
404
467
  const isCssString = isString(next);
@@ -417,6 +480,10 @@ function patchStyle(el, prev, next) {
417
480
  const currentDisplay = style.display;
418
481
  if (isCssString) {
419
482
  if (prev !== next) {
483
+ const cssVarText = style[CSS_VAR_TEXT];
484
+ if (cssVarText) {
485
+ next += ";" + cssVarText;
486
+ }
420
487
  style.cssText = next;
421
488
  }
422
489
  } else if (prev) {
@@ -670,7 +737,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
670
737
  }
671
738
  if (key === "width" || key === "height") {
672
739
  const tag = el.tagName;
673
- return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
740
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
741
+ return false;
742
+ }
674
743
  }
675
744
  if (isNativeOn(key) && isString(value)) {
676
745
  return false;
@@ -921,65 +990,6 @@ function useCssModule(name = "$style") {
921
990
  }
922
991
  }
923
992
 
924
- function useCssVars(getter) {
925
- const instance = getCurrentInstance();
926
- if (!instance) {
927
- !!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`);
928
- return;
929
- }
930
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
931
- Array.from(
932
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
933
- ).forEach((node) => setVarsOnNode(node, vars));
934
- };
935
- const setVars = () => {
936
- const vars = getter(instance.proxy);
937
- setVarsOnVNode(instance.subTree, vars);
938
- updateTeleports(vars);
939
- };
940
- watchPostEffect(setVars);
941
- onMounted(() => {
942
- const ob = new MutationObserver(setVars);
943
- ob.observe(instance.subTree.el.parentNode, { childList: true });
944
- onUnmounted(() => ob.disconnect());
945
- });
946
- }
947
- function setVarsOnVNode(vnode, vars) {
948
- if (vnode.shapeFlag & 128) {
949
- const suspense = vnode.suspense;
950
- vnode = suspense.activeBranch;
951
- if (suspense.pendingBranch && !suspense.isHydrating) {
952
- suspense.effects.push(() => {
953
- setVarsOnVNode(suspense.activeBranch, vars);
954
- });
955
- }
956
- }
957
- while (vnode.component) {
958
- vnode = vnode.component.subTree;
959
- }
960
- if (vnode.shapeFlag & 1 && vnode.el) {
961
- setVarsOnNode(vnode.el, vars);
962
- } else if (vnode.type === Fragment) {
963
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
964
- } else if (vnode.type === Static) {
965
- let { el, anchor } = vnode;
966
- while (el) {
967
- setVarsOnNode(el, vars);
968
- if (el === anchor)
969
- break;
970
- el = el.nextSibling;
971
- }
972
- }
973
- }
974
- function setVarsOnNode(el, vars) {
975
- if (el.nodeType === 1) {
976
- const style = el.style;
977
- for (const key in vars) {
978
- style.setProperty(`--${key}`, vars[key]);
979
- }
980
- }
981
- }
982
-
983
993
  const positionMap = /* @__PURE__ */ new WeakMap();
984
994
  const newPositionMap = /* @__PURE__ */ new WeakMap();
985
995
  const moveCbKey = Symbol("_moveCb");
@@ -238,20 +238,29 @@ var VueRuntimeDOM = (function (exports) {
238
238
  return replacer(_key, val.value);
239
239
  } else if (isMap(val)) {
240
240
  return {
241
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
242
- entries[`${key} =>`] = val2;
243
- return entries;
244
- }, {})
241
+ [`Map(${val.size})`]: [...val.entries()].reduce(
242
+ (entries, [key, val2], i) => {
243
+ entries[stringifySymbol(key, i) + " =>"] = val2;
244
+ return entries;
245
+ },
246
+ {}
247
+ )
245
248
  };
246
249
  } else if (isSet(val)) {
247
250
  return {
248
- [`Set(${val.size})`]: [...val.values()]
251
+ [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
249
252
  };
253
+ } else if (isSymbol(val)) {
254
+ return stringifySymbol(val);
250
255
  } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
251
256
  return String(val);
252
257
  }
253
258
  return val;
254
259
  };
260
+ const stringifySymbol = (v, i = "") => {
261
+ var _a;
262
+ return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
263
+ };
255
264
 
256
265
  function warn$1(msg, ...args) {
257
266
  console.warn(`[Vue warn] ${msg}`, ...args);
@@ -675,8 +684,13 @@ var VueRuntimeDOM = (function (exports) {
675
684
  return isReadonly2;
676
685
  } else if (key === "__v_isShallow") {
677
686
  return shallow;
678
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
679
- return target;
687
+ } else if (key === "__v_raw") {
688
+ if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
689
+ // this means the reciever is a user proxy of the reactive proxy
690
+ Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
691
+ return target;
692
+ }
693
+ return;
680
694
  }
681
695
  const targetIsArray = isArray(target);
682
696
  if (!isReadonly2) {
@@ -712,17 +726,19 @@ var VueRuntimeDOM = (function (exports) {
712
726
  }
713
727
  set(target, key, value, receiver) {
714
728
  let oldValue = target[key];
715
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
716
- return false;
717
- }
718
729
  if (!this._shallow) {
730
+ const isOldValueReadonly = isReadonly(oldValue);
719
731
  if (!isShallow(value) && !isReadonly(value)) {
720
732
  oldValue = toRaw(oldValue);
721
733
  value = toRaw(value);
722
734
  }
723
735
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
724
- oldValue.value = value;
725
- return true;
736
+ if (isOldValueReadonly) {
737
+ return false;
738
+ } else {
739
+ oldValue.value = value;
740
+ return true;
741
+ }
726
742
  }
727
743
  }
728
744
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -1687,13 +1703,16 @@ var VueRuntimeDOM = (function (exports) {
1687
1703
  }
1688
1704
  queueFlush();
1689
1705
  }
1690
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
1706
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1691
1707
  {
1692
1708
  seen = seen || /* @__PURE__ */ new Map();
1693
1709
  }
1694
1710
  for (; i < queue.length; i++) {
1695
1711
  const cb = queue[i];
1696
1712
  if (cb && cb.pre) {
1713
+ if (instance && cb.id !== instance.uid) {
1714
+ continue;
1715
+ }
1697
1716
  if (checkRecursiveUpdates(seen, cb)) {
1698
1717
  continue;
1699
1718
  }
@@ -2799,7 +2818,7 @@ If this is a native custom element, make sure to exclude it from component resol
2799
2818
  timeout: typeof timeout === "number" ? timeout : -1,
2800
2819
  activeBranch: null,
2801
2820
  pendingBranch: null,
2802
- isInFallback: true,
2821
+ isInFallback: !isHydrating,
2803
2822
  isHydrating,
2804
2823
  isUnmounted: false,
2805
2824
  effects: [],
@@ -2885,6 +2904,7 @@ If this is a native custom element, make sure to exclude it from component resol
2885
2904
  }
2886
2905
  const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
2887
2906
  triggerEvent(vnode2, "onFallback");
2907
+ const anchor2 = next(activeBranch);
2888
2908
  const mountFallback = () => {
2889
2909
  if (!suspense.isInFallback) {
2890
2910
  return;
@@ -2893,7 +2913,7 @@ If this is a native custom element, make sure to exclude it from component resol
2893
2913
  null,
2894
2914
  fallbackVNode,
2895
2915
  container2,
2896
- next(activeBranch),
2916
+ anchor2,
2897
2917
  parentComponent2,
2898
2918
  null,
2899
2919
  // fallback tree will not have suspense context
@@ -6108,6 +6128,16 @@ If you want to remount the same app, move your app creation logic into a factory
6108
6128
  if (dirs) {
6109
6129
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6110
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
+ }
6111
6141
  if (props) {
6112
6142
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6113
6143
  for (const key in props) {
@@ -6140,16 +6170,6 @@ If you want to remount the same app, move your app creation logic into a factory
6140
6170
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6141
6171
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6142
6172
  }
6143
- let needCallTransitionHooks = false;
6144
- if (isTemplateNode(el)) {
6145
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6146
- const content = el.content.firstChild;
6147
- if (needCallTransitionHooks) {
6148
- transition.beforeEnter(content);
6149
- }
6150
- replaceNode(content, el, parentComponent);
6151
- vnode.el = el = content;
6152
- }
6153
6173
  if (dirs) {
6154
6174
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6155
6175
  }
@@ -7239,7 +7259,7 @@ If you want to remount the same app, move your app creation logic into a factory
7239
7259
  updateProps(instance, nextVNode.props, prevProps, optimized);
7240
7260
  updateSlots(instance, nextVNode.children, optimized);
7241
7261
  pauseTracking();
7242
- flushPreFlushCbs();
7262
+ flushPreFlushCbs(instance);
7243
7263
  resetTracking();
7244
7264
  };
7245
7265
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
@@ -9106,7 +9126,7 @@ Component that was made reactive: `,
9106
9126
  return true;
9107
9127
  }
9108
9128
 
9109
- const version = "3.3.10";
9129
+ const version = "3.3.12";
9110
9130
  const ssrUtils = null;
9111
9131
  const resolveFilter = null;
9112
9132
  const compatUtils = null;
@@ -9501,6 +9521,69 @@ Component that was made reactive: `,
9501
9521
  el.style.display = value ? el[vShowOldKey] : "none";
9502
9522
  }
9503
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
+
9504
9587
  function patchStyle(el, prev, next) {
9505
9588
  const style = el.style;
9506
9589
  const isCssString = isString(next);
@@ -9519,6 +9602,10 @@ Component that was made reactive: `,
9519
9602
  const currentDisplay = style.display;
9520
9603
  if (isCssString) {
9521
9604
  if (prev !== next) {
9605
+ const cssVarText = style[CSS_VAR_TEXT];
9606
+ if (cssVarText) {
9607
+ next += ";" + cssVarText;
9608
+ }
9522
9609
  style.cssText = next;
9523
9610
  }
9524
9611
  } else if (prev) {
@@ -9772,7 +9859,9 @@ Component that was made reactive: `,
9772
9859
  }
9773
9860
  if (key === "width" || key === "height") {
9774
9861
  const tag = el.tagName;
9775
- return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
9862
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
9863
+ return false;
9864
+ }
9776
9865
  }
9777
9866
  if (isNativeOn(key) && isString(value)) {
9778
9867
  return false;
@@ -10011,65 +10100,6 @@ Component that was made reactive: `,
10011
10100
  }
10012
10101
  }
10013
10102
 
10014
- function useCssVars(getter) {
10015
- const instance = getCurrentInstance();
10016
- if (!instance) {
10017
- warn(`useCssVars is called without current active component instance.`);
10018
- return;
10019
- }
10020
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10021
- Array.from(
10022
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10023
- ).forEach((node) => setVarsOnNode(node, vars));
10024
- };
10025
- const setVars = () => {
10026
- const vars = getter(instance.proxy);
10027
- setVarsOnVNode(instance.subTree, vars);
10028
- updateTeleports(vars);
10029
- };
10030
- watchPostEffect(setVars);
10031
- onMounted(() => {
10032
- const ob = new MutationObserver(setVars);
10033
- ob.observe(instance.subTree.el.parentNode, { childList: true });
10034
- onUnmounted(() => ob.disconnect());
10035
- });
10036
- }
10037
- function setVarsOnVNode(vnode, vars) {
10038
- if (vnode.shapeFlag & 128) {
10039
- const suspense = vnode.suspense;
10040
- vnode = suspense.activeBranch;
10041
- if (suspense.pendingBranch && !suspense.isHydrating) {
10042
- suspense.effects.push(() => {
10043
- setVarsOnVNode(suspense.activeBranch, vars);
10044
- });
10045
- }
10046
- }
10047
- while (vnode.component) {
10048
- vnode = vnode.component.subTree;
10049
- }
10050
- if (vnode.shapeFlag & 1 && vnode.el) {
10051
- setVarsOnNode(vnode.el, vars);
10052
- } else if (vnode.type === Fragment) {
10053
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10054
- } else if (vnode.type === Static) {
10055
- let { el, anchor } = vnode;
10056
- while (el) {
10057
- setVarsOnNode(el, vars);
10058
- if (el === anchor)
10059
- break;
10060
- el = el.nextSibling;
10061
- }
10062
- }
10063
- }
10064
- function setVarsOnNode(el, vars) {
10065
- if (el.nodeType === 1) {
10066
- const style = el.style;
10067
- for (const key in vars) {
10068
- style.setProperty(`--${key}`, vars[key]);
10069
- }
10070
- }
10071
- }
10072
-
10073
10103
  const positionMap = /* @__PURE__ */ new WeakMap();
10074
10104
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10075
10105
  const moveCbKey = Symbol("_moveCb");