@seyuna/postcss 1.0.0-canary.31 → 1.0.0-canary.32
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/functions/color.js +21 -13
- package/package.json +1 -1
- package/src/functions/color.ts +46 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.0.0-canary.32](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.31...v1.0.0-canary.32) (2026-01-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* remove color validation to support multi-file CSS processing ([9c6f906](https://github.com/seyuna-corp/seyuna-postcss/commit/9c6f9064ff0a0895506ea95e3a5025523b09271d))
|
|
7
|
+
|
|
1
8
|
# [1.0.0-canary.31](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.30...v1.0.0-canary.31) (2026-01-21)
|
|
2
9
|
|
|
3
10
|
|
package/dist/functions/color.js
CHANGED
|
@@ -7,39 +7,47 @@ function getColorVariables(context, color, type) {
|
|
|
7
7
|
const colors = config?.ui?.theme?.colors || {};
|
|
8
8
|
const lightColors = config?.ui?.theme?.light?.colors || {};
|
|
9
9
|
const darkColors = config?.ui?.theme?.dark?.colors || {};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (type === 'sc' && !isStandard) {
|
|
13
|
-
throw new Error(`Standard color '${color}' not found in seyuna.json hues`);
|
|
14
|
-
}
|
|
15
|
-
if (type === 'fc' && !isFixed) {
|
|
16
|
-
throw new Error(`Fixed color '${color}' not found in seyuna.json colors`);
|
|
17
|
-
}
|
|
18
|
-
if (isStandard) {
|
|
10
|
+
// If explicitly typed, trust the type and generate appropriate variables
|
|
11
|
+
if (type === "sc") {
|
|
19
12
|
return {
|
|
20
13
|
l: "var(--lightness)",
|
|
21
14
|
c: "var(--chroma)",
|
|
22
15
|
h: `var(--${color}-hue)`,
|
|
23
16
|
};
|
|
24
17
|
}
|
|
25
|
-
if (
|
|
18
|
+
if (type === "fc") {
|
|
26
19
|
return {
|
|
27
20
|
l: `var(--${color}-lightness)`,
|
|
28
21
|
c: `var(--${color}-chroma)`,
|
|
29
22
|
h: `var(--${color}-hue)`,
|
|
30
23
|
};
|
|
31
24
|
}
|
|
32
|
-
|
|
25
|
+
// Auto-detect based on config
|
|
26
|
+
const isStandard = color in hues;
|
|
27
|
+
const isFixed = color in colors || color in lightColors || color in darkColors;
|
|
28
|
+
if (isStandard) {
|
|
29
|
+
return {
|
|
30
|
+
l: "var(--lightness)",
|
|
31
|
+
c: "var(--chroma)",
|
|
32
|
+
h: `var(--${color}-hue)`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
// Default to fixed color pattern (graceful degradation for multi-file scenarios)
|
|
36
|
+
return {
|
|
37
|
+
l: `var(--${color}-lightness)`,
|
|
38
|
+
c: `var(--${color}-chroma)`,
|
|
39
|
+
h: `var(--${color}-hue)`,
|
|
40
|
+
};
|
|
33
41
|
}
|
|
34
42
|
export function SeyunaStandardColor(context, name, alpha, lightness, chroma) {
|
|
35
|
-
const vars = getColorVariables(context, name,
|
|
43
|
+
const vars = getColorVariables(context, name, "sc");
|
|
36
44
|
const a = alpha && alpha !== "null" ? alpha : "1";
|
|
37
45
|
const l = lightness && lightness !== "null" ? lightness : vars.l;
|
|
38
46
|
const c = chroma && chroma !== "null" ? chroma : vars.c;
|
|
39
47
|
return `oklch(${l} ${c} ${vars.h} / ${a})`;
|
|
40
48
|
}
|
|
41
49
|
export function SeyunaFixedColor(context, name, alpha, lightness, chroma) {
|
|
42
|
-
const vars = getColorVariables(context, name,
|
|
50
|
+
const vars = getColorVariables(context, name, "fc");
|
|
43
51
|
const a = alpha && alpha !== "null" ? alpha : "1";
|
|
44
52
|
const l = lightness && lightness !== "null" ? lightness : vars.l;
|
|
45
53
|
const c = chroma && chroma !== "null" ? chroma : vars.c;
|
package/package.json
CHANGED
package/src/functions/color.ts
CHANGED
|
@@ -3,32 +3,26 @@ import { PluginContext } from "../types.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Resolves a color name to its CSS variables based on its type (standard or fixed)
|
|
5
5
|
*/
|
|
6
|
-
function getColorVariables(
|
|
6
|
+
function getColorVariables(
|
|
7
|
+
context: PluginContext,
|
|
8
|
+
color: string,
|
|
9
|
+
type?: "sc" | "fc",
|
|
10
|
+
) {
|
|
7
11
|
const { config } = context;
|
|
8
12
|
const hues = config?.ui?.theme?.hues || {};
|
|
9
13
|
const colors = config?.ui?.theme?.colors || {};
|
|
10
14
|
const lightColors = config?.ui?.theme?.light?.colors || {};
|
|
11
15
|
const darkColors = config?.ui?.theme?.dark?.colors || {};
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (type === 'sc' && !isStandard) {
|
|
17
|
-
throw new Error(`Standard color '${color}' not found in seyuna.json hues`);
|
|
18
|
-
}
|
|
19
|
-
if (type === 'fc' && !isFixed) {
|
|
20
|
-
throw new Error(`Fixed color '${color}' not found in seyuna.json colors`);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (isStandard) {
|
|
17
|
+
// If explicitly typed, trust the type and generate appropriate variables
|
|
18
|
+
if (type === "sc") {
|
|
24
19
|
return {
|
|
25
20
|
l: "var(--lightness)",
|
|
26
21
|
c: "var(--chroma)",
|
|
27
22
|
h: `var(--${color}-hue)`,
|
|
28
23
|
};
|
|
29
24
|
}
|
|
30
|
-
|
|
31
|
-
if (isFixed) {
|
|
25
|
+
if (type === "fc") {
|
|
32
26
|
return {
|
|
33
27
|
l: `var(--${color}-lightness)`,
|
|
34
28
|
c: `var(--${color}-chroma)`,
|
|
@@ -36,7 +30,25 @@ function getColorVariables(context: PluginContext, color: string, type?: 'sc' |
|
|
|
36
30
|
};
|
|
37
31
|
}
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
// Auto-detect based on config
|
|
34
|
+
const isStandard = color in hues;
|
|
35
|
+
const isFixed =
|
|
36
|
+
color in colors || color in lightColors || color in darkColors;
|
|
37
|
+
|
|
38
|
+
if (isStandard) {
|
|
39
|
+
return {
|
|
40
|
+
l: "var(--lightness)",
|
|
41
|
+
c: "var(--chroma)",
|
|
42
|
+
h: `var(--${color}-hue)`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Default to fixed color pattern (graceful degradation for multi-file scenarios)
|
|
47
|
+
return {
|
|
48
|
+
l: `var(--${color}-lightness)`,
|
|
49
|
+
c: `var(--${color}-chroma)`,
|
|
50
|
+
h: `var(--${color}-hue)`,
|
|
51
|
+
};
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
export function SeyunaStandardColor(
|
|
@@ -44,9 +56,9 @@ export function SeyunaStandardColor(
|
|
|
44
56
|
name: string,
|
|
45
57
|
alpha?: string,
|
|
46
58
|
lightness?: string,
|
|
47
|
-
chroma?: string
|
|
59
|
+
chroma?: string,
|
|
48
60
|
) {
|
|
49
|
-
const vars = getColorVariables(context, name,
|
|
61
|
+
const vars = getColorVariables(context, name, "sc");
|
|
50
62
|
const a = alpha && alpha !== "null" ? alpha : "1";
|
|
51
63
|
const l = lightness && lightness !== "null" ? lightness : vars.l;
|
|
52
64
|
const c = chroma && chroma !== "null" ? chroma : vars.c;
|
|
@@ -59,9 +71,9 @@ export function SeyunaFixedColor(
|
|
|
59
71
|
name: string,
|
|
60
72
|
alpha?: string,
|
|
61
73
|
lightness?: string,
|
|
62
|
-
chroma?: string
|
|
74
|
+
chroma?: string,
|
|
63
75
|
) {
|
|
64
|
-
const vars = getColorVariables(context, name,
|
|
76
|
+
const vars = getColorVariables(context, name, "fc");
|
|
65
77
|
const a = alpha && alpha !== "null" ? alpha : "1";
|
|
66
78
|
const l = lightness && lightness !== "null" ? lightness : vars.l;
|
|
67
79
|
const c = chroma && chroma !== "null" ? chroma : vars.c;
|
|
@@ -69,17 +81,29 @@ export function SeyunaFixedColor(
|
|
|
69
81
|
return `oklch(${l} ${c} ${vars.h} / ${a})`;
|
|
70
82
|
}
|
|
71
83
|
|
|
72
|
-
export function SeyunaAlpha(
|
|
84
|
+
export function SeyunaAlpha(
|
|
85
|
+
context: PluginContext,
|
|
86
|
+
color: string,
|
|
87
|
+
value: string,
|
|
88
|
+
) {
|
|
73
89
|
const { l, c, h } = getColorVariables(context, color);
|
|
74
90
|
return `oklch(${l} ${c} ${h} / ${value})`;
|
|
75
91
|
}
|
|
76
92
|
|
|
77
|
-
export function SeyunaLighten(
|
|
93
|
+
export function SeyunaLighten(
|
|
94
|
+
context: PluginContext,
|
|
95
|
+
color: string,
|
|
96
|
+
amount: string,
|
|
97
|
+
) {
|
|
78
98
|
const { l, c, h } = getColorVariables(context, color);
|
|
79
99
|
return `oklch(calc(${l} + ${amount}) ${c} ${h} / 1)`;
|
|
80
100
|
}
|
|
81
101
|
|
|
82
|
-
export function SeyunaDarken(
|
|
102
|
+
export function SeyunaDarken(
|
|
103
|
+
context: PluginContext,
|
|
104
|
+
color: string,
|
|
105
|
+
amount: string,
|
|
106
|
+
) {
|
|
83
107
|
const { l, c, h } = getColorVariables(context, color);
|
|
84
108
|
return `oklch(calc(${l} - ${amount}) ${c} ${h} / 1)`;
|
|
85
109
|
}
|