@kolkrabbi/kol-component 0.388.0 → 0.390.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.
@@ -34,7 +34,9 @@ import { floatSurfaceClass } from '../utilities/tone.js'
34
34
  * keeps one line that scrolls sideways with no scrollbar, `.kol-scroll-fade--x` fading the clipped edge(s), and the
35
35
  * active tab scrolled into view when it changes — arrow keys included; `wrap` breaks the tabs onto a second line.
36
36
  * Every variant but `stacked`, which has its phone bar
37
- * @param {'underline'|'chip'|'text'|'stacked'|'kolbox'} [variant='underline'] `kolbox` (W31.2 batch 3): kolbox's tab track, see `TabsKolbox` below; takes `tabs`, `value`, `onChange`, `size` (sm, md) and `className` only.
37
+ * @param {'underline'|'chip'|'text'|'stacked'|'track'} [variant='underline'] `track` (kolbox's tabs, W31.2 batch 3; a plain variant
38
+ * since plan-2026-11-29-one-set-fold W3 run 2): the tab track, see `TabsTrack` below; takes `tabs`, `value`, `onChange`, `size`
39
+ * (sm, md) and `className` only. `kolbox` and `folio` are accepted and draw `track` (on the retirement ledger).
38
40
  * @param {string} [look] @deprecated 2026-10-30 — the old spelling of `variant`; `variant` wins when both are passed
39
41
  * @param {'mono'|'sans'|'mono-light'} [type='mono'] `underline` only: the tab's type — `mono-light` is `sans`'s row on JetBrains Mono at 300 (his word, 2026-10-30)
40
42
  * @param {boolean} [filled=false] - `chip` only: every chip shows at rest (Button `tab-filled`), so the row reads as choices
@@ -84,17 +86,19 @@ import { floatSurfaceClass } from '../utilities/tone.js'
84
86
  * Tabs are `{ id, label }` or `{ value, label }` (either key), plus `icon` for stacked; a stacked tab's `selected`
85
87
  * lights it whatever `value` is — action slots (the transport) light more than one.
86
88
  */
87
- /* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's Tabs carried class for class,
88
- * chrome in kol-theme `.kol-tabs--kolbox`. `size` sm (its default) the tab track: the kolbox control height (`--kol-kolbox-ctl`, 24) on the oq-16 field, radius 6,
89
- * 2 in, the tabs 1 apart at radius 4, 12 in, the current one oq-24 in the ink; md the top rail's mode track: 32 on the
90
- * ground (24 tabs, as every control; 36 until 2026-11-19, plan-2026-11-19 C9.1), radius 8, 4 in, the tabs touching, 8 in, the current one oq-16 with the accent label. Inter 12 / 16 / 500, the
91
- * rest oq-64, the ink on hover. Tabs are strings or `{ value, label, disabled, tooltip }`: a disabled tab is 40%, takes
92
- * no hover or focus and shows its `tooltip` in `Tooltip variant="kolbox"` (batch 4; the `tooltipComponent` seam is gone). In a track narrower than the labels and their padding the tabs share it
93
- * equally and the padding gives way. */
94
- function TabsKolbox({ tabs = [], value, onChange, size = 'sm', className = '', accent }) {
89
+ /* `variant="track"` (kolbox's Tabs, plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18; a plain variant since
90
+ * plan-2026-11-29-one-set-fold W3 run 2), chrome in kol-theme `.kol-tabs-track`, its look `--kol-tabs-track-*`. `size` sm
91
+ * (its default) the tab track: the control height on the track's fill, 2 in, the tabs 1 apart at radius 4, 12 in, the
92
+ * current one on the stronger fill in the ink; md the top rail's mode track: 32 on the ground, 4 in, the tabs touching, 8
93
+ * in. The UI text, the rest oq-64, the ink on hover. Tabs are strings or `{ value, label, disabled, tooltip }`: a disabled
94
+ * tab is 40%, takes no hover or focus and shows its `tooltip`. In a track narrower than the labels and their padding the
95
+ * tabs share it equally and the padding gives way. kolbox sets the fills, the type and the height
96
+ * (kol-components-molecules.css). `kol-tabs--kolbox-sm` stays on the sm box as a hook for kol-fxr's touch height
97
+ * (retirement ledger). */
98
+ function TabsTrack({ tabs = [], value, onChange, size = 'sm', className = '', accent }) {
95
99
  const md = size === 'md'
96
100
  return (
97
- <div data-accent={accent === 'secondary' ? accent : undefined} role="tablist" className={`kol-tabs--kolbox kol-tabs--kolbox-${md ? 'md' : 'sm'} inline-flex items-center ${md ? 'h-8 p-1' : 'h-(--kol-kolbox-ctl) gap-px p-0.5'} ${className}`}>
101
+ <div data-accent={accent === 'secondary' ? accent : undefined} role="tablist" className={`kol-tabs-track kol-tabs-track--${md ? 'md' : 'sm kol-tabs--kolbox-sm'} inline-flex items-center ${md ? 'h-8 p-1' : 'gap-px p-0.5'} ${className}`}>
98
102
  {tabs.map((t) => {
99
103
  const { value: v, label, disabled, tooltip } = typeof t === 'string' ? { value: t, label: t } : t
100
104
  const on = v === value
@@ -111,12 +115,15 @@ function TabsKolbox({ tabs = [], value, onChange, size = 'sm', className = '', a
111
115
  {label}
112
116
  </button>
113
117
  )
114
- return tooltip ? <span key={v} className="flex h-full flex-1 [&>span]:h-full [&>span]:flex-1 [&_button]:w-full">{<Tooltip variant="kolbox" label={tooltip}>{tab}</Tooltip>}</span> : tab
118
+ return tooltip ? <span key={v} className="flex h-full flex-1 [&>span]:h-full [&>span]:flex-1 [&_button]:w-full">{<Tooltip label={tooltip}>{tab}</Tooltip>}</span> : tab
115
119
  })}
116
120
  </div>
117
121
  )
118
122
  }
119
123
 
124
+ /* the old theme words: accepted, they draw `track` (W3 run 2, on the retirement ledger) */
125
+ const THEME_WORDS = ['kolbox', 'folio']
126
+
120
127
  export const TABBAR_H = 56
121
128
  /* the pill's height (W16, round 3 — fxr's live nav: was TABBAR_H) — a page under it owes TABBAR_PILL_H + TABBAR_PILL_INSET */
122
129
  export const TABBAR_PILL_H = 66
@@ -142,7 +149,7 @@ export const tabbarPillSlot = (at, { count, labels = false, split = false } = {}
142
149
  const COLLAPSE_MS = 300
143
150
 
144
151
  export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, variant, look: lookLegacy, type, trailing, filled = false, placement = 'inline', shape = 'bar', collapsed = false, onExpand, edge, border, shadow, dock, active, foldable, folded, onFoldChange, foldSide, foldTone, surface, split, labels, size, tracked = false, overflow = 'scroll', ariaLabel, className, style, accent }) {
145
- if (variant === 'kolbox') return <TabsKolbox tabs={raw} value={value} onChange={onChange} size={size} className={className} accent={accent} />
152
+ if (variant === 'track' || THEME_WORDS.includes(variant)) return <TabsTrack tabs={raw} value={value} onChange={onChange} size={size} className={className} accent={accent} />
146
153
  const tabs = raw.map((t) => ({ ...t, id: t.id ?? t.value }))
147
154
  const look = variant ?? lookLegacy ?? 'underline'
148
155
  const wrap = overflow === 'wrap'
@@ -9,15 +9,16 @@
9
9
  * @param {ReactNode} label
10
10
  * @param {boolean} [current]
11
11
  * @param {string} [href]
12
+ * @param {ElementType} [linkComponent] a router's Link for `href` (it gets `to`); default `a`
12
13
  * @param {Function} [onClick]
13
14
  * @param {string} [className]
14
15
  */
15
- export default function TocRow({ number, label, current = false, href, onClick, className = '' }) {
16
- const Tag = href ? 'a' : 'button'
16
+ export default function TocRow({ number, label, current = false, href, linkComponent, onClick, className = '' }) {
17
+ const Tag = href ? (linkComponent ?? 'a') : 'button'
17
18
  const n = typeof number === 'number' ? String(number).padStart(2, '0') : number
18
19
  return (
19
20
  <Tag
20
- {...(href ? { href } : { type: 'button' })}
21
+ {...(href ? (Tag === 'a' ? { href } : { to: href }) : { type: 'button' })}
21
22
  onClick={onClick}
22
23
  aria-current={current ? 'location' : undefined}
23
24
  className={`group flex h-8 w-full items-center gap-4 rounded-[var(--kol-float-list-r)] px-3 text-left no-underline cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${current ? 'bg-fg-12' : 'hover:bg-fg-04'} ${className}`.trim()}
@@ -6,7 +6,6 @@ import OptionRow from '../molecules/OptionRow.jsx'
6
6
  import { PopoverLayer } from '../utilities/Popover.jsx'
7
7
  import { IconLoader } from '@kolkrabbi/kol-icons'
8
8
  import SearchInput from '../molecules/SearchInput.jsx'
9
- import ModalShell from '../molecules/ModalShell.jsx'
10
9
  import Tag from '../atoms/Tag.jsx'
11
10
  import TabsRow from '../molecules/TabsRow.jsx'
12
11
  import { shortcutInScope } from './ShortcutsOverlay.jsx'
@@ -153,10 +152,10 @@ function unfold(rows, opened) {
153
152
  * @param {string} [selectLabel] the footer's Enter line while a row is highlighted (default
154
153
  * `Go to page`) — a modal whose rows are not pages says what
155
154
  * Enter does instead (the rack's module search: `Add module`)
156
- * @param {'default'|'kolbox'|'folio'} [variant='default'] the look. `folio`: Folio's search modal and command list (`mode`
157
- * search, commands), see `CommandOverlayFolio`. `default` is the KOL search modal (the overlay
158
- * panel on oq-04, the field in a grey tone, OptionRow rows, the Kbd footer), as it was
159
- * drawn up to 0.341.1.
155
+ * @param {Array} [groups] the grouped build instead (see `CommandOverlayGrouped`): the host keeps the rows and the
156
+ * lit row. Without it this build: the KOL search modal (the overlay panel, the field in a
157
+ * grey tone, OptionRow rows, the Kbd footer), as it was drawn up to 0.341.1.
158
+ * @param {'kolbox'|'folio'} [variant] the old theme words, accepted: they ask for the grouped build (W3, on the ledger).
160
159
  */
161
160
  function CommandOverlayDefault({
162
161
  open,
@@ -498,32 +497,30 @@ function CommandOverlayDefault({
498
497
  )
499
498
  }
500
499
 
501
- /* ── kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18) ─────────────────────────────────────────────────
502
- * kolbox's ModalSearch (round 3, 9.1; round 4, 14.1), carried from apps/kolbox/src/ui/ModalSearch.jsx: the panel 576 wide
503
- * (`--kol-kolbox-search-w`), radius 16, on the one floating surface, in PopoverLayer's body on the dim, 20% down. The
504
- * field (Input kolbox lg, the lens, the ⌘K mark while empty), the tabs, then the groups: a title and its rows (TreeRow
505
- * kolbox lg, touching, the active one lit, the hint at the right), then a rule and the foot (↑↓ Navigate, ↵ Run, Esc
506
- * Close). Presentational: the host passes the rows and keeps the state. CommandOverlay's words: `open`, `onClose`,
507
- * `query`, `onQueryChange`, `placeholder`, `tabs` [{ value, label }], `onSelect(row)` (kolbox's onRun), `mode` ('search',
508
- * or 'shortcuts': the real S sheet, the same panel with no field and no tabs, Enter folds a key's section back up and
509
- * never runs it). kolbox's own: `tab`, `onTab`, `groups` [{ title, rows: [{ id, icon, label, body, hint, kbd, disabled,
510
- * disabledHint, items, open }] }] (a row with `items` is a fold), `active` (an index into the rows in group order),
511
- * `onActive(index)`, `empty` (what can be searched, said when nothing is found:
512
- * plan-2026-11-19 C5.1b). Keys in the field: ↑↓ move the lit row over disabled rows,
513
- * Enter runs it, Tab and ⇧Tab step the tabs, → and ← open and close a fold while the field is empty, ⌘↵ all folds;
514
- * Escape is the layer's. */
515
- function MatchKolbox({ label, query }) {
500
+ /* ── grouped (kolbox's ModalSearch, plan-2026-11-18-kolbox-system W31.2 batch 5; one build since plan-2026-11-29-one-set-fold W3) ──
501
+ * The search modal the host draws from `groups`: the panel `--kol-command-w` wide (576), radius 12, on the one floating
502
+ * surface, in PopoverLayer's body on the dim, 20% down. The field (Input lg, the lens, the ⌘K mark while empty), the
503
+ * tabs (TabsRow track), then the groups: a title and its rows (TreeRow lg, touching, the active one lit, the hint at the
504
+ * right), then a rule and the foot (↑↓ Navigate, ↵ Run, Esc Close). Presentational: the host passes the rows and keeps the
505
+ * state. CommandOverlay's words: `open`, `onClose`, `query`, `onQueryChange`, `placeholder`, `tabs` [{ value, label }],
506
+ * `onSelect(row)`, `mode` ('search', or 'shortcuts': the S sheet, the same panel with no field and no tabs, Enter folds a
507
+ * key's section back up and never runs it). Its own: `tab`, `onTab`, `groups` [{ title, rows: [{ id, icon, label, body,
508
+ * hint, kbd, disabled, disabledHint, items, open }] }] (a row with `items` is a fold), `active` (an index into the rows in
509
+ * group order), `onActive(index)`, `empty` (what can be searched, said when nothing is found: plan-2026-11-19 C5.1b). Keys
510
+ * in the field: ↑↓ move the lit row over disabled rows, Enter runs it, Tab and ⇧Tab step the tabs, → and ← open and close
511
+ * a fold while the field is empty, ⌘↵ all folds; Escape is the layer's. Its look is `--kol-command-*` in kol-theme. */
512
+ function MatchLabel({ label, query }) {
516
513
  /* a label the host has marked itself (a node) is drawn as it is */
517
514
  if (typeof label !== 'string') return label
518
515
  const at = query ? label.toLowerCase().indexOf(query.toLowerCase()) : -1
519
516
  if (at < 0) return label
520
517
  return <>{label.slice(0, at)}<span className="underline decoration-2 underline-offset-[3px]">{label.slice(at, at + query.length)}</span>{label.slice(at + query.length)}</>
521
518
  }
522
- const KeyKolbox = ({ k, children }) => <span className="flex items-center gap-1"><KbdKeys variant="kolbox" size="sm" keys={k} />{children}</span>
519
+ const FootKey = ({ k, children }) => <span className="flex items-center gap-1"><KbdKeys size="sm" keys={k} />{children}</span>
523
520
  /* a fold's rows indented to its label: the row's 12 inset, the 20 icon and its 12 gap */
524
- const INDENT_KOLBOX = { paddingLeft: 'calc(var(--kol-spacing-3) * 2 + 20px)' }
521
+ const FOLD_INDENT = { paddingLeft: 'calc(var(--kol-spacing-3) * 2 + 20px)' }
525
522
 
526
- function CommandOverlayKolbox({ open, onClose, mode = 'search', query = '', onQueryChange, placeholder = 'Search tools, actions, pages…', tabs = [], tab, onTab, groups = [], active = -1, onActive, onSelect, empty, mark = '⌘K', 'aria-label': ariaLabel }) {
523
+ function CommandOverlayGrouped({ open, onClose, mode = 'search', query = '', onQueryChange, placeholder = 'Search tools, actions, pages…', tabs = [], tab, onTab, groups = [], active = -1, onActive, onSelect, empty, mark = '⌘K', 'aria-label': ariaLabel }) {
527
524
  const field = mode !== 'shortcuts'
528
525
  const input = useRef(null)
529
526
  const panel = useRef(null)
@@ -597,11 +594,11 @@ function CommandOverlayKolbox({ open, onClose, mode = 'search', query = '', onQu
597
594
  data-kolbox-search=""
598
595
  tabIndex={field ? undefined : -1}
599
596
  onKeyDown={field ? undefined : key}
600
- className="kol-command--kolbox kol-kolbox-surface mt-[20vh] flex max-w-[calc(100vw-var(--kol-spacing-8))] flex-col self-start overflow-hidden outline-none"
597
+ className="kol-command-panel kol-kolbox-surface mt-[20vh] flex max-w-[calc(100vw-var(--kol-spacing-8))] flex-col self-start overflow-hidden outline-none"
601
598
  >
602
599
  {field && (
603
600
  <div className="flex flex-col gap-2 p-2">
604
- <Input variant="kolbox"
601
+ <Input
605
602
  ref={input}
606
603
  size="lg"
607
604
  iconLeft="search"
@@ -614,8 +611,8 @@ function CommandOverlayKolbox({ open, onClose, mode = 'search', query = '', onQu
614
611
  value={query}
615
612
  onChange={(e) => onQueryChange?.(e.target.value)}
616
613
  onKeyDown={key}
617
- slotRight={!query && mark && <KbdKeys variant="kolbox" size="sm" keys={mark} />} />
618
- {tabs.length > 0 && <TabsRow variant="kolbox" tabs={tabs} value={tab} onChange={onTab} className="h-10! w-full [&>button]:flex-1 [&>button]:px-4" />}
614
+ slotRight={!query && mark && <KbdKeys size="sm" keys={mark} />} />
615
+ {tabs.length > 0 && <TabsRow variant="track" tabs={tabs} value={tab} onChange={onTab} className="h-10! w-full [&>button]:flex-1 [&>button]:px-4" />}
619
616
  </div>
620
617
  )}
621
618
  {(rows.length > 0 || field) && (
@@ -636,7 +633,7 @@ function CommandOverlayKolbox({ open, onClose, mode = 'search', query = '', onQu
636
633
  return (
637
634
  <TreeRow
638
635
  key={r.id}
639
- variant="kolbox"
636
+ variant="kolbox" /* TreeRow's own fold is W5: until then its theme word draws this row */
640
637
  size="lg"
641
638
  id={`${listId}-${i}`}
642
639
  role="option"
@@ -648,16 +645,16 @@ function CommandOverlayKolbox({ open, onClose, mode = 'search', query = '', onQu
648
645
  icon={r.of ? undefined : r.icon}
649
646
  label={r.body
650
647
  /* `body`, an optional second line (Folio's word): the row grows to hold it; a row without one is as before */
651
- ? <span className="flex min-w-0 flex-col"><span className="truncate"><MatchKolbox label={r.label} query={query} /></span><span className="kol-command-body truncate">{r.body}</span></span>
652
- : <MatchKolbox label={r.label} query={query} />}
648
+ ? <span className="flex min-w-0 flex-col"><span className="truncate"><MatchLabel label={r.label} query={query} /></span><span className="kol-command-body truncate">{r.body}</span></span>
649
+ : <MatchLabel label={r.label} query={query} />}
653
650
  className={r.body ? 'h-auto! min-h-10 py-1.5' : undefined}
654
651
  active={i === active}
655
652
  disabled={r.disabled}
656
653
  onMouseDown={(e) => e.preventDefault()}
657
654
  onMouseEnter={() => !r.disabled && onActive?.(i)}
658
655
  onClick={() => pick(r)}
659
- trailing={hint && (r.kbd && hint === r.hint ? <KbdKeys variant="kolbox" keys={hint} size="md" className="pl-3" /> : <span className="kol-command-hint max-w-1/2 shrink-0 truncate pl-3">{hint}</span>)}
660
- {...(r.of ? { style: INDENT_KOLBOX } : {})}
656
+ trailing={hint && (r.kbd && hint === r.hint ? <KbdKeys keys={hint} size="md" className="pl-3" /> : <span className="kol-command-hint max-w-1/2 shrink-0 truncate pl-3">{hint}</span>)}
657
+ {...(r.of ? { style: FOLD_INDENT } : {})}
661
658
  />
662
659
  )
663
660
  })}
@@ -666,14 +663,14 @@ function CommandOverlayKolbox({ open, onClose, mode = 'search', query = '', onQu
666
663
  </div>}
667
664
  <div role="separator" className="kol-command-rule mt-2 h-px shrink-0" />
668
665
  <footer className="kol-command-foot flex h-10 shrink-0 items-center gap-4 px-4">
669
- {rows.length > 1 && <KeyKolbox k="↑↓">Navigate</KeyKolbox>}
670
- {rows.length > 0 && <KeyKolbox k="↵">{enter}</KeyKolbox>}
666
+ {rows.length > 1 && <FootKey k="↑↓">Navigate</FootKey>}
667
+ {rows.length > 0 && <FootKey k="↵">{enter}</FootKey>}
671
668
  <button type="button" onMouseDown={(e) => e.preventDefault()} onClick={onClose} className="outline-none">
672
- <KeyKolbox k="Esc">Close</KeyKolbox>
669
+ <FootKey k="Esc">Close</FootKey>
673
670
  </button>
674
671
  {folds.length > 0 && !query && (
675
672
  <button type="button" onMouseDown={(e) => e.preventDefault()} onClick={toggleAll} className="ml-auto outline-none" data-fold-all>
676
- <KeyKolbox k="⌘↵">{allOpen ? 'Collapse all' : 'Expand all'}</KeyKolbox>
673
+ <FootKey k="⌘↵">{allOpen ? 'Collapse all' : 'Expand all'}</FootKey>
677
674
  </button>
678
675
  )}
679
676
  </footer>
@@ -684,84 +681,13 @@ function CommandOverlayKolbox({ open, onClose, mode = 'search', query = '', onQu
684
681
  )
685
682
  }
686
683
 
687
- /* ── folio (Folio migration batch B, 2026-11-22) ──────────────────────────────────────────────────────────────────────────
688
- * Folio's two search windows carried class for class, the chrome in kol-theme `.kol-command--folio`, on `ModalShell
689
- * variant="folio"`, 12% down, drawn in place (never portalled, so they keep the frame's `data-folio-*`); a press outside
690
- * closes. Presentational, as kolbox's: the host keeps the query, the rows and the lit row.
691
- * mode 'search' the search modal (Folio's SearchOverlay): 720 wide on the Folio dim, the field (the lens, `esc`),
692
- * then each row: `label` (a node, the matches marked by the host) with `group` at the right, `hint`
693
- * under it, `body` (Folio's word: a line of the text) under that
694
- * mode 'commands' the command list (Folio's CommandPalette, ⇧⌘P): 640 wide, no dim, the field, then rows of `label`
695
- * with `hint` (the keys) at the right
696
- * CommandOverlay's words: `open`, `onClose`, `query`, `onQueryChange`, `placeholder`, `results` `[{ id, label, group,
697
- * hint, body }]`, `onSelect(row)` (also on Enter with no row in `commands`, so Enter there always closes), `aria-label`.
698
- * kolbox's: `active`, `onActive`, `empty` (said under the field when it is set). Keys in the field: ↑↓ move the lit
699
- * row, Enter picks, Escape closes. */
700
- function CommandOverlayFolio({ open, onClose, mode = 'search', query = '', onQueryChange, placeholder, results = [], active = 0, onActive, onSelect, empty, 'aria-label': label }) {
701
- const commands = mode === 'commands'
702
- const input = useRef(null)
703
- useEffect(() => { if (open && !commands) setTimeout(() => input.current?.focus(), 0) }, [open]) // eslint-disable-line react-hooks/exhaustive-deps
704
- if (!open) return null
705
- const onKey = (e) => {
706
- if (e.key === 'Escape') onClose?.()
707
- if (e.key === 'ArrowDown') { e.preventDefault(); onActive?.(Math.min(active + 1, results.length - 1)) }
708
- if (e.key === 'ArrowUp') { e.preventDefault(); onActive?.(Math.max(active - 1, 0)) }
709
- if (e.key === 'Enter') {
710
- if (commands) { e.preventDefault(); onSelect?.(results[active]) }
711
- else if (results[active]) onSelect?.(results[active])
712
- }
713
- }
714
- if (commands) {
715
- return (
716
- <div className="fixed inset-0 z-50 flex items-start justify-center px-[16px] pt-[12vh]" onMouseDown={onClose}>
717
- <ModalShell variant="folio" role="dialog" aria-label={label} onMouseDown={(e) => e.stopPropagation()} className="kol-command--folio kol-command--folio-commands max-h-[60vh] w-[640px] max-w-full overflow-hidden">
718
- <input autoFocus aria-label="Command" placeholder={placeholder} value={query} onChange={(e) => onQueryChange?.(e.target.value)} onKeyDown={onKey}
719
- className="kol-command-field--folio h-[48px] shrink-0 border-b bg-transparent px-[16px] outline-none" />
720
- <div role="listbox" aria-label={label} className="min-h-0 overflow-y-auto py-[6px]">
721
- {results.map((r, i) => (
722
- <button key={r.id ?? r.label} type="button" role="option" aria-selected={i === active} onMouseEnter={() => onActive?.(i)} onClick={() => onSelect?.(r)} className={`kol-command-row--folio${i === active ? ' is-active' : ''} flex h-[32px] w-full items-center px-[16px] text-left`}>
723
- {r.label}<span className="kol-command-hint--folio ml-auto">{r.hint ?? ''}</span>
724
- </button>
725
- ))}
726
- {empty && <p className="kol-folio-meta kol-command-empty--folio px-[16px] py-[8px]">{empty}</p>}
727
- </div>
728
- </ModalShell>
729
- </div>
730
- )
731
- }
732
- return (
733
- <div className="kol-modal-dim--folio fixed inset-0 z-50 flex items-start justify-center px-[16px] pt-[12vh]" onMouseDown={onClose}>
734
- <ModalShell variant="folio" role="dialog" aria-label={label} className="kol-command--folio kol-command--folio-search max-h-[70vh] w-full max-w-[720px] overflow-hidden" onMouseDown={(e) => e.stopPropagation()}>
735
- <label className="kol-command-head--folio flex h-[56px] shrink-0 items-center gap-[12px] border-b px-[18px]">
736
- <IconLoader name="search" size={18} />
737
- <input ref={input} value={query} onChange={(e) => onQueryChange?.(e.target.value)} onKeyDown={onKey} placeholder={placeholder} className="kol-command-search--folio min-w-0 flex-1 bg-transparent outline-none" />
738
- <span className="kol-folio-meta kol-command-hint--folio">esc</span>
739
- </label>
740
- <div className="overflow-y-auto">
741
- {empty && <p className="kol-folio-body kol-command-empty--folio px-[18px] py-[20px]">{empty}</p>}
742
- {results.map((r, i) => (
743
- <button key={r.id} type="button" onMouseEnter={() => onActive?.(i)} onClick={() => onSelect?.(r)} className={`kol-command-result--folio${i === active ? ' is-active' : ''} flex w-full flex-col gap-[6px] border-b px-[18px] py-[14px] text-left`}>
744
- <span className="flex items-baseline justify-between gap-[16px]">
745
- <span className="kol-folio-shelf">{r.label}</span>
746
- <span className="kol-folio-label kol-command-hint--folio shrink-0">{r.group}</span>
747
- </span>
748
- {r.hint && <span className="kol-folio-meta kol-command-hint--folio">{r.hint}</span>}
749
- {r.body && <span className="kol-folio-body kol-command-hint--folio">{r.body}</span>}
750
- </button>
751
- ))}
752
- </div>
753
- </ModalShell>
754
- </div>
755
- )
756
- }
757
-
758
- /* ── kolbox, from `results` (Folio on kolbox, 2026-11-22) ──
759
- * The folio branch's words under the kolbox look, so a host switches by the variant alone: `results` `[{ id, label, group,
760
- * hint, body }]` become kolbox's groups (each `group` a titled group, in the order they first come; `hint` at the row's
761
- * right, as key caps when it is one combo); `body`, when a row has one, is a second line under its label. `mode`
762
- * 'commands' is the same panel with no group titles: the command list. The row handed to `onSelect` is the host's own. */
684
+ /* ── grouped, from `results` (Folio on kolbox, 2026-11-22) ──
685
+ * `results` `[{ id, label, group, hint, body }]` drawn as the grouped build: each `group` a titled group, in the order
686
+ * they first come; `hint` at the row's right, as key caps when it is one combo; `body`, when a row has one, a second line
687
+ * under its label. `mode` 'commands' is the same panel with no group titles: the command list. The row handed to
688
+ * `onSelect` is the host's own. Reached by an old theme word in `variant` with `results` (Folio's and kol-fxr's hosts). */
763
689
  export const isKeyCombo = (s) => typeof s === 'string' && /^[⌘⇧⌥⌃]*[^\s⌘⇧⌥⌃]+$/.test(s)
764
- function CommandOverlayKolboxResults({ results, mode, ...props }) {
690
+ function CommandOverlayFromResults({ results, mode, ...props }) {
765
691
  const groups = []
766
692
  results.forEach((r, i) => {
767
693
  const title = mode === 'commands' ? undefined : r.group
@@ -770,11 +696,16 @@ function CommandOverlayKolboxResults({ results, mode, ...props }) {
770
696
  g.rows.push({ ...r, id: r.id ?? `${i}:${typeof r.label === 'string' ? r.label : ''}`, hint: r.hint || undefined, kbd: isKeyCombo(r.hint) })
771
697
  })
772
698
  /* the field's ⌘K mark is the search modal's own key; the command list does not open on it */
773
- return <CommandOverlayKolbox {...props} mode="search" groups={groups} mark={mode === 'commands' ? null : undefined} />
699
+ return <CommandOverlayGrouped {...props} mode="search" groups={groups} mark={mode === 'commands' ? null : undefined} />
774
700
  }
775
701
 
702
+ /* WHICH BUILD (plan-2026-11-29-one-set-fold W3, decided for his review): `groups`, or `mode="commands"` (the command list
703
+ * from `results`), asks for the grouped build, which the host keeps (`active`, `tab`); without them the default build
704
+ * keeps its own state over `results` and `suggestions`. The old
705
+ * theme words in `variant` are accepted and ask for the grouped build, reading `results` when given (on the retirement
706
+ * ledger); the theme draws its look. Folio's own search modal and command list went to _tmp/2026-11-29-one-set-fold/. */
707
+ const THEME_WORDS = ['kolbox', 'folio']
776
708
  export default function CommandOverlay(props) {
777
- if (props.variant === 'folio') return <CommandOverlayFolio {...props} />
778
- if (props.variant === 'kolbox') return props.results ? <CommandOverlayKolboxResults {...props} /> : <CommandOverlayKolbox {...props} />
779
- return <CommandOverlayDefault {...props} />
709
+ if (props.groups == null && props.mode !== 'commands' && !THEME_WORDS.includes(props.variant)) return <CommandOverlayDefault {...props} />
710
+ return props.results ? <CommandOverlayFromResults {...props} /> : <CommandOverlayGrouped {...props} />
780
711
  }
@@ -1,20 +1,20 @@
1
- import { IconLoader } from '@kolkrabbi/kol-icons'
2
1
  import Input from '../atoms/Input.jsx'
3
2
  import Button from '../atoms/Button.jsx'
4
- import ButtonGroup from '../molecules/ButtonGroup.jsx'
5
3
 
6
4
  /**
7
5
  * FindBar — find and replace over a document, one bar across its top (Folio's FindBar, 2026-11-22). It holds no
8
6
  * document state: the host keeps the query, the replacement, the count and match case, and does the finding.
9
7
  *
10
8
  * The find field takes focus when the bar mounts. In either field Enter is the next match, Shift+Enter the previous;
11
- * Escape anywhere in the bar closes it. Chrome in kol-theme `.kol-find-bar--kolbox` and `.kol-find-bar--folio`.
9
+ * Escape anywhere in the bar closes it. Chrome in kol-theme `.kol-find-bar`, its line `--kol-find-bar-line` (kolbox the one edge).
12
10
  *
13
11
  * <FindBar query={q} onQueryChange={setQ} replacement={r} onReplacementChange={setR} count="3 found"
14
12
  * onPrev={prev} onNext={next} onReplace={one} onReplaceAll={all} matchCase={mc} onMatchCase={setMc} onClose={close} />
15
13
  *
16
- * @param {'kolbox'|'folio'} [variant='kolbox'] - kolbox: 48 high on the rail ground, the kolbox line under it, kolbox's
17
- * Input md (the rail's search) and Buttons. folio: Folio's bar carried class for class (48, its surface, its rule).
14
+ * ONE BAR (plan-2026-11-29-one-set-fold W3 run 2): 48 high on the rail ground, the line under it, Input md (the rail's search)
15
+ * and Buttons, the theme's look on each.
16
+ * @param {'kolbox'|'folio'} [variant] - accepted and nothing (on the retirement ledger). Folio's own bar (56 in, arrow
17
+ * glyphs, Folio's Input and Buttons) went to `_tmp/2026-11-29-one-set-fold/FindBar.pre-w3b.jsx`
18
18
  * @param {string} query - The find field's text
19
19
  * @param {(value: string) => void} onQueryChange
20
20
  * @param {string} replacement - The replace field's text
@@ -29,42 +29,28 @@ import ButtonGroup from '../molecules/ButtonGroup.jsx'
29
29
  * @param {() => void} onClose
30
30
  * @param {string} [className] - Extra classes on the bar
31
31
  */
32
- export default function FindBar({ variant = 'kolbox', query, onQueryChange, replacement, onReplacementChange, count, onPrev, onNext, onReplace, onReplaceAll, matchCase, onMatchCase, onClose, className = '' }) {
32
+ export default function FindBar({ variant, query, // eslint-disable-line no-unused-vars
33
+ onQueryChange, replacement, onReplacementChange, count, onPrev, onNext, onReplace, onReplaceAll, matchCase, onMatchCase, onClose, className = '' }) {
33
34
  /* Enter steps only from a field, so a focused button still presses on Enter */
34
35
  const onKeyDown = (e) => {
35
36
  if (e.key === 'Escape') { e.preventDefault(); onClose?.() }
36
37
  if (e.key === 'Enter' && e.target.tagName === 'INPUT') { e.preventDefault(); e.shiftKey ? onPrev?.() : onNext?.() }
37
38
  }
38
39
 
39
- if (variant === 'folio') return (
40
- <div className={`kol-find-bar--folio flex h-[48px] shrink-0 items-center gap-[10px] border-b px-[56px] ${className}`.trim()} onKeyDown={onKeyDown}>
41
- <IconLoader name="search" size={16} />
42
- <Input variant="folio" autoFocus aria-label="Find" placeholder="Find" value={query} onChange={(e) => onQueryChange(e.target.value)} className="w-[220px]" />
43
- <span className="kol-find-bar-count w-[64px] tabular-nums">{count}</span>
44
- <ButtonGroup layout="joined" variant="folio" ariaLabel="Matches" options={[{ icon: 'arrow-left', ariaLabel: 'Previous match', onPress: onPrev }, { icon: 'arrow-right', ariaLabel: 'Next match', onPress: onNext }]} />
45
- <button type="button" aria-pressed={matchCase} onClick={() => onMatchCase(!matchCase)} className={`kol-find-bar-case${matchCase ? ' is-on' : ''} h-[28px] rounded-[3px] px-[8px]`}>Aa</button>
46
- <span className="kol-find-bar-rule mx-[8px] h-[20px] w-px" />
47
- <Input variant="folio" aria-label="Replace with" placeholder="Replace with" value={replacement} onChange={(e) => onReplacementChange(e.target.value)} className="w-[220px]" />
48
- <Button variant="folio" keepFocus onClick={onReplace}>Replace</Button>
49
- <Button variant="folio" keepFocus onClick={onReplaceAll}>Replace all</Button>
50
- <Button variant="folio" keepFocus iconOnly="x" aria-label="Close find" onClick={onClose} className="kol-find-bar-close ml-auto" />
51
- </div>
52
- )
53
-
54
- /* kolbox: the rail header's 48 and its insets (12 in, 8 at the end), the rail's search field (Input md) and kolbox's
55
- own find's buttons; Folio's order and words */
40
+ /* the rail header's 48 and its insets (12 in, 8 at the end), the rail's search field (Input md) and kolbox's own find's
41
+ buttons; Folio's order and words */
56
42
  return (
57
- <div className={`kol-find-bar--kolbox flex h-12 shrink-0 items-center gap-2 border-b pr-2 pl-3 ${className}`.trim()} onKeyDown={onKeyDown}>
58
- <Input variant="kolbox" size="md" iconLeft="search" autoFocus aria-label="Find" placeholder="Find" value={query} onChange={(e) => onQueryChange(e.target.value)} className="w-60" />
43
+ <div className={`kol-find-bar flex h-12 shrink-0 items-center gap-2 border-b pr-2 pl-3 ${className}`.trim()} onKeyDown={onKeyDown}>
44
+ <Input size="md" iconLeft="search" autoFocus aria-label="Find" placeholder="Find" value={query} onChange={(e) => onQueryChange(e.target.value)} className="w-60" />
59
45
  <span className="kol-find-bar-count kol-kolbox-row w-16 shrink-0 tabular-nums">{count}</span>
60
- <Button variant="kolbox" iconOnly="chevron-up" aria-label="Previous match" onClick={onPrev} />
61
- <Button variant="kolbox" iconOnly="chevron-down" aria-label="Next match" onClick={onNext} />
62
- <Button variant="kolbox" tone="ghost" pressed={Boolean(matchCase)} aria-label="Match case" onClick={() => onMatchCase(!matchCase)}>Aa</Button>
46
+ <Button iconOnly="chevron-up" aria-label="Previous match" onClick={onPrev} />
47
+ <Button iconOnly="chevron-down" aria-label="Next match" onClick={onNext} />
48
+ <Button tone="ghost" pressed={Boolean(matchCase)} aria-label="Match case" onClick={() => onMatchCase(!matchCase)}>Aa</Button>
63
49
  <span className="kol-find-bar-rule mx-2 h-5 w-px shrink-0" />
64
- <Input variant="kolbox" size="md" iconLeft="arrow-right" aria-label="Replace with" placeholder="Replace with" value={replacement} onChange={(e) => onReplacementChange(e.target.value)} className="w-60" />
65
- <Button variant="kolbox" onClick={onReplace}>Replace</Button>
66
- <Button variant="kolbox" onClick={onReplaceAll}>Replace all</Button>
67
- <Button variant="kolbox" iconOnly="x" aria-label="Close find" onClick={onClose} className="ml-auto" />
50
+ <Input size="md" iconLeft="arrow-right" aria-label="Replace with" placeholder="Replace with" value={replacement} onChange={(e) => onReplacementChange(e.target.value)} className="w-60" />
51
+ <Button onClick={onReplace}>Replace</Button>
52
+ <Button onClick={onReplaceAll}>Replace all</Button>
53
+ <Button iconOnly="x" aria-label="Close find" onClick={onClose} className="ml-auto" />
68
54
  </div>
69
55
  )
70
56
  }
@@ -20,36 +20,53 @@ import { LabeledControlSection } from './SettingsPanel.jsx'
20
20
  * chapter, 12 under the count, 4 between rows; `current` lifted fg-16), then `progress` (`Through the book` and the
21
21
  * share in mono over the float ProgressBar, 12 apart). Each part renders only when given.
22
22
  *
23
- * @param {ReactNode} [book] · {ReactNode} [author] · {ReactNode} [count] `9 interludes`
23
+ * Folio's parts, optional (plan-2026-11-29-one-set-fold W3; Folio batch E, its own build until then): `eyebrow` over the
24
+ * book, `title` (the list's head, the `count` at its right), a chapter's `sections` under the current one (anchors, in
25
+ * past the number), a document's `headings` when there are no `chapters`, `empty` when there are neither, `progressText`
26
+ * for the share's figure (`3 / 9`), and `linkComponent` (a router's Link for a chapter's `href`).
27
+ *
28
+ * @param {ReactNode} [eyebrow] · {ReactNode} [book] · {ReactNode} [author] · {ReactNode} [title] · {ReactNode} [count] `9 interludes`
24
29
  * @param {Array} chapters `[{ id, label, href? }]`
25
30
  * @param {string} [current] the id the reader is in
26
31
  * @param {Function} [onSelect] `(id) => void`
32
+ * @param {Array} [sections] the current chapter's headings `[{ id, label }]`, drawn under it
33
+ * @param {Array} [headings] a document's headings `[{ id, label }]`, drawn when there are no chapters
34
+ * @param {ReactNode} [empty] the line when there are neither
35
+ * @param {ElementType} [linkComponent] a router's Link for a chapter's `href`; default `a`
27
36
  * @param {number} [progress] 0–100; unset, no progress line
28
37
  * @param {string} [progressLabel] default `Through the book`
38
+ * @param {ReactNode} [progressText] the figure; default the share, `42%`
29
39
  * @param {string} [className]
40
+ * @param {'folio'} [variant] the old theme word, accepted and does nothing (W3, on the retirement ledger); Folio's own
41
+ * build went to _tmp/2026-11-29-one-set-fold/
30
42
  */
31
- function ReadingContentsDefault({ book, author, count, chapters = [], current, onSelect, progress, progressLabel = 'Through the book', className = '' }) {
43
+ export default function ReadingContents({ eyebrow, book, author, title, count, chapters = [], current, onSelect, sections = [], headings = [], empty, linkComponent, progress, progressLabel = 'Through the book', progressText, className = '' }) {
44
+ const ruler = (text) => <span className="kol-float-ruler uppercase text-fg-64">{text}</span>
32
45
  return (
33
46
  <div data-reading-contents="" className={`flex flex-col gap-6 ${className}`.trim()}>
34
- {(book || author) && (
47
+ {(eyebrow || book || author) && (
35
48
  <div className="flex flex-col gap-1">
49
+ {eyebrow && <span className="kol-float-hint text-fg-64">{eyebrow}</span>}
36
50
  {book && <span className="kol-float-section text-fg-emphasis">{book}</span>}
37
51
  {author && <span className="kol-float-hint text-fg-64">{author}</span>}
38
52
  </div>
39
53
  )}
40
- {(count || chapters.length > 0) && (
54
+ {(title || count || chapters.length > 0 || headings.length > 0 || empty) && (
41
55
  <LabeledControlSection as="nav" aria-label="Contents" rowGap={1}
42
- label={count && <span className="kol-float-ruler uppercase text-fg-64">{count}</span>}>
43
- {chapters.map((c, i) => (
44
- <TocRow key={c.id} number={i + 1} label={c.label} href={c.href} current={c.id === current} onClick={onSelect ? () => onSelect(c.id) : undefined} className="h-9" />
45
- ))}
56
+ label={title ? ruler(title) : count && ruler(count)} end={title && count ? ruler(count) : undefined}>
57
+ {chapters.length > 0 ? chapters.flatMap((c, i) => [
58
+ <TocRow key={c.id} number={i + 1} label={c.label} href={c.href} linkComponent={linkComponent} current={c.id === current} onClick={onSelect ? () => onSelect(c.id) : undefined} className="h-9" />,
59
+ ...(c.id === current ? sections.map((h) => <TocRow key={`${c.id}#${h.id}`} label={h.label} href={`#${h.id}`} className="pl-11" />) : []),
60
+ ]) : headings.length > 0 ? headings.map((h, i) => (
61
+ <TocRow key={h.id} number={i + 1} label={h.label} href={`#${h.id}`} />
62
+ )) : empty && <span className="kol-float-hint px-3 text-fg-64">{empty}</span>}
46
63
  </LabeledControlSection>
47
64
  )}
48
65
  {progress != null && (
49
66
  <div className="flex flex-col gap-3">
50
67
  <div className="flex items-center justify-between">
51
68
  <span className="kol-float-hint text-fg-64">{progressLabel}</span>
52
- <span className="kol-float-timecode tabular-nums text-fg-emphasis">{Math.round(progress)}%</span>
69
+ <span className="kol-float-timecode tabular-nums text-fg-emphasis">{progressText ?? `${Math.round(progress)}%`}</span>
53
70
  </div>
54
71
  <ProgressBar value={progress} ariaLabel={progressLabel} />
55
72
  </div>
@@ -57,65 +74,3 @@ function ReadingContentsDefault({ book, author, count, chapters = [], current, o
57
74
  </div>
58
75
  )
59
76
  }
60
-
61
- /* ── folio (Folio batch E, 2026-11-22) ─────────────────────────────────────────────────────────────────────────────
62
- * Folio's contents, carried from apps/folio's FolioDocument (the reader's left Rail, above the library tree): the
63
- * `eyebrow` in Folio's label, the `book` title, the `author` line (Folio puts its chapter count or the document's kind
64
- * there), 12 apart; then the list under its head (`title`, `Contents` by default, and the `count`, over a rule in the
65
- * ink); then, for a book, `progress` (0 to 100) under `progressLabel` and its figure (`progressText`, the reader's
66
- * "1 / 3"). Parts 28 apart, each drawn only when given. ReadingContents' words: `chapters` ({ id, label, href }),
67
- * `current`. Folio's own: `sections` (the current chapter's headings, { id, label }, as anchors under it), `headings` (a
68
- * document's headings when it is not a book, drawn quieter), `empty` (the line when there are neither), `linkComponent`
69
- * (a router's Link for a chapter; default `a`) and `progressText`. */
70
- function ReadingContentsFolio({ eyebrow, book, author, title = 'Contents', count, chapters = [], current, sections = [], headings = [], empty, linkComponent: L = 'a', progress, progressLabel = 'Through the book', progressText, className = '' }) {
71
- const go = (href) => (L === 'a' ? { href } : { to: href })
72
- return (
73
- <div className={`kol-reading-contents--folio flex flex-col gap-[28px] ${className}`.trim()}>
74
- <div className="flex flex-col gap-[12px]">
75
- {eyebrow != null && <p className="kol-folio-label kol-reading-contents-muted">{eyebrow}</p>}
76
- {book != null && <p className="kol-folio-book break-words">{book}</p>}
77
- {author != null && <p className="kol-folio-body kol-reading-contents-muted">{author}</p>}
78
- </div>
79
- <nav aria-label="Contents" className="flex flex-col gap-[4px]">
80
- <div className="kol-reading-contents-head flex justify-between border-b pb-[15px]">
81
- <p className="kol-folio-nav">{title}</p>
82
- <p className="kol-folio-meta kol-reading-contents-muted">{count}</p>
83
- </div>
84
- {chapters.length ? chapters.map((c, n) => {
85
- const on = c.id === current
86
- return (
87
- <div key={c.id} className="flex flex-col">
88
- <L {...go(c.href)} aria-current={on ? 'page' : undefined} className={`kol-reading-contents-row flex gap-[14px] rounded-[3px] px-[12px] py-[11px] ${on ? 'is-current' : ''}`.trim()}>
89
- <span className="kol-folio-meta kol-reading-contents-number tabular-nums">{String(n + 1).padStart(2, '0')}</span>
90
- <span className="kol-folio-nav min-w-0 flex-1">{c.label}</span>
91
- </L>
92
- {on && sections.length > 0 && (
93
- <div className="kol-reading-contents-sections ml-[38px] flex flex-col border-l py-[4px]">
94
- {sections.map((h) => <a key={h.id} href={`#${h.id}`} className="kol-folio-meta kol-reading-contents-quiet py-[6px] pl-[12px]">{h.label}</a>)}
95
- </div>
96
- )}
97
- </div>
98
- )
99
- }) : headings.length ? headings.map((h, n) => (
100
- <a key={h.id} href={`#${h.id}`} className="kol-reading-contents-heading kol-reading-contents-quiet flex gap-[12px] rounded-[3px] px-[12px] py-[9px]">
101
- <span className="kol-folio-meta tabular-nums">{String(n + 1).padStart(2, '0')}</span>
102
- <span className="kol-folio-nav min-w-0 flex-1">{h.label}</span>
103
- </a>
104
- )) : <p className="kol-folio-meta kol-reading-contents-muted px-[12px] py-[9px]">{empty}</p>}
105
- </nav>
106
- {progress != null && (
107
- <div className="kol-reading-contents-progress flex flex-col gap-[12px] border-t pt-[19px]">
108
- <div className="kol-folio-meta flex justify-between">
109
- <p className="kol-reading-contents-muted">{progressLabel}</p>
110
- <p className="kol-reading-contents-figure font-bold">{progressText}</p>
111
- </div>
112
- <div className="kol-reading-contents-track h-[4px]"><div className="kol-reading-contents-fill h-full" style={{ width: `${progress}%` }} /></div>
113
- </div>
114
- )}
115
- </div>
116
- )
117
- }
118
-
119
- export default function ReadingContents(props) {
120
- return props.variant === 'folio' ? <ReadingContentsFolio {...props} /> : <ReadingContentsDefault {...props} />
121
- }