@kolkrabbi/kol-shell 0.74.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 +111 -48
- 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/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, 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,
|
|
@@ -37,7 +38,9 @@ import WalkthroughPanel from './WalkthroughPanel.jsx'
|
|
|
37
38
|
* variant's A4, so nothing existing moves. Anything `ContentFilters` takes that the page has no
|
|
38
39
|
* prop for goes through `filtersProps` — `mutuallyExclusiveFilters` was the gap.
|
|
39
40
|
*
|
|
40
|
-
* @param {'catalog'|'shelf'} preset the whole page as one word (default `catalog` = today's defaults). `
|
|
41
|
+
* @param {'catalog'|'app'|'shelf'} preset the whole page as one word (default `catalog` = today's defaults). `app` = an
|
|
42
|
+
* app's saved files: the `app` card and row (`toCard` returns `verbs` · `download` ·
|
|
43
|
+
* `menuItems` · `date` ms · `size` bytes · `media` src) and one shared menu. `shelf` = a
|
|
41
44
|
* shelf of slide decks: capped · 3 tracks on a 280 floor · `slide` card and row · stacked
|
|
42
45
|
* list · `kol-tone-secondary` on the root · the All / Recent view strip; `toCard` returns
|
|
43
46
|
* the deck's fields and handlers — `title date bytes count cover href onNavigate onDownload
|
|
@@ -55,6 +58,12 @@ import WalkthroughPanel from './WalkthroughPanel.jsx'
|
|
|
55
58
|
* @param {string} defaultLayout 'grid' (default) | 'list'
|
|
56
59
|
* @param {{steps: Array, open: boolean, onClose?: Function, iconComponent?: ElementType}} walkthrough the panel over the catalog; `onClose` draws its X inside the card
|
|
57
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
|
|
58
67
|
* @param {'bleed'|'capped'} width the page's TIER, forwarded to PageShell (two-page-scaffolds-one-job, 2026-09-03):
|
|
59
68
|
* `bleed` (default) fills the window — the app tier; `capped` centres on the
|
|
60
69
|
* framework container — the site tier, so a brand book adopting this page keeps its geometry
|
|
@@ -62,10 +71,16 @@ import WalkthroughPanel from './WalkthroughPanel.jsx'
|
|
|
62
71
|
* @param {number} minColumn the grid track's floor in px (default 160) — a minimum, never a count
|
|
63
72
|
* @param {number} maxColumns the grid's ceiling (default 6, the ruling); a three-deck shelf passes 3 and the tracks share the width
|
|
64
73
|
* @param {string} cardVariant the grid card's variant, per page (default `catalog`); `toCard` may return `variant` per card
|
|
65
|
-
* @param {'catalog'|'file'} rowVariant the list row (default `catalog`, the 36px no-thumb row); `file` = the 48px thumb row, for a catalog whose grid shows a cover —
|
|
74
|
+
* @param {'catalog'|'file'|'app'} rowVariant the list row (default `catalog`, the 36px no-thumb row); `file` = the 48px thumb row, for a catalog whose grid shows a cover —
|
|
66
75
|
* its slots (`date` · `size` · `meta` · `selected`) come from `toCard` like everything else
|
|
67
|
-
* @param {number} listColumns the list grid's column ceiling (default 3 for a file or slide row, else 4); tracks never go under 240
|
|
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
|
|
68
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)
|
|
69
84
|
* @param {ElementType} iconComponent icon renderer seam for ContentFilters
|
|
70
85
|
* @param {boolean} showCountOnlyWhenFiltering (default true)
|
|
71
86
|
* @param {Object} filtersProps spread onto ContentFilters last — e.g. `{ mutuallyExclusiveFilters: ['category', 'u_label'] }`
|
|
@@ -96,7 +111,16 @@ function computeHiddenSet(items, expandedIdx) {
|
|
|
96
111
|
* defaults, byte-identical. `shelf` is olina's /slide-deck as it stood, every
|
|
97
112
|
* value read off the render. An explicit prop always wins over its preset. */
|
|
98
113
|
const PRESETS = {
|
|
99
|
-
|
|
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' },
|
|
117
|
+
/* an app's saved files (CatalogAppVariant, kol-fxr 2026-10-23): the `app` card and row — `toCard`
|
|
118
|
+
* returns `verbs` · `download` · `menuItems` · `date` · `size` · `media` and the page draws the rest */
|
|
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 },
|
|
100
124
|
shelf: {
|
|
101
125
|
width: 'capped', maxColumns: 3, minColumn: 280,
|
|
102
126
|
cardVariant: 'slide', rowVariant: 'slide', listLayout: 'stack',
|
|
@@ -114,6 +138,50 @@ const stop = (e) => { e.preventDefault(); e.stopPropagation() }
|
|
|
114
138
|
* the size cell is SizeOrDownload; `count` is the slide count. A slot the
|
|
115
139
|
* consumer supplies itself is left alone. The consumer writes no JSX for
|
|
116
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
|
+
|
|
117
185
|
function toSlideCard(c, { layout }) {
|
|
118
186
|
const { bytes, count, cover, favourited, onDownload, onFavourite, onDelete, downloadHref, ...rest } = c
|
|
119
187
|
const list = layout === 'list'
|
|
@@ -137,6 +205,9 @@ export default function CatalogPage({
|
|
|
137
205
|
/* FIRST, so every default below can read it */
|
|
138
206
|
preset = 'catalog',
|
|
139
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,
|
|
140
211
|
width = PRESETS[preset]?.width ?? 'bleed',
|
|
141
212
|
items = [],
|
|
142
213
|
toCard,
|
|
@@ -178,43 +249,32 @@ export default function CatalogPage({
|
|
|
178
249
|
/* the LIST grid's column ceiling (2026-10-22 — user: *"are you passing props on number of items/columns?"*). It was
|
|
179
250
|
a hard 4 — monitor's ruling for the 36px catalog row. A file or slide row is a contained tile with a 72 thumb, so
|
|
180
251
|
it defaults to 3 (user: *"change this one to 3"*). Tracks still never go under 240. */
|
|
181
|
-
listColumns = rowVariant === 'file' || rowVariant === 'slide' ? 3 : 4,
|
|
252
|
+
listColumns = rowVariant === 'file' || rowVariant === 'app' || rowVariant === 'slide' ? 3 : 4,
|
|
182
253
|
iconComponent,
|
|
183
254
|
showCountOnlyWhenFiltering = true,
|
|
184
255
|
filtersProps,
|
|
256
|
+
phoneLayout = 'list',
|
|
257
|
+
lead,
|
|
185
258
|
children,
|
|
186
259
|
className = '',
|
|
187
260
|
style,
|
|
188
261
|
}) {
|
|
262
|
+
mode = mode ?? (width === 'capped' ? 'scroll' : PRESETS[preset]?.mode ?? 'scroll')
|
|
189
263
|
const open = walkthrough?.open === true
|
|
190
|
-
/*
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* because the CSS form (`round()` over a length ÷ length) is Chromium-only —
|
|
196
|
-
* theme 0.137.0 rendered ONE column in Firefox. `undefined` until measured
|
|
197
|
-
* → 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. */
|
|
198
269
|
const [cols, setCols] = useState(null)
|
|
199
|
-
const observer = useRef(null)
|
|
200
|
-
/* a CALLBACK ref: the grid mounts and unmounts with the layout toggle, and a
|
|
201
|
-
* callback ref sees both — an effect keyed on a value out of this scope does
|
|
202
|
-
* not (the first cut referenced `renderItem`'s `layout` here and threw) */
|
|
203
|
-
const gridRef = useCallback((el) => {
|
|
204
|
-
observer.current?.disconnect()
|
|
205
|
-
observer.current = null
|
|
206
|
-
if (!el) return
|
|
207
|
-
const measure = (W) => setCols((c) => { const n = Math.max(1, Math.min(maxColumns, Math.floor((W + 24) / (minColumn + 24)))); return c === n ? c : n })
|
|
208
|
-
measure(el.getBoundingClientRect().width)
|
|
209
|
-
const ro = new ResizeObserver(([entry]) => measure(entry.contentRect.width))
|
|
210
|
-
ro.observe(el)
|
|
211
|
-
observer.current = ro
|
|
212
|
-
}, [minColumn, maxColumns])
|
|
213
270
|
|
|
271
|
+
/* the page's ONE menu for its `app` cards and rows (AppItem.jsx) — closed, it renders nothing */
|
|
214
272
|
return (
|
|
215
|
-
<
|
|
273
|
+
<AppItemMenuProvider>
|
|
274
|
+
<PageShell mode={mode} width={width} className={`${PRESETS[preset]?.className ?? ''} ${className}`.trim()} style={{ overflow: 'hidden', '--kol-catalog-n': cols ?? undefined, ...style }}>
|
|
216
275
|
{header && <PageHeader level="app" {...header} />}
|
|
217
|
-
|
|
276
|
+
{lead}
|
|
277
|
+
<div style={mode === 'fixed' ? { flex: 1, minHeight: 0, position: 'relative', display: 'flex', flexDirection: 'column' } : { flex: 1, position: 'relative' }}>
|
|
218
278
|
{open && <WalkthroughPanel steps={walkthrough.steps} iconComponent={walkthrough.iconComponent} onClose={walkthrough.onClose} />}
|
|
219
279
|
<ContentFilters
|
|
220
280
|
items={items}
|
|
@@ -229,8 +289,9 @@ export default function CatalogPage({
|
|
|
229
289
|
viewMode={view}
|
|
230
290
|
onViewModeChange={onViewChange}
|
|
231
291
|
defaultViewMode={defaultView}
|
|
232
|
-
layoutOptions={open ? undefined : layouts}
|
|
292
|
+
layoutOptions={open || phoneRows ? undefined : layouts}
|
|
233
293
|
defaultLayout={defaultLayout}
|
|
294
|
+
layout={phoneRows ? 'list' : undefined}
|
|
234
295
|
renderItem={(rows, viewMode, layout) => {
|
|
235
296
|
if (open) return null
|
|
236
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 })
|
|
@@ -247,38 +308,40 @@ export default function CatalogPage({
|
|
|
247
308
|
* expanded-card neighbour math (computeHiddenSet) stays a
|
|
248
309
|
* six-column ruling — below the ceiling the hide-set is
|
|
249
310
|
* desktop-only geometry. */
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
<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}>
|
|
255
315
|
{rows.map((item, i) => {
|
|
256
316
|
if (hidden.has(i)) return null
|
|
257
317
|
const c = cards[i]
|
|
258
318
|
const key = c.key ?? item.key ?? item.id ?? item.name ?? i
|
|
259
319
|
/* A COMPOSITION FORWARDS THE WHOLE CONTRACT OF WHAT IT COMPOSES (user
|
|
260
320
|
* 2026-09-03: "why wouldn't we as standard practice ALLOW VARIANT CHANGE
|
|
261
|
-
* EVERY TIME WE USE THOSE CONTENT CARDS?").
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
* onto the card and the row: every prop either takes is reachable per
|
|
266
|
-
* card, today and for props not written yet; `variant` per card beats
|
|
267
|
-
* the page's `cardVariant` / `rowVariant`; `fit` keeps its `cover`
|
|
268
|
-
* 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. */
|
|
269
325
|
const { key: _key, ...forwarded } = c
|
|
270
326
|
return layout === 'list'
|
|
271
327
|
? <ContentRow key={key} {...forwarded} variant={c.variant ?? rowVariant} />
|
|
272
328
|
: <ContentCard key={key} {...forwarded} variant={c.variant ?? cardVariant} fit={c.fit ?? 'cover'} />
|
|
273
329
|
})}
|
|
274
|
-
</
|
|
330
|
+
</CatalogGrid>
|
|
275
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
|
|
276
337
|
}}
|
|
277
338
|
{...filtersProps}
|
|
278
339
|
/>
|
|
279
340
|
</div>
|
|
280
341
|
{children}
|
|
281
|
-
{
|
|
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>}
|
|
282
344
|
</PageShell>
|
|
345
|
+
</AppItemMenuProvider>
|
|
283
346
|
)
|
|
284
347
|
}
|