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: shell on the paper: wordmark in the sidebar, cards for the selection, status capsule

Gabriele Lozupone81ff0580f310
diff --git a/src/App.tsx b/src/App.tsx
index 9f770ac..7b65339 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -6,6 +6,7 @@ import { native } from "./lib/native";
import {
addExampleProjects, addInputs, closeStarPrompt, dismissToast, getState, initStarPrompt, isMissingModel, newProject, openModelSetup, redoVersion, refreshLoras, refreshStatus, selectItem, setPrivateMode, setState, startEvents, startTour, submitComposer, toastError, toastInfo, undoKey, undoVersion, useStore,
} from "./lib/store";
+import { SilkSpin } from "./components/Cocoon";
import { Composer, importPaths } from "./components/Composer";
import { ExpandEditor } from "./components/ExpandEditor";
import { Gallery } from "./components/Gallery";
@@ -65,7 +66,7 @@ function StatusIndicator() {
else if (server.state === "stopped" && connected) api.startBackend().then(refreshStatus, toastError);
}}
>
- <span className={cls} />
+ {cls === "dot busy" || (cls === "dot ready" && busy) ? <SilkSpin size={18} /> : <span className={cls} />}
<span style={{ maxWidth: 360, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{text}</span>
</button>
);
diff --git a/src/components/Cocoon.tsx b/src/components/Cocoon.tsx
index 32e18a3..64b8526 100644
--- a/src/components/Cocoon.tsx
+++ b/src/components/Cocoon.tsx
@@ -267,6 +267,23 @@ export function Cocoon({ src, pct, form, dim }: { src?: string; pct: number; for
);
}
+/** The cocoon in small, for the status capsule and the timeline: silk threads winding round a
+ * capsule (the logo's stem). `fill` (0..1) fills the capsule from the bottom, like the job's
+ * percentage; without it the capsule stays faint. `size` is the height in px. */
+export function SilkSpin({ size = 18, fill }: { size?: number; fill?: number }) {
+ const f = fill === undefined ? null : clamp01(fill);
+ return (
+ <svg className="silk-spin" width={(size * 2) / 3} height={size} viewBox="0 0 16 24" aria-hidden>
+ <rect x="4.5" y="3.5" width="7" height="17" rx="3.5" fill="currentColor" opacity="0.16" />
+ {f !== null && <rect className="silk-fill" x="4.5" y={3.5 + 17 * (1 - f)} width="7" height={17 * f} rx="3.5" fill="currentColor" opacity="0.5" />}
+ <ellipse cx="8" cy="12" rx="4.6" ry="9.6" strokeWidth="0.9" />
+ <ellipse cx="8" cy="12" rx="4" ry="9.9" strokeWidth="0.7" />
+ <ellipse cx="8" cy="12" rx="5.1" ry="9.2" strokeWidth="0.7" />
+ <ellipse cx="8" cy="12" rx="3.6" ry="10" strokeWidth="0.6" />
+ </svg>
+ );
+}
+
// ---------------------------------------------------------------------------------------
// Hatching: a result made a moment ago comes out of the logo once, when first shown.
// ---------------------------------------------------------------------------------------
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index c327c82..e002266 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -4,6 +4,7 @@ import { urls } from "../lib/api";
import { timeAgo } from "../lib/logic";
import { deleteProject, 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. */
export function Sidebar() {
@@ -17,6 +18,10 @@ export function Sidebar() {
return (
<aside className="sidebar">
<div className="side-head">
+ <span className="wordmark">
+ <KokonMark size={18} />
+ Kokon
+ </span>
<IconButton title="Hide sidebar" onClick={() => setState({ sidebar: false })}>
<PanelLeftClose size={18} />
</IconButton>
diff --git a/src/styles.css b/src/styles.css
index 6123682..76840a0 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -78,29 +78,35 @@ svg { display: block; flex: none; }
.app { display: flex; height: 100%; }
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
-/* ---------- sidebar: new / all images / projects ---------- */
-.sidebar { width: 260px; flex: none; background: var(--sidebar); display: flex; flex-direction: column; min-height: 0; }
-.side-head { height: 48px; display: flex; align-items: center; padding: 0 8px; flex: none; }
-.side-nav { display: flex; flex-direction: column; gap: 1px; padding: 0 8px 8px; }
-.side-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 10px; color: var(--text); font-size: 14px; text-align: left; }
-.side-item:hover, .side-item.on { background: var(--surface-2); }
-.side-label { font-size: 12px; color: var(--text-3); padding: 12px 18px 6px; }
-.side-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; }
-.proj { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; cursor: pointer; position: relative; outline-offset: -2px; }
-.proj:hover, .proj.on { background: var(--surface-2); }
-.proj .cover { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--surface-3); flex: none; }
+/* ---------- sidebar: the mark, new / all images / projects (on the paper, no panel) ---------- */
+.sidebar { width: 256px; flex: none; background: var(--sidebar); display: flex; flex-direction: column; min-height: 0; padding-left: 4px; }
+.side-head { height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 16px; flex: none; }
+.wordmark { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; font-weight: 640; font-size: 15px; letter-spacing: -0.03em; color: var(--text); }
+.wordmark .kokon-mark svg { width: 18px; height: 18px; }
+.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 2px 8px 10px; }
+.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-list { flex: 1; overflow-y: auto; padding: 2px 8px 12px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
+.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); }
+.proj.on { background: var(--bg); box-shadow: var(--lift); }
+.proj .cover { width: 42px; height: 42px; border-radius: 10px; overflow: hidden; background: var(--surface-3); flex: none; }
.proj .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.proj-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
-.proj-title { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
-.proj-sub { font-size: 11px; color: var(--text-3); white-space: nowrap; }
+.proj-title { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.proj-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.proj-rm { width: 24px; height: 24px; border-radius: 7px; display: none; place-items: center; color: var(--text-2); flex: none; }
.proj:hover .proj-rm { display: grid; }
-.proj-rm:hover { background: var(--surface-3); color: var(--text); }
+.proj-rm:hover { background: var(--surface-2); color: var(--text); }
/* ---------- top bar ---------- */
-.topbar { height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px 0 16px; flex: none; }
+.topbar { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px 0 16px; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
-.status { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 400; }
+/* the status capsule: a card in the top bar; a small cocoon spins while images are made */
+.status { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 11px; border-radius: 999px; background: var(--bg); box-shadow: var(--lift); color: var(--text); font-size: 12.5px; font-weight: 400; }
+.status .silk-spin { margin: 0 -2px 0 -3px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.dot.ready { background: var(--text); }
.dot.busy { background: transparent; border: 1.5px solid var(--text); animation: pulse 1.2s ease-in-out infinite; }
@@ -117,8 +123,8 @@ svg { display: block; flex: none; }
.name-field { font: inherit; font-size: 13px; color: var(--text); background: var(--bg); border: 1px solid var(--text-3); border-radius: 6px; padding: 2px 6px; outline: none; min-width: 0; width: 100%; user-select: text; }
.name-field.title-field { font-size: 14px; font-weight: 500; height: 32px; padding: 0 8px; width: min(480px, 50vw); }
-.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); }
-.icon-btn:hover:not(:disabled) { background: var(--surface); color: var(--text); }
+.icon-btn { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: var(--text-2); transition: background 0.15s, color 0.15s; }
+.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn.active { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.has-badge { position: relative; }
@@ -164,6 +170,15 @@ svg { display: block; flex: none; }
.cocoon.dim { opacity: 0.32; }
.cocoon canvas { position: absolute; inset: 0; display: block; }
.cocoon-src { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: filter 0.9s ease-out, opacity 0.9s ease-out; }
+/* silk spinner (Cocoon.tsx SilkSpin): a tiny cocoon, threads winding round a capsule that fills */
+.silk-spin { color: var(--text); flex: none; overflow: visible; }
+.silk-spin ellipse { fill: none; stroke: currentColor; transform-box: fill-box; transform-origin: center; animation: silk-wind 2.6s ease-in-out infinite alternate; }
+.silk-spin ellipse:nth-of-type(2) { animation-duration: 3.4s; animation-delay: -1s; }
+.silk-spin ellipse:nth-of-type(3) { animation-duration: 2.1s; animation-delay: -0.4s; }
+.silk-spin ellipse:nth-of-type(4) { animation-duration: 4s; animation-delay: -2s; }
+.silk-spin .silk-fill { transition: y 0.3s, height 0.3s; }
+@keyframes silk-wind { from { transform: rotate(-32deg); } to { transform: rotate(32deg); } }
+@media (prefers-reduced-motion: reduce) { .silk-spin ellipse { animation: none; } }
/* a fresh result seen through the logo, which grows until it is the image (Hatch) */
.hatch { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; }
.hatch-body { position: relative; z-index: 1; flex: 1; min-width: 0; min-height: 0; display: flex; }
@@ -409,8 +424,8 @@ pre.diag { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.private-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--invert-bg); color: var(--invert-text); font: inherit; font-size: 13px; cursor: pointer; }
-.update-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
-.update-pill:hover:not(:disabled) { background: var(--surface-2); }
+.update-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--bg); box-shadow: var(--lift); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
+.update-pill:hover:not(:disabled) { background: var(--surface); }
.update-pill:disabled { cursor: default; color: var(--text-2); }
.setup { flex: 1; display: flex; justify-content: center; overflow-y: auto; padding: 40px 24px 0; }
/* Bottom room inside the scroller (padding on the scroller itself is dropped by Chromium). */