@kolkrabbi/kol-workshop 0.46.0 → 0.48.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 +6 -6
- package/src/compositions/{WorkshopDefaultSidebar.jsx → WorkshopDefaultRail.jsx} +3 -3
- package/src/compositions/{WorkshopSidebar.jsx → WorkshopRail.jsx} +5 -5
- package/src/compositions/index.js +6 -2
- package/src/exhibit/ExhibitSidebar.jsx +1 -1
- package/src/index.js +1 -1
- package/src/shell/ShellLayout.jsx +6 -6
- package/src/shell/{ShellSidebar.jsx → ShellRail.jsx} +3 -3
- 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`, `WorkshopDefaultRail` | 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.48.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Docs viewer, shell and tag system",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"d3": "^7.9.0",
|
|
16
|
+
"@kolkrabbi/kol-brand": "^0.2.0",
|
|
16
17
|
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
17
|
-
"@kolkrabbi/kol-search": "^0.3.0"
|
|
18
|
-
"@kolkrabbi/kol-brand": "^0.2.0"
|
|
18
|
+
"@kolkrabbi/kol-search": "^0.3.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@kolkrabbi/kol-component": ">=0.355.0",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"react-router-dom": "^6.0.0 || ^7.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@kolkrabbi/kol-component": "^0.
|
|
33
|
-
"@kolkrabbi/kol-theme": "^0.216.1",
|
|
32
|
+
"@kolkrabbi/kol-component": "^0.358.0",
|
|
34
33
|
"@kolkrabbi/kol-framework": "^0.74.0",
|
|
34
|
+
"@kolkrabbi/kol-icons": "^0.68.0",
|
|
35
35
|
"@kolkrabbi/kol-shell": "^0.118.0",
|
|
36
|
-
"@kolkrabbi/kol-
|
|
36
|
+
"@kolkrabbi/kol-theme": "^0.217.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"src",
|
|
@@ -3,7 +3,7 @@ import { IconLoader } from '@kolkrabbi/kol-component'
|
|
|
3
3
|
import { RailRow } from '../shell/index.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* WorkshopDefaultRail — EXAMPLE composition. The contextual right rail:
|
|
7
7
|
* given the current route it shows sibling pages, the section's repo links, and
|
|
8
8
|
* quick actions. Decoupled from app singletons via props:
|
|
9
9
|
*
|
|
@@ -12,7 +12,7 @@ import { RailRow } from '../shell/index.js'
|
|
|
12
12
|
* basePath — mount point of the workshop (drives route matching + hrefs).
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const WorkshopDefaultRail = ({ routes = [], basePath = '/workshop' }) => {
|
|
16
16
|
const location = useLocation()
|
|
17
17
|
const stripped = location.pathname.startsWith(basePath)
|
|
18
18
|
? location.pathname.slice(basePath.length).replace(/^\//, '')
|
|
@@ -62,4 +62,4 @@ const WorkshopDefaultSidebar = ({ routes = [], basePath = '/workshop' }) => {
|
|
|
62
62
|
)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
export default
|
|
65
|
+
export default WorkshopDefaultRail
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import { Link, useLocation } from 'react-router-dom'
|
|
3
|
-
import {
|
|
3
|
+
import { ShellRail, RailSection, RailRow } from '../shell/index.js'
|
|
4
4
|
import { IconLoader } from '@kolkrabbi/kol-component'
|
|
5
5
|
import {
|
|
6
6
|
extractDocNumber,
|
|
@@ -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:
|
|
@@ -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,9 @@
|
|
|
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
|
|
8
|
-
|
|
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'
|
|
10
|
+
export { default as WorkshopDefaultRail } from './WorkshopDefaultRail.jsx'
|
|
11
|
+
/** @deprecated WorkshopDefaultSidebar = WorkshopDefaultRail (2026-11-08, ITS RAIL) — alias for the 30-day ledger */
|
|
12
|
+
export { default as WorkshopDefaultSidebar } from './WorkshopDefaultRail.jsx'
|
|
@@ -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 }]
|
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 +
|
|
@@ -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
|
))}
|
|
@@ -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)
|
|
@@ -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. */
|