@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.
@@ -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);
@@ -1958,8 +1958,10 @@ function checkRecursiveUpdates(seen, fn) {
1958
1958
  if (count > RECURSION_LIMIT) {
1959
1959
  const instance = fn.ownerInstance;
1960
1960
  const componentName = instance && getComponentName(instance.type);
1961
- warn(
1962
- `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.`
1961
+ handleError(
1962
+ `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.`,
1963
+ null,
1964
+ 10
1963
1965
  );
1964
1966
  return true;
1965
1967
  } else {
@@ -3154,6 +3156,8 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
3154
3156
  return false;
3155
3157
  }
3156
3158
  function updateHOCHostEl({ vnode, parent }, el) {
3159
+ if (!el)
3160
+ return;
3157
3161
  while (parent) {
3158
3162
  const root = parent.subTree;
3159
3163
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -5878,24 +5882,30 @@ function useModel(props, name) {
5878
5882
  warn(`useModel() called with prop "${name}" which is not declared.`);
5879
5883
  return ref();
5880
5884
  }
5881
- let localValue;
5882
- watchSyncEffect(() => {
5883
- localValue = props[name];
5884
- });
5885
- return customRef((track, trigger) => ({
5886
- get() {
5887
- track();
5888
- return localValue;
5889
- },
5890
- set(value) {
5891
- const rawProps = i.vnode.props;
5892
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5893
- localValue = value;
5885
+ return customRef((track, trigger) => {
5886
+ let localValue;
5887
+ watchSyncEffect(() => {
5888
+ const propValue = props[name];
5889
+ if (hasChanged(localValue, propValue)) {
5890
+ localValue = propValue;
5894
5891
  trigger();
5895
5892
  }
5896
- i.emit(`update:${name}`, value);
5897
- }
5898
- }));
5893
+ });
5894
+ return {
5895
+ get() {
5896
+ track();
5897
+ return localValue;
5898
+ },
5899
+ set(value) {
5900
+ const rawProps = i.vnode.props;
5901
+ if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5902
+ localValue = value;
5903
+ trigger();
5904
+ }
5905
+ i.emit(`update:${name}`, value);
5906
+ }
5907
+ };
5908
+ });
5899
5909
  }
5900
5910
  function getContext() {
5901
5911
  const i = getCurrentInstance();
@@ -6469,7 +6479,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6469
6479
  return vm;
6470
6480
  }
6471
6481
  }
6472
- Vue.version = `2.6.14-compat:${"3.4.0-beta.2"}`;
6482
+ Vue.version = `2.6.14-compat:${"3.4.0-beta.4"}`;
6473
6483
  Vue.config = singletonApp.config;
6474
6484
  Vue.use = (p, ...options) => {
6475
6485
  if (p && isFunction(p.install)) {
@@ -8197,7 +8207,7 @@ function propHasMismatch(el, key, clientValue) {
8197
8207
  let actual;
8198
8208
  let expected;
8199
8209
  if (key === "class") {
8200
- actual = el.className;
8210
+ actual = el.getAttribute("class");
8201
8211
  expected = normalizeClass(clientValue);
8202
8212
  if (actual !== expected) {
8203
8213
  mismatchType = mismatchKey = `class`;
@@ -11173,7 +11183,7 @@ function isMemoSame(cached, memo) {
11173
11183
  return true;
11174
11184
  }
11175
11185
 
11176
- const version = "3.4.0-beta.2";
11186
+ const version = "3.4.0-beta.4";
11177
11187
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11178
11188
  const ssrUtils = null;
11179
11189
  const resolveFilter = resolveFilter$1 ;
@@ -11615,6 +11625,69 @@ function setDisplay(el, value) {
11615
11625
  el.style.display = value ? el[vShowOldKey] : "none";
11616
11626
  }
11617
11627
 
11628
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
11629
+ function useCssVars(getter) {
11630
+ const instance = getCurrentInstance();
11631
+ if (!instance) {
11632
+ warn(`useCssVars is called without current active component instance.`);
11633
+ return;
11634
+ }
11635
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11636
+ Array.from(
11637
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11638
+ ).forEach((node) => setVarsOnNode(node, vars));
11639
+ };
11640
+ const setVars = () => {
11641
+ const vars = getter(instance.proxy);
11642
+ setVarsOnVNode(instance.subTree, vars);
11643
+ updateTeleports(vars);
11644
+ };
11645
+ watchPostEffect(setVars);
11646
+ onMounted(() => {
11647
+ const ob = new MutationObserver(setVars);
11648
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
11649
+ onUnmounted(() => ob.disconnect());
11650
+ });
11651
+ }
11652
+ function setVarsOnVNode(vnode, vars) {
11653
+ if (vnode.shapeFlag & 128) {
11654
+ const suspense = vnode.suspense;
11655
+ vnode = suspense.activeBranch;
11656
+ if (suspense.pendingBranch && !suspense.isHydrating) {
11657
+ suspense.effects.push(() => {
11658
+ setVarsOnVNode(suspense.activeBranch, vars);
11659
+ });
11660
+ }
11661
+ }
11662
+ while (vnode.component) {
11663
+ vnode = vnode.component.subTree;
11664
+ }
11665
+ if (vnode.shapeFlag & 1 && vnode.el) {
11666
+ setVarsOnNode(vnode.el, vars);
11667
+ } else if (vnode.type === Fragment) {
11668
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11669
+ } else if (vnode.type === Static) {
11670
+ let { el, anchor } = vnode;
11671
+ while (el) {
11672
+ setVarsOnNode(el, vars);
11673
+ if (el === anchor)
11674
+ break;
11675
+ el = el.nextSibling;
11676
+ }
11677
+ }
11678
+ }
11679
+ function setVarsOnNode(el, vars) {
11680
+ if (el.nodeType === 1) {
11681
+ const style = el.style;
11682
+ let cssText = "";
11683
+ for (const key in vars) {
11684
+ style.setProperty(`--${key}`, vars[key]);
11685
+ cssText += `--${key}: ${vars[key]};`;
11686
+ }
11687
+ style[CSS_VAR_TEXT] = cssText;
11688
+ }
11689
+ }
11690
+
11618
11691
  function patchStyle(el, prev, next) {
11619
11692
  const style = el.style;
11620
11693
  const isCssString = isString(next);
@@ -11633,6 +11706,10 @@ function patchStyle(el, prev, next) {
11633
11706
  const currentDisplay = style.display;
11634
11707
  if (isCssString) {
11635
11708
  if (prev !== next) {
11709
+ const cssVarText = style[CSS_VAR_TEXT];
11710
+ if (cssVarText) {
11711
+ next += ";" + cssVarText;
11712
+ }
11636
11713
  style.cssText = next;
11637
11714
  }
11638
11715
  } else if (prev) {
@@ -12183,65 +12260,6 @@ function useCssModule(name = "$style") {
12183
12260
  }
12184
12261
  }
12185
12262
 
12186
- function useCssVars(getter) {
12187
- const instance = getCurrentInstance();
12188
- if (!instance) {
12189
- warn(`useCssVars is called without current active component instance.`);
12190
- return;
12191
- }
12192
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
12193
- Array.from(
12194
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
12195
- ).forEach((node) => setVarsOnNode(node, vars));
12196
- };
12197
- const setVars = () => {
12198
- const vars = getter(instance.proxy);
12199
- setVarsOnVNode(instance.subTree, vars);
12200
- updateTeleports(vars);
12201
- };
12202
- watchPostEffect(setVars);
12203
- onMounted(() => {
12204
- const ob = new MutationObserver(setVars);
12205
- ob.observe(instance.subTree.el.parentNode, { childList: true });
12206
- onUnmounted(() => ob.disconnect());
12207
- });
12208
- }
12209
- function setVarsOnVNode(vnode, vars) {
12210
- if (vnode.shapeFlag & 128) {
12211
- const suspense = vnode.suspense;
12212
- vnode = suspense.activeBranch;
12213
- if (suspense.pendingBranch && !suspense.isHydrating) {
12214
- suspense.effects.push(() => {
12215
- setVarsOnVNode(suspense.activeBranch, vars);
12216
- });
12217
- }
12218
- }
12219
- while (vnode.component) {
12220
- vnode = vnode.component.subTree;
12221
- }
12222
- if (vnode.shapeFlag & 1 && vnode.el) {
12223
- setVarsOnNode(vnode.el, vars);
12224
- } else if (vnode.type === Fragment) {
12225
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
12226
- } else if (vnode.type === Static) {
12227
- let { el, anchor } = vnode;
12228
- while (el) {
12229
- setVarsOnNode(el, vars);
12230
- if (el === anchor)
12231
- break;
12232
- el = el.nextSibling;
12233
- }
12234
- }
12235
- }
12236
- function setVarsOnNode(el, vars) {
12237
- if (el.nodeType === 1) {
12238
- const style = el.style;
12239
- for (const key in vars) {
12240
- style.setProperty(`--${key}`, vars[key]);
12241
- }
12242
- }
12243
- }
12244
-
12245
12263
  const positionMap = /* @__PURE__ */ new WeakMap();
12246
12264
  const newPositionMap = /* @__PURE__ */ new WeakMap();
12247
12265
  const moveCbKey = Symbol("_moveCb");
@@ -12624,7 +12642,9 @@ const modifierGuards = {
12624
12642
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12625
12643
  };
12626
12644
  const withModifiers = (fn, modifiers) => {
12627
- return fn._withMods || (fn._withMods = (event, ...args) => {
12645
+ const cache = fn._withMods || (fn._withMods = {});
12646
+ const cacheKey = modifiers.join(".");
12647
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12628
12648
  for (let i = 0; i < modifiers.length; i++) {
12629
12649
  const guard = modifierGuards[modifiers[i]];
12630
12650
  if (guard && guard(event, modifiers))
@@ -12659,7 +12679,9 @@ const withKeys = (fn, modifiers) => {
12659
12679
  );
12660
12680
  }
12661
12681
  }
12662
- return fn._withKeys || (fn._withKeys = (event) => {
12682
+ const cache = fn._withKeys || (fn._withKeys = {});
12683
+ const cacheKey = modifiers.join(".");
12684
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
12663
12685
  if (!("key" in event)) {
12664
12686
  return;
12665
12687
  }
@@ -14187,7 +14209,7 @@ const errorMessages = {
14187
14209
  Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
14188
14210
  [45]: `Error parsing JavaScript expression: `,
14189
14211
  [46]: `<KeepAlive> expects exactly one child component.`,
14190
- [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.`,
14212
+ [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.`,
14191
14213
  // generic errors
14192
14214
  [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
14193
14215
  [48]: `ES module mode is not supported in this build of compiler.`,