@kolkrabbi/kol-component 0.378.0 → 0.380.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 +5 -4
- package/src/atoms/Badge.jsx +1 -5
- package/src/atoms/BezierPathEditor.jsx +1 -1
- package/src/atoms/Button.jsx +88 -12
- package/src/atoms/Figure.jsx +19 -1
- package/src/atoms/FunctionPlot.jsx +1 -1
- package/src/atoms/Input.jsx +107 -7
- package/src/atoms/Kbd.jsx +42 -2
- package/src/atoms/Link.jsx +20 -0
- package/src/atoms/OriginPicker.jsx +9 -5
- package/src/atoms/Pill.jsx +1 -3
- package/src/atoms/ProgressBar.jsx +3 -6
- package/src/atoms/SectionFooter.jsx +22 -0
- package/src/atoms/SectionHeader.jsx +24 -0
- package/src/atoms/SectionLabel.jsx +0 -22
- package/src/atoms/SizeOrDownload.jsx +1 -1
- package/src/atoms/Tag.jsx +4 -7
- package/src/atoms/Textarea.jsx +12 -7
- package/src/atoms/ToggleCheckbox.jsx +25 -5
- package/src/atoms/ToggleSwitch.jsx +41 -7
- package/src/atoms/ViewToggle.jsx +2 -29
- package/src/atoms/XYPad.jsx +25 -0
- package/src/hooks/useDragResize.js +1 -1
- package/src/index.js +26 -4
- package/src/molecules/AccountMenu.jsx +16 -3
- package/src/molecules/AlignmentGrid.jsx +13 -1
- package/src/molecules/ButtonGroup.jsx +78 -15
- package/src/molecules/ButtonSplit.jsx +75 -28
- package/src/molecules/Chip.jsx +26 -0
- package/src/molecules/CodeBlock.jsx +39 -2
- package/src/molecules/ColorInputRow.jsx +125 -4
- package/src/molecules/ColorSwatch.jsx +43 -2
- package/src/molecules/ContentCard.jsx +104 -3
- package/src/molecules/ContentMedia.jsx +1 -1
- package/src/molecules/ContentRow.jsx +4 -32
- package/src/molecules/ContextMenu.jsx +0 -1
- package/src/molecules/DividerLabel.jsx +19 -0
- package/src/molecules/DocsToc.jsx +1 -16
- package/src/molecules/Dropdown.jsx +115 -18
- package/src/molecules/DropdownStepper.jsx +29 -0
- package/src/molecules/EmptyState.jsx +1 -15
- package/src/molecules/FieldPair.jsx +41 -2
- package/src/molecules/Header.jsx +4 -4
- package/src/molecules/IndexRow.jsx +1 -1
- package/src/molecules/InlineAddRow.jsx +2 -2
- package/src/molecules/LabeledControl.jsx +56 -11
- package/src/molecules/LayerRow.jsx +1 -1
- package/src/molecules/LinkAddRow.jsx +5 -7
- package/src/molecules/Menu.jsx +250 -33
- package/src/molecules/MenuFloat.jsx +6 -12
- package/src/molecules/MenuList.jsx +5 -11
- package/src/molecules/Modal.jsx +228 -55
- package/src/molecules/ModalHeader.jsx +12 -20
- package/src/molecules/ModalShell.jsx +20 -10
- package/src/molecules/NoticeBanner.jsx +1 -1
- package/src/molecules/OptionRow.jsx +1 -1
- package/src/molecules/PanelsMenu.jsx +2 -2
- package/src/molecules/ParamBindDot.jsx +29 -2
- package/src/molecules/PasswordInput.jsx +1 -1
- package/src/molecules/QuantityInput.jsx +45 -13
- package/src/molecules/QuickLookFrame.jsx +2 -31
- package/src/molecules/RailHeader.jsx +37 -16
- package/src/molecules/ReadingActions.jsx +2 -2
- package/src/molecules/ReadingNotes.jsx +3 -3
- package/src/molecules/ReadingSettings.jsx +8 -8
- package/src/molecules/SearchInput.jsx +4 -5
- package/src/molecules/SectionText.jsx +56 -10
- package/src/molecules/SettingsControls.jsx +23 -23
- package/src/molecules/Slider.jsx +103 -55
- package/src/molecules/SpecList.jsx +1 -21
- package/src/molecules/SplitToolButton.jsx +4 -6
- package/src/molecules/SwatchControls.jsx +28 -0
- package/src/molecules/SwatchGrid.jsx +39 -0
- package/src/molecules/TabsDocument.jsx +131 -0
- package/src/molecules/TabsRow.jsx +40 -50
- package/src/molecules/TaskRow.jsx +2 -2
- package/src/molecules/Toast.jsx +55 -0
- package/src/molecules/TocRow.jsx +1 -1
- package/src/molecules/TreeRow.jsx +87 -1
- package/src/molecules/WorkspaceSwitcher.jsx +3 -6
- package/src/organisms/AppItemMenuProvider.jsx +2 -2
- package/src/organisms/ColorPickerPopover.jsx +133 -4
- package/src/organisms/ColumnBrowser.jsx +1 -1
- package/src/organisms/CommandOverlay.jsx +362 -87
- package/src/organisms/ContentFilters.jsx +4 -12
- package/src/organisms/FindBar.jsx +70 -0
- package/src/organisms/FramedMediaBand.jsx +2 -2
- package/src/organisms/GalleryCarousel.jsx +1 -1
- package/src/organisms/LogoSystem.jsx +38 -0
- package/src/organisms/LogoTuner.jsx +32 -0
- package/src/organisms/MediaLibrary.jsx +1 -56
- package/src/organisms/MediaLibraryPages.jsx +1 -1
- package/src/organisms/NavRail.jsx +1 -4
- package/src/organisms/Rail.jsx +33 -1
- package/src/organisms/RailSwitcher.jsx +62 -0
- package/src/organisms/ReadingContents.jsx +65 -3
- package/src/organisms/ReadingOverview.jsx +5 -5
- package/src/organisms/ReadingPanel.jsx +1 -1
- package/src/organisms/SectionSplit.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +64 -41
- package/src/organisms/ShortcutsOverlay.jsx +46 -2
- package/src/organisms/SpectrumControls.jsx +112 -19
- package/src/organisms/StatusBar.jsx +30 -0
- package/src/organisms/Table.jsx +136 -45
- package/src/organisms/TimelineDock.jsx +281 -1
- package/src/organisms/logoBoard.jsx +61 -0
- package/src/utilities/AssetPlaceholder.jsx +1 -1
- package/src/utilities/EditorShell.jsx +42 -1
- package/src/utilities/OverlayGlassPanel.jsx +1 -1
- package/src/utilities/Popover.jsx +299 -5
- package/src/utilities/SelectionOverlay.jsx +60 -31
- package/src/utilities/kolboxGlyph.jsx +10 -0
- package/src/molecules/FloatModuleHeader.jsx +0 -11
- package/src/organisms/NavRailFloat.jsx +0 -139
|
@@ -189,17 +189,53 @@ export function SettingsSwitch({ on = false, onChange, disabled = false, disable
|
|
|
189
189
|
* user ruling: it named the place it was first used, not what it is; kol-fxr
|
|
190
190
|
* took it for a params rail the same day). RENAMED, NO ALIAS — the render is
|
|
191
191
|
* the 0.104.0 locked composition, untouched.
|
|
192
|
-
|
|
193
|
-
* `variant="float"` — the one float section (plan-2026-11-12-float-rails-figma W10.1, the user: *"this should be a
|
|
194
|
-
* component with slots that has multiple items?"*): a `head` (the `label`, any node, a string in the float label role,
|
|
195
|
-
* and `end`, a + button or a meta, at the far end) over the items (children, any number). PropertyRail's sections and
|
|
196
|
-
* subheads, ReadingContents' chapters and NavRail float's groups all draw it. The head renders only when a label or an
|
|
197
|
-
* end is given, the items only when there are any. `gap` is head to items, `rowGap` items to items, each a spacing step
|
|
198
|
-
* (0.5 · 1 · 1.5 · 2 · 3) or `'module'` (`--kol-float-module-gap`); float defaults 3 (12) and 2 (8). `as` the element
|
|
199
|
-
* (`nav` for a list of links), the rest of the props on it. */
|
|
200
|
-
const GAP = { 0.5: 'gap-0.5', 1: 'gap-1', 1.5: 'gap-1.5', 2: 'gap-2', 3: 'gap-3', module: 'gap-[var(--kol-float-module-gap)]' }
|
|
192
|
+
*/
|
|
201
193
|
const SETTINGS_GAP = { 3: 'gap-3', 4: 'gap-4', settings: 'gap-[7px]' }
|
|
202
|
-
|
|
194
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's RailSection (Figma 27:9309),
|
|
195
|
+
* carried from apps/kolbox/src/ui/RailSection.jsx. A 1px rule at the section's top, then the head: a 40 row, the `label`
|
|
196
|
+
* 16 in, its `end` actions (24 boxes) 4 apart and 8 off the right edge; 4 to the rows, inset 16, 8 apart; 16 under them.
|
|
197
|
+
* With no rows it is the rule and the head alone (41 high). Measured on Figma's own rails (plan-2026-11-23-editor-
|
|
198
|
+
* measured-against-figma W3: Pages, Layers, Page, Styles and Export headers are 40, label 16 in); closed is not empty, so its title and
|
|
199
|
+
* its actions keep the full ink (his "I thought text were white", R3.2).
|
|
200
|
+
* THE RAIL'S ONE GRID (plan-2026-11-19-kolbox-whats-left R3.1): in a Rail the rows' tracks are set here, once, as
|
|
201
|
+
* `--kol-kolbox-row-cols`: two field columns and two 16 icon columns, 8 apart (76, 76, 16, 16 in the 240 rail; his
|
|
202
|
+
* design's Stroke row, 149:26890). FieldPair and ColorInputRow kolbox lay out on it; the head's actions sit at the right
|
|
203
|
+
* of the head (above); LabeledControl kolbox's 76 label is the first field column. */
|
|
204
|
+
function LabeledControlSectionKolbox({ label, end, className = '', children }) {
|
|
205
|
+
const rows = Children.toArray(children)
|
|
206
|
+
const open = rows.length > 0
|
|
207
|
+
return (
|
|
208
|
+
<section
|
|
209
|
+
className={`kol-section--kolbox relative flex flex-col gap-1 pt-px ${open ? 'pb-4' : ''} before:absolute before:inset-x-0 before:top-0 before:h-px ${className}`}
|
|
210
|
+
data-rail-section={label ?? ''}
|
|
211
|
+
>
|
|
212
|
+
{(label || end) && (
|
|
213
|
+
<header className="flex h-10 items-center pr-2 pl-4">
|
|
214
|
+
<h3 className="kol-section-title--kolbox min-w-0 flex-1 truncate">{label}</h3>
|
|
215
|
+
{end && <span className="flex shrink-0 items-center gap-1">{end}</span>}
|
|
216
|
+
</header>
|
|
217
|
+
)}
|
|
218
|
+
{open && <div className="flex flex-col gap-2 px-4 in-data-rail:[--kol-kolbox-row-cols:minmax(0,1fr)_minmax(0,1fr)_var(--kol-spacing-4)_var(--kol-spacing-4)]">{rows}</div>}
|
|
219
|
+
</section>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* `variant="folio"` (Folio batch C, 2026-11-22): Folio's SettingGroup, carried class for class. The `label` (12 / 17
|
|
224
|
+
* medium, Folio's ink) 12 over its rows, the rows 8 apart. Chrome in kol-theme `.kol-section--folio`. */
|
|
225
|
+
function LabeledControlSectionFolio({ label, className = '', children }) {
|
|
226
|
+
return (
|
|
227
|
+
<div className={`kol-section--folio flex flex-col gap-[12px] ${className}`.trim()}>
|
|
228
|
+
<p className="kol-section-title--folio">{label}</p>
|
|
229
|
+
<div className="flex flex-col gap-[8px]">{children}</div>
|
|
230
|
+
</div>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function LabeledControlSection(props) {
|
|
235
|
+
if (props.variant === 'folio') return <LabeledControlSectionFolio {...props} />
|
|
236
|
+
return props.variant === 'kolbox' ? <LabeledControlSectionKolbox {...props} /> : <LabeledControlSectionBody {...props} />
|
|
237
|
+
}
|
|
238
|
+
function LabeledControlSectionBody({ label, end, variant, divided = false, gap, rowGap, collapsible = false, open, defaultOpen = true, onToggle, as: Tag = 'div', children, className = '', ...rest }) {
|
|
203
239
|
const [ownOpen, setOwnOpen] = useState(defaultOpen)
|
|
204
240
|
/* `variant="settings"` (plan-2026-11-12-float-rails-figma W13.1): the generator settings window's group — the head is
|
|
205
241
|
* the title (a string in Inter 12 semibold) with `end` (the note) at its right on one baseline, 15 over the items;
|
|
@@ -220,39 +256,26 @@ export function LabeledControlSection({ label, end, variant, divided = false, ga
|
|
|
220
256
|
</Tag>
|
|
221
257
|
)
|
|
222
258
|
}
|
|
223
|
-
if (variant === 'float') {
|
|
224
|
-
const items = Children.toArray(children)
|
|
225
|
-
const hasLabel = label != null && label !== false && label !== ''
|
|
226
|
-
const head = hasLabel && (typeof label === 'string' ? <span className="kol-float-label text-oq-64">{label}</span> : label)
|
|
227
|
-
/* `collapsible` (plan-2026-11-12-one-header W10.1): the head is the toggle, ONE indicator — the 12 chevron at its right
|
|
228
|
-
* end (⌄ open, › closed), the Header's chevron; `open` controlled or `defaultOpen`, `onToggle(open)`. `end` sits before
|
|
229
|
-
* the chevron and must not be interactive. The items hide while closed. */
|
|
230
|
-
const isOpen = !collapsible || (open ?? ownOpen)
|
|
231
|
-
const toggle = () => { const next = !isOpen; if (open === undefined) setOwnOpen(next); onToggle?.(next) }
|
|
232
|
-
return (
|
|
233
|
-
<Tag data-labeled-control-section="" data-open={collapsible ? String(isOpen) : undefined} className={`flex flex-col ${GAP[gap ?? 3]} ${className}`.trim()} {...rest}>
|
|
234
|
-
{collapsible ? (
|
|
235
|
-
<button type="button" aria-expanded={isOpen} onClick={toggle}
|
|
236
|
-
className="flex w-full items-center gap-2 text-left rounded-sm cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
|
|
237
|
-
<span className="flex min-w-0 flex-1 items-center">{head}</span>
|
|
238
|
-
{end}
|
|
239
|
-
<IconLoader name={isOpen ? 'chevron-down' : 'chevron-right'} size="var(--kol-float-chev-sm)" className="shrink-0 text-oq-64" />
|
|
240
|
-
</button>
|
|
241
|
-
) : (hasLabel || end) && (
|
|
242
|
-
<div className="flex items-center justify-between">
|
|
243
|
-
{head}
|
|
244
|
-
{end}
|
|
245
|
-
</div>
|
|
246
|
-
)}
|
|
247
|
-
{isOpen && items.length > 0 && <div className={`flex flex-col ${GAP[rowGap ?? 2]}`}>{items}</div>}
|
|
248
|
-
</Tag>
|
|
249
|
-
)
|
|
250
|
-
}
|
|
251
259
|
rowGap ??= 2
|
|
260
|
+
/* `end` and `collapsible` (restored 2026-11-27 on the one component, ARCHITECTURE §8; they lived only in the retired
|
|
261
|
+
* float branch, which PropertyRail used): `end` sits at the head's right; `collapsible` makes the head the toggle, the
|
|
262
|
+
* 12 chevron at its right end (⌄ open, › closed), `open` controlled or `defaultOpen`, `onToggle(open)`. `end` must not be
|
|
263
|
+
* interactive on a collapsible head. The rows hide while closed. */
|
|
264
|
+
const isOpen = !collapsible || (open ?? ownOpen)
|
|
265
|
+
const toggle = () => { const next = !isOpen; if (open === undefined) setOwnOpen(next); onToggle?.(next) }
|
|
266
|
+
const head = label && (typeof label === 'string' ? <p className="kol-eyebrow text-fg-80">{label}</p> : label)
|
|
252
267
|
return (
|
|
253
|
-
<div className={`flex flex-col gap-3 ${divided ? 'kol-section--divided' : ''} ${className}`.replace(/\s+/g, ' ').trim()}>
|
|
254
|
-
{
|
|
255
|
-
|
|
268
|
+
<div data-labeled-control-section="" data-open={collapsible ? String(isOpen) : undefined} className={`flex flex-col gap-3 ${divided ? 'kol-section--divided' : ''} ${className}`.replace(/\s+/g, ' ').trim()} {...rest}>
|
|
269
|
+
{collapsible ? (
|
|
270
|
+
<button type="button" aria-expanded={isOpen} onClick={toggle} className="flex w-full cursor-pointer items-center gap-2 text-left">
|
|
271
|
+
<span className="flex min-w-0 flex-1 items-center">{head}</span>
|
|
272
|
+
{end}
|
|
273
|
+
<IconLoader name={isOpen ? 'chevron-down' : 'chevron-right'} size={12} className="shrink-0 text-oq-64" />
|
|
274
|
+
</button>
|
|
275
|
+
) : end ? (
|
|
276
|
+
<div className="flex items-center justify-between gap-2">{head}{end}</div>
|
|
277
|
+
) : head}
|
|
278
|
+
{isOpen && <div className={`flex flex-col ${rowGap === 1 ? 'gap-1' : 'gap-2'}`}>{children}</div>}
|
|
256
279
|
</div>
|
|
257
280
|
)
|
|
258
281
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
1
2
|
import SettingsPanel, { LabeledControlSection, SettingsRow } from './SettingsPanel.jsx'
|
|
3
|
+
import CommandOverlay, { isKeyCombo } from './CommandOverlay.jsx'
|
|
4
|
+
import ModalShell from '../molecules/ModalShell.jsx'
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* ShortcutsOverlay — The keyboard shortcut sheet. the keyboard-shortcut sheet: blurred scrim, centred
|
|
@@ -41,8 +44,13 @@ import SettingsPanel, { LabeledControlSection, SettingsRow } from './SettingsPan
|
|
|
41
44
|
* @param {Array} props.shortcuts - `[{ label, combo }]` or `[{ section, items: [{ id, label, combo }] }]` — the same array `SettingsShortcuts` takes (ShellHomeSystemMonitorGaps, kol-monitor 2026-08-27: the overlay read `keys` while the settings block read `combo`; `combo` is the name, `keys` is tolerated for a release)
|
|
42
45
|
* @param {Function} props.onClose
|
|
43
46
|
* @param {string} [props.title] the header, beside the × (default `Shortcuts`)
|
|
44
|
-
* @param {'overlay'|'rail'} [props.variant] centred (default) or the right rail — SettingsPanel's two forms, so an app
|
|
45
|
-
* never hand-builds the rail (kol-monitor's ShortcutsRail, 2026-10-18)
|
|
47
|
+
* @param {'overlay'|'rail'|'folio'|'kolbox'} [props.variant] centred (default) or the right rail — SettingsPanel's two forms, so an app
|
|
48
|
+
* never hand-builds the rail (kol-monitor's ShortcutsRail, 2026-10-18). `folio` (Folio migration batch B, 2026-11-22):
|
|
49
|
+
* Folio's list (its KeysPanel, carried class for class): `ModalShell variant="folio"` 460 wide centred on the Folio dim,
|
|
50
|
+
* the title as a label, then each key under a rule, the label in body text and the combo in Folio's green. Flat
|
|
51
|
+
* `shortcuts` only; drawn in place, never portalled, so it keeps the frame's `data-folio-*`. Escape and a press on the
|
|
52
|
+
* dim close it. `kolbox` (Folio on kolbox, 2026-11-22): kolbox's S sheet, `CommandOverlay variant="kolbox"
|
|
53
|
+
* mode="shortcuts"`, from the same array (see `ShortcutsOverlayKolbox`)
|
|
46
54
|
* @param {string} [props.currentPath] sections may carry `routes: ['/rack']` (CommandOverlayModes, kol-monitor
|
|
47
55
|
* 2026-10-17 — user: *"im in dev, how can I cable lock here?"*): with a path, only the sections that work here
|
|
48
56
|
* are drawn (ShortcutsOverlayList, kol-monitor 2026-10-18 — the muted ELSEWHERE block is gone). A section without `routes`
|
|
@@ -58,7 +66,43 @@ const isSectioned = (list) => Array.isArray(list?.[0]?.items)
|
|
|
58
66
|
/* ONE OVERLAY, NOT TWO (user 2026-10-18, retiring the near-copy): the sheet is `SettingsPanel variant="overlay"` —
|
|
59
67
|
* the title on the header with the × beside it, a Divider, then the sections exactly as monitor's ⇧S rail draws
|
|
60
68
|
* them (LabeledControlSection divided · SettingsRow text · the combo in mono). Same props as before, plus `title`. */
|
|
69
|
+
function ShortcutsOverlayFolio({ shortcuts = [], onClose, title = 'Shortcuts' }) {
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const esc = (e) => e.key === 'Escape' && onClose?.()
|
|
72
|
+
addEventListener('keydown', esc)
|
|
73
|
+
return () => removeEventListener('keydown', esc)
|
|
74
|
+
}, [onClose])
|
|
75
|
+
return (
|
|
76
|
+
<div className="kol-modal-dim--folio fixed inset-0 z-50 flex items-center justify-center px-[16px]" onMouseDown={onClose}>
|
|
77
|
+
<ModalShell variant="folio" role="dialog" aria-label={title} onMouseDown={(e) => e.stopPropagation()} className="kol-shortcuts--folio w-full max-w-[460px] gap-[4px] p-[20px]">
|
|
78
|
+
<p className="kol-folio-label kol-shortcuts-title--folio pb-[10px]">{title}</p>
|
|
79
|
+
{shortcuts.map((it) => (
|
|
80
|
+
<div key={it.label} className="kol-shortcuts-row--folio flex items-baseline justify-between gap-[16px] border-t py-[9px]">
|
|
81
|
+
<span className="kol-folio-body">{it.label}</span>
|
|
82
|
+
<kbd className="kol-folio-meta kol-shortcuts-combo--folio whitespace-nowrap">{it.combo ?? it.keys}</kbd>
|
|
83
|
+
</div>
|
|
84
|
+
))}
|
|
85
|
+
</ModalShell>
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* `variant="kolbox"` (Folio on kolbox, 2026-11-22): kolbox's S sheet, which kolbox draws as `CommandOverlay variant="kolbox"
|
|
91
|
+
* mode="shortcuts"` (its WindowShortcuts), from the same `shortcuts`: one group under `title`; a sectioned list's sections
|
|
92
|
+
* are its folds, open. A combo that is one key chord is drawn as key caps, any other text (`S, or ⌥S while writing`) as
|
|
93
|
+
* the row's hint. The sheet keeps its own lit row; Escape and the dim close it. */
|
|
94
|
+
function ShortcutsOverlayKolbox({ shortcuts = [], onClose, currentPath, title }) {
|
|
95
|
+
const [active, setActive] = useState(0)
|
|
96
|
+
const row = (it, i, at = '') => ({ id: `${at}${i}:${it.label}`, label: it.label, hint: it.combo ?? it.keys, kbd: isKeyCombo(it.combo ?? it.keys) })
|
|
97
|
+
const rows = isSectioned(shortcuts)
|
|
98
|
+
? shortcuts.filter((s) => shortcutInScope(s, currentPath)).map((s, n) => ({ id: `cat:${s.section ?? n}`, label: s.section, open: true, items: (s.items ?? []).map((it, i) => row(it, i, `${n}/`)) }))
|
|
99
|
+
: shortcuts.map((it, i) => row(it, i))
|
|
100
|
+
return <CommandOverlay variant="kolbox" open mode="shortcuts" onClose={onClose} groups={[{ title, rows }]} active={active} onActive={setActive} />
|
|
101
|
+
}
|
|
102
|
+
|
|
61
103
|
export default function ShortcutsOverlay({ shortcuts = [], onClose, currentPath, title = 'Shortcuts', variant = 'overlay' }) {
|
|
104
|
+
if (variant === 'kolbox') return <ShortcutsOverlayKolbox shortcuts={shortcuts} onClose={onClose} currentPath={currentPath} title={title} />
|
|
105
|
+
if (variant === 'folio') return <ShortcutsOverlayFolio shortcuts={shortcuts} onClose={onClose} title={title} />
|
|
62
106
|
const sections = isSectioned(shortcuts)
|
|
63
107
|
? shortcuts.filter((s) => shortcutInScope(s, currentPath))
|
|
64
108
|
: [{ items: shortcuts }]
|
|
@@ -40,7 +40,8 @@ const HANDLE_R = 7
|
|
|
40
40
|
const HUE_GRADIENT =
|
|
41
41
|
'linear-gradient(to right, hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%), hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%))'
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
/* (the default look; the exported HueStrip below picks the look)
|
|
44
|
+
*
|
|
44
45
|
* HueStrip — A hue slider. 1D hue slider: a rainbow bar with a draggable knob. Pointer
|
|
45
46
|
* drag anywhere on the strip; focus + Left/Right (or Down/Up) arrow keys
|
|
46
47
|
* nudge hue by 1° (role="slider").
|
|
@@ -48,7 +49,7 @@ const HUE_GRADIENT =
|
|
|
48
49
|
* @param {number} hue controlled hue, 0–360
|
|
49
50
|
* @param {Function} onChange (hue: number) => void — fires on press, drag, and arrow keys
|
|
50
51
|
*/
|
|
51
|
-
|
|
52
|
+
function HueStripDefault({ hue, onChange }) {
|
|
52
53
|
const ref = useRef(null)
|
|
53
54
|
const dragging = useRef(false)
|
|
54
55
|
|
|
@@ -103,7 +104,7 @@ export function HueStrip({ hue, onChange }) {
|
|
|
103
104
|
aria-valuenow={Math.round(hue)}
|
|
104
105
|
onPointerDown={onDown}
|
|
105
106
|
onKeyDown={onKeyDown}
|
|
106
|
-
className="relative rounded-[var(--kol-radius-
|
|
107
|
+
className="relative rounded-[var(--kol-radius-2)] cursor-pointer touch-none"
|
|
107
108
|
style={{ height: 12, background: HUE_GRADIENT }}
|
|
108
109
|
>
|
|
109
110
|
{/* Handle positions inside an inset region so 0..100% maps to the
|
|
@@ -118,7 +119,8 @@ export function HueStrip({ hue, onChange }) {
|
|
|
118
119
|
/* the transparency checker behind an alpha ramp — literal greys, like the spectra (not themeable) */
|
|
119
120
|
const CHECKER = 'repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 0 0 / 8px 8px'
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
/* (the default look; the exported AlphaStrip below picks the look)
|
|
123
|
+
*
|
|
122
124
|
* AlphaStrip — An opacity slider. HueStrip's twin for alpha: the colour ramped from transparent to
|
|
123
125
|
* opaque over a checker, same knob, same inset (ColorPickerPopover, kol-monitor 2026-10-17). Focus +
|
|
124
126
|
* Left/Right (or Down/Up) nudge alpha by 1% (role="slider").
|
|
@@ -127,7 +129,7 @@ const CHECKER = 'repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 0 0 / 8px 8p
|
|
|
127
129
|
* @param {string} color the opaque colour the ramp ends on (any CSS colour)
|
|
128
130
|
* @param {Function} onChange (alpha: number) => void — fires on press, drag, and arrow keys
|
|
129
131
|
*/
|
|
130
|
-
|
|
132
|
+
function AlphaStripDefault({ alpha, color, onChange }) {
|
|
131
133
|
const ref = useRef(null)
|
|
132
134
|
const dragging = useRef(false)
|
|
133
135
|
|
|
@@ -173,7 +175,7 @@ export function AlphaStrip({ alpha, color, onChange }) {
|
|
|
173
175
|
aria-valuenow={Math.round(alpha * 100)}
|
|
174
176
|
onPointerDown={(e) => { dragging.current = true; update(e.clientX); e.preventDefault() }}
|
|
175
177
|
onKeyDown={onKeyDown}
|
|
176
|
-
className="relative rounded-[var(--kol-radius-
|
|
178
|
+
className="relative rounded-[var(--kol-radius-2)] cursor-pointer touch-none"
|
|
177
179
|
style={{ height: 12, background: `linear-gradient(to right, transparent, ${color}), ${CHECKER}` }}
|
|
178
180
|
>
|
|
179
181
|
<div className="absolute inset-y-0" style={{ left: HANDLE_R, right: HANDLE_R }}>
|
|
@@ -183,10 +185,11 @@ export function AlphaStrip({ alpha, color, onChange }) {
|
|
|
183
185
|
)
|
|
184
186
|
}
|
|
185
187
|
|
|
186
|
-
|
|
188
|
+
/* (the default look; the exported SBSquare below picks the look)
|
|
189
|
+
*
|
|
187
190
|
* SBSquare — Pick saturation and value on a square. 2D saturation/value picker: white→hue horizontal gradient with
|
|
188
191
|
* a black overlay fading upward, crosshair handle. Fills its container
|
|
189
|
-
* (consumer owns the size — and the rounding: apply `rounded-[var(--kol-radius-
|
|
192
|
+
* (consumer owns the size — and the rounding: apply `rounded-[var(--kol-radius-2)]
|
|
190
193
|
* overflow-hidden` on the wrapper). Focus + arrow keys nudge: Left/Right =
|
|
191
194
|
* saturation ±1, Up/Down = value ±1 (role="slider").
|
|
192
195
|
*
|
|
@@ -195,7 +198,7 @@ export function AlphaStrip({ alpha, color, onChange }) {
|
|
|
195
198
|
* @param {number} val controlled value/brightness, 0–100
|
|
196
199
|
* @param {Function} onChange (sat: number, val: number) => void
|
|
197
200
|
*/
|
|
198
|
-
|
|
201
|
+
function SBSquareDefault({ hue, sat, val, onChange }) {
|
|
199
202
|
const ref = useRef(null)
|
|
200
203
|
const dragging = useRef(false)
|
|
201
204
|
|
|
@@ -242,7 +245,7 @@ export function SBSquare({ hue, sat, val, onChange }) {
|
|
|
242
245
|
|
|
243
246
|
const sb = `linear-gradient(to bottom, transparent 0%, #000 100%), linear-gradient(to right, #fff 0%, hsl(${hue},100%,50%) 100%)`
|
|
244
247
|
/* Gradient field is rectangular — rounding is the consumer's job (apply
|
|
245
|
-
* `rounded-[var(--kol-radius-
|
|
248
|
+
* `rounded-[var(--kol-radius-2)] overflow-hidden` on the wrapper). Putting border-radius
|
|
246
249
|
* on the gradient itself produces tiny antialiasing artifacts at the
|
|
247
250
|
* corners; clipping via overflow-hidden on the parent is cleaner. */
|
|
248
251
|
return (
|
|
@@ -313,8 +316,13 @@ function vertexAt(angleRad) {
|
|
|
313
316
|
* @param {number} val controlled value/brightness, 0–100
|
|
314
317
|
* @param {Function} onChangeHue (hue: number) => void — ring drag / hue arrow keys
|
|
315
318
|
* @param {Function} onChangeSV (sat: number, val: number) => void — triangle drag / value arrow keys
|
|
319
|
+
* @param {'default'|'kolbox'} [variant='default'] `kolbox` (kolbox's ColorWheel, plan-2026-11-18-kolbox-system W31.2,
|
|
320
|
+
* 2026-11-18): the same wheel, its handles a ring in the ink over a hairline of the ground (so it reads on the
|
|
321
|
+
* triangle's white corner) and a round focus ring in the accent, 2 out. Chrome in kol-theme `.kol-wheel-triangle--kolbox`.
|
|
322
|
+
* @param {string} [className] extra classes on the wrapper
|
|
316
323
|
*/
|
|
317
|
-
export function WheelTriangle({ hue, sat, val, onChangeHue, onChangeSV }) {
|
|
324
|
+
export function WheelTriangle({ hue, sat, val, onChangeHue, onChangeSV, variant = 'default', className = '' }) {
|
|
325
|
+
const kolbox = variant === 'kolbox'
|
|
318
326
|
const svgRef = useRef(null)
|
|
319
327
|
const dragMode = useRef(null) /* { type: 'ring' } | { type: 'tri', offsetX, offsetY } | null */
|
|
320
328
|
|
|
@@ -459,7 +467,9 @@ export function WheelTriangle({ hue, sat, val, onChangeHue, onChangeSV }) {
|
|
|
459
467
|
aria-valuenow={Math.round(hue)}
|
|
460
468
|
aria-valuetext={`Hue ${Math.round(hue)} degrees, saturation ${Math.round(sat)}%, brightness ${Math.round(val)}%`}
|
|
461
469
|
onKeyDown={onKeyDown}
|
|
462
|
-
className=
|
|
470
|
+
className={kolbox
|
|
471
|
+
? `kol-wheel-triangle--kolbox aspect-square max-h-full max-w-full rounded-full outline-none focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-offset-2 ${className}`
|
|
472
|
+
: `aspect-square max-h-full max-w-full ${className}`.trim()}
|
|
463
473
|
>
|
|
464
474
|
<svg
|
|
465
475
|
ref={svgRef}
|
|
@@ -509,8 +519,8 @@ export function WheelTriangle({ hue, sat, val, onChangeHue, onChangeSV }) {
|
|
|
509
519
|
<polygon points={trianglePoints} fill={`url(#${blackFadeId})`} />
|
|
510
520
|
|
|
511
521
|
{/* Handles. Ring handle is larger than the SV handle to match the Ref. */}
|
|
512
|
-
<SvgHandle cx={ringHx} cy={ringHy} r={3.2} />
|
|
513
|
-
<SvgHandle cx={handleX} cy={handleY} r={2.0} />
|
|
522
|
+
<SvgHandle cx={ringHx} cy={ringHy} r={3.2} kolbox={kolbox} />
|
|
523
|
+
<SvgHandle cx={handleX} cy={handleY} r={2.0} kolbox={kolbox} />
|
|
514
524
|
</svg>
|
|
515
525
|
</div>
|
|
516
526
|
)
|
|
@@ -536,11 +546,12 @@ function Handle({ left, top }) {
|
|
|
536
546
|
|
|
537
547
|
/* SVG handle for WheelTriangle. Two concentric circles to stay sharp at any
|
|
538
548
|
* zoom — outer black halo + white outline. */
|
|
539
|
-
function SvgHandle({ cx, cy, r = 2.4 }) {
|
|
549
|
+
function SvgHandle({ cx, cy, r = 2.4, kolbox = false }) {
|
|
550
|
+
/* kolbox: the ring in the ink over a hairline of the ground (the theme's `.kol-wheel-triangle--kolbox` strokes) */
|
|
540
551
|
return (
|
|
541
552
|
<g pointerEvents="none">
|
|
542
|
-
<circle cx={cx} cy={cy} r={r + 0.5} fill="none" stroke=
|
|
543
|
-
<circle cx={cx} cy={cy} r={r} fill="none" stroke=
|
|
553
|
+
<circle cx={cx} cy={cy} r={r + 0.5} fill="none" stroke={kolbox ? undefined : '#000'} className={kolbox ? 'kol-wheel-triangle-halo' : undefined} strokeOpacity="0.7" strokeWidth="0.5" />
|
|
554
|
+
<circle cx={cx} cy={cy} r={r} fill="none" stroke={kolbox ? undefined : '#FFF'} className={kolbox ? 'kol-wheel-triangle-ring' : undefined} strokeWidth="1.4" />
|
|
544
555
|
</g>
|
|
545
556
|
)
|
|
546
557
|
}
|
|
@@ -548,7 +559,7 @@ function SvgHandle({ cx, cy, r = 2.4 }) {
|
|
|
548
559
|
/**
|
|
549
560
|
* SpectrumControls — A hue strip over a saturation square. The composed classic square picker: HueStrip stacked
|
|
550
561
|
* over a fill-height SBSquare, per the source color panel's Hue mode layout
|
|
551
|
-
* (SBSquare wrapped in `rounded-[var(--kol-radius-
|
|
562
|
+
* (SBSquare wrapped in `rounded-[var(--kol-radius-2)] overflow-hidden`, see its comment).
|
|
552
563
|
* Fills its container — the consumer owns the outer size. For the ring
|
|
553
564
|
* picker, use WheelTriangle directly; the primitives are also exported for
|
|
554
565
|
* custom layouts.
|
|
@@ -564,9 +575,91 @@ export default function SpectrumControls({ value, onChange }) {
|
|
|
564
575
|
return (
|
|
565
576
|
<div className="flex flex-col gap-3 w-full h-full min-h-0">
|
|
566
577
|
<HueStrip hue={hue} onChange={(h) => onChange({ hue: h, sat, val })} />
|
|
567
|
-
<div className="flex-1 min-h-0 rounded-[var(--kol-radius-
|
|
578
|
+
<div className="flex-1 min-h-0 rounded-[var(--kol-radius-2)] overflow-hidden">
|
|
568
579
|
<SBSquare hue={hue} sat={sat} val={val} onChange={(s, v) => onChange({ hue, sat: s, val: v })} />
|
|
569
580
|
</div>
|
|
570
581
|
</div>
|
|
571
582
|
)
|
|
572
583
|
}
|
|
584
|
+
|
|
585
|
+
/* ── kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18) ─────────────────────────────────────────────────
|
|
586
|
+
* kolbox's ColorField, HueSlider and OpacitySlider, carried from apps/kolbox/src/ui as `variant="kolbox"` of SBSquare,
|
|
587
|
+
* HueStrip and AlphaStrip, on these parts' own words (`hue`, `sat` and `val` 0–100, `alpha` 0–1). Pointer down and drag,
|
|
588
|
+
* no keys (kolbox's have none); the handle a 12 ring in the ink. `className` lands on the part. */
|
|
589
|
+
|
|
590
|
+
/* pointer down on the element and drag: move(x, y), each clamped to 0..1 of its box */
|
|
591
|
+
function dragKolbox(e, move) {
|
|
592
|
+
const box = e.currentTarget
|
|
593
|
+
const at = (ev) => { const r = box.getBoundingClientRect(); move(Math.min(1, Math.max(0, (ev.clientX - r.left) / r.width)), Math.min(1, Math.max(0, (ev.clientY - r.top) / r.height))) }
|
|
594
|
+
box.setPointerCapture(e.pointerId)
|
|
595
|
+
at(e)
|
|
596
|
+
const up = () => { box.removeEventListener('pointermove', at); box.removeEventListener('pointerup', up) }
|
|
597
|
+
box.addEventListener('pointermove', at)
|
|
598
|
+
box.addEventListener('pointerup', up)
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/* the saturation and brightness square at the hue (Figma plan W13 state 4); onChange(sat, val) */
|
|
602
|
+
function SBSquareKolbox({ hue = 0, sat = 100, val = 100, onChange, className = '' }) {
|
|
603
|
+
return (
|
|
604
|
+
<div
|
|
605
|
+
role="slider"
|
|
606
|
+
aria-label="Saturation and brightness"
|
|
607
|
+
aria-valuetext={`${Math.round(sat)}%, ${Math.round(val)}%`}
|
|
608
|
+
onPointerDown={(e) => dragKolbox(e, (x, y) => onChange?.(x * 100, (1 - y) * 100))}
|
|
609
|
+
className={`relative aspect-square w-full cursor-crosshair touch-none ${className}`}
|
|
610
|
+
style={{ background: `linear-gradient(to top, black, transparent), linear-gradient(to right, white, hsl(${hue} 100% 50%))` }}
|
|
611
|
+
>
|
|
612
|
+
<span className="kol-spectrum-handle--kolbox pointer-events-none absolute size-3 -translate-1/2 rounded-full" style={{ left: `${sat}%`, top: `${100 - val}%` }} />
|
|
613
|
+
</div>
|
|
614
|
+
)
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/* the hue run, 0 to 360, 12 high, its thumb the hue */
|
|
618
|
+
function HueStripKolbox({ hue = 0, onChange, className = '' }) {
|
|
619
|
+
return (
|
|
620
|
+
<div
|
|
621
|
+
role="slider"
|
|
622
|
+
aria-label="Hue"
|
|
623
|
+
aria-valuemin={0}
|
|
624
|
+
aria-valuemax={360}
|
|
625
|
+
aria-valuenow={Math.round(hue)}
|
|
626
|
+
onPointerDown={(e) => dragKolbox(e, (x) => onChange?.(x * 360))}
|
|
627
|
+
className={`relative h-3 w-full cursor-pointer touch-none rounded-full ${className}`}
|
|
628
|
+
style={{ background: 'linear-gradient(to right, hsl(0 100% 50%), hsl(60 100% 50%), hsl(120 100% 50%), hsl(180 100% 50%), hsl(240 100% 50%), hsl(300 100% 50%), hsl(360 100% 50%))' }}
|
|
629
|
+
>
|
|
630
|
+
<span className="kol-spectrum-handle--kolbox pointer-events-none absolute top-1/2 size-3 -translate-1/2 rounded-full" style={{ left: `${(hue / 360) * 100}%`, background: `hsl(${hue} 100% 50%)` }} />
|
|
631
|
+
</div>
|
|
632
|
+
)
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/* the opacity run, clear to `color` over the checker; onChange(alpha), in whole percents */
|
|
636
|
+
function AlphaStripKolbox({ alpha = 1, color = 'currentColor', onChange, className = '' }) {
|
|
637
|
+
const value = alpha * 100
|
|
638
|
+
return (
|
|
639
|
+
<div
|
|
640
|
+
role="slider"
|
|
641
|
+
aria-label="Opacity"
|
|
642
|
+
aria-valuemin={0}
|
|
643
|
+
aria-valuemax={100}
|
|
644
|
+
aria-valuenow={Math.round(value)}
|
|
645
|
+
onPointerDown={(e) => dragKolbox(e, (x) => onChange?.(Math.round(x * 100) / 100))}
|
|
646
|
+
className={`kol-alpha-strip--kolbox relative h-3 w-full cursor-pointer touch-none rounded-full ${className}`}
|
|
647
|
+
>
|
|
648
|
+
<span className="absolute inset-0 rounded-full" style={{ background: `linear-gradient(to right, transparent, ${color})` }} />
|
|
649
|
+
<span className="kol-spectrum-handle--kolbox pointer-events-none absolute top-1/2 size-3 -translate-1/2 rounded-full" style={{ left: `${value}%` }} />
|
|
650
|
+
</div>
|
|
651
|
+
)
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/** SBSquare — Pick saturation and value on a square. @param {'default'|'kolbox'} [variant] `kolbox`: kolbox's ColorField (above) */
|
|
655
|
+
export function SBSquare(props) {
|
|
656
|
+
return props.variant === 'kolbox' ? <SBSquareKolbox {...props} /> : <SBSquareDefault {...props} />
|
|
657
|
+
}
|
|
658
|
+
/** HueStrip — A hue slider. @param {'default'|'kolbox'} [variant] `kolbox`: kolbox's HueSlider (above) */
|
|
659
|
+
export function HueStrip(props) {
|
|
660
|
+
return props.variant === 'kolbox' ? <HueStripKolbox {...props} /> : <HueStripDefault {...props} />
|
|
661
|
+
}
|
|
662
|
+
/** AlphaStrip — An opacity slider. @param {'default'|'kolbox'} [variant] `kolbox`: kolbox's OpacitySlider (above) */
|
|
663
|
+
export function AlphaStrip(props) {
|
|
664
|
+
return props.variant === 'kolbox' ? <AlphaStripKolbox {...props} /> : <AlphaStripDefault {...props} />
|
|
665
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StatusBar — a document's status along its foot (Folio's StatusBar, 2026-11-22): the counts on the left, the host's
|
|
3
|
+
* cells on the right (the format, the language, the zoom, the encoding). It holds no state; the cells are the host's.
|
|
4
|
+
* Spaces in `left` are kept (Folio spaces its counts with them). Chrome in kol-theme `.kol-status-bar--kolbox` and
|
|
5
|
+
* `.kol-status-bar--folio`.
|
|
6
|
+
*
|
|
7
|
+
* <StatusBar left="212 words 1,204 characters 18 lines">
|
|
8
|
+
* <Dropdown variant="kolbox" ... /><span>UTF-8 LF</span>
|
|
9
|
+
* </StatusBar>
|
|
10
|
+
*
|
|
11
|
+
* @param {'kolbox'|'folio'} [variant='kolbox'] - kolbox: 32 high on the rail ground, the kolbox line over it, the text
|
|
12
|
+
* kolbox's help voice (11 / 15), the counts in oq-64. folio: Folio's bar carried class for class (40, its rule, meta).
|
|
13
|
+
* @param {ReactNode} [left] - The text on the left
|
|
14
|
+
* @param {ReactNode} [children] - The right-hand cells, 16 apart (folio 24)
|
|
15
|
+
* @param {string} [className] - Extra classes on the bar
|
|
16
|
+
*/
|
|
17
|
+
export default function StatusBar({ variant = 'kolbox', left, children, className = '' }) {
|
|
18
|
+
if (variant === 'folio') return (
|
|
19
|
+
<div className={`kol-status-bar--folio flex h-[40px] shrink-0 items-center justify-between gap-[24px] whitespace-pre border-t px-[56px] ${className}`.trim()}>
|
|
20
|
+
<p className="kol-status-bar-left">{left}</p>
|
|
21
|
+
<div className="flex items-center gap-[24px]">{children}</div>
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
return (
|
|
25
|
+
<div className={`kol-status-bar--kolbox kol-kolbox-help flex h-8 shrink-0 items-center justify-between gap-4 whitespace-pre border-t pr-2 pl-3 ${className}`.trim()}>
|
|
26
|
+
<p className="kol-status-bar-left min-w-0 overflow-hidden text-ellipsis">{left}</p>
|
|
27
|
+
<div className="flex shrink-0 items-center gap-4">{children}</div>
|
|
28
|
+
</div>
|
|
29
|
+
)
|
|
30
|
+
}
|