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(drag-drop,icons): optimize drag ghost latency and update pastel icon palettes

Deepender25368fa35249a3
diff --git a/electron/main/drag.ts b/electron/main/drag.ts
index cf3f960..3dd55f6 100644
--- a/electron/main/drag.ts
+++ b/electron/main/drag.ts
@@ -86,16 +86,52 @@ interface Staged {
files?: string[]
}
+const stagedCache = new Map<string, Staged>()
+const STAGED_CACHE_MAX = 64
+
+function getStagedCacheKey(data: ItemData, capturedAt?: number): string {
+ switch (data.kind) {
+ case 'files':
+ return `files:${data.paths.join('|')}`
+ case 'image':
+ return `img:${data.imageId}:${data.ext || 'png'}:${capturedAt || 0}`
+ case 'image-collection':
+ return `imgs:${data.images.map((i) => i.imageId).join('|')}:${capturedAt || 0}`
+ case 'text':
+ return `text:${data.text.slice(0, 100)}`
+ }
+}
+
+/** Pre-stage a drag request in the background so drag initiation is 0ms. */
+export function prestageDrag(req: DragRequest): void {
+ try {
+ const resolved = resolveDragData(req)
+ if (!resolved) return
+ const { data, capturedAt } = resolved
+ stageDragFile(data, capturedAt)
+ dragIcon(data)
+ } catch {}
+}
+
/** Resolve the item to a concrete file path to hand to the OS. */
export function stageDragFile(data: ItemData, capturedAt?: number): Staged | null {
+ const cacheKey = getStagedCacheKey(data, capturedAt)
+ const cached = stagedCache.get(cacheKey)
+ if (cached && existsSync(cached.file)) {
+ return cached
+ }
+
const temp = getUnpackagedTempDir()
mkdirSync(temp, { recursive: true })
+ let result: Staged | null = null
+
switch (data.kind) {
case 'files': {
const real = data.paths.filter((p) => existsSync(p))
if (!real.length) return null
const exposed = toUnpackagedFilePaths(real)
- return { file: exposed[0], files: exposed }
+ result = { file: exposed[0], files: exposed }
+ break
}
case 'image': {
const src = getStore().getImagePath(data.imageId, data.ext)
@@ -110,7 +146,8 @@ export function stageDragFile(data: ItemData, capturedAt?: number): Staged | nul
} catch {
return null
}
- return { file: dest, files: [dest] }
+ result = { file: dest, files: [dest] }
+ break
}
case 'image-collection': {
const paths: string[] = []
@@ -133,7 +170,8 @@ export function stageDragFile(data: ItemData, capturedAt?: number): Staged | nul
}
}
if (!paths.length) return null
- return { file: paths[0], files: paths }
+ result = { file: paths[0], files: paths }
+ break
}
case 'text': {
const id = `${Date.now().toString(36)}`
@@ -143,9 +181,20 @@ export function stageDragFile(data: ItemData, capturedAt?: number): Staged | nul
} catch {
return null
}
- return { file: dest, files: [dest] }
+ result = { file: dest, files: [dest] }
+ break
+ }
+ }
+
+ if (result) {
+ stagedCache.set(cacheKey, result)
+ if (stagedCache.size > STAGED_CACHE_MAX) {
+ const first = stagedCache.keys().next().value
+ if (first) stagedCache.delete(first)
}
}
+
+ return result
}
/* ------------------------------------------------------------------ */
@@ -211,79 +260,26 @@ function dragIcon(data: ItemData): Electron.NativeImage {
return getFileDragIcon()
}
-function getGlyphSvg(kind: string, color: string): string {
- switch (kind) {
- case 'pdf':
- return `<g> <g fill="${color}" fill-rule="evenodd" clip-rule="evenodd"> <path d="M15.143 22H8.286A4.286 4.286 0 0 1 4 17.714V6.286A4.286 4.286 0 0 1 8.286 2h4.008a3.5 3.5 0 0 1 2.304.866l3.635 3.18a3.5 3.5 0 0 1 1.196 2.635v9.033A4.286 4.286 0 0 1 15.143 22m0-2H8.286A2.286 2.286 0 0 1 6 17.714V6.286A2.286 2.286 0 0 1 8.286 4h4.008a1.5 1.5 0 0 1 .987.371l3.635 3.18a1.5 1.5 0 0 1 .513 1.13v9.033A2.286 2.286 0 0 1 15.143 20" /> <path d="M7 12a1 1 0 0 1 1-1h5a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1m0 4a1 1 0 0 1 1-1h3.125a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1m6-13a1 1 0 0 1 1 1v3a1 1 0 0 0 1 1h2.5a1 1 0 1 1 0 2H15a3 3 0 0 1-3-3V4a1 1 0 0 1 1-1" /> </g> </g>`
- case 'archive':
- return `<g> <g fill="${color}" fill-rule="evenodd" clip-rule="evenodd"> <path d="m14.071 2.887l4.786 2.762a4.14 4.14 0 0 1 2.071 3.588v5.526c0 1.48-.79 2.848-2.071 3.588l-4.786 2.762a4.14 4.14 0 0 1-4.142 0l-4.786-2.762a4.14 4.14 0 0 1-2.071-3.588V9.237c0-1.48.79-2.848 2.071-3.588L9.93 2.887a4.14 4.14 0 0 1 4.142 0Zm-1 1.732a2.14 2.14 0 0 0-2.142 0L6.143 7.38a2.14 2.14 0 0 0-1.071 1.856v5.526c0 .765.408 1.473 1.071 1.856l4.786 2.762a2.14 2.14 0 0 0 2.142 0l4.786-2.762a2.14 2.14 0 0 0 1.071-1.856V9.237c0-.765-.408-1.473-1.071-1.856L13.07 4.62Z" /> <path d="m10.595 11.844l-5.9-2.95l.895-1.788l5.899 2.949c.322.16.7.16 1.022 0l5.899-2.95l.895 1.79l-5.9 2.949a3.14 3.14 0 0 1-2.81 0" /> <path d="M13 11.428v9.143h-2v-9.143zM7.677 5.267a1 1 0 0 1 1.342-.447l6.857 3.428a1 1 0 1 1-.895 1.79l-6.857-3.43a1 1 0 0 1-.447-1.34Z" /> </g> </g>`
- case 'code':
- return `<g> <g fill="${color}" fill-rule="evenodd" clip-rule="evenodd"> <path d="M3 9.612c0-1.563 1.333-2.72 2.837-2.72H9v2H5.837c-.525 0-.837.383-.837.72v9.56c0 .337.312.72.837.72h6.326c.525 0 .837-.383.837-.72v-.288h2v.287c0 1.563-1.333 2.72-2.837 2.72H5.837C4.333 21.892 3 20.735 3 19.172z" /> <path d="M17.2 19h-5.4C9.643 19 8 17.214 8 15.143V5.857C8 3.787 9.643 2 11.8 2h3.022c.867 0 1.703.322 2.347.903l2.675 2.415A3.5 3.5 0 0 1 21 7.918v7.225C21 17.213 19.357 19 17.2 19m0-2h-5.4c-.994 0-1.8-.831-1.8-1.857V5.857C10 4.831 10.806 4 11.8 4h3.022c.372 0 .73.138 1.007.387l2.675 2.416A1.5 1.5 0 0 1 19 7.918v7.225C19 16.169 18.194 17 17.2 17" /> <path d="M11 11a1 1 0 0 1 1-1h4a1 1 0 1 1 0 2h-4a1 1 0 0 1-1-1m0 4a1 1 0 0 1 1-1h2.5a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1m4-12a1 1 0 0 1 1 1v1.997C16 6.551 16.449 7 17.003 7H19a1 1 0 1 1 0 2h-1.997A3.003 3.003 0 0 1 14 5.997V4a1 1 0 0 1 1-1" /> </g> </g>`
- case 'text':
- return `<path fill="${color}" d="m16.263 8.361l.001-.184c.009-.578.319-1.159.897-1.159h.85a.27.27 0 0 1 .27.27v8.654c0 .291.063.805.219.984c.156.171.439.257.8.257h1.18c.342 0 .59.221.644.56a3 3 0 0 1 .05.861c0 .234-.197.41-.431.416c-.12.003-.267-.002-.634-.002c-.468.03-1.235 0-1.72 0c-.837 0-1.19-.059-1.642-.44c-.593-.5-.5-1.23-.5-2zm4.069 1.66c.506 0 .991.333.991.84c0 .156-.007-.003-.023.139c-.05.403-.385.669-.791.673l-3.213.034h-2.68c-.481 0-.74-.324-.74-.805c0-.535.3-.9.835-.897l2.589.013zM3.433 7.005c-.307-.001-.58-.212-.609-.517a5 5 0 0 1-.024-.48q0-.224.024-.482c.03-.31.308-.526.62-.527l9.701-.017c.284 0 .543.177.584.458q.037.247.037.482q0 .582-.357.828q-.358.234-1.11.235l-.912.03q-.234 0-.702-.012A120 120 0 0 0 9.3 6.985h-2c-.164 0 .16.01-.143.018c-.304.008-1.043.011-1.215.011zM7.3 8.641v-.817q.012-.369.012-.84v-.062a.922.922 0 0 1 1.744-.417l.244.48v11.279a.723.723 0 0 1-.665.736c-.23.015-.146 0-.335 0c-.206 0-.11.015-.347 0a.71.71 0 0 1-.653-.724z" />`
- case 'word':
- return `<g> <g fill="${color}" fill-rule="evenodd" clip-rule="evenodd"> <path d="M15.143 22H8.286A4.286 4.286 0 0 1 4 17.714V6.286A4.286 4.286 0 0 1 8.286 2h4.008a3.5 3.5 0 0 1 2.304.866l3.635 3.18a3.5 3.5 0 0 1 1.196 2.635v9.033A4.286 4.286 0 0 1 15.143 22m0-2H8.286A2.286 2.286 0 0 1 6 17.714V6.286A2.286 2.286 0 0 1 8.286 4h4.008a1.5 1.5 0 0 1 .987.371l3.635 3.18a1.5 1.5 0 0 1 .513 1.13v9.033A2.286 2.286 0 0 1 15.143 20" /> <path d="M7 12a1 1 0 0 1 1-1h5a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1m0 4a1 1 0 0 1 1-1h3.125a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1m6-13a1 1 0 0 1 1 1v3a1 1 0 0 0 1 1h2.5a1 1 0 1 1 0 2H15a3 3 0 0 1-3-3V4a1 1 0 0 1 1-1" /> </g> </g>`
- case 'excel':
- return `<g> <g fill="${color}" fill-rule="evenodd" clip-rule="evenodd"> <path d="M6 2h12a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4m0 2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z" /> <path d="M12 6a1 1 0 0 1 1 1v10a1 1 0 1 1-2 0V7a1 1 0 0 1 1-1M7 9a1 1 0 0 1 1 1v7a1 1 0 1 1-2 0v-7a1 1 0 0 1 1-1m10 3a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0v-4a1 1 0 0 1 1-1" /> </g> </g>`
- case 'powerpoint':
- return `<g> <g fill="${color}" fill-rule="evenodd" clip-rule="evenodd"> <path d="M4.511 5.032c.197-.037.462-.038 1.004-.031a7 7 0 0 1 1.953.294c1.026.312 2.084.94 3.029 1.5l.082.05c.208.123.331.197.415.253a19 19 0 0 1 .006.448v10.367c-.977-.474-2.195-.884-3.78-1.203a49 49 0 0 1-1.888-.493c-.47-.14-.635-.226-.684-.261a1.6 1.6 0 0 1-.336-.294a1.6 1.6 0 0 1-.204-.398c-.092-.233-.108-.5-.108-1.558v-6.81c0-.671.003-1.054.05-1.336c.037-.225.089-.299.158-.367a.5.5 0 0 1 .303-.16ZM5.401 3c-.884-.013-1.792-.026-2.599.771c-.436.43-.636.926-.725 1.464C2 5.698 2 6.249 2 6.83v7.024c0 .838-.002 1.513.248 2.145c.126.319.27.615.488.894c.217.278.47.49.748.69c.346.247.8.408 1.276.55c.494.148 1.147.31 1.972.517l.049.012l.023.005c2.184.437 3.471 1.033 4.35 1.641l.011.008c.045.031.15.104.254.157c.097.049.523.253 1 .003a1.08 1.08 0 0 0 .565-.821c.017-.116.016-.244.016-.297V7.513c0-.225 0-.456-.018-.654a1.85 1.85 0 0 0-.224-.765a1.9 1.9 0 0 0-.555-.59a8 8 0 0 0-.574-.362l-.029-.017l-.144-.086c-.897-.533-2.14-1.273-3.407-1.658a9 9 0 0 0-2.51-.38z" /> <path d="M19.489 5.032c-.197-.037-.462-.038-1.004-.031a7 7 0 0 0-1.953.294c-1.026.312-2.084.94-3.029 1.5l-.082.05c-.208.123-.331.197-.415.253l-.004.13C13 7.314 13 7.416 13 7.545v10.367c.977-.474 2.195-.884 3.78-1.203a49 49 0 0 0 1.888-.493c.47-.14.635-.226.684-.261a1.6 1.6 0 0 0 .336-.294c.053-.069.114-.17.204-.398c.092-.233.108-.5.108-1.558v-6.81c0-.671-.003-1.054-.05-1.336c-.037-.225-.089-.299-.158-.367a.5.5 0 0 0-.303-.16M18.599 3c.884-.013 1.791-.026 2.599.771c.436.43.636.926.725 1.464C22 5.698 22 6.249 22 6.83v7.024c0 .838.002 1.513-.248 2.145a3.5 3.5 0 0 1-.488.894c-.217.278-.47.49-.748.69c-.346.247-.8.408-1.276.55c-.494.148-1.147.31-1.972.517l-.049.012l-.023.005c-2.184.437-3.471 1.033-4.35 1.641l-.011.008c-.045.031-.15.104-.254.157a1.09 1.09 0 0 1-1 .003a1.09 1.09 0 0 1-.565-.821a2 2 0 0 1-.016-.297V7.513c0-.225 0-.456.018-.654c.02-.224.07-.495.224-.765a1.9 1.9 0 0 1 .555-.59c.165-.12.37-.241.574-.362l.029-.017l.144-.086c.897-.533 2.14-1.273 3.406-1.658a9 9 0 0 1 2.511-.38l.139-.002Z" /> </g> </g>`
- case 'audio':
- return `<path fill="${color}" fill-rule="evenodd" d="M6.733 7.2H5.545c-.235 0-.514 0-.761.02c-.39.025-.773.125-1.125.296A3 3 0 0 0 2.316 8.86c-.215.43-.273.84-.296 1.125a10 10 0 0 0-.02.806v2.465c0 .235 0 .514.02.761c.023.286.08.695.296 1.125a3 3 0 0 0 1.343 1.343c.43.215.84.273 1.125.296c.247.02.526.02.76.02h1.189l1.056 1.129l.05.054c.38.405.75.8 1.073 1.09c.28.253.888.778 1.748.876a3 3 0 0 0 2.625-1.037c.56-.66.645-1.457.678-1.834c.037-.433.037-.973.037-1.529V8.451c0-.556 0-1.096-.037-1.529c-.033-.376-.117-1.175-.678-1.834A3 3 0 0 0 10.66 4.05c-.86.098-1.467.623-1.748.876c-.323.29-.692.685-1.072 1.09l-.05.054zm.979 7.761c.1.067.187.159.36.342l1.177 1.259c.848.906 1.272 1.358 1.638 1.4a1 1 0 0 0 .875-.346c.238-.28.238-.9.238-2.14V8.524c0-1.24 0-1.861-.238-2.141a1 1 0 0 0-.875-.346c-.366.042-.79.494-1.638 1.4L8.07 8.697c-.172.183-.258.275-.36.341a1 1 0 0 1-.306.133c-.117.029-.243.029-.494.029H5.59c-.55 0-.826 0-1.037.105a1 1 0 0 0-.448.448C4 9.964 4 10.239 4 10.79v2.42c0 .55 0 .826.105 1.037a1 1 0 0 0 .448.447c.21.106.486.106 1.037.106h1.32c.252 0 .378 0 .495.029q.165.04.307.132m7.569-7.156a1 1 0 0 1 1.414-.024A5.87 5.87 0 0 1 18.5 12c0 1.59-.654 3.106-1.805 4.219a1.001 1.001 0 0 1-1.698-.735a1 1 0 0 1 .308-.703A3.87 3.87 0 0 0 16.5 12a3.87 3.87 0 0 0-1.195-2.781a1 1 0 0 1-.024-1.414" clip-rule="evenodd" /> <path fill="${color}" fill-rule="evenodd" d="M17.36 4.367a.9.9 0 0 1 1.273-.006A10.75 10.75 0 0 1 21.828 12c0 2.867-1.15 5.615-3.195 7.64a.901.901 0 0 1-1.463-.99a.9.9 0 0 1 .197-.29a8.95 8.95 0 0 0 2.66-6.36a8.95 8.95 0 0 0-2.66-6.36a.9.9 0 0 1-.007-1.273" clip-rule="evenodd" />`
- case 'video':
- return `<g> <g fill="${color}" fill-rule="evenodd" clip-rule="evenodd"> <path d="M6 5h7a4 4 0 0 1 4 4v6a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4V9a4 4 0 0 1 4-4m0 2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z" /> <path d="M20 14.887a.5.5 0 0 1-.832.373l-2-1.777a.5.5 0 0 1-.168-.374V10.83a.5.5 0 0 1 .172-.377l2-1.736a.5.5 0 0 1 .828.378v5.79Zm-4.139-5.944l2-1.735C19.482 5.803 22 6.953 22 9.096v5.79c0 2.158-2.549 3.302-4.16 1.87l-2-1.779A2.5 2.5 0 0 1 15 13.11v-2.28a2.5 2.5 0 0 1 .861-1.888Z" /> </g> </g>`
- case 'image':
- return `<g> <g fill="${color}"> <path fill-rule="evenodd" d="M6.188 2h11.625A4.187 4.187 0 0 1 22 6.188v11.625A4.187 4.187 0 0 1 17.812 22H6.188A4.187 4.187 0 0 1 2 17.812V6.188A4.19 4.19 0 0 1 6.188 2m0 2C4.979 4 4 4.98 4 6.188v11.625C4 19.02 4.98 20 6.188 20h11.625C19.02 20 20 19.02 20 17.812V6.188C20 4.98 19.02 4 17.812 4z" clip-rule="evenodd" /> <path fill-rule="evenodd" d="M17.24 10.924a1.19 1.19 0 0 0-1.51-.013l-5.244 4.247a2.094 2.094 0 0 1-2.59.035l-1.385-1.06a.094.094 0 0 0-.122.007l-2.698 2.582a1 1 0 1 1-1.382-1.444l2.697-2.583a2.094 2.094 0 0 1 2.721-.15l1.385 1.06a.094.094 0 0 0 .116-.001l5.242-4.247a3.19 3.19 0 0 1 4.053.033l3.12 2.613a1 1 0 0 1-1.285 1.533z" clip-rule="evenodd" /> <path d="M10.281 8.64a1.64 1.64 0 1 1-3.28 0a1.64 1.64 0 0 1 3.28 0" /> </g> </g>`
- default:
- return `<g> <g fill="${color}" fill-rule="evenodd" clip-rule="evenodd"> <path d="M15.143 22H8.286A4.286 4.286 0 0 1 4 17.714V6.286A4.286 4.286 0 0 1 8.286 2h4.008a3.5 3.5 0 0 1 2.304.866l3.635 3.18a3.5 3.5 0 0 1 1.196 2.635v9.033A4.286 4.286 0 0 1 15.143 22m0-2H8.286A2.286 2.286 0 0 1 6 17.714V6.286A2.286 2.286 0 0 1 8.286 4h4.008a1.5 1.5 0 0 1 .987.371l3.635 3.18a1.5 1.5 0 0 1 .513 1.13v9.033A2.286 2.286 0 0 1 15.143 20" /> <path d="M13 3a1 1 0 0 1 1 1v3a1 1 0 0 0 1 1h2.5a1 1 0 1 1 0 2H15a3 3 0 0 1-3-3V4a1 1 0 0 1 1-1" /> </g> </g>`
- }
-}
+import { buildFileDragSvg } from './fileSvg'
-/** Generate a custom stacked card PNG icon representing file kinds with count badge. */
+/** Generate a custom standalone SVG PNG icon representing file kinds with count badge. */
function createFileStackDragIcon(paths: string[]): Electron.NativeImage {
const count = paths.length
if (count === 0) return getFileDragIcon()
- const kinds = paths.slice(0, 3).map((p) => getFileKind(p))
- const cacheKey = `stack|solid-black|${kinds.map((k) => k.kind).join('-')}|${count}`
+ const kinds = paths.slice(0, 3).map((p) => getFileKind(p).kind)
+ const cacheKey = `stack|pastel-svg|${kinds.join('-')}|${count}`
const cached = iconCache.get(cacheKey)
if (cached && !cached.isEmpty()) {
return cached
}
- const defsSvg = ''
-
- let cardsSvg = ''
- for (let i = kinds.length - 1; i >= 0; i--) {
- const info = kinds[i]
- const x = 16 - i * 4
- const y = 8 + i * 4
- cardsSvg += `
- <rect x="${x}" y="${y}" width="64" height="72" rx="10" fill="#000000" stroke="rgba(255,255,255,0.18)" stroke-width="1.5" />
- `
- if (i === 0) {
- cardsSvg += `
- <svg x="${x + 12}" y="${y + 16}" width="40" height="40" viewBox="0 0 24 24">
- ${getGlyphSvg(info.kind, info.color)}
- </svg>
- `
- }
- }
-
- const badgeSvg = count > 1 ? `
- <circle cx="18" cy="18" r="14" fill="#FF3B30" stroke="#FFFFFF" stroke-width="2" />
- <text x="18" y="23" font-family="sans-serif" font-size="13" font-weight="bold" fill="#FFFFFF" text-anchor="middle">+${count}</text>
- ` : ''
-
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 96 96">
- ${defsSvg}
- ${cardsSvg}
- ${badgeSvg}
- </svg>`
+ const svg = buildFileDragSvg(kinds, count)
try {
- const resvg = new Resvg(svg, { fitTo: { mode: 'zoom', value: 3 } })
+ const resvg = new Resvg(svg, { fitTo: { mode: 'zoom', value: 2 } })
const pngData = resvg.render().asPng()
- const img = nativeImage.createFromBuffer(pngData, { scaleFactor: 3 })
+ const img = nativeImage.createFromBuffer(pngData, { scaleFactor: 2 })
if (!img.isEmpty()) {
iconCache.set(cacheKey, img)
if (iconCache.size > ICON_CACHE_MAX) {
@@ -326,30 +322,33 @@ function createTextDragIcon(text: string): Electron.NativeImage {
line2 = line2.replace(/.{3}$/, '...')
}
+ const width = 330
+ const height = 92
+
const defsSvg = `
<defs>
<clipPath id="textClip">
- <rect x="48" y="0" width="200" height="72" />
+ <rect x="58" y="0" width="255" height="${height}" />
</clipPath>
</defs>
`
- const width = 260
- const height = 72
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">
${defsSvg}
- <rect x="2" y="2" width="${width - 4}" height="${height - 4}" rx="12" fill="#000000" stroke="rgba(255,255,255,0.15)" stroke-width="1.5" />
+ <rect x="2" y="2" width="${width - 4}" height="${height - 4}" rx="14" fill="#000000" stroke="rgba(255,255,255,0.15)" stroke-width="1.5" />
<!-- Accent Icon -->
- <svg x="14" y="24" width="24" height="24" viewBox="0 0 24 24">
- ${getGlyphSvg('text', '#8E8E93')}
+ <svg x="18" y="32" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="#A0A0A5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
+ <polyline points="14 2 14 8 20 8" />
+ <line x1="16" y1="13" x2="8" y2="13" />
+ <line x1="16" y1="17" x2="8" y2="17" />
</svg>
<!-- Text Content -->
<g clip-path="url(#textClip)">
- <text x="48" y="32" font-family="sans-serif" font-size="14" font-weight="600" fill="#FFFFFF">${escapeXml(line1)}</text>
- ${line2 ? `<text x="48" y="52" font-family="sans-serif" font-size="13" font-weight="400" fill="#A0A0A5">${escapeXml(line2)}</text>` : ''}
+ <text x="58" y="42" font-family="sans-serif" font-size="15" font-weight="600" fill="#FFFFFF">${escapeXml(line1)}</text>
+ ${line2 ? `<text x="58" y="66" font-family="sans-serif" font-size="14" font-weight="400" fill="#A0A0A5">${escapeXml(line2)}</text>` : ''}
</g>
</svg>`
@@ -366,9 +365,16 @@ function createTextDragIcon(text: string): Electron.NativeImage {
export function prewarmDragIcons(): void {
setTimeout(() => {
try {
- createFileStackDragIcon(['image.png'])
- createFileStackDragIcon(['file.txt'])
- createFileStackDragIcon(['archive.zip'])
+ const commonKinds = [
+ 'pdf', 'word', 'excel', 'powerpoint', 'archive',
+ 'text', 'code', 'audio', 'video', 'image',
+ 'executable', 'folder', 'file'
+ ]
+ for (const k of commonKinds) {
+ createFileStackDragIcon([`dummy.${k}`])
+ }
+ createFileStackDragIcon(['dummy.image', 'dummy.image'])
+ createFileStackDragIcon(['dummy.image', 'dummy.image', 'dummy.image'])
} catch {}
- }, 1000)
+ }, 400)
}
diff --git a/electron/main/fileSvg.ts b/electron/main/fileSvg.ts
new file mode 100644
index 0000000..5b28c33
--- /dev/null
+++ b/electron/main/fileSvg.ts
@@ -0,0 +1,395 @@
+import type { FileKind } from '../../src/lib/fileType'
+
+/**
+ * Generates the 1:1 exact vector SVG markup for the 3D pastel category folder icons
+ * matching CustomFileIcon.tsx without any glass container or background box.
+ */
+export function getFileKindSvgContent(kind: FileKind, uid = 'drag'): string {
+ const folderShadowId = `fsh-${uid}`
+ const sheetShadowId = `ssh-${uid}`
+ const glyphShadowId = `gsh-${uid}`
+
+ switch (kind) {
+ case 'folder':
+ return `
+ <defs>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#D97706" floodOpacity="0.12" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#FDE68A" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#FFFDF5" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#FBBF24" />
+ </g>
+ `
+
+ case 'executable':
+ return `
+ <defs>
+ <filter id="${glyphShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#3730A3" floodOpacity="0.22" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.05" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#4338CA" floodOpacity="0.12" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#C7D2FE" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#F5F7FF" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#93A4FC" />
+ <g filter="url(#${glyphShadowId})">
+ <g stroke="#FFFFFF" stroke-width="8" stroke-linecap="round">
+ <line x1="226" y1="235" x2="226" y2="218" />
+ <line x1="256" y1="235" x2="256" y2="218" />
+ <line x1="286" y1="235" x2="286" y2="218" />
+ <line x1="226" y1="343" x2="226" y2="360" />
+ <line x1="256" y1="343" x2="256" y2="360" />
+ <line x1="286" y1="343" x2="286" y2="360" />
+ <line x1="202" y1="259" x2="185" y2="259" />
+ <line x1="202" y1="289" x2="185" y2="289" />
+ <line x1="202" y1="319" x2="185" y2="319" />
+ <line x1="310" y1="259" x2="327" y2="259" />
+ <line x1="310" y1="289" x2="327" y2="289" />
+ <line x1="310" y1="319" x2="327" y2="319" />
+ </g>
+ <rect x="202" y="235" width="108" height="108" rx="20" fill="#FFFFFF" />
+ <rect x="226" y="259" width="60" height="60" rx="12" fill="#93A4FC" />
+ </g>
+ </g>
+ `
+
+ case 'audio':
+ return `
+ <defs>
+ <filter id="${glyphShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#6B21A8" floodOpacity="0.22" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.05" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#7E22CE" floodOpacity="0.12" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#E2D0FE" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#FAF5FF" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#C495FD" />
+ <g transform="translate(167.8, 190.6) scale(12)" filter="url(#${glyphShadowId})" fill="#FFFFFF">
+ <path d="M 10.888 2.518 L 6.132 3.477 C 5.98 3.508 5.86 3.565 5.76 3.65 C 5.66 3.735 5.6 3.86 5.6 4.02 C 5.596 4.047 5.59 4.1 5.59 4.18 L 5.59 10.132 C 5.59 10.272 5.578 10.407 5.484 10.522 C 5.389 10.637 5.274 10.672 5.137 10.699 L 4.827 10.762 C 4.434 10.842 4.177 10.895 3.946 10.985 C 3.738 11.066 3.555 11.186 3.427 11.318 C 3.25 11.5 3.12 11.75 3.095 12.313 C 3.126 12.61 3.261 12.895 3.49 13.105 C 3.646 13.247 3.84 13.355 4.068 13.401 C 4.304 13.448 4.558 13.432 4.926 13.358 C 5.122 13.318 5.306 13.256 5.481 13.153 C 5.656 13.05 5.81 12.89 5.919 12.748 C 6.028 12.606 6.12 12.36 6.152 12.198 C 6.194 11.996 6.204 11.812 6.204 11.61 L 6.204 6.347 C 6.204 6.071 6.284 5.997 6.506 5.943 C 6.53 5.938 10.46 5.146 10.644 5.11 C 10.901 5.061 11.022 5.135 11.022 5.404 L 11.022 8.928 C 11.022 9.068 11.021 9.208 10.926 9.324 C 10.832 9.439 10.715 9.474 10.578 9.502 L 10.268 9.564 C 9.875 9.644 9.619 9.697 9.388 9.787 C 9.18 9.868 8.997 9.988 8.868 10.121 C 8.69 10.3 8.56 10.55 8.528 11.115 C 8.558 11.412 8.702 11.697 8.932 11.907 C 9.088 12.049 9.282 12.157 9.51 12.203 C 9.745 12.25 10 12.234 10.367 12.16 C 10.564 12.12 10.747 12.058 10.923 11.955 C 11.098 11.852 11.251 11.692 11.361 11.55 C 11.467 11.393 11.546 11.206 11.594 11 C 11.636 10.798 11.646 10.614 11.646 10.412 L 11.646 2.812 C 11.646 2.666 11.593 2.562 11.486 2.502 C 11.38 2.44 11.19 2.456 10.888 2.518 Z" />
+ </g>
+ </g>
+ `
+
+ case 'code':
+ return `
+ <defs>
+ <filter id="${glyphShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#0369A1" floodOpacity="0.18" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.05" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#0284C7" floodOpacity="0.12" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#86DDFB" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#F0FBFF" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#53CAF7" />
+ <g filter="url(#${glyphShadowId})" fill="none" stroke="#FFFFFF" stroke-width="16" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M 200 240 L 156 289 L 200 338" />
+ <line x1="282" y1="222" x2="230" y2="356" />
+ <path d="M 312 240 L 356 289 L 312 338" />
+ </g>
+ </g>
+ `
+
+ case 'word':
+ return `
+ <defs>
+ <filter id="${sheetShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#000000" floodOpacity="0.06" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.04" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#000000" floodOpacity="0.08" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#9DC5FA" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#F2F7FE" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#7BAFF8" />
+ <g filter="url(#${sheetShadowId})">
+ <path d="M 204 200 C 195 200 188 207 188 216 L 188 364 C 188 373 195 380 204 380 L 308 380 C 317 380 324 373 324 364 L 324 244 C 324 240 322 236 319 233 L 291 205 C 288 202 284 200 280 200 Z" fill="#F2F7FE" />
+ <path d="M 281 201 L 281 232 C 281 238 286 243 292 243 L 323 243" fill="none" stroke="#7BAFF8" stroke-width="7" stroke-linecap="round" stroke-linejoin="round" />
+ <text x="210" y="278" fill="#7BAFF8" font-family="-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif" font-size="52" font-weight="800" letter-spacing="-0.5" text-anchor="start">W</text>
+ <line x1="210" y1="306" x2="302" y2="306" stroke="#7BAFF8" stroke-width="7" stroke-linecap="round" />
+ <line x1="210" y1="328" x2="302" y2="328" stroke="#7BAFF8" stroke-width="7" stroke-linecap="round" />
+ <line x1="210" y1="350" x2="258" y2="350" stroke="#7BAFF8" stroke-width="7" stroke-linecap="round" />
+ </g>
+ </g>
+ `
+
+ case 'image':
+ return `
+ <defs>
+ <filter id="${glyphShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#6B4F3B" floodOpacity="0.22" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.05" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#8C6A4F" floodOpacity="0.14" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#DFCEBC" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#FFFDF9" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#BA9B7B" />
+ <g filter="url(#${glyphShadowId})">
+ <circle cx="272" cy="260" r="14" fill="#FFFFFF" />
+ <path d="M 178 346 L 178 326 L 230 274 L 266 308 L 298 282 L 334 324 L 334 346 Z" fill="#FFFFFF" />
+ <rect x="176" y="228" width="160" height="122" rx="18" fill="none" stroke="#FFFFFF" stroke-width="12" />
+ </g>
+ </g>
+ `
+
+ case 'pdf':
+ return `
+ <defs>
+ <filter id="${sheetShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#000000" floodOpacity="0.06" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.04" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#000000" floodOpacity="0.08" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#FF92A0" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#FFF0F2" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#FF7C8E" />
+ <g filter="url(#${sheetShadowId})">
+ <path d="M 204 200 C 195 200 188 207 188 216 L 188 364 C 188 373 195 380 204 380 L 308 380 C 317 380 324 373 324 364 L 324 244 C 324 240 322 236 319 233 L 291 205 C 288 202 284 200 280 200 Z" fill="#FFF0F2" />
+ <path d="M 281 201 L 281 232 C 281 238 286 243 292 243 L 323 243" fill="none" stroke="#FF7C8E" stroke-width="7" stroke-linecap="round" stroke-linejoin="round" />
+ <text x="256" y="302" fill="#FF7C8E" font-family="-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif" font-size="38" font-weight="800" letter-spacing="0.5" text-anchor="middle">PDF</text>
+ <line x1="208" y1="330" x2="304" y2="330" stroke="#FF7C8E" stroke-width="7" stroke-linecap="round" />
+ <line x1="208" y1="352" x2="304" y2="352" stroke="#FF7C8E" stroke-width="7" stroke-linecap="round" />
+ </g>
+ </g>
+ `
+
+ case 'powerpoint':
+ return `
+ <defs>
+ <filter id="${sheetShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#000000" floodOpacity="0.06" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.04" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#000000" floodOpacity="0.08" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#FFC492" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#FFF8F2" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#FFA25B" />
+ <g filter="url(#${sheetShadowId})">
+ <line x1="256" y1="306" x2="256" y2="368" stroke="#FFF8F2" stroke-width="8" stroke-linecap="round" />
+ <line x1="256" y1="312" x2="222" y2="368" stroke="#FFF8F2" stroke-width="8" stroke-linecap="round" />
+ <line x1="256" y1="312" x2="290" y2="368" stroke="#FFF8F2" stroke-width="8" stroke-linecap="round" />
+ <rect x="182" y="196" width="148" height="14" rx="7" fill="#FFF8F2" />
+ <rect x="188" y="210" width="136" height="96" rx="8" fill="#FFF8F2" />
+ <path d="M 252 230 A 28 28 0 1 0 273 277 L 252 258 Z" fill="#FFA25B" />
+ <path d="M 260 228 A 28 28 0 0 1 288 255 L 260 255 Z" fill="#FFA25B" />
+ <path d="M 288 261 A 28 28 0 0 1 279 280 L 260 261 Z" fill="#FFA25B" />
+ </g>
+ </g>
+ `
+
+ case 'excel':
+ return `
+ <defs>
+ <filter id="${sheetShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#000000" floodOpacity="0.06" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.04" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#000000" floodOpacity="0.08" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#7EE6BC" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#F0FDF8" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#52D7A4" />
+ <g filter="url(#${sheetShadowId})">
+ <path d="M 204 200 C 195 200 188 207 188 216 L 188 364 C 188 373 195 380 204 380 L 308 380 C 317 380 324 373 324 364 L 324 244 C 324 240 322 236 319 233 L 291 205 C 288 202 284 200 280 200 Z" fill="#F0FDF8" />
+ <path d="M 281 201 L 281 232 C 281 238 286 243 292 243 L 323 243" fill="none" stroke="#52D7A4" stroke-width="7" stroke-linecap="round" stroke-linejoin="round" />
+ <rect x="210" y="262" width="92" height="86" rx="8" fill="none" stroke="#52D7A4" stroke-width="5" />
+ <line x1="210" y1="290" x2="302" y2="290" stroke="#52D7A4" stroke-width="5" />
+ <line x1="210" y1="319" x2="302" y2="319" stroke="#52D7A4" stroke-width="5" />
+ <line x1="241" y1="262" x2="241" y2="348" stroke="#52D7A4" stroke-width="5" />
+ <line x1="271" y1="262" x2="271" y2="348" stroke="#52D7A4" stroke-width="5" />
+ </g>
+ </g>
+ `
+
+ case 'text':
+ return `
+ <defs>
+ <filter id="${sheetShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#000000" floodOpacity="0.06" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.04" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#4A5F3B" floodOpacity="0.14" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#CEDDC3" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#F8FAF6" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#8CA77B" />
+ <g filter="url(#${sheetShadowId})">
+ <path d="M 204 200 C 195 200 188 207 188 216 L 188 364 C 188 373 195 380 204 380 L 308 380 C 317 380 324 373 324 364 L 324 244 C 324 240 322 236 319 233 L 291 205 C 288 202 284 200 280 200 Z" fill="#F8FAF6" />
+ <path d="M 281 201 L 281 232 C 281 238 286 243 292 243 L 323 243" fill="none" stroke="#8CA77B" stroke-width="7" stroke-linecap="round" stroke-linejoin="round" />
+ <line x1="210" y1="268" x2="256" y2="268" stroke="#8CA77B" stroke-width="7" stroke-linecap="round" />
+ <line x1="210" y1="294" x2="300" y2="294" stroke="#8CA77B" stroke-width="7" stroke-linecap="round" />
+ <line x1="210" y1="320" x2="300" y2="320" stroke="#8CA77B" stroke-width="7" stroke-linecap="round" />
+ <line x1="210" y1="346" x2="276" y2="346" stroke="#8CA77B" stroke-width="7" stroke-linecap="round" />
+ </g>
+ </g>
+ `
+
+ case 'video':
+ return `
+ <defs>
+ <filter id="${sheetShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#000000" floodOpacity="0.06" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.04" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#1E293B" floodOpacity="0.14" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#94A3B8" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#F8FAFC" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#64748B" />
+ <g filter="url(#${sheetShadowId})">
+ <rect x="176" y="224" width="160" height="128" rx="20" fill="#F8FAFC" />
+ <rect x="192" y="240" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="192" y="266.67" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="192" y="293.33" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="192" y="320" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="216" y="240" width="80" height="96" rx="8" fill="#64748B" />
+ <rect x="304" y="240" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="304" y="266.67" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="304" y="293.33" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="304" y="320" width="16" height="16" rx="4" fill="#64748B" />
+ <path d="M 243 274 C 243 271 246.5 269 249.5 270.8 L 269.5 284.8 C 272.5 286.5 272.5 289.5 269.5 291.2 L 249.5 305.2 C 246.5 307 243 305 243 302 Z" fill="#FFFFFF" />
+ </g>
+ </g>
+ `
+
+ case 'archive':
+ return `
+ <defs>
+ <filter id="${glyphShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#B45309" floodOpacity="0.22" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.05" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#D97706" floodOpacity="0.12" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#FDE68A" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#FFFDF5" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#FBBF24" />
+ <g filter="url(#${glyphShadowId})">
+ <line x1="256" y1="178" x2="256" y2="284" stroke="#FFFDF5" stroke-width="6" stroke-linecap="round" />
+ <rect x="236" y="184" width="20" height="6" rx="3" fill="#FFFDF5" />
+ <rect x="236" y="204" width="20" height="6" rx="3" fill="#FFFDF5" />
+ <rect x="236" y="224" width="20" height="6" rx="3" fill="#FFFDF5" />
+ <rect x="236" y="244" width="20" height="6" rx="3" fill="#FFFDF5" />
+ <rect x="236" y="264" width="20" height="6" rx="3" fill="#FFFDF5" />
+ <rect x="256" y="194" width="20" height="6" rx="3" fill="#FFFDF5" />
+ <rect x="256" y="214" width="20" height="6" rx="3" fill="#FFFDF5" />
+ <rect x="256" y="234" width="20" height="6" rx="3" fill="#FFFDF5" />
+ <rect x="256" y="254" width="20" height="6" rx="3" fill="#FFFDF5" />
+ <rect x="256" y="274" width="20" height="6" rx="3" fill="#FFFDF5" />
+ <path d="M 242 282 L 270 282 C 274 282 277 285 277 289 L 275 304 C 275 310 277 314 273 320 L 260 327 C 257.5 328.5 254.5 328.5 252 327 L 239 320 C 235 314 237 310 237 304 L 235 289 C 235 285 238 282 242 282 Z" fill="#FFFDF5" />
+ <path d="M 249 314 C 249 311 251 309 254 309 L 258 309 C 261 309 263 311 263 314 L 264 346 C 266 354 275 362 275 374 C 275 384.5 266.5 393 256 393 C 245.5 393 237 384.5 237 374 C 237 362 246 354 248 346 Z" fill="#FFFDF5" />
+ <rect x="252" y="294" width="8" height="22" rx="4" fill="#FBBF24" />
+ <circle cx="256" cy="374" r="9" fill="#FBBF24" />
+ </g>
+ </g>
+ `
+
+ case 'file':
+ default:
+ return `
+ <defs>
+ <filter id="${sheetShadowId}" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#000000" floodOpacity="0.06" />
+ <feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.04" />
+ </filter>
+ <filter id="${folderShadowId}" x="-10%" y="-10%" width="120%" height="120%">
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#475569" floodOpacity="0.12" />
+ </filter>
+ </defs>
+ <g filter="url(#${folderShadowId})">
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#D4DFE9" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#F8FAFC" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#B0C0D0" />
+ <g filter="url(#${sheetShadowId})">
+ <path d="M 204 200 C 195 200 188 207 188 216 L 188 364 C 188 373 195 380 204 380 L 308 380 C 317 380 324 373 324 364 L 324 244 C 324 240 322 236 319 233 L 291 205 C 288 202 284 200 280 200 Z" fill="#F8FAFC" />
+ <path d="M 281 201 L 281 232 C 281 238 286 243 292 243 L 323 243" fill="none" stroke="#B0C0D0" stroke-width="7" stroke-linecap="round" stroke-linejoin="round" />
+ </g>
+ </g>
+ `
+ }
+}
+
+/**
+ * Builds the standalone SVG string for drag previews.
+ * Zero glass effect, zero black bounding container — just the clean SVG icon artwork.
+ */
+export function buildFileDragSvg(kinds: FileKind[], count: number): string {
+ if (count <= 1 || kinds.length === 1) {
+ const kind = kinds[0] || 'file'
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="122" height="122" viewBox="0 0 512 512" fill="none">
+ ${getFileKindSvgContent(kind, 'single')}
+ </svg>`
+ }
+
+ // Multi-file stack (2 or 3 items offset naturally without any bounding card container)
+ const displayKinds = kinds.slice(0, 3)
+ const stackSvg = displayKinds
+ .map((k, i) => ({ kind: k, index: i }))
+ .reverse()
+ .map(({ kind, index }) => {
+ const spread = 28
+ const rot = index * 5 - ((displayKinds.length - 1) * 2.5)
+ const tx = index * spread - ((displayKinds.length - 1) * spread) / 2
+ const ty = index * 10
+ const scale = 1 - index * 0.04
+ return `
+ <g transform="translate(${tx}, ${ty}) rotate(${rot} 256 256) scale(${scale})">
+ ${getFileKindSvgContent(kind, `stack-${index}`)}
+ </g>
+ `
+ })
+ .join('')
+
+ const badgeSvg = count > 1 ? `
+ <g transform="translate(380, 110)">
+ <circle cx="0" cy="0" r="42" fill="#18181B" stroke="#FFFFFF" stroke-width="6" />
+ <text x="0" y="14" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" font-size="38" font-weight="700" fill="#FFFFFF" text-anchor="middle">+${count}</text>
+ </g>
+ ` : ''
+
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="142" height="142" viewBox="0 0 512 512" fill="none">
+ ${stackSvg}
+ ${badgeSvg}
+ </svg>`
+}
diff --git a/electron/main/ipc.ts b/electron/main/ipc.ts
index 0232111..616bd61 100644
--- a/electron/main/ipc.ts
+++ b/electron/main/ipc.ts
@@ -16,7 +16,7 @@ import { sendToMainWindow, setInteractive, setHeartbeatPaused, setHotZoneWidth,
import { registerGlobalHotkey } from './index'
import { getOnboardingWindow } from './onboardingWindow'
import { rebuildTrayMenu } from './tray'
-import { startDragOut, resolveDragData } from './drag'
+import { startDragOut, resolveDragData, prestageDrag } from './drag'
import { clipboardSignature, formatTabularDataForClipboard } from '../clipboard/formats'
import type { ItemData, MergeResult } from '../../shared/types'
import { quitAndInstallUpdate, checkForUpdatesManual, startUpdateDownload, syncAutoUpdaterState } from './updater'
@@ -668,6 +668,10 @@ export function registerSendListeners(): void {
}
}
})
+
+ on('item:prestage-drag', (_sender, req) => {
+ prestageDrag(req)
+ })
}
/** Write any item payload back onto the system clipboard. */
diff --git a/electron/main/window.ts b/electron/main/window.ts
index b0b20dc..e8d4672 100644
--- a/electron/main/window.ts
+++ b/electron/main/window.ts
@@ -259,10 +259,14 @@ let _lastSentY = -9999
*/
export function setHeartbeatPaused(paused: boolean): void {
heartbeatPaused = paused
- if (!paused) {
- // Re-assert z-order immediately when drag ends so the window snaps back
- // to the correct level without waiting for the next heartbeat tick.
- if (mainWindow && !mainWindow.isDestroyed() && mainWindow.isVisible()) {
+ if (mainWindow && !mainWindow.isDestroyed() && mainWindow.isVisible()) {
+ if (paused) {
+ // Temporarily lower window z-band from 'screen-saver' to 'normal' during active drag
+ // so the Windows DWM drag-ghost image renders ON TOP of our window.
+ mainWindow.setAlwaysOnTop(true, 'normal')
+ } else {
+ // Re-assert z-order immediately when drag ends so the window snaps back
+ // to the correct level without waiting for the next heartbeat tick.
mainWindow.setAlwaysOnTop(true, 'screen-saver')
}
}
diff --git a/electron/preload/index.ts b/electron/preload/index.ts
index 7086a02..a2222b1 100644
--- a/electron/preload/index.ts
+++ b/electron/preload/index.ts
@@ -153,6 +153,7 @@ const api = {
startUpdateDownload: () => invoke('updater:start-download'),
quitApp: () => invoke('app:quit'),
startDrag: (req: DragRequest) => send('item:start-drag', req),
+ prestageDrag: (req: DragRequest) => send('item:prestage-drag', req),
addFiles: (paths: string[]) => invoke('item:add-files', paths),
addItemData: (data: import('../../shared/types').ItemData) => invoke('item:add-data', data),
removeSubitem: (req: import('../../shared/types').DragRequest) => invoke('item:remove-subitem', req),
diff --git a/new icons/imge svg icon.svg b/new icons/imge svg icon.svg
index be47075..a734306 100644
--- a/new icons/imge svg icon.svg
+++ b/new icons/imge svg icon.svg
@@ -2,13 +2,13 @@
<defs>
<!-- Soft Matte Shadow for the Image Motif -->
<filter id="glyphShadow" x="-20%" y="-20%" width="140%" height="140%">
- <feDropShadow dx="0" dy="4" stdDeviation="5" flood-color="#9D174D" flood-opacity="0.22"/>
+ <feDropShadow dx="0" dy="4" stdDeviation="5" flood-color="#6B4F3B" flood-opacity="0.22"/>
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000000" flood-opacity="0.05"/>
</filter>
<!-- Folder Base Soft Shadow -->
<filter id="folderShadow" x="-10%" y="-10%" width="120%" height="120%">
- <feDropShadow dx="0" dy="10" stdDeviation="16" flood-color="#BE185D" flood-opacity="0.12"/>
+ <feDropShadow dx="0" dy="10" stdDeviation="16" flood-color="#8C6A4F" flood-opacity="0.14"/>
</filter>
</defs>
@@ -26,7 +26,7 @@
C 456 396 442 410 424 410
L 88 410
C 70 410 56 396 56 378 Z"
- fill="#F9A8D4"/>
+ fill="#DFCEBC"/>
<!-- 2. Paper Sheet Peeking Inside -->
<path d="M 74 162
@@ -35,7 +35,7 @@
L 429 143
C 434 143 438 147 438 152
L 438 162 Z"
- fill="#FFF1F8"/>
+ fill="#FFFDF9"/>
<!-- 3. Folder Front Flap -->
<path d="M 56 168
@@ -46,7 +46,7 @@
C 456 396 442 410 424 410
L 88 410
C 70 410 56 396 56 378 Z"
- fill="#F472B6"/>
+ fill="#BA9B7B"/>
<!-- 4. Clean Seamless Photo Frame Motif (Zero Artifacts) -->
<g filter="url(#glyphShadow)">
diff --git a/new icons/text svg icon.svg b/new icons/text svg icon.svg
index daa2c4f..60bcf4c 100644
--- a/new icons/text svg icon.svg
+++ b/new icons/text svg icon.svg
@@ -8,7 +8,7 @@
<!-- Folder Base Soft Shadow -->
<filter id="folderShadow" x="-10%" y="-10%" width="120%" height="120%">
- <feDropShadow dx="0" dy="10" stdDeviation="16" flood-color="#475569" flood-opacity="0.12"/>
+ <feDropShadow dx="0" dy="10" stdDeviation="16" flood-color="#4A5F3B" flood-opacity="0.14"/>
</filter>
</defs>
@@ -26,7 +26,7 @@
C 456 396 442 410 424 410
L 88 410
C 70 410 56 396 56 378 Z"
- fill="#D1DBE5"/>
+ fill="#CEDDC3"/>
<!-- 2. Paper Sheet Peeking Inside -->
<path d="M 74 162
@@ -35,7 +35,7 @@
L 429 143
C 434 143 438 147 438 152
L 438 162 Z"
- fill="#F8FAFC"/>
+ fill="#F8FAF6"/>
<!-- 3. Folder Front Flap -->
<path d="M 56 168
@@ -46,7 +46,7 @@
C 456 396 442 410 424 410
L 88 410
C 70 410 56 396 56 378 Z"
- fill="#B2C0D0"/>
+ fill="#8CA77B"/>
<!-- 4. Folded Note Document Motif -->
<g filter="url(#sheetShadow)">
@@ -62,7 +62,7 @@
L 291 205
C 288 202 284 200 280 200
Z"
- fill="#F8FAFC"/>
+ fill="#F8FAF6"/>
<!-- Folded Corner L-Flap -->
<path d="M 281 201
@@ -70,32 +70,32 @@
C 281 238 286 243 292 243
L 323 243"
fill="none"
- stroke="#B2C0D0"
+ stroke="#8CA77B"
stroke-width="7"
stroke-linecap="round"
stroke-linejoin="round"/>
<!-- Note Line 1 (Short Heading) -->
<line x1="210" y1="268" x2="256" y2="268"
- stroke="#B2C0D0"
+ stroke="#8CA77B"
stroke-width="7"
stroke-linecap="round"/>
<!-- Note Line 2 (Full Line) -->
<line x1="210" y1="294" x2="300" y2="294"
- stroke="#B2C0D0"
+ stroke="#8CA77B"
stroke-width="7"
stroke-linecap="round"/>
<!-- Note Line 3 (Full Line) -->
<line x1="210" y1="320" x2="300" y2="320"
- stroke="#B2C0D0"
+ stroke="#8CA77B"
stroke-width="7"
stroke-linecap="round"/>
<!-- Note Line 4 (Medium Line) -->
<line x1="210" y1="346" x2="276" y2="346"
- stroke="#B2C0D0"
+ stroke="#8CA77B"
stroke-width="7"
stroke-linecap="round"/>
</g>
diff --git a/new icons/vidoe svg icon.svg b/new icons/vidoe svg icon.svg
index 82fb895..77a183e 100644
--- a/new icons/vidoe svg icon.svg
+++ b/new icons/vidoe svg icon.svg
@@ -8,7 +8,7 @@
<!-- Folder Base Soft Shadow -->
<filter id="folderShadow" x="-10%" y="-10%" width="120%" height="120%">
- <feDropShadow dx="0" dy="10" stdDeviation="16" flood-color="#BE123C" flood-opacity="0.12"/>
+ <feDropShadow dx="0" dy="10" stdDeviation="16" flood-color="#1E293B" flood-opacity="0.14"/>
</filter>
</defs>
@@ -26,7 +26,7 @@
C 456 396 442 410 424 410
L 88 410
C 70 410 56 396 56 378 Z"
- fill="#FFA1AD"/>
+ fill="#94A3B8"/>
<!-- 2. Paper Sheet Peeking Inside -->
<path d="M 74 162
@@ -35,7 +35,7 @@
L 429 143
C 434 143 438 147 438 152
L 438 162 Z"
- fill="#FFF0F3"/>
+ fill="#F8FAFC"/>
<!-- 3. Folder Front Flap -->
<path d="M 56 168
@@ -46,27 +46,27 @@
C 456 396 442 410 424 410
L 88 410
C 70 410 56 396 56 378 Z"
- fill="#FF6E7F"/>
+ fill="#64748B"/>
<!-- 4. Cinema Film Strip Motif -->
<g filter="url(#sheetShadow)">
<!-- Main White Film Strip Card -->
- <rect x="176" y="224" width="160" height="128" rx="20" fill="#FFF0F3"/>
+ <rect x="176" y="224" width="160" height="128" rx="20" fill="#F8FAFC"/>
<!-- Left Sprocket Holes -->
- <rect x="192" y="240" width="16" height="16" rx="4" fill="#FF6E7F"/>
- <rect x="192" y="266.67" width="16" height="16" rx="4" fill="#FF6E7F"/>
- <rect x="192" y="293.33" width="16" height="16" rx="4" fill="#FF6E7F"/>
- <rect x="192" y="320" width="16" height="16" rx="4" fill="#FF6E7F"/>
+ <rect x="192" y="240" width="16" height="16" rx="4" fill="#64748B"/>
+ <rect x="192" y="266.67" width="16" height="16" rx="4" fill="#64748B"/>
+ <rect x="192" y="293.33" width="16" height="16" rx="4" fill="#64748B"/>
+ <rect x="192" y="320" width="16" height="16" rx="4" fill="#64748B"/>
<!-- Center Film Frame Window (x=216 to 296, Center=256) -->
- <rect x="216" y="240" width="80" height="96" rx="8" fill="#FF6E7F"/>
+ <rect x="216" y="240" width="80" height="96" rx="8" fill="#64748B"/>
<!-- Right Sprocket Holes -->
- <rect x="304" y="240" width="16" height="16" rx="4" fill="#FF6E7F"/>
- <rect x="304" y="266.67" width="16" height="16" rx="4" fill="#FF6E7F"/>
- <rect x="304" y="293.33" width="16" height="16" rx="4" fill="#FF6E7F"/>
- <rect x="304" y="320" width="16" height="16" rx="4" fill="#FF6E7F"/>
+ <rect x="304" y="240" width="16" height="16" rx="4" fill="#64748B"/>
+ <rect x="304" y="266.67" width="16" height="16" rx="4" fill="#64748B"/>
+ <rect x="304" y="293.33" width="16" height="16" rx="4" fill="#64748B"/>
+ <rect x="304" y="320" width="16" height="16" rx="4" fill="#64748B"/>
<!-- Mathematically Centered Play Triangle -->
<path d="M 243 274
diff --git a/shared/bridge.ts b/shared/bridge.ts
index 1030528..a62a102 100644
--- a/shared/bridge.ts
+++ b/shared/bridge.ts
@@ -30,6 +30,11 @@ export interface EdgeApi {
* from the DOM `dragstart` event, and main calls `event.sender.startDrag`.
*/
startDrag: (req: DragRequest) => void
+ /**
+ * Pre-stage a drag request in the background (e.g. on hover or pointerdown)
+ * so drag initiation is 0ms.
+ */
+ prestageDrag: (req: DragRequest) => void
addFiles: (paths: string[]) => Promise<import('./types').ClipboardItemDto[]>
addItemData: (data: import('./types').ItemData) => Promise<import('./types').ClipboardItemDto[]>
mergeItems: (sourceId: string, targetId: string) => Promise<import('./types').MergeResult>
diff --git a/shared/ipc.ts b/shared/ipc.ts
index 296c127..8912573 100644
--- a/shared/ipc.ts
+++ b/shared/ipc.ts
@@ -173,6 +173,8 @@ export interface EventMap {
export interface SendMap {
/** Begin a native OS drag of an item (or one file of a bundle) out of the app. */
'item:start-drag': { args: [req: DragRequest] }
+ /** Pre-stage drag file and warm icon in background before drag begins. */
+ 'item:prestage-drag': { args: [req: DragRequest] }
/** Synchronize tutorial step */
'tutorial:set-step': { args: [step: number] }
}
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsx
index 3d242ad..e38c8b3 100644
--- a/src/components/ClipboardItem.tsx
+++ b/src/components/ClipboardItem.tsx
@@ -24,7 +24,7 @@ import { useDragOut } from '../hooks/useDragOut'
import { basename, formatBytes, previewText, relativeTime, formatImageDisplayName } from '../lib/format'
import { getFileKind } from '../lib/fileType'
import { playButtonClickSound, playToggleSound, playDeleteSound, playCardExpandSound } from '../lib/soundEffects'
-import { CopyIcon, FileKindIcon, ImageIcon, LinkIcon, GlobeIcon, PinIcon, PinFillIcon, TrashIcon, MinusIcon, ChevronUpIcon, ExpandIcon, ContractIcon, ExternalLinkIcon } from './icons'
+import { CopyIcon, FileKindIcon, GlobeIcon, PinIcon, PinFillIcon, TrashIcon, MinusIcon, ChevronUpIcon, ExpandIcon, ContractIcon, ExternalLinkIcon } from './icons'
import { parseUrlPreview } from '../lib/urlPreview'
import '../styles/item.css'
@@ -108,12 +108,18 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
// own ghost in parallel; Electron's startDrag starts an independent OLE
// drag managed by the OS. Fire the IPC synchronously so main calls
// event.sender.startDrag(...) on the same tick.
- setInternalDragReq(req)
e.preventDefault()
startDrag(req)
+ setInternalDragReq(req)
}
}, [item.data, startDrag, setInternalDragReq])
+ const handlePrestage = useCallback(() => {
+ if (item.data.kind !== 'text' && !isPreviewing) {
+ window.edge.prestageDrag({ id: item.id })
+ }
+ }, [item.data.kind, isPreviewing, item.id])
+
return (
<motion.div
ref={ref}
@@ -150,6 +156,8 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
className={`item-main${isPreviewing ? ' force-actions previewing' : ''}`}
data-id={item.id}
draggable={!isPreviewing && item.data.kind !== 'text' && (!isBundle || !expanded)}
+ onMouseEnter={handlePrestage}
+ onPointerDown={handlePrestage}
onDragStart={(e) => handleDragStart(e, { id: item.id })}
onDragEnd={() => setInternalDragReq(null)}
onDragOver={(e) => {
@@ -532,6 +540,8 @@ function BundleFluidPreview({
className="fluid-card-row"
layout
draggable
+ onMouseEnter={() => window.edge.prestageDrag({ id: item.id, paths: [filePath] })}
+ onPointerDown={() => window.edge.prestageDrag({ id: item.id, paths: [filePath] })}
onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, paths: [filePath] }) }}
onClick={(e) => { e.stopPropagation(); tryPaste(() => window.edge.pasteSubitem({ id: item.id, paths: [filePath] })) }}
>
@@ -749,22 +759,17 @@ function KindBadge({ item }: { item: ClipboardItemDto }) {
switch (item.data.kind) {
case 'text':
if (item.data.isUrl)
- return (
- <span className="kind-badge url">
- <LinkIcon width={11} height={11} /> {t('filters.links').toLowerCase()}
- </span>
- )
+ return <span className="kind-badge url">{t('filters.links').toLowerCase()}</span>
return <span className="kind-badge">{t('filters.text').toLowerCase()}</span>
case 'image':
return (
<span className="kind-badge">
- <ImageIcon width={11} height={11} /> {t('filters.images').toLowerCase().slice(0, -1) || t('filters.images').toLowerCase()}
+ {t('filters.images').toLowerCase().slice(0, -1) || t('filters.images').toLowerCase()}
</span>
)
case 'image-collection':
return (
<span className="kind-badge">
- <ImageIcon width={11} height={11} />
{item.data.images.length} {t('filters.images').toLowerCase()}
</span>
)
@@ -777,14 +782,13 @@ function KindBadge({ item }: { item: ClipboardItemDto }) {
if (isImage) {
return (
<span className="kind-badge">
- <ImageIcon width={11} height={11} /> {t('filters.images').toLowerCase().slice(0, -1) || t('filters.images').toLowerCase()}
+ {t('filters.images').toLowerCase().slice(0, -1) || t('filters.images').toLowerCase()}
</span>
)
}
const label = count > 1 ? `${count} ${t('filters.files').toLowerCase()}` : info.label.toLowerCase()
return (
<span className="kind-badge" style={{ color: count > 1 ? undefined : info.color }}>
- <FileKindIcon path={firstPath} width={11} height={11} isDirectory={entry?.isDirectory} />
{label}
</span>
)
diff --git a/src/components/CustomFileIcon.tsx b/src/components/CustomFileIcon.tsx
index f971242..9e5457e 100644
--- a/src/components/CustomFileIcon.tsx
+++ b/src/components/CustomFileIcon.tsx
@@ -331,17 +331,17 @@ export function CustomFileIcon({
<svg {...svgProps}>
<defs>
<filter id={glyphShadowId} x="-20%" y="-20%" width="140%" height="140%">
- <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#9D174D" floodOpacity="0.22" />
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#6B4F3B" floodOpacity="0.22" />
<feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.05" />
</filter>
<filter id={folderShadowId} x="-10%" y="-10%" width="120%" height="120%">
- <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#BE185D" floodOpacity="0.12" />
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#8C6A4F" floodOpacity="0.14" />
</filter>
</defs>
<g filter={`url(#${folderShadowId})`}>
- <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#F9A8D4" />
- <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#FFF1F8" />
- <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#F472B6" />
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#DFCEBC" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#FFFDF9" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#BA9B7B" />
<g filter={`url(#${glyphShadowId})`}>
<circle cx="272" cy="260" r="14" fill="#FFFFFF" />
<path d="M 178 346 L 178 326 L 230 274 L 266 308 L 298 282 L 334 324 L 334 346 Z" fill="#FFFFFF" />
@@ -454,20 +454,20 @@ export function CustomFileIcon({
<feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.04" />
</filter>
<filter id={folderShadowId} x="-10%" y="-10%" width="120%" height="120%">
- <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#475569" floodOpacity="0.12" />
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#4A5F3B" floodOpacity="0.14" />
</filter>
</defs>
<g filter={`url(#${folderShadowId})`}>
- <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#D1DBE5" />
- <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#F8FAFC" />
- <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#B2C0D0" />
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#CEDDC3" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#F8FAF6" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#8CA77B" />
<g filter={`url(#${sheetShadowId})`}>
- <path d="M 204 200 C 195 200 188 207 188 216 L 188 364 C 188 373 195 380 204 380 L 308 380 C 317 380 324 373 324 364 L 324 244 C 324 240 322 236 319 233 L 291 205 C 288 202 284 200 280 200 Z" fill="#F8FAFC" />
- <path d="M 281 201 L 281 232 C 281 238 286 243 292 243 L 323 243" fill="none" stroke="#B2C0D0" strokeWidth="7" strokeLinecap="round" strokeLinejoin="round" />
- <line x1="210" y1="268" x2="256" y2="268" stroke="#B2C0D0" strokeWidth="7" strokeLinecap="round" />
- <line x1="210" y1="294" x2="300" y2="294" stroke="#B2C0D0" strokeWidth="7" strokeLinecap="round" />
- <line x1="210" y1="320" x2="300" y2="320" stroke="#B2C0D0" strokeWidth="7" strokeLinecap="round" />
- <line x1="210" y1="346" x2="276" y2="346" stroke="#B2C0D0" strokeWidth="7" strokeLinecap="round" />
+ <path d="M 204 200 C 195 200 188 207 188 216 L 188 364 C 188 373 195 380 204 380 L 308 380 C 317 380 324 373 324 364 L 324 244 C 324 240 322 236 319 233 L 291 205 C 288 202 284 200 280 200 Z" fill="#F8FAF6" />
+ <path d="M 281 201 L 281 232 C 281 238 286 243 292 243 L 323 243" fill="none" stroke="#8CA77B" strokeWidth="7" strokeLinecap="round" strokeLinejoin="round" />
+ <line x1="210" y1="268" x2="256" y2="268" stroke="#8CA77B" strokeWidth="7" strokeLinecap="round" />
+ <line x1="210" y1="294" x2="300" y2="294" stroke="#8CA77B" strokeWidth="7" strokeLinecap="round" />
+ <line x1="210" y1="320" x2="300" y2="320" stroke="#8CA77B" strokeWidth="7" strokeLinecap="round" />
+ <line x1="210" y1="346" x2="276" y2="346" stroke="#8CA77B" strokeWidth="7" strokeLinecap="round" />
</g>
</g>
</svg>
@@ -484,24 +484,24 @@ export function CustomFileIcon({
<feDropShadow dx="0" dy="1" stdDeviation="2" floodColor="#000000" floodOpacity="0.04" />
</filter>
<filter id={folderShadowId} x="-10%" y="-10%" width="120%" height="120%">
- <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#BE123C" floodOpacity="0.12" />
+ <feDropShadow dx="0" dy="10" stdDeviation="16" floodColor="#1E293B" floodOpacity="0.14" />
</filter>
</defs>
<g filter={`url(#${folderShadowId})`}>
- <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#FFA1AD" />
- <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#FFF0F3" />
- <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#FF6E7F" />
+ <path d="M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#94A3B8" />
+ <path d="M 74 162 L 74 152 C 74 147 78 143 83 143 L 429 143 C 434 143 438 147 438 152 L 438 162 Z" fill="#F8FAFC" />
+ <path d="M 56 168 C 56 156 65 148 76 148 L 436 148 C 447 148 456 156 456 168 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z" fill="#64748B" />
<g filter={`url(#${sheetShadowId})`}>
- <rect x="176" y="224" width="160" height="128" rx="20" fill="#FFF0F3" />
- <rect x="192" y="240" width="16" height="16" rx="4" fill="#FF6E7F" />
- <rect x="192" y="266.67" width="16" height="16" rx="4" fill="#FF6E7F" />
- <rect x="192" y="293.33" width="16" height="16" rx="4" fill="#FF6E7F" />
- <rect x="192" y="320" width="16" height="16" rx="4" fill="#FF6E7F" />
- <rect x="216" y="240" width="80" height="96" rx="8" fill="#FF6E7F" />
- <rect x="304" y="240" width="16" height="16" rx="4" fill="#FF6E7F" />
- <rect x="304" y="266.67" width="16" height="16" rx="4" fill="#FF6E7F" />
- <rect x="304" y="293.33" width="16" height="16" rx="4" fill="#FF6E7F" />
- <rect x="304" y="320" width="16" height="16" rx="4" fill="#FF6E7F" />
+ <rect x="176" y="224" width="160" height="128" rx="20" fill="#F8FAFC" />
+ <rect x="192" y="240" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="192" y="266.67" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="192" y="293.33" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="192" y="320" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="216" y="240" width="80" height="96" rx="8" fill="#64748B" />
+ <rect x="304" y="240" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="304" y="266.67" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="304" y="293.33" width="16" height="16" rx="4" fill="#64748B" />
+ <rect x="304" y="320" width="16" height="16" rx="4" fill="#64748B" />
<path d="M 243 274 C 243 271 246.5 269 249.5 270.8 L 269.5 284.8 C 272.5 286.5 272.5 289.5 269.5 291.2 L 249.5 305.2 C 246.5 307 243 305 243 302 Z" fill="#FFFFFF" />
</g>
</g>
diff --git a/src/lib/fileType.ts b/src/lib/fileType.ts
index 4cf7490..766f399 100644
--- a/src/lib/fileType.ts
+++ b/src/lib/fileType.ts
@@ -54,11 +54,11 @@ const KIND_INFO: Record<FileKind, FileKindInfo> = {
excel: { kind: 'excel', label: 'Excel', color: '#52D7A4' },
powerpoint: { kind: 'powerpoint', label: 'Slides', color: '#FFA25B' },
archive: { kind: 'archive', label: 'Archive', color: '#FBBF24' },
- text: { kind: 'text', label: 'Text', color: '#B2C0D0' },
+ text: { kind: 'text', label: 'Text', color: '#8CA77B' },
code: { kind: 'code', label: 'Code', color: '#53CAF7' },
audio: { kind: 'audio', label: 'Audio', color: '#C495FD' },
- video: { kind: 'video', label: 'Video', color: '#FF6E7F' },
- image: { kind: 'image', label: 'Image', color: '#F472B6' },
+ video: { kind: 'video', label: 'Video', color: '#64748B' },
+ image: { kind: 'image', label: 'Image', color: '#BA9B7B' },
executable: { kind: 'executable', label: 'App', color: '#93A4FC' },
folder: { kind: 'folder', label: 'Folder', color: '#FBBF24' },
file: { kind: 'file', label: 'File', color: '#B0C0D0' }
diff --git a/tests/customFileIcon.test.ts b/tests/customFileIcon.test.ts
index a634277..a31030f 100644
--- a/tests/customFileIcon.test.ts
+++ b/tests/customFileIcon.test.ts
@@ -18,6 +18,10 @@ describe('Custom File Category & Pastel Theme Palette', () => {
const pptx = getFileKindByExt('pptx')
expect(pptx.kind).toBe('powerpoint')
expect(pptx.color).toBe('#FFA25B')
+
+ const txt = getFileKindByExt('txt')
+ expect(txt.kind).toBe('text')
+ expect(txt.color).toBe('#8CA77B')
})
it('correctly maps code and developer formats with cyan pastel', () => {
@@ -33,11 +37,11 @@ describe('Custom File Category & Pastel Theme Palette', () => {
it('correctly maps media formats with respective pastel tones', () => {
const png = getFileKindByExt('png')
expect(png.kind).toBe('image')
- expect(png.color).toBe('#F472B6')
+ expect(png.color).toBe('#BA9B7B')
const mp4 = getFileKindByExt('mp4')
expect(mp4.kind).toBe('video')
- expect(mp4.color).toBe('#FF6E7F')
+ expect(mp4.color).toBe('#64748B')
const mp3 = getFileKindByExt('mp3')
expect(mp3.kind).toBe('audio')
diff --git a/tests/dragDrop.test.ts b/tests/dragDrop.test.ts
index 8aa22a4..b688e10 100644
--- a/tests/dragDrop.test.ts
+++ b/tests/dragDrop.test.ts
@@ -125,3 +125,52 @@ describe('stageDragFile dual-channel payload', () => {
expect(staged?.files?.[0]).toBe(staged?.file)
})
})
+
+import { buildFileDragSvg, getFileKindSvgContent } from '../electron/main/fileSvg'
+import type { FileKind } from '../src/lib/fileType'
+
+describe('buildFileDragSvg — standalone 3D pastel vector drag icons', () => {
+ const allKinds: FileKind[] = [
+ 'pdf',
+ 'word',
+ 'excel',
+ 'powerpoint',
+ 'archive',
+ 'text',
+ 'code',
+ 'audio',
+ 'video',
+ 'image',
+ 'executable',
+ 'folder',
+ 'file'
+ ]
+
+ it('generates valid SVG content for all 13 file categories without bounding boxes', () => {
+ for (const kind of allKinds) {
+ const content = getFileKindSvgContent(kind)
+ expect(content).toBeTruthy()
+ // Ensure no black container box
+ expect(content).not.toContain('fill="#000000"')
+ expect(content).not.toContain('stroke="rgba(255,255,255,0.18)"')
+ }
+ })
+
+ it('builds a clean single-file drag icon SVG without glass card or background', () => {
+ const svg = buildFileDragSvg(['pdf'], 1)
+ expect(svg).toContain('<svg')
+ expect(svg).toContain('viewBox="0 0 512 512"')
+ expect(svg).toContain('PDF')
+ expect(svg).not.toContain('fill="#000000"')
+ expect(svg).not.toContain('<rect x="16" y="8" width="64" height="72"')
+ })
+
+ it('builds a clean multi-file stack SVG with count badge', () => {
+ const svg = buildFileDragSvg(['pdf', 'excel', 'image'], 3)
+ expect(svg).toContain('<svg')
+ expect(svg).toContain('+3')
+ expect(svg).toContain('stack-0')
+ expect(svg).toContain('stack-1')
+ expect(svg).toContain('stack-2')
+ })
+})