@kolkrabbi/kol-component 0.300.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.300.0",
3
+ "version": "0.302.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -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. */
@@ -211,6 +211,10 @@ export { default as SettingsPanel, LabeledControlSection, SettingsRow, SettingsS
211
211
  /* the settings BODY as data — one call for the page, the drawer and a sheet
212
212
  * (user 2026-09-03: "lets normalise a component they can grab") */
213
213
  export { default as SettingsSections } from './organisms/SettingsSections.jsx'
214
+ /* the rail kit (RailKit, kol-monitor 2026-10-24): the parts a Rail's content is built from; RailSection and RailRow
215
+ * are the settings rail's LabeledControlSection and SettingsRow under the kit's names — the same components */
216
+ export { RailHeader, RailTabs, RailHint, RailActions, RailFoot, RailNav } from './organisms/RailKit.jsx'
217
+ export { LabeledControlSection as RailSection, SettingsRow as RailRow } from './organisms/SettingsPanel.jsx'
214
218
  export { default as SectionNewsletter } from './organisms/SectionNewsletter.jsx'
215
219
  export { default as NewsletterBand } from './organisms/NewsletterBand.jsx'
216
220
  export { default as ColumnBrowser } from './organisms/ColumnBrowser.jsx'
@@ -40,9 +40,17 @@ import { toneClass } from '../utilities/tone.js'
40
40
  * is HOW it shows — `flip-image` (the media turns, the plate and the corner controls stay; default),
41
41
  * `flip-card` (the whole card turns, the back fills it, bare), `hover` (the back cuts in over the
42
42
  * front, no motion) — three treatments on the open-questions page (round 17) for the user's pick; the
43
- * losers go after his ruling. The choreography is kol-theme's (`.kol-card[data-back]`, kol-animation.css);
43
+ * losers go after his ruling. The choreography is kol-theme's (`[data-back]`, kol-animation.css);
44
44
  * reduced motion makes both flips the cut; touch has no hover and keeps the front. Absent `back` = the
45
45
  * card as it was. Not `reveal`: that name is the canvas card's overlay NODE.
46
+ *
47
+ * THE WHOLE CARD TURNS, ON A KEY, HOVER OPT-IN (AppCardWholeFlip, kol-monitor 2026-10-24 — user: *"it doesnt truly
48
+ * flip the card, there is still the background that remains"* · *"make the cards flip on a shortcut and disable the
49
+ * hover"* · *"hover flips card? default off"*). `flip-card` is a 3D turner AROUND the card: the card root — plate, text,
50
+ * controls, its own ground — is the front face, and the back is a second full face on the card's surface
51
+ * (surface-secondary, the card's radius) holding the picture; nothing stays behind. `flipped` (controlled) turns the
52
+ * card — `CatalogPage` and `HubHome` take a page-level one, so a page turns every card on a key — and `backHover`
53
+ * (default false) opts the hover (and keyboard focus) reveal in. The faces swap by backface, never a timed visibility.
46
54
  */
47
55
 
48
56
  /* ruled defaults — defaults, not hardcodes; `ratio` stays overridable while
@@ -192,6 +200,9 @@ export default function ContentCard({
192
200
  /* `back` + `backReveal` — the second cover and how it shows (AppCardBackCover, 2026-10-24) */
193
201
  back,
194
202
  backReveal = 'flip-image',
203
+ /* `flipped` · `backHover` — the controlled turn and the opt-in hover (AppCardWholeFlip, 2026-10-24) */
204
+ flipped = false,
205
+ backHover = false,
195
206
  /* plateRule (CatalogCardFrameAndZoom): the plate's top hairline — default the variant's (catalog and
196
207
  * print draw it); `false` turns it off without an `!important` in a consumer sheet */
197
208
  plateRule,
@@ -505,14 +516,8 @@ export default function ContentCard({
505
516
  </>
506
517
  )
507
518
 
508
- /* `flip-card`: the WHOLE card is the front face and the back fills the card — every control turns
509
- * away with the front, which is the treatment's cost (named on round 17) */
510
- const turned = backMode === 'flip-card' ? (
511
- <div className="kol-card-turn-inner flex flex-col">
512
- <div className="kol-card-face kol-card-face--front flex flex-col">{body}</div>
513
- {backFace}
514
- </div>
515
- ) : body
519
+ /* `flip-card` wraps the ROOT below — the whole card is the front face (AppCardWholeFlip) */
520
+ const turned = body
516
521
 
517
522
  /* THE ROOT FOLLOWS THE AFFORDANCE. A card that navigates must be a real <a>:
518
523
  * middle-click, cmd-click, focus order, "copy link address" and every screen
@@ -534,8 +539,11 @@ export default function ContentCard({
534
539
 
535
540
  const common = {
536
541
  'data-tags': isHero && Array.isArray(text.tags) && text.tags.length ? text.tags.join(' ') : undefined,
537
- 'data-back': backMode ?? undefined,
538
- className: `kol-card group flex ${toneClass(tone)} ${box.layout === 'canvas' && reveal != null ? 'has-reveal' : ''} ${expanded ? 'flex-col md:flex-row-reverse' : 'flex-col'} ${box.layout === 'drawer' ? 'relative overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${backMode === 'flip-card' ? 'relative' : ''} ${framed ? 'overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${box.border ? 'border' : ''} ${box.layout === 'canvas' ? 'relative' : ''} ${interactive ? 'cursor-pointer select-none' : ''} ${hoverBg && interactive ? 'kol-content-hover' : ''} ${interactive && box.frameHover ? 'kol-content-hover-frame' : ''} ${className}`.trim(),
542
+ /* flip-card's attributes ride the turner around the root (below); the other two treatments mark the root */
543
+ 'data-back': backMode && backMode !== 'flip-card' ? backMode : undefined,
544
+ 'data-back-hover': backMode && backMode !== 'flip-card' && backHover ? '' : undefined,
545
+ 'data-flipped': backMode && backMode !== 'flip-card' && flipped ? '' : undefined,
546
+ className: `kol-card group flex ${toneClass(tone)} ${box.layout === 'canvas' && reveal != null ? 'has-reveal' : ''} ${expanded ? 'flex-col md:flex-row-reverse' : 'flex-col'} ${box.layout === 'drawer' ? 'relative overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${framed ? 'overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${box.border ? 'border' : ''} ${box.layout === 'canvas' ? 'relative' : ''} ${interactive ? 'cursor-pointer select-none' : ''} ${hoverBg && interactive ? 'kol-content-hover' : ''} ${interactive && box.frameHover ? 'kol-content-hover-frame' : ''} ${className}`.trim(),
539
547
  style: {
540
548
  /* same reason as ContentRow: rest colors are PROPERTIES, because an
541
549
  * inline background/borderColor outranks the hover class and the step
@@ -554,11 +562,24 @@ export default function ContentCard({
554
562
  },
555
563
  }
556
564
 
565
+ /* THE TURNER AROUND THE ROOT (`flip-card`, AppCardWholeFlip): the card is the front face, the back a full face on
566
+ * the card's surface — perspective, preserve-3d, both faces backface-hidden, kol-theme's `[data-back="flip-card"]` */
567
+ const turn = (root) => backMode === 'flip-card' ? (
568
+ <div className="kol-card-turn" data-back="flip-card" data-back-hover={backHover ? '' : undefined} data-flipped={flipped ? '' : undefined} style={{ gridColumn: common.style.gridColumn, gridRow: common.style.gridRow }}>
569
+ <div className="kol-card-turn-inner">
570
+ <div className="kol-card-face kol-card-face--front">{root}</div>
571
+ <div className="kol-card-face kol-card-face--back overflow-hidden rounded-[var(--kol-radius-sm)] bg-surface-secondary" aria-hidden={!flipped || undefined}>
572
+ <ContentMedia ratio={null} radius={false} fit="cover">{backNode}</ContentMedia>
573
+ </div>
574
+ </div>
575
+ </div>
576
+ ) : root
577
+
557
578
  if (href) {
558
- return <a href={href} onClick={nav} {...common}>{turned}</a>
579
+ return turn(<a href={href} onClick={nav} {...common}>{turned}</a>)
559
580
  }
560
581
  if (onClick) {
561
- return (
582
+ return turn(
562
583
  <article
563
584
  onClick={onClick}
564
585
  onContextMenu={onContextMenu}
@@ -578,8 +599,8 @@ export default function ContentCard({
578
599
  {...common}
579
600
  >
580
601
  {turned}
581
- </article>
602
+ </article>,
582
603
  )
583
604
  }
584
- return <article {...common}>{turned}</article>
605
+ return turn(<article {...common}>{turned}</article>)
585
606
  }
@@ -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,6 +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
60
+ * @param {'app'|'site'} variant THE TIER (RailKit, kol-monitor 2026-10-24): its width when `width` / `height` is not given
61
+ * (`--kol-rail-w-app` 320 · `--kol-rail-w-site` 380) and its padding (`--kol-pad-rail-app` ·
62
+ * `--kol-pad-rail-site`), kol-theme's tokens — so the settings rail and a page rail of one
63
+ * app are one size. Unset = the rail as before (`--kol-pad-overlay`, the width yours)
64
+ * @param {ReactNode} footer a FOOT pinned below the scrolling body (fxr's transport dock; `RailFoot` is its shape) —
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
40
67
  * @param {boolean} open drawer visible (drives slide in/out)
41
68
  * @param {Function} onClose close request (Esc / backdrop / close button)
42
69
  * @param {string} side 'left' | 'right' | 'bottom' — edge the panel slides from.
@@ -56,12 +83,87 @@ const FOCUSABLE =
56
83
  * @param {ReactNode} children scrollable panel body
57
84
  * @param {string} className extra classes on the panel
58
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
+
59
156
  const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v))
60
157
  const px = (v) => (v == null ? undefined : typeof v === 'number' ? `${v}px` : v)
61
158
 
62
- export default function Rail({
159
+ function RailShell({
160
+ 'data-rail-role': roleAttr,
161
+ style,
162
+ nav,
63
163
  open,
64
164
  onClose,
165
+ variant,
166
+ footer,
65
167
  side = 'left',
66
168
  mode = 'over',
67
169
  resizable = false,
@@ -93,6 +195,13 @@ export default function Rail({
93
195
  const vertical = side === 'top' || side === 'bottom'
94
196
  /* the rail's own size once dragged; null = the `width` / `height` given */
95
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' })
96
205
  const startResize = (e) => {
97
206
  if (!resizable) return
98
207
  e.preventDefault()
@@ -106,19 +215,23 @@ export default function Rail({
106
215
  setDragged(next)
107
216
  onResize?.(next)
108
217
  }
109
- 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) }
110
219
  document.body.style.cursor = vertical ? 'row-resize' : 'col-resize'
111
220
  document.body.style.userSelect = 'none'
221
+ setResizing(true)
112
222
  window.addEventListener('pointermove', move)
113
223
  window.addEventListener('pointerup', up)
114
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 */
115
227
  const grab = resizable && (
116
228
  <span
229
+ ref={grabRef}
117
230
  role="separator"
118
231
  aria-orientation={vertical ? 'horizontal' : 'vertical'}
119
232
  aria-label="Resize"
120
233
  onPointerDown={startResize}
121
- className={`absolute z-10 touch-none transition-colors hover:bg-oq-16 active:bg-oq-24 ${vertical ? 'inset-x-0 h-1.5 cursor-row-resize' : 'inset-y-0 w-1.5 cursor-col-resize'} ${side === 'bottom' ? 'top-0' : side === 'top' ? 'bottom-0' : side === 'right' ? 'left-0' : 'right-0'}`}
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()}
122
235
  />
123
236
  )
124
237
  const push = mode === 'push'
@@ -196,17 +309,20 @@ export default function Rail({
196
309
  * exists before we focus it (it mounts one commit after `open` flips). */
197
310
  useEffect(() => {
198
311
  if (!(open && present) || push) return undefined
199
- const prevOverflow = document.body.style.overflow
200
- document.body.style.overflow = 'hidden'
312
+ lockScroll()
201
313
  const prevFocus = document.activeElement
202
314
  panelRef.current?.focus()
203
315
  return () => {
204
- document.body.style.overflow = prevOverflow
316
+ unlockScroll()
205
317
  if (prevFocus instanceof HTMLElement) prevFocus.focus()
206
318
  }
207
319
  }, [open, present, push])
208
320
 
209
- const extent = dragged ?? (vertical ? height : width)
321
+ /* the tier's width stands in for an absent `width` on a side rail; a bottom or top rail keeps its own height */
322
+ const tierWidth = variant && !vertical && width == null ? `var(--kol-rail-w-${variant})` : undefined
323
+ const extent = dragged ?? (vertical ? height : width ?? tierWidth)
324
+ /* the tier's padding, else the overlay inset — one variable the classes below read */
325
+ const pad = { '--kol-pad-rail': variant ? `var(--kol-pad-rail-${variant})` : 'var(--kol-pad-overlay)' }
210
326
  /* the edge that faces the page carries the border, on every side */
211
327
  const edgeCls = edge ? ({ left: 'border-r', right: 'border-l', top: 'border-b', bottom: 'border-t' })[side] : ''
212
328
 
@@ -216,14 +332,17 @@ export default function Rail({
216
332
  return (
217
333
  <div
218
334
  ref={panelRef}
335
+ data-rail-role={roleAttr}
219
336
  aria-hidden={!open || undefined}
220
337
  className={`relative shrink-0 overflow-hidden bg-surface-primary border-oq-08 ${open ? edgeCls : ''} ${reduced ? '' : 'transition-[width,height] duration-200 ease-out'} ${className}`}
221
- style={sizeStyle}
338
+ style={{ ...sizeStyle, ...pad, ...style }}
222
339
  >
223
340
  {grab}
224
- <div className="flex h-full flex-col p-[var(--kol-pad-overlay)]">
225
- {header != null && <div className="mb-6 min-w-0">{header}</div>}
341
+ <div className="flex h-full flex-col p-[var(--kol-pad-rail)]">
342
+ {header != null && <div className="mb-3 min-w-0">{header}</div>}
343
+ {header != null && <Divider className="mb-6" />}
226
344
  <div className="flex-1 overflow-auto" style={{ overflowAnchor: 'none' }}>{children}</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>}
227
346
  </div>
228
347
  </div>
229
348
  )
@@ -236,11 +355,18 @@ export default function Rail({
236
355
  ? ''
237
356
  : `transition-transform duration-200 ease-out ${shown ? (vertical ? 'translate-y-0' : 'translate-x-0') : slideOut}`
238
357
  const place = vertical
239
- ? `inset-x-0 ${side === 'bottom' ? 'bottom-0' : 'top-0'} w-full max-h-full ${edgeCls}`
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}`
240
361
  : `inset-y-0 max-w-full ${side === 'right' ? 'right-0' : 'left-0'} ${edgeCls} ${extent == null ? 'w-full' : ''}`
241
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"*) */
242
368
  const size = vertical
243
- ? { ...(extent != null ? { height: px(extent) } : {}), ...(side === 'bottom' ? { paddingBottom: 'calc(var(--kol-pad-overlay) + env(safe-area-inset-bottom, 0px))' } : { paddingTop: 'calc(var(--kol-pad-overlay) + env(safe-area-inset-top, 0px))' }) }
369
+ ? { ...(extent != null ? { height: px(extent) } : {}), ...(nav != null ? {} : safe) }
244
370
  : extent != null ? { width: px(extent) } : undefined
245
371
  const motionBackdrop = reduced
246
372
  ? ''
@@ -262,19 +388,23 @@ export default function Rail({
262
388
  )}
263
389
  <div
264
390
  ref={panelRef}
391
+ data-rail-role={roleAttr}
265
392
  role="dialog"
266
393
  aria-modal="true"
267
394
  tabIndex={-1}
268
395
  /* `edge` / `shadow` (SettingsPanelApproved, 2026-08-27): the approved settings
269
396
  * drawer has neither — the sheet meets the page flat */
270
- className={`fixed z-[200] flex flex-col bg-surface-primary p-[var(--kol-pad-overlay)] outline-none ${backdrop && shadow ? 'shadow-2xl' : ''} ${place} border-oq-08 ${motionPanel} ${className}`}
271
- style={size}
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 }}
272
399
  >
273
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}>
274
403
  {/* closeSide="start": the reference sets the × glyph ~9px deeper than
275
404
  * the label column's edge, with extra top air (both reference frames
276
405
  * 2026-08-09 measure the same inset) */}
277
- <div className={`mb-6 flex items-center gap-4${closeSide === 'start' ? ' pt-3 pl-2' : ''}`}>
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' : ''}`}>
278
408
  {/* closeSide="start" — the record-surface anatomy (reference frame,
279
409
  * 2026-08-09): × leads, the header's actions sit at the far end. */}
280
410
  {closeSide === 'start' && (
@@ -293,9 +423,19 @@ export default function Rail({
293
423
  <CloseButton onClick={onClose} size={closeSize} hover={closeHover} className="ml-auto shrink-0" />
294
424
  )}
295
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" />}
296
430
  <div className="flex-1 overflow-y-auto pr-1" style={{ overflowAnchor: 'none' }}>
297
431
  {children}
298
432
  </div>
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>
299
439
  </div>
300
440
  </>,
301
441
  document.body,
@@ -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
  )}
@@ -0,0 +1,103 @@
1
+ import SegmentedToggle from '../atoms/SegmentedToggle.jsx'
2
+ import Button from '../atoms/Button.jsx'
3
+ import { Tooltip } from '../utilities/Popover.jsx'
4
+ import { RAIL_ROW } from '../hooks/railRow.js'
5
+
6
+ /* taxonomy-ok: organism — the parts a Rail's content is built from, beside SettingsPanel's LabeledControlSection and SettingsRow */
7
+
8
+ /**
9
+ * The rail kit — the parts of a Rail's content, so an app composes a rail instead of improvising one (RailKit,
10
+ * kol-monitor 2026-10-24 — user: *"FXR uses a system of components to structure their rails … does DS need to ship a
11
+ * better rail instructions? … some sort of set or apps/rails? if we can have some reference source of truth"*).
12
+ *
13
+ * THE ANATOMY IS FXR'S INSPECTOR (`kol-fxr/src/editor/labs/LabsView.jsx` LabsRail + `params/AutoControls.jsx`, its own
14
+ * `kol-editor.css` until now): an uppercase title; segmented tabs (Generate · Style · Animation); label / value rows (a
15
+ * label column, a control column); a divider between groups; segmented Off / On rows; a hint line; full-width action
16
+ * buttons and a row of icon buttons; a FOOT pinned under the scroller with its own tabs (Transport · Output · File)
17
+ * and a transport row. Two of those parts the DS already shipped under the settings rail's names, and they are the same
18
+ * components here — `RailSection` IS `LabeledControlSection`, `RailRow` IS `SettingsRow` (aliases in the barrel, not
19
+ * copies). The rest are below. `SettingsPanel` wears `RailHeader`, so the settings rail and every page rail are one
20
+ * thing; the SHELL (width, padding, scrim, the ×) is `Rail`'s, per tier (`variant="app" | "site"`).
21
+ *
22
+ * RailHeader title (helper-14 uppercase), a subtitle, the header's actions — the node Rail's `header` slot takes
23
+ * RailTabs segmented tabs across the rail's width
24
+ * RailSection = LabeledControlSection — an eyebrow over its rows, `divided` for the hairline above
25
+ * RailRow = SettingsRow — label · control, the label column fixed (160) or `labelWidth="auto"` in a narrow rail
26
+ * RailHint one quiet line under a row or a group (mono-10, meta ink — fxr's)
27
+ * RailActions full-width buttons stacked, or `row` for a line of icon buttons
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`
33
+ *
34
+ * The reference is `apps/rails` (`pnpm rails`): every part on its own, then the whole rails — the settings rail, an
35
+ * inspector like fxr's, a list rail like monitor's patch table, and the bottom rail — in both tiers.
36
+ */
37
+
38
+ /** RailHeader — the rail's title line: title, subtitle, and the actions before the × (which Rail draws). */
39
+ export function RailHeader({ title, subtitle, actions }) {
40
+ return (
41
+ <div className="flex min-w-0 items-center gap-2">
42
+ <div className="flex min-w-0 flex-1 flex-col">
43
+ {title && <span className="kol-helper-14 uppercase text-emphasis">{title}</span>}
44
+ {subtitle && <span className="kol-mono-12 text-meta">{subtitle}</span>}
45
+ </div>
46
+ {actions}
47
+ </div>
48
+ )
49
+ }
50
+
51
+ /** RailTabs — segmented tabs across the rail: `tabs` `[{ value, label }]`, controlled by `value` / `onChange`. */
52
+ export function RailTabs({ tabs = [], value, onChange, ariaLabel = 'Tabs', className = '' }) {
53
+ return <SegmentedToggle size="sm" className={`w-full ${className}`.trim()} options={tabs} value={value} onChange={onChange} ariaLabel={ariaLabel} />
54
+ }
55
+
56
+ /** RailHint — one quiet line of guidance under a row or a group; a sentence, never a label. */
57
+ export function RailHint({ children, className = '' }) {
58
+ return <p className={`kol-mono-10 text-meta ${className}`.trim()}>{children}</p>
59
+ }
60
+
61
+ /** RailActions — the rail's buttons: stacked full width (default), or `row` for a line of icon buttons. */
62
+ export function RailActions({ row = false, children, className = '' }) {
63
+ return row
64
+ ? <div className={`flex items-center gap-2 ${className}`.trim()}>{children}</div>
65
+ : <div className={`flex flex-col gap-2 [&>*]:w-full ${className}`.trim()}>{children}</div>
66
+ }
67
+
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). */
69
+ export function RailFoot({ tabs, value, onChange, ariaLabel = 'Foot tabs', children, className = '' }) {
70
+ return (
71
+ <div className={`flex flex-col gap-4 ${className}`.trim()}>
72
+ {tabs?.length > 0 && <RailTabs tabs={tabs} value={value} onChange={onChange} ariaLabel={ariaLabel} />}
73
+ {children}
74
+ </div>
75
+ )
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
+ }
@@ -8,6 +8,7 @@ import ToggleSwitch from '../atoms/ToggleSwitch.jsx'
8
8
  import Rail from '../molecules/Rail.jsx'
9
9
  import FullscreenOverlay from '../utilities/FullscreenOverlay.jsx'
10
10
  import { Tooltip } from '../utilities/Popover.jsx'
11
+ import { RailHeader } from './RailKit.jsx'
11
12
 
12
13
  /**
13
14
  * SettingsPanel — Settings beside the thing they change. a settings surface for the thing you are looking at: you
@@ -38,14 +39,20 @@ import { Tooltip } from '../utilities/Popover.jsx'
38
39
  * usually conditionally renders it)
39
40
  * @param {'rail'|'overlay'} variant presentation — `rail` (default) or `overlay`, the only two names (user 2026-10-18);
40
41
  * `drawer` is the old name of `rail`, still accepted
41
- * @param {number|string} width width (default 380 for the rail, the ⌘K overlay's 32rem for the overlay)
42
+ * @param {'app'|'site'} tier THE RAIL'S TIER (RailKit, kol-monitor 2026-10-24; default `app`): its width and padding are
43
+ * the tier's tokens, the same the page rails read — `app` 320, `site` 380, the overlay inset.
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
47
+ * @param {number|string} width width — overrides the tier's for the rail; the ⌘K overlay's 32rem for the overlay
42
48
  * @param {string} title header line 1
43
49
  * @param {string} subtitle header line 2 (the approved drawer passes none)
44
50
  * @param {string} intro a note under the header (the approved drawer passes none)
45
51
  * @param {Function} onClose × · scrim · Escape
46
52
  * @param {ReactNode} footer the foot slot — `SettingsFooter` is the default shape
47
53
  * @param {ReactNode} headerActions controls on the header line, before the × (the file rail's edit pencil, 2026-10-23)
48
- * @param {boolean} backdrop the rail's scrim (default true — the app's Settings tier dims and locks the page). `false`
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`
49
56
  * is the Rail's own: the panel alone, no scrim, no scroll lock, no focus trap — a PAGE-LEVEL rail
50
57
  * over a live page, the bottom rail's setup (SettingsPanelBackdrop, kol-monitor 2026-10-24: the
51
58
  * rack's and the stage's settings open over the running picture and its keys keep working).
@@ -57,6 +64,8 @@ import { Tooltip } from '../utilities/Popover.jsx'
57
64
  export default function SettingsPanel({
58
65
  open = true,
59
66
  variant = 'rail',
67
+ tier = 'app',
68
+ role = 'settings',
60
69
  width: widthProp,
61
70
  title,
62
71
  subtitle,
@@ -64,29 +73,19 @@ export default function SettingsPanel({
64
73
  onClose,
65
74
  footer,
66
75
  headerActions,
67
- backdrop = true,
76
+ backdrop,
68
77
  mode = 'over',
69
78
  children,
70
79
  className = '',
71
80
  }) {
72
- const header = (
73
- <div className="flex min-w-0 items-center gap-2">
74
- <div className="flex min-w-0 flex-1 flex-col">
75
- {/* THE APP REGISTER (SettingsPanelChromeAndColumnPreview, kol-r2b2 2026-08-27 —
76
- * user: "all wrong font styles"): the collection beside the panel is the
77
- * reference — helper-14 uppercase titles, the eyebrow for section labels,
78
- * mono-12 rows and hints. No mono-10 anywhere. */}
79
- {title && <span className="kol-helper-14 uppercase text-emphasis">{title}</span>}
80
- {subtitle && <span className="kol-mono-12 text-meta">{subtitle}</span>}
81
- </div>
82
- {headerActions}
83
- </div>
84
- )
81
+ /* THE APP REGISTER (SettingsPanelChromeAndColumnPreview, kol-r2b2 2026-08-27 — user: "all wrong font styles"): the
82
+ * collection beside the panel is the reference — helper-14 uppercase titles, the eyebrow for section labels, mono-12
83
+ * rows and hints. The header is the kit's `RailHeader` (RailKit, 2026-10-24): the same node every page rail wears. */
84
+ const header = <RailHeader title={title} subtitle={subtitle} actions={headerActions} />
85
85
  const body = (
86
86
  <>
87
87
  {intro && <p className="kol-mono-12 text-meta">{intro}</p>}
88
88
  <div className="flex flex-col gap-5">{children}</div>
89
- {footer && <div className="mt-2">{footer}</div>}
90
89
  </>
91
90
  )
92
91
 
@@ -106,16 +105,17 @@ export default function SettingsPanel({
106
105
  <div className="min-w-0 flex-1">{header}</div>
107
106
  <CloseButton onClick={onClose} hover={false} className="shrink-0" />
108
107
  </div>
109
- <div className="flex flex-col gap-4"><Divider />{body}</div>
108
+ <div className="flex flex-col gap-4"><Divider />{body}{footer && <div className="mt-2">{footer}</div>}</div>
110
109
  </div>
111
110
  </FullscreenOverlay>
112
111
  )
113
112
  }
114
113
 
115
- const width = widthProp ?? 380
114
+ /* no 380 here any more: the width is the tier's token unless the caller sets one (RailKit) */
115
+ const width = widthProp
116
116
  return (
117
117
  /* THE APPROVED DRAWER (SettingsPanelApproved, kol-r2b2 2026-08-27 — user: "LOCK
118
- THIS"): no edge, no shadow, a Divider under the header, the sections.
118
+ THIS"): no edge, no shadow, the Rail's hairline under the header, the sections.
119
119
  THE SCRIM IS BACK (settings-drawer-has-no-surface, kol-client-olina
120
120
  2026-09-03). `backdrop={false}` stood here from 2026-08-30; the drawer
121
121
  paints `bg-surface-primary`, the same token as the page, so the scrim was
@@ -123,8 +123,11 @@ export default function SettingsPanel({
123
123
  the controls floated in the right third of the screen.
124
124
  `backdrop` FORWARDS (SettingsPanelBackdrop, kol-monitor 2026-10-24): the default keeps olina's scrim; a page-level
125
125
  rail passes `false` and gets the Rail's own no-scrim setup — the page keeps running under it. */
126
- <Rail open={open} onClose={onClose} side="right" width={width} header={header} className={className} edge={false} shadow={false} closeHover={false} backdrop={backdrop} mode={mode}>
127
- <div className="flex flex-col gap-4"><Divider />{body}</div>
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}
127
+ /* the foot is the Rail's pinned slot now (RailKit): reset and the verbs stay in reach while the sections scroll */
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>
128
131
  </Rail>
129
132
  )
130
133
  }
@@ -271,7 +274,7 @@ export function SettingsChipRow({ options = [], selected = [], onToggle, allChip
271
274
  )
272
275
  }
273
276
 
274
- /** SettingsFooter — Reset settings to their defaults. a Divider, then one `IconFrame refresh` (primary · sm) at the
277
+ /** SettingsFooter — Reset settings to their defaults. one `IconFrame refresh` (primary · sm) at the
275
278
  * right = reset to defaults (SettingsPanelApproved, 2026-08-27). No status word,
276
279
  * no text button. `customised` is accepted for compatibility and unused.
277
280
  *
@@ -286,9 +289,8 @@ export function SettingsChipRow({ options = [], selected = [], onToggle, allChip
286
289
  * for one control and wrong for two — the chip and the reset icon touched. */
287
290
  export function SettingsFooter({ onReset, resetLabel = 'Reset to defaults', resetDisabled = false, children }) {
288
291
  return (
289
- <div className="flex flex-col gap-4">
290
- <Divider />
291
- <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">
292
294
  {children}
293
295
  {/* `resetDisabled`: the control stays in its place, dimmed and inert — one footer shape on every rail, whether or
294
296
  * not the app has preferences to reset yet (user 2026-10-24: *"standardise what goes in"*) */}
@@ -298,6 +300,5 @@ export function SettingsFooter({ onReset, resetLabel = 'Reset to defaults', rese
298
300
  </Tooltip>
299
301
  )}
300
302
  </div>
301
- </div>
302
303
  )
303
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` — in the surface's tone, never the consumer's. The Hub's rail takes typed rows and refuses `render`.
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)}