@kolkrabbi/kol-shell 0.87.2 → 0.88.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-shell",
3
- "version": "0.87.2",
3
+ "version": "0.88.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.311.2",
25
- "@kolkrabbi/kol-framework": "^0.62.2",
26
- "@kolkrabbi/kol-theme": "^0.196.0",
27
- "@kolkrabbi/kol-icons": "^0.52.0"
24
+ "@kolkrabbi/kol-framework": "^0.62.4",
25
+ "@kolkrabbi/kol-component": "^0.313.0",
26
+ "@kolkrabbi/kol-icons": "^0.52.0",
27
+ "@kolkrabbi/kol-theme": "^0.196.0"
28
28
  },
29
29
  "files": [
30
30
  "src",
package/src/AppHub.jsx CHANGED
@@ -13,7 +13,7 @@ import SettingsLinks, { SettingsColophon } from './SettingsLinks.jsx'
13
13
  import About from './About.jsx'
14
14
  import { warnJsx } from './warnJsx.js'
15
15
  import { Icon } from '@kolkrabbi/kol-icons'
16
- import { Avatar, CommandOverlay, LabeledControlSection, MediaLibrary, ModalProvider, RAIL_PRESETS, SettingsFooter, SettingsPanel, SettingsSections, ShortcutsOverlay, TabsRow, shortcutInScope, useModal } from '@kolkrabbi/kol-component'
16
+ import { Avatar, Button, CommandOverlay, LabeledControlSection, MediaLibrary, ModalProvider, RAIL_PRESETS, SettingsFooter, SettingsPanel, SettingsSections, ShortcutsOverlay, TabsRow, shortcutInScope, useModal } from '@kolkrabbi/kol-component'
17
17
 
18
18
  /* taxonomy-ok: organism — nests AppShell / HubHome / HubSettings / HubDev (relative) + kol-component's CommandOverlay */
19
19
 
@@ -92,7 +92,15 @@ import { Avatar, CommandOverlay, LabeledControlSection, MediaLibrary, ModalProvi
92
92
  * foot, opening `MediaLibrary variant="picker"` (the column browser with the preview pane,
93
93
  * Cancel and Use — mirror's) over `client` (kol-media-client's shape, or the media
94
94
  * fixture's). OPT-IN: no `media`, no row
95
- * @param {Object} signIn `{ signedIn, user?, onProfile?, onPress }` — the user row at the rail's foot. OPT-IN: no
95
+ * @param {Object} phoneNav `{ more: (defaults) => rows }` — the phone pill's More sheet, edited by the app (HubAppOwnsItsRows).
96
+ * With `home.menu` · `home.signedOutActions` · `shell.foot`, the four places the Hub draws
97
+ * rows: each takes a function of its default rows, `{ icon, label, onPress | path, avatar? }`
98
+ * @param {Object} signIn `{ signedIn, user?, onProfile?, onPress, account? }` — the user row at the rail's foot. OPT-IN: no
99
+ * `account: { sections, content?, footer? }` (SettingsAccountTab, kol-fxr 2026-10-29 — *"why isnt
100
+ * account just in settings in account tab?"*): an Account tab, first in the settings rail while
101
+ * signed in — typed rows (`sections`), a node for what rows cannot say (`content`: the
102
+ * picture, Upload), and `footer: { label, onPress }` (Sign out). Without `onProfile` the
103
+ * account row opens the rail on that tab
96
104
  * `signIn`, no row. THE ACCOUNT (HubAccountRow, kol-fxr 2026-10-28 — user: *"I am the only user.
97
105
  * and we will treat me THE ONLY USER as a proper user"* · *"why does it say password for library
98
106
  * sync? … stupid."*): with `user: { name, avatar? }` the row is an account — signed out it reads
@@ -197,8 +205,12 @@ function HubFrame({
197
205
  shortcutsRailKey = 'S',
198
206
  masthead,
199
207
  shell,
208
+ /* `{ more: (defaults) => rows }` — the phone pill's More sheet, the app's edit of the Hub's rows (HubAppOwnsItsRows) */
209
+ phoneNav: phoneNavEdit,
200
210
  children,
201
211
  }) {
212
+ /* `shell.foot`: the rail's pinned foot as the app edits it — the rest of `shell` is AppShell's */
213
+ const { foot: footEdit, ...shellProps } = shell ?? {}
202
214
  const [sheet, setSheet] = useState(false)
203
215
  const [rail, setRail] = useState(false)
204
216
  const [search, setSearch] = useState(false)
@@ -211,6 +223,7 @@ function HubFrame({
211
223
  const { page: settingsPage = false, filters: settingsFilters = false, ...settingsProps } = settings ?? {}
212
224
  const settingsDrawer = !!settings && !settingsPage
213
225
  const [settingsTab, setSettingsTab] = useState('settings')
226
+ const account = signIn?.signedIn && signIn.account ? signIn.account : null
214
227
  const modal = useModal()
215
228
  const theme = useTheme()
216
229
  /* THE DEFAULT THEME IS A ROOT ATTRIBUTE kol-framework's theme reads (`data-theme-default`): reset (`theme.clear()`)
@@ -235,14 +248,18 @@ function HubFrame({
235
248
  if (settingsDrawer && settings.content != null) warnRailJsx('content')
236
249
  const railRows = settingsDrawer ? railSections(settings.sections) : []
237
250
  /* reset, live everywhere: the theme back to the system, then the app's own */
238
- const reset = () => { theme.clear(); settings.drawer?.onReset?.() }
251
+ const reset = () => { theme.clear(); settings?.drawer?.onReset?.() }
239
252
  /* SIGN IN ASKS IN THE DS DIALOG (review 2, § 5.2 — fxr's RailSignIn, verbatim copy): signed out, the password prompt —
240
253
  * empty cancels — then `onPress(password)`; signed in, the sign-out confirm, then `onPress(null)` */
241
254
  const askSignIn = async () => {
242
255
  if (!signIn) return
243
256
  /* an account: signed in opens the profile; signed out asks email and password */
244
- if (signIn.user || signIn.onProfile) {
245
- if (signIn.signedIn) { signIn.onProfile?.(); return }
257
+ if (signIn.user || signIn.onProfile || signIn.account) {
258
+ if (signIn.signedIn) {
259
+ if (signIn.onProfile) { signIn.onProfile(); return }
260
+ if (signIn.account) { setSettingsTab('account'); setSettingsOpen(true) }
261
+ return
262
+ }
246
263
  const got = await modal.form('Sign in', [
247
264
  { id: 'email', placeholder: 'Email', type: 'email', autoComplete: 'username' },
248
265
  { id: 'password', placeholder: 'Password', type: 'password', autoComplete: 'current-password' },
@@ -318,16 +335,22 @@ function HubFrame({
318
335
  * (no More), they stay on the page */
319
336
  const barOn = ['bar', 'pill'].includes(shell?.touch ?? RAIL_PRESETS.app.phone)
320
337
  const onHome = home && currentPath === homePath
321
- const homeActions = onHome && barOn ? [
338
+ /* the signed-in account as a row — Home's menu and the phone's More end on it (HomeMenuAccountRow) */
339
+ const accountAction = signIn?.signedIn && (signIn.user || signIn.account || signIn.onProfile)
340
+ ? { label: signIn.user?.name ?? 'Account', icon: 'user', avatar: signIn.user?.avatar, onPress: () => askSignIn() }
341
+ : undefined
342
+ const homeDefaults = onHome && barOn ? [
322
343
  ...(home.action ? [{ label: home.action.label, icon: 'plus', onPress: home.action.onClick }] : []),
323
344
  ...(walkthrough?.length ? [{ label: touring ? 'Close walkthrough' : 'Walkthrough', icon: 'book-open', onPress: () => setTouring((t) => !t) }] : []),
345
+ ...(accountAction ? [accountAction] : []),
324
346
  ] : []
347
+ const homeActions = onHome && barOn && typeof home.menu === 'function' ? home.menu(homeDefaults) ?? [] : homeDefaults
325
348
  /* SIGNED OUT (HubHomeSignedOut, 2026-10-28): Home is the stage, no files; the desk's round + carries Sign in beside New File
326
349
  * and Walkthrough; on a phone the pill is the app's chromes and More is the rail (frame A2) */
327
350
  const signedOutHome = onHome && (home.signedOut ?? (home.stage != null && !(home.files?.length)))
328
351
  const signInAction = signIn && !signIn.signedIn ? { label: 'Sign in', icon: 'user', onPress: () => askSignIn() } : undefined
329
352
  const page = onHome
330
- ? <HubHome app={app} iconComponent={iconComponent} walkthrough={walkthrough} {...home} touring={touring} onTouringChange={setTouring} actionsInBar={barOn} signInAction={signInAction} />
353
+ ? <HubHome app={app} iconComponent={iconComponent} walkthrough={walkthrough} {...home} touring={touring} onTouringChange={setTouring} actionsInBar={barOn} signInAction={signInAction} accountAction={accountAction} />
331
354
  : settingsPage && currentPath === settingsPath
332
355
  ? <HubSettings app={app} shortcuts={shortcuts} themeToggle={toggle} filters={settingsFilters} {...settingsProps} drawer={settingsProps.drawer ?? true} />
333
356
  : devOn && (currentPath === devPath || currentPath?.startsWith(`${devPath}/`))
@@ -337,13 +360,22 @@ function HubFrame({
337
360
  * *"why did the dev tab move? it was fine where it was. below stage"*); Settings keeps the bottom alone */
338
361
  const rows = devOn ? [...items, { icon: 'code', path: devPath, label: 'Dev' }] : items
339
362
  /* the pinned foot: Media, Sign in, Settings — each only when the app passes it */
340
- const bottom = [
363
+ const bottomDefaults = [
341
364
  ...(media ? [{ icon: 'image', path: MEDIA_PATH, label: 'Media' }] : []),
342
365
  ...(signIn ? [signIn.signedIn && signIn.user
343
366
  ? { icon: ACCOUNT_GLYPH, path: SIGN_IN_PATH, label: signIn.user.name ?? 'Account' }
344
367
  : { icon: signIn.signedIn ? 'cloud' : 'user', path: SIGN_IN_PATH, label: signIn.signedIn ? 'Signed in' : 'Sign in' }] : []),
345
368
  ...(settings ? SETTINGS_ROW(settingsDrawer ? SETTINGS_DRAWER : settingsPath) : []),
346
369
  ]
370
+ /* an app's row may press rather than route (`onPress`): it travels the rail as a sentinel path, and `go` presses it */
371
+ const pressed = {}
372
+ const asRows = (list) => (list ?? []).map((r, i) => {
373
+ if (r.path || !r.onPress) return r
374
+ const path = `#row:${i}:${r.label}`
375
+ pressed[path] = r.onPress
376
+ return { ...r, path }
377
+ })
378
+ const bottom = typeof footEdit === 'function' ? asRows(footEdit(bottomDefaults)) : bottomDefaults
347
379
  /* the phone bar lists Home as a tab — the rail draws it as the mark, the bar has no mark */
348
380
  const barItems = [...(home ? [{ icon: 'home-01', path: homePath, label: 'Home' }] : []), ...rows, ...bottom.map((r) => (r.icon === ACCOUNT_GLYPH ? { ...r, icon: 'user' } : r))]
349
381
  /* the rail's glyphs, with the account's avatar where its row is */
@@ -361,6 +393,7 @@ function HubFrame({
361
393
  if (path === MEDIA_PATH) { setMediaOpen(true); return }
362
394
  if (path === SIGN_IN_PATH) { askSignIn(); return }
363
395
  if (path === SETTINGS_DRAWER) { setSettingsOpen((v) => !v); return }
396
+ if (pressed[path]) { pressed[path](); return }
364
397
  return onNavigate?.(path, ...rest)
365
398
  }
366
399
 
@@ -392,7 +425,11 @@ function HubFrame({
392
425
  bottomItems={bottom}
393
426
  barItems={signedOutHome && home.chromes?.length ? home.chromes.map((c) => ({ id: c.label, label: c.label, icon: c.icon, onPress: c.onPress })) : barItems}
394
427
  barActions={homeActions}
395
- phoneNav={signedOutHome && home.chromes?.length ? { sheetItems: [...rows, ...bottom.map((r) => ({ ...r, icon: r.icon === ACCOUNT_GLYPH ? 'user' : r.icon, foot: true }))], moreKeepsOpen: true } : undefined}
428
+ phoneNav={(() => {
429
+ const sheet = [...rows, ...bottom.map((r) => ({ ...r, icon: r.icon === ACCOUNT_GLYPH ? 'user' : r.icon, foot: true }))]
430
+ if (typeof phoneNavEdit?.more === 'function') return { sheetItems: asRows(phoneNavEdit.more(sheet)), moreKeepsOpen: signedOutHome || undefined }
431
+ return signedOutHome && home.chromes?.length ? { sheetItems: sheet, moreKeepsOpen: true } : undefined
432
+ })()}
396
433
  logomark={app.logomark ? { svgUrl: app.logomark, title: app.name } : undefined}
397
434
  currentPath={currentPath}
398
435
  onNavigate={go}
@@ -408,7 +445,7 @@ function HubFrame({
408
445
  touch={RAIL_PRESETS.app.phone}
409
446
  masthead={masthead}
410
447
  pageWash="var(--kol-fg-02)"
411
- {...shell}
448
+ {...shellProps}
412
449
  >
413
450
  {page}
414
451
  {/* THE SHEET IS THE ⌘K MODAL WITH NO FIELD (ShortcutsOverlayCategories, kol-monitor 2026-10-18 — user: *"I said
@@ -428,22 +465,37 @@ function HubFrame({
428
465
  * TabsRow under the header — Settings first, then the app's (Monitor: Shortcuts, About, Repo; Mirror: Performance)
429
466
  * — like the labs rail's levels, never a page. Rows only: the Hub draws every string, so no rail can wear a class
430
467
  * the template does not */}
431
- {settingsDrawer && (
468
+ {(settingsDrawer || account) && (
432
469
  <SettingsPanel
433
470
  open={settingsOpen}
434
471
  variant="rail"
435
- title={settings.drawer?.title ?? 'Settings'}
472
+ title={settings?.drawer?.title ?? 'Settings'}
436
473
  onClose={() => setSettingsOpen(false)}
437
474
  /* the footer on every rail: the toggle, and a live reset */
438
475
  footer={<SettingsFooter onReset={reset}>{toggle}</SettingsFooter>}
439
476
  >
440
477
  {/* the tab row wraps in the 380 rail — five tabs (Mirror's Performance beside the Hub's three) overran it */}
441
- {railTabs.length > 0 && (
442
- <TabsRow look="text" size={12} tracked className="flex-wrap gap-x-6 gap-y-2" tabs={[{ id: 'settings', label: 'Settings' }, ...railTabs.map((t) => ({ id: t.value, label: t.label }))]} value={settingsTab} onChange={setSettingsTab} ariaLabel="Settings tabs" />
443
- )}
444
- {settingsTab === 'settings'
445
- ? (railRows.length > 0 && <SettingsSections sections={railRows} divided />)
446
- : railTabs.find((x) => x.value === settingsTab)?.named?.draw({ app, shortcuts })}
478
+ {(() => {
479
+ /* the Account tab first, while signed in (SettingsAccountTab); then Settings and the Hub's named tabs */
480
+ const tabs = [...(account ? [{ id: 'account', label: 'Account' }] : []), ...(settingsDrawer ? [{ id: 'settings', label: 'Settings' }] : []), ...railTabs.map((t) => ({ id: t.value, label: t.label }))]
481
+ const tab = tabs.some((t) => t.id === settingsTab) ? settingsTab : tabs[0]?.id
482
+ return (
483
+ <>
484
+ {tabs.length > 1 && <TabsRow look="text" size={12} tracked className="flex-wrap gap-x-6 gap-y-2" tabs={tabs} value={tab} onChange={setSettingsTab} ariaLabel="Settings tabs" />}
485
+ {tab === 'account'
486
+ ? (
487
+ <div className="flex flex-col gap-8">
488
+ {account.content}
489
+ {account.sections?.length > 0 && <SettingsSections sections={railSections(account.sections)} divided />}
490
+ {account.footer && <Button tone="outline" size="sm" className="self-start" onClick={account.footer.onPress}>{account.footer.label}</Button>}
491
+ </div>
492
+ )
493
+ : tab === 'settings'
494
+ ? (railRows.length > 0 && <SettingsSections sections={railRows} divided />)
495
+ : railTabs.find((x) => x.value === tab)?.named?.draw({ app, shortcuts })}
496
+ </>
497
+ )
498
+ })()}
447
499
  </SettingsPanel>
448
500
  )}
449
501
  </AppShell>
package/src/HubHome.jsx CHANGED
@@ -158,6 +158,15 @@ export default function HubHome({
158
158
  stage,
159
159
  chromes = [],
160
160
  signInAction,
161
+ /* AppHub's: the signed-in account row (HomeMenuAccountRow, kol-fxr 2026-10-29 — *"here is supposed to be user space as
162
+ * well"*), the menu's last row */
163
+ accountAction,
164
+ /* THE APP OWNS ITS ROWS (HubAppOwnsItsRows, kol-fxr 2026-10-29 — *"I dont wanna file every goddamn change"*): each a
165
+ * function of the Hub's rows, `(defaults) => rows` — keep them and edit, or replace them. Rows keep the Hub's shape
166
+ * `{ icon, label, onPress, avatar? }` and the Hub still draws them. `menu` is the masthead's round button signed in,
167
+ * `signedOutActions` the + on the signed-out page. */
168
+ menu,
169
+ signedOutActions,
161
170
  ...unknown
162
171
  }) {
163
172
  if (import.meta.env.DEV) warnUnknown(unknown)
@@ -224,10 +233,12 @@ export default function HubHome({
224
233
  * the phone bar's More draws (MoreRows in `.kol-more-sheet`). The foot row it replaces was a row of buttons under the
225
234
  * catalog, hence a bottom pad that read as a clipped last row. With the bar on a phone the bar's More carries both
226
235
  * and the button hides below `md`; with the drawer it stays on every width. */
227
- const menuActions = [
236
+ const baseActions = [
228
237
  ...(action ? [{ label: action.label, icon: 'plus', onPress: action.onClick }] : []),
229
238
  ...(steps.length ? [{ label: touring ? 'Close walkthrough' : 'Walkthrough', icon: 'book-open', onPress: () => setTouring((t) => !t) }] : []),
230
239
  ]
240
+ const menuDefaults = [...baseActions, ...(accountAction ? [accountAction] : [])]
241
+ const menuActions = typeof menu === 'function' ? menu(menuDefaults) ?? [] : menuDefaults
231
242
  /* with the drawer the button stays on the phone, stepped left of the shell's drawer trigger (fixed top-right, 32 at 12;
232
243
  * the variants gate caught the overlap on editor-hub at 390) */
233
244
  const headerMenu = menuActions.length ? <HomeMenu actions={menuActions} className={actionsInBar ? 'max-md:hidden' : 'max-md:mr-11'} /> : undefined
@@ -245,7 +256,8 @@ export default function HubHome({
245
256
  ) : undefined
246
257
 
247
258
  if (signedOut ?? (stage != null && files.length === 0)) {
248
- const outActions = [...menuActions, ...(signInAction ? [signInAction] : [])]
259
+ const outDefaults = [...baseActions, ...(signInAction ? [signInAction] : [])]
260
+ const outActions = typeof signedOutActions === 'function' ? signedOutActions(outDefaults) ?? [] : outDefaults
249
261
  return (
250
262
  <div className="relative min-h-dvh overflow-hidden" data-hub-signed-out>
251
263
  {stage && <div className="absolute inset-0" aria-hidden="true">{stage}</div>}
package/src/MoreSheet.jsx CHANGED
@@ -1,4 +1,4 @@
1
- import { Button } from '@kolkrabbi/kol-component'
1
+ import { Avatar, Button } from '@kolkrabbi/kol-component'
2
2
  import { Icon } from '@kolkrabbi/kol-icons'
3
3
 
4
4
  /* taxonomy-ok: molecule — a column of nav Buttons */
@@ -9,7 +9,8 @@ import { Icon } from '@kolkrabbi/kol-icons'
9
9
  * (user 2026-10-23: *"we could even make similar dropdown as we use in phone nav"*). The sheet's chrome is
10
10
  * `.kol-more-sheet` — the pill's ground and hairline, a 24px rounding, 8px pad — on whatever box holds the rows.
11
11
  *
12
- * @param {Array} actions `[{ label, icon?, onPress, checked? }]` — the page's own buttons, first. A row with `checked`
12
+ * @param {Array} actions `[{ label, icon?, avatar?, onPress, checked? }]` — the page's own buttons, first. `avatar` (a picture
13
+ * url — the account row) draws in the glyph's place. A row with `checked`
13
14
  * (a pick list — TransportPill's loop lengths) draws the 22px check, or keeps its space when false
14
15
  * @param {Array} items `[{ path, label, icon? }]` — destinations, after a divider's worth of nothing
15
16
  * @param {string} active the item path that is current
@@ -21,7 +22,8 @@ export default function MoreRows({ actions = [], items = [], active, onPick, ite
21
22
  const acts = (
22
23
  <>
23
24
  {actions.map((a) => (
24
- <Button key={a.label} variant="nav" size="lg" iconLeft={a.checked === undefined ? a.icon : undefined} iconSize={22} className="w-full justify-start h-11 gap-3" onClick={() => { onPick?.(a); a.onPress?.() }}>
25
+ <Button key={a.label} variant="nav" size="lg" iconLeft={a.checked === undefined && !a.avatar ? a.icon : undefined} iconSize={22} className="w-full justify-start h-11 gap-3" onClick={() => { onPick?.(a); a.onPress?.() }}>
26
+ {a.avatar && <Avatar src={a.avatar} alt="" size="xs" />}
25
27
  {a.checked !== undefined && (
26
28
  <span className="inline-flex items-center justify-center shrink-0" style={{ width: 22, height: 22 }}>{a.checked && <Icon name="check" size={22} />}</span>
27
29
  )}