@vue/compat 3.4.0-alpha.3 → 3.4.0-beta.1

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.
@@ -15,8 +15,8 @@ const EMPTY_ARR = [];
15
15
  const NOOP = () => {
16
16
  };
17
17
  const NO = () => false;
18
- const onRE = /^on[^a-z]/;
19
- const isOn = (key) => onRE.test(key);
18
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
19
+ (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
20
20
  const isModelListener = (key) => key.startsWith("onUpdate:");
21
21
  const extend = Object.assign;
22
22
  const remove = (arr, el) => {
@@ -105,7 +105,7 @@ function genPropsAccessExp(name) {
105
105
  return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
106
106
  }
107
107
 
108
- const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
108
+ const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
109
109
  const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
110
110
 
111
111
  function normalizeStyle(value) {
@@ -187,9 +187,11 @@ function normalizeProps(props) {
187
187
 
188
188
  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";
189
189
  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";
190
+ 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";
190
191
  const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
191
192
  const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
192
193
  const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
194
+ const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
193
195
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
194
196
 
195
197
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
@@ -204,7 +206,7 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
204
206
  `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
205
207
  );
206
208
  const isKnownSvgAttr = /* @__PURE__ */ makeMap(
207
- `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
209
+ `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
208
210
  );
209
211
 
210
212
  const escapeRE = /["'&<>]/;
@@ -307,20 +309,29 @@ const replacer = (_key, val) => {
307
309
  return replacer(_key, val.value);
308
310
  } else if (isMap(val)) {
309
311
  return {
310
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
311
- entries[`${key} =>`] = val2;
312
- return entries;
313
- }, {})
312
+ [`Map(${val.size})`]: [...val.entries()].reduce(
313
+ (entries, [key, val2], i) => {
314
+ entries[stringifySymbol(key, i) + " =>"] = val2;
315
+ return entries;
316
+ },
317
+ {}
318
+ )
314
319
  };
315
320
  } else if (isSet(val)) {
316
321
  return {
317
- [`Set(${val.size})`]: [...val.values()]
322
+ [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
318
323
  };
324
+ } else if (isSymbol(val)) {
325
+ return stringifySymbol(val);
319
326
  } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
320
327
  return String(val);
321
328
  }
322
329
  return val;
323
330
  };
331
+ const stringifySymbol = (v, i = "") => {
332
+ var _a;
333
+ return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
334
+ };
324
335
 
325
336
  let activeEffectScope;
326
337
  class EffectScope {
@@ -736,8 +747,13 @@ class BaseReactiveHandler {
736
747
  return isReadonly2;
737
748
  } else if (key === "__v_isShallow") {
738
749
  return shallow;
739
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
740
- return target;
750
+ } else if (key === "__v_raw") {
751
+ if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
752
+ // this means the reciever is a user proxy of the reactive proxy
753
+ Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
754
+ return target;
755
+ }
756
+ return;
741
757
  }
742
758
  const targetIsArray = isArray(target);
743
759
  if (!isReadonly2) {
@@ -773,17 +789,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
773
789
  }
774
790
  set(target, key, value, receiver) {
775
791
  let oldValue = target[key];
776
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
777
- return false;
778
- }
779
792
  if (!this._shallow) {
793
+ const isOldValueReadonly = isReadonly(oldValue);
780
794
  if (!isShallow(value) && !isReadonly(value)) {
781
795
  oldValue = toRaw(oldValue);
782
796
  value = toRaw(value);
783
797
  }
784
798
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
785
- oldValue.value = value;
786
- return true;
799
+ if (isOldValueReadonly) {
800
+ return false;
801
+ } else {
802
+ oldValue.value = value;
803
+ return true;
804
+ }
787
805
  }
788
806
  }
789
807
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -1418,6 +1436,18 @@ function propertyToRef(source, key, defaultValue) {
1418
1436
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1419
1437
  }
1420
1438
 
1439
+ const TrackOpTypes = {
1440
+ "GET": "get",
1441
+ "HAS": "has",
1442
+ "ITERATE": "iterate"
1443
+ };
1444
+ const TriggerOpTypes = {
1445
+ "SET": "set",
1446
+ "ADD": "add",
1447
+ "DELETE": "delete",
1448
+ "CLEAR": "clear"
1449
+ };
1450
+
1421
1451
  function warn$1(msg, ...args) {
1422
1452
  return;
1423
1453
  }
@@ -1425,6 +1455,38 @@ function assertNumber(val, type) {
1425
1455
  return;
1426
1456
  }
1427
1457
 
1458
+ const ErrorCodes = {
1459
+ "SETUP_FUNCTION": 0,
1460
+ "0": "SETUP_FUNCTION",
1461
+ "RENDER_FUNCTION": 1,
1462
+ "1": "RENDER_FUNCTION",
1463
+ "WATCH_GETTER": 2,
1464
+ "2": "WATCH_GETTER",
1465
+ "WATCH_CALLBACK": 3,
1466
+ "3": "WATCH_CALLBACK",
1467
+ "WATCH_CLEANUP": 4,
1468
+ "4": "WATCH_CLEANUP",
1469
+ "NATIVE_EVENT_HANDLER": 5,
1470
+ "5": "NATIVE_EVENT_HANDLER",
1471
+ "COMPONENT_EVENT_HANDLER": 6,
1472
+ "6": "COMPONENT_EVENT_HANDLER",
1473
+ "VNODE_HOOK": 7,
1474
+ "7": "VNODE_HOOK",
1475
+ "DIRECTIVE_HOOK": 8,
1476
+ "8": "DIRECTIVE_HOOK",
1477
+ "TRANSITION_HOOK": 9,
1478
+ "9": "TRANSITION_HOOK",
1479
+ "APP_ERROR_HANDLER": 10,
1480
+ "10": "APP_ERROR_HANDLER",
1481
+ "APP_WARN_HANDLER": 11,
1482
+ "11": "APP_WARN_HANDLER",
1483
+ "FUNCTION_REF": 12,
1484
+ "12": "FUNCTION_REF",
1485
+ "ASYNC_COMPONENT_LOADER": 13,
1486
+ "13": "ASYNC_COMPONENT_LOADER",
1487
+ "SCHEDULER": 14,
1488
+ "14": "SCHEDULER"
1489
+ };
1428
1490
  function callWithErrorHandling(fn, instance, type, args) {
1429
1491
  let res;
1430
1492
  try {
@@ -1552,10 +1614,13 @@ function queuePostFlushCb(cb) {
1552
1614
  }
1553
1615
  queueFlush();
1554
1616
  }
1555
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
1617
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1556
1618
  for (; i < queue.length; i++) {
1557
1619
  const cb = queue[i];
1558
1620
  if (cb && cb.pre) {
1621
+ if (instance && cb.id !== instance.uid) {
1622
+ continue;
1623
+ }
1559
1624
  queue.splice(i, 1);
1560
1625
  i--;
1561
1626
  cb();
@@ -1646,6 +1711,50 @@ function setDevtoolsHook(hook, target) {
1646
1711
  }
1647
1712
  }
1648
1713
 
1714
+ const DeprecationTypes$1 = {
1715
+ "GLOBAL_MOUNT": "GLOBAL_MOUNT",
1716
+ "GLOBAL_MOUNT_CONTAINER": "GLOBAL_MOUNT_CONTAINER",
1717
+ "GLOBAL_EXTEND": "GLOBAL_EXTEND",
1718
+ "GLOBAL_PROTOTYPE": "GLOBAL_PROTOTYPE",
1719
+ "GLOBAL_SET": "GLOBAL_SET",
1720
+ "GLOBAL_DELETE": "GLOBAL_DELETE",
1721
+ "GLOBAL_OBSERVABLE": "GLOBAL_OBSERVABLE",
1722
+ "GLOBAL_PRIVATE_UTIL": "GLOBAL_PRIVATE_UTIL",
1723
+ "CONFIG_SILENT": "CONFIG_SILENT",
1724
+ "CONFIG_DEVTOOLS": "CONFIG_DEVTOOLS",
1725
+ "CONFIG_KEY_CODES": "CONFIG_KEY_CODES",
1726
+ "CONFIG_PRODUCTION_TIP": "CONFIG_PRODUCTION_TIP",
1727
+ "CONFIG_IGNORED_ELEMENTS": "CONFIG_IGNORED_ELEMENTS",
1728
+ "CONFIG_WHITESPACE": "CONFIG_WHITESPACE",
1729
+ "CONFIG_OPTION_MERGE_STRATS": "CONFIG_OPTION_MERGE_STRATS",
1730
+ "INSTANCE_SET": "INSTANCE_SET",
1731
+ "INSTANCE_DELETE": "INSTANCE_DELETE",
1732
+ "INSTANCE_DESTROY": "INSTANCE_DESTROY",
1733
+ "INSTANCE_EVENT_EMITTER": "INSTANCE_EVENT_EMITTER",
1734
+ "INSTANCE_EVENT_HOOKS": "INSTANCE_EVENT_HOOKS",
1735
+ "INSTANCE_CHILDREN": "INSTANCE_CHILDREN",
1736
+ "INSTANCE_LISTENERS": "INSTANCE_LISTENERS",
1737
+ "INSTANCE_SCOPED_SLOTS": "INSTANCE_SCOPED_SLOTS",
1738
+ "INSTANCE_ATTRS_CLASS_STYLE": "INSTANCE_ATTRS_CLASS_STYLE",
1739
+ "OPTIONS_DATA_FN": "OPTIONS_DATA_FN",
1740
+ "OPTIONS_DATA_MERGE": "OPTIONS_DATA_MERGE",
1741
+ "OPTIONS_BEFORE_DESTROY": "OPTIONS_BEFORE_DESTROY",
1742
+ "OPTIONS_DESTROYED": "OPTIONS_DESTROYED",
1743
+ "WATCH_ARRAY": "WATCH_ARRAY",
1744
+ "PROPS_DEFAULT_THIS": "PROPS_DEFAULT_THIS",
1745
+ "V_ON_KEYCODE_MODIFIER": "V_ON_KEYCODE_MODIFIER",
1746
+ "CUSTOM_DIR": "CUSTOM_DIR",
1747
+ "ATTR_FALSE_VALUE": "ATTR_FALSE_VALUE",
1748
+ "ATTR_ENUMERATED_COERCION": "ATTR_ENUMERATED_COERCION",
1749
+ "TRANSITION_CLASSES": "TRANSITION_CLASSES",
1750
+ "TRANSITION_GROUP_ROOT": "TRANSITION_GROUP_ROOT",
1751
+ "COMPONENT_ASYNC": "COMPONENT_ASYNC",
1752
+ "COMPONENT_FUNCTIONAL": "COMPONENT_FUNCTIONAL",
1753
+ "COMPONENT_V_MODEL": "COMPONENT_V_MODEL",
1754
+ "RENDER_FUNCTION": "RENDER_FUNCTION",
1755
+ "FILTERS": "FILTERS",
1756
+ "PRIVATE_APIS": "PRIVATE_APIS"
1757
+ };
1649
1758
  function warnDeprecation(key, instance, ...args) {
1650
1759
  {
1651
1760
  return;
@@ -2176,9 +2285,17 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2176
2285
  return false;
2177
2286
  }
2178
2287
  function updateHOCHostEl({ vnode, parent }, el) {
2179
- while (parent && parent.subTree === vnode) {
2180
- (vnode = parent.vnode).el = el;
2181
- parent = parent.parent;
2288
+ while (parent) {
2289
+ const root = parent.subTree;
2290
+ if (root.suspense && root.suspense.activeBranch === vnode) {
2291
+ root.el = vnode.el;
2292
+ }
2293
+ if (root === vnode) {
2294
+ (vnode = parent.vnode).el = el;
2295
+ parent = parent.parent;
2296
+ } else {
2297
+ break;
2298
+ }
2182
2299
  }
2183
2300
  }
2184
2301
 
@@ -2233,6 +2350,7 @@ function resolve(registry, name) {
2233
2350
  }
2234
2351
 
2235
2352
  const isSuspense = (type) => type.__isSuspense;
2353
+ let suspenseId = 0;
2236
2354
  const SuspenseImpl = {
2237
2355
  name: "Suspense",
2238
2356
  // In order to make Suspense tree-shakable, we need to avoid importing it
@@ -2240,7 +2358,7 @@ const SuspenseImpl = {
2240
2358
  // on a vnode's type and calls the `process` method, passing in renderer
2241
2359
  // internals.
2242
2360
  __isSuspense: true,
2243
- process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
2361
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
2244
2362
  if (n1 == null) {
2245
2363
  mountSuspense(
2246
2364
  n2,
@@ -2248,7 +2366,7 @@ const SuspenseImpl = {
2248
2366
  anchor,
2249
2367
  parentComponent,
2250
2368
  parentSuspense,
2251
- isSVG,
2369
+ namespace,
2252
2370
  slotScopeIds,
2253
2371
  optimized,
2254
2372
  rendererInternals
@@ -2260,7 +2378,7 @@ const SuspenseImpl = {
2260
2378
  container,
2261
2379
  anchor,
2262
2380
  parentComponent,
2263
- isSVG,
2381
+ namespace,
2264
2382
  slotScopeIds,
2265
2383
  optimized,
2266
2384
  rendererInternals
@@ -2278,7 +2396,7 @@ function triggerEvent(vnode, name) {
2278
2396
  eventListener();
2279
2397
  }
2280
2398
  }
2281
- function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
2399
+ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
2282
2400
  const {
2283
2401
  p: patch,
2284
2402
  o: { createElement }
@@ -2291,7 +2409,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
2291
2409
  container,
2292
2410
  hiddenContainer,
2293
2411
  anchor,
2294
- isSVG,
2412
+ namespace,
2295
2413
  slotScopeIds,
2296
2414
  optimized,
2297
2415
  rendererInternals
@@ -2303,7 +2421,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
2303
2421
  null,
2304
2422
  parentComponent,
2305
2423
  suspense,
2306
- isSVG,
2424
+ namespace,
2307
2425
  slotScopeIds
2308
2426
  );
2309
2427
  if (suspense.deps > 0) {
@@ -2317,7 +2435,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
2317
2435
  parentComponent,
2318
2436
  null,
2319
2437
  // fallback tree will not have suspense context
2320
- isSVG,
2438
+ namespace,
2321
2439
  slotScopeIds
2322
2440
  );
2323
2441
  setActiveBranch(suspense, vnode.ssFallback);
@@ -2325,7 +2443,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
2325
2443
  suspense.resolve(false, true);
2326
2444
  }
2327
2445
  }
2328
- function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
2446
+ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
2329
2447
  const suspense = n2.suspense = n1.suspense;
2330
2448
  suspense.vnode = n2;
2331
2449
  n2.el = n1.el;
@@ -2342,29 +2460,31 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
2342
2460
  null,
2343
2461
  parentComponent,
2344
2462
  suspense,
2345
- isSVG,
2463
+ namespace,
2346
2464
  slotScopeIds,
2347
2465
  optimized
2348
2466
  );
2349
2467
  if (suspense.deps <= 0) {
2350
2468
  suspense.resolve();
2351
2469
  } else if (isInFallback) {
2352
- patch(
2353
- activeBranch,
2354
- newFallback,
2355
- container,
2356
- anchor,
2357
- parentComponent,
2358
- null,
2359
- // fallback tree will not have suspense context
2360
- isSVG,
2361
- slotScopeIds,
2362
- optimized
2363
- );
2364
- setActiveBranch(suspense, newFallback);
2470
+ if (!isHydrating) {
2471
+ patch(
2472
+ activeBranch,
2473
+ newFallback,
2474
+ container,
2475
+ anchor,
2476
+ parentComponent,
2477
+ null,
2478
+ // fallback tree will not have suspense context
2479
+ namespace,
2480
+ slotScopeIds,
2481
+ optimized
2482
+ );
2483
+ setActiveBranch(suspense, newFallback);
2484
+ }
2365
2485
  }
2366
2486
  } else {
2367
- suspense.pendingId++;
2487
+ suspense.pendingId = suspenseId++;
2368
2488
  if (isHydrating) {
2369
2489
  suspense.isHydrating = false;
2370
2490
  suspense.activeBranch = pendingBranch;
@@ -2382,7 +2502,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
2382
2502
  null,
2383
2503
  parentComponent,
2384
2504
  suspense,
2385
- isSVG,
2505
+ namespace,
2386
2506
  slotScopeIds,
2387
2507
  optimized
2388
2508
  );
@@ -2397,7 +2517,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
2397
2517
  parentComponent,
2398
2518
  null,
2399
2519
  // fallback tree will not have suspense context
2400
- isSVG,
2520
+ namespace,
2401
2521
  slotScopeIds,
2402
2522
  optimized
2403
2523
  );
@@ -2411,7 +2531,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
2411
2531
  anchor,
2412
2532
  parentComponent,
2413
2533
  suspense,
2414
- isSVG,
2534
+ namespace,
2415
2535
  slotScopeIds,
2416
2536
  optimized
2417
2537
  );
@@ -2424,7 +2544,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
2424
2544
  null,
2425
2545
  parentComponent,
2426
2546
  suspense,
2427
- isSVG,
2547
+ namespace,
2428
2548
  slotScopeIds,
2429
2549
  optimized
2430
2550
  );
@@ -2442,7 +2562,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
2442
2562
  anchor,
2443
2563
  parentComponent,
2444
2564
  suspense,
2445
- isSVG,
2565
+ namespace,
2446
2566
  slotScopeIds,
2447
2567
  optimized
2448
2568
  );
@@ -2450,7 +2570,11 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
2450
2570
  } else {
2451
2571
  triggerEvent(n2, "onPending");
2452
2572
  suspense.pendingBranch = newBranch;
2453
- suspense.pendingId++;
2573
+ if (newBranch.shapeFlag & 512) {
2574
+ suspense.pendingId = newBranch.component.suspenseId;
2575
+ } else {
2576
+ suspense.pendingId = suspenseId++;
2577
+ }
2454
2578
  patch(
2455
2579
  null,
2456
2580
  newBranch,
@@ -2458,7 +2582,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
2458
2582
  null,
2459
2583
  parentComponent,
2460
2584
  suspense,
2461
- isSVG,
2585
+ namespace,
2462
2586
  slotScopeIds,
2463
2587
  optimized
2464
2588
  );
@@ -2479,7 +2603,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
2479
2603
  }
2480
2604
  }
2481
2605
  }
2482
- function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
2606
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
2483
2607
  const {
2484
2608
  p: patch,
2485
2609
  m: move,
@@ -2500,7 +2624,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2500
2624
  vnode,
2501
2625
  parent: parentSuspense,
2502
2626
  parentComponent,
2503
- isSVG,
2627
+ namespace,
2504
2628
  container,
2505
2629
  hiddenContainer,
2506
2630
  anchor,
@@ -2509,7 +2633,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2509
2633
  timeout: typeof timeout === "number" ? timeout : -1,
2510
2634
  activeBranch: null,
2511
2635
  pendingBranch: null,
2512
- isInFallback: true,
2636
+ isInFallback: !isHydrating,
2513
2637
  isHydrating,
2514
2638
  isUnmounted: false,
2515
2639
  effects: [],
@@ -2531,7 +2655,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2531
2655
  if (delayEnter) {
2532
2656
  activeBranch.transition.afterLeave = () => {
2533
2657
  if (pendingId === suspense.pendingId) {
2534
- move(pendingBranch, container2, anchor2, 0);
2658
+ move(
2659
+ pendingBranch,
2660
+ container2,
2661
+ next(activeBranch),
2662
+ 0
2663
+ );
2535
2664
  queuePostFlushCb(effects);
2536
2665
  }
2537
2666
  };
@@ -2576,7 +2705,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2576
2705
  if (!suspense.pendingBranch) {
2577
2706
  return;
2578
2707
  }
2579
- const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
2708
+ const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
2580
2709
  triggerEvent(vnode2, "onFallback");
2581
2710
  const anchor2 = next(activeBranch);
2582
2711
  const mountFallback = () => {
@@ -2591,7 +2720,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2591
2720
  parentComponent2,
2592
2721
  null,
2593
2722
  // fallback tree will not have suspense context
2594
- isSVG2,
2723
+ namespace2,
2595
2724
  slotScopeIds,
2596
2725
  optimized
2597
2726
  );
@@ -2651,7 +2780,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2651
2780
  // consider the comment placeholder case.
2652
2781
  hydratedEl ? null : next(instance.subTree),
2653
2782
  suspense,
2654
- isSVG,
2783
+ namespace,
2655
2784
  optimized
2656
2785
  );
2657
2786
  if (placeholder) {
@@ -2685,7 +2814,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2685
2814
  };
2686
2815
  return suspense;
2687
2816
  }
2688
- function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
2817
+ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
2689
2818
  const suspense = vnode.suspense = createSuspenseBoundary(
2690
2819
  vnode,
2691
2820
  parentSuspense,
@@ -2693,7 +2822,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
2693
2822
  node.parentNode,
2694
2823
  document.createElement("div"),
2695
2824
  null,
2696
- isSVG,
2825
+ namespace,
2697
2826
  slotScopeIds,
2698
2827
  optimized,
2699
2828
  rendererInternals,
@@ -3596,7 +3725,7 @@ const KeepAliveImpl = {
3596
3725
  }
3597
3726
  } = sharedContext;
3598
3727
  const storageContainer = createElement("div");
3599
- sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
3728
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
3600
3729
  const instance2 = vnode.component;
3601
3730
  move(vnode, container, anchor, 0, parentSuspense);
3602
3731
  patch(
@@ -3606,7 +3735,7 @@ const KeepAliveImpl = {
3606
3735
  anchor,
3607
3736
  instance2,
3608
3737
  parentSuspense,
3609
- isSVG,
3738
+ namespace,
3610
3739
  vnode.slotScopeIds,
3611
3740
  optimized
3612
3741
  );
@@ -4637,31 +4766,26 @@ function useSlots() {
4637
4766
  function useAttrs() {
4638
4767
  return getContext().attrs;
4639
4768
  }
4640
- function useModel(props, name, options) {
4769
+ function useModel(props, name) {
4641
4770
  const i = getCurrentInstance();
4642
- if (options && options.local) {
4643
- const proxy = ref(props[name]);
4644
- watch(
4645
- () => props[name],
4646
- (v) => proxy.value = v
4647
- );
4648
- watch(proxy, (value) => {
4649
- if (value !== props[name]) {
4650
- i.emit(`update:${name}`, value);
4651
- }
4652
- });
4653
- return proxy;
4654
- } else {
4655
- return {
4656
- __v_isRef: true,
4657
- get value() {
4658
- return props[name];
4659
- },
4660
- set value(value) {
4661
- i.emit(`update:${name}`, value);
4771
+ let localValue;
4772
+ watchSyncEffect(() => {
4773
+ localValue = props[name];
4774
+ });
4775
+ return customRef((track, trigger) => ({
4776
+ get() {
4777
+ track();
4778
+ return localValue;
4779
+ },
4780
+ set(value) {
4781
+ const rawProps = i.vnode.props;
4782
+ if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
4783
+ localValue = value;
4784
+ trigger();
4662
4785
  }
4663
- };
4664
- }
4786
+ i.emit(`update:${name}`, value);
4787
+ }
4788
+ }));
4665
4789
  }
4666
4790
  function getContext() {
4667
4791
  const i = getCurrentInstance();
@@ -5122,7 +5246,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5122
5246
  return vm;
5123
5247
  }
5124
5248
  }
5125
- Vue.version = `2.6.14-compat:${"3.4.0-alpha.3"}`;
5249
+ Vue.version = `2.6.14-compat:${"3.4.0-beta.1"}`;
5126
5250
  Vue.config = singletonApp.config;
5127
5251
  Vue.use = (p, ...options) => {
5128
5252
  if (p && isFunction(p.install)) {
@@ -5351,7 +5475,11 @@ function installCompatMount(app, context, render) {
5351
5475
  } else {
5352
5476
  container = selectorOrEl || document.createElement("div");
5353
5477
  }
5354
- const isSVG = container instanceof SVGElement;
5478
+ let namespace;
5479
+ if (container instanceof SVGElement)
5480
+ namespace = "svg";
5481
+ else if (typeof MathMLElement === "function" && container instanceof MathMLElement)
5482
+ namespace = "mathml";
5355
5483
  if (hasNoRender && instance.render === emptyRender) {
5356
5484
  instance.render = null;
5357
5485
  component.template = container.innerHTML;
@@ -5363,7 +5491,7 @@ function installCompatMount(app, context, render) {
5363
5491
  );
5364
5492
  }
5365
5493
  container.innerHTML = "";
5366
- render(vnode, container, isSVG);
5494
+ render(vnode, container, namespace);
5367
5495
  if (container instanceof Element) {
5368
5496
  container.removeAttribute("v-cloak");
5369
5497
  container.setAttribute("data-v-app", "");
@@ -5531,14 +5659,19 @@ function createAppAPI(render, hydrate) {
5531
5659
  context.directives[name] = directive;
5532
5660
  return app;
5533
5661
  },
5534
- mount(rootContainer, isHydrate, isSVG) {
5662
+ mount(rootContainer, isHydrate, namespace) {
5535
5663
  if (!isMounted) {
5536
5664
  const vnode = createVNode(rootComponent, rootProps);
5537
5665
  vnode.appContext = context;
5666
+ if (namespace === true) {
5667
+ namespace = "svg";
5668
+ } else if (namespace === false) {
5669
+ namespace = void 0;
5670
+ }
5538
5671
  if (isHydrate && hydrate) {
5539
5672
  hydrate(vnode, rootContainer);
5540
5673
  } else {
5541
- render(vnode, rootContainer, isSVG);
5674
+ render(vnode, rootContainer, namespace);
5542
5675
  }
5543
5676
  isMounted = true;
5544
5677
  app._container = rootContainer;
@@ -6107,7 +6240,15 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6107
6240
  }
6108
6241
 
6109
6242
  let hasMismatch = false;
6110
- const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject";
6243
+ const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
6244
+ const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
6245
+ const getContainerType = (container) => {
6246
+ if (isSVGContainer(container))
6247
+ return "svg";
6248
+ if (isMathMLContainer(container))
6249
+ return "mathml";
6250
+ return void 0;
6251
+ };
6111
6252
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
6112
6253
  function createHydrationFunctions(rendererInternals) {
6113
6254
  const {
@@ -6252,7 +6393,7 @@ function createHydrationFunctions(rendererInternals) {
6252
6393
  null,
6253
6394
  parentComponent,
6254
6395
  parentSuspense,
6255
- isSVGContainer(container),
6396
+ getContainerType(container),
6256
6397
  optimized
6257
6398
  );
6258
6399
  if (isAsyncWrapper(vnode)) {
@@ -6287,7 +6428,7 @@ function createHydrationFunctions(rendererInternals) {
6287
6428
  vnode,
6288
6429
  parentComponent,
6289
6430
  parentSuspense,
6290
- isSVGContainer(parentNode(node)),
6431
+ getContainerType(parentNode(node)),
6291
6432
  slotScopeIds,
6292
6433
  optimized,
6293
6434
  rendererInternals,
@@ -6308,6 +6449,39 @@ function createHydrationFunctions(rendererInternals) {
6308
6449
  if (dirs) {
6309
6450
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6310
6451
  }
6452
+ let needCallTransitionHooks = false;
6453
+ if (isTemplateNode(el)) {
6454
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6455
+ const content = el.content.firstChild;
6456
+ if (needCallTransitionHooks) {
6457
+ transition.beforeEnter(content);
6458
+ }
6459
+ replaceNode(content, el, parentComponent);
6460
+ vnode.el = el = content;
6461
+ }
6462
+ if (shapeFlag & 16 && // skip if element has innerHTML / textContent
6463
+ !(props && (props.innerHTML || props.textContent))) {
6464
+ let next = hydrateChildren(
6465
+ el.firstChild,
6466
+ vnode,
6467
+ el,
6468
+ parentComponent,
6469
+ parentSuspense,
6470
+ slotScopeIds,
6471
+ optimized
6472
+ );
6473
+ while (next) {
6474
+ hasMismatch = true;
6475
+ const cur = next;
6476
+ next = next.nextSibling;
6477
+ remove(cur);
6478
+ }
6479
+ } else if (shapeFlag & 8) {
6480
+ if (el.textContent !== vnode.children) {
6481
+ hasMismatch = true;
6482
+ el.textContent = vnode.children;
6483
+ }
6484
+ }
6311
6485
  if (props) {
6312
6486
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6313
6487
  for (const key in props) {
@@ -6318,7 +6492,7 @@ function createHydrationFunctions(rendererInternals) {
6318
6492
  key,
6319
6493
  null,
6320
6494
  props[key],
6321
- false,
6495
+ void 0,
6322
6496
  void 0,
6323
6497
  parentComponent
6324
6498
  );
@@ -6330,7 +6504,7 @@ function createHydrationFunctions(rendererInternals) {
6330
6504
  "onClick",
6331
6505
  null,
6332
6506
  props.onClick,
6333
- false,
6507
+ void 0,
6334
6508
  void 0,
6335
6509
  parentComponent
6336
6510
  );
@@ -6340,16 +6514,6 @@ function createHydrationFunctions(rendererInternals) {
6340
6514
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6341
6515
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6342
6516
  }
6343
- let needCallTransitionHooks = false;
6344
- if (isTemplateNode(el)) {
6345
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6346
- const content = el.content.firstChild;
6347
- if (needCallTransitionHooks) {
6348
- transition.beforeEnter(content);
6349
- }
6350
- replaceNode(content, el, parentComponent);
6351
- vnode.el = el = content;
6352
- }
6353
6517
  if (dirs) {
6354
6518
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6355
6519
  }
@@ -6360,29 +6524,6 @@ function createHydrationFunctions(rendererInternals) {
6360
6524
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6361
6525
  }, parentSuspense);
6362
6526
  }
6363
- if (shapeFlag & 16 && // skip if element has innerHTML / textContent
6364
- !(props && (props.innerHTML || props.textContent))) {
6365
- let next = hydrateChildren(
6366
- el.firstChild,
6367
- vnode,
6368
- el,
6369
- parentComponent,
6370
- parentSuspense,
6371
- slotScopeIds,
6372
- optimized
6373
- );
6374
- while (next) {
6375
- hasMismatch = true;
6376
- const cur = next;
6377
- next = next.nextSibling;
6378
- remove(cur);
6379
- }
6380
- } else if (shapeFlag & 8) {
6381
- if (el.textContent !== vnode.children) {
6382
- hasMismatch = true;
6383
- el.textContent = vnode.children;
6384
- }
6385
- }
6386
6527
  }
6387
6528
  return el.nextSibling;
6388
6529
  };
@@ -6412,7 +6553,7 @@ function createHydrationFunctions(rendererInternals) {
6412
6553
  null,
6413
6554
  parentComponent,
6414
6555
  parentSuspense,
6415
- isSVGContainer(container),
6556
+ getContainerType(container),
6416
6557
  slotScopeIds
6417
6558
  );
6418
6559
  }
@@ -6466,7 +6607,7 @@ function createHydrationFunctions(rendererInternals) {
6466
6607
  next,
6467
6608
  parentComponent,
6468
6609
  parentSuspense,
6469
- isSVGContainer(container),
6610
+ getContainerType(container),
6470
6611
  slotScopeIds
6471
6612
  );
6472
6613
  return next;
@@ -6532,7 +6673,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6532
6673
  setScopeId: hostSetScopeId = NOOP,
6533
6674
  insertStaticContent: hostInsertStaticContent
6534
6675
  } = options;
6535
- const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = !!n2.dynamicChildren) => {
6676
+ const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = !!n2.dynamicChildren) => {
6536
6677
  if (n1 === n2) {
6537
6678
  return;
6538
6679
  }
@@ -6555,7 +6696,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6555
6696
  break;
6556
6697
  case Static:
6557
6698
  if (n1 == null) {
6558
- mountStaticNode(n2, container, anchor, isSVG);
6699
+ mountStaticNode(n2, container, anchor, namespace);
6559
6700
  }
6560
6701
  break;
6561
6702
  case Fragment:
@@ -6566,7 +6707,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6566
6707
  anchor,
6567
6708
  parentComponent,
6568
6709
  parentSuspense,
6569
- isSVG,
6710
+ namespace,
6570
6711
  slotScopeIds,
6571
6712
  optimized
6572
6713
  );
@@ -6580,7 +6721,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6580
6721
  anchor,
6581
6722
  parentComponent,
6582
6723
  parentSuspense,
6583
- isSVG,
6724
+ namespace,
6584
6725
  slotScopeIds,
6585
6726
  optimized
6586
6727
  );
@@ -6592,7 +6733,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6592
6733
  anchor,
6593
6734
  parentComponent,
6594
6735
  parentSuspense,
6595
- isSVG,
6736
+ namespace,
6596
6737
  slotScopeIds,
6597
6738
  optimized
6598
6739
  );
@@ -6604,7 +6745,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6604
6745
  anchor,
6605
6746
  parentComponent,
6606
6747
  parentSuspense,
6607
- isSVG,
6748
+ namespace,
6608
6749
  slotScopeIds,
6609
6750
  optimized,
6610
6751
  internals
@@ -6617,7 +6758,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6617
6758
  anchor,
6618
6759
  parentComponent,
6619
6760
  parentSuspense,
6620
- isSVG,
6761
+ namespace,
6621
6762
  slotScopeIds,
6622
6763
  optimized,
6623
6764
  internals
@@ -6653,12 +6794,12 @@ function baseCreateRenderer(options, createHydrationFns) {
6653
6794
  n2.el = n1.el;
6654
6795
  }
6655
6796
  };
6656
- const mountStaticNode = (n2, container, anchor, isSVG) => {
6797
+ const mountStaticNode = (n2, container, anchor, namespace) => {
6657
6798
  [n2.el, n2.anchor] = hostInsertStaticContent(
6658
6799
  n2.children,
6659
6800
  container,
6660
6801
  anchor,
6661
- isSVG,
6802
+ namespace,
6662
6803
  n2.el,
6663
6804
  n2.anchor
6664
6805
  );
@@ -6681,8 +6822,12 @@ function baseCreateRenderer(options, createHydrationFns) {
6681
6822
  }
6682
6823
  hostRemove(anchor);
6683
6824
  };
6684
- const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
6685
- isSVG = isSVG || n2.type === "svg";
6825
+ const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6826
+ if (n2.type === "svg") {
6827
+ namespace = "svg";
6828
+ } else if (n2.type === "math") {
6829
+ namespace = "mathml";
6830
+ }
6686
6831
  if (n1 == null) {
6687
6832
  mountElement(
6688
6833
  n2,
@@ -6690,7 +6835,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6690
6835
  anchor,
6691
6836
  parentComponent,
6692
6837
  parentSuspense,
6693
- isSVG,
6838
+ namespace,
6694
6839
  slotScopeIds,
6695
6840
  optimized
6696
6841
  );
@@ -6700,19 +6845,19 @@ function baseCreateRenderer(options, createHydrationFns) {
6700
6845
  n2,
6701
6846
  parentComponent,
6702
6847
  parentSuspense,
6703
- isSVG,
6848
+ namespace,
6704
6849
  slotScopeIds,
6705
6850
  optimized
6706
6851
  );
6707
6852
  }
6708
6853
  };
6709
- const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
6854
+ const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6710
6855
  let el;
6711
6856
  let vnodeHook;
6712
- const { type, props, shapeFlag, transition, dirs } = vnode;
6857
+ const { props, shapeFlag, transition, dirs } = vnode;
6713
6858
  el = vnode.el = hostCreateElement(
6714
6859
  vnode.type,
6715
- isSVG,
6860
+ namespace,
6716
6861
  props && props.is,
6717
6862
  props
6718
6863
  );
@@ -6725,7 +6870,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6725
6870
  null,
6726
6871
  parentComponent,
6727
6872
  parentSuspense,
6728
- isSVG && type !== "foreignObject",
6873
+ resolveChildrenNamespace(vnode, namespace),
6729
6874
  slotScopeIds,
6730
6875
  optimized
6731
6876
  );
@@ -6742,7 +6887,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6742
6887
  key,
6743
6888
  null,
6744
6889
  props[key],
6745
- isSVG,
6890
+ namespace,
6746
6891
  vnode.children,
6747
6892
  parentComponent,
6748
6893
  parentSuspense,
@@ -6751,7 +6896,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6751
6896
  }
6752
6897
  }
6753
6898
  if ("value" in props) {
6754
- hostPatchProp(el, "value", null, props.value);
6899
+ hostPatchProp(el, "value", null, props.value, namespace);
6755
6900
  }
6756
6901
  if (vnodeHook = props.onVnodeBeforeMount) {
6757
6902
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
@@ -6796,7 +6941,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6796
6941
  }
6797
6942
  }
6798
6943
  };
6799
- const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
6944
+ const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
6800
6945
  for (let i = start; i < children.length; i++) {
6801
6946
  const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
6802
6947
  patch(
@@ -6806,13 +6951,13 @@ function baseCreateRenderer(options, createHydrationFns) {
6806
6951
  anchor,
6807
6952
  parentComponent,
6808
6953
  parentSuspense,
6809
- isSVG,
6954
+ namespace,
6810
6955
  slotScopeIds,
6811
6956
  optimized
6812
6957
  );
6813
6958
  }
6814
6959
  };
6815
- const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
6960
+ const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6816
6961
  const el = n2.el = n1.el;
6817
6962
  let { patchFlag, dynamicChildren, dirs } = n2;
6818
6963
  patchFlag |= n1.patchFlag & 16;
@@ -6827,7 +6972,6 @@ function baseCreateRenderer(options, createHydrationFns) {
6827
6972
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
6828
6973
  }
6829
6974
  parentComponent && toggleRecurse(parentComponent, true);
6830
- const areChildrenSVG = isSVG && n2.type !== "foreignObject";
6831
6975
  if (dynamicChildren) {
6832
6976
  patchBlockChildren(
6833
6977
  n1.dynamicChildren,
@@ -6835,7 +6979,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6835
6979
  el,
6836
6980
  parentComponent,
6837
6981
  parentSuspense,
6838
- areChildrenSVG,
6982
+ resolveChildrenNamespace(n2, namespace),
6839
6983
  slotScopeIds
6840
6984
  );
6841
6985
  } else if (!optimized) {
@@ -6846,7 +6990,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6846
6990
  null,
6847
6991
  parentComponent,
6848
6992
  parentSuspense,
6849
- areChildrenSVG,
6993
+ resolveChildrenNamespace(n2, namespace),
6850
6994
  slotScopeIds,
6851
6995
  false
6852
6996
  );
@@ -6860,16 +7004,16 @@ function baseCreateRenderer(options, createHydrationFns) {
6860
7004
  newProps,
6861
7005
  parentComponent,
6862
7006
  parentSuspense,
6863
- isSVG
7007
+ namespace
6864
7008
  );
6865
7009
  } else {
6866
7010
  if (patchFlag & 2) {
6867
7011
  if (oldProps.class !== newProps.class) {
6868
- hostPatchProp(el, "class", null, newProps.class, isSVG);
7012
+ hostPatchProp(el, "class", null, newProps.class, namespace);
6869
7013
  }
6870
7014
  }
6871
7015
  if (patchFlag & 4) {
6872
- hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
7016
+ hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
6873
7017
  }
6874
7018
  if (patchFlag & 8) {
6875
7019
  const propsToUpdate = n2.dynamicProps;
@@ -6883,7 +7027,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6883
7027
  key,
6884
7028
  prev,
6885
7029
  next,
6886
- isSVG,
7030
+ namespace,
6887
7031
  n1.children,
6888
7032
  parentComponent,
6889
7033
  parentSuspense,
@@ -6906,7 +7050,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6906
7050
  newProps,
6907
7051
  parentComponent,
6908
7052
  parentSuspense,
6909
- isSVG
7053
+ namespace
6910
7054
  );
6911
7055
  }
6912
7056
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
@@ -6916,7 +7060,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6916
7060
  }, parentSuspense);
6917
7061
  }
6918
7062
  };
6919
- const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
7063
+ const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
6920
7064
  for (let i = 0; i < newChildren.length; i++) {
6921
7065
  const oldVNode = oldChildren[i];
6922
7066
  const newVNode = newChildren[i];
@@ -6941,13 +7085,13 @@ function baseCreateRenderer(options, createHydrationFns) {
6941
7085
  null,
6942
7086
  parentComponent,
6943
7087
  parentSuspense,
6944
- isSVG,
7088
+ namespace,
6945
7089
  slotScopeIds,
6946
7090
  true
6947
7091
  );
6948
7092
  }
6949
7093
  };
6950
- const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
7094
+ const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
6951
7095
  if (oldProps !== newProps) {
6952
7096
  if (oldProps !== EMPTY_OBJ) {
6953
7097
  for (const key in oldProps) {
@@ -6957,7 +7101,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6957
7101
  key,
6958
7102
  oldProps[key],
6959
7103
  null,
6960
- isSVG,
7104
+ namespace,
6961
7105
  vnode.children,
6962
7106
  parentComponent,
6963
7107
  parentSuspense,
@@ -6977,7 +7121,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6977
7121
  key,
6978
7122
  prev,
6979
7123
  next,
6980
- isSVG,
7124
+ namespace,
6981
7125
  vnode.children,
6982
7126
  parentComponent,
6983
7127
  parentSuspense,
@@ -6986,11 +7130,11 @@ function baseCreateRenderer(options, createHydrationFns) {
6986
7130
  }
6987
7131
  }
6988
7132
  if ("value" in newProps) {
6989
- hostPatchProp(el, "value", oldProps.value, newProps.value);
7133
+ hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
6990
7134
  }
6991
7135
  }
6992
7136
  };
6993
- const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
7137
+ const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6994
7138
  const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
6995
7139
  const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
6996
7140
  let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
@@ -7006,7 +7150,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7006
7150
  fragmentEndAnchor,
7007
7151
  parentComponent,
7008
7152
  parentSuspense,
7009
- isSVG,
7153
+ namespace,
7010
7154
  slotScopeIds,
7011
7155
  optimized
7012
7156
  );
@@ -7020,7 +7164,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7020
7164
  container,
7021
7165
  parentComponent,
7022
7166
  parentSuspense,
7023
- isSVG,
7167
+ namespace,
7024
7168
  slotScopeIds
7025
7169
  );
7026
7170
  if (
@@ -7045,14 +7189,14 @@ function baseCreateRenderer(options, createHydrationFns) {
7045
7189
  fragmentEndAnchor,
7046
7190
  parentComponent,
7047
7191
  parentSuspense,
7048
- isSVG,
7192
+ namespace,
7049
7193
  slotScopeIds,
7050
7194
  optimized
7051
7195
  );
7052
7196
  }
7053
7197
  }
7054
7198
  };
7055
- const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
7199
+ const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7056
7200
  n2.slotScopeIds = slotScopeIds;
7057
7201
  if (n1 == null) {
7058
7202
  if (n2.shapeFlag & 512) {
@@ -7060,7 +7204,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7060
7204
  n2,
7061
7205
  container,
7062
7206
  anchor,
7063
- isSVG,
7207
+ namespace,
7064
7208
  optimized
7065
7209
  );
7066
7210
  } else {
@@ -7070,7 +7214,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7070
7214
  anchor,
7071
7215
  parentComponent,
7072
7216
  parentSuspense,
7073
- isSVG,
7217
+ namespace,
7074
7218
  optimized
7075
7219
  );
7076
7220
  }
@@ -7078,7 +7222,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7078
7222
  updateComponent(n1, n2, optimized);
7079
7223
  }
7080
7224
  };
7081
- const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
7225
+ const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
7082
7226
  const compatMountInstance = initialVNode.isCompatRoot && initialVNode.component;
7083
7227
  const instance = compatMountInstance || (initialVNode.component = createComponentInstance(
7084
7228
  initialVNode,
@@ -7097,17 +7241,17 @@ function baseCreateRenderer(options, createHydrationFns) {
7097
7241
  const placeholder = instance.subTree = createVNode(Comment);
7098
7242
  processCommentNode(null, placeholder, container, anchor);
7099
7243
  }
7100
- return;
7244
+ } else {
7245
+ setupRenderEffect(
7246
+ instance,
7247
+ initialVNode,
7248
+ container,
7249
+ anchor,
7250
+ parentSuspense,
7251
+ namespace,
7252
+ optimized
7253
+ );
7101
7254
  }
7102
- setupRenderEffect(
7103
- instance,
7104
- initialVNode,
7105
- container,
7106
- anchor,
7107
- parentSuspense,
7108
- isSVG,
7109
- optimized
7110
- );
7111
7255
  };
7112
7256
  const updateComponent = (n1, n2, optimized) => {
7113
7257
  const instance = n2.component = n1.component;
@@ -7126,7 +7270,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7126
7270
  instance.vnode = n2;
7127
7271
  }
7128
7272
  };
7129
- const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
7273
+ const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7130
7274
  const componentUpdateFn = () => {
7131
7275
  if (!instance.isMounted) {
7132
7276
  let vnodeHook;
@@ -7175,7 +7319,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7175
7319
  anchor,
7176
7320
  instance,
7177
7321
  parentSuspense,
7178
- isSVG
7322
+ namespace
7179
7323
  );
7180
7324
  initialVNode.el = subTree.el;
7181
7325
  }
@@ -7208,6 +7352,21 @@ function baseCreateRenderer(options, createHydrationFns) {
7208
7352
  initialVNode = container = anchor = null;
7209
7353
  } else {
7210
7354
  let { next, bu, u, parent, vnode } = instance;
7355
+ {
7356
+ const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
7357
+ if (nonHydratedAsyncRoot) {
7358
+ if (next) {
7359
+ next.el = vnode.el;
7360
+ updateComponentPreRender(instance, next, optimized);
7361
+ }
7362
+ nonHydratedAsyncRoot.asyncDep.then(() => {
7363
+ if (!instance.isUnmounted) {
7364
+ componentUpdateFn();
7365
+ }
7366
+ });
7367
+ return;
7368
+ }
7369
+ }
7211
7370
  let originNext = next;
7212
7371
  let vnodeHook;
7213
7372
  toggleRecurse(instance, false);
@@ -7239,7 +7398,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7239
7398
  getNextHostNode(prevTree),
7240
7399
  instance,
7241
7400
  parentSuspense,
7242
- isSVG
7401
+ namespace
7243
7402
  );
7244
7403
  next.el = nextTree.el;
7245
7404
  if (originNext === null) {
@@ -7286,10 +7445,10 @@ function baseCreateRenderer(options, createHydrationFns) {
7286
7445
  updateProps(instance, nextVNode.props, prevProps, optimized);
7287
7446
  updateSlots(instance, nextVNode.children, optimized);
7288
7447
  pauseTracking();
7289
- flushPreFlushCbs();
7448
+ flushPreFlushCbs(instance);
7290
7449
  resetTracking();
7291
7450
  };
7292
- const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
7451
+ const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
7293
7452
  const c1 = n1 && n1.children;
7294
7453
  const prevShapeFlag = n1 ? n1.shapeFlag : 0;
7295
7454
  const c2 = n2.children;
@@ -7303,7 +7462,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7303
7462
  anchor,
7304
7463
  parentComponent,
7305
7464
  parentSuspense,
7306
- isSVG,
7465
+ namespace,
7307
7466
  slotScopeIds,
7308
7467
  optimized
7309
7468
  );
@@ -7316,7 +7475,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7316
7475
  anchor,
7317
7476
  parentComponent,
7318
7477
  parentSuspense,
7319
- isSVG,
7478
+ namespace,
7320
7479
  slotScopeIds,
7321
7480
  optimized
7322
7481
  );
@@ -7340,7 +7499,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7340
7499
  anchor,
7341
7500
  parentComponent,
7342
7501
  parentSuspense,
7343
- isSVG,
7502
+ namespace,
7344
7503
  slotScopeIds,
7345
7504
  optimized
7346
7505
  );
@@ -7358,7 +7517,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7358
7517
  anchor,
7359
7518
  parentComponent,
7360
7519
  parentSuspense,
7361
- isSVG,
7520
+ namespace,
7362
7521
  slotScopeIds,
7363
7522
  optimized
7364
7523
  );
@@ -7366,7 +7525,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7366
7525
  }
7367
7526
  }
7368
7527
  };
7369
- const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
7528
+ const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7370
7529
  c1 = c1 || EMPTY_ARR;
7371
7530
  c2 = c2 || EMPTY_ARR;
7372
7531
  const oldLength = c1.length;
@@ -7382,7 +7541,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7382
7541
  null,
7383
7542
  parentComponent,
7384
7543
  parentSuspense,
7385
- isSVG,
7544
+ namespace,
7386
7545
  slotScopeIds,
7387
7546
  optimized
7388
7547
  );
@@ -7403,14 +7562,14 @@ function baseCreateRenderer(options, createHydrationFns) {
7403
7562
  anchor,
7404
7563
  parentComponent,
7405
7564
  parentSuspense,
7406
- isSVG,
7565
+ namespace,
7407
7566
  slotScopeIds,
7408
7567
  optimized,
7409
7568
  commonLength
7410
7569
  );
7411
7570
  }
7412
7571
  };
7413
- const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
7572
+ const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7414
7573
  let i = 0;
7415
7574
  const l2 = c2.length;
7416
7575
  let e1 = c1.length - 1;
@@ -7426,7 +7585,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7426
7585
  null,
7427
7586
  parentComponent,
7428
7587
  parentSuspense,
7429
- isSVG,
7588
+ namespace,
7430
7589
  slotScopeIds,
7431
7590
  optimized
7432
7591
  );
@@ -7446,7 +7605,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7446
7605
  null,
7447
7606
  parentComponent,
7448
7607
  parentSuspense,
7449
- isSVG,
7608
+ namespace,
7450
7609
  slotScopeIds,
7451
7610
  optimized
7452
7611
  );
@@ -7468,7 +7627,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7468
7627
  anchor,
7469
7628
  parentComponent,
7470
7629
  parentSuspense,
7471
- isSVG,
7630
+ namespace,
7472
7631
  slotScopeIds,
7473
7632
  optimized
7474
7633
  );
@@ -7531,7 +7690,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7531
7690
  null,
7532
7691
  parentComponent,
7533
7692
  parentSuspense,
7534
- isSVG,
7693
+ namespace,
7535
7694
  slotScopeIds,
7536
7695
  optimized
7537
7696
  );
@@ -7552,7 +7711,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7552
7711
  anchor,
7553
7712
  parentComponent,
7554
7713
  parentSuspense,
7555
- isSVG,
7714
+ namespace,
7556
7715
  slotScopeIds,
7557
7716
  optimized
7558
7717
  );
@@ -7768,13 +7927,21 @@ function baseCreateRenderer(options, createHydrationFns) {
7768
7927
  }
7769
7928
  return hostNextSibling(vnode.anchor || vnode.el);
7770
7929
  };
7771
- const render = (vnode, container, isSVG) => {
7930
+ const render = (vnode, container, namespace) => {
7772
7931
  if (vnode == null) {
7773
7932
  if (container._vnode) {
7774
7933
  unmount(container._vnode, null, null, true);
7775
7934
  }
7776
7935
  } else {
7777
- patch(container._vnode || null, vnode, container, null, null, null, isSVG);
7936
+ patch(
7937
+ container._vnode || null,
7938
+ vnode,
7939
+ container,
7940
+ null,
7941
+ null,
7942
+ null,
7943
+ namespace
7944
+ );
7778
7945
  }
7779
7946
  flushPreFlushCbs();
7780
7947
  flushPostFlushCbs();
@@ -7805,6 +7972,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7805
7972
  createApp: createAppAPI(render, hydrate)
7806
7973
  };
7807
7974
  }
7975
+ function resolveChildrenNamespace({ type, props }, currentNamespace) {
7976
+ return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
7977
+ }
7808
7978
  function toggleRecurse({ effect, update }, allowed) {
7809
7979
  effect.allowRecurse = update.allowRecurse = allowed;
7810
7980
  }
@@ -7872,10 +8042,21 @@ function getSequence(arr) {
7872
8042
  }
7873
8043
  return result;
7874
8044
  }
8045
+ function locateNonHydratedAsyncRoot(instance) {
8046
+ const subComponent = instance.subTree.component;
8047
+ if (subComponent) {
8048
+ if (subComponent.asyncDep && !subComponent.asyncResolved) {
8049
+ return subComponent;
8050
+ } else {
8051
+ return locateNonHydratedAsyncRoot(subComponent);
8052
+ }
8053
+ }
8054
+ }
7875
8055
 
7876
8056
  const isTeleport = (type) => type.__isTeleport;
7877
8057
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
7878
8058
  const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
8059
+ const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
7879
8060
  const resolveTarget = (props, select) => {
7880
8061
  const targetSelector = props && props.to;
7881
8062
  if (isString(targetSelector)) {
@@ -7892,7 +8073,7 @@ const resolveTarget = (props, select) => {
7892
8073
  const TeleportImpl = {
7893
8074
  name: "Teleport",
7894
8075
  __isTeleport: true,
7895
- process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
8076
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
7896
8077
  const {
7897
8078
  mc: mountChildren,
7898
8079
  pc: patchChildren,
@@ -7910,7 +8091,11 @@ const TeleportImpl = {
7910
8091
  const targetAnchor = n2.targetAnchor = createText("");
7911
8092
  if (target) {
7912
8093
  insert(targetAnchor, target);
7913
- isSVG = isSVG || isTargetSVG(target);
8094
+ if (namespace === "svg" || isTargetSVG(target)) {
8095
+ namespace = "svg";
8096
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
8097
+ namespace = "mathml";
8098
+ }
7914
8099
  }
7915
8100
  const mount = (container2, anchor2) => {
7916
8101
  if (shapeFlag & 16) {
@@ -7920,7 +8105,7 @@ const TeleportImpl = {
7920
8105
  anchor2,
7921
8106
  parentComponent,
7922
8107
  parentSuspense,
7923
- isSVG,
8108
+ namespace,
7924
8109
  slotScopeIds,
7925
8110
  optimized
7926
8111
  );
@@ -7939,7 +8124,11 @@ const TeleportImpl = {
7939
8124
  const wasDisabled = isTeleportDisabled(n1.props);
7940
8125
  const currentContainer = wasDisabled ? container : target;
7941
8126
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
7942
- isSVG = isSVG || isTargetSVG(target);
8127
+ if (namespace === "svg" || isTargetSVG(target)) {
8128
+ namespace = "svg";
8129
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
8130
+ namespace = "mathml";
8131
+ }
7943
8132
  if (dynamicChildren) {
7944
8133
  patchBlockChildren(
7945
8134
  n1.dynamicChildren,
@@ -7947,7 +8136,7 @@ const TeleportImpl = {
7947
8136
  currentContainer,
7948
8137
  parentComponent,
7949
8138
  parentSuspense,
7950
- isSVG,
8139
+ namespace,
7951
8140
  slotScopeIds
7952
8141
  );
7953
8142
  traverseStaticChildren(n1, n2, true);
@@ -7959,7 +8148,7 @@ const TeleportImpl = {
7959
8148
  currentAnchor,
7960
8149
  parentComponent,
7961
8150
  parentSuspense,
7962
- isSVG,
8151
+ namespace,
7963
8152
  slotScopeIds,
7964
8153
  false
7965
8154
  );
@@ -8603,20 +8792,29 @@ function createComponentInstance(vnode, parent, suspense) {
8603
8792
  let currentInstance = null;
8604
8793
  const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8605
8794
  let internalSetCurrentInstance;
8606
- let globalCurrentInstanceSetters;
8607
- let settersKey = "__VUE_INSTANCE_SETTERS__";
8795
+ let setInSSRSetupState;
8608
8796
  {
8609
- if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
8610
- globalCurrentInstanceSetters = getGlobalThis()[settersKey] = [];
8611
- }
8612
- globalCurrentInstanceSetters.push((i) => currentInstance = i);
8613
- internalSetCurrentInstance = (instance) => {
8614
- if (globalCurrentInstanceSetters.length > 1) {
8615
- globalCurrentInstanceSetters.forEach((s) => s(instance));
8616
- } else {
8617
- globalCurrentInstanceSetters[0](instance);
8618
- }
8797
+ const g = getGlobalThis();
8798
+ const registerGlobalSetter = (key, setter) => {
8799
+ let setters;
8800
+ if (!(setters = g[key]))
8801
+ setters = g[key] = [];
8802
+ setters.push(setter);
8803
+ return (v) => {
8804
+ if (setters.length > 1)
8805
+ setters.forEach((set) => set(v));
8806
+ else
8807
+ setters[0](v);
8808
+ };
8619
8809
  };
8810
+ internalSetCurrentInstance = registerGlobalSetter(
8811
+ `__VUE_INSTANCE_SETTERS__`,
8812
+ (v) => currentInstance = v
8813
+ );
8814
+ setInSSRSetupState = registerGlobalSetter(
8815
+ `__VUE_SSR_SETTERS__`,
8816
+ (v) => isInSSRComponentSetup = v
8817
+ );
8620
8818
  }
8621
8819
  const setCurrentInstance = (instance) => {
8622
8820
  internalSetCurrentInstance(instance);
@@ -8631,13 +8829,13 @@ function isStatefulComponent(instance) {
8631
8829
  }
8632
8830
  let isInSSRComponentSetup = false;
8633
8831
  function setupComponent(instance, isSSR = false) {
8634
- isInSSRComponentSetup = isSSR;
8832
+ isSSR && setInSSRSetupState(isSSR);
8635
8833
  const { props, children } = instance.vnode;
8636
8834
  const isStateful = isStatefulComponent(instance);
8637
8835
  initProps(instance, props, isStateful, isSSR);
8638
8836
  initSlots(instance, children);
8639
8837
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
8640
- isInSSRComponentSetup = false;
8838
+ isSSR && setInSSRSetupState(false);
8641
8839
  return setupResult;
8642
8840
  }
8643
8841
  function setupStatefulComponent(instance, isSSR) {
@@ -8857,7 +9055,7 @@ function isMemoSame(cached, memo) {
8857
9055
  return true;
8858
9056
  }
8859
9057
 
8860
- const version = "3.4.0-alpha.3";
9058
+ const version = "3.4.0-beta.1";
8861
9059
  const ErrorTypeStrings = null;
8862
9060
  const _ssrUtils = {
8863
9061
  createComponentInstance,
@@ -8877,8 +9075,10 @@ const _compatUtils = {
8877
9075
  softAssertCompatEnabled
8878
9076
  };
8879
9077
  const compatUtils = _compatUtils ;
9078
+ const DeprecationTypes = DeprecationTypes$1 ;
8880
9079
 
8881
9080
  const svgNS = "http://www.w3.org/2000/svg";
9081
+ const mathmlNS = "http://www.w3.org/1998/Math/MathML";
8882
9082
  const doc = typeof document !== "undefined" ? document : null;
8883
9083
  const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
8884
9084
  const nodeOps = {
@@ -8891,8 +9091,8 @@ const nodeOps = {
8891
9091
  parent.removeChild(child);
8892
9092
  }
8893
9093
  },
8894
- createElement: (tag, isSVG, is, props) => {
8895
- const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0);
9094
+ createElement: (tag, namespace, is, props) => {
9095
+ const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
8896
9096
  if (tag === "select" && props && props.multiple != null) {
8897
9097
  el.setAttribute("multiple", props.multiple);
8898
9098
  }
@@ -8916,7 +9116,7 @@ const nodeOps = {
8916
9116
  // Reason: innerHTML.
8917
9117
  // Static content here can only come from compiled templates.
8918
9118
  // As long as the user only uses trusted templates, this is safe.
8919
- insertStaticContent(content, parent, anchor, isSVG, start, end) {
9119
+ insertStaticContent(content, parent, anchor, namespace, start, end) {
8920
9120
  const before = anchor ? anchor.previousSibling : parent.lastChild;
8921
9121
  if (start && (start === end || start.nextSibling)) {
8922
9122
  while (true) {
@@ -8925,9 +9125,9 @@ const nodeOps = {
8925
9125
  break;
8926
9126
  }
8927
9127
  } else {
8928
- templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
9128
+ templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
8929
9129
  const template = templateContainer.content;
8930
- if (isSVG) {
9130
+ if (namespace === "svg" || namespace === "mathml") {
8931
9131
  const wrapper = template.firstChild;
8932
9132
  while (wrapper.firstChild) {
8933
9133
  template.appendChild(wrapper.firstChild);
@@ -9550,8 +9750,10 @@ function patchStopImmediatePropagation(e, value) {
9550
9750
  }
9551
9751
  }
9552
9752
 
9553
- const nativeOnRE = /^on[a-z]/;
9554
- const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
9753
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
9754
+ key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
9755
+ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
9756
+ const isSVG = namespace === "svg";
9555
9757
  if (key === "class") {
9556
9758
  patchClass(el, nextValue, isSVG);
9557
9759
  } else if (key === "style") {
@@ -9584,7 +9786,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
9584
9786
  if (key === "innerHTML" || key === "textContent") {
9585
9787
  return true;
9586
9788
  }
9587
- if (key in el && nativeOnRE.test(key) && isFunction(value)) {
9789
+ if (key in el && isNativeOn(key) && isFunction(value)) {
9588
9790
  return true;
9589
9791
  }
9590
9792
  return false;
@@ -9601,7 +9803,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
9601
9803
  if (key === "type" && el.tagName === "TEXTAREA") {
9602
9804
  return false;
9603
9805
  }
9604
- if (nativeOnRE.test(key) && isString(value)) {
9806
+ if (key === "width" || key === "height") {
9807
+ const tag = el.tagName;
9808
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
9809
+ return false;
9810
+ }
9811
+ }
9812
+ if (isNativeOn(key) && isString(value)) {
9605
9813
  return false;
9606
9814
  }
9607
9815
  return key in el;
@@ -10243,14 +10451,14 @@ const modifierGuards = {
10243
10451
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
10244
10452
  };
10245
10453
  const withModifiers = (fn, modifiers) => {
10246
- return (event, ...args) => {
10454
+ return fn._withMods || (fn._withMods = (event, ...args) => {
10247
10455
  for (let i = 0; i < modifiers.length; i++) {
10248
10456
  const guard = modifierGuards[modifiers[i]];
10249
10457
  if (guard && guard(event, modifiers))
10250
10458
  return;
10251
10459
  }
10252
10460
  return fn(event, ...args);
10253
- };
10461
+ });
10254
10462
  };
10255
10463
  const keyNames = {
10256
10464
  esc: "escape",
@@ -10272,7 +10480,7 @@ const withKeys = (fn, modifiers) => {
10272
10480
  }
10273
10481
  }
10274
10482
  }
10275
- return (event) => {
10483
+ return fn._withKeys || (fn._withKeys = (event) => {
10276
10484
  if (!("key" in event)) {
10277
10485
  return;
10278
10486
  }
@@ -10300,7 +10508,7 @@ const withKeys = (fn, modifiers) => {
10300
10508
  }
10301
10509
  }
10302
10510
  }
10303
- };
10511
+ });
10304
10512
  };
10305
10513
 
10306
10514
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -10332,7 +10540,7 @@ const createApp = (...args) => {
10332
10540
  component.template = container.innerHTML;
10333
10541
  }
10334
10542
  container.innerHTML = "";
10335
- const proxy = mount(container, false, container instanceof SVGElement);
10543
+ const proxy = mount(container, false, resolveRootNamespace(container));
10336
10544
  if (container instanceof Element) {
10337
10545
  container.removeAttribute("v-cloak");
10338
10546
  container.setAttribute("data-v-app", "");
@@ -10347,11 +10555,19 @@ const createSSRApp = (...args) => {
10347
10555
  app.mount = (containerOrSelector) => {
10348
10556
  const container = normalizeContainer(containerOrSelector);
10349
10557
  if (container) {
10350
- return mount(container, true, container instanceof SVGElement);
10558
+ return mount(container, true, resolveRootNamespace(container));
10351
10559
  }
10352
10560
  };
10353
10561
  return app;
10354
10562
  };
10563
+ function resolveRootNamespace(container) {
10564
+ if (container instanceof SVGElement) {
10565
+ return "svg";
10566
+ }
10567
+ if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
10568
+ return "mathml";
10569
+ }
10570
+ }
10355
10571
  function normalizeContainer(container) {
10356
10572
  if (isString(container)) {
10357
10573
  const res = document.querySelector(container);
@@ -10373,7 +10589,9 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10373
10589
  BaseTransition: BaseTransition,
10374
10590
  BaseTransitionPropsValidators: BaseTransitionPropsValidators,
10375
10591
  Comment: Comment,
10592
+ DeprecationTypes: DeprecationTypes,
10376
10593
  EffectScope: EffectScope,
10594
+ ErrorCodes: ErrorCodes,
10377
10595
  ErrorTypeStrings: ErrorTypeStrings,
10378
10596
  Fragment: Fragment,
10379
10597
  KeepAlive: KeepAlive,
@@ -10382,8 +10600,10 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10382
10600
  Suspense: Suspense,
10383
10601
  Teleport: Teleport,
10384
10602
  Text: Text,
10603
+ TrackOpTypes: TrackOpTypes,
10385
10604
  Transition: Transition,
10386
10605
  TransitionGroup: TransitionGroup,
10606
+ TriggerOpTypes: TriggerOpTypes,
10387
10607
  VueElement: VueElement,
10388
10608
  assertNumber: assertNumber,
10389
10609
  callWithAsyncErrorHandling: callWithAsyncErrorHandling,
@@ -10840,7 +11060,9 @@ class Tokenizer {
10840
11060
  this.inRCDATA = false;
10841
11061
  /** For disabling RCDATA tags handling */
10842
11062
  this.inXML = false;
10843
- /** Reocrd newline positions for fast line / column calculation */
11063
+ /** For disabling interpolation parsing in v-pre */
11064
+ this.inVPre = false;
11065
+ /** Record newline positions for fast line / column calculation */
10844
11066
  this.newlines = [];
10845
11067
  this.mode = 0;
10846
11068
  this.delimiterOpen = defaultDelimitersOpen;
@@ -10865,6 +11087,7 @@ class Tokenizer {
10865
11087
  this.sectionStart = 0;
10866
11088
  this.index = 0;
10867
11089
  this.baseState = 1;
11090
+ this.inRCDATA = false;
10868
11091
  this.currentSequence = void 0;
10869
11092
  this.newlines.length = 0;
10870
11093
  this.delimiterOpen = defaultDelimitersOpen;
@@ -10905,7 +11128,7 @@ class Tokenizer {
10905
11128
  this.sectionStart = this.index;
10906
11129
  } else if (c === 38) {
10907
11130
  this.startEntity();
10908
- } else if (c === this.delimiterOpen[0]) {
11131
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
10909
11132
  this.state = 2;
10910
11133
  this.delimiterIndex = 0;
10911
11134
  this.stateInterpolationOpen(c);
@@ -11723,59 +11946,320 @@ const errorMessages = {
11723
11946
  Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
11724
11947
  [45]: `Error parsing JavaScript expression: `,
11725
11948
  [46]: `<KeepAlive> expects exactly one child component.`,
11949
+ [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.`,
11726
11950
  // generic errors
11727
11951
  [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
11728
11952
  [48]: `ES module mode is not supported in this build of compiler.`,
11729
11953
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
11730
11954
  [50]: `"scopeId" option is only supported in module mode.`,
11731
- // deprecations
11732
- [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.`,
11733
- [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
11734
11955
  // just to fulfill types
11735
- [53]: ``
11956
+ [52]: ``
11736
11957
  };
11737
11958
 
11738
- const isStaticExp = (p) => p.type === 4 && p.isStatic;
11739
- function isCoreComponent(tag) {
11740
- switch (tag) {
11741
- case "Teleport":
11742
- case "teleport":
11743
- return TELEPORT;
11744
- case "Suspense":
11745
- case "suspense":
11746
- return SUSPENSE;
11747
- case "KeepAlive":
11748
- case "keep-alive":
11749
- return KEEP_ALIVE;
11750
- case "BaseTransition":
11751
- case "base-transition":
11752
- return BASE_TRANSITION;
11753
- }
11754
- }
11755
- const nonIdentifierRE = /^\d|[^\$\w]/;
11756
- const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
11757
- const isMemberExpressionNode = (path, context) => {
11758
- try {
11759
- let ret = parser.parseExpression(path, {
11760
- plugins: context.expressionPlugins
11761
- });
11762
- if (ret.type === "TSAsExpression" || ret.type === "TSTypeAssertion") {
11763
- ret = ret.expression;
11764
- }
11765
- return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier";
11766
- } catch (e) {
11767
- return false;
11768
- }
11769
- };
11770
- const isMemberExpression = isMemberExpressionNode;
11771
- function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
11772
- return advancePositionWithMutation(
11773
- {
11774
- offset: pos.offset,
11775
- line: pos.line,
11776
- column: pos.column
11959
+ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
11960
+ const rootExp = root.type === "Program" ? root.body[0].type === "ExpressionStatement" && root.body[0].expression : root;
11961
+ estreeWalker.walk(root, {
11962
+ enter(node, parent) {
11963
+ parent && parentStack.push(parent);
11964
+ if (parent && parent.type.startsWith("TS") && !TS_NODE_TYPES.includes(parent.type)) {
11965
+ return this.skip();
11966
+ }
11967
+ if (node.type === "Identifier") {
11968
+ const isLocal = !!knownIds[node.name];
11969
+ const isRefed = isReferencedIdentifier(node, parent, parentStack);
11970
+ if (includeAll || isRefed && !isLocal) {
11971
+ onIdentifier(node, parent, parentStack, isRefed, isLocal);
11972
+ }
11973
+ } else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
11974
+ node.inPattern = true;
11975
+ } else if (isFunctionType(node)) {
11976
+ walkFunctionParams(node, (id) => markScopeIdentifier(node, id, knownIds));
11977
+ } else if (node.type === "BlockStatement") {
11978
+ walkBlockDeclarations(
11979
+ node,
11980
+ (id) => markScopeIdentifier(node, id, knownIds)
11981
+ );
11982
+ }
11777
11983
  },
11778
- source,
11984
+ leave(node, parent) {
11985
+ parent && parentStack.pop();
11986
+ if (node !== rootExp && node.scopeIds) {
11987
+ for (const id of node.scopeIds) {
11988
+ knownIds[id]--;
11989
+ if (knownIds[id] === 0) {
11990
+ delete knownIds[id];
11991
+ }
11992
+ }
11993
+ }
11994
+ }
11995
+ });
11996
+ }
11997
+ function isReferencedIdentifier(id, parent, parentStack) {
11998
+ if (!parent) {
11999
+ return true;
12000
+ }
12001
+ if (id.name === "arguments") {
12002
+ return false;
12003
+ }
12004
+ if (isReferenced(id, parent)) {
12005
+ return true;
12006
+ }
12007
+ switch (parent.type) {
12008
+ case "AssignmentExpression":
12009
+ case "AssignmentPattern":
12010
+ return true;
12011
+ case "ObjectPattern":
12012
+ case "ArrayPattern":
12013
+ return isInDestructureAssignment(parent, parentStack);
12014
+ }
12015
+ return false;
12016
+ }
12017
+ function isInDestructureAssignment(parent, parentStack) {
12018
+ if (parent && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
12019
+ let i = parentStack.length;
12020
+ while (i--) {
12021
+ const p = parentStack[i];
12022
+ if (p.type === "AssignmentExpression") {
12023
+ return true;
12024
+ } else if (p.type !== "ObjectProperty" && !p.type.endsWith("Pattern")) {
12025
+ break;
12026
+ }
12027
+ }
12028
+ }
12029
+ return false;
12030
+ }
12031
+ function walkFunctionParams(node, onIdent) {
12032
+ for (const p of node.params) {
12033
+ for (const id of extractIdentifiers(p)) {
12034
+ onIdent(id);
12035
+ }
12036
+ }
12037
+ }
12038
+ function walkBlockDeclarations(block, onIdent) {
12039
+ for (const stmt of block.body) {
12040
+ if (stmt.type === "VariableDeclaration") {
12041
+ if (stmt.declare)
12042
+ continue;
12043
+ for (const decl of stmt.declarations) {
12044
+ for (const id of extractIdentifiers(decl.id)) {
12045
+ onIdent(id);
12046
+ }
12047
+ }
12048
+ } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
12049
+ if (stmt.declare || !stmt.id)
12050
+ continue;
12051
+ onIdent(stmt.id);
12052
+ } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
12053
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
12054
+ if (variable && variable.type === "VariableDeclaration") {
12055
+ for (const decl of variable.declarations) {
12056
+ for (const id of extractIdentifiers(decl.id)) {
12057
+ onIdent(id);
12058
+ }
12059
+ }
12060
+ }
12061
+ }
12062
+ }
12063
+ }
12064
+ function extractIdentifiers(param, nodes = []) {
12065
+ switch (param.type) {
12066
+ case "Identifier":
12067
+ nodes.push(param);
12068
+ break;
12069
+ case "MemberExpression":
12070
+ let object = param;
12071
+ while (object.type === "MemberExpression") {
12072
+ object = object.object;
12073
+ }
12074
+ nodes.push(object);
12075
+ break;
12076
+ case "ObjectPattern":
12077
+ for (const prop of param.properties) {
12078
+ if (prop.type === "RestElement") {
12079
+ extractIdentifiers(prop.argument, nodes);
12080
+ } else {
12081
+ extractIdentifiers(prop.value, nodes);
12082
+ }
12083
+ }
12084
+ break;
12085
+ case "ArrayPattern":
12086
+ param.elements.forEach((element) => {
12087
+ if (element)
12088
+ extractIdentifiers(element, nodes);
12089
+ });
12090
+ break;
12091
+ case "RestElement":
12092
+ extractIdentifiers(param.argument, nodes);
12093
+ break;
12094
+ case "AssignmentPattern":
12095
+ extractIdentifiers(param.left, nodes);
12096
+ break;
12097
+ }
12098
+ return nodes;
12099
+ }
12100
+ function markScopeIdentifier(node, child, knownIds) {
12101
+ const { name } = child;
12102
+ if (node.scopeIds && node.scopeIds.has(name)) {
12103
+ return;
12104
+ }
12105
+ if (name in knownIds) {
12106
+ knownIds[name]++;
12107
+ } else {
12108
+ knownIds[name] = 1;
12109
+ }
12110
+ (node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
12111
+ }
12112
+ const isFunctionType = (node) => {
12113
+ return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
12114
+ };
12115
+ const isStaticProperty = (node) => node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed;
12116
+ const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
12117
+ function isReferenced(node, parent, grandparent) {
12118
+ switch (parent.type) {
12119
+ case "MemberExpression":
12120
+ case "OptionalMemberExpression":
12121
+ if (parent.property === node) {
12122
+ return !!parent.computed;
12123
+ }
12124
+ return parent.object === node;
12125
+ case "JSXMemberExpression":
12126
+ return parent.object === node;
12127
+ case "VariableDeclarator":
12128
+ return parent.init === node;
12129
+ case "ArrowFunctionExpression":
12130
+ return parent.body === node;
12131
+ case "PrivateName":
12132
+ return false;
12133
+ case "ClassMethod":
12134
+ case "ClassPrivateMethod":
12135
+ case "ObjectMethod":
12136
+ if (parent.key === node) {
12137
+ return !!parent.computed;
12138
+ }
12139
+ return false;
12140
+ case "ObjectProperty":
12141
+ if (parent.key === node) {
12142
+ return !!parent.computed;
12143
+ }
12144
+ return !grandparent || grandparent.type !== "ObjectPattern";
12145
+ case "ClassProperty":
12146
+ if (parent.key === node) {
12147
+ return !!parent.computed;
12148
+ }
12149
+ return true;
12150
+ case "ClassPrivateProperty":
12151
+ return parent.key !== node;
12152
+ case "ClassDeclaration":
12153
+ case "ClassExpression":
12154
+ return parent.superClass === node;
12155
+ case "AssignmentExpression":
12156
+ return parent.right === node;
12157
+ case "AssignmentPattern":
12158
+ return parent.right === node;
12159
+ case "LabeledStatement":
12160
+ return false;
12161
+ case "CatchClause":
12162
+ return false;
12163
+ case "RestElement":
12164
+ return false;
12165
+ case "BreakStatement":
12166
+ case "ContinueStatement":
12167
+ return false;
12168
+ case "FunctionDeclaration":
12169
+ case "FunctionExpression":
12170
+ return false;
12171
+ case "ExportNamespaceSpecifier":
12172
+ case "ExportDefaultSpecifier":
12173
+ return false;
12174
+ case "ExportSpecifier":
12175
+ if (grandparent == null ? void 0 : grandparent.source) {
12176
+ return false;
12177
+ }
12178
+ return parent.local === node;
12179
+ case "ImportDefaultSpecifier":
12180
+ case "ImportNamespaceSpecifier":
12181
+ case "ImportSpecifier":
12182
+ return false;
12183
+ case "ImportAttribute":
12184
+ return false;
12185
+ case "JSXAttribute":
12186
+ return false;
12187
+ case "ObjectPattern":
12188
+ case "ArrayPattern":
12189
+ return false;
12190
+ case "MetaProperty":
12191
+ return false;
12192
+ case "ObjectTypeProperty":
12193
+ return parent.key !== node;
12194
+ case "TSEnumMember":
12195
+ return parent.id !== node;
12196
+ case "TSPropertySignature":
12197
+ if (parent.key === node) {
12198
+ return !!parent.computed;
12199
+ }
12200
+ return true;
12201
+ }
12202
+ return true;
12203
+ }
12204
+ const TS_NODE_TYPES = [
12205
+ "TSAsExpression",
12206
+ // foo as number
12207
+ "TSTypeAssertion",
12208
+ // (<number>foo)
12209
+ "TSNonNullExpression",
12210
+ // foo!
12211
+ "TSInstantiationExpression",
12212
+ // foo<string>
12213
+ "TSSatisfiesExpression"
12214
+ // foo satisfies T
12215
+ ];
12216
+ function unwrapTSNode(node) {
12217
+ if (TS_NODE_TYPES.includes(node.type)) {
12218
+ return unwrapTSNode(node.expression);
12219
+ } else {
12220
+ return node;
12221
+ }
12222
+ }
12223
+
12224
+ const isStaticExp = (p) => p.type === 4 && p.isStatic;
12225
+ function isCoreComponent(tag) {
12226
+ switch (tag) {
12227
+ case "Teleport":
12228
+ case "teleport":
12229
+ return TELEPORT;
12230
+ case "Suspense":
12231
+ case "suspense":
12232
+ return SUSPENSE;
12233
+ case "KeepAlive":
12234
+ case "keep-alive":
12235
+ return KEEP_ALIVE;
12236
+ case "BaseTransition":
12237
+ case "base-transition":
12238
+ return BASE_TRANSITION;
12239
+ }
12240
+ }
12241
+ const nonIdentifierRE = /^\d|[^\$\w]/;
12242
+ const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
12243
+ const isMemberExpressionNode = (path, context) => {
12244
+ try {
12245
+ let ret = parser.parseExpression(path, {
12246
+ plugins: context.expressionPlugins
12247
+ });
12248
+ ret = unwrapTSNode(ret);
12249
+ return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier";
12250
+ } catch (e) {
12251
+ return false;
12252
+ }
12253
+ };
12254
+ const isMemberExpression = isMemberExpressionNode;
12255
+ function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
12256
+ return advancePositionWithMutation(
12257
+ {
12258
+ offset: pos.offset,
12259
+ line: pos.line,
12260
+ column: pos.column
12261
+ },
12262
+ source,
11779
12263
  numberOfCharacters
11780
12264
  );
11781
12265
  }
@@ -11982,7 +12466,8 @@ const defaultParserOptions = {
11982
12466
  isCustomElement: NO,
11983
12467
  onError: defaultOnError,
11984
12468
  onWarn: defaultOnWarn,
11985
- comments: false
12469
+ comments: false,
12470
+ prefixIdentifiers: false
11986
12471
  };
11987
12472
  let currentOptions = defaultParserOptions;
11988
12473
  let currentRoot = null;
@@ -12024,7 +12509,7 @@ const tokenizer = new Tokenizer(stack, {
12024
12509
  }
12025
12510
  addNode({
12026
12511
  type: 5,
12027
- content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
12512
+ content: createExp(exp, false, getLoc(innerStart, innerEnd)),
12028
12513
  loc: getLoc(start, end)
12029
12514
  });
12030
12515
  },
@@ -12117,7 +12602,7 @@ const tokenizer = new Tokenizer(stack, {
12117
12602
  loc: getLoc(start)
12118
12603
  };
12119
12604
  if (name === "pre") {
12120
- inVPre = true;
12605
+ inVPre = tokenizer.inVPre = true;
12121
12606
  currentVPreBoundary = currentOpenTag;
12122
12607
  const props = currentOpenTag.props;
12123
12608
  for (let i = 0; i < props.length; i++) {
@@ -12137,7 +12622,7 @@ const tokenizer = new Tokenizer(stack, {
12137
12622
  setLocEnd(currentProp.nameLoc, end);
12138
12623
  } else {
12139
12624
  const isStatic = arg[0] !== `[`;
12140
- currentProp.arg = createSimpleExpression(
12625
+ currentProp.arg = createExp(
12141
12626
  isStatic ? arg : arg.slice(1, -1),
12142
12627
  isStatic,
12143
12628
  getLoc(start, end),
@@ -12204,10 +12689,22 @@ const tokenizer = new Tokenizer(stack, {
12204
12689
  tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
12205
12690
  }
12206
12691
  } else {
12207
- currentProp.exp = createSimpleExpression(
12692
+ let expParseMode = 0 /* Normal */;
12693
+ {
12694
+ if (currentProp.name === "for") {
12695
+ expParseMode = 3 /* Skip */;
12696
+ } else if (currentProp.name === "slot") {
12697
+ expParseMode = 1 /* Params */;
12698
+ } else if (currentProp.name === "on" && currentAttrValue.includes(";")) {
12699
+ expParseMode = 2 /* Statements */;
12700
+ }
12701
+ }
12702
+ currentProp.exp = createExp(
12208
12703
  currentAttrValue,
12209
12704
  false,
12210
- getLoc(currentAttrStartIndex, currentAttrEndIndex)
12705
+ getLoc(currentAttrStartIndex, currentAttrEndIndex),
12706
+ 0,
12707
+ expParseMode
12211
12708
  );
12212
12709
  if (currentProp.name === "for") {
12213
12710
  currentProp.forParseResult = parseForExpression(currentProp.exp);
@@ -12310,10 +12807,16 @@ function parseForExpression(input) {
12310
12807
  if (!inMatch)
12311
12808
  return;
12312
12809
  const [, LHS, RHS] = inMatch;
12313
- const createAliasExpression = (content, offset) => {
12810
+ const createAliasExpression = (content, offset, asParam = false) => {
12314
12811
  const start = loc.start.offset + offset;
12315
12812
  const end = start + content.length;
12316
- return createSimpleExpression(content, false, getLoc(start, end));
12813
+ return createExp(
12814
+ content,
12815
+ false,
12816
+ getLoc(start, end),
12817
+ 0,
12818
+ asParam ? 1 /* Params */ : 0 /* Normal */
12819
+ );
12317
12820
  };
12318
12821
  const result = {
12319
12822
  source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
@@ -12331,7 +12834,7 @@ function parseForExpression(input) {
12331
12834
  let keyOffset;
12332
12835
  if (keyContent) {
12333
12836
  keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
12334
- result.key = createAliasExpression(keyContent, keyOffset);
12837
+ result.key = createAliasExpression(keyContent, keyOffset, true);
12335
12838
  }
12336
12839
  if (iteratorMatch[2]) {
12337
12840
  const indexContent = iteratorMatch[2].trim();
@@ -12341,13 +12844,14 @@ function parseForExpression(input) {
12341
12844
  exp.indexOf(
12342
12845
  indexContent,
12343
12846
  result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
12344
- )
12847
+ ),
12848
+ true
12345
12849
  );
12346
12850
  }
12347
12851
  }
12348
12852
  }
12349
12853
  if (valueContent) {
12350
- result.value = createAliasExpression(valueContent, trimmedOffset);
12854
+ result.value = createAliasExpression(valueContent, trimmedOffset, true);
12351
12855
  }
12352
12856
  return result;
12353
12857
  }
@@ -12418,7 +12922,7 @@ function onCloseTag(el, end, isImplied = false) {
12418
12922
  inPre--;
12419
12923
  }
12420
12924
  if (currentVPreBoundary === el) {
12421
- inVPre = false;
12925
+ inVPre = tokenizer.inVPre = false;
12422
12926
  currentVPreBoundary = null;
12423
12927
  }
12424
12928
  if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
@@ -12623,8 +13127,36 @@ function dirToAttr(dir) {
12623
13127
  }
12624
13128
  return attr;
12625
13129
  }
12626
- function emitError(code, index) {
12627
- currentOptions.onError(createCompilerError(code, getLoc(index, index)));
13130
+ function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
13131
+ const exp = createSimpleExpression(content, isStatic, loc, constType);
13132
+ if (!isStatic && currentOptions.prefixIdentifiers && parseMode !== 3 /* Skip */ && content.trim()) {
13133
+ if (isSimpleIdentifier(content)) {
13134
+ exp.ast = null;
13135
+ return exp;
13136
+ }
13137
+ try {
13138
+ const plugins = currentOptions.expressionPlugins;
13139
+ const options = {
13140
+ plugins: plugins ? [...plugins, "typescript"] : ["typescript"]
13141
+ };
13142
+ if (parseMode === 2 /* Statements */) {
13143
+ exp.ast = parser.parse(` ${content} `, options).program;
13144
+ } else if (parseMode === 1 /* Params */) {
13145
+ exp.ast = parser.parseExpression(`(${content})=>{}`, options);
13146
+ } else {
13147
+ exp.ast = parser.parseExpression(`(${content})`, options);
13148
+ }
13149
+ } catch (e) {
13150
+ exp.ast = false;
13151
+ emitError(45, loc.start.offset, e.message);
13152
+ }
13153
+ }
13154
+ return exp;
13155
+ }
13156
+ function emitError(code, index, message) {
13157
+ currentOptions.onError(
13158
+ createCompilerError(code, getLoc(index, index), void 0, message)
13159
+ );
12628
13160
  }
12629
13161
  function reset() {
12630
13162
  tokenizer.reset();
@@ -12648,6 +13180,7 @@ function baseParse(input, options) {
12648
13180
  }
12649
13181
  }
12650
13182
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
13183
+ tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
12651
13184
  const delimiters = options == null ? void 0 : options.delimiters;
12652
13185
  if (delimiters) {
12653
13186
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
@@ -12932,6 +13465,7 @@ function createTransformContext(root, {
12932
13465
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
12933
13466
  const context = {
12934
13467
  // options
13468
+ filename,
12935
13469
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
12936
13470
  prefixIdentifiers,
12937
13471
  hoistStatic: hoistStatic2,
@@ -13903,334 +14437,76 @@ function genCacheExpression(node, context) {
13903
14437
  genNode(node.value, context);
13904
14438
  if (node.isVNode) {
13905
14439
  push(`,`);
13906
- newline();
13907
- push(`${helper(SET_BLOCK_TRACKING)}(1),`);
13908
- newline();
13909
- push(`_cache[${node.index}]`);
13910
- deindent();
13911
- }
13912
- push(`)`);
13913
- }
13914
- function genTemplateLiteral(node, context) {
13915
- const { push, indent, deindent } = context;
13916
- push("`");
13917
- const l = node.elements.length;
13918
- const multilines = l > 3;
13919
- for (let i = 0; i < l; i++) {
13920
- const e = node.elements[i];
13921
- if (isString(e)) {
13922
- push(e.replace(/(`|\$|\\)/g, "\\$1"), -3 /* Unknown */);
13923
- } else {
13924
- push("${");
13925
- if (multilines)
13926
- indent();
13927
- genNode(e, context);
13928
- if (multilines)
13929
- deindent();
13930
- push("}");
13931
- }
13932
- }
13933
- push("`");
13934
- }
13935
- function genIfStatement(node, context) {
13936
- const { push, indent, deindent } = context;
13937
- const { test, consequent, alternate } = node;
13938
- push(`if (`);
13939
- genNode(test, context);
13940
- push(`) {`);
13941
- indent();
13942
- genNode(consequent, context);
13943
- deindent();
13944
- push(`}`);
13945
- if (alternate) {
13946
- push(` else `);
13947
- if (alternate.type === 23) {
13948
- genIfStatement(alternate, context);
13949
- } else {
13950
- push(`{`);
13951
- indent();
13952
- genNode(alternate, context);
13953
- deindent();
13954
- push(`}`);
13955
- }
13956
- }
13957
- }
13958
- function genAssignmentExpression(node, context) {
13959
- genNode(node.left, context);
13960
- context.push(` = `);
13961
- genNode(node.right, context);
13962
- }
13963
- function genSequenceExpression(node, context) {
13964
- context.push(`(`);
13965
- genNodeList(node.expressions, context);
13966
- context.push(`)`);
13967
- }
13968
- function genReturnStatement({ returns }, context) {
13969
- context.push(`return `);
13970
- if (isArray(returns)) {
13971
- genNodeListAsArray(returns, context);
13972
- } else {
13973
- genNode(returns, context);
13974
- }
13975
- }
13976
-
13977
- function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
13978
- const rootExp = root.type === "Program" && root.body[0].type === "ExpressionStatement" && root.body[0].expression;
13979
- estreeWalker.walk(root, {
13980
- enter(node, parent) {
13981
- parent && parentStack.push(parent);
13982
- if (parent && parent.type.startsWith("TS") && !TS_NODE_TYPES.includes(parent.type)) {
13983
- return this.skip();
13984
- }
13985
- if (node.type === "Identifier") {
13986
- const isLocal = !!knownIds[node.name];
13987
- const isRefed = isReferencedIdentifier(node, parent, parentStack);
13988
- if (includeAll || isRefed && !isLocal) {
13989
- onIdentifier(node, parent, parentStack, isRefed, isLocal);
13990
- }
13991
- } else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
13992
- node.inPattern = true;
13993
- } else if (isFunctionType(node)) {
13994
- walkFunctionParams(node, (id) => markScopeIdentifier(node, id, knownIds));
13995
- } else if (node.type === "BlockStatement") {
13996
- walkBlockDeclarations(
13997
- node,
13998
- (id) => markScopeIdentifier(node, id, knownIds)
13999
- );
14000
- }
14001
- },
14002
- leave(node, parent) {
14003
- parent && parentStack.pop();
14004
- if (node !== rootExp && node.scopeIds) {
14005
- for (const id of node.scopeIds) {
14006
- knownIds[id]--;
14007
- if (knownIds[id] === 0) {
14008
- delete knownIds[id];
14009
- }
14010
- }
14011
- }
14012
- }
14013
- });
14014
- }
14015
- function isReferencedIdentifier(id, parent, parentStack) {
14016
- if (!parent) {
14017
- return true;
14018
- }
14019
- if (id.name === "arguments") {
14020
- return false;
14021
- }
14022
- if (isReferenced(id, parent)) {
14023
- return true;
14024
- }
14025
- switch (parent.type) {
14026
- case "AssignmentExpression":
14027
- case "AssignmentPattern":
14028
- return true;
14029
- case "ObjectPattern":
14030
- case "ArrayPattern":
14031
- return isInDestructureAssignment(parent, parentStack);
14032
- }
14033
- return false;
14034
- }
14035
- function isInDestructureAssignment(parent, parentStack) {
14036
- if (parent && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
14037
- let i = parentStack.length;
14038
- while (i--) {
14039
- const p = parentStack[i];
14040
- if (p.type === "AssignmentExpression") {
14041
- return true;
14042
- } else if (p.type !== "ObjectProperty" && !p.type.endsWith("Pattern")) {
14043
- break;
14044
- }
14045
- }
14440
+ newline();
14441
+ push(`${helper(SET_BLOCK_TRACKING)}(1),`);
14442
+ newline();
14443
+ push(`_cache[${node.index}]`);
14444
+ deindent();
14046
14445
  }
14047
- return false;
14446
+ push(`)`);
14048
14447
  }
14049
- function walkFunctionParams(node, onIdent) {
14050
- for (const p of node.params) {
14051
- for (const id of extractIdentifiers(p)) {
14052
- onIdent(id);
14448
+ function genTemplateLiteral(node, context) {
14449
+ const { push, indent, deindent } = context;
14450
+ push("`");
14451
+ const l = node.elements.length;
14452
+ const multilines = l > 3;
14453
+ for (let i = 0; i < l; i++) {
14454
+ const e = node.elements[i];
14455
+ if (isString(e)) {
14456
+ push(e.replace(/(`|\$|\\)/g, "\\$1"), -3 /* Unknown */);
14457
+ } else {
14458
+ push("${");
14459
+ if (multilines)
14460
+ indent();
14461
+ genNode(e, context);
14462
+ if (multilines)
14463
+ deindent();
14464
+ push("}");
14053
14465
  }
14054
14466
  }
14467
+ push("`");
14055
14468
  }
14056
- function walkBlockDeclarations(block, onIdent) {
14057
- for (const stmt of block.body) {
14058
- if (stmt.type === "VariableDeclaration") {
14059
- if (stmt.declare)
14060
- continue;
14061
- for (const decl of stmt.declarations) {
14062
- for (const id of extractIdentifiers(decl.id)) {
14063
- onIdent(id);
14064
- }
14065
- }
14066
- } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
14067
- if (stmt.declare || !stmt.id)
14068
- continue;
14069
- onIdent(stmt.id);
14070
- } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
14071
- const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
14072
- if (variable && variable.type === "VariableDeclaration") {
14073
- for (const decl of variable.declarations) {
14074
- for (const id of extractIdentifiers(decl.id)) {
14075
- onIdent(id);
14076
- }
14077
- }
14078
- }
14469
+ function genIfStatement(node, context) {
14470
+ const { push, indent, deindent } = context;
14471
+ const { test, consequent, alternate } = node;
14472
+ push(`if (`);
14473
+ genNode(test, context);
14474
+ push(`) {`);
14475
+ indent();
14476
+ genNode(consequent, context);
14477
+ deindent();
14478
+ push(`}`);
14479
+ if (alternate) {
14480
+ push(` else `);
14481
+ if (alternate.type === 23) {
14482
+ genIfStatement(alternate, context);
14483
+ } else {
14484
+ push(`{`);
14485
+ indent();
14486
+ genNode(alternate, context);
14487
+ deindent();
14488
+ push(`}`);
14079
14489
  }
14080
14490
  }
14081
14491
  }
14082
- function extractIdentifiers(param, nodes = []) {
14083
- switch (param.type) {
14084
- case "Identifier":
14085
- nodes.push(param);
14086
- break;
14087
- case "MemberExpression":
14088
- let object = param;
14089
- while (object.type === "MemberExpression") {
14090
- object = object.object;
14091
- }
14092
- nodes.push(object);
14093
- break;
14094
- case "ObjectPattern":
14095
- for (const prop of param.properties) {
14096
- if (prop.type === "RestElement") {
14097
- extractIdentifiers(prop.argument, nodes);
14098
- } else {
14099
- extractIdentifiers(prop.value, nodes);
14100
- }
14101
- }
14102
- break;
14103
- case "ArrayPattern":
14104
- param.elements.forEach((element) => {
14105
- if (element)
14106
- extractIdentifiers(element, nodes);
14107
- });
14108
- break;
14109
- case "RestElement":
14110
- extractIdentifiers(param.argument, nodes);
14111
- break;
14112
- case "AssignmentPattern":
14113
- extractIdentifiers(param.left, nodes);
14114
- break;
14115
- }
14116
- return nodes;
14492
+ function genAssignmentExpression(node, context) {
14493
+ genNode(node.left, context);
14494
+ context.push(` = `);
14495
+ genNode(node.right, context);
14117
14496
  }
14118
- function markScopeIdentifier(node, child, knownIds) {
14119
- const { name } = child;
14120
- if (node.scopeIds && node.scopeIds.has(name)) {
14121
- return;
14122
- }
14123
- if (name in knownIds) {
14124
- knownIds[name]++;
14125
- } else {
14126
- knownIds[name] = 1;
14127
- }
14128
- (node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
14497
+ function genSequenceExpression(node, context) {
14498
+ context.push(`(`);
14499
+ genNodeList(node.expressions, context);
14500
+ context.push(`)`);
14129
14501
  }
14130
- const isFunctionType = (node) => {
14131
- return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
14132
- };
14133
- const isStaticProperty = (node) => node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed;
14134
- const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
14135
- function isReferenced(node, parent, grandparent) {
14136
- switch (parent.type) {
14137
- case "MemberExpression":
14138
- case "OptionalMemberExpression":
14139
- if (parent.property === node) {
14140
- return !!parent.computed;
14141
- }
14142
- return parent.object === node;
14143
- case "JSXMemberExpression":
14144
- return parent.object === node;
14145
- case "VariableDeclarator":
14146
- return parent.init === node;
14147
- case "ArrowFunctionExpression":
14148
- return parent.body === node;
14149
- case "PrivateName":
14150
- return false;
14151
- case "ClassMethod":
14152
- case "ClassPrivateMethod":
14153
- case "ObjectMethod":
14154
- if (parent.key === node) {
14155
- return !!parent.computed;
14156
- }
14157
- return false;
14158
- case "ObjectProperty":
14159
- if (parent.key === node) {
14160
- return !!parent.computed;
14161
- }
14162
- return !grandparent || grandparent.type !== "ObjectPattern";
14163
- case "ClassProperty":
14164
- if (parent.key === node) {
14165
- return !!parent.computed;
14166
- }
14167
- return true;
14168
- case "ClassPrivateProperty":
14169
- return parent.key !== node;
14170
- case "ClassDeclaration":
14171
- case "ClassExpression":
14172
- return parent.superClass === node;
14173
- case "AssignmentExpression":
14174
- return parent.right === node;
14175
- case "AssignmentPattern":
14176
- return parent.right === node;
14177
- case "LabeledStatement":
14178
- return false;
14179
- case "CatchClause":
14180
- return false;
14181
- case "RestElement":
14182
- return false;
14183
- case "BreakStatement":
14184
- case "ContinueStatement":
14185
- return false;
14186
- case "FunctionDeclaration":
14187
- case "FunctionExpression":
14188
- return false;
14189
- case "ExportNamespaceSpecifier":
14190
- case "ExportDefaultSpecifier":
14191
- return false;
14192
- case "ExportSpecifier":
14193
- if (grandparent == null ? void 0 : grandparent.source) {
14194
- return false;
14195
- }
14196
- return parent.local === node;
14197
- case "ImportDefaultSpecifier":
14198
- case "ImportNamespaceSpecifier":
14199
- case "ImportSpecifier":
14200
- return false;
14201
- case "ImportAttribute":
14202
- return false;
14203
- case "JSXAttribute":
14204
- return false;
14205
- case "ObjectPattern":
14206
- case "ArrayPattern":
14207
- return false;
14208
- case "MetaProperty":
14209
- return false;
14210
- case "ObjectTypeProperty":
14211
- return parent.key !== node;
14212
- case "TSEnumMember":
14213
- return parent.id !== node;
14214
- case "TSPropertySignature":
14215
- if (parent.key === node) {
14216
- return !!parent.computed;
14217
- }
14218
- return true;
14502
+ function genReturnStatement({ returns }, context) {
14503
+ context.push(`return `);
14504
+ if (isArray(returns)) {
14505
+ genNodeListAsArray(returns, context);
14506
+ } else {
14507
+ genNode(returns, context);
14219
14508
  }
14220
- return true;
14221
14509
  }
14222
- const TS_NODE_TYPES = [
14223
- "TSAsExpression",
14224
- // foo as number
14225
- "TSTypeAssertion",
14226
- // (<number>foo)
14227
- "TSNonNullExpression",
14228
- // foo!
14229
- "TSInstantiationExpression",
14230
- // foo<string>
14231
- "TSSatisfiesExpression"
14232
- // foo satisfies T
14233
- ];
14234
14510
 
14235
14511
  const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
14236
14512
  const constantBailRE = /\w\s*\(|\.[^\d]/;
@@ -14324,7 +14600,11 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
14324
14600
  };
14325
14601
  const rawExp = node.content;
14326
14602
  const bailConstant = constantBailRE.test(rawExp);
14327
- if (isSimpleIdentifier(rawExp)) {
14603
+ let ast = node.ast;
14604
+ if (ast === false) {
14605
+ return node;
14606
+ }
14607
+ if (ast === null || !ast && isSimpleIdentifier(rawExp)) {
14328
14608
  const isScopeVarReference = context.identifiers[rawExp];
14329
14609
  const isAllowedGlobal = isGloballyAllowed(rawExp);
14330
14610
  const isLiteral = isLiteralWhitelisted(rawExp);
@@ -14342,22 +14622,23 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
14342
14622
  }
14343
14623
  return node;
14344
14624
  }
14345
- let ast;
14346
- const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
14347
- try {
14348
- ast = parser.parse(source, {
14349
- plugins: context.expressionPlugins
14350
- }).program;
14351
- } catch (e) {
14352
- context.onError(
14353
- createCompilerError(
14354
- 45,
14355
- node.loc,
14356
- void 0,
14357
- e.message
14358
- )
14359
- );
14360
- return node;
14625
+ if (!ast) {
14626
+ const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
14627
+ try {
14628
+ ast = parser.parse(source, {
14629
+ plugins: context.expressionPlugins
14630
+ }).program;
14631
+ } catch (e) {
14632
+ context.onError(
14633
+ createCompilerError(
14634
+ 45,
14635
+ node.loc,
14636
+ void 0,
14637
+ e.message
14638
+ )
14639
+ );
14640
+ return node;
14641
+ }
14361
14642
  }
14362
14643
  const ids = [];
14363
14644
  const parentStack = [];
@@ -14400,15 +14681,15 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
14400
14681
  if (leadingText.length || id.prefix) {
14401
14682
  children.push(leadingText + (id.prefix || ``));
14402
14683
  }
14403
- const source2 = rawExp.slice(start, end);
14684
+ const source = rawExp.slice(start, end);
14404
14685
  children.push(
14405
14686
  createSimpleExpression(
14406
14687
  id.name,
14407
14688
  false,
14408
14689
  {
14409
- start: advancePositionWithClone(node.loc.start, source2, start),
14410
- end: advancePositionWithClone(node.loc.start, source2, end),
14411
- source: source2
14690
+ start: advancePositionWithClone(node.loc.start, source, start),
14691
+ end: advancePositionWithClone(node.loc.start, source, end),
14692
+ source
14412
14693
  },
14413
14694
  id.isConstant ? 3 : 0
14414
14695
  )
@@ -14420,6 +14701,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
14420
14701
  let ret;
14421
14702
  if (children.length) {
14422
14703
  ret = createCompoundExpression(children, node.loc);
14704
+ ret.ast = ast;
14423
14705
  } else {
14424
14706
  ret = node;
14425
14707
  ret.constType = bailConstant ? 0 : 3;
@@ -15354,6 +15636,10 @@ function resolveSetupReference(name, context) {
15354
15636
  `${context.helperString(UNREF)}(${fromMaybeRef})`
15355
15637
  ) : `$setup[${JSON.stringify(fromMaybeRef)}]`;
15356
15638
  }
15639
+ const fromProps = checkType("props");
15640
+ if (fromProps) {
15641
+ return `${context.helperString(UNREF)}(${context.inline ? "__props" : "$props"}[${JSON.stringify(fromProps)}])`;
15642
+ }
15357
15643
  }
15358
15644
  function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
15359
15645
  const { tag, loc: elementLoc, children } = node;
@@ -15394,6 +15680,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
15394
15680
  if (isEventHandler && isReservedProp(name)) {
15395
15681
  hasVnodeHook = true;
15396
15682
  }
15683
+ if (isEventHandler && value.type === 14) {
15684
+ value = value.arguments[0];
15685
+ }
15397
15686
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
15398
15687
  return;
15399
15688
  }
@@ -16371,7 +16660,10 @@ function baseCompile(source, options = {}) {
16371
16660
  if (options.scopeId && !isModuleMode) {
16372
16661
  onError(createCompilerError(50));
16373
16662
  }
16374
- const ast = isString(source) ? baseParse(source, options) : source;
16663
+ const resolvedOptions = extend({}, options, {
16664
+ prefixIdentifiers
16665
+ });
16666
+ const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
16375
16667
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
16376
16668
  if (options.isTS) {
16377
16669
  const { expressionPlugins } = options;
@@ -16381,8 +16673,7 @@ function baseCompile(source, options = {}) {
16381
16673
  }
16382
16674
  transform(
16383
16675
  ast,
16384
- extend({}, options, {
16385
- prefixIdentifiers,
16676
+ extend({}, resolvedOptions, {
16386
16677
  nodeTransforms: [
16387
16678
  ...nodeTransforms,
16388
16679
  ...options.nodeTransforms || []
@@ -16396,12 +16687,7 @@ function baseCompile(source, options = {}) {
16396
16687
  )
16397
16688
  })
16398
16689
  );
16399
- return generate(
16400
- ast,
16401
- extend({}, options, {
16402
- prefixIdentifiers
16403
- })
16404
- );
16690
+ return generate(ast, resolvedOptions);
16405
16691
  }
16406
16692
 
16407
16693
  const noopDirectiveTransform = () => ({ props: [] });
@@ -16432,7 +16718,7 @@ registerRuntimeHelpers({
16432
16718
  const parserOptions = {
16433
16719
  parseMode: "html",
16434
16720
  isVoidTag,
16435
- isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
16721
+ isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
16436
16722
  isPreTag: (tag) => tag === "pre",
16437
16723
  decodeEntities: void 0,
16438
16724
  isBuiltInComponent: (tag) => {