@kolkrabbi/kol-workshop 0.41.3 → 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.3",
3
+ "version": "0.42.0",
4
4
  "private": false,
5
5
  "description": "Docs viewer, shell and tag system",
6
6
  "license": "MIT",
@@ -13,13 +13,14 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "d3": "^7.9.0",
16
- "@kolkrabbi/kol-markdown": "^0.2.0",
17
16
  "@kolkrabbi/kol-brand": "^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",
@@ -30,8 +31,9 @@
30
31
  "devDependencies": {
31
32
  "@kolkrabbi/kol-component": "^0.314.0",
32
33
  "@kolkrabbi/kol-icons": "^0.52.0",
33
- "@kolkrabbi/kol-framework": "^0.62.5",
34
- "@kolkrabbi/kol-theme": "^0.197.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, useScrollFade } 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'
@@ -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
@@ -303,11 +313,11 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
303
313
  // eslint-disable-next-line react-hooks/exhaustive-deps
304
314
  }, [location.pathname, location.hash, location.key])
305
315
 
306
- /* THE shortcut map. One list, rendered by the `S` sheet AND bound by the
307
- * handler below — a shortcut that isn't in this array doesn't exist, so the
308
- * sheet can never drift from the bindings. The sheet is kol-component's
309
- * ShortcutsOverlay (2026-09-28): the same sheet, on the same key, as every
310
- * 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. */
311
321
  /* FEWEST WORDS (the showcase review W16, 2026-09-30 — user: "shortcuts overlay, too wordy"):
312
322
  * a label names the thing the key does, nothing more. `\\` hides or shows both rails at once. */
313
323
  const SHORTCUTS = [
@@ -321,6 +331,9 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
321
331
  { id: 'nav', label: 'Left rail', combo: '[' },
322
332
  { id: 'toc', label: 'Right rail', combo: ']' },
323
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: '|' },
324
337
  { id: 'fold', label: 'Fold / expand all', combo: 'C' },
325
338
  { id: 'tree', label: 'Whole tree', combo: 'T' },
326
339
  { id: 'esc', label: 'Close', combo: 'Esc' },
@@ -367,6 +380,18 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
367
380
  setNavCollapsed(hide)
368
381
  setTocCollapsed(hide)
369
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 })
370
395
  } else if (e.key === 'c' || e.key === 'C') {
371
396
  e.preventDefault()
372
397
  foldedRef.current = !foldedRef.current
@@ -520,21 +545,27 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
520
545
  navigate(q ? `${searchPath}?q=${encodeURIComponent(q)}` : searchPath)
521
546
  }
522
547
 
548
+ /* typed rows, the rail's shape (`type: 'switch'`) — the consumer's `settings` follow; the keys are the Shortcuts tab */
523
549
  const settingsSections = [
524
550
  { label: 'Layout', rows: [
525
- { id: 'nav', label: 'Left rail', render: () => <SettingsSwitch on={!navCollapsed} onChange={(on) => { setNavCollapsed(!on); setPref('navHidden', !on) }} /> },
526
- { id: 'nav-icons', label: 'Icons only', render: () => <SettingsSwitch on={navIcons} onChange={(on) => setPref('navIcons', on)} /> },
527
- { 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) } },
528
556
  ] },
529
557
  { label: 'Search', rows: [
530
- { 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) },
531
559
  ] },
532
560
  ...settings,
533
- { label: 'Keys', rowGap: 1, rows: SHORTCUTS.flatMap((sec) => sec.items).map((k) => ({
534
- id: `key-${k.id}`, label: k.label, labelWidth: 'auto', align: 'fill',
535
- value: <span className="kol-helper-12 text-fg-48 whitespace-nowrap">{k.combo}</span>,
536
- })) },
537
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
+ }
538
569
 
539
570
  return (
540
571
  <ShellPageMetaContext.Provider value={{ meta: pageMeta, setMeta: setPageMeta }}>
@@ -567,6 +598,8 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
567
598
  onTocToggle={hasToc ? () => setTocCollapsed((p) => !p) : null}
568
599
  navCollapsed={navCollapsed}
569
600
  tocCollapsed={tocCollapsed}
601
+ hideTop={topHidden}
602
+ hideTabs={tabsHidden}
570
603
  />
571
604
 
572
605
  {/* ONE scroll region, edge to edge (see SHELL_SCROLL_ROOT). The chrome
@@ -663,7 +696,8 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
663
696
  {tagMode.isProvided && tagMode.expanded ? <TagModeOverlay /> : null}
664
697
  </CommandOverlay>
665
698
 
666
- {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)} />
667
701
 
668
702
  {/* THE WHOLE TREE, FROM ANY PAGE (`T`, 2026-10-02): every space's rail side by side, every
669
703
  * fold open, over the page like the search modal. Each column is the consumer's own rail
@@ -684,16 +718,18 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
684
718
  </div>
685
719
  </FullscreenOverlay>
686
720
 
687
- {/* THE SHELL'S SETTINGS (2026-09-28, user: "might we also want to utilize a
688
- * settings page or settings sidebar … to offload some functional
689
- * settings, search settings, sidenav settings"). A right drawer over
690
- * the page, the same rows the apps' settings use (SettingsSections). */}
691
- {/* THE APPROVED DRAWER (2026-09-30): kol-component's `SettingsPanel` — the composition locked
692
- * 2026-08-27 that media's Display settings and Trash already wear: title header, divided
693
- * sections. This was a hand-built ShellDrawer + eyebrow + undivided sections. */}
694
- <SettingsPanel open={isSettingsOpen} variant="rail" title="Settings" onClose={() => setIsSettingsOpen(false)}>
695
- <SettingsSections sections={settingsSections} divided />
696
- </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
+ />
697
733
  </div>
698
734
  </ShellNavCollapsedContext.Provider>
699
735
  </ShellTocCollapsedContext.Provider>