@kolkrabbi/kol-shell 0.101.0 → 0.102.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 +3 -14
- package/src/FloatLayout.jsx +100 -0
- package/src/index.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.102.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.337.0",
|
|
16
16
|
"@kolkrabbi/kol-framework": ">=0.55.0",
|
|
17
17
|
"@kolkrabbi/kol-icons": ">=0.16.0",
|
|
18
18
|
"@kolkrabbi/kol-theme": ">=0.211.1",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@kolkrabbi/kol-
|
|
25
|
-
"@kolkrabbi/kol-icons": "^0.
|
|
24
|
+
"@kolkrabbi/kol-component": "^0.337.0",
|
|
25
|
+
"@kolkrabbi/kol-icons": "^0.64.0",
|
|
26
26
|
"@kolkrabbi/kol-framework": "^0.69.0",
|
|
27
|
-
"@kolkrabbi/kol-
|
|
27
|
+
"@kolkrabbi/kol-theme": "^0.211.1"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
package/src/AppFloatNav.jsx
CHANGED
|
@@ -288,8 +288,8 @@ function FloatNav({ items = [], currentPath = '/', onNavigate, actions = [], sha
|
|
|
288
288
|
* @param {boolean} foldable a sideways swipe folds it into the right edge tab
|
|
289
289
|
* @param {boolean} folded · {Function} onFoldChange the folded state, controlled (else the pill holds it)
|
|
290
290
|
* @param {Object|string} timecode THE TIMECODE (float-everything W5 rows 69 · 70, 2026-11-04): `{ current, total? }` (or the
|
|
291
|
-
* current alone) drawn by `Timecode`
|
|
292
|
-
*
|
|
291
|
+
* current alone) drawn by `Timecode` INSIDE the pill, after the slots — TabsRow's `trailing`
|
|
292
|
+
* (kol-component ≥0.335.0); the slots stay where a pill without it puts them. Unset, no readout
|
|
293
293
|
*/
|
|
294
294
|
function Transport({ items = [], sheetFor = {}, placement = 'bottom', foldable = false, folded, onFoldChange, menuBorder = false, surface = 'solid', labels = false, foldSide = 'right', foldTone, timecode }) {
|
|
295
295
|
const [sheet, setSheet] = useState(null)
|
|
@@ -319,22 +319,10 @@ function Transport({ items = [], sheetFor = {}, placement = 'bottom', foldable =
|
|
|
319
319
|
...(top ? { bottom: 'auto' } : {}),
|
|
320
320
|
width: 'max-content', minWidth: 160,
|
|
321
321
|
}
|
|
322
|
-
/* the timecode capsule: the pill's height, its right end 8 off the pill's, bottom edges on one line
|
|
323
|
-
* ponytail: beside the pill, not inside it — inside needs a trailing slot on TabsRow's pill (kol-component) */
|
|
324
322
|
const tc = timecode == null ? null : typeof timecode === 'string' ? { current: timecode } : timecode
|
|
325
|
-
const tcStyle = {
|
|
326
|
-
left: `calc(50% + ${W / 2}px + 8px)`,
|
|
327
|
-
[top ? 'top' : 'bottom']: `calc(env(safe-area-inset-${top ? 'top' : 'bottom'}, 0px) + ${TABBAR_PILL_INSET}px)`,
|
|
328
|
-
height: TABBAR_PILL_H,
|
|
329
|
-
}
|
|
330
323
|
|
|
331
324
|
return (
|
|
332
325
|
<>
|
|
333
|
-
{tc && !folded && (
|
|
334
|
-
<div className={`kol-transport-timecode fixed z-[var(--kol-z-sticky)] inline-flex items-center px-5 rounded-full ${floatSurfaceClass(surface)}`} style={tcStyle}>
|
|
335
|
-
<Timecode {...tc} />
|
|
336
|
-
</div>
|
|
337
|
-
)}
|
|
338
326
|
{sheet && (
|
|
339
327
|
/* a clear BUTTON scrim — the panel under it stays in view, a tap off the sheet closes it */
|
|
340
328
|
<button type="button" aria-label="Close" className="kol-phone-nav-scrim" onClick={() => setSheet(null)} />
|
|
@@ -363,6 +351,7 @@ function Transport({ items = [], sheetFor = {}, placement = 'bottom', foldable =
|
|
|
363
351
|
foldSide={foldSide}
|
|
364
352
|
foldTone={foldTone}
|
|
365
353
|
ariaLabel="Transport"
|
|
354
|
+
trailing={tc ? <Timecode {...tc} /> : undefined}
|
|
366
355
|
tabs={tabs}
|
|
367
356
|
onChange={press}
|
|
368
357
|
/>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useRef, useState } from 'react'
|
|
2
|
+
import { NavRail, useMediaQuery } from '@kolkrabbi/kol-component'
|
|
3
|
+
import TopControlsBar from './TopControlsBar.jsx'
|
|
4
|
+
import RailTrigger from './RailTrigger.jsx'
|
|
5
|
+
import RailFlyout from './RailFlyout.jsx'
|
|
6
|
+
import RailDisplayControls from './RailDisplayControls.jsx'
|
|
7
|
+
|
|
8
|
+
/* taxonomy-ok: module — the float page frame: NavRail float · RailTrigger · RailFlyout · TopControlsBar · PanelsRestore · the inspector slot */
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* FloatLayout — The float workspace frame (plan-2026-11-04-float-views W1.1 — kol-float--style 9:15449 "Adaptive
|
|
12
|
+
* workspace", its rules 9:15179). Assembled from the float chrome, nothing drawn here: the nav Rail (`NavRail
|
|
13
|
+
* variant="float"`) in three states — `expanded` 280, `collapsed` 72 (a section's rows open beside a slot on hover,
|
|
14
|
+
* RailFlyout), `hidden` 0 (RailTrigger and the breadcrumb take the corner) — the 64 TopControlsBar, the content slot,
|
|
15
|
+
* and ONE inspector slot (PropertyRail, 272 on the sheet radius). 24 round the page and between the Rails, 40 under the bar.
|
|
16
|
+
*
|
|
17
|
+
* Visibility controls space, selection controls content: a hidden Rail is never removed — Panels ▾ (PanelsRestore)
|
|
18
|
+
* shows in the bar exactly while one is hidden and brings it back as it was (the nav at its last width). Below `md` the
|
|
19
|
+
* nav is the trigger and the inspector stacks under the content.
|
|
20
|
+
*
|
|
21
|
+
* @param {Array} nav NavRail float items — `{ heading }` | `{ icon, label, path, count?, sub? }`
|
|
22
|
+
* @param {string} currentPath · {Function} onNavigate `(path) => void`
|
|
23
|
+
* @param {string} [title] · {string} [icon] · {Function} [onSwitch] · {Function} [onSearch] the nav Rail's switcher and search
|
|
24
|
+
* @param {'expanded'|'collapsed'|'hidden'} [rail] the nav Rail's state (controlled); `defaultRail` uncontrolled (default `expanded`) · {Function} [onRailChange]
|
|
25
|
+
* @param {ReactNode} [railFooter] the expanded Rail's foot (default RailDisplayControls: theme · Collapse · Hide)
|
|
26
|
+
* @param {string|string[]} [breadcrumb] the words beside RailTrigger while the nav is hidden
|
|
27
|
+
* @param {Object} [bar] TopControlsBar's props (`document` · `tabs` · `tab` · `onTab` · `onSearch` · `action` · `start` · `center` · `end`); `panels` is the frame's
|
|
28
|
+
* @param {ReactNode|Function} [inspector] the one inspector — a node, or `({ hide }) => node` (hand `hide` to PropertyRail's `onCollapse`)
|
|
29
|
+
* @param {string} [inspectorLabel] its name in Panels ▾ (default "Inspector")
|
|
30
|
+
* @param {boolean} [inspectorHidden] controlled; `defaultInspectorHidden` uncontrolled · {Function} [onInspectorHiddenChange]
|
|
31
|
+
* @param {'solid'|'glass-dark'|'glass-light'} [surface] what the floats are made of (default `solid`)
|
|
32
|
+
* @param {ReactNode} children the content
|
|
33
|
+
* @param {string} [className]
|
|
34
|
+
*/
|
|
35
|
+
export default function FloatLayout({
|
|
36
|
+
nav = [], currentPath = '', onNavigate, title, icon, onSwitch, onSearch,
|
|
37
|
+
rail, defaultRail = 'expanded', onRailChange, railFooter, breadcrumb,
|
|
38
|
+
bar = {}, inspector, inspectorLabel = 'Inspector', inspectorHidden, defaultInspectorHidden = false, onInspectorHiddenChange,
|
|
39
|
+
surface = 'solid', children, className = '',
|
|
40
|
+
}) {
|
|
41
|
+
const [ownRail, setOwnRail] = useState(defaultRail)
|
|
42
|
+
const [ownHidden, setOwnHidden] = useState(defaultInspectorHidden)
|
|
43
|
+
const railNow = rail ?? ownRail
|
|
44
|
+
const hidden = inspectorHidden ?? ownHidden
|
|
45
|
+
const lastShown = useRef(railNow === 'hidden' ? 'expanded' : railNow)
|
|
46
|
+
if (railNow !== 'hidden') lastShown.current = railNow
|
|
47
|
+
const setRail = (r) => { if (rail === undefined) setOwnRail(r); onRailChange?.(r) }
|
|
48
|
+
const setHidden = (h) => { if (inspectorHidden === undefined) setOwnHidden(h); onInspectorHiddenChange?.(h) }
|
|
49
|
+
|
|
50
|
+
const phone = useMediaQuery('(max-width: 767px)')
|
|
51
|
+
const shown = phone ? 'hidden' : railNow
|
|
52
|
+
|
|
53
|
+
// the hover flyout: a section's rows beside the 72 Rail, kept open while the pointer is on the slot or the card
|
|
54
|
+
const [fly, setFly] = useState(null)
|
|
55
|
+
const timer = useRef(0)
|
|
56
|
+
const hold = () => clearTimeout(timer.current)
|
|
57
|
+
const drop = () => { hold(); timer.current = setTimeout(() => setFly(null), 160) }
|
|
58
|
+
const onItemHover = (item, el) => {
|
|
59
|
+
if (!item) return drop()
|
|
60
|
+
hold()
|
|
61
|
+
setFly(item.sub?.length ? { item, el } : null)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const restore = [
|
|
65
|
+
...(railNow === 'hidden' && !phone ? [{ label: 'Navigation', icon: 'panel-left', onPress: () => setRail(lastShown.current) }] : []),
|
|
66
|
+
...(inspector && hidden ? [{ label: inspectorLabel, icon: 'panel-right', onPress: () => setHidden(false) }] : []),
|
|
67
|
+
]
|
|
68
|
+
const body = typeof inspector === 'function' ? inspector({ hide: () => setHidden(true) }) : inspector
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div className={`kol-float-layout flex h-dvh gap-6 overflow-hidden bg-surface-primary p-6 max-md:p-4 ${className}`.trim()}>
|
|
72
|
+
{shown !== 'hidden' && (
|
|
73
|
+
<NavRail variant="float" items={nav} currentPath={currentPath} onNavigate={onNavigate}
|
|
74
|
+
collapsed={shown === 'collapsed'} onCollapsedChange={(c) => { setFly(null); setRail(c ? 'collapsed' : 'expanded') }}
|
|
75
|
+
title={title} icon={icon} onSwitch={onSwitch} onSearch={onSearch} onHide={() => setRail('hidden')}
|
|
76
|
+
onItemHover={shown === 'collapsed' ? onItemHover : undefined}
|
|
77
|
+
footer={shown === 'expanded' ? (railFooter ?? <RailDisplayControls onCollapse={() => setRail('collapsed')} onHide={() => setRail('hidden')} />) : undefined}
|
|
78
|
+
className="shrink-0" />
|
|
79
|
+
)}
|
|
80
|
+
{shown === 'collapsed' && fly && (
|
|
81
|
+
<span className="contents" onMouseEnter={hold} onMouseLeave={drop}>
|
|
82
|
+
<RailFlyout icon={fly.item.icon} title={fly.item.label} items={fly.item.sub} active={currentPath} anchor={fly.el} surface={surface}
|
|
83
|
+
onOpenChange={(o) => { if (!o) setFly(null) }}
|
|
84
|
+
onPick={(i) => { setFly(null); if (i.path) onNavigate?.(i.path) }} />
|
|
85
|
+
</span>
|
|
86
|
+
)}
|
|
87
|
+
<div className="flex min-w-0 flex-1 flex-col gap-10 max-md:gap-6">
|
|
88
|
+
<div className="flex min-w-0 shrink-0 items-center gap-4">
|
|
89
|
+
{shown === 'hidden' && <RailTrigger items={nav} currentPath={currentPath} onNavigate={onNavigate} title={title} breadcrumb={phone ? undefined : breadcrumb} surface={surface} className="shrink-0" />}
|
|
90
|
+
<TopControlsBar {...bar} panels={restore.length ? { items: restore } : undefined} surface={surface}
|
|
91
|
+
className={`min-w-0 flex-1 max-md:overflow-x-auto max-md:[scrollbar-width:none] ${bar.className ?? ''}`.trim()} />
|
|
92
|
+
</div>
|
|
93
|
+
<div className="flex min-h-0 flex-1 gap-6 max-md:flex-col max-md:overflow-y-auto">
|
|
94
|
+
<div className="kol-float-layout-content min-w-0 flex-1 overflow-y-auto max-md:flex-none max-md:overflow-visible">{children}</div>
|
|
95
|
+
{body && !hidden && <aside aria-label={inspectorLabel} className="max-h-full shrink-0 self-start overflow-y-auto [scrollbar-width:none] max-md:max-h-none max-md:self-stretch">{body}</aside>}
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
)
|
|
100
|
+
}
|
package/src/index.js
CHANGED
|
@@ -31,6 +31,8 @@ export { default as RailTrigger } from './RailTrigger.jsx'
|
|
|
31
31
|
export { default as RailFlyout } from './RailFlyout.jsx'
|
|
32
32
|
export { default as RailDisplayControls } from './RailDisplayControls.jsx'
|
|
33
33
|
export { AccountFooter, StatusStrip, Breadcrumb, FooterStrip, PeriodNav, DataStatus } from './WorkspaceStrips.jsx'
|
|
34
|
+
// the float page frame, assembled from the chrome above (plan-2026-11-04-float-views W1.1)
|
|
35
|
+
export { default as FloatLayout } from './FloatLayout.jsx'
|
|
34
36
|
export { default as PhoneNav, PHONE_NAV_VARIANTS } from './PhoneNav.jsx'
|
|
35
37
|
export { default as TransportPill } from './TransportPill.jsx'
|
|
36
38
|
export { default as PageShell, PageBleed } from './PageShell.jsx'
|