@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.
@@ -0,0 +1,4 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
4
+ }
@@ -0,0 +1,2 @@
1
+ import { type AtRule } from "postcss";
2
+ export default function dark(atRule: AtRule): void;
@@ -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,3 @@
1
+ import type { AtRule } from "postcss";
2
+ export type AtRuleHandler = (atRule: AtRule) => void;
3
+ export declare const atRuleHandlers: Record<string, AtRuleHandler>;
@@ -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,2 @@
1
+ import { type AtRule } from "postcss";
2
+ export default function light(atRule: AtRule): void;
@@ -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 declare const color: (name: string, alpha?: string, lightness?: string, chroma?: string) => string;
1
+ export default function color(name: string, alpha?: string, lightness?: string, chroma?: string): string;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.color = void 0;
4
- const color = (name, alpha, lightness, chroma) => {
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
+ }
@@ -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.color,
8
- spacing: spacing_1.spacing
10
+ color: color_1.default,
11
+ spacing: spacing_1.default,
9
12
  };
@@ -1 +1 @@
1
- export declare const spacing: (multiplier: string) => string;
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.spacing = void 0;
4
- const spacing = (multiplier) => {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seyuna/postcss",
3
- "version": "0.0.1-dev.6",
3
+ "version": "0.0.1-dev.8",
4
4
  "description": "Seyuna UI's postcss plugin",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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
+ }
@@ -1,4 +1,9 @@
1
- export const color = (name: string, alpha?: string, lightness?: string, chroma?: string) => {
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
+ }
@@ -1,9 +1,9 @@
1
- import { color } from "./color";
2
- import { spacing } from "./spacing";
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
  };
@@ -1,3 +1,3 @@
1
- export const spacing = (multiplier: string) => {
1
+ export default function spacing(multiplier: string) {
2
2
  return `${parseFloat(multiplier) * 1}rem`;
3
- };
3
+ }