@nanisoft/prism-ui 0.5.1 → 0.7.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.
Files changed (132) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/blocks/cta-01/cta.d.ts +66 -6
  3. package/dist/blocks/cta-01/cta.d.ts.map +1 -1
  4. package/dist/blocks/cta-01/cta.js +8 -3
  5. package/dist/blocks/cta-01/index.d.ts +1 -0
  6. package/dist/blocks/cta-01/index.d.ts.map +1 -1
  7. package/dist/blocks/feature-grid-01/feature-grid.d.ts +57 -6
  8. package/dist/blocks/feature-grid-01/feature-grid.d.ts.map +1 -1
  9. package/dist/blocks/feature-grid-01/feature-grid.js +12 -2
  10. package/dist/blocks/feature-grid-01/index.d.ts +1 -0
  11. package/dist/blocks/feature-grid-01/index.d.ts.map +1 -1
  12. package/dist/blocks/hero-01/hero.d.ts +30 -1
  13. package/dist/blocks/hero-01/hero.d.ts.map +1 -1
  14. package/dist/blocks/hero-01/hero.js +14 -2
  15. package/dist/blocks/index.d.ts +10 -0
  16. package/dist/blocks/index.d.ts.map +1 -1
  17. package/dist/blocks/index.js +9 -0
  18. package/dist/blocks/instrument-panel-01/index.d.ts +3 -0
  19. package/dist/blocks/instrument-panel-01/index.d.ts.map +1 -0
  20. package/dist/blocks/instrument-panel-01/index.js +1 -0
  21. package/dist/blocks/instrument-panel-01/instrument-panel.d.ts +114 -0
  22. package/dist/blocks/instrument-panel-01/instrument-panel.d.ts.map +1 -0
  23. package/dist/blocks/instrument-panel-01/instrument-panel.js +64 -0
  24. package/dist/blocks/logo-strip-01/index.d.ts +3 -0
  25. package/dist/blocks/logo-strip-01/index.d.ts.map +1 -0
  26. package/dist/blocks/logo-strip-01/index.js +1 -0
  27. package/dist/blocks/logo-strip-01/logo-strip.d.ts +84 -0
  28. package/dist/blocks/logo-strip-01/logo-strip.d.ts.map +1 -0
  29. package/dist/blocks/logo-strip-01/logo-strip.js +40 -0
  30. package/dist/blocks/note-grid-01/index.d.ts +3 -0
  31. package/dist/blocks/note-grid-01/index.d.ts.map +1 -0
  32. package/dist/blocks/note-grid-01/index.js +1 -0
  33. package/dist/blocks/note-grid-01/note-grid.d.ts +79 -0
  34. package/dist/blocks/note-grid-01/note-grid.d.ts.map +1 -0
  35. package/dist/blocks/note-grid-01/note-grid.js +37 -0
  36. package/dist/blocks/pricing-01/pricing.js +1 -1
  37. package/dist/blocks/process-rail-01/index.d.ts +3 -0
  38. package/dist/blocks/process-rail-01/index.d.ts.map +1 -0
  39. package/dist/blocks/process-rail-01/index.js +1 -0
  40. package/dist/blocks/process-rail-01/process-rail.d.ts +99 -0
  41. package/dist/blocks/process-rail-01/process-rail.d.ts.map +1 -0
  42. package/dist/blocks/process-rail-01/process-rail.js +58 -0
  43. package/dist/blocks/product-grid-01/index.d.ts +3 -0
  44. package/dist/blocks/product-grid-01/index.d.ts.map +1 -0
  45. package/dist/blocks/product-grid-01/index.js +1 -0
  46. package/dist/blocks/product-grid-01/product-grid.d.ts +114 -0
  47. package/dist/blocks/product-grid-01/product-grid.d.ts.map +1 -0
  48. package/dist/blocks/product-grid-01/product-grid.js +51 -0
  49. package/dist/blocks/site-footer/index.d.ts +3 -0
  50. package/dist/blocks/site-footer/index.d.ts.map +1 -0
  51. package/dist/blocks/site-footer/index.js +1 -0
  52. package/dist/blocks/site-footer/site-footer.d.ts +135 -0
  53. package/dist/blocks/site-footer/site-footer.d.ts.map +1 -0
  54. package/dist/blocks/site-footer/site-footer.js +41 -0
  55. package/dist/blocks/site-header/index.d.ts +3 -0
  56. package/dist/blocks/site-header/index.d.ts.map +1 -0
  57. package/dist/blocks/site-header/index.js +1 -0
  58. package/dist/blocks/site-header/site-header.d.ts +142 -0
  59. package/dist/blocks/site-header/site-header.d.ts.map +1 -0
  60. package/dist/blocks/site-header/site-header.js +46 -0
  61. package/dist/blocks/stack-grid-01/index.d.ts +3 -0
  62. package/dist/blocks/stack-grid-01/index.d.ts.map +1 -0
  63. package/dist/blocks/stack-grid-01/index.js +1 -0
  64. package/dist/blocks/stack-grid-01/stack-grid.d.ts +118 -0
  65. package/dist/blocks/stack-grid-01/stack-grid.d.ts.map +1 -0
  66. package/dist/blocks/stack-grid-01/stack-grid.js +49 -0
  67. package/dist/blocks/status-ledger-01/index.d.ts +3 -0
  68. package/dist/blocks/status-ledger-01/index.d.ts.map +1 -0
  69. package/dist/blocks/status-ledger-01/index.js +1 -0
  70. package/dist/blocks/status-ledger-01/status-ledger.d.ts +131 -0
  71. package/dist/blocks/status-ledger-01/status-ledger.d.ts.map +1 -0
  72. package/dist/blocks/status-ledger-01/status-ledger.js +80 -0
  73. package/dist/catalog.d.ts.map +1 -1
  74. package/dist/catalog.js +180 -0
  75. package/dist/components/index.d.ts +11 -0
  76. package/dist/components/index.d.ts.map +1 -1
  77. package/dist/components/index.js +6 -0
  78. package/dist/components/ui/card.d.ts +25 -0
  79. package/dist/components/ui/card.d.ts.map +1 -1
  80. package/dist/components/ui/card.js +25 -0
  81. package/dist/components/ui/cta-link.d.ts +45 -0
  82. package/dist/components/ui/cta-link.d.ts.map +1 -0
  83. package/dist/components/ui/cta-link.js +81 -0
  84. package/dist/components/ui/diagram.d.ts +154 -0
  85. package/dist/components/ui/diagram.d.ts.map +1 -0
  86. package/dist/components/ui/diagram.js +150 -0
  87. package/dist/components/ui/fact-list.d.ts +90 -0
  88. package/dist/components/ui/fact-list.d.ts.map +1 -0
  89. package/dist/components/ui/fact-list.js +38 -0
  90. package/dist/components/ui/product-mark.d.ts +115 -0
  91. package/dist/components/ui/product-mark.d.ts.map +1 -0
  92. package/dist/components/ui/product-mark.js +82 -0
  93. package/dist/components/ui/product-switcher.d.ts +108 -0
  94. package/dist/components/ui/product-switcher.d.ts.map +1 -0
  95. package/dist/components/ui/product-switcher.js +47 -0
  96. package/dist/components/ui/prose.d.ts +88 -0
  97. package/dist/components/ui/prose.d.ts.map +1 -0
  98. package/dist/components/ui/prose.js +53 -0
  99. package/dist/components/ui/section.d.ts +24 -1
  100. package/dist/components/ui/section.d.ts.map +1 -1
  101. package/dist/components/ui/section.js +11 -2
  102. package/dist/components/ui/slider.d.ts.map +1 -1
  103. package/dist/components/ui/slider.js +7 -1
  104. package/dist/index.d.ts +24 -0
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +17 -0
  107. package/dist/pages/blog-post-page/index.d.ts +174 -0
  108. package/dist/pages/blog-post-page/index.d.ts.map +1 -0
  109. package/dist/pages/blog-post-page/index.js +49 -0
  110. package/dist/pages/docs-shell/docs-shell.d.ts +250 -0
  111. package/dist/pages/docs-shell/docs-shell.d.ts.map +1 -0
  112. package/dist/pages/docs-shell/docs-shell.js +197 -0
  113. package/dist/pages/docs-shell/index.d.ts +3 -0
  114. package/dist/pages/docs-shell/index.d.ts.map +1 -0
  115. package/dist/pages/docs-shell/index.js +1 -0
  116. package/dist/pages/index.d.ts +13 -2
  117. package/dist/pages/index.d.ts.map +1 -1
  118. package/dist/pages/index.js +10 -2
  119. package/dist/pages/not-found-page/index.d.ts +112 -0
  120. package/dist/pages/not-found-page/index.d.ts.map +1 -0
  121. package/dist/pages/not-found-page/index.js +46 -0
  122. package/dist/provider/provider.d.ts +5 -0
  123. package/dist/provider/provider.d.ts.map +1 -1
  124. package/dist/provider/provider.js +129 -38
  125. package/dist/provider/theme-script.d.ts +41 -3
  126. package/dist/provider/theme-script.d.ts.map +1 -1
  127. package/dist/provider/theme-script.js +68 -17
  128. package/dist/styles.css +555 -12
  129. package/dist/theming/index.d.ts +132 -2
  130. package/dist/theming/index.d.ts.map +1 -1
  131. package/dist/theming/index.js +127 -1
  132. package/package.json +14 -4
@@ -0,0 +1,197 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Prose } from '../../components/ui/prose';
3
+ import { Heading, Text } from '../../components/ui/typography';
4
+ import { cn } from '../../lib/utils';
5
+ /**
6
+ * A documentation screen: a navigation rail, the document, a contents rail and
7
+ * the pager to the neighbouring pages.
8
+ *
9
+ * **This is the Page the other three NaniSoft sites import, and the name is
10
+ * theirs.** All three already read `import { DocsShell, type DocsNavEntry }
11
+ * from '@nanisoft/prism-ui/pages'` in their own document template, and all three
12
+ * map their page tree into that shape in their own `lib/to-prism-tree`. A
13
+ * published name cannot be cheaply changed and there is no redirect lane for item
14
+ * routes, so the name follows the three import lines rather than this file's
15
+ * shape. It was `docs-shell` in the retired line, where it was an empty
16
+ * `div` plus a class name that each site then had to style from scratch, and it
17
+ * is `docs-shell` here because that is what the three call sites already say.
18
+ *
19
+ * **A section is a label, not a control.** It carries no status, no badge, no
20
+ * count, no collapse and no sort, and that is the whole of its interface. The
21
+ * reason is specific: AlphaLens files its documentation as a pipeline, where
22
+ * "Unified data contract (approved)" is a stage of the work and not a topic a
23
+ * reader may visit in any order, and every structural affordance says the
24
+ * opposite. A status in the title is part of the title and stays there as words:
25
+ * the Page reads no parentheses, matches no vocabulary, and renders no pill
26
+ * beside a heading that has one. A tree is data, and a Page that parsed a
27
+ * consumer's data would be a Page that had opinions about it.
28
+ *
29
+ * **A group with no index is a label rather than a route.** `href` is optional
30
+ * on `DocsNavGroup` for exactly that, and the absence means the label. The three
31
+ * consumer sites all write `url: node.index?.url ?? ''` in their own adapter
32
+ * today, which is the same fact spelled as an empty string, and two of the three
33
+ * then carry a stylesheet rule that styles the resulting anchor-with-no-href
34
+ * back into a label. Naming the case in the type makes those two rules dead
35
+ * rather than load-bearing, and the type is the only place that had to change.
36
+ *
37
+ * **The pager is derived from the navigation rather than passed.** The rail
38
+ * already knows every page and the order a reader meets them in, and deriving the
39
+ * two neighbours from that plus `currentHref` removes one derivation from each
40
+ * of the three sites. It is derived rather than passed for a second reason: a
41
+ * caller who passes neighbours can pass a neighbour that is not in the tree, and
42
+ * this is the one arrangement where a reader would notice.
43
+ *
44
+ * **The consumer supplies two orders and the Page imposes neither.** `nav` is in
45
+ * the order the rail shows, and `toc` is in the order the contents rail shows.
46
+ * Both are read as given: nothing is sorted, deduplicated or alphabetised, and a
47
+ * tree whose sections are named for subject matter reads in the order its
48
+ * author filed it. A Page that sorted its rail would flatten the one thing the
49
+ * three sites disagree about and cannot both be right about.
50
+ *
51
+ * **The rail is bounded in height.** Atlas files nineteen pages and AlphaLens
52
+ * files twenty-seven, so the taller tree is half again as long, and an unbounded
53
+ * rail on a tall tree is a rail that pushes the document below the fold before
54
+ * the reader has read a line of it. The rail and the contents rail are each
55
+ * capped against the viewport and scroll inside it, so a nineteen-page tree and a
56
+ * twenty-seven-page tree are both a full screen and neither is a page-long
57
+ * sidebar.
58
+ *
59
+ * It is a Page rather than a Block because it is a whole screen and it is the
60
+ * screen a content pipeline targets: a route that reads one document and hands
61
+ * it the page tree, the outline and the current address. A Block would be the
62
+ * rail, and the rail's job is not separable from the screen's, because the
63
+ * arrangement of rail, document, contents and pager is what the three sites each
64
+ * wrote separately and are here written once.
65
+ *
66
+ * It is a server Component. It fetches nothing, it holds no state and it imports
67
+ * no router, so a consumer renders it from whichever route their framework names
68
+ * and hands it the document their pipeline produced.
69
+ */
70
+ export function DocsShell({ title, description, nav, toc, currentHref, navLabel, tocLabel, pagerLabel, pagerLabels, header, footer, className, children, }) {
71
+ const rail = nav && nav.length > 0 ? nav : undefined;
72
+ const contents = toc && toc.length > 0 ? toc : undefined;
73
+ const neighbours = currentHref === undefined ? undefined : deriveNeighbours(nav ?? [], currentHref);
74
+ return (_jsxs("div", { "data-slot": "docs-shell", className: cn('mx-auto w-full max-w-6xl px-6 py-10 lg:px-8', className), children: [header, _jsxs("div", { "data-slot": "docs-shell-frame", className: cn('flex flex-col gap-8 lg:flex-row lg:gap-10',
75
+ // One column for the document, and a third for whichever rails are
76
+ // present. The frame is sized by what the consumer passed rather than
77
+ // by a fixed three-column grid, so a tree with no contents rail leaves
78
+ // the document the width the two remaining columns divide between
79
+ // them.
80
+ contents ? 'lg:grid lg:grid-cols-[15rem_minmax(0,1fr)] xl:grid-cols-[15rem_minmax(0,1fr)_13rem]' : 'lg:grid lg:grid-cols-[15rem_minmax(0,1fr)]'), children: [rail ? (_jsx("aside", { "data-slot": "docs-rail", className: "hidden lg:col-start-1 lg:row-start-1 lg:block", children: _jsx("nav", { "aria-label": navLabel, className: "lg:sticky lg:top-20 lg:max-h-[calc(100svh-7rem)] lg:overflow-y-auto lg:pe-4", children: _jsx(NavList, { entries: rail, currentHref: currentHref, depth: 0 }) }) })) : null, _jsxs("article", { "data-slot": "docs-article", className: "flex min-w-0 flex-col gap-8", children: [title ? (_jsxs("header", { className: "flex flex-col gap-3", children: [_jsx(Heading, { as: "h1", size: "3xl", children: title }), description ? (_jsx(Text, { size: "lg", tone: "muted", className: "max-w-measure", children: description })) : null] })) : description ? (_jsx(Text, { size: "lg", tone: "muted", className: "max-w-measure", children: description })) : null, _jsx(Prose, { fullWidth: true, children: children }), neighbours ? (_jsx(Pager, { previous: neighbours.previous, next: neighbours.next, label: pagerLabel, labels: pagerLabels })) : null] }), contents ? (_jsx("aside", { "data-slot": "docs-contents", className: "hidden lg:col-start-3 lg:row-start-1 lg:block", children: _jsx("nav", { "aria-label": tocLabel, className: "lg:sticky lg:top-20 lg:max-h-[calc(100svh-7rem)] lg:overflow-y-auto", children: _jsx(NavList, { entries: contents, currentHref: currentHref, depth: 0 }) }) })) : null] }), footer] }));
81
+ }
82
+ /* ------------------------------------------------------------------ *
83
+ * The rail
84
+ * ------------------------------------------------------------------ */
85
+ /**
86
+ * One level of the tree as a list, at whatever depth it sits.
87
+ *
88
+ * The nesting is a rule rather than a special case: the tree is the shape the
89
+ * navigation has, and one level of that is the whole renderer. A tree one deep
90
+ * and a tree seven deep are the same code with different data, which is what
91
+ * lets one Page carry a site that files nine pages under a heading and a site
92
+ * that files six sections separated by rules.
93
+ */
94
+ function NavList({ entries, currentHref, depth, }) {
95
+ return (_jsx("ul", { "data-slot": "docs-nav-list", "data-depth": depth, className: cn('border-border flex flex-col gap-1 border-l',
96
+ // One level of indent per nested group, and none at the top, so the
97
+ // depth reads from the rule rather than from the words.
98
+ depth > 0 && 'ps-3'), children: entries.map((entry, index) => (_jsx(NavNode, { entry: entry, currentHref: currentHref, depth: depth }, `${entry.type}:${index}`))) }));
99
+ }
100
+ /**
101
+ * One entry, in whichever of the three shapes it arrives.
102
+ *
103
+ * The switch is on `type` rather than on the presence of fields, so an entry
104
+ * that arrives malformed falls to the last arm and renders nothing rather than
105
+ * rendering a destination it has no address for.
106
+ */
107
+ function NavNode({ entry, currentHref, depth, }) {
108
+ if (entry.type === 'divider') {
109
+ // A rule between entries. It is a label, so it is not focusable and a reader
110
+ // does not meet it as a destination, and the empty title renders no words
111
+ // above the hairline rather than a word a reader has to interpret.
112
+ return (_jsx("li", { "data-slot": "docs-nav-divider", className: "border-border mt-2 border-t pt-2 first:mt-0 first:border-t-0 first:pt-0", children: entry.title ? (_jsx("span", { className: "text-muted-foreground text-xs font-medium tracking-wide uppercase", children: entry.title })) : null }));
113
+ }
114
+ if (entry.type === 'group') {
115
+ return (_jsx("li", { "data-slot": "docs-nav-group", children: _jsxs("div", { className: "flex flex-col gap-1", children: [entry.href === undefined ? (_jsx("span", { "data-slot": "docs-nav-label", className: cn('rounded-sm text-sm font-semibold tracking-tight', containsHref(entry, currentHref) ? 'text-foreground' : 'text-muted-foreground'), children: entry.title })) : (_jsx("a", { "data-slot": "docs-nav-heading", href: entry.href, "aria-current": currentHref === entry.href ? 'page' : undefined, className: cn('hover:text-foreground rounded-sm text-sm font-semibold tracking-tight transition-colors duration-fast ease-out', under(entry.href, currentHref) ? 'text-foreground' : 'text-muted-foreground'), children: entry.title })), entry.items.length > 0 ? (_jsx(NavList, { entries: entry.items, currentHref: currentHref, depth: depth + 1 })) : null] }) }));
116
+ }
117
+ return (_jsx("li", { "data-slot": "docs-nav-page", children: _jsx("a", { "data-slot": "docs-nav-link", href: entry.href, "aria-current": currentHref === entry.href ? 'page' : undefined, className: cn('-ms-px block border-l-2 py-1 ps-3 text-sm transition-colors duration-fast ease-out', currentHref === entry.href
118
+ ? 'text-foreground border-primary font-medium'
119
+ : 'text-muted-foreground hover:text-foreground border-transparent'), children: entry.title }) }));
120
+ }
121
+ /**
122
+ * Every page the tree holds, in the order a reader meets them.
123
+ *
124
+ * A group's own index page comes before the pages under it, because that is the
125
+ * order the tree states and the Page does not reorder it. A group with no index
126
+ * contributes its children and nothing else, which is the second thing that
127
+ * makes an absent `href` a label rather than a route: there is no page there for
128
+ * the pager to reach either. A divider contributes nothing at all.
129
+ */
130
+ function flatten(entries, into = []) {
131
+ for (const entry of entries) {
132
+ if (entry.type === 'page') {
133
+ into.push({ title: entry.title, href: entry.href });
134
+ continue;
135
+ }
136
+ if (entry.type === 'group') {
137
+ if (entry.href !== undefined)
138
+ into.push({ title: entry.title, href: entry.href });
139
+ flatten(entry.items, into);
140
+ }
141
+ }
142
+ return into;
143
+ }
144
+ /**
145
+ * The pages either side of `currentHref`, or nothing when it is not in the tree.
146
+ *
147
+ * It returns `undefined` rather than a pair of blanks when the address is not in
148
+ * the navigation, because a pager with two empty halves is a rule above nothing
149
+ * and a reader cannot tell it from a page that has no neighbours.
150
+ */
151
+ function deriveNeighbours(entries, currentHref) {
152
+ const flat = flatten(entries);
153
+ const at = flat.findIndex((entry) => entry.href === currentHref);
154
+ if (at === -1)
155
+ return undefined;
156
+ return { previous: flat[at - 1], next: flat[at + 1] };
157
+ }
158
+ /**
159
+ * The two pages either side of this one, rendered as native links.
160
+ *
161
+ * Each half renders only when there is a page for it. A "previous" link on the
162
+ * first page is a link to the page the reader has already read, and a "next"
163
+ * link on the last is a promise the site cannot keep.
164
+ */
165
+ function Pager({ previous, next, label, labels, }) {
166
+ if (!previous && !next)
167
+ return null;
168
+ return (_jsxs("nav", { "aria-label": label, "data-slot": "docs-pager", className: "border-border mt-4 flex flex-wrap items-start justify-between gap-4 border-t pt-6", children: [previous ? (_jsxs("a", { href: previous.href, className: "hover:text-foreground flex flex-col rounded-sm transition-colors duration-fast ease-out", children: [_jsx("span", { className: "text-muted-foreground text-xs font-medium tracking-wide uppercase", children: labels.previous }), _jsx("span", { className: "text-sm font-semibold", children: previous.title })] })) : (_jsx("span", {})), next ? (_jsxs("a", { href: next.href, className: "hover:text-foreground ms-auto flex flex-col rounded-sm text-right transition-colors duration-fast ease-out", children: [_jsx("span", { className: "text-muted-foreground text-xs font-medium tracking-wide uppercase", children: labels.next }), _jsx("span", { className: "text-sm font-semibold", children: next.title })] })) : null] }));
169
+ }
170
+ /* ------------------------------------------------------------------ *
171
+ * The current address
172
+ * ------------------------------------------------------------------ */
173
+ /** Under a route, or at it, and never under a route that merely starts the same. */
174
+ function under(href, currentHref) {
175
+ return (href !== undefined &&
176
+ currentHref !== undefined &&
177
+ (currentHref === href || currentHref.startsWith(`${href}/`)));
178
+ }
179
+ /**
180
+ * Whether the current page is inside this group.
181
+ *
182
+ * A group with a route answers for that route and everything under it. A group
183
+ * without one has no route to answer with, so it asks its children, which is the
184
+ * only way a label can still show a reader that they are inside it.
185
+ */
186
+ function containsHref(group, currentHref) {
187
+ if (under(group.href, currentHref))
188
+ return true;
189
+ return group.items.some((entry) => {
190
+ if (entry.type === 'page')
191
+ return under(entry.href, currentHref);
192
+ if (entry.type === 'group')
193
+ return containsHref(entry, currentHref);
194
+ return false;
195
+ });
196
+ }
197
+ export default DocsShell;
@@ -0,0 +1,3 @@
1
+ export { DocsShell, default } from './docs-shell';
2
+ export type { DocsShellProps, DocsNavEntry, DocsNavPage, DocsNavGroup, DocsNavDivider, DocsPagerLabels, } from './docs-shell';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/docs-shell/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACjD,YAAY,EACV,cAAc,EACd,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,cAAc,CAAA"}
@@ -0,0 +1 @@
1
+ export { DocsShell, default } from './docs-shell';
@@ -3,8 +3,13 @@
3
3
  *
4
4
  * A Page is a shipped, installable screen model composed of Blocks and
5
5
  * Components that receives application-owned navigation, content and data
6
- * (ticket 07). The v1 roster ships four Pages. Each is also importable on its
7
- * own subpath, `@nanisoft/prism-ui/pages/<slug>`.
6
+ * (ticket 07). Each is also importable on its own subpath,
7
+ * `@nanisoft/prism-ui/pages/<slug>`.
8
+ *
9
+ * `DocsShell` and `DocsNavEntry` keep the names the three consumer sites already
10
+ * import, so the name follows those import lines rather than this file's shape.
11
+ * A published name cannot be cheaply changed and there is no redirect lane for
12
+ * item routes.
8
13
  */
9
14
  export { MarketingPage } from './marketing-page';
10
15
  export type { MarketingPageProps } from './marketing-page';
@@ -14,4 +19,10 @@ export { SettingsPage } from './settings-page';
14
19
  export type { SettingsPageProps, SettingsPageTab } from './settings-page';
15
20
  export { AuthPage } from './auth-page';
16
21
  export type { AuthPageProps, AuthPageAside } from './auth-page';
22
+ export { NotFoundPage } from './not-found-page';
23
+ export type { NotFoundPageProps, NotFoundLink } from './not-found-page';
24
+ export { BlogPostPage } from './blog-post-page';
25
+ export type { BlogPostPageProps, BlogPostTag, BlogPostNeighbour, BlogPostTrailLabels } from './blog-post-page';
26
+ export { DocsShell } from './docs-shell';
27
+ export type { DocsShellProps, DocsNavEntry, DocsNavPage, DocsNavGroup, DocsNavDivider, DocsPagerLabels, } from './docs-shell';
17
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC9G,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,YAAY,EACV,cAAc,EACd,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,cAAc,CAAA"}
@@ -3,10 +3,18 @@
3
3
  *
4
4
  * A Page is a shipped, installable screen model composed of Blocks and
5
5
  * Components that receives application-owned navigation, content and data
6
- * (ticket 07). The v1 roster ships four Pages. Each is also importable on its
7
- * own subpath, `@nanisoft/prism-ui/pages/<slug>`.
6
+ * (ticket 07). Each is also importable on its own subpath,
7
+ * `@nanisoft/prism-ui/pages/<slug>`.
8
+ *
9
+ * `DocsShell` and `DocsNavEntry` keep the names the three consumer sites already
10
+ * import, so the name follows those import lines rather than this file's shape.
11
+ * A published name cannot be cheaply changed and there is no redirect lane for
12
+ * item routes.
8
13
  */
9
14
  export { MarketingPage } from './marketing-page';
10
15
  export { DashboardPage } from './dashboard-page';
11
16
  export { SettingsPage } from './settings-page';
12
17
  export { AuthPage } from './auth-page';
18
+ export { NotFoundPage } from './not-found-page';
19
+ export { BlogPostPage } from './blog-post-page';
20
+ export { DocsShell } from './docs-shell';
@@ -0,0 +1,112 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * One way out of a page that was not found.
4
+ *
5
+ * A destination, and the words for it. Both are required, because a not-found
6
+ * page with no way out is a dead end with a message on it, and a link with no
7
+ * words is a shape a reader has to guess at.
8
+ */
9
+ export type NotFoundLink = {
10
+ /** The words of the link. */
11
+ label: string;
12
+ /** Where it goes. */
13
+ href: string;
14
+ /**
15
+ * Opens the destination in a new browsing context, which defaults the link
16
+ * relationship to `noopener noreferrer`. Almost never right here: a reader who
17
+ * followed a broken link and is sent to a new tab has to find their way back.
18
+ */
19
+ newTab?: boolean;
20
+ };
21
+ /**
22
+ * The props a NotFoundPage takes.
23
+ *
24
+ * Every string is a prop and the Page ships none. There is no "404", no "this
25
+ * page does not exist", no product name and no default set of links: a not-found
26
+ * page that hardcoded any of them would be a page that made a claim about a
27
+ * product it knows nothing about, and the one page on a site that every reader
28
+ * and no crawler will see is the worst place to hardcode a sentence.
29
+ */
30
+ export type NotFoundPageProps = {
31
+ /**
32
+ * The status code, shown as the page's own `h1`. Required, and a string rather
33
+ * than a number because it is displayed, not computed: a Page never decides
34
+ * what code it is answering.
35
+ */
36
+ code: string;
37
+ /**
38
+ * The headline under the code: the sentence that says what happened. It is the
39
+ * part a reader actually reads, and it is the caller's because every product
40
+ * says it differently - "No node here", "This page does not exist (yet)".
41
+ */
42
+ title: string;
43
+ /**
44
+ * One or two sentences under the headline, for anything a reader should know
45
+ * before they follow one of the links: that the URL may be mistyped, that the
46
+ * page is planned, that a search would find it.
47
+ */
48
+ description?: string;
49
+ /**
50
+ * The ways out, in the order a reader should see them. Put the destination
51
+ * most likely to help first; a not-found page that offers a homepage link
52
+ * before the documentation sends a reader further from what they wanted.
53
+ */
54
+ links: readonly NotFoundLink[];
55
+ /**
56
+ * The accessible name of the row of ways out. It is required, because it is a
57
+ * word a reader hears and a Page that ships no copy ships no reader-facing copy
58
+ * either. "Ways out" is the Page's own phrasing; a site that files its
59
+ * destinations differently names the same landmark differently.
60
+ */
61
+ linksLabel: string;
62
+ /**
63
+ * A slot for whatever else the site wants to say here: a search box, a list of
64
+ * recent posts, a contact address.
65
+ */
66
+ children?: ReactNode;
67
+ /**
68
+ * Layout only, exactly as on every Component. Changing a Prism-owned visual
69
+ * property from here is prohibited.
70
+ */
71
+ className?: string;
72
+ };
73
+ /**
74
+ * A complete not-found screen: the code, what happened, and the ways out.
75
+ *
76
+ * All four NaniSoft sites compose one, each in its own `not-found` route, and
77
+ * three of them are the same six lines with a different product name on it: a
78
+ * display title carrying the code, one muted sentence, and two or three links.
79
+ * The fourth wrote the same thing in its own markup. Four hand-written screens
80
+ * for one shape.
81
+ *
82
+ * It is a Page rather than a Block because it is a whole screen: it owns the
83
+ * document's `h1`, it is what a router renders when a route does not resolve, and
84
+ * it composes `Section`, `Heading`, `Text`, `Prose` and `CtaLink` into the one
85
+ * arrangement of them that answers "this is not here". A Block would be a band
86
+ * of that arrangement, and the band's job is not separable from the screen's:
87
+ * there is one correct page here and it is short.
88
+ *
89
+ * **The code is the `h1` and the sentence is not.** A not-found page whose
90
+ * `h1` is "Page not found" gives a search engine and a screen reader nothing
91
+ * distinct to index, and the code is the one string on the page that is the same
92
+ * for every broken URL. The code takes the display step and the sentence takes
93
+ * the muted one, which is the reverse of what a reader sees first and the right
94
+ * way round for anything that reads the outline.
95
+ *
96
+ * The links are `CtaLink`, so each one is a native anchor with a destination a
97
+ * browser can show, copy and open in a new tab. A not-found page is the one place
98
+ * on a site where a reader most wants to see where a link goes before following
99
+ * it, because they have just followed one that went nowhere.
100
+ *
101
+ * The page carries no `noindex` and no `robots` directive, because this is a
102
+ * component and not a route: what a not-found response is indexed as is the
103
+ * consumer's server's decision, and a Page that declared it would be a Page
104
+ * making a claim about a deployment it cannot see.
105
+ *
106
+ * It is a server Component. It fetches nothing, it holds no state and it imports
107
+ * no router, which is what lets a consumer render it from whichever not-found
108
+ * route their framework names.
109
+ */
110
+ export declare function NotFoundPage({ code, title, description, links, linksLabel, children, className, }: NotFoundPageProps): import("react").JSX.Element;
111
+ export default NotFoundPage;
112
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/not-found-page/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,KAAK,EAAE,SAAS,YAAY,EAAE,CAAA;IAC9B;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,KAAK,EACL,WAAW,EACX,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,GACV,EAAE,iBAAiB,+BA+BnB;AAED,eAAe,YAAY,CAAA"}
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CtaLink } from '../../components/ui/cta-link';
3
+ import { Heading, Text } from '../../components/ui/typography';
4
+ import { Prose } from '../../components/ui/prose';
5
+ import { Section } from '../../components/ui/section';
6
+ /**
7
+ * A complete not-found screen: the code, what happened, and the ways out.
8
+ *
9
+ * All four NaniSoft sites compose one, each in its own `not-found` route, and
10
+ * three of them are the same six lines with a different product name on it: a
11
+ * display title carrying the code, one muted sentence, and two or three links.
12
+ * The fourth wrote the same thing in its own markup. Four hand-written screens
13
+ * for one shape.
14
+ *
15
+ * It is a Page rather than a Block because it is a whole screen: it owns the
16
+ * document's `h1`, it is what a router renders when a route does not resolve, and
17
+ * it composes `Section`, `Heading`, `Text`, `Prose` and `CtaLink` into the one
18
+ * arrangement of them that answers "this is not here". A Block would be a band
19
+ * of that arrangement, and the band's job is not separable from the screen's:
20
+ * there is one correct page here and it is short.
21
+ *
22
+ * **The code is the `h1` and the sentence is not.** A not-found page whose
23
+ * `h1` is "Page not found" gives a search engine and a screen reader nothing
24
+ * distinct to index, and the code is the one string on the page that is the same
25
+ * for every broken URL. The code takes the display step and the sentence takes
26
+ * the muted one, which is the reverse of what a reader sees first and the right
27
+ * way round for anything that reads the outline.
28
+ *
29
+ * The links are `CtaLink`, so each one is a native anchor with a destination a
30
+ * browser can show, copy and open in a new tab. A not-found page is the one place
31
+ * on a site where a reader most wants to see where a link goes before following
32
+ * it, because they have just followed one that went nowhere.
33
+ *
34
+ * The page carries no `noindex` and no `robots` directive, because this is a
35
+ * component and not a route: what a not-found response is indexed as is the
36
+ * consumer's server's decision, and a Page that declared it would be a Page
37
+ * making a claim about a deployment it cannot see.
38
+ *
39
+ * It is a server Component. It fetches nothing, it holds no state and it imports
40
+ * no router, which is what lets a consumer render it from whichever not-found
41
+ * route their framework names.
42
+ */
43
+ export function NotFoundPage({ code, title, description, links, linksLabel, children, className, }) {
44
+ return (_jsx(Section, { className: className, children: _jsxs("div", { className: "flex flex-col items-start gap-6", children: [_jsx(Heading, { as: "h1", size: "4xl", className: "text-muted-foreground font-mono", children: code }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx(Heading, { as: "h2", size: "2xl", children: title }), description ? _jsx(Text, { size: "lg", children: description }) : null] }), links.length > 0 ? (_jsx("nav", { "aria-label": linksLabel, className: "flex flex-wrap items-center gap-3", children: links.map((link, index) => (_jsx(CtaLink, { href: link.href, newTab: link.newTab, variant: index === 0 ? 'default' : 'outline', children: link.label }, link.href))) })) : null, children ? _jsx(Prose, { className: "mt-2", children: children }) : null] }) }));
45
+ }
46
+ export default NotFoundPage;
@@ -7,6 +7,11 @@
7
7
  * the same two markup attributes the declarative form uses. There is no
8
8
  * override, merge, token, className or style prop: the provider's only outputs
9
9
  * are the document-element attributes and context (ticket 07).
10
+ *
11
+ * It resolves through `resolveTheme`, the one rule the boot script also
12
+ * implements, and it never writes `THEME_ORIGIN_ATTRIBUTE`: the script is that
13
+ * attribute's only writer, and two writers would turn a record of the origin
14
+ * into a race.
10
15
  */
11
16
  import { type ReactNode } from 'react';
12
17
  import { type Mode, type PackId } from '../theming';
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider/provider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAEd,OAAO,EAML,KAAK,IAAI,EACT,KAAK,MAAM,EACZ,MAAM,YAAY,CAAA;AAEnB,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IAC7B,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAID,MAAM,MAAM,kBAAkB,GAAG;IAC/B,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sCAAsC;IACtC,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAwBD,wBAAgB,aAAa,CAAC,EAC5B,WAAuB,EACvB,WAAqB,EACrB,UAAgC,EAChC,QAAQ,GACT,EAAE,kBAAkB,+BA8CpB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAM1C"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider/provider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAEd,OAAO,EAML,KAAK,IAAI,EACT,KAAK,MAAM,EAEZ,MAAM,YAAY,CAAA;AAEnB,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IAC7B,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAID,MAAM,MAAM,kBAAkB,GAAG;IAC/B,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sCAAsC;IACtC,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAyCD,wBAAgB,aAAa,CAAC,EAC5B,WAAuB,EACvB,WAAqB,EACrB,UAAgC,EAChC,QAAQ,GACT,EAAE,kBAAkB,+BAuHpB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAM1C"}