@dmisdm/pandatail 0.5.0 → 0.6.0

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 @@
1
+ export declare function runLanguageServer(): void;
@@ -0,0 +1,24 @@
1
+ import type { LayerStyles, RecipeConfig } from "@pandacss/dev";
2
+ import type { AtRule } from "postcss";
3
+ import type { Diagnostic } from "@pandacss/compiler-shared";
4
+ declare const compositions: {
5
+ readonly "text-style": "textStyles";
6
+ readonly "layer-style": "layerStyles";
7
+ readonly "animation-style": "animationStyles";
8
+ };
9
+ export type PandaKind = keyof typeof compositions | "recipe" | "config";
10
+ type CompositionKind = (typeof compositions)[keyof typeof compositions];
11
+ type CompositionTree = LayerStyles;
12
+ export interface PandaCss {
13
+ theme: Partial<Record<CompositionKind, CompositionTree>> & {
14
+ recipes?: Record<string, RecipeConfig>;
15
+ };
16
+ configFile?: string;
17
+ references: PandaCssReference[];
18
+ }
19
+ type PandaCssReference = Pick<Diagnostic, "file" | "location"> & {
20
+ category: CompositionKind | "tokens";
21
+ name: string;
22
+ };
23
+ export declare function readPandaRule(rule: AtRule, base: string, out: PandaCss, file?: string): void;
24
+ export {};
package/dist/preset.d.ts CHANGED
@@ -17,7 +17,7 @@ export interface TailwindPresetOptions {
17
17
  }
18
18
  /**
19
19
  * Everything pandatail learns from a Tailwind entry stylesheet: the Panda
20
- * preset (tokens + conditions) and the project info (`@source`s etc.) that
20
+ * preset (tokens, conditions and `@panda` styles) and the project info that
21
21
  * the config-less compiler uses.
22
22
  */
23
23
  export interface LoadedTailwind {
@@ -34,7 +34,8 @@ export declare function loadTailwind(opts: TailwindPresetOptions, preview?: bool
34
34
  /**
35
35
  * Build a PandaCSS preset whose token layer references the CSS custom
36
36
  * properties that Tailwind v4 emits from the user's `@theme` blocks, and whose
37
- * conditions mirror the stylesheet's `@custom-variant`s.
37
+ * conditions mirror the stylesheet's `@custom-variant`s. Includes the theme
38
+ * entries declared with `@panda` (not its project-level JSON config).
38
39
  *
39
40
  * Tailwind owns the values; Panda owns the typed API. There is no value
40
41
  * duplication: every Panda token resolves to `var(--<tailwind-name>)`.
@@ -42,6 +43,9 @@ export declare function loadTailwind(opts: TailwindPresetOptions, preview?: bool
42
43
  export declare function tailwindPreset(opts: TailwindPresetOptions): Promise<{
43
44
  readonly name: "tailwind";
44
45
  readonly theme: {
46
+ readonly extend?: (Partial<Record<"textStyles" | "layerStyles" | "animationStyles", import("@pandacss/types").LayerStyles>> & {
47
+ recipes?: Record<string, import("@pandacss/types").RecipeConfig>;
48
+ }) | undefined;
45
49
  readonly tokens: Record<string, any>;
46
50
  readonly breakpoints: Record<string, string>;
47
51
  };
@@ -49,6 +53,9 @@ export declare function tailwindPreset(opts: TailwindPresetOptions): Promise<{
49
53
  declare function buildPreset(tokens: ExtractedToken[], scan?: CssScan): {
50
54
  readonly name: "tailwind";
51
55
  readonly theme: {
56
+ readonly extend?: (Partial<Record<"textStyles" | "layerStyles" | "animationStyles", import("@pandacss/types").LayerStyles>> & {
57
+ recipes?: Record<string, import("@pandacss/types").RecipeConfig>;
58
+ }) | undefined;
52
59
  readonly tokens: Record<string, any>;
53
60
  readonly breakpoints: Record<string, string>;
54
61
  };
package/dist/project.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type NativeCompiler } from "@pandacss/compiler";
2
2
  import { formatDiagnostic, type Diagnostic } from "@pandacss/compiler-shared";
3
+ import type { CssScan } from "./scanCss";
3
4
  type AnyConfig = Record<string, any>;
4
5
  export interface PandatailOptions {
5
6
  /** Tailwind v4 entry stylesheet (`@import "tailwindcss"`, `@theme`, …). */
@@ -7,9 +8,8 @@ export interface PandatailOptions {
7
8
  /** Project root. Defaults to `process.cwd()`. */
8
9
  cwd?: string;
9
10
  /**
10
- * Optional escape hatch for everything CSS can't express (recipes, patterns,
11
- * textStyles, custom utilities, …): a path to a `panda.config.ts`, or an
12
- * inline config object. Merged on top of what pandatail derives from the CSS.
11
+ * Optional overrides: a path to `panda.config.ts` or an inline config object.
12
+ * Merged on top of the stylesheet and its optional `@panda config` JSON.
13
13
  */
14
14
  config?: string | AnyConfig;
15
15
  /** Source globs for Panda to scan. Replaces the default and the config's `include`. */
@@ -50,6 +50,8 @@ export interface PandatailProject {
50
50
  dependencies: string[];
51
51
  /** Non-fatal things pandatail could not translate from the CSS. */
52
52
  warnings: string[];
53
+ /** Parsed stylesheet metadata, when loaded via `createPandatailProject`. */
54
+ cssScan?: CssScan;
53
55
  }
54
56
  /**
55
57
  * Build a Panda compiler in memory from a Tailwind stylesheet, with no
@@ -62,6 +64,7 @@ export declare function resolvePandatailConfig(opts: PandatailOptions, preview?:
62
64
  outdir: string;
63
65
  dependencies: string[];
64
66
  warnings: string[];
67
+ cssScan: CssScan;
65
68
  }>;
66
69
  export interface BuildResult {
67
70
  files: string[];
@@ -78,4 +81,8 @@ export interface BuildOptions {
78
81
  }
79
82
  /** Scan + parse sources, then write the artifacts and/or stylesheet. */
80
83
  export declare function buildProject(project: PandatailProject, opts?: BuildOptions): BuildResult;
84
+ type ScannedProject = Pick<BuildResult, "files" | "diagnostics">;
85
+ export declare function scanProject({ compiler }: PandatailProject): ScannedProject;
86
+ /** Emit from an already-scanned compiler, so a checker can run before writing. */
87
+ export declare function writeProject({ compiler, cwd, outdir }: PandatailProject, { files, diagnostics }: ScannedProject, opts?: BuildOptions): BuildResult;
81
88
  export { formatDiagnostic };
package/dist/scanCss.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { Diagnostic } from "@pandacss/compiler-shared";
2
+ import { type PandaCss } from "./pandaCss";
1
3
  /**
2
4
  * What a Tailwind entry stylesheet says about the project, beyond `@theme`:
3
5
  * where to look for class usage (`@source`) and the custom variants
@@ -10,9 +12,13 @@ export interface CssScan {
10
12
  excludes: string[];
11
13
  /** `@custom-variant` rules, mapped to Panda condition values. */
12
14
  conditions: Record<string, string>;
15
+ /** Panda-specific definitions and optional JSON config from `@panda`. */
16
+ panda?: PandaCss;
13
17
  /** Things we saw but could not translate. */
14
18
  warnings: string[];
15
- /** Local files that were read (entry + relative `@import`s), for watching. */
19
+ /** Structured CSS and Pandatail diagnostics. */
20
+ diagnostics: Diagnostic[];
21
+ /** Local stylesheets that were read, for watching. */
16
22
  files: string[];
17
23
  }
18
24
  export interface ScanCssOptions {
@@ -21,10 +27,13 @@ export interface ScanCssOptions {
21
27
  base: string;
22
28
  /** Path of the entry file, if there is one. */
23
29
  file?: string;
30
+ /** Return diagnostics even if the stylesheet is invalid. */
31
+ recover?: boolean;
32
+ /** Set false to validate only the supplied buffer without reading dependencies. */
33
+ followImports?: boolean;
24
34
  }
25
35
  /**
26
- * Walk the entry CSS and any *relative* `@import`s (bare specifiers such as
27
- * `tailwindcss` are skipped: they carry no project-specific `@source`s or
28
- * variants).
36
+ * Walk the entry CSS and its relative `@import`s and `@reference`s.
37
+ * Package imports are only processed by Tailwind's own loader.
29
38
  */
30
39
  export declare function scanCss(opts: ScanCssOptions, rootVariables?: Map<string, string>): CssScan;