@kolkrabbi/kol-workshop 0.41.0 → 0.41.2
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 +9 -9
- package/src/compositions/WorkshopDefaultSidebar.jsx +1 -1
- package/src/compositions/WorkshopSidebar.jsx +2 -2
- package/src/docs/DocsFrontmatter.jsx +1 -1
- package/src/docs/DocumentationReader.jsx +2 -2
- package/src/search/SearchPage.jsx +1 -1
- package/src/shell/ShellLayout.jsx +6 -6
- package/src/shell/ShellSidebar.jsx +1 -1
- package/src/shell/index.js +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-workshop",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Docs viewer, shell and tag system",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"d3": "^7.9.0",
|
|
16
|
-
"@kolkrabbi/kol-
|
|
17
|
-
"@kolkrabbi/kol-markdown": "^0.
|
|
18
|
-
"@kolkrabbi/kol-
|
|
16
|
+
"@kolkrabbi/kol-brand": "^0.2.0",
|
|
17
|
+
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
18
|
+
"@kolkrabbi/kol-search": "^0.3.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@kolkrabbi/kol-component": ">=0.
|
|
21
|
+
"@kolkrabbi/kol-component": ">=0.296.0",
|
|
22
22
|
"@kolkrabbi/kol-framework": ">=0.45.0",
|
|
23
23
|
"@kolkrabbi/kol-theme": ">=0.165.0",
|
|
24
24
|
"@kolkrabbi/kol-icons": ">=0.18.0",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"react-router-dom": "^6.0.0 || ^7.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@kolkrabbi/kol-component": "^0.
|
|
32
|
-
"@kolkrabbi/kol-icons": "^0.
|
|
33
|
-
"@kolkrabbi/kol-framework": "^0.
|
|
34
|
-
"@kolkrabbi/kol-theme": "^0.
|
|
31
|
+
"@kolkrabbi/kol-component": "^0.311.2",
|
|
32
|
+
"@kolkrabbi/kol-icons": "^0.52.0",
|
|
33
|
+
"@kolkrabbi/kol-framework": "^0.62.2",
|
|
34
|
+
"@kolkrabbi/kol-theme": "^0.196.0"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"src",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLocation, Link } from 'react-router-dom'
|
|
2
2
|
import { Icon } from '@kolkrabbi/kol-component'
|
|
3
|
-
import { RailRow } from '../shell'
|
|
3
|
+
import { RailRow } from '../shell/index.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* WorkshopDefaultSidebar — EXAMPLE composition. The contextual right rail:
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import { Link, useLocation } from 'react-router-dom'
|
|
3
|
-
import { ShellSidebar, RailSection, RailRow } from '../shell'
|
|
3
|
+
import { ShellSidebar, RailSection, RailRow } from '../shell/index.js'
|
|
4
4
|
import { Icon } from '@kolkrabbi/kol-component'
|
|
5
5
|
import {
|
|
6
6
|
extractDocNumber,
|
|
7
7
|
cleanTitle,
|
|
8
8
|
categoryLabels,
|
|
9
9
|
groupDocsByMajor,
|
|
10
|
-
} from '../engine'
|
|
10
|
+
} from '../engine/index.js'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* WorkshopSidebar — EXAMPLE composition. This is the app-specific glue that
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useLayoutEffect, useRef, useState } from 'react'
|
|
2
2
|
import { Badge, Icon, Tag } from '@kolkrabbi/kol-component'
|
|
3
3
|
import { getTagColor } from '@kolkrabbi/kol-markdown'
|
|
4
|
-
import { useTagMode } from '../tags'
|
|
4
|
+
import { useTagMode } from '../tags/index.js'
|
|
5
5
|
import TagPath from '../tags/TagPath.jsx'
|
|
6
6
|
|
|
7
7
|
/* EVERY field carries an icon (user ruling 2026-08-01). Ten of these were
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useContext, useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import { useParams, Link, useNavigate } from 'react-router-dom'
|
|
3
3
|
import { CodeBlock, Divider, Icon, Table, useScrollSpy } from '@kolkrabbi/kol-component'
|
|
4
|
-
import { ShellTocContext, RightRail, SHELL_SCROLL_ROOT } from '../shell'
|
|
5
|
-
import { useTagMode } from '../tags'
|
|
4
|
+
import { ShellTocContext, RightRail, SHELL_SCROLL_ROOT } from '../shell/index.js'
|
|
5
|
+
import { useTagMode } from '../tags/index.js'
|
|
6
6
|
import TagPath from '../tags/TagPath.jsx'
|
|
7
7
|
import { parseDocsMarkdown, isIndexFile } from '@kolkrabbi/kol-markdown'
|
|
8
8
|
import { buildTagCounts } from '@kolkrabbi/kol-markdown'
|
|
@@ -173,7 +173,7 @@ export default function SearchPage({ items = [], spaces = [], facets = DEFAULT_F
|
|
|
173
173
|
))}
|
|
174
174
|
</ol>
|
|
175
175
|
)}
|
|
176
|
-
{out.total > out.results.length && <p className="kol-
|
|
176
|
+
{out.total > out.results.length && <p className="kol-mono-12 text-meta">{out.total - out.results.length} more — narrow the query.</p>}
|
|
177
177
|
</section>
|
|
178
178
|
)}
|
|
179
179
|
</div>
|
|
@@ -11,12 +11,12 @@ import { Asset } from '@kolkrabbi/kol-brand/svg'
|
|
|
11
11
|
// Pages can register right-rail TOC content via this context.
|
|
12
12
|
// Usage: const setTocContent = useContext(ShellTocContext)
|
|
13
13
|
// useLayoutEffect(() => { setTocContent(<MyToc />) ; return () => setTocContent(null) }, [])
|
|
14
|
-
export const ShellTocContext = createContext(null)
|
|
14
|
+
export const ShellTocContext = (globalThis[Symbol.for('@kolkrabbi/kol-workshop/ShellTocContext')] ??= createContext(null))
|
|
15
15
|
|
|
16
16
|
// Pages that need to fill the viewport (e.g. iframe embeds) can opt into full-height mode.
|
|
17
17
|
// Usage: const setFullHeight = useContext(ShellFullHeightContext)
|
|
18
18
|
// useLayoutEffect(() => { setFullHeight(true) ; return () => setFullHeight(false) }, [setFullHeight])
|
|
19
|
-
export const ShellFullHeightContext = createContext(null)
|
|
19
|
+
export const ShellFullHeightContext = (globalThis[Symbol.for('@kolkrabbi/kol-workshop/ShellFullHeightContext')] ??= createContext(null))
|
|
20
20
|
|
|
21
21
|
// WIDTH IS THE PAGE'S DECISION (user, 2026-08-26 — "there isnt one size fits
|
|
22
22
|
// all … what I want is consistency, sometimes that is done by left align …
|
|
@@ -29,12 +29,12 @@ export const ShellFullHeightContext = createContext(null)
|
|
|
29
29
|
// hero, a wall that should use the room it is given
|
|
30
30
|
// Usage: const setContentWidth = useContext(ShellContentWidthContext)
|
|
31
31
|
// useLayoutEffect(() => { setContentWidth('none') ; return () => setContentWidth('canvas') }, [setContentWidth])
|
|
32
|
-
export const ShellContentWidthContext = createContext(null)
|
|
32
|
+
export const ShellContentWidthContext = (globalThis[Symbol.for('@kolkrabbi/kol-workshop/ShellContentWidthContext')] ??= createContext(null))
|
|
33
33
|
|
|
34
34
|
// Pages can request the right sidebar to start collapsed.
|
|
35
35
|
// Usage: const setTocCollapsed = useContext(ShellTocCollapsedContext)
|
|
36
36
|
// useLayoutEffect(() => { setTocCollapsed(true) ; return () => setTocCollapsed(false) }, [setTocCollapsed])
|
|
37
|
-
export const ShellTocCollapsedContext = createContext(null)
|
|
37
|
+
export const ShellTocCollapsedContext = (globalThis[Symbol.for('@kolkrabbi/kol-workshop/ShellTocCollapsedContext')] ??= createContext(null))
|
|
38
38
|
|
|
39
39
|
// THE LEFT RAIL IS THE PAGE'S CALL TOO (2026-09-01). The TOC had this seam and
|
|
40
40
|
// the nav did not, so a landing page could shed one rail and not the other —
|
|
@@ -43,7 +43,7 @@ export const ShellTocCollapsedContext = createContext(null)
|
|
|
43
43
|
// the header's own toggles keep working on top of it.
|
|
44
44
|
// Usage: const setNavCollapsed = useContext(ShellNavCollapsedContext)
|
|
45
45
|
// useLayoutEffect(() => { setNavCollapsed(true) ; return () => setNavCollapsed(false) }, [setNavCollapsed])
|
|
46
|
-
export const ShellNavCollapsedContext = createContext(null)
|
|
46
|
+
export const ShellNavCollapsedContext = (globalThis[Symbol.for('@kolkrabbi/kol-workshop/ShellNavCollapsedContext')] ??= createContext(null))
|
|
47
47
|
|
|
48
48
|
/* THE PAGE TELLS THE RAIL WHAT IT IS ABOUT (2026-09-28, user: "the purpose of
|
|
49
49
|
* the right sidebar is to list that pages content and context"). The right
|
|
@@ -54,7 +54,7 @@ export const ShellNavCollapsedContext = createContext(null)
|
|
|
54
54
|
* const meta = usePageMetaValue() — in a rail
|
|
55
55
|
* Cleared on unmount, so a page that says nothing gets an empty context, never
|
|
56
56
|
* the previous page's. */
|
|
57
|
-
const ShellPageMetaContext = createContext({ meta: null, setMeta: null })
|
|
57
|
+
const ShellPageMetaContext = (globalThis[Symbol.for('@kolkrabbi/kol-workshop/ShellPageMetaContext')] ??= createContext({ meta: null, setMeta: null }))
|
|
58
58
|
|
|
59
59
|
export function usePageMeta(meta) {
|
|
60
60
|
const { setMeta } = useContext(ShellPageMetaContext)
|
|
@@ -32,7 +32,7 @@ export const RAIL_FOLD_EVENT = 'kol-rail-fold'
|
|
|
32
32
|
* provides the state; every ShellSidebar 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
|
-
export const ShellRailModeContext = createContext('open')
|
|
35
|
+
export const ShellRailModeContext = (globalThis[Symbol.for('@kolkrabbi/kol-workshop/ShellRailModeContext')] ??= createContext('open'))
|
|
36
36
|
|
|
37
37
|
const ShellSidebar = ({ routes = [], basePath = '/', onNavigate, label = 'Navigation', labelTo, collapsed, onToggle, defaultCollapsed = false }) => {
|
|
38
38
|
const location = useLocation()
|
package/src/shell/index.js
CHANGED
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
export { default as ShellLayout } from './ShellLayout.jsx'
|
|
10
10
|
export { ShellTocContext, ShellFullHeightContext, ShellTocCollapsedContext, ShellNavCollapsedContext, ShellContentWidthContext, SHELL_SCROLL_ROOT, usePageMeta, usePageMetaValue } from './ShellLayout.jsx'
|
|
11
11
|
export { default as ShellSidebar } from './ShellSidebar.jsx'
|
|
12
|
+
/* the workshop rail IS a NavRail preset (2026-10-24): `NavRail preset="workshop"` renders ShellSidebar once this
|
|
13
|
+
* package is imported — kol-component cannot import kol-workshop, so the name is registered from here */
|
|
14
|
+
import { registerRailPreset } from '@kolkrabbi/kol-component'
|
|
15
|
+
import ShellSidebarForRail from './ShellSidebar.jsx'
|
|
16
|
+
registerRailPreset('workshop', ShellSidebarForRail)
|
|
12
17
|
/* the left rail's column and its three states — open · icons · hidden (2026-10-02) */
|
|
13
18
|
export { ShellNavColumn } from './ShellLayout.jsx'
|
|
14
19
|
export { ShellRailModeContext } from './ShellSidebar.jsx'
|