@kolkrabbi/kol-component 0.272.0 → 0.274.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/package.json +1 -1
- package/src/molecules/QuickLookFrame.jsx +5 -4
- package/src/molecules/Rail.jsx +3 -3
- package/src/molecules/SearchInput.jsx +26 -7
- package/src/organisms/CommandOverlay.jsx +97 -38
- package/src/organisms/MediaLibraryPages.jsx +2 -2
- package/src/organisms/SettingsPanel.jsx +21 -14
- package/src/organisms/ShortcutsOverlay.jsx +21 -57
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ import CloseButton from '../atoms/CloseButton.jsx'
|
|
|
11
11
|
* floating over a video, a see-through page — so no two kinds looked like one feature. One
|
|
12
12
|
* opaque window now holds all of them:
|
|
13
13
|
*
|
|
14
|
-
* header
|
|
14
|
+
* header ‹ › n / N · the file's name · its facts · the kind's actions and the close, right-aligned
|
|
15
15
|
* body the media at its own aspect ratio, capped to the viewport — the window hugs it
|
|
16
16
|
* footer the transport, when the kind has one (`PlaybackBar docked`)
|
|
17
17
|
*
|
|
@@ -61,9 +61,6 @@ export default function QuickLookFrame({ title, meta, actions, onClose, nav, siz
|
|
|
61
61
|
className={`kol-quicklook${footer ? ' kol-quicklook--footer' : ''}${size ? ' kol-quicklook--sized' : ''} ${className}`.trim()}>
|
|
62
62
|
{header && (
|
|
63
63
|
<div className="kol-quicklook-header">
|
|
64
|
-
{/* THE ESTATE'S CLOSE IDIOM, and every header control wears it (user 2026-09-23): bare at
|
|
65
|
-
* rest, a wash on hover — a filled container read as a second surface on the header */}
|
|
66
|
-
{onClose && <CloseButton size="sm" onClick={onClose} />}
|
|
67
64
|
{nav?.total > 1 && (
|
|
68
65
|
/* the pager is its own group: the count sits off the chevrons, and the group sits clear of
|
|
69
66
|
* the file's name (user 2026-09-23) */
|
|
@@ -77,6 +74,10 @@ export default function QuickLookFrame({ title, meta, actions, onClose, nav, siz
|
|
|
77
74
|
{meta && <span className="kol-mono-12 text-meta truncate">{meta}</span>}
|
|
78
75
|
<span className="flex-1" />
|
|
79
76
|
{actions}
|
|
77
|
+
{/* THE ESTATE'S CLOSE IDIOM, and every header control wears it (user 2026-09-23): bare at
|
|
78
|
+
* rest, a wash on hover — a filled container read as a second surface on the header. LAST, at the
|
|
79
|
+
* far right (user 2026-10-18: *"X should be space between justify on the right"*) */}
|
|
80
|
+
{onClose && <CloseButton size="sm" onClick={onClose} />}
|
|
80
81
|
</div>
|
|
81
82
|
)}
|
|
82
83
|
<div className="kol-quicklook-body">{children}</div>
|
package/src/molecules/Rail.jsx
CHANGED
|
@@ -219,7 +219,7 @@ export default function Rail({
|
|
|
219
219
|
style={sizeStyle}
|
|
220
220
|
>
|
|
221
221
|
{grab}
|
|
222
|
-
<div className="flex h-full flex-col
|
|
222
|
+
<div className="flex h-full flex-col p-[var(--kol-pad-overlay)]">
|
|
223
223
|
{header != null && <div className="mb-6 min-w-0">{header}</div>}
|
|
224
224
|
<div className="flex-1 overflow-auto" style={{ overflowAnchor: 'none' }}>{children}</div>
|
|
225
225
|
</div>
|
|
@@ -238,7 +238,7 @@ export default function Rail({
|
|
|
238
238
|
: `inset-y-0 max-w-full ${side === 'right' ? 'right-0' : 'left-0'} ${edgeCls} ${extent == null ? 'w-full' : ''}`
|
|
239
239
|
/* padding per side (RailOverlay): a bottom rail clears the home bar at its foot; a top rail its notch */
|
|
240
240
|
const size = vertical
|
|
241
|
-
? { ...(extent != null ? { height: px(extent) } : {}), ...(side === 'bottom' ? { paddingBottom: 'calc(
|
|
241
|
+
? { ...(extent != null ? { height: px(extent) } : {}), ...(side === 'bottom' ? { paddingBottom: 'calc(var(--kol-pad-overlay) + env(safe-area-inset-bottom, 0px))' } : { paddingTop: 'calc(var(--kol-pad-overlay) + env(safe-area-inset-top, 0px))' }) }
|
|
242
242
|
: extent != null ? { width: px(extent) } : undefined
|
|
243
243
|
const motionBackdrop = reduced
|
|
244
244
|
? ''
|
|
@@ -265,7 +265,7 @@ export default function Rail({
|
|
|
265
265
|
tabIndex={-1}
|
|
266
266
|
/* `edge` / `shadow` (SettingsPanelApproved, 2026-08-27): the approved settings
|
|
267
267
|
* drawer has neither — the sheet meets the page flat */
|
|
268
|
-
className={`fixed z-[200] flex flex-col bg-surface-primary
|
|
268
|
+
className={`fixed z-[200] flex flex-col bg-surface-primary p-[var(--kol-pad-overlay)] outline-none ${backdrop && shadow ? 'shadow-2xl' : ''} ${place} border-oq-08 ${motionPanel} ${className}`}
|
|
269
269
|
style={size}
|
|
270
270
|
>
|
|
271
271
|
{grab}
|
|
@@ -43,6 +43,10 @@ import Kbd from '../atoms/Kbd.jsx'
|
|
|
43
43
|
* @param {Function} onOpenChange (expanding) (bool) => void — trigger click / Escape
|
|
44
44
|
* @param {number} expandedWidth (expanding) open pill width in px (default 280)
|
|
45
45
|
* @param {string} triggerLabel (expanding) aria-label on the icon trigger (default 'Open search')
|
|
46
|
+
* @param {Function} [onBack] a drill-in's way back: the leading search glyph becomes a back arrow IN THE SAME
|
|
47
|
+
* SLOT, so the field never moves (CommandOverlay's second layer — user 2026-10-18:
|
|
48
|
+
* *"why would the back move the input?!"*)
|
|
49
|
+
* @param {string} [backLabel] the back arrow's aria-label (default `Back`)
|
|
46
50
|
* @param {string} className extra classes on the shell
|
|
47
51
|
*/
|
|
48
52
|
|
|
@@ -88,6 +92,8 @@ export default function SearchInput({
|
|
|
88
92
|
iconSize,
|
|
89
93
|
fieldHeight,
|
|
90
94
|
triggerLabel = 'Open search',
|
|
95
|
+
onBack,
|
|
96
|
+
backLabel = 'Back',
|
|
91
97
|
className = '',
|
|
92
98
|
...inputProps
|
|
93
99
|
}) {
|
|
@@ -226,13 +232,26 @@ export default function SearchInput({
|
|
|
226
232
|
|
|
227
233
|
return (
|
|
228
234
|
<label className={shellCls}>
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
{onBack ? (
|
|
236
|
+
<button
|
|
237
|
+
type="button"
|
|
238
|
+
aria-label={backLabel}
|
|
239
|
+
/* mousedown keeps focus in the field */
|
|
240
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
241
|
+
onClick={onBack}
|
|
242
|
+
className={`flex items-center shrink-0 cursor-pointer transition-colors ${bare ? 'text-oq-48 hover:text-oq-96' : 'text-auto opacity-50 hover:opacity-100'}`}
|
|
243
|
+
>
|
|
244
|
+
<Icon name="arrow-left" size={iconSize ?? glyphSize(size)} />
|
|
245
|
+
</button>
|
|
246
|
+
) : (
|
|
247
|
+
<span
|
|
248
|
+
aria-hidden="true"
|
|
249
|
+
className={`flex items-center shrink-0 ${bare ? 'text-oq-48' : 'text-auto opacity-50'}`}
|
|
250
|
+
>
|
|
251
|
+
{/* ADJACENT — this glyph sits in the field's line box beside the query */}
|
|
252
|
+
<Icon name="search" size={iconSize ?? glyphSize(size)} />
|
|
253
|
+
</span>
|
|
254
|
+
)}
|
|
236
255
|
<input
|
|
237
256
|
type="search"
|
|
238
257
|
value={value ?? ''}
|
|
@@ -4,8 +4,6 @@ import SearchInput from '../molecules/SearchInput.jsx'
|
|
|
4
4
|
import Tag from '../atoms/Tag.jsx'
|
|
5
5
|
import Kbd from '../atoms/Kbd.jsx'
|
|
6
6
|
import OptionRow from '../molecules/OptionRow.jsx'
|
|
7
|
-
import Button from '../atoms/Button.jsx'
|
|
8
|
-
import { Tooltip } from '../utilities/Popover.jsx'
|
|
9
7
|
import { shortcutInScope } from './ShortcutsOverlay.jsx'
|
|
10
8
|
|
|
11
9
|
/* ONE COLUMN (2026-09-30): rows, headings and footer sit on the field's own
|
|
@@ -64,25 +62,46 @@ export function HighlightMatch({ label, query, ranges }) {
|
|
|
64
62
|
/* THE MODES (CommandOverlayModes, kol-monitor 2026-10-17 — user: *"can we make the modal more general then just
|
|
65
63
|
* search? … add module would be another, shortcuts could be a third"*). One field, one grouped list, one footer;
|
|
66
64
|
* the mode only sets the footer's words and, for `shortcuts`, where the rows come from. */
|
|
67
|
-
|
|
68
|
-
const
|
|
65
|
+
/* `go` was `search` under another placeholder — folded into it (user 2026-10-18); still accepted as its old name */
|
|
66
|
+
const MODE_LABEL = { search: 'Go to page', add: 'Add' }
|
|
67
|
+
const MODE_PLACEHOLDER = { search: 'Search…', add: 'Add…' }
|
|
69
68
|
|
|
70
|
-
/* THE KEYMAP AS
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
/* THE KEYMAP AS FOLDS (user 2026-10-18: *"shortcuts doesnt make any sense in command overlay, it should just be
|
|
70
|
+
* shortcuts fold"*): this page's sections (plus those with no `routes`) as fold rows under "Shortcuts", each opening
|
|
71
|
+
* its keys in place — label left, combo right, never run. The index keeps two keys with one label apart. */
|
|
72
|
+
function shortcutFolds(shortcuts, path) {
|
|
73
|
+
return shortcuts.filter((s) => shortcutInScope(s, path)).map((s) => ({
|
|
74
|
+
/* the page's own sections start OPEN (user 2026-10-18: *"if you are in rack then its already expanded no?"*) —
|
|
75
|
+
* a section with `routes` that match; App (no routes, everywhere) starts folded */
|
|
76
|
+
id: `cat:${s.section}`, label: s.section, group: 'Shortcuts', open: !!s.routes?.length,
|
|
77
|
+
items: (s.items ?? []).map((it, i) => ({ id: it.id ?? `${i}:${it.label}`, label: it.label, hint: it.combo ?? it.keys })),
|
|
78
|
+
}))
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* FOLD ROWS (user 2026-10-18: *"shortcuts could be used for things like add, where you wanna find category not a flat
|
|
82
|
+
* list, and all could also be a category"*): any row carrying `items` is a category that opens its rows under it, in
|
|
83
|
+
* place — the arrow turns down. Its children take its group and an indent; nothing else on the list moves. */
|
|
84
|
+
function unfold(rows, opened) {
|
|
85
|
+
return rows.flatMap((r) => {
|
|
86
|
+
if (!Array.isArray(r.items)) return [r]
|
|
87
|
+
const on = opened.has(r.id)
|
|
88
|
+
return [
|
|
89
|
+
{ ...r, icon: on ? 'arrow-down' : 'arrow-right', fold: true },
|
|
90
|
+
...(on ? r.items.map((c) => ({ ...c, id: `${r.id}/${c.id}`, group: r.group, indent: true, of: r.id })) : []),
|
|
91
|
+
]
|
|
92
|
+
})
|
|
78
93
|
}
|
|
79
94
|
|
|
80
95
|
/**
|
|
81
96
|
* CommandOverlay — The ⌘K overlay: search, add, go, shortcuts. Was `ShellSearchOverlay` (still exported, an
|
|
82
|
-
* alias). `mode` names what the overlay is for — `search` (default) · `
|
|
83
|
-
* `shortcuts` it draws `shortcuts` (the AppHub keymap) with NO field: the current page's sections
|
|
84
|
-
* "Shortcuts"
|
|
85
|
-
*
|
|
97
|
+
* alias). `mode` names what the overlay is for — `search` (default) · `add` · `shortcuts` (`go` is search's old name). In
|
|
98
|
+
* `shortcuts` it draws `shortcuts` (the AppHub keymap) with NO field, as fold rows: the current page's sections
|
|
99
|
+
* under "Shortcuts", each opening its keys in place (label · combo, never run). AppHub's `S` opens this.
|
|
100
|
+
*
|
|
101
|
+
* FOLD ROWS, any mode: a row with `items` is a category — Enter / → / click opens it in place, ← or Enter again
|
|
102
|
+
* closes it; its children are ordinary rows (Enter selects them). An "All" category is just a fold row holding
|
|
103
|
+
* every item. `open: true` on a fold row starts it open; ⌘/Ctrl+Enter (and the footer's second line) opens or
|
|
104
|
+
* closes them all.
|
|
86
105
|
*
|
|
87
106
|
* ARROWS (2026-10-17 — user: *"arrows up down can focus category and arrows left right can enter and back,
|
|
88
107
|
* along with enter key"*): ↑↓ move through rows; → or Enter opens a category (a `keepOpen` row); ← goes back
|
|
@@ -121,7 +140,7 @@ function shortcutRows(shortcuts, path, cat) {
|
|
|
121
140
|
* own results surface. Plain Enter keeps its meaning.
|
|
122
141
|
* @param {string} [resultsLabel] the footer's second line for ⌘Enter (e.g. `All results`)
|
|
123
142
|
* @param {Function} [onBack] a drill-in's way back (CommandOverlayModes, kol-monitor 2026-10-17): set, the
|
|
124
|
-
*
|
|
143
|
+
* search glyph becomes a back arrow in its slot (the field never moves); Backspace on an empty field calls it —
|
|
125
144
|
* instead of a "← All" row that scrolls away with the list
|
|
126
145
|
* @param {string} [backLabel] the arrow's tooltip (default `Back`) — name where it goes ("All modules")
|
|
127
146
|
* @param {string} [selectLabel] the footer's Enter line while a row is highlighted (default
|
|
@@ -163,13 +182,16 @@ export default function CommandOverlay({
|
|
|
163
182
|
/* Has the user actually chosen a row? See the Enter branch — without this,
|
|
164
183
|
* index 0 counts as a selection and Enter navigates somewhere unasked. */
|
|
165
184
|
const [navigated, setNavigated] = useState(false)
|
|
166
|
-
/* the
|
|
167
|
-
const [
|
|
185
|
+
/* the fold rows' open categories */
|
|
186
|
+
const [opened, setOpened] = useState(() => new Set())
|
|
187
|
+
const toggle = (c, on) => setOpened((o) => { const n = new Set(o); (on ?? !n.has(c)) ? n.add(c) : n.delete(c); return n })
|
|
168
188
|
const noField = mode === 'shortcuts'
|
|
169
|
-
const back =
|
|
189
|
+
const back = onBack
|
|
190
|
+
if (mode === 'go') mode = 'search'
|
|
170
191
|
const placeholder = placeholderProp ?? MODE_PLACEHOLDER[mode] ?? 'Search…'
|
|
171
192
|
const selectLabel = selectLabelProp ?? MODE_LABEL[mode] ?? 'Go to page'
|
|
172
|
-
const
|
|
193
|
+
const base = mode === 'shortcuts' ? shortcutFolds(shortcuts, currentPath) : groupRows(query ? rawResults : suggestions)
|
|
194
|
+
const results = unfold(base, opened)
|
|
173
195
|
/* a `disabled` row is drawn but never active: ↑↓ step over it, Enter and click never reach
|
|
174
196
|
* `onSelect` (ShellSearchDisabledRow, kol-monitor 2026-10-15 — a module with no room on the rack) */
|
|
175
197
|
const clamped = Math.min(activeIndex, results.length - 1)
|
|
@@ -186,14 +208,16 @@ export default function CommandOverlay({
|
|
|
186
208
|
if (!open) return undefined
|
|
187
209
|
const prev = document.activeElement
|
|
188
210
|
;(panelRef.current?.querySelector('input') ?? panelRef.current)?.focus()
|
|
189
|
-
|
|
211
|
+
setOpened(new Set(base.filter((r) => r.items && r.open).map((r) => r.id)))
|
|
212
|
+
return () => { setOpened(new Set()); if (prev instanceof HTMLElement) prev.focus() }
|
|
190
213
|
}, [open])
|
|
191
214
|
|
|
192
215
|
/* Roving row resets to the top on every query change / reopen — and when the ROWS change under an
|
|
193
216
|
* unchanged query (ShellSearchOverlayActionKeepsOpen, kol-fxr 2026-10-13: a drill-in swaps the
|
|
194
217
|
* suggestions for a category's presets). Keyed on the row ids, not the array's identity, so a
|
|
195
218
|
* consumer passing a fresh array every render does not snap the highlight back to the top. */
|
|
196
|
-
|
|
219
|
+
/* the BASE rows, not the unfolded ones: opening a category must not throw the highlight back to the top */
|
|
220
|
+
const rowsKey = base.map((r) => r.id).join('\u0000')
|
|
197
221
|
useEffect(() => { setActiveIndex(Math.max(0, results.findIndex((r) => !r.disabled))); setNavigated(false) }, [query, open, rowsKey]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
198
222
|
|
|
199
223
|
/* Keep the active row visible inside the scrolling list. */
|
|
@@ -210,13 +234,23 @@ export default function CommandOverlay({
|
|
|
210
234
|
* it too would fire it twice in every shell that already does (workshop's tag rows). */
|
|
211
235
|
const select = (item) => {
|
|
212
236
|
if (item?.disabled) return
|
|
213
|
-
if (
|
|
237
|
+
if (item?.fold) { toggle(item.id); return }
|
|
238
|
+
/* a key is never run: Enter on one folds its category back up, the highlight on the category */
|
|
239
|
+
if (mode === 'shortcuts') {
|
|
240
|
+
if (item?.of != null) { toggle(item.of, false); setActiveIndex(results.findIndex((x) => x.id === item.of)) }
|
|
241
|
+
return
|
|
242
|
+
}
|
|
214
243
|
onSelect?.(item)
|
|
215
244
|
if (!(item?.keepOpen || typeof item?.action === 'function')) onClose?.()
|
|
216
245
|
}
|
|
217
246
|
|
|
218
247
|
const optionId = (item) => `${listId}-${item.id}`
|
|
219
248
|
|
|
249
|
+
/* EXPAND / COLLAPSE ALL (user 2026-10-18: *"needs a expand/collapse all shortcut next to expand in the bottom"*) */
|
|
250
|
+
const folds = base.filter((r) => Array.isArray(r.items))
|
|
251
|
+
const allOpen = folds.length > 0 && folds.every((r) => opened.has(r.id))
|
|
252
|
+
const toggleAll = () => setOpened(allOpen ? new Set() : new Set(folds.map((r) => r.id)))
|
|
253
|
+
|
|
220
254
|
const handleKeyDown = (e) => {
|
|
221
255
|
if (e.key === 'Backspace' && !query && back) {
|
|
222
256
|
e.preventDefault()
|
|
@@ -224,6 +258,13 @@ export default function CommandOverlay({
|
|
|
224
258
|
} else if (e.key === 'ArrowLeft' && !query && back) {
|
|
225
259
|
e.preventDefault()
|
|
226
260
|
back()
|
|
261
|
+
} else if (!query && (e.key === 'ArrowRight' || e.key === 'ArrowLeft') && active >= 0 && (results[active].fold || results[active].of != null)) {
|
|
262
|
+
/* fold rows: → opens the highlighted category, ← closes it (from a child row, its own category) */
|
|
263
|
+
e.preventDefault()
|
|
264
|
+
const r = results[active]
|
|
265
|
+
const c = r.fold ? r.id : r.of
|
|
266
|
+
if (e.key === 'ArrowRight' && r.fold) toggle(c, true)
|
|
267
|
+
if (e.key === 'ArrowLeft') { toggle(c, false); if (!r.fold) setActiveIndex(results.findIndex((x) => x.id === c)) }
|
|
227
268
|
} else if (e.key === 'ArrowRight' && !query && active >= 0 && results[active]?.keepOpen) {
|
|
228
269
|
e.preventDefault()
|
|
229
270
|
select(results[active])
|
|
@@ -243,6 +284,8 @@ export default function CommandOverlay({
|
|
|
243
284
|
/* ⌘ENTER OPENS EVERY HIT (user 2026-09-30: *"enter would focus searched item, and maybe
|
|
244
285
|
* command enter would open the results page"*) — only where the consumer has a place for them. */
|
|
245
286
|
if ((e.metaKey || e.ctrlKey) && onOpenResults && query) { onOpenResults(query); onClose?.(); return }
|
|
287
|
+
/* ⌘ENTER ON FOLDS opens every category, or closes them all when all are open */
|
|
288
|
+
if ((e.metaKey || e.ctrlKey) && folds.length) { toggleAll(); return }
|
|
246
289
|
/* ENTER OPENS THE HIGHLIGHTED ROW (user 2026-10-01: *"I think enter should also take you to
|
|
247
290
|
* the atom but something like command enter take you to the index"* — reverses the
|
|
248
291
|
* 2026-08-01 "Enter commits, it only selects once you have arrowed"). The top row is drawn
|
|
@@ -294,25 +337,23 @@ export default function CommandOverlay({
|
|
|
294
337
|
)}
|
|
295
338
|
{/* A REAL FIELD, inset in the panel (2026-09-30, shadcn's search modal as
|
|
296
339
|
* the aim) — the flush `bare` strip read as a hole, not a control. */}
|
|
297
|
-
{
|
|
340
|
+
{!noField && (
|
|
298
341
|
<div className="kol-tone-grey p-2 flex items-center gap-2">
|
|
299
|
-
{back
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
<Button iconOnly="arrow-left" tone="ghost" size="md" aria-label={noField ? 'Shortcuts' : backLabel} onMouseDown={(e) => e.preventDefault()} onClick={back} />
|
|
303
|
-
</Tooltip>
|
|
304
|
-
)}
|
|
305
|
-
{!noField && <SearchInput
|
|
342
|
+
{/* THE BACK ARROW TAKES THE SEARCH GLYPH'S SLOT (user 2026-10-18: *"why would the back move the input?!"*) —
|
|
343
|
+
* a button beside the field shrank it and shifted the caret on every drill-in */}
|
|
344
|
+
<SearchInput
|
|
306
345
|
className="w-full min-w-0 flex-1"
|
|
307
346
|
value={query}
|
|
308
347
|
onChange={(e) => onQueryChange?.(e.target.value)}
|
|
309
348
|
placeholder={chips.length > 0 ? 'Narrow these results…' : placeholder}
|
|
310
349
|
onKeyDown={handleKeyDown}
|
|
350
|
+
onBack={back}
|
|
351
|
+
backLabel={backLabel}
|
|
311
352
|
role="combobox"
|
|
312
353
|
aria-expanded={results.length > 0}
|
|
313
354
|
aria-controls={listId}
|
|
314
355
|
aria-activedescendant={active >= 0 ? optionId(results[active]) : undefined}
|
|
315
|
-
/>
|
|
356
|
+
/>
|
|
316
357
|
</div>
|
|
317
358
|
)}
|
|
318
359
|
|
|
@@ -344,14 +385,15 @@ export default function CommandOverlay({
|
|
|
344
385
|
ref={listRef}
|
|
345
386
|
id={listId}
|
|
346
387
|
role="listbox"
|
|
347
|
-
className={`kol-tone-grey h-80 overflow-y-auto px-2 pb-2${noField
|
|
388
|
+
className={`kol-tone-grey h-80 overflow-y-auto px-2 pb-2${noField ? ' pt-2' : ''}`}
|
|
348
389
|
>
|
|
349
390
|
{results.map((item, i) => {
|
|
350
391
|
const heading = (item.group ?? '') !== (results[i - 1]?.group ?? '') || i === 0
|
|
351
392
|
return (
|
|
352
393
|
<li key={item.id} role="presentation">
|
|
353
394
|
{heading && item.group && (
|
|
354
|
-
|
|
395
|
+
/* the rail's eyebrow (user 2026-10-18: *"sections shoudl be uppercase eyebrow like in siderail"*) */
|
|
396
|
+
<p className="kol-eyebrow text-fg-80 px-4 border-x border-transparent pt-3 pb-2">{item.group}</p>
|
|
355
397
|
)}
|
|
356
398
|
<OptionRow
|
|
357
399
|
id={optionId(item)}
|
|
@@ -361,6 +403,8 @@ export default function CommandOverlay({
|
|
|
361
403
|
active={i === active}
|
|
362
404
|
disabled={item.disabled}
|
|
363
405
|
icon={item.icon}
|
|
406
|
+
/* a fold's key row sits under its category's label, past the chevron */
|
|
407
|
+
leading={item.indent ? <span className="inline-block w-4" /> : undefined}
|
|
364
408
|
label={<HighlightMatch label={item.label} query={query} ranges={item.highlights} />}
|
|
365
409
|
hint={(item.disabled && item.disabledHint) || item.hint}
|
|
366
410
|
/* preventDefault keeps focus in the input through the click */
|
|
@@ -374,14 +418,29 @@ export default function CommandOverlay({
|
|
|
374
418
|
</ul>
|
|
375
419
|
)}
|
|
376
420
|
{/* THE FOOTER SAYS WHAT ENTER DOES — always, not only once typing. */}
|
|
377
|
-
{!expanded &&
|
|
421
|
+
{!expanded && (results.length > 0 || (query && (enterLabel || onOpenResults))) && (
|
|
378
422
|
<div className="border-t border-fg-08 py-2">
|
|
379
423
|
{/* Enter's line names what Enter does NOW: a row is highlighted → it opens that row;
|
|
380
424
|
* no rows → it commits the query. */}
|
|
381
425
|
{(results.length > 0 || enterLabel) && (
|
|
382
|
-
|
|
426
|
+
/* 44px on touch — a finger-sized line */
|
|
427
|
+
<p className="flex items-center gap-2 kol-helper-12 text-fg-48 mx-2 px-4 border-x border-transparent pointer-coarse:min-h-11">
|
|
383
428
|
<Kbd icon="corner-down-left" />
|
|
384
|
-
{results.length > 0
|
|
429
|
+
{results.length > 0
|
|
430
|
+
? (results[active]?.fold ? (opened.has(results[active].id) ? 'Collapse' : 'Expand') : noField ? 'Collapse' : selectLabel)
|
|
431
|
+
: enterLabel}
|
|
432
|
+
{/* the second action on the same line, right — ⌘↵, the footer's idiom for "the other one" */}
|
|
433
|
+
{folds.length > 0 && !query && (
|
|
434
|
+
<button
|
|
435
|
+
type="button"
|
|
436
|
+
className="ml-auto flex items-center gap-2 text-fg-48 hover:text-fg-default transition-colors cursor-pointer"
|
|
437
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
438
|
+
onClick={toggleAll}
|
|
439
|
+
>
|
|
440
|
+
<Kbd icon="command"><Icon name="corner-down-left" size={12} /></Kbd>
|
|
441
|
+
{allOpen ? 'Collapse all' : 'Expand all'}
|
|
442
|
+
</button>
|
|
443
|
+
)}
|
|
385
444
|
</p>
|
|
386
445
|
)}
|
|
387
446
|
{/* THE RESULTS LINE IS A LINK (user 2026-10-01: *"make 'all results...' at the bottom
|
|
@@ -770,7 +770,7 @@ export function mediaSettingsSections({ settings, onChange, profile }) {
|
|
|
770
770
|
* composition the user locked 2026-08-27), drawn from `mediaSettingsSections`. */
|
|
771
771
|
function MediaSettings({ settings, onChange, onReset, onClose, profile, settingsFooter }) {
|
|
772
772
|
return (
|
|
773
|
-
<SettingsPanel variant="
|
|
773
|
+
<SettingsPanel variant="rail" title="Display settings" onClose={onClose} footer={<SettingsFooter onReset={onReset} resetLabel="Reset preferences">{settingsFooter}</SettingsFooter>}>
|
|
774
774
|
<SettingsSections sections={mediaSettingsSections({ settings, onChange, profile })} divided />
|
|
775
775
|
</SettingsPanel>
|
|
776
776
|
)
|
|
@@ -862,7 +862,7 @@ function TrashPanel({ trash, onClose, run, confirm }) {
|
|
|
862
862
|
run(async () => { for (const id of ids) await trash.purge(id); setSel(new Set()) })
|
|
863
863
|
}
|
|
864
864
|
return (
|
|
865
|
-
<SettingsPanel variant="
|
|
865
|
+
<SettingsPanel variant="rail" title="Trash" onClose={onClose}
|
|
866
866
|
footer={items.length > 0 && trash.empty ? (
|
|
867
867
|
<SettingsFooter>
|
|
868
868
|
<Button tone="primary" size="sm" onClick={async () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Button from '../atoms/Button.jsx'
|
|
2
2
|
import Dropdown from '../molecules/Dropdown.jsx'
|
|
3
|
+
import CloseButton from '../atoms/CloseButton.jsx'
|
|
3
4
|
import Divider from '../atoms/Divider.jsx'
|
|
4
5
|
import IconFrame from '../atoms/IconFrame.jsx'
|
|
5
6
|
import LabeledControl from '../molecules/LabeledControl.jsx'
|
|
@@ -14,10 +15,10 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
14
15
|
* overlay), never a route (SettingsPanel, kol-r2b2 2026-08-26 — the
|
|
15
16
|
* per-bucket display settings: kinds allow-list, structure, loading, layout).
|
|
16
17
|
*
|
|
17
|
-
* TWO PRESENTATIONS, ONE ANATOMY (the user's ask): `variant="
|
|
18
|
-
* right-anchored
|
|
18
|
+
* TWO PRESENTATIONS, ONE ANATOMY (the user's ask): `variant="rail"` is a
|
|
19
|
+
* right-anchored rail over a scrim, `variant="overlay"` the same content
|
|
19
20
|
* centred. Only the shell differs; header · intro · sections · footer are the
|
|
20
|
-
* same nodes in both. Neither shell is built here — the
|
|
21
|
+
* same nodes in both. Neither shell is built here — the rail IS `Rail`
|
|
21
22
|
* (scrim, Escape, focus trap, scroll lock, focus return, the × control) and
|
|
22
23
|
* the overlay IS FullscreenOverlay (scrim, Escape, backdrop dismiss, scroll
|
|
23
24
|
* lock, the corner ×). The source had none of that: scrim click was the only
|
|
@@ -35,8 +36,9 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
35
36
|
*
|
|
36
37
|
* @param {boolean} open mounted and shown (default true — the parent
|
|
37
38
|
* usually conditionally renders it)
|
|
38
|
-
* @param {'
|
|
39
|
-
*
|
|
39
|
+
* @param {'rail'|'overlay'} variant presentation — `rail` (default) or `overlay`, the only two names (user 2026-10-18);
|
|
40
|
+
* `drawer` is the old name of `rail`, still accepted
|
|
41
|
+
* @param {number|string} width width (default 380 for the rail, the ⌘K overlay's 32rem for the overlay)
|
|
40
42
|
* @param {string} title header line 1
|
|
41
43
|
* @param {string} subtitle header line 2 (the approved drawer passes none)
|
|
42
44
|
* @param {string} intro a note under the header (the approved drawer passes none)
|
|
@@ -46,8 +48,8 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
46
48
|
*/
|
|
47
49
|
export default function SettingsPanel({
|
|
48
50
|
open = true,
|
|
49
|
-
variant = '
|
|
50
|
-
width
|
|
51
|
+
variant = 'rail',
|
|
52
|
+
width: widthProp,
|
|
51
53
|
title,
|
|
52
54
|
subtitle,
|
|
53
55
|
intro,
|
|
@@ -76,22 +78,27 @@ export default function SettingsPanel({
|
|
|
76
78
|
|
|
77
79
|
if (variant === 'overlay') {
|
|
78
80
|
if (!open) return null
|
|
81
|
+
/* THE DRAWER'S ANATOMY IN A CENTRED PANEL (user 2026-10-18: *"wrong width wrong close placement, header is
|
|
82
|
+
* bullshit"*): the ⌘K overlay's width, the × on the header's own line as the rail has it, a Divider under the
|
|
83
|
+
* header — it was 380 wide with the × floating in a lane above the title and nothing under the header */
|
|
84
|
+
const width = widthProp ?? 'min(32rem, calc(100vw - 32px))'
|
|
79
85
|
return (
|
|
80
|
-
<FullscreenOverlay open onClose={onClose}>
|
|
81
|
-
{/* the corner × rides the sheet at --kol-spacing-3; the panel reserves
|
|
82
|
-
* that lane on top (the .kol-media-picker precedent) instead of the
|
|
83
|
-
* control moving */}
|
|
86
|
+
<FullscreenOverlay open scrim closeButton={false} onClose={onClose}>
|
|
84
87
|
<div
|
|
85
|
-
className={`kol-overlay-panel flex flex-col
|
|
88
|
+
className={`kol-overlay-panel flex flex-col p-[var(--kol-pad-overlay)] ${className}`}
|
|
86
89
|
style={{ width: typeof width === 'number' ? `${width}px` : width, maxWidth: '100%', maxHeight: '85vh', overflowY: 'auto' }}
|
|
87
90
|
>
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
<div className="mb-6 flex items-center gap-4">
|
|
92
|
+
<div className="min-w-0 flex-1">{header}</div>
|
|
93
|
+
<CloseButton onClick={onClose} className="shrink-0" />
|
|
94
|
+
</div>
|
|
95
|
+
<div className="flex flex-col gap-4"><Divider />{body}</div>
|
|
90
96
|
</div>
|
|
91
97
|
</FullscreenOverlay>
|
|
92
98
|
)
|
|
93
99
|
}
|
|
94
100
|
|
|
101
|
+
const width = widthProp ?? 380
|
|
95
102
|
return (
|
|
96
103
|
/* THE APPROVED DRAWER (SettingsPanelApproved, kol-r2b2 2026-08-27 — user: "LOCK
|
|
97
104
|
THIS"): no edge, no shadow, a Divider under the header, the sections.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import SettingsSections from './SettingsSections.jsx'
|
|
1
|
+
import SettingsPanel, { LabeledControlSection, SettingsRow } from './SettingsPanel.jsx'
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* ShortcutsOverlay — The keyboard shortcut sheet. the keyboard-shortcut sheet: blurred scrim, centred
|
|
@@ -41,6 +40,7 @@ import SettingsSections from './SettingsSections.jsx'
|
|
|
41
40
|
*
|
|
42
41
|
* @param {Array} props.shortcuts - `[{ label, combo }]` or `[{ section, items: [{ id, label, combo }] }]` — the same array `SettingsShortcuts` takes (ShellHomeSystemMonitorGaps, kol-monitor 2026-08-27: the overlay read `keys` while the settings block read `combo`; `combo` is the name, `keys` is tolerated for a release)
|
|
43
42
|
* @param {Function} props.onClose
|
|
43
|
+
* @param {string} [props.title] the header, beside the × (default `Shortcuts`)
|
|
44
44
|
* @param {string} [props.currentPath] sections may carry `routes: ['/rack']` (CommandOverlayModes, kol-monitor
|
|
45
45
|
* 2026-10-17 — user: *"im in dev, how can I cable lock here?"*): with a path, only the sections that work here
|
|
46
46
|
* are drawn (ShortcutsOverlayList, kol-monitor 2026-10-18 — the muted ELSEWHERE block is gone). A section without `routes`
|
|
@@ -53,61 +53,25 @@ export const shortcutInScope = (section, path) => !section?.routes?.length || pa
|
|
|
53
53
|
|
|
54
54
|
const isSectioned = (list) => Array.isArray(list?.[0]?.items)
|
|
55
55
|
|
|
56
|
-
/*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
align: 'fill',
|
|
64
|
-
labelWidth: 'auto',
|
|
65
|
-
value: <span className="text-fg-32 kol-helper-12 sm:whitespace-nowrap">{combo ?? keys}</span>,
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
export default function ShortcutsOverlay({ shortcuts = [], onClose, currentPath }) {
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
const onKey = (e) => { if (e.key === 'Escape') onClose?.() }
|
|
71
|
-
window.addEventListener('keydown', onKey)
|
|
72
|
-
return () => window.removeEventListener('keydown', onKey)
|
|
73
|
-
}, [onClose])
|
|
74
|
-
|
|
75
|
-
const sectioned = isSectioned(shortcuts)
|
|
76
|
-
const here = sectioned ? shortcuts.filter((s) => shortcutInScope(s, currentPath)) : []
|
|
77
|
-
|
|
56
|
+
/* ONE OVERLAY, NOT TWO (user 2026-10-18, retiring the near-copy): the sheet is `SettingsPanel variant="overlay"` —
|
|
57
|
+
* the title on the header with the × beside it, a Divider, then the sections exactly as monitor's ⇧S rail draws
|
|
58
|
+
* them (LabeledControlSection divided · SettingsRow text · the combo in mono). Same props as before, plus `title`. */
|
|
59
|
+
export default function ShortcutsOverlay({ shortcuts = [], onClose, currentPath, title = 'Shortcuts' }) {
|
|
60
|
+
const sections = isSectioned(shortcuts)
|
|
61
|
+
? shortcuts.filter((s) => shortcutInScope(s, currentPath))
|
|
62
|
+
: [{ items: shortcuts }]
|
|
78
63
|
return (
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
brightest edge on screen. The OPAQUE ramp is right here: the sheet
|
|
92
|
-
must not let the canvas through, and `oq-04` is a 4 % lift off the
|
|
93
|
-
ground rather than a surface from the page's own ladder — so the
|
|
94
|
-
panel separates from the scrimmed canvas without a stroke. */}
|
|
95
|
-
<div
|
|
96
|
-
/* THE SHEET FITS THE WINDOW (editor review #4, 2026-09-27): a long keymap — the design
|
|
97
|
-
* editor's is six sections — ran past both edges of the viewport with no way to reach the
|
|
98
|
-
* rest. Capped to the window less a margin, scrolling inside. */
|
|
99
|
-
className="kol-shortcuts-panel text-fg-64 kol-helper-12 bg-oq-04 flex flex-col gap-6 overflow-y-auto"
|
|
100
|
-
/* and the window's WIDTH too (apps review, 2026-09-29): nothing capped it, so the widest
|
|
101
|
-
* row set the sheet's width and a phone showed its middle third */
|
|
102
|
-
style={{ padding: 24, borderRadius: 4, maxHeight: 'calc(100dvh - 48px)', maxWidth: 'calc(100vw - 32px)' }}
|
|
103
|
-
onClick={(e) => e.stopPropagation()}
|
|
104
|
-
>
|
|
105
|
-
<SettingsSections
|
|
106
|
-
sections={sectioned
|
|
107
|
-
? here.map(({ section, items = [] }) => ({ label: section, rowGap: 1, rows: items.map(toRow) }))
|
|
108
|
-
: [{ rowGap: 1, rows: shortcuts.map(toRow) }]}
|
|
109
|
-
/>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
64
|
+
<SettingsPanel open variant="overlay" title={title} onClose={onClose}>
|
|
65
|
+
{sections.map((sec, n) => (
|
|
66
|
+
<LabeledControlSection key={sec.section ?? n} label={sec.section} divided rowGap={1}>
|
|
67
|
+
{(sec.items ?? []).map((it, i) => (
|
|
68
|
+
/* the index keeps two keys with one label apart (monitor's Pointer has two "Pan") */
|
|
69
|
+
<SettingsRow key={it.id ?? `${i}:${it.label}`} label={it.label} text>
|
|
70
|
+
<span className="kol-mono-12 text-fg-80">{it.combo ?? it.keys}</span>
|
|
71
|
+
</SettingsRow>
|
|
72
|
+
))}
|
|
73
|
+
</LabeledControlSection>
|
|
74
|
+
))}
|
|
75
|
+
</SettingsPanel>
|
|
112
76
|
)
|
|
113
77
|
}
|