Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.
TypeScript clipboardclipboard-managerdesktop-appdrag-and-dropelectronopen-sourceproductivityproductivity-toolwindows
fix(ui): resolve pin/unpin card overlapping and offload disk persistence to background queue
Deepender255e967e022145
diff --git a/electron/main/index.ts b/electron/main/index.tsindex 0959173..100ed52 100644--- a/electron/main/index.ts+++ b/electron/main/index.ts@@ -15,7 +15,7 @@ import { createWindow, getMainWindow, setInteractive, setVisible, startCursorPolimport { createTray, registerIncognitoApplier } from './tray'import { registerIpc, registerSendListeners } from './ipc'import { prewarmDragIcons } from './drag'-import { initState, getWatcher, loadSettings, saveSettings, pushState, stopStateTimers } from './state'+import { initState, getWatcher, loadSettings, saveSettings, pushState, stopStateTimers, getStore } from './state'import { initAutoUpdater } from './updater'import { createOnboardingWindow } from './onboardingWindow'import { startFullscreenMonitor, stopFullscreenMonitor, triggerFullscreenCheck } from './fullscreen'@@ -67,6 +67,9 @@ app.on('before-quit', () => {stopStateTimers()stopFullscreenMonitor()getWatcher().stop()+ try {+ getStore().persistSync()+ } catch { /* ignore */ }try {const { globalShortcut } = require('electron')globalShortcut.unregisterAll()diff --git a/electron/main/ipc.ts b/electron/main/ipc.tsindex 7548421..fd85412 100644--- a/electron/main/ipc.ts+++ b/electron/main/ipc.ts@@ -230,7 +230,6 @@ export function registerIpc(): void {handle('item:set-pinned', (id, pinned) => {getStore().setPinned(id, pinned)- pushState.items()return getStore().toDto()})diff --git a/electron/store/ItemStore.ts b/electron/store/ItemStore.tsindex 2f95a04..869cf70 100644--- a/electron/store/ItemStore.ts+++ b/electron/store/ItemStore.ts@@ -124,8 +124,25 @@ export class ItemStore {for (const it of this.items) this.sigToId.set(signature(it.data), it.id)}- /** Persist the current index to disk. Called after every mutation. */+ private persistTimer: ReturnType<typeof setTimeout> | null = null++ /** Persist the current index to disk. Debounced to prevent main thread blocking during UI transitions. */private persist(): void {+ if (this.persistTimer) {+ clearTimeout(this.persistTimer)+ }+ this.persistTimer = setTimeout(() => {+ this.persistTimer = null+ this.persistSync()+ }, 150)+ }++ /** Synchronous disk write (called by debounced timer or on app shutdown). */+ public persistSync(): void {+ if (this.persistTimer) {+ clearTimeout(this.persistTimer)+ this.persistTimer = null+ }try {const indexObj: Index = { items: this.items }const jsonStr = JSON.stringify(indexObj)diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsxindex fc53324..c3bcb57 100644--- a/src/components/ClipboardItem.tsx+++ b/src/components/ClipboardItem.tsx@@ -14,7 +14,7 @@* clamped preview; file items list names or bundle badge. Motion is handled by* the parent list (layout/AnimatePresence), so this component stays presentational.*/-import { memo, useState, useCallback, useEffect } from 'react'+import { memo, useState, useCallback, useEffect, forwardRef } from 'react'import { motion, AnimatePresence } from 'framer-motion'import type { ClipboardItemDto } from '../../shared/types'import { MAX_STACK } from '../../shared/types'@@ -42,7 +42,7 @@ interface Props {/* Main item card *//* ------------------------------------------------------------------ */-function ClipboardItemBase({ item }: Props) {+const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {const copy = useStore.getState().copyconst paste = useStore.getState().pasteconst togglePin = useStore.getState().togglePin@@ -111,18 +111,17 @@ function ClipboardItemBase({ item }: Props) {return (<motion.div+ ref={ref}layout="position"initial={open ? { opacity: 0, scale: 0.96, y: 6 } : false}animate={{ opacity: 1, scale: 1, y: 0 }}exit={{ opacity: 0, scale: 0.95, y: -4, transition: { duration: 0.12, ease: [0.32, 0, 0.67, 0] } }}transition={{- layout: { type: 'spring', stiffness: 280, damping: 28, mass: 0.8 },+ layout: { duration: 0.22, ease: [0.16, 1, 0.3, 1] },type: 'spring',- stiffness: 300,- damping: 30,- mass: 0.8,- restDelta: 0.001,- restSpeed: 0.001+ stiffness: 360,+ damping: 28,+ mass: 0.6}}style={{ willChange: 'transform, opacity' }}className={`item${item.pinned ? ' pinned' : ''}${isBundle ? ' bundle' : ''}`}@@ -269,7 +268,7 @@ function ClipboardItemBase({ item }: Props) {</div></motion.div>)-}+})// Bundle expand/collapse — all blur removed; opacity+y+scale composite trivially.const containerVariants = {diff --git a/src/components/ItemList.tsx b/src/components/ItemList.tsxindex 4f96b17..eae7d01 100644--- a/src/components/ItemList.tsx+++ b/src/components/ItemList.tsx@@ -201,8 +201,10 @@ export function ItemList() {) : (<>{pinned.length > 0 && (- <section className="pinned-section">- <div+ <motion.section layout transition={{ duration: 0.22, ease: [0.16, 1, 0.3, 1] }} className="pinned-section">+ <motion.div+ layout+ transition={{ duration: 0.22, ease: [0.16, 1, 0.3, 1] }}className={`section-label pinned-header-interactive ${pinnedCollapsed ? 'is-collapsed' : ''}`}onClick={() => {const next = !pinnedCollapsed@@ -221,35 +223,42 @@ export function ItemList() {<ChevronDownIcon style={{ transform: pinnedCollapsed ? 'rotate(0deg)' : 'rotate(180deg)', transition: 'transform 0.22s ease' }} /></button></div>- </div>+ </motion.div><AnimatePresence initial={false}>{!pinnedCollapsed && (<motion.divkey="pinned-items-container"- initial={{ opacity: 0, height: 0 }}- animate={{ opacity: 1, height: 'auto' }}- exit={{ opacity: 0, height: 0 }}- transition={{ duration: 0.22, ease: [0.22, 1, 0.36, 1] }}- style={{ overflow: 'hidden', display: 'flex', flexDirection: 'column', gap: 8, marginTop: 6 }}+ layout+ initial={{ opacity: 0 }}+ animate={{ opacity: 1 }}+ exit={{ opacity: 0 }}+ transition={{ duration: 0.22, ease: [0.16, 1, 0.3, 1] }}+ style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 6 }}>- {pinned.map((it) => (- <ClipboardItemCard key={it.id} item={it} />- ))}+ <AnimatePresence initial={false}>+ {pinned.map((it) => (+ <ClipboardItemCard key={it.id} item={it} />+ ))}+ </AnimatePresence></motion.div>)}</AnimatePresence>- </section>+ </motion.section>)}{recent.length > 0 && (- <section>- {pinned.length > 0 && <div className="section-label">{t('item.recent')}</div>}+ <motion.section layout transition={{ duration: 0.22, ease: [0.16, 1, 0.3, 1] }} style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>+ {pinned.length > 0 && (+ <motion.div layout transition={{ duration: 0.22, ease: [0.16, 1, 0.3, 1] }} className="section-label">+ {t('item.recent')}+ </motion.div>+ )}<AnimatePresence initial={false}>{recent.map((it) => (<ClipboardItemCard key={it.id} item={it} />))}</AnimatePresence>- </section>+ </motion.section>)}</>)}diff --git a/src/lib/particleEvents.ts b/src/lib/particleEvents.tsnew file mode 100644index 0000000..f53a42e--- /dev/null+++ b/src/lib/particleEvents.ts@@ -0,0 +1,26 @@+/**+ * particleEvents - zero-dependency event emitter for deletion particle bursts.+ */++export interface ParticleBurstRect {+ left: number+ top: number+ width: number+ height: number+}++type BurstListener = (rect: ParticleBurstRect) => void++let _listeners: BurstListener[] = []++export const particleEvents = {+ emit(rect: ParticleBurstRect) {+ _listeners.forEach((l) => l(rect))+ },+ on(listener: BurstListener): () => void {+ _listeners.push(listener)+ return () => {+ _listeners = _listeners.filter((l) => l !== listener)+ }+ },+}diff --git a/src/store/appStore.ts b/src/store/appStore.tsindex 40f6d8c..51f63ec 100644--- a/src/store/appStore.ts+++ b/src/store/appStore.ts@@ -311,7 +311,10 @@ export const useStore = create<AppState>((set, get) => ({items: get().items.map((it) => (it.id === id ? { ...it, pinned } : it))})const items = await edge.setPinned(id, pinned)- set({ items })+ const current = get().items+ if (items.length !== current.length || items.some((it, i) => it.id !== current[i]?.id || it.pinned !== current[i]?.pinned)) {+ set({ items })+ }},async remove(id) {