@kolkrabbi/kol-shell 0.29.0 → 0.30.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 +2 -2
- package/src/NavRail.jsx +5 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.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,7 +20,7 @@
|
|
|
20
20
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@kolkrabbi/kol-component": "^0.
|
|
23
|
+
"@kolkrabbi/kol-component": "^0.142.0",
|
|
24
24
|
"@kolkrabbi/kol-icons": "^0.25.0",
|
|
25
25
|
"@kolkrabbi/kol-framework": "^0.35.0",
|
|
26
26
|
"@kolkrabbi/kol-theme": "^0.111.0"
|
package/src/NavRail.jsx
CHANGED
|
@@ -2,6 +2,11 @@ import { useEffect, useRef, useState } from 'react'
|
|
|
2
2
|
import gsap from 'gsap'
|
|
3
3
|
import { Button } from '@kolkrabbi/kol-component'
|
|
4
4
|
import { GRAB } from '@kolkrabbi/kol-component/utilities/motion'
|
|
5
|
+
/* the grab pill's proximity wake, travel and dwell — ONE implementation, shared
|
|
6
|
+
* with kol-framework's useDragResize (OneGrabGestureBothRails, kol-fxr
|
|
7
|
+
* 2026-08-30: two rails on one screen felt different because each package had
|
|
8
|
+
* built the gesture itself). It lived here until then. */
|
|
9
|
+
import { useGrabEdge } from '@kolkrabbi/kol-component'
|
|
5
10
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
6
11
|
import Logomark from './Logomark.jsx'
|
|
7
12
|
|
|
@@ -83,36 +88,6 @@ const openWidth = () => {
|
|
|
83
88
|
* lands on you, holds while you move inside the radius, then travels to where you
|
|
84
89
|
* are now — inside `GRAB.range`, the middle band of the edge, so it never rides
|
|
85
90
|
* up beside the logomark. One window listener, rAF-throttled. */
|
|
86
|
-
function useGrabEdge(ref) {
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
let raf = 0
|
|
89
|
-
const onMove = ({ clientX, clientY }) => {
|
|
90
|
-
if (raf) return
|
|
91
|
-
raf = requestAnimationFrame(() => {
|
|
92
|
-
raf = 0
|
|
93
|
-
const h = ref.current
|
|
94
|
-
if (!h) return
|
|
95
|
-
const r = h.getBoundingClientRect()
|
|
96
|
-
const dist = Math.abs(clientX - (r.left + r.width / 2))
|
|
97
|
-
const near = dist <= GRAB.near || (h.classList.contains('is-near') && dist <= GRAB.sleep)
|
|
98
|
-
h.classList.toggle('is-near', near)
|
|
99
|
-
if (!near) return
|
|
100
|
-
/* the travel band: bipolar from the middle, GRAB.range of the height */
|
|
101
|
-
const edge = (r.height * (1 - GRAB.range)) / 2
|
|
102
|
-
const along = Math.min(Math.max(clientY - r.top, edge), r.height - edge)
|
|
103
|
-
if (h.dataset.grabSeeded && Math.abs(along - Number(h.dataset.grabTarget)) < GRAB.stick) return
|
|
104
|
-
h.dataset.grabTarget = String(along)
|
|
105
|
-
const vars = { '--kol-rail-grab-y': `${along}px` }
|
|
106
|
-
/* the CSS fallback is 50%, a percentage — nothing to tween from, so the
|
|
107
|
-
* first sighting sets and every move after tweens */
|
|
108
|
-
if (h.dataset.grabSeeded) gsap.to(h, { ...vars, ...GRAB.travel, overwrite: 'auto' })
|
|
109
|
-
else { gsap.set(h, vars); h.dataset.grabSeeded = '1' }
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
window.addEventListener('pointermove', onMove)
|
|
113
|
-
return () => { window.removeEventListener('pointermove', onMove); cancelAnimationFrame(raf) }
|
|
114
|
-
}, [ref])
|
|
115
|
-
}
|
|
116
91
|
|
|
117
92
|
/* THE DRAG — hold the pill and the width follows the pointer between closed and
|
|
118
93
|
* open; release snaps to the nearer state, a click (no travel past GRAB.slop)
|