@kuma-ui/sheet
Advanced tools
Comparing version 0.0.0-dev-20230824171415 to 0.0.0-dev-20230825122324
@@ -6,2 +6,2 @@ export { SystemStyle, sheet } from './sheet.js'; | ||
export { generateHash } from './hash.js'; | ||
export { cssPropertyRegex, removeSpacesExceptInPropertiesRegex } from './regex.js'; | ||
export { removeSpacesAroundCssPropertyValues, removeSpacesExceptInProperties } from './regex.js'; |
@@ -28,5 +28,5 @@ "use strict"; | ||
__export(src_exports, { | ||
cssPropertyRegex: () => cssPropertyRegex, | ||
generateHash: () => generateHash, | ||
removeSpacesExceptInPropertiesRegex: () => removeSpacesExceptInPropertiesRegex, | ||
removeSpacesAroundCssPropertyValues: () => removeSpacesAroundCssPropertyValues, | ||
removeSpacesExceptInProperties: () => removeSpacesExceptInProperties, | ||
sheet: () => sheet, | ||
@@ -61,4 +61,10 @@ styleCache: () => styleCache, | ||
// src/regex.ts | ||
var cssPropertyRegex = /(?<=:)\s+|\s+(?=;)/g; | ||
var removeSpacesExceptInPropertiesRegex = /(?<=:)\s+|\s+(?=;)|(?<=\{)\s+|\s+(?=\})|(?<=,)\s+|\s+(?=,)|\s+(?={)/g; | ||
var removeSpacesAroundCssPropertyValues = (css) => { | ||
const regex = /(:)\s+|\s+(?=;)/g; | ||
return css.replace(regex, "$1"); | ||
}; | ||
var removeSpacesExceptInProperties = (css) => { | ||
const regex = /(:)\s+|\s+(?=;)|(\{)\s+|\s+(?=\})|(,)\s+|\s+(?=,)|\s+(?={)/g; | ||
return css.replace(regex, "$1$2$3"); | ||
}; | ||
@@ -102,10 +108,9 @@ // src/sheet.ts | ||
_addBaseRule(className, css) { | ||
css = css.replace(cssPropertyRegex, ""); | ||
this.base.push(`.${className}{${css}}`); | ||
const minifiedCss = removeSpacesAroundCssPropertyValues(css); | ||
this.base.push(`.${className}{${minifiedCss}}`); | ||
} | ||
_addMediaRule(className, css, breakpoint) { | ||
css = css.replace(cssPropertyRegex, ""); | ||
const mediaCss = `@media (min-width: ${breakpoint}) { .${className} { ${css} } }`.replace( | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
const minifiedCss = removeSpacesAroundCssPropertyValues(css); | ||
const mediaCss = removeSpacesExceptInProperties( | ||
`@media (min-width: ${breakpoint}) { .${className} { ${minifiedCss} } }` | ||
); | ||
@@ -115,6 +120,5 @@ this.responsive.push(mediaCss); | ||
_addPseudoRule(className, pseudo) { | ||
const css = pseudo.base.replace(cssPropertyRegex, ""); | ||
const pseudoCss = `.${className}${pseudo.key} { ${css} }`.replace( | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
const css = removeSpacesAroundCssPropertyValues(pseudo.base); | ||
const pseudoCss = removeSpacesExceptInProperties( | ||
`.${className}${pseudo.key} { ${css} }` | ||
); | ||
@@ -283,5 +287,5 @@ this.pseudo.push(pseudoCss); | ||
0 && (module.exports = { | ||
cssPropertyRegex, | ||
generateHash, | ||
removeSpacesExceptInPropertiesRegex, | ||
removeSpacesAroundCssPropertyValues, | ||
removeSpacesExceptInProperties, | ||
sheet, | ||
@@ -288,0 +292,0 @@ styleCache, |
@@ -1,4 +0,4 @@ | ||
declare const cssPropertyRegex: RegExp; | ||
declare const removeSpacesExceptInPropertiesRegex: RegExp; | ||
declare const removeSpacesAroundCssPropertyValues: (css: string) => string; | ||
declare const removeSpacesExceptInProperties: (css: string) => string; | ||
export { cssPropertyRegex, removeSpacesExceptInPropertiesRegex }; | ||
export { removeSpacesAroundCssPropertyValues, removeSpacesExceptInProperties }; |
@@ -23,12 +23,18 @@ "use strict"; | ||
__export(regex_exports, { | ||
cssPropertyRegex: () => cssPropertyRegex, | ||
removeSpacesExceptInPropertiesRegex: () => removeSpacesExceptInPropertiesRegex | ||
removeSpacesAroundCssPropertyValues: () => removeSpacesAroundCssPropertyValues, | ||
removeSpacesExceptInProperties: () => removeSpacesExceptInProperties | ||
}); | ||
module.exports = __toCommonJS(regex_exports); | ||
var cssPropertyRegex = /(?<=:)\s+|\s+(?=;)/g; | ||
var removeSpacesExceptInPropertiesRegex = /(?<=:)\s+|\s+(?=;)|(?<=\{)\s+|\s+(?=\})|(?<=,)\s+|\s+(?=,)|\s+(?={)/g; | ||
var removeSpacesAroundCssPropertyValues = (css) => { | ||
const regex = /(:)\s+|\s+(?=;)/g; | ||
return css.replace(regex, "$1"); | ||
}; | ||
var removeSpacesExceptInProperties = (css) => { | ||
const regex = /(:)\s+|\s+(?=;)|(\{)\s+|\s+(?=\})|(,)\s+|\s+(?=,)|\s+(?={)/g; | ||
return css.replace(regex, "$1$2$3"); | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
cssPropertyRegex, | ||
removeSpacesExceptInPropertiesRegex | ||
removeSpacesAroundCssPropertyValues, | ||
removeSpacesExceptInProperties | ||
}); |
@@ -159,4 +159,10 @@ "use strict"; | ||
// src/regex.ts | ||
var cssPropertyRegex = /(?<=:)\s+|\s+(?=;)/g; | ||
var removeSpacesExceptInPropertiesRegex = /(?<=:)\s+|\s+(?=;)|(?<=\{)\s+|\s+(?=\})|(?<=,)\s+|\s+(?=,)|\s+(?={)/g; | ||
var removeSpacesAroundCssPropertyValues = (css) => { | ||
const regex = /(:)\s+|\s+(?=;)/g; | ||
return css.replace(regex, "$1"); | ||
}; | ||
var removeSpacesExceptInProperties = (css) => { | ||
const regex = /(:)\s+|\s+(?=;)|(\{)\s+|\s+(?=\})|(,)\s+|\s+(?=,)|\s+(?={)/g; | ||
return css.replace(regex, "$1$2$3"); | ||
}; | ||
@@ -200,10 +206,9 @@ // src/sheet.ts | ||
_addBaseRule(className, css) { | ||
css = css.replace(cssPropertyRegex, ""); | ||
this.base.push(`.${className}{${css}}`); | ||
const minifiedCss = removeSpacesAroundCssPropertyValues(css); | ||
this.base.push(`.${className}{${minifiedCss}}`); | ||
} | ||
_addMediaRule(className, css, breakpoint) { | ||
css = css.replace(cssPropertyRegex, ""); | ||
const mediaCss = `@media (min-width: ${breakpoint}) { .${className} { ${css} } }`.replace( | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
const minifiedCss = removeSpacesAroundCssPropertyValues(css); | ||
const mediaCss = removeSpacesExceptInProperties( | ||
`@media (min-width: ${breakpoint}) { .${className} { ${minifiedCss} } }` | ||
); | ||
@@ -213,6 +218,5 @@ this.responsive.push(mediaCss); | ||
_addPseudoRule(className, pseudo) { | ||
const css = pseudo.base.replace(cssPropertyRegex, ""); | ||
const pseudoCss = `.${className}${pseudo.key} { ${css} }`.replace( | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
const css = removeSpacesAroundCssPropertyValues(pseudo.base); | ||
const pseudoCss = removeSpacesExceptInProperties( | ||
`.${className}${pseudo.key} { ${css} }` | ||
); | ||
@@ -219,0 +223,0 @@ this.pseudo.push(pseudoCss); |
{ | ||
"name": "@kuma-ui/sheet", | ||
"version": "0.0.0-dev-20230824171415", | ||
"version": "0.0.0-dev-20230825122324", | ||
"description": "🐻 Kuma UI is a utility-first, zero-runtime CSS-in-JS library that offers an outstanding developer experience and optimized performance.", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
44347
1362