@volvel/ui 0.0.0-stage → 0.6.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 +202 -0
- package/THIRD_PARTY_NOTICES.md +23018 -0
- package/dist/Badge.d.ts +20 -0
- package/dist/Badge.js +35 -0
- package/dist/Button.d.ts +56 -0
- package/dist/Button.js +52 -0
- package/dist/Chart.d.ts +23 -0
- package/dist/Chart.js +98 -0
- package/dist/Combobox.d.ts +45 -0
- package/dist/Combobox.js +42 -0
- package/dist/ContextMenu.d.ts +16 -0
- package/dist/ContextMenu.js +11 -0
- package/dist/DateInput.d.ts +31 -0
- package/dist/DateInput.js +329 -0
- package/dist/Details.d.ts +12 -0
- package/dist/Details.js +9 -0
- package/dist/Dialog.d.ts +44 -0
- package/dist/Dialog.js +95 -0
- package/dist/Dialogs.d.ts +56 -0
- package/dist/Dialogs.js +95 -0
- package/dist/Doc.d.ts +25 -0
- package/dist/Doc.js +118 -0
- package/dist/DocServed.d.ts +6 -0
- package/dist/DocServed.js +154 -0
- package/dist/DocZoom.d.ts +11 -0
- package/dist/DocZoom.js +133 -0
- package/dist/Facts.d.ts +12 -0
- package/dist/Facts.js +10 -0
- package/dist/Fields.d.ts +184 -0
- package/dist/Fields.js +249 -0
- package/dist/Form.d.ts +47 -0
- package/dist/Form.js +189 -0
- package/dist/Grid.d.ts +118 -0
- package/dist/Grid.js +475 -0
- package/dist/HeadingSlot.d.ts +13 -0
- package/dist/HeadingSlot.js +19 -0
- package/dist/JsonView.d.ts +11 -0
- package/dist/JsonView.js +68 -0
- package/dist/LogViewer.d.ts +45 -0
- package/dist/LogViewer.js +299 -0
- package/dist/Markdown.d.ts +21 -0
- package/dist/Markdown.js +27 -0
- package/dist/MarkdownBody.d.ts +6 -0
- package/dist/MarkdownBody.js +14 -0
- package/dist/Menu.d.ts +29 -0
- package/dist/Menu.js +8 -0
- package/dist/MoveButtons.d.ts +19 -0
- package/dist/MoveButtons.js +22 -0
- package/dist/Notice.d.ts +47 -0
- package/dist/Notice.js +50 -0
- package/dist/PageShell.d.ts +42 -0
- package/dist/PageShell.js +14 -0
- package/dist/Pagination.d.ts +13 -0
- package/dist/Pagination.js +9 -0
- package/dist/Panel.d.ts +31 -0
- package/dist/Panel.js +33 -0
- package/dist/Pickers.d.ts +37 -0
- package/dist/Pickers.js +44 -0
- package/dist/Popover.d.ts +24 -0
- package/dist/Popover.js +12 -0
- package/dist/ResultView.d.ts +28 -0
- package/dist/ResultView.js +140 -0
- package/dist/SchemaForm.d.ts +45 -0
- package/dist/SchemaForm.js +626 -0
- package/dist/SideSheet.d.ts +31 -0
- package/dist/SideSheet.js +136 -0
- package/dist/Sparkline.d.ts +14 -0
- package/dist/Sparkline.js +23 -0
- package/dist/Surfaces.d.ts +30 -0
- package/dist/Surfaces.js +34 -0
- package/dist/Switch.d.ts +18 -0
- package/dist/Switch.js +11 -0
- package/dist/Table.d.ts +15 -0
- package/dist/Table.js +6 -0
- package/dist/Tabs.d.ts +32 -0
- package/dist/Tabs.js +11 -0
- package/dist/Term.d.ts +82 -0
- package/dist/Term.js +153 -0
- package/dist/Timeline.d.ts +29 -0
- package/dist/Timeline.js +39 -0
- package/dist/Toast.d.ts +43 -0
- package/dist/Toast.js +140 -0
- package/dist/Tooltip.d.ts +34 -0
- package/dist/Tooltip.js +70 -0
- package/dist/Tree.d.ts +51 -0
- package/dist/Tree.js +233 -0
- package/dist/chartEngine.d.ts +32 -0
- package/dist/chartEngine.js +72 -0
- package/dist/chartTheme.d.ts +41 -0
- package/dist/chartTheme.js +131 -0
- package/dist/contrast.d.ts +27 -0
- package/dist/contrast.js +110 -0
- package/dist/dates.d.ts +61 -0
- package/dist/dates.js +294 -0
- package/dist/drawer/Chips.d.ts +37 -0
- package/dist/drawer/Chips.js +32 -0
- package/dist/drawer/Choices.d.ts +47 -0
- package/dist/drawer/Choices.js +81 -0
- package/dist/drawer/Drawer.d.ts +125 -0
- package/dist/drawer/Drawer.js +150 -0
- package/dist/drawer/EditorBodies.d.ts +95 -0
- package/dist/drawer/EditorBodies.js +169 -0
- package/dist/drawer/NumberFormat.d.ts +36 -0
- package/dist/drawer/NumberFormat.js +98 -0
- package/dist/drawer/SortableRows.d.ts +35 -0
- package/dist/drawer/SortableRows.js +23 -0
- package/dist/drawer/edgeShadows.d.ts +7 -0
- package/dist/drawer/edgeShadows.js +17 -0
- package/dist/drawer/index.d.ts +8 -0
- package/dist/drawer/index.js +8 -0
- package/dist/drawer/useSortable.d.ts +53 -0
- package/dist/drawer/useSortable.js +323 -0
- package/dist/format.d.ts +6 -0
- package/dist/format.js +17 -0
- package/dist/icons.d.ts +20 -0
- package/dist/icons.js +16 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +48 -0
- package/dist/markdownKnowledge.d.ts +45 -0
- package/dist/markdownKnowledge.js +37 -0
- package/dist/overlay.d.ts +7 -0
- package/dist/overlay.js +10 -0
- package/dist/pageIcons.d.ts +12 -0
- package/dist/pageIcons.js +32 -0
- package/dist/presence.d.ts +41 -0
- package/dist/presence.js +108 -0
- package/dist/returnFocus.d.ts +9 -0
- package/dist/returnFocus.js +44 -0
- package/dist/tokens.css +437 -0
- package/dist/type-scale.css +34 -0
- package/dist/useFlip.d.ts +32 -0
- package/dist/useFlip.js +118 -0
- package/fonts/OFL.txt +193 -0
- package/fonts/geist-latin.woff2 +0 -0
- package/fonts/geist-mono-latin.woff2 +0 -0
- package/package.json +47 -3
- package/README.md +0 -3
package/dist/tokens.css
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Theme tokens. Every color, radius and font in the kit comes from one of
|
|
3
|
+
* these variables, so a tenant's branding is a different set of values and
|
|
4
|
+
* nothing else. Tailwind utilities are generated from the same variables.
|
|
5
|
+
*
|
|
6
|
+
* The dark values are the ones the design boards (temp/Volvel App Builder
|
|
7
|
+
* redesign.html) are drawn with; the light values keep the same cyan hue
|
|
8
|
+
* family on light surfaces.
|
|
9
|
+
*/
|
|
10
|
+
@import "tailwindcss";
|
|
11
|
+
@source "./";
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Geist and Geist Mono, the faces the boards are set in: variable fonts, Latin
|
|
15
|
+
* range, downloaded unchanged from Google Fonts (SIL Open Font License 1.1,
|
|
16
|
+
* ../fonts/OFL.txt). They are served with the page, never fetched from a
|
|
17
|
+
* network. A brand that sets `--vx-font` replaces them; the system faces after
|
|
18
|
+
* them cover every other script.
|
|
19
|
+
*/
|
|
20
|
+
@font-face {
|
|
21
|
+
font-family: "Geist";
|
|
22
|
+
font-style: normal;
|
|
23
|
+
font-weight: 100 900;
|
|
24
|
+
font-display: swap;
|
|
25
|
+
src: url("../fonts/geist-latin.woff2") format("woff2");
|
|
26
|
+
unicode-range:
|
|
27
|
+
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
|
|
28
|
+
U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
29
|
+
}
|
|
30
|
+
@font-face {
|
|
31
|
+
font-family: "Geist Mono";
|
|
32
|
+
font-style: normal;
|
|
33
|
+
font-weight: 100 900;
|
|
34
|
+
font-display: swap;
|
|
35
|
+
src: url("../fonts/geist-mono-latin.woff2") format("woff2");
|
|
36
|
+
unicode-range:
|
|
37
|
+
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
|
|
38
|
+
U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:root {
|
|
42
|
+
--vx-canvas: #f3f5f8;
|
|
43
|
+
--vx-surface: #ffffff;
|
|
44
|
+
--vx-sunken: #eef1f5;
|
|
45
|
+
--vx-line: #dde3ea;
|
|
46
|
+
--vx-ink: #0f1720;
|
|
47
|
+
--vx-ink-muted: #4b5666;
|
|
48
|
+
--vx-action: #0b6b88;
|
|
49
|
+
--vx-action-ink: #ffffff;
|
|
50
|
+
--vx-action-soft: #dcf0f7;
|
|
51
|
+
--vx-attention: #9a4707;
|
|
52
|
+
--vx-attention-soft: #fdf0dc;
|
|
53
|
+
--vx-danger: #b3261e;
|
|
54
|
+
--vx-danger-soft: #fbe9e7;
|
|
55
|
+
--vx-success: #1b6e45;
|
|
56
|
+
--vx-success-soft: #e1f3e9;
|
|
57
|
+
--vx-structure: #eaeef3;
|
|
58
|
+
--vx-raised: #ffffff;
|
|
59
|
+
--vx-selected: #e0f0f6;
|
|
60
|
+
--vx-line-strong: #c6cfd9;
|
|
61
|
+
/* The edge of a control, such as an input: 3:1 or more against what is around it. */
|
|
62
|
+
--vx-line-control: #748090;
|
|
63
|
+
--vx-ink-subtle: #586474;
|
|
64
|
+
--vx-code-bg: #f5f7f9;
|
|
65
|
+
--vx-focus: #0b6b88;
|
|
66
|
+
--vx-radius-control: 8px;
|
|
67
|
+
--vx-radius-panel: 12px;
|
|
68
|
+
--vx-font:
|
|
69
|
+
"Geist", ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
70
|
+
--vx-font-code:
|
|
71
|
+
"Geist Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
|
|
72
|
+
color-scheme: light;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* Dark follows the system unless the page says otherwise: `data-theme` on the
|
|
77
|
+
* root element is "light" or "dark" when a person has chosen one.
|
|
78
|
+
*/
|
|
79
|
+
@media (prefers-color-scheme: dark) {
|
|
80
|
+
:root:not([data-theme="light"]) {
|
|
81
|
+
--vx-canvas: #0e1218;
|
|
82
|
+
--vx-surface: #11161d;
|
|
83
|
+
--vx-sunken: #0f141a;
|
|
84
|
+
--vx-line: #1f2731;
|
|
85
|
+
--vx-ink: #e7eaee;
|
|
86
|
+
--vx-ink-muted: #9aa5b4;
|
|
87
|
+
--vx-action: #5cc2e6;
|
|
88
|
+
--vx-action-ink: #071016;
|
|
89
|
+
--vx-action-soft: #14252e;
|
|
90
|
+
--vx-attention: #f0a541;
|
|
91
|
+
--vx-attention-soft: #2a2318;
|
|
92
|
+
--vx-danger: #ff8a8d;
|
|
93
|
+
--vx-danger-soft: #2e1a1e;
|
|
94
|
+
--vx-success: #4fd1a5;
|
|
95
|
+
--vx-success-soft: #16292a;
|
|
96
|
+
--vx-structure: #0b0f14;
|
|
97
|
+
--vx-raised: #192029;
|
|
98
|
+
--vx-selected: #13212a;
|
|
99
|
+
--vx-line-strong: #2a3542;
|
|
100
|
+
--vx-line-control: #5e6d81;
|
|
101
|
+
--vx-ink-subtle: #8290a1;
|
|
102
|
+
--vx-code-bg: #0b0f14;
|
|
103
|
+
--vx-focus: #5cc2e6;
|
|
104
|
+
color-scheme: dark;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
:root[data-theme="dark"] {
|
|
109
|
+
--vx-canvas: #0e1218;
|
|
110
|
+
--vx-surface: #11161d;
|
|
111
|
+
--vx-sunken: #0f141a;
|
|
112
|
+
--vx-line: #1f2731;
|
|
113
|
+
--vx-ink: #e7eaee;
|
|
114
|
+
--vx-ink-muted: #9aa5b4;
|
|
115
|
+
--vx-action: #5cc2e6;
|
|
116
|
+
--vx-action-ink: #071016;
|
|
117
|
+
--vx-action-soft: #14252e;
|
|
118
|
+
--vx-attention: #f0a541;
|
|
119
|
+
--vx-attention-soft: #2a2318;
|
|
120
|
+
--vx-danger: #ff8a8d;
|
|
121
|
+
--vx-danger-soft: #2e1a1e;
|
|
122
|
+
--vx-success: #4fd1a5;
|
|
123
|
+
--vx-success-soft: #16292a;
|
|
124
|
+
--vx-structure: #0b0f14;
|
|
125
|
+
--vx-raised: #192029;
|
|
126
|
+
--vx-selected: #13212a;
|
|
127
|
+
--vx-line-strong: #2a3542;
|
|
128
|
+
--vx-line-control: #5e6d81;
|
|
129
|
+
--vx-ink-subtle: #8290a1;
|
|
130
|
+
--vx-code-bg: #0b0f14;
|
|
131
|
+
--vx-focus: #5cc2e6;
|
|
132
|
+
color-scheme: dark;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@theme inline {
|
|
136
|
+
--color-canvas: var(--vx-canvas);
|
|
137
|
+
--color-surface: var(--vx-surface);
|
|
138
|
+
--color-sunken: var(--vx-sunken);
|
|
139
|
+
--color-line: var(--vx-line);
|
|
140
|
+
--color-ink: var(--vx-ink);
|
|
141
|
+
--color-ink-muted: var(--vx-ink-muted);
|
|
142
|
+
--color-action: var(--vx-action);
|
|
143
|
+
--color-action-ink: var(--vx-action-ink);
|
|
144
|
+
--color-action-soft: var(--vx-action-soft);
|
|
145
|
+
--color-attention: var(--vx-attention);
|
|
146
|
+
--color-attention-soft: var(--vx-attention-soft);
|
|
147
|
+
--color-danger: var(--vx-danger);
|
|
148
|
+
--color-danger-soft: var(--vx-danger-soft);
|
|
149
|
+
--color-success: var(--vx-success);
|
|
150
|
+
--color-success-soft: var(--vx-success-soft);
|
|
151
|
+
--color-structure: var(--vx-structure);
|
|
152
|
+
--color-raised: var(--vx-raised);
|
|
153
|
+
--color-selected: var(--vx-selected);
|
|
154
|
+
--color-line-strong: var(--vx-line-strong);
|
|
155
|
+
--color-line-control: var(--vx-line-control);
|
|
156
|
+
--color-ink-subtle: var(--vx-ink-subtle);
|
|
157
|
+
--color-code-bg: var(--vx-code-bg);
|
|
158
|
+
--color-focus: var(--vx-focus);
|
|
159
|
+
--color-field: var(--vx-field);
|
|
160
|
+
--color-hover: var(--vx-hover);
|
|
161
|
+
--color-ring: var(--vx-ring);
|
|
162
|
+
--color-track: var(--vx-track);
|
|
163
|
+
--color-scrim: var(--vx-scrim);
|
|
164
|
+
/* Tags, chips, menu items, grid cells, inline code: a step inside a control. */
|
|
165
|
+
--radius-inner: calc(var(--vx-radius-control) - 2px);
|
|
166
|
+
--radius-control: var(--vx-radius-control);
|
|
167
|
+
--radius-panel: var(--vx-radius-panel);
|
|
168
|
+
/* Dialogs, sheets and the command palette. */
|
|
169
|
+
--radius-overlay: calc(var(--vx-radius-panel) + 4px);
|
|
170
|
+
/* Something that floats and can be dismissed has a shadow; nothing in the page's flow does. */
|
|
171
|
+
--shadow-overlay: 0 4px 12px var(--vx-shadow-overlay);
|
|
172
|
+
--shadow-modal: 0 12px 32px var(--vx-shadow-modal);
|
|
173
|
+
--shadow-drag: 0 8px 20px var(--vx-shadow-overlay);
|
|
174
|
+
--height-control: var(--vx-control-height);
|
|
175
|
+
--font-sans: var(--vx-font);
|
|
176
|
+
--font-mono: var(--vx-font-code);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/*
|
|
180
|
+
* Values a brand does not set. How dark a shadow is: deeper in dark, where a
|
|
181
|
+
* surface barely differs from what is under it. A control's height: 36 px
|
|
182
|
+
* everywhere, the boards' control. A text field's fill, the wash a row or a
|
|
183
|
+
* menu item takes on hover, the ring round something selected and the track a
|
|
184
|
+
* segmented control or a key chip sits on: worked out from the brand's own
|
|
185
|
+
* tokens, so changing those changes these.
|
|
186
|
+
*/
|
|
187
|
+
html {
|
|
188
|
+
--vx-shadow-overlay: rgb(0 0 0 / 0.1);
|
|
189
|
+
--vx-shadow-modal: rgb(0 0 0 / 0.16);
|
|
190
|
+
--vx-control-height: 36px;
|
|
191
|
+
--vx-field: var(--vx-surface);
|
|
192
|
+
--vx-hover: color-mix(in srgb, var(--vx-ink) 6%, transparent);
|
|
193
|
+
--vx-ring: color-mix(in srgb, var(--vx-action) 55%, transparent);
|
|
194
|
+
--vx-track: var(--vx-structure);
|
|
195
|
+
/* What the page turns under a dialog or a sheet. */
|
|
196
|
+
--vx-scrim: rgb(15 23 32 / 0.4);
|
|
197
|
+
}
|
|
198
|
+
@media (prefers-color-scheme: dark) {
|
|
199
|
+
html:not([data-theme="light"]) {
|
|
200
|
+
--vx-shadow-overlay: rgb(0 0 0 / 0.4);
|
|
201
|
+
--vx-shadow-modal: rgb(0 0 0 / 0.5);
|
|
202
|
+
--vx-field: var(--vx-sunken);
|
|
203
|
+
--vx-scrim: rgb(4 7 11 / 0.7);
|
|
204
|
+
--vx-hover: color-mix(in srgb, #94a3b8 8%, transparent);
|
|
205
|
+
--vx-ring: color-mix(in srgb, var(--vx-action) 50%, transparent);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
html[data-theme="dark"] {
|
|
209
|
+
--vx-shadow-overlay: rgb(0 0 0 / 0.4);
|
|
210
|
+
--vx-shadow-modal: rgb(0 0 0 / 0.5);
|
|
211
|
+
--vx-field: var(--vx-sunken);
|
|
212
|
+
--vx-scrim: rgb(4 7 11 / 0.7);
|
|
213
|
+
--vx-hover: color-mix(in srgb, #94a3b8 8%, transparent);
|
|
214
|
+
--vx-ring: color-mix(in srgb, var(--vx-action) 50%, transparent);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/*
|
|
218
|
+
* Type roles. Sizes, not brand: a theme does not set them. `text-label` and
|
|
219
|
+
* `text-tag` are written in capitals by the element that uses them, and the
|
|
220
|
+
* code roles are used with `font-mono`.
|
|
221
|
+
*
|
|
222
|
+
* | role | px / line | use |
|
|
223
|
+
* | display-lg | 26 / 32 | overview titles, sign-in |
|
|
224
|
+
* | display | 20 / 28 | the title of every working screen |
|
|
225
|
+
* | title | 16 / 24 | section, panel, inspector and dialog headings |
|
|
226
|
+
* | emphasis | 15 / 22 | a row's primary text in comfortable lists, lead lines |
|
|
227
|
+
* | body | 14 / 20 | interface text, values, cells |
|
|
228
|
+
* | body-sm | 13 / 18 | labels, hints, errors, secondary text, menu items |
|
|
229
|
+
* | meta | 12 / 16 | times, counts, captions, table headers |
|
|
230
|
+
* | label | 11 / 16 | group headings above sections |
|
|
231
|
+
* | code | 13 / 20 | paths, IDs, inline code, JSON |
|
|
232
|
+
* | code-sm | 12 / 18 | log lines, dense JSON |
|
|
233
|
+
* | tag | 10.5 / 12 | environment and classification tags |
|
|
234
|
+
*
|
|
235
|
+
* The px are the size at a scale of 1. Every size and line height is multiplied by
|
|
236
|
+
* `--vx-type-scale` (1 where nothing sets it, as in an app that imports this file), so
|
|
237
|
+
* one number scales body and headings together and the layout's spacing stays put.
|
|
238
|
+
*/
|
|
239
|
+
@theme {
|
|
240
|
+
--text-display-lg: calc(26px * var(--vx-type-scale, 1));
|
|
241
|
+
--text-display-lg--line-height: calc(32px * var(--vx-type-scale, 1));
|
|
242
|
+
--text-display-lg--letter-spacing: -0.015em;
|
|
243
|
+
--text-display-lg--font-weight: 600;
|
|
244
|
+
--text-display: calc(20px * var(--vx-type-scale, 1));
|
|
245
|
+
--text-display--line-height: calc(28px * var(--vx-type-scale, 1));
|
|
246
|
+
--text-display--letter-spacing: -0.01em;
|
|
247
|
+
--text-display--font-weight: 600;
|
|
248
|
+
--text-title: calc(16px * var(--vx-type-scale, 1));
|
|
249
|
+
--text-title--line-height: calc(24px * var(--vx-type-scale, 1));
|
|
250
|
+
--text-title--font-weight: 600;
|
|
251
|
+
--text-emphasis: calc(15px * var(--vx-type-scale, 1));
|
|
252
|
+
--text-emphasis--line-height: calc(22px * var(--vx-type-scale, 1));
|
|
253
|
+
--text-emphasis--font-weight: 500;
|
|
254
|
+
--text-body: calc(14px * var(--vx-type-scale, 1));
|
|
255
|
+
--text-body--line-height: calc(20px * var(--vx-type-scale, 1));
|
|
256
|
+
--text-body-sm: calc(13px * var(--vx-type-scale, 1));
|
|
257
|
+
--text-body-sm--line-height: calc(18px * var(--vx-type-scale, 1));
|
|
258
|
+
--text-meta: calc(12px * var(--vx-type-scale, 1));
|
|
259
|
+
--text-meta--line-height: calc(16px * var(--vx-type-scale, 1));
|
|
260
|
+
--text-label: calc(11px * var(--vx-type-scale, 1));
|
|
261
|
+
--text-label--line-height: calc(16px * var(--vx-type-scale, 1));
|
|
262
|
+
--text-label--letter-spacing: 0.06em;
|
|
263
|
+
--text-label--font-weight: 600;
|
|
264
|
+
--text-code: calc(13px * var(--vx-type-scale, 1));
|
|
265
|
+
--text-code--line-height: calc(20px * var(--vx-type-scale, 1));
|
|
266
|
+
--text-code-sm: calc(12px * var(--vx-type-scale, 1));
|
|
267
|
+
--text-code-sm--line-height: calc(18px * var(--vx-type-scale, 1));
|
|
268
|
+
--text-tag: calc(10.5px * var(--vx-type-scale, 1));
|
|
269
|
+
--text-tag--line-height: calc(12px * var(--vx-type-scale, 1));
|
|
270
|
+
--text-tag--letter-spacing: 0.06em;
|
|
271
|
+
--text-tag--font-weight: 600;
|
|
272
|
+
|
|
273
|
+
/* The width of a line of prose. */
|
|
274
|
+
--container-measure: 72ch;
|
|
275
|
+
|
|
276
|
+
/* Motion: only to show where something came from, or that it finished. */
|
|
277
|
+
--ease-out: cubic-bezier(0.2, 0, 0, 1);
|
|
278
|
+
--animate-spin-slow: spin 2.4s linear infinite;
|
|
279
|
+
--animate-arrive: arrive 180ms cubic-bezier(0.2, 0, 0, 1);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
@keyframes arrive {
|
|
283
|
+
from {
|
|
284
|
+
opacity: 0;
|
|
285
|
+
background-color: var(--vx-action-soft);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/*
|
|
290
|
+
* Layers, lowest first. A sheet sits under a dialog opened from it; menus and
|
|
291
|
+
* comboboxes over both; toasts over everything but the skip link.
|
|
292
|
+
*/
|
|
293
|
+
@utility layer-sticky {
|
|
294
|
+
z-index: 10;
|
|
295
|
+
}
|
|
296
|
+
@utility layer-sheet {
|
|
297
|
+
z-index: 40;
|
|
298
|
+
}
|
|
299
|
+
@utility layer-dialog {
|
|
300
|
+
z-index: 60;
|
|
301
|
+
}
|
|
302
|
+
@utility layer-popover {
|
|
303
|
+
z-index: 70;
|
|
304
|
+
}
|
|
305
|
+
@utility layer-toast {
|
|
306
|
+
z-index: 80;
|
|
307
|
+
}
|
|
308
|
+
@utility layer-skip {
|
|
309
|
+
z-index: 90;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/*
|
|
313
|
+
* Motion durations (07 §7.10): none for selection, hover and tab change; 120 ms
|
|
314
|
+
* for hover and press backgrounds; 180 ms for menus, popovers and tooltips; 240
|
|
315
|
+
* ms for sheets and dialogs. Every transition names one; under reduced motion
|
|
316
|
+
* none runs. A row that arrives live fades in over `motion-base`.
|
|
317
|
+
*/
|
|
318
|
+
@utility motion-instant {
|
|
319
|
+
transition-duration: 0ms;
|
|
320
|
+
}
|
|
321
|
+
@utility motion-fast {
|
|
322
|
+
transition-duration: 120ms;
|
|
323
|
+
transition-timing-function: var(--ease-out);
|
|
324
|
+
}
|
|
325
|
+
@utility motion-base {
|
|
326
|
+
transition-duration: 180ms;
|
|
327
|
+
transition-timing-function: var(--ease-out);
|
|
328
|
+
}
|
|
329
|
+
@utility motion-slow {
|
|
330
|
+
transition-duration: 240ms;
|
|
331
|
+
transition-timing-function: var(--ease-out);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
body {
|
|
335
|
+
margin: 0;
|
|
336
|
+
background: var(--vx-canvas);
|
|
337
|
+
color: var(--vx-ink);
|
|
338
|
+
font-family: var(--vx-font);
|
|
339
|
+
font-size: calc(14px * var(--vx-type-scale, 1));
|
|
340
|
+
line-height: calc(20px * var(--vx-type-scale, 1));
|
|
341
|
+
font-variant-numeric: tabular-nums;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
:focus-visible {
|
|
345
|
+
outline: 2px solid var(--vx-focus);
|
|
346
|
+
outline-offset: 2px;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
@media (prefers-reduced-motion: reduce) {
|
|
350
|
+
* {
|
|
351
|
+
transition: none !important;
|
|
352
|
+
animation: none !important;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/*
|
|
357
|
+
* Checkboxes and radios, drawn the same in both themes as the boards draw them: an empty box or
|
|
358
|
+
* ring with the control's border while off (the browser's own dark box is a grey fill), the
|
|
359
|
+
* action colour with a tick or a dot while on. The ones that carry the control for a styled label
|
|
360
|
+
* (`sr-only`) are not seen and are left alone.
|
|
361
|
+
*/
|
|
362
|
+
input[type="checkbox"]:not(.sr-only),
|
|
363
|
+
input[type="radio"]:not(.sr-only) {
|
|
364
|
+
appearance: none;
|
|
365
|
+
display: inline-grid;
|
|
366
|
+
flex-shrink: 0;
|
|
367
|
+
place-content: center;
|
|
368
|
+
width: 1rem;
|
|
369
|
+
height: 1rem;
|
|
370
|
+
margin: 0;
|
|
371
|
+
border: 1.5px solid var(--vx-line-control);
|
|
372
|
+
background: transparent;
|
|
373
|
+
cursor: pointer;
|
|
374
|
+
}
|
|
375
|
+
input[type="checkbox"]:not(.sr-only) {
|
|
376
|
+
border-radius: 4px;
|
|
377
|
+
}
|
|
378
|
+
input[type="radio"]:not(.sr-only) {
|
|
379
|
+
border-radius: 999px;
|
|
380
|
+
}
|
|
381
|
+
input[type="checkbox"]:not(.sr-only):checked,
|
|
382
|
+
input[type="radio"]:not(.sr-only):checked {
|
|
383
|
+
border-color: var(--vx-action);
|
|
384
|
+
}
|
|
385
|
+
input[type="checkbox"]:not(.sr-only):checked {
|
|
386
|
+
background:
|
|
387
|
+
var(--vx-action)
|
|
388
|
+
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
|
|
389
|
+
center / 100% no-repeat;
|
|
390
|
+
}
|
|
391
|
+
input[type="radio"]:not(.sr-only):checked {
|
|
392
|
+
background: radial-gradient(circle, var(--vx-action) 0 40%, transparent 45%);
|
|
393
|
+
}
|
|
394
|
+
input[type="checkbox"]:not(.sr-only):indeterminate {
|
|
395
|
+
border-color: var(--vx-action);
|
|
396
|
+
background:
|
|
397
|
+
var(--vx-action)
|
|
398
|
+
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")
|
|
399
|
+
center / 100% no-repeat;
|
|
400
|
+
}
|
|
401
|
+
input[type="checkbox"]:not(.sr-only):disabled,
|
|
402
|
+
input[type="radio"]:not(.sr-only):disabled {
|
|
403
|
+
opacity: 0.5;
|
|
404
|
+
cursor: default;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/*
|
|
408
|
+
* Forced colors (Windows high contrast) removes every background, so what is chosen cannot be told
|
|
409
|
+
* by its fill. Whatever says it is chosen (a page, a tab, a device, a tile, a chip, the app's page
|
|
410
|
+
* tabs) is outlined in the system's highlight colour, once, here, for everything in the kit. A
|
|
411
|
+
* focused one keeps its focus ring.
|
|
412
|
+
*/
|
|
413
|
+
@media (forced-colors: active) {
|
|
414
|
+
:is(
|
|
415
|
+
[aria-current="page"],
|
|
416
|
+
[aria-current="true"],
|
|
417
|
+
[aria-selected="true"],
|
|
418
|
+
[aria-pressed="true"],
|
|
419
|
+
[aria-checked="true"],
|
|
420
|
+
[data-selected],
|
|
421
|
+
[data-state="on"],
|
|
422
|
+
[data-state="active"],
|
|
423
|
+
[data-state="checked"]
|
|
424
|
+
):not(:focus-visible, input, svg) {
|
|
425
|
+
outline: 2px solid Highlight;
|
|
426
|
+
outline-offset: -2px;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/* A button that cannot be pressed keeps an edge in forced colors, drawn in the system's grey, whatever its fill was. */
|
|
431
|
+
@media (forced-colors: active) {
|
|
432
|
+
:is(button, a[role="button"])[disabled],
|
|
433
|
+
:is(button, a, [role="menuitem"])[aria-disabled="true"] {
|
|
434
|
+
border: 2px solid GrayText;
|
|
435
|
+
color: GrayText;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The type scale of the console and of the served apps (owner, 2026-11-24): body text is 16 px up to 1920 CSS px wide, 18 px
|
|
3
|
+
* from 2560 (2K/QHD) and 20 px from 3840 (4K). Steps, not a ramp: min-width queries at 2560 and
|
|
4
|
+
* 3840, so 1921-2559 stays at 16 and 2561-3839 at 18. The roles in tokens.css are written for a
|
|
5
|
+
* 14 px body, so the scale is the body size over 14; headings and every other role follow by the
|
|
6
|
+
* same ratio. Spacing and icons do not scale. The served apps runtime imports this same file, so a page in the builder's canvas, an app's preview and a dashboard draw at the size the published app does. The browser reports CSS pixels: a 4K screen at 150%
|
|
7
|
+
* display scaling is 2560 wide and gets 18.
|
|
8
|
+
*/
|
|
9
|
+
:root {
|
|
10
|
+
--vx-type-scale: calc(16 / 14);
|
|
11
|
+
/* How much bigger than the 16 px step: for a fixed width that holds text, such as the console's rail. */
|
|
12
|
+
--vx-type-growth: 1;
|
|
13
|
+
}
|
|
14
|
+
@media (min-width: 2560px) {
|
|
15
|
+
:root {
|
|
16
|
+
--vx-type-scale: calc(18 / 14);
|
|
17
|
+
--vx-type-growth: calc(18 / 16);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
@media (min-width: 3840px) {
|
|
21
|
+
:root {
|
|
22
|
+
--vx-type-scale: calc(20 / 14);
|
|
23
|
+
--vx-type-growth: calc(20 / 16);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* A phone's text boxes are 16 px at least, or the browser zooms in when one takes focus. */
|
|
28
|
+
@media (max-width: 640px) {
|
|
29
|
+
input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]),
|
|
30
|
+
select,
|
|
31
|
+
textarea {
|
|
32
|
+
font-size: max(16px, 1em);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Things that change places move to their new place and are not just found
|
|
4
|
+
* there: a column moved up with its arrow, a widget moved along a row from the
|
|
5
|
+
* keyboard. Without it the list is redrawn in its new order in one frame, and
|
|
6
|
+
* the reader has to find what moved.
|
|
7
|
+
*
|
|
8
|
+
* Give the returned ref to the element that holds them, and each thing that
|
|
9
|
+
* can move a `data-flip-key` that stays with it. Whenever `order` changes,
|
|
10
|
+
* each is played from where it was to where it is, over `motion-base`. Nothing
|
|
11
|
+
* moves under reduced motion, or while `paused` (a pointer is dragging, and
|
|
12
|
+
* the drag is the motion).
|
|
13
|
+
*
|
|
14
|
+
* Every reordering that is not a drag goes through this: `MoveButtons` are the
|
|
15
|
+
* buttons for it, and `enforce.test.ts` holds new ones to both.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useFlip<E extends HTMLElement>(order: string, options?: {
|
|
18
|
+
paused?: boolean;
|
|
19
|
+
/** The holder, when the caller already has a ref for it: a canvas that measures it too. */
|
|
20
|
+
ref?: RefObject<E | null>;
|
|
21
|
+
}): RefObject<E | null>;
|
|
22
|
+
/**
|
|
23
|
+
* A name for each place in a list whose items have none of their own, such
|
|
24
|
+
* as the cases of a branch while their names are being typed. The name stays
|
|
25
|
+
* with the item when it is moved, so it is the item that moves and what is
|
|
26
|
+
* being typed into it keeps focus. Tell it of every move and removal.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useKeys(count: number): {
|
|
29
|
+
keys: string[];
|
|
30
|
+
move: (from: number, to: number) => void;
|
|
31
|
+
remove: (at: number) => void;
|
|
32
|
+
};
|
package/dist/useFlip.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef } from "react";
|
|
2
|
+
/** `motion-base` and `--ease-out` (tokens.css), for motion that script starts. */
|
|
3
|
+
const MOVE_MS = 180;
|
|
4
|
+
const EASE = "cubic-bezier(0.2, 0, 0, 1)";
|
|
5
|
+
const still = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6
|
+
/**
|
|
7
|
+
* Things that change places move to their new place and are not just found
|
|
8
|
+
* there: a column moved up with its arrow, a widget moved along a row from the
|
|
9
|
+
* keyboard. Without it the list is redrawn in its new order in one frame, and
|
|
10
|
+
* the reader has to find what moved.
|
|
11
|
+
*
|
|
12
|
+
* Give the returned ref to the element that holds them, and each thing that
|
|
13
|
+
* can move a `data-flip-key` that stays with it. Whenever `order` changes,
|
|
14
|
+
* each is played from where it was to where it is, over `motion-base`. Nothing
|
|
15
|
+
* moves under reduced motion, or while `paused` (a pointer is dragging, and
|
|
16
|
+
* the drag is the motion).
|
|
17
|
+
*
|
|
18
|
+
* Every reordering that is not a drag goes through this: `MoveButtons` are the
|
|
19
|
+
* buttons for it, and `enforce.test.ts` holds new ones to both.
|
|
20
|
+
*/
|
|
21
|
+
export function useFlip(order, options = {}) {
|
|
22
|
+
const own = useRef(null);
|
|
23
|
+
const holder = options.ref ?? own;
|
|
24
|
+
const before = useRef({
|
|
25
|
+
order,
|
|
26
|
+
places: new Map(),
|
|
27
|
+
});
|
|
28
|
+
const paused = options.paused === true;
|
|
29
|
+
const playing = useRef(new Map());
|
|
30
|
+
// After every draw, not only a reordering: where things were is as of the last draw.
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
const node = holder.current;
|
|
33
|
+
if (!node)
|
|
34
|
+
return;
|
|
35
|
+
node.setAttribute("data-flip-holder", "");
|
|
36
|
+
const origin = node.getBoundingClientRect();
|
|
37
|
+
// A holder drawn scaled down (a sheet in the builder's canvas) is moved in its own pixels.
|
|
38
|
+
const scale = node.offsetWidth > 0 && origin.width > 0 ? origin.width / node.offsetWidth : 1;
|
|
39
|
+
const places = new Map();
|
|
40
|
+
const moved = [];
|
|
41
|
+
const reordered = before.current.order !== order;
|
|
42
|
+
for (const child of node.querySelectorAll("[data-flip-key]")) {
|
|
43
|
+
// Only its own: a list inside a list moves its own things.
|
|
44
|
+
if (child.closest("[data-flip-holder]") !== node)
|
|
45
|
+
continue;
|
|
46
|
+
const key = child.dataset.flipKey;
|
|
47
|
+
// One still on its way is seen where its motion has got to, and is laid out where it goes:
|
|
48
|
+
// the two are kept apart, so that a move that interrupts a move starts from what is seen.
|
|
49
|
+
const running = playing.current.get(key);
|
|
50
|
+
const shift = running && typeof DOMMatrixReadOnly === "function"
|
|
51
|
+
? new DOMMatrixReadOnly(getComputedStyle(child).transform)
|
|
52
|
+
: undefined;
|
|
53
|
+
const carried = { x: (shift?.e ?? 0) * scale, y: (shift?.f ?? 0) * scale };
|
|
54
|
+
const box = child.getBoundingClientRect();
|
|
55
|
+
// From the holder's corner, so that scrolling the page between draws moves nothing.
|
|
56
|
+
const place = { x: box.left - origin.left - carried.x, y: box.top - origin.top - carried.y };
|
|
57
|
+
places.set(key, place);
|
|
58
|
+
const was = before.current.places.get(key);
|
|
59
|
+
// Less than a pixel is rounding, not a move.
|
|
60
|
+
if (reordered && was && (Math.abs(was.x - place.x) >= 1 || Math.abs(was.y - place.y) >= 1)) {
|
|
61
|
+
moved.push([
|
|
62
|
+
child,
|
|
63
|
+
key,
|
|
64
|
+
(was.x - place.x + carried.x) / scale,
|
|
65
|
+
(was.y - place.y + carried.y) / scale,
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
before.current = { order, places };
|
|
70
|
+
if (paused || still())
|
|
71
|
+
return;
|
|
72
|
+
for (const [child, key, dx, dy] of moved) {
|
|
73
|
+
child.dataset.flipMoving = "";
|
|
74
|
+
const played = child.animate?.([{ transform: `translate(${dx}px, ${dy}px)` }, { transform: "translate(0, 0)" }], { duration: MOVE_MS, easing: EASE });
|
|
75
|
+
const last = playing.current.get(key);
|
|
76
|
+
if (played)
|
|
77
|
+
playing.current.set(key, played);
|
|
78
|
+
// The one it takes over from ends now; the new one starts where that one was.
|
|
79
|
+
last?.cancel();
|
|
80
|
+
const done = () => {
|
|
81
|
+
if (played && playing.current.get(key) !== played)
|
|
82
|
+
return;
|
|
83
|
+
playing.current.delete(key);
|
|
84
|
+
delete child.dataset.flipMoving;
|
|
85
|
+
};
|
|
86
|
+
if (played)
|
|
87
|
+
played.finished.then(done, done);
|
|
88
|
+
else
|
|
89
|
+
done();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return holder;
|
|
93
|
+
}
|
|
94
|
+
let made = 0;
|
|
95
|
+
/**
|
|
96
|
+
* A name for each place in a list whose items have none of their own, such
|
|
97
|
+
* as the cases of a branch while their names are being typed. The name stays
|
|
98
|
+
* with the item when it is moved, so it is the item that moves and what is
|
|
99
|
+
* being typed into it keeps focus. Tell it of every move and removal.
|
|
100
|
+
*/
|
|
101
|
+
export function useKeys(count) {
|
|
102
|
+
const keys = useRef([]);
|
|
103
|
+
while (keys.current.length < count)
|
|
104
|
+
keys.current.push(`k${++made}`);
|
|
105
|
+
if (keys.current.length > count)
|
|
106
|
+
keys.current.length = count;
|
|
107
|
+
return {
|
|
108
|
+
keys: keys.current,
|
|
109
|
+
move: (from, to) => {
|
|
110
|
+
const [taken] = keys.current.splice(from, 1);
|
|
111
|
+
if (taken !== undefined)
|
|
112
|
+
keys.current.splice(to, 0, taken);
|
|
113
|
+
},
|
|
114
|
+
remove: (at) => {
|
|
115
|
+
keys.current.splice(at, 1);
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|