@seyuna/postcss 1.0.0-canary.23 → 1.0.0-canary.24

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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.0.0-canary.24](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.23...v1.0.0-canary.24) (2026-01-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * resolve deadlock by preventing infinite loop and using deep imports ([b7b552c](https://github.com/seyuna-corp/seyuna-postcss/commit/b7b552cfc52c88e07d12022f27269fee16ccb013))
7
+
1
8
  # [1.0.0-canary.23](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.22...v1.0.0-canary.23) (2026-01-10)
2
9
 
3
10
 
@@ -1,4 +1,3 @@
1
- import type { AtRule } from "postcss";
2
1
  import { PluginContext } from "../types.js";
3
- export declare const light: (atRule: AtRule, context: PluginContext) => void;
4
- export declare const dark: (atRule: AtRule, context: PluginContext) => void;
2
+ export declare const light: (atRule: any, context: PluginContext) => void;
3
+ export declare const dark: (atRule: any, context: PluginContext) => void;
@@ -1,4 +1,5 @@
1
- import postcss from "postcss";
1
+ import Rule from "postcss/lib/rule";
2
+ import AtRule from "postcss/lib/at-rule";
2
3
  /**
3
4
  * Custom PostCSS plugin handler factory for `@light` and `@dark` at-rules.
4
5
  */
@@ -14,7 +15,7 @@ function createColorSchemeHandler(scheme) {
14
15
  /**
15
16
  * Rule 1: [data-mode="scheme"] & { ... } (Explicit mode)
16
17
  */
17
- const explicitRule = new postcss.Rule({
18
+ const explicitRule = new Rule({
18
19
  selector: `[${modeAttribute}="${scheme}"] &`,
19
20
  source: atRule.source,
20
21
  });
@@ -22,12 +23,12 @@ function createColorSchemeHandler(scheme) {
22
23
  /**
23
24
  * Rule 2: @media (prefers-color-scheme: scheme) { [data-mode="system"] & { ... } } (System preference)
24
25
  */
25
- const mediaAtRule = new postcss.AtRule({
26
+ const mediaAtRule = new AtRule({
26
27
  name: "media",
27
28
  params: `(prefers-color-scheme: ${scheme})`,
28
29
  source: atRule.source,
29
30
  });
30
- const systemRule = new postcss.Rule({
31
+ const systemRule = new Rule({
31
32
  selector: `[${modeAttribute}="system"] &`,
32
33
  source: atRule.source,
33
34
  });
@@ -1,10 +1,9 @@
1
- import type { AtRule } from "postcss";
2
1
  import { PluginContext } from "../types.js";
3
2
  /**
4
3
  * Handler for @each-standard-color
5
4
  */
6
- export declare function eachStandardColor(atRule: AtRule, context: PluginContext): void;
5
+ export declare function eachStandardColor(atRule: any, context: PluginContext): void;
7
6
  /**
8
7
  * Handler for @each-fixed-color
9
8
  */
10
- export declare function eachFixedColor(atRule: AtRule, context: PluginContext): void;
9
+ export declare function eachFixedColor(atRule: any, context: PluginContext): void;
@@ -1,4 +1,3 @@
1
- import type { AtRule } from "postcss";
2
1
  import { PluginContext } from "../types.js";
3
2
  /**
4
3
  * Custom PostCSS plugin handler for responsive at-rules.
@@ -16,4 +15,4 @@ import { PluginContext } from "../types.js";
16
15
  * }
17
16
  *
18
17
  */
19
- export default function container(atRule: AtRule, context: PluginContext): void;
18
+ export default function container(atRule: any, context: PluginContext): void;
@@ -1,4 +1,4 @@
1
- import postcss from "postcss";
1
+ import AtRule from "postcss/lib/at-rule";
2
2
  /**
3
3
  * Custom PostCSS plugin handler for responsive at-rules.
4
4
  *
@@ -37,7 +37,7 @@ export default function container(atRule, context) {
37
37
  atRule.each((node) => {
38
38
  clonedNodes.push(node.clone());
39
39
  });
40
- const containerAtRule = new postcss.AtRule({
40
+ const containerAtRule = new AtRule({
41
41
  name: "container",
42
42
  params: `(min-width: ${minWidth})`,
43
43
  source: atRule.source,
@@ -1,7 +1,6 @@
1
- import type { AtRule } from "postcss";
2
1
  import { PluginContext } from "../types.js";
3
2
  export interface AtRuleHandler {
4
3
  name: string;
5
- handler: (atRule: AtRule, context: PluginContext) => void;
4
+ handler: (atRule: any, context: PluginContext) => void;
6
5
  }
7
6
  export declare const atRuleHandlers: AtRuleHandler[];
@@ -1,3 +1,4 @@
1
+ // import type { AtRule } from "postcss";
1
2
  import { eachStandardColor, eachFixedColor } from "./color.js";
2
3
  import container from "./container.js";
3
4
  import { light, dark } from "./color-scheme.js";
package/dist/errors.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { Node } from 'postcss';
2
1
  import { PluginContext } from './types.js';
3
- export declare function reportError(message: string, node: Node, context: PluginContext, options?: {
2
+ export declare function reportError(message: string, node: any, context: PluginContext, options?: {
4
3
  word?: string;
5
4
  index?: number;
6
5
  }): void;
7
- export declare function reportWarning(message: string, node: Node): void;
6
+ export declare function reportWarning(message: string, node: any): void;
package/dist/helpers.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- import postcss from "postcss";
2
- import type { ChildNode, AtRule } from "postcss";
1
+ import Rule from "postcss/lib/rule";
3
2
  import { PluginContext } from './types.js';
4
3
  /**
5
4
  * Helper: clone nodes and replace {name} placeholders safely
6
5
  * Returns only valid Rules or Declarations (never raw AtRules)
7
6
  */
8
- export declare function cloneNodes(nodes: ChildNode[], name: string, context: PluginContext): ChildNode[];
7
+ export declare function cloneNodes(nodes: any[], // ChildNode[]
8
+ name: string, context: PluginContext): any[];
9
9
  /**
10
10
  * Generate CSS rules from a list of names
11
11
  */
12
- export declare function generateRules(names: string[], atRule: AtRule, context: PluginContext): postcss.Rule[];
12
+ export declare function generateRules(names: string[], atRule: any, // AtRule
13
+ context: PluginContext): Rule[];
package/dist/helpers.js CHANGED
@@ -1,15 +1,17 @@
1
- import postcss from "postcss";
1
+ import Rule from "postcss/lib/rule";
2
+ // import type { ChildNode, Declaration, AtRule } from "postcss";
2
3
  import { processFunctions } from "./parser.js";
3
4
  /**
4
5
  * Helper: clone nodes and replace {name} placeholders safely
5
6
  * Returns only valid Rules or Declarations (never raw AtRules)
6
7
  */
7
- export function cloneNodes(nodes, name, context) {
8
+ export function cloneNodes(nodes, // ChildNode[]
9
+ name, context) {
8
10
  const { functions: fnMap } = context;
9
11
  return nodes.flatMap((node) => {
10
12
  const cloned = node.clone();
11
13
  if (cloned.type === "decl") {
12
- const decl = cloned;
14
+ const decl = cloned; // Declaration
13
15
  let value = decl.value.replace(/\{name\}/g, name);
14
16
  // Process functions using the robust parser
15
17
  decl.value = processFunctions(value, fnMap, decl, context);
@@ -33,11 +35,12 @@ export function cloneNodes(nodes, name, context) {
33
35
  /**
34
36
  * Generate CSS rules from a list of names
35
37
  */
36
- export function generateRules(names, atRule, context) {
38
+ export function generateRules(names, atRule, // AtRule
39
+ context) {
37
40
  const nodes = atRule.nodes ?? [];
38
41
  const generatedRules = [];
39
42
  for (const name of names) {
40
- const rule = new postcss.Rule({
43
+ const rule = new Rule({
41
44
  selector: `&.${name}`,
42
45
  source: atRule.source,
43
46
  });
package/dist/index.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- declare const plugin: import("postcss").PluginCreator<import("./types.js").PluginOptions> & {
2
- postcss: boolean;
3
- functions: Record<string, import("./functions/index.js").FnHandler>;
4
- };
1
+ declare const plugin: any;
5
2
  export default plugin;
package/dist/parser.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { Node } from 'postcss';
2
1
  import { PluginContext, FunctionMap } from './types.js';
3
2
  export type { FunctionMap } from './types.js';
4
- export declare function processFunctions(value: string, fnMap: FunctionMap, node: Node, context: PluginContext): string;
3
+ export declare function processFunctions(value: string, fnMap: FunctionMap, node: any, context: PluginContext): string;
package/dist/plugin.d.ts CHANGED
@@ -1,3 +1 @@
1
- import type { PluginCreator } from "postcss";
2
- import { PluginOptions } from "./types.js";
3
- export declare const dynamicFunctionsPlugin: PluginCreator<PluginOptions>;
1
+ export declare const dynamicFunctionsPlugin: any;
package/dist/plugin.js CHANGED
@@ -1,3 +1,4 @@
1
+ // import type { PluginCreator } from "postcss";
1
2
  import { functions } from "./functions/index.js";
2
3
  import { atRuleHandlers } from "./at-rules/index.js";
3
4
  import { loadConfigAsync } from "./config.js";
@@ -19,7 +20,10 @@ export const dynamicFunctionsPlugin = (opts = {}) => {
19
20
  Declaration(decl) {
20
21
  if (!context || !fnMap)
21
22
  return;
22
- decl.value = processFunctions(decl.value, fnMap, decl, context);
23
+ const newValue = processFunctions(decl.value, fnMap, decl, context);
24
+ if (newValue !== decl.value) {
25
+ decl.value = newValue;
26
+ }
23
27
  },
24
28
  // Override AtRule handler to ensure ordered execution
25
29
  AtRule(atRule) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seyuna/postcss",
3
- "version": "1.0.0-canary.23",
3
+ "version": "1.0.0-canary.24",
4
4
  "description": "Seyuna UI's postcss plugin",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,25 +1,26 @@
1
- import postcss from "postcss";
2
- import type { AtRule, ChildNode } from "postcss";
1
+ import Rule from "postcss/lib/rule";
2
+ import AtRule from "postcss/lib/at-rule";
3
+ // import type { ChildNode } from "postcss";
3
4
  import { PluginContext } from "../types.js";
4
5
 
5
6
  /**
6
7
  * Custom PostCSS plugin handler factory for `@light` and `@dark` at-rules.
7
8
  */
8
9
  function createColorSchemeHandler(scheme: 'light' | 'dark') {
9
- return (atRule: AtRule, context: PluginContext) => {
10
+ return (atRule: any, context: PluginContext) => {
10
11
  const { options } = context;
11
12
  const modeAttribute = options.modeAttribute;
12
- const clonedNodes: ChildNode[] = [];
13
+ const clonedNodes: any[] = [];
13
14
 
14
15
  // Clone all child nodes inside the block
15
- atRule.each((node: ChildNode) => {
16
+ atRule.each((node: any) => {
16
17
  clonedNodes.push(node.clone());
17
18
  });
18
19
 
19
20
  /**
20
21
  * Rule 1: [data-mode="scheme"] & { ... } (Explicit mode)
21
22
  */
22
- const explicitRule = new postcss.Rule({
23
+ const explicitRule = new Rule({
23
24
  selector: `[${modeAttribute}="${scheme}"] &`,
24
25
  source: atRule.source,
25
26
  });
@@ -28,13 +29,13 @@ function createColorSchemeHandler(scheme: 'light' | 'dark') {
28
29
  /**
29
30
  * Rule 2: @media (prefers-color-scheme: scheme) { [data-mode="system"] & { ... } } (System preference)
30
31
  */
31
- const mediaAtRule = new postcss.AtRule({
32
+ const mediaAtRule = new AtRule({
32
33
  name: "media",
33
34
  params: `(prefers-color-scheme: ${scheme})`,
34
35
  source: atRule.source,
35
36
  });
36
37
 
37
- const systemRule = new postcss.Rule({
38
+ const systemRule = new Rule({
38
39
  selector: `[${modeAttribute}="system"] &`,
39
40
  source: atRule.source,
40
41
  });
@@ -1,11 +1,11 @@
1
- import type { AtRule } from "postcss";
1
+ // import type { AtRule } from "postcss";
2
2
  import { PluginContext } from "../types.js";
3
3
  import { generateRules } from "../helpers.js";
4
4
 
5
5
  /**
6
6
  * Handler for @each-standard-color
7
7
  */
8
- export function eachStandardColor(atRule: AtRule, context: PluginContext) {
8
+ export function eachStandardColor(atRule: any, context: PluginContext) {
9
9
  const { config } = context;
10
10
  const hueNames = config.ui ? Object.keys(config.ui.theme.hues) : [];
11
11
 
@@ -17,7 +17,7 @@ export function eachStandardColor(atRule: AtRule, context: PluginContext) {
17
17
  /**
18
18
  * Handler for @each-fixed-color
19
19
  */
20
- export function eachFixedColor(atRule: AtRule, context: PluginContext) {
20
+ export function eachFixedColor(atRule: any, context: PluginContext) {
21
21
  const { config } = context;
22
22
 
23
23
  const mergedNames = [
@@ -1,5 +1,5 @@
1
- import postcss from "postcss";
2
- import type { AtRule, ChildNode } from "postcss";
1
+ import AtRule from "postcss/lib/at-rule";
2
+ // import type { ChildNode } from "postcss"; // AtRule is now a value import
3
3
  import { PluginContext } from "../types.js";
4
4
 
5
5
  /**
@@ -18,7 +18,7 @@ import { PluginContext } from "../types.js";
18
18
  * }
19
19
  *
20
20
  */
21
- export default function container(atRule: AtRule, context: PluginContext) {
21
+ export default function container(atRule: any, context: PluginContext) {
22
22
  const { config } = context;
23
23
 
24
24
  // Default breakpoints
@@ -40,12 +40,12 @@ export default function container(atRule: AtRule, context: PluginContext) {
40
40
  if (Object.keys(breakpoints).includes(atRule.name)) {
41
41
  const minWidth = breakpoints[atRule.name];
42
42
 
43
- const clonedNodes: ChildNode[] = [];
44
- atRule.each((node: ChildNode) => {
43
+ const clonedNodes: any[] = [];
44
+ atRule.each((node: any) => {
45
45
  clonedNodes.push(node.clone());
46
46
  });
47
47
 
48
- const containerAtRule = new postcss.AtRule({
48
+ const containerAtRule = new AtRule({
49
49
  name: "container",
50
50
  params: `(min-width: ${minWidth})`,
51
51
  source: atRule.source,
@@ -1,4 +1,4 @@
1
- import type { AtRule } from "postcss";
1
+ // import type { AtRule } from "postcss";
2
2
  import { eachStandardColor, eachFixedColor } from "./color.js";
3
3
  import container from "./container.js";
4
4
  import { light, dark } from "./color-scheme.js";
@@ -7,7 +7,7 @@ import { PluginContext } from "../types.js";
7
7
  // Each handler has a name (matches the at-rule) and the function
8
8
  export interface AtRuleHandler {
9
9
  name: string;
10
- handler: (atRule: AtRule, context: PluginContext) => void;
10
+ handler: (atRule: any, context: PluginContext) => void;
11
11
  }
12
12
 
13
13
  // Ordered array ensures execution order
package/src/errors.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Node } from 'postcss';
1
+ // import type { Node } from 'postcss';
2
2
  import { PluginContext } from './types.js';
3
3
 
4
4
  export function reportError(
5
5
  message: string,
6
- node: Node,
6
+ node: any,
7
7
  context: PluginContext,
8
8
  options: { word?: string; index?: number } = {}
9
9
  ) {
@@ -17,7 +17,7 @@ export function reportError(
17
17
  }
18
18
  }
19
19
 
20
- export function reportWarning(message: string, node: Node) {
20
+ export function reportWarning(message: string, node: any) {
21
21
  const result = node.root().toResult();
22
22
  node.warn(result, `[Seyuna PostCSS] ${message}`);
23
23
  }
package/src/helpers.ts CHANGED
@@ -1,5 +1,5 @@
1
- import postcss from "postcss";
2
- import type { ChildNode, Declaration, AtRule } from "postcss";
1
+ import Rule from "postcss/lib/rule";
2
+ // import type { ChildNode, Declaration, AtRule } from "postcss";
3
3
  import { processFunctions } from "./parser.js";
4
4
  import { PluginContext } from './types.js';
5
5
 
@@ -8,17 +8,17 @@ import { PluginContext } from './types.js';
8
8
  * Returns only valid Rules or Declarations (never raw AtRules)
9
9
  */
10
10
  export function cloneNodes(
11
- nodes: ChildNode[],
11
+ nodes: any[], // ChildNode[]
12
12
  name: string,
13
13
  context: PluginContext
14
- ): ChildNode[] {
14
+ ): any[] { // ChildNode[]
15
15
  const { functions: fnMap } = context;
16
16
 
17
17
  return nodes.flatMap((node) => {
18
18
  const cloned = node.clone();
19
19
 
20
20
  if (cloned.type === "decl") {
21
- const decl = cloned as Declaration;
21
+ const decl = cloned as any; // Declaration
22
22
  let value = decl.value.replace(/\{name\}/g, name);
23
23
 
24
24
  // Process functions using the robust parser
@@ -28,7 +28,7 @@ export function cloneNodes(
28
28
  }
29
29
 
30
30
  if (cloned.type === "rule") {
31
- const rule = cloned as postcss.Rule;
31
+ const rule = cloned as Rule;
32
32
  if (!rule.selector) return [];
33
33
 
34
34
  rule.selector = rule.selector.replace(/\{name\}/g, name);
@@ -52,19 +52,19 @@ export function cloneNodes(
52
52
  */
53
53
  export function generateRules(
54
54
  names: string[],
55
- atRule: AtRule,
55
+ atRule: any, // AtRule
56
56
  context: PluginContext
57
- ): postcss.Rule[] {
57
+ ): Rule[] {
58
58
  const nodes = atRule.nodes ?? [];
59
- const generatedRules: postcss.Rule[] = [];
59
+ const generatedRules: Rule[] = [];
60
60
 
61
61
  for (const name of names) {
62
- const rule = new postcss.Rule({
62
+ const rule = new Rule({
63
63
  selector: `&.${name}`,
64
64
  source: atRule.source,
65
65
  });
66
66
  cloneNodes(nodes, name, context).forEach((n) => {
67
- if (n.type === "rule" && n.selector && (n as postcss.Rule).nodes?.length) rule.append(n);
67
+ if (n.type === "rule" && n.selector && (n as Rule).nodes?.length) rule.append(n);
68
68
  if (n.type === "decl") rule.append(n);
69
69
  });
70
70
 
package/src/parser.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import valueParser from 'postcss-value-parser';
2
- import { Node } from 'postcss';
2
+ // import type { Node } from 'postcss';
3
3
  import { PluginContext, FunctionMap } from './types.js';
4
4
  import { reportError } from './errors.js';
5
5
 
@@ -9,7 +9,7 @@ export type { FunctionMap } from './types.js';
9
9
  export function processFunctions(
10
10
  value: string,
11
11
  fnMap: FunctionMap,
12
- node: Node,
12
+ node: any,
13
13
  context: PluginContext
14
14
  ): string {
15
15
  const parsed = valueParser(value);
package/src/plugin.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { PluginCreator } from "postcss";
1
+ // import type { PluginCreator } from "postcss";
2
2
  import { functions } from "./functions/index.js";
3
3
  import { atRuleHandlers } from "./at-rules/index.js";
4
4
  import { loadConfig, loadConfigAsync } from "./config.js";
5
5
  import { PluginOptions, PluginContext, FunctionMap } from "./types.js";
6
6
  import { processFunctions } from "./parser.js";
7
7
 
8
- export const dynamicFunctionsPlugin: PluginCreator<PluginOptions> = (
8
+ export const dynamicFunctionsPlugin: any = (
9
9
  opts = {}
10
10
  ) => {
11
11
  let context: PluginContext | undefined;
@@ -16,21 +16,26 @@ export const dynamicFunctionsPlugin: PluginCreator<PluginOptions> = (
16
16
 
17
17
  async Once() {
18
18
  const { config, options } = await loadConfigAsync(opts);
19
- fnMap = { ...functions, ...opts.functions };
19
+ fnMap = { ...functions, ...(opts as any).functions };
20
20
  context = {
21
21
  config,
22
22
  options,
23
- functions: fnMap,
23
+ functions: fnMap as FunctionMap,
24
24
  };
25
25
  },
26
26
 
27
- Declaration(decl) {
27
+ Declaration(decl: any) {
28
28
  if (!context || !fnMap) return;
29
- decl.value = processFunctions(decl.value, fnMap, decl, context);
29
+
30
+ const newValue = processFunctions(decl.value, fnMap, decl, context);
31
+
32
+ if (newValue !== decl.value) {
33
+ decl.value = newValue;
34
+ }
30
35
  },
31
36
 
32
37
  // Override AtRule handler to ensure ordered execution
33
- AtRule(atRule) {
38
+ AtRule(atRule: any) {
34
39
  if (!context) return;
35
40
  // Iterate over handlers in order (array) instead of object spread
36
41
  for (const { name, handler } of atRuleHandlers) {