@kolkrabbi/kol-component 0.298.0 → 0.300.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
CHANGED
|
@@ -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
|
|
@@ -178,6 +189,9 @@ export default function ContentCard({
|
|
|
178
189
|
/* `flip` + `fade` — behaviours, not variants (the print fold, 2026-08-29) */
|
|
179
190
|
flip,
|
|
180
191
|
fade,
|
|
192
|
+
/* `back` + `backReveal` — the second cover and how it shows (AppCardBackCover, 2026-10-24) */
|
|
193
|
+
back,
|
|
194
|
+
backReveal = 'flip-image',
|
|
181
195
|
/* plateRule (CatalogCardFrameAndZoom): the plate's top hairline — default the variant's (catalog and
|
|
182
196
|
* print draw it); `false` turns it off without an `!important` in a consumer sheet */
|
|
183
197
|
plateRule,
|
|
@@ -217,8 +231,8 @@ export default function ContentCard({
|
|
|
217
231
|
/* `app` (CatalogAppVariant, kol-fxr 2026-10-23) is the `file` card with its parts slotted from
|
|
218
232
|
* `verbs`, `download`, `menuItems`, and `tags`, `details`, `onTags` for the info rail — AppItem.jsx.
|
|
219
233
|
* None of them reach ContentText; an app card's `tags` are the rail's, never chips on the plate. */
|
|
220
|
-
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 })
|
|
221
|
-
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
|
|
222
236
|
if (app) {
|
|
223
237
|
delete text.tags
|
|
224
238
|
variantProp = 'file'
|
|
@@ -317,6 +331,17 @@ export default function ContentCard({
|
|
|
317
331
|
* existing consumer is untouched. */
|
|
318
332
|
const noMedia = media === false
|
|
319
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
|
+
|
|
320
345
|
const textNode = hasPlate ? (
|
|
321
346
|
<div
|
|
322
347
|
className="kol-card-plate relative"
|
|
@@ -393,7 +418,16 @@ export default function ContentCard({
|
|
|
393
418
|
* positions against the media box, and there is none */}
|
|
394
419
|
{!noMedia && (
|
|
395
420
|
<div className="relative">
|
|
396
|
-
|
|
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
|
+
)}
|
|
397
431
|
{controlNode}
|
|
398
432
|
{controlStartNode}
|
|
399
433
|
</div>
|
|
@@ -471,6 +505,15 @@ export default function ContentCard({
|
|
|
471
505
|
</>
|
|
472
506
|
)
|
|
473
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
|
+
|
|
474
517
|
/* THE ROOT FOLLOWS THE AFFORDANCE. A card that navigates must be a real <a>:
|
|
475
518
|
* middle-click, cmd-click, focus order, "copy link address" and every screen
|
|
476
519
|
* reader's link list all come from the tag, and none of them can be added
|
|
@@ -491,7 +534,8 @@ export default function ContentCard({
|
|
|
491
534
|
|
|
492
535
|
const common = {
|
|
493
536
|
'data-tags': isHero && Array.isArray(text.tags) && text.tags.length ? text.tags.join(' ') : undefined,
|
|
494
|
-
|
|
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(),
|
|
495
539
|
style: {
|
|
496
540
|
/* same reason as ContentRow: rest colors are PROPERTIES, because an
|
|
497
541
|
* inline background/borderColor outranks the hover class and the step
|
|
@@ -511,7 +555,7 @@ export default function ContentCard({
|
|
|
511
555
|
}
|
|
512
556
|
|
|
513
557
|
if (href) {
|
|
514
|
-
return <a href={href} onClick={nav} {...common}>{
|
|
558
|
+
return <a href={href} onClick={nav} {...common}>{turned}</a>
|
|
515
559
|
}
|
|
516
560
|
if (onClick) {
|
|
517
561
|
return (
|
|
@@ -533,9 +577,9 @@ export default function ContentCard({
|
|
|
533
577
|
}}
|
|
534
578
|
{...common}
|
|
535
579
|
>
|
|
536
|
-
{
|
|
580
|
+
{turned}
|
|
537
581
|
</article>
|
|
538
582
|
)
|
|
539
583
|
}
|
|
540
|
-
return <article {...common}>{
|
|
584
|
+
return <article {...common}>{turned}</article>
|
|
541
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'
|
|
@@ -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 })} />}
|
|
@@ -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
|
)
|
package/src/organisms/Table.jsx
CHANGED
|
@@ -99,7 +99,9 @@ const Table = ({ caption, columns, rows, variant = 'default', className = '', wi
|
|
|
99
99
|
{sorted.map((row, rowIndex) => (
|
|
100
100
|
<tr key={row.id ?? row.token ?? rowIndex} className={`kol-table-row${rowClassName ? ` ${rowClassName(row, rowIndex)}` : ''}`}>
|
|
101
101
|
{columns.map((column) => (
|
|
102
|
-
|
|
102
|
+
/* a column's `wrap: true` is the body cell that wraps (TableWrapTextCell, kol-studio 2026-10-24) — the default
|
|
103
|
+
* class with its `--wrap` modifier; a column naming its own className keeps it */
|
|
104
|
+
<td key={column.accessor} className={(typeof column.className === 'function' ? column.className(row) : column.className) ?? (column.wrap ? 'kol-table-cell-text kol-table-cell-text--wrap' : 'kol-table-cell-text')} style={column.style}>
|
|
103
105
|
{column.render ? column.render(row) : row[column.accessor] ?? '—'}
|
|
104
106
|
</td>
|
|
105
107
|
))}
|