@takazudo/zudo-sg 0.2.1 → 0.2.2
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 +13 -0
- package/README.md +5 -1
- package/dist/config/index.d.ts +7 -1
- package/dist/config/index.js +38 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ All notable changes to `@takazudo/zudo-sg` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on Keep a Changelog, and release notes are generated from the changelog MDX pages.
|
|
6
6
|
|
|
7
|
+
## [0.2.2] - 2026-09-20
|
|
8
|
+
|
|
9
|
+
Minimal hosts now expose the engine's routes in their header without requiring
|
|
10
|
+
additional navigation configuration.
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- `withZudoSg` fills an empty host header with Components and Design Tokens
|
|
15
|
+
links and a search control. Existing non-empty navigation remains unchanged,
|
|
16
|
+
and `chromeDefaults: false` preserves an intentionally empty header.
|
|
17
|
+
- Default engine links honor custom route paths and deployment bases while
|
|
18
|
+
remaining global on translated and versioned documentation pages.
|
|
19
|
+
|
|
7
20
|
## [0.2.1] - 2026-09-20
|
|
8
21
|
|
|
9
22
|
This release removes host-specific assumptions from generated registries and
|
package/README.md
CHANGED
|
@@ -108,7 +108,11 @@ export default defineConfig(
|
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
`withZudoSg` merges the engine's plugins and collections after the zudo-doc
|
|
111
|
-
preset's own.
|
|
111
|
+
preset's own. When the zudo-doc preset has an empty `headerNav`, it also adds
|
|
112
|
+
the engine-owned Components and Design Tokens links and the standard search
|
|
113
|
+
control. Any non-empty host navigation stays authoritative; set
|
|
114
|
+
`chromeDefaults: false` in the second argument to keep an intentionally empty
|
|
115
|
+
header. The engine requires `packageOwnedRoutes: true` on the host (its
|
|
112
116
|
routes import zudo-doc's route-context virtual modules). On the engine's zfb
|
|
113
117
|
peer floor (≥ 2.18.0) nothing else is needed: `zfb dev` seeds its island
|
|
114
118
|
scanner from the injected routes. `@takazudo/zudo-sg/islands` remains
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { componentDocsCollectionName } from "../registry/component-docs.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type SgRoutes } from "../sg-routes.js";
|
|
3
3
|
export declare const ROUTES_PLUGIN_NAME = "@takazudo/zudo-sg/plugins/routes";
|
|
4
4
|
export declare const PREVIEW_CSS_PLUGIN_NAME = "@takazudo/zudo-sg/plugins/preview-css";
|
|
5
5
|
export declare const ZDTP_APPLY_PROXY_PLUGIN_NAME = "@takazudo/zudo-sg/plugins/zdtp-apply-proxy";
|
|
@@ -34,6 +34,12 @@ export interface ZudoSgComposeOptions {
|
|
|
34
34
|
title?: string;
|
|
35
35
|
intro?: string;
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Populate an otherwise empty zudo-doc header with links to the engine-owned
|
|
39
|
+
* Components and Design Tokens routes, plus search. Defaults to true.
|
|
40
|
+
* Existing host navigation remains authoritative and is never replaced.
|
|
41
|
+
*/
|
|
42
|
+
chromeDefaults?: boolean;
|
|
37
43
|
/** `tokens.manifestOut` feeds the `/tokens` route's dashboards (routes plugin `tokensManifestModule`). */
|
|
38
44
|
tokens?: {
|
|
39
45
|
manifestOut?: string;
|
package/dist/config/index.js
CHANGED
|
@@ -4,13 +4,48 @@ import {
|
|
|
4
4
|
componentDocsRoots
|
|
5
5
|
} from "../registry/component-docs.js";
|
|
6
6
|
import { DEFAULT_PREVIEW_CSS_URL } from "../sg-context.js";
|
|
7
|
+
import { resolveSgRoutes } from "../sg-routes.js";
|
|
7
8
|
const ROUTES_PLUGIN_NAME = "@takazudo/zudo-sg/plugins/routes";
|
|
8
9
|
const PREVIEW_CSS_PLUGIN_NAME = "@takazudo/zudo-sg/plugins/preview-css";
|
|
9
10
|
const ZDTP_APPLY_PROXY_PLUGIN_NAME = "@takazudo/zudo-sg/plugins/zdtp-apply-proxy";
|
|
11
|
+
const ZUDO_DOC_ROUTES_PLUGIN_NAME = "@takazudo/zudo-doc/plugins/routes";
|
|
10
12
|
const COMPONENT_DOCS_COLLECTION_BASE = COMPONENT_DOCS_COLLECTION;
|
|
11
13
|
function definedOnly(record) {
|
|
12
14
|
return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== void 0));
|
|
13
15
|
}
|
|
16
|
+
function isRecord(value) {
|
|
17
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18
|
+
}
|
|
19
|
+
function withStyleguideChromeDefaults(plugin, routes) {
|
|
20
|
+
if (!isRecord(plugin) || plugin.name !== ZUDO_DOC_ROUTES_PLUGIN_NAME) return plugin;
|
|
21
|
+
const options = isRecord(plugin.options) ? plugin.options : {};
|
|
22
|
+
const settings = isRecord(options.settings) ? options.settings : {};
|
|
23
|
+
const headerNav = Array.isArray(settings.headerNav) ? settings.headerNav : [];
|
|
24
|
+
if (headerNav.length > 0) return plugin;
|
|
25
|
+
const headerRightItems = Array.isArray(settings.headerRightItems) ? settings.headerRightItems : [];
|
|
26
|
+
const hasSearch = headerRightItems.some(
|
|
27
|
+
(item) => isRecord(item) && item.type === "component" && item.component === "search"
|
|
28
|
+
);
|
|
29
|
+
return {
|
|
30
|
+
...plugin,
|
|
31
|
+
options: {
|
|
32
|
+
...options,
|
|
33
|
+
settings: {
|
|
34
|
+
...settings,
|
|
35
|
+
headerNav: [
|
|
36
|
+
{ label: "Components", path: routes.componentsIndex, categoryMatch: "components", versioned: false },
|
|
37
|
+
{ label: "Design Tokens", path: routes.tokens, versioned: false }
|
|
38
|
+
],
|
|
39
|
+
// Engine navigation targets global routes, including from translated docs.
|
|
40
|
+
defaultLocaleOnlyPrefixes: [.../* @__PURE__ */ new Set([
|
|
41
|
+
...Array.isArray(settings.defaultLocaleOnlyPrefixes) ? settings.defaultLocaleOnlyPrefixes : [],
|
|
42
|
+
...[routes.componentsIndex, routes.tokens].map((path) => `${path.replace(/\/+$/, "")}/`)
|
|
43
|
+
])],
|
|
44
|
+
headerRightItems: hasSearch ? headerRightItems : [...headerRightItems, { type: "component", component: "search" }]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
14
49
|
function zudoSg(options) {
|
|
15
50
|
if (!options || typeof options !== "object") {
|
|
16
51
|
throw new Error("[zudo-sg] zudoSg(options) requires an options object (the zudo-sg.config.mjs shape)");
|
|
@@ -51,9 +86,11 @@ function zudoSg(options) {
|
|
|
51
86
|
}
|
|
52
87
|
function withZudoSg(presetFragment, options) {
|
|
53
88
|
const sg = zudoSg(options);
|
|
89
|
+
const presetPlugins = [...presetFragment.plugins ?? []];
|
|
90
|
+
const pluginsWithChrome = options.chromeDefaults === false ? presetPlugins : presetPlugins.map((plugin) => withStyleguideChromeDefaults(plugin, resolveSgRoutes(options.routes)));
|
|
54
91
|
return {
|
|
55
92
|
...presetFragment,
|
|
56
|
-
plugins: [...
|
|
93
|
+
plugins: [...pluginsWithChrome, ...sg.plugins],
|
|
57
94
|
collections: [...presetFragment.collections ?? [], ...sg.collections]
|
|
58
95
|
};
|
|
59
96
|
}
|
package/package.json
CHANGED