@kolkrabbi/kol-component 0.297.0 → 0.299.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 +1 -1
- package/src/hooks/useDragResize.js +7 -1
- package/src/index.js +1 -0
- package/src/molecules/AppItem.jsx +7 -3
- package/src/molecules/ContentCard.jsx +57 -9
- package/src/molecules/ContentRow.jsx +2 -2
- package/src/molecules/PageControls.jsx +69 -0
- package/src/organisms/AppItemMenuProvider.jsx +133 -15
- package/src/organisms/NavRailSite.jsx +79 -34
- package/src/organisms/SettingsPanel.jsx +13 -2
package/package.json
CHANGED
|
@@ -24,7 +24,9 @@ import useGrabEdge from './useGrabEdge.js'
|
|
|
24
24
|
*
|
|
25
25
|
* - CLICK TOGGLES expand↔collapse: pointerup with < 3px of travel is a
|
|
26
26
|
* click, never a resize — drags only start past the slop, so toggle
|
|
27
|
-
* presses can't jitter the rail.
|
|
27
|
+
* presses can't jitter the rail. Expanding by a press lands on the
|
|
28
|
+
* stylesheet's rung for the viewport, not a remembered drag width
|
|
29
|
+
* (2026-10-24).
|
|
28
30
|
* - DRAG resizes; live width goes to --kol-sidenav-w on :root so the grid,
|
|
29
31
|
* shell-header brand block and aside follow one number. Dragging under
|
|
30
32
|
* --kol-sidenav-snap stamps :root[data-sidenav="collapsed"].
|
|
@@ -189,6 +191,10 @@ export default function useDragResize(ref, options = {}) {
|
|
|
189
191
|
const toggleCollapsed = () => {
|
|
190
192
|
const { collapsed: c } = readBack(names)
|
|
191
193
|
stampCollapsed(names, !c)
|
|
194
|
+
/* EXPANDING BY A PRESS LANDS ON THE RUNG (user 2026-10-24: "clicking the rail when collapsed should go to
|
|
195
|
+
* that default"): the stylesheet's width for this viewport (264 · 320 from 1536), never a remembered drag
|
|
196
|
+
* width — the override is cleared, and persisted as cleared */
|
|
197
|
+
if (c) writeWidth(names, null)
|
|
192
198
|
syncAndPersist()
|
|
193
199
|
}
|
|
194
200
|
|
package/src/index.js
CHANGED
|
@@ -105,6 +105,7 @@ export { default as CodeBlock } from './molecules/CodeBlock.jsx'
|
|
|
105
105
|
export { default as ColorInputRow } from './molecules/ColorInputRow.jsx'
|
|
106
106
|
export { default as ColorRamp } from './molecules/ColorRamp.jsx'
|
|
107
107
|
export { default as TextFold } from './molecules/TextFold.jsx'
|
|
108
|
+
export { default as PageControls } from './molecules/PageControls.jsx'
|
|
108
109
|
export { default as ColorSwatch } from './molecules/ColorSwatch.jsx'
|
|
109
110
|
export { default as Dropdown } from './molecules/Dropdown.jsx'
|
|
110
111
|
/* MultiSelect — several pick-one settings in one dropdown, a column each (2026-10-01, first cut) */
|
|
@@ -68,7 +68,7 @@ const placeholder = (
|
|
|
68
68
|
* cover's other corner and reads in the rail. Always runs the same hooks (one
|
|
69
69
|
* context read), so ContentCard / ContentRow call it unconditionally.
|
|
70
70
|
*/
|
|
71
|
-
export function useAppItem(variant, { title, verbs, download, menuItems, date, size, media, tone, tags, details, onTags, note, onNote, mark, onCover, onInsert, row = false }) {
|
|
71
|
+
export function useAppItem(variant, { title, verbs, download, menuItems, date, size, media, back, tone, tags, details, onTags, note, onNote, mark, onCover, onInsert, images, onImages, onBack, row = false }) {
|
|
72
72
|
const ctx = useContext(MenuCtx)
|
|
73
73
|
if (variant !== 'app') return null
|
|
74
74
|
const menu = ctx?.menu
|
|
@@ -79,8 +79,12 @@ export function useAppItem(variant, { title, verbs, download, menuItems, date, s
|
|
|
79
79
|
const dateText = typeof date === 'number' ? new Date(date).toISOString().slice(0, 10) : date
|
|
80
80
|
const sizeText = typeof size === 'number' ? formatSize(size) : size
|
|
81
81
|
/* the cog opens the file's info rail (user ruling 2026-10-23); right-click keeps the menu. `onCover(src)` is the
|
|
82
|
-
* rail's Upload image (2026-10-24)
|
|
83
|
-
|
|
82
|
+
* rail's Upload image (2026-10-24), or the Cover pick when the file carries `images` (FileRailImages): the rail's
|
|
83
|
+
* Files section reads the card's own cover and back srcs for its marks, so both go along as strings */
|
|
84
|
+
const openInfo = ctx ? () => ctx.openInfo({
|
|
85
|
+
name: title, verbs, download, tags, details, onTags, note, onNote, mark, date: dateText, size: sizeText, onCover,
|
|
86
|
+
images, onImages, onBack, cover: typeof media === 'string' ? media : undefined, back: typeof back === 'string' ? back : undefined,
|
|
87
|
+
}) : undefined
|
|
84
88
|
/* the cover's download stops its click at the control, as the plate does — a card that opens on click
|
|
85
89
|
* opened under the download too (AppCardDownloadClickBubbles, kol-monitor 2026-10-23) */
|
|
86
90
|
return {
|
|
@@ -32,6 +32,17 @@ import { toneClass } from '../utilities/tone.js'
|
|
|
32
32
|
* library's parts slotted from `verbs` (`{ rename?, duplicate?, remove? }`), `download` and
|
|
33
33
|
* `menuItems` — download on the cover, cog over trash in the plate, the page's one menu on
|
|
34
34
|
* right-click. `date` takes ms, `size` bytes, `media` a src. See AppItem.jsx.
|
|
35
|
+
*
|
|
36
|
+
* THE BACK (AppCardBackCover, kol-monitor 2026-10-24): `back` is a SECOND cover — a src or a node,
|
|
37
|
+
* passed as `media` is — revealed on hover and on keyboard focus, never on `selected` (the print
|
|
38
|
+
* flip rides `selected`, so a consumer could not put it on hover without the card reading as
|
|
39
|
+
* selected). Monitor's case: the patch's OUTPUT in front, the rack it was built on behind. `backReveal`
|
|
40
|
+
* is HOW it shows — `flip-image` (the media turns, the plate and the corner controls stay; default),
|
|
41
|
+
* `flip-card` (the whole card turns, the back fills it, bare), `hover` (the back cuts in over the
|
|
42
|
+
* front, no motion) — three treatments on the open-questions page (round 17) for the user's pick; the
|
|
43
|
+
* losers go after his ruling. The choreography is kol-theme's (`.kol-card[data-back]`, kol-animation.css);
|
|
44
|
+
* reduced motion makes both flips the cut; touch has no hover and keeps the front. Absent `back` = the
|
|
45
|
+
* card as it was. Not `reveal`: that name is the canvas card's overlay NODE.
|
|
35
46
|
*/
|
|
36
47
|
|
|
37
48
|
/* ruled defaults — defaults, not hardcodes; `ratio` stays overridable while
|
|
@@ -131,8 +142,12 @@ const MEDIA = {
|
|
|
131
142
|
showcase: { zoom: true },
|
|
132
143
|
/* frame OFF by default (ListingCardThumbBorder, user 2026-08-27: "I hate
|
|
133
144
|
* border — remove border"): the article thumb's hairline is opt-in —
|
|
134
|
-
* `frame` turns it on, and with it the fg-08 → fg-16 hover step
|
|
135
|
-
|
|
145
|
+
* `frame` turns it on, and with it the fg-08 → fg-16 hover step.
|
|
146
|
+
* ZOOM OFF (user 2026-10-24, site-hub W4: "an annoying habit of using article
|
|
147
|
+
* contentcard with a stupid zoom on hover"): a page link is not image-led —
|
|
148
|
+
* the thumb stays put, as the app card's hover fill went (2026-10-23). `zoom`
|
|
149
|
+
* stays an opt-in prop; the hero rung is hero's own. */
|
|
150
|
+
article: { frame: false, borderHover: true, zoom: false },
|
|
136
151
|
}
|
|
137
152
|
|
|
138
153
|
/* VARIANTS ARE CONTENT KINDS, NEVER PAGE NAMES (user ruling 2026-08-29:
|
|
@@ -174,6 +189,9 @@ export default function ContentCard({
|
|
|
174
189
|
/* `flip` + `fade` — behaviours, not variants (the print fold, 2026-08-29) */
|
|
175
190
|
flip,
|
|
176
191
|
fade,
|
|
192
|
+
/* `back` + `backReveal` — the second cover and how it shows (AppCardBackCover, 2026-10-24) */
|
|
193
|
+
back,
|
|
194
|
+
backReveal = 'flip-image',
|
|
177
195
|
/* plateRule (CatalogCardFrameAndZoom): the plate's top hairline — default the variant's (catalog and
|
|
178
196
|
* print draw it); `false` turns it off without an `!important` in a consumer sheet */
|
|
179
197
|
plateRule,
|
|
@@ -213,8 +231,8 @@ export default function ContentCard({
|
|
|
213
231
|
/* `app` (CatalogAppVariant, kol-fxr 2026-10-23) is the `file` card with its parts slotted from
|
|
214
232
|
* `verbs`, `download`, `menuItems`, and `tags`, `details`, `onTags` for the info rail — AppItem.jsx.
|
|
215
233
|
* None of them reach ContentText; an app card's `tags` are the rail's, never chips on the plate. */
|
|
216
|
-
const app = useAppItem(variantProp, { title: text.title, verbs: text.verbs, download: text.download, menuItems: text.menuItems, date: text.date, size: text.size, media, tone, tags: text.tags, details: text.details, onTags: text.onTags, note: text.note, onNote: text.onNote, mark: text.mark, onCover: text.onCover, onInsert: text.onInsert })
|
|
217
|
-
delete text.verbs; delete text.download; delete text.menuItems; delete text.details; delete text.onTags; delete text.note; delete text.onNote; delete text.mark; delete text.onCover; delete text.onInsert
|
|
234
|
+
const app = useAppItem(variantProp, { title: text.title, verbs: text.verbs, download: text.download, menuItems: text.menuItems, date: text.date, size: text.size, media, back, tone, tags: text.tags, details: text.details, onTags: text.onTags, note: text.note, onNote: text.onNote, mark: text.mark, onCover: text.onCover, onInsert: text.onInsert, images: text.images, onImages: text.onImages, onBack: text.onBack })
|
|
235
|
+
delete text.verbs; delete text.download; delete text.menuItems; delete text.details; delete text.onTags; delete text.note; delete text.onNote; delete text.mark; delete text.onCover; delete text.onInsert; delete text.images; delete text.onImages; delete text.onBack
|
|
218
236
|
if (app) {
|
|
219
237
|
delete text.tags
|
|
220
238
|
variantProp = 'file'
|
|
@@ -313,6 +331,17 @@ export default function ContentCard({
|
|
|
313
331
|
* existing consumer is untouched. */
|
|
314
332
|
const noMedia = media === false
|
|
315
333
|
|
|
334
|
+
/* THE BACK: a src becomes the cover's `<img>`, cover-cropped at the consumer's `--kol-media-focus`
|
|
335
|
+
* (monitor binds `top left`, so a rack reads its modules — the old rack previews' anchor); a node
|
|
336
|
+
* is the consumer's. The three treatments share two FACES in one TURN; the theme keys the motion
|
|
337
|
+
* off `data-back` on the root. `flip-card` wraps the whole body (below); the other two wrap the
|
|
338
|
+
* media only, so the plate and the corner controls hold still. */
|
|
339
|
+
const backNode = back == null ? null
|
|
340
|
+
: typeof back === 'string' ? <img src={back} alt="" className="size-full object-cover" style={{ objectPosition: 'var(--kol-media-focus, center)' }} /> : back
|
|
341
|
+
/* the media turn is the stack layout's (file · slide · article — the app card is file); flip-card wraps any body */
|
|
342
|
+
const backMode = backNode && !noMedia && (box.layout === 'stack' || backReveal === 'flip-card') ? backReveal : null
|
|
343
|
+
const backFace = backMode ? <div className="kol-card-face kol-card-face--back"><ContentMedia ratio={null} {...{ radius: !framed, fit: 'cover' }}>{backNode}</ContentMedia></div> : null
|
|
344
|
+
|
|
316
345
|
const textNode = hasPlate ? (
|
|
317
346
|
<div
|
|
318
347
|
className="kol-card-plate relative"
|
|
@@ -389,7 +418,16 @@ export default function ContentCard({
|
|
|
389
418
|
* positions against the media box, and there is none */}
|
|
390
419
|
{!noMedia && (
|
|
391
420
|
<div className="relative">
|
|
392
|
-
|
|
421
|
+
{backMode && backMode !== 'flip-card' ? (
|
|
422
|
+
<div className="kol-card-turn">
|
|
423
|
+
<div className="kol-card-turn-inner">
|
|
424
|
+
<div className="kol-card-face kol-card-face--front"><ContentMedia ratio={r} {...mediaProps}>{media}</ContentMedia></div>
|
|
425
|
+
{backFace}
|
|
426
|
+
</div>
|
|
427
|
+
</div>
|
|
428
|
+
) : (
|
|
429
|
+
<ContentMedia ratio={r} {...mediaProps}>{media}</ContentMedia>
|
|
430
|
+
)}
|
|
393
431
|
{controlNode}
|
|
394
432
|
{controlStartNode}
|
|
395
433
|
</div>
|
|
@@ -467,6 +505,15 @@ export default function ContentCard({
|
|
|
467
505
|
</>
|
|
468
506
|
)
|
|
469
507
|
|
|
508
|
+
/* `flip-card`: the WHOLE card is the front face and the back fills the card — every control turns
|
|
509
|
+
* away with the front, which is the treatment's cost (named on round 17) */
|
|
510
|
+
const turned = backMode === 'flip-card' ? (
|
|
511
|
+
<div className="kol-card-turn-inner flex flex-col">
|
|
512
|
+
<div className="kol-card-face kol-card-face--front flex flex-col">{body}</div>
|
|
513
|
+
{backFace}
|
|
514
|
+
</div>
|
|
515
|
+
) : body
|
|
516
|
+
|
|
470
517
|
/* THE ROOT FOLLOWS THE AFFORDANCE. A card that navigates must be a real <a>:
|
|
471
518
|
* middle-click, cmd-click, focus order, "copy link address" and every screen
|
|
472
519
|
* reader's link list all come from the tag, and none of them can be added
|
|
@@ -487,7 +534,8 @@ export default function ContentCard({
|
|
|
487
534
|
|
|
488
535
|
const common = {
|
|
489
536
|
'data-tags': isHero && Array.isArray(text.tags) && text.tags.length ? text.tags.join(' ') : undefined,
|
|
490
|
-
|
|
537
|
+
'data-back': backMode ?? undefined,
|
|
538
|
+
className: `kol-card group flex ${toneClass(tone)} ${box.layout === 'canvas' && reveal != null ? 'has-reveal' : ''} ${expanded ? 'flex-col md:flex-row-reverse' : 'flex-col'} ${box.layout === 'drawer' ? 'relative overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${backMode === 'flip-card' ? 'relative' : ''} ${framed ? 'overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${box.border ? 'border' : ''} ${box.layout === 'canvas' ? 'relative' : ''} ${interactive ? 'cursor-pointer select-none' : ''} ${hoverBg && interactive ? 'kol-content-hover' : ''} ${interactive && box.frameHover ? 'kol-content-hover-frame' : ''} ${className}`.trim(),
|
|
491
539
|
style: {
|
|
492
540
|
/* same reason as ContentRow: rest colors are PROPERTIES, because an
|
|
493
541
|
* inline background/borderColor outranks the hover class and the step
|
|
@@ -507,7 +555,7 @@ export default function ContentCard({
|
|
|
507
555
|
}
|
|
508
556
|
|
|
509
557
|
if (href) {
|
|
510
|
-
return <a href={href} onClick={nav} {...common}>{
|
|
558
|
+
return <a href={href} onClick={nav} {...common}>{turned}</a>
|
|
511
559
|
}
|
|
512
560
|
if (onClick) {
|
|
513
561
|
return (
|
|
@@ -529,9 +577,9 @@ export default function ContentCard({
|
|
|
529
577
|
}}
|
|
530
578
|
{...common}
|
|
531
579
|
>
|
|
532
|
-
{
|
|
580
|
+
{turned}
|
|
533
581
|
</article>
|
|
534
582
|
)
|
|
535
583
|
}
|
|
536
|
-
return <article {...common}>{
|
|
584
|
+
return <article {...common}>{turned}</article>
|
|
537
585
|
}
|
|
@@ -196,8 +196,8 @@ export default function ContentRow({
|
|
|
196
196
|
/* `app` (CatalogAppVariant, kol-fxr 2026-10-23) is the `file` row with its parts slotted from
|
|
197
197
|
* `verbs`, `download`, `menuItems`, and `tags`, `details`, `onTags` for the info rail — AppItem.jsx.
|
|
198
198
|
* None of them reach ContentText; an app row's `tags` are the rail's, never chips in the row. */
|
|
199
|
-
const app = useAppItem(variantProp, { title: text.title, verbs: text.verbs, download: text.download, menuItems: text.menuItems, date: text.date, size: text.size, media, tone, tags: text.tags, details: text.details, onTags: text.onTags, note: text.note, onNote: text.onNote, mark: text.mark, onCover: text.onCover, onInsert: text.onInsert, row: true })
|
|
200
|
-
delete text.verbs; delete text.download; delete text.menuItems; delete text.details; delete text.onTags; delete text.note; delete text.onNote; delete text.mark; delete text.onCover; delete text.onInsert
|
|
199
|
+
const app = useAppItem(variantProp, { title: text.title, verbs: text.verbs, download: text.download, menuItems: text.menuItems, date: text.date, size: text.size, media, back: text.back, tone, tags: text.tags, details: text.details, onTags: text.onTags, note: text.note, onNote: text.onNote, mark: text.mark, onCover: text.onCover, onInsert: text.onInsert, images: text.images, onImages: text.onImages, onBack: text.onBack, row: true })
|
|
200
|
+
delete text.verbs; delete text.download; delete text.menuItems; delete text.details; delete text.onTags; delete text.note; delete text.onNote; delete text.mark; delete text.onCover; delete text.onInsert; delete text.back; delete text.images; delete text.onImages; delete text.onBack
|
|
201
201
|
if (app) {
|
|
202
202
|
delete text.tags
|
|
203
203
|
variantProp = 'file'
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import Tag from '../atoms/Tag.jsx'
|
|
2
|
+
import SegmentedToggle from '../atoms/SegmentedToggle.jsx'
|
|
3
|
+
import TabsRow from './TabsRow.jsx'
|
|
4
|
+
|
|
5
|
+
/* taxonomy-ok: molecule — composes Tag, SegmentedToggle (atoms) and TabsRow (a molecule of chips) into one strip */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* PageControls — The page's own controls, one strip. the controls a PAGE carries for itself — which series show,
|
|
9
|
+
* which view, where to jump, what the dots mean, how many are showing — in one sticky strip under the page
|
|
10
|
+
* header, every page the same (site-hub W4, user 2026-10-24: kol-branding's Compare and Moods carried the same
|
|
11
|
+
* five pieces in two orders, each page hand-laying its own sticky bar). Not content filters: `ContentFilters`
|
|
12
|
+
* narrows a COLLECTION by its facets; this strip drives the page's rendering.
|
|
13
|
+
*
|
|
14
|
+
* The slots, in the order they are drawn — an empty slot is not there:
|
|
15
|
+
* row 1 toggles · views · count the series chips (Tag), the view switches (SegmentedToggle), the readout
|
|
16
|
+
* row 2 jump the section tabs (TabsRow look="chip"), scrolling sideways when long
|
|
17
|
+
* row 3 legend a dot and a name per series, as many columns as series
|
|
18
|
+
*
|
|
19
|
+
* STICKY by default: `sticky top-0` on the page's z-sticky rung, a hairline under it, the surface painted so the
|
|
20
|
+
* page scrolls beneath — kol-branding's StickyBar line, carried. The host page gives it the page's horizontal
|
|
21
|
+
* edge (a `kol-shell-page-bleed` in the app shell, nothing on a site plane).
|
|
22
|
+
*
|
|
23
|
+
* @param {Object} [toggles] `{ label, items: [{ id, label, active }], onToggle(id) }` — Tag chips, pressed = showing
|
|
24
|
+
* @param {Array} [views] `[{ label, value, onChange, options: [{ value, label }] }]` — one SegmentedToggle each
|
|
25
|
+
* @param {ReactNode}[count] the readout on the row's right (`15 / 15`)
|
|
26
|
+
* @param {Object} [jump] `{ label, value, onChange, tabs: [{ id, label }] }` — TabsRow chips
|
|
27
|
+
* @param {Array} [legend] `[{ id, label, color }]` — a dot (`color`, a CSS color) and a name per series
|
|
28
|
+
* @param {boolean} [sticky=true]
|
|
29
|
+
* @param {string} [className]
|
|
30
|
+
*/
|
|
31
|
+
export default function PageControls({ toggles, views = [], count, jump, legend, sticky = true, className = '' }) {
|
|
32
|
+
const rowOne = toggles || views.length > 0 || count != null
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
className={`${sticky ? 'md:sticky top-0 z-[calc(var(--kol-z-sticky)-1)]' : ''} flex flex-col gap-3 border-b border-fg-08 bg-surface-primary bg-[linear-gradient(var(--kol-shell-page-wash,transparent),var(--kol-shell-page-wash,transparent))] py-3 ${className}`.replace(/\s+/g, ' ').trim()}
|
|
36
|
+
>
|
|
37
|
+
{rowOne && (
|
|
38
|
+
<div className="flex flex-wrap items-center gap-x-6 gap-y-3">
|
|
39
|
+
{toggles && (
|
|
40
|
+
<div className="flex flex-wrap items-center gap-2" role="group" aria-label={toggles.label}>
|
|
41
|
+
{toggles.items.map((t) => (
|
|
42
|
+
<Tag key={t.id} hash={false} active={t.active} onClick={() => toggles.onToggle(t.id)}>{t.label}</Tag>
|
|
43
|
+
))}
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
46
|
+
{views.map((v) => (
|
|
47
|
+
<SegmentedToggle key={v.label} ariaLabel={v.label} size="sm" value={v.value} onChange={v.onChange} options={v.options} />
|
|
48
|
+
))}
|
|
49
|
+
{count != null && <span className="kol-mono-12 text-fg-48 ml-auto">{count}</span>}
|
|
50
|
+
</div>
|
|
51
|
+
)}
|
|
52
|
+
{jump && (
|
|
53
|
+
<div className="overflow-x-auto">
|
|
54
|
+
<TabsRow look="chip" size="sm" ariaLabel={jump.label} value={jump.value} onChange={jump.onChange} tabs={jump.tabs} />
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
{legend && legend.length > 0 && (
|
|
58
|
+
<div className="grid grid-cols-1 gap-4 xl:[grid-template-columns:var(--cols)]" style={{ '--cols': `repeat(${legend.length}, minmax(0, 1fr))` }}>
|
|
59
|
+
{legend.map((l) => (
|
|
60
|
+
<span key={l.id} className="flex items-center gap-2 min-w-0">
|
|
61
|
+
<span className="h-2.5 w-2.5 flex-none rounded-full border border-fg-24" style={{ background: l.color }} aria-hidden="true" />
|
|
62
|
+
<span className="kol-mono-12 truncate">{l.label}</span>
|
|
63
|
+
</span>
|
|
64
|
+
))}
|
|
65
|
+
</div>
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
+
import { createPortal } from 'react-dom'
|
|
3
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
2
4
|
import { MenuCtx, useAsk, glyph } from '../molecules/AppItem.jsx'
|
|
3
5
|
import ContextMenu, { useContextMenu } from '../molecules/ContextMenu.jsx'
|
|
4
6
|
import { MenuDropdownItem } from '../molecules/MenuItem.jsx'
|
|
7
|
+
import ActionButton from '../molecules/ActionButton.jsx'
|
|
5
8
|
import Tag from '../atoms/Tag.jsx'
|
|
6
9
|
import Input from '../atoms/Input.jsx'
|
|
7
10
|
import Textarea from '../atoms/Textarea.jsx'
|
|
@@ -9,8 +12,9 @@ import IconFrame from '../atoms/IconFrame.jsx'
|
|
|
9
12
|
import Button from '../atoms/Button.jsx'
|
|
10
13
|
import { Tooltip } from '../utilities/Popover.jsx'
|
|
11
14
|
import { pickImage } from '../utilities/imageToDataUrl.js'
|
|
12
|
-
import SettingsPanel, { SettingsFooter } from './SettingsPanel.jsx'
|
|
15
|
+
import SettingsPanel, { SettingsFooter, LabeledControlSection } from './SettingsPanel.jsx'
|
|
13
16
|
import SettingsSections from './SettingsSections.jsx'
|
|
17
|
+
import { MediaInspector } from './MediaLibraryPages.jsx'
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* AppItemMenuProvider — One menu and one file rail. the page's ONE right-click menu and ONE file
|
|
@@ -34,14 +38,118 @@ import SettingsSections from './SettingsSections.jsx'
|
|
|
34
38
|
* *"why is edit 32px icon when others are 26px??"*): Details opens with the card's own Date and Size; in edit mode a
|
|
35
39
|
* Cover row offers Upload image — the DS picker, a webp data URL, handed to the file's `onCover(src)` (HubHome's
|
|
36
40
|
* `onCover(file, src)`); and the pencil is the rows' `sm` frame (26), as the × beside it.
|
|
41
|
+
*
|
|
42
|
+
* FILES (FileRailImages, kol-monitor 2026-10-24 — user: *"it should show images associated with file … literally the
|
|
43
|
+
* files that you could click and view with quicklook (like media) and you can remove them and upload new … You would
|
|
44
|
+
* rather click/select which file or files go to thumbnail"*): a file that carries `images` `[{ id, src, label? }]` gets
|
|
45
|
+
* a FILES section between the fields and Details — the images as square thumbnails, two across; a click opens them in
|
|
46
|
+
* `MediaInspector`, the quicklook apps/media uses. Edit mode adds × on each and an Upload tile (the DS picker), both
|
|
47
|
+
* writing `onImages(next)` — the WHOLE list, the rail naming a new image's id, so the consumer stores it and reads
|
|
48
|
+
* nothing back (the item is a snapshot; add / remove by id would have the consumer's handler closing over a stale
|
|
49
|
+
* file) — and the cover is PICKED, not uploaded: Cover and Back on each caption (`onCover(src)` · `onBack(src)`, the
|
|
50
|
+
* picked image's src — one argument type, the one `onCover` always took; `null` when the image that was it is removed),
|
|
51
|
+
* the marks reading which image is which from the card's own `media` and `back`. With `images`, the Cover row's Upload
|
|
52
|
+
* image goes (the tile is the upload); without `images`, the rail is as it was. Storage is the consumer's.
|
|
53
|
+
* THE PENCIL IS A FOOT VERB (same ticket: *"the edit icon should move to the bottom row next to download duplicate and
|
|
54
|
+
* trash icons"*): it leads the foot row's verbs; the header keeps only the ×.
|
|
37
55
|
*/
|
|
56
|
+
/* the quicklook's file shape over an image: a key with the right extension (the inspector reads the kind off it),
|
|
57
|
+
* the label as its name, the mime from a data URL when there is one */
|
|
58
|
+
const extOfSrc = (src = '') => {
|
|
59
|
+
const m = /^data:image\/([a-z0-9+.-]+)/i.exec(src)
|
|
60
|
+
if (m) return m[1] === 'svg+xml' ? 'svg' : m[1]
|
|
61
|
+
const base = src.split(/[?#]/)[0].split('/').pop() ?? ''
|
|
62
|
+
const dot = base.lastIndexOf('.')
|
|
63
|
+
return dot > 0 ? base.slice(dot + 1).toLowerCase() : 'png'
|
|
64
|
+
}
|
|
65
|
+
const EMPTY_KEYS = new Set()
|
|
66
|
+
|
|
67
|
+
/* the FILES section — thumbnails, quicklook, and in edit mode remove · upload · the Cover and Back picks */
|
|
68
|
+
function FileImages({ images, cover, back, editing, onImages, onCover, onBack }) {
|
|
69
|
+
const [look, setLook] = useState(null)
|
|
70
|
+
/* DRAFTS, as the tags and the note keep theirs: the item is a snapshot taken when the rail opened, so the list, the
|
|
71
|
+
* cover and the back the rail shows are its own until the next open; every change is written out the same moment */
|
|
72
|
+
const [draft, setDraft] = useState(images)
|
|
73
|
+
const [dCover, setDCover] = useState(cover)
|
|
74
|
+
const [dBack, setDBack] = useState(back)
|
|
75
|
+
const files = draft.map((img, i) => ({ key: `${img.id}.${extOfSrc(img.src)}`, displayName: img.label ?? `Image ${i + 1}`, contentType: `image/${extOfSrc(img.src) === 'svg' ? 'svg+xml' : extOfSrc(img.src)}` }))
|
|
76
|
+
const srcOf = Object.fromEntries(draft.map((img, i) => [files[i].key, img.src]))
|
|
77
|
+
const canEdit = editing && !!onImages
|
|
78
|
+
if (!draft.length && !canEdit) return null
|
|
79
|
+
const step = (d) => setLook((i) => (i + d + draft.length) % draft.length)
|
|
80
|
+
const setImages = (next) => { setDraft(next); onImages(next) }
|
|
81
|
+
const pickCover = (src) => { setDCover(src); onCover?.(src) }
|
|
82
|
+
const pickBack = (src) => { setDBack(src); onBack?.(src) }
|
|
83
|
+
/* a removed image that was the cover or the back clears it — `null` to the consumer, the placeholder on the card */
|
|
84
|
+
const remove = (img) => {
|
|
85
|
+
setImages(draft.filter((x) => x.id !== img.id))
|
|
86
|
+
if (dCover === img.src) pickCover(null)
|
|
87
|
+
if (dBack === img.src) pickBack(null)
|
|
88
|
+
}
|
|
89
|
+
const add = async () => { const src = await pickImage(); if (src) setImages([...draft, { id: `img-${Date.now().toString(36)}`, src, label: `Image ${draft.length + 1}` }]) }
|
|
90
|
+
return (
|
|
91
|
+
<>
|
|
92
|
+
<div className="grid grid-cols-2 gap-3">
|
|
93
|
+
{draft.map((img, i) => {
|
|
94
|
+
const isCover = !!dCover && img.src === dCover
|
|
95
|
+
const isBack = !!dBack && img.src === dBack
|
|
96
|
+
const label = img.label ?? `Image ${i + 1}`
|
|
97
|
+
const role = [isCover && 'Cover', isBack && 'Back'].filter(Boolean).join(', ')
|
|
98
|
+
return (
|
|
99
|
+
<figure key={img.id} className="flex min-w-0 flex-col gap-1.5">
|
|
100
|
+
<div className="relative">
|
|
101
|
+
<button type="button" className="block aspect-square w-full overflow-hidden rounded-[var(--kol-radius-sm)] bg-fg-04" onClick={() => setLook(i)} aria-label={`Open ${label}`}>
|
|
102
|
+
<img src={img.src} alt="" className="size-full object-cover" style={{ objectPosition: 'var(--kol-media-focus, center)' }} />
|
|
103
|
+
</button>
|
|
104
|
+
{/* the × in the card's own media-corner chrome (the download's plate), so it reads on a dark picture —
|
|
105
|
+
* a bare xs glyph vanished on the rack screenshots */}
|
|
106
|
+
{canEdit && (
|
|
107
|
+
<div className="kol-frame-control">
|
|
108
|
+
<ActionButton chrome="media" icon="x" confirmIcon="x" label={`Remove ${label}`} onAction={() => remove(img)} />
|
|
109
|
+
</div>
|
|
110
|
+
)}
|
|
111
|
+
</div>
|
|
112
|
+
<figcaption className="kol-mono-12 flex items-center justify-between gap-2">
|
|
113
|
+
<span className="truncate text-body">{label}</span>
|
|
114
|
+
{editing && (onCover || onBack) ? (
|
|
115
|
+
<span className="flex shrink-0 gap-1">
|
|
116
|
+
{onCover && <Button size="xs" tone="grey" pressed={isCover} onClick={() => pickCover(img.src)} aria-label={`Use ${label} as cover`}>Cover</Button>}
|
|
117
|
+
{onBack && <Button size="xs" tone="grey" pressed={isBack} onClick={() => pickBack(img.src)} aria-label={`Use ${label} as back`}>Back</Button>}
|
|
118
|
+
</span>
|
|
119
|
+
) : role ? <span className="shrink-0 text-meta">{role}</span> : null}
|
|
120
|
+
</figcaption>
|
|
121
|
+
</figure>
|
|
122
|
+
)
|
|
123
|
+
})}
|
|
124
|
+
{canEdit && (
|
|
125
|
+
<figure className="flex min-w-0 flex-col gap-1.5">
|
|
126
|
+
<button type="button" onClick={add} aria-label="Upload image"
|
|
127
|
+
className="flex aspect-square w-full items-center justify-center rounded-[var(--kol-radius-sm)] border border-dashed border-[var(--kol-fg-24)] bg-[var(--kol-fg-02)] text-fg-48">
|
|
128
|
+
<Icon name="plus" size={20} />
|
|
129
|
+
</button>
|
|
130
|
+
<figcaption className="kol-mono-12 text-meta">Upload image</figcaption>
|
|
131
|
+
</figure>
|
|
132
|
+
)}
|
|
133
|
+
</div>
|
|
134
|
+
{/* PORTALLED to the body: the rail slides in on a transform, which makes it the containing block of any fixed
|
|
135
|
+
* descendant — rendered in place, the quicklook's full-screen overlay was clipped to the rail's 380 column */}
|
|
136
|
+
{look != null && draft[look] && createPortal(
|
|
137
|
+
<MediaInspector files={files} index={look} onClose={() => setLook(null)} onPrev={() => step(-1)} onNext={() => step(1)}
|
|
138
|
+
mediaUrl={(k) => srcOf[k]} downloadUrl={(k) => srcOf[k]} keySet={EMPTY_KEYS} showNav={draft.length > 1} />,
|
|
139
|
+
document.body,
|
|
140
|
+
)}
|
|
141
|
+
</>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
38
145
|
/* the rail's body — READ MODE by default, the header's pencil opens EDIT MODE (user 2026-10-23: *"use the same edit icon
|
|
39
146
|
* from create? to edit mode or read mode?"*): read shows the name, the tag chips and the note as text; edit swaps in the
|
|
40
147
|
* Input, the chips with × over the add-a-tag Input, and the note's Textarea. Drafts are the rail's own, so what you typed
|
|
41
148
|
* stays while the consumer's state catches up. ONE row per field, no section label over a lone row of the same name
|
|
42
149
|
* (user 2026-10-23: the rail read NAME / NAME, TAGS / TAGS / ADD). */
|
|
43
150
|
function FileRailBody({ item, editing, onRenamed }) {
|
|
44
|
-
const { name, verbs, tags, details, note, onTags, onNote, mark, date, size, onCover } = item
|
|
151
|
+
const { name, verbs, tags, details, note, onTags, onNote, mark, date, size, onCover, images, cover, back, onImages, onBack } = item
|
|
152
|
+
const hasImages = Array.isArray(images)
|
|
45
153
|
const [draftName, setDraftName] = useState(name ?? '')
|
|
46
154
|
const [draftTags, setDraftTags] = useState(tags ?? [])
|
|
47
155
|
const [newTag, setNewTag] = useState('')
|
|
@@ -87,13 +195,13 @@ function FileRailBody({ item, editing, onRenamed }) {
|
|
|
87
195
|
...((editNote || draftNote.trim()) ? [editNote
|
|
88
196
|
? { label: 'Note', align: 'fill', render: () => <Textarea size="sm" rows={3} value={draftNote} onChange={(e) => setDraftNote(e.target.value)} onBlur={commitNote} placeholder="Add a note" aria-label="Note" /> }
|
|
89
197
|
: { label: 'Note', text: true, value: text(draftNote.trim(), 'text-right') }] : []),
|
|
90
|
-
/* edit mode
|
|
91
|
-
|
|
198
|
+
/* edit mode, a file with no `images`: the cover — Upload image hands the DS picker's data URL to `onCover`
|
|
199
|
+
* (2026-10-24); with `images` the Files section's tile is the upload and the cover is a pick */
|
|
200
|
+
...((editing && onCover && !hasImages) ? [{ label: 'Cover', align: 'fill', render: () => (
|
|
92
201
|
<Button size="sm" tone="grey" onClick={async () => { const src = await pickImage(); if (src) onCover(src) }}>Upload image</Button>
|
|
93
202
|
) }] : []),
|
|
94
203
|
]
|
|
95
|
-
const
|
|
96
|
-
{ rows },
|
|
204
|
+
const detailSections = [
|
|
97
205
|
...((date || size || mark || details?.length) ? [{ label: 'Details', rows: [
|
|
98
206
|
/* the card's own date and size first (user 2026-10-24) */
|
|
99
207
|
...(date ? [{ label: 'Date', text: true, value: text(date) }] : []),
|
|
@@ -103,18 +211,28 @@ function FileRailBody({ item, editing, onRenamed }) {
|
|
|
103
211
|
...(details ?? []).map(({ label, value }) => ({ label, text: true, value: text(value) })),
|
|
104
212
|
] }] : []),
|
|
105
213
|
]
|
|
106
|
-
|
|
214
|
+
/* the fields, then FILES (a file with `images`), then Details — one stack, the sections' gap and hairlines */
|
|
215
|
+
const filesNode = hasImages ? <FileImages images={images} cover={cover} back={back} editing={editing} onImages={onImages} onCover={onCover} onBack={onBack} /> : null
|
|
216
|
+
return (
|
|
217
|
+
<div className="flex flex-col gap-6">
|
|
218
|
+
<SettingsSections sections={[{ rows }]} divided />
|
|
219
|
+
{filesNode && <LabeledControlSection label="Files" divided>{filesNode}</LabeledControlSection>}
|
|
220
|
+
{detailSections.length > 0 && <SettingsSections sections={detailSections} divided />}
|
|
221
|
+
</div>
|
|
222
|
+
)
|
|
107
223
|
}
|
|
108
224
|
|
|
109
|
-
/* the foot: SettingsFooter's row,
|
|
110
|
-
|
|
225
|
+
/* the foot: SettingsFooter's row — the pencil (edit · done) leading download, duplicate and delete, four icon buttons in
|
|
226
|
+
* reset's control (the pencil moved here from the header line, FileRailImages 2026-10-24) */
|
|
227
|
+
function fileRailFoot(item, ask, onClose, edit) {
|
|
111
228
|
const { name, verbs, download } = item
|
|
112
|
-
if (!(download || verbs?.duplicate || verbs?.remove)) return undefined
|
|
229
|
+
if (!(edit || download || verbs?.duplicate || verbs?.remove)) return undefined
|
|
113
230
|
const verb = (icon, label, onClick) => (
|
|
114
231
|
<Tooltip label={label}><IconFrame name={icon} variant="nav" size="sm" onClick={onClick} aria-label={label} /></Tooltip>
|
|
115
232
|
)
|
|
116
233
|
return (
|
|
117
234
|
<SettingsFooter>
|
|
235
|
+
{edit && verb('edit', edit.editing ? 'Done editing' : 'Edit', edit.toggle)}
|
|
118
236
|
{download && verb('download', 'Download', download)}
|
|
119
237
|
{verbs?.duplicate && verb('copy', 'Duplicate', verbs.duplicate)}
|
|
120
238
|
{verbs?.remove && verb('trash', 'Delete', async () => { if (await ask.remove(name, verbs)) onClose() })}
|
|
@@ -129,7 +247,7 @@ export default function AppItemMenuProvider({ children }) {
|
|
|
129
247
|
const [info, setInfo] = useState(null)
|
|
130
248
|
const [editing, setEditing] = useState(false)
|
|
131
249
|
const close = () => setInfo(null)
|
|
132
|
-
const editable = !!(info?.verbs?.rename || info?.onTags || info?.onNote || info?.onCover)
|
|
250
|
+
const editable = !!(info?.verbs?.rename || info?.onTags || info?.onNote || info?.onCover || info?.onImages || info?.onBack)
|
|
133
251
|
return (
|
|
134
252
|
/* each open is stamped, so the rail keeps its drafts across a rename (the key no longer follows the name) and the
|
|
135
253
|
* foot's Delete confirm names the file as renamed, not as opened */
|
|
@@ -146,10 +264,10 @@ export default function AppItemMenuProvider({ children }) {
|
|
|
146
264
|
)}
|
|
147
265
|
</ContextMenu>
|
|
148
266
|
<SettingsPanel
|
|
149
|
-
open={!!info} variant="rail" title="File" onClose={close}
|
|
150
|
-
/* the pencil
|
|
151
|
-
*
|
|
152
|
-
|
|
267
|
+
open={!!info} variant="rail" title="File" onClose={close}
|
|
268
|
+
/* the pencil leads the foot row (FileRailImages 2026-10-24) — bare, the rows' `sm` frame (26), as the other verbs;
|
|
269
|
+
* the header keeps only the × */
|
|
270
|
+
footer={info ? fileRailFoot(info, ask, close, editable ? { editing, toggle: () => setEditing((v) => !v) } : null) : undefined}
|
|
153
271
|
>
|
|
154
272
|
{/* `key` resets the drafts per file */}
|
|
155
273
|
{info && <FileRailBody key={info.openId} item={info} editing={editing} onRenamed={(name) => setInfo((i) => i && { ...i, name })} />}
|
|
@@ -24,6 +24,13 @@ import useDragResize from '../hooks/useDragResize.js'
|
|
|
24
24
|
* and no `pages` (Home) renders as a plain link row — it has nothing to
|
|
25
25
|
* disclose.
|
|
26
26
|
*
|
|
27
|
+
* THE FOLDERNOTE (user 2026-10-24, site-hub: "make a prop so you can choose if
|
|
28
|
+
* you want to make the category a clickable page. this is how its set in
|
|
29
|
+
* kol-branding"): a category with `to` AND `pages` is a page of its own — its
|
|
30
|
+
* row is a link that opens the page and discloses the pages under it; the
|
|
31
|
+
* caret alone toggles the disclosure without navigating. Lit by its own route
|
|
32
|
+
* or any page beneath. No `to` = the disclosure button it always was.
|
|
33
|
+
*
|
|
27
34
|
* The 2026-08-01 "TWO LEVELS ONLY" ruling was the BRAND APP's, about its
|
|
28
35
|
* scroll-spied `#anchor` section layer — that layer stays dead (an `{ id }`
|
|
29
36
|
* leaf is dropped). It was inscribed here as a law for every consumer, and
|
|
@@ -107,9 +114,12 @@ import useDragResize from '../hooks/useDragResize.js'
|
|
|
107
114
|
* `themeToggle` `false` drops the theme slot (default `true`)
|
|
108
115
|
* `iconComponent` the hop glyph's renderer, kol-shell's seam — `(props:
|
|
109
116
|
* { name, size }) => element`; default the DS `Icon`
|
|
110
|
-
* `expandOnSelect` `
|
|
111
|
-
*
|
|
112
|
-
*
|
|
117
|
+
* `expandOnSelect` `true` expands the rail when a row navigates, dispatches
|
|
118
|
+
* or discloses from the collapsed state. Default `false`
|
|
119
|
+
* (user 2026-10-24: "dont auto expand rail when you click an
|
|
120
|
+
* icon when its collapsed" — reversing the 2026-08-09 brand
|
|
121
|
+
* ruling "pressing any icon would expand the sidebar"): a
|
|
122
|
+
* collapsed rail stays collapsed, the press does its job
|
|
113
123
|
* `defaultCollapsed` boots collapsed when nothing is stored (useDragResize)
|
|
114
124
|
* `background` (2026-08-09, prop): `true` (default) paints the rail surface;
|
|
115
125
|
* `false` renders chromeless so the rail can float over a consumer's media
|
|
@@ -119,12 +129,13 @@ import useDragResize from '../hooks/useDragResize.js'
|
|
|
119
129
|
*/
|
|
120
130
|
|
|
121
131
|
const pageBase =
|
|
122
|
-
'kol-sidenav-link kol-helper-10 block relative py-[4px] pl-
|
|
132
|
+
'kol-sidenav-link kol-helper-10 block relative py-[4px] pl-[calc(var(--kol-pad-chrome-x)+2rem)] pr-6 no-underline transition-colors duration-150'
|
|
123
133
|
|
|
124
134
|
/* The active-dot pseudo-element is positioned by `--kol-sidenav-dot-left`
|
|
125
|
-
* (kol-components-atoms.css). The page row indents
|
|
126
|
-
*
|
|
127
|
-
|
|
135
|
+
* (kol-components-atoms.css). The page row indents one step past the chrome inset
|
|
136
|
+
* (`--kol-pad-chrome-x` + the icon column + the gap, 2026-10-24 — it was a literal
|
|
137
|
+
* 3.5rem); the dot sits 0.875rem inside that, in the gutter the icon column leaves. */
|
|
138
|
+
const pageStyle = { '--kol-sidenav-dot-left': 'calc(var(--kol-pad-chrome-x) + 1.125rem)' }
|
|
128
139
|
/* Category and page must not share a stop: category `emphasis`, page `strong`
|
|
129
140
|
* — two rungs of one ladder, so the tree reads as hierarchy (elder ruling). */
|
|
130
141
|
const pageCls = `${pageBase} text-strong hover:text-emphasis`
|
|
@@ -140,7 +151,18 @@ const leavesOf = (rows) => rows.flatMap((r) => (r.children ? leavesOf(rowsOf(r.c
|
|
|
140
151
|
/* A nested row sits one --kol-spacing-3 step further in per depth. Inline,
|
|
141
152
|
* not a rule: `pl-14` rides the leaf as a utility and outranks anything in
|
|
142
153
|
* this layer. Depth 0 carries no indent so a flat tree renders unchanged. */
|
|
143
|
-
const indentOf = (depth) => `calc(
|
|
154
|
+
const indentOf = (depth) => `calc(var(--kol-pad-chrome-x) + 2rem + ${depth} * var(--kol-spacing-3))`
|
|
155
|
+
|
|
156
|
+
/* the route leaf is always an `<a href>` handing the route to `onNavigate(event, to)` — the
|
|
157
|
+
* router lives in the consumer (kol-framework's `SideNav` wraps this with react-router). A
|
|
158
|
+
* modified click (cmd, ctrl, shift, middle) is left to the browser, as a NavLink left it.
|
|
159
|
+
* Hoisted out of the component so its identity is stable across renders (see `leafProps`). */
|
|
160
|
+
function RouteLeaf({ to, href, active, onNavigate, className, style, children, onPress }) {
|
|
161
|
+
return (
|
|
162
|
+
<a href={href} style={style} className={className(active)} aria-current={active ? 'page' : undefined}
|
|
163
|
+
onClick={(e) => { if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) return; e.preventDefault(); onPress?.(); onNavigate(e, to) }}>{children}</a>
|
|
164
|
+
)
|
|
165
|
+
}
|
|
144
166
|
|
|
145
167
|
export default function NavRailSite({
|
|
146
168
|
currentPath: pathname = '',
|
|
@@ -164,7 +186,7 @@ export default function NavRailSite({
|
|
|
164
186
|
footer,
|
|
165
187
|
themeToggle = true,
|
|
166
188
|
iconComponent,
|
|
167
|
-
expandOnSelect =
|
|
189
|
+
expandOnSelect = false,
|
|
168
190
|
defaultCollapsed = false,
|
|
169
191
|
}) {
|
|
170
192
|
const Glyph = iconComponent ?? Icon
|
|
@@ -190,16 +212,11 @@ export default function NavRailSite({
|
|
|
190
212
|
setOpenPanel(null)
|
|
191
213
|
if (collapsed && expandOnSelect) toggleCollapsed()
|
|
192
214
|
}
|
|
193
|
-
/*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return (
|
|
199
|
-
<a href={hrefFor ? hrefFor(to) : to} style={style} className={className(active)} aria-current={active ? 'page' : undefined}
|
|
200
|
-
onClick={(e) => { if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) return; e.preventDefault(); handleNavigate(e, to) }}>{children}</a>
|
|
201
|
-
)
|
|
202
|
-
}
|
|
215
|
+
/* what a route leaf needs from this render — `RouteLeaf` itself is hoisted above the component
|
|
216
|
+
* (2026-10-24): declared in here it was a NEW component type every render, so React threw every
|
|
217
|
+
* row's DOM away and rebuilt it on each toggle, disclosure or route — the rail flashed and lost
|
|
218
|
+
* hover and focus on the collapse. */
|
|
219
|
+
const leafProps = (to) => ({ to, href: hrefFor ? hrefFor(to) : to, active: isPageActive(to), onNavigate: handleNavigate })
|
|
203
220
|
|
|
204
221
|
/* Which categories are disclosed. INDEPENDENT per category (elder ruling
|
|
205
222
|
* 2026-08-01) — arriving somewhere must not silently close wherever you
|
|
@@ -249,11 +266,14 @@ export default function NavRailSite({
|
|
|
249
266
|
* up the way a category does — when one of its leaves is the current route. */
|
|
250
267
|
const renderRows = (rows, depth) => rows.map((row, i) => {
|
|
251
268
|
if (row.children) {
|
|
252
|
-
const lit = leavesOf(rowsOf(row.children)).some(isLeafActive)
|
|
253
269
|
return (
|
|
254
270
|
<li key={row.id ?? `${row.label}-${i}`}>
|
|
255
271
|
<div
|
|
256
|
-
|
|
272
|
+
/* UPPERCASE (user 2026-10-24, the another-creation reference: "look at uppercase sections") — the fork's
|
|
273
|
+
* `uppercase` utility returns, as the reference carries it; the group is a section label in the rows' voice.
|
|
274
|
+
* ONE INK (user 2026-10-24: "just keep them same opacity"): the label never lights — the row's dot says
|
|
275
|
+
* which row is active, and a label that brightened said it twice. */
|
|
276
|
+
className="kol-sidenav-group kol-helper-10 uppercase text-subtle"
|
|
257
277
|
style={depth ? { paddingLeft: indentOf(depth) } : undefined}
|
|
258
278
|
>
|
|
259
279
|
{row.label}
|
|
@@ -263,7 +283,9 @@ export default function NavRailSite({
|
|
|
263
283
|
)
|
|
264
284
|
}
|
|
265
285
|
/* the dot keeps its 0.875rem lead on the text at every depth */
|
|
266
|
-
|
|
286
|
+
/* a row under a group sits 2px further in than the step, dot and text together, so the dot's edge lines up under
|
|
287
|
+
* the group label's first letter (user 2026-10-24: "just indent the dot+text by 2px to right") */
|
|
288
|
+
const leafStyle = depth ? { paddingLeft: `calc(${indentOf(depth)} + 2px)`, '--kol-sidenav-dot-left': `calc(var(--kol-pad-chrome-x) + 1.125rem + 2px + ${depth} * var(--kol-spacing-3))` } : pageStyle
|
|
267
289
|
if (row.onSelect) {
|
|
268
290
|
return (
|
|
269
291
|
<li key={row.id ?? `${row.label}-${i}`}>
|
|
@@ -281,7 +303,7 @@ export default function NavRailSite({
|
|
|
281
303
|
}
|
|
282
304
|
return (
|
|
283
305
|
<li key={row.to}>
|
|
284
|
-
<RouteLeaf
|
|
306
|
+
<RouteLeaf {...leafProps(row.to)} style={leafStyle} className={(active) => (active ? pageActiveCls : pageCls)}>
|
|
285
307
|
{row.label}
|
|
286
308
|
</RouteLeaf>
|
|
287
309
|
</li>
|
|
@@ -293,6 +315,8 @@ export default function NavRailSite({
|
|
|
293
315
|
const pages = pagesOf(cat)
|
|
294
316
|
const isOpen = openCats.has(cat.id)
|
|
295
317
|
const isLink = !pages.length && cat.to
|
|
318
|
+
/* the FOLDERNOTE: a category that is a page of its own (`to` with `pages`) */
|
|
319
|
+
const isFolder = pages.length > 0 && !!cat.to
|
|
296
320
|
const isPanel = !pages.length && !cat.to && !!cat.panel
|
|
297
321
|
const isAction = !pages.length && !cat.to && !isPanel && cat.onSelect
|
|
298
322
|
/* THE COLLAPSE RULE: no icon, no route, no action = a LABEL over
|
|
@@ -318,8 +342,28 @@ export default function NavRailSite({
|
|
|
318
342
|
/* A category is a <button>, not a link — it has no route by
|
|
319
343
|
definition, and an <a href> would promise a page that does
|
|
320
344
|
not exist. Clicking it discloses its pages. */
|
|
321
|
-
const head =
|
|
322
|
-
|
|
345
|
+
const head = isFolder ? (
|
|
346
|
+
/* the row opens the page and discloses; the caret beside it (a sibling — a button cannot sit
|
|
347
|
+
* inside a link) toggles the disclosure alone */
|
|
348
|
+
<>
|
|
349
|
+
<RouteLeaf {...leafProps(cat.to)} onPress={() => discloseCat(cat.id)} className={(active) => `${rowCls}${(active || isActiveCat(cat)) ? ' is-active' : ''}`}>
|
|
350
|
+
{glyph}
|
|
351
|
+
<span className="kol-sidenav-hop-label flex-1 min-w-0">{cat.label}</span>
|
|
352
|
+
</RouteLeaf>
|
|
353
|
+
<button
|
|
354
|
+
type="button"
|
|
355
|
+
/* no display utility on the caret — it would outrank the collapsed rule's display:none (the 2026-08-09 defect; the
|
|
356
|
+
* box lives in .kol-sidenav-hop-caret, kol-framework.css) */
|
|
357
|
+
className={`kol-sidenav-hop-caret bg-transparent border-0 cursor-pointer p-0 text-emphasis${isOpen ? '' : ' -rotate-90'}`}
|
|
358
|
+
aria-expanded={isOpen}
|
|
359
|
+
aria-label={isOpen ? `Collapse ${cat.label}` : `Expand ${cat.label}`}
|
|
360
|
+
onClick={() => (collapsed ? (expandOnSelect && toggleCollapsed(), discloseCat(cat.id)) : toggleCat(cat.id))}
|
|
361
|
+
>
|
|
362
|
+
<Icon name="chevron-down" size={12} />
|
|
363
|
+
</button>
|
|
364
|
+
</>
|
|
365
|
+
) : isLink ? (
|
|
366
|
+
<RouteLeaf {...leafProps(cat.to)} className={(active) => `${rowCls}${active ? ' is-active' : ''}`}>
|
|
323
367
|
{glyph}
|
|
324
368
|
<span className="kol-sidenav-hop-label flex-1 min-w-0">{cat.label}</span>
|
|
325
369
|
</RouteLeaf>
|
|
@@ -354,7 +398,7 @@ export default function NavRailSite({
|
|
|
354
398
|
* an expand that lands on a closed tree. */
|
|
355
399
|
onClick={() => {
|
|
356
400
|
if (collapsed) {
|
|
357
|
-
toggleCollapsed()
|
|
401
|
+
if (expandOnSelect) toggleCollapsed()
|
|
358
402
|
discloseCat(cat.id)
|
|
359
403
|
} else {
|
|
360
404
|
toggleCat(cat.id)
|
|
@@ -366,7 +410,7 @@ export default function NavRailSite({
|
|
|
366
410
|
{/* plain wrapper span — Icon stamps inline-flex on its own
|
|
367
411
|
* element, which would outrank the rail's display:none */}
|
|
368
412
|
<span
|
|
369
|
-
className={`kol-sidenav-hop-caret
|
|
413
|
+
className={`kol-sidenav-hop-caret${isOpen ? '' : ' -rotate-90'}`}
|
|
370
414
|
aria-hidden="true"
|
|
371
415
|
>
|
|
372
416
|
<Icon name="chevron-down" size={12} />
|
|
@@ -377,11 +421,12 @@ export default function NavRailSite({
|
|
|
377
421
|
<li key={cat.id} className="relative">
|
|
378
422
|
{/* Collapsed rail hides the label — the tooltip is the only
|
|
379
423
|
thing naming the row. Portalled, so overflow can't clip it. */}
|
|
380
|
-
{
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
424
|
+
{/* ONE TREE IN BOTH STATES (2026-10-24, the clip model): the Tooltip wraps the row expanded too,
|
|
425
|
+
disabled — wrapping only when collapsed rebuilt every row on the toggle, losing hover and
|
|
426
|
+
focus and flashing the rail. Portalled, so overflow can't clip it. */}
|
|
427
|
+
<Tooltip label={cat.label} placement="right" triggerClassName="block" disabled={!collapsed}>
|
|
428
|
+
{head}
|
|
429
|
+
</Tooltip>
|
|
385
430
|
|
|
386
431
|
{!isLink && !isAction && !isPanel && isOpen && (
|
|
387
432
|
<ul className="kol-sidenav-list">{renderRows(pages, 0)}</ul>
|
|
@@ -420,8 +465,8 @@ export default function NavRailSite({
|
|
|
420
465
|
</nav>
|
|
421
466
|
</div>
|
|
422
467
|
|
|
423
|
-
{/*
|
|
424
|
-
|
|
468
|
+
{/* the theme slot holds a TREE ROW (kol-framework's SideNav passes `ThemeToggle variant="row"`,
|
|
469
|
+
2026-10-24): it wears .kol-sidenav-hop and follows the collapse as the rows do. */}
|
|
425
470
|
<div className="pb-4">
|
|
426
471
|
{/* the theme slot is the consumer's: kol-component cannot import kol-framework's
|
|
427
472
|
* toggle, so `themeToggle` is a render function `({ collapsed }) => node` (kol-framework's
|
|
@@ -45,6 +45,13 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
45
45
|
* @param {Function} onClose × · scrim · Escape
|
|
46
46
|
* @param {ReactNode} footer the foot slot — `SettingsFooter` is the default shape
|
|
47
47
|
* @param {ReactNode} headerActions controls on the header line, before the × (the file rail's edit pencil, 2026-10-23)
|
|
48
|
+
* @param {boolean} backdrop the rail's scrim (default true — the app's Settings tier dims and locks the page). `false`
|
|
49
|
+
* is the Rail's own: the panel alone, no scrim, no scroll lock, no focus trap — a PAGE-LEVEL rail
|
|
50
|
+
* over a live page, the bottom rail's setup (SettingsPanelBackdrop, kol-monitor 2026-10-24: the
|
|
51
|
+
* rack's and the stage's settings open over the running picture and its keys keep working).
|
|
52
|
+
* `rail` only; the overlay keeps its scrim
|
|
53
|
+
* @param {'over'|'push'} mode the Rail's own (default `over`): `over` slides over the page, `push` sits in the layout and
|
|
54
|
+
* pushes it — inline, no scrim, no trap. Forwarded with `backdrop` (same ticket); `rail` only
|
|
48
55
|
* @param {ReactNode} children the sections
|
|
49
56
|
*/
|
|
50
57
|
export default function SettingsPanel({
|
|
@@ -57,6 +64,8 @@ export default function SettingsPanel({
|
|
|
57
64
|
onClose,
|
|
58
65
|
footer,
|
|
59
66
|
headerActions,
|
|
67
|
+
backdrop = true,
|
|
68
|
+
mode = 'over',
|
|
60
69
|
children,
|
|
61
70
|
className = '',
|
|
62
71
|
}) {
|
|
@@ -111,8 +120,10 @@ export default function SettingsPanel({
|
|
|
111
120
|
2026-09-03). `backdrop={false}` stood here from 2026-08-30; the drawer
|
|
112
121
|
paints `bg-surface-primary`, the same token as the page, so the scrim was
|
|
113
122
|
the only thing separating them — with it off the panel was invisible and
|
|
114
|
-
the controls floated in the right third of the screen.
|
|
115
|
-
|
|
123
|
+
the controls floated in the right third of the screen.
|
|
124
|
+
`backdrop` FORWARDS (SettingsPanelBackdrop, kol-monitor 2026-10-24): the default keeps olina's scrim; a page-level
|
|
125
|
+
rail passes `false` and gets the Rail's own no-scrim setup — the page keeps running under it. */
|
|
126
|
+
<Rail open={open} onClose={onClose} side="right" width={width} header={header} className={className} edge={false} shadow={false} closeHover={false} backdrop={backdrop} mode={mode}>
|
|
116
127
|
<div className="flex flex-col gap-4"><Divider />{body}</div>
|
|
117
128
|
</Rail>
|
|
118
129
|
)
|