@kolkrabbi/kol-shell 0.111.0 → 0.113.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-shell",
3
- "version": "0.111.0",
3
+ "version": "0.113.0",
4
4
  "private": false,
5
5
  "description": "The application shell",
6
6
  "license": "MIT",
@@ -21,10 +21,10 @@
21
21
  "react-dom": "^18.3.0 || ^19.0.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@kolkrabbi/kol-component": "^0.343.0",
24
+ "@kolkrabbi/kol-component": "^0.344.0",
25
25
  "@kolkrabbi/kol-icons": "^0.66.0",
26
- "@kolkrabbi/kol-framework": "^0.70.0",
27
- "@kolkrabbi/kol-theme": "^0.212.0"
26
+ "@kolkrabbi/kol-theme": "^0.214.0",
27
+ "@kolkrabbi/kol-framework": "^0.70.0"
28
28
  },
29
29
  "files": [
30
30
  "src",
@@ -22,16 +22,29 @@ import { Icon } from '@kolkrabbi/kol-icons'
22
22
  * `{ type: 'slider', id?, label, value, onChange, min?, max?, step?, formatValue? }` (Slider float) ·
23
23
  * `{ type: 'switch', id?, label, icon?, on, onChange }` (ToggleSwitch float) ·
24
24
  * `{ id?, render }` — anything else
25
+ * `{ type: 'labeled', id?, label, render }` — the tool Rail's row (generator Rails, plan-2026-11-05-float-editor
26
+ * W7.6): the label in a 110 column, the control in the rest ·
27
+ * `{ type: 'subhead', id?, label, meta? }` — a group's caps head inside a section (LIGHTS / POINT EDITOR) ·
28
+ * a section may also be `collapsible` (`open` · `onToggle(open)`): its head is the chevron and the
29
+ * title in `kol-float-panel`, `meta` at the far end, its rows shown while open
30
+ * @param {'regular'|'compact'} density `compact` — the tool Rail's rhythm (his generator frames 32:16215): 8 between rows,
31
+ * 24 before a section, 20 before a subhead; `regular` (default) the inspector's 18
32
+ * @param {Function} onExpand the ↗ in the header — the tool's expanded form (the settings dialog); unset, none
33
+ * @param {ReactNode} footer the Rail's foot (a status line, the tool's action), after the sections
25
34
  * @param {'solid'|'glass-dark'|'glass-light'} surface what the sheet is made of (default `solid`)
26
35
  * @param {number} width the sheet's width (default 272)
27
36
  * @param {string} className
28
37
  */
29
- export default function PropertyRail({ title, onCollapse, tabs, tab, onTab, selected, sections = [], surface = 'solid', width = 272, className = '' }) {
38
+ export default function PropertyRail({ title, onCollapse, onExpand, density = 'regular', tabs, tab, onTab, selected, sections = [], footer, surface = 'solid', width = 272, className = '' }) {
39
+ const compact = density === 'compact'
30
40
  return (
31
- <div className={`kol-property-rail kol-float-chrome flex flex-col gap-[18px] p-4 rounded-[var(--kol-float-menu-r)] ${floatSurfaceClass(surface, true)} ${className}`.trim()} style={{ width }}>
41
+ <div className={`kol-property-rail kol-float-chrome flex flex-col ${compact ? 'gap-2' : 'gap-[18px]'} p-4 rounded-[var(--kol-float-menu-r)] ${floatSurfaceClass(surface, true)} ${className}`.trim()} style={{ width }}>
32
42
  <div className="flex items-center justify-between">
33
43
  <span className="kol-float-panel text-emphasis">{title}</span>
34
- {onCollapse && <Button variant="float" tone="ghost" size="sm" iconOnly="skip-end" aria-label="Collapse" onClick={onCollapse} />}
44
+ <span className="flex items-center gap-1">
45
+ {onExpand && <Button variant="float" tone="ghost" size="sm" iconOnly="arrow-upright" aria-label="Expand" onClick={onExpand} />}
46
+ {onCollapse && <Button variant="float" tone="ghost" size="sm" iconOnly="skip-end" aria-label="Collapse" onClick={onCollapse} />}
47
+ </span>
35
48
  </div>
36
49
  {tabs?.length > 0 && <TabsRow variant="float" size="xs" tabs={tabs} value={tab} onChange={onTab} ariaLabel={`${title} tabs`} />}
37
50
  {selected && (
@@ -44,22 +57,46 @@ export default function PropertyRail({ title, onCollapse, tabs, tab, onTab, sele
44
57
  </div>
45
58
  )}
46
59
  {sections.map((s, i) => (
47
- <section key={s.id ?? s.label ?? i} className="flex flex-col gap-[18px]">
48
- {(s.label || s.onAdd || s.meta) && (
60
+ <section key={s.id ?? s.label ?? i} className={`flex flex-col ${compact ? `gap-2${i > 0 ? ' pt-4' : ''}` : 'gap-[18px]'}`} data-section={s.id ?? s.label}>
61
+ {s.collapsible ? (
62
+ <button type="button" aria-expanded={!!s.open} onClick={() => s.onToggle?.(!s.open)}
63
+ className="flex items-center gap-1.5 text-left focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] rounded-sm">
64
+ <Icon name="chevron-down" size={12} className={`text-oq-64 transition-transform ${s.open ? '' : '-rotate-90'}`} />
65
+ <span className="kol-float-panel text-emphasis flex-1 min-w-0">{s.label}</span>
66
+ {s.meta && <span className="kol-float-timecode text-oq-64">{s.meta}</span>}
67
+ </button>
68
+ ) : (s.label || s.onAdd || s.meta) && (
49
69
  <div className="flex items-center justify-between">
50
70
  <span className="kol-float-label text-oq-64">{s.label}</span>
51
71
  {s.onAdd && <Button variant="float" tone="ghost" size="sm" iconOnly="plus" aria-label={`Add to ${s.label}`} onClick={s.onAdd} />}
52
72
  {s.meta && <span className="kol-float-timecode text-emphasis">{s.meta}</span>}
53
73
  </div>
54
74
  )}
55
- {(s.rows ?? []).map((r, j) => <Row key={r.id ?? j} row={r} />)}
75
+ {(!s.collapsible || s.open) && (s.rows ?? []).map((r, j) => <Row key={r.id ?? j} row={r} compact={compact} />)}
56
76
  </section>
57
77
  ))}
78
+ {footer && <div className={compact ? 'pt-4' : undefined}>{footer}</div>}
58
79
  </div>
59
80
  )
60
81
  }
61
82
 
62
- function Row({ row: r }) {
83
+ function Row({ row: r, compact }) {
84
+ if (r.type === 'labeled') {
85
+ return (
86
+ <div className="flex items-center gap-1.5 min-h-7" data-control={r.label}>
87
+ <span className="kol-float-hint text-oq-64 w-[110px] shrink-0 truncate">{r.label}</span>
88
+ <div className="flex-1 min-w-0 flex items-center gap-1.5">{r.render()}</div>
89
+ </div>
90
+ )
91
+ }
92
+ if (r.type === 'subhead') {
93
+ return (
94
+ <div className={`flex items-center justify-between ${compact ? 'pt-3' : 'pt-1'}`}>
95
+ <span className="kol-float-label text-oq-64">{r.label}</span>
96
+ {r.meta && <span className="kol-float-label text-fg-emphasis">{r.meta}</span>}
97
+ </div>
98
+ )
99
+ }
63
100
  if (r.render) return r.render()
64
101
  if (r.type === 'fields') {
65
102
  return (
package/src/ToolRail.jsx CHANGED
@@ -19,8 +19,13 @@ import { Icon } from '@kolkrabbi/kol-icons'
19
19
  * @param {string} className the rail's — or, with `more`, the column's that holds the rail and its ⋮
20
20
  * @param {'vertical'|'horizontal'} orientation THE PHONE ROW (plan-2026-11-05-float-editor W2.7; his frame 06 19:8598):
21
21
  * `horizontal` lays the slots in a row and names them above; default `vertical`
22
+ * THE DOCK (7.7; his float-more 30:914) is the horizontal rail with these three:
23
+ * a tool's own `more` (`[{ id?, label, icon, kbd?, onClick? }]`) draws its ▾ beside the slot, the
24
+ * list rising above; a member with an `id` arms that tool and the slot then shows it
25
+ * @param {ReactNode} end after a rule — the dock's hand and undo
26
+ * @param {Object} search `{ onPress, kbd?, label?, pressed? }` — the ⌘K pill at the dock's end, after a rule
22
27
  */
23
- export default function ToolRail({ tools = [], value, onChange, surface = 'solid', more, orientation = 'vertical', className = '' }) {
28
+ export default function ToolRail({ tools = [], value, onChange, surface = 'solid', more, orientation = 'vertical', end, search, className = '' }) {
24
29
  const row = orientation === 'horizontal'
25
30
  if (more?.length && !row) {
26
31
  return (
@@ -31,33 +36,60 @@ export default function ToolRail({ tools = [], value, onChange, surface = 'solid
31
36
  )
32
37
  }
33
38
  return (
34
- <div role="toolbar" aria-orientation={orientation} aria-label="Tools" className={`kol-tool-rail kol-float-chrome inline-flex ${row ? 'flex-row' : 'flex-col'} gap-1 p-1.5 rounded-full ${floatSurfaceClass(surface)} ${className}`.trim()}>
35
- {tools.map((t) => (
36
- <Tooltip key={t.id} variant="float" placement={row ? 'top' : 'right'} offset={12} label={t.label} shortcut={t.kbd}>
37
- {/* every slot at full ink, armed or not (his frame 19:6071 — W1.3; the ghost tone's oq-48 read as disabled) */}
38
- <Button variant="float" tone="ghost" iconOnly={t.icon} aria-label={t.label} pressed={t.id === value} onClick={() => onChange?.(t.id)} className="[--kol-tone-fg:var(--kol-oq-96)]" />
39
- </Tooltip>
40
- ))}
39
+ <div role="toolbar" aria-orientation={orientation} aria-label="Tools" className={`kol-tool-rail kol-float-chrome inline-flex ${row ? 'flex-row items-center' : 'flex-col'} gap-1 p-1.5 rounded-full ${floatSurfaceClass(surface)} ${className}`.trim()}>
40
+ {tools.map((t) => {
41
+ /* a slot with its own ▾ shows the member armed from it (the dock's Shapes slot reads Ellipse once Ellipse is picked) */
42
+ const shown = t.more?.find((m) => m.id != null && m.id === value) ?? t
43
+ const slot = (
44
+ <Tooltip key={t.id} variant="float" placement={row ? 'top' : 'right'} offset={12} label={shown.label} shortcut={shown.kbd}>
45
+ {/* every slot at full ink, armed or not (his frame 19:6071 — W1.3; the ghost tone's oq-48 read as disabled) */}
46
+ <Button variant="float" tone="ghost" iconOnly={shown.icon} aria-label={shown.label} pressed={shown.id === value || t.id === value}
47
+ onClick={() => (shown.onClick ? shown.onClick() : onChange?.(shown.id))} className="[--kol-tone-fg:var(--kol-oq-96)]" />
48
+ </Tooltip>
49
+ )
50
+ return t.more?.length && row
51
+ ? <span key={t.id} className="inline-flex items-center">{slot}<ToolMore items={t.more} surface={surface} chevron label={`${t.label} tools`} onPick={(m) => (m.onClick ? m.onClick() : onChange?.(m.id))} active={value} /></span>
52
+ : slot
53
+ })}
54
+ {end && <><span aria-hidden className="mx-2 h-6 w-px shrink-0 bg-fg-08" />{end}</>}
55
+ {search && <><span aria-hidden className="mx-2 h-6 w-px shrink-0 bg-fg-08" /><ToolSearchPill {...search} /></>}
41
56
  </div>
42
57
  )
43
58
  }
44
59
 
45
- /* the ⋮ under the rail and its list, to the right, top edges on one line */
46
- function ToolMore({ items, surface }) {
60
+ /* the dock's ⌘K pill (his float-more 30:914): the search glyph and its key on the float well, at the slot's height;
61
+ * `kbd: null` (a phone has no ⌘) draws the glyph alone */
62
+ function ToolSearchPill({ onPress, kbd = '⌘K', label = 'Search', pressed }) {
63
+ return (
64
+ <Tooltip variant="float" placement="top" offset={12} label={label} shortcut={kbd}>
65
+ <Button variant="float" tone="ghost" aria-label={label} pressed={pressed} onClick={onPress}
66
+ className={`kol-tool-search gap-2 ${kbd ? 'px-4' : 'px-2.5'} bg-[var(--kol-float-well)] [--kol-tone-fg:var(--kol-oq-96)]`}>
67
+ <Icon name="search" size="var(--kol-float-ic)" />
68
+ {kbd && <span className="kol-float-panel">{kbd}</span>}
69
+ </Button>
70
+ </Tooltip>
71
+ )
72
+ }
73
+
74
+ /* the ⋮ under the rail and its list, to the right, top edges on one line — or, `chevron`, a slot's ▾ in the dock, its
75
+ * list rising above it */
76
+ function ToolMore({ items, surface, chevron = false, label = 'More tools', onPick, active }) {
47
77
  const [open, setOpen] = useState(false)
48
- const pop = usePopover({ open, onOpenChange: setOpen, placement: 'right-start', offset: 12 })
78
+ const pop = usePopover({ open, onOpenChange: setOpen, placement: chevron ? 'top-start' : 'right-start', offset: 12 })
49
79
  return (
50
80
  <>
51
- <span ref={pop.refs.setReference} {...pop.getReferenceProps()} className={`kol-float-chrome inline-flex rounded-full ${floatSurfaceClass(surface)}`}>
52
- <Button variant="float" tone="ghost" iconOnly="more-vertical" aria-label="More tools" pressed={open} className="[--kol-tone-fg:var(--kol-oq-96)]" />
81
+ <span ref={pop.refs.setReference} {...pop.getReferenceProps()} className={chevron ? 'inline-flex' : `kol-float-chrome inline-flex rounded-full ${floatSurfaceClass(surface)}`}>
82
+ <Button variant="float" tone="ghost" iconOnly={chevron ? 'chevron-down' : 'more-vertical'} aria-label={label} pressed={open}
83
+ className={chevron ? 'kol-tool-chevron [--kol-tone-fg:var(--kol-oq-64)]' : '[--kol-tone-fg:var(--kol-oq-96)]'} />
53
84
  </span>
54
85
  {open && (
55
86
  <PopoverPanel popover={pop} panel={false} focus={false}>
56
87
  <MenuPanel variant="float" className="min-w-[200px]">
57
88
  {items.map((it) => (
58
89
  <MenuRow key={it.label} rowClass="kol-menu-row kol-helper-12" kbd={it.kbd} disabled={it.disabled}
90
+ indicator={chevron && it.id != null && it.id === active ? 'dot' : undefined}
59
91
  iconLeft={it.icon && <Icon name={it.icon} size={16} className="text-oq-88" />}
60
- onClick={() => { setOpen(false); it.onClick?.() }}>{it.label}</MenuRow>
92
+ onClick={() => { setOpen(false); onPick ? onPick(it) : it.onClick?.() }}>{it.label}</MenuRow>
61
93
  ))}
62
94
  </MenuPanel>
63
95
  </PopoverPanel>