diff --git a/.changeset/nightly-sky.md b/.changeset/nightly-sky.md new file mode 100644 index 00000000..aa669a0d --- /dev/null +++ b/.changeset/nightly-sky.md @@ -0,0 +1,2 @@ +### Changes +- **Stroke Nightly looks like Nightly** - Its title bar has a night sky behind it: a violet glow from the left, stars that twinkle out of step, and now and then a shooting star. A 1px violet to amber line runs along the top of the window. Light themes keep the glow and the line without the stars. Stable looks as before, and the sky holds still with reduced motion turned on. diff --git a/src/App.svelte b/src/App.svelte index d531a4f4..715909f3 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -3,6 +3,7 @@ import { onMount } from 'svelte' import { Toaster } from '$lib/components/ui/sonner/index.js' import ZoomIndicator from '$lib/components/ZoomIndicator.svelte' + import NightlyEdge from '$lib/components/NightlyEdge.svelte' import StudioShell from './lib/components/StudioShell.svelte' @@ -94,6 +95,7 @@ + .flex-1 { flex-basis: auto; } + +/* Stroke Nightly: a violet to amber accent and a night sky behind the title + bar, only on Nightly builds (NightlyEdge.svelte, NightlySky.svelte). */ +:root { + --nightly-a: oklch(0.62 0.19 295); + --nightly-b: oklch(0.76 0.15 65); + --nightly-glow: oklch(0.62 0.19 295 / 0.2); + --nightly-glow-2: oklch(0.6 0.16 255 / 0.12); + --nightly-star: oklch(0.55 0.17 295 / 0.75); +} +.dark { + --nightly-a: oklch(0.7 0.17 295); + --nightly-b: oklch(0.8 0.14 65); + --nightly-glow: oklch(0.5 0.2 295 / 0.32); + --nightly-glow-2: oklch(0.45 0.16 260 / 0.24); + --nightly-star: oklch(0.97 0.02 290 / 0.9); +} +.nightly-edge { + background: linear-gradient(90deg, transparent, var(--nightly-a) 30%, var(--nightly-b) 70%, transparent); + opacity: 0.85; +} +.nightly-sky { + background: + radial-gradient(120% 160% at 0% 0%, var(--nightly-glow), transparent 55%), + radial-gradient(80% 140% at 28% 120%, var(--nightly-glow-2), transparent 60%); +} +.nightly-star { + background: var(--nightly-star); + box-shadow: 0 0 3px var(--nightly-star); + animation: nightly-twinkle 5.5s ease-in-out infinite; +} +@keyframes nightly-twinkle { + 0%, 100% { opacity: 0.25; } + 50% { opacity: 1; } +} +/* One streak, mostly idle: crosses the left of the bar for ~0.8s every 18s. */ +.nightly-shooting-star { + left: 6%; + top: 10%; + width: 56px; + height: 1px; + background: linear-gradient(90deg, transparent, var(--nightly-star)); + opacity: 0; + transform: rotate(11deg); + animation: nightly-shoot 18s ease-out 4s infinite; +} +@keyframes nightly-shoot { + 0%, 95% { opacity: 0; transform: translate(0, 0) rotate(11deg); } + 96% { opacity: 1; } + 100% { opacity: 0; transform: translate(160px, 32px) rotate(11deg); } +} +/* A light bar is a daytime sky: the glow stays, stars on it read as dust. */ +:root:not(.dark) .nightly-star, +:root:not(.dark) .nightly-shooting-star { display: none; } +@media (prefers-reduced-motion: reduce) { + .nightly-star { animation: none; opacity: 0.7; } + .nightly-shooting-star { display: none; } +} diff --git a/src/lib/build-track.js b/src/lib/build-track.js new file mode 100644 index 00000000..dbfae27a --- /dev/null +++ b/src/lib/build-track.js @@ -0,0 +1,23 @@ +/** + * Which app this is: Stroke or Stroke Nightly. Nightly's version carries a + * build stamp, `3.7.7-nightly.202611240456`; Stable's is plain `3.7.7`. + */ +import { derived, writable } from 'svelte/store' + +/** The running app's version, '' until Tauri answers (and in browser dev). */ +export const appVersion = writable('') + +if (typeof window !== 'undefined' && '__TAURI_INTERNALS__' in window) { + void import('@tauri-apps/api/app') + .then((m) => m.getVersion()) + .then((v) => appVersion.set(v)) + .catch(() => {}) +} + +/** @param {string} version */ +export function isNightlyVersion(version) { + return /-nightly\.\d+/.test(version) +} + +export const isNightly = derived(appVersion, (v) => isNightlyVersion(v)) + diff --git a/src/lib/build-track.test.js b/src/lib/build-track.test.js new file mode 100644 index 00000000..f2dab6d8 --- /dev/null +++ b/src/lib/build-track.test.js @@ -0,0 +1,10 @@ +import { describe, it, expect } from 'vitest' +import { isNightlyVersion } from './build-track.js' + +describe('build track', () => { + it('tells Nightly from Stable by the version', () => { + expect(isNightlyVersion('3.7.7-nightly.202611240456')).toBe(true) + expect(isNightlyVersion('3.7.7')).toBe(false) + expect(isNightlyVersion('')).toBe(false) + }) +}) diff --git a/src/lib/components/NightlyEdge.svelte b/src/lib/components/NightlyEdge.svelte new file mode 100644 index 00000000..6c468ccc --- /dev/null +++ b/src/lib/components/NightlyEdge.svelte @@ -0,0 +1,11 @@ + + +{#if $isNightly} + +{/if} diff --git a/src/lib/components/NightlySky.svelte b/src/lib/components/NightlySky.svelte new file mode 100644 index 00000000..8a4bb2b4 --- /dev/null +++ b/src/lib/components/NightlySky.svelte @@ -0,0 +1,35 @@ + + +{#if $isNightly} + +{/if} diff --git a/src/lib/components/SettingsDialog.svelte b/src/lib/components/SettingsDialog.svelte index 29a52171..38191c68 100644 --- a/src/lib/components/SettingsDialog.svelte +++ b/src/lib/components/SettingsDialog.svelte @@ -1,5 +1,6 @@