@vue/shared
Advanced tools
Comparing version 3.0.0-beta.9 to 3.0.0-beta.10
@@ -165,14 +165,18 @@ 'use strict'; | ||
// On the client we only need to offer special cases for boolean attributes that | ||
// have different names from their corresponding dom properties: | ||
// - itemscope -> N/A | ||
// - allowfullscreen -> allowFullscreen | ||
// - formnovalidate -> formNoValidate | ||
// - ismap -> isMap | ||
// - nomodule -> noModule | ||
// - novalidate -> noValidate | ||
// - readonly -> readOnly | ||
/** | ||
* On the client we only need to offer special cases for boolean attributes that | ||
* have different names from their corresponding dom properties: | ||
* - itemscope -> N/A | ||
* - allowfullscreen -> allowFullscreen | ||
* - formnovalidate -> formNoValidate | ||
* - ismap -> isMap | ||
* - nomodule -> noModule | ||
* - novalidate -> noValidate | ||
* - readonly -> readOnly | ||
*/ | ||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | ||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs); | ||
// The full list is needed during SSR to produce the correct initial markup. | ||
/** | ||
* The full list is needed during SSR to produce the correct initial markup. | ||
*/ | ||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs + | ||
@@ -200,3 +204,5 @@ `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` + | ||
}; | ||
// CSS properties that accept plain numbers | ||
/** | ||
* CSS properties that accept plain numbers | ||
*/ | ||
const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` + | ||
@@ -211,2 +217,23 @@ `border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` + | ||
`stroke-miterlimit,stroke-opacity,stroke-width`); | ||
/** | ||
* Known attributes, this is used for stringification of runtime static nodes | ||
* so that we don't stringify bindings that cannot be set from HTML. | ||
* Don't also forget to allow `data-*` and `aria-*`! | ||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | ||
*/ | ||
const isKnownAttr = /*#__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,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`); | ||
@@ -217,3 +244,4 @@ function normalizeStyle(value) { | ||
for (let i = 0; i < value.length; i++) { | ||
const normalized = normalizeStyle(value[i]); | ||
const item = value[i]; | ||
const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item); | ||
if (normalized) { | ||
@@ -231,2 +259,14 @@ for (const key in normalized) { | ||
} | ||
const listDelimiterRE = /;(?![^(]*\))/g; | ||
const propertyDelimiterRE = /:(.+)/; | ||
function parseStringStyle(cssText) { | ||
const ret = {}; | ||
cssText.split(listDelimiterRE).forEach(item => { | ||
if (item) { | ||
const tmp = item.split(propertyDelimiterRE); | ||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | ||
} | ||
}); | ||
return ret; | ||
} | ||
function stringifyStyle(styles) { | ||
@@ -506,2 +546,3 @@ let ret = ''; | ||
exports.isHTMLTag = isHTMLTag; | ||
exports.isKnownAttr = isKnownAttr; | ||
exports.isNoUnitNumericStyleProp = isNoUnitNumericStyleProp; | ||
@@ -527,2 +568,3 @@ exports.isObject = isObject; | ||
exports.objectToString = objectToString; | ||
exports.parseStringStyle = parseStringStyle; | ||
exports.propsToAttrMap = propsToAttrMap; | ||
@@ -529,0 +571,0 @@ exports.remove = remove; |
@@ -165,14 +165,18 @@ 'use strict'; | ||
// On the client we only need to offer special cases for boolean attributes that | ||
// have different names from their corresponding dom properties: | ||
// - itemscope -> N/A | ||
// - allowfullscreen -> allowFullscreen | ||
// - formnovalidate -> formNoValidate | ||
// - ismap -> isMap | ||
// - nomodule -> noModule | ||
// - novalidate -> noValidate | ||
// - readonly -> readOnly | ||
/** | ||
* On the client we only need to offer special cases for boolean attributes that | ||
* have different names from their corresponding dom properties: | ||
* - itemscope -> N/A | ||
* - allowfullscreen -> allowFullscreen | ||
* - formnovalidate -> formNoValidate | ||
* - ismap -> isMap | ||
* - nomodule -> noModule | ||
* - novalidate -> noValidate | ||
* - readonly -> readOnly | ||
*/ | ||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | ||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs); | ||
// The full list is needed during SSR to produce the correct initial markup. | ||
/** | ||
* The full list is needed during SSR to produce the correct initial markup. | ||
*/ | ||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs + | ||
@@ -200,3 +204,5 @@ `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` + | ||
}; | ||
// CSS properties that accept plain numbers | ||
/** | ||
* CSS properties that accept plain numbers | ||
*/ | ||
const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` + | ||
@@ -211,2 +217,23 @@ `border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` + | ||
`stroke-miterlimit,stroke-opacity,stroke-width`); | ||
/** | ||
* Known attributes, this is used for stringification of runtime static nodes | ||
* so that we don't stringify bindings that cannot be set from HTML. | ||
* Don't also forget to allow `data-*` and `aria-*`! | ||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | ||
*/ | ||
const isKnownAttr = /*#__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,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`); | ||
@@ -217,3 +244,4 @@ function normalizeStyle(value) { | ||
for (let i = 0; i < value.length; i++) { | ||
const normalized = normalizeStyle(value[i]); | ||
const item = value[i]; | ||
const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item); | ||
if (normalized) { | ||
@@ -231,2 +259,14 @@ for (const key in normalized) { | ||
} | ||
const listDelimiterRE = /;(?![^(]*\))/g; | ||
const propertyDelimiterRE = /:(.+)/; | ||
function parseStringStyle(cssText) { | ||
const ret = {}; | ||
cssText.split(listDelimiterRE).forEach(item => { | ||
if (item) { | ||
const tmp = item.split(propertyDelimiterRE); | ||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | ||
} | ||
}); | ||
return ret; | ||
} | ||
function stringifyStyle(styles) { | ||
@@ -505,2 +545,3 @@ let ret = ''; | ||
exports.isHTMLTag = isHTMLTag; | ||
exports.isKnownAttr = isKnownAttr; | ||
exports.isNoUnitNumericStyleProp = isNoUnitNumericStyleProp; | ||
@@ -526,2 +567,3 @@ exports.isObject = isObject; | ||
exports.objectToString = objectToString; | ||
exports.parseStringStyle = parseStringStyle; | ||
exports.propsToAttrMap = propsToAttrMap; | ||
@@ -528,0 +570,0 @@ exports.remove = remove; |
@@ -32,2 +32,5 @@ | ||
/** | ||
* The full list is needed during SSR to produce the correct initial markup. | ||
*/ | ||
export declare const isBooleanAttr: (key: string) => boolean; | ||
@@ -41,2 +44,13 @@ | ||
/** | ||
* Known attributes, this is used for stringification of runtime static nodes | ||
* so that we don't stringify bindings that cannot be set from HTML. | ||
* Don't also forget to allow `data-*` and `aria-*`! | ||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | ||
*/ | ||
export declare const isKnownAttr: (key: string) => boolean; | ||
/** | ||
* CSS properties that accept plain numbers | ||
*/ | ||
export declare const isNoUnitNumericStyleProp: (key: string) => boolean; | ||
@@ -85,6 +99,10 @@ | ||
export declare function normalizeStyle(value: unknown): Record<string, string | number> | undefined; | ||
export declare type NormalizedStyle = Record<string, string | number>; | ||
export declare function normalizeStyle(value: unknown): NormalizedStyle | undefined; | ||
export declare const objectToString: () => string; | ||
export declare function parseStringStyle(cssText: string): NormalizedStyle; | ||
export declare const PatchFlagNames: { | ||
@@ -128,3 +146,3 @@ [x: number]: string; | ||
export declare function stringifyStyle(styles: Record<string, string | number> | undefined): string; | ||
export declare function stringifyStyle(styles: NormalizedStyle | undefined): string; | ||
@@ -131,0 +149,0 @@ export declare const toDisplayString: (val: unknown) => string; |
@@ -161,14 +161,18 @@ // Make a map and return a function for checking if a key | ||
// On the client we only need to offer special cases for boolean attributes that | ||
// have different names from their corresponding dom properties: | ||
// - itemscope -> N/A | ||
// - allowfullscreen -> allowFullscreen | ||
// - formnovalidate -> formNoValidate | ||
// - ismap -> isMap | ||
// - nomodule -> noModule | ||
// - novalidate -> noValidate | ||
// - readonly -> readOnly | ||
/** | ||
* On the client we only need to offer special cases for boolean attributes that | ||
* have different names from their corresponding dom properties: | ||
* - itemscope -> N/A | ||
* - allowfullscreen -> allowFullscreen | ||
* - formnovalidate -> formNoValidate | ||
* - ismap -> isMap | ||
* - nomodule -> noModule | ||
* - novalidate -> noValidate | ||
* - readonly -> readOnly | ||
*/ | ||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | ||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs); | ||
// The full list is needed during SSR to produce the correct initial markup. | ||
/** | ||
* The full list is needed during SSR to produce the correct initial markup. | ||
*/ | ||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs + | ||
@@ -196,3 +200,5 @@ `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` + | ||
}; | ||
// CSS properties that accept plain numbers | ||
/** | ||
* CSS properties that accept plain numbers | ||
*/ | ||
const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` + | ||
@@ -207,2 +213,23 @@ `border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` + | ||
`stroke-miterlimit,stroke-opacity,stroke-width`); | ||
/** | ||
* Known attributes, this is used for stringification of runtime static nodes | ||
* so that we don't stringify bindings that cannot be set from HTML. | ||
* Don't also forget to allow `data-*` and `aria-*`! | ||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | ||
*/ | ||
const isKnownAttr = /*#__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,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`); | ||
@@ -213,3 +240,4 @@ function normalizeStyle(value) { | ||
for (let i = 0; i < value.length; i++) { | ||
const normalized = normalizeStyle(value[i]); | ||
const item = value[i]; | ||
const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item); | ||
if (normalized) { | ||
@@ -227,2 +255,14 @@ for (const key in normalized) { | ||
} | ||
const listDelimiterRE = /;(?![^(]*\))/g; | ||
const propertyDelimiterRE = /:(.+)/; | ||
function parseStringStyle(cssText) { | ||
const ret = {}; | ||
cssText.split(listDelimiterRE).forEach(item => { | ||
if (item) { | ||
const tmp = item.split(propertyDelimiterRE); | ||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | ||
} | ||
}); | ||
return ret; | ||
} | ||
function stringifyStyle(styles) { | ||
@@ -482,2 +522,2 @@ let ret = ''; | ||
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, generateCodeFrame, hasChanged, hasOwn, hyphenate, invokeArrayFns, isArray, isBooleanAttr, isFunction, isGloballyWhitelisted, isHTMLTag, isNoUnitNumericStyleProp, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSVGTag, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, mockError, mockWarn, normalizeClass, normalizeStyle, objectToString, propsToAttrMap, remove, stringifyStyle, toDisplayString, toRawType, toTypeString }; | ||
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, generateCodeFrame, hasChanged, hasOwn, hyphenate, invokeArrayFns, isArray, isBooleanAttr, isFunction, isGloballyWhitelisted, isHTMLTag, isKnownAttr, isNoUnitNumericStyleProp, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSVGTag, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, mockError, mockWarn, normalizeClass, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, stringifyStyle, toDisplayString, toRawType, toTypeString }; |
{ | ||
"name": "@vue/shared", | ||
"version": "3.0.0-beta.9", | ||
"version": "3.0.0-beta.10", | ||
"description": "internal utils shared across @vue packages", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
68339
1718