@kolkrabbi/kol-component 0.273.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.273.0",
3
+ "version": "0.274.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -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 close · ‹ › n / N · the file's name · its facts · the kind's actions, right-aligned
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>
@@ -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 px-4 py-4 md:px-5 lg:px-6">
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(1rem + env(safe-area-inset-bottom, 0px))' } : { paddingTop: 'calc(1rem + env(safe-area-inset-top, 0px))' }) }
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 px-4 py-4 outline-none md:px-5 lg:px-6 ${backdrop && shadow ? 'shadow-2xl' : ''} ${place} border-oq-08 ${motionPanel} ${className}`}
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}
@@ -62,25 +62,46 @@ export function HighlightMatch({ label, query, ranges }) {
62
62
  /* THE MODES (CommandOverlayModes, kol-monitor 2026-10-17 — user: *"can we make the modal more general then just
63
63
  * search? … add module would be another, shortcuts could be a third"*). One field, one grouped list, one footer;
64
64
  * the mode only sets the footer's words and, for `shortcuts`, where the rows come from. */
65
- const MODE_LABEL = { search: 'Go to page', go: 'Go to page', add: 'Add', shortcuts: 'Open' }
66
- const MODE_PLACEHOLDER = { search: 'Search…', go: 'Go to…', add: 'Add…', shortcuts: 'Search shortcuts…' }
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…' }
67
68
 
68
- /* THE KEYMAP AS CATEGORIES (ShortcutsOverlayCategories, kol-monitor 2026-10-18 — user: *"we are using the fucking
69
- * command overlay WITHOUT THE SEARHC INPUT, we are using the CATEGORIES"*): this page's sections (plus those with no
70
- * `routes`) as rows under "Shortcuts"; a picked section drills in to its keys — label left, combo right, never run. */
71
- function shortcutRows(shortcuts, path, cat) {
72
- const here = shortcuts.filter((s) => shortcutInScope(s, path))
73
- const sec = cat != null && here.find((s) => s.section === cat)
74
- if (!sec) return here.map((s) => ({ id: `cat:${s.section}`, label: s.section, icon: 'arrow-right', group: 'Shortcuts', keepOpen: true, cat: s.section }))
75
- return (sec.items ?? []).map((it) => ({ id: `${sec.section}:${it.id ?? it.label}`, label: it.label, hint: it.combo ?? it.keys, group: sec.section }))
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
+ })
76
93
  }
77
94
 
78
95
  /**
79
96
  * CommandOverlay — The ⌘K overlay: search, add, go, shortcuts. Was `ShellSearchOverlay` (still exported, an
80
- * alias). `mode` names what the overlay is for — `search` (default) · `go` · `add` · `shortcuts`. In
81
- * `shortcuts` it draws `shortcuts` (the AppHub keymap) with NO field: the current page's sections as category rows under
82
- * "Shortcuts"; Enter / → / click enters one, its keys listed (label · combo, never run); ← / Backspace / the back
83
- * arrow returns. AppHub's `S` opens this (ShortcutsOverlayCategories, 2026-10-18).
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.
84
105
  *
85
106
  * ARROWS (2026-10-17 — user: *"arrows up down can focus category and arrows left right can enter and back,
86
107
  * along with enter key"*): ↑↓ move through rows; → or Enter opens a category (a `keepOpen` row); ← goes back
@@ -161,13 +182,16 @@ export default function CommandOverlay({
161
182
  /* Has the user actually chosen a row? See the Enter branch — without this,
162
183
  * index 0 counts as a selection and Enter navigates somewhere unasked. */
163
184
  const [navigated, setNavigated] = useState(false)
164
- /* the shortcuts mode's drill-in — the category entered, or null for the category list */
165
- const [cat, setCat] = useState(null)
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 })
166
188
  const noField = mode === 'shortcuts'
167
- const back = noField ? (cat != null ? () => setCat(null) : undefined) : onBack
189
+ const back = onBack
190
+ if (mode === 'go') mode = 'search'
168
191
  const placeholder = placeholderProp ?? MODE_PLACEHOLDER[mode] ?? 'Search…'
169
192
  const selectLabel = selectLabelProp ?? MODE_LABEL[mode] ?? 'Go to page'
170
- const results = mode === 'shortcuts' ? shortcutRows(shortcuts, currentPath, cat) : groupRows(query ? rawResults : suggestions)
193
+ const base = mode === 'shortcuts' ? shortcutFolds(shortcuts, currentPath) : groupRows(query ? rawResults : suggestions)
194
+ const results = unfold(base, opened)
171
195
  /* a `disabled` row is drawn but never active: ↑↓ step over it, Enter and click never reach
172
196
  * `onSelect` (ShellSearchDisabledRow, kol-monitor 2026-10-15 — a module with no room on the rack) */
173
197
  const clamped = Math.min(activeIndex, results.length - 1)
@@ -184,14 +208,16 @@ export default function CommandOverlay({
184
208
  if (!open) return undefined
185
209
  const prev = document.activeElement
186
210
  ;(panelRef.current?.querySelector('input') ?? panelRef.current)?.focus()
187
- return () => { setCat(null); if (prev instanceof HTMLElement) prev.focus() }
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() }
188
213
  }, [open])
189
214
 
190
215
  /* Roving row resets to the top on every query change / reopen — and when the ROWS change under an
191
216
  * unchanged query (ShellSearchOverlayActionKeepsOpen, kol-fxr 2026-10-13: a drill-in swaps the
192
217
  * suggestions for a category's presets). Keyed on the row ids, not the array's identity, so a
193
218
  * consumer passing a fresh array every render does not snap the highlight back to the top. */
194
- const rowsKey = results.map((r) => r.id).join('\u0000')
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')
195
221
  useEffect(() => { setActiveIndex(Math.max(0, results.findIndex((r) => !r.disabled))); setNavigated(false) }, [query, open, rowsKey]) // eslint-disable-line react-hooks/exhaustive-deps
196
222
 
197
223
  /* Keep the active row visible inside the scrolling list. */
@@ -208,13 +234,23 @@ export default function CommandOverlay({
208
234
  * it too would fire it twice in every shell that already does (workshop's tag rows). */
209
235
  const select = (item) => {
210
236
  if (item?.disabled) return
211
- if (mode === 'shortcuts') { if (item?.cat != null) setCat(item.cat); return }
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
+ }
212
243
  onSelect?.(item)
213
244
  if (!(item?.keepOpen || typeof item?.action === 'function')) onClose?.()
214
245
  }
215
246
 
216
247
  const optionId = (item) => `${listId}-${item.id}`
217
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
+
218
254
  const handleKeyDown = (e) => {
219
255
  if (e.key === 'Backspace' && !query && back) {
220
256
  e.preventDefault()
@@ -222,6 +258,13 @@ export default function CommandOverlay({
222
258
  } else if (e.key === 'ArrowLeft' && !query && back) {
223
259
  e.preventDefault()
224
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)) }
225
268
  } else if (e.key === 'ArrowRight' && !query && active >= 0 && results[active]?.keepOpen) {
226
269
  e.preventDefault()
227
270
  select(results[active])
@@ -241,6 +284,8 @@ export default function CommandOverlay({
241
284
  /* ⌘ENTER OPENS EVERY HIT (user 2026-09-30: *"enter would focus searched item, and maybe
242
285
  * command enter would open the results page"*) — only where the consumer has a place for them. */
243
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 }
244
289
  /* ENTER OPENS THE HIGHLIGHTED ROW (user 2026-10-01: *"I think enter should also take you to
245
290
  * the atom but something like command enter take you to the index"* — reverses the
246
291
  * 2026-08-01 "Enter commits, it only selects once you have arrowed"). The top row is drawn
@@ -346,15 +391,10 @@ export default function CommandOverlay({
346
391
  const heading = (item.group ?? '') !== (results[i - 1]?.group ?? '') || i === 0
347
392
  return (
348
393
  <li key={item.id} role="presentation">
349
- {heading && item.group && (noField && back && i === 0 ? (
350
- /* shortcuts' second layer: the arrow leads the category's own heading — nothing moves */
351
- <button type="button" aria-label="Shortcuts" onMouseDown={(e) => e.preventDefault()} onClick={back}
352
- className="kol-helper-12 text-fg-48 hover:text-fg-80 transition-colors flex items-center gap-2 px-4 border-x border-transparent pt-3 pb-2 cursor-pointer">
353
- <Icon name="arrow-left" size={12} />{item.group}
354
- </button>
355
- ) : (
356
- <p className="kol-helper-12 text-fg-48 px-4 border-x border-transparent pt-3 pb-2">{item.group}</p>
357
- ))}
394
+ {heading && item.group && (
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>
397
+ )}
358
398
  <OptionRow
359
399
  id={optionId(item)}
360
400
  role="option"
@@ -363,6 +403,8 @@ export default function CommandOverlay({
363
403
  active={i === active}
364
404
  disabled={item.disabled}
365
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}
366
408
  label={<HighlightMatch label={item.label} query={query} ranges={item.highlights} />}
367
409
  hint={(item.disabled && item.disabledHint) || item.hint}
368
410
  /* preventDefault keeps focus in the input through the click */
@@ -376,14 +418,29 @@ export default function CommandOverlay({
376
418
  </ul>
377
419
  )}
378
420
  {/* THE FOOTER SAYS WHAT ENTER DOES — always, not only once typing. */}
379
- {!expanded && !(noField && cat != null) && (results.length > 0 || (query && (enterLabel || onOpenResults))) && (
421
+ {!expanded && (results.length > 0 || (query && (enterLabel || onOpenResults))) && (
380
422
  <div className="border-t border-fg-08 py-2">
381
423
  {/* Enter's line names what Enter does NOW: a row is highlighted → it opens that row;
382
424
  * no rows → it commits the query. */}
383
425
  {(results.length > 0 || enterLabel) && (
384
- <p className="flex items-center gap-2 kol-helper-12 text-fg-48 mx-2 px-4 border-x border-transparent">
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">
385
428
  <Kbd icon="corner-down-left" />
386
- {results.length > 0 ? selectLabel : enterLabel}
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
+ )}
387
444
  </p>
388
445
  )}
389
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="drawer" title="Display settings" onClose={onClose} footer={<SettingsFooter onReset={onReset} resetLabel="Reset preferences">{settingsFooter}</SettingsFooter>}>
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="drawer" title="Trash" onClose={onClose}
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="drawer"` is a
18
- * right-anchored sheet over a scrim, `variant="overlay"` the same panel
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 drawer IS ShellDrawer
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 {'drawer'|'overlay'} variant presentation
39
- * @param {number|string} width panel width (default 380)
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 = 'drawer',
50
- width = 380,
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 gap-4 p-6 pt-12 ${className}`}
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
- {header}
89
- {body}
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 { useEffect } from 'react'
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
- /* A shortcut as a settings ROW: the label on the left, the combo as the row's
57
- * value. `labelWidth="auto"` makes the label yield and the combo hug. A combo
58
- * holds on one line from `sm` up; below it, it wraps under its label (LabeledControl stacks) — media's
59
- * combos are sentences ("Drag from empty space (rows: …"), and held on one line
60
- * they pushed the sheet past both edges of a phone (apps review, 2026-09-29). */
61
- const toRow = ({ label, combo, keys }) => ({
62
- label,
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
- <div
80
- onClick={onClose}
81
- /* THE scrim (overlay-scrim-outliers, kol-client-olina 2026-09-03; user: "we
82
- removed the blur and put just color on the background … we missed this").
83
- This drew its own — an 8 % inverse wash plus a 2px blur — after the
84
- 2026-09-01 no-blur ruling and the one-tint-48 class. */
85
- className="fixed inset-0 select-none kol-overlay-scrim"
86
- style={{ display: 'grid', placeItems: 'center', zIndex: 'var(--kol-z-modal)' }}
87
- >
88
- {/* `bg-oq-04`, not `bg-surface-primary` (user, 2026-09-03: *"this is too
89
- bright"*). Over a near-black editor canvas the raised page surface
90
- reads as a lit slab, and an `fg-16` stroke on top of it was the
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
  }