@kolkrabbi/kol-component 0.390.0 → 0.391.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.390.0",
3
+ "version": "0.391.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,9 +32,9 @@
32
32
  "embla-carousel-react": "^8.6.0",
33
33
  "pdfjs-dist": "^6.3.289",
34
34
  "react-syntax-highlighter": "^16.1.1",
35
- "@kolkrabbi/kol-markdown": "^0.2.0",
36
35
  "@kolkrabbi/kol-search": "^0.3.0",
37
- "@kolkrabbi/kol-growth": "^0.5.0"
36
+ "@kolkrabbi/kol-growth": "^0.5.0",
37
+ "@kolkrabbi/kol-markdown": "^0.2.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@kolkrabbi/kol-icons": ">=0.69.0",
@@ -4,20 +4,24 @@
4
4
  * RailHeader — the rail kit's title line (RailKit 2026-10-24): title (helper-14 uppercase), a subtitle, the header's
5
5
  * actions before the × (which Rail draws). The node Rail's `header` slot takes it; SettingsPanel wears it.
6
6
  *
7
- * `variant="kolbox"` (W31.2 batch 5): kolbox's rail header, with `leading` and `size` md · sm (below).
7
+ * `docked` (kolbox's rail header, W31.2 batch 5; a plain boolean since plan-2026-11-29-one-set-fold W4 run 1): the header
8
+ * of a `Rail mode="docked"`, with `leading` and `size` md · sm (below). Chrome in kol-theme `.kol-rail-header--docked`.
9
+ * `variant="kolbox"` and `"folio"` are accepted and draw it (the retirement ledger).
8
10
  *
9
- * @param {'default'|'kolbox'} [variant='default']
11
+ * @param {boolean} [docked=false]
10
12
  * @param {ReactNode} [title] · {ReactNode} [subtitle] · {ReactNode} [actions] · {string} [className]
11
13
  */
12
- export default function RailHeader({ variant = 'default', title, subtitle, actions, leading, size = 'md', className = '' }) {
13
- /* kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's RailHeader, carried from
14
- * apps/kolbox/src/ui/RailHeader.jsx: a `leading` slot, the title, the `subtitle` as a quiet meta line at the right,
14
+ const THEME_WORDS = ['kolbox', 'folio']
15
+
16
+ export default function RailHeader({ docked, variant, title, subtitle, actions, leading, size = 'md', className = '' }) {
17
+ /* docked (kolbox's RailHeader, plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18, carried from
18
+ * apps/kolbox/src/ui/RailHeader.jsx): a `leading` slot, the title, the `subtitle` as a quiet meta line at the right,
15
19
  * the actions; inset 16. `size` md the plain header (48 high), sm the document header (the file's RailHeader 61:11315:
16
20
  * 65 high as Figma's, the title on the document voice 13 / 22; below). */
17
- if (variant === 'kolbox') {
21
+ if (docked ?? THEME_WORDS.includes(variant)) {
18
22
  const sm = size === 'sm'
19
23
  return (
20
- <div className={`kol-rail-header--kolbox flex items-center ${sm ? 'items-start! gap-2 pt-[13px] pb-[9px] pr-2 pl-4' : 'h-12 gap-2 px-4'} ${className}`.trim()} data-rail-header>
24
+ <div className={`kol-rail-header--docked flex items-center ${sm ? 'items-start! gap-2 pt-[13px] pb-[9px] pr-2 pl-4' : 'h-12 gap-2 px-4'} ${className}`.trim()} data-rail-header>
21
25
  {leading}
22
26
  {sm ? (
23
27
  /* sm, the document header: the subtitle is a quiet line UNDER the title, as his reference draws it (2026-11-19);
@@ -57,13 +57,14 @@ const FOCUSABLE =
57
57
  * @param {ReactNode} nav A RAIL INSIDE THE RAIL (review 2, 2026-10-25 — *"like a siderail in the bottom rail"*): `RailNav`, the
58
58
  * collapsed nav rail's 48 icon column, stood at the panel's edge with the header, body and foot
59
59
  * padded beside it — so a bottom rail over the nav rail carries its views as glyphs under it
60
- * @param {'app'|'site'|'kolbox'|'folio'} variant `kolbox` and `folio` are those looks (below). THE TIER (RailKit, kol-monitor 2026-10-24): its width when `width` / `height` is not given
60
+ * @param {'app'|'site'} variant THE TIER (RailKit, kol-monitor 2026-10-24): its width when `width` / `height` is not given
61
61
  * (`--kol-rail-w-app` 320 · `--kol-rail-w-site` 380) and its padding (`--kol-pad-rail-app` ·
62
62
  * `--kol-pad-rail-site`), kol-theme's tokens — so the settings rail and a page rail of one
63
63
  * app are one size. Unset = the rail as before (`--kol-pad-overlay`, the width yours)
64
64
  * @param {ReactNode} footer a FOOT pinned below the scrolling body (fxr's transport dock; `RailFoot` is its shape) —
65
65
  * the body scrolls, the foot does not; the Rail draws it as a band with a full-width rule
66
66
  * (2026-10-25), so nothing inside it draws a rule
67
+ * @param {'over'|'push'|'docked'} mode over the page (default), in the layout pushing it, or `docked`: a frame always at its edge (below)
67
68
  * @param {boolean} open drawer visible (drives slide in/out)
68
69
  * @param {Function} onClose close request (Esc / backdrop / close button)
69
70
  * @param {string} side 'left' | 'right' | 'bottom' — edge the panel slides from.
@@ -139,20 +140,22 @@ export function useRailKey(role, onToggle, enabled = true) {
139
140
  }, [role, enabled])
140
141
  }
141
142
 
142
- /* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's one rail shell, carried from
143
- * apps/kolbox/src/ui/Rail.jsx. It alone draws the panel fill, the edge line, the 240 width (`--kol-kolbox-rail-w`) and
144
- * the clip. Slots: `header` and `footer` stay put, the body scrolls. `side` left draws its edge line on the right, right
145
- * on the left, in the field ink, over the rail's own edge so the content keeps the full 240. `collapsed` the narrow
146
- * strip, 49 (`--kol-kolbox-rail-w-collapsed`). Under 768 a rail lies along the bottom or stacks in a column: the full
143
+ /* `mode="docked"` (kolbox's one rail shell, plan-2026-11-18-kolbox-system W31.2 batch 5, carried from apps/kolbox/src/ui/Rail.jsx;
144
+ * a plain mode since plan-2026-11-29-one-set-fold W4 run 1): a frame docked at its edge, always there, no open state. It
145
+ * draws the panel fill, the edge line (`--kol-rail-line`), the width (`--kol-rail-docked-w`, 240) and the clip; chrome in
146
+ * kol-theme `.kol-rail--docked`. Slots: `header` and `footer` stay put, the body scrolls. `side` left draws its edge line
147
+ * on the right, right on the left, over the rail's own edge so the content keeps the full width. `collapsed` the narrow
148
+ * strip (`--kol-rail-docked-w-collapsed`, 49). Under 768 a rail lies along the bottom or stacks in a column: the full
147
149
  * width, as tall as its content, its edge line along its top. `aria-label` names it. None of the roles, the scrim, the
148
- * resize or the phone rule: the look's rails are docked frames. */
149
- function RailKolbox({ side = 'left', 'aria-label': ariaLabel, header, footer, collapsed = false, children, className = '' }) {
150
+ * resize or the phone rule. Folio's bare aside (`variant="folio"`) went to `_tmp/2026-11-29-one-set-fold/Rail.pre-w4a.jsx`;
151
+ * apps/folio draws its aside itself. */
152
+ function RailDocked({ side = 'left', 'aria-label': ariaLabel, header, footer, collapsed = false, children, className = '' }) {
150
153
  return (
151
154
  <aside
152
155
  aria-label={ariaLabel}
153
156
  data-rail={side}
154
157
  data-collapsed={collapsed || undefined}
155
- className={`kol-rail--kolbox${collapsed ? ' is-collapsed' : ''} relative flex h-full shrink-0 flex-col overflow-hidden max-md:h-auto before:absolute before:inset-y-0 before:z-10 before:w-px ${side === 'left' ? 'before:right-0' : 'before:left-0'} max-md:before:inset-x-0 max-md:before:top-0 max-md:before:bottom-auto max-md:before:h-px max-md:before:w-auto ${className}`.trim()}
158
+ className={`kol-rail--docked${collapsed ? ' is-collapsed' : ''} relative flex h-full shrink-0 flex-col overflow-hidden max-md:h-auto before:absolute before:inset-y-0 before:z-10 before:w-px ${side === 'left' ? 'before:right-0' : 'before:left-0'} max-md:before:inset-x-0 max-md:before:top-0 max-md:before:bottom-auto max-md:before:h-px max-md:before:w-auto ${className}`.trim()}
156
159
  >
157
160
  {header && <div className="shrink-0">{header}</div>}
158
161
  <div className="min-h-0 flex-1 overflow-y-auto" data-rail-body>{children}</div>
@@ -161,18 +164,12 @@ function RailKolbox({ side = 'left', 'aria-label': ariaLabel, header, footer, co
161
164
  )
162
165
  }
163
166
 
164
- /* `variant="folio"` (Folio migration batch D, 2026-11-22): Folio's edge Rail, carried from apps/folio's EditorChrome.jsx.
165
- * The bare aside, a column that clips: no fill, no edge, no width, no padding (its content brings Folio's 16, its edge
166
- * line and width are the caller's `className`). `aria-label` names it (Folio's `label`). None of the roles, the scrim,
167
- * the resize or the phone rule. */
168
- function RailFolio({ 'aria-label': ariaLabel, children, className = '' }) {
169
- return <aside aria-label={ariaLabel} className={`kol-rail--folio flex min-w-0 flex-col overflow-hidden ${className}`.trim()}>{children}</aside>
170
- }
167
+ /* the old theme words: accepted, they draw the docked rail (W4 run 1, on the retirement ledger) */
168
+ const THEME_WORDS = ['kolbox', 'folio']
171
169
 
172
170
  /* the role's shell, the phone rule over it, then whatever the call site passed (an `undefined` prop is not a pass) */
173
171
  export default function Rail({ role, ...props }) {
174
- if (props.variant === 'kolbox') return <RailKolbox {...props} />
175
- if (props.variant === 'folio') return <RailFolio {...props} />
172
+ if (props.mode === 'docked' || THEME_WORDS.includes(props.variant)) return <RailDocked {...props} />
176
173
  const phone = useMediaQuery('(max-width: 767px)')
177
174
  const r = role ? RAIL_ROLES[role] : null
178
175
  if (role && !r && import.meta.env?.DEV) console.warn(`Rail: no role "${role}" — patch · page · settings · bottom`)
@@ -13,9 +13,10 @@ import { Tooltip } from '../utilities/Popover.jsx'
13
13
  * The glyph is drawn at 20: Figma's read 10 to 14 inside their 24 box, the set's at 20 draws 12 to 15.
14
14
  * The host owns the list: a space is added by adding a row.
15
15
  *
16
- * @param {'kolbox'} variant the one look so far: kolbox's panel, its edge line (`--kol-kolbox-line`), the lit tile a neutral wash
17
- * (the field fill) with the plain ink, Figma's way (plan-2026-11-23-editor-measured-against-figma W4: the accent is kept for
18
- * the primary button, the active tool and selection).
16
+ * One look: the panel, its edge line (`--kol-rail-line`, set by the theme; chrome in kol-theme `.kol-rail-switcher`), the
17
+ * docked rail's collapsed width (`--kol-rail-docked-w-collapsed`), the lit tile a neutral wash (the field fill) with the
18
+ * plain ink, Figma's way (plan-2026-11-23-editor-measured-against-figma W4: the accent is kept for the primary button, the
19
+ * active tool and selection). `variant` is accepted and does nothing (it was `kolbox`, the one look; the ledger).
19
20
  * @param {string} markIcon the mark's glyph (your icons), plain, no tile fill (W4)
20
21
  * @param {string} [markLabel] its tooltip and name (default "Main menu")
21
22
  * @param {boolean} [markOpen] the main menu is open (the tile stays lit)
@@ -42,17 +43,17 @@ function Row({ row, lit, onSelect }) {
42
43
  )
43
44
  }
44
45
 
45
- const RailSwitcher = forwardRef(function RailSwitcher({ variant = 'kolbox', markIcon = 'wave', markLabel = 'Main menu', markOpen = false, onMark, items = [], foot = [], value, onSelect, className = '', ...rest }, ref) {
46
+ const RailSwitcher = forwardRef(function RailSwitcher({ variant: _variant, markIcon = 'wave', markLabel = 'Main menu', markOpen = false, onMark, items = [], foot = [], value, onSelect, className = '', ...rest }, ref) {
46
47
  return (
47
- <nav aria-label="Spaces" data-rail-switcher={variant}
48
- className={`relative flex h-full w-(--kol-kolbox-rail-w-collapsed) shrink-0 flex-col items-start bg-panel pt-2 pb-1 after:absolute after:inset-y-0 after:right-0 after:w-px after:bg-(--kol-kolbox-line) ${className}`.trim()} {...rest}>
48
+ <nav aria-label="Spaces" data-rail-switcher=""
49
+ className={`kol-rail-switcher relative flex h-full w-(--kol-rail-docked-w-collapsed) shrink-0 flex-col items-start bg-panel pt-2 pb-1 after:absolute after:inset-y-0 after:right-0 after:w-px after:bg-(--kol-rail-line) ${className}`.trim()} {...rest}>
49
50
  <Tooltip variant="kolbox" asChild label={markLabel}>
50
51
  <button ref={ref} type="button" aria-label={markLabel} aria-haspopup="menu" aria-expanded={markOpen} onClick={onMark} data-mark
51
52
  className={`${tile} ml-2 shrink-0 p-1 text-text hover:bg-field ${markOpen ? 'bg-field' : ''} ${focus}`}>
52
53
  <IconLoader name={markIcon} size={18} />
53
54
  </button>
54
55
  </Tooltip>
55
- <span aria-hidden className="mx-4 mt-2 mb-[7px] h-px w-4 shrink-0 bg-(--kol-kolbox-line)" data-rail-switcher-divider />
56
+ <span aria-hidden className="mx-4 mt-2 mb-[7px] h-px w-4 shrink-0 bg-(--kol-rail-line)" data-rail-switcher-divider />
56
57
  <div className="flex flex-col">{items.map((r) => <Row key={r.value} row={r} lit={r.value === value} onSelect={onSelect} />)}</div>
57
58
  {foot.length > 0 && <div className="mt-auto flex flex-col">{foot.map((r) => <Row key={r.value ?? r.label} row={r} lit={r.value != null && r.value === value} onSelect={onSelect} />)}</div>}
58
59
  </nav>
@@ -191,27 +191,28 @@ export function SettingsSwitch({ on = false, onChange, disabled = false, disable
191
191
  * the 0.104.0 locked composition, untouched.
192
192
  */
193
193
  const SETTINGS_GAP = { 3: 'gap-3', 4: 'gap-4', settings: 'gap-[7px]' }
194
- /* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's RailSection (Figma 27:9309),
195
- * carried from apps/kolbox/src/ui/RailSection.jsx. A 1px rule at the section's top, then the head: a 40 row, the `label`
196
- * 16 in, its `end` actions (24 boxes) 4 apart and 8 off the right edge; 4 to the rows, inset 16, 8 apart; 16 under them.
197
- * With no rows it is the rule and the head alone (41 high). Measured on Figma's own rails (plan-2026-11-23-editor-
198
- * measured-against-figma W3: Pages, Layers, Page, Styles and Export headers are 40, label 16 in); closed is not empty, so its title and
199
- * its actions keep the full ink (his "I thought text were white", R3.2).
194
+ /* `variant="rail"` (kolbox's RailSection, Figma 27:9309, plan-2026-11-18-kolbox-system W31.2 batch 5, carried from
195
+ * apps/kolbox/src/ui/RailSection.jsx; a plain variant since plan-2026-11-29-one-set-fold W4 run 1): the section of a docked
196
+ * Rail. A 1px rule at the section's top (`--kol-rail-line`), then the head: a 40 row, the `label` 16 in, its `end` actions
197
+ * (24 boxes) 4 apart and 8 off the right edge; 4 to the rows, inset 16, 8 apart; 16 under them. With no rows it is the rule
198
+ * and the head alone (41 high). Measured on Figma's own rails (plan-2026-11-23-editor-measured-against-figma W3: Pages,
199
+ * Layers, Page, Styles and Export headers are 40, label 16 in); closed is not empty, so its title and its actions keep the
200
+ * full ink (his "I thought text were white", R3.2). Chrome in kol-theme `.kol-section--rail`.
200
201
  * THE RAIL'S ONE GRID (plan-2026-11-19-kolbox-whats-left R3.1): in a Rail the rows' tracks are set here, once, as
201
202
  * `--kol-kolbox-row-cols`: two field columns and two 16 icon columns, 8 apart (76, 76, 16, 16 in the 240 rail; his
202
- * design's Stroke row, 149:26890). FieldPair and ColorInputRow kolbox lay out on it; the head's actions sit at the right
203
- * of the head (above); LabeledControl kolbox's 76 label is the first field column. */
204
- function LabeledControlSectionKolbox({ label, end, className = '', children }) {
203
+ * design's Stroke row, 149:26890). FieldPair and ColorInputRow lay out on it; the head's actions sit at the right of the
204
+ * head (above); LabeledControl's 76 label is the first field column. */
205
+ function LabeledControlSectionRail({ label, end, className = '', children }) {
205
206
  const rows = Children.toArray(children)
206
207
  const open = rows.length > 0
207
208
  return (
208
209
  <section
209
- className={`kol-section--kolbox relative flex flex-col gap-1 pt-px ${open ? 'pb-4' : ''} before:absolute before:inset-x-0 before:top-0 before:h-px ${className}`}
210
+ className={`kol-section--rail relative flex flex-col gap-1 pt-px ${open ? 'pb-4' : ''} before:absolute before:inset-x-0 before:top-0 before:h-px ${className}`}
210
211
  data-rail-section={label ?? ''}
211
212
  >
212
213
  {(label || end) && (
213
214
  <header className="flex h-10 items-center pr-2 pl-4">
214
- <h3 className="kol-section-title--kolbox min-w-0 flex-1 truncate">{label}</h3>
215
+ <h3 className="kol-section-title--rail min-w-0 flex-1 truncate">{label}</h3>
215
216
  {end && <span className="flex shrink-0 items-center gap-1">{end}</span>}
216
217
  </header>
217
218
  )}
@@ -220,20 +221,13 @@ function LabeledControlSectionKolbox({ label, end, className = '', children }) {
220
221
  )
221
222
  }
222
223
 
223
- /* `variant="folio"` (Folio batch C, 2026-11-22): Folio's SettingGroup, carried class for class. The `label` (12 / 17
224
- * medium, Folio's ink) 12 over its rows, the rows 8 apart. Chrome in kol-theme `.kol-section--folio`. */
225
- function LabeledControlSectionFolio({ label, className = '', children }) {
226
- return (
227
- <div className={`kol-section--folio flex flex-col gap-[12px] ${className}`.trim()}>
228
- <p className="kol-section-title--folio">{label}</p>
229
- <div className="flex flex-col gap-[8px]">{children}</div>
230
- </div>
231
- )
232
- }
224
+ /* the old theme words (W4 run 1, on the retirement ledger): `kolbox` draws `rail`; `folio` (Folio's SettingGroup, its
225
+ * build in `_tmp/2026-11-29-one-set-fold/SettingsPanel.pre-w4a.jsx`) draws the default section, its 12 and 8 the same */
226
+ const THEME_WORDS = { kolbox: 'rail', folio: undefined }
233
227
 
234
- export function LabeledControlSection(props) {
235
- if (props.variant === 'folio') return <LabeledControlSectionFolio {...props} />
236
- return props.variant === 'kolbox' ? <LabeledControlSectionKolbox {...props} /> : <LabeledControlSectionBody {...props} />
228
+ export function LabeledControlSection({ variant: variantProp, ...props }) {
229
+ const variant = variantProp in THEME_WORDS ? THEME_WORDS[variantProp] : variantProp
230
+ return variant === 'rail' ? <LabeledControlSectionRail {...props} /> : <LabeledControlSectionBody variant={variant} {...props} />
237
231
  }
238
232
  function LabeledControlSectionBody({ label, end, variant, divided = false, gap, rowGap, collapsible = false, open, defaultOpen = true, onToggle, as: Tag = 'div', children, className = '', ...rest }) {
239
233
  const [ownOpen, setOwnOpen] = useState(defaultOpen)
@@ -1,28 +1,23 @@
1
1
  /**
2
2
  * StatusBar — a document's status along its foot (Folio's StatusBar, 2026-11-22): the counts on the left, the host's
3
3
  * cells on the right (the format, the language, the zoom, the encoding). It holds no state; the cells are the host's.
4
- * Spaces in `left` are kept (Folio spaces its counts with them). Chrome in kol-theme `.kol-status-bar--kolbox` and
5
- * `.kol-status-bar--folio`.
4
+ * Spaces in `left` are kept (Folio spaces its counts with them). One bar (plan-2026-11-29-one-set-fold W4 run 1): 32 high
5
+ * on the rail ground, the rail line over it (`--kol-rail-line`, set by the theme), the help voice (11 / 15), the counts
6
+ * in oq-64; chrome in kol-theme `.kol-status-bar`. Folio's own bar (40, 56 in) went to
7
+ * `_tmp/2026-11-29-one-set-fold/StatusBar.pre-w4a.jsx`; `variant="kolbox"` and `"folio"` are accepted and draw this one.
6
8
  *
7
9
  * <StatusBar left="212 words 1,204 characters 18 lines">
8
- * <Dropdown variant="kolbox" ... /><span>UTF-8 LF</span>
10
+ * <Dropdown ... /><span>UTF-8 LF</span>
9
11
  * </StatusBar>
10
12
  *
11
- * @param {'kolbox'|'folio'} [variant='kolbox'] - kolbox: 32 high on the rail ground, the kolbox line over it, the text
12
- * kolbox's help voice (11 / 15), the counts in oq-64. folio: Folio's bar carried class for class (40, its rule, meta).
13
13
  * @param {ReactNode} [left] - The text on the left
14
- * @param {ReactNode} [children] - The right-hand cells, 16 apart (folio 24)
14
+ * @param {ReactNode} [children] - The right-hand cells, 16 apart
15
15
  * @param {string} [className] - Extra classes on the bar
16
16
  */
17
- export default function StatusBar({ variant = 'kolbox', left, children, className = '' }) {
18
- if (variant === 'folio') return (
19
- <div className={`kol-status-bar--folio flex h-[40px] shrink-0 items-center justify-between gap-[24px] whitespace-pre border-t px-[56px] ${className}`.trim()}>
20
- <p className="kol-status-bar-left">{left}</p>
21
- <div className="flex items-center gap-[24px]">{children}</div>
22
- </div>
23
- )
17
+ // eslint-disable-next-line no-unused-vars
18
+ export default function StatusBar({ variant, left, children, className = '' }) {
24
19
  return (
25
- <div className={`kol-status-bar--kolbox kol-kolbox-help flex h-8 shrink-0 items-center justify-between gap-4 whitespace-pre border-t pr-2 pl-3 ${className}`.trim()}>
20
+ <div className={`kol-status-bar flex h-8 shrink-0 items-center justify-between gap-4 whitespace-pre border-t pr-2 pl-3 ${className}`.trim()}>
26
21
  <p className="kol-status-bar-left min-w-0 overflow-hidden text-ellipsis">{left}</p>
27
22
  <div className="flex shrink-0 items-center gap-4">{children}</div>
28
23
  </div>