@kolkrabbi/kol-shell 0.11.0 → 0.12.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 +5 -5
- package/src/AppShell.jsx +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "KOL application shell — fixed 48px NavRail + AppShell layout root, PageShell/PageHeader scaffolds, ContentFilters catalog organism, GridCard, SettingsScaffold, WalkthroughPanel, ShortcutsOverlay. App chrome (kol-framework owns site chrome). Nav items, content, shortcuts and settings are consumer-injected. Sits above @kolkrabbi/kol-{theme,component,framework}.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@kolkrabbi/kol-
|
|
24
|
-
"@kolkrabbi/kol-
|
|
25
|
-
"@kolkrabbi/kol-
|
|
26
|
-
"@kolkrabbi/kol-
|
|
23
|
+
"@kolkrabbi/kol-component": "^0.118.2",
|
|
24
|
+
"@kolkrabbi/kol-framework": "^0.30.0",
|
|
25
|
+
"@kolkrabbi/kol-icons": "^0.24.0",
|
|
26
|
+
"@kolkrabbi/kol-theme": "^0.78.1"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"src",
|
package/src/AppShell.jsx
CHANGED
|
@@ -26,6 +26,13 @@ import TouchDeviceOverlay, { useTouchPrimary } from './TouchDeviceOverlay.jsx'
|
|
|
26
26
|
* localStorage `kol-desktop` is '1' (fxr's gate); `overlay` keeps the shell and
|
|
27
27
|
* mounts TouchDeviceOverlay once (monitor's)
|
|
28
28
|
* @param {string} props.appName TouchDeviceOverlay's subject
|
|
29
|
+
* @param {boolean} props.navKeys Option+1…9 navigates to `items[n-1].path` through `onNavigate` — the
|
|
30
|
+
* rail-order counterpart of `railToggleKey` (AppShellNavKeys, kol-monitor
|
|
31
|
+
* 2026-08-28 — user: "make command or alt 1234 go from home 1 2 3 4 in the
|
|
32
|
+
* sidenav without clicking"). Option, not Command: ⌘1–9 is the browser's
|
|
33
|
+
* tab switch. Matched on `e.code` (`Digit1`…) because Opt+digit yields
|
|
34
|
+
* `¡ ™ £ ¢` as `e.key` on macOS; ignored while typing in a field; only
|
|
35
|
+
* digits with an item; `preventDefault` on a match. Default off.
|
|
29
36
|
* @param {string} props.pageWash a CSS colour painted by `PageShell` OVER the shell's primary back
|
|
30
37
|
* (ShellPageWash, kol-monitor 2026-08-27 — user: "the back of the back
|
|
31
38
|
* should be primary — then you can just add transparent on top to step
|
|
@@ -47,6 +54,7 @@ export default function AppShell({
|
|
|
47
54
|
touch = 'shell',
|
|
48
55
|
appName,
|
|
49
56
|
pageWash,
|
|
57
|
+
navKeys = false,
|
|
50
58
|
children,
|
|
51
59
|
}) {
|
|
52
60
|
const [navHidden, setNavHidden] = useState(false)
|
|
@@ -68,6 +76,23 @@ export default function AppShell({
|
|
|
68
76
|
return () => window.removeEventListener('keydown', onKey)
|
|
69
77
|
}, [railToggleKey])
|
|
70
78
|
|
|
79
|
+
/* Option+digit → the rail item in that position (never while typing) */
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (!navKeys) return undefined
|
|
82
|
+
const onKey = (e) => {
|
|
83
|
+
const m = /^Digit([1-9])$/.exec(e.code)
|
|
84
|
+
if (!m || !e.altKey || e.metaKey || e.ctrlKey) return
|
|
85
|
+
const t = e.target
|
|
86
|
+
if (t?.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t?.tagName)) return
|
|
87
|
+
const item = items?.[Number(m[1]) - 1]
|
|
88
|
+
if (!item?.path) return
|
|
89
|
+
e.preventDefault()
|
|
90
|
+
onNavigate?.(item.path)
|
|
91
|
+
}
|
|
92
|
+
window.addEventListener('keydown', onKey)
|
|
93
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
94
|
+
}, [navKeys, items, onNavigate])
|
|
95
|
+
|
|
71
96
|
let wantsDesktop = false
|
|
72
97
|
try { wantsDesktop = typeof localStorage !== 'undefined' && localStorage.getItem('kol-desktop') === '1' } catch { /* storage blocked */ }
|
|
73
98
|
/* the wash variable rides the bare wrapper too (custom properties inherit
|