vue 3.4.0-beta.1 → 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.
package/dist/vue.d.mts CHANGED
@@ -5,7 +5,3 @@ export * from '@vue/runtime-dom';
5
5
  export declare function compileToFunction(template: string | HTMLElement, options?: CompilerOptions): RenderFunction;
6
6
 
7
7
  export { compileToFunction as compile };
8
- // this is appended to the end of ../dist/vue.d.ts during build.
9
- // imports the global JSX namespace registration for compat.
10
- // TODO: remove in 3.4
11
- import '../jsx'
package/dist/vue.d.ts CHANGED
@@ -5,7 +5,3 @@ export * from '@vue/runtime-dom';
5
5
  export declare function compileToFunction(template: string | HTMLElement, options?: CompilerOptions): RenderFunction;
6
6
 
7
7
  export { compileToFunction as compile };
8
- // this is appended to the end of ../dist/vue.d.ts during build.
9
- // imports the global JSX namespace registration for compat.
10
- // TODO: remove in 3.4
11
- import '../jsx'
@@ -239,7 +239,7 @@ function normalizeProps(props) {
239
239
 
240
240
  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";
241
241
  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";
242
- 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";
242
+ 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";
243
243
  const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
244
244
  const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
245
245
  const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
@@ -2637,6 +2637,8 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2637
2637
  return false;
2638
2638
  }
2639
2639
  function updateHOCHostEl({ vnode, parent }, el) {
2640
+ if (!el)
2641
+ return;
2640
2642
  while (parent) {
2641
2643
  const root = parent.subTree;
2642
2644
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -4781,24 +4783,30 @@ function useModel(props, name) {
4781
4783
  warn(`useModel() called with prop "${name}" which is not declared.`);
4782
4784
  return ref();
4783
4785
  }
4784
- let localValue;
4785
- watchSyncEffect(() => {
4786
- localValue = props[name];
4787
- });
4788
- return customRef((track, trigger) => ({
4789
- get() {
4790
- track();
4791
- return localValue;
4792
- },
4793
- set(value) {
4794
- const rawProps = i.vnode.props;
4795
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
4796
- localValue = value;
4786
+ return customRef((track, trigger) => {
4787
+ let localValue;
4788
+ watchSyncEffect(() => {
4789
+ const propValue = props[name];
4790
+ if (hasChanged(localValue, propValue)) {
4791
+ localValue = propValue;
4797
4792
  trigger();
4798
4793
  }
4799
- i.emit(`update:${name}`, value);
4800
- }
4801
- }));
4794
+ });
4795
+ return {
4796
+ get() {
4797
+ track();
4798
+ return localValue;
4799
+ },
4800
+ set(value) {
4801
+ const rawProps = i.vnode.props;
4802
+ if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
4803
+ localValue = value;
4804
+ trigger();
4805
+ }
4806
+ i.emit(`update:${name}`, value);
4807
+ }
4808
+ };
4809
+ });
4802
4810
  }
4803
4811
  function getContext() {
4804
4812
  const i = getCurrentInstance();
@@ -9433,7 +9441,7 @@ function isMemoSame(cached, memo) {
9433
9441
  return true;
9434
9442
  }
9435
9443
 
9436
- const version = "3.4.0-beta.1";
9444
+ const version = "3.4.0-beta.3";
9437
9445
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9438
9446
  const ssrUtils = null;
9439
9447
  const resolveFilter = null;
@@ -9831,6 +9839,69 @@ function setDisplay(el, value) {
9831
9839
  el.style.display = value ? el[vShowOldKey] : "none";
9832
9840
  }
9833
9841
 
9842
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
9843
+ function useCssVars(getter) {
9844
+ const instance = getCurrentInstance();
9845
+ if (!instance) {
9846
+ warn(`useCssVars is called without current active component instance.`);
9847
+ return;
9848
+ }
9849
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
9850
+ Array.from(
9851
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
9852
+ ).forEach((node) => setVarsOnNode(node, vars));
9853
+ };
9854
+ const setVars = () => {
9855
+ const vars = getter(instance.proxy);
9856
+ setVarsOnVNode(instance.subTree, vars);
9857
+ updateTeleports(vars);
9858
+ };
9859
+ watchPostEffect(setVars);
9860
+ onMounted(() => {
9861
+ const ob = new MutationObserver(setVars);
9862
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
9863
+ onUnmounted(() => ob.disconnect());
9864
+ });
9865
+ }
9866
+ function setVarsOnVNode(vnode, vars) {
9867
+ if (vnode.shapeFlag & 128) {
9868
+ const suspense = vnode.suspense;
9869
+ vnode = suspense.activeBranch;
9870
+ if (suspense.pendingBranch && !suspense.isHydrating) {
9871
+ suspense.effects.push(() => {
9872
+ setVarsOnVNode(suspense.activeBranch, vars);
9873
+ });
9874
+ }
9875
+ }
9876
+ while (vnode.component) {
9877
+ vnode = vnode.component.subTree;
9878
+ }
9879
+ if (vnode.shapeFlag & 1 && vnode.el) {
9880
+ setVarsOnNode(vnode.el, vars);
9881
+ } else if (vnode.type === Fragment) {
9882
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
9883
+ } else if (vnode.type === Static) {
9884
+ let { el, anchor } = vnode;
9885
+ while (el) {
9886
+ setVarsOnNode(el, vars);
9887
+ if (el === anchor)
9888
+ break;
9889
+ el = el.nextSibling;
9890
+ }
9891
+ }
9892
+ }
9893
+ function setVarsOnNode(el, vars) {
9894
+ if (el.nodeType === 1) {
9895
+ const style = el.style;
9896
+ let cssText = "";
9897
+ for (const key in vars) {
9898
+ style.setProperty(`--${key}`, vars[key]);
9899
+ cssText += `--${key}: ${vars[key]};`;
9900
+ }
9901
+ style[CSS_VAR_TEXT] = cssText;
9902
+ }
9903
+ }
9904
+
9834
9905
  function patchStyle(el, prev, next) {
9835
9906
  const style = el.style;
9836
9907
  const isCssString = isString(next);
@@ -9849,6 +9920,10 @@ function patchStyle(el, prev, next) {
9849
9920
  const currentDisplay = style.display;
9850
9921
  if (isCssString) {
9851
9922
  if (prev !== next) {
9923
+ const cssVarText = style[CSS_VAR_TEXT];
9924
+ if (cssVarText) {
9925
+ next += ";" + cssVarText;
9926
+ }
9852
9927
  style.cssText = next;
9853
9928
  }
9854
9929
  } else if (prev) {
@@ -10356,65 +10431,6 @@ function useCssModule(name = "$style") {
10356
10431
  }
10357
10432
  }
10358
10433
 
10359
- function useCssVars(getter) {
10360
- const instance = getCurrentInstance();
10361
- if (!instance) {
10362
- warn(`useCssVars is called without current active component instance.`);
10363
- return;
10364
- }
10365
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10366
- Array.from(
10367
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10368
- ).forEach((node) => setVarsOnNode(node, vars));
10369
- };
10370
- const setVars = () => {
10371
- const vars = getter(instance.proxy);
10372
- setVarsOnVNode(instance.subTree, vars);
10373
- updateTeleports(vars);
10374
- };
10375
- watchPostEffect(setVars);
10376
- onMounted(() => {
10377
- const ob = new MutationObserver(setVars);
10378
- ob.observe(instance.subTree.el.parentNode, { childList: true });
10379
- onUnmounted(() => ob.disconnect());
10380
- });
10381
- }
10382
- function setVarsOnVNode(vnode, vars) {
10383
- if (vnode.shapeFlag & 128) {
10384
- const suspense = vnode.suspense;
10385
- vnode = suspense.activeBranch;
10386
- if (suspense.pendingBranch && !suspense.isHydrating) {
10387
- suspense.effects.push(() => {
10388
- setVarsOnVNode(suspense.activeBranch, vars);
10389
- });
10390
- }
10391
- }
10392
- while (vnode.component) {
10393
- vnode = vnode.component.subTree;
10394
- }
10395
- if (vnode.shapeFlag & 1 && vnode.el) {
10396
- setVarsOnNode(vnode.el, vars);
10397
- } else if (vnode.type === Fragment) {
10398
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10399
- } else if (vnode.type === Static) {
10400
- let { el, anchor } = vnode;
10401
- while (el) {
10402
- setVarsOnNode(el, vars);
10403
- if (el === anchor)
10404
- break;
10405
- el = el.nextSibling;
10406
- }
10407
- }
10408
- }
10409
- function setVarsOnNode(el, vars) {
10410
- if (el.nodeType === 1) {
10411
- const style = el.style;
10412
- for (const key in vars) {
10413
- style.setProperty(`--${key}`, vars[key]);
10414
- }
10415
- }
10416
- }
10417
-
10418
10434
  const positionMap = /* @__PURE__ */ new WeakMap();
10419
10435
  const newPositionMap = /* @__PURE__ */ new WeakMap();
10420
10436
  const moveCbKey = Symbol("_moveCb");
@@ -12215,7 +12231,7 @@ const errorMessages = {
12215
12231
  Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
12216
12232
  [45]: `Error parsing JavaScript expression: `,
12217
12233
  [46]: `<KeepAlive> expects exactly one child component.`,
12218
- [51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
12234
+ [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`,
12219
12235
  // generic errors
12220
12236
  [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
12221
12237
  [48]: `ES module mode is not supported in this build of compiler.`,