@kdujs/shared-canary
Advanced tools
Comparing version 3.20241223.0-minor.0 to 3.20241223.0
@@ -0,1 +1,6 @@ | ||
/** | ||
* @kdujs/shared-canary v3.20241223.0 | ||
* (c) 2021-present NKDuy | ||
* @license MIT | ||
**/ | ||
'use strict'; | ||
@@ -5,9 +10,7 @@ | ||
/*! #__NO_SIDE_EFFECTS__ */ | ||
// @__NO_SIDE_EFFECTS__ | ||
function makeMap(str, expectsLowerCase) { | ||
const map = /* @__PURE__ */ Object.create(null); | ||
const list = str.split(","); | ||
for (let i = 0; i < list.length; i++) { | ||
map[list[i]] = true; | ||
} | ||
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val]; | ||
const set = new Set(str.split(",")); | ||
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val); | ||
} | ||
@@ -20,4 +23,4 @@ | ||
const NO = () => false; | ||
const onRE = /^on[^a-z]/; | ||
const isOn = (key) => onRE.test(key); | ||
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | ||
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | ||
const isModelListener = (key) => key.startsWith("onUpdate:"); | ||
@@ -82,11 +85,12 @@ const extend = Object.assign; | ||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | ||
const invokeArrayFns = (fns, arg) => { | ||
const invokeArrayFns = (fns, ...arg) => { | ||
for (let i = 0; i < fns.length; i++) { | ||
fns[i](arg); | ||
fns[i](...arg); | ||
} | ||
}; | ||
const def = (obj, key, value) => { | ||
const def = (obj, key, value, writable = false) => { | ||
Object.defineProperty(obj, key, { | ||
configurable: true, | ||
enumerable: false, | ||
writable, | ||
value | ||
@@ -112,2 +116,32 @@ }); | ||
const PatchFlags = { | ||
"TEXT": 1, | ||
"1": "TEXT", | ||
"CLASS": 2, | ||
"2": "CLASS", | ||
"STYLE": 4, | ||
"4": "STYLE", | ||
"PROPS": 8, | ||
"8": "PROPS", | ||
"FULL_PROPS": 16, | ||
"16": "FULL_PROPS", | ||
"NEED_HYDRATION": 32, | ||
"32": "NEED_HYDRATION", | ||
"STABLE_FRAGMENT": 64, | ||
"64": "STABLE_FRAGMENT", | ||
"KEYED_FRAGMENT": 128, | ||
"128": "KEYED_FRAGMENT", | ||
"UNKEYED_FRAGMENT": 256, | ||
"256": "UNKEYED_FRAGMENT", | ||
"NEED_PATCH": 512, | ||
"512": "NEED_PATCH", | ||
"DYNAMIC_SLOTS": 1024, | ||
"1024": "DYNAMIC_SLOTS", | ||
"DEV_ROOT_FRAGMENT": 2048, | ||
"2048": "DEV_ROOT_FRAGMENT", | ||
"HOISTED": -1, | ||
"-1": "HOISTED", | ||
"BAIL": -2, | ||
"-2": "BAIL" | ||
}; | ||
const PatchFlagNames = { | ||
@@ -119,3 +153,3 @@ [1]: `TEXT`, | ||
[16]: `FULL_PROPS`, | ||
[32]: `HYDRATE_EVENTS`, | ||
[32]: `NEED_HYDRATION`, | ||
[64]: `STABLE_FRAGMENT`, | ||
@@ -131,2 +165,35 @@ [128]: `KEYED_FRAGMENT`, | ||
const ShapeFlags = { | ||
"ELEMENT": 1, | ||
"1": "ELEMENT", | ||
"FUNCTIONAL_COMPONENT": 2, | ||
"2": "FUNCTIONAL_COMPONENT", | ||
"STATEFUL_COMPONENT": 4, | ||
"4": "STATEFUL_COMPONENT", | ||
"TEXT_CHILDREN": 8, | ||
"8": "TEXT_CHILDREN", | ||
"ARRAY_CHILDREN": 16, | ||
"16": "ARRAY_CHILDREN", | ||
"SLOTS_CHILDREN": 32, | ||
"32": "SLOTS_CHILDREN", | ||
"TELEPORT": 64, | ||
"64": "TELEPORT", | ||
"SUSPENSE": 128, | ||
"128": "SUSPENSE", | ||
"COMPONENT_SHOULD_KEEP_ALIVE": 256, | ||
"256": "COMPONENT_SHOULD_KEEP_ALIVE", | ||
"COMPONENT_KEPT_ALIVE": 512, | ||
"512": "COMPONENT_KEPT_ALIVE", | ||
"COMPONENT": 6, | ||
"6": "COMPONENT" | ||
}; | ||
const SlotFlags = { | ||
"STABLE": 1, | ||
"1": "STABLE", | ||
"DYNAMIC": 2, | ||
"2": "DYNAMIC", | ||
"FORWARDED": 3, | ||
"3": "FORWARDED" | ||
}; | ||
const slotFlagsText = { | ||
@@ -138,3 +205,3 @@ [1]: "STABLE", | ||
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"; | ||
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"; | ||
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | ||
@@ -154,4 +221,3 @@ const isGloballyWhitelisted = isGloballyAllowed; | ||
for (let j = i - range; j <= i + range || end > count; j++) { | ||
if (j < 0 || j >= lines.length) | ||
continue; | ||
if (j < 0 || j >= lines.length) continue; | ||
const line = j + 1; | ||
@@ -221,4 +287,4 @@ res.push( | ||
const value = styles[key]; | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
if (isString(value) || typeof value === "number") { | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
ret += `${normalizedKey}:${value};`; | ||
@@ -250,4 +316,3 @@ } | ||
function normalizeProps(props) { | ||
if (!props) | ||
return null; | ||
if (!props) return null; | ||
let { class: klass, style } = props; | ||
@@ -265,5 +330,7 @@ if (klass && !isString(klass)) { | ||
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"; | ||
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"; | ||
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; | ||
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | ||
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | ||
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | ||
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | ||
@@ -301,4 +368,11 @@ | ||
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,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | ||
`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` | ||
); | ||
function isRenderableAttrValue(value) { | ||
if (value == null) { | ||
return false; | ||
} | ||
const type = typeof value; | ||
return type === "string" || type === "number" || type === "boolean"; | ||
} | ||
@@ -350,4 +424,3 @@ const escapeRE = /["'&<>]/; | ||
function looseCompareArrays(a, b) { | ||
if (a.length !== b.length) | ||
return false; | ||
if (a.length !== b.length) return false; | ||
let equal = true; | ||
@@ -360,4 +433,3 @@ for (let i = 0; equal && i < a.length; i++) { | ||
function looseEqual(a, b) { | ||
if (a === b) | ||
return true; | ||
if (a === b) return true; | ||
let aValidType = isDate(a); | ||
@@ -411,11 +483,16 @@ let bValidType = isDate(b); | ||
return { | ||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => { | ||
entries[`${key} =>`] = val2; | ||
return entries; | ||
}, {}) | ||
[`Map(${val.size})`]: [...val.entries()].reduce( | ||
(entries, [key, val2], i) => { | ||
entries[stringifySymbol(key, i) + " =>"] = val2; | ||
return entries; | ||
}, | ||
{} | ||
) | ||
}; | ||
} else if (isSet(val)) { | ||
return { | ||
[`Set(${val.size})`]: [...val.values()] | ||
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | ||
}; | ||
} else if (isSymbol(val)) { | ||
return stringifySymbol(val); | ||
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | ||
@@ -426,2 +503,10 @@ return String(val); | ||
}; | ||
const stringifySymbol = (v, i = "") => { | ||
var _a; | ||
return ( | ||
// Symbol.description in es2019+ so we need to cast here to pass | ||
// the lib: es2016 check | ||
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | ||
); | ||
}; | ||
@@ -433,2 +518,5 @@ exports.EMPTY_ARR = EMPTY_ARR; | ||
exports.PatchFlagNames = PatchFlagNames; | ||
exports.PatchFlags = PatchFlags; | ||
exports.ShapeFlags = ShapeFlags; | ||
exports.SlotFlags = SlotFlags; | ||
exports.camelize = camelize; | ||
@@ -460,2 +548,3 @@ exports.capitalize = capitalize; | ||
exports.isMap = isMap; | ||
exports.isMathMLTag = isMathMLTag; | ||
exports.isModelListener = isModelListener; | ||
@@ -467,2 +556,3 @@ exports.isObject = isObject; | ||
exports.isRegExp = isRegExp; | ||
exports.isRenderableAttrValue = isRenderableAttrValue; | ||
exports.isReservedProp = isReservedProp; | ||
@@ -469,0 +559,0 @@ exports.isSSRSafeAttrName = isSSRSafeAttrName; |
@@ -0,1 +1,6 @@ | ||
/** | ||
* @kdujs/shared-canary v3.20241223.0 | ||
* (c) 2021-present NKDuy | ||
* @license MIT | ||
**/ | ||
'use strict'; | ||
@@ -5,9 +10,7 @@ | ||
/*! #__NO_SIDE_EFFECTS__ */ | ||
// @__NO_SIDE_EFFECTS__ | ||
function makeMap(str, expectsLowerCase) { | ||
const map = /* @__PURE__ */ Object.create(null); | ||
const list = str.split(","); | ||
for (let i = 0; i < list.length; i++) { | ||
map[list[i]] = true; | ||
} | ||
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val]; | ||
const set = new Set(str.split(",")); | ||
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val); | ||
} | ||
@@ -20,4 +23,4 @@ | ||
const NO = () => false; | ||
const onRE = /^on[^a-z]/; | ||
const isOn = (key) => onRE.test(key); | ||
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | ||
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | ||
const isModelListener = (key) => key.startsWith("onUpdate:"); | ||
@@ -82,11 +85,12 @@ const extend = Object.assign; | ||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | ||
const invokeArrayFns = (fns, arg) => { | ||
const invokeArrayFns = (fns, ...arg) => { | ||
for (let i = 0; i < fns.length; i++) { | ||
fns[i](arg); | ||
fns[i](...arg); | ||
} | ||
}; | ||
const def = (obj, key, value) => { | ||
const def = (obj, key, value, writable = false) => { | ||
Object.defineProperty(obj, key, { | ||
configurable: true, | ||
enumerable: false, | ||
writable, | ||
value | ||
@@ -112,2 +116,32 @@ }); | ||
const PatchFlags = { | ||
"TEXT": 1, | ||
"1": "TEXT", | ||
"CLASS": 2, | ||
"2": "CLASS", | ||
"STYLE": 4, | ||
"4": "STYLE", | ||
"PROPS": 8, | ||
"8": "PROPS", | ||
"FULL_PROPS": 16, | ||
"16": "FULL_PROPS", | ||
"NEED_HYDRATION": 32, | ||
"32": "NEED_HYDRATION", | ||
"STABLE_FRAGMENT": 64, | ||
"64": "STABLE_FRAGMENT", | ||
"KEYED_FRAGMENT": 128, | ||
"128": "KEYED_FRAGMENT", | ||
"UNKEYED_FRAGMENT": 256, | ||
"256": "UNKEYED_FRAGMENT", | ||
"NEED_PATCH": 512, | ||
"512": "NEED_PATCH", | ||
"DYNAMIC_SLOTS": 1024, | ||
"1024": "DYNAMIC_SLOTS", | ||
"DEV_ROOT_FRAGMENT": 2048, | ||
"2048": "DEV_ROOT_FRAGMENT", | ||
"HOISTED": -1, | ||
"-1": "HOISTED", | ||
"BAIL": -2, | ||
"-2": "BAIL" | ||
}; | ||
const PatchFlagNames = { | ||
@@ -119,3 +153,3 @@ [1]: `TEXT`, | ||
[16]: `FULL_PROPS`, | ||
[32]: `HYDRATE_EVENTS`, | ||
[32]: `NEED_HYDRATION`, | ||
[64]: `STABLE_FRAGMENT`, | ||
@@ -131,2 +165,35 @@ [128]: `KEYED_FRAGMENT`, | ||
const ShapeFlags = { | ||
"ELEMENT": 1, | ||
"1": "ELEMENT", | ||
"FUNCTIONAL_COMPONENT": 2, | ||
"2": "FUNCTIONAL_COMPONENT", | ||
"STATEFUL_COMPONENT": 4, | ||
"4": "STATEFUL_COMPONENT", | ||
"TEXT_CHILDREN": 8, | ||
"8": "TEXT_CHILDREN", | ||
"ARRAY_CHILDREN": 16, | ||
"16": "ARRAY_CHILDREN", | ||
"SLOTS_CHILDREN": 32, | ||
"32": "SLOTS_CHILDREN", | ||
"TELEPORT": 64, | ||
"64": "TELEPORT", | ||
"SUSPENSE": 128, | ||
"128": "SUSPENSE", | ||
"COMPONENT_SHOULD_KEEP_ALIVE": 256, | ||
"256": "COMPONENT_SHOULD_KEEP_ALIVE", | ||
"COMPONENT_KEPT_ALIVE": 512, | ||
"512": "COMPONENT_KEPT_ALIVE", | ||
"COMPONENT": 6, | ||
"6": "COMPONENT" | ||
}; | ||
const SlotFlags = { | ||
"STABLE": 1, | ||
"1": "STABLE", | ||
"DYNAMIC": 2, | ||
"2": "DYNAMIC", | ||
"FORWARDED": 3, | ||
"3": "FORWARDED" | ||
}; | ||
const slotFlagsText = { | ||
@@ -138,3 +205,3 @@ [1]: "STABLE", | ||
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"; | ||
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"; | ||
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | ||
@@ -154,4 +221,3 @@ const isGloballyWhitelisted = isGloballyAllowed; | ||
for (let j = i - range; j <= i + range || end > count; j++) { | ||
if (j < 0 || j >= lines.length) | ||
continue; | ||
if (j < 0 || j >= lines.length) continue; | ||
const line = j + 1; | ||
@@ -221,4 +287,4 @@ res.push( | ||
const value = styles[key]; | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
if (isString(value) || typeof value === "number") { | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
ret += `${normalizedKey}:${value};`; | ||
@@ -250,4 +316,3 @@ } | ||
function normalizeProps(props) { | ||
if (!props) | ||
return null; | ||
if (!props) return null; | ||
let { class: klass, style } = props; | ||
@@ -265,5 +330,7 @@ if (klass && !isString(klass)) { | ||
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"; | ||
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"; | ||
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; | ||
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | ||
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | ||
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | ||
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | ||
@@ -301,4 +368,11 @@ | ||
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,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | ||
`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` | ||
); | ||
function isRenderableAttrValue(value) { | ||
if (value == null) { | ||
return false; | ||
} | ||
const type = typeof value; | ||
return type === "string" || type === "number" || type === "boolean"; | ||
} | ||
@@ -350,4 +424,3 @@ const escapeRE = /["'&<>]/; | ||
function looseCompareArrays(a, b) { | ||
if (a.length !== b.length) | ||
return false; | ||
if (a.length !== b.length) return false; | ||
let equal = true; | ||
@@ -360,4 +433,3 @@ for (let i = 0; equal && i < a.length; i++) { | ||
function looseEqual(a, b) { | ||
if (a === b) | ||
return true; | ||
if (a === b) return true; | ||
let aValidType = isDate(a); | ||
@@ -411,11 +483,16 @@ let bValidType = isDate(b); | ||
return { | ||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => { | ||
entries[`${key} =>`] = val2; | ||
return entries; | ||
}, {}) | ||
[`Map(${val.size})`]: [...val.entries()].reduce( | ||
(entries, [key, val2], i) => { | ||
entries[stringifySymbol(key, i) + " =>"] = val2; | ||
return entries; | ||
}, | ||
{} | ||
) | ||
}; | ||
} else if (isSet(val)) { | ||
return { | ||
[`Set(${val.size})`]: [...val.values()] | ||
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | ||
}; | ||
} else if (isSymbol(val)) { | ||
return stringifySymbol(val); | ||
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | ||
@@ -426,2 +503,10 @@ return String(val); | ||
}; | ||
const stringifySymbol = (v, i = "") => { | ||
var _a; | ||
return ( | ||
// Symbol.description in es2019+ so we need to cast here to pass | ||
// the lib: es2016 check | ||
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | ||
); | ||
}; | ||
@@ -433,2 +518,5 @@ exports.EMPTY_ARR = EMPTY_ARR; | ||
exports.PatchFlagNames = PatchFlagNames; | ||
exports.PatchFlags = PatchFlags; | ||
exports.ShapeFlags = ShapeFlags; | ||
exports.SlotFlags = SlotFlags; | ||
exports.camelize = camelize; | ||
@@ -460,2 +548,3 @@ exports.capitalize = capitalize; | ||
exports.isMap = isMap; | ||
exports.isMathMLTag = isMathMLTag; | ||
exports.isModelListener = isModelListener; | ||
@@ -467,2 +556,3 @@ exports.isObject = isObject; | ||
exports.isRegExp = isRegExp; | ||
exports.isRenderableAttrValue = isRenderableAttrValue; | ||
exports.isReservedProp = isReservedProp; | ||
@@ -469,0 +559,0 @@ exports.isSSRSafeAttrName = isSSRSafeAttrName; |
@@ -8,2 +8,3 @@ /** | ||
*/ | ||
/*! #__NO_SIDE_EFFECTS__ */ | ||
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean; | ||
@@ -64,7 +65,7 @@ | ||
export declare const hasChanged: (value: any, oldValue: any) => boolean; | ||
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void; | ||
export declare const def: (obj: object, key: string | symbol, value: any) => void; | ||
export declare const invokeArrayFns: (fns: Function[], ...arg: any[]) => void; | ||
export declare const def: (obj: object, key: string | symbol, value: any, writable?: boolean) => void; | ||
/** | ||
* "123-foo" will be parsed to 123 | ||
* This is used for the .number modifier in v-model | ||
* This is used for the .number modifier in k-model | ||
*/ | ||
@@ -98,3 +99,3 @@ export declare const looseToNumber: (val: any) => any; | ||
*/ | ||
export declare const enum PatchFlags { | ||
export declare enum PatchFlags { | ||
/** | ||
@@ -135,6 +136,7 @@ * Indicates an element with dynamic textContent (children fast path) | ||
/** | ||
* Indicates an element with event listeners (which need to be attached | ||
* during hydration) | ||
* Indicates an element that requires props hydration | ||
* (but not necessarily patching) | ||
* e.g. event listeners & k-bind with prop modifier | ||
*/ | ||
HYDRATE_EVENTS = 32, | ||
NEED_HYDRATION = 32, | ||
/** | ||
@@ -197,3 +199,3 @@ * Indicates a fragment whose children order doesn't change. | ||
export declare const enum ShapeFlags { | ||
export declare enum ShapeFlags { | ||
ELEMENT = 1, | ||
@@ -212,3 +214,3 @@ FUNCTIONAL_COMPONENT = 2, | ||
export declare const enum SlotFlags { | ||
export declare enum SlotFlags { | ||
/** | ||
@@ -270,2 +272,7 @@ * Stable slots that only reference slot props or context state. The slot | ||
*/ | ||
export declare const isMathMLTag: (key: string) => boolean; | ||
/** | ||
* Compiler only. | ||
* Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
*/ | ||
export declare const isVoidTag: (key: string) => boolean; | ||
@@ -296,2 +303,6 @@ | ||
export declare const isKnownSvgAttr: (key: string) => boolean; | ||
/** | ||
* Shared between server-renderer and runtime-core hydration logic | ||
*/ | ||
export declare function isRenderableAttrValue(value: unknown): boolean; | ||
@@ -298,0 +309,0 @@ export declare function escapeHtml(string: unknown): string; |
@@ -0,8 +1,11 @@ | ||
/** | ||
* @kdujs/shared-canary v3.20241223.0 | ||
* (c) 2021-present NKDuy | ||
* @license MIT | ||
**/ | ||
/*! #__NO_SIDE_EFFECTS__ */ | ||
// @__NO_SIDE_EFFECTS__ | ||
function makeMap(str, expectsLowerCase) { | ||
const map = /* @__PURE__ */ Object.create(null); | ||
const list = str.split(","); | ||
for (let i = 0; i < list.length; i++) { | ||
map[list[i]] = true; | ||
} | ||
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val]; | ||
const set = new Set(str.split(",")); | ||
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val); | ||
} | ||
@@ -15,4 +18,4 @@ | ||
const NO = () => false; | ||
const onRE = /^on[^a-z]/; | ||
const isOn = (key) => onRE.test(key); | ||
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | ||
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | ||
const isModelListener = (key) => key.startsWith("onUpdate:"); | ||
@@ -77,11 +80,12 @@ const extend = Object.assign; | ||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | ||
const invokeArrayFns = (fns, arg) => { | ||
const invokeArrayFns = (fns, ...arg) => { | ||
for (let i = 0; i < fns.length; i++) { | ||
fns[i](arg); | ||
fns[i](...arg); | ||
} | ||
}; | ||
const def = (obj, key, value) => { | ||
const def = (obj, key, value, writable = false) => { | ||
Object.defineProperty(obj, key, { | ||
configurable: true, | ||
enumerable: false, | ||
writable, | ||
value | ||
@@ -107,2 +111,32 @@ }); | ||
const PatchFlags = { | ||
"TEXT": 1, | ||
"1": "TEXT", | ||
"CLASS": 2, | ||
"2": "CLASS", | ||
"STYLE": 4, | ||
"4": "STYLE", | ||
"PROPS": 8, | ||
"8": "PROPS", | ||
"FULL_PROPS": 16, | ||
"16": "FULL_PROPS", | ||
"NEED_HYDRATION": 32, | ||
"32": "NEED_HYDRATION", | ||
"STABLE_FRAGMENT": 64, | ||
"64": "STABLE_FRAGMENT", | ||
"KEYED_FRAGMENT": 128, | ||
"128": "KEYED_FRAGMENT", | ||
"UNKEYED_FRAGMENT": 256, | ||
"256": "UNKEYED_FRAGMENT", | ||
"NEED_PATCH": 512, | ||
"512": "NEED_PATCH", | ||
"DYNAMIC_SLOTS": 1024, | ||
"1024": "DYNAMIC_SLOTS", | ||
"DEV_ROOT_FRAGMENT": 2048, | ||
"2048": "DEV_ROOT_FRAGMENT", | ||
"HOISTED": -1, | ||
"-1": "HOISTED", | ||
"BAIL": -2, | ||
"-2": "BAIL" | ||
}; | ||
const PatchFlagNames = { | ||
@@ -114,3 +148,3 @@ [1]: `TEXT`, | ||
[16]: `FULL_PROPS`, | ||
[32]: `HYDRATE_EVENTS`, | ||
[32]: `NEED_HYDRATION`, | ||
[64]: `STABLE_FRAGMENT`, | ||
@@ -126,2 +160,35 @@ [128]: `KEYED_FRAGMENT`, | ||
const ShapeFlags = { | ||
"ELEMENT": 1, | ||
"1": "ELEMENT", | ||
"FUNCTIONAL_COMPONENT": 2, | ||
"2": "FUNCTIONAL_COMPONENT", | ||
"STATEFUL_COMPONENT": 4, | ||
"4": "STATEFUL_COMPONENT", | ||
"TEXT_CHILDREN": 8, | ||
"8": "TEXT_CHILDREN", | ||
"ARRAY_CHILDREN": 16, | ||
"16": "ARRAY_CHILDREN", | ||
"SLOTS_CHILDREN": 32, | ||
"32": "SLOTS_CHILDREN", | ||
"TELEPORT": 64, | ||
"64": "TELEPORT", | ||
"SUSPENSE": 128, | ||
"128": "SUSPENSE", | ||
"COMPONENT_SHOULD_KEEP_ALIVE": 256, | ||
"256": "COMPONENT_SHOULD_KEEP_ALIVE", | ||
"COMPONENT_KEPT_ALIVE": 512, | ||
"512": "COMPONENT_KEPT_ALIVE", | ||
"COMPONENT": 6, | ||
"6": "COMPONENT" | ||
}; | ||
const SlotFlags = { | ||
"STABLE": 1, | ||
"1": "STABLE", | ||
"DYNAMIC": 2, | ||
"2": "DYNAMIC", | ||
"FORWARDED": 3, | ||
"3": "FORWARDED" | ||
}; | ||
const slotFlagsText = { | ||
@@ -133,3 +200,3 @@ [1]: "STABLE", | ||
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"; | ||
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"; | ||
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | ||
@@ -149,4 +216,3 @@ const isGloballyWhitelisted = isGloballyAllowed; | ||
for (let j = i - range; j <= i + range || end > count; j++) { | ||
if (j < 0 || j >= lines.length) | ||
continue; | ||
if (j < 0 || j >= lines.length) continue; | ||
const line = j + 1; | ||
@@ -216,4 +282,4 @@ res.push( | ||
const value = styles[key]; | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
if (isString(value) || typeof value === "number") { | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
ret += `${normalizedKey}:${value};`; | ||
@@ -245,4 +311,3 @@ } | ||
function normalizeProps(props) { | ||
if (!props) | ||
return null; | ||
if (!props) return null; | ||
let { class: klass, style } = props; | ||
@@ -260,5 +325,7 @@ if (klass && !isString(klass)) { | ||
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"; | ||
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"; | ||
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; | ||
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | ||
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | ||
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | ||
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | ||
@@ -296,4 +363,11 @@ | ||
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,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | ||
`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` | ||
); | ||
function isRenderableAttrValue(value) { | ||
if (value == null) { | ||
return false; | ||
} | ||
const type = typeof value; | ||
return type === "string" || type === "number" || type === "boolean"; | ||
} | ||
@@ -345,4 +419,3 @@ const escapeRE = /["'&<>]/; | ||
function looseCompareArrays(a, b) { | ||
if (a.length !== b.length) | ||
return false; | ||
if (a.length !== b.length) return false; | ||
let equal = true; | ||
@@ -355,4 +428,3 @@ for (let i = 0; equal && i < a.length; i++) { | ||
function looseEqual(a, b) { | ||
if (a === b) | ||
return true; | ||
if (a === b) return true; | ||
let aValidType = isDate(a); | ||
@@ -406,11 +478,16 @@ let bValidType = isDate(b); | ||
return { | ||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => { | ||
entries[`${key} =>`] = val2; | ||
return entries; | ||
}, {}) | ||
[`Map(${val.size})`]: [...val.entries()].reduce( | ||
(entries, [key, val2], i) => { | ||
entries[stringifySymbol(key, i) + " =>"] = val2; | ||
return entries; | ||
}, | ||
{} | ||
) | ||
}; | ||
} else if (isSet(val)) { | ||
return { | ||
[`Set(${val.size})`]: [...val.values()] | ||
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | ||
}; | ||
} else if (isSymbol(val)) { | ||
return stringifySymbol(val); | ||
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | ||
@@ -421,3 +498,11 @@ return String(val); | ||
}; | ||
const stringifySymbol = (v, i = "") => { | ||
var _a; | ||
return ( | ||
// Symbol.description in es2019+ so we need to cast here to pass | ||
// the lib: es2016 check | ||
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | ||
); | ||
}; | ||
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString }; | ||
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString }; |
{ | ||
"name": "@kdujs/shared-canary", | ||
"version": "3.20241223.0-minor.0", | ||
"version": "3.20241223.0", | ||
"description": "internal utils shared across @kdujs packages", | ||
@@ -12,2 +12,16 @@ "main": "index.js", | ||
], | ||
"exports": { | ||
".": { | ||
"types": "./dist/shared.d.ts", | ||
"node": { | ||
"production": "./dist/shared.cjs.prod.js", | ||
"development": "./dist/shared.cjs.js", | ||
"default": "./index.js" | ||
}, | ||
"module": "./dist/shared.esm-bundler.js", | ||
"import": "./dist/shared.esm-bundler.js", | ||
"require": "./index.js" | ||
}, | ||
"./*": "./*" | ||
}, | ||
"sideEffects": false, | ||
@@ -14,0 +28,0 @@ "buildOptions": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
80541
1951
1