@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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/blocks/cta-01/cta.d.ts +66 -6
- package/dist/blocks/cta-01/cta.d.ts.map +1 -1
- package/dist/blocks/cta-01/cta.js +8 -3
- package/dist/blocks/cta-01/index.d.ts +1 -0
- package/dist/blocks/cta-01/index.d.ts.map +1 -1
- package/dist/blocks/feature-grid-01/feature-grid.d.ts +57 -6
- package/dist/blocks/feature-grid-01/feature-grid.d.ts.map +1 -1
- package/dist/blocks/feature-grid-01/feature-grid.js +12 -2
- package/dist/blocks/feature-grid-01/index.d.ts +1 -0
- package/dist/blocks/feature-grid-01/index.d.ts.map +1 -1
- package/dist/blocks/hero-01/hero.d.ts +30 -1
- package/dist/blocks/hero-01/hero.d.ts.map +1 -1
- package/dist/blocks/hero-01/hero.js +14 -2
- package/dist/blocks/index.d.ts +10 -0
- package/dist/blocks/index.d.ts.map +1 -1
- package/dist/blocks/index.js +9 -0
- package/dist/blocks/instrument-panel-01/index.d.ts +3 -0
- package/dist/blocks/instrument-panel-01/index.d.ts.map +1 -0
- package/dist/blocks/instrument-panel-01/index.js +1 -0
- package/dist/blocks/instrument-panel-01/instrument-panel.d.ts +114 -0
- package/dist/blocks/instrument-panel-01/instrument-panel.d.ts.map +1 -0
- package/dist/blocks/instrument-panel-01/instrument-panel.js +64 -0
- package/dist/blocks/logo-strip-01/index.d.ts +3 -0
- package/dist/blocks/logo-strip-01/index.d.ts.map +1 -0
- package/dist/blocks/logo-strip-01/index.js +1 -0
- package/dist/blocks/logo-strip-01/logo-strip.d.ts +84 -0
- package/dist/blocks/logo-strip-01/logo-strip.d.ts.map +1 -0
- package/dist/blocks/logo-strip-01/logo-strip.js +40 -0
- package/dist/blocks/note-grid-01/index.d.ts +3 -0
- package/dist/blocks/note-grid-01/index.d.ts.map +1 -0
- package/dist/blocks/note-grid-01/index.js +1 -0
- package/dist/blocks/note-grid-01/note-grid.d.ts +79 -0
- package/dist/blocks/note-grid-01/note-grid.d.ts.map +1 -0
- package/dist/blocks/note-grid-01/note-grid.js +37 -0
- package/dist/blocks/pricing-01/pricing.js +1 -1
- package/dist/blocks/process-rail-01/index.d.ts +3 -0
- package/dist/blocks/process-rail-01/index.d.ts.map +1 -0
- package/dist/blocks/process-rail-01/index.js +1 -0
- package/dist/blocks/process-rail-01/process-rail.d.ts +99 -0
- package/dist/blocks/process-rail-01/process-rail.d.ts.map +1 -0
- package/dist/blocks/process-rail-01/process-rail.js +58 -0
- package/dist/blocks/product-grid-01/index.d.ts +3 -0
- package/dist/blocks/product-grid-01/index.d.ts.map +1 -0
- package/dist/blocks/product-grid-01/index.js +1 -0
- package/dist/blocks/product-grid-01/product-grid.d.ts +114 -0
- package/dist/blocks/product-grid-01/product-grid.d.ts.map +1 -0
- package/dist/blocks/product-grid-01/product-grid.js +51 -0
- package/dist/blocks/site-footer/index.d.ts +3 -0
- package/dist/blocks/site-footer/index.d.ts.map +1 -0
- package/dist/blocks/site-footer/index.js +1 -0
- package/dist/blocks/site-footer/site-footer.d.ts +135 -0
- package/dist/blocks/site-footer/site-footer.d.ts.map +1 -0
- package/dist/blocks/site-footer/site-footer.js +41 -0
- package/dist/blocks/site-header/index.d.ts +3 -0
- package/dist/blocks/site-header/index.d.ts.map +1 -0
- package/dist/blocks/site-header/index.js +1 -0
- package/dist/blocks/site-header/site-header.d.ts +142 -0
- package/dist/blocks/site-header/site-header.d.ts.map +1 -0
- package/dist/blocks/site-header/site-header.js +46 -0
- package/dist/blocks/stack-grid-01/index.d.ts +3 -0
- package/dist/blocks/stack-grid-01/index.d.ts.map +1 -0
- package/dist/blocks/stack-grid-01/index.js +1 -0
- package/dist/blocks/stack-grid-01/stack-grid.d.ts +118 -0
- package/dist/blocks/stack-grid-01/stack-grid.d.ts.map +1 -0
- package/dist/blocks/stack-grid-01/stack-grid.js +49 -0
- package/dist/blocks/status-ledger-01/index.d.ts +3 -0
- package/dist/blocks/status-ledger-01/index.d.ts.map +1 -0
- package/dist/blocks/status-ledger-01/index.js +1 -0
- package/dist/blocks/status-ledger-01/status-ledger.d.ts +131 -0
- package/dist/blocks/status-ledger-01/status-ledger.d.ts.map +1 -0
- package/dist/blocks/status-ledger-01/status-ledger.js +80 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +180 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +6 -0
- package/dist/components/ui/card.d.ts +25 -0
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +25 -0
- package/dist/components/ui/cta-link.d.ts +45 -0
- package/dist/components/ui/cta-link.d.ts.map +1 -0
- package/dist/components/ui/cta-link.js +81 -0
- package/dist/components/ui/diagram.d.ts +154 -0
- package/dist/components/ui/diagram.d.ts.map +1 -0
- package/dist/components/ui/diagram.js +150 -0
- package/dist/components/ui/fact-list.d.ts +90 -0
- package/dist/components/ui/fact-list.d.ts.map +1 -0
- package/dist/components/ui/fact-list.js +38 -0
- package/dist/components/ui/product-mark.d.ts +115 -0
- package/dist/components/ui/product-mark.d.ts.map +1 -0
- package/dist/components/ui/product-mark.js +82 -0
- package/dist/components/ui/product-switcher.d.ts +108 -0
- package/dist/components/ui/product-switcher.d.ts.map +1 -0
- package/dist/components/ui/product-switcher.js +47 -0
- package/dist/components/ui/prose.d.ts +88 -0
- package/dist/components/ui/prose.d.ts.map +1 -0
- package/dist/components/ui/prose.js +53 -0
- package/dist/components/ui/section.d.ts +24 -1
- package/dist/components/ui/section.d.ts.map +1 -1
- package/dist/components/ui/section.js +11 -2
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/slider.js +7 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -0
- package/dist/pages/blog-post-page/index.d.ts +174 -0
- package/dist/pages/blog-post-page/index.d.ts.map +1 -0
- package/dist/pages/blog-post-page/index.js +49 -0
- package/dist/pages/docs-shell/docs-shell.d.ts +250 -0
- package/dist/pages/docs-shell/docs-shell.d.ts.map +1 -0
- package/dist/pages/docs-shell/docs-shell.js +197 -0
- package/dist/pages/docs-shell/index.d.ts +3 -0
- package/dist/pages/docs-shell/index.d.ts.map +1 -0
- package/dist/pages/docs-shell/index.js +1 -0
- package/dist/pages/index.d.ts +13 -2
- package/dist/pages/index.d.ts.map +1 -1
- package/dist/pages/index.js +10 -2
- package/dist/pages/not-found-page/index.d.ts +112 -0
- package/dist/pages/not-found-page/index.d.ts.map +1 -0
- package/dist/pages/not-found-page/index.js +46 -0
- package/dist/provider/provider.d.ts +5 -0
- package/dist/provider/provider.d.ts.map +1 -1
- package/dist/provider/provider.js +129 -38
- package/dist/provider/theme-script.d.ts +41 -3
- package/dist/provider/theme-script.d.ts.map +1 -1
- package/dist/provider/theme-script.js +68 -17
- package/dist/styles.css +555 -12
- package/dist/theming/index.d.ts +132 -2
- package/dist/theming/index.d.ts.map +1 -1
- package/dist/theming/index.js +127 -1
- package/package.json +14 -4
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* One tag on a post, or one step in the trail to the next one.
|
|
4
|
+
*
|
|
5
|
+
* `href` is optional and a tag without one renders as text. A tag that goes
|
|
6
|
+
* somewhere is a link, a tag that does not is a word, and a post's tags are
|
|
7
|
+
* usually the words.
|
|
8
|
+
*/
|
|
9
|
+
export type BlogPostTag = {
|
|
10
|
+
/** The word on the tag. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Where the tag goes, for a tag that filters an archive. */
|
|
13
|
+
href?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* One neighbour of this post: the title and where it is.
|
|
17
|
+
*
|
|
18
|
+
* `title` and `href` are both required. A next post with no title is an arrow
|
|
19
|
+
* with a destination and no promise about what is at the other end, which is the
|
|
20
|
+
* one thing a reader deciding whether to click cannot afford.
|
|
21
|
+
*/
|
|
22
|
+
export type BlogPostNeighbour = {
|
|
23
|
+
/** The post's title. */
|
|
24
|
+
title: string;
|
|
25
|
+
/** Where the post is. */
|
|
26
|
+
href: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The two words the trail renders above the neighbouring posts' titles.
|
|
30
|
+
*
|
|
31
|
+
* Both are required, and both are the caller's: "Previous" and "Next" are this
|
|
32
|
+
* Page's own phrasing, a site that files posts newest-last says the opposite pair,
|
|
33
|
+
* and a Page that ships no copy ships no reader-facing copy either.
|
|
34
|
+
*/
|
|
35
|
+
export type BlogPostTrailLabels = {
|
|
36
|
+
/** The word above the previous post's title. */
|
|
37
|
+
previous: string;
|
|
38
|
+
/** The word above the next post's title. */
|
|
39
|
+
next: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The props a BlogPostPage takes.
|
|
43
|
+
*
|
|
44
|
+
* The post's own text is `children`, because a post's body is authored wherever it
|
|
45
|
+
* is authored - a Markdown file, a CMS, a headless store - and Prism owns the
|
|
46
|
+
* measure and the rhythm around it, not the words. Everything that is a *fact*
|
|
47
|
+
* about the post rather than its text is a prop: the title, the standfirst, the
|
|
48
|
+
* date, the tags and the neighbours.
|
|
49
|
+
*/
|
|
50
|
+
export type BlogPostPageProps = {
|
|
51
|
+
/**
|
|
52
|
+
* The post's title. It is the page's `h1`, so the page has exactly one and it
|
|
53
|
+
* is the post's name.
|
|
54
|
+
*/
|
|
55
|
+
title: string;
|
|
56
|
+
/**
|
|
57
|
+
* The standfirst: one or two sentences under the title that say what the post
|
|
58
|
+
* is about. It is a prop rather than the first paragraph of the body because a
|
|
59
|
+
* reader deciding whether to read needs it before the body starts, and because
|
|
60
|
+
* it is what an index, a feed and a search result show.
|
|
61
|
+
*/
|
|
62
|
+
description?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The publication date, already formatted for display, and the machine value
|
|
65
|
+
* for the `time` element's `dateTime`. Both are props, and the machine one is
|
|
66
|
+
* required: `dateTime` is what a reader's browser, a feed reader and a search
|
|
67
|
+
* engine use to order posts, and a formatted string is none of those.
|
|
68
|
+
*/
|
|
69
|
+
date: string;
|
|
70
|
+
/**
|
|
71
|
+
* The date in a machine-readable form, `YYYY-MM-DD`, carried on the `time`
|
|
72
|
+
* element. Required, and deliberately not derived from `date`: parsing a
|
|
73
|
+
* formatted date back into an ISO one is a guess about a locale, and a guess
|
|
74
|
+
* in a `datetime` attribute is a wrong date in a feed.
|
|
75
|
+
*/
|
|
76
|
+
dateTime: string;
|
|
77
|
+
/** Who wrote the post. A name, or a link to an author page. */
|
|
78
|
+
author?: ReactNode;
|
|
79
|
+
/**
|
|
80
|
+
* The tags on the post, in the order a reader should meet them. Omit them for a
|
|
81
|
+
* post with none: an empty row of badges is a row of nothing.
|
|
82
|
+
*/
|
|
83
|
+
tags?: readonly BlogPostTag[];
|
|
84
|
+
/** How long the post takes to read, in the consumer's own words. */
|
|
85
|
+
readingTime?: string;
|
|
86
|
+
/**
|
|
87
|
+
* The post's body. Any flow content: paragraphs, headings, lists, code, images,
|
|
88
|
+
* tables. `Prose` holds it to the reading measure and to the block rhythm.
|
|
89
|
+
*/
|
|
90
|
+
children: ReactNode;
|
|
91
|
+
/**
|
|
92
|
+
* The post before this one and the post after it, for the trail at the foot of
|
|
93
|
+
* the page. Omit the half there is no neighbour for; a "previous" link with no
|
|
94
|
+
* previous post is a link to nothing.
|
|
95
|
+
*/
|
|
96
|
+
previous?: BlogPostNeighbour;
|
|
97
|
+
next?: BlogPostNeighbour;
|
|
98
|
+
/**
|
|
99
|
+
* The two words the trail renders above the neighbouring posts' titles. Required
|
|
100
|
+
* whenever either neighbour is passed, because they are words a reader reads and
|
|
101
|
+
* a Page that ships no copy ships no reader-facing copy either.
|
|
102
|
+
*/
|
|
103
|
+
trailLabels: BlogPostTrailLabels;
|
|
104
|
+
/**
|
|
105
|
+
* The accessible name of the trail between the neighbouring posts. It is
|
|
106
|
+
* required whenever either neighbour is passed, because it is a word a reader
|
|
107
|
+
* hears and a Page that ships no copy ships no reader-facing copy either. "More
|
|
108
|
+
* posts" is the Page's own phrasing and a site that files posts by release calls
|
|
109
|
+
* the same landmark something else.
|
|
110
|
+
*/
|
|
111
|
+
trailLabel: string;
|
|
112
|
+
/**
|
|
113
|
+
* The way back to the archive the post is filed in, rendered as one call to
|
|
114
|
+
* action under the trail. A prop rather than a hardcoded "back to the index",
|
|
115
|
+
* because the words and the route belong to the site that publishes the post
|
|
116
|
+
* and a Page that held either would be a Page making a claim about a consumer's
|
|
117
|
+
* own site.
|
|
118
|
+
*/
|
|
119
|
+
indexLink?: BlogPostNeighbour;
|
|
120
|
+
/**
|
|
121
|
+
* A slot for what comes after the trail: a related-posts grid, a newsletter
|
|
122
|
+
* form, a call to action. A slot rather than a prop because every one of those
|
|
123
|
+
* is a Block, and a Page that took a Block per prop would be a Page whose
|
|
124
|
+
* interface lists the whole catalogue.
|
|
125
|
+
*/
|
|
126
|
+
footer?: ReactNode;
|
|
127
|
+
/**
|
|
128
|
+
* Layout only, exactly as on every Component. Changing a Prism-owned visual
|
|
129
|
+
* property from here is prohibited.
|
|
130
|
+
*/
|
|
131
|
+
className?: string;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* A complete blog post screen: the title, the standfirst, the byline, the body at
|
|
135
|
+
* the measure, and the trail to the neighbouring posts.
|
|
136
|
+
*
|
|
137
|
+
* All four NaniSoft sites publish a blog, each with four posts and the same
|
|
138
|
+
* frontmatter: a title, a description, a date and a list of tags. Each one then
|
|
139
|
+
* rendered that frontmatter in its own component, with its own wrapper, its own
|
|
140
|
+
* measure and its own treatment of the date, and each of them wrote the trail to
|
|
141
|
+
* the neighbouring posts separately or not at all.
|
|
142
|
+
*
|
|
143
|
+
* It is a Page rather than a Block because it is a whole screen and it is the
|
|
144
|
+
* screen a content pipeline targets: a route that reads one document and hands
|
|
145
|
+
* its frontmatter to this Page. The Page is what makes the frontmatter a
|
|
146
|
+
* contract, because a field that is not a prop is a field nothing checks.
|
|
147
|
+
*
|
|
148
|
+
* **The date is two props.** `date` is the words a reader sees and `dateTime` is
|
|
149
|
+
* the machine value on the `time` element, and they are kept apart because
|
|
150
|
+
* parsing a formatted date back into an ISO one is a guess about a locale. A
|
|
151
|
+
* wrong date in a `datetime` attribute is a wrong date in a feed reader and in a
|
|
152
|
+
* search result, and neither reader can see the string that was wrong. This is
|
|
153
|
+
* the arrangement every one of the four sites needs and none of them has, because
|
|
154
|
+
* each of them formats its date in one place and has nowhere else to put the ISO
|
|
155
|
+
* value.
|
|
156
|
+
*
|
|
157
|
+
* The body is `children` and it is held by `Prose`, not by a set of per-element
|
|
158
|
+
* props. A post's body is authored somewhere else - a Markdown pipeline, a CMS -
|
|
159
|
+
* and a Page that took `paragraphs` and `headings` as arrays would be a Page that
|
|
160
|
+
* had to be handed a parsed document, which is a second representation of
|
|
161
|
+
* something the consumer's own pipeline already owns.
|
|
162
|
+
*
|
|
163
|
+
* The trail is one `nav` with two links, and it renders only the halves it is
|
|
164
|
+
* given. A previous link on the oldest post is a link to the first post a reader
|
|
165
|
+
* has already read, and a next link on the newest is a promise the site cannot
|
|
166
|
+
* keep.
|
|
167
|
+
*
|
|
168
|
+
* It is a server Component. It fetches nothing, it holds no state and it imports
|
|
169
|
+
* no router, so a consumer renders it from a server route and hands it the
|
|
170
|
+
* document their pipeline produced.
|
|
171
|
+
*/
|
|
172
|
+
export declare function BlogPostPage({ title, description, date, dateTime, author, tags, readingTime, children, previous, next, trailLabels, trailLabel, indexLink, footer, className, }: BlogPostPageProps): import("react").JSX.Element;
|
|
173
|
+
export default BlogPostPage;
|
|
174
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/blog-post-page/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;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E,MAAM,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,EACN,SAAS,GACV,EAAE,iBAAiB,+BAgFnB;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from '../../components/ui/badge';
|
|
3
|
+
import { CtaLink } from '../../components/ui/cta-link';
|
|
4
|
+
import { Heading, Text } from '../../components/ui/typography';
|
|
5
|
+
import { Prose } from '../../components/ui/prose';
|
|
6
|
+
import { Section } from '../../components/ui/section';
|
|
7
|
+
/**
|
|
8
|
+
* A complete blog post screen: the title, the standfirst, the byline, the body at
|
|
9
|
+
* the measure, and the trail to the neighbouring posts.
|
|
10
|
+
*
|
|
11
|
+
* All four NaniSoft sites publish a blog, each with four posts and the same
|
|
12
|
+
* frontmatter: a title, a description, a date and a list of tags. Each one then
|
|
13
|
+
* rendered that frontmatter in its own component, with its own wrapper, its own
|
|
14
|
+
* measure and its own treatment of the date, and each of them wrote the trail to
|
|
15
|
+
* the neighbouring posts separately or not at all.
|
|
16
|
+
*
|
|
17
|
+
* It is a Page rather than a Block because it is a whole screen and it is the
|
|
18
|
+
* screen a content pipeline targets: a route that reads one document and hands
|
|
19
|
+
* its frontmatter to this Page. The Page is what makes the frontmatter a
|
|
20
|
+
* contract, because a field that is not a prop is a field nothing checks.
|
|
21
|
+
*
|
|
22
|
+
* **The date is two props.** `date` is the words a reader sees and `dateTime` is
|
|
23
|
+
* the machine value on the `time` element, and they are kept apart because
|
|
24
|
+
* parsing a formatted date back into an ISO one is a guess about a locale. A
|
|
25
|
+
* wrong date in a `datetime` attribute is a wrong date in a feed reader and in a
|
|
26
|
+
* search result, and neither reader can see the string that was wrong. This is
|
|
27
|
+
* the arrangement every one of the four sites needs and none of them has, because
|
|
28
|
+
* each of them formats its date in one place and has nowhere else to put the ISO
|
|
29
|
+
* value.
|
|
30
|
+
*
|
|
31
|
+
* The body is `children` and it is held by `Prose`, not by a set of per-element
|
|
32
|
+
* props. A post's body is authored somewhere else - a Markdown pipeline, a CMS -
|
|
33
|
+
* and a Page that took `paragraphs` and `headings` as arrays would be a Page that
|
|
34
|
+
* had to be handed a parsed document, which is a second representation of
|
|
35
|
+
* something the consumer's own pipeline already owns.
|
|
36
|
+
*
|
|
37
|
+
* The trail is one `nav` with two links, and it renders only the halves it is
|
|
38
|
+
* given. A previous link on the oldest post is a link to the first post a reader
|
|
39
|
+
* has already read, and a next link on the newest is a promise the site cannot
|
|
40
|
+
* keep.
|
|
41
|
+
*
|
|
42
|
+
* It is a server Component. It fetches nothing, it holds no state and it imports
|
|
43
|
+
* no router, so a consumer renders it from a server route and hands it the
|
|
44
|
+
* document their pipeline produced.
|
|
45
|
+
*/
|
|
46
|
+
export function BlogPostPage({ title, description, date, dateTime, author, tags, readingTime, children, previous, next, trailLabels, trailLabel, indexLink, footer, className, }) {
|
|
47
|
+
return (_jsxs(Section, { className: className, children: [_jsxs("article", { "data-slot": "blog-post", className: "flex flex-col gap-8", children: [_jsxs("header", { className: "flex flex-col gap-4", children: [_jsx(Heading, { as: "h1", size: "3xl", children: title }), description ? (_jsx(Text, { size: "lg", className: "text-muted-foreground max-w-measure", children: description })) : null, _jsxs("div", { className: "text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-2 text-sm", children: [author ? _jsx("span", { className: "text-foreground font-medium", children: author }) : null, _jsx("time", { dateTime: dateTime, children: date }), readingTime ? _jsx("span", { children: readingTime }) : null] }), tags && tags.length > 0 ? (_jsx("ul", { className: "flex flex-wrap items-center gap-2", children: tags.map((tag) => (_jsx("li", { children: tag.href ? (_jsx("a", { href: tag.href, className: "rounded-sm", "aria-label": `Posts tagged ${tag.label}`, children: _jsx(Badge, { variant: "secondary", children: tag.label }) })) : (_jsx(Badge, { variant: "secondary", children: tag.label })) }, tag.label))) })) : null] }), _jsx(Prose, { children: children }), previous || next ? (_jsxs("nav", { "aria-label": trailLabel, className: "border-border grid gap-4 border-t pt-6 sm:grid-cols-2", children: [previous ? (_jsxs("a", { href: previous.href, className: "flex flex-col gap-1 rounded-sm", children: [_jsx("span", { className: "text-muted-foreground text-xs font-medium tracking-wide uppercase", children: trailLabels.previous }), _jsx("span", { className: "text-sm font-semibold", children: previous.title })] })) : null, next ? (_jsxs("a", { href: next.href, className: "flex flex-col gap-1 rounded-sm sm:items-end sm:text-right", children: [_jsx("span", { className: "text-muted-foreground text-xs font-medium tracking-wide uppercase", children: trailLabels.next }), _jsx("span", { className: "text-sm font-semibold", children: next.title })] })) : null] })) : null, footer ? _jsx("div", { className: "border-border border-t pt-8", children: footer }) : null] }), indexLink ? (_jsx("div", { className: "mt-10 flex justify-center", children: _jsx(CtaLink, { href: indexLink.href, variant: "outline", children: indexLink.title }) })) : null] }));
|
|
48
|
+
}
|
|
49
|
+
export default BlogPostPage;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* One page in a documentation tree: a title and the address it is read at.
|
|
4
|
+
*
|
|
5
|
+
* `href` is required. A page in the navigation that goes nowhere is an entry a
|
|
6
|
+
* reader can focus and not follow, and the Page renders every page entry as a
|
|
7
|
+
* native anchor so a reader can see where a destination is before taking it.
|
|
8
|
+
*/
|
|
9
|
+
export type DocsNavPage = {
|
|
10
|
+
type: 'page';
|
|
11
|
+
/** The words the reader meets. */
|
|
12
|
+
title: string;
|
|
13
|
+
/** The address the page is read at. */
|
|
14
|
+
href: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* One group in a documentation tree: a label and the pages under it, at any
|
|
18
|
+
* depth.
|
|
19
|
+
*
|
|
20
|
+
* `href` is the group's own index page, and it is optional on purpose. A group
|
|
21
|
+
* with no index is a place in the tree and not a route, so the Page renders it
|
|
22
|
+
* as a label: no anchor, no `href`, nothing focusable. Inventing a route for it
|
|
23
|
+
* would publish an address that resolves to nothing, and rendering an anchor
|
|
24
|
+
* with no `href` would publish a destination a reader can reach and cannot
|
|
25
|
+
* follow. AlphaLens already uses the absent case to mean exactly this, in every
|
|
26
|
+
* section whose folder holds no `index.mdx`, and Atlas and Nexus style those
|
|
27
|
+
* entries out of their own stylesheets with a rule that has now become dead.
|
|
28
|
+
*
|
|
29
|
+
* `items` is required, because a group that renders a label and holds nothing
|
|
30
|
+
* is an empty rail entry rather than a group. Pass a page with no children
|
|
31
|
+
* rather than a group with none.
|
|
32
|
+
*/
|
|
33
|
+
export type DocsNavGroup = {
|
|
34
|
+
type: 'group';
|
|
35
|
+
/** The words on the label. A status inside them stays inside them. */
|
|
36
|
+
title: string;
|
|
37
|
+
/**
|
|
38
|
+
* The group's own index page, where it has one. Omit it for a group that is
|
|
39
|
+
* only a heading over its pages.
|
|
40
|
+
*/
|
|
41
|
+
href?: string;
|
|
42
|
+
/** The pages under this group, in the order a reader should meet them. */
|
|
43
|
+
items: readonly DocsNavEntry[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A rule between entries, carrying a name that is usually empty.
|
|
47
|
+
*
|
|
48
|
+
* It is a label and never a link. The alternative spelling, a page entry with an
|
|
49
|
+
* empty `href`, was what two of the three consumer sites shipped and had to
|
|
50
|
+
* restyle in their own stylesheets, because an anchor with no destination is a
|
|
51
|
+
* control that cannot be operated.
|
|
52
|
+
*/
|
|
53
|
+
export type DocsNavDivider = {
|
|
54
|
+
type: 'divider';
|
|
55
|
+
/** The words on the rule, which may be the empty string. */
|
|
56
|
+
title: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* One entry in a documentation tree, of any of the three kinds.
|
|
60
|
+
*
|
|
61
|
+
* The union is closed, and it is a union rather than one shape with optional
|
|
62
|
+
* fields because a reader meets three different things in a rail: a destination,
|
|
63
|
+
* a label over a list, and a rule. A single shape would make all three look
|
|
64
|
+
* alike, and "a place that is a heading, not a link" is the distinction the whole
|
|
65
|
+
* arrangement turns on.
|
|
66
|
+
*/
|
|
67
|
+
export type DocsNavEntry = DocsNavPage | DocsNavGroup | DocsNavDivider;
|
|
68
|
+
/**
|
|
69
|
+
* The two words the pager renders above the neighbouring pages' titles.
|
|
70
|
+
*
|
|
71
|
+
* Both are required, and both are the caller's: "Previous" and "Next" are this
|
|
72
|
+
* Page's own phrasing, a site that files its pages in the other direction says
|
|
73
|
+
* the opposite pair, and a Page that ships no copy ships no reader-facing copy
|
|
74
|
+
* either.
|
|
75
|
+
*/
|
|
76
|
+
export type DocsPagerLabels = {
|
|
77
|
+
/** The word above the previous page's title. */
|
|
78
|
+
previous: string;
|
|
79
|
+
/** The word above the next page's title. */
|
|
80
|
+
next: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The props a DocsShell takes.
|
|
84
|
+
*
|
|
85
|
+
* The navigation is data and the frame is the consumer's. Three sites publish
|
|
86
|
+
* full documentation sets and each of them has a different shape: Nexus files
|
|
87
|
+
* six sections of five pages, Atlas files four of which one holds nine pages
|
|
88
|
+
* under a single heading, and AlphaLens files six sections separated by rules
|
|
89
|
+
* and named for subject matter rather than for a documentation genre. The shape
|
|
90
|
+
* arrives in `nav` and the Page renders it, so none of the three had to be told
|
|
91
|
+
* which of the others it looks like.
|
|
92
|
+
*
|
|
93
|
+
* The document's own body is `children`, because a document is authored wherever
|
|
94
|
+
* it is authored, a Markdown pipeline or a CMS, and Prism owns the measure and
|
|
95
|
+
* the rhythm around the words rather than the words.
|
|
96
|
+
*/
|
|
97
|
+
export type DocsShellProps = {
|
|
98
|
+
/**
|
|
99
|
+
* The page's title, and the document's `h1`.
|
|
100
|
+
*
|
|
101
|
+
* It is optional because the three consumer sites do not agree about whether a
|
|
102
|
+
* documentation page has one: two render the frontmatter title as the page
|
|
103
|
+
* heading, and one lets the document's own Markdown own it. When it is absent
|
|
104
|
+
* the Page renders no heading at all rather than an empty one, so the document
|
|
105
|
+
* keeps exactly the outline its own content declares.
|
|
106
|
+
*/
|
|
107
|
+
title?: string;
|
|
108
|
+
/**
|
|
109
|
+
* One or two sentences under the title: what this part of the documentation
|
|
110
|
+
* covers. A `ReactNode` because a site that files a page for a pipeline states
|
|
111
|
+
* the pipeline's stage as markup rather than as a sentence.
|
|
112
|
+
*/
|
|
113
|
+
description?: ReactNode;
|
|
114
|
+
/**
|
|
115
|
+
* The documentation tree, in the order a reader should meet it. The whole
|
|
116
|
+
* shape arrives here, so the Page holds no opinion about how many sections a
|
|
117
|
+
* site has, how deep they nest, or what a section is called.
|
|
118
|
+
*/
|
|
119
|
+
nav?: readonly DocsNavEntry[];
|
|
120
|
+
/**
|
|
121
|
+
* The headings inside this page, in document order, for the contents rail.
|
|
122
|
+
*
|
|
123
|
+
* It is the consumer's document that knows its own outline, because Prism does
|
|
124
|
+
* not parse Markdown and a Page that guessed at it would guess wrong on every
|
|
125
|
+
* document rather than on some. Pass the whole outline or none: a partial one
|
|
126
|
+
* is a contents list that lies about the page.
|
|
127
|
+
*/
|
|
128
|
+
toc?: readonly DocsNavEntry[];
|
|
129
|
+
/**
|
|
130
|
+
* The address of the page being rendered. The rail marks it with
|
|
131
|
+
* `aria-current="page"` and the pager derives its two neighbours from it, so
|
|
132
|
+
* the same navigation renders a different pager for every page without the
|
|
133
|
+
* caller deriving anything.
|
|
134
|
+
*/
|
|
135
|
+
currentHref?: string;
|
|
136
|
+
/**
|
|
137
|
+
* The accessible name of the rail. Required whenever `nav` is passed, because
|
|
138
|
+
* it is a word a reader hears and a Page that ships no copy ships no
|
|
139
|
+
* reader-facing copy either.
|
|
140
|
+
*/
|
|
141
|
+
navLabel: string;
|
|
142
|
+
/**
|
|
143
|
+
* The accessible name of the contents rail. Required whenever `toc` is passed,
|
|
144
|
+
* for the same reason `navLabel` is.
|
|
145
|
+
*/
|
|
146
|
+
tocLabel: string;
|
|
147
|
+
/**
|
|
148
|
+
* The accessible name of the pager. Required whenever there is a neighbour to
|
|
149
|
+
* reach, for the same reason `navLabel` is.
|
|
150
|
+
*/
|
|
151
|
+
pagerLabel: string;
|
|
152
|
+
/**
|
|
153
|
+
* The two words the pager renders above the neighbouring pages' titles.
|
|
154
|
+
* Required whenever either neighbour exists, for the same reason `navLabel`
|
|
155
|
+
* is.
|
|
156
|
+
*/
|
|
157
|
+
pagerLabels: DocsPagerLabels;
|
|
158
|
+
/**
|
|
159
|
+
* The document's own body. Any flow content: paragraphs, headings, lists,
|
|
160
|
+
* code, images, tables. `Prose` holds it to the reading measure and to the
|
|
161
|
+
* block rhythm, and it is passed `fullWidth` so the document fills the column
|
|
162
|
+
* the frame gives it rather than sitting in a second measure inside one.
|
|
163
|
+
*/
|
|
164
|
+
children: ReactNode;
|
|
165
|
+
/**
|
|
166
|
+
* A slot above the frame, inside the container: a breadcrumb trail, a version
|
|
167
|
+
* picker, a search field. A slot rather than a prop because each of those is a
|
|
168
|
+
* Block, and a Page that took one per prop would be a Page whose interface
|
|
169
|
+
* lists the whole catalogue.
|
|
170
|
+
*/
|
|
171
|
+
header?: ReactNode;
|
|
172
|
+
/**
|
|
173
|
+
* A slot below the frame, inside the container: a feedback prompt, a link back
|
|
174
|
+
* to the section index, a support address.
|
|
175
|
+
*/
|
|
176
|
+
footer?: ReactNode;
|
|
177
|
+
/**
|
|
178
|
+
* Layout only, exactly as on every Component. Changing a Prism-owned visual
|
|
179
|
+
* property from here is prohibited.
|
|
180
|
+
*/
|
|
181
|
+
className?: string;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* A documentation screen: a navigation rail, the document, a contents rail and
|
|
185
|
+
* the pager to the neighbouring pages.
|
|
186
|
+
*
|
|
187
|
+
* **This is the Page the other three NaniSoft sites import, and the name is
|
|
188
|
+
* theirs.** All three already read `import { DocsShell, type DocsNavEntry }
|
|
189
|
+
* from '@nanisoft/prism-ui/pages'` in their own document template, and all three
|
|
190
|
+
* map their page tree into that shape in their own `lib/to-prism-tree`. A
|
|
191
|
+
* published name cannot be cheaply changed and there is no redirect lane for item
|
|
192
|
+
* routes, so the name follows the three import lines rather than this file's
|
|
193
|
+
* shape. It was `docs-shell` in the retired line, where it was an empty
|
|
194
|
+
* `div` plus a class name that each site then had to style from scratch, and it
|
|
195
|
+
* is `docs-shell` here because that is what the three call sites already say.
|
|
196
|
+
*
|
|
197
|
+
* **A section is a label, not a control.** It carries no status, no badge, no
|
|
198
|
+
* count, no collapse and no sort, and that is the whole of its interface. The
|
|
199
|
+
* reason is specific: AlphaLens files its documentation as a pipeline, where
|
|
200
|
+
* "Unified data contract (approved)" is a stage of the work and not a topic a
|
|
201
|
+
* reader may visit in any order, and every structural affordance says the
|
|
202
|
+
* opposite. A status in the title is part of the title and stays there as words:
|
|
203
|
+
* the Page reads no parentheses, matches no vocabulary, and renders no pill
|
|
204
|
+
* beside a heading that has one. A tree is data, and a Page that parsed a
|
|
205
|
+
* consumer's data would be a Page that had opinions about it.
|
|
206
|
+
*
|
|
207
|
+
* **A group with no index is a label rather than a route.** `href` is optional
|
|
208
|
+
* on `DocsNavGroup` for exactly that, and the absence means the label. The three
|
|
209
|
+
* consumer sites all write `url: node.index?.url ?? ''` in their own adapter
|
|
210
|
+
* today, which is the same fact spelled as an empty string, and two of the three
|
|
211
|
+
* then carry a stylesheet rule that styles the resulting anchor-with-no-href
|
|
212
|
+
* back into a label. Naming the case in the type makes those two rules dead
|
|
213
|
+
* rather than load-bearing, and the type is the only place that had to change.
|
|
214
|
+
*
|
|
215
|
+
* **The pager is derived from the navigation rather than passed.** The rail
|
|
216
|
+
* already knows every page and the order a reader meets them in, and deriving the
|
|
217
|
+
* two neighbours from that plus `currentHref` removes one derivation from each
|
|
218
|
+
* of the three sites. It is derived rather than passed for a second reason: a
|
|
219
|
+
* caller who passes neighbours can pass a neighbour that is not in the tree, and
|
|
220
|
+
* this is the one arrangement where a reader would notice.
|
|
221
|
+
*
|
|
222
|
+
* **The consumer supplies two orders and the Page imposes neither.** `nav` is in
|
|
223
|
+
* the order the rail shows, and `toc` is in the order the contents rail shows.
|
|
224
|
+
* Both are read as given: nothing is sorted, deduplicated or alphabetised, and a
|
|
225
|
+
* tree whose sections are named for subject matter reads in the order its
|
|
226
|
+
* author filed it. A Page that sorted its rail would flatten the one thing the
|
|
227
|
+
* three sites disagree about and cannot both be right about.
|
|
228
|
+
*
|
|
229
|
+
* **The rail is bounded in height.** Atlas files nineteen pages and AlphaLens
|
|
230
|
+
* files twenty-seven, so the taller tree is half again as long, and an unbounded
|
|
231
|
+
* rail on a tall tree is a rail that pushes the document below the fold before
|
|
232
|
+
* the reader has read a line of it. The rail and the contents rail are each
|
|
233
|
+
* capped against the viewport and scroll inside it, so a nineteen-page tree and a
|
|
234
|
+
* twenty-seven-page tree are both a full screen and neither is a page-long
|
|
235
|
+
* sidebar.
|
|
236
|
+
*
|
|
237
|
+
* It is a Page rather than a Block because it is a whole screen and it is the
|
|
238
|
+
* screen a content pipeline targets: a route that reads one document and hands
|
|
239
|
+
* it the page tree, the outline and the current address. A Block would be the
|
|
240
|
+
* rail, and the rail's job is not separable from the screen's, because the
|
|
241
|
+
* arrangement of rail, document, contents and pager is what the three sites each
|
|
242
|
+
* wrote separately and are here written once.
|
|
243
|
+
*
|
|
244
|
+
* It is a server Component. It fetches nothing, it holds no state and it imports
|
|
245
|
+
* no router, so a consumer renders it from whichever route their framework names
|
|
246
|
+
* and hands it the document their pipeline produced.
|
|
247
|
+
*/
|
|
248
|
+
export declare function DocsShell({ title, description, nav, toc, currentHref, navLabel, tocLabel, pagerLabel, pagerLabels, header, footer, className, children, }: DocsShellProps): import("react").JSX.Element;
|
|
249
|
+
export default DocsShell;
|
|
250
|
+
//# sourceMappingURL=docs-shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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