Skip to content

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.

feat(drag): drop zone that meets the drag; dashed stacking and detach targets; bottom hover pill on text cards

Deepender25dee6bac85063
diff --git a/electron/main/externalDrag.ts b/electron/main/externalDrag.ts
new file mode 100644
index 0000000..bb3f63a
--- /dev/null
+++ b/electron/main/externalDrag.ts
@@ -0,0 +1,67 @@
+/**
+ * Is a drag from another app in progress right now?
+ *
+ * The shelf window is click-through while closed, so it gets no drag events
+ * until it is open and under the cursor. To let the edge bar get ready for a
+ * drag before it arrives, the cursor poll asks this on each tick.
+ *
+ * Windows has no API for "a drag is in progress", but every drag that carries
+ * a drag image (Explorer, browsers, Office, Electron and Chromium apps) shows
+ * it in a small top-level shell window of class `SysDragImage` that exists
+ * only for the length of the drag. A held mouse button plus that window is
+ * the signal; the button is checked first, so a tick with no button held
+ * costs one GetAsyncKeyState pair. Drags with no image are not seen here and
+ * keep the old behaviour (open at the edge, drop zone on drag-enter).
+ *
+ * Our own drag-outs (cards dragged out of the shelf) also show that window;
+ * main brackets them with setOwnDragActive so they are never mistaken for an
+ * incoming drag.
+ */
+import koffi from 'koffi'
+
+type GetAsyncKeyStateFn = (vKey: number) => number
+type FindWindowFn = (className: string, windowName: null) => number | bigint
+
+let getAsyncKeyState: GetAsyncKeyStateFn | null = null
+let findWindow: FindWindowFn | null = null
+
+if (process.platform === 'win32') {
+ try {
+ const user32 = koffi.load('user32.dll')
+ getAsyncKeyState = user32.func('short GetAsyncKeyState(int vKey)') as GetAsyncKeyStateFn
+ findWindow = user32.func('uintptr_t FindWindowW(str16 lpClassName, str16 lpWindowName)') as FindWindowFn
+ } catch (err) {
+ console.error('[ExternalDrag] Failed to load user32 functions via koffi:', err)
+ getAsyncKeyState = null
+ findWindow = null
+ }
+}
+
+const VK_LBUTTON = 0x01
+const VK_RBUTTON = 0x02
+/** After our own drag-out ends, its drag image can linger a moment. */
+const OWN_DRAG_TAIL_MS = 800
+
+let ownDrag = false
+let ownDragUntil = 0
+
+/** Bracket a drag-out from the shelf (true before startDrag, false after). */
+export function setOwnDragActive(active: boolean): void {
+ ownDrag = active
+ if (!active) ownDragUntil = Date.now() + OWN_DRAG_TAIL_MS
+}
+
+/** True while a drag from another app is in progress anywhere on screen. */
+export function isExternalDragActive(now = Date.now()): boolean {
+ if (!getAsyncKeyState || !findWindow) return false
+ if (ownDrag || now < ownDragUntil) return false
+ try {
+ // Physical buttons (GetAsyncKeyState ignores the swap setting), and a
+ // right-button drag is a drag too.
+ const held = (getAsyncKeyState(VK_LBUTTON) & 0x8000) !== 0 || (getAsyncKeyState(VK_RBUTTON) & 0x8000) !== 0
+ if (!held) return false
+ return !!findWindow('SysDragImage', null)
+ } catch {
+ return false
+ }
+}
diff --git a/electron/main/ipc.ts b/electron/main/ipc.ts
index ebdfd3b..5517ca7 100644
--- a/electron/main/ipc.ts
+++ b/electron/main/ipc.ts
@@ -19,6 +19,7 @@ import { registerGlobalHotkey } from './index'
import { getOnboardingWindow } from './onboardingWindow'
import { rebuildTrayMenu } from './tray'
import { startDragOut, resolveDragData, prestageDrag, stageDragFile, formatClipboardImageFilename } from './drag'
+import { setOwnDragActive } from './externalDrag'
import { clipboardSignature, formatTabularDataForClipboard, signatureMatchesItem } from '../clipboard/formats'
import type { ClipboardItem, ItemData, MergeResult } from '../../shared/types'
import { quitAndInstallUpdate, checkForUpdatesManual, startUpdateDownload, syncAutoUpdaterState, getCachedUpdateState, triggerBackgroundCheck } from './updater'
@@ -891,7 +892,14 @@ export function registerSendListeners(): void {
// dragged item appear to vanish ~0.5 s into any drag gesture.
setHeartbeatPaused(true)
- const dragStarted = startDragOut(sender, data, capturedAt, subIndex)
+ // Our own drag image must not read as a drag coming in from another app.
+ setOwnDragActive(true)
+ let dragStarted: boolean
+ try {
+ dragStarted = startDragOut(sender, data, capturedAt, subIndex)
+ } finally {
+ setOwnDragActive(false)
+ }
console.log('[IPC] start-drag returned, sending drag-end')
sender.send('item:drag-end')
diff --git a/electron/main/window.ts b/electron/main/window.ts
index 31a14ee..53ebe5f 100644
--- a/electron/main/window.ts
+++ b/electron/main/window.ts
@@ -26,6 +26,7 @@ import { probeSeamAware, isNearProximity, type SeamTickState } from './stickProb
import { loadSettings, saveSettings } from '../store/settings'
import { isFullscreenAppActive, registerFullscreenActiveListener } from './fullscreen'
import { noteUiMotion } from './thumbnailCache'
+import { isExternalDragActive } from './externalDrag'
type RegisterWindowMessageFn = (lpString: string) => number
type SetWindowLongPtrFn = (hWnd: number | bigint, nIndex: number, dwNewLong: number | bigint) => number | bigint
@@ -487,6 +488,8 @@ export function requestPollBoost(durationMs = 8000): void {
/** Last sent cursor position — used to suppress duplicate IPC messages. */
let _lastSentX = -9999
let _lastSentY = -9999
+/** Last sent "a drag from another app is in progress" flag. */
+let _lastSentDrag = false
/** Seam-policy tracker threaded between ticks (see stickProbe.ts pillars). */
let _seamState: SeamTickState = {}
@@ -615,17 +618,23 @@ function _pollTick(): void {
Math.abs(clientX - _lastSentX) >= IPC_MIN_DELTA_PX ||
Math.abs(clientY - _lastSentY) >= IPC_MIN_DELTA_PX
- const shouldSend = newState !== lastEdgeState || interactive || (nearEdge && positionChangedEnough)
+ // d) A drag from another app starts or ends (the edge bar gets ready
+ // for it wherever the cursor is; near the edge (c) streams it in).
+ const drag = isExternalDragActive()
+
+ const shouldSend = newState !== lastEdgeState || interactive || (nearEdge && positionChangedEnough) || drag !== _lastSentDrag
if (shouldSend) {
lastEdgeState = newState
_lastSentX = clientX
_lastSentY = clientY
+ _lastSentDrag = drag
sendToMainWindow('window:cursor-edge', {
x: clientX,
y: clientY,
inEdge,
inZone: true,
+ drag,
stickPosition: settings.stickPosition,
displayWidth: wa.width,
displayHeight: wa.height
diff --git a/shared/bridge.ts b/shared/bridge.ts
index b53c4c7..5059155 100644
--- a/shared/bridge.ts
+++ b/shared/bridge.ts
@@ -92,6 +92,8 @@ export interface EdgeApi {
stickPosition: import('./types').StickPosition
displayWidth: number
displayHeight: number
+ /** A drag from another app is in progress anywhere on screen (see electron/main/externalDrag.ts). */
+ drag?: boolean
}) => void) => () => void
onToast: (cb: (toast: { id: string; message: string; tone: 'info' | 'error'; params?: Record<string, string | number> }) => void) => () => void
onCopyFlare: (cb: () => void) => () => void
diff --git a/shared/ipc.ts b/shared/ipc.ts
index 9f7198b..f8a3fd0 100644
--- a/shared/ipc.ts
+++ b/shared/ipc.ts
@@ -198,6 +198,8 @@ export interface EventMap {
stickPosition: import('./types').StickPosition
displayWidth: number
displayHeight: number
+ /** A drag from another app is in progress anywhere on screen (see electron/main/externalDrag.ts). */
+ drag?: boolean
}]
}
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsx
index 6782134..55f26dd 100644
--- a/src/components/ClipboardItem.tsx
+++ b/src/components/ClipboardItem.tsx
@@ -26,6 +26,7 @@ import { basename, formatBytes, previewText, relativeTime, formatImageDisplayNam
import { getFileKind } from '../lib/fileType'
import { playButtonClickSound, playToggleSound, playDeleteSound, playCardExpandSound } from '../lib/soundEffects'
import { CopyIcon, FileKindIcon, FileStackPhoto, PinIcon, PinFillIcon, TrashIcon, MinusIcon, ChevronUpIcon, ChevronLeftIcon, ExpandIcon, ContractIcon, ExternalLinkIcon } from './icons'
+import { DashedOutline } from './DashedOutline'
import { LinkPreviewCard } from './LinkPreviewCard'
import { CodeBlock } from './CodeBlock'
import { StackHeader, StackItems, fileStackEntries, imageCollectionEntries, stackOpenWidth } from './StackItems'
@@ -85,6 +86,9 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
const isPreviewing = useStore((s) => s.previewItemId === item.id)
const isMenuTarget = useStore((s) => s.cardMenu?.itemId === item.id)
+ // In-app drag: the card a drop would merge into, and the whole card being dragged.
+ const isDropTarget = useStore((s) => s.dropTargetId === item.id)
+ const isDragSource = useStore((s) => s.internalDragReq?.id === item.id && !s.internalDragReq.imageId && !s.internalDragReq.paths?.length)
const isBundle = (item.data.kind === 'files' && item.data.paths.length > 1) || item.data.kind === 'image-collection'
const isSingleImage = item.data.kind === 'image' || (
item.data.kind === 'files' &&
@@ -306,7 +310,7 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
}}
initial={false}
animate={{ opacity: 1 }}
- className={`item${item.pinned ? ' pinned' : ''}${isMenuTarget ? ' menu-target' : ''}${isBundle ? ' bundle' : ''}${expanded ? ' is-expanded' : ''}${colorInfo ? ` is-color-card ${colorInfo.isLight ? 'is-light-color' : 'is-dark-color'}` : ''}${isImageFolderCard || isFileCard ? ' is-image-folder-card' : ''}`}
+ className={`item${item.pinned ? ' pinned' : ''}${isMenuTarget ? ' menu-target' : ''}${isDropTarget ? ' is-drop-target' : ''}${isDragSource ? ' is-drag-source' : ''}${isBundle ? ' bundle' : ''}${expanded ? ' is-expanded' : ''}${colorInfo ? ` is-color-card ${colorInfo.isLight ? 'is-light-color' : 'is-dark-color'}` : ''}${isImageFolderCard || isFileCard ? ' is-image-folder-card' : ''}`}
data-expanded-stack={expanded ? 'true' : undefined}
style={{
...(expandedWidth ? { width: expandedWidth, minWidth: expandedWidth, maxWidth: expandedWidth } : {}),
@@ -334,6 +338,11 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
}}
/>
)}
+ {isDropTarget && (
+ <div className="drop-target-ring" aria-hidden="true">
+ <DashedOutline radius={14} />
+ </div>
+ )}
<div
className={`item-main${isPreviewing ? ' force-actions previewing' : ''}`}
data-id={item.id}
diff --git a/src/components/DashedOutline.tsx b/src/components/DashedOutline.tsx
new file mode 100644
index 0000000..b6085b3
--- /dev/null
+++ b/src/components/DashedOutline.tsx
@@ -0,0 +1,27 @@
+/**
+ * The drag targets' dashed line (drop zone, stacking ring, detach edge).
+ *
+ * Drawn as SVG instead of a CSS `dashed` border: a border's dashes are thin
+ * and short with fixed gaps, while a stroke takes its weight, dash length and
+ * gap from one place (`.dashed-outline` in panel.css), the same everywhere.
+ * The outline fills its positioned parent; the line runs along one edge of it.
+ */
+export function DashedOutline({ radius }: { radius: number }) {
+ return (
+ <svg className="dashed-outline" aria-hidden="true" focusable="false">
+ <rect className="dashed-outline-shape" rx={radius} ry={radius} />
+ </svg>
+ )
+}
+
+export function DashedLine({ vertical }: { vertical: boolean }) {
+ return (
+ <svg className="dashed-outline" aria-hidden="true" focusable="false">
+ {vertical ? (
+ <line className="dashed-outline-shape" x1="50%" y1="0" x2="50%" y2="100%" />
+ ) : (
+ <line className="dashed-outline-shape" x1="0" y1="50%" x2="100%" y2="50%" />
+ )}
+ </svg>
+ )
+}
diff --git a/src/components/ItemList.tsx b/src/components/ItemList.tsx
index c0145a8..dcbc409 100644
--- a/src/components/ItemList.tsx
+++ b/src/components/ItemList.tsx
@@ -29,6 +29,7 @@ export function ItemList() {
const total = pinned.length + recent.length
const isDraggingAny = useStore((s) => !!s.dragActive || !!s.internalDragReq)
+ const isDraggingCard = useStore((s) => !!s.internalDragReq)
const stickPosition = useStore((s) => s.settings.stickPosition)
const reduceMotion = useStore((s) => !!s.settings.reduceMotion)
const isHorizontal = stickPosition === 'top'
@@ -338,6 +339,34 @@ export function ItemList() {
stopScrolling()
}
+ // In-app drag: mark the card a drop would stack the dragged card into.
+ // One listener for the whole window instead of enter/leave pairs on every
+ // card: dragover fires on whatever is under the drag (also while it rests),
+ // so the mark follows the drag exactly and clears off any card, outside the
+ // list, or when the drag leaves the window. Text cards never stack.
+ useEffect(() => {
+ if (!isDraggingCard) return
+ const onOver = (e: DragEvent) => {
+ const s = useStore.getState()
+ const card = (e.target as Element | null)?.closest?.('.list .item-main') as HTMLElement | null
+ const id = card?.dataset.id
+ const target = id && s.internalDragReq && id !== s.internalDragReq.id ? s.items.find((it) => it.id === id) : undefined
+ s.setDropTargetId(target && target.data.kind !== 'text' ? target.id : null)
+ }
+ const onLeave = (e: DragEvent) => {
+ if (e.clientX <= 0 || e.clientY <= 0 || e.clientX >= window.innerWidth || e.clientY >= window.innerHeight) {
+ useStore.getState().setDropTargetId(null)
+ }
+ }
+ document.addEventListener('dragover', onOver, true)
+ document.addEventListener('dragleave', onLeave, true)
+ return () => {
+ document.removeEventListener('dragover', onOver, true)
+ document.removeEventListener('dragleave', onLeave, true)
+ useStore.getState().setDropTargetId(null)
+ }
+ }, [isDraggingCard])
+
// A filter or search change replays the list's short fade-in. The list used
// to be keyed on this for that, which destroyed and rebuilt every card on
// each keystroke; keeping it lets unchanged cards stay and replays the same
diff --git a/src/components/Panel.tsx b/src/components/Panel.tsx
index ec4ecb1..09d5a49 100644
--- a/src/components/Panel.tsx
+++ b/src/components/Panel.tsx
@@ -25,6 +25,8 @@ import { CardMenu } from './CardMenu'
import { TagSuggest } from './TagSuggest'
import { CopyIndicatorCurve } from './CopyIndicatorCurve'
import { useFilteredItems } from '../hooks/useFilteredItems'
+import { registerEdgeDragCue } from '../lib/edgeDrag'
+import { DashedLine, DashedOutline } from './DashedOutline'
import { useTranslation } from '../i18n'
@@ -99,13 +101,28 @@ export function Panel() {
const containerRef = useRef<HTMLDivElement>(null)
const showEdgeHint = !!edgeHintActive && (settings.showEdgeLocationHint ?? false)
const showEdgeBeacon = !open && (startupBeacon || showEdgeHint)
+ // A drag from another app is on its way: the bar swells, ready for it
+ // (placed like the beacon, see EdgeDragCue). After the shelf closes it waits
+ // for the close to finish, so it never appears over the shape drawing back.
+ const externalDrag = useStore((s) => s.externalDrag)
+ const [closeSettled, setCloseSettled] = useState(true)
+ useEffect(() => {
+ if (open) {
+ setCloseSettled(false)
+ return
+ }
+ const timer = window.setTimeout(() => setCloseSettled(true), 320)
+ return () => window.clearTimeout(timer)
+ }, [open])
+ const showDragCue = externalDrag && !open && closeSettled && !startupBeacon
const [beaconFrame, setBeaconFrame] = useState<{ left: number; top: number; width: number; height: number } | null>(null)
useLayoutEffect(() => {
- if (!showEdgeBeacon || !containerRef.current) return
+ if (!(showEdgeBeacon || showDragCue) || !containerRef.current) return
const r = containerRef.current.getBoundingClientRect()
setBeaconFrame({ left: r.left, top: r.top, width: r.width, height: r.height })
}, [
showEdgeBeacon,
+ showDragCue,
settings.stickPosition,
settings.panelHeight,
settings.verticalOffset,
@@ -475,6 +492,26 @@ export function Panel() {
</motion.div>
)}
</AnimatePresence>
+ <AnimatePresence>
+ {showDragCue && beaconFrame && (
+ <motion.div
+ key="edge-drag-cue"
+ initial={{ opacity: 1 }}
+ exit={{ opacity: 0, transition: { duration: reduceMotion ? 0.01 : 0.14 } }}
+ style={{ position: 'absolute', ...beaconFrame, pointerEvents: 'none', zIndex: 11 }}
+ >
+ <div
+ style={
+ isHorizontal
+ ? { position: 'absolute', left: insetLeft, right: insetRight, top: 0, height: hotWidth }
+ : { position: 'absolute', top: insetTop, bottom: insetBottom, [isRight ? 'right' : 'left']: 0, width: hotWidth }
+ }
+ >
+ <EdgeDragCue side={isHorizontal ? 'top' : isRight ? 'right' : 'left'} barPx={hotWidth} />
+ </div>
+ </motion.div>
+ )}
+ </AnimatePresence>
<div
ref={containerRef}
className={containerClass}
@@ -638,7 +675,7 @@ export function Panel() {
)}
</AnimatePresence>
</div>
- <DropOverlay />
+ <DropOverlay isHorizontal={isHorizontal} />
<SplitDropZone stickPosition={settings.stickPosition || (isRight ? 'right' : 'left')} />
</div>
<PreviewFlyout isRight={isRight} />
@@ -669,60 +706,113 @@ function getTutorialText(step: number): string {
}
*/
-function DropOverlay() {
+/**
+ * The edge bar getting ready for a drag from another app: a slightly wider,
+ * lit pill over the bar (same look as the launch beacon) that grows as the
+ * drag gets closer (--pull, written by lib/edgeDrag.ts without a render).
+ */
+function EdgeDragCue({ side, barPx }: { side: 'left' | 'right' | 'top'; barPx: number }) {
+ const ref = useRef<HTMLDivElement>(null)
+ useLayoutEffect(() => {
+ registerEdgeDragCue(ref.current)
+ return () => registerEdgeDragCue(null)
+ }, [])
+ return (
+ <div
+ ref={ref}
+ data-edge-drag-cue=""
+ className={`edge-drag-cue side-${side}`}
+ style={{ '--bar': `${barPx}px`, '--barn': barPx } as React.CSSProperties}
+ />
+ )
+}
+
+/** Tray with an arrow dropping into it; the arrow is its own group so it can move. */
+function TrayArrowIcon() {
+ return (
+ <svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
+ <g className="drop-arrow">
+ <path d="M12 3.25v9" />
+ <path d="m8.25 8.75 3.75 3.75 3.75-3.75" />
+ </g>
+ <path d="M3.5 14h4.1l1.6 2.6h5.6l1.6-2.6h4.1" />
+ <path d="M3.5 14v3.75a2.25 2.25 0 0 0 2.25 2.25h12.5a2.25 2.25 0 0 0 2.25-2.25V14l-2.1-5.1" />
+ <path d="M5.6 8.9 3.5 14" />
+ </svg>
+ )
+}
+
+/**
+ * Drop zone for anything dragged in from another app: a dashed well over the
+ * dimmed shelf. It is up from the first frame of an open caused by the drag
+ * (the content veil reveals it with the shelf), lights up once the drag is
+ * over the shelf, and on a drop it takes the item in (the well tightens, the
+ * arrow sinks into the tray) before handing over to the new card.
+ */
+function DropOverlay({ isHorizontal }: { isHorizontal: boolean }) {
const { t } = useTranslation()
- const dragActive = useStore((s) => s.dragActive)
- const internalDragReq = useStore((s) => s.internalDragReq)
+ const open = useStore((s) => s.open)
+ const incoming = useStore((s) => !s.internalDragReq && (s.externalDrag || s.dragActive))
+ const over = useStore((s) => s.dragActive && !s.internalDragReq)
+ const reduceMotion = useStore((s) => !!s.settings.reduceMotion)
+ const [accepted, setAccepted] = useState(false)
+ // Once up, the zone stays when the drag goes away without a drop (it left
+ // the shelf, was let go elsewhere or cancelled): either the shelf then
+ // closes, and the zone stays until the shape has drawn back (320ms) so no
+ // cards show through the collapse; or the shelf stays open (the pointer is
+ // still on it), and after the close grace has passed (GRACE_MS 250 in
+ // useEdgeHover, plus margin) the zone fades and the cards return. A drop
+ // hands over to the accept instead.
+ const [held, setHeld] = useState(false)
+ useEffect(() => {
+ if (accepted) {
+ if (held) setHeld(false)
+ return
+ }
+ if (open && incoming) {
+ if (!held) setHeld(true)
+ return
+ }
+ if (!held) return
+ const timer = window.setTimeout(() => setHeld(false), open ? 450 : 320)
+ return () => window.clearTimeout(timer)
+ }, [open, incoming, held, accepted])
+ const visible = held || (open && incoming)
+
+ useEffect(() => {
+ if (!visible) return
+ // Capture phase: the preload's own drop handler stops nothing for drops
+ // from other apps, so this sees each of them.
+ const onDrop = () => setAccepted(true)
+ document.addEventListener('drop', onDrop, true)
+ return () => document.removeEventListener('drop', onDrop, true)
+ }, [visible])
+ useEffect(() => {
+ if (!accepted) return
+ const timer = window.setTimeout(() => setAccepted(false), reduceMotion ? 0 : 240)
+ return () => window.clearTimeout(timer)
+ }, [accepted, reduceMotion])
return (
<AnimatePresence>
- {dragActive && !internalDragReq && (
+ {(visible || accepted) && (
<motion.div
+ key="drop-overlay"
+ className={`drop-overlay${isHorizontal ? ' is-horizontal' : ''}${over ? ' is-over' : ''}${accepted ? ' is-accepted' : ''}`}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
- transition={{ duration: 0.2 }}
- style={{
- position: 'absolute',
- inset: 0,
- zIndex: 100,
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- justifyContent: 'center',
- gap: '14px',
- pointerEvents: 'none',
- background: 'rgba(6, 6, 8, 0.95)',
- textAlign: 'center',
- padding: '24px'
- }}
+ transition={{ duration: reduceMotion ? 0.01 : accepted ? 0.2 : 0.14, ease: [0.22, 1, 0.36, 1] }}
>
- <div
- style={{
- width: '52px',
- height: '52px',
- borderRadius: '16px',
- background: 'rgba(255, 255, 255, 0.05)',
- border: '1px solid rgba(255, 255, 255, 0.1)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- color: 'rgba(255, 255, 255, 0.9)'
- }}
- >
- <svg width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
- <path d="M12 3v13"></path>
- <path d="m8 12 4 4 4-4"></path>
- <path d="M4 20h16"></path>
- </svg>
- </div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
- <div style={{ fontSize: '15px', fontWeight: 600, color: 'rgba(255, 255, 255, 0.95)', letterSpacing: '0.01em' }}>
- {t('item.dropToSave')}
- </div>
- <div style={{ fontSize: '12px', fontWeight: 400, color: 'rgba(255, 255, 255, 0.5)', lineHeight: 1.4 }}>
- {t('item.dropToSaveDesc')}
- </div>
+ <div className="drop-well">
+ <DashedOutline radius={16} />
+ <span className="drop-icon">
+ <TrayArrowIcon />
+ </span>
+ <span className="drop-text">
+ <span className="drop-title">{t('item.dropToSave')}</span>
+ <span className="drop-sub">{t('item.dropToSaveDesc')}</span>
+ </span>
</div>
</motion.div>
)}
@@ -730,8 +820,15 @@ function DropOverlay() {
)
}
+/**
+ * Detach target while a card is dragged out of an open stack: the edge of the
+ * shelf that meets the screen edge (where you drag it to) gets the drop
+ * zone's dashed line, lit while the card is over it. The whole strip along
+ * that edge takes the drop; only the line is drawn.
+ */
function SplitDropZone({ stickPosition = 'left' }: { stickPosition?: 'left' | 'right' | 'top' }) {
const internalDragReq = useStore((s) => s.internalDragReq)
+ const reduceMotion = useStore((s) => !!s.settings.reduceMotion)
const isSubitemDragging = !!(
internalDragReq &&
(internalDragReq.imageId || (internalDragReq.paths && internalDragReq.paths.length > 0))
@@ -744,7 +841,9 @@ function SplitDropZone({ stickPosition = 'left' }: { stickPosition?: 'left' | 'r
setIsOver(true)
}
- const handleDragLeave = () => {
+ const handleDragLeave = (e: React.DragEvent) => {
+ const related = e.relatedTarget as Node | null
+ if (related && e.currentTarget.contains(related)) return
setIsOver(false)
}
@@ -759,48 +858,8 @@ function SplitDropZone({ stickPosition = 'left' }: { stickPosition?: 'left' | 'r
}
}
- const isTop = stickPosition === 'top'
- const isRight = stickPosition === 'right'
-
- // Orientation alignment:
- // When dock is on LEFT, drop zone is on the LEFT (-15px x-offset)
- // When dock is on RIGHT, drop zone is on the RIGHT (+15px x-offset)
- // When dock is on TOP, drop zone is at the TOP (-15px y-offset)
- const initialMotion = isTop
- ? { opacity: 0, y: -15 }
- : isRight
- ? { opacity: 0, x: 15 }
- : { opacity: 0, x: -15 }
-
- const exitMotion = initialMotion
-
- const styleByPos: React.CSSProperties = isTop
- ? {
- top: 0,
- left: 0,
- right: 0,
- height: isOver ? 72 : 56,
- flexDirection: 'column',
- alignItems: 'center',
- justifyContent: 'flex-start'
- }
- : isRight
- ? {
- top: 0,
- bottom: 0,
- right: 0,
- width: isOver ? 100 : 80,
- justifyContent: 'flex-end',
- alignItems: 'center'
- }
- : {
- top: 0,
- bottom: 0,
- left: 0,
- width: isOver ? 100 : 80,
- justifyContent: 'flex-start',
- alignItems: 'center'
- }
+ // Slides in from the edge it belongs to.
+ const offset = stickPosition === 'top' ? { y: -8 } : stickPosition === 'right' ? { x: 8 } : { x: -8 }
return (
<AnimatePresence>
@@ -814,13 +873,14 @@ function SplitDropZone({ stickPosition = 'left' }: { stickPosition?: 'left' | 'r
onDragEnter={handleDragEnter}
onDragLeave={handleDragLeave}
onDrop={handleDrop}
- initial={initialMotion}
+ initial={{ opacity: 0, ...offset }}
animate={{ opacity: 1, x: 0, y: 0 }}
- exit={exitMotion}
- transition={{ type: 'spring', stiffness: 350, damping: 25 }}
- style={styleByPos}
+ exit={{ opacity: 0, ...offset }}
+ transition={reduceMotion ? { duration: 0.01 } : { type: 'spring', stiffness: 420, damping: 34 }}
>
- <div className="glow-line" />
+ <div className="split-line">
+ <DashedLine vertical={stickPosition !== 'top'} />
+ </div>
</motion.div>
)}
</AnimatePresence>
diff --git a/src/hooks/useEdgeHover.ts b/src/hooks/useEdgeHover.ts
index 2d80af1..ce50736 100644
--- a/src/hooks/useEdgeHover.ts
+++ b/src/hooks/useEdgeHover.ts
@@ -19,11 +19,15 @@
* before React's mouseleave has a chance to fire.
*
* Drag-awareness: while an external OS file drag is active we never close.
+ * A drag from another app is also seen before it reaches the window (main
+ * flags it on every cursor update): the edge bar gets ready for it, and at
+ * the bar the shelf opens straight into its drop zone (see lib/edgeDrag.ts).
*/
import { useEffect, useRef } from 'react'
import { edge } from '../lib/edge'
import { useStore } from '../store/appStore'
import { normalizeHoverOpenDelay } from '../../shared/types'
+import { DRAG_CATCH_DWELL_MS, edgeDragPull, inEdgeDragCatch, setEdgeDragPull, type EdgeDragLane } from '../lib/edgeDrag'
const TRIGGER_PX = 3 // leftmost px that count as "the edge"
const DWELL_MS = 40 // cursor must linger this long to open (base; user delay adds on top)
@@ -286,6 +290,7 @@ export function useEdgeHover(): void {
let dwellTimer: number | undefined
let graceTimer: number | undefined
let interactiveTimer: number | undefined
+ let dragOpenTimer: number | undefined
const closePanelNow = () => {
const s = useStore.getState()
@@ -522,6 +527,13 @@ export function useEdgeHover(): void {
// 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 clearDragOpen = () => {
+ if (dragOpenTimer !== undefined) {
+ window.clearTimeout(dragOpenTimer)
+ dragOpenTimer = undefined
+ }
+ }
+
const unsubCursorEdge = window.edge.onCursorEdge((data) => {
lastClient.current = { x: data.x, y: data.y }
if (data.displayWidth) displaySize.current.width = data.displayWidth
@@ -530,6 +542,36 @@ export function useEdgeHover(): void {
const { stickPosition, displayWidth } = data
const { top, bottom, midY, panelHalfH } = zone.current
+ // ── A drag from another app (anywhere on screen) ─────────────────────
+ // Follows the hover setting: with hover opening off, cursor moves never
+ // open the shelf, dragged or not.
+ const drag = !!data.drag && !state.internalDragReq && (state.settings.hoverActivation ?? true)
+ if (state.externalDrag !== drag) state.setExternalDrag(drag)
+ if (drag && !state.open) {
+ const dispW = displayWidth || displaySize.current.width
+ const s = state.settings
+ const bar = stickPosition === 'top'
+ ? getHorizontalDockMetrics(dispW, s.horizontalOffset ?? 0.5, s.hotZoneHeight ?? 0.25, s.triggerAlignment || 'center')
+ : null
+ const lane: EdgeDragLane = bar
+ ? { stickPosition: 'top', start: bar.triggerLeft, end: bar.triggerRight, displayWidth: dispW }
+ : { stickPosition: stickPosition === 'right' ? 'right' : 'left', start: top, end: bottom, displayWidth: dispW }
+ setEdgeDragPull(edgeDragPull(lane, data.x, data.y))
+ if (inEdgeDragCatch(lane, data.x, data.y)) {
+ if (dragOpenTimer === undefined) {
+ dragOpenTimer = window.setTimeout(() => {
+ dragOpenTimer = undefined
+ if (useStore.getState().externalDrag) openPanel()
+ }, DRAG_CATCH_DWELL_MS)
+ }
+ } else {
+ clearDragOpen()
+ }
+ } else {
+ clearDragOpen()
+ if (!drag) setEdgeDragPull(0)
+ }
+
// The card menu (or its label editor) is part of the shelf while open.
if (state.open && state.cardMenu && cardMenuHolds(state.cardMenu, state.cardMenuRect, cursorInWindow(state, data), windowHasKeyboard())) {
const now = Date.now()
@@ -825,6 +867,7 @@ export function useEdgeHover(): void {
window.clearTimeout(dwellTimer)
window.clearTimeout(graceTimer)
window.clearTimeout(interactiveTimer)
+ window.clearTimeout(dragOpenTimer)
}
}, [])
}
diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts
index b9d0b2e..96d2efa 100644
--- a/src/i18n/translations.ts
+++ b/src/i18n/translations.ts
@@ -846,7 +846,7 @@ export const en: TranslationKeys = {
"stacksTitle": "Explore File Stacks",
"stacksDesc": "Copying multiple files groups them into a stack. You can drag the entire stack, or click it to view and extract individual files.",
"ungroupTitle": "Ungroup & Split Stacks",
- "ungroupDesc": "Want to separate items in a stack? Click to expand the stack, then drag any subitem to the left edge of the screen. A glowing coral bar will appear—drop the item on it to extract it back into a standalone card.",
+ "ungroupDesc": "Want to separate items in a stack? Click to expand the stack, then drag any subitem to the left edge of the screen. A glowing bar will appear—drop the item on it to extract it back into a standalone card.",
"mergeTitle": "Combine & Merge Items",
"mergeDesc": "Combine separate file or image cards by dragging them directly onto each other. This organizes your shelf by bundling related assets into a stack.",
"previewTitle": "Preview Flyout",
@@ -1250,7 +1250,7 @@ export const es: TranslationKeys = {
"stacksTitle": "Explorar pilas de archivos",
"stacksDesc": "Copiar varios archivos los agrupa en una pila. Puedes arrastrar toda la pila o hacer clic para ver y extraer archivos individuales.",
"ungroupTitle": "Separar y dividir pilas",
- "ungroupDesc": "¿Quieres separar elementos de una pila? Haz clic para expandirla y arrastra cualquier subelemento al borde izquierdo de la pantalla. Aparecerá una barra coral brillante; suelta el elemento sobre ella para extraerlo como tarjeta independiente.",
+ "ungroupDesc": "¿Quieres separar elementos de una pila? Haz clic para expandirla y arrastra cualquier subelemento al borde izquierdo de la pantalla. Aparecerá una barra brillante; suelta el elemento sobre ella para extraerlo como tarjeta independiente.",
"mergeTitle": "Combinar y fusionar elementos",
"mergeDesc": "Combina tarjetas independientes de archivos o imágenes arrastrándolas directamente unas sobre otras. Esto organiza tu panel agrupando recursos relacionados en una pila.",
"previewTitle": "Panel de vista previa",
@@ -1654,7 +1654,7 @@ export const fr: TranslationKeys = {
"stacksTitle": "Explorez les piles de fichiers",
"stacksDesc": "Copier plusieurs fichiers les regroupe en une pile. Vous pouvez glisser toute la pile ou cliquer dessus pour voir et extraire les fichiers individuels.",
"ungroupTitle": "Dégrouper et séparer les piles",
- "ungroupDesc": "Vous souhaitez séparer des éléments d'une pile ? Cliquez pour développer la pile, puis glissez tout sous-élément vers le bord gauche de l'écran. Une barre corail lumineuse apparaîtra ; déposez l'élément dessus pour le réextraire en carte autonome.",
+ "ungroupDesc": "Vous souhaitez séparer des éléments d'une pile ? Cliquez pour développer la pile, puis glissez tout sous-élément vers le bord gauche de l'écran. Une barre lumineuse apparaîtra ; déposez l'élément dessus pour le réextraire en carte autonome.",
"mergeTitle": "Combiner et fusionner des éléments",
"mergeDesc": "Combinez des cartes de fichiers ou d'images distinctes en les glissant directement les unes sur les autres. Cela organise votre étagère en regroupant les ressources associées dans une pile.",
"previewTitle": "Volet d'aperçu",
@@ -2058,7 +2058,7 @@ export const de: TranslationKeys = {
"stacksTitle": "Datei-Stapel erkunden",
"stacksDesc": "Das Kopieren mehrerer Dateien gruppiert sie zu einem Stapel. Sie können den gesamten Stapel ziehen oder darauf klicken, um einzelne Dateien anzuzeigen und zu extrahieren.",
"ungroupTitle": "Stapel lösen & teilen",
- "ungroupDesc": "Möchten Sie Elemente in einem Stapel trennen? Klicken Sie, um den Stapel zu erweitern, und ziehen Sie dann ein Unterelement an den linken Bildschirmrand. Ein leuchtender Korallenbalken erscheint — legen Sie das Element darauf ab, um es als eigenständige Karte zu extrahieren.",
+ "ungroupDesc": "Möchten Sie Elemente in einem Stapel trennen? Klicken Sie, um den Stapel zu erweitern, und ziehen Sie dann ein Unterelement an den linken Bildschirmrand. Ein leuchtender Balken erscheint — legen Sie das Element darauf ab, um es als eigenständige Karte zu extrahieren.",
"mergeTitle": "Elemente kombinieren & zusammenführen",
"mergeDesc": "Kombinieren Sie separate Datei- oder Bildkarten, indem Sie sie direkt übereinander ziehen. Dadurch wird Ihre Ablage organisiert, indem verwandte Objekte zu einem Stapel gebündelt werden.",
"previewTitle": "Vorschau-Flyout",
@@ -2462,7 +2462,7 @@ export const it: TranslationKeys = {
"stacksTitle": "Esplora le pile di file",
"stacksDesc": "La copia di più file li raggruppa in una pila. Puoi trascinare l'intera pila o fare clic per visualizzare ed estrarre singoli file.",
"ungroupTitle": "Separa e dividi le pile",
- "ungroupDesc": "Vuoi separare elementi in una pila? Fai clic per espandere la pila, quindi trascina qualsiasi sotto-elemento verso il bordo sinistro dello schermo. Apparirà una barra corallo luminosa — rilascia l'elemento su di essa per estrarlo di nuovo come scheda autonoma.",
+ "ungroupDesc": "Vuoi separare elementi in una pila? Fai clic per espandere la pila, quindi trascina qualsiasi sotto-elemento verso il bordo sinistro dello schermo. Apparirà una barra luminosa — rilascia l'elemento su di essa per estrarlo di nuovo come scheda autonoma.",
"mergeTitle": "Combina e unisci elementi",
"mergeDesc": "Combina schede separate di file o immagini trascinandole direttamente l'una sull'altra. In questo modo organizzi lo scaffale raggruppando le risorse correlate in una pila.",
"previewTitle": "Pannello di anteprima",
@@ -2866,7 +2866,7 @@ export const pt: TranslationKeys = {
"stacksTitle": "Explore pilhas de arquivos",
"stacksDesc": "Copiar vários arquivos os agrupa em uma pilha. Você pode arrastar a pilha inteira ou clicar nela para visualizar e extrair arquivos individuais.",
"ungroupTitle": "Desagrupar e dividir pilhas",
- "ungroupDesc": "Quer separar itens de uma pilha? Clique para expandir a pilha e arraste qualquer subitem para a borda esquerda da tela. Uma barra coral brilhante aparecerá — solte o item nela para extraí-lo de volta como um cartão autônomo.",
+ "ungroupDesc": "Quer separar itens de uma pilha? Clique para expandir a pilha e arraste qualquer subitem para a borda esquerda da tela. Uma barra brilhante aparecerá — solte o item nela para extraí-lo de volta como um cartão autônomo.",
"mergeTitle": "Combinar e mesclar itens",
"mergeDesc": "Combine cartões separados de arquivos ou imagens arrastando-os diretamente uns sobre os outros. Isso organiza sua prateleira agrupando recursos relacionados em uma pilha.",
"previewTitle": "Painel de visualização",
@@ -3270,7 +3270,7 @@ export const ru: TranslationKeys = {
"stacksTitle": "Изучайте стопки файлов",
"stacksDesc": "Копирование нескольких файлов объединяет их в стопку. Вы можете перетащить всю стопку или щёлкнуть её, чтобы просмотреть и извлечь отдельные файлы.",
"ungroupTitle": "Разгруппировывайте и разделяйте стопки",
- "ungroupDesc": "Хотите разделить элементы стопки? Щёлкните, чтобы развернуть стопку, затем перетащите любой подэлемент к левому краю экрана. Появится светящаяся коралловая полоса — перетащите элемент на неё, чтобы извлечь его обратно как отдельную карточку.",
+ "ungroupDesc": "Хотите разделить элементы стопки? Щёлкните, чтобы развернуть стопку, затем перетащите любой подэлемент к левому краю экрана. Появится светящаяся полоса — перетащите элемент на неё, чтобы извлечь его обратно как отдельную карточку.",
"mergeTitle": "Объединяйте и сливайте элементы",
"mergeDesc": "Объединяйте отдельные карточки файлов или изображений, перетаскивая их друг на друга. Это упорядочивает вашу полку, объединяя связанные ресурсы в стопку.",
"previewTitle": "Панель предпросмотра",
@@ -4078,7 +4078,7 @@ export const ko: TranslationKeys = {
"stacksTitle": "파일 스택 살펴보기",
"stacksDesc": "여러 파일을 복사하면 하나의 스택으로 묶입니다. 전체 스택을 드래그하거나 클릭하여 개별 파일을 보고 추출할 수 있습니다.",
"ungroupTitle": "스택 분리 및 나누기",
- "ungroupDesc": "스택의 항목을 분리하고 싶나요? 클릭하여 스택을 펼친 뒤 서브 항목을 화면 왼쪽 가장자리로 드래그하세요. 빛나는 코랄색 막대가 나타나면 그 위에 항목을 드롭하여 개별 카드로 다시 추출하세요.",
+ "ungroupDesc": "스택의 항목을 분리하고 싶나요? 클릭하여 스택을 펼친 뒤 서브 항목을 화면 왼쪽 가장자리로 드래그하세요. 빛나는 막대가 나타나면 그 위에 항목을 드롭하여 개별 카드로 다시 추출하세요.",
"mergeTitle": "항목 결합 및 병합",
"mergeDesc": "별도의 파일 또는 이미지 카드를 서로 직접 드래그하여 결합하세요. 관련 자산을 스택으로 묶어 선반을 정리합니다.",
"previewTitle": "미리보기 플라이아웃",
@@ -4482,7 +4482,7 @@ export const zhCN: TranslationKeys = {
"stacksTitle": "探索文件堆栈",
"stacksDesc": "复制多个文件会将它们组合为堆栈。您可以拖动整个堆栈,或点击它查看并提取单个文件。",
"ungroupTitle": "取消分组并拆分堆栈",
- "ungroupDesc": "想分离堆栈中的项?点击展开堆栈,然后将任意子项拖到屏幕左边缘。会出现一条发光的珊瑚色条—将项拖放到上面即可将其提取为独立卡片。",
+ "ungroupDesc": "想分离堆栈中的项?点击展开堆栈,然后将任意子项拖到屏幕左边缘。会出现一条发光条—将项拖放到上面即可将其提取为独立卡片。",
"mergeTitle": "组合并合并项",
"mergeDesc": "通过将独立的文件或图片卡片直接拖到彼此上来组合它们。这样可以将相关资源捆绑到堆栈中以整理搁架。",
"previewTitle": "预览浮出窗",
@@ -4886,7 +4886,7 @@ export const zhTW: TranslationKeys = {
"stacksTitle": "探索檔案堆疊",
"stacksDesc": "複製多個檔案會將它們組合為堆疊。您可以拖動整個堆疊,或點擊它檢視並提取單個檔案。",
"ungroupTitle": "取消分組並拆分堆疊",
- "ungroupDesc": "想分離堆疊中的項目?點擊展開堆疊,然後將任意子項目拖到螢幕左邊緣。會出現一條發光的珊瑚色條—將項目拖放到上面即可將其提取為獨立卡片。",
+ "ungroupDesc": "想分離堆疊中的項目?點擊展開堆疊,然後將任意子項目拖到螢幕左邊緣。會出現一條發光條—將項目拖放到上面即可將其提取為獨立卡片。",
"mergeTitle": "組合並合併項目",
"mergeDesc": "通過將獨立的檔案或圖片卡片直接拖到彼此上來組合它們。這樣可以將相關資源捆綁到堆疊中以整理層架。",
"previewTitle": "預覽浮出窗",
@@ -5290,7 +5290,7 @@ export const hi: TranslationKeys = {
"stacksTitle": "फ़ाइल स्टैक एक्सप्लोर करें",
"stacksDesc": "एकाधिक फ़ाइलें कॉपी करने से उन्हें एक स्टैक में समूहित कर देता है। आप पूरे स्टैक को खींच सकते हैं, या अलग-अलग फ़ाइलें देखने और निकालने के लिए उस पर क्लिक कर सकते हैं।",
"ungroupTitle": "स्टैक अलग करें और विभाजित करें",
- "ungroupDesc": "स्टैक में आइटम अलग करना चाहते हैं? स्टैक विस्तारित करने के लिए क्लिक करें, फिर किसी भी सबआइटम को स्क्रीन के बाएँ किनारे पर खींचें। एक चमकती कोरल पट्टी दिखाई देगी—आइटम को वापस अलग कार्ड में निकालने के लिए उस पर छोड़ दें।",
+ "ungroupDesc": "स्टैक में आइटम अलग करना चाहते हैं? स्टैक विस्तारित करने के लिए क्लिक करें, फिर किसी भी सबआइटम को स्क्रीन के बाएँ किनारे पर खींचें। एक चमकती पट्टी दिखाई देगी—आइटम को वापस अलग कार्ड में निकालने के लिए उस पर छोड़ दें।",
"mergeTitle": "आइटम संयोजित और मर्ज करें",
"mergeDesc": "अलग फ़ाइल या छवि कार्ड को सीधे एक-दूसरे पर खींचकर संयोजित करें। यह संबंधित एसेट को स्टैक में बाँधकर आपकी शेल्फ़ को व्यवस्थित करता है।",
"previewTitle": "प्रीव्यू फ्लाईआउट",
@@ -5694,7 +5694,7 @@ export const ar: TranslationKeys = {
"stacksTitle": "استكشف مكدسات الملفات",
"stacksDesc": "نسخ ملفات متعددة يجمعها في مكدس. يمكنك سحب المكدس بأكمله أو النقر عليه لعرض الملفات واستخراجها فردياً.",
"ungroupTitle": "إلغاء التجميع وفصل المكدسات",
- "ungroupDesc": "تريد فصل العناصر في مكدس؟ انقر لتوسيع المكدس، ثم اسحب أي عنصر فرعي إلى الحافة اليسرى للشاشة. سيظهر شريط مرجاني متوهج—أفلت العنصر عليه لاستخراجه كبطاقة مستقلة.",
+ "ungroupDesc": "تريد فصل العناصر في مكدس؟ انقر لتوسيع المكدس، ثم اسحب أي عنصر فرعي إلى الحافة اليسرى للشاشة. سيظهر شريط متوهج—أفلت العنصر عليه لاستخراجه كبطاقة مستقلة.",
"mergeTitle": "دمج العناصر",
"mergeDesc": "ادمج بطاقات ملفات أو صور منفصلة بسحبها مباشرة فوق بعضها. ينظّم ذلك رفّك بجمع الأصول ذات الصلة في مكدس.",
"previewTitle": "لوحة المعاينة",
@@ -6098,7 +6098,7 @@ export const fa: TranslationKeys = {
"stacksTitle": "دسته‌های فایل رو ببین",
"stacksDesc": "چندتا فایل رو باهم کپی کنی، توی یه دسته جمع می‌شن. می‌تونی کل دسته رو بکشی یا روش کلیک کنی و فایل‌ها رو جداجدا برداری.",
"ungroupTitle": "دسته‌ها رو از هم باز کن",
- "ungroupDesc": "می‌خوای یکی از آیتم‌های یه دسته رو جدا کنی؟ دسته رو باز کن، بعد آیتم موردنظرت رو بکش سمت لبه چپ صفحه. یه نوار مرجانیِ روشن ظاهر می‌شه؛ آیتم رو بنداز روش تا به‌صورت یه کارت جدا دربیاد.",
+ "ungroupDesc": "می‌خوای یکی از آیتم‌های یه دسته رو جدا کنی؟ دسته رو باز کن، بعد آیتم موردنظرت رو بکش سمت لبه چپ صفحه. یه نوار روشن ظاهر می‌شه؛ آیتم رو بنداز روش تا به‌صورت یه کارت جدا دربیاد.",
"mergeTitle": "آیتم‌ها رو باهم یکی کن",
"mergeDesc": "کارت‌های جداگانه فایل یا عکس رو مستقیم بنداز روی هم تا یکی بشن. این‌طوری آیتم‌های مرتبط توی یه دسته می‌مونن و قفسه مرتب‌تر می‌شه.",
"previewTitle": "پیش‌نمایش کناری",
@@ -6502,7 +6502,7 @@ export const bn: TranslationKeys = {
"stacksTitle": "ফাইল স্ট্যাক অন্বেষণ করুন",
"stacksDesc": "একাধিক ফাইল কপি করলে সেগুলি একটি স্ট্যাকে গোষ্ঠীভুক্ত হয়। আপনি পুরো স্ট্যাক টেনে আনতে পারেন বা ব্যক্তিগত ফাইল দেখতে ও বের করতে এতে ক্লিক করতে পারেন।",
"ungroupTitle": "স্ট্যাক আনগ্রুপ ও বিভক্ত করুন",
- "ungroupDesc": "স্ট্যাকে আইটেমগুলি আলাদা করতে চান? স্ট্যাক প্রসারিত করতে ক্লিক করুন, তারপর যেকোনো সাবআইটেম স্ক্রিনের বাম প্রান্তে টেনে আনুন। একটি উজ্জ্বল কোরাল বার আবির্ভূত হবে—আইটেমটিকে স্বতন্ত্র কার্ড হিসাবে ফিরে আনতে এতে ছেড়ে দিন।",
+ "ungroupDesc": "স্ট্যাকে আইটেমগুলি আলাদা করতে চান? স্ট্যাক প্রসারিত করতে ক্লিক করুন, তারপর যেকোনো সাবআইটেম স্ক্রিনের বাম প্রান্তে টেনে আনুন। একটি উজ্জ্বল বার আবির্ভূত হবে—আইটেমটিকে স্বতন্ত্র কার্ড হিসাবে ফিরে আনতে এতে ছেড়ে দিন।",
"mergeTitle": "আইটেম একত্রিত ও মার্জ করুন",
"mergeDesc": "আলাদা ফাইল বা ছবি কার্ড সরাসরি একে অপরের উপর টেনে এনে একত্রিত করুন। এটি সম্পর্কিত অ্যাসেটগুলিকে স্ট্যাকে বাঁধাই করে আপনার শেলফ সংগঠিত করে।",
"previewTitle": "প্রিভিউ ফ্লাইআউট",
@@ -6906,7 +6906,7 @@ export const tr: TranslationKeys = {
"stacksTitle": "Dosya Yığınlarını Keşfet",
"stacksDesc": "Birden çok dosya kopyalamak onları bir yığında gruplandırır. Tüm yığını sürükleyebilir veya tek tek dosyaları görüntülemek ve çıkarmak için tıklayabilirsiniz.",
"ungroupTitle": "Yığınları Ayır ve Böl",
- "ungroupDesc": "Yığındaki öğeleri ayırmak mı istiyorsunuz? Yığını genişletmek için tıklayın, ardından herhangi bir alt öğeyi ekranın sol kenarına sürükleyin. Parlayan mercan bir çubuk belirecek—öğeyi bağımsız bir kart olarak geri çıkarmak için üzerine bırakın.",
+ "ungroupDesc": "Yığındaki öğeleri ayırmak mı istiyorsunuz? Yığını genişletmek için tıklayın, ardından herhangi bir alt öğeyi ekranın sol kenarına sürükleyin. Parlayan bir çubuk belirecek—öğeyi bağımsız bir kart olarak geri çıkarmak için üzerine bırakın.",
"mergeTitle": "Öğeleri Birleştir ve Kaynaştır",
"mergeDesc": "Ayrı dosya veya görsel kartlarını doğrudan birbirinin üzerine sürükleyerek birleştirin. Bu, ilgili varlıkları bir yığında bağlayarak rafınızı düzenler.",
"previewTitle": "Önizleme Paneli",
@@ -7310,7 +7310,7 @@ export const vi: TranslationKeys = {
"stacksTitle": "Khám phá Ngăn xếp Tệp",
"stacksDesc": "Sao chép nhiều tệp sẽ nhóm chúng thành một ngăn xếp. Bạn có thể kéo toàn bộ ngăn xếp hoặc nhấp vào nó để xem và trích xuất từng tệp.",
"ungroupTitle": "Tách và chia Ngăn xếp",
- "ungroupDesc": "Muốn tách các mục trong ngăn xếp? Nhấp để mở rộng ngăn xếp, sau đó kéo bất kỳ mục con nào đến mép trái màn hình. Một thanh san hô phát sáng sẽ xuất hiện — thả mục lên đó để trích xuất lại thành thẻ độc lập.",
+ "ungroupDesc": "Muốn tách các mục trong ngăn xếp? Nhấp để mở rộng ngăn xếp, sau đó kéo bất kỳ mục con nào đến mép trái màn hình. Một thanh phát sáng sẽ xuất hiện — thả mục lên đó để trích xuất lại thành thẻ độc lập.",
"mergeTitle": "Kết hợp & Gộp Mục",
"mergeDesc": "Kết hợp các thẻ tệp hoặc hình ảnh riêng biệt bằng cách kéo chúng trực tiếp lên nhau. Việc này sắp xếp giá của bạn bằng cách đóng gói các tài sản liên quan vào một ngăn xếp.",
"previewTitle": "Bảng xem trước",
@@ -7714,7 +7714,7 @@ export const pl: TranslationKeys = {
"stacksTitle": "Odkrywaj stosy plików",
"stacksDesc": "Kopiowanie wielu plików grupuje je w stos. Możesz przeciągnąć cały stos lub kliknąć go, aby wyświetlić i wyodrębnić poszczególne pliki.",
"ungroupTitle": "Rozgrupowuj i dziel stosy",
- "ungroupDesc": "Chcesz oddzielić elementy w stosie? Kliknij, aby rozwinąć stos, a następnie przeciągnij dowolny podelement na lewą krawędź ekranu. Pojawi się świecący koralowy pasek — upuść na nim element, aby wyodrębnić go z powrotem jako samodzielną kartę.",
+ "ungroupDesc": "Chcesz oddzielić elementy w stosie? Kliknij, aby rozwinąć stos, a następnie przeciągnij dowolny podelement na lewą krawędź ekranu. Pojawi się świecący pasek — upuść na nim element, aby wyodrębnić go z powrotem jako samodzielną kartę.",
"mergeTitle": "Łącz i scalaj elementy",
"mergeDesc": "Łącz osobne karty plików lub obrazów, przeciągając je bezpośrednio jedna na drugą. To organizuje Twoją półkę, wiążąc powiązane zasoby w stos.",
"previewTitle": "Panel podglądu",
@@ -8118,7 +8118,7 @@ export const nl: TranslationKeys = {
"stacksTitle": "Verken bestandsstapels",
"stacksDesc": "Meerdere bestanden kopiëren groepeert ze in een stapel. Je kunt de hele stapel slepen of erop klikken om individuele bestanden te bekijken en te extraheren.",
"ungroupTitle": "Stapels losmaken en splitsen",
- "ungroupDesc": "Items in een stapel scheiden? Klik om de stapel uit te vouwen en sleep vervolgens een subitem naar de linkerrand van het scherm. Er verschijnt een gloeiende koraalbalk — laat het item erop vallen om het terug te extraheren als zelfstandige kaart.",
+ "ungroupDesc": "Items in een stapel scheiden? Klik om de stapel uit te vouwen en sleep vervolgens een subitem naar de linkerrand van het scherm. Er verschijnt een gloeiende balk — laat het item erop vallen om het terug te extraheren als zelfstandige kaart.",
"mergeTitle": "Combineren en samenvoegen",
"mergeDesc": "Combineer losse bestands- of afbeeldingskaarten door ze direct op elkaar te slepen. Dit organiseert je plank door gerelateerde assets in een stapel te bundelen.",
"previewTitle": "Voorbeeld-flyout",
@@ -8522,7 +8522,7 @@ export const sv: TranslationKeys = {
"stacksTitle": "Utforska filstackar",
"stacksDesc": "Att kopiera flera filer grupperar dem i en stack. Du kan dra hela stacken eller klicka på den för att visa och extrahera enskilda filer.",
"ungroupTitle": "Avgruppera och dela stackar",
- "ungroupDesc": "Vill du separera objekt i en stack? Klicka för att expandera stacken och dra sedan ett underobjekt till skärmens vänstra kant. Ett lysande korallfärgat fält visas — släpp objektet på det för att extrahera det tillbaka som ett fristående kort.",
+ "ungroupDesc": "Vill du separera objekt i en stack? Klicka för att expandera stacken och dra sedan ett underobjekt till skärmens vänstra kant. Ett lysande fält visas — släpp objektet på det för att extrahera det tillbaka som ett fristående kort.",
"mergeTitle": "Kombinera och sammanfoga objekt",
"mergeDesc": "Kombinera separata fil- eller bildkort genom att dra dem direkt på varandra. Detta organiserar din hylla genom att bunta relaterade tillgångar i en stack.",
"previewTitle": "Förhandsgranskningspanel",
@@ -8926,7 +8926,7 @@ export const id: TranslationKeys = {
"stacksTitle": "Jelajahi Tumpukan Berkas",
"stacksDesc": "Menyalin beberapa berkas mengelompokkannya menjadi tumpukan. Anda dapat menyeret seluruh tumpukan, atau mengkliknya untuk melihat dan mengekstrak berkas individual.",
"ungroupTitle": "Pisahkan & Bagi Tumpukan",
- "ungroupDesc": "Ingin memisahkan item dalam tumpukan? Klik untuk meluaskan tumpukan, lalu seret subitem apa pun ke tepi kiri layar. Bilah koral bercahaya akan muncul—jatuhkan item ke sana untuk mengekstraknya kembali sebagai kartu mandiri.",
+ "ungroupDesc": "Ingin memisahkan item dalam tumpukan? Klik untuk meluaskan tumpukan, lalu seret subitem apa pun ke tepi kiri layar. Bilah bercahaya akan muncul—jatuhkan item ke sana untuk mengekstraknya kembali sebagai kartu mandiri.",
"mergeTitle": "Gabungkan & Merger Item",
"mergeDesc": "Gabungkan kartu berkas atau gambar terpisah dengan menyeretnya langsung satu sama lain. Ini mengatur rak Anda dengan menggabungkan aset terkait ke dalam tumpukan.",
"previewTitle": "Panel Pratinjau",
@@ -9330,7 +9330,7 @@ export const uk: TranslationKeys = {
"stacksTitle": "Досліджуйте стеки файлів",
"stacksDesc": "Копіювання кількох файлів об'єднує їх у стек. Ви можете перетягнути весь стек або натиснути на нього, щоб переглянути та витягти окремі файли.",
"ungroupTitle": "Відокремлюйте та розділяйте стеки",
- "ungroupDesc": "Хочете розділити елементи в стеку? Натисніть, щоб розгорнути стек, а потім перетягніть будь-який під-елемент до лівого краю екрана. З'явиться світиться кораловий стовпчик—перетягніть елемент на нього, щоб витягти його назад як окрему картку.",
+ "ungroupDesc": "Хочете розділити елементи в стеку? Натисніть, щоб розгорнути стек, а потім перетягніть будь-який під-елемент до лівого краю екрана. З'явиться яскравий стовпчик—перетягніть елемент на нього, щоб витягти його назад як окрему картку.",
"mergeTitle": "Об'єднуйте та зливайте елементи",
"mergeDesc": "Об'єднуйте окремі картки файлів або зображень, перетягуючи їх безпосередньо одна на одну. Це впорядковує вашу полицю, об'єднуючи пов'язані ресурси у стек.",
"previewTitle": "Панель попереднього перегляду",
@@ -9734,7 +9734,7 @@ export const el: TranslationKeys = {
"stacksTitle": "Εξερευνήστε Στοίβες Αρχείων",
"stacksDesc": "Η αντιγραφή πολλών αρχείων τα ομαδοποιεί σε στοίβα. Μπορείτε να σύρετε ολόκληρη τη στοίβα ή να κάνετε κλικ σε αυτήν για να δείτε και να εξαγάγετε μεμονωμένα αρχεία.",
"ungroupTitle": "Αποομαδοποίηση & Διαχωρισμός Στοιβών",
- "ungroupDesc": "Θέλετε να διαχωρίσετε στοιχεία σε μια στοίβα; Κάντε κλικ για ανάπτυξη της στοίβας και έπειτα σύρετε οποιοδήποτε υπο-στοιχείο στην αριστερή άκρη της οθόνης. Θα εμφανιστεί μια φωτεινή κοραλί γραμμή—αφήστε το στοιχείο πάνω της για να το εξαγάγετε ξανά ως αυτόνομη κάρτα.",
+ "ungroupDesc": "Θέλετε να διαχωρίσετε στοιχεία σε μια στοίβα; Κάντε κλικ για ανάπτυξη της στοίβας και έπειτα σύρετε οποιοδήποτε υπο-στοιχείο στην αριστερή άκρη της οθόνης. Θα εμφανιστεί μια φωτεινή γραμμή—αφήστε το στοιχείο πάνω της για να το εξαγάγετε ξανά ως αυτόνομη κάρτα.",
"mergeTitle": "Συνδυασμός & Συγχώνευση Στοιχείων",
"mergeDesc": "Συνδυάστε ξεχωριστές κάρτες αρχείων ή εικόνων σύροντάς τες απευθείας η μία πάνω στην άλλη. Αυτό οργανώνει το ράφι σας δεσμεύοντας σχετικούς πόρους σε μια στοίβα.",
"previewTitle": "Πλαίσιο προεπισκόπησης",
@@ -10138,7 +10138,7 @@ export const cs: TranslationKeys = {
"stacksTitle": "Prozkoumejte stohy souborů",
"stacksDesc": "Kopírování více souborů je seskupí do stohu. Můžete přetáhnout celý stoh nebo na něj kliknout pro zobrazení a extrahování jednotlivých souborů.",
"ungroupTitle": "Oddělení a rozdělení stohů",
- "ungroupDesc": "Chcete oddělit položky v stohu? Klikněte pro rozbalení stohu a poté přetáhněte libovolnou podpoložku na levý okraj obrazovky. Objeví se zářivý korálový pruh—přetáhněte na něj položku, abyste ji extrahovali zpět jako samostatnou kartu.",
+ "ungroupDesc": "Chcete oddělit položky v stohu? Klikněte pro rozbalení stohu a poté přetáhněte libovolnou podpoložku na levý okraj obrazovky. Objeví se zářivý pruh—přetáhněte na něj položku, abyste ji extrahovali zpět jako samostatnou kartu.",
"mergeTitle": "Kombinování a slučování položek",
"mergeDesc": "Kombinujte oddělené karty souborů nebo obrázků jejich přímým přetažením na sebe. To organizuje vaši polici sdružováním souvisejících položek do stohu.",
"previewTitle": "Panel náhledu",
@@ -10542,7 +10542,7 @@ export const ro: TranslationKeys = {
"stacksTitle": "Explorează stive de fișiere",
"stacksDesc": "Copierea mai multor fișiere le grupează într-o stivă. Poți trage toată stiva sau să dai clic pe ea pentru a vizualiza și extrage fișiere individuale.",
"ungroupTitle": "Degrupează și împarte stive",
- "ungroupDesc": "Vrei să separi elemente într-o stivă? Dă clic pentru a extinde stiva, apoi trage orice subelement spre marginea stângă a ecranului. Va apărea o bară corală strălucitoare—plasează elementul pe ea pentru a-l extrage înapoi ca pe un card autonom.",
+ "ungroupDesc": "Vrei să separi elemente într-o stivă? Dă clic pentru a extinde stiva, apoi trage orice subelement spre marginea stângă a ecranului. Va apărea o bară strălucitoare—plasează elementul pe ea pentru a-l extrage înapoi ca pe un card autonom.",
"mergeTitle": "Combină și îmbină elemente",
"mergeDesc": "Combină carduri separate de fișiere sau imagini trăgându-le direct una peste alta. Asta îți organizează raftul împachetând active corelate într-o stivă.",
"previewTitle": "Panou de previzualizare",
@@ -10946,7 +10946,7 @@ export const hu: TranslationKeys = {
"stacksTitle": "Fedezze fel a fájlkötegeket",
"stacksDesc": "Több fájl másolása egy kötegbe csoportosítja őket. Húzhatja a teljes köteget, vagy rákattinthat az egyes fájlok megtekintéséhez és kibontásához.",
"ungroupTitle": "Kötegek szétválasztása",
- "ungroupDesc": "Szeretné elválasztani a köteg elemeit? Kattintson a köteg kibontásához, majd húzzon bármely alelemet a képernyő bal széléhez. Egy ragyogó korall sáv jelenik meg—ejtse rá az elemet, hogy újra önálló kártyaként bontsa ki.",
+ "ungroupDesc": "Szeretné elválasztani a köteg elemeit? Kattintson a köteg kibontásához, majd húzzon bármely alelemet a képernyő bal széléhez. Egy ragyogó sáv jelenik meg—ejtse rá az elemet, hogy újra önálló kártyaként bontsa ki.",
"mergeTitle": "Elemek kombinálása és egyesítése",
"mergeDesc": "Különálló fájl- vagy képkártyákat közvetlenül egymásra húzással kombinálhat. Ez a polcát úgy rendszerezi, hogy a kapcsolódó elemeket egy kötegbe csomagolja.",
"previewTitle": "Előnézeti panel",
@@ -11350,7 +11350,7 @@ export const da: TranslationKeys = {
"stacksTitle": "Udforsk filstakke",
"stacksDesc": "Kopiering af flere filer grupperer dem i en stak. Du kan trække hele stakken eller klikke på den for at se og udtrække individuelle filer.",
"ungroupTitle": "Fjern og del stakke",
- "ungroupDesc": "Vil du adskille elementer i en stak? Klik for at udvide stakken, og træk derefter et hvilket som helst under-element til skærmens venstre kant. En lysende koralbjælke vises—slip elementet på den for at udtrække det tilbage som et selvstændigt kort.",
+ "ungroupDesc": "Vil du adskille elementer i en stak? Klik for at udvide stakken, og træk derefter et hvilket som helst under-element til skærmens venstre kant. En lysende bjælke vises—slip elementet på den for at udtrække det tilbage som et selvstændigt kort.",
"mergeTitle": "Kombiner og flet elementer",
"mergeDesc": "Kombiner separate fil- eller billedkort ved at trække dem direkte oven på hinanden. Dette organiserer din hylde ved at samle relaterede aktiver i en stak.",
"previewTitle": "Forhåndsvisningspanel",
@@ -11754,7 +11754,7 @@ export const fi: TranslationKeys = {
"stacksTitle": "Tutki tiedostopinoja",
"stacksDesc": "Useiden tiedostojen kopiointi ryhmittelee ne pinoon. Voit vetää koko pinon tai napsauttaa sitä nähdäksesi ja poimiaksesi yksittäisiä tiedostoja.",
"ungroupTitle": "Pura ja jaa pinoja",
- "ungroupDesc": "Haluatko erottaa pinon kohteita? Napsauta laajentaaksesi pino ja vedä sitten mikä tahansa alakohde näytön vasempaan reunaan. Hohtava korallipalkki ilmestyy—pudota kohde siihen palauttaaksesi se itsenäiseksi kortiksi.",
+ "ungroupDesc": "Haluatko erottaa pinon kohteita? Napsauta laajentaaksesi pino ja vedä sitten mikä tahansa alakohde näytön vasempaan reunaan. Hohtava palkki ilmestyy—pudota kohde siihen palauttaaksesi se itsenäiseksi kortiksi.",
"mergeTitle": "Yhdistä ja sulauta kohteita",
"mergeDesc": "Yhdistä erilliset tiedosto- tai kuvakortit vetämällä ne suoraan toistensa päälle. Tämä järjestää hyllyäsi sitomalla liittyvät omaisuudet pinoon.",
"previewTitle": "Esikatselupaneeli",
@@ -12158,7 +12158,7 @@ export const th: TranslationKeys = {
"stacksTitle": "สำรวจสแต็กไฟล์",
"stacksDesc": "การคัดลอกไฟล์หลายไฟล์จะจัดกลุ่มเป็นสแต็ก คุณสามารถลากทั้งสแต็กหรือคลิกเพื่อดูและแยกไฟล์แต่ละไฟล์ได้",
"ungroupTitle": "ยกเลิกการจัดกลุ่มและแยกสแต็ก",
- "ungroupDesc": "ต้องการแยกรายการในสแต็กหรือไม่? คลิกเพื่อขยายสแต็ก จากนั้นลากรายการย่อยใด ๆ ไปยังขอบซ้ายของหน้าจอ แถบสีคอรัลเรืองแสงจะปรากฏขึ้น—วางรายการบนนั้นเพื่อแยกกลับเป็นการ์ดอิสระ",
+ "ungroupDesc": "ต้องการแยกรายการในสแต็กหรือไม่? คลิกเพื่อขยายสแต็ก จากนั้นลากรายการย่อยใด ๆ ไปยังขอบซ้ายของหน้าจอ แถบเรืองแสงจะปรากฏขึ้น—วางรายการบนนั้นเพื่อแยกกลับเป็นการ์ดอิสระ",
"mergeTitle": "รวมและผสานรายการ",
"mergeDesc": "รวมการ์ดไฟล์หรือรูปภาพแยกกันโดยลากไปวางซ้อนกันโดยตรง การนี้จะจัดระเบียบชั้นวางของคุณโดยรวมสินทรัพย์ที่เกี่ยวข้องเข้าในสแต็ก",
"previewTitle": "แผงพรีวิว",
@@ -12562,7 +12562,7 @@ export const he: TranslationKeys = {
"stacksTitle": "חקור מחסניות קבצים",
"stacksDesc": "העתקת קבצים מרובים מקבצת אותם למחסנית. אתה יכול לגרור את כל המחסנית, או ללחוץ עליה כדי לראות ולחלץ קבצים בודדים.",
"ungroupTitle": "בטל קיבוץ ופצל מחסניות",
- "ungroupDesc": "רוצה להפריד פריטים במחסנית? לחץ כדי להרחיב את המחסנית, ואז גרור כל תת-פריט לקצה השמאלי של המסך. תופיע בר אלמוגי זוהר—שחרר את הפריט עליו כדי לחלץ אותו בחזרה לכרטיס עצמאי.",
+ "ungroupDesc": "רוצה להפריד פריטים במחסנית? לחץ כדי להרחיב את המחסנית, ואז גרור כל תת-פריט לקצה השמאלי של המסך. תופיע בר זוהר—שחרר את הפריט עליו כדי לחלץ אותו בחזרה לכרטיס עצמאי.",
"mergeTitle": "שלב ומזג פריטים",
"mergeDesc": "שלב כרטיסי קובץ או תמונה נפרדים על-ידי גרירתם ישירות אחד על השני. זה מארגן את המדף שלך על-ידי איגוד נכסים קשורים למחסנית.",
"previewTitle": "תפריט תצוגה מקדימה",
@@ -12966,7 +12966,7 @@ export const no: TranslationKeys = {
"stacksTitle": "Utforsk filstabler",
"stacksDesc": "Kopiering av flere filer grupperer dem i en stabel. Du kan dra hele stablen, eller klikke på den for å se og trekke ut individuelle filer.",
"ungroupTitle": "Fjern og del stabler",
- "ungroupDesc": "Vil du skille elementer i en stabel? Klikk for å utvide stabelen, og dra deretter et hvilket som helst underelement til venstre kant av skjermen. En lysende korall-bar vil vises—slipp elementet på den for å trekke det tilbake som et frittstående kort.",
+ "ungroupDesc": "Vil du skille elementer i en stabel? Klikk for å utvide stabelen, og dra deretter et hvilket som helst underelement til venstre kant av skjermen. En lysende bar vil vises—slipp elementet på den for å trekke det tilbake som et frittstående kort.",
"mergeTitle": "Kombiner og slå sammen elementer",
"mergeDesc": "Kombiner separate fil- eller bildekort ved å dra dem direkte oppå hverandre. Dette organiserer hyllen din ved å samle relaterte ressurser i en stabel.",
"previewTitle": "Forhåndsvisningspanel",
diff --git a/src/lib/edgeDrag.ts b/src/lib/edgeDrag.ts
new file mode 100644
index 0000000..415fc95
--- /dev/null
+++ b/src/lib/edgeDrag.ts
@@ -0,0 +1,93 @@
+/**
+ * A drag from another app, seen before it reaches the shelf (main reports it
+ * with every cursor update, see electron/main/externalDrag.ts).
+ *
+ * - Anywhere on screen: the edge bar swells a little, ready for it.
+ * - Closer: the swell grows with the drag's distance to the bar ("pull").
+ * - At the bar ("catch"): the shelf opens straight into its drop zone.
+ *
+ * All positions are in the stick display's work-area coordinates, the same
+ * ones the cursor poll reports.
+ */
+
+/** Distance from the bar where the pull starts to build. */
+export const DRAG_PULL_RANGE_PX = 360
+/** How deep from the screen edge the catch reaches (side docks / top dock). */
+export const DRAG_CATCH_DEPTH_PX = 48
+export const DRAG_CATCH_DEPTH_TOP_PX = 40
+/** Extra room past each end of the bar that still catches. */
+export const DRAG_CATCH_SLACK_PX = 24
+/** The drag must stay in the catch this long, so one passing by never opens it. */
+export const DRAG_CATCH_DWELL_MS = 60
+
+export interface EdgeDragLane {
+ stickPosition: 'left' | 'right' | 'top'
+ /** Where the bar starts and ends along the edge (y for side docks, x for top). */
+ start: number
+ end: number
+ displayWidth: number
+}
+
+/** Distance from the screen edge, and how far past the bar's ends, of a point. */
+function offsets(lane: EdgeDragLane, x: number, y: number): { depth: number; past: number } {
+ const depth = lane.stickPosition === 'top' ? y : lane.stickPosition === 'right' ? lane.displayWidth - x : x
+ const along = lane.stickPosition === 'top' ? x : y
+ const past = along < lane.start ? lane.start - along : along > lane.end ? along - lane.end : 0
+ return { depth: Math.max(0, depth), past }
+}
+
+/** 0 (far, or at the edge of the range) .. 1 (at the bar), eased so most of the growth happens close in. */
+export function edgeDragPull(lane: EdgeDragLane, x: number, y: number): number {
+ const { depth, past } = offsets(lane, x, y)
+ const t = Math.min(1, Math.max(0, 1 - Math.hypot(depth, past) / DRAG_PULL_RANGE_PX))
+ return t * t * (3 - 2 * t)
+}
+
+/** True when the drag is at the bar, close enough to open the shelf for it. */
+export function inEdgeDragCatch(lane: EdgeDragLane, x: number, y: number): boolean {
+ const { depth, past } = offsets(lane, x, y)
+ const maxDepth = lane.stickPosition === 'top' ? DRAG_CATCH_DEPTH_TOP_PX : DRAG_CATCH_DEPTH_PX
+ return depth <= maxDepth && past <= DRAG_CATCH_SLACK_PX
+}
+
+// The pull changes with every cursor update while a drag approaches, but the
+// bar only moves in three steps (ready -> nearer -> close): each step is one
+// short eased swell, instead of a 60 fps animation for as long as the drag
+// moves (a moving bar cost ~25% of a core; three swells cost a few frames).
+// The step is written straight onto the cue element as a CSS variable (one
+// element restyled, no React render). A margin around each step's edge keeps
+// a drag hovering on a boundary from flickering between two steps.
+export const DRAG_PULL_STEPS = 3
+/** Pull where each step starts: about 240px, 160px and 90px from the bar. */
+export const DRAG_PULL_STEP_AT = [0.25, 0.55, 0.82]
+const STEP_MARGIN = 0.04
+
+let cueEl: HTMLElement | null = null
+let step = 0
+
+function applyPull(): void {
+ cueEl?.style.setProperty('--pull', String(step / DRAG_PULL_STEPS))
+}
+
+/** The cue element registers itself while it is mounted (null on unmount). */
+export function registerEdgeDragCue(el: HTMLElement | null): void {
+ cueEl = el
+ applyPull()
+}
+
+/** Step (0..DRAG_PULL_STEPS) for a pull; within STEP_MARGIN of an edge it stays on `current`. */
+export function pullStep(t: number, current: number): number {
+ let next = 0
+ for (const at of DRAG_PULL_STEP_AT) if (t >= at) next++
+ if (next === current) return current
+ // only cross an edge once clearly past it
+ const edge = next > current ? DRAG_PULL_STEP_AT[next - 1] : DRAG_PULL_STEP_AT[next]
+ return Math.abs(t - edge) < STEP_MARGIN && Math.abs(next - current) === 1 ? current : next
+}
+
+export function setEdgeDragPull(t: number): void {
+ const next = t <= 0 ? 0 : pullStep(t, step)
+ if (next === step) return
+ step = next
+ applyPull()
+}
diff --git a/src/store/appStore.ts b/src/store/appStore.ts
index 5b4ca2f..c67d601 100644
--- a/src/store/appStore.ts
+++ b/src/store/appStore.ts
@@ -94,6 +94,16 @@ interface AppState {
setEmojiCategory: (cat: import('../lib/emoji/catalog').EmojiCategoryId) => void
/** True while an OS file drag is hovering the panel (prevents premature close). */
dragActive: boolean
+ /**
+ * True while main sees a drag from another app in progress anywhere on
+ * screen (before it reaches the window): the edge bar gets ready for it and
+ * the shelf opens straight into its drop zone.
+ */
+ externalDrag: boolean
+ setExternalDrag: (active: boolean) => void
+ /** In-app drag: the card a drop would stack the dragged card into. */
+ dropTargetId: string | null
+ setDropTargetId: (id: string | null) => void
/**
* The one stack/bundle whose expanded sub-item list is open (accordion).
* Single source of truth so expanding one stack collapses the previous,
@@ -269,6 +279,14 @@ export const useStore = create<AppState>((set, get) => ({
}
},
dragActive: false,
+ externalDrag: false,
+ setExternalDrag: (externalDrag) => {
+ if (get().externalDrag !== externalDrag) set({ externalDrag })
+ },
+ dropTargetId: null,
+ setDropTargetId: (dropTargetId) => {
+ if (get().dropTargetId !== dropTargetId) set({ dropTargetId })
+ },
expandedStackId: null,
setExpandedStackId: (expandedStackId) => set({ expandedStackId }),
internalDragReq: null,
@@ -532,7 +550,7 @@ export const useStore = create<AppState>((set, get) => ({
setDragActive: (dragActive) => set({ dragActive }),
setInternalDragReq: (internalDragReq) => {
if (internalDragReq === null) {
- set({ internalDragReq: null, dragActive: false })
+ set({ internalDragReq: null, dragActive: false, dropTargetId: null })
} else {
set({ internalDragReq })
}
diff --git a/src/styles/item.css b/src/styles/item.css
index d861582..39d0661 100644
--- a/src/styles/item.css
+++ b/src/styles/item.css
@@ -658,6 +658,38 @@ html[data-motion='reduce'] .fko-layers > .fil {
bottom: 28px;
}
+/* Text, link, code and color cards dock the same pill at the bottom right,
+ in the room their content leaves at the bottom:
+ - top dock (fixed-height tiles): in the free band just above the bottom
+ row, >= 3px clear of a full 5-line preview and of the row; color values
+ sit above that band (see the color card rules).
+ - side dock (cards as tall as their content): in the bottom row, over the
+ time. These cards keep 6px more room at the bottom for it, and while the
+ pill shows the row's extras (tags, link domain, x-count, time) step aside
+ but keep their size, so the card never changes height; the type and
+ "copied" stay. They come back once the pill has faded out. */
+.list-stack .item:not(.is-image-folder-card) .item-main > .actions {
+ top: auto;
+ bottom: 6px;
+ transform-origin: bottom right;
+}
+.list.horizontal .list-stack .item:not(.is-image-folder-card) .item-main > .actions {
+ bottom: 27px;
+}
+.list:not(.horizontal) .list-stack .item:not(.is-image-folder-card) .item-footer {
+ padding-bottom: 14px;
+}
+.list:not(.horizontal) .list-stack .item:not(.is-image-folder-card) .item-footer :is(.meta > :not(.kind-badge, .meta-copied), .meta-time) {
+ transition: visibility 0s linear 0.12s, order 0s linear 0.12s;
+}
+.list:not(.horizontal) .list-stack .item:not(.is-image-folder-card) .item-main:is(:hover, :focus-within, .force-actions) .item-footer :is(.meta > :not(.kind-badge, .meta-copied), .meta-time) {
+ visibility: hidden;
+ transition-delay: 0s;
+}
+.list:not(.horizontal) .list-stack .item:not(.is-image-folder-card) .item-main:is(:hover, :focus-within, .force-actions) .item-footer .meta > :not(.kind-badge, .meta-copied) {
+ order: 1;
+}
+
/* The preview's cards have no flap: their pill stays in the top corner and
the folder sits a little lower so the open papers clear it. */
.flyout-subitem:not(.single-hero-card) .item-content:has(.file-kind-opening) {
@@ -2852,12 +2884,13 @@ html[data-motion='reduce'] .file-stack-folder {
margin-bottom: 2px;
}
-/* In horizontal mode: give breathing room above the code */
+/* In horizontal mode: give breathing room above the code, and keep it above
+ the band the hover pill uses (bottom right, just above the bottom row) */
.list.horizontal .item.is-color-card .item-content {
display: flex;
flex-direction: column;
justify-content: flex-end;
- padding-bottom: 0;
+ padding-bottom: 28px;
}
.list.horizontal .item.is-color-card .color-swatch-code {
@@ -2872,124 +2905,104 @@ html[data-motion='reduce'] .file-stack-folder {
.split-dropzone {
position: absolute;
z-index: 300;
- display: flex;
pointer-events: auto;
box-sizing: border-box;
- transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
-/* Top Dock: Attached to top screen edge */
+/* Each dock: along the edge the card is dragged out to. The hit area is the
+ whole strip; Panel's internal-drop fallback uses the same reach (80px from
+ the top, 100px from a side). */
.split-dropzone.pos-top {
top: 0;
left: 0;
right: 0;
- height: 56px;
- align-items: flex-start;
- justify-content: center;
+ height: 64px;
}
-
-.split-dropzone.pos-bottom {
+.split-dropzone.pos-left,
+.split-dropzone.pos-right {
+ top: 0;
bottom: 0;
- left: 0;
- right: 0;
- height: 56px;
- align-items: flex-end;
- justify-content: center;
+ width: 88px;
}
-
-/* Left Dock: Attached to left screen edge */
.split-dropzone.pos-left {
- top: 0;
- bottom: 0;
left: 0;
- width: 80px;
- align-items: center;
- justify-content: flex-start;
}
-
-/* Right Dock: Attached to right screen edge */
.split-dropzone.pos-right {
- top: 0;
- bottom: 0;
right: 0;
- width: 80px;
- align-items: center;
- justify-content: flex-end;
}
-/* The neon laser capsule glow bar */
-.split-dropzone .glow-line {
+/* The line: along the screen edge, in the shelf's gutter, clear of its
+ rounded ends; lit while the card is over the strip. */
+.split-line {
position: absolute;
pointer-events: none;
- border-radius: 9999px;
- background: linear-gradient(180deg, transparent 0%, rgba(249, 115, 22, 0.85) 30%, rgba(249, 115, 22, 0.85) 70%, transparent 100%);
- box-shadow: 0 0 16px rgba(249, 115, 22, 0.45), 0 0 32px rgba(249, 115, 22, 0.2);
- transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
+ --dash-color: rgba(255, 255, 255, 0.45);
}
-
-/* Horizontal line for Top/Bottom docks */
-.split-dropzone.pos-top .glow-line,
-.split-dropzone.pos-bottom .glow-line {
- width: 55%;
- max-width: 360px;
- height: 2px;
- background: linear-gradient(90deg, transparent 0%, rgba(249, 115, 22, 0.85) 30%, rgba(249, 115, 22, 0.85) 70%, transparent 100%);
+.split-dropzone.active .split-line {
+ --dash-color: rgba(255, 255, 255, 0.95);
}
-
-.split-dropzone.pos-top .glow-line {
- top: 4px;
+.split-dropzone.pos-top .split-line {
+ top: 3px;
+ left: 28px;
+ right: 28px;
+ height: 4px;
}
-
-.split-dropzone.pos-bottom .glow-line {
- bottom: 4px;
+.split-dropzone.pos-left .split-line,
+.split-dropzone.pos-right .split-line {
+ top: 28px;
+ bottom: 28px;
+ width: 4px;
}
-
-/* Vertical line for Left/Right docks */
-.split-dropzone.pos-left .glow-line,
-.split-dropzone.pos-right .glow-line {
- height: 55%;
- max-height: 260px;
- width: 2px;
- background: linear-gradient(180deg, transparent 0%, rgba(249, 115, 22, 0.85) 30%, rgba(249, 115, 22, 0.85) 70%, transparent 100%);
+.split-dropzone.pos-left .split-line {
+ left: 3px;
}
-
-.split-dropzone.pos-left .glow-line {
- left: 4px;
+.split-dropzone.pos-right .split-line {
+ right: 3px;
}
-.split-dropzone.pos-right .glow-line {
- right: 4px;
+/* In-app drag onto another card: the card a drop would stack into gets the
+ drop zone's dashed ring over its dimmed content; the card being dragged
+ dims. Both sit over every layer of the card's own content (its pill is 20).
+ The dim is ::after because the card's framer motion keeps an inline
+ opacity on .item. */
+.drop-target-ring {
+ position: absolute;
+ inset: 4px;
+ z-index: 25;
+ pointer-events: none;
+ border-radius: calc(var(--radius-card) - 4px);
+ background-color: rgba(0, 0, 0, 0.45);
+ --dash-color: rgba(255, 255, 255, 0.75);
+ animation: drop-target-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
-
-/* Active / Drag-over States */
-.split-dropzone.active.pos-left,
-.split-dropzone.active.pos-right {
- width: 100px;
+@keyframes drop-target-in {
+ from {
+ opacity: 0;
+ transform: scale(1.04);
+ }
}
-
-.split-dropzone.active.pos-top,
-.split-dropzone.active.pos-bottom {
- height: 72px;
+.item.is-drag-source::after {
+ content: '';
+ position: absolute;
+ inset: 0;
+ z-index: 25;
+ pointer-events: none;
+ border-radius: inherit;
+ background-color: rgba(0, 0, 0, 0.6);
+ animation: drag-source-in 150ms ease;
}
-
-.split-dropzone.active .glow-line {
- background: linear-gradient(180deg, transparent 0%, #f97316 25%, #ff8a3d 50%, #f97316 75%, transparent 100%);
- box-shadow: 0 0 24px rgba(249, 115, 22, 0.9), 0 0 48px rgba(249, 115, 22, 0.45);
+@keyframes drag-source-in {
+ from {
+ opacity: 0;
+ }
}
-
-.split-dropzone.pos-left.active .glow-line,
-.split-dropzone.pos-right.active .glow-line {
- width: 3.5px;
- height: 68%;
- max-height: 320px;
+/* its hover buttons stay out of the way while it is the target */
+.item.is-drop-target .item-main > .actions {
+ visibility: hidden;
}
-
-.split-dropzone.pos-top.active .glow-line,
-.split-dropzone.pos-bottom.active .glow-line {
- height: 3.5px;
- width: 68%;
- max-width: 440px;
- background: linear-gradient(90deg, transparent 0%, #f97316 25%, #ff8a3d 50%, #f97316 75%, transparent 100%);
+html[data-motion='reduce'] .drop-target-ring,
+html[data-motion='reduce'] .item.is-drag-source::after {
+ animation: none;
}
/* ------------------------------------------------------------------ */
diff --git a/src/styles/panel.css b/src/styles/panel.css
index ca27175..c86d0b0 100644
--- a/src/styles/panel.css
+++ b/src/styles/panel.css
@@ -197,6 +197,196 @@
+/* Edge bar getting ready for a drag from another app (EdgeDragCue): the bar
+ itself, solid black like it, swelling a little wider and longer. It starts
+ just wider than the bar and grows in three eased steps as the drag comes
+ closer: --pull is 0, 1/3, 2/3 or 1 (set from the cursor poll, see
+ lib/edgeDrag.ts), so it only animates when it changes step. The pill is
+ laid out at its largest (bar + 10px thick, 114% long) and scaled down to
+ the step, so a step is a transform on its own layer: no layout or repaint
+ per frame. --barn is the bar's thickness as a plain number. */
+.edge-drag-cue {
+ --pull: 0;
+ --bar: 3px;
+ --barn: 3;
+ --cue-thick: calc((var(--barn) + 3 + 7 * var(--pull)) / (var(--barn) + 10));
+ --cue-long: calc((1.04 + 0.1 * var(--pull)) / 1.14);
+ position: absolute;
+ background-color: #000000;
+ will-change: transform;
+ transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
+ animation-duration: 260ms;
+ animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
+}
+.edge-drag-cue.side-left,
+.edge-drag-cue.side-right {
+ top: 50%;
+ width: calc(var(--bar) + 10px);
+ height: 114%;
+ transform: translateY(-50%) scale(var(--cue-thick), var(--cue-long));
+}
+.edge-drag-cue.side-left {
+ left: 0;
+ transform-origin: left center;
+ border-radius: 0 100% 100% 0 / 0 24px 24px 0;
+}
+.edge-drag-cue.side-right {
+ right: 0;
+ transform-origin: right center;
+ border-radius: 100% 0 0 100% / 24px 0 0 24px;
+}
+.edge-drag-cue.side-top {
+ top: 0;
+ left: 50%;
+ height: calc(var(--bar) + 10px);
+ width: 114%;
+ transform-origin: center top;
+ transform: translateX(-50%) scale(var(--cue-long), var(--cue-thick));
+ border-radius: 0 0 24px 24px / 0 0 100% 100%;
+}
+/* Grows out of the bar itself */
+.edge-drag-cue.side-left,
+.edge-drag-cue.side-right {
+ animation-name: edge-drag-cue-in-side;
+}
+.edge-drag-cue.side-top {
+ animation-name: edge-drag-cue-in-top;
+}
+@keyframes edge-drag-cue-in-side {
+ from {
+ transform: translateY(-50%) scale(calc(var(--barn) / (var(--barn) + 10)), calc(1 / 1.14));
+ }
+}
+@keyframes edge-drag-cue-in-top {
+ from {
+ transform: translateX(-50%) scale(calc(1 / 1.14), calc(var(--barn) / (var(--barn) + 10)));
+ }
+}
+[data-motion='reduce'] .edge-drag-cue {
+ transition: none;
+ animation: none;
+}
+
+/* The drag targets' dashed line (DashedOutline / DashedLine): a 2px stroke,
+ 10px dashes with round ends and 8px clear between them, the same for the
+ drop zone, the stacking ring and the detach edge. --dash-color sets how lit
+ it is. The rect is inset by half the stroke so it is never clipped. */
+.dashed-outline {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ overflow: visible;
+ pointer-events: none;
+}
+.dashed-outline-shape {
+ fill: none;
+ stroke: var(--dash-color, rgba(255, 255, 255, 0.38));
+ stroke-width: 2px;
+ stroke-linecap: round;
+ stroke-dasharray: 8 10;
+ transition: stroke 180ms ease;
+}
+rect.dashed-outline-shape {
+ x: 1px;
+ y: 1px;
+ width: calc(100% - 2px);
+ height: calc(100% - 2px);
+}
+
+/* Drop zone for drags from other apps (DropOverlay): solid black over the
+ whole shelf (nothing shows through), a dashed well, and the tray icon on its
+ own. The well's dashes light up once the drag is over the shelf, and it
+ tightens as it takes the drop. */
+.drop-overlay {
+ position: absolute;
+ inset: 0;
+ z-index: 320; /* above the header and the split zone, below the content veil (400) */
+ display: flex;
+ padding: 12px;
+ pointer-events: none;
+ background: #000000;
+}
+.drop-overlay.is-horizontal {
+ padding: 10px 12px 12px;
+}
+.drop-well {
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 12px;
+ padding: 16px;
+ position: relative;
+ border-radius: 16px;
+ --dash-color: rgba(255, 255, 255, 0.38);
+ text-align: center;
+ transform: scale(0.98);
+ transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
+ animation: drop-well-in 300ms cubic-bezier(0.22, 1, 0.36, 1);
+}
+.drop-overlay.is-horizontal .drop-well {
+ flex-direction: row;
+ gap: 14px;
+ text-align: left;
+}
+@keyframes drop-well-in {
+ from {
+ transform: scale(0.94);
+ }
+}
+.drop-overlay.is-over .drop-well {
+ --dash-color: rgba(255, 255, 255, 0.7);
+ transform: scale(1);
+}
+.drop-overlay.is-accepted .drop-well {
+ --dash-color: rgba(255, 255, 255, 0.9);
+ transform: scale(0.97);
+ transition-duration: 200ms;
+}
+.drop-icon {
+ flex-shrink: 0;
+ display: grid;
+ place-items: center;
+ color: rgba(255, 255, 255, 0.92);
+}
+.drop-icon .drop-arrow {
+ transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 160ms ease;
+}
+.drop-overlay.is-over .drop-icon .drop-arrow {
+ transform: translateY(1.5px);
+}
+.drop-overlay.is-accepted .drop-icon .drop-arrow {
+ transform: translateY(4px);
+ opacity: 0;
+}
+.drop-text {
+ display: flex;
+ flex-direction: column;
+ gap: 3px;
+ min-width: 0;
+}
+.drop-title {
+ font-size: calc(14px * var(--font-scale, 1));
+ font-weight: 600;
+ color: rgba(255, 255, 255, 0.95);
+ letter-spacing: 0.01em;
+}
+.drop-sub {
+ font-size: calc(12px * var(--font-scale, 1));
+ line-height: 1.4;
+ color: rgba(255, 255, 255, 0.5);
+}
+[data-motion='reduce'] .dashed-outline-shape,
+[data-motion='reduce'] .drop-well,
+[data-motion='reduce'] .drop-icon,
+[data-motion='reduce'] .drop-icon .drop-arrow {
+ transition: none;
+ animation: none;
+}
+
/* Header */
.header {
display: flex;
diff --git a/tests/dragExperience.test.ts b/tests/dragExperience.test.ts
new file mode 100644
index 0000000..1ebc674
--- /dev/null
+++ b/tests/dragExperience.test.ts
@@ -0,0 +1,274 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+import {
+ DRAG_CATCH_DEPTH_PX,
+ DRAG_CATCH_DEPTH_TOP_PX,
+ DRAG_CATCH_SLACK_PX,
+ DRAG_PULL_RANGE_PX,
+ edgeDragPull,
+ inEdgeDragCatch,
+ registerEdgeDragCue,
+ setEdgeDragPull,
+ pullStep,
+ DRAG_PULL_STEP_AT,
+ type EdgeDragLane
+} from '../src/lib/edgeDrag'
+
+const read = (p: string) => readFileSync(join(__dirname, '..', p), 'utf8').replace(/\r\n/g, '\n')
+
+// ── main: is a drag from another app in progress? ──────────────────────────
+const user32 = vi.hoisted(() => ({ buttons: new Set<number>(), dragWindow: 0 as number, calls: [] as string[] }))
+vi.mock('koffi', () => ({
+ default: {
+ load: () => ({
+ func: (sig: string) => {
+ if (sig.includes('GetAsyncKeyState')) return (vk: number) => { user32.calls.push('key'); return user32.buttons.has(vk) ? -32768 : 0 }
+ if (sig.includes('FindWindowW')) return (cls: string) => { user32.calls.push('find:' + cls); return user32.dragWindow }
+ throw new Error('unexpected ' + sig)
+ }
+ })
+ }
+}))
+
+describe('main: a drag from another app (externalDrag.ts)', () => {
+ let mod: typeof import('../electron/main/externalDrag')
+ const platform = process.platform
+ beforeEach(async () => {
+ Object.defineProperty(process, 'platform', { value: 'win32' })
+ vi.resetModules()
+ mod = await import('../electron/main/externalDrag')
+ user32.buttons.clear(); user32.dragWindow = 0; user32.calls.length = 0
+ })
+ afterEach(() => { Object.defineProperty(process, 'platform', { value: platform }) })
+
+ it('is a held button plus the shell drag-image window', () => {
+ user32.buttons.add(1); user32.dragWindow = 0x1234
+ expect(mod.isExternalDragActive()).toBe(true)
+ expect(user32.calls).toContain('find:SysDragImage')
+ })
+
+ it('a right-button drag counts too', () => {
+ user32.buttons.add(2); user32.dragWindow = 0x1234
+ expect(mod.isExternalDragActive()).toBe(true)
+ })
+
+ it('no button held: no drag, and the window is not even looked up (cheap idle ticks)', () => {
+ user32.dragWindow = 0x1234
+ expect(mod.isExternalDragActive()).toBe(false)
+ expect(user32.calls.filter((c) => c.startsWith('find'))).toHaveLength(0)
+ })
+
+ it('a held button without a drag image (window drag, text selection, slider) is no drag', () => {
+ user32.buttons.add(1)
+ expect(mod.isExternalDragActive()).toBe(false)
+ })
+
+ it('our own drag-out never reads as an incoming drag, including its short tail', () => {
+ user32.buttons.add(1); user32.dragWindow = 0x1234
+ mod.setOwnDragActive(true)
+ expect(mod.isExternalDragActive()).toBe(false)
+ mod.setOwnDragActive(false)
+ expect(mod.isExternalDragActive(Date.now() + 100)).toBe(false)
+ expect(mod.isExternalDragActive(Date.now() + 2000)).toBe(true)
+ })
+
+ it('the cursor poll sends the flag, and when it flips even far from the edge', () => {
+ const win = read('electron/main/window.ts')
+ expect(win).toContain("import { isExternalDragActive } from './externalDrag'")
+ expect(win).toContain('|| drag !== _lastSentDrag')
+ expect(win).toMatch(/sendToMainWindow\('window:cursor-edge', \{[\s\S]*?\n drag,/)
+ })
+
+ it('drag-outs from the shelf are bracketed, also when startDrag throws', () => {
+ const ipc = read('electron/main/ipc.ts')
+ expect(ipc).toMatch(/setOwnDragActive\(true\)\n let dragStarted: boolean\n try \{\n dragStarted = startDragOut\(sender, data, capturedAt, subIndex\)\n \} finally \{\n setOwnDragActive\(false\)\n \}/)
+ })
+})
+
+// ── renderer: ready, pull, catch ─────────────────────────────────────────────
+describe('edge bar pull and catch (lib/edgeDrag.ts)', () => {
+ const left: EdgeDragLane = { stickPosition: 'left', start: 400, end: 700, displayWidth: 1920 }
+ const right: EdgeDragLane = { stickPosition: 'right', start: 400, end: 700, displayWidth: 1920 }
+ const top: EdgeDragLane = { stickPosition: 'top', start: 800, end: 1100, displayWidth: 1920 }
+
+ it('pull: 0 out of range, 1 at the bar, growing steadily as the drag comes closer', () => {
+ expect(edgeDragPull(left, DRAG_PULL_RANGE_PX + 1, 550)).toBe(0)
+ expect(edgeDragPull(left, 0, 550)).toBe(1)
+ const steps = [300, 200, 120, 60, 20].map((d) => edgeDragPull(left, d, 550))
+ for (let i = 1; i < steps.length; i++) expect(steps[i]).toBeGreaterThan(steps[i - 1])
+ // past the ends of the bar counts as distance too
+ expect(edgeDragPull(left, 0, 700 + DRAG_PULL_RANGE_PX + 1)).toBe(0)
+ expect(edgeDragPull(left, 0, 760)).toBeLessThan(1)
+ })
+
+ it('each dock measures from its own edge', () => {
+ expect(edgeDragPull(right, 1920, 550)).toBe(1)
+ expect(edgeDragPull(right, 1920 - 100, 550)).toBeCloseTo(edgeDragPull(left, 100, 550))
+ expect(edgeDragPull(top, 950, 0)).toBe(1)
+ expect(edgeDragPull(top, 950, 100)).toBeCloseTo(edgeDragPull(left, 100, 550))
+ })
+
+ it('catch: only right at the bar, with a little slack past its ends', () => {
+ expect(inEdgeDragCatch(left, DRAG_CATCH_DEPTH_PX, 550)).toBe(true)
+ expect(inEdgeDragCatch(left, DRAG_CATCH_DEPTH_PX + 1, 550)).toBe(false)
+ expect(inEdgeDragCatch(left, 10, 400 - DRAG_CATCH_SLACK_PX)).toBe(true)
+ expect(inEdgeDragCatch(left, 10, 400 - DRAG_CATCH_SLACK_PX - 1)).toBe(false)
+ expect(inEdgeDragCatch(right, 1920 - 10, 550)).toBe(true)
+ expect(inEdgeDragCatch(right, 10, 550)).toBe(false)
+ // the top dock catches a little shallower (browser tab strips live up there)
+ expect(inEdgeDragCatch(top, 950, DRAG_CATCH_DEPTH_TOP_PX)).toBe(true)
+ expect(inEdgeDragCatch(top, 950, DRAG_CATCH_DEPTH_TOP_PX + 1)).toBe(false)
+ expect(DRAG_CATCH_DEPTH_TOP_PX).toBeLessThan(DRAG_CATCH_DEPTH_PX)
+ })
+
+ it('the bar moves in three steps (~240, ~160, ~90px), not with every cursor update', () => {
+ expect(pullStep(edgeDragPull(left, 300, 550), 0)).toBe(0)
+ expect(pullStep(edgeDragPull(left, 230, 550), 0)).toBe(1)
+ expect(pullStep(edgeDragPull(left, 150, 550), 1)).toBe(2)
+ expect(pullStep(edgeDragPull(left, 80, 550), 2)).toBe(3)
+ // a fast approach can skip steps
+ expect(pullStep(edgeDragPull(left, 40, 550), 0)).toBe(3)
+ // hovering on an edge does not flicker between two steps
+ expect(pullStep(DRAG_PULL_STEP_AT[1] + 0.02, 1)).toBe(1)
+ expect(pullStep(DRAG_PULL_STEP_AT[1] - 0.02, 2)).toBe(2)
+ expect(pullStep(DRAG_PULL_STEP_AT[1] + 0.05, 1)).toBe(2)
+ })
+
+ it('the step is written onto the cue element only, and only when it changes', () => {
+ const style = new Map<string, string>()
+ const set = vi.fn((k: string, v: string) => style.set(k, v))
+ const el = { style: { setProperty: set } } as unknown as HTMLElement
+ registerEdgeDragCue(el)
+ setEdgeDragPull(0.6)
+ expect(style.get('--pull')).toBe(String(2 / 3))
+ const n = set.mock.calls.length
+ setEdgeDragPull(0.62) // same step: nothing written
+ expect(set.mock.calls.length).toBe(n)
+ setEdgeDragPull(1)
+ expect(style.get('--pull')).toBe('1')
+ setEdgeDragPull(0)
+ expect(style.get('--pull')).toBe('0')
+ registerEdgeDragCue(null)
+ })
+})
+
+describe('edge hover: a drag from another app', () => {
+ const hook = read('src/hooks/useEdgeHover.ts')
+ it('follows the hover setting and ignores our own drags', () => {
+ expect(hook).toContain("const drag = !!data.drag && !state.internalDragReq && (state.settings.hoverActivation ?? true)")
+ })
+ it('opens only after resting in the catch, and only while the drag is still on', () => {
+ expect(hook).toMatch(/if \(inEdgeDragCatch\(lane, data\.x, data\.y\)\) \{\n\s+if \(dragOpenTimer === undefined\) \{\n\s+dragOpenTimer = window\.setTimeout\(\(\) => \{\n\s+dragOpenTimer = undefined\n\s+if \(useStore\.getState\(\)\.externalDrag\) openPanel\(\)\n\s+\}, DRAG_CATCH_DWELL_MS\)/)
+ expect(hook).toContain('window.clearTimeout(dragOpenTimer)')
+ })
+})
+
+// ── store ────────────────────────────────────────────────────────────────────
+describe('store: drag state', () => {
+ it('setters only notify on a real change; ending an in-app drag clears the stack target', async () => {
+ vi.resetModules()
+ vi.doMock('../src/lib/edge', () => ({ edge: new Proxy({}, { get: () => () => Promise.resolve(undefined) }) }))
+ const { useStore } = await import('../src/store/appStore')
+ let n = 0
+ const unsub = useStore.subscribe(() => { n++ })
+ useStore.getState().setExternalDrag(false)
+ useStore.getState().setDropTargetId(null)
+ expect(n).toBe(0)
+ useStore.getState().setExternalDrag(true)
+ useStore.getState().setDropTargetId('a')
+ useStore.getState().setDropTargetId('a')
+ expect(n).toBe(2)
+ useStore.getState().setInternalDragReq({ id: 'b' })
+ useStore.getState().setInternalDragReq(null)
+ expect(useStore.getState().dropTargetId).toBeNull()
+ unsub()
+ vi.doUnmock('../src/lib/edge')
+ })
+})
+
+// ── looks ────────────────────────────────────────────────────────────────────
+describe('drag looks', () => {
+ const panelCss = read('src/styles/panel.css')
+ const itemCss = read('src/styles/item.css')
+ const panel = read('src/components/Panel.tsx')
+
+ it('drop zone: solid black, a bold dashed well, the tray icon on its own (no box, no glass)', () => {
+ expect(panelCss).toMatch(/\.drop-overlay \{[^}]*z-index: 320;[^}]*background: #000000;/)
+ // the shared dashed line: 2px stroke, 10px round dashes, 8px gaps
+ const dash = panelCss.match(/\n\.dashed-outline-shape \{([^}]*)\}/)![1]
+ expect(dash).toContain('stroke-width: 2px;')
+ expect(dash).toContain('stroke-linecap: round;')
+ expect(dash).toContain('stroke-dasharray: 8 10;')
+ expect(panel).toContain('<DashedOutline radius={16} />')
+ const well = panelCss.match(/\.drop-well \{([^}]*)\}/)![1]
+ expect(well).not.toMatch(/background|border:/)
+ const icon = panelCss.match(/\.drop-icon \{([^}]*)\}/)![1]
+ expect(icon).not.toMatch(/background|box-shadow|border/)
+ expect(panelCss).toContain('.drop-overlay.is-over .drop-well {\n --dash-color: rgba(255, 255, 255, 0.7);\n transform: scale(1);\n}')
+ expect(panelCss).toMatch(/\.drop-overlay\.is-accepted \.drop-well \{[^}]*transform: scale\(0\.97\);/)
+ expect(panelCss).toContain('.drop-overlay.is-horizontal .drop-well {\n flex-direction: row;')
+ // shown as soon as a drag from another app is on, not only once it is over the window
+ expect(panel).toContain('const incoming = useStore((s) => !s.internalDragReq && (s.externalDrag || s.dragActive))')
+ expect(panel).not.toContain("background: 'rgba(6, 6, 8, 0.95)'")
+ })
+
+ it('drop zone: when the drag goes away without a drop, it stays through the shelf collapse (no cards show)', () => {
+ // held once up; released 320ms after the shelf closed (the close is 289ms), or 450ms later if it stays open
+ expect(panel).toContain('if (open && incoming) {\n if (!held) setHeld(true)')
+ expect(panel).toContain('const timer = window.setTimeout(() => setHeld(false), open ? 450 : 320)')
+ expect(panel).toContain('const visible = held || (open && incoming)')
+ // a drop hands over to the accept animation instead
+ expect(panel).toContain('if (accepted) {\n if (held) setHeld(false)')
+ })
+
+ it('edge bar cue: the bar itself (solid black, no border) growing in steps, no loop, honours reduced motion', () => {
+ const cue = panelCss.match(/\.edge-drag-cue \{([^}]*)\}/)![1]
+ expect(cue).toContain('background-color: #000000;')
+ expect(cue).not.toMatch(/box-shadow|border/)
+ // bar + 3px when ready, bar + 10px at the bar; 104% -> 114% long; done as a transform on its own layer
+ expect(cue).toContain('--cue-thick: calc((var(--barn) + 3 + 7 * var(--pull)) / (var(--barn) + 10));')
+ expect(cue).toContain('--cue-long: calc((1.04 + 0.1 * var(--pull)) / 1.14);')
+ expect(cue).toContain('will-change: transform;')
+ expect(cue).toContain('transition: transform 240ms')
+ expect(panelCss).toContain('.edge-drag-cue.side-left,\n.edge-drag-cue.side-right {\n top: 50%;\n width: calc(var(--bar) + 10px);\n height: 114%;\n transform: translateY(-50%) scale(var(--cue-thick), var(--cue-long));')
+ expect(panelCss).toMatch(/\.edge-drag-cue\.side-top \{[^}]*transform: translateX\(-50%\) scale\(var\(--cue-long\), var\(--cue-thick\)\);/)
+ expect(panel).toContain("style={{ '--bar': `${barPx}px`, '--barn': barPx } as React.CSSProperties}")
+ expect(panelCss).not.toMatch(/edge-drag-cue[^{]*\{[^}]*infinite/)
+ expect(panelCss).toContain("[data-motion='reduce'] .edge-drag-cue {\n transition: none;\n animation: none;")
+ // never over a shelf that is still drawing back
+ expect(panel).toContain('const showDragCue = externalDrag && !open && closeSettled && !startupBeacon')
+ expect(panel).toMatch(/const timer = window\.setTimeout\(\(\) => setCloseSettled\(true\), 320\)/)
+ })
+
+ it('stacking: the same dashed ring over every layer of the target card, no badge; the dragged card dims', () => {
+ const item = read('src/components/ClipboardItem.tsx')
+ expect(item).toContain('<div className="drop-target-ring" aria-hidden="true">\n <DashedOutline radius={14} />')
+ expect(item).not.toContain('drop-target-chip')
+ expect(itemCss).not.toContain('drop-target-chip')
+ expect(itemCss).toMatch(/\.drop-target-ring \{[^}]*z-index: 25;/)
+ expect(itemCss).toMatch(/\.item\.is-drag-source::after \{[^}]*z-index: 25;/)
+ const list = read('src/components/ItemList.tsx')
+ expect(list).toContain("s.setDropTargetId(target && target.data.kind !== 'text' ? target.id : null)")
+ })
+
+ it('detach zone: only the dashed line along the screen edge of the shelf, no text, no orange glow', () => {
+ expect(itemCss).not.toMatch(/249, 115, 22|#f97316|#ff8a3d|glow-line|split-well|split-label/)
+ expect(panel).toContain("<DashedLine vertical={stickPosition !== 'top'} />")
+ expect(panel).not.toContain('split-label')
+ expect(itemCss).toMatch(/\.split-dropzone\.pos-top \.split-line \{\n top: 3px;/)
+ expect(itemCss).toMatch(/\.split-dropzone\.pos-left \.split-line \{\n left: 3px;/)
+ expect(itemCss).toMatch(/\.split-dropzone\.pos-right \.split-line \{\n right: 3px;/)
+ expect(itemCss).toMatch(/\.split-dropzone\.active \.split-line \{\n --dash-color: rgba\(255, 255, 255, 0\.95\);/)
+ // the strip that takes the drop stays inside the reach of Panel's internal-drop fallback (80px top, 100px sides)
+ expect(itemCss).toMatch(/\.split-dropzone\.pos-top \{[^}]*height: 64px;/)
+ expect(itemCss).toMatch(/\.split-dropzone\.pos-left,\n\.split-dropzone\.pos-right \{[^}]*width: 88px;/)
+ expect(panel).toContain('(isTop && pos.y <= 80)')
+ expect(panel).toContain('(!isTop && !isRight && pos.x <= 100)')
+ })
+
+ it('the detach help text no longer names a colour, in every language', () => {
+ const tr = read('src/i18n/translations.ts')
+ expect(tr).not.toMatch(/coral|Coral|corail|Koralle|corallo|珊瑚|коралл|кораловий|코랄|कोरल|مرجان|কোরাল|mercan|san hô|koral|κοραλί|korál/)
+ })
+})
diff --git a/tests/stackFeatures.test.ts b/tests/stackFeatures.test.ts
index 18f6b11..c55a759 100644
--- a/tests/stackFeatures.test.ts
+++ b/tests/stackFeatures.test.ts
@@ -53,16 +53,16 @@ describe('Stack Features: SVG Folder Silhouette, Sizing, Horizontal Expansion &
const src = read('src/components/Panel.tsx')
expect(src).toContain('SplitDropZone stickPosition={settings.stickPosition')
expect(src).toContain('pos-${stickPosition}')
- expect(src).toContain("isTop = stickPosition === 'top'")
- expect(src).toContain("isRight = stickPosition === 'right'")
+ // slides in from its own edge in each dock
+ expect(src).toContain("const offset = stickPosition === 'top' ? { y: -8 } : stickPosition === 'right' ? { x: 8 } : { x: -8 }")
// Text pill must NOT be introduced into SplitDropZone
expect(src).not.toContain('split-dropzone-pill')
})
it('item.css includes styles for orientation-aware split-dropzone and no split-dropzone-pill', () => {
const css = read('src/styles/item.css')
+ // one per dock (left, right, top; there is no bottom dock)
expect(css).toContain('.split-dropzone.pos-top')
- expect(css).toContain('.split-dropzone.pos-bottom')
expect(css).toContain('.split-dropzone.pos-left')
expect(css).toContain('.split-dropzone.pos-right')
expect(css).not.toContain('.split-dropzone-pill')
diff --git a/tests/textPill.test.ts b/tests/textPill.test.ts
new file mode 100644
index 0000000..861173f
--- /dev/null
+++ b/tests/textPill.test.ts
@@ -0,0 +1,26 @@
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+
+const css = readFileSync(join(__dirname, '..', 'src/styles/item.css'), 'utf8')
+
+describe('hover pill on text, link, code and color cards', () => {
+ it('docks at the bottom right in both docks, on shelf cards only (not the preview flyout)', () => {
+ expect(css).toContain('.list-stack .item:not(.is-image-folder-card) .item-main > .actions {\n top: auto;\n bottom: 6px;\n transform-origin: bottom right;')
+ // top dock: the free band just above the bottom row
+ expect(css).toContain('.list.horizontal .list-stack .item:not(.is-image-folder-card) .item-main > .actions {\n bottom: 27px;')
+ // top dock color values sit above that band
+ expect(css).toMatch(/\.list\.horizontal \.item\.is-color-card \.item-content \{[^}]*padding-bottom: 28px;/)
+ })
+
+ it('side dock: room for the pill in the bottom row, without changing card height on hover', () => {
+ expect(css).toContain('.list:not(.horizontal) .list-stack .item:not(.is-image-folder-card) .item-footer {\n padding-bottom: 14px;')
+ // extras step aside with visibility (keeps their size), type and "copied" stay
+ const hide = css.match(/\.list:not\(\.horizontal\) \.list-stack \.item:not\(\.is-image-folder-card\) \.item-main:is\(:hover, :focus-within, \.force-actions\) \.item-footer :is\(\.meta > :not\(\.kind-badge, \.meta-copied\), \.meta-time\) \{([^}]*)\}/)
+ expect(hide?.[1]).toContain('visibility: hidden;')
+ expect(hide?.[1]).not.toContain('display: none')
+ // they come back only after the pill (0.12s fade) is gone
+ expect(css).toMatch(/\.item-footer :is\(\.meta > :not\(\.kind-badge, \.meta-copied\), \.meta-time\) \{\n transition: visibility 0s linear 0\.12s, order 0s linear 0\.12s;/)
+ expect(css).toMatch(/opacity 0\.12s ease,\n scale 0\.18s/)
+ })
+})