@kolkrabbi/kol-component 0.389.0 → 0.391.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 +2 -2
- package/src/molecules/Modal.jsx +2 -0
- package/src/molecules/RailHeader.jsx +11 -7
- package/src/molecules/TocRow.jsx +4 -3
- package/src/organisms/CommandOverlay.jsx +48 -117
- package/src/organisms/Rail.jsx +15 -18
- package/src/organisms/RailSwitcher.jsx +8 -7
- package/src/organisms/ReadingContents.jsx +26 -71
- package/src/organisms/SettingsPanel.jsx +18 -24
- package/src/organisms/ShortcutsOverlay.jsx +17 -39
- package/src/organisms/StatusBar.jsx +9 -14
- package/src/utilities/SelectionOverlay.jsx +14 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.391.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@kolkrabbi/kol-icons": "^0.
|
|
48
|
+
"@kolkrabbi/kol-icons": "^0.75.0"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"src",
|
package/src/molecules/Modal.jsx
CHANGED
|
@@ -229,6 +229,7 @@ function ModalView({ state, closeWith, contained }) {
|
|
|
229
229
|
<div className="px-4 pb-4" data-modal-prompt>
|
|
230
230
|
<Input
|
|
231
231
|
variant="kolbox"
|
|
232
|
+
text
|
|
232
233
|
ref={inputRef}
|
|
233
234
|
type={state.type}
|
|
234
235
|
autoComplete={state.type === 'password' ? 'current-password' : undefined}
|
|
@@ -245,6 +246,7 @@ function ModalView({ state, closeWith, contained }) {
|
|
|
245
246
|
<Input
|
|
246
247
|
key={f.id}
|
|
247
248
|
variant="kolbox"
|
|
249
|
+
text
|
|
248
250
|
ref={i === 0 ? inputRef : undefined}
|
|
249
251
|
type={f.type ?? 'text'}
|
|
250
252
|
autoComplete={f.autoComplete}
|
|
@@ -4,20 +4,24 @@
|
|
|
4
4
|
* RailHeader — the rail kit's title line (RailKit 2026-10-24): title (helper-14 uppercase), a subtitle, the header's
|
|
5
5
|
* actions before the × (which Rail draws). The node Rail's `header` slot takes it; SettingsPanel wears it.
|
|
6
6
|
*
|
|
7
|
-
* `
|
|
7
|
+
* `docked` (kolbox's rail header, W31.2 batch 5; a plain boolean since plan-2026-11-29-one-set-fold W4 run 1): the header
|
|
8
|
+
* of a `Rail mode="docked"`, with `leading` and `size` md · sm (below). Chrome in kol-theme `.kol-rail-header--docked`.
|
|
9
|
+
* `variant="kolbox"` and `"folio"` are accepted and draw it (the retirement ledger).
|
|
8
10
|
*
|
|
9
|
-
* @param {
|
|
11
|
+
* @param {boolean} [docked=false]
|
|
10
12
|
* @param {ReactNode} [title] · {ReactNode} [subtitle] · {ReactNode} [actions] · {string} [className]
|
|
11
13
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const THEME_WORDS = ['kolbox', 'folio']
|
|
15
|
+
|
|
16
|
+
export default function RailHeader({ docked, variant, title, subtitle, actions, leading, size = 'md', className = '' }) {
|
|
17
|
+
/* docked (kolbox's RailHeader, plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18, carried from
|
|
18
|
+
* apps/kolbox/src/ui/RailHeader.jsx): a `leading` slot, the title, the `subtitle` as a quiet meta line at the right,
|
|
15
19
|
* the actions; inset 16. `size` md the plain header (48 high), sm the document header (the file's RailHeader 61:11315:
|
|
16
20
|
* 65 high as Figma's, the title on the document voice 13 / 22; below). */
|
|
17
|
-
if (
|
|
21
|
+
if (docked ?? THEME_WORDS.includes(variant)) {
|
|
18
22
|
const sm = size === 'sm'
|
|
19
23
|
return (
|
|
20
|
-
<div className={`kol-rail-header--
|
|
24
|
+
<div className={`kol-rail-header--docked flex items-center ${sm ? 'items-start! gap-2 pt-[13px] pb-[9px] pr-2 pl-4' : 'h-12 gap-2 px-4'} ${className}`.trim()} data-rail-header>
|
|
21
25
|
{leading}
|
|
22
26
|
{sm ? (
|
|
23
27
|
/* sm, the document header: the subtitle is a quiet line UNDER the title, as his reference draws it (2026-11-19);
|
package/src/molecules/TocRow.jsx
CHANGED
|
@@ -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 {
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
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
|
|
502
|
-
*
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
* `
|
|
508
|
-
*
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
|
|
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
|
|
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
|
|
521
|
+
const FOLD_INDENT = { paddingLeft: 'calc(var(--kol-spacing-3) * 2 + 20px)' }
|
|
525
522
|
|
|
526
|
-
function
|
|
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
|
|
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
|
|
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
|
|
618
|
-
{tabs.length > 0 && <TabsRow variant="
|
|
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"><
|
|
652
|
-
: <
|
|
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
|
|
660
|
-
{...(r.of ? { style:
|
|
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 && <
|
|
670
|
-
{rows.length > 0 && <
|
|
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
|
-
<
|
|
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
|
-
<
|
|
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
|
-
/* ──
|
|
688
|
-
*
|
|
689
|
-
*
|
|
690
|
-
*
|
|
691
|
-
*
|
|
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
|
|
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 <
|
|
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.
|
|
778
|
-
|
|
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
|
}
|
package/src/organisms/Rail.jsx
CHANGED
|
@@ -57,13 +57,14 @@ const FOCUSABLE =
|
|
|
57
57
|
* @param {ReactNode} nav A RAIL INSIDE THE RAIL (review 2, 2026-10-25 — *"like a siderail in the bottom rail"*): `RailNav`, the
|
|
58
58
|
* collapsed nav rail's 48 icon column, stood at the panel's edge with the header, body and foot
|
|
59
59
|
* padded beside it — so a bottom rail over the nav rail carries its views as glyphs under it
|
|
60
|
-
* @param {'app'|'site'
|
|
60
|
+
* @param {'app'|'site'} variant THE TIER (RailKit, kol-monitor 2026-10-24): its width when `width` / `height` is not given
|
|
61
61
|
* (`--kol-rail-w-app` 320 · `--kol-rail-w-site` 380) and its padding (`--kol-pad-rail-app` ·
|
|
62
62
|
* `--kol-pad-rail-site`), kol-theme's tokens — so the settings rail and a page rail of one
|
|
63
63
|
* app are one size. Unset = the rail as before (`--kol-pad-overlay`, the width yours)
|
|
64
64
|
* @param {ReactNode} footer a FOOT pinned below the scrolling body (fxr's transport dock; `RailFoot` is its shape) —
|
|
65
65
|
* the body scrolls, the foot does not; the Rail draws it as a band with a full-width rule
|
|
66
66
|
* (2026-10-25), so nothing inside it draws a rule
|
|
67
|
+
* @param {'over'|'push'|'docked'} mode over the page (default), in the layout pushing it, or `docked`: a frame always at its edge (below)
|
|
67
68
|
* @param {boolean} open drawer visible (drives slide in/out)
|
|
68
69
|
* @param {Function} onClose close request (Esc / backdrop / close button)
|
|
69
70
|
* @param {string} side 'left' | 'right' | 'bottom' — edge the panel slides from.
|
|
@@ -139,20 +140,22 @@ export function useRailKey(role, onToggle, enabled = true) {
|
|
|
139
140
|
}, [role, enabled])
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
/* `
|
|
143
|
-
*
|
|
144
|
-
* the
|
|
145
|
-
*
|
|
146
|
-
*
|
|
143
|
+
/* `mode="docked"` (kolbox's one rail shell, plan-2026-11-18-kolbox-system W31.2 batch 5, carried from apps/kolbox/src/ui/Rail.jsx;
|
|
144
|
+
* a plain mode since plan-2026-11-29-one-set-fold W4 run 1): a frame docked at its edge, always there, no open state. It
|
|
145
|
+
* draws the panel fill, the edge line (`--kol-rail-line`), the width (`--kol-rail-docked-w`, 240) and the clip; chrome in
|
|
146
|
+
* kol-theme `.kol-rail--docked`. Slots: `header` and `footer` stay put, the body scrolls. `side` left draws its edge line
|
|
147
|
+
* on the right, right on the left, over the rail's own edge so the content keeps the full width. `collapsed` the narrow
|
|
148
|
+
* strip (`--kol-rail-docked-w-collapsed`, 49). Under 768 a rail lies along the bottom or stacks in a column: the full
|
|
147
149
|
* width, as tall as its content, its edge line along its top. `aria-label` names it. None of the roles, the scrim, the
|
|
148
|
-
* resize or the phone rule
|
|
149
|
-
|
|
150
|
+
* resize or the phone rule. Folio's bare aside (`variant="folio"`) went to `_tmp/2026-11-29-one-set-fold/Rail.pre-w4a.jsx`;
|
|
151
|
+
* apps/folio draws its aside itself. */
|
|
152
|
+
function RailDocked({ side = 'left', 'aria-label': ariaLabel, header, footer, collapsed = false, children, className = '' }) {
|
|
150
153
|
return (
|
|
151
154
|
<aside
|
|
152
155
|
aria-label={ariaLabel}
|
|
153
156
|
data-rail={side}
|
|
154
157
|
data-collapsed={collapsed || undefined}
|
|
155
|
-
className={`kol-rail--
|
|
158
|
+
className={`kol-rail--docked${collapsed ? ' is-collapsed' : ''} relative flex h-full shrink-0 flex-col overflow-hidden max-md:h-auto before:absolute before:inset-y-0 before:z-10 before:w-px ${side === 'left' ? 'before:right-0' : 'before:left-0'} max-md:before:inset-x-0 max-md:before:top-0 max-md:before:bottom-auto max-md:before:h-px max-md:before:w-auto ${className}`.trim()}
|
|
156
159
|
>
|
|
157
160
|
{header && <div className="shrink-0">{header}</div>}
|
|
158
161
|
<div className="min-h-0 flex-1 overflow-y-auto" data-rail-body>{children}</div>
|
|
@@ -161,18 +164,12 @@ function RailKolbox({ side = 'left', 'aria-label': ariaLabel, header, footer, co
|
|
|
161
164
|
)
|
|
162
165
|
}
|
|
163
166
|
|
|
164
|
-
/*
|
|
165
|
-
|
|
166
|
-
* line and width are the caller's `className`). `aria-label` names it (Folio's `label`). None of the roles, the scrim,
|
|
167
|
-
* the resize or the phone rule. */
|
|
168
|
-
function RailFolio({ 'aria-label': ariaLabel, children, className = '' }) {
|
|
169
|
-
return <aside aria-label={ariaLabel} className={`kol-rail--folio flex min-w-0 flex-col overflow-hidden ${className}`.trim()}>{children}</aside>
|
|
170
|
-
}
|
|
167
|
+
/* the old theme words: accepted, they draw the docked rail (W4 run 1, on the retirement ledger) */
|
|
168
|
+
const THEME_WORDS = ['kolbox', 'folio']
|
|
171
169
|
|
|
172
170
|
/* the role's shell, the phone rule over it, then whatever the call site passed (an `undefined` prop is not a pass) */
|
|
173
171
|
export default function Rail({ role, ...props }) {
|
|
174
|
-
if (props.
|
|
175
|
-
if (props.variant === 'folio') return <RailFolio {...props} />
|
|
172
|
+
if (props.mode === 'docked' || THEME_WORDS.includes(props.variant)) return <RailDocked {...props} />
|
|
176
173
|
const phone = useMediaQuery('(max-width: 767px)')
|
|
177
174
|
const r = role ? RAIL_ROLES[role] : null
|
|
178
175
|
if (role && !r && import.meta.env?.DEV) console.warn(`Rail: no role "${role}" — patch · page · settings · bottom`)
|
|
@@ -13,9 +13,10 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
13
13
|
* The glyph is drawn at 20: Figma's read 10 to 14 inside their 24 box, the set's at 20 draws 12 to 15.
|
|
14
14
|
* The host owns the list: a space is added by adding a row.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* the primary button, the
|
|
16
|
+
* One look: the panel, its edge line (`--kol-rail-line`, set by the theme; chrome in kol-theme `.kol-rail-switcher`), the
|
|
17
|
+
* docked rail's collapsed width (`--kol-rail-docked-w-collapsed`), the lit tile a neutral wash (the field fill) with the
|
|
18
|
+
* plain ink, Figma's way (plan-2026-11-23-editor-measured-against-figma W4: the accent is kept for the primary button, the
|
|
19
|
+
* active tool and selection). `variant` is accepted and does nothing (it was `kolbox`, the one look; the ledger).
|
|
19
20
|
* @param {string} markIcon the mark's glyph (your icons), plain, no tile fill (W4)
|
|
20
21
|
* @param {string} [markLabel] its tooltip and name (default "Main menu")
|
|
21
22
|
* @param {boolean} [markOpen] the main menu is open (the tile stays lit)
|
|
@@ -42,17 +43,17 @@ function Row({ row, lit, onSelect }) {
|
|
|
42
43
|
)
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
const RailSwitcher = forwardRef(function RailSwitcher({ variant
|
|
46
|
+
const RailSwitcher = forwardRef(function RailSwitcher({ variant: _variant, markIcon = 'wave', markLabel = 'Main menu', markOpen = false, onMark, items = [], foot = [], value, onSelect, className = '', ...rest }, ref) {
|
|
46
47
|
return (
|
|
47
|
-
<nav aria-label="Spaces" data-rail-switcher=
|
|
48
|
-
className={`relative flex h-full w-(--kol-
|
|
48
|
+
<nav aria-label="Spaces" data-rail-switcher=""
|
|
49
|
+
className={`kol-rail-switcher relative flex h-full w-(--kol-rail-docked-w-collapsed) shrink-0 flex-col items-start bg-panel pt-2 pb-1 after:absolute after:inset-y-0 after:right-0 after:w-px after:bg-(--kol-rail-line) ${className}`.trim()} {...rest}>
|
|
49
50
|
<Tooltip variant="kolbox" asChild label={markLabel}>
|
|
50
51
|
<button ref={ref} type="button" aria-label={markLabel} aria-haspopup="menu" aria-expanded={markOpen} onClick={onMark} data-mark
|
|
51
52
|
className={`${tile} ml-2 shrink-0 p-1 text-text hover:bg-field ${markOpen ? 'bg-field' : ''} ${focus}`}>
|
|
52
53
|
<IconLoader name={markIcon} size={18} />
|
|
53
54
|
</button>
|
|
54
55
|
</Tooltip>
|
|
55
|
-
<span aria-hidden className="mx-4 mt-2 mb-[7px] h-px w-4 shrink-0 bg-(--kol-
|
|
56
|
+
<span aria-hidden className="mx-4 mt-2 mb-[7px] h-px w-4 shrink-0 bg-(--kol-rail-line)" data-rail-switcher-divider />
|
|
56
57
|
<div className="flex flex-col">{items.map((r) => <Row key={r.value} row={r} lit={r.value === value} onSelect={onSelect} />)}</div>
|
|
57
58
|
{foot.length > 0 && <div className="mt-auto flex flex-col">{foot.map((r) => <Row key={r.value ?? r.label} row={r} lit={r.value != null && r.value === value} onSelect={onSelect} />)}</div>}
|
|
58
59
|
</nav>
|
|
@@ -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
|
-
*
|
|
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
|
|
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 &&
|
|
43
|
-
{chapters.
|
|
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)}
|
|
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
|
-
}
|
|
@@ -191,27 +191,28 @@ export function SettingsSwitch({ on = false, onChange, disabled = false, disable
|
|
|
191
191
|
* the 0.104.0 locked composition, untouched.
|
|
192
192
|
*/
|
|
193
193
|
const SETTINGS_GAP = { 3: 'gap-3', 4: 'gap-4', settings: 'gap-[7px]' }
|
|
194
|
-
/* `variant="
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
194
|
+
/* `variant="rail"` (kolbox's RailSection, Figma 27:9309, plan-2026-11-18-kolbox-system W31.2 batch 5, carried from
|
|
195
|
+
* apps/kolbox/src/ui/RailSection.jsx; a plain variant since plan-2026-11-29-one-set-fold W4 run 1): the section of a docked
|
|
196
|
+
* Rail. A 1px rule at the section's top (`--kol-rail-line`), then the head: a 40 row, the `label` 16 in, its `end` actions
|
|
197
|
+
* (24 boxes) 4 apart and 8 off the right edge; 4 to the rows, inset 16, 8 apart; 16 under them. With no rows it is the rule
|
|
198
|
+
* and the head alone (41 high). Measured on Figma's own rails (plan-2026-11-23-editor-measured-against-figma W3: Pages,
|
|
199
|
+
* Layers, Page, Styles and Export headers are 40, label 16 in); closed is not empty, so its title and its actions keep the
|
|
200
|
+
* full ink (his "I thought text were white", R3.2). Chrome in kol-theme `.kol-section--rail`.
|
|
200
201
|
* THE RAIL'S ONE GRID (plan-2026-11-19-kolbox-whats-left R3.1): in a Rail the rows' tracks are set here, once, as
|
|
201
202
|
* `--kol-kolbox-row-cols`: two field columns and two 16 icon columns, 8 apart (76, 76, 16, 16 in the 240 rail; his
|
|
202
|
-
* design's Stroke row, 149:26890). FieldPair and ColorInputRow
|
|
203
|
-
*
|
|
204
|
-
function
|
|
203
|
+
* design's Stroke row, 149:26890). FieldPair and ColorInputRow lay out on it; the head's actions sit at the right of the
|
|
204
|
+
* head (above); LabeledControl's 76 label is the first field column. */
|
|
205
|
+
function LabeledControlSectionRail({ label, end, className = '', children }) {
|
|
205
206
|
const rows = Children.toArray(children)
|
|
206
207
|
const open = rows.length > 0
|
|
207
208
|
return (
|
|
208
209
|
<section
|
|
209
|
-
className={`kol-section--
|
|
210
|
+
className={`kol-section--rail relative flex flex-col gap-1 pt-px ${open ? 'pb-4' : ''} before:absolute before:inset-x-0 before:top-0 before:h-px ${className}`}
|
|
210
211
|
data-rail-section={label ?? ''}
|
|
211
212
|
>
|
|
212
213
|
{(label || end) && (
|
|
213
214
|
<header className="flex h-10 items-center pr-2 pl-4">
|
|
214
|
-
<h3 className="kol-section-title--
|
|
215
|
+
<h3 className="kol-section-title--rail min-w-0 flex-1 truncate">{label}</h3>
|
|
215
216
|
{end && <span className="flex shrink-0 items-center gap-1">{end}</span>}
|
|
216
217
|
</header>
|
|
217
218
|
)}
|
|
@@ -220,20 +221,13 @@ function LabeledControlSectionKolbox({ label, end, className = '', children }) {
|
|
|
220
221
|
)
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
/*
|
|
224
|
-
*
|
|
225
|
-
|
|
226
|
-
return (
|
|
227
|
-
<div className={`kol-section--folio flex flex-col gap-[12px] ${className}`.trim()}>
|
|
228
|
-
<p className="kol-section-title--folio">{label}</p>
|
|
229
|
-
<div className="flex flex-col gap-[8px]">{children}</div>
|
|
230
|
-
</div>
|
|
231
|
-
)
|
|
232
|
-
}
|
|
224
|
+
/* the old theme words (W4 run 1, on the retirement ledger): `kolbox` draws `rail`; `folio` (Folio's SettingGroup, its
|
|
225
|
+
* build in `_tmp/2026-11-29-one-set-fold/SettingsPanel.pre-w4a.jsx`) draws the default section, its 12 and 8 the same */
|
|
226
|
+
const THEME_WORDS = { kolbox: 'rail', folio: undefined }
|
|
233
227
|
|
|
234
|
-
export function LabeledControlSection(props) {
|
|
235
|
-
|
|
236
|
-
return
|
|
228
|
+
export function LabeledControlSection({ variant: variantProp, ...props }) {
|
|
229
|
+
const variant = variantProp in THEME_WORDS ? THEME_WORDS[variantProp] : variantProp
|
|
230
|
+
return variant === 'rail' ? <LabeledControlSectionRail {...props} /> : <LabeledControlSectionBody variant={variant} {...props} />
|
|
237
231
|
}
|
|
238
232
|
function LabeledControlSectionBody({ label, end, variant, divided = false, gap, rowGap, collapsible = false, open, defaultOpen = true, onToggle, as: Tag = 'div', children, className = '', ...rest }) {
|
|
239
233
|
const [ownOpen, setOwnOpen] = useState(defaultOpen)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react'
|
|
2
2
|
import SettingsPanel, { LabeledControlSection, SettingsRow } from './SettingsPanel.jsx'
|
|
3
3
|
import CommandOverlay, { isKeyCombo } from './CommandOverlay.jsx'
|
|
4
|
-
import ModalShell from '../molecules/ModalShell.jsx'
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* ShortcutsOverlay — The keyboard shortcut sheet. the keyboard-shortcut sheet: blurred scrim, centred
|
|
@@ -44,13 +43,11 @@ import ModalShell from '../molecules/ModalShell.jsx'
|
|
|
44
43
|
* @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)
|
|
45
44
|
* @param {Function} props.onClose
|
|
46
45
|
* @param {string} [props.title] the header, beside the × (default `Shortcuts`)
|
|
47
|
-
* @param {'overlay'|'rail'|'
|
|
48
|
-
* never hand-builds the rail (kol-monitor's ShortcutsRail, 2026-10-18). `
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* dim close it. `kolbox` (Folio on kolbox, 2026-11-22): kolbox's S sheet, `CommandOverlay variant="kolbox"
|
|
53
|
-
* mode="shortcuts"`, from the same array (see `ShortcutsOverlayKolbox`)
|
|
46
|
+
* @param {'overlay'|'rail'|'search'} [props.variant] centred (default) or the right rail — SettingsPanel's two forms, so an
|
|
47
|
+
* app never hand-builds the rail (kol-monitor's ShortcutsRail, 2026-10-18). `search` (Folio on kolbox, 2026-11-22, its
|
|
48
|
+
* plain name since plan-2026-11-29-one-set-fold W3): the keymap in the search modal, `CommandOverlay mode="shortcuts"`
|
|
49
|
+
* with `groups`, from the same array (see `ShortcutsOverlaySearch`). The old theme words `kolbox` and `folio` are
|
|
50
|
+
* accepted and ask for `search` (on the retirement ledger); Folio's own flat list went to _tmp/2026-11-29-one-set-fold/.
|
|
54
51
|
* @param {string} [props.currentPath] sections may carry `routes: ['/rack']` (CommandOverlayModes, kol-monitor
|
|
55
52
|
* 2026-10-17 — user: *"im in dev, how can I cable lock here?"*): with a path, only the sections that work here
|
|
56
53
|
* are drawn (ShortcutsOverlayList, kol-monitor 2026-10-18 — the muted ELSEWHERE block is gone). A section without `routes`
|
|
@@ -63,46 +60,27 @@ export const shortcutInScope = (section, path) => !section?.routes?.length || pa
|
|
|
63
60
|
|
|
64
61
|
const isSectioned = (list) => Array.isArray(list?.[0]?.items)
|
|
65
62
|
|
|
66
|
-
/*
|
|
67
|
-
* the title on the header with the × beside it, a Divider, then the sections exactly as monitor's ⇧S rail draws
|
|
68
|
-
* them (LabeledControlSection divided · SettingsRow text · the combo in mono). Same props as before, plus `title`. */
|
|
69
|
-
function ShortcutsOverlayFolio({ shortcuts = [], onClose, title = 'Shortcuts' }) {
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
const esc = (e) => e.key === 'Escape' && onClose?.()
|
|
72
|
-
addEventListener('keydown', esc)
|
|
73
|
-
return () => removeEventListener('keydown', esc)
|
|
74
|
-
}, [onClose])
|
|
75
|
-
return (
|
|
76
|
-
<div className="kol-modal-dim--folio fixed inset-0 z-50 flex items-center justify-center px-[16px]" onMouseDown={onClose}>
|
|
77
|
-
<ModalShell variant="folio" role="dialog" aria-label={title} onMouseDown={(e) => e.stopPropagation()} className="kol-shortcuts--folio w-full max-w-[460px] gap-[4px] p-[20px]">
|
|
78
|
-
<p className="kol-folio-label kol-shortcuts-title--folio pb-[10px]">{title}</p>
|
|
79
|
-
{shortcuts.map((it) => (
|
|
80
|
-
<div key={it.label} className="kol-shortcuts-row--folio flex items-baseline justify-between gap-[16px] border-t py-[9px]">
|
|
81
|
-
<span className="kol-folio-body">{it.label}</span>
|
|
82
|
-
<kbd className="kol-folio-meta kol-shortcuts-combo--folio whitespace-nowrap">{it.combo ?? it.keys}</kbd>
|
|
83
|
-
</div>
|
|
84
|
-
))}
|
|
85
|
-
</ModalShell>
|
|
86
|
-
</div>
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/* `variant="kolbox"` (Folio on kolbox, 2026-11-22): kolbox's S sheet, which kolbox draws as `CommandOverlay variant="kolbox"
|
|
63
|
+
/* `variant="search"` (Folio on kolbox, 2026-11-22): the S sheet, which kolbox draws as the grouped `CommandOverlay
|
|
91
64
|
* mode="shortcuts"` (its WindowShortcuts), from the same `shortcuts`: one group under `title`; a sectioned list's sections
|
|
92
65
|
* are its folds, open. A combo that is one key chord is drawn as key caps, any other text (`S, or ⌥S while writing`) as
|
|
93
66
|
* the row's hint. The sheet keeps its own lit row; Escape and the dim close it. */
|
|
94
|
-
function
|
|
67
|
+
function ShortcutsOverlaySearch({ shortcuts = [], onClose, currentPath, title }) {
|
|
95
68
|
const [active, setActive] = useState(0)
|
|
96
69
|
const row = (it, i, at = '') => ({ id: `${at}${i}:${it.label}`, label: it.label, hint: it.combo ?? it.keys, kbd: isKeyCombo(it.combo ?? it.keys) })
|
|
97
70
|
const rows = isSectioned(shortcuts)
|
|
98
71
|
? shortcuts.filter((s) => shortcutInScope(s, currentPath)).map((s, n) => ({ id: `cat:${s.section ?? n}`, label: s.section, open: true, items: (s.items ?? []).map((it, i) => row(it, i, `${n}/`)) }))
|
|
99
72
|
: shortcuts.map((it, i) => row(it, i))
|
|
100
|
-
return <CommandOverlay
|
|
73
|
+
return <CommandOverlay open mode="shortcuts" onClose={onClose} groups={[{ title, rows }]} active={active} onActive={setActive} />
|
|
101
74
|
}
|
|
102
75
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
76
|
+
/* the old theme words in `variant`: accepted, they ask for `search` (W3, on the retirement ledger) */
|
|
77
|
+
const THEME_WORDS = ['kolbox', 'folio']
|
|
78
|
+
/* ONE OVERLAY, NOT TWO (user 2026-10-18, retiring the near-copy): the sheet is `SettingsPanel variant="overlay"` —
|
|
79
|
+
* the title on the header with the × beside it, a Divider, then the sections exactly as monitor's ⇧S rail draws
|
|
80
|
+
* them (LabeledControlSection divided · SettingsRow text · the combo in mono). Same props as before, plus `title`. */
|
|
81
|
+
export default function ShortcutsOverlay({ shortcuts = [], onClose, currentPath, title = 'Shortcuts', variant: variantProp = 'overlay' }) {
|
|
82
|
+
const variant = THEME_WORDS.includes(variantProp) ? 'search' : variantProp
|
|
83
|
+
if (variant === 'search') return <ShortcutsOverlaySearch shortcuts={shortcuts} onClose={onClose} currentPath={currentPath} title={title} />
|
|
106
84
|
const sections = isSectioned(shortcuts)
|
|
107
85
|
? shortcuts.filter((s) => shortcutInScope(s, currentPath))
|
|
108
86
|
: [{ items: shortcuts }]
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* StatusBar — a document's status along its foot (Folio's StatusBar, 2026-11-22): the counts on the left, the host's
|
|
3
3
|
* cells on the right (the format, the language, the zoom, the encoding). It holds no state; the cells are the host's.
|
|
4
|
-
* Spaces in `left` are kept (Folio spaces its counts with them).
|
|
5
|
-
*
|
|
4
|
+
* Spaces in `left` are kept (Folio spaces its counts with them). One bar (plan-2026-11-29-one-set-fold W4 run 1): 32 high
|
|
5
|
+
* on the rail ground, the rail line over it (`--kol-rail-line`, set by the theme), the help voice (11 / 15), the counts
|
|
6
|
+
* in oq-64; chrome in kol-theme `.kol-status-bar`. Folio's own bar (40, 56 in) went to
|
|
7
|
+
* `_tmp/2026-11-29-one-set-fold/StatusBar.pre-w4a.jsx`; `variant="kolbox"` and `"folio"` are accepted and draw this one.
|
|
6
8
|
*
|
|
7
9
|
* <StatusBar left="212 words 1,204 characters 18 lines">
|
|
8
|
-
* <Dropdown
|
|
10
|
+
* <Dropdown ... /><span>UTF-8 LF</span>
|
|
9
11
|
* </StatusBar>
|
|
10
12
|
*
|
|
11
|
-
* @param {'kolbox'|'folio'} [variant='kolbox'] - kolbox: 32 high on the rail ground, the kolbox line over it, the text
|
|
12
|
-
* kolbox's help voice (11 / 15), the counts in oq-64. folio: Folio's bar carried class for class (40, its rule, meta).
|
|
13
13
|
* @param {ReactNode} [left] - The text on the left
|
|
14
|
-
* @param {ReactNode} [children] - The right-hand cells, 16 apart
|
|
14
|
+
* @param {ReactNode} [children] - The right-hand cells, 16 apart
|
|
15
15
|
* @param {string} [className] - Extra classes on the bar
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<div className={`kol-status-bar--folio flex h-[40px] shrink-0 items-center justify-between gap-[24px] whitespace-pre border-t px-[56px] ${className}`.trim()}>
|
|
20
|
-
<p className="kol-status-bar-left">{left}</p>
|
|
21
|
-
<div className="flex items-center gap-[24px]">{children}</div>
|
|
22
|
-
</div>
|
|
23
|
-
)
|
|
17
|
+
// eslint-disable-next-line no-unused-vars
|
|
18
|
+
export default function StatusBar({ variant, left, children, className = '' }) {
|
|
24
19
|
return (
|
|
25
|
-
<div className={`kol-status-bar
|
|
20
|
+
<div className={`kol-status-bar flex h-8 shrink-0 items-center justify-between gap-4 whitespace-pre border-t pr-2 pl-3 ${className}`.trim()}>
|
|
26
21
|
<p className="kol-status-bar-left min-w-0 overflow-hidden text-ellipsis">{left}</p>
|
|
27
22
|
<div className="flex shrink-0 items-center gap-4">{children}</div>
|
|
28
23
|
</div>
|
|
@@ -51,12 +51,13 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
51
51
|
* @param {string} accentColor outline + handle + label color (default var(--kol-accent-primary))
|
|
52
52
|
* @param {Function} labelFormatter (box) => string — dimension readout (default `${round(w)} × ${round(h)}`)
|
|
53
53
|
* @param {string} rotateTitle tooltip on the rotate handle (default 'Rotate')
|
|
54
|
-
* @param {'
|
|
54
|
+
* @param {'corners'} variant the corner build (see CORNERS below); unset, the default build. The old theme words
|
|
55
|
+
* `kolbox` and `folio` are accepted and ask for `corners` (plan-2026-11-29-one-set-fold W3, on the ledger)
|
|
55
56
|
* @param {number} scale screen px per virtual px (default: the zoom); a host whose stage is also fitted passes
|
|
56
57
|
* fit × zoom so 1 screen px stays 1
|
|
57
58
|
*
|
|
58
|
-
*
|
|
59
|
-
* like in figma"): one solid 1 screen px accent line, four white 6 squares with a 1px accent edge at the corners only
|
|
59
|
+
* CORNERS (`variant="corners"`, was `variant="kolbox"`, plan-2026-11-19-kolbox-whats-left R2, his Figma reference "this is
|
|
60
|
+
* how shape looks like in figma"; its plain name since plan-2026-11-29-one-set-fold W3, decided for his review): one solid 1 screen px accent line, four white 6 squares with a 1px accent edge at the corners only
|
|
60
61
|
* (SelectionBox 28:9356's handle size), no name, and the size on an accent chip centred 8 px under the box (the design's
|
|
61
62
|
* label: medium 10 / 14, 8 by 2 in, radius 4, the accent's own ink). The sides and the rotate are NOT drawn but still
|
|
62
63
|
* answer the pointer: an 8 px band on each side (`data-handle` N, E, S, W, the resize cursors) and a 16 px zone just
|
|
@@ -78,6 +79,9 @@ const HANDLE_DIRS = [
|
|
|
78
79
|
* compensation — fxr's number. */
|
|
79
80
|
const ROTATE_OFFSET = 22
|
|
80
81
|
|
|
82
|
+
/* the old theme words in `variant`: accepted, they ask for `corners` (W3, on the retirement ledger) */
|
|
83
|
+
const THEME_WORDS = ['kolbox', 'folio']
|
|
84
|
+
|
|
81
85
|
export default function SelectionOverlay({
|
|
82
86
|
box,
|
|
83
87
|
showHandles = true,
|
|
@@ -96,7 +100,7 @@ export default function SelectionOverlay({
|
|
|
96
100
|
const zoom = useContext(CanvasZoomContext)
|
|
97
101
|
|
|
98
102
|
if (!box || box.x == null) return null /* no positional box → no chrome */
|
|
99
|
-
if (variant === '
|
|
103
|
+
if (variant === 'corners' || THEME_WORDS.includes(variant)) return <SelectionCorners box={box} s={scale || zoom || 1} showHandles={showHandles} showRotate={showRotate} showLabel={showLabel} labelFormatter={labelFormatter} />
|
|
100
104
|
|
|
101
105
|
const { x, y, w, h } = box
|
|
102
106
|
const size = handleSize / zoom
|
|
@@ -211,14 +215,14 @@ export default function SelectionOverlay({
|
|
|
211
215
|
)
|
|
212
216
|
}
|
|
213
217
|
|
|
214
|
-
/* the
|
|
215
|
-
const
|
|
218
|
+
/* the corner build (see the header): every screen-constant size is `n * px`, px being one screen px in virtual px */
|
|
219
|
+
const CORNERS = [
|
|
216
220
|
{ dir: 'NW', cursor: 'nwse-resize', x: 0, y: 0 },
|
|
217
221
|
{ dir: 'NE', cursor: 'nesw-resize', x: 1, y: 0 },
|
|
218
222
|
{ dir: 'SE', cursor: 'nwse-resize', x: 1, y: 1 },
|
|
219
223
|
{ dir: 'SW', cursor: 'nesw-resize', x: 0, y: 1 },
|
|
220
224
|
]
|
|
221
|
-
function
|
|
225
|
+
function SelectionCorners({ box, s, showHandles = true, showRotate, showLabel = true, labelFormatter }) {
|
|
222
226
|
const { x, y, w, h } = box
|
|
223
227
|
const px = 1 / s
|
|
224
228
|
const hs = 6 * px, band = 8 * px, rz = 16 * px
|
|
@@ -230,10 +234,10 @@ function KolboxSelection({ box, s, showHandles = true, showRotate, showLabel = t
|
|
|
230
234
|
const zone = { position: 'absolute', pointerEvents: 'auto' }
|
|
231
235
|
return (
|
|
232
236
|
<>
|
|
233
|
-
<div data-selection="
|
|
237
|
+
<div data-selection="corners" style={{ position: 'absolute', left: x, top: y, width: w, height: h, transform: rot ? `rotate(${rot}deg)` : undefined, pointerEvents: 'none', zIndex: 100 }}>
|
|
234
238
|
{/* a spread shadow, not an outline: an outline's width is rounded to whole layout px before the zoom scales it */}
|
|
235
239
|
<div data-selection-line style={{ position: 'absolute', inset: 0, boxShadow: `0 0 0 ${px}px ${accent}` }} />
|
|
236
|
-
{rotate &&
|
|
240
|
+
{rotate && CORNERS.map(({ dir, x: cx, y: cy }) => (
|
|
237
241
|
<div key={`r${dir}`} data-handle="ROT" style={{ ...zone, left: cx ? '100%' : -rz, top: cy ? '100%' : -rz, width: rz, height: rz, cursor: 'var(--kol-cursor-rotate, grab)' }} />
|
|
238
242
|
))}
|
|
239
243
|
{showHandles && (
|
|
@@ -242,7 +246,7 @@ function KolboxSelection({ box, s, showHandles = true, showRotate, showLabel = t
|
|
|
242
246
|
<div data-handle="S" style={{ ...zone, left: hs, right: hs, bottom: -band / 2, height: band, cursor: 'ns-resize' }} />
|
|
243
247
|
<div data-handle="W" style={{ ...zone, top: hs, bottom: hs, left: -band / 2, width: band, cursor: 'ew-resize' }} />
|
|
244
248
|
<div data-handle="E" style={{ ...zone, top: hs, bottom: hs, right: -band / 2, width: band, cursor: 'ew-resize' }} />
|
|
245
|
-
{
|
|
249
|
+
{CORNERS.map(({ dir, cursor, x: cx, y: cy }) => (
|
|
246
250
|
<div
|
|
247
251
|
key={dir}
|
|
248
252
|
data-handle={dir}
|