@kolkrabbi/kol-workshop 0.45.0 → 0.47.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/README.md +2 -2
- package/package.json +8 -8
- package/src/compositions/WorkshopDefaultSidebar.jsx +5 -5
- package/src/compositions/{WorkshopSidebar.jsx → WorkshopRail.jsx} +7 -7
- package/src/compositions/index.js +3 -1
- package/src/docs/DocsFrontmatter.jsx +3 -3
- package/src/docs/DocumentationReader.jsx +7 -7
- package/src/exhibit/ExhibitLinkCard.jsx +3 -3
- package/src/exhibit/ExhibitSidebar.jsx +9 -9
- package/src/index.js +1 -1
- package/src/search/SearchPage.jsx +2 -2
- package/src/shell/RailSection.jsx +3 -3
- package/src/shell/ShellLayout.jsx +6 -6
- package/src/shell/{ShellSidebar.jsx → ShellRail.jsx} +7 -7
- package/src/shell/index.js +7 -5
package/README.md
CHANGED
|
@@ -26,9 +26,9 @@ Two entry points:
|
|
|
26
26
|
| Import | What |
|
|
27
27
|
| --- | --- |
|
|
28
28
|
| `DocumentationReader` | the docs viewer — renders one doc from the inventory (article + header + frontmatter + token render) |
|
|
29
|
-
| `ShellLayout`, `
|
|
29
|
+
| `ShellLayout`, `ShellRail` | the docs shell composition (adapts the DS `ShellHeader`/`ShellDrawer`/`ShellSearchOverlay`) |
|
|
30
30
|
| `TagModeProvider`, `TagModeGate`, `TagModeOverlay`, `TagGraph` | the tag system, incl. the d3 tag graph |
|
|
31
|
-
| `
|
|
31
|
+
| `WorkshopRail`, `WorkshopDefaultSidebar` | example sidebar compositions to copy |
|
|
32
32
|
|
|
33
33
|
The React layer imports its chrome (`Icon`/`Tag`/`CodeBlock`/`Divider`/`DocsToc` from `kol-component`, `ShellHeader` from `kol-framework`) from the DS packages — it keeps **no** local copies. Chrome CSS ships in `@kolkrabbi/kol-theme` (`kol-components-workshop.css`, already in the theme aggregate).
|
|
34
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-workshop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Docs viewer, shell and tag system",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,22 +18,22 @@
|
|
|
18
18
|
"@kolkrabbi/kol-brand": "^0.2.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@kolkrabbi/kol-component": ">=0.
|
|
21
|
+
"@kolkrabbi/kol-component": ">=0.355.0",
|
|
22
22
|
"@kolkrabbi/kol-framework": ">=0.63.0",
|
|
23
23
|
"@kolkrabbi/kol-shell": ">=0.89.0",
|
|
24
24
|
"@kolkrabbi/kol-theme": ">=0.165.0",
|
|
25
|
-
"@kolkrabbi/kol-icons": ">=0.
|
|
25
|
+
"@kolkrabbi/kol-icons": ">=0.68.0",
|
|
26
26
|
"gsap": "^3.13.0",
|
|
27
27
|
"react": "^18.3.0 || ^19.0.0",
|
|
28
28
|
"react-dom": "^18.3.0 || ^19.0.0",
|
|
29
29
|
"react-router-dom": "^6.0.0 || ^7.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@kolkrabbi/kol-icons": "^0.
|
|
33
|
-
"@kolkrabbi/kol-framework": "^0.
|
|
34
|
-
"@kolkrabbi/kol-shell": "^0.
|
|
35
|
-
"@kolkrabbi/kol-theme": "^0.
|
|
36
|
-
"@kolkrabbi/kol-component": "^0.
|
|
32
|
+
"@kolkrabbi/kol-icons": "^0.68.0",
|
|
33
|
+
"@kolkrabbi/kol-framework": "^0.74.0",
|
|
34
|
+
"@kolkrabbi/kol-shell": "^0.118.0",
|
|
35
|
+
"@kolkrabbi/kol-theme": "^0.217.0",
|
|
36
|
+
"@kolkrabbi/kol-component": "^0.358.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"src",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useLocation, Link } from 'react-router-dom'
|
|
2
|
-
import {
|
|
2
|
+
import { IconLoader } from '@kolkrabbi/kol-component'
|
|
3
3
|
import { RailRow } from '../shell/index.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -42,10 +42,10 @@ const WorkshopDefaultSidebar = ({ routes = [], basePath = '/workshop' }) => {
|
|
|
42
42
|
<div className="shell-sidebar-label kol-doc-eyebrow">Repository</div>
|
|
43
43
|
<div>
|
|
44
44
|
{links.live && (
|
|
45
|
-
<RailRow href={links.live} icon={<
|
|
45
|
+
<RailRow href={links.live} icon={<IconLoader name="external-link" size={14} />}>Live site</RailRow>
|
|
46
46
|
)}
|
|
47
47
|
{links.repo && (
|
|
48
|
-
<RailRow href={links.repo} icon={<
|
|
48
|
+
<RailRow href={links.repo} icon={<IconLoader name="external-link" size={14} />}>GitHub</RailRow>
|
|
49
49
|
)}
|
|
50
50
|
</div>
|
|
51
51
|
</div>
|
|
@@ -54,8 +54,8 @@ const WorkshopDefaultSidebar = ({ routes = [], basePath = '/workshop' }) => {
|
|
|
54
54
|
<div>
|
|
55
55
|
<div className="shell-sidebar-label kol-doc-eyebrow">Quick actions</div>
|
|
56
56
|
<div>
|
|
57
|
-
<RailRow to={basePath} icon={<
|
|
58
|
-
<RailRow onClick={() => navigator.clipboard.writeText(window.location.pathname)} icon={<
|
|
57
|
+
<RailRow to={basePath} icon={<IconLoader name="layout" size={14} />}>Workshop home</RailRow>
|
|
58
|
+
<RailRow onClick={() => navigator.clipboard.writeText(window.location.pathname)} icon={<IconLoader name="copy" size={14} />}>Copy path</RailRow>
|
|
59
59
|
</div>
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import { Link, useLocation } from 'react-router-dom'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { ShellRail, RailSection, RailRow } from '../shell/index.js'
|
|
4
|
+
import { IconLoader } from '@kolkrabbi/kol-component'
|
|
5
5
|
import {
|
|
6
6
|
extractDocNumber,
|
|
7
7
|
cleanTitle,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '../engine/index.js'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* WorkshopRail — EXAMPLE composition. This is the app-specific glue that
|
|
14
14
|
* wires the KOL shell + docs engine into a product's primary navigation.
|
|
15
15
|
* Consumers copy this file and adapt it; it is intentionally decoupled from
|
|
16
16
|
* any app singleton via props:
|
|
@@ -85,7 +85,7 @@ const DocsSidebar = ({ inventory = [], docHref, basePath, onNavigate, collapsed,
|
|
|
85
85
|
count={docs.length}
|
|
86
86
|
collapsed={!!isCollapsed}
|
|
87
87
|
onToggle={() => toggleGroup(major)}
|
|
88
|
-
icon={
|
|
88
|
+
icon={IconLoader}
|
|
89
89
|
>
|
|
90
90
|
<nav className="shell-nav-items">
|
|
91
91
|
{docs.map((d) => (
|
|
@@ -110,7 +110,7 @@ const DocsSidebar = ({ inventory = [], docHref, basePath, onNavigate, collapsed,
|
|
|
110
110
|
)
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
const
|
|
113
|
+
const WorkshopRail = ({
|
|
114
114
|
routes = [],
|
|
115
115
|
inventory = [],
|
|
116
116
|
basePath = '/workshop',
|
|
@@ -135,7 +135,7 @@ const WorkshopSidebar = ({
|
|
|
135
135
|
|
|
136
136
|
return (
|
|
137
137
|
<div className="shell-rail-stack">
|
|
138
|
-
<
|
|
138
|
+
<ShellRail
|
|
139
139
|
routes={workshopRoutes}
|
|
140
140
|
basePath={basePath}
|
|
141
141
|
onNavigate={onNavigate}
|
|
@@ -156,4 +156,4 @@ const WorkshopSidebar = ({
|
|
|
156
156
|
)
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
export default
|
|
159
|
+
export default WorkshopRail
|
|
@@ -4,5 +4,7 @@
|
|
|
4
4
|
* to be copied and adapted; they take app data (routes, inventory) and href
|
|
5
5
|
* helpers (basePath, docHref) as props rather than importing any singleton.
|
|
6
6
|
*/
|
|
7
|
-
export { default as
|
|
7
|
+
export { default as WorkshopRail } from './WorkshopRail.jsx'
|
|
8
|
+
/** @deprecated WorkshopSidebar = WorkshopRail (2026-11-08, ITS RAIL) — alias for the 30-day ledger */
|
|
9
|
+
export { default as WorkshopSidebar } from './WorkshopRail.jsx'
|
|
8
10
|
export { default as WorkshopDefaultSidebar } from './WorkshopDefaultSidebar.jsx'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useLayoutEffect, useRef, useState } from 'react'
|
|
2
|
-
import { Badge,
|
|
2
|
+
import { Badge, IconLoader, Tag } from '@kolkrabbi/kol-component'
|
|
3
3
|
import { getTagColor } from '@kolkrabbi/kol-markdown'
|
|
4
4
|
import { useTagMode } from '../tags/index.js'
|
|
5
5
|
import TagPath from '../tags/TagPath.jsx'
|
|
@@ -219,7 +219,7 @@ const DocsFrontmatter = ({ metadata, docId, fields: config = {} }) => {
|
|
|
219
219
|
return (
|
|
220
220
|
<div key={key} className="docs-frontmatter-row">
|
|
221
221
|
<span className="docs-frontmatter-key kol-helper-12 text-meta">
|
|
222
|
-
{icon && <
|
|
222
|
+
{icon && <IconLoader name={icon} size={14} className="text-oq-48" />}
|
|
223
223
|
{cfg.label ?? FIELD_LABELS[key] ?? humanise(key)}
|
|
224
224
|
</span>
|
|
225
225
|
<span className="docs-frontmatter-value kol-mono-12 text-strong">
|
|
@@ -290,7 +290,7 @@ const DocsFrontmatter = ({ metadata, docId, fields: config = {} }) => {
|
|
|
290
290
|
className="docs-frontmatter-toggle kol-helper-12 text-meta"
|
|
291
291
|
onClick={() => setExpanded((v) => !v)}
|
|
292
292
|
>
|
|
293
|
-
<
|
|
293
|
+
<IconLoader name={expanded ? 'chevron-up' : 'chevron-down'} size={14} />
|
|
294
294
|
{expanded ? 'Collapse' : 'Expand'}
|
|
295
295
|
</button>
|
|
296
296
|
)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, useContext, useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import { useParams, Link, useNavigate } from 'react-router-dom'
|
|
3
|
-
import { CodeBlock, Divider,
|
|
3
|
+
import { CodeBlock, Divider, IconLoader, Table, useScrollSpy } from '@kolkrabbi/kol-component'
|
|
4
4
|
import { ShellTocContext, RightRail, SHELL_SCROLL_ROOT } from '../shell/index.js'
|
|
5
5
|
import { useTagMode } from '../tags/index.js'
|
|
6
6
|
import TagPath from '../tags/TagPath.jsx'
|
|
@@ -28,11 +28,11 @@ const DocReaderSidebar = ({ toc, allTags, related, docId, docsIndexHref, compone
|
|
|
28
28
|
const activeId = useScrollSpy((toc ?? []).map((h) => h.id), { root: SHELL_SCROLL_ROOT })
|
|
29
29
|
|
|
30
30
|
const actions = [
|
|
31
|
-
{ id: 'back', label: 'Back', icon: <
|
|
32
|
-
{ id: 'docs', label: 'All documentation', icon: <
|
|
33
|
-
{ id: 'components', label: 'View components', icon: <
|
|
34
|
-
{ id: 'copy', label: 'Copy path', icon: <
|
|
35
|
-
{ id: 'graph', label: 'Graph view', icon: <
|
|
31
|
+
{ id: 'back', label: 'Back', icon: <IconLoader name="arrow-left" size={14} />, onClick: () => navigate(-1) },
|
|
32
|
+
{ id: 'docs', label: 'All documentation', icon: <IconLoader name="book-open" size={14} />, to: docsIndexHref },
|
|
33
|
+
{ id: 'components', label: 'View components', icon: <IconLoader name="grid" size={14} />, to: componentsHref },
|
|
34
|
+
{ id: 'copy', label: 'Copy path', icon: <IconLoader name="copy" size={14} />, onClick: () => navigator.clipboard.writeText(docFilePath(docId)) },
|
|
35
|
+
{ id: 'graph', label: 'Graph view', icon: <IconLoader name="polygon" size={14} />, onClick: () => openTagMode(null, { view: 'graph' }) },
|
|
36
36
|
]
|
|
37
37
|
|
|
38
38
|
return (
|
|
@@ -45,7 +45,7 @@ const DocReaderSidebar = ({ toc, allTags, related, docId, docsIndexHref, compone
|
|
|
45
45
|
tags={allTags}
|
|
46
46
|
renderTag={(tag) => <TagPath tag={tag} />}
|
|
47
47
|
onTagClick={(tag) => openTagMode(tag)}
|
|
48
|
-
icon={
|
|
48
|
+
icon={IconLoader}
|
|
49
49
|
/>
|
|
50
50
|
)
|
|
51
51
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Link } from 'react-router-dom'
|
|
2
|
-
import {
|
|
2
|
+
import { IconLoader } from '@kolkrabbi/kol-component'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* ExhibitLinkCard — A card linking to an exhibit page. the card an exhibit's landing page uses for each child
|
|
@@ -44,7 +44,7 @@ export default function ExhibitLinkCard({
|
|
|
44
44
|
<h3 className="kol-card-kicker">{label}</h3>
|
|
45
45
|
{subtitle && <p className="kol-mono-10 mt-1 italic text-fg-64">{subtitle}</p>}
|
|
46
46
|
</div>
|
|
47
|
-
<
|
|
47
|
+
<IconLoader name={icon} size={16} />
|
|
48
48
|
</div>
|
|
49
49
|
|
|
50
50
|
<div className="flex flex-1 items-center justify-center overflow-hidden rounded border border-fg-08">
|
|
@@ -55,7 +55,7 @@ export default function ExhibitLinkCard({
|
|
|
55
55
|
className="h-full w-full scale-100 object-cover object-center transition-transform duration-300 group-hover:scale-105"
|
|
56
56
|
/>
|
|
57
57
|
) : (
|
|
58
|
-
<
|
|
58
|
+
<IconLoader
|
|
59
59
|
name={icon}
|
|
60
60
|
size={64}
|
|
61
61
|
className="text-auto transition-transform duration-300 group-hover:scale-105"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Link, useNavigate } from 'react-router-dom'
|
|
2
|
-
import { DocsToc,
|
|
2
|
+
import { DocsToc, IconLoader } from '@kolkrabbi/kol-component'
|
|
3
3
|
import RailSection from '../shell/RailSection.jsx'
|
|
4
4
|
import RailRow from '../shell/RailRow.jsx'
|
|
5
5
|
|
|
@@ -18,7 +18,7 @@ import RailRow from '../shell/RailRow.jsx'
|
|
|
18
18
|
* rungs come from RailSection now, so this block cannot drift from either rail.
|
|
19
19
|
* `pnpm validate:rails` R3 + R4 assert both halves.
|
|
20
20
|
*
|
|
21
|
-
* Router-agnostic in the same way as
|
|
21
|
+
* Router-agnostic in the same way as WorkshopRail: hrefs are built from
|
|
22
22
|
* `basePath`/`docHref`, never from an app singleton.
|
|
23
23
|
*
|
|
24
24
|
* @param {Array} [sections] on-this-page entries for DocsToc: [{ id, title, level }]
|
|
@@ -39,13 +39,13 @@ export default function ExhibitSidebar({
|
|
|
39
39
|
return (
|
|
40
40
|
<div className="shell-rail-stack-inner">
|
|
41
41
|
{sections.length > 0 && (
|
|
42
|
-
<RailSection level={1} label="On this page" icon={
|
|
42
|
+
<RailSection level={1} label="On this page" icon={IconLoader}>
|
|
43
43
|
<DocsToc toc={sections} />
|
|
44
44
|
</RailSection>
|
|
45
45
|
)}
|
|
46
46
|
|
|
47
47
|
{links.length > 0 && (
|
|
48
|
-
<RailSection level={1} label="Documentation" icon={
|
|
48
|
+
<RailSection level={1} label="Documentation" icon={IconLoader}>
|
|
49
49
|
<nav className="shell-nav-items">
|
|
50
50
|
{links.map(({ id, label }) => (
|
|
51
51
|
<RailRow key={id} to={docHref(id)}>
|
|
@@ -57,22 +57,22 @@ export default function ExhibitSidebar({
|
|
|
57
57
|
)}
|
|
58
58
|
|
|
59
59
|
{actions && (
|
|
60
|
-
<RailSection level={1} label="Quick actions" icon={
|
|
60
|
+
<RailSection level={1} label="Quick actions" icon={IconLoader}>
|
|
61
61
|
<div className="space-y-1">
|
|
62
62
|
<button
|
|
63
63
|
type="button"
|
|
64
64
|
className="shell-sidebar-action kol-mono-14 text-body"
|
|
65
65
|
onClick={() => navigate(-1)}
|
|
66
66
|
>
|
|
67
|
-
<
|
|
67
|
+
<IconLoader name="arrow-left" size={14} />
|
|
68
68
|
Back
|
|
69
69
|
</button>
|
|
70
70
|
<Link to={docHref()} className="shell-sidebar-action kol-mono-14 text-body">
|
|
71
|
-
<
|
|
71
|
+
<IconLoader name="book-open" size={14} className="text-oq-64" />
|
|
72
72
|
All documentation
|
|
73
73
|
</Link>
|
|
74
74
|
<Link to={basePath} className="shell-sidebar-action kol-mono-14 text-body">
|
|
75
|
-
<
|
|
75
|
+
<IconLoader name="layout" size={14} className="text-oq-64" />
|
|
76
76
|
Workshop home
|
|
77
77
|
</Link>
|
|
78
78
|
<button
|
|
@@ -80,7 +80,7 @@ export default function ExhibitSidebar({
|
|
|
80
80
|
className="shell-sidebar-action kol-mono-14 text-body"
|
|
81
81
|
onClick={() => navigator.clipboard?.writeText(window.location.pathname)}
|
|
82
82
|
>
|
|
83
|
-
<
|
|
83
|
+
<IconLoader name="copy" size={14} />
|
|
84
84
|
Copy path
|
|
85
85
|
</button>
|
|
86
86
|
</div>
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @kolkrabbi/kol-workshop — the KOL workshop / docs system.
|
|
3
3
|
*
|
|
4
4
|
* Aggregates everything the package now owns: the shell composition
|
|
5
|
-
* (ShellLayout +
|
|
5
|
+
* (ShellLayout + ShellRail + their contexts), the docs viewer, the tag
|
|
6
6
|
* system, the exhibit-section scaffold, the example compositions, and the pure
|
|
7
7
|
* React-free engine. Duplicated chrome (ShellHeader, ShellDrawer, SearchInput,
|
|
8
8
|
* ShellSearchOverlay, DocsToc) ships from @kolkrabbi/kol-framework +
|
|
@@ -4,7 +4,7 @@ import { useNavigate, useSearchParams } from 'react-router-dom'
|
|
|
4
4
|
import { EmptyState, Input, Tag } from '@kolkrabbi/kol-component'
|
|
5
5
|
import ResultRow from './ResultRow.jsx'
|
|
6
6
|
import { ShellSearchScopeContext } from '../shell/ShellLayout.jsx'
|
|
7
|
-
import {
|
|
7
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
8
8
|
import { createIndex, search, parseQuery } from '@kolkrabbi/kol-search'
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -170,7 +170,7 @@ export default function SearchPage({ items = [], spaces: allSpaces = [], facets
|
|
|
170
170
|
variant={rowVariant}
|
|
171
171
|
title={<Highlight text={r.item.title} ranges={r.highlights.title} />}
|
|
172
172
|
/* Round 6 (2026-10-01): `kindIcons` puts a glyph for the kind on the row, `rowMeta="path"` prints the route as the second line */
|
|
173
|
-
icon={kindIcons?.[r.item.kind] && <
|
|
173
|
+
icon={kindIcons?.[r.item.kind] && <IconLoader name={kindIcons[r.item.kind]} size={14} />}
|
|
174
174
|
meta={rowMeta === 'path' ? r.item.href : [r.item.kind, r.item.category, r.item.space, r.item.date].filter(Boolean).join(' · ')}
|
|
175
175
|
description={r.item.description}
|
|
176
176
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
2
|
import { Link } from 'react-router-dom'
|
|
3
|
-
import {
|
|
3
|
+
import { IconLoader } from '@kolkrabbi/kol-component'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* RailSection — THE rail ladder. One component owns every rail header, at
|
|
@@ -58,7 +58,7 @@ import { Icon } from '@kolkrabbi/kol-component'
|
|
|
58
58
|
* @param {Function} [onToggle] required when `collapsed` is passed
|
|
59
59
|
* @param {boolean} [defaultCollapsed=false] uncontrolled initial state
|
|
60
60
|
* @param {Function} [onNavigate] click hook on the label link (close a drawer, etc.)
|
|
61
|
-
* @param {
|
|
61
|
+
* @param {IconLoader} [icon] the chevron renderer, injected — the shell package
|
|
62
62
|
* must not reach into kol-component from here
|
|
63
63
|
*/
|
|
64
64
|
export default function RailSection({
|
|
@@ -71,7 +71,7 @@ export default function RailSection({
|
|
|
71
71
|
onToggle,
|
|
72
72
|
defaultCollapsed = false,
|
|
73
73
|
onNavigate,
|
|
74
|
-
icon: IconComponent =
|
|
74
|
+
icon: IconComponent = IconLoader,
|
|
75
75
|
/* a leading glyph for the group, between the caret and the label (rail icons, 2026-10-01) */
|
|
76
76
|
glyph,
|
|
77
77
|
children,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext, useContext, useMemo, useRef, useState, useEffect, Suspense } from 'react'
|
|
2
2
|
import { Outlet, Link, useLocation, useNavigate, useNavigationType } from 'react-router-dom'
|
|
3
3
|
import { ShellHeader } from '@kolkrabbi/kol-framework'
|
|
4
|
-
import
|
|
4
|
+
import ShellRail, { RAIL_FOLD_EVENT, ShellRailModeContext } from './ShellRail.jsx'
|
|
5
5
|
import { FullscreenOverlay, IconFrame, Rail, CommandOverlay, Tooltip, useDragResize, useScrollFade } from '@kolkrabbi/kol-component'
|
|
6
6
|
import { HubSettingsRail } from '@kolkrabbi/kol-shell'
|
|
7
7
|
import { createIndex, search } from '@kolkrabbi/kol-search'
|
|
@@ -110,7 +110,7 @@ const useRailGrab = (token, side, hide) => {
|
|
|
110
110
|
* 2026-10-02) — `open`, `icons` and hidden, which is simply not mounting it.
|
|
111
111
|
*
|
|
112
112
|
* In `icons` the column is a narrow strip (the track is the framework's collapsed-rail width,
|
|
113
|
-
* `--kol-sidenav-w-collapsed`) and every `
|
|
113
|
+
* `--kol-sidenav-w-collapsed`) and every `ShellRail` inside draws one glyph per group. Hover
|
|
114
114
|
* opens the whole rail OVER the page at its full width — the track does not move, so the page
|
|
115
115
|
* never reflows — and leaving folds it back. A touch has no hover: there the glyphs are the nav.
|
|
116
116
|
*
|
|
@@ -238,7 +238,7 @@ const toSearchItem = (item, i) => ({
|
|
|
238
238
|
* in the `S` sheet and bound by the same handler (2026-09-30)
|
|
239
239
|
* @param {Function} [renderSidebar] `({ activeRoute, onNavigate, mode }) => node` — the space's
|
|
240
240
|
* rail. `mode` is `open` or `icons` (the left rail's third state,
|
|
241
|
-
* 2026-10-02): every `
|
|
241
|
+
* 2026-10-02): every `ShellRail` reads it by itself, so `mode`
|
|
242
242
|
* is only for what else the consumer puts in the rail
|
|
243
243
|
*/
|
|
244
244
|
const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoSrc, brandLogoAlt = '', renderSidebar, searchItems, searchPath, settings = [], app, brandLabel, defaultTocContent, isActive: isActiveProp, actions, shortcuts = [] }) => {
|
|
@@ -647,7 +647,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
|
|
|
647
647
|
<div className={`shell-content-grid grid ${gridCols}`} data-layout={layoutType} style={{ paddingInline: 'var(--kol-pad-chrome-x)' }}>
|
|
648
648
|
{showNav && (
|
|
649
649
|
<ShellNavColumn mode={navIcons ? 'icons' : 'open'} railRef={navGrab.ref} grip={navGrab.grab}>
|
|
650
|
-
{(mode) => (renderSidebar ? renderSidebar({ activeRoute, mode }) : <
|
|
650
|
+
{(mode) => (renderSidebar ? renderSidebar({ activeRoute, mode }) : <ShellRail routes={routes} basePath={basePath} />)}
|
|
651
651
|
</ShellNavColumn>
|
|
652
652
|
)}
|
|
653
653
|
|
|
@@ -679,7 +679,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
|
|
|
679
679
|
>
|
|
680
680
|
{renderSidebar
|
|
681
681
|
? renderSidebar({ activeRoute, onNavigate: () => setIsNavDrawerOpen(false) })
|
|
682
|
-
: <
|
|
682
|
+
: <ShellRail routes={routes} basePath={basePath} onNavigate={() => setIsNavDrawerOpen(false)} />
|
|
683
683
|
}
|
|
684
684
|
</Rail>
|
|
685
685
|
|
|
@@ -746,7 +746,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
|
|
|
746
746
|
<ShellRailModeContext.Provider value="full">
|
|
747
747
|
{renderSidebar
|
|
748
748
|
? renderSidebar({ activeRoute: route, onNavigate: () => setIsTreeOpen(false), mode: 'full' })
|
|
749
|
-
: <
|
|
749
|
+
: <ShellRail routes={route.children ?? []} basePath={basePath} label={null} onNavigate={() => setIsTreeOpen(false)} />}
|
|
750
750
|
</ShellRailModeContext.Provider>
|
|
751
751
|
</section>
|
|
752
752
|
))}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, useContext, useState, useEffect } from 'react'
|
|
2
2
|
import { useLocation, useNavigate } from 'react-router-dom'
|
|
3
|
-
import { Button,
|
|
3
|
+
import { Button, IconLoader, Tooltip } from '@kolkrabbi/kol-component'
|
|
4
4
|
import RailSection from './RailSection.jsx'
|
|
5
5
|
import RailRow from './RailRow.jsx'
|
|
6
6
|
|
|
@@ -29,12 +29,12 @@ export const RAIL_FOLD_EVENT = 'kol-rail-fold'
|
|
|
29
29
|
/* THE RAIL'S THIRD STATE (user ruling 2026-10-02: *"I wanted that icon state on the rails. even if
|
|
30
30
|
* we dont use it, I want to see it"*). Beside visible and hidden: `icons` — the rail is a narrow
|
|
31
31
|
* strip, one glyph per group, and opens on hover. The column that holds the rail (`ShellNavColumn`)
|
|
32
|
-
* provides the state; every
|
|
32
|
+
* provides the state; every ShellRail inside it reads it, so a consumer's rail takes the state
|
|
33
33
|
* without passing a prop. Outside a provider a rail is `open`, as it always was. A third value,
|
|
34
34
|
* `full`, is the whole-tree sheet's: an open rail with every fold open. */
|
|
35
35
|
export const ShellRailModeContext = (globalThis[Symbol.for('@kolkrabbi/kol-workshop/ShellRailModeContext')] ??= createContext('open'))
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const ShellRail = ({ routes = [], basePath = '/', onNavigate, label = 'Navigation', labelTo, collapsed, onToggle, defaultCollapsed = false }) => {
|
|
38
38
|
const location = useLocation()
|
|
39
39
|
const navigate = useNavigate()
|
|
40
40
|
const mode = useContext(ShellRailModeContext)
|
|
@@ -125,7 +125,7 @@ const ShellSidebar = ({ routes = [], basePath = '/', onNavigate, label = 'Naviga
|
|
|
125
125
|
* so its caret sits on its siblings' text edge. A leaf is a RailRow wherever it lands. */
|
|
126
126
|
/* A ROUTE MAY CARRY A GLYPH (rail icons, open-questions Round 6, ruled 2026-10-01): `icon` is an
|
|
127
127
|
* icon name, drawn on the row or beside the group's label. The consumer decides which routes. */
|
|
128
|
-
const glyphOf = (route) => (route.icon ? <
|
|
128
|
+
const glyphOf = (route) => (route.icon ? <IconLoader name={route.icon} size={14} className="shrink-0" /> : undefined)
|
|
129
129
|
const renderGroup = (route) => (
|
|
130
130
|
<RailSection
|
|
131
131
|
level={2}
|
|
@@ -137,7 +137,7 @@ const ShellSidebar = ({ routes = [], basePath = '/', onNavigate, label = 'Naviga
|
|
|
137
137
|
collapsed={isFolded(route)}
|
|
138
138
|
onToggle={() => handleSectionClick(route)}
|
|
139
139
|
onNavigate={onNavigate}
|
|
140
|
-
icon={
|
|
140
|
+
icon={IconLoader}
|
|
141
141
|
glyph={glyphOf(route)}
|
|
142
142
|
>
|
|
143
143
|
{/* a group that wears a glyph steps its children in by the glyph (14 + the 8 gap), so they
|
|
@@ -218,7 +218,7 @@ const ShellSidebar = ({ routes = [], basePath = '/', onNavigate, label = 'Naviga
|
|
|
218
218
|
collapsed={mode === 'full' ? false : navCollapsed}
|
|
219
219
|
onToggle={handleToggle}
|
|
220
220
|
onNavigate={onNavigate}
|
|
221
|
-
icon={
|
|
221
|
+
icon={IconLoader}
|
|
222
222
|
>
|
|
223
223
|
{body}
|
|
224
224
|
</RailSection>
|
|
@@ -227,4 +227,4 @@ const ShellSidebar = ({ routes = [], basePath = '/', onNavigate, label = 'Naviga
|
|
|
227
227
|
)
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
export default
|
|
230
|
+
export default ShellRail
|
package/src/shell/index.js
CHANGED
|
@@ -8,15 +8,17 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { default as ShellLayout } from './ShellLayout.jsx'
|
|
10
10
|
export { ShellTocContext, ShellFullHeightContext, ShellTocCollapsedContext, ShellNavCollapsedContext, ShellContentWidthContext, ShellSearchScopeContext, SHELL_SCROLL_ROOT, usePageMeta, usePageMetaValue } from './ShellLayout.jsx'
|
|
11
|
-
export { default as
|
|
12
|
-
|
|
11
|
+
export { default as ShellRail } from './ShellRail.jsx'
|
|
12
|
+
/** @deprecated ShellSidebar = ShellRail (2026-11-08, "if it comes to view form the sides ITS RAIL") — alias for the 30-day ledger */
|
|
13
|
+
export { default as ShellSidebar } from './ShellRail.jsx'
|
|
14
|
+
/* the workshop rail IS a NavRail preset (2026-10-24): `NavRail preset="workshop"` renders ShellRail once this
|
|
13
15
|
* package is imported — kol-component cannot import kol-workshop, so the name is registered from here */
|
|
14
16
|
import { registerRailPreset } from '@kolkrabbi/kol-component'
|
|
15
|
-
import
|
|
16
|
-
registerRailPreset('workshop',
|
|
17
|
+
import ShellRailForPreset from './ShellRail.jsx'
|
|
18
|
+
registerRailPreset('workshop', ShellRailForPreset)
|
|
17
19
|
/* the left rail's column and its three states — open · icons · hidden (2026-10-02) */
|
|
18
20
|
export { ShellNavColumn } from './ShellLayout.jsx'
|
|
19
|
-
export { ShellRailModeContext } from './
|
|
21
|
+
export { ShellRailModeContext } from './ShellRail.jsx'
|
|
20
22
|
/* RailSection — THE rail ladder. Every rail header at every rung comes from
|
|
21
23
|
* here, in both rails; see the file header for why a class alone was not
|
|
22
24
|
* enough. `pnpm validate:rails` R4 asserts it. */
|