@vue/shared 3.6.0-beta.9 → 3.6.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared.cjs.js +176 -36
- package/dist/shared.cjs.prod.js +176 -36
- package/dist/shared.d.ts +296 -190
- package/dist/shared.esm-bundler.js +169 -37
- package/package.json +1 -1
package/dist/shared.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/shared v3.6.0-
|
|
2
|
+
* @vue/shared v3.6.0-rc.10
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -15,7 +15,7 @@ Object.defineProperties(exports, {
|
|
|
15
15
|
* \/\*#\_\_PURE\_\_\*\/
|
|
16
16
|
* So that they can be tree-shaken if necessary.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
19
19
|
function makeMap(str) {
|
|
20
20
|
const map = Object.create(null);
|
|
21
21
|
for (const key of str.split(",")) map[key] = 1;
|
|
@@ -63,9 +63,9 @@ const toRawType = (value) => {
|
|
|
63
63
|
};
|
|
64
64
|
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
65
65
|
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
66
|
-
const isReservedProp =
|
|
67
|
-
const isBuiltInTag =
|
|
68
|
-
const isBuiltInDirective =
|
|
66
|
+
const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
|
|
67
|
+
const isBuiltInTag = /*#__PURE__*/ makeMap("slot,component");
|
|
68
|
+
const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
|
|
69
69
|
const cacheStringFunction = (fn) => {
|
|
70
70
|
const cache = Object.create(null);
|
|
71
71
|
return ((str) => {
|
|
@@ -238,6 +238,8 @@ const ShapeFlags = {
|
|
|
238
238
|
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
|
|
239
239
|
"COMPONENT_KEPT_ALIVE": 512,
|
|
240
240
|
"512": "COMPONENT_KEPT_ALIVE",
|
|
241
|
+
"SLOT_FALLBACK": 1024,
|
|
242
|
+
"1024": "SLOT_FALLBACK",
|
|
241
243
|
"COMPONENT": 6,
|
|
242
244
|
"6": "COMPONENT"
|
|
243
245
|
};
|
|
@@ -259,7 +261,7 @@ const slotFlagsText = {
|
|
|
259
261
|
[2]: "DYNAMIC",
|
|
260
262
|
[3]: "FORWARDED"
|
|
261
263
|
};
|
|
262
|
-
const isGloballyAllowed =
|
|
264
|
+
const isGloballyAllowed = /*@__PURE__*/ makeMap("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,Symbol");
|
|
263
265
|
/** @deprecated use `isGloballyAllowed` instead */
|
|
264
266
|
const isGloballyWhitelisted = isGloballyAllowed;
|
|
265
267
|
//#endregion
|
|
@@ -315,10 +317,10 @@ function normalizeStyle(value) {
|
|
|
315
317
|
}
|
|
316
318
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
|
317
319
|
const propertyDelimiterRE = /:([^]+)/;
|
|
318
|
-
const styleCommentRE =
|
|
320
|
+
const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
|
|
319
321
|
function parseStringStyle(cssText) {
|
|
320
322
|
const ret = {};
|
|
321
|
-
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
|
323
|
+
cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
|
|
322
324
|
if (item) {
|
|
323
325
|
const tmp = item.split(propertyDelimiterRE);
|
|
324
326
|
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
|
@@ -365,49 +367,49 @@ const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,col
|
|
|
365
367
|
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
|
|
366
368
|
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
|
367
369
|
const FORMATTING_TAGS = "a,b,big,code,em,font,i,nobr,s,small,strike,strong,tt,u";
|
|
368
|
-
const ALWAYS_CLOSE_TAGS = "title,style,script,noscript,template,object,table,button,textarea,select,iframe,fieldset";
|
|
370
|
+
const ALWAYS_CLOSE_TAGS = "title,style,script,noscript,template,object,table,button,textarea,select,iframe,fieldset,form,foreignObject,desc,mi,mo,mn,ms,mtext,annotation-xml";
|
|
369
371
|
const INLINE_TAGS = "a,abbr,acronym,b,bdi,bdo,big,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,label,map,mark,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,small,span,strong,sub,sup,svg,textarea,time,u,tt,var,video";
|
|
370
372
|
const BLOCK_TAGS = "address,article,aside,blockquote,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,main,menu,nav,ol,p,pre,section,table,ul";
|
|
371
373
|
/**
|
|
372
374
|
* Compiler only.
|
|
373
375
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
374
376
|
*/
|
|
375
|
-
const isHTMLTag =
|
|
377
|
+
const isHTMLTag = /*@__PURE__*/ makeMap(HTML_TAGS);
|
|
376
378
|
/**
|
|
377
379
|
* Compiler only.
|
|
378
380
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
379
381
|
*/
|
|
380
|
-
const isSVGTag =
|
|
382
|
+
const isSVGTag = /*@__PURE__*/ makeMap(SVG_TAGS);
|
|
381
383
|
/**
|
|
382
384
|
* Compiler only.
|
|
383
385
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
384
386
|
*/
|
|
385
|
-
const isMathMLTag =
|
|
387
|
+
const isMathMLTag = /*@__PURE__*/ makeMap(MATH_TAGS);
|
|
386
388
|
/**
|
|
387
389
|
* Compiler only.
|
|
388
390
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
389
391
|
*/
|
|
390
|
-
const isVoidTag =
|
|
392
|
+
const isVoidTag = /*@__PURE__*/ makeMap(VOID_TAGS);
|
|
391
393
|
/**
|
|
392
394
|
* Compiler only.
|
|
393
395
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
394
396
|
*/
|
|
395
|
-
const isFormattingTag =
|
|
397
|
+
const isFormattingTag = /*@__PURE__*/ makeMap(FORMATTING_TAGS);
|
|
396
398
|
/**
|
|
397
399
|
* Compiler only.
|
|
398
400
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
399
401
|
*/
|
|
400
|
-
const isAlwaysCloseTag =
|
|
402
|
+
const isAlwaysCloseTag = /*@__PURE__*/ makeMap(ALWAYS_CLOSE_TAGS);
|
|
401
403
|
/**
|
|
402
404
|
* Compiler only.
|
|
403
405
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
404
406
|
*/
|
|
405
|
-
const isInlineTag =
|
|
407
|
+
const isInlineTag = /*@__PURE__*/ makeMap(INLINE_TAGS);
|
|
406
408
|
/**
|
|
407
409
|
* Compiler only.
|
|
408
410
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
409
411
|
*/
|
|
410
|
-
const isBlockTag =
|
|
412
|
+
const isBlockTag = /*@__PURE__*/ makeMap(BLOCK_TAGS);
|
|
411
413
|
//#endregion
|
|
412
414
|
//#region packages/shared/src/domAttrConfig.ts
|
|
413
415
|
/**
|
|
@@ -422,11 +424,11 @@ const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS);
|
|
|
422
424
|
* - readonly -> readOnly
|
|
423
425
|
*/
|
|
424
426
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
|
425
|
-
const isSpecialBooleanAttr =
|
|
427
|
+
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
|
|
426
428
|
/**
|
|
427
429
|
* The full list is needed during SSR to produce the correct initial markup.
|
|
428
430
|
*/
|
|
429
|
-
const isBooleanAttr =
|
|
431
|
+
const isBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
|
|
430
432
|
/**
|
|
431
433
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
432
434
|
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
@@ -434,7 +436,7 @@ const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,auto
|
|
|
434
436
|
function includeBooleanAttr(value) {
|
|
435
437
|
return !!value || value === "";
|
|
436
438
|
}
|
|
437
|
-
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
|
439
|
+
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\u0020]/;
|
|
438
440
|
const attrValidationCache = {};
|
|
439
441
|
function isSSRSafeAttrName(name) {
|
|
440
442
|
if (attrValidationCache.hasOwnProperty(name)) return attrValidationCache[name];
|
|
@@ -454,15 +456,15 @@ const propsToAttrMap = {
|
|
|
454
456
|
* Don't also forget to allow `data-*` and `aria-*`!
|
|
455
457
|
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
|
456
458
|
*/
|
|
457
|
-
const isKnownHtmlAttr =
|
|
459
|
+
const isKnownHtmlAttr = /*@__PURE__*/ makeMap("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");
|
|
458
460
|
/**
|
|
459
461
|
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
|
460
462
|
*/
|
|
461
|
-
const isKnownSvgAttr =
|
|
463
|
+
const isKnownSvgAttr = /*@__PURE__*/ makeMap("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");
|
|
462
464
|
/**
|
|
463
465
|
* Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute
|
|
464
466
|
*/
|
|
465
|
-
const isKnownMathMLAttr =
|
|
467
|
+
const isKnownMathMLAttr = /*@__PURE__*/ makeMap("accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns");
|
|
466
468
|
/**
|
|
467
469
|
* Shared between server-renderer and runtime-core hydration logic
|
|
468
470
|
*/
|
|
@@ -526,9 +528,14 @@ function escapeHtml(string) {
|
|
|
526
528
|
}
|
|
527
529
|
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
|
528
530
|
}
|
|
529
|
-
const commentStripRE =
|
|
531
|
+
const commentStripRE = /^(?:-?>)+|<!--|-->|--!>|<!-$/g;
|
|
530
532
|
function escapeHtmlComment(src) {
|
|
531
|
-
|
|
533
|
+
let prev;
|
|
534
|
+
do {
|
|
535
|
+
prev = src;
|
|
536
|
+
src = src.replace(commentStripRE, "");
|
|
537
|
+
} while (src !== prev);
|
|
538
|
+
return src;
|
|
532
539
|
}
|
|
533
540
|
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
534
541
|
function getEscapedCssVarName(key, doubleEscape) {
|
|
@@ -536,13 +543,54 @@ function getEscapedCssVarName(key, doubleEscape) {
|
|
|
536
543
|
}
|
|
537
544
|
//#endregion
|
|
538
545
|
//#region packages/shared/src/looseEqual.ts
|
|
539
|
-
function looseCompareArrays(a, b) {
|
|
546
|
+
function looseCompareArrays(a, b, seen) {
|
|
540
547
|
if (a.length !== b.length) return false;
|
|
541
548
|
let equal = true;
|
|
542
|
-
for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i]);
|
|
549
|
+
for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i], seen);
|
|
543
550
|
return equal;
|
|
544
551
|
}
|
|
545
|
-
function
|
|
552
|
+
function looseCompareCollections(a, b, seen) {
|
|
553
|
+
if (a.size !== b.size) return false;
|
|
554
|
+
const candidates = Array.from(b);
|
|
555
|
+
const matched = new Uint8Array(candidates.length);
|
|
556
|
+
for (const item of a) {
|
|
557
|
+
let index = -1;
|
|
558
|
+
for (let i = 0; i < candidates.length; i++) if (!matched[i] && looseEqual(item, candidates[i], seen)) {
|
|
559
|
+
index = i;
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
if (index < 0) return false;
|
|
563
|
+
matched[index] = 1;
|
|
564
|
+
}
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
function looseCompareObjects(a, b, seen) {
|
|
568
|
+
let aValidType = isMap(a);
|
|
569
|
+
let bValidType = isMap(b);
|
|
570
|
+
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
|
|
571
|
+
aValidType = isSet(a);
|
|
572
|
+
bValidType = isSet(b);
|
|
573
|
+
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
|
|
574
|
+
if (Object.keys(a).length !== Object.keys(b).length) return false;
|
|
575
|
+
for (const key in a) {
|
|
576
|
+
const aHasKey = a.hasOwnProperty(key);
|
|
577
|
+
const bHasKey = b.hasOwnProperty(key);
|
|
578
|
+
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) return false;
|
|
579
|
+
}
|
|
580
|
+
return String(a) === String(b);
|
|
581
|
+
}
|
|
582
|
+
function looseCompareNested(a, b, seen, compare) {
|
|
583
|
+
if (!seen) seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
|
|
584
|
+
const [seenA, seenB] = seen;
|
|
585
|
+
if (seenA.has(a) || seenB.has(b)) return seenA.get(a) === b && seenB.get(b) === a;
|
|
586
|
+
seenA.set(a, b);
|
|
587
|
+
seenB.set(b, a);
|
|
588
|
+
const equal = compare(a, b, seen);
|
|
589
|
+
seenA.delete(a);
|
|
590
|
+
seenB.delete(b);
|
|
591
|
+
return equal;
|
|
592
|
+
}
|
|
593
|
+
function looseEqual(a, b, seen) {
|
|
546
594
|
if (a === b) return true;
|
|
547
595
|
let aValidType = isDate(a);
|
|
548
596
|
let bValidType = isDate(b);
|
|
@@ -552,17 +600,12 @@ function looseEqual(a, b) {
|
|
|
552
600
|
if (aValidType || bValidType) return a === b;
|
|
553
601
|
aValidType = isArray(a);
|
|
554
602
|
bValidType = isArray(b);
|
|
555
|
-
if (aValidType || bValidType) return aValidType && bValidType ?
|
|
603
|
+
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
|
|
556
604
|
aValidType = isObject(a);
|
|
557
605
|
bValidType = isObject(b);
|
|
558
606
|
if (aValidType || bValidType) {
|
|
559
607
|
if (!aValidType || !bValidType) return false;
|
|
560
|
-
|
|
561
|
-
for (const key in a) {
|
|
562
|
-
const aHasKey = a.hasOwnProperty(key);
|
|
563
|
-
const bHasKey = b.hasOwnProperty(key);
|
|
564
|
-
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) return false;
|
|
565
|
-
}
|
|
608
|
+
return looseCompareNested(a, b, seen, looseCompareObjects);
|
|
566
609
|
}
|
|
567
610
|
return String(a) === String(b);
|
|
568
611
|
}
|
|
@@ -664,7 +707,15 @@ const VaporVForFlags = {
|
|
|
664
707
|
"IS_COMPONENT": 2,
|
|
665
708
|
"2": "IS_COMPONENT",
|
|
666
709
|
"ONCE": 4,
|
|
667
|
-
"4": "ONCE"
|
|
710
|
+
"4": "ONCE",
|
|
711
|
+
"IS_SINGLE_NODE": 8,
|
|
712
|
+
"8": "IS_SINGLE_NODE",
|
|
713
|
+
"IS_FRAGMENT": 16,
|
|
714
|
+
"16": "IS_FRAGMENT",
|
|
715
|
+
"SLOT_ROOT": 32,
|
|
716
|
+
"32": "SLOT_ROOT",
|
|
717
|
+
"WRAPPED_ROWS": 64,
|
|
718
|
+
"64": "WRAPPED_ROWS"
|
|
668
719
|
};
|
|
669
720
|
const VaporBlockShape = {
|
|
670
721
|
"EMPTY": 0,
|
|
@@ -674,6 +725,87 @@ const VaporBlockShape = {
|
|
|
674
725
|
"MULTI_ROOT": 2,
|
|
675
726
|
"2": "MULTI_ROOT"
|
|
676
727
|
};
|
|
728
|
+
/**
|
|
729
|
+
* Bit layout for vapor `createIf` flags.
|
|
730
|
+
*
|
|
731
|
+
* - bits 0-1: true branch VaporBlockShape
|
|
732
|
+
* - bits 2-3: false branch VaporBlockShape
|
|
733
|
+
* - bit 4: v-once
|
|
734
|
+
* - bit 5: true branch is static and can skip branch-owned EffectScope
|
|
735
|
+
* - bit 6: false branch is static and can skip branch-owned EffectScope
|
|
736
|
+
* - bit 7: v-if sits on a slot content/fallback root chain
|
|
737
|
+
* - bits 8+: branch index + 1 for keyed dynamic fragments
|
|
738
|
+
*
|
|
739
|
+
* Examples:
|
|
740
|
+
* - v-once, true single-root, no false branch: 1 | ONCE = 17
|
|
741
|
+
* - keyed index 0, true/false single-root: 1 | (1 << 2) | (1 << 8) = 261
|
|
742
|
+
*/
|
|
743
|
+
const VaporIfFlags = {
|
|
744
|
+
"BLOCK_SHAPE": 15,
|
|
745
|
+
"15": "BLOCK_SHAPE",
|
|
746
|
+
"ONCE": 16,
|
|
747
|
+
"16": "ONCE",
|
|
748
|
+
"TRUE_NO_SCOPE": 32,
|
|
749
|
+
"32": "TRUE_NO_SCOPE",
|
|
750
|
+
"FALSE_NO_SCOPE": 64,
|
|
751
|
+
"64": "FALSE_NO_SCOPE",
|
|
752
|
+
"SLOT_ROOT": 128,
|
|
753
|
+
"128": "SLOT_ROOT",
|
|
754
|
+
"INDEX_SHIFT": 8,
|
|
755
|
+
"8": "INDEX_SHIFT"
|
|
756
|
+
};
|
|
757
|
+
/**
|
|
758
|
+
* Flags used by vapor template factories, shared between the compiler and the
|
|
759
|
+
* runtime.
|
|
760
|
+
*/
|
|
761
|
+
const TemplateFlags = {
|
|
762
|
+
"ROOT": 1,
|
|
763
|
+
"1": "ROOT",
|
|
764
|
+
"STATIC": 2,
|
|
765
|
+
"2": "STATIC"
|
|
766
|
+
};
|
|
767
|
+
/**
|
|
768
|
+
* Flags used by vapor slot outlets, shared between the compiler and the
|
|
769
|
+
* runtime.
|
|
770
|
+
*/
|
|
771
|
+
const VaporSlotFlags = {
|
|
772
|
+
"NO_SLOTTED": 1,
|
|
773
|
+
"1": "NO_SLOTTED",
|
|
774
|
+
"ONCE": 2,
|
|
775
|
+
"2": "ONCE",
|
|
776
|
+
"FORWARDED": 4,
|
|
777
|
+
"4": "FORWARDED",
|
|
778
|
+
"SHARED_FALLBACK": 8,
|
|
779
|
+
"8": "SHARED_FALLBACK"
|
|
780
|
+
};
|
|
781
|
+
function isForwardedSlot(flags) {
|
|
782
|
+
return !!(flags & 12);
|
|
783
|
+
}
|
|
784
|
+
function slotInheritsFallback(flags) {
|
|
785
|
+
return isForwardedSlot(flags) && !(flags & 8);
|
|
786
|
+
}
|
|
787
|
+
function slotNotifiesBoundary(flags) {
|
|
788
|
+
return isForwardedSlot(flags) && !(flags & 2);
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Per-slot-function metadata attached by the compiler as `fn._`.
|
|
792
|
+
*/
|
|
793
|
+
const VaporSlotStability = {
|
|
794
|
+
"NON_STABLE": 1,
|
|
795
|
+
"1": "NON_STABLE"
|
|
796
|
+
};
|
|
797
|
+
const VaporDynamicComponentFlags = {
|
|
798
|
+
"SINGLE_ROOT": 1,
|
|
799
|
+
"1": "SINGLE_ROOT",
|
|
800
|
+
"ONCE": 2,
|
|
801
|
+
"2": "ONCE",
|
|
802
|
+
"SLOT_ROOT": 4,
|
|
803
|
+
"4": "SLOT_ROOT",
|
|
804
|
+
"NS_SVG": 8,
|
|
805
|
+
"8": "NS_SVG",
|
|
806
|
+
"NS_MATHML": 16,
|
|
807
|
+
"16": "NS_MATHML"
|
|
808
|
+
};
|
|
677
809
|
//#endregion
|
|
678
810
|
exports.EMPTY_ARR = EMPTY_ARR;
|
|
679
811
|
exports.EMPTY_OBJ = EMPTY_OBJ;
|
|
@@ -684,7 +816,12 @@ exports.PatchFlagNames = PatchFlagNames;
|
|
|
684
816
|
exports.PatchFlags = PatchFlags;
|
|
685
817
|
exports.ShapeFlags = ShapeFlags;
|
|
686
818
|
exports.SlotFlags = SlotFlags;
|
|
819
|
+
exports.TemplateFlags = TemplateFlags;
|
|
687
820
|
exports.VaporBlockShape = VaporBlockShape;
|
|
821
|
+
exports.VaporDynamicComponentFlags = VaporDynamicComponentFlags;
|
|
822
|
+
exports.VaporIfFlags = VaporIfFlags;
|
|
823
|
+
exports.VaporSlotFlags = VaporSlotFlags;
|
|
824
|
+
exports.VaporSlotStability = VaporSlotStability;
|
|
688
825
|
exports.VaporVForFlags = VaporVForFlags;
|
|
689
826
|
exports.YES = YES;
|
|
690
827
|
exports.camelize = camelize;
|
|
@@ -715,6 +852,7 @@ exports.isBuiltInDirective = isBuiltInDirective;
|
|
|
715
852
|
exports.isBuiltInTag = isBuiltInTag;
|
|
716
853
|
exports.isDate = isDate;
|
|
717
854
|
exports.isFormattingTag = isFormattingTag;
|
|
855
|
+
exports.isForwardedSlot = isForwardedSlot;
|
|
718
856
|
exports.isFunction = isFunction;
|
|
719
857
|
exports.isGloballyAllowed = isGloballyAllowed;
|
|
720
858
|
exports.isGloballyWhitelisted = isGloballyWhitelisted;
|
|
@@ -756,6 +894,8 @@ exports.propsToAttrMap = propsToAttrMap;
|
|
|
756
894
|
exports.remove = remove;
|
|
757
895
|
exports.shouldSetAsAttr = shouldSetAsAttr;
|
|
758
896
|
exports.slotFlagsText = slotFlagsText;
|
|
897
|
+
exports.slotInheritsFallback = slotInheritsFallback;
|
|
898
|
+
exports.slotNotifiesBoundary = slotNotifiesBoundary;
|
|
759
899
|
exports.stringifyStyle = stringifyStyle;
|
|
760
900
|
exports.toDisplayString = toDisplayString;
|
|
761
901
|
exports.toHandlerKey = toHandlerKey;
|