Speed up downloads by combining multiple network connections in parallel
TypeScript bandwidth-aggregationcross-platformdesktop-appdownloaderdownloadmanagerlinuxmacosmulticonnectionparallel-downloadswindows
Rework network edit popover around distinct auto-assigned colors
Anmol Kapil43c396fc63e6
diff --git a/src/renderer/src/components/NetworkCard.tsx b/src/renderer/src/components/NetworkCard.tsxindex 8d6088f..b9cb416 100644--- a/src/renderer/src/components/NetworkCard.tsx+++ b/src/renderer/src/components/NetworkCard.tsx@@ -1,13 +1,7 @@import type { NetworkInterfaceInfo } from '@shared/types'-import { Pencil } from 'lucide-react'-import { useState } from 'react'-import { useAppStore } from '../store/useAppStore'-import { resolveNetworkVisual, type NetworkColorId } from '../theme'+import { useNetworkVisuals } from '../hooks/useNetworkVisuals'import { ColorBadge } from './ColorBadge'-import { NetworkEditorFields } from './NetworkEditorFields'-import { Button } from './ui/button'-import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'-import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'+import { NetworkEditPopover } from './NetworkEditPopover'interface NetworkCardProps {iface: NetworkInterfaceInfo@@ -46,10 +40,7 @@ export function NetworkCard({latencyMs,onToggle}: NetworkCardProps): React.JSX.Element {- const [editing, setEditing] = useState(false)- const preference = useAppStore((store) => store.networkPreferences[iface.id])- const setNetworkPreference = useAppStore((store) => store.setNetworkPreference)- const visual = resolveNetworkVisual(iface.kind, iface.displayName, preference)+ const visual = useNetworkVisuals()(iface.id, iface.kind, iface.displayName)const online = latencyMs != nullreturn (@@ -78,39 +69,11 @@ export function NetworkCard({{visual.name}</div></button>- <Popover open={editing} onOpenChange={setEditing}>- <Tooltip>- <TooltipTrigger- render={- <PopoverTrigger- render={- <Button- type="button"- variant="ghost"- size="icon-xs"- aria-label="Rename or recolor this network"- className="shrink-0 text-muted-foreground"- >- <Pencil className="size-3" />- </Button>- }- />- }- />- <TooltipContent>Rename or recolor this network</TooltipContent>- </Tooltip>- <PopoverContent className="w-[276px]">- <NetworkEditorFields- name={preference?.customName ?? ''}- onNameChange={(customName) => setNetworkPreference(iface.id, { customName })}- namePlaceholder={iface.displayName}- colorId={preference?.colorId as NetworkColorId | undefined}- onColorSelect={(colorId) => setNetworkPreference(iface.id, { colorId })}- interfaceKind={iface.kind}- onDone={() => setEditing(false)}- />- </PopoverContent>- </Popover>+ <NetworkEditPopover+ interfaceId={iface.id}+ interfaceKind={iface.kind}+ osName={iface.displayName}+ /></div><ColorBadgebg={selected ? visual.bg : 'transparent'}diff --git a/src/renderer/src/components/NetworkEditPopover.tsx b/src/renderer/src/components/NetworkEditPopover.tsxnew file mode 100644index 0000000..c9d8a5f--- /dev/null+++ b/src/renderer/src/components/NetworkEditPopover.tsx@@ -0,0 +1,138 @@+import type { NetworkInterfaceKind } from '@shared/types'+import { Pencil } from 'lucide-react'+import { useState } from 'react'+import { useNetworkVisuals } from '../hooks/useNetworkVisuals'+import { useAppStore } from '../store/useAppStore'+import { NETWORK_COLOR_SWATCHES, type NetworkColorId } from '../theme'+import { Button } from './ui/button'+import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'+import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'++interface NetworkEditPopoverProps {+ interfaceId: string+ interfaceKind: NetworkInterfaceKind+ osName: string+}++const fieldLabelClass =+ 'font-mono text-[9px] leading-none font-medium tracking-[0.12em] text-muted-foreground uppercase'++/** Rename/recolor one network. Edits are a draft that's saved when the popover closes — Done,+ * Enter or clicking away — and thrown away on Escape, like renaming a file in Finder. */+export function NetworkEditPopover({+ interfaceId,+ interfaceKind,+ osName+}: NetworkEditPopoverProps): React.JSX.Element {+ const [open, setOpen] = useState(false)+ const preference = useAppStore((store) => store.networkPreferences[interfaceId])+ const setNetworkPreference = useAppStore((store) => store.setNetworkPreference)+ const visual = useNetworkVisuals()(interfaceId, interfaceKind, osName)++ const [draftName, setDraftName] = useState('')+ const [draftColorId, setDraftColorId] = useState<NetworkColorId>(visual.colorId)++ function save(): void {+ const trimmed = draftName.trim()+ const customName = trimmed && trimmed !== osName ? trimmed : undefined+ // Re-picking the color it already had keeps it automatic instead of pinning it.+ const colorId = draftColorId === visual.colorId ? preference?.colorId : draftColorId+ if (customName !== preference?.customName || colorId !== preference?.colorId) {+ void setNetworkPreference(interfaceId, { customName, colorId })+ }+ }++ function close(): void {+ save()+ setOpen(false)+ }++ return (+ <Popover+ open={open}+ onOpenChange={(next, details) => {+ if (next) {+ setDraftName(visual.name)+ setDraftColorId(visual.colorId)+ } else if (details.reason !== 'escape-key') {+ save()+ }+ setOpen(next)+ }}+ >+ <Tooltip>+ <TooltipTrigger+ render={+ <PopoverTrigger+ render={+ <Button+ type="button"+ variant="ghost"+ size="icon-xs"+ aria-label="Rename or recolor this network"+ className="shrink-0 text-muted-foreground"+ >+ <Pencil className="size-3" />+ </Button>+ }+ />+ }+ />+ <TooltipContent>Rename or recolor this network</TooltipContent>+ </Tooltip>+ <PopoverContent aria-label={`Edit ${visual.name}`} className="gap-3 p-3">+ <div className="flex flex-col gap-[6px]">+ <label htmlFor={`network-name-${interfaceId}`} className={fieldLabelClass}>+ Name+ </label>+ <input+ id={`network-name-${interfaceId}`}+ type="text"+ value={draftName}+ onChange={(event) => setDraftName(event.target.value)}+ onFocus={(event) => event.target.select()}+ onKeyDown={(event) => {+ if (event.key === 'Enter') close()+ }}+ placeholder={osName}+ autoFocus+ className="rounded-[6px] border border-input bg-background px-[9px] py-1.5 font-sans text-[12px] leading-[1.3] font-medium text-foreground outline-none focus-visible:border-ring"+ />+ </div>++ <div className="flex flex-col gap-[6px]">+ <span className={fieldLabelClass}>Color</span>+ <div className="flex items-center justify-between px-1 py-1">+ {NETWORK_COLOR_SWATCHES.map((swatch) => {+ const isSelected = draftColorId === swatch.id+ return (+ <button+ key={swatch.id}+ type="button"+ onClick={() => setDraftColorId(swatch.id)}+ title={swatch.label}+ aria-label={swatch.label}+ aria-pressed={isSelected}+ className="size-5 shrink-0 rounded-full border-none p-0"+ style={{+ background: swatch.solid,+ // Popover-colored gap, then a ring in the swatch's own hue — reads in both themes.+ boxShadow: isSelected+ ? `0 0 0 2px var(--color-popover), 0 0 0 4px ${swatch.solid}`+ : undefined+ }}+ />+ )+ })}+ </div>+ </div>++ <div className="flex justify-end">+ <Button type="button" size="xs" onClick={close}>+ Done+ </Button>+ </div>+ </PopoverContent>+ </Popover>+ )+}diff --git a/src/renderer/src/components/NetworkEditorFields.tsx b/src/renderer/src/components/NetworkEditorFields.tsxdeleted file mode 100644index 7e155b9..0000000--- a/src/renderer/src/components/NetworkEditorFields.tsx+++ /dev/null@@ -1,128 +0,0 @@-import type { NetworkInterfaceKind } from '@shared/types'-import { useRef } from 'react'-import { NETWORK_COLOR_SWATCHES, resolveNetworkVisual, type NetworkColorId } from '../theme'-import { Button } from './ui/button'--export interface NetworkEditorFieldsProps {- name: string- onNameChange: (name: string) => void- namePlaceholder: string- colorId: NetworkColorId | undefined- onColorSelect: (colorId: NetworkColorId | undefined) => void- interfaceKind: NetworkInterfaceKind- onDone: () => void-}--const fieldLabelClass =- 'font-mono text-[9px] leading-none font-medium tracking-[0.12em] text-muted-foreground uppercase'--/** Rename + recolor fields for a physical network, rendered inside a shadcn `PopoverContent` (see- * NetworkCard) — real-time preview and keyboard support, positioning/portal/dismissal all handled- * by the Popover primitive rather than by hand here. */-export function NetworkEditorFields({- name,- onNameChange,- namePlaceholder,- colorId,- onColorSelect,- interfaceKind,- onDone-}: NetworkEditorFieldsProps): React.JSX.Element {- const inputRef = useRef<HTMLInputElement>(null)-- const previewVisual = resolveNetworkVisual(interfaceKind, namePlaceholder, {- customName: name,- colorId- })-- return (- <div className="flex flex-col gap-[11px]">- <div className="font-mono text-[9.5px] leading-none font-semibold tracking-[0.14em] text-muted-foreground uppercase">- Edit Network- </div>-- <div className="flex flex-col gap-[5px]">- <label htmlFor="network-display-name" className={fieldLabelClass}>- Display Name- </label>- <input- ref={inputRef}- id="network-display-name"- type="text"- value={name}- onChange={(event) => onNameChange(event.target.value)}- onKeyDown={(event) => {- if (event.key === 'Enter') onDone()- }}- placeholder={namePlaceholder}- autoFocus- className="rounded-[6px] border border-input bg-background px-[9px] py-1.5 font-sans text-[12px] leading-[1.3] font-medium text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50"- />- </div>-- <div className="flex flex-col gap-[6px]">- <div className="flex items-center justify-between">- <span className={fieldLabelClass}>Color</span>- {colorId && (- <button- type="button"- onClick={() => onColorSelect(undefined)}- className="border-none bg-transparent p-0 font-mono text-[9.5px] leading-none font-medium text-primary"- >- Reset to default- </button>- )}- </div>- <div className="flex items-center gap-[7px] py-0.5">- <button- type="button"- onClick={() => onColorSelect(undefined)}- title="Default color for this network kind"- aria-label="Default color for this network kind"- aria-pressed={!colorId}- className={`flex size-6 shrink-0 items-center justify-center rounded-full bg-background p-0 ${- !colorId ? 'border-2 border-foreground' : 'border border-input'- }`}- >- <span className="text-[9px] leading-none text-muted-foreground">✕</span>- </button>- {NETWORK_COLOR_SWATCHES.map((swatch) => {- const isSelected = colorId === swatch.id- return (- <button- key={swatch.id}- type="button"- onClick={() => onColorSelect(swatch.id)}- title={swatch.label}- aria-label={swatch.label}- aria-pressed={isSelected}- className={`size-6 shrink-0 rounded-full p-0 ${- isSelected ? 'scale-110 border-2 border-foreground' : 'border border-transparent'- }`}- style={{ background: swatch.solid }}- />- )- })}- </div>- </div>-- <div className="mt-0.5 flex items-center justify-between border-t-[0.5px] border-border pt-2">- <div className="flex min-w-0 items-center gap-[6px]">- <div- className="size-[7px] shrink-0 rounded-full"- style={{ background: previewVisual.solid }}- />- <span- className="max-w-[155px] truncate font-sans text-[11px] leading-none font-semibold"- style={{ color: previewVisual.text }}- >- {previewVisual.name}- </span>- </div>- <Button type="button" size="xs" onClick={onDone}>- Done- </Button>- </div>- </div>- )-}diff --git a/src/renderer/src/components/NetworkRow.tsx b/src/renderer/src/components/NetworkRow.tsxindex bffa6a1..8686bfd 100644--- a/src/renderer/src/components/NetworkRow.tsx+++ b/src/renderer/src/components/NetworkRow.tsx@@ -1,19 +1,11 @@import { useState } from 'react'-import { Pencil } from 'lucide-react'-import { useAppStore } from '../store/useAppStore'+import { useNetworkVisuals } from '../hooks/useNetworkVisuals'import type { BlockState } from '@shared/types'-import {- DANGER,- NETWORK_ROW_GRID_COLUMNS,- resolveNetworkVisual,- type NetworkColorId-} from '../theme'+import { DANGER, NETWORK_ROW_GRID_COLUMNS } from '../theme'import type { NetworkGroup } from '../utils/format'import { formatBytes, formatSpeed } from '../utils/format'import { ColorBadge } from './ColorBadge'-import { NetworkEditorFields } from './NetworkEditorFields'-import { Button } from './ui/button'-import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'+import { NetworkEditPopover } from './NetworkEditPopover'interface NetworkRowProps {group: NetworkGroup@@ -29,11 +21,8 @@ export function NetworkRow({totalBytes,blocks}: NetworkRowProps): React.JSX.Element {- const [editing, setEditing] = useState(false)const [expanded, setExpanded] = useState(false)- const preference = useAppStore((store) => store.networkPreferences[group.interfaceId])- const setNetworkPreference = useAppStore((store) => store.setNetworkPreference)- const visual = resolveNetworkVisual(group.interfaceKind, group.interfaceLabel, preference)+ const visual = useNetworkVisuals()(group.interfaceId, group.interfaceKind, group.interfaceLabel)const hasError = group.chunks.some((chunk) => chunk.status === 'error')const isActive = group.chunks.some((chunk) => chunk.status === 'downloading')@@ -64,33 +53,11 @@ export function NetworkRow({>{visual.name}</span>- <Popover open={editing} onOpenChange={setEditing}>- <PopoverTrigger- render={- <Button- type="button"- variant="ghost"- size="icon-xs"- title="Rename or recolor this network"- aria-label="Rename or recolor this network"- className="shrink-0 text-muted-foreground"- >- <Pencil className="size-3" />- </Button>- }- />- <PopoverContent className="w-[276px]">- <NetworkEditorFields- name={preference?.customName ?? ''}- onNameChange={(customName) => setNetworkPreference(group.interfaceId, { customName })}- namePlaceholder={group.interfaceLabel}- colorId={preference?.colorId as NetworkColorId | undefined}- onColorSelect={(colorId) => setNetworkPreference(group.interfaceId, { colorId })}- interfaceKind={group.interfaceKind}- onDone={() => setEditing(false)}- />- </PopoverContent>- </Popover>+ <NetworkEditPopover+ interfaceId={group.interfaceId}+ interfaceKind={group.interfaceKind}+ osName={group.interfaceLabel}+ /><buttontype="button"onClick={() => setExpanded((v) => !v)}diff --git a/src/renderer/src/hooks/useNetworkVisuals.ts b/src/renderer/src/hooks/useNetworkVisuals.tsnew file mode 100644index 0000000..4bbb192--- /dev/null+++ b/src/renderer/src/hooks/useNetworkVisuals.ts@@ -0,0 +1,27 @@+import type { NetworkInterfaceKind } from '@shared/types'+import { useAppStore } from '../store/useAppStore'+import { assignNetworkColors, resolveNetworkVisual, type NetworkVisual } from '../theme'++export type ResolveNetworkVisual = (+ id: string,+ kind: NetworkInterfaceKind,+ osName: string+) => NetworkVisual++/** Colors are assigned across every known network at once (detected interfaces plus any in the+ * current download), so each screen agrees on which network is which color. */+export function useNetworkVisuals(): ResolveNetworkVisual {+ const interfaces = useAppStore((store) => store.interfaces)+ const chunks = useAppStore((store) => store.currentDownload?.chunks)+ const preferences = useAppStore((store) => store.networkPreferences)++ const networks = new Map<string, NetworkInterfaceKind>()+ for (const iface of interfaces) networks.set(iface.id, iface.kind)+ for (const chunk of chunks ?? []) {+ if (!networks.has(chunk.interfaceId)) networks.set(chunk.interfaceId, chunk.interfaceKind)+ }+ const colors = assignNetworkColors(networks, preferences)++ return (id, kind, osName) =>+ resolveNetworkVisual(kind, osName, preferences[id], colors.get(id) ?? 'teal')+}diff --git a/src/renderer/src/screens/CompleteScreen.tsx b/src/renderer/src/screens/CompleteScreen.tsxindex e9e32a2..9fd3c2c 100644--- a/src/renderer/src/screens/CompleteScreen.tsx+++ b/src/renderer/src/screens/CompleteScreen.tsx@@ -3,8 +3,8 @@ import type { DownloadState } from '@shared/types'import { CyclableChip } from '../components/CyclableChip'import { ThroughputChart } from '../components/ThroughputChart'import { Button } from '../components/ui/button'+import { useNetworkVisuals } from '../hooks/useNetworkVisuals'import { useAppStore } from '../store/useAppStore'-import { resolveNetworkVisual } from '../theme'import {dirnameOf,formatBytes,@@ -29,7 +29,7 @@ export function CompleteScreen({const homeDir = useAppStore((store) => store.homeDir)const peakSpeedBytesPerSec = useAppStore((store) => store.peakSpeedBytesPerSec)const speedHistoryByInterface = useAppStore((store) => store.speedHistoryByInterface)- const networkPreferences = useAppStore((store) => store.networkPreferences)+ const networkVisual = useNetworkVisuals()const finalSize = download.totalBytes || download.bytesDownloaded// completedAt is always set by the time a download reaches 'completed' — the@@ -39,11 +39,7 @@ export function CompleteScreen({const groups = groupChunksByInterface(download.chunks)const visuals = groups.map((group) =>- resolveNetworkVisual(- group.interfaceKind,- group.interfaceLabel,- networkPreferences[group.interfaceId]- )+ networkVisual(group.interfaceId, group.interfaceKind, group.interfaceLabel))const totalWeight = groups.reduce((sum, group) => sum + group.bytesDownloaded, 0) || 1const totalRetries = download.chunks.reduce((sum, chunk) => sum + chunk.retryCount, 0)diff --git a/src/renderer/src/screens/DownloadingScreen.tsx b/src/renderer/src/screens/DownloadingScreen.tsxindex ef859be..ebdbf21 100644--- a/src/renderer/src/screens/DownloadingScreen.tsx+++ b/src/renderer/src/screens/DownloadingScreen.tsx@@ -8,8 +8,9 @@ import { NetworkRow } from '../components/NetworkRow'import { ThroughputChart } from '../components/ThroughputChart'import { Button } from '../components/ui/button'import { useNetworkPolling } from '../hooks/useNetworkPolling'+import { useNetworkVisuals } from '../hooks/useNetworkVisuals'import { useAppStore } from '../store/useAppStore'-import { NETWORK_ROW_GRID_COLUMNS, resolveNetworkVisual } from '../theme'+import { NETWORK_ROW_GRID_COLUMNS } from '../theme'import {dirnameOf,fileExtensionBadge,@@ -60,7 +61,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Reconst speedHistory = useAppStore((store) => store.speedHistory)const speedHistoryByInterface = useAppStore((store) => store.speedHistoryByInterface)const peakSpeedBytesPerSec = useAppStore((store) => store.peakSpeedBytesPerSec)- const networkPreferences = useAppStore((store) => store.networkPreferences)+ const networkVisual = useNetworkVisuals()const isPaused = download.status === 'paused'const isAssembling = download.status === 'assembling'const percent = formatPercent(download.bytesDownloaded, download.totalBytes)@@ -123,11 +124,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Reconst groups = groupChunksByInterface(download.chunks)const totalDownloadedByNetworks = groups.reduce((sum, g) => sum + g.bytesDownloaded, 0)const visuals = groups.map((group) =>- resolveNetworkVisual(- group.interfaceKind,- group.interfaceLabel,- networkPreferences[group.interfaceId]- )+ networkVisual(group.interfaceId, group.interfaceKind, group.interfaceLabel))const activeGroups = groups.filter((group) =>group.chunks.some((chunk) => chunk.status === 'downloading')diff --git a/src/renderer/src/theme.ts b/src/renderer/src/theme.tsindex e410489..4874fcc 100644--- a/src/renderer/src/theme.ts+++ b/src/renderer/src/theme.ts@@ -1,4 +1,4 @@-import type { NetworkInterfaceKind, NetworkPreference } from '@shared/types'+import type { NetworkInterfaceKind, NetworkPreference, NetworkPreferences } from '@shared/types'interface KindPalette {solid: string@@ -61,6 +61,13 @@ export const NETWORK_COLOR_SWATCHES = [export type NetworkColorId = (typeof NETWORK_COLOR_SWATCHES)[number]['id']+/** Whether a persisted colorId still names one of the current swatches — a stale id (from a+ * removed swatch, or corrupted storage) must fall back to the kind default rather than be+ * trusted as-is. */+export function isValidNetworkColorId(id: string | undefined): id is NetworkColorId {+ return NETWORK_COLOR_SWATCHES.some((swatch) => swatch.id === id)+}+/** Derives a full surface set (bg/border/text) from a swatch's one solid color, tinted against* the ambient theme — same trick as the kind palette, just computed at runtime since these* colors are picked by the user rather than baked into the design. */@@ -71,25 +78,70 @@ function tint(source: string, amount: number, base = 'var(--bg-secondary)'): strexport interface NetworkVisual extends KindPalette {/** The network's effective display name — the user's custom name if set, else the OS one. */name: string+ colorId: NetworkColorId+}++// The swatch each kind's palette is tuned from (same hex in dark mode). Bridge/other have no+// hue of their own — neutral grey reads as "offline" in charts — so they always take a free one.+const KIND_SWATCH: Record<NetworkInterfaceKind, NetworkColorId | undefined> = {+ wifi: 'teal',+ usb: 'amber',+ ethernet: 'steel',+ bridge: undefined,+ other: undefined+}++/** Gives every network exactly one color, distinct from the others while swatches last: a+ * user-picked color always wins, then each network gets its kind's hue if still free, then the+ * first unused swatch — so two USB phones never both render amber. */+export function assignNetworkColors(+ networks: Map<string, NetworkInterfaceKind>,+ preferences: NetworkPreferences+): Map<string, NetworkColorId> {+ // ponytail: ordered by id, so plugging in a same-kind network can shift an unpinned one's color.+ const ids = [...networks.keys()].sort()+ const colors = new Map<string, NetworkColorId>()+ const used = new Set<NetworkColorId>()+ const take = (id: string, color: NetworkColorId): void => {+ colors.set(id, color)+ used.add(color)+ }++ for (const id of ids) {+ const pinned = preferences[id]?.colorId+ if (isValidNetworkColorId(pinned)) take(id, pinned)+ }+ for (const id of ids) {+ const kindColor = KIND_SWATCH[networks.get(id)!]+ if (!colors.has(id) && kindColor && !used.has(kindColor)) take(id, kindColor)+ }+ for (const id of ids) {+ if (colors.has(id)) continue+ const free = NETWORK_COLOR_SWATCHES.find((swatch) => !used.has(swatch.id))?.id+ take(id, free ?? KIND_SWATCH[networks.get(id)!] ?? NETWORK_COLOR_SWATCHES[0].id)+ }+ return colors}-/** Resolves what a physical network should actually look like in the UI: its kind's default- * palette, unless the user picked a custom color for this specific interface id, and its OS- * display name, unless the user gave it a friendlier one (e.g. "feth0" -> "iPhone Hotspot"). */+/** What a network looks like given its assigned color (see assignNetworkColors): the kind's+ * hand-tuned light/dark palette when the color is the kind's own hue, a tint of the swatch+ * otherwise. Name is the user's custom one, else the OS one (e.g. "feth0" -> "iPhone Hotspot"). */export function resolveNetworkVisual(kind: NetworkInterfaceKind,fallbackName: string,- preference: NetworkPreference | undefined+ preference: NetworkPreference | undefined,+ colorId: NetworkColorId): NetworkVisual {const name = preference?.customName?.trim() || fallbackNameconst kindPalette = KIND_PALETTE[kind]- const swatch = NETWORK_COLOR_SWATCHES.find((entry) => entry.id === preference?.colorId)+ const swatch = NETWORK_COLOR_SWATCHES.find((entry) => entry.id === colorId)!- if (!swatch) {- return { ...kindPalette, name }+ if (colorId === KIND_SWATCH[kind]) {+ return { ...kindPalette, name, colorId }}return {+ colorId,solid: swatch.solid,bg: tint(swatch.solid, 16),border: tint(swatch.solid, 42, 'var(--border-strong)'),