@seyuna/postcss 1.0.0-canary.25 → 1.0.0-canary.26
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.d.ts +6 -6
- package/dist/functions/color.js +6 -6
- package/dist/functions/index.js +9 -9
- package/dist/functions/theme.d.ts +1 -1
- package/dist/functions/theme.js +1 -1
- package/package.json +1 -1
- package/src/functions/color.ts +6 -6
- package/src/functions/index.ts +16 -9
- package/src/functions/theme.ts +1 -1
- package/tests/plugin.test.ts +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.0.0-canary.26](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.25...v1.0.0-canary.26) (2026-01-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* trigger major release\n\nBREAKING CHANGE: rename and prefix all custom CSS functions with Seyuna to avoid conflicts with native CSS functions. ([3a50bca](https://github.com/seyuna-corp/seyuna-postcss/commit/3a50bcafa89d0c3e21e2b9d1acc879458d9b25aa))
|
|
7
|
+
|
|
1
8
|
# [1.0.0-canary.25](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.24...v1.0.0-canary.25) (2026-01-10)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PluginContext } from "../types.js";
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
2
|
+
export declare function SeyunaStandardColor(context: PluginContext, name: string, alpha?: string, lightness?: string, chroma?: string): string;
|
|
3
|
+
export declare function SeyunaFixedColor(context: PluginContext, name: string, alpha?: string, lightness?: string, chroma?: string): string;
|
|
4
|
+
export declare function SeyunaAlpha(context: PluginContext, color: string, value: string): string;
|
|
5
|
+
export declare function SeyunaLighten(context: PluginContext, color: string, amount: string): string;
|
|
6
|
+
export declare function SeyunaDarken(context: PluginContext, color: string, amount: string): string;
|
|
7
|
+
export declare function SeyunaContrast(context: PluginContext, color: string): string;
|
package/dist/functions/color.js
CHANGED
|
@@ -31,33 +31,33 @@ function getColorVariables(context, color, type) {
|
|
|
31
31
|
}
|
|
32
32
|
throw new Error(`Color '${color}' not found in seyuna.json`);
|
|
33
33
|
}
|
|
34
|
-
export function
|
|
34
|
+
export function SeyunaStandardColor(context, name, alpha, lightness, chroma) {
|
|
35
35
|
const vars = getColorVariables(context, name, 'sc');
|
|
36
36
|
const a = alpha && alpha !== "null" ? alpha : "1";
|
|
37
37
|
const l = lightness && lightness !== "null" ? lightness : vars.l;
|
|
38
38
|
const c = chroma && chroma !== "null" ? chroma : vars.c;
|
|
39
39
|
return `oklch(${l} ${c} ${vars.h} / ${a})`;
|
|
40
40
|
}
|
|
41
|
-
export function
|
|
41
|
+
export function SeyunaFixedColor(context, name, alpha, lightness, chroma) {
|
|
42
42
|
const vars = getColorVariables(context, name, 'fc');
|
|
43
43
|
const a = alpha && alpha !== "null" ? alpha : "1";
|
|
44
44
|
const l = lightness && lightness !== "null" ? lightness : vars.l;
|
|
45
45
|
const c = chroma && chroma !== "null" ? chroma : vars.c;
|
|
46
46
|
return `oklch(${l} ${c} ${vars.h} / ${a})`;
|
|
47
47
|
}
|
|
48
|
-
export function
|
|
48
|
+
export function SeyunaAlpha(context, color, value) {
|
|
49
49
|
const { l, c, h } = getColorVariables(context, color);
|
|
50
50
|
return `oklch(${l} ${c} ${h} / ${value})`;
|
|
51
51
|
}
|
|
52
|
-
export function
|
|
52
|
+
export function SeyunaLighten(context, color, amount) {
|
|
53
53
|
const { l, c, h } = getColorVariables(context, color);
|
|
54
54
|
return `oklch(calc(${l} + ${amount}) ${c} ${h} / 1)`;
|
|
55
55
|
}
|
|
56
|
-
export function
|
|
56
|
+
export function SeyunaDarken(context, color, amount) {
|
|
57
57
|
const { l, c, h } = getColorVariables(context, color);
|
|
58
58
|
return `oklch(calc(${l} - ${amount}) ${c} ${h} / 1)`;
|
|
59
59
|
}
|
|
60
|
-
export function
|
|
60
|
+
export function SeyunaContrast(context, color) {
|
|
61
61
|
const { l } = getColorVariables(context, color);
|
|
62
62
|
return `oklch(calc((${l} - 0.6) * -1000) 0 0)`;
|
|
63
63
|
}
|
package/dist/functions/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { SeyunaStandardColor, SeyunaFixedColor, SeyunaAlpha, SeyunaLighten, SeyunaDarken, SeyunaContrast, } from "./color.js";
|
|
2
|
+
import { SeyunaTheme } from "./theme.js";
|
|
3
3
|
export const functions = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
SeyunaStandardColor,
|
|
5
|
+
SeyunaFixedColor,
|
|
6
|
+
SeyunaAlpha,
|
|
7
|
+
SeyunaLighten,
|
|
8
|
+
SeyunaDarken,
|
|
9
|
+
SeyunaContrast,
|
|
10
|
+
SeyunaTheme,
|
|
11
11
|
};
|
|
@@ -3,4 +3,4 @@ import { PluginContext } from "../types.js";
|
|
|
3
3
|
* Accesses values from the Seyuna configuration using dot notation
|
|
4
4
|
* Example: theme(ui.theme.breakpoints.tablet)
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function SeyunaTheme(context: PluginContext, path: string): string;
|
package/dist/functions/theme.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Accesses values from the Seyuna configuration using dot notation
|
|
3
3
|
* Example: theme(ui.theme.breakpoints.tablet)
|
|
4
4
|
*/
|
|
5
|
-
export function
|
|
5
|
+
export function SeyunaTheme(context, path) {
|
|
6
6
|
const parts = path.split('.');
|
|
7
7
|
let current = context.config;
|
|
8
8
|
for (const part of parts) {
|
package/package.json
CHANGED
package/src/functions/color.ts
CHANGED
|
@@ -39,7 +39,7 @@ function getColorVariables(context: PluginContext, color: string, type?: 'sc' |
|
|
|
39
39
|
throw new Error(`Color '${color}' not found in seyuna.json`);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export function
|
|
42
|
+
export function SeyunaStandardColor(
|
|
43
43
|
context: PluginContext,
|
|
44
44
|
name: string,
|
|
45
45
|
alpha?: string,
|
|
@@ -54,7 +54,7 @@ export function sc(
|
|
|
54
54
|
return `oklch(${l} ${c} ${vars.h} / ${a})`;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export function
|
|
57
|
+
export function SeyunaFixedColor(
|
|
58
58
|
context: PluginContext,
|
|
59
59
|
name: string,
|
|
60
60
|
alpha?: string,
|
|
@@ -69,22 +69,22 @@ export function fc(
|
|
|
69
69
|
return `oklch(${l} ${c} ${vars.h} / ${a})`;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export function
|
|
72
|
+
export function SeyunaAlpha(context: PluginContext, color: string, value: string) {
|
|
73
73
|
const { l, c, h } = getColorVariables(context, color);
|
|
74
74
|
return `oklch(${l} ${c} ${h} / ${value})`;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
export function
|
|
77
|
+
export function SeyunaLighten(context: PluginContext, color: string, amount: string) {
|
|
78
78
|
const { l, c, h } = getColorVariables(context, color);
|
|
79
79
|
return `oklch(calc(${l} + ${amount}) ${c} ${h} / 1)`;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
export function
|
|
82
|
+
export function SeyunaDarken(context: PluginContext, color: string, amount: string) {
|
|
83
83
|
const { l, c, h } = getColorVariables(context, color);
|
|
84
84
|
return `oklch(calc(${l} - ${amount}) ${c} ${h} / 1)`;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
export function
|
|
87
|
+
export function SeyunaContrast(context: PluginContext, color: string) {
|
|
88
88
|
const { l } = getColorVariables(context, color);
|
|
89
89
|
return `oklch(calc((${l} - 0.6) * -1000) 0 0)`;
|
|
90
90
|
}
|
package/src/functions/index.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
SeyunaStandardColor,
|
|
3
|
+
SeyunaFixedColor,
|
|
4
|
+
SeyunaAlpha,
|
|
5
|
+
SeyunaLighten,
|
|
6
|
+
SeyunaDarken,
|
|
7
|
+
SeyunaContrast,
|
|
8
|
+
} from "./color.js";
|
|
9
|
+
import { SeyunaTheme } from "./theme.js";
|
|
3
10
|
import { PluginContext } from "../types.js";
|
|
4
11
|
|
|
5
12
|
export type FnHandler = (context: PluginContext, ...args: string[]) => string;
|
|
6
13
|
|
|
7
14
|
export const functions: Record<string, FnHandler> = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
SeyunaStandardColor,
|
|
16
|
+
SeyunaFixedColor,
|
|
17
|
+
SeyunaAlpha,
|
|
18
|
+
SeyunaLighten,
|
|
19
|
+
SeyunaDarken,
|
|
20
|
+
SeyunaContrast,
|
|
21
|
+
SeyunaTheme,
|
|
15
22
|
};
|
package/src/functions/theme.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PluginContext } from "../types.js";
|
|
|
4
4
|
* Accesses values from the Seyuna configuration using dot notation
|
|
5
5
|
* Example: theme(ui.theme.breakpoints.tablet)
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
7
|
+
export function SeyunaTheme(context: PluginContext, path: string): string {
|
|
8
8
|
const parts = path.split('.');
|
|
9
9
|
let current: any = context.config;
|
|
10
10
|
|
package/tests/plugin.test.ts
CHANGED
|
@@ -38,44 +38,44 @@ async function run(input: string, opts: any = {}) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
describe('Seyuna PostCSS Plugin', () => {
|
|
41
|
-
it('processes
|
|
42
|
-
const input = '.test { color:
|
|
41
|
+
it('processes SeyunaStandardColor() function', async () => {
|
|
42
|
+
const input = '.test { color: SeyunaStandardColor(primary); }';
|
|
43
43
|
const output = '.test { color: oklch(var(--lightness) var(--chroma) var(--primary-hue) / 1)';
|
|
44
44
|
const result = await run(input);
|
|
45
45
|
expect(result.css).toContain(output);
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
it('processes
|
|
49
|
-
const input = '.test { color:
|
|
48
|
+
it('processes SeyunaStandardColor() with alpha', async () => {
|
|
49
|
+
const input = '.test { color: SeyunaStandardColor(primary, 0.5); }';
|
|
50
50
|
const output = '.test { color: oklch(var(--lightness) var(--chroma) var(--primary-hue) / 0.5)';
|
|
51
51
|
const result = await run(input);
|
|
52
52
|
expect(result.css).toContain(output);
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
it('processes
|
|
56
|
-
const input = '.test { color:
|
|
55
|
+
it('processes SeyunaAlpha() function with color name', async () => {
|
|
56
|
+
const input = '.test { color: SeyunaAlpha(primary, 0.5); }';
|
|
57
57
|
const output = 'color: oklch(var(--lightness) var(--chroma) var(--primary-hue) / 0.5)';
|
|
58
58
|
const result = await run(input);
|
|
59
59
|
expect(result.css).toContain(output);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
it('processes
|
|
63
|
-
const input = '.test { color:
|
|
62
|
+
it('processes SeyunaLighten() function with color name', async () => {
|
|
63
|
+
const input = '.test { color: SeyunaLighten(primary, 0.1); }';
|
|
64
64
|
const output = 'color: oklch(calc(var(--lightness) + 0.1) var(--chroma) var(--primary-hue) / 1)';
|
|
65
65
|
const result = await run(input);
|
|
66
66
|
expect(result.css).toContain(output);
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
it('processes
|
|
70
|
-
const input = '.test { color:
|
|
69
|
+
it('processes SeyunaDarken() function with color name', async () => {
|
|
70
|
+
const input = '.test { color: SeyunaDarken(primary, 0.1); }';
|
|
71
71
|
const output = 'color: oklch(calc(var(--lightness) - 0.1) var(--chroma) var(--primary-hue) / 1)';
|
|
72
72
|
const result = await run(input);
|
|
73
73
|
expect(result.css).toContain(output);
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
it('processes
|
|
76
|
+
it('processes SeyunaTheme() function', async () => {
|
|
77
77
|
// We pass the config via opts for testing
|
|
78
|
-
const input = '.test { border-radius:
|
|
78
|
+
const input = '.test { border-radius: SeyunaTheme(ui.theme.breakpoints.tablet); }';
|
|
79
79
|
const result = await run(input, { config: mockConfig });
|
|
80
80
|
expect(result.css).toContain('.test { border-radius: 48rem');
|
|
81
81
|
});
|
|
@@ -95,48 +95,48 @@ describe('Seyuna PostCSS Plugin', () => {
|
|
|
95
95
|
expect(result.css).toContain('[data-mode="light"] &');
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
-
it('processes
|
|
99
|
-
const input = '.test { color:
|
|
98
|
+
it('processes SeyunaAlpha() with standard color', async () => {
|
|
99
|
+
const input = '.test { color: SeyunaAlpha(primary, 0.5); }';
|
|
100
100
|
const output = 'color: oklch(var(--lightness) var(--chroma) var(--primary-hue) / 0.5)';
|
|
101
101
|
const result = await run(input, { config: mockConfig });
|
|
102
102
|
expect(result.css).toContain(output);
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
it('processes
|
|
106
|
-
const input = '.test { color:
|
|
105
|
+
it('processes SeyunaAlpha() with fixed color', async () => {
|
|
106
|
+
const input = '.test { color: SeyunaAlpha(surface, 0.5); }';
|
|
107
107
|
const output = 'color: oklch(var(--surface-lightness) var(--surface-chroma) var(--surface-hue) / 0.5)';
|
|
108
108
|
const result = await run(input, { config: mockConfig });
|
|
109
109
|
expect(result.css).toContain(output);
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
it('processes
|
|
113
|
-
const input = '.test { color:
|
|
112
|
+
it('processes SeyunaContrast() with fixed color', async () => {
|
|
113
|
+
const input = '.test { color: SeyunaContrast(surface); }';
|
|
114
114
|
const output = 'color: oklch(calc((var(--surface-lightness) - 0.6) * -1000) 0 0)';
|
|
115
115
|
const result = await run(input, { config: mockConfig });
|
|
116
116
|
expect(result.css).toContain(output);
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
it('processes
|
|
120
|
-
const input = '.test { color:
|
|
119
|
+
it('processes SeyunaContrast() with standard color', async () => {
|
|
120
|
+
const input = '.test { color: SeyunaContrast(primary); }';
|
|
121
121
|
const output = 'color: oklch(calc((var(--lightness) - 0.6) * -1000) 0 0)';
|
|
122
122
|
const result = await run(input, { config: mockConfig });
|
|
123
123
|
expect(result.css).toContain(output);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
it('throws error for unknown standard color in strict mode', async () => {
|
|
127
|
-
const input = '.test { color:
|
|
127
|
+
const input = '.test { color: SeyunaStandardColor(unknown); }';
|
|
128
128
|
await expect(run(input, { config: mockConfig, strict: true }))
|
|
129
129
|
.rejects.toThrow(/Standard color 'unknown' not found/);
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
it('throws error for unknown fixed color in strict mode', async () => {
|
|
133
|
-
const input = '.test { color:
|
|
133
|
+
const input = '.test { color: SeyunaFixedColor(unknown); }';
|
|
134
134
|
await expect(run(input, { config: mockConfig, strict: true }))
|
|
135
135
|
.rejects.toThrow(/Fixed color 'unknown' not found/);
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
-
it('throws error for unknown color in
|
|
139
|
-
const input = '.test { color:
|
|
138
|
+
it('throws error for unknown color in SeyunaAlpha() in strict mode', async () => {
|
|
139
|
+
const input = '.test { color: SeyunaAlpha(unknown, 0.5); }';
|
|
140
140
|
await expect(run(input, { config: mockConfig, strict: true }))
|
|
141
141
|
.rejects.toThrow(/Color 'unknown' not found in seyuna.json/);
|
|
142
142
|
});
|