@kolkrabbi/kol-shell 0.120.0 → 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 +5 -5
- package/src/PropertyRail.jsx +27 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
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.
|
|
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.
|
|
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.362.0",
|
|
25
24
|
"@kolkrabbi/kol-icons": "^0.70.1",
|
|
26
25
|
"@kolkrabbi/kol-framework": "^0.74.1",
|
|
27
|
-
"@kolkrabbi/kol-
|
|
26
|
+
"@kolkrabbi/kol-component": "^0.363.0",
|
|
27
|
+
"@kolkrabbi/kol-theme": "^0.219.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
package/src/PropertyRail.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import { Button, Input, Dropdown, Slider, ToggleSwitch, TabsRow, floatSurfaceClass } from '@kolkrabbi/kol-component'
|
|
2
|
+
import { Button, Input, Dropdown, LabeledControl, Slider, ToggleSwitch, TabsRow, floatSurfaceClass } from '@kolkrabbi/kol-component'
|
|
3
3
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
4
4
|
|
|
5
5
|
/* taxonomy-ok: organism — a float sheet of kol-component fields (Input · Dropdown · Slider · ToggleSwitch · TabsRow) */
|
|
@@ -9,7 +9,7 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
9
9
|
* 16 in, 18 between) holding its header (the title in `kol-float-panel` and the collapse ⇥), chip tabs (TabsRow float),
|
|
10
10
|
* the selected object's line (glyph · name · eye) and sections — each a `kol-float-label` head with an optional + and
|
|
11
11
|
* rows that kol-component draws: `fields` two-up Inputs float, `select` a Dropdown, `slider` a Slider float with its
|
|
12
|
-
* 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
|
|
13
13
|
* exploration's `Floating properties inspector` (kol-float--style 9:9273); the section hairlines stay out (no-borders law).
|
|
14
14
|
*
|
|
15
15
|
* @param {string} title the header (Properties)
|
|
@@ -24,7 +24,7 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
24
24
|
* `{ type: 'switch', id?, label, icon?, on, onChange }` (ToggleSwitch float) ·
|
|
25
25
|
* `{ id?, render }` — anything else
|
|
26
26
|
* `{ type: 'labeled', id?, label, render }` — the tool Rail's row (generator Rails, plan-2026-11-05-float-editor
|
|
27
|
-
* W7.6): the label in
|
|
27
|
+
* W7.6): LabeledControl float `inline` — the label in the `--kol-float-label-w` column, the control in the rest ·
|
|
28
28
|
* `{ type: 'subhead', id?, label, meta? }` — a group's caps head inside a section (LIGHTS / POINT EDITOR) ·
|
|
29
29
|
* a section may also be `collapsible` (`open` · `onToggle(open)`): its head is the chevron and the
|
|
30
30
|
* title in `kol-float-panel`, `meta` at the far end, its rows shown while open
|
|
@@ -33,7 +33,9 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
33
33
|
* @param {Function} onExpand the ↗ in the header — the tool's expanded form (the settings dialog); unset, none
|
|
34
34
|
* @param {ReactNode} footer the Rail's foot (a status line, the tool's action), after the sections
|
|
35
35
|
* @param {'solid'|'glass-dark'|'glass-light'} surface what the sheet is made of (default `solid`)
|
|
36
|
-
* @param {
|
|
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
|
|
37
39
|
* @param {boolean} foldable the fold ⌃ in the header: the Rail folds to its header pill and opens again — every float
|
|
38
40
|
* panel is a module (the user, 2026-11-12: *"EVERYTHING IS FLOAT everything is MODULES"*)
|
|
39
41
|
* @param {boolean} folded controlled; `defaultFolded` uncontrolled · `onFold(folded)` on every press. Folded, only the
|
|
@@ -42,13 +44,13 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
42
44
|
* Labs' params)
|
|
43
45
|
* @param {string} className
|
|
44
46
|
*/
|
|
45
|
-
export default function PropertyRail({ title, onCollapse, onExpand, density = 'regular', tabs, tab, onTab, selected, sections = [], footer, surface = 'solid',
|
|
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 = '' }) {
|
|
46
48
|
const compact = density === 'compact'
|
|
47
49
|
const [ownFolded, setOwnFolded] = useState(defaultFolded)
|
|
48
50
|
const isFolded = foldable && (folded ?? ownFolded)
|
|
49
51
|
const fold = () => { const next = !isFolded; if (folded === undefined) setOwnFolded(next); onFold?.(next) }
|
|
50
52
|
return (
|
|
51
|
-
<div className={`kol-property-rail kol-float-chrome flex flex-col ${compact ? 'gap-2' : 'gap-[
|
|
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' : ''})` }}>
|
|
52
54
|
<div className="flex items-center justify-between">
|
|
53
55
|
<span className="kol-float-panel text-emphasis">{title}</span>
|
|
54
56
|
<span className="flex items-center gap-1">
|
|
@@ -69,11 +71,11 @@ export default function PropertyRail({ title, onCollapse, onExpand, density = 'r
|
|
|
69
71
|
</div>
|
|
70
72
|
)}
|
|
71
73
|
{sections.map((s, i) => (
|
|
72
|
-
<section key={s.id ?? s.label ?? i} className={`flex flex-col ${compact ? `gap-2${i > 0 ? ' pt-4' : ''}` : 'gap-[
|
|
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}>
|
|
73
75
|
{s.collapsible ? (
|
|
74
76
|
<button type="button" aria-expanded={!!s.open} onClick={() => s.onToggle?.(!s.open)}
|
|
75
77
|
className="flex items-center gap-1.5 text-left focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] rounded-sm">
|
|
76
|
-
<IconLoader name="chevron-down" size=
|
|
78
|
+
<IconLoader name="chevron-down" size="var(--kol-float-chev-sm)" className={`text-oq-64 transition-transform ${s.open ? '' : '-rotate-90'}`} />
|
|
77
79
|
<span className="kol-float-panel text-emphasis flex-1 min-w-0">{s.label}</span>
|
|
78
80
|
{s.meta && <span className="kol-float-timecode text-oq-64">{s.meta}</span>}
|
|
79
81
|
</button>
|
|
@@ -94,13 +96,14 @@ export default function PropertyRail({ title, onCollapse, onExpand, density = 'r
|
|
|
94
96
|
)
|
|
95
97
|
}
|
|
96
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 */
|
|
97
101
|
function Row({ row: r, compact }) {
|
|
98
102
|
if (r.type === 'labeled') {
|
|
99
103
|
return (
|
|
100
|
-
<
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
</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>
|
|
104
107
|
)
|
|
105
108
|
}
|
|
106
109
|
if (r.type === 'subhead') {
|
|
@@ -122,25 +125,23 @@ function Row({ row: r, compact }) {
|
|
|
122
125
|
)
|
|
123
126
|
}
|
|
124
127
|
if (r.type === 'select') {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{r.label && <span className="kol-float-hint text-oq-64">{r.label}</span>}
|
|
128
|
-
<Dropdown variant="float" size="md" options={r.options} value={r.value} onChange={r.onChange} aria-label={r.label} className="w-full" />
|
|
129
|
-
</div>
|
|
130
|
-
)
|
|
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
|
|
131
130
|
}
|
|
132
131
|
if (r.type === 'slider') {
|
|
133
|
-
|
|
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
|
+
)
|
|
134
138
|
}
|
|
135
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
|
|
136
141
|
return (
|
|
137
|
-
<
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
{r.label}
|
|
141
|
-
</span>
|
|
142
|
-
<ToggleSwitch variant="float" checked={!!r.on} onChange={r.onChange} aria-label={r.label} />
|
|
143
|
-
</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>
|
|
144
145
|
)
|
|
145
146
|
}
|
|
146
147
|
return null
|