@slotform/react-ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +44 -2
- package/dist/density.d.ts +4 -0
- package/dist/density.d.ts.map +1 -0
- package/dist/density.js +8 -0
- package/dist/density.js.map +1 -0
- package/dist/index.d.ts +400 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +388 -0
- package/dist/index.js.map +1 -0
- package/dist/node/canvas.d.ts +3 -0
- package/dist/node/canvas.d.ts.map +1 -0
- package/dist/node/canvas.js +13 -0
- package/dist/node/canvas.js.map +1 -0
- package/dist/node/codegen.d.ts +6 -0
- package/dist/node/codegen.d.ts.map +1 -0
- package/dist/node/codegen.js +70 -0
- package/dist/node/codegen.js.map +1 -0
- package/dist/node/css-escape.d.ts +8 -0
- package/dist/node/css-escape.d.ts.map +1 -0
- package/dist/node/css-escape.js +12 -0
- package/dist/node/css-escape.js.map +1 -0
- package/dist/node/fonts.d.ts +6 -0
- package/dist/node/fonts.d.ts.map +1 -0
- package/dist/node/fonts.js +219 -0
- package/dist/node/fonts.js.map +1 -0
- package/dist/node/lint.d.ts +3 -0
- package/dist/node/lint.d.ts.map +1 -0
- package/dist/node/lint.js +23 -0
- package/dist/node/lint.js.map +1 -0
- package/dist/node/mode.d.ts +9 -0
- package/dist/node/mode.d.ts.map +1 -0
- package/dist/node/mode.js +38 -0
- package/dist/node/mode.js.map +1 -0
- package/dist/node/theme.d.ts +13 -0
- package/dist/node/theme.d.ts.map +1 -0
- package/dist/node/theme.js +160 -0
- package/dist/node/theme.js.map +1 -0
- package/dist/types.d.ts +250 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +80 -0
- package/dist/types.js.map +1 -0
- package/guide/acts.md +61 -0
- package/guide/audio.md +77 -0
- package/guide/blocks.md +82 -0
- package/guide/canvas-choosing.md +34 -0
- package/guide/canvas-editing.md +36 -0
- package/guide/canvas-layout.md +46 -0
- package/guide/canvas-opening.md +47 -0
- package/guide/canvas-overview.md +24 -0
- package/guide/canvas-states.md +37 -0
- package/guide/canvas-view.md +46 -0
- package/guide/canvas.md +94 -0
- package/guide/containers.md +60 -0
- package/guide/content.md +40 -0
- package/guide/controls.md +89 -0
- package/guide/density.md +48 -0
- package/guide/dock.md +42 -0
- package/guide/drag.md +38 -0
- package/guide/figures.md +25 -0
- package/guide/forms.md +82 -0
- package/guide/pane-bar.md +11 -0
- package/guide/pane.md +50 -0
- package/guide/reference.md +74 -0
- package/guide/rules.md +109 -0
- package/guide/section.md +29 -0
- package/guide/shell.md +26 -0
- package/guide/shots.md +37 -0
- package/guide/sidebar.md +30 -0
- package/guide/table.md +119 -0
- package/lint/no-arbitrary-value.grit +9 -0
- package/lint/no-class-on-component.grit +12 -0
- package/lint/no-density.grit +8 -0
- package/lint/no-host-look.grit +38 -0
- package/lint/no-img.grit +10 -0
- package/lint/no-navigate-act.grit +22 -0
- package/lint/no-raw-style.grit +8 -0
- package/package.json +150 -3
- package/src/density.ts +9 -0
- package/src/index.ts +503 -0
- package/src/node/canvas.ts +14 -0
- package/src/node/codegen.ts +100 -0
- package/src/node/css-escape.ts +27 -0
- package/src/node/fonts.ts +260 -0
- package/src/node/lint.ts +25 -0
- package/src/node/mode.ts +64 -0
- package/src/node/theme.ts +232 -0
- package/src/types.ts +120 -0
- package/src/ui/atoms/avatar/base.tsx +42 -0
- package/src/ui/atoms/button/glyph.tsx +244 -0
- package/src/ui/atoms/button/link.tsx +81 -0
- package/src/ui/atoms/button/look.ts +32 -0
- package/src/ui/atoms/button/reason.tsx +69 -0
- package/src/ui/atoms/chip/base.tsx +85 -0
- package/src/ui/atoms/count/base.tsx +27 -0
- package/src/ui/atoms/icon/index.tsx +51 -0
- package/src/ui/atoms/message/waiting.tsx +19 -0
- package/src/ui/atoms/prose/painted.tsx +35 -0
- package/src/ui/atoms/row/badges.tsx +226 -0
- package/src/ui/atoms/row/leading.tsx +166 -0
- package/src/ui/atoms/row/lock.tsx +17 -0
- package/src/ui/atoms/row/marks.tsx +79 -0
- package/src/ui/atoms/section/card.tsx +27 -0
- package/src/ui/atoms/spinner/index.tsx +42 -0
- package/src/ui/atoms/status/base.tsx +51 -0
- package/src/ui/atoms/status/change.tsx +29 -0
- package/src/ui/atoms/status/dot.tsx +45 -0
- package/src/ui/atoms/switch/checkbox.tsx +121 -0
- package/src/ui/atoms/turn.tsx +28 -0
- package/src/ui/components/action-bar/base.tsx +276 -0
- package/src/ui/components/action-bar/index.tsx +20 -0
- package/src/ui/components/avatar/index.tsx +21 -0
- package/src/ui/components/banner/index.tsx +207 -0
- package/src/ui/components/banner/pending.tsx +109 -0
- package/src/ui/components/bar-chart/index.tsx +701 -0
- package/src/ui/components/button/base.tsx +214 -0
- package/src/ui/components/button/face.tsx +84 -0
- package/src/ui/components/button/index.tsx +206 -0
- package/src/ui/components/canvas/connection.tsx +26 -0
- package/src/ui/components/canvas/edges.tsx +116 -0
- package/src/ui/components/canvas/elk.ts +260 -0
- package/src/ui/components/canvas/floor.ts +173 -0
- package/src/ui/components/canvas/geometry.ts +772 -0
- package/src/ui/components/canvas/ground.tsx +97 -0
- package/src/ui/components/canvas/group.tsx +156 -0
- package/src/ui/components/canvas/hit.ts +40 -0
- package/src/ui/components/canvas/index.tsx +497 -0
- package/src/ui/components/canvas/label.tsx +53 -0
- package/src/ui/components/canvas/layout.ts +543 -0
- package/src/ui/components/canvas/lift.ts +272 -0
- package/src/ui/components/canvas/look.ts +129 -0
- package/src/ui/components/canvas/node.tsx +689 -0
- package/src/ui/components/canvas/open.ts +243 -0
- package/src/ui/components/canvas/opening.ts +240 -0
- package/src/ui/components/canvas/view.ts +621 -0
- package/src/ui/components/canvas/viewport.ts +417 -0
- package/src/ui/components/canvas/zoom.tsx +113 -0
- package/src/ui/components/card/index.tsx +20 -0
- package/src/ui/components/chip/index.tsx +24 -0
- package/src/ui/components/code/frame.ts +2 -0
- package/src/ui/components/code/index.tsx +234 -0
- package/src/ui/components/columns/index.tsx +51 -0
- package/src/ui/components/count/index.tsx +17 -0
- package/src/ui/components/diff/index.tsx +249 -0
- package/src/ui/components/diff/word.tsx +104 -0
- package/src/ui/components/dock/index.tsx +262 -0
- package/src/ui/components/file-row/index.tsx +213 -0
- package/src/ui/components/form/base.tsx +280 -0
- package/src/ui/components/form/derive.tsx +269 -0
- package/src/ui/components/form/index.tsx +49 -0
- package/src/ui/components/form/saved.tsx +39 -0
- package/src/ui/components/form-field/index.tsx +658 -0
- package/src/ui/components/gallery/index.tsx +83 -0
- package/src/ui/components/gate/index.tsx +183 -0
- package/src/ui/components/image/base.tsx +245 -0
- package/src/ui/components/image/index.tsx +58 -0
- package/src/ui/components/input/base.tsx +246 -0
- package/src/ui/components/input/code.tsx +108 -0
- package/src/ui/components/input/drop.ts +37 -0
- package/src/ui/components/input/file.tsx +154 -0
- package/src/ui/components/input/index.tsx +132 -0
- package/src/ui/components/input/prose.tsx +107 -0
- package/src/ui/components/input/refusal.tsx +30 -0
- package/src/ui/components/item-header/base.tsx +410 -0
- package/src/ui/components/menu/base.tsx +319 -0
- package/src/ui/components/message/attachments.tsx +101 -0
- package/src/ui/components/message/base.tsx +266 -0
- package/src/ui/components/message-input/index.tsx +377 -0
- package/src/ui/components/missing/base.tsx +45 -0
- package/src/ui/components/pane/head.tsx +399 -0
- package/src/ui/components/pane/index.tsx +325 -0
- package/src/ui/components/picker/base.tsx +1551 -0
- package/src/ui/components/picker/index.tsx +224 -0
- package/src/ui/components/picker/list.tsx +423 -0
- package/src/ui/components/picker/segments.tsx +183 -0
- package/src/ui/components/prose/index.tsx +259 -0
- package/src/ui/components/qr-code/index.tsx +65 -0
- package/src/ui/components/row/acts.tsx +126 -0
- package/src/ui/components/row/fact.tsx +54 -0
- package/src/ui/components/row/index.tsx +1370 -0
- package/src/ui/components/row/progress.tsx +38 -0
- package/src/ui/components/row/status.tsx +54 -0
- package/src/ui/components/row/title.ts +7 -0
- package/src/ui/components/rules/index.tsx +290 -0
- package/src/ui/components/section/band.tsx +39 -0
- package/src/ui/components/section/head.tsx +267 -0
- package/src/ui/components/section/index.tsx +409 -0
- package/src/ui/components/section/rows.tsx +356 -0
- package/src/ui/components/sheet/base.tsx +272 -0
- package/src/ui/components/sheet/confirm.tsx +79 -0
- package/src/ui/components/sheet/docked.tsx +218 -0
- package/src/ui/components/sheet/form.tsx +76 -0
- package/src/ui/components/sheet/head.tsx +120 -0
- package/src/ui/components/sheet/index.tsx +45 -0
- package/src/ui/components/sheet/layer.tsx +168 -0
- package/src/ui/components/sheet/outlet.tsx +58 -0
- package/src/ui/components/sheet/task.tsx +41 -0
- package/src/ui/components/shell/cut.tsx +116 -0
- package/src/ui/components/shell/drag.tsx +45 -0
- package/src/ui/components/shell/host.tsx +71 -0
- package/src/ui/components/shell/index.tsx +737 -0
- package/src/ui/components/shell/panes.tsx +76 -0
- package/src/ui/components/shell/preview.ts +230 -0
- package/src/ui/components/shell/rail.tsx +163 -0
- package/src/ui/components/shell/row.ts +11 -0
- package/src/ui/components/shell/switcher.tsx +143 -0
- package/src/ui/components/shell/tree.tsx +252 -0
- package/src/ui/components/slider/base.tsx +139 -0
- package/src/ui/components/slider/index.tsx +57 -0
- package/src/ui/components/stages/index.tsx +198 -0
- package/src/ui/components/stats/count-links.tsx +47 -0
- package/src/ui/components/stats/index.tsx +203 -0
- package/src/ui/components/stats/meter.tsx +213 -0
- package/src/ui/components/stats/parts.ts +10 -0
- package/src/ui/components/step-count/index.tsx +45 -0
- package/src/ui/components/switch/base.tsx +86 -0
- package/src/ui/components/switch/index.tsx +38 -0
- package/src/ui/components/table/columns.tsx +131 -0
- package/src/ui/components/table/index.tsx +2215 -0
- package/src/ui/components/text/index.tsx +37 -0
- package/src/ui/components/thread/index.tsx +503 -0
- package/src/ui/components/thread/latest.tsx +59 -0
- package/src/ui/components/toast/index.tsx +113 -0
- package/src/ui/components/toast/layer.tsx +26 -0
- package/src/ui/components/toolbar/filters.tsx +161 -0
- package/src/ui/components/toolbar/index.tsx +125 -0
- package/src/ui/components/waveform/index.tsx +205 -0
- package/src/ui/globals.css +427 -0
- package/src/ui/lib/act.ts +60 -0
- package/src/ui/lib/age.ts +49 -0
- package/src/ui/lib/bound.ts +16 -0
- package/src/ui/lib/canvas-layout.ts +11 -0
- package/src/ui/lib/caret.ts +9 -0
- package/src/ui/lib/chip-lines.ts +3 -0
- package/src/ui/lib/closed.ts +8 -0
- package/src/ui/lib/code.tsx +184 -0
- package/src/ui/lib/columns.ts +39 -0
- package/src/ui/lib/commit.ts +24 -0
- package/src/ui/lib/container.ts +112 -0
- package/src/ui/lib/copy.ts +29 -0
- package/src/ui/lib/drag.ts +575 -0
- package/src/ui/lib/empty.tsx +85 -0
- package/src/ui/lib/field.ts +39 -0
- package/src/ui/lib/focus.ts +175 -0
- package/src/ui/lib/folds.ts +67 -0
- package/src/ui/lib/follow.ts +220 -0
- package/src/ui/lib/form.ts +19 -0
- package/src/ui/lib/guards.ts +38 -0
- package/src/ui/lib/heading.ts +14 -0
- package/src/ui/lib/ink.ts +26 -0
- package/src/ui/lib/lang.ts +7 -0
- package/src/ui/lib/leave.ts +14 -0
- package/src/ui/lib/lockup.tsx +145 -0
- package/src/ui/lib/measure.ts +22 -0
- package/src/ui/lib/media.ts +63 -0
- package/src/ui/lib/modality.ts +69 -0
- package/src/ui/lib/moment.ts +13 -0
- package/src/ui/lib/more.tsx +76 -0
- package/src/ui/lib/navigate.ts +210 -0
- package/src/ui/lib/noop.ts +3 -0
- package/src/ui/lib/not-found.tsx +40 -0
- package/src/ui/lib/paint.tsx +55 -0
- package/src/ui/lib/parts-line.tsx +54 -0
- package/src/ui/lib/picked.ts +18 -0
- package/src/ui/lib/player-store.ts +38 -0
- package/src/ui/lib/player.ts +139 -0
- package/src/ui/lib/portal.ts +12 -0
- package/src/ui/lib/read.tsx +269 -0
- package/src/ui/lib/region.tsx +49 -0
- package/src/ui/lib/reorder.ts +154 -0
- package/src/ui/lib/rest.ts +16 -0
- package/src/ui/lib/saved.ts +29 -0
- package/src/ui/lib/scramble.tsx +147 -0
- package/src/ui/lib/scrolls.ts +70 -0
- package/src/ui/lib/style.ts +6 -0
- package/src/ui/lib/swap.tsx +107 -0
- package/src/ui/lib/toast.ts +39 -0
- package/src/ui/lib/walk-classes.ts +16 -0
- package/src/ui/lib/window.tsx +376 -0
- package/src/ui/worker.d.ts +4 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const cssImportSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
3
|
+
url: z.ZodString;
|
|
4
|
+
layer: z.ZodOptional<z.ZodString>;
|
|
5
|
+
supports: z.ZodOptional<z.ZodString>;
|
|
6
|
+
source: z.ZodOptional<z.ZodLiteral<"none">>;
|
|
7
|
+
}, z.core.$strip>]>;
|
|
8
|
+
export type CssImport = z.input<typeof cssImportSchema>;
|
|
9
|
+
export declare const cssLayerSchema: z.ZodObject<{
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
content: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type CssLayer = z.input<typeof cssLayerSchema>;
|
|
14
|
+
export declare const cssBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
15
|
+
kind: z.ZodLiteral<"theme">;
|
|
16
|
+
declarations: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
17
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
18
|
+
kind: z.ZodLiteral<"utility">;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
declarations: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
21
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
22
|
+
kind: z.ZodLiteral<"variant">;
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
content: z.ZodString;
|
|
25
|
+
}, z.core.$strip>], "kind">;
|
|
26
|
+
export type CssBlock = z.input<typeof cssBlockSchema>;
|
|
27
|
+
export declare const cssSourceInlineSchema: z.ZodString;
|
|
28
|
+
export type CssSourceInline = z.input<typeof cssSourceInlineSchema>;
|
|
29
|
+
export interface CodegenAppCssPayload {
|
|
30
|
+
imports: CssImport[];
|
|
31
|
+
sources: CssSourceInline[];
|
|
32
|
+
blocks: CssBlock[];
|
|
33
|
+
layers: CssLayer[];
|
|
34
|
+
}
|
|
35
|
+
declare const fontEntrySchema: z.ZodObject<{
|
|
36
|
+
family: z.ZodString;
|
|
37
|
+
specifier: z.ZodString;
|
|
38
|
+
weight: z.ZodString;
|
|
39
|
+
style: z.ZodEnum<{
|
|
40
|
+
italic: "italic";
|
|
41
|
+
normal: "normal";
|
|
42
|
+
}>;
|
|
43
|
+
fallback: z.ZodObject<{
|
|
44
|
+
family: z.ZodString;
|
|
45
|
+
ascentOverride: z.ZodString;
|
|
46
|
+
descentOverride: z.ZodString;
|
|
47
|
+
lineGapOverride: z.ZodString;
|
|
48
|
+
sizeAdjust: z.ZodString;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export type FontEntry = z.infer<typeof fontEntrySchema>;
|
|
52
|
+
export declare const reactUiOptionsSchema: z.ZodObject<{
|
|
53
|
+
fonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
54
|
+
family: z.ZodString;
|
|
55
|
+
specifier: z.ZodString;
|
|
56
|
+
weight: z.ZodString;
|
|
57
|
+
style: z.ZodEnum<{
|
|
58
|
+
italic: "italic";
|
|
59
|
+
normal: "normal";
|
|
60
|
+
}>;
|
|
61
|
+
fallback: z.ZodObject<{
|
|
62
|
+
family: z.ZodString;
|
|
63
|
+
ascentOverride: z.ZodString;
|
|
64
|
+
descentOverride: z.ZodString;
|
|
65
|
+
lineGapOverride: z.ZodString;
|
|
66
|
+
sizeAdjust: z.ZodString;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
}, z.core.$strip>>>;
|
|
69
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
hue: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
accent: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
cast: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
}, z.core.$strict>>;
|
|
74
|
+
radius: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
fonts: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
sans: z.ZodOptional<z.ZodString>;
|
|
78
|
+
mono: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
defaultMode: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
dark: "dark";
|
|
82
|
+
light: "light";
|
|
83
|
+
}>>;
|
|
84
|
+
loading: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
text: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
pulse: "pulse";
|
|
87
|
+
scramble: "scramble";
|
|
88
|
+
}>>;
|
|
89
|
+
figure: z.ZodOptional<z.ZodEnum<{
|
|
90
|
+
pulse: "pulse";
|
|
91
|
+
scramble: "scramble";
|
|
92
|
+
}>>;
|
|
93
|
+
id: z.ZodOptional<z.ZodEnum<{
|
|
94
|
+
pulse: "pulse";
|
|
95
|
+
scramble: "scramble";
|
|
96
|
+
}>>;
|
|
97
|
+
}, z.core.$strict>>;
|
|
98
|
+
}, z.core.$strict>>;
|
|
99
|
+
words: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
actFailed: z.ZodString;
|
|
101
|
+
actions: z.ZodString;
|
|
102
|
+
active: z.ZodString;
|
|
103
|
+
add: z.ZodString;
|
|
104
|
+
added: z.ZodString;
|
|
105
|
+
arrange: z.ZodString;
|
|
106
|
+
attach: z.ZodString;
|
|
107
|
+
attention: z.ZodString;
|
|
108
|
+
audioFiles: z.ZodString;
|
|
109
|
+
back: z.ZodString;
|
|
110
|
+
badFormat: z.ZodString;
|
|
111
|
+
badLine: z.ZodString;
|
|
112
|
+
breadcrumb: z.ZodString;
|
|
113
|
+
cancel: z.ZodString;
|
|
114
|
+
changed: z.ZodString;
|
|
115
|
+
checkField: z.ZodString;
|
|
116
|
+
checking: z.ZodString;
|
|
117
|
+
choose: z.ZodString;
|
|
118
|
+
chooseAll: z.ZodString;
|
|
119
|
+
chooseFile: z.ZodString;
|
|
120
|
+
chooseNone: z.ZodString;
|
|
121
|
+
chosenNounOf: z.ZodString;
|
|
122
|
+
chosenOf: z.ZodString;
|
|
123
|
+
clearFilters: z.ZodString;
|
|
124
|
+
close: z.ZodString;
|
|
125
|
+
code: z.ZodString;
|
|
126
|
+
collapse: z.ZodString;
|
|
127
|
+
columns: z.ZodString;
|
|
128
|
+
continue: z.ZodString;
|
|
129
|
+
copied: z.ZodString;
|
|
130
|
+
copy: z.ZodString;
|
|
131
|
+
copyFailed: z.ZodString;
|
|
132
|
+
countOver: z.ZodString;
|
|
133
|
+
denied: z.ZodString;
|
|
134
|
+
details: z.ZodString;
|
|
135
|
+
discard: z.ZodString;
|
|
136
|
+
discardEdit: z.ZodString;
|
|
137
|
+
dismiss: z.ZodString;
|
|
138
|
+
dockSidebar: z.ZodString;
|
|
139
|
+
done: z.ZodString;
|
|
140
|
+
download: z.ZodString;
|
|
141
|
+
downloadFailed: z.ZodString;
|
|
142
|
+
dragged: z.ZodObject<{
|
|
143
|
+
one: z.ZodString;
|
|
144
|
+
other: z.ZodString;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
earlierLines: z.ZodObject<{
|
|
147
|
+
one: z.ZodString;
|
|
148
|
+
other: z.ZodString;
|
|
149
|
+
}, z.core.$strict>;
|
|
150
|
+
edit: z.ZodString;
|
|
151
|
+
editUnsaved: z.ZodString;
|
|
152
|
+
expand: z.ZodString;
|
|
153
|
+
failed: z.ZodString;
|
|
154
|
+
fewestCharacters: z.ZodString;
|
|
155
|
+
files: z.ZodString;
|
|
156
|
+
filters: z.ZodString;
|
|
157
|
+
fit: z.ZodString;
|
|
158
|
+
foldSidebar: z.ZodString;
|
|
159
|
+
giveField: z.ZodString;
|
|
160
|
+
idle: z.ZodString;
|
|
161
|
+
imageFiles: z.ZodString;
|
|
162
|
+
keepEditing: z.ZodString;
|
|
163
|
+
latest: z.ZodString;
|
|
164
|
+
leastNumber: z.ZodString;
|
|
165
|
+
lessThan: z.ZodString;
|
|
166
|
+
linesUnshown: z.ZodString;
|
|
167
|
+
locked: z.ZodString;
|
|
168
|
+
message: z.ZodString;
|
|
169
|
+
missing: z.ZodString;
|
|
170
|
+
missingNoun: z.ZodString;
|
|
171
|
+
more: z.ZodString;
|
|
172
|
+
moreFailed: z.ZodString;
|
|
173
|
+
morePlaces: z.ZodString;
|
|
174
|
+
moreThan: z.ZodString;
|
|
175
|
+
mostCharacters: z.ZodString;
|
|
176
|
+
mostNumber: z.ZodString;
|
|
177
|
+
moveDown: z.ZodString;
|
|
178
|
+
moveFirst: z.ZodString;
|
|
179
|
+
moveLast: z.ZodString;
|
|
180
|
+
moveUp: z.ZodString;
|
|
181
|
+
mute: z.ZodString;
|
|
182
|
+
next: z.ZodString;
|
|
183
|
+
noMatches: z.ZodString;
|
|
184
|
+
noOptions: z.ZodString;
|
|
185
|
+
none: z.ZodString;
|
|
186
|
+
notFound: z.ZodString;
|
|
187
|
+
notifications: z.ZodString;
|
|
188
|
+
nowhere: z.ZodString;
|
|
189
|
+
off: z.ZodString;
|
|
190
|
+
open: z.ZodString;
|
|
191
|
+
optional: z.ZodString;
|
|
192
|
+
pause: z.ZodString;
|
|
193
|
+
photos: z.ZodString;
|
|
194
|
+
pickFailed: z.ZodString;
|
|
195
|
+
pickField: z.ZodString;
|
|
196
|
+
pickValue: z.ZodString;
|
|
197
|
+
places: z.ZodString;
|
|
198
|
+
play: z.ZodString;
|
|
199
|
+
playFailed: z.ZodString;
|
|
200
|
+
player: z.ZodString;
|
|
201
|
+
previous: z.ZodString;
|
|
202
|
+
readEmpty: z.ZodString;
|
|
203
|
+
readFailed: z.ZodString;
|
|
204
|
+
readPaused: z.ZodString;
|
|
205
|
+
readStale: z.ZodString;
|
|
206
|
+
recommended: z.ZodString;
|
|
207
|
+
remove: z.ZodString;
|
|
208
|
+
removeSecret: z.ZodString;
|
|
209
|
+
removed: z.ZodString;
|
|
210
|
+
replace: z.ZodString;
|
|
211
|
+
replyStopped: z.ZodString;
|
|
212
|
+
required: z.ZodString;
|
|
213
|
+
reset: z.ZodString;
|
|
214
|
+
retry: z.ZodString;
|
|
215
|
+
running: z.ZodString;
|
|
216
|
+
save: z.ZodString;
|
|
217
|
+
savedEndsIn: z.ZodString;
|
|
218
|
+
search: z.ZodString;
|
|
219
|
+
seek: z.ZodString;
|
|
220
|
+
send: z.ZodString;
|
|
221
|
+
showMore: z.ZodString;
|
|
222
|
+
sort: z.ZodString;
|
|
223
|
+
stale: z.ZodString;
|
|
224
|
+
stepOf: z.ZodString;
|
|
225
|
+
stop: z.ZodString;
|
|
226
|
+
tabs: z.ZodString;
|
|
227
|
+
textFiles: z.ZodString;
|
|
228
|
+
typeValue: z.ZodString;
|
|
229
|
+
unchanged: z.ZodString;
|
|
230
|
+
unmute: z.ZodString;
|
|
231
|
+
unshownLines: z.ZodObject<{
|
|
232
|
+
one: z.ZodString;
|
|
233
|
+
other: z.ZodString;
|
|
234
|
+
}, z.core.$strict>;
|
|
235
|
+
update: z.ZodString;
|
|
236
|
+
updateFromStore: z.ZodString;
|
|
237
|
+
updateRequired: z.ZodString;
|
|
238
|
+
videoFiles: z.ZodString;
|
|
239
|
+
volume: z.ZodString;
|
|
240
|
+
waiting: z.ZodString;
|
|
241
|
+
wholeNumber: z.ZodString;
|
|
242
|
+
wrongType: z.ZodString;
|
|
243
|
+
zoomIn: z.ZodString;
|
|
244
|
+
zoomOut: z.ZodString;
|
|
245
|
+
}, z.core.$strict>>;
|
|
246
|
+
}, z.core.$strip>;
|
|
247
|
+
export type ReactUiOptions = z.input<typeof reactUiOptionsSchema>;
|
|
248
|
+
export type { Theme } from "@slotform/ui-core/schema";
|
|
249
|
+
export type { Words } from "@slotform/ui-core/tokens";
|
|
250
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;mBAsB1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAGxD,eAAO,MAAM,cAAc;;;iBAKzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAKtD,eAAO,MAAM,cAAc;;;;;;;;;;;2BAiBzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAGtD,eAAO,MAAM,qBAAqB,aAKhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,MAAM,EAAE,QAAQ,EAAE,CAAC;CACnB;AAGD,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;iBAmBnB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAGxD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE,YAAY,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,YAAY,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { themeSchema, wordsSchema } from "@slotform/ui-core/schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { isCssIdent, isCssSupportsExpression } from "./node/css-escape.js";
|
|
4
|
+
// A CSS `@import`, shorthand or structured: docs/architecture/slot-catalog.md, "`reactUi.slots.*` (the `react-ui` plugin)".
|
|
5
|
+
export const cssImportSchema = z.union([
|
|
6
|
+
z.string().min(1, "css @import url must be a non-empty string"),
|
|
7
|
+
z.object({
|
|
8
|
+
url: z.string().min(1, "css @import url must be a non-empty string"),
|
|
9
|
+
layer: z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.refine((v) => v === undefined || isCssIdent(v), "css @import layer(...) argument must be a CSS <ident>"),
|
|
13
|
+
supports: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.refine((v) => v === undefined || isCssSupportsExpression(v), "css @import supports(...) argument must be a balanced parenthesized feature query without ';' / '{' / '}'"),
|
|
17
|
+
// Tailwind v4's `source(none)`: no automatic content detection, so only
|
|
18
|
+
// the sheet's `@source` declarations are scanned.
|
|
19
|
+
source: z.literal("none").optional(),
|
|
20
|
+
}),
|
|
21
|
+
]);
|
|
22
|
+
// `@layer <name>` — name must be a CSS <ident>.
|
|
23
|
+
export const cssLayerSchema = z.object({
|
|
24
|
+
name: z
|
|
25
|
+
.string()
|
|
26
|
+
.refine((v) => isCssIdent(v), "css @layer name must be a CSS <ident>"),
|
|
27
|
+
content: z.string(),
|
|
28
|
+
});
|
|
29
|
+
// A top-level `@theme`, `@utility` or `@custom-variant` block: docs/architecture/slot-catalog.md, "`reactUi.slots.*` (the `react-ui` plugin)".
|
|
30
|
+
const cssDeclarationsSchema = z.record(z.string(), z.string());
|
|
31
|
+
export const cssBlockSchema = z.discriminatedUnion("kind", [
|
|
32
|
+
z.object({
|
|
33
|
+
kind: z.literal("theme"),
|
|
34
|
+
declarations: cssDeclarationsSchema,
|
|
35
|
+
}),
|
|
36
|
+
z.object({
|
|
37
|
+
kind: z.literal("utility"),
|
|
38
|
+
// Validated at the render boundary by `cssIdent`, so a malformed name
|
|
39
|
+
// throws an error that names the contributing plugin.
|
|
40
|
+
name: z.string(),
|
|
41
|
+
declarations: cssDeclarationsSchema,
|
|
42
|
+
}),
|
|
43
|
+
z.object({
|
|
44
|
+
kind: z.literal("variant"),
|
|
45
|
+
name: z.string(),
|
|
46
|
+
content: z.string(),
|
|
47
|
+
}),
|
|
48
|
+
]);
|
|
49
|
+
// An `@source inline` pattern: docs/architecture/slot-catalog.md, "`reactUi.slots.*` (the `react-ui` plugin)".
|
|
50
|
+
export const cssSourceInlineSchema = z
|
|
51
|
+
.string()
|
|
52
|
+
.regex(/^[a-z0-9{},.:-]+$/, "css @source inline(...) pattern must be class characters and braces");
|
|
53
|
+
// A webfont file: docs/architecture/plugins/react-ui.md, "Fonts".
|
|
54
|
+
const fontEntrySchema = z.object({
|
|
55
|
+
// CSS family name used in `font-family` declarations (e.g. "IBM Plex Sans").
|
|
56
|
+
family: z.string(),
|
|
57
|
+
// Node module path or workspace-relative path to the actual woff2 file
|
|
58
|
+
// (e.g. "@fontsource-variable/ibm-plex-sans/files/ibm-plex-sans-latin-wght-normal.woff2").
|
|
59
|
+
specifier: z.string(),
|
|
60
|
+
// A single weight ("400") or a variable-font range ("100 900").
|
|
61
|
+
weight: z.string(),
|
|
62
|
+
style: z.enum(["normal", "italic"]),
|
|
63
|
+
// Fallback-font metrics used to generate a sibling `@font-face` that
|
|
64
|
+
// matches the webfont's metrics on top of a system family. Prevents CLS
|
|
65
|
+
// while the woff2 loads.
|
|
66
|
+
fallback: z.object({
|
|
67
|
+
family: z.string(),
|
|
68
|
+
ascentOverride: z.string(),
|
|
69
|
+
descentOverride: z.string(),
|
|
70
|
+
lineGapOverride: z.string(),
|
|
71
|
+
sizeAdjust: z.string(),
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
// The options: plugins/react-ui/guide/reference.md, "Options".
|
|
75
|
+
export const reactUiOptionsSchema = z.object({
|
|
76
|
+
fonts: z.array(fontEntrySchema).optional(),
|
|
77
|
+
theme: themeSchema.optional(),
|
|
78
|
+
words: wordsSchema.optional(),
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/guide/acts.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Acts, the ActionBar and toasts
|
|
2
|
+
|
|
3
|
+
How the web draws an act: the `Act` type, the `ActionBar`, the chosen bar over ticked rows, and `toast()`. What an act carries and the order it runs in is `node_modules/@slotform/ui-core/guide/acts.md`; a sheet it opens is `node_modules/@slotform/ui-core/guide/sheets.md`; which acts stand together is `rules.md`.
|
|
4
|
+
|
|
5
|
+
## The act
|
|
6
|
+
|
|
7
|
+
The web `Act`, `IconAct` and `MenuEntry` are `lib/act`: ui-core's `Act` plus `sheet`, a `Sheet`'s props but `open` and `onClose` ([containers](./containers.md#sheet)), opened by the press in place of `onAct`. Give it through `sheetOf({ … })` from `lib/act`, which types the form's procedure. The root container's sheet outlet draws the sheet the press opens. A sheet no act opens is a `sheet` search param the route reads with the router.
|
|
8
|
+
|
|
9
|
+
| Import | From |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `Act`, `IconAct`, `MenuEntry`, `sheetOf` | `@slotform/react-ui/lib/act` |
|
|
12
|
+
| `refusal(error)` | `@slotform/query/acts` |
|
|
13
|
+
| `useAttempt()`, `useDraft` | `@slotform/ui-core/react/acts` |
|
|
14
|
+
| `confirm(confirmation)` | `@slotform/ui-core/react/confirm`, for a decision no act starts |
|
|
15
|
+
| `toast` | `@slotform/react-ui/lib/toast` |
|
|
16
|
+
|
|
17
|
+
The pending look's delay is `--act-delay` (`tuned.actDelay`, `@slotform/ui-core/paint`).
|
|
18
|
+
|
|
19
|
+
## ActionBar
|
|
20
|
+
|
|
21
|
+
`@slotform/react-ui/components/action-bar`: the acts that close a block ([rules](./rules.md#a-records-decision-is-an-actionbar)), or that apply to the rows chosen in a list.
|
|
22
|
+
|
|
23
|
+
| Prop | Is |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| `acts` | `Act`s and `LinkAct`s in reading order, the one filled act last; a `LinkAct` (a Back, a way home) is an anchor, quiet unless it is the filled act |
|
|
26
|
+
| `chosen` | `{ count, of, noun?, onAll? }`: the bar is a chosen bar ([the chosen bar](#the-chosen-bar)) |
|
|
27
|
+
| `pending` | `{ sentence, until?, act? }`: the server works on a decision, and a pending bar stands in the bar's place at the bar's height, so nothing below it moves; `until` fills a track toward the end and shows the time left (unset, a spinner turns), and `act` is the one hairline act beside it |
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
<ActionBar
|
|
31
|
+
acts={[
|
|
32
|
+
{ label: "Decline", onAct: () => decline.mutateAsync({ id }), destructive: true, confirm },
|
|
33
|
+
{ label: "Approve", onAct: () => approve.mutateAsync({ id }), done: "Approved" },
|
|
34
|
+
]}
|
|
35
|
+
/>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
One rule lays out every bar, by the width of the block it closes and never the viewport (the `acts` container): up to the auth column's width (a `Gate` step, a sheet on a phone) the acts stack across the block, one a row and the filled act on top; wider (a desktop sheet, a page's form) they stand at their own width at the block's end, the filled act last, wrapping to a further row only when the line cannot hold them. An empty state's act stands across a column at the empty width the same way.
|
|
39
|
+
|
|
40
|
+
The bar holds its acts' attempt (`node_modules/@slotform/ui-core/guide/acts.md#an-act-holds-its-attempt`), its rejection in the line under the acts. A blocked act waits for a touch: inert and silent until it is pressed, or until its form or sheet has taken input, then its reason stands in the line under the acts, at the filled act's edge. The line stands only while it says something, so it leaves with the reason.
|
|
41
|
+
|
|
42
|
+
A `Form`'s `submit` and `acts` and a `Sheet`'s foot draw this bar themselves; give a bar of your own only where no form or sheet stands, and for the rows a `Table` ticks.
|
|
43
|
+
|
|
44
|
+
## The chosen bar
|
|
45
|
+
|
|
46
|
+
An `ActionBar` with `chosen` in the `Pane`'s `foot` holds the acts that apply to a `Table`'s ticked rows ([table](./table.md#choosing-rows)).
|
|
47
|
+
|
|
48
|
+
| `chosen` field | Is |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `count` | the rows ticked |
|
|
51
|
+
| `of` | the rows that can be ticked, yours to count |
|
|
52
|
+
| `noun` | a plural word naming them: "N of M promotable chosen" |
|
|
53
|
+
| `onAll` | hears the set to choose: `true` for every row that can be ticked, `false` for none |
|
|
54
|
+
|
|
55
|
+
The bar is one row at the body's column and start (the reading width, the body's width where the body holds wide content). At its start it reads "N of M chosen" with the numbers formatted ("48,210 of 48,210 chosen"), a select-all act while the ticked are fewer than `of`, and a clear icon while any are ticked. At its end the filled act stands, the last of `acts`, and the others are in a more menu before it. It draws nothing, nor does the foot, while no row is ticked or the table has no row to tick.
|
|
56
|
+
|
|
57
|
+
## Toasts
|
|
58
|
+
|
|
59
|
+
`toast(sentence, { tone, act })` queues a toast for what no act started. `tone` is how the thing it reports ended (`node_modules/@slotform/ui-core/guide/tone.md`). `act` is an `Act` or a `LinkAct` it offers (a route, a retry), never an undo. Only a page inside the `Shell` can call `toast()` or `confirm()`, since the `Shell` draws both.
|
|
60
|
+
|
|
61
|
+
A toast stands over the foot of the container, above whatever docks there: a `Pane`'s `foot` or open docked `sheet`, and on touch an open bottom `Sheet`, so it never covers a foot, a sheet's sentence or an act. Where nothing docks it stands over the page's end for its few seconds, and the `Pane`'s body takes its reach under the last line, so scrolling to the end brings that line clear of it. It swipes away and takes no press outside its own box.
|
package/guide/audio.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Audio
|
|
2
|
+
|
|
3
|
+
Sound a viewer plays is the player, never an `<audio>` in a screen. The app passes the player one
|
|
4
|
+
output, calls `player` with a `Track`, and gives the `Shell` a `Dock` for its `foot`; the dock stands
|
|
5
|
+
under the place while a track is loaded, and the sound goes on through navigation. The dock and a
|
|
6
|
+
waveform on its own are [dock](./dock.md). Nothing here mounts by default: an app that plays no sound carries no audio.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Dock } from "@slotform/react-ui/components/dock";
|
|
10
|
+
import { Waveform } from "@slotform/react-ui/components/waveform";
|
|
11
|
+
import { audioOutput, connectOutput, player, usePlayer, windowQueue } from "@slotform/react-ui/lib/player";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Set it up
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
connectOutput(audioOutput()); // once, before the app renders
|
|
18
|
+
|
|
19
|
+
<Shell places={places} foot={<Dock />}>…</Shell>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- `audioOutput()` is the browser's audio element as the player's `Output`, made when the first track
|
|
23
|
+
loads. Another engine is an `Engine` (`(report) => Output`, `@slotform/ui-core/player`): the store
|
|
24
|
+
tells it to `load`, `play` and `pause`, and it reports the sound's events through `report`.
|
|
25
|
+
- `player.play` and `player.load` throw until an output is passed, so a forgotten `connectOutput` fails loudly.
|
|
26
|
+
- `createPlayer` (`@slotform/ui-core/player`) makes a store over a `PlayerHost`; `lib/player` is the
|
|
27
|
+
one the app calls, so there is one player per page.
|
|
28
|
+
|
|
29
|
+
## Play a track
|
|
30
|
+
|
|
31
|
+
A `Track` (`@slotform/ui-core/descriptors`) is the file and what is known of it:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
const toTrack = (t: Song): Track => ({
|
|
35
|
+
src: t.url,
|
|
36
|
+
title: t.title,
|
|
37
|
+
line: t.artist,
|
|
38
|
+
image: t.cover,
|
|
39
|
+
duration: t.seconds,
|
|
40
|
+
peaks: { values: t.peaks },
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
<Button label="Play" onAct={() => player.play(toTrack(song), songs.map(toTrack))} />
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- Call `player.play` from a press: a browser holds back sound nothing asked for, and the track then
|
|
47
|
+
waits paused.
|
|
48
|
+
- The second argument is the queue Next and Previous walk; leave it out and the track plays alone.
|
|
49
|
+
The queue stays while the tracks played are in it. A track is the same track by its `key`, else its
|
|
50
|
+
`src`.
|
|
51
|
+
- A queue too long to hold (a `Table` over a window read of tens of thousands of rows) is a
|
|
52
|
+
provider: `queue` takes `{ next(current), previous(current) }` instead of a list, each
|
|
53
|
+
returning the `Track` beside `current` (or `undefined` at an end), now or as a promise. The
|
|
54
|
+
player asks it once as a track loads, so the dock knows whether a Next exists before it is
|
|
55
|
+
pressed (it is shown until the provider answers there is none), and `ended` and the media keys
|
|
56
|
+
walk the same way. A provider is kept while the tracks played are the ones it gave. Over a
|
|
57
|
+
window read, `windowQueue` is the provider; it fetches the rows beside the playing one through the
|
|
58
|
+
read's own pages, in its order and filter:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
// useWindow: @slotform/ui-core/react/read
|
|
62
|
+
const rows = useWindow(tracks)?.rows ?? [];
|
|
63
|
+
<Table items={tracks} row={{ id: (t) => t.id }} onOpen={(id) => {
|
|
64
|
+
const at = rows.findIndex((t) => t?.id === id);
|
|
65
|
+
player.play(toTrack(rows[at]), windowQueue(tracks, { track: toTrack, at }));
|
|
66
|
+
}} />
|
|
67
|
+
```
|
|
68
|
+
`track` may return a promise, for an address signed per track (give the track a `key`, since its address changes): it runs for each row of a page
|
|
69
|
+
as the page loads.
|
|
70
|
+
- `player.load(track)` cues it paused; `pause`, `toggle`, `seek(seconds)`, `skip(seconds)`,
|
|
71
|
+
`setVolume(0..1)`, `mute()`, `playNext`, `playPrevious` and `close` do what they say.
|
|
72
|
+
- `usePlayer()` reads `track`, `playing`, `failed`, `volume`, `muted`, `queue`, `next` and
|
|
73
|
+
`previous` (once a provider has answered), `queued` and `hasNext` with the same commands, so a row can draw its own playing state:
|
|
74
|
+
`usePlayer().track?.src === row.src`. `usePlayerTime()` reads `{ time, duration }` and draws
|
|
75
|
+
again on each frame while it plays: use it only where the time is drawn.
|
|
76
|
+
|
|
77
|
+
**Check:** the dock stands under the place across a route change, with the audio uninterrupted.
|
package/guide/blocks.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Blocks: text, code and pictures
|
|
2
|
+
|
|
3
|
+
The parts that read as a block in a `Section`'s body, and the pictures. [`Card`](./containers.md#card) names the ones that stand in a `Card`. `Stats` and `BarChart` are [figures](./figures.md), a `Waveform` is [dock](./dock.md) and a `Canvas` is [canvas](./canvas.md). This page is what each takes.
|
|
4
|
+
|
|
5
|
+
## Text
|
|
6
|
+
|
|
7
|
+
A paragraph in a type role. `kind`: `body` (the default) or `meta`, not named `role`, which is the ARIA attribute. Its `children` are words, links or runs: a `{ strong }` run is words at weight 500, a `{ code }` run a span of code.
|
|
8
|
+
|
|
9
|
+
## Prose
|
|
10
|
+
|
|
11
|
+
Markdown. `markdown` is the text: headings, paragraphs, lists, quotes, rules, inline code, links and fenced code.
|
|
12
|
+
|
|
13
|
+
## Code
|
|
14
|
+
|
|
15
|
+
Text in mono, split on newlines.
|
|
16
|
+
|
|
17
|
+
- `text`: the text. A selection paints lines until its read lands.
|
|
18
|
+
- `title`: what the text is (a file's name, the tool it goes into), in a head over it; it names the acts.
|
|
19
|
+
- `copy`: adds the copy act.
|
|
20
|
+
- `download`: adds a download act that saves the text as a file of this name (`download="recovery-codes.txt"`).
|
|
21
|
+
- `tail`: shows only the last lines, that many, behind an act that reveals the earlier ones: a log.
|
|
22
|
+
|
|
23
|
+
## Diff
|
|
24
|
+
|
|
25
|
+
Two texts compared. `label` is the file's path. Give `hunks`, or `before` and `after` with `by`: `line` (the default: code, each line marked and numbered) or `word` (prose: a removed run struck through and an added one underlined in place, in a card at the measure). A code diff spans the `Pane`'s body (`data-wide`).
|
|
26
|
+
|
|
27
|
+
## Stages
|
|
28
|
+
|
|
29
|
+
A rail of fixed states.
|
|
30
|
+
|
|
31
|
+
- `steps`: `{ label, state, at? }`. `state` is `done`, `current` or `later`; `at` is the ISO moment a done or current stage was reached.
|
|
32
|
+
- `ended`: `{ label, reason? }`, the terminal row that stands in place of every stage after the last done one.
|
|
33
|
+
|
|
34
|
+
## Image
|
|
35
|
+
|
|
36
|
+
A picture that opens full size on a press.
|
|
37
|
+
|
|
38
|
+
- `src`: the address; a selection paints the tile until its read lands.
|
|
39
|
+
- `alt`: what it shows; the failed shape's words and the full view's name.
|
|
40
|
+
- `fit`: `content` (the default; the container's width at `aspect`, capped in height) or `thumb`, a square tile.
|
|
41
|
+
- `aspect`: the width over the height (`16 / 9`), which the screen gives as it knows it before the bytes land. A `content` Image requires it; a `thumb` takes none.
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<Image src={cover} alt="Cover art" aspect={16 / 9} />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Gallery
|
|
48
|
+
|
|
49
|
+
Pictures side by side (`node_modules/@slotform/ui-core/guide/pictures.md` says when). `items` are the pictures, in the order the full view steps through them:
|
|
50
|
+
|
|
51
|
+
| Field | Is |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `key` | tells the picture apart, kept while the list changes |
|
|
54
|
+
| `src` | the address; a selection paints the tile, inert, until its read lands |
|
|
55
|
+
| `alt` | what it shows: the tile's accessible name and the full view's name, a sentence |
|
|
56
|
+
| `aspect` | the width over the height (`16 / 10`) |
|
|
57
|
+
| `caption` | a line under the tile, cut to its width (a file's name, a page's address) |
|
|
58
|
+
|
|
59
|
+
Each tile stands a fixed height at its picture's `aspect`, held no narrower than three to four (a phone's page is cropped to its top, where its head is) and no wider than the container, and the tiles wrap a gap apart. A tile paints, waits and fails as an `Image` does. A press opens the full view on that picture, with Previous and Next beside it stepping through the others in the list's order (and the arrow keys).
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<Gallery
|
|
63
|
+
items={shots.map((shot) => ({
|
|
64
|
+
key: shot.path,
|
|
65
|
+
src: shot.url,
|
|
66
|
+
alt: `Screenshot ${shot.path}`,
|
|
67
|
+
aspect: shot.width / shot.height,
|
|
68
|
+
caption: shot.path,
|
|
69
|
+
}))}
|
|
70
|
+
/>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## QrCode
|
|
74
|
+
|
|
75
|
+
A code a camera reads (`node_modules/@slotform/ui-core/guide/pictures.md#a-code-a-camera-reads-is-a-qrcode`).
|
|
76
|
+
|
|
77
|
+
| Prop | Is |
|
|
78
|
+
| --- | --- |
|
|
79
|
+
| `value` | the text it carries (an address), a constant or a selection, which paints the tile until its read lands; never drawn nor read aloud |
|
|
80
|
+
| `label` | what it is for, its accessible name ("Code that adds a device") |
|
|
81
|
+
|
|
82
|
+
It draws its modules dark on a light tile in both modes, inside a four-module quiet zone, a square at its container's width down to the image cap and centred, so it is never cropped.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Choosing a node
|
|
2
|
+
|
|
3
|
+
How a viewer chooses a `Canvas` node or a group, the keys that walk them, the empty group, and the
|
|
4
|
+
`act` at the canvas's foot.
|
|
5
|
+
|
|
6
|
+
A canvas with no handler is read-only: it has no node button and no node moves. Pass `onSelect`
|
|
7
|
+
and each node is a button named by its text, in path order in the Tab order (with `onMove` it is one too: [editing](./canvas-editing.md)). Enter or Space
|
|
8
|
+
chooses it, Escape or a click on the ground calls `onSelect(null)`, and a node focused from the
|
|
9
|
+
keyboard pans into view. Hold the choice yourself and pass it back as `selected`; a change from
|
|
10
|
+
outside (a row in a list) pans to its node.
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
const [selected, setSelected] = useState<string>();
|
|
14
|
+
<Canvas label="Journey" nodes={numbered} edges={edges} selected={selected} onSelect={(id) => setSelected(id ?? undefined)} />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
A group's `head` is one line, cut at its end with an ellipsis: put what decides first (a round count before its qualifier), and keep it short enough for a phone's frame. A group is a box; with `onSelect` its head is a selectable control. The head is a button named
|
|
18
|
+
by its text (at least a target tall) that calls `onSelect(group.id)`, and `selected` may name a
|
|
19
|
+
group, which draws its box in the selection's outline (a heavier dashed line). The head
|
|
20
|
+
shows hover as a node does. Node ids and group ids share one
|
|
21
|
+
namespace. The head's band stands over the edges that cross it into the box, so no edge
|
|
22
|
+
strikes through its words. The box's body takes no pointer, so a drag from it pans, and a group does not move:
|
|
23
|
+
its box follows its holds. The heads take their Tab stops first, outer before inner, then the
|
|
24
|
+
nodes in path order. Under the text floor a head draws at its own size on screen and stays a stop.
|
|
25
|
+
|
|
26
|
+
A group holding no present node (an empty loop) is a leaf of the graph: the layout stands it in
|
|
27
|
+
its place in the path, as a box of its head and padding at a node's width, and an edge may name
|
|
28
|
+
its id as `from` or `to`, so its edges meet it. Its head is a button as any group's. It is no
|
|
29
|
+
node: it takes no port, no drag and no connection, and `onMove` never hears it. The layout
|
|
30
|
+
places it. When every node has a `position` no layout runs, and the empty groups stand in one row
|
|
31
|
+
below the nodes' bounds, left-aligned with them, in path order; an empty group takes no
|
|
32
|
+
`position`. A group that holds an empty group frames it, and an edge naming a group that holds a node is ignored.
|
|
33
|
+
|
|
34
|
+
An `act` stands at the foot's centre, an `Act` or a `LinkAct` (a `{ label, href }` is an anchor to a route); it adds, it never removes.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Editing the canvas
|
|
2
|
+
|
|
3
|
+
How a `Canvas` reports a drag, an arrow key, Arrange, a node that lands and a link drawn between two
|
|
4
|
+
nodes, and why each one sticks only when you store it.
|
|
5
|
+
|
|
6
|
+
Editing is controlled: the canvas reports and holds nothing of yours. `onMove(id, position)`
|
|
7
|
+
reports a node's position when a drag ends or an arrow key moves it, once for each node when the canvas lays them out or
|
|
8
|
+
Arrange runs, and once for a node that lands. **Store each one and pass it back as `position`**:
|
|
9
|
+
that is what makes a drag, Arrange and a landing stick, and a position you do not store is
|
|
10
|
+
forgotten on release.
|
|
11
|
+
|
|
12
|
+
- **Move.** With `onMove` a node follows a drag at once, with no long press and no handle, and
|
|
13
|
+
the edges and group boxes follow it, and it stands over the nodes it crosses. A drag never
|
|
14
|
+
selects. Held near the canvas's edge, a dragged node or a dragged link pans the view toward that
|
|
15
|
+
edge, faster the nearer it is, and the node stays under the pointer, so a node or an in port out
|
|
16
|
+
of sight is reached without letting go. A node that can move is a button in the Tab order: an
|
|
17
|
+
arrow key moves the focused node a quarter of the dot grid's pitch (4 px), and Shift with an
|
|
18
|
+
arrow one pitch (16 px), each reported through `onMove` as a drop is. Every position a move
|
|
19
|
+
reports is in whole pixels. Arrange joins the zoom stack, the
|
|
20
|
+
way to lay the graph out again without dragging: it ignores every position, reports each
|
|
21
|
+
node's, and fits the view.
|
|
22
|
+
- **Landing.** A node added without a `position` among placed ones lands with its centre at the
|
|
23
|
+
centre of the view, and `onSelect` is called with its id. Two added at once land on one
|
|
24
|
+
another. Without `onMove` it is drawn there and nothing is reported.
|
|
25
|
+
- **Connect.** With `onConnect` each node shows an in port at its top and an out port at its
|
|
26
|
+
bottom. Dragging an out port to an in port calls `onConnect(from, to)`, and releasing on the
|
|
27
|
+
ground calls `onConnect(from, null)`: open whatever you offer for a dropped link (your sheet).
|
|
28
|
+
The in port under the pointer fills with ink while the link is dragged, so the release has a
|
|
29
|
+
visible target, and a forward edge ends just above an in port, clear of its ring. A release over
|
|
30
|
+
a node's body, a control or outside the canvas reports nothing, and a link from a node to itself
|
|
31
|
+
is reported: refuse it when you save. The canvas never adds the edge; add it to your own data and
|
|
32
|
+
pass it back in `edges`.
|
|
33
|
+
- A canvas with neither handler has no drag, no Arrange and no port. Connecting without a
|
|
34
|
+
pointer is your own sheet: the ports are not focusable. A `path` does not gate editing and a
|
|
35
|
+
port keeps its ink on a dimmed or marked node: a run you want read-only is a canvas given
|
|
36
|
+
neither handler.
|