shelving 1.322.0 → 1.322.2
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/docs/api/APIProvider.md +2 -2
- package/docs/api/CachedAPIProvider.md +6 -8
- package/docs/api/ClientAPIProvider.md +5 -5
- package/docs/api/DebugAPIProvider.md +3 -5
- package/docs/api/HydratingAPIProvider.md +2 -2
- package/docs/api/JSONAPIProvider.md +3 -5
- package/docs/api/LoggingAPIProvider.md +7 -9
- package/docs/api/MockAPIProvider.md +4 -4
- package/docs/api/MockEndpointAPIProvider.md +5 -7
- package/docs/api/ThroughAPIProvider.md +15 -10
- package/docs/api/ValidationAPIProvider.md +3 -5
- package/docs/api/XMLAPIProvider.md +3 -3
- package/docs/api.md +48 -44
- package/docs/bun.md +9 -9
- package/docs/db/DBProvider.md +6 -6
- package/docs/db/MemoryDBProvider.md +3 -3
- package/docs/db/PostgresProvider.md +6 -4
- package/docs/db/SQLProvider.md +6 -3
- package/docs/db/SQLiteProvider.md +9 -4
- package/docs/db/StorageDBProvider.md +2 -2
- package/docs/db/ThroughDBProvider.md +6 -6
- package/docs/db/UndoDBProvider.md +2 -2
- package/docs/db.md +32 -32
- package/docs/error/NetworkError.md +5 -5
- package/docs/error/RequestError.md +4 -4
- package/docs/error/RequiredError.md +2 -2
- package/docs/error/ResponseError.md +1 -1
- package/docs/error/UnexpectedError.md +1 -1
- package/docs/error/UnsupportedError.md +3 -3
- package/docs/error/ValueError.md +2 -2
- package/docs/error.md +20 -19
- package/docs/extract.md +14 -14
- package/docs/firebase.md +6 -6
- package/docs/guides/building-with-shelving.md +113 -85
- package/docs/guides/styleguide.md +29 -29
- package/docs/index.md +3 -2
- package/docs/llms-full.txt +2541 -2295
- package/docs/markup.md +15 -17
- package/docs/react/createAPIContext.md +12 -12
- package/docs/react/createDBContext.md +21 -15
- package/docs/react/useInstance.md +2 -2
- package/docs/react/useLazy.md +1 -1
- package/docs/react/useMap.md +10 -6
- package/docs/react/useReduce.md +2 -2
- package/docs/react/useSequence.md +2 -2
- package/docs/react/useStore.md +10 -10
- package/docs/react.md +22 -16
- package/docs/schema/ArraySchema.md +6 -6
- package/docs/schema/BooleanSchema.md +5 -5
- package/docs/schema/ChoiceSchema.md +1 -1
- package/docs/schema/CurrencyAmountSchema.md +2 -2
- package/docs/schema/DataSchema.md +5 -5
- package/docs/schema/NullableSchema.md +4 -4
- package/docs/schema/NumberSchema.md +4 -4
- package/docs/schema/OptionalSchema.md +1 -1
- package/docs/schema/StringSchema.md +7 -7
- package/docs/schema.md +21 -21
- package/docs/sequence/DeferredSequence.md +1 -1
- package/docs/sequence/InspectSequence.md +8 -6
- package/docs/sequence/LazySequence.md +3 -3
- package/docs/sequence/Sequence.md +6 -6
- package/docs/sequence/ThroughSequence.md +4 -2
- package/docs/sequence.md +3 -3
- package/docs/store/ArrayStore.md +6 -6
- package/docs/store/BooleanStore.md +2 -2
- package/docs/store/BusyStore.md +1 -1
- package/docs/store/DataStore.md +5 -5
- package/docs/store/DictionaryStore.md +4 -4
- package/docs/store/FetchStore.md +6 -6
- package/docs/store/PathStore.md +4 -4
- package/docs/store/PayloadFetchStore.md +1 -5
- package/docs/store/Store.md +8 -6
- package/docs/store/URLStore.md +5 -5
- package/docs/store.md +15 -15
- package/docs/test.md +6 -6
- package/docs/ui/App.md +99 -69
- package/docs/ui/AppLayout.md +35 -26
- package/docs/ui/BackButton.md +13 -11
- package/docs/ui/Button.md +73 -64
- package/docs/ui/Card.md +23 -22
- package/docs/ui/Catcher.md +3 -3
- package/docs/ui/ClassProps.md +1 -1
- package/docs/ui/Code.md +11 -11
- package/docs/ui/CollapseTransition.md +5 -5
- package/docs/ui/Deleted.md +6 -6
- package/docs/ui/Details.md +13 -13
- package/docs/ui/Dialog.md +42 -28
- package/docs/ui/Dialogs.md +4 -0
- package/docs/ui/DocumentationButtons.md +2 -2
- package/docs/ui/DocumentationCard.md +2 -2
- package/docs/ui/DocumentationFrame.md +4 -4
- package/docs/ui/DocumentationLive.md +11 -11
- package/docs/ui/DocumentationPage.md +3 -3
- package/docs/ui/Emphasis.md +4 -4
- package/docs/ui/Empty.md +2 -2
- package/docs/ui/FadeTransition.md +9 -9
- package/docs/ui/Field.md +14 -14
- package/docs/ui/FixedLayout.md +27 -25
- package/docs/ui/Form.md +41 -39
- package/docs/ui/FormStore.md +6 -2
- package/docs/ui/Grid.md +21 -9
- package/docs/ui/HTML.md +10 -8
- package/docs/ui/Head.md +2 -3
- package/docs/ui/Heading.md +12 -12
- package/docs/ui/HorizontalTransition.md +10 -10
- package/docs/ui/Icon.md +4 -4
- package/docs/ui/ImageInput.md +12 -12
- package/docs/ui/Inserted.md +6 -6
- package/docs/ui/Link.md +11 -11
- package/docs/ui/List.md +7 -7
- package/docs/ui/Loading.md +6 -6
- package/docs/ui/Mark.md +11 -9
- package/docs/ui/Markup.md +4 -4
- package/docs/ui/Menu.md +24 -24
- package/docs/ui/MenuItem.md +29 -29
- package/docs/ui/Modal.md +57 -45
- package/docs/ui/Navigation.md +28 -26
- package/docs/ui/NavigationStore.md +18 -18
- package/docs/ui/Notice.md +15 -15
- package/docs/ui/Notices.md +17 -17
- package/docs/ui/Page.md +13 -13
- package/docs/ui/Panel.md +8 -8
- package/docs/ui/Paragraph.md +5 -5
- package/docs/ui/Progress.md +11 -11
- package/docs/ui/Prose.md +6 -6
- package/docs/ui/QueryRadiosInput.md +2 -2
- package/docs/ui/RouteCache.md +27 -27
- package/docs/ui/Router.md +70 -61
- package/docs/ui/SchemaInput.md +20 -20
- package/docs/ui/Scroll.md +16 -16
- package/docs/ui/Section.md +13 -10
- package/docs/ui/SidebarLayout.md +27 -27
- package/docs/ui/Small.md +4 -4
- package/docs/ui/Span.md +3 -1
- package/docs/ui/StackButton.md +13 -7
- package/docs/ui/Strong.md +4 -4
- package/docs/ui/Subheading.md +12 -12
- package/docs/ui/TINT_CLASS.md +11 -11
- package/docs/ui/Table.md +40 -29
- package/docs/ui/Tag.md +15 -15
- package/docs/ui/Title.md +13 -13
- package/docs/ui/Transition.md +22 -22
- package/docs/ui/TreeApp.md +8 -8
- package/docs/ui/TreeMarkup.md +2 -2
- package/docs/ui/TreeMenu.md +3 -3
- package/docs/ui/TreeSidebar.md +1 -1
- package/docs/ui/VerticalTransition.md +8 -8
- package/docs/ui/getClass.md +10 -10
- package/docs/ui/getColorClass.md +23 -23
- package/docs/ui/getDurationClass.md +5 -5
- package/docs/ui/getGridClass.md +2 -2
- package/docs/ui/getHeightClass.md +4 -4
- package/docs/ui/getRadiusClass.md +9 -9
- package/docs/ui/getShadowClass.md +6 -6
- package/docs/ui/getSpaceClass.md +13 -13
- package/docs/ui/getStrokeClass.md +6 -6
- package/docs/ui/getTypographyClass.md +38 -38
- package/docs/ui/getWidthClass.md +4 -4
- package/docs/ui/notify.md +11 -11
- package/docs/ui/requireContext.md +1 -1
- package/docs/ui.md +4 -4
- package/docs/util/array.md +35 -29
- package/docs/util/async.md +2 -2
- package/docs/util/base64.md +7 -7
- package/docs/util/boolean.md +10 -10
- package/docs/util/buffer.md +5 -5
- package/docs/util/bytes.md +9 -9
- package/docs/util/class.md +10 -6
- package/docs/util/color.md +13 -13
- package/docs/util/constants.md +2 -2
- package/docs/util/crypto.md +1 -1
- package/docs/util/currency.md +2 -2
- package/docs/util/data.md +18 -18
- package/docs/util/date.md +22 -22
- package/docs/util/debug/debug.md +12 -12
- package/docs/util/dictionary.md +21 -18
- package/docs/util/diff.md +6 -6
- package/docs/util/dispose/dispose.md +5 -5
- package/docs/util/duration.md +9 -9
- package/docs/util/element.md +1 -1
- package/docs/util/entity.md +6 -6
- package/docs/util/entry.md +21 -8
- package/docs/util/env.md +2 -2
- package/docs/util/equal.md +16 -16
- package/docs/util/error.md +4 -4
- package/docs/util/file.md +8 -8
- package/docs/util/filter.md +9 -5
- package/docs/util/format.md +18 -18
- package/docs/util/function.md +4 -4
- package/docs/util/geo.md +13 -13
- package/docs/util/hash.md +3 -3
- package/docs/util/http.md +1 -1
- package/docs/util/hydrate/hydrate.md +7 -4
- package/docs/util/item.md +4 -4
- package/docs/util/iterate.md +11 -11
- package/docs/util/jwt.md +1 -6
- package/docs/util/link.md +5 -5
- package/docs/util/map.md +17 -11
- package/docs/util/merge.md +2 -5
- package/docs/util/null.md +20 -10
- package/docs/util/number.md +16 -16
- package/docs/util/object.md +25 -22
- package/docs/util/path.md +17 -17
- package/docs/util/query.md +23 -25
- package/docs/util/random.md +7 -7
- package/docs/util/regexp.md +16 -16
- package/docs/util/sequence.md +16 -10
- package/docs/util/serialise/serialise.md +6 -6
- package/docs/util/set.md +10 -10
- package/docs/util/sort.md +10 -11
- package/docs/util/source.md +11 -7
- package/docs/util/start.md +8 -8
- package/docs/util/string.md +14 -14
- package/docs/util/template.md +3 -3
- package/docs/util/timeout.md +5 -5
- package/docs/util/transform.md +6 -6
- package/docs/util/tree.md +13 -13
- package/docs/util/undefined.md +3 -3
- package/docs/util/units.md +15 -15
- package/docs/util/update.md +16 -16
- package/docs/util/uri.md +12 -12
- package/docs/util/url.md +11 -11
- package/docs/util/uuid.md +3 -3
- package/docs/util/validate.md +14 -9
- package/package.json +3 -3
- package/skills/shelving/SKILL.md +1 -0
- package/ui/README.md +4 -4
- package/ui/app/App.md +99 -69
- package/ui/block/Card.md +23 -22
- package/ui/block/Details.md +13 -13
- package/ui/block/Grid.md +21 -9
- package/ui/block/Heading.md +12 -12
- package/ui/block/List.md +7 -7
- package/ui/block/Panel.md +8 -8
- package/ui/block/Paragraph.md +5 -5
- package/ui/block/Prose.md +6 -6
- package/ui/block/Section.md +13 -10
- package/ui/block/Subheading.md +12 -12
- package/ui/block/Title.md +13 -13
- package/ui/button/Button.md +73 -64
- package/ui/dialog/Dialog.md +42 -28
- package/ui/dialog/Dialogs.d.ts +4 -0
- package/ui/dialog/Dialogs.js +4 -0
- package/ui/dialog/Dialogs.tsx +4 -0
- package/ui/dialog/Modal.md +57 -45
- package/ui/docs/DocumentationButtons.md +2 -2
- package/ui/docs/DocumentationCard.md +2 -2
- package/ui/docs/DocumentationFrame.md +4 -4
- package/ui/docs/DocumentationLive.md +11 -11
- package/ui/docs/DocumentationPage.md +3 -3
- package/ui/form/Field.md +14 -14
- package/ui/form/Form.md +41 -39
- package/ui/form/FormStore.md +6 -2
- package/ui/form/Progress.md +11 -11
- package/ui/inline/Code.md +11 -11
- package/ui/inline/Deleted.md +6 -6
- package/ui/inline/Emphasis.md +4 -4
- package/ui/inline/Inserted.md +6 -6
- package/ui/inline/Link.md +11 -11
- package/ui/inline/Mark.md +11 -9
- package/ui/inline/Small.md +4 -4
- package/ui/inline/Span.md +3 -1
- package/ui/inline/Strong.md +4 -4
- package/ui/input/ImageInput.md +12 -12
- package/ui/input/QueryRadiosInput.md +2 -2
- package/ui/input/SchemaInput.md +20 -20
- package/ui/layout/AppLayout.md +35 -26
- package/ui/layout/AppLayout.module.css +3 -16
- package/ui/layout/FixedLayout.md +27 -25
- package/ui/layout/SidebarLayout.md +27 -27
- package/ui/layout/SidebarLayout.module.css +1 -0
- package/ui/menu/Menu.md +24 -24
- package/ui/menu/MenuItem.md +29 -29
- package/ui/misc/Catcher.md +3 -3
- package/ui/misc/Icon.md +4 -4
- package/ui/misc/Loading.md +6 -6
- package/ui/misc/Markup.md +4 -4
- package/ui/misc/Tag.md +15 -15
- package/ui/notice/Empty.md +2 -2
- package/ui/notice/Notice.md +15 -15
- package/ui/notice/Notices.md +17 -17
- package/ui/page/HTML.md +10 -8
- package/ui/page/Head.md +2 -3
- package/ui/page/Page.md +13 -13
- package/ui/router/BackButton.md +13 -11
- package/ui/router/Navigation.md +28 -26
- package/ui/router/NavigationStore.md +18 -18
- package/ui/router/RouteCache.md +27 -27
- package/ui/router/Router.md +70 -61
- package/ui/router/StackButton.md +13 -7
- package/ui/style/Scroll.md +16 -16
- package/ui/style/TINT_CLASS.md +11 -11
- package/ui/style/getColorClass.md +23 -23
- package/ui/style/getDurationClass.md +5 -5
- package/ui/style/getGridClass.md +2 -2
- package/ui/style/getHeightClass.md +4 -4
- package/ui/style/getRadiusClass.md +9 -9
- package/ui/style/getShadowClass.md +6 -6
- package/ui/style/getSpaceClass.md +13 -13
- package/ui/style/getStrokeClass.md +6 -6
- package/ui/style/getTypographyClass.md +38 -38
- package/ui/style/getWidthClass.md +4 -4
- package/ui/table/Table.md +40 -30
- package/ui/transition/CollapseTransition.md +5 -5
- package/ui/transition/FadeTransition.md +9 -9
- package/ui/transition/HorizontalTransition.md +10 -10
- package/ui/transition/Transition.md +22 -22
- package/ui/transition/VerticalTransition.md +8 -8
- package/ui/tree/TreeApp.md +8 -8
- package/ui/tree/TreeMarkup.md +2 -2
- package/ui/tree/TreeMenu.md +3 -3
- package/ui/tree/TreeSidebar.md +1 -1
- package/ui/util/ClassProps.md +1 -1
- package/ui/util/getClass.md +10 -10
- package/ui/util/notify.md +11 -11
- package/ui/util/requireContext.md +1 -1
package/ui/table/Table.md
CHANGED
|
@@ -22,14 +22,23 @@ A data table — renders a `<table>`. Compose the usual `<thead>` / `<tbody>` /
|
|
|
22
22
|
import { Table } from "shelving/ui";
|
|
23
23
|
|
|
24
24
|
<Table>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
<thead>
|
|
26
|
+
<tr>
|
|
27
|
+
<th>Name</th>
|
|
28
|
+
<th>Plan</th>
|
|
29
|
+
</tr>
|
|
30
|
+
</thead>
|
|
31
|
+
<tbody>
|
|
32
|
+
<tr>
|
|
33
|
+
<td>Alice</td>
|
|
34
|
+
<td>Pro</td>
|
|
35
|
+
</tr>
|
|
36
|
+
<tr>
|
|
37
|
+
<td>Bob</td>
|
|
38
|
+
<td>Free</td>
|
|
39
|
+
</tr>
|
|
40
|
+
</tbody>
|
|
41
|
+
</Table>;
|
|
33
42
|
```
|
|
34
43
|
|
|
35
44
|
### Cell padding
|
|
@@ -38,13 +47,15 @@ import { Table } from "shelving/ui";
|
|
|
38
47
|
import { Button, Cell, Table } from "shelving/ui";
|
|
39
48
|
|
|
40
49
|
<Table padding="small">
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
</
|
|
50
|
+
<tbody>
|
|
51
|
+
<tr>
|
|
52
|
+
<Cell width="full">Alice</Cell>
|
|
53
|
+
<Cell width="fit" padding="none">
|
|
54
|
+
<Button small>Remove</Button>
|
|
55
|
+
</Cell>
|
|
56
|
+
</tr>
|
|
57
|
+
</tbody>
|
|
58
|
+
</Table>;
|
|
48
59
|
```
|
|
49
60
|
|
|
50
61
|
## Styling
|
|
@@ -53,19 +64,19 @@ import { Button, Cell, Table } from "shelving/ui";
|
|
|
53
64
|
|
|
54
65
|
`--table-padding` sets the top and bottom padding of each cell, and `--table-indent` the left and right. Each takes one length. The table's `padding` and `indent` variants set these hooks. The outermost columns still drop their outer inline padding, and `<thead>` / `<tfoot>` their outer block padding, so the table stays flush with its container.
|
|
55
66
|
|
|
56
|
-
| Variable
|
|
57
|
-
|
|
58
|
-
| `--table-space`
|
|
59
|
-
| `--table-padding`
|
|
60
|
-
| `--table-indent`
|
|
61
|
-
| `--table-border`
|
|
62
|
-
| `--table-stroke`
|
|
63
|
-
| `--table-header-weight` | Weight of `<thead>` / `<tfoot>` / `<tbody> <th>` cells | `var(--weight-strong)`
|
|
64
|
-
| `--table-label-font`
|
|
65
|
-
| `--table-label-weight`
|
|
66
|
-
| `--table-label-size`
|
|
67
|
-
| `--table-label-case`
|
|
68
|
-
| `--table-label-color`
|
|
67
|
+
| Variable | Styles | Default |
|
|
68
|
+
| ----------------------- | ------------------------------------------------------ | ------------------------------------------- |
|
|
69
|
+
| `--table-space` | Outer block margin (top + bottom) | `var(--space-paragraph)` (16px) |
|
|
70
|
+
| `--table-padding` | Cell top and bottom padding (one length) | `var(--space-xsmall)` (8px) |
|
|
71
|
+
| `--table-indent` | Cell left and right padding (one length) | `var(--space-xsmall)` (8px) |
|
|
72
|
+
| `--table-border` | Cell border shorthand | `var(--table-stroke)` |
|
|
73
|
+
| `--table-stroke` | Cell border thickness/colour | `var(--stroke-normal) solid var(--tint-90)` |
|
|
74
|
+
| `--table-header-weight` | Weight of `<thead>` / `<tfoot>` / `<tbody> <th>` cells | `var(--weight-strong)` |
|
|
75
|
+
| `--table-label-font` | Label font for `<thead>` / `<tfoot>` `<th>` | `var(--font-label)` |
|
|
76
|
+
| `--table-label-weight` | Label weight | `var(--weight-label)` |
|
|
77
|
+
| `--table-label-size` | Label size | `var(--size-label)` |
|
|
78
|
+
| `--table-label-case` | Label letter case | `var(--case-label)` |
|
|
79
|
+
| `--table-label-color` | Label colour | `var(--tint-70)` |
|
|
69
80
|
|
|
70
81
|
**Global tokens it reads:** `--space-paragraph`, `--space-xsmall`, `--stroke-normal`, the tint-ladder steps `--tint-70` / `--tint-90`, and the label tokens `--font-label` / `--weight-label` / `--size-label` / `--case-label` / `--weight-strong`.
|
|
71
82
|
|
|
@@ -95,7 +106,6 @@ The following table will be defined with two fixed width cells and a longer cell
|
|
|
95
106
|
|
|
96
107
|
The following table does the same but with a minimum width on the description column:
|
|
97
108
|
|
|
98
|
-
|
|
99
109
|
```TableWidths.tsx
|
|
100
110
|
<Table>
|
|
101
111
|
<tr>
|
|
@@ -104,4 +114,4 @@ The following table does the same but with a minimum width on the description co
|
|
|
104
114
|
<Cell width="24x" grow>{description}</Cell>
|
|
105
115
|
</tr>
|
|
106
116
|
</Table>
|
|
107
|
-
```
|
|
117
|
+
```
|
|
@@ -14,11 +14,11 @@ A `<Transition>` preset that collapses its children in and out by animating thei
|
|
|
14
14
|
import { CollapseTransition } from "shelving/ui";
|
|
15
15
|
|
|
16
16
|
function Details({ open }: { open: boolean }) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
return open ? (
|
|
18
|
+
<CollapseTransition>
|
|
19
|
+
<Panel>…</Panel>
|
|
20
|
+
</CollapseTransition>
|
|
21
|
+
) : null;
|
|
22
22
|
}
|
|
23
23
|
```
|
|
24
24
|
|
|
@@ -14,11 +14,11 @@ A `<Transition>` preset that fades its children in and out by animating opacity.
|
|
|
14
14
|
import { FadeTransition } from "shelving/ui";
|
|
15
15
|
|
|
16
16
|
function Panel({ visible }: { visible: boolean }) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
return visible ? (
|
|
18
|
+
<FadeTransition>
|
|
19
|
+
<div className="panel">…</div>
|
|
20
|
+
</FadeTransition>
|
|
21
|
+
) : null;
|
|
22
22
|
}
|
|
23
23
|
```
|
|
24
24
|
|
|
@@ -31,14 +31,14 @@ import { ViewTransition } from "react";
|
|
|
31
31
|
import { FADE_TRANSITION_CLASS } from "shelving/ui";
|
|
32
32
|
|
|
33
33
|
<ViewTransition enter={FADE_TRANSITION_CLASS} exit={FADE_TRANSITION_CLASS}>
|
|
34
|
-
|
|
35
|
-
</ViewTransition
|
|
34
|
+
<div className="panel">…</div>
|
|
35
|
+
</ViewTransition>;
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
## Styling
|
|
39
39
|
|
|
40
|
-
| Variable
|
|
41
|
-
|
|
40
|
+
| Variable | Styles | Default |
|
|
41
|
+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
|
|
42
42
|
| `--fade-transition-duration` | Duration of the fade in, the fade out, and the crossfade when content changes in place (also the group's size and position morph) | `var(--duration-fast)` |
|
|
43
43
|
|
|
44
44
|
**Global tokens it reads** — `--duration-fast`.
|
|
@@ -30,10 +30,10 @@ import { HorizontalTransition, Navigation, Router } from "shelving/ui";
|
|
|
30
30
|
|
|
31
31
|
// Links slide right, the browser back button slides left.
|
|
32
32
|
<Navigation>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
</Navigation
|
|
33
|
+
<HorizontalTransition>
|
|
34
|
+
<Router routes={ROUTES} />
|
|
35
|
+
</HorizontalTransition>
|
|
36
|
+
</Navigation>;
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## Use the class without the component
|
|
@@ -45,15 +45,15 @@ import { ViewTransition } from "react";
|
|
|
45
45
|
import { SLIDE_RIGHT_TRANSITION_CLASS } from "shelving/ui";
|
|
46
46
|
|
|
47
47
|
<ViewTransition enter={SLIDE_RIGHT_TRANSITION_CLASS} exit={SLIDE_RIGHT_TRANSITION_CLASS}>
|
|
48
|
-
|
|
49
|
-
</ViewTransition
|
|
48
|
+
<div className="panel">…</div>
|
|
49
|
+
</ViewTransition>;
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
## Styling
|
|
53
53
|
|
|
54
|
-
| Variable
|
|
55
|
-
|
|
56
|
-
| `--horizontal-transition-size`
|
|
57
|
-
| `--horizontal-transition-duration` | Duration of the slide keyframes
|
|
54
|
+
| Variable | Styles | Default |
|
|
55
|
+
| ---------------------------------- | ----------------------------------------------------------------------------------------- | ------------------------ |
|
|
56
|
+
| `--horizontal-transition-size` | Slide distance for the enter/leave keyframes. A percentage is of the element's own width. | `100%` |
|
|
57
|
+
| `--horizontal-transition-duration` | Duration of the slide keyframes | `var(--duration-normal)` |
|
|
58
58
|
|
|
59
59
|
**Global tokens it reads** — `--duration-normal`.
|
|
@@ -18,8 +18,8 @@ The base View Transition wrapper. It wraps its children in React 19's `<ViewTran
|
|
|
18
18
|
import { Transition } from "shelving/ui";
|
|
19
19
|
|
|
20
20
|
<Transition default="zoom" forward="zoomIn" back="zoomOut">
|
|
21
|
-
|
|
22
|
-
</Transition
|
|
21
|
+
{children}
|
|
22
|
+
</Transition>;
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Overlay
|
|
@@ -28,8 +28,8 @@ import { Transition } from "shelving/ui";
|
|
|
28
28
|
import { FadeTransition } from "shelving/ui";
|
|
29
29
|
|
|
30
30
|
<FadeTransition overlay>
|
|
31
|
-
|
|
32
|
-
</FadeTransition
|
|
31
|
+
<Notification />
|
|
32
|
+
</FadeTransition>;
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Page transitions
|
|
@@ -41,10 +41,10 @@ import { HorizontalTransition, Navigation, Router } from "shelving/ui";
|
|
|
41
41
|
|
|
42
42
|
// Slides right on forward, left on back:
|
|
43
43
|
<Navigation>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
</Navigation
|
|
44
|
+
<HorizontalTransition>
|
|
45
|
+
<Router routes={ROUTES} />
|
|
46
|
+
</HorizontalTransition>
|
|
47
|
+
</Navigation>;
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
### Setting the direction with `setTransitionType()`
|
|
@@ -54,17 +54,17 @@ import { HorizontalTransition, setTransitionType } from "shelving/ui";
|
|
|
54
54
|
import { startTransition, useState } from "react";
|
|
55
55
|
|
|
56
56
|
function Steps() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
const [step, setStep] = useState(0);
|
|
58
|
+
const go = (direction: "forward" | "back") =>
|
|
59
|
+
startTransition(() => {
|
|
60
|
+
setTransitionType(direction);
|
|
61
|
+
setStep(s => s + (direction === "forward" ? 1 : -1));
|
|
62
|
+
});
|
|
63
|
+
return (
|
|
64
|
+
<HorizontalTransition>
|
|
65
|
+
<Step key={step} step={step} onNext={() => go("forward")} onBack={() => go("back")} />
|
|
66
|
+
</HorizontalTransition>
|
|
67
|
+
);
|
|
68
68
|
}
|
|
69
69
|
```
|
|
70
70
|
|
|
@@ -72,9 +72,9 @@ function Steps() {
|
|
|
72
72
|
|
|
73
73
|
Transitions are driven by CSS `::view-transition-*` pseudo-element rules keyed on the transition class names, not by per-component `--variable` hooks. `<Transition>` itself only ships the `overlay` rule:
|
|
74
74
|
|
|
75
|
-
| Variable | Styles
|
|
76
|
-
|
|
77
|
-
| _(none)_ | `<Transition>` exposes no own custom properties | —
|
|
75
|
+
| Variable | Styles | Default |
|
|
76
|
+
| -------- | ----------------------------------------------- | ------- |
|
|
77
|
+
| _(none)_ | `<Transition>` exposes no own custom properties | — |
|
|
78
78
|
|
|
79
79
|
The `overlay` variant sets `z-index: 100` on `::view-transition-group(.overlay)`. The preset variants document their own timing/distance hooks (`--fade-transition-duration`, `--vertical-transition-size` / `-duration`, `--horizontal-transition-size` / `-duration`) on their pages.
|
|
80
80
|
|
|
@@ -29,8 +29,8 @@ A direction-aware `<Transition>` preset that slides its children vertically —
|
|
|
29
29
|
import { VerticalTransition } from "shelving/ui";
|
|
30
30
|
|
|
31
31
|
<VerticalTransition>
|
|
32
|
-
|
|
33
|
-
</VerticalTransition
|
|
32
|
+
<Router routes={ROUTES} />
|
|
33
|
+
</VerticalTransition>;
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## Use the class without the component
|
|
@@ -42,15 +42,15 @@ import { ViewTransition } from "react";
|
|
|
42
42
|
import { SLIDE_DOWN_TRANSITION_CLASS } from "shelving/ui";
|
|
43
43
|
|
|
44
44
|
<ViewTransition enter={SLIDE_DOWN_TRANSITION_CLASS} exit={SLIDE_DOWN_TRANSITION_CLASS}>
|
|
45
|
-
|
|
46
|
-
</ViewTransition
|
|
45
|
+
<div className="panel">…</div>
|
|
46
|
+
</ViewTransition>;
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
## Styling
|
|
50
50
|
|
|
51
|
-
| Variable
|
|
52
|
-
|
|
53
|
-
| `--vertical-transition-size`
|
|
54
|
-
| `--vertical-transition-duration` | Duration of the slide keyframes
|
|
51
|
+
| Variable | Styles | Default |
|
|
52
|
+
| -------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------ |
|
|
53
|
+
| `--vertical-transition-size` | Slide distance for the enter/leave keyframes. A percentage is of the element's own height. | `100%` |
|
|
54
|
+
| `--vertical-transition-duration` | Duration of the slide keyframes | `var(--duration-normal)` |
|
|
55
55
|
|
|
56
56
|
**Global tokens it reads** — `--duration-normal`.
|
package/ui/tree/TreeApp.md
CHANGED
|
@@ -9,11 +9,11 @@ The entry point for a tree-based documentation site. Given a `TreeElement` from
|
|
|
9
9
|
- Only directories and files (plus `kind: "module"` symbols) appear in the navigation — code symbols are kept off the sidebar but still get their own pages.
|
|
10
10
|
- Every renderer is overridable. Each dispatch layer is a `[Mapping, Mapper]` pair built by `createMapper()`; wrap the app (or any subtree) in the matching `*Mapping` component to swap a renderer for one element type without touching anything else:
|
|
11
11
|
|
|
12
|
-
| Mapping pair
|
|
13
|
-
|
|
12
|
+
| Mapping pair | Overrides |
|
|
13
|
+
| -------------------------------------- | ------------------------------------------------- |
|
|
14
14
|
| `TreePageMapping` / `TreeRouterMapper` | Full-page renderer (dispatched by `<TreeRouter>`) |
|
|
15
|
-
| `TreeMenuMapping` / `TreeMenuMapper`
|
|
16
|
-
| `TreeCardMapping` / `TreeCardMapper`
|
|
15
|
+
| `TreeMenuMapping` / `TreeMenuMapper` | Sidebar menu item |
|
|
16
|
+
| `TreeCardMapping` / `TreeCardMapper` | Card in a listing |
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ The entry point for a tree-based documentation site. Given a `TreeElement` from
|
|
|
23
23
|
import { TreeApp } from "shelving/ui";
|
|
24
24
|
|
|
25
25
|
// `tree` is a TreeElement returned by DirectoryExtractor (see /extract).
|
|
26
|
-
<TreeApp tree={tree}
|
|
26
|
+
<TreeApp tree={tree} />;
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
That single line produces a complete documentation site.
|
|
@@ -33,7 +33,7 @@ That single line produces a complete documentation site.
|
|
|
33
33
|
Extra `routes` are merged before the tree routes, so they take precedence on conflicts.
|
|
34
34
|
|
|
35
35
|
```tsx
|
|
36
|
-
<TreeApp tree={tree} routes={{ "/changelog": ChangelogPage }}
|
|
36
|
+
<TreeApp tree={tree} routes={{ "/changelog": ChangelogPage }} />;
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
### Overriding a renderer
|
|
@@ -44,8 +44,8 @@ Wrap the app (or any subtree) in a `*Mapping` component to replace the renderer
|
|
|
44
44
|
import { TreeApp, TreePageMapping } from "shelving/ui";
|
|
45
45
|
|
|
46
46
|
<TreePageMapping mapping={{ "tree-element": MyTreePage }}>
|
|
47
|
-
|
|
48
|
-
</TreePageMapping
|
|
47
|
+
<TreeApp tree={tree} />
|
|
48
|
+
</TreePageMapping>;
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
The same pattern works for `TreeMenuMapping` (sidebar items) and `TreeCardMapping` (cards inside directory listings).
|
package/ui/tree/TreeMarkup.md
CHANGED
|
@@ -18,6 +18,6 @@ import { TreeMarkup } from "shelving/ui";
|
|
|
18
18
|
|
|
19
19
|
// Inline code spans link automatically: `BooleanSchema` → /schema/BooleanSchema.
|
|
20
20
|
<Prose>
|
|
21
|
-
|
|
22
|
-
</Prose
|
|
21
|
+
<TreeMarkup>{element.props.content}</TreeMarkup>
|
|
22
|
+
</Prose>;
|
|
23
23
|
```
|
package/ui/tree/TreeMenu.md
CHANGED
|
@@ -16,7 +16,7 @@ import { TreeMenu } from "shelving/ui";
|
|
|
16
16
|
import { useTreeMap } from "shelving/ui";
|
|
17
17
|
|
|
18
18
|
// Just the navigation menu from the flattened root's children.
|
|
19
|
-
<TreeMenu tree={useTreeMap().get("/")}
|
|
19
|
+
<TreeMenu tree={useTreeMap().get("/")} />;
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Override the menu-item renderer for one element type:
|
|
@@ -25,6 +25,6 @@ Override the menu-item renderer for one element type:
|
|
|
25
25
|
import { TreeApp, TreeMenuMapping } from "shelving/ui";
|
|
26
26
|
|
|
27
27
|
<TreeMenuMapping mapping={{ "tree-element": MyMenuItem }}>
|
|
28
|
-
|
|
29
|
-
</TreeMenuMapping
|
|
28
|
+
<TreeApp tree={tree} />
|
|
29
|
+
</TreeMenuMapping>;
|
|
30
30
|
```
|
package/ui/tree/TreeSidebar.md
CHANGED
package/ui/util/ClassProps.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ClassProps
|
|
2
2
|
|
|
3
|
-
The shared `className` prop most components accept — an app class merged
|
|
3
|
+
The shared `className` prop most components accept — an app class merged _after_ the classes the component computes for itself.
|
|
4
4
|
|
|
5
5
|
**Things to know:**
|
|
6
6
|
|
package/ui/util/getClass.md
CHANGED
|
@@ -36,15 +36,15 @@ import { getClass, getModuleClass, getTypographyClass } from "shelving/ui";
|
|
|
36
36
|
import BUTTON_CSS from "./Button.module.css";
|
|
37
37
|
|
|
38
38
|
export function Button({ children, ...variants }: ButtonProps): ReactElement {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
return (
|
|
40
|
+
<button
|
|
41
|
+
className={getClass(
|
|
42
|
+
getModuleClass(BUTTON_CSS, "button", variants), //
|
|
43
|
+
getTypographyClass(variants),
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
</button>
|
|
48
|
+
);
|
|
49
49
|
}
|
|
50
50
|
```
|
package/ui/util/notify.md
CHANGED
|
@@ -7,15 +7,15 @@ Dispatches a `notice` event so the global `<Notices>` list can display it. This
|
|
|
7
7
|
- The event bubbles, so any ancestor subscribed with `subscribeNotices()` receives it; it defaults to dispatching on `window`.
|
|
8
8
|
- A family of helpers builds on `notify`:
|
|
9
9
|
|
|
10
|
-
| Function
|
|
11
|
-
|
|
12
|
-
| `notify(message, status?, el?)`
|
|
13
|
-
| `notifySuccess(message, el?)`
|
|
14
|
-
| `notifyError(message, el?)`
|
|
15
|
-
| `notifyThrown(thrown, el?)`
|
|
16
|
-
| `callNotified(callback, ...args)` | Run a callback; dispatch success or error automatically
|
|
17
|
-
| `awaitNotified(promise)`
|
|
18
|
-
| `subscribeNotices(callback, el?)` | Listen for notice events; returns an unsubscribe function
|
|
10
|
+
| Function | What it does |
|
|
11
|
+
| --------------------------------- | ----------------------------------------------------------- |
|
|
12
|
+
| `notify(message, status?, el?)` | Dispatch a notice event (defaults to `window`) |
|
|
13
|
+
| `notifySuccess(message, el?)` | Shorthand for a `"success"` notice |
|
|
14
|
+
| `notifyError(message, el?)` | Shorthand for an `"error"` notice |
|
|
15
|
+
| `notifyThrown(thrown, el?)` | Extract a message from a caught value and dispatch an error |
|
|
16
|
+
| `callNotified(callback, ...args)` | Run a callback; dispatch success or error automatically |
|
|
17
|
+
| `awaitNotified(promise)` | Same for an already-pending promise |
|
|
18
|
+
| `subscribeNotices(callback, el?)` | Listen for notice events; returns an unsubscribe function |
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
@@ -31,8 +31,8 @@ import { callNotified } from "shelving/ui";
|
|
|
31
31
|
|
|
32
32
|
// Return a string for success; throw for error.
|
|
33
33
|
callNotified(async () => {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
await saveData();
|
|
35
|
+
return "Saved!";
|
|
36
36
|
});
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -14,6 +14,6 @@ Reads a React context and throws `RequiredError` if the value is `null` or `unde
|
|
|
14
14
|
import { requireContext } from "shelving/ui";
|
|
15
15
|
|
|
16
16
|
function requireNavigation(): NavigationStore {
|
|
17
|
-
|
|
17
|
+
return requireContext(NavigationContext, requireNavigation);
|
|
18
18
|
}
|
|
19
19
|
```
|