@seyuna/postcss 0.0.1-dev.5 → 0.0.1-dev.7

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,2 @@
1
+ import type { AtRule } from "postcss";
2
+ export default function dark(atRule: AtRule): void;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = dark;
4
+ function dark(atRule) {
5
+ const nestRule = atRule.clone({
6
+ name: "nest",
7
+ params: `[data-mode="dark"] &`,
8
+ });
9
+ atRule.replaceWith(nestRule);
10
+ }
@@ -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,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = light;
4
+ function light(atRule) {
5
+ const nestRule = atRule.clone({
6
+ name: "nest",
7
+ params: `[data-mode="light"] &`,
8
+ });
9
+ atRule.replaceWith(nestRule);
10
+ }
@@ -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/dist/index.d.ts CHANGED
@@ -1,2 +1,5 @@
1
- export { dynamicFunctionsPlugin as default } from "./plugin";
2
- export { functions } from "./functions";
1
+ declare const _default: import("postcss").PluginCreator<import("./plugin").PluginOptions> & {
2
+ postcss: boolean;
3
+ functions: Record<string, import("./functions").FnHandler>;
4
+ };
5
+ export = _default;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.functions = exports.default = void 0;
4
- var plugin_1 = require("./plugin");
5
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return plugin_1.dynamicFunctionsPlugin; } });
6
- var functions_1 = require("./functions");
7
- Object.defineProperty(exports, "functions", { enumerable: true, get: function () { return functions_1.functions; } });
2
+ const plugin_1 = require("./plugin");
3
+ const functions_1 = require("./functions");
4
+ module.exports = Object.assign(plugin_1.dynamicFunctionsPlugin, {
5
+ postcss: true,
6
+ functions: functions_1.functions
7
+ });
package/dist/plugin.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { PluginCreator } from "postcss";
2
- interface PluginOptions {
2
+ export interface PluginOptions {
3
3
  functions?: Record<string, (...args: string[]) => string>;
4
4
  }
5
5
  export declare const dynamicFunctionsPlugin: PluginCreator<PluginOptions>;
6
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seyuna/postcss",
3
- "version": "0.0.1-dev.5",
3
+ "version": "0.0.1-dev.7",
4
4
  "description": "Seyuna UI's postcss plugin",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,9 @@
1
+ import type { AtRule } from "postcss";
2
+
3
+ export default function dark(atRule: AtRule) {
4
+ const nestRule = atRule.clone({
5
+ name: "nest",
6
+ params: `[data-mode="dark"] &`,
7
+ });
8
+ atRule.replaceWith(nestRule);
9
+ }
@@ -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,9 @@
1
+ import type { AtRule } from "postcss";
2
+
3
+ export default function light(atRule: AtRule) {
4
+ const nestRule = atRule.clone({
5
+ name: "nest",
6
+ params: `[data-mode="light"] &`,
7
+ });
8
+ atRule.replaceWith(nestRule);
9
+ }
@@ -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
+ }
package/src/index.ts CHANGED
@@ -1,2 +1,8 @@
1
- export { dynamicFunctionsPlugin as default } from "./plugin";
2
- export { functions } from "./functions";
1
+ import { dynamicFunctionsPlugin } from './plugin';
2
+ import { functions } from './functions';
3
+
4
+ // CommonJS-friendly export
5
+ export = Object.assign(dynamicFunctionsPlugin, {
6
+ postcss: true,
7
+ functions
8
+ });
package/src/plugin.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PluginCreator } from "postcss";
2
2
  import { functions } from "./functions";
3
3
 
4
- interface PluginOptions {
4
+ export interface PluginOptions {
5
5
  functions?: Record<string, (...args: string[]) => string>;
6
6
  }
7
7