create-zudo-sg 0.1.9 → 0.2.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/CHANGELOG.md +35 -0
- package/README.md +44 -41
- package/dist/cli.js +1 -0
- package/package.json +3 -2
- package/templates/default/package.json +11 -10
- package/templates/default/pages/index.tsx +2 -4
- package/templates/default/pages/lib/_body-end-islands.tsx +6 -11
- package/templates/default/pages/lib/_engine-route-preview-token-panel-bootstrap.tsx +8 -6
- package/templates/default/pnpm-workspace.yaml +11 -11
- package/templates/default/src/styles/components.css +4 -0
- package/templates/default/src/styles/global.css +3 -19
- package/templates/default/src/styles/preview-entry.css +4 -6
- package/templates/default/src/styles/ui-tokens.css +1 -1
- package/templates/default/tsconfig.json +2 -1
- package/templates/default/ui/a-preview/preview.stories.tsx +2 -3
- package/templates/default/ui/b-preview-two/preview-two.stories.tsx +2 -3
- package/templates/default/ui/button/button.stories.tsx +3 -4
- package/templates/default/ui/button/button.tsx +4 -5
- package/templates/default/ui/canvas/canvas.stories.tsx +2 -3
- package/templates/default/ui/card/card.stories.tsx +2 -3
- package/templates/default/ui/card/card.tsx +4 -5
- package/templates/default/ui/counter/counter.stories.tsx +2 -3
- package/templates/default/ui/counter/counter.tsx +3 -5
- package/templates/default/vitest.config.ts +12 -0
- package/templates/default/zfb.config.ts +117 -27
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,41 @@ All notable changes to `create-zudo-sg` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on Keep a Changelog.
|
|
6
6
|
|
|
7
|
+
## [0.2.0] - 2026-10-12
|
|
8
|
+
|
|
9
|
+
This release moves the generated starter to the zfb 4 and zudo-doc 6 stack and
|
|
10
|
+
the newly published `@takazudo/zudo-sg` 0.5 line.
|
|
11
|
+
|
|
12
|
+
### Breaking Changes
|
|
13
|
+
|
|
14
|
+
- New projects use zudo-react and zudo-wind instead of the old Preact host and
|
|
15
|
+
Tailwind setup. The template pins zfb, zfb-runtime, and zfb-md-wasm to 4.3.1,
|
|
16
|
+
zudo-doc to 6.0.0, and zdtp to 0.8.6. Existing generated projects should
|
|
17
|
+
follow the migration guides rather than replacing files in place.
|
|
18
|
+
- The starter now installs `@takazudo/zudo-sg ^0.5.0`; its new framework and
|
|
19
|
+
peer contracts do not resolve through the prior `^0.4.1` range.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Generate zudo-react stories, component scaffolds, route wrappers, and token
|
|
24
|
+
panel bootstrap wiring that hydrate under zfb 4.
|
|
25
|
+
- Configure wind tokens and the engine's `wind.json` manifest, and generate
|
|
26
|
+
the UI token manifest for the migrated CSS pipeline.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Defer the engine-route preview panel bootstrap decision until client
|
|
31
|
+
activation, so the generated starter hydrates and replays early clicks.
|
|
32
|
+
|
|
33
|
+
## [0.1.10] - 2026-09-27
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Update the starter engine range to `@takazudo/zudo-sg ^0.4.1`, which brings
|
|
38
|
+
the WCAG AA, scheme-following code-panel editor theme.
|
|
39
|
+
- Update the starter's `@takazudo/zudo-doc` pin to 5.28.0, including its exact
|
|
40
|
+
release-age exclusion.
|
|
41
|
+
|
|
7
42
|
## [0.1.9] - 2026-09-27
|
|
8
43
|
|
|
9
44
|
### Changed
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`create-zudo-sg` is the pnpm-only initializer for a new
|
|
4
4
|
[`@takazudo/zudo-sg`](https://github.com/Takazudo/zudo-sg/tree/main/packages/styleguide)
|
|
5
|
-
styleguide host. It copies a small, working
|
|
5
|
+
styleguide host. It copies a small, working zudo-react + zfb project into a new
|
|
6
6
|
directory; the generated project is private and is ready to customize.
|
|
7
7
|
|
|
8
8
|
## Quick start
|
|
@@ -13,10 +13,11 @@ cd my-styleguide
|
|
|
13
13
|
pnpm install
|
|
14
14
|
pnpm gen-registry
|
|
15
15
|
pnpm gen-token-manifest
|
|
16
|
+
pnpm test
|
|
16
17
|
pnpm dev
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
The command defaults to no dependency installation and prints the
|
|
20
|
+
The command defaults to no dependency installation and prints the setup
|
|
20
21
|
commands after it creates the project. Pass `--install` when the initializer
|
|
21
22
|
should run `pnpm install` for you. The generated `package.json` pins the
|
|
22
23
|
package manager to pnpm, and this release has no npm, yarn, or `--pm` mode.
|
|
@@ -61,7 +62,7 @@ contains:
|
|
|
61
62
|
`pages/lib/_zudo-sg-islands.ts` import shim, for the host page and for
|
|
62
63
|
mounting the preview token panel on the injected `/components/*` and
|
|
63
64
|
`/tokens` routes.
|
|
64
|
-
- Three small
|
|
65
|
+
- Three small zudo-react examples under `ui/`: Button, Card, and Counter, with
|
|
65
66
|
co-located stories and a Button MDX document.
|
|
66
67
|
- `src/styleguide/sg-registry.ts`, generated from the three example stories.
|
|
67
68
|
Run `pnpm gen-registry` after changing stories; the CLI also bootstraps a
|
|
@@ -123,38 +124,32 @@ for the wiring shape.
|
|
|
123
124
|
zfb discovers `src/styles/global.css` automatically; no page import or config
|
|
124
125
|
entry is needed. Keep its imports in this order:
|
|
125
126
|
|
|
126
|
-
1. Declare `@layer
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
`page-loading.css`, in that order.
|
|
127
|
+
1. Declare `@layer zw-reset, zd-flow`; zfb's wind compiler supplies its owned
|
|
128
|
+
reset and utility rules.
|
|
129
|
+
2. Import `@takazudo/zudo-doc/theme.css`, then `./ui-tokens.css` and your local
|
|
130
|
+
`./components.css`. Define host tokens as ordinary `:root` properties and
|
|
131
|
+
map them in `zfb.config.ts` under `wind.tokens`.
|
|
132
|
+
3. Import zudo-doc's `content.css`, `features.css`, and `page-loading.css`, in
|
|
133
|
+
that order.
|
|
134
134
|
4. Import `@takazudo/zdtp/dashboard/styles.css` after content styles so the
|
|
135
|
-
`/tokens` dashboard wins ties with prose rules, then
|
|
136
|
-
`@takazudo/zudo-sg/styles.css
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
outrank `zd-flow`, while engine chrome overrides must compete with utilities.
|
|
143
|
-
Do not add the full `tailwindcss` import or a second preflight. If an existing
|
|
144
|
-
host defines consumer-only color tokens before zudo-doc's theme, replace
|
|
145
|
-
`theme.css` with `theme-no-reset.css` to preserve them. That variant only
|
|
146
|
-
omits the color-token reset; tokens defined by both stylesheets still follow
|
|
147
|
-
source order.
|
|
135
|
+
`/tokens` dashboard wins ties with prose rules, then import
|
|
136
|
+
`@takazudo/zudo-sg/styles.css`.
|
|
137
|
+
|
|
138
|
+
Wind utilities and engine styles are unlayered. Configure
|
|
139
|
+
`wind.sources.roots` in `zfb.config.ts` for host source directories;
|
|
140
|
+
`withZudoSg()` registers the engine's public `wind.json` manifest. Do not add
|
|
141
|
+
a separate utility stylesheet or another reset.
|
|
148
142
|
|
|
149
143
|
### Three token worlds and engine overrides
|
|
150
144
|
|
|
151
|
-
The generated host has three color-token worlds: zudo-doc's `--zd-*` roles for
|
|
152
|
-
documentation shell, zudo-sg's raw `--sg-*` roles for catalog chrome, and
|
|
153
|
-
component library's
|
|
145
|
+
The generated host has three color-token worlds: zudo-doc's `--zd-*` roles for
|
|
146
|
+
the documentation shell, zudo-sg's raw `--sg-*` roles for catalog chrome, and
|
|
147
|
+
the host component library's `:root` tokens (usually `--color-*`) for previewed
|
|
154
148
|
components. Keep the engine and component-library roles separate.
|
|
155
149
|
|
|
156
|
-
The engine defaults are plain `--sg-*` properties under `:where(:root)`,
|
|
157
|
-
|
|
150
|
+
The engine defaults are plain `--sg-*` properties under `:where(:root)`, separate from
|
|
151
|
+
the host's `--color-*` properties. zudo-doc 6's `theme.css` supplies its own token
|
|
152
|
+
values without resetting host colors. Retheme engine chrome with an ordinary,
|
|
158
153
|
unlayered override in any import position:
|
|
159
154
|
|
|
160
155
|
```css
|
|
@@ -165,17 +160,22 @@ unlayered override in any import position:
|
|
|
165
160
|
|
|
166
161
|
If the host previously used bare `--color-border` to style engine chrome, migrate that
|
|
167
162
|
declaration to `--sg-border` (and migrate each other chrome role to its corresponding
|
|
168
|
-
`--sg-*` role). `--color-border` can still style the host's own components.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
163
|
+
`--sg-*` role). `--color-border` can still style the host's own components. Import
|
|
164
|
+
`theme.css` before the host's token styles, then declare intentional `:root`
|
|
165
|
+
overrides afterward. The engine's raw `--sg-*` namespace remains separate.
|
|
166
|
+
|
|
167
|
+
The preview document uses `src/styles/preview-entry.css` independently. Keep
|
|
168
|
+
its input local to the host:
|
|
169
|
+
|
|
170
|
+
```css
|
|
171
|
+
@layer zw-reset;
|
|
172
|
+
@import "./ui-tokens.css";
|
|
173
|
+
@import "./components.css";
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
The preview compiler scans the configured component roots and scopes token
|
|
177
|
+
roots under `:root[data-sg-preview-doc]`. Keep dashboard and catalog chrome
|
|
178
|
+
imports in the host's global entry.
|
|
179
179
|
|
|
180
180
|
## Release-age exemptions
|
|
181
181
|
|
|
@@ -188,7 +188,7 @@ checks each optional package independently.
|
|
|
188
188
|
|
|
189
189
|
## Host requirements and caveats
|
|
190
190
|
|
|
191
|
-
The starter targets
|
|
191
|
+
The starter targets zudo-react + zfb hosts. Keep these dependencies in a host
|
|
192
192
|
that adopts the engine:
|
|
193
193
|
|
|
194
194
|
- `@takazudo/zdtp` is required by the injected `/tokens` route at build time,
|
|
@@ -197,6 +197,9 @@ that adopts the engine:
|
|
|
197
197
|
instead of zudo-doc's throwing stub (zudolab/zudo-doc#4261). Do not drop it.
|
|
198
198
|
- `diff` and `katex` are required by the published zudo-doc route dist that
|
|
199
199
|
the host loads, even when the corresponding optional features are disabled.
|
|
200
|
+
- The engine owns the Preact dependency used by the opaque zdtp dashboard
|
|
201
|
+
adapter. Host components and stories use zudo-react and do not add a direct
|
|
202
|
+
`preact` dependency.
|
|
200
203
|
|
|
201
204
|
Keep the `tokens` block in `zudo-sg.config.mjs` as well. The initializer's
|
|
202
205
|
configuration is typed with `tokens` required, and `gen-token-manifest` needs
|
package/dist/cli.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-zudo-sg",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Create a new zudo-sg styleguide project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Takeshi Takatsudo",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^22.0.0",
|
|
46
46
|
"typescript": "^5.9.0",
|
|
47
|
-
"
|
|
47
|
+
"vite": "7.3.5",
|
|
48
|
+
"vitest": "4.1.11"
|
|
48
49
|
},
|
|
49
50
|
"scripts": {
|
|
50
51
|
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
@@ -8,25 +8,26 @@
|
|
|
8
8
|
"dev": "zfb dev",
|
|
9
9
|
"build": "zfb build",
|
|
10
10
|
"check": "tsc --noEmit -p tsconfig.json",
|
|
11
|
+
"test": "vitest run --passWithNoTests",
|
|
11
12
|
"gen-registry": "zudo-sg gen-registry",
|
|
12
13
|
"gen-token-manifest": "zudo-sg gen-token-manifest"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"@takazudo/zdtp": "0.8.
|
|
16
|
-
"@takazudo/zfb": "
|
|
17
|
-
"@takazudo/zfb-md-wasm": "
|
|
18
|
-
"@takazudo/zfb-runtime": "
|
|
19
|
-
"@takazudo/zudo-doc": "
|
|
20
|
-
"@takazudo/zudo-sg": "^0.
|
|
16
|
+
"@takazudo/zdtp": "0.8.6",
|
|
17
|
+
"@takazudo/zfb": "4.3.1",
|
|
18
|
+
"@takazudo/zfb-md-wasm": "4.3.1",
|
|
19
|
+
"@takazudo/zfb-runtime": "4.3.1",
|
|
20
|
+
"@takazudo/zudo-doc": "6.0.0",
|
|
21
|
+
"@takazudo/zudo-sg": "^0.5.0",
|
|
21
22
|
"diff": "^8.0.4",
|
|
22
23
|
"katex": "^0.16.38",
|
|
23
|
-
"preact": "^10.29.1",
|
|
24
|
-
"preact-render-to-string": "^6.6.6",
|
|
25
|
-
"tailwindcss": "^4.2.0",
|
|
26
24
|
"zod": "^4.3.6"
|
|
27
25
|
},
|
|
28
26
|
"devDependencies": {
|
|
29
27
|
"@types/node": "^22.0.0",
|
|
30
|
-
"
|
|
28
|
+
"happy-dom": "20.14.6",
|
|
29
|
+
"typescript": "^5.9.0",
|
|
30
|
+
"vite": "7.3.5",
|
|
31
|
+
"vitest": "4.1.11"
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
1
|
// The root page stays host-owned so it can import site-wide islands.
|
|
4
|
-
import type { JSX } from "
|
|
2
|
+
import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
5
3
|
// Optional islands seed; see pages/lib/_zudo-sg-islands.ts.
|
|
6
4
|
import "./lib/_zudo-sg-islands";
|
|
7
5
|
// Statically imported (not just reached through `chromeBindingsModule`'s
|
|
@@ -16,7 +14,7 @@ export default function IndexPage(): JSX.Element {
|
|
|
16
14
|
return (
|
|
17
15
|
<html lang="en">
|
|
18
16
|
<head>
|
|
19
|
-
<meta
|
|
17
|
+
<meta charset="utf-8" />
|
|
20
18
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
21
19
|
<title>Styleguide starter</title>
|
|
22
20
|
</head>
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
1
|
// Host-side body-end islands helper.
|
|
4
2
|
//
|
|
5
3
|
// Mirrors the sibling zudo-doc showcase's pages/lib/_body-end-islands.tsx,
|
|
@@ -17,7 +15,7 @@
|
|
|
17
15
|
// against that registered constructor too — not just this starter's
|
|
18
16
|
// host-owned `/`.
|
|
19
17
|
|
|
20
|
-
import type {
|
|
18
|
+
import type { Description } from "@takazudo/zfb/zudo-react";
|
|
21
19
|
import { Island } from "@takazudo/zfb";
|
|
22
20
|
import EngineRoutePreviewTokenPanelBootstrap from "./_engine-route-preview-token-panel-bootstrap";
|
|
23
21
|
import { previewTokenPanelCaptureScript } from "@takazudo/zudo-sg/token-tweak";
|
|
@@ -26,17 +24,14 @@ import { previewTokenPanelCaptureScript } from "@takazudo/zudo-sg/token-tweak";
|
|
|
26
24
|
* The body-end islands this starter mounts. Currently just the preview
|
|
27
25
|
* token panel bootstrap the header trigger opens.
|
|
28
26
|
*/
|
|
29
|
-
export function BodyEndIslands():
|
|
27
|
+
export function BodyEndIslands(): Description {
|
|
30
28
|
return (
|
|
31
29
|
<>
|
|
32
30
|
{/* Capture pre-hydration clicks; the bootstrap drains this once it loads. */}
|
|
33
|
-
<script
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
when: "load",
|
|
38
|
-
children: <EngineRoutePreviewTokenPanelBootstrap />,
|
|
39
|
-
}) as unknown as VNode}
|
|
31
|
+
<script rawHtml={previewTokenPanelCaptureScript()} />
|
|
32
|
+
<Island when="load">
|
|
33
|
+
<EngineRoutePreviewTokenPanelBootstrap />
|
|
34
|
+
</Island>
|
|
40
35
|
</>
|
|
41
36
|
);
|
|
42
37
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
/** @jsxImportSource preact */
|
|
3
|
+
import { getScope, signal, Show } from "@takazudo/zfb/zudo-react";
|
|
5
4
|
import PreviewTokenPanelBootstrap from "@takazudo/zudo-sg/token-tweak/preview-token-panel-bootstrap";
|
|
6
5
|
|
|
7
6
|
export default function EngineRoutePreviewTokenPanelBootstrap() {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
// Route detection needs the browser DOM. Keep the initial component regions
|
|
8
|
+
// identical on the server and client, then mount the bootstrap on activation.
|
|
9
|
+
const active = signal(false);
|
|
10
|
+
getScope().onActivate(() => {
|
|
11
|
+
active.value = Boolean(document.querySelector("[data-sg-engine-route]"));
|
|
12
|
+
});
|
|
13
|
+
return <Show when={active}>{() => <PreviewTokenPanelBootstrap />}</Show>;
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
EngineRoutePreviewTokenPanelBootstrap.displayName = "EngineRoutePreviewTokenPanelBootstrap";
|
|
@@ -2,14 +2,14 @@ packages: []
|
|
|
2
2
|
allowBuilds:
|
|
3
3
|
esbuild: true
|
|
4
4
|
minimumReleaseAgeExclude:
|
|
5
|
-
- "@takazudo/zdtp@0.8.
|
|
6
|
-
- "@takazudo/zfb-darwin-arm64@
|
|
7
|
-
- "@takazudo/zfb-darwin-x64@
|
|
8
|
-
- "@takazudo/zfb-linux-arm64-gnu@
|
|
9
|
-
- "@takazudo/zfb-linux-x64-gnu@
|
|
10
|
-
- "@takazudo/zfb-md-wasm@
|
|
11
|
-
- "@takazudo/zfb-runtime@
|
|
12
|
-
- "@takazudo/zfb-win32-x64-msvc@
|
|
13
|
-
- "@takazudo/zfb@
|
|
14
|
-
- "@takazudo/zudo-doc@
|
|
15
|
-
- "@takazudo/zudo-sg@0.
|
|
5
|
+
- "@takazudo/zdtp@0.8.6"
|
|
6
|
+
- "@takazudo/zfb-darwin-arm64@4.3.1"
|
|
7
|
+
- "@takazudo/zfb-darwin-x64@4.3.1"
|
|
8
|
+
- "@takazudo/zfb-linux-arm64-gnu@4.3.1"
|
|
9
|
+
- "@takazudo/zfb-linux-x64-gnu@4.3.1"
|
|
10
|
+
- "@takazudo/zfb-md-wasm@4.3.1"
|
|
11
|
+
- "@takazudo/zfb-runtime@4.3.1"
|
|
12
|
+
- "@takazudo/zfb-win32-x64-msvc@4.3.1"
|
|
13
|
+
- "@takazudo/zfb@4.3.1"
|
|
14
|
+
- "@takazudo/zudo-doc@6.0.0"
|
|
15
|
+
- "@takazudo/zudo-sg@0.5.0"
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
/* zfb discovers this entry automatically.
|
|
2
|
-
|
|
3
|
-
@layer zd-preflight, zd-flow;
|
|
4
|
-
/* The only element reset is preflight; theme.css below resets color tokens only. */
|
|
5
|
-
@import "tailwindcss/preflight" layer(zd-preflight);
|
|
6
|
-
@import "tailwindcss/utilities";
|
|
7
|
-
|
|
8
|
-
/* Framework defaults first, then the starter's own token values. */
|
|
1
|
+
/* zfb discovers this entry automatically. Wind owns reset and utilities. */
|
|
2
|
+
@layer zw-reset, zd-flow;
|
|
9
3
|
@import "@takazudo/zudo-doc/theme.css";
|
|
10
4
|
@import "./ui-tokens.css";
|
|
11
|
-
|
|
5
|
+
@import "./components.css";
|
|
12
6
|
|
|
13
|
-
@import "@takazudo/zudo-doc/safelist.css";
|
|
14
7
|
@import "@takazudo/zudo-doc/content.css";
|
|
15
8
|
@import "@takazudo/zudo-doc/features.css";
|
|
16
9
|
@import "@takazudo/zudo-doc/page-loading.css";
|
|
17
10
|
|
|
18
|
-
/* Dashboard rules follow content CSS so they win ties with prose styling. */
|
|
19
11
|
@import "@takazudo/zdtp/dashboard/styles.css";
|
|
20
|
-
/* Keep engine styles unlayered alongside utilities so chrome overrides work. */
|
|
21
12
|
@import "@takazudo/zudo-sg/styles.css";
|
|
22
|
-
@import "@takazudo/zudo-sg/safelist.css";
|
|
23
13
|
|
|
24
14
|
/* The engine chrome owns raw --sg-* tokens and no longer needs the host's
|
|
25
15
|
* bare --color-* values. To theme chrome intentionally, add an unlayered
|
|
@@ -30,9 +20,3 @@
|
|
|
30
20
|
* --sg-accent: #7c3aed;
|
|
31
21
|
* }
|
|
32
22
|
*/
|
|
33
|
-
|
|
34
|
-
/* zfb resolves these global-entry globs from the project root.
|
|
35
|
-
* Add your component package's @source here; package chrome uses the safelists. */
|
|
36
|
-
@source "pages/**/*.{tsx,ts,jsx,js}";
|
|
37
|
-
@source "ui/**/*.{tsx,ts,jsx,js,mdx,md}";
|
|
38
|
-
@source "src/content/**/*.{mdx,md}";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
@import "tailwindcss/preflight";
|
|
5
|
-
@import "tailwindcss/utilities";
|
|
1
|
+
/* Independently compiled preview input; zfb supplies wind utilities from
|
|
2
|
+
the component-root source flags. */
|
|
3
|
+
@layer zw-reset;
|
|
6
4
|
@import "./ui-tokens.css";
|
|
7
|
-
@
|
|
5
|
+
@import "./components.css";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@takazudo/zudo-doc/tsconfig.base.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
4
|
"target": "ESNext",
|
|
4
5
|
"module": "ESNext",
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
"noEmit": true,
|
|
10
11
|
"strict": true,
|
|
11
12
|
"jsx": "react-jsx",
|
|
12
|
-
"jsxImportSource": "
|
|
13
|
+
"jsxImportSource": "@takazudo/zfb/zudo-react",
|
|
13
14
|
"skipLibCheck": false
|
|
14
15
|
},
|
|
15
16
|
"include": ["pages", "src", "ui", "zfb.config.ts", "zudo-sg.config.mjs"]
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** @jsxImportSource preact */
|
|
1
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
3
2
|
import type { Story, StoryMeta } from "@takazudo/zudo-sg/stories";
|
|
4
3
|
|
|
5
4
|
const meta: StoryMeta = {
|
|
@@ -12,5 +11,5 @@ export default meta;
|
|
|
12
11
|
|
|
13
12
|
export const Default: Story = {
|
|
14
13
|
name: "Default",
|
|
15
|
-
render: () => <div data-packed-story-identity="packed-preview-default">Preview route probe</div>,
|
|
14
|
+
render: (): Child => <div data-packed-story-identity="packed-preview-default">Preview route probe</div>,
|
|
16
15
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** @jsxImportSource preact */
|
|
1
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
3
2
|
import type { Story, StoryMeta } from "@takazudo/zudo-sg/stories";
|
|
4
3
|
|
|
5
4
|
const meta: StoryMeta = {
|
|
@@ -12,5 +11,5 @@ export default meta;
|
|
|
12
11
|
|
|
13
12
|
export const Default: Story = {
|
|
14
13
|
name: "Default",
|
|
15
|
-
render: () => <div data-packed-story-identity="packed-preview-two-default">Preview 2 route probe</div>,
|
|
14
|
+
render: (): Child => <div data-packed-story-identity="packed-preview-two-default">Preview 2 route probe</div>,
|
|
16
15
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** @jsxImportSource preact */
|
|
1
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
3
2
|
import type { Story, StoryMeta } from "@takazudo/zudo-sg/stories";
|
|
4
3
|
import { Button } from "./button.tsx";
|
|
5
4
|
|
|
@@ -13,10 +12,10 @@ export default meta;
|
|
|
13
12
|
|
|
14
13
|
export const Primary: Story = {
|
|
15
14
|
name: "Primary",
|
|
16
|
-
render: () => <Button>Primary action</Button>,
|
|
15
|
+
render: (): Child => <Button>Primary action</Button>,
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
export const Plain: Story = {
|
|
20
19
|
name: "Plain",
|
|
21
|
-
render: () => <Button tone="plain">Plain action</Button>,
|
|
20
|
+
render: (): Child => <Button tone="plain">Plain action</Button>,
|
|
22
21
|
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { ComponentChildren, JSX } from "preact";
|
|
1
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
2
|
+
import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
4
3
|
|
|
5
|
-
export function Button(props: { children:
|
|
4
|
+
export function Button(props: { children: Child; tone?: "accent" | "plain" }): JSX.Element {
|
|
6
5
|
const tone = props.tone ?? "accent";
|
|
7
6
|
return (
|
|
8
7
|
<button
|
|
9
8
|
type="button"
|
|
10
9
|
data-ui-button={tone}
|
|
11
|
-
class={tone === "accent" ? "bg-accent text-bg px-hsp-md py-vsp-sm" : "text-fg px-hsp-md"}
|
|
10
|
+
class={tone === "accent" ? "bg-accent text-bg px-hsp-md py-vsp-sm rounded-full" : "text-fg px-hsp-md rounded-full"}
|
|
12
11
|
>
|
|
13
12
|
{props.children}
|
|
14
13
|
</button>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** @jsxImportSource preact */
|
|
1
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
3
2
|
import type { Story, StoryMeta } from "@takazudo/zudo-sg/stories";
|
|
4
3
|
|
|
5
4
|
const meta: StoryMeta = {
|
|
@@ -12,5 +11,5 @@ export default meta;
|
|
|
12
11
|
|
|
13
12
|
export const Default: Story = {
|
|
14
13
|
name: "Default",
|
|
15
|
-
render: () => <div data-packed-story-identity="packed-canvas-default">Canvas route probe</div>,
|
|
14
|
+
render: (): Child => <div data-packed-story-identity="packed-canvas-default">Canvas route probe</div>,
|
|
16
15
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** @jsxImportSource preact */
|
|
1
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
3
2
|
import type { Story, StoryMeta } from "@takazudo/zudo-sg/stories";
|
|
4
3
|
import { Card } from "./card.tsx";
|
|
5
4
|
|
|
@@ -13,5 +12,5 @@ export default meta;
|
|
|
13
12
|
|
|
14
13
|
export const Basic: Story = {
|
|
15
14
|
name: "Basic",
|
|
16
|
-
render: () => <Card title="Example">Body content</Card>,
|
|
15
|
+
render: (): Child => <Card title="Example">Body content</Card>,
|
|
17
16
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { ComponentChildren, JSX } from "preact";
|
|
1
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
2
|
+
import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
4
3
|
|
|
5
|
-
export function Card(props: { title: string; children:
|
|
4
|
+
export function Card(props: { title: string; children: Child }): JSX.Element {
|
|
6
5
|
return (
|
|
7
|
-
<div data-ui-card class="border border-
|
|
6
|
+
<div data-ui-card class="zc-fixture-card border border-border rounded-md p-hsp-md">
|
|
8
7
|
<h3 class="font-bold mb-vsp-sm">{props.title}</h3>
|
|
9
8
|
{props.children}
|
|
10
9
|
</div>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** @jsxImportSource preact */
|
|
1
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
3
2
|
import type { Story, StoryMeta } from "@takazudo/zudo-sg/stories";
|
|
4
3
|
import Counter from "./counter.tsx";
|
|
5
4
|
|
|
@@ -13,5 +12,5 @@ export default meta;
|
|
|
13
12
|
|
|
14
13
|
export const Basic: Story = {
|
|
15
14
|
name: "Basic",
|
|
16
|
-
render: () => <Counter start={3} />,
|
|
15
|
+
render: (): Child => <Counter start={3} />,
|
|
17
16
|
};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
/** @jsxRuntime automatic */
|
|
3
|
-
/** @jsxImportSource preact */
|
|
4
2
|
|
|
5
3
|
// Real `"use client"` island reached through the generated registry. It is
|
|
6
4
|
// intentionally not statically imported by a host `pages/` file.
|
|
7
5
|
|
|
8
|
-
import {
|
|
6
|
+
import { signal } from "@takazudo/zfb/zudo-react";
|
|
9
7
|
|
|
10
8
|
export default function Counter(props: { start?: number }) {
|
|
11
|
-
const
|
|
9
|
+
const count = signal(props.start ?? 0);
|
|
12
10
|
return (
|
|
13
|
-
<button type="button" data-counter
|
|
11
|
+
<button type="button" data-counter on:click={() => { count.value += 1; }}>
|
|
14
12
|
count: {count}
|
|
15
13
|
</button>
|
|
16
14
|
);
|
|
@@ -4,36 +4,126 @@
|
|
|
4
4
|
// appends the engine's plugins and collections after `zudoDoc()`'s own — the
|
|
5
5
|
// routes plugin requires `packageOwnedRoutes: true`, which `zudoDoc()`
|
|
6
6
|
// defaults on.
|
|
7
|
-
import { defineConfig } from "@takazudo/zfb/config";
|
|
7
|
+
import { defineConfig, type WindConfig } from "@takazudo/zfb/config";
|
|
8
8
|
import { zudoDoc } from "@takazudo/zudo-doc/config";
|
|
9
9
|
import { withZudoSg } from "@takazudo/zudo-sg/config";
|
|
10
10
|
import zudoSgConfig from "./zudo-sg.config.mjs";
|
|
11
11
|
|
|
12
12
|
export default defineConfig(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
13
|
+
{
|
|
14
|
+
...withZudoSg(
|
|
15
|
+
{
|
|
16
|
+
...zudoDoc({
|
|
17
|
+
siteName: "Styleguide Starter",
|
|
18
|
+
base: "/",
|
|
19
|
+
port: 4397,
|
|
20
|
+
// The starter ships no public/ icons; replace "auto" with a path or FaviconConfig once real icons exist.
|
|
21
|
+
favicon: "auto",
|
|
22
|
+
// No mermaid diagrams anywhere in this starter's one seed doc; turned
|
|
23
|
+
// off rather than leaving the default on to keep the dependency set
|
|
24
|
+
// minimal (see package.json).
|
|
25
|
+
mermaid: false,
|
|
26
|
+
strictContentBridge: true,
|
|
27
|
+
dynamicPageTransition: true,
|
|
28
|
+
// Bundling follows `bundleZdtp ?? designTokenPanel`; this starter never
|
|
29
|
+
// sets `designTokenPanel`, so without this the zdtp loader resolves to
|
|
30
|
+
// zudo-doc's throwing stub and the engine's PREVIEW token panel (opened
|
|
31
|
+
// from the header trigger `withZudoSg` injects) rejects at runtime
|
|
32
|
+
// (zudolab/zudo-doc#4261).
|
|
33
|
+
bundleZdtp: true,
|
|
34
|
+
// Mounts the preview token panel bootstrap on every package-owned
|
|
35
|
+
// route (/components/*, /tokens), not just this starter's host-owned
|
|
36
|
+
// `/`. See pages/lib/_chrome-bindings.tsx.
|
|
37
|
+
chromeBindingsModule: "./pages/lib/_chrome-bindings.tsx",
|
|
38
|
+
}),
|
|
39
|
+
wind: {
|
|
40
|
+
reset: "owned-v1",
|
|
41
|
+
tokens: {
|
|
42
|
+
colors: {
|
|
43
|
+
bg: "var(--color-bg)",
|
|
44
|
+
fg: "var(--color-fg)",
|
|
45
|
+
surface: "var(--color-surface)",
|
|
46
|
+
"surface-2": "var(--color-surface-2)",
|
|
47
|
+
border: "var(--color-border)",
|
|
48
|
+
muted: "var(--color-muted)",
|
|
49
|
+
accent: "var(--color-accent)",
|
|
50
|
+
"accent-hover": "var(--color-accent-hover)",
|
|
51
|
+
"on-accent": "var(--color-on-accent)",
|
|
52
|
+
focus: "var(--color-focus)",
|
|
53
|
+
success: "var(--color-success)",
|
|
54
|
+
danger: "var(--color-danger)",
|
|
55
|
+
warning: "var(--color-warning)",
|
|
56
|
+
info: "var(--color-info)",
|
|
57
|
+
"rail-bg": "var(--color-rail-bg)",
|
|
58
|
+
"rail-bg-strong": "var(--color-rail-bg-strong)",
|
|
59
|
+
"rail-fg": "var(--color-rail-fg)",
|
|
60
|
+
"rail-muted": "var(--color-rail-muted)",
|
|
61
|
+
"rail-border": "var(--color-rail-border)",
|
|
62
|
+
"rail-hover-bg": "var(--color-rail-hover-bg)",
|
|
63
|
+
},
|
|
64
|
+
spacing: {
|
|
65
|
+
"hsp-2xs": "var(--spacing-hsp-2xs)",
|
|
66
|
+
"hsp-xs": "var(--spacing-hsp-xs)",
|
|
67
|
+
"hsp-sm": "var(--spacing-hsp-sm)",
|
|
68
|
+
"hsp-md": "var(--spacing-hsp-md)",
|
|
69
|
+
"hsp-lg": "var(--spacing-hsp-lg)",
|
|
70
|
+
"hsp-xl": "var(--spacing-hsp-xl)",
|
|
71
|
+
"hsp-2xl": "var(--spacing-hsp-2xl)",
|
|
72
|
+
"vsp-3xs": "var(--spacing-vsp-3xs)",
|
|
73
|
+
"vsp-2xs": "var(--spacing-vsp-2xs)",
|
|
74
|
+
"vsp-xs": "var(--spacing-vsp-xs)",
|
|
75
|
+
"vsp-sm": "var(--spacing-vsp-sm)",
|
|
76
|
+
"vsp-md": "var(--spacing-vsp-md)",
|
|
77
|
+
"vsp-lg": "var(--spacing-vsp-lg)",
|
|
78
|
+
"vsp-xl": "var(--spacing-vsp-xl)",
|
|
79
|
+
"vsp-2xl": "var(--spacing-vsp-2xl)",
|
|
80
|
+
},
|
|
81
|
+
fontSizes: {
|
|
82
|
+
xs: { size: "var(--text-xs)", lineHeight: "var(--text-xs--line-height)" },
|
|
83
|
+
sm: { size: "var(--text-sm)", lineHeight: "var(--text-sm--line-height)" },
|
|
84
|
+
base: { size: "var(--text-base)", lineHeight: "var(--text-base--line-height)" },
|
|
85
|
+
lg: { size: "var(--text-lg)", lineHeight: "var(--text-lg--line-height)" },
|
|
86
|
+
xl: { size: "var(--text-xl)", lineHeight: "var(--text-xl--line-height)" },
|
|
87
|
+
"2xl": { size: "var(--text-2xl)", lineHeight: "var(--text-2xl--line-height)" },
|
|
88
|
+
},
|
|
89
|
+
fontFamilies: { sans: "var(--font-sans)", mono: "var(--font-mono)" },
|
|
90
|
+
fontWeights: {
|
|
91
|
+
normal: "var(--font-weight-normal)",
|
|
92
|
+
medium: "var(--font-weight-medium)",
|
|
93
|
+
semibold: "var(--font-weight-semibold)",
|
|
94
|
+
bold: "var(--font-weight-bold)",
|
|
95
|
+
},
|
|
96
|
+
lineHeights: {
|
|
97
|
+
tight: "var(--leading-tight)",
|
|
98
|
+
snug: "var(--leading-snug)",
|
|
99
|
+
normal: "var(--leading-normal)",
|
|
100
|
+
relaxed: "var(--leading-relaxed)",
|
|
101
|
+
},
|
|
102
|
+
radii: {
|
|
103
|
+
default: "var(--radius-DEFAULT)",
|
|
104
|
+
sm: "var(--radius-sm)",
|
|
105
|
+
md: "var(--radius-md)",
|
|
106
|
+
lg: "var(--radius-lg)",
|
|
107
|
+
},
|
|
108
|
+
shadows: {
|
|
109
|
+
card: "var(--shadow-card)",
|
|
110
|
+
raised: "var(--shadow-raised)",
|
|
111
|
+
overlay: "var(--shadow-overlay)",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
breakpoints: {
|
|
115
|
+
sm: { minWidthPx: 640 },
|
|
116
|
+
md: { minWidthPx: 768 },
|
|
117
|
+
lg: { minWidthPx: 1024 },
|
|
118
|
+
xl: { minWidthPx: 1280 },
|
|
119
|
+
},
|
|
120
|
+
strict: true,
|
|
121
|
+
dark: false,
|
|
122
|
+
utilities: { placement: "before-authored" },
|
|
123
|
+
sources: { roots: ["pages", "src", "ui"] },
|
|
124
|
+
} satisfies WindConfig,
|
|
125
|
+
},
|
|
126
|
+
zudoSgConfig,
|
|
127
|
+
),
|
|
128
|
+
},
|
|
39
129
|
);
|