@seyuna/postcss 1.0.0-canary.5 → 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 +12 -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 -0
- package/dist/functions/color.js +34 -0
- 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 +49 -0
- package/src/functions/index.ts +2 -1
- package/dist/functions/sc.d.ts +0 -1
- package/dist/functions/sc.js +0 -18
- package/src/functions/sc.ts +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
|
|
1
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)
|
|
2
14
|
|
|
3
15
|
|
|
@@ -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
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sc = sc;
|
|
4
|
+
exports.fc = fc;
|
|
5
|
+
function sc(name, alpha, lightness, chroma) {
|
|
6
|
+
let a = "1";
|
|
7
|
+
let l = "var(--lightness)";
|
|
8
|
+
let c = "var(--chroma)";
|
|
9
|
+
if (alpha && alpha !== "null") {
|
|
10
|
+
a = alpha;
|
|
11
|
+
}
|
|
12
|
+
if (lightness && lightness !== "null") {
|
|
13
|
+
l = lightness;
|
|
14
|
+
}
|
|
15
|
+
if (chroma && chroma !== "null") {
|
|
16
|
+
c = chroma;
|
|
17
|
+
}
|
|
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})`;
|
|
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
|
|
7
|
+
const color_1 = require("./color");
|
|
8
8
|
const spacing_1 = __importDefault(require("./spacing"));
|
|
9
9
|
exports.functions = {
|
|
10
|
-
sc:
|
|
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
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function sc(
|
|
2
|
+
name: string,
|
|
3
|
+
alpha?: string,
|
|
4
|
+
lightness?: string,
|
|
5
|
+
chroma?: string
|
|
6
|
+
) {
|
|
7
|
+
let a: string = "1";
|
|
8
|
+
let l: string = "var(--lightness)";
|
|
9
|
+
let c: string = "var(--chroma)";
|
|
10
|
+
|
|
11
|
+
if (alpha && alpha !== "null") {
|
|
12
|
+
a = alpha;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (lightness && lightness !== "null") {
|
|
16
|
+
l = lightness;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (chroma && chroma !== "null") {
|
|
20
|
+
c = chroma;
|
|
21
|
+
}
|
|
22
|
+
|
|
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})`;
|
|
49
|
+
}
|
package/src/functions/index.ts
CHANGED
package/dist/functions/sc.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function sc(name: string, alpha?: string, lightness?: string, chroma?: string): string;
|
package/dist/functions/sc.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = sc;
|
|
4
|
-
function sc(name, alpha, lightness, chroma) {
|
|
5
|
-
let a = "1";
|
|
6
|
-
let l = "var(--lightness)";
|
|
7
|
-
let c = "var(--chroma)";
|
|
8
|
-
if (alpha && alpha !== "null") {
|
|
9
|
-
a = alpha;
|
|
10
|
-
}
|
|
11
|
-
if (lightness && lightness !== "null") {
|
|
12
|
-
l = lightness;
|
|
13
|
-
}
|
|
14
|
-
if (chroma && chroma !== "null") {
|
|
15
|
-
c = chroma;
|
|
16
|
-
}
|
|
17
|
-
return `oklch(${l} ${c} var(--${name}) / ${a})`;
|
|
18
|
-
}
|
package/src/functions/sc.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export default function sc(
|
|
2
|
-
name: string,
|
|
3
|
-
alpha?: string,
|
|
4
|
-
lightness?: string,
|
|
5
|
-
chroma?: string
|
|
6
|
-
) {
|
|
7
|
-
let a: string = "1";
|
|
8
|
-
let l: string = "var(--lightness)";
|
|
9
|
-
let c: string = "var(--chroma)";
|
|
10
|
-
|
|
11
|
-
if (alpha && alpha !== "null") {
|
|
12
|
-
a = alpha;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (lightness && lightness !== "null") {
|
|
16
|
-
l = lightness;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (chroma && chroma !== "null") {
|
|
20
|
-
c = chroma;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return `oklch(${l} ${c} var(--${name}) / ${a})`;
|
|
24
|
-
}
|