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
|
@@ -50,17 +50,17 @@ function Counter() {
|
|
|
50
50
|
|
|
51
51
|
## Styling
|
|
52
52
|
|
|
53
|
-
| Variable
|
|
54
|
-
|
|
55
|
-
| `--documentation-live-bezel`
|
|
56
|
-
| `--documentation-live-body`
|
|
57
|
-
| `--documentation-live-detail` | Colour of the speaker slot and home button
|
|
58
|
-
| `--documentation-live-edge`
|
|
59
|
-
| `--documentation-live-gap`
|
|
60
|
-
| `--documentation-live-height` | Height of the screen (one length)
|
|
61
|
-
| `--documentation-live-radius` | Corner radius of the phone
|
|
62
|
-
| `--documentation-live-space`
|
|
63
|
-
| `--documentation-live-width`
|
|
53
|
+
| Variable | Styles | Default |
|
|
54
|
+
| ----------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------- |
|
|
55
|
+
| `--documentation-live-bezel` | Space above and below the speaker slot, which sets the thickness of the top and the chin (one length) | `2.25rem` |
|
|
56
|
+
| `--documentation-live-body` | Fill of the phone | `oklch(92% 0 0deg)` (light grey) |
|
|
57
|
+
| `--documentation-live-detail` | Colour of the speaker slot and home button | `oklch(80% 0 0deg)` |
|
|
58
|
+
| `--documentation-live-edge` | Width of the phone edge left and right of the screen (one length) | `0.75rem` |
|
|
59
|
+
| `--documentation-live-gap` | Space between the code and the phone (one length) | `var(--space-normal)` (16px) |
|
|
60
|
+
| `--documentation-live-height` | Height of the screen (one length) | `26rem` |
|
|
61
|
+
| `--documentation-live-radius` | Corner radius of the phone | `2.5rem` |
|
|
62
|
+
| `--documentation-live-space` | Outer block margin (top + bottom) | `var(--space-paragraph)` (16px) |
|
|
63
|
+
| `--documentation-live-width` | Width of the phone (one length) | `22rem` |
|
|
64
64
|
|
|
65
65
|
Global tokens: `--space-normal`, `--space-xsmall`, `--space-paragraph`, `--font-label`, `--size-small`. The code block is a raw `<pre>` with `--preformatted-space` set to `0`, so it takes the other `.prose pre` styles of `<Preformatted>`. The code and phone are side by side when the screen is 75rem or wider.
|
|
66
66
|
|
|
@@ -28,7 +28,7 @@ Used automatically by `<TreeApp>`. To render a single page manually, spread the
|
|
|
28
28
|
import { DocumentationPage } from "shelving/ui";
|
|
29
29
|
|
|
30
30
|
// `element` is a `tree-documentation` element from DirectoryExtractor (see /extract).
|
|
31
|
-
<DocumentationPage {...element.props}
|
|
31
|
+
<DocumentationPage {...element.props} />;
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
To replace this renderer across the whole site, wrap the app in `TreePageMapping`.
|
|
@@ -37,8 +37,8 @@ To replace this renderer across the whole site, wrap the app in `TreePageMapping
|
|
|
37
37
|
import { TreeApp, TreePageMapping } from "shelving/ui";
|
|
38
38
|
|
|
39
39
|
<TreePageMapping mapping={{ "tree-documentation": MyDocumentationPage }}>
|
|
40
|
-
|
|
41
|
-
</TreePageMapping
|
|
40
|
+
<TreeApp tree={tree} />
|
|
41
|
+
</TreePageMapping>;
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
## Styling
|
package/docs/ui/Emphasis.md
CHANGED
|
@@ -21,16 +21,16 @@ Emphasised text — renders an `<em>` element for stress emphasis, the kind that
|
|
|
21
21
|
import { Paragraph, Emphasis } from "shelving/ui";
|
|
22
22
|
|
|
23
23
|
<Paragraph>
|
|
24
|
-
|
|
25
|
-
</Paragraph
|
|
24
|
+
You were meant to turn <Emphasis>left</Emphasis>.
|
|
25
|
+
</Paragraph>;
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Styling
|
|
29
29
|
|
|
30
30
|
`Emphasis` only sets its font style and inherits everything else from its surroundings.
|
|
31
31
|
|
|
32
|
-
| Variable
|
|
33
|
-
|
|
32
|
+
| Variable | Styles | Default |
|
|
33
|
+
| ------------------ | ---------- | -------- |
|
|
34
34
|
| `--emphasis-style` | Font style | `italic` |
|
|
35
35
|
|
|
36
36
|
|
package/docs/ui/Empty.md
CHANGED
|
@@ -24,7 +24,7 @@ import { Empty, Paragraph } from "shelving/ui";
|
|
|
24
24
|
|
|
25
25
|
<Empty>
|
|
26
26
|
<Paragraph>No challenges yet.</Paragraph>
|
|
27
|
-
</Empty
|
|
27
|
+
</Empty>;
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
### Loading list
|
|
@@ -34,7 +34,7 @@ import { EMPTY_LOADING, Loader } from "shelving/ui";
|
|
|
34
34
|
|
|
35
35
|
<Loader fallback={EMPTY_LOADING}>
|
|
36
36
|
<LoadChallenges />
|
|
37
|
-
</Loader
|
|
37
|
+
</Loader>;
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Styling
|
|
@@ -19,11 +19,11 @@ A `<Transition>` preset that fades its children in and out by animating opacity.
|
|
|
19
19
|
import { FadeTransition } from "shelving/ui";
|
|
20
20
|
|
|
21
21
|
function Panel({ visible }: { visible: boolean }) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
return visible ? (
|
|
23
|
+
<FadeTransition>
|
|
24
|
+
<div className="panel">…</div>
|
|
25
|
+
</FadeTransition>
|
|
26
|
+
) : null;
|
|
27
27
|
}
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -36,14 +36,14 @@ import { ViewTransition } from "react";
|
|
|
36
36
|
import { FADE_TRANSITION_CLASS } from "shelving/ui";
|
|
37
37
|
|
|
38
38
|
<ViewTransition enter={FADE_TRANSITION_CLASS} exit={FADE_TRANSITION_CLASS}>
|
|
39
|
-
|
|
40
|
-
</ViewTransition
|
|
39
|
+
<div className="panel">…</div>
|
|
40
|
+
</ViewTransition>;
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
## Styling
|
|
44
44
|
|
|
45
|
-
| Variable
|
|
46
|
-
|
|
45
|
+
| Variable | Styles | Default |
|
|
46
|
+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
|
|
47
47
|
| `--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)` |
|
|
48
48
|
|
|
49
49
|
**Global tokens it reads** — `--duration-fast`.
|
package/docs/ui/Field.md
CHANGED
|
@@ -21,8 +21,8 @@ The visual wrapper for a single form control. `Field` renders a `<label>` with a
|
|
|
21
21
|
import { Field, TextInput } from "shelving/ui";
|
|
22
22
|
|
|
23
23
|
<Field title="Email address" message={emailError}>
|
|
24
|
-
|
|
25
|
-
</Field
|
|
24
|
+
<TextInput name="email" value={email} onValue={setEmail} required />
|
|
25
|
+
</Field>;
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### Two-up layout
|
|
@@ -42,18 +42,18 @@ import { Field, TextInput } from "shelving/ui";
|
|
|
42
42
|
|
|
43
43
|
`Field` paints its label, description, and message text. Override these hooks at `:root` or any ancestor scope.
|
|
44
44
|
|
|
45
|
-
| Variable
|
|
46
|
-
|
|
47
|
-
| `--field-space`
|
|
48
|
-
| `--field-gap`
|
|
49
|
-
| `--field-title-size`
|
|
50
|
-
| `--field-title-leading`
|
|
51
|
-
| `--field-title-weight`
|
|
52
|
-
| `--field-title-color`
|
|
53
|
-
| `--field-description-size`
|
|
54
|
-
| `--field-description-leading` | Description line height
|
|
55
|
-
| `--field-description-weight`
|
|
56
|
-
| `--field-description-color`
|
|
45
|
+
| Variable | Styles | Default |
|
|
46
|
+
| ----------------------------- | --------------------------------------- | ------------------------------- |
|
|
47
|
+
| `--field-space` | Outer block margin (top + bottom) | `var(--space-paragraph)` (16px) |
|
|
48
|
+
| `--field-gap` | Gap between label, control, and message | `var(--space-xsmall)` |
|
|
49
|
+
| `--field-title-size` | Title font size | `var(--size-normal)` |
|
|
50
|
+
| `--field-title-leading` | Title line height | `var(--leading)` |
|
|
51
|
+
| `--field-title-weight` | Title font weight | `var(--weight-strong)` |
|
|
52
|
+
| `--field-title-color` | Title colour | `var(--tint-00)` |
|
|
53
|
+
| `--field-description-size` | Description font size | `var(--size-normal)` |
|
|
54
|
+
| `--field-description-leading` | Description line height | `var(--leading)` |
|
|
55
|
+
| `--field-description-weight` | Description font weight | `var(--weight-normal)` |
|
|
56
|
+
| `--field-description-color` | Description colour | `var(--tint-70)` |
|
|
57
57
|
|
|
58
58
|
**Global tokens it reads:** the tint ladder `--tint-00` and `--tint-70`, plus `--space-paragraph`, `--space-xsmall`, `--size-normal`, `--weight-strong`, `--weight-normal`, and `--leading`.
|
|
59
59
|
|
package/docs/ui/FixedLayout.md
CHANGED
|
@@ -24,23 +24,25 @@ import { Block, FixedLayout, Router, Scroll } from "shelving/ui";
|
|
|
24
24
|
|
|
25
25
|
// The signed-out screens: one layout around their own router.
|
|
26
26
|
<FixedLayout>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
<Scroll vertical cover>
|
|
28
|
+
<Router
|
|
29
|
+
routes={{
|
|
30
|
+
"/login": LoginPage,
|
|
31
|
+
"/register": RegisterPage,
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
</Scroll>
|
|
35
|
+
</FixedLayout>;
|
|
34
36
|
|
|
35
37
|
// Each page centres its own content.
|
|
36
38
|
function LoginPage() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
return (
|
|
40
|
+
<Page title="Log in">
|
|
41
|
+
<Block height="full" middle width="narrow" padding="xxlarge" indent="normal">
|
|
42
|
+
<LoginForm />
|
|
43
|
+
</Block>
|
|
44
|
+
</Page>
|
|
45
|
+
);
|
|
44
46
|
}
|
|
45
47
|
```
|
|
46
48
|
|
|
@@ -50,24 +52,24 @@ An app-level error, outside every other layout:
|
|
|
50
52
|
import { Catcher, ErrorPage, type ErrorProps, FixedLayout, Scroll } from "shelving/ui";
|
|
51
53
|
|
|
52
54
|
function AppError({ reason }: ErrorProps) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
return (
|
|
56
|
+
<FixedLayout>
|
|
57
|
+
<Scroll vertical cover>
|
|
58
|
+
<ErrorPage reason={reason} />
|
|
59
|
+
</Scroll>
|
|
60
|
+
</FixedLayout>
|
|
61
|
+
);
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
<Catcher as={AppError}>…</Catcher
|
|
64
|
+
<Catcher as={AppError}>…</Catcher>;
|
|
63
65
|
```
|
|
64
66
|
|
|
65
67
|
## Styling
|
|
66
68
|
|
|
67
|
-
| Variable
|
|
68
|
-
|
|
69
|
+
| Variable | Styles | Default |
|
|
70
|
+
| --------------------------- | ------------------------------------------- | ------------------------- |
|
|
69
71
|
| `--fixed-layout-background` | Page background while the layout is mounted | `var(--tint-100)` (white) |
|
|
70
|
-
| `--fixed-layout-color`
|
|
72
|
+
| `--fixed-layout-color` | Text colour for the layout | `var(--tint-00)` (black) |
|
|
71
73
|
|
|
72
74
|
**Global tokens it reads** — `--tint-00` and `--tint-100`.
|
|
73
75
|
|
package/docs/ui/Form.md
CHANGED
|
@@ -28,21 +28,21 @@ import { Form } from "shelving/ui";
|
|
|
28
28
|
import { DATA, StringSchema, NumberSchema } from "shelving/schema";
|
|
29
29
|
|
|
30
30
|
const PRODUCT_SCHEMA = DATA({
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
name: new StringSchema({ title: "Name", min: 1, max: 100 }),
|
|
32
|
+
price: new NumberSchema({ title: "Price", min: 0 }),
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
export function NewProductForm() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
return (
|
|
37
|
+
<Form
|
|
38
|
+
schema={PRODUCT_SCHEMA}
|
|
39
|
+
submit="Create product"
|
|
40
|
+
onSubmit={async data => {
|
|
41
|
+
await createProduct(data);
|
|
42
|
+
return "Product created"; // dispatched as a success notice
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
46
|
}
|
|
47
47
|
```
|
|
48
48
|
|
|
@@ -53,23 +53,23 @@ import { Form } from "shelving/ui";
|
|
|
53
53
|
import { DATA, StringSchema, NumberSchema, BOOLEAN } from "shelving/schema";
|
|
54
54
|
|
|
55
55
|
const LISTING_SCHEMA = DATA({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
title: new StringSchema({ title: "Title", min: 1, max: 80 }),
|
|
57
|
+
price: new NumberSchema({ title: "Price", min: 0 }),
|
|
58
|
+
published: BOOLEAN,
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
export function ListingForm({ listing }: { listing?: typeof LISTING_SCHEMA.type }) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
return (
|
|
63
|
+
<Form
|
|
64
|
+
schema={LISTING_SCHEMA}
|
|
65
|
+
data={listing}
|
|
66
|
+
submit={listing ? "Save changes" : "Publish listing"}
|
|
67
|
+
onSubmit={async data => {
|
|
68
|
+
await saveListing(data);
|
|
69
|
+
return listing ? "Listing updated" : "Listing published";
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
73
|
}
|
|
74
74
|
```
|
|
75
75
|
|
|
@@ -81,19 +81,21 @@ Provide explicit `children` when you need control over field order, groupings, o
|
|
|
81
81
|
import { Form, Field, FormInput, SubmitButton, Button, FormMessage } from "shelving/ui";
|
|
82
82
|
|
|
83
83
|
<Form schema={LISTING_SCHEMA} data={listing} onSubmit={handleSubmit}>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
<Field title="Title" required>
|
|
85
|
+
<FormInput name="title" />
|
|
86
|
+
</Field>
|
|
87
|
+
<Field title="Price">
|
|
88
|
+
<FormInput name="price" />
|
|
89
|
+
</Field>
|
|
90
|
+
<FormInput name="published" />
|
|
91
|
+
<footer>
|
|
92
|
+
<SubmitButton>Save changes</SubmitButton>
|
|
93
|
+
<Button plain onClick={onCancel}>
|
|
94
|
+
Cancel
|
|
95
|
+
</Button>
|
|
96
|
+
<FormMessage />
|
|
97
|
+
</footer>
|
|
98
|
+
</Form>;
|
|
97
99
|
```
|
|
98
100
|
|
|
99
101
|
## Notices and error surfacing
|
package/docs/ui/FormStore.md
CHANGED
|
@@ -42,8 +42,12 @@ const data = store.validated; // Fully-typed data, or throws a string message.
|
|
|
42
42
|
import { requireForm } from "shelving/ui";
|
|
43
43
|
|
|
44
44
|
function ResetButton() {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const store = requireForm();
|
|
46
|
+
return (
|
|
47
|
+
<Button plain onClick={() => store.set("name", "")}>
|
|
48
|
+
Clear name
|
|
49
|
+
</Button>
|
|
50
|
+
);
|
|
47
51
|
}
|
|
48
52
|
```
|
|
49
53
|
|
package/docs/ui/Grid.md
CHANGED
|
@@ -22,11 +22,19 @@ A grid container that arranges its children in equal-width columns. Renders a `<
|
|
|
22
22
|
import { Card, Grid, Paragraph } from "shelving/ui";
|
|
23
23
|
|
|
24
24
|
<Grid gap="small">
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</
|
|
25
|
+
<Card>
|
|
26
|
+
<Paragraph>Running</Paragraph>
|
|
27
|
+
</Card>
|
|
28
|
+
<Card>
|
|
29
|
+
<Paragraph>Cycling</Paragraph>
|
|
30
|
+
</Card>
|
|
31
|
+
<Card>
|
|
32
|
+
<Paragraph>Swimming</Paragraph>
|
|
33
|
+
</Card>
|
|
34
|
+
<Card>
|
|
35
|
+
<Paragraph>Rowing</Paragraph>
|
|
36
|
+
</Card>
|
|
37
|
+
</Grid>;
|
|
30
38
|
```
|
|
31
39
|
|
|
32
40
|
### A list of tiles
|
|
@@ -35,8 +43,10 @@ import { Card, Grid, Paragraph } from "shelving/ui";
|
|
|
35
43
|
import { Grid } from "shelving/ui";
|
|
36
44
|
|
|
37
45
|
<Grid as="ul" columns={3} gap="normal">
|
|
38
|
-
|
|
39
|
-
</
|
|
46
|
+
{badges.map(badge => (
|
|
47
|
+
<li key={badge.id}>{badge.name}</li>
|
|
48
|
+
))}
|
|
49
|
+
</Grid>;
|
|
40
50
|
```
|
|
41
51
|
|
|
42
52
|
### Days of the week
|
|
@@ -45,8 +55,10 @@ import { Grid } from "shelving/ui";
|
|
|
45
55
|
import { Grid } from "shelving/ui";
|
|
46
56
|
|
|
47
57
|
<Grid as="ol" columns={7} gap="xsmall">
|
|
48
|
-
|
|
49
|
-
</
|
|
58
|
+
{days.map(day => (
|
|
59
|
+
<li key={day.date}>{day.label}</li>
|
|
60
|
+
))}
|
|
61
|
+
</Grid>;
|
|
50
62
|
```
|
|
51
63
|
|
|
52
64
|
## Styling
|
package/docs/ui/HTML.md
CHANGED
|
@@ -22,14 +22,16 @@ import { Navigation, Router } from "shelving/ui";
|
|
|
22
22
|
|
|
23
23
|
// Server-side render — pass the request URL to <HTML>.
|
|
24
24
|
renderToString(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
<HTML app="My App" root="https://example.com/" url={requestUrl} language="en">
|
|
26
|
+
<Navigation>
|
|
27
|
+
<Router
|
|
28
|
+
routes={{
|
|
29
|
+
"/": HomePage,
|
|
30
|
+
"/about": AboutPage,
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</Navigation>
|
|
34
|
+
</HTML>,
|
|
33
35
|
);
|
|
34
36
|
```
|
|
35
37
|
|
package/docs/ui/Head.md
CHANGED
package/docs/ui/Heading.md
CHANGED
|
@@ -41,30 +41,30 @@ import { Title, Heading, Subheading } from "shelving/ui";
|
|
|
41
41
|
```tsx live
|
|
42
42
|
import { Heading } from "shelving/ui";
|
|
43
43
|
|
|
44
|
-
<Heading color="red">Danger zone</Heading
|
|
44
|
+
<Heading color="red">Danger zone</Heading>;
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
## Styling
|
|
48
48
|
|
|
49
49
|
`Heading` exposes hooks for its rhythm and type. It inherits text colour by default (so it picks up the surrounding tint); set `--heading-color` only to override that.
|
|
50
50
|
|
|
51
|
-
| Variable
|
|
52
|
-
|
|
53
|
-
| `--heading-color`
|
|
54
|
-
| `--heading-space-before` | Top margin
|
|
55
|
-
| `--heading-space`
|
|
56
|
-
| `--heading-font`
|
|
57
|
-
| `--heading-weight`
|
|
58
|
-
| `--heading-size`
|
|
59
|
-
| `--heading-leading`
|
|
51
|
+
| Variable | Styles | Default |
|
|
52
|
+
| ------------------------ | ------------- | ------------------------------- |
|
|
53
|
+
| `--heading-color` | Text colour | `inherit` |
|
|
54
|
+
| `--heading-space-before` | Top margin | `var(--space-section)` (2rem) |
|
|
55
|
+
| `--heading-space` | Bottom margin | `var(--space-paragraph)` (16px) |
|
|
56
|
+
| `--heading-font` | Font family | `var(--font-title)` |
|
|
57
|
+
| `--heading-weight` | Font weight | `var(--weight-strong)` (700) |
|
|
58
|
+
| `--heading-size` | Font size | `var(--size-xxlarge)` |
|
|
59
|
+
| `--heading-leading` | Line height | `var(--leading)` |
|
|
60
60
|
|
|
61
61
|
**Global tokens it reads:** `--space-section`, `--space-paragraph`, `--font-title`, `--weight-strong`, `--size-xxlarge`, and `--leading`. (`<Title>` and `<Subheading>` share this component and expose the parallel `--title-*` / `--subheading-*` hooks.)
|
|
62
62
|
|
|
63
63
|
```css
|
|
64
64
|
/* Theme: serif headings, a touch larger. */
|
|
65
65
|
:root {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
--heading-font: var(--font-serif);
|
|
67
|
+
--heading-size: 3rem;
|
|
68
68
|
}
|
|
69
69
|
```
|
|
70
70
|
|
|
@@ -35,10 +35,10 @@ import { HorizontalTransition, Navigation, Router } from "shelving/ui";
|
|
|
35
35
|
|
|
36
36
|
// Links slide right, the browser back button slides left.
|
|
37
37
|
<Navigation>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</Navigation
|
|
38
|
+
<HorizontalTransition>
|
|
39
|
+
<Router routes={ROUTES} />
|
|
40
|
+
</HorizontalTransition>
|
|
41
|
+
</Navigation>;
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
## Use the class without the component
|
|
@@ -50,16 +50,16 @@ import { ViewTransition } from "react";
|
|
|
50
50
|
import { SLIDE_RIGHT_TRANSITION_CLASS } from "shelving/ui";
|
|
51
51
|
|
|
52
52
|
<ViewTransition enter={SLIDE_RIGHT_TRANSITION_CLASS} exit={SLIDE_RIGHT_TRANSITION_CLASS}>
|
|
53
|
-
|
|
54
|
-
</ViewTransition
|
|
53
|
+
<div className="panel">…</div>
|
|
54
|
+
</ViewTransition>;
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
## Styling
|
|
58
58
|
|
|
59
|
-
| Variable
|
|
60
|
-
|
|
61
|
-
| `--horizontal-transition-size`
|
|
62
|
-
| `--horizontal-transition-duration` | Duration of the slide keyframes
|
|
59
|
+
| Variable | Styles | Default |
|
|
60
|
+
| ---------------------------------- | ----------------------------------------------------------------------------------------- | ------------------------ |
|
|
61
|
+
| `--horizontal-transition-size` | Slide distance for the enter/leave keyframes. A percentage is of the element's own width. | `100%` |
|
|
62
|
+
| `--horizontal-transition-duration` | Duration of the slide keyframes | `var(--duration-normal)` |
|
|
63
63
|
|
|
64
64
|
**Global tokens it reads** — `--duration-normal`.
|
|
65
65
|
|
package/docs/ui/Icon.md
CHANGED
|
@@ -27,10 +27,10 @@ import { Icon } from "shelving/ui";
|
|
|
27
27
|
|
|
28
28
|
## Styling
|
|
29
29
|
|
|
30
|
-
| Variable
|
|
31
|
-
|
|
32
|
-
| `--icon-color` | Icon colour
|
|
33
|
-
| `--icon-size`
|
|
30
|
+
| Variable | Styles | Default |
|
|
31
|
+
| -------------- | ------------------- | ------------------------------------------------------------------------------- |
|
|
32
|
+
| `--icon-color` | Icon colour | `var(--tint-50)` (the status tint, e.g. `--color-failure` for `status="error"`) |
|
|
33
|
+
| `--icon-size` | Icon width / height | `var(--size-icon)` (1.5rem) |
|
|
34
34
|
|
|
35
35
|
**Global tokens it reads** — the status tint anchor `--tint-50`, `--size-icon` (the unset-`size` default), plus the size tokens `--size-small` / `--size-normal` / `--size-large` / `--size-xlarge` / `--size-xxlarge` used by the `size` prop.
|
|
36
36
|
|
package/docs/ui/ImageInput.md
CHANGED
|
@@ -27,8 +27,8 @@ A large square image picker. With no image, it shows a "Choose…" button in the
|
|
|
27
27
|
import { ImageInput } from "shelving/ui";
|
|
28
28
|
|
|
29
29
|
function PhotoPicker() {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const [photo, setPhoto] = useState<File>();
|
|
31
|
+
return <ImageInput name="photo" title="Photo" value={photo} onValue={setPhoto} />;
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
34
|
|
|
@@ -38,22 +38,22 @@ function PhotoPicker() {
|
|
|
38
38
|
import { ImageInput } from "shelving/ui";
|
|
39
39
|
|
|
40
40
|
// Shows the saved photo. A new pick calls `onValue` with the new `File`.
|
|
41
|
-
<ImageInput name="photo" value={user.photoURL} onValue={upload}
|
|
41
|
+
<ImageInput name="photo" value={user.photoURL} onValue={upload} />;
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
## Styling
|
|
45
45
|
|
|
46
46
|
`ImageInput` paints from the [tint ladder](/ui/TINT_CLASS). The "Choose…" and X buttons are `<Button>` styles, so `--button-*` hooks also move them.
|
|
47
47
|
|
|
48
|
-
| Variable
|
|
49
|
-
|
|
50
|
-
| `--image-input-space`
|
|
51
|
-
| `--image-input-radius`
|
|
52
|
-
| `--image-input-background`
|
|
53
|
-
| `--image-input-preview-background` | Background behind the picked image, seen through a transparent image | `#000`
|
|
54
|
-
| `--image-input-focus-border`
|
|
55
|
-
| `--image-input-invalid-border`
|
|
56
|
-
| `--image-input-clear-inset`
|
|
48
|
+
| Variable | Styles | Default |
|
|
49
|
+
| ---------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------ |
|
|
50
|
+
| `--image-input-space` | Space above and below the square | `var(--space-small)` (12px) |
|
|
51
|
+
| `--image-input-radius` | Corner radius of the square | `var(--radius-small)` (12px) |
|
|
52
|
+
| `--image-input-background` | Square background when empty | `var(--tint-90)` |
|
|
53
|
+
| `--image-input-preview-background` | Background behind the picked image, seen through a transparent image | `#000` |
|
|
54
|
+
| `--image-input-focus-border` | Outline when the input has focus | `var(--stroke-focus) solid var(--color-focus)` |
|
|
55
|
+
| `--image-input-invalid-border` | Outline when `message` is set | `var(--stroke-focus) solid var(--color-failure)` |
|
|
56
|
+
| `--image-input-clear-inset` | Distance of the X button from the top and end edges | `var(--space-small)` (12px) |
|
|
57
57
|
|
|
58
58
|
Global tokens it reads: `--tint-90`, `--space-small`, `--radius-small`, `--stroke-focus`, `--color-focus`, `--color-failure`.
|
|
59
59
|
|
package/docs/ui/Inserted.md
CHANGED
|
@@ -21,19 +21,19 @@ Inserted text — renders an `<ins>` element to mark content that has been added
|
|
|
21
21
|
import { Paragraph, Deleted, Inserted } from "shelving/ui";
|
|
22
22
|
|
|
23
23
|
<Paragraph>
|
|
24
|
-
|
|
25
|
-
</Paragraph
|
|
24
|
+
Was <Deleted>$50</Deleted> <Inserted>$35</Inserted>.
|
|
25
|
+
</Paragraph>;
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Styling
|
|
29
29
|
|
|
30
30
|
`Inserted` colours its text directly from `--color-green` (not the tint ladder), so insertions stay a consistent green regardless of the surrounding tint. Override `--inserted-color` to recolour.
|
|
31
31
|
|
|
32
|
-
| Variable
|
|
33
|
-
|
|
34
|
-
| `--inserted-color`
|
|
32
|
+
| Variable | Styles | Default |
|
|
33
|
+
| ----------------------- | --------------- | -------------------------------- |
|
|
34
|
+
| `--inserted-color` | Text colour | `var(--color-green)` |
|
|
35
35
|
| `--inserted-decoration` | Text decoration | `underline var(--stroke-normal)` |
|
|
36
|
-
| `--inserted-weight`
|
|
36
|
+
| `--inserted-weight` | Font weight | `var(--weight-strong)` |
|
|
37
37
|
|
|
38
38
|
**Global tokens it reads:** `--color-green`, `--stroke-normal`, and `--weight-strong`.
|
|
39
39
|
|