create-zudo-doc 0.2.8 → 0.2.9

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/dist/compose.d.ts CHANGED
@@ -80,6 +80,12 @@ export declare function validateDependencies(features: FeatureDefinition[], allS
80
80
  * `p:` map entry) when imageEnlarge is enabled.
81
81
  * - `pages/lib/_body-end-islands.tsx` — tauri.ts injects the FindInPageInit
82
82
  * island (import, displayName, Island mount) when tauri is enabled.
83
+ * design-token-panel.ts injects the DesignTokenPanelBootstrap island
84
+ * (import, displayName, Island mount + toggle shim) when designTokenPanel
85
+ * is enabled.
86
+ * - `src/config/settings-types.ts` — design-token-panel.ts injects the
87
+ * `"design-token-panel"` member into `HeaderRightTriggerName` when the
88
+ * feature is enabled (replace-range between the :start/:end anchors).
83
89
  */
84
90
  export declare const ANCHOR_FILES: string[];
85
91
  /**
package/dist/compose.js CHANGED
@@ -166,11 +166,18 @@ export function validateDependencies(features, allSelectedNames) {
166
166
  * `p:` map entry) when imageEnlarge is enabled.
167
167
  * - `pages/lib/_body-end-islands.tsx` — tauri.ts injects the FindInPageInit
168
168
  * island (import, displayName, Island mount) when tauri is enabled.
169
+ * design-token-panel.ts injects the DesignTokenPanelBootstrap island
170
+ * (import, displayName, Island mount + toggle shim) when designTokenPanel
171
+ * is enabled.
172
+ * - `src/config/settings-types.ts` — design-token-panel.ts injects the
173
+ * `"design-token-panel"` member into `HeaderRightTriggerName` when the
174
+ * feature is enabled (replace-range between the :start/:end anchors).
169
175
  */
170
176
  export const ANCHOR_FILES = [
171
177
  "src/styles/global.css",
172
178
  "pages/_mdx-components.ts",
173
179
  "pages/lib/_body-end-islands.tsx",
180
+ "src/config/settings-types.ts",
174
181
  ];
175
182
  /**
176
183
  * Main composition entry point. Orchestrates the full feature composition
@@ -2,11 +2,13 @@ import type { FeatureModule } from "../compose.js";
2
2
  /**
3
3
  * Design-token-panel (zdtp) feature.
4
4
  *
5
- * Injects the zdtp CSS @import at `@slot:global-css:feature-styles` in
6
- * `src/styles/global.css`. The bootstrap is loaded by
7
- * `pages/lib/design-token-panel-bootstrap` as a side effect when the
8
- * feature is enabled, and the header trigger is rendered by
9
- * `pages/lib/_header-with-defaults.tsx` from the `settings.headerRightItems`
10
- * entry `{ type: "trigger", trigger: "design-token-panel" }`.
5
+ * Injects:
6
+ * 1. The zdtp CSS @import at `@slot:global-css:feature-styles` in
7
+ * `src/styles/global.css`.
8
+ * 2. The DesignTokenPanelBootstrap import, displayName, and Island mount
9
+ * (with pre-hydration toggle shim) into
10
+ * `pages/lib/_body-end-islands.tsx` via the three @slot: anchors
11
+ * (imports / display-names / extra-islands). Mirrors the tauri feature
12
+ * injection shape (zudolab/zudo-doc#2162).
11
13
  */
12
14
  export declare const designTokenPanelFeature: FeatureModule;
@@ -1,12 +1,38 @@
1
+ /**
2
+ * Pre-hydration toggle shim for the zdtp panel (inline, minified).
3
+ *
4
+ * Emitted as a <script dangerouslySetInnerHTML> alongside the
5
+ * DesignTokenPanelBootstrap Island so the header palette button is
6
+ * responsive before the island hydrates. Records the first click as a
7
+ * boolean flag and exposes window.__zdtpReadyClicks so the bootstrap
8
+ * module can drain and re-dispatch once the real zdtp listener is live.
9
+ * Guards against double-installation across SPA body swaps via
10
+ * __zdtpToggleShimInstalled. Mirrors the host's ZDTP_TOGGLE_SHIM_SRC
11
+ * constant (pages/lib/_body-end-islands.tsx, zudolab/zudo-doc#1627 Part B).
12
+ */
13
+ const ZDTP_TOGGLE_SHIM_SRC = `(function(){
14
+ if(window.__zdtpToggleShimInstalled)return;
15
+ window.__zdtpToggleShimInstalled=true;
16
+ var pending=false;
17
+ function shim(){pending=true;}
18
+ window.addEventListener('toggle-design-token-panel',shim);
19
+ window.__zdtpReadyClicks=function(){
20
+ window.removeEventListener('toggle-design-token-panel',shim);
21
+ delete window.__zdtpReadyClicks;
22
+ if(pending){pending=false;window.dispatchEvent(new CustomEvent('toggle-design-token-panel'));}
23
+ };
24
+ })();`;
1
25
  /**
2
26
  * Design-token-panel (zdtp) feature.
3
27
  *
4
- * Injects the zdtp CSS @import at `@slot:global-css:feature-styles` in
5
- * `src/styles/global.css`. The bootstrap is loaded by
6
- * `pages/lib/design-token-panel-bootstrap` as a side effect when the
7
- * feature is enabled, and the header trigger is rendered by
8
- * `pages/lib/_header-with-defaults.tsx` from the `settings.headerRightItems`
9
- * entry `{ type: "trigger", trigger: "design-token-panel" }`.
28
+ * Injects:
29
+ * 1. The zdtp CSS @import at `@slot:global-css:feature-styles` in
30
+ * `src/styles/global.css`.
31
+ * 2. The DesignTokenPanelBootstrap import, displayName, and Island mount
32
+ * (with pre-hydration toggle shim) into
33
+ * `pages/lib/_body-end-islands.tsx` via the three @slot: anchors
34
+ * (imports / display-names / extra-islands). Mirrors the tauri feature
35
+ * injection shape (zudolab/zudo-doc#2162).
10
36
  */
11
37
  export const designTokenPanelFeature = () => ({
12
38
  name: "designTokenPanel",
@@ -21,5 +47,54 @@ export const designTokenPanelFeature = () => ({
21
47
  anchor: "/* @slot:global-css:feature-styles */",
22
48
  content: `@import "@takazudo/zdtp/styles.css";`,
23
49
  },
50
+ // 1. Import the island entry. Inserted AFTER the
51
+ // `// @slot:body-end-islands:imports` anchor.
52
+ {
53
+ file: "pages/lib/_body-end-islands.tsx",
54
+ anchor: "// @slot:body-end-islands:imports",
55
+ position: "after",
56
+ content: `import DesignTokenPanelBootstrap from "@/components/design-token-panel-bootstrap";`,
57
+ },
58
+ // 2. Stable island marker name (belt-and-braces guard matching the
59
+ // sibling islands in the file). Inserted AFTER the
60
+ // `// @slot:body-end-islands:display-names` anchor.
61
+ {
62
+ file: "pages/lib/_body-end-islands.tsx",
63
+ anchor: "// @slot:body-end-islands:display-names",
64
+ position: "after",
65
+ content: `(DesignTokenPanelBootstrap as { displayName?: string }).displayName = "DesignTokenPanelBootstrap";`,
66
+ },
67
+ // 4. Extend HeaderRightTriggerName with "design-token-panel". Uses
68
+ // replace-range between the :start/:end anchors in settings-types.ts
69
+ // so the base template emits only "ai-chat" and this injection adds
70
+ // the zdtp trigger only when the feature is on (zudolab/zudo-doc#2162).
71
+ {
72
+ file: "src/config/settings-types.ts",
73
+ anchor: "// @slot:settings-types:trigger-names:start",
74
+ position: "replace",
75
+ content: `export type HeaderRightTriggerName = "design-token-panel" | "ai-chat";`,
76
+ },
77
+ // 3. Island mount + pre-hydration toggle shim. Inserted AFTER the
78
+ // `{/* @slot:body-end-islands:extra-islands */}` anchor.
79
+ // when="load" (not "idle"): the bootstrap module registers the
80
+ // `toggle-design-token-panel` window listener as a side effect of
81
+ // its import, so it must hydrate as early as possible (zudolab/zudo-doc#1623).
82
+ // The inline <script> is the pre-hydration shim (zudolab/zudo-doc#1627 Part B).
83
+ {
84
+ file: "pages/lib/_body-end-islands.tsx",
85
+ anchor: "{/* @slot:body-end-islands:extra-islands */}",
86
+ position: "after",
87
+ content: ` {/* zdtp panel bootstrap: hydrates on load so configurePanel() runs early
88
+ and the toggle-design-token-panel listener is live before the user
89
+ clicks the header trigger. The inline script is the pre-hydration
90
+ shim that queues the first click (zudolab/zudo-doc#1627 Part B). */}
91
+ <script
92
+ dangerouslySetInnerHTML={{ __html: ${JSON.stringify(ZDTP_TOGGLE_SHIM_SRC)} }}
93
+ />
94
+ {Island({
95
+ when: "load",
96
+ children: <DesignTokenPanelBootstrap />,
97
+ }) as unknown as VNode}`,
98
+ },
24
99
  ],
25
100
  });
package/dist/scaffold.js CHANGED
@@ -202,6 +202,16 @@ export async function scaffold(choices) {
202
202
  ".wrangler/",
203
203
  "",
204
204
  ].join("\n"));
205
+ // Emit an .npmrc exempting undici-types from pnpm's trust-downgrade policy.
206
+ // External pnpm supply-chain quirk (pnpm >= 10.21, https://github.com/pnpm/pnpm/issues/8889):
207
+ // when a consumer enables `trust-policy=no-downgrade` (off by default, but a
208
+ // common hardened posture), `pnpm install` aborts with ERR_PNPM_TRUST_DOWNGRADE
209
+ // on undici-types@6.21.0 — a transitive dep of @types/node@^22 whose earlier
210
+ // releases carried provenance attestation that 6.21.0 dropped. The package is a
211
+ // type-only stub and safe; this narrow exclusion lets a fresh scaffold install
212
+ // under a strict trust policy without disabling the guard wholesale. Pinned to
213
+ // the exact known-safe version so a future undici-types bump is re-reviewed.
214
+ await fs.outputFile(path.join(targetDir, ".npmrc"), "trust-policy-exclude[]=undici-types@6.21.0\n");
205
215
  const claudeContent = generateCLAUDEFile(choices);
206
216
  await fs.outputFile(path.join(targetDir, "CLAUDE.md"), claudeContent);
207
217
  // 4. Compose features (copy feature files + inject into shared files)
@@ -290,21 +300,26 @@ function generatePackageJson(choices) {
290
300
  // extraWatchPaths rebuilds, and TS-config-loader path canonicalization
291
301
  // (Takazudo/zudo-front-builder#1036–#1043). next.45: docs-only. next.46:
292
302
  // opt-in dev boot-lazy mode (#1057) + client-router timer lifecycle fixes —
293
- // dev-server-only. next.47 (current pin): dual light/dark syntect themes
294
- // (themeLight/themeDark on CodeHighlightConfig, --shiki-light/--shiki-dark,
295
- // #1067) plus stricter build-start validation that rejects unknown theme
296
- // names additive; a fresh scaffold sets no explicit codeHighlight.theme so
297
- // the default still applies. No consumer-facing / CLI breaking change.
298
- "@takazudo/zfb": "0.1.0-next.47",
299
- "@takazudo/zfb-runtime": "0.1.0-next.47",
303
+ // dev-server-only. next.47: dual light/dark syntect themes (themeLight/
304
+ // themeDark on CodeHighlightConfig, --shiki-light/--shiki-dark, #1067) plus
305
+ // stricter build-start validation that rejects unknown theme names. next.48:
306
+ // re-export @takazudo/zfb/config from the zfb-shim.d.ts type shim type-only
307
+ // fix, additive. next.49 (current pin): client-router WebKit bfcache fix
308
+ // re-sync the history index + originalLocation on a bfcache restore so
309
+ // browser Back after an SPA navigation returns to the previous page instead
310
+ // of skipping an entry — runtime-only bug fix, additive. A fresh scaffold
311
+ // sets no explicit codeHighlight.theme so the default still applies. No
312
+ // consumer-facing / CLI breaking change.
313
+ "@takazudo/zfb": "0.1.0-next.49",
314
+ "@takazudo/zfb-runtime": "0.1.0-next.49",
300
315
  // zfb-adapter-cloudflare — required for any route with `prerender = false`.
301
316
  // Pinned in lockstep with @takazudo/zfb.
302
- "@takazudo/zfb-adapter-cloudflare": "0.1.0-next.47",
317
+ "@takazudo/zfb-adapter-cloudflare": "0.1.0-next.49",
303
318
  // @takazudo/zudo-doc — published from this monorepo via
304
319
  // .github/workflows/publish-zudo-doc.yml. The pin here is bumped in
305
320
  // lockstep by scripts/release-create-zudo-doc.sh whenever zudo-doc's
306
321
  // version moves, so a fresh scaffold pulls the version we just published.
307
- "@takazudo/zudo-doc": "^0.2.8",
322
+ "@takazudo/zudo-doc": "^0.2.9",
308
323
  // zod — used by the generated zfb.config.ts. zfb-config-gen emits
309
324
  // `import { z } from "zod"` for the content-collection schema +
310
325
  // `z.toJSONSchema(...)` conversion. Without this dep, the consumer
@@ -359,7 +374,7 @@ function generatePackageJson(choices) {
359
374
  // @takazudo/zudo-doc/integrations/doc-history which in turn imports
360
375
  // @takazudo/zudo-doc-history-server/git-history. Without this dep the
361
376
  // plugin host fails at init with ERR_MODULE_NOT_FOUND — W8A (#1739).
362
- deps["@takazudo/zudo-doc-history-server"] = "^0.2.8";
377
+ deps["@takazudo/zudo-doc-history-server"] = "^0.2.9";
363
378
  // W7A (#1736): doc-history-plugin.mjs spawns `tsx -e <inline-script>` to
364
379
  // run the v2 runtime in a TS-aware Node subprocess; without tsx the
365
380
  // plugin's preBuild step exits with ENOENT before zfb finishes config
@@ -259,10 +259,17 @@ export function generateSettingsFile(choices) {
259
259
  if (choices.headerRightItems !== undefined) {
260
260
  // User-supplied override (including empty array): emit each entry verbatim,
261
261
  // in the chosen order. An empty array means "no header-right items" — honor it.
262
- // filterHeaderRightItems (src/utils/header-right-items.ts) handles runtime
263
- // hiding of items whose feature is disabledno need to gate emission
264
- // here on choices.features.
262
+ // DEFENSIVE STRIP: drop any "design-token-panel" trigger when the
263
+ // designTokenPanel feature is offthe type "design-token-panel" is absent
264
+ // from HeaderRightTriggerName in a feature-off scaffold (gated via
265
+ // @slot:settings-types:trigger-names), so emitting it would cause a TS error
266
+ // (zudolab/zudo-doc#2162).
265
267
  for (const item of choices.headerRightItems) {
268
+ if (item.type === "trigger" &&
269
+ item.trigger === "design-token-panel" &&
270
+ !choices.features.includes("designTokenPanel")) {
271
+ continue;
272
+ }
266
273
  if (item.type === "trigger") {
267
274
  lines.push(` { type: "trigger", trigger: ${JSON.stringify(item.trigger)} },`);
268
275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-zudo-doc",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Create a new zudo-doc documentation site",
5
5
  "license": "MIT",
6
6
  "author": "Takeshi Takatsudo",
@@ -34,7 +34,6 @@ import { settings } from "@/config/settings";
34
34
 
35
35
  import AiChatModal from "@/components/ai-chat-modal";
36
36
  import ClientRouterBootstrap from "@/components/client-router-bootstrap";
37
- import DesignTokenPanelBootstrap from "@/components/design-token-panel-bootstrap";
38
37
  import ImageEnlarge, { ImageEnlargeSsrFallback } from "@/components/image-enlarge";
39
38
  import { PageLoadingOverlay } from "@takazudo/zudo-doc/page-loading";
40
39
  // @slot:body-end-islands:imports
@@ -49,8 +48,6 @@ import { PageLoadingOverlay } from "@takazudo/zudo-doc/page-loading";
49
48
  (AiChatModal as { displayName?: string }).displayName = "AiChatModal";
50
49
  (ClientRouterBootstrap as { displayName?: string }).displayName =
51
50
  "ClientRouterBootstrap";
52
- (DesignTokenPanelBootstrap as { displayName?: string }).displayName =
53
- "DesignTokenPanelBootstrap";
54
51
  (ImageEnlarge as { displayName?: string }).displayName = "ImageEnlarge";
55
52
  // @slot:body-end-islands:display-names
56
53
 
@@ -64,37 +61,6 @@ import { PageLoadingOverlay } from "@takazudo/zudo-doc/page-loading";
64
61
  */
65
62
  const DEFAULT_AI_CHAT_BODY_LABEL = "Ask a question about the documentation.";
66
63
 
67
- /**
68
- * SSR-emitted inline script that acts as a pre-hydration shim for the
69
- * `toggle-design-token-panel` window event. Because the
70
- * DesignTokenPanelBootstrap Island is deferred, zdtp's real
71
- * `toggle-design-token-panel` listener (registered in index.tsx at
72
- * module init) is not yet installed when the user clicks the header
73
- * palette button. This shim:
74
- *
75
- * 1. Records the first (and only meaningful) click as a boolean flag.
76
- * 2. Exposes `window.__zdtpReadyClicks` so the bootstrap Island can
77
- * drain the queue and re-dispatch a single event once the real
78
- * listener is live.
79
- * 3. Guards against double-installation across any re-evaluation path
80
- * (SPA body swap, HMR, etc.) via `__zdtpToggleShimInstalled`.
81
- *
82
- * A single boolean (not an array) is used because the panel is a toggle —
83
- * any number of pre-hydration clicks should result in at most one open.
84
- */
85
- const ZDTP_TOGGLE_SHIM_SRC = `(function(){
86
- if(window.__zdtpToggleShimInstalled)return;
87
- window.__zdtpToggleShimInstalled=true;
88
- var pending=false;
89
- function shim(){pending=true;}
90
- window.addEventListener('toggle-design-token-panel',shim);
91
- window.__zdtpReadyClicks=function(){
92
- window.removeEventListener('toggle-design-token-panel',shim);
93
- delete window.__zdtpReadyClicks;
94
- if(pending){pending=false;window.dispatchEvent(new CustomEvent('toggle-design-token-panel'));}
95
- };
96
- })();`;
97
-
98
64
  /** Props for {@link BodyEndIslands}. */
99
65
  export interface BodyEndIslandsProps {
100
66
  /** Base path the AI chat modal uses to construct API URLs. */
@@ -109,15 +75,18 @@ export interface BodyEndIslandsProps {
109
75
  }
110
76
 
111
77
  /**
112
- * The default body-end islands a doc page may mount: the design-token
113
- * tweak panel (overlay, fixed-position), the AI chat modal (`<dialog>`
114
- * overlay), and the image-enlarge dialog (mounted lazily based on
115
- * viewport scan). Each is feature-gated — the design-token panel on
116
- * `settings.designTokenPanel`, the AI chat modal (and its sr-only
117
- * landmark heading) on `settings.aiAssistant`, and image-enlarge on
118
- * `settings.imageEnlarge` — so a feature-off consumer ships neither the
78
+ * The default body-end islands a doc page may mount: the AI chat modal
79
+ * (`<dialog>` overlay) and the image-enlarge dialog (mounted lazily based
80
+ * on viewport scan). Each is feature-gated the AI chat modal (and its
81
+ * sr-only landmark heading) on `settings.aiAssistant`, and image-enlarge
82
+ * on `settings.imageEnlarge` so a feature-off consumer ships neither the
119
83
  * island marker nor a misleading landmark (zudolab/zudo-doc#2058).
120
84
  *
85
+ * Optional feature islands (e.g. the design token panel bootstrap) are not
86
+ * listed here: they are injected at the body-end-islands composition
87
+ * anchors only when their feature is selected, so a feature-off scaffold
88
+ * carries no trace of them.
89
+ *
121
90
  * Each island is wrapped in `<Island ssrFallback>` so the heavy
122
91
  * component is NOT evaluated server-side — they depend on
123
92
  * `dialog.showModal()`, `localStorage`, `ResizeObserver`, runtime
@@ -143,37 +112,12 @@ export function BodyEndIslands({
143
112
  children: <ClientRouterBootstrap />,
144
113
  }) as unknown as VNode;
145
114
 
146
- // Hydrates on load so configurePanel() runs as early as possible and
147
- // the `toggle-design-token-panel` window listener is registered before
148
- // the user can click the header trigger. Renders nothing visually —
149
- // the zdtp panel self-mounts as a side-effect (zudolab/zudo-doc#1623).
150
- //
151
- // The inline <script> emitted alongside the Island is the pre-hydration
152
- // toggle shim (zudolab/zudo-doc#1627 Part B). It captures the first
153
- // click as a boolean flag and exposes window.__zdtpReadyClicks so the
154
- // bootstrap module can drain and re-dispatch once the real zdtp listener
155
- // is registered. Mirrors the PageLoadingOverlay SSR-script pattern.
156
- const designTokenPanelBootstrap =
157
- settings.designTokenPanel
158
- ? (
159
- <>
160
- <script
161
- dangerouslySetInnerHTML={{ __html: ZDTP_TOGGLE_SHIM_SRC }}
162
- />
163
- {Island({
164
- when: "load",
165
- children: <DesignTokenPanelBootstrap />,
166
- }) as unknown as VNode}
167
- </>
168
- )
169
- : null;
170
-
171
115
  // Gated on `settings.aiAssistant` (zudolab/zudo-doc#2058): when the AI
172
116
  // assistant feature is off, neither the AiChatModal island marker nor the
173
117
  // sr-only "AI Assistant" landmark heading should reach the SSG output —
174
118
  // otherwise feature-off consumers ship a dead island marker plus a
175
119
  // misleading screen-reader landmark for a section that never hydrates.
176
- // Mirrors the `designTokenPanel` gating above.
120
+ // Same feature-gating pattern as the other optional body-end islands.
177
121
  //
178
122
  // KNOWN CAVEAT: zfb's island scanner walks the static `"use client"`
179
123
  // import chain, so gating this JSX removes the SSR marker and heading but
@@ -222,7 +166,6 @@ export function BodyEndIslands({
222
166
  zfb:before-preparation / zfb:after-swap listeners at runtime. */}
223
167
  <PageLoadingOverlay />
224
168
  {clientRouterBootstrap}
225
- {designTokenPanelBootstrap}
226
169
  {aiAssistant}
227
170
  {imageEnlarge}
228
171
  {/* @slot:body-end-islands:extra-islands */}
@@ -11,11 +11,12 @@ export interface ColorScheme {
11
11
  string, string, string, string, string, string, string, string,
12
12
  string, string, string, string, string, string, string, string,
13
13
  ];
14
- /** Optional, vestigial. Carried only in the zdtp panel's color-scheme
15
- * config envelope (falls back to DEFAULT_SHIKI_THEME when omitted), but has
16
- * no visible effect: zdtp's Shiki integration is a no-op stub, and page code
17
- * highlighting is done by syntect (dual-theme, configured via `codeHighlight`
18
- * in zfb.config.ts), not Shiki. */
14
+ /** Optional, vestigial. Carried only in the optional color-scheme config
15
+ * envelope consumed by the design token panel tooling (falls back to
16
+ * DEFAULT_SHIKI_THEME when omitted), but has no visible effect: that
17
+ * tooling's Shiki integration is a no-op stub, and page code highlighting is
18
+ * done by syntect (dual-theme, configured via `codeHighlight` in
19
+ * zfb.config.ts), not Shiki. */
19
20
  shikiTheme?: string;
20
21
  /** Optional semantic overrides — when omitted, defaults are used:
21
22
  * surface=p0, muted=p8, accent=p5, accentHover=p14
@@ -16,7 +16,9 @@ export type HeaderRightComponentName =
16
16
  | "github-link"
17
17
  | "search";
18
18
 
19
- export type HeaderRightTriggerName = "design-token-panel" | "ai-chat";
19
+ // @slot:settings-types:trigger-names:start
20
+ export type HeaderRightTriggerName = "ai-chat";
21
+ // @slot:settings-types:trigger-names:end
20
22
 
21
23
  export interface HeaderRightComponentItem {
22
24
  type: "component";
@@ -17,8 +17,9 @@
17
17
  *
18
18
  * The package ships a build-generated safelist at `dist/safelist.css`
19
19
  * (zudolab/zudo-doc#1993). Importing it via the module resolver is
20
- * reliable across all consumer environments — same code path as the
21
- * existing `@import "@takazudo/zdtp/styles.css"` below.
20
+ * reliable across all consumer environments — the same module-resolver
21
+ * code path used for any feature stylesheet injected at the
22
+ * `@slot:global-css:feature-styles` anchor below.
22
23
  *
23
24
  * Why not @source the package dist/ glob? The old approach
24
25
  * (`@source "../../node_modules/@takazudo/zudo-doc/dist/**"`) was
@@ -1,15 +0,0 @@
1
- // W6A stub — no-op default Preact wrapper.
2
- //
3
- // When the designTokenPanel feature is enabled, the feature template
4
- // overwrites this file with the real wrapper that side-effect-imports
5
- // `@/lib/design-token-panel-bootstrap` (which calls configurePanel and
6
- // mounts zdtp). Generated projects without the feature ship the no-op
7
- // so the unconditional `pages/lib/_body-end-islands` import resolves.
8
- import type { JSX } from "preact";
9
-
10
- function DesignTokenPanelBootstrap(): JSX.Element | null {
11
- return null;
12
- }
13
- DesignTokenPanelBootstrap.displayName = "DesignTokenPanelBootstrap";
14
-
15
- export default DesignTokenPanelBootstrap;
@@ -1,38 +0,0 @@
1
- import { settings } from "@/config/settings";
2
- import type { HeaderRightItem } from "@/config/settings-types";
3
-
4
- function isDesignTokenPanelEnabled(): boolean {
5
- return Boolean(settings.designTokenPanel);
6
- }
7
-
8
- export function filterHeaderRightItems(
9
- items: HeaderRightItem[],
10
- ): HeaderRightItem[] {
11
- return items.filter((item) => {
12
- if (item.type === "trigger") {
13
- if (item.trigger === "design-token-panel") {
14
- return isDesignTokenPanelEnabled();
15
- }
16
- if (item.trigger === "ai-chat") {
17
- return Boolean(settings.aiAssistant);
18
- }
19
- }
20
-
21
- if (item.type === "component") {
22
- if (item.component === "theme-toggle") {
23
- return Boolean(settings.colorMode);
24
- }
25
- if (item.component === "language-switcher") {
26
- return Object.keys(settings.locales).length > 0;
27
- }
28
- if (item.component === "version-switcher") {
29
- return Boolean(settings.versions);
30
- }
31
- if (item.component === "github-link") {
32
- return Boolean(settings.githubUrl);
33
- }
34
- }
35
-
36
- return true;
37
- });
38
- }