@kolkrabbi/kol-component 0.307.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.307.0",
3
+ "version": "0.308.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,8 +26,8 @@
26
26
  "embla-carousel-react": "^8.6.0",
27
27
  "pdfjs-dist": "^6.3.289",
28
28
  "react-syntax-highlighter": "^16.1.1",
29
- "@kolkrabbi/kol-markdown": "^0.1.3",
30
- "@kolkrabbi/kol-search": "^0.3.0"
29
+ "@kolkrabbi/kol-search": "^0.3.0",
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>
@@ -126,8 +126,12 @@ import useDragResize from '../hooks/useDragResize.js'
126
126
  * THE RAIL'S BEHAVIOURS ARE PROPS (SiteRailTitleNavigatesOnly, kol-branding 2026-10-27 — user: "clicking on title
127
127
  * shouldnt also expand, that is what the chevron is for", and: a small rail behaviour should never need a ticket here —
128
128
  * a sensible default plus a prop the consumer sets in its own repo):
129
- * `discloseOnTitle` `true` lets a foldernote's TITLE also open its pages; default `false` — the title navigates, the
130
- * 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
131
135
  * `defaultOpen` category ids open on first render (default none — the rail loads closed, elder ruling 2026-08-06)
132
136
  * `openOnRoute` `true` opens the category holding the current route whenever the route changes (default `false`
133
137
  * — nothing auto-expands on arrival); it only adds, never closes what you opened
@@ -204,6 +208,7 @@ export default function NavRailSite({
204
208
  expandOnSelect = false,
205
209
  defaultCollapsed = false,
206
210
  discloseOnTitle = false,
211
+ fade = true,
207
212
  defaultOpen = [],
208
213
  openOnRoute = false,
209
214
  }) {
@@ -368,24 +373,28 @@ export default function NavRailSite({
368
373
  definition, and an <a href> would promise a page that does
369
374
  not exist. Clicking it discloses its pages. */
370
375
  const head = isFolder ? (
371
- /* the row opens the page (and discloses only with `discloseOnTitle`); the caret beside it (a sibling — a
372
- * 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. */
373
382
  <>
374
- <RouteLeaf {...leafProps(cat.to)} onPress={discloseOnTitle ? () => discloseCat(cat.id) : undefined} className={(active) => `${rowCls}${(active || isActiveCat(cat)) ? ' is-active' : ''}`}>
375
- {glyph}
376
- <span className="kol-sidenav-hop-label flex-1 min-w-0">{cat.label}</span>
377
- </RouteLeaf>
378
383
  <button
379
384
  type="button"
380
385
  /* no display utility on the caret — it would outrank the collapsed rule's display:none (the 2026-08-09 defect; the
381
386
  * box lives in .kol-sidenav-hop-caret, kol-framework.css) */
382
- 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"
383
388
  aria-expanded={isOpen}
384
389
  aria-label={isOpen ? `Collapse ${cat.label}` : `Expand ${cat.label}`}
385
390
  onClick={() => (collapsed ? (expandOnSelect && toggleCollapsed(), discloseCat(cat.id)) : toggleCat(cat.id))}
386
391
  >
387
- <Icon name="chevron-down" size={12} />
392
+ <span className={`kol-sidenav-hop-chevron${isOpen ? '' : ' -rotate-90'}`}><Icon name="chevron-down" size={12} /></span>
388
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>
389
398
  </>
390
399
  ) : isLink ? (
391
400
  <RouteLeaf {...leafProps(cat.to)} className={(active) => `${rowCls}${active ? ' is-active' : ''}`}>
@@ -449,7 +458,7 @@ export default function NavRailSite({
449
458
  {/* ONE TREE IN BOTH STATES (2026-10-24, the clip model): the Tooltip wraps the row expanded too,
450
459
  disabled — wrapping only when collapsed rebuilt every row on the toggle, losing hover and
451
460
  focus and flashing the rail. Portalled, so overflow can't clip it. */}
452
- <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}>
453
462
  {head}
454
463
  </Tooltip>
455
464
 
@@ -482,7 +491,7 @@ export default function NavRailSite({
482
491
  * collapsed tree they scrolled off below the footer — "pinned" only
483
492
  * held while the tree was shorter than the rail. They are the block
484
493
  * after it now, above the footer, the tree scrolling underneath. */}
485
- <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'}`}>
486
495
  <nav aria-label="Sections">
487
496
  <ul className="kol-sidenav-tree flex flex-col gap-[2px]">
488
497
  {navTree.map(renderCat)}