@kolkrabbi/kol-workshop 0.22.0 → 0.24.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 +11 -5
- package/src/shell/ShellLayout.jsx +37 -27
- package/src/shell/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-workshop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "KOL workshop/docs system — a handrolled markdown engine, search, tag system (incl. a d3 tag graph), docs viewer, and docs shell. Sits above @kolkrabbi/kol-{theme,icons,component,framework}; content is consumer-injected (the package never globs docs).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,17 +13,23 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"d3": "^7.9.0",
|
|
16
|
-
"@kolkrabbi/kol-component": "^0.39.0",
|
|
17
|
-
"@kolkrabbi/kol-icons": "^0.16.0",
|
|
18
|
-
"@kolkrabbi/kol-framework": "^0.20.0",
|
|
19
|
-
"@kolkrabbi/kol-theme": "^0.41.0",
|
|
20
16
|
"@kolkrabbi/kol-brand": "^0.1.2"
|
|
21
17
|
},
|
|
22
18
|
"peerDependencies": {
|
|
19
|
+
"@kolkrabbi/kol-component": ">=0.68.1",
|
|
20
|
+
"@kolkrabbi/kol-framework": ">=0.23.0",
|
|
21
|
+
"@kolkrabbi/kol-theme": ">=0.51.0",
|
|
22
|
+
"@kolkrabbi/kol-icons": ">=0.18.0",
|
|
23
23
|
"react": "^18.3.0 || ^19.0.0",
|
|
24
24
|
"react-dom": "^18.3.0 || ^19.0.0",
|
|
25
25
|
"react-router-dom": "^6.0.0 || ^7.0.0"
|
|
26
26
|
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@kolkrabbi/kol-component": "^0.68.1",
|
|
29
|
+
"@kolkrabbi/kol-icons": "^0.18.0",
|
|
30
|
+
"@kolkrabbi/kol-framework": "^0.24.0",
|
|
31
|
+
"@kolkrabbi/kol-theme": "^0.52.1"
|
|
32
|
+
},
|
|
27
33
|
"files": [
|
|
28
34
|
"src",
|
|
29
35
|
"README.md"
|
|
@@ -18,6 +18,19 @@ export const ShellTocContext = createContext(null)
|
|
|
18
18
|
// useLayoutEffect(() => { setFullHeight(true) ; return () => setFullHeight(false) }, [setFullHeight])
|
|
19
19
|
export const ShellFullHeightContext = createContext(null)
|
|
20
20
|
|
|
21
|
+
// WIDTH IS THE PAGE'S DECISION (user, 2026-08-26 — "there isnt one size fits
|
|
22
|
+
// all … what I want is consistency, sometimes that is done by left align …
|
|
23
|
+
// sometimes its a different method"). Three settings:
|
|
24
|
+
// 'canvas' (default) — capped at --kol-content-canvas, LEFT against the nav:
|
|
25
|
+
// doc pages, where the constant gap to the rail is the
|
|
26
|
+
// consistency that matters, especially for narrow content
|
|
27
|
+
// 'shell' — capped at --kol-content-shell and centred: the frame rung
|
|
28
|
+
// 'none' — spans the main track: a landing page with a centred
|
|
29
|
+
// hero, a wall that should use the room it is given
|
|
30
|
+
// Usage: const setContentWidth = useContext(ShellContentWidthContext)
|
|
31
|
+
// useLayoutEffect(() => { setContentWidth('none') ; return () => setContentWidth('canvas') }, [setContentWidth])
|
|
32
|
+
export const ShellContentWidthContext = createContext(null)
|
|
33
|
+
|
|
21
34
|
// Pages can request the right sidebar to start collapsed.
|
|
22
35
|
// Usage: const setTocCollapsed = useContext(ShellTocCollapsedContext)
|
|
23
36
|
// useLayoutEffect(() => { setTocCollapsed(true) ; return () => setTocCollapsed(false) }, [setTocCollapsed])
|
|
@@ -33,39 +46,33 @@ const NavColumn = ({ children }) => (
|
|
|
33
46
|
</aside>
|
|
34
47
|
)
|
|
35
48
|
|
|
36
|
-
const
|
|
49
|
+
const CONTENT_WIDTH = {
|
|
50
|
+
canvas: 'w-full max-w-[var(--kol-content-canvas)]',
|
|
51
|
+
shell: 'w-full mx-auto max-w-[var(--kol-content-shell)]',
|
|
52
|
+
none: 'w-full',
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const MainColumn = ({ children, fullHeight, width = 'canvas' }) => (
|
|
37
56
|
<main
|
|
38
57
|
id="main"
|
|
39
58
|
className={`w-full min-w-0 h-full min-h-0 ${fullHeight ? 'overflow-hidden flex flex-col' : 'overflow-y-auto overscroll-none'}`}
|
|
40
59
|
style={fullHeight ? undefined : { scrollbarGutter: 'stable' }}
|
|
41
60
|
>
|
|
42
|
-
{/*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* One decision, made once: 14 pages needed no per-page cap.
|
|
55
|
-
* `fullHeight` stays uncapped on purpose — it IS the fill-the-viewport
|
|
56
|
-
* escape hatch (iframe embeds).
|
|
57
|
-
*
|
|
58
|
-
* LEFT-ANCHORED, not centred (user ruling 2026-08-01). The capped div
|
|
59
|
-
* below carried `mx-auto`, which centres the column inside the main
|
|
60
|
-
* track — so above the canvas width the content drifted away from the
|
|
61
|
-
* rail it is supposed to line up with. The one-frame law has said
|
|
62
|
-
* "content LEFT-ANCHORED inside" since 2026-07-28 (kol-theme.css content
|
|
63
|
-
* block; docs/documentation/01-foundations/05-layout-systems.md): the
|
|
64
|
-
* FRAME centres in the viewport, the CONTENT does not centre in the
|
|
65
|
-
* frame. `validate:width` W4 asserts it now. */}
|
|
61
|
+
{/* The cap lives HERE, on the CONTENT — not on the grid that holds the
|
|
62
|
+
* rails (2026-07-31: capping the grid centred all three columns and pulled
|
|
63
|
+
* both rails off the viewport edge). WHICH cap is the page's call — see
|
|
64
|
+
* ShellContentWidthContext. The default is canvas, left against the nav:
|
|
65
|
+
* that was a call made for doc pages (2026-07-31 / 2026-08-01, narrow
|
|
66
|
+
* content keeping a constant gap to the rail) and it was written here as
|
|
67
|
+
* a law for every page — the home page's centred hero then centred on the
|
|
68
|
+
* cap instead of the track, so closing the TOC moved nothing and closing
|
|
69
|
+
* the nav moved everything. It is a default now, not a rule. Canvas stays
|
|
70
|
+
* left-anchored (never mx-auto — W4); shell is the frame rung and centres;
|
|
71
|
+
* none spans the track. `fullHeight` stays uncapped — it IS the
|
|
72
|
+
* fill-the-viewport escape hatch (iframe embeds). */}
|
|
66
73
|
{fullHeight
|
|
67
74
|
? children
|
|
68
|
-
: <div className=
|
|
75
|
+
: <div className={`${CONTENT_WIDTH[width] ?? CONTENT_WIDTH.canvas} pt-6 md:pt-6 lg:pt-8 pb-16`}>{children}</div>
|
|
69
76
|
}
|
|
70
77
|
</main>
|
|
71
78
|
)
|
|
@@ -109,6 +116,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
|
|
|
109
116
|
: setLocalOpen
|
|
110
117
|
const [tocContent, setTocContent] = useState(null)
|
|
111
118
|
const [isFullHeight, setIsFullHeight] = useState(false)
|
|
119
|
+
const [contentWidth, setContentWidth] = useState('canvas')
|
|
112
120
|
const [isShortcutsOpen, setIsShortcutsOpen] = useState(false)
|
|
113
121
|
const location = useLocation()
|
|
114
122
|
const navigate = useNavigate()
|
|
@@ -250,6 +258,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
|
|
|
250
258
|
return (
|
|
251
259
|
<ShellTocContext.Provider value={setTocContent}>
|
|
252
260
|
<ShellFullHeightContext.Provider value={setIsFullHeight}>
|
|
261
|
+
<ShellContentWidthContext.Provider value={setContentWidth}>
|
|
253
262
|
<ShellTocCollapsedContext.Provider value={setTocCollapsed}>
|
|
254
263
|
<div className="fixed inset-0 flex flex-col bg-surface-primary text-auto">
|
|
255
264
|
<ShellHeader
|
|
@@ -311,7 +320,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
|
|
|
311
320
|
</NavColumn>
|
|
312
321
|
)}
|
|
313
322
|
|
|
314
|
-
<MainColumn fullHeight={isFullHeight}>
|
|
323
|
+
<MainColumn fullHeight={isFullHeight} width={contentWidth}>
|
|
315
324
|
<div className={isFullHeight ? 'flex flex-col flex-1 min-h-0 [&>*]:flex-1 [&>*]:flex [&>*]:flex-col [&>*]:min-h-0' : ''}>
|
|
316
325
|
<Suspense fallback={<div className="flex items-center justify-center p-12 text-fg-48">Loading…</div>}>
|
|
317
326
|
<Outlet />
|
|
@@ -426,6 +435,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
|
|
|
426
435
|
)}
|
|
427
436
|
</div>
|
|
428
437
|
</ShellTocCollapsedContext.Provider>
|
|
438
|
+
</ShellContentWidthContext.Provider>
|
|
429
439
|
</ShellFullHeightContext.Provider>
|
|
430
440
|
</ShellTocContext.Provider>
|
|
431
441
|
)
|
package/src/shell/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* against.
|
|
8
8
|
*/
|
|
9
9
|
export { default as ShellLayout } from './ShellLayout.jsx'
|
|
10
|
-
export { ShellTocContext, ShellFullHeightContext, ShellTocCollapsedContext } from './ShellLayout.jsx'
|
|
10
|
+
export { ShellTocContext, ShellFullHeightContext, ShellTocCollapsedContext, ShellContentWidthContext } from './ShellLayout.jsx'
|
|
11
11
|
export { default as ShellSidebar } from './ShellSidebar.jsx'
|
|
12
12
|
/* RailSection — THE rail ladder. Every rail header at every rung comes from
|
|
13
13
|
* here, in both rails; see the file header for why a class alone was not
|