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
feat(indicator): liquid-tab copy indicator with compositor-only motion
Deepender258a446b4c721c
diff --git a/src/components/CopyIndicatorCurve.tsx b/src/components/CopyIndicatorCurve.tsxindex 1d69db1..8b10f8d 100644--- a/src/components/CopyIndicatorCurve.tsx+++ b/src/components/CopyIndicatorCurve.tsx@@ -1,16 +1,20 @@/*** Copy confirmation at the stick edge.*- * Apple-like: one purposeful enter, a still hold, a matching exit.- * No looping bob, no glow bloom. Reduce Motion fades only.+ * A small liquid tab grows out of the edge bar with a soft spring, the icon+ * pops in just behind it, holds, then the icon goes first and the tab draws+ * back into the bar. Same shape and motion in every dock.+ *+ * All motion is CSS transform/opacity transitions (see `.copy-ind` in+ * panel.css), so the compositor runs it with no per-frame JS. The element+ * stays mounted and is hidden at rest, so a copy during the exit simply+ * reverses the motion instead of restarting it.*/-import { motion, AnimatePresence } from 'framer-motion'+import { useMemo, type CSSProperties } from 'react'import { useStore } from '../store/appStore'import { OCTO_PATH } from './LiquidOctopusLoader'+import { COPY_TAB_BEHIND_EDGE, COPY_TAB_DEPTH, copyTabPath, edgeBarCenter } from '../lib/copyIndicatorShape'-/** System confirmation ease — fast settle, no bounce. */-const EASE_OUT: [number, number, number, number] = [0.22, 1, 0.36, 1]-const ENTER_MS = 0.3const ICON_FILTER = 'drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35))'export function LogoIndicatorIcon({@@ -53,13 +57,14 @@ export function LogoIndicatorIcon({export function TickIndicatorIcon({fillColor = '#ffffff',size = 36,- animated = false+ draw = false}: {color?: stringfillColor?: stringglowColor?: stringsize?: number- animated?: boolean+ /** Let the copy indicator draw the stroke in (CSS, `.copy-ind .tick-draw`). */+ draw?: boolean}) {return (<div@@ -81,26 +86,14 @@ export function TickIndicatorIcon({xmlns="http://www.w3.org/2000/svg"style={{ display: 'block', overflow: 'visible' }}>- {animated ? (- <motion.path- d="M 5.0 12.5 L 9.5 17.0 L 22.8 2.8"- stroke={fillColor}- strokeWidth="2.6"- strokeLinecap="round"- strokeLinejoin="round"- initial={{ pathLength: 0, opacity: 0 }}- animate={{ pathLength: 1, opacity: 1 }}- transition={{ duration: 0.28, ease: EASE_OUT }}- />- ) : (- <path- d="M 5.0 12.5 L 9.5 17.0 L 22.8 2.8"- stroke={fillColor}- strokeWidth="2.6"- strokeLinecap="round"- strokeLinejoin="round"- />- )}+ <path+ d="M 5.0 12.5 L 9.5 17.0 L 22.8 2.8"+ stroke={fillColor}+ strokeWidth="2.6"+ strokeLinecap="round"+ strokeLinejoin="round"+ {...(draw ? { className: 'tick-draw', pathLength: 1 } : {})}+ /></svg></div>)@@ -108,13 +101,11 @@ export function TickIndicatorIcon({export function CopyIndicatorIcon({fillColor = '#ffffff',- size = 36,- animated = false+ size = 36}: {fillColor?: stringglowColor?: stringsize?: number- animated?: boolean}) {const maskId = 'copy-icon-gap-mask'@@ -143,53 +134,23 @@ export function CopyIndicatorIcon({<rect x="6.8" y="0.8" width="16.4" height="16.4" rx="5.8" fill="#000000" /></mask></defs>- {animated ? (- <>- <motion.rect- x="2.5"- y="8.5"- width="13"- height="13"- rx="4.2"- fill={fillColor}- mask={`url(#${maskId})`}- initial={{ scale: 0.92, opacity: 0 }}- animate={{ scale: 1, opacity: 1 }}- transition={{ duration: 0.28, ease: EASE_OUT }}- />- <motion.rect- x="8.5"- y="2.5"- width="13"- height="13"- rx="4.2"- fill={fillColor}- initial={{ scale: 0.92, opacity: 0 }}- animate={{ scale: 1, opacity: 1 }}- transition={{ duration: 0.28, ease: EASE_OUT, delay: 0.04 }}- />- </>- ) : (- <>- <rect- x="2.5"- y="8.5"- width="13"- height="13"- rx="4.2"- fill={fillColor}- mask={`url(#${maskId})`}- />- <rect- x="8.5"- y="2.5"- width="13"- height="13"- rx="4.2"- fill={fillColor}- />- </>- )}+ <rect+ x="2.5"+ y="8.5"+ width="13"+ height="13"+ rx="4.2"+ fill={fillColor}+ mask={`url(#${maskId})`}+ />+ <rect+ x="8.5"+ y="2.5"+ width="13"+ height="13"+ rx="4.2"+ fill={fillColor}+ /></svg></div>)@@ -197,13 +158,11 @@ export function CopyIndicatorIcon({export function SparkleIndicatorIcon({fillColor = '#ffffff',- size = 36,- animated = false+ size = 36}: {fillColor?: stringglowColor?: stringsize?: number- animated?: boolean}) {return (<div@@ -224,35 +183,14 @@ export function SparkleIndicatorIcon({fill="none"style={{ display: 'block', overflow: 'visible' }}>- {animated ? (- <>- <motion.path- d="M 9.5 1.5 C 9.5 5.8 5.8 9.5 1.5 9.5 C 5.8 9.5 9.5 13.2 9.5 17.5 C 9.5 13.2 13.2 9.5 17.5 9.5 C 13.2 9.5 9.5 5.8 9.5 1.5 Z"- fill={fillColor}- initial={{ scale: 0.86, opacity: 0 }}- animate={{ scale: 1, opacity: 1 }}- transition={{ duration: 0.28, ease: EASE_OUT }}- />- <motion.path- d="M 18.5 12.5 C 18.5 15.2 16.2 17.5 13.5 17.5 C 16.2 17.5 18.5 19.8 18.5 22.5 C 18.5 19.8 20.8 17.5 23.5 17.5 C 20.8 17.5 18.5 15.2 18.5 12.5 Z"- fill={fillColor}- initial={{ scale: 0.86, opacity: 0 }}- animate={{ scale: 1, opacity: 1 }}- transition={{ duration: 0.28, ease: EASE_OUT, delay: 0.05 }}- />- </>- ) : (- <>- <path- d="M 9.5 1.5 C 9.5 5.8 5.8 9.5 1.5 9.5 C 5.8 9.5 9.5 13.2 9.5 17.5 C 9.5 13.2 13.2 9.5 17.5 9.5 C 13.2 9.5 9.5 5.8 9.5 1.5 Z"- fill={fillColor}- />- <path- d="M 18.5 12.5 C 18.5 15.2 16.2 17.5 13.5 17.5 C 16.2 17.5 18.5 19.8 18.5 22.5 C 18.5 19.8 20.8 17.5 23.5 17.5 C 20.8 17.5 18.5 15.2 18.5 12.5 Z"- fill={fillColor}- />- </>- )}+ <path+ d="M 9.5 1.5 C 9.5 5.8 5.8 9.5 1.5 9.5 C 5.8 9.5 9.5 13.2 9.5 17.5 C 9.5 13.2 13.2 9.5 17.5 9.5 C 13.2 9.5 9.5 5.8 9.5 1.5 Z"+ fill={fillColor}+ />+ <path+ d="M 18.5 12.5 C 18.5 15.2 16.2 17.5 13.5 17.5 C 16.2 17.5 18.5 19.8 18.5 22.5 C 18.5 19.8 20.8 17.5 23.5 17.5 C 20.8 17.5 18.5 15.2 18.5 12.5 Z"+ fill={fillColor}+ /></svg></div>)@@ -260,153 +198,65 @@ export function SparkleIndicatorIcon({export function CopyIndicatorCurve() {const copyFlareActive = useStore((s) => s.copyFlareActive)- const flareKey = useStore((s) => s.flareKey)const open = useStore((s) => s.open)const settings = useStore((s) => s.settings)- const isRight = settings.stickPosition === 'right'- const isTop = settings.stickPosition === 'top'- const isHorizontal = isTop+ const dock = settings.stickPosition === 'right' ? 'right' : settings.stickPosition === 'top' ? 'top' : 'left'const indicatorStyle = settings.copyIndicatorStyle || 'logo'- const reduceMotion = !!settings.reduceMotion-- const screenH = typeof window !== 'undefined' ? window.innerHeight : 1080- const bulge = 48- const hw = settings.hotZoneWidth || 3+ const barWidth = settings.hotZoneWidth || 3- let boxW = 75- let boxH = 75- let activePath = ''- let flatPath = ''+ const shape = useMemo(() => copyTabPath(barWidth), [barWidth])- if (isHorizontal) {- const W = 297 // 220 * 1.35 (+35% increase, matches trigger bar)- boxW = W- boxH = 75- activePath = `M 0,0 L 0,${hw} C ${W * 0.22},${hw} ${W * 0.28},${bulge} ${W / 2},${bulge} C ${W * 0.72},${bulge} ${W * 0.78},${hw} ${W},${hw} L ${W},0 Z`- flatPath = `M 0,0 L 0,${hw} C ${W * 0.22},${hw} ${W * 0.28},${hw} ${W / 2},${hw} C ${W * 0.72},${hw} ${W * 0.78},${hw} ${W},${hw} L ${W},0 Z`- } else {- const H = screenH * (settings.hotZoneHeight || 0.25)- boxW = 75- boxH = H- const curvePathLeft = `M 0,0 L ${hw},0 C ${hw},${H * 0.22} ${bulge},${H * 0.28} ${bulge},${H / 2} C ${bulge},${H * 0.72} ${hw},${H * 0.78} ${hw},${H} L 0,${H} Z`- const flatPathLeft = `M 0,0 L ${hw},0 C ${hw},${H * 0.22} ${hw},${H * 0.28} ${hw},${H / 2} C ${hw},${H * 0.72} ${hw},${H * 0.78} ${hw},${H} L 0,${H} Z`+ if (settings.showCopyIndicator === false) return null- const curvePathRight = `M ${boxW},0 L ${boxW - hw},0 C ${boxW - hw},${H * 0.22} ${boxW - bulge},${H * 0.28} ${boxW - bulge},${H / 2} C ${boxW - bulge},${H * 0.72} ${boxW - hw},${H * 0.78} ${boxW - hw},${H} L ${boxW},${H} Z`- const flatPathRight = `M ${boxW},0 L ${boxW - hw},0 C ${boxW - hw},${H * 0.22} ${boxW - hw},${H * 0.28} ${boxW - hw},${H / 2} C ${boxW - hw},${H * 0.72} ${boxW - hw},${H * 0.78} ${boxW - hw},${H} L ${boxW},${H} Z`+ const on = copyFlareActive && !open+ const viewport = { width: window.innerWidth, height: window.innerHeight }+ const along = edgeBarCenter(settings, viewport)- activePath = isRight ? curvePathRight : curvePathLeft- flatPath = isRight ? flatPathRight : flatPathLeft- }+ // Anchor: a zero-size point on the screen edge at the middle of the bar.+ const anchor: CSSProperties =+ dock === 'top'+ ? { top: 0, left: along }+ : { top: along, [dock]: 0 }- const showCurve = (settings.showCopyIndicator !== false) && copyFlareActive && !open+ const svgW = COPY_TAB_BEHIND_EDGE + COPY_TAB_DEPTH + 8+ const svgH = shape.halfLength * 2- const pFrac = settings.panelHeight || 0.6- const panelH = screenH * pFrac- const minY = panelH / 2- const maxY = screenH - panelH / 2- const vOffset = settings.verticalOffset ?? 0.5- const midY = minY + vOffset * (maxY - minY)-- const fade = { duration: reduceMotion ? 0.12 : ENTER_MS, ease: reduceMotion ? 'linear' : EASE_OUT }+ let className = `copy-ind copy-ind--${dock}`+ if (on) className += ' is-on'+ if (settings.reduceMotion) className += ' is-reduced'return (- <AnimatePresence>- {showCurve && (- <motion.div- key={`copy-sine-curve-${flareKey}`}- className={`copy-curve-container ${settings.stickPosition}`}- initial={{ opacity: 0 }}- animate={{ opacity: 1 }}- exit={{ opacity: 0 }}- transition={fade}- style={- isHorizontal- ? {- position: 'absolute',- left: '50%',- x: '-50%',- top: 0,- width: boxW,- height: boxH,- pointerEvents: 'none',- zIndex: 9999- }- : {- position: 'absolute',- top: `${midY}px`,- y: '-50%',- [isRight ? 'right' : 'left']: 0,- width: boxW,- height: boxH,- pointerEvents: 'none',- zIndex: 9999- }- }+ <div+ className={className}+ aria-hidden="true"+ style={{ ...anchor, '--copy-tab-start': `${barWidth / COPY_TAB_DEPTH}` } as CSSProperties}+ >+ <div className="copy-ind__orient">+ <svg+ className="copy-ind__shape"+ width={svgW}+ height={svgH}+ viewBox={`${-COPY_TAB_BEHIND_EDGE} ${-shape.halfLength} ${svgW} ${svgH}`}+ style={{+ left: -COPY_TAB_BEHIND_EDGE,+ top: -shape.halfLength,+ transformOrigin: `${COPY_TAB_BEHIND_EDGE}px ${shape.halfLength}px`+ }}>- <svg- width={boxW}- height={boxH}- viewBox={`0 0 ${boxW} ${boxH}`}- fill="none"- xmlns="http://www.w3.org/2000/svg"- style={{ overflow: 'visible' }}- >- <motion.path- d={activePath}- fill="#000000"- stroke="none"- initial={{ d: reduceMotion ? activePath : flatPath }}- animate={{ d: activePath }}- exit={{ d: reduceMotion ? activePath : flatPath }}- transition={fade}- />- </svg>-- <motion.div- initial={reduceMotion ? { opacity: 0 } : { scale: 0.92, opacity: 0 }}- animate={reduceMotion ? { opacity: 1 } : { scale: 1, opacity: 1 }}- exit={reduceMotion ? { opacity: 0 } : { scale: 0.92, opacity: 0 }}- transition={{ ...fade, delay: reduceMotion ? 0 : 0.04 }}- style={- isHorizontal- ? {- position: 'absolute',- left: '50%',- x: '-50%',- top: 2,- width: 43.3,- height: 43.3,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- pointerEvents: 'none'- }- : {- position: 'absolute',- top: '50%',- y: '-50%',- [isRight ? 'right' : 'left']: 2,- width: 43.3,- height: 43.3,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- pointerEvents: 'none'- }- }- >- {indicatorStyle === 'check' ? (- <TickIndicatorIcon fillColor="#ffffff" animated />- ) : indicatorStyle === 'copy' ? (- <CopyIndicatorIcon fillColor="#ffffff" animated />- ) : indicatorStyle === 'sparkle' ? (- <SparkleIndicatorIcon fillColor="#ffffff" animated />- ) : (- <LogoIndicatorIcon fillColor="#ffffff" size={38} />- )}- </motion.div>- </motion.div>- )}- </AnimatePresence>+ <path d={shape.d} fill="#000000" />+ </svg>+ </div>+ <div className="copy-ind__icon">+ {indicatorStyle === 'check' ? (+ <TickIndicatorIcon fillColor="#ffffff" size={26} draw />+ ) : indicatorStyle === 'copy' ? (+ <CopyIndicatorIcon fillColor="#ffffff" size={24} />+ ) : indicatorStyle === 'sparkle' ? (+ <SparkleIndicatorIcon fillColor="#ffffff" size={26} />+ ) : (+ <LogoIndicatorIcon fillColor="#ffffff" size={30} />+ )}+ </div>+ </div>)}diff --git a/src/lib/copyIndicatorShape.ts b/src/lib/copyIndicatorShape.tsnew file mode 100644index 0000000..9caa5a3--- /dev/null+++ b/src/lib/copyIndicatorShape.ts@@ -0,0 +1,108 @@+/**+ * Outline of the copy indicator: a small liquid tab that grows out of the+ * edge bar.+ *+ * The profile is a box (half-length A, depth DEPTH) softened by a Gaussian+ * of width SOFTNESS. That gives a flat cap for the icon, rounded shoulders,+ * and concave feet that melt back into the bar, with no corners anywhere.+ * It starts and ends at the bar's own thickness, so the tab and the bar read+ * as one shape.+ *+ * Coordinates are for a left dock: x points away from the screen edge, y+ * runs along it, and (0, 0) is the middle of the tab on the edge. Other+ * docks mirror or rotate it in CSS.+ */++/** How far the tab reaches out from the screen edge, in px. */+export const COPY_TAB_DEPTH = 48+const A = 30+const SOFTNESS = 10+/** Points sampled along the outline (smoothed into cubic curves). */+const SAMPLES = 48+/** The closed outline runs this far behind the screen edge so no gap shows. */+const BEHIND_EDGE = 40++// Abramowitz & Stegun 7.1.26 (max error 1.5e-7): plenty for drawing.+function erf(v: number): number {+ const s = Math.sign(v)+ const x = Math.abs(v)+ const t = 1 / (1 + 0.3275911 * x)+ const y = 1 - (((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t) * Math.exp(-x * x)+ return s * y+}++/** Distance of the outline from the screen edge at position y along it. */+export function copyTabProfile(y: number, barWidth: number): number {+ const box = 0.5 * (erf((A - y) / SOFTNESS) + erf((A + y) / SOFTNESS))+ return barWidth + (COPY_TAB_DEPTH - barWidth) * (box / erf(A / SOFTNESS))+}++/**+ * Closed SVG path for the tab plus its half-length along the edge.+ * The ends stop once the outline is within 0.05px of the bar.+ */+export function copyTabPath(barWidth: number): { d: string; halfLength: number } {+ const bar = Math.max(0, barWidth)+ let half = A+ while (copyTabProfile(half, bar) - bar > 0.05) half += 0.5++ const pts: Array<[number, number]> = []+ for (let i = 0; i <= SAMPLES; i++) {+ const y = -half + (2 * half * i) / SAMPLES+ pts.push([copyTabProfile(Math.abs(y), bar), y])+ }+ const r = (v: number) => +v.toFixed(2)+ let d = `M ${-BEHIND_EDGE} ${r(-half)} L ${r(pts[0][0])} ${r(pts[0][1])}`+ // Catmull-Rom through the samples, written as cubic Beziers.+ for (let i = 0; i < SAMPLES; i++) {+ const p0 = pts[Math.max(0, i - 1)]+ const p1 = pts[i]+ const p2 = pts[i + 1]+ const p3 = pts[Math.min(SAMPLES, i + 2)]+ const c1x = p1[0] + (p2[0] - p0[0]) / 6+ const c1y = p1[1] + (p2[1] - p0[1]) / 6+ const c2x = p2[0] - (p3[0] - p1[0]) / 6+ const c2y = p2[1] - (p3[1] - p1[1]) / 6+ d += ` C ${r(c1x)} ${r(c1y)} ${r(c2x)} ${r(c2y)} ${r(p2[0])} ${r(p2[1])}`+ }+ d += ` L ${-BEHIND_EDGE} ${r(half)} Z`+ return { d, halfLength: half }+}++export const COPY_TAB_BEHIND_EDGE = BEHIND_EDGE++/**+ * Centre of the visible edge bar, in window px, along the edge.+ * Mirrors the trigger-bar placement in Panel.tsx (alignment + offsets) so+ * the tab always grows out of the bar itself.+ */+export function edgeBarCenter(+ settings: {+ stickPosition?: string+ panelHeight?: number+ verticalOffset?: number+ hotZoneHeight?: number+ triggerAlignment?: string+ },+ viewport: { width: number; height: number }+): number {+ const alignment = settings.triggerAlignment || 'center'+ if (settings.stickPosition === 'top') {+ const bladeW = Math.min(viewport.width - 60, 1080)+ const hz = settings.hotZoneHeight ?? 0.25+ const barW = hz >= 0.55 ? 575 : hz >= 0.35 ? 400 : 275+ const mid = viewport.width / 2+ if (alignment === 'top' || alignment === 'left') return mid - bladeW / 2 + barW / 2+ if (alignment === 'bottom' || alignment === 'right') return mid + bladeW / 2 - barW / 2+ return mid+ }+ const screenH = viewport.height+ const panelH = screenH * (settings.panelHeight || 0.6)+ const minY = panelH / 2+ const maxY = screenH - panelH / 2+ const midY = Math.round(minY + (settings.verticalOffset ?? 0.5) * (maxY - minY))+ const barH = Math.round(screenH * (settings.hotZoneHeight ?? 0.25))+ if (alignment === 'top') return midY - panelH / 2 + barH / 2+ if (alignment === 'bottom') return midY + panelH / 2 - barH / 2+ return midY+}diff --git a/src/styles/global.css b/src/styles/global.cssindex 5bcb69b..c51d701 100644--- a/src/styles/global.css+++ b/src/styles/global.css@@ -73,7 +73,7 @@ svg {.thumb-wrap,.thumb,.kind-badge,-.copy-curve-container,+.copy-ind__shape,.style-card {-webkit-background-clip: padding-box;background-clip: padding-box;diff --git a/src/styles/panel.css b/src/styles/panel.cssindex ea5be20..4045596 100644--- a/src/styles/panel.css+++ b/src/styles/panel.css@@ -1026,16 +1026,116 @@}}-/* Copy Indicator Sine Curve Morph Styles */-.copy-curve-container {+/* Copy indicator: a liquid tab that grows out of the edge bar.+ .copy-ind is a zero-size anchor on the screen edge at the middle of the+ bar. The shape is drawn for a left dock; .copy-ind__orient mirrors it for+ the right dock and turns it for the top. Everything animates with+ transform/opacity, so the compositor runs it (no per-frame JS). */+.copy-ind {+ position: absolute;+ width: 0;+ height: 0;pointer-events: none;- z-index: 100;+ z-index: 9999;}-.copy-indicator-badge {- box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.25);- user-select: none;- font-family: inherit;- font-feature-settings: "cv02", "cv03", "cv04", "cv11";+.copy-ind__orient {+ position: absolute;+ left: 0;+ top: 0;+}+.copy-ind--right .copy-ind__orient {+ transform: scaleX(-1);+}+.copy-ind--top .copy-ind__orient {+ transform: rotate(90deg);+}++/* Rest: squashed into the bar (bar thickness / tab depth) and hidden once+ the exit has finished. Exit: critically damped spring, no bounce, starts+ 60ms after the icon leaves. */+.copy-ind__shape {+ position: absolute;+ display: block;+ overflow: visible;+ transform: scale(var(--copy-tab-start), 0.62);+ visibility: hidden;+ transition:+ transform 289ms linear(0, 0.021 1.8%, 0.058 3.8%, 0.116 6.3%, 0.23 10.5%, 0.402 16.8%, 0.503 20.8%, 0.586 24.5%, 0.659 28.2%, 0.725 32.3%, 0.782 36.5%, 0.832 41%, 0.874 46%, 0.911 51.7%, 0.941 58.5%, 0.965 66.8%, 0.982 77.5%, 0.994 93.8%, 1) 60ms,+ visibility 0s linear 360ms;+}+/* Enter: spring with response 0.40s and damping 0.72, a 3.8% overshoot. */+.copy-ind.is-on .copy-ind__shape {+ transform: scale(1, 1);+ visibility: visible;+ transition:+ transform 444ms linear(0, 0.007 1.8%, 0.03 3.8%, 0.071 6%, 0.138 8.8%, 0.246 12.5%, 0.524 21.5%, 0.649 26%, 0.745 30%, 0.826 34%, 0.891 38%, 0.944 42.3%, 0.985 46.8%, 1.014 51.7%, 1.032 57.8%, 1.038 65.5%, 1.026 80%, 1.006 99.8%, 1),+ visibility 0s;+}++/* Icon: centred on the tab's flat cap, upright in every dock. */+.copy-ind__icon {+ position: absolute;+ left: 25px;+ top: 0;+ transform: translate(-50%, -50%) scale(0.5);+ opacity: 0;+ visibility: hidden;+ transition:+ opacity 110ms cubic-bezier(0.4, 0, 1, 1),+ transform 160ms cubic-bezier(0.4, 0, 1, 1),+ visibility 0s linear 160ms;+}+.copy-ind--right .copy-ind__icon {+ left: -25px;+}+.copy-ind--top .copy-ind__icon {+ left: 0;+ top: 25px;+}+/* Pops in once the tab is big enough to hold it (110ms): spring with+ response 0.34s, damping 0.62. */+.copy-ind.is-on .copy-ind__icon {+ transform: translate(-50%, -50%) scale(1);+ opacity: 1;+ visibility: visible;+ transition:+ opacity 160ms cubic-bezier(0.2, 0, 0, 1) 110ms,+ transform 348ms linear(0, 0.008 2%, 0.033 4.3%, 0.078 6.8%, 0.149 9.8%, 0.255 13.5%, 0.58 24%, 0.705 28.5%, 0.802 32.5%, 0.884 36.5%, 0.95 40.5%, 1.001 44.5%, 1.039 48.8%, 1.067 53.5%, 1.081 59%, 1.082 65.8%, 1.061 76.3%, 1.016 95.3%, 1.008 99.8%, 1) 110ms,+ visibility 0s;+}++/* Check style: the tick draws itself in once the icon has appeared. */+.copy-ind .tick-draw {+ stroke-dasharray: 1;+ stroke-dashoffset: 1;+ transition: stroke-dashoffset 0s linear 200ms;+}+.copy-ind.is-on .tick-draw {+ stroke-dashoffset: 0;+ transition: stroke-dashoffset 280ms cubic-bezier(0.22, 1, 0.36, 1) 170ms;+}++/* Reduce motion: full-size shape and icon simply fade. */+.copy-ind.is-reduced .copy-ind__shape {+ transform: none;+ opacity: 0;+ transition: opacity 120ms linear, visibility 0s linear 120ms;+}+.copy-ind.is-reduced.is-on .copy-ind__shape {+ opacity: 1;+ transition: opacity 120ms linear, visibility 0s;+}+.copy-ind.is-reduced .copy-ind__icon {+ transform: translate(-50%, -50%);+ transition: opacity 120ms linear, visibility 0s linear 120ms;+}+.copy-ind.is-reduced.is-on .copy-ind__icon {+ transform: translate(-50%, -50%);+ transition: opacity 120ms linear, visibility 0s;+}+.copy-ind.is-reduced .tick-draw {+ stroke-dashoffset: 0;+ transition: none;}diff --git a/tests/copyIndicator.test.ts b/tests/copyIndicator.test.tsnew file mode 100644index 0000000..5086aa7--- /dev/null+++ b/tests/copyIndicator.test.ts@@ -0,0 +1,89 @@+import { describe, expect, it } from 'vitest'+import { readFileSync } from 'node:fs'+import { join } from 'node:path'+import { COPY_TAB_DEPTH, copyTabPath, copyTabProfile, edgeBarCenter } from '../src/lib/copyIndicatorShape'++const read = (p: string) => readFileSync(join(__dirname, '..', p), 'utf8')++describe('copy indicator shape', () => {+ it('reaches full depth in the middle and melts back into the bar at the ends', () => {+ for (const bar of [1, 3, 7]) {+ expect(copyTabProfile(0, bar)).toBeCloseTo(COPY_TAB_DEPTH, 6)+ const { halfLength } = copyTabPath(bar)+ expect(copyTabProfile(halfLength, bar) - bar).toBeLessThanOrEqual(0.05)+ expect(copyTabProfile(halfLength, bar)).toBeGreaterThanOrEqual(bar)+ }+ })++ it('is symmetric and only ever gets shallower away from the middle (no bumps)', () => {+ let last = Infinity+ for (let y = 0; y <= 70; y += 0.5) {+ const v = copyTabProfile(y, 3)+ expect(v).toBeCloseTo(copyTabProfile(-y, 3), 9)+ expect(v).toBeLessThanOrEqual(last + 1e-9)+ last = v+ }+ })++ it('has a flat cap for the icon: within 1px of full depth for the middle 30px', () => {+ for (let y = 0; y <= 15; y += 1) expect(COPY_TAB_DEPTH - copyTabProfile(y, 3)).toBeLessThan(1)+ })++ it('is the same compact size in every dock (about 100px along the edge)', () => {+ const { halfLength, d } = copyTabPath(3)+ expect(halfLength * 2).toBeGreaterThan(90)+ expect(halfLength * 2).toBeLessThan(115)+ expect(d.startsWith('M -40 ')).toBe(true)+ expect(d.endsWith('Z')).toBe(true)+ })+})++describe('copy indicator placement follows the edge bar', () => {+ const vp = { width: 384, height: 1000 }+ const base = { panelHeight: 0.5, verticalOffset: 0.5, hotZoneHeight: 0.2 }++ it('side docks: bar centre for each alignment', () => {+ // panel 500 tall centred at 500 -> spans 250..750; bar is 200 long.+ expect(edgeBarCenter({ ...base, stickPosition: 'left' }, vp)).toBe(500)+ expect(edgeBarCenter({ ...base, stickPosition: 'right', triggerAlignment: 'top' }, vp)).toBe(350)+ expect(edgeBarCenter({ ...base, stickPosition: 'left', triggerAlignment: 'bottom' }, vp)).toBe(650)+ })++ it('top dock: bar centre for each alignment', () => {+ const wide = { width: 1200, height: 400 }+ // blade 1080 wide centred at 600 -> 60..1140; bar 275 wide at hotZoneHeight 0.2.+ expect(edgeBarCenter({ ...base, stickPosition: 'top' }, wide)).toBe(600)+ expect(edgeBarCenter({ ...base, stickPosition: 'top', triggerAlignment: 'left' }, wide)).toBe(60 + 137.5)+ expect(edgeBarCenter({ ...base, stickPosition: 'top', triggerAlignment: 'right' }, wide)).toBe(1140 - 137.5)+ })+})++describe('copy indicator motion', () => {+ const tsx = read('src/components/CopyIndicatorCurve.tsx')+ const css = read('src/styles/panel.css')++ it('has no per-frame JS: no framer-motion, no path morphing', () => {+ expect(tsx).not.toContain('framer-motion')+ expect(tsx).not.toContain('AnimatePresence')+ expect(tsx).toContain("if (on) className += ' is-on'")+ })++ it('grows the tab out of the bar with transforms only', () => {+ expect(css).toMatch(/\.copy-ind__shape \{[^}]*transform: scale\(var\(--copy-tab-start\), 0\.62\);/)+ expect(css).toMatch(/\.copy-ind\.is-on \.copy-ind__shape \{[^}]*transform: scale\(1, 1\);/)+ expect(tsx).toContain("'--copy-tab-start': `${barWidth / COPY_TAB_DEPTH}`")+ })++ it('hides everything only after the exit has finished', () => {+ const shape = css.match(/\.copy-ind__shape \{([^}]*)\}/)?.[1] ?? ''+ // exit: 289ms spring starting 60ms late -> done at 349ms+ expect(shape).toContain('visibility 0s linear 360ms')+ const icon = css.match(/\.copy-ind__icon \{([^}]*)\}/)?.[1] ?? ''+ expect(icon).toContain('visibility 0s linear 160ms')+ })++ it('honours Reduce motion with plain fades', () => {+ expect(tsx).toContain("if (settings.reduceMotion) className += ' is-reduced'")+ expect(css).toMatch(/\.copy-ind\.is-reduced \.copy-ind__shape \{\s*transform: none;\s*opacity: 0;/)+ })+})