@vue/runtime-dom 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.
@@ -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) {
@@ -923,65 +990,6 @@ function useCssModule(name = "$style") {
923
990
  }
924
991
  }
925
992
 
926
- function useCssVars(getter) {
927
- const instance = getCurrentInstance();
928
- if (!instance) {
929
- !!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`);
930
- return;
931
- }
932
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
933
- Array.from(
934
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
935
- ).forEach((node) => setVarsOnNode(node, vars));
936
- };
937
- const setVars = () => {
938
- const vars = getter(instance.proxy);
939
- setVarsOnVNode(instance.subTree, vars);
940
- updateTeleports(vars);
941
- };
942
- watchPostEffect(setVars);
943
- onMounted(() => {
944
- const ob = new MutationObserver(setVars);
945
- ob.observe(instance.subTree.el.parentNode, { childList: true });
946
- onUnmounted(() => ob.disconnect());
947
- });
948
- }
949
- function setVarsOnVNode(vnode, vars) {
950
- if (vnode.shapeFlag & 128) {
951
- const suspense = vnode.suspense;
952
- vnode = suspense.activeBranch;
953
- if (suspense.pendingBranch && !suspense.isHydrating) {
954
- suspense.effects.push(() => {
955
- setVarsOnVNode(suspense.activeBranch, vars);
956
- });
957
- }
958
- }
959
- while (vnode.component) {
960
- vnode = vnode.component.subTree;
961
- }
962
- if (vnode.shapeFlag & 1 && vnode.el) {
963
- setVarsOnNode(vnode.el, vars);
964
- } else if (vnode.type === Fragment) {
965
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
966
- } else if (vnode.type === Static) {
967
- let { el, anchor } = vnode;
968
- while (el) {
969
- setVarsOnNode(el, vars);
970
- if (el === anchor)
971
- break;
972
- el = el.nextSibling;
973
- }
974
- }
975
- }
976
- function setVarsOnNode(el, vars) {
977
- if (el.nodeType === 1) {
978
- const style = el.style;
979
- for (const key in vars) {
980
- style.setProperty(`--${key}`, vars[key]);
981
- }
982
- }
983
- }
984
-
985
993
  const positionMap = /* @__PURE__ */ new WeakMap();
986
994
  const newPositionMap = /* @__PURE__ */ new WeakMap();
987
995
  const moveCbKey = Symbol("_moveCb");
@@ -1389,7 +1397,9 @@ const modifierGuards = {
1389
1397
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
1390
1398
  };
1391
1399
  const withModifiers = (fn, modifiers) => {
1392
- return fn._withMods || (fn._withMods = (event, ...args) => {
1400
+ const cache = fn._withMods || (fn._withMods = {});
1401
+ const cacheKey = modifiers.join(".");
1402
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
1393
1403
  for (let i = 0; i < modifiers.length; i++) {
1394
1404
  const guard = modifierGuards[modifiers[i]];
1395
1405
  if (guard && guard(event, modifiers))
@@ -1408,7 +1418,9 @@ const keyNames = {
1408
1418
  delete: "backspace"
1409
1419
  };
1410
1420
  const withKeys = (fn, modifiers) => {
1411
- return fn._withKeys || (fn._withKeys = (event) => {
1421
+ const cache = fn._withKeys || (fn._withKeys = {});
1422
+ const cacheKey = modifiers.join(".");
1423
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
1412
1424
  if (!("key" in event)) {
1413
1425
  return;
1414
1426
  }
@@ -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.13";
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");
@@ -10463,7 +10473,9 @@ Component that was made reactive: `,
10463
10473
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
10464
10474
  };
10465
10475
  const withModifiers = (fn, modifiers) => {
10466
- return fn._withMods || (fn._withMods = (event, ...args) => {
10476
+ const cache = fn._withMods || (fn._withMods = {});
10477
+ const cacheKey = modifiers.join(".");
10478
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
10467
10479
  for (let i = 0; i < modifiers.length; i++) {
10468
10480
  const guard = modifierGuards[modifiers[i]];
10469
10481
  if (guard && guard(event, modifiers))
@@ -10482,7 +10494,9 @@ Component that was made reactive: `,
10482
10494
  delete: "backspace"
10483
10495
  };
10484
10496
  const withKeys = (fn, modifiers) => {
10485
- return fn._withKeys || (fn._withKeys = (event) => {
10497
+ const cache = fn._withKeys || (fn._withKeys = {});
10498
+ const cacheKey = modifiers.join(".");
10499
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
10486
10500
  if (!("key" in event)) {
10487
10501
  return;
10488
10502
  }