@vue/runtime-dom 3.4.0-beta.2 → 3.4.0-beta.4

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.
@@ -403,6 +403,11 @@ function initVShowForSSR() {
403
403
  };
404
404
  }
405
405
 
406
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
407
+ function useCssVars(getter) {
408
+ return;
409
+ }
410
+
406
411
  function patchStyle(el, prev, next) {
407
412
  const style = el.style;
408
413
  const isCssString = shared.isString(next);
@@ -421,6 +426,10 @@ function patchStyle(el, prev, next) {
421
426
  const currentDisplay = style.display;
422
427
  if (isCssString) {
423
428
  if (prev !== next) {
429
+ const cssVarText = style[CSS_VAR_TEXT];
430
+ if (cssVarText) {
431
+ next += ";" + cssVarText;
432
+ }
424
433
  style.cssText = next;
425
434
  }
426
435
  } else if (prev) {
@@ -928,10 +937,6 @@ function useCssModule(name = "$style") {
928
937
  }
929
938
  }
930
939
 
931
- function useCssVars(getter) {
932
- return;
933
- }
934
-
935
940
  const positionMap = /* @__PURE__ */ new WeakMap();
936
941
  const newPositionMap = /* @__PURE__ */ new WeakMap();
937
942
  const moveCbKey = Symbol("_moveCb");
@@ -1339,7 +1344,9 @@ const modifierGuards = {
1339
1344
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
1340
1345
  };
1341
1346
  const withModifiers = (fn, modifiers) => {
1342
- return fn._withMods || (fn._withMods = (event, ...args) => {
1347
+ const cache = fn._withMods || (fn._withMods = {});
1348
+ const cacheKey = modifiers.join(".");
1349
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
1343
1350
  for (let i = 0; i < modifiers.length; i++) {
1344
1351
  const guard = modifierGuards[modifiers[i]];
1345
1352
  if (guard && guard(event, modifiers))
@@ -1358,7 +1365,9 @@ const keyNames = {
1358
1365
  delete: "backspace"
1359
1366
  };
1360
1367
  const withKeys = (fn, modifiers) => {
1361
- return fn._withKeys || (fn._withKeys = (event) => {
1368
+ const cache = fn._withKeys || (fn._withKeys = {});
1369
+ const cacheKey = modifiers.join(".");
1370
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
1362
1371
  if (!("key" in event)) {
1363
1372
  return;
1364
1373
  }
@@ -400,6 +400,11 @@ function initVShowForSSR() {
400
400
  };
401
401
  }
402
402
 
403
+ const CSS_VAR_TEXT = Symbol("");
404
+ function useCssVars(getter) {
405
+ return;
406
+ }
407
+
403
408
  function patchStyle(el, prev, next) {
404
409
  const style = el.style;
405
410
  const isCssString = shared.isString(next);
@@ -418,6 +423,10 @@ function patchStyle(el, prev, next) {
418
423
  const currentDisplay = style.display;
419
424
  if (isCssString) {
420
425
  if (prev !== next) {
426
+ const cssVarText = style[CSS_VAR_TEXT];
427
+ if (cssVarText) {
428
+ next += ";" + cssVarText;
429
+ }
421
430
  style.cssText = next;
422
431
  }
423
432
  } else if (prev) {
@@ -889,10 +898,6 @@ function useCssModule(name = "$style") {
889
898
  }
890
899
  }
891
900
 
892
- function useCssVars(getter) {
893
- return;
894
- }
895
-
896
901
  const positionMap = /* @__PURE__ */ new WeakMap();
897
902
  const newPositionMap = /* @__PURE__ */ new WeakMap();
898
903
  const moveCbKey = Symbol("_moveCb");
@@ -1295,7 +1300,9 @@ const modifierGuards = {
1295
1300
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
1296
1301
  };
1297
1302
  const withModifiers = (fn, modifiers) => {
1298
- return fn._withMods || (fn._withMods = (event, ...args) => {
1303
+ const cache = fn._withMods || (fn._withMods = {});
1304
+ const cacheKey = modifiers.join(".");
1305
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
1299
1306
  for (let i = 0; i < modifiers.length; i++) {
1300
1307
  const guard = modifierGuards[modifiers[i]];
1301
1308
  if (guard && guard(event, modifiers))
@@ -1314,7 +1321,9 @@ const keyNames = {
1314
1321
  delete: "backspace"
1315
1322
  };
1316
1323
  const withKeys = (fn, modifiers) => {
1317
- return fn._withKeys || (fn._withKeys = (event) => {
1324
+ const cache = fn._withKeys || (fn._withKeys = {});
1325
+ const cacheKey = modifiers.join(".");
1326
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
1318
1327
  if (!("key" in event)) {
1319
1328
  return;
1320
1329
  }
@@ -103,13 +103,17 @@ export declare const vModelDynamic: ObjectDirective<HTMLInputElement | HTMLSelec
103
103
  * @private
104
104
  */
105
105
  export declare const withModifiers: <T extends (event: Event, ...args: unknown[]) => any>(fn: T & {
106
- _withMods?: T | undefined;
106
+ _withMods?: {
107
+ [key: string]: T;
108
+ } | undefined;
107
109
  }, modifiers: string[]) => T;
108
110
  /**
109
111
  * @private
110
112
  */
111
113
  export declare const withKeys: <T extends (event: KeyboardEvent) => any>(fn: T & {
112
- _withKeys?: T | undefined;
114
+ _withKeys?: {
115
+ [k: string]: T;
116
+ } | undefined;
113
117
  }, modifiers: string[]) => T;
114
118
 
115
119
  declare const vShowOldKey: unique symbol;
@@ -176,7 +176,7 @@ function normalizeProps(props) {
176
176
 
177
177
  const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
178
178
  const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
179
- const MATH_TAGS = "math,maction,annotation,annotation-xml,menclose,merror,mfenced,mfrac,mi,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,semantics,mspace,msqrt,mstyle,msub,msup,msubsup,mtable,mtd,mtext,mtr,munder,munderover";
179
+ const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
180
180
  const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
181
181
  const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
182
182
  const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
@@ -1893,8 +1893,10 @@ function checkRecursiveUpdates(seen, fn) {
1893
1893
  if (count > RECURSION_LIMIT) {
1894
1894
  const instance = fn.ownerInstance;
1895
1895
  const componentName = instance && getComponentName(instance.type);
1896
- warn(
1897
- `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`
1896
+ handleError(
1897
+ `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
1898
+ null,
1899
+ 10
1898
1900
  );
1899
1901
  return true;
1900
1902
  } else {
@@ -2572,6 +2574,8 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2572
2574
  return false;
2573
2575
  }
2574
2576
  function updateHOCHostEl({ vnode, parent }, el) {
2577
+ if (!el)
2578
+ return;
2575
2579
  while (parent) {
2576
2580
  const root = parent.subTree;
2577
2581
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -4716,24 +4720,30 @@ function useModel(props, name) {
4716
4720
  warn(`useModel() called with prop "${name}" which is not declared.`);
4717
4721
  return ref();
4718
4722
  }
4719
- let localValue;
4720
- watchSyncEffect(() => {
4721
- localValue = props[name];
4722
- });
4723
- return customRef((track, trigger) => ({
4724
- get() {
4725
- track();
4726
- return localValue;
4727
- },
4728
- set(value) {
4729
- const rawProps = i.vnode.props;
4730
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
4731
- localValue = value;
4723
+ return customRef((track, trigger) => {
4724
+ let localValue;
4725
+ watchSyncEffect(() => {
4726
+ const propValue = props[name];
4727
+ if (hasChanged(localValue, propValue)) {
4728
+ localValue = propValue;
4732
4729
  trigger();
4733
4730
  }
4734
- i.emit(`update:${name}`, value);
4735
- }
4736
- }));
4731
+ });
4732
+ return {
4733
+ get() {
4734
+ track();
4735
+ return localValue;
4736
+ },
4737
+ set(value) {
4738
+ const rawProps = i.vnode.props;
4739
+ if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
4740
+ localValue = value;
4741
+ trigger();
4742
+ }
4743
+ i.emit(`update:${name}`, value);
4744
+ }
4745
+ };
4746
+ });
4737
4747
  }
4738
4748
  function getContext() {
4739
4749
  const i = getCurrentInstance();
@@ -6499,7 +6509,7 @@ function propHasMismatch(el, key, clientValue) {
6499
6509
  let actual;
6500
6510
  let expected;
6501
6511
  if (key === "class") {
6502
- actual = el.className;
6512
+ actual = el.getAttribute("class");
6503
6513
  expected = normalizeClass(clientValue);
6504
6514
  if (actual !== expected) {
6505
6515
  mismatchType = mismatchKey = `class`;
@@ -9368,7 +9378,7 @@ function isMemoSame(cached, memo) {
9368
9378
  return true;
9369
9379
  }
9370
9380
 
9371
- const version = "3.4.0-beta.2";
9381
+ const version = "3.4.0-beta.4";
9372
9382
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9373
9383
  const ssrUtils = null;
9374
9384
  const resolveFilter = null;
@@ -9766,6 +9776,69 @@ function setDisplay(el, value) {
9766
9776
  el.style.display = value ? el[vShowOldKey] : "none";
9767
9777
  }
9768
9778
 
9779
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
9780
+ function useCssVars(getter) {
9781
+ const instance = getCurrentInstance();
9782
+ if (!instance) {
9783
+ warn(`useCssVars is called without current active component instance.`);
9784
+ return;
9785
+ }
9786
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
9787
+ Array.from(
9788
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
9789
+ ).forEach((node) => setVarsOnNode(node, vars));
9790
+ };
9791
+ const setVars = () => {
9792
+ const vars = getter(instance.proxy);
9793
+ setVarsOnVNode(instance.subTree, vars);
9794
+ updateTeleports(vars);
9795
+ };
9796
+ watchPostEffect(setVars);
9797
+ onMounted(() => {
9798
+ const ob = new MutationObserver(setVars);
9799
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
9800
+ onUnmounted(() => ob.disconnect());
9801
+ });
9802
+ }
9803
+ function setVarsOnVNode(vnode, vars) {
9804
+ if (vnode.shapeFlag & 128) {
9805
+ const suspense = vnode.suspense;
9806
+ vnode = suspense.activeBranch;
9807
+ if (suspense.pendingBranch && !suspense.isHydrating) {
9808
+ suspense.effects.push(() => {
9809
+ setVarsOnVNode(suspense.activeBranch, vars);
9810
+ });
9811
+ }
9812
+ }
9813
+ while (vnode.component) {
9814
+ vnode = vnode.component.subTree;
9815
+ }
9816
+ if (vnode.shapeFlag & 1 && vnode.el) {
9817
+ setVarsOnNode(vnode.el, vars);
9818
+ } else if (vnode.type === Fragment) {
9819
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
9820
+ } else if (vnode.type === Static) {
9821
+ let { el, anchor } = vnode;
9822
+ while (el) {
9823
+ setVarsOnNode(el, vars);
9824
+ if (el === anchor)
9825
+ break;
9826
+ el = el.nextSibling;
9827
+ }
9828
+ }
9829
+ }
9830
+ function setVarsOnNode(el, vars) {
9831
+ if (el.nodeType === 1) {
9832
+ const style = el.style;
9833
+ let cssText = "";
9834
+ for (const key in vars) {
9835
+ style.setProperty(`--${key}`, vars[key]);
9836
+ cssText += `--${key}: ${vars[key]};`;
9837
+ }
9838
+ style[CSS_VAR_TEXT] = cssText;
9839
+ }
9840
+ }
9841
+
9769
9842
  function patchStyle(el, prev, next) {
9770
9843
  const style = el.style;
9771
9844
  const isCssString = isString(next);
@@ -9784,6 +9857,10 @@ function patchStyle(el, prev, next) {
9784
9857
  const currentDisplay = style.display;
9785
9858
  if (isCssString) {
9786
9859
  if (prev !== next) {
9860
+ const cssVarText = style[CSS_VAR_TEXT];
9861
+ if (cssVarText) {
9862
+ next += ";" + cssVarText;
9863
+ }
9787
9864
  style.cssText = next;
9788
9865
  }
9789
9866
  } else if (prev) {
@@ -10291,65 +10368,6 @@ function useCssModule(name = "$style") {
10291
10368
  }
10292
10369
  }
10293
10370
 
10294
- function useCssVars(getter) {
10295
- const instance = getCurrentInstance();
10296
- if (!instance) {
10297
- warn(`useCssVars is called without current active component instance.`);
10298
- return;
10299
- }
10300
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10301
- Array.from(
10302
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10303
- ).forEach((node) => setVarsOnNode(node, vars));
10304
- };
10305
- const setVars = () => {
10306
- const vars = getter(instance.proxy);
10307
- setVarsOnVNode(instance.subTree, vars);
10308
- updateTeleports(vars);
10309
- };
10310
- watchPostEffect(setVars);
10311
- onMounted(() => {
10312
- const ob = new MutationObserver(setVars);
10313
- ob.observe(instance.subTree.el.parentNode, { childList: true });
10314
- onUnmounted(() => ob.disconnect());
10315
- });
10316
- }
10317
- function setVarsOnVNode(vnode, vars) {
10318
- if (vnode.shapeFlag & 128) {
10319
- const suspense = vnode.suspense;
10320
- vnode = suspense.activeBranch;
10321
- if (suspense.pendingBranch && !suspense.isHydrating) {
10322
- suspense.effects.push(() => {
10323
- setVarsOnVNode(suspense.activeBranch, vars);
10324
- });
10325
- }
10326
- }
10327
- while (vnode.component) {
10328
- vnode = vnode.component.subTree;
10329
- }
10330
- if (vnode.shapeFlag & 1 && vnode.el) {
10331
- setVarsOnNode(vnode.el, vars);
10332
- } else if (vnode.type === Fragment) {
10333
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10334
- } else if (vnode.type === Static) {
10335
- let { el, anchor } = vnode;
10336
- while (el) {
10337
- setVarsOnNode(el, vars);
10338
- if (el === anchor)
10339
- break;
10340
- el = el.nextSibling;
10341
- }
10342
- }
10343
- }
10344
- function setVarsOnNode(el, vars) {
10345
- if (el.nodeType === 1) {
10346
- const style = el.style;
10347
- for (const key in vars) {
10348
- style.setProperty(`--${key}`, vars[key]);
10349
- }
10350
- }
10351
- }
10352
-
10353
10371
  const positionMap = /* @__PURE__ */ new WeakMap();
10354
10372
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10355
10373
  const moveCbKey = Symbol("_moveCb");
@@ -10723,7 +10741,9 @@ const modifierGuards = {
10723
10741
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
10724
10742
  };
10725
10743
  const withModifiers = (fn, modifiers) => {
10726
- return fn._withMods || (fn._withMods = (event, ...args) => {
10744
+ const cache = fn._withMods || (fn._withMods = {});
10745
+ const cacheKey = modifiers.join(".");
10746
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
10727
10747
  for (let i = 0; i < modifiers.length; i++) {
10728
10748
  const guard = modifierGuards[modifiers[i]];
10729
10749
  if (guard && guard(event, modifiers))
@@ -10742,7 +10762,9 @@ const keyNames = {
10742
10762
  delete: "backspace"
10743
10763
  };
10744
10764
  const withKeys = (fn, modifiers) => {
10745
- return fn._withKeys || (fn._withKeys = (event) => {
10765
+ const cache = fn._withKeys || (fn._withKeys = {});
10766
+ const cacheKey = modifiers.join(".");
10767
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
10746
10768
  if (!("key" in event)) {
10747
10769
  return;
10748
10770
  }