@vue/shared 3.6.0-rc.5 → 3.6.0-rc.7
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 +68 -29
- package/dist/shared.cjs.prod.js +68 -29
- package/dist/shared.d.ts +255 -240
- package/dist/shared.esm-bundler.js +65 -30
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/shared v3.6.0-rc.
|
|
2
|
+
* @vue/shared v3.6.0-rc.7
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* \/\*#\_\_PURE\_\_\*\/
|
|
12
12
|
* So that they can be tree-shaken if necessary.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
15
15
|
function makeMap(str) {
|
|
16
16
|
const map = Object.create(null);
|
|
17
17
|
for (const key of str.split(",")) map[key] = 1;
|
|
@@ -59,9 +59,9 @@ const toRawType = (value) => {
|
|
|
59
59
|
};
|
|
60
60
|
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
61
61
|
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
62
|
-
const isReservedProp =
|
|
63
|
-
const isBuiltInTag =
|
|
64
|
-
const isBuiltInDirective =
|
|
62
|
+
const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
|
|
63
|
+
const isBuiltInTag = /*#__PURE__*/ makeMap("slot,component");
|
|
64
|
+
const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
|
|
65
65
|
const cacheStringFunction = (fn) => {
|
|
66
66
|
const cache = Object.create(null);
|
|
67
67
|
return ((str) => {
|
|
@@ -255,7 +255,7 @@ const slotFlagsText = {
|
|
|
255
255
|
[2]: "DYNAMIC",
|
|
256
256
|
[3]: "FORWARDED"
|
|
257
257
|
};
|
|
258
|
-
const isGloballyAllowed =
|
|
258
|
+
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");
|
|
259
259
|
/** @deprecated use `isGloballyAllowed` instead */
|
|
260
260
|
const isGloballyWhitelisted = isGloballyAllowed;
|
|
261
261
|
//#endregion
|
|
@@ -368,42 +368,42 @@ const BLOCK_TAGS = "address,article,aside,blockquote,dd,details,dialog,div,dl,dt
|
|
|
368
368
|
* Compiler only.
|
|
369
369
|
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
|
|
370
370
|
*/
|
|
371
|
-
const isHTMLTag =
|
|
371
|
+
const isHTMLTag = /*@__PURE__*/ makeMap(HTML_TAGS);
|
|
372
372
|
/**
|
|
373
373
|
* Compiler only.
|
|
374
374
|
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
|
|
375
375
|
*/
|
|
376
|
-
const isSVGTag =
|
|
376
|
+
const isSVGTag = /*@__PURE__*/ makeMap(SVG_TAGS);
|
|
377
377
|
/**
|
|
378
378
|
* Compiler only.
|
|
379
379
|
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
|
|
380
380
|
*/
|
|
381
|
-
const isMathMLTag =
|
|
381
|
+
const isMathMLTag = /*@__PURE__*/ makeMap(MATH_TAGS);
|
|
382
382
|
/**
|
|
383
383
|
* Compiler only.
|
|
384
384
|
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
|
|
385
385
|
*/
|
|
386
|
-
const isVoidTag =
|
|
386
|
+
const isVoidTag = /*@__PURE__*/ makeMap(VOID_TAGS);
|
|
387
387
|
/**
|
|
388
388
|
* Compiler only.
|
|
389
389
|
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
|
|
390
390
|
*/
|
|
391
|
-
const isFormattingTag =
|
|
391
|
+
const isFormattingTag = /*@__PURE__*/ makeMap(FORMATTING_TAGS);
|
|
392
392
|
/**
|
|
393
393
|
* Compiler only.
|
|
394
394
|
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
|
|
395
395
|
*/
|
|
396
|
-
const isAlwaysCloseTag =
|
|
396
|
+
const isAlwaysCloseTag = /*@__PURE__*/ makeMap(ALWAYS_CLOSE_TAGS);
|
|
397
397
|
/**
|
|
398
398
|
* Compiler only.
|
|
399
399
|
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
|
|
400
400
|
*/
|
|
401
|
-
const isInlineTag =
|
|
401
|
+
const isInlineTag = /*@__PURE__*/ makeMap(INLINE_TAGS);
|
|
402
402
|
/**
|
|
403
403
|
* Compiler only.
|
|
404
404
|
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
|
|
405
405
|
*/
|
|
406
|
-
const isBlockTag =
|
|
406
|
+
const isBlockTag = /*@__PURE__*/ makeMap(BLOCK_TAGS);
|
|
407
407
|
//#endregion
|
|
408
408
|
//#region packages/shared/src/domAttrConfig.ts
|
|
409
409
|
/**
|
|
@@ -418,11 +418,11 @@ const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS);
|
|
|
418
418
|
* - readonly -> readOnly
|
|
419
419
|
*/
|
|
420
420
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
|
421
|
-
const isSpecialBooleanAttr =
|
|
421
|
+
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
|
|
422
422
|
/**
|
|
423
423
|
* The full list is needed during SSR to produce the correct initial markup.
|
|
424
424
|
*/
|
|
425
|
-
const isBooleanAttr =
|
|
425
|
+
const isBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
|
|
426
426
|
/**
|
|
427
427
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
428
428
|
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
@@ -430,7 +430,7 @@ const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,auto
|
|
|
430
430
|
function includeBooleanAttr(value) {
|
|
431
431
|
return !!value || value === "";
|
|
432
432
|
}
|
|
433
|
-
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
|
433
|
+
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\u0020]/;
|
|
434
434
|
const attrValidationCache = {};
|
|
435
435
|
function isSSRSafeAttrName(name) {
|
|
436
436
|
if (attrValidationCache.hasOwnProperty(name)) return attrValidationCache[name];
|
|
@@ -450,15 +450,15 @@ const propsToAttrMap = {
|
|
|
450
450
|
* Don't also forget to allow `data-*` and `aria-*`!
|
|
451
451
|
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
|
452
452
|
*/
|
|
453
|
-
const isKnownHtmlAttr =
|
|
453
|
+
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");
|
|
454
454
|
/**
|
|
455
455
|
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
|
456
456
|
*/
|
|
457
|
-
const isKnownSvgAttr =
|
|
457
|
+
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");
|
|
458
458
|
/**
|
|
459
459
|
* Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute
|
|
460
460
|
*/
|
|
461
|
-
const isKnownMathMLAttr =
|
|
461
|
+
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");
|
|
462
462
|
/**
|
|
463
463
|
* Shared between server-renderer and runtime-core hydration logic
|
|
464
464
|
*/
|
|
@@ -543,6 +543,21 @@ function looseCompareArrays(a, b) {
|
|
|
543
543
|
for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i]);
|
|
544
544
|
return equal;
|
|
545
545
|
}
|
|
546
|
+
function looseCompareCollections(a, b) {
|
|
547
|
+
if (a.size !== b.size) return false;
|
|
548
|
+
const candidates = Array.from(b);
|
|
549
|
+
const matched = new Uint8Array(candidates.length);
|
|
550
|
+
for (const item of a) {
|
|
551
|
+
let index = -1;
|
|
552
|
+
for (let i = 0; i < candidates.length; i++) if (!matched[i] && looseEqual(item, candidates[i])) {
|
|
553
|
+
index = i;
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
if (index < 0) return false;
|
|
557
|
+
matched[index] = 1;
|
|
558
|
+
}
|
|
559
|
+
return true;
|
|
560
|
+
}
|
|
546
561
|
function looseEqual(a, b) {
|
|
547
562
|
if (a === b) return true;
|
|
548
563
|
let aValidType = isDate(a);
|
|
@@ -558,6 +573,12 @@ function looseEqual(a, b) {
|
|
|
558
573
|
bValidType = isObject(b);
|
|
559
574
|
if (aValidType || bValidType) {
|
|
560
575
|
if (!aValidType || !bValidType) return false;
|
|
576
|
+
aValidType = isMap(a);
|
|
577
|
+
bValidType = isMap(b);
|
|
578
|
+
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b) : false;
|
|
579
|
+
aValidType = isSet(a);
|
|
580
|
+
bValidType = isSet(b);
|
|
581
|
+
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b) : false;
|
|
561
582
|
if (Object.keys(a).length !== Object.keys(b).length) return false;
|
|
562
583
|
for (const key in a) {
|
|
563
584
|
const aHasKey = a.hasOwnProperty(key);
|
|
@@ -673,7 +694,9 @@ const VaporVForFlags = {
|
|
|
673
694
|
"IS_FRAGMENT": 16,
|
|
674
695
|
"16": "IS_FRAGMENT",
|
|
675
696
|
"SLOT_ROOT": 32,
|
|
676
|
-
"32": "SLOT_ROOT"
|
|
697
|
+
"32": "SLOT_ROOT",
|
|
698
|
+
"WRAPPED_ROWS": 64,
|
|
699
|
+
"64": "WRAPPED_ROWS"
|
|
677
700
|
};
|
|
678
701
|
const VaporBlockShape = {
|
|
679
702
|
"EMPTY": 0,
|
|
@@ -731,14 +754,26 @@ const VaporSlotFlags = {
|
|
|
731
754
|
"1": "NO_SLOTTED",
|
|
732
755
|
"ONCE": 2,
|
|
733
756
|
"2": "ONCE",
|
|
734
|
-
"
|
|
735
|
-
"4": "
|
|
736
|
-
"
|
|
737
|
-
"8": "
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
757
|
+
"FORWARDED": 4,
|
|
758
|
+
"4": "FORWARDED",
|
|
759
|
+
"SHARED_FALLBACK": 8,
|
|
760
|
+
"8": "SHARED_FALLBACK"
|
|
761
|
+
};
|
|
762
|
+
function isForwardedSlot(flags) {
|
|
763
|
+
return !!(flags & 12);
|
|
764
|
+
}
|
|
765
|
+
function slotInheritsFallback(flags) {
|
|
766
|
+
return isForwardedSlot(flags) && !(flags & 8);
|
|
767
|
+
}
|
|
768
|
+
function slotNotifiesBoundary(flags) {
|
|
769
|
+
return isForwardedSlot(flags) && !(flags & 2);
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Per-slot-function metadata attached by the compiler as `fn._`.
|
|
773
|
+
*/
|
|
774
|
+
const VaporSlotStability = {
|
|
775
|
+
"NON_STABLE": 1,
|
|
776
|
+
"1": "NON_STABLE"
|
|
742
777
|
};
|
|
743
778
|
const VaporDynamicComponentFlags = {
|
|
744
779
|
"SINGLE_ROOT": 1,
|
|
@@ -749,4 +784,4 @@ const VaporDynamicComponentFlags = {
|
|
|
749
784
|
"4": "SLOT_ROOT"
|
|
750
785
|
};
|
|
751
786
|
//#endregion
|
|
752
|
-
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, Namespaces, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, TemplateFlags, VaporBlockShape, VaporDynamicComponentFlags, VaporIfFlags, VaporSlotFlags, VaporVForFlags, YES, camelize, canSetValueDirectly, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isAlwaysCloseTag, isArray, isBlockTag, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isDate, isFormattingTag, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isInlineTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, shouldSetAsAttr, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|
|
787
|
+
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, Namespaces, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, TemplateFlags, VaporBlockShape, VaporDynamicComponentFlags, VaporIfFlags, VaporSlotFlags, VaporSlotStability, VaporVForFlags, YES, camelize, canSetValueDirectly, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isAlwaysCloseTag, isArray, isBlockTag, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isDate, isFormattingTag, isForwardedSlot, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isInlineTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, shouldSetAsAttr, slotFlagsText, slotInheritsFallback, slotNotifiesBoundary, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|