@vue/compat 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.
@@ -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);
@@ -3089,6 +3089,8 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
3089
3089
  return false;
3090
3090
  }
3091
3091
  function updateHOCHostEl({ vnode, parent }, el) {
3092
+ if (!el)
3093
+ return;
3092
3094
  while (parent) {
3093
3095
  const root = parent.subTree;
3094
3096
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -5813,24 +5815,30 @@ function useModel(props, name) {
5813
5815
  warn(`useModel() called with prop "${name}" which is not declared.`);
5814
5816
  return ref();
5815
5817
  }
5816
- let localValue;
5817
- watchSyncEffect(() => {
5818
- localValue = props[name];
5819
- });
5820
- return customRef((track, trigger) => ({
5821
- get() {
5822
- track();
5823
- return localValue;
5824
- },
5825
- set(value) {
5826
- const rawProps = i.vnode.props;
5827
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5828
- localValue = value;
5818
+ return customRef((track, trigger) => {
5819
+ let localValue;
5820
+ watchSyncEffect(() => {
5821
+ const propValue = props[name];
5822
+ if (hasChanged(localValue, propValue)) {
5823
+ localValue = propValue;
5829
5824
  trigger();
5830
5825
  }
5831
- i.emit(`update:${name}`, value);
5832
- }
5833
- }));
5826
+ });
5827
+ return {
5828
+ get() {
5829
+ track();
5830
+ return localValue;
5831
+ },
5832
+ set(value) {
5833
+ const rawProps = i.vnode.props;
5834
+ if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5835
+ localValue = value;
5836
+ trigger();
5837
+ }
5838
+ i.emit(`update:${name}`, value);
5839
+ }
5840
+ };
5841
+ });
5834
5842
  }
5835
5843
  function getContext() {
5836
5844
  const i = getCurrentInstance();
@@ -6404,7 +6412,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6404
6412
  return vm;
6405
6413
  }
6406
6414
  }
6407
- Vue.version = `2.6.14-compat:${"3.4.0-beta.2"}`;
6415
+ Vue.version = `2.6.14-compat:${"3.4.0-beta.3"}`;
6408
6416
  Vue.config = singletonApp.config;
6409
6417
  Vue.use = (p, ...options) => {
6410
6418
  if (p && isFunction(p.install)) {
@@ -11108,7 +11116,7 @@ function isMemoSame(cached, memo) {
11108
11116
  return true;
11109
11117
  }
11110
11118
 
11111
- const version = "3.4.0-beta.2";
11119
+ const version = "3.4.0-beta.3";
11112
11120
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11113
11121
  const ssrUtils = null;
11114
11122
  const resolveFilter = resolveFilter$1 ;
@@ -11550,6 +11558,69 @@ function setDisplay(el, value) {
11550
11558
  el.style.display = value ? el[vShowOldKey] : "none";
11551
11559
  }
11552
11560
 
11561
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
11562
+ function useCssVars(getter) {
11563
+ const instance = getCurrentInstance();
11564
+ if (!instance) {
11565
+ warn(`useCssVars is called without current active component instance.`);
11566
+ return;
11567
+ }
11568
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11569
+ Array.from(
11570
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11571
+ ).forEach((node) => setVarsOnNode(node, vars));
11572
+ };
11573
+ const setVars = () => {
11574
+ const vars = getter(instance.proxy);
11575
+ setVarsOnVNode(instance.subTree, vars);
11576
+ updateTeleports(vars);
11577
+ };
11578
+ watchPostEffect(setVars);
11579
+ onMounted(() => {
11580
+ const ob = new MutationObserver(setVars);
11581
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
11582
+ onUnmounted(() => ob.disconnect());
11583
+ });
11584
+ }
11585
+ function setVarsOnVNode(vnode, vars) {
11586
+ if (vnode.shapeFlag & 128) {
11587
+ const suspense = vnode.suspense;
11588
+ vnode = suspense.activeBranch;
11589
+ if (suspense.pendingBranch && !suspense.isHydrating) {
11590
+ suspense.effects.push(() => {
11591
+ setVarsOnVNode(suspense.activeBranch, vars);
11592
+ });
11593
+ }
11594
+ }
11595
+ while (vnode.component) {
11596
+ vnode = vnode.component.subTree;
11597
+ }
11598
+ if (vnode.shapeFlag & 1 && vnode.el) {
11599
+ setVarsOnNode(vnode.el, vars);
11600
+ } else if (vnode.type === Fragment) {
11601
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11602
+ } else if (vnode.type === Static) {
11603
+ let { el, anchor } = vnode;
11604
+ while (el) {
11605
+ setVarsOnNode(el, vars);
11606
+ if (el === anchor)
11607
+ break;
11608
+ el = el.nextSibling;
11609
+ }
11610
+ }
11611
+ }
11612
+ function setVarsOnNode(el, vars) {
11613
+ if (el.nodeType === 1) {
11614
+ const style = el.style;
11615
+ let cssText = "";
11616
+ for (const key in vars) {
11617
+ style.setProperty(`--${key}`, vars[key]);
11618
+ cssText += `--${key}: ${vars[key]};`;
11619
+ }
11620
+ style[CSS_VAR_TEXT] = cssText;
11621
+ }
11622
+ }
11623
+
11553
11624
  function patchStyle(el, prev, next) {
11554
11625
  const style = el.style;
11555
11626
  const isCssString = isString(next);
@@ -11568,6 +11639,10 @@ function patchStyle(el, prev, next) {
11568
11639
  const currentDisplay = style.display;
11569
11640
  if (isCssString) {
11570
11641
  if (prev !== next) {
11642
+ const cssVarText = style[CSS_VAR_TEXT];
11643
+ if (cssVarText) {
11644
+ next += ";" + cssVarText;
11645
+ }
11571
11646
  style.cssText = next;
11572
11647
  }
11573
11648
  } else if (prev) {
@@ -12118,65 +12193,6 @@ function useCssModule(name = "$style") {
12118
12193
  }
12119
12194
  }
12120
12195
 
12121
- function useCssVars(getter) {
12122
- const instance = getCurrentInstance();
12123
- if (!instance) {
12124
- warn(`useCssVars is called without current active component instance.`);
12125
- return;
12126
- }
12127
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
12128
- Array.from(
12129
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
12130
- ).forEach((node) => setVarsOnNode(node, vars));
12131
- };
12132
- const setVars = () => {
12133
- const vars = getter(instance.proxy);
12134
- setVarsOnVNode(instance.subTree, vars);
12135
- updateTeleports(vars);
12136
- };
12137
- watchPostEffect(setVars);
12138
- onMounted(() => {
12139
- const ob = new MutationObserver(setVars);
12140
- ob.observe(instance.subTree.el.parentNode, { childList: true });
12141
- onUnmounted(() => ob.disconnect());
12142
- });
12143
- }
12144
- function setVarsOnVNode(vnode, vars) {
12145
- if (vnode.shapeFlag & 128) {
12146
- const suspense = vnode.suspense;
12147
- vnode = suspense.activeBranch;
12148
- if (suspense.pendingBranch && !suspense.isHydrating) {
12149
- suspense.effects.push(() => {
12150
- setVarsOnVNode(suspense.activeBranch, vars);
12151
- });
12152
- }
12153
- }
12154
- while (vnode.component) {
12155
- vnode = vnode.component.subTree;
12156
- }
12157
- if (vnode.shapeFlag & 1 && vnode.el) {
12158
- setVarsOnNode(vnode.el, vars);
12159
- } else if (vnode.type === Fragment) {
12160
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
12161
- } else if (vnode.type === Static) {
12162
- let { el, anchor } = vnode;
12163
- while (el) {
12164
- setVarsOnNode(el, vars);
12165
- if (el === anchor)
12166
- break;
12167
- el = el.nextSibling;
12168
- }
12169
- }
12170
- }
12171
- function setVarsOnNode(el, vars) {
12172
- if (el.nodeType === 1) {
12173
- const style = el.style;
12174
- for (const key in vars) {
12175
- style.setProperty(`--${key}`, vars[key]);
12176
- }
12177
- }
12178
- }
12179
-
12180
12196
  const positionMap = /* @__PURE__ */ new WeakMap();
12181
12197
  const newPositionMap = /* @__PURE__ */ new WeakMap();
12182
12198
  const moveCbKey = Symbol("_moveCb");