shelving 1.236.2 → 1.237.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 (219) hide show
  1. package/extract/IndexExtractor.js +9 -2
  2. package/extract/MergingExtractor.d.ts +3 -1
  3. package/extract/MergingExtractor.js +41 -3
  4. package/extract/TypescriptExtractor.d.ts +1 -0
  5. package/extract/TypescriptExtractor.js +12 -2
  6. package/package.json +1 -1
  7. package/ui/README.md +19 -274
  8. package/ui/app/App.d.ts +1 -0
  9. package/ui/app/App.js +1 -0
  10. package/ui/app/App.md +58 -0
  11. package/ui/app/App.tsx +1 -0
  12. package/ui/block/Card.d.ts +1 -0
  13. package/ui/block/Card.js +1 -0
  14. package/ui/block/Card.md +85 -0
  15. package/ui/block/Card.tsx +1 -0
  16. package/ui/block/Heading.d.ts +1 -0
  17. package/ui/block/Heading.js +1 -0
  18. package/ui/block/Heading.md +70 -0
  19. package/ui/block/Heading.tsx +1 -0
  20. package/ui/block/List.d.ts +1 -0
  21. package/ui/block/List.js +1 -0
  22. package/ui/block/List.md +51 -0
  23. package/ui/block/List.tsx +1 -0
  24. package/ui/block/Panel.d.ts +1 -0
  25. package/ui/block/Panel.js +1 -0
  26. package/ui/block/Panel.md +50 -0
  27. package/ui/block/Panel.tsx +1 -0
  28. package/ui/block/Paragraph.d.ts +1 -0
  29. package/ui/block/Paragraph.js +1 -0
  30. package/ui/block/Paragraph.md +48 -0
  31. package/ui/block/Paragraph.tsx +1 -0
  32. package/ui/block/Prose.d.ts +1 -0
  33. package/ui/block/Prose.js +1 -0
  34. package/ui/block/Prose.md +49 -0
  35. package/ui/block/Prose.tsx +1 -0
  36. package/ui/block/Section.d.ts +6 -0
  37. package/ui/block/Section.js +6 -0
  38. package/ui/block/Section.md +56 -0
  39. package/ui/block/Section.tsx +6 -0
  40. package/ui/block/Subheading.d.ts +1 -0
  41. package/ui/block/Subheading.js +1 -0
  42. package/ui/block/Subheading.md +58 -0
  43. package/ui/block/Subheading.tsx +1 -0
  44. package/ui/block/Table.d.ts +1 -0
  45. package/ui/block/Table.js +1 -0
  46. package/ui/block/Table.md +54 -0
  47. package/ui/block/Table.tsx +1 -0
  48. package/ui/block/Title.d.ts +1 -0
  49. package/ui/block/Title.js +1 -0
  50. package/ui/block/Title.md +57 -0
  51. package/ui/block/Title.tsx +1 -0
  52. package/ui/dialog/Dialog.d.ts +1 -0
  53. package/ui/dialog/Dialog.js +1 -0
  54. package/ui/dialog/Dialog.md +73 -0
  55. package/ui/dialog/Dialog.tsx +1 -0
  56. package/ui/dialog/Modal.d.ts +1 -0
  57. package/ui/dialog/Modal.js +1 -0
  58. package/ui/dialog/Modal.md +40 -0
  59. package/ui/dialog/Modal.tsx +1 -0
  60. package/ui/docs/DocumentationButtons.d.ts +2 -0
  61. package/ui/docs/DocumentationButtons.js +2 -0
  62. package/ui/docs/DocumentationButtons.md +38 -0
  63. package/ui/docs/DocumentationButtons.tsx +2 -0
  64. package/ui/docs/DocumentationCard.d.ts +1 -0
  65. package/ui/docs/DocumentationCard.js +1 -0
  66. package/ui/docs/DocumentationCard.md +35 -0
  67. package/ui/docs/DocumentationCard.tsx +1 -0
  68. package/ui/docs/DocumentationKind.d.ts +1 -1
  69. package/ui/docs/DocumentationKind.js +9 -4
  70. package/ui/docs/DocumentationKind.tsx +10 -5
  71. package/ui/docs/DocumentationPage.d.ts +1 -0
  72. package/ui/docs/DocumentationPage.js +2 -0
  73. package/ui/docs/DocumentationPage.md +46 -0
  74. package/ui/docs/DocumentationPage.tsx +2 -0
  75. package/ui/form/Button.d.ts +1 -0
  76. package/ui/form/Button.js +1 -0
  77. package/ui/form/Button.md +88 -0
  78. package/ui/form/Button.tsx +1 -0
  79. package/ui/form/Field.d.ts +6 -1
  80. package/ui/form/Field.js +6 -1
  81. package/ui/form/Field.md +59 -0
  82. package/ui/form/Field.tsx +6 -1
  83. package/ui/form/Form.d.ts +1 -0
  84. package/ui/form/Form.md +118 -0
  85. package/ui/form/Form.tsx +1 -0
  86. package/ui/form/FormStore.md +47 -0
  87. package/ui/form/SchemaInput.d.ts +1 -0
  88. package/ui/form/SchemaInput.md +64 -0
  89. package/ui/form/SchemaInput.tsx +1 -0
  90. package/ui/inline/Code.d.ts +1 -0
  91. package/ui/inline/Code.js +1 -0
  92. package/ui/inline/Code.md +58 -0
  93. package/ui/inline/Code.tsx +1 -0
  94. package/ui/inline/Link.d.ts +1 -0
  95. package/ui/inline/Link.js +1 -0
  96. package/ui/inline/Link.md +47 -0
  97. package/ui/inline/Link.tsx +1 -0
  98. package/ui/inline/Mark.d.ts +1 -0
  99. package/ui/inline/Mark.js +1 -0
  100. package/ui/inline/Mark.md +40 -0
  101. package/ui/inline/Mark.tsx +1 -0
  102. package/ui/inline/Strong.d.ts +1 -0
  103. package/ui/inline/Strong.js +1 -0
  104. package/ui/inline/Strong.md +34 -0
  105. package/ui/inline/Strong.tsx +1 -0
  106. package/ui/layout/CenteredLayout.d.ts +1 -0
  107. package/ui/layout/CenteredLayout.js +1 -0
  108. package/ui/layout/CenteredLayout.md +38 -0
  109. package/ui/layout/CenteredLayout.tsx +1 -0
  110. package/ui/layout/SidebarLayout.d.ts +1 -0
  111. package/ui/layout/SidebarLayout.js +1 -0
  112. package/ui/layout/SidebarLayout.md +65 -0
  113. package/ui/layout/SidebarLayout.tsx +1 -0
  114. package/ui/menu/Menu.d.ts +2 -0
  115. package/ui/menu/Menu.js +2 -0
  116. package/ui/menu/Menu.md +51 -0
  117. package/ui/menu/Menu.tsx +2 -0
  118. package/ui/menu/MenuItem.md +54 -0
  119. package/ui/misc/Catcher.d.ts +1 -0
  120. package/ui/misc/Catcher.js +1 -0
  121. package/ui/misc/Catcher.md +41 -0
  122. package/ui/misc/Catcher.tsx +1 -0
  123. package/ui/misc/Loading.d.ts +1 -0
  124. package/ui/misc/Loading.js +1 -0
  125. package/ui/misc/Loading.md +28 -0
  126. package/ui/misc/Loading.tsx +1 -0
  127. package/ui/misc/Mapper.md +40 -0
  128. package/ui/misc/Markup.d.ts +1 -0
  129. package/ui/misc/Markup.js +1 -0
  130. package/ui/misc/Markup.md +34 -0
  131. package/ui/misc/Markup.tsx +1 -0
  132. package/ui/misc/StatusIcon.d.ts +1 -0
  133. package/ui/misc/StatusIcon.js +1 -0
  134. package/ui/misc/StatusIcon.md +25 -0
  135. package/ui/misc/StatusIcon.tsx +1 -0
  136. package/ui/misc/Tag.d.ts +1 -0
  137. package/ui/misc/Tag.js +1 -0
  138. package/ui/misc/Tag.md +47 -0
  139. package/ui/misc/Tag.tsx +1 -0
  140. package/ui/notice/Notice.d.ts +1 -0
  141. package/ui/notice/Notice.js +1 -0
  142. package/ui/notice/Notice.md +53 -0
  143. package/ui/notice/Notice.tsx +1 -0
  144. package/ui/notice/Notices.d.ts +1 -0
  145. package/ui/notice/Notices.js +1 -0
  146. package/ui/notice/Notices.md +59 -0
  147. package/ui/notice/Notices.tsx +1 -0
  148. package/ui/page/HTML.d.ts +1 -0
  149. package/ui/page/HTML.js +1 -0
  150. package/ui/page/HTML.md +36 -0
  151. package/ui/page/HTML.tsx +1 -0
  152. package/ui/page/Head.d.ts +1 -0
  153. package/ui/page/Head.js +1 -0
  154. package/ui/page/Head.md +26 -0
  155. package/ui/page/Head.tsx +1 -0
  156. package/ui/page/Page.d.ts +1 -0
  157. package/ui/page/Page.js +1 -0
  158. package/ui/page/Page.md +42 -0
  159. package/ui/page/Page.tsx +1 -0
  160. package/ui/router/Navigation.d.ts +1 -0
  161. package/ui/router/Navigation.js +1 -0
  162. package/ui/router/Navigation.md +41 -0
  163. package/ui/router/Navigation.tsx +1 -0
  164. package/ui/router/NavigationStore.md +34 -0
  165. package/ui/router/Router.d.ts +1 -0
  166. package/ui/router/Router.js +1 -0
  167. package/ui/router/Router.md +143 -0
  168. package/ui/router/Router.tsx +1 -0
  169. package/ui/style/TINT_CLASS.md +55 -0
  170. package/ui/transition/CollapseTransition.d.ts +1 -0
  171. package/ui/transition/CollapseTransition.js +1 -0
  172. package/ui/transition/CollapseTransition.md +34 -0
  173. package/ui/transition/CollapseTransition.tsx +1 -0
  174. package/ui/transition/FadeTransition.d.ts +1 -0
  175. package/ui/transition/FadeTransition.js +1 -0
  176. package/ui/transition/FadeTransition.md +36 -0
  177. package/ui/transition/FadeTransition.tsx +1 -0
  178. package/ui/transition/HorizontalTransition.d.ts +1 -0
  179. package/ui/transition/HorizontalTransition.js +1 -0
  180. package/ui/transition/HorizontalTransition.md +44 -0
  181. package/ui/transition/HorizontalTransition.tsx +1 -0
  182. package/ui/transition/Transition.d.ts +1 -0
  183. package/ui/transition/Transition.js +1 -0
  184. package/ui/transition/Transition.md +70 -0
  185. package/ui/transition/Transition.tsx +1 -0
  186. package/ui/transition/VerticalTransition.d.ts +1 -0
  187. package/ui/transition/VerticalTransition.js +1 -0
  188. package/ui/transition/VerticalTransition.md +34 -0
  189. package/ui/transition/VerticalTransition.tsx +1 -0
  190. package/ui/tree/TreeApp.d.ts +1 -0
  191. package/ui/tree/TreeApp.js +1 -0
  192. package/ui/tree/TreeApp.md +59 -0
  193. package/ui/tree/TreeApp.tsx +1 -0
  194. package/ui/tree/TreeMenu.d.ts +1 -0
  195. package/ui/tree/TreeMenu.js +1 -0
  196. package/ui/tree/TreeMenu.md +35 -0
  197. package/ui/tree/TreeMenu.tsx +1 -0
  198. package/ui/tree/TreeSidebar.d.ts +1 -0
  199. package/ui/tree/TreeSidebar.js +1 -0
  200. package/ui/tree/TreeSidebar.md +24 -0
  201. package/ui/tree/TreeSidebar.tsx +1 -0
  202. package/ui/util/getClass.md +55 -0
  203. package/ui/util/notify.md +50 -0
  204. package/ui/util/requireContext.md +24 -0
  205. package/ui/app/README.md +0 -32
  206. package/ui/block/README.md +0 -144
  207. package/ui/dialog/README.md +0 -80
  208. package/ui/docs/README.md +0 -71
  209. package/ui/form/README.md +0 -165
  210. package/ui/inline/README.md +0 -86
  211. package/ui/layout/README.md +0 -71
  212. package/ui/menu/README.md +0 -33
  213. package/ui/misc/README.md +0 -121
  214. package/ui/notice/README.md +0 -94
  215. package/ui/page/README.md +0 -56
  216. package/ui/router/README.md +0 -186
  217. package/ui/transition/README.md +0 -80
  218. package/ui/tree/README.md +0 -78
  219. package/ui/util/README.md +0 -153
@@ -1,144 +0,0 @@
1
- # Block content
2
-
3
- Block-level components for structuring page content. Every component here maps to a semantic HTML element and applies consistent spacing, typography, and layout from the design system's CSS modules.
4
-
5
- ## Concepts
6
-
7
- ### Semantic HTML, no custom markup
8
-
9
- Each component is a thin styled wrapper around a single HTML element: `<Card>` renders `<article>`, `<Section>` renders `<section>`, `<Table>` renders `<table>`, and so on. Pick the component whose HTML element fits the semantic meaning — do not reach for a `<Block>` when a `<Section>` or `<List>` is the right choice.
10
-
11
- [Section.tsx](./Section.tsx) exports all the standard landmark elements with the same props: `Section`, `Header`, `Footer`, `Nav`, `Aside`, and `Figure`. `<Panel>` is the odd one out — a full-width region that paints the current surface colour, used to break a page into stacked bands.
12
-
13
- ### Styling props
14
-
15
- Block components share the styling props defined in [ui/style](../style/) — see the [ui README](../README.md) for the full system. The ones you'll use most here:
16
-
17
- - `space="none"` … `space="xxlarge"` — block margin (top + bottom). Every block has a sensible default; first and last children collapse their outer margins automatically.
18
- - `color="red"`, `status="error"` — retint the component and everything nested inside it.
19
- - `size="large"`, `code`, `serif`, `center` — typography overrides.
20
- - `narrow` / `wide` / `full` — constrain or unconstrain content width within the parent.
21
- - `gap="small"` — item spacing on `<List>` and flex containers.
22
-
23
- ### `<Prose>` for longform text
24
-
25
- Wrap any block of mixed HTML content (paragraphs, lists, headings, code, tables) in `<Prose>` to apply cohesive longform typography in one step. All the inline and block component styles are applied as a compound class, so raw HTML elements produced by a markdown renderer just work.
26
-
27
- ### Compound components
28
-
29
- Some block components ship multiple pieces intended to compose:
30
-
31
- - `Figure` + `Caption` (a `<figure>` with its `<figcaption>`)
32
- - `Video` + `VideoButtons` + `VideoButton` + `FullscreenVideoButton`
33
- - `Definitions` (raw `<dt>` / `<dd>` term/value pairs inside a styled `<dl>`)
34
- - `Address`, `PhysicalAddress`, `EmailAddress`
35
-
36
- ## Canonical usage examples
37
-
38
- ### Content card with a heading
39
-
40
- ```tsx
41
- import { Card, Paragraph, Subheading } from "shelving/ui";
42
-
43
- <Card href="/products/42" title="Open product">
44
- <Subheading>Widget Pro</Subheading>
45
- <Paragraph>The best widget on the market.</Paragraph>
46
- </Card>
47
- ```
48
-
49
- `href` turns the card into a navigable overlay. Real interactive elements inside (like inline `<Link>` components) stay clickable via `position: relative; z-index: 2` rules in the stylesheet.
50
-
51
- `<Card>` also accepts `status` and `color` — `<Card status="error">` for a prominent error panel, `<Card color="purple">` for decorative tinting. The card styles the box and its tint cascades into nested content; compose its contents however the use case needs.
52
-
53
- ### Structured page section
54
-
55
- ```tsx
56
- import { Section, Heading, Definitions } from "shelving/ui";
57
-
58
- <Section narrow>
59
- <Heading>Account details</Heading>
60
- <Definitions>
61
- <dt>Name</dt><dd>Alice Smith</dd>
62
- <dt>Email</dt><dd>alice@example.com</dd>
63
- <dt>Plan</dt><dd>Pro</dd>
64
- </Definitions>
65
- </Section>
66
- ```
67
-
68
- `<Title>`, `<Heading>`, and `<Subheading>` render `<h1>`, `<h2>`, and `<h3>` respectively — pick the component that matches the level rather than overriding it with the `level` prop. Use `<Subheading>` for card titles, in-section labels, and panel titles.
69
-
70
- ### Page banded into panels
71
-
72
- ```tsx
73
- import { Panel, Block, Title, Paragraph } from "shelving/ui";
74
-
75
- <Panel as="header" color="primary">
76
- <Block narrow>
77
- <Title>Welcome</Title>
78
- </Block>
79
- </Panel>
80
- <Panel padding="large">
81
- <Block narrow>
82
- <Paragraph>Each panel is a full-width band; the inner block constrains the content.</Paragraph>
83
- </Block>
84
- </Panel>
85
- ```
86
-
87
- ### Prose content from a renderer
88
-
89
- ```tsx
90
- import { Prose, Markup } from "shelving/ui";
91
-
92
- <Prose>
93
- <Markup>{article.body}</Markup>
94
- </Prose>
95
- ```
96
-
97
- Wrap `<Markup>` (or any component that emits raw HTML elements) in `<Prose>` to apply consistent longform typography.
98
-
99
- ### Flex row of cards
100
-
101
- ```tsx
102
- import { Card, Flex, Subheading } from "shelving/ui";
103
-
104
- <Flex wrap gap="small">
105
- {products.map(p => (
106
- <Card key={p.id} href={`/products/${p.id}`}>
107
- <Subheading>{p.name}</Subheading>
108
- </Card>
109
- ))}
110
- </Flex>
111
- ```
112
-
113
- `<Flex>` is a dumb flex box: `column` switches direction, `wrap` allows wrapping, and the justify/align booleans (`left`, `center`, `right`, `between`, `top`, `middle`, `bottom`, …) position children along each axis. It carries no outer spacing of its own.
114
-
115
- ### Figure with caption
116
-
117
- ```tsx
118
- import { Figure, Image, Caption } from "shelving/ui";
119
-
120
- <Figure>
121
- <Image src="/images/dog.jpg" alt="Golden retriever" />
122
- <Caption>A golden retriever at the park</Caption>
123
- </Figure>
124
- ```
125
-
126
- ### Video with controls
127
-
128
- ```tsx
129
- import { Video, VideoButtons, FullscreenVideoButton } from "shelving/ui";
130
-
131
- <Video wide>
132
- <video src={stream.url} autoPlay muted playsInline />
133
- <VideoButtons>
134
- <FullscreenVideoButton />
135
- </VideoButtons>
136
- </Video>
137
- ```
138
-
139
- ## See also
140
-
141
- - [ui/inline](/ui/inline) — inline-level text components used inside block content
142
- - [ui/misc/Markup](/ui/misc) — renders a markup string into block and inline elements
143
- - [ui/form](/ui/form) — interactive form elements and buttons
144
- - [ui/layout](/ui/layout) — page-level layout structures
@@ -1,80 +0,0 @@
1
- # Dialog
2
-
3
- Overlay components for modals and imperative dialogs. Two approaches: mount a `<Dialog>` declaratively in the tree, or use `DialogsStore` to push dialogs imperatively from anywhere in the app.
4
-
5
- ## Components
6
-
7
- | Export | Purpose |
8
- |---|---|
9
- | `<Dialog>` | A native `<dialog>` element opened in modal mode. Closes on backdrop click, on links/buttons inside a `<nav>`, or via `<DialogCloseButton>`. |
10
- | `<DialogCloseButton>` | A button that closes its nearest wrapping `<dialog>`. Renders an X icon by default. |
11
- | `<DialogsContext>` | Creates a `DialogsStore` and provides it to descendants. |
12
- | `<Dialogs>` | Renders the list of dialogs currently in the nearest `DialogsStore`. Mount once near the root of the app. |
13
- | `DialogsStore` | An `ArrayStore<ReactElement>` with `.show(children)` and `.hideAll()`. Call `requireDialogs()` to get it from any component. |
14
- | `<Modal>` | A non-blocking `<aside>` overlay for persistent panels (drawers, toasts, side-sheets) — not a `<dialog>`. |
15
-
16
- ## Declarative usage
17
-
18
- Mount `<Dialog>` directly when its lifetime matches a React state variable:
19
-
20
- ```tsx
21
- import { Dialog, DialogCloseButton } from "shelving/ui";
22
-
23
- function ConfirmDelete({ onConfirm, onClose }: { onConfirm: () => void; onClose: () => void }) {
24
- return (
25
- <Dialog onClose={onClose}>
26
- <p>Delete this item?</p>
27
- <button type="button" onClick={onConfirm}>Delete</button>
28
- <DialogCloseButton/>
29
- </Dialog>
30
- );
31
- }
32
-
33
- // In the parent:
34
- {showConfirm && <ConfirmDelete onConfirm={handleDelete} onClose={() => setShowConfirm(false)}/>}
35
- ```
36
-
37
- ## Imperative usage with DialogsStore
38
-
39
- Set up the context once near the app root, then call `.show()` from any component:
40
-
41
- ```tsx
42
- import { DialogsContext, Dialogs, requireDialogs } from "shelving/ui";
43
-
44
- // App root — add <Dialogs> alongside your content.
45
- function AppRoot() {
46
- return (
47
- <DialogsContext>
48
- <AppContent/>
49
- <Dialogs/>
50
- </DialogsContext>
51
- );
52
- }
53
-
54
- // Anywhere in the tree:
55
- function DeleteButton({ id }: { id: string }) {
56
- const dialogs = requireDialogs();
57
- const open = () => dialogs.show(
58
- <ConfirmDelete id={id} onConfirm={() => handleDelete(id)}/>
59
- );
60
- return <button type="button" onClick={open}>Delete</button>;
61
- }
62
- ```
63
-
64
- `<Dialogs>` removes a dialog from the DOM 500 ms after it closes, giving CSS animations time to finish.
65
-
66
- ## Modal
67
-
68
- `<Modal>` is an `<aside>` element — use it for persistent overlays that coexist with the page rather than blocking interaction:
69
-
70
- ```tsx
71
- <Modal>
72
- <NotificationPanel/>
73
- </Modal>
74
- ```
75
-
76
- ## See also
77
-
78
- - [`notice`](/ui/notice) — inline and global notices (toasts, banners)
79
- - [`form`](/ui/form) — form components to put inside dialogs
80
- - [`transition`](/ui/transition) — animate dialog enter / leave
package/ui/docs/README.md DELETED
@@ -1,71 +0,0 @@
1
- # Documentation pages
2
-
3
- Page and card renderers for the two tree element types. These are the defaults wired into [ui/tree](/ui/tree) — use them directly if you need a page or card outside the tree shell, or replace them via the `*Mapping` components.
4
-
5
- ## Element types and their renderers
6
-
7
- | Element type | Page renderer | Card renderer |
8
- |---|---|---|
9
- | `tree-element` | `TreePage` | `TreeCard` |
10
- | `tree-documentation` | `DocumentationPage` | `DocumentationCard` |
11
-
12
- Each renderer receives the props of its element type (title, name, description, content, children, etc.). Card renderers also accept a `path` prop — the parent's URL path — so each card can compute its own `href` as `joinPath(path, name)`.
13
-
14
- ## Pages
15
-
16
- **`TreePage`** renders a generic `tree-element` (a directory or file): its title, any absorbed prose content via `<Markup>`, then its children as a `<TreeCards>` listing. The `path` prop is threaded down so each child card links to the right path.
17
-
18
- **`DocumentationPage`** is the most detailed renderer. Before the title it renders `<TreeBreadcrumbs>` (a trail of links to the page's ancestors, from [ui/tree](/ui/tree)). The title carries a `<DocumentationKind>` tag. Below the title `<DocumentationButtons>` lists the symbol's relations (`member of`, `extends`, `implements`, `overrides`) as links. Then it renders the signature(s) as preformatted blocks (each carries the symbol's name, e.g. `refreshAll(maxAge?: number): Promise<void>`, with `readonly` folded into property signatures), prose content, and conditional sections for parameters, returns, throws, and examples. Child symbols follow as cards.
19
-
20
- ## Linking between symbols
21
-
22
- Three components turn the raw relational metadata the extractor records (`class`, `readonly`, `overrides`, `extends`, `implements`) into navigation:
23
-
24
- **`DocumentationButton`** links to another symbol by reference string — a bare name (`"Store"`) or a qualified member (`"Store.get"`). It resolves the reference against the flattened tree map from `<TreeProvider>` (see [ui/tree](/ui/tree)): a hit becomes a link, a miss (e.g. a builtin like `Serializable`) renders as a non-linking label so the text still reads. Defaults to `small plain` button styling.
25
-
26
- **`DocumentationButtons`** renders a symbol's relations as a `<nav>` column of labelled `<DocumentationButton>`s — `overrides AbstractStore.get`, `implements Serializable`, `member of Store`, etc. Carries paragraph-level block spacing by default (composes `PARAGRAPH_CLASS`), overridable with the `space` prop. Renders nothing when the symbol has no relations. Used by both `DocumentationPage` and `DocumentationCard`.
27
-
28
- (The ancestor breadcrumb trail rendered above the title is `<TreeBreadcrumbs>`, which lives in [ui/tree](/ui/tree) since it works with any tree, not just documentation.)
29
-
30
- ## Cards
31
-
32
- Cards are compact link tiles used in `<TreeCards>` directory listings.
33
-
34
- **`TreeCard`** shows the title and prose lead-in inside a `<Card>` linked to the element's path — used for both directories and files.
35
-
36
- **`DocumentationCard`** leads with the symbol's signature(s) as monospace `<Subheading>`s (one per overload) — the signature already carries the name (and `readonly` for properties), so there's no separate title or kind tag; the card's *colour* carries the kind. Symbols with no signature (classes, interfaces, modules) fall back to a plain-name heading. Below: its `<DocumentationButtons>` relations (excluding "member of"), and a prose lead-in.
37
-
38
- ## DocumentationKind
39
-
40
- `<DocumentationKind>` renders a colour-coded `<Tag>` for a symbol's `kind` string. Built-in colour map:
41
-
42
- | Kind | Colour |
43
- |---|---|
44
- | `function` | blue |
45
- | `class` | purple |
46
- | `interface` | cyan |
47
- | `type` | pink |
48
- | `constant` | green |
49
- | `method` | orange |
50
- | `property` | yellow |
51
-
52
- Unknown kinds render as an uncoloured tag.
53
-
54
- ## Usage
55
-
56
- The renderers are used automatically via [ui/tree](/ui/tree). To render a single page or card manually, spread element props directly:
57
-
58
- ```tsx
59
- import { TreePage, DocumentationPage } from "shelving/ui";
60
-
61
- <TreePage {...treeElement.props} />
62
- <DocumentationPage {...documentationElement.props} />
63
- ```
64
-
65
- To replace a renderer for one element type across the whole site, use `<TreePageMapping>` or `<TreeCardMapping>` from [ui/tree](/ui/tree).
66
-
67
- ## See also
68
-
69
- - [ui/tree](/ui/tree) — `<TreeCards>` and the `*Mapping` override mechanism
70
- - [extract](/extract) — produces the `TreeElement` tree whose props these renderers consume
71
- - [markup](/markup) — renders the Markdown `content` field carried by each element
package/ui/form/README.md DELETED
@@ -1,165 +0,0 @@
1
- # Forms
2
-
3
- Forms and inputs for shelving apps. Build validated, schema-driven forms from a handful of composable pieces, or drop in a single `<Form>` component for a fully automatic experience.
4
-
5
- ## Concepts
6
-
7
- ### FormStore — form state
8
-
9
- `FormStore` is the brain of every form. It extends `DataStore` and owns:
10
-
11
- - The current (partial) field values.
12
- - A `messages` dictionary — error strings keyed by field name, plus a top-level `""` key for form-wide messages.
13
- - A `validated` getter that runs the schema and returns fully-typed data or throws a string on failure.
14
- - A `publish(name, value)` method that validates a single field, writes the result, and stores any per-field error.
15
- - A `submit(callback)` method that validates the whole form and, if valid, runs the callback.
16
-
17
- When `submit` calls the callback and the callback throws a plain **string**, `FormStore` parses it into field messages using the `"fieldName: message"` line format from [schema](/schema). Any non-string throw is surfaced as a global error notice. A successful return value is dispatched as a success notice.
18
-
19
- You rarely create `FormStore` directly — `<Form>` does it for you — but you can grab it from context with `requireForm()` when you need it.
20
-
21
- ### `<Form>` — the outer wrapper
22
-
23
- `<Form>` creates a `FormStore` from a `schema` prop, wraps everything in an HTML `<form>`, disables the whole fieldset while busy, and calls `onSubmit` on a valid submit. If you provide no `children`, it renders `<FormFields>` (one auto-input per schema property) followed by `<FormFooter>` (submit button + error message).
24
-
25
- ```tsx
26
- import { Form } from "shelving/ui";
27
- import { DATA, STRING, NumberSchema } from "shelving/schema";
28
-
29
- const PRODUCT_SCHEMA = DATA({
30
- name: new StringSchema({ title: "Name", min: 1, max: 100 }),
31
- price: new NumberSchema({ title: "Price", min: 0 }),
32
- });
33
-
34
- export function NewProductForm() {
35
- return (
36
- <Form
37
- schema={PRODUCT_SCHEMA}
38
- submit="Create product"
39
- onSubmit={async data => {
40
- await createProduct(data);
41
- return "Product created"; // dispatched as a success notice
42
- }}
43
- />
44
- );
45
- }
46
- ```
47
-
48
- Pass `data` to pre-populate an edit form. Pass `messages` (a string or dictionary) to seed initial field errors — useful when a server returns validation failures.
49
-
50
- ### `<Field>` — label + input + error
51
-
52
- `<Field>` is the visual wrapper for a single control. It renders a `<label>` with an optional title, description, and inline error message below the input. Use it when composing inputs by hand rather than relying on `<FormFields>`.
53
-
54
- ```tsx
55
- <Field title="Email address" message={emailError}>
56
- <TextInput name="email" value={email} onValue={setEmail} required />
57
- </Field>
58
- ```
59
-
60
- `<FormField name="…">` combines `<Field>` with `useField()` and `<SchemaInput>` in one step — it reads the schema, current value, and error state from the surrounding `FormContext` automatically.
61
-
62
- ### Typed input components
63
-
64
- Each input is a standalone, controlled component. All extend `ValueInputProps<O>`:
65
-
66
- | Prop | Contract |
67
- |---|---|
68
- | `name` | HTML field name |
69
- | `value` | Current value |
70
- | `onValue(v)` | Called on every change |
71
- | `required` | Marks the field as required |
72
- | `disabled` | Disables the control |
73
- | `message` | Inline error string |
74
-
75
- The typed inputs are: `TextInput`, `NumberInput`, `DateInput`, `CheckboxInput`, `RadioInput`, `SelectInput`, `FileInput`, `ArrayInput`, `DictionaryInput`, and `DataInput`. `ArrayInput` and `DictionaryInput` both accept an `items` schema to render a repeatable list of sub-inputs with add/remove buttons.
76
-
77
- ### `SchemaInput` / `DataInput` — schema-driven rendering
78
-
79
- `SchemaInput` inspects a `Schema` instance and renders the right input automatically:
80
-
81
- | Schema type | Rendered as |
82
- |---|---|
83
- | `StringSchema` | `<TextInput>` |
84
- | `NumberSchema` | `<NumberInput>` (formatted on blur) |
85
- | `DateSchema` | `<DateInput>` |
86
- | `BooleanSchema` | `<CheckboxInput>` |
87
- | `ChoiceSchema` (≤ 8 options) | `<ChoiceRadioInputs>` |
88
- | `ChoiceSchema` (> 8 options) | `<SelectInput>` |
89
- | `ArraySchema` | `<ArrayInput>` |
90
- | `DictionarySchema` | `<DictionaryInput>` |
91
- | `DataSchema` | `<DataInput>` |
92
-
93
- `DataInput` renders a row of `SchemaInput` elements for each property of a nested data object, and propagates sub-field errors from a `"key: message\n…"` formatted `message` string.
94
-
95
- ### `<Button>`, `<SubmitButton>`, `<Clickable>`
96
-
97
- `<Clickable>` renders a `<button>` or an `<a>` depending on whether `onClick` or `href` is provided. It tracks its own busy state and shows a loading spinner when its `onClick` promise is pending. `<Button>` is `<Clickable>` with styling variants (`strong`, `plain`, `outline`, `small`, `primary`, `danger`, `success`, …). `<SubmitButton>` reads the surrounding `FormContext`, disables itself while the form is busy, and defaults to a "Save →" label.
98
-
99
- ### Popovers and combo inputs
100
-
101
- `<Popover>` is a layout primitive: its first child is the trigger, subsequent children appear in a floating panel when `open` is true. `<ButtonPopover>` wraps a `<Button>` trigger; `<ButtonInputPopover>` wraps a `<ButtonInput>` trigger styled to look like an input field. Use these to build date-pickers, tag selectors, and other inputs that need a dropdown panel.
102
-
103
- `<QueryInput>` is a ready-made combo box: it renders a schema-driven text input and calls an async `onQuery` callback on each keystroke (debounced), showing results as a radio list in a popover.
104
-
105
- ### Notices and error surfacing
106
-
107
- When an `onSubmit` callback returns a non-empty `ReactNode`, `<Form>` dispatches it as a success notice. When it throws a **string**, the string is parsed into field messages — any line matching `"fieldName: message"` maps to that field's error display; an unmatched remainder appears as the form-wide message shown by `<FormMessage>`. Non-string throws become global error notices.
108
-
109
- `<FormMessage>` renders the top-level `""` message inline as a `<Message>`. `<FormNotice>` renders it as a larger `<Notice>` block. `<FormNotify>` (no JSX output) forwards the message to the global notice system via a side effect instead.
110
-
111
- ## Canonical end-to-end example
112
-
113
- ```tsx
114
- import { Form, Field, TextInput, NumberInput, CheckboxInput, SubmitButton, FormMessage } from "shelving/ui";
115
- import { DATA, StringSchema, NumberSchema, BOOLEAN } from "shelving/schema";
116
-
117
- const LISTING_SCHEMA = DATA({
118
- title: new StringSchema({ title: "Title", min: 1, max: 80 }),
119
- price: new NumberSchema({ title: "Price", min: 0 }),
120
- published: BOOLEAN,
121
- });
122
-
123
- export function ListingForm({ listing }: { listing?: typeof LISTING_SCHEMA.type }) {
124
- return (
125
- <Form
126
- schema={LISTING_SCHEMA}
127
- data={listing}
128
- submit={listing ? "Save changes" : "Publish listing"}
129
- onSubmit={async data => {
130
- await saveListing(data);
131
- return listing ? "Listing updated" : "Listing published";
132
- }}
133
- />
134
- );
135
- }
136
- ```
137
-
138
- The default `<Form>` children (`<FormFields>` + `<FormFooter>`) handle layout automatically. Customise by providing explicit children when you need control over field order, groupings, or extra buttons:
139
-
140
- ```tsx
141
- <Form schema={LISTING_SCHEMA} data={listing} onSubmit={handleSubmit}>
142
- <Field title="Title" required>
143
- <FormInput name="title" />
144
- </Field>
145
- <Field title="Price">
146
- <FormInput name="price" />
147
- </Field>
148
- <FormInput name="published" />
149
- <footer>
150
- <SubmitButton>Save changes</SubmitButton>
151
- <Button plain onClick={onCancel}>Cancel</Button>
152
- <FormMessage />
153
- </footer>
154
- </Form>
155
- ```
156
-
157
- `<FormInput name="…">` uses `useField()` to pull the current value, error, and schema from context, then delegates to `<SchemaInput>` — so each field automatically renders the correct control type.
158
-
159
- ## See also
160
-
161
- - [schema](/schema) — `DataSchema`, `StringSchema`, `NumberSchema`, `ChoiceSchema`, and other schema types that drive automatic input selection.
162
- - [ui/form/FormStore](/ui/form/FormStore) — the state class underlying every form.
163
- - [ui/form/SchemaInput](/ui/form/SchemaInput) — the schema-to-input dispatch component.
164
- - [ui](/ui) — top-level UI module index.
165
- - [react](/react) — `useStore`, `useInstance`, and other hooks used internally.
@@ -1,86 +0,0 @@
1
- # Inline content
2
-
3
- Inline-level components for annotating text. Every component here renders a single semantic HTML element — `<Strong>` renders `<strong>`, `<Code>` renders `<code>`, `<Mark>` renders `<mark>` — and applies the matching design-system styles.
4
-
5
- ## Concepts
6
-
7
- ### Semantic wrappers
8
-
9
- These components exist so that text annotations always carry the correct HTML semantics and class names. Prefer them over raw HTML elements inside React components: `<Strong>` instead of `<strong>`, `<Link href="…">` instead of `<a href="…">`.
10
-
11
- ### Code family
12
-
13
- `Code.tsx` exports four components that all share the same monospace styling:
14
-
15
- | Component | HTML element | Use for |
16
- | ---------- | ------------ | ------------------------------- |
17
- | `Code` | `<code>` | Inline code fragments |
18
- | `Keyboard` | `<kbd>` | Keyboard input, e.g. `Ctrl+S` |
19
- | `Sample` | `<samp>` | Program output |
20
- | `Variable` | `<var>` | Variable names in documentation |
21
-
22
- ### `<Link>` delegates to `<Clickable>`
23
-
24
- `<Link>` renders an `<a>` when `href` is provided or a `<button>` when `onClick` is provided, via the shared `Clickable` helper. It handles busy state, URL resolution, and active-page highlighting automatically.
25
-
26
- ### `<When>`, `<Ago>`, `<Until>` — time display
27
-
28
- These components format a date as a compact relative string (`in 6d`, `3w ago`) and wrap it in a `<time>` element with a machine-readable `dateTime` attribute and a `title` showing the full date. Pass `full` to append the absolute date alongside the relative one.
29
-
30
- - `When` — shows direction: `in 6d` or `3w ago`
31
- - `Ago` — always backward-looking duration: `6d`
32
- - `Until` — always forward-looking duration: `6d`
33
-
34
- ## Canonical usage examples
35
-
36
- ### Annotated paragraph
37
-
38
- ```tsx
39
- import { Strong, Emphasis, Mark, Keyboard, Code, Small } from "shelving/ui";
40
-
41
- <p>
42
- Press <Keyboard>Ctrl+S</Keyboard> to save. <Strong>Unsaved changes will be lost.</Strong>{" "}
43
- Files are stored as <Emphasis>plain text</Emphasis> in{" "}
44
- <Mark>UTF-8</Mark> encoding. <Small>Maximum 10 MB.</Small>
45
- </p>
46
- ```
47
-
48
- Use `<Keyboard>` for key combinations, `<Code>` for inline code fragments, and `<Sample>` for program output — they share the same monospace appearance but carry different semantics.
49
-
50
- ### Link inside body copy
51
-
52
- ```tsx
53
- import { Link } from "shelving/ui";
54
-
55
- <p>
56
- Read our <Link href="/privacy">privacy policy</Link> for details.
57
- </p>
58
- ```
59
-
60
- ### Relative timestamp
61
-
62
- ```tsx
63
- import { When, Until } from "shelving/ui";
64
-
65
- // "in 3d" or "5h ago" with full ISO date as title tooltip
66
- <span>Last updated <When target={post.updatedAt} /></span>
67
-
68
- // Just the forward-looking duration: "in 2w"
69
- <span>Expires <Until target={subscription.expiresAt} /></span>
70
- ```
71
-
72
- ### Change tracking
73
-
74
- ```tsx
75
- import { Deleted, Inserted } from "shelving/ui";
76
-
77
- <p>
78
- Price: <Deleted>£9.99</Deleted> <Inserted>£7.99</Inserted>
79
- </p>
80
- ```
81
-
82
- ## See also
83
-
84
- - [ui/block](/ui/block) — block-level content components that inline components live inside
85
- - [ui/block/Prose](/ui/block) — applies cohesive longform typography to a subtree of block and inline elements
86
- - [ui/form/Clickable](/ui/form) — the underlying clickable primitive that `Link` delegates to
@@ -1,71 +0,0 @@
1
- # Layout
2
-
3
- Page-level layout containers. Each layout occupies the full viewport and handles scroll, safe areas, and responsive behaviour so individual pages don't have to.
4
-
5
- ## Components
6
-
7
- | Component | Purpose |
8
- |---|---|
9
- | `<SidebarLayout>` | Fixed-width side column next to a scrollable main column. Collapses to an off-canvas drawer on narrow screens. |
10
- | `<CenteredLayout>` | Centers content horizontally with a narrow max-width. Good for login, registration, error, and focused-form pages. |
11
-
12
- `Layout.ts` also exports `useSafeKeyboardArea()` — a hook that adjusts the `--layout-inset-bottom` CSS variable when the on-screen keyboard appears on iOS (a Safari workaround until `interactive-widget` viewport support lands).
13
-
14
- ## SidebarLayout
15
-
16
- ```tsx
17
- import { SidebarLayout, Menu, MenuItem } from "shelving/ui";
18
-
19
- function AppShell() {
20
- const nav = (
21
- <Menu>
22
- <MenuItem href="/dashboard">Dashboard</MenuItem>
23
- <MenuItem href="/users">Users</MenuItem>
24
- <MenuItem href="/settings">Settings</MenuItem>
25
- </Menu>
26
- );
27
- return (
28
- <SidebarLayout sidebar={nav}>
29
- <Router routes={ROUTES}/>
30
- </SidebarLayout>
31
- );
32
- }
33
- ```
34
-
35
- Pass `right` to place the sidebar on the right. The sidebar renders as `<nav>`, so it is a navigation landmark without additional markup. Inside a `<Navigation>` context the drawer closes automatically on route change.
36
-
37
- Override the sidebar width and background with CSS custom properties:
38
-
39
- ```css
40
- --sidebar-layout-width: 280px;
41
- --sidebar-layout-bg: var(--tint-90);
42
- ```
43
-
44
- ## CenteredLayout
45
-
46
- ```tsx
47
- import { CenteredLayout, Section } from "shelving/ui";
48
-
49
- function LoginPage() {
50
- return (
51
- <CenteredLayout>
52
- <Section narrow>
53
- <LoginForm/>
54
- </Section>
55
- </CenteredLayout>
56
- );
57
- }
58
- ```
59
-
60
- Pass `fullWidth` to remove the max-width constraint when centered positioning is still wanted but the content needs full width.
61
-
62
- ## Composing with the router
63
-
64
- Layouts sit naturally inside `<Router>` route values. See the layout-wrapping pattern in [`router`](/ui/router) for examples of wrapping a group of routes in a shared layout.
65
-
66
- ## See also
67
-
68
- - [`router`](/ui/router) — pattern for wrapping route groups in a shared layout
69
- - [`menu`](/ui/menu) — `<Menu>` and `<MenuItem>` for sidebar navigation
70
- - [`app`](/ui/app) — `<App>` wraps the outermost layout on the client
71
- - [`page`](/ui/page) — `<HTML>` and `<Page>` sit above layouts in the tree
package/ui/menu/README.md DELETED
@@ -1,33 +0,0 @@
1
- # Menu
2
-
3
- A `<menu>` list with URL-aware items. `<Menu>` and `<MenuItem>` are the building blocks for navigation in sidebars, dropdowns, and any other list of links.
4
-
5
- `<MenuItem>` reads the current page URL from the `Meta` context and automatically marks itself `active` (exact match) or `proud` (ancestor of the current page). When proud, it reveals its submenu children.
6
-
7
- ## Usage
8
-
9
- ```tsx
10
- import { Menu, MenuItem } from "shelving/ui";
11
-
12
- <Menu>
13
- <MenuItem href="/dashboard">Dashboard</MenuItem>
14
- <MenuItem href="/users">
15
- Users
16
- <Menu>
17
- <MenuItem href="/users/active">Active</MenuItem>
18
- <MenuItem href="/users/archived">Archived</MenuItem>
19
- </Menu>
20
- </MenuItem>
21
- <MenuItem href="/settings">Settings</MenuItem>
22
- </Menu>
23
- ```
24
-
25
- The first child of `<MenuItem>` is the link label. Any additional children form the submenu and are only rendered when the item is proud (i.e. when the current URL starts with the item's `href`). Nesting a `<Menu>` inside applies the `.menu .menu` indentation rule automatically.
26
-
27
- `<MenuItem>` forwards all `ClickableProps` — `href`, `onClick`, `disabled`, and so on.
28
-
29
- ## See also
30
-
31
- - [`layout`](/ui/layout) — `<SidebarLayout>` renders a `<nav>` that typically contains a `<Menu>`
32
- - [`router`](/ui/router) — provides the URL context `<MenuItem>` reads
33
- - [`form`](/ui/form) — `<Clickable>` and `<Button>` used as the link primitive inside `<MenuItem>`