@takazudo/zudo-doc 10.0.3 → 11.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 +28 -0
- package/dist/asset-index-page/index.js +1 -1
- package/dist/asset-page/index.js +1 -1
- package/dist/asset-path/index.d.ts +2 -0
- package/dist/asset-path/index.js +1 -0
- package/dist/catalog.js +1 -1
- package/dist/chrome/derive.js +14 -2
- package/dist/compiled.css +178 -30
- package/dist/config-assertions/index.d.ts +54 -0
- package/dist/config-assertions/index.js +205 -0
- package/dist/config.d.ts +12 -9
- package/dist/config.js +8 -0
- package/dist/content/index.d.ts +1 -0
- package/dist/content/index.js +2 -0
- package/dist/content/wide-section-heading.d.ts +12 -0
- package/dist/content/wide-section-heading.js +8 -0
- package/dist/doc-body-end-islands/index.d.ts +0 -7
- package/dist/doc-body-end-islands/index.js +0 -6
- package/dist/doc-card-nav/index.d.ts +78 -0
- package/dist/doc-card-nav/index.js +82 -0
- package/dist/doc-card-nav/slug.d.ts +6 -0
- package/dist/doc-card-nav/slug.js +6 -0
- package/dist/doc-page-renderer/index.d.ts +1 -0
- package/dist/doc-page-renderer/index.js +2 -0
- package/dist/doc-page-shell/index.d.ts +3 -0
- package/dist/doc-page-shell/index.js +4 -1
- package/dist/docs-schema/index.d.ts +2 -0
- package/dist/docs-schema/index.js +9 -0
- package/dist/features.css +201 -0
- package/dist/frontmatter-preview-defaults/index.js +3 -1
- package/dist/head-with-defaults/index.d.ts +11 -0
- package/dist/head-with-defaults/index.js +15 -3
- package/dist/home-hero/index.d.ts +36 -0
- package/dist/home-hero/index.js +128 -0
- package/dist/home-page/index.js +149 -58
- package/dist/i18n-defaults/index.js +8 -0
- package/dist/mcp/constants.d.ts +11 -0
- package/dist/mcp/constants.js +20 -0
- package/dist/mcp/discovery.d.ts +45 -0
- package/dist/mcp/discovery.js +138 -0
- package/dist/mcp/handler.js +4 -2
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.js +37 -1
- package/dist/nav-indexing/doc-card-grid.d.ts +6 -0
- package/dist/nav-indexing/doc-card-grid.js +26 -16
- package/dist/plugins/internal/llms-txt/dev-middleware.js +5 -1
- package/dist/plugins/internal/llms-txt/emit.js +5 -1
- package/dist/plugins/internal/llms-txt/generate.d.ts +2 -0
- package/dist/plugins/internal/llms-txt/generate.js +3 -0
- package/dist/plugins/routes.js +6 -1
- package/dist/preset.d.ts +4 -1
- package/dist/preset.js +8 -0
- package/dist/robots.d.ts +14 -0
- package/dist/robots.js +22 -4
- package/dist/routes/404.js +1 -1
- package/dist/routes/ai-catalog.d.ts +5 -0
- package/dist/routes/ai-catalog.js +28 -0
- package/dist/routes/mcp-server-card.d.ts +5 -0
- package/dist/routes/mcp-server-card.js +24 -0
- package/dist/settings-defaults.js +1 -1
- package/dist/settings.d.ts +102 -6
- package/dist/sidebar/client-data.d.ts +1 -1
- package/dist/sidebar/client-data.js +2 -0
- package/dist/sidebar/types.d.ts +4 -0
- package/dist/sidebar-tree/build-tree.js +1 -0
- package/dist/sidebar-tree/types.d.ts +4 -0
- package/dist/site-schema/nav-tree.js +2 -0
- package/dist/site-schema/types.d.ts +3 -0
- package/dist/site-tree-nav/index.d.ts +18 -0
- package/dist/site-tree-nav/index.js +18 -3
- package/dist/site-tree-nav/normalize-island-props.d.ts +6 -0
- package/dist/site-tree-nav/normalize-island-props.js +15 -0
- package/dist/site-tree-nav-island/count.d.ts +3 -0
- package/dist/site-tree-nav-island/count.js +11 -0
- package/dist/site-tree-nav-island/index.d.ts +22 -2
- package/dist/site-tree-nav-island/index.js +272 -221
- package/dist/tag-pages/index.d.ts +1 -0
- package/dist/tag-pages/index.js +2 -2
- package/dist/theme-packs/bauhaus/meta.json +1 -1
- package/dist/theme-packs/bauhaus/pack.css +2 -2
- package/dist/theme-packs/beacon/meta.json +1 -1
- package/dist/theme-packs/beacon/pack.css +0 -15
- package/dist/theme-packs/eink/meta.json +1 -1
- package/dist/theme-packs/eink/pack.css +1 -14
- package/dist/theme.css +0 -16
- package/dist/versions-page/index.d.ts +1 -0
- package/dist/versions-page/index.js +1 -1
- package/dist/wind.json +4 -6
- package/eject/sidebar/client-data.ts +3 -1
- package/eject/sidebar/types.ts +4 -0
- package/eject/site-tree-nav-island/count.ts +11 -0
- package/eject/site-tree-nav-island/index.tsx +359 -256
- package/package.json +19 -7
- package/routes-src/404.tsx +1 -1
- package/routes-src/ai-catalog.tsx +26 -0
- package/routes-src/mcp-server-card.tsx +21 -0
- package/dist/find-in-page/find-bar.d.ts +0 -11
- package/dist/find-in-page/find-bar.js +0 -103
- package/dist/find-in-page/find-in-page.d.ts +0 -17
- package/dist/find-in-page/find-in-page.js +0 -131
- package/dist/find-in-page/index.d.ts +0 -5
- package/dist/find-in-page/index.js +0 -52
|
@@ -61,6 +61,7 @@ function createDocPageShell(ctx) {
|
|
|
61
61
|
title,
|
|
62
62
|
description,
|
|
63
63
|
canonical,
|
|
64
|
+
ogImage,
|
|
64
65
|
alternateLinks,
|
|
65
66
|
breadcrumbs,
|
|
66
67
|
prev,
|
|
@@ -133,7 +134,9 @@ function createDocPageShell(ctx) {
|
|
|
133
134
|
title,
|
|
134
135
|
description,
|
|
135
136
|
canonical,
|
|
136
|
-
alternateLinks
|
|
137
|
+
alternateLinks,
|
|
138
|
+
locale,
|
|
139
|
+
ogImage
|
|
137
140
|
}
|
|
138
141
|
),
|
|
139
142
|
/* @__PURE__ */ jsx(SidebarVisibilityPrepaint, { hideSidebar }),
|
|
@@ -57,6 +57,8 @@ export declare function buildDocsSchema(opts?: BuildDocsSchemaOptions): z.ZodObj
|
|
|
57
57
|
standalone: z.ZodOptional<z.ZodBoolean>;
|
|
58
58
|
slug: z.ZodOptional<z.ZodString>;
|
|
59
59
|
generated: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
cover: z.ZodOptional<z.ZodString>;
|
|
61
|
+
og_image: z.ZodOptional<z.ZodString>;
|
|
60
62
|
category_no_page: z.ZodOptional<z.ZodBoolean>;
|
|
61
63
|
category_sort_order: z.ZodOptional<z.ZodEnum<{
|
|
62
64
|
asc: "asc";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { isRootAbsoluteSitePath } from "../config-assertions/index.js";
|
|
2
3
|
function buildTagsSchema(opts) {
|
|
3
4
|
const vocabulary = opts?.tagVocabulary ?? [];
|
|
4
5
|
const vocabularyActive = vocabulary.length > 0 && opts?.tagGovernance === "strict";
|
|
@@ -30,6 +31,14 @@ function buildDocsSchema(opts) {
|
|
|
30
31
|
standalone: z.boolean().optional(),
|
|
31
32
|
slug: z.string().optional(),
|
|
32
33
|
generated: z.boolean().optional(),
|
|
34
|
+
// Home-grid card picture for a top-level category's index page, a root-absolute site path.
|
|
35
|
+
cover: z.string().refine(isRootAbsoluteSitePath, {
|
|
36
|
+
message: 'cover must be a root-absolute site path such as "/img/guides.png"'
|
|
37
|
+
}).optional(),
|
|
38
|
+
// Page link-preview image (og:image / twitter:image), a root-absolute site path.
|
|
39
|
+
og_image: z.string().refine(isRootAbsoluteSitePath, {
|
|
40
|
+
message: 'og_image must be a root-absolute site path such as "/img/page.png"'
|
|
41
|
+
}).optional(),
|
|
33
42
|
// Category metadata expressed as a directory index.mdx's frontmatter — the
|
|
34
43
|
// frontmatter form of `_category_.json`. `category_no_page` makes the index
|
|
35
44
|
// a non-linked sidebar header excluded from routes/sitemap/search;
|
package/dist/features.css
CHANGED
|
@@ -1460,3 +1460,204 @@ site-search [data-search-results] > :is([data-search-placeholder], p) {
|
|
|
1460
1460
|
border: 1px solid CanvasText;
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
|
+
|
|
1464
|
+
/* ======== Home hero image (home.image) ======== */
|
|
1465
|
+
/* With `darkSrc`, the hero emits a light and a dark picture; show the one that
|
|
1466
|
+
* matches the colour mode. `data-theme` is set on <html> by the colour-mode
|
|
1467
|
+
* bootstrap before first paint, so no script runs for this choice. Without a
|
|
1468
|
+
* `data-theme` (colorMode: false, or scripting off) the light picture shows. */
|
|
1469
|
+
html[data-theme="dark"] [data-zd-home-image="light"],
|
|
1470
|
+
html:not([data-theme="dark"]) [data-zd-home-image="dark"] {
|
|
1471
|
+
display: none;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
/* home.imageLayout: "backdrop" — the picture fills the hero behind a readable
|
|
1475
|
+
* copy panel. aspect-ratio grows with the panel when the copy is taller than
|
|
1476
|
+
* 1200:630 (narrow screens), so text is never clipped; no overflow clipping is
|
|
1477
|
+
* set because that would disable the aspect-ratio growth. */
|
|
1478
|
+
.zd-home-backdrop {
|
|
1479
|
+
position: relative;
|
|
1480
|
+
display: grid;
|
|
1481
|
+
place-items: center;
|
|
1482
|
+
aspect-ratio: 1200 / 630;
|
|
1483
|
+
padding: var(--spacing-vsp-md) var(--spacing-hsp-lg);
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
.zd-home-backdrop-image {
|
|
1487
|
+
position: absolute;
|
|
1488
|
+
inset: 0;
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
.zd-home-backdrop-panel {
|
|
1492
|
+
position: relative;
|
|
1493
|
+
max-width: 40rem;
|
|
1494
|
+
padding: var(--spacing-vsp-sm) var(--spacing-hsp-xl);
|
|
1495
|
+
background: color-mix(in oklch, var(--zd-bg) 92%, transparent);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
/* ======== SiteTreeNav tree geometry ======== */
|
|
1499
|
+
/* One set of shared lengths drives every connector of `SiteTreeNav`
|
|
1500
|
+
* (site-tree-nav-island). The disclosure box and the category-marker slot are
|
|
1501
|
+
* the same `--zd-stn-slot` square, and every rail sits on that slot's centre
|
|
1502
|
+
* (`--zd-stn-rail-x`), so:
|
|
1503
|
+
* - a category's double-chevron (centred in its slot) shares the x axis of
|
|
1504
|
+
* the dashed rail of the tree directly below it;
|
|
1505
|
+
* - a nested rail starts at the bottom centre of its parent's boxed toggle;
|
|
1506
|
+
* - each branch sits on the first text line (`--zd-stn-mid`), never on the
|
|
1507
|
+
* middle of a multi-line row; the last rail stops at its branch.
|
|
1508
|
+
* Stacked categories keep a short lead-in above the first branch (the root
|
|
1509
|
+
* rail starts at the first row's top). A lone described category whose own
|
|
1510
|
+
* tree box (the `<nav>`, which it fills alone) is at least 48.75rem wide splits into summary + tree columns; the SAME
|
|
1511
|
+
* container condition sets `--zd-stn-split: 1`, which crops the root rail so
|
|
1512
|
+
* it begins at the first branch (no vertical segment for an only child).
|
|
1513
|
+
* Container queries are authored here because Wind has no container-query
|
|
1514
|
+
* variant. Sidebar connectors (tree-nav-shared) are unaffected. */
|
|
1515
|
+
.zd-site-tree {
|
|
1516
|
+
--zd-stn-slot: 1.75rem;
|
|
1517
|
+
--zd-stn-rail-x: calc(var(--zd-stn-slot) / 2);
|
|
1518
|
+
--zd-stn-indent: calc(var(--zd-stn-slot) + var(--spacing-hsp-sm));
|
|
1519
|
+
--zd-stn-row-pad: var(--spacing-vsp-2xs);
|
|
1520
|
+
container: zd-site-tree / inline-size;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
.zd-site-tree-card {
|
|
1524
|
+
--zd-stn-card-pad: var(--spacing-hsp-sm);
|
|
1525
|
+
padding: var(--zd-stn-card-pad);
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
.zd-site-tree-card[data-described] {
|
|
1529
|
+
--zd-stn-card-pad: var(--spacing-hsp-xl);
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
@container zd-site-tree (max-width: 38.75rem) {
|
|
1533
|
+
.zd-site-tree-card[data-described] {
|
|
1534
|
+
--zd-stn-card-pad: var(--spacing-hsp-lg);
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
/* Category card cover (`cover` frontmatter on a top-level category index).
|
|
1539
|
+
* Bleeds over the card padding so it sits flush with the border; the 1200:630
|
|
1540
|
+
* box is reserved before the picture loads. */
|
|
1541
|
+
.zd-site-nav-cover {
|
|
1542
|
+
display: block;
|
|
1543
|
+
width: calc(100% + 2 * var(--zd-stn-card-pad));
|
|
1544
|
+
max-width: none;
|
|
1545
|
+
height: auto;
|
|
1546
|
+
aspect-ratio: 1200 / 630;
|
|
1547
|
+
object-fit: cover;
|
|
1548
|
+
margin: calc(-1 * var(--zd-stn-card-pad)) calc(-1 * var(--zd-stn-card-pad)) var(--zd-stn-card-pad);
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
.zd-site-tree-body {
|
|
1552
|
+
display: flex;
|
|
1553
|
+
flex-direction: column;
|
|
1554
|
+
gap: var(--spacing-vsp-2xs);
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
.zd-site-tree-card[data-described] .zd-site-tree-body {
|
|
1558
|
+
gap: var(--spacing-vsp-sm);
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
@container zd-site-tree (min-width: 48.75rem) {
|
|
1562
|
+
.zd-site-tree-body[data-split="true"] {
|
|
1563
|
+
display: grid;
|
|
1564
|
+
grid-template-columns: minmax(12rem, 20rem) minmax(0, 1fr);
|
|
1565
|
+
column-gap: var(--spacing-hsp-2xl);
|
|
1566
|
+
align-items: start;
|
|
1567
|
+
--zd-stn-split: 1;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
.zd-site-tree-head,
|
|
1572
|
+
.zd-site-tree-row {
|
|
1573
|
+
font-size: var(--text-small);
|
|
1574
|
+
line-height: var(--leading-relaxed);
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/* First text line centred on the slot; `max()` keeps tall line-heights intact. */
|
|
1578
|
+
.zd-site-tree-label {
|
|
1579
|
+
padding-block-start: calc((max(var(--zd-stn-slot), 1lh) - 1lh) / 2);
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
.zd-site-tree-marker {
|
|
1583
|
+
inline-size: var(--zd-stn-slot);
|
|
1584
|
+
block-size: 1lh;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
.zd-site-tree-toggle {
|
|
1588
|
+
inline-size: var(--zd-stn-slot);
|
|
1589
|
+
block-size: var(--zd-stn-slot);
|
|
1590
|
+
padding: 0;
|
|
1591
|
+
background: transparent;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
.zd-site-tree-list {
|
|
1595
|
+
list-style: none;
|
|
1596
|
+
margin: 0;
|
|
1597
|
+
padding: 0;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
.zd-site-tree-row {
|
|
1601
|
+
--zd-stn-mid: calc(var(--zd-stn-row-pad) + max(var(--zd-stn-slot), 1lh) / 2);
|
|
1602
|
+
position: relative;
|
|
1603
|
+
min-inline-size: 0;
|
|
1604
|
+
margin: 0;
|
|
1605
|
+
padding-inline-start: var(--zd-stn-indent);
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
.zd-site-tree-line {
|
|
1609
|
+
padding-block: var(--zd-stn-row-pad);
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
.zd-site-tree-rail,
|
|
1613
|
+
.zd-site-tree-branch,
|
|
1614
|
+
.zd-site-tree-stem {
|
|
1615
|
+
position: absolute;
|
|
1616
|
+
inline-size: 0;
|
|
1617
|
+
border: 0 dashed var(--color-muted);
|
|
1618
|
+
pointer-events: none;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
.zd-site-tree-rail {
|
|
1622
|
+
inset-inline-start: var(--zd-stn-rail-x);
|
|
1623
|
+
inset-block: 0;
|
|
1624
|
+
border-inline-start-width: 1px;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
.zd-site-tree-rail[data-last="true"] {
|
|
1628
|
+
inset-block-end: auto;
|
|
1629
|
+
block-size: var(--zd-stn-mid);
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
.zd-site-tree-rail[data-root][data-first="true"] {
|
|
1633
|
+
inset-block-start: calc(var(--zd-stn-mid) * var(--zd-stn-split, 0));
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
.zd-site-tree-rail[data-root][data-first="true"][data-last="true"] {
|
|
1637
|
+
block-size: calc(var(--zd-stn-mid) * (1 - var(--zd-stn-split, 0)));
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
.zd-site-tree-branch {
|
|
1641
|
+
inset-inline-start: var(--zd-stn-rail-x);
|
|
1642
|
+
inset-block-start: var(--zd-stn-mid);
|
|
1643
|
+
inline-size: calc(var(--zd-stn-indent) - var(--zd-stn-rail-x) - var(--spacing-hsp-xs));
|
|
1644
|
+
border-block-start-width: 1px;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
.zd-site-tree-row[data-group] > .zd-site-tree-branch {
|
|
1648
|
+
inline-size: calc(var(--zd-stn-indent) - var(--zd-stn-rail-x));
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
.zd-site-tree-stem {
|
|
1652
|
+
inset-inline-start: var(--zd-stn-rail-x);
|
|
1653
|
+
inset-block: calc(var(--zd-stn-row-pad) + var(--zd-stn-slot)) 0;
|
|
1654
|
+
border-inline-start-width: 1px;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
@media (forced-colors: active) {
|
|
1658
|
+
.zd-site-tree-rail,
|
|
1659
|
+
.zd-site-tree-branch,
|
|
1660
|
+
.zd-site-tree-stem {
|
|
1661
|
+
border-color: CanvasText;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
@@ -16,6 +16,11 @@ export interface HeadWithDefaultsProps {
|
|
|
16
16
|
canonical?: string;
|
|
17
17
|
/** Page-specific alternate links, such as an exported Markdown version. */
|
|
18
18
|
alternateLinks?: HeadProps["alternateLinks"];
|
|
19
|
+
/** Active locale: selects `locales[locale].ogImage` when set, and a configured non-default
|
|
20
|
+
* locale links its own `llms.txt`. */
|
|
21
|
+
locale?: string;
|
|
22
|
+
/** Page link-preview image path (frontmatter `og_image`); wins over every setting. */
|
|
23
|
+
ogImage?: string;
|
|
19
24
|
}
|
|
20
25
|
/** Settings subset read by {@link createHeadWithDefaults}. Retained for the
|
|
21
26
|
* `HeadProps`/`ColorSchemeProviderColorMode` type references it documents. */
|
|
@@ -30,10 +35,16 @@ export interface HeadWithDefaultsSettings {
|
|
|
30
35
|
twitterCreator?: string;
|
|
31
36
|
};
|
|
32
37
|
siteName: string;
|
|
38
|
+
/** Per-locale settings: `ogImage` is read here, and each configured code has its own `llms.txt`. */
|
|
39
|
+
locales?: Record<string, {
|
|
40
|
+
ogImage?: string | false;
|
|
41
|
+
}>;
|
|
33
42
|
/** Emit agent-discovery links only when the opt-in static export is enabled. */
|
|
34
43
|
agentExport?: boolean;
|
|
35
44
|
/** Existing llms.txt output setting; retained independently from agent export. */
|
|
36
45
|
llmsTxt?: boolean;
|
|
46
|
+
/** The read-only MCP endpoint; on a root base it also publishes the AI Catalog. */
|
|
47
|
+
mcp?: boolean;
|
|
37
48
|
colorMode?: ColorSchemeProviderColorMode | null | false;
|
|
38
49
|
sidebarResizer?: boolean;
|
|
39
50
|
/** Configured theme-pack slug (ADR `docs/adr/theme-packs.md`, #2822). */
|
|
@@ -10,6 +10,7 @@ import { resolveConfiguredThemePack } from "../theme-packs-registry/configured-t
|
|
|
10
10
|
import { renderAutoLogoIconSvg } from "../auto-logo/icon.js";
|
|
11
11
|
import { deriveComposeMetaTitle, deriveColorSchemeGenerators } from "../chrome/derive.js";
|
|
12
12
|
import { assertChromeContext } from "../chrome/assert-chrome-context.js";
|
|
13
|
+
import { AI_CATALOG_MEDIA_TYPE, AI_CATALOG_WELL_KNOWN_PATH } from "../mcp/constants.js";
|
|
13
14
|
function mediaSwapHandler(media) {
|
|
14
15
|
const handler = `this.media='${media ?? "all"}'`;
|
|
15
16
|
if (!/^this\.media='[a-z\d\s(),:.%+\-/*<>=]*'$/i.test(handler)) {
|
|
@@ -102,14 +103,24 @@ function createHeadWithDefaults(ctx) {
|
|
|
102
103
|
const themePackConfigured = resolveConfiguredThemePack(settings);
|
|
103
104
|
const themePackBase = withBase("/");
|
|
104
105
|
const faviconLinks = resolveFaviconLinks(settings.favicon, settings.siteName, withBase);
|
|
106
|
+
const defaultLocale = ctx.defaultLocale;
|
|
107
|
+
const configuredLocales = settings.locales ?? {};
|
|
108
|
+
const llmsTxtHref = (locale) => withBase(
|
|
109
|
+
locale !== void 0 && locale !== defaultLocale && Object.prototype.hasOwnProperty.call(configuredLocales, locale) ? `/${locale}/llms.txt` : "/llms.txt"
|
|
110
|
+
);
|
|
111
|
+
const publishesAiCatalog = settings.mcp === true && withBase("/") === "/";
|
|
105
112
|
function HeadWithDefaults({
|
|
106
113
|
title,
|
|
107
114
|
description,
|
|
108
115
|
canonical,
|
|
109
|
-
alternateLinks
|
|
116
|
+
alternateLinks,
|
|
117
|
+
locale,
|
|
118
|
+
ogImage
|
|
110
119
|
}) {
|
|
111
120
|
const { metaTags } = settings;
|
|
112
|
-
const
|
|
121
|
+
const localeOgImage = locale !== void 0 ? settings.locales?.[locale]?.ogImage : void 0;
|
|
122
|
+
const configuredOgImage = ogImage ?? (localeOgImage !== void 0 ? localeOgImage : metaTags.ogImage);
|
|
123
|
+
const ogImageUrl = configuredOgImage != null && configuredOgImage !== false ? absoluteUrl(withBase(configuredOgImage)) : void 0;
|
|
113
124
|
const colorMode = settings.colorMode ? settings.colorMode : null;
|
|
114
125
|
const cssText = colorMode ? generateLightDarkCssProperties() : generateCssCustomProperties();
|
|
115
126
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -161,7 +172,8 @@ function createHeadWithDefaults(ctx) {
|
|
|
161
172
|
},
|
|
162
173
|
`page-alternate:${i}`
|
|
163
174
|
)),
|
|
164
|
-
settings.agentExport && settings.llmsTxt && /* @__PURE__ */ jsx("link", { rel: "alternate", href:
|
|
175
|
+
settings.agentExport && settings.llmsTxt && /* @__PURE__ */ jsx("link", { rel: "alternate", href: llmsTxtHref(locale), type: "text/plain" }),
|
|
176
|
+
publishesAiCatalog && /* @__PURE__ */ jsx("link", { rel: "ai-catalog", href: AI_CATALOG_WELL_KNOWN_PATH, type: AI_CATALOG_MEDIA_TYPE }),
|
|
165
177
|
ctx.settings.head && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
166
178
|
ctx.settings.head.preconnect?.map((p, i) => /* @__PURE__ */ jsx(
|
|
167
179
|
"link",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
3
|
+
import type { HomeImageConfig, HomeImageLayout } from "../settings.js";
|
|
4
|
+
export type { HomeImageConfig, HomeImageLayout } from "../settings.js";
|
|
5
|
+
export { assertValidHomeImage, isRootAbsoluteSitePath } from "../config-assertions/index.js";
|
|
6
|
+
/** Props for {@link HomeHero}. Field meanings match the same-named settings. */
|
|
7
|
+
export interface HomeHeroProps {
|
|
8
|
+
/** Printed as the hero `<h1>`. */
|
|
9
|
+
siteName: string;
|
|
10
|
+
/** Short tagline under the title. Printed as-is; `""` leaves it blank. */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** Same values as `settings.logo`. @default "auto" */
|
|
13
|
+
logo?: string | false;
|
|
14
|
+
/** Same shape as `settings.home.image`; replaces the logo when set. */
|
|
15
|
+
image?: HomeImageConfig;
|
|
16
|
+
/** Same values as `settings.home.imageLayout`. Ignored without `image`. @default "logo" */
|
|
17
|
+
imageLayout?: HomeImageLayout;
|
|
18
|
+
/** Site base, prefixed to `logo` and `image` paths. @default "/" */
|
|
19
|
+
base?: string;
|
|
20
|
+
/** Links-row items, rendered `/`-separated in order. */
|
|
21
|
+
links?: Child[];
|
|
22
|
+
/**
|
|
23
|
+
* Resolves a `logo` path to its URL. Defaults to prefixing `base`. The
|
|
24
|
+
* package route passes its page-URL helper here so existing logo output
|
|
25
|
+
* stays byte-identical.
|
|
26
|
+
*/
|
|
27
|
+
logoHref?: (path: string) => string;
|
|
28
|
+
}
|
|
29
|
+
/** Base-prefix an asset path without the page-URL trailing-slash rule. */
|
|
30
|
+
export declare function homeAssetHref(base: string | undefined, path: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* The home page hero: logo (or `image`), site name, description and links row.
|
|
33
|
+
* With the default `imageLayout` ("logo") and no `image`, the markup is exactly
|
|
34
|
+
* what the package home route has always emitted.
|
|
35
|
+
*/
|
|
36
|
+
export declare function HomeHero({ siteName, description, logo, image, imageLayout, base, links, logoHref, }: HomeHeroProps): import("@takazudo/zfb").Description;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
2
|
+
import { AutoLogo } from "../auto-logo/index.js";
|
|
3
|
+
import { assertValidHomeImage, isRootAbsoluteSitePath } from "../config-assertions/index.js";
|
|
4
|
+
function cssUrl(url) {
|
|
5
|
+
return `url("${url.replace(/[\\"]/g, "\\$&")}")`;
|
|
6
|
+
}
|
|
7
|
+
function logoMaskStyle(url) {
|
|
8
|
+
const mask = `${cssUrl(url)} center/contain no-repeat`;
|
|
9
|
+
return { "-webkit-mask": mask, mask };
|
|
10
|
+
}
|
|
11
|
+
function homeAssetHref(base, path) {
|
|
12
|
+
return `${(base ?? "/").replace(/\/+$/, "")}${path}`;
|
|
13
|
+
}
|
|
14
|
+
function HomeHeroImage({
|
|
15
|
+
image,
|
|
16
|
+
layout,
|
|
17
|
+
base
|
|
18
|
+
}) {
|
|
19
|
+
const alt = layout === "backdrop" ? "" : image.alt ?? "";
|
|
20
|
+
const size = image.width !== void 0 && image.height !== void 0 ? { width: image.width, height: image.height } : {};
|
|
21
|
+
const variants = image.darkSrc === void 0 ? [{ src: image.src }] : [
|
|
22
|
+
{ src: image.src, mode: "light" },
|
|
23
|
+
{ src: image.darkSrc, mode: "dark" }
|
|
24
|
+
];
|
|
25
|
+
const fit = layout === "backdrop" ? "object-cover" : "object-contain";
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
class: layout === "large" ? "w-[560px] max-w-full aspect-[1200/630] shrink-0" : layout === "banner" ? "w-full aspect-[1200/630]" : layout === "backdrop" ? "zd-home-backdrop-image" : "w-[320px] max-w-full aspect-[1200/630] shrink-0",
|
|
30
|
+
"data-zd-home-image-box": true,
|
|
31
|
+
children: variants.map(({ src, mode }) => /* @__PURE__ */ jsx(
|
|
32
|
+
"img",
|
|
33
|
+
{
|
|
34
|
+
src: homeAssetHref(base, src),
|
|
35
|
+
alt,
|
|
36
|
+
...size,
|
|
37
|
+
...mode ? { loading: "lazy" } : {},
|
|
38
|
+
decoding: "async",
|
|
39
|
+
class: `block w-full h-full ${fit}`,
|
|
40
|
+
...mode ? { "data-zd-home-image": mode } : {}
|
|
41
|
+
}
|
|
42
|
+
))
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function HomeHeroCopy({
|
|
47
|
+
siteName,
|
|
48
|
+
description,
|
|
49
|
+
rowContent,
|
|
50
|
+
centered
|
|
51
|
+
}) {
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", { class: centered ? "zd-home-copy min-w-0" : "zd-home-copy min-w-0 lg:flex-1", children: [
|
|
53
|
+
/* @__PURE__ */ jsx("h1", { class: "text-heading font-bold mb-vsp-2xs zd-wrap-anywhere", "data-zd-site-name": true, children: siteName }),
|
|
54
|
+
/* @__PURE__ */ jsx("p", { class: "text-muted text-small mb-vsp-sm", children: description }),
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
class: centered ? "zd-home-links flex flex-wrap items-center justify-center gap-hsp-md text-small" : "zd-home-links flex flex-wrap items-center justify-center lg:justify-start gap-hsp-md text-small",
|
|
59
|
+
children: rowContent
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] });
|
|
63
|
+
}
|
|
64
|
+
function HomeHero({
|
|
65
|
+
siteName,
|
|
66
|
+
description,
|
|
67
|
+
logo = "auto",
|
|
68
|
+
image,
|
|
69
|
+
imageLayout,
|
|
70
|
+
base,
|
|
71
|
+
links = [],
|
|
72
|
+
logoHref
|
|
73
|
+
}) {
|
|
74
|
+
const rowContent = [];
|
|
75
|
+
links.forEach((item, index) => {
|
|
76
|
+
if (index > 0) rowContent.push(/* @__PURE__ */ jsx("span", { class: "text-muted", children: "/" }));
|
|
77
|
+
rowContent.push(item);
|
|
78
|
+
});
|
|
79
|
+
const layout = image ? imageLayout ?? "logo" : "logo";
|
|
80
|
+
const copy = /* @__PURE__ */ jsx(
|
|
81
|
+
HomeHeroCopy,
|
|
82
|
+
{
|
|
83
|
+
siteName,
|
|
84
|
+
description,
|
|
85
|
+
rowContent,
|
|
86
|
+
centered: layout === "banner" || layout === "backdrop"
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
if (image && layout === "banner") {
|
|
90
|
+
return /* @__PURE__ */ jsx("div", { "data-zd-home-hero": true, "data-zd-home-hero-layout": "banner", class: "mb-vsp-xl", children: /* @__PURE__ */ jsxs("div", { class: "zd-home-inner flex flex-col items-center text-center gap-hsp-md", children: [
|
|
91
|
+
/* @__PURE__ */ jsx(HomeHeroImage, { image, layout: "banner", base }),
|
|
92
|
+
copy
|
|
93
|
+
] }) });
|
|
94
|
+
}
|
|
95
|
+
if (image && layout === "backdrop") {
|
|
96
|
+
return /* @__PURE__ */ jsx("div", { "data-zd-home-hero": true, "data-zd-home-hero-layout": "backdrop", class: "mb-vsp-xl", children: /* @__PURE__ */ jsxs("div", { class: "zd-home-inner zd-home-backdrop", children: [
|
|
97
|
+
/* @__PURE__ */ jsx(HomeHeroImage, { image, layout: "backdrop", base }),
|
|
98
|
+
/* @__PURE__ */ jsx("div", { class: "zd-home-backdrop-panel text-center", children: copy })
|
|
99
|
+
] }) });
|
|
100
|
+
}
|
|
101
|
+
const resolveLogo = logoHref ?? ((path) => /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(path) ? path : homeAssetHref(base, path.startsWith("/") ? path : `/${path}`));
|
|
102
|
+
const visual = image ? /* @__PURE__ */ jsx(HomeHeroImage, { image, layout, base }) : logo === "auto" ? /* @__PURE__ */ jsx(AutoLogo, { seed: siteName, class: "w-[320px] max-w-full aspect-[1200/630] text-fg shrink-0" }) : logo !== false ? /* @__PURE__ */ jsx(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
class: "w-[320px] max-w-full aspect-[1200/630] bg-fg shrink-0",
|
|
106
|
+
style: logoMaskStyle(resolveLogo(logo)),
|
|
107
|
+
"aria-hidden": "true"
|
|
108
|
+
}
|
|
109
|
+
) : null;
|
|
110
|
+
return /* @__PURE__ */ jsx(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
"data-zd-home-hero": true,
|
|
114
|
+
...image && layout === "large" ? { "data-zd-home-hero-layout": "large" } : {},
|
|
115
|
+
class: "mb-vsp-xl",
|
|
116
|
+
children: /* @__PURE__ */ jsxs("div", { class: "zd-home-inner flex flex-col items-center justify-center text-center gap-hsp-md lg:flex-row lg:text-left lg:gap-hsp-xl", children: [
|
|
117
|
+
visual,
|
|
118
|
+
copy
|
|
119
|
+
] })
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
HomeHero,
|
|
125
|
+
assertValidHomeImage,
|
|
126
|
+
homeAssetHref,
|
|
127
|
+
isRootAbsoluteSitePath
|
|
128
|
+
};
|