@takazudo/zudo-doc 12.0.0 → 13.0.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 +16 -0
- package/dist/category-list/index.d.ts +68 -0
- package/dist/category-list/index.js +130 -0
- package/dist/category-list/model.d.ts +142 -0
- package/dist/category-list/model.js +174 -0
- package/dist/category-list/view.d.ts +56 -0
- package/dist/category-list/view.js +192 -0
- package/dist/chrome/derive.d.ts +7 -0
- package/dist/chrome/derive.js +25 -0
- package/dist/compiled.css +202 -0
- package/dist/config-assertions/index.d.ts +2 -2
- package/dist/config-assertions/index.js +16 -7
- package/dist/features.css +213 -0
- package/dist/home-page/index.js +37 -3
- package/dist/i18n-defaults/index.js +6 -0
- package/dist/mdx-components/vocabulary.d.ts +1 -1
- package/dist/mdx-components/vocabulary.js +2 -1
- package/dist/plugins/internal/agent-export/components.js +47 -0
- package/dist/settings.d.ts +25 -3
- package/package.json +14 -10
package/dist/features.css
CHANGED
|
@@ -1661,3 +1661,216 @@ html:not([data-theme="dark"]) [data-zd-home-image="dark"] {
|
|
|
1661
1661
|
border-color: CanvasText;
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
|
+
|
|
1665
|
+
/* ======== Category list (cards / list, #4802) ======== */
|
|
1666
|
+
/* Accepted layouts B (cards) and C (two-column index). Columns follow the
|
|
1667
|
+
* component's own width (container queries), so a narrow placement collapses
|
|
1668
|
+
* inside a wide viewport. DOM, reading and tab order stay row-major. */
|
|
1669
|
+
|
|
1670
|
+
.zd-category-list {
|
|
1671
|
+
container: zd-category-list / inline-size;
|
|
1672
|
+
min-width: 0;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
.zd-category-list-items {
|
|
1676
|
+
display: grid;
|
|
1677
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1678
|
+
margin: 0;
|
|
1679
|
+
padding: 0;
|
|
1680
|
+
list-style: none;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
.zd-category-list-item {
|
|
1684
|
+
min-width: 0;
|
|
1685
|
+
margin: 0;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
.zd-category-list-link {
|
|
1689
|
+
display: grid;
|
|
1690
|
+
min-width: 0;
|
|
1691
|
+
height: 100%;
|
|
1692
|
+
text-decoration: none;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
.zd-category-list-body {
|
|
1696
|
+
display: flex;
|
|
1697
|
+
min-width: 0;
|
|
1698
|
+
flex-direction: column;
|
|
1699
|
+
gap: var(--spacing-vsp-3xs);
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
/* Titles, descriptions and metadata always wrap — Japanese and long unbroken
|
|
1703
|
+
* strings included — and are never clamped to a fixed height. */
|
|
1704
|
+
.zd-category-list-title,
|
|
1705
|
+
.zd-category-list-description,
|
|
1706
|
+
.zd-category-list-meta {
|
|
1707
|
+
min-width: 0;
|
|
1708
|
+
margin: 0;
|
|
1709
|
+
overflow-wrap: anywhere;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
.zd-category-list-title {
|
|
1713
|
+
font-size: var(--text-body);
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
.zd-category-list-link:is(:hover, :focus-visible) .zd-category-list-title {
|
|
1717
|
+
color: var(--color-accent);
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
.zd-category-list-meta {
|
|
1721
|
+
display: flex;
|
|
1722
|
+
flex-wrap: wrap;
|
|
1723
|
+
align-items: baseline;
|
|
1724
|
+
gap: var(--spacing-vsp-3xs) var(--spacing-hsp-md);
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
.zd-category-list-tags {
|
|
1728
|
+
display: inline-flex;
|
|
1729
|
+
flex-wrap: wrap;
|
|
1730
|
+
gap: var(--spacing-hsp-xs);
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
.zd-category-list-tag {
|
|
1734
|
+
font-size: var(--text-micro);
|
|
1735
|
+
line-height: var(--leading-normal);
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
.zd-category-list-rank {
|
|
1739
|
+
min-width: var(--zd-category-list-rank-width, 2ch);
|
|
1740
|
+
font-size: var(--text-title);
|
|
1741
|
+
line-height: var(--leading-tight);
|
|
1742
|
+
white-space: nowrap;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
/* Chevron centred on the first text line of its row. */
|
|
1746
|
+
.zd-category-list-chevron {
|
|
1747
|
+
font-size: var(--text-body);
|
|
1748
|
+
line-height: var(--leading-snug);
|
|
1749
|
+
align-self: start;
|
|
1750
|
+
margin-block-start: calc((1lh - var(--spacing-icon-sm)) / 2);
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
.zd-category-list-footer {
|
|
1754
|
+
display: flex;
|
|
1755
|
+
flex-wrap: wrap;
|
|
1756
|
+
align-items: center;
|
|
1757
|
+
justify-content: space-between;
|
|
1758
|
+
gap: var(--spacing-vsp-2xs) var(--spacing-hsp-lg);
|
|
1759
|
+
margin-top: var(--spacing-vsp-sm);
|
|
1760
|
+
padding-top: var(--spacing-vsp-xs);
|
|
1761
|
+
border-top: 1px solid var(--color-muted);
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
.zd-category-list-count {
|
|
1765
|
+
margin: 0;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
.zd-category-list-archive {
|
|
1769
|
+
margin-inline-start: auto;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
/* ── B: cards — equal bordered surfaces, at most three columns ── */
|
|
1773
|
+
|
|
1774
|
+
.zd-category-list[data-layout="cards"] .zd-category-list-items {
|
|
1775
|
+
gap: var(--spacing-vsp-sm) var(--spacing-hsp-lg);
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
.zd-category-list[data-layout="cards"] .zd-category-list-link {
|
|
1779
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
1780
|
+
grid-template-areas:
|
|
1781
|
+
"body chevron"
|
|
1782
|
+
"meta meta";
|
|
1783
|
+
grid-template-rows: auto 1fr;
|
|
1784
|
+
column-gap: var(--spacing-hsp-md);
|
|
1785
|
+
row-gap: var(--spacing-vsp-xs);
|
|
1786
|
+
padding: var(--spacing-vsp-sm) var(--spacing-hsp-xl);
|
|
1787
|
+
border: 1px solid var(--color-muted);
|
|
1788
|
+
border-radius: var(--radius-DEFAULT);
|
|
1789
|
+
background: var(--color-surface);
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
.zd-category-list[data-layout="cards"]:not([data-lead="none"]) .zd-category-list-link {
|
|
1793
|
+
grid-template-areas:
|
|
1794
|
+
"lead chevron"
|
|
1795
|
+
"body body"
|
|
1796
|
+
"meta meta";
|
|
1797
|
+
grid-template-rows: auto auto 1fr;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
.zd-category-list[data-layout="cards"] .zd-category-list-lead { grid-area: lead; }
|
|
1801
|
+
.zd-category-list[data-layout="cards"] .zd-category-list-body { grid-area: body; }
|
|
1802
|
+
.zd-category-list[data-layout="cards"] .zd-category-list-chevron {
|
|
1803
|
+
grid-area: chevron;
|
|
1804
|
+
justify-self: end;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
.zd-category-list[data-layout="cards"]:not([data-lead="none"]) .zd-category-list-chevron {
|
|
1808
|
+
align-self: center;
|
|
1809
|
+
margin-block-start: 0;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
|
|
1813
|
+
.zd-category-list[data-layout="cards"] .zd-category-list-meta {
|
|
1814
|
+
grid-area: meta;
|
|
1815
|
+
align-self: end;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
.zd-category-list[data-layout="cards"] .zd-category-list-link:is(:hover, :focus-visible) {
|
|
1819
|
+
border-color: var(--color-accent);
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
@container zd-category-list (min-width: 36rem) {
|
|
1823
|
+
.zd-category-list[data-layout="cards"] .zd-category-list-items {
|
|
1824
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
@container zd-category-list (min-width: 64rem) {
|
|
1829
|
+
.zd-category-list[data-layout="cards"] .zd-category-list-items {
|
|
1830
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
/* ── C: list — quiet rows with separators, at most two columns ── */
|
|
1835
|
+
|
|
1836
|
+
.zd-category-list[data-layout="list"] .zd-category-list-items {
|
|
1837
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1838
|
+
column-gap: var(--spacing-hsp-2xl);
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
.zd-category-list[data-layout="list"] .zd-category-list-item {
|
|
1842
|
+
border-bottom: 1px solid var(--color-muted);
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
.zd-category-list[data-layout="list"] .zd-category-list-link {
|
|
1846
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
1847
|
+
column-gap: var(--spacing-hsp-md);
|
|
1848
|
+
align-items: start;
|
|
1849
|
+
padding: var(--spacing-vsp-xs) var(--spacing-hsp-2xs);
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
.zd-category-list[data-layout="list"][data-lead="rank"] .zd-category-list-link {
|
|
1853
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
.zd-category-list[data-layout="list"][data-lead="date"] .zd-category-list-link {
|
|
1857
|
+
grid-template-columns: 4.5rem minmax(0, 1fr) auto;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
.zd-category-list[data-layout="list"] .zd-category-list-link:is(:hover, :focus-visible) {
|
|
1861
|
+
background: color-mix(in oklch, var(--color-surface) 70%, transparent);
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
.zd-category-list[data-layout="list"] .zd-category-list-meta {
|
|
1865
|
+
margin-top: var(--spacing-vsp-3xs);
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
.zd-category-list[data-layout="list"] .zd-category-list-footer {
|
|
1869
|
+
border-top: 0;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
@container zd-category-list (max-width: 520px) {
|
|
1873
|
+
.zd-category-list[data-layout="list"] .zd-category-list-items {
|
|
1874
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1875
|
+
}
|
|
1876
|
+
}
|
package/dist/home-page/index.js
CHANGED
|
@@ -16,7 +16,13 @@ import { resolveSiteTreeNavCountLabels } from "../site-tree-nav/index.js";
|
|
|
16
16
|
import { getNoteTrayItems } from "../note-tray-model/index.js";
|
|
17
17
|
import { createHeadWithDefaults } from "../head-with-defaults/index.js";
|
|
18
18
|
import { resolveThemePackSsrSlug } from "../theme/theme-pack-provider.js";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
deriveCategoryListDeps,
|
|
21
|
+
deriveComposeMetaTitle,
|
|
22
|
+
deriveBodyEndIslands,
|
|
23
|
+
deriveDateFormats
|
|
24
|
+
} from "../chrome/derive.js";
|
|
25
|
+
import { createCategoryListRenderer } from "../category-list/index.js";
|
|
20
26
|
import { derivePrimaryChromeSlots } from "../chrome/primary-slots.js";
|
|
21
27
|
import { assertChromeContext } from "../chrome/assert-chrome-context.js";
|
|
22
28
|
import { prepareHomeData } from "./prepare-home-data.js";
|
|
@@ -57,7 +63,9 @@ function selectSecondaryNodes(tree, secondary, categoryIgnore) {
|
|
|
57
63
|
return moved;
|
|
58
64
|
}
|
|
59
65
|
function sectionText(section, locale, field) {
|
|
60
|
-
|
|
66
|
+
const own = section[field];
|
|
67
|
+
const localized = section.locales?.[locale]?.[field];
|
|
68
|
+
for (const value of [localized, own]) {
|
|
61
69
|
if (value?.trim()) return value;
|
|
62
70
|
}
|
|
63
71
|
return void 0;
|
|
@@ -89,6 +97,7 @@ function createHomePageView(ctx) {
|
|
|
89
97
|
const HeadWithDefaults = createHeadWithDefaults(ctx);
|
|
90
98
|
const { Header: HeaderWithDefaults, Footer: FooterWithDefaults } = derivePrimaryChromeSlots(ctx);
|
|
91
99
|
const BodyEndIslands = deriveBodyEndIslands(ctx);
|
|
100
|
+
const categoryLists = createCategoryListRenderer(deriveCategoryListDeps(ctx));
|
|
92
101
|
const homeExtras = ctx.hostBindings.homeExtras;
|
|
93
102
|
const homeIntros = ctx.homeIntros;
|
|
94
103
|
const dataThemePack = resolveThemePackSsrSlug(
|
|
@@ -248,6 +257,31 @@ function createHomePageView(ctx) {
|
|
|
248
257
|
}
|
|
249
258
|
);
|
|
250
259
|
}
|
|
260
|
+
function renderCategoryListSection(section, index) {
|
|
261
|
+
const where = `home.sections[${index}]`;
|
|
262
|
+
const { type: _type, heading: _heading, description: _description, locales: _locales, ...options } = section;
|
|
263
|
+
const archiveLabel = sectionText(section, locale, "archiveLabel");
|
|
264
|
+
const listOptions = { ...options, ...archiveLabel !== void 0 ? { archiveLabel } : {} };
|
|
265
|
+
const context = { lang: locale, where };
|
|
266
|
+
const resolution = categoryLists.resolve(listOptions, context);
|
|
267
|
+
if (resolution.status !== "ok" || resolution.items.length === 0) return null;
|
|
268
|
+
const headingId = `zd-home-category-list-${index}-heading`;
|
|
269
|
+
const sectionDescription = sectionText(section, locale, "description");
|
|
270
|
+
return /* @__PURE__ */ jsxs(
|
|
271
|
+
"section",
|
|
272
|
+
{
|
|
273
|
+
"data-zd-home-section": "category-list",
|
|
274
|
+
"data-zd-home-category": resolution.category.slug,
|
|
275
|
+
"aria-labelledby": headingId,
|
|
276
|
+
class: "mx-auto flex w-full min-w-0 max-w-[80rem] flex-col gap-vsp-md",
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ jsx(WideSectionHeading, { id: headingId, children: sectionText(section, locale, "heading") ?? resolution.category.label }),
|
|
279
|
+
sectionDescription && /* @__PURE__ */ jsx("p", { class: "text-muted", children: sectionDescription }),
|
|
280
|
+
categoryLists.render(listOptions, context, resolution, 3)
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
}
|
|
251
285
|
return /* @__PURE__ */ jsxs(
|
|
252
286
|
DocLayoutWithDefaults,
|
|
253
287
|
{
|
|
@@ -308,7 +342,7 @@ function createHomePageView(ctx) {
|
|
|
308
342
|
)
|
|
309
343
|
] })
|
|
310
344
|
] }) : /* @__PURE__ */ jsx("div", { "data-zd-home-sections": true, class: "mt-vsp-2xl flex flex-col gap-vsp-2xl", children: homeSections.map(
|
|
311
|
-
(section) => section.type === "doc-cards" ? renderDocCardsSection(section) : renderSiteTreeSection(section)
|
|
345
|
+
(section, index) => section.type === "doc-cards" ? renderDocCardsSection(section) : section.type === "category-list" ? renderCategoryListSection(section, index) : renderSiteTreeSection(section)
|
|
312
346
|
) }),
|
|
313
347
|
settings.docTags && tagCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
314
348
|
/* @__PURE__ */ jsx("hr", { class: "zd-home-rule", "data-home-rule": "tags" }),
|
|
@@ -4,6 +4,9 @@ const defaultTranslations = {
|
|
|
4
4
|
"home.secondaryNav": "More categories",
|
|
5
5
|
"home.selectedDocsHeading": "Start here",
|
|
6
6
|
"home.selectedDocsNav": "Selected documents",
|
|
7
|
+
"categoryList.archive": "See all",
|
|
8
|
+
"categoryList.count": "Showing {shown} of {total}",
|
|
9
|
+
"categoryList.path": "In",
|
|
7
10
|
"siteTreeNav.documentCount.one": "{count} document",
|
|
8
11
|
"siteTreeNav.documentCount.other": "{count} documents",
|
|
9
12
|
"nav.gettingStarted": "Getting Started",
|
|
@@ -143,6 +146,9 @@ const defaultTranslations = {
|
|
|
143
146
|
"home.secondaryNav": "\u305D\u306E\u4ED6\u306E\u30AB\u30C6\u30B4\u30EA",
|
|
144
147
|
"home.selectedDocsHeading": "\u307E\u305A\u306F\u3053\u3053\u304B\u3089",
|
|
145
148
|
"home.selectedDocsNav": "\u9078\u3093\u3060\u6587\u66F8",
|
|
149
|
+
"categoryList.archive": "\u3059\u3079\u3066\u898B\u308B",
|
|
150
|
+
"categoryList.count": "{total} \u4EF6\u4E2D {shown} \u4EF6\u3092\u8868\u793A",
|
|
151
|
+
"categoryList.path": "\u5206\u985E",
|
|
146
152
|
"siteTreeNav.documentCount.one": "{count} \u4EF6\u306E\u6587\u66F8",
|
|
147
153
|
"siteTreeNav.documentCount.other": "{count} \u4EF6\u306E\u6587\u66F8",
|
|
148
154
|
"nav.gettingStarted": "\u306F\u3058\u3081\u306B",
|
|
@@ -15,5 +15,5 @@ export declare const TAB_GROUP_COMPONENTS: readonly ["Tabs", "CodeGroup"];
|
|
|
15
15
|
/** One labelled tab inside a tab container (`label` prop). */
|
|
16
16
|
export declare const TAB_ITEM_COMPONENT = "TabItem";
|
|
17
17
|
/** Navigation tags that list documents from the docs collection. */
|
|
18
|
-
export declare const NAV_COMPONENTS: readonly ["CategoryNav", "CategoryTreeNav", "SiteTreeNav", "SiteTreeNavDemo", "DocCardNav", "NoteTrayIndex"];
|
|
18
|
+
export declare const NAV_COMPONENTS: readonly ["CategoryNav", "CategoryTreeNav", "SiteTreeNav", "SiteTreeNavDemo", "DocCardNav", "NoteTrayIndex", "CategoryList"];
|
|
19
19
|
export type NavComponentName = (typeof NAV_COMPONENTS)[number];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isCanonicalDocSlug } from "../../../doc-card-nav/slug.js";
|
|
2
|
+
import { assertValidCategoryListOptions, resolveCategoryList, resolveCategoryListLead } from "../../../category-list/model.js";
|
|
2
3
|
import {
|
|
3
4
|
ADMONITION_COMPONENTS,
|
|
4
5
|
admonitionComponentName,
|
|
@@ -60,6 +61,23 @@ function createAgentComponentRenderer(source) {
|
|
|
60
61
|
};
|
|
61
62
|
const firstUrl = (node) => node.url ?? node.children.map(firstUrl).find((url) => url !== void 0);
|
|
62
63
|
const list = (lines) => lines.join("\n");
|
|
64
|
+
const toListNode = (node) => {
|
|
65
|
+
const page = source.published.get(node.id);
|
|
66
|
+
return {
|
|
67
|
+
slug: node.id,
|
|
68
|
+
label: node.label,
|
|
69
|
+
...node.description !== void 0 ? { description: node.description } : {},
|
|
70
|
+
...page ? { href: page.url } : {},
|
|
71
|
+
hasPage: page !== void 0 && !hidden.has(node.id),
|
|
72
|
+
...node.shape !== void 0 ? { shape: node.shape } : {},
|
|
73
|
+
...node.noteTrayDated !== void 0 ? { noteTrayDated: node.noteTrayDated } : {},
|
|
74
|
+
...node.date !== void 0 ? { date: node.date } : {},
|
|
75
|
+
...node.updated !== void 0 ? { updated: node.updated } : {},
|
|
76
|
+
...node.rank !== void 0 ? { rank: node.rank } : {},
|
|
77
|
+
children: node.children.map(toListNode)
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const listTree = tree.map(toListNode);
|
|
63
81
|
const nav = (name, props, currentSlug) => {
|
|
64
82
|
switch (name) {
|
|
65
83
|
case "CategoryNav": {
|
|
@@ -95,6 +113,35 @@ function createAgentComponentRenderer(source) {
|
|
|
95
113
|
if (!tray) return "";
|
|
96
114
|
return list(getNoteTrayItems(tray).filter((item) => item.url !== void 0).map((item) => line(item, 0, true, props.showDate === true && item.date ? ` (${item.date})` : "")));
|
|
97
115
|
}
|
|
116
|
+
case "CategoryList": {
|
|
117
|
+
try {
|
|
118
|
+
assertValidCategoryListOptions(props, "<CategoryList>", ["titleLevel"]);
|
|
119
|
+
} catch {
|
|
120
|
+
return void 0;
|
|
121
|
+
}
|
|
122
|
+
const indexIds = new Set(source.entries.filter(({ slug }) => slug === "index" || slug.endsWith("/index")).map(({ slug, data }) => data.slug ?? slug.replace(/\/?index$/, "")));
|
|
123
|
+
const resolution = resolveCategoryList(listTree, props.category, {
|
|
124
|
+
...typeof props.scope === "string" ? { scope: props.scope } : {},
|
|
125
|
+
limit: props.limit,
|
|
126
|
+
isCategoryIndex: (slug) => indexIds.has(slug) || !source.published.has(slug)
|
|
127
|
+
});
|
|
128
|
+
if (resolution.status !== "ok" || resolution.items.length === 0) return "";
|
|
129
|
+
const lead = resolveCategoryListLead(
|
|
130
|
+
typeof props.lead === "string" ? props.lead : "auto",
|
|
131
|
+
resolution.category
|
|
132
|
+
);
|
|
133
|
+
const withDescription = props.showDescription !== false;
|
|
134
|
+
const width = resolution.rankWidth ?? 2;
|
|
135
|
+
const lines = resolution.items.map((item) => {
|
|
136
|
+
const rank = lead === "rank" && item.rank !== void 0 ? `${String(item.rank).padStart(width, "0")}. ` : "";
|
|
137
|
+
const date = item.date && (lead === "date" || props.showDate === true) ? ` (${item.date})` : "";
|
|
138
|
+
return line({ label: `${rank}${item.title}`, url: item.href, ...item.description ? { description: item.description } : {} }, 0, withDescription, date);
|
|
139
|
+
});
|
|
140
|
+
if (props.showArchive !== false && resolution.category.href) {
|
|
141
|
+
lines.push(line({ label: asString(props.archiveLabel)?.trim() || resolution.category.label, url: resolution.category.href }, 0, false));
|
|
142
|
+
}
|
|
143
|
+
return list(lines);
|
|
144
|
+
}
|
|
98
145
|
case "DocCardNav": {
|
|
99
146
|
if (!Array.isArray(props.docs)) return void 0;
|
|
100
147
|
const seen = /* @__PURE__ */ new Set();
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DateFormatPattern } from "./format-date/index.js";
|
|
2
|
+
import type { CategoryListOptions } from "./category-list/model.js";
|
|
2
3
|
/**
|
|
3
4
|
* Tag governance enforcement level.
|
|
4
5
|
*
|
|
@@ -199,8 +200,9 @@ export interface HomeConfig {
|
|
|
199
200
|
imageLayout?: HomeImageLayout;
|
|
200
201
|
/**
|
|
201
202
|
* Optional navigation recipe that replaces the legacy sitemap block: exactly
|
|
202
|
-
* one `site-tree` section
|
|
203
|
-
* order. Omitted keeps the legacy home page
|
|
203
|
+
* one `site-tree` section, at most one `doc-cards` section and any number of
|
|
204
|
+
* `category-list` sections, in any order. Omitted keeps the legacy home page
|
|
205
|
+
* (sitemap heading + tree).
|
|
204
206
|
* See {@link HomeSection}.
|
|
205
207
|
* @default undefined
|
|
206
208
|
*/
|
|
@@ -241,7 +243,27 @@ export interface HomeSiteTreeSection {
|
|
|
241
243
|
/** Per-locale heading/description overrides keyed by locale code. */
|
|
242
244
|
locales?: Readonly<Record<string, HomeSectionLocaleText>>;
|
|
243
245
|
}
|
|
244
|
-
|
|
246
|
+
/** Per-locale overrides for a `category-list` home section. */
|
|
247
|
+
export interface HomeCategoryListLocaleText extends HomeSectionLocaleText {
|
|
248
|
+
archiveLabel?: string;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Documents from one category (a blog, a numbered note tray or an ordinary
|
|
252
|
+
* category) as cards or a two-column list, with a link to the full category.
|
|
253
|
+
* Repeatable. A category with no visible documents renders no section at all.
|
|
254
|
+
* See `CategoryListOptions` (`@takazudo/zudo-doc/category-list`) for every
|
|
255
|
+
* option and its default.
|
|
256
|
+
*/
|
|
257
|
+
export interface HomeCategoryListSection extends CategoryListOptions {
|
|
258
|
+
type: "category-list";
|
|
259
|
+
/** Section heading. Blank/omitted uses the category's own label. */
|
|
260
|
+
heading?: string;
|
|
261
|
+
/** Short plain-text line under the heading. */
|
|
262
|
+
description?: string;
|
|
263
|
+
/** Per-locale heading/description/archiveLabel overrides keyed by locale code. */
|
|
264
|
+
locales?: Readonly<Record<string, HomeCategoryListLocaleText>>;
|
|
265
|
+
}
|
|
266
|
+
export type HomeSection = HomeDocCardsSection | HomeSiteTreeSection | HomeCategoryListSection;
|
|
245
267
|
/**
|
|
246
268
|
* Full-colour home hero image (`home.image`). Rendered as a real `<img>` in
|
|
247
269
|
* the box the logo occupies (320px wide, 1200:630, fluid on narrow screens)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takazudo/zudo-doc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
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",
|
|
@@ -530,6 +530,10 @@
|
|
|
530
530
|
"types": "./dist/doc-card-nav/index.d.ts",
|
|
531
531
|
"default": "./dist/doc-card-nav/index.js"
|
|
532
532
|
},
|
|
533
|
+
"./category-list": {
|
|
534
|
+
"types": "./dist/category-list/index.d.ts",
|
|
535
|
+
"default": "./dist/category-list/index.js"
|
|
536
|
+
},
|
|
533
537
|
"./routes/design-token-panel-bootstrap": {
|
|
534
538
|
"types": "./dist/routes/_design-token-panel-bootstrap.d.ts",
|
|
535
539
|
"default": "./dist/routes/_design-token-panel-bootstrap.js"
|
|
@@ -765,10 +769,10 @@
|
|
|
765
769
|
"peerDependencies": {
|
|
766
770
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
767
771
|
"@takazudo/zdtp": "^0.5.2 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0",
|
|
768
|
-
"@takazudo/zfb": "^
|
|
769
|
-
"@takazudo/zfb-md-wasm": "^
|
|
770
|
-
"@takazudo/zfb-runtime": "^
|
|
771
|
-
"@takazudo/zudo-doc-history-server": "^
|
|
772
|
+
"@takazudo/zfb": "^7.0.0",
|
|
773
|
+
"@takazudo/zfb-md-wasm": "^7.0.0",
|
|
774
|
+
"@takazudo/zfb-runtime": "^7.0.0",
|
|
775
|
+
"@takazudo/zudo-doc-history-server": "^13.0.0",
|
|
772
776
|
"diff": "^8.0.0 || ^9.0.0",
|
|
773
777
|
"katex": "^0.18.2 || ^0.19.0",
|
|
774
778
|
"zod": "^4.3.6"
|
|
@@ -807,10 +811,10 @@
|
|
|
807
811
|
},
|
|
808
812
|
"devDependencies": {
|
|
809
813
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
810
|
-
"@takazudo/mdx-formatter": "1.3.
|
|
811
|
-
"@takazudo/zfb": "
|
|
812
|
-
"@takazudo/zfb-md-wasm": "
|
|
813
|
-
"@takazudo/zfb-runtime": "
|
|
814
|
+
"@takazudo/mdx-formatter": "1.3.1",
|
|
815
|
+
"@takazudo/zfb": "7.0.0",
|
|
816
|
+
"@takazudo/zfb-md-wasm": "7.0.0",
|
|
817
|
+
"@takazudo/zfb-runtime": "7.0.0",
|
|
814
818
|
"@types/fs-extra": "^11.0.4",
|
|
815
819
|
"@types/minimist": "^1.2.5",
|
|
816
820
|
"@types/node": "^26.6.6",
|
|
@@ -823,7 +827,7 @@
|
|
|
823
827
|
"typescript": "^7.0.2",
|
|
824
828
|
"vitest": "5.1.0",
|
|
825
829
|
"zod": "^4.6.7",
|
|
826
|
-
"@takazudo/zudo-doc-history-server": "
|
|
830
|
+
"@takazudo/zudo-doc-history-server": "13.0.0"
|
|
827
831
|
},
|
|
828
832
|
"scripts": {
|
|
829
833
|
"gen:search-widget-script": "node scripts/gen-search-widget-script.mjs",
|