@seyuna/postcss 0.0.1-dev.6 → 0.0.1-dev.8
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/.vscode/settings.json +4 -0
- package/dist/at-rules/dark.d.ts +2 -0
- package/dist/at-rules/dark.js +13 -0
- package/dist/at-rules/index.d.ts +3 -0
- package/dist/at-rules/index.js +13 -0
- package/dist/at-rules/light.d.ts +2 -0
- package/dist/at-rules/light.js +13 -0
- package/dist/functions/color.d.ts +1 -1
- package/dist/functions/color.js +3 -4
- package/dist/functions/index.js +7 -4
- package/dist/functions/spacing.d.ts +1 -1
- package/dist/functions/spacing.js +3 -4
- package/package.json +1 -1
- package/src/at-rules/dark.ts +12 -0
- package/src/at-rules/index.ts +11 -0
- package/src/at-rules/light.ts +12 -0
- package/src/functions/color.ts +7 -2
- package/src/functions/index.ts +3 -3
- package/src/functions/spacing.ts +2 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = dark;
|
|
4
|
+
const postcss_1 = require("postcss");
|
|
5
|
+
function dark(atRule) {
|
|
6
|
+
// Create a new nested rule: [data-mode="dark"] & { ... }
|
|
7
|
+
const nestedRule = new postcss_1.Rule({
|
|
8
|
+
selector: `[data-mode="dark"] &`,
|
|
9
|
+
nodes: atRule.nodes, // move children inside
|
|
10
|
+
});
|
|
11
|
+
// Replace @dark atRule with the new nested rule
|
|
12
|
+
atRule.replaceWith(nestedRule);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.atRuleHandlers = void 0;
|
|
7
|
+
const dark_1 = __importDefault(require("./dark"));
|
|
8
|
+
const light_1 = __importDefault(require("./light"));
|
|
9
|
+
exports.atRuleHandlers = {
|
|
10
|
+
light: light_1.default,
|
|
11
|
+
dark: dark_1.default,
|
|
12
|
+
// add more handlers here as needed
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = light;
|
|
4
|
+
const postcss_1 = require("postcss");
|
|
5
|
+
function light(atRule) {
|
|
6
|
+
// Create a new nested rule: [data-mode="light"] & { ... }
|
|
7
|
+
const nestedRule = new postcss_1.Rule({
|
|
8
|
+
selector: `[data-mode="light"] &`,
|
|
9
|
+
nodes: atRule.nodes, // move children inside
|
|
10
|
+
});
|
|
11
|
+
// Replace @light atRule with the new nested rule
|
|
12
|
+
atRule.replaceWith(nestedRule);
|
|
13
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export default function color(name: string, alpha?: string, lightness?: string, chroma?: string): string;
|
package/dist/functions/color.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.default = color;
|
|
4
|
+
function color(name, alpha, lightness, chroma) {
|
|
5
5
|
let a = "1";
|
|
6
6
|
let l = "var(--lightness)";
|
|
7
7
|
let c = "var(--chroma)";
|
|
@@ -15,5 +15,4 @@ const color = (name, alpha, lightness, chroma) => {
|
|
|
15
15
|
c = chroma;
|
|
16
16
|
}
|
|
17
17
|
return `oklch(${l} ${c} var(--${name}) / ${a})`;
|
|
18
|
-
}
|
|
19
|
-
exports.color = color;
|
|
18
|
+
}
|
package/dist/functions/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.functions = void 0;
|
|
4
|
-
const color_1 = require("./color");
|
|
5
|
-
const spacing_1 = require("./spacing");
|
|
7
|
+
const color_1 = __importDefault(require("./color"));
|
|
8
|
+
const spacing_1 = __importDefault(require("./spacing"));
|
|
6
9
|
exports.functions = {
|
|
7
|
-
color: color_1.
|
|
8
|
-
spacing: spacing_1.
|
|
10
|
+
color: color_1.default,
|
|
11
|
+
spacing: spacing_1.default,
|
|
9
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export default function spacing(multiplier: string): string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.default = spacing;
|
|
4
|
+
function spacing(multiplier) {
|
|
5
5
|
return `${parseFloat(multiplier) * 1}rem`;
|
|
6
|
-
}
|
|
7
|
-
exports.spacing = spacing;
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Rule, type AtRule } from "postcss";
|
|
2
|
+
|
|
3
|
+
export default function dark(atRule: AtRule) {
|
|
4
|
+
// Create a new nested rule: [data-mode="dark"] & { ... }
|
|
5
|
+
const nestedRule = new Rule({
|
|
6
|
+
selector: `[data-mode="dark"] &`,
|
|
7
|
+
nodes: atRule.nodes, // move children inside
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// Replace @dark atRule with the new nested rule
|
|
11
|
+
atRule.replaceWith(nestedRule);
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import dark from "./dark";
|
|
2
|
+
import light from "./light";
|
|
3
|
+
import type { AtRule } from "postcss";
|
|
4
|
+
|
|
5
|
+
export type AtRuleHandler = (atRule: AtRule) => void;
|
|
6
|
+
|
|
7
|
+
export const atRuleHandlers: Record<string, AtRuleHandler> = {
|
|
8
|
+
light,
|
|
9
|
+
dark,
|
|
10
|
+
// add more handlers here as needed
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Rule, type AtRule } from "postcss";
|
|
2
|
+
|
|
3
|
+
export default function light(atRule: AtRule) {
|
|
4
|
+
// Create a new nested rule: [data-mode="light"] & { ... }
|
|
5
|
+
const nestedRule = new Rule({
|
|
6
|
+
selector: `[data-mode="light"] &`,
|
|
7
|
+
nodes: atRule.nodes, // move children inside
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// Replace @light atRule with the new nested rule
|
|
11
|
+
atRule.replaceWith(nestedRule);
|
|
12
|
+
}
|
package/src/functions/color.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export default function color(
|
|
2
|
+
name: string,
|
|
3
|
+
alpha?: string,
|
|
4
|
+
lightness?: string,
|
|
5
|
+
chroma?: string
|
|
6
|
+
) {
|
|
2
7
|
let a: string = "1";
|
|
3
8
|
let l: string = "var(--lightness)";
|
|
4
9
|
let c: string = "var(--chroma)";
|
|
@@ -16,4 +21,4 @@ export const color = (name: string, alpha?: string, lightness?: string, chroma?:
|
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
return `oklch(${l} ${c} var(--${name}) / ${a})`;
|
|
19
|
-
}
|
|
24
|
+
}
|
package/src/functions/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import color from "./color";
|
|
2
|
+
import spacing from "./spacing";
|
|
3
3
|
|
|
4
4
|
export type FnHandler = (...args: string[]) => string;
|
|
5
5
|
|
|
6
6
|
export const functions: Record<string, FnHandler> = {
|
|
7
7
|
color,
|
|
8
|
-
spacing
|
|
8
|
+
spacing,
|
|
9
9
|
};
|
package/src/functions/spacing.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export default function spacing(multiplier: string) {
|
|
2
2
|
return `${parseFloat(multiplier) * 1}rem`;
|
|
3
|
-
}
|
|
3
|
+
}
|