From 3864815ef136a8b95c7a871fbd69bb37a05583d0 Mon Sep 17 00:00:00 2001 From: frankpagan Date: Fri, 31 May 2024 08:18:35 -0500 Subject: [PATCH 1/5] fix: svg icon class --- demo/atomic-css.html | 40 +++++++++++----------------------------- demo/test.html | 18 +++++------------- docs/index.html | 40 +++++++++++----------------------------- 3 files changed, 27 insertions(+), 71 deletions(-) diff --git a/demo/atomic-css.html b/demo/atomic-css.html index 3f14f6d..21835fe 100644 --- a/demo/atomic-css.html +++ b/demo/atomic-css.html @@ -57,41 +57,31 @@

CoCreate helper CSS

href="https://github.com/CoCreate-app/CoCreateCSS" target="_blank" class="margin-right:15px" - > @@ -114,9 +104,7 @@

Reference

@@ -1004,9 +992,7 @@

Demo

@@ -1050,7 +1036,7 @@

Demo

toggle="code-height" toggle-selector="#demo-code" >

Demo

hide="#eye-slash" toggle="code-height" toggle-selector="#demo-code" - >

Demo

show="#code, #demo-code" hide="#code-slash" >

SPREAD THE WORD!

href="https://twitter.com/CoCreate_App" target="_blank" class="margin:15px color:white" - >
diff --git a/docs/index.html b/docs/index.html index 824a23e..0a6d853 100644 --- a/docs/index.html +++ b/docs/index.html @@ -91,43 +91,33 @@

CoCreate utility CSS

class="margin-right:15px" share-network="twitter" title="Share on twitter" - > @@ -153,9 +143,7 @@

Usage

@@ -1048,9 +1036,7 @@

Demo

@@ -1094,7 +1080,7 @@

Demo

toggle="code-height" toggle-selector="#demo-code" >

Demo

hide="#eye-slash" toggle="code-height" toggle-selector="#demo-code" - >

Demo

show="#code, #demo-code" hide="#code-slash" >
Date: Sat, 8 Jun 2024 14:51:34 -0500 Subject: [PATCH 2/5] fix: handling dark and light mode --- src/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index a01b9de..084b3c4 100644 --- a/src/index.js +++ b/src/index.js @@ -230,8 +230,9 @@ function createThemeRule(className) { rule = `.${property}\\:${suffix}\\@${theme} { ${property}: ${value}; }`; } if (theme == 'dark' || theme == 'light') { - rule = `[theme="${theme}"] ${rule}`; - let reverseRule = `html:not([theme="${themes[1 - themes.indexOf(theme)]}"]) ${rule}`; + // rule = `[theme="${theme}"] ${rule}`; + // let reverseRule = `html:not([theme="${themes[1 - themes.indexOf(theme)]}"]) ${rule}`; + let reverseRule = `${rule}`; tempStyleList.push(rule); themeCSS[theme].push(reverseRule); classNameList.set(classname, true); From 70781057f761557080360535d9ba47ef7aee8e67 Mon Sep 17 00:00:00 2001 From: frankpagan Date: Sun, 9 Jun 2024 15:45:10 -0500 Subject: [PATCH 3/5] fix: Handlig importan in theme rules --- src/index.js | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/index.js b/src/index.js index 084b3c4..f9b6118 100644 --- a/src/index.js +++ b/src/index.js @@ -208,40 +208,49 @@ function createThemeRule(className) { theme = theme[0]; pseudo.shift(); } + let important = ""; + let importantSuffix = ""; + if (className.includes('!important')) { + [className, important] = className.split("!"); + important = '!' + important; + importantSuffix = parseValue(important); + important = '!important'; + } let res = className.split(':'); - if (res.length > 2) { - console.log('pseudo names need to be added after theme'); - return; - } + // if (res.length > 2) { + // console.log('pseudo names need to be added after theme'); + // return; + // } let property = res[0]; let suffix = parseValue(res[1]); let value = res[1].replace(/_/g, " "); + //TODO: set theme rule with pseudo and !important let rule = ""; - if (pseudo) { - suffix += "\\@" + theme; - for (let i = 0; i < pseudo.length; i++) { - suffix += ":" + pseudo[0 + i]; - } - rule = `.${property}\\:${suffix} { ${property}: ${value}; }`; - } - else { + if (res.length > 2) { + // suffix += "\\@" + theme; + // for (let i = 0; i < res.length - 2; i++) { + suffix += "\\:" + res[2] + importantSuffix + ":" + "\\@" + theme + ":" + res[2]; + // } + rule = `.${property}\\:${suffix} { ${property}: ${value}${important}; }`; + } else { rule = `.${property}\\:${suffix}\\@${theme} { ${property}: ${value}; }`; } + if (theme == 'dark' || theme == 'light') { // rule = `[theme="${theme}"] ${rule}`; // let reverseRule = `html:not([theme="${themes[1 - themes.indexOf(theme)]}"]) ${rule}`; - let reverseRule = `${rule}`; - tempStyleList.push(rule); - themeCSS[theme].push(reverseRule); + // let reverseRule = `${rule}`; + // tempStyleList.push(rule); + themeCSS[theme].push(rule); classNameList.set(classname, true); } } function createThemeMedia() { - let initial; if (themeCSS.dark.length) { + let initial; initial = "@media (prefers-color-scheme: dark) {"; for (let c of themeCSS.dark) { initial += c + "\n"; @@ -251,6 +260,7 @@ function createThemeMedia() { themeCSS.dark = []; } if (themeCSS.light.length) { + let initial; initial = "@media (prefers-color-scheme: light) {"; for (let c of themeCSS.light) { initial += c + "\n"; From ea1b6fca49f2dc55cceba26f4419efbfa76f4f79 Mon Sep 17 00:00:00 2001 From: frankpagan Date: Wed, 12 Jun 2024 18:26:06 -0500 Subject: [PATCH 4/5] fix: bump cocreate dependencies --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f10858e..277eb6c 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "webpack-log": "^3.0.1" }, "dependencies": { - "@cocreate/local-storage": "^1.14.3", - "@cocreate/observer": "^1.16.0" + "@cocreate/local-storage": "^1.15.0", + "@cocreate/observer": "^1.16.1" } -} +} \ No newline at end of file From 40d20a0f97521cb1aac95dde51df17d1455f0980 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 12 Jun 2024 23:35:03 +0000 Subject: [PATCH 5/5] chore(release): 1.14.5 [skip ci] ## [1.14.5](https://github.com/CoCreate-app/CoCreate-css-parser/compare/v1.14.4...v1.14.5) (2024-06-12) ### Bug Fixes * bump cocreate dependencies ([ea1b6fc](https://github.com/CoCreate-app/CoCreate-css-parser/commit/ea1b6fca49f2dc55cceba26f4419efbfa76f4f79)) * Handlig importan in theme rules ([7078105](https://github.com/CoCreate-app/CoCreate-css-parser/commit/70781057f761557080360535d9ba47ef7aee8e67)) * handling dark and light mode ([5217148](https://github.com/CoCreate-app/CoCreate-css-parser/commit/52171481883c33d30650366ef70f3b19445266d2)) * svg icon class ([3864815](https://github.com/CoCreate-app/CoCreate-css-parser/commit/3864815ef136a8b95c7a871fbd69bb37a05583d0)) --- CHANGELOG.md | 10 ++++++++++ package.json | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2857b38..60b98e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [1.14.5](https://github.com/CoCreate-app/CoCreate-css-parser/compare/v1.14.4...v1.14.5) (2024-06-12) + + +### Bug Fixes + +* bump cocreate dependencies ([ea1b6fc](https://github.com/CoCreate-app/CoCreate-css-parser/commit/ea1b6fca49f2dc55cceba26f4419efbfa76f4f79)) +* Handlig importan in theme rules ([7078105](https://github.com/CoCreate-app/CoCreate-css-parser/commit/70781057f761557080360535d9ba47ef7aee8e67)) +* handling dark and light mode ([5217148](https://github.com/CoCreate-app/CoCreate-css-parser/commit/52171481883c33d30650366ef70f3b19445266d2)) +* svg icon class ([3864815](https://github.com/CoCreate-app/CoCreate-css-parser/commit/3864815ef136a8b95c7a871fbd69bb37a05583d0)) + ## [1.14.4](https://github.com/CoCreate-app/CoCreate-css-parser/compare/v1.14.3...v1.14.4) (2024-04-29) diff --git a/package.json b/package.json index 277eb6c..b64656c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cocreate/css-parser", - "version": "1.14.4", + "version": "1.14.5", "description": "A simple css-parser component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.", "keywords": [ "css-parser", @@ -61,4 +61,4 @@ "@cocreate/local-storage": "^1.15.0", "@cocreate/observer": "^1.16.1" } -} \ No newline at end of file +}