Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

ui: select several projects/images to remove, straight timeline, window polish

Gabriele Lozuponeadb112bdf491
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 9838c5e..cb7bfed 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -18,8 +18,8 @@
"title": "Kokon",
"width": 1320,
"height": 880,
- "minWidth": 880,
- "minHeight": 620,
+ "minWidth": 960,
+ "minHeight": 660,
"center": true,
"visible": false,
"dragDropEnabled": true,
diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json
index c661bc9..56368b1 100644
--- a/src-tauri/tauri.macos.conf.json
+++ b/src-tauri/tauri.macos.conf.json
@@ -6,8 +6,8 @@
"title": "Kokon",
"width": 1320,
"height": 880,
- "minWidth": 880,
- "minHeight": 620,
+ "minWidth": 960,
+ "minHeight": 660,
"center": true,
"visible": false,
"dragDropEnabled": true,
@@ -16,7 +16,7 @@
"hiddenTitle": true,
"trafficLightPosition": {
"x": 18,
- "y": 20
+ "y": 28
}
}
]
diff --git a/src/App.tsx b/src/App.tsx
index 617cb42..ed2f124 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -13,7 +13,7 @@ import { Gallery } from "./components/Gallery";
import { InpaintEditor } from "./components/InpaintEditor";
import { Settings as SettingsDialog } from "./components/Settings";
import { Setup } from "./components/Setup";
-import { ProjectTitle, Sidebar } from "./components/Sidebar";
+import { ProjectTitle, Sidebar, Wordmark } from "./components/Sidebar";
import { Stage } from "./components/Stage";
import { Tour } from "./components/Tour";
import { IconButton } from "./components/ui";
@@ -373,6 +373,7 @@ export default function App() {
<div className="workspace">
<div className="topbar" data-tauri-drag-region>
<div className="brand" data-tauri-drag-region>
+ {(!sidebar || needsSetup) && <Wordmark />}
{!sidebar && !needsSetup && (
<>
<IconButton title="Show sidebar" onClick={() => setState({ sidebar: true })}>
diff --git a/src/components/Composer.tsx b/src/components/Composer.tsx
index 3094101..88c4134 100644
--- a/src/components/Composer.tsx
+++ b/src/components/Composer.tsx
@@ -131,10 +131,10 @@ function ModeSwitch({ editing }: { editing: boolean }) {
return (
<div className="mode-switch" role="radiogroup" aria-label="What the prompt does">
<button className={editing ? "" : "on"} role="radio" aria-checked={!editing} onClick={() => editing && startNewImage()} title="Make a new image from the prompt alone; your images stay in the timeline">
- <Sparkles size={14} /> New image
+ <Sparkles size={14} /> <span className="lbl">New image</span>
</button>
<button className={editing ? "on" : ""} role="radio" aria-checked={editing} onClick={() => !editing && editShownImage()} title={editing ? "The prompt edits this image" : `Edit ${name}, the image shown`}>
- <Pencil size={14} /> Edit image
+ <Pencil size={14} /> <span className="lbl">Edit image</span>
</button>
</div>
);
@@ -182,7 +182,7 @@ function TargetBar() {
<span className="spacer" />
<span className="tool-group">
<button className={`tool ${c.mask ? "on" : ""}`} data-tour="paint" onClick={() => setState({ overlay: "inpaint" })} title="Paint the area to change; the rest stays as it is">
- <Brush size={14} /> {c.mask ? "Area painted" : "Paint area"}
+ <Brush size={14} /> <span className="lbl">{c.mask ? "Area painted" : "Paint area"}</span>
</button>
{c.mask && (
<button className="tool-x" title="Remove the painted area" onClick={() => updateComposer({ mask: null })}>
@@ -192,7 +192,7 @@ function TargetBar() {
</span>
<span className="tool-group">
<button className={`tool ${outPx ? "on" : ""}`} onClick={() => setState({ overlay: "expand" })} title="Extend the image beyond its borders">
- <Expand size={14} /> {outPx ? "Expanded" : "Expand"}
+ <Expand size={14} /> <span className="lbl">{outPx ? "Expanded" : "Expand"}</span>
</button>
{outPx && (
<button className="tool-x" title="Remove the expansion" onClick={() => updateComposer({ outpaint: null })}>
@@ -306,7 +306,7 @@ function LoraBadge() {
title={l.available ? `${title}. Click to turn ${on.length ? "off" : "on"}.` : "This LoRA's file is missing: load it again in Settings → LoRA."}
>
<Layers size={15} />
- LoRA
+ <span className="lbl">LoRA</span>
</button>
);
}
@@ -315,8 +315,9 @@ function LoraBadge() {
trigger={(open, toggleOpen) => (
<button className={`pill toggle ${on.length || open ? "on" : ""}`} onClick={toggleOpen} title={title}>
<Layers size={15} />
- LoRA{on.length > 0 && <span className="lora-count">{on.length}</span>}
- <ChevronDown size={13} />
+ <span className="lbl">LoRA</span>
+ {on.length > 0 && <span className="lora-count">{on.length}</span>}
+ <ChevronDown size={13} className="chev" />
</button>
)}
>
@@ -461,7 +462,7 @@ export function Composer() {
<button className={`pill ${open ? "on" : ""}`} onClick={toggle} title="Aspect ratio">
<RatioIcon ratio={aspectRatioNow} size={15} />
{aspectText}
- <ChevronDown size={13} />
+ <ChevronDown size={13} className="chev" />
</button>
)}
>
@@ -475,7 +476,7 @@ export function Composer() {
<button className={`pill ${open ? "on" : ""}`} onClick={toggle} title="Resolution">
<Maximize size={14} />
{resolutionLabel(c.resolution, c.customWidth, c.customHeight)}
- <ChevronDown size={13} />
+ <ChevronDown size={13} className="chev" />
</button>
)}
>
@@ -486,8 +487,8 @@ export function Composer() {
trigger={(open, toggle) => (
<button className={`pill ${open ? "on" : ""}`} onClick={toggle} title="Quality">
<Gauge size={15} />
- {QUALITY.find((q) => q.value === c.quality)?.label}
- <ChevronDown size={13} />
+ <span className="lbl">{QUALITY.find((q) => q.value === c.quality)?.label}</span>
+ <ChevronDown size={13} className="chev" />
</button>
)}
>
@@ -509,7 +510,7 @@ export function Composer() {
}
>
<WandSparkles size={15} />
- Prompt+
+ <span className="lbl">Prompt+</span>
</button>
)}
diff --git a/src/components/Gallery.tsx b/src/components/Gallery.tsx
index 40280c1..8f12da7 100644
--- a/src/components/Gallery.tsx
+++ b/src/components/Gallery.tsx
@@ -1,4 +1,4 @@
-import { ArrowLeft, FolderOpen, Heart, Loader2, Maximize2, Search, Trash2 } from "lucide-react";
+import { ArrowLeft, Check, FolderOpen, Heart, Loader2, Maximize2, Search, Trash2, X } from "lucide-react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { api, urls } from "../lib/api";
import { native } from "../lib/native";
@@ -28,6 +28,13 @@ export function Gallery() {
const index = view ? previewIndex(ids, view.id, view.at) : null;
const loaded = useRef(0);
loaded.current = items.length;
+ // Selection ("Select", or Ctrl/⌘-click, Shift-click for a range): null = off.
+ const [picked, setPicked] = useState<Set<string> | null>(null);
+ const [anchor, setAnchor] = useState<number | null>(null);
+ const [deleting, setDeleting] = useState(false);
+ const selecting = picked !== null;
+ const selectingNow = useRef(selecting);
+ selectingNow.current = selecting;
/** Loads `count` images from `offset` (the first page replaces the list). */
const load = useCallback(
@@ -64,14 +71,22 @@ export function Gallery() {
}, [load, version, q]);
useEffect(() => {
- const onKey = (e: KeyboardEvent) => e.key === "Escape" && setState({ overlay: null });
+ // Esc leaves the selection first, then the gallery.
+ const onKey = (e: KeyboardEvent) => {
+ if (e.key !== "Escape") return;
+ if (selectingNow.current) setPicked(null);
+ else setState({ overlay: null });
+ };
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, []);
// A new search or filter closes the preview. When the image it shows has left the list,
// it moves onto the one now at that position (back to the grid when nothing is left).
- useEffect(() => setView(null), [q, favorites, sort]);
+ useEffect(() => {
+ setView(null);
+ setPicked(null);
+ }, [q, favorites, sort]);
useEffect(() => {
if (!view || loading || ids.includes(view.id)) return;
setView(index === null ? null : { id: ids[index], at: index });
@@ -118,8 +133,43 @@ export function Gallery() {
}
};
+ const toggle = (i: number, range: boolean) => {
+ const next = new Set(picked ?? []);
+ if (range && anchor !== null) for (const g of items.slice(Math.min(anchor, i), Math.max(anchor, i) + 1)) next.add(g.id);
+ else if (next.has(items[i].id)) next.delete(items[i].id);
+ else next.add(items[i].id);
+ setPicked(next);
+ setAnchor(i);
+ };
+
+ /** Deletes the picked images from the gallery and the disk, one by one (the ones that fail stay). */
+ const removePicked = async () => {
+ if (!picked?.size || deleting) return;
+ const n = picked.size;
+ if (!(await native.confirm(`Delete ${n} ${n === 1 ? "image" : "images"} from the gallery and disk? This cannot be undone.`, "Delete images"))) return;
+ setDeleting(true);
+ const gone: string[] = [];
+ let failed: unknown = null;
+ for (const id of picked) {
+ try {
+ await api.deleteGeneration(id);
+ gone.push(id);
+ leaving(id);
+ forgetGeneration(id);
+ } catch (e) {
+ failed ??= e;
+ }
+ }
+ const out = new Set(gone);
+ setItems((list) => list.filter((x) => !out.has(x.id)));
+ setTotal((t) => t - gone.length);
+ setPicked(failed ? new Set([...picked].filter((id) => !out.has(id))) : null);
+ setDeleting(false);
+ if (failed) toastError(failed);
+ };
+
return (
- <div className="overlay">
+ <div className={`overlay ${selecting ? "selecting" : ""}`}>
<div className="overlay-head">
<IconButton title="Back (Esc)" onClick={() => setState({ overlay: null })}>
<ArrowLeft size={18} />
@@ -145,6 +195,12 @@ export function Gallery() {
onChange={setSort}
/>
</div>
+ <span className="spacer" />
+ {items.length > 0 && (
+ <button className={`btn ${selecting ? "primary" : ""}`} onClick={() => setPicked(selecting ? null : new Set())} title={selecting ? "Stop selecting (Esc)" : "Select several images to delete them at once (or Ctrl/⌘-click)"}>
+ {selecting ? "Done" : "Select"}
+ </button>
+ )}
</div>
<div
className="grid"
@@ -157,14 +213,18 @@ export function Gallery() {
{items.map((g, i) => (
<div
key={g.id}
- className="card"
- onClick={() => {
+ className={`card ${picked?.has(g.id) ? "picked" : ""}`}
+ role={selecting ? "checkbox" : undefined}
+ aria-checked={selecting ? picked.has(g.id) : undefined}
+ onClick={(e) => {
(document.activeElement as HTMLElement | null)?.blur();
- setView({ id: g.id, at: i });
+ if (selecting || e.ctrlKey || e.metaKey || e.shiftKey) toggle(i, e.shiftKey);
+ else setView({ id: g.id, at: i });
}}
title={g.prompt}
>
<img src={urls.genThumb(g.id)} alt="" loading="lazy" draggable={false} />
+ {selecting && <span className="pick-mark">{picked.has(g.id) && <Check size={14} strokeWidth={3} />}</span>}
<div className={`card-actions ${g.favorite ? "fav" : ""}`} onClick={(e) => e.stopPropagation()}>
<button title={g.favorite ? "Remove from favorites" : "Favorite"} onClick={() => toggleFav(g)}>
<Heart size={14} fill={g.favorite ? "currentColor" : "none"} />
@@ -188,6 +248,21 @@ export function Gallery() {
</div>
)}
</div>
+ {selecting && (
+ <div className="select-bar gallery-select">
+ <span className="select-count">{picked.size ? `${picked.size} selected` : "Click images to select them"}</span>
+ <button className="link-btn" onClick={() => setPicked(picked.size === items.length ? new Set() : new Set(items.map((g) => g.id)))}>
+ {picked.size === items.length ? "Select none" : `Select all ${items.length < total ? "loaded " : ""}(${items.length})`}
+ </button>
+ <span className="spacer" />
+ <button className="btn danger" disabled={!picked.size || deleting} onClick={removePicked}>
+ {deleting ? <Loader2 size={14} className="spin" /> : <Trash2 size={14} />} Delete
+ </button>
+ <IconButton title="Cancel (Esc)" onClick={() => setPicked(null)}>
+ <X size={16} />
+ </IconButton>
+ </div>
+ )}
{index !== null && view && (
<Preview
g={items[index]}
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 0940b1d..11140e2 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -1,12 +1,24 @@
-import { Images, PanelLeftClose, Pencil, SquarePen, X } from "lucide-react";
-import { useState } from "react";
+import { Check, Images, PanelLeftClose, Pencil, SquarePen, Trash2, X } from "lucide-react";
+import { useEffect, useState } from "react";
import { urls } from "../lib/api";
import { timeAgo } from "../lib/logic";
-import { deleteProject, newProject, renameProject, setState, switchProject, useStore } from "../lib/store";
+import { native } from "../lib/native";
+import { deleteProject, deleteProjects, newProject, renameProject, setState, switchProject, useStore } from "../lib/store";
import { IconButton, NameField } from "./ui";
import { KokonMark } from "./Welcome";
-/** Navigation: start something new, browse every image, or go back to a project. */
+/** The Kokon mark and name: the sidebar's head, and the top bar's while the sidebar is hidden. */
+export function Wordmark() {
+ return (
+ <span className="wordmark" data-tauri-drag-region>
+ <KokonMark size={18} />
+ Kokon
+ </span>
+ );
+}
+
+/** Navigation: start something new, browse every image, or go back to a project. "Select"
+ * (or Ctrl/⌘-click, Shift-click for a range) picks several projects to remove at once. */
export function Sidebar() {
const projects = useStore((s) => s.projects);
const current = useStore((s) => s.projectId);
@@ -14,14 +26,53 @@ export function Sidebar() {
const overlay = useStore((s) => s.overlay);
const gallery = overlay === "gallery";
const [renaming, setRenaming] = useState<string | null>(null);
+ // Selection: null = off; otherwise the picked project ids (and the last one clicked, for Shift).
+ const [picked, setPicked] = useState<Set<string> | null>(null);
+ const [anchor, setAnchor] = useState<string | null>(null);
+ const selecting = picked !== null;
+
+ // Esc leaves the selection; projects that are gone leave it too.
+ useEffect(() => {
+ if (!selecting) return;
+ const onKey = (e: KeyboardEvent) => {
+ if (e.key !== "Escape") return;
+ e.stopPropagation();
+ setPicked(null);
+ };
+ window.addEventListener("keydown", onKey, true);
+ return () => window.removeEventListener("keydown", onKey, true);
+ }, [selecting]);
+ useEffect(() => {
+ if (!picked) return;
+ const ids = new Set(projects.map((p) => p.id));
+ if ([...picked].some((id) => !ids.has(id))) setPicked(new Set([...picked].filter((id) => ids.has(id))));
+ }, [projects, picked]);
+
+ const toggle = (id: string, range: boolean) => {
+ const next = new Set(picked ?? []);
+ if (range && anchor) {
+ const a = projects.findIndex((p) => p.id === anchor);
+ const b = projects.findIndex((p) => p.id === id);
+ if (a >= 0 && b >= 0) for (const p of projects.slice(Math.min(a, b), Math.max(a, b) + 1)) next.add(p.id);
+ } else if (next.has(id)) next.delete(id);
+ else next.add(id);
+ setPicked(next);
+ setAnchor(id);
+ };
+
+ const removePicked = async () => {
+ if (!picked?.size) return;
+ const n = picked.size;
+ const ok = await native.confirm(`Remove ${n} ${n === 1 ? "project" : "projects"} from the list? Their images stay in All images.`, "Remove projects");
+ if (!ok) return;
+ deleteProjects([...picked]);
+ setPicked(null);
+ };
return (
- <aside className="sidebar">
+ <aside className={`sidebar ${selecting ? "selecting" : ""}`}>
<div className="side-head" data-tauri-drag-region>
- <span className="wordmark" data-tauri-drag-region>
- <KokonMark size={18} />
- Kokon
- </span>
+ <Wordmark />
<IconButton title="Hide sidebar" onClick={() => setState({ sidebar: false })}>
<PanelLeftClose size={18} />
</IconButton>
@@ -34,60 +85,99 @@ export function Sidebar() {
<Images size={16} /> All images
</button>
</nav>
- {projects.length > 0 && <div className="side-label">Projects</div>}
+ {projects.length > 0 && (
+ <div className="side-label">
+ <span>Projects</span>
+ <button className="side-select" onClick={() => setPicked(selecting ? null : new Set())} title={selecting ? "Stop selecting (Esc)" : "Select several projects to remove them at once (or Ctrl/⌘-click)"}>
+ {selecting ? "Done" : "Select"}
+ </button>
+ </div>
+ )}
<div className="side-list">
- {projects.map((p) => (
- <div
- key={p.id}
- role="button"
- tabIndex={0}
- className={`proj ${p.id === current && !gallery ? "on" : ""}`}
- onClick={() => switchProject(p.id)}
- onDoubleClick={() => setRenaming(p.id)}
- onKeyDown={(e) => {
- if (e.target !== e.currentTarget) return;
- if (e.key === "Enter" || e.key === " ") switchProject(p.id);
- else if (e.key === "F2") setRenaming(p.id);
- }}
- title={`${p.title}
-Double-click or F2 to rename`}
- >
- <span className="cover">{p.cover && <img src={urls.sourceThumb(p.cover)} alt="" draggable={false} loading="lazy" />}</span>
- <span className="proj-text">
- {renaming === p.id ? (
- <NameField value={p.title} onSave={(v) => renameProject(p.id, v)} onDone={() => setRenaming(null)} />
- ) : (
- <span className="proj-title">{p.title}</span>
- )}
- <span className="proj-sub">
- {p.count} {p.count === 1 ? "image" : "images"} · {timeAgo(p.updatedAt)}
- </span>
- </span>
- <button
- className="proj-rm"
- title="Rename"
- aria-label="Rename project"
+ {projects.map((p) => {
+ const on = picked?.has(p.id) ?? false;
+ return (
+ <div
+ key={p.id}
+ role={selecting ? "checkbox" : "button"}
+ aria-checked={selecting ? on : undefined}
+ tabIndex={0}
+ className={`proj ${p.id === current && !gallery && !selecting ? "on" : ""} ${on ? "picked" : ""}`}
onClick={(e) => {
- e.stopPropagation();
- setRenaming(p.id);
+ if (selecting || e.ctrlKey || e.metaKey || e.shiftKey) toggle(p.id, e.shiftKey);
+ else switchProject(p.id);
}}
- >
- <Pencil size={13} />
- </button>
- <button
- className="proj-rm"
- title="Remove from list (images stay in All images)"
- aria-label="Remove project"
- onClick={(e) => {
- e.stopPropagation();
- deleteProject(p.id);
+ onDoubleClick={() => !selecting && setRenaming(p.id)}
+ onKeyDown={(e) => {
+ if (e.target !== e.currentTarget) return;
+ if (e.key === "Enter" || e.key === " ") {
+ e.preventDefault();
+ if (selecting) toggle(p.id, e.shiftKey);
+ else switchProject(p.id);
+ } else if (e.key === "F2" && !selecting) setRenaming(p.id);
+ else if ((e.key === "Delete" || e.key === "Backspace") && selecting) removePicked();
}}
+ title={selecting ? p.title : `${p.title}\nDouble-click or F2 to rename · Ctrl/⌘-click to select several`}
>
- <X size={14} />
- </button>
- </div>
- ))}
+ <span className="cover">
+ {p.cover && <img src={urls.sourceThumb(p.cover)} alt="" draggable={false} loading="lazy" />}
+ {selecting && <span className="pick-mark">{on && <Check size={13} strokeWidth={3} />}</span>}
+ </span>
+ <span className="proj-text">
+ {renaming === p.id ? (
+ <NameField value={p.title} onSave={(v) => renameProject(p.id, v)} onDone={() => setRenaming(null)} />
+ ) : (
+ <span className="proj-title">{p.title}</span>
+ )}
+ <span className="proj-sub">
+ {p.count} {p.count === 1 ? "image" : "images"} · {timeAgo(p.updatedAt)}
+ </span>
+ </span>
+ {!selecting && (
+ <>
+ <button
+ className="proj-rm"
+ title="Rename"
+ aria-label="Rename project"
+ onClick={(e) => {
+ e.stopPropagation();
+ setRenaming(p.id);
+ }}
+ >
+ <Pencil size={13} />
+ </button>
+ <button
+ className="proj-rm"
+ title="Remove from list (images stay in All images)"
+ aria-label="Remove project"
+ onClick={(e) => {
+ e.stopPropagation();
+ deleteProject(p.id);
+ }}
+ >
+ <X size={14} />
+ </button>
+ </>
+ )}
+ </div>
+ );
+ })}
</div>
+ {selecting && (
+ <div className="select-bar">
+ <span className="select-count">{picked.size ? `${picked.size} selected` : "Pick projects"}</span>
+ <button className="link-btn" onClick={() => setPicked(picked.size === projects.length ? new Set() : new Set(projects.map((p) => p.id)))}>
+ {picked.size === projects.length ? "None" : "All"}
+ </button>
+ <span className="spacer" />
+ <button className="btn small danger" disabled={!picked.size} onClick={removePicked} title="Remove from the list; the images stay in All images">
+ <Trash2 size={13} /> Remove
+ </button>
+ <IconButton title="Cancel (Esc)" onClick={() => setPicked(null)}>
+ <X size={15} />
+ </IconButton>
+ </div>
+ )}
</aside>
);
}
diff --git a/src/components/Stage.tsx b/src/components/Stage.tsx
index 967358a..c406399 100644
--- a/src/components/Stage.tsx
+++ b/src/components/Stage.tsx
@@ -661,9 +661,11 @@ function safeDecode(s: string) {
}
/** Arcs above the thumbnails join a version to the earlier ones it was made from: one level
- * per arc that spans another, `LANE` px apart, rounded corners of `R` px. */
+ * per arc that spans another, `LANE` px apart, rounded corners of `R` px; they stop `GAP` px
+ * above the thumbnails, clear of the ring or outline round them. */
const LANE = 9;
const R = 5;
+const GAP = 9;
/** What joins a version to the one before it: a line when it continues from it (dashed for a
* new seed of it), a break when it starts something new, a plain gap when it comes from
@@ -671,13 +673,8 @@ const R = 5;
function Joint({ kind, hot }: { kind: LinkKind; hot: boolean }) {
if (kind === "start") return <span className="joint break" aria-hidden />;
if (kind === "branch" || kind === "combine") return <span className="joint gap" aria-hidden />;
- // Two silk threads between the thumbnails' centres (25 px down the 50 px frame).
- return (
- <svg className={`joint silk ${kind === "variant" ? "dashed" : ""} ${hot ? "hot" : ""}`} viewBox="0 0 22 50" aria-hidden>
- <path className="t1" d="M-3 25 C 5 30.5, 17 30.5, 25 25" />
- <path className="t2" d="M-3 24 C 6 20, 15 21, 25 26" />
- </svg>
- );
+ // A straight line between the thumbnails, ending where a ring or outline round them sits.
+ return <span className={`joint link ${kind === "variant" ? "dashed" : ""} ${hot ? "hot" : ""}`} aria-hidden />;
}
function linkText(link: TimelineLink | undefined, labels: Record<string, string>): string {
@@ -759,9 +756,9 @@ function Timeline({ labels }: { labels: Record<string, string> }) {
})
.filter((a) => centers[a.from] !== undefined && centers[a.to] !== undefined);
const places = arcLayout(arcs.map((a) => ({ a: index.get(a.from)!, b: index.get(a.to)! })));
- const band = arcs.length ? 10 + (Math.max(...places.map((p) => p.lane)) + 1) * LANE : 0;
+ const band = arcs.length ? 10 + GAP + (Math.max(...places.map((p) => p.lane)) + 1) * LANE : 0;
const arcPath = (x1: number, x2: number, top: number) => {
- const y = band - 1;
+ const y = band - GAP;
const d = x2 > x1 ? 1 : -1;
// Up from the source, across at its level, down into the result, with an arrowhead.
return `M ${x1} ${y} L ${x1} ${top + R} Q ${x1} ${top} ${x1 + d * R} ${top} L ${x2 - d * R} ${top} Q ${x2} ${top} ${x2} ${top + R} L ${x2} ${y} M ${x2 - 3.5} ${y - 4.5} L ${x2} ${y} L ${x2 + 3.5} ${y - 4.5}`;
@@ -777,7 +774,7 @@ function Timeline({ labels }: { labels: Record<string, string> }) {
.map((a, i) => ({ a, p: places[i] }))
.sort((x, y) => Number(x.a.hot) - Number(y.a.hot))
.map(({ a, p }) => (
- <path key={`${a.from}-${a.to}`} className={a.hot ? "hot" : ""} d={arcPath(centers[a.from] + p.dx1, centers[a.to] + p.dx2, band - 8 - (p.lane + 1) * LANE)} />
+ <path key={`${a.from}-${a.to}`} className={a.hot ? "hot" : ""} d={arcPath(centers[a.from] + p.dx1, centers[a.to] + p.dx2, band - 8 - GAP - (p.lane + 1) * LANE)} />
))}
</svg>
)}
diff --git a/src/components/TitleBar.tsx b/src/components/TitleBar.tsx
index 27562ec..df483c9 100644
--- a/src/components/TitleBar.tsx
+++ b/src/components/TitleBar.tsx
@@ -1,12 +1,12 @@
// Kokon draws its own title bar: the window is one surface. On Windows and Linux the system
// bar is off (tauri.conf.json) and these are the window's buttons; on macOS the system keeps
// its traffic lights, drawn over Kokon's top bar (tauri.macos.conf.json), so there is nothing
-// to draw here. The top bar and the sidebar's head are drag regions (data-tauri-drag-region).
+// to draw here. Linux gets round GNOME-like buttons, Windows its own. The top bar and the sidebar's head are drag regions (data-tauri-drag-region).
import { Copy, Minus, Square, X } from "lucide-react";
import { useEffect, useState } from "react";
import { native } from "../lib/native";
-import { isMac } from "../lib/platform";
+import { isLinux, isMac } from "../lib/platform";
// macOS: room for the traffic lights on the left of the top bar (styles.css).
if (isMac && typeof document !== "undefined") document.documentElement.dataset.platform = "mac";
@@ -27,15 +27,15 @@ export function WindowControls() {
}, []);
if (isMac) return null;
return (
- <div className="window-controls">
+ <div className={`window-controls ${isLinux ? "linux" : ""}`}>
<button className="win-btn" title="Minimize" aria-label="Minimize" onClick={() => native.minimize().catch(() => {})}>
- <Minus size={16} strokeWidth={1.6} />
+ <Minus size={isLinux ? 14 : 16} strokeWidth={isLinux ? 2 : 1.6} />
</button>
<button className="win-btn" title={maximized ? "Restore" : "Maximize"} aria-label={maximized ? "Restore" : "Maximize"} onClick={() => native.toggleMaximize().catch(() => {})}>
- {maximized ? <Copy size={13} strokeWidth={1.6} style={{ transform: "scaleX(-1)" }} /> : <Square size={13} strokeWidth={1.6} />}
+ {maximized ? <Copy size={isLinux ? 11 : 13} strokeWidth={isLinux ? 2 : 1.6} style={{ transform: "scaleX(-1)" }} /> : <Square size={isLinux ? 11 : 13} strokeWidth={isLinux ? 2 : 1.6} />}
</button>
<button className="win-btn close" title="Close" aria-label="Close" onClick={() => native.close().catch(() => {})}>
- <X size={17} strokeWidth={1.6} />
+ <X size={isLinux ? 14 : 17} strokeWidth={isLinux ? 2 : 1.6} />
</button>
</div>
);
diff --git a/src/lib/store.ts b/src/lib/store.ts
index 15da84d..4bd884b 100644
--- a/src/lib/store.ts
+++ b/src/lib/store.ts
@@ -670,9 +670,14 @@ export function renameProject(id: string, name: string) {
/** Removes a project from the list; its images stay in the gallery. */
export function deleteProject(id: string) {
- delete projects[id];
+ deleteProjects([id]);
+}
+
+/** Removes projects from the list (their images stay in All images); the open one closes. */
+export function deleteProjects(ids: string[]) {
+ for (const id of ids) delete projects[id];
persistProjects();
- if (id === state.projectId) setState((s) => ({ projectId: newKey(), session: [], selected: null, composer: emptyComposer(s.composer) }));
+ if (ids.includes(state.projectId)) setState((s) => ({ projectId: newKey(), session: [], selected: null, composer: emptyComposer(s.composer), projects: projectList() }));
else setState({ projects: projectList() });
}
diff --git a/src/styles.css b/src/styles.css
index 769b2d4..0302500 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -24,6 +24,7 @@
--shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.05), 0 24px 56px -18px rgba(0, 0, 0, 0.24);
--print: 0 2px 4px rgba(0, 0, 0, 0.06), 0 30px 60px -28px rgba(0, 0, 0, 0.38);
--pick: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 0 6px rgba(0, 0, 0, 0.06);
+ --pick-bg: #ffffff;
--glow: rgba(255, 255, 255, 0.95);
--checker: #ebebeb;
--sidebar: transparent;
@@ -55,7 +56,8 @@
--lift: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 10px 28px -12px rgba(0, 0, 0, 0.7);
--shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 24px 60px -18px rgba(0, 0, 0, 0.8);
--print: 0 2px 6px rgba(0, 0, 0, 0.5), 0 34px 70px -24px rgba(0, 0, 0, 0.9);
- --pick: 0 0 0 1px rgba(255, 255, 255, 0.08);
+ --pick: none;
+ --pick-bg: #333333;
--glow: rgba(255, 255, 255, 0.045);
--checker: #181818;
--sidebar: transparent;
@@ -94,7 +96,10 @@ svg { display: block; flex: none; }
.side-item { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 12px; color: var(--text-2); font-size: 14px; text-align: left; transition: background 0.15s, box-shadow 0.2s, color 0.15s; }
.side-item:hover { background: var(--surface); color: var(--text); }
.side-item.on { background: var(--bg); color: var(--text); box-shadow: var(--lift); font-weight: 500; }
-.side-label { font-size: 11.5px; color: var(--text-3); padding: 12px 20px 6px; letter-spacing: 0.02em; }
+.side-label { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-3); padding: 8px 14px 4px 20px; letter-spacing: 0.02em; }
+.side-select { height: 24px; padding: 0 8px; border-radius: 7px; font-size: 11.5px; color: var(--text-3); opacity: 0; transition: opacity 0.15s, background 0.15s, color 0.15s; }
+.sidebar:hover .side-select, .sidebar.selecting .side-select, .side-select:focus-visible { opacity: 1; }
+.side-select:hover { background: var(--surface); color: var(--text); }
.side-list { flex: 1; overflow-y: auto; padding: 2px 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.proj { display: flex; align-items: center; gap: 11px; padding: 7px; border-radius: 14px; cursor: pointer; position: relative; outline-offset: -2px; transition: background 0.15s, box-shadow 0.2s; }
.proj:hover { background: var(--surface); }
@@ -261,16 +266,12 @@ svg { display: block; flex: none; }
.arcs path { fill: none; stroke: var(--text-3); stroke-opacity: 0.45; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: stroke-opacity 0.15s; }
.arcs path.hot { stroke: var(--text); stroke-opacity: 1; stroke-width: 2; }
.joint { flex: none; }
-/* versions joined by silk: two threads, the second one swaying a little */
-.joint.silk { width: 22px; height: 50px; color: var(--text-3); overflow: visible; }
-.joint.silk path { fill: none; stroke: currentColor; stroke-linecap: round; transition: stroke-opacity 0.15s; }
-.joint.silk .t1 { stroke-width: 1.1; stroke-opacity: 0.6; }
-.joint.silk .t2 { stroke-width: 0.7; stroke-opacity: 0.35; animation: silk-sway 3.2s ease-in-out infinite; }
-.joint.silk.dashed .t1 { stroke-dasharray: 2 3; }
-.joint.silk.hot { color: var(--text); }
-.joint.silk.hot .t1 { stroke-opacity: 1; }
-.joint.silk.hot .t2 { stroke-opacity: 0.55; }
-@keyframes silk-sway { 50% { transform: translateY(1.5px); } }
+/* versions joined by a straight line; it stops where the ring or outline round a thumbnail
+ sits (5 px out), so lines and rings meet without crossing */
+.joint.link { position: relative; width: 22px; height: 50px; }
+.joint.link::before { content: ""; position: absolute; left: 3px; right: 3px; top: 24.25px; border-top: 1.5px solid var(--text-3); opacity: 0.5; transition: opacity 0.15s, border-color 0.15s; }
+.joint.link.dashed::before { border-top-style: dashed; }
+.joint.link.hot::before { border-top-color: var(--text); opacity: 1; }
.joint.gap { width: 16px; }
/* a new image: the line breaks */
.joint.break { width: 29px; height: 32px; margin-top: 9px; background: linear-gradient(var(--border-2), var(--border-2)) center / 1px 100% no-repeat; }
@@ -292,11 +293,11 @@ svg { display: block; flex: none; }
.frame-silk .run { stroke-width: 1.7; stroke-linecap: round; stroke-dasharray: 46 154; animation: silk-orbit 3.6s linear infinite; }
@keyframes silk-orbit { to { stroke-dashoffset: -200; } }
@media (prefers-reduced-motion: reduce) {
- .frame-silk .run, .joint.silk .t2 { animation: none; }
+ .frame-silk .run { animation: none; }
.frame-silk.making .ring { stroke-opacity: 0.6; }
}
/* what the shown version was made from */
-.frame.src .frame-img { outline: 2px dashed var(--text-3); }
+.frame.src .frame-img { outline: 1.6px dashed var(--text-3); outline-offset: 3.2px; }
.frame.sel { color: var(--text); }
.frame-label { display: flex; align-items: center; gap: 3px; font-size: 11px; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.frame-badge { position: absolute; right: 3px; bottom: 3px; width: 17px; height: 17px; border-radius: 6px; background: var(--invert-bg); color: var(--invert-text); display: grid; place-items: center; }
@@ -324,7 +325,7 @@ svg { display: block; flex: none; }
.mode-switch { display: flex; flex: none; background: var(--surface); border-radius: 13px; padding: 3px; gap: 2px; }
.mode-switch button { height: 30px; padding: 0 11px; border-radius: 10px; transition: background 0.2s, box-shadow 0.2s, color 0.15s; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.mode-switch button:hover:not(.on) { color: var(--text); }
-.mode-switch button.on { background: var(--bg); color: var(--text); box-shadow: var(--pick); font-weight: 500; }
+.mode-switch button.on { background: var(--pick-bg); color: var(--text); box-shadow: var(--pick); font-weight: 500; }
.target-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--surface); display: grid; place-items: center; color: var(--text-2); flex: none; }
.target-text { display: flex; flex-direction: column; min-width: 0; }
.target-text .what { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@@ -392,7 +393,7 @@ svg { display: block; flex: none; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 60px; }
.seg { display: flex; background: var(--surface); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { flex: 1; height: 28px; border-radius: 8px; font-size: 12px; color: var(--text-2); padding: 0 6px; white-space: nowrap; }
-.seg button.on { background: var(--bg); color: var(--text); box-shadow: var(--pick); }
+.seg button.on { background: var(--pick-bg); color: var(--text); box-shadow: var(--pick); }
input[type="range"] { width: 100%; accent-color: var(--text); }
.switch { width: 34px; height: 20px; border-radius: 10px; background: var(--surface-3); position: relative; flex: none; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); transition: left 0.15s; }
@@ -881,3 +882,47 @@ kbd { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; display
::-webkit-scrollbar-thumb { background-color: transparent; border: 3px solid transparent; border-radius: 999px; background-clip: padding-box; min-height: 32px; }
:hover::-webkit-scrollbar-thumb { background-color: var(--scroll); }
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background-color: var(--scroll-hi); }
+
+/* ---------- selecting several projects / images to remove them at once ---------- */
+.pick-mark { position: absolute; left: 6px; top: 6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.28); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.9); backdrop-filter: blur(4px); }
+.proj .cover { position: relative; }
+.proj .pick-mark { left: 50%; top: 50%; margin: -10px 0 0 -10px; }
+.proj.picked { background: var(--bg); box-shadow: var(--lift); }
+.proj.picked .pick-mark, .card.picked .pick-mark { background: var(--invert-bg); color: var(--invert-text); box-shadow: 0 0 0 1.5px var(--invert-text); }
+.card.picked { outline: 2.5px solid var(--text); outline-offset: 2px; }
+.card.picked img { transform: scale(0.96); border-radius: 10px; }
+.card img { transition: transform 0.2s var(--ease), border-radius 0.2s; }
+.overlay.selecting .card .card-actions, .overlay.selecting .card .card-meta { display: none; }
+.select-bar { flex: none; display: flex; align-items: center; gap: 8px; margin: 6px 8px 10px; padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--bg); box-shadow: var(--shadow); animation: rise 0.3s var(--ease) both; font-size: 13px; }
+.select-bar .spacer { flex: 1; }
+.select-count { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
+.gallery-select { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); margin: 0; min-width: min(560px, calc(100% - 32px)); z-index: 6; animation: none; }
+.gallery-bar .spacer { flex: 1; }
+.btn.danger { background: #c42b1c; color: #fff; }
+.btn.danger:hover:not(:disabled) { background: #b02418; }
+@media (prefers-reduced-motion: reduce) { .select-bar { animation: none; } }
+
+/* the mark and name in the top bar while the sidebar is hidden */
+.brand .wordmark { flex: none; padding: 0 10px 0 2px; }
+
+/* Linux: GNOME-like round window buttons instead of the Windows ones */
+.window-controls.linux { gap: 12px; align-items: center; padding: 0 16px 0 8px; }
+.window-controls.linux .win-btn { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); color: var(--text); }
+.window-controls.linux .win-btn:hover { background: var(--surface-3); }
+.window-controls.linux .win-btn:active, .window-controls.linux .win-btn.close:active { background: var(--border-2); color: var(--text); }
+.window-controls.linux .win-btn.close:hover { background: var(--surface-3); color: var(--text); }
+
+/* ---------- a narrow window: the prompt box keeps every control, words give way to icons ---------- */
+.composer-wrap { container: composer / inline-size; }
+@container composer (max-width: 780px) {
+ .tool .lbl, .controls .pill .lbl { display: none; }
+ .tool { padding: 0 9px; }
+ .target-text .sub { display: none; }
+}
+@container composer (max-width: 700px) {
+ .plan-hint { display: none; }
+}
+@container composer (max-width: 600px) {
+ .controls .pill .chev, .mode-switch .lbl { display: none; }
+ .controls { gap: 3px; }
+}