feat: workspace scaffold with iced shell, theme and design system

Two-crate workspace (ym-api for the API client, musyx for the iced app).
The app has the sidebar, top bar, Queue/Lyrics drawer and player bar from
the approved mockup, plus signed-out states for every screen.

- DESIGN.md records the mockup tokens; ui/theme.rs mirrors them for dark
  and light, and the app follows the system appearance
- Bundles Onest/Unbounded (OFL) and Lucide 0.460 icons (ISC)
- Back-stack navigator, player bar toggles (shuffle, repeat, volume, mute)
- snapshot feature renders a screen to PNG via iced's window screenshot
This commit is contained in:
Yuriy Panov committed 2026-10-15 13:52:55 +06:00
commit c4928ae7fe
65 files changed
+8368

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
/target
.DS_Store
/design/shots
Generated
+4933
View File
File diff suppressed because it is too large. Load diff
+12
View File
@@ -0,0 +1,12 @@
[workspace]
resolver = "3"
members = ["crates/ym-api", "crates/musyx"]
[workspace.package]
version = "0.1.0"
edition = "2024"
license = "MIT"
publish = false
[workspace.lints.clippy]
all = { level = "warn", priority = -1 }
+63
View File
@@ -0,0 +1,63 @@
# Musyx design system
The approved mockup is [`design/mockup.html`](design/mockup.html) (published at
https://claude.ai/artifact/2gmswtceJM61fcE2F5uYYM). This file records its tokens. They map
1:1 to [`crates/musyx/src/ui/theme.rs`](crates/musyx/src/ui/theme.rs), so change both together.
## Direction
The ground is aubergine graphite, with one amber accent taken from a tape deck's VU needle.
The app is dark-first, and the light theme follows the system setting. Everything stays quiet
except the My Wave hero, which is the one animated, accent-heavy surface.
## Colour
| Token | Dark | Light | Used for |
|--------------|-----------|-----------|----------|
| `bg` | `#1C1A22` | `#F3F1F6` | Window and content background |
| `panel` | `#23202B` | `#FFFFFF` | Sidebar, player bar, drawer, cards that need separation |
| `raised` | `#2D2937` | `#EAE6F0` | Hover and selected rows, chip fills, progress track |
| `line` | `#3A3546` | `#DCD6E4` | 1px dividers and outlines |
| `fg` | `#EEEAF3` | `#1F1B27` | Primary text, the play/pause disc |
| `muted` | `#A39CB0` | `#686178` | Secondary text, idle icons |
| `accent` | `#F0B23E` | `#A86C05` | Current track, progress fill, primary buttons, active nav icon |
| `accent_ink` | `#2A1D04` | `#FFF7E6` | Text and icons on `accent` |
| `like` | `#F27286` | `#D2405A` | Filled heart, falling chart position |
| `ok` | `#7FCB9B` | `#2E8A55` | Subscription status, rising chart position |
Covers that have no artwork yet get a placeholder made of two hues (`h1`, `h2`) derived from
the item id, painted as a diagonal gradient between them.
## Type
| Role | Face | Size / weight | Where |
|---------|----------------------|--------------------|-------|
| Display | Unbounded SemiBold | 46 / 40 / 34 / 30 | My Wave hero, detail page titles, sign-in headline, screen titles |
| Wordmark| Unbounded SemiBold | 20 | `musyx` + amber dot |
| Section | Onest SemiBold | 19 | Section headings ("Made for you") |
| Body | Onest Regular/Medium | 14 (rows 14, meta 13, small 12.5) | Everything else |
The fonts are bundled from `crates/musyx/assets/fonts` and licensed under OFL. Durations and
counts use tabular figures.
## Space and shape
- Spacing steps: 2 · 4 · 6 · 8 · 10 · 12 · 14 · 18 · 22 · 28 · 34. Content gutter is 28,
and the gap between sections is 34.
- Radii: cover 10 · control 8 · small cover 6 · pill/round 999 · hero 16 · window cards 14.
- Shell: sidebar 232 · player bar 80 · drawer 320 · track row 52 tall.
- Icons: Lucide 0.460 (ISC), 18px and tinted via `currentColor`. The `-fill` variants are for
liked, play and pause.
## Components
- **Sidebar**: wordmark, five nav items (Home, My Wave, Search, Collection, Podcasts), a
playlist list, and an account chip with sign-out. The active item sits on a `raised` fill
and has an amber icon.
- **Player bar**: shows cover, title/artist, like and dislike on the left. The centre has
transport (shuffle, previous, play disc, next, repeat) over a progress bar with times. On
the right are a quality badge, lyrics, queue and a volume bar.
- **Track row**: index (or an equaliser when playing), cover, title/artist, album, like,
duration and a "more" button that appears on hover. The playing row is amber.
- **Cards**: a cover with a hover play button, the title, and one muted subtitle line.
- **Drawer**: Queue | Lyrics tabs, sliding in from the right over the content edge.
+41
View File
@@ -0,0 +1,41 @@
# Musyx
A desktop player for Yandex Music, written in Rust with [iced](https://iced.rs).
Musyx is an unofficial client. It talks to the same undocumented API the official apps use,
and it isn't affiliated with or endorsed by Yandex.
## Layout
- `crates/ym-api`: the Yandex Music API client, with no UI dependencies.
- `crates/musyx`: the iced app (screens, widgets, player, theme).
- `design/mockup.html`: the approved design. `DESIGN.md` records its tokens.
## Run
```sh
cargo run -p musyx
```
## Check
```sh
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
```
Snapshot mode renders one screen to a PNG through iced's own screenshot, so it needs no
screen-recording permission:
```sh
MUSYX_SNAPSHOT=design/shots/home.png MUSYX_SNAPSHOT_ROUTE=home MUSYX_SNAPSHOT_THEME=dark \
cargo run -p musyx --features snapshot
```
`MUSYX_SNAPSHOT_ROUTE` takes home, wave, search, collection, podcasts, settings or signin.
`MUSYX_SNAPSHOT_DRAWER` takes queue or lyrics. `MUSYX_SNAPSHOT_THEME` takes light or dark.
## Licences
Musyx is MIT. Onest and Unbounded are OFL (`crates/musyx/assets/fonts`), and Lucide icons
are ISC (`crates/musyx/assets/icons/LICENSE.txt`).
+20
View File
@@ -0,0 +1,20 @@
[package]
name = "musyx"
description = "Desktop player for Yandex Music"
version.workspace = true
edition.workspace = true
license.workspace = true
publish.workspace = true
[dependencies]
ym-api = { path = "../ym-api" }
iced = { version = "0.14.0", features = ["svg", "image", "tokio", "advanced"] }
png = { version = "0.18.1", optional = true }
tokio = { version = "1", features = ["time"], optional = true }
[features]
# `MUSYX_SNAPSHOT=out.png cargo run --features snapshot` renders one screen to a PNG and exits.
snapshot = ["dep:png", "dep:tokio"]
[lints]
workspace = true
+93
View File
@@ -0,0 +1,93 @@
Copyright 2021 The Onest Project Authors (https://github.com/googlefonts/onest)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
Copyright 2022 The Unbounded Project Authors (https://github.com/googlefonts/unbounded)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
ISC License
Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+20
View File
@@ -0,0 +1,20 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-audio-lines"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M2 10v3" />
<path d="M6 6v11" />
<path d="M10 3v18" />
<path d="M14 8v7" />
<path d="M18 5v13" />
<path d="M22 10v3" />
</svg>

After

Width:  |  Height:  |  Size: 432 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-ban"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="10" />
<path d="m4.9 4.9 14.2 14.2" />
</svg>

After

Width:  |  Height:  |  Size: 353 B

@@ -0,0 +1,15 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-chevron-left"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m15 18-6-6 6-6" />
</svg>

After

Width:  |  Height:  |  Size: 322 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-clock-3"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="10" />
<polyline points="12 6 12 12 16.5 12" />
</svg>

After

Width:  |  Height:  |  Size: 366 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-copy"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
</svg>

After

Width:  |  Height:  |  Size: 415 B

+18
View File
@@ -0,0 +1,18 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-disc-3"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="10" />
<path d="M6 12c0-1.7.7-3.2 1.8-4.2" />
<circle cx="12" cy="12" r="2" />
<path d="M18 12c0 1.7-.7 3.2-1.8 4.2" />
</svg>

After

Width:  |  Height:  |  Size: 441 B

+17
View File
@@ -0,0 +1,17 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-ellipsis"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="1" />
<circle cx="19" cy="12" r="1" />
<circle cx="5" cy="12" r="1" />
</svg>

After

Width:  |  Height:  |  Size: 392 B

+17
View File
@@ -0,0 +1,17 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-globe"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="10" />
<path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" />
<path d="M2 12h20" />
</svg>

After

Width:  |  Height:  |  Size: 408 B

@@ -0,0 +1,20 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-grip-vertical"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="9" cy="12" r="1" />
<circle cx="9" cy="5" r="1" />
<circle cx="9" cy="19" r="1" />
<circle cx="15" cy="12" r="1" />
<circle cx="15" cy="5" r="1" />
<circle cx="15" cy="19" r="1" />
</svg>

After

Width:  |  Height:  |  Size: 498 B

+15
View File
@@ -0,0 +1,15 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-heart"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="currentColor"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" />
</svg>

After

Width:  |  Height:  |  Size: 445 B

+15
View File
@@ -0,0 +1,15 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-heart"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" />
</svg>

After

Width:  |  Height:  |  Size: 437 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-house"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" />
<path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
</svg>

After

Width:  |  Height:  |  Size: 468 B

+18
View File
@@ -0,0 +1,18 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-library"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m16 6 4 14" />
<path d="M12 6v14" />
<path d="M8 8v12" />
<path d="M4 4v16" />
</svg>

After

Width:  |  Height:  |  Size: 383 B

+19
View File
@@ -0,0 +1,19 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-list-music"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M21 15V6" />
<path d="M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z" />
<path d="M12 12H3" />
<path d="M16 6H3" />
<path d="M12 18H3" />
</svg>

After

Width:  |  Height:  |  Size: 446 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-lock"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect width="18" height="11" x="3" y="11" rx="2" ry="2" />
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
</svg>

After

Width:  |  Height:  |  Size: 385 B

+17
View File
@@ -0,0 +1,17 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-log-out"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
<polyline points="16 17 21 12 16 7" />
<line x1="21" x2="9" y1="12" y2="12" />
</svg>

After

Width:  |  Height:  |  Size: 425 B

+17
View File
@@ -0,0 +1,17 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-mic-vocal"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12" />
<path d="M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5" />
<circle cx="16" cy="7" r="5" />
</svg>

After

Width:  |  Height:  |  Size: 526 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-pause"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="currentColor"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect x="14" y="4" width="4" height="16" rx="1" />
<rect x="6" y="4" width="4" height="16" rx="1" />
</svg>

After

Width:  |  Height:  |  Size: 398 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-pause"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect x="14" y="4" width="4" height="16" rx="1" />
<rect x="6" y="4" width="4" height="16" rx="1" />
</svg>

After

Width:  |  Height:  |  Size: 390 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-pencil"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" />
<path d="m15 5 4 4" />
</svg>

After

Width:  |  Height:  |  Size: 455 B

+15
View File
@@ -0,0 +1,15 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-play"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="currentColor"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<polygon points="6 3 20 12 6 21 6 3" />
</svg>

After

Width:  |  Height:  |  Size: 334 B

+15
View File
@@ -0,0 +1,15 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-play"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<polygon points="6 3 20 12 6 21 6 3" />
</svg>

After

Width:  |  Height:  |  Size: 326 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-plus"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M5 12h14" />
<path d="M12 5v14" />
</svg>

After

Width:  |  Height:  |  Size: 332 B

+18
View File
@@ -0,0 +1,18 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-podcast"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M16.85 18.58a9 9 0 1 0-9.7 0" />
<path d="M8 14a5 5 0 1 1 8 0" />
<circle cx="12" cy="11" r="1" />
<path d="M13 17a1 1 0 1 0-2 0l.5 4.5a.5.5 0 1 0 1 0Z" />
</svg>

After

Width:  |  Height:  |  Size: 460 B

+19
View File
@@ -0,0 +1,19 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-repeat-1"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m17 2 4 4-4 4" />
<path d="M3 11v-1a4 4 0 0 1 4-4h14" />
<path d="m7 22-4-4 4-4" />
<path d="M21 13v1a4 4 0 0 1-4 4H3" />
<path d="M11 10h1v4" />
</svg>

After

Width:  |  Height:  |  Size: 453 B

+18
View File
@@ -0,0 +1,18 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-repeat"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m17 2 4 4-4 4" />
<path d="M3 11v-1a4 4 0 0 1 4-4h14" />
<path d="m7 22-4-4 4-4" />
<path d="M21 13v1a4 4 0 0 1-4 4H3" />
</svg>

After

Width:  |  Height:  |  Size: 425 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-search"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="11" cy="11" r="8" />
<path d="m21 21-4.3-4.3" />
</svg>

After

Width:  |  Height:  |  Size: 351 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-settings"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
<circle cx="12" cy="12" r="3" />
</svg>

After

Width:  |  Height:  |  Size: 904 B

+19
View File
@@ -0,0 +1,19 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-shuffle"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22" />
<path d="m18 2 4 4-4 4" />
<path d="M2 6h1.9c1.5 0 2.9.9 3.6 2.2" />
<path d="M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8" />
<path d="m18 14 4 4-4 4" />
</svg>

After

Width:  |  Height:  |  Size: 524 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-skip-back"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<polygon points="19 20 9 12 19 4 19 20" />
<line x1="5" x2="5" y1="19" y2="5" />
</svg>

After

Width:  |  Height:  |  Size: 374 B

@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-skip-forward"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<polygon points="5 4 15 12 5 20 5 4" />
<line x1="19" x2="19" y1="5" y2="19" />
</svg>

After

Width:  |  Height:  |  Size: 376 B

@@ -0,0 +1,23 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-sliders-horizontal"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<line x1="21" x2="14" y1="4" y2="4" />
<line x1="10" x2="3" y1="4" y2="4" />
<line x1="21" x2="12" y1="12" y2="12" />
<line x1="8" x2="3" y1="12" y2="12" />
<line x1="21" x2="16" y1="20" y2="20" />
<line x1="12" x2="3" y1="20" y2="20" />
<line x1="14" x2="14" y1="2" y2="6" />
<line x1="8" x2="8" y1="10" y2="14" />
<line x1="16" x2="16" y1="18" y2="22" />
</svg>

After

Width:  |  Height:  |  Size: 673 B

+19
View File
@@ -0,0 +1,19 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-trash-2"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M3 6h18" />
<path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" />
<path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" />
<line x1="10" x2="10" y1="11" y2="17" />
<line x1="14" x2="14" y1="11" y2="17" />
</svg>

After

Width:  |  Height:  |  Size: 499 B

+17
View File
@@ -0,0 +1,17 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-volume-2"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z" />
<path d="M16 9a5 5 0 0 1 0 6" />
<path d="M19.364 18.364a9 9 0 0 0 0-12.728" />
</svg>

After

Width:  |  Height:  |  Size: 556 B

+17
View File
@@ -0,0 +1,17 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-volume-x"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z" />
<line x1="22" x2="16" y1="9" y2="15" />
<line x1="16" x2="22" y1="9" y2="15" />
</svg>

After

Width:  |  Height:  |  Size: 556 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-x"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M18 6 6 18" />
<path d="m6 6 12 12" />
</svg>

After

Width:  |  Height:  |  Size: 333 B

+140
View File
@@ -0,0 +1,140 @@
//! Application state, messages and the window layout.
use iced::theme::Mode;
use iced::widget::{column, container, row, scrollable, space};
use iced::{Element, Fill, Subscription, Task, Theme};
use crate::route::{Navigator, Route};
use crate::screens;
use crate::ui::theme::{self, shell};
use crate::widgets::drawer::{self, Panel};
use crate::widgets::player_bar::{self, PlayerUi};
use crate::widgets::{sidebar, topbar};
pub struct App {
theme: Theme,
/// Set by a snapshot run so the system appearance can't override it.
forced_mode: Option<Mode>,
nav: Navigator,
search: String,
drawer: Option<Panel>,
player: PlayerUi,
}
#[derive(Debug, Clone)]
pub enum Message {
ThemeChanged(Mode),
Navigate(Route),
Back,
SearchChanged(String),
SearchSubmitted,
ToggleDrawer(Panel),
CloseDrawer,
Player(player_bar::Action),
}
impl App {
pub fn new() -> (Self, Task<Message>) {
let app = Self {
theme: theme::for_mode(Mode::Dark),
forced_mode: None,
nav: Navigator::new(Route::Home),
search: String::new(),
drawer: None,
player: PlayerUi::default(),
};
let boot = iced::system::theme().map(Message::ThemeChanged);
#[cfg(feature = "snapshot")]
if let Some(config) = crate::snapshot::Config::from_env() {
let mut app = app;
if let Some(route) = config.route {
app.nav = Navigator::new(route);
}
app.drawer = config.drawer;
app.forced_mode = config.mode;
if let Some(mode) = config.mode {
app.theme = theme::for_mode(mode);
}
return (app, Task::batch([boot, config.capture()]));
}
(app, boot)
}
pub fn title(&self) -> String {
match self.nav.current() {
Route::Home => "Musyx".into(),
route => format!("{} · Musyx", route.label()),
}
}
pub fn theme(&self) -> Theme {
self.theme.clone()
}
pub fn subscription(&self) -> Subscription<Message> {
iced::system::theme_changes().map(Message::ThemeChanged)
}
pub fn update(&mut self, message: Message) -> Task<Message> {
match message {
Message::ThemeChanged(mode) => {
self.theme = theme::for_mode(self.forced_mode.unwrap_or(mode));
}
Message::Navigate(route) => self.nav.go(route),
Message::Back => self.nav.back(),
Message::SearchChanged(query) => self.search = query,
Message::SearchSubmitted => self.nav.go(Route::Search),
Message::ToggleDrawer(panel) => {
self.drawer = if self.drawer == Some(panel) { None } else { Some(panel) };
}
Message::CloseDrawer => self.drawer = None,
Message::Player(action) => self.player.apply(action),
}
Task::none()
}
pub fn view(&self) -> Element<'_, Message> {
let t = theme::tokens(&self.theme);
let route = self.nav.current();
let content = column![
topbar::view(t, self.nav.can_go_back(), &self.search),
scrollable(screens::view(t, route, &self.search))
.height(Fill)
.style(theme::scroll),
]
.width(Fill)
.height(Fill);
let mut body = row![
sidebar::view(t, route),
vline(),
content,
]
.height(Fill);
if let Some(panel) = self.drawer {
body = body.push(vline()).push(drawer::view(t, panel));
}
let window = column![
body,
hline(),
container(player_bar::view(t, &self.player, self.drawer))
.height(shell::PLAYER)
.style(theme::panel),
];
container(window).width(Fill).height(Fill).style(theme::app).into()
}
}
fn vline<'a>() -> Element<'a, Message> {
container(space()).width(1).height(Fill).style(theme::divider).into()
}
fn hline<'a>() -> Element<'a, Message> {
container(space()).width(Fill).height(1).style(theme::divider).into()
}
+28
View File
@@ -0,0 +1,28 @@
mod app;
mod route;
mod screens;
#[cfg(feature = "snapshot")]
mod snapshot;
mod ui;
mod widgets;
use iced::{Size, window};
use app::App;
use ui::theme;
fn main() -> iced::Result {
let app = iced::application(App::new, App::update, App::view)
.title(App::title)
.theme(App::theme)
.subscription(App::subscription)
.default_font(theme::BODY)
.window(window::Settings {
size: Size::new(1280.0, 800.0),
min_size: Some(Size::new(960.0, 620.0)),
..window::Settings::default()
})
.centered();
theme::FONTS.into_iter().fold(app, |app, font| app.font(font)).run()
}
+120
View File
@@ -0,0 +1,120 @@
//! Every place the content area can show. Detail pages (album, artist, playlist)
//! join this enum once they carry ids from the API.
use crate::ui::icons::Icon;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Route {
Home,
Wave,
Search,
Collection,
Podcasts,
Settings,
SignIn,
}
impl Route {
/// Sidebar order.
pub const NAV: [Route; 5] =
[Route::Home, Route::Wave, Route::Search, Route::Collection, Route::Podcasts];
pub fn label(self) -> &'static str {
match self {
Route::Home => "Home",
Route::Wave => "My Wave",
Route::Search => "Search",
Route::Collection => "Collection",
Route::Podcasts => "Podcasts",
Route::Settings => "Settings",
Route::SignIn => "Sign in",
}
}
pub fn icon(self) -> Icon {
match self {
Route::Home => Icon::Home,
Route::Wave => Icon::Wave,
Route::Search => Icon::Search,
Route::Collection => Icon::Library,
Route::Podcasts => Icon::Podcast,
Route::Settings => Icon::Settings,
Route::SignIn => Icon::LogOut,
}
}
}
/// Back-stack navigation: the sidebar pushes, the back button pops.
#[derive(Debug, Clone)]
pub struct Navigator {
current: Route,
history: Vec<Route>,
}
impl Navigator {
const MAX_HISTORY: usize = 50;
pub fn new(start: Route) -> Self {
Self { current: start, history: Vec::new() }
}
pub fn current(&self) -> Route {
self.current
}
pub fn can_go_back(&self) -> bool {
!self.history.is_empty()
}
pub fn go(&mut self, route: Route) {
if route == self.current {
return;
}
if self.history.len() == Self::MAX_HISTORY {
self.history.remove(0);
}
self.history.push(self.current);
self.current = route;
}
pub fn back(&mut self) {
if let Some(previous) = self.history.pop() {
self.current = previous;
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn back_returns_to_previous_route() {
let mut nav = Navigator::new(Route::Home);
nav.go(Route::Search);
nav.go(Route::Collection);
nav.back();
assert_eq!(nav.current(), Route::Search);
nav.back();
assert_eq!(nav.current(), Route::Home);
assert!(!nav.can_go_back());
nav.back();
assert_eq!(nav.current(), Route::Home);
}
#[test]
fn revisiting_current_route_does_not_grow_history() {
let mut nav = Navigator::new(Route::Home);
nav.go(Route::Home);
assert!(!nav.can_go_back());
}
#[test]
fn history_is_bounded() {
let mut nav = Navigator::new(Route::Home);
for i in 0..200 {
nav.go(if i % 2 == 0 { Route::Search } else { Route::Home });
}
assert_eq!(nav.history.len(), Navigator::MAX_HISTORY);
}
}
+181
View File
@@ -0,0 +1,181 @@
//! Content for each route. Until sign-in exists every screen shows its
//! signed-out state, which is also what a signed-out user will see later.
use iced::widget::{Column, button, column, container, row, space};
use iced::{Alignment, Element, Fill, Padding};
use crate::app::Message;
use crate::route::Route;
use crate::ui::icons::{Icon, icon, sized};
use crate::ui::theme::{self, Tokens, radius, size, space as sp};
use crate::ui::{line, para};
pub fn view<'a>(t: &'static Tokens, route: Route, query: &str) -> Element<'a, Message> {
let content: Column<'a, Message> = match route {
Route::Home => column![
wave_hero(t),
signed_out(
t,
Icon::Library,
"Your music, picked for you",
"Sign in to see your daily playlists, the chart and albums picked from what you play.",
),
],
Route::Wave => column![
title(t, "My Wave"),
signed_out(
t,
Icon::Wave,
"An endless stream that learns from you",
"Sign in to start My Wave. Every like, skip and full listen steers what comes next.",
),
],
Route::Search => column![
title(t, if query.trim().is_empty() {
"Search".to_owned()
} else {
format!("Results for “{}”", query.trim())
}),
signed_out(
t,
Icon::Search,
"Search the whole catalogue",
"Sign in to search tracks, albums, artists, playlists and podcasts.",
),
],
Route::Collection => column![
title(t, "Collection"),
signed_out(
t,
Icon::HeartFilled,
"Everything you've liked",
"Your liked tracks, albums, artists and playlists appear here after you sign in.",
),
],
Route::Podcasts => column![
title(t, "Podcasts and books"),
signed_out(
t,
Icon::Podcast,
"Pick up where you left off",
"Podcasts and audiobooks you follow appear here after you sign in.",
),
],
Route::Settings => column![
title(t, "Settings"),
signed_out(
t,
Icon::Settings,
"Account and playback",
"Sign in to choose streaming quality and manage your Yandex account.",
),
],
Route::SignIn => column![sign_in(t)],
};
content
.spacing(sp::SECTION)
.padding(Padding::default().top(6).bottom(40).left(sp::GUTTER).right(sp::GUTTER))
.width(Fill)
.into()
}
fn title<'a>(t: &'static Tokens, text: impl Into<String>) -> Element<'a, Message> {
line(text.into(), theme::DISPLAY, size::DISPLAY_S, t.fg).into()
}
fn signed_out<'a>(
t: &'static Tokens,
glyph: Icon,
heading: &'a str,
body: &'a str,
) -> Element<'a, Message> {
container(
column![
sized(glyph, 28.0, t.accent),
column![
line(heading, theme::SEMIBOLD, size::SECTION, t.fg),
container(para(body, size::BODY, t.muted)).max_width(460),
]
.spacing(6),
button(line("Sign in", theme::SEMIBOLD, size::BODY, t.accent_ink))
.padding([11, 18])
.style(theme::primary)
.on_press(Message::Navigate(Route::SignIn)),
]
.spacing(18),
)
.padding(28)
.width(Fill)
.style(theme::card)
.into()
}
/// Static version of the My Wave hero; the animated wave arrives with playback.
fn wave_hero<'a>(t: &'static Tokens) -> Element<'a, Message> {
container(
row![
column![
line("My Wave", theme::DISPLAY, size::DISPLAY_M, t.fg),
container(para(
"An endless stream picked from what you play, like and skip.",
size::BODY,
t.muted,
))
.max_width(380),
]
.spacing(6)
.width(Fill),
button(
row![icon(Icon::Play, t.muted), line("Play My Wave", theme::SEMIBOLD, size::BODY, t.muted)]
.spacing(8)
.align_y(Alignment::Center),
)
.padding([11, 18])
.style(theme::primary),
]
.spacing(28)
.align_y(Alignment::End),
)
.padding(Padding::default().top(120).bottom(26).left(28).right(28))
.width(Fill)
.style(move |th| {
let mut s = theme::card(th);
s.border.radius = radius::HERO.into();
s.background = Some(iced::Background::Gradient(
iced::gradient::Linear::new(0.0)
.add_stop(0.0, t.panel)
.add_stop(1.0, theme::mix(t.panel, t.accent, 0.16))
.into(),
));
s
})
.into()
}
fn sign_in<'a>(t: &'static Tokens) -> Element<'a, Message> {
column![
container(line("Sign in with your Yandex account", theme::DISPLAY, size::DISPLAY_M, t.fg)),
container(para(
"Musyx plays your Yandex Music library, My Wave and playlists. You confirm sign-in \
on Yandex's own page, so your password never passes through this app.",
15.0,
t.muted,
))
.max_width(520),
button(line("Get sign-in code", theme::SEMIBOLD, size::BODY, t.muted))
.padding([11, 18])
.style(theme::primary),
space().height(8),
container(para(
"Musyx is an unofficial client and isn't affiliated with Yandex. Your sign-in token \
is kept in the system keychain.",
size::SMALL,
t.muted,
))
.max_width(520),
]
.spacing(22)
.padding(Padding::default().top(24))
.into()
}
+82
View File
@@ -0,0 +1,82 @@
//! Headless-ish visual check: render one screen, save it as a PNG, quit.
//!
//! ```sh
//! MUSYX_SNAPSHOT=home.png MUSYX_SNAPSHOT_ROUTE=wave MUSYX_SNAPSHOT_DRAWER=queue \
//! MUSYX_SNAPSHOT_THEME=light cargo run -p musyx --features snapshot
//! ```
//! iced's own `window::screenshot` is used, so it needs no screen-recording permission.
use std::path::PathBuf;
use std::time::Duration;
use iced::Task;
use iced::theme::Mode;
use iced::window;
use crate::route::Route;
use crate::widgets::drawer::Panel;
#[derive(Debug, Clone)]
pub struct Config {
pub out: PathBuf,
pub route: Option<Route>,
pub drawer: Option<Panel>,
pub mode: Option<Mode>,
}
impl Config {
pub fn from_env() -> Option<Self> {
let out = PathBuf::from(std::env::var_os("MUSYX_SNAPSHOT")?);
let var = |k: &str| std::env::var(k).ok().map(|v| v.to_ascii_lowercase());
let route = var("MUSYX_SNAPSHOT_ROUTE").and_then(|r| {
Some(match r.as_str() {
"home" => Route::Home,
"wave" => Route::Wave,
"search" => Route::Search,
"collection" => Route::Collection,
"podcasts" => Route::Podcasts,
"settings" => Route::Settings,
"signin" => Route::SignIn,
_ => return None,
})
});
let drawer = var("MUSYX_SNAPSHOT_DRAWER").and_then(|d| match d.as_str() {
"queue" => Some(Panel::Queue),
"lyrics" => Some(Panel::Lyrics),
_ => None,
});
let mode = var("MUSYX_SNAPSHOT_THEME").and_then(|m| match m.as_str() {
"light" => Some(Mode::Light),
"dark" => Some(Mode::Dark),
_ => None,
});
Some(Self { out, route, drawer, mode })
}
/// Waits for fonts and the first frames, captures the window, writes the PNG, exits.
pub fn capture<M: Send + 'static>(self) -> Task<M> {
Task::future(tokio::time::sleep(Duration::from_millis(1500)))
.then(|()| window::latest())
.then(|id| match id {
Some(id) => window::screenshot(id),
None => Task::none(),
})
.then(move |shot| {
if let Err(e) = write_png(&self.out, &shot) {
eprintln!("snapshot: {e}");
} else {
eprintln!("snapshot: wrote {}", self.out.display());
}
iced::exit()
})
}
}
fn write_png(path: &std::path::Path, shot: &window::Screenshot) -> Result<(), Box<dyn std::error::Error>> {
let file = std::io::BufWriter::new(std::fs::File::create(path)?);
let mut encoder = png::Encoder::new(file, shot.size.width, shot.size.height);
encoder.set_color(png::ColorType::Rgba);
encoder.set_depth(png::BitDepth::Eight);
encoder.write_header()?.write_image_data(&shot.rgba)?;
Ok(())
}
+97
View File
@@ -0,0 +1,97 @@
//! Bundled Lucide 0.460 icons (ISC, see `assets/icons/LICENSE.txt`).
//!
//! The SVGs stroke with `currentColor`; iced ignores that, so every icon is tinted
//! through `svg::Style::color` instead — pass the colour the surrounding text uses.
// Bundled ahead of the screens that use them.
#![allow(dead_code)]
use iced::widget::{Svg, svg};
use iced::{Color, Length, Theme};
use super::theme::shell;
macro_rules! icons {
($($variant:ident => $file:literal),+ $(,)?) => {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Icon { $($variant),+ }
impl Icon {
pub const ALL: &[Icon] = &[$(Icon::$variant),+];
fn bytes(self) -> &'static [u8] {
match self {
$(Icon::$variant => include_bytes!(concat!("../../assets/icons/", $file, ".svg"))),+
}
}
}
};
}
icons! {
Home => "house",
Wave => "audio-lines",
Search => "search",
Library => "library",
Podcast => "podcast",
Plus => "plus",
LogOut => "log-out",
Back => "chevron-left",
Play => "play-fill",
Pause => "pause-fill",
Previous => "skip-back",
Next => "skip-forward",
Shuffle => "shuffle",
Repeat => "repeat",
RepeatOne => "repeat-1",
Heart => "heart",
HeartFilled => "heart-fill",
Dislike => "ban",
Lyrics => "mic-vocal",
Queue => "list-music",
Volume => "volume-2",
Muted => "volume-x",
More => "ellipsis",
Disc => "disc-3",
Lock => "lock",
Globe => "globe",
Pencil => "pencil",
Trash => "trash-2",
Grip => "grip-vertical",
Close => "x",
Copy => "copy",
Clock => "clock-3",
Tune => "sliders-horizontal",
Settings => "settings",
}
impl Icon {
pub fn handle(self) -> svg::Handle {
svg::Handle::from_memory(self.bytes())
}
}
/// An icon at the standard 18px size, tinted `color`.
pub fn icon<'a>(icon: Icon, color: Color) -> Svg<'a, Theme> {
sized(icon, shell::ICON, color)
}
pub fn sized<'a>(icon: Icon, size: f32, color: Color) -> Svg<'a, Theme> {
svg(icon.handle())
.width(Length::Fixed(size))
.height(Length::Fixed(size))
.style(move |_, _| svg::Style { color: Some(color) })
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn every_icon_is_an_svg() {
for icon in Icon::ALL {
let text = std::str::from_utf8(icon.bytes()).expect("utf-8");
assert!(text.contains("<svg"), "{icon:?} is not an SVG");
}
}
}
+16
View File
@@ -0,0 +1,16 @@
pub mod icons;
pub mod theme;
use iced::widget::{Text, text};
use iced::widget::text::Wrapping;
use iced::{Color, Font};
/// Single-line text in the given face; long values are clipped by their container.
pub fn line<'a>(content: impl text::IntoFragment<'a>, font: Font, size: f32, color: Color) -> Text<'a> {
text(content).font(font).size(size).color(color).wrapping(Wrapping::None)
}
/// Running text that wraps.
pub fn para<'a>(content: impl text::IntoFragment<'a>, size: f32, color: Color) -> Text<'a> {
text(content).font(theme::BODY).size(size).color(color).line_height(1.45)
}
+446
View File
@@ -0,0 +1,446 @@
//! Design tokens and widget styles. Mirrors `DESIGN.md`; change both together.
// The token set is the whole design system; screens adopt pieces milestone by milestone.
#![allow(dead_code)]
use iced::border::Radius;
use iced::font::{Family, Weight};
use iced::theme::{Mode, Palette};
use iced::widget::{button, container, scrollable, slider, text_input};
use iced::{Background, Border, Color, Font, Shadow, Theme, Vector};
/// Colour tokens for one theme mode.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Tokens {
pub bg: Color,
pub panel: Color,
pub raised: Color,
pub line: Color,
pub fg: Color,
pub muted: Color,
pub accent: Color,
pub accent_ink: Color,
pub like: Color,
pub ok: Color,
}
const fn hex(h: u32) -> Color {
Color::from_rgb8((h >> 16) as u8, (h >> 8) as u8, h as u8)
}
pub const DARK: Tokens = Tokens {
bg: hex(0x1C1A22),
panel: hex(0x23202B),
raised: hex(0x2D2937),
line: hex(0x3A3546),
fg: hex(0xEEEAF3),
muted: hex(0xA39CB0),
accent: hex(0xF0B23E),
accent_ink: hex(0x2A1D04),
like: hex(0xF27286),
ok: hex(0x7FCB9B),
};
pub const LIGHT: Tokens = Tokens {
bg: hex(0xF3F1F6),
panel: hex(0xFFFFFF),
raised: hex(0xEAE6F0),
line: hex(0xDCD6E4),
fg: hex(0x1F1B27),
muted: hex(0x686178),
accent: hex(0xA86C05),
accent_ink: hex(0xFFF7E6),
like: hex(0xD2405A),
ok: hex(0x2E8A55),
};
/// Tokens for whichever theme is active. Style closures only receive `&Theme`,
/// so the tokens are recovered from the palette's darkness.
pub fn tokens(theme: &Theme) -> &'static Tokens {
if theme.extended_palette().is_dark { &DARK } else { &LIGHT }
}
/// The iced theme for a system appearance. Musyx is dark-first, so "no preference" is dark.
pub fn for_mode(mode: Mode) -> Theme {
let (name, t) = match mode {
Mode::Light => ("Musyx Light", &LIGHT),
Mode::Dark | Mode::None => ("Musyx Dark", &DARK),
};
Theme::custom(
name,
Palette {
background: t.bg,
text: t.fg,
primary: t.accent,
success: t.ok,
warning: t.accent,
danger: t.like,
},
)
}
// ---- Type ----
pub const BODY: Font = Font::with_name("Onest");
pub const MEDIUM: Font = Font { weight: Weight::Medium, ..BODY };
pub const SEMIBOLD: Font = Font { weight: Weight::Semibold, ..BODY };
pub const DISPLAY: Font = Font {
family: Family::Name("Unbounded"),
weight: Weight::Semibold,
..Font::DEFAULT
};
pub const FONTS: [&[u8]; 4] = [
include_bytes!("../../assets/fonts/Onest-Regular.ttf"),
include_bytes!("../../assets/fonts/Onest-Medium.ttf"),
include_bytes!("../../assets/fonts/Onest-SemiBold.ttf"),
include_bytes!("../../assets/fonts/Unbounded-SemiBold.ttf"),
];
pub mod size {
pub const DISPLAY_XL: f32 = 46.0;
pub const DISPLAY_L: f32 = 40.0;
pub const DISPLAY_M: f32 = 34.0;
pub const DISPLAY_S: f32 = 30.0;
pub const WORDMARK: f32 = 20.0;
pub const SECTION: f32 = 19.0;
pub const BODY: f32 = 14.0;
pub const META: f32 = 13.0;
pub const SMALL: f32 = 12.5;
}
// ---- Space and shape ----
pub mod space {
pub const XS: f32 = 4.0;
pub const S: f32 = 8.0;
pub const M: f32 = 12.0;
pub const L: f32 = 18.0;
pub const XL: f32 = 22.0;
pub const GUTTER: f32 = 28.0;
pub const SECTION: f32 = 34.0;
}
pub mod radius {
pub const COVER: f32 = 10.0;
pub const CONTROL: f32 = 8.0;
pub const SMALL_COVER: f32 = 6.0;
pub const PILL: f32 = 999.0;
pub const HERO: f32 = 16.0;
pub const CARD: f32 = 14.0;
}
pub mod shell {
pub const SIDEBAR: f32 = 232.0;
pub const PLAYER: f32 = 80.0;
pub const DRAWER: f32 = 320.0;
pub const ICON: f32 = 18.0;
}
// ---- Containers ----
fn hairline(color: Color) -> Border {
Border { color, width: 1.0, radius: Radius::from(0.0) }
}
pub fn app(theme: &Theme) -> container::Style {
let t = tokens(theme);
container::Style {
background: Some(t.bg.into()),
text_color: Some(t.fg),
..container::Style::default()
}
}
/// Sidebar, player bar and drawer share the panel fill; the divider is drawn separately.
pub fn panel(theme: &Theme) -> container::Style {
let t = tokens(theme);
container::Style {
background: Some(t.panel.into()),
text_color: Some(t.fg),
..container::Style::default()
}
}
pub fn divider(theme: &Theme) -> container::Style {
container::Style {
background: Some(tokens(theme).line.into()),
..container::Style::default()
}
}
/// A bordered surface such as the empty-state card or the device-code box.
pub fn card(theme: &Theme) -> container::Style {
let t = tokens(theme);
container::Style {
background: Some(t.panel.into()),
border: Border { radius: radius::CARD.into(), ..hairline(t.line) },
..container::Style::default()
}
}
pub fn badge(theme: &Theme) -> container::Style {
let t = tokens(theme);
container::Style {
text_color: Some(t.muted),
border: Border { radius: 5.0.into(), ..hairline(t.line) },
..container::Style::default()
}
}
pub fn accent_dot(theme: &Theme) -> container::Style {
container::Style {
background: Some(tokens(theme).accent.into()),
border: Border { radius: radius::PILL.into(), ..Border::default() },
..container::Style::default()
}
}
pub fn avatar(theme: &Theme) -> container::Style {
let t = tokens(theme);
container::Style {
background: Some(Background::Gradient(
iced::gradient::Linear::new(std::f32::consts::FRAC_PI_4 * 3.0)
.add_stop(0.0, hex(0x8E7AB5))
.add_stop(1.0, hex(0xE0A84B))
.into(),
)),
text_color: Some(hex(0x1C1A22)),
border: Border { radius: radius::PILL.into(), ..hairline(t.line) },
..container::Style::default()
}
}
/// Placeholder art for an item without a cover yet: two hues on a diagonal.
pub fn cover(h1: f32, h2: f32, corner: f32) -> impl Fn(&Theme) -> container::Style {
move |_| container::Style {
background: Some(Background::Gradient(
iced::gradient::Linear::new(std::f32::consts::FRAC_PI_4 * 3.0)
.add_stop(0.0, hsl(h1, 0.70, 0.60))
.add_stop(0.55, hsl((h1 + h2) / 2.0, 0.45, 0.30))
.add_stop(1.0, hsl(h2, 0.40, 0.16))
.into(),
)),
border: Border { radius: corner.into(), ..Border::default() },
..container::Style::default()
}
}
fn hsl(h: f32, s: f32, l: f32) -> Color {
let c = (1.0 - (2.0 * l - 1.0).abs()) * s;
let hp = (h.rem_euclid(360.0)) / 60.0;
let x = c * (1.0 - (hp % 2.0 - 1.0).abs());
let (r, g, b) = match hp as u32 {
0 => (c, x, 0.0),
1 => (x, c, 0.0),
2 => (0.0, c, x),
3 => (0.0, x, c),
4 => (x, 0.0, c),
_ => (c, 0.0, x),
};
let m = l - c / 2.0;
Color::from_rgb(r + m, g + m, b + m)
}
// ---- Buttons ----
/// Sidebar navigation item; `active` is the current page.
pub fn nav_item(active: bool) -> impl Fn(&Theme, button::Status) -> button::Style {
move |theme, status| {
let t = tokens(theme);
let lit = active || matches!(status, button::Status::Hovered | button::Status::Pressed);
button::Style {
background: lit.then(|| t.raised.into()),
text_color: if lit { t.fg } else { t.muted },
border: Border { radius: radius::CONTROL.into(), ..Border::default() },
shadow: Shadow::default(),
snap: true,
}
}
}
/// Square icon button. `on` tints it (accent for toggles, `like` for hearts).
pub fn icon_button(on: Option<Color>) -> impl Fn(&Theme, button::Status) -> button::Style {
move |theme, status| {
let t = tokens(theme);
let hovered = matches!(status, button::Status::Hovered | button::Status::Pressed);
let disabled = matches!(status, button::Status::Disabled);
button::Style {
background: (hovered && !disabled).then(|| t.raised.into()),
text_color: match (on, disabled, hovered) {
(_, true, _) => t.muted.scale_alpha(0.45),
(Some(c), _, _) => c,
(None, _, true) => t.fg,
(None, _, false) => t.muted,
},
border: Border { radius: radius::CONTROL.into(), ..Border::default() },
shadow: Shadow::default(),
snap: true,
}
}
}
/// The round play/pause disc in the player bar.
pub fn play_disc(theme: &Theme, status: button::Status) -> button::Style {
let t = tokens(theme);
let disabled = matches!(status, button::Status::Disabled);
button::Style {
background: Some(if disabled { t.raised } else { t.fg }.into()),
text_color: if disabled { t.muted } else { t.bg },
border: Border { radius: radius::PILL.into(), ..Border::default() },
shadow: Shadow::default(),
snap: true,
}
}
pub fn primary(theme: &Theme, status: button::Status) -> button::Style {
let t = tokens(theme);
let bg = match status {
button::Status::Hovered => mix(t.accent, t.fg, 0.12),
button::Status::Pressed => mix(t.accent, t.bg, 0.12),
button::Status::Disabled => t.raised,
button::Status::Active => t.accent,
};
button::Style {
background: Some(bg.into()),
text_color: if matches!(status, button::Status::Disabled) { t.muted } else { t.accent_ink },
border: Border { radius: radius::PILL.into(), ..Border::default() },
shadow: Shadow {
color: Color::BLACK.scale_alpha(0.18),
offset: Vector::new(0.0, 4.0),
blur_radius: 12.0,
},
snap: true,
}
}
pub fn ghost(theme: &Theme, status: button::Status) -> button::Style {
let t = tokens(theme);
button::Style {
background: matches!(status, button::Status::Hovered | button::Status::Pressed)
.then(|| t.raised.into()),
text_color: t.fg,
border: Border { radius: radius::PILL.into(), ..hairline(t.line) },
shadow: Shadow::default(),
snap: true,
}
}
/// Tab in a tab strip (drawer Queue | Lyrics, collection tabs).
pub fn tab(selected: bool) -> impl Fn(&Theme, button::Status) -> button::Style {
move |theme, status| {
let t = tokens(theme);
let hovered = matches!(status, button::Status::Hovered);
button::Style {
background: None,
text_color: if selected || hovered { t.fg } else { t.muted },
border: Border::default(),
shadow: Shadow::default(),
snap: true,
}
}
}
pub fn tab_underline(selected: bool) -> impl Fn(&Theme) -> container::Style {
move |theme| container::Style {
background: selected.then(|| tokens(theme).accent.into()),
..container::Style::default()
}
}
// ---- Inputs ----
pub fn search_field(theme: &Theme, status: text_input::Status) -> text_input::Style {
let t = tokens(theme);
let focused = matches!(status, text_input::Status::Focused { .. });
text_input::Style {
background: t.panel.into(),
border: Border {
color: if focused { t.accent } else { t.line },
width: 1.0,
radius: radius::PILL.into(),
},
icon: t.muted,
placeholder: t.muted,
value: t.fg,
selection: t.accent.scale_alpha(0.35),
}
}
/// Thin seek bar: amber fill, knob only while hovered or dragged.
pub fn seek_bar(theme: &Theme, status: slider::Status) -> slider::Style {
thin_slider(theme, status, tokens(theme).accent)
}
pub fn volume_bar(theme: &Theme, status: slider::Status) -> slider::Style {
thin_slider(theme, status, tokens(theme).fg)
}
fn thin_slider(theme: &Theme, status: slider::Status, fill: Color) -> slider::Style {
let t = tokens(theme);
let engaged = matches!(status, slider::Status::Hovered | slider::Status::Dragged);
slider::Style {
rail: slider::Rail {
backgrounds: (fill.into(), t.raised.into()),
width: 4.0,
border: Border { radius: 2.0.into(), ..Border::default() },
},
handle: slider::Handle {
shape: slider::HandleShape::Circle { radius: if engaged { 6.0 } else { 0.0 } },
background: t.fg.into(),
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
}
}
pub fn scroll(theme: &Theme, status: scrollable::Status) -> scrollable::Style {
let t = tokens(theme);
let mut style = scrollable::default(theme, status);
let rail = scrollable::Rail {
background: None,
border: Border::default(),
scroller: scrollable::Scroller {
background: t.line.into(),
border: Border { radius: radius::PILL.into(), ..Border::default() },
},
};
style.vertical_rail = rail;
style.horizontal_rail = rail;
style
}
/// Linear blend of two colours; `amount` is the share of `b`.
pub fn mix(a: Color, b: Color, amount: f32) -> Color {
Color {
r: a.r + (b.r - a.r) * amount,
g: a.g + (b.g - a.g) * amount,
b: a.b + (b.b - a.b) * amount,
a: a.a + (b.a - a.a) * amount,
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn tokens_follow_theme_mode() {
assert_eq!(tokens(&for_mode(Mode::Dark)), &DARK);
assert_eq!(tokens(&for_mode(Mode::None)), &DARK);
assert_eq!(tokens(&for_mode(Mode::Light)), &LIGHT);
}
#[test]
fn hex_unpacks_channels() {
assert_eq!(hex(0xF0B23E), Color::from_rgb8(0xF0, 0xB2, 0x3E));
}
#[test]
fn hsl_primaries() {
let red = hsl(0.0, 1.0, 0.5);
assert!((red.r - 1.0).abs() < 1e-5 && red.g.abs() < 1e-5 && red.b.abs() < 1e-5);
let blue = hsl(240.0, 1.0, 0.5);
assert!((blue.b - 1.0).abs() < 1e-5 && blue.r.abs() < 1e-5);
}
}
+74
View File
@@ -0,0 +1,74 @@
//! Right-hand panel with the play queue and lyrics.
use iced::widget::{button, column, container, row, space};
use iced::{Alignment, Element, Fill, Padding};
use crate::app::Message;
use crate::ui::icons::{Icon, icon};
use crate::ui::theme::{self, Tokens, shell, size};
use crate::ui::{line, para};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Panel {
Queue,
Lyrics,
}
impl Panel {
fn label(self) -> &'static str {
match self {
Panel::Queue => "Queue",
Panel::Lyrics => "Lyrics",
}
}
}
pub fn view<'a>(t: &'static Tokens, panel: Panel) -> Element<'a, Message> {
let tabs = row![tab(t, Panel::Queue, panel), tab(t, Panel::Lyrics, panel)].spacing(4);
let head = row![
tabs,
space().width(Fill),
button(icon(Icon::Close, t.muted))
.padding(8)
.style(theme::icon_button(None))
.on_press(Message::CloseDrawer),
]
.align_y(Alignment::Center)
.padding(Padding::default().top(14).bottom(8).left(18).right(14));
let body = match panel {
Panel::Queue => para(
"Nothing queued yet. Tracks you play, and the ones lined up after them, show up here.",
size::META,
t.muted,
),
Panel::Lyrics => para(
"Play a track to see its lyrics. Synced lyrics follow playback, and clicking a line jumps to it.",
size::META,
t.muted,
),
};
container(column![head, container(body).padding([4, 20])])
.width(shell::DRAWER)
.height(Fill)
.style(theme::panel)
.into()
}
fn tab<'a>(t: &'static Tokens, panel: Panel, selected: Panel) -> Element<'a, Message> {
let on = panel == selected;
button(
column![
line(panel.label(), theme::MEDIUM, size::BODY, if on { t.fg } else { t.muted }),
container(space()).width(Fill).height(2).style(theme::tab_underline(on)),
]
.spacing(7)
.width(iced::Shrink),
)
.padding(Padding::default().left(10).right(10).top(6))
.style(theme::tab(on))
.on_press(Message::ToggleDrawer(panel))
.into()
}
+4
View File
@@ -0,0 +1,4 @@
pub mod drawer;
pub mod player_bar;
pub mod sidebar;
pub mod topbar;
+295
View File
@@ -0,0 +1,295 @@
//! The persistent bar along the bottom: now playing, transport, extras.
//!
//! Until the audio engine lands the bar only knows its own toggles; `now` stays
//! `None`, so the transport renders disabled and the seek bar is static.
use iced::widget::{button, column, container, row, slider, space};
use iced::{Alignment, Element, Fill, Length};
use crate::app::Message;
use crate::ui::icons::{Icon, icon, sized};
use crate::ui::line;
use crate::ui::theme::{self, Tokens, radius, size};
use crate::widgets::drawer::Panel;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Repeat {
#[default]
Off,
All,
One,
}
impl Repeat {
fn next(self) -> Self {
match self {
Repeat::Off => Repeat::All,
Repeat::All => Repeat::One,
Repeat::One => Repeat::Off,
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct NowPlaying {
pub title: String,
pub artists: String,
pub position: f32,
pub duration: f32,
pub playing: bool,
pub liked: bool,
pub quality: String,
/// Placeholder cover hues until artwork loads.
pub hues: (f32, f32),
}
#[derive(Debug, Clone, PartialEq)]
pub struct PlayerUi {
pub now: Option<NowPlaying>,
pub shuffle: bool,
pub repeat: Repeat,
pub volume: f32,
pub muted: bool,
}
impl Default for PlayerUi {
fn default() -> Self {
Self { now: None, shuffle: false, repeat: Repeat::Off, volume: 0.7, muted: false }
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Action {
ToggleShuffle,
CycleRepeat,
SetVolume(f32),
ToggleMute,
}
impl PlayerUi {
pub fn apply(&mut self, action: Action) {
match action {
Action::ToggleShuffle => self.shuffle = !self.shuffle,
Action::CycleRepeat => self.repeat = self.repeat.next(),
Action::SetVolume(v) => {
self.volume = v.clamp(0.0, 1.0);
self.muted = self.volume == 0.0;
}
Action::ToggleMute => self.muted = !self.muted,
}
}
}
pub fn view<'a>(t: &'static Tokens, p: &'a PlayerUi, drawer: Option<Panel>) -> Element<'a, Message> {
row![
container(now_playing(t, p.now.as_ref())).width(Length::FillPortion(2)),
container(transport(t, p)).width(Length::FillPortion(3)).center_x(Fill),
container(extras(t, p, drawer)).width(Length::FillPortion(2)).align_right(Fill),
]
.spacing(18)
.align_y(Alignment::Center)
.padding([0, 18])
.height(Fill)
.into()
}
fn now_playing<'a>(t: &'static Tokens, now: Option<&'a NowPlaying>) -> Element<'a, Message> {
let cover = container(space())
.width(52)
.height(52)
.style(move |th| match now {
Some(n) => theme::cover(n.hues.0, n.hues.1, radius::CONTROL)(th),
None => iced::widget::container::Style {
background: Some(t.raised.into()),
border: iced::Border { radius: radius::CONTROL.into(), ..Default::default() },
..Default::default()
},
});
let Some(now) = now else {
return row![
cover,
column![
line("Nothing playing", theme::MEDIUM, size::BODY, t.fg),
line("Pick a track to start", theme::BODY, size::META, t.muted),
]
.spacing(2),
]
.spacing(12)
.align_y(Alignment::Center)
.into();
};
row![
cover,
column![
line(&now.title, theme::MEDIUM, size::BODY, t.fg),
line(&now.artists, theme::BODY, size::META, t.muted),
]
.spacing(2)
.width(Length::Shrink),
button(icon(
if now.liked { Icon::HeartFilled } else { Icon::Heart },
if now.liked { t.like } else { t.muted },
))
.padding(8)
.style(theme::icon_button(None)),
button(icon(Icon::Dislike, t.muted)).padding(8).style(theme::icon_button(None)),
]
.spacing(12)
.align_y(Alignment::Center)
.clip(true)
.into()
}
fn transport<'a>(t: &'static Tokens, p: &'a PlayerUi) -> Element<'a, Message> {
let has_track = p.now.is_some();
let playing = p.now.as_ref().is_some_and(|n| n.playing);
let toggle = |glyph: Icon, on: bool, action: Action| {
button(icon(glyph, if on { t.accent } else { t.muted }))
.padding(8)
.style(theme::icon_button(on.then_some(t.accent)))
.on_press(Message::Player(action))
};
let skip = |glyph: Icon| {
button(icon(glyph, if has_track { t.fg } else { t.muted.scale_alpha(0.45) }))
.padding(8)
.style(theme::icon_button(None))
};
let disc_tint = if has_track { t.bg } else { t.muted };
let disc = button(
container(sized(if playing { Icon::Pause } else { Icon::Play }, 18.0, disc_tint)).center(40),
)
.width(40)
.height(40)
.padding(0)
.style(theme::play_disc);
let ctrls = row![
toggle(Icon::Shuffle, p.shuffle, Action::ToggleShuffle),
skip(Icon::Previous),
disc,
skip(Icon::Next),
toggle(
if p.repeat == Repeat::One { Icon::RepeatOne } else { Icon::Repeat },
p.repeat != Repeat::Off,
Action::CycleRepeat,
),
]
.spacing(8)
.align_y(Alignment::Center);
let (pos, dur) = p.now.as_ref().map_or((0.0, 0.0), |n| (n.position, n.duration));
let fraction = if dur > 0.0 { (pos / dur).clamp(0.0, 1.0) } else { 0.0 };
let seek = row![
container(line(clock(pos), theme::BODY, 12.0, t.muted)).width(42).align_right(42),
static_bar(t, fraction),
container(line(clock(dur), theme::BODY, 12.0, t.muted)).width(42),
]
.spacing(10)
.align_y(Alignment::Center)
.width(Fill);
column![ctrls, seek]
.spacing(4)
.align_x(Alignment::Center)
.max_width(560)
.into()
}
/// Seek bar while there is nothing to seek; becomes a slider with the engine.
fn static_bar<'a>(t: &'static Tokens, fraction: f32) -> Element<'a, Message> {
let part = |portion: f32, colour: iced::Color| {
container(space())
.width(Length::FillPortion((portion * 1000.0).round().max(0.0) as u16))
.height(4)
.style(move |_| iced::widget::container::Style {
background: Some(colour.into()),
border: iced::Border { radius: 2.0.into(), ..Default::default() },
..Default::default()
})
};
if fraction <= 0.0 {
return part(1.0, t.raised).width(Fill).into();
}
row![part(fraction, t.accent), part(1.0 - fraction, t.raised)].width(Fill).into()
}
fn extras<'a>(t: &'static Tokens, p: &'a PlayerUi, drawer: Option<Panel>) -> Element<'a, Message> {
let panel_button = |glyph: Icon, panel: Panel| {
let on = drawer == Some(panel);
button(icon(glyph, if on { t.accent } else { t.muted }))
.padding(8)
.style(theme::icon_button(on.then_some(t.accent)))
.on_press(Message::ToggleDrawer(panel))
};
let mut items = row![].spacing(4).align_y(Alignment::Center);
if let Some(now) = &p.now {
items = items.push(
container(line(&now.quality, theme::MEDIUM, 11.5, t.muted))
.padding([2, 6])
.style(theme::badge),
);
}
let volume = if p.muted { 0.0 } else { p.volume };
items
.push(panel_button(Icon::Lyrics, Panel::Lyrics))
.push(panel_button(Icon::Queue, Panel::Queue))
.push(
button(icon(if p.muted { Icon::Muted } else { Icon::Volume }, t.muted))
.padding(8)
.style(theme::icon_button(None))
.on_press(Message::Player(Action::ToggleMute)),
)
.push(
slider(0.0..=1.0, volume, |v| Message::Player(Action::SetVolume(v)))
.step(0.01_f32)
.width(96)
.style(theme::volume_bar),
)
.into()
}
/// `m:ss`, or `h:mm:ss` for podcast-length items.
pub fn clock(seconds: f32) -> String {
let s = seconds.max(0.0) as u64;
let (h, m, s) = (s / 3600, (s / 60) % 60, s % 60);
if h > 0 { format!("{h}:{m:02}:{s:02}") } else { format!("{m}:{s:02}") }
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn clock_formats() {
assert_eq!(clock(0.0), "0:00");
assert_eq!(clock(225.4), "3:45");
assert_eq!(clock(3132.0), "52:12");
assert_eq!(clock(3725.0), "1:02:05");
assert_eq!(clock(-3.0), "0:00");
}
#[test]
fn repeat_cycles_off_all_one() {
let mut p = PlayerUi::default();
p.apply(Action::CycleRepeat);
assert_eq!(p.repeat, Repeat::All);
p.apply(Action::CycleRepeat);
assert_eq!(p.repeat, Repeat::One);
p.apply(Action::CycleRepeat);
assert_eq!(p.repeat, Repeat::Off);
}
#[test]
fn volume_is_clamped_and_zero_means_muted() {
let mut p = PlayerUi::default();
p.apply(Action::SetVolume(1.4));
assert_eq!(p.volume, 1.0);
p.apply(Action::SetVolume(0.0));
assert!(p.muted);
}
}
+110
View File
@@ -0,0 +1,110 @@
//! Left column: wordmark, main navigation, playlists and the account chip.
use iced::widget::{Column, button, column, container, row, space};
use iced::{Alignment, Element, Fill, Padding};
use crate::app::Message;
use crate::route::Route;
use crate::ui::icons::{Icon, icon};
use crate::ui::theme::{self, Tokens, radius, shell, size};
use crate::ui::{line, para};
pub fn view<'a>(t: &'static Tokens, current: Route) -> Element<'a, Message> {
let nav = Column::with_children(Route::NAV.map(|route| nav_item(t, route, route == current)))
.spacing(2);
let playlists_head = row![
line("Playlists", theme::MEDIUM, size::SMALL, t.muted),
space().width(Fill),
button(icon(Icon::Plus, t.muted))
.padding(4)
.style(theme::icon_button(None)),
]
.align_y(Alignment::Center)
.padding(Padding::default().left(10).right(2));
let playlists = container(para(
"Your playlists appear here after you sign in.",
size::META,
t.muted,
))
.padding(Padding::default().left(10).right(10));
column![
wordmark(t),
nav,
column![playlists_head, playlists].spacing(6),
space().height(Fill),
account(t, current),
]
.spacing(22)
.padding(Padding::default().top(18).bottom(12).left(12).right(12))
.width(shell::SIDEBAR)
.height(Fill)
.into()
}
pub fn wordmark<'a>(t: &'static Tokens) -> Element<'a, Message> {
row![
line("musyx", theme::DISPLAY, size::WORDMARK, t.fg),
container(space()).width(7).height(7).style(theme::accent_dot),
]
.spacing(3)
.align_y(Alignment::End)
.padding(Padding::default().left(10).top(4).bottom(4))
.into()
}
fn nav_item<'a>(t: &'static Tokens, route: Route, active: bool) -> Element<'a, Message> {
let tint = if active { t.accent } else { t.muted };
button(
row![
icon(route.icon(), tint),
line(route.label(), theme::MEDIUM, size::BODY, if active { t.fg } else { t.muted }),
]
.spacing(12)
.align_y(Alignment::Center),
)
.width(Fill)
.padding([9, 10])
.style(theme::nav_item(active))
.on_press(Message::Navigate(route))
.into()
}
/// Signed-out state; becomes the avatar, login and subscription once sign-in lands.
fn account<'a>(t: &'static Tokens, current: Route) -> Element<'a, Message> {
let avatar = container(line("?", theme::SEMIBOLD, size::BODY, t.muted))
.center(32)
.style(move |_| iced::widget::container::Style {
background: Some(t.raised.into()),
border: iced::Border { radius: radius::PILL.into(), ..Default::default() },
..Default::default()
});
let settings_active = current == Route::Settings;
column![
container(space()).width(Fill).height(1).style(theme::divider),
row![
avatar,
column![
line("Not signed in", theme::MEDIUM, 13.5, t.fg),
button(line("Sign in", theme::MEDIUM, size::SMALL, t.accent))
.padding(0)
.style(theme::tab(false))
.on_press(Message::Navigate(Route::SignIn)),
]
.spacing(1)
.width(Fill),
button(icon(Icon::Settings, if settings_active { t.accent } else { t.muted }))
.padding(8)
.style(theme::icon_button(None))
.on_press(Message::Navigate(Route::Settings)),
]
.spacing(10)
.align_y(Alignment::Center)
.padding(Padding::default().left(10).right(2)),
]
.spacing(14)
.into()
}
+33
View File
@@ -0,0 +1,33 @@
//! Back button and search field above the content.
use iced::widget::{button, row, text_input};
use iced::{Alignment, Element};
use crate::app::Message;
use crate::ui::icons::{Icon, icon};
use crate::ui::theme::{self, Tokens, size, space};
pub const SEARCH_ID: &str = "search";
pub fn view<'a>(t: &'static Tokens, can_go_back: bool, query: &str) -> Element<'a, Message> {
let back = button(icon(Icon::Back, if can_go_back { t.fg } else { t.muted }))
.padding(8)
.style(theme::icon_button(None))
.on_press_maybe(can_go_back.then_some(Message::Back));
let search = text_input("Search artists, tracks, podcasts", query)
.id(SEARCH_ID)
.on_input(Message::SearchChanged)
.on_submit(Message::SearchSubmitted)
.font(theme::BODY)
.size(size::BODY)
.padding([10, 16])
.width(420)
.style(theme::search_field);
row![back, search]
.spacing(10)
.align_y(Alignment::Center)
.padding([14.0, space::GUTTER])
.into()
}
+12
View File
@@ -0,0 +1,12 @@
[package]
name = "ym-api"
description = "Client for the unofficial Yandex Music API"
version.workspace = true
edition.workspace = true
license.workspace = true
publish.workspace = true
[dependencies]
[lints]
workspace = true
+4
View File
@@ -0,0 +1,4 @@
//! Client for the unofficial Yandex Music API.
//!
//! Filled in by milestone 3 (sign-in) onwards; the app depends on this crate's
//! own types only, never on whichever upstream wrapper it uses internally.
+841
View File
@@ -0,0 +1,841 @@
<title>Musyx Desktop Mockup</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600&family=Unbounded:wght@500;600&display=swap">
<style>
/* Layout: desktop window — 232px sidebar | scrolling content | optional 320px drawer; 80px player bar spans the bottom.
Dark-first: aubergine graphite ground, one amber accent taken from a tape deck's VU needle. */
:root {
--bg: #1C1A22;
--panel: #23202B;
--raised: #2D2937;
--line: #3A3546;
--fg: #EEEAF3;
--muted: #A39CB0;
--accent: #F0B23E;
--accent-ink: #2A1D04;
--like: #F27286;
--ok: #7FCB9B;
--shadow: 0 18px 50px rgba(8, 6, 14, .45);
--font-display: "Unbounded", "Onest", system-ui, sans-serif;
--font-body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
--r-cover: 10px;
--r-ctl: 8px;
color-scheme: dark;
}
@media (prefers-color-scheme: light) {
:root:not([data-theme="dark"]) {
--bg: #F3F1F6; --panel: #FFFFFF; --raised: #EAE6F0; --line: #DCD6E4;
--fg: #1F1B27; --muted: #686178; --accent: #A86C05; --accent-ink: #FFF7E6;
--like: #D2405A; --ok: #2E8A55; --shadow: 0 18px 50px rgba(40, 30, 60, .14);
color-scheme: light;
}
}
:root[data-theme="light"] {
--bg: #F3F1F6; --panel: #FFFFFF; --raised: #EAE6F0; --line: #DCD6E4;
--fg: #1F1B27; --muted: #686178; --accent: #A86C05; --accent-ink: #FFF7E6;
--like: #D2405A; --ok: #2E8A55; --shadow: 0 18px 50px rgba(40, 30, 60, .14);
color-scheme: light;
}
* { box-sizing: border-box; }
body {
background: var(--bg); color: var(--fg);
font: 400 14px/1.45 var(--font-body);
padding: 20px 16px 32px;
-webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }
/* Review strip (outside the app window) */
.review { max-width: 1280px; margin: 0 auto 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.review h1 { font: 600 17px/1.2 var(--font-display); margin: 0; letter-spacing: .01em; }
.review p { margin: 0; color: var(--muted); font-size: 13px; flex: 1 1 260px; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
color: var(--muted); font-size: 13px; background: var(--panel);
}
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
/* App window */
.window {
max-width: 1280px; height: 780px; margin: 0 auto;
display: grid; grid-template-columns: 232px minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) 80px;
background: var(--bg); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
box-shadow: var(--shadow);
}
.window.signed-out { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.window.signed-out > :not(.signin) { display: none; }
/* Sidebar */
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 12px; gap: 22px; min-height: 0; }
.wordmark { font: 600 20px/1 var(--font-display); letter-spacing: -.01em; padding: 4px 10px; display: flex; align-items: baseline; gap: 2px; }
.wordmark i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button, .side-list button {
display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-ctl);
color: var(--muted); font-weight: 500; text-align: left; width: 100%;
}
.nav button:hover, .side-list button:hover { color: var(--fg); background: var(--raised); }
.nav button[aria-current="page"] { color: var(--fg); background: var(--raised); }
.nav button[aria-current="page"] svg { color: var(--accent); }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 0 10px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.side-head button { color: var(--muted); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; }
.side-head button:hover { background: var(--raised); color: var(--fg); }
.side-list { display: flex; flex-direction: column; gap: 1px; overflow: auto; min-height: 0; flex: 1; }
.side-list button { gap: 10px; padding: 6px 10px; font-weight: 400; }
.side-list .cover { width: 30px; height: 30px; border-radius: 6px; }
.side-list span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-ctl); border-top: 1px solid var(--line); padding-top: 14px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #8E7AB5, #E0A84B); display: grid; place-items: center; font-weight: 600; color: #1C1A22; flex: none; }
.account div { min-width: 0; flex: 1; }
.account b { display: block; font-weight: 500; font-size: 13.5px; }
.account small { color: var(--ok); font-size: 12px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r-ctl); color: var(--muted); flex: none; }
.icon-btn:hover { color: var(--fg); background: var(--raised); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn.liked { color: var(--like); }
.icon-btn.liked svg { fill: currentColor; }
/* Content */
.content { overflow: auto; min-height: 0; min-width: 0; position: relative; }
.topbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
.topbar .search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.topbar .search input { background: none; border: 0; outline: 0; flex: 1; min-width: 0; color: var(--fg); }
.screen { padding: 6px 28px 40px; display: flex; flex-direction: column; gap: 34px; }
.screen-title { font: 600 30px/1.15 var(--font-display); letter-spacing: -.015em; margin: 0; text-wrap: balance; }
.sec { display: flex; flex-direction: column; gap: 14px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-head h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.005em; }
.sec-head button { color: var(--muted); font-size: 13px; }
.sec-head button:hover { color: var(--fg); }
.sub { color: var(--muted); }
/* Covers: generated art stands in for Yandex's avatars.yandex.net images */
.cover {
aspect-ratio: 1; max-width: 100%; border-radius: var(--r-cover); position: relative; overflow: hidden; flex: none;
background:
radial-gradient(circle at 28% 24%, hsl(var(--h1) 78% 66% / .95), transparent 52%),
radial-gradient(circle at 78% 82%, hsl(var(--h2) 70% 52% / .85), transparent 55%),
linear-gradient(140deg, hsl(var(--h2) 38% 26%), hsl(var(--h1) 44% 14%));
}
.cover.round { border-radius: 50%; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 22px 18px; }
.card { display: flex; flex-direction: column; gap: 9px; text-align: left; min-width: 0; }
.card .cover { width: 100%; }
.card .cover .play-fab { position: absolute; right: 10px; bottom: 10px; opacity: 0; transform: translateY(6px); transition: .18s; }
.card:hover .cover .play-fab, .card:focus-visible .cover .play-fab { opacity: 1; transform: none; }
.card b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card small { color: var(--muted); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-fab { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
.play-fab svg { fill: currentColor; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary svg { fill: currentColor; }
.btn.ghost { border: 1px solid var(--line); color: var(--fg); font-weight: 500; }
.btn.ghost:hover { background: var(--raised); }
/* My Wave hero — the one bold moment */
.wave-hero { position: relative; border-radius: 16px; overflow: hidden; min-height: 260px; background: var(--panel); border: 1px solid var(--line); display: flex; align-items: flex-end; }
.wave-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.wave-hero .wave-body { position: relative; padding: 26px 28px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 28px; width: 100%; }
.wave-hero h2 { font: 600 34px/1.05 var(--font-display); margin: 0 0 6px; letter-spacing: -.02em; }
.wave-hero p { margin: 0; color: var(--muted); max-width: 40ch; }
.wave-hero .wave-text { flex: 1 1 260px; min-width: 0; }
.wave-hero.big { min-height: 380px; }
.wave-hero.big h2 { font-size: 46px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.setting h3 { margin: 0 0 10px; font-size: 14px; font-weight: 500; color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); color: var(--fg); font-size: 13.5px; }
.seg button:hover { background: var(--raised); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 500; }
/* Track list */
.tracks { display: flex; flex-direction: column; }
.trow {
display: grid; grid-template-columns: 36px minmax(0, 2.2fr) minmax(0, 1.4fr) 34px 52px 34px; align-items: center; gap: 12px;
padding: 6px 10px; border-radius: var(--r-ctl); text-align: left; width: 100%;
}
.trow.head { color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--line); border-radius: 0; padding-bottom: 8px; margin-bottom: 4px; }
.trow:not(.head):hover { background: var(--raised); }
.trow .idx { color: var(--muted); text-align: center; position: relative; }
.trow .t { display: flex; align-items: center; gap: 12px; min-width: 0; }
.trow .t .cover { width: 40px; height: 40px; border-radius: 6px; }
.trow .t div { min-width: 0; }
.trow .t b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .t small, .trow .alb { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.trow .dur { color: var(--muted); text-align: right; }
.trow.playing b, .trow.playing .idx { color: var(--accent); }
.trow .more { opacity: 0; }
.trow:hover .more, .trow:focus-within .more { opacity: 1; }
.trow.no-cover .t .cover { display: none; }
.trow.with-grip { grid-template-columns: 22px 36px minmax(0, 2.2fr) minmax(0, 1.4fr) 34px 52px 34px; }
.grip { color: var(--muted); cursor: grab; display: grid; place-items: center; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s; } .eq i:nth-child(3) { animation-delay: -.7s; }
.paused .eq i { animation-play-state: paused; }
@keyframes eq { 0%,100% { height: 4px } 50% { height: 14px } }
/* Detail headers (album / artist / playlist) */
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 22px 28px; }
.detail-head .cover { width: 220px; box-shadow: var(--shadow); }
.detail-head .meta { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.detail-head .kind { color: var(--muted); font-size: 13px; }
.detail-head h1 { font: 600 40px/1.08 var(--font-display); margin: 0; letter-spacing: -.02em; text-wrap: balance; }
.detail-head .by { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); }
.detail-head .by b { color: var(--fg); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--raised); color: var(--muted); font-size: 12.5px; }
.pill svg.lucide { width: 13px; height: 13px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs button { padding: 9px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--fg); border-color: var(--accent); }
.tabs .count { color: var(--muted); font-weight: 400; margin-left: 4px; font-size: 12.5px; }
.chart-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 24px; }
.chart-row { display: grid; grid-template-columns: 26px 18px 44px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-ctl); text-align: left; }
.chart-row:hover { background: var(--raised); }
.chart-row .rank { font: 600 15px/1 var(--font-display); text-align: right; }
.chart-row .delta { font-size: 11px; color: var(--muted); text-align: center; }
.chart-row .delta.up { color: var(--ok); } .chart-row .delta.down { color: var(--like); }
.chart-row .cover { width: 44px; border-radius: 6px; }
.chart-row b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-row small { color: var(--muted); font-size: 13px; }
.top-result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 24px; }
.top-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; text-align: left; position: relative; }
.top-card .cover { width: 108px; }
.top-card h3 { font: 600 26px/1.1 var(--font-display); margin: 0; }
.top-card .play-fab { position: absolute; right: 20px; bottom: 20px; }
.edit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; }
/* Drawer: queue / lyrics */
.drawer { grid-row: 1; grid-column: 3; width: 320px; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.drawer[hidden] { display: none !important; }
.drawer-head { display: flex; align-items: center; gap: 6px; padding: 14px 14px 8px 18px; }
.drawer-head .tabs { border: 0; flex: 1; }
.drawer-body { overflow: auto; min-height: 0; padding: 4px 10px 18px; }
.drawer h4 { margin: 14px 8px 8px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.qrow { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: var(--r-ctl); text-align: left; width: 100%; }
.qrow:hover { background: var(--raised); }
.qrow .cover { width: 40px; border-radius: 6px; }
.qrow b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow small { color: var(--muted); font-size: 12.5px; }
.qrow.now b { color: var(--accent); }
.lyrics { padding: 10px 10px 30px; display: flex; flex-direction: column; gap: 14px; }
.lyrics .line { height: 15px; border-radius: 5px; background: var(--raised); }
.lyrics .line.past { opacity: .45; }
.lyrics .line.current { background: var(--accent); height: 19px; }
.lyrics .note { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
/* Player bar */
.player {
grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr);
align-items: center; gap: 18px; padding: 0 18px; background: var(--panel); border-top: 1px solid var(--line);
}
.now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.now .cover { width: 52px; border-radius: 8px; }
.now div { min-width: 0; }
.now b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now small { color: var(--muted); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transport { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.transport .ctrls { display: flex; align-items: center; gap: 8px; }
.transport .pp { width: 40px; height: 40px; border-radius: 50%; background: var(--fg); color: var(--bg); display: grid; place-items: center; }
.transport .pp svg { fill: currentColor; }
.progress { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; align-items: center; gap: 10px; width: 100%; font-size: 12px; color: var(--muted); }
.progress span:last-child { text-align: left; }
.progress span:first-child { text-align: right; }
.bar { height: 4px; border-radius: 2px; background: var(--raised); position: relative; cursor: pointer; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 2px; }
.bar i::after { content: ""; position: absolute; right: -6px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--fg); opacity: 0; transition: opacity .15s; }
.bar:hover i::after { opacity: 1; }
.extras { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.quality { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; margin-right: 6px; white-space: nowrap; }
.vol { display: flex; align-items: center; gap: 8px; width: 120px; }
.vol .bar { flex: 1; }
.vol .bar i { background: var(--fg); }
/* Sign-in */
.signin { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 0; }
.signin .left { padding: 48px 56px; display: flex; flex-direction: column; gap: 28px; overflow: auto; }
.signin h2 { font: 600 34px/1.12 var(--font-display); letter-spacing: -.02em; margin: 0; max-width: 16ch; text-wrap: balance; }
.signin .lead { color: var(--muted); max-width: 46ch; margin: 0; font-size: 15px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; align-items: start; counter-increment: s; }
.steps li::before { content: counter(s); width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; color: var(--muted); }
.steps b { font-weight: 500; display: block; margin-top: 4px; }
.steps .sub { font-size: 13.5px; }
.code-box { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.code { font: 600 30px/1 var(--font-display); letter-spacing: .12em; padding: 14px 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: pulse 1.6s infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 10px transparent; } }
details { color: var(--muted); font-size: 13.5px; }
details summary { cursor: pointer; width: fit-content; }
details .token-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
details input { flex: 1 1 220px; min-width: 0; height: 38px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--panel); }
.fine { color: var(--muted); font-size: 12.5px; margin: auto 0 0; max-width: 52ch; }
.signin .right { position: relative; background: var(--panel); border-left: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.signin .right canvas.bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.qr-card { position: relative; background: #FFFFFF; padding: 18px; border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-card canvas { width: 200px; height: 200px; image-rendering: pixelated; }
.qr-card small { color: #4A4458; font-size: 12.5px; }
/* Narrow layouts */
@media (max-width: 1020px) {
.drawer { position: absolute; right: 0; top: 0; bottom: 80px; z-index: 6; box-shadow: var(--shadow); }
.window { position: relative; }
.trow .alb { display: none; }
.trow, .trow.with-grip { grid-template-columns: 36px minmax(0, 1fr) 34px 52px 34px; }
.trow.with-grip { grid-template-columns: 22px 36px minmax(0, 1fr) 34px 52px 34px; }
.top-result { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
.window { height: auto; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(560px, auto) auto; }
.sidebar { flex-direction: row; align-items: center; padding: 10px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.sidebar .wordmark { display: none; }
.nav { flex-direction: row; }
.nav button { width: auto; white-space: nowrap; }
.side-head, .side-list, .account { display: none; }
.content { grid-row: 2; max-height: 640px; }
.drawer { width: min(320px, 100%); bottom: 0; }
.player { grid-row: 3; grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px; }
.extras { display: none; }
.transport .ctrls .icon-btn:not(.keep) { display: none; }
.progress { display: none; }
.screen, .topbar { padding-left: 16px; padding-right: 16px; }
.detail-head .cover { width: 150px; }
.detail-head h1 { font-size: 30px; }
.wave-hero h2, .wave-hero.big h2 { font-size: 30px; }
.signin { grid-template-columns: 1fr; }
.signin .left { padding: 28px 20px; }
.signin .right { min-height: 300px; border-left: 0; border-top: 1px solid var(--line); }
.window.signed-out { grid-template-rows: auto; }
.code { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
.eq i, .pulse { animation: none; }
.card .cover .play-fab { transition: none; }
}
</style>
<header class="review">
<h1>Musyx mockup</h1>
<p>Sample data throughout. Covers are generated art; the app will show real artwork from Yandex Music.</p>
<div class="chips" id="screen-chips" role="group" aria-label="Jump to screen"></div>
</header>
<div class="window" id="win">
<!-- Sign in -->
<section class="signin" aria-label="Sign in" hidden>
<div class="left">
<div class="wordmark">musyx<i></i></div>
<div>
<h2>Sign in with your Yandex account</h2>
</div>
<p class="lead">Musyx plays your Yandex Music library, My Wave and playlists. You confirm sign-in on Yandex's own page, so your password never passes through this app.</p>
<ol class="steps">
<li><div><b>Open oauth.yandex.ru/device</b><span class="sub">On this computer or your phone. You can also scan the QR code.</span></div></li>
<li><div><b>Enter this code</b>
<div class="code-box"><span class="code" id="dev-code">QX7K-29PM</span><button class="btn ghost" id="copy-code"><i data-lucide="copy"></i>Copy code</button></div>
</div></li>
<li><div><b>Come back here</b><span class="sub">Musyx signs you in as soon as you allow access.</span></div></li>
</ol>
<div class="status"><span class="pulse" aria-hidden="true"></span><span>Waiting for confirmation · code expires in <span class="num" id="expires">4:52</span></span></div>
<details>
<summary>Sign in with an existing token instead</summary>
<div class="token-row"><input id="token-input" type="password" placeholder="Paste OAuth token" aria-label="OAuth token"><button class="btn ghost" id="token-btn">Sign in</button></div>
</details>
<p class="fine">Musyx is an unofficial client and isn't affiliated with Yandex. Your sign-in token is kept in the system keychain.</p>
</div>
<div class="right">
<canvas class="bg" id="signin-wave" aria-hidden="true"></canvas>
<div class="qr-card"><canvas id="qr" width="29" height="29" aria-label="QR code for oauth.yandex.ru/device"></canvas><small>Scan to open the sign-in page</small></div>
</div>
</section>
<!-- Sidebar -->
<aside class="sidebar">
<div class="wordmark">musyx<i></i></div>
<nav class="nav" aria-label="Main">
<button data-go="home"><i data-lucide="house"></i>Home</button>
<button data-go="wave"><i data-lucide="audio-lines"></i>My Wave</button>
<button data-go="search"><i data-lucide="search"></i>Search</button>
<button data-go="collection"><i data-lucide="library"></i>Collection</button>
<button data-go="podcasts"><i data-lucide="podcast"></i>Podcasts</button>
</nav>
<div class="side-head"><span>Playlists</span><button aria-label="New playlist"><i data-lucide="plus"></i></button></div>
<div class="side-list" id="side-playlists"></div>
<div class="account">
<span class="avatar">Ю</span>
<div><b>yuriy.panov</b><small>Plus subscription</small></div>
<button class="icon-btn" data-go="signin" aria-label="Sign out"><i data-lucide="log-out"></i></button>
</div>
</aside>
<!-- Content -->
<main class="content" id="content">
<div class="topbar">
<button class="icon-btn" id="back" aria-label="Back"><i data-lucide="chevron-left"></i></button>
<label class="search"><i data-lucide="search"></i><input id="q" placeholder="Artists, tracks, podcasts" aria-label="Search"></label>
</div>
<!-- Home -->
<section class="screen" data-screen="home">
<div class="wave-hero">
<canvas data-wave aria-hidden="true"></canvas>
<div class="wave-body">
<div class="wave-text"><h2>My Wave</h2><p>An endless stream picked from what you play, like and skip. Tuned to: any mood, favourites.</p></div>
<button class="btn primary" data-play-wave><i data-lucide="play"></i>Play My Wave</button>
<button class="btn ghost" data-go="wave"><i data-lucide="sliders-horizontal"></i>Tune</button>
</div>
</div>
<div class="sec"><div class="sec-head"><h2>Made for you</h2></div><div class="grid" id="made-for-you"></div></div>
<div class="sec"><div class="sec-head"><h2>Chart</h2><button>Show all 100</button></div><div class="chart-list" id="chart"></div></div>
<div class="sec"><div class="sec-head"><h2>Albums you might like</h2><button>Show all</button></div><div class="grid" id="albums-like"></div></div>
</section>
<!-- My Wave -->
<section class="screen" data-screen="wave" hidden>
<div class="wave-hero big">
<canvas data-wave aria-hidden="true"></canvas>
<div class="wave-body">
<div class="wave-text"><h2>My Wave</h2><p>Every like, skip and full listen steers what comes next.</p></div>
<button class="btn primary" data-play-wave><i data-lucide="play"></i>Play</button>
</div>
</div>
<div class="settings-grid">
<div class="setting"><h3>Mood</h3><div class="seg" data-seg><button aria-pressed="true">Any</button><button>Energetic</button><button>Cheerful</button><button>Calm</button><button>Sad</button></div></div>
<div class="setting"><h3>Character</h3><div class="seg" data-seg><button aria-pressed="true">Favourite</button><button>Unfamiliar</button><button>Popular</button></div></div>
<div class="setting"><h3>Language</h3><div class="seg" data-seg><button>Russian</button><button>Foreign</button><button>No vocals</button><button aria-pressed="true">Any</button></div></div>
</div>
<div class="sec"><div class="sec-head"><h2>Stations</h2></div><div class="grid" id="stations"></div></div>
</section>
<!-- Search -->
<section class="screen" data-screen="search" hidden>
<h1 class="screen-title">Results for “земфира”</h1>
<div class="tabs" role="tablist" data-tabs><button role="tab" aria-selected="true">All</button><button role="tab">Tracks</button><button role="tab">Albums</button><button role="tab">Artists</button><button role="tab">Playlists</button><button role="tab">Podcasts</button></div>
<div class="top-result">
<div class="sec"><div class="sec-head"><h2>Top result</h2></div>
<button class="top-card" data-go="artist">
<span class="cover round" style="--h1:330;--h2:260"></span>
<h3>Земфира</h3><span class="sub">Artist · 4.1M listeners a month</span>
<span class="play-fab"><i data-lucide="play"></i></span>
</button>
</div>
<div class="sec"><div class="sec-head"><h2>Tracks</h2></div><div class="tracks" id="search-tracks"></div></div>
</div>
<div class="sec"><div class="sec-head"><h2>Albums</h2></div><div class="grid" id="search-albums"></div></div>
</section>
<!-- Collection -->
<section class="screen" data-screen="collection" hidden>
<h1 class="screen-title">Collection</h1>
<div class="tabs" role="tablist" data-tabs>
<button role="tab" aria-selected="true">Liked tracks<span class="count num">1,284</span></button>
<button role="tab">Albums<span class="count num">96</span></button>
<button role="tab">Artists<span class="count num">41</span></button>
<button role="tab">Playlists<span class="count num">18</span></button>
<button role="tab">Podcasts<span class="count num">6</span></button>
<button role="tab">Disliked<span class="count num">57</span></button>
</div>
<div class="actions" style="margin-top:-12px"><button class="btn primary" data-play-first="liked"><i data-lucide="play"></i>Play</button><button class="btn ghost"><i data-lucide="shuffle"></i>Shuffle</button></div>
<div class="tracks" id="liked"></div>
</section>
<!-- Album -->
<section class="screen" data-screen="album" hidden>
<div class="detail-head">
<span class="cover" style="--h1:8;--h2:345"></span>
<div class="meta">
<span class="kind">Album · 1988</span>
<h1>Группа крови</h1>
<div class="by"><b>Кино</b><span class="num">12 tracks · 47 min</span><span class="pill"><i data-lucide="disc-3"></i>MP3 320</span></div>
<div class="actions">
<button class="btn primary" data-play-first="album"><i data-lucide="play"></i>Play</button>
<button class="btn ghost"><i data-lucide="shuffle"></i>Shuffle</button>
<button class="icon-btn liked" data-like aria-label="Remove album from collection" aria-pressed="true"><i data-lucide="heart"></i></button>
<button class="icon-btn" aria-label="More album actions"><i data-lucide="ellipsis"></i></button>
</div>
</div>
</div>
<div class="tracks" id="album-tracks"></div>
<div class="sec"><div class="sec-head"><h2>More by Кино</h2></div><div class="grid" id="more-by"></div></div>
</section>
<!-- Artist -->
<section class="screen" data-screen="artist" hidden>
<div class="detail-head">
<span class="cover round" style="--h1:330;--h2:260"></span>
<div class="meta">
<span class="kind">Artist · Rock, Pop</span>
<h1>Земфира</h1>
<div class="by"><span class="num">4.1M listeners a month · 2.3M likes</span></div>
<div class="actions">
<button class="btn primary" data-play-first="artist"><i data-lucide="play"></i>Play</button>
<button class="btn ghost" data-play-wave><i data-lucide="audio-lines"></i>Artist wave</button>
<button class="icon-btn" data-like aria-label="Like artist" aria-pressed="false"><i data-lucide="heart"></i></button>
</div>
</div>
</div>
<div class="sec"><div class="sec-head"><h2>Popular tracks</h2><button>Show all</button></div><div class="tracks" id="artist-tracks"></div></div>
<div class="sec"><div class="sec-head"><h2>Albums</h2></div><div class="grid" id="artist-albums"></div></div>
<div class="sec"><div class="sec-head"><h2>Similar artists</h2></div><div class="grid" id="similar"></div></div>
</section>
<!-- Playlist (own, editable) -->
<section class="screen" data-screen="playlist" hidden>
<div class="detail-head">
<span class="cover" style="--h1:42;--h2:190"></span>
<div class="meta">
<span class="kind">Your playlist · <span class="pill"><i data-lucide="lock"></i>Private</span></span>
<h1>Дорога на дачу</h1>
<div class="by"><b>yuriy.panov</b><span class="num">14 tracks · 52 min · edited yesterday</span></div>
<div class="actions">
<button class="btn primary" data-play-first="playlist"><i data-lucide="play"></i>Play</button>
<button class="btn ghost"><i data-lucide="plus"></i>Add tracks</button>
<button class="btn ghost"><i data-lucide="pencil"></i>Rename</button>
<button class="icon-btn" aria-label="Make public"><i data-lucide="globe"></i></button>
<button class="icon-btn" aria-label="Delete playlist"><i data-lucide="trash-2"></i></button>
</div>
</div>
</div>
<div class="edit-bar"><i data-lucide="grip-vertical"></i>Drag tracks to reorder. Changes save to Yandex Music right away.</div>
<div class="tracks" id="playlist-tracks"></div>
</section>
<!-- Podcasts -->
<section class="screen" data-screen="podcasts" hidden>
<h1 class="screen-title">Podcasts and books</h1>
<div class="sec"><div class="sec-head"><h2>Continue listening</h2></div><div class="tracks" id="episodes"></div></div>
<div class="sec"><div class="sec-head"><h2>Your podcasts</h2></div><div class="grid" id="pods"></div></div>
</section>
</main>
<!-- Drawer -->
<aside class="drawer" id="drawer" hidden>
<div class="drawer-head">
<div class="tabs" role="tablist" id="drawer-tabs"><button role="tab" data-panel="queue" aria-selected="true">Queue</button><button role="tab" data-panel="lyrics">Lyrics</button></div>
<button class="icon-btn" id="drawer-close" aria-label="Close panel"><i data-lucide="x"></i></button>
</div>
<div class="drawer-body" data-panel-body="queue">
<h4>Now playing</h4><div id="q-now"></div>
<h4>Next from: Группа крови</h4><div id="q-next"></div>
</div>
<div class="drawer-body" data-panel-body="lyrics" hidden>
<div class="lyrics" id="lyrics"><p class="note">Synced lyrics from Yandex Music appear here. The current line follows playback, and clicking a line seeks to it.</p></div>
</div>
</aside>
<!-- Player -->
<footer class="player" id="player">
<div class="now">
<span class="cover" id="p-cover" style="--h1:8;--h2:345"></span>
<div><b id="p-title">Звезда по имени Солнце</b><small id="p-artist">Кино</small></div>
<button class="icon-btn liked" data-like aria-label="Remove from liked tracks" aria-pressed="true"><i data-lucide="heart"></i></button>
<button class="icon-btn" aria-label="Don't recommend this track"><i data-lucide="ban"></i></button>
</div>
<div class="transport">
<div class="ctrls">
<button class="icon-btn" id="shuffle" aria-label="Shuffle" aria-pressed="false"><i data-lucide="shuffle"></i></button>
<button class="icon-btn keep" id="prev" aria-label="Previous track"><i data-lucide="skip-back"></i></button>
<button class="pp keep" id="pp" aria-label="Pause"><i data-lucide="pause"></i></button>
<button class="icon-btn keep" id="next" aria-label="Next track"><i data-lucide="skip-forward"></i></button>
<button class="icon-btn" id="repeat" aria-label="Repeat" aria-pressed="false"><i data-lucide="repeat"></i></button>
</div>
<div class="progress num"><span id="t-cur">1:12</span><div class="bar" id="seek"><i id="t-fill" style="width:32%"></i></div><span id="t-dur">3:45</span></div>
</div>
<div class="extras">
<span class="quality">MP3 320</span>
<button class="icon-btn" data-drawer="lyrics" aria-label="Lyrics" aria-pressed="false"><i data-lucide="mic-vocal"></i></button>
<button class="icon-btn" data-drawer="queue" aria-label="Queue" aria-pressed="false"><i data-lucide="list-music"></i></button>
<div class="vol"><i data-lucide="volume-2"></i><div class="bar" id="vol"><i style="width:70%"></i></div></div>
</div>
</footer>
</div>
<script src="https://unpkg.com/lucide@0.460.0/dist/umd/lucide.min.js"></script>
<script>
(() => {
const $ = (s, r = document) => r.querySelector(s);
const $$ = (s, r = document) => [...r.querySelectorAll(s)];
const icons = () => { try { window.lucide && lucide.createIcons(); } catch (e) {} };
// ---- Sample data ----
const kino = { h1: 8, h2: 345 };
const album = [
["Группа крови", "4:46"], ["Закрой за мной дверь, я ухожу", "4:16"], ["Война", "4:34"],
["Попробуй спеть вместе со мной", "4:43"], ["Звезда по имени Солнце", "3:45"], ["Спокойная ночь", "6:06"],
["Мама, мы все тяжело больны", "4:02"], ["В наших глазах", "3:37"], ["Бошетунмай", "3:30"],
["Легенда", "4:05"], ["Прохожий", "3:22"], ["Дерево", "2:58"]
].map(([t, d]) => ({ t, a: "Кино", al: "Группа крови", d, ...kino }));
const z = (t, al, d, h1, h2) => ({ t, a: "Земфира", al, d, h1, h2 });
const zTracks = [
z("Хочешь?", "Прости меня моя любовь", "3:45", 200, 250), z("Искала", "Прости меня моя любовь", "3:38", 200, 250),
z("Ариведерчи", "Земфира", "4:00", 330, 280), z("ПММЛ", "Прости меня моя любовь", "3:56", 200, 250),
z("Жить в твоей голове", "Жить в твоей голове", "4:26", 160, 220)
];
const liked = [
album[4], zTracks[0],
{ t: "Выхода нет", a: "Сплин", al: "Гранатовый альбом", d: "3:50", h1: 25, h2: 300 },
{ t: "Полковнику никто не пишет", a: "Би-2", al: "Би-2", d: "4:45", h1: 280, h2: 30 },
{ t: "Владивосток 2000", a: "Мумий Тролль", al: "Морская", d: "2:45", h1: 185, h2: 210 },
{ t: "Город золотой", a: "Аквариум", al: "Десять стрел", d: "3:25", h1: 48, h2: 20 },
{ t: "Что такое осень", a: "ДДТ", al: "Актриса Весна", d: "5:10", h1: 30, h2: 0 },
zTracks[2], album[0],
{ t: "Каждый раз", a: "Монеточка", al: "Раскраски для взрослых", d: "3:28", h1: 300, h2: 170 }
];
const card = (o) => `<button class="card" data-go="${o.go || "album"}"><span class="cover${o.round ? " round" : ""}" style="--h1:${o.h1};--h2:${o.h2}">
<span class="play-fab"><i data-lucide="play"></i></span></span><span><b>${o.t}</b><small>${o.s}</small></span></button>`;
const madeForYou = [
{ t: "Playlist of the Day", s: "Updated today · 60 tracks", h1: 45, h2: 15, go: "playlist" },
{ t: "Déjà Vu", s: "Tracks you haven't heard yet", h1: 270, h2: 200, go: "playlist" },
{ t: "Premiere", s: "New from artists you like", h1: 150, h2: 90, go: "playlist" },
{ t: "Secret Stash", s: "Songs you might have missed", h1: 320, h2: 40, go: "playlist" },
{ t: "Your 2026", s: "Your most played this year", h1: 210, h2: 330, go: "playlist" }
];
const albumsLike = [
{ t: "Группа крови", s: "Кино · 1988", ...kino },
{ t: "Прости меня моя любовь", s: "Земфира · 2000", h1: 200, h2: 250 },
{ t: "Морская", s: "Мумий Тролль · 1997", h1: 185, h2: 210 },
{ t: "Гранатовый альбом", s: "Сплин · 1998", h1: 25, h2: 300 },
{ t: "Десять стрел", s: "Аквариум · 1986", h1: 48, h2: 20 }
];
const chart = [
["Хочешь?", "Земфира", "up", 200, 250], ["Звезда по имени Солнце", "Кино", "", 8, 345],
["Выхода нет", "Сплин", "down", 25, 300], ["Полковнику никто не пишет", "Би-2", "up", 280, 30],
["Владивосток 2000", "Мумий Тролль", "", 185, 210], ["Каждый раз", "Монеточка", "up", 300, 170]
];
const playlists = [
{ t: "Liked tracks", h1: 345, h2: 330, go: "collection" }, { t: "Дорога на дачу", h1: 42, h2: 190, go: "playlist" },
{ t: "Для работы", h1: 160, h2: 230, go: "playlist" }, { t: "Русский рок 90-х", h1: 10, h2: 40, go: "playlist" },
{ t: "Вечер пятницы", h1: 290, h2: 330, go: "playlist" }, { t: "Бег 170 bpm", h1: 120, h2: 60, go: "playlist" }
];
const trow = (tr, i, opts = {}) => `<div class="trow${opts.noCover ? " no-cover" : ""}${opts.grip ? " with-grip" : ""}" role="button" tabindex="0" data-track="${i}" data-list="${opts.list}">
${opts.grip ? `<span class="grip" aria-hidden="true"><i data-lucide="grip-vertical"></i></span>` : ""}
<span class="idx num">${i + 1}</span>
<span class="t"><span class="cover" style="--h1:${tr.h1};--h2:${tr.h2}"></span><div><b>${tr.t}</b><small>${tr.a}</small></div></span>
<span class="alb">${tr.al}</span>
<button class="icon-btn${opts.liked ? " liked" : ""}" data-like aria-pressed="${!!opts.liked}" aria-label="Like"><i data-lucide="heart"></i></button>
<span class="dur num">${tr.d}</span>
<button class="icon-btn more" aria-label="More actions"><i data-lucide="ellipsis"></i></button></div>`;
const head = (grip) => `<div class="trow head${grip ? " with-grip" : ""}">${grip ? "<span></span>" : ""}<span class="idx">#</span><span>Title</span><span class="alb">Album</span><span></span><span class="dur"><i data-lucide="clock-3"></i></span><span></span></div>`;
const lists = { album, liked, artist: zTracks, search: zTracks.slice(0, 4), playlist: [liked[2], liked[5], album[1], zTracks[4], liked[3], liked[6], album[3], liked[4]] };
$("#album-tracks").innerHTML = head() + album.map((t, i) => trow(t, i, { noCover: true, list: "album", liked: i === 4 })).join("");
$("#liked").innerHTML = head() + liked.map((t, i) => trow(t, i, { list: "liked", liked: true })).join("");
$("#artist-tracks").innerHTML = zTracks.map((t, i) => trow(t, i, { list: "artist", liked: i === 0 })).join("");
$("#search-tracks").innerHTML = lists.search.map((t, i) => trow(t, i, { list: "search", liked: i === 0 })).join("");
$("#playlist-tracks").innerHTML = head(true) + lists.playlist.map((t, i) => trow(t, i, { list: "playlist", grip: true })).join("");
$("#made-for-you").innerHTML = madeForYou.map(card).join("");
$("#albums-like").innerHTML = albumsLike.map(card).join("");
$("#search-albums").innerHTML = [
{ t: "Прости меня моя любовь", s: "2000", h1: 200, h2: 250 }, { t: "Земфира", s: "1999", h1: 330, h2: 280 },
{ t: "Вендетта", s: "2005", h1: 0, h2: 220 }, { t: "Жить в твоей голове", s: "2013", h1: 160, h2: 220 }, { t: "Бордерлайн", s: "2021", h1: 260, h2: 20 }
].map(card).join("");
$("#artist-albums").innerHTML = $("#search-albums").innerHTML;
$("#more-by").innerHTML = [
{ t: "Звезда по имени Солнце", s: "1989", h1: 40, h2: 10 }, { t: "Последний герой", s: "1989", h1: 220, h2: 260 },
{ t: "Ночь", s: "1986", h1: 250, h2: 300 }, { t: "Чёрный альбом", s: "1990", h1: 0, h2: 0 }
].map(card).join("");
$("#similar").innerHTML = [
{ t: "Сплин", s: "Artist", h1: 25, h2: 300, round: true, go: "artist" }, { t: "Мумий Тролль", s: "Artist", h1: 185, h2: 210, round: true, go: "artist" },
{ t: "Би-2", s: "Artist", h1: 280, h2: 30, round: true, go: "artist" }, { t: "Монеточка", s: "Artist", h1: 300, h2: 170, round: true, go: "artist" }
].map(card).join("");
$("#stations").innerHTML = [
{ t: "Rock", s: "Genre station", h1: 10, h2: 340, go: "wave" }, { t: "Indie", s: "Genre station", h1: 170, h2: 120, go: "wave" },
{ t: "For running", s: "Activity station", h1: 100, h2: 50, go: "wave" }, { t: "Focus", s: "Activity station", h1: 220, h2: 250, go: "wave" },
{ t: "1990s", s: "Era station", h1: 300, h2: 20, go: "wave" }
].map(card).join("");
$("#chart").innerHTML = chart.map(([t, a, d, h1, h2], i) => `<button class="chart-row" data-go="album"><span class="rank num">${i + 1}</span>
<span class="delta ${d}" aria-label="${d === "up" ? "Up" : d === "down" ? "Down" : "No change"}">${d === "up" ? "▲" : d === "down" ? "▼" : "–"}</span>
<span class="cover" style="--h1:${h1};--h2:${h2}"></span><span style="min-width:0"><b>${t}</b><small>${a}</small></span><span class="num sub">${liked.find(x => x.t === t)?.d || "3:45"}</span></button>`).join("");
$("#side-playlists").innerHTML = playlists.map(p => `<button data-go="${p.go}"><span class="cover" style="--h1:${p.h1};--h2:${p.h2}"></span><span>${p.t}</span></button>`).join("");
$("#episodes").innerHTML = [
{ t: "Как устроен звук винила", a: "Подкаст «Звукорежиссура» · 38 min left", al: "", d: "52:10", h1: 50, h2: 200 },
{ t: "Глава 7", a: "Мастер и Маргарита · audiobook", al: "", d: "41:32", h1: 0, h2: 270 }
].map((t, i) => trow(t, i, { list: "episodes" })).join("");
$("#pods").innerHTML = [
{ t: "Звукорежиссура", s: "Podcast · weekly", h1: 50, h2: 200 }, { t: "Мастер и Маргарита", s: "Audiobook · 17 h", h1: 0, h2: 270 },
{ t: "Почему это смешно", s: "Podcast", h1: 140, h2: 40 }
].map(card).join("");
// ---- Navigation ----
const screens = [["signin", "Sign in"], ["home", "Home"], ["wave", "My Wave"], ["search", "Search"], ["collection", "Collection"], ["album", "Album"], ["artist", "Artist"], ["playlist", "Playlist"], ["podcasts", "Podcasts"]];
$("#screen-chips").innerHTML = screens.map(([k, l]) => `<button class="chip" data-go="${k}" aria-pressed="false">${l}</button>`).join("");
const history = [];
let current = "home";
function go(name, push = true) {
const win = $("#win");
if (push && name !== current) history.push(current);
current = name;
const signedOut = name === "signin";
win.classList.toggle("signed-out", signedOut);
$(".signin").hidden = !signedOut;
$$(".screen").forEach(s => s.hidden = s.dataset.screen !== name);
$$(".nav button").forEach(b => b.dataset.go === name ? b.setAttribute("aria-current", "page") : b.removeAttribute("aria-current"));
$$("#screen-chips .chip").forEach(c => c.setAttribute("aria-pressed", String(c.dataset.go === name)));
$("#content").scrollTop = 0;
if (signedOut) drawQR();
try { localStorage.setItem("musyx-mock-screen", name); } catch (e) {}
}
document.addEventListener("click", (e) => {
const g = e.target.closest("[data-go]");
if (g && !e.target.closest("[data-like]")) { go(g.dataset.go); }
});
$("#back").addEventListener("click", () => { if (history.length) go(history.pop(), false); });
$("#q").addEventListener("keydown", (e) => { if (e.key === "Enter") go("search"); });
// Tabs & segmented controls
$$("[data-tabs]").forEach(t => t.addEventListener("click", (e) => {
const b = e.target.closest("button"); if (!b) return;
$$("button", t).forEach(x => x.setAttribute("aria-selected", String(x === b)));
}));
$$("[data-seg]").forEach(s => s.addEventListener("click", (e) => {
const b = e.target.closest("button"); if (!b) return;
$$("button", s).forEach(x => x.setAttribute("aria-pressed", String(x === b)));
}));
// Likes
document.addEventListener("click", (e) => {
const l = e.target.closest("[data-like]"); if (!l) return;
e.stopPropagation();
const on = l.getAttribute("aria-pressed") !== "true";
l.setAttribute("aria-pressed", String(on)); l.classList.toggle("liked", on);
}, true);
// ---- Player ----
let queue = album, qi = 4, playing = true, pos = 72, dur = 225;
const secs = (d) => { const [m, s] = d.split(":").map(Number); return m * 60 + s; };
const fmt = (s) => `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
function renderPlayer() {
const tr = queue[qi];
$("#p-title").textContent = tr.t; $("#p-artist").textContent = tr.a;
$("#p-cover").style.cssText = `--h1:${tr.h1};--h2:${tr.h2}`;
$("#t-dur").textContent = tr.d; dur = secs(tr.d);
$("#t-cur").textContent = fmt(pos); $("#t-fill").style.width = (pos / dur * 100) + "%";
$("#pp").innerHTML = `<i data-lucide="${playing ? "pause" : "play"}"></i>`;
$("#pp").setAttribute("aria-label", playing ? "Pause" : "Play");
$$(".trow.playing").forEach(r => { r.classList.remove("playing"); const ix = r.querySelector(".idx"); ix.textContent = +r.dataset.track + 1; });
$$(`.trow[data-list="${queue.name}"][data-track="${qi}"]`).forEach(r => {
r.classList.add("playing"); r.classList.toggle("paused", !playing);
r.querySelector(".idx").innerHTML = `<span class="eq" aria-label="Playing"><i></i><i></i><i></i></span>`;
});
const q = (t, i, now) => `<button class="qrow${now ? " now" : ""}" data-q="${i}"><span class="cover" style="--h1:${t.h1};--h2:${t.h2}"></span><span style="min-width:0"><b>${t.t}</b><small>${t.a}</small></span><span class="num sub">${t.d}</span></button>`;
$("#q-now").innerHTML = q(tr, qi, true);
$("#q-next").innerHTML = queue.slice(qi + 1).map((t, i) => q(t, qi + 1 + i)).join("") || `<p class="sub" style="padding:0 8px">Nothing queued. My Wave continues after this track.</p>`;
const n = 16, cur = Math.min(n - 1, Math.floor(pos / dur * n));
$("#lyrics").innerHTML = `<p class="note">Synced lyrics from Yandex Music appear here. The current line follows playback, and clicking a line seeks to it.</p>` +
Array.from({ length: n }, (_, i) => `<span class="line${i < cur ? " past" : i === cur ? " current" : ""}" style="width:${55 + ((i * 37) % 40)}%"></span>`).join("");
icons();
}
album.name = "album"; liked.name = "liked"; zTracks.name = "artist"; lists.search.name = "search"; lists.playlist.name = "playlist";
function play(list, i) { queue = list; qi = i; pos = 0; playing = true; renderPlayer(); }
document.addEventListener("click", (e) => {
if (e.target.closest("[data-like], .more")) return;
const r = e.target.closest(".trow[data-track]");
if (r && lists[r.dataset.list]) play(lists[r.dataset.list], +r.dataset.track);
const pf = e.target.closest("[data-play-first]");
if (pf) { const l = { album, liked, artist: zTracks, playlist: lists.playlist }[pf.dataset.playFirst]; play(l, 0); }
const pw = e.target.closest("[data-play-wave]");
if (pw) play(liked, Math.floor(Math.random() * liked.length));
const qb = e.target.closest("[data-q]");
if (qb) { qi = +qb.dataset.q; pos = 0; renderPlayer(); }
});
$("#pp").addEventListener("click", () => { playing = !playing; renderPlayer(); });
$("#next").addEventListener("click", () => { qi = (qi + 1) % queue.length; pos = 0; renderPlayer(); });
$("#prev").addEventListener("click", () => { if (pos > 3) pos = 0; else qi = (qi - 1 + queue.length) % queue.length, pos = 0; renderPlayer(); });
["#shuffle", "#repeat"].forEach(id => $(id).addEventListener("click", (e) => { const b = e.currentTarget; b.setAttribute("aria-pressed", String(b.getAttribute("aria-pressed") !== "true")); }));
$("#seek").addEventListener("click", (e) => { const r = e.currentTarget.getBoundingClientRect(); pos = (e.clientX - r.left) / r.width * dur; renderPlayer(); });
$("#vol").addEventListener("click", (e) => { const r = e.currentTarget.getBoundingClientRect(); e.currentTarget.firstElementChild.style.width = ((e.clientX - r.left) / r.width * 100) + "%"; });
setInterval(() => { if (!playing || current === "signin") return; pos += 1; if (pos >= dur) { qi = (qi + 1) % queue.length; pos = 0; } renderPlayer(); }, 1000);
// Drawer
function openDrawer(panel) {
const d = $("#drawer");
const same = !d.hidden && $(`#drawer-tabs [data-panel="${panel}"]`).getAttribute("aria-selected") === "true";
d.hidden = same;
$$("#drawer-tabs button").forEach(b => b.setAttribute("aria-selected", String(b.dataset.panel === panel)));
$$("[data-panel-body]").forEach(b => b.hidden = b.dataset.panelBody !== panel);
$$("[data-drawer]").forEach(b => b.setAttribute("aria-pressed", String(!d.hidden && b.dataset.drawer === panel)));
}
$$("[data-drawer]").forEach(b => b.addEventListener("click", () => openDrawer(b.dataset.drawer)));
$("#drawer-tabs").addEventListener("click", (e) => { const b = e.target.closest("button"); if (b) { $("#drawer").hidden = true; openDrawer(b.dataset.panel); } });
$("#drawer-close").addEventListener("click", () => { $("#drawer").hidden = true; $$("[data-drawer]").forEach(b => b.setAttribute("aria-pressed", "false")); });
// ---- Sign-in bits ----
$("#copy-code").addEventListener("click", () => {
const btn = $("#copy-code");
const done = () => { btn.lastChild.textContent = "Copied"; setTimeout(() => btn.lastChild.textContent = "Copy code", 1600); };
try { navigator.clipboard.writeText($("#dev-code").textContent).then(done, () => { getSelection().selectAllChildren($("#dev-code")); }); }
catch (e) { getSelection().selectAllChildren($("#dev-code")); }
});
$("#token-btn").addEventListener("click", () => go("home"));
let left = 292;
setInterval(() => { if (current !== "signin") return; left = left > 0 ? left - 1 : 300; $("#expires").textContent = fmt(left); }, 1000);
function drawQR() {
// Decorative stand-in for the real QR the app renders from verification_url.
const c = $("#qr"), x = c.getContext("2d"), n = 29;
x.fillStyle = "#fff"; x.fillRect(0, 0, n, n); x.fillStyle = "#1C1A22";
let s = 7;
const rnd = () => (s = (s * 16807) % 2147483647) / 2147483647;
for (let i = 0; i < n; i++) for (let j = 0; j < n; j++) if (rnd() > .52) x.fillRect(i, j, 1, 1);
[[0, 0], [n - 7, 0], [0, n - 7]].forEach(([a, b]) => {
x.fillStyle = "#fff"; x.fillRect(a - (a ? 1 : 0), b - (b ? 1 : 0), 8, 8);
x.fillStyle = "#1C1A22"; x.fillRect(a, b, 7, 7); x.fillStyle = "#fff"; x.fillRect(a + 1, b + 1, 5, 5); x.fillStyle = "#1C1A22"; x.fillRect(a + 2, b + 2, 3, 3);
});
}
// ---- Wave canvases ----
const reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
const accent = () => getComputedStyle(document.documentElement).getPropertyValue("--accent").trim() || "#F0B23E";
function drawWave(cv, t) {
const r = cv.getBoundingClientRect(); if (!r.width) return;
const dpr = devicePixelRatio || 1;
if (cv.width !== Math.round(r.width * dpr)) { cv.width = Math.round(r.width * dpr); cv.height = Math.round(r.height * dpr); }
const x = cv.getContext("2d"), w = cv.width, h = cv.height;
x.clearRect(0, 0, w, h);
const col = accent();
const amp = playing ? 1 : .45;
for (let k = 0; k < 14; k++) {
x.beginPath();
const base = h * (.22 + k * .028), a = h * (.05 + k * .006) * amp, f = 1.6 + k * .09, ph = t * (.35 + k * .02) + k * .5;
for (let px = 0; px <= w; px += 6 * dpr) {
const u = px / w;
const y = base + Math.sin(u * Math.PI * f + ph) * a + Math.sin(u * Math.PI * 4.2 - ph * .7) * a * .35;
px ? x.lineTo(px, y) : x.moveTo(px, y);
}
x.strokeStyle = col; x.globalAlpha = .08 + (k / 14) * .55; x.lineWidth = (1 + k * .08) * dpr; x.stroke();
}
x.globalAlpha = 1;
}
function frame(ts) {
const t = reduce ? 1.2 : ts / 1000;
$$("[data-wave]").forEach(cv => { if (!cv.closest("[hidden]")) drawWave(cv, t); });
if (current === "signin") drawWave($("#signin-wave"), t * .6);
if (!reduce) requestAnimationFrame(frame);
}
// Boot
let start = "home";
try { const s = localStorage.getItem("musyx-mock-screen"); if (s && screens.some(x => x[0] === s)) start = s; } catch (e) {}
go(start, false);
renderPlayer();
requestAnimationFrame(frame);
if (reduce) { addEventListener("click", () => requestAnimationFrame(frame)); }
})();
</script>