@dmisdm/pandatail 0.2.0 → 0.4.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 +90 -83
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +610 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +320 -233
- 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 +579 -0
- package/package.json +33 -14
- package/LICENSE +0 -21
- package/dist/extractSync.d.ts +0 -19
package/README.md
CHANGED
|
@@ -1,113 +1,120 @@
|
|
|
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 @tailwindcss/node
|
|
17
31
|
```
|
|
18
32
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
Keep `@tailwindcss/node` on the same version as `tailwindcss` and your Tailwind
|
|
34
|
+
build plugin (such as `@tailwindcss/vite`). Pandatail uses Tailwind's Node adapter to resolve CSS imports and
|
|
35
|
+
load plugins, then reads the resolved theme before Tailwind emits CSS.
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
--
|
|
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>
|
|
37
|
+
## CLI
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
pandatail build --css src/app.css # codegen + stylesheet (default)
|
|
41
|
+
pandatail codegen --css src/app.css # styled-system/ only
|
|
42
|
+
pandatail cssgen --css src/app.css -o out.css # stylesheet only
|
|
43
|
+
pandatail watch --css src/app.css # rebuild on change
|
|
39
44
|
```
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
| Option | Meaning |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `-c, --css` | Tailwind entry stylesheet (required) |
|
|
49
|
+
| `-o, --out` | Output CSS file (default `<outdir>/styles.css`) |
|
|
50
|
+
| `--config` | Optional `panda.config.ts`, merged on top |
|
|
51
|
+
| `--outdir` | Codegen dir (default `styled-system`; keep the last segment `styled-system` or set `importMap` in your config) |
|
|
52
|
+
| `-i, --include` | Source glob, repeatable. Replaces the defaults |
|
|
53
|
+
| `--cwd` | Project root |
|
|
54
|
+
|
|
55
|
+
Import the generated `styled-system/styles.css` after Tailwind's CSS.
|
|
43
56
|
|
|
44
|
-
##
|
|
57
|
+
## Vite plugin
|
|
58
|
+
|
|
59
|
+
Runs codegen and the stylesheet before your modules build, then watches CSS, config and source files during `vite dev`.
|
|
45
60
|
|
|
46
61
|
```ts
|
|
47
|
-
//
|
|
48
|
-
import {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
// vite.config.ts
|
|
63
|
+
import { pandatail } from "@dmisdm/pandatail/vite";
|
|
64
|
+
|
|
65
|
+
export default {
|
|
66
|
+
plugins: [
|
|
67
|
+
pandatail({
|
|
68
|
+
css: "src/app.css",
|
|
69
|
+
jsxStyleProps: "all", // <Box bg="brand.500" p="4" />
|
|
70
|
+
jsxFramework: "react",
|
|
71
|
+
}),
|
|
57
72
|
],
|
|
58
|
-
|
|
59
|
-
outdir: "styled-system",
|
|
60
|
-
});
|
|
73
|
+
};
|
|
61
74
|
```
|
|
62
75
|
|
|
63
|
-
|
|
76
|
+
Options: everything `createPandatailProject` takes (`css`, `config`, `include`, `exclude`, `outdir`, `jsxFramework`,
|
|
77
|
+
`jsxStyleProps`, `preflight`, `importMap`, `prefix`, `hash`, `minify`), plus `outfile` and `verbose`. Explicit options win over a
|
|
78
|
+
`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
79
|
|
|
65
|
-
|
|
66
|
-
npx panda codegen
|
|
67
|
-
```
|
|
80
|
+
## What maps, and what doesn't
|
|
68
81
|
|
|
69
|
-
|
|
82
|
+
| Tailwind | Panda |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| `@theme` | `theme.tokens` + `breakpoints`, as `var(--…)` references |
|
|
85
|
+
| `@source "x"` / `@source not "x"` | `include` / `exclude` |
|
|
86
|
+
| `@custom-variant n (sel);` | `conditions.extend.n` |
|
|
87
|
+
| `@custom-variant n { &:hover, &:focus { @slot } }` | same (single selector or at-rule wrapping one `@slot`) |
|
|
88
|
+
| `@plugin` | loaded for token extraction; plugin-defined utilities are not Panda utilities |
|
|
89
|
+
| `@source inline(...)`, complex `@custom-variant` blocks, `@utility` | warned about, not mapped |
|
|
70
90
|
|
|
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.
|
|
91
|
+
Anything CSS can't express (text styles, recipes, patterns, utilities) goes in an optional
|
|
92
|
+
`panda.config.ts` passed with `--config`. It is merged after Tailwind's tokens, so it wins.
|
|
75
93
|
|
|
76
|
-
|
|
94
|
+
## Programmatic API
|
|
77
95
|
|
|
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` |
|
|
96
|
+
```ts
|
|
97
|
+
import { createPandatailProject, buildProject } from "@dmisdm/pandatail";
|
|
91
98
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
const project = await createPandatailProject({ css: "src/app.css", config: "panda.config.ts" });
|
|
100
|
+
const { cssPath, diagnostics } = buildProject(project);
|
|
101
|
+
// project.compiler is a Panda compiler; project.warnings lists unmapped CSS.
|
|
102
|
+
```
|
|
96
103
|
|
|
97
|
-
|
|
104
|
+
Prefer your own `panda.config.ts`? `tailwindPreset({ cssPath })` is async and returns a normal Panda preset
|
|
105
|
+
(use top-level `await` in the config).
|
|
98
106
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
+
## Limitations
|
|
108
|
+
|
|
109
|
+
- No PostCSS plugin yet; use the Vite plugin or the CLI (`watch` for dev).
|
|
110
|
+
- `@theme` changes need a rebuild; `watch` reloads the whole project when the CSS or config changes.
|
|
111
|
+
- Panda's cascade layers (`reset, base, tokens, recipes, utilities`) are separate from Tailwind's; check ordering if both emit a `utilities` layer.
|
|
112
|
+
|
|
113
|
+
## Changes in 0.4.0
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
and rejects top-level `await`.
|
|
115
|
+
Tailwind's Node adapter now resolves stylesheet imports and loads plugins and configs. This supports CSS-only package exports such as `tw-animate-css`. Add the `@tailwindcss/node` peer dependency at the same version as your Tailwind installation.
|
|
110
116
|
|
|
111
|
-
##
|
|
117
|
+
## Changes in 0.3.0
|
|
112
118
|
|
|
113
|
-
|
|
119
|
+
Breaking: sync API (`tailwindPresetSync`) and the demo site removed; Panda peers are `^2.0.0`.
|
|
120
|
+
Added: config-less compiler (`createPandatailProject`) and the `pandatail` CLI.
|
package/dist/cli.d.ts
ADDED