@vue/compat 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.
@@ -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 {
@@ -3089,6 +3091,8 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
3089
3091
  return false;
3090
3092
  }
3091
3093
  function updateHOCHostEl({ vnode, parent }, el) {
3094
+ if (!el)
3095
+ return;
3092
3096
  while (parent) {
3093
3097
  const root = parent.subTree;
3094
3098
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -5813,24 +5817,30 @@ function useModel(props, name) {
5813
5817
  warn(`useModel() called with prop "${name}" which is not declared.`);
5814
5818
  return ref();
5815
5819
  }
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;
5820
+ return customRef((track, trigger) => {
5821
+ let localValue;
5822
+ watchSyncEffect(() => {
5823
+ const propValue = props[name];
5824
+ if (hasChanged(localValue, propValue)) {
5825
+ localValue = propValue;
5829
5826
  trigger();
5830
5827
  }
5831
- i.emit(`update:${name}`, value);
5832
- }
5833
- }));
5828
+ });
5829
+ return {
5830
+ get() {
5831
+ track();
5832
+ return localValue;
5833
+ },
5834
+ set(value) {
5835
+ const rawProps = i.vnode.props;
5836
+ if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5837
+ localValue = value;
5838
+ trigger();
5839
+ }
5840
+ i.emit(`update:${name}`, value);
5841
+ }
5842
+ };
5843
+ });
5834
5844
  }
5835
5845
  function getContext() {
5836
5846
  const i = getCurrentInstance();
@@ -6404,7 +6414,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6404
6414
  return vm;
6405
6415
  }
6406
6416
  }
6407
- Vue.version = `2.6.14-compat:${"3.4.0-beta.2"}`;
6417
+ Vue.version = `2.6.14-compat:${"3.4.0-beta.4"}`;
6408
6418
  Vue.config = singletonApp.config;
6409
6419
  Vue.use = (p, ...options) => {
6410
6420
  if (p && isFunction(p.install)) {
@@ -8132,7 +8142,7 @@ function propHasMismatch(el, key, clientValue) {
8132
8142
  let actual;
8133
8143
  let expected;
8134
8144
  if (key === "class") {
8135
- actual = el.className;
8145
+ actual = el.getAttribute("class");
8136
8146
  expected = normalizeClass(clientValue);
8137
8147
  if (actual !== expected) {
8138
8148
  mismatchType = mismatchKey = `class`;
@@ -11108,7 +11118,7 @@ function isMemoSame(cached, memo) {
11108
11118
  return true;
11109
11119
  }
11110
11120
 
11111
- const version = "3.4.0-beta.2";
11121
+ const version = "3.4.0-beta.4";
11112
11122
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11113
11123
  const ssrUtils = null;
11114
11124
  const resolveFilter = resolveFilter$1 ;
@@ -11550,6 +11560,69 @@ function setDisplay(el, value) {
11550
11560
  el.style.display = value ? el[vShowOldKey] : "none";
11551
11561
  }
11552
11562
 
11563
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
11564
+ function useCssVars(getter) {
11565
+ const instance = getCurrentInstance();
11566
+ if (!instance) {
11567
+ warn(`useCssVars is called without current active component instance.`);
11568
+ return;
11569
+ }
11570
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11571
+ Array.from(
11572
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11573
+ ).forEach((node) => setVarsOnNode(node, vars));
11574
+ };
11575
+ const setVars = () => {
11576
+ const vars = getter(instance.proxy);
11577
+ setVarsOnVNode(instance.subTree, vars);
11578
+ updateTeleports(vars);
11579
+ };
11580
+ watchPostEffect(setVars);
11581
+ onMounted(() => {
11582
+ const ob = new MutationObserver(setVars);
11583
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
11584
+ onUnmounted(() => ob.disconnect());
11585
+ });
11586
+ }
11587
+ function setVarsOnVNode(vnode, vars) {
11588
+ if (vnode.shapeFlag & 128) {
11589
+ const suspense = vnode.suspense;
11590
+ vnode = suspense.activeBranch;
11591
+ if (suspense.pendingBranch && !suspense.isHydrating) {
11592
+ suspense.effects.push(() => {
11593
+ setVarsOnVNode(suspense.activeBranch, vars);
11594
+ });
11595
+ }
11596
+ }
11597
+ while (vnode.component) {
11598
+ vnode = vnode.component.subTree;
11599
+ }
11600
+ if (vnode.shapeFlag & 1 && vnode.el) {
11601
+ setVarsOnNode(vnode.el, vars);
11602
+ } else if (vnode.type === Fragment) {
11603
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11604
+ } else if (vnode.type === Static) {
11605
+ let { el, anchor } = vnode;
11606
+ while (el) {
11607
+ setVarsOnNode(el, vars);
11608
+ if (el === anchor)
11609
+ break;
11610
+ el = el.nextSibling;
11611
+ }
11612
+ }
11613
+ }
11614
+ function setVarsOnNode(el, vars) {
11615
+ if (el.nodeType === 1) {
11616
+ const style = el.style;
11617
+ let cssText = "";
11618
+ for (const key in vars) {
11619
+ style.setProperty(`--${key}`, vars[key]);
11620
+ cssText += `--${key}: ${vars[key]};`;
11621
+ }
11622
+ style[CSS_VAR_TEXT] = cssText;
11623
+ }
11624
+ }
11625
+
11553
11626
  function patchStyle(el, prev, next) {
11554
11627
  const style = el.style;
11555
11628
  const isCssString = isString(next);
@@ -11568,6 +11641,10 @@ function patchStyle(el, prev, next) {
11568
11641
  const currentDisplay = style.display;
11569
11642
  if (isCssString) {
11570
11643
  if (prev !== next) {
11644
+ const cssVarText = style[CSS_VAR_TEXT];
11645
+ if (cssVarText) {
11646
+ next += ";" + cssVarText;
11647
+ }
11571
11648
  style.cssText = next;
11572
11649
  }
11573
11650
  } else if (prev) {
@@ -12118,65 +12195,6 @@ function useCssModule(name = "$style") {
12118
12195
  }
12119
12196
  }
12120
12197
 
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
12198
  const positionMap = /* @__PURE__ */ new WeakMap();
12181
12199
  const newPositionMap = /* @__PURE__ */ new WeakMap();
12182
12200
  const moveCbKey = Symbol("_moveCb");
@@ -12559,7 +12577,9 @@ const modifierGuards = {
12559
12577
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12560
12578
  };
12561
12579
  const withModifiers = (fn, modifiers) => {
12562
- return fn._withMods || (fn._withMods = (event, ...args) => {
12580
+ const cache = fn._withMods || (fn._withMods = {});
12581
+ const cacheKey = modifiers.join(".");
12582
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12563
12583
  for (let i = 0; i < modifiers.length; i++) {
12564
12584
  const guard = modifierGuards[modifiers[i]];
12565
12585
  if (guard && guard(event, modifiers))
@@ -12594,7 +12614,9 @@ const withKeys = (fn, modifiers) => {
12594
12614
  );
12595
12615
  }
12596
12616
  }
12597
- return fn._withKeys || (fn._withKeys = (event) => {
12617
+ const cache = fn._withKeys || (fn._withKeys = {});
12618
+ const cacheKey = modifiers.join(".");
12619
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
12598
12620
  if (!("key" in event)) {
12599
12621
  return;
12600
12622
  }