🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@atom-vue/shared

Package Overview
Dependencies
Maintainers
3
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atom-vue/shared - npm Package Compare versions

Comparing version
3.0.0-beta.47
to
3.0.0-beta.48
+136
-36
dist/shared.cjs.js

@@ -21,8 +21,5 @@ 'use strict';

// Patch flags are optimization hints generated by the compiler.
// when a block with dynamicChildren is encountered during diff, the algorithm
// enters "optimized mode". In this mode, we know that the vdom is produced by
// a render function generated by the compiler, so the algorithm only needs to
// handle updates explicitly marked by these patch flags.
// dev only flag -> name mapping
/**
* dev only flag -> name mapping
*/
const PatchFlagNames = {

@@ -39,4 +36,5 @@ [1 /* TEXT */]: `TEXT`,

[256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
[512 /* NEED_PATCH */]: `NEED_PATCH`,
[1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
[512 /* NEED_PATCH */]: `NEED_PATCH`,
[4096 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
[-1 /* HOISTED */]: `HOISTED`,

@@ -46,5 +44,14 @@ [-2 /* BAIL */]: `BAIL`

/**
* Dev only
*/
const slotFlagsText = {
[1 /* STABLE */]: 'STABLE',
[2 /* DYNAMIC */]: 'DYNAMIC',
[3 /* FORWARDED */]: 'FORWARDED'
};
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,';
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
let EXTERN_GLOBALS_WHITE_LISTED = '';

@@ -62,7 +69,16 @@ let innerIsGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED + EXTERN_GLOBALS_WHITE_LISTED);

function generateCodeFrame(source, start = 0, end = source.length) {
const lines = source.split(/\r?\n/);
// Split the content into individual lines but capture the newline sequence
// that separated each line. This is important because the actual sequence is
// needed to properly take into account the full line length for offset
// comparison
let lines = source.split(/(\r?\n)/);
// Separate the lines and newline sequences into separate arrays for easier referencing
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
let count = 0;
const res = [];
for (let i = 0; i < lines.length; i++) {
count += lines[i].length + 1;
count +=
lines[i].length +
((newlineSequences[i] && newlineSequences[i].length) || 0);
if (count >= start) {

@@ -75,5 +91,6 @@ for (let j = i - range; j <= i + range || end > count; j++) {

const lineLength = lines[j].length;
const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;
if (j === i) {
// push underline
const pad = start - (count - lineLength) + 1;
const pad = start - (count - (lineLength + newLineSeqLength));
const length = Math.max(1, end > count ? lineLength - pad : end - start);

@@ -87,3 +104,3 @@ res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));

}
count += lineLength + 1;
count += lineLength + newLineSeqLength;
}

@@ -117,2 +134,9 @@ }

`checked,muted,multiple,selected`);
/**
* Boolean attributes should be included if the value is truthy or ''.
* e.g. <select multiple> compiles to { multiple: '' }
*/
function includeBooleanAttr(value) {
return !!value || value === '';
}
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;

@@ -154,3 +178,3 @@ const attrValidationCache = {};

*/
const isKnownAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +

@@ -170,2 +194,44 @@ `border,buffered,capture,challenge,charset,checked,cite,class,code,` +

`value,width,wrap`);
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
*/
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`);

@@ -177,3 +243,5 @@ function normalizeStyle(value) {

const item = value[i];
const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
const normalized = isString(item)
? parseStringStyle(item)
: normalizeStyle(item);
if (normalized) {

@@ -239,3 +307,4 @@ for (const key in normalized) {

// 一个存在一个不存在 或 都存在但长度不同
if (valueAms != valueBms || (valueAms && valueA.ms.length != valueB.ms.length)) {
if (valueAms != valueBms ||
(valueAms && valueA.ms.length != valueB.ms.length)) {
return false;

@@ -288,2 +357,27 @@ }

}
function normalizeProps(props) {
if (!props)
return null;
let { class: klass, 'active-class': activeClass, 'focused-class': focusedClass, style } = props;
// wangyan51: class.d可能是Array<Number>或Array<Array<Number>>,由normalizeClass处理成Array<Number>
// @ts-ignore
if (klass && klass.d) {
// @ts-ignore
props.class.d = normalizeClass(klass.d);
}
// @ts-ignore
if (activeClass && activeClass.d) {
// @ts-ignore
props['active-class'].d = normalizeClass(activeClass.d);
}
// @ts-ignore
if (focusedClass && focusedClass.d) {
// @ts-ignore
props['focused-class'].d = normalizeClass(focusedClass.d);
}
if (style) {
props.style = normalizeStyle(style);
}
return props;
}

@@ -388,9 +482,2 @@ // These tag configs are shared between compiler-dom and runtime-dom, so they

}
function looseHas(set, val) {
for (let item of set) {
if (looseEqual(item, val))
return true;
}
return false;
}

@@ -404,3 +491,5 @@ /**

? ''
: isObject(val)
: isArray(val) ||
(isObject(val) &&
(val.toString === objectToString || !isFunction(val.toString)))
? JSON.stringify(val, replacer, 2)

@@ -410,3 +499,7 @@ : String(val);

const replacer = (_key, val) => {
if (isMap(val)) {
// can't use isRef here since @vue/shared has no deps
if (val && val.__v_isRef) {
return replacer(_key, val.value);
}
else if (isMap(val)) {
return {

@@ -441,5 +534,5 @@ [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {

];
const EMPTY_OBJ = Object.freeze({})
const EMPTY_OBJ = Object.freeze({})
;
const EMPTY_ARR = [];
const EMPTY_ARR = Object.freeze([]) ;
const NOOP = () => { };

@@ -476,2 +569,3 @@ /**

const toRawType = (value) => {
// extract "RawType" from strings like "[object RawType]"
return toTypeString(value).slice(8, -1);

@@ -484,3 +578,5 @@ };

'' + parseInt(key, 10) === key;
const isReservedProp = /*#__PURE__*/ makeMap('key,ref,' +
const isReservedProp = /*#__PURE__*/ makeMap(
// the leading comma is intentional so empty string "" is also included
',key,ref,' +
'onVnodeBeforeMount,onVnodeMounted,' +

@@ -507,13 +603,13 @@ 'onVnodeBeforeUpdate,onVnodeUpdated,' +

*/
const hyphenate = cacheStringFunction((str) => {
return str.replace(hyphenateRE, '-$1').toLowerCase();
});
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
/**
* @private
*/
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
/**
* @private
*/
const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
// compare whether a value has changed, accounting for NaN.
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
const invokeArrayFns = (fns, arg) => {

@@ -568,2 +664,3 @@ for (let i = 0; i < fns.length; i++) {

exports.hyphenate = hyphenate;
exports.includeBooleanAttr = includeBooleanAttr;
exports.invokeArrayFns = invokeArrayFns;

@@ -576,3 +673,4 @@ exports.isArray = isArray;

exports.isIntegerKey = isIntegerKey;
exports.isKnownAttr = isKnownAttr;
exports.isKnownHtmlAttr = isKnownHtmlAttr;
exports.isKnownSvgAttr = isKnownSvgAttr;
exports.isMap = isMap;

@@ -593,6 +691,6 @@ exports.isModelListener = isModelListener;

exports.looseEqual = looseEqual;
exports.looseHas = looseHas;
exports.looseIndexOf = looseIndexOf;
exports.makeMap = makeMap;
exports.normalizeClass = normalizeClass;
exports.normalizeProps = normalizeProps;
exports.normalizeStyle = normalizeStyle;

@@ -604,6 +702,8 @@ exports.objectToString = objectToString;

exports.setExternGlobals = setExternGlobals;
exports.slotFlagsText = slotFlagsText;
exports.stringifyStyle = stringifyStyle;
exports.toDisplayString = toDisplayString;
exports.toHandlerKey = toHandlerKey;
exports.toNumber = toNumber;
exports.toRawType = toRawType;
exports.toTypeString = toTypeString;

@@ -21,8 +21,5 @@ 'use strict';

// Patch flags are optimization hints generated by the compiler.
// when a block with dynamicChildren is encountered during diff, the algorithm
// enters "optimized mode". In this mode, we know that the vdom is produced by
// a render function generated by the compiler, so the algorithm only needs to
// handle updates explicitly marked by these patch flags.
// dev only flag -> name mapping
/**
* dev only flag -> name mapping
*/
const PatchFlagNames = {

@@ -39,4 +36,5 @@ [1 /* TEXT */]: `TEXT`,

[256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
[512 /* NEED_PATCH */]: `NEED_PATCH`,
[1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
[512 /* NEED_PATCH */]: `NEED_PATCH`,
[4096 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
[-1 /* HOISTED */]: `HOISTED`,

@@ -46,5 +44,14 @@ [-2 /* BAIL */]: `BAIL`

/**
* Dev only
*/
const slotFlagsText = {
[1 /* STABLE */]: 'STABLE',
[2 /* DYNAMIC */]: 'DYNAMIC',
[3 /* FORWARDED */]: 'FORWARDED'
};
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,';
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
let EXTERN_GLOBALS_WHITE_LISTED = '';

@@ -62,7 +69,16 @@ let innerIsGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED + EXTERN_GLOBALS_WHITE_LISTED);

function generateCodeFrame(source, start = 0, end = source.length) {
const lines = source.split(/\r?\n/);
// Split the content into individual lines but capture the newline sequence
// that separated each line. This is important because the actual sequence is
// needed to properly take into account the full line length for offset
// comparison
let lines = source.split(/(\r?\n)/);
// Separate the lines and newline sequences into separate arrays for easier referencing
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
let count = 0;
const res = [];
for (let i = 0; i < lines.length; i++) {
count += lines[i].length + 1;
count +=
lines[i].length +
((newlineSequences[i] && newlineSequences[i].length) || 0);
if (count >= start) {

@@ -75,5 +91,6 @@ for (let j = i - range; j <= i + range || end > count; j++) {

const lineLength = lines[j].length;
const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;
if (j === i) {
// push underline
const pad = start - (count - lineLength) + 1;
const pad = start - (count - (lineLength + newLineSeqLength));
const length = Math.max(1, end > count ? lineLength - pad : end - start);

@@ -87,3 +104,3 @@ res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));

}
count += lineLength + 1;
count += lineLength + newLineSeqLength;
}

@@ -117,2 +134,9 @@ }

`checked,muted,multiple,selected`);
/**
* Boolean attributes should be included if the value is truthy or ''.
* e.g. <select multiple> compiles to { multiple: '' }
*/
function includeBooleanAttr(value) {
return !!value || value === '';
}
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;

@@ -154,3 +178,3 @@ const attrValidationCache = {};

*/
const isKnownAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +

@@ -170,2 +194,44 @@ `border,buffered,capture,challenge,charset,checked,cite,class,code,` +

`value,width,wrap`);
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
*/
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`);

@@ -177,3 +243,5 @@ function normalizeStyle(value) {

const item = value[i];
const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
const normalized = isString(item)
? parseStringStyle(item)
: normalizeStyle(item);
if (normalized) {

@@ -239,3 +307,4 @@ for (const key in normalized) {

// 一个存在一个不存在 或 都存在但长度不同
if (valueAms != valueBms || (valueAms && valueA.ms.length != valueB.ms.length)) {
if (valueAms != valueBms ||
(valueAms && valueA.ms.length != valueB.ms.length)) {
return false;

@@ -288,2 +357,27 @@ }

}
function normalizeProps(props) {
if (!props)
return null;
let { class: klass, 'active-class': activeClass, 'focused-class': focusedClass, style } = props;
// wangyan51: class.d可能是Array<Number>或Array<Array<Number>>,由normalizeClass处理成Array<Number>
// @ts-ignore
if (klass && klass.d) {
// @ts-ignore
props.class.d = normalizeClass(klass.d);
}
// @ts-ignore
if (activeClass && activeClass.d) {
// @ts-ignore
props['active-class'].d = normalizeClass(activeClass.d);
}
// @ts-ignore
if (focusedClass && focusedClass.d) {
// @ts-ignore
props['focused-class'].d = normalizeClass(focusedClass.d);
}
if (style) {
props.style = normalizeStyle(style);
}
return props;
}

@@ -388,9 +482,2 @@ // These tag configs are shared between compiler-dom and runtime-dom, so they

}
function looseHas(set, val) {
for (let item of set) {
if (looseEqual(item, val))
return true;
}
return false;
}

@@ -404,3 +491,5 @@ /**

? ''
: isObject(val)
: isArray(val) ||
(isObject(val) &&
(val.toString === objectToString || !isFunction(val.toString)))
? JSON.stringify(val, replacer, 2)

@@ -410,3 +499,7 @@ : String(val);

const replacer = (_key, val) => {
if (isMap(val)) {
// can't use isRef here since @vue/shared has no deps
if (val && val.__v_isRef) {
return replacer(_key, val.value);
}
else if (isMap(val)) {
return {

@@ -441,3 +534,3 @@ [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {

];
const EMPTY_OBJ = {};
const EMPTY_OBJ = {};
const EMPTY_ARR = [];

@@ -475,2 +568,3 @@ const NOOP = () => { };

const toRawType = (value) => {
// extract "RawType" from strings like "[object RawType]"
return toTypeString(value).slice(8, -1);

@@ -483,3 +577,5 @@ };

'' + parseInt(key, 10) === key;
const isReservedProp = /*#__PURE__*/ makeMap('key,ref,' +
const isReservedProp = /*#__PURE__*/ makeMap(
// the leading comma is intentional so empty string "" is also included
',key,ref,' +
'onVnodeBeforeMount,onVnodeMounted,' +

@@ -506,13 +602,13 @@ 'onVnodeBeforeUpdate,onVnodeUpdated,' +

*/
const hyphenate = cacheStringFunction((str) => {
return str.replace(hyphenateRE, '-$1').toLowerCase();
});
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
/**
* @private
*/
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
/**
* @private
*/
const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
// compare whether a value has changed, accounting for NaN.
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
const invokeArrayFns = (fns, arg) => {

@@ -567,2 +663,3 @@ for (let i = 0; i < fns.length; i++) {

exports.hyphenate = hyphenate;
exports.includeBooleanAttr = includeBooleanAttr;
exports.invokeArrayFns = invokeArrayFns;

@@ -575,3 +672,4 @@ exports.isArray = isArray;

exports.isIntegerKey = isIntegerKey;
exports.isKnownAttr = isKnownAttr;
exports.isKnownHtmlAttr = isKnownHtmlAttr;
exports.isKnownSvgAttr = isKnownSvgAttr;
exports.isMap = isMap;

@@ -592,6 +690,6 @@ exports.isModelListener = isModelListener;

exports.looseEqual = looseEqual;
exports.looseHas = looseHas;
exports.looseIndexOf = looseIndexOf;
exports.makeMap = makeMap;
exports.normalizeClass = normalizeClass;
exports.normalizeProps = normalizeProps;
exports.normalizeStyle = normalizeStyle;

@@ -603,6 +701,8 @@ exports.objectToString = objectToString;

exports.setExternGlobals = setExternGlobals;
exports.slotFlagsText = slotFlagsText;
exports.stringifyStyle = stringifyStyle;
exports.toDisplayString = toDisplayString;
exports.toHandlerKey = toHandlerKey;
exports.toNumber = toNumber;
exports.toRawType = toRawType;
exports.toTypeString = toTypeString;

@@ -1,2 +0,1 @@

/**

@@ -24,3 +23,3 @@ * List of @babel/parser plugins that are used for template expression

export declare const EMPTY_ARR: [];
export declare const EMPTY_ARR: readonly never[];

@@ -55,2 +54,8 @@ export declare const EMPTY_OBJ: {

/**
* Boolean attributes should be included if the value is truthy or ''.
* e.g. <select multiple> compiles to { multiple: '' }
*/
export declare function includeBooleanAttr(value: unknown): boolean;
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;

@@ -79,4 +84,9 @@

*/
export declare const isKnownAttr: (key: string) => boolean;
export declare const isKnownHtmlAttr: (key: string) => boolean;
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
*/
export declare const isKnownSvgAttr: (key: string) => boolean;
export declare const isMap: (val: unknown) => val is Map<any, any>;

@@ -115,4 +125,2 @@

export declare function looseHas(set: Set<any>, val: any): boolean;
export declare function looseIndexOf(arr: any[], val: any): number;

@@ -140,2 +148,4 @@

export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
export declare function normalizeStyle(value: unknown): NormalizedStyle | undefined;

@@ -147,2 +157,5 @@

/**
* dev only flag -> name mapping
*/
export declare const PatchFlagNames: {

@@ -152,16 +165,109 @@ [x: number]: string;

/**
* Patch flags are optimization hints generated by the compiler.
* when a block with dynamicChildren is encountered during diff, the algorithm
* enters "optimized mode". In this mode, we know that the vdom is produced by
* a render function generated by the compiler, so the algorithm only needs to
* handle updates explicitly marked by these patch flags.
*
* Patch flags can be combined using the | bitwise operator and can be checked
* using the & operator, e.g.
*
* ```js
* const flag = TEXT | CLASS
* if (flag & TEXT) { ... }
* ```
*
* Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the
* flags are handled during diff.
*/
export declare const enum PatchFlags {
/**
* Indicates an element with dynamic textContent (children fast path)
*/
TEXT = 1,
/**
* Indicates an element with dynamic class binding.
*/
CLASS = 2,
/**
* Indicates an element with dynamic style
* The compiler pre-compiles static string styles into static objects
* + detects and hoists inline static objects
* e.g. style="color: red" and :style="{ color: 'red' }" both get hoisted as
* const style = { color: 'red' }
* render() { return e('div', { style }) }
*/
STYLE = 4,
/**
* Indicates an element that has non-class/style dynamic props.
* Can also be on a component that has any dynamic props (includes
* class/style). when this flag is present, the vnode also has a dynamicProps
* array that contains the keys of the props that may change so the runtime
* can diff them faster (without having to worry about removed props)
*/
PROPS = 8,
/**
* Indicates an element with props with dynamic keys. When keys change, a full
* diff is always needed to remove the old key. This flag is mutually
* exclusive with CLASS, STYLE and PROPS.
*/
FULL_PROPS = 16,
/**
* Indicates an element with event listeners (which need to be attached
* during hydration)
*/
HYDRATE_EVENTS = 32,
/**
* Indicates a fragment whose children order doesn't change.
*/
STABLE_FRAGMENT = 64,
/**
* Indicates a fragment with keyed or partially keyed children
*/
KEYED_FRAGMENT = 128,
/**
* Indicates a fragment with unkeyed children.
*/
UNKEYED_FRAGMENT = 256,
/**
* Indicates an element that only needs non-props patching, e.g. ref or
* directives (onVnodeXXX hooks). since every patched vnode checks for refs
* and onVnodeXXX hooks, it simply marks the vnode so that a parent block
* will track it.
*/
NEED_PATCH = 512,
/**
* Indicates a component with dynamic slots (e.g. slot that references a v-for
* iterated value, or dynamic slot names).
* Components with this flag are always force updated.
*/
DYNAMIC_SLOTS = 1024,
ACTIVE_CLASS = 2048,
/**
* Indicates a fragment that was created only because the user has placed
* comments at the root level of a template. This is a dev-only flag since
* comments are stripped in production.
*/
DEV_ROOT_FRAGMENT = 4096,
FOCUSED_CLASS = 8192,
/**
* SPECIAL FLAGS -------------------------------------------------------------
* Special flags are negative integers. They are never matched against using
* bitwise operators (bitwise matching should only happen in branches where
* patchFlag > 0), and are mutually exclusive. When checking for a special
* flag, simply check patchFlag === FLAG.
*/
/**
* Indicates a hoisted static vnode. This is a hint for hydration to skip
* the entire sub tree since static content never needs to be updated.
*/
HOISTED = -1,
/**
* A special flag that indicates that the diffing algorithm should bail out
* of optimized mode. For example, on block fragments created by renderSlot()
* when encountering non-compiler generated slots (i.e. manually written
* render functions, which should always be fully diffed)
* OR manually cloneVNodes
*/
BAIL = -2

@@ -212,2 +318,11 @@ }

/**
* Dev only
*/
export declare const slotFlagsText: {
1: string;
2: string;
3: string;
};
export declare function stringifyStyle(styles: NormalizedStyle | undefined): string;

@@ -221,2 +336,7 @@

/**
* @private
*/
export declare const toHandlerKey: (str: string) => string;
export declare const toNumber: (val: any) => any;

@@ -223,0 +343,0 @@

@@ -17,8 +17,5 @@ /**

// Patch flags are optimization hints generated by the compiler.
// when a block with dynamicChildren is encountered during diff, the algorithm
// enters "optimized mode". In this mode, we know that the vdom is produced by
// a render function generated by the compiler, so the algorithm only needs to
// handle updates explicitly marked by these patch flags.
// dev only flag -> name mapping
/**
* dev only flag -> name mapping
*/
const PatchFlagNames = {

@@ -35,4 +32,5 @@ [1 /* TEXT */]: `TEXT`,

[256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
[512 /* NEED_PATCH */]: `NEED_PATCH`,
[1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
[512 /* NEED_PATCH */]: `NEED_PATCH`,
[4096 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
[-1 /* HOISTED */]: `HOISTED`,

@@ -42,5 +40,14 @@ [-2 /* BAIL */]: `BAIL`

/**
* Dev only
*/
const slotFlagsText = {
[1 /* STABLE */]: 'STABLE',
[2 /* DYNAMIC */]: 'DYNAMIC',
[3 /* FORWARDED */]: 'FORWARDED'
};
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,';
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
let EXTERN_GLOBALS_WHITE_LISTED = '';

@@ -58,7 +65,16 @@ let innerIsGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED + EXTERN_GLOBALS_WHITE_LISTED);

function generateCodeFrame(source, start = 0, end = source.length) {
const lines = source.split(/\r?\n/);
// Split the content into individual lines but capture the newline sequence
// that separated each line. This is important because the actual sequence is
// needed to properly take into account the full line length for offset
// comparison
let lines = source.split(/(\r?\n)/);
// Separate the lines and newline sequences into separate arrays for easier referencing
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
let count = 0;
const res = [];
for (let i = 0; i < lines.length; i++) {
count += lines[i].length + 1;
count +=
lines[i].length +
((newlineSequences[i] && newlineSequences[i].length) || 0);
if (count >= start) {

@@ -71,5 +87,6 @@ for (let j = i - range; j <= i + range || end > count; j++) {

const lineLength = lines[j].length;
const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;
if (j === i) {
// push underline
const pad = start - (count - lineLength) + 1;
const pad = start - (count - (lineLength + newLineSeqLength));
const length = Math.max(1, end > count ? lineLength - pad : end - start);

@@ -83,3 +100,3 @@ res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));

}
count += lineLength + 1;
count += lineLength + newLineSeqLength;
}

@@ -113,2 +130,9 @@ }

`checked,muted,multiple,selected`);
/**
* Boolean attributes should be included if the value is truthy or ''.
* e.g. <select multiple> compiles to { multiple: '' }
*/
function includeBooleanAttr(value) {
return !!value || value === '';
}
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;

@@ -150,3 +174,3 @@ const attrValidationCache = {};

*/
const isKnownAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +

@@ -166,2 +190,44 @@ `border,buffered,capture,challenge,charset,checked,cite,class,code,` +

`value,width,wrap`);
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
*/
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`);

@@ -173,3 +239,5 @@ function normalizeStyle(value) {

const item = value[i];
const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
const normalized = isString(item)
? parseStringStyle(item)
: normalizeStyle(item);
if (normalized) {

@@ -235,3 +303,4 @@ for (const key in normalized) {

// 一个存在一个不存在 或 都存在但长度不同
if (valueAms != valueBms || (valueAms && valueA.ms.length != valueB.ms.length)) {
if (valueAms != valueBms ||
(valueAms && valueA.ms.length != valueB.ms.length)) {
return false;

@@ -284,2 +353,27 @@ }

}
function normalizeProps(props) {
if (!props)
return null;
let { class: klass, 'active-class': activeClass, 'focused-class': focusedClass, style } = props;
// wangyan51: class.d可能是Array<Number>或Array<Array<Number>>,由normalizeClass处理成Array<Number>
// @ts-ignore
if (klass && klass.d) {
// @ts-ignore
props.class.d = normalizeClass(klass.d);
}
// @ts-ignore
if (activeClass && activeClass.d) {
// @ts-ignore
props['active-class'].d = normalizeClass(activeClass.d);
}
// @ts-ignore
if (focusedClass && focusedClass.d) {
// @ts-ignore
props['focused-class'].d = normalizeClass(focusedClass.d);
}
if (style) {
props.style = normalizeStyle(style);
}
return props;
}

@@ -384,9 +478,2 @@ // These tag configs are shared between compiler-dom and runtime-dom, so they

}
function looseHas(set, val) {
for (let item of set) {
if (looseEqual(item, val))
return true;
}
return false;
}

@@ -400,3 +487,5 @@ /**

? ''
: isObject(val)
: isArray(val) ||
(isObject(val) &&
(val.toString === objectToString || !isFunction(val.toString)))
? JSON.stringify(val, replacer, 2)

@@ -406,3 +495,7 @@ : String(val);

const replacer = (_key, val) => {
if (isMap(val)) {
// can't use isRef here since @vue/shared has no deps
if (val && val.__v_isRef) {
return replacer(_key, val.value);
}
else if (isMap(val)) {
return {

@@ -440,3 +533,3 @@ [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {

: {};
const EMPTY_ARR = [];
const EMPTY_ARR = (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
const NOOP = () => { };

@@ -473,2 +566,3 @@ /**

const toRawType = (value) => {
// extract "RawType" from strings like "[object RawType]"
return toTypeString(value).slice(8, -1);

@@ -481,3 +575,5 @@ };

'' + parseInt(key, 10) === key;
const isReservedProp = /*#__PURE__*/ makeMap('key,ref,' +
const isReservedProp = /*#__PURE__*/ makeMap(
// the leading comma is intentional so empty string "" is also included
',key,ref,' +
'onVnodeBeforeMount,onVnodeMounted,' +

@@ -504,13 +600,13 @@ 'onVnodeBeforeUpdate,onVnodeUpdated,' +

*/
const hyphenate = cacheStringFunction((str) => {
return str.replace(hyphenateRE, '-$1').toLowerCase();
});
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
/**
* @private
*/
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
/**
* @private
*/
const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
// compare whether a value has changed, accounting for NaN.
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
const invokeArrayFns = (fns, arg) => {

@@ -547,2 +643,2 @@ for (let i = 0; i < fns.length; i++) {

export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, babelParserDefaultPlugins, camelize, capitalize, compareClass, def, escapeHtml, escapeHtmlComment, extend, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, invokeArrayFns, isArray, isBooleanAttr, isDate, isFunction, isGloballyWhitelisted, isIntegerKey, isKnownAttr, isMap, isModelListener, isNoUnitNumericStyleProp, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseHas, looseIndexOf, makeMap, normalizeClass, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, setExternGlobals, stringifyStyle, toDisplayString, toNumber, toRawType, toTypeString };
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, babelParserDefaultPlugins, camelize, capitalize, compareClass, def, escapeHtml, escapeHtmlComment, extend, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isDate, isFunction, isGloballyWhitelisted, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isNoUnitNumericStyleProp, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, setExternGlobals, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
{
"name": "@atom-vue/shared",
"version": "3.0.0-beta.47",
"version": "3.0.0-beta.48",
"description": "internal utils shared across @vue packages",

@@ -5,0 +5,0 @@ "main": "index.js",