@liberation-data/desk 0.28.0 → 0.30.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 +22 -1
- package/dist/css/controls.css +102 -0
- package/dist/desk.css +102 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +2 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/outline.d.ts +22 -0
- package/dist/react/outline.d.ts.map +1 -0
- package/dist/react/outline.js +68 -0
- package/dist/react/outline.js.map +1 -0
- package/dist/react/pageDots.d.ts +20 -0
- package/dist/react/pageDots.d.ts.map +1 -0
- package/dist/react/pageDots.js +20 -0
- package/dist/react/pageDots.js.map +1 -0
- package/llms.txt +19 -0
- package/package.json +1 -1
- package/src/css/controls.css +102 -0
- package/src/react/index.ts +4 -0
- package/src/react/outline.tsx +113 -0
- package/src/react/pageDots.tsx +60 -0
package/README.md
CHANGED
|
@@ -356,6 +356,22 @@ lamp on white looks switched off. A lamp stays bright on both grounds; on a ligh
|
|
|
356
356
|
(`--desk-led-rim`), because the glow that makes it look lit on a dark one (`--desk-led-glow`) has nothing to
|
|
357
357
|
glow against.
|
|
358
358
|
|
|
359
|
+
## Page dots
|
|
360
|
+
|
|
361
|
+
```tsx
|
|
362
|
+
import { PageDots } from '@liberation-data/desk/react'
|
|
363
|
+
|
|
364
|
+
<PageDots count={tips.length} value={index} label="Tip" />
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Where you are in a short run of pages: a row of dots, the current one drawn longer. It takes less room than
|
|
368
|
+
"3 of 9" and sits in a footer beside the button that moves on. It is a picture, not a control: nothing in
|
|
369
|
+
it is pressed, and the row reads aloud as "Tip 3 of 9", so the dots are never the only thing saying it.
|
|
370
|
+
|
|
371
|
+
It does not grow with the count. Past `max` (default 7) only a window of dots is drawn, around the current
|
|
372
|
+
one, and the dots at an edge with more beyond it shrink — a hundred pages take the room of seven and still
|
|
373
|
+
show which way there is further to go. Fewer than two pages draws nothing.
|
|
374
|
+
|
|
359
375
|
## Setup assistant
|
|
360
376
|
|
|
361
377
|

|
|
@@ -568,6 +584,7 @@ arriving.
|
|
|
568
584
|
sort={sort} onSortChange={setSort} empty={<p>No rides yet</p>} />
|
|
569
585
|
|
|
570
586
|
<Sidebar label="Bikes" sections={SECTIONS} value={bike} onChange={setBike} />
|
|
587
|
+
<Outline label="Manual" rows={HEADINGS} value={heading} onChange={setHeading} />
|
|
571
588
|
|
|
572
589
|
<PopUpButton label="Distance" options={UNITS} value={units} onChange={setUnits} />
|
|
573
590
|
<Checkbox checked={commutes} onChange={setCommutes} label="Count commutes towards wear" />
|
|
@@ -576,7 +593,11 @@ arriving.
|
|
|
576
593
|
|
|
577
594
|
A **table** renders what it is given — no paging, no fetching — and is one tab stop: arrow keys move the
|
|
578
595
|
selection, Enter or a double click opens a row, and a sortable heading says which way it is sorted. A
|
|
579
|
-
**sidebar** is navigation, so where you are is `aria-current` and stays put.
|
|
596
|
+
**sidebar** is navigation, so where you are is `aria-current` and stays put. An **outline** is a
|
|
597
|
+
hierarchy — a document's headings, a schema — given as a flat list in reading order with a `depth` on each
|
|
598
|
+
row. It is a tree to the keyboard: up and down through the rows, left out to the parent, right in to the first
|
|
599
|
+
child. Depth shows as weight, colour and a small indent, and stops changing at the fourth level, so a deep
|
|
600
|
+
hierarchy cannot indent itself out of the list. A row is one line, cut with an ellipsis and whole on hover. A **pop-up button** is what a
|
|
580
601
|
segmented control becomes when there are too many options to show at once; unlike a menu it takes focus, and
|
|
581
602
|
typing jumps to an option. A **checkbox** is for a setting that waits for Save (a Toggle applies at once),
|
|
582
603
|
and can stand for a mixed set. A **slider** reads its value in words for people who cannot see it.
|
package/dist/css/controls.css
CHANGED
|
@@ -930,6 +930,74 @@
|
|
|
930
930
|
|
|
931
931
|
/* ── Sidebar ── */
|
|
932
932
|
|
|
933
|
+
/*
|
|
934
|
+
* Outline. Depth is weight, colour and a small indent together, and all three stop at the fourth
|
|
935
|
+
* level, so a deep hierarchy cannot indent itself out of the list's width.
|
|
936
|
+
*/
|
|
937
|
+
.desk-outline {
|
|
938
|
+
display: flex;
|
|
939
|
+
flex-direction: column;
|
|
940
|
+
padding: var(--desk-space-2);
|
|
941
|
+
font-family: var(--desk-font);
|
|
942
|
+
overflow-y: auto;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
.desk-outline-row {
|
|
946
|
+
display: flex;
|
|
947
|
+
align-items: center;
|
|
948
|
+
flex: none;
|
|
949
|
+
width: 100%;
|
|
950
|
+
min-height: 28px;
|
|
951
|
+
padding: var(--desk-space-1) var(--desk-space-2);
|
|
952
|
+
padding-inline-start: calc(var(--desk-space-2) + var(--desk-outline-indent, 0px));
|
|
953
|
+
border: 0;
|
|
954
|
+
border-radius: 7px;
|
|
955
|
+
background: transparent;
|
|
956
|
+
color: var(--desk-ink);
|
|
957
|
+
font: inherit;
|
|
958
|
+
font-size: var(--desk-text-body);
|
|
959
|
+
text-align: start;
|
|
960
|
+
cursor: pointer;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
.desk-outline-row[data-depth="1"] { font-weight: 600; }
|
|
964
|
+
.desk-outline-row[data-depth="2"] { --desk-outline-indent: var(--desk-space-3); }
|
|
965
|
+
.desk-outline-row[data-depth="3"] { --desk-outline-indent: calc(var(--desk-space-3) * 2); color: var(--desk-muted); }
|
|
966
|
+
.desk-outline-row[data-depth="4"] { --desk-outline-indent: calc(var(--desk-space-3) * 3); color: var(--desk-muted); }
|
|
967
|
+
|
|
968
|
+
.desk-outline-row:hover:not(:disabled) {
|
|
969
|
+
background: color-mix(in srgb, var(--desk-ink) 7%, transparent);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
/* Named with the hover it has to outrank: the chosen row stays the chosen colour under the pointer. */
|
|
973
|
+
.desk-outline-row[data-current],
|
|
974
|
+
.desk-outline-row[data-current]:hover:not(:disabled) {
|
|
975
|
+
background: color-mix(in srgb, var(--desk-accent) 18%, transparent);
|
|
976
|
+
color: var(--desk-ink);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
.desk-outline-row:focus-visible {
|
|
980
|
+
outline: 2px solid var(--desk-accent);
|
|
981
|
+
outline-offset: -2px;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
.desk-outline-row:disabled {
|
|
985
|
+
opacity: .45;
|
|
986
|
+
cursor: not-allowed;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
.desk-outline-label {
|
|
990
|
+
flex: 1;
|
|
991
|
+
min-width: 0;
|
|
992
|
+
overflow: hidden;
|
|
993
|
+
text-overflow: ellipsis;
|
|
994
|
+
white-space: nowrap;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
@media (pointer: coarse) {
|
|
998
|
+
.desk-outline-row { min-height: 44px; }
|
|
999
|
+
}
|
|
1000
|
+
|
|
933
1001
|
.desk-sidebar {
|
|
934
1002
|
display: flex;
|
|
935
1003
|
flex-direction: column;
|
|
@@ -1242,6 +1310,40 @@
|
|
|
1242
1310
|
.desk-led { forced-color-adjust: none; }
|
|
1243
1311
|
}
|
|
1244
1312
|
|
|
1313
|
+
/* PAGE DOTS (`PageDots`): where you are in a run of pages. Ink, not the accent; the why is in pageDots.tsx. */
|
|
1314
|
+
.desk-page-dots {
|
|
1315
|
+
display: inline-flex;
|
|
1316
|
+
align-items: center;
|
|
1317
|
+
vertical-align: middle;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
.desk-page-dot {
|
|
1321
|
+
flex: none;
|
|
1322
|
+
display: block;
|
|
1323
|
+
width: 6px;
|
|
1324
|
+
height: 6px;
|
|
1325
|
+
margin: 0 3px;
|
|
1326
|
+
border-radius: 3px;
|
|
1327
|
+
background: color-mix(in srgb, var(--desk-ink) 28%, transparent);
|
|
1328
|
+
transition: width 0.2s var(--desk-ease), transform 0.2s var(--desk-ease);
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
.desk-page-dot[data-size="medium"] { transform: scale(0.75); }
|
|
1332
|
+
.desk-page-dot[data-size="small"] { transform: scale(0.5); }
|
|
1333
|
+
|
|
1334
|
+
.desk-page-dot[data-current] {
|
|
1335
|
+
width: 15px;
|
|
1336
|
+
background: var(--desk-ink);
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1340
|
+
.desk-page-dot { transition: none; }
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
@media (forced-colors: active) {
|
|
1344
|
+
.desk-page-dot[data-current] { background: Highlight; }
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1245
1347
|
@keyframes desk-spin { to { transform: rotate(360deg); } }
|
|
1246
1348
|
|
|
1247
1349
|
/* A FADE, NOT A FREEZE. §2 Motion asks for movement to go and fades to stay, and a ring that has
|
package/dist/desk.css
CHANGED
|
@@ -2216,6 +2216,74 @@
|
|
|
2216
2216
|
|
|
2217
2217
|
/* ── Sidebar ── */
|
|
2218
2218
|
|
|
2219
|
+
/*
|
|
2220
|
+
* Outline. Depth is weight, colour and a small indent together, and all three stop at the fourth
|
|
2221
|
+
* level, so a deep hierarchy cannot indent itself out of the list's width.
|
|
2222
|
+
*/
|
|
2223
|
+
.desk-outline {
|
|
2224
|
+
display: flex;
|
|
2225
|
+
flex-direction: column;
|
|
2226
|
+
padding: var(--desk-space-2);
|
|
2227
|
+
font-family: var(--desk-font);
|
|
2228
|
+
overflow-y: auto;
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
.desk-outline-row {
|
|
2232
|
+
display: flex;
|
|
2233
|
+
align-items: center;
|
|
2234
|
+
flex: none;
|
|
2235
|
+
width: 100%;
|
|
2236
|
+
min-height: 28px;
|
|
2237
|
+
padding: var(--desk-space-1) var(--desk-space-2);
|
|
2238
|
+
padding-inline-start: calc(var(--desk-space-2) + var(--desk-outline-indent, 0px));
|
|
2239
|
+
border: 0;
|
|
2240
|
+
border-radius: 7px;
|
|
2241
|
+
background: transparent;
|
|
2242
|
+
color: var(--desk-ink);
|
|
2243
|
+
font: inherit;
|
|
2244
|
+
font-size: var(--desk-text-body);
|
|
2245
|
+
text-align: start;
|
|
2246
|
+
cursor: pointer;
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2249
|
+
.desk-outline-row[data-depth="1"] { font-weight: 600; }
|
|
2250
|
+
.desk-outline-row[data-depth="2"] { --desk-outline-indent: var(--desk-space-3); }
|
|
2251
|
+
.desk-outline-row[data-depth="3"] { --desk-outline-indent: calc(var(--desk-space-3) * 2); color: var(--desk-muted); }
|
|
2252
|
+
.desk-outline-row[data-depth="4"] { --desk-outline-indent: calc(var(--desk-space-3) * 3); color: var(--desk-muted); }
|
|
2253
|
+
|
|
2254
|
+
.desk-outline-row:hover:not(:disabled) {
|
|
2255
|
+
background: color-mix(in srgb, var(--desk-ink) 7%, transparent);
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
/* Named with the hover it has to outrank: the chosen row stays the chosen colour under the pointer. */
|
|
2259
|
+
.desk-outline-row[data-current],
|
|
2260
|
+
.desk-outline-row[data-current]:hover:not(:disabled) {
|
|
2261
|
+
background: color-mix(in srgb, var(--desk-accent) 18%, transparent);
|
|
2262
|
+
color: var(--desk-ink);
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
.desk-outline-row:focus-visible {
|
|
2266
|
+
outline: 2px solid var(--desk-accent);
|
|
2267
|
+
outline-offset: -2px;
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
.desk-outline-row:disabled {
|
|
2271
|
+
opacity: .45;
|
|
2272
|
+
cursor: not-allowed;
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
.desk-outline-label {
|
|
2276
|
+
flex: 1;
|
|
2277
|
+
min-width: 0;
|
|
2278
|
+
overflow: hidden;
|
|
2279
|
+
text-overflow: ellipsis;
|
|
2280
|
+
white-space: nowrap;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
@media (pointer: coarse) {
|
|
2284
|
+
.desk-outline-row { min-height: 44px; }
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2219
2287
|
.desk-sidebar {
|
|
2220
2288
|
display: flex;
|
|
2221
2289
|
flex-direction: column;
|
|
@@ -2528,6 +2596,40 @@
|
|
|
2528
2596
|
.desk-led { forced-color-adjust: none; }
|
|
2529
2597
|
}
|
|
2530
2598
|
|
|
2599
|
+
/* PAGE DOTS (`PageDots`): where you are in a run of pages. Ink, not the accent; the why is in pageDots.tsx. */
|
|
2600
|
+
.desk-page-dots {
|
|
2601
|
+
display: inline-flex;
|
|
2602
|
+
align-items: center;
|
|
2603
|
+
vertical-align: middle;
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
.desk-page-dot {
|
|
2607
|
+
flex: none;
|
|
2608
|
+
display: block;
|
|
2609
|
+
width: 6px;
|
|
2610
|
+
height: 6px;
|
|
2611
|
+
margin: 0 3px;
|
|
2612
|
+
border-radius: 3px;
|
|
2613
|
+
background: color-mix(in srgb, var(--desk-ink) 28%, transparent);
|
|
2614
|
+
transition: width 0.2s var(--desk-ease), transform 0.2s var(--desk-ease);
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
.desk-page-dot[data-size="medium"] { transform: scale(0.75); }
|
|
2618
|
+
.desk-page-dot[data-size="small"] { transform: scale(0.5); }
|
|
2619
|
+
|
|
2620
|
+
.desk-page-dot[data-current] {
|
|
2621
|
+
width: 15px;
|
|
2622
|
+
background: var(--desk-ink);
|
|
2623
|
+
}
|
|
2624
|
+
|
|
2625
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2626
|
+
.desk-page-dot { transition: none; }
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
@media (forced-colors: active) {
|
|
2630
|
+
.desk-page-dot[data-current] { background: Highlight; }
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2531
2633
|
@keyframes desk-spin { to { transform: rotate(360deg); } }
|
|
2532
2634
|
|
|
2533
2635
|
/* A FADE, NOT A FREEZE. §2 Motion asks for movement to go and fades to stay, and a ring that has
|
package/dist/react/index.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export { useWindowInfo, useWindowNote } from './windowDescription.js';
|
|
|
25
25
|
export type { WindowDescription } from './windowDescription.js';
|
|
26
26
|
export type { LoadingProps, SpinnerProps, SpinnerSize } from './progress.js';
|
|
27
27
|
export { Led } from './led.js';
|
|
28
|
+
export { PageDots, pageWindow } from './pageDots.js';
|
|
29
|
+
export type { PageDot, PageDotsProps } from './pageDots.js';
|
|
28
30
|
export type { LedColor, LedProps } from './led.js';
|
|
29
31
|
export { Pane, PaneHeader, Section, Toolbar } from './pane.js';
|
|
30
32
|
export type { PaneHeaderProps, PaneProps, SectionProps, ToolbarProps } from './pane.js';
|
|
@@ -42,6 +44,8 @@ export { Tabs } from './tabs.js';
|
|
|
42
44
|
export type { Tab, TabsProps } from './tabs.js';
|
|
43
45
|
export { Table } from './table.js';
|
|
44
46
|
export type { Column, Sort, TableProps } from './table.js';
|
|
47
|
+
export { Outline, OUTLINE_MAX_DEPTH } from './outline.js';
|
|
48
|
+
export type { OutlineProps, OutlineRow } from './outline.js';
|
|
45
49
|
export { Sidebar } from './sidebar.js';
|
|
46
50
|
export type { SidebarItem, SidebarProps, SidebarSection } from './sidebar.js';
|
|
47
51
|
export { Wizard } from './wizard.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,UAAU,EACV,iBAA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AK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACjH,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;AACjD,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACrG,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC/E,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/react/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { Loading, Spinner } from './progress.js';
|
|
|
12
12
|
export { useWindowProgress } from './windowProgress.js';
|
|
13
13
|
export { useWindowInfo, useWindowNote } from './windowDescription.js';
|
|
14
14
|
export { Led } from './led.js';
|
|
15
|
+
export { PageDots, pageWindow } from './pageDots.js';
|
|
15
16
|
export { Pane, PaneHeader, Section, Toolbar } from './pane.js';
|
|
16
17
|
export { InfoTip } from './infoTip.js';
|
|
17
18
|
export { Checklist, useTasks } from './tasks.js';
|
|
@@ -20,6 +21,7 @@ export { PopUpButton } from './popup.js';
|
|
|
20
21
|
export { Chip, Disclosure } from './disclosure.js';
|
|
21
22
|
export { Tabs } from './tabs.js';
|
|
22
23
|
export { Table } from './table.js';
|
|
24
|
+
export { Outline, OUTLINE_MAX_DEPTH } from './outline.js';
|
|
23
25
|
export { Sidebar } from './sidebar.js';
|
|
24
26
|
export { Wizard } from './wizard.js';
|
|
25
27
|
export { TourBar } from './tour.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,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAExF,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,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAGrE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings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are const OUTLINE_MAX_DEPTH = 4;
|
|
3
|
+
export interface OutlineRow {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
/** 1 for the top level, 2 for a row inside one, and so on. */
|
|
7
|
+
readonly depth: number;
|
|
8
|
+
/** Listed, but with nothing to open: a heading with no words under it. */
|
|
9
|
+
readonly disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface OutlineProps {
|
|
12
|
+
/** In the order they are read, each saying how deep it sits. */
|
|
13
|
+
readonly rows: readonly OutlineRow[];
|
|
14
|
+
/** The chosen row, or null when none is. */
|
|
15
|
+
readonly value: string | null;
|
|
16
|
+
readonly onChange: (id: string) => void;
|
|
17
|
+
/** Names the outline for assistive technology: "Sections". */
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function Outline({ rows, value, onChange, label, className }: OutlineProps): import("react").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=outline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../src/react/outline.tsx"],"names":[],"mappings":"AAgBA,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,CAAA;IACpC,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AAID,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,YAAY,+BAuEhF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
/*
|
|
4
|
+
* An outline: a list that shows how deep each row sits. A document's headings, a schema, a folder.
|
|
5
|
+
*
|
|
6
|
+
* It is not a sidebar. A sidebar is a few places to go, in sections, all at one level; an outline
|
|
7
|
+
* can be hundreds of rows in a hierarchy, and is moved through the way a tree is. The rows arrive
|
|
8
|
+
* flat and in order, each saying its depth, because that is how a hierarchy is usually held and it
|
|
9
|
+
* leaves nothing to fold or unfold by accident.
|
|
10
|
+
*
|
|
11
|
+
* Depth is drawn with weight, colour and a small indent, and all three stop changing at
|
|
12
|
+
* [OUTLINE_MAX_DEPTH]: a hierarchy twelve levels deep cannot indent the list out of its own width.
|
|
13
|
+
* A row is one line; a title too long for it is cut, and is whole on hover.
|
|
14
|
+
*/
|
|
15
|
+
/** The deepest level drawn differently. Deeper rows look like this one. */
|
|
16
|
+
export const OUTLINE_MAX_DEPTH = 4;
|
|
17
|
+
const drawnDepth = (depth) => Math.min(Math.max(1, Math.floor(depth)), OUTLINE_MAX_DEPTH);
|
|
18
|
+
export function Outline({ rows, value, onChange, label, className }) {
|
|
19
|
+
const tree = useRef(null);
|
|
20
|
+
const enabled = rows.filter(row => !row.disabled);
|
|
21
|
+
// One tab stop: the chosen row, or the first that can be chosen when none is.
|
|
22
|
+
const tabStop = enabled.some(row => row.id === value) ? value : enabled[0]?.id ?? null;
|
|
23
|
+
// Chosen from outside — Next, a link — it may be out of sight; bring it in without jumping.
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (value === null)
|
|
26
|
+
return;
|
|
27
|
+
tree.current?.querySelector(`[data-row="${CSS.escape(value)}"]`)?.scrollIntoView?.({ block: 'nearest' });
|
|
28
|
+
}, [value]);
|
|
29
|
+
const choose = (row) => {
|
|
30
|
+
if (!row)
|
|
31
|
+
return;
|
|
32
|
+
onChange(row.id);
|
|
33
|
+
tree.current?.querySelector(`[data-row="${CSS.escape(row.id)}"]`)?.focus();
|
|
34
|
+
};
|
|
35
|
+
const onKeyDown = (event) => {
|
|
36
|
+
const at = rows.findIndex(row => row.id === document.activeElement?.dataset.row);
|
|
37
|
+
if (at < 0)
|
|
38
|
+
return;
|
|
39
|
+
const here = rows[at];
|
|
40
|
+
const usable = (row) => !row.disabled;
|
|
41
|
+
const target = (() => {
|
|
42
|
+
switch (event.key) {
|
|
43
|
+
case 'ArrowDown': return rows.slice(at + 1).find(usable);
|
|
44
|
+
case 'ArrowUp': return rows.slice(0, at).reverse().find(usable);
|
|
45
|
+
case 'Home': return enabled[0];
|
|
46
|
+
case 'End': return enabled.at(-1);
|
|
47
|
+
// Out to what this row sits inside, as a tree does.
|
|
48
|
+
case 'ArrowLeft': return rows.slice(0, at).reverse().find(row => row.depth < here.depth && usable(row));
|
|
49
|
+
// In to the first row inside this one, if it has any.
|
|
50
|
+
case 'ArrowRight': {
|
|
51
|
+
const inside = rows.slice(at + 1);
|
|
52
|
+
const end = inside.findIndex(row => row.depth <= here.depth);
|
|
53
|
+
return (end < 0 ? inside : inside.slice(0, end)).find(usable);
|
|
54
|
+
}
|
|
55
|
+
default: return undefined;
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
if (!['ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key))
|
|
59
|
+
return;
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
choose(target);
|
|
62
|
+
};
|
|
63
|
+
return (_jsx("div", { ref: tree, role: "tree", "aria-label": label, className: ['desk-outline', className].filter(Boolean).join(' '), onKeyDown: onKeyDown, children: rows.map(row => {
|
|
64
|
+
const current = row.id === value;
|
|
65
|
+
return (_jsx("button", { type: "button", role: "treeitem", "aria-level": Math.max(1, Math.floor(row.depth)), "aria-selected": current, "data-row": row.id, "data-depth": drawnDepth(row.depth), "data-current": current || undefined, className: "desk-outline-row", disabled: row.disabled, tabIndex: row.id === tabStop ? 0 : -1, title: row.label, onClick: () => onChange(row.id), children: _jsx("span", { className: "desk-outline-label", children: row.label }) }, row.id));
|
|
66
|
+
}) }));
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=outline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.js","sourceRoot":"","sources":["../../src/react/outline.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAGzC;;;;;;;;;;;GAWG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAsBlC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAA;AAEjG,MAAM,UAAU,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAgB;IAC/E,MAAM,IAAI,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACjD,8EAA8E;IAC9E,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KA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+
/** The current page, from 0. */
|
|
5
|
+
readonly value: number;
|
|
6
|
+
/** What a page is, in a word: "Tip", "Photo". Read aloud with the position. */
|
|
7
|
+
readonly label: string;
|
|
8
|
+
/** The most dots drawn at once. Default 7; an odd number keeps the current one in the middle. */
|
|
9
|
+
readonly max?: number;
|
|
10
|
+
readonly className?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PageDot {
|
|
13
|
+
readonly index: number;
|
|
14
|
+
/** Smaller toward an edge that has more pages beyond it. */
|
|
15
|
+
readonly size: 'full' | 'medium' | 'small';
|
|
16
|
+
}
|
|
17
|
+
/** The dots to draw for [count] pages at [value]: all of them, or a window of [max] around it. */
|
|
18
|
+
export declare function pageWindow(count: number, value: number, max?: number): PageDot[];
|
|
19
|
+
export declare function PageDots({ count, value, label, max, className }: PageDotsProps): import("react").JSX.Element | null;
|
|
20
|
+
//# sourceMappingURL=pageDots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageDots.d.ts","sourceRoot":"","sources":["../../src/react/pageDots.tsx"],"names":[],"mappings":"AAkBA,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,iGAAiG;IACjG,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;CAC3C;AAED,kGAAkG;AAClG,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,SAAI,GAAG,OAAO,EAAE,CAU3E;AAED,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAO,EAAE,SAAS,EAAE,EAAE,aAAa,sCAUlF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** The dots to draw for [count] pages at [value]: all of them, or a window of [max] around it. */
|
|
3
|
+
export function pageWindow(count, value, max = 7) {
|
|
4
|
+
const shown = Math.max(1, Math.min(max, count));
|
|
5
|
+
const at = Math.min(Math.max(value, 0), Math.max(count - 1, 0));
|
|
6
|
+
const start = Math.min(Math.max(at - Math.floor(shown / 2), 0), Math.max(count - shown, 0));
|
|
7
|
+
const before = start > 0;
|
|
8
|
+
const after = start + shown < count;
|
|
9
|
+
return Array.from({ length: shown }, (_, i) => {
|
|
10
|
+
const fromEdge = Math.min(before ? i : Infinity, after ? shown - 1 - i : Infinity);
|
|
11
|
+
return { index: start + i, size: fromEdge === 0 ? 'small' : fromEdge === 1 ? 'medium' : 'full' };
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function PageDots({ count, value, label, max = 7, className }) {
|
|
15
|
+
if (count < 2)
|
|
16
|
+
return null;
|
|
17
|
+
const at = Math.min(Math.max(value, 0), count - 1);
|
|
18
|
+
return (_jsx("span", { className: ['desk-page-dots', className].filter(Boolean).join(' '), role: "img", "aria-label": `${label} ${at + 1} of ${count}`, children: pageWindow(count, at, max).map(dot => (_jsx("span", { className: "desk-page-dot", "data-size": dot.size, "data-current": dot.index === at || undefined }, dot.index))) }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=pageDots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageDots.js","sourceRoot":"","sources":["../../src/react/pageDots.tsx"],"names":[],"mappings":";AAoCA,kGAAkG;AAClG,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,K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AAU,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,EAAE,SAAS,EAAiB;IACjF,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IAC1B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;IAClD,OAAO,CACL,eAAM,SAAS,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,KAAK,gBAAa,GAAG,KAAK,IAAI,EAAE,GAAG,CAAC,OAAO,KAAK,EAAE,YAC9H,UAAU,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CACrC,eAAsB,SAAS,EAAC,eAAe,eAAY,GAAG,CAAC,IAAI,kBAAgB,GAAG,CAAC,KAAK,KAAK,EAAE,IAAI,SAAS,IAArG,GAAG,CAAC,KAAK,CAAgG,CACrH,CAAC,GACG,CACR,CAAA;AACH,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -421,6 +421,17 @@ The colour is named for what it looks like; what it means is the app's to say, i
|
|
|
421
421
|
never the only thing carrying a state. Its colours are `--desk-led-*`, bright on both grounds, not the
|
|
422
422
|
`--desk-ok`/`--desk-warn`/`--desk-bad` text tokens, which are dark on a light ground and look switched off.
|
|
423
423
|
|
|
424
|
+
### Page dots
|
|
425
|
+
|
|
426
|
+
```tsx
|
|
427
|
+
<PageDots count value label={'Tip'} max?={7} className? /> // value from 0; read aloud as "Tip 3 of 9"
|
|
428
|
+
pageWindow(count, value, max?): { index, size: 'full'|'medium'|'small' }[] // the dots it draws
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
Position in a short run of pages. Past `max` it draws a window around the current dot and shrinks the dots
|
|
432
|
+
at an edge with more beyond it, so the row never grows. It is `role="img"` and takes no focus: a button
|
|
433
|
+
beside it moves between pages. Fewer than two pages draws nothing.
|
|
434
|
+
|
|
424
435
|
Both are one `role="status"`. `Loading` shows `slow` once the wait passes `slowAfterMs`, inside that same
|
|
425
436
|
region, so its arrival is the announcement; the timer restarts when `slow` or `slowAfterMs` changes. There
|
|
426
437
|
is no determinate bar: a bar needs a fraction the browser can see, and work with real steps is a
|
|
@@ -437,8 +448,16 @@ interface Sort { key: string; direction: 'ascending' | 'descending' }
|
|
|
437
448
|
|
|
438
449
|
<Sidebar sections={{ id, label?, items: { id, label, icon?, badge?, disabled? }[] }[]}
|
|
439
450
|
value onChange label footer? />
|
|
451
|
+
|
|
452
|
+
<Outline rows={{ id, label, depth, disabled? }[]} value={string | null} onChange label />
|
|
440
453
|
```
|
|
441
454
|
|
|
455
|
+
Outline: a hierarchy as a flat list in reading order, each row saying its `depth` (1 is the top). Use it
|
|
456
|
+
for a document's headings, a schema, a folder — not `Sidebar`, which is a few places at one level. One tab
|
|
457
|
+
stop; up and down move through the rows, left goes out to the parent and right in to the first child, Home
|
|
458
|
+
and End to the ends. Depth is drawn with weight, colour and indent, and stops changing at the fourth level
|
|
459
|
+
(`OUTLINE_MAX_DEPTH`). A `disabled` row is listed and cannot be chosen.
|
|
460
|
+
|
|
442
461
|
Table: one tab stop, arrow keys move the selection, Enter or double click activates, `aria-sort` on
|
|
443
462
|
sortable headings. It renders what it is given — no paging, no fetching.
|
|
444
463
|
|
package/package.json
CHANGED
package/src/css/controls.css
CHANGED
|
@@ -929,6 +929,74 @@
|
|
|
929
929
|
|
|
930
930
|
/* ── Sidebar ── */
|
|
931
931
|
|
|
932
|
+
/*
|
|
933
|
+
* Outline. Depth is weight, colour and a small indent together, and all three stop at the fourth
|
|
934
|
+
* level, so a deep hierarchy cannot indent itself out of the list's width.
|
|
935
|
+
*/
|
|
936
|
+
.desk-outline {
|
|
937
|
+
display: flex;
|
|
938
|
+
flex-direction: column;
|
|
939
|
+
padding: var(--desk-space-2);
|
|
940
|
+
font-family: var(--desk-font);
|
|
941
|
+
overflow-y: auto;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
.desk-outline-row {
|
|
945
|
+
display: flex;
|
|
946
|
+
align-items: center;
|
|
947
|
+
flex: none;
|
|
948
|
+
width: 100%;
|
|
949
|
+
min-height: 28px;
|
|
950
|
+
padding: var(--desk-space-1) var(--desk-space-2);
|
|
951
|
+
padding-inline-start: calc(var(--desk-space-2) + var(--desk-outline-indent, 0px));
|
|
952
|
+
border: 0;
|
|
953
|
+
border-radius: 7px;
|
|
954
|
+
background: transparent;
|
|
955
|
+
color: var(--desk-ink);
|
|
956
|
+
font: inherit;
|
|
957
|
+
font-size: var(--desk-text-body);
|
|
958
|
+
text-align: start;
|
|
959
|
+
cursor: pointer;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
.desk-outline-row[data-depth="1"] { font-weight: 600; }
|
|
963
|
+
.desk-outline-row[data-depth="2"] { --desk-outline-indent: var(--desk-space-3); }
|
|
964
|
+
.desk-outline-row[data-depth="3"] { --desk-outline-indent: calc(var(--desk-space-3) * 2); color: var(--desk-muted); }
|
|
965
|
+
.desk-outline-row[data-depth="4"] { --desk-outline-indent: calc(var(--desk-space-3) * 3); color: var(--desk-muted); }
|
|
966
|
+
|
|
967
|
+
.desk-outline-row:hover:not(:disabled) {
|
|
968
|
+
background: color-mix(in srgb, var(--desk-ink) 7%, transparent);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/* Named with the hover it has to outrank: the chosen row stays the chosen colour under the pointer. */
|
|
972
|
+
.desk-outline-row[data-current],
|
|
973
|
+
.desk-outline-row[data-current]:hover:not(:disabled) {
|
|
974
|
+
background: color-mix(in srgb, var(--desk-accent) 18%, transparent);
|
|
975
|
+
color: var(--desk-ink);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
.desk-outline-row:focus-visible {
|
|
979
|
+
outline: 2px solid var(--desk-accent);
|
|
980
|
+
outline-offset: -2px;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
.desk-outline-row:disabled {
|
|
984
|
+
opacity: .45;
|
|
985
|
+
cursor: not-allowed;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
.desk-outline-label {
|
|
989
|
+
flex: 1;
|
|
990
|
+
min-width: 0;
|
|
991
|
+
overflow: hidden;
|
|
992
|
+
text-overflow: ellipsis;
|
|
993
|
+
white-space: nowrap;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
@media (pointer: coarse) {
|
|
997
|
+
.desk-outline-row { min-height: 44px; }
|
|
998
|
+
}
|
|
999
|
+
|
|
932
1000
|
.desk-sidebar {
|
|
933
1001
|
display: flex;
|
|
934
1002
|
flex-direction: column;
|
|
@@ -1241,6 +1309,40 @@
|
|
|
1241
1309
|
.desk-led { forced-color-adjust: none; }
|
|
1242
1310
|
}
|
|
1243
1311
|
|
|
1312
|
+
/* PAGE DOTS (`PageDots`): where you are in a run of pages. Ink, not the accent; the why is in pageDots.tsx. */
|
|
1313
|
+
.desk-page-dots {
|
|
1314
|
+
display: inline-flex;
|
|
1315
|
+
align-items: center;
|
|
1316
|
+
vertical-align: middle;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
.desk-page-dot {
|
|
1320
|
+
flex: none;
|
|
1321
|
+
display: block;
|
|
1322
|
+
width: 6px;
|
|
1323
|
+
height: 6px;
|
|
1324
|
+
margin: 0 3px;
|
|
1325
|
+
border-radius: 3px;
|
|
1326
|
+
background: color-mix(in srgb, var(--desk-ink) 28%, transparent);
|
|
1327
|
+
transition: width 0.2s var(--desk-ease), transform 0.2s var(--desk-ease);
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
.desk-page-dot[data-size="medium"] { transform: scale(0.75); }
|
|
1331
|
+
.desk-page-dot[data-size="small"] { transform: scale(0.5); }
|
|
1332
|
+
|
|
1333
|
+
.desk-page-dot[data-current] {
|
|
1334
|
+
width: 15px;
|
|
1335
|
+
background: var(--desk-ink);
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1339
|
+
.desk-page-dot { transition: none; }
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
@media (forced-colors: active) {
|
|
1343
|
+
.desk-page-dot[data-current] { background: Highlight; }
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1244
1346
|
@keyframes desk-spin { to { transform: rotate(360deg); } }
|
|
1245
1347
|
|
|
1246
1348
|
/* A FADE, NOT A FREEZE. §2 Motion asks for movement to go and fades to stay, and a ring that has
|
package/src/react/index.ts
CHANGED
|
@@ -47,6 +47,8 @@ export { useWindowInfo, useWindowNote } from './windowDescription.js'
|
|
|
47
47
|
export type { WindowDescription } from './windowDescription.js'
|
|
48
48
|
export type { LoadingProps, SpinnerProps, SpinnerSize } from './progress.js'
|
|
49
49
|
export { Led } from './led.js'
|
|
50
|
+
export { PageDots, pageWindow } from './pageDots.js'
|
|
51
|
+
export type { PageDot, PageDotsProps } from './pageDots.js'
|
|
50
52
|
export type { LedColor, LedProps } from './led.js'
|
|
51
53
|
export { Pane, PaneHeader, Section, Toolbar } from './pane.js'
|
|
52
54
|
export type { PaneHeaderProps, PaneProps, SectionProps, ToolbarProps } from './pane.js'
|
|
@@ -64,6 +66,8 @@ export { Tabs } from './tabs.js'
|
|
|
64
66
|
export type { Tab, TabsProps } from './tabs.js'
|
|
65
67
|
export { Table } from './table.js'
|
|
66
68
|
export type { Column, Sort, TableProps } from './table.js'
|
|
69
|
+
export { Outline, OUTLINE_MAX_DEPTH } from './outline.js'
|
|
70
|
+
export type { OutlineProps, OutlineRow } from './outline.js'
|
|
67
71
|
export { Sidebar } from './sidebar.js'
|
|
68
72
|
export type { SidebarItem, SidebarProps, SidebarSection } from './sidebar.js'
|
|
69
73
|
export { Wizard } from './wizard.js'
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
|
2
|
+
import type { KeyboardEvent } from 'react'
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* An outline: a list that shows how deep each row sits. A document's headings, a schema, a folder.
|
|
6
|
+
*
|
|
7
|
+
* It is not a sidebar. A sidebar is a few places to go, in sections, all at one level; an outline
|
|
8
|
+
* can be hundreds of rows in a hierarchy, and is moved through the way a tree is. The rows arrive
|
|
9
|
+
* flat and in order, each saying its depth, because that is how a hierarchy is usually held and it
|
|
10
|
+
* leaves nothing to fold or unfold by accident.
|
|
11
|
+
*
|
|
12
|
+
* Depth is drawn with weight, colour and a small indent, and all three stop changing at
|
|
13
|
+
* [OUTLINE_MAX_DEPTH]: a hierarchy twelve levels deep cannot indent the list out of its own width.
|
|
14
|
+
* A row is one line; a title too long for it is cut, and is whole on hover.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** The deepest level drawn differently. Deeper rows look like this one. */
|
|
18
|
+
export const OUTLINE_MAX_DEPTH = 4
|
|
19
|
+
|
|
20
|
+
export interface OutlineRow {
|
|
21
|
+
readonly id: string
|
|
22
|
+
readonly label: string
|
|
23
|
+
/** 1 for the top level, 2 for a row inside one, and so on. */
|
|
24
|
+
readonly depth: number
|
|
25
|
+
/** Listed, but with nothing to open: a heading with no words under it. */
|
|
26
|
+
readonly disabled?: boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface OutlineProps {
|
|
30
|
+
/** In the order they are read, each saying how deep it sits. */
|
|
31
|
+
readonly rows: readonly OutlineRow[]
|
|
32
|
+
/** The chosen row, or null when none is. */
|
|
33
|
+
readonly value: string | null
|
|
34
|
+
readonly onChange: (id: string) => void
|
|
35
|
+
/** Names the outline for assistive technology: "Sections". */
|
|
36
|
+
readonly label: string
|
|
37
|
+
readonly className?: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const drawnDepth = (depth: number) => Math.min(Math.max(1, Math.floor(depth)), OUTLINE_MAX_DEPTH)
|
|
41
|
+
|
|
42
|
+
export function Outline({ rows, value, onChange, label, className }: OutlineProps) {
|
|
43
|
+
const tree = useRef<HTMLDivElement>(null)
|
|
44
|
+
const enabled = rows.filter(row => !row.disabled)
|
|
45
|
+
// One tab stop: the chosen row, or the first that can be chosen when none is.
|
|
46
|
+
const tabStop = enabled.some(row => row.id === value) ? value : enabled[0]?.id ?? null
|
|
47
|
+
|
|
48
|
+
// Chosen from outside — Next, a link — it may be out of sight; bring it in without jumping.
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (value === null) return
|
|
51
|
+
tree.current?.querySelector<HTMLElement>(`[data-row="${CSS.escape(value)}"]`)?.scrollIntoView?.({ block: 'nearest' })
|
|
52
|
+
}, [value])
|
|
53
|
+
|
|
54
|
+
const choose = (row: OutlineRow | undefined) => {
|
|
55
|
+
if (!row) return
|
|
56
|
+
onChange(row.id)
|
|
57
|
+
tree.current?.querySelector<HTMLButtonElement>(`[data-row="${CSS.escape(row.id)}"]`)?.focus()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {
|
|
61
|
+
const at = rows.findIndex(row => row.id === (document.activeElement as HTMLElement | null)?.dataset.row)
|
|
62
|
+
if (at < 0) return
|
|
63
|
+
const here = rows[at]!
|
|
64
|
+
const usable = (row: OutlineRow) => !row.disabled
|
|
65
|
+
const target: OutlineRow | undefined = (() => {
|
|
66
|
+
switch (event.key) {
|
|
67
|
+
case 'ArrowDown': return rows.slice(at + 1).find(usable)
|
|
68
|
+
case 'ArrowUp': return rows.slice(0, at).reverse().find(usable)
|
|
69
|
+
case 'Home': return enabled[0]
|
|
70
|
+
case 'End': return enabled.at(-1)
|
|
71
|
+
// Out to what this row sits inside, as a tree does.
|
|
72
|
+
case 'ArrowLeft': return rows.slice(0, at).reverse().find(row => row.depth < here.depth && usable(row))
|
|
73
|
+
// In to the first row inside this one, if it has any.
|
|
74
|
+
case 'ArrowRight': {
|
|
75
|
+
const inside = rows.slice(at + 1)
|
|
76
|
+
const end = inside.findIndex(row => row.depth <= here.depth)
|
|
77
|
+
return (end < 0 ? inside : inside.slice(0, end)).find(usable)
|
|
78
|
+
}
|
|
79
|
+
default: return undefined
|
|
80
|
+
}
|
|
81
|
+
})()
|
|
82
|
+
if (!['ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return
|
|
83
|
+
event.preventDefault()
|
|
84
|
+
choose(target)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div ref={tree} role="tree" aria-label={label} className={['desk-outline', className].filter(Boolean).join(' ')} onKeyDown={onKeyDown}>
|
|
89
|
+
{rows.map(row => {
|
|
90
|
+
const current = row.id === value
|
|
91
|
+
return (
|
|
92
|
+
<button
|
|
93
|
+
key={row.id}
|
|
94
|
+
type="button"
|
|
95
|
+
role="treeitem"
|
|
96
|
+
aria-level={Math.max(1, Math.floor(row.depth))}
|
|
97
|
+
aria-selected={current}
|
|
98
|
+
data-row={row.id}
|
|
99
|
+
data-depth={drawnDepth(row.depth)}
|
|
100
|
+
data-current={current || undefined}
|
|
101
|
+
className="desk-outline-row"
|
|
102
|
+
disabled={row.disabled}
|
|
103
|
+
tabIndex={row.id === tabStop ? 0 : -1}
|
|
104
|
+
title={row.label}
|
|
105
|
+
onClick={() => onChange(row.id)}
|
|
106
|
+
>
|
|
107
|
+
<span className="desk-outline-label">{row.label}</span>
|
|
108
|
+
</button>
|
|
109
|
+
)
|
|
110
|
+
})}
|
|
111
|
+
</div>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WHERE YOU ARE IN A SHORT RUN OF PAGES.
|
|
3
|
+
*
|
|
4
|
+
* A row of dots, the current one drawn longer: tips, a gallery, the screens of a walkthrough. It
|
|
5
|
+
* says position at a glance and takes less room than "3 of 9", which is why it sits in a footer
|
|
6
|
+
* beside the button that moves on.
|
|
7
|
+
*
|
|
8
|
+
* IT DOES NOT GROW WITH THE COUNT. Nine dots are nine dots; a hundred would be a ruler. Past
|
|
9
|
+
* `max` only a window of them is drawn, around the current one, and the dots at an edge with more
|
|
10
|
+
* beyond it shrink — so the row keeps its width and still shows which way there is further to go.
|
|
11
|
+
*
|
|
12
|
+
* THE DOTS ARE NEVER THE ONLY THING THAT SAYS IT. The row reads aloud as "<label> 12 of 100", the
|
|
13
|
+
* exact position a row of seven dots cannot show.
|
|
14
|
+
*
|
|
15
|
+
* A PICTURE, NOT A CONTROL. A dot is six pixels and a page is pressed for with a button; dots that
|
|
16
|
+
* could be pressed would each need a 44 px target, and then they are no longer a row of dots.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export interface PageDotsProps {
|
|
20
|
+
/** How many pages there are. Nothing is drawn for fewer than two. */
|
|
21
|
+
readonly count: number
|
|
22
|
+
/** The current page, from 0. */
|
|
23
|
+
readonly value: number
|
|
24
|
+
/** What a page is, in a word: "Tip", "Photo". Read aloud with the position. */
|
|
25
|
+
readonly label: string
|
|
26
|
+
/** The most dots drawn at once. Default 7; an odd number keeps the current one in the middle. */
|
|
27
|
+
readonly max?: number
|
|
28
|
+
readonly className?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface PageDot {
|
|
32
|
+
readonly index: number
|
|
33
|
+
/** Smaller toward an edge that has more pages beyond it. */
|
|
34
|
+
readonly size: 'full' | 'medium' | 'small'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The dots to draw for [count] pages at [value]: all of them, or a window of [max] around it. */
|
|
38
|
+
export function pageWindow(count: number, value: number, max = 7): PageDot[] {
|
|
39
|
+
const shown = Math.max(1, Math.min(max, count))
|
|
40
|
+
const at = Math.min(Math.max(value, 0), Math.max(count - 1, 0))
|
|
41
|
+
const start = Math.min(Math.max(at - Math.floor(shown / 2), 0), Math.max(count - shown, 0))
|
|
42
|
+
const before = start > 0
|
|
43
|
+
const after = start + shown < count
|
|
44
|
+
return Array.from({ length: shown }, (_, i): PageDot => {
|
|
45
|
+
const fromEdge = Math.min(before ? i : Infinity, after ? shown - 1 - i : Infinity)
|
|
46
|
+
return { index: start + i, size: fromEdge === 0 ? 'small' : fromEdge === 1 ? 'medium' : 'full' }
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function PageDots({ count, value, label, max = 7, className }: PageDotsProps) {
|
|
51
|
+
if (count < 2) return null
|
|
52
|
+
const at = Math.min(Math.max(value, 0), count - 1)
|
|
53
|
+
return (
|
|
54
|
+
<span className={['desk-page-dots', className].filter(Boolean).join(' ')} role="img" aria-label={`${label} ${at + 1} of ${count}`}>
|
|
55
|
+
{pageWindow(count, at, max).map(dot => (
|
|
56
|
+
<span key={dot.index} className="desk-page-dot" data-size={dot.size} data-current={dot.index === at || undefined} />
|
|
57
|
+
))}
|
|
58
|
+
</span>
|
|
59
|
+
)
|
|
60
|
+
}
|