@kolkrabbi/kol-workshop 0.41.2 → 0.42.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.41.2",
3
+ "version": "0.42.0",
4
4
  "private": false,
5
5
  "description": "Docs viewer, shell and tag system",
6
6
  "license": "MIT",
@@ -14,12 +14,13 @@
14
14
  "dependencies": {
15
15
  "d3": "^7.9.0",
16
16
  "@kolkrabbi/kol-brand": "^0.2.0",
17
- "@kolkrabbi/kol-markdown": "^0.2.0",
18
- "@kolkrabbi/kol-search": "^0.3.0"
17
+ "@kolkrabbi/kol-search": "^0.3.0",
18
+ "@kolkrabbi/kol-markdown": "^0.2.0"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "@kolkrabbi/kol-component": ">=0.296.0",
22
- "@kolkrabbi/kol-framework": ">=0.45.0",
22
+ "@kolkrabbi/kol-framework": ">=0.63.0",
23
+ "@kolkrabbi/kol-shell": ">=0.89.0",
23
24
  "@kolkrabbi/kol-theme": ">=0.165.0",
24
25
  "@kolkrabbi/kol-icons": ">=0.18.0",
25
26
  "gsap": "^3.13.0",
@@ -28,10 +29,11 @@
28
29
  "react-router-dom": "^6.0.0 || ^7.0.0"
29
30
  },
30
31
  "devDependencies": {
31
- "@kolkrabbi/kol-component": "^0.311.2",
32
+ "@kolkrabbi/kol-component": "^0.314.0",
32
33
  "@kolkrabbi/kol-icons": "^0.52.0",
33
- "@kolkrabbi/kol-framework": "^0.62.2",
34
- "@kolkrabbi/kol-theme": "^0.196.0"
34
+ "@kolkrabbi/kol-shell": "^0.89.0",
35
+ "@kolkrabbi/kol-theme": "^0.197.0",
36
+ "@kolkrabbi/kol-framework": "^0.63.0"
35
37
  },
36
38
  "files": [
37
39
  "src",
@@ -2,7 +2,8 @@ import { createContext, useContext, useMemo, useRef, useState, useEffect, Suspen
2
2
  import { Outlet, Link, useLocation, useNavigate, useNavigationType } from 'react-router-dom'
3
3
  import { ShellHeader } from '@kolkrabbi/kol-framework'
4
4
  import ShellSidebar, { RAIL_FOLD_EVENT, ShellRailModeContext } from './ShellSidebar.jsx'
5
- import { FullscreenOverlay, IconFrame, Rail, CommandOverlay, ShortcutsOverlay, SettingsPanel, SettingsSections, SettingsSwitch, Tooltip, useDragResize } from '@kolkrabbi/kol-component'
5
+ import { FullscreenOverlay, IconFrame, Rail, CommandOverlay, Tooltip, useDragResize, useScrollFade } from '@kolkrabbi/kol-component'
6
+ import { HubSettingsRail } from '@kolkrabbi/kol-shell'
6
7
  import { createIndex, search } from '@kolkrabbi/kol-search'
7
8
  import { useTagMode } from '../tags/TagModeContext.jsx'
8
9
  import TagModeOverlay from '../tags/TagModeOverlay.jsx'
@@ -123,7 +124,7 @@ export function ShellNavColumn({ mode = 'open', children, grip, railRef }) {
123
124
  <aside
124
125
  ref={railRef}
125
126
  aria-label="Navigation"
126
- className={`shell-rail shell-rail--nav shell-sidebar-sticky hidden lg:block pt-6 md:pt-6 lg:pt-8 pb-14 ${icons ? `shell-rail--icons ${peek ? 'is-peek' : ''}` : ''}`.trim()}
127
+ className={`shell-rail shell-rail--nav kol-scroll-fade shell-sidebar-sticky hidden lg:block pt-6 md:pt-6 lg:pt-8 pb-14 ${icons ? `shell-rail--icons ${peek ? 'is-peek' : ''}` : ''}`.trim()}
127
128
  onMouseEnter={icons ? () => setPeek(true) : undefined}
128
129
  onMouseLeave={icons ? () => setPeek(false) : undefined}
129
130
  >
@@ -169,7 +170,7 @@ const MainColumn = ({ children, fullHeight, width = 'canvas', padStart, padEnd }
169
170
  * below). The breakpoint here and the one in gridCols are one decision and
170
171
  * must not be stated twice differently. */
171
172
  const TocColumn = ({ children, grip, railRef }) => (
172
- <aside ref={railRef} aria-label="Table of contents" className="shell-rail shell-rail--toc shell-sidebar-sticky hidden xl:block pt-6 md:pt-6 lg:pt-8 pb-14">
173
+ <aside ref={railRef} aria-label="Table of contents" className="shell-rail shell-rail--toc kol-scroll-fade shell-sidebar-sticky hidden xl:block pt-6 md:pt-6 lg:pt-8 pb-14">
173
174
  {grip}
174
175
  {/* The width is the grid track (--kol-shell-toc-w). An empty rail still
175
176
  * holds its column (user ruling 2026-08-01): a rail that disappears
@@ -203,7 +204,9 @@ const toSearchItem = (item, i) => ({
203
204
  * shared results page (kol-workshop `SearchPage`). Omitted,
204
205
  * Enter keeps the older behaviour: the tag browser in place.
205
206
  * @param {Array} [settings] extra settings sections (`SettingsSections` shape) the
206
- * consumer adds to the shell's settings drawer
207
+ * consumer adds to the Settings tab of the hub's rail
208
+ * @param {Object} [app] `{ name, about, links, docs }` — the rail's About and Docs tabs, as on AppHub
209
+ * (WorkshopSettingsRailAndBars, 2026-10-29)
207
210
  * @param {string|Function} [brandLabel] a TYPED label in the second wordmark slot instead of
208
211
  * the drawn WORKSHOP mark — a string, or `({ activeRoute }) => string`
209
212
  * so it names the space you are in
@@ -214,10 +217,17 @@ const toSearchItem = (item, i) => ({
214
217
  * 2026-10-02): every `ShellSidebar` reads it by itself, so `mode`
215
218
  * is only for what else the consumer puts in the rail
216
219
  */
217
- const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoSrc, brandLogoAlt = '', renderSidebar, searchItems, searchPath, settings = [], brandLabel, defaultTocContent, isActive: isActiveProp, actions, shortcuts = [] }) => {
220
+ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoSrc, brandLogoAlt = '', renderSidebar, searchItems, searchPath, settings = [], app, brandLabel, defaultTocContent, isActive: isActiveProp, actions, shortcuts = [] }) => {
218
221
  const [isNavDrawerOpen, setIsNavDrawerOpen] = useState(false)
219
222
  const [prefs, setPrefs] = useState(readSettings)
220
- const setPref = (key, value) => setPrefs((p) => { const next = { ...p, [key]: value }; writeSettings(next); return next })
223
+ /* the store is the truth — the rail keys write it directly, so a pref merges onto what is stored, never onto a stale copy */
224
+ const setPref = (key, value) => setPrefs(() => { const next = { ...readSettings(), [key]: value }; writeSettings(next); return next })
225
+ /* THE TWO BARS (WorkshopSettingsRailAndBars, kol-hq 2026-10-29 — user: *"we need ways to show hide these both and
226
+ * individually"*, keys *"< top, > tabs, | both"*): persisted like navHidden / tocHidden; a hidden bar is not drawn, so
227
+ * the scroll region below it takes its height */
228
+ const topHidden = prefs.topHidden === true
229
+ const tabsHidden = prefs.tabsHidden === true
230
+ const setBars = (patch) => setPrefs(() => { const next = { ...readSettings(), ...patch }; writeSettings(next); return next })
221
231
  const [navCollapsed, setNavCollapsed] = useState(() => readSettings().navHidden === true)
222
232
  /* the left rail's third state — a strip of icons that opens on hover (see ShellNavColumn) */
223
233
  const navIcons = prefs.navIcons === true
@@ -225,6 +235,9 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
225
235
  const [tocCollapsed, setTocCollapsed] = useState(() => readSettings().tocHidden === true)
226
236
  const navGrab = useRailGrab('kol-shell-nav', 'left', () => { setNavCollapsed(true); writeSettings({ ...readSettings(), navHidden: true }) })
227
237
  const tocGrab = useRailGrab('kol-shell-toc', 'right', () => { setTocCollapsed(true); writeSettings({ ...readSettings(), tocHidden: true }) })
238
+ /* both rails fade where they clip — the head once scrolled, the foot while more lies below (kol-theme `.kol-scroll-fade`) */
239
+ useScrollFade(navGrab.ref)
240
+ useScrollFade(tocGrab.ref)
228
241
  const [isSettingsOpen, setIsSettingsOpen] = useState(false)
229
242
  /* ONE QUERY (user ruling 2026-08-01). The search modal's text used to live here
230
243
  * while tags lived in TagModeContext — two states, and therefore two
@@ -300,11 +313,11 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
300
313
  // eslint-disable-next-line react-hooks/exhaustive-deps
301
314
  }, [location.pathname, location.hash, location.key])
302
315
 
303
- /* THE shortcut map. One list, rendered by the `S` sheet AND bound by the
304
- * handler below — a shortcut that isn't in this array doesn't exist, so the
305
- * sheet can never drift from the bindings. The sheet is kol-component's
306
- * ShortcutsOverlay (2026-09-28): the same sheet, on the same key, as every
307
- * app — it was a `?` sheet of its own here. `?` still opens it. */
316
+ /* THE shortcut map. One list, rendered by the `S` modal, the rail's Shortcuts
317
+ * tab AND bound by the handler below — a shortcut that isn't in this array
318
+ * doesn't exist, so neither can drift from the bindings. The modal is AppHub's
319
+ * (`CommandOverlay mode="shortcuts"`, WorkshopSettingsRailAndBars 2026-10-29) —
320
+ * it was ShortcutsOverlay's flat sheet here. `?` still opens it. */
308
321
  /* FEWEST WORDS (the showcase review W16, 2026-09-30 — user: "shortcuts overlay, too wordy"):
309
322
  * a label names the thing the key does, nothing more. `\\` hides or shows both rails at once. */
310
323
  const SHORTCUTS = [
@@ -318,6 +331,9 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
318
331
  { id: 'nav', label: 'Left rail', combo: '[' },
319
332
  { id: 'toc', label: 'Right rail', combo: ']' },
320
333
  { id: 'rails', label: 'Both rails', combo: '\\' },
334
+ { id: 'top', label: 'Top bar', combo: '<' },
335
+ { id: 'tabs', label: 'Tab bar', combo: '>' },
336
+ { id: 'bars', label: 'Both bars', combo: '|' },
321
337
  { id: 'fold', label: 'Fold / expand all', combo: 'C' },
322
338
  { id: 'tree', label: 'Whole tree', combo: 'T' },
323
339
  { id: 'esc', label: 'Close', combo: 'Esc' },
@@ -364,6 +380,18 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
364
380
  setNavCollapsed(hide)
365
381
  setTocCollapsed(hide)
366
382
  writeSettings({ ...s, navHidden: hide, tocHidden: hide })
383
+ } else if (e.key === '<') {
384
+ e.preventDefault()
385
+ setBars({ topHidden: readSettings().topHidden !== true })
386
+ } else if (e.key === '>') {
387
+ e.preventDefault()
388
+ setBars({ tabsHidden: readSettings().tabsHidden !== true })
389
+ } else if (e.key === '|') {
390
+ /* BOTH BARS, as `\\` does the rails: any bar showing → hide both; both hidden → show both */
391
+ e.preventDefault()
392
+ const s = readSettings()
393
+ const hide = !(s.topHidden && s.tabsHidden)
394
+ setBars({ topHidden: hide, tabsHidden: hide })
367
395
  } else if (e.key === 'c' || e.key === 'C') {
368
396
  e.preventDefault()
369
397
  foldedRef.current = !foldedRef.current
@@ -517,21 +545,27 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
517
545
  navigate(q ? `${searchPath}?q=${encodeURIComponent(q)}` : searchPath)
518
546
  }
519
547
 
548
+ /* typed rows, the rail's shape (`type: 'switch'`) — the consumer's `settings` follow; the keys are the Shortcuts tab */
520
549
  const settingsSections = [
521
550
  { label: 'Layout', rows: [
522
- { id: 'nav', label: 'Left rail', render: () => <SettingsSwitch on={!navCollapsed} onChange={(on) => { setNavCollapsed(!on); setPref('navHidden', !on) }} /> },
523
- { id: 'nav-icons', label: 'Icons only', render: () => <SettingsSwitch on={navIcons} onChange={(on) => setPref('navIcons', on)} /> },
524
- { id: 'toc', label: 'Right rail', render: () => <SettingsSwitch on={!tocCollapsed} onChange={(on) => { setTocCollapsed(!on); setPref('tocHidden', !on) }} /> },
551
+ { id: 'top', label: 'Top bar', type: 'switch', on: !topHidden, onChange: (on) => setBars({ topHidden: !on }) },
552
+ { id: 'tabs', label: 'Tab bar', type: 'switch', on: !tabsHidden, onChange: (on) => setBars({ tabsHidden: !on }) },
553
+ { id: 'nav', label: 'Left rail', type: 'switch', on: !navCollapsed, onChange: (on) => { setNavCollapsed(!on); setPref('navHidden', !on) } },
554
+ { id: 'nav-icons', label: 'Icons only', type: 'switch', on: navIcons, onChange: (on) => setPref('navIcons', on) },
555
+ { id: 'toc', label: 'Right rail', type: 'switch', on: !tocCollapsed, onChange: (on) => { setTocCollapsed(!on); setPref('tocHidden', !on) } },
525
556
  ] },
526
557
  { label: 'Search', rows: [
527
- { id: 'scope', label: 'This space only', render: () => <SettingsSwitch on={!!prefs.limitToSpace} onChange={(on) => setPref('limitToSpace', on)} /> },
558
+ { id: 'scope', label: 'This space only', type: 'switch', on: !!prefs.limitToSpace, onChange: (on) => setPref('limitToSpace', on) },
528
559
  ] },
529
560
  ...settings,
530
- { label: 'Keys', rowGap: 1, rows: SHORTCUTS.flatMap((sec) => sec.items).map((k) => ({
531
- id: `key-${k.id}`, label: k.label, labelWidth: 'auto', align: 'fill',
532
- value: <span className="kol-helper-12 text-fg-48 whitespace-nowrap">{k.combo}</span>,
533
- })) },
534
561
  ]
562
+ /* the rail's reset: the theme (the rail's own), then the shell's settings back to their defaults */
563
+ const resetSettings = () => {
564
+ writeSettings({})
565
+ setPrefs({})
566
+ setNavCollapsed(false)
567
+ setTocCollapsed(false)
568
+ }
535
569
 
536
570
  return (
537
571
  <ShellPageMetaContext.Provider value={{ meta: pageMeta, setMeta: setPageMeta }}>
@@ -564,6 +598,8 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
564
598
  onTocToggle={hasToc ? () => setTocCollapsed((p) => !p) : null}
565
599
  navCollapsed={navCollapsed}
566
600
  tocCollapsed={tocCollapsed}
601
+ hideTop={topHidden}
602
+ hideTabs={tabsHidden}
567
603
  />
568
604
 
569
605
  {/* ONE scroll region, edge to edge (see SHELL_SCROLL_ROOT). The chrome
@@ -660,7 +696,8 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
660
696
  {tagMode.isProvided && tagMode.expanded ? <TagModeOverlay /> : null}
661
697
  </CommandOverlay>
662
698
 
663
- {isShortcutsOpen && <ShortcutsOverlay shortcuts={SHORTCUTS} onClose={() => setIsShortcutsOpen(false)} />}
699
+ {/* `S` — AppHub's shortcuts modal: the ⌘K overlay with no field, the map's sections as open folds */}
700
+ <CommandOverlay open={isShortcutsOpen} mode="shortcuts" shortcuts={SHORTCUTS} currentPath={location.pathname} onClose={() => setIsShortcutsOpen(false)} />
664
701
 
665
702
  {/* THE WHOLE TREE, FROM ANY PAGE (`T`, 2026-10-02): every space's rail side by side, every
666
703
  * fold open, over the page like the search modal. Each column is the consumer's own rail
@@ -681,16 +718,18 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
681
718
  </div>
682
719
  </FullscreenOverlay>
683
720
 
684
- {/* THE SHELL'S SETTINGS (2026-09-28, user: "might we also want to utilize a
685
- * settings page or settings sidebar … to offload some functional
686
- * settings, search settings, sidenav settings"). A right drawer over
687
- * the page, the same rows the apps' settings use (SettingsSections). */}
688
- {/* THE APPROVED DRAWER (2026-09-30): kol-component's `SettingsPanel` — the composition locked
689
- * 2026-08-27 that media's Display settings and Trash already wear: title header, divided
690
- * sections. This was a hand-built ShellDrawer + eyebrow + undivided sections. */}
691
- <SettingsPanel open={isSettingsOpen} variant="rail" title="Settings" onClose={() => setIsSettingsOpen(false)}>
692
- <SettingsSections sections={settingsSections} divided />
693
- </SettingsPanel>
721
+ {/* THE SHELL'S SETTINGS ARE THE HUB'S RAIL (WorkshopSettingsRailAndBars, kol-hq 2026-10-29 — user: *"studio-hub
722
+ * settings have tabs … this should be implemented on workshop as well"*): kol-shell's HubSettingsRail, the one
723
+ * AppHub opens — Settings · Shortcuts · About · Docs, the theme toggle and reset in the footer. It was
724
+ * kol-component's SettingsPanel with a Keys section of its own. */}
725
+ <HubSettingsRail
726
+ open={isSettingsOpen}
727
+ onClose={() => setIsSettingsOpen(false)}
728
+ sections={settingsSections}
729
+ app={app}
730
+ shortcuts={SHORTCUTS}
731
+ onReset={resetSettings}
732
+ />
694
733
  </div>
695
734
  </ShellNavCollapsedContext.Provider>
696
735
  </ShellTocCollapsedContext.Provider>