Skip to content

Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.

feat(cards): right-click menu, labels & tags, redesigned preview, new file icons

Deepender252abfe59f5fe2
diff --git a/electron/main/drag.ts b/electron/main/drag.ts
index 73c5883..bca6e09 100644
--- a/electron/main/drag.ts
+++ b/electron/main/drag.ts
@@ -374,7 +374,7 @@ function dragIcon(data: ItemData): Electron.NativeImage {
return getFileDragIcon()
}
-import { buildFileDragSvg } from './fileSvg'
+import { buildFileDragSvg, dragSvgHasArt } from './fileSvg'
/** Generate a custom standalone SVG PNG icon representing file kinds with count badge. */
function createFileStackDragIcon(paths: string[], entries?: Array<{ isDirectory?: boolean }>): Electron.NativeImage {
@@ -392,13 +392,16 @@ function createFileStackDragIcon(paths: string[], entries?: Array<{ isDirectory?
}
return getFileKind(p, isDir).kind
})
- const cacheKey = `stack|png|${kinds.join('-')}|${count}`
+ const cacheKey = `stack|svg|${kinds.join('-')}|${count}`
const cached = iconCache.get(cacheKey)
if (cached && !cached.isEmpty()) {
return cached
}
const svg = buildFileDragSvg(kinds, count)
+ // No art could be read: an invisible ghost must not be rasterized, and
+ // above all must not be cached for the rest of the session.
+ if (!dragSvgHasArt(svg)) return getFileDragIcon()
try {
const resvg = new Resvg(svg, { fitTo: { mode: 'zoom', value: 2 } })
diff --git a/electron/main/externalUrl.ts b/electron/main/externalUrl.ts
new file mode 100644
index 0000000..1ab1b0b
--- /dev/null
+++ b/electron/main/externalUrl.ts
@@ -0,0 +1,18 @@
+/**
+ * Which URLs the renderer may hand to the OS (window.open -> shell.openExternal).
+ *
+ * Links come from clipboard history, i.e. from anything the user ever copied,
+ * so only web links, mail links and the Microsoft Store review link the
+ * settings page uses are passed on. Everything else (file:, javascript:,
+ * custom protocol handlers) is refused.
+ */
+const ALLOWED_PROTOCOLS = new Set(['http:', 'https:', 'mailto:', 'ms-windows-store:'])
+
+export function isSafeExternalUrl(raw: unknown): raw is string {
+ if (typeof raw !== 'string' || raw.length === 0 || raw.length > 8192) return false
+ try {
+ return ALLOWED_PROTOCOLS.has(new URL(raw).protocol)
+ } catch {
+ return false
+ }
+}
diff --git a/electron/main/fileSvg.ts b/electron/main/fileSvg.ts
index e0ed96f..d03ee92 100644
--- a/electron/main/fileSvg.ts
+++ b/electron/main/fileSvg.ts
@@ -4,24 +4,24 @@ import { app } from 'electron'
import type { FileKind } from '../../src/lib/fileType'
/**
- * Drag-ghost artwork from the vintage textured PNG set
- * (resources/file-icons, one static file per kind).
+ * Drag-ghost artwork from the file-kind SVG set (resources/file-icons, one
+ * static file per kind).
*
- * PNGs are read once per session into a bounded data-URI cache, then
- * embedded into the existing stack/badge SVG layout which Resvg rasterizes
- * exactly as before. UI file icons come from the same files over
- * edgelocal://icon/, so there is a single copy of the art.
+ * Each SVG is read once per session into a bounded data-URI cache, then
+ * embedded as a nested image in the stack/badge SVG layout which Resvg
+ * rasterizes. UI file icons come from the same files over edgelocal://icon/,
+ * so there is a single copy of the art. The files are square and already
+ * cropped to the folder (their viewBox), so each one fills the 512 slot.
*/
-const PNG_WIDTH = 512
-const PNG_HEIGHT = 341
+const ART_SIZE = 512
let iconDirOverride: string | null = null
/** Test hook: point the builder at a fixture directory instead of resources. */
export function setFileIconAssetDir(dir: string): void {
iconDirOverride = dir
- pngCache.clear()
+ artCache.clear()
}
function fileIconDir(): string | null {
@@ -35,43 +35,55 @@ function fileIconDir(): string | null {
}
}
-const pngCache = new Map<string, string | null>()
-const PNG_CACHE_MAX = 16
+const artCache = new Map<string, string>()
+const ART_CACHE_MAX = 16
-/** Data-URI for a kind's PNG, or null when the file is unavailable. */
-function kindPngDataUri(kind: FileKind): string | null {
- const cached = pngCache.get(kind)
- if (cached !== undefined) return cached
- let uri: string | null = null
+function readArt(kind: string): string | null {
try {
const dir = fileIconDir()
- if (dir) {
- const buf = readFileSync(join(dir, `${kind}.png`))
- if (buf.length > 0) uri = `data:image/png;base64,${buf.toString('base64')}`
- }
+ if (!dir) return null
+ const buf = readFileSync(join(dir, `${kind}.svg`))
+ return buf.length > 0 ? `data:image/svg+xml;base64,${buf.toString('base64')}` : null
} catch {
- uri = null
+ return null
}
- if (pngCache.size >= PNG_CACHE_MAX) {
- const first = pngCache.keys().next().value
- if (first) pngCache.delete(first)
+}
+
+/**
+ * Data-URI for a kind's SVG; a kind whose file is unreadable borrows the
+ * generic `file` art. Only successful reads are cached, so a file that was
+ * missing for a moment (an update or rebuild swapping the folder) is picked
+ * up on the next drag instead of leaving that kind blank for the session.
+ */
+function kindArtDataUri(kind: FileKind): string | null {
+ const cached = artCache.get(kind)
+ if (cached !== undefined) return cached
+ const uri = readArt(kind) ?? (kind === 'file' ? null : readArt('file'))
+ if (!uri) return null
+ if (artCache.size >= ART_CACHE_MAX) {
+ const first = artCache.keys().next().value
+ if (first) artCache.delete(first)
}
- pngCache.set(kind, uri)
+ artCache.set(kind, uri)
return uri
}
-/** One folder PNG centered in the 512 viewBox (512x341 art). */
+/** One folder icon filling the 512 viewBox. */
function kindImage(kind: FileKind): string {
- const uri = kindPngDataUri(kind)
+ const uri = kindArtDataUri(kind)
if (!uri) return ''
- const y = Math.round((512 - PNG_HEIGHT) / 2)
- return `<image href="${uri}" x="0" y="${y}" width="${PNG_WIDTH}" height="${PNG_HEIGHT}"/>`
+ return `<image href="${uri}" x="0" y="0" width="${ART_SIZE}" height="${ART_SIZE}"/>`
+}
+
+/** True when a built drag SVG carries at least one piece of art. */
+export function dragSvgHasArt(svg: string): boolean {
+ return svg.includes('<image ')
}
/**
* Builds the standalone SVG string for drag previews.
- * Vintage PNG artwork with the multi-file stack offsets and count badge.
- * Kinds without a readable PNG render as empty slots (the caller falls back
+ * File-kind artwork with the multi-file stack offsets and count badge.
+ * Kinds without readable art render as empty slots (the caller falls back
* to the generic icon when rasterization yields nothing usable).
*/
export function buildFileDragSvg(kinds: FileKind[], count: number): string {
diff --git a/electron/main/imageProtocol.ts b/electron/main/imageProtocol.ts
index da4073d..c3ba159 100644
--- a/electron/main/imageProtocol.ts
+++ b/electron/main/imageProtocol.ts
@@ -104,11 +104,12 @@ export async function readEmojiBatch(assetDir: string, names: readonly unknown[]
}
/**
- * File-kind folder icons (PNG, resources/file-icons). Fixed 13-name
+ * File-kind folder icons (SVG, resources/file-icons). Fixed 13-name
* allowlist so the protocol cannot escape the icon directory — same
- * validation shape as the emoji assets above.
+ * validation shape as the emoji assets above. Served only as <img> /
+ * <image> sources, where SVG never runs script.
*/
-const ICON_FILE_RE = /^(pdf|word|excel|powerpoint|archive|text|code|audio|video|image|executable|folder|file)\.png$/
+const ICON_FILE_RE = /^(pdf|word|excel|powerpoint|archive|text|code|audio|video|image|executable|folder|file)\.svg$/
/** Resolve a file-kind icon name to its on-disk PNG. */
export function resolveIconAsset(assetDir: string, fileName: string): string | null {
diff --git a/electron/main/index.ts b/electron/main/index.ts
index e448b21..cceeffc 100644
--- a/electron/main/index.ts
+++ b/electron/main/index.ts
@@ -186,7 +186,7 @@ function registerImageProtocol(): void {
})
}
- // File-kind folder icons (static PNG set, same immutable-cache shape
+ // File-kind folder icons (static SVG set, same immutable-cache shape
// as emoji). Must sit before the generic imageId fallback below.
if (request.url.startsWith(`${APP_CONFIG.imageProtocol}://icon/`)) {
const fileName = decodeURIComponent(request.url.slice(`${APP_CONFIG.imageProtocol}://icon/`.length).split('?')[0] ?? '')
@@ -199,7 +199,7 @@ function registerImageProtocol(): void {
return new Response(body, {
status: 200,
headers: new Headers({
- 'Content-Type': 'image/png',
+ 'Content-Type': 'image/svg+xml',
'Cache-Control': 'public, max-age=31536000, immutable'
})
})
diff --git a/electron/main/ipc.ts b/electron/main/ipc.ts
index 29aa334..6091432 100644
--- a/electron/main/ipc.ts
+++ b/electron/main/ipc.ts
@@ -7,6 +7,7 @@
*/
import { app, ipcMain, clipboard, nativeImage, shell, net } from 'electron'
import { existsSync } from 'node:fs'
+import { basename } from 'node:path'
import { execFile } from 'node:child_process'
import { psHost, getSystemPowerShellPath, getWritableCwd } from './powershell'
import { filterValidPaths, isExistingFilePath } from './pathValidation'
@@ -16,7 +17,7 @@ import { sendToMainWindow, setInteractive, setHeartbeatPaused, setHotZoneWidth,
import { registerGlobalHotkey } from './index'
import { getOnboardingWindow } from './onboardingWindow'
import { rebuildTrayMenu } from './tray'
-import { startDragOut, resolveDragData, prestageDrag, stageDragFile } from './drag'
+import { startDragOut, resolveDragData, prestageDrag, stageDragFile, formatClipboardImageFilename } from './drag'
import { clipboardSignature, formatTabularDataForClipboard, signatureMatchesItem } from '../clipboard/formats'
import type { ClipboardItem, ItemData, MergeResult } from '../../shared/types'
import { quitAndInstallUpdate, checkForUpdatesManual, startUpdateDownload, syncAutoUpdaterState, getCachedUpdateState, triggerBackgroundCheck } from './updater'
@@ -26,9 +27,13 @@ import { applyLaunchAtLogin, refreshLaunchAtLoginFromOs } from './loginItems'
import { toUnpackagedFilePath, toUnpackagedFilePaths } from '../store/paths'
import { isPasteableEmoji } from '../../shared/emoji'
import { emojiAssetDir, readEmojiBatch } from './imageProtocol'
+import { saveItemImages } from './saveImages'
export { isStoreBuild }
+/** Longest text item:copy-text accepts (a derived link / color / path list). */
+export const COPY_TEXT_MAX = 100_000
+
/**
* Returns true if the current system clipboard content matches the given item data.
*
@@ -242,6 +247,58 @@ export function registerIpc(): void {
return getStore().toDto()
})
+ handle('item:set-meta', (id, meta) => {
+ getStore().setMeta(id, meta)
+ return getStore().toDto()
+ })
+
+ handle('item:copy-text', (text) => {
+ if (typeof text !== 'string' || text.length === 0 || text.length > COPY_TEXT_MAX) return false
+ // Same rule as emoji:paste: a derived copy (clean link, color format,
+ // file path) is a tool action, not a capture, so it never becomes a new
+ // history card. resyncSignature() makes the watcher treat this write as
+ // already seen when it resumes.
+ const watcher = getWatcher()
+ watcher.setPaused(true)
+ try {
+ clipboard.clear()
+ clipboard.writeText(text)
+ return true
+ } catch (err) {
+ console.error('[IPC] item:copy-text failed:', err)
+ return false
+ } finally {
+ setTimeout(() => {
+ watcher.resyncSignature()
+ watcher.setPaused(loadSettings().incognito)
+ }, 200)
+ }
+ })
+
+ handle('item:save-images', (id) => {
+ const item = getStore().get(id)
+ if (!item || (item.data.kind !== 'image' && item.data.kind !== 'image-collection')) return []
+ let saved: string[] = []
+ try {
+ saved = saveItemImages(item, {
+ destDir: app.getPath('downloads'),
+ resolveSource: (imageId, ext) => getStore().resolveStoredImagePath(imageId, ext),
+ defaultName: (capturedAt, ext, img, index) =>
+ formatClipboardImageFilename(capturedAt, ext, {
+ source: img.source,
+ fileName: img.fileName,
+ indexSuffix: item.data.kind === 'image-collection' ? index : undefined
+ })
+ })
+ } catch (err) {
+ console.error('[IPC] item:save-images failed:', err)
+ }
+ if (saved.length === 0) toast('toast.saveImagesFailed', 'error')
+ else if (saved.length === 1) toast('toast.savedToDownloads', 'info', { name: basename(saved[0]) })
+ else toast('toast.savedManyToDownloads', 'info', { count: saved.length })
+ return saved.map((p) => basename(p))
+ })
+
handle('item:delete', (id) => {
const item = getStore().get(id)
const watcher = getWatcher()
@@ -388,7 +445,7 @@ export function registerIpc(): void {
let _lastEmojiPasteTime = 0
const EMOJI_PASTE_GUARD_MS = 180
- handle('item:paste', async (id) => {
+ handle('item:paste', async (id, opts) => {
const now = Date.now()
if (now - _lastPasteTime < PASTE_GUARD_MS) {
console.log('[IPC] item:paste blocked — too soon after last paste')
@@ -423,7 +480,7 @@ export function registerIpc(): void {
// 2. Write item to system clipboard
const fullText = item.data.kind === 'text' ? getStore().getFullText(id) : undefined
const itemDataWithFullText = item.data.kind === 'text' && fullText ? { ...item.data, text: fullText } : item.data
- const ok = await writeItemToClipboard(itemDataWithFullText, item.capturedAt)
+ const ok = await writeItemToClipboard(itemDataWithFullText, item.capturedAt, { plain: opts?.plain === true })
if (!ok) {
// Extremely rare race: source vanished between pre-check and write.
toast('toast.imageUnavailable', 'error')
@@ -867,12 +924,13 @@ export function registerSendListeners(): void {
* written (e.g. every source image vanished from disk) so callers can show an
* explicit error instead of silently degrading quality.
*/
-export async function writeItemToClipboard(data: ItemData, capturedAt?: number): Promise<boolean> {
+export async function writeItemToClipboard(data: ItemData, capturedAt?: number, opts?: { plain?: boolean }): Promise<boolean> {
switch (data.kind) {
case 'text': {
const formatted = formatTabularDataForClipboard(data.text, data.html)
clipboard.clear()
- clipboard.write({ text: formatted.text, html: formatted.html })
+ // Plain: the same CRLF text, but no html (fonts, colors, tables).
+ clipboard.write(opts?.plain ? { text: formatted.text } : { text: formatted.text, html: formatted.html })
return true
}
diff --git a/electron/main/saveImages.ts b/electron/main/saveImages.ts
new file mode 100644
index 0000000..4892a4c
--- /dev/null
+++ b/electron/main/saveImages.ts
@@ -0,0 +1,75 @@
+/**
+ * "Save to Downloads" for image items: copies the stored original file(s)
+ * into a folder under a readable name, never overwriting an existing file.
+ *
+ * Kept free of Electron imports (paths and lookups are passed in) so it can
+ * be unit-tested against a temp folder.
+ */
+import { copyFileSync, existsSync, mkdirSync } from 'node:fs'
+import { extname, join } from 'node:path'
+import type { ClipboardImageFields, ClipboardItem } from '../../shared/types'
+
+export interface SaveImagesDeps {
+ /** Target folder (the user's Downloads folder in the app). */
+ destDir: string
+ /** On-disk original for a stored image, or null when it is gone. */
+ resolveSource: (imageId: string, ext?: string) => string | null
+ /** Default name when the item has no label (same names drag-out uses). */
+ defaultName: (capturedAt: number, ext: string, img: ClipboardImageFields, index: number) => string
+}
+
+const RESERVED = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i
+
+/** A label as a Windows-safe file name base (no extension). */
+export function fileBaseFromLabel(label: string): string {
+ let base = label
+ .replace(/[<>:"/\\|?*\u0000-\u001f]/g, '_')
+ .replace(/\s+/g, ' ')
+ .trim()
+ .replace(/[. ]+$/, '')
+ .replace(/^\.+/, '')
+ if (Array.from(base).length > 120) base = Array.from(base).slice(0, 120).join('').trim()
+ if (RESERVED.test(base)) base = `${base}_`
+ return base || 'Image'
+}
+
+/** `dir/base.ext`, or `dir/base (2).ext`, `(3)`... when that name is taken. */
+export function uniqueDest(dir: string, base: string, ext: string): string {
+ const cleanExt = ext.replace(/^\./, '') || 'png'
+ let candidate = join(dir, `${base}.${cleanExt}`)
+ for (let n = 2; existsSync(candidate) && n < 10000; n++) {
+ candidate = join(dir, `${base} (${n}).${cleanExt}`)
+ }
+ return candidate
+}
+
+/** Copy the item's images into destDir. Returns the written paths. */
+export function saveItemImages(item: ClipboardItem, deps: SaveImagesDeps): string[] {
+ const images: ClipboardImageFields[] =
+ item.data.kind === 'image'
+ ? [item.data]
+ : item.data.kind === 'image-collection'
+ ? item.data.images
+ : []
+ if (images.length === 0) return []
+ mkdirSync(deps.destDir, { recursive: true })
+
+ const labelBase = item.label ? fileBaseFromLabel(item.label) : null
+ const saved: string[] = []
+ images.forEach((img, i) => {
+ const src = deps.resolveSource(img.imageId, img.ext)
+ if (!src) return
+ const ext = extname(src).replace(/^\./, '') || img.ext || 'png'
+ const base = labelBase
+ ? images.length > 1 ? `${labelBase} (${i + 1})` : labelBase
+ : deps.defaultName(item.capturedAt, ext, img, i + 1).replace(/\.[^.]+$/, '')
+ const dest = uniqueDest(deps.destDir, base, ext)
+ try {
+ copyFileSync(src, dest)
+ saved.push(dest)
+ } catch (err) {
+ console.error('[saveImages] copy failed:', err)
+ }
+ })
+ return saved
+}
diff --git a/electron/main/window.ts b/electron/main/window.ts
index bc2cc60..aa4755a 100644
--- a/electron/main/window.ts
+++ b/electron/main/window.ts
@@ -20,6 +20,7 @@ import { runtime } from './config'
import { PATHS } from '../store/paths'
import { TRANSLATIONS, en } from '../../src/i18n/translations'
import { computeStickBounds } from './geometry'
+import { isSafeExternalUrl } from './externalUrl'
import { WorkAreaCache } from './workAreaCache'
import { probeSeamAware, isNearProximity, type SeamTickState } from './stickProbe'
import { loadSettings, saveSettings } from '../store/settings'
@@ -194,6 +195,14 @@ export function isInteractive(): boolean {
let lastExternalForeground: number | bigint = 0
/** Last focusability actually applied via native calls (avoids redundant writes). */
let focusabilityApplied: boolean | null = null
+/**
+ * Bumped on every focusability request. A release's foreground repair keeps
+ * retrying for ~120ms in the background; when a newer request (the shelf
+ * taking focus again for a text field) arrives meanwhile, the old repair
+ * must stop instead of handing the foreground back to the user's app right
+ * after we took it.
+ */
+let focusRequestGeneration = 0
function hwndNumber(h: number | bigint): number {
try {
@@ -267,7 +276,7 @@ function usableHwnd(h: number | bigint): boolean {
* Retries with small sleeps. Resolves true only when the target is
* foreground afterwards.
*/
-export async function restoreFgAwaited(target: number | bigint, tag: string): Promise<boolean> {
+export async function restoreFgAwaited(target: number | bigint, tag: string, isStale?: () => boolean): Promise<boolean> {
if (process.platform !== 'win32' || !setForegroundWindowFn || !getForegroundWindowFn) {
return false
}
@@ -276,6 +285,10 @@ export async function restoreFgAwaited(target: number | bigint, tag: string): Pr
return false
}
for (let attempt = 1; attempt <= 4; attempt++) {
+ if (isStale?.()) {
+ console.log(`[Focus] ${tag}: superseded by a newer focus request, stopped before attempt ${attempt}`)
+ return false
+ }
try {
const before = getForegroundWindowFn()
const ok = !!setForegroundWindowFn(target)
@@ -865,9 +878,14 @@ export function createWindow(): BrowserWindow {
mainWindow?.setAlwaysOnTop(true, 'screen-saver')
})
- // Open external links in the default browser.
+ // Open external links in the default browser (web, mail and Store links
+ // only; see externalUrl.ts).
mainWindow.webContents.setWindowOpenHandler((details) => {
- shell.openExternal(details.url)
+ if (isSafeExternalUrl(details.url)) {
+ void shell.openExternal(details.url).catch((err) => console.error('[Window] openExternal failed:', err))
+ } else {
+ console.warn('[Window] refused to open a non-web link')
+ }
return { action: 'deny' }
})
@@ -1091,6 +1109,7 @@ export function setVisible(visible: boolean): void {
}
export function setWindowFocusable(focusable: boolean): void {
+ const generation = ++focusRequestGeneration
if (mainWindow && !mainWindow.isDestroyed()) {
try {
// Skip redundant native writes: even "no-op" style/focusability calls
@@ -1129,7 +1148,7 @@ export function setWindowFocusable(focusable: boolean): void {
`after=${after ? hwndHex(after) : 'none'} target=${usableHwnd(target) ? hwndHex(target) : 'none'}`
)
if (usableHwnd(target)) {
- void restoreFgAwaited(target, 'release-repair').catch(() => {})
+ void restoreFgAwaited(target, 'release-repair', () => focusRequestGeneration !== generation).catch(() => {})
}
}
return
diff --git a/electron/preload/index.ts b/electron/preload/index.ts
index c6853aa..bab9de7 100644
--- a/electron/preload/index.ts
+++ b/electron/preload/index.ts
@@ -185,7 +185,10 @@ const api = {
getFullText: (id: string) => invoke('item:get-full-text', id),
copyItem: (id: string) => invoke('item:copy', id),
copySubitem: (req: import('../../shared/types').DragRequest) => invoke('item:copy-subitem', req),
- pasteItem: (id: string) => invoke('item:paste', id),
+ pasteItem: (id: string, opts?: { plain?: boolean }) => invoke('item:paste', id, opts),
+ setItemMeta: (id: string, meta: import('../../shared/itemMeta').ItemMetaPatch) => invoke('item:set-meta', id, meta),
+ copyText: (text: string) => invoke('item:copy-text', text),
+ saveImages: (id: string) => invoke('item:save-images', id),
pasteSubitem: (req: import('../../shared/types').DragRequest) => invoke('item:paste-subitem', req),
pasteEmoji: (text: string) => invoke('emoji:paste', text),
emojiGlyphs: (files: string[]) => invoke('emoji:glyphs', files),
diff --git a/electron/store/ItemStore.ts b/electron/store/ItemStore.ts
index ac83988..2721cdd 100644
--- a/electron/store/ItemStore.ts
+++ b/electron/store/ItemStore.ts
@@ -26,6 +26,15 @@ import { PATHS } from './paths'
import { createId } from './ids'
import { contentSignature } from './signature'
import { MAX_ITEM_HTML_CHARS } from '../clipboard/formats'
+import { combineTags, hasItemMeta, normalizeLabel, normalizeTags, type ItemMetaPatch } from '../../shared/itemMeta'
+
+/** Write already-normalized metadata, removing the fields when empty. */
+function applyMeta(it: ClipboardItem, label: string | undefined, tags: string[] | undefined): void {
+ if (label) it.label = label
+ else delete it.label
+ if (tags && tags.length > 0) it.tags = tags
+ else delete it.tags
+}
/** Maps a signature -> item id so dedup is O(1). */
interface Index {
@@ -103,6 +112,9 @@ export class ItemStore {
// Auto-migrate large text items to disk payload files
let migratedAnyPayloads = false
for (const it of this.items) {
+ // A hand-edited or damaged file must never feed odd label/tag
+ // values to the renderer: re-run the same cleanup as writes.
+ if ('label' in it || 'tags' in it) applyMeta(it, normalizeLabel(it.label), normalizeTags(it.tags))
if (it.data.kind === 'text') {
if (!it.data.hasFullPayload && it.data.text.length > 300) {
this.writeTextPayload(it.id, it.data.text)
@@ -306,6 +318,24 @@ export class ItemStore {
this.persist()
}
+ /**
+ * Set or clear an item's label and tags. Values are normalized here, so
+ * nothing unclean is ever stored. Giving an unpinned item a label or tag
+ * pins it: history limit, auto-delete and "clear" never touch pinned items,
+ * so something the user named cannot silently disappear. Clearing the
+ * metadata leaves the pin alone. Returns false when the item is gone.
+ */
+ setMeta(id: string, patch: ItemMetaPatch): boolean {
+ const it = this.items.find((x) => x.id === id)
+ if (!it || !patch || typeof patch !== 'object') return false
+ const label = 'label' in patch ? normalizeLabel(patch.label) : it.label
+ const tags = 'tags' in patch ? normalizeTags(patch.tags) : it.tags
+ applyMeta(it, label, tags)
+ if (hasItemMeta(it)) it.pinned = true
+ this.persist()
+ return true
+ }
+
delete(id: string): void {
const idx = this.items.findIndex((x) => x.id === id)
if (idx < 0) return
@@ -416,6 +446,15 @@ export class ItemStore {
this.sigToId.set(contentSignature(newData), tgt.id)
tgt.capturedAt = Date.now() // bump time
+ // The source card disappears, so carry what the user gave it: the
+ // target keeps its own label (or takes the source's when it has none)
+ // and gets both sets of tags. A named source was kept by its pin; keep
+ // the merged card the same way.
+ if (hasItemMeta(src)) {
+ applyMeta(tgt, tgt.label ?? src.label, combineTags(tgt.tags, src.tags))
+ if (src.pinned) tgt.pinned = true
+ }
+
// Remove source item completely but DO NOT delete its underlying files/images
// because they are now owned by the target!
const [removed] = this.items.splice(srcIdx, 1)
@@ -809,7 +848,10 @@ export class ItemStore {
isUrl: d.isUrl,
isColor: d.isColor,
hasFullPayload: d.hasFullPayload,
- previewText: d.previewText
+ previewText: d.previewText,
+ // html itself stays in main (can be large); the renderer only
+ // needs to know it exists to offer "Paste as plain text".
+ hasHtml: !!d.html
}
}
}
diff --git a/resources/file-icons/archive.png b/resources/file-icons/archive.png
deleted file mode 100644
index 61a335f..0000000
Binary files a/resources/file-icons/archive.png and /dev/null differ
diff --git a/resources/file-icons/archive.svg b/resources/file-icons/archive.svg
new file mode 100644
index 0000000..a662f30
--- /dev/null
+++ b/resources/file-icons/archive.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Archive file icon"><defs>
+ <linearGradient id="archive-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#a87a3e"/><stop offset="1" stop-color="#5e3e17"/></linearGradient>
+ <linearGradient id="archive-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="archive-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fffbf3"/><stop offset="1" stop-color="#f2e8d6"/></linearGradient>
+ <linearGradient id="archive-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#faf2e3" stop-opacity="0.55"/><stop offset=".5" stop-color="#d9c093" stop-opacity="0.45"/><stop offset="1" stop-color="#634219" stop-opacity="0.82"/></linearGradient>
+ <linearGradient id="archive-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="archive-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="archive-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="archive-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="archive-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="archive-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#archive-front" fill="#fff"/></mask>
+ <filter id="archive-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="archive-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="archive-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="archive-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="archive-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="archive-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="archive-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#5e3e17" flood-opacity=".22"/></filter>
+ <filter id="archive-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#5e3e17" opacity=".32" filter="url(#archive-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#5e3e17" opacity=".28" filter="url(#archive-sht)"/>
+ <use href="#archive-panel" fill="url(#archive-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#archive-backlight)"/>
+ <g id="archive-contents"><g transform="rotate(8 341 240)" filter="url(#archive-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#archive-paper)"/><rect x="336.8" y="164" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="169.32" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="174.64" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="179.95999999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="206.55999999999995" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="211.87999999999994" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="217.19999999999993" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="222.51999999999992" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="227.83999999999992" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="233.1599999999999" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="238.4799999999999" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="243.7999999999999" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="249.1199999999999" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="254.43999999999988" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="259.7599999999999" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="265.07999999999987" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="270.39999999999986" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="275.71999999999986" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="281.03999999999985" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="286.35999999999984" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="291.67999999999984" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="296.99999999999983" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="302.3199999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="307.6399999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="336.8" y="312.9599999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="341.2" y="318.2799999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="333.5" y="181.5" width="17" height="24" rx="8.5" fill="#fffbf3"/><rect x="336.0" y="184" width="12" height="19" rx="6.0" fill="#c4a26a"/><rect x="339.96" y="194.45" width="4.08" height="4.94" rx="2.04" fill="#fffbf3"/></g><g transform="rotate(5 300 226)" filter="url(#archive-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#archive-paper)"/><rect x="294.8" y="140" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="145.32" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="150.64" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="155.95999999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="182.55999999999995" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="187.87999999999994" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="193.19999999999993" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="198.51999999999992" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="203.83999999999992" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="209.1599999999999" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="214.4799999999999" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="219.7999999999999" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="225.1199999999999" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="230.43999999999988" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="235.75999999999988" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="241.07999999999987" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="246.39999999999986" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="251.71999999999986" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="257.03999999999985" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="262.35999999999984" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="267.67999999999984" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="272.99999999999983" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="278.3199999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="283.6399999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="288.9599999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="294.2799999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="299.5999999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="304.9199999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="294.8" y="310.2399999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="299.2" y="315.5599999999998" width="6" height="2.8" rx="1.4" fill="#c4a26a"/><rect x="291.5" y="157.5" width="17" height="24" rx="8.5" fill="#fffbf3"/><rect x="294.0" y="160" width="12" height="19" rx="6.0" fill="#c4a26a"/><rect x="297.96" y="170.45" width="4.08" height="4.94" rx="2.04" fill="#fffbf3"/></g><g transform="rotate(-8 220 224)" filter="url(#archive-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#archive-paper)"/><rect x="212.8" y="122" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="128.84" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="135.68" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="176.72000000000003" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="183.56000000000003" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="190.40000000000003" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="197.24000000000004" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="204.08000000000004" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="210.92000000000004" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="217.76000000000005" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="224.60000000000005" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="231.44000000000005" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="238.28000000000006" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="245.12000000000006" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="251.96000000000006" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="258.80000000000007" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="265.64000000000004" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="272.48" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="279.32" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="286.15999999999997" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="292.99999999999994" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="299.8399999999999" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="306.6799999999999" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="313.51999999999987" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="320.35999999999984" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="212.8" y="327.1999999999998" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="219.2" y="334.0399999999998" width="8" height="3.6" rx="1.8" fill="#c4a26a"/><rect x="209.5" y="139.5" width="21" height="31" rx="10.5" fill="#fffbf3"/><rect x="212.0" y="142" width="16" height="26" rx="8.0" fill="#c4a26a"/><rect x="217.28" y="156.3" width="5.44" height="6.76" rx="2.72" fill="#fffbf3"/></g></g>
+ <g mask="url(#archive-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#archive-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#f1e6d2" opacity=".18"/>
+ <g filter="url(#archive-frost)"><use href="#archive-panel" fill="url(#archive-back)"/><use href="#archive-contents"/></g>
+ <use href="#archive-front" fill="url(#archive-glass)"/>
+ <use href="#archive-front" fill="url(#archive-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#archive-grain)"/>
+ <use href="#archive-front" fill="url(#archive-spot)"/>
+ <use href="#archive-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#archive-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#archive-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/audio.png b/resources/file-icons/audio.png
deleted file mode 100644
index b6f41b4..0000000
Binary files a/resources/file-icons/audio.png and /dev/null differ
diff --git a/resources/file-icons/audio.svg b/resources/file-icons/audio.svg
new file mode 100644
index 0000000..155d0eb
--- /dev/null
+++ b/resources/file-icons/audio.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Audio file icon"><defs>
+ <linearGradient id="audio-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#9a6478"/><stop offset="1" stop-color="#4f2c3b"/></linearGradient>
+ <linearGradient id="audio-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="audio-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fffafb"/><stop offset="1" stop-color="#f2e6ea"/></linearGradient>
+ <linearGradient id="audio-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f8eff2" stop-opacity="0.55"/><stop offset=".5" stop-color="#d8b9c5" stop-opacity="0.45"/><stop offset="1" stop-color="#55303f" stop-opacity="0.82"/></linearGradient>
+ <linearGradient id="audio-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="audio-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="audio-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="audio-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="audio-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="audio-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#audio-front" fill="#fff"/></mask>
+ <filter id="audio-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="audio-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="audio-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="audio-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="audio-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="audio-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="audio-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#4f2c3b" flood-opacity=".22"/></filter>
+ <filter id="audio-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#4f2c3b" opacity=".32" filter="url(#audio-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#4f2c3b" opacity=".28" filter="url(#audio-sht)"/>
+ <use href="#audio-panel" fill="url(#audio-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#audio-backlight)"/>
+ <g id="audio-contents"><g transform="rotate(8 341 240)" filter="url(#audio-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#audio-paper)"/><rect x="320" y="197.52" width="4" height="5.76" rx="2.0" fill="#e4d0d8"/><rect x="328" y="195.36" width="4" height="10.08" rx="2.0" fill="#e4d0d8"/><rect x="336" y="191.76" width="4" height="17.28" rx="2.0" fill="#c49aab"/><rect x="344" y="188.16" width="4" height="24.48" rx="2.0" fill="#c49aab"/><rect x="352" y="186.0" width="4" height="28.799999999999997" rx="2.0" fill="#c49aab"/><rect x="360" y="189.6" width="4" height="21.599999999999998" rx="2.0" fill="#c49aab"/><rect x="318" y="223.44" width="48" height="6" rx="3.0" fill="#e4d0d8"/><rect x="318" y="239.44" width="41.76" height="6" rx="3.0" fill="#e4d0d8"/><rect x="318" y="255.44" width="46.56" height="6" rx="3.0" fill="#e4d0d8"/><rect x="318" y="271.44" width="36.0" height="6" rx="3.0" fill="#e4d0d8"/><rect x="318" y="287.44" width="44.64" height="6" rx="3.0" fill="#e4d0d8"/><rect x="318" y="303.44" width="38.400000000000006" height="6" rx="3.0" fill="#e4d0d8"/></g><g transform="rotate(5 300 226)" filter="url(#audio-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#audio-paper)"/><rect x="270" y="173.52" width="4" height="5.76" rx="2.0" fill="#e4d0d8"/><rect x="278" y="171.36" width="4" height="10.08" rx="2.0" fill="#e4d0d8"/><rect x="286" y="167.76" width="4" height="17.28" rx="2.0" fill="#c49aab"/><rect x="294" y="164.16" width="4" height="24.48" rx="2.0" fill="#c49aab"/><rect x="302" y="162.0" width="4" height="28.799999999999997" rx="2.0" fill="#c49aab"/><rect x="310" y="165.6" width="4" height="21.599999999999998" rx="2.0" fill="#c49aab"/><rect x="318" y="169.20000000000002" width="4" height="14.399999999999999" rx="2.0" fill="#c49aab"/><rect x="326" y="172.08" width="4" height="8.64" rx="2.0" fill="#e4d0d8"/><rect x="268" y="199.44" width="64" height="6" rx="3.0" fill="#e4d0d8"/><rect x="268" y="215.44" width="55.68" height="6" rx="3.0" fill="#e4d0d8"/><rect x="268" y="231.44" width="62.08" height="6" rx="3.0" fill="#e4d0d8"/><rect x="268" y="247.44" width="48.0" height="6" rx="3.0" fill="#e4d0d8"/><rect x="268" y="263.44" width="59.52" height="6" rx="3.0" fill="#e4d0d8"/><rect x="268" y="279.44" width="51.2" height="6" rx="3.0" fill="#e4d0d8"/><rect x="268" y="295.44" width="57.6" height="6" rx="3.0" fill="#e4d0d8"/></g><g transform="rotate(-8 220 224)" filter="url(#audio-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#audio-paper)"/><rect x="162" y="160.0" width="5" height="8" rx="2.5" fill="#e4d0d8"/><rect x="173" y="157.0" width="5" height="14" rx="2.5" fill="#e4d0d8"/><rect x="184" y="152.0" width="5" height="24" rx="2.5" fill="#c49aab"/><rect x="195" y="147.0" width="5" height="34" rx="2.5" fill="#c49aab"/><rect x="206" y="144.0" width="5" height="40" rx="2.5" fill="#c49aab"/><rect x="217" y="149.0" width="5" height="30" rx="2.5" fill="#c49aab"/><rect x="228" y="154.0" width="5" height="20" rx="2.5" fill="#c49aab"/><rect x="239" y="158.0" width="5" height="12" rx="2.5" fill="#e4d0d8"/><rect x="250" y="160.0" width="5" height="8" rx="2.5" fill="#e4d0d8"/><rect x="261" y="157.0" width="5" height="14" rx="2.5" fill="#e4d0d8"/><rect x="272" y="160.0" width="5" height="8" rx="2.5" fill="#e4d0d8"/><rect x="160" y="196" width="120" height="6" rx="3.0" fill="#e4d0d8"/><rect x="160" y="213" width="104.4" height="6" rx="3.0" fill="#e4d0d8"/><rect x="160" y="230" width="116.39999999999999" height="6" rx="3.0" fill="#e4d0d8"/><rect x="160" y="247" width="90.0" height="6" rx="3.0" fill="#e4d0d8"/><rect x="160" y="264" width="111.60000000000001" height="6" rx="3.0" fill="#e4d0d8"/><rect x="160" y="281" width="96.0" height="6" rx="3.0" fill="#e4d0d8"/><rect x="160" y="298" width="108.0" height="6" rx="3.0" fill="#e4d0d8"/><rect x="160" y="315" width="99.6" height="6" rx="3.0" fill="#e4d0d8"/></g></g>
+ <g mask="url(#audio-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#audio-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#f0e3e8" opacity=".18"/>
+ <g filter="url(#audio-frost)"><use href="#audio-panel" fill="url(#audio-back)"/><use href="#audio-contents"/></g>
+ <use href="#audio-front" fill="url(#audio-glass)"/>
+ <use href="#audio-front" fill="url(#audio-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#audio-grain)"/>
+ <use href="#audio-front" fill="url(#audio-spot)"/>
+ <use href="#audio-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#audio-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#audio-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/code.png b/resources/file-icons/code.png
deleted file mode 100644
index 4580936..0000000
Binary files a/resources/file-icons/code.png and /dev/null differ
diff --git a/resources/file-icons/code.svg b/resources/file-icons/code.svg
new file mode 100644
index 0000000..146c109
--- /dev/null
+++ b/resources/file-icons/code.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Code file icon"><defs>
+ <linearGradient id="code-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#4a4f9e"/><stop offset="1" stop-color="#1f2152"/></linearGradient>
+ <linearGradient id="code-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="code-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#eceefa"/></linearGradient>
+ <linearGradient id="code-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e8eafb" stop-opacity="0.52"/><stop offset=".5" stop-color="#a9aee0" stop-opacity="0.42"/><stop offset="1" stop-color="#222557" stop-opacity="0.84"/></linearGradient>
+ <linearGradient id="code-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="code-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="code-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="code-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="code-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="code-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#code-front" fill="#fff"/></mask>
+ <filter id="code-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="code-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="code-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="code-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="code-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="code-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="code-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#1f2152" flood-opacity=".22"/></filter>
+ <filter id="code-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#1f2152" opacity=".32" filter="url(#code-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#1f2152" opacity=".28" filter="url(#code-sht)"/>
+ <use href="#code-panel" fill="url(#code-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#code-backlight)"/>
+ <g id="code-contents"><g transform="rotate(8 341 240)" filter="url(#code-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#code-paper)"/><rect x="325" y="182" width="1.6" height="134" rx="0.8" fill="#c9ccec"/><rect x="318" y="186" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="331.0" y="186" width="12.58" height="6" rx="3" fill="#9aa0d9"/><rect x="347.58" y="186" width="8.14" height="6" rx="3" fill="#c9ccec"/><rect x="318" y="198" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="335.44" y="198" width="9.62" height="6" rx="3" fill="#9aa0d9"/><rect x="349.06" y="198" width="11.1" height="6" rx="3" fill="#c9ccec"/><rect x="318" y="210" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="339.88" y="210" width="14.8" height="6" rx="3" fill="#9aa0d9"/><rect x="318" y="222" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="339.88" y="222" width="8.14" height="6" rx="3" fill="#9aa0d9"/><rect x="352.02" y="222" width="9.62" height="6" rx="3" fill="#c9ccec"/><rect x="318" y="234" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="335.44" y="234" width="6.66" height="6" rx="3" fill="#9aa0d9"/><rect x="318" y="246" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="331.0" y="246" width="5.18" height="6" rx="3" fill="#9aa0d9"/><rect x="318" y="258" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="331.0" y="258" width="11.1" height="6" rx="3" fill="#9aa0d9"/><rect x="346.1" y="258" width="8.879999999999999" height="6" rx="3" fill="#c9ccec"/><rect x="318" y="270" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="335.44" y="270" width="16.28" height="6" rx="3" fill="#9aa0d9"/><rect x="318" y="282" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="339.88" y="282" width="10.36" height="6" rx="3" fill="#9aa0d9"/><rect x="354.24" y="282" width="6.66" height="6" rx="3" fill="#c9ccec"/><rect x="318" y="294" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="335.44" y="294" width="5.92" height="6" rx="3" fill="#9aa0d9"/><rect x="318" y="306" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="331.0" y="306" width="5.18" height="6" rx="3" fill="#9aa0d9"/></g><g transform="rotate(5 300 226)" filter="url(#code-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#code-paper)"/><rect x="275" y="158" width="1.6" height="158" rx="0.8" fill="#c9ccec"/><rect x="268" y="162" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="281.0" y="162" width="18.02" height="6" rx="3" fill="#9aa0d9"/><rect x="303.02" y="162" width="11.66" height="6" rx="3" fill="#c9ccec"/><rect x="268" y="174" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="287.36" y="174" width="13.780000000000001" height="6" rx="3" fill="#9aa0d9"/><rect x="305.14" y="174" width="15.9" height="6" rx="3" fill="#c9ccec"/><rect x="268" y="186" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="293.72" y="186" width="21.200000000000003" height="6" rx="3" fill="#9aa0d9"/><rect x="268" y="198" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="293.72" y="198" width="11.66" height="6" rx="3" fill="#9aa0d9"/><rect x="309.38000000000005" y="198" width="13.780000000000001" height="6" rx="3" fill="#c9ccec"/><rect x="268" y="210" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="287.36" y="210" width="9.540000000000001" height="6" rx="3" fill="#9aa0d9"/><rect x="268" y="222" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="281.0" y="222" width="7.42" height="6" rx="3" fill="#9aa0d9"/><rect x="268" y="234" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="281.0" y="234" width="15.9" height="6" rx="3" fill="#9aa0d9"/><rect x="300.9" y="234" width="12.72" height="6" rx="3" fill="#c9ccec"/><rect x="268" y="246" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="287.36" y="246" width="23.32" height="6" rx="3" fill="#9aa0d9"/><rect x="268" y="258" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="293.72" y="258" width="14.84" height="6" rx="3" fill="#9aa0d9"/><rect x="312.56" y="258" width="9.540000000000001" height="6" rx="3" fill="#c9ccec"/><rect x="268" y="270" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="287.36" y="270" width="8.48" height="6" rx="3" fill="#9aa0d9"/><rect x="268" y="282" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="281.0" y="282" width="7.42" height="6" rx="3" fill="#9aa0d9"/><rect x="268" y="294" width="5" height="6" rx="3" fill="#c9ccec"/><rect x="281.0" y="294" width="13.780000000000001" height="6" rx="3" fill="#9aa0d9"/><rect x="298.78" y="294" width="15.9" height="6" rx="3" fill="#c9ccec"/></g><g transform="rotate(-8 220 224)" filter="url(#code-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#code-paper)"/><rect x="170" y="140" width="1.6" height="184" rx="0.8" fill="#c9ccec"/><rect x="160" y="144" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="177.0" y="144" width="35.7" height="6" rx="3" fill="#9aa0d9"/><rect x="216.7" y="144" width="23.1" height="6" rx="3" fill="#c9ccec"/><rect x="160" y="157" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="189.6" y="157" width="27.3" height="6" rx="3" fill="#9aa0d9"/><rect x="220.9" y="157" width="31.5" height="6" rx="3" fill="#c9ccec"/><rect x="160" y="170" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="202.2" y="170" width="42.0" height="6" rx="3" fill="#9aa0d9"/><rect x="160" y="183" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="202.2" y="183" width="23.1" height="6" rx="3" fill="#9aa0d9"/><rect x="229.29999999999998" y="183" width="27.3" height="6" rx="3" fill="#c9ccec"/><rect x="160" y="196" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="189.6" y="196" width="18.900000000000002" height="6" rx="3" fill="#9aa0d9"/><rect x="160" y="209" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="177.0" y="209" width="14.700000000000001" height="6" rx="3" fill="#9aa0d9"/><rect x="160" y="222" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="177.0" y="222" width="31.5" height="6" rx="3" fill="#9aa0d9"/><rect x="212.5" y="222" width="25.200000000000003" height="6" rx="3" fill="#c9ccec"/><rect x="160" y="235" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="189.6" y="235" width="46.2" height="6" rx="3" fill="#9aa0d9"/><rect x="160" y="248" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="202.2" y="248" width="29.400000000000002" height="6" rx="3" fill="#9aa0d9"/><rect x="235.6" y="248" width="18.900000000000002" height="6" rx="3" fill="#c9ccec"/><rect x="160" y="261" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="189.6" y="261" width="16.8" height="6" rx="3" fill="#9aa0d9"/><rect x="160" y="274" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="177.0" y="274" width="14.700000000000001" height="6" rx="3" fill="#9aa0d9"/><rect x="160" y="287" width="7" height="6" rx="3" fill="#c9ccec"/><rect x="177.0" y="287" width="27.3" height="6" rx="3" fill="#9aa0d9"/><rect x="208.3" y="287" width="31.5" height="6" rx="3" fill="#c9ccec"/></g></g>
+ <g mask="url(#code-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#code-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#dcdff4" opacity=".18"/>
+ <g filter="url(#code-frost)"><use href="#code-panel" fill="url(#code-back)"/><use href="#code-contents"/></g>
+ <use href="#code-front" fill="url(#code-glass)"/>
+ <use href="#code-front" fill="url(#code-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#code-grain)"/>
+ <use href="#code-front" fill="url(#code-spot)"/>
+ <use href="#code-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#code-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#code-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/excel.png b/resources/file-icons/excel.png
deleted file mode 100644
index 3b0eded..0000000
Binary files a/resources/file-icons/excel.png and /dev/null differ
diff --git a/resources/file-icons/excel.svg b/resources/file-icons/excel.svg
new file mode 100644
index 0000000..3de1d83
--- /dev/null
+++ b/resources/file-icons/excel.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Excel file icon"><defs>
+ <linearGradient id="excel-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#2e7a5e"/><stop offset="1" stop-color="#11402f"/></linearGradient>
+ <linearGradient id="excel-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="excel-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#e8f2ed"/></linearGradient>
+ <linearGradient id="excel-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e4f3ec" stop-opacity="0.52"/><stop offset=".5" stop-color="#a6cdbb" stop-opacity="0.42"/><stop offset="1" stop-color="#13442f" stop-opacity="0.84"/></linearGradient>
+ <linearGradient id="excel-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="excel-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="excel-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="excel-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="excel-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="excel-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#excel-front" fill="#fff"/></mask>
+ <filter id="excel-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="excel-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="excel-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="excel-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="excel-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="excel-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="excel-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#11402f" flood-opacity=".22"/></filter>
+ <filter id="excel-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#11402f" opacity=".32" filter="url(#excel-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#11402f" opacity=".28" filter="url(#excel-sht)"/>
+ <use href="#excel-panel" fill="url(#excel-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#excel-backlight)"/>
+ <g id="excel-contents"><g transform="rotate(8 341 240)" filter="url(#excel-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#excel-paper)"/><rect x="318" y="184" width="48" height="9.64" rx="4" fill="#7fb39c"/><rect x="318" y="204" width="12.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="332.4" y="204" width="15.36" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="350.16" y="204" width="15.84" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="318" y="219" width="12.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="332.4" y="219" width="15.36" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="350.16" y="219" width="15.84" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="318" y="234" width="12.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="332.4" y="234" width="15.36" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="350.16" y="234" width="15.84" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="318" y="249" width="12.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="332.4" y="249" width="15.36" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="350.16" y="249" width="15.84" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="318" y="264" width="12.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="332.4" y="264" width="15.36" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="350.16" y="264" width="15.84" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="318" y="279" width="12.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="332.4" y="279" width="15.36" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="350.16" y="279" width="15.84" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="318" y="294" width="12.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="332.4" y="294" width="15.36" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="350.16" y="294" width="15.84" height="7.4799999999999995" rx="3" fill="#bfdacd"/></g><g transform="rotate(5 300 226)" filter="url(#excel-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#excel-paper)"/><rect x="268" y="160" width="64" height="9.64" rx="4" fill="#7fb39c"/><rect x="268" y="180" width="16.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="287.2" y="180" width="20.48" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="310.88" y="180" width="21.119999999999997" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="268" y="195" width="16.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="287.2" y="195" width="20.48" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="310.88" y="195" width="21.119999999999997" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="268" y="210" width="16.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="287.2" y="210" width="20.48" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="310.88" y="210" width="21.119999999999997" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="268" y="225" width="16.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="287.2" y="225" width="20.48" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="310.88" y="225" width="21.119999999999997" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="268" y="240" width="16.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="287.2" y="240" width="20.48" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="310.88" y="240" width="21.119999999999997" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="268" y="255" width="16.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="287.2" y="255" width="20.48" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="310.88" y="255" width="21.119999999999997" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="268" y="270" width="16.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="287.2" y="270" width="20.48" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="310.88" y="270" width="21.119999999999997" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="268" y="285" width="16.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="287.2" y="285" width="20.48" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="310.88" y="285" width="21.119999999999997" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="268" y="300" width="16.0" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="287.2" y="300" width="20.48" height="7.4799999999999995" rx="3" fill="#bfdacd"/><rect x="310.88" y="300" width="21.119999999999997" height="7.4799999999999995" rx="3" fill="#bfdacd"/></g><g transform="rotate(-8 220 224)" filter="url(#excel-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#excel-paper)"/><rect x="160" y="142" width="120" height="13" rx="4" fill="#7fb39c"/><rect x="160" y="162" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="162" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="162" width="39.6" height="10" rx="3" fill="#bfdacd"/><rect x="160" y="178" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="178" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="178" width="39.6" height="10" rx="3" fill="#bfdacd"/><rect x="160" y="194" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="194" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="194" width="39.6" height="10" rx="3" fill="#bfdacd"/><rect x="160" y="210" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="210" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="210" width="39.6" height="10" rx="3" fill="#bfdacd"/><rect x="160" y="226" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="226" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="226" width="39.6" height="10" rx="3" fill="#bfdacd"/><rect x="160" y="242" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="242" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="242" width="39.6" height="10" rx="3" fill="#bfdacd"/><rect x="160" y="258" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="258" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="258" width="39.6" height="10" rx="3" fill="#bfdacd"/><rect x="160" y="274" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="274" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="274" width="39.6" height="10" rx="3" fill="#bfdacd"/><rect x="160" y="290" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="290" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="290" width="39.6" height="10" rx="3" fill="#bfdacd"/><rect x="160" y="306" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="306" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="306" width="39.6" height="10" rx="3" fill="#bfdacd"/><rect x="160" y="322" width="30.0" height="10" rx="3" fill="#bfdacd"/><rect x="196.0" y="322" width="38.4" height="10" rx="3" fill="#bfdacd"/><rect x="240.4" y="322" width="39.6" height="10" rx="3" fill="#bfdacd"/></g></g>
+ <g mask="url(#excel-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#excel-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#d8ebe2" opacity=".18"/>
+ <g filter="url(#excel-frost)"><use href="#excel-panel" fill="url(#excel-back)"/><use href="#excel-contents"/></g>
+ <use href="#excel-front" fill="url(#excel-glass)"/>
+ <use href="#excel-front" fill="url(#excel-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#excel-grain)"/>
+ <use href="#excel-front" fill="url(#excel-spot)"/>
+ <use href="#excel-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#excel-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#excel-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/executable.png b/resources/file-icons/executable.png
deleted file mode 100644
index 0afbc57..0000000
Binary files a/resources/file-icons/executable.png and /dev/null differ
diff --git a/resources/file-icons/executable.svg b/resources/file-icons/executable.svg
new file mode 100644
index 0000000..77d83d5
--- /dev/null
+++ b/resources/file-icons/executable.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Installer file icon"><defs>
+ <linearGradient id="executable-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#4a5d72"/><stop offset="1" stop-color="#1f2a37"/></linearGradient>
+ <linearGradient id="executable-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="executable-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#ebeff3"/></linearGradient>
+ <linearGradient id="executable-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#eaeef2" stop-opacity="0.52"/><stop offset=".5" stop-color="#b0bcc8" stop-opacity="0.42"/><stop offset="1" stop-color="#222d3a" stop-opacity="0.84"/></linearGradient>
+ <linearGradient id="executable-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="executable-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="executable-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="executable-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="executable-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="executable-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#executable-front" fill="#fff"/></mask>
+ <filter id="executable-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="executable-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="executable-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="executable-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="executable-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="executable-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="executable-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#1f2a37" flood-opacity=".22"/></filter>
+ <filter id="executable-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#1f2a37" opacity=".32" filter="url(#executable-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#1f2a37" opacity=".28" filter="url(#executable-sht)"/>
+ <use href="#executable-panel" fill="url(#executable-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#executable-backlight)"/>
+ <g id="executable-contents"><g transform="rotate(8 341 240)" filter="url(#executable-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#executable-paper)"/><rect x="318" y="184" width="26" height="26" rx="7.280000000000001" fill="#93a3b4"/><path d="M331.0 191.3 V201.0 M326.7 197.0 L331.0 201.3 L335.3 197.0" fill="none" stroke="#ffffff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><rect x="347.84" y="188" width="14.52800000000002" height="8.075" rx="3.9899999999999998" fill="#93a3b4"/><rect x="347.84" y="201.5" width="10.896000000000015" height="6" rx="3" fill="#cad3dc"/><rect x="318" y="220" width="48" height="7" rx="3.5" fill="#cad3dc"/><rect x="318" y="220" width="29.759999999999998" height="7" rx="3.5" fill="#93a3b4"/><rect x="318" y="240" width="48" height="6" rx="3.0" fill="#cad3dc"/><rect x="318" y="256" width="41.76" height="6" rx="3.0" fill="#cad3dc"/><rect x="318" y="272" width="46.56" height="6" rx="3.0" fill="#cad3dc"/><rect x="318" y="288" width="36.0" height="6" rx="3.0" fill="#cad3dc"/><rect x="318" y="304" width="44.64" height="6" rx="3.0" fill="#cad3dc"/></g><g transform="rotate(5 300 226)" filter="url(#executable-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#executable-paper)"/><rect x="268" y="160" width="26" height="26" rx="7.280000000000001" fill="#93a3b4"/><path d="M281.0 167.3 V177.0 M276.7 173.0 L281.0 177.3 L285.3 173.0" fill="none" stroke="#ffffff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><rect x="299.12" y="164" width="26.304" height="8.075" rx="3.9899999999999998" fill="#93a3b4"/><rect x="299.12" y="177.5" width="19.727999999999998" height="6" rx="3" fill="#cad3dc"/><rect x="268" y="196" width="64" height="7" rx="3.5" fill="#cad3dc"/><rect x="268" y="196" width="39.68" height="7" rx="3.5" fill="#93a3b4"/><rect x="268" y="216" width="64" height="6" rx="3.0" fill="#cad3dc"/><rect x="268" y="232" width="55.68" height="6" rx="3.0" fill="#cad3dc"/><rect x="268" y="248" width="62.08" height="6" rx="3.0" fill="#cad3dc"/><rect x="268" y="264" width="48.0" height="6" rx="3.0" fill="#cad3dc"/><rect x="268" y="280" width="59.52" height="6" rx="3.0" fill="#cad3dc"/><rect x="268" y="296" width="51.2" height="6" rx="3.0" fill="#cad3dc"/></g><g transform="rotate(-8 220 224)" filter="url(#executable-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#executable-paper)"/><rect x="160" y="142" width="36" height="36" rx="10.080000000000002" fill="#93a3b4"/><path d="M178.0 152.1 V165.5 M172.1 160.0 L178.0 165.9 L183.9 160.0" fill="none" stroke="#ffffff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><rect x="205.6" y="146" width="59.52000000000001" height="9.35" rx="4.62" fill="#93a3b4"/><rect x="205.6" y="161" width="44.64" height="6" rx="3" fill="#cad3dc"/><rect x="160" y="188" width="120" height="7" rx="3.5" fill="#cad3dc"/><rect x="160" y="188" width="74.4" height="7" rx="3.5" fill="#93a3b4"/><rect x="160" y="208" width="120" height="6" rx="3.0" fill="#cad3dc"/><rect x="160" y="225" width="104.4" height="6" rx="3.0" fill="#cad3dc"/><rect x="160" y="242" width="116.39999999999999" height="6" rx="3.0" fill="#cad3dc"/><rect x="160" y="259" width="90.0" height="6" rx="3.0" fill="#cad3dc"/><rect x="160" y="276" width="111.60000000000001" height="6" rx="3.0" fill="#cad3dc"/><rect x="160" y="293" width="96.0" height="6" rx="3.0" fill="#cad3dc"/><rect x="160" y="310" width="108.0" height="6" rx="3.0" fill="#cad3dc"/></g></g>
+ <g mask="url(#executable-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#executable-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#dde3e9" opacity=".18"/>
+ <g filter="url(#executable-frost)"><use href="#executable-panel" fill="url(#executable-back)"/><use href="#executable-contents"/></g>
+ <use href="#executable-front" fill="url(#executable-glass)"/>
+ <use href="#executable-front" fill="url(#executable-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#executable-grain)"/>
+ <use href="#executable-front" fill="url(#executable-spot)"/>
+ <use href="#executable-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#executable-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#executable-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/file.png b/resources/file-icons/file.png
deleted file mode 100644
index d0b260f..0000000
Binary files a/resources/file-icons/file.png and /dev/null differ
diff --git a/resources/file-icons/file.svg b/resources/file-icons/file.svg
new file mode 100644
index 0000000..6698954
--- /dev/null
+++ b/resources/file-icons/file.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="File file icon"><defs>
+ <linearGradient id="file-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#a2a8b3"/><stop offset="1" stop-color="#656c79"/></linearGradient>
+ <linearGradient id="file-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="file-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#eef0f3"/></linearGradient>
+ <linearGradient id="file-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f3f4f6" stop-opacity="0.55"/><stop offset=".5" stop-color="#c9ced6" stop-opacity="0.45"/><stop offset="1" stop-color="#6a717e" stop-opacity="0.8"/></linearGradient>
+ <linearGradient id="file-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="file-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="file-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="file-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="file-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="file-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#file-front" fill="#fff"/></mask>
+ <filter id="file-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="file-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="file-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="file-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="file-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="file-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="file-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#4a505b" flood-opacity=".22"/></filter>
+ <filter id="file-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#4a505b" opacity=".32" filter="url(#file-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#4a505b" opacity=".28" filter="url(#file-sht)"/>
+ <use href="#file-panel" fill="url(#file-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#file-backlight)"/>
+ <g id="file-contents"><g transform="rotate(8 341 240)" filter="url(#file-pshadow)"><path d="M313 165 H362 L382 185 V302 Q382 315 369 315 H313 Q300 315 300 302 V178 Q300 165 313 165 Z" fill="url(#file-paper)"/><path d="M362 165 V177 Q362 185 370 185 H382 Z" fill="#d3d8de"/><rect x="318" y="188" width="32.160000000000004" height="9.5" rx="4.75" fill="#aeb5c0"/><rect x="318" y="212" width="48" height="6" rx="3.0" fill="#d3d8de"/><rect x="318" y="228" width="41.76" height="6" rx="3.0" fill="#d3d8de"/><rect x="318" y="244" width="46.56" height="6" rx="3.0" fill="#d3d8de"/><rect x="318" y="260" width="36.0" height="6" rx="3.0" fill="#d3d8de"/><rect x="318" y="276" width="44.64" height="6" rx="3.0" fill="#d3d8de"/><rect x="318" y="292" width="38.400000000000006" height="6" rx="3.0" fill="#d3d8de"/><rect x="318" y="308" width="43.2" height="6" rx="3.0" fill="#d3d8de"/></g><g transform="rotate(5 300 226)" filter="url(#file-pshadow)"><path d="M266 140 H328 L348 160 V298 Q348 312 334 312 H266 Q252 312 252 298 V154 Q252 140 266 140 Z" fill="url(#file-paper)"/><path d="M328 140 V152 Q328 160 336 160 H348 Z" fill="#d3d8de"/><rect x="268" y="164" width="42.88" height="9.5" rx="4.75" fill="#aeb5c0"/><rect x="268" y="188" width="64" height="6" rx="3.0" fill="#d3d8de"/><rect x="268" y="204" width="55.68" height="6" rx="3.0" fill="#d3d8de"/><rect x="268" y="220" width="62.08" height="6" rx="3.0" fill="#d3d8de"/><rect x="268" y="236" width="48.0" height="6" rx="3.0" fill="#d3d8de"/><rect x="268" y="252" width="59.52" height="6" rx="3.0" fill="#d3d8de"/><rect x="268" y="268" width="51.2" height="6" rx="3.0" fill="#d3d8de"/><rect x="268" y="284" width="57.6" height="6" rx="3.0" fill="#d3d8de"/><rect x="268" y="300" width="53.12" height="6" rx="3.0" fill="#d3d8de"/></g><g transform="rotate(-8 220 224)" filter="url(#file-pshadow)"><path d="M156 122 H272 L300 150 V310 Q300 326 284 326 H156 Q140 326 140 310 V138 Q140 122 156 122 Z" fill="url(#file-paper)"/><path d="M272 122 V142 Q272 150 280 150 H300 Z" fill="#d3d8de"/><rect x="160" y="146" width="80.4" height="11" rx="5.5" fill="#aeb5c0"/><rect x="160" y="170" width="120" height="6" rx="3.0" fill="#d3d8de"/><rect x="160" y="187" width="104.4" height="6" rx="3.0" fill="#d3d8de"/><rect x="160" y="204" width="116.39999999999999" height="6" rx="3.0" fill="#d3d8de"/><rect x="160" y="221" width="90.0" height="6" rx="3.0" fill="#d3d8de"/><rect x="160" y="238" width="111.60000000000001" height="6" rx="3.0" fill="#d3d8de"/><rect x="160" y="255" width="96.0" height="6" rx="3.0" fill="#d3d8de"/><rect x="160" y="272" width="108.0" height="6" rx="3.0" fill="#d3d8de"/><rect x="160" y="289" width="99.6" height="6" rx="3.0" fill="#d3d8de"/><rect x="160" y="306" width="120" height="6" rx="3.0" fill="#d3d8de"/></g></g>
+ <g mask="url(#file-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#file-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#e7eaee" opacity=".18"/>
+ <g filter="url(#file-frost)"><use href="#file-panel" fill="url(#file-back)"/><use href="#file-contents"/></g>
+ <use href="#file-front" fill="url(#file-glass)"/>
+ <use href="#file-front" fill="url(#file-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#file-grain)"/>
+ <use href="#file-front" fill="url(#file-spot)"/>
+ <use href="#file-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#file-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#file-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/folder.png b/resources/file-icons/folder.png
deleted file mode 100644
index 681f6dc..0000000
Binary files a/resources/file-icons/folder.png and /dev/null differ
diff --git a/resources/file-icons/folder.svg b/resources/file-icons/folder.svg
new file mode 100644
index 0000000..3843e3e
--- /dev/null
+++ b/resources/file-icons/folder.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Folder file icon"><defs>
+ <linearGradient id="folder-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f0bf4c"/><stop offset="1" stop-color="#c4861c"/></linearGradient>
+ <linearGradient id="folder-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="folder-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fffdf7"/><stop offset="1" stop-color="#f6eedb"/></linearGradient>
+ <linearGradient id="folder-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff7e2" stop-opacity="0.55"/><stop offset=".5" stop-color="#efd496" stop-opacity="0.45"/><stop offset="1" stop-color="#b0761a" stop-opacity="0.8"/></linearGradient>
+ <linearGradient id="folder-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="folder-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="folder-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="folder-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="folder-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="folder-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#folder-front" fill="#fff"/></mask>
+ <filter id="folder-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="folder-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="folder-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="folder-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="folder-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="folder-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="folder-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#8a5a10" flood-opacity=".22"/></filter>
+ <filter id="folder-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#8a5a10" opacity=".32" filter="url(#folder-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#8a5a10" opacity=".28" filter="url(#folder-sht)"/>
+ <use href="#folder-panel" fill="url(#folder-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#folder-backlight)"/>
+ <g id="folder-contents"><g transform="rotate(8 341 240)" filter="url(#folder-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#folder-paper)"/><rect x="318" y="184" width="48" height="9.64" rx="4" fill="#d6b264"/><rect x="318" y="204" width="12.0" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="332.4" y="204" width="15.36" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="350.16" y="204" width="15.84" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="318" y="219" width="12.0" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="332.4" y="219" width="15.36" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="350.16" y="219" width="15.84" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="318" y="234" width="12.0" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="332.4" y="234" width="15.36" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="350.16" y="234" width="15.84" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="318" y="249" width="12.0" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="332.4" y="249" width="15.36" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="350.16" y="249" width="15.84" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="318" y="264" width="12.0" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="332.4" y="264" width="15.36" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="350.16" y="264" width="15.84" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="318" y="279" width="12.0" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="332.4" y="279" width="15.36" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="350.16" y="279" width="15.84" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="318" y="294" width="12.0" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="332.4" y="294" width="15.36" height="7.4799999999999995" rx="3" fill="#eddcb2"/><rect x="350.16" y="294" width="15.84" height="7.4799999999999995" rx="3" fill="#eddcb2"/></g><g transform="rotate(5 300 226)" filter="url(#folder-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#folder-paper)"/><rect x="268" y="160" width="64" height="34" rx="6.4799999999999995" fill="#eddcb2"/><path d="M268 187.9 L284.0 171.9 L293.6 181.1 L301.9 174.3 L332 191.3 V187.5 Q332 194 325.5 194 H274.5 Q268 194 268 187.5 Z" fill="#d6b264"/><circle cx="319.2" cy="170.2" r="4.3" fill="#fffdf7"/><rect x="268" y="206" width="64" height="6" rx="3.0" fill="#eddcb2"/><rect x="268" y="222" width="55.68" height="6" rx="3.0" fill="#eddcb2"/><rect x="268" y="238" width="62.08" height="6" rx="3.0" fill="#eddcb2"/><rect x="268" y="254" width="48.0" height="6" rx="3.0" fill="#eddcb2"/><rect x="268" y="270" width="59.52" height="6" rx="3.0" fill="#eddcb2"/><rect x="268" y="286" width="51.2" height="6" rx="3.0" fill="#eddcb2"/><rect x="268" y="302" width="57.6" height="6" rx="3.0" fill="#eddcb2"/></g><g transform="rotate(-8 220 224)" filter="url(#folder-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#folder-paper)"/><rect x="160" y="146" width="80.4" height="11" rx="5.5" fill="#d6b264"/><rect x="160" y="170" width="120" height="6" rx="3.0" fill="#eddcb2"/><rect x="160" y="187" width="104.4" height="6" rx="3.0" fill="#eddcb2"/><rect x="160" y="204" width="116.39999999999999" height="6" rx="3.0" fill="#eddcb2"/><rect x="160" y="221" width="90.0" height="6" rx="3.0" fill="#eddcb2"/><rect x="160" y="238" width="111.60000000000001" height="6" rx="3.0" fill="#eddcb2"/><rect x="160" y="255" width="96.0" height="6" rx="3.0" fill="#eddcb2"/><rect x="160" y="272" width="108.0" height="6" rx="3.0" fill="#eddcb2"/><rect x="160" y="289" width="99.6" height="6" rx="3.0" fill="#eddcb2"/><rect x="160" y="306" width="120" height="6" rx="3.0" fill="#eddcb2"/></g></g>
+ <g mask="url(#folder-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#folder-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#fbefd3" opacity=".18"/>
+ <g filter="url(#folder-frost)"><use href="#folder-panel" fill="url(#folder-back)"/><use href="#folder-contents"/></g>
+ <use href="#folder-front" fill="url(#folder-glass)"/>
+ <use href="#folder-front" fill="url(#folder-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#folder-grain)"/>
+ <use href="#folder-front" fill="url(#folder-spot)"/>
+ <use href="#folder-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#folder-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#folder-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/image.png b/resources/file-icons/image.png
deleted file mode 100644
index dd3412e..0000000
Binary files a/resources/file-icons/image.png and /dev/null differ
diff --git a/resources/file-icons/image.svg b/resources/file-icons/image.svg
new file mode 100644
index 0000000..68966f0
--- /dev/null
+++ b/resources/file-icons/image.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Image file icon"><defs>
+ <linearGradient id="image-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#74835c"/><stop offset="1" stop-color="#38422a"/></linearGradient>
+ <linearGradient id="image-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="image-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fdfdf8"/><stop offset="1" stop-color="#eef0e4"/></linearGradient>
+ <linearGradient id="image-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f3f5ec" stop-opacity="0.55"/><stop offset=".5" stop-color="#c5cdb0" stop-opacity="0.45"/><stop offset="1" stop-color="#3b462c" stop-opacity="0.82"/></linearGradient>
+ <linearGradient id="image-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="image-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="image-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="image-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="image-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="image-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#image-front" fill="#fff"/></mask>
+ <filter id="image-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="image-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="image-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="image-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="image-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="image-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="image-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#38422a" flood-opacity=".22"/></filter>
+ <filter id="image-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#38422a" opacity=".32" filter="url(#image-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#38422a" opacity=".28" filter="url(#image-sht)"/>
+ <use href="#image-panel" fill="url(#image-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#image-backlight)"/>
+ <g id="image-contents"><g transform="rotate(8 341 240)" filter="url(#image-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#image-paper)"/><rect x="318" y="184" width="48" height="34" rx="6.4799999999999995" fill="#d6dcc6"/><path d="M318 211.9 L330.0 195.9 L337.2 205.1 L343.4 198.3 L366 215.3 V211.5 Q366 218 359.5 218 H324.5 Q318 218 318 211.5 Z" fill="#a7b38c"/><circle cx="356.4" cy="194.2" r="4.3" fill="#fdfdf8"/><rect x="318" y="230" width="48" height="6" rx="3.0" fill="#d6dcc6"/><rect x="318" y="246" width="41.76" height="6" rx="3.0" fill="#d6dcc6"/><rect x="318" y="262" width="46.56" height="6" rx="3.0" fill="#d6dcc6"/><rect x="318" y="278" width="36.0" height="6" rx="3.0" fill="#d6dcc6"/><rect x="318" y="294" width="44.64" height="6" rx="3.0" fill="#d6dcc6"/></g><g transform="rotate(5 300 226)" filter="url(#image-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#image-paper)"/><rect x="268" y="160" width="64" height="34" rx="6.4799999999999995" fill="#d6dcc6"/><path d="M268 187.9 L284.0 171.9 L293.6 181.1 L301.9 174.3 L332 191.3 V187.5 Q332 194 325.5 194 H274.5 Q268 194 268 187.5 Z" fill="#a7b38c"/><circle cx="319.2" cy="170.2" r="4.3" fill="#fdfdf8"/><rect x="268" y="206" width="64" height="6" rx="3.0" fill="#d6dcc6"/><rect x="268" y="222" width="55.68" height="6" rx="3.0" fill="#d6dcc6"/><rect x="268" y="238" width="62.08" height="6" rx="3.0" fill="#d6dcc6"/><rect x="268" y="254" width="48.0" height="6" rx="3.0" fill="#d6dcc6"/><rect x="268" y="270" width="59.52" height="6" rx="3.0" fill="#d6dcc6"/><rect x="268" y="286" width="51.2" height="6" rx="3.0" fill="#d6dcc6"/><rect x="268" y="302" width="57.6" height="6" rx="3.0" fill="#d6dcc6"/></g><g transform="rotate(-8 220 224)" filter="url(#image-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#image-paper)"/><rect x="160" y="142" width="120" height="46" rx="9" fill="#d6dcc6"/><path d="M160 179.7 L190.0 158.1 L208.0 170.5 L223.6 161.3 L280 184.3 V179.0 Q280 188 271.0 188 H169.0 Q160 188 160 179.0 Z" fill="#a7b38c"/><circle cx="256.0" cy="155.8" r="6.0" fill="#fdfdf8"/><rect x="160" y="200" width="120" height="6" rx="3.0" fill="#d6dcc6"/><rect x="160" y="217" width="104.4" height="6" rx="3.0" fill="#d6dcc6"/><rect x="160" y="234" width="116.39999999999999" height="6" rx="3.0" fill="#d6dcc6"/><rect x="160" y="251" width="90.0" height="6" rx="3.0" fill="#d6dcc6"/><rect x="160" y="268" width="111.60000000000001" height="6" rx="3.0" fill="#d6dcc6"/><rect x="160" y="285" width="96.0" height="6" rx="3.0" fill="#d6dcc6"/><rect x="160" y="302" width="108.0" height="6" rx="3.0" fill="#d6dcc6"/><rect x="160" y="319" width="99.6" height="6" rx="3.0" fill="#d6dcc6"/></g></g>
+ <g mask="url(#image-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#image-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#e6eadb" opacity=".18"/>
+ <g filter="url(#image-frost)"><use href="#image-panel" fill="url(#image-back)"/><use href="#image-contents"/></g>
+ <use href="#image-front" fill="url(#image-glass)"/>
+ <use href="#image-front" fill="url(#image-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#image-grain)"/>
+ <use href="#image-front" fill="url(#image-spot)"/>
+ <use href="#image-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#image-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#image-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/pdf.png b/resources/file-icons/pdf.png
deleted file mode 100644
index 5a2780f..0000000
Binary files a/resources/file-icons/pdf.png and /dev/null differ
diff --git a/resources/file-icons/pdf.svg b/resources/file-icons/pdf.svg
new file mode 100644
index 0000000..f890a1f
--- /dev/null
+++ b/resources/file-icons/pdf.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="PDF file icon"><defs>
+ <linearGradient id="pdf-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8e2c33"/><stop offset="1" stop-color="#5a141a"/></linearGradient>
+ <linearGradient id="pdf-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="pdf-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fbf3eb"/><stop offset="1" stop-color="#eee0d2"/></linearGradient>
+ <linearGradient id="pdf-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f6ece6" stop-opacity="0.56"/><stop offset=".5" stop-color="#d9bcb8" stop-opacity="0.46"/><stop offset="1" stop-color="#6a1d24" stop-opacity="0.82"/></linearGradient>
+ <linearGradient id="pdf-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="pdf-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="pdf-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="pdf-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="pdf-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="pdf-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#pdf-front" fill="#fff"/></mask>
+ <filter id="pdf-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="pdf-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="pdf-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="pdf-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="pdf-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="pdf-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="pdf-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#5a141a" flood-opacity=".22"/></filter>
+ <filter id="pdf-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#5a141a" opacity=".32" filter="url(#pdf-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#5a141a" opacity=".28" filter="url(#pdf-sht)"/>
+ <use href="#pdf-panel" fill="url(#pdf-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#pdf-backlight)"/>
+ <g id="pdf-contents"><g transform="rotate(8 341 240)" filter="url(#pdf-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#pdf-paper)"/><rect x="318" y="186" width="33.599999999999994" height="9.5" rx="4.75" fill="#ad8580"/><rect x="318" y="206" width="20.16" height="24" rx="5.04" fill="#ad8580" opacity=".55"/><rect x="342.0" y="206.0" width="24.0" height="5" rx="2.5" fill="#d2b2ab"/><rect x="342.0" y="215.0" width="20.16" height="5" rx="2.5" fill="#d2b2ab"/><rect x="342.0" y="224.0" width="24.0" height="5" rx="2.5" fill="#d2b2ab"/><rect x="318" y="242" width="48" height="6" rx="3.0" fill="#d2b2ab"/><rect x="318" y="258" width="41.76" height="6" rx="3.0" fill="#d2b2ab"/><rect x="318" y="274" width="46.56" height="6" rx="3.0" fill="#d2b2ab"/><rect x="318" y="290" width="36.0" height="6" rx="3.0" fill="#d2b2ab"/><rect x="318" y="306" width="44.64" height="6" rx="3.0" fill="#d2b2ab"/></g><g transform="rotate(5 300 226)" filter="url(#pdf-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#pdf-paper)"/><rect x="268" y="162" width="44.8" height="9.5" rx="4.75" fill="#ad8580"/><rect x="268" y="182" width="26.88" height="24" rx="5.04" fill="#ad8580" opacity=".55"/><rect x="300.0" y="182.0" width="32.0" height="5" rx="2.5" fill="#d2b2ab"/><rect x="300.0" y="191.0" width="26.88" height="5" rx="2.5" fill="#d2b2ab"/><rect x="300.0" y="200.0" width="32.0" height="5" rx="2.5" fill="#d2b2ab"/><rect x="268" y="218" width="64" height="6" rx="3.0" fill="#d2b2ab"/><rect x="268" y="234" width="55.68" height="6" rx="3.0" fill="#d2b2ab"/><rect x="268" y="250" width="62.08" height="6" rx="3.0" fill="#d2b2ab"/><rect x="268" y="266" width="48.0" height="6" rx="3.0" fill="#d2b2ab"/><rect x="268" y="282" width="59.52" height="6" rx="3.0" fill="#d2b2ab"/><rect x="268" y="298" width="51.2" height="6" rx="3.0" fill="#d2b2ab"/></g><g transform="rotate(-8 220 224)" filter="url(#pdf-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#pdf-paper)"/><rect x="160" y="144" width="84.0" height="11" rx="5.5" fill="#ad8580"/><rect x="160" y="164" width="50.4" height="34" rx="7" fill="#ad8580" opacity=".55"/><rect x="220.0" y="164.0" width="60.0" height="6" rx="3.0" fill="#d2b2ab"/><rect x="220.0" y="178.0" width="50.4" height="6" rx="3.0" fill="#d2b2ab"/><rect x="220.0" y="192.0" width="60.0" height="6" rx="3.0" fill="#d2b2ab"/><rect x="160" y="210" width="120" height="6" rx="3.0" fill="#d2b2ab"/><rect x="160" y="227" width="104.4" height="6" rx="3.0" fill="#d2b2ab"/><rect x="160" y="244" width="116.39999999999999" height="6" rx="3.0" fill="#d2b2ab"/><rect x="160" y="261" width="90.0" height="6" rx="3.0" fill="#d2b2ab"/><rect x="160" y="278" width="111.60000000000001" height="6" rx="3.0" fill="#d2b2ab"/><rect x="160" y="295" width="96.0" height="6" rx="3.0" fill="#d2b2ab"/><rect x="160" y="312" width="108.0" height="6" rx="3.0" fill="#d2b2ab"/></g></g>
+ <g mask="url(#pdf-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#pdf-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#efe3dd" opacity=".18"/>
+ <g filter="url(#pdf-frost)"><use href="#pdf-panel" fill="url(#pdf-back)"/><use href="#pdf-contents"/></g>
+ <use href="#pdf-front" fill="url(#pdf-glass)"/>
+ <use href="#pdf-front" fill="url(#pdf-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#pdf-grain)"/>
+ <use href="#pdf-front" fill="url(#pdf-spot)"/>
+ <use href="#pdf-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#pdf-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#pdf-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/powerpoint.png b/resources/file-icons/powerpoint.png
deleted file mode 100644
index aa2adec..0000000
Binary files a/resources/file-icons/powerpoint.png and /dev/null differ
diff --git a/resources/file-icons/powerpoint.svg b/resources/file-icons/powerpoint.svg
new file mode 100644
index 0000000..18127b3
--- /dev/null
+++ b/resources/file-icons/powerpoint.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Slides file icon"><defs>
+ <linearGradient id="powerpoint-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b85a3c"/><stop offset="1" stop-color="#6e2c19"/></linearGradient>
+ <linearGradient id="powerpoint-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="powerpoint-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fffaf6"/><stop offset="1" stop-color="#f3e6dc"/></linearGradient>
+ <linearGradient id="powerpoint-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fbefe7" stop-opacity="0.55"/><stop offset=".5" stop-color="#e0b39d" stop-opacity="0.45"/><stop offset="1" stop-color="#742f1b" stop-opacity="0.82"/></linearGradient>
+ <linearGradient id="powerpoint-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="powerpoint-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="powerpoint-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="powerpoint-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="powerpoint-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="powerpoint-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#powerpoint-front" fill="#fff"/></mask>
+ <filter id="powerpoint-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="powerpoint-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="powerpoint-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="powerpoint-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="powerpoint-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="powerpoint-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="powerpoint-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#6e2c19" flood-opacity=".22"/></filter>
+ <filter id="powerpoint-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#6e2c19" opacity=".32" filter="url(#powerpoint-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#6e2c19" opacity=".28" filter="url(#powerpoint-sht)"/>
+ <use href="#powerpoint-panel" fill="url(#powerpoint-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#powerpoint-backlight)"/>
+ <g id="powerpoint-contents"><g transform="rotate(8 341 240)" filter="url(#powerpoint-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#powerpoint-paper)"/><rect x="318" y="188" width="24.0" height="9.5" rx="4.75" fill="#cf8f72"/><rect x="318" y="208" width="18.240000000000002" height="6" rx="3" fill="#e6c8b8"/><rect x="334" y="203.83999999999997" width="5" height="8.64" rx="2.5" fill="#e6c8b8"/><rect x="343" y="198.07999999999998" width="5" height="14.399999999999999" rx="2.5" fill="#e6c8b8"/><rect x="352" y="200.95999999999998" width="5" height="11.52" rx="2.5" fill="#e6c8b8"/><rect x="361" y="192.32" width="5" height="20.16" rx="2.5" fill="#cf8f72"/><rect x="318" y="231.44" width="48" height="6" rx="3.0" fill="#e6c8b8"/><rect x="318" y="247.44" width="41.76" height="6" rx="3.0" fill="#e6c8b8"/><rect x="318" y="263.44" width="46.56" height="6" rx="3.0" fill="#e6c8b8"/><rect x="318" y="279.44" width="36.0" height="6" rx="3.0" fill="#e6c8b8"/><rect x="318" y="295.44" width="44.64" height="6" rx="3.0" fill="#e6c8b8"/></g><g transform="rotate(5 300 226)" filter="url(#powerpoint-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#powerpoint-paper)"/><rect x="268" y="164" width="32.0" height="9.5" rx="4.75" fill="#cf8f72"/><rect x="268" y="184" width="24.32" height="6" rx="3" fill="#e6c8b8"/><rect x="300" y="179.83999999999997" width="5" height="8.64" rx="2.5" fill="#e6c8b8"/><rect x="309" y="174.07999999999998" width="5" height="14.399999999999999" rx="2.5" fill="#e6c8b8"/><rect x="318" y="176.95999999999998" width="5" height="11.52" rx="2.5" fill="#e6c8b8"/><rect x="327" y="168.32" width="5" height="20.16" rx="2.5" fill="#cf8f72"/><rect x="268" y="207.44" width="64" height="6" rx="3.0" fill="#e6c8b8"/><rect x="268" y="223.44" width="55.68" height="6" rx="3.0" fill="#e6c8b8"/><rect x="268" y="239.44" width="62.08" height="6" rx="3.0" fill="#e6c8b8"/><rect x="268" y="255.44" width="48.0" height="6" rx="3.0" fill="#e6c8b8"/><rect x="268" y="271.44" width="59.52" height="6" rx="3.0" fill="#e6c8b8"/><rect x="268" y="287.44" width="51.2" height="6" rx="3.0" fill="#e6c8b8"/><rect x="268" y="303.44" width="57.6" height="6" rx="3.0" fill="#e6c8b8"/></g><g transform="rotate(-8 220 224)" filter="url(#powerpoint-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#powerpoint-paper)"/><rect x="160" y="146" width="60.0" height="11" rx="5.5" fill="#cf8f72"/><rect x="160" y="166" width="45.6" height="6" rx="3" fill="#e6c8b8"/><rect x="240" y="168" width="7" height="12" rx="3.5" fill="#e6c8b8"/><rect x="251" y="160" width="7" height="20" rx="3.5" fill="#e6c8b8"/><rect x="262" y="164" width="7" height="16" rx="3.5" fill="#e6c8b8"/><rect x="273" y="152" width="7" height="28" rx="3.5" fill="#cf8f72"/><rect x="160" y="204" width="120" height="6" rx="3.0" fill="#e6c8b8"/><rect x="160" y="221" width="104.4" height="6" rx="3.0" fill="#e6c8b8"/><rect x="160" y="238" width="116.39999999999999" height="6" rx="3.0" fill="#e6c8b8"/><rect x="160" y="255" width="90.0" height="6" rx="3.0" fill="#e6c8b8"/><rect x="160" y="272" width="111.60000000000001" height="6" rx="3.0" fill="#e6c8b8"/><rect x="160" y="289" width="96.0" height="6" rx="3.0" fill="#e6c8b8"/><rect x="160" y="306" width="108.0" height="6" rx="3.0" fill="#e6c8b8"/></g></g>
+ <g mask="url(#powerpoint-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#powerpoint-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#f3e1d7" opacity=".18"/>
+ <g filter="url(#powerpoint-frost)"><use href="#powerpoint-panel" fill="url(#powerpoint-back)"/><use href="#powerpoint-contents"/></g>
+ <use href="#powerpoint-front" fill="url(#powerpoint-glass)"/>
+ <use href="#powerpoint-front" fill="url(#powerpoint-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#powerpoint-grain)"/>
+ <use href="#powerpoint-front" fill="url(#powerpoint-spot)"/>
+ <use href="#powerpoint-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#powerpoint-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#powerpoint-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/text.png b/resources/file-icons/text.png
deleted file mode 100644
index 609dad9..0000000
Binary files a/resources/file-icons/text.png and /dev/null differ
diff --git a/resources/file-icons/text.svg b/resources/file-icons/text.svg
new file mode 100644
index 0000000..e462fc6
--- /dev/null
+++ b/resources/file-icons/text.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Text file icon"><defs>
+ <linearGradient id="text-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7b736b"/><stop offset="1" stop-color="#3d3732"/></linearGradient>
+ <linearGradient id="text-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="text-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fdfbf8"/><stop offset="1" stop-color="#efebe5"/></linearGradient>
+ <linearGradient id="text-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f5f2ee" stop-opacity="0.55"/><stop offset=".5" stop-color="#c9c1b7" stop-opacity="0.45"/><stop offset="1" stop-color="#403a34" stop-opacity="0.84"/></linearGradient>
+ <linearGradient id="text-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="text-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="text-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="text-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="text-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="text-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#text-front" fill="#fff"/></mask>
+ <filter id="text-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="text-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="text-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="text-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="text-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="text-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="text-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#3d3732" flood-opacity=".22"/></filter>
+ <filter id="text-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#3d3732" opacity=".32" filter="url(#text-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#3d3732" opacity=".28" filter="url(#text-sht)"/>
+ <use href="#text-panel" fill="url(#text-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#text-backlight)"/>
+ <g id="text-contents"><g transform="rotate(8 341 240)" filter="url(#text-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#text-paper)"/><rect x="328" y="178" width="1.8" height="138" rx="0.9" fill="#b2a99d" opacity=".7"/><circle cx="321.0" cy="191.0" r="2" fill="#b2a99d"/><circle cx="321.0" cy="207.0" r="2" fill="#b2a99d"/><circle cx="321.0" cy="223.0" r="2" fill="#b2a99d"/><circle cx="321.0" cy="239.0" r="2" fill="#b2a99d"/><circle cx="321.0" cy="255.0" r="2" fill="#b2a99d"/><circle cx="321.0" cy="271.0" r="2" fill="#b2a99d"/><circle cx="321.0" cy="287.0" r="2" fill="#b2a99d"/><circle cx="321.0" cy="303.0" r="2" fill="#b2a99d"/><rect x="334" y="188" width="30" height="6" rx="3.0" fill="#d6d0c7"/><rect x="334" y="204" width="26.1" height="6" rx="3.0" fill="#d6d0c7"/><rect x="334" y="220" width="29.099999999999998" height="6" rx="3.0" fill="#d6d0c7"/><rect x="334" y="236" width="22.5" height="6" rx="3.0" fill="#d6d0c7"/><rect x="334" y="252" width="27.900000000000002" height="6" rx="3.0" fill="#d6d0c7"/><rect x="334" y="268" width="24.0" height="6" rx="3.0" fill="#d6d0c7"/><rect x="334" y="284" width="27.0" height="6" rx="3.0" fill="#d6d0c7"/><rect x="334" y="300" width="24.9" height="6" rx="3.0" fill="#d6d0c7"/></g><g transform="rotate(5 300 226)" filter="url(#text-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#text-paper)"/><rect x="278" y="154" width="1.8" height="160" rx="0.9" fill="#b2a99d" opacity=".7"/><circle cx="271.0" cy="167.0" r="2" fill="#b2a99d"/><circle cx="271.0" cy="183.0" r="2" fill="#b2a99d"/><circle cx="271.0" cy="199.0" r="2" fill="#b2a99d"/><circle cx="271.0" cy="215.0" r="2" fill="#b2a99d"/><circle cx="271.0" cy="231.0" r="2" fill="#b2a99d"/><circle cx="271.0" cy="247.0" r="2" fill="#b2a99d"/><circle cx="271.0" cy="263.0" r="2" fill="#b2a99d"/><circle cx="271.0" cy="279.0" r="2" fill="#b2a99d"/><circle cx="271.0" cy="295.0" r="2" fill="#b2a99d"/><rect x="284" y="164" width="46" height="6" rx="3.0" fill="#d6d0c7"/><rect x="284" y="180" width="40.02" height="6" rx="3.0" fill="#d6d0c7"/><rect x="284" y="196" width="44.62" height="6" rx="3.0" fill="#d6d0c7"/><rect x="284" y="212" width="34.5" height="6" rx="3.0" fill="#d6d0c7"/><rect x="284" y="228" width="42.78" height="6" rx="3.0" fill="#d6d0c7"/><rect x="284" y="244" width="36.800000000000004" height="6" rx="3.0" fill="#d6d0c7"/><rect x="284" y="260" width="41.4" height="6" rx="3.0" fill="#d6d0c7"/><rect x="284" y="276" width="38.18" height="6" rx="3.0" fill="#d6d0c7"/><rect x="284" y="292" width="46" height="6" rx="3.0" fill="#d6d0c7"/></g><g transform="rotate(-8 220 224)" filter="url(#text-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#text-paper)"/><rect x="174" y="136" width="1.8" height="194" rx="0.9" fill="#b2a99d" opacity=".7"/><circle cx="163.0" cy="149.0" r="2.6" fill="#b2a99d"/><circle cx="163.0" cy="166.0" r="2.6" fill="#b2a99d"/><circle cx="163.0" cy="183.0" r="2.6" fill="#b2a99d"/><circle cx="163.0" cy="200.0" r="2.6" fill="#b2a99d"/><circle cx="163.0" cy="217.0" r="2.6" fill="#b2a99d"/><circle cx="163.0" cy="234.0" r="2.6" fill="#b2a99d"/><circle cx="163.0" cy="251.0" r="2.6" fill="#b2a99d"/><circle cx="163.0" cy="268.0" r="2.6" fill="#b2a99d"/><circle cx="163.0" cy="285.0" r="2.6" fill="#b2a99d"/><circle cx="163.0" cy="302.0" r="2.6" fill="#b2a99d"/><circle cx="163.0" cy="319.0" r="2.6" fill="#b2a99d"/><rect x="182" y="146" width="98" height="6" rx="3.0" fill="#d6d0c7"/><rect x="182" y="163" width="85.26" height="6" rx="3.0" fill="#d6d0c7"/><rect x="182" y="180" width="95.06" height="6" rx="3.0" fill="#d6d0c7"/><rect x="182" y="197" width="73.5" height="6" rx="3.0" fill="#d6d0c7"/><rect x="182" y="214" width="91.14" height="6" rx="3.0" fill="#d6d0c7"/><rect x="182" y="231" width="78.4" height="6" rx="3.0" fill="#d6d0c7"/><rect x="182" y="248" width="88.2" height="6" rx="3.0" fill="#d6d0c7"/><rect x="182" y="265" width="81.33999999999999" height="6" rx="3.0" fill="#d6d0c7"/><rect x="182" y="282" width="98" height="6" rx="3.0" fill="#d6d0c7"/><rect x="182" y="299" width="85.26" height="6" rx="3.0" fill="#d6d0c7"/><rect x="182" y="316" width="95.06" height="6" rx="3.0" fill="#d6d0c7"/></g></g>
+ <g mask="url(#text-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#text-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#ebe6df" opacity=".18"/>
+ <g filter="url(#text-frost)"><use href="#text-panel" fill="url(#text-back)"/><use href="#text-contents"/></g>
+ <use href="#text-front" fill="url(#text-glass)"/>
+ <use href="#text-front" fill="url(#text-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#text-grain)"/>
+ <use href="#text-front" fill="url(#text-spot)"/>
+ <use href="#text-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#text-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#text-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/video.png b/resources/file-icons/video.png
deleted file mode 100644
index 5831fb6..0000000
Binary files a/resources/file-icons/video.png and /dev/null differ
diff --git a/resources/file-icons/video.svg b/resources/file-icons/video.svg
new file mode 100644
index 0000000..469a243
--- /dev/null
+++ b/resources/file-icons/video.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Video file icon"><defs>
+ <linearGradient id="video-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#6a43a0"/><stop offset="1" stop-color="#321b57"/></linearGradient>
+ <linearGradient id="video-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="video-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#efeafa"/></linearGradient>
+ <linearGradient id="video-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#efe9fb" stop-opacity="0.52"/><stop offset=".5" stop-color="#bba9e2" stop-opacity="0.42"/><stop offset="1" stop-color="#351d5c" stop-opacity="0.84"/></linearGradient>
+ <linearGradient id="video-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="video-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="video-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="video-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="video-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="video-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#video-front" fill="#fff"/></mask>
+ <filter id="video-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="video-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="video-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="video-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="video-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="video-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="video-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#321b57" flood-opacity=".22"/></filter>
+ <filter id="video-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#321b57" opacity=".32" filter="url(#video-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#321b57" opacity=".28" filter="url(#video-sht)"/>
+ <use href="#video-panel" fill="url(#video-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#video-backlight)"/>
+ <g id="video-contents"><g transform="rotate(8 341 240)" filter="url(#video-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#video-paper)"/><rect x="318" y="184" width="48" height="34" rx="6.4799999999999995" fill="#d4c9ec"/><path d="M337.1 195.2 L348.0 201.0 L337.1 206.8 Z" fill="#ffffff" stroke="#ffffff" stroke-width="2.9" stroke-linejoin="round"/><rect x="318" y="230" width="48" height="6" rx="3.0" fill="#d4c9ec"/><rect x="318" y="246" width="41.76" height="6" rx="3.0" fill="#d4c9ec"/><rect x="318" y="262" width="46.56" height="6" rx="3.0" fill="#d4c9ec"/><rect x="318" y="278" width="36.0" height="6" rx="3.0" fill="#d4c9ec"/><rect x="318" y="294" width="44.64" height="6" rx="3.0" fill="#d4c9ec"/></g><g transform="rotate(5 300 226)" filter="url(#video-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#video-paper)"/><rect x="268" y="160" width="64" height="34" rx="6.4799999999999995" fill="#d4c9ec"/><path d="M295.1 171.2 L306.0 177.0 L295.1 182.8 Z" fill="#ffffff" stroke="#ffffff" stroke-width="2.9" stroke-linejoin="round"/><rect x="268" y="206" width="64" height="6" rx="3.0" fill="#d4c9ec"/><rect x="268" y="222" width="55.68" height="6" rx="3.0" fill="#d4c9ec"/><rect x="268" y="238" width="62.08" height="6" rx="3.0" fill="#d4c9ec"/><rect x="268" y="254" width="48.0" height="6" rx="3.0" fill="#d4c9ec"/><rect x="268" y="270" width="59.52" height="6" rx="3.0" fill="#d4c9ec"/><rect x="268" y="286" width="51.2" height="6" rx="3.0" fill="#d4c9ec"/><rect x="268" y="302" width="57.6" height="6" rx="3.0" fill="#d4c9ec"/></g><g transform="rotate(-8 220 224)" filter="url(#video-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#video-paper)"/><rect x="160" y="142" width="120" height="46" rx="9" fill="#d4c9ec"/><path d="M213.2 157.0 L228.4 165.0 L213.2 173.0 Z" fill="#ffffff" stroke="#ffffff" stroke-width="4.0" stroke-linejoin="round"/><rect x="160" y="200" width="120" height="6" rx="3.0" fill="#d4c9ec"/><rect x="160" y="217" width="104.4" height="6" rx="3.0" fill="#d4c9ec"/><rect x="160" y="234" width="116.39999999999999" height="6" rx="3.0" fill="#d4c9ec"/><rect x="160" y="251" width="90.0" height="6" rx="3.0" fill="#d4c9ec"/><rect x="160" y="268" width="111.60000000000001" height="6" rx="3.0" fill="#d4c9ec"/><rect x="160" y="285" width="96.0" height="6" rx="3.0" fill="#d4c9ec"/><rect x="160" y="302" width="108.0" height="6" rx="3.0" fill="#d4c9ec"/><rect x="160" y="319" width="99.6" height="6" rx="3.0" fill="#d4c9ec"/></g></g>
+ <g mask="url(#video-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#video-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#e3dbf3" opacity=".18"/>
+ <g filter="url(#video-frost)"><use href="#video-panel" fill="url(#video-back)"/><use href="#video-contents"/></g>
+ <use href="#video-front" fill="url(#video-glass)"/>
+ <use href="#video-front" fill="url(#video-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#video-grain)"/>
+ <use href="#video-front" fill="url(#video-spot)"/>
+ <use href="#video-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#video-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#video-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/resources/file-icons/word.png b/resources/file-icons/word.png
deleted file mode 100644
index b11cf22..0000000
Binary files a/resources/file-icons/word.png and /dev/null differ
diff --git a/resources/file-icons/word.svg b/resources/file-icons/word.svg
new file mode 100644
index 0000000..cbb2d51
--- /dev/null
+++ b/resources/file-icons/word.svg
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="64 60 384 384" width="384" height="384" role="img" aria-label="Word file icon"><defs>
+ <linearGradient id="word-back" x1="0" y1="118" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#34609f"/><stop offset="1" stop-color="#16305e"/></linearGradient>
+ <linearGradient id="word-backlight" x1="0" y1="118" x2="0" y2="230" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".16"/><stop offset=".35" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
+ <linearGradient id="word-paper" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#eaf0f8"/></linearGradient>
+ <linearGradient id="word-glass" x1="0" y1="180" x2="0" y2="364" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e6eefa" stop-opacity="0.52"/><stop offset=".5" stop-color="#a9bddc" stop-opacity="0.42"/><stop offset="1" stop-color="#183463" stop-opacity="0.84"/></linearGradient>
+ <linearGradient id="word-sheen" x1="104" y1="0" x2="408" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".24"/><stop offset=".3" stop-color="#fff" stop-opacity="0"/><stop offset=".78" stop-color="#fff" stop-opacity=".03"/><stop offset="1" stop-color="#fff" stop-opacity=".16"/></linearGradient>
+ <radialGradient id="word-spot" cx="170" cy="200" r="190" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff" stop-opacity=".22"/><stop offset=".55" stop-color="#fff" stop-opacity=".05"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
+ <path id="word-front" d="M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z"/>
+ <path id="word-top" d="M105 198 C104 187 112 180 124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C401 224 409 231 408 242"/>
+ <rect id="word-panel" x="120" y="118" width="272" height="246" rx="24"/>
+ <mask id="word-mask" maskUnits="userSpaceOnUse" x="90" y="170" width="332" height="210"><use href="#word-front" fill="#fff"/></mask>
+ <filter id="word-frost" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="word-edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3.5"/></filter>
+ <filter id="word-soft" x="-20%" y="-60%" width="140%" height="220%"><feGaussianBlur stdDeviation="5"/></filter>
+ <filter id="word-etch" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="1.2"/></filter>
+ <filter id="word-shw" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="11"/></filter>
+ <filter id="word-sht" x="-30%" y="-200%" width="160%" height="500%"><feGaussianBlur stdDeviation="4"/></filter>
+ <filter id="word-pshadow" x="-25%" y="-20%" width="150%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="4" flood-color="#16305e" flood-opacity=".22"/></filter>
+ <filter id="word-grain" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" seed="7" stitchTiles="stitch"/><feColorMatrix type="matrix" values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .08"/></filter>
+</defs>
+ <g transform="translate(0 14)">
+ <ellipse cx="256" cy="368" rx="150" ry="15" fill="#16305e" opacity=".32" filter="url(#word-shw)"/>
+ <ellipse cx="256" cy="364" rx="134" ry="6" fill="#16305e" opacity=".28" filter="url(#word-sht)"/>
+ <use href="#word-panel" fill="url(#word-back)"/>
+ <rect x="120" y="118" width="272" height="246" rx="24" fill="url(#word-backlight)"/>
+ <g id="word-contents"><g transform="rotate(8 341 240)" filter="url(#word-pshadow)"><rect x="300" y="165" width="82" height="150" rx="13" fill="url(#word-paper)"/><rect x="326.64" y="186" width="30.72" height="9.5" rx="4.75" fill="#8ea8d0"/><rect x="332.4" y="204" width="19.200000000000003" height="6" rx="3" fill="#c2d0e6"/><rect x="318" y="222" width="48" height="6" rx="3.0" fill="#c2d0e6"/><rect x="318" y="236" width="48" height="6" rx="3.0" fill="#c2d0e6"/><rect x="318" y="250" width="48" height="6" rx="3.0" fill="#c2d0e6"/><rect x="318" y="264" width="29.759999999999998" height="6" rx="3.0" fill="#c2d0e6"/><rect x="318" y="286" width="48" height="6" rx="3.0" fill="#c2d0e6"/><rect x="318" y="302" width="41.76" height="6" rx="3.0" fill="#c2d0e6"/></g><g transform="rotate(5 300 226)" filter="url(#word-pshadow)"><rect x="252" y="140" width="96" height="172" rx="14" fill="url(#word-paper)"/><rect x="279.52" y="162" width="40.96" height="9.5" rx="4.75" fill="#8ea8d0"/><rect x="287.2" y="180" width="25.6" height="6" rx="3" fill="#c2d0e6"/><rect x="268" y="198" width="64" height="6" rx="3.0" fill="#c2d0e6"/><rect x="268" y="212" width="64" height="6" rx="3.0" fill="#c2d0e6"/><rect x="268" y="226" width="64" height="6" rx="3.0" fill="#c2d0e6"/><rect x="268" y="240" width="39.68" height="6" rx="3.0" fill="#c2d0e6"/><rect x="268" y="262" width="64" height="6" rx="3.0" fill="#c2d0e6"/><rect x="268" y="278" width="55.68" height="6" rx="3.0" fill="#c2d0e6"/><rect x="268" y="294" width="62.08" height="6" rx="3.0" fill="#c2d0e6"/></g><g transform="rotate(-8 220 224)" filter="url(#word-pshadow)"><rect x="140" y="122" width="160" height="204" rx="16" fill="url(#word-paper)"/><rect x="181.6" y="144" width="76.8" height="11" rx="5.5" fill="#8ea8d0"/><rect x="196.0" y="162" width="48.0" height="6" rx="3" fill="#c2d0e6"/><rect x="160" y="180" width="120" height="6" rx="3.0" fill="#c2d0e6"/><rect x="160" y="196" width="120" height="6" rx="3.0" fill="#c2d0e6"/><rect x="160" y="212" width="120" height="6" rx="3.0" fill="#c2d0e6"/><rect x="160" y="228" width="74.4" height="6" rx="3.0" fill="#c2d0e6"/><rect x="160" y="252" width="120" height="6" rx="3.0" fill="#c2d0e6"/><rect x="160" y="269" width="104.4" height="6" rx="3.0" fill="#c2d0e6"/><rect x="160" y="286" width="116.39999999999999" height="6" rx="3.0" fill="#c2d0e6"/><rect x="160" y="303" width="90.0" height="6" rx="3.0" fill="#c2d0e6"/><rect x="160" y="320" width="111.60000000000001" height="6" rx="3.0" fill="#c2d0e6"/></g></g>
+ <g mask="url(#word-mask)">
+ <rect x="96" y="172" width="320" height="200" fill="url(#word-back)"/>
+ <rect x="96" y="172" width="320" height="200" fill="#dbe5f3" opacity=".18"/>
+ <g filter="url(#word-frost)"><use href="#word-panel" fill="url(#word-back)"/><use href="#word-contents"/></g>
+ <use href="#word-front" fill="url(#word-glass)"/>
+ <use href="#word-front" fill="url(#word-sheen)"/>
+ <rect x="96" y="172" width="320" height="200" filter="url(#word-grain)"/>
+ <use href="#word-front" fill="url(#word-spot)"/>
+ <use href="#word-top" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="10" filter="url(#word-edge)"/>
+ <ellipse cx="256" cy="372" rx="150" ry="14" fill="#fff" opacity=".16" filter="url(#word-soft)"/>
+ </g>
+ </g>
+</svg>
diff --git a/shared/bridge.ts b/shared/bridge.ts
index 770995b..99d9e51 100644
--- a/shared/bridge.ts
+++ b/shared/bridge.ts
@@ -30,7 +30,10 @@ export interface EdgeApi {
removeSubitem: (req: DragRequest) => Promise<boolean>
copyItem: (id: string) => Promise<boolean>
copySubitem: (req: DragRequest) => Promise<boolean>
- pasteItem: (id: string) => Promise<boolean>
+ pasteItem: (id: string, opts?: { plain?: boolean }) => Promise<boolean>
+ setItemMeta: (id: string, meta: import('./itemMeta').ItemMetaPatch) => Promise<import('./types').ClipboardItemDto[]>
+ copyText: (text: string) => Promise<boolean>
+ saveImages: (id: string) => Promise<string[]>
pasteSubitem: (req: DragRequest) => Promise<boolean>
pasteEmoji: (text: string) => Promise<boolean>
emojiGlyphs: (files: string[]) => Promise<Record<string, string>>
diff --git a/shared/ipc.ts b/shared/ipc.ts
index 30f8979..03536c8 100644
--- a/shared/ipc.ts
+++ b/shared/ipc.ts
@@ -44,8 +44,29 @@ export interface InvokeMap {
* collection) onto the system clipboard. */
'item:copy-subitem': { args: [req: DragRequest]; result: boolean }
- /** Copy an item and paste it directly into the active application. */
- 'item:paste': { args: [id: string]; result: boolean }
+ /**
+ * Copy an item and paste it directly into the active application.
+ * `plain` writes text items as plain text only (no html / table formatting).
+ */
+ 'item:paste': { args: [id: string, opts?: { plain?: boolean }]; result: boolean }
+
+ /**
+ * Set or clear an item's label / tags (normalized in main). Giving an item
+ * a label or tag also pins it. Returns the updated list.
+ */
+ 'item:set-meta': { args: [id: string, meta: import('./itemMeta').ItemMetaPatch]; result: ClipboardItemDto[] }
+
+ /**
+ * Put a derived piece of text on the clipboard (clean link, color in
+ * another format, file path) without adding it to history.
+ */
+ 'item:copy-text': { args: [text: string]; result: boolean }
+
+ /**
+ * Save an image item's original file(s) into the user's Downloads folder.
+ * Returns the saved file names (empty when nothing could be saved).
+ */
+ 'item:save-images': { args: [id: string]; result: string[] }
/** Copy a sub-item and paste it directly into the active application. */
'item:paste-subitem': { args: [req: DragRequest]; result: boolean }
diff --git a/shared/itemMeta.ts b/shared/itemMeta.ts
new file mode 100644
index 0000000..7d180dd
--- /dev/null
+++ b/shared/itemMeta.ts
@@ -0,0 +1,72 @@
+/**
+ * User-given metadata on a clipboard item: one short label and a few tags.
+ *
+ * Both are optional, live at the top level of the item (not inside `data`, so
+ * dedup, touch and the DTO keep them unchanged) and are searchable. The main
+ * process normalizes every write through these functions, so whatever the
+ * renderer sends, only clean values are ever stored.
+ */
+
+export const LABEL_MAX = 60
+export const TAG_MAX_LEN = 24
+export const TAGS_MAX = 5
+
+export interface ItemMetaPatch {
+ /** New label; empty / null removes it. Omitted keeps the current one. */
+ label?: string | null
+ /** New tag list; empty / null removes all. Omitted keeps the current ones. */
+ tags?: string[] | null
+}
+
+/** Cut a string to `max` characters without splitting a surrogate pair. */
+function clip(value: string, max: number): string {
+ const chars = Array.from(value)
+ return chars.length > max ? chars.slice(0, max).join('') : value
+}
+
+/**
+ * One line of plain text: control characters and runs of whitespace become a
+ * single space, trimmed, at most LABEL_MAX characters. Empty -> undefined.
+ */
+export function normalizeLabel(value: unknown): string | undefined {
+ if (typeof value !== 'string') return undefined
+ const flat = value.replace(/[\u0000-\u001f\u007f\s]+/g, ' ').trim()
+ const out = clip(flat, LABEL_MAX).trim()
+ return out || undefined
+}
+
+/**
+ * A tag is one lowercase word: a leading '#' is dropped, spaces become '-',
+ * and only letters, marks and numbers (any language) plus - _ . + are kept.
+ * At most TAG_MAX_LEN characters. Empty -> undefined.
+ */
+export function normalizeTag(value: unknown): string | undefined {
+ if (typeof value !== 'string') return undefined
+ let tag = value.trim().replace(/^#+/, '').toLowerCase()
+ tag = tag.replace(/\s+/g, '-').replace(/[^\p{L}\p{M}\p{N}_.+-]/gu, '')
+ tag = tag.replace(/-{2,}/g, '-').replace(/^[-.]+|[-.]+$/g, '')
+ tag = clip(tag, TAG_MAX_LEN).replace(/[-.]+$/g, '')
+ return tag || undefined
+}
+
+/** Clean, de-duplicated tags in their given order, at most TAGS_MAX. Empty -> undefined. */
+export function normalizeTags(value: unknown): string[] | undefined {
+ if (!Array.isArray(value)) return undefined
+ const out: string[] = []
+ for (const raw of value) {
+ const tag = normalizeTag(raw)
+ if (tag && !out.includes(tag)) out.push(tag)
+ if (out.length >= TAGS_MAX) break
+ }
+ return out.length > 0 ? out : undefined
+}
+
+/** Tags of `a` followed by the new ones of `b`, normalized and capped. */
+export function combineTags(a: readonly string[] | undefined, b: readonly string[] | undefined): string[] | undefined {
+ return normalizeTags([...(a ?? []), ...(b ?? [])])
+}
+
+/** True when the item carries a label or at least one tag. */
+export function hasItemMeta(item: { label?: string; tags?: readonly string[] }): boolean {
+ return !!item.label || (Array.isArray(item.tags) && item.tags.length > 0)
+}
diff --git a/shared/types.ts b/shared/types.ts
index 1d7757b..cbd4e55 100644
--- a/shared/types.ts
+++ b/shared/types.ts
@@ -85,6 +85,10 @@ export interface ClipboardItem {
hitCount: number
/** Pinned items never scroll off and survive app restarts. */
pinned: boolean
+ /** User-given short name (see shared/itemMeta.ts). Searchable. */
+ label?: string
+ /** User-given lowercase tags (see shared/itemMeta.ts). Searchable. */
+ tags?: string[]
}
/**
@@ -105,7 +109,7 @@ export interface FileEntry {
/** Payload sent over IPC: same as ClipboardItem but with inline image previews. */
export interface ClipboardItemDto extends Omit<ClipboardItem, 'data'> {
data:
- | { kind: 'text'; text: string; html?: string; isUrl: boolean; isColor?: boolean; hasFullPayload?: boolean; previewText?: string }
+ | { kind: 'text'; text: string; html?: string; isUrl: boolean; isColor?: boolean; hasFullPayload?: boolean; previewText?: string; hasHtml?: boolean }
| ({ kind: 'image'; preview: string } & ClipboardImageFields)
| { kind: 'image-collection'; images: Array<ClipboardImageFields & { preview: string }> }
| { kind: 'files'; paths: string[]; previews?: string[]; entries?: FileEntry[] }
diff --git a/src/components/CardMenu.tsx b/src/components/CardMenu.tsx
new file mode 100644
index 0000000..7be691a
--- /dev/null
+++ b/src/components/CardMenu.tsx
@@ -0,0 +1,746 @@
+/**
+ * CardMenu — the right-click menu of an item card, and the label / tags
+ * editor it turns into.
+ *
+ * One instance for the whole shelf (mounted next to the other flyouts),
+ * rendered only while open, so it costs nothing the rest of the time. It is
+ * portaled to <body> because the blade clips its children; the store keeps
+ * its on-screen box (cardMenuRect) so the hover-close logic treats it as part
+ * of the shelf.
+ *
+ * Placement: at the pointer, like a normal context menu, opening toward the
+ * middle of the screen (right of the pointer in the left / top dock, left of
+ * it in the right dock), flipped and clamped to stay inside the window. It
+ * may extend past the blade into the (already interactive) window area; the
+ * hover-close logic treats its box as part of the shelf.
+ *
+ * Closing: picking an action, a click or wheel outside (a click outside only
+ * dismisses, like a Windows menu, so it can never paste the card under it),
+ * Escape, the window changing size, the item disappearing, or the shelf
+ * closing (setOpen(false) clears it). While editing, clicking outside or
+ * switching to another app saves, Escape cancels. After the menu closes the
+ * shelf waits a moment before hover-closing (cardMenuStayUntil), so a
+ * pointer left outside the blade by the menu has time to come back.
+ */
+import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react'
+import { createPortal } from 'react-dom'
+import type { ClipboardItemDto } from '../../shared/types'
+import { LABEL_MAX, TAGS_MAX, TAG_MAX_LEN, hasItemMeta, normalizeLabel, normalizeTag } from '../../shared/itemMeta'
+import { useStore } from '../store/appStore'
+import { useTranslation } from '../i18n'
+import { edge } from '../lib/edge'
+import { tryPaste } from '../lib/tryPaste'
+import { colorFormats, type ColorFormat } from '../lib/colorUtils'
+import { externalHref, stripTracking } from '../lib/urlPreview'
+import { acquireKeyboard, releaseKeyboard } from '../lib/keyboardFocus'
+import { suggestTags, tagCounts } from '../lib/tagQuery'
+import { playCardExpandSound, playDeleteSound, playToggleSound } from '../lib/soundEffects'
+import {
+ CloseIcon,
+ CopyIcon,
+ DownloadIcon,
+ ExpandIcon,
+ ContractIcon,
+ ExternalLinkIcon,
+ FolderOpenIcon,
+ LinkIcon,
+ PaletteIcon,
+ PasteIcon,
+ PinFillIcon,
+ PinIcon,
+ TagIcon,
+ TrashIcon,
+ TypeIcon
+} from './icons'
+import '../styles/cardMenu.css'
+
+/** Keyboard-focus holder name for the label / tags editor. */
+const EDITOR_FOCUS_OWNER = 'card-meta'
+/** Space kept between the menu and the edge of its allowed area. */
+const EDGE_GAP = 8
+/** Gap between the pointer and the menu corner. */
+const POINTER_GAP = 2
+/** How long the shelf must stay unfocused before the editor treats it as an app switch. */
+const EDITOR_BLUR_GRACE_MS = 250
+
+export interface MenuRegion {
+ left: number
+ top: number
+ right: number
+ bottom: number
+}
+
+export interface MenuPlacement {
+ left: number
+ top: number
+ /** Corner the menu grows from (it opens away from the pointer). */
+ origin: 'top left' | 'top right' | 'bottom left' | 'bottom right'
+}
+
+/**
+ * Put a menu of `size` next to the pointer, below it and on the `prefer`
+ * side; flipped to the other side when it would cross the region, then
+ * clamped inside.
+ */
+export function placeMenu(
+ anchor: { x: number; y: number },
+ size: { w: number; h: number },
+ region: MenuRegion,
+ prefer: 'right' | 'left' = 'right'
+): MenuPlacement {
+ const rightOf = anchor.x + POINTER_GAP
+ const leftOf = anchor.x - size.w - POINTER_GAP
+ const fitsRight = rightOf + size.w <= region.right
+ const fitsLeft = leftOf >= region.left
+ const flipX = prefer === 'right' ? !fitsRight && fitsLeft : !(!fitsLeft && fitsRight)
+ let left = flipX ? leftOf : rightOf
+ // Neither side fits: keep the preferred side as close as the area allows.
+ if (!fitsRight && !fitsLeft) left = prefer === 'right' ? rightOf : leftOf
+ left = Math.min(Math.max(left, region.left), Math.max(region.left, region.right - size.w))
+
+ let top = anchor.y + POINTER_GAP
+ let flipY = false
+ if (top + size.h > region.bottom) {
+ top = anchor.y - size.h - POINTER_GAP
+ flipY = true
+ }
+ top = Math.min(Math.max(top, region.top), Math.max(region.top, region.bottom - size.h))
+
+ return {
+ left: Math.round(left),
+ top: Math.round(top),
+ origin: `${flipY ? 'bottom' : 'top'} ${flipX ? 'right' : 'left'}` as MenuPlacement['origin']
+ }
+}
+
+/**
+ * Where the menu may go: the whole window (side docks: the blade plus the
+ * transparent strip beside it). Top dock: the blade's width (the window has
+ * 30px gutters for the corner flares) and the full window height.
+ */
+function menuRegion(isHorizontal: boolean): MenuRegion {
+ const win = { left: EDGE_GAP, top: EDGE_GAP, right: window.innerWidth - EDGE_GAP, bottom: window.innerHeight - EDGE_GAP }
+ if (!isHorizontal) return win
+ const blade = document.querySelector('.blade')?.getBoundingClientRect()
+ if (!blade || blade.width <= 0) return win
+ return {
+ left: Math.max(win.left, blade.left + EDGE_GAP),
+ right: Math.min(win.right, blade.right - EDGE_GAP),
+ top: win.top,
+ bottom: win.bottom
+ }
+}
+
+/**
+ * Arm a one-shot click blocker: the click that follows a pointer-down used to
+ * dismiss the menu must not reach the card under it (that would paste). Lives
+ * outside the component because the menu unmounts before the click arrives.
+ */
+function swallowNextOutsideClick(): void {
+ const until = Date.now() + 700
+ const onClick = (e: MouseEvent) => {
+ document.removeEventListener('click', onClick, true)
+ if (Date.now() > until) return
+ const target = e.target as Element | null
+ if (target?.closest?.('.card-menu')) return
+ e.preventDefault()
+ e.stopPropagation()
+ }
+ document.addEventListener('click', onClick, true)
+ window.setTimeout(() => document.removeEventListener('click', onClick, true), 750)
+}
+
+function revealRect(itemId: string) {
+ const el = document.querySelector(`.item-main[data-id="${CSS.escape(itemId)}"]`)
+ const r = el?.getBoundingClientRect()
+ return r ? { x: r.x, y: r.y, width: r.width, height: r.height } : undefined
+}
+
+/** Full text of a text item (cards only hold the first 300 characters). */
+async function fullTextOf(item: ClipboardItemDto): Promise<string> {
+ if (item.data.kind !== 'text') return ''
+ if (!item.data.hasFullPayload) return item.data.text
+ try {
+ const full = await edge.getFullText(item.id)
+ return full || item.data.text
+ } catch {
+ return item.data.text
+ }
+}
+
+export function CardMenu() {
+ const menu = useStore((s) => s.cardMenu)
+ const item = useStore((s) => (s.cardMenu ? s.items.find((it) => it.id === s.cardMenu!.itemId) : undefined))
+ const stick = useStore((s) => s.settings.stickPosition)
+ const isHorizontal = stick === 'top'
+ // Open toward the middle of the screen.
+ const prefer: 'right' | 'left' = stick === 'right' ? 'left' : 'right'
+ const closeCardMenu = useStore((s) => s.closeCardMenu)
+ const boxRef = useRef<HTMLDivElement>(null)
+ const commitRef = useRef<(() => void) | null>(null)
+ const [placement, setPlacement] = useState<MenuPlacement | null>(null)
+
+ // The item was deleted / merged away (auto-delete, another window).
+ useEffect(() => {
+ if (menu && !item) closeCardMenu()
+ }, [menu, item, closeCardMenu])
+
+ // The editor's keyboard hold ends with edit mode (or a pointer-down on
+ // "Label & tags" that never became a click).
+ const editing = menu?.mode === 'edit'
+ useEffect(() => {
+ if (!editing) releaseKeyboard(EDITOR_FOCUS_OWNER)
+ }, [editing, menu])
+
+ /** Close; while editing, `save` keeps what was typed (outside click, app switch). */
+ const dismiss = useCallback((save: boolean) => {
+ const s = useStore.getState()
+ if (!s.cardMenu) return
+ if (save && s.cardMenu.mode === 'edit') commitRef.current?.()
+ useStore.getState().closeCardMenu()
+ }, [])
+
+ // Measure, place, and publish the box for hover-close. Re-runs when the
+ // content changes size (menu -> editor, chips wrapping).
+ useLayoutEffect(() => {
+ const el = boxRef.current
+ if (!menu || !el) {
+ setPlacement(null)
+ return
+ }
+ const place = () => {
+ const w = el.offsetWidth
+ const h = el.offsetHeight
+ const p = placeMenu({ x: menu.x, y: menu.y }, { w, h }, menuRegion(isHorizontal), prefer)
+ setPlacement((prev) => (prev && prev.left === p.left && prev.top === p.top && prev.origin === p.origin ? prev : p))
+ const r = { left: p.left, top: p.top, right: p.left + w, bottom: p.top + h }
+ const cur = useStore.getState().cardMenuRect
+ if (!cur || cur.left !== r.left || cur.top !== r.top || cur.right !== r.right || cur.bottom !== r.bottom) {
+ useStore.getState().setCardMenuRect(r)
+ }
+ }
+ place()
+ const ro = new ResizeObserver(place)
+ ro.observe(el)
+ return () => ro.disconnect()
+ }, [menu, isHorizontal, prefer])
+
+ // Outside interactions.
+ useEffect(() => {
+ if (!menu) return
+ const inside = (t: EventTarget | null) => t instanceof Element && !!t.closest('.card-menu')
+ const onPointerDown = (e: PointerEvent) => {
+ if (inside(e.target)) return
+ if (e.button === 0) swallowNextOutsideClick()
+ dismiss(true)
+ }
+ const onWheel = (e: WheelEvent) => {
+ if (!inside(e.target)) dismiss(true)
+ }
+ const onKeyDown = (e: KeyboardEvent) => {
+ if (e.key !== 'Escape') return
+ // Owns Escape while open: cancel the menu / editor, never the panel.
+ e.preventDefault()
+ e.stopPropagation()
+ dismiss(false)
+ }
+ // Only a real size change (dock switch, display change) closes the
+ // menu; Windows can fire resize for style-only updates when the shelf
+ // takes or returns keyboard focus.
+ const openSize = { w: window.innerWidth, h: window.innerHeight }
+ const onResize = () => {
+ if (window.innerWidth !== openSize.w || window.innerHeight !== openSize.h) dismiss(true)
+ }
+ // Switching to another app while typing keeps what was typed. Only a
+ // blur that lasts counts: a momentary focus blip during the keyboard
+ // hand-over must not close the editor.
+ let blurTimer: number | undefined
+ const onBlur = () => {
+ if (useStore.getState().cardMenu?.mode !== 'edit') return
+ window.clearTimeout(blurTimer)
+ blurTimer = window.setTimeout(() => {
+ if (!document.hasFocus() && useStore.getState().cardMenu?.mode === 'edit') dismiss(true)
+ }, EDITOR_BLUR_GRACE_MS)
+ }
+ document.addEventListener('pointerdown', onPointerDown, true)
+ document.addEventListener('wheel', onWheel, { capture: true, passive: true })
+ window.addEventListener('keydown', onKeyDown, true)
+ window.addEventListener('resize', onResize)
+ window.addEventListener('blur', onBlur)
+ return () => {
+ document.removeEventListener('pointerdown', onPointerDown, true)
+ document.removeEventListener('wheel', onWheel, { capture: true } as EventListenerOptions)
+ window.removeEventListener('keydown', onKeyDown, true)
+ window.removeEventListener('resize', onResize)
+ window.removeEventListener('blur', onBlur)
+ window.clearTimeout(blurTimer)
+ }
+ }, [menu, dismiss])
+
+ if (!menu || !item) return null
+
+ return createPortal(
+ <div
+ ref={boxRef}
+ className={`card-menu${editing ? ' is-editing' : ''}${placement ? ' is-placed' : ''}`}
+ role={editing ? 'dialog' : 'menu'}
+ style={{
+ left: placement?.left ?? 0,
+ top: placement?.top ?? 0,
+ transformOrigin: placement?.origin ?? 'top left'
+ }}
+ onContextMenu={(e) => e.preventDefault()}
+ >
+ {editing ? (
+ <MetaEditor
+ key={item.id}
+ item={item}
+ focus={menu.focus ?? 'label'}
+ commitRef={commitRef}
+ onDone={() => useStore.getState().closeCardMenu()}
+ />
+ ) : (
+ <MenuList item={item} />
+ )}
+ </div>,
+ document.body
+ )
+}
+
+/* ------------------------------------------------------------------ */
+/* Menu */
+/* ------------------------------------------------------------------ */
+
+function MenuRow({
+ icon,
+ label,
+ onSelect,
+ onPress,
+ danger
+}: {
+ icon: ReactNode
+ label: string
+ onSelect: () => void
+ onPress?: () => void
+ danger?: boolean
+}) {
+ return (
+ <button
+ type="button"
+ role="menuitem"
+ className={`card-menu-row${danger ? ' is-danger' : ''}`}
+ // Never take focus from a field the user may be typing in.
+ onMouseDown={(e) => e.preventDefault()}
+ onPointerDown={(e) => {
+ if (e.button === 0) onPress?.()
+ }}
+ onClick={(e) => {
+ e.stopPropagation()
+ onSelect()
+ }}
+ >
+ <span className="card-menu-icon" aria-hidden="true">{icon}</span>
+ <span className="card-menu-label">{label}</span>
+ </button>
+ )
+}
+
+function Separator() {
+ return <div className="card-menu-sep" role="separator" />
+}
+
+const FORMAT_LABEL: Record<ColorFormat, string> = { hex: 'HEX', rgb: 'RGB', hsl: 'HSL' }
+
+function MenuList({ item }: { item: ClipboardItemDto }) {
+ const { t } = useTranslation()
+ const isPreviewing = useStore((s) => s.previewItemId === item.id)
+ const close = () => useStore.getState().closeCardMenu()
+ const store = () => useStore.getState()
+
+ const d = item.data
+ const isText = d.kind === 'text'
+ const text = isText ? d.text : ''
+ const isLink = isText && d.isUrl
+ const colors = isText && !d.isUrl ? colorFormats(text) : null
+ const canPastePlain = isText && !colors && (!!d.hasHtml || text.includes('\t'))
+ const canCleanLink = isLink && (!!d.hasFullPayload || stripTracking(text) !== text.trim())
+ const isImage = d.kind === 'image' || d.kind === 'image-collection'
+ const filePaths = d.kind === 'files' ? d.paths : []
+ const named = hasItemMeta(item)
+
+ const copyText = (value: string) => {
+ void store().copyText(value)
+ close()
+ }
+
+ const typeRows: ReactNode[] = []
+ if (isLink) {
+ typeRows.push(
+ <MenuRow
+ key="open"
+ icon={<ExternalLinkIcon />}
+ label={t('menu.openLink')}
+ onSelect={() => {
+ close()
+ void fullTextOf(item).then((full) => window.open(externalHref(full), '_blank'))
+ }}
+ />
+ )
+ if (canCleanLink) {
+ typeRows.push(
+ <MenuRow
+ key="clean"
+ icon={<LinkIcon />}
+ label={t('menu.copyCleanLink')}
+ onSelect={() => {
+ close()
+ void fullTextOf(item).then((full) => store().copyText(stripTracking(full)))
+ }}
+ />
+ )
+ }
+ }
+ if (colors) {
+ const others = (['hex', 'rgb', 'hsl'] as const).filter((f) => f !== colors.source)
+ typeRows.push(
+ <div key="colors" className="card-menu-row card-menu-colors" role="group" aria-label={t('menu.copyAs')}>
+ <span className="card-menu-icon" aria-hidden="true"><PaletteIcon /></span>
+ <span className="card-menu-label">{t('menu.copyAs')}</span>
+ <span className="card-menu-chips">
+ {others.map((f) => (
+ <button
+ key={f}
+ type="button"
+ role="menuitem"
+ className="card-menu-chip"
+ title={colors[f]}
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={(e) => {
+ e.stopPropagation()
+ copyText(colors[f])
+ }}
+ >
+ {FORMAT_LABEL[f]}
+ </button>
+ ))}
+ </span>
+ </div>
+ )
+ }
+ if (filePaths.length > 0) {
+ typeRows.push(
+ <MenuRow
+ key="reveal"
+ icon={<FolderOpenIcon />}
+ label={t('menu.showInFolder')}
+ onSelect={() => {
+ close()
+ void edge.revealFile(filePaths[0]).then((ok) => {
+ if (!ok) store().pushToast({ id: `reveal-${Date.now()}`, message: t('toast.fileUnavailable'), tone: 'error' })
+ })
+ }}
+ />,
+ <MenuRow
+ key="path"
+ icon={<CopyIcon />}
+ label={filePaths.length > 1 ? t('menu.copyPaths') : t('menu.copyPath')}
+ onSelect={() => copyText(filePaths.join('\r\n'))}
+ />
+ )
+ }
+ if (isImage) {
+ typeRows.push(
+ <MenuRow
+ key="save"
+ icon={<DownloadIcon />}
+ label={t('menu.saveToDownloads')}
+ onSelect={() => {
+ close()
+ void store().saveImages(item.id)
+ }}
+ />
+ )
+ }
+
+ return (
+ <div className="card-menu-list" aria-label={t('menu.title')}>
+ <MenuRow
+ icon={<PasteIcon />}
+ label={t('menu.paste')}
+ onSelect={() => {
+ close()
+ tryPaste(() => void store().paste(item.id))
+ }}
+ />
+ {canPastePlain && (
+ <MenuRow
+ icon={<TypeIcon />}
+ label={t('menu.pastePlain')}
+ onSelect={() => {
+ close()
+ tryPaste(() => void store().paste(item.id, { plain: true }))
+ }}
+ />
+ )}
+ <MenuRow
+ icon={<CopyIcon />}
+ label={t('item.copy')}
+ onSelect={() => {
+ close()
+ void store().copy(item.id).then((ok) => {
+ if (ok) store().pushToast({ id: `copied-${Date.now()}`, message: t('toast.copiedToClipboard'), tone: 'info' })
+ })
+ }}
+ />
+ <Separator />
+ <MenuRow
+ icon={<TagIcon />}
+ label={named ? t('menu.editLabel') : t('menu.addLabel')}
+ // Borrow the keyboard on pointer-down: the shelf window may never
+ // see a focus event from a plain click (NOACTIVATE).
+ onPress={() => void acquireKeyboard(EDITOR_FOCUS_OWNER)}
+ onSelect={() => store().editCardMeta('label')}
+ />
+ <MenuRow
+ icon={item.pinned ? <PinFillIcon /> : <PinIcon />}
+ label={item.pinned ? t('item.unpin') : t('item.pin')}
+ onSelect={() => {
+ close()
+ playToggleSound(!item.pinned)
+ void store().togglePin(item.id, !item.pinned)
+ }}
+ />
+ {typeRows.length > 0 && <Separator />}
+ {typeRows}
+ <Separator />
+ <MenuRow
+ icon={isPreviewing ? <ContractIcon /> : <ExpandIcon />}
+ label={isPreviewing ? t('menu.closePreview') : t('menu.preview')}
+ onSelect={() => {
+ close()
+ playCardExpandSound(!isPreviewing)
+ store().setPreviewItemId(isPreviewing ? null : item.id, isPreviewing ? undefined : revealRect(item.id))
+ }}
+ />
+ <MenuRow
+ icon={<TrashIcon />}
+ label={t('item.delete')}
+ danger
+ onSelect={() => {
+ close()
+ playDeleteSound()
+ void store().remove(item.id)
+ }}
+ />
+ </div>
+ )
+}
+
+/* ------------------------------------------------------------------ */
+/* Label / tags editor */
+/* ------------------------------------------------------------------ */
+
+function MetaEditor({
+ item,
+ focus,
+ commitRef,
+ onDone
+}: {
+ item: ClipboardItemDto
+ focus: 'label' | 'tags'
+ commitRef: React.MutableRefObject<(() => void) | null>
+ onDone: () => void
+}) {
+ const { t } = useTranslation()
+ const [label, setLabel] = useState(item.label ?? '')
+ const [tags, setTags] = useState<string[]>(item.tags ?? [])
+ const [draft, setDraft] = useState('')
+ const labelRef = useRef<HTMLInputElement>(null)
+ const tagRef = useRef<HTMLInputElement>(null)
+ const items = useStore((s) => s.items)
+ const counts = useMemo(() => tagCounts(items), [items])
+ const suggestions = useMemo(
+ () => (tags.length < TAGS_MAX ? suggestTags(counts, draft, { exclude: tags, limit: 6 }) : []),
+ [counts, draft, tags]
+ )
+ const full = tags.length >= TAGS_MAX
+
+ // Hold the keyboard while the editor is open (acquired on the menu row's
+ // pointer-down already; this is a no-op then) and put the caret in.
+ useEffect(() => {
+ let alive = true
+ void acquireKeyboard(EDITOR_FOCUS_OWNER).then(() => {
+ if (!alive) return
+ const el = focus === 'tags' ? tagRef.current ?? labelRef.current : labelRef.current
+ try {
+ el?.focus()
+ el?.select?.()
+ } catch { /* ignore */ }
+ })
+ return () => {
+ alive = false
+ releaseKeyboard(EDITOR_FOCUS_OWNER)
+ }
+ }, [focus])
+
+ const addTag = useCallback((raw: string) => {
+ const tag = normalizeTag(raw)
+ setDraft('')
+ if (!tag) return
+ setTags((cur) => (cur.includes(tag) || cur.length >= TAGS_MAX ? cur : [...cur, tag]))
+ }, [])
+
+ const save = useCallback(() => {
+ let nextTags = tags
+ const pending = normalizeTag(draft)
+ if (pending && !nextTags.includes(pending) && nextTags.length < TAGS_MAX) nextTags = [...nextTags, pending]
+ const nextLabel = normalizeLabel(label)
+ const changed = (nextLabel ?? '') !== (item.label ?? '') || nextTags.join('\u0001') !== (item.tags ?? []).join('\u0001')
+ if (changed) void useStore.getState().setItemMeta(item.id, { label: nextLabel ?? null, tags: nextTags })
+ onDone()
+ }, [tags, draft, label, item, onDone])
+ commitRef.current = save
+
+ const removeAll = () => {
+ void useStore.getState().setItemMeta(item.id, { label: null, tags: null })
+ onDone()
+ }
+
+ return (
+ <form
+ className="card-meta-editor"
+ aria-label={t('menu.editLabel')}
+ onSubmit={(e) => {
+ e.preventDefault()
+ save()
+ }}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
+ e.preventDefault()
+ save()
+ }
+ }}
+ >
+ <label className="card-meta-field">
+ <span className="card-meta-caption">{t('menu.label')}</span>
+ <input
+ ref={labelRef}
+ className="card-meta-input"
+ value={label}
+ maxLength={LABEL_MAX}
+ placeholder={t('menu.labelPlaceholder')}
+ spellCheck={false}
+ autoComplete="off"
+ onChange={(e) => setLabel(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' && !e.ctrlKey && !e.metaKey) {
+ e.preventDefault()
+ if (full) save()
+ else tagRef.current?.focus()
+ }
+ }}
+ />
+ </label>
+
+ <div className="card-meta-field">
+ <span className="card-meta-caption">
+ {t('menu.tags')}
+ <span className="card-meta-count">{tags.length}/{TAGS_MAX}</span>
+ </span>
+ <div className="card-meta-tags" onMouseDown={(e) => {
+ if (e.target === e.currentTarget) {
+ e.preventDefault()
+ tagRef.current?.focus()
+ }
+ }}>
+ {tags.map((tag) => (
+ <span key={tag} className="card-meta-chip">
+ <span className="card-meta-chip-text">#{tag}</span>
+ <button
+ type="button"
+ className="card-meta-chip-remove"
+ aria-label={t('menu.removeTag', { tag })}
+ title={t('menu.removeTag', { tag })}
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={() => setTags((cur) => cur.filter((x) => x !== tag))}
+ >
+ <CloseIcon width={8} height={8} />
+ </button>
+ </span>
+ ))}
+ {!full && (
+ <input
+ ref={tagRef}
+ className="card-meta-tag-input"
+ value={draft}
+ maxLength={TAG_MAX_LEN + 1}
+ placeholder={tags.length === 0 ? t('menu.tagPlaceholder') : ''}
+ spellCheck={false}
+ autoComplete="off"
+ onChange={(e) => {
+ const v = e.target.value
+ if (v.includes(',')) {
+ const parts = v.split(',')
+ parts.slice(0, -1).forEach(addTag)
+ setDraft(parts[parts.length - 1])
+ } else {
+ setDraft(v)
+ }
+ }}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' && !e.ctrlKey && !e.metaKey) {
+ e.preventDefault()
+ if (draft.trim()) addTag(draft)
+ else save()
+ } else if (e.key === 'Backspace' && draft === '' && tags.length > 0) {
+ e.preventDefault()
+ setTags((cur) => cur.slice(0, -1))
+ }
+ }}
+ />
+ )}
+ </div>
+ {suggestions.length > 0 && (
+ <div className="card-meta-suggest" aria-label={t('menu.usedBefore')}>
+ {suggestions.map((s) => (
+ <button
+ key={s.tag}
+ type="button"
+ className="card-meta-suggestion"
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={() => addTag(s.tag)}
+ >
+ #{s.tag}
+ </button>
+ ))}
+ </div>
+ )}
+ </div>
+
+ <div className="card-meta-actions">
+ {hasItemMeta(item) && (
+ <button
+ type="button"
+ className="card-meta-btn is-quiet"
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={removeAll}
+ >
+ {t('menu.removeAll')}
+ </button>
+ )}
+ <span className="card-meta-spacer" />
+ <button
+ type="button"
+ className="card-meta-btn"
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={onDone}
+ >
+ {t('menu.cancel')}
+ </button>
+ <button type="submit" className="card-meta-btn is-primary" onMouseDown={(e) => e.preventDefault()}>
+ {t('menu.save')}
+ </button>
+ </div>
+ </form>
+ )
+}
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsx
index 63af939..dec02a5 100644
--- a/src/components/ClipboardItem.tsx
+++ b/src/components/ClipboardItem.tsx
@@ -32,6 +32,7 @@ import { detectCode } from '../lib/codeDetect'
import '../styles/item.css'
import { tryPaste } from '../lib/tryPaste'
import { parseColor } from '../lib/colorUtils'
+import { externalHref } from '../lib/urlPreview'
import { useTranslation, t } from '../i18n'
import { useRelativeTimeTick } from '../hooks/useRelativeTimeTick'
@@ -82,6 +83,7 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
}, [item.id])
const isPreviewing = useStore((s) => s.previewItemId) === item.id
+ const isMenuTarget = useStore((s) => s.cardMenu?.itemId === item.id)
const isBundle = (item.data.kind === 'files' && item.data.paths.length > 1) || item.data.kind === 'image-collection'
const isSingleImage = item.data.kind === 'image' || (
item.data.kind === 'files' &&
@@ -127,6 +129,7 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
if (!target || typeof target.closest !== 'function') return
if (target.closest('[data-expanded-stack]')) return
if (target.closest('[data-preview-flyout], .preview-flyout')) return
+ if (target.closest('.card-menu')) return
if (target.closest('.item')) return
setExpandedFlag(false)
}
@@ -179,8 +182,11 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
if (useStore.getState().previewItemId === item.id) {
return
}
- tryPaste(() => paste(item.id))
- }, [paste, item.id])
+ // Shift+click: paste text without its formatting (same as the menu's
+ // "Paste as plain text"; plain text has nothing to strip).
+ const plain = !!e?.shiftKey && item.data.kind === 'text'
+ tryPaste(() => paste(item.id, plain ? { plain: true } : undefined))
+ }, [paste, item.id, item.data.kind])
const onExpand = useCallback((e?: React.MouseEvent) => {
e?.stopPropagation()
@@ -229,12 +235,20 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
const handlePointerDown = useCallback((e: React.PointerEvent) => {
// Track if THIS card was the actively previewed (blurred) card when pointer clicked
wasPreviewingRef.current = (useStore.getState().previewItemId === item.id) || isPreviewing
- if (e.button === 0) {
- pointerStartRef.current = { x: e.clientX, y: e.clientY, moved: false }
- }
+ if (e.button !== 0) return // right-click opens the menu; nothing to stage
+ pointerStartRef.current = { x: e.clientX, y: e.clientY, moved: false }
handlePrestage()
}, [isPreviewing, item.id, handlePrestage])
+ // Right-click: the card menu (not during the tutorial or a drag).
+ const handleContextMenu = useCallback((e: React.MouseEvent) => {
+ e.preventDefault()
+ e.stopPropagation()
+ const s = useStore.getState()
+ if (s.tutorialStep > 0 || s.internalDragReq) return
+ s.openCardMenu(item.id, e.clientX, e.clientY)
+ }, [item.id])
+
const handlePointerMove = useCallback((e: React.PointerEvent) => {
if (!pointerStartRef.current) return
const dist = Math.hypot(e.clientX - pointerStartRef.current.x, e.clientY - pointerStartRef.current.y)
@@ -291,7 +305,7 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
}}
initial={false}
animate={{ opacity: 1 }}
- className={`item${item.pinned ? ' pinned' : ''}${isBundle ? ' bundle' : ''}${expanded ? ' is-expanded' : ''}${colorInfo ? ` is-color-card ${colorInfo.isLight ? 'is-light-color' : 'is-dark-color'}` : ''}${isImageFolderCard || isFileCard ? ' is-image-folder-card' : ''}`}
+ className={`item${item.pinned ? ' pinned' : ''}${isMenuTarget ? ' menu-target' : ''}${isBundle ? ' bundle' : ''}${expanded ? ' is-expanded' : ''}${colorInfo ? ` is-color-card ${colorInfo.isLight ? 'is-light-color' : 'is-dark-color'}` : ''}${isImageFolderCard || isFileCard ? ' is-image-folder-card' : ''}`}
data-expanded-stack={expanded ? 'true' : undefined}
style={{
...(expandedWidth ? { width: expandedWidth, minWidth: expandedWidth, maxWidth: expandedWidth } : {}),
@@ -326,6 +340,7 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
onMouseEnter={handlePrestage}
onPointerDown={handlePointerDown}
onPointerMove={handlePointerMove}
+ onContextMenu={handleContextMenu}
onDragStart={(e) => {
if (pointerStartRef.current) pointerStartRef.current.moved = true
handleDragStart(e, { id: item.id })
@@ -381,6 +396,9 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
/>
) : (
<div className="body">
+ {item.label && !isHorizontal && (!isBundle || !expanded) && (
+ <div className="item-label" title={item.label}>{item.label}</div>
+ )}
<div className="item-content">
{isBundle ? (
<BundleFluidPreview
@@ -400,7 +418,19 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
<div className="item-footer">
<div className="meta">
<KindBadge item={item} />
- <ItemDetails item={item} />
+ {isHorizontal && item.label ? (
+ // Fixed-size top-dock card: the label gets the whole line
+ // (tags stay searchable and show in the tooltip / preview).
+ <>
+ <span>·</span>
+ <span className="meta-label" title={item.tags?.length ? `${item.label} · ${item.tags.map((tag) => `#${tag}`).join(' ')}` : item.label}>{item.label}</span>
+ </>
+ ) : (
+ <>
+ <MetaTags tags={item.tags} max={2} />
+ <ItemDetails item={item} />
+ </>
+ )}
{item.hitCount > 1 && (
<>
<span>·</span>
@@ -471,7 +501,7 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
e.preventDefault()
e.currentTarget.blur()
playButtonClickSound()
- window.open((item.data as any).text, '_blank')
+ window.open(externalHref((item.data as any).text), '_blank')
}}
>
<ExternalLinkIcon />
@@ -1586,17 +1616,23 @@ function ImageFolderCard({
{/* Flap Footer: Left side shows image source/file name, Right side shows relative time */}
<div className="image-folder-flap-footer">
<div className="image-folder-meta">
- {metaDetail && (
+ {item.label ? (
+ <span className="image-folder-source-name meta-label" title={metaDetail ? `${item.label} · ${metaDetail}` : item.label}>
+ {item.label}
+ </span>
+ ) : metaDetail && (
<span className="image-folder-source-name file-name-meta" title={metaDetail}>
{metaDetail}
</span>
)}
+ {/* Narrow top-dock tiles: a label gets the whole line. */}
+ {!(isHorizontal && item.label) && <MetaTags tags={item.tags} max={1} />}
{item.hitCount > 1 && (
<span className="meta-hit-count" title={t('item.copiedTimes', { count: item.hitCount })}>
- {metaDetail ? ' · ×' : '×'}{item.hitCount}
+ {(item.label || metaDetail) ? ' · ×' : '×'}{item.hitCount}
</span>
)}
- {copied && <span className="meta-copied">{(metaDetail || item.hitCount > 1) ? ' · ' : ''}{t('item.copied')}</span>}
+ {copied && <span className="meta-copied">{(item.label || metaDetail || item.hitCount > 1) ? ' · ' : ''}{t('item.copied')}</span>}
</div>
<RelativeTime capturedAt={item.capturedAt} />
</div>
@@ -1755,8 +1791,8 @@ function MiniFileFolderCard({
<FileKindIcon
path={filePath}
isDirectory={subEntry?.isDirectory}
- width={isHorizontal ? 58 : 154}
- height={isHorizontal ? 58 : 154}
+ width={isHorizontal ? 58 : 128}
+ height={isHorizontal ? 58 : 128}
/>
</div>
)}
@@ -1878,7 +1914,7 @@ function FileFolderCard({
/>
) : (
<div className="single-file-hero" style={{ color: info.color }}>
- <FileKindIcon path={first} isDirectory={entry?.isDirectory} width={isHorizontal ? 116 : 140} height={isHorizontal ? 116 : 140} />
+ <FileKindIcon path={first} isDirectory={entry?.isDirectory} width={isHorizontal ? 100 : 136} height={isHorizontal ? 100 : 136} />
</div>
)
) : (
@@ -1887,17 +1923,19 @@ function FileFolderCard({
deckKey="file-stack-deck"
panelKey="file-stack-panel"
deck={
- <div className="image-folder-stack-deck" data-count={Math.min(count, 4)}>
+ <div className="image-folder-stack-deck is-file-deck" data-count={Math.min(count, 4)}>
{paths.slice(0, 4).map((filePath, idx) => {
const fileEntry = entries?.[idx]
const fileInfo = getFileKind(filePath, fileEntry?.isDirectory)
const isImg = !fileEntry?.isDirectory && (fileEntry?.isImage || fileInfo.kind === 'image')
- const iconSize = isHorizontal ? 142 : 160
+ // Front folder art is ~65% of the icon tall; sized so the cascade
+ // fits the viewport above the label flap in each dock.
+ const iconSize = isHorizontal ? 100 : 148
const imgSrc = fileEntry?.preview || `edgelocal://file/${encodeURIComponent(filePath.replace(/\\/g, '/'))}`
return (
<div
key={`${item.id}-${filePath}-${idx}`}
- className={`image-folder-stack-item ${isImg ? '' : 'file-stack-item '}pos-${idx}`}
+ className={`${isImg ? 'image-folder-stack-item' : 'file-stack-folder'} pos-${idx}`}
style={{ color: fileInfo.color }}
>
{isImg ? (
@@ -2066,9 +2104,17 @@ function FileFolderCard({
{/* Flap Footer: Left side shows file name, Right side shows relative time */}
<div className="image-folder-flap-footer">
<div className="image-folder-meta">
- <span className="image-folder-source-name file-name-meta" title={rawName}>
- {rawName}
- </span>
+ {item.label ? (
+ <span className="image-folder-source-name meta-label" title={`${item.label} · ${rawName}`}>
+ {item.label}
+ </span>
+ ) : (
+ <span className="image-folder-source-name file-name-meta" title={rawName}>
+ {rawName}
+ </span>
+ )}
+ {/* Narrow top-dock tiles: a label gets the whole line. */}
+ {!(isHorizontal && item.label) && <MetaTags tags={item.tags} max={1} />}
{item.hitCount > 1 && (
<span className="meta-hit-count" title={t('item.copiedTimes', { count: item.hitCount })}>
· ×{item.hitCount}
@@ -2200,6 +2246,21 @@ function Preview({ item }: { item: ClipboardItemDto }) {
/* Kind badge */
/* ------------------------------------------------------------------ */
+/** Up to `max` tag chips, then "+N" for the rest. Nothing when untagged. */
+function MetaTags({ tags, max }: { tags?: string[]; max: number }) {
+ if (!tags || tags.length === 0) return null
+ return (
+ <>
+ {tags.slice(0, max).map((tag) => (
+ <span key={tag} className="meta-tag" title={`#${tag}`}>#{tag}</span>
+ ))}
+ {tags.length > max && (
+ <span className="meta-tag-more" title={tags.slice(max).map((tag) => `#${tag}`).join(' ')}>+{tags.length - max}</span>
+ )}
+ </>
+ )
+}
+
function KindBadge({ item }: { item: ClipboardItemDto }) {
switch (item.data.kind) {
case 'text':
diff --git a/src/components/CustomFileIcon.tsx b/src/components/CustomFileIcon.tsx
index 2c20f71..63dd5f9 100644
--- a/src/components/CustomFileIcon.tsx
+++ b/src/components/CustomFileIcon.tsx
@@ -95,10 +95,13 @@ function renderMicroIcon(kind: FileKind, color: string): JSX.Element {
}
/**
- * Vintage textured folder icons (PNG, resources/file-icons, served over
- * edgelocal://icon/). One static file per kind — no per-mount SVG
- * construction, gradients, or unique gradient IDs. The <=16px micro vector
- * path stays for tiny badges where a raster would soften.
+ * Frosted-glass folder icons (SVG, resources/file-icons, served over
+ * edgelocal://icon/). One static file per kind, drawn as an <img>: each
+ * file is its own document, so its gradient / filter IDs never collide and
+ * Chromium caches the raster per size. The files are square and cropped to
+ * the folder (viewBox 64 60 384 384 of the 512 art), so the folder fills
+ * about 80% of any square box, as the previous art did. The <=16px micro
+ * line icons stay for tiny badges, where the folder art turns to a blur.
*/
export function CustomFileIcon({
ext,
@@ -166,8 +169,8 @@ export function CustomFileIcon({
display: 'inline-block',
verticalAlign: 'middle',
flexShrink: 0,
- // 3:2 art in the square boxes the vector icons used — letterbox,
- // never stretch. Transparent margins blend into the dark cards.
+ // Square art in square boxes; contain keeps it unstretched if a
+ // caller ever passes a non-square box.
objectFit: 'contain',
...style
}}
@@ -176,10 +179,18 @@ export function CustomFileIcon({
)
}
-const FOLDER_MASK_PATH =
- 'M 116 136 L 176 136 C 202 136 210 160 238 160 L 398 160 C 411 160 422 171 422 184 L 422 348 C 422 364 410 376 394 376 L 118 376 C 102 376 90 364 90 348 L 90 162 C 90 148 102 136 116 136 Z'
+/**
+ * Outline of the folder icons (back panel + front pocket, copied from the
+ * SVGs in resources/file-icons) in the same cropped frame, so a photo
+ * masked with it lines up with the file icons next to it in a stack.
+ */
+const FOLDER_MASK_SHAPES =
+ "<g transform='translate(0 14)' fill='black'>" +
+ "<rect x='120' y='118' width='272' height='246' rx='24'/>" +
+ "<path d='M124 180 L250 180 C262 180 268 184 274 192 L290 214 C295 221 300 224 310 224 L390 224 C402 224 410 232 408 244 L398 344 C396 356 388 364 376 364 L136 364 C124 364 116 356 114 344 L104 200 C103 188 112 180 124 180 Z'/>" +
+ '</g>'
-export const FILE_ICON_MASK = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='black' d='${FOLDER_MASK_PATH}'/></svg>")`
+export const FILE_ICON_MASK = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='64 60 384 384'>${FOLDER_MASK_SHAPES}</svg>")`
export interface FileStackPhotoProps {
src?: string
@@ -191,7 +202,7 @@ export interface FileStackPhotoProps {
alt?: string
}
-/** Render a photo preview masked into the 3D folder silhouette for multi-file bundles */
+/** Render a photo preview masked into the folder silhouette for multi-file bundles */
export function FileStackPhoto({
src,
fallbackSrc,
diff --git a/src/components/Panel.tsx b/src/components/Panel.tsx
index 7cbea0d..4e49e95 100644
--- a/src/components/Panel.tsx
+++ b/src/components/Panel.tsx
@@ -21,6 +21,8 @@ import { ClearMenu } from './ClearMenu'
import { PreviewFlyout } from './PreviewFlyout'
import { IndicatorStyleFlyout } from './IndicatorStyleFlyout'
import { LanguageFlyout } from './LanguageFlyout'
+import { CardMenu } from './CardMenu'
+import { TagSuggest } from './TagSuggest'
import { CopyIndicatorCurve } from './CopyIndicatorCurve'
import { useFilteredItems } from '../hooks/useFilteredItems'
@@ -481,7 +483,9 @@ export function Panel() {
<ToastStack />
{!isHorizontal && !emojiOpen && !settingsOpen && <ShelfSearch />}
+ {!isHorizontal && !emojiOpen && !settingsOpen && <TagSuggest isHorizontal={false} />}
<div style={{ flex: 1, display: 'grid', gridTemplate: '1fr / 1fr', overflow: 'hidden', position: 'relative' }}>
+ {isHorizontal && !emojiOpen && !settingsOpen && <TagSuggest isHorizontal />}
{/* Main clipboard / emoji view (persistent so ItemList is never torn down and doesn't jump on Y-axis) */}
<div
style={{
@@ -572,6 +576,7 @@ export function Panel() {
<PreviewFlyout isRight={isRight} />
<IndicatorStyleFlyout isRight={isRight} />
<LanguageFlyout isRight={isRight} />
+ <CardMenu />
</div>
</div>
)
diff --git a/src/components/PreviewFlyout.tsx b/src/components/PreviewFlyout.tsx
index eea6247..3ecbc51 100644
--- a/src/components/PreviewFlyout.tsx
+++ b/src/components/PreviewFlyout.tsx
@@ -1,68 +1,78 @@
-import { useState, useRef, useEffect } from 'react'
-import { motion, AnimatePresence } from 'framer-motion'
+import { useState, useRef, useEffect, useLayoutEffect, type ReactNode } from 'react'
import { useStore } from '../store/appStore'
-import { formatBytes, formatImageDisplayName } from '../lib/format'
+import { formatBytes, formatImageDisplayName, relativeTime } from '../lib/format'
import { getFileKind } from '../lib/fileType'
-import { FileKindIcon, FolderOpenIcon, CopyIcon, CheckIcon, ExternalLinkIcon, CloseIcon, GlobeIcon } from './icons'
-import { parseUrlPreview } from '../lib/urlPreview'
-import { parseColor } from '../lib/colorUtils'
+import { FileKindIcon, FolderOpenIcon, CopyIcon, CheckIcon, ExternalLinkIcon, CloseIcon, GlobeIcon, TypeIcon, ImageIcon, PaletteIcon, FilesIcon } from './icons'
+import { externalHref, parseUrlPreview, stripTracking } from '../lib/urlPreview'
+import { colorFormats, parseColor } from '../lib/colorUtils'
+import { fitPreviewImage, type PreviewImageFit } from '../lib/previewImageFit'
import { detectCode } from '../lib/codeDetect'
import { CodeBlock } from './CodeBlock'
import { createPortal } from 'react-dom'
import { useAdaptiveSpring } from '../hooks/useAdaptiveSpring'
+import { usePresence } from '../hooks/usePresence'
import { useDragOut } from '../hooks/useDragOut'
import { tryPaste } from '../lib/tryPaste'
import { playButtonClickSound, playToggleSound } from '../lib/soundEffects'
+import '../styles/previewFlyout.css'
import { useTranslation, t } from '../i18n'
-/** Fast start, soft landing — no overshoot, no spring hang. */
-const flyoutEaseOpen = [0.16, 1, 0.3, 1] as const
-const flyoutEaseClose = [0.3, 0, 0.2, 1] as const
-
-const flyoutVariants = {
- hidden: (dir: 'left' | 'right' | 'top') => ({
- opacity: 0,
- x: dir === 'right' ? 14 : dir === 'left' ? -14 : 0,
- y: dir === 'top' ? -14 : 0,
- scale: 0.97,
- }),
- shown: {
- opacity: 1,
- x: 0,
- y: 0,
- scale: 1,
- transition: {
- x: { duration: 0.26, ease: flyoutEaseOpen },
- y: { duration: 0.26, ease: flyoutEaseOpen },
- scale: { duration: 0.26, ease: flyoutEaseOpen },
- opacity: { duration: 0.18, ease: 'easeOut' as const },
- },
- },
- exit: (dir: 'left' | 'right' | 'top') => ({
- opacity: 0,
- x: dir === 'right' ? 10 : dir === 'left' ? -10 : 0,
- y: dir === 'top' ? -10 : 0,
- scale: 0.98,
- transition: {
- x: { duration: 0.18, ease: flyoutEaseClose },
- y: { duration: 0.18, ease: flyoutEaseClose },
- scale: { duration: 0.18, ease: flyoutEaseClose },
- opacity: { duration: 0.14, ease: 'easeIn' as const },
- },
- }),
- reducedHidden: { opacity: 0 },
- reducedShown: { opacity: 1 },
+/**
+ * How long the close animation runs (previewFlyout.css, `is-leaving`). The
+ * shell stays mounted this long; then the window may leave preview mode.
+ */
+export const PREVIEW_EXIT_MS = 170
+/** Batch bar close animation (previewFlyout.css, `.pf-batch.is-leaving`). */
+const BATCH_EXIT_MS = 140
+
+/** Normal flyout width (every kind but large images). */
+const FLYOUT_W = 440
+/** Blade width (var(--panel-width)) and the flyout's gap to it. */
+const PANEL_W = 270
+const FLYOUT_GAP = 12
+/**
+ * Side docks: the window is this wide while previewing (main/window.ts,
+ * getStickGeometry), so a flyout may reach this far from the screen edge
+ * with a gap to spare.
+ */
+const PREVIEW_WINDOW_W = 820
+const SIDE_FLYOUT_MAX_W = PREVIEW_WINDOW_W - PANEL_W - 2 * FLYOUT_GAP
+/** Top dock: widest an image flyout gets (the dock itself is up to 1080). */
+const TOP_FLYOUT_MAX_W = 760
+/** Header (14 + 30) and body padding (14 + 20) around an image. */
+const IMAGE_CHROME_H = 78
+const BODY_SIDE_PADDING = 40
+
+/** Rough height of the label + tags block above the content. */
+function metaHeight(item: any): number {
+ const hasLabel = !!item?.label
+ const hasTags = !!item?.tags?.length
+ if (!hasLabel && !hasTags) return 0
+ return 14 + (hasLabel ? 22 : 0) + (hasTags ? 22 : 0) + (hasLabel && hasTags ? 8 : 0)
}
+/** Same soft spring as the CSS open, for the slide when the anchor card moves. */
+const PF_SPRING = 'linear(0, 0.0172, 0.0616, 0.1238, 0.1968, 0.275, 0.3545, 0.4322, 0.5062, 0.5751, 0.6381, 0.6948, 0.7453, 0.7896, 0.828, 0.8611, 0.8892, 0.9128, 0.9326, 0.9488, 0.9621, 0.9728, 0.9813, 0.988, 0.9932, 0.9971, 1, 1.002, 1.0034, 1.0043, 1.0048, 1.005, 1.005, 1.0048, 1.0045, 1.0042, 1.0038, 1.0034, 1.003, 1.0026, 1)'
+
export function PreviewFlyout({ isRight }: { isRight: boolean }) {
const { t } = useTranslation()
const previewItemId = useStore((s) => s.previewItemId)
const items = useStore((s) => s.items)
const settings = useStore((s) => s.settings)
const adaptiveSpring = useAdaptiveSpring()
-
- const item = previewItemId ? items.find((i) => i.id === previewItemId) : null
+
+ const liveItem = previewItemId ? items.find((i) => i.id === previewItemId) ?? null : null
+ // While the close animation plays, keep drawing the item that was open.
+ const lastItemRef = useRef(liveItem)
+ if (liveItem) lastItemRef.current = liveItem
+ const presence = usePresence(!!liveItem, PREVIEW_EXIT_MS, () => {
+ if (!useStore.getState().previewItemId) {
+ window.edge.setPreviewMode(false)
+ }
+ })
+ const item = liveItem ?? (presence.mounted ? lastItemRef.current : null)
+ const leaving = presence.leaving
const stickPosition = (settings.stickPosition || (isRight ? 'right' : 'left')) as 'left' | 'right' | 'top'
const isTop = stickPosition === 'top'
@@ -81,11 +91,33 @@ export function PreviewFlyout({ isRight }: { isRight: boolean }) {
const reduceMotion = settings.reduceMotion || adaptiveSpring.type === 'tween'
const dockWidth = Math.min(screenW - 60, 1080)
- const flyoutWidth = 440
- const maxFlyoutHeight = isHorizontal ? Math.min(460, Math.max(200, screenH - 240)) : Math.max(100, panelH - 24)
+ // Top dock: the window grows to its preview height (min(work area - 20,
+ // 720), main/geometry.ts) only after this first render; size for that.
+ const availH = typeof window !== 'undefined' && window.screen?.availHeight ? window.screen.availHeight : screenH
+ const topWindowH = Math.max(screenH, Math.min(availH - 20, 720))
+ const maxFlyoutHeight = isHorizontal ? Math.min(460, Math.max(200, topWindowH - 240)) : Math.max(100, panelH - 24)
+
+ // Images get a flyout sized to them (wider for screenshots, scrolling for
+ // long ones, never blown up); everything else is the normal width.
+ const imageFit: PreviewImageFit | null = item?.data.kind === 'image'
+ ? fitPreviewImage(item.data.width, item.data.height, {
+ minFlyoutWidth: FLYOUT_W,
+ maxFlyoutWidth: isHorizontal ? Math.max(FLYOUT_W, Math.min(TOP_FLYOUT_MAX_W, dockWidth - 24)) : SIDE_FLYOUT_MAX_W,
+ maxImageHeight: maxFlyoutHeight - IMAGE_CHROME_H - metaHeight(item),
+ sidePadding: BODY_SIDE_PADDING,
+ devicePixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1
+ })
+ : null
+ const flyoutWidth = imageFit?.flyoutWidth ?? FLYOUT_W
const dockLeft = Math.round((screenW - dockWidth) / 2)
- const previewItemRect = useStore((s) => s.previewItemRect)
+ // Closing clears the card's rect in the store at once; keep the last one
+ // while the exit plays, or the flyout would jump to its fallback spot
+ // (the middle of the dock) before it fades.
+ const liveItemRect = useStore((s) => s.previewItemRect)
+ const lastItemRectRef = useRef(liveItemRect)
+ if (liveItem) lastItemRectRef.current = liveItemRect
+ const previewItemRect = liveItem ? liveItemRect : lastItemRectRef.current
const cardCenterXInBlade = previewItemRect?.x !== undefined
? (previewItemRect.x + (previewItemRect.width || 210) / 2) - dockLeft
: dockWidth / 2
@@ -93,11 +125,41 @@ export function PreviewFlyout({ isRight }: { isRight: boolean }) {
const maxLeft = Math.max(minLeft, dockWidth - flyoutWidth - 12)
const flyoutLeft = Math.max(minLeft, Math.min(maxLeft, Math.round(cardCenterXInBlade - flyoutWidth / 2)))
+ // Grow out of the card that was previewed: the scale's fixed point sits on
+ // the card's side of the flyout, level with (or under) the card.
+ const transformOrigin = (() => {
+ const r = previewItemRect
+ if (isHorizontal) {
+ const ox = Math.max(0, Math.min(flyoutWidth, Math.round(cardCenterXInBlade - flyoutLeft)))
+ return `${ox}px 0px`
+ }
+ const oy = r?.y !== undefined
+ ? `${Math.max(0, Math.min(panelH, Math.round(r.y + (r.height || 0) / 2 - panelTop)))}px`
+ : '50%'
+ return `${isRight ? '100%' : '0%'} ${oy}`
+ })()
+
+ // Top dock: previewing another card moves the flyout under it. Slide it
+ // there (FLIP on `translate`, compositor-run) instead of jumping.
+ const wrapRef = useRef<HTMLDivElement | null>(null)
+ const prevLeftRef = useRef<number | null>(null)
+ useLayoutEffect(() => {
+ const prev = prevLeftRef.current
+ prevLeftRef.current = item && !leaving ? flyoutLeft : null
+ const el = wrapRef.current
+ if (!el || prev === null || !isHorizontal || reduceMotion || leaving) return
+ const dx = prev - flyoutLeft
+ if (Math.abs(dx) < 1 || typeof el.animate !== 'function') return
+ el.animate([{ translate: `${dx}px 0` }, { translate: '0 0' }], { duration: 460, easing: PF_SPRING })
+ }, [item?.id, flyoutLeft, leaving, isHorizontal, reduceMotion])
+
const [dragOver, setDragOver] = useState(false)
const flyoutRef = useRef<HTMLDivElement | null>(null)
useEffect(() => {
- if (!item || !flyoutRef.current) {
+ // liveItem, not item: the hover keep-alive zone goes the moment the
+ // preview closes, not after the exit animation.
+ if (!liveItem || !flyoutRef.current) {
useStore.getState().setPreviewFlyoutRect(null)
return
}
@@ -116,7 +178,7 @@ export function PreviewFlyout({ isRight }: { isRight: boolean }) {
})
} else {
const top = panelTop + (panelH - h) / 2
- useStore.getState().setPreviewFlyoutRect({ top, bottom: top + h })
+ useStore.getState().setPreviewFlyoutRect({ top, bottom: top + h, reach: PANEL_W + FLYOUT_GAP + flyoutWidth })
}
}
@@ -130,7 +192,7 @@ export function PreviewFlyout({ isRight }: { isRight: boolean }) {
window.removeEventListener('resize', updateRect)
useStore.getState().setPreviewFlyoutRect(null)
}
- }, [item?.id, panelTop, panelH, isHorizontal, isTop, dockLeft, flyoutLeft, flyoutWidth])
+ }, [liveItem?.id, panelTop, panelH, isHorizontal, isTop, dockLeft, flyoutLeft, flyoutWidth])
// Dismiss preview flyout when user clicks inside the clipboard shelf (outside the flyout)
useEffect(() => {
@@ -165,7 +227,7 @@ export function PreviewFlyout({ isRight }: { isRight: boolean }) {
const handleDragOver = (e: React.DragEvent) => {
const activeDrag = useStore.getState().internalDragReq
- if (item && activeDrag && activeDrag.id !== item.id) {
+ if (liveItem && activeDrag && activeDrag.id !== liveItem.id) {
e.preventDefault()
e.stopPropagation()
setDragOver(true)
@@ -183,8 +245,8 @@ export function PreviewFlyout({ isRight }: { isRight: boolean }) {
e.stopPropagation()
setDragOver(false)
const activeDrag = useStore.getState().internalDragReq
- if (item && activeDrag && activeDrag.id !== item.id) {
- await window.edge.mergeItems(activeDrag.id, item.id)
+ if (liveItem && activeDrag && activeDrag.id !== liveItem.id) {
+ await window.edge.mergeItems(activeDrag.id, liveItem.id)
useStore.getState().setInternalDragReq(null)
}
}
@@ -195,7 +257,7 @@ export function PreviewFlyout({ isRight }: { isRight: boolean }) {
// Reset selection whenever preview item changes or closes
useEffect(() => {
setSelectedKeys(new Set())
- }, [item?.id])
+ }, [liveItem?.id])
const toggleSelectKey = (key: string, e?: React.MouseEvent) => {
e?.stopPropagation()
@@ -252,78 +314,73 @@ export function PreviewFlyout({ isRight }: { isRight: boolean }) {
}
}
+ // The batch bar plays its own close; keep its last count while it does.
+ const batch = usePresence(selectedKeys.size > 0, BATCH_EXIT_MS)
+ const lastSelCountRef = useRef(0)
+ if (selectedKeys.size > 0) lastSelCountRef.current = selectedKeys.size
+ const selCount = selectedKeys.size || lastSelCountRef.current
+
+ const fromClass = isTop ? 'from-top' : isRight ? 'from-right' : 'from-left'
+ const wrapClass = `pf-wrap ${reduceMotion ? 'is-reduced' : fromClass}${leaving ? ' is-leaving' : ''}`
+
return createPortal(
- <AnimatePresence onExitComplete={() => {
- if (!useStore.getState().previewItemId) {
- window.edge.setPreviewMode(false)
- }
- }}>
- {item && (
- <motion.div
- key={item.id}
- custom={stickPosition}
- variants={flyoutVariants}
- initial={reduceMotion ? 'reducedHidden' : 'hidden'}
- animate={reduceMotion ? 'reducedShown' : 'shown'}
- exit={reduceMotion ? 'reducedHidden' : 'exit'}
- transition={reduceMotion ? { duration: 0.12, ease: 'linear' } : undefined}
- style={
- isHorizontal
- ? {
- position: 'absolute',
- left: dockLeft + flyoutLeft,
- width: flyoutWidth,
- top: 222,
- display: 'flex',
- flexDirection: 'column',
- pointerEvents: 'none',
- zIndex: 5,
- originX: 0.5,
- originY: 0,
- willChange: 'transform, opacity',
- backfaceVisibility: 'hidden',
- }
- : {
- position: 'absolute',
- top: panelTop,
- height: panelH,
- [isRight ? 'right' : 'left']: 'var(--panel-width)',
- marginLeft: isRight ? 0 : 12,
- marginRight: isRight ? 12 : 0,
- width: 440,
- display: 'flex',
- alignItems: 'center',
- pointerEvents: 'none',
- zIndex: 5,
- originX: isRight ? 1 : 0,
- originY: 0.5,
- willChange: 'transform, opacity',
- backfaceVisibility: 'hidden',
- }
- }
+ item ? (
+ <div
+ ref={wrapRef}
+ className={wrapClass}
+ style={
+ isHorizontal
+ ? {
+ position: 'absolute',
+ left: dockLeft + flyoutLeft,
+ width: flyoutWidth,
+ top: 222,
+ display: 'flex',
+ flexDirection: 'column',
+ pointerEvents: 'none',
+ zIndex: 5,
+ transformOrigin,
+ }
+ : {
+ position: 'absolute',
+ top: panelTop,
+ height: panelH,
+ [isRight ? 'right' : 'left']: 'var(--panel-width)',
+ marginLeft: isRight ? 0 : FLYOUT_GAP,
+ marginRight: isRight ? FLYOUT_GAP : 0,
+ width: flyoutWidth,
+ display: 'flex',
+ alignItems: 'center',
+ pointerEvents: 'none',
+ zIndex: 5,
+ transformOrigin,
+ }
+ }
+ >
+ <div
+ ref={flyoutRef}
+ className="preview-flyout"
+ data-preview-flyout="true"
+ onDragOver={handleDragOver}
+ onDragLeave={handleDragLeave}
+ onDrop={handleDrop}
+ style={{
+ width: '100%',
+ maxHeight: maxFlyoutHeight,
+ background: dragOver ? 'rgba(15, 30, 18, 0.95)' : '#000000',
+ borderRadius: 20,
+ border: dragOver ? '2px dashed #4caf50' : 'none',
+ overflow: 'hidden',
+ display: 'flex',
+ flexDirection: 'column',
+ // undefined (not 'none') so the stylesheet's inner rim shows
+ boxShadow: dragOver ? '0 0 35px rgba(76, 175, 80, 0.3)' : undefined,
+ // a closing flyout no longer takes clicks
+ pointerEvents: leaving ? 'none' : 'auto',
+ transition: 'background 0.2s ease, border 0.2s ease, box-shadow 0.2s ease',
+ position: 'relative'
+ }}
>
- <div
- ref={flyoutRef}
- className="preview-flyout"
- data-preview-flyout="true"
- onDragOver={handleDragOver}
- onDragLeave={handleDragLeave}
- onDrop={handleDrop}
- style={{
- width: '100%',
- maxHeight: maxFlyoutHeight,
- background: dragOver ? 'rgba(15, 30, 18, 0.95)' : '#000000',
- borderRadius: 20,
- border: dragOver ? '2px dashed #4caf50' : 'none',
- overflow: 'hidden',
- display: 'flex',
- flexDirection: 'column',
- boxShadow: dragOver ? '0 0 35px rgba(76, 175, 80, 0.3)' : 'none',
- pointerEvents: 'auto',
- transition: 'background 0.2s ease, border 0.2s ease, box-shadow 0.2s ease',
- position: 'relative'
- }}
- >
{dragOver && (
<div
style={{
@@ -348,86 +405,66 @@ export function PreviewFlyout({ isRight }: { isRight: boolean }) {
<span>+ {t('onboarding.dropToExtract')}</span>
</div>
)}
- {/* Content — even bezels, no header chrome */}
- <div style={{ padding: selectedKeys.size > 0 ? '20px 20px 68px 20px' : '20px', overflowY: 'auto', overflowX: 'hidden', scrollbarWidth: 'none', msOverflowStyle: 'none', flex: 1, minHeight: 0 }}>
+ {/* Re-keyed per item: switching cards settles the new content in place. */}
+ <div key={item.id} className="pf-swap">
<PreviewContent
item={item}
selectedKeys={selectedKeys}
onToggleSelectKey={toggleSelectKey}
+ hasBatch={batch.mounted}
+ imageFit={imageFit}
/>
</div>
- {/* Floating Multi-Selection Batch Action Bar */}
- <AnimatePresence>
- {selectedKeys.size > 0 && (
- <motion.div
- initial={{ opacity: 0, y: 14, scale: 0.95 }}
- animate={{ opacity: 1, y: 0, scale: 1 }}
- exit={{ opacity: 0, y: 14, scale: 0.95 }}
- transition={{ type: 'spring', stiffness: 450, damping: 32 }}
- style={{
- position: 'absolute',
- bottom: 12,
- left: 12,
- right: 12,
- background: 'var(--act-surface)',
- boxShadow: '0 12px 32px rgba(0, 0, 0, 0.6)',
- borderRadius: 999,
- padding: '4px 4px 4px 6px',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- zIndex: 20
- }}
- >
- <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
- <div className="flyout-chip">
- {t('flyout.selectedCount').replace('{count}', String(selectedKeys.size))}
- </div>
- <button type="button" className="flyout-text-btn" onClick={handleSelectAllToggle}>
- {selectedKeys.size === allItemKeys.length ? t('flyout.deselectAll') : t('flyout.selectAll')}
- </button>
+ {/* Floating multi-selection batch action bar */}
+ {batch.mounted && (
+ <div className={`pf-batch${batch.leaving ? ' is-leaving' : ''}`}>
+ <div className="pf-batch-group">
+ <div className="flyout-chip">
+ {t('flyout.selectedCount').replace('{count}', String(selCount))}
</div>
+ <button type="button" className="flyout-text-btn" onClick={handleSelectAllToggle}>
+ {selectedKeys.size === allItemKeys.length ? t('flyout.deselectAll') : t('flyout.selectAll')}
+ </button>
+ </div>
- <div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
- <button
- type="button"
- className="flyout-btn"
- title={t('flyout.copySelected')}
- onClick={handleBatchCopy}
- >
- <CopyIcon width={13} height={13} />
- <span>{t('item.copy')}</span>
- </button>
-
- <button
- type="button"
- className="flyout-btn primary"
- title={t('flyout.pasteSelected')}
- onClick={handleBatchPaste}
- >
- <span>{t('flyout.paste')}</span>
- </button>
-
- <button
- type="button"
- className="act"
- title={t('flyout.clearSelection')}
- onClick={() => {
- playButtonClickSound()
- setSelectedKeys(new Set())
- }}
- >
- <CloseIcon />
- </button>
- </div>
- </motion.div>
- )}
- </AnimatePresence>
- </div>
- </motion.div>
- )}
- </AnimatePresence>,
+ <div className="pf-batch-group">
+ <button
+ type="button"
+ className="flyout-btn"
+ title={t('flyout.copySelected')}
+ onClick={handleBatchCopy}
+ >
+ <CopyIcon width={13} height={13} />
+ <span>{t('item.copy')}</span>
+ </button>
+
+ <button
+ type="button"
+ className="flyout-btn primary"
+ title={t('flyout.pasteSelected')}
+ onClick={handleBatchPaste}
+ >
+ <span>{t('flyout.paste')}</span>
+ </button>
+
+ <button
+ type="button"
+ className="act"
+ title={t('flyout.clearSelection')}
+ onClick={() => {
+ playButtonClickSound()
+ setSelectedKeys(new Set())
+ }}
+ >
+ <CloseIcon />
+ </button>
+ </div>
+ </div>
+ )}
+ </div>
+ </div>
+ ) : null,
document.body
)
}
@@ -501,8 +538,6 @@ function ExplorerButton({
)
}
-const SYS_FONT = 'var(--font-ui)'
-
function SelectionBadge({
isSelected,
forceVisible,
@@ -528,14 +563,91 @@ function SelectionBadge({
)
}
+/**
+ * One header row for every kind: what it is, a detail, when it was copied,
+ * and the item's quick actions. It stays put while the body scrolls.
+ */
+function FlyoutHead({
+ icon,
+ title,
+ detail,
+ time,
+ children
+}: {
+ icon: ReactNode
+ title: string
+ detail?: string
+ time: string
+ children?: ReactNode
+}) {
+ return (
+ <div className="pf-head">
+ <span className="pf-head-icon">{icon}</span>
+ <span className="pf-head-title" title={title}>{title}</span>
+ {detail ? <span className="pf-head-detail" title={detail}>{detail}</span> : null}
+ <span className="pf-head-time">{time}</span>
+ <span className="pf-head-spacer" />
+ {children ? <div className="act-pill">{children}</div> : null}
+ </div>
+ )
+}
+
+/** The item's label and every tag, above the content. */
+function MetaHead({ item }: { item: any }) {
+ if (!item.label && !item.tags?.length) return null
+ return (
+ <div className="flyout-meta-head">
+ {item.label && <div className="flyout-meta-label">{item.label}</div>}
+ {item.tags?.length ? (
+ <div className="flyout-meta-tags">
+ {item.tags.map((tag: string) => (
+ <span key={tag} className="flyout-meta-tag">#{tag}</span>
+ ))}
+ </div>
+ ) : null}
+ </div>
+ )
+}
+
+/** One color format ("RGB rgb(59, 130, 246)"); a click copies it. */
+function ColorFormatRow({ name, value }: { name: string; value: string }) {
+ const [done, setDone] = useState(false)
+ useEffect(() => {
+ if (!done) return
+ const id = setTimeout(() => setDone(false), 1200)
+ return () => clearTimeout(id)
+ }, [done])
+ return (
+ <button
+ type="button"
+ className={`pf-format${done ? ' is-done' : ''}`}
+ title={done ? t('flyout.copied') : t('flyout.copyText')}
+ onClick={(e) => {
+ e.stopPropagation()
+ e.currentTarget.blur()
+ // Through main (watcher paused): the copy is not captured as a new card.
+ void useStore.getState().copyText(value, { quiet: true }).then((ok) => { if (ok) setDone(true) })
+ }}
+ >
+ <span className="pf-format-name">{name}</span>
+ <span className="pf-format-value">{value}</span>
+ <span className="pf-format-icon">{done ? <CheckIcon /> : <CopyIcon />}</span>
+ </button>
+ )
+}
+
function PreviewContent({
item,
selectedKeys,
- onToggleSelectKey
+ onToggleSelectKey,
+ hasBatch,
+ imageFit
}: {
item: any
selectedKeys?: Set<string>
onToggleSelectKey?: (key: string, e?: React.MouseEvent) => void
+ hasBatch?: boolean
+ imageFit?: PreviewImageFit | null
}) {
const { t } = useTranslation()
const startDrag = useDragOut()
@@ -550,6 +662,31 @@ function PreviewContent({
}
}, [item?.id, item?.data?.hasFullPayload])
+ const time = relativeTime(item.capturedAt)
+ /** Header on top, then the scrolling body (label + tags first). */
+ const frame = (head: ReactNode, body: ReactNode) => (
+ <>
+ {head}
+ <div className={`pf-scroll${hasBatch ? ' has-batch' : ''}`}>
+ <MetaHead item={item} />
+ {body}
+ </div>
+ </>
+ )
+ const pasteOnClick = (e: React.MouseEvent) => {
+ const sel = window.getSelection()?.toString()
+ if (sel && sel.trim().length > 0) return
+ e.stopPropagation()
+ tryPaste(() => useStore.getState().paste(item.id))
+ }
+ const copyButton = (title: string) => (
+ <QuickActionButton
+ title={title}
+ icon={CopyIcon}
+ onClick={() => useStore.getState().copy(item.id)}
+ />
+ )
+
if (item.data.kind === 'text') {
const activeText = fullText ?? item.data.text
const text: string = activeText.length > 20000
@@ -559,87 +696,31 @@ function PreviewContent({
if (isUrl) {
const info = parseUrlPreview(activeText)
- return (
+ return frame(
+ <FlyoutHead icon={<GlobeIcon />} title={info.serviceName} detail={info.domain} time={time}>
+ <QuickActionButton
+ title={t('flyout.openLink')}
+ icon={ExternalLinkIcon}
+ onClick={() => window.open(externalHref(activeText), '_blank')}
+ />
+ <QuickActionButton
+ title={t('flyout.copyText')}
+ icon={CopyIcon}
+ // Through main (watcher paused): the copy is not captured as a new card.
+ onClick={() => void useStore.getState().copyText(stripTracking(activeText), { quiet: true })}
+ />
+ </FlyoutHead>,
<div
- onClick={(e) => {
- const sel = window.getSelection()?.toString()
- if (sel && sel.trim().length > 0) return
- e.stopPropagation()
- tryPaste(() => useStore.getState().paste(item.id))
- }}
+ onClick={pasteOnClick}
title={t('flyout.clickToPaste')}
- style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 14, cursor: 'pointer' }}
+ style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 12, cursor: 'pointer' }}
>
- <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 10 }}>
- <div style={{
- display: 'inline-flex',
- alignItems: 'center',
- gap: 6,
- background: 'rgba(255, 255, 255, 0.08)',
- border: '1px solid rgba(255, 255, 255, 0.14)',
- borderRadius: 999,
- padding: '3px 10px',
- maxWidth: 'calc(100% - 75px)',
- overflow: 'hidden',
- whiteSpace: 'nowrap',
- boxSizing: 'border-box'
- }}>
- <GlobeIcon width={13} height={13} style={{ color: 'rgba(255, 255, 255, 0.85)', flexShrink: 0 }} />
- <span style={{ fontSize: 12, fontWeight: 600, color: '#ffffff', fontFamily: SYS_FONT, flexShrink: 0, whiteSpace: 'nowrap' }}>{info.serviceName}</span>
- <span style={{ fontSize: 11, color: 'rgba(255, 255, 255, 0.35)', flexShrink: 0 }}>·</span>
- <span style={{ fontSize: 11.5, color: 'rgba(255, 255, 255, 0.65)', fontFamily: SYS_FONT, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', minWidth: 0, flexShrink: 1 }}>{info.domain}</span>
- </div>
-
- <div className="act-pill">
- <QuickActionButton
- title={t('flyout.openLink')}
- icon={ExternalLinkIcon}
- onClick={() => window.open(activeText, '_blank')}
- />
- <QuickActionButton
- title={t('flyout.copyText')}
- icon={CopyIcon}
- onClick={() => navigator.clipboard.writeText(info.cleanUrl || activeText)}
- />
- </div>
- </div>
-
- {info.title && (
- <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
- <div style={{
- fontSize: 16,
- fontWeight: 600,
- color: '#ffffff',
- lineHeight: 1.35,
- fontFamily: SYS_FONT,
- wordBreak: 'break-word'
- }}>
- {info.title}
- </div>
- {info.subtitle && (
- <div>
- <span style={{
- fontSize: 10.5,
- fontWeight: 600,
- textTransform: 'uppercase',
- letterSpacing: '0.04em',
- color: 'rgba(255, 255, 255, 0.6)',
- background: 'rgba(255, 255, 255, 0.08)',
- padding: '2px 7px',
- borderRadius: 4,
- display: 'inline-block'
- }}>
- {info.subtitle}
- </span>
- </div>
- )}
- </div>
- )}
-
+ {info.title && <div className="pf-link-title">{info.title}</div>}
+ {info.title && info.subtitle && <span className="pf-link-sub">{info.subtitle}</span>}
<div
onClick={(e) => {
e.stopPropagation()
- window.open(activeText, '_blank')
+ window.open(externalHref(activeText), '_blank')
}}
className="flyout-url"
>
@@ -651,75 +732,42 @@ function PreviewContent({
const colorInfo = parseColor(activeText)
if (colorInfo) {
- return (
- <div
- onClick={(e) => {
- const sel = window.getSelection()?.toString()
- if (sel && sel.trim().length > 0) return
- e.stopPropagation()
- tryPaste(() => useStore.getState().paste(item.id))
- }}
- title={t('flyout.clickToPaste')}
- style={{
- position: 'relative',
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- justifyContent: 'center',
- gap: 12,
- padding: '36px 20px',
- borderRadius: 16,
- background: colorInfo.cssColor,
- color: colorInfo.isLight ? '#111827' : '#ffffff',
- cursor: 'pointer',
- boxShadow: '0 8px 24px rgba(0, 0, 0, 0.35)',
- boxSizing: 'border-box',
- }}
- >
- <div style={{ display: 'flex', justifyContent: 'flex-end', width: '100%', position: 'absolute', top: 10, right: 10 }}>
- <div className="act-pill">
- <QuickActionButton
- title={t('flyout.copyText')}
- icon={CopyIcon}
- onClick={() => useStore.getState().copy(item.id)}
- />
- </div>
- </div>
- <div style={{
- fontFamily: 'var(--font-mono)',
- fontSize: 24,
- fontWeight: 700,
- letterSpacing: '0.04em',
- textShadow: colorInfo.isLight ? '0 1px 2px rgba(255,255,255,0.5)' : '0 2px 4px rgba(0,0,0,0.6)',
- }}>
+ const formats = colorFormats(activeText)
+ return frame(
+ <FlyoutHead icon={<PaletteIcon />} title={(formats?.source ?? 'hex').toUpperCase()} time={time}>
+ {copyButton(t('flyout.copyText'))}
+ </FlyoutHead>,
+ <>
+ <div
+ className="pf-swatch"
+ onClick={pasteOnClick}
+ title={t('flyout.clickToPaste')}
+ style={{ background: colorInfo.cssColor, color: colorInfo.isLight ? '#111827' : '#ffffff' }}
+ >
{colorInfo.displayText}
</div>
- </div>
+ {formats && (
+ <div className="pf-formats">
+ <ColorFormatRow name="HEX" value={formats.hex} />
+ <ColorFormatRow name="RGB" value={formats.rgb} />
+ <ColorFormatRow name="HSL" value={formats.hsl} />
+ </div>
+ )}
+ </>
)
}
const codeInfo = detectCode(activeText)
if (codeInfo.isCode) {
- return (
+ return frame(
+ <FlyoutHead icon={<TypeIcon />} title={codeInfo.displayName} time={time}>
+ {copyButton(t('flyout.copyText'))}
+ </FlyoutHead>,
<div
- onClick={(e) => {
- const sel = window.getSelection()?.toString()
- if (sel && sel.trim().length > 0) return
- e.stopPropagation()
- tryPaste(() => useStore.getState().paste(item.id))
- }}
+ onClick={pasteOnClick}
title={t('flyout.clickToPaste')}
- style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 10, cursor: 'pointer', width: '100%' }}
+ style={{ position: 'relative', cursor: 'pointer', width: '100%' }}
>
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 6, position: 'sticky', top: 0, zIndex: 2 }}>
- <div className="act-pill">
- <QuickActionButton
- title={t('flyout.copyText')}
- icon={CopyIcon}
- onClick={() => useStore.getState().copy(item.id)}
- />
- </div>
- </div>
<CodeBlock
code={text}
language={codeInfo.language}
@@ -732,44 +780,31 @@ function PreviewContent({
)
}
- return (
+ return frame(
+ <FlyoutHead icon={<TypeIcon />} title={t('filters.text')} time={time}>
+ {copyButton(t('flyout.copyText'))}
+ </FlyoutHead>,
<div
- onClick={(e) => {
- const sel = window.getSelection()?.toString()
- if (sel && sel.trim().length > 0) return
- e.stopPropagation()
- tryPaste(() => useStore.getState().paste(item.id))
- }}
+ className="pf-text"
+ onClick={pasteOnClick}
title={t('flyout.clickToPaste')}
- style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 10, cursor: 'pointer' }}
+ style={{ cursor: 'pointer' }}
>
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 6, position: 'sticky', top: 0, zIndex: 2 }}>
- <div className="act-pill">
- <QuickActionButton
- title={t('flyout.copyText')}
- icon={CopyIcon}
- onClick={() => useStore.getState().copy(item.id)}
- />
- </div>
- </div>
- <div style={{
- color: 'rgba(255,255,255,0.88)',
- whiteSpace: 'pre-wrap',
- wordBreak: 'break-word',
- fontSize: 13.5,
- lineHeight: 1.65,
- fontFamily: 'var(--font-ui)',
- fontWeight: 400,
- letterSpacing: '0.01em'
- }}>
- {text}
- </div>
+ {text}
</div>
)
}
-
+
if (item.data.kind === 'image') {
- return (
+ return frame(
+ <FlyoutHead
+ icon={<ImageIcon />}
+ title={`${item.data.width} × ${item.data.height}`}
+ detail={formatBytes(item.data.bytes)}
+ time={time}
+ >
+ {copyButton(t('flyout.copyImage'))}
+ </FlyoutHead>,
<div
draggable={true}
onDragStart={(e) => {
@@ -784,29 +819,30 @@ function PreviewContent({
tryPaste(() => useStore.getState().paste(item.id))
}}
title={t('flyout.clickToPasteDrag')}
- style={{ display: 'flex', flexDirection: 'column', gap: 12, position: 'relative', cursor: 'grab' }}
+ className="pf-image-box"
>
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 6, position: 'absolute', top: 8, right: 8, zIndex: 2 }}>
- <div className="act-pill">
- <QuickActionButton
- title={t('flyout.copyImage')}
- icon={CopyIcon}
- onClick={() => useStore.getState().copy(item.id)}
- />
- </div>
- </div>
{item.data.imageId && (
- <img src={`edgelocal://${item.data.imageId}`} alt="preview" style={{ width: '100%', maxHeight: '65vh', objectFit: 'contain', borderRadius: 8 }} draggable={false} />
+ <img
+ className="pf-image"
+ src={`edgelocal://${item.data.imageId}`}
+ alt="preview"
+ draggable={false}
+ decoding="async"
+ // exact size up front: no reflow when it loads, no stretching
+ style={imageFit ? { width: imageFit.width, height: imageFit.height } : undefined}
+ />
)}
- <div style={{ fontSize: 12, color: 'rgba(255,255,255,0.4)', fontFamily: SYS_FONT, letterSpacing: '0.02em' }}>
- {item.data.width} × {item.data.height} · {formatBytes(item.data.bytes)}
- </div>
</div>
)
}
if (item.data.kind === 'image-collection') {
- return (
+ return frame(
+ <FlyoutHead
+ icon={<ImageIcon />}
+ title={`${item.data.images.length} ${t('filters.images').toLowerCase()}`}
+ time={time}
+ />,
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
{item.data.images.map((img: any, idx: number) => {
const isSelected = selectedKeys?.has(img.imageId) ?? false
@@ -886,7 +922,9 @@ function PreviewContent({
const entry = item.data.entries?.[0]
const fileName = formatImageDisplayName(entry?.name || p, item.capturedAt)
const fullResUrl = `edgelocal://file/${encodeURIComponent(p.replace(/\\/g, '/'))}`
- return (
+ const ext = (entry?.ext || '').toUpperCase()
+ return frame(
+ <FlyoutHead icon={<ImageIcon />} title={ext || fileName} time={time} />,
<div
className="item flyout-subitem single-hero-card"
draggable={true}
@@ -951,7 +989,12 @@ function PreviewContent({
const entry = item.data.entries?.[0]
const info = getFileKind(p, entry?.isDirectory)
const fileName = formatImageDisplayName(entry?.name || p, item.capturedAt)
- return (
+ return frame(
+ <FlyoutHead
+ icon={<FileKindIcon path={p} width={14} height={14} isDirectory={entry?.isDirectory} />}
+ title={info.label}
+ time={time}
+ />,
<div
className="item flyout-subitem single-hero-card"
draggable={true}
@@ -1014,7 +1057,12 @@ function PreviewContent({
})
const useSingleColumn = hasImageFiles
- return (
+ return frame(
+ <FlyoutHead
+ icon={<FilesIcon />}
+ title={`${item.data.paths.length} ${t('filters.files').toLowerCase()}`}
+ time={time}
+ />,
<div style={{ display: useSingleColumn ? 'flex' : 'grid', flexDirection: useSingleColumn ? 'column' : undefined, gridTemplateColumns: useSingleColumn ? undefined : 'repeat(2, minmax(0, 1fr))', gap: 10, width: '100%', boxSizing: 'border-box' }}>
{item.data.paths.map((p: string, i: number) => {
const entry = item.data.entries?.[i]
diff --git a/src/components/ShelfSearch.tsx b/src/components/ShelfSearch.tsx
index daa0712..4eba126 100644
--- a/src/components/ShelfSearch.tsx
+++ b/src/components/ShelfSearch.tsx
@@ -13,8 +13,7 @@
*/
import { useCallback, useEffect, useRef } from 'react'
import { useStore } from '../store/appStore'
-import { edge } from '../lib/edge'
-import { noteSearchEngaged } from '../lib/searchFocus'
+import { acquireKeyboard, releaseKeyboard } from '../lib/keyboardFocus'
import { useTranslation } from '../i18n'
import { CloseIcon, SearchIcon } from './icons'
@@ -28,13 +27,7 @@ export function ShelfSearch() {
const disengage = useCallback(() => {
if (!engagedRef.current) return
engagedRef.current = false
- noteSearchEngaged(false)
- try {
- void edge.focusWindow(false)?.catch?.(() => {})
- } catch { /* ignore */ }
- try {
- void edge.pauseHotkey(false)?.catch?.(() => {})
- } catch { /* ignore */ }
+ releaseKeyboard('search')
}, [])
// Engage BEFORE focus can happen: pointer-down always fires, focus may not.
@@ -42,23 +35,9 @@ export function ShelfSearch() {
const engage = useCallback(() => {
if (engagedRef.current) return
engagedRef.current = true
- noteSearchEngaged(true)
- try {
- window.focus()
- } catch { /* ignore */ }
- try {
- const p = edge.focusWindow(true) as unknown as Promise<void> | undefined
- if (p && typeof (p as Promise<void>).then === 'function') {
- ;(p as Promise<void>).then(() => {
- try { inputRef.current?.focus() } catch { /* ignore */ }
- }).catch(() => {})
- } else {
- try { inputRef.current?.focus() } catch { /* ignore */ }
- }
- } catch { /* ignore */ }
- try {
- void edge.pauseHotkey(true)?.catch?.(() => {})
- } catch { /* ignore */ }
+ void acquireKeyboard('search').then(() => {
+ try { inputRef.current?.focus() } catch { /* ignore */ }
+ })
}, [])
// Safety: if the input unmounts mid-focus (view switch), restore state.
diff --git a/src/components/TagSuggest.tsx b/src/components/TagSuggest.tsx
new file mode 100644
index 0000000..b0342d8
--- /dev/null
+++ b/src/components/TagSuggest.tsx
@@ -0,0 +1,47 @@
+/**
+ * TagSuggest — while the search ends in `#word`, a row of matching tags
+ * (most used first, with counts). Clicking one completes the query.
+ *
+ * Side docks: a row between the search box and the list. Top dock: a strip
+ * floating over the top of the list, so the fixed-height cards never move.
+ * Buttons never take focus, so typing continues in the search box.
+ */
+import { useMemo } from 'react'
+import { useStore } from '../store/appStore'
+import { useTranslation } from '../i18n'
+import { activeTagPrefix, completeTag, suggestTags, tagCounts } from '../lib/tagQuery'
+
+export function TagSuggest({ isHorizontal }: { isHorizontal: boolean }) {
+ const { t } = useTranslation()
+ const query = useStore((s) => s.query)
+ const items = useStore((s) => s.items)
+ const prefix = activeTagPrefix(query)
+ const active = prefix !== null
+ const counts = useMemo(() => (active ? tagCounts(items) : null), [items, active])
+ const suggestions = useMemo(
+ () => (prefix === null || !counts ? [] : suggestTags(counts, prefix, { limit: isHorizontal ? 6 : 8 })),
+ [counts, prefix, isHorizontal]
+ )
+ if (suggestions.length === 0) return null
+
+ return (
+ <div className={`tag-suggest${isHorizontal ? ' is-horizontal' : ''}`} role="listbox" aria-label={t('menu.tags')}>
+ {suggestions.map((s) => (
+ <button
+ key={s.tag}
+ type="button"
+ role="option"
+ aria-selected={false}
+ className="tag-suggest-chip"
+ tabIndex={-1}
+ onPointerDown={(e) => e.preventDefault()}
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={() => useStore.getState().setQuery(completeTag(useStore.getState().query, s.tag))}
+ >
+ <span className="tag-suggest-name">#{s.tag}</span>
+ <span className="tag-suggest-count">{s.count}</span>
+ </button>
+ ))}
+ </div>
+ )
+}
diff --git a/src/components/icons.tsx b/src/components/icons.tsx
index 60b2de3..1015e27 100644
--- a/src/components/icons.tsx
+++ b/src/components/icons.tsx
@@ -119,6 +119,9 @@ export const RecentIcon = ClockIcon
export const TypeIcon = uiIcon('textT')
export const FilesIcon = uiIcon('files')
export const PaletteIcon = uiIcon('palette')
+export const TagIcon = uiIcon('tag')
+export const PasteIcon = uiIcon('clipboardText')
+export const DownloadIcon = uiIcon('downloadSimple')
export const EmojiSmileIcon = uiIcon('smiley', 18)
export const EmojiClockIcon = (p: P) => <ClockIcon width={p.width ?? 18} height={p.height ?? 18} {...(p as any)} />
diff --git a/src/components/phosphorPaths.ts b/src/components/phosphorPaths.ts
index 8a34300..aaaa9ea 100644
--- a/src/components/phosphorPaths.ts
+++ b/src/components/phosphorPaths.ts
@@ -41,9 +41,11 @@ export const PHOSPHOR_BOLD = {
caretUp: 'M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z',
check: 'M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z',
clipboard: 'M200,28H165.47a51.88,51.88,0,0,0-74.94,0H56A20,20,0,0,0,36,48V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V48A20,20,0,0,0,200,28ZM155.71,60H100.29a28,28,0,0,1,55.42,0ZM196,212H60V52H77.41A52.13,52.13,0,0,0,76,64v8A12,12,0,0,0,88,84h80a12,12,0,0,0,12-12V64a52.13,52.13,0,0,0-1.41-12H196Z',
+ clipboardText: 'M172,164a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,164Zm-12-52H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24Zm60-64V216a20,20,0,0,1-20,20H56a20,20,0,0,1-20-20V48A20,20,0,0,1,56,28H90.53a51.88,51.88,0,0,1,74.94,0H200A20,20,0,0,1,220,48ZM100.29,60h55.42a28,28,0,0,0-55.42,0ZM196,52H178.59A52.13,52.13,0,0,1,180,64v8a12,12,0,0,1-12,12H88A12,12,0,0,1,76,72V64a52.13,52.13,0,0,1,1.41-12H60V212H196Z',
clockCounterClockwise: 'M140,80v41.21l34.17,20.5a12,12,0,1,1-12.34,20.58l-40-24A12,12,0,0,1,116,128V80a12,12,0,0,1,24,0ZM128,28A99.38,99.38,0,0,0,57.24,57.34c-4.69,4.74-9,9.37-13.24,14V64a12,12,0,0,0-24,0v40a12,12,0,0,0,12,12H72a12,12,0,0,0,0-24H57.77C63,86,68.37,80.22,74.26,74.26a76,76,0,1,1,1.58,109,12,12,0,0,0-16.48,17.46A100,100,0,1,0,128,28Z',
coffee: 'M212,76H32A12,12,0,0,0,20,88v48a100.24,100.24,0,0,0,26.73,68H32a12,12,0,0,0,0,24H208a12,12,0,0,0,0-24H193.27a100.75,100.75,0,0,0,20-32A44,44,0,0,0,256,128v-8A44.05,44.05,0,0,0,212,76Zm-16,60a76.27,76.27,0,0,1-42,68H86a76.27,76.27,0,0,1-42-68V100H196Zm36-8a20,20,0,0,1-12.57,18.55A97.17,97.17,0,0,0,220,136V101.68A20,20,0,0,1,232,120ZM68,48V24a12,12,0,0,1,24,0V48a12,12,0,0,1-24,0Zm40,0V24a12,12,0,0,1,24,0V48a12,12,0,0,1-24,0Zm40,0V24a12,12,0,0,1,24,0V48a12,12,0,0,1-24,0Z',
copy: 'M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z',
+ downloadSimple: 'M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0Zm-108.49,8.49a12,12,0,0,0,17,0l40-40a12,12,0,0,0-17-17L140,115V32a12,12,0,0,0-24,0v83L96.49,95.51a12,12,0,0,0-17,17Z',
dotsSixVertical: 'M108,60A16,16,0,1,1,92,44,16,16,0,0,1,108,60Zm56,16a16,16,0,1,0-16-16A16,16,0,0,0,164,76ZM92,112a16,16,0,1,0,16,16A16,16,0,0,0,92,112Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,112ZM92,180a16,16,0,1,0,16,16A16,16,0,0,0,92,180Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,180Z',
files: 'M220.49,59.51l-40-40A12,12,0,0,0,172,16H92A20,20,0,0,0,72,36V56H56A20,20,0,0,0,36,76V216a20,20,0,0,0,20,20H164a20,20,0,0,0,20-20V196h20a20,20,0,0,0,20-20V68A12,12,0,0,0,220.49,59.51ZM160,212H60V80h67l33,33Zm40-40H184V108a12,12,0,0,0-3.51-8.49l-40-40A12,12,0,0,0,132,56H96V40h71l33,33Zm-56-28a12,12,0,0,1-12,12H88a12,12,0,0,1,0-24h44A12,12,0,0,1,144,144Zm0,40a12,12,0,0,1-12,12H88a12,12,0,0,1,0-24h44A12,12,0,0,1,144,184Z',
flag: 'M40.14,46.88A12,12,0,0,0,36,56V224a12,12,0,0,0,24,0V181.72c22.84-17.12,42.1-9.12,70.68,5,16.23,8,34.74,17.2,54.8,17.2,14.72,0,30.28-4.94,46.38-18.88A12,12,0,0,0,236,176V56a12,12,0,0,0-19.86-9.07c-24.71,21.41-44.53,13.31-74.82-1.68C113.19,31.27,78.17,13.94,40.14,46.88ZM212,170.26c-22.84,17.13-42.1,9.11-70.68-5C118.16,153.76,90.33,140,60,153.87V61.69c22.84-17.12,42.1-9.12,70.68,5,16.23,8,34.74,17.2,54.8,17.2A63,63,0,0,0,212,78.08Z',
@@ -67,6 +69,7 @@ export const PHOSPHOR_BOLD = {
sparkle: 'M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z',
stack: 'M234.36,170A12,12,0,0,1,230,186.37l-96,56a12,12,0,0,1-12.1,0l-96-56a12,12,0,0,1,12.09-20.74l90,52.48L218,165.63A12,12,0,0,1,234.36,170ZM218,117.63,128,170.11,38.05,117.63A12,12,0,0,0,26,138.37l96,56a12,12,0,0,0,12.1,0l96-56A12,12,0,0,0,218,117.63ZM20,80a12,12,0,0,1,6-10.37l96-56a12.06,12.06,0,0,1,12.1,0l96,56a12,12,0,0,1,0,20.74l-96,56a12,12,0,0,1-12.1,0l-96-56A12,12,0,0,1,20,80Zm35.82,0L128,122.11,200.18,80,128,37.89Z',
star: 'M243,96a20.33,20.33,0,0,0-17.74-14l-56.59-4.57L146.83,24.62a20.36,20.36,0,0,0-37.66,0L87.35,77.44,30.76,82A20.45,20.45,0,0,0,19.1,117.88l43.18,37.24-13.2,55.7A20.37,20.37,0,0,0,79.57,233L128,203.19,176.43,233a20.39,20.39,0,0,0,30.49-22.15l-13.2-55.7,43.18-37.24A20.43,20.43,0,0,0,243,96ZM172.53,141.7a12,12,0,0,0-3.84,11.86L181.58,208l-47.29-29.08a12,12,0,0,0-12.58,0L74.42,208l12.89-54.4a12,12,0,0,0-3.84-11.86L41.2,105.24l55.4-4.47a12,12,0,0,0,10.13-7.38L128,41.89l21.27,51.5a12,12,0,0,0,10.13,7.38l55.4,4.47Z',
+ tag: 'M246.15,133.18,146.83,33.86A19.85,19.85,0,0,0,132.69,28H40A12,12,0,0,0,28,40v92.69a19.85,19.85,0,0,0,5.86,14.14l99.32,99.32a20,20,0,0,0,28.28,0l84.69-84.69A20,20,0,0,0,246.15,133.18Zm-98.83,93.17L52,131V52h79l95.32,95.32ZM104,88A16,16,0,1,1,88,72,16,16,0,0,1,104,88Z',
textT: 'M212,56V88a12,12,0,0,1-24,0V68H140V188h20a12,12,0,0,1,0,24H96a12,12,0,0,1,0-24h20V68H68V88a12,12,0,0,1-24,0V56A12,12,0,0,1,56,44H200A12,12,0,0,1,212,56Z',
trash: 'M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z',
trophy: 'M232,60H212V48a12,12,0,0,0-12-12H56A12,12,0,0,0,44,48V60H24A20,20,0,0,0,4,80V96a44.05,44.05,0,0,0,44,44h.77A84.18,84.18,0,0,0,116,195.15V212H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24H140V195.11c30.94-4.51,56.53-26.2,67-55.11h1a44.05,44.05,0,0,0,44-44V80A20,20,0,0,0,232,60ZM28,96V84H44v28c0,1.21,0,2.41.09,3.61A20,20,0,0,1,28,96Zm160,15.1c0,33.33-26.71,60.65-59.54,60.9A60,60,0,0,1,68,112V60H188ZM228,96a20,20,0,0,1-16.12,19.62c.08-1.5.12-3,.12-4.52V84h16Z',
diff --git a/src/hooks/useEdgeHover.ts b/src/hooks/useEdgeHover.ts
index 835ad0a..2d80af1 100644
--- a/src/hooks/useEdgeHover.ts
+++ b/src/hooks/useEdgeHover.ts
@@ -39,6 +39,18 @@ const KEEP_OPEN_PX = PANEL_WIDE - 15 // 255 — clearly inside blade
const START_CLOSE_PX = PANEL_WIDE + 20 // 290 — 20px buffer outside the visual boundary
const BUFFER_PX = 30 // 30px overshoot buffer across adjacent monitors
const PREVIEW_WIDE = 740 // Extended width when preview flyout is active
+/** Keep-open margin past the flyout's far edge (740 = 270 + 12 + 440 + 18). */
+const PREVIEW_EDGE_MARGIN = 18
+
+/**
+ * Side docks: how far from the screen edge an open flyout keeps the shelf
+ * open. An image preview can be wider than the usual 440px; its flyout
+ * publishes how far it reaches, and the zone grows to match (never shrinks).
+ */
+function flyoutWide(state: ReturnType<typeof useStore.getState>): number {
+ const reach = state.previewItemId ? state.previewFlyoutRect?.reach : undefined
+ return reach ? Math.max(PREVIEW_WIDE, reach + PREVIEW_EDGE_MARGIN) : PREVIEW_WIDE
+}
/** Total dwell before a hover opens the shelf: base + the user's Open Delay setting. */
function dwellMsFor(state: { settings: { hoverOpenDelay?: number } }): number {
@@ -111,6 +123,63 @@ export function getHorizontalDockMetrics(
}
}
+/** Extra margin around the card menu that still counts as "on the menu". */
+const CARD_MENU_BUFFER = 12
+
+/**
+ * The main-process cursor poll reports work-area coordinates; the card menu's
+ * box is in window (client) coordinates. The window sits at the work area's
+ * left edge (left dock), right edge (right dock) or 30px left of the dock
+ * (top dock), always at the work area's top.
+ */
+export function cursorToWindow(
+ cursor: { x: number; y: number },
+ stickPosition: 'left' | 'right' | 'top' | undefined,
+ displayWidth: number,
+ windowWidth: number,
+ dockX: number
+): { x: number; y: number } {
+ if (stickPosition === 'right') return { x: cursor.x - (displayWidth - windowWidth), y: cursor.y }
+ if (stickPosition === 'top') return { x: cursor.x - (dockX - 30), y: cursor.y }
+ return { x: cursor.x, y: cursor.y }
+}
+
+/** True while the card menu should hold the shelf open for this cursor. */
+export function cardMenuHolds(
+ menu: { mode: 'menu' | 'edit' } | null,
+ rect: { left: number; top: number; right: number; bottom: number } | null,
+ point: { x: number; y: number },
+ hasKeyboard = false
+): boolean {
+ if (!menu) return false
+ // Typing a label (the shelf holds the keyboard): never close under the
+ // user. An outside click or app switch saves and closes the editor, then
+ // normal hover rules resume. Without the keyboard nobody can be typing, so
+ // the editor counts only where it is, like the menu.
+ if (menu.mode === 'edit' && hasKeyboard) return true
+ if (!rect) return false
+ return (
+ point.x >= rect.left - CARD_MENU_BUFFER &&
+ point.x <= rect.right + CARD_MENU_BUFFER &&
+ point.y >= rect.top - CARD_MENU_BUFFER &&
+ point.y <= rect.bottom + CARD_MENU_BUFFER
+ )
+}
+
+/** Whether the shelf window currently holds OS keyboard focus. */
+function windowHasKeyboard(): boolean {
+ try {
+ return typeof document !== 'undefined' && document.hasFocus()
+ } catch {
+ return false
+ }
+}
+
+/** The label editor is open and the user can actually type into it. */
+function isTypingInCardMenu(state: { cardMenu: { mode: 'menu' | 'edit' } | null }): boolean {
+ return state.cardMenu?.mode === 'edit' && windowHasKeyboard()
+}
+
export function useEdgeHover(): void {
// Throttle the self-healing setInteractive(true) call.
// Without this, it fires at 60Hz (every 16ms) via the cursor-edge poll,
@@ -234,6 +303,7 @@ export function useEdgeHover(): void {
const state = useStore.getState()
if (!state.open) return
if (state.sliderActive || state.edgeTransition?.active) return
+ if (isTypingInCardMenu(state)) return
if (state.dragActive && !state.internalDragReq) return
// If any flyout is open, let it play its exit spring first.
@@ -270,6 +340,7 @@ export function useEdgeHover(): void {
const scheduleClose = (delay = GRACE_MS) => {
const state = useStore.getState()
if (state.sliderActive || state.edgeTransition?.active) return
+ if (isTypingInCardMenu(state)) return
if (state.dragActive && !state.internalDragReq) return
if (graceTimer !== undefined) return // already closing
@@ -282,6 +353,11 @@ export function useEdgeHover(): void {
} else if (_previewClosedByUser) {
effectiveDelay = PREVIEW_CLOSE_STAY_MS
}
+ // The card menu just closed (an action, Escape, a click outside): it
+ // may have left the pointer outside the blade, so give it a moment to
+ // come back before the shelf closes.
+ const menuStayLeft = state.cardMenuStayUntil - Date.now()
+ if (menuStayLeft > 0) effectiveDelay = Math.max(effectiveDelay, menuStayLeft)
graceTimer = window.setTimeout(closePanel, effectiveDelay)
}
@@ -303,6 +379,8 @@ export function useEdgeHover(): void {
if (elapsed >= 1750) {
state.resetPositionChangedTime()
}
+ // Back inside: the post-menu grace has done its job.
+ state.clearCardMenuStay()
if (_previewClosedByUser) {
_previewClosedByUser = false
if (_previewClosedTimer !== undefined) {
@@ -352,9 +430,19 @@ export function useEdgeHover(): void {
// reflow repositions an exiting child out from under the cursor (e.g. on
// expand). So we treat `panel:leave` as a *hint* and only actually close
// if the last known pointer position is genuinely outside the blade.
+ const cursorInWindow = (state: ReturnType<typeof useStore.getState>, point: { x: number; y: number }) => {
+ const s = state.settings
+ const dispW = displaySize.current.width
+ const dockX = s.stickPosition === 'top'
+ ? getHorizontalDockMetrics(dispW, s.horizontalOffset ?? 0.5, s.hotZoneHeight ?? 0.25, s.triggerAlignment || 'center').dockX
+ : 0
+ return cursorToWindow(point, s.stickPosition, dispW, window.innerWidth, dockX)
+ }
+
const isInsideBlade = () => {
const state = useStore.getState()
if (state.sliderActive || state.edgeTransition?.active) return true
+ if (state.cardMenu && cardMenuHolds(state.cardMenu, state.cardMenuRect, cursorInWindow(state, lastClient.current), windowHasKeyboard())) return true
const timeSincePositionChange = state.sliderReleasedTime > 0 ? Date.now() - state.sliderReleasedTime : Infinity
if (timeSincePositionChange < 1750) return true
@@ -362,7 +450,7 @@ export function useEdgeHover(): void {
if (x < -BUFFER_PX || y < 0) return true // unknown — be conservative, don't close
const s = state.settings
const hasFlyout = !!(state.previewItemId || state.styleFlyoutOpen || state.languageFlyoutOpen)
- const currentPanelWide = hasFlyout ? PREVIEW_WIDE : PANEL_WIDE
+ const currentPanelWide = hasFlyout ? flyoutWide(state) : PANEL_WIDE
if (s.stickPosition === 'top') {
const dispW = displaySize.current.width
@@ -441,9 +529,20 @@ export function useEdgeHover(): void {
const state = useStore.getState()
const { stickPosition, displayWidth } = data
const { top, bottom, midY, panelHalfH } = zone.current
+
+ // The card menu (or its label editor) is part of the shelf while open.
+ if (state.open && state.cardMenu && cardMenuHolds(state.cardMenu, state.cardMenuRect, cursorInWindow(state, data), windowHasKeyboard())) {
+ const now = Date.now()
+ if (now - lastSetInteractiveRef.current > 2000) {
+ lastSetInteractiveRef.current = now
+ edge.setInteractive(true)
+ }
+ cancelClose()
+ return
+ }
const hasFlyout = !!(state.previewItemId || state.styleFlyoutOpen || state.languageFlyoutOpen)
- const currentKeepOpenPx = hasFlyout ? PREVIEW_WIDE - 15 : KEEP_OPEN_PX
- const currentStartClosePx = hasFlyout ? PREVIEW_WIDE + 20 : START_CLOSE_PX
+ const currentKeepOpenPx = hasFlyout ? flyoutWide(state) - 15 : KEEP_OPEN_PX
+ const currentStartClosePx = hasFlyout ? flyoutWide(state) + 20 : START_CLOSE_PX
switch (stickPosition) {
case 'top': {
diff --git a/src/hooks/useFilteredItems.ts b/src/hooks/useFilteredItems.ts
index e0e02f7..0d810a4 100644
--- a/src/hooks/useFilteredItems.ts
+++ b/src/hooks/useFilteredItems.ts
@@ -9,24 +9,27 @@ import { useStore } from '../store/appStore'
import type { ClipboardItemDto, TypeFilter } from '../../shared/types'
import { basename, isImagePath } from '../lib/format'
import { parseColor } from '../lib/colorUtils'
+import { matchesTagFilters, metaMatchesText, parseQuery, type ParsedQuery } from '../lib/tagQuery'
-function matches(it: ClipboardItemDto, q: string): boolean {
- if (!q) return true
- const needle = q.toLowerCase()
+function contentMatches(it: ClipboardItemDto, needle: string): boolean {
switch (it.data.kind) {
case 'text':
return it.data.text.toLowerCase().includes(needle)
case 'files':
return it.data.paths.some((p) => basename(p).toLowerCase().includes(needle))
case 'image':
- // images have no searchable text; hidden by query
- return false
case 'image-collection':
- // image collections have no searchable text; hidden by query
+ // No text of their own: found only through a label or tag.
return false
}
}
+export function matches(it: ClipboardItemDto, q: ParsedQuery): boolean {
+ if (!matchesTagFilters(it, q.tags)) return false
+ if (!q.text) return true
+ return contentMatches(it, q.text) || metaMatchesText(it, q.text)
+}
+
/**
* Explorer-copied photos are stored as `files` but belong in Images, not Files.
* Mixed stacks (photo + PDF) stay in Files only.
@@ -89,8 +92,9 @@ export function useFilteredItems(): GroupedItems {
}
})
+ const parsed = parseQuery(query)
for (const it of filteredByTutorial) {
- if (!matches(it, query.trim())) continue
+ if (!matches(it, parsed)) continue
if (!itemMatchesTypeFilter(it, typeFilter)) continue
;(it.pinned ? pinned : recent).push(it)
}
diff --git a/src/hooks/usePresence.ts b/src/hooks/usePresence.ts
new file mode 100644
index 0000000..6f9164b
--- /dev/null
+++ b/src/hooks/usePresence.ts
@@ -0,0 +1,30 @@
+import { useEffect, useRef, useState } from 'react'
+
+/**
+ * Keep something mounted for `exitMs` after `show` turns false, so a CSS exit
+ * animation can play before it unmounts. Replaces AnimatePresence where the
+ * motion itself is plain CSS (compositor-run, no per-frame JS).
+ *
+ * `leaving` is true while the exit plays. Showing again during the exit
+ * cancels it. `onExited` runs once the element has unmounted.
+ */
+export function usePresence(show: boolean, exitMs: number, onExited?: () => void): { mounted: boolean; leaving: boolean } {
+ const [mounted, setMounted] = useState(show)
+ const onExitedRef = useRef(onExited)
+ onExitedRef.current = onExited
+
+ useEffect(() => {
+ if (show) {
+ setMounted(true)
+ return
+ }
+ if (!mounted) return
+ const id = setTimeout(() => {
+ setMounted(false)
+ onExitedRef.current?.()
+ }, exitMs)
+ return () => clearTimeout(id)
+ }, [show, mounted, exitMs])
+
+ return { mounted: show || mounted, leaving: !show && mounted }
+}
diff --git a/src/i18n/index.ts b/src/i18n/index.ts
index d983d51..ebc3219 100644
--- a/src/i18n/index.ts
+++ b/src/i18n/index.ts
@@ -77,7 +77,9 @@ export function t(path: string, params?: Record<string, string | number>): strin
if (params) {
for (const [k, v] of Object.entries(params)) {
- val = val.replace(new RegExp(`\\{${k}\\}`, 'g'), String(v))
+ // Function form: a value containing "$&" / "$1" (e.g. a file name)
+ // is inserted literally instead of as a replacement pattern.
+ val = val.replace(new RegExp(`\\{${k}\\}`, 'g'), () => String(v))
}
}
diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts
index f0e5d4f..b9d0b2e 100644
--- a/src/i18n/translations.ts
+++ b/src/i18n/translations.ts
@@ -184,6 +184,32 @@ export interface TranslationKeys {
clearAll?: string
clearAllConfirm?: string
}
+ /** Card right-click menu and the label / tags editor. */
+ menu?: {
+ title?: string
+ paste?: string
+ pastePlain?: string
+ addLabel?: string
+ editLabel?: string
+ openLink?: string
+ copyCleanLink?: string
+ copyAs?: string
+ showInFolder?: string
+ copyPath?: string
+ copyPaths?: string
+ saveToDownloads?: string
+ preview?: string
+ closePreview?: string
+ label?: string
+ labelPlaceholder?: string
+ tags?: string
+ tagPlaceholder?: string
+ removeTag?: string
+ usedBefore?: string
+ removeAll?: string
+ cancel?: string
+ save?: string
+ }
emoji?: {
open: string
backToClipboard: string
@@ -324,6 +350,11 @@ export interface TranslationKeys {
mergeImagesFull?: string
mergeFilesFull?: string
mergeIncompatible?: string
+ labelPinned?: string
+ labelFailed?: string
+ savedToDownloads?: string
+ savedManyToDownloads?: string
+ saveImagesFailed?: string
}
groups?: {
feedback?: string
@@ -732,6 +763,31 @@ export const en: TranslationKeys = {
"singleFile": "1 file",
"scrollToTop": "Scroll to top"
},
+ "menu": {
+ "title": "Item actions",
+ "paste": "Paste",
+ "pastePlain": "Paste as plain text",
+ "addLabel": "Add label & tags…",
+ "editLabel": "Edit label & tags…",
+ "openLink": "Open link",
+ "copyCleanLink": "Copy clean link",
+ "copyAs": "Copy as",
+ "showInFolder": "Show in folder",
+ "copyPath": "Copy path",
+ "copyPaths": "Copy paths",
+ "saveToDownloads": "Save to Downloads",
+ "preview": "Preview",
+ "closePreview": "Close preview",
+ "label": "Label",
+ "labelPlaceholder": "e.g. Office Wi-Fi",
+ "tags": "Tags",
+ "tagPlaceholder": "Add a tag…",
+ "removeTag": "Remove #{tag}",
+ "usedBefore": "Used before",
+ "removeAll": "Remove all",
+ "cancel": "Cancel",
+ "save": "Save"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Clipboard",
@@ -854,6 +910,11 @@ export const en: TranslationKeys = {
"current": "Current"
},
"toast": {
+ "labelPinned": "Pinned so it's kept",
+ "labelFailed": "Could not save the label. Please try again.",
+ "savedToDownloads": "Saved to Downloads: {name}",
+ "savedManyToDownloads": "Saved {count} images to Downloads",
+ "saveImagesFailed": "Could not save the image",
"copiedToClipboard": "Copied to clipboard",
"itemDeleted": "Item deleted",
"itemPinned": "Item pinned",
@@ -1107,6 +1168,31 @@ export const es: TranslationKeys = {
"clearAll": "Borrar todo el historial",
"clearAllConfirm": "Toca de nuevo para confirmar"
},
+ "menu": {
+ "title": "Acciones del elemento",
+ "paste": "Pegar",
+ "pastePlain": "Pegar como texto sin formato",
+ "addLabel": "Añadir nombre y etiquetas…",
+ "editLabel": "Editar nombre y etiquetas…",
+ "openLink": "Abrir enlace",
+ "copyCleanLink": "Copiar enlace limpio",
+ "copyAs": "Copiar como",
+ "showInFolder": "Mostrar en la carpeta",
+ "copyPath": "Copiar ruta",
+ "copyPaths": "Copiar rutas",
+ "saveToDownloads": "Guardar en Descargas",
+ "preview": "Vista previa",
+ "closePreview": "Cerrar vista previa",
+ "label": "Nombre",
+ "labelPlaceholder": "p. ej. Wi-Fi de la oficina",
+ "tags": "Etiquetas",
+ "tagPlaceholder": "Añadir etiqueta…",
+ "removeTag": "Quitar #{tag}",
+ "usedBefore": "Usadas antes",
+ "removeAll": "Quitar todo",
+ "cancel": "Cancelar",
+ "save": "Guardar"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Portapapeles",
@@ -1228,6 +1314,11 @@ export const es: TranslationKeys = {
"current": "Actual"
},
"toast": {
+ "labelPinned": "Fijado para conservarlo",
+ "labelFailed": "No se pudo guardar el nombre. Inténtalo de nuevo.",
+ "savedToDownloads": "Guardado en Descargas: {name}",
+ "savedManyToDownloads": "{count} imágenes guardadas en Descargas",
+ "saveImagesFailed": "No se pudo guardar la imagen",
"mergeIncompatible": "No se pueden combinar diferentes tipos de elementos",
"mergeFilesFull": "Un paquete de carpetas puede contener un máximo de 10 archivos",
"mergeImagesFull": "Una colección de imágenes puede contener un máximo de 10 elementos",
@@ -1481,6 +1572,31 @@ export const fr: TranslationKeys = {
"clearAll": "Effacer tout l’historique",
"clearAllConfirm": "Appuyez à nouveau pour confirmer"
},
+ "menu": {
+ "title": "Actions de l’élément",
+ "paste": "Coller",
+ "pastePlain": "Coller en texte brut",
+ "addLabel": "Ajouter un nom et des tags…",
+ "editLabel": "Modifier le nom et les tags…",
+ "openLink": "Ouvrir le lien",
+ "copyCleanLink": "Copier le lien nettoyé",
+ "copyAs": "Copier en",
+ "showInFolder": "Afficher dans le dossier",
+ "copyPath": "Copier le chemin",
+ "copyPaths": "Copier les chemins",
+ "saveToDownloads": "Enregistrer dans Téléchargements",
+ "preview": "Aperçu",
+ "closePreview": "Fermer l’aperçu",
+ "label": "Nom",
+ "labelPlaceholder": "ex. Wi-Fi du bureau",
+ "tags": "Tags",
+ "tagPlaceholder": "Ajouter un tag…",
+ "removeTag": "Retirer #{tag}",
+ "usedBefore": "Déjà utilisés",
+ "removeAll": "Tout retirer",
+ "cancel": "Annuler",
+ "save": "Enregistrer"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Presse-papiers",
@@ -1602,6 +1718,11 @@ export const fr: TranslationKeys = {
"current": "Actuel"
},
"toast": {
+ "labelPinned": "Épinglé pour le conserver",
+ "labelFailed": "Impossible d’enregistrer le nom. Réessayez.",
+ "savedToDownloads": "Enregistré dans Téléchargements : {name}",
+ "savedManyToDownloads": "{count} images enregistrées dans Téléchargements",
+ "saveImagesFailed": "Impossible d’enregistrer l’image",
"mergeIncompatible": "Impossible de combiner différents types d'éléments",
"mergeFilesFull": "Un dossier peut contenir au maximum 10 fichiers",
"mergeImagesFull": "Une collection d'images peut contenir au maximum 10 éléments",
@@ -1855,6 +1976,31 @@ export const de: TranslationKeys = {
"clearAll": "Gesamten Verlauf löschen",
"clearAllConfirm": "Zum Bestätigen erneut tippen"
},
+ "menu": {
+ "title": "Element-Aktionen",
+ "paste": "Einfügen",
+ "pastePlain": "Als reinen Text einfügen",
+ "addLabel": "Name & Tags hinzufügen…",
+ "editLabel": "Name & Tags bearbeiten…",
+ "openLink": "Link öffnen",
+ "copyCleanLink": "Bereinigten Link kopieren",
+ "copyAs": "Kopieren als",
+ "showInFolder": "Im Ordner anzeigen",
+ "copyPath": "Pfad kopieren",
+ "copyPaths": "Pfade kopieren",
+ "saveToDownloads": "In Downloads speichern",
+ "preview": "Vorschau",
+ "closePreview": "Vorschau schließen",
+ "label": "Name",
+ "labelPlaceholder": "z. B. Büro-WLAN",
+ "tags": "Tags",
+ "tagPlaceholder": "Tag hinzufügen…",
+ "removeTag": "#{tag} entfernen",
+ "usedBefore": "Bereits verwendet",
+ "removeAll": "Alle entfernen",
+ "cancel": "Abbrechen",
+ "save": "Speichern"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Zwischenablage",
@@ -1976,6 +2122,11 @@ export const de: TranslationKeys = {
"current": "Aktuell"
},
"toast": {
+ "labelPinned": "Angeheftet, damit es erhalten bleibt",
+ "labelFailed": "Name konnte nicht gespeichert werden. Bitte erneut versuchen.",
+ "savedToDownloads": "In Downloads gespeichert: {name}",
+ "savedManyToDownloads": "{count} Bilder in Downloads gespeichert",
+ "saveImagesFailed": "Bild konnte nicht gespeichert werden",
"mergeIncompatible": "Unterschiedliche Elementtypen können nicht kombiniert werden",
"mergeFilesFull": "Ein Ordnerpaket kann maximal 10 Dateien enthalten",
"mergeImagesFull": "Eine Bildsammlung kann maximal 10 Elemente enthalten",
@@ -2229,6 +2380,31 @@ export const it: TranslationKeys = {
"clearAll": "Cancella tutta la cronologia",
"clearAllConfirm": "Tocca di nuovo per confermare"
},
+ "menu": {
+ "title": "Azioni elemento",
+ "paste": "Incolla",
+ "pastePlain": "Incolla come testo semplice",
+ "addLabel": "Aggiungi nome e tag…",
+ "editLabel": "Modifica nome e tag…",
+ "openLink": "Apri link",
+ "copyCleanLink": "Copia link pulito",
+ "copyAs": "Copia come",
+ "showInFolder": "Mostra nella cartella",
+ "copyPath": "Copia percorso",
+ "copyPaths": "Copia percorsi",
+ "saveToDownloads": "Salva in Download",
+ "preview": "Anteprima",
+ "closePreview": "Chiudi anteprima",
+ "label": "Nome",
+ "labelPlaceholder": "es. Wi-Fi dell’ufficio",
+ "tags": "Tag",
+ "tagPlaceholder": "Aggiungi un tag…",
+ "removeTag": "Rimuovi #{tag}",
+ "usedBefore": "Già usati",
+ "removeAll": "Rimuovi tutto",
+ "cancel": "Annulla",
+ "save": "Salva"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Appunti",
@@ -2350,6 +2526,11 @@ export const it: TranslationKeys = {
"current": "Corrente"
},
"toast": {
+ "labelPinned": "Fissato per conservarlo",
+ "labelFailed": "Impossibile salvare il nome. Riprova.",
+ "savedToDownloads": "Salvato in Download: {name}",
+ "savedManyToDownloads": "{count} immagini salvate in Download",
+ "saveImagesFailed": "Impossibile salvare l’immagine",
"mergeIncompatible": "Non è possibile combinare tipi di elementi diversi",
"mergeFilesFull": "Un pacchetto di cartelle può contenere al massimo 10 file",
"mergeImagesFull": "Una raccolta di immagini può contenere al massimo 10 elementi",
@@ -2603,6 +2784,31 @@ export const pt: TranslationKeys = {
"clearAll": "Limpar todo o histórico",
"clearAllConfirm": "Toque novamente para confirmar"
},
+ "menu": {
+ "title": "Ações do item",
+ "paste": "Colar",
+ "pastePlain": "Colar como texto simples",
+ "addLabel": "Adicionar nome e tags…",
+ "editLabel": "Editar nome e tags…",
+ "openLink": "Abrir link",
+ "copyCleanLink": "Copiar link limpo",
+ "copyAs": "Copiar como",
+ "showInFolder": "Mostrar na pasta",
+ "copyPath": "Copiar caminho",
+ "copyPaths": "Copiar caminhos",
+ "saveToDownloads": "Salvar em Downloads",
+ "preview": "Pré-visualizar",
+ "closePreview": "Fechar pré-visualização",
+ "label": "Nome",
+ "labelPlaceholder": "ex.: Wi-Fi do escritório",
+ "tags": "Tags",
+ "tagPlaceholder": "Adicionar tag…",
+ "removeTag": "Remover #{tag}",
+ "usedBefore": "Usadas antes",
+ "removeAll": "Remover tudo",
+ "cancel": "Cancelar",
+ "save": "Salvar"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Área de transferência",
@@ -2724,6 +2930,11 @@ export const pt: TranslationKeys = {
"current": "Atual"
},
"toast": {
+ "labelPinned": "Fixado para ser mantido",
+ "labelFailed": "Não foi possível salvar o nome. Tente novamente.",
+ "savedToDownloads": "Salvo em Downloads: {name}",
+ "savedManyToDownloads": "{count} imagens salvas em Downloads",
+ "saveImagesFailed": "Não foi possível salvar a imagem",
"mergeIncompatible": "Não é possível combinar tipos de itens diferentes",
"mergeFilesFull": "Um pacote de pastas pode conter no máximo 10 arquivos",
"mergeImagesFull": "Uma coleção de imagens pode conter no máximo 10 itens",
@@ -2977,6 +3188,31 @@ export const ru: TranslationKeys = {
"clearAll": "Очистить всю историю",
"clearAllConfirm": "Нажмите ещё раз для подтверждения"
},
+ "menu": {
+ "title": "Действия с элементом",
+ "paste": "Вставить",
+ "pastePlain": "Вставить как обычный текст",
+ "addLabel": "Добавить название и теги…",
+ "editLabel": "Изменить название и теги…",
+ "openLink": "Открыть ссылку",
+ "copyCleanLink": "Копировать чистую ссылку",
+ "copyAs": "Копировать как",
+ "showInFolder": "Показать в папке",
+ "copyPath": "Копировать путь",
+ "copyPaths": "Копировать пути",
+ "saveToDownloads": "Сохранить в «Загрузки»",
+ "preview": "Просмотр",
+ "closePreview": "Закрыть просмотр",
+ "label": "Название",
+ "labelPlaceholder": "напр. Wi-Fi в офисе",
+ "tags": "Теги",
+ "tagPlaceholder": "Добавить тег…",
+ "removeTag": "Удалить #{tag}",
+ "usedBefore": "Использованные ранее",
+ "removeAll": "Удалить всё",
+ "cancel": "Отмена",
+ "save": "Сохранить"
+ },
"emoji": {
"open": "Эмодзи",
"backToClipboard": "Буфер обмена",
@@ -3098,6 +3334,11 @@ export const ru: TranslationKeys = {
"current": "Текущий"
},
"toast": {
+ "labelPinned": "Закреплено, чтобы не потерялось",
+ "labelFailed": "Не удалось сохранить название. Попробуйте ещё раз.",
+ "savedToDownloads": "Сохранено в «Загрузки»: {name}",
+ "savedManyToDownloads": "Сохранено изображений в «Загрузки»: {count}",
+ "saveImagesFailed": "Не удалось сохранить изображение",
"mergeIncompatible": "Нельзя объединять элементы разных типов",
"mergeFilesFull": "Папка может содержать не более 10 файлов",
"mergeImagesFull": "Коллекция изображений может содержать не более 10 элементов",
@@ -3351,6 +3592,31 @@ export const ja: TranslationKeys = {
"clearAll": "履歴をすべて消去",
"clearAllConfirm": "もう一度押して確認します"
},
+ "menu": {
+ "title": "項目の操作",
+ "paste": "貼り付け",
+ "pastePlain": "プレーンテキストとして貼り付け",
+ "addLabel": "名前とタグを追加…",
+ "editLabel": "名前とタグを編集…",
+ "openLink": "リンクを開く",
+ "copyCleanLink": "クリーンなリンクをコピー",
+ "copyAs": "形式を指定してコピー",
+ "showInFolder": "フォルダーに表示",
+ "copyPath": "パスをコピー",
+ "copyPaths": "パスをコピー",
+ "saveToDownloads": "ダウンロードに保存",
+ "preview": "プレビュー",
+ "closePreview": "プレビューを閉じる",
+ "label": "名前",
+ "labelPlaceholder": "例: オフィスの Wi-Fi",
+ "tags": "タグ",
+ "tagPlaceholder": "タグを追加…",
+ "removeTag": "#{tag} を削除",
+ "usedBefore": "使用済み",
+ "removeAll": "すべて削除",
+ "cancel": "キャンセル",
+ "save": "保存"
+ },
"emoji": {
"open": "絵文字",
"backToClipboard": "クリップボード",
@@ -3472,6 +3738,11 @@ export const ja: TranslationKeys = {
"current": "現在"
},
"toast": {
+ "labelPinned": "保持するためにピン留めしました",
+ "labelFailed": "名前を保存できませんでした。もう一度お試しください。",
+ "savedToDownloads": "ダウンロードに保存しました: {name}",
+ "savedManyToDownloads": "{count} 枚の画像をダウンロードに保存しました",
+ "saveImagesFailed": "画像を保存できませんでした",
"mergeIncompatible": "異なる種類の項目を結合できません",
"mergeFilesFull": "フォルダには最大10個のファイルを格納できます",
"mergeImagesFull": "画像コレクションには最大10個まで登録できます",
@@ -3725,6 +3996,31 @@ export const ko: TranslationKeys = {
"clearAll": "전체 기록 지우기",
"clearAllConfirm": "확인하려면 다시 탭하세요"
},
+ "menu": {
+ "title": "항목 작업",
+ "paste": "붙여넣기",
+ "pastePlain": "일반 텍스트로 붙여넣기",
+ "addLabel": "이름 및 태그 추가…",
+ "editLabel": "이름 및 태그 편집…",
+ "openLink": "링크 열기",
+ "copyCleanLink": "깔끔한 링크 복사",
+ "copyAs": "다른 형식으로 복사",
+ "showInFolder": "폴더에서 보기",
+ "copyPath": "경로 복사",
+ "copyPaths": "경로 복사",
+ "saveToDownloads": "다운로드에 저장",
+ "preview": "미리 보기",
+ "closePreview": "미리 보기 닫기",
+ "label": "이름",
+ "labelPlaceholder": "예: 사무실 Wi-Fi",
+ "tags": "태그",
+ "tagPlaceholder": "태그 추가…",
+ "removeTag": "#{tag} 제거",
+ "usedBefore": "이전에 사용함",
+ "removeAll": "모두 제거",
+ "cancel": "취소",
+ "save": "저장"
+ },
"emoji": {
"open": "이모지",
"backToClipboard": "클립보드",
@@ -3846,6 +4142,11 @@ export const ko: TranslationKeys = {
"current": "현재"
},
"toast": {
+ "labelPinned": "보관되도록 고정했습니다",
+ "labelFailed": "이름을 저장하지 못했습니다. 다시 시도하세요.",
+ "savedToDownloads": "다운로드에 저장됨: {name}",
+ "savedManyToDownloads": "이미지 {count}개를 다운로드에 저장했습니다",
+ "saveImagesFailed": "이미지를 저장하지 못했습니다",
"mergeIncompatible": "서로 다른 항목 유형은 결합할 수 없습니다",
"mergeFilesFull": "폴더 묶음에는 최대 10개의 파일을 담을 수 있습니다",
"mergeImagesFull": "이미지 모음에는 최대 10개의 항목을 담을 수 있습니다",
@@ -4099,6 +4400,31 @@ export const zhCN: TranslationKeys = {
"clearAll": "清除所有历史记录",
"clearAllConfirm": "再次点击以确认"
},
+ "menu": {
+ "title": "项目操作",
+ "paste": "粘贴",
+ "pastePlain": "粘贴为纯文本",
+ "addLabel": "添加名称和标签…",
+ "editLabel": "编辑名称和标签…",
+ "openLink": "打开链接",
+ "copyCleanLink": "复制干净链接",
+ "copyAs": "复制为",
+ "showInFolder": "在文件夹中显示",
+ "copyPath": "复制路径",
+ "copyPaths": "复制路径",
+ "saveToDownloads": "保存到“下载”",
+ "preview": "预览",
+ "closePreview": "关闭预览",
+ "label": "名称",
+ "labelPlaceholder": "例如:办公室 Wi-Fi",
+ "tags": "标签",
+ "tagPlaceholder": "添加标签…",
+ "removeTag": "移除 #{tag}",
+ "usedBefore": "用过的",
+ "removeAll": "全部移除",
+ "cancel": "取消",
+ "save": "保存"
+ },
"emoji": {
"open": "表情符号",
"backToClipboard": "剪贴板",
@@ -4220,6 +4546,11 @@ export const zhCN: TranslationKeys = {
"current": "当前"
},
"toast": {
+ "labelPinned": "已固定,以免被删除",
+ "labelFailed": "无法保存名称,请重试。",
+ "savedToDownloads": "已保存到“下载”:{name}",
+ "savedManyToDownloads": "已将 {count} 张图片保存到“下载”",
+ "saveImagesFailed": "无法保存图片",
"mergeIncompatible": "无法组合不同类型的项目",
"mergeFilesFull": "文件夹包最多可包含 10 个文件",
"mergeImagesFull": "图片集合最多可包含 10 个项目",
@@ -4473,6 +4804,31 @@ export const zhTW: TranslationKeys = {
"clearAll": "清除所有歷史記錄",
"clearAllConfirm": "再次點擊以確認"
},
+ "menu": {
+ "title": "項目動作",
+ "paste": "貼上",
+ "pastePlain": "以純文字貼上",
+ "addLabel": "新增名稱與標籤…",
+ "editLabel": "編輯名稱與標籤…",
+ "openLink": "開啟連結",
+ "copyCleanLink": "複製乾淨連結",
+ "copyAs": "複製為",
+ "showInFolder": "在資料夾中顯示",
+ "copyPath": "複製路徑",
+ "copyPaths": "複製路徑",
+ "saveToDownloads": "儲存到「下載」",
+ "preview": "預覽",
+ "closePreview": "關閉預覽",
+ "label": "名稱",
+ "labelPlaceholder": "例如:辦公室 Wi-Fi",
+ "tags": "標籤",
+ "tagPlaceholder": "新增標籤…",
+ "removeTag": "移除 #{tag}",
+ "usedBefore": "用過的",
+ "removeAll": "全部移除",
+ "cancel": "取消",
+ "save": "儲存"
+ },
"emoji": {
"open": "表情符號",
"backToClipboard": "剪貼簿",
@@ -4594,6 +4950,11 @@ export const zhTW: TranslationKeys = {
"current": "目前"
},
"toast": {
+ "labelPinned": "已釘選,以免被刪除",
+ "labelFailed": "無法儲存名稱,請再試一次。",
+ "savedToDownloads": "已儲存到「下載」:{name}",
+ "savedManyToDownloads": "已將 {count} 張圖片儲存到「下載」",
+ "saveImagesFailed": "無法儲存圖片",
"mergeIncompatible": "無法合併不同類型的項目",
"mergeFilesFull": "資料夾套件最多可包含 10 個檔案",
"mergeImagesFull": "圖片集合最多可包含 10 個項目",
@@ -4847,6 +5208,31 @@ export const hi: TranslationKeys = {
"clearAll": "पूरा इतिहास साफ़ करें",
"clearAllConfirm": "पुष्टि करने के लिए फिर से टैप करें"
},
+ "menu": {
+ "title": "आइटम क्रियाएँ",
+ "paste": "पेस्ट करें",
+ "pastePlain": "सादे टेक्स्ट के रूप में पेस्ट करें",
+ "addLabel": "नाम और टैग जोड़ें…",
+ "editLabel": "नाम और टैग बदलें…",
+ "openLink": "लिंक खोलें",
+ "copyCleanLink": "साफ़ लिंक कॉपी करें",
+ "copyAs": "इस रूप में कॉपी करें",
+ "showInFolder": "फ़ोल्डर में दिखाएँ",
+ "copyPath": "पाथ कॉपी करें",
+ "copyPaths": "पाथ कॉपी करें",
+ "saveToDownloads": "डाउनलोड्स में सेव करें",
+ "preview": "प्रीव्यू",
+ "closePreview": "प्रीव्यू बंद करें",
+ "label": "नाम",
+ "labelPlaceholder": "जैसे ऑफ़िस वाई-फ़ाई",
+ "tags": "टैग",
+ "tagPlaceholder": "टैग जोड़ें…",
+ "removeTag": "#{tag} हटाएँ",
+ "usedBefore": "पहले इस्तेमाल किए गए",
+ "removeAll": "सब हटाएँ",
+ "cancel": "रद्द करें",
+ "save": "सेव करें"
+ },
"emoji": {
"open": "इमोजी",
"backToClipboard": "क्लिपबोर्ड",
@@ -4968,6 +5354,11 @@ export const hi: TranslationKeys = {
"current": "वर्तमान"
},
"toast": {
+ "labelPinned": "पिन किया गया ताकि यह बना रहे",
+ "labelFailed": "नाम सेव नहीं हो सका। फिर से कोशिश करें।",
+ "savedToDownloads": "डाउनलोड्स में सेव किया गया: {name}",
+ "savedManyToDownloads": "{count} इमेज डाउनलोड्स में सेव की गईं",
+ "saveImagesFailed": "इमेज सेव नहीं हो सकी",
"mergeIncompatible": "अलग-अलग प्रकार के आइटम संयोजित नहीं किए जा सकते",
"mergeFilesFull": "फ़ोल्डर बंडल में अधिकतम 10 फ़ाइलें हो सकती हैं",
"mergeImagesFull": "चित्र संग्रह में अधिकतम 10 आइटम हो सकते हैं",
@@ -5221,6 +5612,31 @@ export const ar: TranslationKeys = {
"clearAll": "مسح كل السجل",
"clearAllConfirm": "اضغط مرة أخرى للتأكيد"
},
+ "menu": {
+ "title": "إجراءات العنصر",
+ "paste": "لصق",
+ "pastePlain": "لصق كنص عادي",
+ "addLabel": "إضافة اسم ووسوم…",
+ "editLabel": "تعديل الاسم والوسوم…",
+ "openLink": "فتح الرابط",
+ "copyCleanLink": "نسخ رابط نظيف",
+ "copyAs": "نسخ بصيغة",
+ "showInFolder": "إظهار في المجلد",
+ "copyPath": "نسخ المسار",
+ "copyPaths": "نسخ المسارات",
+ "saveToDownloads": "حفظ في التنزيلات",
+ "preview": "معاينة",
+ "closePreview": "إغلاق المعاينة",
+ "label": "الاسم",
+ "labelPlaceholder": "مثل: Wi-Fi المكتب",
+ "tags": "الوسوم",
+ "tagPlaceholder": "إضافة وسم…",
+ "removeTag": "إزالة #{tag}",
+ "usedBefore": "مستخدمة سابقًا",
+ "removeAll": "إزالة الكل",
+ "cancel": "إلغاء",
+ "save": "حفظ"
+ },
"emoji": {
"open": "رموز تعبيرية",
"backToClipboard": "الحافظة",
@@ -5342,6 +5758,11 @@ export const ar: TranslationKeys = {
"current": "الحالي"
},
"toast": {
+ "labelPinned": "تم التثبيت للاحتفاظ به",
+ "labelFailed": "تعذّر حفظ الاسم. حاول مرة أخرى.",
+ "savedToDownloads": "تم الحفظ في التنزيلات: {name}",
+ "savedManyToDownloads": "تم حفظ {count} صور في التنزيلات",
+ "saveImagesFailed": "تعذّر حفظ الصورة",
"mergeIncompatible": "لا يمكن دمج أنواع مختلفة من العناصر",
"mergeFilesFull": "يمكن لحزمة المجلدات أن تحتوي على 10 ملفات كحد أقصى",
"mergeImagesFull": "يمكن لمجموعة الصور أن تحتوي على 10 عناصر كحد أقصى",
@@ -5595,6 +6016,31 @@ export const fa: TranslationKeys = {
"clearAll": "پاک کردن کل تاریخچه",
"clearAllConfirm": "برای تأیید دوباره ضربه بزنید"
},
+ "menu": {
+ "title": "عملیات مورد",
+ "paste": "جای‌گذاری",
+ "pastePlain": "جای‌گذاری به‌صورت متن ساده",
+ "addLabel": "افزودن نام و برچسب…",
+ "editLabel": "ویرایش نام و برچسب…",
+ "openLink": "باز کردن پیوند",
+ "copyCleanLink": "کپی پیوند تمیز",
+ "copyAs": "کپی به‌صورت",
+ "showInFolder": "نمایش در پوشه",
+ "copyPath": "کپی مسیر",
+ "copyPaths": "کپی مسیرها",
+ "saveToDownloads": "ذخیره در دانلودها",
+ "preview": "پیش‌نمایش",
+ "closePreview": "بستن پیش‌نمایش",
+ "label": "نام",
+ "labelPlaceholder": "مثلاً Wi-Fi دفتر",
+ "tags": "برچسب‌ها",
+ "tagPlaceholder": "افزودن برچسب…",
+ "removeTag": "حذف #{tag}",
+ "usedBefore": "استفاده‌شده",
+ "removeAll": "حذف همه",
+ "cancel": "لغو",
+ "save": "ذخیره"
+ },
"emoji": {
"open": "ایموجی",
"backToClipboard": "کلیپبورد",
@@ -5716,6 +6162,11 @@ export const fa: TranslationKeys = {
"current": "فعلی"
},
"toast": {
+ "labelPinned": "سنجاق شد تا نگه داشته شود",
+ "labelFailed": "ذخیرهٔ نام ممکن نشد. دوباره تلاش کنید.",
+ "savedToDownloads": "در دانلودها ذخیره شد: {name}",
+ "savedManyToDownloads": "{count} تصویر در دانلودها ذخیره شد",
+ "saveImagesFailed": "ذخیرهٔ تصویر ممکن نشد",
"mergeIncompatible": "ترکیب انواع مختلف موارد ممکن نیست",
"mergeFilesFull": "بسته پوشه حداکثر می‌تواند ۱۰ فایل داشته باشد",
"mergeImagesFull": "مجموعه تصاویر حداکثر می‌تواند ۱۰ مورد داشته باشد",
@@ -5969,6 +6420,31 @@ export const bn: TranslationKeys = {
"clearAll": "সব ইতিহাস মুছুন",
"clearAllConfirm": "নিশ্চিত করতে আবার ট্যাপ করুন"
},
+ "menu": {
+ "title": "আইটেমের কাজ",
+ "paste": "পেস্ট করুন",
+ "pastePlain": "সাধারণ টেক্সট হিসেবে পেস্ট করুন",
+ "addLabel": "নাম ও ট্যাগ যোগ করুন…",
+ "editLabel": "নাম ও ট্যাগ সম্পাদনা করুন…",
+ "openLink": "লিঙ্ক খুলুন",
+ "copyCleanLink": "পরিষ্কার লিঙ্ক কপি করুন",
+ "copyAs": "যেভাবে কপি করবেন",
+ "showInFolder": "ফোল্ডারে দেখান",
+ "copyPath": "পাথ কপি করুন",
+ "copyPaths": "পাথগুলো কপি করুন",
+ "saveToDownloads": "ডাউনলোডসে সেভ করুন",
+ "preview": "প্রিভিউ",
+ "closePreview": "প্রিভিউ বন্ধ করুন",
+ "label": "নাম",
+ "labelPlaceholder": "যেমন অফিসের ওয়াই-ফাই",
+ "tags": "ট্যাগ",
+ "tagPlaceholder": "ট্যাগ যোগ করুন…",
+ "removeTag": "#{tag} সরান",
+ "usedBefore": "আগে ব্যবহৃত",
+ "removeAll": "সব সরান",
+ "cancel": "বাতিল",
+ "save": "সেভ করুন"
+ },
"emoji": {
"open": "ইমোজি",
"backToClipboard": "ক্লিপবোর্ড",
@@ -6090,6 +6566,11 @@ export const bn: TranslationKeys = {
"current": "বর্তমান"
},
"toast": {
+ "labelPinned": "রাখার জন্য পিন করা হয়েছে",
+ "labelFailed": "নাম সেভ করা যায়নি। আবার চেষ্টা করুন।",
+ "savedToDownloads": "ডাউনলোডসে সেভ হয়েছে: {name}",
+ "savedManyToDownloads": "{count}টি ছবি ডাউনলোডসে সেভ হয়েছে",
+ "saveImagesFailed": "ছবি সেভ করা যায়নি",
"mergeIncompatible": "ভিন্ন ধরনের আইটেম একত্র করা যায় না",
"mergeFilesFull": "একটি ফোল্ডার বান্ডেলে সর্বোচ্চ ১০টি ফাইল থাকতে পারে",
"mergeImagesFull": "একটি ছবি সংগ্রহে সর্বোচ্চ ১০টি আইটেম থাকতে পারে",
@@ -6343,6 +6824,31 @@ export const tr: TranslationKeys = {
"clearAll": "Tüm geçmişi temizle",
"clearAllConfirm": "Onaylamak için tekrar dokunun"
},
+ "menu": {
+ "title": "Öğe işlemleri",
+ "paste": "Yapıştır",
+ "pastePlain": "Düz metin olarak yapıştır",
+ "addLabel": "Ad ve etiket ekle…",
+ "editLabel": "Adı ve etiketleri düzenle…",
+ "openLink": "Bağlantıyı aç",
+ "copyCleanLink": "Temiz bağlantıyı kopyala",
+ "copyAs": "Şu biçimde kopyala",
+ "showInFolder": "Klasörde göster",
+ "copyPath": "Yolu kopyala",
+ "copyPaths": "Yolları kopyala",
+ "saveToDownloads": "İndirilenler'e kaydet",
+ "preview": "Önizleme",
+ "closePreview": "Önizlemeyi kapat",
+ "label": "Ad",
+ "labelPlaceholder": "ör. Ofis Wi-Fi",
+ "tags": "Etiketler",
+ "tagPlaceholder": "Etiket ekle…",
+ "removeTag": "#{tag} kaldır",
+ "usedBefore": "Daha önce kullanılanlar",
+ "removeAll": "Tümünü kaldır",
+ "cancel": "İptal",
+ "save": "Kaydet"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Pano",
@@ -6464,6 +6970,11 @@ export const tr: TranslationKeys = {
"current": "Geçerli"
},
"toast": {
+ "labelPinned": "Saklanması için sabitlendi",
+ "labelFailed": "Ad kaydedilemedi. Lütfen tekrar deneyin.",
+ "savedToDownloads": "İndirilenler'e kaydedildi: {name}",
+ "savedManyToDownloads": "{count} görsel İndirilenler'e kaydedildi",
+ "saveImagesFailed": "Görsel kaydedilemedi",
"mergeIncompatible": "Farklı öğe türleri birleştirilemez",
"mergeFilesFull": "Bir klasör paketi en fazla 10 dosya içerebilir",
"mergeImagesFull": "Bir resim koleksiyonu en fazla 10 öğe içerebilir",
@@ -6717,6 +7228,31 @@ export const vi: TranslationKeys = {
"clearAll": "Xóa toàn bộ lịch sử",
"clearAllConfirm": "Nhấn lại để xác nhận"
},
+ "menu": {
+ "title": "Thao tác mục",
+ "paste": "Dán",
+ "pastePlain": "Dán dạng văn bản thuần",
+ "addLabel": "Thêm tên và thẻ…",
+ "editLabel": "Sửa tên và thẻ…",
+ "openLink": "Mở liên kết",
+ "copyCleanLink": "Sao chép liên kết sạch",
+ "copyAs": "Sao chép dạng",
+ "showInFolder": "Hiện trong thư mục",
+ "copyPath": "Sao chép đường dẫn",
+ "copyPaths": "Sao chép các đường dẫn",
+ "saveToDownloads": "Lưu vào Tải xuống",
+ "preview": "Xem trước",
+ "closePreview": "Đóng xem trước",
+ "label": "Tên",
+ "labelPlaceholder": "vd. Wi-Fi văn phòng",
+ "tags": "Thẻ",
+ "tagPlaceholder": "Thêm thẻ…",
+ "removeTag": "Xóa #{tag}",
+ "usedBefore": "Đã dùng trước đây",
+ "removeAll": "Xóa tất cả",
+ "cancel": "Hủy",
+ "save": "Lưu"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Bảng tạm",
@@ -6838,6 +7374,11 @@ export const vi: TranslationKeys = {
"current": "Hiện tại"
},
"toast": {
+ "labelPinned": "Đã ghim để giữ lại",
+ "labelFailed": "Không thể lưu tên. Vui lòng thử lại.",
+ "savedToDownloads": "Đã lưu vào Tải xuống: {name}",
+ "savedManyToDownloads": "Đã lưu {count} ảnh vào Tải xuống",
+ "saveImagesFailed": "Không thể lưu ảnh",
"mergeIncompatible": "Không thể kết hợp các loại mục khác nhau",
"mergeFilesFull": "Một gói thư mục có thể chứa tối đa 10 tệp",
"mergeImagesFull": "Một bộ sưu tập hình ảnh có thể chứa tối đa 10 mục",
@@ -7091,6 +7632,31 @@ export const pl: TranslationKeys = {
"clearAll": "Wyczyść całą historię",
"clearAllConfirm": "Dotknij ponownie, aby potwierdzić"
},
+ "menu": {
+ "title": "Akcje elementu",
+ "paste": "Wklej",
+ "pastePlain": "Wklej jako zwykły tekst",
+ "addLabel": "Dodaj nazwę i tagi…",
+ "editLabel": "Edytuj nazwę i tagi…",
+ "openLink": "Otwórz link",
+ "copyCleanLink": "Kopiuj czysty link",
+ "copyAs": "Kopiuj jako",
+ "showInFolder": "Pokaż w folderze",
+ "copyPath": "Kopiuj ścieżkę",
+ "copyPaths": "Kopiuj ścieżki",
+ "saveToDownloads": "Zapisz w Pobranych",
+ "preview": "Podgląd",
+ "closePreview": "Zamknij podgląd",
+ "label": "Nazwa",
+ "labelPlaceholder": "np. Wi-Fi w biurze",
+ "tags": "Tagi",
+ "tagPlaceholder": "Dodaj tag…",
+ "removeTag": "Usuń #{tag}",
+ "usedBefore": "Używane wcześniej",
+ "removeAll": "Usuń wszystko",
+ "cancel": "Anuluj",
+ "save": "Zapisz"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Schowek",
@@ -7212,6 +7778,11 @@ export const pl: TranslationKeys = {
"current": "Bieżący"
},
"toast": {
+ "labelPinned": "Przypięto, aby zostało zachowane",
+ "labelFailed": "Nie udało się zapisać nazwy. Spróbuj ponownie.",
+ "savedToDownloads": "Zapisano w Pobranych: {name}",
+ "savedManyToDownloads": "Zapisane obrazy w Pobranych: {count}",
+ "saveImagesFailed": "Nie udało się zapisać obrazu",
"mergeIncompatible": "Nie można łączyć elementów różnych typów",
"mergeFilesFull": "Pakiet folderów może zawierać maksymalnie 10 plików",
"mergeImagesFull": "Kolekcja obrazów może zawierać maksymalnie 10 elementów",
@@ -7465,6 +8036,31 @@ export const nl: TranslationKeys = {
"clearAll": "Volledige geschiedenis wissen",
"clearAllConfirm": "Tik opnieuw om te bevestigen"
},
+ "menu": {
+ "title": "Itemacties",
+ "paste": "Plakken",
+ "pastePlain": "Plakken als platte tekst",
+ "addLabel": "Naam en tags toevoegen…",
+ "editLabel": "Naam en tags bewerken…",
+ "openLink": "Link openen",
+ "copyCleanLink": "Opgeschoonde link kopiëren",
+ "copyAs": "Kopiëren als",
+ "showInFolder": "Weergeven in map",
+ "copyPath": "Pad kopiëren",
+ "copyPaths": "Paden kopiëren",
+ "saveToDownloads": "Opslaan in Downloads",
+ "preview": "Voorbeeld",
+ "closePreview": "Voorbeeld sluiten",
+ "label": "Naam",
+ "labelPlaceholder": "bijv. Wifi op kantoor",
+ "tags": "Tags",
+ "tagPlaceholder": "Tag toevoegen…",
+ "removeTag": "#{tag} verwijderen",
+ "usedBefore": "Eerder gebruikt",
+ "removeAll": "Alles verwijderen",
+ "cancel": "Annuleren",
+ "save": "Opslaan"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Klembord",
@@ -7586,6 +8182,11 @@ export const nl: TranslationKeys = {
"current": "Huidig"
},
"toast": {
+ "labelPinned": "Vastgezet zodat het bewaard blijft",
+ "labelFailed": "Naam kon niet worden opgeslagen. Probeer het opnieuw.",
+ "savedToDownloads": "Opgeslagen in Downloads: {name}",
+ "savedManyToDownloads": "{count} afbeeldingen opgeslagen in Downloads",
+ "saveImagesFailed": "Afbeelding kon niet worden opgeslagen",
"mergeIncompatible": "Verschillende itemtypen kunnen niet worden gecombineerd",
"mergeFilesFull": "Een mappakket kan maximaal 10 bestanden bevatten",
"mergeImagesFull": "Een afbeeldingsverzameling kan maximaal 10 items bevatten",
@@ -7839,6 +8440,31 @@ export const sv: TranslationKeys = {
"clearAll": "Rensa all historik",
"clearAllConfirm": "Tryck igen för att bekräfta"
},
+ "menu": {
+ "title": "Objektåtgärder",
+ "paste": "Klistra in",
+ "pastePlain": "Klistra in som oformaterad text",
+ "addLabel": "Lägg till namn och taggar…",
+ "editLabel": "Redigera namn och taggar…",
+ "openLink": "Öppna länk",
+ "copyCleanLink": "Kopiera ren länk",
+ "copyAs": "Kopiera som",
+ "showInFolder": "Visa i mapp",
+ "copyPath": "Kopiera sökväg",
+ "copyPaths": "Kopiera sökvägar",
+ "saveToDownloads": "Spara i Hämtade filer",
+ "preview": "Förhandsgranska",
+ "closePreview": "Stäng förhandsgranskning",
+ "label": "Namn",
+ "labelPlaceholder": "t.ex. Kontorets wifi",
+ "tags": "Taggar",
+ "tagPlaceholder": "Lägg till tagg…",
+ "removeTag": "Ta bort #{tag}",
+ "usedBefore": "Använda tidigare",
+ "removeAll": "Ta bort alla",
+ "cancel": "Avbryt",
+ "save": "Spara"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Urklipp",
@@ -7960,6 +8586,11 @@ export const sv: TranslationKeys = {
"current": "Aktuell"
},
"toast": {
+ "labelPinned": "Fäst så att den sparas",
+ "labelFailed": "Det gick inte att spara namnet. Försök igen.",
+ "savedToDownloads": "Sparad i Hämtade filer: {name}",
+ "savedManyToDownloads": "{count} bilder sparade i Hämtade filer",
+ "saveImagesFailed": "Det gick inte att spara bilden",
"mergeIncompatible": "Olika objekttyper kan inte kombineras",
"mergeFilesFull": "Ett mappaket kan innehålla högst 10 filer",
"mergeImagesFull": "En bildsamling kan innehålla högst 10 objekt",
@@ -8213,6 +8844,31 @@ export const id: TranslationKeys = {
"clearAll": "Hapus semua riwayat",
"clearAllConfirm": "Ketuk lagi untuk mengonfirmasi"
},
+ "menu": {
+ "title": "Tindakan item",
+ "paste": "Tempel",
+ "pastePlain": "Tempel sebagai teks biasa",
+ "addLabel": "Tambah nama & tag…",
+ "editLabel": "Edit nama & tag…",
+ "openLink": "Buka tautan",
+ "copyCleanLink": "Salin tautan bersih",
+ "copyAs": "Salin sebagai",
+ "showInFolder": "Tampilkan di folder",
+ "copyPath": "Salin jalur",
+ "copyPaths": "Salin jalur",
+ "saveToDownloads": "Simpan ke Unduhan",
+ "preview": "Pratinjau",
+ "closePreview": "Tutup pratinjau",
+ "label": "Nama",
+ "labelPlaceholder": "mis. Wi-Fi kantor",
+ "tags": "Tag",
+ "tagPlaceholder": "Tambah tag…",
+ "removeTag": "Hapus #{tag}",
+ "usedBefore": "Pernah dipakai",
+ "removeAll": "Hapus semua",
+ "cancel": "Batal",
+ "save": "Simpan"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Papan klip",
@@ -8334,6 +8990,11 @@ export const id: TranslationKeys = {
"current": "Saat ini"
},
"toast": {
+ "labelPinned": "Disematkan agar tetap tersimpan",
+ "labelFailed": "Gagal menyimpan nama. Coba lagi.",
+ "savedToDownloads": "Disimpan ke Unduhan: {name}",
+ "savedManyToDownloads": "{count} gambar disimpan ke Unduhan",
+ "saveImagesFailed": "Gagal menyimpan gambar",
"mergeIncompatible": "Tidak dapat menggabungkan jenis item yang berbeda",
"mergeFilesFull": "Paket folder dapat berisi maksimal 10 file",
"mergeImagesFull": "Koleksi gambar dapat berisi maksimal 10 item",
@@ -8587,6 +9248,31 @@ export const uk: TranslationKeys = {
"clearAll": "Очистити всю історію",
"clearAllConfirm": "Натисніть ще раз для підтвердження"
},
+ "menu": {
+ "title": "Дії з елементом",
+ "paste": "Вставити",
+ "pastePlain": "Вставити як звичайний текст",
+ "addLabel": "Додати назву й теги…",
+ "editLabel": "Змінити назву й теги…",
+ "openLink": "Відкрити посилання",
+ "copyCleanLink": "Копіювати чисте посилання",
+ "copyAs": "Копіювати як",
+ "showInFolder": "Показати в теці",
+ "copyPath": "Копіювати шлях",
+ "copyPaths": "Копіювати шляхи",
+ "saveToDownloads": "Зберегти в «Завантаження»",
+ "preview": "Перегляд",
+ "closePreview": "Закрити перегляд",
+ "label": "Назва",
+ "labelPlaceholder": "напр. Wi-Fi в офісі",
+ "tags": "Теги",
+ "tagPlaceholder": "Додати тег…",
+ "removeTag": "Прибрати #{tag}",
+ "usedBefore": "Використані раніше",
+ "removeAll": "Прибрати все",
+ "cancel": "Скасувати",
+ "save": "Зберегти"
+ },
"emoji": {
"open": "Емодзі",
"backToClipboard": "Буфер обміну",
@@ -8708,6 +9394,11 @@ export const uk: TranslationKeys = {
"current": "Поточний"
},
"toast": {
+ "labelPinned": "Закріплено, щоб не загубилося",
+ "labelFailed": "Не вдалося зберегти назву. Спробуйте ще раз.",
+ "savedToDownloads": "Збережено в «Завантаження»: {name}",
+ "savedManyToDownloads": "Збережено зображень у «Завантаження»: {count}",
+ "saveImagesFailed": "Не вдалося зберегти зображення",
"mergeIncompatible": "Не можна об'єднувати елементи різних типів",
"mergeFilesFull": "Пакет папки може містити максимум 10 файлів",
"mergeImagesFull": "Колекція зображень може містити максимум 10 елементів",
@@ -8961,6 +9652,31 @@ export const el: TranslationKeys = {
"clearAll": "Εκκαθάριση όλου του ιστορικού",
"clearAllConfirm": "Πατήστε ξανά για επιβεβαίωση"
},
+ "menu": {
+ "title": "Ενέργειες στοιχείου",
+ "paste": "Επικόλληση",
+ "pastePlain": "Επικόλληση ως απλό κείμενο",
+ "addLabel": "Προσθήκη ονόματος και ετικετών…",
+ "editLabel": "Επεξεργασία ονόματος και ετικετών…",
+ "openLink": "Άνοιγμα συνδέσμου",
+ "copyCleanLink": "Αντιγραφή καθαρού συνδέσμου",
+ "copyAs": "Αντιγραφή ως",
+ "showInFolder": "Εμφάνιση στον φάκελο",
+ "copyPath": "Αντιγραφή διαδρομής",
+ "copyPaths": "Αντιγραφή διαδρομών",
+ "saveToDownloads": "Αποθήκευση στις Λήψεις",
+ "preview": "Προεπισκόπηση",
+ "closePreview": "Κλείσιμο προεπισκόπησης",
+ "label": "Όνομα",
+ "labelPlaceholder": "π.χ. Wi-Fi γραφείου",
+ "tags": "Ετικέτες",
+ "tagPlaceholder": "Προσθήκη ετικέτας…",
+ "removeTag": "Αφαίρεση #{tag}",
+ "usedBefore": "Έχουν χρησιμοποιηθεί",
+ "removeAll": "Αφαίρεση όλων",
+ "cancel": "Ακύρωση",
+ "save": "Αποθήκευση"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Πρόχειρο",
@@ -9082,6 +9798,11 @@ export const el: TranslationKeys = {
"current": "Τρέχον"
},
"toast": {
+ "labelPinned": "Καρφιτσώθηκε για να διατηρηθεί",
+ "labelFailed": "Δεν ήταν δυνατή η αποθήκευση του ονόματος. Δοκιμάστε ξανά.",
+ "savedToDownloads": "Αποθηκεύτηκε στις Λήψεις: {name}",
+ "savedManyToDownloads": "Αποθηκεύτηκαν {count} εικόνες στις Λήψεις",
+ "saveImagesFailed": "Δεν ήταν δυνατή η αποθήκευση της εικόνας",
"mergeIncompatible": "Δεν είναι δυνατός ο συνδυασμός διαφορετικών τύπων στοιχείων",
"mergeFilesFull": "Ένα πακέτο φακέλου μπορεί να περιέχει έως 10 αρχεία",
"mergeImagesFull": "Μια συλλογή εικόνων μπορεί να περιέχει έως 10 στοιχεία",
@@ -9335,6 +10056,31 @@ export const cs: TranslationKeys = {
"clearAll": "Vymazat celou historii",
"clearAllConfirm": "Potvrďte dalším klepnutím"
},
+ "menu": {
+ "title": "Akce položky",
+ "paste": "Vložit",
+ "pastePlain": "Vložit jako prostý text",
+ "addLabel": "Přidat název a štítky…",
+ "editLabel": "Upravit název a štítky…",
+ "openLink": "Otevřít odkaz",
+ "copyCleanLink": "Kopírovat čistý odkaz",
+ "copyAs": "Kopírovat jako",
+ "showInFolder": "Zobrazit ve složce",
+ "copyPath": "Kopírovat cestu",
+ "copyPaths": "Kopírovat cesty",
+ "saveToDownloads": "Uložit do Stažených souborů",
+ "preview": "Náhled",
+ "closePreview": "Zavřít náhled",
+ "label": "Název",
+ "labelPlaceholder": "např. Wi-Fi v kanceláři",
+ "tags": "Štítky",
+ "tagPlaceholder": "Přidat štítek…",
+ "removeTag": "Odebrat #{tag}",
+ "usedBefore": "Dříve použité",
+ "removeAll": "Odebrat vše",
+ "cancel": "Zrušit",
+ "save": "Uložit"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Schránka",
@@ -9456,6 +10202,11 @@ export const cs: TranslationKeys = {
"current": "Aktuální"
},
"toast": {
+ "labelPinned": "Připnuto, aby se zachovalo",
+ "labelFailed": "Název se nepodařilo uložit. Zkuste to znovu.",
+ "savedToDownloads": "Uloženo do Stažených souborů: {name}",
+ "savedManyToDownloads": "Uložené obrázky ve Stažených souborech: {count}",
+ "saveImagesFailed": "Obrázek se nepodařilo uložit",
"mergeIncompatible": "Nelze kombinovat různé typy položek",
"mergeFilesFull": "Balíček složky může obsahovat maximálně 10 souborů",
"mergeImagesFull": "Kolekce obrázků může obsahovat maximálně 10 položek",
@@ -9709,6 +10460,31 @@ export const ro: TranslationKeys = {
"clearAll": "Șterge tot istoricul",
"clearAllConfirm": "Atinge din nou pentru confirmare"
},
+ "menu": {
+ "title": "Acțiuni element",
+ "paste": "Lipește",
+ "pastePlain": "Lipește ca text simplu",
+ "addLabel": "Adaugă nume și etichete…",
+ "editLabel": "Editează numele și etichetele…",
+ "openLink": "Deschide linkul",
+ "copyCleanLink": "Copiază linkul curat",
+ "copyAs": "Copiază ca",
+ "showInFolder": "Arată în dosar",
+ "copyPath": "Copiază calea",
+ "copyPaths": "Copiază căile",
+ "saveToDownloads": "Salvează în Descărcări",
+ "preview": "Previzualizare",
+ "closePreview": "Închide previzualizarea",
+ "label": "Nume",
+ "labelPlaceholder": "ex. Wi-Fi birou",
+ "tags": "Etichete",
+ "tagPlaceholder": "Adaugă o etichetă…",
+ "removeTag": "Elimină #{tag}",
+ "usedBefore": "Folosite anterior",
+ "removeAll": "Elimină tot",
+ "cancel": "Anulează",
+ "save": "Salvează"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Clipboard",
@@ -9830,6 +10606,11 @@ export const ro: TranslationKeys = {
"current": "Curent"
},
"toast": {
+ "labelPinned": "Fixat ca să fie păstrat",
+ "labelFailed": "Numele nu a putut fi salvat. Încearcă din nou.",
+ "savedToDownloads": "Salvat în Descărcări: {name}",
+ "savedManyToDownloads": "{count} imagini salvate în Descărcări",
+ "saveImagesFailed": "Imaginea nu a putut fi salvată",
"mergeIncompatible": "Tipurile diferite de elemente nu pot fi combinate",
"mergeFilesFull": "Un pachet de dosare poate conține maximum 10 fișiere",
"mergeImagesFull": "O colecție de imagini poate conține maximum 10 elemente",
@@ -10083,6 +10864,31 @@ export const hu: TranslationKeys = {
"clearAll": "Teljes előzmény törlése",
"clearAllConfirm": "Koppintson újra a megerősítéshez"
},
+ "menu": {
+ "title": "Elemműveletek",
+ "paste": "Beillesztés",
+ "pastePlain": "Beillesztés egyszerű szövegként",
+ "addLabel": "Név és címkék hozzáadása…",
+ "editLabel": "Név és címkék szerkesztése…",
+ "openLink": "Hivatkozás megnyitása",
+ "copyCleanLink": "Tiszta hivatkozás másolása",
+ "copyAs": "Másolás mint",
+ "showInFolder": "Megjelenítés a mappában",
+ "copyPath": "Elérési út másolása",
+ "copyPaths": "Elérési utak másolása",
+ "saveToDownloads": "Mentés a Letöltésekbe",
+ "preview": "Előnézet",
+ "closePreview": "Előnézet bezárása",
+ "label": "Név",
+ "labelPlaceholder": "pl. Irodai Wi-Fi",
+ "tags": "Címkék",
+ "tagPlaceholder": "Címke hozzáadása…",
+ "removeTag": "#{tag} eltávolítása",
+ "usedBefore": "Korábban használt",
+ "removeAll": "Összes eltávolítása",
+ "cancel": "Mégse",
+ "save": "Mentés"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Vágólap",
@@ -10204,6 +11010,11 @@ export const hu: TranslationKeys = {
"current": "Jelenlegi"
},
"toast": {
+ "labelPinned": "Rögzítve, hogy megmaradjon",
+ "labelFailed": "A nevet nem sikerült menteni. Próbáld újra.",
+ "savedToDownloads": "Mentve a Letöltésekbe: {name}",
+ "savedManyToDownloads": "{count} kép mentve a Letöltésekbe",
+ "saveImagesFailed": "A képet nem sikerült menteni",
"mergeIncompatible": "Különböző típusú elemek nem kombinálhatók",
"mergeFilesFull": "Egy mappacsomag legfeljebb 10 fájlt tartalmazhat",
"mergeImagesFull": "Egy képgyűjtemény legfeljebb 10 elemet tartalmazhat",
@@ -10457,6 +11268,31 @@ export const da: TranslationKeys = {
"clearAll": "Ryd hele historikken",
"clearAllConfirm": "Tryk igen for at bekræfte"
},
+ "menu": {
+ "title": "Elementhandlinger",
+ "paste": "Indsæt",
+ "pastePlain": "Indsæt som ren tekst",
+ "addLabel": "Tilføj navn og tags…",
+ "editLabel": "Rediger navn og tags…",
+ "openLink": "Åbn link",
+ "copyCleanLink": "Kopiér rent link",
+ "copyAs": "Kopiér som",
+ "showInFolder": "Vis i mappe",
+ "copyPath": "Kopiér sti",
+ "copyPaths": "Kopiér stier",
+ "saveToDownloads": "Gem i Overførsler",
+ "preview": "Eksempel",
+ "closePreview": "Luk eksempel",
+ "label": "Navn",
+ "labelPlaceholder": "f.eks. Kontorets wi-fi",
+ "tags": "Tags",
+ "tagPlaceholder": "Tilføj tag…",
+ "removeTag": "Fjern #{tag}",
+ "usedBefore": "Brugt før",
+ "removeAll": "Fjern alle",
+ "cancel": "Annuller",
+ "save": "Gem"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Udklipsholder",
@@ -10578,6 +11414,11 @@ export const da: TranslationKeys = {
"current": "Nuværende"
},
"toast": {
+ "labelPinned": "Fastgjort, så det bevares",
+ "labelFailed": "Navnet kunne ikke gemmes. Prøv igen.",
+ "savedToDownloads": "Gemt i Overførsler: {name}",
+ "savedManyToDownloads": "{count} billeder gemt i Overførsler",
+ "saveImagesFailed": "Billedet kunne ikke gemmes",
"mergeIncompatible": "Forskellige elementtyper kan ikke kombineres",
"mergeFilesFull": "En mappepakke kan indeholde højst 10 filer",
"mergeImagesFull": "En billedsamling kan indeholde højst 10 elementer",
@@ -10831,6 +11672,31 @@ export const fi: TranslationKeys = {
"clearAll": "Tyhjennä koko historia",
"clearAllConfirm": "Vahvista napauttamalla uudelleen"
},
+ "menu": {
+ "title": "Kohteen toiminnot",
+ "paste": "Liitä",
+ "pastePlain": "Liitä pelkkänä tekstinä",
+ "addLabel": "Lisää nimi ja tunnisteet…",
+ "editLabel": "Muokkaa nimeä ja tunnisteita…",
+ "openLink": "Avaa linkki",
+ "copyCleanLink": "Kopioi siistitty linkki",
+ "copyAs": "Kopioi muodossa",
+ "showInFolder": "Näytä kansiossa",
+ "copyPath": "Kopioi polku",
+ "copyPaths": "Kopioi polut",
+ "saveToDownloads": "Tallenna Ladatut tiedostot -kansioon",
+ "preview": "Esikatselu",
+ "closePreview": "Sulje esikatselu",
+ "label": "Nimi",
+ "labelPlaceholder": "esim. Toimiston Wi-Fi",
+ "tags": "Tunnisteet",
+ "tagPlaceholder": "Lisää tunniste…",
+ "removeTag": "Poista #{tag}",
+ "usedBefore": "Aiemmin käytetyt",
+ "removeAll": "Poista kaikki",
+ "cancel": "Peruuta",
+ "save": "Tallenna"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Leikepöytä",
@@ -10952,6 +11818,11 @@ export const fi: TranslationKeys = {
"current": "Nykyinen"
},
"toast": {
+ "labelPinned": "Kiinnitetty, jotta se säilyy",
+ "labelFailed": "Nimeä ei voitu tallentaa. Yritä uudelleen.",
+ "savedToDownloads": "Tallennettu Ladatut tiedostot -kansioon: {name}",
+ "savedManyToDownloads": "{count} kuvaa tallennettu Ladatut tiedostot -kansioon",
+ "saveImagesFailed": "Kuvaa ei voitu tallentaa",
"mergeIncompatible": "Eri kohdetyyppejä ei voi yhdistää",
"mergeFilesFull": "Kansiopaketti voi sisältää enintään 10 tiedostoa",
"mergeImagesFull": "Kuvakokoelma voi sisältää enintään 10 kohdetta",
@@ -11205,6 +12076,31 @@ export const th: TranslationKeys = {
"clearAll": "ล้างประวัติทั้งหมด",
"clearAllConfirm": "แตะอีกครั้งเพื่อยืนยัน"
},
+ "menu": {
+ "title": "การทำงานกับรายการ",
+ "paste": "วาง",
+ "pastePlain": "วางเป็นข้อความธรรมดา",
+ "addLabel": "เพิ่มชื่อและแท็ก…",
+ "editLabel": "แก้ไขชื่อและแท็ก…",
+ "openLink": "เปิดลิงก์",
+ "copyCleanLink": "คัดลอกลิงก์ที่สะอาด",
+ "copyAs": "คัดลอกเป็น",
+ "showInFolder": "แสดงในโฟลเดอร์",
+ "copyPath": "คัดลอกพาธ",
+ "copyPaths": "คัดลอกพาธ",
+ "saveToDownloads": "บันทึกไปที่ดาวน์โหลด",
+ "preview": "แสดงตัวอย่าง",
+ "closePreview": "ปิดตัวอย่าง",
+ "label": "ชื่อ",
+ "labelPlaceholder": "เช่น Wi-Fi ที่ทำงาน",
+ "tags": "แท็ก",
+ "tagPlaceholder": "เพิ่มแท็ก…",
+ "removeTag": "ลบ #{tag}",
+ "usedBefore": "เคยใช้แล้ว",
+ "removeAll": "ลบทั้งหมด",
+ "cancel": "ยกเลิก",
+ "save": "บันทึก"
+ },
"emoji": {
"open": "อีโมจิ",
"backToClipboard": "คลิปบอร์ด",
@@ -11326,6 +12222,11 @@ export const th: TranslationKeys = {
"current": "ปัจจุบัน"
},
"toast": {
+ "labelPinned": "ปักหมุดไว้เพื่อเก็บรักษา",
+ "labelFailed": "บันทึกชื่อไม่สำเร็จ โปรดลองอีกครั้ง",
+ "savedToDownloads": "บันทึกไปที่ดาวน์โหลดแล้ว: {name}",
+ "savedManyToDownloads": "บันทึกรูปภาพ {count} รูปไปที่ดาวน์โหลดแล้ว",
+ "saveImagesFailed": "บันทึกรูปภาพไม่สำเร็จ",
"mergeIncompatible": "ไม่สามารถรวมไอเท็มต่างประเภทกันได้",
"mergeFilesFull": "ชุดโฟลเดอร์มีได้สูงสุด 10 ไฟล์",
"mergeImagesFull": "คอลเลกชันรูปภาพมีได้สูงสุด 10 รายการ",
@@ -11579,6 +12480,31 @@ export const he: TranslationKeys = {
"clearAll": "נקה את כל ההיסטוריה",
"clearAllConfirm": "הקש שוב כדי לאשר"
},
+ "menu": {
+ "title": "פעולות פריט",
+ "paste": "הדבקה",
+ "pastePlain": "הדבקה כטקסט פשוט",
+ "addLabel": "הוספת שם ותגיות…",
+ "editLabel": "עריכת שם ותגיות…",
+ "openLink": "פתיחת קישור",
+ "copyCleanLink": "העתקת קישור נקי",
+ "copyAs": "העתקה בתור",
+ "showInFolder": "הצגה בתיקייה",
+ "copyPath": "העתקת נתיב",
+ "copyPaths": "העתקת נתיבים",
+ "saveToDownloads": "שמירה בהורדות",
+ "preview": "תצוגה מקדימה",
+ "closePreview": "סגירת תצוגה מקדימה",
+ "label": "שם",
+ "labelPlaceholder": "לדוגמה: Wi-Fi במשרד",
+ "tags": "תגיות",
+ "tagPlaceholder": "הוספת תגית…",
+ "removeTag": "הסרת #{tag}",
+ "usedBefore": "בשימוש בעבר",
+ "removeAll": "הסרת הכול",
+ "cancel": "ביטול",
+ "save": "שמירה"
+ },
"emoji": {
"open": "אימוג'י",
"backToClipboard": "לוח",
@@ -11700,6 +12626,11 @@ export const he: TranslationKeys = {
"current": "נוכחי"
},
"toast": {
+ "labelPinned": "הוצמד כדי שיישמר",
+ "labelFailed": "לא ניתן היה לשמור את השם. נסו שוב.",
+ "savedToDownloads": "נשמר בהורדות: {name}",
+ "savedManyToDownloads": "{count} תמונות נשמרו בהורדות",
+ "saveImagesFailed": "לא ניתן היה לשמור את התמונה",
"mergeIncompatible": "לא ניתן לשלב סוגי פריטים שונים",
"mergeFilesFull": "חבילת תיקייה יכולה להכיל עד 10 קבצים",
"mergeImagesFull": "אוסף תמונות יכול להכיל עד 10 פריטים",
@@ -11953,6 +12884,31 @@ export const no: TranslationKeys = {
"clearAll": "Tøm all historikk",
"clearAllConfirm": "Trykk igjen for å bekrefte"
},
+ "menu": {
+ "title": "Elementhandlinger",
+ "paste": "Lim inn",
+ "pastePlain": "Lim inn som ren tekst",
+ "addLabel": "Legg til navn og tagger…",
+ "editLabel": "Rediger navn og tagger…",
+ "openLink": "Åpne lenke",
+ "copyCleanLink": "Kopier ren lenke",
+ "copyAs": "Kopier som",
+ "showInFolder": "Vis i mappe",
+ "copyPath": "Kopier bane",
+ "copyPaths": "Kopier baner",
+ "saveToDownloads": "Lagre i Nedlastinger",
+ "preview": "Forhåndsvis",
+ "closePreview": "Lukk forhåndsvisning",
+ "label": "Navn",
+ "labelPlaceholder": "f.eks. Wi-Fi på kontoret",
+ "tags": "Tagger",
+ "tagPlaceholder": "Legg til tagg…",
+ "removeTag": "Fjern #{tag}",
+ "usedBefore": "Brukt før",
+ "removeAll": "Fjern alle",
+ "cancel": "Avbryt",
+ "save": "Lagre"
+ },
"emoji": {
"open": "Emoji",
"backToClipboard": "Utklippstavle",
@@ -12074,6 +13030,11 @@ export const no: TranslationKeys = {
"current": "Gjeldende"
},
"toast": {
+ "labelPinned": "Festet slik at det beholdes",
+ "labelFailed": "Kunne ikke lagre navnet. Prøv igjen.",
+ "savedToDownloads": "Lagret i Nedlastinger: {name}",
+ "savedManyToDownloads": "{count} bilder lagret i Nedlastinger",
+ "saveImagesFailed": "Kunne ikke lagre bildet",
"mergeIncompatible": "Ulike elementtyper kan ikke kombineres",
"mergeFilesFull": "En mappepakke kan inneholde maksimalt 10 filer",
"mergeImagesFull": "En bildesamling kan inneholde maksimalt 10 elementer",
diff --git a/src/lib/codeDetect.ts b/src/lib/codeDetect.ts
index 7dea159..31538e9 100644
--- a/src/lib/codeDetect.ts
+++ b/src/lib/codeDetect.ts
@@ -60,12 +60,17 @@ export function detectCode(raw: string): CodeDetectionResult {
}
}
+ // A script module that returns markup (React components and the like):
+ // it starts as code, not as a tag, so the HTML rule below must not win.
+ const looksLikeScript = !text.startsWith('<') &&
+ /(?:^|\n)\s*(import\s[^\n]*?\bfrom\s+['"]|export\s+(default|const|function|class)\b|(const|let|var)\s+([\w$]+\s*(:[^=\n]+)?=[^=]|[{[])|function\s+[\w$]+\s*\()/.test(text)
+
// 2. HTML / XML / SVG Detection
- if (
+ if (!looksLikeScript && (
/<!DOCTYPE\s+html/i.test(text) ||
/<(html|head|body|div|span|p|a|svg|script|style|path|button|input|h[1-6]|table|form|ul|li|section|header|footer|template)\b[^>]*>/i.test(text) ||
(text.startsWith('<') && text.endsWith('>') && /<\/?[a-z][a-z0-9-]*\b/i.test(text))
- ) {
+ )) {
return { isCode: true, language: 'html', displayName: 'HTML' }
}
@@ -149,11 +154,13 @@ export function detectCode(raw: string): CodeDetectionResult {
/\b(interface\s+[A-Z]\w*|type\s+[A-Z]\w*\s*=|as\s+const\b|<[A-Z]\w*>\s*\()/.test(text)
const hasJsx = /<[A-Z][a-zA-Z0-9]*\b[^>]*(\/?>|>[\s\S]*?<\/[A-Z][a-zA-Z0-9]*>)/.test(text) ||
/<>\s*[\s\S]*?<\/>/.test(text) ||
- /\bclassName=/.test(text)
+ /\bclassName=/.test(text) ||
+ // lowercase tags count only as markup, not inside a string or regex
+ (looksLikeScript && /(^|[^'"`/\w])<[a-z][a-z0-9-]*\b[^<>]*>/.test(text))
const hasJsKeywords = /\b(import\s+.*?from\s+['"]|export\s+(default\s+|const\s+|function\s+|class\s+)|const\s+[a-zA-Z0-9_$]+(\s*:\s*[^=]+)?\s*=|let\s+[a-zA-Z0-9_$]+(\s*:\s*[^=]+)?\s*=|function\s+[a-zA-Z0-9_$]+\s*\(|console\.(log|error|warn|info)|async\s+function|await\s+[a-zA-Z0-9_$]+|=>\s*[\{\(])/.test(text)
- if (hasJsKeywords || hasJsx || hasTsTypes) {
+ if (hasJsKeywords || hasJsx || hasTsTypes || looksLikeScript) {
if (hasJsx) {
return {
isCode: true,
diff --git a/src/lib/colorUtils.ts b/src/lib/colorUtils.ts
index ed04486..4017afa 100644
--- a/src/lib/colorUtils.ts
+++ b/src/lib/colorUtils.ts
@@ -172,3 +172,58 @@ export function parseColor(raw: string): ColorInfo | null {
return null
}
+
+export type ColorFormat = 'hex' | 'rgb' | 'hsl'
+
+export interface ColorFormats {
+ /** Format the copied code is already written in. */
+ source: ColorFormat
+ hex: string
+ rgb: string
+ hsl: string
+}
+
+function rgbToHsl(r: number, g: number, b: number): [number, number, number] {
+ const rn = r / 255
+ const gn = g / 255
+ const bn = b / 255
+ const max = Math.max(rn, gn, bn)
+ const min = Math.min(rn, gn, bn)
+ const l = (max + min) / 2
+ if (max === min) return [0, 0, Math.round(l * 100)]
+ const d = max - min
+ const s = l > 0.5 ? d / (2 - max - min) : d / (max + min)
+ let h: number
+ if (max === rn) h = (gn - bn) / d + (gn < bn ? 6 : 0)
+ else if (max === gn) h = (bn - rn) / d + 2
+ else h = (rn - gn) / d + 4
+ return [Math.round(h * 60) % 360, Math.round(s * 100), Math.round(l * 100)]
+}
+
+function alphaText(a: number): string {
+ return String(Math.round(a * 100) / 100)
+}
+
+/**
+ * The same color written as HEX, RGB and HSL (with alpha when it is not
+ * fully opaque), or null when `raw` is not a color code parseColor accepts.
+ * The source format is returned as typed, so copying it back never drifts.
+ */
+export function colorFormats(raw: string): ColorFormats | null {
+ const c = parseColor(raw)
+ if (!c) return null
+ const str = raw.trim()
+ const source: ColorFormat = str.startsWith('#') ? 'hex' : /^rgba?\(/i.test(str) ? 'rgb' : 'hsl'
+ const { r, g, b, a } = c
+ const translucent = a < 1
+ const hex = `#${toHex2(r)}${toHex2(g)}${toHex2(b)}${translucent ? toHex2(Math.round(a * 255)) : ''}`
+ const rgb = translucent ? `rgba(${r}, ${g}, ${b}, ${alphaText(a)})` : `rgb(${r}, ${g}, ${b})`
+ const [h, sat, l] = rgbToHsl(r, g, b)
+ const hsl = translucent ? `hsla(${h}, ${sat}%, ${l}%, ${alphaText(a)})` : `hsl(${h}, ${sat}%, ${l}%)`
+ return {
+ source,
+ hex: source === 'hex' ? str : hex,
+ rgb: source === 'rgb' ? str : rgb,
+ hsl: source === 'hsl' ? str : hsl
+ }
+}
diff --git a/src/lib/fileType.ts b/src/lib/fileType.ts
index 356b99c..a94d7d3 100644
--- a/src/lib/fileType.ts
+++ b/src/lib/fileType.ts
@@ -133,9 +133,9 @@ export function getFileKindByExt(ext: string, isDirectory?: boolean): FileKindIn
}
/**
- * edgelocal:// URL for a file-kind folder icon (PNG, see resources/file-icons).
+ * edgelocal:// URL for a file-kind folder icon (SVG, see resources/file-icons).
* Same hardcoded-scheme convention as the emoji catalog (`edgelocal://emoji/…`).
*/
export function fileIconUrl(kind: FileKind): string {
- return `edgelocal://icon/${kind}.png`
+ return `edgelocal://icon/${kind}.svg`
}
diff --git a/src/lib/itemSignature.ts b/src/lib/itemSignature.ts
index 0d5dd15..f0efa63 100644
--- a/src/lib/itemSignature.ts
+++ b/src/lib/itemSignature.ts
@@ -49,6 +49,15 @@ export function itemRenderKey(item: ClipboardItemDto): string {
}
}
+ // The label and tags are drawn on the card, so a rename alone must re-render.
+ key += `|m|${itemMetaKey(item)}`
+
renderKeyCache.set(item, key)
return key
}
+
+/** Label + tags as one comparable string ('' when the item has neither). */
+export function itemMetaKey(item: Pick<ClipboardItemDto, 'label' | 'tags'>): string {
+ if (!item.label && !item.tags?.length) return ''
+ return `${item.label ?? ''}\u0001${(item.tags ?? []).join('\u0002')}`
+}
diff --git a/src/lib/keyboardFocus.ts b/src/lib/keyboardFocus.ts
new file mode 100644
index 0000000..bff0118
--- /dev/null
+++ b/src/lib/keyboardFocus.ts
@@ -0,0 +1,96 @@
+/**
+ * Borrow and return OS keyboard focus for a text field in the shelf.
+ *
+ * The shelf never takes focus on its own (clicks must paste into the user's
+ * app). A field that needs typing calls acquireKeyboard() on pointer-down —
+ * a NOACTIVATE window may never fire a focus event from a plain click — and
+ * releaseKeyboard() on every exit. Holders are counted (searchFocus.ts), so
+ * search and the label editor can hand over to each other.
+ *
+ * Giving focus back is deferred a moment and cancelled if anyone takes it
+ * again meanwhile. Without that, a release immediately followed by an
+ * acquire (a hand-over between fields, or React StrictMode running an
+ * effect's cleanup + setup back to back in dev) reached the main process as
+ * focus(false) + focus(true): the release's verified foreground repair kept
+ * retrying in the background and handed the foreground back to the user's
+ * app right after the new acquire, so the field lost the keyboard at once.
+ */
+import { edge } from './edge'
+import { holdsFocus, noteFocusHolder, takeSearchEngaged } from './searchFocus'
+
+/** How long the last release waits before focus really goes back. */
+export const KEYBOARD_RELEASE_DELAY_MS = 150
+
+let pending: Promise<void> | undefined
+/** True from the focus(true) request until the matching focus(false). */
+let focusRequested = false
+let releaseTimer: ReturnType<typeof setTimeout> | null = null
+
+function cancelPendingRelease(): void {
+ if (releaseTimer !== null) {
+ clearTimeout(releaseTimer)
+ releaseTimer = null
+ }
+}
+
+function giveFocusBack(): void {
+ cancelPendingRelease()
+ if (!focusRequested) return
+ focusRequested = false
+ pending = undefined
+ try {
+ void edge.focusWindow(false)?.catch?.(() => {})
+ } catch { /* ignore */ }
+ try {
+ void edge.pauseHotkey(false)?.catch?.(() => {})
+ } catch { /* ignore */ }
+}
+
+/** Make the shelf focusable for `owner`. Resolves once main applied it. */
+export function acquireKeyboard(owner: string): Promise<void> {
+ noteFocusHolder(owner, true)
+ // A release still waiting to happen is simply cancelled: focus never left.
+ cancelPendingRelease()
+ if (focusRequested) return pending ?? Promise.resolve()
+ focusRequested = true
+ try {
+ // globalThis: this module is also compiled by the DOM-less node config
+ // (the store imports it).
+ ;(globalThis as { focus?: () => void }).focus?.()
+ } catch { /* ignore */ }
+ let p: Promise<void> = Promise.resolve()
+ try {
+ const r = edge.focusWindow(true) as unknown as Promise<void> | undefined
+ if (r && typeof r.then === 'function') p = r.catch(() => {})
+ } catch { /* ignore */ }
+ try {
+ void edge.pauseHotkey(true)?.catch?.(() => {})
+ } catch { /* ignore */ }
+ pending = p
+ void p.then(() => {
+ if (pending === p) pending = undefined
+ })
+ return p
+}
+
+/** Release `owner`'s hold; when nobody holds focus any more, hand it back shortly. */
+export function releaseKeyboard(owner: string): void {
+ const { last } = noteFocusHolder(owner, false)
+ if (!last || !focusRequested) return
+ cancelPendingRelease()
+ releaseTimer = setTimeout(() => {
+ releaseTimer = null
+ if (!holdsFocus()) giveFocusBack()
+ }, KEYBOARD_RELEASE_DELAY_MS)
+}
+
+/**
+ * The panel is closing: drop every holder and hand focus back now (no
+ * delay). Returns true when focus had been taken.
+ */
+export function releaseAllKeyboard(): boolean {
+ const held = takeSearchEngaged()
+ const wasRequested = focusRequested
+ giveFocusBack()
+ return held || wasRequested
+}
diff --git a/src/lib/previewImageFit.ts b/src/lib/previewImageFit.ts
new file mode 100644
index 0000000..5dfd822
--- /dev/null
+++ b/src/lib/previewImageFit.ts
@@ -0,0 +1,77 @@
+/**
+ * How big to draw an image in the preview flyout, and how wide the flyout
+ * should be for it.
+ *
+ * A fixed 440px flyout with a contain-fit image failed three ways: a
+ * full-screen screenshot drew at ~20% (text unreadable), a long screenshot
+ * became a thin sliver, and a small icon was blown up 8x and blurry. So:
+ * - the flyout widens (up to what the window allows) for wide images;
+ * - an image too tall to fit at a readable size is drawn at full width and
+ * the body scrolls, instead of shrinking it to a sliver;
+ * - nothing is enlarged past 2 image pixels per screen pixel.
+ */
+
+export interface PreviewImageFit {
+ /** Outer width of the flyout (CSS px). */
+ flyoutWidth: number
+ /** Size the image is drawn at (CSS px). */
+ width: number
+ height: number
+ /** Drawn taller than the body: the flyout body scrolls. */
+ scroll: boolean
+}
+
+export interface PreviewImageBounds {
+ /** Flyout width used for everything else; the image never narrows it. */
+ minFlyoutWidth: number
+ /** Widest the flyout may get here. */
+ maxFlyoutWidth: number
+ /** Room for the image inside the body (flyout height minus header, padding, label). */
+ maxImageHeight: number
+ /** Body padding left + right. */
+ sidePadding: number
+ devicePixelRatio: number
+}
+
+/** Most image pixels per screen pixel when enlarging a small image. */
+export const MAX_UPSCALE = 2
+/** Below this scale a height-fitted tall image is too small to read: scroll instead. */
+export const MIN_READABLE_SCALE = 0.6
+/**
+ * Only images at least this much taller than wide scroll (phone and long
+ * page screenshots, receipts). A portrait photo (2:3) still fits whole.
+ */
+export const TALL_ASPECT = 1.8
+
+export function fitPreviewImage(imgW: number, imgH: number, b: PreviewImageBounds): PreviewImageFit {
+ const minInner = Math.max(1, b.minFlyoutWidth - b.sidePadding)
+ const maxInner = Math.max(minInner, b.maxFlyoutWidth - b.sidePadding)
+ const maxH = Math.max(1, b.maxImageHeight)
+ if (!(imgW > 0) || !(imgH > 0)) {
+ return { flyoutWidth: b.minFlyoutWidth, width: minInner, height: Math.min(maxH, minInner), scroll: false }
+ }
+ // CSS px per image px at which the image would be enlarged MAX_UPSCALE times on screen.
+ const dpr = Math.max(1, b.devicePixelRatio || 1)
+ const upscaleCap = MAX_UPSCALE / dpr
+ // Only an image wider than the normal flyout at its own size widens it;
+ // a smaller one is never stretched just to fill a wider panel.
+ const wide = imgW / dpr > minInner
+ const boxW = wide ? maxInner : minInner
+ // In the wider box an image is at most its own size (1 image px per screen px).
+ const cap = wide ? Math.min(upscaleCap, 1 / dpr) : upscaleCap
+
+ let scale = Math.min(cap, boxW / imgW, maxH / imgH)
+ let scroll = false
+
+ // Tall image that would be shrunk to an unreadable sliver: draw it as wide
+ // as allowed and let the body scroll.
+ if (scale < MIN_READABLE_SCALE && imgH / imgW >= TALL_ASPECT && maxH / imgH < boxW / imgW) {
+ scale = Math.min(cap, boxW / imgW)
+ scroll = imgH * scale > maxH
+ }
+
+ const width = Math.max(1, Math.round(imgW * scale))
+ const height = Math.max(1, Math.round(imgH * scale))
+ const flyoutWidth = Math.min(b.maxFlyoutWidth, Math.max(b.minFlyoutWidth, width + b.sidePadding))
+ return { flyoutWidth, width, height, scroll }
+}
diff --git a/src/lib/searchFocus.ts b/src/lib/searchFocus.ts
index 424a3e2..41a7c3e 100644
--- a/src/lib/searchFocus.ts
+++ b/src/lib/searchFocus.ts
@@ -1,21 +1,47 @@
/**
- * Search-focus bookkeeping shared by the search input and the store.
+ * Keyboard-focus bookkeeping shared by every text field in the shelf (the
+ * search box and the label/tag editor) and the store.
*
- * While the user types in search, the shelf is temporarily OS-focusable and
- * the global toggle hotkey is paused. If the panel closes through a path
- * that skips the input's blur handler (tray toggle, cursor leave), the
- * store's setOpen(false) uses this flag to restore focusability + hotkey
- * exactly once. No imports — safe from both component and store modules.
+ * Typing needs the shelf to be temporarily OS-focusable with the global
+ * toggle hotkey paused. Several fields can hold that at once (search still
+ * focused while the tag editor opens), so holders are counted by name: the
+ * first holder turns focusability on, the last one to let go turns it off.
+ * If the panel closes through a path that skips a field's blur (tray toggle,
+ * cursor leave), the store's setOpen(false) takes all holders and restores
+ * focusability + hotkey exactly once. No imports — safe from both component
+ * and store modules.
*/
-let searchEngaged = false
+const holders = new Set<string>()
+
+/**
+ * Record that `owner` now holds (or released) keyboard focus. `first` is true
+ * when this made the shelf go from no holder to one; `last` when it went from
+ * one holder to none. Repeated calls for the same owner are no-ops.
+ */
+export function noteFocusHolder(owner: string, held: boolean): { first: boolean; last: boolean } {
+ if (held) {
+ if (holders.has(owner)) return { first: false, last: false }
+ const first = holders.size === 0
+ holders.add(owner)
+ return { first, last: false }
+ }
+ if (!holders.delete(owner)) return { first: false, last: false }
+ return { first: false, last: holders.size === 0 }
+}
+
+/** Whether `owner` (or, without an argument, anyone) holds keyboard focus. */
+export function holdsFocus(owner?: string): boolean {
+ return owner ? holders.has(owner) : holders.size > 0
+}
export function noteSearchEngaged(engaged: boolean): void {
- searchEngaged = engaged
+ noteFocusHolder('search', engaged)
}
+/** Drop every holder; true when there was at least one (so focus must be restored). */
export function takeSearchEngaged(): boolean {
- const was = searchEngaged
- searchEngaged = false
+ const was = holders.size > 0
+ holders.clear()
return was
}
diff --git a/src/lib/tagQuery.ts b/src/lib/tagQuery.ts
new file mode 100644
index 0000000..862955a
--- /dev/null
+++ b/src/lib/tagQuery.ts
@@ -0,0 +1,92 @@
+/**
+ * Search over labels and tags.
+ *
+ * A query is split into `#tag` filters and plain text:
+ * "invoice" -> text match (content, file names, label, tags)
+ * "#work" -> items with a tag starting with "work"
+ * "#work #client-a" -> items with both
+ * "#work invoice" -> tag "work..." AND text "invoice"
+ * A query without any `#word` behaves exactly as before: one substring.
+ */
+import { normalizeTag } from '../../shared/itemMeta'
+
+export interface ParsedQuery {
+ /** Lowercased plain-text part ('' when only tags were typed). */
+ text: string
+ /** Normalized tag prefixes from `#word` tokens. */
+ tags: string[]
+}
+
+export function parseQuery(raw: string): ParsedQuery {
+ const q = raw.trim()
+ if (!q.includes('#')) return { text: q.toLowerCase(), tags: [] }
+ const tags: string[] = []
+ const words: string[] = []
+ for (const token of q.split(/\s+/)) {
+ if (token.startsWith('#')) {
+ const tag = normalizeTag(token)
+ if (tag && !tags.includes(tag)) tags.push(tag)
+ } else if (token) {
+ words.push(token)
+ }
+ }
+ return { text: words.join(' ').toLowerCase(), tags }
+}
+
+/** Label/tag part of a text search (the content part lives with the item kinds). */
+export function metaMatchesText(item: { label?: string; tags?: readonly string[] }, needle: string): boolean {
+ if (!needle) return true
+ if (item.label && item.label.toLowerCase().includes(needle)) return true
+ const bare = needle.startsWith('#') ? needle.slice(1) : needle
+ return !!bare && !!item.tags?.some((tag) => tag.includes(bare))
+}
+
+/** Every `#tag` filter must match one of the item's tags by prefix. */
+export function matchesTagFilters(item: { tags?: readonly string[] }, filters: readonly string[]): boolean {
+ if (filters.length === 0) return true
+ const tags = item.tags
+ if (!tags || tags.length === 0) return false
+ return filters.every((f) => tags.some((tag) => tag.startsWith(f)))
+}
+
+/** How many items use each tag. */
+export function tagCounts(items: ReadonlyArray<{ tags?: readonly string[] }>): Map<string, number> {
+ const counts = new Map<string, number>()
+ for (const it of items) {
+ if (!it.tags) continue
+ for (const tag of it.tags) counts.set(tag, (counts.get(tag) ?? 0) + 1)
+ }
+ return counts
+}
+
+/** Most-used tags first (then A-Z) whose name starts with `prefix`. */
+export function suggestTags(
+ counts: ReadonlyMap<string, number>,
+ prefix: string,
+ opts: { exclude?: readonly string[]; limit?: number } = {}
+): Array<{ tag: string; count: number }> {
+ const p = prefix ? normalizeTag(prefix) ?? '' : ''
+ const exclude = new Set(opts.exclude ?? [])
+ const out: Array<{ tag: string; count: number }> = []
+ for (const [tag, count] of counts) {
+ if (exclude.has(tag)) continue
+ if (p && !tag.startsWith(p)) continue
+ out.push({ tag, count })
+ }
+ out.sort((a, b) => b.count - a.count || a.tag.localeCompare(b.tag))
+ return out.slice(0, opts.limit ?? 8)
+}
+
+/**
+ * When the last thing typed is a `#word` (or a lone `#`), the part after
+ * '#' that tag suggestions should complete; otherwise null.
+ */
+export function activeTagPrefix(query: string): string | null {
+ const m = /(?:^|\s)#([^\s#]*)$/.exec(query)
+ return m ? m[1] : null
+}
+
+/** Replace the trailing `#word` of the query with `#tag ` (suggestion click). */
+export function completeTag(query: string, tag: string): string {
+ return query.replace(/(^|\s)#[^\s#]*$/, `$1#${tag} `)
+}
diff --git a/src/lib/urlPreview.ts b/src/lib/urlPreview.ts
index a4c3a67..e134d62 100644
--- a/src/lib/urlPreview.ts
+++ b/src/lib/urlPreview.ts
@@ -339,6 +339,49 @@ const TRACKING_PARAMS = new Set([
'mkt_tok', 'spReportId', '__twitter_impression', 'vero_id', 'vero_conv'
])
+/**
+ * A copied link as something the browser can open: "www.example.com" (no
+ * scheme) becomes "https://www.example.com". Without this, window.open
+ * resolves it relative to the app page and nothing useful opens.
+ */
+export function externalHref(text: string): string {
+ const t = typeof text === 'string' ? text.trim() : ''
+ return /^[a-z][a-z0-9+.-]*:/i.test(t) ? t : `https://${t}`
+}
+
+function isTrackingParam(key: string): boolean {
+ const k = key.toLowerCase()
+ return TRACKING_PARAMS.has(k) || TRACKING_PARAM_PREFIXES.some((p) => k.startsWith(p))
+}
+
+/**
+ * The link with only its tracking parameters removed (utm_*, fbclid, gclid,
+ * ...). Everything else is kept exactly as written: host, www., path,
+ * trailing slash, other parameters and their order, and the #hash. Returns
+ * the input unchanged when it is not an http(s) link or has nothing to strip.
+ */
+export function stripTracking(rawUrl: string): string {
+ const raw = typeof rawUrl === 'string' ? rawUrl.trim() : ''
+ const q = raw.indexOf('?')
+ if (q < 0 || !/^https?:\/\//i.test(raw)) return raw
+ const hashAt = raw.indexOf('#', q)
+ const head = raw.slice(0, q)
+ const query = raw.slice(q + 1, hashAt < 0 ? undefined : hashAt)
+ const hash = hashAt < 0 ? '' : raw.slice(hashAt)
+ const parts = query.split('&').filter(Boolean)
+ const kept = parts.filter((part) => {
+ const eq = part.indexOf('=')
+ const name = eq < 0 ? part : part.slice(0, eq)
+ let key = name
+ try {
+ key = decodeURIComponent(name.replace(/\+/g, ' '))
+ } catch { /* keep raw name */ }
+ return !isTrackingParam(key)
+ })
+ if (kept.length === parts.length) return raw
+ return `${head}${kept.length ? `?${kept.join('&')}` : ''}${hash}`
+}
+
/* ------------------------------------------------------------------ */
/* 4. Common Acronyms & Short Words to Keep Upper-Cased */
/* ------------------------------------------------------------------ */
diff --git a/src/store/appStore.ts b/src/store/appStore.ts
index 24fbc0d..c1e79fd 100644
--- a/src/store/appStore.ts
+++ b/src/store/appStore.ts
@@ -8,11 +8,13 @@
*/
import { create } from 'zustand'
import { edge } from '../lib/edge'
-import { takeSearchEngaged } from '../lib/searchFocus'
+import { releaseAllKeyboard } from '../lib/keyboardFocus'
import { t } from '../i18n'
import { loadRecents } from '../lib/emoji/prefs'
import type { ClipboardItemDto, Settings, DragRequest } from '../../shared/types'
import { DEFAULT_SETTINGS } from '../../shared/types'
+import { normalizeLabel, normalizeTags, type ItemMetaPatch } from '../../shared/itemMeta'
+import { itemMetaKey } from '../lib/itemSignature'
import { playEdgeRetractSound, playEdgeBeaconAppearSound, playEdgeExpandSound, playButtonClickSound } from '../lib/soundEffects'
let flareTimer: ReturnType<typeof setTimeout> | null = null
@@ -45,6 +47,26 @@ export interface ToastMsg {
params?: Record<string, string | number>
}
+export interface CardMenuState {
+ itemId: string
+ /** Where the right-click happened, in window (client) pixels. */
+ x: number
+ y: number
+ mode: 'menu' | 'edit'
+ /** Editor field that gets the caret first. */
+ focus?: 'label' | 'tags'
+}
+
+/** Grace after the card menu closes before hover-close may shut the shelf. */
+export const CARD_MENU_STAY_MS = 1500
+
+export interface CardMenuRect {
+ left: number
+ top: number
+ right: number
+ bottom: number
+}
+
export interface UpdateProgress {
percent: number
bytesPerSecond?: number
@@ -143,13 +165,40 @@ interface AppState {
languageFlyoutOpen: boolean
languageFlyoutAnchorRect: { x?: number; y?: number; width?: number; height?: number } | null
setLanguageFlyoutOpen: (open: boolean, rect?: { x?: number; y?: number; width?: number; height?: number } | null) => void
- previewFlyoutRect: { top: number; bottom: number; left?: number; right?: number } | null
- setPreviewFlyoutRect: (rect: { top: number; bottom: number; left?: number; right?: number } | null) => void
+ /**
+ * The open preview flyout's box for hover keep-alive. Top dock: dock
+ * coordinates with left/right. Side docks: top/bottom, plus `reach` (how far
+ * its far edge is from the screen edge; image previews can be wider).
+ */
+ previewFlyoutRect: { top: number; bottom: number; left?: number; right?: number; reach?: number } | null
+ setPreviewFlyoutRect: (rect: { top: number; bottom: number; left?: number; right?: number; reach?: number } | null) => void
isInternalCopying: boolean
copyFlareActive: boolean
flareKey: number
triggerCopyFlare: () => void
+ /** The card right-click menu (one at a time), or null when closed. */
+ cardMenu: CardMenuState | null
+ /** The open menu's on-screen box (window pixels), so hover-close keeps the shelf open over it. */
+ cardMenuRect: CardMenuRect | null
+ /**
+ * Until this time (ms epoch) hover-close waits before closing the shelf:
+ * the menu can reach outside the blade, so after it closes the pointer may
+ * be outside and needs a moment to come back. 0 when not active.
+ */
+ cardMenuStayUntil: number
+ clearCardMenuStay: () => void
+ openCardMenu: (itemId: string, x: number, y: number) => void
+ /** Turn the open menu into the label / tags editor. */
+ editCardMeta: (focus?: 'label' | 'tags') => void
+ closeCardMenu: () => void
+ setCardMenuRect: (rect: CardMenuRect | null) => void
+ /** Save a label / tags (main normalizes; a label or tag also pins). */
+ setItemMeta: (id: string, patch: ItemMetaPatch) => Promise<void>
+ /** Put derived text (clean link, color format, path) on the clipboard without a new card. */
+ copyText: (text: string, opts?: { quiet?: boolean }) => Promise<boolean>
+ saveImages: (id: string) => Promise<void>
+
/* toasts */
pushToast: (toast: ToastMsg) => void
dismissToast: (id: string) => void
@@ -158,9 +207,10 @@ interface AppState {
togglePin: (id: string, pinned: boolean) => Promise<void>
remove: (id: string) => Promise<void>
clear: (ids?: string[]) => Promise<void>
- copy: (id: string) => Promise<void>
+ /** Copy an item back to the clipboard; false when its content is gone. */
+ copy: (id: string) => Promise<boolean>
copySubitem: (req: DragRequest) => Promise<void>
- paste: (id: string) => Promise<void>
+ paste: (id: string, opts?: { plain?: boolean }) => Promise<void>
pasteSubitem: (req: DragRequest) => Promise<void>
pasteEmoji: (text: string) => Promise<void>
patchSettings: (patch: Partial<Settings>) => Promise<void>
@@ -178,7 +228,7 @@ export const useStore = create<AppState>((set, get) => ({
typeFilter: 'all',
setTypeFilter: (typeFilter) => {
if (get().typeFilter === typeFilter && !get().emojiOpen) return
- set({ typeFilter, emojiOpen: false, expandedStackId: null })
+ set({ typeFilter, emojiOpen: false, expandedStackId: null, cardMenu: null, cardMenuRect: null })
// The list remounts on filter change; leave the flyout open and it
// would float over a tab that no longer contains the source card.
if (get().previewItemId) get().setPreviewItemId(null)
@@ -209,7 +259,9 @@ export const useStore = create<AppState>((set, get) => ({
styleFlyoutAnchorRect: null,
languageFlyoutOpen: false,
languageFlyoutAnchorRect: null,
- expandedStackId: null
+ expandedStackId: null,
+ cardMenu: null,
+ cardMenuRect: null
})
edge.setPreviewMode(false)
} else {
@@ -420,7 +472,7 @@ export const useStore = create<AppState>((set, get) => ({
const prevItems = get().items
if (
prevItems.length === items.length &&
- prevItems.every((it, i) => it.id === items[i]?.id && it.pinned === items[i]?.pinned && it.hitCount === items[i]?.hitCount && it.capturedAt === items[i]?.capturedAt)
+ prevItems.every((it, i) => it.id === items[i]?.id && it.pinned === items[i]?.pinned && it.hitCount === items[i]?.hitCount && it.capturedAt === items[i]?.capturedAt && itemMetaKey(it) === itemMetaKey(items[i]))
) {
return
}
@@ -442,19 +494,17 @@ export const useStore = create<AppState>((set, get) => ({
// compiling under the DOM-less node tsconfig.)
const active = (globalThis as { document?: { activeElement?: { blur?: () => void } } }).document?.activeElement
try { active?.blur?.() } catch { /* ignore */ }
- // If search held temporary OS focusability + paused hotkey through a
- // close path that skipped the input's blur (tray toggle, cursor
- // leave), restore both exactly once. No-op when search was never used.
+ // If a text field (search, label editor) held temporary OS
+ // focusability + paused hotkey through a close path that skipped its
+ // blur (tray toggle, cursor leave), restore both now, exactly once.
+ // No-op when no field ever took the keyboard.
try {
- if (takeSearchEngaged()) {
- void edge.focusWindow(false)?.catch?.(() => {})
- void edge.pauseHotkey(false)?.catch?.(() => {})
- }
+ releaseAllKeyboard()
} catch { /* ignore */ }
// NOTE: Do NOT reset styleFlyoutOpen here — closePanel() handles the
// sequencing so the flyout exit animation completes before the panel closes.
// Only reset previewItemId so the normal preview flyout clears correctly.
- set({ previewItemId: null, previewItemRect: null, expandedStackId: null })
+ set({ previewItemId: null, previewItemRect: null, expandedStackId: null, cardMenu: null, cardMenuRect: null, cardMenuStayUntil: 0 })
edge.setPreviewMode(false)
}
},
@@ -470,6 +520,8 @@ export const useStore = create<AppState>((set, get) => ({
languageFlyoutOpen: false,
languageFlyoutAnchorRect: null,
expandedStackId: null,
+ cardMenu: null,
+ cardMenuRect: null,
emojiOpen: settingsOpen ? false : get().emojiOpen
})
},
@@ -586,7 +638,9 @@ export const useStore = create<AppState>((set, get) => ({
// guard active so the external edge copy indicator flare does not appear.
set({ isInternalCopying: true })
try {
- await edge.copyItem(id)
+ return await edge.copyItem(id)
+ } catch {
+ return false
} finally {
setTimeout(() => set({ isInternalCopying: false }), 400)
}
@@ -601,12 +655,87 @@ export const useStore = create<AppState>((set, get) => ({
}
},
- async paste(id) {
+ async paste(id, opts) {
set({ isInternalCopying: true })
- await edge.pasteItem(id)
+ await edge.pasteItem(id, opts?.plain ? { plain: true } : undefined)
setTimeout(() => set({ isInternalCopying: false }), 600)
},
+ cardMenu: null,
+ cardMenuRect: null,
+ openCardMenu: (itemId, x, y) => {
+ set({ cardMenu: { itemId, x, y, mode: 'menu' }, cardMenuRect: null })
+ },
+ editCardMeta: (focus = 'label') => {
+ const menu = get().cardMenu
+ if (!menu) return
+ set({ cardMenu: { ...menu, mode: 'edit', focus } })
+ },
+ closeCardMenu: () => {
+ if (!get().cardMenu && !get().cardMenuRect) return
+ set({
+ cardMenu: null,
+ cardMenuRect: null,
+ cardMenuStayUntil: get().open ? Date.now() + CARD_MENU_STAY_MS : 0
+ })
+ },
+ cardMenuStayUntil: 0,
+ clearCardMenuStay: () => {
+ if (get().cardMenuStayUntil !== 0) set({ cardMenuStayUntil: 0 })
+ },
+ setCardMenuRect: (cardMenuRect) => set({ cardMenuRect }),
+
+ async setItemMeta(id, patch) {
+ const before = get().items.find((it) => it.id === id)
+ if (!before) return
+ // Optimistic: show the cleaned values at once; main sends the stored truth.
+ const label = 'label' in patch ? normalizeLabel(patch.label) : before.label
+ const tags = 'tags' in patch ? normalizeTags(patch.tags) : before.tags
+ const named = !!label || !!tags?.length
+ set({
+ items: get().items.map((it) => {
+ if (it.id !== id) return it
+ const next: ClipboardItemDto = { ...it, pinned: it.pinned || named }
+ if (label) next.label = label
+ else delete next.label
+ if (tags?.length) next.tags = tags
+ else delete next.tags
+ return next
+ })
+ })
+ try {
+ const items = await edge.setItemMeta(id, patch)
+ set({ items })
+ const after = items.find((it) => it.id === id)
+ if (after && !before.pinned && after.pinned) {
+ get().pushToast({ id: `meta-pin-${Date.now()}`, message: t('toast.labelPinned'), tone: 'info' })
+ }
+ } catch {
+ set({ items: get().items.map((it) => (it.id === id ? before : it)) })
+ get().pushToast({ id: `meta-${Date.now()}`, message: t('toast.labelFailed'), tone: 'error' })
+ }
+ },
+
+ async copyText(text, opts) {
+ set({ isInternalCopying: true })
+ try {
+ const ok = await edge.copyText(text)
+ if (ok && !opts?.quiet) get().pushToast({ id: `copied-${Date.now()}`, message: t('toast.copiedToClipboard'), tone: 'info' })
+ return ok
+ } catch {
+ return false
+ } finally {
+ setTimeout(() => set({ isInternalCopying: false }), 400)
+ }
+ },
+
+ async saveImages(id) {
+ // Main shows the result toast (saved name or failure).
+ try {
+ await edge.saveImages(id)
+ } catch { /* ignore */ }
+ },
+
async pasteSubitem(req) {
set({ isInternalCopying: true })
try {
diff --git a/src/styles/cardMenu.css b/src/styles/cardMenu.css
new file mode 100644
index 0000000..6fa37c8
--- /dev/null
+++ b/src/styles/cardMenu.css
@@ -0,0 +1,420 @@
+/**
+ * Card right-click menu + label / tags editor.
+ * Flat like the blade and the preview flyout (no drop shadow), on a surface
+ * one step lighter than the cards so it reads as raised above them: soft
+ * white highlights, white "on" state, soft-red delete. A faint hairline
+ * keeps its edge where it overlaps a card.
+ * Only opacity/transform animate, and only once when the menu appears.
+ */
+
+.card-menu {
+ position: fixed;
+ z-index: 60;
+ min-width: 212px;
+ max-width: 240px;
+ box-sizing: border-box;
+ padding: 6px;
+ background: #1c1c1c;
+ border-radius: 18px;
+ box-shadow: inset 0 0 0 1px var(--divider);
+ color: rgba(255, 255, 255, 0.86);
+ font-family: var(--font-ui);
+ pointer-events: auto;
+ user-select: none;
+ -webkit-user-select: none;
+ visibility: hidden;
+}
+
+.card-menu.is-placed {
+ visibility: visible;
+ animation: card-menu-in 0.12s cubic-bezier(0.2, 0.9, 0.3, 1);
+}
+
+@keyframes card-menu-in {
+ from {
+ opacity: 0;
+ transform: scale(0.96);
+ }
+ to {
+ opacity: 1;
+ transform: none;
+ }
+}
+
+html[data-motion='reduce'] .card-menu.is-placed {
+ animation: none;
+}
+
+.card-menu-list {
+ display: flex;
+ flex-direction: column;
+}
+
+.card-menu-row {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ width: 100%;
+ height: 32px;
+ padding: 0 10px;
+ border: none;
+ border-radius: 12px;
+ background: transparent;
+ color: inherit;
+ font: inherit;
+ font-size: calc(13px * var(--font-scale, 1));
+ font-weight: 500;
+ text-align: start;
+ cursor: pointer;
+ box-sizing: border-box;
+ transition: background 0.12s ease, color 0.12s ease;
+}
+
+.card-menu-row:hover,
+.card-menu-row:focus-visible {
+ outline: none;
+ background: rgba(255, 255, 255, 0.08);
+ color: var(--text-primary);
+}
+
+.card-menu-icon {
+ display: inline-flex;
+ flex-shrink: 0;
+ width: 15px;
+ height: 15px;
+ align-items: center;
+ justify-content: center;
+ color: rgba(255, 255, 255, 0.68);
+ transition: color 0.12s ease;
+}
+
+.card-menu-icon svg {
+ width: 15px;
+ height: 15px;
+}
+
+.card-menu-row:hover .card-menu-icon {
+ color: #ffffff;
+}
+
+.card-menu-label {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.card-menu-row.is-danger,
+.card-menu-row.is-danger .card-menu-icon {
+ color: var(--act-danger);
+}
+
+.card-menu-row.is-danger:hover {
+ background: var(--act-danger-bg);
+ color: var(--act-danger);
+}
+
+.card-menu-sep {
+ height: 1px;
+ margin: 5px 10px;
+ background: rgba(255, 255, 255, 0.1);
+}
+
+/* "Copy as [RGB] [HSL]" — a row of small format chips. */
+.card-menu-colors,
+.card-menu-colors:hover {
+ cursor: default;
+ background: transparent;
+ color: inherit;
+}
+
+.card-menu-colors:hover .card-menu-icon {
+ color: rgba(255, 255, 255, 0.68);
+}
+
+.card-menu-chips {
+ display: inline-flex;
+ gap: 4px;
+ flex-shrink: 0;
+}
+
+.card-menu-chip {
+ height: 22px;
+ padding: 0 8px;
+ border: none;
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.08);
+ color: rgba(255, 255, 255, 0.86);
+ font-family: var(--font-mono);
+ font-size: calc(10.5px * var(--font-scale, 1));
+ font-weight: 600;
+ letter-spacing: 0.02em;
+ cursor: pointer;
+ transition: background 0.12s ease, color 0.12s ease;
+}
+
+.card-menu-chip:hover,
+.card-menu-chip:focus-visible {
+ outline: none;
+ background: var(--act-on);
+ color: var(--act-on-ink);
+}
+
+/* ---------------------------- editor ---------------------------- */
+
+.card-menu.is-editing {
+ width: 252px;
+ max-width: 252px;
+ padding: 12px;
+}
+
+.card-meta-editor {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ animation: card-meta-in 0.1s ease-out;
+}
+
+@keyframes card-meta-in {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
+html[data-motion='reduce'] .card-meta-editor {
+ animation: none;
+}
+
+.card-meta-field {
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+}
+
+.card-meta-caption {
+ display: flex;
+ justify-content: space-between;
+ align-items: baseline;
+ padding: 0 2px;
+ font-size: calc(11px * var(--font-scale, 1));
+ font-weight: 600;
+ color: rgba(255, 255, 255, 0.55);
+}
+
+.card-meta-count {
+ font-weight: 500;
+ color: rgba(255, 255, 255, 0.4);
+}
+
+/* Fields: borderless pills like the search box; hover and focus lift the
+ fill a step (no ring). */
+.card-meta-input,
+.card-meta-tags {
+ box-sizing: border-box;
+ width: 100%;
+ border: none;
+ background: rgba(255, 255, 255, 0.06);
+ transition: background-color var(--dur-fast) var(--ease-out);
+}
+
+.card-meta-input:hover,
+.card-meta-tags:hover {
+ background: rgba(255, 255, 255, 0.08);
+}
+
+.card-meta-input {
+ height: 32px;
+ padding: 0 12px;
+ border-radius: var(--radius-pill);
+ color: #ffffff;
+ caret-color: #ffffff;
+ font-family: var(--font-ui);
+ font-size: calc(13px * var(--font-scale, 1));
+ font-weight: 500;
+ outline: none;
+ user-select: text;
+ -webkit-user-select: text;
+}
+
+.card-meta-input::placeholder,
+.card-meta-tag-input::placeholder {
+ color: var(--text-tertiary);
+ font-weight: 400;
+}
+
+.card-meta-input::selection,
+.card-meta-tag-input::selection {
+ background: rgba(255, 255, 255, 0.28);
+}
+
+.card-meta-input:focus,
+.card-meta-tags:focus-within {
+ background: rgba(255, 255, 255, 0.11);
+}
+
+/* Wraps to more lines when there are many tags, so a fixed radius (a pill
+ while it is one line high) instead of 999px. */
+.card-meta-tags {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 4px;
+ min-height: 32px;
+ padding: 4px 5px;
+ border-radius: 16px;
+ cursor: text;
+}
+
+.card-meta-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 2px;
+ height: 22px;
+ max-width: 100%;
+ padding: 0 3px 0 8px;
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.12);
+ color: #ffffff;
+ font-size: calc(11.5px * var(--font-scale, 1));
+ font-weight: 600;
+ box-sizing: border-box;
+}
+
+.card-meta-chip-text {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.card-meta-chip-remove {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ flex-shrink: 0;
+ width: 16px;
+ height: 16px;
+ padding: 0;
+ border: none;
+ border-radius: 50%;
+ background: transparent;
+ color: rgba(255, 255, 255, 0.6);
+ cursor: pointer;
+}
+
+.card-meta-chip-remove:hover {
+ background: rgba(255, 255, 255, 0.18);
+ color: #ffffff;
+}
+
+.card-meta-tag-input {
+ flex: 1;
+ min-width: 56px;
+ height: 22px;
+ padding: 0 4px;
+ border: none;
+ background: transparent;
+ color: #ffffff;
+ font-family: var(--font-ui);
+ font-size: calc(12px * var(--font-scale, 1));
+ font-weight: 500;
+ outline: none;
+ user-select: text;
+ -webkit-user-select: text;
+}
+
+.card-meta-suggest {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 4px;
+}
+
+.card-meta-suggestion {
+ height: 22px;
+ max-width: 100%;
+ padding: 0 8px;
+ border: none;
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.08);
+ color: rgba(255, 255, 255, 0.82);
+ font-family: var(--font-ui);
+ font-size: calc(11px * var(--font-scale, 1));
+ font-weight: 600;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ cursor: pointer;
+ transition: background 0.12s ease, color 0.12s ease;
+}
+
+/* Same as the #tag suggestion chips under the search box. */
+.card-meta-suggestion:hover {
+ background: var(--act-on);
+ color: var(--act-on-ink);
+}
+
+.card-meta-actions {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+
+.card-meta-spacer {
+ flex: 1;
+}
+
+/* Same capsule buttons as the preview flyout (.flyout-btn). */
+.card-meta-btn {
+ height: 28px;
+ padding: 0 12px;
+ border: none;
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.08);
+ color: rgba(255, 255, 255, 0.85);
+ font-family: var(--font-ui);
+ font-size: calc(12px * var(--font-scale, 1));
+ font-weight: 500;
+ white-space: nowrap;
+ cursor: pointer;
+ transition: background-color 0.12s ease, color 0.12s ease, transform 0.1s ease;
+}
+
+.card-meta-btn:hover {
+ background: rgba(255, 255, 255, 0.14);
+ color: #ffffff;
+}
+
+.card-meta-btn:active {
+ transform: scale(0.96);
+}
+
+.card-meta-btn:focus-visible,
+.card-meta-chip-remove:focus-visible,
+.card-meta-suggestion:focus-visible {
+ outline: 2px solid rgba(255, 255, 255, 0.45);
+ outline-offset: 2px;
+}
+
+.card-meta-btn.is-primary {
+ background: var(--act-on);
+ color: var(--act-on-ink);
+ font-weight: 600;
+}
+
+.card-meta-btn.is-primary:hover {
+ background: #e6e6e6;
+}
+
+.card-meta-btn.is-quiet {
+ padding: 0 4px;
+ background: transparent;
+ color: rgba(255, 255, 255, 0.5);
+}
+
+.card-meta-btn.is-quiet:hover {
+ background: transparent;
+ color: var(--act-danger);
+}
diff --git a/src/styles/item.css b/src/styles/item.css
index 92b359c..b88b2d4 100644
--- a/src/styles/item.css
+++ b/src/styles/item.css
@@ -187,6 +187,16 @@
.meta .meta-detail {
white-space: nowrap;
+ /* In a tight footer the detail text (domain, size, name) shortens first,
+ so badges after it (×N, tags) are never cut in half. */
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.meta .kind-badge,
+.meta .meta-hit-count {
+ flex-shrink: 0;
}
.meta-hit-count {
@@ -495,25 +505,52 @@
transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
+/* The file art keeps one soft shadow; hover only grows it a touch around
+ its center (no lift into the hover buttons, no animated shadow: changing
+ a filter repaints the SVG every frame, a transform does not). */
.single-file-hero svg,
.single-file-hero img.file-kind-img {
display: block;
- filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.55));
- transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), filter 0.22s ease;
+ filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.45));
+ transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
+ will-change: transform;
}
.item.is-image-folder-card:not(.is-expanded):hover .single-file-hero svg,
.item:not(.is-expanded) .item-main:hover .single-file-hero svg,
.item.is-image-folder-card:not(.is-expanded):hover .single-file-hero img.file-kind-img,
.item:not(.is-expanded) .item-main:hover .single-file-hero img.file-kind-img {
- transform: translateY(-2px) scale(1.04);
- filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.65));
+ transform: scale(1.04);
}
.mini-image-folder-card:hover .single-file-hero svg,
.mini-image-folder-card:hover .single-file-hero img.file-kind-img {
- transform: translateY(-2px) scale(1.04);
- filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.65));
+ transform: scale(1.04);
+}
+
+html[data-motion='reduce'] .single-file-hero svg,
+html[data-motion='reduce'] .single-file-hero img.file-kind-img {
+ transition: none;
+}
+
+/* File cards: center the art in the part of the viewport the label flap
+ (.image-folder-flap-wrap, pulled up 26px / 24px) leaves visible. */
+.image-folder-viewport > .single-file-hero {
+ margin-top: 0;
+ padding-bottom: 26px;
+ box-sizing: border-box;
+}
+.list.horizontal .image-folder-viewport > .single-file-hero {
+ padding-bottom: 24px;
+}
+/* Same for the mini cards of an expanded stack. Their flap covers 16px /
+ 12px of the viewport (measured on the rendered cards). */
+.mini-image-folder-viewport > .single-file-hero {
+ padding-bottom: 16px;
+ box-sizing: border-box;
+}
+.list.horizontal .mini-image-folder-viewport > .single-file-hero {
+ padding-bottom: 12px;
}
/* Single Image Folder Card (Framed image in folder card + borderless folder flap) */
@@ -1275,48 +1312,138 @@
}
/* ------------------------------------------------------------------ */
-/* File Stacks — Pure 3D Folders (No container card, 100% opaque) */
+/* File stacks — a cascade of the glass folder icons */
/* ------------------------------------------------------------------ */
-
-.image-folder-stack-item.file-stack-item,
-.list.horizontal .image-folder-stack-item.file-stack-item {
- background: transparent !important;
- box-shadow: none !important;
- border: none !important;
- border-radius: 0 !important;
- display: flex !important;
- align-items: center !important;
- justify-content: center !important;
- overflow: visible !important;
- opacity: 1 !important;
-}
-
-.image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-0,
-.image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-1,
-.image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-2,
-.image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-3,
-.list.horizontal .image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-0,
-.list.horizontal .image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-1,
-.list.horizontal .image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-2,
-.list.horizontal .image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-3 {
- opacity: 1 !important;
- background: transparent !important;
- box-shadow: none !important;
- border: none !important;
+/* The folders have see-through fronts, so a tight fan of four (each with
+ its own heavy shadow) read as a smear. The front folder sits in full
+ color with the only shadow; the others peek out to the sides and behind,
+ smaller and dimmed, so the glass reads as depth. Positions are % of the
+ icon, so the same rules fit both docks. Hover spreads them a little with
+ a small tilt. Only transform animates (each folder is its own layer,
+ rastered once); the dimming and the shadow never change. Photo cards in
+ a mixed stack keep the .image-folder-stack-item rules above. */
+
+.file-stack-folder {
+ position: absolute;
+ display: block;
+ line-height: 0;
+ transform-origin: 50% 70%;
+ transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
+ will-change: transform;
}
-.image-folder-stack-item.file-stack-item svg,
-.image-folder-stack-item.file-stack-item img.file-kind-img {
+.file-stack-folder img.file-kind-img,
+.file-stack-folder svg {
display: block;
- filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.65));
- transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), filter 0.22s ease;
}
-.item.is-image-folder-card:hover .image-folder-stack-item.file-stack-item svg,
-.item-main:hover .image-folder-stack-item.file-stack-item svg,
-.item.is-image-folder-card:hover .image-folder-stack-item.file-stack-item img.file-kind-img,
-.item-main:hover .image-folder-stack-item.file-stack-item img.file-kind-img {
- filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.75));
+.file-stack-folder.pos-0 {
+ z-index: 4;
+}
+.file-stack-folder.pos-0 img.file-kind-img {
+ filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
+}
+.file-stack-folder.pos-1 {
+ z-index: 3;
+}
+.file-stack-folder.pos-2 {
+ z-index: 2;
+}
+.file-stack-folder.pos-3 {
+ z-index: 1;
+}
+.file-stack-folder.pos-1 img.file-kind-img,
+.file-stack-folder.pos-2 img.file-kind-img {
+ filter: brightness(0.74);
+}
+.file-stack-folder.pos-3 img.file-kind-img {
+ filter: brightness(0.6);
+}
+
+/* 2 files: front a little left, the second behind on the right. */
+.image-folder-stack-deck[data-count="2"] .file-stack-folder.pos-0 {
+ transform: translate(-9%, 3%);
+}
+.image-folder-stack-deck[data-count="2"] .file-stack-folder.pos-1 {
+ transform: translate(17%, -5%) rotate(3deg) scale(0.88);
+}
+.item.is-image-folder-card:not(.is-expanded):hover .image-folder-stack-deck[data-count="2"] .file-stack-folder.pos-0,
+.item-main:hover .image-folder-stack-deck[data-count="2"] .file-stack-folder.pos-0 {
+ transform: translate(-12%, 2%) scale(1.03);
+}
+.item.is-image-folder-card:not(.is-expanded):hover .image-folder-stack-deck[data-count="2"] .file-stack-folder.pos-1,
+.item-main:hover .image-folder-stack-deck[data-count="2"] .file-stack-folder.pos-1 {
+ transform: translate(23%, -7%) rotate(6deg) scale(0.9);
+}
+
+/* 3 files: front centered, one each side behind (right first, as the photo cards). */
+.image-folder-stack-deck[data-count="3"] .file-stack-folder.pos-0 {
+ transform: translate(0, 3%);
+}
+.image-folder-stack-deck[data-count="3"] .file-stack-folder.pos-1 {
+ transform: translate(24%, -4%) rotate(3deg) scale(0.84);
+}
+.image-folder-stack-deck[data-count="3"] .file-stack-folder.pos-2 {
+ transform: translate(-24%, -4%) rotate(-3deg) scale(0.84);
+}
+.item.is-image-folder-card:not(.is-expanded):hover .image-folder-stack-deck[data-count="3"] .file-stack-folder.pos-0,
+.item-main:hover .image-folder-stack-deck[data-count="3"] .file-stack-folder.pos-0 {
+ transform: translate(0, 2%) scale(1.03);
+}
+.item.is-image-folder-card:not(.is-expanded):hover .image-folder-stack-deck[data-count="3"] .file-stack-folder.pos-1,
+.item-main:hover .image-folder-stack-deck[data-count="3"] .file-stack-folder.pos-1 {
+ transform: translate(30%, -6%) rotate(6deg) scale(0.86);
+}
+.item.is-image-folder-card:not(.is-expanded):hover .image-folder-stack-deck[data-count="3"] .file-stack-folder.pos-2,
+.item-main:hover .image-folder-stack-deck[data-count="3"] .file-stack-folder.pos-2 {
+ transform: translate(-30%, -6%) rotate(-6deg) scale(0.86);
+}
+
+/* 4+ files: front centered, left and right behind, a fourth further back. */
+.image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-0 {
+ transform: translate(0, 4%);
+}
+.image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-1 {
+ transform: translate(-24%, -3%) rotate(-3deg) scale(0.84);
+}
+.image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-2 {
+ transform: translate(24%, -3%) rotate(3deg) scale(0.84);
+}
+.image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-3 {
+ transform: translate(0, -17%) scale(0.74);
+}
+.item.is-image-folder-card:not(.is-expanded):hover .image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-0,
+.item-main:hover .image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-0 {
+ transform: translate(0, 3%) scale(1.03);
+}
+.item.is-image-folder-card:not(.is-expanded):hover .image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-1,
+.item-main:hover .image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-1 {
+ transform: translate(-30%, -5%) rotate(-6deg) scale(0.86);
+}
+.item.is-image-folder-card:not(.is-expanded):hover .image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-2,
+.item-main:hover .image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-2 {
+ transform: translate(30%, -5%) rotate(6deg) scale(0.86);
+}
+.item.is-image-folder-card:not(.is-expanded):hover .image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-3,
+.item-main:hover .image-folder-stack-deck[data-count="4"] .file-stack-folder.pos-3 {
+ transform: translate(0, -22%) scale(0.76);
+}
+
+html[data-motion='reduce'] .file-stack-folder {
+ transition: none;
+}
+
+/* Center the cascade in the viewport above the label flap. The back
+ folders rise above the front one, so the box is nudged down by about
+ half that rise to keep the whole group optically centered. */
+.image-folder-viewport .image-folder-stack-deck.is-file-deck {
+ margin-top: 0;
+ padding: 8px 0 26px;
+ box-sizing: border-box;
+}
+.list.horizontal .image-folder-viewport .image-folder-stack-deck.is-file-deck {
+ margin-top: 0;
+ padding: 6px 0 24px;
}
.file-stack-expanded-track {
@@ -2428,20 +2555,6 @@
.list.horizontal .item-main:hover .image-folder-stack-deck[data-count="4"] .image-folder-stack-item.pos-2 {
transform: translate(17px, -6px) rotate(17deg) scale(0.95);
}
-/* Standalone 3D Folder file stacks in Horizontal Dock (no container card, 100% opacity, transparent box) */
-.list.horizontal .image-folder-stack-deck .image-folder-stack-item.file-stack-item,
-.list.horizontal .image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-0,
-.list.horizontal .image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-1,
-.list.horizontal .image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-2,
-.list.horizontal .image-folder-stack-deck .image-folder-stack-item.file-stack-item.pos-3 {
- background: transparent !important;
- box-shadow: none !important;
- border: none !important;
- border-radius: 0 !important;
- opacity: 1 !important;
- overflow: visible !important;
-}
-
.list.horizontal .item.is-image-folder-card.is-expanded .image-folder-flap-wrap {
margin-top: -18px;
flex-shrink: 0;
@@ -3062,3 +3175,116 @@
background: rgba(255, 255, 255, 0.1);
color: #ffffff;
}
+
+/* ------------------------------------------------------------------ */
+/* Label + tags (user metadata) */
+/* ------------------------------------------------------------------ */
+
+/* Side-dock text cards: the label is a title line above the content
+ (cards there are content-height, so this simply adds one line). */
+.item-label {
+ padding: 11px 16px 0 16px;
+ font-family: var(--font-ui);
+ font-size: calc(12px * var(--font-scale, 1));
+ font-weight: 600;
+ line-height: 1.3;
+ color: #ffffff;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.item-label + .item-content {
+ padding-top: 4px;
+}
+
+/* Fixed-height cards (top dock, image and file cards): the label takes the
+ place of the small detail text in the bottom line, so nothing grows. */
+.meta-label {
+ min-width: 0;
+ flex-shrink: 1;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-weight: 600;
+ color: rgba(255, 255, 255, 0.9);
+}
+
+.meta-tag {
+ flex-shrink: 0;
+ max-width: 96px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-size: calc(10.5px * var(--font-scale, 1));
+ font-weight: 600;
+ color: rgba(255, 255, 255, 0.72);
+ background: rgba(255, 255, 255, 0.08);
+ padding: 0.5px 5px;
+ border-radius: 4px;
+ letter-spacing: 0.01em;
+}
+
+.meta-tag-more {
+ flex-shrink: 0;
+ font-size: calc(10.5px * var(--font-scale, 1));
+ font-weight: 600;
+ color: rgba(255, 255, 255, 0.5);
+}
+
+.item.is-color-card.is-light-color .item-label {
+ color: rgba(0, 0, 0, 0.86);
+}
+.item.is-color-card.is-light-color .meta-label,
+.item.is-color-card.is-light-color .meta-tag,
+.item.is-color-card.is-light-color .meta-tag-more {
+ color: rgba(0, 0, 0, 0.7) !important;
+}
+.item.is-color-card.is-light-color .meta-tag {
+ background: rgba(0, 0, 0, 0.08);
+}
+.item.is-color-card.is-dark-color .meta-label,
+.item.is-color-card.is-dark-color .meta-tag,
+.item.is-color-card.is-dark-color .meta-tag-more {
+ color: rgba(255, 255, 255, 0.82) !important;
+}
+.item.is-color-card.is-dark-color .meta-tag {
+ background: rgba(255, 255, 255, 0.12);
+}
+
+/* The card whose right-click menu is open keeps its hover look. */
+.item.menu-target:not(.is-color-card) {
+ background: var(--bg-card-hover);
+}
+
+/* Preview flyout: the item's label and every tag above the content. */
+.flyout-meta-head {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ margin-bottom: 14px;
+}
+.flyout-meta-label {
+ font-family: var(--font-ui);
+ font-size: calc(15px * var(--font-scale, 1));
+ font-weight: 700;
+ line-height: 1.3;
+ color: #ffffff;
+ word-break: break-word;
+}
+.flyout-meta-tags {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 5px;
+}
+.flyout-meta-tag {
+ height: 22px;
+ display: inline-flex;
+ align-items: center;
+ padding: 0 9px;
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.08);
+ color: rgba(255, 255, 255, 0.82);
+ font-family: var(--font-ui);
+ font-size: calc(11.5px * var(--font-scale, 1));
+ font-weight: 600;
+}
diff --git a/src/styles/panel.css b/src/styles/panel.css
index 089e197..ca27175 100644
--- a/src/styles/panel.css
+++ b/src/styles/panel.css
@@ -1211,3 +1211,61 @@
transition: none;
}
+/* Tag suggestions under the search while it ends in "#word". Chips never
+ take focus, so typing stays in the search box. */
+.tag-suggest {
+ display: flex;
+ flex-wrap: nowrap;
+ gap: 5px;
+ margin: -2px var(--pad) 6px;
+ overflow: hidden;
+ position: relative;
+ z-index: 1;
+}
+.tag-suggest.is-horizontal {
+ position: absolute;
+ top: 4px;
+ left: 50%;
+ transform: translateX(-50%);
+ max-width: calc(100% - 32px);
+ margin: 0;
+ padding: 4px;
+ border-radius: var(--radius-pill);
+ /* Blade surface, no drop shadow; the hairline keeps the strip's edge
+ visible over the cards it floats above. */
+ background: #000000;
+ box-shadow: inset 0 0 0 1px var(--edge-strong);
+ z-index: 30;
+}
+.tag-suggest-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ flex-shrink: 0;
+ max-width: 140px;
+ height: 24px;
+ padding: 0 9px;
+ border: none;
+ border-radius: var(--radius-pill);
+ background: var(--bg-card);
+ color: rgba(255, 255, 255, 0.82);
+ font-family: var(--font-ui);
+ font-size: calc(11.5px * var(--font-scale, 1));
+ font-weight: 600;
+ cursor: pointer;
+ transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
+}
+.tag-suggest-chip:hover {
+ background: var(--act-on);
+ color: var(--act-on-ink);
+}
+.tag-suggest-name {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.tag-suggest-count {
+ font-size: calc(10px * var(--font-scale, 1));
+ font-weight: 600;
+ opacity: 0.55;
+}
diff --git a/src/styles/previewFlyout.css b/src/styles/previewFlyout.css
new file mode 100644
index 0000000..534a445
--- /dev/null
+++ b/src/styles/previewFlyout.css
@@ -0,0 +1,340 @@
+/**
+ * Preview flyout: shell motion, header, and the per-kind bodies.
+ *
+ * Motion is plain CSS on transform + opacity only, so it runs on the
+ * compositor with no JavaScript per frame. Opening uses a soft spring
+ * (critically under-damped, ~0.5% overshoot, 90% there at ~210ms) sampled
+ * into linear(); closing is a quick ease-in. The shell grows from the card
+ * that was previewed (transform-origin is set inline from its position).
+ * Keep PREVIEW_EXIT_MS in PreviewFlyout.tsx equal to the exit duration.
+ */
+
+.pf-wrap {
+ --pf-spring: linear(0, 0.0172, 0.0616, 0.1238, 0.1968, 0.275, 0.3545, 0.4322, 0.5062, 0.5751, 0.6381, 0.6948, 0.7453, 0.7896, 0.828, 0.8611, 0.8892, 0.9128, 0.9326, 0.9488, 0.9621, 0.9728, 0.9813, 0.988, 0.9932, 0.9971, 1, 1.002, 1.0034, 1.0043, 1.0048, 1.005, 1.005, 1.0048, 1.0045, 1.0042, 1.0038, 1.0034, 1.003, 1.0026, 1);
+ --pf-out: cubic-bezier(0.4, 0, 1, 1);
+}
+
+.pf-wrap.from-left {
+ animation: pf-fade-in 180ms cubic-bezier(0.2, 0, 0, 1) both, pf-in-left 500ms var(--pf-spring) both;
+}
+.pf-wrap.from-right {
+ animation: pf-fade-in 180ms cubic-bezier(0.2, 0, 0, 1) both, pf-in-right 500ms var(--pf-spring) both;
+}
+.pf-wrap.from-top {
+ animation: pf-fade-in 180ms cubic-bezier(0.2, 0, 0, 1) both, pf-in-top 500ms var(--pf-spring) both;
+}
+.pf-wrap.from-left.is-leaving {
+ animation: pf-out-left 170ms var(--pf-out) both;
+}
+.pf-wrap.from-right.is-leaving {
+ animation: pf-out-right 170ms var(--pf-out) both;
+}
+.pf-wrap.from-top.is-leaving {
+ animation: pf-out-top 170ms var(--pf-out) both;
+}
+.pf-wrap.is-reduced {
+ animation: pf-fade-in 120ms linear both;
+}
+.pf-wrap.is-reduced.is-leaving {
+ animation: pf-fade-out 120ms linear both;
+}
+
+@keyframes pf-fade-in {
+ from { opacity: 0; }
+ to { opacity: 1; }
+}
+@keyframes pf-fade-out {
+ from { opacity: 1; }
+ to { opacity: 0; }
+}
+@keyframes pf-in-left {
+ from { transform: translateX(-14px) scale(0.94); }
+ to { transform: none; }
+}
+@keyframes pf-in-right {
+ from { transform: translateX(14px) scale(0.94); }
+ to { transform: none; }
+}
+@keyframes pf-in-top {
+ from { transform: translateY(-12px) scale(0.94); }
+ to { transform: none; }
+}
+@keyframes pf-out-left {
+ to { opacity: 0; transform: translateX(-8px) scale(0.97); }
+}
+@keyframes pf-out-right {
+ to { opacity: 0; transform: translateX(8px) scale(0.97); }
+}
+@keyframes pf-out-top {
+ to { opacity: 0; transform: translateY(-8px) scale(0.97); }
+}
+
+/* The panel itself. Black like the blade; a faint inner rim keeps its edge
+ crisp over dark wallpapers (no drop shadow, same as the blade). */
+.preview-flyout {
+ box-shadow: inset 0 0 0 1px var(--edge-light);
+}
+
+/* Content of one item. Re-keyed when the preview switches to another card,
+ so the new content settles in while the panel stays put. */
+.pf-swap {
+ display: flex;
+ flex-direction: column;
+ flex: 1 1 auto;
+ min-height: 0;
+ animation: pf-swap-in 220ms cubic-bezier(0.2, 0, 0, 1) both;
+}
+.pf-wrap.is-reduced .pf-swap {
+ animation: pf-fade-in 120ms linear both;
+}
+@keyframes pf-swap-in {
+ from { opacity: 0; transform: translateY(4px); }
+ to { opacity: 1; transform: none; }
+}
+
+/* ------------------------------ header ------------------------------ */
+
+.pf-head {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-height: 30px;
+ padding: 14px 14px 0 20px;
+ font-family: var(--font-ui);
+ font-size: calc(12px * var(--font-scale, 1));
+ white-space: nowrap;
+}
+.pf-head-icon {
+ display: inline-flex;
+ flex-shrink: 0;
+ align-items: center;
+ justify-content: center;
+ width: 14px;
+ height: 14px;
+ color: rgba(255, 255, 255, 0.7);
+}
+.pf-head-icon svg {
+ width: 14px;
+ height: 14px;
+}
+.pf-head-title {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ color: rgba(255, 255, 255, 0.92);
+ font-weight: 600;
+}
+.pf-head-detail,
+.pf-head-time {
+ color: var(--text-tertiary);
+ font-weight: 500;
+}
+.pf-head-detail {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.pf-head-time {
+ flex-shrink: 0;
+}
+.pf-head-detail::before,
+.pf-head-time::before {
+ content: '·';
+ margin-inline-end: 8px;
+ color: rgba(255, 255, 255, 0.28);
+}
+.pf-head-spacer {
+ flex: 1 1 0;
+}
+.pf-head .act-pill {
+ flex-shrink: 0;
+}
+
+/* ------------------------------- body ------------------------------- */
+
+.pf-scroll {
+ flex: 1 1 auto;
+ min-height: 0;
+ padding: 14px 20px 20px;
+ overflow-x: hidden;
+ overflow-y: auto;
+}
+.pf-scroll.has-batch {
+ padding-bottom: 68px;
+}
+
+.pf-text {
+ color: rgba(255, 255, 255, 0.88);
+ font-family: var(--font-ui);
+ font-size: calc(13.5px * var(--font-scale, 1));
+ font-weight: 400;
+ line-height: 1.65;
+ letter-spacing: 0.01em;
+ white-space: pre-wrap;
+ word-break: break-word;
+}
+
+/* The image is drawn at the size fitPreviewImage() picked (inline width and
+ height): centered when smaller than the panel, and taller than the body
+ only for long screenshots, which then scroll. */
+.pf-image-box {
+ position: relative;
+ display: flex;
+ justify-content: center;
+ cursor: grab;
+}
+.pf-image {
+ display: block;
+ max-width: 100%;
+ object-fit: contain;
+ border-radius: 12px;
+}
+
+/* Link: page title, optional section chip, then the full address. */
+.pf-link-title {
+ color: #ffffff;
+ font-family: var(--font-ui);
+ font-size: calc(16px * var(--font-scale, 1));
+ font-weight: 600;
+ line-height: 1.35;
+ word-break: break-word;
+}
+.pf-link-sub {
+ align-self: flex-start;
+ padding: 2px 8px;
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.08);
+ color: rgba(255, 255, 255, 0.62);
+ font-family: var(--font-ui);
+ font-size: calc(10.5px * var(--font-scale, 1));
+ font-weight: 600;
+ letter-spacing: 0.04em;
+ text-transform: uppercase;
+}
+
+/* Color: a big swatch, then every format as a row that copies on click. */
+.pf-swatch {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ min-height: 132px;
+ padding: 20px;
+ border-radius: 16px;
+ box-sizing: border-box;
+ cursor: pointer;
+ font-family: var(--font-mono);
+ font-size: calc(24px * var(--font-scale, 1));
+ font-weight: 700;
+ letter-spacing: 0.04em;
+ transition: transform 0.12s ease;
+}
+.pf-swatch:active {
+ transform: scale(0.99);
+}
+.pf-formats {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ margin-top: 12px;
+}
+.pf-format {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ width: 100%;
+ height: 34px;
+ padding: 0 10px 0 12px;
+ border: none;
+ border-radius: 10px;
+ background: transparent;
+ color: rgba(255, 255, 255, 0.86);
+ font-family: var(--font-mono);
+ font-size: calc(12.5px * var(--font-scale, 1));
+ text-align: start;
+ cursor: pointer;
+ box-sizing: border-box;
+ transition: background-color 0.12s ease, color 0.12s ease;
+}
+.pf-format:hover {
+ background: var(--bg-card);
+ color: #ffffff;
+}
+.pf-format:focus-visible {
+ outline: 2px solid rgba(255, 255, 255, 0.45);
+ outline-offset: -2px;
+}
+.pf-format-name {
+ flex-shrink: 0;
+ width: 32px;
+ color: var(--text-tertiary);
+ font-size: calc(10.5px * var(--font-scale, 1));
+ font-weight: 700;
+ letter-spacing: 0.06em;
+}
+.pf-format-value {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.pf-format-icon {
+ display: inline-flex;
+ flex-shrink: 0;
+ color: rgba(255, 255, 255, 0.4);
+ opacity: 0;
+ transition: opacity 0.12s ease, color 0.12s ease;
+}
+.pf-format-icon svg {
+ width: 14px;
+ height: 14px;
+}
+.pf-format:hover .pf-format-icon,
+.pf-format:focus-visible .pf-format-icon,
+.pf-format.is-done .pf-format-icon {
+ opacity: 1;
+ color: #ffffff;
+}
+
+/* ---------------------------- batch bar ----------------------------- */
+
+/* Same raised surface as the card menu. */
+.pf-batch {
+ position: absolute;
+ bottom: 12px;
+ left: 12px;
+ right: 12px;
+ z-index: 20;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 4px 4px 4px 6px;
+ border-radius: 999px;
+ background: #1c1c1c;
+ box-shadow: inset 0 0 0 1px var(--divider);
+ animation: pf-fade-in 140ms ease-out both, pf-batch-in 440ms var(--pf-spring) both;
+}
+.pf-batch.is-leaving {
+ animation: pf-batch-out 140ms var(--pf-out) both;
+}
+.pf-wrap.is-reduced .pf-batch {
+ animation: pf-fade-in 120ms linear both;
+}
+.pf-wrap.is-reduced .pf-batch.is-leaving {
+ animation: pf-fade-out 120ms linear both;
+}
+.pf-batch-group {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+.pf-batch-group:first-child {
+ gap: 10px;
+}
+@keyframes pf-batch-in {
+ from { transform: translateY(14px) scale(0.96); }
+ to { transform: none; }
+}
+@keyframes pf-batch-out {
+ to { opacity: 0; transform: translateY(10px) scale(0.97); }
+}
diff --git a/tests/actionPills.test.ts b/tests/actionPills.test.ts
index c57da79..84201fe 100644
--- a/tests/actionPills.test.ts
+++ b/tests/actionPills.test.ts
@@ -71,7 +71,8 @@ describe('preview flyout buttons use the shared styles', () => {
expect(flyout).not.toContain('onMouseLeave')
})
- it('standalone quick actions sit in a pill', () => {
- expect(flyout.split('className="act-pill"').length - 1).toBe(5)
+ it('standalone quick actions sit in a pill (the shared header row)', () => {
+ expect(flyout.split('className="act-pill"').length - 1).toBe(1)
+ expect(flyout).toMatch(/<div className="pf-head">[\s\S]*className="act-pill"/)
})
})
diff --git a/tests/cardMenu.test.ts b/tests/cardMenu.test.ts
new file mode 100644
index 0000000..530e71d
--- /dev/null
+++ b/tests/cardMenu.test.ts
@@ -0,0 +1,441 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+import type { ClipboardItemDto } from '../shared/types'
+import { activeTagPrefix, completeTag, matchesTagFilters, metaMatchesText, parseQuery, suggestTags, tagCounts } from '../src/lib/tagQuery'
+import { matches } from '../src/hooks/useFilteredItems'
+import { colorFormats } from '../src/lib/colorUtils'
+import { externalHref, stripTracking } from '../src/lib/urlPreview'
+import { itemMetaKey, itemRenderKey } from '../src/lib/itemSignature'
+import { holdsFocus, noteFocusHolder, takeSearchEngaged } from '../src/lib/searchFocus'
+import { placeMenu } from '../src/components/CardMenu'
+import { cardMenuHolds, cursorToWindow } from '../src/hooks/useEdgeHover'
+import { CARD_MENU_STAY_MS, useStore } from '../src/store/appStore'
+import { KEYBOARD_RELEASE_DELAY_MS, acquireKeyboard, releaseAllKeyboard, releaseKeyboard } from '../src/lib/keyboardFocus'
+
+const read = (p: string) => readFileSync(join(__dirname, '..', p), 'utf8')
+
+const textItem = (id: string, text: string, extra: Partial<ClipboardItemDto> = {}): ClipboardItemDto => ({
+ id,
+ data: { kind: 'text', text, isUrl: false },
+ capturedAt: 1,
+ hitCount: 1,
+ pinned: false,
+ ...extra
+})
+const imageItem = (id: string, extra: Partial<ClipboardItemDto> = {}): ClipboardItemDto => ({
+ id,
+ data: { kind: 'image', imageId: id, width: 1, height: 1, bytes: 1, preview: 'p' },
+ capturedAt: 1,
+ hitCount: 1,
+ pinned: false,
+ ...extra
+})
+
+describe('search over labels and tags', () => {
+ it('a query without #tags is one substring, as before', () => {
+ expect(parseQuery(' Hello World ')).toEqual({ text: 'hello world', tags: [] })
+ expect(parseQuery('')).toEqual({ text: '', tags: [] })
+ })
+
+ it('#words become tag filters, the rest stays text', () => {
+ expect(parseQuery('#Work invoice #client-a')).toEqual({ text: 'invoice', tags: ['work', 'client-a'] })
+ expect(parseQuery('#')).toEqual({ text: '', tags: [] })
+ })
+
+ it('finds images by label, text by label or tag, keeps content search', () => {
+ const img = imageItem('g', { label: 'Invoice March', tags: ['finance'] })
+ const note = textItem('n', 'agenda', { label: 'Meeting', tags: ['work', 'team'] })
+ const plain = textItem('p', 'just some words')
+ expect(matches(img, parseQuery('invoice'))).toBe(true)
+ expect(matches(img, parseQuery('finance'))).toBe(true)
+ expect(matches(imageItem('x'), parseQuery('anything'))).toBe(false)
+ expect(matches(note, parseQuery('meet'))).toBe(true)
+ expect(matches(note, parseQuery('agenda'))).toBe(true)
+ expect(matches(note, parseQuery('#wo'))).toBe(true)
+ expect(matches(note, parseQuery('#work #team'))).toBe(true)
+ expect(matches(note, parseQuery('#work #finance'))).toBe(false)
+ expect(matches(note, parseQuery('#work agenda'))).toBe(true)
+ expect(matches(note, parseQuery('#work nothing'))).toBe(false)
+ expect(matches(plain, parseQuery('some words'))).toBe(true)
+ expect(matches(plain, parseQuery('#work'))).toBe(false)
+ expect(matches(plain, parseQuery(''))).toBe(true)
+ })
+
+ it('tag helpers', () => {
+ expect(matchesTagFilters({ tags: ['work'] }, [])).toBe(true)
+ expect(matchesTagFilters({}, ['w'])).toBe(false)
+ expect(metaMatchesText({ tags: ['wifi'] }, '#wi')).toBe(true)
+ expect(metaMatchesText({ tags: ['wifi'] }, '#')).toBe(false)
+ const counts = tagCounts([{ tags: ['work', 'wifi'] }, { tags: ['work'] }, {}, { tags: ['team'] }])
+ expect([...counts]).toEqual([['work', 2], ['wifi', 1], ['team', 1]])
+ expect(suggestTags(counts, '')).toEqual([{ tag: 'work', count: 2 }, { tag: 'team', count: 1 }, { tag: 'wifi', count: 1 }])
+ expect(suggestTags(counts, '#W', { exclude: ['work'] })).toEqual([{ tag: 'wifi', count: 1 }])
+ expect(suggestTags(counts, '', { limit: 1 })).toHaveLength(1)
+ expect(activeTagPrefix('invoice #wo')).toBe('wo')
+ expect(activeTagPrefix('#')).toBe('')
+ expect(activeTagPrefix('#work ')).toBeNull()
+ expect(activeTagPrefix('a#b')).toBeNull()
+ expect(completeTag('invoice #wo', 'work')).toBe('invoice #work ')
+ expect(completeTag('#', 'team')).toBe('#team ')
+ })
+})
+
+describe('menu helpers', () => {
+ it('color formats keep the source as typed and convert the rest', () => {
+ expect(colorFormats('#3B82F6')).toEqual({ source: 'hex', hex: '#3B82F6', rgb: 'rgb(59, 130, 246)', hsl: 'hsl(217, 91%, 60%)' })
+ expect(colorFormats('rgb(255, 0, 0)')).toEqual({ source: 'rgb', hex: '#ff0000', rgb: 'rgb(255, 0, 0)', hsl: 'hsl(0, 100%, 50%)' })
+ expect(colorFormats('hsl(120, 100%, 25%)')).toMatchObject({ source: 'hsl', hex: '#008000', rgb: 'rgb(0, 128, 0)', hsl: 'hsl(120, 100%, 25%)' })
+ expect(colorFormats('#00000080')).toMatchObject({ rgb: 'rgba(0, 0, 0, 0.5)', hsl: 'hsla(0, 0%, 0%, 0.5)' })
+ expect(colorFormats('#fff')).toMatchObject({ rgb: 'rgb(255, 255, 255)', hsl: 'hsl(0, 0%, 100%)' })
+ expect(colorFormats('not a color')).toBeNull()
+ })
+
+ it('clean link removes only tracking parameters', () => {
+ expect(stripTracking('https://www.example.com/a/?id=7&utm_source=x&UTM_Medium=y&fbclid=Z#top')).toBe('https://www.example.com/a/?id=7#top')
+ expect(stripTracking('https://example.com/?gclid=1&si=2')).toBe('https://example.com/')
+ expect(stripTracking('https://example.com/p?q=a+b&ref=tw&x')).toBe('https://example.com/p?q=a+b&x')
+ expect(stripTracking('https://example.com/p?q=1')).toBe('https://example.com/p?q=1')
+ expect(stripTracking('https://example.com/p')).toBe('https://example.com/p')
+ expect(stripTracking('www.example.com/?utm_source=x')).toBe('www.example.com/?utm_source=x')
+ expect(stripTracking(' https://e.com/?utm_id=1 ')).toBe('https://e.com/')
+ })
+
+ it('links without a scheme open as web links', () => {
+ expect(externalHref('www.example.com')).toBe('https://www.example.com')
+ expect(externalHref(' https://a.b ')).toBe('https://a.b')
+ expect(externalHref('mailto:[email protected]')).toBe('mailto:[email protected]')
+ })
+
+ it('placeMenu opens away from the pointer and never leaves its area', () => {
+ const area = { left: 8, top: 8, right: 262, bottom: 792 }
+ expect(placeMenu({ x: 40, y: 100 }, { w: 208, h: 240 }, area)).toEqual({ left: 42, top: 102, origin: 'top left' })
+ // near the right edge: flips left
+ expect(placeMenu({ x: 250, y: 100 }, { w: 208, h: 240 }, area)).toMatchObject({ left: 40, origin: 'top right' })
+ // near the bottom: flips up
+ expect(placeMenu({ x: 40, y: 700 }, { w: 208, h: 240 }, area)).toMatchObject({ top: 458, origin: 'bottom left' })
+ // too wide for the area: pinned to its left edge
+ expect(placeMenu({ x: 100, y: 100 }, { w: 400, h: 240 }, area).left).toBe(8)
+ // too tall: pinned to its top edge
+ expect(placeMenu({ x: 40, y: 300 }, { w: 208, h: 900 }, area).top).toBe(8)
+ })
+
+ it('placeMenu can prefer the left side (right dock opens toward the screen middle)', () => {
+ const win = { left: 8, top: 8, right: 376, bottom: 992 }
+ expect(placeMenu({ x: 300, y: 100 }, { w: 208, h: 240 }, win, 'left')).toEqual({ left: 90, top: 102, origin: 'top right' })
+ // no room on the left: flips right
+ expect(placeMenu({ x: 100, y: 100 }, { w: 208, h: 240 }, win, 'left')).toMatchObject({ left: 102, origin: 'top left' })
+ // left dock (prefer right) opens right of the pointer and may pass the blade (270px)
+ expect(placeMenu({ x: 150, y: 100 }, { w: 208, h: 240 }, win, 'right')).toMatchObject({ left: 152, origin: 'top left' })
+ // neither side fits: stays on the preferred side, clamped inside
+ expect(placeMenu({ x: 190, y: 100 }, { w: 208, h: 240 }, win, 'right').left).toBe(168)
+ })
+
+ it('hover-close treats the open menu (or the editor) as part of the shelf', () => {
+ const rect = { left: 100, top: 200, right: 300, bottom: 400 }
+ expect(cardMenuHolds(null, rect, { x: 150, y: 250 })).toBe(false)
+ expect(cardMenuHolds({ mode: 'menu' }, rect, { x: 150, y: 250 })).toBe(true)
+ expect(cardMenuHolds({ mode: 'menu' }, rect, { x: 310, y: 405 })).toBe(true) // small margin
+ expect(cardMenuHolds({ mode: 'menu' }, rect, { x: 500, y: 250 })).toBe(false)
+ expect(cardMenuHolds({ mode: 'menu' }, null, { x: 150, y: 250 })).toBe(false)
+ expect(cardMenuHolds({ mode: 'edit' }, rect, { x: 900, y: 900 }, true)).toBe(true)
+ // editor open but the shelf never got the keyboard: only its own box holds
+ expect(cardMenuHolds({ mode: 'edit' }, rect, { x: 900, y: 900 }, false)).toBe(false)
+ expect(cardMenuHolds({ mode: 'edit' }, rect, { x: 150, y: 250 }, false)).toBe(true)
+ })
+
+ it('maps the work-area cursor into window pixels for each dock', () => {
+ expect(cursorToWindow({ x: 50, y: 60 }, 'left', 1920, 384, 0)).toEqual({ x: 50, y: 60 })
+ expect(cursorToWindow({ x: 1900, y: 60 }, 'right', 1920, 384, 0)).toEqual({ x: 364, y: 60 })
+ // top: window starts 30px left of the dock
+ expect(cursorToWindow({ x: 450, y: 60 }, 'top', 1920, 1140, 420)).toEqual({ x: 60, y: 60 })
+ })
+})
+
+describe('keyboard focus holders', () => {
+ afterEach(() => {
+ takeSearchEngaged()
+ })
+
+ it('first holder turns focus on, last one turns it off', () => {
+ expect(noteFocusHolder('search', true)).toEqual({ first: true, last: false })
+ expect(noteFocusHolder('card-meta', true)).toEqual({ first: false, last: false })
+ expect(noteFocusHolder('card-meta', true)).toEqual({ first: false, last: false })
+ expect(noteFocusHolder('search', false)).toEqual({ first: false, last: false })
+ expect(holdsFocus()).toBe(true)
+ expect(noteFocusHolder('card-meta', false)).toEqual({ first: false, last: true })
+ expect(noteFocusHolder('card-meta', false)).toEqual({ first: false, last: false })
+ expect(holdsFocus()).toBe(false)
+ })
+
+ it('closing the panel takes every holder at once', () => {
+ noteFocusHolder('search', true)
+ noteFocusHolder('card-meta', true)
+ expect(takeSearchEngaged()).toBe(true)
+ expect(holdsFocus()).toBe(false)
+ expect(takeSearchEngaged()).toBe(false)
+ })
+})
+
+describe('cards re-render on a label / tag change', () => {
+ it('render key and meta key include label and tags', () => {
+ const a = textItem('a', 'x')
+ const b = textItem('a', 'x', { label: 'L' })
+ const c = textItem('a', 'x', { label: 'L', tags: ['t'] })
+ expect(itemMetaKey(a)).toBe('')
+ expect(itemRenderKey(a)).not.toBe(itemRenderKey(b))
+ expect(itemRenderKey(b)).not.toBe(itemRenderKey(c))
+ expect(itemRenderKey(c)).toBe(itemRenderKey(textItem('a', 'x', { label: 'L', tags: ['t'] })))
+ })
+})
+
+describe('store: card menu and label saving', () => {
+ let setItemMeta: ReturnType<typeof vi.fn>
+ beforeEach(() => {
+ setItemMeta = vi.fn(async (id: string, meta: { label?: string | null; tags?: string[] | null }) =>
+ useStore.getState().items.map((it) => (it.id === id ? { ...it, label: meta.label ?? undefined, tags: meta.tags ?? undefined, pinned: true } : it))
+ )
+ ;(globalThis as any).window = {
+ edge: {
+ setItemMeta,
+ copyText: vi.fn(async () => true),
+ pasteItem: vi.fn(async () => true),
+ setPreviewMode: vi.fn(),
+ focusWindow: vi.fn(async () => undefined),
+ pauseHotkey: vi.fn(async () => undefined)
+ }
+ }
+ useStore.setState({ items: [textItem('a', 'x'), textItem('b', 'y')], toasts: [], cardMenu: null, cardMenuRect: null, open: true })
+ })
+ afterEach(() => {
+ delete (globalThis as any).window
+ })
+
+ it('a label-only change from main is applied (not skipped as "unchanged")', () => {
+ const items = useStore.getState().items.map((it) => (it.id === 'a' ? { ...it, label: 'New' } : it))
+ useStore.getState().setItems(items)
+ expect(useStore.getState().items[0].label).toBe('New')
+ })
+
+ it('opens, switches to the editor, and closes with every view change', () => {
+ const s = () => useStore.getState()
+ s().openCardMenu('a', 10, 20)
+ expect(s().cardMenu).toEqual({ itemId: 'a', x: 10, y: 20, mode: 'menu' })
+ s().editCardMeta('tags')
+ expect(s().cardMenu).toMatchObject({ mode: 'edit', focus: 'tags' })
+ s().setCardMenuRect({ left: 1, top: 2, right: 3, bottom: 4 })
+ s().setOpen(false)
+ expect(s().cardMenu).toBeNull()
+ expect(s().cardMenuRect).toBeNull()
+ s().openCardMenu('a', 0, 0)
+ s().setTypeFilter('links')
+ expect(s().cardMenu).toBeNull()
+ s().openCardMenu('a', 0, 0)
+ s().setSettingsOpen(true)
+ expect(s().cardMenu).toBeNull()
+ s().setSettingsOpen(false)
+ s().openCardMenu('a', 0, 0)
+ s().setEmojiOpen(true)
+ expect(s().cardMenu).toBeNull()
+ })
+
+ it('saves through main, shows the cleaned value at once, and says when it pinned', async () => {
+ const pending = useStore.getState().setItemMeta('a', { label: ' Office Wi-Fi ', tags: ['#Work'] })
+ expect(useStore.getState().items[0]).toMatchObject({ label: 'Office Wi-Fi', tags: ['work'], pinned: true })
+ await pending
+ expect(setItemMeta).toHaveBeenCalledWith('a', { label: ' Office Wi-Fi ', tags: ['#Work'] })
+ expect(useStore.getState().toasts.map((t) => t.message)).toContain("Pinned so it's kept")
+ })
+
+ it('rolls back and reports when saving fails', async () => {
+ setItemMeta.mockRejectedValueOnce(new Error('down'))
+ await useStore.getState().setItemMeta('b', { label: 'X' })
+ expect(useStore.getState().items[1].label).toBeUndefined()
+ expect(useStore.getState().items[1].pinned).toBe(false)
+ expect(useStore.getState().toasts.some((t) => t.tone === 'error')).toBe(true)
+ })
+
+ it('plain paste and derived copies go to main with the right options', async () => {
+ await useStore.getState().paste('a', { plain: true })
+ expect((globalThis as any).window.edge.pasteItem).toHaveBeenCalledWith('a', { plain: true })
+ await useStore.getState().paste('a')
+ expect((globalThis as any).window.edge.pasteItem).toHaveBeenLastCalledWith('a', undefined)
+ expect(await useStore.getState().copyText('https://e.com/')).toBe(true)
+ expect(useStore.getState().toasts.map((t) => t.message)).toContain('Copied to clipboard')
+ useStore.setState({ toasts: [] })
+ await useStore.getState().copyText('x', { quiet: true })
+ expect(useStore.getState().toasts).toHaveLength(0)
+ })
+})
+
+describe('wiring', () => {
+ it('IPC contract, preload and main handlers', () => {
+ const ipc = read('shared/ipc.ts')
+ expect(ipc).toContain("'item:paste': { args: [id: string, opts?: { plain?: boolean }]; result: boolean }")
+ expect(ipc).toContain("'item:set-meta': { args: [id: string, meta: import('./itemMeta').ItemMetaPatch]; result: ClipboardItemDto[] }")
+ expect(ipc).toContain("'item:copy-text': { args: [text: string]; result: boolean }")
+ expect(ipc).toContain("'item:save-images': { args: [id: string]; result: string[] }")
+ const preload = read('electron/preload/index.ts')
+ expect(preload).toContain("pasteItem: (id: string, opts?: { plain?: boolean }) => invoke('item:paste', id, opts)")
+ expect(preload).toContain("setItemMeta: (id: string, meta: import('../../shared/itemMeta').ItemMetaPatch) => invoke('item:set-meta', id, meta)")
+ expect(preload).toContain("copyText: (text: string) => invoke('item:copy-text', text)")
+ expect(preload).toContain("saveImages: (id: string) => invoke('item:save-images', id)")
+ const main = read('electron/main/ipc.ts')
+ expect(main).toMatch(/handle\('item:set-meta'[\s\S]*?getStore\(\)\.setMeta\(id, meta\)/)
+ expect(main).toMatch(/handle\('item:copy-text'[\s\S]*?watcher\.setPaused\(true\)[\s\S]*?resyncSignature\(\)/)
+ expect(main).toMatch(/handle\('item:save-images'[\s\S]*?app\.getPath\('downloads'\)/)
+ expect(main).toContain("writeItemToClipboard(itemDataWithFullText, item.capturedAt, { plain: opts?.plain === true })")
+ expect(main).toContain('clipboard.write(opts?.plain ? { text: formatted.text } : { text: formatted.text, html: formatted.html })')
+ expect(read('electron/main/window.ts')).toContain('if (isSafeExternalUrl(details.url))')
+ })
+
+ it('cards open the menu on right-click and show labels / tags', () => {
+ const card = read('src/components/ClipboardItem.tsx')
+ expect(card).toContain('onContextMenu={handleContextMenu}')
+ expect(card).toContain('s.openCardMenu(item.id, e.clientX, e.clientY)')
+ expect(card).toContain("if (e.button !== 0) return // right-click opens the menu; nothing to stage")
+ expect(card).toContain('<div className="item-label" title={item.label}>{item.label}</div>')
+ expect(card).toContain("if (target.closest('.card-menu')) return")
+ const panel = read('src/components/Panel.tsx')
+ expect(panel).toContain('<CardMenu />')
+ expect(panel).toContain('<TagSuggest isHorizontal={false} />')
+ expect(panel).toContain('<TagSuggest isHorizontal />')
+ })
+
+ it('search and the label editor share the keyboard hand-over', () => {
+ expect(read('src/components/ShelfSearch.tsx')).toContain("acquireKeyboard('search')")
+ expect(read('src/components/ShelfSearch.tsx')).toContain("releaseKeyboard('search')")
+ const menu = read('src/components/CardMenu.tsx')
+ expect(menu).toContain('onPress={() => void acquireKeyboard(EDITOR_FOCUS_OWNER)}')
+ expect(menu).toContain('releaseKeyboard(EDITOR_FOCUS_OWNER)')
+ })
+
+ it('every language has every new string', () => {
+ const src = read('src/i18n/translations.ts')
+ const dictionaries = src.match(/export const \w+: TranslationKeys = \{/g)?.length ?? 0
+ expect(dictionaries).toBe(31)
+ for (const key of ['title', 'paste', 'pastePlain', 'addLabel', 'editLabel', 'openLink', 'copyCleanLink', 'copyAs', 'showInFolder', 'copyPath', 'copyPaths', 'saveToDownloads', 'preview', 'closePreview', 'label', 'labelPlaceholder', 'tags', 'tagPlaceholder', 'removeTag', 'usedBefore', 'removeAll', 'cancel', 'save', 'labelPinned', 'labelFailed', 'savedToDownloads', 'savedManyToDownloads', 'saveImagesFailed']) {
+ expect(src.split(`"${key}":`).length - 1, key).toBeGreaterThanOrEqual(dictionaries)
+ }
+ expect(src.split('"menu": {').length - 1).toBe(dictionaries)
+ // placeholders survive translation
+ expect(src.split('#{tag}').length - 1).toBe(dictionaries)
+ expect(src.split('"savedToDownloads": "').length - 1).toBe(dictionaries)
+ for (const m of src.matchAll(/"savedToDownloads": "([^"]*)"/g)) expect(m[1]).toContain('{name}')
+ for (const m of src.matchAll(/"savedManyToDownloads": "([^"]*)"/g)) expect(m[1]).toContain('{count}')
+ })
+})
+
+describe('keyboard hand-over is race-free', () => {
+ let focusWindow: ReturnType<typeof vi.fn>
+ let pauseHotkey: ReturnType<typeof vi.fn>
+ beforeEach(() => {
+ vi.useFakeTimers()
+ focusWindow = vi.fn(async () => undefined)
+ pauseHotkey = vi.fn(async () => undefined)
+ ;(globalThis as any).window = { edge: { focusWindow, pauseHotkey } }
+ })
+ afterEach(() => {
+ releaseAllKeyboard()
+ vi.useRealTimers()
+ delete (globalThis as any).window
+ })
+
+ it('release then immediate re-acquire (StrictMode cleanup + setup) never reaches main', () => {
+ void acquireKeyboard('card-meta')
+ releaseKeyboard('card-meta')
+ void acquireKeyboard('card-meta')
+ vi.advanceTimersByTime(KEYBOARD_RELEASE_DELAY_MS * 3)
+ expect(focusWindow.mock.calls).toEqual([[true]])
+ })
+
+ it('search hands over to the label editor without a focus flip', () => {
+ void acquireKeyboard('search')
+ releaseKeyboard('search') // input blurs as the editor opens
+ vi.advanceTimersByTime(KEYBOARD_RELEASE_DELAY_MS - 10)
+ void acquireKeyboard('card-meta')
+ vi.advanceTimersByTime(1000)
+ expect(focusWindow.mock.calls).toEqual([[true]])
+ expect(pauseHotkey.mock.calls).toEqual([[true]])
+ })
+
+ it('the last release hands focus back once, after a short delay', () => {
+ void acquireKeyboard('card-meta')
+ releaseKeyboard('card-meta')
+ expect(focusWindow.mock.calls).toEqual([[true]])
+ vi.advanceTimersByTime(KEYBOARD_RELEASE_DELAY_MS)
+ expect(focusWindow.mock.calls).toEqual([[true], [false]])
+ expect(pauseHotkey.mock.calls).toEqual([[true], [false]])
+ releaseKeyboard('card-meta')
+ vi.advanceTimersByTime(1000)
+ expect(focusWindow.mock.calls).toHaveLength(2)
+ })
+
+ it('closing the panel gives focus back at once and only once', () => {
+ void acquireKeyboard('search')
+ void acquireKeyboard('card-meta')
+ expect(releaseAllKeyboard()).toBe(true)
+ expect(focusWindow.mock.calls).toEqual([[true], [false]])
+ releaseKeyboard('card-meta')
+ vi.advanceTimersByTime(1000)
+ expect(releaseAllKeyboard()).toBe(false)
+ expect(focusWindow.mock.calls).toEqual([[true], [false]])
+ // and the next field takes focus again normally
+ void acquireKeyboard('search')
+ expect(focusWindow.mock.calls).toEqual([[true], [false], [true]])
+ })
+})
+
+describe('after the menu closes, the shelf waits before hover-closing', () => {
+ beforeEach(() => {
+ ;(globalThis as any).window = { edge: { setPreviewMode: vi.fn(), focusWindow: vi.fn(async () => undefined), pauseHotkey: vi.fn(async () => undefined) } }
+ useStore.setState({ items: [textItem('a', 'x')], cardMenu: null, cardMenuRect: null, cardMenuStayUntil: 0, open: true })
+ })
+ afterEach(() => {
+ delete (globalThis as any).window
+ })
+
+ it('closing the menu while the shelf is open starts the grace; closing the shelf clears it', () => {
+ const s = () => useStore.getState()
+ s().openCardMenu('a', 0, 0)
+ const before = Date.now()
+ s().closeCardMenu()
+ expect(s().cardMenuStayUntil).toBeGreaterThanOrEqual(before + CARD_MENU_STAY_MS)
+ expect(s().cardMenuStayUntil).toBeLessThanOrEqual(Date.now() + CARD_MENU_STAY_MS)
+ s().clearCardMenuStay()
+ expect(s().cardMenuStayUntil).toBe(0)
+ s().openCardMenu('a', 0, 0)
+ s().closeCardMenu()
+ s().setOpen(false)
+ expect(s().cardMenuStayUntil).toBe(0)
+ // nothing open: closing again does not start a grace
+ s().closeCardMenu()
+ expect(s().cardMenuStayUntil).toBe(0)
+ })
+
+ it('hover-close honours the grace and pointer-back clears it', () => {
+ const hover = read('src/hooks/useEdgeHover.ts')
+ expect(hover).toContain('const menuStayLeft = state.cardMenuStayUntil - Date.now()')
+ expect(hover).toContain('if (menuStayLeft > 0) effectiveDelay = Math.max(effectiveDelay, menuStayLeft)')
+ expect(hover).toContain('state.clearCardMenuStay()')
+ expect(CARD_MENU_STAY_MS).toBeGreaterThanOrEqual(1000)
+ expect(CARD_MENU_STAY_MS).toBeLessThanOrEqual(1500)
+ })
+})
+
+describe('focus and menu robustness wiring', () => {
+ it('a stale foreground repair stops when a newer focus request arrives', () => {
+ const w = read('electron/main/window.ts')
+ expect(w).toContain('const generation = ++focusRequestGeneration')
+ expect(w).toContain("restoreFgAwaited(target, 'release-repair', () => focusRequestGeneration !== generation)")
+ expect(w).toMatch(/for \(let attempt = 1; attempt <= 4; attempt\+\+\) \{\s*if \(isStale\?\.\(\)\)/)
+ })
+
+ it('the editor survives focus blips and style-only resizes', () => {
+ const menu = read('src/components/CardMenu.tsx')
+ expect(menu).toContain('if (window.innerWidth !== openSize.w || window.innerHeight !== openSize.h) dismiss(true)')
+ expect(menu).toContain("if (!document.hasFocus() && useStore.getState().cardMenu?.mode === 'edit') dismiss(true)")
+ expect(menu).toContain("const prefer: 'right' | 'left' = stick === 'right' ? 'left' : 'right'")
+ expect(read('src/store/appStore.ts')).toContain('releaseAllKeyboard()')
+ })
+})
diff --git a/tests/codeDetect.test.ts b/tests/codeDetect.test.ts
new file mode 100644
index 0000000..e3b8b22
--- /dev/null
+++ b/tests/codeDetect.test.ts
@@ -0,0 +1,45 @@
+import { describe, expect, it } from 'vitest'
+import { detectCode } from '../src/lib/codeDetect'
+
+const lang = (s: string) => detectCode(s).language
+
+describe('detectCode: markup inside scripts', () => {
+ it('a React component with lowercase tags is JSX, not HTML', () => {
+ const src = [
+ "import { useState } from 'react'",
+ '',
+ 'export function Counter() {',
+ ' const [n, setN] = useState(0)',
+ ' return <button onClick={() => setN(n + 1)}>{n}</button>',
+ '}'
+ ].join('\n')
+ expect(detectCode(src)).toEqual({ isCode: true, language: 'jsx', displayName: 'JSX' })
+ })
+
+ it('typed components are TSX', () => {
+ expect(lang('const Row = ({ title }: { title: string }) => <div className="row">{title}</div>')).toBe('tsx')
+ })
+
+ it('real markup is still HTML', () => {
+ expect(lang('<div class="card"><span>Hi</span></div>')).toBe('html')
+ expect(lang('<!DOCTYPE html>\n<html><body><p>x</p></body></html>')).toBe('html')
+ expect(lang('<script>\n const x = 1\n</script>')).toBe('html')
+ expect(lang('<button type="submit">Send</button>')).toBe('html')
+ })
+
+ it('prose that starts a line with "let" is not treated as script', () => {
+ expect(lang('let me know if <span>this</span> works')).toBe('html')
+ expect(detectCode('let me know when you are free').isCode).toBe(false)
+ })
+
+ it('markup inside a string or regex keeps a script JavaScript', () => {
+ expect(lang('let html = "<div>x</div>"')).toBe('javascript')
+ expect(lang('var tpl = `<section class="x"></section>`')).toBe('javascript')
+ expect(lang('const re = /<div>/g')).toBe('javascript')
+ })
+
+ it('plain scripts are unchanged', () => {
+ expect(lang('const answer = 42\nconsole.log(answer)')).toBe('javascript')
+ expect(lang('let total: number = 0')).toBe('typescript')
+ })
+})
diff --git a/tests/dragDrop.test.ts b/tests/dragDrop.test.ts
index f45ceaa..ad5734e 100644
--- a/tests/dragDrop.test.ts
+++ b/tests/dragDrop.test.ts
@@ -177,7 +177,7 @@ import { join } from 'node:path'
import { buildFileDragSvg, setFileIconAssetDir } from '../electron/main/fileSvg'
import type { FileKind } from '../src/lib/fileType'
-describe('buildFileDragSvg — vintage PNG drag icons', () => {
+describe('buildFileDragSvg — SVG folder drag icons', () => {
const allKinds: FileKind[] = [
'pdf',
'word',
@@ -196,14 +196,15 @@ describe('buildFileDragSvg — vintage PNG drag icons', () => {
setFileIconAssetDir(join(process.cwd(), 'resources', 'file-icons'))
- it('embeds real PNG art for all 13 file categories', () => {
+ it('embeds the real SVG art for all 13 file categories, filling the slot', () => {
for (const kind of allKinds) {
const svg = buildFileDragSvg([kind], 1)
expect(svg).toContain('<svg')
expect(svg).toContain('viewBox="0 0 512 512"')
- // Embedded raster art, never the old vector gradients or black boxes
+ // Nested art document (its own IDs), never inline gradients or black boxes
expect(svg).toContain('<image')
- expect(svg).toContain('data:image/png;base64,')
+ expect(svg).toContain('data:image/svg+xml;base64,')
+ expect(svg).toContain('x="0" y="0" width="512" height="512"')
expect(svg).not.toContain('linearGradient')
expect(svg).not.toContain('fill="#000000"')
}
diff --git a/tests/fileDragArt.test.ts b/tests/fileDragArt.test.ts
new file mode 100644
index 0000000..57b8443
--- /dev/null
+++ b/tests/fileDragArt.test.ts
@@ -0,0 +1,42 @@
+import { afterAll, describe, expect, it } from 'vitest'
+import { copyFileSync, mkdtempSync, rmSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { buildFileDragSvg, dragSvgHasArt, setFileIconAssetDir } from '../electron/main/fileSvg'
+
+const real = join(process.cwd(), 'resources', 'file-icons')
+const tmp = mkdtempSync(join(tmpdir(), 'edge-drag-art-'))
+afterAll(() => {
+ setFileIconAssetDir(real)
+ rmSync(tmp, { recursive: true, force: true })
+})
+
+describe('drag ghost art loading', () => {
+ it('real icons: every ghost carries art', () => {
+ setFileIconAssetDir(real)
+ expect(dragSvgHasArt(buildFileDragSvg(['pdf'], 1))).toBe(true)
+ expect(dragSvgHasArt(buildFileDragSvg(['pdf', 'excel', 'folder'], 3))).toBe(true)
+ })
+
+ it('a missing file is not remembered: art that appears later is used on the next drag', () => {
+ setFileIconAssetDir(tmp) // empty folder
+ expect(dragSvgHasArt(buildFileDragSvg(['pdf'], 1))).toBe(false)
+ copyFileSync(join(real, 'pdf.svg'), join(tmp, 'pdf.svg'))
+ // no cache reset: the earlier miss must not stick
+ expect(dragSvgHasArt(buildFileDragSvg(['pdf'], 1))).toBe(true)
+ })
+
+ it('a kind without its own file borrows the generic file art', () => {
+ copyFileSync(join(real, 'file.svg'), join(tmp, 'file.svg'))
+ const svg = buildFileDragSvg(['audio'], 1)
+ expect(dragSvgHasArt(svg)).toBe(true)
+ const generic = buildFileDragSvg(['file'], 1)
+ expect(svg).toBe(generic)
+ })
+
+ it('the drag code never rasterizes or caches a ghost without art', async () => {
+ const { readFileSync } = await import('node:fs')
+ const drag = readFileSync(join(process.cwd(), 'electron', 'main', 'drag.ts'), 'utf8')
+ expect(drag).toMatch(/const svg = buildFileDragSvg\(kinds, count\)\s+[\s\S]{0,200}if \(!dragSvgHasArt\(svg\)\) return getFileDragIcon\(\)\s+try \{\s+const resvg = new Resvg/)
+ })
+})
diff --git a/tests/fileIcons.test.ts b/tests/fileIcons.test.ts
index 34bb2e1..ae1b756 100644
--- a/tests/fileIcons.test.ts
+++ b/tests/fileIcons.test.ts
@@ -1,35 +1,71 @@
import { describe, expect, it } from 'vitest'
+import { readdirSync, readFileSync } from 'node:fs'
import { join } from 'node:path'
import { fileIconUrl, type FileKind } from '../src/lib/fileType'
import { resolveIconAsset } from '../electron/main/imageProtocol'
+import { FILE_ICON_MASK } from '../src/components/CustomFileIcon'
const ALL_KINDS: FileKind[] = [
'pdf', 'word', 'excel', 'powerpoint', 'archive', 'text', 'code',
'audio', 'video', 'image', 'executable', 'folder', 'file'
]
+const dir = join(process.cwd(), 'resources', 'file-icons')
-describe('vintage PNG file icons', () => {
+describe('SVG file icons', () => {
it('fileIconUrl points every kind at its edgelocal icon', () => {
for (const kind of ALL_KINDS) {
- expect(fileIconUrl(kind)).toBe(`edgelocal://icon/${kind}.png`)
+ expect(fileIconUrl(kind)).toBe(`edgelocal://icon/${kind}.svg`)
}
})
+ it('the folder holds exactly the 13 icons', () => {
+ expect(readdirSync(dir).sort()).toEqual(ALL_KINDS.map((k) => `${k}.svg`).sort())
+ })
+
it('resolveIconAsset accepts the 13 icon names in resources/file-icons', () => {
- const dir = join(process.cwd(), 'resources', 'file-icons')
for (const kind of ALL_KINDS) {
- const resolved = resolveIconAsset(dir, `${kind}.png`)
+ const resolved = resolveIconAsset(dir, `${kind}.svg`)
expect(resolved).toBeTruthy()
- expect(resolved?.toLowerCase().endsWith(`${kind}.png`)).toBe(true)
+ expect(resolved?.toLowerCase().endsWith(`${kind}.svg`)).toBe(true)
}
})
it('resolveIconAsset rejects traversal, wrong types, and unknown names', () => {
- const dir = join(process.cwd(), 'resources', 'file-icons')
expect(resolveIconAsset(dir, '../settings.json')).toBeNull()
expect(resolveIconAsset(dir, '..\\settings.json')).toBeNull()
expect(resolveIconAsset(dir, 'evil.svg')).toBeNull()
- expect(resolveIconAsset(dir, 'nope.png')).toBeNull()
+ expect(resolveIconAsset(dir, 'pdf.png')).toBeNull()
+ expect(resolveIconAsset(dir, 'nope.svg')).toBeNull()
expect(resolveIconAsset(dir, '')).toBeNull()
})
+
+ it('every icon is self-contained art: no script, events, external links or foreign content', () => {
+ for (const kind of ALL_KINDS) {
+ const svg = readFileSync(join(dir, `${kind}.svg`), 'utf8')
+ expect(svg, kind).not.toMatch(/<script|<foreignObject|<image|\son[a-z]+\s*=|javascript:|@import/i)
+ // every reference is to an id inside the same file
+ for (const m of svg.matchAll(/(?:href|url\()\s*=?\s*["(]?([^")\s]+)/g)) {
+ expect(m[1].startsWith('#'), `${kind}: ${m[1]}`).toBe(true)
+ }
+ }
+ })
+
+ it('every icon is square and cropped to the folder the same way', () => {
+ for (const kind of ALL_KINDS) {
+ const root = readFileSync(join(dir, `${kind}.svg`), 'utf8').match(/<svg[^>]*>/)![0]
+ expect(root, kind).toContain('viewBox="64 60 384 384"')
+ expect(root, kind).toContain('width="384" height="384"')
+ }
+ })
+
+ it('the photo mask uses the same frame and the folder outline from the art', () => {
+ expect(FILE_ICON_MASK).toContain("viewBox='64 60 384 384'")
+ const folder = readFileSync(join(dir, 'folder.svg'), 'utf8')
+ const front = folder.match(/<path id="folder-front" d="([^"]+)"/)![1]
+ expect(FILE_ICON_MASK).toContain(front)
+ expect(folder).toContain('<rect id="folder-panel" x="120" y="118" width="272" height="246" rx="24"/>')
+ expect(FILE_ICON_MASK).toContain("<rect x='120' y='118' width='272' height='246' rx='24'/>")
+ expect(folder).toContain('<g transform="translate(0 14)">')
+ expect(FILE_ICON_MASK).toContain("translate(0 14)")
+ })
})
diff --git a/tests/fileStacks.test.ts b/tests/fileStacks.test.ts
new file mode 100644
index 0000000..2c58dca
--- /dev/null
+++ b/tests/fileStacks.test.ts
@@ -0,0 +1,66 @@
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+
+const read = (p: string) => readFileSync(join(__dirname, '..', p), 'utf8')
+const css = read('src/styles/item.css')
+const card = read('src/components/ClipboardItem.tsx')
+
+const cssNoComments = css.replace(/\/\*[\s\S]*?\*\//g, '')
+
+/** Every rule whose selector mentions `needle`, as [selector, body]. */
+const rules = (needle: string) =>
+ [...cssNoComments.matchAll(/(^|\n)([^{}\n][^{}]*)\{([^}]*)\}/g)]
+ .map((m) => [m[2].trim(), m[3]] as const)
+ .filter(([sel]) => sel.includes(needle))
+
+describe('file icon stacks and hover', () => {
+ it('file items in a stack use the cascade class; photo cards keep theirs', () => {
+ expect(card).toContain("className={`${isImg ? 'image-folder-stack-item' : 'file-stack-folder'} pos-${idx}`}")
+ expect(card).toContain('<div className="image-folder-stack-deck is-file-deck" data-count={Math.min(count, 4)}>')
+ expect(css).not.toContain('file-stack-item')
+ })
+
+ it('hovering a file icon or stack only moves it: no filter or shadow changes', () => {
+ const hover = [...rules('.file-stack-folder'), ...rules('.single-file-hero')].filter(([sel]) => sel.includes(':hover'))
+ expect(hover.length).toBeGreaterThan(8)
+ for (const [sel, body] of hover) {
+ // the flyout's own hover rules are separate and already transform-only
+ expect(body, sel).not.toMatch(/filter|box-shadow|opacity/)
+ expect(body, sel).toMatch(/transform:/)
+ }
+ })
+
+ it('only transform is transitioned, and each folder is its own layer', () => {
+ const base = rules('.file-stack-folder').find(([sel]) => sel === '.file-stack-folder')![1]
+ // one property only: the curve's commas are inside cubic-bezier( )
+ const onlyTransform = /transition: transform [\d.]+s cubic-bezier\([^)]*\);/
+ expect(base).toMatch(onlyTransform)
+ expect(base).toContain('will-change: transform')
+ const hero = rules('.single-file-hero img.file-kind-img').find(([sel]) => sel.startsWith('.single-file-hero svg'))![1]
+ expect(hero).toMatch(onlyTransform)
+ expect(hero).toContain('will-change: transform')
+ })
+
+ it('every stack size has a rest and a hover position for each folder', () => {
+ for (const [count, positions] of [[2, 2], [3, 3], [4, 4]] as const) {
+ for (let p = 0; p < positions; p++) {
+ const sel = `.image-folder-stack-deck[data-count="${count}"] .file-stack-folder.pos-${p}`
+ expect(css, sel).toContain(`${sel} {`)
+ expect(css, `hover ${sel}`).toContain(`.item-main:hover ${sel} {`)
+ }
+ }
+ })
+
+ it('file art is centered above the label flap in cards and mini cards', () => {
+ expect(css).toMatch(/\.image-folder-viewport > \.single-file-hero \{[^}]*padding-bottom: 26px/)
+ expect(css).toMatch(/\.list\.horizontal \.image-folder-viewport > \.single-file-hero \{[^}]*padding-bottom: 24px/)
+ expect(css).toMatch(/\.mini-image-folder-viewport > \.single-file-hero \{[^}]*padding-bottom: 16px/)
+ expect(css).toMatch(/\.image-folder-viewport \.image-folder-stack-deck\.is-file-deck \{[^}]*padding: 8px 0 26px/)
+ })
+
+ it('reduced motion turns the stack and hero motion off', () => {
+ expect(css).toContain("html[data-motion='reduce'] .file-stack-folder {\n transition: none;")
+ expect(css).toContain("html[data-motion='reduce'] .single-file-hero img.file-kind-img {\n transition: none;")
+ })
+})
diff --git a/tests/itemMeta.test.ts b/tests/itemMeta.test.ts
new file mode 100644
index 0000000..5cdf0f8
--- /dev/null
+++ b/tests/itemMeta.test.ts
@@ -0,0 +1,255 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { join } from 'node:path'
+import { tmpdir } from 'node:os'
+
+const fsRoots = vi.hoisted(() => ({ home: '', userData: '' }))
+
+vi.mock('electron', () => ({
+ app: {
+ isPackaged: false,
+ getAppPath: () => join(fsRoots.userData, 'app'),
+ getPath: (name: string) => (name === 'userData' ? fsRoots.userData : join(fsRoots.userData, name))
+ },
+ nativeImage: { createFromPath: () => ({ isEmpty: () => true }) },
+ safeStorage: { isEncryptionAvailable: () => false }
+}))
+
+vi.mock('node:os', async (importOriginal) => {
+ const actual = await importOriginal<typeof import('node:os')>()
+ return { ...actual, homedir: () => fsRoots.home }
+})
+
+import { ItemStore } from '../electron/store/ItemStore'
+import { PATHS } from '../electron/store/paths'
+import {
+ LABEL_MAX,
+ TAGS_MAX,
+ TAG_MAX_LEN,
+ combineTags,
+ hasItemMeta,
+ normalizeLabel,
+ normalizeTag,
+ normalizeTags
+} from '../shared/itemMeta'
+import { fileBaseFromLabel, saveItemImages, uniqueDest } from '../electron/main/saveImages'
+import { isSafeExternalUrl } from '../electron/main/externalUrl'
+import type { ClipboardItem } from '../shared/types'
+
+describe('label / tag normalization (shared, used by main for every write)', () => {
+ it('labels become one trimmed line, capped without splitting characters', () => {
+ expect(normalizeLabel(' Office\n\tWi-Fi password ')).toBe('Office Wi-Fi password')
+ expect(normalizeLabel('a\u0000b')).toBe('a b')
+ expect(normalizeLabel(' ')).toBeUndefined()
+ expect(normalizeLabel(42)).toBeUndefined()
+ expect(normalizeLabel(null)).toBeUndefined()
+ const long = '😀'.repeat(LABEL_MAX + 10)
+ const cut = normalizeLabel(long)!
+ expect(Array.from(cut)).toHaveLength(LABEL_MAX)
+ expect(cut.endsWith('😀')).toBe(true) // no half surrogate pair
+ })
+
+ it('tags are one lowercase word in any language', () => {
+ expect(normalizeTag('#Work')).toBe('work')
+ expect(normalizeTag('##client a')).toBe('client-a')
+ expect(normalizeTag(' Client A ')).toBe('client-a')
+ expect(normalizeTag('ÜBER-größe')).toBe('über-größe')
+ expect(normalizeTag('काम')).toBe('काम')
+ expect(normalizeTag('日本語')).toBe('日本語')
+ expect(normalizeTag('c++')).toBe('c++')
+ expect(normalizeTag('v1.2')).toBe('v1.2')
+ expect(normalizeTag('a!@$%^&*()b')).toBe('ab')
+ expect(normalizeTag('--x--')).toBe('x')
+ expect(normalizeTag('#')).toBeUndefined()
+ expect(normalizeTag('!!!')).toBeUndefined()
+ expect(normalizeTag(undefined)).toBeUndefined()
+ expect(Array.from(normalizeTag('a'.repeat(50))!)).toHaveLength(TAG_MAX_LEN)
+ expect(normalizeTag('abcdefghijklmnopqrstuvw-xyz')).toBe('abcdefghijklmnopqrstuvw') // no trailing '-'
+ })
+
+ it('tag lists are cleaned, de-duplicated and capped', () => {
+ expect(normalizeTags(['Work', '#work', 'wifi', '', '!!', 'a', 'b', 'c', 'd'])).toEqual(['work', 'wifi', 'a', 'b', 'c'])
+ expect(normalizeTags(['x', 'y', 'z', 'p', 'q', 'r'])).toHaveLength(TAGS_MAX)
+ expect(normalizeTags([])).toBeUndefined()
+ expect(normalizeTags('work')).toBeUndefined()
+ expect(combineTags(['work'], ['wifi', 'work'])).toEqual(['work', 'wifi'])
+ expect(combineTags(undefined, undefined)).toBeUndefined()
+ expect(hasItemMeta({})).toBe(false)
+ expect(hasItemMeta({ tags: [] })).toBe(false)
+ expect(hasItemMeta({ label: 'x' })).toBe(true)
+ expect(hasItemMeta({ tags: ['x'] })).toBe(true)
+ })
+})
+
+describe('ItemStore label / tags', () => {
+ beforeEach(() => {
+ const stamp = `${Date.now()}-${Math.random().toString(16).slice(2)}`
+ fsRoots.userData = join(tmpdir(), `ed-meta-${stamp}`)
+ fsRoots.home = join(tmpdir(), `ed-meta-home-${stamp}`)
+ for (const d of [fsRoots.userData, join(fsRoots.userData, 'payloads'), join(fsRoots.userData, 'images'), fsRoots.home]) {
+ mkdirSync(d, { recursive: true })
+ }
+ })
+ afterEach(() => {
+ try { rmSync(fsRoots.userData, { recursive: true, force: true }) } catch { /* ignore */ }
+ try { rmSync(fsRoots.home, { recursive: true, force: true }) } catch { /* ignore */ }
+ })
+
+ const text = (t: string) => ({ kind: 'text' as const, text: t, isUrl: false })
+
+ it('saves cleaned values, pins the item, and survives a restart', () => {
+ const store = new ItemStore()
+ store.add(text('secret'), 50)
+ const id = store.list()[0].id
+ expect(store.setMeta(id, { label: ' Office Wi-Fi ', tags: ['#Work', 'work', 'Home Net'] })).toBe(true)
+ const it = store.get(id)!
+ expect(it.label).toBe('Office Wi-Fi')
+ expect(it.tags).toEqual(['work', 'home-net'])
+ expect(it.pinned).toBe(true)
+ expect(store.toDto()[0]).toMatchObject({ label: 'Office Wi-Fi', tags: ['work', 'home-net'] })
+
+ store.persistSync()
+ const reopened = new ItemStore()
+ reopened.load()
+ expect(reopened.get(id)).toMatchObject({ label: 'Office Wi-Fi', tags: ['work', 'home-net'], pinned: true })
+ })
+
+ it('a partial patch keeps the other field; clearing removes the fields but keeps the pin', () => {
+ const store = new ItemStore()
+ store.add(text('a'), 50)
+ const id = store.list()[0].id
+ store.setMeta(id, { label: 'Name', tags: ['x'] })
+ store.setMeta(id, { tags: ['y'] })
+ expect(store.get(id)).toMatchObject({ label: 'Name', tags: ['y'] })
+ store.setMeta(id, { label: null, tags: null })
+ const it = store.get(id)!
+ expect('label' in it).toBe(false)
+ expect('tags' in it).toBe(false)
+ expect(it.pinned).toBe(true)
+ expect(store.setMeta('missing', { label: 'x' })).toBe(false)
+ })
+
+ it('a labelled item is kept by the history limit (it is pinned)', () => {
+ const store = new ItemStore()
+ store.add(text('keep me'), 3)
+ const keep = store.list()[0].id
+ store.setMeta(keep, { label: 'Keep' })
+ for (let i = 0; i < 10; i++) store.add(text(`filler ${i}`), 3)
+ expect(store.get(keep)?.label).toBe('Keep')
+ })
+
+ it('copying the same content again keeps its label and tags', () => {
+ const store = new ItemStore()
+ store.add(text('same'), 50)
+ const id = store.list()[0].id
+ store.setMeta(id, { label: 'L', tags: ['t'] })
+ store.add(text('other'), 50)
+ store.add(text('same'), 50)
+ expect(store.list()[0]).toMatchObject({ id, label: 'L', tags: ['t'], hitCount: 2 })
+ store.touch(id)
+ expect(store.get(id)).toMatchObject({ label: 'L', tags: ['t'] })
+ })
+
+ it('merging keeps the target label (or takes the source one) and combines tags', () => {
+ const store = new ItemStore()
+ const files = (p: string) => ({ kind: 'files' as const, paths: [join(fsRoots.home, p)] })
+ for (const p of ['a.txt', 'b.txt', 'c.txt']) writeFileSync(join(fsRoots.home, p), p)
+ store.add(files('a.txt'), 50)
+ store.add(files('b.txt'), 50)
+ store.add(files('c.txt'), 50)
+ const [c, b, a] = store.list().map((x) => x.id)
+ store.setMeta(a, { label: 'Source A', tags: ['alpha', 'shared'] })
+ store.setMeta(b, { tags: ['beta', 'shared'] })
+ store.setPinned(b, false)
+ expect(store.merge(a, b).ok).toBe(true)
+ expect(store.get(a)).toBeUndefined()
+ expect(store.get(b)).toMatchObject({ label: 'Source A', tags: ['beta', 'shared', 'alpha'], pinned: true })
+ store.setMeta(c, { label: 'Target C' })
+ expect(store.merge(b, c).ok).toBe(true)
+ expect(store.get(c)?.label).toBe('Target C')
+ })
+
+ it('load cleans hand-edited values instead of trusting them', () => {
+ const dirty = {
+ items: [
+ { id: 'x1', data: { kind: 'text', text: 'hi', isUrl: false }, capturedAt: 1, hitCount: 1, pinned: true, label: ` ${'L'.repeat(200)} `, tags: ['#A', 'a', 5, 'b c'] },
+ { id: 'x2', data: { kind: 'text', text: 'yo', isUrl: false }, capturedAt: 1, hitCount: 1, pinned: false, label: ' ', tags: 'nope' }
+ ]
+ }
+ writeFileSync(PATHS.indexFile(), JSON.stringify(dirty))
+ const store = new ItemStore()
+ store.load()
+ expect(Array.from(store.get('x1')!.label!)).toHaveLength(LABEL_MAX)
+ expect(store.get('x1')!.tags).toEqual(['a', 'b-c'])
+ expect('label' in store.get('x2')!).toBe(false)
+ expect('tags' in store.get('x2')!).toBe(false)
+ })
+
+ it('the DTO tells the renderer when a text item has html, without sending the html', () => {
+ const store = new ItemStore()
+ store.add({ kind: 'text', text: 'rich', html: '<b>rich</b>', isUrl: false }, 50)
+ store.add(text('plain'), 50)
+ const [plain, rich] = store.toDto()
+ expect(rich.data).toMatchObject({ kind: 'text', hasHtml: true })
+ expect('html' in rich.data).toBe(false)
+ expect(plain.data).toMatchObject({ kind: 'text', hasHtml: false })
+ })
+})
+
+describe('save images to Downloads', () => {
+ const dir = join(tmpdir(), `ed-save-${process.pid}`)
+ beforeEach(() => mkdirSync(dir, { recursive: true }))
+ afterEach(() => rmSync(dir, { recursive: true, force: true }))
+
+ it('turns a label into a safe Windows file name', () => {
+ expect(fileBaseFromLabel('Invoice: March/April?')).toBe('Invoice_ March_April_')
+ expect(fileBaseFromLabel(' report. ')).toBe('report')
+ expect(fileBaseFromLabel('CON')).toBe('CON_')
+ expect(fileBaseFromLabel('...')).toBe('Image')
+ expect(Array.from(fileBaseFromLabel('x'.repeat(300))).length).toBe(120)
+ })
+
+ it('never overwrites: name, name (2), name (3)', () => {
+ expect(uniqueDest(dir, 'a', 'png')).toBe(join(dir, 'a.png'))
+ writeFileSync(join(dir, 'a.png'), '1')
+ expect(uniqueDest(dir, 'a', '.png')).toBe(join(dir, 'a (2).png'))
+ writeFileSync(join(dir, 'a (2).png'), '1')
+ expect(uniqueDest(dir, 'a', 'png')).toBe(join(dir, 'a (3).png'))
+ })
+
+ it('copies originals under the label (numbered for a collection) or the default name', () => {
+ const src = join(dir, 'src')
+ mkdirSync(src)
+ writeFileSync(join(src, 'i1.png'), 'one')
+ writeFileSync(join(src, 'i2.png'), 'two')
+ const out = join(dir, 'out')
+ const deps = {
+ destDir: out,
+ resolveSource: (id: string) => (existsSync(join(src, `${id}.png`)) ? join(src, `${id}.png`) : null),
+ defaultName: (_at: number, ext: string, _img: unknown, n: number) => `Screenshot X (${n}).${ext}`
+ }
+ const img = (id: string) => ({ imageId: id, width: 1, height: 1, bytes: 3, ext: 'png' })
+ const labelled: ClipboardItem = { id: 'a', label: 'Trip', capturedAt: 0, hitCount: 1, pinned: true, data: { kind: 'image-collection', images: [img('i1'), img('i2'), img('gone')] } }
+ const saved = saveItemImages(labelled, deps)
+ expect(saved).toEqual([join(out, 'Trip (1).png'), join(out, 'Trip (2).png')])
+ expect(readFileSync(saved[1], 'utf8')).toBe('two')
+ const plain: ClipboardItem = { id: 'b', capturedAt: 0, hitCount: 1, pinned: false, data: { kind: 'image', ...img('i1') } }
+ expect(saveItemImages(plain, deps)).toEqual([join(out, 'Screenshot X (1).png')])
+ expect(saveItemImages({ ...plain, data: { kind: 'text', text: 'x', isUrl: false } }, deps)).toEqual([])
+ })
+})
+
+describe('links handed to the OS', () => {
+ it('only web, mail and Store links open', () => {
+ expect(isSafeExternalUrl('https://example.com/a?b=1')).toBe(true)
+ expect(isSafeExternalUrl('http://example.com')).toBe(true)
+ expect(isSafeExternalUrl('mailto:[email protected]')).toBe(true)
+ expect(isSafeExternalUrl('ms-windows-store://review/?ProductId=9P3JMHN9M4NR')).toBe(true)
+ expect(isSafeExternalUrl('file:///C:/Windows/System32/calc.exe')).toBe(false)
+ expect(isSafeExternalUrl('javascript:alert(1)')).toBe(false)
+ expect(isSafeExternalUrl('search-ms:query=x')).toBe(false)
+ expect(isSafeExternalUrl('www.example.com')).toBe(false)
+ expect(isSafeExternalUrl('')).toBe(false)
+ expect(isSafeExternalUrl(undefined)).toBe(false)
+ })
+})
diff --git a/tests/previewFlyout.test.ts b/tests/previewFlyout.test.ts
new file mode 100644
index 0000000..f80f8ea
--- /dev/null
+++ b/tests/previewFlyout.test.ts
@@ -0,0 +1,104 @@
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+
+const read = (p: string) => readFileSync(join(__dirname, '..', p), 'utf8')
+const flyout = read('src/components/PreviewFlyout.tsx')
+const css = read('src/styles/previewFlyout.css')
+
+const keyframes = (name: string) => {
+ const m = css.match(new RegExp(`@keyframes ${name} \\{([\\s\\S]*?)\\n\\}`))
+ return m?.[1] ?? ''
+}
+
+describe('preview flyout motion runs on the compositor', () => {
+ it('uses CSS motion, not per-frame JavaScript', () => {
+ expect(flyout).not.toContain('framer-motion')
+ expect(flyout).not.toContain('requestAnimationFrame')
+ expect(flyout).toContain("import '../styles/previewFlyout.css'")
+ })
+
+ it('every keyframe animates only opacity and transform', () => {
+ const names = [...css.matchAll(/@keyframes ([\w-]+)/g)].map((m) => m[1])
+ expect(names.length).toBeGreaterThanOrEqual(10)
+ for (const name of names) {
+ const props = [...keyframes(name).matchAll(/([a-z-]+)\s*:/g)].map((m) => m[1])
+ expect(props.length, name).toBeGreaterThan(0)
+ for (const p of props) expect(['opacity', 'transform'], `${name}: ${p}`).toContain(p)
+ }
+ })
+
+ it('the anchor slide animates translate only, with the same spring', () => {
+ expect(flyout).toMatch(/el\.animate\(\[\{ translate: `\$\{dx\}px 0` \}, \{ translate: '0 0' \}\]/)
+ const tsSpring = flyout.match(/const PF_SPRING = '(linear\([^']+\))'/)?.[1]
+ const cssSpring = css.match(/--pf-spring: (linear\([^;]+\));/)?.[1]
+ expect(tsSpring).toBeTruthy()
+ expect(tsSpring).toBe(cssSpring)
+ })
+
+ it('the spring settles exactly on 1 and barely overshoots', () => {
+ const pts = css.match(/--pf-spring: linear\(([^;]+)\);/)![1].split(',').map(Number)
+ expect(pts[0]).toBe(0)
+ expect(pts[pts.length - 1]).toBe(1)
+ expect(Math.max(...pts)).toBeLessThanOrEqual(1.01)
+ })
+
+ it('stays mounted exactly as long as the exit animations run', () => {
+ const exitMs = Number(flyout.match(/export const PREVIEW_EXIT_MS = (\d+)/)?.[1])
+ const batchMs = Number(flyout.match(/const BATCH_EXIT_MS = (\d+)/)?.[1])
+ for (const dir of ['left', 'right', 'top']) {
+ expect(css).toContain(`.pf-wrap.from-${dir}.is-leaving {\n animation: pf-out-${dir} ${exitMs}ms`)
+ }
+ expect(css).toContain(`.pf-batch.is-leaving {\n animation: pf-batch-out ${batchMs}ms`)
+ // the panel closes 240ms after the preview (App / useEdgeHover): the exit must finish first
+ expect(exitMs).toBeLessThan(240)
+ })
+
+ it('reduced motion is a plain fade', () => {
+ expect(flyout).toContain("reduceMotion ? 'is-reduced' : fromClass")
+ expect(css).toMatch(/\.pf-wrap\.is-reduced \{\n animation: pf-fade-in 120ms linear both;/)
+ expect(css).toMatch(/\.pf-wrap\.is-reduced\.is-leaving \{\n animation: pf-fade-out 120ms linear both;/)
+ })
+
+ it('no permanent will-change layer on the shell', () => {
+ expect(flyout).not.toContain('willChange')
+ expect(css).not.toContain('will-change')
+ })
+})
+
+describe('preview flyout keeps its behaviour', () => {
+ it('leaves preview mode only after the close finished and nothing reopened', () => {
+ expect(flyout).toMatch(/usePresence\(!!liveItem, PREVIEW_EXIT_MS, \(\) => \{\s+if \(!useStore\.getState\(\)\.previewItemId\) \{\s+window\.edge\.setPreviewMode\(false\)/)
+ })
+
+ it('closes where it is: position and grow-point keep the last card rect during the exit', () => {
+ expect(flyout).toContain('if (liveItem) lastItemRectRef.current = liveItemRect')
+ expect(flyout).toContain('const previewItemRect = liveItem ? liveItemRect : lastItemRectRef.current')
+ // the only read of the store rect is the live one above
+ expect(flyout.match(/useStore\(\(s\) => s\.previewItemRect\)/g)?.length).toBe(1)
+ })
+
+ it('the hover keep-alive zone follows the live item, not the closing one', () => {
+ expect(flyout).toMatch(/if \(!liveItem \|\| !flyoutRef\.current\) \{\s+useStore\.getState\(\)\.setPreviewFlyoutRect\(null\)/)
+ })
+
+ it('a closing flyout ignores clicks and drops', () => {
+ expect(flyout).toContain("pointerEvents: leaving ? 'none' : 'auto'")
+ expect(flyout).toContain('if (liveItem && activeDrag && activeDrag.id !== liveItem.id)')
+ })
+
+ it('every kind gets the header row and keeps click-to-paste', () => {
+ expect(flyout.match(/return frame\(/g)?.length).toBe(9)
+ expect(flyout.match(/onClick=\{pasteOnClick\}/g)?.length).toBe(4)
+ })
+
+ it('color previews list every format, copied without a new card', () => {
+ for (const f of ['HEX', 'RGB', 'HSL']) expect(flyout).toContain(`<ColorFormatRow name="${f}"`)
+ expect(flyout).toContain('copyText(value, { quiet: true })')
+ })
+
+ it('the inline style does not hide the stylesheet rim', () => {
+ expect(flyout).toContain("boxShadow: dragOver ? '0 0 35px rgba(76, 175, 80, 0.3)' : undefined")
+ expect(css).toMatch(/\.preview-flyout \{\n box-shadow: inset 0 0 0 1px var\(--edge-light\);/)
+ })
+})
diff --git a/tests/previewImageFit.test.ts b/tests/previewImageFit.test.ts
new file mode 100644
index 0000000..12ee1c5
--- /dev/null
+++ b/tests/previewImageFit.test.ts
@@ -0,0 +1,60 @@
+import { describe, expect, it } from 'vitest'
+import { fitPreviewImage, type PreviewImageBounds } from '../src/lib/previewImageFit'
+
+// Side dock: 440 normal, up to 526 (820px preview window - 270 blade - 24 gaps).
+const side: PreviewImageBounds = { minFlyoutWidth: 440, maxFlyoutWidth: 526, maxImageHeight: 560, sidePadding: 40, devicePixelRatio: 1 }
+// Top dock: up to 760 wide, shorter.
+const top: PreviewImageBounds = { ...side, maxFlyoutWidth: 760, maxImageHeight: 380 }
+
+describe('fitPreviewImage', () => {
+ it('a full-screen screenshot widens the flyout instead of shrinking to ~20%', () => {
+ expect(fitPreviewImage(1920, 1080, side)).toEqual({ flyoutWidth: 526, width: 486, height: 273, scroll: false })
+ const t = fitPreviewImage(1920, 1080, top)
+ // height-limited here: 676 x 380 (was 400 x 225)
+ expect(t).toEqual({ flyoutWidth: 716, width: 676, height: 380, scroll: false })
+ })
+
+ it('a long screenshot is drawn at full width and scrolls, not squeezed to a sliver', () => {
+ expect(fitPreviewImage(1080, 2400, side)).toEqual({ flyoutWidth: 526, width: 486, height: 1080, scroll: true })
+ expect(fitPreviewImage(800, 6000, top)).toMatchObject({ width: 720, scroll: true })
+ })
+
+ it('a portrait photo still fits whole', () => {
+ const f = fitPreviewImage(600, 900, side)
+ expect(f.scroll).toBe(false)
+ expect(f.height).toBe(560)
+ expect(f.width).toBe(373)
+ expect(f.flyoutWidth).toBe(440)
+ })
+
+ it('a small icon is enlarged at most 2x and never widens the flyout', () => {
+ expect(fitPreviewImage(48, 48, side)).toEqual({ flyoutWidth: 440, width: 96, height: 96, scroll: false })
+ // on a 2x screen, 2 screen pixels per image pixel is already 2x
+ expect(fitPreviewImage(48, 48, { ...side, devicePixelRatio: 2 })).toMatchObject({ width: 48, height: 48 })
+ })
+
+ it('an image a bit wider than the normal flyout is shown at its own size, not stretched', () => {
+ expect(fitPreviewImage(480, 360, side)).toEqual({ flyoutWidth: 520, width: 480, height: 360, scroll: false })
+ })
+
+ it('a medium image keeps the normal flyout and fills its width as before', () => {
+ expect(fitPreviewImage(300, 200, side)).toEqual({ flyoutWidth: 440, width: 400, height: 267, scroll: false })
+ })
+
+ it('never exceeds the window: width, and height unless scrolling', () => {
+ for (const [w, h] of [[5000, 5000], [10000, 200], [200, 10000], [1, 1], [4096, 2160], [2560, 1600]]) {
+ for (const b of [side, top, { ...side, devicePixelRatio: 1.5 }]) {
+ const f = fitPreviewImage(w, h, b)
+ expect(f.flyoutWidth).toBeGreaterThanOrEqual(b.minFlyoutWidth)
+ expect(f.flyoutWidth).toBeLessThanOrEqual(b.maxFlyoutWidth)
+ expect(f.width).toBeLessThanOrEqual(b.maxFlyoutWidth - b.sidePadding)
+ if (!f.scroll) expect(f.height).toBeLessThanOrEqual(b.maxImageHeight)
+ }
+ }
+ })
+
+ it('bad sizes fall back to the normal flyout', () => {
+ expect(fitPreviewImage(0, 0, side).flyoutWidth).toBe(440)
+ expect(fitPreviewImage(NaN, 100, side).flyoutWidth).toBe(440)
+ })
+})