@kolkrabbi/kol-workshop 0.2.0 → 0.3.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 +4 -4
- package/src/shell/ShellLayout.jsx +18 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-workshop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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,11 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"d3": "^7.9.0",
|
|
16
|
-
"@kolkrabbi/kol-component": "0.12.19",
|
|
17
16
|
"@kolkrabbi/kol-brand": "^0.1.2",
|
|
17
|
+
"@kolkrabbi/kol-framework": "0.6.4",
|
|
18
18
|
"@kolkrabbi/kol-icons": "0.8.10",
|
|
19
|
-
"@kolkrabbi/kol-
|
|
20
|
-
"@kolkrabbi/kol-theme": "0.12.
|
|
19
|
+
"@kolkrabbi/kol-component": "0.13.1",
|
|
20
|
+
"@kolkrabbi/kol-theme": "0.12.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": "^18.3.0 || ^19.0.0",
|
|
@@ -46,7 +46,7 @@ const TocColumn = ({ children }) => (
|
|
|
46
46
|
</aside>
|
|
47
47
|
)
|
|
48
48
|
|
|
49
|
-
const ShellLayout = ({ routes = [], basePath = '/', brandLogoSrc, brandLogoAlt = '', renderSidebar, searchItems, defaultTocContent }) => {
|
|
49
|
+
const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoSrc, brandLogoAlt = '', renderSidebar, searchItems, defaultTocContent, isActive: isActiveProp, actions }) => {
|
|
50
50
|
const [isNavDrawerOpen, setIsNavDrawerOpen] = useState(false)
|
|
51
51
|
const [navCollapsed, setNavCollapsed] = useState(false)
|
|
52
52
|
const [tocCollapsed, setTocCollapsed] = useState(false)
|
|
@@ -94,14 +94,20 @@ const ShellLayout = ({ routes = [], basePath = '/', brandLogoSrc, brandLogoAlt =
|
|
|
94
94
|
href: r.path ? joinPath(r.path) : basePath,
|
|
95
95
|
icon: r.icon,
|
|
96
96
|
}))
|
|
97
|
-
|
|
97
|
+
/* Prefix matching is the default, but a consumer can override it: a tab whose
|
|
98
|
+
* href targets a CHILD page (Docs → /docs/shell-and-layout) must still light
|
|
99
|
+
* up across the whole /docs prefix, which self-matching can't express. */
|
|
100
|
+
const isActive = isActiveProp ?? ((href) => location.pathname === href || location.pathname.startsWith(`${href}/`))
|
|
98
101
|
const handleNavigate = (event, item) => {
|
|
99
102
|
if (item.href) {
|
|
100
103
|
event.preventDefault()
|
|
101
104
|
navigate(item.href)
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
|
-
|
|
107
|
+
/* `brand` takes any node — a consumer that isn't the workshop needs its own
|
|
108
|
+
* wordmark, and brandLogoSrc only ever accepted an <img>. Falls back to the
|
|
109
|
+
* logo-src form, then to the KOLKRABBI + WORKSHOP pair. */
|
|
110
|
+
const brand = brandProp ?? (brandLogoSrc ? (
|
|
105
111
|
<Link to={basePath} className="shell-header-logo flex items-center text-emphasis">
|
|
106
112
|
<img src={brandLogoSrc} alt={brandLogoAlt} className="h-6 w-auto" />
|
|
107
113
|
</Link>
|
|
@@ -117,11 +123,16 @@ const ShellLayout = ({ routes = [], basePath = '/', brandLogoSrc, brandLogoAlt =
|
|
|
117
123
|
<Asset name="wordmark-workshop" title="Workshop" className="inline-flex [&>svg]:h-6 [&>svg]:w-auto" />
|
|
118
124
|
</Link>
|
|
119
125
|
</>
|
|
120
|
-
)
|
|
126
|
+
))
|
|
127
|
+
/* Consumer `actions` sit BEFORE the search trigger in row 1 — a showcase
|
|
128
|
+
* needs its own controls (repo link, etc.) beside the shell's. */
|
|
121
129
|
const searchTrigger = (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
<>
|
|
131
|
+
{actions}
|
|
132
|
+
<Tooltip label="Search">
|
|
133
|
+
<Button variant="ghost" quiet iconOnly="search" iconSize={18} onClick={() => setIsSearchOpen(true)} aria-label="Search" />
|
|
134
|
+
</Tooltip>
|
|
135
|
+
</>
|
|
125
136
|
)
|
|
126
137
|
|
|
127
138
|
/* searchItems ({ id, label, href, sectionLabel?, tags?, headings?, keywords? })
|