@kolkrabbi/kol-shell 0.112.0 → 0.114.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/DocumentCapsule.jsx +10 -3
- package/src/ToolRail.jsx +46 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.114.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-framework": "^0.70.0",
|
|
25
|
-
"@kolkrabbi/kol-component": "^0.343.0",
|
|
26
24
|
"@kolkrabbi/kol-icons": "^0.66.0",
|
|
27
|
-
"@kolkrabbi/kol-
|
|
25
|
+
"@kolkrabbi/kol-component": "^0.344.0",
|
|
26
|
+
"@kolkrabbi/kol-theme": "^0.214.0",
|
|
27
|
+
"@kolkrabbi/kol-framework": "^0.70.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
package/src/DocumentCapsule.jsx
CHANGED
|
@@ -12,14 +12,16 @@ import MoreRows, { FloatMenu } from './MoreSheet.jsx'
|
|
|
12
12
|
* oq-64). The exploration's `Document pill` (kol-float--style 9:9358).
|
|
13
13
|
*
|
|
14
14
|
* @param {string} name the document
|
|
15
|
-
* @param {string} status the save state, verbatim ("
|
|
15
|
+
* @param {string} status the save state, verbatim ("Saved")
|
|
16
|
+
* @param {string} statusIcon an icon before the status (`check` for a saved document) — a glyph is an Icon, never a text
|
|
17
|
+
* character (plan-2026-11-06-buttons-page 1.4: the "✓" was a string)
|
|
16
18
|
* @param {Function} onBack the ← press; unset, no ←
|
|
17
19
|
* @param {Array} menuItems `[{ label, icon?, onPress, sub? }]` — the ▾ menu's rows (MoreRows float); unset with `onMenu`, the ▾ runs it
|
|
18
20
|
* @param {Function} onMenu `() => void` — the ▾ press when the consumer owns the menu
|
|
19
21
|
* @param {'solid'|'glass-dark'|'glass-light'} surface what the capsule (and its menu) is made of (default `solid`)
|
|
20
22
|
* @param {string} className
|
|
21
23
|
*/
|
|
22
|
-
export default function DocumentCapsule({ name, status, onBack, menuItems, onMenu, surface = 'solid', className = '' }) {
|
|
24
|
+
export default function DocumentCapsule({ name, status, statusIcon, onBack, menuItems, onMenu, surface = 'solid', className = '' }) {
|
|
23
25
|
const [open, setOpen] = useState(false)
|
|
24
26
|
const popover = usePopover({ open, onOpenChange: setOpen, placement: 'bottom-start', offset: 8 })
|
|
25
27
|
const hasMenu = menuItems?.length > 0
|
|
@@ -43,7 +45,12 @@ export default function DocumentCapsule({ name, status, onBack, menuItems, onMen
|
|
|
43
45
|
) : (
|
|
44
46
|
<span className="kol-float-panel text-emphasis">{name}</span>
|
|
45
47
|
)}
|
|
46
|
-
{status &&
|
|
48
|
+
{status && (
|
|
49
|
+
<span className="kol-float-label text-oq-64 inline-flex items-center gap-1">
|
|
50
|
+
{statusIcon && <Icon name={statusIcon} size={16} />}
|
|
51
|
+
{status}
|
|
52
|
+
</span>
|
|
53
|
+
)}
|
|
47
54
|
{hasMenu && (
|
|
48
55
|
<PopoverPanel popover={popover} panel={false} focus={false} className={card} style={{ minWidth: 220, maxWidth: 'calc(100vw - 24px)' }}>
|
|
49
56
|
<FloatMenu beside cardClass={card} onLeaf={() => setOpen(false)}>
|
package/src/ToolRail.jsx
CHANGED
|
@@ -19,8 +19,13 @@ import { Icon } from '@kolkrabbi/kol-icons'
|
|
|
19
19
|
* @param {string} className the rail's — or, with `more`, the column's that holds the rail and its ⋮
|
|
20
20
|
* @param {'vertical'|'horizontal'} orientation THE PHONE ROW (plan-2026-11-05-float-editor W2.7; his frame 06 19:8598):
|
|
21
21
|
* `horizontal` lays the slots in a row and names them above; default `vertical`
|
|
22
|
+
* THE DOCK (7.7; his float-more 30:914) is the horizontal rail with these three:
|
|
23
|
+
* a tool's own `more` (`[{ id?, label, icon, kbd?, onClick? }]`) draws its ▾ beside the slot, the
|
|
24
|
+
* list rising above; a member with an `id` arms that tool and the slot then shows it
|
|
25
|
+
* @param {ReactNode} end after a rule — the dock's hand and undo
|
|
26
|
+
* @param {Object} search `{ onPress, kbd?, label?, pressed? }` — the ⌘K pill at the dock's end, after a rule
|
|
22
27
|
*/
|
|
23
|
-
export default function ToolRail({ tools = [], value, onChange, surface = 'solid', more, orientation = 'vertical', className = '' }) {
|
|
28
|
+
export default function ToolRail({ tools = [], value, onChange, surface = 'solid', more, orientation = 'vertical', end, search, className = '' }) {
|
|
24
29
|
const row = orientation === 'horizontal'
|
|
25
30
|
if (more?.length && !row) {
|
|
26
31
|
return (
|
|
@@ -31,33 +36,60 @@ export default function ToolRail({ tools = [], value, onChange, surface = 'solid
|
|
|
31
36
|
)
|
|
32
37
|
}
|
|
33
38
|
return (
|
|
34
|
-
<div role="toolbar" aria-orientation={orientation} aria-label="Tools" className={`kol-tool-rail kol-float-chrome inline-flex ${row ? 'flex-row' : 'flex-col'} gap-1 p-1.5 rounded-full ${floatSurfaceClass(surface)} ${className}`.trim()}>
|
|
35
|
-
{tools.map((t) =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
<div role="toolbar" aria-orientation={orientation} aria-label="Tools" className={`kol-tool-rail kol-float-chrome inline-flex ${row ? 'flex-row items-center' : 'flex-col'} gap-1 p-1.5 rounded-full ${floatSurfaceClass(surface)} ${className}`.trim()}>
|
|
40
|
+
{tools.map((t) => {
|
|
41
|
+
/* a slot with its own ▾ shows the member armed from it (the dock's Shapes slot reads Ellipse once Ellipse is picked) */
|
|
42
|
+
const shown = t.more?.find((m) => m.id != null && m.id === value) ?? t
|
|
43
|
+
const slot = (
|
|
44
|
+
<Tooltip key={t.id} variant="float" placement={row ? 'top' : 'right'} offset={12} label={shown.label} shortcut={shown.kbd}>
|
|
45
|
+
{/* every slot at full ink, armed or not (his frame 19:6071 — W1.3; the ghost tone's oq-48 read as disabled) */}
|
|
46
|
+
<Button variant="float" tone="ghost" iconOnly={shown.icon} aria-label={shown.label} pressed={shown.id === value || t.id === value}
|
|
47
|
+
onClick={() => (shown.onClick ? shown.onClick() : onChange?.(shown.id))} className="[--kol-tone-fg:var(--kol-oq-96)]" />
|
|
48
|
+
</Tooltip>
|
|
49
|
+
)
|
|
50
|
+
return t.more?.length && row
|
|
51
|
+
? <span key={t.id} className="inline-flex items-center">{slot}<ToolMore items={t.more} surface={surface} chevron label={`${t.label} tools`} onPick={(m) => (m.onClick ? m.onClick() : onChange?.(m.id))} active={value} /></span>
|
|
52
|
+
: slot
|
|
53
|
+
})}
|
|
54
|
+
{end && <><span aria-hidden className="mx-2 h-6 w-px shrink-0 bg-fg-08" />{end}</>}
|
|
55
|
+
{search && <><span aria-hidden className="mx-2 h-6 w-px shrink-0 bg-fg-08" /><ToolSearchPill {...search} /></>}
|
|
41
56
|
</div>
|
|
42
57
|
)
|
|
43
58
|
}
|
|
44
59
|
|
|
45
|
-
/* the
|
|
46
|
-
|
|
60
|
+
/* the dock's ⌘K pill (his float-more 30:914): the search glyph and its key on the float well, at the slot's height;
|
|
61
|
+
* `kbd: null` (a phone has no ⌘) draws the glyph alone */
|
|
62
|
+
function ToolSearchPill({ onPress, kbd = '⌘K', label = 'Search', pressed }) {
|
|
63
|
+
return (
|
|
64
|
+
<Tooltip variant="float" placement="top" offset={12} label={label} shortcut={kbd}>
|
|
65
|
+
<Button variant="float" tone="ghost" aria-label={label} pressed={pressed} onClick={onPress}
|
|
66
|
+
className={`kol-tool-search gap-2 ${kbd ? 'px-4' : 'px-2.5'} bg-[var(--kol-float-well)] [--kol-tone-fg:var(--kol-oq-96)]`}>
|
|
67
|
+
<Icon name="search" size="var(--kol-float-ic)" />
|
|
68
|
+
{kbd && <span className="kol-float-panel">{kbd}</span>}
|
|
69
|
+
</Button>
|
|
70
|
+
</Tooltip>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* the ⋮ under the rail and its list, to the right, top edges on one line — or, `chevron`, a slot's ▾ in the dock, its
|
|
75
|
+
* list rising above it */
|
|
76
|
+
function ToolMore({ items, surface, chevron = false, label = 'More tools', onPick, active }) {
|
|
47
77
|
const [open, setOpen] = useState(false)
|
|
48
|
-
const pop = usePopover({ open, onOpenChange: setOpen, placement: 'right-start', offset: 12 })
|
|
78
|
+
const pop = usePopover({ open, onOpenChange: setOpen, placement: chevron ? 'top-start' : 'right-start', offset: 12 })
|
|
49
79
|
return (
|
|
50
80
|
<>
|
|
51
|
-
<span ref={pop.refs.setReference} {...pop.getReferenceProps()} className={`kol-float-chrome inline-flex rounded-full ${floatSurfaceClass(surface)}`}>
|
|
52
|
-
<Button variant="float" tone="ghost" iconOnly=
|
|
81
|
+
<span ref={pop.refs.setReference} {...pop.getReferenceProps()} className={chevron ? 'inline-flex' : `kol-float-chrome inline-flex rounded-full ${floatSurfaceClass(surface)}`}>
|
|
82
|
+
<Button variant="float" tone="ghost" iconOnly={chevron ? 'chevron-down' : 'more-vertical'} aria-label={label} pressed={open}
|
|
83
|
+
className={chevron ? 'kol-tool-chevron [--kol-tone-fg:var(--kol-oq-64)]' : '[--kol-tone-fg:var(--kol-oq-96)]'} />
|
|
53
84
|
</span>
|
|
54
85
|
{open && (
|
|
55
86
|
<PopoverPanel popover={pop} panel={false} focus={false}>
|
|
56
87
|
<MenuPanel variant="float" className="min-w-[200px]">
|
|
57
88
|
{items.map((it) => (
|
|
58
89
|
<MenuRow key={it.label} rowClass="kol-menu-row kol-helper-12" kbd={it.kbd} disabled={it.disabled}
|
|
90
|
+
indicator={chevron && it.id != null && it.id === active ? 'dot' : undefined}
|
|
59
91
|
iconLeft={it.icon && <Icon name={it.icon} size={16} className="text-oq-88" />}
|
|
60
|
-
onClick={() => { setOpen(false); it.onClick?.() }}>{it.label}</MenuRow>
|
|
92
|
+
onClick={() => { setOpen(false); onPick ? onPick(it) : it.onClick?.() }}>{it.label}</MenuRow>
|
|
61
93
|
))}
|
|
62
94
|
</MenuPanel>
|
|
63
95
|
</PopoverPanel>
|