@kolkrabbi/kol-shell 0.130.0 → 0.131.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/AppFloatNav.jsx +48 -14
- package/src/PropertyRail.jsx +37 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.131.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The application shell",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"./src/*": "./src/*"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@kolkrabbi/kol-component": ">=0.
|
|
15
|
+
"@kolkrabbi/kol-component": ">=0.378.0",
|
|
16
16
|
"@kolkrabbi/kol-framework": ">=0.55.0",
|
|
17
17
|
"@kolkrabbi/kol-icons": ">=0.69.0",
|
|
18
18
|
"@kolkrabbi/kol-theme": ">=0.224.0",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@kolkrabbi/kol-component": ">=0.
|
|
24
|
+
"@kolkrabbi/kol-component": ">=0.378.0",
|
|
25
|
+
"@kolkrabbi/kol-framework": "^0.74.1",
|
|
25
26
|
"@kolkrabbi/kol-icons": "^0.71.0",
|
|
26
|
-
"@kolkrabbi/kol-theme": "^0.225.0"
|
|
27
|
-
"@kolkrabbi/kol-framework": "^0.74.1"
|
|
27
|
+
"@kolkrabbi/kol-theme": "^0.225.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
package/src/AppFloatNav.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react'
|
|
2
2
|
import { Button, TabsRow, Tooltip, TABBAR_H, TABBAR_PILL_H, TABBAR_PILL_INSET, tabbarPillWidth, tabbarPillSlot, floatSurfaceClass, usePopover, PopoverPanel, useMediaQuery } from '@kolkrabbi/kol-component'
|
|
3
|
-
import { hasIcon } from '@kolkrabbi/kol-icons'
|
|
3
|
+
import { hasIcon, IconLoader } from '@kolkrabbi/kol-icons'
|
|
4
4
|
import { MenuFloatRows, MenuFloat } from '@kolkrabbi/kol-component'
|
|
5
5
|
import Timecode from './Timecode.jsx'
|
|
6
6
|
|
|
@@ -286,8 +286,15 @@ function FloatNav({ items = [], currentPath = '/', onNavigate, actions = [], sha
|
|
|
286
286
|
* @param {Object} sheetFor `{ [id]: [{ label, icon?, onPress, checked?, sub? }] }` — rows for a slot that opens a sheet;
|
|
287
287
|
* `checked` marks the current pick with the 22px check (MenuFloatRows); `sub` opens a level in place
|
|
288
288
|
* @param {'bottom'|'top'} placement the pill's edge (default bottom)
|
|
289
|
-
* @param {boolean}
|
|
290
|
-
*
|
|
289
|
+
* @param {boolean} collapsibleH collapse-h (plan-2026-11-12-one-header W11; was `foldable`, aliased): the pill — a sideways swipe
|
|
290
|
+
* folds it into the right edge tab; the inline capsule — it collapses to its LAST item (the
|
|
291
|
+
* play/pause, one button in both states) + the timecode + any item that is lit (Loop on); ONE
|
|
292
|
+
* regular 12 chevron (`--kol-float-chev-sm`, oq-64) directly left of the play/pause, Figma-style:
|
|
293
|
+
* ‹ collapsed, › expanded; the other items open to its left, so the play/pause and the right
|
|
294
|
+
* edge never move. It starts collapsed (`defaultCollapsedH`, default true) and remembers the
|
|
295
|
+
* choice (localStorage `kol-float-transport:collapsed-h`)
|
|
296
|
+
* @param {boolean} collapsedH · {Function} onCollapseH the collapsed state, controlled (else the transport holds it);
|
|
297
|
+
* `folded` · `onFoldChange` are their deprecated aliases
|
|
291
298
|
* @param {Object|string} timecode THE TIMECODE (float-everything W5 rows 69 · 70, 2026-11-04): `{ current, total? }` (or the
|
|
292
299
|
* current alone) drawn by `Timecode` INSIDE the pill, after the slots — TabsRow's `trailing`
|
|
293
300
|
* (kol-component ≥0.335.0); the slots stay where a pill without it puts them. Unset, no readout
|
|
@@ -298,8 +305,21 @@ function FloatNav({ items = [], currentPath = '/', onNavigate, actions = [], sha
|
|
|
298
305
|
* 12 above the slot. Below md it is the phone pill as before. Default false — the pill everywhere
|
|
299
306
|
* @param {string} className the inline capsule's (ignored by the pill)
|
|
300
307
|
*/
|
|
301
|
-
|
|
308
|
+
const COLLAPSED_H_KEY = 'kol-float-transport:collapsed-h'
|
|
309
|
+
|
|
310
|
+
function Transport({ items = [], sheetFor = {}, placement = 'bottom', collapsibleH, collapsedH, defaultCollapsedH = true, onCollapseH, foldable, folded, onFoldChange, menuBorder = false, surface = 'solid', labels = false, foldSide = 'right', foldTone, timecode, inline = false, className = '' }) {
|
|
302
311
|
const [sheet, setSheet] = useState(null)
|
|
312
|
+
const canH = collapsibleH ?? foldable ?? false
|
|
313
|
+
const ctlH = collapsedH ?? folded
|
|
314
|
+
const onH = onCollapseH ?? onFoldChange
|
|
315
|
+
const [ownH, setOwnH] = useState(() => { try { const v = localStorage.getItem(COLLAPSED_H_KEY); return v == null ? defaultCollapsedH : v === '1' } catch { return defaultCollapsedH } })
|
|
316
|
+
const isH = canH && (ctlH ?? ownH)
|
|
317
|
+
const toggleH = () => {
|
|
318
|
+
const next = !isH
|
|
319
|
+
if (next) setSheet(null)
|
|
320
|
+
if (ctlH === undefined) { setOwnH(next); try { localStorage.setItem(COLLAPSED_H_KEY, next ? '1' : '0') } catch { /* private window: kept for this visit */ } }
|
|
321
|
+
onH?.(next)
|
|
322
|
+
}
|
|
303
323
|
useEffect(() => {
|
|
304
324
|
if (!sheet) return undefined
|
|
305
325
|
const onKey = (e) => { if (e.key === 'Escape') setSheet(null) }
|
|
@@ -336,8 +356,19 @@ function Transport({ items = [], sheetFor = {}, placement = 'bottom', foldable =
|
|
|
336
356
|
const phone = useMediaQuery('(max-width: 767px)')
|
|
337
357
|
|
|
338
358
|
if (inline && !phone) {
|
|
339
|
-
/* the
|
|
340
|
-
const
|
|
359
|
+
/* collapse-h: the extras, the chevron, the play/pause (the last item); collapsed, only a lit extra stays */
|
|
360
|
+
const main = canH ? tabs[tabs.length - 1] : null
|
|
361
|
+
const shown = canH ? tabs.slice(0, -1).filter((t) => !isH || t.selected) : tabs
|
|
362
|
+
const slot = (t) => (
|
|
363
|
+
<Tooltip key={t.value} variant="float" placement={top ? 'bottom' : 'top'} offset={12} label={t.label}>
|
|
364
|
+
<Button variant="float" tone="ghost" iconOnly={t.icon} aria-label={t.label} pressed={t.selected} onClick={() => press(t.value)} />
|
|
365
|
+
</Tooltip>
|
|
366
|
+
)
|
|
367
|
+
/* the desktop capsule — ToolRail's slots laid in a row; the sheet sits over its slot (6 in + 40 a slot + 18 its centre,
|
|
368
|
+
+ the chevron's 16 + 4 for the play/pause) */
|
|
369
|
+
const order = main ? [...shown, main] : shown
|
|
370
|
+
const slotAt = order.findIndex((t) => t.value === sheet)
|
|
371
|
+
const capsuleSheet = { position: 'absolute', left: 6 + slotAt * 40 + 18 + (main && sheet === main.value ? 20 : 0), right: 'auto', transform: 'translateX(-50%)', [top ? 'top' : 'bottom']: 'calc(100% + 12px)', width: 'max-content', minWidth: 160 }
|
|
341
372
|
return (
|
|
342
373
|
<div role="toolbar" aria-label="Transport" className={`kol-transport-capsule kol-float-chrome relative inline-flex items-center gap-1 p-1.5 rounded-full ${floatSurfaceClass(surface)} ${className}`.trim()}>
|
|
343
374
|
{sheet && <button type="button" aria-label="Close" className="kol-phone-nav-scrim" onClick={() => setSheet(null)} />}
|
|
@@ -348,11 +379,14 @@ function Transport({ items = [], sheetFor = {}, placement = 'bottom', foldable =
|
|
|
348
379
|
</MenuFloat>
|
|
349
380
|
</div>
|
|
350
381
|
)}
|
|
351
|
-
{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
382
|
+
{shown.map(slot)}
|
|
383
|
+
{main && (
|
|
384
|
+
<button type="button" aria-label={isH ? 'Show transport controls' : 'Hide transport controls'} aria-expanded={!isH} onClick={toggleH} data-collapse-h=""
|
|
385
|
+
className="inline-flex h-9 w-4 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
|
|
386
|
+
<IconLoader name={isH ? 'chevron-left' : 'chevron-right'} size="var(--kol-float-chev-sm)" />
|
|
387
|
+
</button>
|
|
388
|
+
)}
|
|
389
|
+
{main && slot(main)}
|
|
356
390
|
{tc && <Timecode {...tc} className="px-3" />}
|
|
357
391
|
</div>
|
|
358
392
|
)
|
|
@@ -382,9 +416,9 @@ function Transport({ items = [], sheetFor = {}, placement = 'bottom', foldable =
|
|
|
382
416
|
active={APP_FLOAT_NAV_VARIANTS.transport.active}
|
|
383
417
|
surface={surface}
|
|
384
418
|
labels={labels}
|
|
385
|
-
foldable={
|
|
386
|
-
folded={
|
|
387
|
-
onFoldChange={(v) => { if (v) setSheet(null);
|
|
419
|
+
foldable={canH}
|
|
420
|
+
folded={ctlH}
|
|
421
|
+
onFoldChange={(v) => { if (v) setSheet(null); onH?.(v) }}
|
|
388
422
|
foldSide={foldSide}
|
|
389
423
|
foldTone={foldTone}
|
|
390
424
|
ariaLabel="Transport"
|
package/src/PropertyRail.jsx
CHANGED
|
@@ -15,6 +15,11 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
15
15
|
* W4.1) — the one shell NavRail float and ReadingContents draw on too; the body scrolls under the header.
|
|
16
16
|
*
|
|
17
17
|
* @param {string} title the header (Properties)
|
|
18
|
+
* @param {ReactNode} kind the quiet second text beside the title (the preset beside the effect — no middot, W10.1)
|
|
19
|
+
* @param {Array} windows `[{ id, title, kind, sections, children, footer, defaultCollapsedV, … }]` — the Rail as a stack
|
|
20
|
+
* of separate RailFloat windows (W10.1): each window takes this component's props over the
|
|
21
|
+
* shared ones, its own Header with collapse-v, collapsing alone; 24 between them; the stack
|
|
22
|
+
* scrolls only when they outgrow it. Unset, one Rail as before
|
|
18
23
|
* @param {Function} onCollapseH the collapse-h ⇥'s press (the Rail collapses sideways out of view); unset, no ⇥.
|
|
19
24
|
* `onCollapse` is its deprecated alias
|
|
20
25
|
* @param {Array} tabs TabsRow tabs `[{ value, label }]` at the inspector size (xs, 26 — float-operational W1.3);
|
|
@@ -30,10 +35,11 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
30
35
|
* W7.6): LabeledControl float `horizontal` — the label in the `--kol-float-label-w` column, the control in the rest ·
|
|
31
36
|
* `{ type: 'subhead', id?, label, meta? }` — a group's caps head inside a section (LIGHTS / POINT EDITOR): it and the rows
|
|
32
37
|
* under it are a float LabeledControlSection of their own ·
|
|
33
|
-
* a section may also be `collapsible` (`open` · `onToggle(open)`):
|
|
34
|
-
* title in `kol-float-panel`, `meta
|
|
35
|
-
*
|
|
36
|
-
*
|
|
38
|
+
* a section may also be `collapsible` (`open` · `onToggle(open)`): LabeledControlSection's own
|
|
39
|
+
* collapsible head — the title in `kol-float-panel`, `meta`, the 12 chevron at the right end; its
|
|
40
|
+
* rows shown while open. No section pads itself: the space between sections is the body's gap
|
|
41
|
+
* @param {'regular'|'compact'} density `compact` — the tool Rail's rhythm (his generator frames 32:16215): 8 between rows
|
|
42
|
+
* and between sections (the body's gap, W10.1); `regular` (default) the inspector's 18
|
|
37
43
|
* @param {Function} onExpand the ↗ in the header — the tool's expanded form (the settings dialog); unset, none
|
|
38
44
|
* @param {ReactNode} footer the Rail's foot (a status line, the tool's action), after the sections
|
|
39
45
|
* @param {'solid'|'glass-dark'|'glass-light'} surface what the sheet is made of (default `solid`)
|
|
@@ -48,10 +54,26 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
48
54
|
* @param {ReactNode} children the body slot, after the sections — a panel that is not rows (ReadingContents, Labs' params)
|
|
49
55
|
* @param {string} className
|
|
50
56
|
*/
|
|
51
|
-
export default function PropertyRail({
|
|
57
|
+
export default function PropertyRail({ windows, ...props }) {
|
|
58
|
+
/* WINDOWS (plan-2026-11-12-one-header W10.1, P15: *"you just split the content into windows and they expand and collapse as
|
|
59
|
+
* you see fit"*): a vertical stack of separate RailFloat windows, the float layout's gap (24) between them, each its own
|
|
60
|
+
* Header (property, collapse-v) collapsing alone; the stack scrolls only when the windows outgrow it. A window is this
|
|
61
|
+
* component's own props (`{ id, title, kind, sections, children, footer, defaultCollapsedV … }`) over the shared ones. */
|
|
62
|
+
if (windows?.length) {
|
|
63
|
+
const { className = '', title, kind, sections, children, footer, tabs, tab, onTab, selected, ...shared } = props
|
|
64
|
+
return (
|
|
65
|
+
<div data-property-rail-windows="" className={`flex min-h-0 flex-col gap-6 overflow-y-auto [scrollbar-width:none] ${className}`.trim()}>
|
|
66
|
+
{windows.map((w, i) => <PropertyRailWindow key={w.id ?? i} collapsibleV {...shared} {...w} className={`shrink-0 ${w.className ?? ''}`.trim()} />)}
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
return <PropertyRailWindow {...props} />
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function PropertyRailWindow({ title, kind, onCollapseH, onCollapse, onExpand, density = 'regular', tabs, tab, onTab, selected, sections = [], footer, surface = 'solid', wide = false, width, collapsibleV, collapsedV, defaultCollapsedV, onCollapseV, foldable, folded, defaultFolded, onFold, children, className = '' }) {
|
|
52
74
|
const compact = density === 'compact'
|
|
53
75
|
return (
|
|
54
|
-
<RailFloat title={title} onExpand={onExpand} onCollapseH={onCollapseH ?? onCollapse}
|
|
76
|
+
<RailFloat title={title} kind={kind} onExpand={onExpand} onCollapseH={onCollapseH ?? onCollapse}
|
|
55
77
|
collapsibleV={collapsibleV ?? foldable} collapsedV={collapsedV ?? folded} defaultCollapsedV={defaultCollapsedV ?? defaultFolded} onCollapseV={onCollapseV ?? onFold}
|
|
56
78
|
compact={compact} wide={wide} width={width} surface={surface} className={`kol-property-rail ${className}`.trim()}
|
|
57
79
|
footer={footer && compact ? <div className="pt-4">{footer}</div> : footer}>
|
|
@@ -63,20 +85,17 @@ export default function PropertyRail({ title, onCollapseH, onCollapse, onExpand,
|
|
|
63
85
|
{sections.map((s, i) => {
|
|
64
86
|
const add = s.onAdd && <Button variant="float" tone="ghost" size="sm" iconOnly="plus" aria-label={`Add to ${s.label}`} onClick={s.onAdd} />
|
|
65
87
|
const meta = s.meta && <span className="kol-float-timecode text-emphasis">{s.meta}</span>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<span className="kol-float-panel text-emphasis flex-1 min-w-0">{s.label}</span>
|
|
71
|
-
{s.meta && <span className="kol-float-timecode text-oq-64">{s.meta}</span>}
|
|
72
|
-
</button>
|
|
73
|
-
) : s.label
|
|
88
|
+
/* a collapsible section is LabeledControlSection's own `collapsible`: the title, the meta, the 12 chevron at the head's
|
|
89
|
+
* right end (W10.1). No section pads itself: the space between sections is the body's gap */
|
|
90
|
+
const label = s.collapsible ? <span className="kol-float-panel text-emphasis min-w-0">{s.label}</span> : s.label
|
|
91
|
+
const end = s.collapsible ? (s.meta && <span className="kol-float-timecode text-oq-64">{s.meta}</span>) : (add || meta) && <>{add}{meta}</>
|
|
74
92
|
return (
|
|
75
|
-
<LabeledControlSection key={s.id ?? s.label ?? i} variant="float" data-section={s.id ?? s.label} label={label} end={
|
|
76
|
-
|
|
77
|
-
{
|
|
93
|
+
<LabeledControlSection key={s.id ?? s.label ?? i} variant="float" data-section={s.id ?? s.label} label={label} end={end}
|
|
94
|
+
collapsible={!!s.collapsible} open={s.collapsible ? !!s.open : undefined} onToggle={s.onToggle}
|
|
95
|
+
gap={compact ? 2 : 'module'} rowGap={compact ? 2 : 'module'}>
|
|
96
|
+
{groups(s.rows ?? []).map((g, j) => (g.head
|
|
78
97
|
? <LabeledControlSection key={g.head.id ?? `g${j}`} variant="float" label={g.head.label} end={g.head.meta && <span className="kol-float-label text-fg-emphasis">{g.head.meta}</span>}
|
|
79
|
-
gap={compact ? 2 : 'module'} rowGap={compact ? 2 : 'module'}
|
|
98
|
+
gap={compact ? 2 : 'module'} rowGap={compact ? 2 : 'module'}>
|
|
80
99
|
{g.rows.map((r, k) => <Row key={r.id ?? k} row={r} />)}
|
|
81
100
|
</LabeledControlSection>
|
|
82
101
|
: g.rows.map((r, k) => <Row key={r.id ?? k} row={r} />)))}
|