@kolkrabbi/kol-shell 0.85.0 → 0.87.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 +6 -6
- package/src/AppHub.jsx +7 -2
- package/src/AppShell.jsx +4 -1
- package/src/HubHome.jsx +38 -3
- package/src/PhoneNav.jsx +20 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.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.311.0",
|
|
16
16
|
"@kolkrabbi/kol-framework": ">=0.55.0",
|
|
17
17
|
"@kolkrabbi/kol-icons": ">=0.16.0",
|
|
18
18
|
"@kolkrabbi/kol-theme": ">=0.187.0",
|
|
@@ -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-framework": "^0.
|
|
26
|
-
"@kolkrabbi/kol-
|
|
27
|
-
"@kolkrabbi/kol-
|
|
24
|
+
"@kolkrabbi/kol-icons": "^0.52.0",
|
|
25
|
+
"@kolkrabbi/kol-framework": "^0.61.0",
|
|
26
|
+
"@kolkrabbi/kol-component": "^0.311.0",
|
|
27
|
+
"@kolkrabbi/kol-theme": "^0.195.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
package/src/AppHub.jsx
CHANGED
|
@@ -320,8 +320,12 @@ function HubFrame({
|
|
|
320
320
|
...(home.action ? [{ label: home.action.label, icon: 'plus', onPress: home.action.onClick }] : []),
|
|
321
321
|
...(walkthrough?.length ? [{ label: touring ? 'Close walkthrough' : 'Walkthrough', icon: 'book-open', onPress: () => setTouring((t) => !t) }] : []),
|
|
322
322
|
] : []
|
|
323
|
+
/* SIGNED OUT (HubHomeSignedOut, 2026-10-28): Home is the stage, no files; the desk's round + carries Sign in beside New File
|
|
324
|
+
* and Walkthrough; on a phone the pill is the app's chromes and More is the rail (frame A2) */
|
|
325
|
+
const signedOutHome = onHome && (home.signedOut ?? (home.stage != null && !(home.files?.length)))
|
|
326
|
+
const signInAction = signIn && !signIn.signedIn ? { label: 'Sign in', icon: 'user', onPress: () => askSignIn() } : undefined
|
|
323
327
|
const page = onHome
|
|
324
|
-
? <HubHome app={app} iconComponent={iconComponent} walkthrough={walkthrough} {...home} touring={touring} onTouringChange={setTouring} actionsInBar={barOn} />
|
|
328
|
+
? <HubHome app={app} iconComponent={iconComponent} walkthrough={walkthrough} {...home} touring={touring} onTouringChange={setTouring} actionsInBar={barOn} signInAction={signInAction} />
|
|
325
329
|
: settingsPage && currentPath === settingsPath
|
|
326
330
|
? <HubSettings app={app} shortcuts={shortcuts} themeToggle={toggle} filters={settingsFilters} {...settingsProps} drawer={settingsProps.drawer ?? true} />
|
|
327
331
|
: devOn && (currentPath === devPath || currentPath?.startsWith(`${devPath}/`))
|
|
@@ -384,8 +388,9 @@ function HubFrame({
|
|
|
384
388
|
<AppShell
|
|
385
389
|
items={rows}
|
|
386
390
|
bottomItems={bottom}
|
|
387
|
-
barItems={barItems}
|
|
391
|
+
barItems={signedOutHome && home.chromes?.length ? home.chromes.map((c) => ({ id: c.label, label: c.label, icon: c.icon, onPress: c.onPress })) : barItems}
|
|
388
392
|
barActions={homeActions}
|
|
393
|
+
phoneNav={signedOutHome && home.chromes?.length ? { sheetItems: [...rows, ...bottom.map((r) => ({ ...r, icon: r.icon === ACCOUNT_GLYPH ? 'user' : r.icon, foot: true }))], moreKeepsOpen: true } : undefined}
|
|
389
394
|
logomark={app.logomark ? { svgUrl: app.logomark, title: app.name } : undefined}
|
|
390
395
|
currentPath={currentPath}
|
|
391
396
|
onNavigate={go}
|
package/src/AppShell.jsx
CHANGED
|
@@ -75,6 +75,8 @@ import { TABBAR_H, TABBAR_PILL_INSET, MastheadContext, RAIL_PRESETS } from '@kol
|
|
|
75
75
|
* @param {'nav'|'panel'|'transport'} [props.navVariant='nav'] THE PHONE PILL'S PRESET (PhoneNavVariants, kol-fxr 2026-10-28 —
|
|
76
76
|
* the Home pill kept its hairline while Labs tuned its own by hand): `nav` is no hairline,
|
|
77
77
|
* no shadow, the circle; PhoneNav's `PHONE_NAV_VARIANTS` is the table
|
|
78
|
+
* @param {Object} [props.phoneNav] any further PhoneNav prop for the pill (`sheetItems`, `moreKeepsOpen`, …) — the Hub's
|
|
79
|
+
* signed-out Home passes the rail as More's rows (2026-10-28)
|
|
78
80
|
* @param {string[]|Function} [props.moreItems] which rail rows the More sheet lists (PhoneNav `moreItems`) — unset, all of them
|
|
79
81
|
* @param {Array} [props.barItems] the bar's destinations under `touch="bar"` (default items + bottomItems) —
|
|
80
82
|
* a Hub passes Home first, which the rail draws as the mark instead
|
|
@@ -162,6 +164,7 @@ export default function AppShell({
|
|
|
162
164
|
barActions,
|
|
163
165
|
navVariant = 'nav',
|
|
164
166
|
moreItems,
|
|
167
|
+
phoneNav,
|
|
165
168
|
barHiddenOn = NO_PATHS,
|
|
166
169
|
masthead,
|
|
167
170
|
children,
|
|
@@ -389,7 +392,7 @@ export default function AppShell({
|
|
|
389
392
|
onClick={() => setDrawerOpen(false)}
|
|
390
393
|
/>
|
|
391
394
|
)}
|
|
392
|
-
{bar && <PhoneNav items={barItems ?? [...(items ?? []), ...(bottomItems ?? [])]} actions={barActions} shape={touch === 'pill' ? 'pill' : 'bar'} variant={navVariant} moreItems={moreItems} currentPath={currentPath} onNavigate={navigate} />}
|
|
395
|
+
{bar && <PhoneNav items={barItems ?? [...(items ?? []), ...(bottomItems ?? [])]} actions={barActions} shape={touch === 'pill' ? 'pill' : 'bar'} variant={navVariant} moreItems={moreItems} {...phoneNav} currentPath={currentPath} onNavigate={navigate} />}
|
|
393
396
|
{!navHidden && !bar && !barAside && (
|
|
394
397
|
<Rail
|
|
395
398
|
items={items}
|
package/src/HubHome.jsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import { Button, PopoverPanel, usePopover, useMediaQuery } from '@kolkrabbi/kol-component'
|
|
2
|
+
import { Button, PopoverPanel, usePopover, useMediaQuery, VectorLoader } from '@kolkrabbi/kol-component'
|
|
3
|
+
import PhoneNav from './PhoneNav.jsx'
|
|
4
|
+
import WalkthroughPanel from './WalkthroughPanel.jsx'
|
|
3
5
|
import MoreRows from './MoreSheet.jsx'
|
|
4
6
|
import CatalogPage from './CatalogPage.jsx'
|
|
5
7
|
import { useTouchPrimary } from './TouchDeviceOverlay.jsx'
|
|
@@ -146,6 +148,16 @@ export default function HubHome({
|
|
|
146
148
|
touring: touringProp,
|
|
147
149
|
onTouringChange,
|
|
148
150
|
actionsInBar = false,
|
|
151
|
+
/* SIGNED OUT (HubHomeSignedOut, kol-fxr 2026-10-28, frames A2 · B2 — user: *"we shouldnt see any files until you've
|
|
152
|
+
* LOGGED-IN. we should rather have something unique to an unlogged experience"*): no catalog, no views, no filters. The
|
|
153
|
+
* `stage` node lies full-bleed behind the page (fxr's live generator); the mark top-left, alone (48 on a phone, 112 on a
|
|
154
|
+
* desk); the round `+` top-right opening New File, Walkthrough and Sign in (`signInAction`, AppHub's); the app's `chromes`
|
|
155
|
+
* as the desk's dock pill bottom-left (PhoneNav `variant="dock"`) — the phone's pill is AppHub's, the chromes with the
|
|
156
|
+
* rail under More. On by `signedOut`, or by a `stage` with no files. Signed in, nothing here changes. */
|
|
157
|
+
signedOut,
|
|
158
|
+
stage,
|
|
159
|
+
chromes = [],
|
|
160
|
+
signInAction,
|
|
149
161
|
...unknown
|
|
150
162
|
}) {
|
|
151
163
|
if (import.meta.env.DEV) warnUnknown(unknown)
|
|
@@ -232,6 +244,28 @@ export default function HubHome({
|
|
|
232
244
|
</div>
|
|
233
245
|
) : undefined
|
|
234
246
|
|
|
247
|
+
if (signedOut ?? (stage != null && files.length === 0)) {
|
|
248
|
+
const outActions = [...menuActions, ...(signInAction ? [signInAction] : [])]
|
|
249
|
+
return (
|
|
250
|
+
<div className="relative min-h-dvh overflow-hidden" data-hub-signed-out>
|
|
251
|
+
{stage && <div className="absolute inset-0" aria-hidden="true">{stage}</div>}
|
|
252
|
+
{app.logomark && (
|
|
253
|
+
<div className="absolute left-4 top-6 w-12 h-12 md:left-20 md:top-16 md:w-28 md:h-28 text-emphasis">
|
|
254
|
+
<VectorLoader src={app.logomark} size="100%" role="img" aria-label={app.name} />
|
|
255
|
+
</div>
|
|
256
|
+
)}
|
|
257
|
+
{outActions.length > 0 && <HomeMenu actions={outActions} icon="plus" className="absolute right-16 top-[72px] max-md:hidden" />}
|
|
258
|
+
{chromes.length > 0 && <PhoneNav variant="dock" shape="pill" items={chromes.map((c) => ({ id: c.label, label: c.label, icon: c.icon, onPress: c.onPress }))} />}
|
|
259
|
+
{/* the walkthrough over the stage, where the catalog's would sit */}
|
|
260
|
+
{touring && steps.length > 0 && (
|
|
261
|
+
<div className="absolute inset-x-4 top-24 md:left-20 md:right-auto md:top-52 md:w-[560px]">
|
|
262
|
+
<WalkthroughPanel steps={steps} iconComponent={iconComponent} onClose={close} />
|
|
263
|
+
</div>
|
|
264
|
+
)}
|
|
265
|
+
</div>
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
|
|
235
269
|
return (
|
|
236
270
|
<CatalogPage
|
|
237
271
|
preset="app"
|
|
@@ -257,14 +291,15 @@ export default function HubHome({
|
|
|
257
291
|
}
|
|
258
292
|
|
|
259
293
|
/* the masthead's round button and its sheet — the catalog's VariantsButton shape, the phone More's rows */
|
|
260
|
-
function HomeMenu({ actions, className = '' }) {
|
|
294
|
+
function HomeMenu({ actions, icon = 'more', className = '' }) {
|
|
261
295
|
const [open, setOpen] = useState(false)
|
|
262
296
|
/* the sheet opens to the LEFT of the button, top edges on one line (user 2026-10-23) — as the phone's sits beside its × */
|
|
263
297
|
const popover = usePopover({ open, onOpenChange: setOpen, placement: 'left-start', offset: 12 })
|
|
264
298
|
return (
|
|
265
299
|
<div className={className}>
|
|
266
300
|
<span ref={popover.refs.setReference} {...popover.getReferenceProps()} className="inline-flex">
|
|
267
|
-
|
|
301
|
+
{/* `icon` — `more` on Home, `plus` signed out (frame B2), the × while its sheet is open */}
|
|
302
|
+
<Button iconOnly={icon === 'more' ? 'more' : open ? 'x' : icon} size="lg" tone="inverted" radius="full" aria-label={open ? 'Close' : 'Actions'} pressed={open} />
|
|
268
303
|
</span>
|
|
269
304
|
<PopoverPanel popover={popover} panel={false} className="kol-more-sheet" style={{ minWidth: 220 }}>
|
|
270
305
|
<MoreRows actions={actions} onPick={() => setOpen(false)} />
|
package/src/PhoneNav.jsx
CHANGED
|
@@ -48,11 +48,18 @@ import MoreRows from './MoreSheet.jsx'
|
|
|
48
48
|
* menu list … but also ship with prop so you can customise"*). The sheet lists every row the rail has, the ones in the pill
|
|
49
49
|
* included and the pinned foot last, then the page's actions. Before, it held only what did not fit.
|
|
50
50
|
* @param {string[]|Function} moreItems which rows More lists — an allow-list of paths, or `(item) => boolean`. Unset: all
|
|
51
|
+
* @param {Array} sheetItems the More rows themselves, when they are not the pill's (HubHomeSignedOut, 2026-10-28: the pill holds
|
|
52
|
+
* the app's chromes and More holds the rail). Rows flagged `foot` (the pinned Media · Sign in · Settings)
|
|
53
|
+
* sit AFTER the page's actions, the rest before — frame A2's order
|
|
54
|
+
*
|
|
55
|
+
* `dock` (PhoneNavDock, kol-fxr 2026-10-28, frame B2): the pill on a DESK — md and up, at the content's bottom-left (TabsRow
|
|
56
|
+
* `dock`), no More (the rail is right there). An app shows it beside the rail, not instead of it.
|
|
51
57
|
*/
|
|
52
58
|
export const PHONE_NAV_VARIANTS = {
|
|
53
59
|
nav: { border: false, shadow: false, active: 'circle' },
|
|
54
60
|
panel: { placement: 'top', foldable: true, moreKeepsOpen: true, border: false, shadow: false, active: 'circle' },
|
|
55
61
|
transport: { border: false, shadow: true, active: 'circle' },
|
|
62
|
+
dock: { dock: true, border: false, shadow: false, active: 'circle' },
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
const MORE = '__more'
|
|
@@ -62,7 +69,7 @@ const activePath = (items, path) => items
|
|
|
62
69
|
.filter((i) => (i.path === '/' ? path === '/' : path === i.path || path.startsWith(`${i.path}/`)))
|
|
63
70
|
.sort((a, b) => b.path.length - a.path.length)[0]?.path
|
|
64
71
|
|
|
65
|
-
export default function PhoneNav({ items = [], currentPath = '/', onNavigate, actions = [], shape = 'bar', variant, placement: placementProp, border: borderProp, shadow: shadowProp, active: activeProp, foldable: foldableProp, folded, onFoldChange, moreKeepsOpen: keepsOpenProp, moreItems }) {
|
|
72
|
+
export default function PhoneNav({ items = [], currentPath = '/', onNavigate, actions = [], shape = 'bar', variant, placement: placementProp, border: borderProp, shadow: shadowProp, active: activeProp, foldable: foldableProp, folded, onFoldChange, moreKeepsOpen: keepsOpenProp, moreItems, sheetItems, dock: dockProp }) {
|
|
66
73
|
const preset = PHONE_NAV_VARIANTS[variant] ?? {}
|
|
67
74
|
const placement = placementProp ?? preset.placement ?? 'bottom'
|
|
68
75
|
const border = borderProp ?? preset.border ?? true
|
|
@@ -70,6 +77,7 @@ export default function PhoneNav({ items = [], currentPath = '/', onNavigate, ac
|
|
|
70
77
|
const activeShape = activeProp ?? preset.active
|
|
71
78
|
const foldable = foldableProp ?? preset.foldable ?? false
|
|
72
79
|
const moreKeepsOpen = keepsOpenProp ?? preset.moreKeepsOpen ?? false
|
|
80
|
+
const dock = dockProp ?? preset.dock ?? false
|
|
73
81
|
const [open, setOpen] = useState(false)
|
|
74
82
|
useEffect(() => { setOpen(false) }, [currentPath])
|
|
75
83
|
useEffect(() => {
|
|
@@ -80,18 +88,22 @@ export default function PhoneNav({ items = [], currentPath = '/', onNavigate, ac
|
|
|
80
88
|
}, [open])
|
|
81
89
|
|
|
82
90
|
const overflow = items.length > MAX || (actions.length > 0 && items.length >= MAX)
|
|
83
|
-
const hasMore = overflow || actions.length > 0
|
|
91
|
+
const hasMore = !dock && (overflow || actions.length > 0 || (sheetItems?.length ?? 0) > 0)
|
|
84
92
|
const inBar = overflow ? items.slice(0, MAX - 1) : items
|
|
85
93
|
const inMore = overflow ? items.slice(MAX - 1) : []
|
|
86
94
|
/* the sheet's rows: the whole nav, filtered by `moreItems` */
|
|
87
95
|
const allow = typeof moreItems === 'function' ? moreItems : Array.isArray(moreItems) ? (i) => moreItems.includes(i.path) : () => true
|
|
88
|
-
const moreRows = items.filter(allow)
|
|
96
|
+
const moreRows = (sheetItems ?? items).filter(allow)
|
|
97
|
+
const before = moreRows.filter((i) => !i.foot)
|
|
98
|
+
const after = moreRows.filter((i) => i.foot)
|
|
89
99
|
const active = activePath(items, currentPath)
|
|
90
100
|
const value = open || inMore.some((i) => i.path === active) ? MORE : active
|
|
91
101
|
|
|
92
102
|
const key = (i) => i.path ?? i.id ?? i.label
|
|
93
103
|
const tabs = inBar.map((i) => ({ value: key(i), label: i.label, icon: i.icon, selected: i.selected ?? (moreKeepsOpen ? key(i) === active : undefined) }))
|
|
94
|
-
|
|
104
|
+
/* with the pill kept whole, the More slot itself turns to × while its sheet is open, and a press closes it
|
|
105
|
+
* (PhonePillMoreTurnsToClose, kol-fxr 2026-10-28 — frame A2: *"[...] that makes a list and nav turns to (X)"*) */
|
|
106
|
+
if (hasMore) tabs.push({ value: MORE, label: open && moreKeepsOpen ? 'Close' : 'More', icon: open && moreKeepsOpen ? 'x' : 'more', selected: moreKeepsOpen ? open : undefined })
|
|
95
107
|
/* THE SHEET HUGS ITS WORDS AND SITS BESIDE THE × (user 2026-10-23, his reference: iOS Photos' menu next to its ×, *"but
|
|
96
108
|
* align to bottom"*) — to the left of the collapsed ×, a 12px gap, the two bottom edges on one line */
|
|
97
109
|
const pill = shape === 'pill'
|
|
@@ -127,7 +139,9 @@ export default function PhoneNav({ items = [], currentPath = '/', onNavigate, ac
|
|
|
127
139
|
)}
|
|
128
140
|
{open && (
|
|
129
141
|
<div className="kol-phone-nav-more kol-more-sheet" role="menu" aria-label="More" style={sheetStyle}>
|
|
130
|
-
|
|
142
|
+
{/* the nav, the page's actions, then the pinned foot (frame A2) */}
|
|
143
|
+
<MoreRows actions={actions} items={before} itemsFirst active={active} onPick={(x) => { setOpen(false); if (x.onPress && !actions.includes(x)) { x.onPress(); return } if (x.path) onNavigate?.(x.path) }} />
|
|
144
|
+
{after.length > 0 && <MoreRows items={after} active={active} onPick={(x) => { setOpen(false); if (x.onPress) { x.onPress(); return } if (x.path) onNavigate?.(x.path) }} />}
|
|
131
145
|
</div>
|
|
132
146
|
)}
|
|
133
147
|
<TabsRow
|
|
@@ -139,6 +153,7 @@ export default function PhoneNav({ items = [], currentPath = '/', onNavigate, ac
|
|
|
139
153
|
edge={top ? 'top' : 'bottom'}
|
|
140
154
|
border={border}
|
|
141
155
|
shadow={shadow}
|
|
156
|
+
dock={dock}
|
|
142
157
|
active={activeShape}
|
|
143
158
|
foldable={foldable}
|
|
144
159
|
folded={folded}
|