@kolkrabbi/kol-workshop 0.47.0 → 0.49.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
CHANGED
|
@@ -28,7 +28,7 @@ Two entry points:
|
|
|
28
28
|
| `DocumentationReader` | the docs viewer — renders one doc from the inventory (article + header + frontmatter + token render) |
|
|
29
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
|
-
| `WorkshopRail`, `
|
|
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.49.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Docs viewer, shell and tag system",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@kolkrabbi/kol-brand": "^0.2.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@kolkrabbi/kol-component": ">=0.
|
|
21
|
+
"@kolkrabbi/kol-component": ">=0.396.0",
|
|
22
22
|
"@kolkrabbi/kol-framework": ">=0.63.0",
|
|
23
23
|
"@kolkrabbi/kol-shell": ">=0.89.0",
|
|
24
24
|
"@kolkrabbi/kol-theme": ">=0.165.0",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"react-router-dom": "^6.0.0 || ^7.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@kolkrabbi/kol-
|
|
33
|
-
"@kolkrabbi/kol-
|
|
34
|
-
"@kolkrabbi/kol-
|
|
35
|
-
"@kolkrabbi/kol-
|
|
36
|
-
"@kolkrabbi/kol-
|
|
32
|
+
"@kolkrabbi/kol-component": "^0.397.0",
|
|
33
|
+
"@kolkrabbi/kol-icons": "^0.75.0",
|
|
34
|
+
"@kolkrabbi/kol-theme": "^0.242.0",
|
|
35
|
+
"@kolkrabbi/kol-framework": "^0.74.1",
|
|
36
|
+
"@kolkrabbi/kol-shell": "^0.138.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
|
|
@@ -7,4 +7,6 @@
|
|
|
7
7
|
export { default as WorkshopRail } from './WorkshopRail.jsx'
|
|
8
8
|
/** @deprecated WorkshopSidebar = WorkshopRail (2026-11-08, ITS RAIL) — alias for the 30-day ledger */
|
|
9
9
|
export { default as WorkshopSidebar } from './WorkshopRail.jsx'
|
|
10
|
-
export { default as
|
|
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'
|
|
@@ -149,7 +149,7 @@ export default function SearchPage({ items = [], spaces: allSpaces = [], facets
|
|
|
149
149
|
<div className="flex flex-wrap items-center gap-2">
|
|
150
150
|
<span className="kol-doc-eyebrow">Read as</span>
|
|
151
151
|
{tokens.map((t, i) => (
|
|
152
|
-
<Tag key={`${t.raw}-${i}`} hash={false} variant="secondary" onRemove={() => removeToken(t.raw)}
|
|
152
|
+
<Tag key={`${t.raw}-${i}`} hash={false} variant="secondary" onRemove={() => removeToken(t.raw)} removeLabel={`Remove ${t.raw}`}>{readToken(t)}</Tag>
|
|
153
153
|
))}
|
|
154
154
|
</div>
|
|
155
155
|
)}
|
|
@@ -216,6 +216,37 @@ const quickList = (ranked) => {
|
|
|
216
216
|
return out.slice(0, QUICK_MAX)
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
/* PAGES FIRST (his ruling 2026-11-20, plan W17.2: *"the pages have to be suggested before content within them"*): an item
|
|
220
|
+
* carrying `within` is something found inside a page (an icon), not a page. Every page is listed before any of it; what
|
|
221
|
+
* is inside pages follows, one heading per `within`, its best WITHIN_MAX rows, then one row to `withinHref?q=` (the full
|
|
222
|
+
* catalog, the typed word carried over). */
|
|
223
|
+
const WITHIN_MAX = 5
|
|
224
|
+
const toRow = ({ item, reasons, highlights }) => {
|
|
225
|
+
const titleHit = reasons.some((r) => r.field === 'title')
|
|
226
|
+
const first = reasons.find((r) => r.hit)
|
|
227
|
+
return {
|
|
228
|
+
id: item.id,
|
|
229
|
+
label: item.title,
|
|
230
|
+
group: item.within ?? item.category,
|
|
231
|
+
hint: titleHit ? item.hint : (first?.hit ?? item.description ?? item.hint),
|
|
232
|
+
href: item.href,
|
|
233
|
+
highlights: highlights.title,
|
|
234
|
+
/* `action` survives the reshape — a row may run a closure instead of going somewhere */
|
|
235
|
+
action: item.action,
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const quickRows = (ranked, q) => {
|
|
239
|
+
const inside = new Map()
|
|
240
|
+
ranked.forEach((r) => { if (r.item.within) inside.set(r.item.within, [...(inside.get(r.item.within) ?? []), r]) })
|
|
241
|
+
return [
|
|
242
|
+
...quickList(ranked.filter((r) => !r.item.within)).map(toRow),
|
|
243
|
+
...[...inside].flatMap(([within, hits]) => [
|
|
244
|
+
...hits.slice(0, WITHIN_MAX).map(toRow),
|
|
245
|
+
...(hits[0].item.withinHref ? [{ id: `within:${within}`, label: `All ${within.toLowerCase()} for “${q}”`, group: within, hint: `${hits.length}`, href: `${hits[0].item.withinHref}?q=${encodeURIComponent(q)}` }] : []),
|
|
246
|
+
]),
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
|
|
219
250
|
const toSearchItem = (item, i) => ({
|
|
220
251
|
...item,
|
|
221
252
|
id: item.id ?? item.href ?? `${item.label ?? item.title}-${i}`,
|
|
@@ -552,22 +583,17 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
|
|
|
552
583
|
* search to the spaces in view. */
|
|
553
584
|
const searchIndex = useMemo(() => createIndex((searchItems ?? []).map(toSearchItem)), [searchItems])
|
|
554
585
|
const quickScope = scopedIds ? { space: scopedIds } : {}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
/* `action` survives the reshape — a row may run a closure instead of going somewhere */
|
|
567
|
-
action: item.action,
|
|
568
|
-
}
|
|
569
|
-
})
|
|
570
|
-
: []
|
|
586
|
+
/* a word that names a facet is read as its filter (`icons` → kind icon), which would hide the pages titled with it:
|
|
587
|
+
* the same word as plain text finds them, and they lead (plan-2026-11-20 W17.2) */
|
|
588
|
+
const searchResults = searchQuery ? (() => {
|
|
589
|
+
const q = searchQuery.trim()
|
|
590
|
+
const ranked = search(searchIndex, searchQuery, { scope: quickScope }).results
|
|
591
|
+
const titled = /^[^-"#][^":]*$/.test(q)
|
|
592
|
+
? search(searchIndex, `"${q}"`, { scope: quickScope }).results.filter((r) => !r.item.within && r.reasons.some((x) => x.field === 'title'))
|
|
593
|
+
: []
|
|
594
|
+
const ids = new Set(titled.map((r) => r.item.id))
|
|
595
|
+
return quickRows([...titled, ...ranked.filter((r) => !ids.has(r.item.id))], q)
|
|
596
|
+
})() : []
|
|
571
597
|
const openResultsPage = () => {
|
|
572
598
|
const q = searchQuery.trim()
|
|
573
599
|
closeSearch()
|