@kolkrabbi/kol-component 0.295.0 → 0.296.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 +4 -4
- package/src/atoms/CloseButton.jsx +24 -4
- package/src/atoms/IconToggle.jsx +1 -1
- package/src/hooks/canvasViewport.js +400 -0
- package/src/hooks/railRow.js +11 -0
- package/src/index.js +9 -4
- package/src/molecules/AppItem.jsx +44 -37
- package/src/molecules/ContentCard.jsx +6 -3
- package/src/molecules/ContentRow.jsx +5 -3
- package/src/molecules/ContentText.jsx +12 -11
- package/src/molecules/LabeledControl.jsx +3 -1
- package/src/molecules/MenuItem.jsx +1 -1
- package/src/molecules/PageHeader.jsx +2 -1
- package/src/molecules/Rail.jsx +5 -3
- package/src/molecules/SectionText.jsx +6 -2
- package/src/molecules/TabsRow.jsx +65 -9
- package/src/molecules/TextFold.jsx +1 -1
- package/src/organisms/AppItemMenuProvider.jsx +144 -0
- package/src/organisms/Canvas.jsx +49 -258
- package/src/organisms/CanvasStudio.jsx +128 -0
- package/src/organisms/CommandOverlay.jsx +7 -5
- package/src/organisms/CurveEditor.jsx +1 -1
- package/src/organisms/MediaGalleryModes.jsx +1 -1
- package/src/organisms/MediaLibrary.jsx +31 -9
- package/src/organisms/MediaLibraryPages.jsx +30 -6
- package/src/organisms/NavRail.jsx +68 -56
- package/src/organisms/SettingsPanel.jsx +16 -9
- package/src/organisms/SettingsSections.jsx +31 -6
|
@@ -44,6 +44,7 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
44
44
|
* @param {string} intro a note under the header (the approved drawer passes none)
|
|
45
45
|
* @param {Function} onClose × · scrim · Escape
|
|
46
46
|
* @param {ReactNode} footer the foot slot — `SettingsFooter` is the default shape
|
|
47
|
+
* @param {ReactNode} headerActions controls on the header line, before the × (the file rail's edit pencil, 2026-10-23)
|
|
47
48
|
* @param {ReactNode} children the sections
|
|
48
49
|
*/
|
|
49
50
|
export default function SettingsPanel({
|
|
@@ -55,11 +56,13 @@ export default function SettingsPanel({
|
|
|
55
56
|
intro,
|
|
56
57
|
onClose,
|
|
57
58
|
footer,
|
|
59
|
+
headerActions,
|
|
58
60
|
children,
|
|
59
61
|
className = '',
|
|
60
62
|
}) {
|
|
61
63
|
const header = (
|
|
62
|
-
<div className="flex min-w-0
|
|
64
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
65
|
+
<div className="flex min-w-0 flex-1 flex-col">
|
|
63
66
|
{/* THE APP REGISTER (SettingsPanelChromeAndColumnPreview, kol-r2b2 2026-08-27 —
|
|
64
67
|
* user: "all wrong font styles"): the collection beside the panel is the
|
|
65
68
|
* reference — helper-14 uppercase titles, the eyebrow for section labels,
|
|
@@ -67,6 +70,8 @@ export default function SettingsPanel({
|
|
|
67
70
|
{title && <span className="kol-helper-14 uppercase text-emphasis">{title}</span>}
|
|
68
71
|
{subtitle && <span className="kol-mono-12 text-meta">{subtitle}</span>}
|
|
69
72
|
</div>
|
|
73
|
+
{headerActions}
|
|
74
|
+
</div>
|
|
70
75
|
)
|
|
71
76
|
const body = (
|
|
72
77
|
<>
|
|
@@ -90,7 +95,7 @@ export default function SettingsPanel({
|
|
|
90
95
|
>
|
|
91
96
|
<div className="mb-6 flex items-center gap-4">
|
|
92
97
|
<div className="min-w-0 flex-1">{header}</div>
|
|
93
|
-
<CloseButton onClick={onClose} className="shrink-0" />
|
|
98
|
+
<CloseButton onClick={onClose} hover={false} className="shrink-0" />
|
|
94
99
|
</div>
|
|
95
100
|
<div className="flex flex-col gap-4"><Divider />{body}</div>
|
|
96
101
|
</div>
|
|
@@ -107,7 +112,7 @@ export default function SettingsPanel({
|
|
|
107
112
|
paints `bg-surface-primary`, the same token as the page, so the scrim was
|
|
108
113
|
the only thing separating them — with it off the panel was invisible and
|
|
109
114
|
the controls floated in the right third of the screen. */
|
|
110
|
-
<Rail open={open} onClose={onClose} side="right" width={width} header={header} className={className} edge={false} shadow={false}>
|
|
115
|
+
<Rail open={open} onClose={onClose} side="right" width={width} header={header} className={className} edge={false} shadow={false} closeHover={false}>
|
|
111
116
|
<div className="flex flex-col gap-4"><Divider />{body}</div>
|
|
112
117
|
</Rail>
|
|
113
118
|
)
|
|
@@ -185,7 +190,7 @@ export function LabeledControlSection({ label, divided = false, rowGap = 2, chil
|
|
|
185
190
|
* falls back to primary — the same render wherever there is no wrapper. */
|
|
186
191
|
export function SettingsChoice({ options = [], value, onChange, ariaLabel, tone = 'default', size = 'sm', variant, className = '' }) {
|
|
187
192
|
const opts = options.map((o) => (o != null && typeof o === 'object' ? o : { value: o, label: String(o) }))
|
|
188
|
-
return <Dropdown size={size} variant={variant} tone={tone} value={value} onChange={onChange} options={opts} className={`w-full ${className}`.trim()}
|
|
193
|
+
return <Dropdown size={size} variant={variant} tone={tone} value={value} onChange={onChange} options={opts} className={`w-full ${className}`.trim()} ariaLabel={ariaLabel} />
|
|
189
194
|
}
|
|
190
195
|
|
|
191
196
|
/* THE CONTROL CHIP (SettingsPanelCompliance, user 2026-08-27: "WROOOONG" on the
|
|
@@ -268,15 +273,17 @@ export function SettingsChipRow({ options = [], selected = [], onToggle, allChip
|
|
|
268
273
|
*
|
|
269
274
|
* `gap-2` on the row (user 2026-08-28): `flex justify-end` with no gap is right
|
|
270
275
|
* for one control and wrong for two — the chip and the reset icon touched. */
|
|
271
|
-
export function SettingsFooter({ onReset, resetLabel = 'Reset to defaults', children }) {
|
|
276
|
+
export function SettingsFooter({ onReset, resetLabel = 'Reset to defaults', resetDisabled = false, children }) {
|
|
272
277
|
return (
|
|
273
278
|
<div className="flex flex-col gap-4">
|
|
274
279
|
<Divider />
|
|
275
|
-
<div className="flex justify-end items-center gap-2">
|
|
280
|
+
<div className="kol-ink-step flex justify-end items-center gap-2">
|
|
276
281
|
{children}
|
|
277
|
-
{
|
|
278
|
-
|
|
279
|
-
|
|
282
|
+
{/* `resetDisabled`: the control stays in its place, dimmed and inert — one footer shape on every rail, whether or
|
|
283
|
+
* not the app has preferences to reset yet (user 2026-10-24: *"standardise what goes in"*) */}
|
|
284
|
+
{(onReset || resetDisabled) && (
|
|
285
|
+
<Tooltip label={resetDisabled ? 'Nothing to reset' : resetLabel}>
|
|
286
|
+
<IconFrame name="refresh" variant="nav" size="sm" onClick={resetDisabled ? undefined : onReset} aria-label={resetLabel} aria-disabled={resetDisabled || undefined} className={resetDisabled ? 'opacity-40 pointer-events-none' : ''} />
|
|
280
287
|
</Tooltip>
|
|
281
288
|
)}
|
|
282
289
|
</div>
|
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
import { LabeledControlSection, SettingsRow } from './SettingsPanel.jsx'
|
|
1
|
+
import { LabeledControlSection, SettingsChoice, SettingsRow, SettingsSwitch } from './SettingsPanel.jsx'
|
|
2
|
+
|
|
3
|
+
/* A STRING VALUE WEARS THE DS'S CLASS (user 2026-10-24, on Mirror's settings rail: *"YOU ARE USING A HELPER text for
|
|
4
|
+
* paragraphs"* — *"THIS SHOULDNT BE POSSIBLE if you were using a preset"*). A consumer that hands rows as data never
|
|
5
|
+
* picks a text class: a plain `value` is drawn in `kol-mono-12 text-body`, the file rail's and the shortcut rows' voice.
|
|
6
|
+
* A node passed as `value` is the consumer's and stays as given. */
|
|
7
|
+
const isText = (v) => typeof v === 'string' || typeof v === 'number'
|
|
8
|
+
const textValue = (v) => <span className="kol-mono-12 text-body">{v}</span>
|
|
9
|
+
/* a section's `note` — a sentence or two under the eyebrow, before the rows (Mirror's Memory, Monitor's Patches): mono-12
|
|
10
|
+
* in the meta ink, the panel's own intro voice. It wraps — the helper law is about helper text, and this is not helper */
|
|
11
|
+
const notes = (note) => (Array.isArray(note) ? note : [note]).map((n, i) => <p key={i} className="kol-mono-12 text-meta">{n}</p>)
|
|
12
|
+
/* the typed controls — the DS's, in the surface's tone; `render` stays the escape hatch for a control the DS has no word for */
|
|
13
|
+
const control = (row) => {
|
|
14
|
+
if (row.type === 'choice') return <SettingsChoice options={row.options ?? []} value={row.value} onChange={row.onChange} ariaLabel={row.ariaLabel ?? (typeof row.label === 'string' ? row.label : undefined)} />
|
|
15
|
+
if (row.type === 'switch') return <SettingsSwitch on={!!row.on} onChange={row.onChange} disabled={row.disabled} disabledHint={row.disabledHint} label={row.ariaLabel ?? (typeof row.label === 'string' ? row.label : undefined)} />
|
|
16
|
+
if (row.render) return row.render()
|
|
17
|
+
return isText(row.value) ? textValue(row.value) : row.value
|
|
18
|
+
}
|
|
19
|
+
/* a typed row's cell: a choice fills the value column, a switch sits at its end, text sits on the baseline */
|
|
20
|
+
const rowAlign = (row, fallback) => row.align ?? (row.type === 'choice' ? 'fill' : fallback)
|
|
2
21
|
|
|
3
22
|
/**
|
|
4
23
|
* SettingsSections — settings rows AS DATA, rendered once.
|
|
@@ -31,11 +50,16 @@ import { LabeledControlSection, SettingsRow } from './SettingsPanel.jsx'
|
|
|
31
50
|
* text (a keyboard combo, a version string), which is what lets the shortcuts
|
|
32
51
|
* sheet and the settings page's shortcut block be the same call.
|
|
33
52
|
*
|
|
53
|
+
* TYPED ROWS (user 2026-10-24, on FXR's rail drawing its own sunken dropdown beside the reference's: *"we are literally
|
|
54
|
+
* avoiding this custom per repo shit"*): a row names its CONTROL as data and this draws it — `{ type: 'choice', options,
|
|
55
|
+
* value, onChange, ariaLabel? }` is a `SettingsChoice`, `{ type: 'switch', on, onChange, disabled?, disabledHint? }` a
|
|
56
|
+
* `SettingsSwitch` — in the surface's tone, never the consumer's. The Hub's rail takes typed rows and refuses `render`.
|
|
57
|
+
*
|
|
34
58
|
* `divided` puts the hairline above a section — pass it on EVERY section, the
|
|
35
59
|
* first included: the rule is `.kol-section--divided + .kol-section--divided`,
|
|
36
60
|
* so the first draws nothing and skipping it just costs the next its line.
|
|
37
61
|
*
|
|
38
|
-
* @param {Array<{label?: string, rows
|
|
62
|
+
* @param {Array<{label?: string, note?: string|string[], rows?: Array<{label: ReactNode, type?: 'choice'|'switch', options?: Array, value?: ReactNode, on?: boolean, onChange?: Function, render?: Function, hint?: string, align?: string, labelWidth?: number|'auto', text?: boolean, id?: string}>, rowGap?: number}>} sections - The settings body, in order (`hint` → SettingsRow's hint; `note` a sentence or two under the eyebrow; a string `value` is drawn in the DS's mono-12 and sits on the baseline; `type: 'choice'` / `'switch'` rows are drawn here)
|
|
39
63
|
* @param {boolean} [divided=false] - Hairline above each section
|
|
40
64
|
* @param {number|'auto'} [labelWidth] - Default label column for every row — `'auto'` makes the label yield and the control hug, which is what a narrow column or a nowrap value needs
|
|
41
65
|
* @param {string} [align] - Default row alignment passed to `SettingsRow`
|
|
@@ -46,16 +70,17 @@ export default function SettingsSections({ sections = [], divided = false, label
|
|
|
46
70
|
<div className={`kol-settings-sections flex flex-col gap-6 ${className}`.trim()}>
|
|
47
71
|
{sections.map((sec, i) => (
|
|
48
72
|
<LabeledControlSection key={sec.label ?? i} label={sec.label} divided={divided} rowGap={sec.rowGap}>
|
|
49
|
-
{sec.
|
|
73
|
+
{sec.note != null && notes(sec.note)}
|
|
74
|
+
{(sec.rows ?? []).map((row, j) => (
|
|
50
75
|
<SettingsRow
|
|
51
76
|
key={row.id ?? row.label ?? j}
|
|
52
77
|
label={row.label}
|
|
53
78
|
hint={row.hint}
|
|
54
|
-
align={row
|
|
79
|
+
align={rowAlign(row, align)}
|
|
55
80
|
labelWidth={row.labelWidth ?? labelWidth}
|
|
56
|
-
text={row.text}
|
|
81
|
+
text={row.text ?? (!row.render && !row.type && isText(row.value))}
|
|
57
82
|
>
|
|
58
|
-
{row
|
|
83
|
+
{control(row)}
|
|
59
84
|
</SettingsRow>
|
|
60
85
|
))}
|
|
61
86
|
</LabeledControlSection>
|