@kolkrabbi/kol-workshop 0.42.0 → 0.43.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-workshop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Docs viewer, shell and tag system",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"d3": "^7.9.0",
|
|
16
16
|
"@kolkrabbi/kol-brand": "^0.2.0",
|
|
17
|
-
"@kolkrabbi/kol-
|
|
18
|
-
"@kolkrabbi/kol-
|
|
17
|
+
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
18
|
+
"@kolkrabbi/kol-search": "^0.3.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@kolkrabbi/kol-component": ">=0.296.0",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"react-router-dom": "^6.0.0 || ^7.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@kolkrabbi/kol-
|
|
32
|
+
"@kolkrabbi/kol-framework": "^0.64.0",
|
|
33
33
|
"@kolkrabbi/kol-icons": "^0.52.0",
|
|
34
|
-
"@kolkrabbi/kol-
|
|
35
|
-
"@kolkrabbi/kol-theme": "^0.
|
|
36
|
-
"@kolkrabbi/kol-
|
|
34
|
+
"@kolkrabbi/kol-component": "^0.316.0",
|
|
35
|
+
"@kolkrabbi/kol-theme": "^0.199.0",
|
|
36
|
+
"@kolkrabbi/kol-shell": "^0.89.1"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"src",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext, useEffect, useMemo, useState } from 'react'
|
|
1
|
+
import { Fragment, 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
4
|
import { ShellTocContext, RightRail, SHELL_SCROLL_ROOT } from '../shell/index.js'
|
|
@@ -82,6 +82,10 @@ const DocReaderSidebar = ({ toc, allTags, related, docId, docsIndexHref, compone
|
|
|
82
82
|
* @param {node} [props.actions] the page's own actions (a button to the live app),
|
|
83
83
|
* rendered under the title and before the intro; absent,
|
|
84
84
|
* nothing (2026-10-05, kol-website /workshop)
|
|
85
|
+
* @param {Object} [props.blocks] a consumer's own drawing for a block type — `{ [type]: (block, ctx) => node | null }`,
|
|
86
|
+
* `ctx` `{ docId, file, metadata, key }`. Asked first; a missing entry or `null` falls
|
|
87
|
+
* through to the reader's own (ReaderBlockRenderers, kol-hq 2026-10-29 — a ref card's
|
|
88
|
+
* keys table drawn as keycaps). The views are the consumer's; the reader adds none
|
|
85
89
|
*/
|
|
86
90
|
const DocumentationReader = ({
|
|
87
91
|
inventory = [],
|
|
@@ -92,6 +96,7 @@ const DocumentationReader = ({
|
|
|
92
96
|
showFrontmatter = true,
|
|
93
97
|
fields,
|
|
94
98
|
actions,
|
|
99
|
+
blocks: blockRenderers,
|
|
95
100
|
/* false → render the article only and leave the right rail to the page (a HOME sits on top of
|
|
96
101
|
* a page whose sections the rail must list — 2026-09-30, "This page (0)" on every home) */
|
|
97
102
|
rail = true,
|
|
@@ -152,7 +157,12 @@ const DocumentationReader = ({
|
|
|
152
157
|
* prose-h4 precedent), panel-capped furniture (width law: tables/code cap
|
|
153
158
|
* at --kol-content-panel), markdown tables through THE kol-component Table
|
|
154
159
|
* as a dynamic-column DocTable sibling (no parallel table markup). */
|
|
160
|
+
/* the consumer's renderer first (`blocks`), the reader's own when it has none or returns null */
|
|
155
161
|
const renderBlock = (block, blockKey) => {
|
|
162
|
+
const own = blockRenderers?.[block.type]?.(block, { docId, file: doc?.file, metadata: doc?.metadata, key: blockKey })
|
|
163
|
+
return own != null ? <Fragment key={blockKey}>{own}</Fragment> : renderOwnBlock(block, blockKey)
|
|
164
|
+
}
|
|
165
|
+
const renderOwnBlock = (block, blockKey) => {
|
|
156
166
|
switch (block.type) {
|
|
157
167
|
case 'paragraph':
|
|
158
168
|
return (
|