@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.
- 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 +194 -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 +279 -0
- package/src/StudioDetail.jsx +162 -0
- package/src/WalkthroughPanel.jsx +12 -7
- package/src/index.js +4 -0
- package/src/warnJsx.js +9 -0
package/src/AppStudio.jsx
CHANGED
|
@@ -27,20 +27,30 @@ import PageShell from './PageShell.jsx'
|
|
|
27
27
|
* Router-agnostic like AppShell: `currentPath` + `onNavigate`. Everything else is AppHub's.
|
|
28
28
|
*
|
|
29
29
|
* @param {Object} app AppHub's `{ name, subtitle, logomark, about, links }`
|
|
30
|
-
* @param {Object} home HubHome's props — the landing Catalog (
|
|
30
|
+
* @param {Object} home HubHome's props — the landing Catalog's DATA (`files` · `template` · handlers;
|
|
31
|
+
* required: a Studio opens on Home)
|
|
31
32
|
* @param {Object} [library] CatalogPage's props — or `children` (a router, for pages under the
|
|
32
33
|
* slot: `/library/:id`), which renders in place of the CatalogPage —
|
|
33
34
|
* plus `{ path, label, icon }`
|
|
34
|
-
* @param {Object} [create] `{ header (PageHeader props), children, path, label, icon }
|
|
35
|
+
* @param {Object} [create] `{ header (PageHeader props), children, path, label, icon, bar? }` (`bar: false` as `pages`);
|
|
35
36
|
* `shell: false` renders `children` bare — for a Create that owns its
|
|
36
37
|
* PageShell (a fixed canvas beside a scrolling list)
|
|
37
38
|
* @param {Object} [use] `{ children, path, label, icon }` — the tool
|
|
38
|
-
* @param {Array} [pages] `[{ path, icon, label, children }]` — opt-in pages, after Use
|
|
39
|
+
* @param {Array} [pages] `[{ path, icon, label, children, sub?, bar? }]` — opt-in pages, after Use; `bar: false` on a page
|
|
40
|
+
* (or a sub row) that owns the phone's bottom edge hides the bar there, as Use does; a page with `sub`
|
|
41
|
+
* is a SECTION whose rows (each `{ path, icon, label, children, sub? }`) open under it
|
|
42
|
+
* (rows that hold sections enter under a Back row; leaf rows expand in place)
|
|
39
43
|
* @param {Object} [settings] HubSettings' props
|
|
44
|
+
* @param {Object} [media] AppHub's `media` — the Media row at the rail's foot, the DS modal library over a client
|
|
45
|
+
* @param {Object} [signIn] AppHub's `signIn` — the user row at the rail's foot; the press is the consumer's
|
|
40
46
|
* @param {Object} [dev] HubDev's props — AppHub's `dev`: a dev server's `code` page at `/dev`
|
|
41
47
|
* @param {'mono'|'display'} [masthead='mono']
|
|
42
|
-
* @param {Object} [shell] any AppShell prop, spread last
|
|
48
|
+
* @param {Object} [shell] any AppShell prop, spread last. The rail is `NavRail preset="app"` (AppHub's), so an app
|
|
49
|
+
* passes nothing about it; the Studio adds `barHiddenOn` — Use and every `bar: false` page
|
|
43
50
|
*/
|
|
51
|
+
/* a rail row and its `sub` rows, every level deep (Chrome → Labs → Effects → its groups); a page's `children` stay here */
|
|
52
|
+
const railRow = ({ path, icon, label, sub, to }) => ({ path, icon, label, ...(sub && { sub: sub.map(railRow) }), ...(to && { to }) }) // `bar`, `children` stay here
|
|
53
|
+
|
|
44
54
|
export default function AppStudio({
|
|
45
55
|
app,
|
|
46
56
|
currentPath,
|
|
@@ -52,6 +62,8 @@ export default function AppStudio({
|
|
|
52
62
|
use,
|
|
53
63
|
pages = [],
|
|
54
64
|
settings,
|
|
65
|
+
media,
|
|
66
|
+
signIn,
|
|
55
67
|
dev,
|
|
56
68
|
walkthrough,
|
|
57
69
|
shortcuts,
|
|
@@ -66,11 +78,17 @@ export default function AppStudio({
|
|
|
66
78
|
const tool = slot(use, '/use', 'Use', 'nav-rack')
|
|
67
79
|
const rows = [lib, make, tool, ...pages].filter(Boolean)
|
|
68
80
|
const at = (p) => currentPath === p || currentPath.startsWith(`${p}/`)
|
|
81
|
+
/* THE BAR STEPS ASIDE on the tool and on any page that owns the phone's bottom edge (mirror's bottom sheet, the rack's
|
|
82
|
+
* chrome, fxr's chromes). The rail itself is NavRail's `app` preset, through AppHub; `shell` still overrides, deliberately. */
|
|
83
|
+
const flatPages = (list) => list.flatMap((p) => [...flatPages(p.sub ?? []), p])
|
|
84
|
+
const barHiddenOn = [tool?.path, make?.bar === false ? make.path : null, ...flatPages(pages).filter((p) => p.bar === false).map((p) => p.path)].filter(Boolean)
|
|
69
85
|
|
|
70
86
|
let page = null
|
|
71
87
|
if (lib && at(lib.path)) {
|
|
72
|
-
|
|
73
|
-
|
|
88
|
+
/* `key` is React's, lifted out so a consumer can remount the Catalog per view (a chip from one view must not
|
|
89
|
+
* survive into the other and filter everything out — mixer-hub's `key={props.view}`) */
|
|
90
|
+
const { path: _p, label: _l, icon: _i, children, key, ...props } = lib
|
|
91
|
+
page = children ?? <CatalogPage key={key} {...props} />
|
|
74
92
|
} else if (make && at(make.path)) {
|
|
75
93
|
page = make.shell === false ? make.children : (
|
|
76
94
|
<PageShell>
|
|
@@ -81,26 +99,31 @@ export default function AppStudio({
|
|
|
81
99
|
} else if (tool && at(tool.path)) {
|
|
82
100
|
page = tool.children
|
|
83
101
|
} else {
|
|
84
|
-
page
|
|
102
|
+
/* a page may be a SECTION — `sub` rows under it (plan-2026-10-23 § 3.5: the Chrome section that enters to
|
|
103
|
+
* Editor, Labs, Randomiser, Morph; Effects expands its leaves) — so the walk reads every level, the deepest match first */
|
|
104
|
+
const flat = (list) => list.flatMap((p) => [...flat(p.sub ?? []), p])
|
|
105
|
+
page = flat(pages).find((p) => at(p.path))?.children ?? null
|
|
85
106
|
}
|
|
86
107
|
|
|
87
108
|
return (
|
|
88
109
|
<AppHub
|
|
89
110
|
app={app}
|
|
90
|
-
items={rows.map(
|
|
111
|
+
items={rows.map(railRow)}
|
|
91
112
|
currentPath={currentPath}
|
|
92
113
|
onNavigate={onNavigate}
|
|
93
114
|
iconComponent={iconComponent}
|
|
94
115
|
home={home}
|
|
95
116
|
walkthrough={walkthrough}
|
|
96
117
|
settings={settings}
|
|
118
|
+
media={media}
|
|
119
|
+
signIn={signIn}
|
|
97
120
|
dev={dev}
|
|
98
121
|
shortcuts={shortcuts}
|
|
99
122
|
themeToggle={themeToggle}
|
|
100
123
|
shortcutsKey={shortcutsKey}
|
|
101
124
|
masthead={masthead}
|
|
102
125
|
/* the tool sits on bare surface-primary, full-bleed; every other page keeps the Hub's wash */
|
|
103
|
-
shell={{ ...(tool && at(tool.path) ? { pageWash: null } : null), ...shell }}
|
|
126
|
+
shell={{ barHiddenOn, ...(tool && at(tool.path) ? { pageWash: null } : null), ...shell }}
|
|
104
127
|
>
|
|
105
128
|
{page}
|
|
106
129
|
</AppHub>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useCallback, useRef, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CatalogGrid — The catalog's measured card grid. the grid every catalog draws its cards and rows on, lifted out of
|
|
5
|
+
* `CatalogPage` so a second page draws the same one (studio-hub review 2, § 3.1 — user, on Create's parts: *"a new
|
|
6
|
+
* set of card and row … different card, layout, padding, text … there are 8 columns per row"*: StudioCreate had drawn
|
|
7
|
+
* its own `auto-fill minmax(160px)` grid and its own list).
|
|
8
|
+
*
|
|
9
|
+
* GRID: `.kol-catalog-grid` over a MEASURED track count (CatalogFilterFirstGroupTrackCount, 2026-09-03) — up to
|
|
10
|
+
* `maxColumns` (6, the ruling) tracks, none narrower than `minColumn` (160), gap 24:
|
|
11
|
+
* `min(maxColumns, floor((W + 24) / (minColumn + 24)))`, in JS because the CSS form is Chromium-only. The count is set
|
|
12
|
+
* as `--kol-catalog-n` on the grid and reported through `onColumns`, so a page can set it where its filter row's
|
|
13
|
+
* `.kol-filters-first` reads it too. LIST: rows `listColumns` across (never under 240, gap 8), or `stack` — one per line.
|
|
14
|
+
*
|
|
15
|
+
* @param {'grid'|'list'} layout which of the two (default `grid`)
|
|
16
|
+
* @param {number} minColumn the grid track's floor in px (default 160)
|
|
17
|
+
* @param {number} maxColumns the grid's ceiling (default 6)
|
|
18
|
+
* @param {number} listColumns the list's column ceiling (default 4)
|
|
19
|
+
* @param {'grid'|'stack'} listLayout the list's container (default `grid`)
|
|
20
|
+
* @param {Function} onColumns `(n) => void` — the measured track count, whenever it changes
|
|
21
|
+
* @param {ReactNode} children the cards (grid) or rows (list)
|
|
22
|
+
*/
|
|
23
|
+
export default function CatalogGrid({ layout = 'grid', minColumn = 160, maxColumns = 6, listColumns = 4, listLayout = 'grid', onColumns, children, className, style }) {
|
|
24
|
+
const [cols, setCols] = useState(null)
|
|
25
|
+
const observer = useRef(null)
|
|
26
|
+
const report = useRef(onColumns)
|
|
27
|
+
report.current = onColumns
|
|
28
|
+
/* a CALLBACK ref: the grid mounts and unmounts with the layout toggle, and a callback ref sees both */
|
|
29
|
+
const gridRef = useCallback((el) => {
|
|
30
|
+
observer.current?.disconnect()
|
|
31
|
+
observer.current = null
|
|
32
|
+
if (!el) return
|
|
33
|
+
const measure = (W) => {
|
|
34
|
+
const n = Math.max(1, Math.min(maxColumns, Math.floor((W + 24) / (minColumn + 24))))
|
|
35
|
+
setCols((c) => (c === n ? c : n))
|
|
36
|
+
report.current?.(n)
|
|
37
|
+
}
|
|
38
|
+
measure(el.getBoundingClientRect().width)
|
|
39
|
+
const ro = new ResizeObserver(([entry]) => measure(entry.contentRect.width))
|
|
40
|
+
ro.observe(el)
|
|
41
|
+
observer.current = ro
|
|
42
|
+
}, [minColumn, maxColumns])
|
|
43
|
+
|
|
44
|
+
if (layout === 'list') {
|
|
45
|
+
return (
|
|
46
|
+
<div className={className} style={{ ...(listLayout === 'stack' ? { display: 'flex', flexDirection: 'column', gap: 8 } : { display: 'grid', gridTemplateColumns: `repeat(auto-fill, minmax(min(100%, max(240px, calc((100% - ${listColumns - 1} * 8px) / ${listColumns}))), 1fr))`, gap: 8 }), ...style }}>
|
|
47
|
+
{children}
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
return (
|
|
52
|
+
<div ref={gridRef} className={`kol-catalog-grid ${className ?? ''}`.trim()} style={{ '--kol-catalog-n': cols ?? undefined, ...style }}>
|
|
53
|
+
{children}
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
}
|
package/src/CatalogPage.jsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ActionButton, AppItemMenuProvider, ContentCard, ContentFilters, ContentRow, SizeOrDownload, formatSize } from '@kolkrabbi/kol-component'
|
|
1
|
+
import { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import { ActionButton, AppItemMenuProvider, ContentCard, ContentFilters, ContentRow, SizeOrDownload, formatSize, useMediaQuery } from '@kolkrabbi/kol-component'
|
|
3
3
|
import PageShell from './PageShell.jsx'
|
|
4
4
|
import { PageHeader } from '@kolkrabbi/kol-component'
|
|
5
5
|
import WalkthroughPanel from './WalkthroughPanel.jsx'
|
|
6
|
+
import CatalogGrid from './CatalogGrid.jsx'
|
|
6
7
|
|
|
7
|
-
/* taxonomy-ok: organism — nests PageShell / PageHeader / WalkthroughPanel (relative) + kol-component's ContentFilters + ContentCard / ContentRow */
|
|
8
|
+
/* taxonomy-ok: organism — nests PageShell / PageHeader / WalkthroughPanel / CatalogGrid (relative) + kol-component's ContentFilters + ContentCard / ContentRow */
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* CatalogPage — An app's home or library page. the app tier's Home / Library page, shipped once (ShellHomeSystem,
|
|
@@ -57,6 +58,12 @@ import WalkthroughPanel from './WalkthroughPanel.jsx'
|
|
|
57
58
|
* @param {string} defaultLayout 'grid' (default) | 'list'
|
|
58
59
|
* @param {{steps: Array, open: boolean, onClose?: Function, iconComponent?: ElementType}} walkthrough the panel over the catalog; `onClose` draws its X inside the card
|
|
59
60
|
* @param {ReactNode} actions the bottom row's buttons
|
|
61
|
+
* @param {'scroll'|'fixed'} mode the page's HEIGHT (plan-2026-10-23 § 4.12, his idea: *"100vh and have the content vertically
|
|
62
|
+
* scroll … new file and walkthrough are always at the same place regardless of content"*):
|
|
63
|
+
* `scroll` (default) is the page as it was; `fixed` holds the page at the viewport's height,
|
|
64
|
+
* the catalog scrolls in its own region and the action row sits at the foot, in the same
|
|
65
|
+
* place with one item or a hundred
|
|
66
|
+
* @param {boolean} actionsOnPhone draw the action row below `md` (default true); false when the phone bar's More sheet carries it
|
|
60
67
|
* @param {'bleed'|'capped'} width the page's TIER, forwarded to PageShell (two-page-scaffolds-one-job, 2026-09-03):
|
|
61
68
|
* `bleed` (default) fills the window — the app tier; `capped` centres on the
|
|
62
69
|
* framework container — the site tier, so a brand book adopting this page keeps its geometry
|
|
@@ -68,6 +75,12 @@ import WalkthroughPanel from './WalkthroughPanel.jsx'
|
|
|
68
75
|
* its slots (`date` · `size` · `meta` · `selected`) come from `toCard` like everything else
|
|
69
76
|
* @param {number} listColumns the list grid's column ceiling (default 3 for a file, app or slide row, else 4); tracks never go under 240
|
|
70
77
|
* @param {'grid'|'stack'} listLayout the list's container (default `grid`, rows four across — monitor's ruling); `stack` = one row per line
|
|
78
|
+
* @param {'list'|'grid'} phoneLayout below `md` (768, the shell's `drawerBelow` rung): `list` (default) draws the list with the
|
|
79
|
+
* preset's row and no LIST / GRID strip — a phone gets rows, the grid card breaks its
|
|
80
|
+
* layout (studio-hub review 2, § 7.2 — *"I do like just using row contentcard for mobile …
|
|
81
|
+
* if we opt for just using row card on mobile, then we don't need to show it at all"*);
|
|
82
|
+
* `grid` keeps the desk's strip and layouts on a phone
|
|
83
|
+
* @param {ReactNode} lead a node between the masthead and the catalog (HubHome's quick links on a phone)
|
|
71
84
|
* @param {ElementType} iconComponent icon renderer seam for ContentFilters
|
|
72
85
|
* @param {boolean} showCountOnlyWhenFiltering (default true)
|
|
73
86
|
* @param {Object} filtersProps spread onto ContentFilters last — e.g. `{ mutuallyExclusiveFilters: ['category', 'u_label'] }`
|
|
@@ -98,10 +111,16 @@ function computeHiddenSet(items, expandedIdx) {
|
|
|
98
111
|
* defaults, byte-identical. `shelf` is olina's /slide-deck as it stood, every
|
|
99
112
|
* value read off the render. An explicit prop always wins over its preset. */
|
|
100
113
|
const PRESETS = {
|
|
101
|
-
|
|
114
|
+
/* the app tier holds still (user 2026-10-23: *"I do like the heading fixed at the top … a rule to avoid vertical
|
|
115
|
+
* scroll"*): the masthead and filter row stay, the catalog scrolls, the action row is the foot. `mode` below. */
|
|
116
|
+
catalog: { mode: 'fixed' },
|
|
102
117
|
/* an app's saved files (CatalogAppVariant, kol-fxr 2026-10-23): the `app` card and row — `toCard`
|
|
103
118
|
* returns `verbs` · `download` · `menuItems` · `date` · `size` · `media` and the page draws the rest */
|
|
104
|
-
|
|
119
|
+
/* 208 FLOOR (user 2026-10-24: *"the layout of the card CAN NOT CHANGE on resolution available"*): the card's text
|
|
120
|
+
* column is the track less 24 of plate pad and the 28 the cog and trash reserve; `2026-10-23` · 24 gap · `999.9 KB`
|
|
121
|
+
* at mono-12 is 72 + 24 + 58 = 154, so a 208 track holds the pair on one line for every size, and a narrower page
|
|
122
|
+
* drops a column (CatalogGrid's measured count) instead of breaking the row. Was 160, where the size wrapped by file. */
|
|
123
|
+
app: { cardVariant: 'app', rowVariant: 'app', mode: 'fixed', minColumn: 208 },
|
|
105
124
|
shelf: {
|
|
106
125
|
width: 'capped', maxColumns: 3, minColumn: 280,
|
|
107
126
|
cardVariant: 'slide', rowVariant: 'slide', listLayout: 'stack',
|
|
@@ -119,6 +138,50 @@ const stop = (e) => { e.preventDefault(); e.stopPropagation() }
|
|
|
119
138
|
* the size cell is SizeOrDownload; `count` is the slide count. A slot the
|
|
120
139
|
* consumer supplies itself is left alone. The consumer writes no JSX for
|
|
121
140
|
* actions — that is the point of the preset. */
|
|
141
|
+
/* THE FOLD (user 2026-10-23, Firefox's rail as the example: *"the first row is clipped, like we want … a slight shadow"*):
|
|
142
|
+
* the fixed mode's scroll region with a 32px fade from the page's ground at its TOP edge, only once rows have scrolled
|
|
143
|
+
* under it, so a cut row reads as folded under the edge. The top alone (user 2026-10-23: *"I dont think we need it on bottom"*). A fade, not a
|
|
144
|
+
* shadow: on this ground a shadow has nothing to fall on. `bleed` runs the region through the page's bottom pad. */
|
|
145
|
+
function ScrollRegion({ bleed, children }) {
|
|
146
|
+
const ref = useRef(null)
|
|
147
|
+
const [under, setUnder] = useState(false)
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
const el = ref.current
|
|
150
|
+
if (!el) return undefined
|
|
151
|
+
const read = () => setUnder(el.scrollTop > 0)
|
|
152
|
+
read()
|
|
153
|
+
el.addEventListener('scroll', read, { passive: true })
|
|
154
|
+
const ro = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(read)
|
|
155
|
+
ro?.observe(el)
|
|
156
|
+
if (el.firstElementChild) ro?.observe(el.firstElementChild)
|
|
157
|
+
return () => { el.removeEventListener('scroll', read); ro?.disconnect() }
|
|
158
|
+
}, [])
|
|
159
|
+
const fade = (
|
|
160
|
+
<div
|
|
161
|
+
aria-hidden
|
|
162
|
+
/* PAGE-WIDE, through the side pads, so the band has no visible ends (user 2026-10-23: "it clips the left and right");
|
|
163
|
+
* the opaque surface under the wash, else a translucent wash fading to nothing is a band you hardly see */
|
|
164
|
+
className="pointer-events-none absolute h-8 transition-opacity duration-150"
|
|
165
|
+
style={{
|
|
166
|
+
top: 0,
|
|
167
|
+
left: 'calc(var(--kol-shell-page-pad) * -1)',
|
|
168
|
+
right: 'calc(var(--kol-shell-page-pad) * -1)',
|
|
169
|
+
opacity: under ? 1 : 0,
|
|
170
|
+
background: 'linear-gradient(to bottom, var(--kol-shell-page-wash, transparent), transparent), linear-gradient(to bottom, var(--kol-surface-primary) 20%, transparent)',
|
|
171
|
+
}}
|
|
172
|
+
/>
|
|
173
|
+
)
|
|
174
|
+
return (
|
|
175
|
+
/* THE FOLD SITS RIGHT UNDER THE LIST / GRID ROW (user 2026-10-23: *"it could fade further up"*): ContentFilters puts 24px
|
|
176
|
+
* of air above its items; the region takes that air INSIDE its scroll box, so at rest nothing moves and a scrolled row
|
|
177
|
+
* folds under the row above, not 24px below it */
|
|
178
|
+
<div className="relative flex min-h-0 flex-1 flex-col" style={{ marginTop: 'calc(var(--kol-spacing-6) * -1)', marginBottom: bleed ? 'calc(var(--kol-shell-page-pad) * -1)' : undefined }}>
|
|
179
|
+
<div ref={ref} style={{ flex: 1, minHeight: 0, overflowY: 'auto', paddingTop: 'var(--kol-spacing-6)' }}>{children}</div>
|
|
180
|
+
{fade}
|
|
181
|
+
</div>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
122
185
|
function toSlideCard(c, { layout }) {
|
|
123
186
|
const { bytes, count, cover, favourited, onDownload, onFavourite, onDelete, downloadHref, ...rest } = c
|
|
124
187
|
const list = layout === 'list'
|
|
@@ -142,6 +205,9 @@ export default function CatalogPage({
|
|
|
142
205
|
/* FIRST, so every default below can read it */
|
|
143
206
|
preset = 'catalog',
|
|
144
207
|
header,
|
|
208
|
+
/* a site-tier page (`capped`, the shelf) is a document and scrolls; the app tier's presets hold still */
|
|
209
|
+
mode,
|
|
210
|
+
actionsOnPhone = true,
|
|
145
211
|
width = PRESETS[preset]?.width ?? 'bleed',
|
|
146
212
|
items = [],
|
|
147
213
|
toCard,
|
|
@@ -187,41 +253,28 @@ export default function CatalogPage({
|
|
|
187
253
|
iconComponent,
|
|
188
254
|
showCountOnlyWhenFiltering = true,
|
|
189
255
|
filtersProps,
|
|
256
|
+
phoneLayout = 'list',
|
|
257
|
+
lead,
|
|
190
258
|
children,
|
|
191
259
|
className = '',
|
|
192
260
|
style,
|
|
193
261
|
}) {
|
|
262
|
+
mode = mode ?? (width === 'capped' ? 'scroll' : PRESETS[preset]?.mode ?? 'scroll')
|
|
194
263
|
const open = walkthrough?.open === true
|
|
195
|
-
/*
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* because the CSS form (`round()` over a length ÷ length) is Chromium-only —
|
|
201
|
-
* theme 0.137.0 rendered ONE column in Firefox. `undefined` until measured
|
|
202
|
-
* → the theme's fallback of 6, the pre-0.137.0 geometry. */
|
|
264
|
+
/* a phone gets rows: the list, and no LIST / GRID strip to choose from */
|
|
265
|
+
const phoneRows = useMediaQuery('(max-width: 767px)') && phoneLayout !== 'grid'
|
|
266
|
+
/* THE TRACK COUNT, MEASURED by `CatalogGrid` (CatalogFilterFirstGroupTrackCount, 2026-09-03) and set here on the
|
|
267
|
+
* page too, where the filter row's `.kol-filters-first` reads the same `--kol-catalog-n`. `null` until measured →
|
|
268
|
+
* the theme's fallback of 6, the pre-0.137.0 geometry. */
|
|
203
269
|
const [cols, setCols] = useState(null)
|
|
204
|
-
const observer = useRef(null)
|
|
205
|
-
/* a CALLBACK ref: the grid mounts and unmounts with the layout toggle, and a
|
|
206
|
-
* callback ref sees both — an effect keyed on a value out of this scope does
|
|
207
|
-
* not (the first cut referenced `renderItem`'s `layout` here and threw) */
|
|
208
|
-
const gridRef = useCallback((el) => {
|
|
209
|
-
observer.current?.disconnect()
|
|
210
|
-
observer.current = null
|
|
211
|
-
if (!el) return
|
|
212
|
-
const measure = (W) => setCols((c) => { const n = Math.max(1, Math.min(maxColumns, Math.floor((W + 24) / (minColumn + 24)))); return c === n ? c : n })
|
|
213
|
-
measure(el.getBoundingClientRect().width)
|
|
214
|
-
const ro = new ResizeObserver(([entry]) => measure(entry.contentRect.width))
|
|
215
|
-
ro.observe(el)
|
|
216
|
-
observer.current = ro
|
|
217
|
-
}, [minColumn, maxColumns])
|
|
218
270
|
|
|
219
271
|
/* the page's ONE menu for its `app` cards and rows (AppItem.jsx) — closed, it renders nothing */
|
|
220
272
|
return (
|
|
221
273
|
<AppItemMenuProvider>
|
|
222
|
-
<PageShell width={width} className={`${PRESETS[preset]?.className ?? ''} ${className}`.trim()} style={{ overflow: 'hidden', '--kol-catalog-n': cols ?? undefined, ...style }}>
|
|
274
|
+
<PageShell mode={mode} width={width} className={`${PRESETS[preset]?.className ?? ''} ${className}`.trim()} style={{ overflow: 'hidden', '--kol-catalog-n': cols ?? undefined, ...style }}>
|
|
223
275
|
{header && <PageHeader level="app" {...header} />}
|
|
224
|
-
|
|
276
|
+
{lead}
|
|
277
|
+
<div style={mode === 'fixed' ? { flex: 1, minHeight: 0, position: 'relative', display: 'flex', flexDirection: 'column' } : { flex: 1, position: 'relative' }}>
|
|
225
278
|
{open && <WalkthroughPanel steps={walkthrough.steps} iconComponent={walkthrough.iconComponent} onClose={walkthrough.onClose} />}
|
|
226
279
|
<ContentFilters
|
|
227
280
|
items={items}
|
|
@@ -236,8 +289,9 @@ export default function CatalogPage({
|
|
|
236
289
|
viewMode={view}
|
|
237
290
|
onViewModeChange={onViewChange}
|
|
238
291
|
defaultViewMode={defaultView}
|
|
239
|
-
layoutOptions={open ? undefined : layouts}
|
|
292
|
+
layoutOptions={open || phoneRows ? undefined : layouts}
|
|
240
293
|
defaultLayout={defaultLayout}
|
|
294
|
+
layout={phoneRows ? 'list' : undefined}
|
|
241
295
|
renderItem={(rows, viewMode, layout) => {
|
|
242
296
|
if (open) return null
|
|
243
297
|
const cards = rows.map((item) => { const c = toCard ? toCard(item, { view: viewMode, layout }) : { title: item.title ?? item.name, detail: item.detail }; return preset === 'shelf' ? toSlideCard(c, { layout }) : c })
|
|
@@ -254,38 +308,39 @@ export default function CatalogPage({
|
|
|
254
308
|
* expanded-card neighbour math (computeHiddenSet) stays a
|
|
255
309
|
* six-column ruling — below the ceiling the hide-set is
|
|
256
310
|
* desktop-only geometry. */
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
<div ref={layout === 'list' ? undefined : gridRef} className={layout === 'list' ? undefined : 'kol-catalog-grid'} style={layout === 'list' ? (listLayout === 'stack' ? { display: 'flex', flexDirection: 'column', gap: 8 } : { display: 'grid', gridTemplateColumns: `repeat(auto-fill, minmax(min(100%, max(240px, calc((100% - ${listColumns - 1} * 8px) / ${listColumns}))), 1fr))`, gap: 8 }) : undefined}>
|
|
311
|
+
/* the grid and the list are `CatalogGrid` (studio-hub review 2, § 3.1): the measured tracks, `.kol-catalog-grid`,
|
|
312
|
+
* the list's `listColumns` — one piece, so StudioCreate's parts draw on the same one */
|
|
313
|
+
const grid = (
|
|
314
|
+
<CatalogGrid layout={layout} minColumn={minColumn} maxColumns={maxColumns} listColumns={listColumns} listLayout={listLayout} onColumns={setCols}>
|
|
262
315
|
{rows.map((item, i) => {
|
|
263
316
|
if (hidden.has(i)) return null
|
|
264
317
|
const c = cards[i]
|
|
265
318
|
const key = c.key ?? item.key ?? item.id ?? item.name ?? i
|
|
266
319
|
/* A COMPOSITION FORWARDS THE WHOLE CONTRACT OF WHAT IT COMPOSES (user
|
|
267
320
|
* 2026-09-03: "why wouldn't we as standard practice ALLOW VARIANT CHANGE
|
|
268
|
-
* EVERY TIME WE USE THOSE CONTENT CARDS?").
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
* onto the card and the row: every prop either takes is reachable per
|
|
273
|
-
* card, today and for props not written yet; `variant` per card beats
|
|
274
|
-
* the page's `cardVariant` / `rowVariant`; `fit` keeps its `cover`
|
|
275
|
-
* default. `key` is React's and is lifted out first. */
|
|
321
|
+
* EVERY TIME WE USE THOSE CONTENT CARDS?"). `toCard`'s return is SPREAD
|
|
322
|
+
* onto the card and the row; `variant` per card beats the page's
|
|
323
|
+
* `cardVariant` / `rowVariant`; `fit` keeps its `cover` default. `key`
|
|
324
|
+
* is React's and is lifted out first. */
|
|
276
325
|
const { key: _key, ...forwarded } = c
|
|
277
326
|
return layout === 'list'
|
|
278
327
|
? <ContentRow key={key} {...forwarded} variant={c.variant ?? rowVariant} />
|
|
279
328
|
: <ContentCard key={key} {...forwarded} variant={c.variant ?? cardVariant} fit={c.fit ?? 'cover'} />
|
|
280
329
|
})}
|
|
281
|
-
</
|
|
330
|
+
</CatalogGrid>
|
|
282
331
|
)
|
|
332
|
+
/* `fixed`: the catalog scrolls in its own region — the fill chain ContentFilters keeps for a fixed page
|
|
333
|
+
* (ContentFiltersFillChain) ends here, in a scroller; the page itself never scrolls */
|
|
334
|
+
/* TO THE PAGE'S EDGE (user 2026-10-23: *"padding bottom is still there clipping"*): with no foot row under it the
|
|
335
|
+
* region bleeds through the page's bottom pad, so a cut row reads as scrolling under the edge, not stopped above a band */
|
|
336
|
+
return mode === 'fixed' ? <ScrollRegion bleed={!actions}>{grid}</ScrollRegion> : grid
|
|
283
337
|
}}
|
|
284
338
|
{...filtersProps}
|
|
285
339
|
/>
|
|
286
340
|
</div>
|
|
287
341
|
{children}
|
|
288
|
-
{
|
|
342
|
+
{/* `fixed`: the action row is the page's FOOT, the same place with one item or a hundred */}
|
|
343
|
+
{actions && <div className={actionsOnPhone ? 'flex' : 'flex max-md:hidden'} style={{ gap: 12, marginTop: mode === 'fixed' ? 24 : 48, alignSelf: 'flex-start', flexShrink: 0 }}>{actions}</div>}
|
|
289
344
|
</PageShell>
|
|
290
345
|
</AppItemMenuProvider>
|
|
291
346
|
)
|