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

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");
@@ -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");
@@ -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);
@@ -2572,6 +2572,8 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2572
2572
  return false;
2573
2573
  }
2574
2574
  function updateHOCHostEl({ vnode, parent }, el) {
2575
+ if (!el)
2576
+ return;
2575
2577
  while (parent) {
2576
2578
  const root = parent.subTree;
2577
2579
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -4716,24 +4718,30 @@ function useModel(props, name) {
4716
4718
  warn(`useModel() called with prop "${name}" which is not declared.`);
4717
4719
  return ref();
4718
4720
  }
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;
4721
+ return customRef((track, trigger) => {
4722
+ let localValue;
4723
+ watchSyncEffect(() => {
4724
+ const propValue = props[name];
4725
+ if (hasChanged(localValue, propValue)) {
4726
+ localValue = propValue;
4732
4727
  trigger();
4733
4728
  }
4734
- i.emit(`update:${name}`, value);
4735
- }
4736
- }));
4729
+ });
4730
+ return {
4731
+ get() {
4732
+ track();
4733
+ return localValue;
4734
+ },
4735
+ set(value) {
4736
+ const rawProps = i.vnode.props;
4737
+ if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
4738
+ localValue = value;
4739
+ trigger();
4740
+ }
4741
+ i.emit(`update:${name}`, value);
4742
+ }
4743
+ };
4744
+ });
4737
4745
  }
4738
4746
  function getContext() {
4739
4747
  const i = getCurrentInstance();
@@ -9368,7 +9376,7 @@ function isMemoSame(cached, memo) {
9368
9376
  return true;
9369
9377
  }
9370
9378
 
9371
- const version = "3.4.0-beta.2";
9379
+ const version = "3.4.0-beta.3";
9372
9380
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9373
9381
  const ssrUtils = null;
9374
9382
  const resolveFilter = null;
@@ -9766,6 +9774,69 @@ function setDisplay(el, value) {
9766
9774
  el.style.display = value ? el[vShowOldKey] : "none";
9767
9775
  }
9768
9776
 
9777
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
9778
+ function useCssVars(getter) {
9779
+ const instance = getCurrentInstance();
9780
+ if (!instance) {
9781
+ warn(`useCssVars is called without current active component instance.`);
9782
+ return;
9783
+ }
9784
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
9785
+ Array.from(
9786
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
9787
+ ).forEach((node) => setVarsOnNode(node, vars));
9788
+ };
9789
+ const setVars = () => {
9790
+ const vars = getter(instance.proxy);
9791
+ setVarsOnVNode(instance.subTree, vars);
9792
+ updateTeleports(vars);
9793
+ };
9794
+ watchPostEffect(setVars);
9795
+ onMounted(() => {
9796
+ const ob = new MutationObserver(setVars);
9797
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
9798
+ onUnmounted(() => ob.disconnect());
9799
+ });
9800
+ }
9801
+ function setVarsOnVNode(vnode, vars) {
9802
+ if (vnode.shapeFlag & 128) {
9803
+ const suspense = vnode.suspense;
9804
+ vnode = suspense.activeBranch;
9805
+ if (suspense.pendingBranch && !suspense.isHydrating) {
9806
+ suspense.effects.push(() => {
9807
+ setVarsOnVNode(suspense.activeBranch, vars);
9808
+ });
9809
+ }
9810
+ }
9811
+ while (vnode.component) {
9812
+ vnode = vnode.component.subTree;
9813
+ }
9814
+ if (vnode.shapeFlag & 1 && vnode.el) {
9815
+ setVarsOnNode(vnode.el, vars);
9816
+ } else if (vnode.type === Fragment) {
9817
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
9818
+ } else if (vnode.type === Static) {
9819
+ let { el, anchor } = vnode;
9820
+ while (el) {
9821
+ setVarsOnNode(el, vars);
9822
+ if (el === anchor)
9823
+ break;
9824
+ el = el.nextSibling;
9825
+ }
9826
+ }
9827
+ }
9828
+ function setVarsOnNode(el, vars) {
9829
+ if (el.nodeType === 1) {
9830
+ const style = el.style;
9831
+ let cssText = "";
9832
+ for (const key in vars) {
9833
+ style.setProperty(`--${key}`, vars[key]);
9834
+ cssText += `--${key}: ${vars[key]};`;
9835
+ }
9836
+ style[CSS_VAR_TEXT] = cssText;
9837
+ }
9838
+ }
9839
+
9769
9840
  function patchStyle(el, prev, next) {
9770
9841
  const style = el.style;
9771
9842
  const isCssString = isString(next);
@@ -9784,6 +9855,10 @@ function patchStyle(el, prev, next) {
9784
9855
  const currentDisplay = style.display;
9785
9856
  if (isCssString) {
9786
9857
  if (prev !== next) {
9858
+ const cssVarText = style[CSS_VAR_TEXT];
9859
+ if (cssVarText) {
9860
+ next += ";" + cssVarText;
9861
+ }
9787
9862
  style.cssText = next;
9788
9863
  }
9789
9864
  } else if (prev) {
@@ -10291,65 +10366,6 @@ function useCssModule(name = "$style") {
10291
10366
  }
10292
10367
  }
10293
10368
 
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
10369
  const positionMap = /* @__PURE__ */ new WeakMap();
10354
10370
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10355
10371
  const moveCbKey = Symbol("_moveCb");