@kolkrabbi/kol-shell 0.119.1 → 0.121.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.119.1",
3
+ "version": "0.121.0",
4
4
  "private": false,
5
5
  "description": "The application shell",
6
6
  "license": "MIT",
@@ -12,19 +12,19 @@
12
12
  "./src/*": "./src/*"
13
13
  },
14
14
  "peerDependencies": {
15
- "@kolkrabbi/kol-component": ">=0.349.0",
15
+ "@kolkrabbi/kol-component": ">=0.363.0",
16
16
  "@kolkrabbi/kol-framework": ">=0.55.0",
17
17
  "@kolkrabbi/kol-icons": ">=0.69.0",
18
- "@kolkrabbi/kol-theme": ">=0.215.0",
18
+ "@kolkrabbi/kol-theme": ">=0.219.0",
19
19
  "gsap": "^3.13.0",
20
20
  "react": "^18.3.0 || ^19.0.0",
21
21
  "react-dom": "^18.3.0 || ^19.0.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@kolkrabbi/kol-component": "^0.361.1",
25
24
  "@kolkrabbi/kol-icons": "^0.70.1",
26
25
  "@kolkrabbi/kol-framework": "^0.74.1",
27
- "@kolkrabbi/kol-theme": "^0.217.0"
26
+ "@kolkrabbi/kol-component": "^0.363.0",
27
+ "@kolkrabbi/kol-theme": "^0.219.0"
28
28
  },
29
29
  "files": [
30
30
  "src",
@@ -1,4 +1,5 @@
1
- import { Button, Input, Dropdown, Slider, ToggleSwitch, TabsRow, floatSurfaceClass } from '@kolkrabbi/kol-component'
1
+ import { useState } from 'react'
2
+ import { Button, Input, Dropdown, LabeledControl, Slider, ToggleSwitch, TabsRow, floatSurfaceClass } from '@kolkrabbi/kol-component'
2
3
  import { IconLoader } from '@kolkrabbi/kol-icons'
3
4
 
4
5
  /* taxonomy-ok: organism — a float sheet of kol-component fields (Input · Dropdown · Slider · ToggleSwitch · TabsRow) */
@@ -8,7 +9,7 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
8
9
  * 16 in, 18 between) holding its header (the title in `kol-float-panel` and the collapse ⇥), chip tabs (TabsRow float),
9
10
  * the selected object's line (glyph · name · eye) and sections — each a `kol-float-label` head with an optional + and
10
11
  * rows that kol-component draws: `fields` two-up Inputs float, `select` a Dropdown, `slider` a Slider float with its
11
- * readout, `switch` a ToggleSwitch float, or `render`. Nothing is forked: the sheet is the only new chrome. The
12
+ * readout, `switch` a ToggleSwitch float, or `render`. Every labelled row is `LabeledControl variant="float"`. Nothing is forked: the sheet is the only new chrome. The
12
13
  * exploration's `Floating properties inspector` (kol-float--style 9:9273); the section hairlines stay out (no-borders law).
13
14
  *
14
15
  * @param {string} title the header (Properties)
@@ -23,7 +24,7 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
23
24
  * `{ type: 'switch', id?, label, icon?, on, onChange }` (ToggleSwitch float) ·
24
25
  * `{ id?, render }` — anything else
25
26
  * `{ 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
+ * W7.6): LabeledControl float `inline` — the label in the `--kol-float-label-w` column, the control in the rest ·
27
28
  * `{ type: 'subhead', id?, label, meta? }` — a group's caps head inside a section (LIGHTS / POINT EDITOR) ·
28
29
  * a section may also be `collapsible` (`open` · `onToggle(open)`): its head is the chevron and the
29
30
  * title in `kol-float-panel`, `meta` at the far end, its rows shown while open
@@ -32,20 +33,33 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
32
33
  * @param {Function} onExpand the ↗ in the header — the tool's expanded form (the settings dialog); unset, none
33
34
  * @param {ReactNode} footer the Rail's foot (a status line, the tool's action), after the sections
34
35
  * @param {'solid'|'glass-dark'|'glass-light'} surface what the sheet is made of (default `solid`)
35
- * @param {number} width the sheet's width (default 272)
36
+ * @param {boolean} wide the wide module (`--kol-float-module-w-wide`, 352): a tool Rail whose rows carry two controls;
37
+ * unset, the inspector (`--kol-float-module-w`, 272) — the two module widths of the float spec
38
+ * @param {number|string} width an explicit width (a phone's `100%`); unset, the module width
39
+ * @param {boolean} foldable the fold ⌃ in the header: the Rail folds to its header pill and opens again — every float
40
+ * panel is a module (the user, 2026-11-12: *"EVERYTHING IS FLOAT everything is MODULES"*)
41
+ * @param {boolean} folded controlled; `defaultFolded` uncontrolled · `onFold(folded)` on every press. Folded, only the
42
+ * header shows, on the same sheet
43
+ * @param {ReactNode} children the body slot, after the sections — a panel that is not rows (ReadingContents' `bare` body,
44
+ * Labs' params)
36
45
  * @param {string} className
37
46
  */
38
- export default function PropertyRail({ title, onCollapse, onExpand, density = 'regular', tabs, tab, onTab, selected, sections = [], footer, surface = 'solid', width = 272, className = '' }) {
47
+ export default function PropertyRail({ title, onCollapse, onExpand, density = 'regular', tabs, tab, onTab, selected, sections = [], footer, surface = 'solid', wide = false, width, foldable = false, folded, defaultFolded = false, onFold, children, className = '' }) {
39
48
  const compact = density === 'compact'
49
+ const [ownFolded, setOwnFolded] = useState(defaultFolded)
50
+ const isFolded = foldable && (folded ?? ownFolded)
51
+ const fold = () => { const next = !isFolded; if (folded === undefined) setOwnFolded(next); onFold?.(next) }
40
52
  return (
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 }}>
53
+ <div className={`kol-property-rail kol-float-chrome flex flex-col ${compact ? 'gap-2' : 'gap-[var(--kol-float-module-gap)]'} p-4 rounded-[var(--kol-float-menu-r)] ${floatSurfaceClass(surface, true)} ${className}`.trim()} style={{ width: width ?? `var(--kol-float-module-w${wide ? '-wide' : ''})` }}>
42
54
  <div className="flex items-center justify-between">
43
55
  <span className="kol-float-panel text-emphasis">{title}</span>
44
56
  <span className="flex items-center gap-1">
57
+ {foldable && <Button variant="float" tone="ghost" size="sm" iconOnly={isFolded ? 'chevron-down' : 'chevron-up'} aria-label={isFolded ? 'Open' : 'Fold'} aria-expanded={!isFolded} onClick={fold} />}
45
58
  {onExpand && <Button variant="float" tone="ghost" size="sm" iconOnly="arrow-upright" aria-label="Expand" onClick={onExpand} />}
46
59
  {onCollapse && <Button variant="float" tone="ghost" size="sm" iconOnly="panel-right" aria-label="Collapse" onClick={onCollapse} />}
47
60
  </span>
48
61
  </div>
62
+ {!isFolded && <>
49
63
  {tabs?.length > 0 && <TabsRow variant="float" size="xs" tabs={tabs} value={tab} onChange={onTab} ariaLabel={`${title} tabs`} />}
50
64
  {selected && (
51
65
  <div className="flex items-center gap-2">
@@ -57,11 +71,11 @@ export default function PropertyRail({ title, onCollapse, onExpand, density = 'r
57
71
  </div>
58
72
  )}
59
73
  {sections.map((s, i) => (
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}>
74
+ <section key={s.id ?? s.label ?? i} className={`flex flex-col ${compact ? `gap-2${i > 0 ? ' pt-4' : ''}` : 'gap-[var(--kol-float-module-gap)]'}`} data-section={s.id ?? s.label}>
61
75
  {s.collapsible ? (
62
76
  <button type="button" aria-expanded={!!s.open} onClick={() => s.onToggle?.(!s.open)}
63
77
  className="flex items-center gap-1.5 text-left focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] rounded-sm">
64
- <IconLoader name="chevron-down" size={12} className={`text-oq-64 transition-transform ${s.open ? '' : '-rotate-90'}`} />
78
+ <IconLoader name="chevron-down" size="var(--kol-float-chev-sm)" className={`text-oq-64 transition-transform ${s.open ? '' : '-rotate-90'}`} />
65
79
  <span className="kol-float-panel text-emphasis flex-1 min-w-0">{s.label}</span>
66
80
  {s.meta && <span className="kol-float-timecode text-oq-64">{s.meta}</span>}
67
81
  </button>
@@ -75,18 +89,21 @@ export default function PropertyRail({ title, onCollapse, onExpand, density = 'r
75
89
  {(!s.collapsible || s.open) && (s.rows ?? []).map((r, j) => <Row key={r.id ?? j} row={r} compact={compact} />)}
76
90
  </section>
77
91
  ))}
92
+ {children}
78
93
  {footer && <div className={compact ? 'pt-4' : undefined}>{footer}</div>}
94
+ </>}
79
95
  </div>
80
96
  )
81
97
  }
82
98
 
99
+ /* every row with a label is LabeledControl float (plan-2026-11-12-float-system W2.1): the label column and gap are the
100
+ * spec's tokens, the control bare in its cell */
83
101
  function Row({ row: r, compact }) {
84
102
  if (r.type === 'labeled') {
85
103
  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>
104
+ <LabeledControl variant="float" inline label={r.label} className="w-full">
105
+ <div className="flex w-full min-w-0 items-center gap-1.5" data-control={r.label}>{r.render()}</div>
106
+ </LabeledControl>
90
107
  )
91
108
  }
92
109
  if (r.type === 'subhead') {
@@ -108,25 +125,23 @@ function Row({ row: r, compact }) {
108
125
  )
109
126
  }
110
127
  if (r.type === 'select') {
111
- return (
112
- <div className="flex flex-col gap-[7px]">
113
- {r.label && <span className="kol-float-hint text-oq-64">{r.label}</span>}
114
- <Dropdown variant="float" size="md" options={r.options} value={r.value} onChange={r.onChange} aria-label={r.label} className="w-full" />
115
- </div>
116
- )
128
+ const dd = <Dropdown variant="float" size="md" options={r.options} value={r.value} onChange={r.onChange} aria-label={r.label} className="w-full" />
129
+ return r.label ? <LabeledControl variant="float" label={r.label}>{dd}</LabeledControl> : dd
117
130
  }
118
131
  if (r.type === 'slider') {
119
- return <Slider variant="float" readout="value" label={r.label} value={r.value} onChange={r.onChange} min={r.min} max={r.max} step={r.step} formatValue={r.formatValue} className="w-full" />
132
+ const shown = r.formatValue ? r.formatValue(r.value) : r.value
133
+ return (
134
+ <LabeledControl variant="float" label={r.label} hint={shown}>
135
+ <Slider variant="float" aria-label={r.label} value={r.value} onChange={r.onChange} min={r.min} max={r.max} step={r.step} className="w-full" />
136
+ </LabeledControl>
137
+ )
120
138
  }
121
139
  if (r.type === 'switch') {
140
+ const label = r.icon ? <span className="inline-flex items-center gap-1.5"><IconLoader name={r.icon} size={16} className="text-oq-96" />{r.label}</span> : r.label
122
141
  return (
123
- <div className="flex items-center justify-between gap-2">
124
- <span className="kol-float-panel text-emphasis inline-flex items-center gap-1.5">
125
- {r.icon && <IconLoader name={r.icon} size={16} className="text-oq-96" />}
126
- {r.label}
127
- </span>
128
- <ToggleSwitch variant="float" checked={!!r.on} onChange={r.onChange} aria-label={r.label} />
129
- </div>
142
+ <LabeledControl variant="float" inline label={label}>
143
+ <div className="flex w-full justify-end"><ToggleSwitch variant="float" checked={!!r.on} onChange={r.onChange} aria-label={r.label} /></div>
144
+ </LabeledControl>
130
145
  )
131
146
  }
132
147
  return null