diff --git a/themes/aura-v2.0.3/aura-theme/README.md b/themes/aura-v2.0.3/aura-theme/README.md new file mode 100644 index 0000000..8099481 --- /dev/null +++ b/themes/aura-v2.0.3/aura-theme/README.md @@ -0,0 +1,60 @@ +# 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. + +## 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.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-v2.0.3/aura-theme/manifest.json b/themes/aura-v2.0.3/aura-theme/manifest.json new file mode 100644 index 0000000..52e7231 --- /dev/null +++ b/themes/aura-v2.0.3/aura-theme/manifest.json @@ -0,0 +1,24 @@ +{ + "id": "aura-theme", + "name": "Aura Theme", + "type": "theme", + "version": "2.0.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: live spectrum, bass-reactive glow and cover-art colours.", + "tags": ["glass", "dark", "purple", "reactive", "visualizer", "custom-ui", "mini-player"], + "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-v2.0.3/aura-theme/theme.css b/themes/aura-v2.0.3/aura-theme/theme.css new file mode 100644 index 0000000..25ae999 --- /dev/null +++ b/themes/aura-v2.0.3/aura-theme/theme.css @@ -0,0 +1,800 @@ +: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; + } +} diff --git a/themes/aura-v2.0.3/aura-theme/theme.js b/themes/aura-v2.0.3/aura-theme/theme.js new file mode 100644 index 0000000..2648012 --- /dev/null +++ b/themes/aura-v2.0.3/aura-theme/theme.js @@ -0,0 +1,765 @@ +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' }, +]; + +const DEFAULT_STATE = { + skin: 'nebula', + visualizerMode: 'bars', + deckVisible: true, + focusStage: false, + deck: { + x: null, + y: null, + width: 392, + height: 204, + }, +}; + +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 } }; + 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); + 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); +} + +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(); + document.body.classList.remove('aura-compact-docked'); + if (shouldPersist) persistState(); + return; + } + + 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 (!deckEl || isMiniPlayerActive()) 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 perfMode = document.documentElement.dataset.performance === 'true'; + const playing = !perfMode && 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() && !perfMode) { + 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 (typeof unsubSpectrum === 'function') unsubSpectrum(); + for (const fn of cleanups) { + try { + fn(); + } catch (_) {} + } + destroyDeck(); + 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'); +};