Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.
TypeScript clipboardclipboard-managerdesktop-appdrag-and-dropelectronopen-sourceproductivityproductivity-toolwindows
fix: Fixed deadzone Issue
Deepender256f6e5bf05659
diff --git a/electron/clipboard/ClipboardWatcher.ts b/electron/clipboard/ClipboardWatcher.tsindex 6c66983..9ded3b7 100644--- a/electron/clipboard/ClipboardWatcher.ts+++ b/electron/clipboard/ClipboardWatcher.ts@@ -39,25 +39,36 @@ export class ClipboardWatcher {if (this.paused) returnconst sig = clipboardSignature()if (sig === this.lastSig) return- console.log('[Watcher] clipboard changed sig=', sig.slice(0, 60))- this.lastSig = sig- const data = readClipboard()- if (!data) {- console.log('[Watcher] readClipboard returned null')- return- }- console.log('[Watcher] detected kind=', data.kind)+ // We detected a change. Wait a short moment to ensure it's not a transient+ // injection by a dictation app or macro that quickly restores the clipboard.+ setTimeout(() => {+ if (this.paused) return+ const stableSig = clipboardSignature()++ // If the signature changed AGAIN during this tiny window, it was a transient+ // copy-paste-restore operation. Ignore it and let the next tick handle the restored state.+ if (stableSig !== sig) {+ return+ }- // Images need their bytes persisted + an id assigned before publishing.- if (data.kind === 'image') {- const img = clipboard.readImage()- data.imageId = createId()- data.bytes = img.toPNG().length- onNew(data, img.toPNG())- } else {- onNew(data)- }+ this.lastSig = sig++ const data = readClipboard()+ if (!data) {+ return+ }++ // Images need their bytes persisted + an id assigned before publishing.+ if (data.kind === 'image') {+ const img = clipboard.readImage()+ data.imageId = createId()+ data.bytes = img.toPNG().length+ onNew(data, img.toPNG())+ } else {+ onNew(data)+ }+ }, 250)}, this.intervalMs)}diff --git a/electron/clipboard/formats.ts b/electron/clipboard/formats.tsindex 62bd693..384d5fd 100644--- a/electron/clipboard/formats.ts+++ b/electron/clipboard/formats.ts@@ -33,11 +33,40 @@ const COLOR_HEX_RE = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i/** Sensitive clipboard formats used by password managers and transient scripts. */const IGNORED_FORMATS = ['ClipboardViewerIgnore',- 'ExcludeClipboardContentFromMonitorProcessing','org.nspasteboard.ConcealedType','com.agilebits.onepassword']+/** Read a DWORD (32-bit uint) from a clipboard format, if present. */+function getClipboardDword(format: string): number | undefined {+ try {+ const buf = clipboard.readBuffer(format)+ if (buf && buf.length >= 4) {+ return buf.readUInt32LE(0)+ }+ // If present but empty buffer, we can't return a number, return null to indicate presence without value+ if (buf && buf.length === 0) {+ return -1+ }+ } catch {+ // ignore+ }+ return undefined+}++/**+ * Windows registered clipboard format names are compared case-insensitively by+ * the OS, but `availableFormats()` returns whatever casing the registering app+ * used. So a privacy flag like `ExcludeClipboardContentFromMonitorProcessing`+ * may arrive in any casing — we must match it case-insensitively, otherwise+ * content a password manager / dictation tool explicitly marked "do not record"+ * still leaks into our history (and out of Windows' own Win+V history).+ */+function isIgnoredFormat(format: string): boolean {+ const lower = format.toLowerCase()+ return IGNORED_FORMATS.some((f) => f.toLowerCase() === lower)+}+/*** Snapshot the current clipboard into a single ItemData, or null if it's empty.* Order matters: a file copy should win over its text fallback, an image wins@@ -47,12 +76,38 @@ export function readClipboard(): ItemData | null {const formats = clipboard.availableFormats()// Skip content that password managers / secret managers explicitly mark as- // sensitive. These are *explicit* opt-out flags — we do NOT check- // CanIncludeInClipboardHistory or ExcludeClipboardContentFromMonitorProcessing- // with a byte-length test because Windows populates those for most normal- // clipboard content (setting them != 0 is how many apps signal "yes include- // me"). Checking `byteLength > 0` was rejecting nearly everything.- if (formats.some((f) => IGNORED_FORMATS.includes(f))) {+ // sensitive.+ if (formats.some((f) => isIgnoredFormat(f))) {+ return null+ }+ // Explicitly check known privacy formats because Chromium often hides them from availableFormats()+ const checkExplicitExclusion = (format: string, isExcluded: (buf: Buffer) => boolean) => {+ try {+ const buf = clipboard.readBuffer(format)+ if (!buf || buf.length === 0) return false+ return isExcluded(buf)+ } catch {+ return false+ }+ }++ // CanIncludeInClipboardHistory: 0 means DO NOT include+ if (checkExplicitExclusion('CanIncludeInClipboardHistory', (buf) => buf.length >= 4 && buf.readUInt32LE(0) === 0)) {+ return null+ }++ // CanUploadToCloudClipboard: 0 means DO NOT include+ if (checkExplicitExclusion('CanUploadToCloudClipboard', (buf) => buf.length >= 4 && buf.readUInt32LE(0) === 0)) {+ return null+ }++ // ExcludeClipboardContentFromMonitorProcessing: non-zero means EXCLUDE+ if (checkExplicitExclusion('ExcludeClipboardContentFromMonitorProcessing', (buf) => buf.length >= 4 && buf.readUInt32LE(0) !== 0)) {+ return null+ }++ // Clipboard Viewer Ignore: presence of format with data means EXCLUDE+ if (checkExplicitExclusion('Clipboard Viewer Ignore', () => true)) {return null}diff --git a/electron/main/index.ts b/electron/main/index.tsindex 6989eb6..25a7391 100644--- a/electron/main/index.ts+++ b/electron/main/index.ts@@ -11,7 +11,7 @@import { app, BrowserWindow, protocol, session } from 'electron'import { APP_CONFIG, runtime } from './config'import { ensureDirs, cleanTemp, PATHS } from '../store/paths'-import { createWindow, getMainWindow, setInteractive, setVisible } from './window'+import { createWindow, getMainWindow, setInteractive, setVisible, startCursorPoll } from './window'import { createTray, registerIncognitoApplier } from './tray'import { registerIpc, registerSendListeners } from './ipc'import { initState, getWatcher, loadSettings, pushState } from './state'@@ -61,6 +61,7 @@ app.whenReady().then(() => {registerImageProtocol()createWindow()+ startCursorPoll()createTray()registerIpc()registerSendListeners()diff --git a/electron/main/ipc.ts b/electron/main/ipc.tsindex fc24995..bdb09f7 100644--- a/electron/main/ipc.ts+++ b/electron/main/ipc.ts@@ -68,6 +68,42 @@ export function registerIpc(): void {return true})+ handle('item:copy-subitem', (req) => {+ // Resolve a single sub-item (one file of a bundle, or one image of a+ // collection) and write just that onto the clipboard — not the whole item.+ const dto = getStore().toDto().find((d) => d.id === req.id)+ if (!dto) return false++ let wrote = false+ if (dto.data.kind === 'files' && req.paths && req.paths.length > 0) {+ // Electron has no public files-write API; fall back to paths as text,+ // mirroring writeItemToClipboard's behaviour for whole file items.+ clipboard.clear()+ clipboard.writeText(req.paths.join('\r\n'))+ wrote = true+ } else if (dto.data.kind === 'image-collection' && req.imageId) {+ const img = dto.data.images.find((i) => i.imageId === req.imageId)+ if (img && img.preview) {+ const native = nativeImage.createFromDataURL(img.preview)+ if (!native.isEmpty()) {+ clipboard.clear()+ clipboard.writeImage(native)+ wrote = true+ }+ }+ }++ if (!wrote) return false++ const watcher = getWatcher()+ watcher.setPaused(true)+ setTimeout(() => {+ watcher.setPaused(loadSettings().incognito)+ }, 200)++ return true+ })+handle('item:add-files', (paths) => {addFiles(paths)return getStore().toDto()diff --git a/electron/main/window.ts b/electron/main/window.tsindex ca5e494..159ee74 100644--- a/electron/main/window.ts+++ b/electron/main/window.ts@@ -10,14 +10,15 @@* hot zone. This is what produces the "invisible until you approach the edge"* effect without a separate hidden trigger window.*- * Drag-in support: because click-through windows cannot receive HTML5 drag- * events (only pointer events are forwarded), we create a separate thin- * "detector" window layered behind the main panel. It is always interactive- * and transparent — its body uses CSS `pointer-events: none` so regular clicks- * pass through to the desktop, but the BrowserWindow itself *does* receive- * OS drag events. When it detects a Files-type dragenter, it sends an IPC- * signal (`detector:file-drag-enter`) that is handled in index.ts to open- * the panel and make it interactive.+ * Drag-in support: a separate thin "detector" window is layered behind the+ * main panel. Historically it was kept non-click-through so it could receive+ * OS dragenter events, but on Windows that made it swallow all desktop clicks+ * across the hint-bar band (a transparent always-on-top BrowserWindow still+ * hit-tests across a minimum footprint). It is now click-through too; drag-in+ * still works because the main-process cursor poll (startCursorPoll) reads the+ * OS cursor position independently of mouse events, so it fires during an OS+ * file drag — the edge dwell opens the panel and makes the main window+ * interactive, and the drop then lands on the main window.** NOTE: this module must NOT import from state.ts to avoid circular dependencies.*/@@ -46,14 +47,82 @@ export function isInteractive(): boolean {/*** Toggle whether the panel swallows pointer events.*- * - interactive=false -> click-through (cursor passes to the desktop) but mouse- * move events are still forwarded so we can detect the hot zone.- * - interactive=true -> normal interactive window.+ * - interactive=false (collapsed) -> click-through: Windows passes ALL mouse+ * clicks to apps beneath. Edge detection is done by the main-process cursor+ * poll (startCursorPoll), which reads screen.getCursorScreenPoint() directly,+ * so no mouse-event forwarding is needed.+ * - interactive=true (expanded) -> normal interactive window: the black blade+ * captures all clicks.*/export function setInteractive(value: boolean): void {if (!mainWindow || value === interactive) returninteractive = value- mainWindow.setIgnoreMouseEvents(!value, { forward: !value })+ if (value) {+ // Panel is open: disable click-through so user can interact.+ mainWindow.setIgnoreMouseEvents(false)+ } else {+ // Panel is closed: full click-through, no forwarding needed.+ // Cursor edge detection is done by the main-process poll (startCursorPoll)+ // via screen.getCursorScreenPoint() + IPC, so forward:true is not required+ // and omitting it ensures Windows passes ALL mouse clicks to apps beneath.+ mainWindow.setIgnoreMouseEvents(true, { forward: false })+ }+}++/**+ * Poll the OS cursor position every ~16ms and send `window:cursor-edge` to+ * the renderer. This is the reliable alternative to `forward:true` on Windows+ * transparent windows, where pointermove forwarding often silently stops+ * working.+ */+let cursorPollTimer: ReturnType<typeof setInterval> | null = null+let lastEdgeState = false++export function startCursorPoll(): void {+ if (cursorPollTimer !== null) return+ cursorPollTimer = setInterval(() => {+ if (!mainWindow || !mainWindow.isVisible()) return++ const pt = screen.getCursorScreenPoint()+ const display = screen.getDisplayNearestPoint(pt)+ const wa = display.workArea++ // Translate screen coords → window-client coords.+ // getCursorScreenPoint() returns physical pixels on Windows; workArea is+ // already in physical pixels when scaleFactor > 1 in Electron's screen API.+ const clientX = pt.x - wa.x+ const clientY = pt.y - wa.y++ // Guard against garbage values that Windows occasionally sends.+ if (clientX < -1000 || clientX > 10000 || clientY < -1000 || clientY > 10000) return++ const inEdge = clientX <= 3+ const newState = inEdge++ // Keep streaming the cursor position to the renderer while it is near the+ // edge (so opening works) OR while the panel is open (so closing works in+ // EVERY direction). Previously we only streamed while clientX <= 60, which+ // froze the renderer's last-known position the moment the cursor moved to+ // the right past 60px — so it never learned the cursor had left and the+ // blade refused to retract horizontally. When the panel is closed and the+ // cursor is away from the edge we stop streaming to avoid needless IPC.+ if (clientX <= 60 || interactive || newState !== lastEdgeState) {+ lastEdgeState = newState+ mainWindow.webContents.send('window:cursor-edge', {+ x: clientX,+ y: clientY,+ inEdge,+ inZone: true+ })+ }+ }, 16)+}++export function stopCursorPoll(): void {+ if (cursorPollTimer !== null) {+ clearInterval(cursorPollTimer)+ cursorPollTimer = null+ }}/** Compute geometry anchored to the left edge of the primary display. */@@ -74,7 +143,7 @@ export function createWindow(): BrowserWindow {mainWindow = new BrowserWindow({x,y,- width,+ width: PANEL_WIDTH,height,show: false,frame: false,@@ -88,6 +157,7 @@ export function createWindow(): BrowserWindow {hasShadow: false,skipTaskbar: true,alwaysOnTop: true,+ focusable: false,backgroundColor: '#00000000',roundedCorners: false,webPreferences: {@@ -99,8 +169,8 @@ export function createWindow(): BrowserWindow {}})- // Start click-through so the panel is invisible to clicks until hovered.- mainWindow.setIgnoreMouseEvents(true, { forward: true })+ // Start click-through with no forwarding — edge detection is done via cursor poll.+ mainWindow.setIgnoreMouseEvents(true, { forward: false })// Keep the panel glued to the primary display if the work area changes.screen.on('display-metrics-changed', () => {@@ -108,7 +178,7 @@ export function createWindow(): BrowserWindow {const g = edgeGeometry()mainWindow.setBounds({ ...g })if (detectorWindow && !detectorWindow.isDestroyed()) {- detectorWindow.setBounds({ x: g.x, y: g.y, width: g.width, height: g.height })+ detectorWindow.setBounds({ x: g.x, y: g.y, width: 1, height: g.height })}})@@ -151,16 +221,13 @@ export function createWindow(): BrowserWindow {}/**- * Thin invisible detector window for OS file drag awareness.- *- * When the main panel is click-through, HTML5 drag events (dragenter/dragover/drop)- * are NOT forwarded — only pointer events are. This window sits in the same- * position but is always interactive and transparent. It detects incoming file- * drags and sends `detector:file-drag-enter` via the preload bridge so the- * main process (handled in index.ts) can open the panel + make it interactive.+ * Thin invisible detector window.*- * The body has `pointer-events: none` so regular mouse clicks pass through- * to the desktop, but the BrowserWindow itself still receives drag events.+ * It is click-through just like the main window, so when the panel is collapsed+ * it does not steal desktop clicks. It no longer drives opening (the cursor+ * poll does that). It is kept around as a fallback drag surface and a no-op+ * drag-event absorber; its inline script still forwards file drags to the main+ * window via `window.edge.setInteractive(true)` should it ever receive one.*/function createDetectorWindow(x: number, y: number, w: number, h: number): void {// Minimal HTML: the detector uses the preload bridge (window.edge) to send IPC.@@ -196,7 +263,7 @@ function createDetectorWindow(x: number, y: number, w: number, h: number): voiddetectorWindow = new BrowserWindow({x,y: detY,- width: 20,+ width: 1,height: detHeight,show: false,frame: false,@@ -220,8 +287,18 @@ function createDetectorWindow(x: number, y: number, w: number, h: number): void}})- // This window must NOT be click-through — it needs to receive drag events.- detectorWindow.setIgnoreMouseEvents(false)+ // Click-through, like the main window. A non-click-through always-on-top+ // window here used to swallow all desktop clicks across the hint-bar band+ // even though it was only 1px wide (Windows still hit-tests a transparent+ // always-on-top BrowserWindow across a minimum footprint). Keeping it+ // click-through means the collapsed panel passes clicks through everywhere.+ //+ // Drag-in is NOT lost: the main-process cursor poll+ // (screen.getCursorScreenPoint) reads the OS cursor position every ~16ms+ // regardless of mouse events, so it still fires while an OS file drag is in+ // progress — the 120ms edge dwell opens the panel and makes the main window+ // interactive, and the drop then lands on the main window.+ detectorWindow.setIgnoreMouseEvents(true, { forward: false })// Layer behind the main panel (lower always-on-top level).detectorWindow.setAlwaysOnTop(true, 'normal')diff --git a/electron/preload/index.ts b/electron/preload/index.tsindex f1f806e..8e44d65 100644--- a/electron/preload/index.ts+++ b/electron/preload/index.ts@@ -94,6 +94,7 @@ const api = {deleteItem: (id: string) => invoke('item:delete', id),clearItems: () => invoke('item:clear'),copyItem: (id: string) => invoke('item:copy', id),+ copySubitem: (req: import('../../shared/types').DragRequest) => invoke('item:copy-subitem', req),startDrag: (req: DragRequest) => send('item:start-drag', req),addFiles: (paths: string[]) => invoke('item:add-files', paths),removeSubitem: (req: import('../../shared/types').DragRequest) => invoke('item:remove-subitem', req),@@ -110,6 +111,7 @@ const api = {onToggle: (cb: () => void) => on('window:toggle', cb),onDragEnd: (cb: () => void) => on('item:drag-end', cb),onInternalDrop: (cb: (pos: { x: number; y: number }) => void) => on('item:internal-drop', cb),+ onCursorEdge: (cb: (data: { x: number; y: number; inEdge: boolean; inZone: boolean }) => void) => on('window:cursor-edge', cb),/* Drag helpers */// (Handled natively by capturing drop event above)diff --git a/shared/bridge.ts b/shared/bridge.tsindex 62ca186..955cb70 100644--- a/shared/bridge.ts+++ b/shared/bridge.ts@@ -16,6 +16,7 @@ export interface EdgeApi {clearItems: () => Promise<import('./types').ClipboardItemDto[]>removeSubitem: (req: DragRequest) => Promise<boolean>copyItem: (id: string) => Promise<boolean>+ copySubitem: (req: DragRequest) => Promise<boolean>/*** Begin a native OS drag-out. Fire-and-forget: must be called synchronously* from the DOM `dragstart` event, and main calls `event.sender.startDrag`.@@ -34,4 +35,5 @@ export interface EdgeApi {onToggle: (cb: () => void) => () => voidonDragEnd: (cb: () => void) => () => voidonInternalDrop: (cb: (pos: { x: number; y: number }) => void) => () => void+ onCursorEdge: (cb: (data: { x: number; y: number; inEdge: boolean; inZone: boolean }) => void) => () => void}diff --git a/shared/ipc.ts b/shared/ipc.tsindex 2ab028b..2d5f037 100644--- a/shared/ipc.ts+++ b/shared/ipc.ts@@ -34,6 +34,10 @@ export interface InvokeMap {/** Copy an item back onto the system clipboard. */'item:copy': { args: [id: string]; result: boolean }+ /** Copy a single sub-item (one file of a bundle, or one image of a+ * collection) onto the system clipboard. */+ 'item:copy-subitem': { args: [req: DragRequest]; result: boolean }+/** Add local file paths dragged into the shelf. */'item:add-files': { args: [paths: string[]]; result: ClipboardItemDto[] }@@ -65,6 +69,14 @@ export interface EventMap {'item:drag-end': []/** Internal drop triggered by the main process when startDrag ends inside the window */'item:internal-drop': [pos: { x: number; y: number }]+ /**+ * Main-process cursor poll signals: fired when the cursor enters/leaves+ * the screen-edge hot zone. The renderer uses this to open/close the panel+ * instead of relying on `forward:true` pointermove (which is unreliable on+ * Windows transparent windows).+ * payload: { x, y, inEdge, inZone }+ */+ 'window:cursor-edge': [data: { x: number; y: number; inEdge: boolean; inZone: boolean }]}/* ------------------------------------------------------------------ */diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsxindex 1c06382..90b7f85 100644--- a/src/components/ClipboardItem.tsx+++ b/src/components/ClipboardItem.tsx@@ -21,7 +21,7 @@ import type { DragRequest } from '../../shared/types'import { useStore } from '../store/appStore'import { useDragOut } from '../hooks/useDragOut'import { basename, formatBytes, previewText, relativeTime } from '../lib/format'-import { CopyIcon, FileIcon, ImageIcon, LinkIcon, PinIcon, TrashIcon, BundleIcon, MinusIcon, ChevronUpIcon } from './icons'+import { CopyIcon, FileIcon, ImageIcon, LinkIcon, PinIcon, TrashIcon, MinusIcon, ChevronUpIcon } from './icons'import '../styles/item.css'interface Props {@@ -62,17 +62,22 @@ function ClipboardItemBase({ item }: Props) {window.setTimeout(() => setCopied(false), 900)}, [copy, item.id])- const onToggleExpand = useCallback(() => {- if (isBundle) setExpanded((v) => !v)+ const onExpand = useCallback((e?: React.MouseEvent) => {+ e?.stopPropagation()+ if (isBundle) setExpanded(true)}, [isBundle])+ const onCollapse = useCallback((e?: React.MouseEvent) => {+ e?.stopPropagation()+ setExpanded(false)+ }, [])+const handleDragStart = useCallback((e: React.DragEvent, req: DragRequest) => {if (item.data.kind === 'text') {// Native HTML5 drag handles text perfectly and gives us a ghost image.+ // We ONLY set text/plain so that target applications (like browsers or Word)+ // treat the drop as pure text insertion rather than rendering a rich HTML block.e.dataTransfer.setData('text/plain', item.data.text)- if (item.data.html) {- e.dataTransfer.setData('text/html', item.data.html)- }e.dataTransfer.effectAllowed = 'copy'} else {// Images and files need OS-level file handles via Electron's startDrag.@@ -118,18 +123,19 @@ function ClipboardItemBase({ item }: Props) {}}}onDoubleClick={!isBundle ? onDoubleClick : undefined}- onClick={isBundle ? onToggleExpand : undefined}- title={isBundle ? (expanded ? 'Click to collapse' : 'Click to expand, drag to drop all files') : 'Double-click to copy, drag to any app'}+ onClick={isBundle && !expanded ? onExpand : undefined}+ title={isBundle ? (expanded ? '' : 'Click to expand, drag to drop all files') : 'Double-click to copy, drag to any app'}><div className="body">{isBundle ? (- <BundleFluidPreview- item={item}- expanded={expanded}- onDragStart={handleDragStart}- onCopy={onCopy}- onRemove={() => remove(item.id)}- />+ <BundleFluidPreview+ item={item}+ expanded={expanded}+ onDragStart={handleDragStart}+ onCopy={onCopy}+ onRemove={() => remove(item.id)}+ onCollapse={onCollapse}+ />) : (<Preview item={item} />)}@@ -181,106 +187,112 @@ function BundleFluidPreview({onDragStart,onCopy,onRemove,+ onCollapse,}: {item: ClipboardItemDtoexpanded: booleanonDragStart: (e: React.DragEvent, req: DragRequest) => voidonCopy: (e: React.MouseEvent) => voidonRemove: () => void+ onCollapse: (e?: React.MouseEvent) => void}) {if (item.data.kind === 'image-collection') {const more = item.data.images.length - 1return (<motion.div layout className="fluid-bundle" transition={{ type: 'spring', stiffness: 400, damping: 35 }}>- {expanded ? (- <motion.div layout className="fluid-list" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>- <div className="bundle-actions">- <button- className="act"- title="Collapse collection"- style={{ marginRight: 'auto' }}- >- <ChevronUpIcon />- </button>- <div className="actions-pill">- <button- className={`act${item.pinned ? ' active' : ''}`}- title={item.pinned ? 'Unpin' : 'Pin'}- onClick={(e) => { e.stopPropagation(); useStore.getState().togglePin(item.id, !item.pinned); }}+ <AnimatePresence initial={false} mode="popLayout">+ {expanded ? (+ <motion.div key="expanded" layout className="fluid-list" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>+ <div className="bundle-actions">+ <div+ className="bundle-collapse-zone"+ title="Collapse collection"+ onClick={(e) => { e.stopPropagation(); onCollapse(e); }}>- <PinIcon />- </button>- <button className="act" title="Copy all" onClick={(e) => { e.stopPropagation(); onCopy(e); }}>- <CopyIcon />- </button>- <button className="act danger" title="Delete bundle" onClick={(e) => { e.stopPropagation(); onRemove(); }}>- <TrashIcon />- </button>- </div>- </div>- {item.data.images.map((img) => (- <motion.div- key={img.imageId}- className="fluid-list-row"- draggable- onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, imageId: img.imageId }) }}- onClick={(e) => e.stopPropagation()}- initial={{ opacity: 0 }}- animate={{ opacity: 1, x: 0, y: 0, rotate: 0, scale: 1, zIndex: 1 }}- exit={{ opacity: 0 }}- >- <motion.img- layoutId={`img-${item.id}-${img.imageId}`}- src={img.preview}- style={{ width: 50, height: 50, objectFit: 'cover', borderRadius: 4, background: 'rgba(0,0,0,0.5)' }}- draggable={false}- />- <div style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1, minWidth: 0 }}>- <span style={{ fontSize: 13, color: 'rgba(255,255,255,0.9)' }}>- Image • {img.width} × {img.height}- </span>- <span style={{ fontSize: 11, color: 'rgba(255,255,255,0.5)' }}>- {formatBytes(img.bytes)}- </span>+ <button className="act bundle-collapse-btn">+ <ChevronUpIcon />+ </button>+ </div>+ <div className="actions-pill">+ <button+ className={`act${item.pinned ? ' active' : ''}`}+ title={item.pinned ? 'Unpin' : 'Pin'}+ onClick={(e) => { e.stopPropagation(); useStore.getState().togglePin(item.id, !item.pinned); }}+ >+ <PinIcon />+ </button>+ <button className="act" title="Copy all" onClick={(e) => { e.stopPropagation(); onCopy(e); }}>+ <CopyIcon />+ </button>+ <button className="act danger" title="Delete bundle" onClick={(e) => { e.stopPropagation(); onRemove(); }}>+ <TrashIcon />+ </button></div>- <button- className="act subitem-delete-btn"- title="Ungroup image from collection"- onClick={(e) => { e.stopPropagation(); window.edge.splitItem({ id: item.id, imageId: img.imageId, splitPlacement: 'after' }); }}- style={{ width: 24, height: 24 }}+ </div>+ {item.data.images.map((img) => (+ <motion.div+ key={img.imageId}+ className="fluid-list-row"+ draggable+ onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, imageId: img.imageId }) }}+ onClick={(e) => e.stopPropagation()}+ initial={{ opacity: 0 }}+ animate={{ opacity: 1, x: 0, y: 0, rotate: 0, scale: 1, zIndex: 1 }}+ exit={{ opacity: 0 }}>- <MinusIcon width={12} height={12} />- </button>- </motion.div>- ))}- </motion.div>- ) : (- <motion.div layout style={{ width: '100%' }} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>- <div className="bundle-stack-large">- {item.data.images.slice(0, 4).reverse().map((img, idx, arr) => {- const realIndex = arr.length - 1 - idx- return (<motion.imglayoutId={`img-${item.id}-${img.imageId}`}- key={img.imageId}src={img.preview}- className="bundle-stack-card"- animate={{- x: realIndex * 20 - 20,- y: realIndex * 6,- rotate: realIndex * 6 - 6,- scale: 1 - realIndex * 0.05- }}- style={{ zIndex: 10 - realIndex }}+ style={{ width: 50, height: 50, objectFit: 'cover', borderRadius: 4, background: 'rgba(0,0,0,0.5)' }}draggable={false}- initial={{ borderRadius: 8 }}/>- )- })}- </div>- {more > 0 && <div className="bundle-more-label">+{more} more image{more > 1 ? 's' : ''}</div>}- </motion.div>- )}+ <div style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1, minWidth: 0 }}>+ <span style={{ fontSize: 13, color: 'rgba(255,255,255,0.9)' }}>+ Image • {img.width} × {img.height}+ </span>+ <span style={{ fontSize: 11, color: 'rgba(255,255,255,0.5)' }}>+ {formatBytes(img.bytes)}+ </span>+ </div>+ <button+ className="act subitem-delete-btn"+ title="Ungroup image from collection"+ onClick={(e) => { e.stopPropagation(); window.edge.splitItem({ id: item.id, imageId: img.imageId, splitPlacement: 'after' }); }}+ style={{ width: 24, height: 24 }}+ >+ <MinusIcon width={12} height={12} />+ </button>+ </motion.div>+ ))}+ </motion.div>+ ) : (+ <motion.div key="collapsed" layout style={{ width: '100%' }} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>+ <div className="bundle-stack-large">+ {item.data.images.slice(0, 4).reverse().map((img, idx, arr) => {+ const realIndex = arr.length - 1 - idx+ return (+ <motion.img+ layoutId={`img-${item.id}-${img.imageId}`}+ key={img.imageId}+ src={img.preview}+ className="bundle-stack-card"+ animate={{+ x: realIndex * 20 - 20,+ y: realIndex * 6,+ rotate: realIndex * 6 - 6,+ scale: 1 - realIndex * 0.05+ }}+ style={{ zIndex: 10 - realIndex }}+ draggable={false}+ initial={{ borderRadius: 8 }}+ />+ )+ })}+ </div>+ {more > 0 && <div className="bundle-more-label">+{more} more image{more > 1 ? 's' : ''}</div>}+ </motion.div>+ )}+ </AnimatePresence></motion.div>)}@@ -289,84 +301,91 @@ function BundleFluidPreview({const more = item.data.paths.length - 1return (<motion.div layout className="fluid-bundle" transition={{ type: 'spring', stiffness: 400, damping: 35 }}>- {expanded ? (- <motion.div layout className="fluid-list" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>- <div className="bundle-actions">- <button- className="act"- title="Collapse collection"- style={{ marginRight: 'auto' }}- >- <ChevronUpIcon />- </button>- <div className="actions-pill">- <button- className={`act${item.pinned ? ' active' : ''}`}- title={item.pinned ? 'Unpin' : 'Pin'}- onClick={(e) => { e.stopPropagation(); useStore.getState().togglePin(item.id, !item.pinned); }}+ <AnimatePresence initial={false} mode="popLayout">+ {expanded ? (+ <motion.div key="expanded" layout className="fluid-list" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>+ <div className="bundle-actions">+ <div+ className="bundle-collapse-zone"+ title="Collapse collection"+ onClick={(e) => { e.stopPropagation(); onCollapse(e); }}>- <PinIcon />- </button>- <button className="act" title="Copy all paths" onClick={(e) => { e.stopPropagation(); onCopy(e); }}>- <CopyIcon />- </button>- <button className="act danger" title="Delete bundle" onClick={(e) => { e.stopPropagation(); onRemove(); }}>- <TrashIcon />- </button>+ <button className="act bundle-collapse-btn">+ <ChevronUpIcon />+ </button>+ </div>+ <div className="actions-pill">+ <button className="act" title="Copy all" onClick={(e) => { e.stopPropagation(); onCopy(e); }}>+ <CopyIcon />+ </button>+ <button className="act danger" title="Delete bundle" onClick={(e) => { e.stopPropagation(); onRemove(); }}>+ <TrashIcon />+ </button>+ </div></div>- </div>- {item.data.paths.map((filePath) => (- <motion.div- layoutId={`file-${item.id}-${filePath}`}- key={filePath}- className="fluid-list-row"- draggable- onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, paths: [filePath] }) }}- onClick={(e) => e.stopPropagation()}- >- <FileIcon width={14} height={14} />- <span className="file-row-name" style={{ flex: 1 }}>{basename(filePath)}</span>- <button- className="act subitem-delete-btn"- title="Ungroup file from collection"- onClick={(e) => { e.stopPropagation(); window.edge.splitItem({ id: item.id, paths: [filePath], splitPlacement: 'after' }); }}- style={{ width: 24, height: 24 }}+ {item.data.paths.map((filePath, idx) => (+ <motion.div+ key={`${item.id}-${idx}`}+ className="fluid-list-row"+ draggable+ onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, paths: [filePath] }) }}+ onClick={(e) => e.stopPropagation()}+ initial={{ opacity: 0 }}+ animate={{ opacity: 1, x: 0, y: 0, rotate: 0, scale: 1, zIndex: 1 }}+ exit={{ opacity: 0 }}>- <MinusIcon width={12} height={12} />- </button>- </motion.div>- ))}- </motion.div>- ) : (- <motion.div layout style={{ width: '100%' }} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>- <div className="bundle-stack-files">- {item.data.paths.slice(0, 4).reverse().map((filePath, idx, arr) => {- const realIndex = arr.length - 1 - idx- return (- <motion.div- layoutId={`file-${item.id}-${filePath}`}- key={filePath}- className="bundle-file-card"- animate={{- x: realIndex * 20 - 20,- y: realIndex * 6,- rotate: realIndex * 6 - 6,- scale: 1 - realIndex * 0.05- }}- style={{ zIndex: 10 - realIndex }}- draggable={false}- >+ <div className="fluid-list-icon"><FileIcon width={16} height={16} />- <span className="file-row-name" style={{ flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>- {basename(filePath)}- </span>- </motion.div>- )- })}- </div>- {more > 0 && <div className="bundle-more-label">+{more} more file{more > 1 ? 's' : ''}</div>}- </motion.div>- )}+ </div>+ <div className="fluid-list-text">{filePath.split(/[\\/]/).pop()}</div>+ <button+ className="act subitem-copy-btn"+ title="Copy file path"+ onClick={(e) => { e.stopPropagation(); window.edge.copySubitem({ id: item.id, paths: [filePath] }); }}+ style={{ width: 24, height: 24 }}+ >+ <CopyIcon width={12} height={12} />+ </button>+ <button+ className="act subitem-delete-btn"+ title="Ungroup file from collection"+ onClick={(e) => { e.stopPropagation(); window.edge.splitItem({ id: item.id, paths: [filePath], splitPlacement: 'after' }); }}+ style={{ width: 24, height: 24 }}+ >+ <MinusIcon width={12} height={12} />+ </button>+ </motion.div>+ ))}+ </motion.div>+ ) : (+ <motion.div key="collapsed" layout style={{ width: '100%' }} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>+ <div className="bundle-stack-files">+ {item.data.paths.slice(0, 4).reverse().map((filePath, idx, arr) => {+ const realIndex = arr.length - 1 - idx+ return (+ <motion.div+ layoutId={`file-${item.id}-${idx}`}+ key={`${item.id}-${idx}`}+ className="bundle-stack-file"+ animate={{+ x: realIndex * 8,+ y: realIndex * 6,+ scale: 1 - realIndex * 0.05+ }}+ style={{ zIndex: 10 - realIndex }}+ >+ <div className="icon">+ <FileIcon width={14} height={14} />+ </div>+ <span className="name">{filePath.split(/[\\/]/).pop()}</span>+ </motion.div>+ )+ })}+ </div>+ {more > 0 && <div className="bundle-more-label">+{more} more file{more > 1 ? 's' : ''}</div>}+ </motion.div>+ )}+ </AnimatePresence></motion.div>)}diff --git a/src/components/Panel.tsx b/src/components/Panel.tsxindex 55f877d..359d46b 100644--- a/src/components/Panel.tsx+++ b/src/components/Panel.tsx@@ -8,8 +8,9 @@* transparent and click-through.*/import { motion, AnimatePresence } from 'framer-motion'-import { useEffect } from 'react'+import { useEffect, useRef } from 'react'import { useStore } from '../store/appStore'+import { PANEL_LEAVE_EVENT, PANEL_ENTER_EVENT } from '../hooks/useEdgeHover'import { Header } from './Header'import { ItemList } from './ItemList'import { Settings } from './Settings'@@ -34,6 +35,23 @@ export function Panel() {const setInternalDragReq = useStore((s) => s.setInternalDragReq)const internalDragReq = useStore((s) => s.internalDragReq)+ const bladeRef = useRef<HTMLDivElement>(null)++ useEffect(() => {+ const blade = bladeRef.current+ if (!blade) return++ const handleLeave = () => window.dispatchEvent(new Event(PANEL_LEAVE_EVENT))+ const handleEnter = () => window.dispatchEvent(new Event(PANEL_ENTER_EVENT))++ blade.addEventListener('mouseleave', handleLeave)+ blade.addEventListener('mouseenter', handleEnter)+ return () => {+ blade.removeEventListener('mouseleave', handleLeave)+ blade.removeEventListener('mouseenter', handleEnter)+ }+ }, [])+useEffect(() => {const unsubDragEnd = window.edge.onDragEnd(() => {// Delay clearing to allow React's drop event to process first if they coincide@@ -105,6 +123,8 @@ export function Panel() {}const onDrop = (e: React.DragEvent) => {+ e.preventDefault()+ e.stopPropagation()console.log('[Panel] onDrop internalDragReq=', internalDragReq)if (internalDragReq) {e.preventDefault()@@ -125,27 +145,26 @@ export function Panel() {}return (- <div- className="root"- onDragEnter={onDragEnter}- onDragOver={onDragOver}- onDragLeave={onDragLeave}- onDrop={onDrop}- >+ <div className="root"><motion.divclassName="blade-container"initial={false}+ onDragEnter={onDragEnter}+ onDragOver={onDragOver}+ onDragLeave={onDragLeave}+ onDrop={onDrop}style={{top: topOffset,y: '-50%',position: 'absolute',left: 0,- zIndex: 10+ zIndex: 10,+ pointerEvents: open ? 'auto' : 'none'}}animate={{clipPath: open? 'inset(-100px -100px -100px 0px round 0px 24px 24px 0px)'- : `inset(calc(50% - ${halfTrigger}px) calc(100% - 6px) calc(50% - ${halfTrigger}px) 0px round 0px 12px 12px 0px)`+ : `inset(calc(50% - ${halfTrigger}px) calc(100% - 3px) calc(50% - ${halfTrigger}px) 0px round 0px 12px 12px 0px)`}}transition={{type: 'tween',@@ -155,7 +174,11 @@ export function Panel() {><div className="flare-top" /><div className="flare-bottom" />- <div className="blade" style={{ height: panelHeightStr }}>+ <div+ ref={bladeRef}+ className="blade"+ style={{ height: panelHeightStr }}+ ><Header /><AnimatePresence mode="wait">diff --git a/src/hooks/useEdgeHover.ts b/src/hooks/useEdgeHover.tsindex a416e6f..acdce25 100644--- a/src/hooks/useEdgeHover.ts+++ b/src/hooks/useEdgeHover.ts@@ -1,32 +1,44 @@/*** useEdgeHover — the heart of the "invisible until you approach the edge" feel.*- * The window is always full-size and normally click-through. We watch the- * pointer across the whole document:+ * Detection strategy:*- * - When the cursor enters the hot band (leftmost `triggerPx` of the screen,- * within the vertical hot zone) and dwells there for `dwellMs`, we expand- * the blade and ask main to make the window interactive (no longer- * click-through).- * - When the pointer leaves the panel, we wait `graceMs` before collapsing so- * a slip to a child element doesn't snap it shut. Escape and blur also- * collapse immediately.- * - **Drag-aware:** when an OS file drag is active (store `dragActive`), we- * never schedule a close and we keep the panel interactive so the drop can- * land. We also listen for `dragenter`/`dragover` of OS files on the- * document level and immediately open + set interactive, so dragging files- * toward the edge reveals the shelf even when the panel was collapsed.+ * OPENING: cursor dwells in the leftmost TRIGGER_PX band within the hot zone.*- * Settings (hot-zone position/height) come from the store so the user can tune- * where the trigger lives.+ * CLOSING — two complementary mechanisms:+ *+ * 1. panel:leave custom event (primary): Panel.tsx dispatches this event on the+ * blade div's onMouseLeave. React's mouseleave does NOT bubble through child+ * elements, so it fires exactly when the cursor leaves the visible black area.+ * This correctly handles all directions (right, top, bottom) without relying+ * on Electron's broken document-level pointerleave for transparent windows.+ *+ * 2. Y-axis overshooting (backup): while the cursor is inside the window, we+ * track whether it has gone above or below the panel's visual bounds via+ * pointermove. This catches cases where the cursor leaves the panel vertically+ * before React's mouseleave has a chance to fire.+ *+ * Drag-awareness: while an external OS file drag is active we never close.*/import { useEffect, useRef } from 'react'import { edge } from '../lib/edge'import { useStore } from '../store/appStore'-const TRIGGER_PX = 12 // leftmost pixels that count as "the edge"-const DWELL_MS = 120 // how long the cursor must linger to open-const GRACE_MS = 250 // hide delay after leaving, to avoid jitter+const TRIGGER_PX = 3 // leftmost px that count as "the edge"+const DWELL_MS = 120 // cursor must linger this long to open+const GRACE_MS = 250 // close delay after leaving+const PANEL_WIDE = 280 // blade is ~270px (var(--panel-width)); grace margin+/** Hysteresis thresholds for closing the panel.+ * KEEP_OPEN_PX: if cursor x is <= this, the panel stays open (clearly inside blade).+ * START_CLOSE_PX: if cursor x is > this, start the close timer (clearly outside).+ * Gap between the two prevents rapid cancel/schedule oscillation at the blade edge+ * when the cursor hovers just outside the visual boundary.+ */+const KEEP_OPEN_PX = PANEL_WIDE - 30 // 250 — clearly inside blade+const START_CLOSE_PX = PANEL_WIDE + 60 // 340 — clearly outside blade + window margin++export const PANEL_LEAVE_EVENT = 'panel:leave'+export const PANEL_ENTER_EVENT = 'panel:enter'export function useEdgeHover(): void {const open = useStore((s) => s.open)@@ -34,9 +46,10 @@ export function useEdgeHover(): void {const settings = useStore((s) => s.settings)const dragActive = useStore((s) => s.dragActive)const setDragActive = useStore((s) => s.setDragActive)-const internalDragReq = useStore((s) => s.internalDragReq)+ // All reactive values accessed inside events kept in refs so the+ // event-listener effect never needs to restart (restarting cancels timers).const openRef = useRef(open)openRef.current = open@@ -46,95 +59,155 @@ export function useEdgeHover(): void {const internalDragRef = useRef(!!internalDragReq)internalDragRef.current = !!internalDragReq- // Where (in px) the vertical hot zone starts and ends, recomputed per move.- const zone = useRef({ top: 0, bottom: 0 })+ const settingsRef = useRef(settings)+ settingsRef.current = settings++ // Hot zone and panel bounds, recomputed on resize to avoid reading DOM at 1000Hz+ const zone = useRef({ top: 0, bottom: 0, midY: 0, panelHalfH: 0 })++ // Last known pointer position (updated on every pointermove). Used to vet+ // `panel:leave` events — Framer Motion layout reflows can fire spurious+ // mouseleave events while the cursor never actually left the blade.+ const lastClient = useRef({ x: -1, y: -1 })useEffect(() => {- const recomputeZone = () => {+ const recompute = () => {const h = window.innerHeight- const frac = settings.hotZoneHeight- const center = 0.5- const span = h * frac- zone.current = {- top: h * center - span / 2,- bottom: h * center + span / 2+ const s = settingsRef.current+ const half = h * s.hotZoneHeight / 2+ const panelHalfH = h * (s.panelHeight || 0.5) / 2+ zone.current = {+ top: h / 2 - half,+ bottom: h / 2 + half,+ midY: h / 2,+ panelHalfH}}- recomputeZone()- window.addEventListener('resize', recomputeZone)- return () => window.removeEventListener('resize', recomputeZone)- }, [settings.hotZoneHeight])+ recompute()+ window.addEventListener('resize', recompute)+ return () => window.removeEventListener('resize', recompute)+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [])+ // Single stable effect — deps never change after mount.useEffect(() => {let dwellTimer: number | undefinedlet graceTimer: number | undefined+ const closePanel = () => {+ if (!openRef.current) return+ if (dragActiveRef.current && !internalDragRef.current) return+ setOpen(false)+ window.setTimeout(() => edge.setInteractive(false), 220)+ }++ const scheduleClose = (delay = GRACE_MS) => {+ if (dragActiveRef.current && !internalDragRef.current) return+ if (graceTimer !== undefined) return // already closing+ graceTimer = window.setTimeout(closePanel, delay)+ }++ const cancelClose = () => {+ if (graceTimer !== undefined) {+ window.clearTimeout(graceTimer)+ graceTimer = undefined+ }+ }+const openPanel = () => {if (openRef.current) return- window.clearTimeout(graceTimer)- window.clearTimeout(dwellTimer)+ cancelClose()+ if (dwellTimer !== undefined) {+ window.clearTimeout(dwellTimer)+ dwellTimer = undefined+ }edge.setInteractive(true)setOpen(true)}- const scheduleClose = (immediate = false) => {- // If an external OS file drag is in progress, never close the panel.- if (dragActiveRef.current && !internalDragRef.current) return+ // ── panel:leave / panel:enter (from Panel.tsx blade div) ──────────────+ // NOTE: `mouseleave` can fire spuriously when Framer Motion's `layout`+ // reflow repositions an exiting child out from under the cursor (e.g. on+ // expand). So we treat `panel:leave` as a *hint* and only actually close+ // if the last known pointer position is genuinely outside the blade.+ const isInsideBlade = () => {+ const { midY, panelHalfH } = zone.current+ const { x, y } = lastClient.current+ if (x < 0) return true // unknown — be conservative, don't close+ return x <= PANEL_WIDE && y >= midY - panelHalfH && y <= midY + panelHalfH+ }- window.clearTimeout(graceTimer)- graceTimer = window.setTimeout(() => {- if (!openRef.current) return- if (dragActiveRef.current && !internalDragRef.current) return // double-check after timeout- setOpen(false)- // Defer disabling interactivity a frame so the collapse animation can- // run before the window becomes click-through again.- window.setTimeout(() => edge.setInteractive(false), 220)- }, immediate ? 0 : GRACE_MS)+ const onPanelLeave = () => {+ if (isInsideBlade()) {+ cancelClose()+ return+ }+ scheduleClose()}- const onMove = (e: PointerEvent) => {- const { top, bottom } = zone.current- const inEdge = e.clientX <= TRIGGER_PX- const inZone = e.clientY >= top && e.clientY <= bottom+ const onPanelEnter = () => {+ cancelClose()+ }++ // ── main-process cursor poll (replaces broken pointermove forwarding) ──+ // The main process polls screen.getCursorScreenPoint() every 16ms and+ // sends window:cursor-edge with raw x/y coords. We check the hot zone+ // here with the renderer's own settings so everything stays in sync.+ const unsubCursorEdge = window.edge.onCursorEdge((data) => {+ lastClient.current = { x: data.x, y: data.y }+ const { top, bottom, midY, panelHalfH } = zone.current+ const inEdge = data.x <= TRIGGER_PX+ const inZone = data.y >= top && data.y <= bottom- if (inEdge && inZone) {- if (!dwellTimer) {- console.log('[EdgeHover] inEdge and inZone, starting dwell timer')+ // Edge trigger: only start dwell to OPEN when panel is closed.+ // When panel is already open, cursor at x=0 is treated like any other+ // inside-blade position (falls through to insideX check below).+ if (inEdge && inZone && !openRef.current) {+ cancelClose()+ if (dwellTimer === undefined) {dwellTimer = window.setTimeout(() => {- console.log('[EdgeHover] dwell timer fired, calling openPanel')dwellTimer = undefinedopenPanel()}, DWELL_MS)}- } else {- if (dwellTimer) console.log('[EdgeHover] aborted dwell timer')+ return+ }++ if (dwellTimer !== undefined) {window.clearTimeout(dwellTimer)dwellTimer = undefined+ }- // Calculate panel bounds to ensure we close if they leave the visual black area.- const panelHeightFrac = settings.panelHeight || 0.6- const panelHeightPx = window.innerHeight * panelHeightFrac- const panelTop = window.innerHeight / 2 - panelHeightPx / 2- const panelBottom = window.innerHeight / 2 + panelHeightPx / 2+ if (!openRef.current) return- const outsideX = e.clientX > 280- const outsideY = e.clientY < panelTop || e.clientY > panelBottom+ // Hysteresis-based close detection.+ // Using two separate thresholds prevents the oscillation that occurs when+ // the cursor hovers right at the blade edge (x ≈ 280px): a single threshold+ // causes rapid cancel/schedule cycles every 16ms that prevent the grace+ // timer from ever counting down.+ //+ // x ≤ KEEP_OPEN_PX (250): cursor clearly inside blade → cancel close+ // x > START_CLOSE_PX (340): cursor clearly outside window → schedule close+ // 250 < x ≤ 340 (dead band): neither action — let existing timer run+ const insideY = data.y >= midY - panelHalfH && data.y <= midY + panelHalfH- if (outsideX || outsideY) {- if (!graceTimer && openRef.current) console.log(`[EdgeHover] scheduling close, outsideX=${outsideX}, outsideY=${outsideY} (clientY=${e.clientY}, top=${panelTop}, bottom=${panelBottom})`)- scheduleClose()- } else {- window.clearTimeout(graceTimer)- }+ if (data.x <= KEEP_OPEN_PX && insideY) {+ cancelClose()+ return}- }- const onLeave = () => scheduleClose()+ if (data.x > START_CLOSE_PX || !insideY) {+ scheduleClose()+ }+ // else: dead band — do nothing, let existing timer expire naturally+ })++ // ── keyboard ───────────────────────────────────────────────────────────const onKeyDown = (e: KeyboardEvent) => {- if (e.key === 'Escape' && openRef.current) scheduleClose()+ if (e.key === 'Escape' && openRef.current) scheduleClose(0)}- /** Open the panel immediately when an OS file drag enters the window. */+ // ── OS file drag awareness ─────────────────────────────────────────────const onDocDragEnter = (e: DragEvent) => {if (e.dataTransfer?.types.includes('Files')) {e.preventDefault()@@ -142,37 +215,31 @@ export function useEdgeHover(): void {openPanel()}}-const onDocDragOver = (e: DragEvent) => {if (e.dataTransfer?.types.includes('Files')) {e.preventDefault()- // Keep panel alive during drag.- window.clearTimeout(graceTimer)+ cancelClose()}}-const onDocDragLeave = (e: DragEvent) => {- // Only clear if we truly left the document.if (!e.relatedTarget) {setDragActive(false)- if (internalDragRef.current) {- scheduleClose(true)- }+ if (internalDragRef.current) scheduleClose(0)}}-- const onDocDrop = () => {+ const onDocDrop = (e: DragEvent) => {+ e.preventDefault()setDragActive(false)}-- const onDocDragEnd = () => {+ const onDocDragEnd = (e: DragEvent) => {+ e.preventDefault()setDragActive(false)}- document.addEventListener('pointermove', onMove)- document.addEventListener('pointerleave', onLeave)+ // ── register ───────────────────────────────────────────────────────────window.addEventListener('keydown', onKeyDown)- // OS file drag awareness at the document level.+ window.addEventListener(PANEL_LEAVE_EVENT, onPanelLeave)+ window.addEventListener(PANEL_ENTER_EVENT, onPanelEnter)document.addEventListener('dragenter', onDocDragEnter)document.addEventListener('dragover', onDocDragOver)document.addEventListener('dragleave', onDocDragLeave)@@ -180,9 +247,10 @@ export function useEdgeHover(): void {document.addEventListener('dragend', onDocDragEnd)return () => {- document.removeEventListener('pointermove', onMove)- document.removeEventListener('pointerleave', onLeave)+ unsubCursorEdge()window.removeEventListener('keydown', onKeyDown)+ window.removeEventListener(PANEL_LEAVE_EVENT, onPanelLeave)+ window.removeEventListener(PANEL_ENTER_EVENT, onPanelEnter)document.removeEventListener('dragenter', onDocDragEnter)document.removeEventListener('dragover', onDocDragOver)document.removeEventListener('dragleave', onDocDragLeave)@@ -191,5 +259,6 @@ export function useEdgeHover(): void {window.clearTimeout(dwellTimer)window.clearTimeout(graceTimer)}+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [setOpen, setDragActive])}diff --git a/src/hooks/useFilteredItems.ts b/src/hooks/useFilteredItems.tsindex ab3261d..e02dfbe 100644--- a/src/hooks/useFilteredItems.ts+++ b/src/hooks/useFilteredItems.ts@@ -18,7 +18,11 @@ function matches(it: ClipboardItemDto, q: string): boolean {case 'files':return it.data.paths.some((p) => basename(p).toLowerCase().includes(needle))case 'image':- return false // images have no searchable text; hidden by query+ // images have no searchable text; hidden by query+ return false+ case 'image-collection':+ // image collections have no searchable text; hidden by query+ return false}}diff --git a/src/styles/item.css b/src/styles/item.cssindex 41bd49a..14b73c3 100644--- a/src/styles/item.css+++ b/src/styles/item.css@@ -270,6 +270,7 @@width: 100%;display: flex;flex-direction: column;+ position: relative;}.fluid-grid {@@ -344,12 +345,38 @@align-items: center;justify-content: flex-end;gap: 6px;- padding: 4px 0 8px;+ padding: 6px 0 10px;width: 100%;border-bottom: 1px solid rgba(255, 255, 255, 0.04);margin-bottom: 4px;}+/* The invisible buffer area covering the left side to collapse the bundle */+.bundle-collapse-zone {+ display: flex;+ align-items: center;+ flex: 1; /* stretches to push actions-pill to the right */+ height: 100%;+ padding-left: 8px;+ cursor: pointer;+ align-self: stretch; /* fill the vertical space of the actions bar */+}++/* Hovering anywhere in the buffer area highlights the button */+.bundle-collapse-zone:hover .bundle-collapse-btn {+ background: rgba(255, 255, 255, 0.15);+ color: #fff;+}++/* Larger hit area for the collapse (chevron) button */+.bundle-collapse-btn {+ width: 36px !important;+ height: 36px !important;+ border-radius: 8px !important;+ color: rgba(255, 255, 255, 0.75) !important;+ pointer-events: none; /* Let the zone handle the click */+}+.bundle-actions-label {font-weight: 500;}diff --git a/src/styles/panel.css b/src/styles/panel.cssindex 3554e00..79611d4 100644--- a/src/styles/panel.css+++ b/src/styles/panel.css@@ -13,13 +13,12 @@pointer-events: none; /* Let clicks pass through empty space */}-.root > * {- pointer-events: auto; /* Re-enable clicks for the panel itself */-}+/* pointer-events on individual children is set inline via React (open ? auto : none) *//* The blade itself — a tall rounded-right panel. */.blade {position: relative; /* Inside motion wrapper */+ flex-shrink: 0;width: var(--panel-width);display: flex;flex-direction: column;