@seyuna/postcss 1.0.0-canary.1 → 1.0.0-canary.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.0.0-canary.3](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.2...v1.0.0-canary.3) (2025-08-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * prioritized data-mode over prefers-color-scheme for [@dark](https://github.com/dark) & [@light](https://github.com/light) rules ([1dafbe7](https://github.com/seyuna-corp/seyuna-postcss/commit/1dafbe74c2ceae8faf28f55ac64846e9e752405b))
7
+
8
+ # [1.0.0-canary.2](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.1...v1.0.0-canary.2) (2025-08-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * added os mode selectors to dark and light at-rules ([aab8f42](https://github.com/seyuna-corp/seyuna-postcss/commit/aab8f42f05d8bfedf45b19352134254f2da4d9f0))
14
+
1
15
  # 1.0.0-canary.1 (2025-08-07)
2
16
 
3
17
 
@@ -1,2 +1,2 @@
1
- import { type AtRule } from "postcss";
1
+ import { AtRule } from "postcss";
2
2
  export default function dark(atRule: AtRule): void;
@@ -3,13 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = dark;
4
4
  const postcss_1 = require("postcss");
5
5
  function dark(atRule) {
6
- const nestedRule = new postcss_1.Rule({
6
+ const clonedNodes = [];
7
+ // Clone all child nodes so we can reuse them
8
+ atRule.each((node) => {
9
+ clonedNodes.push(node.clone());
10
+ });
11
+ // Create `[data-mode="dark"] &` rule
12
+ const dataAttrRule = new postcss_1.Rule({
7
13
  selector: `[data-mode="dark"] &`,
8
14
  });
9
- // Clone all child nodes to prevent them from being detached
10
- atRule.each((node) => {
11
- nestedRule.append(node.clone());
15
+ clonedNodes.forEach((node) => dataAttrRule.append(node.clone()));
16
+ // Create `@media (prefers-color-scheme: dark)` wrapper
17
+ const mediaAtRule = new postcss_1.AtRule({
18
+ name: "media",
19
+ params: "(prefers-color-scheme: dark)",
20
+ });
21
+ const mediaRule = new postcss_1.Rule({
22
+ selector: `&`,
12
23
  });
13
- // Replace @dark atRule with the new nested rule
14
- atRule.replaceWith(nestedRule);
24
+ clonedNodes.forEach((node) => mediaRule.append(node.clone()));
25
+ mediaAtRule.append(mediaRule);
26
+ // Replace original @dark rule with both new rules
27
+ atRule.replaceWith(mediaAtRule, dataAttrRule);
15
28
  }
@@ -1,2 +1,2 @@
1
- import { type AtRule } from "postcss";
1
+ import { AtRule } from "postcss";
2
2
  export default function light(atRule: AtRule): void;
@@ -3,13 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = light;
4
4
  const postcss_1 = require("postcss");
5
5
  function light(atRule) {
6
- const nestedRule = new postcss_1.Rule({
6
+ const clonedNodes = [];
7
+ // Clone all child nodes so we can reuse them
8
+ atRule.each((node) => {
9
+ clonedNodes.push(node.clone());
10
+ });
11
+ // Create `[data-mode="light"] &` rule
12
+ const dataAttrRule = new postcss_1.Rule({
7
13
  selector: `[data-mode="light"] &`,
8
14
  });
9
- // Clone all child nodes to prevent them from being detached
10
- atRule.each((node) => {
11
- nestedRule.append(node.clone());
15
+ clonedNodes.forEach((node) => dataAttrRule.append(node.clone()));
16
+ // Create `@media (prefers-color-scheme: light)` wrapper
17
+ const mediaAtRule = new postcss_1.AtRule({
18
+ name: "media",
19
+ params: "(prefers-color-scheme: light)",
20
+ });
21
+ const mediaRule = new postcss_1.Rule({
22
+ selector: `&`,
12
23
  });
13
- // Replace @light atRule with the new nested rule
14
- atRule.replaceWith(nestedRule);
24
+ clonedNodes.forEach((node) => mediaRule.append(node.clone()));
25
+ mediaAtRule.append(mediaRule);
26
+ // Replace original @light rule with both new rules
27
+ atRule.replaceWith(mediaAtRule, dataAttrRule);
15
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seyuna/postcss",
3
- "version": "1.0.0-canary.1",
3
+ "version": "1.0.0-canary.3",
4
4
  "description": "Seyuna UI's postcss plugin",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,15 +1,33 @@
1
- import { Rule, type AtRule, type ChildNode } from "postcss";
1
+ import { Rule, AtRule, ChildNode } from "postcss";
2
2
 
3
3
  export default function dark(atRule: AtRule) {
4
- const nestedRule = new Rule({
4
+ const clonedNodes: ChildNode[] = [];
5
+
6
+ // Clone all child nodes so we can reuse them
7
+ atRule.each((node: ChildNode) => {
8
+ clonedNodes.push(node.clone());
9
+ });
10
+
11
+ // Create `[data-mode="dark"] &` rule
12
+ const dataAttrRule = new Rule({
5
13
  selector: `[data-mode="dark"] &`,
6
14
  });
7
15
 
8
- // Clone all child nodes to prevent them from being detached
9
- atRule.each((node: ChildNode) => {
10
- nestedRule.append(node.clone());
16
+ clonedNodes.forEach((node) => dataAttrRule.append(node.clone()));
17
+
18
+ // Create `@media (prefers-color-scheme: dark)` wrapper
19
+ const mediaAtRule = new AtRule({
20
+ name: "media",
21
+ params: "(prefers-color-scheme: dark)",
22
+ });
23
+
24
+ const mediaRule = new Rule({
25
+ selector: `&`,
11
26
  });
12
27
 
13
- // Replace @dark atRule with the new nested rule
14
- atRule.replaceWith(nestedRule);
28
+ clonedNodes.forEach((node) => mediaRule.append(node.clone()));
29
+ mediaAtRule.append(mediaRule);
30
+
31
+ // Replace original @dark rule with both new rules
32
+ atRule.replaceWith(mediaAtRule, dataAttrRule);
15
33
  }
@@ -1,15 +1,33 @@
1
- import { Rule, type AtRule, type ChildNode } from "postcss";
1
+ import { Rule, AtRule, ChildNode } from "postcss";
2
2
 
3
3
  export default function light(atRule: AtRule) {
4
- const nestedRule = new Rule({
4
+ const clonedNodes: ChildNode[] = [];
5
+
6
+ // Clone all child nodes so we can reuse them
7
+ atRule.each((node: ChildNode) => {
8
+ clonedNodes.push(node.clone());
9
+ });
10
+
11
+ // Create `[data-mode="light"] &` rule
12
+ const dataAttrRule = new Rule({
5
13
  selector: `[data-mode="light"] &`,
6
14
  });
7
15
 
8
- // Clone all child nodes to prevent them from being detached
9
- atRule.each((node: ChildNode) => {
10
- nestedRule.append(node.clone());
16
+ clonedNodes.forEach((node) => dataAttrRule.append(node.clone()));
17
+
18
+ // Create `@media (prefers-color-scheme: light)` wrapper
19
+ const mediaAtRule = new AtRule({
20
+ name: "media",
21
+ params: "(prefers-color-scheme: light)",
22
+ });
23
+
24
+ const mediaRule = new Rule({
25
+ selector: `&`,
11
26
  });
12
27
 
13
- // Replace @light atRule with the new nested rule
14
- atRule.replaceWith(nestedRule);
28
+ clonedNodes.forEach((node) => mediaRule.append(node.clone()));
29
+ mediaAtRule.append(mediaRule);
30
+
31
+ // Replace original @light rule with both new rules
32
+ atRule.replaceWith(mediaAtRule, dataAttrRule);
15
33
  }