@bigpixelrocket/uiok 0.0.0-stage → 0.1.1
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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/NOTICE +569 -0
- package/README.md +44 -2
- package/dist/VisuallyHidden.d.ts +13 -0
- package/dist/VisuallyHidden.js +13 -0
- package/dist/activity/ActivityBar.d.ts +29 -0
- package/dist/activity/ActivityBar.js +21 -0
- package/dist/activity/activity.css +43 -0
- package/dist/activity/index.d.ts +2 -0
- package/dist/activity/index.js +2 -0
- package/dist/button/Button.d.ts +26 -0
- package/dist/button/Button.js +14 -0
- package/dist/button/IconButton.d.ts +18 -0
- package/dist/button/IconButton.js +14 -0
- package/dist/button/button.css +95 -0
- package/dist/button/index.d.ts +3 -0
- package/dist/button/index.js +3 -0
- package/dist/charts/Drawing.d.ts +27 -0
- package/dist/charts/Drawing.js +117 -0
- package/dist/charts/Drawing.logic.d.ts +2 -0
- package/dist/charts/Drawing.logic.js +22 -0
- package/dist/charts/Line.logic.d.ts +33 -0
- package/dist/charts/Line.logic.js +72 -0
- package/dist/charts/LineChart.d.ts +34 -0
- package/dist/charts/LineChart.js +100 -0
- package/dist/charts/Pie.logic.d.ts +16 -0
- package/dist/charts/Pie.logic.js +28 -0
- package/dist/charts/PieChart.d.ts +20 -0
- package/dist/charts/PieChart.js +16 -0
- package/dist/charts/ResultChart.d.ts +47 -0
- package/dist/charts/ResultChart.js +175 -0
- package/dist/charts/ResultChart.logic.d.ts +42 -0
- package/dist/charts/ResultChart.logic.js +165 -0
- package/dist/charts/Scatter.logic.d.ts +55 -0
- package/dist/charts/Scatter.logic.js +134 -0
- package/dist/charts/ScatterChart.d.ts +36 -0
- package/dist/charts/ScatterChart.js +99 -0
- package/dist/charts/charts.css +310 -0
- package/dist/charts/index.d.ts +14 -0
- package/dist/charts/index.js +11 -0
- package/dist/charts/seriesColour.d.ts +2 -0
- package/dist/charts/seriesColour.js +8 -0
- package/dist/clock/index.d.ts +2 -0
- package/dist/clock/index.js +2 -0
- package/dist/clock/useClock.d.ts +14 -0
- package/dist/clock/useClock.js +57 -0
- package/dist/datetime/DateTimePicker.d.ts +50 -0
- package/dist/datetime/DateTimePicker.js +98 -0
- package/dist/datetime/DateTimePicker.logic.d.ts +59 -0
- package/dist/datetime/DateTimePicker.logic.js +103 -0
- package/dist/datetime/datetime.css +115 -0
- package/dist/datetime/index.d.ts +7 -0
- package/dist/datetime/index.js +7 -0
- package/dist/dialog/ConfirmDialog.d.ts +73 -0
- package/dist/dialog/ConfirmDialog.js +30 -0
- package/dist/dialog/DialogLegend.d.ts +21 -0
- package/dist/dialog/DialogLegend.js +28 -0
- package/dist/dialog/DialogLegend.logic.d.ts +145 -0
- package/dist/dialog/DialogLegend.logic.js +71 -0
- package/dist/dialog/ModalDialog.d.ts +101 -0
- package/dist/dialog/ModalDialog.js +184 -0
- package/dist/dialog/dialog.css +283 -0
- package/dist/dialog/index.d.ts +8 -0
- package/dist/dialog/index.js +8 -0
- package/dist/filter/FilterEscape.d.ts +16 -0
- package/dist/filter/FilterEscape.js +15 -0
- package/dist/filter/FilterIcon.d.ts +8 -0
- package/dist/filter/FilterIcon.js +11 -0
- package/dist/filter/filter.css +42 -0
- package/dist/filter/index.d.ts +3 -0
- package/dist/filter/index.js +3 -0
- package/dist/grid/DataGrid.d.ts +149 -0
- package/dist/grid/DataGrid.js +373 -0
- package/dist/grid/DataGrid.logic.d.ts +57 -0
- package/dist/grid/DataGrid.logic.js +121 -0
- package/dist/grid/grid.css +206 -0
- package/dist/grid/index.d.ts +7 -0
- package/dist/grid/index.js +7 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +32 -0
- package/dist/keyboard/BrowserKeys.d.ts +15 -0
- package/dist/keyboard/BrowserKeys.js +28 -0
- package/dist/keyboard/KeyChord.logic.d.ts +25 -0
- package/dist/keyboard/KeyChord.logic.js +50 -0
- package/dist/keyboard/Keyboard.logic.d.ts +84 -0
- package/dist/keyboard/Keyboard.logic.js +137 -0
- package/dist/keyboard/OverlayWatch.d.ts +28 -0
- package/dist/keyboard/OverlayWatch.js +119 -0
- package/dist/keyboard/PageSelectAll.d.ts +14 -0
- package/dist/keyboard/PageSelectAll.js +22 -0
- package/dist/keyboard/index.d.ts +9 -0
- package/dist/keyboard/index.js +9 -0
- package/dist/keychord/KeyChord.d.ts +16 -0
- package/dist/keychord/KeyChord.js +55 -0
- package/dist/keychord/index.d.ts +2 -0
- package/dist/keychord/index.js +2 -0
- package/dist/keychord/keychord.css +41 -0
- package/dist/labels/UiokLabels.d.ts +41 -0
- package/dist/labels/UiokLabels.js +31 -0
- package/dist/labels/UiokProvider.d.ts +44 -0
- package/dist/labels/UiokProvider.js +54 -0
- package/dist/labels/charts.d.ts +34 -0
- package/dist/labels/charts.js +15 -0
- package/dist/labels/dateTime.d.ts +32 -0
- package/dist/labels/dateTime.js +14 -0
- package/dist/labels/dialog.d.ts +18 -0
- package/dist/labels/dialog.js +6 -0
- package/dist/labels/index.d.ts +13 -0
- package/dist/labels/index.js +13 -0
- package/dist/labels/keys.d.ts +28 -0
- package/dist/labels/keys.js +53 -0
- package/dist/labels/legend.d.ts +21 -0
- package/dist/labels/legend.js +7 -0
- package/dist/labels/listing.d.ts +16 -0
- package/dist/labels/listing.js +8 -0
- package/dist/labels/pager.d.ts +32 -0
- package/dist/labels/pager.js +20 -0
- package/dist/labels/palette.d.ts +17 -0
- package/dist/labels/palette.js +6 -0
- package/dist/labels/selectAll.d.ts +15 -0
- package/dist/labels/selectAll.js +6 -0
- package/dist/labels/terminal.d.ts +25 -0
- package/dist/labels/terminal.js +9 -0
- package/dist/legend/KeyLegend.logic.d.ts +84 -0
- package/dist/legend/KeyLegend.logic.js +109 -0
- package/dist/legend/KeyLegendStrip.d.ts +36 -0
- package/dist/legend/KeyLegendStrip.js +82 -0
- package/dist/legend/index.d.ts +3 -0
- package/dist/legend/index.js +3 -0
- package/dist/legend/legend.css +148 -0
- package/dist/listing/CurrentDot.d.ts +15 -0
- package/dist/listing/CurrentDot.js +13 -0
- package/dist/listing/Listing.d.ts +230 -0
- package/dist/listing/Listing.js +265 -0
- package/dist/listing/PathParts.logic.d.ts +17 -0
- package/dist/listing/PathParts.logic.js +18 -0
- package/dist/listing/index.d.ts +10 -0
- package/dist/listing/index.js +10 -0
- package/dist/listing/listing.css +867 -0
- package/dist/menu/MenuQuery.logic.d.ts +69 -0
- package/dist/menu/MenuQuery.logic.js +75 -0
- package/dist/menu/fuzzyMatch.d.ts +31 -0
- package/dist/menu/fuzzyMatch.js +296 -0
- package/dist/menu/index.d.ts +9 -0
- package/dist/menu/index.js +9 -0
- package/dist/menu/menu.css +203 -0
- package/dist/menu/useBellBeat.d.ts +8 -0
- package/dist/menu/useBellBeat.js +26 -0
- package/dist/namecut/NameCut.d.ts +22 -0
- package/dist/namecut/NameCut.js +28 -0
- package/dist/namecut/NameCut.logic.d.ts +51 -0
- package/dist/namecut/NameCut.logic.js +120 -0
- package/dist/namecut/index.d.ts +3 -0
- package/dist/namecut/index.js +3 -0
- package/dist/namecut/namecut.css +67 -0
- package/dist/pager/Pager.d.ts +37 -0
- package/dist/pager/Pager.js +38 -0
- package/dist/pager/Pager.logic.d.ts +13 -0
- package/dist/pager/Pager.logic.js +63 -0
- package/dist/pager/index.d.ts +7 -0
- package/dist/pager/index.js +7 -0
- package/dist/pager/pager.css +62 -0
- package/dist/palette/Palette.d.ts +79 -0
- package/dist/palette/Palette.js +60 -0
- package/dist/palette/index.d.ts +6 -0
- package/dist/palette/index.js +6 -0
- package/dist/palette/palette.css +159 -0
- package/dist/pane/PaneActions.d.ts +104 -0
- package/dist/pane/PaneActions.js +62 -0
- package/dist/pane/PaneFrame.d.ts +51 -0
- package/dist/pane/PaneFrame.js +28 -0
- package/dist/pane/PaneKeys.d.ts +41 -0
- package/dist/pane/PaneKeys.js +104 -0
- package/dist/pane/PaneKeys.logic.d.ts +95 -0
- package/dist/pane/PaneKeys.logic.js +109 -0
- package/dist/pane/index.d.ts +11 -0
- package/dist/pane/index.js +11 -0
- package/dist/pane/usePaneKeys.d.ts +141 -0
- package/dist/pane/usePaneKeys.js +313 -0
- package/dist/run/RunHeader.d.ts +50 -0
- package/dist/run/RunHeader.js +31 -0
- package/dist/run/RunProgress.logic.d.ts +29 -0
- package/dist/run/RunProgress.logic.js +34 -0
- package/dist/run/index.d.ts +3 -0
- package/dist/run/index.js +3 -0
- package/dist/run/run.css +190 -0
- package/dist/segmented/SegmentedChoice.d.ts +22 -0
- package/dist/segmented/SegmentedChoice.js +31 -0
- package/dist/segmented/index.d.ts +2 -0
- package/dist/segmented/index.js +2 -0
- package/dist/segmented/segmented.css +49 -0
- package/dist/selectall/CheckRange.logic.d.ts +8 -0
- package/dist/selectall/CheckRange.logic.js +23 -0
- package/dist/selectall/SelectAllBar.d.ts +25 -0
- package/dist/selectall/SelectAllBar.js +24 -0
- package/dist/selectall/index.d.ts +7 -0
- package/dist/selectall/index.js +7 -0
- package/dist/selectall/selectall.css +31 -0
- package/dist/store/KeepUnchanged.logic.d.ts +19 -0
- package/dist/store/KeepUnchanged.logic.js +33 -0
- package/dist/store/SameProps.d.ts +15 -0
- package/dist/store/SameProps.js +46 -0
- package/dist/store/ValueStore.d.ts +17 -0
- package/dist/store/ValueStore.js +23 -0
- package/dist/store/index.d.ts +8 -0
- package/dist/store/index.js +8 -0
- package/dist/store/useStableHandlers.d.ts +13 -0
- package/dist/store/useStableHandlers.js +22 -0
- package/dist/styles.css +85 -0
- package/dist/tabs/PageTabs.d.ts +38 -0
- package/dist/tabs/PageTabs.js +33 -0
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/tabs.css +64 -0
- package/dist/terminal/Terminal.d.ts +104 -0
- package/dist/terminal/Terminal.js +309 -0
- package/dist/terminal/Terminal.logic.d.ts +66 -0
- package/dist/terminal/Terminal.logic.js +156 -0
- package/dist/terminal/TerminalMenu.d.ts +36 -0
- package/dist/terminal/TerminalMenu.js +87 -0
- package/dist/terminal/TerminalMenu.logic.d.ts +78 -0
- package/dist/terminal/TerminalMenu.logic.js +68 -0
- package/dist/terminal/TerminalScrollback.d.ts +10 -0
- package/dist/terminal/TerminalScrollback.js +11 -0
- package/dist/terminal/ghostty/LICENSE +21 -0
- package/dist/terminal/ghostty/core.d.ts +315 -0
- package/dist/terminal/ghostty/core.js +1189 -0
- package/dist/terminal/ghostty/fallbackColors.d.ts +12 -0
- package/dist/terminal/ghostty/fallbackColors.js +23 -0
- package/dist/terminal/ghostty/fonts/LICENSE +21 -0
- package/dist/terminal/ghostty/fonts/SymbolsNerdFontMono-Regular.woff2 +0 -0
- package/dist/terminal/ghostty/keyCodes.logic.d.ts +20 -0
- package/dist/terminal/ghostty/keyCodes.logic.js +249 -0
- package/dist/terminal/ghostty/links.logic.d.ts +39 -0
- package/dist/terminal/ghostty/links.logic.js +84 -0
- package/dist/terminal/ghostty/renderer.d.ts +98 -0
- package/dist/terminal/ghostty/renderer.js +481 -0
- package/dist/terminal/ghostty/runtime.d.ts +126 -0
- package/dist/terminal/ghostty/runtime.js +346 -0
- package/dist/terminal/ghostty/spriteGlyphs.logic.d.ts +64 -0
- package/dist/terminal/ghostty/spriteGlyphs.logic.js +546 -0
- package/dist/terminal/ghostty/surface.d.ts +285 -0
- package/dist/terminal/ghostty/surface.js +1565 -0
- package/dist/terminal/ghostty/surface.logic.d.ts +181 -0
- package/dist/terminal/ghostty/surface.logic.js +392 -0
- package/dist/terminal/ghostty/vendor/LICENSE +21 -0
- package/dist/terminal/ghostty/vendor/ghostty-effects.wasm +0 -0
- package/dist/terminal/ghostty/vendor/ghostty-vt.wasm +0 -0
- package/dist/terminal/index.d.ts +12 -0
- package/dist/terminal/index.js +12 -0
- package/dist/terminal/terminal.css +169 -0
- package/dist/text/MarkedText.d.ts +14 -0
- package/dist/text/MarkedText.js +11 -0
- package/dist/text/highlightSegments.d.ts +13 -0
- package/dist/text/highlightSegments.js +29 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.js +3 -0
- package/dist/text/text.css +11 -0
- package/dist/themes/attributes.d.ts +21 -0
- package/dist/themes/attributes.js +41 -0
- package/dist/themes/catalog.d.ts +125 -0
- package/dist/themes/catalog.js +940 -0
- package/dist/themes/color.d.ts +29 -0
- package/dist/themes/color.js +52 -0
- package/dist/themes/ids.d.ts +139 -0
- package/dist/themes/ids.js +59 -0
- package/dist/themes/index.d.ts +12 -0
- package/dist/themes/index.js +12 -0
- package/dist/themes/themes.generated.css +1830 -0
- package/dist/themes/tokens.d.ts +189 -0
- package/dist/themes/tokens.js +462 -0
- package/dist/tooltip/Tooltip.d.ts +21 -0
- package/dist/tooltip/Tooltip.js +105 -0
- package/dist/tooltip/Tooltip.logic.d.ts +49 -0
- package/dist/tooltip/Tooltip.logic.js +50 -0
- package/dist/tooltip/index.d.ts +3 -0
- package/dist/tooltip/index.js +3 -0
- package/dist/tooltip/tooltip.css +45 -0
- package/package.json +91 -4
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/* ---- Menu look ----
|
|
2
|
+
|
|
3
|
+
A filtered menu: the floating surface, the query row with its count and
|
|
4
|
+
its visual bell, the options with the cursor row, headings, and notes. A
|
|
5
|
+
palette (palette.css) is the same surface over a backdrop. Scoped by
|
|
6
|
+
:where(.listing-root) like the listing look, so an app adjusts a piece
|
|
7
|
+
with one scoped selector whatever order the stylesheets load in. The
|
|
8
|
+
field's mark is .filter-icon (filter.css) and a matched character is
|
|
9
|
+
.name-hit (text.css). */
|
|
10
|
+
|
|
11
|
+
/* A menu that drops below what opened it (a crumb, a field). It floats over
|
|
12
|
+
a listing's sticky column header (z-index 1) and an overlay inside the
|
|
13
|
+
pane (2). */
|
|
14
|
+
:where(.listing-root) .folder-menu {
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: calc(100% + 5px);
|
|
17
|
+
left: 0;
|
|
18
|
+
z-index: 3;
|
|
19
|
+
/* A completion menu's width; a menu that needs more sets its own. */
|
|
20
|
+
width: 300px;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
padding: 4px;
|
|
24
|
+
background: var(--surface);
|
|
25
|
+
border: 1px solid var(--border-strong);
|
|
26
|
+
border-radius: 8px;
|
|
27
|
+
box-shadow: var(--shadow-menu);
|
|
28
|
+
font-weight: normal;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* A menu's query row is a filter field: the icon stands over the rows'
|
|
32
|
+
icons (the menu's padding plus a row's put both 10px in), and the rule
|
|
33
|
+
under it is the accent a focused field wears, which a menu's always is. */
|
|
34
|
+
:where(.listing-root) .folder-menu-query {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
height: 26px;
|
|
38
|
+
margin: -4px -4px 4px;
|
|
39
|
+
padding: 0 10px;
|
|
40
|
+
border-bottom: 1px solid var(--accent);
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* The field keeps room for its placeholder, so a long target name gives way
|
|
45
|
+
before the words that say the field filters. */
|
|
46
|
+
:where(.listing-root) .folder-menu-query input {
|
|
47
|
+
flex: 1;
|
|
48
|
+
min-width: 14ch;
|
|
49
|
+
height: 100%;
|
|
50
|
+
border: none;
|
|
51
|
+
background: transparent;
|
|
52
|
+
color: var(--accent);
|
|
53
|
+
font: inherit;
|
|
54
|
+
caret-color: var(--accent);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:where(.listing-root) .folder-menu-query input:focus {
|
|
58
|
+
outline: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:where(.listing-root) .folder-menu-query input::placeholder {
|
|
62
|
+
color: var(--text-dim);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:where(.listing-root) .folder-menu-count {
|
|
66
|
+
margin-left: 1ch;
|
|
67
|
+
color: var(--text-dim);
|
|
68
|
+
font-family: var(--font-ui);
|
|
69
|
+
font-size: 11px;
|
|
70
|
+
font-variant-numeric: tabular-nums;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
:where(.listing-root) .folder-menu-options {
|
|
75
|
+
/* The options' offset parent, so the cursor row scrolls into view here. */
|
|
76
|
+
position: relative;
|
|
77
|
+
max-height: 216px;
|
|
78
|
+
overflow-y: auto;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:where(.listing-root) .folder-menu-option {
|
|
82
|
+
display: grid;
|
|
83
|
+
grid-template-columns: 20px minmax(0, 1fr) auto;
|
|
84
|
+
align-items: center;
|
|
85
|
+
height: 24px;
|
|
86
|
+
padding: 0 8px 0 6px;
|
|
87
|
+
border-radius: 4px;
|
|
88
|
+
cursor: default;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:where(.listing-root) .folder-menu-option.cursor {
|
|
92
|
+
background: var(--cursor-row-bg);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:where(.listing-root) .folder-menu-note {
|
|
96
|
+
padding: 4px 8px;
|
|
97
|
+
color: var(--text-dim);
|
|
98
|
+
font-family: var(--font-ui);
|
|
99
|
+
font-size: 12px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* A group's name with a hairline running out from it on the same line, so a
|
|
103
|
+
group costs one short row and still reads as a break. */
|
|
104
|
+
:where(.listing-root) .entry-menu-heading {
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: 8px;
|
|
108
|
+
height: 20px;
|
|
109
|
+
padding: 3px 6px 0 8px;
|
|
110
|
+
color: var(--text-dim);
|
|
111
|
+
font-family: var(--font-ui);
|
|
112
|
+
font-size: 10.5px;
|
|
113
|
+
font-weight: 600;
|
|
114
|
+
letter-spacing: 0.04em;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:where(.listing-root) .entry-menu-heading::after {
|
|
118
|
+
content: '';
|
|
119
|
+
flex: 1;
|
|
120
|
+
height: 1px;
|
|
121
|
+
background: var(--border);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* A refused keystroke shoves the query sideways for one beat, the
|
|
125
|
+
wrong-password shake, and turns it red. The parity classes alternate
|
|
126
|
+
`bell-0` and `bell-1` on consecutive rings (useBellBeat), and the paired
|
|
127
|
+
keyframe names are identical on purpose: a changed animation-name is what
|
|
128
|
+
restarts a CSS animation, so every refused key shoves again. An app's own
|
|
129
|
+
filter field or cursor row may ring on the same keyframes. */
|
|
130
|
+
:where(.listing-root) .folder-menu-query.bell-0 input {
|
|
131
|
+
animation:
|
|
132
|
+
row-nudge-a 240ms ease-in-out,
|
|
133
|
+
query-refused-a 280ms ease-out;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:where(.listing-root) .folder-menu-query.bell-1 input {
|
|
137
|
+
animation:
|
|
138
|
+
row-nudge-b 240ms ease-in-out,
|
|
139
|
+
query-refused-b 280ms ease-out;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* Without motion a query keeps only its red. */
|
|
143
|
+
@media (prefers-reduced-motion: reduce) {
|
|
144
|
+
:where(.listing-root) .folder-menu-query.bell-0 input {
|
|
145
|
+
animation: query-refused-a 280ms ease-out;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
:where(.listing-root) .folder-menu-query.bell-1 input {
|
|
149
|
+
animation: query-refused-b 280ms ease-out;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@keyframes query-refused-a {
|
|
154
|
+
0%,
|
|
155
|
+
70% {
|
|
156
|
+
color: var(--danger);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@keyframes query-refused-b {
|
|
161
|
+
0%,
|
|
162
|
+
70% {
|
|
163
|
+
color: var(--danger);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@keyframes row-nudge-a {
|
|
168
|
+
0%,
|
|
169
|
+
100% {
|
|
170
|
+
transform: translateX(0);
|
|
171
|
+
}
|
|
172
|
+
20% {
|
|
173
|
+
transform: translateX(-5px);
|
|
174
|
+
}
|
|
175
|
+
45% {
|
|
176
|
+
transform: translateX(5px);
|
|
177
|
+
}
|
|
178
|
+
70% {
|
|
179
|
+
transform: translateX(-3px);
|
|
180
|
+
}
|
|
181
|
+
85% {
|
|
182
|
+
transform: translateX(2px);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@keyframes row-nudge-b {
|
|
187
|
+
0%,
|
|
188
|
+
100% {
|
|
189
|
+
transform: translateX(0);
|
|
190
|
+
}
|
|
191
|
+
20% {
|
|
192
|
+
transform: translateX(-5px);
|
|
193
|
+
}
|
|
194
|
+
45% {
|
|
195
|
+
transform: translateX(5px);
|
|
196
|
+
}
|
|
197
|
+
70% {
|
|
198
|
+
transform: translateX(-3px);
|
|
199
|
+
}
|
|
200
|
+
85% {
|
|
201
|
+
transform: translateX(2px);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The visual bell for a count of refused keystrokes: the count's parity from
|
|
3
|
+
* a ring until the count has settled for one beat, null at rest. The parity
|
|
4
|
+
* alternates per ring so the stylesheet can restart its animation for every
|
|
5
|
+
* refused key, including the repeats of a held one. Put it on a menu's query
|
|
6
|
+
* row as `bell-0` or `bell-1` (`.folder-menu-query.bell-0`).
|
|
7
|
+
*/
|
|
8
|
+
export declare function useBellBeat(bell: number): 0 | 1 | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* How long a refusal's classes stay on, in milliseconds. Longer than the
|
|
4
|
+
* 240 ms nudge and the red flash in menu.css, so both finish before their
|
|
5
|
+
* class is taken away.
|
|
6
|
+
*/
|
|
7
|
+
const BELL_BEAT_MS = 300;
|
|
8
|
+
/**
|
|
9
|
+
* The visual bell for a count of refused keystrokes: the count's parity from
|
|
10
|
+
* a ring until the count has settled for one beat, null at rest. The parity
|
|
11
|
+
* alternates per ring so the stylesheet can restart its animation for every
|
|
12
|
+
* refused key, including the repeats of a held one. Put it on a menu's query
|
|
13
|
+
* row as `bell-0` or `bell-1` (`.folder-menu-query.bell-0`).
|
|
14
|
+
*/
|
|
15
|
+
export function useBellBeat(bell) {
|
|
16
|
+
const [settledBell, setSettledBell] = useState(bell);
|
|
17
|
+
const ringing = bell !== settledBell;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!ringing) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const timer = setTimeout(() => setSettledBell(bell), BELL_BEAT_MS);
|
|
23
|
+
return () => clearTimeout(timer);
|
|
24
|
+
}, [bell, ringing]);
|
|
25
|
+
return ringing ? (bell % 2 === 0 ? 0 : 1) : null;
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type CutPart } from './NameCut.logic.js';
|
|
3
|
+
/** Props for {@link NameCut}. */
|
|
4
|
+
export interface NameCutProps {
|
|
5
|
+
/** The line in parts (`labelParts`, `nameParts`). */
|
|
6
|
+
readonly parts: readonly CutPart[];
|
|
7
|
+
/** The box's own class, which sets its type, colour, and size where it is drawn. */
|
|
8
|
+
readonly className?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A line that names a file, cut so the name keeps its end (`labelParts`,
|
|
12
|
+
* `nameParts`): a long name's head gives way with an ellipsis, the words
|
|
13
|
+
* after the name give way at their end alongside it, the words before it
|
|
14
|
+
* give way at their end only once both have gone as far as they go, and
|
|
15
|
+
* the name's tail, at its front, only once those words have too, so the
|
|
16
|
+
* line always ends in view. A line with a cut name is drawn in parts for
|
|
17
|
+
* sight only, and assistive technology reads it whole once; a line of words
|
|
18
|
+
* alone is drawn and read as it is. The tooltip carries the complete line,
|
|
19
|
+
* including the words around the name. Styled by the `.name-cut` rules;
|
|
20
|
+
* `className` sets the line's type and colour where it is drawn.
|
|
21
|
+
*/
|
|
22
|
+
export declare function NameCut({ parts, className }: NameCutProps): ReactElement;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { tooltip } from '../tooltip/Tooltip.logic.js';
|
|
4
|
+
import { partsText } from './NameCut.logic.js';
|
|
5
|
+
/**
|
|
6
|
+
* A line that names a file, cut so the name keeps its end (`labelParts`,
|
|
7
|
+
* `nameParts`): a long name's head gives way with an ellipsis, the words
|
|
8
|
+
* after the name give way at their end alongside it, the words before it
|
|
9
|
+
* give way at their end only once both have gone as far as they go, and
|
|
10
|
+
* the name's tail, at its front, only once those words have too, so the
|
|
11
|
+
* line always ends in view. A line with a cut name is drawn in parts for
|
|
12
|
+
* sight only, and assistive technology reads it whole once; a line of words
|
|
13
|
+
* alone is drawn and read as it is. The tooltip carries the complete line,
|
|
14
|
+
* including the words around the name. Styled by the `.name-cut` rules;
|
|
15
|
+
* `className` sets the line's type and colour where it is drawn.
|
|
16
|
+
*/
|
|
17
|
+
export function NameCut({ parts, className }) {
|
|
18
|
+
// Split spans can be read as separate runs, so a cut line is read from
|
|
19
|
+
// one hidden copy; words alone are one span already.
|
|
20
|
+
const cut = parts.some((part) => part.kind === 'name');
|
|
21
|
+
const text = partsText(parts);
|
|
22
|
+
return (_jsxs("span", { className: className ? `name-cut ${className}` : 'name-cut', ...tooltip(text), children: [cut && _jsx("span", { className: "visually-hidden", children: text }), _jsx("span", { "aria-hidden": cut || undefined, className: "name-cut-line", children: parts.map((part, index) =>
|
|
23
|
+
// A line's parts are fixed in order; their place is their identity.
|
|
24
|
+
part.kind === 'text' ? (_jsx("span", {
|
|
25
|
+
// The words that end the line give way alongside a name's
|
|
26
|
+
// head; the words before a name only after both have.
|
|
27
|
+
className: index === parts.length - 1 ? 'name-cut-rest' : 'name-cut-text', children: part.text }, index)) : (_jsxs(Fragment, { children: [part.head !== '' && _jsx("span", { className: "name-cut-head", children: part.head }), _jsx("span", { className: "name-cut-tail", children: _jsx("bdi", { dir: "ltr", children: part.tail }) })] }, index))) })] }));
|
|
28
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One run of a line: words, which give way at their end (the line's last
|
|
3
|
+
* alongside a name's head, any others only after both); or a long name,
|
|
4
|
+
* whose head gives way and whose tail, its closing quote included, stays
|
|
5
|
+
* until everything before it has given way.
|
|
6
|
+
*/
|
|
7
|
+
export type CutPart = {
|
|
8
|
+
readonly kind: 'text';
|
|
9
|
+
readonly text: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'name';
|
|
12
|
+
readonly head: string;
|
|
13
|
+
readonly tail: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A name split for a cut in its middle: the head gives way to an ellipsis
|
|
17
|
+
* when space runs out, and the tail stays until the rest of its line has
|
|
18
|
+
* given way. The tail is the
|
|
19
|
+
* extension and the six characters before it, ten characters at least and
|
|
20
|
+
* twenty-four at most, so "2026-10-17 homepage hero, final (approved by
|
|
21
|
+
* client).mov" reads "2026-10-17 homepag…lient).mov" and a folder's last
|
|
22
|
+
* ten characters stay.
|
|
23
|
+
* A name of at most twenty characters is all tail, so it is never cut.
|
|
24
|
+
*/
|
|
25
|
+
export declare function middleCut(name: string): {
|
|
26
|
+
readonly head: string;
|
|
27
|
+
readonly tail: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A line built from words and names, each `{ name }` cut in its middle:
|
|
31
|
+
* `nameParts(['"', { name }, '" already exists'])`. A cut name keeps its
|
|
32
|
+
* closing quote in its tail, so a quote is never cut on its own. A short
|
|
33
|
+
* name, which is never cut in its middle, joins the words around it, so a
|
|
34
|
+
* line that names only short names is words that give way at their end:
|
|
35
|
+
* the words after the name go first, and the name itself only once they
|
|
36
|
+
* have. Empty words are left out.
|
|
37
|
+
*/
|
|
38
|
+
export declare function nameParts(segments: readonly (string | {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
})[]): CutPart[];
|
|
41
|
+
/**
|
|
42
|
+
* A line that quotes a name (an operation's label, `"name" already
|
|
43
|
+
* exists`), its first quoted name cut in its middle, its closing
|
|
44
|
+
* quote kept with the name's tail, and the rest of the line, later names
|
|
45
|
+
* included, after it as words that give way at their end:
|
|
46
|
+
* `Copying "Better.Call.Saul…CtrlHD.mkv" to "Seed…`. A
|
|
47
|
+
* line that quotes no name gives way at its end, as plain text does.
|
|
48
|
+
*/
|
|
49
|
+
export declare function labelParts(line: string): CutPart[];
|
|
50
|
+
/** The whole line, as assistive technology reads it once. */
|
|
51
|
+
export declare const partsText: (parts: readonly CutPart[]) => string;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Lines that name a file or a folder, cut so the name keeps its end: when a
|
|
3
|
+
* line runs out of room, a long name gives way in its middle
|
|
4
|
+
* ("Better.Call.Saul…CtrlHD.mkv" already exists). What follows the name
|
|
5
|
+
* (` to "Seedbox"`, ` already exists in Downloads`, ` as administrator`)
|
|
6
|
+
* gives way at its end, alongside the name, so the name's end and the words
|
|
7
|
+
* right after it stay in view as long as they can. The words before the
|
|
8
|
+
* name give way at their end only once both have gone as far as they go,
|
|
9
|
+
* and the name's tail, at its front, only once those words have too, so
|
|
10
|
+
* the line always ends in view and nothing is clipped without an ellipsis.
|
|
11
|
+
* A short name ("Breaking Bad") is never
|
|
12
|
+
* cut in its middle: it reads as words, and the words after it give way
|
|
13
|
+
* first. The parts are drawn by `NameCut`; the cut itself is CSS
|
|
14
|
+
* (`namecut.css`), so it follows the width the line has.
|
|
15
|
+
*/
|
|
16
|
+
/** The longest name kept whole: one this short reads better whole than cut. */
|
|
17
|
+
const SHORT_NAME_LENGTH = 20;
|
|
18
|
+
/** The fewest characters a cut name keeps after its ellipsis. */
|
|
19
|
+
const MINIMUM_TAIL_LENGTH = 10;
|
|
20
|
+
/**
|
|
21
|
+
* The most characters a cut name keeps after its ellipsis, so a long run
|
|
22
|
+
* after a name's last dot ("v1.2 final deck for the board…") is not kept
|
|
23
|
+
* whole as if it were an extension, and the tail fits the lines that cut
|
|
24
|
+
* a name before it has to give way itself.
|
|
25
|
+
*/
|
|
26
|
+
const MAXIMUM_TAIL_LENGTH = 24;
|
|
27
|
+
/**
|
|
28
|
+
* A name split for a cut in its middle: the head gives way to an ellipsis
|
|
29
|
+
* when space runs out, and the tail stays until the rest of its line has
|
|
30
|
+
* given way. The tail is the
|
|
31
|
+
* extension and the six characters before it, ten characters at least and
|
|
32
|
+
* twenty-four at most, so "2026-10-17 homepage hero, final (approved by
|
|
33
|
+
* client).mov" reads "2026-10-17 homepag…lient).mov" and a folder's last
|
|
34
|
+
* ten characters stay.
|
|
35
|
+
* A name of at most twenty characters is all tail, so it is never cut.
|
|
36
|
+
*/
|
|
37
|
+
export function middleCut(name) {
|
|
38
|
+
if (name.length <= SHORT_NAME_LENGTH)
|
|
39
|
+
return { head: '', tail: name };
|
|
40
|
+
const dot = name.lastIndexOf('.');
|
|
41
|
+
const keep = Math.min(Math.max(dot > 0 ? name.length - dot + 6 : 0, MINIMUM_TAIL_LENGTH), MAXIMUM_TAIL_LENGTH);
|
|
42
|
+
const split = Math.max(name.length - keep, 0);
|
|
43
|
+
return { head: name.slice(0, split), tail: name.slice(split) };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A closing quote that ends a quoted name: straight, or the closing mark of
|
|
47
|
+
* the languages `labelParts` reads (” “ » «).
|
|
48
|
+
*/
|
|
49
|
+
const CLOSING_QUOTE = /^["”“»«]/u;
|
|
50
|
+
/**
|
|
51
|
+
* A line built from words and names, each `{ name }` cut in its middle:
|
|
52
|
+
* `nameParts(['"', { name }, '" already exists'])`. A cut name keeps its
|
|
53
|
+
* closing quote in its tail, so a quote is never cut on its own. A short
|
|
54
|
+
* name, which is never cut in its middle, joins the words around it, so a
|
|
55
|
+
* line that names only short names is words that give way at their end:
|
|
56
|
+
* the words after the name go first, and the name itself only once they
|
|
57
|
+
* have. Empty words are left out.
|
|
58
|
+
*/
|
|
59
|
+
export function nameParts(segments) {
|
|
60
|
+
const parts = [];
|
|
61
|
+
const addText = (words) => {
|
|
62
|
+
const last = parts.at(-1);
|
|
63
|
+
let text = words;
|
|
64
|
+
if (last?.kind === 'name') {
|
|
65
|
+
const quote = CLOSING_QUOTE.exec(text)?.[0] ?? '';
|
|
66
|
+
parts[parts.length - 1] = { ...last, tail: last.tail + quote };
|
|
67
|
+
text = text.slice(quote.length);
|
|
68
|
+
}
|
|
69
|
+
if (last?.kind === 'text') {
|
|
70
|
+
parts[parts.length - 1] = { kind: 'text', text: last.text + text };
|
|
71
|
+
}
|
|
72
|
+
else if (text !== '') {
|
|
73
|
+
parts.push({ kind: 'text', text });
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
for (const segment of segments) {
|
|
77
|
+
if (typeof segment === 'string') {
|
|
78
|
+
addText(segment);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const cut = middleCut(segment.name);
|
|
82
|
+
if (cut.head === '') {
|
|
83
|
+
addText(cut.tail);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
parts.push({ kind: 'name', ...cut });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return parts;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A quoted name in a line: straight quotes, as untranslated labels write them,
|
|
93
|
+
* or the quotation marks of the language a translated line is in: “ ” in
|
|
94
|
+
* English, „ “ or „ ” in German and Polish, « » in French, » « in
|
|
95
|
+
* Slovenian, ” ” in Swedish and Finnish. French spacing inside « » stays
|
|
96
|
+
* with the name.
|
|
97
|
+
*/
|
|
98
|
+
const QUOTED = /"([^"]+)"|“([^”]+)”|„([^“”]+)[“”]|«([^»]+)»|»([^«]+)«|”([^”]+)”/u;
|
|
99
|
+
/**
|
|
100
|
+
* A line that quotes a name (an operation's label, `"name" already
|
|
101
|
+
* exists`), its first quoted name cut in its middle, its closing
|
|
102
|
+
* quote kept with the name's tail, and the rest of the line, later names
|
|
103
|
+
* included, after it as words that give way at their end:
|
|
104
|
+
* `Copying "Better.Call.Saul…CtrlHD.mkv" to "Seed…`. A
|
|
105
|
+
* line that quotes no name gives way at its end, as plain text does.
|
|
106
|
+
*/
|
|
107
|
+
export function labelParts(line) {
|
|
108
|
+
const match = QUOTED.exec(line);
|
|
109
|
+
if (match === null)
|
|
110
|
+
return [{ kind: 'text', text: line }];
|
|
111
|
+
const opening = match.index + 1;
|
|
112
|
+
const closing = match.index + match[0].length - 1;
|
|
113
|
+
return nameParts([
|
|
114
|
+
line.slice(0, opening),
|
|
115
|
+
{ name: match.slice(1).find((name) => name !== undefined) ?? '' },
|
|
116
|
+
line.slice(closing)
|
|
117
|
+
]);
|
|
118
|
+
}
|
|
119
|
+
/** The whole line, as assistive technology reads it once. */
|
|
120
|
+
export const partsText = (parts) => parts.map((part) => (part.kind === 'text' ? part.text : part.head + part.tail)).join('');
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Names cut in their middle: `NameCut` draws a line whose file name keeps its end, from the parts `labelParts` and `nameParts` build. */
|
|
2
|
+
export { NameCut, type NameCutProps } from './NameCut.js';
|
|
3
|
+
export { labelParts, middleCut, nameParts, partsText, type CutPart } from './NameCut.logic.js';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* ---- Names cut in their middle (NameCut) ----
|
|
2
|
+
|
|
3
|
+
A long name's head and the words after the name give way together, each
|
|
4
|
+
in proportion to its length: the head down to its ellipsis, the words
|
|
5
|
+
after at their end. The words before the name give way at their end only
|
|
6
|
+
once those two have gone as far as they go, and the name's tail, its
|
|
7
|
+
ending kept in view behind an ellipsis at its front, only once those words
|
|
8
|
+
have gone too, so the line always ends in view. A short name is never
|
|
9
|
+
cut in its middle: it joins the words around it (nameParts).
|
|
10
|
+
Each tier's shrink factor dwarfs the next one's
|
|
11
|
+
by far more than any width it could hold, so a later tier loses nothing
|
|
12
|
+
while an earlier one can still give. */
|
|
13
|
+
.name-cut {
|
|
14
|
+
display: flex;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.name-cut-line {
|
|
20
|
+
display: flex;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
white-space: pre;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* A head that has to give way keeps room for a character and its ellipsis. */
|
|
26
|
+
.name-cut-head {
|
|
27
|
+
flex: 0 10000000000 auto;
|
|
28
|
+
min-width: 2ch;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
text-overflow: ellipsis;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.name-cut-rest {
|
|
34
|
+
flex: 0 10000000000 auto;
|
|
35
|
+
min-width: calc-size(max-content, min(size, 2ch));
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
text-overflow: ellipsis;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.name-cut-text {
|
|
41
|
+
flex: 0 100000 auto;
|
|
42
|
+
min-width: calc-size(max-content, min(size, 2ch));
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
text-overflow: ellipsis;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* The tail's box runs right to left so its ellipsis lands at its front; the
|
|
48
|
+
name inside is a left-to-right isolate (<bdi dir="ltr">), so a
|
|
49
|
+
right-to-left run, its stops, and its closing quote keep the order the
|
|
50
|
+
head and the whole name read in. */
|
|
51
|
+
.name-cut-tail {
|
|
52
|
+
flex: 0 1 auto;
|
|
53
|
+
min-width: 0;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
direction: rtl;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* The spoken copy of the line is not selected twice with the drawn one. */
|
|
60
|
+
.name-cut > .visually-hidden {
|
|
61
|
+
user-select: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* In a title strip's context, the line sits at the strip's right edge. */
|
|
65
|
+
.dialog-context > .name-cut {
|
|
66
|
+
justify-content: flex-end;
|
|
67
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { LinkLook } from '../pane/PaneActions.js';
|
|
3
|
+
/** Props for {@link Pager}. */
|
|
4
|
+
export interface PagerProps {
|
|
5
|
+
/**
|
|
6
|
+
* What the pages are of, passed to every `pager` label so each sentence
|
|
7
|
+
* can inflect its noun; the English defaults read it as a plural noun
|
|
8
|
+
* ("rows"). "items" unless given.
|
|
9
|
+
*/
|
|
10
|
+
readonly kind?: string;
|
|
11
|
+
/** The page shown, from 0. */
|
|
12
|
+
readonly page: number;
|
|
13
|
+
/** How many pages the list has, or has so far when `endKnown` is false. */
|
|
14
|
+
readonly pages: number;
|
|
15
|
+
/** Called with the page (from 0) a step or the menu asks for. */
|
|
16
|
+
readonly onPage: (page: number) => void;
|
|
17
|
+
/** Whether `pages` is every page, so End can go to the last; false hides it. */
|
|
18
|
+
readonly endKnown?: boolean;
|
|
19
|
+
/** Whether a page after this one can be reached; false hides Next and End. */
|
|
20
|
+
readonly forward?: boolean;
|
|
21
|
+
/** How the steps draw: icons (the default), words, or both. */
|
|
22
|
+
readonly look?: LinkLook;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The pager of a long list, in the listing look: Begin and Previous while
|
|
26
|
+
* a page precedes the one shown, a menu of page numbers (all of them, or a
|
|
27
|
+
* sample of a long run, `selectorPages`), then Next and End while a page
|
|
28
|
+
* follows. It draws nothing for a list of one page. Its steps are reached
|
|
29
|
+
* by the pointer and Tab; the keys that page the list stay the caller's. A
|
|
30
|
+
* list whose last page is not known yet (one counted only so far) offers
|
|
31
|
+
* no End, and a page that cannot be passed (`forward` false) offers neither
|
|
32
|
+
* Next nor End. `look` draws its steps as icons (named on hover), words,
|
|
33
|
+
* or both; a hidden icon step keeps its place so the menu never moves,
|
|
34
|
+
* while a hidden worded step takes no room, since their widths differ.
|
|
35
|
+
* Words and names come from the `pager` labels.
|
|
36
|
+
*/
|
|
37
|
+
export declare function Pager({ kind, page, pages, onPage, endKnown, forward, look }: PagerProps): ReactElement | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from 'lucide-react';
|
|
3
|
+
import { useLabels } from '../labels/UiokProvider.js';
|
|
4
|
+
import { tooltip } from '../tooltip/Tooltip.logic.js';
|
|
5
|
+
import { selectorPages } from './Pager.logic.js';
|
|
6
|
+
/** Each step's icon. */
|
|
7
|
+
const STEP_ICONS = {
|
|
8
|
+
begin: ChevronsLeft,
|
|
9
|
+
previous: ChevronLeft,
|
|
10
|
+
next: ChevronRight,
|
|
11
|
+
end: ChevronsRight
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The pager of a long list, in the listing look: Begin and Previous while
|
|
15
|
+
* a page precedes the one shown, a menu of page numbers (all of them, or a
|
|
16
|
+
* sample of a long run, `selectorPages`), then Next and End while a page
|
|
17
|
+
* follows. It draws nothing for a list of one page. Its steps are reached
|
|
18
|
+
* by the pointer and Tab; the keys that page the list stay the caller's. A
|
|
19
|
+
* list whose last page is not known yet (one counted only so far) offers
|
|
20
|
+
* no End, and a page that cannot be passed (`forward` false) offers neither
|
|
21
|
+
* Next nor End. `look` draws its steps as icons (named on hover), words,
|
|
22
|
+
* or both; a hidden icon step keeps its place so the menu never moves,
|
|
23
|
+
* while a hidden worded step takes no room, since their widths differ.
|
|
24
|
+
* Words and names come from the `pager` labels.
|
|
25
|
+
*/
|
|
26
|
+
export function Pager({ kind = 'items', page, pages, onPage, endKnown = true, forward = true, look = 'icons' }) {
|
|
27
|
+
const labels = useLabels().pager;
|
|
28
|
+
if (pages <= 1)
|
|
29
|
+
return null;
|
|
30
|
+
const first = page === 0;
|
|
31
|
+
const last = page >= pages - 1 || !forward;
|
|
32
|
+
const step = (name, to, shown) => {
|
|
33
|
+
const Icon = STEP_ICONS[name];
|
|
34
|
+
const word = labels[name];
|
|
35
|
+
return shown ? (_jsxs("button", { "aria-label": labels.step(name, kind), className: look === 'icons' ? 'pager-step' : 'pager-step worded', onClick: () => onPage(to), type: "button", ...(look === 'icons' ? tooltip(word) : {}), children: [look !== 'text' && _jsx(Icon, { "aria-hidden": true, size: 13 }), look !== 'icons' && word] })) : look === 'icons' ? (_jsx("span", { "aria-hidden": true, className: "pager-step" })) : (_jsx(_Fragment, {}));
|
|
36
|
+
};
|
|
37
|
+
return (_jsxs("nav", { "aria-label": labels.pages(kind), className: "pager", children: [step('begin', 0, !first), step('previous', page - 1, !first), _jsx("select", { "aria-label": labels.page(kind), className: "pager-page", onChange: (event) => onPage(Number(event.currentTarget.value) - 1), value: page + 1, children: selectorPages(pages, page + 1).map((number) => (_jsx("option", { value: number, children: labels.pageOption(number, pages) }, number))) }), step('next', page + 1, !last), step('end', pages - 1, !last && endKnown)] }));
|
|
38
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** How many pages `count` items take at `size` a page; never fewer than one. */
|
|
2
|
+
export declare const pageCount: (count: number, size: number) => number;
|
|
3
|
+
/** `page` (from 0) held inside a list of `pages` pages. */
|
|
4
|
+
export declare const clampPage: (page: number, pages: number) => number;
|
|
5
|
+
/** The items of `page` (from 0), `size` a page. */
|
|
6
|
+
export declare const pageSlice: <T>(items: readonly T[], page: number, size: number) => readonly T[];
|
|
7
|
+
/** The page (from 0) that holds the item at `index`, `size` a page. */
|
|
8
|
+
export declare const pageOf: (index: number, size: number) => number;
|
|
9
|
+
/**
|
|
10
|
+
* The page numbers (from 1) the selector lists for `pages` pages while
|
|
11
|
+
* `current` (from 1) is shown, in order, each once.
|
|
12
|
+
*/
|
|
13
|
+
export declare function selectorPages(pages: number, current: number): readonly number[];
|