@kolkrabbi/kol-shell 0.110.0 → 0.112.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 +4 -4
- package/src/MenuBar.jsx +17 -2
- package/src/PropertyRail.jsx +44 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.112.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.342.0",
|
|
25
|
-
"@kolkrabbi/kol-icons": "^0.65.0",
|
|
26
24
|
"@kolkrabbi/kol-framework": "^0.70.0",
|
|
27
|
-
"@kolkrabbi/kol-
|
|
25
|
+
"@kolkrabbi/kol-component": "^0.343.0",
|
|
26
|
+
"@kolkrabbi/kol-icons": "^0.66.0",
|
|
27
|
+
"@kolkrabbi/kol-theme": "^0.213.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
package/src/MenuBar.jsx
CHANGED
|
@@ -17,6 +17,10 @@ import { Icon } from '@kolkrabbi/kol-icons'
|
|
|
17
17
|
* @param {string|Object} app the app's name ("FXR"), or a menu `{ label, items }` when the name opens the app menu
|
|
18
18
|
* @param {Array} menus `[{ label, items, width? }]` — `width` the list's (default 250)
|
|
19
19
|
* @param {Array} end the same, at the bar's far end (Help)
|
|
20
|
+
* @param {'bar'|'capsule'} variant `capsule` (plan-2026-11-05-float-editor W2b; his phone frame 06, 19:9544 — the Section 4
|
|
21
|
+
* menu capsule 19:10617): the menus on a float sheet (the secondary surface, the window round,
|
|
22
|
+
* 20 in), each trigger the float label role in caps at fg-48 with a 10 chevron, 12 apart,
|
|
23
|
+
* lit fg-96 while open. The same menus, lists and keys as the bar.
|
|
20
24
|
* @param {string} className
|
|
21
25
|
*
|
|
22
26
|
* A row in `items` (Menu's own row keys): `{ label, onClick, kbd?, disabled?, checked?, indicator?, icon?, tone? }` ·
|
|
@@ -25,6 +29,8 @@ import { Icon } from '@kolkrabbi/kol-icons'
|
|
|
25
29
|
const ROW = 'kol-menubar-row w-full shrink-0 flex items-center gap-2 h-6 px-2 rounded-[var(--kol-radius-sm)] text-left font-[family-name:var(--kol-font-family-sans)] text-[13px] font-medium leading-normal text-[color:var(--kol-fg-emphasis)] hover:bg-[var(--kol-fg-08)] aria-expanded:bg-[var(--kol-fg-08)] disabled:opacity-40 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:bg-[var(--kol-fg-08)]'
|
|
26
30
|
/* the list: the secondary surface, a 2% rim, 4 in, the large shadow; the key cap on the rim's fill, its ink oq-80 */
|
|
27
31
|
const LIST = 'kol-menubar-list flex flex-col bg-[var(--kol-surface-secondary)] border border-[var(--kol-fg-02)] rounded-[var(--kol-radius-sm)] p-1 shadow-[0_10px_15px_rgba(0,0,0,0.1)] [&_.kol-menu-kbd]:bg-[var(--kol-fg-02)] [&_.kol-menu-kbd]:border [&_.kol-menu-kbd]:border-[var(--kol-fg-02)] [&_.kol-menu-kbd]:text-[var(--kol-oq-80)] [&_.kol-menu-kbd]:rounded-[2px]'
|
|
32
|
+
/* the capsule's trigger (his 19:9544): Inter 11 caps at fg-48, the chevron 8 after, 26 tall, the text on the top */
|
|
33
|
+
const CAPSULE_TRIGGER = 'kol-menu-btn inline-flex items-start gap-2 h-[26px] p-0 bg-transparent border-0 kol-float-label uppercase whitespace-nowrap text-fg-48 hover:text-(--kol-fg-80) aria-expanded:text-(--kol-fg-96) focus-visible:outline-none focus-visible:text-(--kol-fg-96) [&_svg]:mt-[3px]'
|
|
28
34
|
/* the trigger: 26 tall, 12 in; lit while its menu is open. The line box is the pill (leading 26, not 13): a 13 line box
|
|
29
35
|
* centred in 26 starts on a half pixel, and the glyphs rode it — the label's cap centre on the pill's centre, measured
|
|
30
36
|
* in Chromium and Firefox (±0.5 at 1x is the 9px cap's own rounding). */
|
|
@@ -54,7 +60,8 @@ function Rows({ items, width }) {
|
|
|
54
60
|
})
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
export default function MenuBar({ app, menus = [], end = [], className = '' }) {
|
|
63
|
+
export default function MenuBar({ app, menus = [], end = [], variant = 'bar', className = '' }) {
|
|
64
|
+
const capsule = variant === 'capsule'
|
|
58
65
|
const appMenu = typeof app === 'string' ? { label: app } : app
|
|
59
66
|
const all = [...(appMenu ? [{ ...appMenu, app: true }] : []), ...menus, ...end]
|
|
60
67
|
const [open, setOpen] = useState(null)
|
|
@@ -93,8 +100,9 @@ export default function MenuBar({ app, menus = [], end = [], className = '' }) {
|
|
|
93
100
|
<button {...props} ref={(el) => { triggers.current[i] = el }} type="button" aria-expanded={isOpen}
|
|
94
101
|
/* the bar is live once a menu is open: pointing at another opens it (the mac menu bar) */
|
|
95
102
|
onPointerEnter={() => { if (open != null && open !== i) setOpen(i) }}
|
|
96
|
-
className={`${TRIGGER} ${m.app ? 'font-bold' : 'font-medium'}`}>
|
|
103
|
+
className={capsule ? CAPSULE_TRIGGER : `${TRIGGER} ${m.app ? 'font-bold' : 'font-medium'}`}>
|
|
97
104
|
{m.label}
|
|
105
|
+
{capsule && <Icon name="chevron-down" size={10} className="text-oq-48" />}
|
|
98
106
|
</button>
|
|
99
107
|
)}
|
|
100
108
|
>
|
|
@@ -104,6 +112,13 @@ export default function MenuBar({ app, menus = [], end = [], className = '' }) {
|
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
const startCount = (appMenu ? 1 : 0) + menus.length
|
|
115
|
+
if (capsule) {
|
|
116
|
+
return (
|
|
117
|
+
<div role="menubar" aria-label="Menu bar" className={`kol-menubar kol-menubar--capsule flex items-start gap-3 p-5 rounded-[var(--kol-float-window-r)] bg-[var(--kol-surface-secondary)] ${className}`.trim()}>
|
|
118
|
+
{all.map((m, i) => item(m, i))}
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
107
122
|
return (
|
|
108
123
|
<div role="menubar" aria-label="Menu bar" className={`kol-menubar flex items-center gap-1 h-10 px-4 shrink-0 bg-[var(--kol-surface-secondary)] border-b border-[var(--kol-fg-02)] ${className}`.trim()}>
|
|
109
124
|
{all.slice(0, startCount).map((m, i) => item(m, i))}
|
package/src/PropertyRail.jsx
CHANGED
|
@@ -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
|
-
|
|
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=
|
|
48
|
-
{
|
|
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 (
|