@kolkrabbi/kol-workshop 0.23.0 → 0.24.1

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-workshop",
3
- "version": "0.23.0",
3
+ "version": "0.24.1",
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",
@@ -25,10 +25,10 @@
25
25
  "react-router-dom": "^6.0.0 || ^7.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@kolkrabbi/kol-component": "^0.68.1",
29
28
  "@kolkrabbi/kol-icons": "^0.18.0",
30
- "@kolkrabbi/kol-framework": "^0.23.0",
31
- "@kolkrabbi/kol-theme": "^0.51.0"
29
+ "@kolkrabbi/kol-component": "^0.68.1",
30
+ "@kolkrabbi/kol-framework": "^0.24.0",
31
+ "@kolkrabbi/kol-theme": "^0.52.1"
32
32
  },
33
33
  "files": [
34
34
  "src",
@@ -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,42 +46,39 @@ const NavColumn = ({ children }) => (
33
46
  </aside>
34
47
  )
35
48
 
36
- const MainColumn = ({ children, fullHeight }) => (
49
+ const MainColumn = ({ children, fullHeight, width = 'canvas' }) => {
50
+ /* the map lives INSIDE MainColumn on purpose — validate:width W1 reads the
51
+ * cap off this block and refuses a --kol-content-* cap anywhere else */
52
+ const cap = {
53
+ canvas: 'w-full max-w-[var(--kol-content-canvas)]',
54
+ shell: 'w-full mx-auto max-w-[var(--kol-content-shell)]',
55
+ none: 'w-full',
56
+ }[width] ?? 'w-full max-w-[var(--kol-content-canvas)]'
57
+ return (
37
58
  <main
38
59
  id="main"
39
60
  className={`w-full min-w-0 h-full min-h-0 ${fullHeight ? 'overflow-hidden flex flex-col' : 'overflow-y-auto overscroll-none'}`}
40
61
  style={fullHeight ? undefined : { scrollbarGutter: 'stable' }}
41
62
  >
42
- {/* THE cap lives HERE (2026-07-31), on the CONTENT — not on the grid that
43
- * holds the rails. The theme's law is written about a page ("content
44
- * LEFT-ANCHORED inside"), and the rails are chrome, not page. Capping the
45
- * grid centred all three columns and pulled both rails inward off the
46
- * viewport edge; the rails now sit flush at the chrome inset and only the
47
- * main column carries a cap.
48
- *
49
- * It caps at CANVAS, not shell (user ruling 2026-07-31). Shell is the
50
- * frame token and the middle grid track can never reach it — after both
51
- * rails, gutters and inset there is ~1516 of room at a 2200 window — so a
52
- * shell cap here was real code that could never fire, and every page just
53
- * inherited whatever the window gave it. Canvas is the rung that binds.
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. */}
63
+ {/* The cap lives HERE, on the CONTENT — not on the grid that holds the
64
+ * rails (2026-07-31: capping the grid centred all three columns and pulled
65
+ * both rails off the viewport edge). WHICH cap is the page's call — see
66
+ * ShellContentWidthContext. The default is canvas, left against the nav:
67
+ * that was a call made for doc pages (2026-07-31 / 2026-08-01, narrow
68
+ * content keeping a constant gap to the rail) and it was written here as
69
+ * a law for every page — the home page's centred hero then centred on the
70
+ * cap instead of the track, so closing the TOC moved nothing and closing
71
+ * the nav moved everything. It is a default now, not a rule. Canvas stays
72
+ * left-anchored (never mx-auto — W4); shell is the frame rung and centres;
73
+ * none spans the track. `fullHeight` stays uncapped — it IS the
74
+ * fill-the-viewport escape hatch (iframe embeds). */}
66
75
  {fullHeight
67
76
  ? children
68
- : <div className="w-full max-w-[var(--kol-content-canvas)] pt-6 md:pt-6 lg:pt-8 pb-16">{children}</div>
77
+ : <div className={`${cap} pt-6 md:pt-6 lg:pt-8 pb-16`}>{children}</div>
69
78
  }
70
79
  </main>
71
- )
80
+ )
81
+ }
72
82
 
73
83
  /* `xl`, not `lg` — the grid only declares a third column at xl (gridCols
74
84
  * below). Rendering this at lg put THREE children in a TWO-column grid between
@@ -109,6 +119,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
109
119
  : setLocalOpen
110
120
  const [tocContent, setTocContent] = useState(null)
111
121
  const [isFullHeight, setIsFullHeight] = useState(false)
122
+ const [contentWidth, setContentWidth] = useState('canvas')
112
123
  const [isShortcutsOpen, setIsShortcutsOpen] = useState(false)
113
124
  const location = useLocation()
114
125
  const navigate = useNavigate()
@@ -250,6 +261,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
250
261
  return (
251
262
  <ShellTocContext.Provider value={setTocContent}>
252
263
  <ShellFullHeightContext.Provider value={setIsFullHeight}>
264
+ <ShellContentWidthContext.Provider value={setContentWidth}>
253
265
  <ShellTocCollapsedContext.Provider value={setTocCollapsed}>
254
266
  <div className="fixed inset-0 flex flex-col bg-surface-primary text-auto">
255
267
  <ShellHeader
@@ -311,7 +323,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
311
323
  </NavColumn>
312
324
  )}
313
325
 
314
- <MainColumn fullHeight={isFullHeight}>
326
+ <MainColumn fullHeight={isFullHeight} width={contentWidth}>
315
327
  <div className={isFullHeight ? 'flex flex-col flex-1 min-h-0 [&>*]:flex-1 [&>*]:flex [&>*]:flex-col [&>*]:min-h-0' : ''}>
316
328
  <Suspense fallback={<div className="flex items-center justify-center p-12 text-fg-48">Loading…</div>}>
317
329
  <Outlet />
@@ -426,6 +438,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
426
438
  )}
427
439
  </div>
428
440
  </ShellTocCollapsedContext.Provider>
441
+ </ShellContentWidthContext.Provider>
429
442
  </ShellFullHeightContext.Provider>
430
443
  </ShellTocContext.Provider>
431
444
  )
@@ -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