@takazudo/zudo-doc 0.1.0 → 0.2.0-next.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/dist/body-foot-util/body-foot-util-area.d.ts +1 -1
- package/dist/body-foot-util/edit-link.d.ts +1 -1
- package/dist/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/code-syntax/code-block-enhancer.d.ts +1 -1
- package/dist/code-syntax/mermaid-init.d.ts +1 -1
- package/dist/code-syntax/tabs-init.d.ts +1 -1
- package/dist/code-syntax/tabs.d.ts +1 -1
- package/dist/details/details.d.ts +2 -2
- package/dist/doclayout/anchors.d.ts +2 -2
- package/dist/doclayout/doc-layout-with-defaults.d.ts +1 -1
- package/dist/footer/types.d.ts +1 -1
- package/dist/head/doc-head.d.ts +3 -3
- package/dist/head/og-tags.d.ts +4 -4
- package/dist/header/header.d.ts +1 -1
- package/dist/header/nav-active.d.ts +1 -1
- package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +9 -12
- package/dist/i18n-version/version-switcher.d.ts +1 -1
- package/dist/integrations/llms-txt/load.js +1 -0
- package/dist/integrations/search-index/content-files.js +1 -0
- package/dist/integrations/search-index/types.d.ts +1 -1
- package/dist/metainfo/doc-metainfo.d.ts +2 -2
- package/dist/metainfo/doc-tags.d.ts +5 -5
- package/dist/metainfo/frontmatter-preview.d.ts +1 -1
- package/dist/nav-indexing/category-nav.d.ts +1 -1
- package/dist/nav-indexing/category-tree-nav.d.ts +1 -1
- package/dist/nav-indexing/doc-card-grid.d.ts +1 -1
- package/dist/nav-indexing/docs-sitemap.d.ts +1 -1
- package/dist/nav-indexing/nav-card-grid.d.ts +1 -1
- package/dist/nav-indexing/site-tree-nav-demo.d.ts +1 -1
- package/dist/nav-indexing/tag-nav.d.ts +1 -1
- package/dist/nav-indexing/versions-page-content.d.ts +1 -1
- package/dist/sidebar/sidebar.d.ts +1 -1
- package/dist/sidebar/types.d.ts +1 -1
- package/dist/sidebar-resizer/index.d.ts +1 -1
- package/dist/sidebar-resizer/index.js +13 -5
- package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +21 -1
- package/dist/sidebar-resizer/sidebar-resizer-init.js +25 -3
- package/package.json +6 -6
|
@@ -43,7 +43,7 @@ interface BodyFootUtilAreaProps {
|
|
|
43
43
|
/**
|
|
44
44
|
* Footer utility area shown below an article body — composes the
|
|
45
45
|
* "View source on GitHub" link and the host-supplied doc-history
|
|
46
|
-
* island. JSX port of `
|
|
46
|
+
* island. JSX port of the legacy `body-foot-util-area` component.
|
|
47
47
|
*
|
|
48
48
|
* Returns `null` when neither slot has anything to render, mirroring
|
|
49
49
|
* the `hasContent && (...)` guard in the original template so the
|
|
@@ -33,7 +33,7 @@ interface EditLinkProps {
|
|
|
33
33
|
label?: string;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* "Edit this page" link — JSX port of `
|
|
36
|
+
* "Edit this page" link — JSX port of the legacy `edit-link` component.
|
|
37
37
|
*
|
|
38
38
|
* The legacy component owned three concerns: URL computation, i18n
|
|
39
39
|
* lookup, and presentation. v2 keeps only presentation; URL and label
|
|
@@ -42,14 +42,14 @@ interface BreadcrumbProps {
|
|
|
42
42
|
rightSlot?: ComponentChildren;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Breadcrumb trail
|
|
45
|
+
* Breadcrumb trail component.
|
|
46
46
|
*
|
|
47
47
|
* Two usage shapes:
|
|
48
48
|
* 1. Pass pre-built `items` (existing call-sites that already
|
|
49
49
|
* compute crumbs upstream).
|
|
50
50
|
* 2. Pass `tree` + `currentId` and the component derives the trail.
|
|
51
51
|
*
|
|
52
|
-
* Returns null when no items resolve, matching the
|
|
52
|
+
* Returns null when no items resolve, matching the documented
|
|
53
53
|
* `items.length > 0 &&` guard.
|
|
54
54
|
*/
|
|
55
55
|
declare function Breadcrumb(props: BreadcrumbProps): VNode | null;
|
|
@@ -4,7 +4,7 @@ import { JSX } from 'preact';
|
|
|
4
4
|
/** @jsxImportSource preact */
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Drop-in JSX replacement for `
|
|
7
|
+
* Drop-in JSX replacement for the legacy `code-block-enhancer` component.
|
|
8
8
|
*
|
|
9
9
|
* Include **once** in the layout. Renders the screen-reader announce region
|
|
10
10
|
* and emits the code-block enhancer init script via `dangerouslySetInnerHTML`.
|
|
@@ -31,7 +31,7 @@ interface MermaidInitProps {
|
|
|
31
31
|
script?: string;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Drop-in JSX replacement for `
|
|
34
|
+
* Drop-in JSX replacement for the legacy `mermaid-init` component.
|
|
35
35
|
*
|
|
36
36
|
* Include **once** in the layout. Emits the mermaid init script via
|
|
37
37
|
* `dangerouslySetInnerHTML`. The script lazily imports mermaid only when
|
|
@@ -4,7 +4,7 @@ import { JSX } from 'preact';
|
|
|
4
4
|
/** @jsxImportSource preact */
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Drop-in JSX replacement for `
|
|
7
|
+
* Drop-in JSX replacement for the legacy `tabs-init` component.
|
|
8
8
|
*
|
|
9
9
|
* Include **once** in the layout (e.g. in the `<body>` foot). Emits the
|
|
10
10
|
* tabs interactivity script via `dangerouslySetInnerHTML`.
|
|
@@ -14,7 +14,7 @@ interface TabsProps {
|
|
|
14
14
|
children?: ComponentChildren;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Server-rendered tab container — JSX port of `
|
|
17
|
+
* Server-rendered tab container — JSX port of the legacy `tabs` component.
|
|
18
18
|
*
|
|
19
19
|
* Iterates `children` via `toChildArray` to discover `<TabItem>` elements
|
|
20
20
|
* and renders their labels as `<button>` elements in the tab nav bar.
|
|
@@ -7,7 +7,7 @@ interface DetailsProps {
|
|
|
7
7
|
/**
|
|
8
8
|
* Summary / toggle label shown in the `<summary>` element.
|
|
9
9
|
* Defaults to `"Details"` — the same fallback used by the legacy
|
|
10
|
-
* `src/components/details
|
|
10
|
+
* `src/components/details`.
|
|
11
11
|
*/
|
|
12
12
|
title?: string;
|
|
13
13
|
/** Slot content rendered inside the collapsed body. */
|
|
@@ -15,7 +15,7 @@ interface DetailsProps {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Collapsible `<details>` / `<summary>` block — JSX port of
|
|
18
|
-
* `src/components/details
|
|
18
|
+
* `src/components/details`.
|
|
19
19
|
*
|
|
20
20
|
* Keeps layout and token classes identical to the original template.
|
|
21
21
|
* The legacy component used Astro's `<slot />`; v2 accepts standard
|
|
@@ -22,7 +22,7 @@ interface DocLayoutAnchor {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* The 16 doc-layout anchors, in the order they appear in a scaffolded
|
|
25
|
-
*
|
|
25
|
+
* doc-layout file. Order is informational (useful for the drift
|
|
26
26
|
* checker's diagnostic output); identity is what matters.
|
|
27
27
|
*/
|
|
28
28
|
declare const DOC_LAYOUT_ANCHORS: readonly DocLayoutAnchor[];
|
|
@@ -43,7 +43,7 @@ declare function anchorComment(anchor: DocLayoutAnchor): string;
|
|
|
43
43
|
/**
|
|
44
44
|
* Convenience: every anchor's comment string, in declaration order. The
|
|
45
45
|
* drift checker can iterate this and assert each substring appears in the
|
|
46
|
-
* scaffolded
|
|
46
|
+
* scaffolded doc-layout file.
|
|
47
47
|
*/
|
|
48
48
|
declare function allAnchorComments(): readonly string[];
|
|
49
49
|
/**
|
|
@@ -74,7 +74,7 @@ interface DocLayoutWithDefaultsProps extends Omit<DocLayoutProps, "header" | "si
|
|
|
74
74
|
*
|
|
75
75
|
* The body of this component contains every body-region injection
|
|
76
76
|
* anchor as a JSX comment expression, so a literal-substring drift
|
|
77
|
-
* check between this file and the scaffolded
|
|
77
|
+
* check between this file and the scaffolded doc-layout file will
|
|
78
78
|
* find each anchor in both places. JSX comment expressions are
|
|
79
79
|
* compile-time-only and do not affect runtime output.
|
|
80
80
|
*/
|
package/dist/footer/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public types for the framework-agnostic footer shell.
|
|
3
3
|
*
|
|
4
|
-
* The original
|
|
4
|
+
* The original footer template mixed three concerns:
|
|
5
5
|
* 1. Reading `settings.footer` and applying locale overrides.
|
|
6
6
|
* 2. Loading the docs collection + tag vocabulary to build the
|
|
7
7
|
* optional taglist columns.
|
package/dist/head/doc-head.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ import { HeadProps } from './types.js';
|
|
|
8
8
|
* panel, etc.) are owned by other topic folders and composed by the host
|
|
9
9
|
* layout alongside this primitive.
|
|
10
10
|
*
|
|
11
|
-
* Output order is fixed and matches the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Output order is fixed and matches the legacy doc-layout emission so head
|
|
12
|
+
* HTML stays byte-identical (modulo asset hashes) to the pre-migration
|
|
13
|
+
* build for any fixture page:
|
|
14
14
|
*
|
|
15
15
|
* 1. <meta charset>
|
|
16
16
|
* 2. <meta name="viewport">
|
package/dist/head/og-tags.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ import { HeadProps } from './types.js';
|
|
|
5
5
|
* Open Graph meta tags. Emits og:title (always — defaults to `title`) plus
|
|
6
6
|
* any other og:* fields the caller has supplied.
|
|
7
7
|
*
|
|
8
|
-
* Output order matches the
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Output order matches the legacy doc-layout emission for byte parity:
|
|
9
|
+
* og:title → og:description → og:type → og:url → og:image → og:site_name.
|
|
10
|
+
* New og:* tags should be appended at the end of the list, never reordered,
|
|
11
|
+
* to keep snapshot diffs minimal.
|
|
12
12
|
*/
|
|
13
13
|
declare function OgTags(props: {
|
|
14
14
|
title: string;
|
package/dist/header/header.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ interface HeaderProps {
|
|
|
139
139
|
i18n: HeaderI18n;
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
|
-
* Site-header shell — JSX port of `src/components/header
|
|
142
|
+
* Site-header shell — JSX port of `src/components/header`.
|
|
143
143
|
*
|
|
144
144
|
* Responsibilities (matching the legacy template byte-for-byte):
|
|
145
145
|
* 1. Render the sticky `<header>` with the site logo and the desktop
|
|
@@ -8,7 +8,7 @@ interface NavItemLike {
|
|
|
8
8
|
/**
|
|
9
9
|
* Strip the locale prefix from `pathWithoutBase` when the page is being
|
|
10
10
|
* served under a non-default locale. Mirrors the inline regex inside
|
|
11
|
-
* `header
|
|
11
|
+
* `header` so the JSX port matches the legacy template's
|
|
12
12
|
* active-link behaviour.
|
|
13
13
|
*
|
|
14
14
|
* Examples:
|
|
@@ -23,9 +23,9 @@ interface HtmlPreviewWrapperProps {
|
|
|
23
23
|
* `head`, `css`, and `js` are prepended to the per-usage values so
|
|
24
24
|
* that global styles/scripts apply to every preview.
|
|
25
25
|
*
|
|
26
|
-
* The legacy
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* The legacy html-preview-wrapper read this directly from `settings`;
|
|
27
|
+
* v2 accepts it as a prop so the component has no upward dependency
|
|
28
|
+
* on the project settings module.
|
|
29
29
|
*/
|
|
30
30
|
globalConfig?: HtmlPreviewGlobalConfig | null;
|
|
31
31
|
/** HTML body content to display in the iframe. */
|
|
@@ -44,16 +44,13 @@ interface HtmlPreviewWrapperProps {
|
|
|
44
44
|
defaultOpen?: boolean;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* HTML preview wrapper
|
|
48
|
-
* `src/components/html-preview-wrapper.astro`.
|
|
47
|
+
* HTML preview wrapper component.
|
|
49
48
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* the critical path, so we defer hydration until the preview enters
|
|
56
|
-
* the viewport.
|
|
49
|
+
* Merges `settings.htmlPreview` (global config) with per-usage props and
|
|
50
|
+
* forwards everything to `<HtmlPreview>`. Wraps it in
|
|
51
|
+
* `<Island when="visible">`, mirroring the legacy `client:visible`
|
|
52
|
+
* hydration timing — the iframe is heavy and not on the critical path,
|
|
53
|
+
* so we defer hydration until the preview enters the viewport.
|
|
57
54
|
*/
|
|
58
55
|
declare function HtmlPreviewWrapper(props: HtmlPreviewWrapperProps): VNode;
|
|
59
56
|
|
|
@@ -104,7 +104,7 @@ declare function VersionSwitcher(props: VersionSwitcherProps): VNode;
|
|
|
104
104
|
* full vocabulary rationale.
|
|
105
105
|
*
|
|
106
106
|
* Lifted from the `<script>` block of the original
|
|
107
|
-
* version-switcher
|
|
107
|
+
* version-switcher; behaviour is unchanged modulo the lifecycle
|
|
108
108
|
* vocabulary swap.
|
|
109
109
|
*/
|
|
110
110
|
declare const VERSION_SWITCHER_INIT_SCRIPT: string;
|
|
@@ -14,6 +14,7 @@ function collectMdFiles(dir) {
|
|
|
14
14
|
for (const entry of entries) {
|
|
15
15
|
const fullPath = join(currentDir, entry.name);
|
|
16
16
|
if (entry.isDirectory()) {
|
|
17
|
+
if (entry.name.startsWith("_")) continue;
|
|
17
18
|
walk(fullPath, baseDir);
|
|
18
19
|
} else if (/\.mdx?$/.test(entry.name) && !entry.name.startsWith("_")) {
|
|
19
20
|
const rel = relative(baseDir, fullPath).replace(/\.mdx?$/, "").replace(/\/index$/, "");
|
|
@@ -16,6 +16,7 @@ function collectMdFiles(dir) {
|
|
|
16
16
|
for (const entry of entries) {
|
|
17
17
|
const fullPath = join(currentDir, entry.name);
|
|
18
18
|
if (entry.isDirectory()) {
|
|
19
|
+
if (entry.name.startsWith("_")) continue;
|
|
19
20
|
walk(fullPath, baseDir);
|
|
20
21
|
} else if (/\.mdx?$/.test(entry.name) && !entry.name.startsWith("_")) {
|
|
21
22
|
const rel = relative(baseDir, fullPath).replace(/\.mdx?$/, "").replace(/\/index$/, "");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* One page in the search index. The shape mirrors today's Astro
|
|
3
3
|
* integration output verbatim — keep it byte-identical so downstream
|
|
4
|
-
* consumers (search
|
|
4
|
+
* consumers (the search client island and packages/search-worker via
|
|
5
5
|
* MiniSearch) keep working unchanged after the zfb cutover.
|
|
6
6
|
*/
|
|
7
7
|
interface SearchIndexEntry {
|
|
@@ -6,7 +6,7 @@ import { VNode } from 'preact';
|
|
|
6
6
|
interface DocMetainfoProps {
|
|
7
7
|
/**
|
|
8
8
|
* Pre-formatted creation date string (e.g. `"Jan 1, 2024"`).
|
|
9
|
-
* The legacy `doc-metainfo
|
|
9
|
+
* The legacy `doc-metainfo` called `formatDate(gitInfo.createdAt,
|
|
10
10
|
* locale)` inline; v2 delegates that computation to the caller.
|
|
11
11
|
* Omit (or pass `null`) to suppress the "created" row.
|
|
12
12
|
*/
|
|
@@ -35,7 +35,7 @@ declare const DEFAULT_CREATED_LABEL = "Created";
|
|
|
35
35
|
declare const DEFAULT_UPDATED_LABEL = "Updated";
|
|
36
36
|
/**
|
|
37
37
|
* Document meta-information strip (created date, updated date, author)
|
|
38
|
-
* — JSX port of `src/components/doc-metainfo
|
|
38
|
+
* — JSX port of `src/components/doc-metainfo`.
|
|
39
39
|
*
|
|
40
40
|
* The legacy component owned three responsibilities: reading
|
|
41
41
|
* `settings.docMetainfo`, calling `getGitInfo(filePath)`, and
|
|
@@ -5,7 +5,7 @@ import { VNode } from 'preact';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A single resolved tag with its navigation href. The legacy
|
|
8
|
-
* `doc-tags
|
|
8
|
+
* `doc-tags` called `resolvePageTags(tags)` and used `TagNav`
|
|
9
9
|
* which computed `tagHref()` internally. v2 delegates both to the
|
|
10
10
|
* caller so the component has no upward dependency on project routing
|
|
11
11
|
* utilities.
|
|
@@ -18,7 +18,7 @@ interface ResolvedTag {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Controls vertical spacing: matches the `placement` prop on the
|
|
21
|
-
* legacy `doc-tags
|
|
21
|
+
* legacy `doc-tags` component.
|
|
22
22
|
*
|
|
23
23
|
* - `"after-title"` — tight top margin, bottom margin to separate from
|
|
24
24
|
* the body (`mt-0 mb-vsp-md`).
|
|
@@ -52,14 +52,14 @@ interface DocTagsProps {
|
|
|
52
52
|
declare const DEFAULT_TAGS_LABEL = "Tags";
|
|
53
53
|
declare const DEFAULT_TAGGED_WITH_LABEL = "Tagged with";
|
|
54
54
|
/**
|
|
55
|
-
* Page-level tag chips — JSX port of `src/components/doc-tags
|
|
56
|
-
* (page-variant rendering from `src/components/tag-nav
|
|
55
|
+
* Page-level tag chips — JSX port of `src/components/doc-tags`
|
|
56
|
+
* (page-variant rendering from `src/components/tag-nav`).
|
|
57
57
|
*
|
|
58
58
|
* Returns `null` when the `tags` array is empty, matching the original
|
|
59
59
|
* `resolvedTags.length > 0` guard.
|
|
60
60
|
*
|
|
61
61
|
* The pointed-chip shape is reproduced verbatim from the page-variant
|
|
62
|
-
* branch of `tag-nav
|
|
62
|
+
* branch of `tag-nav` using the same `clip-path` values.
|
|
63
63
|
*/
|
|
64
64
|
declare function DocTags(props: DocTagsProps): VNode | null;
|
|
65
65
|
|
|
@@ -81,7 +81,7 @@ declare const DEFAULT_KEY_COL_LABEL = "Key";
|
|
|
81
81
|
declare const DEFAULT_VALUE_COL_LABEL = "Value";
|
|
82
82
|
/**
|
|
83
83
|
* Frontmatter data table — JSX port of
|
|
84
|
-
* `src/components/frontmatter-preview
|
|
84
|
+
* `src/components/frontmatter-preview`.
|
|
85
85
|
*
|
|
86
86
|
* Returns `null` when `entries` is empty, mirroring the original
|
|
87
87
|
* `entries.length > 0` guard.
|
|
@@ -15,7 +15,7 @@ interface CategoryNavProps {
|
|
|
15
15
|
class?: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* CategoryNav — JSX port of `src/components/category-nav
|
|
18
|
+
* CategoryNav — JSX port of `src/components/category-nav`.
|
|
19
19
|
*
|
|
20
20
|
* Renders direct children of a category as a two-column grid of card links.
|
|
21
21
|
* Each card shows the node's label (with an arrow icon) and an optional
|
|
@@ -14,7 +14,7 @@ interface CategoryTreeNavProps {
|
|
|
14
14
|
maxDepth?: number;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* CategoryTreeNav — JSX port of `src/components/category-tree-nav
|
|
17
|
+
* CategoryTreeNav — JSX port of `src/components/category-tree-nav`.
|
|
18
18
|
*
|
|
19
19
|
* Renders the children of a category as a recursive disc-bulleted list. Links
|
|
20
20
|
* are rendered for nodes that have a page; plain text for structural nodes.
|
|
@@ -21,7 +21,7 @@ interface DocCardGridProps {
|
|
|
21
21
|
class?: string;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* DocCardGrid — JSX port of `src/components/doc-card-grid
|
|
24
|
+
* DocCardGrid — JSX port of `src/components/doc-card-grid`.
|
|
25
25
|
*
|
|
26
26
|
* Renders a flat list of `{ href, title, description? }` items as a two-column
|
|
27
27
|
* card grid. Each card shows an arrow icon, the doc title, and an optional
|
|
@@ -12,7 +12,7 @@ interface DocsSitemapProps {
|
|
|
12
12
|
tree: NavNode[];
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* DocsSitemap — JSX port of `src/components/docs-sitemap
|
|
15
|
+
* DocsSitemap — JSX port of `src/components/docs-sitemap`.
|
|
16
16
|
*
|
|
17
17
|
* Renders the full documentation tree as a series of collapsible
|
|
18
18
|
* `<details>` sections. Each top-level node becomes one section; its
|
|
@@ -15,7 +15,7 @@ interface NavCardGridProps {
|
|
|
15
15
|
class?: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* NavCardGrid — JSX port of `src/components/nav-card-grid
|
|
18
|
+
* NavCardGrid — JSX port of `src/components/nav-card-grid`.
|
|
19
19
|
*
|
|
20
20
|
* Renders direct children of a category as a two-column grid of card links.
|
|
21
21
|
* Unlike `CategoryNav`, the arrow icon uses `text-accent` and sits inline with
|
|
@@ -23,7 +23,7 @@ interface SiteTreeNavDemoProps {
|
|
|
23
23
|
ariaLabel?: string;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* SiteTreeNavDemo — JSX port of `src/components/site-tree-nav-demo
|
|
26
|
+
* SiteTreeNavDemo — JSX port of `src/components/site-tree-nav-demo`.
|
|
27
27
|
*
|
|
28
28
|
* Renders the full site tree as a static collapsible section-by-section view.
|
|
29
29
|
* Each top-level category becomes a `<details>` block; leaves within each
|
|
@@ -13,7 +13,7 @@ interface VersionsPageContentProps {
|
|
|
13
13
|
labels: VersionsPageLabels;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* VersionsPageContent — JSX port of `src/components/versions-page-content
|
|
16
|
+
* VersionsPageContent — JSX port of `src/components/versions-page-content`.
|
|
17
17
|
*
|
|
18
18
|
* Renders the full documentation versions page:
|
|
19
19
|
* - An `<h1>` heading (from `labels.pageTitle`).
|
|
@@ -15,7 +15,7 @@ interface SidebarProps extends SidebarTreeIslandProps {
|
|
|
15
15
|
/**
|
|
16
16
|
* Pre-rendered tree content — falls back to this when
|
|
17
17
|
* `treeComponent` is omitted. Useful for tests and for layouts that
|
|
18
|
-
* compose the tree separately (e.g. inside
|
|
18
|
+
* compose the tree separately (e.g. inside a host wrapper
|
|
19
19
|
* that needs `client:load` on the actual island element).
|
|
20
20
|
*/
|
|
21
21
|
children?: ComponentChildren;
|
package/dist/sidebar/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public types for the framework-agnostic sidebar shell.
|
|
3
3
|
*
|
|
4
|
-
* The original
|
|
4
|
+
* The original `sidebar` mixed three concerns:
|
|
5
5
|
* 1. Building `rootMenuItems` from `settings.headerNav` (with i18n
|
|
6
6
|
* label resolution and version-aware hrefs).
|
|
7
7
|
* 2. Building the doc tree via `loadLocaleDocs` +
|
|
@@ -12,6 +12,7 @@ function initSidebarResizer() {
|
|
|
12
12
|
if (typeof document === "undefined") return;
|
|
13
13
|
const sidebar = document.getElementById(SIDEBAR_ID);
|
|
14
14
|
if (!sidebar || sidebar.querySelector(`[${HANDLE_MARKER}]`)) return;
|
|
15
|
+
if (getComputedStyle(sidebar).position !== "fixed") return;
|
|
15
16
|
function readCurrentWidth() {
|
|
16
17
|
const raw = getComputedStyle(document.documentElement).getPropertyValue(
|
|
17
18
|
CSS_PROP
|
|
@@ -29,11 +30,11 @@ function initSidebarResizer() {
|
|
|
29
30
|
handle.setAttribute("aria-valuemax", String(MAX_W));
|
|
30
31
|
handle.setAttribute("aria-valuenow", String(Math.round(cachedWidth)));
|
|
31
32
|
Object.assign(handle.style, {
|
|
32
|
-
position: "
|
|
33
|
-
top: "
|
|
34
|
-
|
|
33
|
+
position: "fixed",
|
|
34
|
+
top: "3.5rem",
|
|
35
|
+
bottom: "0",
|
|
36
|
+
left: "calc(var(--zd-sidebar-w) - 20px)",
|
|
35
37
|
width: "20px",
|
|
36
|
-
height: "100%",
|
|
37
38
|
cursor: "col-resize",
|
|
38
39
|
zIndex: "10",
|
|
39
40
|
transition: "background 0.15s"
|
|
@@ -157,9 +158,16 @@ function initSidebarResizer() {
|
|
|
157
158
|
});
|
|
158
159
|
sidebar.appendChild(handle);
|
|
159
160
|
}
|
|
160
|
-
import {
|
|
161
|
+
import {
|
|
162
|
+
SidebarResizerInit,
|
|
163
|
+
SIDEBAR_RESIZER_INIT_SCRIPT,
|
|
164
|
+
SidebarResizerRestore,
|
|
165
|
+
SIDEBAR_RESIZER_RESTORE_SCRIPT
|
|
166
|
+
} from "./sidebar-resizer-init.js";
|
|
161
167
|
export {
|
|
162
168
|
SIDEBAR_RESIZER_INIT_SCRIPT,
|
|
169
|
+
SIDEBAR_RESIZER_RESTORE_SCRIPT,
|
|
163
170
|
SidebarResizerInit,
|
|
171
|
+
SidebarResizerRestore,
|
|
164
172
|
initSidebarResizer
|
|
165
173
|
};
|
|
@@ -17,4 +17,24 @@ declare const SIDEBAR_RESIZER_INIT_SCRIPT: string;
|
|
|
17
17
|
*/
|
|
18
18
|
declare function SidebarResizerInit(): JSX.Element;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
declare const SIDEBAR_RESIZER_RESTORE_SCRIPT = "(function(){try{var w=localStorage.getItem(\"zudo-doc-sidebar-width\");if(!w)return;var n=parseFloat(w);if(!isFinite(n))return;if(n<192)n=192;else if(n>448)n=448;document.documentElement.style.setProperty(\"--zd-sidebar-w\",n+\"px\");}catch(e){}})();";
|
|
21
|
+
/**
|
|
22
|
+
* Drop-in JSX `<head>` script that restores the persisted sidebar width
|
|
23
|
+
* before first paint.
|
|
24
|
+
*
|
|
25
|
+
* Include once in the page `<head>` (gated on `settings.sidebarResizer`)
|
|
26
|
+
* — placement in `<head>` is what makes this run before the body is
|
|
27
|
+
* parsed, eliminating the resize-flash on reload. Body-end placement is
|
|
28
|
+
* too late: the browser will have already painted at the CSS default.
|
|
29
|
+
*
|
|
30
|
+
* The script is a tiny synchronous IIFE that:
|
|
31
|
+
* - reads `localStorage["zudo-doc-sidebar-width"]`,
|
|
32
|
+
* - validates it as a finite number clamped to [MIN_W, MAX_W],
|
|
33
|
+
* - sets `--zd-sidebar-w` on `document.documentElement.style`.
|
|
34
|
+
*
|
|
35
|
+
* It silently no-ops in privacy / disabled-storage modes (try/catch),
|
|
36
|
+
* matches the resilience of the runtime `applyWidth` writer.
|
|
37
|
+
*/
|
|
38
|
+
declare function SidebarResizerRestore(): JSX.Element;
|
|
39
|
+
|
|
40
|
+
export { SIDEBAR_RESIZER_INIT_SCRIPT, SIDEBAR_RESIZER_RESTORE_SCRIPT, SidebarResizerInit, SidebarResizerRestore, SidebarResizerInit as default };
|
|
@@ -14,6 +14,11 @@ const SIDEBAR_RESIZER_INIT_SCRIPT = `(function(){
|
|
|
14
14
|
if(typeof document==="undefined")return;
|
|
15
15
|
var sidebar=document.getElementById(SIDEBAR_ID);
|
|
16
16
|
if(!sidebar||sidebar.querySelector("["+HANDLE_MARKER+"]"))return;
|
|
17
|
+
// Only attach to the real fixed desktop panel. On hide_sidebar pages the
|
|
18
|
+
// aside renders sr-only (position:absolute) purely for the ARIA landmark; a
|
|
19
|
+
// position:fixed handle would escape sr-only's clip and show a stray strip
|
|
20
|
+
// (below lg the panel is display:none but still fixed \u2014 handle appended, not rendered). zudolab/zudo-doc#1821
|
|
21
|
+
if(getComputedStyle(sidebar).position!=="fixed")return;
|
|
17
22
|
|
|
18
23
|
function readCurrentWidth(){
|
|
19
24
|
var raw=getComputedStyle(document.documentElement).getPropertyValue(CSS_PROP);
|
|
@@ -30,9 +35,15 @@ const SIDEBAR_RESIZER_INIT_SCRIPT = `(function(){
|
|
|
30
35
|
handle.setAttribute("aria-valuemin",String(MIN_W));
|
|
31
36
|
handle.setAttribute("aria-valuemax",String(MAX_W));
|
|
32
37
|
handle.setAttribute("aria-valuenow",String(Math.round(cachedWidth)));
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
|
|
38
|
+
// position:fixed (not absolute) pins the handle to the viewport so it spans
|
|
39
|
+
// the sidebar's full height even while #desktop-sidebar scrolls. As an
|
|
40
|
+
// absolute child of the overflow-y:auto sidebar it scrolled away with the
|
|
41
|
+
// content and height:100% only covered the visible padding box. zudolab/zudo-doc#1821
|
|
42
|
+
// top:3.5rem + left:calc mirror the layout's #desktop-sidebar geometry
|
|
43
|
+
// (top-[3.5rem], left:0, width:var(--zd-sidebar-w)). 20px hit area > native
|
|
44
|
+
// y-scrollbar (~12-17px) keeps a draggable strip left of the scrollbar when
|
|
45
|
+
// the sidebar overflows. zudolab/zudo-doc#1660
|
|
46
|
+
Object.assign(handle.style,{position:"fixed",top:"3.5rem",bottom:"0",left:"calc(var(--zd-sidebar-w) - 20px)",width:"20px",cursor:"col-resize",zIndex:"10",transition:"background 0.15s"});
|
|
36
47
|
|
|
37
48
|
var dragging=false,focused=false;
|
|
38
49
|
|
|
@@ -112,8 +123,19 @@ function SidebarResizerInit() {
|
|
|
112
123
|
return /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: SIDEBAR_RESIZER_INIT_SCRIPT } });
|
|
113
124
|
}
|
|
114
125
|
var sidebar_resizer_init_default = SidebarResizerInit;
|
|
126
|
+
const SIDEBAR_RESIZER_RESTORE_SCRIPT = `(function(){try{var w=localStorage.getItem("zudo-doc-sidebar-width");if(!w)return;var n=parseFloat(w);if(!isFinite(n))return;if(n<192)n=192;else if(n>448)n=448;document.documentElement.style.setProperty("--zd-sidebar-w",n+"px");}catch(e){}})();`;
|
|
127
|
+
function SidebarResizerRestore() {
|
|
128
|
+
return /* @__PURE__ */ jsx(
|
|
129
|
+
"script",
|
|
130
|
+
{
|
|
131
|
+
dangerouslySetInnerHTML: { __html: SIDEBAR_RESIZER_RESTORE_SCRIPT }
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
115
135
|
export {
|
|
116
136
|
SIDEBAR_RESIZER_INIT_SCRIPT,
|
|
137
|
+
SIDEBAR_RESIZER_RESTORE_SCRIPT,
|
|
117
138
|
SidebarResizerInit,
|
|
139
|
+
SidebarResizerRestore,
|
|
118
140
|
sidebar_resizer_init_default as default
|
|
119
141
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takazudo/zudo-doc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-next.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "zudo-doc framework primitives layer that sits on top of zfb's engine — sidebar, theme, TOC, breadcrumb, layouts, head injection, View Transitions, SSR-skip wrappers (per ADR-003).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -154,9 +154,9 @@
|
|
|
154
154
|
],
|
|
155
155
|
"peerDependencies": {
|
|
156
156
|
"preact": "^10.29.1",
|
|
157
|
-
"@takazudo/zfb": "^0.1.0-next.
|
|
158
|
-
"@takazudo/zfb-runtime": "^0.1.0-next.
|
|
159
|
-
"@takazudo/zudo-doc-history-server": "^0.
|
|
157
|
+
"@takazudo/zfb": "^0.1.0-next.25",
|
|
158
|
+
"@takazudo/zfb-runtime": "^0.1.0-next.25",
|
|
159
|
+
"@takazudo/zudo-doc-history-server": "^0.2.0-next.2"
|
|
160
160
|
},
|
|
161
161
|
"peerDependenciesMeta": {
|
|
162
162
|
"@takazudo/zudo-doc-history-server": {
|
|
@@ -174,8 +174,8 @@
|
|
|
174
174
|
"tsup": "^8.0.0",
|
|
175
175
|
"typescript": "^5.0.0",
|
|
176
176
|
"vitest": "^3.0.0",
|
|
177
|
-
"@takazudo/zfb": "0.1.0-next.
|
|
178
|
-
"@takazudo/zfb-runtime": "0.1.0-next.
|
|
177
|
+
"@takazudo/zfb": "0.1.0-next.25",
|
|
178
|
+
"@takazudo/zfb-runtime": "0.1.0-next.25"
|
|
179
179
|
},
|
|
180
180
|
"scripts": {
|
|
181
181
|
"build": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsup",
|