@kolkrabbi/kol-component 0.306.0 → 0.308.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.306.0",
3
+ "version": "0.308.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "pdfjs-dist": "^6.3.289",
28
28
  "react-syntax-highlighter": "^16.1.1",
29
29
  "@kolkrabbi/kol-search": "^0.3.0",
30
- "@kolkrabbi/kol-markdown": "^0.1.3"
30
+ "@kolkrabbi/kol-markdown": "^0.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@kolkrabbi/kol-icons": ">=0.22.0",
@@ -38,7 +38,7 @@
38
38
  "react-dom": "^18.3.0 || ^19.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@kolkrabbi/kol-icons": "^0.47.0"
41
+ "@kolkrabbi/kol-icons": "^0.50.0"
42
42
  },
43
43
  "files": [
44
44
  "src",
@@ -1,7 +1,11 @@
1
1
  import { useState, useEffect } from 'react'
2
2
 
3
3
  /**
4
- * Logomark — An inlined SVG mark. fetches and INLINES an SVG so currentColor theming works: an
4
+ * VectorLoader — ANY SVG by URL, fetched and INLINED so `currentColor` theming works (`Logomark` until kol-component
5
+ * 0.308.0 — user 2026-10-28: "Logomark is the loader Im talking about, it just has a terrible name"; the old name
6
+ * stays an alias on the retirements ledger). `src` is the URL; `svgUrl` is the old prop and still works. Pair it
7
+ * with a path export — `@kolkrabbi/kol-icons/identity/kolkrabbi/kolkrabbi-wordmark.svg?url` — or any file of your own.
8
+ * Fetches and inlines so currentColor theming works: an
5
9
  * <img> renders a currentColor mark black in dark mode (invisible). Ported
6
10
  * verbatim from the kol-mirror cut (module-level cache; async resolve even on
7
11
  * cache hit — sync setState in an effect cascades renders).
@@ -38,19 +42,20 @@ function sanitizeSvg(svg) {
38
42
  }
39
43
  }
40
44
 
41
- export default function Logomark({ svgUrl, size = 20, className = '', ...props }) {
42
- const [svgContent, setSvgContent] = useState(() => svgCache.get(svgUrl) || null)
45
+ export default function VectorLoader({ src, svgUrl, size = 20, className = '', ...props }) {
46
+ const url = src ?? svgUrl
47
+ const [svgContent, setSvgContent] = useState(() => svgCache.get(url) || null)
43
48
 
44
49
  useEffect(() => {
45
- if (!svgUrl) return
50
+ if (!url) return
46
51
  let active = true
47
52
  Promise.resolve(
48
- svgCache.get(svgUrl) ?? fetch(svgUrl).then(res => res.text()).then(raw => { const svg = sanitizeSvg(raw); svgCache.set(svgUrl, svg); return svg })
53
+ svgCache.get(url) ?? fetch(url).then(res => res.text()).then(raw => { const svg = sanitizeSvg(raw); svgCache.set(url, svg); return svg })
49
54
  )
50
55
  .then(svg => { if (active) setSvgContent(svg) })
51
56
  .catch(() => {})
52
57
  return () => { active = false }
53
- }, [svgUrl])
58
+ }, [url])
54
59
 
55
60
  if (!svgContent) return <span style={{ width: size, height: size, display: 'inline-block' }} />
56
61
 
package/src/index.js CHANGED
@@ -183,7 +183,8 @@ export { default as PageHeader, PAGE_HEADER_ROLES } from './molecules/PageHeader
183
183
  /* the one nav rail (2026-10-22) — `variant` app (the flat 48px rail) · site (the grouped site
184
184
  * sidebar, kol-framework's SideNav until then). Moved from kol-shell, which re-exports all three. */
185
185
  export { default as NavRail, RAIL_PRESETS, registerRailPreset } from './organisms/NavRail.jsx'
186
- export { default as Logomark } from './atoms/Logomark.jsx'
186
+ /* any SVG by URL, inlined — `Logomark` until 0.308.0 (2026-10-28: "it just has a terrible name"); the alias is on the ledger */
187
+ export { default as VectorLoader, default as Logomark } from './atoms/VectorLoader.jsx'
187
188
  export { RailSlotProvider, useRailSlot } from './hooks/railSlot.jsx'
188
189
  export { MastheadContext, MASTHEADS, useMasthead, mastheadTitleClass } from './utilities/masthead.js'
189
190
  export { default as ErrorBoundary } from './utilities/ErrorBoundary.jsx'
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useRef, useState } from 'react'
2
2
  import gsap from 'gsap'
3
- /* taxonomy-ok: organism — nests Button (atom) + Logomark (atom) + Tooltip (utility). Moved
3
+ /* taxonomy-ok: organism — nests Button (atom) + VectorLoader (atom) + Tooltip (utility). Moved
4
4
  * from kol-shell 2026-10-22 (the one nav rail, user: "lets go for your recommendation"): the
5
5
  * app rail and the site rail are one component, and a site must not install the app shell
6
6
  * for its sidebar — the PageHeader precedent. kol-shell re-exports it. */
@@ -13,7 +13,7 @@ import { GRAB } from '../utilities/motion.js'
13
13
  * built the gesture itself). It lived here until then. */
14
14
  import useGrabEdge from '../hooks/useGrabEdge.js'
15
15
  import { Icon } from '@kolkrabbi/kol-icons'
16
- import Logomark from '../atoms/Logomark.jsx'
16
+ import VectorLoader from '../atoms/VectorLoader.jsx'
17
17
  import { useRailSlot } from '../hooks/railSlot.jsx'
18
18
  import { RAIL_ROW } from '../hooks/railRow.js'
19
19
  import NavRailSite from './NavRailSite.jsx'
@@ -408,7 +408,7 @@ function AppRail({
408
408
  onClick={() => onNavigate?.('/')}
409
409
  className="text-oq-96 cursor-pointer flex items-center gap-3 w-full overflow-hidden shrink-0 pt-1 mb-4"
410
410
  >
411
- <span className="w-8 flex justify-center shrink-0"><Logomark svgUrl={logomark.svgUrl} size={20} /></span>
411
+ <span className="w-8 flex justify-center shrink-0"><VectorLoader src={logomark.svgUrl} size={20} /></span>
412
412
  <span className="kol-helper-12 uppercase flex-1 min-w-0 truncate">{logomark.title}</span>
413
413
  </div>
414
414
  </Tooltip>
@@ -108,8 +108,10 @@ import useDragResize from '../hooks/useDragResize.js'
108
108
  * footer (the shell pins theme → Settings; a Settings row in
109
109
  * the tree landed above the theme instead — "same rail, two
110
110
  * bottoms")
111
- * `footer` the footer box's content: undefined = the Kolkrabbi link
112
- * (K / wordmark, as ever); `false` = no footer; a node =
111
+ * `footer` the footer box's content: undefined or `false` = no footer
112
+ * (OPT-IN since 0.307.0, user ruling 2026-10-28 — every site had
113
+ * to remember `footer: false`, record.kolkrabbi.io didn't);
114
+ * `'credit'` = the Kolkrabbi link (K / wordmark); a node =
113
115
  * that node (the shell's logomark → '/')
114
116
  * `themeToggle` `false` drops the theme slot (default `true`)
115
117
  * `iconComponent` the hop glyph's renderer, kol-shell's seam — `(props:
@@ -124,8 +126,12 @@ import useDragResize from '../hooks/useDragResize.js'
124
126
  * THE RAIL'S BEHAVIOURS ARE PROPS (SiteRailTitleNavigatesOnly, kol-branding 2026-10-27 — user: "clicking on title
125
127
  * shouldnt also expand, that is what the chevron is for", and: a small rail behaviour should never need a ticket here —
126
128
  * a sensible default plus a prop the consumer sets in its own repo):
127
- * `discloseOnTitle` `true` lets a foldernote's TITLE also open its pages; default `false` — the title navigates, the
128
- * chevron alone expands and collapses
129
+ * `discloseOnTitle` `true` lets a foldernote's TITLE also open its pages; default `false` — the title navigates, and
130
+ * the rest of the row (everything right of the title, the chevron at its end) expands and collapses
131
+ * (2026-10-28: "it should expand anywhere except the title")
132
+ * `fade` `true` (default) — the tree fades out at its foot where the window clips it, as the app rail and
133
+ * the workshop rail do (2026-10-28: "we also are missing a fade when list clips in navrail");
134
+ * `false` draws it plain
129
135
  * `defaultOpen` category ids open on first render (default none — the rail loads closed, elder ruling 2026-08-06)
130
136
  * `openOnRoute` `true` opens the category holding the current route whenever the route changes (default `false`
131
137
  * — nothing auto-expands on arrival); it only adds, never closes what you opened
@@ -202,6 +208,7 @@ export default function NavRailSite({
202
208
  expandOnSelect = false,
203
209
  defaultCollapsed = false,
204
210
  discloseOnTitle = false,
211
+ fade = true,
205
212
  defaultOpen = [],
206
213
  openOnRoute = false,
207
214
  }) {
@@ -366,24 +373,28 @@ export default function NavRailSite({
366
373
  definition, and an <a href> would promise a page that does
367
374
  not exist. Clicking it discloses its pages. */
368
375
  const head = isFolder ? (
369
- /* the row opens the page (and discloses only with `discloseOnTitle`); the caret beside it (a sibling — a
370
- * button cannot sit inside a link) toggles the disclosure */
376
+ /* THE TITLE NAVIGATES, THE REST OF THE ROW EXPANDS (user 2026-10-28: *"it should expand anywhere except the
377
+ * title, so press title > get overview, press the row f.e. on right of the title, expand category"* — the
378
+ * 12px chevron was the only target). The link keeps the row's full box and wash but only its glyph and title
379
+ * take the pointer (`.kol-sidenav-hop--split`); the caret is a button under it filling the whole row
380
+ * (`.kol-sidenav-hop-caret--row`), the chevron at its end, so a press anywhere else on the row lands on it.
381
+ * `discloseOnTitle` still lets the title open its pages too. Collapsed, the link takes the whole row again. */
371
382
  <>
372
- <RouteLeaf {...leafProps(cat.to)} onPress={discloseOnTitle ? () => discloseCat(cat.id) : undefined} className={(active) => `${rowCls}${(active || isActiveCat(cat)) ? ' is-active' : ''}`}>
373
- {glyph}
374
- <span className="kol-sidenav-hop-label flex-1 min-w-0">{cat.label}</span>
375
- </RouteLeaf>
376
383
  <button
377
384
  type="button"
378
385
  /* no display utility on the caret — it would outrank the collapsed rule's display:none (the 2026-08-09 defect; the
379
386
  * box lives in .kol-sidenav-hop-caret, kol-framework.css) */
380
- className={`kol-sidenav-hop-caret bg-transparent border-0 cursor-pointer p-0 text-emphasis${isOpen ? '' : ' -rotate-90'}`}
387
+ className="kol-sidenav-hop-caret kol-sidenav-hop-caret--row bg-transparent border-0 cursor-pointer pt-3 pr-4 pb-0 pl-0 text-emphasis"
381
388
  aria-expanded={isOpen}
382
389
  aria-label={isOpen ? `Collapse ${cat.label}` : `Expand ${cat.label}`}
383
390
  onClick={() => (collapsed ? (expandOnSelect && toggleCollapsed(), discloseCat(cat.id)) : toggleCat(cat.id))}
384
391
  >
385
- <Icon name="chevron-down" size={12} />
392
+ <span className={`kol-sidenav-hop-chevron${isOpen ? '' : ' -rotate-90'}`}><Icon name="chevron-down" size={12} /></span>
386
393
  </button>
394
+ <RouteLeaf {...leafProps(cat.to)} onPress={discloseOnTitle ? () => discloseCat(cat.id) : undefined} className={(active) => `${rowCls} kol-sidenav-hop--split${(active || isActiveCat(cat)) ? ' is-active' : ''}`}>
395
+ {glyph}
396
+ <span className="kol-sidenav-hop-label flex-1 min-w-0"><span className="kol-sidenav-hop-title">{cat.label}</span></span>
397
+ </RouteLeaf>
387
398
  </>
388
399
  ) : isLink ? (
389
400
  <RouteLeaf {...leafProps(cat.to)} className={(active) => `${rowCls}${active ? ' is-active' : ''}`}>
@@ -447,7 +458,7 @@ export default function NavRailSite({
447
458
  {/* ONE TREE IN BOTH STATES (2026-10-24, the clip model): the Tooltip wraps the row expanded too,
448
459
  disabled — wrapping only when collapsed rebuilt every row on the toggle, losing hover and
449
460
  focus and flashing the rail. Portalled, so overflow can't clip it. */}
450
- <Tooltip label={cat.label} placement="right" triggerClassName="block" disabled={!collapsed}>
461
+ <Tooltip label={cat.label} placement="right" triggerClassName={isFolder ? 'block relative kol-sidenav-hop-split' : 'block'} disabled={!collapsed}>
451
462
  {head}
452
463
  </Tooltip>
453
464
 
@@ -480,7 +491,7 @@ export default function NavRailSite({
480
491
  * collapsed tree they scrolled off below the footer — "pinned" only
481
492
  * held while the tree was shorter than the rail. They are the block
482
493
  * after it now, above the footer, the tree scrolling underneath. */}
483
- <div className="kol-sidenav-scroll flex-1 overflow-y-auto pt-4 pb-4 [scrollbar-width:thin]">
494
+ <div className={`kol-sidenav-scroll flex-1 overflow-y-auto pt-4 [scrollbar-width:thin] ${fade ? 'pb-12 kol-sidenav-scroll--fade' : 'pb-4'}`}>
484
495
  <nav aria-label="Sections">
485
496
  <ul className="kol-sidenav-tree flex flex-col gap-[2px]">
486
497
  {navTree.map(renderCat)}
@@ -508,9 +519,9 @@ export default function NavRailSite({
508
519
  )}
509
520
  </div>
510
521
 
511
- {footer !== false && footer !== null && (
522
+ {footer != null && footer !== false && (
512
523
  <div className="kol-sidenav-footer flex items-center h-14 border-t border-fg-08 min-w-0">
513
- {footer !== undefined ? footer : (
524
+ {footer !== 'credit' ? footer : (
514
525
  <a
515
526
  href="https://kolkrabbi.io"
516
527
  target="_blank"