@kolkrabbi/kol-component 0.328.0 → 0.330.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/BezierPathEditor.jsx +171 -0
- package/src/atoms/FunctionPlot.jsx +109 -0
- package/src/atoms/OriginPicker.jsx +111 -0
- package/src/index.js +6 -0
- package/src/molecules/Combobox.jsx +5 -5
- package/src/molecules/ContextMenu.jsx +9 -39
- package/src/molecules/Dropdown.jsx +49 -72
- package/src/molecules/Menu.jsx +77 -38
- package/src/molecules/MenuItem.jsx +51 -53
- package/src/molecules/MultiSelect.jsx +44 -41
- package/src/molecules/ParamBindDot.jsx +79 -0
- package/src/molecules/ShapeDropdown.jsx +5 -5
- package/src/molecules/SplitToolButton.jsx +3 -2
- package/src/molecules/StepList.jsx +34 -8
- package/src/organisms/AppItemMenuProvider.jsx +4 -4
- package/src/organisms/ColorPickerPopover.jsx +7 -1
- package/src/organisms/LayerStack.jsx +7 -7
- package/src/organisms/MediaLibrary.jsx +4 -4
- package/src/organisms/MediaLibraryPages.jsx +46 -46
- package/src/organisms/NavRail.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +3 -6
- package/src/utilities/tone.js +4 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
2
1
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { MenuRow } from './MenuItem.jsx'
|
|
3
|
+
import { Menu } from './Menu.jsx'
|
|
5
4
|
import { indicatorSize } from '../hooks/glyphLadders.js'
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -22,49 +21,53 @@ import { indicatorSize } from '../hooks/glyphLadders.js'
|
|
|
22
21
|
* @param {Function} onChange `(groupId, value) => void`
|
|
23
22
|
* @param {ReactNode} [label] the trigger's text; default is every current value, joined
|
|
24
23
|
* @param {'xs'|'sm'|'md'|'lg'} [size='sm']
|
|
24
|
+
* @param {'start'|'end'} [align='start'] the panel's edge flush with the trigger's
|
|
25
25
|
* @param {string} [className]
|
|
26
26
|
*/
|
|
27
27
|
const SIZE_TYPE = { xs: 'kol-mono-8', sm: 'kol-mono-12', md: 'kol-mono-14', lg: 'kol-mono-16' }
|
|
28
|
+
/* the rows are Dropdown's rows, the same face, padding and height at every size (plan-2026-10-31-menu-engine W1.3 —
|
|
29
|
+
* user: *"mutliple clashing styles in one component — different paddings, alignment off, differnt opacity[ink]"*) */
|
|
30
|
+
const ROW = { xs: 'kol-mono-8 px-1 h-[var(--kol-ctl-xs)]', sm: 'kol-mono-12 px-2 h-[var(--kol-ctl-sm)]', md: 'kol-mono-14 px-3 h-[var(--kol-ctl-md)]', lg: 'kol-mono-16 px-4 h-[var(--kol-ctl-lg)]' }
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
/* `Menu` with columns (W1.3): the trigger is Dropdown's, the panel the menu panel, each column a pick-one list whose
|
|
33
|
+
* current row wears the dot (• for a single pick, W2). The panel opens from the trigger's start edge. */
|
|
34
|
+
export default function MultiSelect({ groups = [], value = {}, onChange, label, size = 'sm', align = 'start', defaultOpen = false, className = '' }) {
|
|
32
35
|
const labelOf = (g) => g.options.find((o) => o.value === value[g.id])?.label ?? value[g.id]
|
|
33
36
|
return (
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{groups.map((
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</
|
|
68
|
-
</
|
|
37
|
+
<Menu
|
|
38
|
+
align={align}
|
|
39
|
+
role="dialog"
|
|
40
|
+
defaultOpen={defaultOpen}
|
|
41
|
+
closeOnSelect={false}
|
|
42
|
+
rootClassName={`relative inline-block align-middle ${className}`.trim()}
|
|
43
|
+
trigger={({ open, props }) => (
|
|
44
|
+
<button
|
|
45
|
+
{...props}
|
|
46
|
+
type="button"
|
|
47
|
+
className={`kol-btn kol-btn-${size} ${SIZE_TYPE[size] ?? SIZE_TYPE.sm} kol-dd-trigger`}
|
|
48
|
+
aria-haspopup="dialog"
|
|
49
|
+
aria-expanded={open}
|
|
50
|
+
data-state={open ? 'open' : 'closed'}
|
|
51
|
+
>
|
|
52
|
+
<span className="kol-dd-label"><span>{label ?? groups.map(labelOf).filter(Boolean).join(' · ')}</span></span>
|
|
53
|
+
<Icon name="chevron-down" size={indicatorSize(size)} className="kol-dd-caret" />
|
|
54
|
+
</button>
|
|
55
|
+
)}
|
|
56
|
+
>
|
|
57
|
+
<div className="flex gap-2">
|
|
58
|
+
{groups.map((g) => (
|
|
59
|
+
<div key={g.id} role="listbox" aria-label={g.label} className="flex min-w-32 flex-col">
|
|
60
|
+
<div className={`${ROW[size] ?? ROW.sm} flex shrink-0 items-center text-meta`}>{g.label}</div>
|
|
61
|
+
{g.options.map((o) => (
|
|
62
|
+
<MenuRow key={o.value} hover={false} size={size} rowClass={ROW[size] ?? ROW.sm}
|
|
63
|
+
onClick={() => onChange?.(g.id, o.value)}
|
|
64
|
+
indicator={o.value === value[g.id] ? 'dot' : undefined}>
|
|
65
|
+
{o.label ?? o.value}
|
|
66
|
+
</MenuRow>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
))}
|
|
70
|
+
</div>
|
|
71
|
+
</Menu>
|
|
69
72
|
)
|
|
70
73
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Menu } from './Menu.jsx'
|
|
2
|
+
import { Tooltip } from '../utilities/Popover.jsx'
|
|
3
|
+
|
|
4
|
+
/* the hit box per control rung: a field's height, a narrow width; the dot inside it */
|
|
5
|
+
const SIZE = {
|
|
6
|
+
xs: 'w-4 h-[22px] [--bd-dot:6px]',
|
|
7
|
+
sm: 'w-5 h-[26px] [--bd-dot:7px]',
|
|
8
|
+
md: 'w-6 h-8 [--bd-dot:8px]',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* ParamBindDot — Show a param is bound and open its menu. the small dot beside a param row: hollow at rest,
|
|
13
|
+
* filled in the accent once the param is bound (modulated); a click opens a menu of actions.
|
|
14
|
+
*
|
|
15
|
+
* Lobby ParamBindDot (kol-fxr, 2026-10-31): fxr's `params/BindDot.jsx` was a raw `<button>` dot and a
|
|
16
|
+
* hand-wired PopoverPanel beside every animatable row. This is that dot on KOL's `Menu` — the menu panel,
|
|
17
|
+
* rows and dismissal are the Menu family's, so `items` take every Menu row key (`checked`, `divider`,
|
|
18
|
+
* `heading`, `icon`, `disabled`…), not just `{ label, onClick }`.
|
|
19
|
+
*
|
|
20
|
+
* ON THE CONTROL RAMP. The hit box is a field's height at the same `size` (xs 22 · sm 26 · md 32) and narrow,
|
|
21
|
+
* so it sits in a `SettingsRow`'s trailing slot level with the control. The dot itself: xs 6 · sm 7 · md 8.
|
|
22
|
+
*
|
|
23
|
+
* STATES (the icon ink law — oq, never fg): at rest a hollow ring in oq-48, hover lifts it to oq-80, bound
|
|
24
|
+
* fills it and its ring in the accent. Open, the ring holds its hover ink. The `mode` names what it is bound
|
|
25
|
+
* to — it rides the tooltip and the accessible name.
|
|
26
|
+
*
|
|
27
|
+
* <ParamBindDot bound={isBound} mode="LFO" label="Opacity" items={[
|
|
28
|
+
* { label: 'Constant', checked: !isBound, onClick: unbind },
|
|
29
|
+
* { label: 'LFO', checked: mode === 'lfo', onClick: () => bind('lfo') },
|
|
30
|
+
* ]} />
|
|
31
|
+
*
|
|
32
|
+
* @param {boolean} [bound=false] - The param is bound (modulated) — fills the dot in the accent
|
|
33
|
+
* @param {string} [mode] - What it is bound to ("LFO", "Keyframes"…) — shown in the tooltip and the name while bound
|
|
34
|
+
* @param {Array<Object>} [items=[]] - The menu rows — `{ label, onClick }` and every other Menu row key
|
|
35
|
+
* @param {string} [label] - The param's name, for the accessible name ("Modulate Opacity")
|
|
36
|
+
* @param {string} [tooltip] - Overrides the tooltip (default "Modulate", or "Bound · <mode>" while bound)
|
|
37
|
+
* @param {'xs'|'sm'|'md'} [size='sm'] - The control rung — the hit box matches a field of this size
|
|
38
|
+
* @param {'start'|'end'} [align='end'] - The menu's edge against the dot
|
|
39
|
+
* @param {number} [minWidth=180] - The menu's minimum width
|
|
40
|
+
* @param {string} [className] - Extra classes on the trigger
|
|
41
|
+
*/
|
|
42
|
+
export default function ParamBindDot({
|
|
43
|
+
bound = false,
|
|
44
|
+
mode,
|
|
45
|
+
items = [],
|
|
46
|
+
label,
|
|
47
|
+
tooltip,
|
|
48
|
+
size = 'sm',
|
|
49
|
+
align = 'end',
|
|
50
|
+
minWidth = 180,
|
|
51
|
+
className = '',
|
|
52
|
+
}) {
|
|
53
|
+
const tip = tooltip ?? (bound ? (mode ? `Bound · ${mode}` : 'Bound') : 'Modulate')
|
|
54
|
+
const name = [`Modulate${label ? ` ${label}` : ''}`, bound && mode ? `(${mode})` : ''].filter(Boolean).join(' ')
|
|
55
|
+
return (
|
|
56
|
+
<Menu align={align} minWidth={minWidth} items={items} trigger={({ open, props }) => (
|
|
57
|
+
<Tooltip label={open ? null : tip}>
|
|
58
|
+
<button
|
|
59
|
+
type="button"
|
|
60
|
+
aria-label={name}
|
|
61
|
+
{...props}
|
|
62
|
+
className={[
|
|
63
|
+
'kol-param-bind-dot group inline-flex shrink-0 items-center justify-center p-0 border-0 bg-transparent cursor-pointer rounded-[var(--kol-radius-xs)] outline-none',
|
|
64
|
+
'focus-visible:outline focus-visible:outline-1 focus-visible:outline-[var(--kol-focus-ring-quiet)]',
|
|
65
|
+
SIZE[size] ?? SIZE.sm,
|
|
66
|
+
className,
|
|
67
|
+
].filter(Boolean).join(' ')}
|
|
68
|
+
>
|
|
69
|
+
<span
|
|
70
|
+
aria-hidden="true"
|
|
71
|
+
className={`block rounded-full border-[1.5px] border-solid transition-colors size-[var(--bd-dot)] ${bound
|
|
72
|
+
? 'bg-[var(--kol-accent-primary)] border-[var(--kol-accent-primary)]'
|
|
73
|
+
: `bg-transparent group-hover:border-[var(--kol-oq-80)] ${open ? 'border-[var(--kol-oq-80)]' : 'border-[var(--kol-oq-48)]'}`}`}
|
|
74
|
+
/>
|
|
75
|
+
</button>
|
|
76
|
+
</Tooltip>
|
|
77
|
+
)} />
|
|
78
|
+
)
|
|
79
|
+
}
|
|
@@ -2,7 +2,7 @@ import { useState } from 'react'
|
|
|
2
2
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
3
|
import Button from '../atoms/Button.jsx'
|
|
4
4
|
import { PopoverPanel, usePopover, Tooltip } from '../utilities/Popover.jsx'
|
|
5
|
-
import {
|
|
5
|
+
import { MenuRow } from './MenuItem.jsx'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* ShapeDropdown — A tool button with a shape menu. split icon-button + variant-menu molecule (the tool-palette
|
|
@@ -11,7 +11,7 @@ import { MenuDropdownItem } from './MenuItem.jsx'
|
|
|
11
11
|
* menu of all variants — picking one fires `onChange` and closes.
|
|
12
12
|
*
|
|
13
13
|
* Composed from Button (both trigger halves), usePopover/PopoverPanel (menu
|
|
14
|
-
* positioning, dismiss, portal) and
|
|
14
|
+
* positioning, dismiss, portal) and MenuRow (rows — same rows as the
|
|
15
15
|
* Dropdown molecule, ✓ marks the active variant).
|
|
16
16
|
*
|
|
17
17
|
* For single-value list selection with a text trigger use `Dropdown`; this is
|
|
@@ -80,14 +80,14 @@ const ShapeDropdown = ({ options = [], value, onChange, onAction, className = ''
|
|
|
80
80
|
className="w-max bg-surface-secondary border border-fg-08 rounded shadow-lg"
|
|
81
81
|
>
|
|
82
82
|
{options.map((option) => (
|
|
83
|
-
<
|
|
83
|
+
<MenuRow
|
|
84
84
|
key={option.id}
|
|
85
85
|
onClick={() => handleSelect(option)}
|
|
86
86
|
iconLeft={option.icon ? <Icon name={option.icon} size={14} /> : undefined}
|
|
87
|
-
|
|
87
|
+
indicator={option.id === current?.id ? 'dot' : undefined}
|
|
88
88
|
>
|
|
89
89
|
{option.label}
|
|
90
|
-
</
|
|
90
|
+
</MenuRow>
|
|
91
91
|
))}
|
|
92
92
|
</PopoverPanel>
|
|
93
93
|
</div>
|
|
@@ -164,8 +164,9 @@ const SplitToolButton = ({
|
|
|
164
164
|
<IconC name={variant.icon} size={14} />
|
|
165
165
|
</span>
|
|
166
166
|
<span className="flex-1 truncate">{variant.label}</span>
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
{/* the current pick wears the dot, a real icon (plan-2026-10-31-menu-engine W2) — never a typed ✓ */}
|
|
168
|
+
<span className="kol-helper-10 text-oq-88 shrink-0 inline-flex items-center">
|
|
169
|
+
{isActive ? <Icon name="ascii-dot" size={24} style={{ margin: -5 }} /> : variant.shortcut}
|
|
169
170
|
</span>
|
|
170
171
|
</button>
|
|
171
172
|
)
|
|
@@ -15,7 +15,16 @@ import usePointerSort from '../hooks/usePointerSort.js'
|
|
|
15
15
|
* named from `LayerStack`: HTML drag does nothing under a finger, and fxr runs on a phone. The
|
|
16
16
|
* `arrows` variant is the keyboard path.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* ITEMLIST ROWS (lobby ItemList, kol-fxr 2026-10-31 — fxr's Layers sections, Soft forms' forms and Penrose's
|
|
19
|
+
* colour roles, drew one stopgap `LayerRow`). Every key is optional and absent keys draw nothing, so a plain
|
|
20
|
+
* step list is unchanged. A row reads number · swatch · eye · name · control · actions · ×:
|
|
21
|
+
* `swatch` a colour chip (null = an empty chip; undefined = none)
|
|
22
|
+
* `shown` true / false draws the eye (eye-on / eye-off), pressed calls `onToggleShown(i)`; undefined = none
|
|
23
|
+
* `control` a node after the name — an inline control (a slider, a field); the name narrows to make room
|
|
24
|
+
* `actions` `[{ icon, label, onClick, hidden }]` quiet icon buttons; a `hidden` one keeps its slot, never shows disabled
|
|
25
|
+
* The whole row selects (a click anywhere off a control); the name is the keyboard stop.
|
|
26
|
+
*
|
|
27
|
+
* @param {{ id: string|number, label: import('react').ReactNode, swatch?: string|null, shown?: boolean, control?: import('react').ReactNode, actions?: { icon: string, label: string, onClick: Function, hidden?: boolean }[] }[]} items the rows, in order
|
|
19
28
|
* @param {number|null} activeIndex the highlighted (editing) row
|
|
20
29
|
* @param {'grab'|'arrows'} reorder `grab`: a ⠿ handle and a pointer drag (touch too) · `arrows`: ↑ ↓ quiet buttons, one slot a press
|
|
21
30
|
* @param {boolean} readOnly no handle or arrows, no ×, no add row; the body does not open
|
|
@@ -23,6 +32,7 @@ import usePointerSort from '../hooks/usePointerSort.js'
|
|
|
23
32
|
* @param {(index: number) => void} onSelect the body pressed
|
|
24
33
|
* @param {(index: number) => void} onRemove ×
|
|
25
34
|
* @param {(from: number, to: number) => void} onMove after a drop or an arrow press
|
|
35
|
+
* @param {(index: number) => void} onToggleShown a row's eye pressed
|
|
26
36
|
* @param {() => void} onAdd the dashed row
|
|
27
37
|
* @param {import('react').ReactNode} addLabel the dashed row's words — the consumer's copy
|
|
28
38
|
* @param {string} className on the list
|
|
@@ -36,6 +46,7 @@ export default function StepList({
|
|
|
36
46
|
onSelect,
|
|
37
47
|
onRemove,
|
|
38
48
|
onMove,
|
|
49
|
+
onToggleShown,
|
|
39
50
|
onAdd,
|
|
40
51
|
addLabel = 'Add a step',
|
|
41
52
|
className = '',
|
|
@@ -56,7 +67,8 @@ export default function StepList({
|
|
|
56
67
|
return (
|
|
57
68
|
<li
|
|
58
69
|
key={it.id}
|
|
59
|
-
className={`kol-step-list-item relative flex items-center gap-2 rounded px-2 py-1${active ? ' bg-fg-08' : ''}${dragging ? ' opacity-40' : ''}`}
|
|
70
|
+
className={`kol-step-list-item relative flex items-center gap-2 rounded px-2 py-1${readOnly ? '' : ' cursor-pointer'}${active ? ' bg-fg-08' : ''}${dragging ? ' opacity-40' : ''}`}
|
|
71
|
+
onClick={readOnly ? undefined : () => onSelect?.(i)}
|
|
60
72
|
>
|
|
61
73
|
{/* the drop mark: a 1px accent line above or below the row under the pointer */}
|
|
62
74
|
{mark && <span aria-hidden="true" className={`absolute left-2 right-2 h-px ${mark}`} style={{ background: 'var(--kol-accent-primary)' }} />}
|
|
@@ -66,27 +78,41 @@ export default function StepList({
|
|
|
66
78
|
aria-label={`Reorder step ${i + 1}`}
|
|
67
79
|
className="cursor-grab shrink-0 touch-none border-0 bg-transparent p-0"
|
|
68
80
|
onPointerDown={(e) => startDrag(e, i, rows())}
|
|
81
|
+
onClick={(e) => e.stopPropagation()}
|
|
69
82
|
>
|
|
70
83
|
<Icon name="drag-handle" size={12} className="text-oq-48" />
|
|
71
84
|
</button>
|
|
72
85
|
)}
|
|
73
86
|
{arrows && (
|
|
74
87
|
<span className="flex shrink-0 items-center">
|
|
75
|
-
<Button tone="ghost" quiet iconOnly="chevron-up" size={size} aria-label={`Move step ${i + 1} up`} disabled={i === 0} onClick={() => onMove(i, i - 1)} />
|
|
76
|
-
<Button tone="ghost" quiet iconOnly="chevron-down" size={size} aria-label={`Move step ${i + 1} down`} disabled={i === items.length - 1} onClick={() => onMove(i, i + 1)} />
|
|
88
|
+
<Button tone="ghost" quiet iconOnly="chevron-up" size={size} aria-label={`Move step ${i + 1} up`} disabled={i === 0} onClick={(e) => { e.stopPropagation(); onMove(i, i - 1) }} />
|
|
89
|
+
<Button tone="ghost" quiet iconOnly="chevron-down" size={size} aria-label={`Move step ${i + 1} down`} disabled={i === items.length - 1} onClick={(e) => { e.stopPropagation(); onMove(i, i + 1) }} />
|
|
77
90
|
</span>
|
|
78
91
|
)}
|
|
92
|
+
<span className="kol-helper-10 text-meta tabular-nums w-4 shrink-0">{i + 1}</span>
|
|
93
|
+
{it.swatch !== undefined && (
|
|
94
|
+
<span aria-hidden="true" className="size-4 shrink-0 rounded-sm" style={{ background: it.swatch ?? 'var(--kol-oq-08)' }} />
|
|
95
|
+
)}
|
|
96
|
+
{it.shown !== undefined && (
|
|
97
|
+
<Button tone="ghost" quiet iconOnly={it.shown ? 'eye-on' : 'eye-off'} size={size} aria-pressed={it.shown}
|
|
98
|
+
aria-label={`${it.shown ? 'Hide' : 'Show'} row ${i + 1}`} onClick={(e) => { e.stopPropagation(); onToggleShown?.(i) }} />
|
|
99
|
+
)}
|
|
79
100
|
<button
|
|
80
101
|
type="button"
|
|
81
|
-
className=
|
|
82
|
-
onClick={readOnly ? undefined : () => onSelect?.(i)}
|
|
102
|
+
className={`flex min-w-0 items-center border-0 bg-transparent p-0 text-left ${it.control ? 'w-20 shrink-0' : 'flex-1'}`}
|
|
83
103
|
disabled={readOnly}
|
|
84
104
|
>
|
|
85
|
-
<span className="kol-helper-10 text-meta tabular-nums w-4 shrink-0">{i + 1}</span>
|
|
86
105
|
<span className="kol-mono-12 text-emphasis truncate">{it.label}</span>
|
|
87
106
|
</button>
|
|
107
|
+
{it.control && <div className="flex-1 min-w-0" onClick={(e) => e.stopPropagation()}>{it.control}</div>}
|
|
108
|
+
{it.actions?.map((a) => (
|
|
109
|
+
<Button key={a.label} tone="ghost" quiet iconOnly={a.icon} size={size} aria-label={a.label}
|
|
110
|
+
aria-hidden={a.hidden || undefined} tabIndex={a.hidden ? -1 : undefined}
|
|
111
|
+
className={a.hidden ? 'invisible pointer-events-none' : undefined}
|
|
112
|
+
onClick={(e) => { e.stopPropagation(); if (!a.hidden) a.onClick?.() }} />
|
|
113
|
+
))}
|
|
88
114
|
{!readOnly && onRemove && (
|
|
89
|
-
<Button tone="ghost" quiet iconOnly="x" size={size} aria-label={`Remove step ${i + 1}`} onClick={() => onRemove(i)} />
|
|
115
|
+
<Button tone="ghost" quiet iconOnly="x" size={size} aria-label={`Remove step ${i + 1}`} onClick={(e) => { e.stopPropagation(); onRemove(i) }} />
|
|
90
116
|
)}
|
|
91
117
|
</li>
|
|
92
118
|
)
|
|
@@ -3,7 +3,7 @@ import { createPortal } from 'react-dom'
|
|
|
3
3
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
4
4
|
import { MenuCtx, useAsk, glyph } from '../molecules/AppItem.jsx'
|
|
5
5
|
import ContextMenu, { useContextMenu } from '../molecules/ContextMenu.jsx'
|
|
6
|
-
import {
|
|
6
|
+
import { MenuRow } from '../molecules/MenuItem.jsx'
|
|
7
7
|
import ActionButton from '../molecules/ActionButton.jsx'
|
|
8
8
|
import Tag from '../atoms/Tag.jsx'
|
|
9
9
|
import Input from '../atoms/Input.jsx'
|
|
@@ -256,9 +256,9 @@ export default function AppItemMenuProvider({ children }) {
|
|
|
256
256
|
<ContextMenu menu={menu}>
|
|
257
257
|
{(item) => item && (
|
|
258
258
|
<>
|
|
259
|
-
{item.verbs?.rename && <
|
|
260
|
-
{item.verbs?.duplicate && <
|
|
261
|
-
{item.verbs?.remove && <
|
|
259
|
+
{item.verbs?.rename && <MenuRow iconLeft={glyph('edit')} onClick={() => ask.rename(item.name, item.verbs)}>Rename</MenuRow>}
|
|
260
|
+
{item.verbs?.duplicate && <MenuRow iconLeft={glyph('copy')} onClick={item.verbs.duplicate}>Duplicate</MenuRow>}
|
|
261
|
+
{item.verbs?.remove && <MenuRow iconLeft={glyph('trash')} onClick={() => ask.remove(item.name, item.verbs)}>Delete</MenuRow>}
|
|
262
262
|
{item.menuItems}
|
|
263
263
|
</>
|
|
264
264
|
)}
|
|
@@ -117,8 +117,11 @@ function cssToHex(css) {
|
|
|
117
117
|
* @param {boolean} [modes=false] a head row — `title` and a mode Dropdown, HEX · RGB · HSB · Lab — and, under the square and
|
|
118
118
|
* the hue, that mode's fields: the hex, or three channel strips with their numbers (Adobe's)
|
|
119
119
|
* @param {string} [title] the head row's name ("Base", "Edit color")
|
|
120
|
+
* @param {ReactNode|Function} [footer] extras under the hex row — palette swatches, quick states ("Theme", "None"). A node,
|
|
121
|
+
* or `({ close }) => node` so a pick can close the panel (lobby ColorPickerPopoverExtras,
|
|
122
|
+
* kol-fxr 2026-10-31). Inline, it sits last and `close` does nothing
|
|
120
123
|
*/
|
|
121
|
-
export default function ColorPickerPopover({ color, onChange, defaultValue, size = 'xs', label = 'Color', trigger, placement = 'bottom-end', alpha = true, brightness = false, inline = false, hexEnd, modes = false, title, className = '' }) {
|
|
124
|
+
export default function ColorPickerPopover({ color, onChange, defaultValue, size = 'xs', label = 'Color', trigger, placement = 'bottom-end', alpha = true, brightness = false, inline = false, hexEnd, modes = false, title, footer, className = '' }) {
|
|
122
125
|
const [mode, setMode] = useState('hex')
|
|
123
126
|
const isNone = !color || color === 'transparent'
|
|
124
127
|
const [open, setOpen] = useState(false)
|
|
@@ -162,6 +165,7 @@ export default function ColorPickerPopover({ color, onChange, defaultValue, size
|
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
const opaque = hsva && hsvaToHex({ ...hsva, alpha: 1 })
|
|
168
|
+
const extras = typeof footer === 'function' ? footer({ close: () => setOpen(false) }) : footer
|
|
165
169
|
|
|
166
170
|
/* INLINE: the working copy follows `color` whenever it changes from outside (a roll, an undo) */
|
|
167
171
|
useEffect(() => {
|
|
@@ -223,6 +227,7 @@ export default function ColorPickerPopover({ color, onChange, defaultValue, size
|
|
|
223
227
|
{modes && mode !== 'hex' && CHANNELS[mode].map((ch) => <ChannelStrip key={ch.key} ch={ch} hex={hsvaToHex({ ...hsva, alpha: 1 })} hsva={hsva} onHsva={commit} />)}
|
|
224
228
|
{(!modes || mode === 'hex' || mode === 'rgb') && <ChannelStrip ch={BRIGHTNESS} hex={hsvaToHex({ ...hsva, alpha: 1 })} hsva={hsva} onHsva={commit} />}
|
|
225
229
|
{alpha && <AlphaStrip alpha={hsva.alpha} color={opaque} onChange={(a) => commit({ ...hsva, alpha: a })} />}
|
|
230
|
+
{extras}
|
|
226
231
|
</div>
|
|
227
232
|
)
|
|
228
233
|
}
|
|
@@ -258,6 +263,7 @@ export default function ColorPickerPopover({ color, onChange, defaultValue, size
|
|
|
258
263
|
{head}
|
|
259
264
|
{strips}
|
|
260
265
|
{(!modes || mode === 'hex') && hexField}
|
|
266
|
+
{extras}
|
|
261
267
|
</PopoverPanel>
|
|
262
268
|
)}
|
|
263
269
|
</>
|
|
@@ -2,7 +2,7 @@ import { useRef, useState } from 'react'
|
|
|
2
2
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
3
|
import Button from '../atoms/Button.jsx'
|
|
4
4
|
import Input from '../atoms/Input.jsx'
|
|
5
|
-
import {
|
|
5
|
+
import { MenuRow, MenuFlyout } from '../molecules/MenuItem.jsx'
|
|
6
6
|
import { usePopover, PopoverPanel, Tooltip } from '../utilities/Popover.jsx'
|
|
7
7
|
import { rowLabelForLayer, findLayerDeep } from '../hooks/layerTree.js'
|
|
8
8
|
|
|
@@ -488,19 +488,19 @@ export function AddLayerButton({
|
|
|
488
488
|
{types.map((t) => {
|
|
489
489
|
if (nested && t.id === nested.typeId) {
|
|
490
490
|
return (
|
|
491
|
-
<
|
|
491
|
+
<MenuFlyout key={t.id} iconLeft={<IconC name={t.icon ?? iconFor(t.id)} size={12} />} label={t.label}>
|
|
492
492
|
{nested.kinds.map((k) => (
|
|
493
|
-
<
|
|
493
|
+
<MenuRow key={k.id} iconLeft={<IconC name={k.icon ?? iconFor(t.id)} size={12} />} onClick={() => pick(t.id, k.extras)}>
|
|
494
494
|
{k.label}
|
|
495
|
-
</
|
|
495
|
+
</MenuRow>
|
|
496
496
|
))}
|
|
497
|
-
</
|
|
497
|
+
</MenuFlyout>
|
|
498
498
|
)
|
|
499
499
|
}
|
|
500
500
|
return (
|
|
501
|
-
<
|
|
501
|
+
<MenuRow key={t.id} iconLeft={<IconC name={t.icon ?? iconFor(t.id)} size={12} />} onClick={() => pick(t.id)}>
|
|
502
502
|
{t.label}
|
|
503
|
-
</
|
|
503
|
+
</MenuRow>
|
|
504
504
|
)
|
|
505
505
|
})}
|
|
506
506
|
</PopoverPanel>
|
|
@@ -11,7 +11,7 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
11
11
|
import MediaTile from '../molecules/MediaTile.jsx'
|
|
12
12
|
import ContentRow from '../molecules/ContentRow.jsx'
|
|
13
13
|
import ContentFilters from './ContentFilters.jsx'
|
|
14
|
-
import { MenuItem,
|
|
14
|
+
import { MenuItem, MenuRow, MenuDivider } from '../molecules/MenuItem.jsx'
|
|
15
15
|
import MediaViewer from './MediaViewer.jsx'
|
|
16
16
|
import { MediaLibraryBrowse, MediaLibraryLibrary, SETTINGS_BASE } from './MediaLibraryPages.jsx'
|
|
17
17
|
import MediaLibraryExplorer from './MediaLibraryExplorer.jsx'
|
|
@@ -949,11 +949,11 @@ function LibraryChrome({ onOpen, onPick }) {
|
|
|
949
949
|
{({ close }) => (
|
|
950
950
|
<div className="py-1 w-[200px]">
|
|
951
951
|
{VIEW_OPTIONS.map((opt) => (
|
|
952
|
-
<
|
|
952
|
+
<MenuRow key={opt.value} onClick={() => { setViewMode(opt.value); close() }} indicator={viewMode === opt.value ? 'dot' : undefined}>{opt.label}</MenuRow>
|
|
953
953
|
))}
|
|
954
|
-
<
|
|
954
|
+
<MenuDivider />
|
|
955
955
|
{SORT_OPTIONS.map((opt) => (
|
|
956
|
-
<
|
|
956
|
+
<MenuRow key={opt.value} onClick={() => { sortBy(opt.value); close() }} shortcut={sort.by === opt.value ? <Icon name={sort.dir === 'desc' ? 'arrow-down' : 'arrow-up'} size={11} /> : undefined}>{opt.label}</MenuRow>
|
|
957
957
|
))}
|
|
958
958
|
</div>
|
|
959
959
|
)}
|