Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.
TypeScript clipboardclipboard-managerdesktop-appdrag-and-dropelectronopen-sourceproductivityproductivity-toolwindows
feat(swatches): add dynamic Pantone color cards and optimize horizontal dock stack & emoji layouts
Deepender25d5f7f484125f
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsxindex c04c098..20c42b1 100644--- a/src/components/ClipboardItem.tsx+++ b/src/components/ClipboardItem.tsx@@ -25,11 +25,11 @@ import { itemRenderKey } from '../lib/itemSignature'import { basename, formatBytes, previewText, relativeTime, formatImageDisplayName } from '../lib/format'import { getFileKind } from '../lib/fileType'import { playButtonClickSound, playToggleSound, playDeleteSound, playCardExpandSound } from '../lib/soundEffects'-import { CopyIcon, FileKindIcon, FileStackPhoto, PinIcon, PinFillIcon, TrashIcon, MinusIcon, ChevronUpIcon, ExpandIcon, ContractIcon, ExternalLinkIcon } from './icons'+import { CopyIcon, FileKindIcon, FileStackPhoto, PinIcon, PinFillIcon, TrashIcon, MinusIcon, ChevronUpIcon, ChevronLeftIcon, ExpandIcon, ContractIcon, ExternalLinkIcon } from './icons'import { LinkPreviewCard } from './LinkPreviewCard'import '../styles/item.css'-import { tryPaste } from '../lib/tryPaste'+import { parseColor } from '../lib/colorUtils'import { useTranslation, t } from '../i18n'interface Props {@@ -62,6 +62,10 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item, timeTick =const startDrag = useDragOut()const [copied, setCopied] = useState(false)+ const settings = useStore((s) => s.settings)+ const isHorizontal = settings.stickPosition === 'top' || settings.stickPosition === 'bottom'+ const colorInfo = item.data.kind === 'text' ? parseColor(item.data.text) : null+// Accordion expansion: ONE stack open at a time, coordinated store-wide// (expanding another stack collapses this one; Escape / outside click /// filter or settings switches collapse via the same store field).@@ -74,6 +78,17 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item, timeTick =const isPreviewing = useStore((s) => s.previewItemId) === item.idconst isBundle = (item.data.kind === 'files' && item.data.paths.length > 1) || item.data.kind === 'image-collection'+ const bundleCount = item.data.kind === 'image-collection'+ ? item.data.images.length+ : item.data.kind === 'files'+ ? item.data.paths.length+ : 0++ const screenW = typeof window !== 'undefined' ? window.innerWidth : 1140+ const expandedWidth = expanded && isHorizontal+ ? Math.min(screenW - 80, Math.max(300, 36 + bundleCount * 112))+ : undefined+useEffect(() => {if (!isBundle && expanded) setExpandedFlag(false)}, [isBundle, expanded, setExpandedFlag])@@ -225,8 +240,15 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item, timeTick =initial={false}animate={{ opacity: 1 }}transition={{ layout: { duration: 0.18, ease: [0.22, 1, 0.36, 1] } }}- className={`item${item.pinned ? ' pinned' : ''}${isBundle ? ' bundle' : ''}`}+ className={`item${item.pinned ? ' pinned' : ''}${isBundle ? ' bundle' : ''}${expanded ? ' is-expanded' : ''}${colorInfo ? ` is-color-card ${colorInfo.isLight ? 'is-light-color' : 'is-dark-color'}` : ''}`}data-expanded-stack={expanded ? 'true' : undefined}+ style={{+ ...(expandedWidth ? { width: expandedWidth, minWidth: expandedWidth, maxWidth: expandedWidth } : {}),+ ...(colorInfo ? {+ '--card-color': colorInfo.cssColor,+ backgroundColor: colorInfo.cssColor+ } as React.CSSProperties : {})+ }}>{copied && (<motion.div@@ -238,7 +260,9 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item, timeTick =position: 'absolute',inset: 0,borderRadius: 16,- background: 'radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.08) 45%, transparent 75%)',+ background: colorInfo?.isLight+ ? 'radial-gradient(circle at center, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.06) 45%, transparent 75%)'+ : 'radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.08) 45%, transparent 75%)',pointerEvents: 'none',zIndex: 15}}@@ -255,7 +279,9 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item, timeTick =if (pointerStartRef.current) pointerStartRef.current.moved = truehandleDragStart(e, { id: item.id })}}- onDragEnd={() => setInternalDragReq(null)}+ onDragEnd={() => {+ setInternalDragReq(null)+ }}onDragOver={(e) => {const activeDrag = useStore.getState().internalDragReqif (activeDrag && activeDrag.id !== item.id) {@@ -270,9 +296,6 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item, timeTick =if (activeDrag && activeDrag.id !== item.id) {e.preventDefault()e.stopPropagation()- // If they drop an entire item or a subitem onto another item, we merge them.- // Currently our merge logic merges the entire source item.- // In the future we might want to merge just the subitem.window.edge.mergeItems(activeDrag.id, item.id)setInternalDragReq(null)} else if (activeDrag && activeDrag.id === item.id) {@@ -289,6 +312,7 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item, timeTick =<BundleFluidPreviewitem={item}expanded={expanded}+ isHorizontal={isHorizontal}onDragStart={handleDragStart}onCopy={onCopy}onRemove={() => remove(item.id)}@@ -569,9 +593,192 @@ function BundleToolbar({)}+function HorizontalBundleExpanded({+ item,+ onCollapse,+ onCopy,+ onRemove,+ onDragStart+}: {+ item: ClipboardItemDto+ onCollapse: (e?: React.MouseEvent) => void+ onCopy: (e: React.MouseEvent) => void+ onRemove: () => void+ onDragStart: (e: React.DragEvent, req: DragRequest) => void+}) {+ const { t } = useTranslation()+ const isImageCollection = item.data.kind === 'image-collection'+ const isFiles = item.data.kind === 'files'+ const images = item.data.kind === 'image-collection' ? item.data.images : []+ const paths = item.data.kind === 'files' ? item.data.paths : []+ const entries = item.data.kind === 'files' ? item.data.entries : undefined++ return (+ <div className="horizontal-bundle-expanded">+ {/* Top Header Toolbar */}+ <div+ className="horizontal-bundle-header"+ title={t('item.collapsePinned')}+ onClick={(e) => {+ e.stopPropagation()+ onCollapse(e)+ }}+ >+ <button+ type="button"+ className="bundle-collapse-hit"+ title={t('item.collapsePinned')}+ onClick={(e) => {+ e.stopPropagation()+ e.currentTarget.blur()+ onCollapse(e)+ }}+ >+ <ChevronLeftIcon />+ </button>+ <div className="actions-pill" onClick={(e) => e.stopPropagation()}>+ <button+ className="act"+ title={t('item.copy')}+ onClick={(e) => { e.stopPropagation(); e.currentTarget.blur(); onCopy(e) }}+ >+ <CopyIcon />+ </button>+ <button+ className="act danger"+ title={t('item.delete')}+ onClick={(e) => { e.stopPropagation(); e.currentTarget.blur(); onRemove() }}+ >+ <TrashIcon />+ </button>+ </div>+ </div>++ {/* Horizontal Sub-Item Track */}+ <div className="horizontal-subitem-track" onClick={(e) => e.stopPropagation()}>+ {isImageCollection && images.map((img) => (+ <motion.div+ key={img.imageId}+ className="horizontal-subitem-tile"+ variants={rowVariants}+ draggable+ onMouseEnter={() => window.edge.prestageDrag({ id: item.id, imageId: img.imageId })}+ onPointerDown={() => window.edge.prestageDrag({ id: item.id, imageId: img.imageId })}+ onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, imageId: img.imageId }) }}+ onClick={(e) => { e.stopPropagation(); tryPaste(() => window.edge.pasteSubitem({ id: item.id, imageId: img.imageId })) }}+ >+ <div className="horizontal-subitem-actions">+ <button+ className="act subitem-copy-btn"+ title={t('item.copy')}+ onClick={(e) => {+ e.stopPropagation()+ e.currentTarget.blur()+ useStore.getState().copySubitem({ id: item.id, imageId: img.imageId })+ }}+ >+ <CopyIcon width={11} height={11} />+ </button>+ <button+ className="act subitem-delete-btn"+ title={t('item.ungroup')}+ onClick={(e) => {+ e.stopPropagation()+ e.currentTarget.blur()+ window.edge.splitItem({ id: item.id, imageId: img.imageId, splitPlacement: 'after' })+ }}+ >+ <MinusIcon width={11} height={11} />+ </button>+ </div>+ <div className="horizontal-subitem-icon-wrap">+ <img+ src={img.preview}+ alt=""+ loading="lazy"+ decoding="async"+ draggable={false}+ className="horizontal-subitem-img"+ />+ </div>+ <div className="horizontal-subitem-meta">+ <span className="horizontal-subitem-name">{img.width}×{img.height}</span>+ <span className="horizontal-subitem-sub">{formatBytes(img.bytes)}</span>+ </div>+ </motion.div>+ ))}++ {isFiles && paths.map((filePath, index) => {+ const entry = entries?.[index]+ const name = formatImageDisplayName(entry?.name ?? filePath, item.capturedAt)+ const size = entry?.size ?? 0+ const isImg = entry?.isImage && entry.preview++ return (+ <motion.div+ key={`${item.id}-${filePath}-${index}`}+ className="horizontal-subitem-tile"+ variants={rowVariants}+ draggable+ onMouseEnter={() => window.edge.prestageDrag({ id: item.id, paths: [filePath] })}+ onPointerDown={() => window.edge.prestageDrag({ id: item.id, paths: [filePath] })}+ onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, paths: [filePath] }) }}+ onClick={(e) => { e.stopPropagation(); tryPaste(() => window.edge.pasteSubitem({ id: item.id, paths: [filePath] })) }}+ >+ <div className="horizontal-subitem-actions">+ <button+ className="act subitem-copy-btn"+ title={t('item.copyFilePath')}+ onClick={(e) => {+ e.stopPropagation()+ e.currentTarget.blur()+ useStore.getState().copySubitem({ id: item.id, paths: [filePath] })+ }}+ >+ <CopyIcon width={11} height={11} />+ </button>+ <button+ className="act subitem-delete-btn"+ title={t('item.ungroup')}+ onClick={(e) => {+ e.stopPropagation()+ e.currentTarget.blur()+ window.edge.splitItem({ id: item.id, paths: [filePath], splitPlacement: 'after' })+ }}+ >+ <MinusIcon width={11} height={11} />+ </button>+ </div>+ <div className="horizontal-subitem-icon-wrap">+ {isImg ? (+ <img+ src={entry.preview!}+ alt=""+ loading="lazy"+ decoding="async"+ draggable={false}+ className="horizontal-subitem-img"+ />+ ) : (+ <FileKindIcon path={filePath} width={40} height={40} isDirectory={entry?.isDirectory} />+ )}+ </div>+ <div className="horizontal-subitem-meta">+ <span className="horizontal-subitem-name" title={name}>{name}</span>+ <span className="horizontal-subitem-sub">{size > 0 ? formatBytes(size) : getFileKind(filePath, entry?.isDirectory).label}</span>+ </div>+ </motion.div>+ )+ })}+ </div>+ </div>+ )+}+function BundleFluidPreview({item,expanded,+ isHorizontal = false,onDragStart,onCopy,onRemove,@@ -579,44 +786,59 @@ function BundleFluidPreview({}: {item: ClipboardItemDtoexpanded: boolean+ isHorizontal?: booleanonDragStart: (e: React.DragEvent, req: DragRequest) => voidonCopy: (e: React.MouseEvent) => voidonRemove: () => voidonCollapse: (e?: React.MouseEvent) => void}) {+ if (isHorizontal && expanded) {+ return (+ <HorizontalBundleExpanded+ item={item}+ onCollapse={onCollapse}+ onCopy={onCopy}+ onRemove={onRemove}+ onDragStart={onDragStart}+ />+ )+ }+if (item.data.kind === 'image-collection') {const more = item.data.images.length - 1+ const photoSize = isHorizontal ? 76 : 124return (<BundleExpandShellexpanded={expanded}stack={<>- <div className="bundle-stack-large">- {/* Photo stacks wear the same fixed-shape folder tile as file- stacks (FileStackPhoto masks each preview into the SVG- silhouette), fanned with the same CENTER-symmetric spread- math as the files branch so larger stacks stay inside the- container instead of clipping at the card edge. */}+ <div className="bundle-stack-large" style={isHorizontal ? { height: 82 } : undefined}>{item.data.images.slice(0, 4).map((img, pathIndex) => ({ img, pathIndex })).reverse().map(({ img }, idx, arr) => {const realIndex = arr.length - 1 - idx- const spread = arr.length > 1 ? 22 : 0- const rotSpread = arr.length > 1 ? 9 : 0+ const spread = arr.length > 1 ? (isHorizontal ? 12 : 16) : 0+ const rotSpread = arr.length > 1 ? (isHorizontal ? 5 : 7) : 0const centerOffset = ((arr.length - 1) * spread) / 2const centerRot = ((arr.length - 1) * rotSpread) / 2const stackMotion = {x: realIndex * spread - centerOffset,- y: realIndex * 5,+ y: 0,rotate: realIndex * rotSpread - centerRot,- scale: 1 - realIndex * 0.05+ scale: 1 - realIndex * 0.04}return (<motion.divkey={img.imageId}className="bundle-stack-icon-item"animate={stackMotion}- style={{ zIndex: 10 - realIndex }}+ style={{+ zIndex: 10 - realIndex,+ width: photoSize,+ height: photoSize,+ marginTop: -photoSize / 2,+ marginLeft: -photoSize / 2+ }}>- <FileStackPhoto src={img.preview} width={154} height={154} />+ <FileStackPhoto src={img.preview} width={photoSize} height={photoSize} /></motion.div>)})}@@ -634,17 +856,17 @@ function BundleFluidPreview({onRemove={onRemove}onTogglePin={() => useStore.getState().togglePin(item.id, !item.pinned)}/>- {item.data.images.map((img) => (- <motion.div- key={img.imageId}- className="fluid-card-row"- variants={rowVariants}- draggable- onMouseEnter={() => window.edge.prestageDrag({ id: item.id, imageId: img.imageId })}- onPointerDown={() => window.edge.prestageDrag({ id: item.id, imageId: img.imageId })}- onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, imageId: img.imageId }) }}- onClick={(e) => { e.stopPropagation(); tryPaste(() => window.edge.pasteSubitem({ id: item.id, imageId: img.imageId })) }}- >+ {item.data.images.map((img) => (+ <motion.div+ key={img.imageId}+ className="fluid-card-row"+ variants={rowVariants}+ draggable+ onMouseEnter={() => window.edge.prestageDrag({ id: item.id, imageId: img.imageId })}+ onPointerDown={() => window.edge.prestageDrag({ id: item.id, imageId: img.imageId })}+ onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, imageId: img.imageId }) }}+ onClick={(e) => { e.stopPropagation(); tryPaste(() => window.edge.pasteSubitem({ id: item.id, imageId: img.imageId })) }}+ ><div className="fluid-row-icon"><imgsrc={img.preview}@@ -680,48 +902,50 @@ function BundleFluidPreview({const entries = item.data.entriesconst paths = item.data.pathsconst count = paths.length+ const photoSize = isHorizontal ? 76 : 124return (<BundleExpandShellexpanded={expanded}stack={<>- <div className="bundle-stack-large">+ <div className="bundle-stack-large" style={isHorizontal ? { height: 82 } : undefined}>{paths.slice(0, 4).map((filePath, i) => ({ filePath, pathIndex: i })).reverse().map(({ filePath, pathIndex }, idx, arr) => {const realIndex = arr.length - 1 - idxconst entry = entries?.[pathIndex]const isImg = !!(entry?.isImage && entry.preview)- const spread = arr.length > 1 ? 22 : 0- const rotSpread = arr.length > 1 ? 9 : 0+ const spread = arr.length > 1 ? (isHorizontal ? 12 : 16) : 0+ const rotSpread = arr.length > 1 ? (isHorizontal ? 5 : 7) : 0const centerOffset = ((arr.length - 1) * spread) / 2const centerRot = ((arr.length - 1) * rotSpread) / 2const stackMotion = {x: realIndex * spread - centerOffset,- y: realIndex * 5,+ y: 0,rotate: realIndex * rotSpread - centerRot,- scale: 1 - realIndex * 0.05+ scale: 1 - realIndex * 0.04}- // Single unified tile path: photos wear the folder-silhouette- // mask (FileStackPhoto), everything else wears its category's- // pastel SVG icon — identical geometry for every stack size.- // GIF thumbs 415 in the bounded endpoint, so tiles fall back to- // streaming the original file (animated) on load failure.return (<motion.divkey={`${item.id}-${pathIndex}`}className="bundle-stack-icon-item"animate={stackMotion}- style={{ zIndex: 10 - realIndex }}+ style={{+ zIndex: 10 - realIndex,+ width: photoSize,+ height: photoSize,+ marginTop: -photoSize / 2,+ marginLeft: -photoSize / 2+ }}>{isImg ? (<FileStackPhotosrc={entry.preview!}- width={154}- height={154}+ width={photoSize}+ height={photoSize}fallbackSrc={fileStreamUrl(filePath)}/>) : (- <FileKindIcon path={filePath} width={154} height={154} isDirectory={entry?.isDirectory} />+ <FileKindIcon path={filePath} width={photoSize} height={photoSize} isDirectory={entry?.isDirectory} />)}</motion.div>)@@ -762,7 +986,7 @@ function BundleFluidPreview({{entry?.isImage && entry.preview ? (<FileStackPhoto src={entry.preview} width={48} height={48} fallbackSrc={fileStreamUrl(filePath)} />) : (- <FileKindIcon path={filePath} width={48} height={48} isDirectory={entry?.isDirectory} />+ <FileKindIcon path={filePath} width={44} height={44} isDirectory={entry?.isDirectory} />)}</div><div className="fluid-row-content">@@ -804,11 +1028,20 @@ function BundleFluidPreview({function Preview({ item }: { item: ClipboardItemDto }) {switch (item.data.kind) {- case 'text':+ case 'text': {if (item.data.isUrl) {return <LinkPreviewCard url={item.data.text} />}+ const colorInfo = parseColor(item.data.text)+ if (colorInfo) {+ return (+ <div className="color-swatch-content">+ <div className="color-swatch-code">{colorInfo.displayText}</div>+ </div>+ )+ }return <div className="preview">{previewText(item.data.text)}</div>+ }case 'image':return (@@ -898,6 +1131,8 @@ function KindBadge({ item }: { item: ClipboardItemDto }) {case 'text':if (item.data.isUrl)return <span className="kind-badge url">{t('filters.links').toLowerCase()}</span>+ if (item.data.isColor || parseColor(item.data.text))+ return <span className="kind-badge color">color</span>return <span className="kind-badge">{t('filters.text').toLowerCase()}</span>case 'image':return (@@ -951,8 +1186,9 @@ function ItemDetails({ item }: { item: ClipboardItemDto }) {return null}- if (item.data.isColor) {- return <span className="meta-detail">· {item.data.text.trim()}</span>+ const colorInfo = parseColor(item.data.text)+ if (item.data.isColor || colorInfo) {+ return null}return nulldiff --git a/src/components/EmojiPicker.tsx b/src/components/EmojiPicker.tsxindex e6e9d2a..ffe6436 100644--- a/src/components/EmojiPicker.tsx+++ b/src/components/EmojiPicker.tsx@@ -74,7 +74,13 @@ function Glyph({ file, size = 22 }: { file: string; size?: number }) {)}-export function EmojiPicker({ active = true }: { active?: boolean }) {+export function EmojiPicker({+ active = true,+ isHorizontal = false+}: {+ active?: boolean+ isHorizontal?: boolean+}) {const { t } = useTranslation()const pasteEmoji = useStore((s) => s.pasteEmoji)const category = useStore((s) => s.emojiCategory)@@ -83,6 +89,7 @@ export function EmojiPicker({ active = true }: { active?: boolean }) {const [failed, setFailed] = useState(false)const [recents, setRecents] = useState<string[]>(loadRecents)const [scrollTop, setScrollTop] = useState(0)+ const [viewW, setViewW] = useState(0)const [viewH, setViewH] = useState(320)const [tonePop, setTonePop] = useState<TonePopup | null>(null)const [hoveredCat, setHoveredCat] = useState<{@@ -137,7 +144,9 @@ export function EmojiPicker({ active = true }: { active?: boolean }) {if (!el) returnconst apply = () => {const h = el.clientHeight+ const w = el.clientWidthif (h > 0) setViewH(h)+ if (w > 0) setViewW(w)}const ro = new ResizeObserver(apply)ro.observe(el)@@ -167,10 +176,19 @@ export function EmojiPicker({ active = true }: { active?: boolean }) {return out}, [catalog, category, recents])- const rows = Math.ceil(items.length / COLS)+ const cols = useMemo(() => {+ if (!isHorizontal) return COLS+ if (viewW <= 0) return 24+ return Math.max(8, Math.floor((viewW - 16) / 36))+ }, [isHorizontal, viewW])++ const rowH = isHorizontal ? 32 : ROW_H+ const glyphSize = isHorizontal ? 22 : 26++ const rows = Math.ceil(items.length / cols)const overscan = 3- const startRow = Math.max(0, Math.floor(scrollTop / ROW_H) - overscan)- const visibleRows = Math.ceil(viewH / ROW_H) + overscan * 2+ const startRow = Math.max(0, Math.floor(scrollTop / rowH) - overscan)+ const visibleRows = Math.ceil(viewH / rowH) + overscan * 2const endRow = Math.min(rows, startRow + visibleRows)const onPaste = useCallback(@@ -204,7 +222,7 @@ export function EmojiPicker({ active = true }: { active?: boolean }) {return (<div- className="emoji-picker"+ className={`emoji-picker${isHorizontal ? ' horizontal' : ''}`}ref={pickerRef}onPointerDown={(e) => {const t = e.target as HTMLElement@@ -263,8 +281,12 @@ export function EmojiPicker({ active = true }: { active?: boolean }) {{failed ? (<div className="emoji-status">{t('emoji.loadFailed')}</div>) : !catalog ? (- <div className="emoji-skel" aria-hidden>- {Array.from({ length: 28 }, (_, i) => (+ <div+ className="emoji-skel"+ style={isHorizontal ? { gridTemplateColumns: `repeat(${cols}, 1fr)` } : undefined}+ aria-hidden+ >+ {Array.from({ length: isHorizontal ? cols * 4 : 28 }, (_, i) => (<i key={i} />))}</div>@@ -280,12 +302,16 @@ export function EmojiPicker({ active = true }: { active?: boolean }) {setHoveredCat(null)}}>- <div style={{ height: startRow * ROW_H }} />+ <div style={{ height: startRow * rowH }} />{Array.from({ length: endRow - startRow }, (_, i) => {const row = startRow + i- const slice = items.slice(row * COLS, row * COLS + COLS)+ const slice = items.slice(row * cols, row * cols + cols)return (- <div key={row} className="emoji-row">+ <div+ key={row}+ className="emoji-row"+ style={isHorizontal ? { gridTemplateColumns: `repeat(${cols}, 1fr)`, height: rowH } : undefined}+ >{slice.map((item) => {const skinnable = hasSkinTones(item.entry)return (@@ -310,14 +336,14 @@ export function EmojiPicker({ active = true }: { active?: boolean }) {onPaste(item.key)}}>- <Glyph file={item.file} size={26} />+ <Glyph file={item.file} size={glyphSize} /></button>)})}</div>)})}- <div style={{ height: Math.max(0, (rows - endRow) * ROW_H) }} />+ <div style={{ height: Math.max(0, (rows - endRow) * rowH) }} /></div>)}diff --git a/src/components/ItemList.tsx b/src/components/ItemList.tsxindex 12d33ee..772e652 100644--- a/src/components/ItemList.tsx+++ b/src/components/ItemList.tsx@@ -35,6 +35,9 @@ export function ItemList() {const isHorizontal = settings.stickPosition === 'top' || settings.stickPosition === 'bottom'const typeFilter = useStore((s) => s.typeFilter) || 'all'+ const filterScrollMap = useRef<Record<string, { top: number; left: number }>>({})+ const prevFilterRef = useRef(typeFilter)+const [showScrollTop, setShowScrollTop] = useState(false)const [collapsedMap, setCollapsedMap] = useState<Record<string, boolean>>(() => {try {@@ -93,13 +96,15 @@ export function ItemList() {topPinnedTime !== lastClosedTopPinnedTime.currentif (timeSinceClosed >= 60000 || hasNewCopyWhileClosed) {+ filterScrollMap.current = {}if (listRef.current) {- listRef.current.scrollTop = 0+ if (isHorizontal) listRef.current.scrollLeft = 0+ else listRef.current.scrollTop = 0}}}prevOpen.current = open- }, [open, topRecentId, topRecentTime, topPinnedTime])+ }, [open, topRecentId, topRecentTime, topPinnedTime, isHorizontal])useLayoutEffect(() => {// If a brand new or freshly updated item was added while panel is open, jump to top@@ -108,8 +113,10 @@ export function ItemList() {const isNewPinned = !!topPinnedTime && (!prevTopPinnedTime.current || topPinnedTime > prevTopPinnedTime.current)if (isNewRecent || isNewPinned) {+ filterScrollMap.current[typeFilter] = { top: 0, left: 0 }if (listRef.current) {- listRef.current.scrollTop = 0+ if (isHorizontal) listRef.current.scrollLeft = 0+ else listRef.current.scrollTop = 0}}}@@ -117,7 +124,55 @@ export function ItemList() {prevTopRecentId.current = topRecentIdprevTopRecentTime.current = topRecentTimeprevTopPinnedTime.current = topPinnedTime- }, [open, topRecentId, topRecentTime, topPinnedTime])+ }, [open, topRecentId, topRecentTime, topPinnedTime, isHorizontal, typeFilter])++ // Independent scroll position per filter page (unsynchronized across tabs)+ useLayoutEffect(() => {+ const el = listRef.current+ if (!el) return++ if (prevFilterRef.current !== typeFilter) {+ // Save outgoing filter's scroll position before applying new filter's position+ filterScrollMap.current[prevFilterRef.current] = {+ top: el.scrollTop,+ left: el.scrollLeft+ }+ prevFilterRef.current = typeFilter++ // Restore incoming filter's saved scroll position (defaulting to 0)+ const saved = filterScrollMap.current[typeFilter]+ if (isHorizontal) {+ el.scrollLeft = saved?.left ?? 0+ } else {+ el.scrollTop = saved?.top ?? 0+ }+ }+ }, [typeFilter, isHorizontal])++ // Reset scroll on search query change+ const prevQueryRef = useRef(query)+ useLayoutEffect(() => {+ if (prevQueryRef.current !== query) {+ prevQueryRef.current = query+ if (listRef.current) {+ if (isHorizontal) listRef.current.scrollLeft = 0+ else listRef.current.scrollTop = 0+ }+ }+ }, [query, isHorizontal])++ // Reset scroll map when switching dock position+ const prevStickPos = useRef(settings.stickPosition)+ useLayoutEffect(() => {+ if (prevStickPos.current !== settings.stickPosition) {+ prevStickPos.current = settings.stickPosition+ filterScrollMap.current = {}+ if (listRef.current) {+ listRef.current.scrollTop = 0+ listRef.current.scrollLeft = 0+ }+ }+ }, [settings.stickPosition])useEffect(() => {if (!isDraggingAny) {@@ -126,13 +181,24 @@ export function ItemList() {}, [isDraggingAny])const handleScroll = (e: React.UIEvent<HTMLDivElement>) => {- const next = e.currentTarget.scrollTop > 50+ const el = e.currentTarget+ filterScrollMap.current[typeFilter] = {+ top: el.scrollTop,+ left: el.scrollLeft+ }+ const scrollPos = isHorizontal ? el.scrollLeft : el.scrollTop+ const next = scrollPos > 50setShowScrollTop((prev) => (prev === next ? prev : next))}const scrollToTop = () => {if (listRef.current) {- listRef.current.scrollTo({ top: 0, behavior: 'smooth' })+ filterScrollMap.current[typeFilter] = { top: 0, left: 0 }+ if (isHorizontal) {+ listRef.current.scrollTo({ left: 0, behavior: 'smooth' })+ } else {+ listRef.current.scrollTo({ top: 0, behavior: 'smooth' })+ }}}@@ -292,7 +358,7 @@ export function ItemList() {)}<AnimatePresence>- {showScrollTop && (+ {!isHorizontal && showScrollTop && (<motion.buttoninitial={{ opacity: 0 }}animate={{ opacity: 1 }}diff --git a/src/components/Panel.tsx b/src/components/Panel.tsxindex 1193cfa..f9333a0 100644--- a/src/components/Panel.tsx+++ b/src/components/Panel.tsx@@ -487,7 +487,7 @@ export function Panel() {}}aria-hidden={!emojiOpen}>- {emojiMounted ? <EmojiPicker active={emojiOpen} /> : null}+ {emojiMounted ? <EmojiPicker active={emojiOpen} isHorizontal={isHorizontal} /> : null}</div></div>{!isHorizontal && (@@ -536,7 +536,7 @@ export function Panel() {</AnimatePresence></div><DropOverlay />- <SplitDropZone isRight={isRight} />+ <SplitDropZone stickPosition={settings.stickPosition || (isRight ? 'right' : 'left')} /></div><PreviewFlyout isRight={isRight} /><IndicatorStyleFlyout isRight={isRight} />@@ -625,7 +625,7 @@ function DropOverlay() {)}-function SplitDropZone({ isRight = false }: { isRight?: boolean }) {+function SplitDropZone({ stickPosition = 'left' }: { stickPosition?: 'left' | 'right' | 'top' | 'bottom' }) {const internalDragReq = useStore((s) => s.internalDragReq)const isSubitemDragging = !!(internalDragReq &&@@ -643,23 +643,86 @@ function SplitDropZone({ isRight = false }: { isRight?: boolean }) {setIsOver(false)}+ const handleDrop = (e: React.DragEvent) => {+ e.preventDefault()+ e.stopPropagation()+ setIsOver(false)+ const req = useStore.getState().internalDragReq+ if (req && (req.imageId || (req.paths && req.paths.length > 0))) {+ window.edge.splitItem(req)+ useStore.getState().setInternalDragReq(null)+ }+ }++ const isTop = stickPosition === 'top'+ const isBottom = stickPosition === 'bottom'+ const isRight = stickPosition === 'right'++ const initialMotion = isTop+ ? { opacity: 0, y: -15 }+ : isBottom+ ? { opacity: 0, y: 15 }+ : isRight+ ? { opacity: 0, x: 15 }+ : { opacity: 0, x: -15 }++ const exitMotion = initialMotion++ const styleByPos: React.CSSProperties = isTop+ ? {+ top: 0,+ left: 0,+ right: 0,+ height: isOver ? 68 : 52,+ flexDirection: 'column',+ alignItems: 'center',+ justifyContent: 'flex-start'+ }+ : isBottom+ ? {+ bottom: 0,+ left: 0,+ right: 0,+ height: isOver ? 68 : 52,+ flexDirection: 'column',+ alignItems: 'center',+ justifyContent: 'flex-end'+ }+ : isRight+ ? {+ top: 0,+ bottom: 0,+ right: 0,+ width: isOver ? 100 : 80,+ justifyContent: 'flex-end',+ alignItems: 'center'+ }+ : {+ top: 0,+ bottom: 0,+ left: 0,+ width: isOver ? 100 : 80,+ justifyContent: 'flex-start',+ alignItems: 'center'+ }+return (<AnimatePresence>{isSubitemDragging && (<motion.div- className={`split-dropzone${isOver ? ' active' : ''}`}- onDragOver={(e) => e.preventDefault()}+ className={`split-dropzone pos-${stickPosition}${isOver ? ' active' : ''}`}+ onDragOver={(e) => {+ e.preventDefault()+ if (!isOver) setIsOver(true)+ }}onDragEnter={handleDragEnter}onDragLeave={handleDragLeave}- initial={{ opacity: 0, x: isRight ? 15 : -15 }}- animate={{ opacity: 1, x: 0 }}- exit={{ opacity: 0, x: isRight ? 15 : -15 }}+ onDrop={handleDrop}+ initial={initialMotion}+ animate={{ opacity: 1, x: 0, y: 0 }}+ exit={exitMotion}transition={{ type: 'spring', stiffness: 350, damping: 25 }}- style={{- left: isRight ? 'auto' : 0,- right: isRight ? 0 : 'auto',- justifyContent: isRight ? 'flex-end' : 'flex-start'- }}+ style={styleByPos}><div className="glow-line" /></motion.div>diff --git a/src/lib/colorUtils.ts b/src/lib/colorUtils.tsnew file mode 100644index 0000000..ed04486--- /dev/null+++ b/src/lib/colorUtils.ts@@ -0,0 +1,174 @@+/**+ * Color detection, parsing, and WCAG/perceptual contrast calculations.+ * Used to transform copied color codes into physical swatch cards.+ */++export interface ColorInfo {+ cssColor: string+ displayText: string+ secondaryText: string+ isLight: boolean+ r: number+ g: number+ b: number+ a: number+}++const HEX_RE = /^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/+const RGB_COMMA_RE = /^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*([\d.]+)\s*)?\)$/i+const RGB_SPACE_RE = /^rgba?\(\s*(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})(?:\s*\/\s*([\d.]+%?)\s*)?\)$/i+const HSL_COMMA_RE = /^hsla?\(\s*(\d{1,3}(?:deg)?)\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%(?:\s*,\s*([\d.]+)\s*)?\)$/i+const HSL_SPACE_RE = /^hsla?\(\s*(\d{1,3}(?:deg)?)\s+(\d{1,3})%\s+(\d{1,3})%(?:\s*\/\s*([\d.]+%?)\s*)?\)$/i++function clamp(val: number, min: number, max: number): number {+ return Math.min(max, Math.max(min, val))+}++function toHex2(n: number): string {+ const h = Math.round(clamp(n, 0, 255)).toString(16)+ return h.length === 1 ? '0' + h : h+}++function hslToRgb(h: number, s: number, l: number): [number, number, number] {+ h = (((h % 360) + 360) % 360) / 360+ s = clamp(s, 0, 100) / 100+ l = clamp(l, 0, 100) / 100++ if (s === 0) {+ const val = Math.round(l * 255)+ return [val, val, val]+ }++ const q = l < 0.5 ? l * (1 + s) : l + s - l * s+ const p = 2 * l - q++ const hue2rgb = (t: number) => {+ if (t < 0) t += 1+ if (t > 1) t -= 1+ if (t < 1 / 6) return p + (q - p) * 6 * t+ if (t < 1 / 2) return q+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6+ return p+ }++ return [+ Math.round(hue2rgb(h + 1 / 3) * 255),+ Math.round(hue2rgb(h) * 255),+ Math.round(hue2rgb(h - 1 / 3) * 255)+ ]+}++/**+ * Attempts to parse a string as a recognized color code (hex, rgb, rgba, hsl, hsla).+ * Returns null if the string is not a pure color code.+ */+export function parseColor(raw: string): ColorInfo | null {+ if (!raw || typeof raw !== 'string') return null+ const str = raw.trim()++ // 1. Hex: #rgb, #rgba, #rrggbb, #rrggbbaa+ const hexMatch = str.match(HEX_RE)+ if (hexMatch) {+ const body = hexMatch[1]+ let r = 0, g = 0, b = 0, a = 1+ if (body.length === 3) {+ r = parseInt(body[0] + body[0], 16)+ g = parseInt(body[1] + body[1], 16)+ b = parseInt(body[2] + body[2], 16)+ } else if (body.length === 4) {+ r = parseInt(body[0] + body[0], 16)+ g = parseInt(body[1] + body[1], 16)+ b = parseInt(body[2] + body[2], 16)+ a = parseInt(body[3] + body[3], 16) / 255+ } else if (body.length === 6) {+ r = parseInt(body.slice(0, 2), 16)+ g = parseInt(body.slice(2, 4), 16)+ b = parseInt(body.slice(4, 6), 16)+ } else if (body.length === 8) {+ r = parseInt(body.slice(0, 2), 16)+ g = parseInt(body.slice(2, 4), 16)+ b = parseInt(body.slice(4, 6), 16)+ a = parseInt(body.slice(6, 8), 16) / 255+ }++ const perceived = (r * 299 + g * 587 + b * 114) / 1000+ // Account for alpha blend over dark app surface (~20)+ const effectiveBrightness = perceived * a + 20 * (1 - a)+ const isLight = effectiveBrightness >= 140++ const secondaryText = a < 1+ ? `rgba(${r}, ${g}, ${b}, ${Math.round(a * 100) / 100})`+ : `rgb(${r}, ${g}, ${b})`++ return {+ cssColor: str,+ displayText: str,+ secondaryText,+ isLight,+ r, g, b, a+ }+ }++ // 2. RGB / RGBA: comma or modern space syntax+ const rgbMatch = str.match(RGB_COMMA_RE) || str.match(RGB_SPACE_RE)+ if (rgbMatch) {+ const r = clamp(parseInt(rgbMatch[1], 10), 0, 255)+ const g = clamp(parseInt(rgbMatch[2], 10), 0, 255)+ const b = clamp(parseInt(rgbMatch[3], 10), 0, 255)+ let a = 1+ if (rgbMatch[4] != null) {+ if (rgbMatch[4].endsWith('%')) {+ a = clamp(parseFloat(rgbMatch[4]) / 100, 0, 1)+ } else {+ a = clamp(parseFloat(rgbMatch[4]), 0, 1)+ }+ }++ const perceived = (r * 299 + g * 587 + b * 114) / 1000+ const effectiveBrightness = perceived * a + 20 * (1 - a)+ const isLight = effectiveBrightness >= 140++ const hex = `#${toHex2(r)}${toHex2(g)}${toHex2(b)}${a < 1 ? toHex2(Math.round(a * 255)) : ''}`++ return {+ cssColor: str,+ displayText: str,+ secondaryText: hex,+ isLight,+ r, g, b, a+ }+ }++ // 3. HSL / HSLA: comma or modern space syntax+ const hslMatch = str.match(HSL_COMMA_RE) || str.match(HSL_SPACE_RE)+ if (hslMatch) {+ const h = parseInt(hslMatch[1].replace('deg', ''), 10)+ const s = parseInt(hslMatch[2], 10)+ const l = parseInt(hslMatch[3], 10)+ let a = 1+ if (hslMatch[4] != null) {+ if (hslMatch[4].endsWith('%')) {+ a = clamp(parseFloat(hslMatch[4]) / 100, 0, 1)+ } else {+ a = clamp(parseFloat(hslMatch[4]), 0, 1)+ }+ }++ const [r, g, b] = hslToRgb(h, s, l)+ const perceived = (r * 299 + g * 587 + b * 114) / 1000+ const effectiveBrightness = perceived * a + 20 * (1 - a)+ const isLight = effectiveBrightness >= 140++ const hex = `#${toHex2(r)}${toHex2(g)}${toHex2(b)}${a < 1 ? toHex2(Math.round(a * 255)) : ''}`++ return {+ cssColor: str,+ displayText: str,+ secondaryText: hex,+ isLight,+ r, g, b, a+ }+ }++ return null+}diff --git a/src/styles/emoji.css b/src/styles/emoji.cssindex b389634..cb64beb 100644--- a/src/styles/emoji.css+++ b/src/styles/emoji.css@@ -243,3 +243,88 @@background: rgba(255, 255, 255, 0.06);}+/* ==========================================================================+ Horizontal Dock Mode (Top & Bottom Edge)+ ========================================================================== */++.emoji-picker.horizontal {+ padding: 2px 14px 4px;+ height: 100%;+ box-sizing: border-box;+}++.emoji-picker.horizontal .emoji-cat-bar {+ max-width: 440px;+ width: 100%;+ margin: 0 auto 4px;+ height: 28px;+ background: rgba(255, 255, 255, 0.04);+ border: 1px solid rgba(255, 255, 255, 0.07);+ border-radius: 999px;+ padding: 2px;+ gap: 2px;+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);+}++.emoji-picker.horizontal .emoji-cat-btn {+ height: 22px;+ border-radius: 999px;+ background: transparent;+ color: rgba(255, 255, 255, 0.65);+}++.emoji-picker.horizontal .emoji-cat-btn:hover {+ background: rgba(255, 255, 255, 0.08);+ color: #ffffff;+}++.emoji-picker.horizontal .emoji-cat-btn.active {+ background: #ffffff;+ color: #000000;+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);+}++.emoji-picker.horizontal .emoji-cat-tooltip {+ top: 34px;+ padding: 3px 8px;+ font-size: 11px;+}++.emoji-picker.horizontal .emoji-grid {+ padding: 2px 6px 4px;+ -webkit-mask-image: linear-gradient(to bottom, transparent 0px, #000 4px, #000 calc(100% - 4px), transparent 100%);+ mask-image: linear-gradient(to bottom, transparent 0px, #000 4px, #000 calc(100% - 4px), transparent 100%);+}++.emoji-picker.horizontal .emoji-row {+ gap: 2px;+ height: 32px;+}++.emoji-picker.horizontal .emoji-cell {+ height: 32px;+ border-radius: 7px;+}++.emoji-picker.horizontal .emoji-recents-footer {+ position: absolute;+ top: 3px;+ right: 14px;+ padding: 0;+ height: 28px;+ display: flex;+ align-items: center;+ z-index: 5;+}++.emoji-picker.horizontal .emoji-recents-clear-btn {+ height: 24px;+ padding: 0 10px;+ font-size: 11px;+}++.emoji-picker.horizontal .emoji-skel {+ padding: 6px 8px;+ gap: 4px;+}+diff --git a/src/styles/item.css b/src/styles/item.cssindex 0bffd73..1dd3be5 100644--- a/src/styles/item.css+++ b/src/styles/item.css@@ -1127,6 +1127,558 @@margin-left: -40px;}+.list.horizontal .item.is-image .item-content,+.list.horizontal .item:has(.thumb-wrap) .item-content {+ display: flex;+ flex-direction: column;+ justify-content: center;+ align-items: center;+ padding: 6px 12px 4px 12px;+}++.list.horizontal .thumb-wrap {+ width: 100%;+ height: auto;+ max-height: 106px;+ display: flex;+ align-items: center;+ justify-content: center;+ background: transparent;+ border-radius: 10px;+ overflow: hidden;+}+.list.horizontal .thumb {- max-height: 85px;+ width: auto;+ max-width: 100%;+ height: auto;+ max-height: 100px;+ object-fit: contain;+ border-radius: 8px;+ box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.09);+ transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;+}++.list.horizontal .item:hover .thumb {+ transform: scale(1.02);+ box-shadow: 0 6px 24px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.16);+}++.list.horizontal .item-content:has(.preview.single) .thumb {+ max-height: 84px;+}++.list.horizontal .preview.single {+ font-size: calc(10.5px * var(--font-scale, 1));+ text-align: center;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ max-width: 100%;+}++/* ------------------------------------------------------------------ */+/* Horizontal Expanded Stack & Sub-Item Tile Styling */+/* ------------------------------------------------------------------ */++.list.horizontal .item.is-expanded {+ max-width: none;+ overflow: visible;+ z-index: 10;+}++.list.horizontal .item.is-expanded .item-main {+ width: 100%;+}++.list.horizontal .item.is-expanded .item-content {+ padding: 6px 10px 6px 10px;+ overflow: visible;+}++.horizontal-bundle-expanded {+ display: flex;+ flex-direction: column;+ height: 100%;+ width: 100%;+ gap: 4px;+}++.horizontal-bundle-header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0 2px 2px 2px;+ width: 100%;+ border: none;+ cursor: pointer;+ flex-shrink: 0;+}++.horizontal-bundle-header .bundle-collapse-hit {+ width: 26px;+ height: 26px;+ border-radius: 999px;+ color: rgba(255, 255, 255, 0.75);+ background: #141414;+ border: none;+ display: flex;+ align-items: center;+ justify-content: center;+ cursor: pointer;+ flex-shrink: 0;+ transition: background 0.15s ease, color 0.15s ease;+}++.horizontal-bundle-header .bundle-collapse-hit:hover {+ background: #1c1c1c;+ color: #fff;+}++.horizontal-bundle-header .actions-pill {+ display: flex;+ align-items: center;+ gap: 4px;+ padding: 2px 6px;+ background: #141414;+ border-radius: 999px;+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);+ flex-shrink: 0;+}++.horizontal-bundle-header .actions-pill .act {+ width: 22px;+ height: 22px;+ display: flex;+ align-items: center;+ justify-content: center;+ background: transparent;+ border: none;+ border-radius: 5px;+ color: rgba(255, 255, 255, 0.82);+ cursor: pointer;+ transition: all 0.14s ease;+}++.horizontal-bundle-header .actions-pill .act:hover {+ background: rgba(255, 255, 255, 0.14);+ color: #fff;+}++.horizontal-bundle-header .actions-pill .act.danger:hover {+ background: rgba(239, 68, 68, 0.25);+ color: #f87171;+}++.horizontal-subitem-track {+ display: flex;+ flex-direction: row;+ align-items: stretch;+ gap: 8px;+ overflow-x: auto;+ overflow-y: hidden;+ height: 94px;+ padding: 2px 2px 3px 2px;+ scroll-behavior: smooth;+}++/* Custom sleek scrollbar for horizontal sub-item track */+.horizontal-subitem-track::-webkit-scrollbar {+ height: 3px;+}+.horizontal-subitem-track::-webkit-scrollbar-track {+ background: transparent;+}+.horizontal-subitem-track::-webkit-scrollbar-thumb {+ background: rgba(255, 255, 255, 0.18);+ border-radius: 999px;+}+.horizontal-subitem-track::-webkit-scrollbar-thumb:hover {+ background: rgba(255, 255, 255, 0.32);+}++.horizontal-subitem-tile {+ flex-shrink: 0;+ width: 104px;+ height: 89px;+ background: #141414;+ border-radius: 12px;+ border: none;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: space-between;+ padding: 4px 6px 5px 6px;+ overflow: hidden;+ cursor: grab;+ position: relative;+ transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);+}++/* Edge-Drop signature 1px specular top highlight reflection */+.horizontal-subitem-tile::before {+ content: '';+ position: absolute;+ inset: 0;+ border-radius: inherit;+ pointer-events: none;+ z-index: 2;+ transition: opacity 0.14s ease;+ background: radial-gradient(+ ellipse 70% 1px at 50% 0%,+ rgba(255, 255, 255, 0.24) 0%,+ rgba(255, 255, 255, 0.06) 45%,+ transparent 80%+ ) top / 100% 1px no-repeat;+}++.horizontal-subitem-tile:hover {+ background: #1c1c1c;+ transform: translateY(-2px);+ box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);+}+.horizontal-subitem-tile:hover::before {+ opacity: 1.3;+}+.horizontal-subitem-tile:active {+ cursor: grabbing;+}++/* Hover Action Floating Micro-Pill */+.horizontal-subitem-actions {+ position: absolute;+ top: 4px;+ right: 4px;+ display: flex;+ align-items: center;+ gap: 2px;+ padding: 2px 4px;+ background: rgba(18, 18, 22, 0.92);+ backdrop-filter: blur(12px);+ -webkit-backdrop-filter: blur(12px);+ border: 1px solid rgba(255, 255, 255, 0.12);+ border-radius: 999px;+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.75);+ opacity: 0;+ pointer-events: none;+ transform: scale(0.9) translateY(-1px);+ transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1), transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);+ z-index: 5;+}++.horizontal-subitem-tile:hover .horizontal-subitem-actions,+.horizontal-subitem-tile:focus-within .horizontal-subitem-actions {+ opacity: 1;+ pointer-events: auto;+ transform: scale(1) translateY(0);+}++.horizontal-subitem-actions .act {+ width: 20px;+ height: 20px;+ display: flex;+ align-items: center;+ justify-content: center;+ background: transparent;+ border: none;+ border-radius: 4px;+ color: rgba(255, 255, 255, 0.82);+ cursor: pointer;+ transition: all 0.12s ease;+ padding: 0;+}++.horizontal-subitem-actions .act:hover {+ background: rgba(255, 255, 255, 0.16);+ color: #ffffff;+}++/* Icon / Thumbnail Wrap */+.horizontal-subitem-icon-wrap {+ width: 100%;+ height: 42px;+ display: flex;+ align-items: center;+ justify-content: center;+ flex-shrink: 0;+}++.horizontal-subitem-img {+ width: 40px;+ height: 40px;+ object-fit: cover;+ border-radius: 8px;+ display: block;+ user-select: none;+ pointer-events: none;+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);+}++.horizontal-subitem-icon-wrap svg {+ width: 36px;+ height: 36px;+ filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));+}++.horizontal-subitem-meta {+ display: flex;+ flex-direction: column;+ width: 100%;+ padding: 0 2px;+ gap: 1px;+ align-items: center;+ justify-content: center;+ min-width: 0;+}++.horizontal-subitem-name {+ width: 100%;+ font-size: 10.5px;+ font-weight: 500;+ color: rgba(255, 255, 255, 0.9);+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ text-align: center;+ line-height: 1.2;+}++.horizontal-subitem-sub {+ width: 100%;+ font-size: 9px;+ color: rgba(255, 255, 255, 0.45);+ font-family: var(--font-mono);+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ text-align: center;+ line-height: 1.2;+}++/* ==========================================================================+ Color Swatch Cards (Dynamic Color Background & Intelligent Contrast)+ ========================================================================== */++.item.is-color-card {+ background-color: var(--card-color) !important;+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);+ transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;+}++.item.is-color-card:hover {+ background-color: var(--card-color) !important;+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);+}++.item.is-color-card.pinned {+ background-color: var(--card-color) !important;+}++.item.is-color-card.pinned:hover {+ background-color: var(--card-color) !important;+}++.item.is-color-card .item-main {+ background: transparent !important;+}++.item.is-color-card .item-main:hover {+ background: transparent !important;+}++.item.is-color-card .item-footer {+ background: transparent !important;+}++/* Light color card contrast (black text, dark buttons, dark footer) */+.item.is-color-card.is-light-color::before {+ background:+ radial-gradient(+ ellipse 70% 1px at 50% 0%,+ rgba(255, 255, 255, 0.7) 0%,+ rgba(255, 255, 255, 0.25) 45%,+ transparent 80%+ ) top / 100% 1px no-repeat,+ linear-gradient(+ 90deg,+ transparent 0%,+ rgba(0, 0, 0, 0.08) 20%,+ rgba(0, 0, 0, 0.08) 80%,+ transparent 100%+ ) bottom / 100% 1px no-repeat;+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.10);+}++.item.is-color-card.is-light-color .color-swatch-code {+ color: #000000;+}++.item.is-color-card.is-light-color .item-footer,+.item.is-color-card.is-light-color .meta,+.item.is-color-card.is-light-color .meta-time,+.item.is-color-card.is-light-color .meta-detail,+.item.is-color-card.is-light-color .meta-hit-count {+ color: rgba(0, 0, 0, 0.62) !important;+}++.item.is-color-card.is-light-color .kind-badge {+ color: rgba(0, 0, 0, 0.62) !important;+ background: transparent !important;+}++.item.is-color-card.is-light-color .meta-hit-count {+ background: rgba(0, 0, 0, 0.08);+}++.item.is-color-card.is-light-color .meta-copied {+ color: #059669 !important;+}++/* Dark color card contrast (white text, light footer) */+.item.is-color-card.is-dark-color::before {+ box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);+}++.item.is-color-card.is-dark-color .color-swatch-code {+ color: #ffffff;+}++.item.is-color-card.is-dark-color .item-footer,+.item.is-color-card.is-dark-color .meta,+.item.is-color-card.is-dark-color .meta-time,+.item.is-color-card.is-dark-color .meta-detail,+.item.is-color-card.is-dark-color .meta-hit-count {+ color: rgba(255, 255, 255, 0.68) !important;+}++.item.is-color-card.is-dark-color .kind-badge {+ color: rgba(255, 255, 255, 0.68) !important;+ background: transparent !important;+}++.item.is-color-card.is-dark-color .meta-hit-count {+ background: rgba(255, 255, 255, 0.10);+}++.item.is-color-card.is-dark-color .meta-copied {+ color: #34d399 !important;+}++/* Swatch Layout */+.color-swatch-content {+ width: 100%;+ height: 100%;+ display: flex;+ flex-direction: column;+ justify-content: flex-end;+ box-sizing: border-box;+}++.color-swatch-code {+ font-family: var(--font-mono, 'Consolas', 'SF Mono', monospace);+ font-size: 16px;+ font-weight: 700;+ letter-spacing: 0.025em;+ line-height: 1.2;+ margin-bottom: 2px;+}++/* In horizontal mode: give breathing room above the code */+.list.horizontal .item.is-color-card .item-content {+ display: flex;+ flex-direction: column;+ justify-content: flex-end;+ padding-bottom: 0;+}++.list.horizontal .item.is-color-card .color-swatch-code {+ font-size: 17px;+ margin-bottom: 4px;+}++/* Split Drop Zone (detach from stack on drag) */+.split-dropzone {+ position: absolute;+ z-index: 120;+ display: flex;+ pointer-events: auto;+ box-sizing: border-box;+}++.split-dropzone.pos-top {+ top: 0;+ left: 0;+ right: 0;+ height: 52px;+}++.split-dropzone.pos-bottom {+ bottom: 0;+ left: 0;+ right: 0;+ height: 52px;+}++.split-dropzone.pos-left {+ top: 0;+ bottom: 0;+ left: 0;+ width: 80px;+}++.split-dropzone.pos-right {+ top: 0;+ bottom: 0;+ right: 0;+ width: 80px;+}++.split-dropzone .glow-line {+ position: absolute;+ pointer-events: none;+ background: linear-gradient(90deg, transparent, rgba(255, 120, 40, 0.9), transparent);+ box-shadow: 0 0 16px rgba(255, 120, 40, 0.7);+ transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);+}++.split-dropzone.pos-top .glow-line,+.split-dropzone.pos-bottom .glow-line {+ left: 10%;+ right: 10%;+ height: 2px;+}++.split-dropzone.pos-top .glow-line {+ top: 4px;+}++.split-dropzone.pos-bottom .glow-line {+ bottom: 4px;+}++.split-dropzone.pos-left .glow-line,+.split-dropzone.pos-right .glow-line {+ top: 10%;+ bottom: 10%;+ width: 2px;+ background: linear-gradient(180deg, transparent, rgba(255, 120, 40, 0.9), transparent);}++.split-dropzone.pos-left .glow-line {+ left: 4px;+}++.split-dropzone.pos-right .glow-line {+ right: 4px;+}++.split-dropzone.active .glow-line {+ background: linear-gradient(90deg, transparent, #ff7828, transparent);+ box-shadow: 0 0 24px #ff7828, 0 0 8px #ffffff;+}++.split-dropzone.pos-left.active .glow-line,+.split-dropzone.pos-right.active .glow-line {+ background: linear-gradient(180deg, transparent, #ff7828, transparent);+}+diff --git a/tests/colorUtils.test.ts b/tests/colorUtils.test.tsnew file mode 100644index 0000000..562352a--- /dev/null+++ b/tests/colorUtils.test.ts@@ -0,0 +1,81 @@+import { describe, expect, it } from 'vitest'+import { parseColor } from '../src/lib/colorUtils'++describe('colorUtils', () => {+ it('parses 6-digit hex colors and detects light vs dark contrast', () => {+ // Colors from user's actual screenshot+ const c1 = parseColor('#ebd5ad')+ expect(c1).not.toBeNull()+ expect(c1?.isLight).toBe(true)+ expect(c1?.secondaryText).toBe('rgb(235, 213, 173)')++ const c2 = parseColor('#c4cdec')+ expect(c2?.isLight).toBe(true)++ const c3 = parseColor('#f5c9e5')+ expect(c3?.isLight).toBe(true)++ const c4 = parseColor('#f8f6f7')+ expect(c4?.isLight).toBe(true)++ const c5 = parseColor('#e9d9bc')+ expect(c5?.isLight).toBe(true)++ // Dark teal from reference screenshot+ const darkTeal = parseColor('#006667')+ expect(darkTeal?.isLight).toBe(false)+ expect(darkTeal?.secondaryText).toBe('rgb(0, 102, 103)')++ // Peach from reference screenshot+ const peach = parseColor('#FFBAA7')+ expect(peach?.isLight).toBe(true)++ // Cyan from reference screenshot+ const cyan = parseColor('#00B7C6')+ expect(cyan?.isLight).toBe(false)++ // Pure black & white+ expect(parseColor('#000000')?.isLight).toBe(false)+ expect(parseColor('#ffffff')?.isLight).toBe(true)+ })++ it('parses 3-digit, 4-digit, and 8-digit hex', () => {+ const shortWhite = parseColor('#fff')+ expect(shortWhite?.isLight).toBe(true)+ expect(shortWhite?.r).toBe(255)++ const shortBlack = parseColor('#000')+ expect(shortBlack?.isLight).toBe(false)+ expect(shortBlack?.r).toBe(0)++ const alphaHex = parseColor('#ffffff80')+ expect(alphaHex).not.toBeNull()+ expect(alphaHex?.a).toBeCloseTo(0.5, 1)+ })++ it('parses rgb and rgba strings', () => {+ const rgb = parseColor('rgb(255, 240, 229)')+ expect(rgb?.isLight).toBe(true)+ expect(rgb?.secondaryText).toBe('#fff0e5')++ const darkRgb = parseColor('rgb(10, 10, 10)')+ expect(darkRgb?.isLight).toBe(false)++ const rgba = parseColor('rgba(255, 255, 255, 0.8)')+ expect(rgba?.isLight).toBe(true)+ })++ it('parses hsl strings', () => {+ const hsl = parseColor('hsl(210, 50%, 40%)')+ expect(hsl).not.toBeNull()+ expect(hsl?.isLight).toBe(false)+ })++ it('returns null for non-color strings', () => {+ expect(parseColor('hello world')).toBeNull()+ expect(parseColor('https://example.com')).toBeNull()+ expect(parseColor('123456')).toBeNull()+ expect(parseColor('#xyz')).toBeNull()+ expect(parseColor('')).toBeNull()+ })+})diff --git a/tests/emojiCatalog.test.ts b/tests/emojiCatalog.test.tsindex 8653bbc..2ca3c6f 100644--- a/tests/emojiCatalog.test.ts+++ b/tests/emojiCatalog.test.ts@@ -136,3 +136,20 @@ describe('emoji asset protocol', () => {expect(dir.replace(/\\/g, '/')).toBe('C:/res/emoji/64')})})++describe('horizontal emoji picker layout calculations', () => {+ it('calculates responsive columns matching horizontal viewport width', () => {+ const calcCols = (viewW: number, isHorizontal: boolean) => {+ if (!isHorizontal) return 7+ if (viewW <= 0) return 24+ return Math.max(8, Math.floor((viewW - 16) / 36))+ }++ expect(calcCols(0, false)).toBe(7)+ expect(calcCols(300, false)).toBe(7)+ expect(calcCols(0, true)).toBe(24)+ expect(calcCols(1000, true)).toBe(27)+ expect(calcCols(720, true)).toBe(19)+ expect(calcCols(1440, true)).toBe(39)+ })+})diff --git a/tests/stackFeatures.test.ts b/tests/stackFeatures.test.tsnew file mode 100644index 0000000..0fed0ac--- /dev/null+++ b/tests/stackFeatures.test.ts@@ -0,0 +1,116 @@+import { describe, it, expect } from 'vitest'+import { readFileSync } from 'node:fs'+import { resolve } from 'node:path'++function read(relPath: string): string {+ return readFileSync(resolve(__dirname, '..', relPath), 'utf8')+}++describe('Stack Features: SVG Folder Silhouette, Sizing, Horizontal Expansion & Detach Zone', () => {+ it('CustomFileIcon.tsx exports FileStackPhoto with SVG folder silhouette mask', () => {+ const src = read('src/components/CustomFileIcon.tsx')+ expect(src).toContain('export function FileStackPhoto')+ expect(src).toContain('FILE_ICON_MASK')+ expect(src).toContain('maskImage: FILE_ICON_MASK')+ })++ it('ClipboardItem.tsx uses FileStackPhoto for image stacks with responsive photoSize', () => {+ const src = read('src/components/ClipboardItem.tsx')+ expect(src).toContain('<FileStackPhoto src={img.preview} width={photoSize} height={photoSize} />')+ expect(src).toContain('photoSize = isHorizontal ? 76 : 124')+ expect(src).toContain('HorizontalBundleExpanded')+ })++ it('ClipboardItem.tsx does not introduce an intrusive merge-target indicator overlay', () => {+ const src = read('src/components/ClipboardItem.tsx')+ expect(src).not.toContain('merge-target-indicator')+ expect(src).not.toContain('item.stack')+ expect(src).not.toContain('isDragOverTarget')+ })++ it('ClipboardItem.tsx provides copy and ungroup hover actions on horizontal subitems with clean header', () => {+ const src = read('src/components/ClipboardItem.tsx')+ expect(src).toContain('horizontal-subitem-actions')+ expect(src).toContain('subitem-copy-btn')+ expect(src).toContain('subitem-delete-btn')+ // Header should be minimal: no collection name label, no capacity badge (e.g. 3 / 10)+ const expandedSection = src.slice(src.indexOf('function HorizontalBundleExpanded'), src.indexOf('function BundleFluidPreview'))+ expect(expandedSection).not.toContain('bundle-actions-label')+ expect(expandedSection).not.toContain('bundle-capacity')+ expect(expandedSection).not.toContain('MAX_STACK')+ // Minus / ungroup button in subitem should not have danger class+ expect(expandedSection).not.toContain('subitem-delete-btn danger')+ })++ it('ClipboardItem.tsx calculates dynamic width for horizontally expanded stacks', () => {+ const src = read('src/components/ClipboardItem.tsx')+ expect(src).toContain('expandedWidth')+ expect(src).toContain('expanded && isHorizontal')+ expect(src).toContain('bundleCount')+ })++ it('Panel.tsx passes stickPosition to SplitDropZone for all 4 orientations without text pill', () => {+ const src = read('src/components/Panel.tsx')+ expect(src).toContain('SplitDropZone stickPosition={settings.stickPosition')+ expect(src).toContain('pos-${stickPosition}')+ expect(src).toContain("isTop = stickPosition === 'top'")+ expect(src).toContain("isBottom = stickPosition === 'bottom'")+ // Text pill must NOT be introduced into SplitDropZone+ expect(src).not.toContain('split-dropzone-pill')+ })++ it('item.css includes styles for orientation-aware split-dropzone and no split-dropzone-pill', () => {+ const css = read('src/styles/item.css')+ expect(css).toContain('.split-dropzone.pos-top')+ expect(css).toContain('.split-dropzone.pos-bottom')+ expect(css).toContain('.split-dropzone.pos-left')+ expect(css).toContain('.split-dropzone.pos-right')+ expect(css).not.toContain('.split-dropzone-pill')+ expect(css).not.toContain('.merge-target-indicator')+ })++ it('item.css includes clean header without divider and subitem actions without red danger hover', () => {+ const css = read('src/styles/item.css')+ expect(css).toContain('.list.horizontal .item.is-expanded')+ expect(css).toContain('.horizontal-bundle-expanded')+ expect(css).toContain('.horizontal-bundle-header')+ // No divider border on horizontal header+ const headerCss = css.slice(css.indexOf('.horizontal-bundle-header {'), css.indexOf('.horizontal-bundle-header .bundle-collapse-hit'))+ expect(headerCss).not.toContain('border-bottom')+ expect(css).toContain('.horizontal-subitem-track')+ expect(css).toContain('.horizontal-subitem-tile')+ expect(css).toContain('.horizontal-subitem-tile::before')+ expect(css).toContain('.horizontal-subitem-actions')+ // No red hover effect on subitem ungroup / delete button+ expect(css).not.toContain('.horizontal-subitem-actions .subitem-delete-btn:hover')+ expect(css).not.toContain('.horizontal-subitem-actions .act.danger:hover')+ expect(css).toContain('.horizontal-subitem-icon-wrap')+ expect(css).toContain('.horizontal-subitem-meta')+ })++ it('ClipboardItem.tsx uses ChevronLeftIcon pointing to left for horizontal stack collapse', () => {+ const src = read('src/components/ClipboardItem.tsx')+ const expandedSection = src.slice(src.indexOf('function HorizontalBundleExpanded'), src.indexOf('function BundleFluidPreview'))+ expect(expandedSection).toContain('<ChevronLeftIcon />')+ expect(expandedSection).not.toContain('<ChevronUpIcon />')+ })++ it('ItemList.tsx isolates scroll positions per filter page so tabs are not synchronized', () => {+ const src = read('src/components/ItemList.tsx')+ expect(src).toContain('filterScrollMap')+ expect(src).toContain('prevFilterRef')+ expect(src).toContain('filterScrollMap.current[prevFilterRef.current]')+ expect(src).toContain('filterScrollMap.current[typeFilter]')+ })++ it('item.css vertically centers and frames images in horizontal dock mode', () => {+ const css = read('src/styles/item.css')+ expect(css).toContain('.list.horizontal .item.is-image .item-content')+ expect(css).toContain('.list.horizontal .thumb-wrap')+ expect(css).toContain('.list.horizontal .thumb')+ const thumbCss = css.slice(css.indexOf('.list.horizontal .thumb {'), css.indexOf('.list.horizontal .item:hover .thumb'))+ expect(thumbCss).toContain('max-height: 100px')+ expect(thumbCss).toContain('box-shadow')+ expect(thumbCss).toContain('object-fit: contain')+ })+})