@seyuna/postcss 1.0.0-canary.4 → 1.0.0-canary.6
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 +19 -0
- package/dist/at-rules/container.d.ts +18 -0
- package/dist/at-rules/container.js +44 -0
- package/dist/at-rules/index.js +2 -0
- package/dist/functions/color.d.ts +2 -1
- package/dist/functions/color.js +19 -3
- package/dist/functions/index.js +3 -2
- package/package.json +1 -1
- package/src/at-rules/container.ts +47 -0
- package/src/at-rules/index.ts +2 -0
- package/src/functions/color.ts +27 -2
- package/src/functions/index.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [1.0.0-canary.6](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.5...v1.0.0-canary.6) (2025-09-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add new color function 'fc' ([70e961f](https://github.com/seyuna-corp/seyuna-postcss/commit/70e961fb0b0a13e358de15b42a87b7890f3fc5c0))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* changed how 'sc' functions, not backward-compatible
|
|
12
|
+
|
|
13
|
+
# [1.0.0-canary.5](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.4...v1.0.0-canary.5) (2025-08-25)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* changed color function name to sc to avoid conflicts with the default css color() function ([a46e96c](https://github.com/seyuna-corp/seyuna-postcss/commit/a46e96c74839f930d39a2c273c822a689a942783))
|
|
19
|
+
|
|
1
20
|
# [1.0.0-canary.4](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.3...v1.0.0-canary.4) (2025-08-24)
|
|
2
21
|
|
|
3
22
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AtRule } from "postcss";
|
|
2
|
+
/**
|
|
3
|
+
* Custom PostCSS plugin handler for responsive at-rules.
|
|
4
|
+
*
|
|
5
|
+
* Example:
|
|
6
|
+
*
|
|
7
|
+
* @xs {
|
|
8
|
+
* .box { color: red; }
|
|
9
|
+
* }
|
|
10
|
+
*
|
|
11
|
+
* Into:
|
|
12
|
+
*
|
|
13
|
+
* @xs (min-width: 234px) {
|
|
14
|
+
* .box { color: red; }
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export default function container(atRule: AtRule): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = container;
|
|
4
|
+
const postcss_1 = require("postcss");
|
|
5
|
+
/**
|
|
6
|
+
* Custom PostCSS plugin handler for responsive at-rules.
|
|
7
|
+
*
|
|
8
|
+
* Example:
|
|
9
|
+
*
|
|
10
|
+
* @xs {
|
|
11
|
+
* .box { color: red; }
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* Into:
|
|
15
|
+
*
|
|
16
|
+
* @xs (min-width: 234px) {
|
|
17
|
+
* .box { color: red; }
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
function container(atRule) {
|
|
22
|
+
// Map of shortcuts → container widths
|
|
23
|
+
const breakpoints = {
|
|
24
|
+
xs: "20rem",
|
|
25
|
+
sm: "40rem",
|
|
26
|
+
md: "48rem",
|
|
27
|
+
lg: "64rem",
|
|
28
|
+
xl: "80rem",
|
|
29
|
+
"2xl": "96rem",
|
|
30
|
+
};
|
|
31
|
+
if (Object.keys(breakpoints).includes(atRule.name)) {
|
|
32
|
+
const minWidth = breakpoints[atRule.name];
|
|
33
|
+
const clonedNodes = [];
|
|
34
|
+
atRule.each((node) => {
|
|
35
|
+
clonedNodes.push(node.clone());
|
|
36
|
+
});
|
|
37
|
+
const containerAtRule = new postcss_1.AtRule({
|
|
38
|
+
name: "container",
|
|
39
|
+
params: `(min-width: ${minWidth})`,
|
|
40
|
+
});
|
|
41
|
+
clonedNodes.forEach((node) => containerAtRule.append(node));
|
|
42
|
+
atRule.replaceWith(containerAtRule);
|
|
43
|
+
}
|
|
44
|
+
}
|
package/dist/at-rules/index.js
CHANGED
|
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.atRuleHandlers = void 0;
|
|
7
7
|
const dark_1 = __importDefault(require("./dark"));
|
|
8
8
|
const light_1 = __importDefault(require("./light"));
|
|
9
|
+
const container_1 = __importDefault(require("./container"));
|
|
9
10
|
exports.atRuleHandlers = {
|
|
10
11
|
light: light_1.default,
|
|
11
12
|
dark: dark_1.default,
|
|
13
|
+
container: container_1.default,
|
|
12
14
|
// add more handlers here as needed
|
|
13
15
|
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function sc(name: string, alpha?: string, lightness?: string, chroma?: string): string;
|
|
2
|
+
export declare function fc(name: string, alpha?: string, lightness?: string, chroma?: string): string;
|
package/dist/functions/color.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.sc = sc;
|
|
4
|
+
exports.fc = fc;
|
|
5
|
+
function sc(name, alpha, lightness, chroma) {
|
|
5
6
|
let a = "1";
|
|
6
7
|
let l = "var(--lightness)";
|
|
7
8
|
let c = "var(--chroma)";
|
|
@@ -14,5 +15,20 @@ function color(name, alpha, lightness, chroma) {
|
|
|
14
15
|
if (chroma && chroma !== "null") {
|
|
15
16
|
c = chroma;
|
|
16
17
|
}
|
|
17
|
-
return `oklch(${l} ${c} var(--${name}) / ${a})`;
|
|
18
|
+
return `oklch(${l} ${c} var(--${name}-hue) / ${a})`;
|
|
19
|
+
}
|
|
20
|
+
function fc(name, alpha, lightness, chroma) {
|
|
21
|
+
let a = "1";
|
|
22
|
+
let l = `var(--${name}-lightness)`;
|
|
23
|
+
let c = `var(--${name}-chroma)`;
|
|
24
|
+
if (alpha && alpha !== "null") {
|
|
25
|
+
a = alpha;
|
|
26
|
+
}
|
|
27
|
+
if (lightness && lightness !== "null") {
|
|
28
|
+
l = lightness;
|
|
29
|
+
}
|
|
30
|
+
if (chroma && chroma !== "null") {
|
|
31
|
+
c = chroma;
|
|
32
|
+
}
|
|
33
|
+
return `oklch(${l} ${c} var(--${name}-hue) / ${a})`;
|
|
18
34
|
}
|
package/dist/functions/index.js
CHANGED
|
@@ -4,9 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.functions = void 0;
|
|
7
|
-
const color_1 =
|
|
7
|
+
const color_1 = require("./color");
|
|
8
8
|
const spacing_1 = __importDefault(require("./spacing"));
|
|
9
9
|
exports.functions = {
|
|
10
|
-
|
|
10
|
+
sc: color_1.sc,
|
|
11
|
+
fc: color_1.fc,
|
|
11
12
|
spacing: spacing_1.default,
|
|
12
13
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AtRule, ChildNode } from "postcss";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Custom PostCSS plugin handler for responsive at-rules.
|
|
5
|
+
*
|
|
6
|
+
* Example:
|
|
7
|
+
*
|
|
8
|
+
* @xs {
|
|
9
|
+
* .box { color: red; }
|
|
10
|
+
* }
|
|
11
|
+
*
|
|
12
|
+
* Into:
|
|
13
|
+
*
|
|
14
|
+
* @xs (min-width: 234px) {
|
|
15
|
+
* .box { color: red; }
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
export default function container(atRule: AtRule) {
|
|
20
|
+
// Map of shortcuts → container widths
|
|
21
|
+
const breakpoints: Record<string, string> = {
|
|
22
|
+
xs: "20rem",
|
|
23
|
+
sm: "40rem",
|
|
24
|
+
md: "48rem",
|
|
25
|
+
lg: "64rem",
|
|
26
|
+
xl: "80rem",
|
|
27
|
+
"2xl": "96rem",
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
if (Object.keys(breakpoints).includes(atRule.name)) {
|
|
31
|
+
const minWidth = breakpoints[atRule.name];
|
|
32
|
+
|
|
33
|
+
const clonedNodes: ChildNode[] = [];
|
|
34
|
+
atRule.each((node: ChildNode) => {
|
|
35
|
+
clonedNodes.push(node.clone());
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const containerAtRule = new AtRule({
|
|
39
|
+
name: "container",
|
|
40
|
+
params: `(min-width: ${minWidth})`,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
clonedNodes.forEach((node) => containerAtRule.append(node));
|
|
44
|
+
|
|
45
|
+
atRule.replaceWith(containerAtRule);
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/at-rules/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import dark from "./dark";
|
|
2
2
|
import light from "./light";
|
|
3
|
+
import container from "./container";
|
|
3
4
|
import type { AtRule } from "postcss";
|
|
4
5
|
|
|
5
6
|
export type AtRuleHandler = (atRule: AtRule) => void;
|
|
@@ -7,5 +8,6 @@ export type AtRuleHandler = (atRule: AtRule) => void;
|
|
|
7
8
|
export const atRuleHandlers: Record<string, AtRuleHandler> = {
|
|
8
9
|
light,
|
|
9
10
|
dark,
|
|
11
|
+
container,
|
|
10
12
|
// add more handlers here as needed
|
|
11
13
|
};
|
package/src/functions/color.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function sc(
|
|
2
2
|
name: string,
|
|
3
3
|
alpha?: string,
|
|
4
4
|
lightness?: string,
|
|
@@ -20,5 +20,30 @@ export default function color(
|
|
|
20
20
|
c = chroma;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
return `oklch(${l} ${c} var(--${name}) / ${a})`;
|
|
23
|
+
return `oklch(${l} ${c} var(--${name}-hue) / ${a})`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function fc(
|
|
27
|
+
name: string,
|
|
28
|
+
alpha?: string,
|
|
29
|
+
lightness?: string,
|
|
30
|
+
chroma?: string
|
|
31
|
+
) {
|
|
32
|
+
let a: string = "1";
|
|
33
|
+
let l: string = `var(--${name}-lightness)`;
|
|
34
|
+
let c: string = `var(--${name}-chroma)`;
|
|
35
|
+
|
|
36
|
+
if (alpha && alpha !== "null") {
|
|
37
|
+
a = alpha;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (lightness && lightness !== "null") {
|
|
41
|
+
l = lightness;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (chroma && chroma !== "null") {
|
|
45
|
+
c = chroma;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return `oklch(${l} ${c} var(--${name}-hue) / ${a})`;
|
|
24
49
|
}
|
package/src/functions/index.ts
CHANGED