From eb39aa10938260f20020bf1821501a812c2a8790 Mon Sep 17 00:00:00 2001
From: nolight132
Date: Sun, 29 Nov 2026 13:28:14 +0100
Subject: [PATCH 01/27] feat(themes): add a theme creator on a labelled mock of
the current app
---
src/lib/color.ts | 179 ++++
src/lib/components/ThemePreview.svelte | 7 +
src/lib/components/TokenMap.svelte | 557 +++++++++++
src/lib/components/mock/AppMock.svelte | 125 ++-
src/lib/components/mock/Aside.svelte | 5 +-
src/lib/components/mock/Members.svelte | 4 +-
src/lib/components/mock/PlayerBar.svelte | 10 +-
src/lib/components/mock/Sidebar.svelte | 1 -
src/lib/components/mock/TitleBar.svelte | 4 +-
src/lib/creator.ts | 176 ++++
src/lib/data/themes.ts | 2 +-
src/lib/mock/theme.ts | 40 +-
src/lib/theme-tokens.ts | 90 ++
src/routes/docs/themes/+page.svelte | 59 +-
src/routes/themes/+page.svelte | 3 +-
src/routes/themes/creator/+page.svelte | 1135 ++++++++++++++++++++++
src/routes/themes/submit/+page.svelte | 12 +
17 files changed, 2293 insertions(+), 116 deletions(-)
create mode 100644 src/lib/color.ts
create mode 100644 src/lib/components/TokenMap.svelte
create mode 100644 src/lib/creator.ts
create mode 100644 src/lib/theme-tokens.ts
create mode 100644 src/routes/themes/creator/+page.svelte
diff --git a/src/lib/color.ts b/src/lib/color.ts
new file mode 100644
index 0000000..eac654d
--- /dev/null
+++ b/src/lib/color.ts
@@ -0,0 +1,179 @@
+/** A colour as red, green and blue from 0 to 255 and alpha from 0 to 1. */
+export type Rgba = { r: number; g: number; b: number; a: number };
+
+/** A colour as hue in degrees and saturation, lightness and alpha from 0 to 1. */
+export type Hsla = { h: number; s: number; l: number; a: number };
+
+/** How far each of the theme creator's sliders moves every colour, from -100 to 100, hue in degrees. */
+export type Shift = { hue: number; saturation: number; lightness: number };
+
+const HEX = /^#?([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
+
+const clamp = (value: number, low = 0, high = 1) => Math.min(Math.max(value, low), high);
+
+/**
+ * Reads a hex colour of 3, 4, 6 or 8 digits, with or without `#`, or CSS `rgb(r g b / a)`.
+ * Returns null for anything else.
+ */
+export function parse(value: string): Rgba | null {
+ const text = value.trim();
+ const hex = text.match(HEX)?.[1];
+ if (hex) {
+ const digits = hex.length <= 4 ? [...hex].map((digit) => digit + digit).join('') : hex;
+ const [r, g, b, a = 255] = (digits.match(/../g) ?? []).map((pair) => parseInt(pair, 16));
+ return { r, g, b, a: a / 255 };
+ }
+ const rgb = text.match(/^rgba?\(([^)]+)\)$/i)?.[1];
+ if (!rgb) return null;
+ const [r, g, b, a = 1] = rgb
+ .split(/[\s,/]+/)
+ .filter(Boolean)
+ .map(Number);
+ if ([r, g, b, a].some(Number.isNaN)) return null;
+ return { r, g, b, a };
+}
+
+/** Whether `value` is a colour a theme file accepts: hex of 6 or 8 digits. */
+export function valid(value: string): boolean {
+ return /^#?(?:[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value.trim());
+}
+
+/** A colour as lowercase `#rrggbb`, or `#rrggbbaa` when it is not opaque. */
+export function hex({ r, g, b, a }: Rgba): string {
+ const byte = (value: number) =>
+ Math.round(clamp(value, 0, 255))
+ .toString(16)
+ .padStart(2, '0');
+ const alpha = Math.round(clamp(a) * 255);
+ return `#${byte(r)}${byte(g)}${byte(b)}${alpha < 255 ? byte(alpha) : ''}`;
+}
+
+/** Any colour `parse` reads, written the way a theme file stores it. */
+export function normal(value: string): string {
+ const color = parse(value);
+ return color ? hex(color) : value;
+}
+
+export function toHsl({ r, g, b, a }: Rgba): Hsla {
+ const red = r / 255;
+ const green = g / 255;
+ const blue = b / 255;
+ const top = Math.max(red, green, blue);
+ const low = Math.min(red, green, blue);
+ const l = (top + low) / 2;
+ const span = top - low;
+ if (span === 0) return { h: 0, s: 0, l, a };
+ const s = span / (1 - Math.abs(2 * l - 1));
+ const h =
+ top === red
+ ? ((green - blue) / span + (green < blue ? 6 : 0)) * 60
+ : top === green
+ ? ((blue - red) / span + 2) * 60
+ : ((red - green) / span + 4) * 60;
+ return { h, s, l, a };
+}
+
+export function fromHsl({ h, s, l, a }: Hsla): Rgba {
+ const chroma = (1 - Math.abs(2 * l - 1)) * s;
+ const turn = (((h % 360) + 360) % 360) / 60;
+ const second = chroma * (1 - Math.abs((turn % 2) - 1));
+ const [red, green, blue] =
+ turn < 1
+ ? [chroma, second, 0]
+ : turn < 2
+ ? [second, chroma, 0]
+ : turn < 3
+ ? [0, chroma, second]
+ : turn < 4
+ ? [0, second, chroma]
+ : turn < 5
+ ? [second, 0, chroma]
+ : [chroma, 0, second];
+ const lift = l - chroma / 2;
+ return { r: (red + lift) * 255, g: (green + lift) * 255, b: (blue + lift) * 255, a };
+}
+
+/**
+ * Moves `value` by `shift`. Hue turns the colour wheel, saturation scales towards grey or full
+ * colour, and lightness moves towards black or white, so a grey stays grey and alpha stays put.
+ */
+export function adjust(value: string, shift: Shift): string {
+ const color = parse(value);
+ if (!color || (!shift.hue && !shift.saturation && !shift.lightness)) return value;
+ const { h, s, l, a } = toHsl(color);
+ return hex(
+ fromHsl({
+ h: h + shift.hue,
+ s: scale(s, shift.saturation / 100),
+ l: towards(l, shift.lightness / 100),
+ a
+ })
+ );
+}
+
+/**
+ * The colour that `adjust` turns into `value` under `shift`, so an edit made while the sliders
+ * are moved survives moving them again. It is exact except where a slider at its end has pinned
+ * every colour to the same saturation or lightness.
+ */
+export function unadjust(value: string, shift: Shift): string {
+ const color = parse(value);
+ if (!color || (!shift.hue && !shift.saturation && !shift.lightness)) return value;
+ const { h, s, l, a } = toHsl(color);
+ return hex(
+ fromHsl({
+ h: h - shift.hue,
+ s: unscale(s, shift.saturation / 100),
+ l: untowards(l, shift.lightness / 100),
+ a
+ })
+ );
+}
+
+/** Relative luminance as WCAG defines it. */
+export function luminance({ r, g, b }: Rgba): number {
+ const linear = (channel: number) => {
+ const value = channel / 255;
+ return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
+ };
+ return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);
+}
+
+/** `top` painted over the opaque `bottom`. The result is opaque. */
+export function over(top: Rgba, bottom: Rgba): Rgba {
+ const mix = (upper: number, lower: number) => upper * top.a + lower * (1 - top.a);
+ return { r: mix(top.r, bottom.r), g: mix(top.g, bottom.g), b: mix(top.b, bottom.b), a: 1 };
+}
+
+/** The WCAG contrast ratio between two opaque colours, from 1 to 21. */
+export function contrast(first: Rgba, second: Rgba): number {
+ const [light, dark] = [luminance(first), luminance(second)].sort((a, b) => b - a);
+ return (light + 0.05) / (dark + 0.05);
+}
+
+/** Whether text on `value` should be light rather than dark. */
+export function dark(value: string): boolean {
+ const color = parse(value);
+ return !!color && luminance(color) < 0.18;
+}
+
+function scale(value: number, amount: number): number {
+ return clamp(amount >= 0 ? value + (1 - value) * amount * value : value * (1 + amount));
+}
+
+function unscale(value: number, amount: number): number {
+ if (amount < 0) return amount === -1 ? value : clamp(value / (1 + amount));
+ if (!amount) return value;
+ // solves value = x + (1 - x) * amount * x for x in 0..1
+ const root = (1 + amount - Math.sqrt((1 + amount) ** 2 - 4 * amount * value)) / (2 * amount);
+ return clamp(root);
+}
+
+function towards(value: number, amount: number): number {
+ return clamp(amount >= 0 ? value + (1 - value) * amount : value * (1 + amount));
+}
+
+function untowards(value: number, amount: number): number {
+ if (amount >= 1 || amount <= -1) return value;
+ return clamp(amount >= 0 ? (value - amount) / (1 - amount) : value / (1 + amount));
+}
diff --git a/src/lib/components/ThemePreview.svelte b/src/lib/components/ThemePreview.svelte
index d99b548..fc4e464 100644
--- a/src/lib/components/ThemePreview.svelte
+++ b/src/lib/components/ThemePreview.svelte
@@ -99,6 +99,12 @@
{/each}
{/if}
+ {#if chosen}
+ Edit
+ {/if}
{/if}
@@ -203,6 +209,7 @@
box-shadow: inset 0 0 0 1px rgb(127 127 127 / 0.3);
}
+ .edit,
.close {
flex: none;
height: 32px;
diff --git a/src/lib/components/TokenMap.svelte b/src/lib/components/TokenMap.svelte
new file mode 100644
index 0000000..457fec2
--- /dev/null
+++ b/src/lib/components/TokenMap.svelte
@@ -0,0 +1,557 @@
+
+
+
+
+
+
+
+ {#each outlines as box, index (index)}
+
+ {/each}
+
+
+ {#each placed as label (label.token)}
+
+ {/each}
+
+
+
diff --git a/src/lib/components/mock/AppMock.svelte b/src/lib/components/mock/AppMock.svelte
index dd1a9dc..ce28176 100644
--- a/src/lib/components/mock/AppMock.svelte
+++ b/src/lib/components/mock/AppMock.svelte
@@ -4,6 +4,7 @@
import { player } from '$lib/mock/player.svelte';
import { reach } from '$lib/mock/packs.svelte';
import { dim, palette } from '$lib/mock/theme';
+ import { dark as isDark } from '$lib/color';
import { route } from '$lib/mock/route.svelte';
import { radius, settings } from '$lib/mock/settings.svelte';
import { ADAPTIVE, scheme as siteScheme } from '$lib/scheme.svelte';
@@ -31,12 +32,21 @@
import Sidebar from './Sidebar.svelte';
import TitleBar from './TitleBar.svelte';
- /** Whether the panes stay still under the wheel until the visitor clicks in, for a window laid inline in a page the visitor is scrolling. */
- let { hold = false }: { hold?: boolean } = $props();
+ let {
+ hold = false,
+ colors,
+ floor = 0.62
+ }: {
+ /** Whether the panes stay still under the wheel until the visitor clicks in, for a window laid inline in a page the visitor is scrolling. */
+ hold?: boolean;
+ /** Every colour token by name, which the window wears instead of the theme picked in its settings. */
+ colors?: Record;
+ /** The least the window shrinks to before its stage scrolls sideways instead. */
+ floor?: number;
+ } = $props();
const WIDTH = 1170;
const HEIGHT = 730;
- const FLOOR = 0.62;
const FADE = 320;
/** The sidebars' limits, as the desktop's, and the least the page between them keeps. */
const LEFT_MIN = 160;
@@ -62,13 +72,27 @@
const at = $derived(route.now);
- const scale = $derived(Math.min(Math.max(room / WIDTH, FLOOR), 1));
+ const scale = $derived(Math.min(Math.max(room / WIDTH, floor), 1));
/** The adaptive theme wears the site's colour, so the window and the page around it always match. */
const tint = $derived(site.tint);
- const tokens = $derived(palette(tint, settings.adaptive, settings.theme));
+ const tokens = $derived(
+ colors
+ ? Object.fromEntries(
+ Object.entries(colors).map(([name, value]) => [`--m-${name.replaceAll('_', '-')}`, value])
+ )
+ : palette(tint, settings.adaptive, settings.theme)
+ );
const scheme = $derived(
- settings.theme === 'System' ? undefined : dim(settings.theme) ? 'dark' : 'light'
+ colors
+ ? isDark(colors.background)
+ ? 'dark'
+ : 'light'
+ : settings.theme === 'System'
+ ? undefined
+ : dim(settings.theme)
+ ? 'dark'
+ : 'light'
);
const style = $derived(
Object.entries(tokens)
@@ -225,29 +249,36 @@
{#if docked}
{/if}
- {#if at.screen === 'home'}
-
- {:else if at.screen === 'search'}
-
- {:else if at.screen === 'library'}
-
- {:else if at.screen === 'history'}
-
- {:else if at.screen === 'settings'}
- route.go({ screen: 'equalizer' })}
- />
- {:else if at.screen === 'equalizer'}
-
- {:else if at.screen === 'artist'}
-
- {:else if at.screen === 'playlist'}
-
- {:else}
-
- {/if}
+
+ {#if at.screen === 'home'}
+
+ {:else if at.screen === 'search'}
+
+ {:else if at.screen === 'library'}
+
+ {:else if at.screen === 'history'}
+
+ {:else if at.screen === 'settings'}
+
route.go({ screen: 'equalizer' })}
+ />
+ {:else if at.screen === 'equalizer'}
+
+ {:else if at.screen === 'artist'}
+
+ {:else if at.screen === 'playlist'}
+
+ {:else}
+
+ {/if}
+
{#if right && tab === 'members'}
{:else if right}
@@ -324,6 +355,42 @@
display: flex;
flex: 1;
min-height: 0;
+ background: var(--m-sidebar);
+ }
+
+ /* the page lies on the chrome as a sheet, edged and rounded wherever a sidebar or an opaque player bar meets it, square against the window */
+ .sheet {
+ --corner: calc(min(var(--m-radius), 10px) * 1.5);
+ position: relative;
+ display: flex;
+ flex: 1;
+ min-width: 0;
+ min-height: 0;
+ overflow: hidden;
+ background: var(--m-background);
+ border-top: 1px solid var(--m-sidebar-border);
+ }
+
+ .sheet.left {
+ border-left: 1px solid var(--m-sidebar-border);
+ border-top-left-radius: var(--corner);
+ }
+
+ .sheet.right {
+ border-right: 1px solid var(--m-sidebar-border);
+ border-top-right-radius: var(--corner);
+ }
+
+ .sheet.footed {
+ border-bottom: 1px solid var(--m-sidebar-border);
+ }
+
+ .sheet.footed.left {
+ border-bottom-left-radius: var(--corner);
+ }
+
+ .sheet.footed.right {
+ border-bottom-right-radius: var(--corner);
}
.dismiss {
diff --git a/src/lib/components/mock/Aside.svelte b/src/lib/components/mock/Aside.svelte
index 43144eb..320eb2f 100644
--- a/src/lib/components/mock/Aside.svelte
+++ b/src/lib/components/mock/Aside.svelte
@@ -377,8 +377,7 @@
flex-direction: column;
width: var(--m-right, 254px);
overflow: hidden;
- background: var(--m-background);
- border-left: 1px solid var(--m-border);
+ background: var(--m-sidebar);
}
.aside.stripped {
@@ -388,7 +387,6 @@
min-height: 0;
height: 100%;
background: none;
- border-left: 0;
}
.head {
@@ -399,7 +397,6 @@
gap: 7px;
height: 32px;
padding: 0 7px;
- border-bottom: 1px solid var(--m-border);
}
.eyebrow {
diff --git a/src/lib/components/mock/Members.svelte b/src/lib/components/mock/Members.svelte
index cba1783..726643a 100644
--- a/src/lib/components/mock/Members.svelte
+++ b/src/lib/components/mock/Members.svelte
@@ -78,8 +78,7 @@
flex-direction: column;
width: var(--m-right, 254px);
overflow: hidden;
- background: var(--m-background);
- border-left: 1px solid var(--m-border);
+ background: var(--m-sidebar);
}
.head {
@@ -88,7 +87,6 @@
align-items: center;
height: 32px;
padding: 0 7px;
- border-bottom: 1px solid var(--m-border);
}
.eyebrow {
diff --git a/src/lib/components/mock/PlayerBar.svelte b/src/lib/components/mock/PlayerBar.svelte
index 1f17d11..708e0b4 100644
--- a/src/lib/components/mock/PlayerBar.svelte
+++ b/src/lib/components/mock/PlayerBar.svelte
@@ -146,8 +146,8 @@
gap: 14px;
height: 76px;
padding: 0 17.5px;
- background: var(--m-secondary);
- border-top: 1px solid var(--m-border);
+ background: var(--m-sidebar);
+ border-top: 1px solid transparent;
}
.now {
@@ -236,9 +236,11 @@
gap: 7px;
}
+ /* glass over the page, the popover colour at 70% under a wide saturated blur, parted from the page by its own edge */
.frosted {
- background: color-mix(in srgb, var(--m-secondary) 72%, transparent);
- backdrop-filter: blur(24px) saturate(1.4);
+ background: color-mix(in srgb, var(--m-popover) 70%, transparent);
+ backdrop-filter: blur(18px) saturate(1.8);
+ border-top-color: var(--m-border);
}
.bar.compact {
diff --git a/src/lib/components/mock/Sidebar.svelte b/src/lib/components/mock/Sidebar.svelte
index 31cb989..bece4f5 100644
--- a/src/lib/components/mock/Sidebar.svelte
+++ b/src/lib/components/mock/Sidebar.svelte
@@ -92,7 +92,6 @@
scrollbar-width: thin;
scrollbar-color: color-mix(in srgb, var(--m-muted-foreground) 45%, transparent) transparent;
background: var(--m-sidebar);
- border-right: 1px solid var(--m-sidebar-border);
}
.row {
diff --git a/src/lib/components/mock/TitleBar.svelte b/src/lib/components/mock/TitleBar.svelte
index 5971bc8..d732b12 100644
--- a/src/lib/components/mock/TitleBar.svelte
+++ b/src/lib/components/mock/TitleBar.svelte
@@ -157,8 +157,8 @@
flex: none;
align-items: center;
height: 36px;
- background: var(--m-background);
- border-bottom: 1px solid var(--m-title-bar-border);
+ background: var(--m-sidebar);
+ border-bottom: 1px solid transparent;
}
/* the sidebar toggle sits as close to the history buttons as they sit to each other */
diff --git a/src/lib/creator.ts b/src/lib/creator.ts
new file mode 100644
index 0000000..6cf0086
--- /dev/null
+++ b/src/lib/creator.ts
@@ -0,0 +1,176 @@
+import { normal } from './color';
+import { themes as community, zip } from './data/themes';
+import { colorsOf, darkColors, FIELDS, themes as builtIn } from './mock/theme';
+import {
+ base64,
+ bytes,
+ check,
+ family,
+ format,
+ link,
+ read,
+ slug,
+ type Canonical
+} from './theme-file';
+
+/** A palette the theme creator can start from. */
+export type Source = {
+ id: string;
+ group: 'Built in' | 'Community';
+ title: string;
+ /** Every token as theme file hex. */
+ colors: Record;
+};
+
+/** One variant of a theme as the creator exports it, `label` being its part of the title. */
+export type Draft = { label: string; colors: Record };
+
+/** A theme the visitor brought in, every variant with its colours filled in. */
+export type Imported = { name: string; author: string; variants: Draft[] };
+
+/** A checked theme ready to save: its id and its files, sorted the way Sonora lists them. */
+export type Packed = { id: string; files: [string | null, Canonical][] };
+
+const LINK = 'sonora://theme/';
+const UNREADABLE = 'This is neither a theme file nor a theme link.';
+
+/** Sonora's own themes, then every variant in the community gallery. */
+export const sources: Source[] = [
+ ...builtIn
+ .filter((title) => title !== 'System')
+ .map((title) => ({
+ id: `built-in/${slug(title)}`,
+ group: 'Built in' as const,
+ title,
+ colors: hexes(colorsOf(title))
+ })),
+ ...community.flatMap((theme) =>
+ theme.variants.map((variant) => ({
+ id: `community/${theme.id}/${variant.id}`,
+ group: 'Community' as const,
+ title: variant.title,
+ colors: hexes(variant.colors)
+ }))
+ )
+];
+
+/** The palette the creator opens with. */
+export const DEFAULT_SOURCE = 'built-in/dark';
+
+/**
+ * Reads a theme the visitor pasted: the text of a theme file, a `sonora://theme/` link or the
+ * part of one after it. A link that carries a family brings every variant. Throws with a reason
+ * the page can show.
+ */
+export function bring(text: string): Imported {
+ const trimmed = text.trim();
+ let json = trimmed;
+ if (!trimmed.startsWith('{')) {
+ const payload = trimmed.startsWith(LINK) ? trimmed.slice(LINK.length) : trimmed;
+ try {
+ json = unbase64(payload);
+ } catch {
+ throw new Error(UNREADABLE);
+ }
+ }
+ let parsed: unknown;
+ try {
+ parsed = JSON.parse(json);
+ } catch {
+ throw new Error(UNREADABLE);
+ }
+ const fail = (reason: string): never => {
+ throw new Error(`${reason[0].toUpperCase()}${reason.slice(1)}.`);
+ };
+ const variants = (parsed as { variants?: Record }).variants;
+ const files = (variants ? Object.values(variants) : [parsed]).map((one) =>
+ read(JSON.stringify(one), fail)
+ );
+ if (!files.length) fail('the link carries no theme');
+ const named =
+ files.length > 1
+ ? family(
+ 'theme',
+ files.map((one) => one.name)
+ )
+ : { name: files[0].name, variants: [''] };
+ return {
+ name: named.name,
+ author: files[0].author,
+ variants: files.map((one, index) => ({
+ label: named.variants[index],
+ colors: Object.fromEntries(
+ FIELDS.map((token) => [token, normal(one.theme[token] ?? darkColors[token])])
+ )
+ }))
+ };
+}
+
+/**
+ * Checks the theme the way Sonora checks a link and returns its files. Every variant is titled
+ * with the theme's name and then its own label, which is how Sonora names a family back. Throws
+ * with a reason the page can show.
+ */
+export function pack(name: string, author: string, drafts: Draft[]): Packed {
+ const id = slug(name) || 'theme';
+ const single = drafts.length === 1;
+ const entries = drafts.map((draft, index): [string | null, string] => {
+ const title = single ? name : `${name.trim()} ${draft.label.trim()}`;
+ const theme: Canonical = {
+ name: title.trim(),
+ author: author.trim(),
+ version: 1,
+ theme: Object.fromEntries(FIELDS.map((token) => [token, normal(draft.colors[token])]))
+ };
+ const stem = single ? null : slug(draft.label) || `variant-${index + 1}`;
+ return [stem, JSON.stringify(theme)];
+ });
+ const files = check(id, entries, (reason) => {
+ throw new Error(`${reason[0].toUpperCase()}${reason.slice(1)}.`);
+ });
+ return { id, files };
+}
+
+/** The `sonora://theme/` link that installs a packed theme, or null when it is too long. */
+export function install({ id, files }: Packed): string | null {
+ try {
+ return link(id, files, (reason) => {
+ throw new Error(reason);
+ });
+ } catch {
+ return null;
+ }
+}
+
+/** What a theme link carries after `sonora://theme/`, which the creator's own link carries too. */
+export function payload({ id, files }: Packed): string {
+ const body =
+ files[0][0] === null ? files[0][1] : { family: id, variants: Object.fromEntries(files) };
+ return base64(bytes(JSON.stringify(body)))
+ .replace(/\+/g, '-')
+ .replace(/\//g, '_')
+ .replace(/=+$/, '');
+}
+
+/** The file to save: the theme file itself, or a zip of the folder for a family. */
+export function archive({ id, files }: Packed): { name: string; blob: Blob } {
+ if (files[0][0] === null) {
+ return {
+ name: `${id}.json`,
+ blob: new Blob([format(files[0][1])], { type: 'application/json' })
+ };
+ }
+ const data = zip(files.map(([stem, file]) => [`${id}/${stem}.json`, format(file)]));
+ return { name: `${id}.zip`, blob: new Blob([data as BlobPart], { type: 'application/zip' }) };
+}
+
+/** Every token of `colors` as theme file hex. */
+function hexes(colors: Record): Record {
+ return Object.fromEntries(FIELDS.map((token) => [token, normal(colors[token])]));
+}
+
+function unbase64(text: string): string {
+ const padded = text.replace(/-/g, '+').replace(/_/g, '/');
+ const binary = atob(padded + '='.repeat((4 - (padded.length % 4)) % 4));
+ return new TextDecoder().decode(Uint8Array.from(binary, (char) => char.charCodeAt(0)));
+}
diff --git a/src/lib/data/themes.ts b/src/lib/data/themes.ts
index d8fdf9a..ad7800e 100644
--- a/src/lib/data/themes.ts
+++ b/src/lib/data/themes.ts
@@ -160,7 +160,7 @@ function css(hex: string): string {
}
/** A zip archive that stores `entries`, each a path and its text, without compressing them. */
-function zip(entries: [string, string][]): Uint8Array {
+export function zip(entries: [string, string][]): Uint8Array {
const parts: Uint8Array[] = [];
const directory: Uint8Array[] = [];
let offset = 0;
diff --git a/src/lib/mock/theme.ts b/src/lib/mock/theme.ts
index e109a8b..b803b0d 100644
--- a/src/lib/mock/theme.ts
+++ b/src/lib/mock/theme.ts
@@ -36,7 +36,11 @@ export const FIELDS = [
'table_row_border',
'table_hover',
'table_active',
- 'table_active_border'
+ 'table_active_border',
+ 'status_error',
+ 'status_success',
+ 'status_warning',
+ 'status_info'
];
const SURFACES = new Set([
@@ -62,38 +66,38 @@ const TEXTS = new Set([
]);
const palettes: Record = {
- dark: '0a0a0a fafafa 50505066 262626 0000008c fafafa 909090 171717 36363666 4d4d4d66 fafafa 171717 e5e5e5b3 7f1d1d fef2f2 8b2020b3 141414 fafafa f5f5f5 1d4ed8 0a0a0a 50505066 262626 262626 171717cc 8a8a8a 262626b3 50505033 1e40af33 1d4ed8',
+ dark: '0b0b0b fafafa 50505066 262626 0000008c fafafa 909090 171717 36363666 4d4d4d66 fafafa 171717 e5e5e5b3 7f1d1d fef2f2 8b2020b3 141414 fafafa f5f5f5 1d4ed8 070707 50505066 181818 262626 171717cc 8a8a8a 262626b3 50505033 1e40af33 1d4ed8 ff6369 4ade80 fbbf24 60a5fa',
light:
- 'fafafa 171717 9b9b9b66 e5e5e5 0000008c fafafa 606060 f5f5f5 d5d5d566 b7b7b766 171717 fafafa 262626b3 b91c1c fef2f2 991b1bb3 ffffff 171717 262626 2563eb f5f5f5 cdcdcd66 d4d4d4 d4d4d4 f5f5f5e6 666666 d4d4d4b3 cdcdcd33 2563eb1f 2563eb',
+ 'fafafa 171717 9b9b9b66 e5e5e5 0000008c fafafa 606060 f5f5f5 d5d5d566 b7b7b766 171717 fafafa 262626b3 b91c1c fef2f2 991b1bb3 ffffff 171717 262626 2563eb ededed cdcdcd66 e4e4e4 d4d4d4 f5f5f5e6 666666 d4d4d4b3 cdcdcd33 2563eb1f 2563eb dc2626 16a34a d97706 2563eb',
'catppuccin-latte':
- 'eff1f5 4c4f69 acb0be66 ccd0da 0000008c eff1f5 6c6f85 e6e9ef ccd0da66 bcc0cc66 8839ef eff1f5 7430cbb3 d20f39 eff1f5 b20d30b3 eff1f5 4c4f69 8839ef 8839ef eff1f5 bcc0cc66 ccd0da ccd0da e6e9efe6 6c6f85 ccd0dab3 ccd0da66 8839ef33 8839ef',
+ 'eff1f5 4c4f69 acb0be66 ccd0da 0000008c eff1f5 6c6f85 e6e9ef ccd0da66 bcc0cc66 8839ef eff1f5 7430cbb3 d20f39 eff1f5 b20d30b3 eff1f5 4c4f69 8839ef 8839ef e6e9ef bcc0cc66 ccd0da ccd0da e6e9efe6 6c6f85 ccd0dab3 ccd0da66 8839ef33 8839ef ff6369 4ade80 fbbf24 60a5fa',
'catppuccin-frappe':
- '303446 c6d0f5 62688066 51576d 0000008c c6d0f5 a5adce 414559 51576d66 62688066 ca9ee6 232634 d7b6ecb3 e78284 232634 eda1a3b3 292c3c c6d0f5 ca9ee6 ca9ee6 303446 62688066 414559 414559 292c3ce6 949cbb 414559b3 51576d66 ca9ee633 ca9ee6',
+ '303446 c6d0f5 62688066 51576d 0000008c c6d0f5 a5adce 414559 51576d66 62688066 ca9ee6 232634 d7b6ecb3 e78284 232634 eda1a3b3 292c3c c6d0f5 ca9ee6 ca9ee6 292c3c 62688066 414559 414559 292c3ce6 949cbb 414559b3 51576d66 ca9ee633 ca9ee6 ff6369 4ade80 fbbf24 60a5fa',
'catppuccin-macchiato':
- '24273a cad3f5 5b607866 494d64 0000008c cad3f5 a5adcb 363a4f 494d6466 5b607866 c6a0f6 181926 d4b8f8b3 ed8796 181926 f2a5b0b3 1e2030 cad3f5 c6a0f6 c6a0f6 24273a 5b607866 363a4f 363a4f 1e2030e6 939ab7 363a4fb3 494d6466 c6a0f633 c6a0f6',
+ '24273a cad3f5 5b607866 494d64 0000008c cad3f5 a5adcb 363a4f 494d6466 5b607866 c6a0f6 181926 d4b8f8b3 ed8796 181926 f2a5b0b3 1e2030 cad3f5 c6a0f6 c6a0f6 1e2030 5b607866 363a4f 363a4f 1e2030e6 939ab7 363a4fb3 494d6466 c6a0f633 c6a0f6 ff6369 4ade80 fbbf24 60a5fa',
'catppuccin-mocha':
- '1e1e2e cdd6f4 585b7066 45475a 0000008c cdd6f4 a6adc8 313244 45475a66 585b7066 cba6f7 11111b d8bcf9b3 f38ba8 11111b f6a8beb3 181825 cdd6f4 cba6f7 cba6f7 1e1e2e 585b7066 313244 313244 181825e6 9399b2 313244b3 45475a66 cba6f733 cba6f7',
+ '1e1e2e cdd6f4 585b7066 45475a 0000008c cdd6f4 a6adc8 313244 45475a66 585b7066 cba6f7 11111b d8bcf9b3 f38ba8 11111b f6a8beb3 181825 cdd6f4 cba6f7 cba6f7 181825 585b7066 313244 313244 181825e6 9399b2 313244b3 45475a66 cba6f733 cba6f7 ff6369 4ade80 fbbf24 60a5fa',
dracula:
- '282a36 f8f8f2 6272a466 44475a 0000008c f8f8f2 b4bccf 343746 44475a66 6272a466 bd93f9 282a36 ceaefab3 ff5555 282a36 ff8080b3 21222c f8f8f2 bd93f9 bd93f9 282a36 6272a466 343746 343746 21222ce6 b4bccf 343746b3 44475a66 bd93f933 bd93f9',
+ '282a36 f8f8f2 6272a466 44475a 0000008c f8f8f2 b4bccf 343746 44475a66 6272a466 bd93f9 282a36 ceaefab3 ff5555 282a36 ff8080b3 21222c f8f8f2 bd93f9 bd93f9 21222c 6272a466 343746 343746 21222ce6 b4bccf 343746b3 44475a66 bd93f933 bd93f9 ff6369 4ade80 fbbf24 60a5fa',
'gruvbox-dark':
- '282828 ebdbb2 665c5466 3c3836 0000008c ebdbb2 a89984 32302f 50494566 665c5466 fe8019 282828 fea052b3 fb4934 282828 fc7667b3 32302f ebdbb2 fe8019 fe8019 282828 665c5466 3c3836 3c3836 282828e6 928374 3c3836b3 50494566 fe801933 fe8019',
+ '282828 ebdbb2 665c5466 3c3836 0000008c ebdbb2 a89984 32302f 50494566 665c5466 fe8019 282828 fea052b3 fb4934 282828 fc7667b3 32302f ebdbb2 fe8019 fe8019 1d2021 665c5466 3c3836 3c3836 282828e6 928374 3c3836b3 50494566 fe801933 fe8019 ff6369 4ade80 fbbf24 60a5fa',
'gruvbox-dark-hard':
- '1d2021 ebdbb2 665c5466 3c3836 0000008c ebdbb2 a89984 282828 50494566 665c5466 fe8019 1d2021 fea052b3 fb4934 1d2021 fc7667b3 282828 ebdbb2 fe8019 fe8019 1d2021 665c5466 3c3836 3c3836 1d2021e6 928374 3c3836b3 50494566 fe801933 fe8019',
+ '1d2021 ebdbb2 665c5466 3c3836 0000008c ebdbb2 a89984 282828 50494566 665c5466 fe8019 1d2021 fea052b3 fb4934 1d2021 fc7667b3 282828 ebdbb2 fe8019 fe8019 141617 665c5466 3c3836 3c3836 1d2021e6 928374 3c3836b3 50494566 fe801933 fe8019 ff6369 4ade80 fbbf24 60a5fa',
'gruvbox-light':
- 'fbf1c7 3c3836 a8998466 ebdbb2 0000008c ebdbb2 7c6f64 f2e5bc d5c4a166 bdae9366 af3a03 fbf1c7 953103b3 9d0006 fbf1c7 850005b3 fbf1c7 3c3836 af3a03 af3a03 fbf1c7 bdae9366 d5c4a1 d5c4a1 f2e5bce6 7c6f64 d5c4a1b3 d5c4a166 af3a0333 af3a03',
+ 'fbf1c7 3c3836 a8998466 ebdbb2 0000008c ebdbb2 7c6f64 f2e5bc d5c4a166 bdae9366 af3a03 fbf1c7 953103b3 9d0006 fbf1c7 850005b3 fbf1c7 3c3836 af3a03 af3a03 f2e5bc bdae9366 d5c4a1 d5c4a1 f2e5bce6 7c6f64 d5c4a1b3 d5c4a166 af3a0333 af3a03 ff6369 4ade80 fbbf24 60a5fa',
'gruvbox-light-hard':
- 'f9f5d7 3c3836 a8998466 ebdbb2 0000008c ebdbb2 7c6f64 f2e5bc d5c4a166 bdae9366 af3a03 f9f5d7 953103b3 9d0006 f9f5d7 850005b3 f9f5d7 3c3836 af3a03 af3a03 f9f5d7 bdae9366 d5c4a1 d5c4a1 f2e5bce6 7c6f64 d5c4a1b3 d5c4a166 af3a0333 af3a03',
- nord: '2e3440 d8dee9 4c566a66 434c5e 0000008c eceff4 a0a8b6 3b4252 4c566a66 616a7d66 88c0d0 2e3440 a6d0dcb3 bf616a eceff4 cf888fb3 3b4252 d8dee9 88c0d0 88c0d0 2e3440 4c566a66 3b4252 3b4252 2e3440e6 a0a8b6 3b4252b3 4c566a66 88c0d033 88c0d0',
+ 'f9f5d7 3c3836 a8998466 ebdbb2 0000008c ebdbb2 7c6f64 f2e5bc d5c4a166 bdae9366 af3a03 f9f5d7 953103b3 9d0006 f9f5d7 850005b3 f9f5d7 3c3836 af3a03 af3a03 f2e5bc bdae9366 d5c4a1 d5c4a1 f2e5bce6 7c6f64 d5c4a1b3 d5c4a166 af3a0333 af3a03 ff6369 4ade80 fbbf24 60a5fa',
+ nord: '2e3440 d8dee9 4c566a66 434c5e 0000008c eceff4 a0a8b6 3b4252 4c566a66 616a7d66 88c0d0 2e3440 a6d0dcb3 bf616a eceff4 cf888fb3 3b4252 d8dee9 88c0d0 88c0d0 272c36 4c566a66 3b4252 3b4252 2e3440e6 a0a8b6 3b4252b3 4c566a66 88c0d033 88c0d0 ff6369 4ade80 fbbf24 60a5fa',
'rose-pine-main':
- '191724 e0def4 524f6766 403d52 0000008c e0def4 908caa 1f1d2e 403d5266 524f6766 c4a7e7 191724 d3bdedb3 eb6f92 191724 f093adb3 26233a e0def4 c4a7e7 c4a7e7 191724 524f6766 403d52 403d52 1f1d2ee6 908caa 403d52b3 403d5266 c4a7e733 c4a7e7',
+ '191724 e0def4 524f6766 403d52 0000008c e0def4 908caa 1f1d2e 403d5266 524f6766 c4a7e7 191724 d3bdedb3 eb6f92 191724 f093adb3 26233a e0def4 c4a7e7 c4a7e7 16141f 524f6766 403d52 403d52 1f1d2ee6 908caa 403d52b3 403d5266 c4a7e733 c4a7e7 ff6369 4ade80 fbbf24 60a5fa',
'rose-pine-moon':
- '232136 e0def4 56526e66 44415a 0000008c e0def4 908caa 2a273f 44415a66 56526e66 c4a7e7 232136 d3bdedb3 eb6f92 232136 f093adb3 393552 e0def4 c4a7e7 c4a7e7 232136 56526e66 44415a 44415a 2a273fe6 908caa 44415ab3 44415a66 c4a7e733 c4a7e7',
+ '232136 e0def4 56526e66 44415a 0000008c e0def4 908caa 2a273f 44415a66 56526e66 c4a7e7 232136 d3bdedb3 eb6f92 232136 f093adb3 393552 e0def4 c4a7e7 c4a7e7 1f1d30 56526e66 44415a 44415a 2a273fe6 908caa 44415ab3 44415a66 c4a7e733 c4a7e7 ff6369 4ade80 fbbf24 60a5fa',
'rose-pine-dawn':
- 'faf4ed 575279 cecacd66 dfdad9 0000008c faf4ed 797593 fffaf3 dfdad966 cecacd66 907aa9 fffaf3 7a6890b3 b4637a fffaf3 995468b3 f2e9e1 575279 907aa9 907aa9 faf4ed cecacd66 dfdad9 dfdad9 fffaf3e6 797593 dfdad9b3 dfdad966 907aa933 907aa9',
+ 'faf4ed 575279 cecacd66 dfdad9 0000008c faf4ed 797593 fffaf3 dfdad966 cecacd66 907aa9 fffaf3 7a6890b3 b4637a fffaf3 995468b3 f2e9e1 575279 907aa9 907aa9 f2e9e1 cecacd66 dfdad9 dfdad9 fffaf3e6 797593 dfdad9b3 dfdad966 907aa933 907aa9 ff6369 4ade80 fbbf24 60a5fa',
'solarized-dark':
- '002b36 93a1a1 586e7566 1f4751 0000008c eee8d5 839496 073642 586e7566 657b8366 268bd2 002b36 5ca8ddb3 dc322f fdf6e3 e56563b3 073642 93a1a1 268bd2 268bd2 002b36 586e7566 073642 073642 002b36e6 839496 073642b3 586e7566 268bd233 268bd2',
+ '002b36 93a1a1 586e7566 1f4751 0000008c eee8d5 839496 073642 586e7566 657b8366 268bd2 002b36 5ca8ddb3 dc322f fdf6e3 e56563b3 073642 93a1a1 268bd2 268bd2 00212b 586e7566 073642 073642 002b36e6 839496 073642b3 586e7566 268bd233 268bd2 ff6369 4ade80 fbbf24 60a5fa',
'solarized-light':
- 'fdf6e3 586e75 93a1a166 d3d3c5 0000008c fdf6e3 657b83 eee8d5 93a1a166 83949666 268bd2 fdf6e3 2076b2b3 dc322f fdf6e3 bb2a28b3 fdf6e3 586e75 268bd2 268bd2 fdf6e3 93a1a166 eee8d5 eee8d5 eee8d5e6 657b83 eee8d5b3 93a1a166 268bd233 268bd2'
+ 'fdf6e3 586e75 93a1a166 d3d3c5 0000008c fdf6e3 657b83 eee8d5 93a1a166 83949666 268bd2 fdf6e3 2076b2b3 dc322f fdf6e3 bb2a28b3 fdf6e3 586e75 268bd2 268bd2 eee8d5 93a1a166 e4ddc8 eee8d5 eee8d5e6 657b83 eee8d5b3 93a1a166 268bd233 268bd2 ff6369 4ade80 fbbf24 60a5fa'
};
const kinds: Record = {
diff --git a/src/lib/theme-tokens.ts b/src/lib/theme-tokens.ts
new file mode 100644
index 0000000..f4b7db8
--- /dev/null
+++ b/src/lib/theme-tokens.ts
@@ -0,0 +1,90 @@
+/** A group of colour tokens that paint one part of the window. */
+export type TokenGroup = { area: string; tokens: string[] };
+
+/**
+ * A pair of colours Sonora draws one on the other. `over` is the opaque colour under a
+ * translucent `on`. `text` pairs need 4.5:1 to read, graphic ones 3:1 to be seen.
+ */
+export type Pairing = { front: string; on: string; over?: string; kind: 'text' | 'graphic' };
+
+/** Every colour token, grouped the way the docs and the theme creator list them. */
+export const groups: TokenGroup[] = [
+ {
+ area: 'Page and text',
+ tokens: ['background', 'foreground', 'muted_foreground', 'muted', 'border']
+ },
+ {
+ area: 'Buttons',
+ tokens: [
+ 'secondary',
+ 'secondary_hover',
+ 'secondary_active',
+ 'primary',
+ 'primary_foreground',
+ 'primary_hover',
+ 'danger',
+ 'danger_foreground',
+ 'danger_hover'
+ ]
+ },
+ {
+ area: 'Chrome',
+ tokens: ['sidebar', 'sidebar_accent', 'sidebar_border', 'title_bar_border']
+ },
+ {
+ area: 'Menus and overlays',
+ tokens: ['popover', 'popover_foreground', 'overlay', 'overlay_foreground']
+ },
+ {
+ area: 'Lists and tables',
+ tokens: [
+ 'table_head',
+ 'table_head_foreground',
+ 'table_row_border',
+ 'table_hover',
+ 'table_active',
+ 'table_active_border'
+ ]
+ },
+ {
+ area: 'Accents',
+ tokens: [
+ 'progress_bar',
+ 'selection',
+ 'status_error',
+ 'status_success',
+ 'status_warning',
+ 'status_info'
+ ]
+ }
+];
+
+/** The colour pairs Sonora draws one on the other, which a theme has to keep apart. */
+export const pairings: Pairing[] = [
+ { front: 'foreground', on: 'background', kind: 'text' },
+ { front: 'muted_foreground', on: 'background', kind: 'text' },
+ { front: 'foreground', on: 'sidebar', kind: 'text' },
+ { front: 'muted_foreground', on: 'sidebar', kind: 'text' },
+ { front: 'foreground', on: 'sidebar_accent', over: 'sidebar', kind: 'text' },
+ { front: 'foreground', on: 'secondary', over: 'background', kind: 'text' },
+ { front: 'foreground', on: 'secondary_hover', over: 'background', kind: 'text' },
+ { front: 'foreground', on: 'secondary_active', over: 'background', kind: 'text' },
+ { front: 'muted_foreground', on: 'secondary_active', over: 'background', kind: 'text' },
+ { front: 'popover_foreground', on: 'secondary_active', over: 'popover', kind: 'text' },
+ { front: 'foreground', on: 'muted', over: 'background', kind: 'text' },
+ { front: 'foreground', on: 'table_hover', over: 'background', kind: 'text' },
+ { front: 'foreground', on: 'table_active', over: 'background', kind: 'text' },
+ { front: 'table_head_foreground', on: 'table_head', over: 'background', kind: 'text' },
+ { front: 'primary_foreground', on: 'primary', over: 'background', kind: 'text' },
+ { front: 'primary_foreground', on: 'primary_hover', over: 'background', kind: 'text' },
+ { front: 'danger_foreground', on: 'danger', over: 'background', kind: 'text' },
+ { front: 'danger_foreground', on: 'danger_hover', over: 'background', kind: 'text' },
+ { front: 'popover_foreground', on: 'popover', over: 'background', kind: 'text' },
+ { front: 'popover_foreground', on: 'secondary_hover', over: 'popover', kind: 'text' },
+ { front: 'primary', on: 'background', kind: 'graphic' },
+ { front: 'progress_bar', on: 'sidebar', kind: 'graphic' },
+ { front: 'status_error', on: 'popover', kind: 'graphic' },
+ { front: 'status_success', on: 'popover', kind: 'graphic' },
+ { front: 'status_warning', on: 'popover', kind: 'graphic' },
+ { front: 'status_info', on: 'popover', kind: 'graphic' }
+];
diff --git a/src/routes/docs/themes/+page.svelte b/src/routes/docs/themes/+page.svelte
index bc8b086..6d17dde 100644
--- a/src/routes/docs/themes/+page.svelte
+++ b/src/routes/docs/themes/+page.svelte
@@ -1,6 +1,7 @@
@@ -119,7 +71,8 @@
- To share your theme, submit it.
+ The theme creator shows where each color goes. To share your theme,
+ submit it.
Variants
@@ -138,12 +91,12 @@
Color tokens
- {#each tokens as group (group.area)}
+ {#each groups as group (group.area)}
| {group.area} |
- {#each group.names as name, index (name)}{name}{index <
- group.names.length - 1
+ {#each group.tokens as name, index (name)}{name}{index <
+ group.tokens.length - 1
? ' '
: ''}{/each}
|
diff --git a/src/routes/themes/+page.svelte b/src/routes/themes/+page.svelte
index a8d7273..89c2f57 100644
--- a/src/routes/themes/+page.svelte
+++ b/src/routes/themes/+page.svelte
@@ -90,7 +90,8 @@
Themes
Community themes
- Want to contribute? Write a theme, then
+ Want to contribute? Make one in the theme creator or
+ write it by hand, then
submit it.
diff --git a/src/routes/themes/creator/+page.svelte b/src/routes/themes/creator/+page.svelte
new file mode 100644
index 0000000..1f0d9ce
--- /dev/null
+++ b/src/routes/themes/creator/+page.svelte
@@ -0,0 +1,1135 @@
+
+
+
+ Theme creator · Sonora
+
+
+
+
+
+
+
+ {#if link}
+
Open in Sonora
+ {:else}
+
+ {/if}
+
+
+
+
+ {#if 'problem' in packed}
+ {packed.problem}
+ {:else if notice}
+ {notice}
+ {/if}
+
+
+
+
+
+
+ {shown.length} of {FIELDS.length} on this screen
+
+
+
+
+
+
+
+
+
diff --git a/src/routes/themes/submit/+page.svelte b/src/routes/themes/submit/+page.svelte
index 539b955..186f948 100644
--- a/src/routes/themes/submit/+page.svelte
+++ b/src/routes/themes/submit/+page.svelte
@@ -20,6 +20,8 @@
const TEST_KEY = '1x00000000000000000000AA';
const SITE_KEY: string = import.meta.env.VITE_TURNSTILE_SITE_KEY || TEST_KEY;
const taken = new Set(themes.map((theme) => theme.id));
+ /** Where the theme creator leaves the files it hands this form. */
+ const HANDOFF = 'sonora-theme-creator-handoff';
let added: Added[] = $state([]);
let pasting = $state(false);
@@ -79,6 +81,16 @@
const ready = $derived('variants' in result && tested && rights && !!token && !sending);
onMount(() => {
+ if (new URLSearchParams(location.search).has('from')) {
+ try {
+ const handed = JSON.parse(sessionStorage.getItem(HANDOFF) ?? '[]') as {
+ stem: string;
+ text: string;
+ }[];
+ sessionStorage.removeItem(HANDOFF);
+ if (!added.length) for (const file of handed) add(file.stem, 'Theme creator', file.text);
+ } catch {}
+ }
const render = () => {
widgetId = window.turnstile!.render(widget!, {
sitekey: SITE_KEY,
From febd10512c08f3e7c9f249f15e26edfc2f84d949 Mon Sep 17 00:00:00 2001
From: nolight132
Date: Sun, 29 Nov 2026 13:43:21 +0100
Subject: [PATCH 02/27] fix(themes): show the creator's labels at once and
restyle its sliders
---
src/lib/components/TokenMap.svelte | 119 ++++++++++++++++---------
src/routes/themes/creator/+page.svelte | 96 ++++++++++++--------
2 files changed, 134 insertions(+), 81 deletions(-)
diff --git a/src/lib/components/TokenMap.svelte b/src/lib/components/TokenMap.svelte
index 457fec2..e6e36ab 100644
--- a/src/lib/components/TokenMap.svelte
+++ b/src/lib/components/TokenMap.svelte
@@ -74,6 +74,8 @@
let placed = $state