@kolkrabbi/kol-shell 0.75.0 → 0.77.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 +7 -6
- package/src/About.jsx +17 -0
- package/src/AppHub.jsx +252 -20
- package/src/AppShell.jsx +35 -13
- package/src/AppStudio.jsx +32 -9
- package/src/CatalogGrid.jsx +56 -0
- package/src/CatalogPage.jsx +100 -45
- package/src/HubHome.jsx +190 -35
- package/src/HubSettings.jsx +34 -3
- package/src/MoreSheet.jsx +40 -0
- package/src/PhoneNav.jsx +23 -18
- package/src/SettingsLinks.jsx +1 -1
- package/src/SettingsScaffold.jsx +8 -2
- package/src/SettingsShortcuts.jsx +1 -1
- package/src/StudioCreate.jsx +275 -0
- package/src/WalkthroughPanel.jsx +12 -7
- package/src/index.js +3 -0
- package/src/warnJsx.js +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The application shell",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,18 +12,19 @@
|
|
|
12
12
|
"./src/*": "./src/*"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@kolkrabbi/kol-component": ">=0.
|
|
15
|
+
"@kolkrabbi/kol-component": ">=0.296.0",
|
|
16
|
+
"@kolkrabbi/kol-framework": ">=0.53.0",
|
|
16
17
|
"@kolkrabbi/kol-icons": ">=0.16.0",
|
|
17
|
-
"@kolkrabbi/kol-theme": ">=0.
|
|
18
|
+
"@kolkrabbi/kol-theme": ">=0.184.0",
|
|
18
19
|
"gsap": "^3.13.0",
|
|
19
20
|
"react": "^18.3.0 || ^19.0.0",
|
|
20
21
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
|
-
"@kolkrabbi/kol-component": "^0.
|
|
24
|
-
"@kolkrabbi/kol-icons": "^0.41.0",
|
|
24
|
+
"@kolkrabbi/kol-component": "^0.296.0",
|
|
25
25
|
"@kolkrabbi/kol-framework": "^0.53.0",
|
|
26
|
-
"@kolkrabbi/kol-
|
|
26
|
+
"@kolkrabbi/kol-icons": "^0.45.0",
|
|
27
|
+
"@kolkrabbi/kol-theme": "^0.184.0"
|
|
27
28
|
},
|
|
28
29
|
"files": [
|
|
29
30
|
"src",
|
package/src/About.jsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { warnJsx } from './warnJsx.js'
|
|
2
|
+
|
|
3
|
+
/* THE APP'S ABOUT, AS DATA: `app.about` is a string or an array of paragraphs, drawn here in the Hub's voice — mono-14,
|
|
4
|
+
* meta ink, a 16px step between paragraphs — on the settings rail's About tab and the settings page alike. A node is
|
|
5
|
+
* still drawn, with a dev warning: it is the consumer picking the class, which no Hub surface takes (2026-10-24). */
|
|
6
|
+
export default function About({ about }) {
|
|
7
|
+
if (about == null) return null
|
|
8
|
+
if (typeof about === 'string' || Array.isArray(about)) {
|
|
9
|
+
return (
|
|
10
|
+
<div className="kol-mono-14 text-fg-48" style={{ maxWidth: 640 }}>
|
|
11
|
+
{(Array.isArray(about) ? about : [about]).map((p, i) => <p key={i} className={i ? 'mt-4' : ''}>{p}</p>)}
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
warnJsx('app.about', 'Pass a string, or an array of paragraphs.')
|
|
16
|
+
return <div className="kol-mono-14 text-fg-48" style={{ maxWidth: 640 }}>{about}</div>
|
|
17
|
+
}
|
package/src/AppHub.jsx
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react'
|
|
2
|
+
/* THE TOGGLE IS THE HUB'S (user 2026-10-24: *"THIS SHOULDNT BE POSSIBLE if you were using a preset"*): kol-framework's
|
|
3
|
+
ThemeToggle, imported by its file so the framework's router-bound chrome never rides along, drawn here with the Hub's
|
|
4
|
+
props on every rail — no app passes a toggle. kol-framework is kol-shell's peer for this (ARCHITECTURE §3: the shell
|
|
5
|
+
consumes component + framework). `useTheme` is the Hub's own setting: reset hands the theme back to the system. */
|
|
6
|
+
import ThemeToggle from '@kolkrabbi/kol-framework/src/ThemeToggle.jsx'
|
|
7
|
+
import { useTheme } from '@kolkrabbi/kol-framework/src/theme.js'
|
|
2
8
|
import AppShell from './AppShell.jsx'
|
|
3
9
|
import HubHome from './HubHome.jsx'
|
|
4
10
|
import HubSettings from './HubSettings.jsx'
|
|
5
11
|
import HubDev from './HubDev.jsx'
|
|
6
|
-
import {
|
|
12
|
+
import SettingsLinks, { SettingsColophon } from './SettingsLinks.jsx'
|
|
13
|
+
import About from './About.jsx'
|
|
14
|
+
import { warnJsx } from './warnJsx.js'
|
|
15
|
+
import { CommandOverlay, LabeledControlSection, MediaLibrary, ModalProvider, RAIL_PRESETS, SettingsFooter, SettingsPanel, SettingsSections, ShortcutsOverlay, TabsRow, shortcutInScope, useModal } from '@kolkrabbi/kol-component'
|
|
7
16
|
|
|
8
17
|
/* taxonomy-ok: organism — nests AppShell / HubHome / HubSettings / HubDev (relative) + kol-component's CommandOverlay */
|
|
9
18
|
|
|
@@ -24,35 +33,122 @@ import { CommandOverlay, ShortcutsOverlay } from '@kolkrabbi/kol-component'
|
|
|
24
33
|
* (`<Outlet/>`) as children.
|
|
25
34
|
*
|
|
26
35
|
* KEYS: `,` toggles Settings · `S` toggles the shortcuts sheet · `⇧S` the shortcuts rail · `\` hides the rail ·
|
|
27
|
-
* ⌥1…9 walks the rail top to bottom, mark first, Settings last. None fire while typing.
|
|
36
|
+
* ⌥1…9 walks the rail top to bottom, mark first, Settings last · ⌘K / Ctrl+K the search modal. None fire while typing.
|
|
37
|
+
*
|
|
38
|
+
* ⌘K IS ONE MODAL (user 2026-10-23, HubHomeContract's review: *"no search command k"*; one modal, not two): the
|
|
39
|
+
* `CommandOverlay` in search mode over Files (Home's `files`, Enter opens one through `home.onOpen`), Pages (the
|
|
40
|
+
* mark, the rail rows, the pinned rows; Enter navigates) and Shortcuts (this page's keymap as folds, read-only).
|
|
41
|
+
* `S` opens the same overlay in shortcuts mode, every section expanded.
|
|
42
|
+
*
|
|
43
|
+
* MEDIA AND SIGN IN ARE THE HUB'S ROWS (user 2026-10-23: *"they all have media and sign in … its about unification
|
|
44
|
+
* and simplification"*): fxr, mirror and monitor each hand-wired both through `shell.bottomItems`. `media` and
|
|
45
|
+
* `signIn` pin them at the rail's foot — Media, Sign in, Settings — as sentinels, never routes: Media opens the DS
|
|
46
|
+
* picker over the consumer's client, Sign in asks for the password in the DS dialog and hands it to the consumer. `shell.bottomItems` still replaces
|
|
47
|
+
* the whole foot, as it always did.
|
|
28
48
|
*
|
|
29
49
|
* @param {Object} app `{ name, subtitle, logomark (svg url), about (node), links [{label,url}] }`
|
|
30
50
|
* @param {Array} items the tool's rail rows `{ icon, path, label }` — Home is the mark, Settings is pinned
|
|
31
51
|
* @param {string} currentPath · {Function} onNavigate · {ElementType} iconComponent as AppShell
|
|
32
52
|
* @param {string} homePath where Home lives (default `/`); anything else puts the tool at `/`
|
|
33
|
-
* @param {Object} home HubHome's props (`
|
|
53
|
+
* @param {Object} home HubHome's props — Home's DATA (`files`, `template`, `onOpen`, the verbs, `action`,
|
|
54
|
+
* `filterGroups`, `views`, …; HubHomeContract 2026-10-23: the Hub draws every card).
|
|
34
55
|
* OPT-IN (apps review 2026-09-29): no `home`, no Home page — `homePath` renders the
|
|
35
56
|
* tool and the mark goes there (media-hub: the column browser IS the app)
|
|
36
57
|
* @param {Array} walkthrough the steps Home's Walkthrough button opens
|
|
37
|
-
* @param {Object} settings
|
|
38
|
-
* OPT-IN like AppShell's `bottomItems` (apps review 2026-09-29: *"not sure it makes sense
|
|
58
|
+
* @param {Object} settings OPT-IN like AppShell's `bottomItems` (apps review 2026-09-29: *"not sure it makes sense
|
|
39
59
|
* to neccessarily have settings manditory part of the rail"*) — no `settings`, no rail
|
|
40
|
-
* row, no route, no `,` key.
|
|
60
|
+
* row, no route, no `,` key. THREE TIERS, opt-in (review 2, § 6.3 — *"most of the time you
|
|
61
|
+
* will only need a siderail … if you are super heavy then you might want a page, then when
|
|
62
|
+
* the page is getting heavy you might want filters"*):
|
|
63
|
+
* THE RAIL (the default, studio-hub's) — the Settings row and `,` open `SettingsPanel` over
|
|
64
|
+
* `sections` (SettingsSections' rows AS DATA — typed rows, `type: 'choice' | 'switch'` with
|
|
65
|
+
* their options and values, or a text `value`; the Hub draws every control, label, value and
|
|
66
|
+
* note in its own class and tone), the theme toggle and reset in its footer. ONE SHAPE ON
|
|
67
|
+
* EVERY RAIL (user 2026-10-24: *"is there no criteria of what information goes into settings
|
|
68
|
+
* rail?"* · *"not 2 lines"*): the tab row is exactly Settings · Shortcuts · About · Repo —
|
|
69
|
+
* the three drawn by the Hub from `shortcuts`, `app.about` and `app.links`, on studio-hub as
|
|
70
|
+
* on every hub; an app has NO tab of its own (a fifth word does not fit the rail on one
|
|
71
|
+
* line) — its rows all go under Settings as sections, and the rail scrolls. Reset is live on
|
|
72
|
+
* every rail: it hands the theme back to the system (the Hub's own setting), then runs the
|
|
73
|
+
* app's `drawer.onReset` when it has one. NO JSX REACHES THE RAIL
|
|
74
|
+
* (*"THIS SHOULDNT BE POSSIBLE if you were using a preset"*): `content`, a tab's `content`
|
|
75
|
+
* and a row's `render` are ignored here with a dev warning — the page tier keeps them. No
|
|
76
|
+
* route, no page.
|
|
77
|
+
* `page: true` — HubSettings at `settingsPath` (its props: `sections`, `content`, `picker`,
|
|
78
|
+
* `comboLabel`, …): the row and `,` navigate to it, its gear opens the drawer; two columns
|
|
79
|
+
* from `lg`, no filter bar. `filters: true` (with `page`) — the page keeps its `ContentFilters`
|
|
80
|
+
* bar, its tabs (`tabs`, ABOUT, REPO) and its search
|
|
41
81
|
* @param {Object} dev HubDev's props (`tabs`, `title`, `subtitle`) + `path` (default `/dev`). OPT-IN, and only on
|
|
42
82
|
* a dev server (`import.meta.env.DEV`; `always: true` overrides) — a `code` row after
|
|
43
83
|
* the app's own rows (CompareGridDevTab · HubDevChrome, kol-monitor)
|
|
84
|
+
* @param {Object} media `{ client, accept?, onSelect?(url, { contentType, kind }) }` — the Media row at the rail's
|
|
85
|
+
* foot, opening `MediaLibrary variant="picker"` (the column browser with the preview pane,
|
|
86
|
+
* Cancel and Use — mirror's) over `client` (kol-media-client's shape, or the media
|
|
87
|
+
* fixture's). OPT-IN: no `media`, no row
|
|
88
|
+
* @param {Object} signIn `{ signedIn, onPress(password | null) }` — the user row at the rail's foot: a `user` glyph
|
|
89
|
+
* and "Sign in" while out, a `cloud` glyph and "Signed in" while in. The Hub asks in the DS
|
|
90
|
+
* dialog — signed out, the password prompt (empty cancels), then `onPress(password)`;
|
|
91
|
+
* signed in, the sign-out confirm, then `onPress(null)`. OPT-IN: no `signIn`, no row
|
|
44
92
|
* @param {Array} shortcuts `[{ section, items: [{ id, label, combo }] }]` — the sheet AND Settings
|
|
45
|
-
* @param {
|
|
93
|
+
* @param {*} themeToggle RETIRED 2026-10-24 — the Hub draws kol-framework's `ThemeToggle` itself, the same on every
|
|
94
|
+
* rail (*"wrong themetoggle"* — two apps had written `tone="sunken"`); a value passed here
|
|
95
|
+
* is ignored with a dev warning
|
|
46
96
|
* @param {string} shortcutsKey default `s`; `null` turns the sheet key off (a tool that owns S)
|
|
47
97
|
* @param {string} shortcutsRailKey default `S` (⇧S) — the same keymap in the right rail (`ShortcutsOverlay variant="rail"`),
|
|
48
98
|
* this page's sections; `null` turns it off. The rail was hand-built in kol-monitor (2026-10-18)
|
|
49
99
|
* @param {'display'|'mono'} masthead the app's one masthead (AppShell's) — set, Home and Settings follow it; unset
|
|
50
100
|
* (the default), they keep the Hub's mono title (2026-09-29)
|
|
51
101
|
* @param {Object} shell any AppShell prop, spread last (`touch`, `pageWash`, `drawerOpenOn`, `railComponent`, …)
|
|
102
|
+
*
|
|
103
|
+
* THE DIALOGS ARE THE DS'S (plan-2026-10-23-studio-hub-review-2 § 0.1): the Hub mounts `ModalProvider`, so the file
|
|
104
|
+
* rail's Delete confirm, the Rename prompt and the Sign in prompt are the DS dialog, never the browser's. A consumer's
|
|
105
|
+
* own provider above it keeps working — `useModal` reads the nearest.
|
|
52
106
|
*/
|
|
53
107
|
const SETTINGS_ROW = (path) => [{ icon: 'nav-settings', path, label: 'Settings' }]
|
|
108
|
+
/* the foot's two sentinels (fxr's `#media` and `#sign-in`, made the Hub's) — a press opens, never routes */
|
|
109
|
+
const MEDIA_PATH = '#media'
|
|
110
|
+
const SIGN_IN_PATH = '#sign-in'
|
|
111
|
+
/* the drawer tier's Settings row — a sentinel too: it opens the drawer, it never routes */
|
|
112
|
+
const SETTINGS_DRAWER = '#settings'
|
|
113
|
+
|
|
114
|
+
const typing = (t) => t?.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t?.tagName)
|
|
115
|
+
const match = (label, q) => !q || String(label ?? '').toLowerCase().includes(q.toLowerCase())
|
|
116
|
+
|
|
117
|
+
/* THE TOGGLE'S PROPS ARE THE HUB'S — studio-hub's `fill="none" label={false} size="sm"`, nothing else */
|
|
118
|
+
const toggle = <ThemeToggle variant="button" fill="none" label={false} size="sm" tone="default" />
|
|
119
|
+
|
|
120
|
+
/* THE RAIL'S NAMED TABS — drawn here, from what the Hub already holds, so a consumer passes a word and no JSX */
|
|
121
|
+
const RAIL_TABS = {
|
|
122
|
+
shortcuts: {
|
|
123
|
+
label: 'Shortcuts',
|
|
124
|
+
draw: ({ shortcuts }) => <SettingsSections divided sections={shortcuts.map((s) => ({ label: s.section, rows: (s.items ?? []).map((k, i) => ({ id: k.id ?? `${i}:${k.label}`, label: k.label, value: k.combo ?? k.keys })) }))} />,
|
|
125
|
+
},
|
|
126
|
+
about: {
|
|
127
|
+
label: 'About',
|
|
128
|
+
draw: ({ app }) => (
|
|
129
|
+
<div className="flex flex-col gap-8">
|
|
130
|
+
{app.about && <LabeledControlSection label={app.name}><About about={app.about} /></LabeledControlSection>}
|
|
131
|
+
<SettingsColophon />
|
|
132
|
+
</div>
|
|
133
|
+
),
|
|
134
|
+
},
|
|
135
|
+
repo: {
|
|
136
|
+
label: 'Repo',
|
|
137
|
+
draw: ({ app }) => <LabeledControlSection label="Links"><SettingsLinks links={app.links ?? []} /></LabeledControlSection>,
|
|
138
|
+
},
|
|
139
|
+
}
|
|
140
|
+
/* the rail's rows: typed, text, or nothing — a `render` row is JSX and is dropped here with a warning */
|
|
141
|
+
const railSections = (sections = []) => sections.map((s) => ({
|
|
142
|
+
...s,
|
|
143
|
+
rows: (s.rows ?? []).filter((r) => { if (r.render && !r.type) { warnJsx('settings.sections[].render', 'Name the control: { type: "choice", options, value, onChange } or { type: "switch", on, onChange }.'); return false } return true }),
|
|
144
|
+
}))
|
|
145
|
+
const warnRailJsx = (key) => warnJsx(`settings.${key}`, 'The rail takes rows: sections, and tabs as { value, label, sections }.')
|
|
54
146
|
|
|
55
|
-
export default function AppHub({
|
|
147
|
+
export default function AppHub(props) {
|
|
148
|
+
return <ModalProvider><HubFrame {...props} /></ModalProvider>
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function HubFrame({
|
|
56
152
|
app = {},
|
|
57
153
|
items = [],
|
|
58
154
|
currentPath,
|
|
@@ -62,6 +158,8 @@ export default function AppHub({
|
|
|
62
158
|
walkthrough,
|
|
63
159
|
settings,
|
|
64
160
|
dev,
|
|
161
|
+
media,
|
|
162
|
+
signIn,
|
|
65
163
|
shortcuts = [],
|
|
66
164
|
themeToggle,
|
|
67
165
|
settingsPath = '/settings',
|
|
@@ -74,6 +172,66 @@ export default function AppHub({
|
|
|
74
172
|
}) {
|
|
75
173
|
const [sheet, setSheet] = useState(false)
|
|
76
174
|
const [rail, setRail] = useState(false)
|
|
175
|
+
const [search, setSearch] = useState(false)
|
|
176
|
+
const [query, setQuery] = useState('')
|
|
177
|
+
const [mediaOpen, setMediaOpen] = useState(false)
|
|
178
|
+
const [settingsOpen, setSettingsOpen] = useState(false)
|
|
179
|
+
/* the walkthrough's open state lives here so the phone bar's More sheet can open it too */
|
|
180
|
+
const [touring, setTouring] = useState(false)
|
|
181
|
+
/* the settings TIER: a page only when asked for, the drawer otherwise */
|
|
182
|
+
const { page: settingsPage = false, filters: settingsFilters = false, ...settingsProps } = settings ?? {}
|
|
183
|
+
const settingsDrawer = !!settings && !settingsPage
|
|
184
|
+
const [settingsTab, setSettingsTab] = useState('settings')
|
|
185
|
+
const modal = useModal()
|
|
186
|
+
const theme = useTheme()
|
|
187
|
+
if (themeToggle != null) warnJsx('themeToggle', 'The Hub draws the theme toggle itself; drop the prop.')
|
|
188
|
+
/* THE RAIL'S TABS, the same four on every hub: Settings · Shortcuts · About · Repo, the three from what the app already
|
|
189
|
+
* passes; an app's `tabs` are not drawn — its rows belong under Settings (dev warns) */
|
|
190
|
+
if (settingsDrawer && settings.tabs?.length) warnJsx('settings.tabs', 'The rail has no app tabs — put the rows under settings.sections.')
|
|
191
|
+
const railTabs = settingsDrawer ? [
|
|
192
|
+
...(shortcuts.length ? [{ value: 'shortcuts', label: RAIL_TABS.shortcuts.label, named: RAIL_TABS.shortcuts }] : []),
|
|
193
|
+
...(app.about ? [{ value: 'about', label: RAIL_TABS.about.label, named: RAIL_TABS.about }] : []),
|
|
194
|
+
...(app.links?.length ? [{ value: 'repo', label: RAIL_TABS.repo.label, named: RAIL_TABS.repo }] : []),
|
|
195
|
+
] : []
|
|
196
|
+
if (settingsDrawer && settings.content != null) warnRailJsx('content')
|
|
197
|
+
const railRows = settingsDrawer ? railSections(settings.sections) : []
|
|
198
|
+
/* reset, live everywhere: the theme back to the system, then the app's own */
|
|
199
|
+
const reset = () => { theme.clear(); settings.drawer?.onReset?.() }
|
|
200
|
+
/* SIGN IN ASKS IN THE DS DIALOG (review 2, § 5.2 — fxr's RailSignIn, verbatim copy): signed out, the password prompt —
|
|
201
|
+
* empty cancels — then `onPress(password)`; signed in, the sign-out confirm, then `onPress(null)` */
|
|
202
|
+
const askSignIn = async () => {
|
|
203
|
+
if (!signIn) return
|
|
204
|
+
if (signIn.signedIn) {
|
|
205
|
+
const ok = await modal.confirm('Sign out of the library sync? Saves stay on this device only.', { okLabel: 'Sign out' })
|
|
206
|
+
if (ok) signIn.onPress?.(null)
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
const pw = await modal.prompt('Password for the library sync:', '')
|
|
210
|
+
if (pw) signIn.onPress?.(pw)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* ⌘K / Ctrl+K — the search modal, from any Hub page; never while typing */
|
|
214
|
+
useEffect(() => {
|
|
215
|
+
const onKey = (e) => {
|
|
216
|
+
if (e.key.toLowerCase() !== 'k' || !(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey || e.repeat || typing(e.target)) return
|
|
217
|
+
e.preventDefault()
|
|
218
|
+
setSearch((v) => !v)
|
|
219
|
+
}
|
|
220
|
+
window.addEventListener('keydown', onKey)
|
|
221
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
222
|
+
}, [])
|
|
223
|
+
|
|
224
|
+
/* `,` — the drawer tier's key (the page tier's is AppShell's, which routes); never while typing */
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
if (!settingsDrawer) return undefined
|
|
227
|
+
const onKey = (e) => {
|
|
228
|
+
if (!(e.key === ',' || e.code === 'Comma') || e.metaKey || e.ctrlKey || e.altKey || e.repeat || typing(e.target)) return
|
|
229
|
+
e.preventDefault()
|
|
230
|
+
setSettingsOpen((v) => !v)
|
|
231
|
+
}
|
|
232
|
+
window.addEventListener('keydown', onKey)
|
|
233
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
234
|
+
}, [settingsDrawer])
|
|
77
235
|
|
|
78
236
|
/* ⇧S — the keymap in the rail. Its own listener: the `S` listener ignores Shift, so the two never both fire */
|
|
79
237
|
useEffect(() => {
|
|
@@ -106,38 +264,82 @@ export default function AppHub({
|
|
|
106
264
|
const devOn = !!dev && (dev.always || !!import.meta.env?.DEV)
|
|
107
265
|
const devPath = dev?.path ?? '/dev'
|
|
108
266
|
const { path: _dp, always: _da, ...devProps } = dev ?? {}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
267
|
+
/* HOME'S BUTTONS ON A PHONE (user 2026-10-23: *"put new and walkthrough in the more button … crowded under the files"*):
|
|
268
|
+
* with the bar, New and Walkthrough ride the top of its More sheet on Home and the page's foot row goes; with the drawer
|
|
269
|
+
* (no More), they stay on the page */
|
|
270
|
+
const barOn = ['bar', 'pill'].includes(shell?.touch ?? RAIL_PRESETS.app.phone)
|
|
271
|
+
const onHome = home && currentPath === homePath
|
|
272
|
+
const homeActions = onHome && barOn ? [
|
|
273
|
+
...(home.action ? [{ label: home.action.label, icon: 'plus', onPress: home.action.onClick }] : []),
|
|
274
|
+
...(walkthrough?.length ? [{ label: touring ? 'Close walkthrough' : 'Walkthrough', icon: 'book-open', onPress: () => setTouring((t) => !t) }] : []),
|
|
275
|
+
] : []
|
|
276
|
+
const page = onHome
|
|
277
|
+
? <HubHome app={app} iconComponent={iconComponent} walkthrough={walkthrough} {...home} touring={touring} onTouringChange={setTouring} actionsInBar={barOn} />
|
|
278
|
+
: settingsPage && currentPath === settingsPath
|
|
279
|
+
? <HubSettings app={app} shortcuts={shortcuts} themeToggle={toggle} filters={settingsFilters} {...settingsProps} drawer={settingsProps.drawer ?? true} />
|
|
113
280
|
: devOn && (currentPath === devPath || currentPath?.startsWith(`${devPath}/`))
|
|
114
281
|
? <HubDev storageKey={`kol-dev-tab:${app.name ?? 'app'}`} {...devProps} />
|
|
115
282
|
: children
|
|
116
283
|
/* the Dev row closes the app's own rows — under Stage in monitor (HubDevChrome, kol-monitor 2026-10-18 — user:
|
|
117
284
|
* *"why did the dev tab move? it was fine where it was. below stage"*); Settings keeps the bottom alone */
|
|
118
285
|
const rows = devOn ? [...items, { icon: 'code', path: devPath, label: 'Dev' }] : items
|
|
119
|
-
|
|
286
|
+
/* the pinned foot: Media, Sign in, Settings — each only when the app passes it */
|
|
287
|
+
const bottom = [
|
|
288
|
+
...(media ? [{ icon: 'image', path: MEDIA_PATH, label: 'Media' }] : []),
|
|
289
|
+
...(signIn ? [{ icon: signIn.signedIn ? 'cloud' : 'user', path: SIGN_IN_PATH, label: signIn.signedIn ? 'Signed in' : 'Sign in' }] : []),
|
|
290
|
+
...(settings ? SETTINGS_ROW(settingsDrawer ? SETTINGS_DRAWER : settingsPath) : []),
|
|
291
|
+
]
|
|
120
292
|
/* the phone bar lists Home as a tab — the rail draws it as the mark, the bar has no mark */
|
|
121
293
|
const barItems = [...(home ? [{ icon: 'home-01', path: homePath, label: 'Home' }] : []), ...rows, ...bottom]
|
|
294
|
+
/* the two sentinels open, everything else routes — the rail, the bar, ⌥-digits and ⌘K all come through here */
|
|
295
|
+
const go = (path, ...rest) => {
|
|
296
|
+
if (path === MEDIA_PATH) { setMediaOpen(true); return }
|
|
297
|
+
if (path === SIGN_IN_PATH) { askSignIn(); return }
|
|
298
|
+
if (path === SETTINGS_DRAWER) { setSettingsOpen((v) => !v); return }
|
|
299
|
+
return onNavigate?.(path, ...rest)
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* ⌘K's rows: Files, Pages, Shortcuts — the pages are the rail as drawn, mark first */
|
|
303
|
+
const pages = [...(home ? [{ icon: 'home-01', path: homePath, label: 'Home' }] : []), ...rows, ...bottom]
|
|
304
|
+
.map((r) => ({ id: `page:${r.path}`, label: r.label, group: 'Pages', icon: r.icon, path: r.path }))
|
|
305
|
+
const files = (home?.files ?? []).map((f) => ({ id: `file:${f.id}`, label: f.name, group: 'Files', icon: 'file', file: f }))
|
|
306
|
+
const keymap = shortcuts.filter((s) => shortcutInScope(s, currentPath))
|
|
307
|
+
const suggestions = [
|
|
308
|
+
...files, ...pages,
|
|
309
|
+
/* every Shortcuts fold starts OPEN, as the S sheet's do (review 2, § 6.1 — *"search still says expand all … should say
|
|
310
|
+
* collapse all and be already expanded"*): the footer reads Collapse all on open */
|
|
311
|
+
...keymap.map((s) => ({ id: `cat:${s.section}`, label: s.section, group: 'Shortcuts', open: true, items: (s.items ?? []).map((it, i) => ({ id: it.id ?? `${i}:${it.label}`, label: it.label, hint: it.combo ?? it.keys, keepOpen: true })) })),
|
|
312
|
+
]
|
|
313
|
+
const results = [
|
|
314
|
+
...files.filter((r) => match(r.label, query)),
|
|
315
|
+
...pages.filter((r) => match(r.label, query)),
|
|
316
|
+
...keymap.flatMap((s) => (s.items ?? []).filter((it) => match(it.label, query)).map((it, i) => ({ id: `key:${s.section}:${it.id ?? i}`, label: it.label, group: 'Shortcuts', hint: it.combo ?? it.keys, keepOpen: true }))),
|
|
317
|
+
]
|
|
318
|
+
const closeSearch = () => { setSearch(false); setQuery('') }
|
|
319
|
+
const pick = (item) => {
|
|
320
|
+
if (item.file) { home?.onOpen?.(item.file); return }
|
|
321
|
+
if (item.path) go(item.path)
|
|
322
|
+
}
|
|
122
323
|
|
|
123
324
|
return (
|
|
124
325
|
<AppShell
|
|
125
326
|
items={rows}
|
|
126
327
|
bottomItems={bottom}
|
|
127
328
|
barItems={barItems}
|
|
329
|
+
barActions={homeActions}
|
|
128
330
|
logomark={app.logomark ? { svgUrl: app.logomark, title: app.name } : undefined}
|
|
129
331
|
currentPath={currentPath}
|
|
130
|
-
onNavigate={
|
|
332
|
+
onNavigate={go}
|
|
131
333
|
iconComponent={iconComponent}
|
|
132
334
|
appName={app.name}
|
|
133
335
|
railToggleKey={'\\'}
|
|
134
|
-
settingsPath={
|
|
135
|
-
settingsKey={
|
|
336
|
+
settingsPath={settingsPage ? settingsPath : undefined}
|
|
337
|
+
settingsKey={settingsPage ? ',' : undefined}
|
|
136
338
|
navKeys
|
|
137
|
-
/* THE
|
|
138
|
-
*
|
|
139
|
-
|
|
140
|
-
touch=
|
|
339
|
+
/* THE RAIL IS THE `app` PRESET (2026-10-24) and the phone nav is its shape — the pill; `shell={{ touch: 'drawer' }}`
|
|
340
|
+
* still gets the drawer, `shell={{ rail }}` another rail */
|
|
341
|
+
rail="app"
|
|
342
|
+
touch={RAIL_PRESETS.app.phone}
|
|
141
343
|
masthead={masthead}
|
|
142
344
|
pageWash="var(--kol-fg-02)"
|
|
143
345
|
{...shell}
|
|
@@ -147,7 +349,37 @@ export default function AppHub({
|
|
|
147
349
|
* no search, I didnt say DONT USE THE FUCKIN MODAL OVERLAY"*): this page's sections as categories under
|
|
148
350
|
* "Shortcuts", each drilling in to its keys; `S` toggles, Esc closes; ⇧S is the rail's. Reverses 0.68.0's swap. */}
|
|
149
351
|
<CommandOverlay open={sheet} mode="shortcuts" shortcuts={shortcuts} currentPath={currentPath} onClose={() => setSheet(false)} />
|
|
352
|
+
{/* ⌘K — the same overlay in search mode over Files, Pages and Shortcuts */}
|
|
353
|
+
<CommandOverlay open={search} suggestions={suggestions} results={results} query={query} onQueryChange={setQuery} onSelect={pick} onClose={closeSearch} placeholder="Search files, pages and shortcuts" selectLabel="Open" />
|
|
150
354
|
{rail && <ShortcutsOverlay variant="rail" shortcuts={shortcuts} currentPath={currentPath} onClose={() => setRail(false)} />}
|
|
355
|
+
{/* the Media row's door — the picker mirror opens (kol-mirror App.jsx:280; review 2, § 5.1: *"incorrect media, did
|
|
356
|
+
* you not look at mirror"*): the column browser with the preview pane, Cancel and Use, over the consumer's client */}
|
|
357
|
+
{media && (
|
|
358
|
+
<MediaLibrary variant="picker" open={mediaOpen} client={media.client} accept={media.accept} onClose={() => setMediaOpen(false)} onSelect={(url, meta) => { setMediaOpen(false); media.onSelect?.(url, meta) }} />
|
|
359
|
+
)}
|
|
360
|
+
{/* THE RAIL tier — studio-hub's, the template (user 2026-10-24: *"In studio what kind of settings tier is there? ITS A
|
|
361
|
+
* RAIL"*): `sections` in the rail, the theme toggle (the Hub's props) and reset in its footer; with `tabs`, a text
|
|
362
|
+
* TabsRow under the header — Settings first, then the app's (Monitor: Shortcuts, About, Repo; Mirror: Performance)
|
|
363
|
+
* — like the labs rail's levels, never a page. Rows only: the Hub draws every string, so no rail can wear a class
|
|
364
|
+
* the template does not */}
|
|
365
|
+
{settingsDrawer && (
|
|
366
|
+
<SettingsPanel
|
|
367
|
+
open={settingsOpen}
|
|
368
|
+
variant="rail"
|
|
369
|
+
title={settings.drawer?.title ?? 'Settings'}
|
|
370
|
+
onClose={() => setSettingsOpen(false)}
|
|
371
|
+
/* the footer on every rail: the toggle, and a live reset */
|
|
372
|
+
footer={<SettingsFooter onReset={reset}>{toggle}</SettingsFooter>}
|
|
373
|
+
>
|
|
374
|
+
{/* the tab row wraps in the 380 rail — five tabs (Mirror's Performance beside the Hub's three) overran it */}
|
|
375
|
+
{railTabs.length > 0 && (
|
|
376
|
+
<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" />
|
|
377
|
+
)}
|
|
378
|
+
{settingsTab === 'settings'
|
|
379
|
+
? (railRows.length > 0 && <SettingsSections sections={railRows} divided />)
|
|
380
|
+
: railTabs.find((x) => x.value === settingsTab)?.named?.draw({ app, shortcuts })}
|
|
381
|
+
</SettingsPanel>
|
|
382
|
+
)}
|
|
151
383
|
</AppShell>
|
|
152
384
|
)
|
|
153
385
|
}
|
package/src/AppShell.jsx
CHANGED
|
@@ -5,7 +5,7 @@ import { NavHiddenContext } from './navHidden.js'
|
|
|
5
5
|
import { SettingsToggleContext } from './settingsToggle.js'
|
|
6
6
|
import TouchDeviceOverlay, { useTouchPrimary } from './TouchDeviceOverlay.jsx'
|
|
7
7
|
import PhoneNav from './PhoneNav.jsx'
|
|
8
|
-
import { TABBAR_H, MastheadContext } from '@kolkrabbi/kol-component'
|
|
8
|
+
import { TABBAR_H, TABBAR_PILL_INSET, MastheadContext, RAIL_PRESETS } from '@kolkrabbi/kol-component'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* AppShell — layout root: the rail + the content column. No header, no
|
|
@@ -43,12 +43,15 @@ import { TABBAR_H, MastheadContext } from '@kolkrabbi/kol-component'
|
|
|
43
43
|
* `/settings` while already there returns to the last page), and the theme
|
|
44
44
|
* toggle lives on the settings page, not in the rail (user, 2026-08-28).
|
|
45
45
|
* @param {boolean} [props.railFade=true] the rail's list fades out at its foot (`NavRail fade`); `false` opts out
|
|
46
|
-
* @param {'
|
|
46
|
+
* @param {'app'|'site'|'workshop'} [props.rail='app'] WHICH RAIL (NavRail's preset, 2026-10-24): `app` the studio rail,
|
|
47
|
+
* `site` the brand rail, `workshop` the workshop rail. The preset decides the phone
|
|
48
|
+
* nav's shape too (`RAIL_PRESETS[rail].phone`) unless `touch` is passed
|
|
49
|
+
* @param {'expand'|'enter'} [props.railSections] how a section row opens — the preset's unless passed: `expand` opens it in place (the
|
|
47
50
|
* accordion), `enter` replaces the list with its rows under a Back row
|
|
48
51
|
* (`NavRail sections`, 2026-10-06 — labs' catalog)
|
|
49
52
|
* @param {string} props.railToggleKey a key that toggles the rail (e.g. '\\') — ignored while typing in a field;
|
|
50
53
|
* the rail comes back on every `currentPath` change (ShellHomeSystem, 2026-08-27)
|
|
51
|
-
* @param {'shell'|'bare'|'overlay'|'drawer'|'bar'} props.touch the touch-primary policy (default 'shell' = the rail regardless):
|
|
54
|
+
* @param {'shell'|'bare'|'overlay'|'drawer'|'bar'|'pill'} props.touch the touch-primary policy (default 'shell' = the rail regardless):
|
|
52
55
|
* 'drawer' takes the rail OFF-CANVAS below `drawerBelow`, hands its width
|
|
53
56
|
* back to the content, and renders a trigger that brings it in over a scrim.
|
|
54
57
|
* Tapping a destination closes it. (ShellRailNoDrawerOnMobile, kol-chess
|
|
@@ -68,9 +71,14 @@ import { TABBAR_H, MastheadContext } from '@kolkrabbi/kol-component'
|
|
|
68
71
|
* description. One app, one header — media-hub wore both. NO DEFAULT (user, 2026-09-29): unset,
|
|
69
72
|
* every page renders as its own props say, so a consumer's bump moves nothing
|
|
70
73
|
* (fxr · mirror · monitor are mono by ruling).
|
|
74
|
+
* @param {Array} [props.barActions] `[{ label, icon?, onPress }]` — buttons at the top of the bar's More sheet (PhoneNav `actions`)
|
|
71
75
|
* @param {Array} [props.barItems] the bar's destinations under `touch="bar"` (default items + bottomItems) —
|
|
72
76
|
* a Hub passes Home first, which the rail draws as the mark instead
|
|
73
|
-
* @param {
|
|
77
|
+
* @param {string[]} [props.barHiddenOn=[]] paths (matched like the rail's active row) where the phone bar STEPS ASIDE
|
|
78
|
+
* for a tool (studio-hub review 2, § 7.1 — *"or we have to hide show the bottom
|
|
79
|
+
* when you're in labs or randomiser or morph?"*): on one, the bar unmounts and
|
|
80
|
+
* `--kol-shell-bar-h` is 0, so the tool takes the full height
|
|
81
|
+
* @param {number} [props.drawerBelow=768] viewport width under which `touch="drawer"` takes the rail off-canvas. A width, not a
|
|
74
82
|
* pointer test: an iPad is coarse and has room, a narrow desktop window is
|
|
75
83
|
* fine-pointered and does not.
|
|
76
84
|
* `bare` renders the children with NO shell on a coarse-pointer device unless
|
|
@@ -79,7 +87,7 @@ import { TABBAR_H, MastheadContext } from '@kolkrabbi/kol-component'
|
|
|
79
87
|
* @param {string[]} [props.drawerOpenOn=[]] paths whose ENTRY opens the drawer (ShellDrawerOpenOnRoute,
|
|
80
88
|
* kol-mirror 2026-09-01 — user: "the rail should load open on home, not
|
|
81
89
|
* everywhere"): a home that is a catalog IS navigation, and arriving there
|
|
82
|
-
* with the nav
|
|
90
|
+
* with the nav collapsed hides the one thing the page is for. Matched like the
|
|
83
91
|
* rail's active row — `'/'` exact, anything else by prefix. Every other path
|
|
84
92
|
* keeps the close-on-navigate rule; above `drawerBelow` there is no drawer
|
|
85
93
|
* and the list is inert. A list, not a boolean: the policy is per-route and
|
|
@@ -135,9 +143,10 @@ export default function AppShell({
|
|
|
135
143
|
iconComponent,
|
|
136
144
|
railComponent: Rail = NavRail,
|
|
137
145
|
railFade = true,
|
|
138
|
-
|
|
146
|
+
rail = 'app',
|
|
147
|
+
railSections,
|
|
139
148
|
railToggleKey,
|
|
140
|
-
touch
|
|
149
|
+
touch: touchProp,
|
|
141
150
|
appName,
|
|
142
151
|
pageWash,
|
|
143
152
|
navKeys = false,
|
|
@@ -146,6 +155,8 @@ export default function AppShell({
|
|
|
146
155
|
drawerBelow = 768,
|
|
147
156
|
drawerOpenOn = NO_PATHS,
|
|
148
157
|
barItems,
|
|
158
|
+
barActions,
|
|
159
|
+
barHiddenOn = NO_PATHS,
|
|
149
160
|
masthead,
|
|
150
161
|
children,
|
|
151
162
|
}) {
|
|
@@ -164,8 +175,15 @@ export default function AppShell({
|
|
|
164
175
|
mq.addEventListener('change', on)
|
|
165
176
|
return () => mq.removeEventListener('change', on)
|
|
166
177
|
}, [drawerBelow])
|
|
178
|
+
/* `shell` is AppShell's own default (the rail regardless); a Hub passes the preset's phone shape */
|
|
179
|
+
const touch = touchProp ?? 'shell'
|
|
167
180
|
const drawer = touch === 'drawer' && narrow
|
|
168
|
-
|
|
181
|
+
/* the bar steps aside on a tool's paths — no bar, no bar height; the rail stays off too (a phone has no rail) */
|
|
182
|
+
/* `pill` is the bar in TabsRow's pill shape (user 2026-10-23) — the same rows, the same More, floated off the edge */
|
|
183
|
+
const barLike = touch === 'bar' || touch === 'pill'
|
|
184
|
+
/* the preset's phone shape when the app did not say (AppHub passes it through) */
|
|
185
|
+
const barAside = barLike && narrow && barHiddenOn.some((x) => (x === '/' ? currentPath === '/' : currentPath === x || currentPath?.startsWith(`${x}/`)))
|
|
186
|
+
const bar = barLike && narrow && !barAside
|
|
169
187
|
const [drawerOpen, setDrawerOpen] = useState(false)
|
|
170
188
|
useEffect(() => { if (!drawer) setDrawerOpen(false) }, [drawer])
|
|
171
189
|
useEffect(() => {
|
|
@@ -245,7 +263,7 @@ export default function AppShell({
|
|
|
245
263
|
* child effects run before parent effects, so a consumer hiding the rail on a
|
|
246
264
|
* path change was overwritten in the same commit. */
|
|
247
265
|
/* …unless the destination is one where nav IS the page (`drawerOpenOn`):
|
|
248
|
-
* there the entry OPENS it. Runs on mount, on the
|
|
266
|
+
* there the entry OPENS it. Runs on mount, on the collapse and on navigation
|
|
249
267
|
* alike — `drawer` is a dep — so a phone arriving on home gets the rail. */
|
|
250
268
|
/* Keyed on the BOOLEAN, not the array: a consumer's inline `['/']` is a new
|
|
251
269
|
* identity every render too (the showcase set passes one), and the effect
|
|
@@ -337,7 +355,7 @@ export default function AppShell({
|
|
|
337
355
|
* margin for `navHidden` closes it here — the rail then takes its own
|
|
338
356
|
* `--kol-shell-drawer-width` rather than this token. */
|
|
339
357
|
data-rail-drawer={drawer ? (drawerOpen ? 'open' : 'closed') : undefined}
|
|
340
|
-
style={navHidden || drawer || bar ? { '--kol-shell-rail-width': '0px' } : undefined}
|
|
358
|
+
style={navHidden || drawer || bar || barAside ? { '--kol-shell-rail-width': '0px' } : undefined}
|
|
341
359
|
>
|
|
342
360
|
{touch === 'overlay' && <TouchDeviceOverlay appName={appName} />}
|
|
343
361
|
{/* THE TRIGGER SHIPS HERE, not in every consumer's page header — the rail
|
|
@@ -365,8 +383,8 @@ export default function AppShell({
|
|
|
365
383
|
onClick={() => setDrawerOpen(false)}
|
|
366
384
|
/>
|
|
367
385
|
)}
|
|
368
|
-
{bar && <PhoneNav items={barItems ?? [...(items ?? []), ...(bottomItems ?? [])]} currentPath={currentPath} onNavigate={navigate} />}
|
|
369
|
-
{!navHidden && !bar && (
|
|
386
|
+
{bar && <PhoneNav items={barItems ?? [...(items ?? []), ...(bottomItems ?? [])]} actions={barActions} shape={touch === 'pill' ? 'pill' : 'bar'} currentPath={currentPath} onNavigate={navigate} />}
|
|
387
|
+
{!navHidden && !bar && !barAside && (
|
|
370
388
|
<Rail
|
|
371
389
|
items={items}
|
|
372
390
|
bottomItems={bottomItems}
|
|
@@ -377,6 +395,7 @@ export default function AppShell({
|
|
|
377
395
|
iconComponent={iconComponent}
|
|
378
396
|
drawer={drawer}
|
|
379
397
|
fade={railFade}
|
|
398
|
+
preset={rail}
|
|
380
399
|
sections={railSections}
|
|
381
400
|
/>
|
|
382
401
|
)}
|
|
@@ -384,7 +403,10 @@ export default function AppShell({
|
|
|
384
403
|
* page paints its wash over it (ShellPageWash). */}
|
|
385
404
|
{/* the margin IS the rail's live width, so the content is pushed
|
|
386
405
|
* through the drag and the snap (RailFlatGrabOpen) */}
|
|
387
|
-
<div className="bg-surface-primary min-w-0" style={{ marginLeft: `var(--kol-shell-rail-width)`, '--kol-shell-page-wash': pageWash,
|
|
406
|
+
<div className="bg-surface-primary min-w-0" style={{ marginLeft: `var(--kol-shell-rail-width)`, '--kol-shell-page-wash': pageWash, /* `bar` pads the page by its height; `pill` FLOATS OVER the page (user 2026-10-23: *"why doesn't it overlay the bottom"*) —
|
|
407
|
+
* no pad, the page runs under it, and `--kol-shell-bar-clear` is what a scroll region's last row and a fixed foot clear */
|
|
408
|
+
...(bar && touch !== 'pill' && { '--kol-shell-bar-h': `calc(${TABBAR_H}px + env(safe-area-inset-bottom, 0px))`, paddingBottom: 'var(--kol-shell-bar-h)' }),
|
|
409
|
+
...(bar && touch === 'pill' && { '--kol-shell-bar-h': '0px', '--kol-shell-bar-clear': `calc(${TABBAR_H + TABBAR_PILL_INSET}px + env(safe-area-inset-bottom, 0px))` }), ...(barAside && { '--kol-shell-bar-h': '0px' }) }}>
|
|
388
410
|
{children}
|
|
389
411
|
</div>
|
|
390
412
|
</div>
|