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.

fix(ui): make pin, filter, and list motion compositor-only

Deepender2537150e9d1e9c
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsx
index 26524a3..5dd89fd 100644
--- a/src/components/ClipboardItem.tsx
+++ b/src/components/ClipboardItem.tsx
@@ -124,28 +124,10 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
<motion.div
ref={ref}
layout="position"
- initial={open ? { opacity: 0, scale: 0.96, y: 6 } : false}
- animate={{ opacity: 1, scale: 1, y: 0, height: 'auto', marginBottom: undefined }}
- exit={{
- opacity: 0,
- height: 0,
- marginBottom: 0,
- scale: 0.95,
- y: -4,
- transition: {
- opacity: { duration: 0.12, ease: [0.32, 0, 0.67, 0] },
- height: { duration: 0.18, ease: [0.16, 1, 0.3, 1] },
- marginBottom: { duration: 0.18, ease: [0.16, 1, 0.3, 1] },
- scale: { duration: 0.14, ease: [0.32, 0, 0.67, 0] }
- }
- }}
- transition={{
- layout: { duration: 0.22, ease: [0.16, 1, 0.3, 1] },
- type: 'spring',
- stiffness: 360,
- damping: 28,
- mass: 0.6
- }}
+ layoutId={`ed-card-${item.id}`}
+ initial={false}
+ animate={{ opacity: 1 }}
+ transition={{ layout: { duration: 0.18, ease: [0.22, 1, 0.36, 1] } }}
className={`item${item.pinned ? ' pinned' : ''}${isBundle ? ' bundle' : ''}`}
>
{copied && (
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 25c0100..4e67ad1 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -78,7 +78,7 @@ export function Header() {
<motion.div
initial={false}
animate={{ x: activeIndex * (filterChipWidth + 2) }}
- transition={{ type: 'spring', stiffness: 500, damping: 35 }}
+ transition={{ duration: 0.14, ease: [0.22, 1, 0.36, 1] }}
style={{
position: 'absolute',
left: 3,
diff --git a/src/components/ItemList.tsx b/src/components/ItemList.tsx
index 4bc671f..ad21d41 100644
--- a/src/components/ItemList.tsx
+++ b/src/components/ItemList.tsx
@@ -3,12 +3,12 @@
*
* Renders Pinned (if any) and Recent sections, handles OS drag-in of files &
* images onto the shelf, and shows the empty state when there's nothing.
- * AnimatePresence here gives items their staggered enter/exit.
+ * AnimatePresence popLayout keeps pin/delete from height-collapsing the list.
*
* Drag-in awareness: sets `dragActive` on the store while OS files are being
* dragged over the panel so the edge-hover hook knows not to close mid-drag.
*/
-import { AnimatePresence, motion } from 'framer-motion'
+import { AnimatePresence, LayoutGroup, motion } from 'framer-motion'
import { useRef, useEffect, useLayoutEffect, useState } from 'react'
import { useStore } from '../store/appStore'
import { useFilteredItems } from '../hooks/useFilteredItems'
@@ -122,11 +122,8 @@ export function ItemList() {
}, [isDraggingAny])
const handleScroll = (e: React.UIEvent<HTMLDivElement>) => {
- if (e.currentTarget.scrollTop > 50) {
- setShowScrollTop(true)
- } else {
- setShowScrollTop(false)
- }
+ const next = e.currentTarget.scrollTop > 50
+ setShowScrollTop((prev) => (prev === next ? prev : next))
}
const scrollToTop = () => {
@@ -186,10 +183,12 @@ export function ItemList() {
stopScrolling()
}
+ const filterKey = `${typeFilter}:${query}`
+
return (
- <motion.div
- className="list"
- ref={listRef}
+ <div
+ className="list"
+ ref={listRef}
onDragOver={handleDragOver}
onDragLeave={handleDragLeaveOrDrop}
onDrop={handleDragLeaveOrDrop}
@@ -198,12 +197,17 @@ export function ItemList() {
{total === 0 ? (
<EmptyState filtered={query.trim().length > 0} />
) : (
- <>
+ <LayoutGroup id={`shelf-${typeFilter}`}>
+ <motion.div
+ key={filterKey}
+ className="list-stack"
+ initial={{ opacity: 0.45 }}
+ animate={{ opacity: 1 }}
+ transition={{ duration: 0.12, ease: [0.22, 1, 0.36, 1] }}
+ >
{pinned.length > 0 && (
- <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] }}
+ <section className="pinned-section">
+ <div
className={`section-label pinned-header-interactive ${pinnedCollapsed ? 'is-collapsed' : ''}`}
onClick={() => {
const next = !pinnedCollapsed
@@ -219,55 +223,39 @@ export function ItemList() {
</div>
<div className="pinned-header-right">
<button className="act bundle-collapse-btn" type="button" aria-label="Toggle pinned section">
- <ChevronDownIcon style={{ transform: pinnedCollapsed ? 'rotate(0deg)' : 'rotate(180deg)', transition: 'transform 0.22s ease' }} />
+ <ChevronDownIcon style={{ transform: pinnedCollapsed ? 'rotate(0deg)' : 'rotate(180deg)', transition: 'transform 0.14s ease' }} />
</button>
</div>
- </motion.div>
- <AnimatePresence initial={false}>
- {!pinnedCollapsed && (
- <motion.div
- key="pinned-items-container"
- 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 }}
- >
- <AnimatePresence initial={false}>
- {pinned.map((it) => (
- <ClipboardItemCard key={it.id} item={it} />
- ))}
- </AnimatePresence>
- </motion.div>
- )}
- </AnimatePresence>
- </motion.section>
+ </div>
+ {!pinnedCollapsed && pinned.map((it) => (
+ <ClipboardItemCard key={it.id} item={it} />
+ ))}
+ </section>
)}
{recent.length > 0 && (
- <motion.section layout transition={{ duration: 0.22, ease: [0.16, 1, 0.3, 1] }} style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
+ <section className="recent-section">
{pinned.length > 0 && (
- <motion.div layout transition={{ duration: 0.22, ease: [0.16, 1, 0.3, 1] }} className="section-label">
+ <div className="section-label">
{t('item.recent')}
- </motion.div>
+ </div>
)}
- <AnimatePresence initial={false}>
- {recent.map((it) => (
- <ClipboardItemCard key={it.id} item={it} />
- ))}
- </AnimatePresence>
- </motion.section>
+ {recent.map((it) => (
+ <ClipboardItemCard key={it.id} item={it} />
+ ))}
+ </section>
)}
- </>
+ </motion.div>
+ </LayoutGroup>
)}
<AnimatePresence>
{showScrollTop && (
<motion.button
- initial={{ opacity: 0, scale: 0.8, y: 20 }}
- animate={{ opacity: 1, scale: 1, y: 0 }}
- exit={{ opacity: 0, scale: 0.8, y: 20 }}
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ exit={{ opacity: 0 }}
+ transition={{ duration: 0.12 }}
className="scroll-top-btn"
onClick={scrollToTop}
title={t('item.scrollToTop')}
@@ -278,6 +266,6 @@ export function ItemList() {
</motion.button>
)}
</AnimatePresence>
- </motion.div>
+ </div>
)
}
diff --git a/src/hooks/useAdaptiveSpring.ts b/src/hooks/useAdaptiveSpring.ts
index 5b08409..b2ed931 100644
--- a/src/hooks/useAdaptiveSpring.ts
+++ b/src/hooks/useAdaptiveSpring.ts
@@ -20,25 +20,23 @@ export function useAdaptiveSpring() {
}
if (dpr >= 1.75) {
- // Hi-DPI (2×+): Apple fluid spring curve
return {
type: 'spring',
- stiffness: 320,
- damping: 30,
- mass: 0.8,
- restDelta: 0.001,
- restSpeed: 0.001
+ stiffness: 520,
+ damping: 42,
+ mass: 0.5,
+ restDelta: 0.4,
+ restSpeed: 10
} as const
}
- // Standard DPI: smooth fluid spring curve
return {
type: 'spring',
- stiffness: 300,
- damping: 28,
- mass: 0.8,
- restDelta: 0.001,
- restSpeed: 0.001
+ stiffness: 480,
+ damping: 40,
+ mass: 0.5,
+ restDelta: 0.4,
+ restSpeed: 10
} as const
}, [])
}
@@ -54,11 +52,11 @@ export function useSubtleSpring() {
return {
type: 'spring',
- stiffness: 340,
- damping: 34,
- mass: 0.65,
- restDelta: 0.001,
- restSpeed: 0.001
+ stiffness: 480,
+ damping: 40,
+ mass: 0.5,
+ restDelta: 0.4,
+ restSpeed: 10
} as const
}, [])
}
diff --git a/src/styles/item.css b/src/styles/item.css
index 3af97af..57e83a3 100644
--- a/src/styles/item.css
+++ b/src/styles/item.css
@@ -13,9 +13,9 @@
border-radius: 14px;
user-select: none;
-webkit-user-select: none;
- transition: background 0.16s ease,
- border-color 0.16s ease,
- box-shadow 0.16s ease;
+ transition: background 0.12s ease,
+ border-color 0.12s ease,
+ box-shadow 0.12s ease;
overflow: hidden;
}
diff --git a/src/styles/panel.css b/src/styles/panel.css
index 0ca2a88..4211690 100644
--- a/src/styles/panel.css
+++ b/src/styles/panel.css
@@ -195,7 +195,7 @@
position: relative;
z-index: 1;
scrollbar-width: none; /* Firefox */
- scroll-behavior: smooth;
+ scroll-behavior: auto;
-webkit-overflow-scrolling: touch;
overscroll-behavior-y: contain;
-webkit-mask-image: linear-gradient(to bottom, transparent 0px, #000 6px, #000 calc(100% - 6px), transparent 100%);
@@ -218,6 +218,13 @@
margin-top: 4px;
}
+.list-stack,
+.recent-section,
+.pinned-section {
+ display: flex;
+ flex-direction: column;
+}
+
/* Clean Pinned Section */
.pinned-section {
background: transparent;