@kolkrabbi/kol-shell 0.77.0 → 0.78.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/HubHome.jsx +5 -1
- package/src/StudioCreate.jsx +12 -4
- package/src/StudioDetail.jsx +162 -0
- package/src/index.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.1",
|
|
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.296.0",
|
|
25
|
-
"@kolkrabbi/kol-framework": "^0.53.0",
|
|
26
24
|
"@kolkrabbi/kol-icons": "^0.45.0",
|
|
27
|
-
"@kolkrabbi/kol-
|
|
25
|
+
"@kolkrabbi/kol-component": "^0.297.0",
|
|
26
|
+
"@kolkrabbi/kol-framework": "^0.53.0",
|
|
27
|
+
"@kolkrabbi/kol-theme": "^0.185.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
package/src/HubHome.jsx
CHANGED
|
@@ -50,6 +50,8 @@ import { useTouchPrimary } from './TouchDeviceOverlay.jsx'
|
|
|
50
50
|
* prompts and Delete confirms before the handler runs
|
|
51
51
|
* @param {Function} onTags `(file, tags)` — the rail's tag chips write through it; absent → tags read-only
|
|
52
52
|
* @param {Function} onNote `(file, text)` — the rail's note (a plain description, 2026-10-23) writes through it; absent → read-only
|
|
53
|
+
* @param {Function} onCover `(file, src)` — the rail's Upload image (2026-10-24): the DS picker's webp data URL for the
|
|
54
|
+
* file's cover; the consumer stores it as the file's `cover`. Absent → no Cover row
|
|
53
55
|
* @param {Object} touch QUICK LINKS ON A PHONE, opt-in (studio-hub review 2, § 7.2 — *"fxr would use the quicklinks
|
|
54
56
|
* for picking chrome right on mobile, while monitor and mirror wouldn't"*):
|
|
55
57
|
* `{ doors: [{ icon, label, onPress }] }` — on a coarse pointer or below `md`, the doors as a
|
|
@@ -94,7 +96,7 @@ function warnUnknown(unknown) {
|
|
|
94
96
|
warned.add(key)
|
|
95
97
|
console.warn(
|
|
96
98
|
`HubHome: "${key}" is not a Home prop and was ignored — Home is a data contract (HubHomeContract, 2026-10-23). `
|
|
97
|
-
+ 'Props: files · onOpen · onDownload · onRename · onDuplicate · onRemove · onTags · onNote · filterGroups · action, '
|
|
99
|
+
+ 'Props: files · onOpen · onDownload · onRename · onDuplicate · onRemove · onTags · onNote · onCover · filterGroups · action, '
|
|
98
100
|
+ 'plus app · title · subtitle · views · defaultView · walkthrough · iconComponent. '
|
|
99
101
|
+ '`template` and `summary` left 2026-10-23: files only, and a file\'s information is `details` in the rail. This warning is dev-only.',
|
|
100
102
|
)
|
|
@@ -113,6 +115,7 @@ export default function HubHome({
|
|
|
113
115
|
onRemove,
|
|
114
116
|
onTags,
|
|
115
117
|
onNote,
|
|
118
|
+
onCover,
|
|
116
119
|
filterGroups,
|
|
117
120
|
action,
|
|
118
121
|
views = HUB_VIEWS,
|
|
@@ -164,6 +167,7 @@ export default function HubHome({
|
|
|
164
167
|
note: item.note,
|
|
165
168
|
mark: item.mark,
|
|
166
169
|
onNote: onNote ? (text) => onNote(item, text) : undefined,
|
|
170
|
+
onCover: onCover ? (src) => onCover(item, src) : undefined,
|
|
167
171
|
verbs: Object.keys(verbs).length ? verbs : undefined,
|
|
168
172
|
download: onDownload ? () => onDownload(item) : undefined,
|
|
169
173
|
onClick: onOpen ? () => onOpen(item) : undefined,
|
package/src/StudioCreate.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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'
|
|
2
|
+
import { ActionButton, AppItemMenuProvider, ContentCard, ContentFilters, ContentRow, Divider, PageHeader, SECTION_TEXT_LEVELS, CanvasStudio, IconFrame, useMediaQuery } from '@kolkrabbi/kol-component'
|
|
3
3
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
4
4
|
import PageShell from './PageShell.jsx'
|
|
5
5
|
import CatalogGrid from './CatalogGrid.jsx'
|
|
@@ -200,19 +200,27 @@ export default function StudioCreate({
|
|
|
200
200
|
* props"*): a part is the `app` card and row, the files' own — no verbs, so no cog or trash; INSERT is the
|
|
201
201
|
* plate's action. On `CatalogGrid`, the Catalog's own grid, six at most, the list three across */
|
|
202
202
|
return (
|
|
203
|
-
/* the parts scroll in their own region — the page holds still on both views (user 2026-10-23)
|
|
203
|
+
/* the parts scroll in their own region — the page holds still on both views (user 2026-10-23). ONE MENU AND
|
|
204
|
+
* ONE RAIL for the parts too (0.78.1): a part is the Library's card — every field and icon — so its cog opens
|
|
205
|
+
* the same file rail and its right-click the same menu CatalogPage mounts */
|
|
206
|
+
<AppItemMenuProvider>
|
|
204
207
|
<div style={{ flex: 1, minHeight: 0, overflowY: 'auto', paddingBottom: 'calc(var(--kol-spacing-6) + var(--kol-shell-bar-clear, 0px))' }}>
|
|
205
208
|
<CatalogGrid layout={layout} onColumns={setCols} listColumns={3}>
|
|
206
209
|
{items.map((part) => {
|
|
207
210
|
const { key, ...props } = toCard ? toCard(part, { layout }) : { title: part.title ?? part.name }
|
|
208
211
|
const k = key ?? part.id ?? part.name
|
|
212
|
+
/* INSERT rides the one card (2026-10-24): the cover's other corner on a card, before the plate on a row —
|
|
213
|
+
* the part keeps every field and icon the Library's card has; `insert` (the plate action) is the shape a
|
|
214
|
+
* card without a plate still takes */
|
|
215
|
+
const place = onPlace ? { onInsert: () => onPlace(part) } : {}
|
|
209
216
|
const item = layout === 'grid'
|
|
210
|
-
? <ContentCard key={onPartPointerDown ? undefined : k} variant="app" {...props} actions={insert(part)} />
|
|
211
|
-
: <ContentRow key={onPartPointerDown ? undefined : k} variant="app" {...props} actions={insert(part)} />
|
|
217
|
+
? <ContentCard key={onPartPointerDown ? undefined : k} variant="app" {...props} {...place} actions={props.verbs || props.onTags ? undefined : insert(part)} />
|
|
218
|
+
: <ContentRow key={onPartPointerDown ? undefined : k} variant="app" {...props} {...place} actions={props.verbs || props.onTags ? undefined : insert(part)} />
|
|
212
219
|
return onPartPointerDown ? <div key={k} onPointerDown={(e) => onPartPointerDown(part, e)}>{item}</div> : item
|
|
213
220
|
})}
|
|
214
221
|
</CatalogGrid>
|
|
215
222
|
</div>
|
|
223
|
+
</AppItemMenuProvider>
|
|
216
224
|
)
|
|
217
225
|
}}
|
|
218
226
|
/>
|
|
@@ -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
|
+
}
|
package/src/index.js
CHANGED
|
@@ -43,5 +43,6 @@ export { default as HubDev } from './HubDev.jsx'
|
|
|
43
43
|
export { default as AppStudio } from './AppStudio.jsx'
|
|
44
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
45
|
export { default as StudioCreate, StudioCreateAction } from './StudioCreate.jsx'
|
|
46
|
+
export { default as StudioDetail } from './StudioDetail.jsx'
|
|
46
47
|
// a consumer slot in the opened rail — the page portals into it (NavRailConsumerSlot, kol-monitor 2026-10-15)
|
|
47
48
|
export { RailSlotProvider, useRailSlot } from '@kolkrabbi/kol-component'
|