@dmisdm/pandatail 0.1.0 → 0.3.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.
- package/README.md +82 -83
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +637 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +344 -213
- package/dist/namespaces.d.ts +10 -0
- package/dist/preset.d.ts +36 -13
- package/dist/project.d.ts +74 -0
- package/dist/scanCss.d.ts +30 -0
- package/dist/vite.d.ts +19 -0
- package/dist/vite.js +606 -0
- package/package.json +31 -14
- package/LICENSE +0 -21
- package/dist/extractSync.d.ts +0 -19
package/README.md
CHANGED
|
@@ -1,113 +1,112 @@
|
|
|
1
|
-
# pandatail
|
|
1
|
+
# @dmisdm/pandatail
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
`@theme { … }` block into typed Panda style props.
|
|
3
|
+
Use your Tailwind v4 stylesheet as the **only** config for [Panda CSS](https://panda-css.com).
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
`@theme` becomes Panda tokens (still pointing at Tailwind's CSS variables, so both engines agree),
|
|
6
|
+
`@source` becomes Panda's `include`/`exclude`, and `@custom-variant` becomes Panda conditions.
|
|
7
|
+
No `panda.config.ts` required. You get Panda's typed `css()`, recipes and slot recipes alongside Tailwind utilities.
|
|
7
8
|
|
|
9
|
+
```css
|
|
10
|
+
/* src/app.css */
|
|
11
|
+
@import "tailwindcss";
|
|
12
|
+
@source "../ui";
|
|
13
|
+
@source not "../ui/legacy.tsx";
|
|
14
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
15
|
+
@custom-variant hocus { &:hover, &:focus { @slot; } }
|
|
16
|
+
@theme { --color-brand-500: oklch(0.62 0.21 260); --radius-pill: 999px; }
|
|
8
17
|
```
|
|
9
|
-
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { css } from "./styled-system/css";
|
|
21
|
+
css({ bg: "brand.500", rounded: "pill", _hocus: { p: 2 }, _dark: { bg: "blue.900" } });
|
|
10
22
|
```
|
|
11
23
|
|
|
12
|
-
|
|
24
|
+
## Requirements
|
|
25
|
+
|
|
26
|
+
Panda v2 (ESM, Node >= 22) and Tailwind v4.
|
|
13
27
|
|
|
14
28
|
```sh
|
|
15
|
-
npm
|
|
16
|
-
|
|
29
|
+
npm i -D @dmisdm/pandatail @pandacss/dev @pandacss/compiler @pandacss/config \
|
|
30
|
+
@pandacss/preset-base @pandacss/compiler-shared tailwindcss
|
|
17
31
|
```
|
|
18
32
|
|
|
19
|
-
|
|
20
|
-
duplication** — every Panda token resolves to `var(--<tailwind-name>)`.
|
|
21
|
-
- Default Tailwind palettes (`blue.500`, `mauve.300`, …) and your custom
|
|
22
|
-
`@theme` additions (`brand.500`, `--radius-pill`, …) are typed
|
|
23
|
-
automatically.
|
|
24
|
-
- Tailwind utilities and Panda style props coexist in the same JSX. Refactor
|
|
25
|
-
one side at a time.
|
|
33
|
+
## CLI
|
|
26
34
|
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
--radius-pill: 999px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// TSX — Panda autocomplete & TS errors against the same tokens
|
|
36
|
-
<tw.span bg="brand.500" rounded="pill" px={3} py={1} color="white">
|
|
37
|
-
New release
|
|
38
|
-
</tw.span>
|
|
35
|
+
```sh
|
|
36
|
+
pandatail build --css src/app.css # codegen + stylesheet (default)
|
|
37
|
+
pandatail codegen --css src/app.css # styled-system/ only
|
|
38
|
+
pandatail cssgen --css src/app.css -o out.css # stylesheet only
|
|
39
|
+
pandatail watch --css src/app.css # rebuild on change
|
|
39
40
|
```
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
| Option | Meaning |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `-c, --css` | Tailwind entry stylesheet (required) |
|
|
45
|
+
| `-o, --out` | Output CSS file (default `<outdir>/styles.css`) |
|
|
46
|
+
| `--config` | Optional `panda.config.ts`, merged on top |
|
|
47
|
+
| `--outdir` | Codegen dir (default `styled-system`; keep the last segment `styled-system` or set `importMap` in your config) |
|
|
48
|
+
| `-i, --include` | Source glob, repeatable. Replaces the defaults |
|
|
49
|
+
| `--cwd` | Project root |
|
|
50
|
+
|
|
51
|
+
Import the generated `styled-system/styles.css` after Tailwind's CSS.
|
|
43
52
|
|
|
44
|
-
##
|
|
53
|
+
## Vite plugin
|
|
54
|
+
|
|
55
|
+
Runs codegen and the stylesheet before your modules build, then watches CSS, config and source files during `vite dev`.
|
|
45
56
|
|
|
46
57
|
```ts
|
|
47
|
-
//
|
|
48
|
-
import {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
// vite.config.ts
|
|
59
|
+
import { pandatail } from "@dmisdm/pandatail/vite";
|
|
60
|
+
|
|
61
|
+
export default {
|
|
62
|
+
plugins: [
|
|
63
|
+
pandatail({
|
|
64
|
+
css: "src/app.css",
|
|
65
|
+
jsxStyleProps: "all", // <Box bg="brand.500" p="4" />
|
|
66
|
+
jsxFramework: "react",
|
|
67
|
+
}),
|
|
57
68
|
],
|
|
58
|
-
|
|
59
|
-
outdir: "styled-system",
|
|
60
|
-
});
|
|
69
|
+
};
|
|
61
70
|
```
|
|
62
71
|
|
|
63
|
-
|
|
72
|
+
Options: everything `createPandatailProject` takes (`css`, `config`, `include`, `exclude`, `outdir`, `jsxFramework`,
|
|
73
|
+
`jsxStyleProps`, `preflight`, `importMap`, `prefix`, `hash`, `minify`), plus `outfile` and `verbose`. Explicit options win over a
|
|
74
|
+
`config` file. Import `styled-system/styles.css` after Tailwind's CSS. A change to the entry CSS or config reloads the project and the page.
|
|
64
75
|
|
|
65
|
-
|
|
66
|
-
npx panda codegen
|
|
67
|
-
```
|
|
76
|
+
## What maps, and what doesn't
|
|
68
77
|
|
|
69
|
-
|
|
78
|
+
| Tailwind | Panda |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| `@theme` | `theme.tokens` + `breakpoints`, as `var(--…)` references |
|
|
81
|
+
| `@source "x"` / `@source not "x"` | `include` / `exclude` |
|
|
82
|
+
| `@custom-variant n (sel);` | `conditions.extend.n` |
|
|
83
|
+
| `@custom-variant n { &:hover, &:focus { @slot } }` | same (single selector or at-rule wrapping one `@slot`) |
|
|
84
|
+
| `@plugin` | loaded for token extraction; plugin-defined utilities are not Panda utilities |
|
|
85
|
+
| `@source inline(...)`, complex `@custom-variant` blocks, `@utility` | warned about, not mapped |
|
|
70
86
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
`tailwindcss/theme.css`), and registers each one as a Panda token whose value
|
|
74
|
-
is a `var()` reference back to the CSS variable.
|
|
87
|
+
Anything CSS can't express (text styles, recipes, patterns, utilities) goes in an optional
|
|
88
|
+
`panda.config.ts` passed with `--config`. It is merged after Tailwind's tokens, so it wins.
|
|
75
89
|
|
|
76
|
-
|
|
90
|
+
## Programmatic API
|
|
77
91
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
| `--color-*` | `colors` |
|
|
81
|
-
| `--spacing-*` | `spacing` + `sizes` |
|
|
82
|
-
| `--radius-*` | `radii` |
|
|
83
|
-
| `--shadow-*` | `shadows` |
|
|
84
|
-
| `--text-*` | `fontSizes` |
|
|
85
|
-
| `--font-*` | `fonts` |
|
|
86
|
-
| `--font-weight-*` | `fontWeights` |
|
|
87
|
-
| `--leading-*` | `lineHeights` |
|
|
88
|
-
| `--tracking-*` | `letterSpacings` |
|
|
89
|
-
| `--breakpoint-*` | `theme.breakpoints` (media queries) |
|
|
90
|
-
| `--container-*` | `sizes` |
|
|
92
|
+
```ts
|
|
93
|
+
import { createPandatailProject, buildProject } from "@dmisdm/pandatail";
|
|
91
94
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
const project = await createPandatailProject({ css: "src/app.css", config: "panda.config.ts" });
|
|
96
|
+
const { cssPath, diagnostics } = buildProject(project);
|
|
97
|
+
// project.compiler is a Panda compiler; project.warnings lists unmapped CSS.
|
|
98
|
+
```
|
|
96
99
|
|
|
97
|
-
|
|
100
|
+
Prefer your own `panda.config.ts`? `tailwindPreset({ cssPath })` is async and returns a normal Panda preset
|
|
101
|
+
(use top-level `await` in the config).
|
|
98
102
|
|
|
99
|
-
|
|
100
|
-
import {
|
|
101
|
-
tailwindPreset, // async — uses Tailwind's design-system loader
|
|
102
|
-
tailwindPresetSync, // sync — call from panda.config.ts (recommended)
|
|
103
|
-
extractTokens,
|
|
104
|
-
extractTokensSync,
|
|
105
|
-
} from "@dmisdm/pandatail";
|
|
106
|
-
```
|
|
103
|
+
## Limitations
|
|
107
104
|
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
- No PostCSS plugin yet; use the Vite plugin or the CLI (`watch` for dev).
|
|
106
|
+
- `@theme` changes need a rebuild; `watch` reloads the whole project when the CSS or config changes.
|
|
107
|
+
- Panda's cascade layers (`reset, base, tokens, recipes, utilities`) are separate from Tailwind's; check ordering if both emit a `utilities` layer.
|
|
110
108
|
|
|
111
|
-
##
|
|
109
|
+
## Changes in 0.3.0
|
|
112
110
|
|
|
113
|
-
|
|
111
|
+
Breaking: sync API (`tailwindPresetSync`) and the demo site removed; Panda peers are `^2.0.0`.
|
|
112
|
+
Added: config-less compiler (`createPandatailProject`) and the `pandatail` CLI.
|
package/dist/cli.d.ts
ADDED