@kolkrabbi/kol-shell 0.75.0 → 0.78.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.
@@ -0,0 +1,279 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react'
2
+ import { ActionButton, ContentCard, ContentFilters, ContentRow, Divider, PageHeader, SECTION_TEXT_LEVELS, CanvasStudio, IconFrame, useMediaQuery } from '@kolkrabbi/kol-component'
3
+ import { Icon } from '@kolkrabbi/kol-icons'
4
+ import PageShell from './PageShell.jsx'
5
+ import CatalogGrid from './CatalogGrid.jsx'
6
+ import { warnJsx } from './warnJsx.js'
7
+
8
+ /* taxonomy-ok: organism — nests PageShell / CatalogGrid (relative) + kol-component's ContentFilters, ContentCard, ContentRow, CanvasStudio, PageHeader */
9
+
10
+ /**
11
+ * StudioCreate — A catalog of parts beside a case. monitor's `CreatePage` made once
12
+ * (plan-2026-10-23 § 3.4 — user: *"the create tab, which is a combination of catalog and studio, where monitor has rack
13
+ * modules and mirror has mixer modules … reference monitor rather than mixer"*). The page is read off
14
+ * `kol-monitor/src/pages/CreatePage.jsx`, structure for structure: a page that is FIXED on the case view and SCROLLS on
15
+ * the parts view; the dot grid over the whole page, under the chrome; an editable masthead (the case's name and
16
+ * description — the pencil in the filter row opens them); `ContentFilters` with the view strip CASE ⇄ PARTS, the parts
17
+ * view a catalog of the parts (the consumer's groups, LIST and GRID), the case view the consumer's case on
18
+ * `CanvasStudio`; a bottom bar with the zoom readout and the consumer's case actions. What a part is, what a row is,
19
+ * and what Insert does are the consumer's — monitor's rows and HP, mirror's channel strips.
20
+ *
21
+ * @param {Object} header `{ title, subtitle, onTitleChange?, onSubtitleChange? }` — the masthead; with the
22
+ * handlers the pencil makes both editable (the consumer persists them), without them it
23
+ * is a plain masthead
24
+ * @param {Array} parts the items of the parts catalog (ContentFilters filters and searches them; `name` /
25
+ * `title` are what the search reads)
26
+ * @param {Array} partGroups ContentFilters' `[{ label, key, values, exclusive? }]` for the parts
27
+ * @param {Function} toCard `(part, { layout }) => card props` — spread onto a `catalog` card (grid) or row (list)
28
+ * on `CatalogGrid`, the Catalog's own grid; pass `zoom: false` to match a Library;
29
+ * `onClick` is the consumer's (monitor opens the part's page)
30
+ * @param {Function} onPlace `(part) => void` — the Insert action (`ActionButton` in the card's and the row's
31
+ * `actions` slot, the plate) on every part; a drag is the consumer's
32
+ * (`onPartPointerDown`), as monitor's is
33
+ * @param {Function} onPartPointerDown `(part, event) => void` — the seam for a consumer's own drag from the pool
34
+ * @param {Object} labels `{ case: 'CASE', parts: 'PARTS', partsTitle: 'All Parts', caseTitle: 'Case' }` — the strip
35
+ * and the catalog titles (monitor: CASE, MODULES, All Modules)
36
+ * @param {number} caseCount what the case holds, for the count beside the title (monitor: the placed modules)
37
+ * @param {ReactNode} caseControls the consumer's controls ABOVE the case (monitor: the Add row and Set HP dialogs, each
38
+ * shown by one of its `caseActions`)
39
+ * @param {ReactNode} caseActions the consumer's buttons in the bottom bar's right (monitor: rows, HP, case preview)
40
+ * @param {{label: string, onClick: Function}} caseLink the link beside the zoom readout, drawn here (monitor: "Open in
41
+ * Rack"); a node is still drawn, with a dev warning (2026-10-24)
42
+ * @param {boolean} showCase draw the case (default true; monitor's case-preview toggle)
43
+ * @param {Object} view · onViewChange · defaultView the canvas view, the consumer's to persist (CanvasStudio's)
44
+ * @param {'case'|'parts'} defaultPage which view opens (default `case`)
45
+ * @param {'case'|'parts'} page · {Function} onPageChange the view, controlled — a consumer's Insert shows the case
46
+ * (monitor's rule), a slot on the case opens the parts (mirror's)
47
+ * @param {Function} canvas `({ gridRef, view, onViewChange }) => node` — a consumer that already HAS a viewport on
48
+ * `CanvasStudio` (monitor's `RackViewport`, with its snap keys and workbench) renders it
49
+ * here instead of `children`; it takes the page's gridRef and view so the whole-page grid
50
+ * and the zoom readout still follow it
51
+ * @param {ReactNode} children the case itself, drawn on this page's own `CanvasStudio` when no `canvas` is given
52
+ * @param {string} className · style on the page
53
+ */
54
+ export default function StudioCreate({
55
+ header = {},
56
+ parts = [],
57
+ partGroups = [],
58
+ toCard,
59
+ onPlace,
60
+ onPartPointerDown,
61
+ labels = {},
62
+ caseCount = 0,
63
+ caseControls,
64
+ caseActions,
65
+ caseLink,
66
+ showCase = true,
67
+ view,
68
+ onViewChange,
69
+ defaultView,
70
+ defaultPage = 'case',
71
+ page: pageProp,
72
+ onPageChange,
73
+ canvas,
74
+ children,
75
+ className = '',
76
+ style,
77
+ }) {
78
+ const L = { case: 'CASE', parts: 'PARTS', partsTitle: 'All Parts', caseTitle: 'Case', ...labels }
79
+ const [ownPage, setOwnPage] = useState(defaultPage)
80
+ const page = pageProp ?? ownPage
81
+ const setPage = (p) => { setOwnPage(p); onPageChange?.(p) }
82
+ const [editing, setEditing] = useState(false)
83
+ const titleRef = useRef(null)
84
+ const gridRef = useRef(null)
85
+ const editable = !!(header.onTitleChange || header.onSubtitleChange)
86
+
87
+ /* the canvas view: the consumer's when passed, else this page's — the zoom readout reads and writes it either way */
88
+ const [ownView, setOwnView] = useState(defaultView ?? { zoom: 1, x: 0, y: 0 })
89
+ const v = view ?? ownView
90
+ const setV = useCallback((next) => {
91
+ const resolved = typeof next === 'function' ? next(view ?? ownView) : next
92
+ if (!view) setOwnView(resolved)
93
+ onViewChange?.(resolved)
94
+ }, [view, ownView, onViewChange])
95
+ const applyZoom = (fn) => setV((cur) => ({ ...cur, zoom: Math.min(2, Math.max(0.1, fn(cur.zoom))) }))
96
+ const [zoomInput, setZoomInput] = useState('100')
97
+ const zoomEditing = useRef(false)
98
+ useEffect(() => { if (!zoomEditing.current) setZoomInput(String(Math.round(v.zoom * 100))) }, [v.zoom])
99
+
100
+ /* the exclusive groups, by key; the flag stays here */
101
+ const exclusive = partGroups.filter((g) => g.exclusive).map((g) => g.key)
102
+ const groups = partGroups.map(({ exclusive: _x, ...g }) => g)
103
+
104
+ /* THE PAGE MASTHEAD, EDITABLE (review 2, § 7.3 — *"create page both desktop and mobile is using a different header than all
105
+ * other pages?"*): both fields wear `SECTION_TEXT_LEVELS.app`'s own classes — the title's and the lede's — with no
106
+ * height or line-height of their own, inside `PageHeader level="app"`, so an uneditable Create and Library's masthead
107
+ * are the same header; editing shows only the caret and the underline */
108
+ const titleCls = SECTION_TEXT_LEVELS.app.title
109
+ const ledeCls = SECTION_TEXT_LEVELS.app.lede
110
+ const field = (value, onChange, cls) => (
111
+ <input
112
+ ref={cls === titleCls ? titleRef : undefined}
113
+ type="text"
114
+ value={value ?? ''}
115
+ onChange={(e) => onChange?.(e.target.value)}
116
+ onBlur={() => setEditing(false)}
117
+ onKeyDown={(e) => { if (e.key === 'Enter') setEditing(false) }}
118
+ readOnly={!editing}
119
+ className={`block p-0 bg-transparent text-inherit outline-none border-none ${cls}`}
120
+ /* `1lh` — the class's own line-height: an input otherwise sizes to the font's metrics (69 for the 60 title) */
121
+ style={{ width: `${String(value ?? '').length + 1}ch`, height: '1lh', cursor: editing ? 'text' : 'default', boxShadow: editing ? 'inset 0 -1px 0 var(--kol-fg-12)' : 'none', caretColor: editing ? 'auto' : 'transparent', pointerEvents: editing ? 'auto' : 'none' }}
122
+ />
123
+ )
124
+
125
+ /* INSERT is its own control, never the card's click (monitor, user 2026-09-02): the card opens the part's page. It is
126
+ * the card's and the row's `actions` slot — the plate, where an app card carries its cog and trash (review 2, § 3.1:
127
+ * *"someone attached an insert to the end of a random card"*) */
128
+ const insert = (part) => onPlace ? (
129
+ <ActionButton chrome="inline" size="sm" icon="plus" label="Insert" onAction={(e) => { e?.stopPropagation(); onPlace(part) }} />
130
+ ) : undefined
131
+ const [cols, setCols] = useState(null)
132
+ /* a phone gets the rows alone, no LIST GRID line — CatalogPage's `phoneLayout` rule, the same rung (768) */
133
+ const phoneRows = useMediaQuery('(max-width: 767px)')
134
+
135
+ return (
136
+ /* Create sits on the app tier's fg-02 wash and holds still on both views: the case is a fixed canvas, the parts scroll in their own region */
137
+ <PageShell mode="fixed" className={className} style={{ '--kol-shell-page-wash': 'var(--kol-fg-02)', '--kol-catalog-n': cols ?? undefined, position: 'relative', isolation: 'isolate', ...style }}>
138
+ {/* the dot grid on the WHOLE page — over the wash, under the chrome, the padding ignored; CanvasStudio drives it
139
+ * through gridRef so it rides the zoom and the pan (monitor, user 2026-08-27) */}
140
+ {page === 'case' && showCase && <div ref={gridRef} aria-hidden style={{ position: 'absolute', inset: 0, zIndex: -1, pointerEvents: 'none' }} />}
141
+ {/* the chrome floats ABOVE the canvas: the case runs under the masthead and the filter row (monitor, 2026-09-02) */}
142
+ <div style={{ position: 'relative', zIndex: 'var(--kol-z-sticky)' }}>
143
+ <PageHeader
144
+ level="app"
145
+ title={editable ? field(header.title, header.onTitleChange, titleCls) : header.title}
146
+ subtitle={editable ? field(header.subtitle, header.onSubtitleChange, ledeCls) : header.subtitle}
147
+ />
148
+ </div>
149
+
150
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0, position: 'relative', zIndex: 'var(--kol-z-sticky)' }}>
151
+ <ContentFilters
152
+ tone="sunken"
153
+ items={page === 'case' ? [] : parts}
154
+ title={page === 'case' ? L.caseTitle : L.partsTitle}
155
+ totalCount={page === 'case' ? caseCount : parts.length}
156
+ filterGroups={page === 'case' ? [] : groups}
157
+ mutuallyExclusiveFilters={exclusive}
158
+ showCountOnlyWhenFiltering
159
+ headerActions={editable ? (
160
+ /* BARE, as the filter and the search beside it (user 2026-10-23: *"icon frame with background color? breaks
161
+ * consistency"*) — IconFrame nav, 16 in the 32 box; the press keeps the title's focus, the click toggles */
162
+ <IconFrame
163
+ name="edit"
164
+ variant="nav"
165
+ size="md"
166
+ iconSize={16}
167
+ aria-label="Rename"
168
+ onPointerDown={(e) => e.preventDefault()}
169
+ onClick={() => {
170
+ setEditing((prev) => {
171
+ if (prev) { titleRef.current?.blur(); window.getSelection()?.removeAllRanges(); return false }
172
+ requestAnimationFrame(() => { titleRef.current?.focus(); titleRef.current?.select() })
173
+ return true
174
+ })
175
+ }}
176
+ />
177
+ ) : undefined}
178
+ viewModeOptions={[{ value: 'case', label: L.case }, { value: 'parts', label: L.parts }]}
179
+ viewMode={page}
180
+ onViewModeChange={setPage}
181
+ layoutOptions={page === 'parts' && !phoneRows ? [{ value: 'list', label: 'LIST' }, { value: 'grid', label: 'GRID' }] : undefined}
182
+ defaultLayout="list"
183
+ layout={phoneRows ? 'list' : undefined}
184
+ renderItem={(items, _mode, layout) => {
185
+ if (page === 'case') {
186
+ return (
187
+ <div style={{ display: 'flex', flexDirection: 'column', flex: 1, minHeight: 0 }}>
188
+ {caseControls}
189
+ {caseControls && <Divider className="mb-4" />}
190
+ {showCase && (canvas ? canvas({ gridRef, view: v, onViewChange: setV }) : (
191
+ /* the canvas is the whole page: the case is never cut by the viewport's box (monitor, 2026-09-02) */
192
+ <CanvasStudio gridRef={gridRef} view={v} onViewChange={setV} style={{ flex: 1, margin: '0 calc(var(--kol-shell-page-pad) * -1)', overflow: 'visible' }}>
193
+ {children}
194
+ </CanvasStudio>
195
+ ))}
196
+ </div>
197
+ )
198
+ }
199
+ /* ONE CARD FOR THE SET (user 2026-10-23: *"why are we using a different card for PARTS? when file has so many
200
+ * props"*): a part is the `app` card and row, the files' own — no verbs, so no cog or trash; INSERT is the
201
+ * plate's action. On `CatalogGrid`, the Catalog's own grid, six at most, the list three across */
202
+ return (
203
+ /* the parts scroll in their own region — the page holds still on both views (user 2026-10-23) */
204
+ <div style={{ flex: 1, minHeight: 0, overflowY: 'auto', paddingBottom: 'calc(var(--kol-spacing-6) + var(--kol-shell-bar-clear, 0px))' }}>
205
+ <CatalogGrid layout={layout} onColumns={setCols} listColumns={3}>
206
+ {items.map((part) => {
207
+ const { key, ...props } = toCard ? toCard(part, { layout }) : { title: part.title ?? part.name }
208
+ const k = key ?? part.id ?? part.name
209
+ /* INSERT rides the one card (2026-10-24): the cover's other corner on a card, before the plate on a row —
210
+ * the part keeps every field and icon the Library's card has; `insert` (the plate action) is the shape a
211
+ * card without a plate still takes */
212
+ const place = onPlace ? { onInsert: () => onPlace(part) } : {}
213
+ const item = layout === 'grid'
214
+ ? <ContentCard key={onPartPointerDown ? undefined : k} variant="app" {...props} {...place} actions={props.verbs || props.onTags ? undefined : insert(part)} />
215
+ : <ContentRow key={onPartPointerDown ? undefined : k} variant="app" {...props} {...place} actions={props.verbs || props.onTags ? undefined : insert(part)} />
216
+ return onPartPointerDown ? <div key={k} onPointerDown={(e) => onPartPointerDown(part, e)}>{item}</div> : item
217
+ })}
218
+ </CatalogGrid>
219
+ </div>
220
+ )
221
+ }}
222
+ />
223
+
224
+ {/* the bottom bar — the zoom readout is the canvas's; the right side is the consumer's (monitor: rows, HP, the case preview) */}
225
+ {page === 'case' && (
226
+ /* above the phone bar or pill when the shell draws one (`--kol-shell-bar-h`, 2026-10-23: it sat under the bar) */
227
+ <div className="fixed flex items-center justify-between" style={{ bottom: 'calc(var(--kol-shell-bar-h, 0px) + var(--kol-shell-bar-clear, 0px) + 24px)', left: 'calc(var(--kol-shell-rail-width, 0px) + 24px)', right: 24, zIndex: 'var(--kol-z-sticky)' }}>
228
+ <div className="flex items-center gap-2">
229
+ <span onClick={() => applyZoom((z) => z - 0.1)} className="kol-helper-12 text-fg-48 hover:text-fg-96 cursor-pointer select-none">−</span>
230
+ <input
231
+ type="text"
232
+ inputMode="numeric"
233
+ value={zoomInput}
234
+ onFocus={(e) => { zoomEditing.current = true; e.target.select() }}
235
+ onChange={(e) => setZoomInput(e.target.value)}
236
+ onBlur={() => {
237
+ zoomEditing.current = false
238
+ const n = parseInt(zoomInput, 10)
239
+ if (!isNaN(n)) applyZoom(() => n / 100)
240
+ else setZoomInput(String(Math.round(v.zoom * 100)))
241
+ }}
242
+ onKeyDown={(e) => { if (e.key === 'Enter') e.target.blur() }}
243
+ className="kol-helper-12 text-fg-64 bg-transparent text-right border-none outline-none"
244
+ style={{ width: 32 }}
245
+ aria-label="Zoom"
246
+ />
247
+ <span className="kol-helper-12 text-fg-32">%</span>
248
+ <span onClick={() => applyZoom((z) => z + 0.1)} className="kol-helper-12 text-fg-48 hover:text-fg-96 cursor-pointer select-none">+</span>
249
+ {caseLink && (
250
+ <span style={{ marginLeft: 16 }}>
251
+ {caseLink.label != null
252
+ ? <span onClick={caseLink.onClick} className="kol-helper-12 text-fg-48 hover:text-fg-96 cursor-pointer select-none">{caseLink.label}</span>
253
+ : (warnJsx('StudioCreate caseLink', 'Pass { label, onClick }.'), caseLink)}
254
+ </span>
255
+ )}
256
+ </div>
257
+ <div className="flex items-center gap-1">{caseActions}</div>
258
+ </div>
259
+ )}
260
+ </div>
261
+ </PageShell>
262
+ )
263
+ }
264
+
265
+ /* a bar button for `caseActions` — monitor's rows / HP / case-preview toggles wear this; exported so a consumer
266
+ * writes the three in one line each */
267
+ export function StudioCreateAction({ icon, label, onClick, pressed }) {
268
+ return (
269
+ <button
270
+ type="button"
271
+ onClick={onClick}
272
+ aria-label={label}
273
+ aria-pressed={pressed}
274
+ className={`${pressed ? 'text-oq-96' : 'text-oq-80'} hover:text-oq-96 transition-colors cursor-pointer bg-transparent border-none p-2 leading-none`}
275
+ >
276
+ <Icon name={icon} size={20} />
277
+ </button>
278
+ )
279
+ }
@@ -0,0 +1,162 @@
1
+ import { useState } from 'react'
2
+ import { Button, Divider, SectionText, useMediaQuery } from '@kolkrabbi/kol-component'
3
+ import PageShell from './PageShell.jsx'
4
+
5
+ /* taxonomy-ok: organism — nests PageShell (relative) + kol-component's SectionText, Divider, Button */
6
+
7
+ /**
8
+ * StudioDetail — A module's or a patch's own page. one page for the thing a Library card opens — a module, a
9
+ * patch, a file — in every Studio app (plan home-library-detail-one-card 3.1, 2026-10-24; user, on the three
10
+ * hand-written pages: *"why was this not designed for in rack-hub"* · *"what back is this"*).
11
+ *
12
+ * kol-monitor wrote it first (`ModuleDetailPage`, 2026-09-02), kol-mirror ported it, the rack-hub twin copied it
13
+ * back, and each kept its own Back (a pill, a span), its own heading classes and its own button row. The page is
14
+ * made here once, from DATA, and an app passes nothing it draws itself:
15
+ *
16
+ * ‹ Back the eyebrow of the masthead — a TEXT LINK, never a Button (history back by default)
17
+ * Title / subtitle `SectionText level="app"` (the app masthead, the DS's one)
18
+ * Description sentences
19
+ * Controls · Specifications sections of rows — `{ kind?, label, value?, hint? }` or a text row
20
+ * Code the first lines, "View full source" opening the whole file in an overlay
21
+ * the preview the right column (a desk: 50 %; a phone: a 160 band above) — click to expand
22
+ * the actions `[{ label, onClick }]`, drawn as DS Buttons under a hairline
23
+ *
24
+ * The prose is `kol-mono-12` (line-height-bearing), the section labels `kol-helper-14` — kol-monitor's rungs, kept.
25
+ *
26
+ * @param {{ label?: string, onClick?: Function }} [back] the eyebrow link; `onClick` defaults to `history.back()`
27
+ * @param {ReactNode} title · subtitle the masthead
28
+ * @param {string|string[]} [description] prose — a string is split into sentences, an array is drawn as given
29
+ * @param {Array} [sections] `[{ label, rows: [{ kind?, label, value?, hint? }], text? }]` — `kind` (Knob · Input) in a
30
+ * 56 column, `label` in 72, `value` flexes, `hint` (a range, a signal) at the right edge;
31
+ * a section with `text` (string | string[]) instead of rows draws paragraphs
32
+ * @param {{ source: string, filename?: string, lines?: number }} [code] the source; the page shows `lines` (5) and an
33
+ * overlay with the whole file and its download
34
+ * @param {ReactNode|{ src: string, alt?: string, contain?: boolean }} [preview] the right column — an image (click
35
+ * to expand) or the consumer's node (a rendered module front)
36
+ * @param {Array} [actions] `[{ label, onClick, icon? }]` — the bottom row, DS `Button tone="grey" size="md"`
37
+ * @param {{ title: string, subtitle?: string }} [notFound] draw the not-found masthead instead of the page
38
+ * @param {string} [className] on the shell
39
+ */
40
+ export default function StudioDetail({ back, title, subtitle, description, sections = [], code, preview, actions = [], notFound, className = '' }) {
41
+ const narrow = useMediaQuery('(max-width: 767px)')
42
+ const [fullView, setFullView] = useState(false)
43
+ const [codeView, setCodeView] = useState(false)
44
+ if (notFound) {
45
+ return (
46
+ <PageShell className={className}>
47
+ {/* the subtitle keeps the masthead on every other page's rung; the requested id is the one fact the reader is missing */}
48
+ <SectionText level="app" headline={notFound.title} body={notFound.subtitle} />
49
+ </PageShell>
50
+ )
51
+ }
52
+ const goBack = back?.onClick ?? (() => window.history.back())
53
+ const sentences = Array.isArray(description) ? description : typeof description === 'string'
54
+ ? description.split('. ').filter(Boolean).map((s) => (s.endsWith('.') ? s : `${s}.`)) : []
55
+ const lines = code?.source ? code.source.split('\n').slice(0, code.lines ?? 5).join('\n') : null
56
+ const downloadSource = () => {
57
+ const blob = new Blob([code.source], { type: 'text/plain' })
58
+ const url = URL.createObjectURL(blob)
59
+ const a = document.createElement('a'); a.href = url; a.download = code.filename ?? 'source.txt'; a.click()
60
+ URL.revokeObjectURL(url)
61
+ }
62
+ const image = preview && typeof preview === 'object' && 'src' in preview ? preview : null
63
+ const heading = (label) => <h2 className="kol-helper-14 text-fg-80" style={{ marginBottom: 16 }}>{label}</h2>
64
+
65
+ return (
66
+ <PageShell mode={narrow ? 'scroll' : 'fixed'} className={className}>
67
+ <SectionText
68
+ level="app"
69
+ /* ‹ Back — a text link in the eyebrow, history back; from Create it returns there, from Library to Library */
70
+ eyebrow={<span onClick={goBack} className="kol-helper-12 text-fg-48 hover:text-fg-96 cursor-pointer select-none">‹ {back?.label ?? 'Back'}</span>}
71
+ headline={title}
72
+ body={subtitle}
73
+ />
74
+ <Divider className="mb-6" />
75
+
76
+ <div className="flex" style={{ flexDirection: narrow ? 'column' : 'row', gap: narrow ? 24 : 48, flex: 1, minHeight: 0 }}>
77
+ {/* the prose column */}
78
+ <div className="flex flex-col justify-between" style={{ flex: 1, overflow: narrow ? 'visible' : 'auto', paddingTop: 4, paddingBottom: 4 }}>
79
+ <div className="flex flex-col" style={{ gap: 32 }}>
80
+ {sentences.length > 0 && (
81
+ <div>
82
+ {heading('Description')}
83
+ <div className="flex flex-col" style={{ gap: 8 }}>
84
+ {sentences.map((s, i) => <div key={i} className="kol-mono-12 text-fg-48">{s}</div>)}
85
+ </div>
86
+ </div>
87
+ )}
88
+ {sections.map((sec) => (
89
+ <div key={sec.label}>
90
+ {heading(sec.label)}
91
+ <div className="flex flex-col" style={{ gap: 8 }}>
92
+ {sec.text != null
93
+ ? (Array.isArray(sec.text) ? sec.text : [sec.text]).map((t, i) => <div key={i} className="kol-mono-12 text-fg-48">{t}</div>)
94
+ : (sec.rows ?? []).map((row, i) => (
95
+ /* kind · label · value · hint — below 768 the value takes its own line so the row never clips sideways */
96
+ <div key={i} className="flex" style={{ gap: 12, alignItems: 'baseline', flexWrap: narrow ? 'wrap' : 'nowrap' }}>
97
+ {row.kind != null && <span className="kol-mono-12 text-fg-32" style={{ width: 56, flexShrink: 0 }}>{row.kind}</span>}
98
+ <span className="kol-mono-12 text-fg-64" style={row.value != null ? { width: 72, flexShrink: 0 } : undefined}>{row.label}</span>
99
+ {row.value != null && <span className="kol-mono-12 text-fg-48" style={{ flex: narrow ? '1 1 100%' : 1 }}>{row.value}</span>}
100
+ {row.hint != null && <span className="kol-mono-12 text-fg-32" style={{ flexShrink: 0 }}>{row.hint}</span>}
101
+ </div>
102
+ ))}
103
+ </div>
104
+ </div>
105
+ ))}
106
+ {lines && (
107
+ <div>
108
+ {heading('Code')}
109
+ <pre className="kol-mono-12 text-fg-32" style={{ margin: 0, overflow: 'hidden' }}>{lines}</pre>
110
+ <span className="kol-helper-10 text-fg-48 hover:text-fg-96 cursor-pointer inline-block" style={{ marginTop: 8 }} onClick={() => setCodeView(true)}>View full source</span>
111
+ </div>
112
+ )}
113
+ </div>
114
+
115
+ {actions.length > 0 && (
116
+ /* the row clears the phone bar or pill when the shell draws one (`--kol-shell-bar-clear`, StudioCreate's rule) */
117
+ <div className="flex flex-col" style={{ gap: 16, marginTop: 32, paddingBottom: 'var(--kol-shell-bar-clear, 0px)' }}>
118
+ <Divider />
119
+ <div className="flex" style={{ gap: 12 }}>
120
+ {actions.map((a) => <Button key={a.label} tone="grey" size="md" iconLeft={a.icon} onClick={a.onClick}>{a.label}</Button>)}
121
+ </div>
122
+ </div>
123
+ )}
124
+ </div>
125
+
126
+ {/* the preview column */}
127
+ {preview && (
128
+ image ? (
129
+ <div
130
+ className="kol-detail-preview bg-surface-tertiary border border-fg-08 relative cursor-pointer overflow-hidden"
131
+ onClick={() => setFullView(true)}
132
+ style={{ flex: narrow ? '0 0 auto' : '0 0 50%', order: narrow ? -1 : 0, height: narrow ? 160 : undefined, borderRadius: 4, padding: narrow ? 12 : 24 }}
133
+ >
134
+ <img src={image.src} alt={image.alt ?? ''} className="size-full" style={{ objectFit: image.contain ? 'contain' : 'cover' }} />
135
+ <div className="kol-detail-preview-overlay absolute inset-0 flex items-center justify-center" style={{ background: 'rgba(0,0,0,0.6)', opacity: 0, transition: 'opacity 0.2s' }}>
136
+ <span className="kol-helper-12 text-fg-64">{narrow ? 'Tap to expand' : 'Click to expand'}</span>
137
+ </div>
138
+ </div>
139
+ ) : (
140
+ <div style={{ flex: narrow ? '0 0 auto' : '0 0 50%', order: narrow ? -1 : 0, minWidth: 0 }}>{preview}</div>
141
+ )
142
+ )}
143
+ </div>
144
+
145
+ {fullView && image && (
146
+ <div onClick={() => setFullView(false)} className="fixed inset-0 flex items-center justify-center cursor-pointer" style={{ zIndex: 'var(--kol-z-modal)', background: 'rgba(0,0,0,0.9)' }}>
147
+ <span onClick={(e) => { e.stopPropagation(); setFullView(false) }} className="kol-helper-12 text-fg-48 hover:text-fg-96 absolute cursor-pointer" style={{ top: 24, right: 24 }}>Close</span>
148
+ <img src={image.src} alt={image.alt ?? ''} style={{ maxWidth: '90vw', maxHeight: '90vh', objectFit: 'contain' }} />
149
+ </div>
150
+ )}
151
+ {codeView && code?.source && (
152
+ <div onClick={() => setCodeView(false)} className="fixed inset-0 flex items-center justify-center cursor-pointer" style={{ zIndex: 'var(--kol-z-modal)', background: 'rgba(0,0,0,0.9)' }}>
153
+ <div className="absolute flex items-center" style={{ top: 24, right: 24, gap: 16 }}>
154
+ <span onClick={(e) => { e.stopPropagation(); downloadSource() }} className="kol-helper-12 text-fg-48 hover:text-fg-96 cursor-pointer">Download</span>
155
+ <span onClick={(e) => { e.stopPropagation(); setCodeView(false) }} className="kol-helper-12 text-fg-48 hover:text-fg-96 cursor-pointer">Close</span>
156
+ </div>
157
+ <pre onClick={(e) => e.stopPropagation()} className="kol-mono-12 text-fg-64" style={{ maxWidth: '85vw', maxHeight: '85vh', overflow: 'auto', padding: 32, margin: 0, cursor: 'text', userSelect: 'text' }}>{code.source}</pre>
158
+ </div>
159
+ )}
160
+ </PageShell>
161
+ )
162
+ }
@@ -1,14 +1,17 @@
1
1
  import { useEffect, useRef, useState } from 'react'
2
2
  import { Button, pushLayer, popLayer, isTopLayer } from '@kolkrabbi/kol-component'
3
+ import { warnJsx } from './warnJsx.js'
3
4
 
4
5
  /**
5
6
  * WalkthroughPanel — A stepped intro card. the absolutely-centred stepped intro card (both repos'
6
7
  * HomePage): chevron Buttons either side, text column + illustration pane.
7
8
  *
8
- * Steps are content: `[{ title, text: [..], illustration?, actions? }]` —
9
- * `illustration` is a render slot (monitor globs SVGs, mirror uses a JPEG),
10
- * a step with `actions` renders that node centred instead of the text/image
11
- * split (the "Get started" step).
9
+ * Steps are content: `[{ title, text: [..], cover?, illustration?, actions? }]` —
10
+ * `cover` is an image src the panel draws itself (full-bleed, at 60 %), `illustration` a render slot for a
11
+ * DRAWING (monitor globs SVGs); a step with `actions` renders them centred instead of the text/image split
12
+ * (the "Get started" step). THE ACTIONS ARE DATA (user 2026-10-24: Mirror and Monitor each drew their own
13
+ * Button there, one of them not the DS's): `[{ label, onClick, icon? }]`, drawn here as `Button tone="grey"
14
+ * size="md"`; a node is still drawn, with a dev warning.
12
15
  *
13
16
  * `onClose` draws an X INSIDE the card, top-right (user, 2026-09-26, on media-hub:
14
17
  * the panel had no close of its own, so every app put one outside the card or on a
@@ -72,7 +75,9 @@ export default function WalkthroughPanel({ steps = [], iconComponent, onClose })
72
75
  )}
73
76
  {current.actions ? (
74
77
  <div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 12 }}>
75
- {current.actions}
78
+ {Array.isArray(current.actions)
79
+ ? current.actions.map((a, i) => <Button key={a.label ?? i} tone="grey" size="md" iconLeft={a.icon} iconComponent={iconComponent} onClick={a.onClick}>{a.label}</Button>)
80
+ : (warnJsx('walkthrough[].actions', 'Pass [{ label, onClick }]; the panel draws the buttons.'), current.actions)}
76
81
  </div>
77
82
  ) : (
78
83
  <>
@@ -85,9 +90,9 @@ export default function WalkthroughPanel({ steps = [], iconComponent, onClose })
85
90
  </div>
86
91
  <span className="text-fg-48 kol-helper-12">{step + 1} / {steps.length}</span>
87
92
  </div>
88
- {current.illustration && (
93
+ {(current.cover || current.illustration) && (
89
94
  <div style={{ flex: '0 0 50%', overflow: 'hidden' }}>
90
- {current.illustration}
95
+ {current.cover ? <img src={current.cover} alt="" style={{ width: '100%', height: '100%', objectFit: 'cover', opacity: 0.6 }} /> : current.illustration}
91
96
  </div>
92
97
  )}
93
98
  </>
package/src/index.js CHANGED
@@ -30,6 +30,7 @@ export { ShortcutsOverlay, shortcutInScope } from '@kolkrabbi/kol-component'
30
30
  export { Logomark } from '@kolkrabbi/kol-component'
31
31
  // the app tier, shipped once (ShellHomeSystem, kol-fxr 2026-08-27)
32
32
  export { default as CatalogPage } from './CatalogPage.jsx'
33
+ export { default as CatalogGrid } from './CatalogGrid.jsx'
33
34
  export { default as SettingsShortcuts } from './SettingsShortcuts.jsx'
34
35
  export { default as SettingsLinks, SettingsColophon } from './SettingsLinks.jsx'
35
36
  export { default as TouchDeviceOverlay, useTouchPrimary } from './TouchDeviceOverlay.jsx'
@@ -40,5 +41,8 @@ export { default as HubSettings } from './HubSettings.jsx'
40
41
  export { default as HubDev } from './HubDev.jsx'
41
42
  // the Studio — the Hub + Home · Library · Create · Use · pages · Settings, the workstation (apps review §6c, 2026-09-29)
42
43
  export { default as AppStudio } from './AppStudio.jsx'
44
+ // Create: a catalog of parts beside the case on the studio canvas — monitor's page made once (plan-2026-10-23 § 3.4)
45
+ export { default as StudioCreate, StudioCreateAction } from './StudioCreate.jsx'
46
+ export { default as StudioDetail } from './StudioDetail.jsx'
43
47
  // a consumer slot in the opened rail — the page portals into it (NavRailConsumerSlot, kol-monitor 2026-10-15)
44
48
  export { RailSlotProvider, useRailSlot } from '@kolkrabbi/kol-component'
package/src/warnJsx.js ADDED
@@ -0,0 +1,9 @@
1
+ /* JSX WHERE DATA IS EXPECTED — one dev warning per place (user 2026-10-24: *"we are literally avoiding this custom per
2
+ * repo shit"*). The Hub's surfaces take data and draw it themselves; an element or a render function handed to one of
3
+ * these props is the hole every drift came through, so it is named once in the console and never silently accepted. */
4
+ const warned = new Set()
5
+ export function warnJsx(where, note = '') {
6
+ if (!import.meta.env?.DEV || warned.has(where)) return
7
+ warned.add(where)
8
+ console.warn(`kol-shell: ${where} takes data, not JSX — the Hub draws it (2026-10-24). ${note}`.trim())
9
+ }