@bigpixelrocket/uiok 0.2.2 → 0.3.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +62 -1
  2. package/dist/button/TextLink.d.ts +27 -0
  3. package/dist/button/TextLink.js +15 -0
  4. package/dist/button/button.css +48 -0
  5. package/dist/button/index.d.ts +2 -1
  6. package/dist/button/index.js +2 -1
  7. package/dist/charts/Sparkline.d.ts +20 -0
  8. package/dist/charts/Sparkline.js +12 -0
  9. package/dist/charts/Sparkline.logic.d.ts +9 -0
  10. package/dist/charts/Sparkline.logic.js +27 -0
  11. package/dist/charts/charts.css +17 -0
  12. package/dist/charts/index.d.ts +2 -0
  13. package/dist/charts/index.js +2 -0
  14. package/dist/dialog/ConfirmDialog.d.ts +17 -1
  15. package/dist/dialog/ConfirmDialog.js +10 -4
  16. package/dist/dialog/DialogLists.d.ts +8 -1
  17. package/dist/dialog/DialogLists.js +3 -2
  18. package/dist/dialog/ModalDialog.d.ts +8 -0
  19. package/dist/dialog/ModalDialog.js +4 -2
  20. package/dist/dialog/ProgressDialog.d.ts +34 -0
  21. package/dist/dialog/ProgressDialog.js +40 -0
  22. package/dist/dialog/TypedNameDialog.d.ts +36 -0
  23. package/dist/dialog/TypedNameDialog.js +17 -0
  24. package/dist/dialog/index.d.ts +5 -2
  25. package/dist/dialog/index.js +4 -1
  26. package/dist/field/Switch.d.ts +26 -0
  27. package/dist/field/Switch.js +20 -0
  28. package/dist/field/field.css +110 -2
  29. package/dist/field/index.d.ts +3 -2
  30. package/dist/field/index.js +3 -2
  31. package/dist/filter/filter.css +16 -0
  32. package/dist/frame/AppRoot.d.ts +44 -0
  33. package/dist/frame/AppRoot.js +26 -0
  34. package/dist/frame/Dock.d.ts +88 -0
  35. package/dist/frame/Dock.js +129 -0
  36. package/dist/frame/FilterChips.d.ts +28 -0
  37. package/dist/frame/FilterChips.js +14 -0
  38. package/dist/frame/PageParts.d.ts +69 -0
  39. package/dist/frame/PageParts.js +60 -0
  40. package/dist/frame/PaneSplit.d.ts +74 -0
  41. package/dist/frame/PaneSplit.js +197 -0
  42. package/dist/frame/SidebarResizer.d.ts +35 -0
  43. package/dist/frame/SidebarResizer.js +43 -0
  44. package/dist/frame/StatusNotice.d.ts +20 -0
  45. package/dist/frame/StatusNotice.js +13 -0
  46. package/dist/frame/Tree.d.ts +140 -0
  47. package/dist/frame/Tree.js +141 -0
  48. package/dist/frame/TreeToggle.d.ts +18 -0
  49. package/dist/frame/TreeToggle.js +17 -0
  50. package/dist/frame/WindowFrame.d.ts +57 -0
  51. package/dist/frame/WindowFrame.js +19 -0
  52. package/dist/frame/frame.css +801 -0
  53. package/dist/frame/index.d.ts +22 -0
  54. package/dist/frame/index.js +22 -0
  55. package/dist/frame/sharedRef.d.ts +8 -0
  56. package/dist/frame/sharedRef.js +26 -0
  57. package/dist/grid/DataGrid.d.ts +10 -2
  58. package/dist/grid/DataGrid.js +47 -13
  59. package/dist/grid/DataGrid.logic.d.ts +16 -0
  60. package/dist/grid/DataGrid.logic.js +28 -0
  61. package/dist/grid/grid.css +128 -4
  62. package/dist/index.d.ts +4 -0
  63. package/dist/index.js +4 -0
  64. package/dist/labels/UiokLabels.d.ts +6 -0
  65. package/dist/labels/UiokLabels.js +5 -1
  66. package/dist/labels/dialog.d.ts +12 -0
  67. package/dist/labels/dialog.js +7 -1
  68. package/dist/labels/index.d.ts +2 -0
  69. package/dist/labels/index.js +2 -0
  70. package/dist/labels/keys.js +2 -0
  71. package/dist/labels/paneTabs.d.ts +27 -0
  72. package/dist/labels/paneTabs.js +10 -0
  73. package/dist/labels/selectAll.d.ts +4 -1
  74. package/dist/labels/selectAll.js +1 -1
  75. package/dist/labels/settings.d.ts +46 -0
  76. package/dist/labels/settings.js +29 -0
  77. package/dist/legend/KeyLegendStrip.d.ts +9 -1
  78. package/dist/legend/KeyLegendStrip.js +119 -5
  79. package/dist/legend/legend.css +52 -0
  80. package/dist/listing/EmptyState.d.ts +40 -0
  81. package/dist/listing/EmptyState.js +14 -0
  82. package/dist/listing/Listing.d.ts +23 -5
  83. package/dist/listing/Listing.js +11 -8
  84. package/dist/listing/index.d.ts +3 -1
  85. package/dist/listing/index.js +3 -1
  86. package/dist/listing/listing.css +172 -5
  87. package/dist/log/LogWell.d.ts +34 -0
  88. package/dist/log/LogWell.js +39 -0
  89. package/dist/log/LogWell.logic.d.ts +16 -0
  90. package/dist/log/LogWell.logic.js +26 -0
  91. package/dist/log/index.d.ts +8 -0
  92. package/dist/log/index.js +8 -0
  93. package/dist/log/log.css +57 -0
  94. package/dist/pane/Pane.d.ts +49 -0
  95. package/dist/pane/Pane.js +17 -0
  96. package/dist/pane/PaneActions.d.ts +3 -1
  97. package/dist/pane/PaneActions.js +6 -5
  98. package/dist/pane/PaneKeys.d.ts +10 -3
  99. package/dist/pane/PaneKeys.js +26 -7
  100. package/dist/pane/PaneTabs.d.ts +92 -0
  101. package/dist/pane/PaneTabs.js +326 -0
  102. package/dist/pane/PaneTabs.logic.d.ts +97 -0
  103. package/dist/pane/PaneTabs.logic.js +158 -0
  104. package/dist/pane/index.d.ts +7 -1
  105. package/dist/pane/index.js +7 -1
  106. package/dist/pane/panetabs.css +408 -0
  107. package/dist/pane/usePaneKeys.js +9 -11
  108. package/dist/pane/useTabDrag.d.ts +49 -0
  109. package/dist/pane/useTabDrag.js +306 -0
  110. package/dist/segmented/SegmentedChoice.d.ts +8 -1
  111. package/dist/segmented/SegmentedChoice.js +7 -4
  112. package/dist/shell/AboutWindow.d.ts +21 -0
  113. package/dist/shell/AboutWindow.js +10 -0
  114. package/dist/shell/LanguageChoice.d.ts +27 -0
  115. package/dist/shell/LanguageChoice.js +17 -0
  116. package/dist/shell/LoadFailure.d.ts +22 -0
  117. package/dist/shell/LoadFailure.js +15 -0
  118. package/dist/shell/Lockup.d.ts +52 -0
  119. package/dist/shell/Lockup.js +30 -0
  120. package/dist/shell/SettingsDialog.d.ts +97 -0
  121. package/dist/shell/SettingsDialog.js +219 -0
  122. package/dist/shell/SettingsDialog.logic.d.ts +33 -0
  123. package/dist/shell/SettingsDialog.logic.js +42 -0
  124. package/dist/shell/SettingsFiles.d.ts +55 -0
  125. package/dist/shell/SettingsFiles.js +30 -0
  126. package/dist/shell/SettingsPageKeys.d.ts +42 -0
  127. package/dist/shell/SettingsPageKeys.js +70 -0
  128. package/dist/shell/SettingsSubsection.d.ts +34 -0
  129. package/dist/shell/SettingsSubsection.js +30 -0
  130. package/dist/shell/SignIn.d.ts +61 -0
  131. package/dist/shell/SignIn.js +36 -0
  132. package/dist/shell/ThemePicker.d.ts +74 -0
  133. package/dist/shell/ThemePicker.js +96 -0
  134. package/dist/shell/ThemePicker.logic.d.ts +13 -0
  135. package/dist/shell/ThemePicker.logic.js +26 -0
  136. package/dist/shell/TitleBar.d.ts +44 -0
  137. package/dist/shell/TitleBar.js +23 -0
  138. package/dist/shell/UpdatePill.d.ts +26 -0
  139. package/dist/shell/UpdatePill.js +17 -0
  140. package/dist/shell/Updates.d.ts +99 -0
  141. package/dist/shell/Updates.js +72 -0
  142. package/dist/shell/index.d.ts +27 -0
  143. package/dist/shell/index.js +27 -0
  144. package/dist/shell/shell.css +243 -4
  145. package/dist/styles.css +10 -0
  146. package/dist/surface/GroupSwatch.d.ts +22 -0
  147. package/dist/surface/GroupSwatch.js +15 -0
  148. package/dist/surface/Tag.d.ts +26 -0
  149. package/dist/surface/Tag.js +12 -0
  150. package/dist/surface/index.d.ts +7 -0
  151. package/dist/surface/index.js +7 -0
  152. package/dist/surface/surface.css +116 -1
  153. package/dist/themes/catalog.js +4 -0
  154. package/dist/themes/themes.generated.css +244 -0
  155. package/dist/themes/tokens.d.ts +17 -5
  156. package/dist/themes/tokens.js +75 -1
  157. package/dist/tokens.css +11 -0
  158. package/package.json +1 -1
@@ -0,0 +1,158 @@
1
+ /**
2
+ * The rules a pane's tab strip draws by, as pure functions: which tabs are
3
+ * picked to close or move together, which tabs a crowded strip folds away
4
+ * and how many in one step, how narrow a tab's label may get, and where a
5
+ * dragged tab lands. A host keeps its tab state with the pick helpers;
6
+ * `PaneTabs` uses the rest.
7
+ */
8
+ /** The picks that still stand: those made under the tab in front now, on tabs still in `order`. */
9
+ const livePicks = (order, frontId, picks) => picks === null || picks.front !== frontId
10
+ ? []
11
+ : picks.ids.filter((id) => id !== frontId && order.includes(id));
12
+ /**
13
+ * The tabs a strip's picks stand for, in strip order: the tab in front,
14
+ * always, and every pick that still stands.
15
+ */
16
+ export function pickedTabs(order, frontId, picks) {
17
+ const live = livePicks(order, frontId, picks);
18
+ return order.filter((id) => id === frontId || live.includes(id));
19
+ }
20
+ /**
21
+ * A Command press on the tab `id`: picks it, or drops it when it was
22
+ * picked. The tab in front is always among the picks and is never dropped,
23
+ * so a press on it changes nothing. Null once nothing beside the tab in
24
+ * front is picked.
25
+ */
26
+ export function togglePick(order, frontId, picks, id) {
27
+ const live = livePicks(order, frontId, picks);
28
+ const ids = id === frontId || !order.includes(id)
29
+ ? live
30
+ : live.includes(id)
31
+ ? live.filter((other) => other !== id)
32
+ : [...live, id];
33
+ return ids.length === 0 ? null : { front: frontId, ids };
34
+ }
35
+ /**
36
+ * A Shift press on the tab `id`: picks the run of tabs from the one in
37
+ * front to it, both ends included, in place of the picks before. Null for a
38
+ * press on the tab in front, or on a tab not in `order`.
39
+ */
40
+ export function pickRun(order, frontId, id) {
41
+ const from = order.indexOf(frontId);
42
+ const to = order.indexOf(id);
43
+ if (from < 0 || to < 0 || from === to) {
44
+ return null;
45
+ }
46
+ return {
47
+ front: frontId,
48
+ ids: order
49
+ .slice(Math.min(from, to), Math.max(from, to) + 1)
50
+ .filter((other) => other !== frontId)
51
+ };
52
+ }
53
+ /**
54
+ * The strip's order with the tabs `carried` drawn together around `held`,
55
+ * the tab under the pointer, as a drag of picked tabs lifts them: the ones
56
+ * before it close up just before it and the ones after it just after, in
57
+ * their order, and every other tab keeps its order.
58
+ */
59
+ export function gatherTabs(order, carried, held) {
60
+ const block = order.filter((id) => id === held || carried.includes(id));
61
+ const rest = order.filter((id) => id === held || !carried.includes(id));
62
+ const at = rest.indexOf(held);
63
+ return at < 0 ? order : [...rest.slice(0, at), ...block, ...rest.slice(at + 1)];
64
+ }
65
+ /** The characters of its name a tab keeps before it folds away instead of shrinking further. */
66
+ const NAME_FLOOR = 8;
67
+ /** The characters of its context a tab keeps before its name starts to shrink. */
68
+ const CONTEXT_FLOOR = 3;
69
+ /** How many characters a part cut to `floor` takes: all of a shorter one, else `floor` and its ellipsis. */
70
+ const kept = (text, floor) => {
71
+ const length = [...text].length;
72
+ return length <= floor ? length : floor + 1;
73
+ };
74
+ /**
75
+ * The fewest characters a tab's label keeps, its ellipses counted, split
76
+ * into the context (its slash not counted) and the name: eight characters
77
+ * of the name and three of the context, or all of a shorter one. The
78
+ * context shrinks to its floor before the name loses a character: the name
79
+ * is what the eye looks for, and the context only tells two tabs apart.
80
+ */
81
+ export function tabLabelFloor(label) {
82
+ return {
83
+ context: label.context === undefined ? 0 : kept(label.context, CONTEXT_FLOOR),
84
+ name: kept(label.name, NAME_FLOOR)
85
+ };
86
+ }
87
+ /**
88
+ * The order in which a crowded strip folds its tabs into the count:
89
+ * farthest from the tab in front first and, of two as far, the later one.
90
+ * The tab in front, pinned tabs, and the following tab never fold, so they
91
+ * are left out.
92
+ */
93
+ export function foldOrder(tabs, frontId) {
94
+ const frontAt = tabs.findIndex((tab) => tab.id === frontId);
95
+ return tabs
96
+ .map((tab, index) => ({ tab, index, distance: Math.abs(index - frontAt) }))
97
+ .filter(({ tab }) => tab.id !== frontId && tab.pinned !== true && tab.following !== true)
98
+ .sort((a, b) => b.distance - a.distance || b.index - a.index)
99
+ .map(({ tab }) => tab.id);
100
+ }
101
+ /**
102
+ * How many more tabs a crowded strip folds in one step. `deficit` is how far
103
+ * the tabs on show run past their room, `widths` the foldable tabs still on
104
+ * show in fold order, and `gap` the space between two tabs. Folding one tab
105
+ * per layout pass would take a pass per tab, and a strip can hold more tabs
106
+ * than React allows passes in a row. A deficit folds at least one tab, and
107
+ * one that no tab covers folds them all.
108
+ */
109
+ export function foldsNeeded(deficit, widths, gap) {
110
+ let freed = 0;
111
+ let count = 0;
112
+ for (const width of widths) {
113
+ if (freed >= deficit) {
114
+ break;
115
+ }
116
+ freed += width + gap;
117
+ count += 1;
118
+ }
119
+ return count;
120
+ }
121
+ /**
122
+ * The strip's order while a tab is dragged along it. `held` is the dragged
123
+ * tab where the pointer has it, `boxes` the other tabs on show where the
124
+ * layout has them, and `order` every tab, folded ones included. A neighbour
125
+ * steps aside once the tab coming toward it covers half of it; one the tab
126
+ * is moving away from stays put, so a tab resting on the line between two
127
+ * places cannot flicker between them. Folded tabs keep their places: a tab
128
+ * that crosses no neighbour returns `order` itself, and one that crosses
129
+ * lands beside the last neighbour it passed. `direction` is the sign of the
130
+ * pointer's last move.
131
+ */
132
+ export function draggedTabOrder(order, held, boxes, direction) {
133
+ const mine = order.indexOf(held.id);
134
+ const rest = order.filter((id) => id !== held.id);
135
+ const shown = rest.filter((id) => boxes.some((box) => box.id === id));
136
+ const right = held.left + held.width;
137
+ const passed = shown.filter((id) => {
138
+ const box = boxes.find((candidate) => candidate.id === id);
139
+ if (box === undefined) {
140
+ return false;
141
+ }
142
+ const centre = box.left + box.width / 2;
143
+ return order.indexOf(id) < mine
144
+ ? !(direction < 0 && held.left < centre)
145
+ : direction > 0 && right > centre;
146
+ }).length;
147
+ const stayed = shown.filter((id) => order.indexOf(id) < mine).length;
148
+ // Nothing crossed: the tab keeps its place among the folded tabs too.
149
+ if (passed === stayed) {
150
+ return order;
151
+ }
152
+ // Past a neighbour, the tab lands beside it: folded tabs on the far side
153
+ // of that neighbour stay where they were.
154
+ const at = passed > stayed
155
+ ? rest.indexOf(shown[passed - 1]) + 1
156
+ : rest.indexOf(shown[passed]);
157
+ return [...rest.slice(0, at), held.id, ...rest.slice(at)];
158
+ }
@@ -3,11 +3,17 @@
3
3
  * compact controls inside them, in listing rows, and in a toolbar that
4
4
  * fits its tools to one line (`useToolbarFit`), and the keyboard of a
5
5
  * sidebar beside a page (`usePaneKeys`) with the pure key mapping and DOM
6
- * readers it is built on. Styled by the listing look under `.listing-root`.
6
+ * readers it is built on, and the tab strip a pane hangs from (`PaneTabs`)
7
+ * with the pure rules it and its host keep tab state by; `PaneBox` and
8
+ * `PaneList` are the pane and its scrolling body. Styled by the listing
9
+ * look under `.listing-root`.
7
10
  */
11
+ export { PaneBox, PaneList, type PaneBoxProps, type PaneListProps, type RegionHandlers } from './Pane.js';
8
12
  export { InRowContext, QuietAction, RowIconAction, RowLinkLookContext, useInRow, type ControlVerb, type LinkLook, type QuietActionProps, type RowIconActionProps } from './PaneActions.js';
9
13
  export { PanePathBar, PaneStatus, PathFact, type PaneCrumb, type PanePathBarProps, type PaneStatusProps, type PathFactProps } from './PaneFrame.js';
10
14
  export { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow, tabStops, verbControl, type SidebarTabStops, type TabStop } from './PaneKeys.js';
11
15
  export { movedIndex, NO_MAIN_VERBS, paneKeyAction, sameVerbs, type MainVerbs, type PaneKeyAction, type PaneKeyOptions, type PaneKeyStroke, type PaneMove } from './PaneKeys.logic.js';
16
+ export { PaneTabs, type PaneTabItem, type PaneTabsProps } from './PaneTabs.js';
17
+ export { draggedTabOrder, foldOrder, foldsNeeded, gatherTabs, pickedTabs, pickRun, tabLabelFloor, togglePick, type FoldableTab, type TabBox, type TabPicks } from './PaneTabs.logic.js';
12
18
  export { useToolbarFit } from './useToolbarFit.js';
13
19
  export { usePaneKeys, type Pane, type PaneKeys, type PaneKeysOptions } from './usePaneKeys.js';
@@ -3,11 +3,17 @@
3
3
  * compact controls inside them, in listing rows, and in a toolbar that
4
4
  * fits its tools to one line (`useToolbarFit`), and the keyboard of a
5
5
  * sidebar beside a page (`usePaneKeys`) with the pure key mapping and DOM
6
- * readers it is built on. Styled by the listing look under `.listing-root`.
6
+ * readers it is built on, and the tab strip a pane hangs from (`PaneTabs`)
7
+ * with the pure rules it and its host keep tab state by; `PaneBox` and
8
+ * `PaneList` are the pane and its scrolling body. Styled by the listing
9
+ * look under `.listing-root`.
7
10
  */
11
+ export { PaneBox, PaneList } from './Pane.js';
8
12
  export { InRowContext, QuietAction, RowIconAction, RowLinkLookContext, useInRow } from './PaneActions.js';
9
13
  export { PanePathBar, PaneStatus, PathFact } from './PaneFrame.js';
10
14
  export { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow, tabStops, verbControl } from './PaneKeys.js';
11
15
  export { movedIndex, NO_MAIN_VERBS, paneKeyAction, sameVerbs } from './PaneKeys.logic.js';
16
+ export { PaneTabs } from './PaneTabs.js';
17
+ export { draggedTabOrder, foldOrder, foldsNeeded, gatherTabs, pickedTabs, pickRun, tabLabelFloor, togglePick } from './PaneTabs.logic.js';
12
18
  export { useToolbarFit } from './useToolbarFit.js';
13
19
  export { usePaneKeys } from './usePaneKeys.js';
@@ -0,0 +1,408 @@
1
+ /* ---- Pane tabs ---------------------------------------------------------------
2
+ The tabs a pane hangs from (PaneTabs): the tab row over the pane's frame,
3
+ the frame hanging from the tab in front, the tabs and their states (in
4
+ front, following, dirty, pinned, picked, in the hand, a danger tone), the
5
+ pin rule, New Tab, the strip's empty end, the folded tabs' count and its
6
+ menu; then a pane's tone. Scoped by :where(.listing-root) as the listing
7
+ look is, so an app adjusts a piece with one scoped selector. */
8
+
9
+ .listing-root {
10
+ /* The tab row's height: the path bar's, so a strip and a bar share a line. */
11
+ --pane-tab-height: var(--bar-height);
12
+ /* A tab behind the one in front. */
13
+ --pane-tab-back: var(--surface-recessed);
14
+ }
15
+
16
+ /* A pane with tabs is its tab row and the frame that hangs from the tab in
17
+ front. The row paints nothing, so the ground shows beside and behind the
18
+ tabs; the content sits inside the frame's hairline under the row. */
19
+ :where(.listing-root) .pane:has(> .pane-header) {
20
+ padding: 0 1px 1px;
21
+ }
22
+
23
+ :where(.listing-root) .pane:has(> .pane-header)::before {
24
+ /* Up under the tab's foot by the hairline, so the tab's surface interrupts
25
+ the frame's top edge and its sides run into the frame's. */
26
+ inset: calc(var(--pane-tab-height) - 1px) 0 0;
27
+ border-radius: 0 var(--radius-md) var(--radius-md);
28
+ }
29
+
30
+ /* The row the tabs stand in. It runs out over the frame's hairline so the
31
+ first tab's near edge meets the frame's, and stops short of the frame's
32
+ rounded far corner. */
33
+ :where(.listing-root) .pane-header {
34
+ display: flex;
35
+ align-items: flex-end;
36
+ gap: var(--space-1);
37
+ height: var(--pane-tab-height);
38
+ flex: 0 0 var(--pane-tab-height);
39
+ min-width: 0;
40
+ margin: 0 -1px;
41
+ padding-right: var(--space-6);
42
+ font: var(--font-size-small) / var(--line-height-compact) var(--font-mono);
43
+ }
44
+
45
+ /* The strip never wraps and never scrolls: its tabs shrink to their floors,
46
+ then fold into the count. */
47
+ :where(.listing-root) .pane-tabs {
48
+ flex: 0 1 auto;
49
+ display: flex;
50
+ align-items: flex-end;
51
+ gap: var(--space-1);
52
+ min-width: 0;
53
+ }
54
+
55
+ /* A tab wears its place's name. The one in front joins the pane's frame;
56
+ the others stand behind it on the ground, shorter and fainter. A tab takes
57
+ no focus: a press shows it, and the host's verbs are the keyboard's way
58
+ in. It shrinks no narrower than its label's floor (--pane-tab-floor, in
59
+ characters, which PaneTabs sets) past its insets, its border, and the
60
+ room it keeps for its close control. */
61
+ :where(.listing-root) .pane-tab {
62
+ position: relative;
63
+ flex: 0 1 auto;
64
+ display: inline-flex;
65
+ align-items: center;
66
+ gap: var(--space-2);
67
+ box-sizing: border-box;
68
+ min-width: calc(
69
+ var(--pane-tab-floor, 0ch) + var(--space-4) + var(--space-2) + var(--space-2) + var(--icon-lg) +
70
+ 2 * var(--line)
71
+ );
72
+ max-width: calc(
73
+ 32ch + var(--space-4) + var(--space-2) + var(--space-2) + var(--icon-lg) + 2 * var(--line)
74
+ );
75
+ /* Shorter than the tab in front, and clear of the frame's top hairline. */
76
+ height: calc(var(--pane-tab-height) - var(--space-2));
77
+ margin-bottom: 1px;
78
+ /* The close control sits in room every tab keeps for it. */
79
+ padding: 0 var(--space-2) 0 var(--space-4);
80
+ border: var(--line) solid var(--border);
81
+ border-bottom: none;
82
+ border-radius: var(--radius-md) var(--radius-md) 0 0;
83
+ background: var(--pane-tab-back);
84
+ color: var(--text-dim);
85
+ white-space: nowrap;
86
+ cursor: default;
87
+ }
88
+
89
+ /* A mark ahead of the name takes its own room on top of the floor. */
90
+ :where(.listing-root) .pane-tab:has(> .pane-tab-mark) {
91
+ min-width: calc(
92
+ var(--pane-tab-floor, 0ch) + var(--space-4) + var(--space-2) + var(--space-2) + var(--icon-lg) +
93
+ 2 * var(--line) + var(--icon-md) + var(--space-2)
94
+ );
95
+ }
96
+
97
+ /* A tab with no close control, pin, or mark of its own has nothing to keep room for. */
98
+ :where(.listing-root) .pane-tab:not(:has(> :is(.pane-tab-close, .pane-tab-pin, .pane-tab-dirty))) {
99
+ padding-right: var(--space-4);
100
+ }
101
+
102
+ :where(.listing-root) .pane-tab:hover {
103
+ border-color: var(--border-strong);
104
+ background: linear-gradient(var(--hover-wash), var(--hover-wash)) var(--surface);
105
+ color: var(--text);
106
+ }
107
+
108
+ /* A tab behind, held down: it sinks before it comes to the front. */
109
+ :where(.listing-root) .pane-tab:not(.active, .picked):active {
110
+ background: linear-gradient(var(--pressed-wash), var(--pressed-wash)) var(--surface);
111
+ box-shadow: var(--press-frost);
112
+ color: var(--text);
113
+ }
114
+
115
+ /* The tab in front: full height, open at the foot where its surface
116
+ interrupts the frame's top edge, and never the one that gives up its name
117
+ to a crowded strip. */
118
+ :where(.listing-root) .pane-tab.active {
119
+ flex-shrink: 0;
120
+ height: var(--pane-tab-height);
121
+ margin-bottom: 0;
122
+ border-color: var(--border-strong);
123
+ background: var(--surface);
124
+ box-shadow: none;
125
+ color: var(--text);
126
+ font-weight: var(--font-weight-strong);
127
+ }
128
+
129
+ /* The active pane wears the accent on its frame and on the tab in front;
130
+ in a window that is not in front both go to the strong hairline. */
131
+ :where(.listing-root) .pane.active .pane-tab.active {
132
+ border-color: var(--accent);
133
+ }
134
+
135
+ :where(:root[data-window-inactive] .listing-root) .pane.active .pane-tab.active,
136
+ :where(:root[data-window-inactive] .listing-root) .pane.active:has(> .pane-header)::before {
137
+ border-color: var(--border-strong);
138
+ }
139
+
140
+ /* A tab picked beside the one in front, to close or move with it, wears
141
+ the tint and edge a marked row does, so it never reads as the tab in
142
+ front, which keeps its outline. Hovered, it keeps the mark. */
143
+ :where(.listing-root) .pane-tab.picked,
144
+ :where(.listing-root) .pane-tab.picked:hover {
145
+ border-color: var(--marked-bar);
146
+ background: linear-gradient(var(--marked-bg), var(--marked-bg)) var(--surface);
147
+ color: var(--text);
148
+ }
149
+
150
+ /* A tab in the hand rides over its neighbours and over a menu's level. */
151
+ :where(.listing-root) .pane-tab.dragging {
152
+ z-index: var(--z-drag);
153
+ box-shadow: var(--shadow-popover);
154
+ }
155
+
156
+ /* What the tab is, ahead of its name: a group's swatch or a kind's glyph. */
157
+ :where(.listing-root) .pane-tab-mark {
158
+ flex: none;
159
+ display: inline-grid;
160
+ place-items: center;
161
+ width: var(--icon-md);
162
+ height: var(--icon-md);
163
+ }
164
+
165
+ :where(.listing-root) .pane-tab-label {
166
+ display: flex;
167
+ min-width: 0;
168
+ }
169
+
170
+ :where(.listing-root) .pane-tab-label > * {
171
+ overflow: hidden;
172
+ text-overflow: ellipsis;
173
+ }
174
+
175
+ /* The name gives way last: it is what the eye looks for. */
176
+ :where(.listing-root) .pane-tab-name {
177
+ flex: 0 1 auto;
178
+ min-width: 0;
179
+ }
180
+
181
+ /* What stands above the name, shown only to tell two tabs of one name
182
+ apart. It gives way to an ellipsis before the name loses a character. */
183
+ :where(.listing-root) .pane-tab-context {
184
+ flex: 0 1000000 auto;
185
+ color: var(--text-dim);
186
+ font-weight: var(--font-weight-regular);
187
+ }
188
+
189
+ :where(.listing-root) .pane-tab-slash {
190
+ flex: none;
191
+ }
192
+
193
+ /* A following tab shows the place opened last, and the next place opened
194
+ takes it over. Its name is italic, as editors set a preview tab's, until
195
+ something keeps it (docs/tokens.md, italic). */
196
+ :where(.listing-root) .pane-tab.following .pane-tab-name {
197
+ font-style: italic;
198
+ }
199
+
200
+ /* A tab's close control: at rest on the tab in front, under the pointer on
201
+ the others, so a tab never changes width. It joins the quiet control's
202
+ hover and press by class (`quiet-control`). */
203
+ :where(.listing-root) .pane-tab-close {
204
+ flex: none;
205
+ display: inline-grid;
206
+ place-items: center;
207
+ width: var(--icon-lg);
208
+ height: var(--icon-lg);
209
+ padding: 0;
210
+ border: none;
211
+ border-radius: var(--radius-sm);
212
+ cursor: default;
213
+ }
214
+
215
+ :where(.listing-root :is(.pane-tab-close, .pane-tab-new, .pane-tabs-folded)) {
216
+ background: transparent;
217
+ color: var(--text-dim);
218
+ }
219
+
220
+ :where(.listing-root) .pane-tab:not(.active, :hover) .pane-tab-close {
221
+ visibility: hidden;
222
+ }
223
+
224
+ /* A dirty tab holds changes not saved. The warning state mark stands where
225
+ the close control does and gives that place back to it under the
226
+ pointer, so the tab keeps its width. A pinned tab has no control to give
227
+ it to, so its mark stays. */
228
+ :where(.listing-root) .pane-tab-dirty {
229
+ flex: none;
230
+ display: inline-grid;
231
+ place-items: center;
232
+ width: var(--icon-lg);
233
+ height: var(--icon-lg);
234
+ }
235
+
236
+ :where(.listing-root) .pane-tab.dirty:not(:hover) .pane-tab-close,
237
+ :where(.listing-root) .pane-tab.dirty:has(> .pane-tab-close):hover .pane-tab-dirty {
238
+ display: none;
239
+ }
240
+
241
+ /* A pinned tab stands before the pin rule, keeps its width however crowded
242
+ the strip, and carries a pin where a tab's close control is. */
243
+ :where(.listing-root) .pane-tab.pinned {
244
+ flex: none;
245
+ }
246
+
247
+ :where(.listing-root) .pane-tab-pin {
248
+ flex: none;
249
+ display: inline-grid;
250
+ place-items: center;
251
+ width: var(--icon-lg);
252
+ height: var(--icon-lg);
253
+ color: var(--text-dim);
254
+ }
255
+
256
+ :where(.listing-root) .pane-tab.pinned.active .pane-tab-pin > svg {
257
+ color: var(--accent);
258
+ }
259
+
260
+ /* The hairline between the pinned tabs and the others. */
261
+ :where(.listing-root) .pane-pin-rule {
262
+ flex: none;
263
+ align-self: center;
264
+ width: var(--line);
265
+ height: var(--icon-md);
266
+ margin: 0 var(--space-1) var(--space-1);
267
+ background: var(--border-strong);
268
+ }
269
+
270
+ /* Centred on the row's height, so its hover wash stands clear of the
271
+ frame's line below it. */
272
+ :where(.listing-root) .pane-tab-new {
273
+ flex: none;
274
+ display: inline-grid;
275
+ place-items: center;
276
+ width: var(--control-height-xs);
277
+ height: var(--control-height-xs);
278
+ margin: 0 0 var(--space-1) var(--space-1);
279
+ padding: 0;
280
+ border: none;
281
+ border-radius: var(--radius-sm);
282
+ cursor: default;
283
+ }
284
+
285
+ :where(.listing-root) :is(.pane-tab-close, .pane-tab-new, .pane-tabs-folded):focus-visible {
286
+ outline: var(--focus-ring-width) solid var(--accent);
287
+ outline-offset: var(--focus-offset-inset);
288
+ }
289
+
290
+ /* The strip's empty end: a double-click there opens a new tab. */
291
+ :where(.listing-root) .pane-tabs-rest {
292
+ flex: 1 1 0;
293
+ align-self: stretch;
294
+ min-width: 0;
295
+ }
296
+
297
+ /* The folded tabs' count, after New Tab: the warning mark while a folded
298
+ tab is dirty, "+N" in tabular figures, and a chevron. Its hover, press,
299
+ and open looks are the quiet control's. */
300
+ :where(.listing-root) .pane-tabs-folded {
301
+ flex: none;
302
+ display: inline-flex;
303
+ align-items: center;
304
+ gap: var(--space-1);
305
+ box-sizing: border-box;
306
+ height: var(--control-height-xs);
307
+ margin: 0 0 var(--space-1);
308
+ padding: 0 var(--space-2);
309
+ border: none;
310
+ border-radius: var(--radius-sm);
311
+ font: inherit;
312
+ cursor: default;
313
+ }
314
+
315
+ :where(.listing-root) .pane-tabs-folded > .pane-tab-dirty {
316
+ width: auto;
317
+ }
318
+
319
+ :where(.listing-root) .pane-tabs-folded-count {
320
+ font-variant-numeric: tabular-nums;
321
+ }
322
+
323
+ /* What the host puts at the strip's end (an update pill), on the controls' line. */
324
+ :where(.listing-root) .pane-tabs-trailing {
325
+ flex: none;
326
+ display: inline-flex;
327
+ align-items: center;
328
+ align-self: center;
329
+ }
330
+
331
+ /* The folded tabs' menu: the menu look, placed under the count by
332
+ PaneTabs (fixed, so the pane's frame does not clip it), as wide as its
333
+ longest row. */
334
+ .folder-menu.pane-tabs-folded-menu {
335
+ position: fixed;
336
+ top: 0;
337
+ left: 0;
338
+ width: max-content;
339
+ min-width: 24ch;
340
+ max-width: 60ch;
341
+ }
342
+
343
+ .pane-tabs-folded-option {
344
+ grid-template-columns: var(--icon-column) minmax(0, 1fr) auto;
345
+ }
346
+
347
+ .pane-tabs-folded-mark {
348
+ display: inline-grid;
349
+ place-items: center start;
350
+ }
351
+
352
+ .pane-tabs-folded-label {
353
+ display: flex;
354
+ min-width: 0;
355
+ white-space: nowrap;
356
+ }
357
+
358
+ .pane-tabs-folded-label > * {
359
+ overflow: hidden;
360
+ text-overflow: ellipsis;
361
+ }
362
+
363
+ .pane-tabs-folded-label > .pane-tab-context {
364
+ flex: 0 1000000 auto;
365
+ color: var(--text-dim);
366
+ }
367
+
368
+ .pane-tabs-folded-label > .pane-tab-slash {
369
+ flex: none;
370
+ }
371
+
372
+ .folder-menu-option.cursor .pane-tabs-folded-label > .pane-tab-context {
373
+ color: var(--text-on-surface);
374
+ }
375
+
376
+ .pane-tabs-folded-marks {
377
+ display: inline-flex;
378
+ align-items: center;
379
+ gap: var(--space-3);
380
+ }
381
+
382
+ .pane-tabs-folded-marks:not(:empty) {
383
+ margin-left: var(--space-5);
384
+ }
385
+
386
+ /* ---- A pane's tone ----
387
+ `data-tone="danger"` on a .pane draws its frame, and its tabs' outlines,
388
+ in the danger colour, whether or not the pane holds the keys and whether
389
+ or not the window is in front: the tone says where the pane is, not who
390
+ has the keys. A danger tab keeps its edge when it is picked or hovered. */
391
+ :where(.listing-root) .pane[data-tone='danger']::before,
392
+ :where(.listing-root) .pane.active[data-tone='danger']::before,
393
+ :where(:root[data-window-inactive] .listing-root)
394
+ .pane.active[data-tone='danger']:has(> .pane-header)::before {
395
+ border-color: var(--danger);
396
+ }
397
+
398
+ :where(.listing-root) .pane-tab[data-tone='danger'],
399
+ :where(.listing-root) .pane-tab[data-tone='danger']:is(:hover, .picked),
400
+ :where(.listing-root) .pane.active .pane-tab.active[data-tone='danger'],
401
+ :where(.listing-root) .pane[data-tone='danger'] .pane-tab.active,
402
+ :where(.listing-root) .pane.active[data-tone='danger'] .pane-tab.active,
403
+ :where(:root[data-window-inactive] .listing-root) .pane.active[data-tone='danger'] .pane-tab.active,
404
+ :where(:root[data-window-inactive] .listing-root)
405
+ .pane.active
406
+ .pane-tab.active[data-tone='danger'] {
407
+ border-color: var(--danger);
408
+ }
@@ -2,12 +2,12 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, use
2
2
  import { isTextEditingTarget } from '../keyboard/Keyboard.logic.js';
3
3
  import { watchOverlays } from '../keyboard/OverlayWatch.js';
4
4
  import { createValueStore, unheard } from '../store/ValueStore.js';
5
- import { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow } from './PaneKeys.js';
5
+ import { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow, shownHome } from './PaneKeys.js';
6
6
  import { movedIndex, sameVerbs } from './PaneKeys.logic.js';
7
7
  /** The sidebar's cursor row: the one moved to while it is listed, else the open row, else the first. */
8
8
  const sidebarRow = (moved, keys, openKey) => (moved !== null && keys.includes(moved) ? moved : (openKey ?? keys[0] ?? null));
9
9
  /** The sidebar pane: the frame around its home, which holds its other controls (Refresh) too. */
10
- const sidebarPane = (root) => root.querySelector('[data-pane-home="sidebar"]')?.closest('.pane') ?? null;
10
+ const sidebarPane = (root) => shownHome(root, true)?.closest('.pane') ?? null;
11
11
  /**
12
12
  * The keyboard of a view with a sidebar beside a page: each pane has a
13
13
  * cursor row the arrows move and the pointer shares (`data-row-key` rows;
@@ -146,8 +146,8 @@ export function usePaneKeys(options) {
146
146
  if (pane === 'main')
147
147
  sidebarStore.set(null);
148
148
  const home = pane === 'sidebar'
149
- ? rootRef.current?.querySelector('[data-pane-home="sidebar"]')
150
- : (mainRef.current?.querySelector('[data-pane-home]') ?? mainRef.current);
149
+ ? shownHome(rootRef.current, true)
150
+ : (shownHome(mainRef.current) ?? mainRef.current);
151
151
  home?.focus({ preventScroll: true });
152
152
  };
153
153
  // Coming into view, the app focuses the view; the active pane's home
@@ -178,7 +178,7 @@ export function usePaneKeys(options) {
178
178
  if (key === undefined)
179
179
  return;
180
180
  sidebarStore.set(key);
181
- showRow(paneRow(root?.querySelector('[data-pane-home="sidebar"]') ?? null, key));
181
+ showRow(paneRow(shownHome(root ?? null, true), key));
182
182
  return;
183
183
  }
184
184
  const rows = paneRows(mainRef.current);
@@ -214,7 +214,7 @@ export function usePaneKeys(options) {
214
214
  if (action === null)
215
215
  return;
216
216
  const sidebar = sidebarPane(root);
217
- const home = main.querySelector('[data-pane-home]') ?? main;
217
+ const home = shownHome(main) ?? main;
218
218
  const inSidebar = node !== null && sidebar?.contains(node) === true;
219
219
  const inMain = node !== null && main.contains(node);
220
220
  const pane = inSidebar ? 'sidebar' : inMain ? 'main' : activePane;
@@ -232,7 +232,7 @@ export function usePaneKeys(options) {
232
232
  !inRow &&
233
233
  node.closest('button, input, select, textarea, summary, a, [tabindex]') === home);
234
234
  if (action.kind === 'switch-pane') {
235
- const sidebarHome = root.querySelector('[data-pane-home="sidebar"]');
235
+ const sidebarHome = shownHome(root, true);
236
236
  const walked = current.sidebarStops === true && sidebar !== null && sidebarHome !== null
237
237
  ? { pane: sidebar, home: sidebarHome }
238
238
  : null;
@@ -248,7 +248,7 @@ export function usePaneKeys(options) {
248
248
  ? 'page'
249
249
  : node;
250
250
  const back = 'back' in action && action.back === true;
251
- const to = nextTabStop(main, home, from, back, walked);
251
+ const to = nextTabStop(main, home, from, back, walked, sidebar === null);
252
252
  event.preventDefault();
253
253
  event.stopPropagation();
254
254
  if (to === 'sidebar' || to === 'page')
@@ -271,9 +271,7 @@ export function usePaneKeys(options) {
271
271
  if (pane !== activePane)
272
272
  setActivePane(pane);
273
273
  if (inRow && isMove) {
274
- (pane === 'sidebar'
275
- ? root.querySelector('[data-pane-home="sidebar"]')
276
- : home)?.focus({
274
+ (pane === 'sidebar' ? shownHome(root, true) : home)?.focus({
277
275
  preventScroll: true
278
276
  });
279
277
  }