@kuma-ui/sheet
Advanced tools
Comparing version 0.0.2 to 0.0.3
export { sheet } from "./sheet"; | ||
export { theme } from "./theme"; | ||
export * from "./regex"; |
@@ -28,2 +28,4 @@ "use strict"; | ||
__export(src_exports, { | ||
cssPropertyRegex: () => cssPropertyRegex, | ||
removeSpacesExceptInPropertiesRegex: () => removeSpacesExceptInPropertiesRegex, | ||
sheet: () => sheet, | ||
@@ -55,2 +57,6 @@ theme: () => theme | ||
// src/regex.ts | ||
var cssPropertyRegex = /(?<=:)\s+|\s+(?=;)/g; | ||
var removeSpacesExceptInPropertiesRegex = /(?<=:)\s+|\s+(?=;)|(?<=\{)\s+|\s+(?=\})|(?<=,)\s+|\s+(?=,)|\s+(?={)/g; | ||
// src/sheet.ts | ||
@@ -75,3 +81,3 @@ var _Sheet = class { | ||
addRule(css) { | ||
css = css.replace(/\s/g, ""); | ||
css = css.replace(cssPropertyRegex, ""); | ||
const id = "kuma-" + generateHash(css); | ||
@@ -84,4 +90,5 @@ const existingRule = this.rules.find((rule) => rule.id === id); | ||
addMediaRule(className, css, breakpoint) { | ||
css = css.replace(cssPropertyRegex, ""); | ||
const mediaCss = `@media (min-width: ${breakpoint}) { .${className} { ${css} } }`.replace( | ||
/\s/g, | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
@@ -92,3 +99,7 @@ ); | ||
addPseudoRule(className, css, pseudo) { | ||
const pseudoCss = `.${className}${pseudo} { ${css} }`.replace(/\s/g, ""); | ||
css = css.replace(cssPropertyRegex, ""); | ||
const pseudoCss = `.${className}${pseudo} { ${css} }`.replace( | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
); | ||
this.pseudo.push(pseudoCss); | ||
@@ -113,3 +124,3 @@ } | ||
this.removeDuplicates(); | ||
return this.rules.map((rule) => `.${rule.id} {${rule.css}}`).join("\n").replace(/\s/g, "") + this.responsive.join("") + this.pseudo.join(""); | ||
return this.rules.map((rule) => `.${rule.id} {${rule.css}}`).join("\n").replace(cssPropertyRegex, "") + this.responsive.join("") + this.pseudo.join(""); | ||
} | ||
@@ -165,4 +176,6 @@ getFromCache(key) { | ||
0 && (module.exports = { | ||
cssPropertyRegex, | ||
removeSpacesExceptInPropertiesRegex, | ||
sheet, | ||
theme | ||
}); |
@@ -54,2 +54,6 @@ "use strict"; | ||
// src/regex.ts | ||
var cssPropertyRegex = /(?<=:)\s+|\s+(?=;)/g; | ||
var removeSpacesExceptInPropertiesRegex = /(?<=:)\s+|\s+(?=;)|(?<=\{)\s+|\s+(?=\})|(?<=,)\s+|\s+(?=,)|\s+(?={)/g; | ||
// src/sheet.ts | ||
@@ -74,3 +78,3 @@ var _Sheet = class { | ||
addRule(css) { | ||
css = css.replace(/\s/g, ""); | ||
css = css.replace(cssPropertyRegex, ""); | ||
const id = "kuma-" + generateHash(css); | ||
@@ -83,4 +87,5 @@ const existingRule = this.rules.find((rule) => rule.id === id); | ||
addMediaRule(className, css, breakpoint) { | ||
css = css.replace(cssPropertyRegex, ""); | ||
const mediaCss = `@media (min-width: ${breakpoint}) { .${className} { ${css} } }`.replace( | ||
/\s/g, | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
@@ -91,3 +96,7 @@ ); | ||
addPseudoRule(className, css, pseudo) { | ||
const pseudoCss = `.${className}${pseudo} { ${css} }`.replace(/\s/g, ""); | ||
css = css.replace(cssPropertyRegex, ""); | ||
const pseudoCss = `.${className}${pseudo} { ${css} }`.replace( | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
); | ||
this.pseudo.push(pseudoCss); | ||
@@ -112,3 +121,3 @@ } | ||
this.removeDuplicates(); | ||
return this.rules.map((rule) => `.${rule.id} {${rule.css}}`).join("\n").replace(/\s/g, "") + this.responsive.join("") + this.pseudo.join(""); | ||
return this.rules.map((rule) => `.${rule.id} {${rule.css}}`).join("\n").replace(cssPropertyRegex, "") + this.responsive.join("") + this.pseudo.join(""); | ||
} | ||
@@ -115,0 +124,0 @@ getFromCache(key) { |
@@ -30,2 +30,6 @@ "use strict"; | ||
// src/regex.ts | ||
var cssPropertyRegex = /(?<=:)\s+|\s+(?=;)/g; | ||
var removeSpacesExceptInPropertiesRegex = /(?<=:)\s+|\s+(?=;)|(?<=\{)\s+|\s+(?=\})|(?<=,)\s+|\s+(?=,)|\s+(?={)/g; | ||
// src/sheet.ts | ||
@@ -50,3 +54,3 @@ var _Sheet = class { | ||
addRule(css) { | ||
css = css.replace(/\s/g, ""); | ||
css = css.replace(cssPropertyRegex, ""); | ||
const id = "kuma-" + generateHash(css); | ||
@@ -59,4 +63,5 @@ const existingRule = this.rules.find((rule) => rule.id === id); | ||
addMediaRule(className, css, breakpoint) { | ||
css = css.replace(cssPropertyRegex, ""); | ||
const mediaCss = `@media (min-width: ${breakpoint}) { .${className} { ${css} } }`.replace( | ||
/\s/g, | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
@@ -67,3 +72,7 @@ ); | ||
addPseudoRule(className, css, pseudo) { | ||
const pseudoCss = `.${className}${pseudo} { ${css} }`.replace(/\s/g, ""); | ||
css = css.replace(cssPropertyRegex, ""); | ||
const pseudoCss = `.${className}${pseudo} { ${css} }`.replace( | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
); | ||
this.pseudo.push(pseudoCss); | ||
@@ -88,3 +97,3 @@ } | ||
this.removeDuplicates(); | ||
return this.rules.map((rule) => `.${rule.id} {${rule.css}}`).join("\n").replace(/\s/g, "") + this.responsive.join("") + this.pseudo.join(""); | ||
return this.rules.map((rule) => `.${rule.id} {${rule.css}}`).join("\n").replace(cssPropertyRegex, "") + this.responsive.join("") + this.pseudo.join(""); | ||
} | ||
@@ -107,3 +116,3 @@ getFromCache(key) { | ||
// ../../node_modules/@jest/globals/build/index.js | ||
// ../../node_modules/.pnpm/@jest+globals@29.5.0/node_modules/@jest/globals/build/index.js | ||
throw new Error( | ||
@@ -135,3 +144,5 @@ "Do not import `@jest/globals` outside of the Jest test environment" | ||
sheet.addMediaRule(className, css, breakpoint); | ||
(void 0)(sheet.getCSS()).toContain(mediaCss.replace(/\s/g, "")); | ||
(void 0)(sheet.getCSS()).toContain( | ||
mediaCss.replace(removeSpacesExceptInPropertiesRegex, "") | ||
); | ||
}); | ||
@@ -142,3 +153,6 @@ (void 0)("addPseudoRule() should add a new pseudo rule with a generated ID", () => { | ||
const pseudo = ":hover"; | ||
const pseudoCss = `.${className}${pseudo} { ${css} }`.replace(/\s/g, ""); | ||
const pseudoCss = `.${className}${pseudo} { ${css} }`.replace( | ||
removeSpacesExceptInPropertiesRegex, | ||
"" | ||
); | ||
sheet.addPseudoRule(className, css, pseudo); | ||
@@ -151,3 +165,5 @@ (void 0)(sheet.getCSS()).toContain(pseudoCss); | ||
const cssString = sheet.getCSS(); | ||
(void 0)(cssString).toContain(`.${id} {${css}}`.replace(/\s/g, "")); | ||
(void 0)(cssString).toContain( | ||
`.${id} {${css}}`.replace(cssPropertyRegex, "") | ||
); | ||
}); | ||
@@ -154,0 +170,0 @@ (void 0)("getFromCache() should return undefined if no value is cached for the given key", () => { |
@@ -41,3 +41,3 @@ "use strict"; | ||
// ../../node_modules/@jest/globals/build/index.js | ||
// ../../node_modules/.pnpm/@jest+globals@29.5.0/node_modules/@jest/globals/build/index.js | ||
throw new Error( | ||
@@ -44,0 +44,0 @@ "Do not import `@jest/globals` outside of the Jest test environment" |
{ | ||
"name": "@kuma-ui/sheet", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "🐻 Kuma UI is a utility-first, zero-runtime CSS-in-JS library that offers an outstanding developer experience and optimized performance.", | ||
@@ -27,3 +27,2 @@ "repository": { | ||
"scripts": { | ||
"test": "jest --config ../../jest.config.ts --rootDir .", | ||
"build": "yarn build:dist && yarn build:declarations", | ||
@@ -30,0 +29,0 @@ "build:declarations": "tsc --emitDeclarationOnly --outDir dist", |
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
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
46322
35
1466
1
94