@kolkrabbi/kol-component 0.377.0 → 0.379.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/BezierPathEditor.jsx +1 -1
- package/src/atoms/Button.jsx +84 -1
- package/src/atoms/Figure.jsx +19 -1
- package/src/atoms/FunctionPlot.jsx +1 -1
- package/src/atoms/Input.jsx +105 -1
- package/src/atoms/Kbd.jsx +42 -2
- package/src/atoms/Link.jsx +20 -0
- package/src/atoms/OriginPicker.jsx +9 -5
- package/src/atoms/SectionFooter.jsx +22 -0
- package/src/atoms/SectionHeader.jsx +24 -0
- package/src/atoms/SizeOrDownload.jsx +1 -1
- package/src/atoms/Textarea.jsx +11 -2
- package/src/atoms/ToggleCheckbox.jsx +23 -1
- package/src/atoms/ToggleSwitch.jsx +39 -0
- package/src/atoms/ViewToggle.jsx +2 -2
- package/src/atoms/XYPad.jsx +25 -0
- package/src/hooks/useDragResize.js +1 -1
- package/src/index.js +26 -3
- package/src/molecules/AccountMenu.jsx +14 -1
- package/src/molecules/AlignmentGrid.jsx +13 -1
- package/src/molecules/ButtonGroup.jsx +73 -1
- package/src/molecules/ButtonSplit.jsx +64 -3
- 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 +3 -3
- package/src/molecules/DividerLabel.jsx +19 -0
- package/src/molecules/Dropdown.jsx +111 -1
- package/src/molecules/DropdownStepper.jsx +29 -0
- package/src/molecules/FieldPair.jsx +41 -2
- package/src/molecules/Header.jsx +8 -4
- package/src/molecules/LabeledControl.jsx +51 -0
- package/src/molecules/Menu.jsx +239 -3
- package/src/molecules/Modal.jsx +216 -10
- package/src/molecules/ModalShell.jsx +21 -8
- package/src/molecules/OptionRow.jsx +1 -1
- package/src/molecules/ParamBindDot.jsx +29 -2
- package/src/molecules/QuantityInput.jsx +48 -0
- package/src/molecules/RailFloat.jsx +4 -3
- package/src/molecules/RailHeader.jsx +32 -2
- package/src/molecules/SectionText.jsx +54 -1
- package/src/molecules/Slider.jsx +101 -2
- 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 +35 -1
- package/src/molecules/Toast.jsx +55 -0
- package/src/molecules/TreeRow.jsx +87 -1
- 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 +396 -21
- 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 -1
- package/src/organisms/MediaLibraryPages.jsx +1 -1
- package/src/organisms/Rail.jsx +33 -1
- package/src/organisms/RailSwitcher.jsx +62 -0
- package/src/organisms/ReadingContents.jsx +63 -1
- package/src/organisms/SectionSplit.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +64 -6
- 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 +141 -2
- 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 +298 -2
- package/src/utilities/SelectionOverlay.jsx +74 -1
- package/src/utilities/kolboxGlyph.jsx +10 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useMemo, useRef } from 'react'
|
|
2
|
+
import { system, systemDrag, grid } from '@kolkrabbi/kol-tuner'
|
|
3
|
+
import { Board, Keylines, Labels, inksOf, useLight } from './logoBoard.jsx'
|
|
4
|
+
|
|
5
|
+
/* LOGOSYSTEM (W27.4, 2026-11-19): the System board of @kolkrabbi/kol-tuner (the canvas's system-01-arcs), a mark built
|
|
6
|
+
* from measures, nothing placed by hand. It draws the form, the wedges, the construction and the math, the grid, the
|
|
7
|
+
* keylines, a reference image and the six handles (y, axisAt, x, angle, footAt, footSize). The settings are the host's:
|
|
8
|
+
* `settings` is the engine's System props as they stand, a handle drag calls `onDrag(key, value)` with the measure under
|
|
9
|
+
* the pointer, a double-click on a handle calls `onDragReset()`, a file dropped on the board calls `onFile(file)`.
|
|
10
|
+
* `reference` is `{ src, w, h }`, drawn faint behind the form. `peek` draws the form alone. */
|
|
11
|
+
export default function LogoSystem({ settings: p, reference, peek = false, onDrag, onDragReset, onFile, className = '' }) {
|
|
12
|
+
const inks = inksOf(p), themeLight = useLight(), light = inks ? inks.light : themeLight, svg = useRef(null), dragging = useRef(null)
|
|
13
|
+
const v = useMemo(() => system(p), [p])
|
|
14
|
+
const grey = p.fill === 'grey', strokeAlpha = grey ? 0.85 : 0.5
|
|
15
|
+
const gridD = p.grid && p.grid !== 'off' && !peek && v.measures ? grid(p.grid, (+p.gridStep || 1) * v.measures.x * (v.box || 480), +p.gridTurn || 0) : ''
|
|
16
|
+
const at = (e) => { const pt = svg.current.createSVGPoint(); pt.x = e.clientX; pt.y = e.clientY; const q = pt.matrixTransform(svg.current.getScreenCTM().inverse()); return [q.x - 600, q.y - 400] }
|
|
17
|
+
const move = (e) => { const k = dragging.current; if (!k) return; const m = at(e); onDrag?.(k, systemDrag(p, k, m[0], m[1])) }
|
|
18
|
+
const refBox = reference && (() => { const k = Math.min(v.box / reference.w, v.box / reference.h), w = reference.w * k, h = reference.h * k; return { x: -w / 2, y: -h / 2, w, h } })()
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className={`h-full w-full ${className}`.trim()} onDragOver={(e) => e.preventDefault()} onDrop={(e) => { e.preventDefault(); onFile?.(e.dataTransfer.files[0]) }}>
|
|
22
|
+
<Board svgRef={svg} inks={inks} label="Mark built from a few measures">
|
|
23
|
+
{refBox && <image href={reference.src} x={refBox.x} y={refBox.y} width={refBox.w} height={refBox.h} className="kol-logo-ref" />}
|
|
24
|
+
{gridD && <path d={gridD} className="kol-logo-grid" />}
|
|
25
|
+
<path d={v.d} className={`kol-logo-form${grey && !peek ? ' is-grey' : ''}`} />
|
|
26
|
+
{!peek && p.math && <path d={v.wedges} className="kol-logo-wedges" />}
|
|
27
|
+
{!peek && <path d={(p.construction ? v.guides : '') + (p.math ? v.dims : '')} className="kol-logo-lines" opacity={strokeAlpha} />}
|
|
28
|
+
{!peek && p.handles && v.handlePts.map((h) => (
|
|
29
|
+
<circle key={h.k} data-handle={h.k} cx={h.p[0]} cy={h.p[1]} r="9" className="kol-logo-handle"
|
|
30
|
+
onPointerDown={(e) => { e.preventDefault(); e.stopPropagation(); dragging.current = h.k; e.currentTarget.setPointerCapture(e.pointerId) }}
|
|
31
|
+
onPointerMove={move} onPointerUp={() => { dragging.current = null }} onDoubleClick={(e) => { e.preventDefault(); dragging.current = null; onDragReset?.() }} />
|
|
32
|
+
))}
|
|
33
|
+
{p.keylines && !peek && <Keylines box={(v.box || 480) * 1.2} light={light} />}
|
|
34
|
+
{!peek && p.math && <Labels list={v.dimLabels} />}
|
|
35
|
+
</Board>
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import { tuner } from '@kolkrabbi/kol-tuner'
|
|
3
|
+
import { Board, Keylines, Labels, inksOf, useLight } from './logoBoard.jsx'
|
|
4
|
+
|
|
5
|
+
/* LOGOTUNER (W27.4, 2026-11-19): the Tuner board of @kolkrabbi/kol-tuner (the canvas's tuner-01-form), a dropped logo
|
|
6
|
+
* rebuilt from circles and lines on one ladder. It draws the form, the traced line, the circles and dots, the curvature
|
|
7
|
+
* comb, the grid, the keylines and the labels. The settings are the host's: `settings` is the engine's Tuner props,
|
|
8
|
+
* `image` the `Image` it reads (an SVG carries its text as `image.__svg`), and a file dropped on the board or picked by
|
|
9
|
+
* a click calls `onFile(file)`; the host reads it into `image`. `peek` draws the tuned form alone. */
|
|
10
|
+
export default function LogoTuner({ settings: p, image = null, peek = false, onFile, className = '' }) {
|
|
11
|
+
const inks = inksOf(p), themeLight = useLight(), light = inks ? inks.light : themeLight
|
|
12
|
+
const v = useMemo(() => tuner(peek ? { ...p, view: 'tuned' } : p, image), [p, image, peek])
|
|
13
|
+
const grey = p.fill !== 'ink', strokeAlpha = grey ? 0.85 : 0.5
|
|
14
|
+
const pick = (e) => { onFile?.(e.target.files[0]); e.target.value = '' }
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<label className={`block h-full w-full cursor-pointer ${className}`.trim()} title="Choose a logo: an SVG or a black and white image"
|
|
18
|
+
onDragOver={(e) => e.preventDefault()} onDrop={(e) => { e.preventDefault(); onFile?.(e.dataTransfer.files[0]) }}>
|
|
19
|
+
<Board inks={inks} label="A form rebuilt from circles and lines">
|
|
20
|
+
{!peek && v.gridD && <path d={v.gridD} className="kol-logo-grid" />}
|
|
21
|
+
<path d={v.d} className={`kol-logo-form${grey && !peek ? ' is-grey' : ''}`} fillRule={v.fillRule || 'evenodd'} />
|
|
22
|
+
{!peek && [v.comb0, v.comb1, v.comb2].map((d, i) => d && <path key={i} d={d} className={`kol-logo-comb is-${i}`} />)}
|
|
23
|
+
{!peek && p.outline && p.view !== 'original' && <path d={v.orig} className="kol-logo-trace" />}
|
|
24
|
+
{!peek && <path d={(p.construction ? v.circles : '') + (p.math ? v.guides : '')} className="kol-logo-lines" opacity={strokeAlpha} />}
|
|
25
|
+
{!peek && p.construction && <path d={v.dots} className="kol-logo-dots" />}
|
|
26
|
+
{!peek && p.keylines && <Keylines box={(v.box || 480) * 1.2} ox={v.boxX} oy={v.boxY} light={light} />}
|
|
27
|
+
{!peek && p.math && <Labels list={v.labels} />}
|
|
28
|
+
</Board>
|
|
29
|
+
<input type="file" accept="image/*,.svg" aria-label="Choose a logo: an SVG or a black and white image" className="sr-only" onChange={pick} />
|
|
30
|
+
</label>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -864,7 +864,7 @@ function BrowserShell({ onSelect }) {
|
|
|
864
864
|
|
|
865
865
|
const VIEW_OPTIONS = [
|
|
866
866
|
{ value: 'grid', icon: 'grid', label: 'Grid' },
|
|
867
|
-
{ value: 'list', icon: '
|
|
867
|
+
{ value: 'list', icon: 'list-bullet', label: 'List' },
|
|
868
868
|
]
|
|
869
869
|
|
|
870
870
|
/* The path at the FOOT of the picker card; the hidden-system count rides it —
|
|
@@ -141,7 +141,7 @@ const VIEW_OPTIONS = [
|
|
|
141
141
|
|
|
142
142
|
const LAYOUT_OPTIONS = [
|
|
143
143
|
{ value: 'grid', label: 'Grid', icon: 'grid' },
|
|
144
|
-
{ value: 'list', label: 'List', icon: '
|
|
144
|
+
{ value: 'list', label: 'List', icon: 'list-bullet' },
|
|
145
145
|
{ value: 'off', label: 'Off', icon: 'eye-off' },
|
|
146
146
|
]
|
|
147
147
|
/* the stack view the `···` switches (item 15) — the same two ColumnBrowser
|
package/src/organisms/Rail.jsx
CHANGED
|
@@ -57,7 +57,7 @@ const FOCUSABLE =
|
|
|
57
57
|
* @param {ReactNode} nav A RAIL INSIDE THE RAIL (review 2, 2026-10-25 — *"like a siderail in the bottom rail"*): `RailNav`, the
|
|
58
58
|
* collapsed nav rail's 48 icon column, stood at the panel's edge with the header, body and foot
|
|
59
59
|
* padded beside it — so a bottom rail over the nav rail carries its views as glyphs under it
|
|
60
|
-
* @param {'app'|'site'} variant THE TIER (RailKit, kol-monitor 2026-10-24): its width when `width` / `height` is not given
|
|
60
|
+
* @param {'app'|'site'|'kolbox'|'folio'} variant `kolbox` and `folio` are those looks (below). THE TIER (RailKit, kol-monitor 2026-10-24): its width when `width` / `height` is not given
|
|
61
61
|
* (`--kol-rail-w-app` 320 · `--kol-rail-w-site` 380) and its padding (`--kol-pad-rail-app` ·
|
|
62
62
|
* `--kol-pad-rail-site`), kol-theme's tokens — so the settings rail and a page rail of one
|
|
63
63
|
* app are one size. Unset = the rail as before (`--kol-pad-overlay`, the width yours)
|
|
@@ -139,8 +139,40 @@ export function useRailKey(role, onToggle, enabled = true) {
|
|
|
139
139
|
}, [role, enabled])
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's one rail shell, carried from
|
|
143
|
+
* apps/kolbox/src/ui/Rail.jsx. It alone draws the panel fill, the edge line, the 240 width (`--kol-kolbox-rail-w`) and
|
|
144
|
+
* the clip. Slots: `header` and `footer` stay put, the body scrolls. `side` left draws its edge line on the right, right
|
|
145
|
+
* on the left, in the field ink, over the rail's own edge so the content keeps the full 240. `collapsed` the narrow
|
|
146
|
+
* strip, 49 (`--kol-kolbox-rail-w-collapsed`). Under 768 a rail lies along the bottom or stacks in a column: the full
|
|
147
|
+
* width, as tall as its content, its edge line along its top. `aria-label` names it. None of the roles, the scrim, the
|
|
148
|
+
* resize or the phone rule: the look's rails are docked frames. */
|
|
149
|
+
function RailKolbox({ side = 'left', 'aria-label': ariaLabel, header, footer, collapsed = false, children, className = '' }) {
|
|
150
|
+
return (
|
|
151
|
+
<aside
|
|
152
|
+
aria-label={ariaLabel}
|
|
153
|
+
data-rail={side}
|
|
154
|
+
data-collapsed={collapsed || undefined}
|
|
155
|
+
className={`kol-rail--kolbox${collapsed ? ' is-collapsed' : ''} relative flex h-full shrink-0 flex-col overflow-hidden max-md:h-auto before:absolute before:inset-y-0 before:z-10 before:w-px ${side === 'left' ? 'before:right-0' : 'before:left-0'} max-md:before:inset-x-0 max-md:before:top-0 max-md:before:bottom-auto max-md:before:h-px max-md:before:w-auto ${className}`.trim()}
|
|
156
|
+
>
|
|
157
|
+
{header && <div className="shrink-0">{header}</div>}
|
|
158
|
+
<div className="min-h-0 flex-1 overflow-y-auto" data-rail-body>{children}</div>
|
|
159
|
+
{footer && <div className="shrink-0">{footer}</div>}
|
|
160
|
+
</aside>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* `variant="folio"` (Folio migration batch D, 2026-11-22): Folio's edge Rail, carried from apps/folio's EditorChrome.jsx.
|
|
165
|
+
* The bare aside, a column that clips: no fill, no edge, no width, no padding (its content brings Folio's 16, its edge
|
|
166
|
+
* line and width are the caller's `className`). `aria-label` names it (Folio's `label`). None of the roles, the scrim,
|
|
167
|
+
* the resize or the phone rule. */
|
|
168
|
+
function RailFolio({ 'aria-label': ariaLabel, children, className = '' }) {
|
|
169
|
+
return <aside aria-label={ariaLabel} className={`kol-rail--folio flex min-w-0 flex-col overflow-hidden ${className}`.trim()}>{children}</aside>
|
|
170
|
+
}
|
|
171
|
+
|
|
142
172
|
/* the role's shell, the phone rule over it, then whatever the call site passed (an `undefined` prop is not a pass) */
|
|
143
173
|
export default function Rail({ role, ...props }) {
|
|
174
|
+
if (props.variant === 'kolbox') return <RailKolbox {...props} />
|
|
175
|
+
if (props.variant === 'folio') return <RailFolio {...props} />
|
|
144
176
|
const phone = useMediaQuery('(max-width: 767px)')
|
|
145
177
|
const r = role ? RAIL_ROLES[role] : null
|
|
146
178
|
if (role && !r && import.meta.env?.DEV) console.warn(`Rail: no role "${role}" — patch · page · settings · bottom`)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { forwardRef } from 'react'
|
|
2
|
+
/* taxonomy-ok: organism — nests Tooltip (utility) and IconLoader (atom) in a full-height Rail of its own. */
|
|
3
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
4
|
+
import { Tooltip } from '../utilities/Popover.jsx'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* RailSwitcher — the narrow Rail at the far left that switches spaces (plan-2026-11-20-kolbox-everything-left W1.1). Top
|
|
8
|
+
* to bottom: the mark (it opens the host's main menu), a divider, the spaces, and the foot rows at the bottom. Measured
|
|
9
|
+
* on Figma's own navigation bar in Chrome 2026-11-20, and again by the rig 2026-11-23 (plan-2026-11-23-editor-measured-
|
|
10
|
+
* against-figma W2, _tmp/2026-11-23-editor-diff): 48 wide plus its 1 edge line (49), the mark a 32 square at 8 in and 8
|
|
11
|
+
* down (4 padding round its glyph); the divider 16 by 1 under it. Each space is a 48 by 40 row, the full width, 4 above
|
|
12
|
+
* and below, the rows touching, the first at 56; its lit and hover wash a 32 tile centred in it (the kit's track radius).
|
|
13
|
+
* The glyph is drawn at 20: Figma's read 10 to 14 inside their 24 box, the set's at 20 draws 12 to 15.
|
|
14
|
+
* The host owns the list: a space is added by adding a row.
|
|
15
|
+
*
|
|
16
|
+
* @param {'kolbox'} variant the one look so far: kolbox's panel, its edge line (`--kol-kolbox-line`), the lit tile a neutral wash
|
|
17
|
+
* (the field fill) with the plain ink, Figma's way (plan-2026-11-23-editor-measured-against-figma W4: the accent is kept for
|
|
18
|
+
* the primary button, the active tool and selection).
|
|
19
|
+
* @param {string} markIcon the mark's glyph (your icons), plain, no tile fill (W4)
|
|
20
|
+
* @param {string} [markLabel] its tooltip and name (default "Main menu")
|
|
21
|
+
* @param {boolean} [markOpen] the main menu is open (the tile stays lit)
|
|
22
|
+
* @param {Function} [onMark] a press on the mark
|
|
23
|
+
* @param {Array} items the spaces [{ value, icon, label }]
|
|
24
|
+
* @param {Array} [foot] the rows at the foot [{ value?, icon, label, onClick? }]
|
|
25
|
+
* @param {string} [value] the current space's value (lit)
|
|
26
|
+
* @param {Function} [onSelect] called with the pressed row (a space, or a foot row without its own onClick)
|
|
27
|
+
* The mark's element is the forwarded ref, so a host anchors its menu on it.
|
|
28
|
+
*/
|
|
29
|
+
const tile = 'inline-flex size-8 items-center justify-center rounded-track'
|
|
30
|
+
const rowCls = 'group flex h-10 w-12 shrink-0 items-center justify-center gap-0.5 py-1'
|
|
31
|
+
const focus = 'outline-none focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-accent'
|
|
32
|
+
|
|
33
|
+
function Row({ row, lit, onSelect }) {
|
|
34
|
+
return (
|
|
35
|
+
<Tooltip variant="kolbox" asChild label={row.label}>
|
|
36
|
+
<button type="button" aria-label={row.label} aria-current={lit ? 'page' : undefined} data-space={row.value}
|
|
37
|
+
onClick={() => (row.onClick ? row.onClick() : onSelect?.(row))}
|
|
38
|
+
className={`${rowCls} ${focus}`}>
|
|
39
|
+
<span className={`${tile} ${lit ? 'bg-field text-text' : 'text-text group-hover:bg-field'}`}><IconLoader name={row.icon} size={18} /></span>
|
|
40
|
+
</button>
|
|
41
|
+
</Tooltip>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const RailSwitcher = forwardRef(function RailSwitcher({ variant = 'kolbox', markIcon = 'wave', markLabel = 'Main menu', markOpen = false, onMark, items = [], foot = [], value, onSelect, className = '', ...rest }, ref) {
|
|
46
|
+
return (
|
|
47
|
+
<nav aria-label="Spaces" data-rail-switcher={variant}
|
|
48
|
+
className={`relative flex h-full w-(--kol-kolbox-rail-w-collapsed) shrink-0 flex-col items-start bg-panel pt-2 pb-1 after:absolute after:inset-y-0 after:right-0 after:w-px after:bg-(--kol-kolbox-line) ${className}`.trim()} {...rest}>
|
|
49
|
+
<Tooltip variant="kolbox" asChild label={markLabel}>
|
|
50
|
+
<button ref={ref} type="button" aria-label={markLabel} aria-haspopup="menu" aria-expanded={markOpen} onClick={onMark} data-mark
|
|
51
|
+
className={`${tile} ml-2 shrink-0 p-1 text-text hover:bg-field ${markOpen ? 'bg-field' : ''} ${focus}`}>
|
|
52
|
+
<IconLoader name={markIcon} size={18} />
|
|
53
|
+
</button>
|
|
54
|
+
</Tooltip>
|
|
55
|
+
<span aria-hidden className="mx-4 mt-2 mb-[7px] h-px w-4 shrink-0 bg-(--kol-kolbox-line)" data-rail-switcher-divider />
|
|
56
|
+
<div className="flex flex-col">{items.map((r) => <Row key={r.value} row={r} lit={r.value === value} onSelect={onSelect} />)}</div>
|
|
57
|
+
{foot.length > 0 && <div className="mt-auto flex flex-col">{foot.map((r) => <Row key={r.value ?? r.label} row={r} lit={r.value != null && r.value === value} onSelect={onSelect} />)}</div>}
|
|
58
|
+
</nav>
|
|
59
|
+
)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
export default RailSwitcher
|
|
@@ -28,7 +28,7 @@ import { LabeledControlSection } from './SettingsPanel.jsx'
|
|
|
28
28
|
* @param {string} [progressLabel] default `Through the book`
|
|
29
29
|
* @param {string} [className]
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
function ReadingContentsDefault({ book, author, count, chapters = [], current, onSelect, progress, progressLabel = 'Through the book', className = '' }) {
|
|
32
32
|
return (
|
|
33
33
|
<div data-reading-contents="" className={`flex flex-col gap-6 ${className}`.trim()}>
|
|
34
34
|
{(book || author) && (
|
|
@@ -57,3 +57,65 @@ export default function ReadingContents({ book, author, count, chapters = [], cu
|
|
|
57
57
|
</div>
|
|
58
58
|
)
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
/* ── folio (Folio batch E, 2026-11-22) ─────────────────────────────────────────────────────────────────────────────
|
|
62
|
+
* Folio's contents, carried from apps/folio's FolioDocument (the reader's left Rail, above the library tree): the
|
|
63
|
+
* `eyebrow` in Folio's label, the `book` title, the `author` line (Folio puts its chapter count or the document's kind
|
|
64
|
+
* there), 12 apart; then the list under its head (`title`, `Contents` by default, and the `count`, over a rule in the
|
|
65
|
+
* ink); then, for a book, `progress` (0 to 100) under `progressLabel` and its figure (`progressText`, the reader's
|
|
66
|
+
* "1 / 3"). Parts 28 apart, each drawn only when given. ReadingContents' words: `chapters` ({ id, label, href }),
|
|
67
|
+
* `current`. Folio's own: `sections` (the current chapter's headings, { id, label }, as anchors under it), `headings` (a
|
|
68
|
+
* document's headings when it is not a book, drawn quieter), `empty` (the line when there are neither), `linkComponent`
|
|
69
|
+
* (a router's Link for a chapter; default `a`) and `progressText`. */
|
|
70
|
+
function ReadingContentsFolio({ eyebrow, book, author, title = 'Contents', count, chapters = [], current, sections = [], headings = [], empty, linkComponent: L = 'a', progress, progressLabel = 'Through the book', progressText, className = '' }) {
|
|
71
|
+
const go = (href) => (L === 'a' ? { href } : { to: href })
|
|
72
|
+
return (
|
|
73
|
+
<div className={`kol-reading-contents--folio flex flex-col gap-[28px] ${className}`.trim()}>
|
|
74
|
+
<div className="flex flex-col gap-[12px]">
|
|
75
|
+
{eyebrow != null && <p className="kol-folio-label kol-reading-contents-muted">{eyebrow}</p>}
|
|
76
|
+
{book != null && <p className="kol-folio-book break-words">{book}</p>}
|
|
77
|
+
{author != null && <p className="kol-folio-body kol-reading-contents-muted">{author}</p>}
|
|
78
|
+
</div>
|
|
79
|
+
<nav aria-label="Contents" className="flex flex-col gap-[4px]">
|
|
80
|
+
<div className="kol-reading-contents-head flex justify-between border-b pb-[15px]">
|
|
81
|
+
<p className="kol-folio-nav">{title}</p>
|
|
82
|
+
<p className="kol-folio-meta kol-reading-contents-muted">{count}</p>
|
|
83
|
+
</div>
|
|
84
|
+
{chapters.length ? chapters.map((c, n) => {
|
|
85
|
+
const on = c.id === current
|
|
86
|
+
return (
|
|
87
|
+
<div key={c.id} className="flex flex-col">
|
|
88
|
+
<L {...go(c.href)} aria-current={on ? 'page' : undefined} className={`kol-reading-contents-row flex gap-[14px] rounded-[3px] px-[12px] py-[11px] ${on ? 'is-current' : ''}`.trim()}>
|
|
89
|
+
<span className="kol-folio-meta kol-reading-contents-number tabular-nums">{String(n + 1).padStart(2, '0')}</span>
|
|
90
|
+
<span className="kol-folio-nav min-w-0 flex-1">{c.label}</span>
|
|
91
|
+
</L>
|
|
92
|
+
{on && sections.length > 0 && (
|
|
93
|
+
<div className="kol-reading-contents-sections ml-[38px] flex flex-col border-l py-[4px]">
|
|
94
|
+
{sections.map((h) => <a key={h.id} href={`#${h.id}`} className="kol-folio-meta kol-reading-contents-quiet py-[6px] pl-[12px]">{h.label}</a>)}
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
)
|
|
99
|
+
}) : headings.length ? headings.map((h, n) => (
|
|
100
|
+
<a key={h.id} href={`#${h.id}`} className="kol-reading-contents-heading kol-reading-contents-quiet flex gap-[12px] rounded-[3px] px-[12px] py-[9px]">
|
|
101
|
+
<span className="kol-folio-meta tabular-nums">{String(n + 1).padStart(2, '0')}</span>
|
|
102
|
+
<span className="kol-folio-nav min-w-0 flex-1">{h.label}</span>
|
|
103
|
+
</a>
|
|
104
|
+
)) : <p className="kol-folio-meta kol-reading-contents-muted px-[12px] py-[9px]">{empty}</p>}
|
|
105
|
+
</nav>
|
|
106
|
+
{progress != null && (
|
|
107
|
+
<div className="kol-reading-contents-progress flex flex-col gap-[12px] border-t pt-[19px]">
|
|
108
|
+
<div className="kol-folio-meta flex justify-between">
|
|
109
|
+
<p className="kol-reading-contents-muted">{progressLabel}</p>
|
|
110
|
+
<p className="kol-reading-contents-figure font-bold">{progressText}</p>
|
|
111
|
+
</div>
|
|
112
|
+
<div className="kol-reading-contents-track h-[4px]"><div className="kol-reading-contents-fill h-full" style={{ width: `${progress}%` }} /></div>
|
|
113
|
+
</div>
|
|
114
|
+
)}
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export default function ReadingContents(props) {
|
|
120
|
+
return props.variant === 'folio' ? <ReadingContentsFolio {...props} /> : <ReadingContentsDefault {...props} />
|
|
121
|
+
}
|
|
@@ -272,7 +272,7 @@ export default function SectionSplit({
|
|
|
272
272
|
* the rung-minus-padding height made a fixed window over a card with its own height —
|
|
273
273
|
* /studio's 621px ProfileCard showed as a 104px strip at 1440. Auto media takes the
|
|
274
274
|
* column's width and its own height, at every width; a ratio keeps the bounded rule. */
|
|
275
|
-
className={`kol-section-split-visual relative w-full max-w-full justify-self-center rounded-[var(--kol-radius-
|
|
275
|
+
className={`kol-section-split-visual relative w-full max-w-full justify-self-center rounded-[var(--kol-radius-4)] ${ratio === 'auto' ? '' : 'min-[901px]:w-auto min-[901px]:h-[calc(var(--kol-section-h,60vh)_-_2*var(--kol-section-py,4rem))]'} ${mediaClip ? 'overflow-hidden' : ''} ${mediaHover ? 'is-hoverable' : ''} ${mediaFirst ? 'order-1' : ''} ${centred ? 'max-w-[640px]' : ''}`.replace(/\s+/g, ' ').trim()}
|
|
276
276
|
style={ratio === 'auto' ? undefined : { aspectRatio: ratio }}
|
|
277
277
|
>
|
|
278
278
|
{media ?? (placeholder === true
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Children } from 'react'
|
|
1
|
+
import { Children, useState } from 'react'
|
|
2
2
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
3
3
|
import Button from '../atoms/Button.jsx'
|
|
4
4
|
import Dropdown from '../molecules/Dropdown.jsx'
|
|
@@ -199,7 +199,52 @@ export function SettingsSwitch({ on = false, onChange, disabled = false, disable
|
|
|
199
199
|
* (`nav` for a list of links), the rest of the props on it. */
|
|
200
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)]' }
|
|
201
201
|
const SETTINGS_GAP = { 3: 'gap-3', 4: 'gap-4', settings: 'gap-[7px]' }
|
|
202
|
-
|
|
202
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's RailSection (Figma 27:9309),
|
|
203
|
+
* carried from apps/kolbox/src/ui/RailSection.jsx. A 1px rule at the section's top, then the head: a 40 row, the `label`
|
|
204
|
+
* 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.
|
|
205
|
+
* With no rows it is the rule and the head alone (41 high). Measured on Figma's own rails (plan-2026-11-23-editor-
|
|
206
|
+
* measured-against-figma W3: Pages, Layers, Page, Styles and Export headers are 40, label 16 in); closed is not empty, so its title and
|
|
207
|
+
* its actions keep the full ink (his "I thought text were white", R3.2).
|
|
208
|
+
* 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
|
|
209
|
+
* `--kol-kolbox-row-cols`: two field columns and two 16 icon columns, 8 apart (76, 76, 16, 16 in the 240 rail; his
|
|
210
|
+
* design's Stroke row, 149:26890). FieldPair and ColorInputRow kolbox lay out on it; the head's actions sit at the right
|
|
211
|
+
* of the head (above); LabeledControl kolbox's 76 label is the first field column. */
|
|
212
|
+
function LabeledControlSectionKolbox({ label, end, className = '', children }) {
|
|
213
|
+
const rows = Children.toArray(children)
|
|
214
|
+
const open = rows.length > 0
|
|
215
|
+
return (
|
|
216
|
+
<section
|
|
217
|
+
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}`}
|
|
218
|
+
data-rail-section={label ?? ''}
|
|
219
|
+
>
|
|
220
|
+
{(label || end) && (
|
|
221
|
+
<header className="flex h-10 items-center pr-2 pl-4">
|
|
222
|
+
<h3 className="kol-section-title--kolbox min-w-0 flex-1 truncate">{label}</h3>
|
|
223
|
+
{end && <span className="flex shrink-0 items-center gap-1">{end}</span>}
|
|
224
|
+
</header>
|
|
225
|
+
)}
|
|
226
|
+
{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>}
|
|
227
|
+
</section>
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* `variant="folio"` (Folio batch C, 2026-11-22): Folio's SettingGroup, carried class for class. The `label` (12 / 17
|
|
232
|
+
* medium, Folio's ink) 12 over its rows, the rows 8 apart. Chrome in kol-theme `.kol-section--folio`. */
|
|
233
|
+
function LabeledControlSectionFolio({ label, className = '', children }) {
|
|
234
|
+
return (
|
|
235
|
+
<div className={`kol-section--folio flex flex-col gap-[12px] ${className}`.trim()}>
|
|
236
|
+
<p className="kol-section-title--folio">{label}</p>
|
|
237
|
+
<div className="flex flex-col gap-[8px]">{children}</div>
|
|
238
|
+
</div>
|
|
239
|
+
)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function LabeledControlSection(props) {
|
|
243
|
+
if (props.variant === 'folio') return <LabeledControlSectionFolio {...props} />
|
|
244
|
+
return props.variant === 'kolbox' ? <LabeledControlSectionKolbox {...props} /> : <LabeledControlSectionBody {...props} />
|
|
245
|
+
}
|
|
246
|
+
function LabeledControlSectionBody({ label, end, variant, divided = false, gap, rowGap, collapsible = false, open, defaultOpen = true, onToggle, as: Tag = 'div', children, className = '', ...rest }) {
|
|
247
|
+
const [ownOpen, setOwnOpen] = useState(defaultOpen)
|
|
203
248
|
/* `variant="settings"` (plan-2026-11-12-float-rails-figma W13.1): the generator settings window's group — the head is
|
|
204
249
|
* the title (a string in Inter 12 semibold) with `end` (the note) at its right on one baseline, 15 over the items;
|
|
205
250
|
* `divided` rules it off from the next group (22 under the items, an oq-16 rule, 18 to the next; the last none).
|
|
@@ -222,15 +267,28 @@ export function LabeledControlSection({ label, end, variant, divided = false, ga
|
|
|
222
267
|
if (variant === 'float') {
|
|
223
268
|
const items = Children.toArray(children)
|
|
224
269
|
const hasLabel = label != null && label !== false && label !== ''
|
|
270
|
+
const head = hasLabel && (typeof label === 'string' ? <span className="kol-float-label text-oq-64">{label}</span> : label)
|
|
271
|
+
/* `collapsible` (plan-2026-11-12-one-header W10.1): the head is the toggle, ONE indicator — the 12 chevron at its right
|
|
272
|
+
* end (⌄ open, › closed), the Header's chevron; `open` controlled or `defaultOpen`, `onToggle(open)`. `end` sits before
|
|
273
|
+
* the chevron and must not be interactive. The items hide while closed. */
|
|
274
|
+
const isOpen = !collapsible || (open ?? ownOpen)
|
|
275
|
+
const toggle = () => { const next = !isOpen; if (open === undefined) setOwnOpen(next); onToggle?.(next) }
|
|
225
276
|
return (
|
|
226
|
-
<Tag data-labeled-control-section="" className={`flex flex-col ${GAP[gap ?? 3]} ${className}`.trim()} {...rest}>
|
|
227
|
-
{
|
|
277
|
+
<Tag data-labeled-control-section="" data-open={collapsible ? String(isOpen) : undefined} className={`flex flex-col ${GAP[gap ?? 3]} ${className}`.trim()} {...rest}>
|
|
278
|
+
{collapsible ? (
|
|
279
|
+
<button type="button" aria-expanded={isOpen} onClick={toggle}
|
|
280
|
+
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)]">
|
|
281
|
+
<span className="flex min-w-0 flex-1 items-center">{head}</span>
|
|
282
|
+
{end}
|
|
283
|
+
<IconLoader name={isOpen ? 'chevron-down' : 'chevron-right'} size="var(--kol-float-chev-sm)" className="shrink-0 text-oq-64" />
|
|
284
|
+
</button>
|
|
285
|
+
) : (hasLabel || end) && (
|
|
228
286
|
<div className="flex items-center justify-between">
|
|
229
|
-
{
|
|
287
|
+
{head}
|
|
230
288
|
{end}
|
|
231
289
|
</div>
|
|
232
290
|
)}
|
|
233
|
-
{items.length > 0 && <div className={`flex flex-col ${GAP[rowGap ?? 2]}`}>{items}</div>}
|
|
291
|
+
{isOpen && items.length > 0 && <div className={`flex flex-col ${GAP[rowGap ?? 2]}`}>{items}</div>}
|
|
234
292
|
</Tag>
|
|
235
293
|
)
|
|
236
294
|
}
|
|
@@ -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 }]
|