@seyuna/postcss 1.0.0-canary.10 → 1.0.0-canary.11
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 +7 -0
- package/dist/at-rules/color.js +22 -4
- package/package.json +1 -1
- package/src/at-rules/color.ts +26 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.0.0-canary.11](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.10...v1.0.0-canary.11) (2025-09-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* nested rules for at-each-standard-color & at-each-fixed-color ([197a755](https://github.com/seyuna-corp/seyuna-postcss/commit/197a75542798ecacaa071802b2abbf962bcd6538))
|
|
7
|
+
|
|
1
8
|
# [1.0.0-canary.10](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.9...v1.0.0-canary.10) (2025-09-10)
|
|
2
9
|
|
|
3
10
|
|
package/dist/at-rules/color.js
CHANGED
|
@@ -35,13 +35,22 @@ function eachStandardColor(atRule) {
|
|
|
35
35
|
const nodes = atRule.nodes ?? [];
|
|
36
36
|
const generatedRules = [];
|
|
37
37
|
// Helper to clone nodes and replace {name} placeholder
|
|
38
|
-
const cloneNodesWithName = (name) =>
|
|
38
|
+
const cloneNodesWithName = (name, nodeList = nodes) => nodeList.map((node) => {
|
|
39
39
|
const cloned = node.clone();
|
|
40
|
-
// Only process declarations
|
|
41
40
|
if (cloned.type === "decl") {
|
|
42
41
|
const decl = cloned;
|
|
43
42
|
decl.value = decl.value.replace(/\{name\}/g, name);
|
|
44
43
|
}
|
|
44
|
+
else if (cloned.type === "rule") {
|
|
45
|
+
const rule = cloned;
|
|
46
|
+
rule.selector = rule.selector.replace(/\{name\}/g, name);
|
|
47
|
+
rule.nodes = cloneNodesWithName(name, rule.nodes || []);
|
|
48
|
+
}
|
|
49
|
+
else if (cloned.type === "atrule") {
|
|
50
|
+
// If you want {name} in selectors inside at-rules too
|
|
51
|
+
cloned.params = cloned.params.replace(/\{name\}/g, name);
|
|
52
|
+
cloned.nodes = cloneNodesWithName(name, cloned.nodes || []);
|
|
53
|
+
}
|
|
45
54
|
return cloned;
|
|
46
55
|
});
|
|
47
56
|
// Generate rules for each hue
|
|
@@ -85,13 +94,22 @@ function eachFixedColor(atRule) {
|
|
|
85
94
|
const nodes = atRule.nodes ?? [];
|
|
86
95
|
const generatedRules = [];
|
|
87
96
|
// Helper to clone nodes and replace {name} placeholder
|
|
88
|
-
const cloneNodesWithName = (name) =>
|
|
97
|
+
const cloneNodesWithName = (name, nodeList = nodes) => nodeList.map((node) => {
|
|
89
98
|
const cloned = node.clone();
|
|
90
|
-
// Only process declarations
|
|
91
99
|
if (cloned.type === "decl") {
|
|
92
100
|
const decl = cloned;
|
|
93
101
|
decl.value = decl.value.replace(/\{name\}/g, name);
|
|
94
102
|
}
|
|
103
|
+
else if (cloned.type === "rule") {
|
|
104
|
+
const rule = cloned;
|
|
105
|
+
rule.selector = rule.selector.replace(/\{name\}/g, name);
|
|
106
|
+
rule.nodes = cloneNodesWithName(name, rule.nodes || []);
|
|
107
|
+
}
|
|
108
|
+
else if (cloned.type === "atrule") {
|
|
109
|
+
// If you want {name} in selectors inside at-rules too
|
|
110
|
+
cloned.params = cloned.params.replace(/\{name\}/g, name);
|
|
111
|
+
cloned.nodes = cloneNodesWithName(name, cloned.nodes || []);
|
|
112
|
+
}
|
|
95
113
|
return cloned;
|
|
96
114
|
});
|
|
97
115
|
// Generate rules for mergedColorNamesSet
|
package/package.json
CHANGED
package/src/at-rules/color.ts
CHANGED
|
@@ -33,14 +33,24 @@ export function eachStandardColor(atRule: AtRule) {
|
|
|
33
33
|
const generatedRules: Rule[] = [];
|
|
34
34
|
|
|
35
35
|
// Helper to clone nodes and replace {name} placeholder
|
|
36
|
-
const cloneNodesWithName = (
|
|
37
|
-
|
|
36
|
+
const cloneNodesWithName = (
|
|
37
|
+
name: string,
|
|
38
|
+
nodeList: ChildNode[] = nodes
|
|
39
|
+
): ChildNode[] =>
|
|
40
|
+
nodeList.map((node) => {
|
|
38
41
|
const cloned = node.clone();
|
|
39
42
|
|
|
40
|
-
// Only process declarations
|
|
41
43
|
if (cloned.type === "decl") {
|
|
42
44
|
const decl = cloned as Declaration;
|
|
43
45
|
decl.value = decl.value.replace(/\{name\}/g, name);
|
|
46
|
+
} else if (cloned.type === "rule") {
|
|
47
|
+
const rule = cloned as Rule;
|
|
48
|
+
rule.selector = rule.selector.replace(/\{name\}/g, name);
|
|
49
|
+
rule.nodes = cloneNodesWithName(name, rule.nodes || []);
|
|
50
|
+
} else if (cloned.type === "atrule") {
|
|
51
|
+
// If you want {name} in selectors inside at-rules too
|
|
52
|
+
cloned.params = cloned.params.replace(/\{name\}/g, name);
|
|
53
|
+
cloned.nodes = cloneNodesWithName(name, cloned.nodes || []);
|
|
44
54
|
}
|
|
45
55
|
|
|
46
56
|
return cloned;
|
|
@@ -93,14 +103,24 @@ export function eachFixedColor(atRule: AtRule) {
|
|
|
93
103
|
const generatedRules: Rule[] = [];
|
|
94
104
|
|
|
95
105
|
// Helper to clone nodes and replace {name} placeholder
|
|
96
|
-
const cloneNodesWithName = (
|
|
97
|
-
|
|
106
|
+
const cloneNodesWithName = (
|
|
107
|
+
name: string,
|
|
108
|
+
nodeList: ChildNode[] = nodes
|
|
109
|
+
): ChildNode[] =>
|
|
110
|
+
nodeList.map((node) => {
|
|
98
111
|
const cloned = node.clone();
|
|
99
112
|
|
|
100
|
-
// Only process declarations
|
|
101
113
|
if (cloned.type === "decl") {
|
|
102
114
|
const decl = cloned as Declaration;
|
|
103
115
|
decl.value = decl.value.replace(/\{name\}/g, name);
|
|
116
|
+
} else if (cloned.type === "rule") {
|
|
117
|
+
const rule = cloned as Rule;
|
|
118
|
+
rule.selector = rule.selector.replace(/\{name\}/g, name);
|
|
119
|
+
rule.nodes = cloneNodesWithName(name, rule.nodes || []);
|
|
120
|
+
} else if (cloned.type === "atrule") {
|
|
121
|
+
// If you want {name} in selectors inside at-rules too
|
|
122
|
+
cloned.params = cloned.params.replace(/\{name\}/g, name);
|
|
123
|
+
cloned.nodes = cloneNodesWithName(name, cloned.nodes || []);
|
|
104
124
|
}
|
|
105
125
|
|
|
106
126
|
return cloned;
|