@liberation-data/desk 0.10.0 → 0.12.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/README.md +24 -0
- package/dist/css/controls.css +86 -0
- package/dist/css/setup.css +17 -1
- package/dist/desk.css +103 -1
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/progress.d.ts +39 -0
- package/dist/react/progress.d.ts.map +1 -0
- package/dist/react/progress.js +47 -0
- package/dist/react/progress.js.map +1 -0
- package/dist/react/windowBoundary.d.ts.map +1 -1
- package/dist/react/windowBoundary.js +7 -1
- package/dist/react/windowBoundary.js.map +1 -1
- package/llms.txt +14 -1
- package/package.json +1 -1
- package/src/css/controls.css +86 -0
- package/src/css/setup.css +17 -1
- package/src/react/index.ts +2 -0
- package/src/react/progress.tsx +98 -0
- package/src/react/windowBoundary.tsx +7 -5
package/README.md
CHANGED
|
@@ -245,6 +245,30 @@ keeps it for screen readers), and an `error` marks it invalid and replaces the h
|
|
|
245
245
|
is the handful of cards a setup step turns on — an icon, a label, a line of why — with native radios
|
|
246
246
|
underneath, so it is one tab stop and the arrow keys move the choice.
|
|
247
247
|
|
|
248
|
+
## Waiting
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
import { Loading, Spinner } from '@liberation-data/desk/react'
|
|
252
|
+
|
|
253
|
+
<Spinner label="Saving the ride" /> // inline: beside a control, in a toolbar
|
|
254
|
+
<Loading label="Asking the weather service" // a view with nothing else on it yet
|
|
255
|
+
slow="It answers slowly on a Friday. The garage works without it." />
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
A wait says so within a moment, and if it goes on it says more. `Spinner` is the mark on its own — its
|
|
259
|
+
label is read aloud rather than drawn, because inline the thing it sits beside has usually said it already.
|
|
260
|
+
`Loading` fills the space the content will take, names what is on its way, and adds `slow` once the wait
|
|
261
|
+
passes three seconds, which is where a spinner alone stops being an answer.
|
|
262
|
+
|
|
263
|
+
There is no determinate bar, and that is deliberate. A bar needs a fraction the browser can actually see,
|
|
264
|
+
and one request whose progress the server never reports has none — a bar drawn over it invents the single
|
|
265
|
+
number it exists to report. Work that has real steps has them named instead, in order, with the
|
|
266
|
+
[setup assistant's](#setup-assistant) `Checklist`.
|
|
267
|
+
|
|
268
|
+
Each is one `role="status"`, and `slow` arrives inside that same region so a screen reader hears the
|
|
269
|
+
explanation as news. Under `prefers-reduced-motion` the ring stops turning and breathes instead: nothing
|
|
270
|
+
travels, and the view still reads as alive rather than as one that has died mid-load.
|
|
271
|
+
|
|
248
272
|
## Setup assistant
|
|
249
273
|
|
|
250
274
|

|
package/dist/css/controls.css
CHANGED
|
@@ -973,3 +973,89 @@
|
|
|
973
973
|
width: 40px;
|
|
974
974
|
height: 40px;
|
|
975
975
|
}
|
|
976
|
+
|
|
977
|
+
/*
|
|
978
|
+
* WAITING. A mark that turns while something is on its way (HIG.md §7), and the panel-sized
|
|
979
|
+
* version of it for a view that has nothing else to draw yet.
|
|
980
|
+
*
|
|
981
|
+
* It lives beside the controls rather than in a part of its own so that an app importing the
|
|
982
|
+
* pieces it draws cannot end up with a spinner and no rule to draw it with.
|
|
983
|
+
*/
|
|
984
|
+
.desk-spinner {
|
|
985
|
+
display: inline-flex;
|
|
986
|
+
align-items: center;
|
|
987
|
+
gap: var(--desk-space-2);
|
|
988
|
+
color: var(--desk-muted);
|
|
989
|
+
font-size: 13px;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.desk-spinner-ring {
|
|
993
|
+
box-sizing: border-box;
|
|
994
|
+
flex: none;
|
|
995
|
+
border-radius: 50%;
|
|
996
|
+
/* THE ARC IS THE INK, not the accent. The accent means focus and selection, and neither is
|
|
997
|
+
happening; the ink is near-white on a dark ground and near-black on a light one, so one
|
|
998
|
+
rule is bright on both without a colour that only works in one theme. The track is a mix of
|
|
999
|
+
the same ink rather than --desk-rule, which disappears against the surface at this size. */
|
|
1000
|
+
border: 2px solid color-mix(in srgb, var(--desk-ink) 20%, transparent);
|
|
1001
|
+
border-top-color: var(--desk-ink);
|
|
1002
|
+
animation: desk-spin 900ms linear infinite;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
.desk-spinner-ring[data-size="small"] { width: 12px; height: 12px; border-width: 1.5px; }
|
|
1006
|
+
.desk-spinner-ring[data-size="regular"] { width: 16px; height: 16px; }
|
|
1007
|
+
.desk-spinner-ring[data-size="large"] { width: 28px; height: 28px; border-width: 3px; }
|
|
1008
|
+
|
|
1009
|
+
.desk-spinner-label[data-hidden] {
|
|
1010
|
+
position: absolute;
|
|
1011
|
+
width: 1px;
|
|
1012
|
+
height: 1px;
|
|
1013
|
+
margin: -1px;
|
|
1014
|
+
padding: 0;
|
|
1015
|
+
overflow: hidden;
|
|
1016
|
+
clip-path: inset(50%);
|
|
1017
|
+
white-space: nowrap;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
.desk-loading {
|
|
1021
|
+
display: flex;
|
|
1022
|
+
flex-direction: column;
|
|
1023
|
+
align-items: center;
|
|
1024
|
+
justify-content: center;
|
|
1025
|
+
gap: var(--desk-space-3);
|
|
1026
|
+
/* Fills whatever it was given, so it stands where the content will stand rather than at the
|
|
1027
|
+
top of the empty space the content has not taken yet. */
|
|
1028
|
+
min-height: 100%;
|
|
1029
|
+
padding: var(--desk-space-6) var(--desk-space-4);
|
|
1030
|
+
text-align: center;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
.desk-loading-label {
|
|
1034
|
+
margin: 0;
|
|
1035
|
+
color: var(--desk-muted);
|
|
1036
|
+
font-size: 13px;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/* Quieter than the label: it arrived second and it is the smaller fact. */
|
|
1040
|
+
.desk-loading-slow {
|
|
1041
|
+
max-width: 44ch;
|
|
1042
|
+
margin: 0;
|
|
1043
|
+
color: var(--desk-muted);
|
|
1044
|
+
font-size: 12px;
|
|
1045
|
+
opacity: 0.85;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
@keyframes desk-spin { to { transform: rotate(360deg); } }
|
|
1049
|
+
|
|
1050
|
+
/* A FADE, NOT A FREEZE. §2 Motion asks for movement to go and fades to stay, and a ring that has
|
|
1051
|
+
simply stopped is indistinguishable from a view that has. Breathing says the same thing the
|
|
1052
|
+
turning did, without anything travelling across the screen. */
|
|
1053
|
+
@keyframes desk-spinner-breathe { 50% { opacity: 0.35; } }
|
|
1054
|
+
|
|
1055
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1056
|
+
.desk-spinner-ring {
|
|
1057
|
+
border-color: color-mix(in srgb, var(--desk-ink) 20%, transparent);
|
|
1058
|
+
border-top-color: var(--desk-ink);
|
|
1059
|
+
animation: desk-spinner-breathe 1.8s ease-in-out infinite;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
package/dist/css/setup.css
CHANGED
|
@@ -104,10 +104,23 @@
|
|
|
104
104
|
|
|
105
105
|
/* ── Wizard ── */
|
|
106
106
|
|
|
107
|
+
/*
|
|
108
|
+
* ONE SIZE FOR EVERY STEP, not a floor with taller steps growing past it.
|
|
109
|
+
*
|
|
110
|
+
* `min-height` meant a step with an extra field was a taller card than the step before it, so the
|
|
111
|
+
* pane changed shape as somebody moved through setup and the buttons they were reaching for moved
|
|
112
|
+
* with it. Worse within a step: a choice that swaps one field for two resized the pane under the
|
|
113
|
+
* pointer.
|
|
114
|
+
*
|
|
115
|
+
* A fixed height costs a step that genuinely needs more room, which is why the content area
|
|
116
|
+
* scrolls rather than being clipped, and why the height is a token an app can raise once for all
|
|
117
|
+
* of its steps. `max-height` keeps the whole thing on a short screen.
|
|
118
|
+
*/
|
|
107
119
|
.desk-wizard {
|
|
108
120
|
box-sizing: border-box;
|
|
109
121
|
width: min(640px, 100%);
|
|
110
|
-
|
|
122
|
+
height: var(--desk-wizard-height, 520px);
|
|
123
|
+
max-height: 100%;
|
|
111
124
|
display: flex;
|
|
112
125
|
flex-direction: column;
|
|
113
126
|
border: 1px solid var(--desk-rule);
|
|
@@ -121,6 +134,9 @@
|
|
|
121
134
|
|
|
122
135
|
.desk-wizard-content {
|
|
123
136
|
flex: 1;
|
|
137
|
+
/* The card's height is fixed, so a step that needs more room scrolls inside it. */
|
|
138
|
+
min-height: 0;
|
|
139
|
+
overflow-y: auto;
|
|
124
140
|
display: flex;
|
|
125
141
|
flex-direction: column;
|
|
126
142
|
align-items: center;
|
package/dist/desk.css
CHANGED
|
@@ -1903,6 +1903,92 @@
|
|
|
1903
1903
|
height: 40px;
|
|
1904
1904
|
}
|
|
1905
1905
|
|
|
1906
|
+
/*
|
|
1907
|
+
* WAITING. A mark that turns while something is on its way (HIG.md §7), and the panel-sized
|
|
1908
|
+
* version of it for a view that has nothing else to draw yet.
|
|
1909
|
+
*
|
|
1910
|
+
* It lives beside the controls rather than in a part of its own so that an app importing the
|
|
1911
|
+
* pieces it draws cannot end up with a spinner and no rule to draw it with.
|
|
1912
|
+
*/
|
|
1913
|
+
.desk-spinner {
|
|
1914
|
+
display: inline-flex;
|
|
1915
|
+
align-items: center;
|
|
1916
|
+
gap: var(--desk-space-2);
|
|
1917
|
+
color: var(--desk-muted);
|
|
1918
|
+
font-size: 13px;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
.desk-spinner-ring {
|
|
1922
|
+
box-sizing: border-box;
|
|
1923
|
+
flex: none;
|
|
1924
|
+
border-radius: 50%;
|
|
1925
|
+
/* THE ARC IS THE INK, not the accent. The accent means focus and selection, and neither is
|
|
1926
|
+
happening; the ink is near-white on a dark ground and near-black on a light one, so one
|
|
1927
|
+
rule is bright on both without a colour that only works in one theme. The track is a mix of
|
|
1928
|
+
the same ink rather than --desk-rule, which disappears against the surface at this size. */
|
|
1929
|
+
border: 2px solid color-mix(in srgb, var(--desk-ink) 20%, transparent);
|
|
1930
|
+
border-top-color: var(--desk-ink);
|
|
1931
|
+
animation: desk-spin 900ms linear infinite;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
.desk-spinner-ring[data-size="small"] { width: 12px; height: 12px; border-width: 1.5px; }
|
|
1935
|
+
.desk-spinner-ring[data-size="regular"] { width: 16px; height: 16px; }
|
|
1936
|
+
.desk-spinner-ring[data-size="large"] { width: 28px; height: 28px; border-width: 3px; }
|
|
1937
|
+
|
|
1938
|
+
.desk-spinner-label[data-hidden] {
|
|
1939
|
+
position: absolute;
|
|
1940
|
+
width: 1px;
|
|
1941
|
+
height: 1px;
|
|
1942
|
+
margin: -1px;
|
|
1943
|
+
padding: 0;
|
|
1944
|
+
overflow: hidden;
|
|
1945
|
+
clip-path: inset(50%);
|
|
1946
|
+
white-space: nowrap;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
.desk-loading {
|
|
1950
|
+
display: flex;
|
|
1951
|
+
flex-direction: column;
|
|
1952
|
+
align-items: center;
|
|
1953
|
+
justify-content: center;
|
|
1954
|
+
gap: var(--desk-space-3);
|
|
1955
|
+
/* Fills whatever it was given, so it stands where the content will stand rather than at the
|
|
1956
|
+
top of the empty space the content has not taken yet. */
|
|
1957
|
+
min-height: 100%;
|
|
1958
|
+
padding: var(--desk-space-6) var(--desk-space-4);
|
|
1959
|
+
text-align: center;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
.desk-loading-label {
|
|
1963
|
+
margin: 0;
|
|
1964
|
+
color: var(--desk-muted);
|
|
1965
|
+
font-size: 13px;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
/* Quieter than the label: it arrived second and it is the smaller fact. */
|
|
1969
|
+
.desk-loading-slow {
|
|
1970
|
+
max-width: 44ch;
|
|
1971
|
+
margin: 0;
|
|
1972
|
+
color: var(--desk-muted);
|
|
1973
|
+
font-size: 12px;
|
|
1974
|
+
opacity: 0.85;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
@keyframes desk-spin { to { transform: rotate(360deg); } }
|
|
1978
|
+
|
|
1979
|
+
/* A FADE, NOT A FREEZE. §2 Motion asks for movement to go and fades to stay, and a ring that has
|
|
1980
|
+
simply stopped is indistinguishable from a view that has. Breathing says the same thing the
|
|
1981
|
+
turning did, without anything travelling across the screen. */
|
|
1982
|
+
@keyframes desk-spinner-breathe { 50% { opacity: 0.35; } }
|
|
1983
|
+
|
|
1984
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1985
|
+
.desk-spinner-ring {
|
|
1986
|
+
border-color: color-mix(in srgb, var(--desk-ink) 20%, transparent);
|
|
1987
|
+
border-top-color: var(--desk-ink);
|
|
1988
|
+
animation: desk-spinner-breathe 1.8s ease-in-out infinite;
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1906
1992
|
/* @liberation-data/desk — overlays.css */
|
|
1907
1993
|
/* ── Overlays ── */
|
|
1908
1994
|
|
|
@@ -2630,10 +2716,23 @@
|
|
|
2630
2716
|
|
|
2631
2717
|
/* ── Wizard ── */
|
|
2632
2718
|
|
|
2719
|
+
/*
|
|
2720
|
+
* ONE SIZE FOR EVERY STEP, not a floor with taller steps growing past it.
|
|
2721
|
+
*
|
|
2722
|
+
* `min-height` meant a step with an extra field was a taller card than the step before it, so the
|
|
2723
|
+
* pane changed shape as somebody moved through setup and the buttons they were reaching for moved
|
|
2724
|
+
* with it. Worse within a step: a choice that swaps one field for two resized the pane under the
|
|
2725
|
+
* pointer.
|
|
2726
|
+
*
|
|
2727
|
+
* A fixed height costs a step that genuinely needs more room, which is why the content area
|
|
2728
|
+
* scrolls rather than being clipped, and why the height is a token an app can raise once for all
|
|
2729
|
+
* of its steps. `max-height` keeps the whole thing on a short screen.
|
|
2730
|
+
*/
|
|
2633
2731
|
.desk-wizard {
|
|
2634
2732
|
box-sizing: border-box;
|
|
2635
2733
|
width: min(640px, 100%);
|
|
2636
|
-
|
|
2734
|
+
height: var(--desk-wizard-height, 520px);
|
|
2735
|
+
max-height: 100%;
|
|
2637
2736
|
display: flex;
|
|
2638
2737
|
flex-direction: column;
|
|
2639
2738
|
border: 1px solid var(--desk-rule);
|
|
@@ -2647,6 +2746,9 @@
|
|
|
2647
2746
|
|
|
2648
2747
|
.desk-wizard-content {
|
|
2649
2748
|
flex: 1;
|
|
2749
|
+
/* The card's height is fixed, so a step that needs more room scrolls inside it. */
|
|
2750
|
+
min-height: 0;
|
|
2751
|
+
overflow-y: auto;
|
|
2650
2752
|
display: flex;
|
|
2651
2753
|
flex-direction: column;
|
|
2652
2754
|
align-items: center;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { lazyWindow } from './windowBoundary.js';
|
|
|
16
16
|
export type { WindowFailed, WindowLoading } from './windowBoundary.js';
|
|
17
17
|
export { Button, Checkbox, ChoiceGroup, RadioGroup, SegmentedControl, Slider, TextField, Toggle } from './controls.js';
|
|
18
18
|
export type { ButtonIntent, ButtonProps, CheckboxProps, ChoiceGroupProps, ChoiceOption, RadioGroupProps, RadioOption, SegmentedControlProps, SegmentedOption, SliderProps, TextFieldProps, ToggleProps, } from './controls.js';
|
|
19
|
+
export { Loading, Spinner } from './progress.js';
|
|
20
|
+
export type { LoadingProps, SpinnerProps, SpinnerSize } from './progress.js';
|
|
19
21
|
export { Pane, Toolbar } from './pane.js';
|
|
20
22
|
export type { PaneProps, ToolbarProps } from './pane.js';
|
|
21
23
|
export { InfoTip } from './infoTip.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC1E,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAChG,YAAY,EACV,OAAO,EACP,IAAI,EACJ,gBAAgB,EAChB,eAAe,EACf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AAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/react/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { Desktop } from './Desktop.js';
|
|
|
7
7
|
export { useDocumentTitle } from './documentTitle.js';
|
|
8
8
|
export { lazyWindow } from './windowBoundary.js';
|
|
9
9
|
export { Button, Checkbox, ChoiceGroup, RadioGroup, SegmentedControl, Slider, TextField, Toggle } from './controls.js';
|
|
10
|
+
export { Loading, Spinner } from './progress.js';
|
|
10
11
|
export { Pane, Toolbar } from './pane.js';
|
|
11
12
|
export { InfoTip } from './infoTip.js';
|
|
12
13
|
export { Checklist, useTasks } from './tasks.js';
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE1E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAWhG,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEnF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAetH,OAA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a,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAErG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE9E,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type SpinnerSize = 'small' | 'regular' | 'large';
|
|
3
|
+
export interface SpinnerProps {
|
|
4
|
+
/**
|
|
5
|
+
* What is being waited for, e.g. "Loading the conversation". Sentence case, no ellipsis — the
|
|
6
|
+
* turning says it is going. Read aloud, and shown only if `showLabel`.
|
|
7
|
+
*/
|
|
8
|
+
readonly label: string;
|
|
9
|
+
/** Beside the mark. Off by default: inline, the control it sits in has usually said it already. */
|
|
10
|
+
readonly showLabel?: boolean;
|
|
11
|
+
readonly size?: SpinnerSize;
|
|
12
|
+
readonly className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A wait, inline — beside a control, in a toolbar, in a row. For a panel with nothing else on it
|
|
16
|
+
* yet, `Loading` centres the same mark and says what is missing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Spinner({ label, showLabel, size, className }: SpinnerProps): import("react").JSX.Element;
|
|
19
|
+
export interface LoadingProps {
|
|
20
|
+
/** What is on its way, e.g. "Reading what your realms brought". Sentence case, no ellipsis. */
|
|
21
|
+
readonly label: string;
|
|
22
|
+
/**
|
|
23
|
+
* Said once the wait passes about three seconds, where a spinner alone stops being enough. Say
|
|
24
|
+
* what is taking the time and whether it is expected — never an apology, and never a guess at
|
|
25
|
+
* how much longer.
|
|
26
|
+
*/
|
|
27
|
+
readonly slow?: ReactNode;
|
|
28
|
+
/** How long before `slow` is said. Only move this for a wait that is known to be longer. */
|
|
29
|
+
readonly slowAfterMs?: number;
|
|
30
|
+
readonly size?: SpinnerSize;
|
|
31
|
+
readonly className?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A panel that has nothing to show yet, saying so in the space the content will take. It replaces
|
|
35
|
+
* the content rather than sitting above it: a spinner over a stale list is a screen claiming two
|
|
36
|
+
* things at once.
|
|
37
|
+
*/
|
|
38
|
+
export declare function Loading({ label, slow, slowAfterMs, size, className }: LoadingProps): import("react").JSX.Element;
|
|
39
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/react/progress.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAqBtC,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;AAEvD,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,mGAAmG;IACnG,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,SAAiB,EAAE,IAAgB,EAAE,SAAS,EAAE,EAAE,YAAY,+BAW9F;AAKD,MAAM,WAAW,YAAY;IAC3B,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB,4FAA4F;IAC5F,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,WAA2B,EAAE,IAAc,EAAE,SAAS,EAAE,EAAE,YAAY,+BAqB5G"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
/*
|
|
4
|
+
* WAITING, SAID OUT LOUD.
|
|
5
|
+
*
|
|
6
|
+
* HIG.md §7 asks for a spinner under about three seconds and a determinate bar beyond it. The bar
|
|
7
|
+
* is not offered here, because a bar needs something real to measure and most waits in an app like
|
|
8
|
+
* this are one request whose progress the browser cannot see. Drawing a bar over that invents the
|
|
9
|
+
* one number it exists to report.
|
|
10
|
+
*
|
|
11
|
+
* What is offered instead is the honest form of "says how far it has got": the spinner keeps
|
|
12
|
+
* turning, and after a few seconds it says MORE. A wait that outlives its welcome stops being a
|
|
13
|
+
* mark and starts being a sentence, which is the difference between a screen that is thinking and
|
|
14
|
+
* a screen that has died.
|
|
15
|
+
*/
|
|
16
|
+
/** The turning mark itself. Decorative — whoever draws it owns the words. */
|
|
17
|
+
function Ring({ size }) {
|
|
18
|
+
return _jsx("span", { className: "desk-spinner-ring", "data-size": size, "aria-hidden": "true" });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A wait, inline — beside a control, in a toolbar, in a row. For a panel with nothing else on it
|
|
22
|
+
* yet, `Loading` centres the same mark and says what is missing.
|
|
23
|
+
*/
|
|
24
|
+
export function Spinner({ label, showLabel = false, size = 'regular', className }) {
|
|
25
|
+
return (_jsxs("span", { className: ['desk-spinner', className].filter(Boolean).join(' '), role: "status", "data-labelled": showLabel || undefined, children: [_jsx(Ring, { size: size }), _jsx("span", { className: "desk-spinner-label", "data-hidden": showLabel ? undefined : true, children: label })] }));
|
|
26
|
+
}
|
|
27
|
+
/** How long a wait may go unexplained. HIG.md §7: a spinner alone is for under about three seconds. */
|
|
28
|
+
const SLOW_AFTER_MS = 3000;
|
|
29
|
+
/**
|
|
30
|
+
* A panel that has nothing to show yet, saying so in the space the content will take. It replaces
|
|
31
|
+
* the content rather than sitting above it: a spinner over a stale list is a screen claiming two
|
|
32
|
+
* things at once.
|
|
33
|
+
*/
|
|
34
|
+
export function Loading({ label, slow, slowAfterMs = SLOW_AFTER_MS, size = 'large', className }) {
|
|
35
|
+
const [slowed, setSlowed] = useState(false);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!slow)
|
|
38
|
+
return;
|
|
39
|
+
// Keyed on the note and the delay, so a panel that changes what it is waiting for waits again
|
|
40
|
+
// rather than inheriting the previous wait's expired timer and explaining itself instantly.
|
|
41
|
+
setSlowed(false);
|
|
42
|
+
const timer = setTimeout(() => setSlowed(true), slowAfterMs);
|
|
43
|
+
return () => clearTimeout(timer);
|
|
44
|
+
}, [slow, slowAfterMs]);
|
|
45
|
+
return (_jsxs("div", { className: ['desk-loading', className].filter(Boolean).join(' '), role: "status", children: [_jsx(Ring, { size: size }), _jsx("p", { className: "desk-loading-label", children: label }), slowed && slow && _jsx("p", { className: "desk-loading-slow", children: slow })] }));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/react/progress.tsx"],"names":[],"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;QAC5D,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAA;IAEvB,OAAO,CACL,eAAK,SAAS,EAAE,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,QAAQ,aAClF,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,EACpB,YAAG,SAAS,EAAC,oBAAoB,YAAE,KAAK,GAAK,EAG5C,MAAM,IAAI,IAAI,IAAI,YAAG,SAAS,EAAC,mBAAmB,YAAE,IAAI,GAAK,IAC1D,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windowBoundary.d.ts","sourceRoot":"","sources":["../../src/react/windowBoundary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkC,SAAS,EAAE,MAAM,OAAO,CAAA;AACrF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"windowBoundary.d.ts","sourceRoot":"","sources":["../../src/react/windowBoundary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkC,SAAS,EAAE,MAAM,OAAO,CAAA;AACrF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAWhD,MAAM,MAAM,aAAa,GAAG,CAAC,EAAE,EAAE,QAAQ,KAAK,SAAS,CAAA;AACvD,MAAM,MAAM,YAAY,GAAG,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,SAAS,CAAA;AA2DxF,wBAAgB,cAAc,CAAC,EAC7B,EAAE,EACF,OAAO,EACP,MAAM,EACN,QAAQ,GACT,EAAE;IACD,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAA;IAC3C,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAC7B,+BAMA;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAYjH"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Component, createContext, lazy, Suspense, useContext } from 'react';
|
|
3
3
|
import { Button } from './controls.js';
|
|
4
|
+
import { Loading } from './progress.js';
|
|
4
5
|
/** How many times this window has been reloaded: a lazy window loads afresh for each. */
|
|
5
6
|
const AttemptContext = createContext(0);
|
|
6
|
-
|
|
7
|
+
/*
|
|
8
|
+
* A window fetching its code says so the way any wait does. It was a line of text, which reads as
|
|
9
|
+
* a window that has finished and has nothing in it — the one thing a window still arriving must
|
|
10
|
+
* not look like.
|
|
11
|
+
*/
|
|
12
|
+
const defaultLoading = () => _jsx(Loading, { label: "Loading" });
|
|
7
13
|
const defaultFailed = (_id, error, reload) => (_jsxs("div", { className: "desk-window-status", role: "alert", children: [_jsx("b", { children: "This window could not open" }), _jsx("span", { className: "desk-window-status-detail", children: error.message }), _jsx(Button, { size: "small", onClick: reload, children: "Reload" })] }));
|
|
8
14
|
class WindowErrorBoundary extends Component {
|
|
9
15
|
state = { error: null, attempt: 0 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windowBoundary.js","sourceRoot":"","sources":["../../src/react/windowBoundary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EA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,cAAc,CAAC,CAAA;QAC1C,IAAI,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACnC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAA;YACnB,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAChC,CAAC;QACD,OAAO,KAAC,MAAM,OAAK,KAAK,GAAI,CAAA;IAC9B,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -235,6 +235,7 @@ useWindowId(): string | null // inside a window's content
|
|
|
235
235
|
const RoutePlanner = lazyWindow(() => import('./apps/RoutePlanner')) // use in renderWindow
|
|
236
236
|
```
|
|
237
237
|
|
|
238
|
+
The default fallback is `<Loading label="Loading" />`; pass `loading` to `Desktop` to replace it.
|
|
238
239
|
Every window has its own Suspense and error boundary: one window loading or throwing never blanks another,
|
|
239
240
|
the menu bar or the dock. A failure is logged with `console.error` and shows Reload, which remounts the
|
|
240
241
|
window; `lazyWindow` retries its import on reload, unlike `React.lazy`, which caches a failed import.
|
|
@@ -375,6 +376,18 @@ SearchCommand = 'desk.search' // a menu item can open i
|
|
|
375
376
|
label labelHidden? placeholder? disabled? size? />
|
|
376
377
|
```
|
|
377
378
|
|
|
379
|
+
### Waiting
|
|
380
|
+
|
|
381
|
+
```tsx
|
|
382
|
+
<Spinner label size?={'small'|'regular'|'large'} showLabel?={false} /> // inline; label is read, not shown
|
|
383
|
+
<Loading label slow?={ReactNode} slowAfterMs?={3000} size?={'large'} /> // a view with nothing on it yet
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Both are one `role="status"`. `Loading` shows `slow` once the wait passes `slowAfterMs`, inside that same
|
|
387
|
+
region, so its arrival is the announcement; the timer restarts when `slow` or `slowAfterMs` changes. There
|
|
388
|
+
is no determinate bar: a bar needs a fraction the browser can see, and work with real steps is a
|
|
389
|
+
`Checklist`. `Loading` fills the height it is given, so give its parent one.
|
|
390
|
+
|
|
378
391
|
### Lists
|
|
379
392
|
|
|
380
393
|
```tsx
|
|
@@ -452,7 +465,7 @@ Every value reads a `--desk-*` token; redefine tokens, never override selectors.
|
|
|
452
465
|
`--desk-surface`, `--desk-titlebar`, `--desk-ink`, `--desk-muted`, `--desk-rule`, `--desk-accent`,
|
|
453
466
|
`--desk-ok|warn|bad`, `--desk-on-accent`. Spacing `--desk-space-1..7` = 4, 8, 12, 16, 24, 32, 48 px. Also
|
|
454
467
|
`--desk-radius`, `--desk-control-height`, `--desk-control-radius`, `--desk-font`, `--desk-font-mono`,
|
|
455
|
-
`--desk-ease`, `--desk-dock-size`, `--desk-dock-glass`, `--desk-inset-bottom`.
|
|
468
|
+
`--desk-ease`, `--desk-dock-size`, `--desk-dock-glass`, `--desk-inset-bottom`, `--desk-wizard-height`.
|
|
456
469
|
|
|
457
470
|
Light and dark follow `prefers-color-scheme`; `data-theme="light" | "dark"` on the root wins.
|
|
458
471
|
|
package/package.json
CHANGED
package/src/css/controls.css
CHANGED
|
@@ -972,3 +972,89 @@
|
|
|
972
972
|
width: 40px;
|
|
973
973
|
height: 40px;
|
|
974
974
|
}
|
|
975
|
+
|
|
976
|
+
/*
|
|
977
|
+
* WAITING. A mark that turns while something is on its way (HIG.md §7), and the panel-sized
|
|
978
|
+
* version of it for a view that has nothing else to draw yet.
|
|
979
|
+
*
|
|
980
|
+
* It lives beside the controls rather than in a part of its own so that an app importing the
|
|
981
|
+
* pieces it draws cannot end up with a spinner and no rule to draw it with.
|
|
982
|
+
*/
|
|
983
|
+
.desk-spinner {
|
|
984
|
+
display: inline-flex;
|
|
985
|
+
align-items: center;
|
|
986
|
+
gap: var(--desk-space-2);
|
|
987
|
+
color: var(--desk-muted);
|
|
988
|
+
font-size: 13px;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
.desk-spinner-ring {
|
|
992
|
+
box-sizing: border-box;
|
|
993
|
+
flex: none;
|
|
994
|
+
border-radius: 50%;
|
|
995
|
+
/* THE ARC IS THE INK, not the accent. The accent means focus and selection, and neither is
|
|
996
|
+
happening; the ink is near-white on a dark ground and near-black on a light one, so one
|
|
997
|
+
rule is bright on both without a colour that only works in one theme. The track is a mix of
|
|
998
|
+
the same ink rather than --desk-rule, which disappears against the surface at this size. */
|
|
999
|
+
border: 2px solid color-mix(in srgb, var(--desk-ink) 20%, transparent);
|
|
1000
|
+
border-top-color: var(--desk-ink);
|
|
1001
|
+
animation: desk-spin 900ms linear infinite;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
.desk-spinner-ring[data-size="small"] { width: 12px; height: 12px; border-width: 1.5px; }
|
|
1005
|
+
.desk-spinner-ring[data-size="regular"] { width: 16px; height: 16px; }
|
|
1006
|
+
.desk-spinner-ring[data-size="large"] { width: 28px; height: 28px; border-width: 3px; }
|
|
1007
|
+
|
|
1008
|
+
.desk-spinner-label[data-hidden] {
|
|
1009
|
+
position: absolute;
|
|
1010
|
+
width: 1px;
|
|
1011
|
+
height: 1px;
|
|
1012
|
+
margin: -1px;
|
|
1013
|
+
padding: 0;
|
|
1014
|
+
overflow: hidden;
|
|
1015
|
+
clip-path: inset(50%);
|
|
1016
|
+
white-space: nowrap;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
.desk-loading {
|
|
1020
|
+
display: flex;
|
|
1021
|
+
flex-direction: column;
|
|
1022
|
+
align-items: center;
|
|
1023
|
+
justify-content: center;
|
|
1024
|
+
gap: var(--desk-space-3);
|
|
1025
|
+
/* Fills whatever it was given, so it stands where the content will stand rather than at the
|
|
1026
|
+
top of the empty space the content has not taken yet. */
|
|
1027
|
+
min-height: 100%;
|
|
1028
|
+
padding: var(--desk-space-6) var(--desk-space-4);
|
|
1029
|
+
text-align: center;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
.desk-loading-label {
|
|
1033
|
+
margin: 0;
|
|
1034
|
+
color: var(--desk-muted);
|
|
1035
|
+
font-size: 13px;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
/* Quieter than the label: it arrived second and it is the smaller fact. */
|
|
1039
|
+
.desk-loading-slow {
|
|
1040
|
+
max-width: 44ch;
|
|
1041
|
+
margin: 0;
|
|
1042
|
+
color: var(--desk-muted);
|
|
1043
|
+
font-size: 12px;
|
|
1044
|
+
opacity: 0.85;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
@keyframes desk-spin { to { transform: rotate(360deg); } }
|
|
1048
|
+
|
|
1049
|
+
/* A FADE, NOT A FREEZE. §2 Motion asks for movement to go and fades to stay, and a ring that has
|
|
1050
|
+
simply stopped is indistinguishable from a view that has. Breathing says the same thing the
|
|
1051
|
+
turning did, without anything travelling across the screen. */
|
|
1052
|
+
@keyframes desk-spinner-breathe { 50% { opacity: 0.35; } }
|
|
1053
|
+
|
|
1054
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1055
|
+
.desk-spinner-ring {
|
|
1056
|
+
border-color: color-mix(in srgb, var(--desk-ink) 20%, transparent);
|
|
1057
|
+
border-top-color: var(--desk-ink);
|
|
1058
|
+
animation: desk-spinner-breathe 1.8s ease-in-out infinite;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
package/src/css/setup.css
CHANGED
|
@@ -103,10 +103,23 @@
|
|
|
103
103
|
|
|
104
104
|
/* ── Wizard ── */
|
|
105
105
|
|
|
106
|
+
/*
|
|
107
|
+
* ONE SIZE FOR EVERY STEP, not a floor with taller steps growing past it.
|
|
108
|
+
*
|
|
109
|
+
* `min-height` meant a step with an extra field was a taller card than the step before it, so the
|
|
110
|
+
* pane changed shape as somebody moved through setup and the buttons they were reaching for moved
|
|
111
|
+
* with it. Worse within a step: a choice that swaps one field for two resized the pane under the
|
|
112
|
+
* pointer.
|
|
113
|
+
*
|
|
114
|
+
* A fixed height costs a step that genuinely needs more room, which is why the content area
|
|
115
|
+
* scrolls rather than being clipped, and why the height is a token an app can raise once for all
|
|
116
|
+
* of its steps. `max-height` keeps the whole thing on a short screen.
|
|
117
|
+
*/
|
|
106
118
|
.desk-wizard {
|
|
107
119
|
box-sizing: border-box;
|
|
108
120
|
width: min(640px, 100%);
|
|
109
|
-
|
|
121
|
+
height: var(--desk-wizard-height, 520px);
|
|
122
|
+
max-height: 100%;
|
|
110
123
|
display: flex;
|
|
111
124
|
flex-direction: column;
|
|
112
125
|
border: 1px solid var(--desk-rule);
|
|
@@ -120,6 +133,9 @@
|
|
|
120
133
|
|
|
121
134
|
.desk-wizard-content {
|
|
122
135
|
flex: 1;
|
|
136
|
+
/* The card's height is fixed, so a step that needs more room scrolls inside it. */
|
|
137
|
+
min-height: 0;
|
|
138
|
+
overflow-y: auto;
|
|
123
139
|
display: flex;
|
|
124
140
|
flex-direction: column;
|
|
125
141
|
align-items: center;
|
package/src/react/index.ts
CHANGED
|
@@ -38,6 +38,8 @@ export type {
|
|
|
38
38
|
TextFieldProps,
|
|
39
39
|
ToggleProps,
|
|
40
40
|
} from './controls.js'
|
|
41
|
+
export { Loading, Spinner } from './progress.js'
|
|
42
|
+
export type { LoadingProps, SpinnerProps, SpinnerSize } from './progress.js'
|
|
41
43
|
export { Pane, Toolbar } from './pane.js'
|
|
42
44
|
export type { PaneProps, ToolbarProps } from './pane.js'
|
|
43
45
|
export { InfoTip } from './infoTip.js'
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* WAITING, SAID OUT LOUD.
|
|
6
|
+
*
|
|
7
|
+
* HIG.md §7 asks for a spinner under about three seconds and a determinate bar beyond it. The bar
|
|
8
|
+
* is not offered here, because a bar needs something real to measure and most waits in an app like
|
|
9
|
+
* this are one request whose progress the browser cannot see. Drawing a bar over that invents the
|
|
10
|
+
* one number it exists to report.
|
|
11
|
+
*
|
|
12
|
+
* What is offered instead is the honest form of "says how far it has got": the spinner keeps
|
|
13
|
+
* turning, and after a few seconds it says MORE. A wait that outlives its welcome stops being a
|
|
14
|
+
* mark and starts being a sentence, which is the difference between a screen that is thinking and
|
|
15
|
+
* a screen that has died.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** The turning mark itself. Decorative — whoever draws it owns the words. */
|
|
19
|
+
function Ring({ size }: { readonly size: SpinnerSize }) {
|
|
20
|
+
return <span className="desk-spinner-ring" data-size={size} aria-hidden="true" />
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type SpinnerSize = 'small' | 'regular' | 'large'
|
|
24
|
+
|
|
25
|
+
export interface SpinnerProps {
|
|
26
|
+
/**
|
|
27
|
+
* What is being waited for, e.g. "Loading the conversation". Sentence case, no ellipsis — the
|
|
28
|
+
* turning says it is going. Read aloud, and shown only if `showLabel`.
|
|
29
|
+
*/
|
|
30
|
+
readonly label: string
|
|
31
|
+
/** Beside the mark. Off by default: inline, the control it sits in has usually said it already. */
|
|
32
|
+
readonly showLabel?: boolean
|
|
33
|
+
readonly size?: SpinnerSize
|
|
34
|
+
readonly className?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A wait, inline — beside a control, in a toolbar, in a row. For a panel with nothing else on it
|
|
39
|
+
* yet, `Loading` centres the same mark and says what is missing.
|
|
40
|
+
*/
|
|
41
|
+
export function Spinner({ label, showLabel = false, size = 'regular', className }: SpinnerProps) {
|
|
42
|
+
return (
|
|
43
|
+
<span
|
|
44
|
+
className={['desk-spinner', className].filter(Boolean).join(' ')}
|
|
45
|
+
role="status"
|
|
46
|
+
data-labelled={showLabel || undefined}
|
|
47
|
+
>
|
|
48
|
+
<Ring size={size} />
|
|
49
|
+
<span className="desk-spinner-label" data-hidden={showLabel ? undefined : true}>{label}</span>
|
|
50
|
+
</span>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** How long a wait may go unexplained. HIG.md §7: a spinner alone is for under about three seconds. */
|
|
55
|
+
const SLOW_AFTER_MS = 3000
|
|
56
|
+
|
|
57
|
+
export interface LoadingProps {
|
|
58
|
+
/** What is on its way, e.g. "Reading what your realms brought". Sentence case, no ellipsis. */
|
|
59
|
+
readonly label: string
|
|
60
|
+
/**
|
|
61
|
+
* Said once the wait passes about three seconds, where a spinner alone stops being enough. Say
|
|
62
|
+
* what is taking the time and whether it is expected — never an apology, and never a guess at
|
|
63
|
+
* how much longer.
|
|
64
|
+
*/
|
|
65
|
+
readonly slow?: ReactNode
|
|
66
|
+
/** How long before `slow` is said. Only move this for a wait that is known to be longer. */
|
|
67
|
+
readonly slowAfterMs?: number
|
|
68
|
+
readonly size?: SpinnerSize
|
|
69
|
+
readonly className?: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A panel that has nothing to show yet, saying so in the space the content will take. It replaces
|
|
74
|
+
* the content rather than sitting above it: a spinner over a stale list is a screen claiming two
|
|
75
|
+
* things at once.
|
|
76
|
+
*/
|
|
77
|
+
export function Loading({ label, slow, slowAfterMs = SLOW_AFTER_MS, size = 'large', className }: LoadingProps) {
|
|
78
|
+
const [slowed, setSlowed] = useState(false)
|
|
79
|
+
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (!slow) return
|
|
82
|
+
// Keyed on the note and the delay, so a panel that changes what it is waiting for waits again
|
|
83
|
+
// rather than inheriting the previous wait's expired timer and explaining itself instantly.
|
|
84
|
+
setSlowed(false)
|
|
85
|
+
const timer = setTimeout(() => setSlowed(true), slowAfterMs)
|
|
86
|
+
return () => clearTimeout(timer)
|
|
87
|
+
}, [slow, slowAfterMs])
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<div className={['desk-loading', className].filter(Boolean).join(' ')} role="status">
|
|
91
|
+
<Ring size={size} />
|
|
92
|
+
<p className="desk-loading-label">{label}</p>
|
|
93
|
+
{/* Announced when it arrives, not when the panel mounts: the wait became long enough to
|
|
94
|
+
explain, and that is the news. */}
|
|
95
|
+
{slowed && slow && <p className="desk-loading-slow">{slow}</p>}
|
|
96
|
+
</div>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
@@ -2,6 +2,7 @@ import { Component, createContext, lazy, Suspense, useContext } from 'react'
|
|
|
2
2
|
import type { ComponentType, ErrorInfo, LazyExoticComponent, ReactNode } from 'react'
|
|
3
3
|
import type { WindowId } from '../core/types.js'
|
|
4
4
|
import { Button } from './controls.js'
|
|
5
|
+
import { Loading } from './progress.js'
|
|
5
6
|
|
|
6
7
|
/*
|
|
7
8
|
* Each window loads, and fails, on its own. One window fetching its code shows a
|
|
@@ -16,11 +17,12 @@ export type WindowFailed = (id: WindowId, error: Error, reload: () => void) => R
|
|
|
16
17
|
/** How many times this window has been reloaded: a lazy window loads afresh for each. */
|
|
17
18
|
const AttemptContext = createContext(0)
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
/*
|
|
21
|
+
* A window fetching its code says so the way any wait does. It was a line of text, which reads as
|
|
22
|
+
* a window that has finished and has nothing in it — the one thing a window still arriving must
|
|
23
|
+
* not look like.
|
|
24
|
+
*/
|
|
25
|
+
const defaultLoading: WindowLoading = () => <Loading label="Loading" />
|
|
24
26
|
|
|
25
27
|
const defaultFailed: WindowFailed = (_id, error, reload) => (
|
|
26
28
|
<div className="desk-window-status" role="alert">
|