@kolkrabbi/kol-component 0.301.0 → 0.302.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 +1 -1
- package/src/atoms/Input.jsx +5 -0
- package/src/hooks/canvasViewport.js +43 -4
- package/src/index.js +3 -3
- package/src/molecules/Rail.jsx +142 -17
- package/src/molecules/Slider.jsx +3 -0
- package/src/organisms/CanvasStudio.jsx +19 -1
- package/src/organisms/NavRail.jsx +4 -0
- package/src/organisms/RailKit.jsx +37 -5
- package/src/organisms/SettingsPanel.jsx +14 -11
- package/src/organisms/SettingsSections.jsx +12 -4
package/package.json
CHANGED
package/src/atoms/Input.jsx
CHANGED
|
@@ -39,6 +39,8 @@ import { glyphSize } from '../hooks/glyphLadders.js'
|
|
|
39
39
|
* size="sm" / "md" (default) / "lg" — matched padding + type class
|
|
40
40
|
*
|
|
41
41
|
* Sizing:
|
|
42
|
+
* preset — `rail` (2026-10-25): the control in a rail's row — its rung's height, 8 at the sides instead of the
|
|
43
|
+
* rung's 12 (*"call it a variant or preset for input on rails"*); the Slider's readout passes it through
|
|
42
44
|
* chars — HTML `size` attribute on the inner input. When set, the inner
|
|
43
45
|
* <input> sizes to N characters and the shell hugs (padding + prefix +
|
|
44
46
|
* N chars + suffix + padding). Use for known-format values (hex,
|
|
@@ -72,6 +74,7 @@ export default function Input({
|
|
|
72
74
|
onChange,
|
|
73
75
|
onCommit,
|
|
74
76
|
variant,
|
|
77
|
+
preset,
|
|
75
78
|
tone = 'default',
|
|
76
79
|
size = 'md',
|
|
77
80
|
chars,
|
|
@@ -109,6 +112,8 @@ export default function Input({
|
|
|
109
112
|
/* no variant → no modifier: the shell inherits a wrapper's tone, else filled (2026-09-03) */
|
|
110
113
|
resolvedVariant && `kol-control--${resolvedVariant}`,
|
|
111
114
|
`kol-control-${size}`,
|
|
115
|
+
/* the rail preset (2026-10-25): 8 at the sides for a rail row's chip — `.kol-control--rail` */
|
|
116
|
+
preset && `kol-control--${preset}`,
|
|
112
117
|
SIZE_TYPE[size],
|
|
113
118
|
'cursor-text',
|
|
114
119
|
/* the dark chip on a washed plane (ControlToneInverse, kol-website 2026-08-27) */
|
|
@@ -33,8 +33,27 @@ export const CANVAS_KEYS = [
|
|
|
33
33
|
{ id: 'fps', label: 'Framerate', combo: 'F' },
|
|
34
34
|
{ id: 'grid', label: 'Dot grid', combo: 'G', surface: 'studio' },
|
|
35
35
|
{ id: 'lock', label: 'Lock the view', combo: 'L', surface: 'studio' },
|
|
36
|
+
{ id: 'snap', label: 'Snap positions', combo: '1–9', surface: 'studio' },
|
|
36
37
|
]
|
|
37
38
|
|
|
39
|
+
/* THE SNAP POSITIONS (CanvasStudioSnapPositions, kol-mirror 2026-10-25 — monitor's RackViewport keys, so mirror's desk
|
|
40
|
+
* reuses them instead of a fourth copy: *"read monitor and see what shortcuts they have set as convention and reuse
|
|
41
|
+
* those"*). Numpad-laid: 7 8 9 the top, 4 5 6 the middle, 1 2 3 the bottom, each at the left · centre · right. A PAN,
|
|
42
|
+
* never a zoom — the content box lands `snapPadding` inside the surface's edge, or centred on that axis. */
|
|
43
|
+
export const SNAP_PADDING = 48
|
|
44
|
+
const SNAP = {
|
|
45
|
+
7: [0, 0], 8: [0.5, 0], 9: [1, 0],
|
|
46
|
+
4: [0, 0.5], 5: [0.5, 0.5], 6: [1, 0.5],
|
|
47
|
+
1: [0, 1], 2: [0.5, 1], 3: [1, 1],
|
|
48
|
+
}
|
|
49
|
+
/* where the content's top-left should land, in surface space, for key `k`: 0 = the padding, 1 = the far edge less
|
|
50
|
+
* the padding and the content's size, 0.5 = centred */
|
|
51
|
+
function snapTarget(k, surface, content, p) {
|
|
52
|
+
const [ax, ay] = SNAP[k]
|
|
53
|
+
const at = (a, size, extent) => (a === 0.5 ? (extent - size) / 2 : a === 0 ? p : extent - p - size)
|
|
54
|
+
return { x: at(ax, content.width, surface.width), y: at(ay, content.height, surface.height) }
|
|
55
|
+
}
|
|
56
|
+
|
|
38
57
|
/* the dot grid — kol-monitor's and kol-mirror's exact rule, on the token: a 1px fg-12 dot on a
|
|
39
58
|
* 36px cell at zoom 1, the cell scaled by the zoom and the field offset by the pan so the surface
|
|
40
59
|
* moves under the work instead of the work sliding over a static field */
|
|
@@ -116,6 +135,9 @@ const REST = { zoom: 1, x: 0, y: 0 }
|
|
|
116
135
|
* gives Space to the transport elsewhere), in the capture phase
|
|
117
136
|
* ignore a selector — wheel and touch pass through what matches (an inner scroller)
|
|
118
137
|
* onSpaceTap a Space press released without a pan, or a one-finger tap on the editor
|
|
138
|
+
* snapKeys whether `1–9` snap the view to the nine positions (the studio does, the editor does not)
|
|
139
|
+
* content () => DOMRect | null — the content box the snap positions place, in screen space
|
|
140
|
+
* snapPadding the inset a snapped edge keeps from the surface's edge (default 48, monitor's)
|
|
119
141
|
* Returns { view, setView, reset, zoomTo, spaceHeld, dragging, pinching, deaf, cursor, locked,
|
|
120
142
|
* setLocked, grid, setGrid, showFps, fps, transform }. */
|
|
121
143
|
export function useCanvasViewport({
|
|
@@ -137,6 +159,9 @@ export function useCanvasViewport({
|
|
|
137
159
|
spaceWhenOver = false,
|
|
138
160
|
ignore = 'input, textarea, select, [data-scroll-own]',
|
|
139
161
|
onSpaceTap,
|
|
162
|
+
snapKeys = false,
|
|
163
|
+
content,
|
|
164
|
+
snapPadding = SNAP_PADDING,
|
|
140
165
|
}) {
|
|
141
166
|
const [inner, setInner] = useState(defaultView ?? REST)
|
|
142
167
|
const controlled = viewProp !== undefined
|
|
@@ -192,10 +217,13 @@ export function useCanvasViewport({
|
|
|
192
217
|
const spaceRef = useRef(false)
|
|
193
218
|
const overRef = useRef(!spaceWhenOver)
|
|
194
219
|
const dragStart = useRef(null)
|
|
195
|
-
const optsRef = useRef({ gridKey, lockKey, spaceWhenOver, touch, ignore })
|
|
196
|
-
optsRef.current = { gridKey, lockKey, spaceWhenOver, touch, ignore }
|
|
220
|
+
const optsRef = useRef({ gridKey, lockKey, spaceWhenOver, touch, ignore, snapKeys, snapPadding })
|
|
221
|
+
optsRef.current = { gridKey, lockKey, spaceWhenOver, touch, ignore, snapKeys, snapPadding }
|
|
222
|
+
const contentRef = useRef(content)
|
|
223
|
+
contentRef.current = content
|
|
197
224
|
|
|
198
|
-
/* keys — Space (pan mode, a tap), ⌘0 / ⌘= / ⌘− (zoom), F (fps), G and L where the surface binds them
|
|
225
|
+
/* keys — Space (pan mode, a tap), ⌘0 / ⌘= / ⌘− (zoom), F (fps), G and L where the surface binds them, 1–9 the snap
|
|
226
|
+
* positions where it binds those (⌥1–9 stay the Hub's: the alt check above returns first) */
|
|
199
227
|
useEffect(() => {
|
|
200
228
|
const onKeyDown = (e) => {
|
|
201
229
|
if (isTypingTarget(e.target)) return
|
|
@@ -221,7 +249,18 @@ export function useCanvasViewport({
|
|
|
221
249
|
if (e.altKey) return
|
|
222
250
|
if (e.key === 'f' || e.key === 'F') { setShowFps((v) => !v); return }
|
|
223
251
|
if (o.gridKey && (e.key === 'g' || e.key === 'G')) { e.preventDefault(); setGridRef.current((v) => !v); return }
|
|
224
|
-
if (o.lockKey && (e.key === 'l' || e.key === 'L')) { e.preventDefault(); setLockedRef.current((v) => !v) }
|
|
252
|
+
if (o.lockKey && (e.key === 'l' || e.key === 'L')) { e.preventDefault(); setLockedRef.current((v) => !v); return }
|
|
253
|
+
if (o.snapKeys && e.key.length === 1 && '123456789'.includes(e.key)) {
|
|
254
|
+
e.preventDefault()
|
|
255
|
+
if (lockedRef.current) return
|
|
256
|
+
const surface = ref.current?.getBoundingClientRect()
|
|
257
|
+
const box = contentRef.current?.()
|
|
258
|
+
if (!surface || !box) return
|
|
259
|
+
/* the view's translate is in screen px (translate, then scale), so the pan moves by the screen delta as is */
|
|
260
|
+
const t = snapTarget(e.key, surface, box, o.snapPadding)
|
|
261
|
+
const dx = surface.left + t.x - box.left, dy = surface.top + t.y - box.top
|
|
262
|
+
setViewRef.current((v) => ({ ...v, x: v.x + dx, y: v.y + dy }))
|
|
263
|
+
}
|
|
225
264
|
}
|
|
226
265
|
const onKeyUp = (e) => {
|
|
227
266
|
if (e.code !== 'Space') return
|
package/src/index.js
CHANGED
|
@@ -128,7 +128,7 @@ export { ModalProvider, useModal } from './molecules/Modal.jsx'
|
|
|
128
128
|
export { default as PaletteHarmonyWheel } from './molecules/PaletteHarmonyWheel.jsx'
|
|
129
129
|
export { default as PropertyInput } from './molecules/PropertyInput.jsx'
|
|
130
130
|
export { default as ShapeDropdown } from './molecules/ShapeDropdown.jsx'
|
|
131
|
-
export { default as Rail } from './molecules/Rail.jsx'
|
|
131
|
+
export { default as Rail, RAIL_ROLES, useRailKey } from './molecules/Rail.jsx'
|
|
132
132
|
/** @deprecated 2026-10-17 — alias of Rail */
|
|
133
133
|
export { default as ShellDrawer } from './molecules/ShellDrawer.jsx'
|
|
134
134
|
export { default as CommandOverlay } from './organisms/CommandOverlay.jsx'
|
|
@@ -162,7 +162,7 @@ export { default as TabChips } from './molecules/TabChips.jsx'
|
|
|
162
162
|
* the desk sit on; both read `useCanvasViewport`, one engine, one key table (`CANVAS_KEYS`). */
|
|
163
163
|
export { default as CanvasEditor, default as Canvas, CanvasFrame, PanViewport, PanZoomViewport, CanvasZoomContext, useFps, CANVAS_VIRTUAL_W, DEFAULT_ASPECTS, CANVAS_DEFAULTS } from './organisms/Canvas.jsx'
|
|
164
164
|
export { default as CanvasStudio } from './organisms/CanvasStudio.jsx'
|
|
165
|
-
export { useCanvasViewport, CANVAS_KEYS, CANVAS_GRID_CELL, CANVAS_GRID_IMAGE } from './hooks/canvasViewport.js'
|
|
165
|
+
export { useCanvasViewport, CANVAS_KEYS, SNAP_PADDING, CANVAS_GRID_CELL, CANVAS_GRID_IMAGE } from './hooks/canvasViewport.js'
|
|
166
166
|
/* The rulers and the guides, public since 2026-09-03 (rulers-and-guides-are-private):
|
|
167
167
|
* they measure the RENDERED rect, so they work over a CSS-zoomed stage with no
|
|
168
168
|
* PanZoomViewport anywhere — which is their second consumer on day one. */
|
|
@@ -213,7 +213,7 @@ export { default as SettingsPanel, LabeledControlSection, SettingsRow, SettingsS
|
|
|
213
213
|
export { default as SettingsSections } from './organisms/SettingsSections.jsx'
|
|
214
214
|
/* the rail kit (RailKit, kol-monitor 2026-10-24): the parts a Rail's content is built from; RailSection and RailRow
|
|
215
215
|
* are the settings rail's LabeledControlSection and SettingsRow under the kit's names — the same components */
|
|
216
|
-
export { RailHeader, RailTabs, RailHint, RailActions, RailFoot } from './organisms/RailKit.jsx'
|
|
216
|
+
export { RailHeader, RailTabs, RailHint, RailActions, RailFoot, RailNav } from './organisms/RailKit.jsx'
|
|
217
217
|
export { LabeledControlSection as RailSection, SettingsRow as RailRow } from './organisms/SettingsPanel.jsx'
|
|
218
218
|
export { default as SectionNewsletter } from './organisms/SectionNewsletter.jsx'
|
|
219
219
|
export { default as NewsletterBand } from './organisms/NewsletterBand.jsx'
|
package/src/molecules/Rail.jsx
CHANGED
|
@@ -3,11 +3,23 @@ import { pushLayer, popLayer, isTopLayer } from '../utilities/layerStack.js'
|
|
|
3
3
|
import { createPortal } from 'react-dom'
|
|
4
4
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
5
5
|
import CloseButton from '../atoms/CloseButton.jsx'
|
|
6
|
+
import Divider from '../atoms/Divider.jsx'
|
|
6
7
|
import usePrefersReducedMotion from '../hooks/usePrefersReducedMotion.js'
|
|
8
|
+
import useMediaQuery from '../hooks/useMediaQuery.js'
|
|
9
|
+
import useGrabEdge from '../hooks/useGrabEdge.js'
|
|
7
10
|
|
|
8
11
|
/* taxonomy-ok: nests kol-icons's Icon (a package import the relative-import
|
|
9
12
|
* check can't see). */
|
|
10
13
|
|
|
14
|
+
/* ONE SCROLL LOCK FOR EVERY OPEN RAIL (RailRoles, 2026-10-25): rails stack — the patch rail, the page rail, the settings
|
|
15
|
+
* rail over both — and each restoring the overflow it saw on open left the body locked when they closed out of order
|
|
16
|
+
* (A opens on '', B opens on 'hidden'; close A → '', close B → 'hidden', forever). A count: the first lock saves, the
|
|
17
|
+
* last unlock restores. */
|
|
18
|
+
let locks = 0
|
|
19
|
+
let savedOverflow = ''
|
|
20
|
+
const lockScroll = () => { if (locks++ === 0) { savedOverflow = document.body.style.overflow; document.body.style.overflow = 'hidden' } }
|
|
21
|
+
const unlockScroll = () => { if (--locks === 0) document.body.style.overflow = savedOverflow }
|
|
22
|
+
|
|
11
23
|
const FOCUSABLE =
|
|
12
24
|
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
13
25
|
|
|
@@ -37,12 +49,21 @@ const FOCUSABLE =
|
|
|
37
49
|
* Presentational shell — the parent owns the open state and supplies the
|
|
38
50
|
* header slot and body; no navigation or routing logic lives here.
|
|
39
51
|
*
|
|
52
|
+
* @param {'patch'|'page'|'settings'|'bottom'} role THE JOB (RailRoles, 2026-10-25): the side, tier, scrim and key of one of
|
|
53
|
+
* the four rails every tool has (`RAIL_ROLES` above), and the phone rule under 768 — the patch
|
|
54
|
+
* rail turns bottom, a settings-shaped rail fills the screen. Explicit props win; `useRailKey`
|
|
55
|
+
* binds the key. Unset = the rail as before
|
|
56
|
+
* @param {Object} style on the panel, last
|
|
57
|
+
* @param {ReactNode} nav A RAIL INSIDE THE RAIL (review 2, 2026-10-25 — *"like a siderail in the bottom rail"*): `RailNav`, the
|
|
58
|
+
* collapsed nav rail's 48 icon column, stood at the panel's edge with the header, body and foot
|
|
59
|
+
* padded beside it — so a bottom rail over the nav rail carries its views as glyphs under it
|
|
40
60
|
* @param {'app'|'site'} variant THE TIER (RailKit, kol-monitor 2026-10-24): its width when `width` / `height` is not given
|
|
41
61
|
* (`--kol-rail-w-app` 320 · `--kol-rail-w-site` 380) and its padding (`--kol-pad-rail-app` ·
|
|
42
62
|
* `--kol-pad-rail-site`), kol-theme's tokens — so the settings rail and a page rail of one
|
|
43
63
|
* app are one size. Unset = the rail as before (`--kol-pad-overlay`, the width yours)
|
|
44
64
|
* @param {ReactNode} footer a FOOT pinned below the scrolling body (fxr's transport dock; `RailFoot` is its shape) —
|
|
45
|
-
* the body scrolls, the foot does not
|
|
65
|
+
* the body scrolls, the foot does not; the Rail draws it as a band with a full-width rule
|
|
66
|
+
* (2026-10-25), so nothing inside it draws a rule
|
|
46
67
|
* @param {boolean} open drawer visible (drives slide in/out)
|
|
47
68
|
* @param {Function} onClose close request (Esc / backdrop / close button)
|
|
48
69
|
* @param {string} side 'left' | 'right' | 'bottom' — edge the panel slides from.
|
|
@@ -62,10 +83,83 @@ const FOCUSABLE =
|
|
|
62
83
|
* @param {ReactNode} children scrollable panel body
|
|
63
84
|
* @param {string} className extra classes on the panel
|
|
64
85
|
*/
|
|
86
|
+
/* THE ROLES (RailRoles, user 2026-10-25: *"they keep making variations old and new and I want to standardize rails"*).
|
|
87
|
+
* Four jobs every tool's rails do, each one shell and one key, so an app names the job and stops choosing a side, a
|
|
88
|
+
* width, a scrim and a key of its own. Monitor's page rails each repeated `side="right" variant="app" backdrop={false}
|
|
89
|
+
* edge={false} shadow={false} closeHover={false}`; mirror's patch table stood at 440 with its own header. An explicit
|
|
90
|
+
* prop still wins over the role's.
|
|
91
|
+
*
|
|
92
|
+
* patch P the patch / cable table — right, the app tier, over the page with no scrim (the rack stays live)
|
|
93
|
+
* page H the page's own settings (monitor's Stage, Rack) — THE SETTINGS RAIL'S SHELL (his review 2026-10-25:
|
|
94
|
+
* *"why is H same as labs siderail and not the same as settings?"*) without the scrim (*"H does not
|
|
95
|
+
* include dark overlay, that is only settings"*): the width, the header, typed rows; only the rows and
|
|
96
|
+
* the key are the page's
|
|
97
|
+
* settings , the app's settings (SettingsPanel) — right, the app tier, THE ONE RAIL WITH THE SCRIM
|
|
98
|
+
* bottom E the edit rail under the page (monitor's stage and rack) — resizable, no scrim, the full width OVER the
|
|
99
|
+
* nav rail (*"it should OVERLAY the navrail … because then we can use same icon system as collapsed
|
|
100
|
+
* siderail"*): `RailNav`, the collapsed nav rail's 48 icon column, stands inside it under the nav rail
|
|
101
|
+
*
|
|
102
|
+
* No role draws an edge (*"why do some have border and some do not?"*, round 19 answered): a rail reads by its scrim or
|
|
103
|
+
* by its content against the live page; `edge` stays the opt-in for a consumer that wants the line.
|
|
104
|
+
*
|
|
105
|
+
* THE STANDARD HEADER (*"title + close!! then divider!!! thats a fucking standard header!!!"*): every rail with a header
|
|
106
|
+
* draws the title line with the × and the hairline under it, here — a rail never draws its own.
|
|
107
|
+
*
|
|
108
|
+
* THE PHONE RULE (below 768): a side rail becomes a bottom rail (70dvh, the thumb's reach), a settings-shaped rail
|
|
109
|
+
* (settings, page) fills the screen, the bottom rail stands at half the height. One rule, so labs and randomiser get it
|
|
110
|
+
* by naming the role. */
|
|
111
|
+
export const RAIL_ROLES = {
|
|
112
|
+
patch: { key: 'p', side: 'right', variant: 'app', backdrop: false, edge: false, shadow: false, closeHover: false, phone: { side: 'bottom', height: '70dvh' } },
|
|
113
|
+
page: { key: 'h', side: 'right', variant: 'app', backdrop: false, edge: false, shadow: false, closeHover: false, phone: { width: '100%' } },
|
|
114
|
+
settings: { key: ',', side: 'right', variant: 'app', backdrop: true, edge: false, shadow: false, closeHover: false, phone: { width: '100%' } },
|
|
115
|
+
bottom: { key: 'e', side: 'bottom', variant: 'app', resizable: true, height: '30dvh', minSize: 80, maxSize: 600, backdrop: false, edge: false, shadow: false, closeHover: false, phone: { height: '50dvh', resizable: false } },
|
|
116
|
+
}
|
|
117
|
+
const CODES = { ',': 'Comma' }
|
|
118
|
+
const typingIn = (t) => t instanceof HTMLElement && (t.isContentEditable || !!t.closest('input, textarea, select'))
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* useRailKey — a role's key toggles its rail: `useRailKey('patch', () => setOpen((v) => !v))`. One bare key (P · H · ,
|
|
122
|
+
* · E), never with ⌘ / Ctrl / Alt, never while typing, never on a held repeat. `enabled` false unbinds it (a route
|
|
123
|
+
* without that rail). Apps that bind the key themselves (AppHub's `,`) keep doing so — this is the same rule, shipped.
|
|
124
|
+
*/
|
|
125
|
+
export function useRailKey(role, onToggle, enabled = true) {
|
|
126
|
+
const ref = useRef(onToggle)
|
|
127
|
+
ref.current = onToggle
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
const key = RAIL_ROLES[role]?.key
|
|
130
|
+
if (!enabled || !key) return undefined
|
|
131
|
+
const onKey = (e) => {
|
|
132
|
+
if (e.metaKey || e.ctrlKey || e.altKey || e.repeat || typingIn(e.target)) return
|
|
133
|
+
if (e.key.toLowerCase() !== key && e.code !== CODES[key]) return
|
|
134
|
+
e.preventDefault()
|
|
135
|
+
ref.current?.()
|
|
136
|
+
}
|
|
137
|
+
window.addEventListener('keydown', onKey)
|
|
138
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
139
|
+
}, [role, enabled])
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* the role's shell, the phone rule over it, then whatever the call site passed (an `undefined` prop is not a pass) */
|
|
143
|
+
export default function Rail({ role, ...props }) {
|
|
144
|
+
const phone = useMediaQuery('(max-width: 767px)')
|
|
145
|
+
const r = role ? RAIL_ROLES[role] : null
|
|
146
|
+
if (role && !r && import.meta.env?.DEV) console.warn(`Rail: no role "${role}" — patch · page · settings · bottom`)
|
|
147
|
+
if (!r) return <RailShell {...props} />
|
|
148
|
+
const { key: _k, phone: phoneRule, ...shell } = r
|
|
149
|
+
const passed = Object.fromEntries(Object.entries(props).filter(([, v]) => v !== undefined))
|
|
150
|
+
const merged = { ...shell, ...passed }
|
|
151
|
+
/* on a phone the rule outranks the call site's side and width — a 380 right rail is not usable at 390 */
|
|
152
|
+
if (phone) Object.assign(merged, phoneRule, phoneRule.side === 'bottom' ? { width: undefined, resizable: false } : {})
|
|
153
|
+
return <RailShell {...merged} data-rail-role={role} />
|
|
154
|
+
}
|
|
155
|
+
|
|
65
156
|
const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v))
|
|
66
157
|
const px = (v) => (v == null ? undefined : typeof v === 'number' ? `${v}px` : v)
|
|
67
158
|
|
|
68
|
-
|
|
159
|
+
function RailShell({
|
|
160
|
+
'data-rail-role': roleAttr,
|
|
161
|
+
style,
|
|
162
|
+
nav,
|
|
69
163
|
open,
|
|
70
164
|
onClose,
|
|
71
165
|
variant,
|
|
@@ -101,6 +195,13 @@ export default function Rail({
|
|
|
101
195
|
const vertical = side === 'top' || side === 'bottom'
|
|
102
196
|
/* the rail's own size once dragged; null = the `width` / `height` given */
|
|
103
197
|
const [dragged, setDragged] = useState(null)
|
|
198
|
+
const [resizing, setResizing] = useState(false)
|
|
199
|
+
/* THE SAME GRAB AS EVERY RAIL (his review 2026-10-25: *"why does bottom rail not have the same grab system as other
|
|
200
|
+
* rails?"*): the proximity-wake pill of the nav rails (`useGrabEdge`, `.kol-rail-grab`), on the edge that faces the
|
|
201
|
+
* page — a side rail's pill travels on y, a bottom or top rail's on x. It drew its own strip with a full-width wash
|
|
202
|
+
* from 2026-10-17 until then. */
|
|
203
|
+
const grabRef = useRef(null)
|
|
204
|
+
useGrabEdge(grabRef, { axis: vertical ? 'x' : 'y' })
|
|
104
205
|
const startResize = (e) => {
|
|
105
206
|
if (!resizable) return
|
|
106
207
|
e.preventDefault()
|
|
@@ -114,19 +215,23 @@ export default function Rail({
|
|
|
114
215
|
setDragged(next)
|
|
115
216
|
onResize?.(next)
|
|
116
217
|
}
|
|
117
|
-
const up = () => { window.removeEventListener('pointermove', move); window.removeEventListener('pointerup', up); document.body.style.cursor = ''; document.body.style.userSelect = '' }
|
|
218
|
+
const up = () => { window.removeEventListener('pointermove', move); window.removeEventListener('pointerup', up); document.body.style.cursor = ''; document.body.style.userSelect = ''; setResizing(false) }
|
|
118
219
|
document.body.style.cursor = vertical ? 'row-resize' : 'col-resize'
|
|
119
220
|
document.body.style.userSelect = 'none'
|
|
221
|
+
setResizing(true)
|
|
120
222
|
window.addEventListener('pointermove', move)
|
|
121
223
|
window.addEventListener('pointerup', up)
|
|
122
224
|
}
|
|
225
|
+
/* the handle: `.kol-rail-grab` is the drawing (kol-animation.css), `--top` · `--bottom` · `--right` place it on the
|
|
226
|
+
* edge facing the page; `is-dragging` keeps the pill lit through the drag */
|
|
123
227
|
const grab = resizable && (
|
|
124
228
|
<span
|
|
229
|
+
ref={grabRef}
|
|
125
230
|
role="separator"
|
|
126
231
|
aria-orientation={vertical ? 'horizontal' : 'vertical'}
|
|
127
232
|
aria-label="Resize"
|
|
128
233
|
onPointerDown={startResize}
|
|
129
|
-
className={`
|
|
234
|
+
className={`kol-rail-grab z-10 touch-none ${side === 'bottom' ? 'kol-rail-grab--top' : side === 'top' ? 'kol-rail-grab--bottom' : side === 'right' ? 'kol-rail-grab--right' : ''} ${resizing ? 'is-dragging' : ''}`.replace(/\s+/g, ' ').trim()}
|
|
130
235
|
/>
|
|
131
236
|
)
|
|
132
237
|
const push = mode === 'push'
|
|
@@ -204,12 +309,11 @@ export default function Rail({
|
|
|
204
309
|
* exists before we focus it (it mounts one commit after `open` flips). */
|
|
205
310
|
useEffect(() => {
|
|
206
311
|
if (!(open && present) || push) return undefined
|
|
207
|
-
|
|
208
|
-
document.body.style.overflow = 'hidden'
|
|
312
|
+
lockScroll()
|
|
209
313
|
const prevFocus = document.activeElement
|
|
210
314
|
panelRef.current?.focus()
|
|
211
315
|
return () => {
|
|
212
|
-
|
|
316
|
+
unlockScroll()
|
|
213
317
|
if (prevFocus instanceof HTMLElement) prevFocus.focus()
|
|
214
318
|
}
|
|
215
319
|
}, [open, present, push])
|
|
@@ -228,15 +332,17 @@ export default function Rail({
|
|
|
228
332
|
return (
|
|
229
333
|
<div
|
|
230
334
|
ref={panelRef}
|
|
335
|
+
data-rail-role={roleAttr}
|
|
231
336
|
aria-hidden={!open || undefined}
|
|
232
337
|
className={`relative shrink-0 overflow-hidden bg-surface-primary border-oq-08 ${open ? edgeCls : ''} ${reduced ? '' : 'transition-[width,height] duration-200 ease-out'} ${className}`}
|
|
233
|
-
style={{ ...sizeStyle, ...pad }}
|
|
338
|
+
style={{ ...sizeStyle, ...pad, ...style }}
|
|
234
339
|
>
|
|
235
340
|
{grab}
|
|
236
341
|
<div className="flex h-full flex-col p-[var(--kol-pad-rail)]">
|
|
237
|
-
{header != null && <div className="mb-
|
|
342
|
+
{header != null && <div className="mb-3 min-w-0">{header}</div>}
|
|
343
|
+
{header != null && <Divider className="mb-6" />}
|
|
238
344
|
<div className="flex-1 overflow-auto" style={{ overflowAnchor: 'none' }}>{children}</div>
|
|
239
|
-
{footer != null && <div className="shrink-0">{footer}</div>}
|
|
345
|
+
{footer != null && <div className="kol-rail-foot shrink-0 -mx-[var(--kol-pad-rail)] border-t border-oq-08 px-[var(--kol-pad-rail)] pt-4">{footer}</div>}
|
|
240
346
|
</div>
|
|
241
347
|
</div>
|
|
242
348
|
)
|
|
@@ -249,11 +355,18 @@ export default function Rail({
|
|
|
249
355
|
? ''
|
|
250
356
|
: `transition-transform duration-200 ease-out ${shown ? (vertical ? 'translate-y-0' : 'translate-x-0') : slideOut}`
|
|
251
357
|
const place = vertical
|
|
252
|
-
|
|
358
|
+
/* no `w-full`: left and right 0 give the width, so a consumer's `left` offset (monitor's bottom rail beside its
|
|
359
|
+
sidebar) narrows the rail instead of pushing it past the viewport */
|
|
360
|
+
? `inset-x-0 ${side === 'bottom' ? 'bottom-0' : 'top-0'} max-h-full ${edgeCls}`
|
|
253
361
|
: `inset-y-0 max-w-full ${side === 'right' ? 'right-0' : 'left-0'} ${edgeCls} ${extent == null ? 'w-full' : ''}`
|
|
254
362
|
/* padding per side (RailOverlay): a bottom rail clears the home bar at its foot; a top rail its notch */
|
|
363
|
+
const safe = vertical
|
|
364
|
+
? (side === 'bottom' ? { paddingBottom: 'calc(var(--kol-pad-rail) + env(safe-area-inset-bottom, 0px))' } : { paddingTop: 'calc(var(--kol-pad-rail) + env(safe-area-inset-top, 0px))' })
|
|
365
|
+
: undefined
|
|
366
|
+
/* with a `nav` the safe-area padding belongs to the padded stack, not the panel — else the nav column stops short of
|
|
367
|
+
* the rail's bottom edge (his review 2026-10-25: *"bottom rail sidebar border stop at padding? should go all the way down"*) */
|
|
255
368
|
const size = vertical
|
|
256
|
-
? { ...(extent != null ? { height: px(extent) } : {}), ...(
|
|
369
|
+
? { ...(extent != null ? { height: px(extent) } : {}), ...(nav != null ? {} : safe) }
|
|
257
370
|
: extent != null ? { width: px(extent) } : undefined
|
|
258
371
|
const motionBackdrop = reduced
|
|
259
372
|
? ''
|
|
@@ -275,19 +388,23 @@ export default function Rail({
|
|
|
275
388
|
)}
|
|
276
389
|
<div
|
|
277
390
|
ref={panelRef}
|
|
391
|
+
data-rail-role={roleAttr}
|
|
278
392
|
role="dialog"
|
|
279
393
|
aria-modal="true"
|
|
280
394
|
tabIndex={-1}
|
|
281
395
|
/* `edge` / `shadow` (SettingsPanelApproved, 2026-08-27): the approved settings
|
|
282
396
|
* drawer has neither — the sheet meets the page flat */
|
|
283
|
-
className={`fixed z-[200] flex flex-
|
|
284
|
-
style={{ ...size, ...pad }}
|
|
397
|
+
className={`fixed z-[200] flex ${nav != null ? 'flex-row' : 'flex-col p-[var(--kol-pad-rail)]'} bg-surface-primary outline-none ${backdrop && shadow ? 'shadow-2xl' : ''} ${place} border-oq-08 ${motionPanel} ${className}`}
|
|
398
|
+
style={{ ...size, ...pad, ...style }}
|
|
285
399
|
>
|
|
286
400
|
{grab}
|
|
401
|
+
{nav}
|
|
402
|
+
<div className={nav != null ? 'flex min-h-0 min-w-0 flex-1 flex-col p-[var(--kol-pad-rail)]' : 'contents'} style={nav != null ? safe : undefined}>
|
|
287
403
|
{/* closeSide="start": the reference sets the × glyph ~9px deeper than
|
|
288
404
|
* the label column's edge, with extra top air (both reference frames
|
|
289
405
|
* 2026-08-09 measure the same inset) */}
|
|
290
|
-
|
|
406
|
+
{/* 12 from the title line to the hairline (his rulings 2026-10-25: 24 → *"I would drop it to 16"* → *"thats too big. make 8px or 12px"*) */}
|
|
407
|
+
<div className={`mb-3 flex items-center gap-4${closeSide === 'start' ? ' pt-3 pl-2' : ''}`}>
|
|
291
408
|
{/* closeSide="start" — the record-surface anatomy (reference frame,
|
|
292
409
|
* 2026-08-09): × leads, the header's actions sit at the far end. */}
|
|
293
410
|
{closeSide === 'start' && (
|
|
@@ -306,11 +423,19 @@ export default function Rail({
|
|
|
306
423
|
<CloseButton onClick={onClose} size={closeSize} hover={closeHover} className="ml-auto shrink-0" />
|
|
307
424
|
)}
|
|
308
425
|
</div>
|
|
426
|
+
{/* THE STANDARD HEADER's hairline (review 2, 2026-10-25): under the title line on every rail — the settings rail
|
|
427
|
+
* drew its own until now and the page rails had none. 24 under it, the same air a section divider gets
|
|
428
|
+
* (*"THEY SHOULD BOTH BE the same!"*) */}
|
|
429
|
+
{header != null && <Divider className="mb-6" />}
|
|
309
430
|
<div className="flex-1 overflow-y-auto pr-1" style={{ overflowAnchor: 'none' }}>
|
|
310
431
|
{children}
|
|
311
432
|
</div>
|
|
312
|
-
{/* the foot:
|
|
313
|
-
|
|
433
|
+
{/* THE FOOT IS A BAND (his review 2026-10-25, the nav rail's Settings foot as the model: *"why dont we do this for
|
|
434
|
+
* below on right rail … that would also solve the fixed footer and scrolling would clip there"*): the hairline
|
|
435
|
+
* runs the rail's full width, outside the scroller, so the content clips at the rule and the foot never moves —
|
|
436
|
+
* the Rail draws it, as it draws the header's; `SettingsFooter` and `RailFoot` draw no rule of their own */}
|
|
437
|
+
{footer != null && <div className="kol-rail-foot shrink-0 -mx-[var(--kol-pad-rail)] border-t border-oq-08 px-[var(--kol-pad-rail)] pt-4">{footer}</div>}
|
|
438
|
+
</div>
|
|
314
439
|
</div>
|
|
315
440
|
</>,
|
|
316
441
|
document.body,
|
package/src/molecules/Slider.jsx
CHANGED
|
@@ -39,6 +39,7 @@ import SliderPanel from './SliderPanel.jsx'
|
|
|
39
39
|
* @param {Function} props.formatValue - Optional formatter for displayed value; Knob's default readout is `${value}%`
|
|
40
40
|
* @param {string} props.className - Additional wrapper classes
|
|
41
41
|
* @param {number} props.displayWidth - Width of the value readout, in characters (default: 6)
|
|
42
|
+
* @param {'rail'} props.readoutPreset - the readout Input's `preset` (2026-10-25): `rail` takes the chip to 8 at the sides, a rail row's digits
|
|
42
43
|
* @param {string} props.fontSize - Font size for label/value (e.g., '11px')
|
|
43
44
|
* @param {Object} props.style - forwarded to the wrapper; the seam for `--kol-slider-track` / `--kol-slider-playhead`
|
|
44
45
|
* @param {number} props.defaultValue - alt-click the control resets to this (falls back to `min`). Same contract on Knob
|
|
@@ -67,6 +68,7 @@ const Slider = ({
|
|
|
67
68
|
formatValue,
|
|
68
69
|
className = '',
|
|
69
70
|
displayWidth = 6,
|
|
71
|
+
readoutPreset,
|
|
70
72
|
fontSize,
|
|
71
73
|
defaultValue,
|
|
72
74
|
readout = 'input',
|
|
@@ -286,6 +288,7 @@ const Slider = ({
|
|
|
286
288
|
inputMode="decimal"
|
|
287
289
|
variant="filled"
|
|
288
290
|
size="sm"
|
|
291
|
+
preset={readoutPreset}
|
|
289
292
|
chars={displayWidth}
|
|
290
293
|
value={draft}
|
|
291
294
|
disabled={disabled}
|
|
@@ -13,7 +13,7 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
13
13
|
* modules snapping to HP, the patch cables, the workbench, the desk's embla loop — stays the
|
|
14
14
|
* app's, rendered as `children` (in the pan-zoom layer) or `overlay` (screen space, over it).
|
|
15
15
|
* `CanvasEditor` is its sibling: a fixed artboard with rulers; both read `useCanvasViewport`,
|
|
16
|
-
* so a gesture or a key means the same thing on either. The keys are `CANVAS_KEYS
|
|
16
|
+
* so a gesture or a key means the same thing on either. The keys are `CANVAS_KEYS`; `1–9` are the studio's snap positions.
|
|
17
17
|
*
|
|
18
18
|
* The grid: a 1px `--kol-fg-12` dot on a 36px cell, the cell scaled by the zoom and the field
|
|
19
19
|
* offset by the pan, so the surface moves under the work. A consumer may host it on a bigger box
|
|
@@ -37,6 +37,12 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
37
37
|
* @param {boolean} spaceWhenOver Space grabs only while the pointer is over the surface (an app whose Space is the transport's elsewhere)
|
|
38
38
|
* @param {string} ignore a selector whose matches keep their own wheel and touch (an inner scroller); default fields and `[data-scroll-own]`
|
|
39
39
|
* @param {Function} onSpaceTap a Space press released without a pan
|
|
40
|
+
* @param {boolean} snapKeys `1–9` SNAP THE VIEW (CanvasStudioSnapPositions, kol-mirror 2026-10-25; default true): monitor's nine
|
|
41
|
+
* positions, numpad-laid — 7 8 9 the top, 4 5 6 the middle, 1 2 3 the bottom, left · centre · right —
|
|
42
|
+
* the content box panned to 48 inside the surface's edge or centred, never zoomed. `false` for a
|
|
43
|
+
* canvas that needs its digits
|
|
44
|
+
* @param {React.RefObject<HTMLElement>} snapRef the element the snap positions place (monitor's rack); absent, the union of the
|
|
45
|
+
* layer's children
|
|
40
46
|
* @param {ReactNode} backdrop a node behind the children, inside the pan-zoom layer
|
|
41
47
|
* @param {ReactNode} overlay nodes in screen space over the layer — cables, chips
|
|
42
48
|
* @param {string} className on the surface
|
|
@@ -60,6 +66,8 @@ export default function CanvasStudio({
|
|
|
60
66
|
spaceWhenOver = false,
|
|
61
67
|
ignore,
|
|
62
68
|
onSpaceTap,
|
|
69
|
+
snapKeys = true,
|
|
70
|
+
snapRef,
|
|
63
71
|
backdrop,
|
|
64
72
|
overlay,
|
|
65
73
|
className = '',
|
|
@@ -75,10 +83,20 @@ export default function CanvasStudio({
|
|
|
75
83
|
if (!fit || !sh || !h) return undefined
|
|
76
84
|
return { zoom: Math.min(maxZoom, Math.max(minZoom, sh / h)), x: 0, y: 0 }
|
|
77
85
|
}
|
|
86
|
+
/* the box the snap positions place: the named element, else everything on the layer (screen space, so the zoom is in it) */
|
|
87
|
+
const contentBox = () => {
|
|
88
|
+
if (snapRef?.current) return snapRef.current.getBoundingClientRect()
|
|
89
|
+
const kids = [...(layer.current?.children ?? [])].map((k) => k.getBoundingClientRect()).filter((r) => r.width || r.height)
|
|
90
|
+
if (!kids.length) return null
|
|
91
|
+
const left = Math.min(...kids.map((r) => r.left)), top = Math.min(...kids.map((r) => r.top))
|
|
92
|
+
const right = Math.max(...kids.map((r) => r.right)), bottom = Math.max(...kids.map((r) => r.bottom))
|
|
93
|
+
return { left, top, right, bottom, width: right - left, height: bottom - top }
|
|
94
|
+
}
|
|
78
95
|
const vp = useCanvasViewport({
|
|
79
96
|
ref, view, defaultView, onViewChange, minZoom, maxZoom, rest: fitView,
|
|
80
97
|
locked, onLockChange, grid, onGridChange, gridKey: true, lockKey: true,
|
|
81
98
|
touch, spaceWhenOver, ignore, onSpaceTap,
|
|
99
|
+
snapKeys, content: contentBox,
|
|
82
100
|
})
|
|
83
101
|
const { zoom, x, y } = vp.view
|
|
84
102
|
/* on open, the fit is the view — after layout, so the layer has its height */
|
|
@@ -392,6 +392,10 @@ function AppRail({
|
|
|
392
392
|
className="kol-rail-grab"
|
|
393
393
|
aria-label={railOpen ? 'Collapse navigation' : 'Expand navigation'}
|
|
394
394
|
aria-expanded={railOpen}
|
|
395
|
+
/* a pointer press never leaves focus on the strip (2026-10-25): a rail closing on its key returned focus here
|
|
396
|
+
* and the strip lit its full-height focus ring — *"make sure this doesnt happen when I press E 2 times"*.
|
|
397
|
+
* Pointer events still reach the drag hook; Tab + Enter/Space keep the keyboard path */
|
|
398
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
395
399
|
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); snapOpenRef.current?.(!railOpen) } }}
|
|
396
400
|
/>
|
|
397
401
|
)}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import SegmentedToggle from '../atoms/SegmentedToggle.jsx'
|
|
2
|
-
import
|
|
2
|
+
import Button from '../atoms/Button.jsx'
|
|
3
|
+
import { Tooltip } from '../utilities/Popover.jsx'
|
|
4
|
+
import { RAIL_ROW } from '../hooks/railRow.js'
|
|
3
5
|
|
|
4
6
|
/* taxonomy-ok: organism — the parts a Rail's content is built from, beside SettingsPanel's LabeledControlSection and SettingsRow */
|
|
5
7
|
|
|
@@ -23,7 +25,11 @@ import Divider from '../atoms/Divider.jsx'
|
|
|
23
25
|
* RailRow = SettingsRow — label · control, the label column fixed (160) or `labelWidth="auto"` in a narrow rail
|
|
24
26
|
* RailHint one quiet line under a row or a group (mono-10, meta ink — fxr's)
|
|
25
27
|
* RailActions full-width buttons stacked, or `row` for a line of icon buttons
|
|
26
|
-
* RailFoot the pinned foot —
|
|
28
|
+
* RailFoot the pinned foot — optional tabs, then the slot; passed to Rail's `footer` (the Rail draws the band's rule)
|
|
29
|
+
* RailNav the collapsed nav rail's icon column INSIDE a rail (review 2, 2026-10-25 — the bottom rail over the nav
|
|
30
|
+
* rail: *"same icon system as collapsed siderail … just icons for Edit Rack and library, like a siderail
|
|
31
|
+
* in the bottom rail"*): 48 wide, the rail's 8px gutter, the nav rail's buttons, lit on the active view;
|
|
32
|
+
* passed to Rail's `nav`
|
|
27
33
|
*
|
|
28
34
|
* The reference is `apps/rails` (`pnpm rails`): every part on its own, then the whole rails — the settings rail, an
|
|
29
35
|
* inspector like fxr's, a list rail like monitor's patch table, and the bottom rail — in both tiers.
|
|
@@ -59,13 +65,39 @@ export function RailActions({ row = false, children, className = '' }) {
|
|
|
59
65
|
: <div className={`flex flex-col gap-2 [&>*]:w-full ${className}`.trim()}>{children}</div>
|
|
60
66
|
}
|
|
61
67
|
|
|
62
|
-
/** RailFoot — the pinned foot for Rail's `footer` slot:
|
|
68
|
+
/** RailFoot — the pinned foot for Rail's `footer` slot: its own tabs when it has them, then the slot (the rule is the Rail's band, 2026-10-25). */
|
|
63
69
|
export function RailFoot({ tabs, value, onChange, ariaLabel = 'Foot tabs', children, className = '' }) {
|
|
64
70
|
return (
|
|
65
|
-
<div className={`flex flex-col gap-4
|
|
66
|
-
<Divider />
|
|
71
|
+
<div className={`flex flex-col gap-4 ${className}`.trim()}>
|
|
67
72
|
{tabs?.length > 0 && <RailTabs tabs={tabs} value={value} onChange={onChange} ariaLabel={ariaLabel} />}
|
|
68
73
|
{children}
|
|
69
74
|
</div>
|
|
70
75
|
)
|
|
71
76
|
}
|
|
77
|
+
|
|
78
|
+
/** RailNav — the collapsed nav rail's icon column inside a rail: `items` `[{ id, icon, label }]`, the active `value`,
|
|
79
|
+
* `onChange(id)`. The nav rail's own geometry and ink (48 wide, `px-2 gap-2 pt-4`, md nav buttons with the 20 glyph at
|
|
80
|
+
* oq-96, `aria-current` on the active one, the DS tooltip to the right), no edge of its own (his review 2026-10-25:
|
|
81
|
+
* *"remove the border on the bottom rail siderail"*) — so a bottom rail over the nav rail carries its views exactly
|
|
82
|
+
* under the nav rail's rows. */
|
|
83
|
+
export function RailNav({ items = [], value, onChange, iconComponent, ariaLabel = 'Views', className = '' }) {
|
|
84
|
+
return (
|
|
85
|
+
<nav aria-label={ariaLabel} className={`kol-rail-nav flex w-12 shrink-0 self-stretch flex-col items-center gap-2 px-2 pt-4 pb-4 ${className}`.trim()}>
|
|
86
|
+
{items.map((it) => (
|
|
87
|
+
<Tooltip key={it.id} label={it.label} placement="right" triggerClassName="inline-flex shrink-0">
|
|
88
|
+
<Button
|
|
89
|
+
iconOnly={it.icon}
|
|
90
|
+
iconSize={RAIL_ROW.glyph}
|
|
91
|
+
iconComponent={iconComponent}
|
|
92
|
+
variant="nav"
|
|
93
|
+
size="md"
|
|
94
|
+
aria-current={value === it.id ? 'page' : undefined}
|
|
95
|
+
style={{ color: RAIL_ROW.active }}
|
|
96
|
+
aria-label={it.label}
|
|
97
|
+
onClick={() => onChange?.(it.id)}
|
|
98
|
+
/>
|
|
99
|
+
</Tooltip>
|
|
100
|
+
))}
|
|
101
|
+
</nav>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
@@ -42,6 +42,8 @@ import { RailHeader } from './RailKit.jsx'
|
|
|
42
42
|
* @param {'app'|'site'} tier THE RAIL'S TIER (RailKit, kol-monitor 2026-10-24; default `app`): its width and padding are
|
|
43
43
|
* the tier's tokens, the same the page rails read — `app` 320, `site` 380, the overlay inset.
|
|
44
44
|
* The 380 of 2026-08-27 is the site tier's; an app's settings rail is as wide as its other rails
|
|
45
|
+
* @param {'settings'|'page'} role THE RAIL'S ROLE (RailRoles, 2026-10-25; default `settings`): `page` for a page's own settings rail
|
|
46
|
+
* (monitor's Stage, Rack — H), which is this same shell under the page's key; `Rail role` carries it
|
|
45
47
|
* @param {number|string} width width — overrides the tier's for the rail; the ⌘K overlay's 32rem for the overlay
|
|
46
48
|
* @param {string} title header line 1
|
|
47
49
|
* @param {string} subtitle header line 2 (the approved drawer passes none)
|
|
@@ -49,7 +51,8 @@ import { RailHeader } from './RailKit.jsx'
|
|
|
49
51
|
* @param {Function} onClose × · scrim · Escape
|
|
50
52
|
* @param {ReactNode} footer the foot slot — `SettingsFooter` is the default shape
|
|
51
53
|
* @param {ReactNode} headerActions controls on the header line, before the × (the file rail's edit pencil, 2026-10-23)
|
|
52
|
-
* @param {boolean} backdrop the rail's scrim
|
|
54
|
+
* @param {boolean} backdrop the rail's scrim — unset, THE ROLE decides (review 2, 2026-10-25: `settings` dims and locks the page,
|
|
55
|
+
* `page` does not — *"H does not include dark overlay, that is only settings"*). `false`
|
|
53
56
|
* is the Rail's own: the panel alone, no scrim, no scroll lock, no focus trap — a PAGE-LEVEL rail
|
|
54
57
|
* over a live page, the bottom rail's setup (SettingsPanelBackdrop, kol-monitor 2026-10-24: the
|
|
55
58
|
* rack's and the stage's settings open over the running picture and its keys keep working).
|
|
@@ -62,6 +65,7 @@ export default function SettingsPanel({
|
|
|
62
65
|
open = true,
|
|
63
66
|
variant = 'rail',
|
|
64
67
|
tier = 'app',
|
|
68
|
+
role = 'settings',
|
|
65
69
|
width: widthProp,
|
|
66
70
|
title,
|
|
67
71
|
subtitle,
|
|
@@ -69,7 +73,7 @@ export default function SettingsPanel({
|
|
|
69
73
|
onClose,
|
|
70
74
|
footer,
|
|
71
75
|
headerActions,
|
|
72
|
-
backdrop
|
|
76
|
+
backdrop,
|
|
73
77
|
mode = 'over',
|
|
74
78
|
children,
|
|
75
79
|
className = '',
|
|
@@ -111,7 +115,7 @@ export default function SettingsPanel({
|
|
|
111
115
|
const width = widthProp
|
|
112
116
|
return (
|
|
113
117
|
/* THE APPROVED DRAWER (SettingsPanelApproved, kol-r2b2 2026-08-27 — user: "LOCK
|
|
114
|
-
THIS"): no edge, no shadow,
|
|
118
|
+
THIS"): no edge, no shadow, the Rail's hairline under the header, the sections.
|
|
115
119
|
THE SCRIM IS BACK (settings-drawer-has-no-surface, kol-client-olina
|
|
116
120
|
2026-09-03). `backdrop={false}` stood here from 2026-08-30; the drawer
|
|
117
121
|
paints `bg-surface-primary`, the same token as the page, so the scrim was
|
|
@@ -119,10 +123,11 @@ export default function SettingsPanel({
|
|
|
119
123
|
the controls floated in the right third of the screen.
|
|
120
124
|
`backdrop` FORWARDS (SettingsPanelBackdrop, kol-monitor 2026-10-24): the default keeps olina's scrim; a page-level
|
|
121
125
|
rail passes `false` and gets the Rail's own no-scrim setup — the page keeps running under it. */
|
|
122
|
-
<Rail open={open} onClose={onClose} side="right" variant={tier} width={width} header={header} className={className} edge={false} shadow={false} closeHover={false} backdrop={backdrop} mode={mode}
|
|
126
|
+
<Rail role={role} open={open} onClose={onClose} side="right" variant={tier} width={width} header={header} className={className} edge={false} shadow={false} closeHover={false} backdrop={backdrop} mode={mode}
|
|
123
127
|
/* the foot is the Rail's pinned slot now (RailKit): reset and the verbs stay in reach while the sections scroll */
|
|
124
|
-
footer={footer
|
|
125
|
-
|
|
128
|
+
footer={footer}>
|
|
129
|
+
{/* the hairline under the header is the Rail's now (the standard header, 2026-10-25) — every rail has it */}
|
|
130
|
+
<div className="flex flex-col gap-4">{body}</div>
|
|
126
131
|
</Rail>
|
|
127
132
|
)
|
|
128
133
|
}
|
|
@@ -269,7 +274,7 @@ export function SettingsChipRow({ options = [], selected = [], onToggle, allChip
|
|
|
269
274
|
)
|
|
270
275
|
}
|
|
271
276
|
|
|
272
|
-
/** SettingsFooter — Reset settings to their defaults.
|
|
277
|
+
/** SettingsFooter — Reset settings to their defaults. one `IconFrame refresh` (primary · sm) at the
|
|
273
278
|
* right = reset to defaults (SettingsPanelApproved, 2026-08-27). No status word,
|
|
274
279
|
* no text button. `customised` is accepted for compatibility and unused.
|
|
275
280
|
*
|
|
@@ -284,9 +289,8 @@ export function SettingsChipRow({ options = [], selected = [], onToggle, allChip
|
|
|
284
289
|
* for one control and wrong for two — the chip and the reset icon touched. */
|
|
285
290
|
export function SettingsFooter({ onReset, resetLabel = 'Reset to defaults', resetDisabled = false, children }) {
|
|
286
291
|
return (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
<div className="kol-ink-step flex justify-end items-center gap-2">
|
|
292
|
+
/* no Divider here since 2026-10-25: the rule is the Rail's foot band, full width */
|
|
293
|
+
<div className="kol-ink-step flex justify-end items-center gap-2">
|
|
290
294
|
{children}
|
|
291
295
|
{/* `resetDisabled`: the control stays in its place, dimmed and inert — one footer shape on every rail, whether or
|
|
292
296
|
* not the app has preferences to reset yet (user 2026-10-24: *"standardise what goes in"*) */}
|
|
@@ -296,6 +300,5 @@ export function SettingsFooter({ onReset, resetLabel = 'Reset to defaults', rese
|
|
|
296
300
|
</Tooltip>
|
|
297
301
|
)}
|
|
298
302
|
</div>
|
|
299
|
-
</div>
|
|
300
303
|
)
|
|
301
304
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LabeledControlSection, SettingsChoice, SettingsRow, SettingsSwitch } from './SettingsPanel.jsx'
|
|
2
|
+
import Slider from '../molecules/Slider.jsx'
|
|
2
3
|
|
|
3
4
|
/* A STRING VALUE WEARS THE DS'S CLASS (user 2026-10-24, on Mirror's settings rail: *"YOU ARE USING A HELPER text for
|
|
4
5
|
* paragraphs"* — *"THIS SHOULDNT BE POSSIBLE if you were using a preset"*). A consumer that hands rows as data never
|
|
@@ -13,11 +14,17 @@ const notes = (note) => (Array.isArray(note) ? note : [note]).map((n, i) => <p k
|
|
|
13
14
|
const control = (row) => {
|
|
14
15
|
if (row.type === 'choice') return <SettingsChoice options={row.options ?? []} value={row.value} onChange={row.onChange} ariaLabel={row.ariaLabel ?? (typeof row.label === 'string' ? row.label : undefined)} />
|
|
15
16
|
if (row.type === 'switch') return <SettingsSwitch on={!!row.on} onChange={row.onChange} disabled={row.disabled} disabledHint={row.disabledHint} label={row.ariaLabel ?? (typeof row.label === 'string' ? row.label : undefined)} />
|
|
17
|
+
/* a slider row (review 2, 2026-10-25 — the Stage's parameters in H): the DS Slider across the value column, the track
|
|
18
|
+
* fluid, the readout the DS Input at a fixed `displayWidth` (3 chars) so every row's track and chip align (his review:
|
|
19
|
+
* *"sliders should be using the space better and we have input component"*); `min` · `max` · `step` · `value` ·
|
|
20
|
+
* `onChange` · `formatValue` · `defaultValue` are the Slider's. Its label column is 80 unless a width is given — the
|
|
21
|
+
* track takes the rest (*"why cant the slider use the space available"*); the chip is `preset="rail"`, 8 at the sides */
|
|
22
|
+
if (row.type === 'slider') return <Slider className="w-full" readout="input" displayWidth={row.displayWidth ?? 3} readoutPreset="rail" min={row.min} max={row.max} step={row.step} value={row.value} onChange={row.onChange} formatValue={row.formatValue} defaultValue={row.defaultValue} disabled={row.disabled} aria-label={row.ariaLabel ?? (typeof row.label === 'string' ? row.label : undefined)} />
|
|
16
23
|
if (row.render) return row.render()
|
|
17
24
|
return isText(row.value) ? textValue(row.value) : row.value
|
|
18
25
|
}
|
|
19
26
|
/* a typed row's cell: a choice fills the value column, a switch sits at its end, text sits on the baseline */
|
|
20
|
-
const rowAlign = (row, fallback) => row.align ?? (row.type === 'choice' ? 'fill' : fallback)
|
|
27
|
+
const rowAlign = (row, fallback) => row.align ?? (row.type === 'choice' || row.type === 'slider' ? 'fill' : fallback)
|
|
21
28
|
|
|
22
29
|
/**
|
|
23
30
|
* SettingsSections — settings rows AS DATA, rendered once.
|
|
@@ -53,13 +60,14 @@ const rowAlign = (row, fallback) => row.align ?? (row.type === 'choice' ? 'fill'
|
|
|
53
60
|
* TYPED ROWS (user 2026-10-24, on FXR's rail drawing its own sunken dropdown beside the reference's: *"we are literally
|
|
54
61
|
* avoiding this custom per repo shit"*): a row names its CONTROL as data and this draws it — `{ type: 'choice', options,
|
|
55
62
|
* value, onChange, ariaLabel? }` is a `SettingsChoice`, `{ type: 'switch', on, onChange, disabled?, disabledHint? }` a
|
|
56
|
-
* `SettingsSwitch`
|
|
63
|
+
* `SettingsSwitch`, `{ type: 'slider', min, max, step, value, onChange }` the DS `Slider` (review 2, 2026-10-25) — in
|
|
64
|
+
* the surface's tone, never the consumer's. The Hub's rail takes typed rows and refuses `render`.
|
|
57
65
|
*
|
|
58
66
|
* `divided` puts the hairline above a section — pass it on EVERY section, the
|
|
59
67
|
* first included: the rule is `.kol-section--divided + .kol-section--divided`,
|
|
60
68
|
* so the first draws nothing and skipping it just costs the next its line.
|
|
61
69
|
*
|
|
62
|
-
* @param {Array<{label?: string, note?: string|string[], rows?: Array<{label: ReactNode, type?: 'choice'|'switch', options?: Array, value?: ReactNode, on?: boolean, onChange?: Function, render?: Function, hint?: string, align?: string, labelWidth?: number|'auto', text?: boolean, id?: string}>, rowGap?: number}>} sections - The settings body, in order (`hint` → SettingsRow's hint; `note` a sentence or two under the eyebrow; a string `value` is drawn in the DS's mono-12 and sits on the baseline; `type: 'choice'` / `'switch'` rows are drawn here)
|
|
70
|
+
* @param {Array<{label?: string, note?: string|string[], rows?: Array<{label: ReactNode, type?: 'choice'|'switch'|'slider', options?: Array, value?: ReactNode, on?: boolean, onChange?: Function, min?: number, max?: number, step?: number, formatValue?: Function, defaultValue?: number, displayWidth?: number, render?: Function, hint?: string, align?: string, labelWidth?: number|'auto', text?: boolean, id?: string}>, rowGap?: number}>} sections - The settings body, in order (`hint` → SettingsRow's hint; `note` a sentence or two under the eyebrow; a string `value` is drawn in the DS's mono-12 and sits on the baseline; `type: 'choice'` / `'switch'` / `'slider'` rows are drawn here — a slider is the DS Slider across the value column, fluid track + the Input readout at `displayWidth` chars (3, `preset="rail"`), its label column 80 unless set; `min` · `max` · `step` · `value` · `onChange`)
|
|
63
71
|
* @param {boolean} [divided=false] - Hairline above each section
|
|
64
72
|
* @param {number|'auto'} [labelWidth] - Default label column for every row — `'auto'` makes the label yield and the control hug, which is what a narrow column or a nowrap value needs
|
|
65
73
|
* @param {string} [align] - Default row alignment passed to `SettingsRow`
|
|
@@ -77,7 +85,7 @@ export default function SettingsSections({ sections = [], divided = false, label
|
|
|
77
85
|
label={row.label}
|
|
78
86
|
hint={row.hint}
|
|
79
87
|
align={rowAlign(row, align)}
|
|
80
|
-
labelWidth={row.labelWidth ?? labelWidth}
|
|
88
|
+
labelWidth={row.labelWidth ?? labelWidth ?? (row.type === 'slider' ? 80 : undefined)}
|
|
81
89
|
text={row.text ?? (!row.render && !row.type && isText(row.value))}
|
|
82
90
|
>
|
|
83
91
|
{control(row)}
|