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(shelf): drop zone opens and closes without a flicker
Deepender2545699190392b
diff --git a/src/components/Panel.tsx b/src/components/Panel.tsxindex 1e6536a..4c9b3fa 100644--- a/src/components/Panel.tsx+++ b/src/components/Panel.tsx@@ -770,6 +770,9 @@ function PinGlow({ isHorizontal }: { isHorizontal: boolean }) {return <div key={glow.at} className={`pin-glow from-${from}`} aria-hidden="true" />}+/** How long the drop zone takes to fade once something is dropped on it. */+const ACCEPT_FADE_MS = 280+function DropOverlay({ isHorizontal }: { isHorizontal: boolean }) {const { t } = useTranslation()const open = useStore((s) => s.open)@@ -799,6 +802,13 @@ function DropOverlay({ isHorizontal }: { isHorizontal: boolean }) {return () => window.clearTimeout(timer)}, [open, incoming, held, accepted])const visible = held || (open && incoming)+ // A drag that opens the shelf opens it straight into the zone: no fade-in then, or the cards showed+ // under the fading zone for a moment, a flicker between the two. Onto an open shelf it fades in.+ const wasOpen = useRef(open)+ const intoZone = open && !wasOpen.current+ useEffect(() => {+ wasOpen.current = open+ }, [open])useEffect(() => {if (!visible) return@@ -808,9 +818,12 @@ function DropOverlay({ isHorizontal }: { isHorizontal: boolean }) {document.addEventListener('drop', onDrop, true)return () => document.removeEventListener('drop', onDrop, true)}, [visible])+ // The drop: the zone fades at once, taking it in as it goes (is-accepted: the well draws in, the arrow+ // drops, the zone fades in CSS, panel.css), so the new card comes up under it; it is unmounted only once+ // it has faded. It used to hold for 240ms first, an empty zone after the drop that then cut to the cards.useEffect(() => {if (!accepted) return- const timer = window.setTimeout(() => setAccepted(false), reduceMotion ? 0 : 240)+ const timer = window.setTimeout(() => setAccepted(false), reduceMotion ? 0 : ACCEPT_FADE_MS + 40)return () => window.clearTimeout(timer)}, [accepted, reduceMotion])@@ -820,10 +833,10 @@ function DropOverlay({ isHorizontal }: { isHorizontal: boolean }) {<motion.divkey="drop-overlay"className={`drop-overlay${isHorizontal ? ' is-horizontal' : ''}${over ? ' is-over' : ''}${accepted ? ' is-accepted' : ''}`}- initial={{ opacity: 0 }}+ initial={{ opacity: intoZone ? 1 : 0 }}animate={{ opacity: 1 }}exit={{ opacity: 0 }}- transition={{ duration: reduceMotion ? 0.01 : accepted ? 0.2 : 0.14, ease: [0.22, 1, 0.36, 1] }}+ transition={{ duration: reduceMotion ? 0.01 : 0.14, ease: [0.22, 1, 0.36, 1] }}><div className="drop-well"><DashedOutline radius={16} />diff --git a/src/styles/panel.css b/src/styles/panel.cssindex 7a76368..69ba810 100644--- a/src/styles/panel.css+++ b/src/styles/panel.css@@ -374,6 +374,13 @@ rect.dashed-outline-shape {transform: scale(0.97);transition-duration: 200ms;}+/* Taken in: the zone fades as the new card comes up under it (Panel unmounts it once faded,+ ACCEPT_FADE_MS). A CSS transition over framer-motion's inline opacity (hence !important): framer's+ own fade showed the zone at full opacity for a frame as it finished, a flash after the drop. */+.drop-overlay.is-accepted {+ opacity: 0 !important;+ transition: opacity 280ms cubic-bezier(0.45, 0, 0.25, 1);+}.drop-icon {flex-shrink: 0;display: grid;@@ -542,6 +549,7 @@ rect.dashed-outline-shape {animation-name: pin-glow-plain;}+[data-motion='reduce'] .drop-overlay.is-accepted,[data-motion='reduce'] .drop-overlay::before,[data-motion='reduce'] .drop-well,[data-motion='reduce'] .drop-icon,