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): un-stack edge is a light on the screen edge, in the edge bar's place

Deepender251940aade0a9c
diff --git a/src/components/DashedOutline.tsx b/src/components/DashedOutline.tsx
index b6085b3..8415bc1 100644
--- a/src/components/DashedOutline.tsx
+++ b/src/components/DashedOutline.tsx
@@ -1,10 +1,10 @@
/**
- * The drag targets' dashed line (drop zone, stacking ring, detach edge).
+ * The drag targets' dashed outline (drop zone, stacking ring).
*
* 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.
+ * The outline fills its positioned parent.
*/
export function DashedOutline({ radius }: { radius: number }) {
return (
@@ -13,15 +13,3 @@ export function DashedOutline({ radius }: { radius: number }) {
</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/Panel.tsx b/src/components/Panel.tsx
index 0d2ba84..c353fef 100644
--- a/src/components/Panel.tsx
+++ b/src/components/Panel.tsx
@@ -25,7 +25,7 @@ import { CardMenu } from './CardMenu'
import { CopyIndicatorCurve } from './CopyIndicatorCurve'
import { useFilteredItems } from '../hooks/useFilteredItems'
import { registerEdgeDragCue } from '../lib/edgeDrag'
-import { DashedLine, DashedOutline } from './DashedOutline'
+import { DashedOutline } from './DashedOutline'
import { isKept } from '../../shared/itemMeta'
import { useTranslation } from '../i18n'
@@ -673,7 +673,11 @@ export function Panel() {
</AnimatePresence>
</div>
<DropOverlay isHorizontal={isHorizontal} />
- <SplitDropZone stickPosition={settings.stickPosition || (isRight ? 'right' : 'left')} />
+ <SplitDropZone
+ stickPosition={settings.stickPosition || (isRight ? 'right' : 'left')}
+ lineStart={isHorizontal ? insetLeft : insetTop}
+ lineEnd={isHorizontal ? insetRight : insetBottom}
+ />
</div>
<PreviewFlyout isRight={isRight} />
<IndicatorStyleFlyout isRight={isRight} />
@@ -818,12 +822,13 @@ function DropOverlay({ isHorizontal }: { isHorizontal: boolean }) {
}
/**
- * 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.
+ * Detach target while a card is dragged out of an open stack: a soft blue
+ * glow coming out of the screen edge where the slim edge bar sits when the
+ * shelf is closed (same length, same alignment), fading out toward its ends;
+ * with the card over the strip it grows and brightens. The whole strip along
+ * that edge takes the drop. lineStart/lineEnd are the edge bar's insets.
*/
-function SplitDropZone({ stickPosition = 'left' }: { stickPosition?: 'left' | 'right' | 'top' }) {
+function SplitDropZone({ stickPosition = 'left', lineStart, lineEnd }: { stickPosition?: 'left' | 'right' | 'top'; lineStart: string; lineEnd: string }) {
const internalDragReq = useStore((s) => s.internalDragReq)
const reduceMotion = useStore((s) => !!s.settings.reduceMotion)
const isSubitemDragging = !!(
@@ -855,9 +860,6 @@ function SplitDropZone({ stickPosition = 'left' }: { stickPosition?: 'left' | 'r
}
}
- // Slides in from the edge it belongs to.
- const offset = stickPosition === 'top' ? { y: -8 } : stickPosition === 'right' ? { x: 8 } : { x: -8 }
-
return (
<AnimatePresence>
{isSubitemDragging && (
@@ -870,13 +872,20 @@ function SplitDropZone({ stickPosition = 'left' }: { stickPosition?: 'left' | 'r
onDragEnter={handleDragEnter}
onDragLeave={handleDragLeave}
onDrop={handleDrop}
- initial={{ opacity: 0, ...offset }}
- animate={{ opacity: 1, x: 0, y: 0 }}
- exit={{ opacity: 0, ...offset }}
- transition={reduceMotion ? { duration: 0.01 } : { type: 'spring', stiffness: 420, damping: 34 }}
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ exit={{ opacity: 0 }}
+ transition={{ duration: reduceMotion ? 0.01 : 0.14 }}
>
- <div className="split-line">
- <DashedLine vertical={stickPosition !== 'top'} />
+ <div
+ className="split-bar"
+ style={
+ stickPosition === 'top'
+ ? { left: `max(0px, ${lineStart})`, right: `max(0px, ${lineEnd})` }
+ : { top: `max(0px, ${lineStart})`, bottom: `max(0px, ${lineEnd})` }
+ }
+ >
+ <div className={`split-glow side-${stickPosition}`} />
</div>
</motion.div>
)}
diff --git a/src/styles/item.css b/src/styles/item.css
index a1d2575..561b216 100644
--- a/src/styles/item.css
+++ b/src/styles/item.css
@@ -2968,33 +2968,106 @@ html[data-motion='reduce'] .file-stack-folder {
right: 0;
}
-/* 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 {
+/* The light: a lit strip on the screen edge in the edge bar's place (inline
+ insets, see SplitDropZone). A near-white core right on the edge, a tight
+ system-blue glow around it and a wide soft bloom into the shelf, its ends
+ fading out along the edge. Drawn once at full reach; while dragging it is
+ dimmer and reaches less, over the strip it comes up to full (transform and
+ opacity only). */
+.split-bar {
position: absolute;
pointer-events: none;
- --dash-color: rgba(255, 255, 255, 0.45);
}
-.split-dropzone.active .split-line {
- --dash-color: rgba(255, 255, 255, 0.95);
+.split-dropzone.pos-top .split-bar {
+ top: 0;
+ height: 0;
}
-.split-dropzone.pos-top .split-line {
- top: 3px;
- left: 28px;
- right: 28px;
- height: 4px;
+.split-dropzone.pos-left .split-bar {
+ left: 0;
+ width: 0;
}
-.split-dropzone.pos-left .split-line,
-.split-dropzone.pos-right .split-line {
- top: 28px;
- bottom: 28px;
- width: 4px;
+.split-dropzone.pos-right .split-bar {
+ right: 0;
+ width: 0;
+}
+.split-glow {
+ position: absolute;
+ opacity: 0.6;
+ will-change: transform, opacity;
+ transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 260ms cubic-bezier(0.22, 1, 0.36, 1);
+ animation: split-glow-in 260ms cubic-bezier(0.22, 1, 0.36, 1);
}
-.split-dropzone.pos-left .split-line {
- left: 3px;
+.split-glow.side-left,
+.split-glow.side-right {
+ top: 0;
+ bottom: 0;
+ width: 48px;
+ transform: scaleX(0.7);
+ -webkit-mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 76%, transparent);
+ mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 76%, transparent);
}
-.split-dropzone.pos-right .split-line {
- right: 3px;
+.split-glow.side-left {
+ left: 0;
+ transform-origin: left center;
+ background: linear-gradient(
+ to right,
+ rgba(222, 240, 255, 1) 0,
+ rgba(222, 240, 255, 0.95) 1.5px,
+ rgba(10, 132, 255, 0.85) 3px,
+ rgba(10, 132, 255, 0.55) 6px,
+ rgba(10, 132, 255, 0.32) 11px,
+ rgba(10, 132, 255, 0.17) 18px,
+ rgba(10, 132, 255, 0.08) 27px,
+ rgba(10, 132, 255, 0.03) 37px,
+ rgba(10, 132, 255, 0) 48px
+ );
+}
+.split-glow.side-right {
+ right: 0;
+ transform-origin: right center;
+ background: linear-gradient(
+ to left,
+ rgba(222, 240, 255, 1) 0,
+ rgba(222, 240, 255, 0.95) 1.5px,
+ rgba(10, 132, 255, 0.85) 3px,
+ rgba(10, 132, 255, 0.55) 6px,
+ rgba(10, 132, 255, 0.32) 11px,
+ rgba(10, 132, 255, 0.17) 18px,
+ rgba(10, 132, 255, 0.08) 27px,
+ rgba(10, 132, 255, 0.03) 37px,
+ rgba(10, 132, 255, 0) 48px
+ );
+}
+.split-glow.side-top {
+ left: 0;
+ right: 0;
+ top: 0;
+ height: 48px;
+ transform: scaleY(0.7);
+ transform-origin: center top;
+ background: linear-gradient(
+ to bottom,
+ rgba(222, 240, 255, 1) 0,
+ rgba(222, 240, 255, 0.95) 1.5px,
+ rgba(10, 132, 255, 0.85) 3px,
+ rgba(10, 132, 255, 0.55) 6px,
+ rgba(10, 132, 255, 0.32) 11px,
+ rgba(10, 132, 255, 0.17) 18px,
+ rgba(10, 132, 255, 0.08) 27px,
+ rgba(10, 132, 255, 0.03) 37px,
+ rgba(10, 132, 255, 0) 48px
+ );
+ -webkit-mask-image: linear-gradient(to right, transparent, #000 24%, #000 76%, transparent);
+ mask-image: linear-gradient(to right, transparent, #000 24%, #000 76%, transparent);
+}
+.split-dropzone.active .split-glow {
+ opacity: 1;
+ transform: none;
+}
+@keyframes split-glow-in {
+ from {
+ opacity: 0;
+ }
}
/* In-app drag onto another card: the card a drop would stack into gets the
diff --git a/src/styles/panel.css b/src/styles/panel.css
index 8b247b1..80f1fac 100644
--- a/src/styles/panel.css
+++ b/src/styles/panel.css
@@ -267,7 +267,7 @@
animation: none;
}
-/* The drag targets' dashed line (DashedOutline / DashedLine): a 2px stroke,
+/* The drag targets' dashed line (DashedOutline): 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. */
diff --git a/tests/dragExperience.test.ts b/tests/dragExperience.test.ts
index 1ebc674..1cd413d 100644
--- a/tests/dragExperience.test.ts
+++ b/tests/dragExperience.test.ts
@@ -252,14 +252,28 @@ describe('drag looks', () => {
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'} />")
+ it('detach zone: a light on the screen edge (bright core, blue bloom), in the place of the edge bar, no text, no orange', () => {
+ expect(itemCss).not.toMatch(/249, 115, 22|#f97316|#ff8a3d|glow-line|split-well|split-label|split-line|split-cue/)
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\);/)
+ expect(panel).not.toContain('DashedLine')
+ expect(panel).toContain('<div className={`split-glow side-${stickPosition}`} />')
+ // as long as the closed edge bar and aligned like it
+ expect(panel).toContain('lineStart={isHorizontal ? insetLeft : insetTop}')
+ expect(panel).toContain('lineEnd={isHorizontal ? insetRight : insetBottom}')
+ expect(panel).toContain("? { left: `max(0px, ${lineStart})`, right: `max(0px, ${lineEnd})` }")
+ expect(panel).toContain(": { top: `max(0px, ${lineStart})`, bottom: `max(0px, ${lineEnd})` }")
+ // the light starts on the screen edge itself: a near-white core, then a system-blue glow and bloom into the shelf
+ for (const dir of ['to right', 'to left', 'to bottom']) {
+ expect(itemCss).toContain(`background: linear-gradient(\n ${dir},\n rgba(222, 240, 255, 1) 0,\n rgba(222, 240, 255, 0.95) 1.5px,\n rgba(10, 132, 255, 0.85) 3px,`)
+ }
+ expect(itemCss).toContain('rgba(10, 132, 255, 0) 48px')
+ // its ends fade out along the edge
+ expect(itemCss).toContain('mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 76%, transparent);')
+ expect(itemCss).toContain('mask-image: linear-gradient(to right, transparent, #000 24%, #000 76%, transparent);')
+ // dimmer and reaching less while dragging, full over the strip, by transform and opacity only
+ expect(itemCss).toMatch(/\.split-glow \{\n position: absolute;\n opacity: 0\.6;/)
+ expect(itemCss).toMatch(/transition: transform 260ms cubic-bezier\(0\.22, 1, 0\.36, 1\), opacity 260ms cubic-bezier\(0\.22, 1, 0\.36, 1\);/)
+ expect(itemCss).toMatch(/\.split-dropzone\.active \.split-glow \{\n opacity: 1;\n transform: none;/)
// 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;/)
diff --git a/tests/stackFeatures.test.ts b/tests/stackFeatures.test.ts
index c55a759..071d6f3 100644
--- a/tests/stackFeatures.test.ts
+++ b/tests/stackFeatures.test.ts
@@ -51,10 +51,10 @@ describe('Stack Features: SVG Folder Silhouette, Sizing, Horizontal Expansion &
it('Panel.tsx passes stickPosition to SplitDropZone for left/top/right orientations without text pill', () => {
const src = read('src/components/Panel.tsx')
- expect(src).toContain('SplitDropZone stickPosition={settings.stickPosition')
+ expect(src).toMatch(/<SplitDropZone\s+stickPosition=\{settings\.stickPosition/)
expect(src).toContain('pos-${stickPosition}')
- // slides in from its own edge in each dock
- expect(src).toContain("const offset = stickPosition === 'top' ? { y: -8 } : stickPosition === 'right' ? { x: 8 } : { x: -8 }")
+ // grows out of its own edge in each dock (the bar's side class)
+ expect(src).toContain('side-${stickPosition}')
// Text pill must NOT be introduced into SplitDropZone
expect(src).not.toContain('split-dropzone-pill')
})