From 43e032a81aa5aaa7be51ae637ad7c9872c795f60 Mon Sep 17 00:00:00 2001 From: bordoypoldaniel-max Date: Fri, 4 Dec 2026 19:42:52 +0800 Subject: [PATCH] add Aura Theme --- themes/aura-theme/README.md | 98 ++ themes/aura-theme/manifest.json | 24 + themes/aura-theme/theme.css | 1469 +++++++++++++++++++++++++++ themes/aura-theme/theme.js | 1684 +++++++++++++++++++++++++++++++ 4 files changed, 3275 insertions(+) create mode 100644 themes/aura-theme/README.md create mode 100644 themes/aura-theme/manifest.json create mode 100644 themes/aura-theme/theme.css create mode 100644 themes/aura-theme/theme.js diff --git a/themes/aura-theme/README.md b/themes/aura-theme/README.md new file mode 100644 index 0000000..fcdeec3 --- /dev/null +++ b/themes/aura-theme/README.md @@ -0,0 +1,98 @@ +# Aura Theme + +Atmospheric reactive glass theme for LastWave Desktop, with six skins and a draggable, resizable **Orbit Deck**. + +## Install + +1. In LastWave open **Settings → Plugins → Install Local Plugin**. +2. Choose **Choose Folder** and pick this `aura-theme` folder (the one containing `manifest.json`). +3. Click **Install & Activate**. + +Needs LastWave 3.0.0 or newer. + +## Skins + +Nebula, Pop-Out, Dusk, Cobalt, Prism and Obsidian. Pick one from the chips on the theme's Store page, from the pills in the Orbit Deck, or press **Alt+S** to cycle. **Prism** takes its colours from the current cover art. + +## Orbit Deck + +A floating player with cover art, live spectrum, transport controls and a like button. + +| Action | How | +| --- | --- | +| Move | Drag the header. It snaps to the window edges. | +| Resize | Drag the bottom-right corner. | +| Show / hide | **Alt+A**, the ✕ button, or the sparkle button in the player bar | +| Focus stage | **Alt+F** or the ◎ button | +| Bars / ring visualizer | The ◈ button | +| Scroll the skin pills | Mouse wheel over them | + +The deck hides itself while the Mini Player is open, and docks into a compact strip in very small windows. Shortcuts are ignored while you are typing in a text field. + +## Mini Player widget modes + +When the Mini Player window opens, Aura draws its own compact card there. The icon row on the top-left switches the card between widget looks; the choice is remembered across restarts. + +| Look | Replicates | +| --- | --- | +| ◉ Vinyl | Vinyl Spinner: spinning record with the cover label, tonearm, RPM readout and progress bar | +| ▣ Cassette | Cassette Deck: reels that wind with progress and a PLAY / PAUSE timer | +| >_ Terminal | Terminal Log: green-phosphor command lines with ASCII progress and elapsed time | +| ♥ Pet | Wavegotchi: pixel pet that dances while playing and naps when paused | +| ◍ Deck | Aura Orbit Deck: spinning platter, spectrum bars and codec pill | + +Every look keeps previous / play-pause / like, a click-to-seek progress strip, and window controls (minimize, expand to window, close). + +**Lyrics switch:** the `Lyrics` pill on the top-right toggles a lyric strip under the stage. Synced lines follow the playback position; plain (unsynced) lyrics rotate while playing; instrumental tracks show the `♪︎` glyph. The switch state persists. + +Tip: for the most room, set **Settings → Playback → Mini Player Style** to *Compact strip* or *Ambient wide*. If the theme script fails to mount, the app's native mini player stays visible as a fallback. + +## Notes + +- Your skin choice is remembered across restarts. The theme stores it itself, so it works on every LastWave 3.0.0+ build; a skin picked on the theme's Store page still wins the first time you install. +- Animation is switched off when your system is set to reduce motion, and the visualiser rests when Performance Mode is on. + +## Changelog + +### 2.1.3 +- **Fixed (root cause):** mini snapshot was reading `LastWave.getCurrentTrack/isPlaying/getPosition` directly; these live under `LastWave.player`, so the card always saw "no track / paused" — the play icon never flipped and lyrics were never requested. Now reads `LastWave.player.*`. +- **Lyrics:** subscribes to the app's `lyrics-partial` Tauri events and adopts its fetched lines, in addition to the theme's own `lyrics_fetch`; empty results now show `No lyrics found` instead of a bare note glyph. + +### 2.1.2 +- **Fixed:** play/pause button now flips its icon immediately on click and on `playState` events. +- **Fixed:** minimize and close buttons reuse the app's native mini-player glyph handlers (with a Tauri `plugin:window:*` fallback), so they actually minimize and close. +- **Fixed:** lyrics strip always renders text when the switch is on (`Loading lyrics…`, native lyric line fallback, `No lyrics found`, `♪︎ instrumental`); fetch failures log to the console instead of failing silently. +- **Fixed:** deck wiring is error-isolated and the frame loop no longer depends on the mini-window detection heuristic, so a failure in one look cannot freeze the card. + +### 2.1.1 +- **Fixed:** the mini card now refreshes from `progress` / `playState` / `trackChange` events as well as the frame loop, so times, progress and the play button stay live; unknown durations show `--:--` instead of a frozen `0:00 / 0:00`. +- **Fixed:** vinyl disc rotation is CSS-driven while playing; per-look frame errors are isolated so one failing look cannot freeze the whole card. +- **Fixed:** the lyrics strip shows `Loading lyrics…`, `No lyrics found` or the instrumental marker instead of staying blank; click-to-seek falls back to the track's own duration; event listeners are removed when the card closes. + +### 2.1.0 +- **Added:** Mini Player widget modes — the mini window now renders a card that matches the Vinyl Spinner, Cassette Deck, Terminal Log, Wavegotchi, or the Aura Orbit Deck widget; switch looks from the icon row on the card, and the choice persists. +- **Added:** on-card **Lyrics switch** that shows or hides the current lyric line: synced lines track playback, plain lyrics rotate while playing, instrumentals show `♪︎`. +- **Improved:** the mini card provides transport, like, click-to-seek progress and window controls; the app's native mini player remains as a fallback when the theme card does not mount. + +### 2.0.3 +- **Fixed:** the skin picked in the deck now actually survives a restart. LastWave has no `LastWave.theme.setVariant`, and its own variant (defaulting to Nebula) overrode the saved choice on every start; the theme now restores its own saved skin first and only follows the app's variant when nothing is saved yet. +- **Fixed:** in very small windows the compact deck strip overflowed — the visualiser canvas fed its own pixel size back into its layout and ballooned the stage far past the 76 px strip. The stage, telemetry column and canvas now get definite heights. +- **Fixed:** `--lw-scrollbar-thumb` was a gradient; the app also feeds that token to `scrollbar-color`, which only accepts colours, so the declaration was dropped. It's a colour now. +- **Fixed:** play buttons and the active skin pill used hard-coded white text; they now use the skin's `on-accent` colour, which keeps contrast on the pale Cobalt accent and the dark-on-light Pop-Out/Obsidian accents. +- **Fixed:** the visualiser read only the first 28 of the 48 spectrum bands, so the top half of the spectrum was never shown. Bars now average slices across all bands. +- **Fixed:** the visualiser kept animating its idle wave while music played with Performance Mode on (where the app stops spectrum frames); it now rests, per LastWave's theme guidance. +- **Fixed:** Prism's cover-art colours silently never updated when the artwork host sends no CORS headers; it now falls back to the track's own accent colour. +- **Fixed:** the visualiser toggle button now reports its state (`aria-pressed`), and the platter clears when nothing is playing. +- **Improved:** the deck has CSS fallback geometry, so it never flashes unpositioned before the script lays it out. + +### 2.0.2 +- **Fixed:** the manifest now follows LastWave's plugin format (`type`, `entry`, `script`, `apiVersion: 1`). It previously failed to install with "Invalid local manifest.json". +- **Fixed:** the skin picked in the deck is now saved, so it no longer reverts to Nebula on restart. +- **Fixed:** the Prism and Obsidian pills were unreachable at the default deck size; the pill row now scrolls with the wheel, shows an edge fade, and centres the active skin. +- **Fixed:** a hidden deck stays out of the tab order; the deck's size no longer depends on the app's global `box-sizing`. +- **Fixed:** Alt shortcuts work on macOS (they used the typed character, which Alt changes) and no longer fire while typing in a field. +- **Improved:** keyboard focus rings, labelled and toggle-aware deck buttons, reduced-motion support, and sanitising of saved or cross-window state. +- **Improved:** mini-player detection runs once per frame instead of on every DOM change, and the bass glow only updates when its value changes. + +### 2.0.1 +- Orbit Deck is removed while the Mini Player is open and restored afterwards. diff --git a/themes/aura-theme/manifest.json b/themes/aura-theme/manifest.json new file mode 100644 index 0000000..c6abf77 --- /dev/null +++ b/themes/aura-theme/manifest.json @@ -0,0 +1,24 @@ +{ + "id": "aura-theme", + "name": "Aura Theme", + "type": "theme", + "version": "2.1.3", + "apiVersion": 1, + "minAppVersion": "3.0.0", + "author": { "name": "Pol Daniel Bordoy" }, + "description": "Atmospheric reactive glass theme with six skins and a draggable, resizable Orbit Deck. The Mini Player can now match any plugin-widget look (vinyl, cassette, terminal, pet, deck) with an on-card lyrics switch.", + "tags": ["glass", "dark", "purple", "reactive", "visualizer", "custom-ui", "mini-player", "widget", "lyrics"], + "previews": [], + "swatch": ["#0b0914", "#18132b", "#9d6bff", "#ff6b9d"], + "variants": [ + { "id": "nebula", "name": "Nebula", "swatch": ["#0b0914", "#18132b", "#9d6bff"] }, + { "id": "popout", "name": "Pop-Out", "swatch": ["#120d18", "#241930", "#ff7a59"] }, + { "id": "dusk", "name": "Dusk", "swatch": ["#130e1d", "#221733", "#e056fd"] }, + { "id": "cobalt", "name": "Cobalt", "swatch": ["#060d17", "#0f213b", "#38bdf8"] }, + { "id": "prism", "name": "Prism", "swatch": ["#0c0a16", "#1c1733", "#9d6bff"] }, + { "id": "obsidian", "name": "Obsidian", "swatch": ["#000000", "#0d0c14", "#b185ff"] } + ], + "updatedAt": "2026-12-04", + "entry": "theme.css", + "script": "theme.js" +} diff --git a/themes/aura-theme/theme.css b/themes/aura-theme/theme.css new file mode 100644 index 0000000..2506698 --- /dev/null +++ b/themes/aura-theme/theme.css @@ -0,0 +1,1469 @@ +:root, +:root[data-lw-theme-variant="nebula"], +:root[data-aura-skin="nebula"] { + color-scheme: dark; + --aura-bg-base: #0b0914; + --aura-bg-deep: #07050e; + --aura-bg-elevated: #18132b; + --aura-bg-surface: #120e22; + --aura-bg-overlay: #211a3b; + --aura-bg-glass: rgba(22, 17, 42, 0.72); + --aura-bg-pill: rgba(157, 107, 255, 0.16); + --aura-border: rgba(182, 146, 255, 0.24); + --aura-border-soft: rgba(182, 146, 255, 0.12); + --aura-border-strong: rgba(255, 107, 157, 0.52); + --aura-primary: #9d6bff; + --aura-secondary: #ff6b9d; + --aura-tertiary: #5ce1e6; + --aura-on-primary: #ffffff; + --aura-text: #f5f2ff; + --aura-text-muted: #aba1ca; + --aura-text-subtle: #8278a3; + --aura-glow: rgba(157, 107, 255, 0.42); + --aura-bass-glow: rgba(255, 107, 157, 0.55); + --aura-shadow: 0 22px 54px rgba(4, 2, 12, 0.74); + --aura-blur: 22px; + --aura-radius: 18px; + --aura-bass-level: 0; +} + +:root[data-lw-theme-variant="popout"], +:root[data-aura-skin="popout"] { + color-scheme: dark; + --aura-bg-base: #120d18; + --aura-bg-deep: #0b0810; + --aura-bg-elevated: #241930; + --aura-bg-surface: #1b1325; + --aura-bg-overlay: #302140; + --aura-bg-glass: rgba(34, 23, 46, 0.80); + --aura-bg-pill: rgba(255, 122, 89, 0.18); + --aura-border: rgba(255, 159, 104, 0.28); + --aura-border-soft: rgba(255, 159, 104, 0.14); + --aura-border-strong: rgba(255, 209, 102, 0.58); + --aura-primary: #ff7a59; + --aura-secondary: #ffd166; + --aura-tertiary: #ff5d8f; + --aura-on-primary: #140b08; + --aura-text: #fff8f3; + --aura-text-muted: #cfb8ae; + --aura-text-subtle: #9e867c; + --aura-glow: rgba(255, 122, 89, 0.46); + --aura-bass-glow: rgba(255, 209, 102, 0.56); + --aura-shadow: 0 26px 60px rgba(0, 0, 0, 0.82), 0 0 0 1px rgba(255, 122, 89, 0.22); + --aura-blur: 18px; + --aura-radius: 20px; +} + +:root[data-lw-theme-variant="dusk"], +:root[data-aura-skin="dusk"] { + color-scheme: dark; + --aura-bg-base: #130e1d; + --aura-bg-deep: #0c0813; + --aura-bg-elevated: #221733; + --aura-bg-surface: #1a1228; + --aura-bg-overlay: #2c1e42; + --aura-bg-glass: rgba(31, 21, 48, 0.74); + --aura-bg-pill: rgba(224, 86, 253, 0.16); + --aura-border: rgba(224, 86, 253, 0.24); + --aura-border-soft: rgba(224, 86, 253, 0.12); + --aura-border-strong: rgba(255, 138, 128, 0.50); + --aura-primary: #e056fd; + --aura-secondary: #ff8a80; + --aura-tertiary: #f8a5c2; + --aura-on-primary: #ffffff; + --aura-text: #fcf4ff; + --aura-text-muted: #bba2c9; + --aura-text-subtle: #8e759c; + --aura-glow: rgba(224, 86, 253, 0.38); + --aura-bass-glow: rgba(255, 138, 128, 0.48); + --aura-shadow: 0 20px 48px rgba(8, 4, 16, 0.76); + --aura-blur: 24px; + --aura-radius: 18px; +} + +:root[data-lw-theme-variant="cobalt"], +:root[data-aura-skin="cobalt"] { + color-scheme: dark; + --aura-bg-base: #060d17; + --aura-bg-deep: #04080f; + --aura-bg-elevated: #0f213b; + --aura-bg-surface: #0b182c; + --aura-bg-overlay: #152c4d; + --aura-bg-glass: rgba(13, 29, 52, 0.76); + --aura-bg-pill: rgba(56, 189, 248, 0.16); + --aura-border: rgba(56, 189, 248, 0.26); + --aura-border-soft: rgba(56, 189, 248, 0.13); + --aura-border-strong: rgba(52, 211, 153, 0.52); + --aura-primary: #38bdf8; + --aura-secondary: #34d399; + --aura-tertiary: #818cf8; + --aura-on-primary: #04101c; + --aura-text: #eef8ff; + --aura-text-muted: #93b7d1; + --aura-text-subtle: #698da8; + --aura-glow: rgba(56, 189, 248, 0.42); + --aura-bass-glow: rgba(52, 211, 153, 0.52); + --aura-shadow: 0 20px 50px rgba(2, 8, 18, 0.80); + --aura-blur: 20px; + --aura-radius: 14px; +} + +:root[data-lw-theme-variant="prism"], +:root[data-aura-skin="prism"] { + color-scheme: dark; + --aura-bg-base: #0c0a16; + --aura-bg-deep: #07060e; + --aura-bg-elevated: #1c1733; + --aura-bg-surface: #141026; + --aura-bg-overlay: #261f45; + --aura-bg-glass: rgba(26, 21, 48, 0.66); + --aura-bg-pill: color-mix(in srgb, var(--aura-dynamic-primary, #9d6bff) 20%, transparent); + --aura-border: color-mix(in srgb, var(--aura-dynamic-primary, #9d6bff) 36%, rgba(255, 255, 255, 0.12)); + --aura-border-soft: color-mix(in srgb, var(--aura-dynamic-primary, #9d6bff) 18%, rgba(255, 255, 255, 0.06)); + --aura-border-strong: var(--aura-dynamic-secondary, #ff6b9d); + --aura-primary: var(--aura-dynamic-primary, #9d6bff); + --aura-secondary: var(--aura-dynamic-secondary, #ff6b9d); + --aura-tertiary: #7dd3fc; + --aura-on-primary: #ffffff; + --aura-text: #ffffff; + --aura-text-muted: #bcb6d6; + --aura-text-subtle: #8b85a8; + --aura-glow: color-mix(in srgb, var(--aura-dynamic-primary, #9d6bff) 46%, transparent); + --aura-bass-glow: color-mix(in srgb, var(--aura-dynamic-secondary, #ff6b9d) 56%, transparent); + --aura-shadow: 0 24px 60px rgba(0, 0, 0, 0.76); + --aura-blur: 28px; + --aura-radius: 20px; +} + +:root[data-lw-theme-variant="obsidian"], +:root[data-aura-skin="obsidian"] { + color-scheme: dark; + --aura-bg-base: #000000; + --aura-bg-deep: #000000; + --aura-bg-elevated: #0d0c14; + --aura-bg-surface: #07070c; + --aura-bg-overlay: #161422; + --aura-bg-glass: rgba(10, 9, 16, 0.90); + --aura-bg-pill: rgba(177, 133, 255, 0.14); + --aura-border: rgba(255, 255, 255, 0.12); + --aura-border-soft: rgba(255, 255, 255, 0.07); + --aura-border-strong: rgba(255, 107, 157, 0.48); + --aura-primary: #b185ff; + --aura-secondary: #ff6b9d; + --aura-tertiary: #38bdf8; + --aura-on-primary: #090612; + --aura-text: #f8f7fc; + --aura-text-muted: #948fa6; + --aura-text-subtle: #69647a; + --aura-glow: rgba(177, 133, 255, 0.34); + --aura-bass-glow: rgba(255, 107, 157, 0.45); + --aura-shadow: 0 18px 44px rgba(0, 0, 0, 0.96); + --aura-blur: 16px; + --aura-radius: 16px; +} + +:root { + --lw-bg: var(--aura-bg-base); + --lw-glass-veil: var(--aura-bg-base); + --lw-bg-deep: var(--aura-bg-deep); + --lw-bg-base: var(--aura-bg-base); + --lw-surface: var(--aura-bg-surface); + --lw-surface-raised: var(--aura-bg-elevated); + --lw-surface-overlay: var(--aura-bg-overlay); + --lw-bg-elevated: var(--aura-bg-elevated); + + --lw-panel-translucent: color-mix(in srgb, var(--aura-bg-elevated) 86%, transparent); + --lw-dock-translucent: color-mix(in srgb, var(--aura-bg-surface) 92%, transparent); + --lw-rail-translucent: color-mix(in srgb, var(--aura-bg-base) 88%, transparent); + + --lw-outline: var(--aura-border); + --lw-outline-soft: var(--aura-border-soft); + --lw-divider: var(--aura-border-soft); + + --lw-text-primary: var(--aura-text); + --lw-text-secondary: var(--aura-text-muted); + --lw-text-tertiary: var(--aura-text-subtle); + + --lw-accent: var(--aura-primary); + --lw-accent-ink: var(--aura-primary); + --lw-on-accent: var(--aura-on-primary); + --lw-accent-subtle: var(--aura-bg-pill); + --lw-focus-ring: color-mix(in srgb, var(--aura-primary) 82%, transparent); + + --lw-wash-hover: color-mix(in srgb, var(--aura-primary) 10%, rgba(255, 255, 255, 0.04)); + --lw-wash-pressed: color-mix(in srgb, var(--aura-primary) 18%, rgba(255, 255, 255, 0.06)); + --lw-control-fill: color-mix(in srgb, var(--aura-primary) 8%, rgba(255, 255, 255, 0.04)); + --lw-control-fill-hover: color-mix(in srgb, var(--aura-primary) 14%, rgba(255, 255, 255, 0.06)); + --lw-control-stroke: var(--aura-border-soft); + --lw-control-stroke-bottom: var(--aura-border); + --lw-card-fill: color-mix(in srgb, var(--aura-bg-elevated) 72%, transparent); + --lw-card-fill-secondary: color-mix(in srgb, var(--aura-bg-surface) 64%, transparent); + --lw-card-stroke: var(--aura-border-soft); + + /* A colour token, not a gradient: the app also feeds it to `scrollbar-color`, + which rejects images and would drop the whole declaration. */ + --lw-scrollbar-thumb: color-mix(in srgb, var(--aura-primary) 55%, transparent); + accent-color: var(--aura-primary); +} + +[data-lw="app-shell"] { + background-color: var(--aura-bg-base) !important; + background-image: + radial-gradient(circle at 12% 10%, color-mix(in srgb, var(--aura-primary) 18%, transparent) 0%, transparent 45%), + radial-gradient(circle at 88% 88%, color-mix(in srgb, var(--aura-secondary) 15%, transparent) 0%, transparent 48%) !important; +} + +:root[data-lw-theme-variant="obsidian"] [data-lw="app-shell"], +:root[data-aura-skin="obsidian"] [data-lw="app-shell"] { + background-image: none !important; +} + +[data-lw="title-bar"] { + background: color-mix(in srgb, var(--aura-bg-base) 84%, transparent) !important; + border-bottom: 1px solid var(--aura-border-soft); +} + +[data-lw="sidebar"].rail { + box-shadow: inset -1px 0 0 0 var(--aura-border-soft) !important; +} + +[data-lw="sidebar-item"][data-active="true"] { + background: var(--aura-bg-pill) !important; + color: var(--aura-text) !important; +} + +[data-lw="sidebar-item"][data-active="true"]::before { + background: linear-gradient(180deg, var(--aura-primary), var(--aura-secondary)) !important; +} + +[data-lw="player-bar"].player-dock { + --lw-dock-edge: var(--aura-border); + box-shadow: + inset 0 1px 0 0 var(--aura-border), + 0 -8px 28px color-mix(in srgb, var(--aura-primary) 10%, transparent) !important; +} + +[data-lw="player-bar"].player-dock > .dock-backdrop { + background: color-mix(in srgb, var(--aura-bg-elevated) 88%, transparent) !important; + backdrop-filter: blur(var(--aura-blur)) saturate(145%); +} + +[data-lw="player-bar"] .dock-play { + background: linear-gradient(135deg, var(--aura-primary), var(--aura-secondary)) !important; + color: var(--lw-on-accent, #ffffff) !important; + box-shadow: 0 4px 16px var(--aura-glow) !important; +} + +body.aura-in-mini-player { + background: var(--aura-bg-base) !important; + overflow: hidden !important; +} + +body.aura-in-mini-player .aura-orbit-deck, +[data-lw="mini-player"] ~ .aura-orbit-deck, +body:has([data-lw="mini-player"]) .aura-orbit-deck { + display: none !important; + visibility: hidden !important; + opacity: 0 !important; + pointer-events: none !important; +} + +[data-lw="mini-player"] { + background: + radial-gradient(circle at 10% 15%, color-mix(in srgb, var(--aura-primary) 22%, transparent) 0%, transparent 55%), + radial-gradient(circle at 92% 85%, color-mix(in srgb, var(--aura-secondary) 18%, transparent) 0%, transparent 55%), + var(--aura-bg-elevated) !important; + border-color: var(--aura-border-strong) !important; + box-shadow: + inset 0 0 0 1px var(--aura-border), + inset 0 0 calc(10px + (var(--aura-bass-level) * 20px)) var(--aura-bass-glow) !important; + color: var(--aura-text) !important; + transition: box-shadow 0.08s linear, border-color 0.25s ease; +} + +:root[data-lw-theme-variant="obsidian"] [data-lw="mini-player"], +:root[data-aura-skin="obsidian"] [data-lw="mini-player"] { + background: #000000 !important; +} + +[data-lw="mini-player"] .mini-ambient-shade { + background: + linear-gradient( + 115deg, + color-mix(in srgb, var(--aura-bg-base) 74%, transparent), + color-mix(in srgb, var(--aura-bg-elevated) 54%, transparent) + ), + radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--aura-primary) 26%, transparent), transparent 65%) !important; +} + +[data-lw="mini-player"] .mini-card-shade { + background: linear-gradient( + to top, + color-mix(in srgb, var(--aura-bg-base) 94%, #000) 0%, + color-mix(in srgb, var(--aura-bg-base) 52%, transparent) 42%, + transparent 68% + ) !important; +} + +[data-lw="mini-player"] [data-lw="mini-player-lyrics"] { + background: color-mix(in srgb, var(--aura-primary) 16%, rgba(0, 0, 0, 0.34)) !important; + border: 1px solid var(--aura-border) !important; + color: var(--aura-text) !important; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28); +} + +[data-lw="mini-player"] .mini-play { + background: linear-gradient(135deg, var(--aura-primary), var(--aura-secondary)) !important; + color: var(--lw-on-accent, #ffffff) !important; + box-shadow: 0 3px 12px var(--aura-glow) !important; +} + +[data-lw="mini-player"] .mini-progress-fill { + background: linear-gradient(90deg, var(--aura-primary), var(--aura-secondary)) !important; + box-shadow: 0 0 8px var(--aura-bass-glow); +} + +[data-lw="mini-player"] .mini-glyph:hover { + background: var(--aura-bg-pill) !important; + color: var(--aura-text) !important; +} + +body.aura-compact-docked:not(.aura-in-mini-player) .aura-orbit-deck { + left: 12px !important; + right: 12px !important; + top: auto !important; + bottom: 78px !important; + width: calc(100vw - 24px) !important; + height: 76px !important; + min-width: 0 !important; + min-height: 76px !important; + border-radius: 16px !important; + padding: 8px 14px !important; +} + +body.aura-compact-docked:not(.aura-in-mini-player) .aura-deck-header, +body.aura-compact-docked:not(.aura-in-mini-player) .aura-resize-handle { + display: none !important; +} + +body.aura-compact-docked:not(.aura-in-mini-player) .aura-deck-body { + padding-top: 0 !important; + flex-direction: row !important; + align-items: center !important; + min-height: 0 !important; + overflow: hidden !important; +} + +/* The strip has a fixed 76px height, so the stage and the canvas need definite heights: + with auto heights the canvas's own pixel buffer fed back into its layout and the stage + ballooned far past the strip. */ +body.aura-compact-docked:not(.aura-in-mini-player) .aura-deck-stage { + flex: 1 1 auto !important; + height: 100% !important; + min-height: 0 !important; + min-width: 0 !important; +} + +body.aura-compact-docked:not(.aura-in-mini-player) .aura-telemetry-col { + height: 100% !important; + min-height: 0 !important; +} + +body.aura-compact-docked:not(.aura-in-mini-player) .aura-eq-canvas { + flex: 1 1 0 !important; + height: auto !important; + min-height: 0 !important; +} + +body.aura-compact-docked:not(.aura-in-mini-player) .aura-platter-wrap { + width: 48px !important; + height: 48px !important; +} + +body.aura-focus-stage [data-lw="sidebar"] { + opacity: 0 !important; + pointer-events: none !important; + flex-basis: 0px !important; + width: 0px !important; +} + +body.aura-focus-stage [data-lw="main-stage"] { + max-width: 1020px; + margin-inline: auto; +} + +.aura-orbit-deck { + box-sizing: border-box; + position: fixed; + z-index: 45; + /* Fallback geometry until the script positions the deck (and if it ever fails to). */ + right: 24px; + bottom: 88px; + width: 392px; + height: 204px; + display: flex; + flex-direction: column; + justify-content: space-between; + background: var(--aura-bg-glass); + backdrop-filter: blur(var(--aura-blur)) saturate(160%); + -webkit-backdrop-filter: blur(var(--aura-blur)) saturate(160%); + border: 1px solid var(--aura-border); + border-radius: var(--aura-radius); + box-shadow: + var(--aura-shadow), + 0 0 calc(8px + (var(--aura-bass-level) * 22px)) var(--aura-glow); + color: var(--aura-text); + padding: 11px 14px; + user-select: none; + overflow: hidden; + transition: + opacity 0.2s ease, + transform 0.2s ease, + border-color 0.25s ease; +} + +.aura-orbit-deck:hover { + border-color: var(--aura-border-strong); +} + +.aura-orbit-deck.is-hidden { + opacity: 0; + pointer-events: none; + + visibility: hidden; + transition: + opacity 0.2s ease, + transform 0.2s ease, + visibility 0s linear 0.2s; + transform: scale(0.96) translateY(8px); +} + +.aura-deck-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 6px; + cursor: grab; + padding-bottom: 7px; + border-bottom: 1px solid rgba(255, 255, 255, 0.07); +} + +.aura-deck-header:active { + cursor: grabbing; +} + +.aura-brand-badge { + display: inline-flex; + align-items: center; + gap: 6px; + font-size: 10.5px; + font-weight: 700; + letter-spacing: 0.06em; + text-transform: uppercase; + color: var(--aura-text); + flex-shrink: 0; +} + +.aura-brand-dot { + width: 8px; + height: 8px; + border-radius: 50%; + background: linear-gradient(135deg, var(--aura-primary), var(--aura-secondary)); + box-shadow: 0 0 10px var(--aura-secondary); +} + +.aura-skin-pills { + display: flex; + align-items: center; + gap: 2px; + background: rgba(0, 0, 0, 0.30); + padding: 2px; + border-radius: 999px; + border: 1px solid rgba(255, 255, 255, 0.07); + overflow-x: auto; + scrollbar-width: none; +} + +.aura-skin-pills::-webkit-scrollbar { + display: none; +} + +.aura-skin-pills { + position: relative; + min-width: 0; +} + +.aura-skin-pills.fade-end { + -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); + mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); +} + +.aura-skin-pills.fade-start { + -webkit-mask-image: linear-gradient(270deg, #000 calc(100% - 22px), transparent); + mask-image: linear-gradient(270deg, #000 calc(100% - 22px), transparent); +} + +.aura-skin-pills.fade-start.fade-end { + -webkit-mask-image: linear-gradient(90deg, transparent, #000 22px, #000 calc(100% - 22px), transparent); + mask-image: linear-gradient(90deg, transparent, #000 22px, #000 calc(100% - 22px), transparent); +} + +.aura-pill-btn { + appearance: none; + border: none; + background: transparent; + color: var(--aura-text-muted); + font-size: 9.5px; + font-weight: 600; + padding: 3px 7px; + border-radius: 999px; + cursor: pointer; + white-space: nowrap; + transition: all 0.16s ease; +} + +.aura-pill-btn:hover { + color: var(--aura-text); +} + +.aura-pill-btn.active { + background: linear-gradient(135deg, var(--aura-primary), var(--aura-secondary)); + color: var(--aura-on-primary, #ffffff); + box-shadow: 0 2px 10px var(--aura-glow); +} + +.aura-header-actions { + display: flex; + align-items: center; + gap: 3px; + flex-shrink: 0; +} + +.aura-icon-btn { + appearance: none; + border: 1px solid transparent; + background: rgba(255, 255, 255, 0.06); + color: var(--aura-text-muted); + border-radius: 7px; + width: 22px; + height: 22px; + display: inline-flex; + align-items: center; + justify-content: center; + font-size: 11px; + cursor: pointer; + transition: all 0.15s ease; +} + +.aura-icon-btn:hover, +.aura-icon-btn.active { + color: var(--aura-text); + background: var(--aura-bg-pill); + border-color: var(--aura-border-strong); +} + +.aura-deck-body { + display: flex; + flex-direction: column; + gap: 8px; + flex: 1; + min-height: 0; + padding-top: 8px; +} + +.aura-deck-stage { + display: flex; + align-items: center; + gap: 12px; + flex: 1; + min-height: 0; +} + +.aura-platter-wrap { + position: relative; + width: 82px; + height: 82px; + flex-shrink: 0; + display: flex; + align-items: center; + justify-content: center; +} + +.aura-orbital-ring { + position: absolute; + inset: -4px; + border-radius: 50%; + border: 1.5px dashed color-mix(in srgb, var(--aura-primary) 58%, transparent); + animation: aura-spin 16s linear infinite reverse; + pointer-events: none; +} + +.aura-platter { + position: relative; + width: 100%; + height: 100%; + border-radius: 50%; + background: + radial-gradient(circle at center, #090710 0 18%, transparent 19%), + conic-gradient(from 0deg, var(--aura-primary), var(--aura-secondary), var(--aura-tertiary), var(--aura-primary)); + padding: 3px; + box-shadow: + 0 8px 22px rgba(0, 0, 0, 0.55), + 0 0 calc(6px + (var(--aura-bass-level) * 18px)) var(--aura-bass-glow); + animation: aura-spin 9s linear infinite; + animation-play-state: paused; +} + +.aura-orbit-deck.is-playing .aura-platter { + animation-play-state: running; +} + +.aura-platter-art { + width: 100%; + height: 100%; + border-radius: 50%; + object-fit: cover; + display: block; + background: #141024; +} + +.aura-platter-spindle { + position: absolute; + top: 50%; + left: 50%; + width: 15px; + height: 15px; + transform: translate(-50%, -50%); + border-radius: 50%; + background: var(--aura-bg-base); + border: 2px solid var(--aura-secondary); + box-shadow: 0 0 8px var(--aura-bass-glow); +} + +@keyframes aura-spin { + to { + transform: rotate(360deg); + } +} + +.aura-telemetry-col { + display: flex; + flex-direction: column; + justify-content: space-between; + flex: 1; + min-width: 0; + height: 100%; + gap: 6px; +} + +.aura-meta-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 6px; +} + +.aura-meta-text { + min-width: 0; + flex: 1; +} + +.aura-track-title { + font-size: 12.5px; + font-weight: 700; + color: var(--aura-text); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.aura-track-artist { + font-size: 11px; + color: var(--aura-text-muted); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.aura-codec-pill { + font-size: 9px; + font-weight: 700; + letter-spacing: 0.04em; + padding: 2px 6px; + border-radius: 6px; + background: var(--aura-bg-pill); + border: 1px solid var(--aura-border); + color: var(--aura-text); + flex-shrink: 0; +} + +.aura-eq-canvas { + width: 100%; + flex: 1; + min-height: 32px; + border-radius: 10px; + background: rgba(0, 0, 0, 0.25); + border: 1px solid rgba(255, 255, 255, 0.06); +} + +.aura-controls-bar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; +} + +.aura-transport-group { + display: flex; + align-items: center; + gap: 5px; +} + +.aura-play-btn { + appearance: none; + border: none; + width: 28px; + height: 28px; + border-radius: 50%; + background: linear-gradient(135deg, var(--aura-primary), var(--aura-secondary)); + color: var(--aura-on-primary, #ffffff); + font-size: 11px; + font-weight: 700; + cursor: pointer; + display: inline-flex; + align-items: center; + justify-content: center; + box-shadow: 0 4px 14px var(--aura-glow); + transition: transform 0.14s ease; +} + +.aura-play-btn:hover { + transform: scale(1.07); +} + +.aura-action-group { + display: flex; + align-items: center; + gap: 4px; +} + +.aura-chip-btn { + appearance: none; + border: 1px solid var(--aura-border); + background: var(--aura-bg-pill); + color: var(--aura-text); + font-size: 10px; + font-weight: 600; + padding: 3px 8px; + border-radius: 999px; + cursor: pointer; + transition: border-color 0.15s ease, background 0.15s ease; +} + +.aura-chip-btn:hover { + border-color: var(--aura-border-strong); +} + +.aura-resize-handle { + position: absolute; + right: 4px; + bottom: 4px; + width: 13px; + height: 13px; + cursor: nwse-resize; + opacity: 0.65; + background: linear-gradient(135deg, transparent 50%, var(--aura-secondary) 50%); + border-bottom-right-radius: 5px; +} + +.aura-resize-handle:hover { + opacity: 1; +} + +.aura-orbit-deck button:focus-visible { + outline: 2px solid var(--aura-primary); + outline-offset: 2px; +} + +@media (prefers-reduced-motion: reduce) { + .aura-orbital-ring, + .aura-platter { + animation: none !important; + } + + .aura-orbit-deck, + .aura-orbit-deck *, + [data-lw="mini-player"], + [data-lw="mini-player"] * { + transition-duration: 0.01ms !important; + } +} + +/* ========================================================================== + Mini Player widget deck (aura-mini-deck) + The theme draws its own compact card in the Mini Player window. The native + mini-player chrome is neutralised only when this card is mounted + (body.aura-mini-custom); if the theme fails to mount, the native UI stays. + ========================================================================== */ + +body.aura-mini-custom [data-lw="mini-player"] { + background: transparent !important; + border-color: transparent !important; + box-shadow: none !important; +} + +body.aura-mini-custom [data-lw="mini-player"] > * { + visibility: hidden !important; +} + +.aura-mini-deck { + position: fixed; + inset: 0; + z-index: 60; + display: flex; + flex-direction: column; + overflow: hidden; + border-radius: 14px; + background: + radial-gradient(circle at 12% 12%, color-mix(in srgb, var(--aura-primary) 18%, transparent) 0%, transparent 55%), + radial-gradient(circle at 90% 88%, color-mix(in srgb, var(--aura-secondary) 16%, transparent) 0%, transparent 55%), + var(--aura-bg-glass); + backdrop-filter: blur(var(--aura-blur)) saturate(150%); + -webkit-backdrop-filter: blur(var(--aura-blur)) saturate(150%); + border: 1px solid var(--aura-border); + box-shadow: var(--aura-shadow); + color: var(--aura-text); + font-family: inherit; + user-select: none; +} + +.aura-mini-deck button:focus-visible { + outline: 2px solid var(--aura-primary); + outline-offset: 1px; +} + +/* ---- top bar: look switcher + lyrics switch + window glyphs ---- */ + +.aum-top { + display: flex; + align-items: center; + justify-content: space-between; + gap: 6px; + padding: 5px 8px 3px; + min-height: 23px; +} + +.aum-look-switch { + display: flex; + gap: 2px; +} + +.aum-look-btn { + appearance: none; + border: 1px solid transparent; + background: transparent; + color: var(--aura-text-muted); + font-size: 11px; + line-height: 1; + width: 23px; + height: 19px; + border-radius: 6px; + cursor: pointer; + font-family: inherit; +} + +.aum-look-btn:hover { + color: var(--aura-text); + background: var(--aura-bg-pill); +} + +.aum-look-btn.active { + background: var(--aura-bg-pill); + color: var(--aura-text); + border-color: var(--aura-border-strong); +} + +.aum-top-right { + display: flex; + align-items: center; + gap: 4px; +} + +.aum-switch { + appearance: none; + display: inline-flex; + align-items: center; + gap: 5px; + background: rgba(0, 0, 0, 0.28); + border: 1px solid var(--aura-border-soft, var(--aura-border)); + border-radius: 999px; + padding: 2px 8px 2px 5px; + cursor: pointer; + color: var(--aura-text-muted); + font-family: inherit; +} + +.aum-switch[aria-checked="true"] { + background: var(--aura-bg-pill); + color: var(--aura-text); + border-color: var(--aura-border-strong); +} + +.aum-switch-track { + width: 22px; + height: 12px; + border-radius: 999px; + background: rgba(255, 255, 255, 0.16); + position: relative; + transition: background 0.15s ease; + flex: none; +} + +.aum-switch-knob { + position: absolute; + top: 1.5px; + left: 2px; + width: 9px; + height: 9px; + border-radius: 50%; + background: #cfc8e0; + transition: transform 0.15s ease; +} + +.aum-switch[aria-checked="true"] .aum-switch-track { + background: var(--aura-primary); +} + +.aum-switch[aria-checked="true"] .aum-switch-knob { + transform: translateX(10px); + background: #ffffff; +} + +.aum-switch-label { + font-size: 10px; + font-weight: 700; + letter-spacing: 0.04em; +} + +.aum-glyph { + appearance: none; + width: 20px; + height: 19px; + border: 1px solid transparent; + border-radius: 6px; + background: transparent; + color: var(--aura-text-muted); + font-size: 11px; + cursor: pointer; + font-family: inherit; +} + +.aum-glyph:hover { + background: var(--aura-bg-pill); + color: var(--aura-text); +} + +.aum-glyph.danger:hover { + color: #ff8a9a; + border-color: color-mix(in srgb, #ff5c74 40%, transparent); +} + +/* ---- body / shared text ---- */ + +.aum-body { + flex: 1; + min-height: 0; + padding: 2px 10px; +} + +.aum-stage { + display: none; + align-items: center; + gap: 10px; + height: 100%; + min-height: 52px; +} + +.aura-mini-deck[data-look="vinyl"] [data-stage="vinyl"], +.aura-mini-deck[data-look="cassette"] [data-stage="cassette"], +.aura-mini-deck[data-look="terminal"] [data-stage="terminal"], +.aura-mini-deck[data-look="pet"] [data-stage="pet"], +.aura-mini-deck[data-look="deck"] [data-stage="deck"] { + display: flex; +} + +.aum-title { + font-size: 12.5px; + font-weight: 800; + color: var(--aura-text); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 100%; +} + +.aum-artist { + font-size: 10.5px; + font-weight: 600; + color: var(--aura-text-muted); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 100%; +} + +/* ---- vinyl look (Vinyl Spinner widget) ---- */ + +.aum-vs-deck { + position: relative; + flex: none; + width: 56px; + height: 56px; +} + +.aum-vs-disc { + position: absolute; + inset: 0; + border-radius: 50%; + background: repeating-radial-gradient(circle, #141418 0 1.2px, #1d1d23 1.2px 2.4px); + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.06); + animation: aum-vinyl-spin 3.2s linear infinite; + animation-play-state: paused; +} + +.aura-mini-deck.is-playing .aum-vs-disc { + animation-play-state: running; +} + +@keyframes aum-vinyl-spin { + to { + transform: rotate(360deg); + } +} + +.aum-vs-label { + position: absolute; + inset: 16px; + border-radius: 50%; + background-size: cover; + background-position: center; + background-color: #1c1830; + box-shadow: 0 0 0 2px #0d0d10; +} + +.aum-vs-hole { + position: absolute; + left: 50%; + top: 50%; + width: 3px; + height: 3px; + transform: translate(-50%, -50%); + border-radius: 50%; + background: #0d0d10; +} + +.aum-vs-arm { + position: absolute; + right: -4px; + top: -2px; + width: 7px; + height: 42px; + transform-origin: 4px 4px; + transform: rotate(18deg); + transition: transform 0.6s ease; +} + +.aum-vs-arm::before { + content: ""; + position: absolute; + left: 2px; + top: 0; + width: 4px; + height: 4px; + border-radius: 50%; + background: #d8d8e0; +} + +.aum-vs-arm::after { + content: ""; + position: absolute; + left: 3px; + top: 3px; + width: 2px; + height: 35px; + background: linear-gradient(#d8d8e0, #8d8d99); + border-radius: 1px; +} + +.aum-vs-meta { + min-width: 0; + flex: 1; + display: flex; + flex-direction: column; + gap: 2px; +} + +.aum-row { + display: flex; + align-items: center; + gap: 6px; + margin-top: 4px; +} + +.aum-rpm { + font: 800 9px/1 Consolas, "SF Mono", monospace; + color: var(--aura-primary); + letter-spacing: 0.6px; + flex: none; +} + +.aum-bar { + flex: 1; + height: 3px; + border-radius: 2px; + background: rgba(255, 255, 255, 0.14); + overflow: hidden; +} + +.aum-fill { + height: 100%; + width: 0; + background: var(--aura-primary); +} + +.aum-time { + font: 700 10px/1 Consolas, "SF Mono", monospace; + color: #9c97b0; + flex: none; +} + +/* ---- cassette look (Cassette Deck widget) ---- */ + +.aum-cc-art { + flex: none; + display: flex; + align-items: center; +} + +.aum-cc-svg { + height: 52px; + width: auto; + display: block; +} + +.aum-cc-meta { + min-width: 0; + flex: 1; + display: flex; + flex-direction: column; + gap: 2px; +} + +.aum-cc-sub { + color: #b9b6ad; +} + +.aum-cc-time { + font: 700 9.5px/1 Consolas, "SF Mono", monospace; + color: #8f8b80; + letter-spacing: 0.5px; + margin-top: 3px; +} + +/* ---- terminal look (Terminal Log widget) ---- */ + +[data-stage="terminal"] { + flex-direction: column; + align-items: stretch; + gap: 2px; + padding: 5px 8px; + border-radius: 10px; + background: #030a05; + border: 1px solid rgba(57, 255, 122, 0.18); + font: 10.5px/13px Consolas, "SF Mono", monospace; +} + +.aum-tl-line { + color: #39ff7a; + text-shadow: 0 0 6px rgba(57, 255, 122, 0.45); + white-space: pre; + overflow: hidden; + text-overflow: ellipsis; +} + +.aum-tl-dim { + color: #1f9c4b; + text-shadow: none; +} + +/* ---- pet look (Wavegotchi widget) ---- */ + +.aum-wg-canvas { + flex: none; + width: 96px; + height: 64px; + image-rendering: pixelated; + border-radius: 9px; + background: #9bbc0f; + box-shadow: inset 0 0 0 3px #306230, inset 0 0 12px rgba(15, 56, 15, 0.45); +} + +.aum-wg-meta { + min-width: 0; + flex: 1; + display: flex; + flex-direction: column; + gap: 2px; + font: 700 10px/1.3 Consolas, "SF Mono", monospace; +} + +.aum-wg-name { + font-size: 11px; + letter-spacing: 0.5px; + color: var(--aura-text); +} + +.aum-wg-mood { + color: #a9b3d6; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.aum-wg-hearts { + color: #ff6b8b; + letter-spacing: 2px; +} + +.aum-wg-stats { + color: #7f89ad; +} + +/* ---- orbit deck look ---- */ + +.aum-platter-wrap { + position: relative; + flex: none; + width: 58px; + height: 58px; + display: flex; + align-items: center; + justify-content: center; +} + +.aum-orbital-ring { + position: absolute; + inset: -3px; + border-radius: 50%; + border: 1.5px dashed color-mix(in srgb, var(--aura-primary) 58%, transparent); + animation: aura-spin 16s linear infinite reverse; +} + +.aum-platter { + position: relative; + width: 100%; + height: 100%; + border-radius: 50%; + padding: 3px; + background: conic-gradient(from 0deg, var(--aura-primary), var(--aura-secondary), var(--aura-tertiary, var(--aura-primary)), var(--aura-primary)); + animation: aura-spin 9s linear infinite; + animation-play-state: paused; +} + +.aura-mini-deck.is-playing .aum-platter { + animation-play-state: running; +} + +.aum-platter-art { + width: 100%; + height: 100%; + border-radius: 50%; + object-fit: cover; + background: #141024; +} + +.aum-platter-spindle { + position: absolute; + top: 50%; + left: 50%; + width: 11px; + height: 11px; + transform: translate(-50%, -50%); + border-radius: 50%; + background: var(--aura-bg-base); + border: 2px solid var(--aura-secondary); +} + +.aum-telemetry-col { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + gap: 4px; +} + +.aum-meta-row { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 8px; + min-width: 0; +} + +.aum-meta-text { + min-width: 0; + flex: 1; + display: flex; + flex-direction: column; + gap: 1px; +} + +.aum-track-title { + font-size: 12px; + font-weight: 700; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.aum-track-artist { + font-size: 10.5px; + color: var(--aura-text-muted); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.aum-codec-pill { + font-size: 8.5px; + font-weight: 700; + letter-spacing: 0.04em; + padding: 1px 5px; + border-radius: 6px; + background: var(--aura-bg-pill); + border: 1px solid var(--aura-border); + flex: none; +} + +.aum-eq-canvas { + width: 100%; + height: 24px; + border-radius: 8px; + background: rgba(0, 0, 0, 0.25); + border: 1px solid rgba(255, 255, 255, 0.06); +} + +/* ---- lyrics strip ---- */ + +.aum-lyrics { + display: none; + align-items: center; + gap: 6px; + margin: 0 10px 4px; + padding: 3px 8px; + border-radius: 8px; + background: color-mix(in srgb, var(--aura-primary) 16%, rgba(0, 0, 0, 0.34)); + border: 1px solid var(--aura-border); + font-size: 11px; + color: var(--aura-text); +} + +.aura-mini-deck.lyrics-on .aum-lyrics { + display: flex; +} + +.aum-lyrics-icon { + color: var(--aura-secondary); + font-size: 12px; + flex: none; +} + +.aum-lyrics-text { + min-width: 0; + flex: 1; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + font-weight: 600; +} + +/* ---- transport bar ---- */ + +.aum-transport { + display: flex; + align-items: center; + gap: 6px; + padding: 4px 10px 6px; +} + +.aum-icon-btn { + appearance: none; + border: 1px solid transparent; + background: rgba(255, 255, 255, 0.06); + color: var(--aura-text-muted); + border-radius: 7px; + width: 24px; + height: 22px; + display: inline-flex; + align-items: center; + justify-content: center; + font-size: 11px; + cursor: pointer; + font-family: inherit; +} + +.aum-icon-btn:hover { + color: var(--aura-text); + background: var(--aura-bg-pill); +} + +.aum-icon-btn.active { + color: #ff86b8; +} + +.aum-play-btn { + appearance: none; + border: none; + width: 28px; + height: 24px; + border-radius: 50%; + background: linear-gradient(135deg, var(--aura-primary), var(--aura-secondary)); + color: #ffffff; + font-size: 10px; + font-weight: 700; + cursor: pointer; + box-shadow: 0 3px 10px var(--aura-glow); + font-family: inherit; +} + +.aum-play-btn:hover { + filter: brightness(1.08); +} + +.aum-progress { + flex: 1; + height: 3px; + border-radius: 2px; + background: rgba(255, 255, 255, 0.14); + overflow: hidden; + cursor: pointer; +} + +.aum-progress-fill { + height: 100%; + width: 0; + background: linear-gradient(90deg, var(--aura-primary), var(--aura-secondary)); +} + +@media (prefers-reduced-motion: reduce) { + .aum-orbital-ring, + .aum-platter, + .aum-vs-disc { + animation: none !important; + } + + .aura-mini-deck, + .aura-mini-deck * { + transition-duration: 0.01ms !important; + } +} diff --git a/themes/aura-theme/theme.js b/themes/aura-theme/theme.js new file mode 100644 index 0000000..dcdcb5e --- /dev/null +++ b/themes/aura-theme/theme.js @@ -0,0 +1,1684 @@ +const SKINS = [ + { id: 'nebula', label: 'Nebula' }, + { id: 'popout', label: 'Pop-Out' }, + { id: 'dusk', label: 'Dusk' }, + { id: 'cobalt', label: 'Cobalt' }, + { id: 'prism', label: 'Prism' }, + { id: 'obsidian', label: 'Obsidian' }, +]; + +// Widget-inspired looks for the Mini Player window. Choosing one on the card +// switches the mini window to that look; the choice is remembered. +const LOOKS = [ + { id: 'vinyl', label: 'Vinyl Spinner' }, + { id: 'cassette', label: 'Cassette Deck' }, + { id: 'terminal', label: 'Terminal Log' }, + { id: 'pet', label: 'Wavegotchi' }, + { id: 'deck', label: 'Orbit Deck' }, +]; + +const DEFAULT_STATE = { + skin: 'nebula', + visualizerMode: 'bars', + deckVisible: true, + focusStage: false, + deck: { + x: null, + y: null, + width: 392, + height: 204, + }, + mini: { + look: 'vinyl', + lyrics: false, + }, +}; + +const clamp = (v, lo, hi, fallback) => + typeof v === 'number' && Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : fallback; + +function sanitizeState(raw) { + const out = { ...DEFAULT_STATE, deck: { ...DEFAULT_STATE.deck }, mini: { ...DEFAULT_STATE.mini } }; + if (!raw || typeof raw !== 'object') return out; + if (SKINS.some((k) => k.id === raw.skin)) out.skin = raw.skin; + if (raw.visualizerMode === 'bars' || raw.visualizerMode === 'radial') out.visualizerMode = raw.visualizerMode; + if (typeof raw.deckVisible === 'boolean') out.deckVisible = raw.deckVisible; + if (typeof raw.focusStage === 'boolean') out.focusStage = raw.focusStage; + const d = raw.deck && typeof raw.deck === 'object' ? raw.deck : {}; + out.deck.width = clamp(d.width, 320, 680, DEFAULT_STATE.deck.width); + out.deck.height = clamp(d.height, 176, 440, DEFAULT_STATE.deck.height); + out.deck.x = clamp(d.x, 0, 20000, null); + out.deck.y = clamp(d.y, 0, 20000, null); + const m = raw.mini && typeof raw.mini === 'object' ? raw.mini : {}; + if (LOOKS.some((k) => k.id === m.look)) out.mini.look = m.look; + if (typeof m.lyrics === 'boolean') out.mini.lyrics = m.lyrics; + return out; +} + +const store = LastWave?.storage ? LastWave.storage(pluginId || 'aura-theme') : null; + +function readSavedState() { + try { + const v2 = store?.get('v2_state'); + if (v2 && typeof v2 === 'object') return v2; + for (const key of ['aura_theme_state', 'aura_music_state']) { + const raw = localStorage.getItem(key); + if (raw) { + const legacy = JSON.parse(raw); + if (legacy && typeof legacy === 'object') { + return { + skin: legacy.skin || legacy.activeSkin || 'nebula', + deckVisible: legacy.deckVisible ?? true, + focusStage: legacy.focusStage ?? false, + deck: { + x: legacy.deck?.x ?? legacy.x ?? null, + y: legacy.deck?.y ?? legacy.y ?? null, + width: legacy.deck?.width ?? legacy.width ?? 392, + height: legacy.deck?.height ?? legacy.height ?? 204, + }, + }; + } + } + } + } catch (_) {} + return null; +} + +const savedState = readSavedState(); +const state = sanitizeState(savedState); +// Only fall back to the app's variant when this theme has no skin of its own saved yet; +// the app always reports a variant (its default or the Store chip), so letting it win +// unconditionally would snap the deck back to Nebula on every restart. +const hadSavedSkin = Boolean(savedState) && SKINS.some((s) => s.id === savedState.skin); +const initialStoreVariant = LastWave?.theme?.getVariant?.(); +if (!hadSavedSkin && initialStoreVariant && SKINS.some((s) => s.id === initialStoreVariant)) { + state.skin = initialStoreVariant; +} + +const channel = + typeof BroadcastChannel !== 'undefined' ? new BroadcastChannel('aura-theme-v2-sync') : null; + +function pushSkinToApp() { + const applied = LastWave?.theme?.setVariant?.(state.skin); + + if (!applied) document.documentElement.dataset.lwThemeVariant = state.skin; +} + +function setSkin(id) { + if (!SKINS.some((k) => k.id === id)) return; + const changed = state.skin !== id; + state.skin = id; + if (changed) pushSkinToApp(); + applySkinAndLayout(true); +} + +function persistState() { + try { + store?.set('v2_state', state); + } catch (_) {} + try { + channel?.postMessage({ type: 'AURA_STATE_SYNC', state }); + } catch (_) {} +} + +let lastChromaUrl = ''; +function updateArtworkChroma(url) { + if (!url || url === lastChromaUrl) return; + lastChromaUrl = url; + + const img = new Image(); + img.crossOrigin = 'anonymous'; + img.onload = () => { + try { + const canvas = document.createElement('canvas'); + canvas.width = 16; + canvas.height = 16; + const ctx = canvas.getContext('2d'); + if (!ctx) return; + ctx.drawImage(img, 0, 0, 16, 16); + const { data } = ctx.getImageData(0, 0, 16, 16); + + let r1 = 157, g1 = 107, b1 = 255; + let r2 = 255, g2 = 107, b2 = 157; + let bestSat1 = -1; + let bestSat2 = -1; + + for (let i = 0; i < data.length; i += 4) { + const r = data[i], g = data[i + 1], b = data[i + 2]; + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + const lum = (max + min) / 2; + if (lum < 36 || lum > 234) continue; + const sat = max === 0 ? 0 : (max - min) / max; + if (sat > bestSat1) { + bestSat2 = bestSat1; + r2 = r1; g2 = g1; b2 = b1; + bestSat1 = sat; + r1 = r; g1 = g; b1 = b; + } else if (sat > bestSat2 && Math.abs(r - r1) + Math.abs(g - g1) > 65) { + bestSat2 = sat; + r2 = r; g2 = g; b2 = b; + } + } + + document.documentElement.style.setProperty('--aura-dynamic-primary', `rgb(${r1}, ${g1}, ${b1})`); + document.documentElement.style.setProperty('--aura-dynamic-secondary', `rgb(${r2}, ${g2}, ${b2})`); + } catch (_) {} + }; + img.onerror = () => { + // Artwork without CORS headers can't be sampled; fall back to the app's art-derived colour. + const accent = LastWave?.player?.getCurrentTrack?.()?.accentColor; + if (accent) { + document.documentElement.style.setProperty('--aura-dynamic-primary', accent); + } + }; + img.src = url; +} + +function isMiniPlayerActive() { + if (document.querySelector('[data-lw="mini-player"]')) return true; + if (!document.querySelector('[data-lw="app-shell"]') && window.innerHeight <= 300 && window.innerWidth <= 540) { + return true; + } + return false; +} + +let deckEl = null; +let canvasEl = null; +let ctx = null; + +function destroyDeck() { + if (deckEl) { + deckEl.remove(); + deckEl = null; + canvasEl = null; + ctx = null; + } + document.getElementById('aura-orbit-deck')?.remove(); +} + +function updatePillFade(pills) { + if (!pills) return; + const max = pills.scrollWidth - pills.clientWidth; + pills.classList.toggle('fade-start', pills.scrollLeft > 2); + pills.classList.toggle('fade-end', max > 2 && pills.scrollLeft < max - 2); +} + +function wireDeckInteractions(el) { + const pills = el.querySelector('#aura-skin-pills'); + pills?.addEventListener( + 'wheel', + (e) => { + + if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) { + pills.scrollLeft += e.deltaY; + e.preventDefault(); + } + }, + { passive: false } + ); + pills?.addEventListener('scroll', () => updatePillFade(pills), { passive: true }); + + el.querySelector('#aura-skin-pills')?.addEventListener('click', (e) => { + const btn = e.target.closest('.aura-pill-btn'); + if (!btn) return; + setSkin(btn.dataset.skin); + }); + + el.querySelector('#aura-vis-btn')?.addEventListener('click', () => { + state.visualizerMode = state.visualizerMode === 'bars' ? 'radial' : 'bars'; + persistState(); + }); + + el.querySelector('#aura-focus-btn')?.addEventListener('click', () => { + state.focusStage = !state.focusStage; + applySkinAndLayout(true); + }); + + el.querySelector('#aura-hide-btn')?.addEventListener('click', () => { + state.deckVisible = false; + applySkinAndLayout(true); + }); + + el.querySelector('#aura-play-btn')?.addEventListener('click', () => { + LastWave?.player?.togglePlay?.(); + syncTrackUI(); + }); + + el.querySelector('#aura-prev-btn')?.addEventListener('click', () => { + LastWave?.player?.previous?.(); + }); + + el.querySelector('#aura-next-btn')?.addEventListener('click', () => { + LastWave?.player?.next?.(); + }); + + el.querySelector('#aura-like-btn')?.addEventListener('click', () => { + LastWave?.library?.toggleLike?.(); + syncTrackUI(); + }); + + el.querySelector('#aura-stage-btn')?.addEventListener('click', () => { + LastWave?.nav?.navigate?.('/now-playing'); + }); + + el.querySelector('#aura-mini-btn')?.addEventListener('click', () => { + LastWave?.window?.toggleMiniPlayer?.(); + }); + + const dragHeader = el.querySelector('#aura-deck-drag'); + let dragging = false; + let startX = 0, startY = 0, origX = 0, origY = 0; + + dragHeader?.addEventListener('pointerdown', (e) => { + if (e.target.closest('button')) return; + dragging = true; + startX = e.clientX; + startY = e.clientY; + const rect = el.getBoundingClientRect(); + origX = rect.left; + origY = rect.top; + dragHeader.setPointerCapture(e.pointerId); + }); + + dragHeader?.addEventListener('pointermove', (e) => { + if (!dragging) return; + const maxX = window.innerWidth - state.deck.width - 12; + const maxY = window.innerHeight - state.deck.height - 76; + let nx = Math.min(Math.max(12, origX + (e.clientX - startX)), Math.max(12, maxX)); + let ny = Math.min(Math.max(52, origY + (e.clientY - startY)), Math.max(52, maxY)); + + if (Math.abs(nx - 16) < 18) nx = 16; + if (Math.abs(nx - maxX) < 18) nx = maxX; + if (Math.abs(ny - 56) < 18) ny = 56; + if (Math.abs(ny - maxY) < 18) ny = maxY; + + state.deck.x = nx; + state.deck.y = ny; + el.style.left = `${nx}px`; + el.style.top = `${ny}px`; + }); + + const endDrag = () => { + if (!dragging) return; + dragging = false; + persistState(); + }; + dragHeader?.addEventListener('pointerup', endDrag); + dragHeader?.addEventListener('pointercancel', endDrag); + + const resizeHandle = el.querySelector('#aura-resize-handle'); + let resizing = false; + let rStartX = 0, rStartY = 0, origW = 0, origH = 0; + + resizeHandle?.addEventListener('pointerdown', (e) => { + e.stopPropagation(); + resizing = true; + rStartX = e.clientX; + rStartY = e.clientY; + origW = state.deck.width; + origH = state.deck.height; + resizeHandle.setPointerCapture(e.pointerId); + }); + + resizeHandle?.addEventListener('pointermove', (e) => { + if (!resizing) return; + const nw = Math.min(Math.max(320, origW + (e.clientX - rStartX)), 680); + const nh = Math.min(Math.max(176, origH + (e.clientY - rStartY)), 440); + state.deck.width = nw; + state.deck.height = nh; + el.style.width = `${nw}px`; + el.style.height = `${nh}px`; + }); + + const endResize = () => { + if (!resizing) return; + resizing = false; + persistState(); + }; + resizeHandle?.addEventListener('pointerup', endResize); + resizeHandle?.addEventListener('pointercancel', endResize); +} + +function ensureDeck() { + if (isMiniPlayerActive()) { + destroyDeck(); + return; + } + if (deckEl && document.body.contains(deckEl)) return; + + destroyDeck(); + const el = document.createElement('aside'); + el.id = 'aura-orbit-deck'; + el.className = 'aura-orbit-deck'; + el.setAttribute('aria-label', 'Aura Orbit Deck v2'); + el.innerHTML = ` +
+
+ + Aura v2 +
+
+ ${SKINS.map( + (s) => `` + ).join('')} +
+
+ + + +
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+
+
Aura Soundstage Ready
+
LastWave Desktop
+
+ +
+ +
+
+ +
+
+ + + + +
+
+ + +
+
+
+
+ `; + + document.body.appendChild(el); + deckEl = el; + canvasEl = el.querySelector('#aura-eq-canvas'); + ctx = canvasEl?.getContext('2d') || null; + wireDeckInteractions(el); +} + +/* ========================================================================== + Mini Player widget deck + -------------------------------------------------------------------------- + When the Mini Player window is open the theme draws its own compact card + there. The card matches the chosen plugin-widget look (vinyl / cassette / + terminal / pet) or the Aura Orbit Deck look, and carries a lyrics switch + that shows or hides the current synced lyric line. + ========================================================================== */ + +const reduceMotion = + typeof window.matchMedia === 'function' && + window.matchMedia('(prefers-reduced-motion: reduce)').matches; +const perfMode = () => document.documentElement.dataset.performance === 'true'; + +let miniEl = null; +let miniRafId = null; +let miniEls = {}; +let miniSvgRefs = {}; +let miniPetCtx = null; +let miniCleanups = []; +const lastProgress = { positionSec: 0, durationSec: 0 }; + +// Vinyl animation state +let vSpeed = 0; +// Cassette animation state +let cAngle = 0; +// Pet state +let petSongs = 0; +let petListenedMs = 0; +let petHappiness = 0.35; +let petLastTrackId = null; +let petJumpUntil = 0; +let petNotes = []; +let plainLastIdx = -1; + +// Lyrics cache (fetched on demand when the switch is on) +const lyricsCache = { trackId: null, lines: [], synced: false, instrumental: false, error: false }; +let lyricsInflight = false; + +function tauriInvoke(command, args) { + try { + const internals = window.__TAURI_INTERNALS__; + if (internals && typeof internals.invoke === 'function') { + return Promise.resolve(internals.invoke(command, args || {})); + } + } catch (err) { + console.warn('[aura] invoke failed:', command, err); + } + return Promise.resolve(null); +} + +// Native mini-player glyphs live in the (visually hidden) app DOM; a programmatic +// .click() still fires their handlers, so we reuse the app's own minimize/close logic. +function clickNativeGlyph(...labels) { + const root = document.querySelector('[data-lw="mini-player"]'); + if (!root) return false; + for (const label of labels) { + const btn = root.querySelector(`button[aria-label="${label}"]`); + if (btn) { + try { + btn.click(); + return true; + } catch (_) {} + } + } + return false; +} + +function fmtMs(ms) { + const s = Math.max(0, Math.floor((ms || 0) / 1000)); + return Math.floor(s / 60) + ':' + ('0' + (s % 60)).slice(-2); +} + +function safeColor(c) { + return typeof c === 'string' && /^#[0-9a-f]{3,8}$/i.test(c) ? c : '#9d6bff'; +} + +function miniSnapshot() { + const player = LastWave?.player; + const t = player && player.getCurrentTrack ? player.getCurrentTrack() : null; + let posSec = player && player.getPosition ? player.getPosition() : 0; + let durSec = player && player.getDuration ? player.getDuration() : 0; + if (!posSec) posSec = lastProgress.positionSec || 0; + if (!durSec) durSec = lastProgress.durationSec || (t ? t.durationSec || 0 : 0); + return { + currentTrack: t, + isPlaying: Boolean(player && player.isPlaying && player.isPlaying()), + positionMs: Math.round((posSec || 0) * 1000), + durationMs: Math.round((durSec || 0) * 1000), + }; +} + +function clockLabel(snap) { + if (snap.durationMs > 0) return fmtMs(snap.positionMs) + ' / ' + fmtMs(snap.durationMs); + return '--:-- / --:--'; +} + +// Shared parser: normalize a backend lyrics result into lyricsCache. +function applyLyricsResult(trackId, res) { + if (!res) { + lyricsCache.trackId = trackId; + lyricsCache.lines = []; + lyricsCache.synced = false; + lyricsCache.instrumental = false; + lyricsCache.error = true; + return; + } + if (res.isInstrumental) { + lyricsCache.trackId = trackId; + lyricsCache.lines = []; + lyricsCache.synced = false; + lyricsCache.instrumental = true; + lyricsCache.error = false; + return; + } + const raw = Array.isArray(res.lines) ? res.lines : []; + let lines = raw + .map((l) => { + const startMs = Math.max(0, Number(l.timeMs) || 0); + const durMs = Math.max(0, Number(l.durationMs) || 0); + return { startMs, endMs: startMs + durMs, text: String(l.text || '').trim() }; + }) + .filter((l) => l.text); + if (lines.length === 0 && res.plainLyrics && String(res.plainLyrics).trim()) { + lines = String(res.plainLyrics) + .split(/\r?\n/) + .map((t) => ({ startMs: 0, endMs: 0, text: t.trim() })) + .filter((t) => t.text); + } + lyricsCache.trackId = trackId; + lyricsCache.lines = lines; + lyricsCache.synced = Boolean(res.isSynced && raw.length > 0); + lyricsCache.instrumental = false; + lyricsCache.error = lines.length === 0; +} + +// Adopt partial/full lyrics pushed by the app itself (lyrics-partial Tauri event). +function listenLyricsPartials() { + const internals = window.__TAURI_INTERNALS__; + if (!internals || typeof internals.listen !== 'function') return null; + let off = null; + try { + Promise.resolve( + internals.listen('lyrics-partial', (ev) => { + try { + const payload = ev && ev.payload ? ev.payload : ev; + const trackId = payload && payload.trackId; + const res = payload && payload.result; + if (trackId && res) applyLyricsResult(trackId, res); + } catch (_) {} + }) + ) + .then((un) => { + off = typeof un === 'function' ? un : null; + }) + .catch(() => {}); + } catch (_) {} + return () => { + if (off) { + try { + off(); + } catch (_) {} + } + }; +} + +async function ensureLyrics(track) { + if (!track || lyricsCache.trackId === track.id || lyricsInflight) return; + lyricsInflight = true; + try { + const dur = Math.max(0, Math.round(track.durationSec || 0)); + const res = await tauriInvoke('lyrics_fetch', { + title: track.title || '', + artist: track.artist || '', + album: track.album || '', + durationSeconds: dur > 0 ? dur : null, + forceRefresh: false, + wordByWord: false, + videoId: track.videoId || null, + preferredProviderId: 'auto', + excludeProviderIds: [], + trackId: track.id, + requestId: 'aura-mini-' + track.id + '-' + Date.now(), + }); + applyLyricsResult(track.id, res); + } catch (err) { + console.warn('[aura] lyrics_fetch failed for', track?.id, err); + lyricsCache.trackId = track.id; + lyricsCache.lines = []; + lyricsCache.synced = false; + lyricsCache.instrumental = false; + lyricsCache.error = true; + } finally { + lyricsInflight = false; + } +} + +function syncedLineIndex(lines, positionMs) { + if (!lines.length || positionMs < lines[0].startMs) return -1; + let lo = 0; + let hi = lines.length - 1; + let out = 0; + while (lo <= hi) { + const mid = (lo + hi) >> 1; + if (lines[mid].startMs <= positionMs) { + out = mid; + lo = mid + 1; + } else { + hi = mid - 1; + } + } + return out; +} + +function nativeLyricsText() { + const root = document.querySelector('[data-lw="mini-player-lyrics"]'); + const span = root?.querySelector('span'); + const txt = span?.textContent?.trim() || ''; + return txt && txt !== '♪︎' ? txt : ''; +} + +function renderMiniLyrics(snap) { + const textEl = miniEls.lyricsText; + if (!textEl) return; + if (!state.mini.lyrics) { + textEl.textContent = ''; + return; + } + if (!snap.currentTrack) { + textEl.textContent = '♪︎'; + return; + } + if (lyricsCache.trackId !== snap.currentTrack.id) { + ensureLyrics(snap.currentTrack); + textEl.textContent = nativeLyricsText() || 'Loading lyrics…'; + return; + } + if (lyricsCache.instrumental) { + textEl.textContent = '♪︎ instrumental'; + return; + } + const lines = lyricsCache.lines; + if (!lines.length) { + textEl.textContent = nativeLyricsText() || (lyricsCache.error ? 'No lyrics found' : '♪︎'); + return; + } + let idx = -1; + if (lyricsCache.synced) { + idx = syncedLineIndex(lines, snap.positionMs); + } else if (snap.isPlaying) { + idx = Math.floor(snap.positionMs / 5000) % lines.length; + plainLastIdx = idx; + } else { + idx = plainLastIdx; + } + textEl.textContent = idx >= 0 ? lines[idx].text : nativeLyricsText() || '♪︎'; +} + +const PET_SPRITES = { + idle: [ + '....####....', + '..########..', + '.##########.', + '.##o####o##.', + '.##########.', + '.####mm####.', + '..########..', + '...##..##...', + '...##..##...', + '..###..###..', + ], + danceA: [ + '....####....', + '..########..', + '#.########.#', + '##o######o##', + '.##########.', + '.###mmmm###.', + '..########..', + '..##....##..', + '.##......##.', + '###......###', + ], + danceB: [ + '....####....', + '..########..', + '.##########.', + '.##o####o##.', + '############', + '#.###mm###.#', + '..########..', + '....####....', + '...##..##...', + '...##..##...', + ], + sleep: [ + '............', + '............', + '....####....', + '..########..', + '.##-####-##.', + '.##########.', + '.####mm####.', + '.##########.', + '..########..', + '.##########.', + ], +}; +const PET_COLORS = { bg: '#9bbc0f', light: '#8bac0f', mid: '#306230', dark: '#0f380f' }; + +function petDrawSprite(ctx, name, ox, oy) { + const rows = PET_SPRITES[name]; + for (let y = 0; y < rows.length; y++) { + for (let x = 0; x < rows[y].length; x++) { + const ch = rows[y][x]; + if (ch === '.') continue; + ctx.fillStyle = ch === '#' ? PET_COLORS.mid : PET_COLORS.dark; + ctx.fillRect(ox + x, oy + y, 1, 1); + } + } +} + +function renderPetFrame(now, dt, snap) { + if (!miniPetCtx) return; + const ctx = miniPetCtx; + const t = snap.currentTrack; + const playing = snap.isPlaying; + if (playing) { + petListenedMs += dt * 1000; + petHappiness = Math.min(1, petHappiness + dt * 0.004); + } else { + petHappiness = Math.max(0.1, petHappiness - dt * 0.0015); + } + + ctx.fillStyle = PET_COLORS.bg; + ctx.fillRect(0, 0, 48, 32); + ctx.fillStyle = PET_COLORS.light; + ctx.fillRect(0, 28, 48, 4); + const jumping = now < petJumpUntil; + const beat = Math.floor(now / 260) % 2; + const bob = jumping ? -Math.round(Math.sin(((petJumpUntil - now) / 900) * Math.PI) * 6) : 0; + if (jumping) { + petDrawSprite(ctx, 'danceA', 18, 18 + bob); + } else if (playing && !reduceMotion) { + petDrawSprite(ctx, beat ? 'danceA' : 'danceB', 18 + (beat ? -1 : 1), 18 - beat); + if (Math.random() < dt * 2.2) petNotes.push({ x: 8 + Math.random() * 30, y: 24, life: 1 }); + } else if (t) { + petDrawSprite(ctx, 'sleep', 18, 18); + } else { + petDrawSprite(ctx, 'idle', 18, 18); + } + ctx.fillStyle = PET_COLORS.dark; + for (let i = petNotes.length - 1; i >= 0; i--) { + const n = petNotes[i]; + n.y -= dt * 9; + n.life -= dt * 0.6; + if (n.life <= 0 || n.y < 1) petNotes.splice(i, 1); + else { + const nx = Math.round(n.x); + const ny = Math.round(n.y); + ctx.fillRect(nx + 2, ny, 1, 4); + ctx.fillRect(nx + 3, ny, 2, 1); + ctx.fillRect(nx, ny + 3, 2, 2); + } + } + + if (miniEls.petMood) { + miniEls.petMood.textContent = !t + ? 'waiting for music...' + : now < petJumpUntil + ? 'new song!! ' + t.title + : playing + ? 'vibing to ' + (t.artist || '') + : 'napping... press play'; + } + if (miniEls.petHearts) { + const full = Math.round(petHappiness * 5); + miniEls.petHearts.textContent = + 'LOVE ' + new Array(full + 1).join('■') + new Array(5 - full + 1).join('□'); + } + if (miniEls.petStats) { + miniEls.petStats.textContent = + petSongs + (petSongs === 1 ? ' song' : ' songs') + ' · ' + Math.floor(petListenedMs / 60000) + ' min'; + } +} + +function cassetteSpec(t) { + if (!t) return ''; + const parts = [String(t.codec || 'AUDIO').toUpperCase()]; + if (t.bitDepth > 0) parts.push(t.bitDepth + 'bit'); + if (t.sampleRateHz > 0) parts.push((t.sampleRateHz / 1000).toFixed(t.sampleRateHz % 1000 ? 1 : 0) + 'kHz'); + return parts.join('/'); +} + +function asciiBar(p, width) { + const n = Math.round(Math.max(0, Math.min(1, p)) * width); + return '[' + new Array(n + 1).join('#') + new Array(width - n + 1).join('.') + ']'; +} + +function buildCassetteSvg(root) { + const NS = 'http://www.w3.org/2000/svg'; + const svg = document.createElementNS(NS, 'svg'); + svg.setAttribute('viewBox', '0 0 98 62'); + svg.setAttribute('class', 'aum-cc-svg'); + svg.setAttribute('aria-hidden', 'true'); + const mk = (tag, attrs) => { + const n = document.createElementNS(NS, tag); + for (const k in attrs) n.setAttribute(k, attrs[k]); + svg.appendChild(n); + return n; + }; + mk('rect', { x: 1, y: 1, width: 96, height: 60, rx: 5, fill: '#2a2a33', stroke: '#45454f', 'stroke-width': 1.5 }); + const sticker = mk('rect', { x: 7, y: 6, width: 84, height: 30, rx: 3, fill: '#e94f37' }); + mk('rect', { x: 7, y: 15, width: 84, height: 3, fill: 'rgba(0,0,0,.18)' }); + mk('rect', { x: 22, y: 21, width: 54, height: 12, rx: 6, fill: '#15151b' }); + const packL = mk('circle', { cx: 34, cy: 27, r: 8, fill: '#3b2a1e' }); + const packR = mk('circle', { cx: 64, cy: 27, r: 4, fill: '#3b2a1e' }); + const reel = (cx) => { + const g = mk('g', {}); + const c1 = document.createElementNS(NS, 'circle'); + c1.setAttribute('cx', cx); c1.setAttribute('cy', 27); c1.setAttribute('r', 4.2); c1.setAttribute('fill', '#ece8dd'); + g.appendChild(c1); + for (let i = 0; i < 6; i++) { + const a = (i * Math.PI) / 3; + const r = document.createElementNS(NS, 'rect'); + r.setAttribute('x', cx - 0.6); r.setAttribute('y', 27 - 3.6); + r.setAttribute('width', 1.2); r.setAttribute('height', 2.4); + r.setAttribute('fill', '#2a2a33'); + r.setAttribute('transform', `rotate(${(a * 180) / Math.PI} ${cx} 27)`); + g.appendChild(r); + } + const c2 = document.createElementNS(NS, 'circle'); + c2.setAttribute('cx', cx); c2.setAttribute('cy', 27); c2.setAttribute('r', 1.2); c2.setAttribute('fill', '#2a2a33'); + g.appendChild(c2); + return g; + }; + const reelL = reel(34); + const reelR = reel(64); + mk('path', { d: 'M18 61 L24 47 H74 L80 61 Z', fill: '#202028', stroke: '#45454f', 'stroke-width': 1 }); + [30, 42, 56, 68].forEach((x) => { + const dot = document.createElementNS(NS, 'circle'); + dot.setAttribute('cx', x); dot.setAttribute('cy', 54); dot.setAttribute('r', 1.6); dot.setAttribute('fill', '#0c0c10'); + svg.appendChild(dot); + }); + const led = mk('circle', { cx: 90, cy: 52, r: 2.2, fill: '#3a3a40' }); + root.appendChild(svg); + return { svg, sticker, packL, packR, reelL, reelR, led }; +} + +function updateMiniDynamic() { + if (!miniEl) return; + let snap; + try { + snap = miniSnapshot(); + } catch (_) { + return; + } + const t = snap.currentTrack; + miniEl.classList.toggle('is-playing', snap.isPlaying); + + if (miniEls.progressFill) { + const p = snap.durationMs > 0 ? Math.min(1, snap.positionMs / snap.durationMs) : 0; + miniEls.progressFill.style.width = (p * 100).toFixed(2) + '%'; + } + if (miniEls.playBtn) { + miniEls.playBtn.textContent = snap.isPlaying ? '❚❚' : '▶'; + miniEls.playBtn.setAttribute('aria-label', snap.isPlaying ? 'Pause' : 'Play'); + } + if (miniEls.likeBtn && t) { + const liked = Boolean(LastWave?.library?.isLiked?.(t.id)); + miniEls.likeBtn.textContent = liked ? '♥' : '♡'; + miniEls.likeBtn.classList.toggle('active', liked); + miniEls.likeBtn.setAttribute('aria-pressed', String(liked)); + } + + const clock = clockLabel(snap); + if (miniEls.vsTime) miniEls.vsTime.textContent = clock; + if (miniEls.ccTime) miniEls.ccTime.textContent = (snap.isPlaying ? 'PLAY ' : 'PAUSE ') + clock; + if (miniEls.tlProgress) { + const p = snap.durationMs > 0 ? snap.positionMs / snap.durationMs : 0; + miniEls.tlProgress.textContent = + (snap.isPlaying ? 'PLAY ' : 'HOLD ') + + asciiBar(p, 12) + + ' ' + + (snap.durationMs > 0 ? fmtMs(snap.positionMs) + '/' + fmtMs(snap.durationMs) : '--:--/--:--'); + } + if (miniEls.vsArm) { + const p = snap.durationMs > 0 ? snap.positionMs / snap.durationMs : 0; + miniEls.vsArm.style.transform = `rotate(${(t ? 18 + 20 * p : 0).toFixed(2)}deg)`; + } + renderMiniLyrics(snap); +} + +function miniFrame(now) { + miniRafId = requestAnimationFrame(miniFrame); + if (!miniEl) return; + try { + const last = miniFrame.last || 0; + const dt = Math.min(0.25, (now - last) / 1000 || 0); + miniFrame.last = now; + const snap = miniSnapshot(); + updateMiniDynamic(); + + if (state.mini.look === 'vinyl') { + const target = snap.isPlaying && !reduceMotion && !perfMode() ? 200 : 0; + vSpeed += (target - vSpeed) * Math.min(1, dt * (target ? 2.5 : 1.2)); + if (miniEls.vsRpm) miniEls.vsRpm.textContent = (vSpeed / 6).toFixed(1) + ' RPM'; + } else if (state.mini.look === 'cassette') { + if (snap.isPlaying && !reduceMotion && !perfMode()) { + cAngle = (cAngle + dt * 220) % 360; + if (miniSvgRefs.reelL) miniSvgRefs.reelL.setAttribute('transform', `rotate(${cAngle.toFixed(1)} 34 27)`); + if (miniSvgRefs.reelR) miniSvgRefs.reelR.setAttribute('transform', `rotate(${cAngle.toFixed(1)} 64 27)`); + } + const p = snap.durationMs > 0 ? Math.min(1, snap.positionMs / snap.durationMs) : 0; + if (miniSvgRefs.packL) miniSvgRefs.packL.setAttribute('r', (4.5 + 7 * (1 - p)).toFixed(2)); + if (miniSvgRefs.packR) miniSvgRefs.packR.setAttribute('r', (4.5 + 7 * p).toFixed(2)); + if (miniSvgRefs.led) miniSvgRefs.led.setAttribute('fill', snap.isPlaying ? '#ff3b3b' : '#3a3a40'); + } else if (state.mini.look === 'pet') { + renderPetFrame(now, dt, snap); + } else if (state.mini.look === 'deck') { + drawMiniEqCanvas(); + } + } catch (_) {} +} + +function drawMiniEqCanvas() { + const c = miniEls.eqCanvas; + if (!c) return; + const c2d = c.getContext('2d'); + if (!c2d) return; + const dpr = window.devicePixelRatio || 1; + const rect = c.getBoundingClientRect(); + if (rect.width <= 0 || rect.height <= 0) return; + const w = Math.floor(rect.width * dpr); + const h = Math.floor(rect.height * dpr); + if (c.width !== w || c.height !== h) { + c.width = w; + c.height = h; + } + c2d.save(); + c2d.scale(dpr, dpr); + c2d.clearRect(0, 0, rect.width, rect.height); + const cs = getComputedStyle(document.documentElement); + const primary = cs.getPropertyValue('--aura-primary').trim() || '#9d6bff'; + const secondary = cs.getPropertyValue('--aura-secondary').trim() || '#ff6b9d'; + const grad = c2d.createLinearGradient(0, rect.height, rect.width, 0); + grad.addColorStop(0, primary); + grad.addColorStop(1, secondary); + c2d.fillStyle = grad; + const bars = 20; + const padX = 6; + const padY = 4; + const usableW = rect.width - padX * 2; + const usableH = rect.height - padY * 2; + const gap = 2; + const barW = Math.max(2, (usableW - gap * (bars - 1)) / bars); + for (let i = 0; i < bars; i++) { + const level = levels[i] || 0.05; + const barH = Math.max(2, level * usableH); + const x = padX + i * (barW + gap); + const y = rect.height - padY - barH; + c2d.beginPath(); + if (c2d.roundRect) c2d.roundRect(x, y, barW, barH, 2); + else c2d.rect(x, y, barW, barH); + c2d.fill(); + } + c2d.restore(); +} + +function syncMiniTrackUI() { + if (!miniEl) return; + const t = LastWave?.player?.getCurrentTrack?.() || null; + if (t?.artworkUrl) updateArtworkChroma(t.artworkUrl); + else if (t?.accentColor) document.documentElement.style.setProperty('--aura-dynamic-primary', t.accentColor); + + const title = t ? t.title : 'Nothing playing'; + const artist = t ? t.artist + (t.album ? ' · ' + t.album : '') : 'Pick a track to begin'; + (miniEls.titles || []).forEach((el) => { if (el) el.textContent = title; }); + (miniEls.artists || []).forEach((el) => { if (el) el.textContent = artist; }); + + if (miniSvgRefs.sticker && t) miniSvgRefs.sticker.setAttribute('fill', safeColor(t.accentColor)); + if (miniEls.vsLabel && t?.artworkUrl) { + miniEls.vsLabel.style.backgroundImage = `url("${t.artworkUrl}")`; + } + if (miniEls.platterArt) { + if (t?.artworkUrl && miniEls.platterArt.src !== t.artworkUrl) miniEls.platterArt.src = t.artworkUrl; + else if (!t?.artworkUrl) miniEls.platterArt.removeAttribute('src'); + } + if (miniEls.codecPill) { + const label = t?.codec ? String(t.codec).toUpperCase() : ''; + if (label && (t.bitDepth >= 24 || (t.sampleRateHz || 0) > 48000)) { + miniEls.codecPill.textContent = label + ' HI-RES'; + miniEls.codecPill.style.display = 'inline-block'; + } else if (label) { + miniEls.codecPill.textContent = label; + miniEls.codecPill.style.display = 'inline-block'; + } else { + miniEls.codecPill.style.display = 'none'; + } + } + // Terminal lines + if (miniEls.tlCmd) miniEls.tlCmd.textContent = t ? '$ lastwave now-playing --verbose' : '$ lastwave status'; + if (miniEls.tlTitle) miniEls.tlTitle.textContent = t ? '> ' + t.title : '> idle. queue something to begin'; + if (miniEls.tlMeta) { + miniEls.tlMeta.textContent = t + ? '> ' + t.artist + (t.album ? ' // ' + t.album : '') + ' [' + cassetteSpec(t) + ']' + : '> waiting for playback'; + } + // Pet track counting + const id = t ? t.id : null; + if (id && id !== petLastTrackId) { + petSongs += 1; + petJumpUntil = performance.now() + 900; + petHappiness = Math.min(1, petHappiness + 0.06); + } + petLastTrackId = id; + // Lyrics cache: invalidate on track change; ensure fetch when switch on + if (lyricsCache.trackId !== id) { + lyricsCache.trackId = null; + lyricsCache.lines = []; + lyricsCache.error = false; + lyricsCache.instrumental = false; + if (state.mini.lyrics && t) ensureLyrics(t); + } +} + +function applyLook() { + if (!miniEl) return; + miniEl.dataset.look = state.mini.look; + (miniEls.lookBtns || []).forEach((btn) => { + const active = btn.dataset.look === state.mini.look; + btn.classList.toggle('active', active); + btn.setAttribute('aria-pressed', String(active)); + }); +} + +function applyLyricsSwitch() { + if (!miniEl) return; + miniEl.classList.toggle('lyrics-on', state.mini.lyrics); + if (miniEls.lyricsSwitch) { + miniEls.lyricsSwitch.setAttribute('aria-checked', String(state.mini.lyrics)); + } + if (state.mini.lyrics) { + const t = LastWave?.player?.getCurrentTrack?.(); + if (t) ensureLyrics(t); + } + updateMiniDynamic(); +} + +function ensureMiniDeck() { + if (miniEl && document.body.contains(miniEl)) return; + destroyMiniDeck(); + + const el = document.createElement('aside'); + el.id = 'aura-mini-deck'; + el.className = 'aura-mini-deck'; + el.setAttribute('aria-label', 'Aura Mini Player'); + el.dataset.look = state.mini.look; + el.innerHTML = ` +
+
+ ${LOOKS.map( + (l) => + `` + ).join('')} +
+
+ + + + +
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+ +
+
WAVEGOTCHI
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ ♪ + +
+ +
+ + + + +
+
+ `; + + document.body.appendChild(el); + miniEl = el; + document.body.classList.add('aura-mini-custom'); + + miniEls = { + lookBtns: Array.from(el.querySelectorAll('.aum-look-btn')), + lyricsSwitch: el.querySelector('#aum-lyrics-switch'), + titles: Array.from(el.querySelectorAll('.aum-title, #aum-deck-title')), + artists: Array.from(el.querySelectorAll('.aum-artist, #aum-deck-artist')), + vsDisc: el.querySelector('.aum-vs-disc'), + vsLabel: el.querySelector('.aum-vs-label'), + vsArm: el.querySelector('.aum-vs-arm'), + vsRpm: el.querySelector('.aum-rpm'), + vsTime: el.querySelector('.aum-time'), + ccTime: el.querySelector('.aum-cc-time'), + tlCmd: el.querySelector('.aum-tl-line[data-i="0"]'), + tlTitle: el.querySelector('.aum-tl-line[data-i="1"]'), + tlMeta: el.querySelector('.aum-tl-line[data-i="2"]'), + tlProgress: el.querySelector('.aum-tl-line[data-i="3"]'), + petMood: el.querySelector('.aum-wg-mood'), + petHearts: el.querySelector('.aum-wg-hearts'), + petStats: el.querySelector('.aum-wg-stats'), + platterArt: el.querySelector('#aum-platter-art'), + codecPill: el.querySelector('#aum-codec-pill'), + eqCanvas: el.querySelector('#aum-eq-canvas'), + progressFill: el.querySelector('.aum-progress-fill'), + playBtn: el.querySelector('#aum-play'), + likeBtn: el.querySelector('#aum-like'), + lyricsText: el.querySelector('.aum-lyrics-text'), + }; + + const petCanvas = el.querySelector('#aum-wg-canvas'); + miniPetCtx = petCanvas ? petCanvas.getContext('2d') : null; + + const ccArt = el.querySelector('#aum-cc-art'); + if (ccArt) miniSvgRefs = buildCassetteSvg(ccArt); + + try { + // Look switcher + miniEls.lookBtns.forEach((btn) => { + btn.addEventListener('click', () => { + state.mini.look = btn.dataset.look; + applyLook(); + persistState(); + }); + }); + + // Lyrics switch + miniEls.lyricsSwitch?.addEventListener('click', () => { + state.mini.lyrics = !state.mini.lyrics; + applyLyricsSwitch(); + persistState(); + }); + + // Transport + el.querySelector('#aum-prev')?.addEventListener('click', () => LastWave?.player?.previous?.()); + miniEls.playBtn?.addEventListener('click', () => { + LastWave?.player?.togglePlay?.(); + updateMiniDynamic(); + setTimeout(updateMiniDynamic, 120); + }); + el.querySelector('#aum-next')?.addEventListener('click', () => LastWave?.player?.next?.()); + miniEls.likeBtn?.addEventListener('click', () => { + LastWave?.library?.toggleLike?.(); + syncMiniTrackUI(); + updateMiniDynamic(); + }); + + // Window actions — reuse the app's native glyph handlers first, then Tauri core fallback. + el.querySelector('#aum-max-btn')?.addEventListener('click', () => LastWave?.window?.toggleMiniPlayer?.()); + el.querySelector('#aum-min-btn')?.addEventListener('click', async () => { + if (clickNativeGlyph('Minimize')) return; + await tauriInvoke('plugin:window:minimize', { label: 'main' }); + }); + el.querySelector('#aum-close-btn')?.addEventListener('click', async () => { + if (clickNativeGlyph('Close mini player', 'Close')) return; + const danger = document.querySelector('[data-lw="mini-player"] button.mini-glyph.danger'); + if (danger) { try { danger.click(); return; } catch (_) {} } + await tauriInvoke('plugin:window:close', { label: 'main' }); + LastWave?.window?.toggleMiniPlayer?.(); + }); + + // Click-to-seek on the progress strip + const progress = el.querySelector('#aum-progress'); + progress?.addEventListener('click', (e) => { + const rect = progress.getBoundingClientRect(); + const ratio = Math.min(1, Math.max(0, (e.clientX - rect.left) / rect.width)); + const t = LastWave?.player?.getCurrentTrack?.(); + const dur = LastWave?.player?.getDuration?.() || t?.durationSec || 0; + if (dur > 0) LastWave?.player?.seek?.(ratio * dur); + }); + + // Event-driven updates so times, play state and lyrics stay live even between frames. + miniCleanups = []; + const partialCleanup = listenLyricsPartials(); + if (partialCleanup) miniCleanups.push(partialCleanup); + if (LastWave?.events?.on) { + miniCleanups.push( + LastWave.events.on('progress', (p) => { + if (p && typeof p === 'object') { + lastProgress.positionSec = Number(p.positionSec) || 0; + lastProgress.durationSec = Number(p.durationSec) || 0; + } + updateMiniDynamic(); + }) + ); + miniCleanups.push(LastWave.events.on('playState', () => updateMiniDynamic())); + miniCleanups.push(LastWave.events.on('trackChange', () => syncMiniTrackUI())); + } + } catch (err) { + console.warn('[aura] mini deck wiring failed:', err); + } + + applyLook(); + applyLyricsSwitch(); + syncMiniTrackUI(); + updateMiniDynamic(); + if (miniRafId === null) miniRafId = requestAnimationFrame(miniFrame); +} + +function destroyMiniDeck() { + if (miniRafId !== null) { + cancelAnimationFrame(miniRafId); + miniRafId = null; + } + for (const fn of miniCleanups) { + try { + fn(); + } catch (_) {} + } + miniCleanups = []; + document.getElementById('aura-mini-deck')?.remove(); + miniEl = null; + miniEls = {}; + miniSvgRefs = {}; + miniPetCtx = null; + document.body.classList.remove('aura-mini-custom'); + miniFrame.last = 0; +} + +function applySkinAndLayout(shouldPersist = true) { + const miniActive = isMiniPlayerActive(); + document.documentElement.setAttribute('data-aura-skin', state.skin); + document.body.classList.toggle('aura-in-mini-player', miniActive); + document.body.classList.toggle('aura-focus-stage', !miniActive && Boolean(state.focusStage)); + + if (miniActive) { + destroyDeck(); + ensureMiniDeck(); + document.body.classList.remove('aura-compact-docked'); + if (shouldPersist) persistState(); + return; + } + + destroyMiniDeck(); + ensureDeck(); + + const compact = window.innerWidth < 620 || window.innerHeight < 460; + document.body.classList.toggle('aura-compact-docked', compact); + + if (deckEl) { + deckEl.classList.toggle('is-hidden', !state.deckVisible); + + const defaultX = Math.max(16, window.innerWidth - state.deck.width - 24); + const defaultY = Math.max(56, window.innerHeight - state.deck.height - 88); + const x = Math.min( + Math.max(12, state.deck.x ?? defaultX), + Math.max(12, window.innerWidth - state.deck.width - 12) + ); + const y = Math.min( + Math.max(52, state.deck.y ?? defaultY), + Math.max(52, window.innerHeight - state.deck.height - 76) + ); + + deckEl.style.left = `${x}px`; + deckEl.style.top = `${y}px`; + deckEl.style.width = `${state.deck.width}px`; + deckEl.style.height = `${state.deck.height}px`; + + deckEl.querySelectorAll('.aura-pill-btn').forEach((btn) => { + const on = btn.dataset.skin === state.skin; + btn.classList.toggle('active', on); + btn.setAttribute('aria-pressed', String(on)); + }); + const pills = deckEl.querySelector('#aura-skin-pills'); + const activePill = pills?.querySelector('.aura-pill-btn.active'); + if (pills && activePill) { + const target = activePill.offsetLeft - (pills.clientWidth - activePill.offsetWidth) / 2; + pills.scrollLeft = Math.max(0, target); + updatePillFade(pills); + } + const focusBtn = deckEl.querySelector('#aura-focus-btn'); + focusBtn?.classList.toggle('active', Boolean(state.focusStage)); + focusBtn?.setAttribute('aria-pressed', String(Boolean(state.focusStage))); + const visBtn = deckEl.querySelector('#aura-vis-btn'); + visBtn?.setAttribute('aria-pressed', String(state.visualizerMode === 'radial')); + } + + if (shouldPersist) persistState(); +} + +function syncTrackUI() { + const track = LastWave?.player?.getCurrentTrack?.() || null; + const playing = Boolean(LastWave?.player?.isPlaying?.()); + + if (track?.artworkUrl) { + updateArtworkChroma(track.artworkUrl); + } else if (track?.accentColor) { + document.documentElement.style.setProperty('--aura-dynamic-primary', track.accentColor); + } + + if (isMiniPlayerActive()) { + syncMiniTrackUI(); + return; + } + if (!deckEl) return; + + const titleEl = deckEl.querySelector('#aura-track-title'); + const artistEl = deckEl.querySelector('#aura-track-artist'); + const artEl = deckEl.querySelector('#aura-platter-art'); + const playBtn = deckEl.querySelector('#aura-play-btn'); + const likeBtn = deckEl.querySelector('#aura-like-btn'); + const codecPill = deckEl.querySelector('#aura-codec-pill'); + + if (titleEl) titleEl.textContent = track?.title || 'Aura Soundstage Ready'; + if (artistEl) artistEl.textContent = track?.artist || 'LastWave Desktop'; + if (artEl) { + if (track?.artworkUrl && artEl.src !== track.artworkUrl) { + artEl.src = track.artworkUrl; + } else if (!track?.artworkUrl && artEl.src) { + artEl.removeAttribute('src'); + } + } + if (playBtn) { + playBtn.textContent = playing ? '❚❚' : '▶'; + playBtn.setAttribute('aria-label', playing ? 'Pause' : 'Play'); + } + deckEl.classList.toggle('is-playing', playing); + + if (likeBtn) { + const liked = track?.id ? Boolean(LastWave?.library?.isLiked?.(track.id)) : false; + likeBtn.textContent = liked ? '♥' : '♡'; + likeBtn.classList.toggle('active', liked); + likeBtn.setAttribute('aria-pressed', String(liked)); + } + + if (codecPill) { + const label = track?.codec ? track.codec.toUpperCase() : ''; + if (label) { + codecPill.textContent = + Number(track?.bitDepth) >= 24 || (track?.sampleRateHz || 0) > 48000 ? `${label} HI-RES` : label; + codecPill.style.display = 'inline-block'; + } else { + codecPill.style.display = 'none'; + } + } +} + +const BAR_COUNT = 28; +const levels = new Float32Array(BAR_COUNT); +let liveBins = null; +let liveRms = 0; +let idlePhase = 0; +let lastBass = ''; +let rafId = null; + +const unsubSpectrum = LastWave?.player?.onSpectrum + ? LastWave.player.onSpectrum((frame) => { + liveBins = frame?.bins || null; + liveRms = typeof frame?.rms === 'number' ? frame.rms : 0; + }) + : null; + +function renderVisualizerFrame() { + // Performance Mode: the app stops spectrum frames here too, so keep everything at rest + // instead of animating an idle wave and repainting glows. + const perfModeActive = document.documentElement.dataset.performance === 'true'; + const playing = !perfModeActive && Boolean(LastWave?.player?.isPlaying?.()); + let bassEnergy = 0; + + if (playing && liveBins && liveBins.length > 0) { + const binCount = liveBins.length; + for (let i = 0; i < BAR_COUNT; i++) { + // Average each bar's slice of ALL the bins (48, log-spaced) instead of reading only + // the first bars, so the top of the spectrum is represented too. + const start = Math.floor((i * binCount) / BAR_COUNT); + const end = Math.max(start + 1, Math.floor(((i + 1) * binCount) / BAR_COUNT)); + let sum = 0; + for (let j = start; j < end; j++) sum += liveBins[Math.min(binCount - 1, j)] || 0; + const val = Math.max(0.05, Math.min(1, sum / (end - start))); + levels[i] = levels[i] * 0.45 + val * 0.55; + if (i < 5) bassEnergy += levels[i]; + } + bassEnergy = Math.max(bassEnergy / 5, Math.min(1, liveRms * 2.2)); + } else if (playing) { + idlePhase += 0.085; + for (let i = 0; i < BAR_COUNT; i++) { + const wave = + 0.40 + + 0.34 * Math.sin(idlePhase + i * 0.42) + + 0.22 * Math.cos(idlePhase * 1.65 - i * 0.28); + levels[i] = Math.max(0.08, Math.min(1, wave)); + if (i < 5) bassEnergy += levels[i]; + } + bassEnergy /= 5; + } else { + for (let i = 0; i < BAR_COUNT; i++) { + levels[i] = levels[i] * 0.82 + 0.05 * 0.18; + } + } + + const bass = bassEnergy.toFixed(2); + if (bass !== lastBass) { + lastBass = bass; + document.documentElement.style.setProperty('--aura-bass-level', bass); + } + + if (canvasEl && ctx && state.deckVisible && !isMiniPlayerActive() && !perfModeActive) { + const dpr = window.devicePixelRatio || 1; + const rect = canvasEl.getBoundingClientRect(); + if (rect.width > 0 && rect.height > 0) { + const w = Math.floor(rect.width * dpr); + const h = Math.floor(rect.height * dpr); + if (canvasEl.width !== w || canvasEl.height !== h) { + canvasEl.width = w; + canvasEl.height = h; + } + + ctx.save(); + ctx.scale(dpr, dpr); + ctx.clearRect(0, 0, rect.width, rect.height); + + const cs = getComputedStyle(document.documentElement); + const primary = cs.getPropertyValue('--aura-primary').trim() || '#9d6bff'; + const secondary = cs.getPropertyValue('--aura-secondary').trim() || '#ff6b9d'; + + const grad = ctx.createLinearGradient(0, rect.height, rect.width, 0); + grad.addColorStop(0, primary); + grad.addColorStop(1, secondary); + ctx.fillStyle = grad; + ctx.strokeStyle = grad; + + if (state.visualizerMode === 'radial') { + const cx = rect.width / 2; + const cy = rect.height / 2; + const baseR = Math.max(7, Math.min(cx, cy) * 0.42); + const maxSpike = Math.max(6, Math.min(cx, cy) * 0.48); + ctx.lineWidth = 2.1; + ctx.lineCap = 'round'; + for (let i = 0; i < BAR_COUNT; i++) { + const angle = (i / BAR_COUNT) * Math.PI * 2 - Math.PI / 2; + const r2 = baseR + levels[i] * maxSpike; + ctx.beginPath(); + ctx.moveTo(cx + Math.cos(angle) * baseR, cy + Math.sin(angle) * baseR); + ctx.lineTo(cx + Math.cos(angle) * r2, cy + Math.sin(angle) * r2); + ctx.stroke(); + } + } else { + const padX = 8; + const padY = 5; + const usableW = rect.width - padX * 2; + const usableH = rect.height - padY * 2; + const gap = 3; + const barW = Math.max(2, (usableW - gap * (BAR_COUNT - 1)) / BAR_COUNT); + for (let i = 0; i < BAR_COUNT; i++) { + const barH = Math.max(3, levels[i] * usableH); + const x = padX + i * (barW + gap); + const y = rect.height - padY - barH; + ctx.beginPath(); + if (ctx.roundRect) { + ctx.roundRect(x, y, barW, barH, 3); + } else { + ctx.rect(x, y, barW, barH); + } + ctx.fill(); + } + } + + ctx.restore(); + } + } + + rafId = requestAnimationFrame(renderVisualizerFrame); +} + +// Show the restored skin straight away: without setVariant in the API, the app's variant +// attribute still says the old/default skin until we push our persisted choice onto . +pushSkinToApp(); +applySkinAndLayout(false); +syncTrackUI(); +rafId = requestAnimationFrame(renderVisualizerFrame); + +const cleanups = []; + +let disposed = false; +let shellCheckQueued = false; +const shellObserver = new MutationObserver(() => { + + if (shellCheckQueued) return; + shellCheckQueued = true; + requestAnimationFrame(() => { + shellCheckQueued = false; + if (disposed) return; + const miniNow = isMiniPlayerActive(); + const wasMini = document.body.classList.contains('aura-in-mini-player'); + if (miniNow !== wasMini) { + applySkinAndLayout(false); + if (!miniNow) syncTrackUI(); + } + }); +}); +shellObserver.observe(document.body, { childList: true, subtree: true }); +cleanups.push(() => shellObserver.disconnect()); + +if (LastWave?.ui?.registerPlayerBarControl) { + cleanups.push( + LastWave.ui.registerPlayerBarControl( + { + id: 'aura-orbit-toggle', + label: 'Toggle Aura Orbit Deck (Alt+A)', + icon: 'sparkles', + onClick: () => { + state.deckVisible = !state.deckVisible; + applySkinAndLayout(true); + }, + }, + pluginId || 'aura-theme' + ) + ); +} + +if (LastWave?.events?.on) { + cleanups.push(LastWave.events.on('trackChange', syncTrackUI)); + cleanups.push(LastWave.events.on('playState', syncTrackUI)); + cleanups.push(LastWave.events.on('queueUpdate', syncTrackUI)); +} + +if (LastWave?.theme?.onVariantChange) { + cleanups.push( + LastWave.theme.onVariantChange((variant) => { + if (variant && SKINS.some((s) => s.id === variant) && state.skin !== variant) { + state.skin = variant; + applySkinAndLayout(true); + } + }) + ); +} + +const isTypingTarget = (t) => + t instanceof HTMLElement && (t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)); + +const onKeyDown = (e) => { + if (!e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.repeat || isTypingTarget(e.target)) return; + + const key = { KeyA: 'a', KeyS: 's', KeyF: 'f' }[e.code]; + if (!key) return; + if (key === 'a') { + e.preventDefault(); + state.deckVisible = !state.deckVisible; + applySkinAndLayout(true); + } else if (key === 's') { + e.preventDefault(); + const idx = SKINS.findIndex((s) => s.id === state.skin); + setSkin(SKINS[(idx + 1) % SKINS.length].id); + } else if (key === 'f') { + e.preventDefault(); + state.focusStage = !state.focusStage; + applySkinAndLayout(true); + } +}; +window.addEventListener('keydown', onKeyDown); +cleanups.push(() => window.removeEventListener('keydown', onKeyDown)); + +const onResize = () => applySkinAndLayout(false); +window.addEventListener('resize', onResize); +cleanups.push(() => window.removeEventListener('resize', onResize)); + +if (channel) { + const onChannelMsg = (ev) => { + if (ev.data?.type === 'AURA_STATE_SYNC' && ev.data.state) { + const next = sanitizeState(ev.data.state); + const skinChanged = next.skin !== state.skin; + Object.assign(state, next); + if (skinChanged) pushSkinToApp(); + applySkinAndLayout(false); + } + }; + channel.addEventListener('message', onChannelMsg); + cleanups.push(() => { + channel.removeEventListener('message', onChannelMsg); + channel.close(); + }); +} + +return () => { + disposed = true; + if (rafId !== null) cancelAnimationFrame(rafId); + if (miniRafId !== null) cancelAnimationFrame(miniRafId); + if (typeof unsubSpectrum === 'function') unsubSpectrum(); + for (const fn of cleanups) { + try { + fn(); + } catch (_) {} + } + destroyDeck(); + destroyMiniDeck(); + const rootStyle = document.documentElement.style; + for (const prop of ['--aura-bass-level', '--aura-dynamic-primary', '--aura-dynamic-secondary']) { + rootStyle.removeProperty(prop); + } + document.documentElement.removeAttribute('data-aura-skin'); + document.body.classList.remove('aura-in-mini-player', 'aura-focus-stage', 'aura-compact-docked', 'aura-mini-custom'); +};