Compare commits

...
Author SHA1 Message Date
rootandClaude Opus 5.5 cd5a083523 iOS: Now Playing close drag tracks the finger 1:1 (global space) and only re-renders the offset (DropState/DropOffset); build 58
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:59:04 -08:00
rootandClaude Opus 5.5 6606e4d437 iOS: folded, drag down on the album art closes Now Playing (art panel only, not over stem dials); build 57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:55:28 -08:00
rootandClaude Opus 5.5 d6ba09f14b iOS: folded resume slides Now Playing up (animated) instead of presenting it in the background; build 56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:50:18 -08:00
rootandClaude Opus 5.5 5959c8a347 iOS: folded Duo opens Now Playing (no animation) when leaving while playing, so it returns on it; build 55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:41:37 -08:00
rootandClaude Opus 5.5 1604a6b3e3 iOS: Duo orientation strict (folded portrait, unfolded landscape, never free), lock changes only after hinge reading holds 450 ms, orient log; build 54
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:38:58 -08:00
rootandClaude Opus 5.5 7dddc25656 iOS: folded Duo keeps portrait lock in background (no landscape flash on reopen while playing); build 53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:33:39 -08:00
rootandClaude Opus 5.5 452ed6f362 Web: bigger drawer tab titles, equal-width tabs, one drawer width
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 18:25:59 -08:00
rootandClaude Opus 5.5 536de29e4d Web: keep real playlist art in downloads, hide quota on HTTPS
The group art fetch now falls back to the raw composite when the Plex
transcode fails, and the Downloads card uses any stored group art.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 17:32:38 -08:00
rootandClaude Opus 5.5 0ef4c650d1 Web: Plex playlist editing, offline art, glass search, NO STEMS tag, artist header fix
- Edit/Rename/Delete on Plex playlists, drag-to-reorder edit mode with the iOS
  remove-then-move-after commit, Remove from playlist, Add to Plex playlists
- Downloads store art blobs with each song and group so it shows offline
- Search box gets a tinted glass blur
- NO STEMS tag restyled and aligned in rows and cards
- Albums header on the artist page no longer overlaps the play button

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 17:29:03 -08:00
rootandClaude Opus 5.5 3ecfdaa73b web: iOS-style Downloads sections, accent fill on the volume slider
Downloads now groups into Playlists, Albums and Artists card grids plus
Other Songs, with Play/Shuffle up top and a right-click menu per card
(play, queue, remove download). The volume track fills with the accent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 17:11:41 -08:00
rootandClaude Opus 5.5 d30479c6f7 web: S opens universal search, sort menu, iOS-style appearance, centered play icon
- Sidebar search box replaced by a blurred overlay (S or /, Shift+S shuffles): songs,
  artists, albums, Plex and stem playlists across every enabled server, arrow keys + Enter
- Sort select + flip chip replaced by one button with a checked menu (fields, directions)
- Themes are now Black/Dark/White with the iOS accent colors; old presets migrate
- Play triangle recentered, per-button nudges removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 17:03:51 -08:00
root 11dffdf9e6 iOS source.json for ios-v0.10.1 2026-11-20 12:25:59 -08:00
rootandClaude Opus 5.5 a8742e7e3d Folded art-left: art's left edge matches the controls' padding
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 12:25:54 -08:00
root ce6bce4018 iOS source.json for ios-v0.10.1 2026-11-20 12:19:26 -08:00
rootandClaude Opus 5.5 4860db6f6c Duo wide Now Playing: art matches the controls' height
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 12:19:12 -08:00
root 4c1956d569 iOS source.json for ios-v0.10.1 2026-11-20 10:42:45 -08:00
rootandClaude Opus 5.5 ed0fd1d184 iOS: bigger art in wide panes, Duo Split View player sits lower; build 50
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:39:40 -08:00
root 55f8574eaa iOS source.json for ios-v0.10.1 2026-11-20 10:33:03 -08:00
rootandClaude Opus 5.5 07b5636bac iOS: full-screen Now Playing watches the hinge so unfolding goes landscape; build 49
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:30:00 -08:00
root 88d3aa48e7 iOS source.json for ios-v0.10.1 2026-11-20 10:23:12 -08:00
rootandClaude Opus 5.5 d6da47db9d iOS: only the on-screen Duo pane reports split/unfolded; build 48
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:20:09 -08:00
root 4dfcfbf434 iOS source.json for ios-v0.10.1 2026-11-20 10:17:11 -08:00
rootandClaude Opus 5.5 56c92e8b93 iOS: free orientation in background, re-lock after resume settles
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:14:59 -08:00
root 639b5368ff iOS source.json for ios-v0.10.1 2026-11-20 10:10:17 -08:00
rootandClaude Opus 5.5 cfaedd06cf iOS 0.10.1 (build 47)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:08:08 -08:00
rootandClaude Opus 5.5 8f3a10df2f iOS: more room between art and title on the folded screen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:00:51 -08:00
rootandClaude Opus 5.5 5868430f8a iOS: unfolded upright never splits, always turns to landscape; orientation request re-checked until it takes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 09:58:48 -08:00
rootandClaude Opus 5.5 566c5f7e8f iOS: folded Now Playing runs into the bottom strip, orientation lock re-asserts on resume
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 09:50:23 -08:00
rootandClaude Opus 5.5 e833af2704 iOS: vocals controls only when playing stems with a vocals stem
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 09:31:10 -08:00
rootandClaude Opus 5.5 c9fa90a840 iOS: hide vocals controls without stems, paint Duo hinge gap, playlist bar per drawing, drop Album Color Background, Colour to Color
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 09:20:18 -08:00
rootandClaude Opus 5.5 0516362461 iOS: Use Stem Server switch for Plex-only playback, build 42
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 08:59:13 -08:00
rootandClaude Opus 5.5 7843ff562b iOS build 41
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 07:23:02 -08:00
rootandClaude Opus 5.5 9e0d7236c2 iOS: seek bar uses the album art accent when Match Album Art is on
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 07:22:42 -08:00
rootandClaude Opus 5.5 8e57b9d0cd Album art theme on web and iOS, roomier player bar
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:39:05 -08:00
rootandClaude Opus 5.5 0c9cae5b11 Web: cleaner grouped settings page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:29:23 -08:00
root a79c134838 iOS source.json for ios-v0.10.0 2026-11-19 22:26:40 -08:00
33 changed files with 981 additions and 363 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ A Plex music player for the OnePlus 15 that plays the stems stemd separates on y
unraid server: per-stem faders, mute/solo, karaoke-style presets, a master volume drawn
over a Plexamp-style waveform seek bar, a 10-band graphic EQ plus Equalizer APO-style
parametric filters with per-device profiles, and an
iOS look in Black, Dark or White (flat colours, no gradients).
iOS look in Black, Dark or White (flat colors, no gradients).
## Install
@@ -48,7 +48,7 @@ import java.io.IOException
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.atomic.AtomicBoolean
/** Display order and colours for stems, matching the desktop app. */
/** Display order and colors for stems, matching the desktop app. */
object Stems {
val ORDER = listOf("vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix")
private val COLORS = mapOf(
@@ -276,7 +276,7 @@ fun Cell(
}
}
/** Settings.app-style coloured rounded-square icon. */
/** Settings.app-style colored rounded-square icon. */
@Composable
fun SettingsIcon(vector: ImageVector, bg: Color) {
Box(Modifier.size(30.dp).clip(RoundedCornerShape(7.dp)).background(bg), contentAlignment = Alignment.Center) {
@@ -113,7 +113,7 @@ private fun newFilter(type: FilterType) = EqFilter(EqController.newFilterId(), t
/**
* The EQ's response, log frequency across, dB up. Left and right are drawn separately when
* some filter applies to only one of them (right in orange). [nodes] are drawn as numbered
* handles; [highlight] gets its own curve in the accent colour.
* handles; [highlight] gets its own curve in the accent color.
*/
@Composable
fun EqCurve(
@@ -102,8 +102,8 @@ import kotlin.math.min
enum class NpPanel { Art, Mixer, Queue }
/**
* A solid colour from the album art, pushed dark (or light for the White theme) so text
* stays readable. One flat colour: no gradients.
* A solid color from the album art, pushed dark (or light for the White theme) so text
* stays readable. One flat color: no gradients.
*/
@Composable
private fun albumColor(thumb: String?, enabled: Boolean, dark: Boolean): Color? {
@@ -400,8 +400,8 @@ fun AppearanceScreen() {
}
}
})
section("np", header = "Now Playing", footer = "Paints the Now Playing screen in one solid colour taken from the album art.", rows = listOf {
Cell("Album Colour Background", trailing = { IosSwitch(albumColor, { s.albumColorNowPlaying.value = it }) })
section("np", header = "Now Playing", footer = "Paints the Now Playing screen in one solid color taken from the album art.", rows = listOf {
Cell("Album Color Background", trailing = { IosSwitch(albumColor, { s.albumColorNowPlaying.value = it }) })
})
}
}
@@ -24,7 +24,7 @@ import com.stemify.mobile.core.Accent
import com.stemify.mobile.core.ThemeMode
import kotlin.math.exp
/** iOS semantic colours, flattened to solid values for each scheme. */
/** iOS semantic colors, flattened to solid values for each scheme. */
@Immutable
data class Palette(
val dark: Boolean,
@@ -130,7 +130,7 @@ fun IosTheme(mode: ThemeMode, accent: Accent, content: @Composable () -> Unit) {
CompositionLocalProvider(LocalPalette provides p, content = content)
}
/** BasicText with iOS defaults: label colour, single line, tail ellipsis. */
/** BasicText with iOS defaults: label color, single line, tail ellipsis. */
@Composable
fun Txt(
text: String,
+2 -2
View File
@@ -1,6 +1,6 @@
"""Office-style ribbon icons: flat, two-tone, drawn from SVG at whatever size QML asks for.
image://icon/<name>[/<hex colour>] — the colour overrides the dark-gray ink (for white-on-green chrome).
image://icon/<name>[/<hex color>] — the color overrides the dark-gray ink (for white-on-green chrome).
"""
from PySide6.QtCore import QByteArray, QRectF, Qt
@@ -15,7 +15,7 @@ RED = "#D13438"
ORANGE = "#E8912D"
LIGHT = "#FFFFFF"
# Each icon is SVG body markup on a 32×32 grid; {ink} is the main colour.
# Each icon is SVG body markup on a 32×32 grid; {ink} is the main color.
ICONS = {
"play": f'<path fill="{GREEN}" d="M9 5v22l18-11z"/>',
"pause": '<path fill="{ink}" d="M8 5h6v22H8zM18 5h6v22h-6z"/>',
+1 -1
View File
@@ -7,7 +7,7 @@ import urllib.error
import urllib.parse
import urllib.request
# Display order and colours, matching the desktop separator and the phone.
# Display order and colors, matching the desktop separator and the phone.
ORDER = ["vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix"]
COLORS = {
"vocals": "#FF7AB6", "drums": "#FFB547", "bass": "#7C8CFF", "other": "#4CD07D",
+1 -1
View File
@@ -93,7 +93,7 @@ class IconProvider(QQuickImageProvider):
BG = _hex("1D1E21")
GLASS_TINT = _hex("242529")
# (color, cx, cy, sigma as fraction of the larger side, strength)
# Kept faint so the window reads as neutral dark gray with a hint of Aero colour.
# Kept faint so the window reads as neutral dark gray with a hint of Aero color.
BLOBS = [
(_hex("3BA8FF"), 0.10, 0.05, 0.30, 0.14),
(_hex("7C8CFF"), 0.62, 0.18, 0.22, 0.06),
+15 -5
View File
@@ -35,12 +35,22 @@ enum Orientation {
nonisolated(unsafe) static var mask: UIInterfaceOrientationMask = .allButUpsideDown
/// Folded Duo: portrait only. Unfolded Duo: landscape only. Anything else turns freely.
@MainActor static func lock(_ m: UIInterfaceOrientationMask) {
guard m != mask else { return }
/// Also re-checks the window when the mask is unchanged: a request made while the app was
/// in the background can be refused, which left the folded screen stuck sideways on return.
@MainActor static func lock(_ m: UIInterfaceOrientationMask, retry: Int = 6) {
let changed = m != mask
mask = m
for case let scene as UIWindowScene in UIApplication.shared.connectedScenes {
scene.keyWindow?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations()
if m != .allButUpsideDown { scene.requestGeometryUpdate(.iOS(interfaceOrientations: m)) { _ in } }
for case let scene as UIWindowScene in UIApplication.shared.connectedScenes where scene.session.role == .windowApplication {
if changed { scene.keyWindow?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations() }
let now = UIInterfaceOrientationMask(rawValue: 1 << scene.effectiveGeometry.interfaceOrientation.rawValue)
guard m != .allButUpsideDown, !m.contains(now) else { continue }
scene.requestGeometryUpdate(.iOS(interfaceOrientations: m)) { _ in }
// The request can be dropped silently (mid-unfold, just back from the background), so check it took.
guard retry > 0 else { continue }
Task { @MainActor in
try? await Task.sleep(for: .milliseconds(500))
if mask == m { lock(m, retry: retry - 1) }
}
}
}
}
+1 -1
View File
@@ -50,7 +50,7 @@ final class HomeReach: @unchecked Sendable {
let (at, last) = stamp.with { (checkedAt, _last) }
if at != 0 && now - at < Self.ttl { return last }
let urls = settings.servers.map { $0.base + ($0.kind == .plex ? "/identity" : "/System/Info/Public") }
+ [settings.stemUrl.trimmingCharacters(in: CharacterSet(charactersIn: "/")) + "/api/info"]
+ (settings.stemServerOff ? [] : [settings.stemUrl.trimmingCharacters(in: CharacterSet(charactersIn: "/")) + "/api/info"])
let ok = await withTaskGroup(of: Bool.self) { g in
for u in urls { g.addTask { await self.answers(u) } }
for await r in g where r { g.cancelAll(); return true }
+5 -2
View File
@@ -107,7 +107,7 @@ final class Settings: @unchecked Sendable {
private static let keys = [
"servers", "plexUrl", "plexToken", "plexUser", "plexMachineId", "musicSection", "musicSectionTitle",
"stemUrl", "stemToken", "plexAccountToken", "stemRoots", "theme", "accent", "albumColorNowPlaying", "highRefreshRate",
"stemUrl", "stemToken", "stemServerOff", "plexAccountToken", "stemRoots", "theme", "accent", "albumTheme", "highRefreshRate",
"stemQuality", "cacheLimitGb", "downloadsWifiOnly", "downloadSort", "keepStemMix", "masterVolume", "tabLayout",
"karaokeVocals", "karaokeSoftDb", "playbackSpeed", "stemsOnly", "noStems", "precacheCount", "hiddenNowPlaying", "presets", "presetOrder", "hiddenPresets", "lockedPreset", "webStations", "lockScreenMix", "swipeUpQueue", "acapella", "crossfadeSec", "sweetFades", "foldedArtLeft",
]
@@ -205,6 +205,8 @@ final class Settings: @unchecked Sendable {
/// The id a new server gets: empty (bare keys) when no server holds it yet.
func nextServerId() -> String { servers.contains { $0.id.isEmpty } ? MediaServer.newId() : "" }
/// Plex only: no stem index, no stemserve traffic.
var stemServerOff: Bool { get { read(\.stemServerOff, "stemServerOff", false) } set { write(\.stemServerOff, "stemServerOff", newValue, false) } }
var stemUrl: String { get { read(\.stemUrl, "stemUrl", "http://192.168.86.2:8765") } set { write(\.stemUrl, "stemUrl", newValue, "http://192.168.86.2:8765") } }
var stemToken: String { get { read(\.stemToken, "stemToken", "") } set { write(\.stemToken, "stemToken", newValue, "") } }
var plexAccountToken: String { get { read(\.plexAccountToken, "plexAccountToken", "") } set { write(\.plexAccountToken, "plexAccountToken", newValue, "") } }
@@ -219,7 +221,8 @@ final class Settings: @unchecked Sendable {
/// Swipe up on Now Playing opens Playing Next.
var swipeUpQueue: Bool { get { read(\.swipeUpQueue, "swipeUpQueue", true) } set { write(\.swipeUpQueue, "swipeUpQueue", newValue, true) } }
var lockScreenMix: Bool { get { read(\.lockScreenMix, "lockScreenMix", false) } set { write(\.lockScreenMix, "lockScreenMix", newValue, false) } }
var albumColorNowPlaying: Bool { get { read(\.albumColorNowPlaying, "albumColorNowPlaying", false) } set { write(\.albumColorNowPlaying, "albumColorNowPlaying", newValue, false) } }
/// The whole app takes its accent and surface tint from the playing track's art.
var albumTheme: Bool { get { read(\.albumTheme, "albumTheme", false) } set { write(\.albumTheme, "albumTheme", newValue, false) } }
/// Folded iPhone Duo: Now Playing's art sits at the left instead of centred.
var foldedArtLeft: Bool { get { read(\.foldedArtLeft, "foldedArtLeft", false) } set { write(\.foldedArtLeft, "foldedArtLeft", newValue, false) } }
var highRefreshRate: Bool { get { read(\.highRefreshRate, "highRefreshRate", true) } set { write(\.highRefreshRate, "highRefreshRate", newValue, true) } }
+1 -1
View File
@@ -1,7 +1,7 @@
import AVFoundation
import Foundation
/// Display order and colours for stems, matching the desktop app.
/// Display order and colors for stems, matching the desktop app.
enum Stems {
static let order = ["vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix"]
private static let colors: [String: UInt32] = [
+15 -2
View File
@@ -5,6 +5,7 @@ enum StemServerStatus: Equatable {
case unknown
case online(tracks: Int, transcode: Bool)
case offline(reason: String, cachedTracks: Int)
case off
var isOnline: Bool { if case .online = self { true } else { false } }
}
@@ -65,7 +66,8 @@ final class StemServer: @unchecked Sendable {
self.settings = settings
indexFile = dir.appendingPathComponent("stem_index.json")
etagFile = dir.appendingPathComponent("stem_index.etag")
if let data = try? Data(contentsOf: indexFile),
if settings.stemServerOff { status = .off }
else if let data = try? Data(contentsOf: indexFile),
let parsed = try? JSONDecoder().decode(StemIndexFile.self, from: data) {
index = StemIndex(parsed.tracks, roots: roots())
}
@@ -111,7 +113,7 @@ final class StemServer: @unchecked Sendable {
/// Reads /api/queue. A change in the finished count pulls the new index straight away.
func pollQueue() async {
guard !base.isEmpty,
guard !settings.stemServerOff, !base.isEmpty,
let u = try? url("/api/queue"),
let data = try? await http.data(req(u)),
let q = try? JSONDecoder().decode(QueueInfo.self, from: data) else { return }
@@ -146,6 +148,16 @@ final class StemServer: @unchecked Sendable {
func refresh(force: Bool = false) async {
await refreshLock.run {
if settings.stemServerOff {
await MainActor.run {
let had = self.index.size > 0
self.index = StemIndex([])
self.current = nil; self.pending = []; self.failed = []
self.status = .off
if had { self.indexListeners.forEach { $0() } }
}
return
}
do {
let info = try JSONDecoder().decode(ServerInfo.self, from: try await http.data(req(try url("/api/info"))))
transcode = info.ffmpeg
@@ -185,6 +197,7 @@ final class StemServer: @unchecked Sendable {
}
func find(_ track: Track) -> StemEntry? {
if settings.stemServerOff { return nil }
let idx = index
if let k = track.stemKey { return idx.entries.first { $0.key == k } }
let hit = idx.find(track.partFile, durationMs: track.durationMs)
+1 -1
View File
@@ -60,7 +60,7 @@ struct Artwork: View {
}
}
/// A settings icon: the glyph in its colour on a faint wash of the same colour.
/// A settings icon: the glyph in its color on a faint wash of the same color.
struct SettingsIcon: View {
let symbol: String
let bg: UInt32
+51 -8
View File
@@ -67,6 +67,8 @@ final class Ui {
}
/// True while an unfolded iPhone Duo shows Now Playing docked beside the library.
private(set) var split = false
/// Unfolded Duo in any orientation (a hinge is showing), even before it has turned to landscape.
private(set) var unfolded = false
/// Split only: the Now Playing tab (the deck) is selected instead of `tab`.
var deck = true
/// Split only: which of the deck's pages is showing.
@@ -123,7 +125,8 @@ final class Ui {
/// This phone has shown the Duo's folded status column at least once (saved).
private var duo = UserDefaults.standard.bool(forKey: "duoSeen")
/// Folded iPhone Duo: the outer display, kept upright.
var folded: Bool { duo && !split }
var folded: Bool { duo && !split && !unfolded }
var isDuo: Bool { duo }
/// Called with the window's side insets. Upright, only the folded Duo has a trailing one.
func sawInsets(trailing: CGFloat, upright: Bool) {
@@ -134,20 +137,60 @@ final class Ui {
lockOrientation()
}
/// Split (unfolded) goes landscape at once. Portrait waits a moment and checks again, so a
/// frame without a hinge reading mid-rotation can't throw an unfolded phone back upright.
private func lockOrientation() {
if split { Orientation.lock(.landscape); return }
guard folded else { Orientation.lock(.allButUpsideDown); return }
/// The Duo is never free to turn: folded is portrait only, unfolded is landscape only.
/// Hinge readings flicker while the window settles (coming back from the background, mid
/// fold), so the lock only changes once a reading has held for a moment. Other iPhones turn freely.
private var lockGen = 0
func resumed() {
lockOrientation()
if away { showPlayingFolded() }
away = false
}
/// Leaves the lock as it is: freeing it let iOS turn the window while audio kept the app alive.
func backgrounded() { away = true }
private var away = false
/// Folded with something playing, the app comes back on Now Playing.
private func showPlayingFolded() {
guard folded, !nowPlayingOpen, AppGraph.shared.playback.current != nil else { return }
// Back from the background folded with something playing: Now Playing slides up as if
// swiped open, once the app's own opening animation has landed.
Task { @MainActor in
try? await Task.sleep(for: .milliseconds(400))
if self.folded { Orientation.lock(.portrait) }
try? await Task.sleep(for: .milliseconds(180))
guard self.folded, !self.nowPlayingOpen, AppGraph.shared.playback.current != nil else { return }
self.nowPlayingOpen = true
}
}
private func lockOrientation() {
guard duo || split || unfolded else { Orientation.lock(.allButUpsideDown); return }
let want: UIInterfaceOrientationMask = (split || unfolded) ? .landscape : .portrait
lockGen += 1
let gen = lockGen
Task { @MainActor in
try? await Task.sleep(for: .milliseconds(450))
guard gen == self.lockGen else { return }
let now: UIInterfaceOrientationMask = (self.split || self.unfolded) ? .landscape : .portrait
guard now == want else { return }
Log.shared.info("orient", "lock \(want == .landscape ? "landscape" : "portrait") split=\(self.split) unfolded=\(self.unfolded)")
Orientation.lock(want)
}
}
func setUnfolded(_ on: Bool) {
guard on != unfolded else { return }
unfolded = on
Log.shared.info("orient", "unfolded \(on)")
lockOrientation()
}
func setSplit(_ on: Bool) {
guard on != split else { return }
split = on
Log.shared.info("orient", "split \(on)")
lockOrientation()
if on {
nowPlayingOpen = false
+41 -5
View File
@@ -6,19 +6,34 @@ import UIKit
/// (or the stems, queue and lyrics deck) on the other, and the tabs stay in the system's own bar.
struct RootView: View {
@State private var ui = Ui(overlays: Overlays())
@State private var art: ArtHue?
private var g: AppGraph { .shared }
var body: some View {
let s = g.settings
let p = Palette.of(s.theme, s.accent)
let base = Palette.of(s.theme, s.accent)
let p = s.albumTheme ? art.map { base.art($0, mode: s.theme) } ?? base : base
bar
.modifier(GlassMiniPlayerHost())
// Folded on the Duo the app stays upright (the window's trailing inset gives the Duo away).
.onGeometryChange(for: CGFloat.self) { $0.safeAreaInsets.trailing } action: { ui.sawInsets(trailing: $0, upright: vSize == .regular) }
.background(p.bg.ignoresSafeArea())
.onChange(of: ui.tabs) { _, _ in ui.ensureValidTab() }
.onChange(of: phase) { _, ph in
if ph == .active { ui.resumed() } else if ph == .background { ui.backgrounded() }
}
.fullScreenCover(isPresented: Binding(get: { ui.nowPlayingOpen }, set: { ui.nowPlayingOpen = $0 })) {
NowPlayingScreen()
// The panes underneath stop reporting while this covers them, so watch for the
// hinge here too: unfolding hands over to the split (docked) layout.
.background(GeometryReader { geo in
let c = DuoPane<EmptyView>.cut(geo)
Color.clear.onChange(of: c == nil ? 0 : c!.vertical ? 2 : 1, initial: true) { _, k in
guard k > 0 else { return }
ui.setUnfolded(true)
ui.setSplit(k == 2)
}
})
.overlayHost(ui.overlays, level: 1)
.environment(ui)
.environment(\.palette, p)
@@ -33,9 +48,15 @@ struct RootView: View {
.environment(\.palette, p)
.preferredColorScheme(s.theme == .White ? .light : .dark)
.tint(p.accent)
.task(id: "\(g.playback.current?.track.thumb ?? "")|\(s.albumTheme)") {
guard s.albumTheme, let thumb = g.playback.current?.track.thumb else { art = nil; return }
let a = await artHue(thumb)
withAnimation(.easeInOut(duration: 0.4)) { art = a }
}
}
@Environment(\.verticalSizeClass) private var vSize
@Environment(\.scenePhase) private var phase
private enum BarItem: Hashable { case deck, tab(Tab) }
@@ -188,11 +209,15 @@ private struct DuoPane<Content: View>: View {
@ViewBuilder var content: Content
@Environment(Ui.self) private var ui
@AppStorage("duoSwap") private var swap = false
@Environment(\.palette) private var p
@State private var shown = false
private var g: AppGraph { .shared }
var body: some View {
GeometryReader { geo in
let cut = Self.cut(geo)
let hinge = Self.cut(geo)
// Unfolded upright (hinge across) never splits: the app turns to landscape instead.
let cut = hinge?.vertical == true ? hinge : nil
let flip = duoSwapEnabled && swap && cut?.vertical == true
let layout = cut?.vertical == false ? AnyLayout(VStackLayout(spacing: cut?.gap ?? 0)) : AnyLayout(HStackLayout(spacing: cut?.gap ?? 0))
layout {
@@ -214,15 +239,22 @@ private struct DuoPane<Content: View>: View {
// Right-to-left lays the same two children out mirrored, so swapping doesn't rebuild either.
.environment(\.layoutDirection, flip ? .rightToLeft : .leftToRight)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
// The hinge gap shows whatever is behind; paint it so the two sides read as one.
.background(p.bg.ignoresSafeArea())
.animation(.spring(duration: 0.4, bounce: 0.1), value: flip)
.onChange(of: cut != nil, initial: true) { _, on in ui.setSplit(on) }
// Every tab has its own pane and TabView keeps hidden ones alive, so only the one on
// screen reports; a hidden one's stale size used to turn split off under the visible one.
.onChange(of: hinge != nil) { _, on in if shown { ui.setUnfolded(on) } }
.onChange(of: cut != nil) { _, on in if shown { ui.setSplit(on) } }
.onAppear { shown = true; ui.setUnfolded(hinge != nil); ui.setSplit(cut != nil) }
.onDisappear { shown = false }
}
}
/// Where the hinge cuts the view: sizes of the two sides and the gap between them.
private struct Cut { var vertical: Bool; var first: CGFloat; var gap: CGFloat; var second: CGFloat }
fileprivate struct Cut { var vertical: Bool; var first: CGFloat; var gap: CGFloat; var second: CGFloat }
private static func cut(_ geo: GeometryProxy) -> Cut? {
fileprivate static func cut(_ geo: GeometryProxy) -> Cut? {
let size = geo.size
var c: Cut?
// The hinge reports inactive while the phone lies flat, so ask for inactive regions too.
@@ -238,6 +270,10 @@ private struct DuoPane<Content: View>: View {
let screenW = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.screen.bounds.width
let half = ((screenW ?? size.width) / 2 - geo.frame(in: .global).minX).rounded()
c = Cut(vertical: true, first: half - 12, gap: 24, second: size.width - half - 12)
} else if UIDevice.current.userInterfaceIdiom == .phone, size.width >= 500, size.height >= 700 {
// Unfolded but still upright: only marks the phone as unfolded so it turns to landscape.
let half = (size.height / 2).rounded()
c = Cut(vertical: false, first: half - 12, gap: 24, second: size.height - half - 12)
}
guard let c else { return nil }
// A region that doesn't leave usable room on both sides isn't a hinge worth splitting at.
+1 -1
View File
@@ -82,7 +82,7 @@ private func effectivePreamp(_ p: EqProfile) -> Float {
/// The EQ's response, log frequency across, dB up. Left and right are drawn separately when
/// some filter applies to only one of them (right in orange). [nodes] are drawn as numbered
/// handles; [highlight] gets its own curve in the accent colour.
/// handles; [highlight] gets its own curve in the accent color.
struct EqCurve: View {
let chain: [EqFilter]
let preampDb: Float
+76 -96
View File
@@ -3,6 +3,14 @@ import UIKit
enum NpPanel { case Art, Mixer, Queue, Lyrics }
/// The close drag's offset. Only DropOffset reads it, so dragging re-renders just the offset.
@Observable final class DropState { var y: CGFloat = 0 }
private struct DropOffset: ViewModifier {
let state: DropState
func body(content: Content) -> some View { content.offset(y: state.y) }
}
func deviceIcon(_ d: OutputDevice) -> (String, UInt32) {
switch d.kind {
case .Speaker: ("iphone", 0x8E8E93)
@@ -15,25 +23,8 @@ func deviceIcon(_ d: OutputDevice) -> (String, UInt32) {
}
}
// ---- album colour ---------------------------------------------------------------------------
/// A solid colour from the album art, pushed dark (or light for the White theme) so text
/// stays readable. One flat colour: no gradients.
@MainActor
private func albumColor(_ thumb: String?, dark: Bool) async -> Color? {
guard let url = AppGraph.shared.plex.artUrl(thumb, px: 120) else { return nil }
let img: UIImage? = if let c = ArtLoader.shared.cached(url) { c } else { await ArtLoader.shared.image(url) }
guard let cg = img?.cgImage else { return nil }
return await Task.detached { () -> Color? in
guard let (h, s0, v0) = vibrant(cg) else { return nil }
let s = dark ? min(s0, 0.65) : min(s0, 0.22)
let v = dark ? min(max(v0, 0.18), 0.30) : 0.96
return Color(hue: h, saturation: s, brightness: v)
}.value
}
/// Roughly Palette's vibrant swatch: the average hue of the most saturated, mid-bright pixels.
private func vibrant(_ cg: CGImage) -> (CGFloat, CGFloat, CGFloat)? {
func vibrant(_ cg: CGImage) -> (CGFloat, CGFloat, CGFloat)? {
let n = 24
var px = [UInt8](repeating: 0, count: n * n * 4)
guard let ctx = CGContext(data: &px, width: n, height: n, bitsPerComponent: 8, bytesPerRow: n * 4,
@@ -44,7 +35,7 @@ private func vibrant(_ cg: CGImage) -> (CGFloat, CGFloat, CGFloat)? {
let c = UIColor(red: CGFloat(px[i * 4]) / 255, green: CGFloat(px[i * 4 + 1]) / 255, blue: CGFloat(px[i * 4 + 2]) / 255, alpha: 1)
var h: CGFloat = 0, s: CGFloat = 0, v: CGFloat = 0, a: CGFloat = 0
c.getHue(&h, saturation: &s, brightness: &v, alpha: &a)
// Favour colourful pixels that aren't near black or white.
// Favour colorful pixels that aren't near black or white.
let score = s * (1 - abs(v - 0.55) * 1.4)
all.append((h, s, v, score))
}
@@ -58,32 +49,6 @@ private func vibrant(_ cg: CGImage) -> (CGFloat, CGFloat, CGFloat)? {
return (h, s / k, v / k)
}
private extension Palette {
func tinted(_ bg: Color) -> Palette {
let dark = UIColor(bg).luminance < 0.5
var c = self
c.dark = dark
c.bg = bg
c.groupedBg = bg
c.fill = dark ? .white.opacity(0.12) : .black.opacity(0.06)
c.fillStrong = dark ? .white.opacity(0.22) : .black.opacity(0.12)
c.label = dark ? .white : .black
c.label2 = dark ? .white.opacity(0.62) : .black.opacity(0.55)
c.label3 = dark ? .white.opacity(0.25) : .black.opacity(0.2)
c.separator = dark ? .white.opacity(0.14) : .black.opacity(0.1)
c.placeholder = c.fill
return c
}
}
private extension UIColor {
var luminance: CGFloat {
var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0
getRed(&r, green: &g, blue: &b, alpha: &a)
return 0.2126 * r + 0.7152 * g + 0.0722 * b
}
}
// ---- now playing ----------------------------------------------------------------------------
/// Full screen, Now Playing owns the window's color scheme. Docked beside the library it only
@@ -105,16 +70,22 @@ struct NowPlayingScreen: View {
@Environment(\.palette) private var base
@Environment(\.dismiss) private var dismiss
@State private var panel = NpPanel.Art
@State private var tint: Color?
/// How far the screen is being dragged down to close it.
@State private var drop: CGFloat = 0
/// How far the screen is being dragged down to close it. Kept out of the view's own state so a
/// drag only moves the screen (DropOffset) instead of rebuilding all of Now Playing each frame.
@State private var drop = DropState()
/// Docked beside the hinge the pane is narrow, so the controls pack tighter. Full screen
/// (folded or any other iPhone) uses the roomy layout across the whole window.
private var tight: Bool { docked }
/// Full screen on the Duo (folded, or a Split View half), the controls run down into the home indicator strip.
private var runsLow: Bool { !docked && (folded || ui.isDuo) }
/// Size of the art panel in the stacked layout, so the controls can match the art's width.
@State private var artBox: CGSize = .zero
/// Height of the wide layout's controls column, so the Duo art can match it.
@State private var ctlH: CGFloat = 0
/// The screen's height, for the strip at the top that a drag down closes from.
@State private var screenH: CGFloat = 0
/// Where the art sits on screen: folded, a drag down that starts on it closes Now Playing.
@State private var artFrame: CGRect = .zero
@Environment(\.verticalSizeClass) private var vSize
/// Folded iPhone Duo: the outer display keeps a status column down the right edge.
@State private var folded = false
@@ -124,7 +95,7 @@ struct NowPlayingScreen: View {
var body: some View {
let pm = g.playback
let c = tint.map { base.tinted($0) } ?? base
let c = base
let track = pm.current?.track
// Wide when there's no room to stack art over controls: landscape, or iPhone Duo's
// outer display. Tall layouts (including the unfolded Duo) cap the controls' width.
@@ -135,13 +106,18 @@ struct NowPlayingScreen: View {
if wide {
// The column never drops below what the transport row needs, so the buttons
// can't spill onto the art or under the Duo rail.
let col = tight ? min(max(geo.size.width * 0.46, 300), 420) : min(geo.size.width * 0.48, 440)
let col = tight ? min(max(geo.size.width * 0.46, 300), 420) : min(max(geo.size.width * 0.42, 300), 440)
HStack(spacing: 0) {
// On the Duo the art matches the controls' height, so it lines up with the title
// and the button row instead of floating in the middle of a tall pane.
let match = ui.isDuo && !docked && panel == .Art && ctlH > 0
panelView(track, header: false)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.frame(maxWidth: .infinity, maxHeight: match ? min(ctlH, geo.size.height) : .infinity)
.frame(maxHeight: .infinity)
.transition(.opacity.combined(with: .scale(scale: 0.96)))
controls(track, wide: true, width: col)
.frame(width: col)
.onGeometryChange(for: CGFloat.self) { $0.size.height } action: { ctlH = $0 }
.frame(maxHeight: .infinity)
}
} else {
@@ -168,11 +144,14 @@ struct NowPlayingScreen: View {
// (it only overlaps the sliding preset chips) instead of leaving a quarter of the screen empty.
// Upright iPhones have no side insets, so this only changes the Duo.
// Folded, the bottom inset is empty space too: run the controls down into it, and the art grows into the room.
.ignoresSafeArea(.container, edges: !docked && vSize == .regular ? (folded ? [.trailing, .bottom] : .trailing) : [])
// The room under the controls has to be inside this view: padding outside it would keep
// the view off the bottom edge, and then it can't run into the home indicator strip.
.padding(.bottom, runsLow ? 6 : 0)
.ignoresSafeArea(.container, edges: !docked && vSize == .regular ? (runsLow ? [.trailing, .bottom] : .trailing) : [])
// Measured outside the line above, so it still sees the status column.
.onGeometryChange(for: Bool.self) { $0.safeAreaInsets.trailing > 20 } action: { folded = $0 && vSize == .regular }
.padding(.top, docked ? 4 : tight ? 14 : 20)
.padding(.bottom, tight ? 4 : folded ? 2 : 8)
.padding(.bottom, runsLow ? 0 : tight ? 4 : 8)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(c.bg.ignoresSafeArea())
.overlay(alignment: .top) {
@@ -183,27 +162,23 @@ struct NowPlayingScreen: View {
.gesture(screenDrag(header: true)) }
}
.onGeometryChange(for: CGFloat.self) { $0.size.height } action: { screenH = $0 }
.offset(y: drop)
.modifier(DropOffset(state: drop))
// Drag down from the top strip (or the song header) to close, so it never fights the
// stem faders. Swipe up anywhere on the art for the queue.
.simultaneousGesture(screenDrag(), including: panel == .Art ? .all : .subviews)
.environment(\.palette, c)
.modifier(NpScheme(dark: c.dark, docked: docked))
.tint(c.label)
.animation(.easeInOut(duration: 0.3), value: tint)
.presentationBackground(.clear)
.onAppear { if !docked && g.playback.karaoke { panel = .Lyrics } }
.task(id: "\(track?.thumb ?? "")|\(g.settings.albumColorNowPlaying)|\(base.dark)") {
guard g.settings.albumColorNowPlaying, let thumb = track?.thumb else { tint = nil; return }
tint = await albumColor(thumb, dark: base.dark)
}
}
@ViewBuilder
private func panelView(_ track: Track, header: Bool) -> some View {
switch panel {
case .Art: ArtPanel(thumb: track.thumb, playing: g.playback.playWhenReady, inset: header || !tight ? artInset : 12,
leading: folded && !docked && !ui.split && g.settings.foldedArtLeft).contentShape(Rectangle())
case .Art: ArtPanel(thumb: track.thumb, playing: g.playback.playWhenReady, inset: header ? artInset : 12,
leading: folded && !docked && !ui.split && g.settings.foldedArtLeft, edge: hPad).contentShape(Rectangle())
.onGeometryChange(for: CGRect.self) { $0.frame(in: .global) } action: { if drop.y == 0 { artFrame = $0 } }
case .Mixer: VStack(spacing: 0) { if header { mini(track) }; MixerPanel(spread: folded) }
case .Queue: VStack(spacing: 0) { if header { mini(track) }; QueuePanel(close: { show(.Queue) }) }
case .Lyrics: VStack(spacing: 0) { if header { mini(track) }; LyricsPanel(track: track) }
@@ -219,7 +194,7 @@ struct NowPlayingScreen: View {
// Folded, the controls keep the tight stems-panel spacing on every panel, so the art gets the room.
let snug = folded
let pm = g.playback
let c = tint.map { base.tinted($0) } ?? base
let c = base
let pad: CGFloat = wide && tight ? 14 : hPad
// Full-size transport needs 312 pt; below that the buttons shrink to fit.
let narrow = width - 2 * pad < 312
@@ -236,10 +211,10 @@ struct NowPlayingScreen: View {
Spacer(minLength: 8)
EllipsisButton(items: ui.menu.track(track))
}
.padding(.top, tight || snug ? 8 : 14)
.padding(.top, snug && !docked ? 20 : tight ? 8 : ui.isDuo && !wide ? 30 : 14)
.transition(.opacity.combined(with: .move(edge: .top)))
}
ProgressVolumeBar(played: c.label, unplayed: c.label3, centerLabel: badge(track))
ProgressVolumeBar(played: g.settings.albumTheme ? c.accent : c.label, unplayed: c.label3, centerLabel: badge(track))
.padding(.top, tight ? (wide ? 14 : 18) : snug ? 14 : wide ? 24 : panel == .Art ? 34 : 30)
HStack(spacing: 0) {
SideToggle(symbol: "shuffle", on: pm.shuffle, action: pm.toggleShuffle, width: narrow ? 36 : 40)
@@ -324,19 +299,25 @@ struct NowPlayingScreen: View {
}
/// Drag down to close: from the grabber or song header, or anywhere in the top tenth of the screen.
/// Folded, also from the art (only while it shows, so never over the stem dials).
private func fromTop(_ v: DragGesture.Value, header: Bool) -> Bool {
header || v.startLocation.y < max(screenH * 0.1, 56)
|| (folded && !docked && panel == .Art && artFrame.contains(v.startLocation))
}
private func screenDrag(header: Bool = false) -> some Gesture {
DragGesture(minimumDistance: 20)
DragGesture(minimumDistance: 20, coordinateSpace: .global)
.onChanged { v in
let dy = v.translation.height
let top = header || v.startLocation.y < max(screenH * 0.1, 56)
drop = !docked && top && dy > 0 && dy > abs(v.translation.width) ? dy : 0
let top = fromTop(v, header: header)
drop.y = !docked && top && dy > 0 && dy > abs(v.translation.width) ? dy : 0
}
.onEnded { v in
let dy = v.translation.height
let vertical = abs(dy) > abs(v.translation.width)
let top = header || v.startLocation.y < max(screenH * 0.1, 56)
let top = fromTop(v, header: header)
if !docked && top && vertical && (dy > 120 || v.predictedEndTranslation.height > 300) { dismiss(); return }
withAnimation(.spring(duration: 0.3, bounce: 0.1)) { drop = 0 }
withAnimation(.spring(duration: 0.3, bounce: 0.1)) { drop.y = 0 }
// Never from the stems: a slightly upward fader drag or scroll there kept opening the queue.
if !docked && vertical && dy < -50 && panel != .Mixer && g.settings.swipeUpQueue {
withAnimation(.spring(duration: 0.38, bounce: 0.12)) { panel = .Queue }
@@ -497,6 +478,8 @@ private struct ArtPanel: View {
var inset: CGFloat = 28
/// Settings > Appearance, folded Duo only: art against the left edge.
var leading = false
/// The controls' side padding, which the art's left edge matches when `leading`.
var edge: CGFloat = 28
var body: some View {
GeometryReader { geo in
let side = max(min(geo.size.width, geo.size.height), 1)
@@ -506,7 +489,8 @@ private struct ArtPanel: View {
.animation(.spring(response: 0.45, dampingFraction: 0.62), value: playing)
.frame(width: geo.size.width, height: geo.size.height, alignment: leading ? .leading : .center)
}
.padding(.horizontal, inset).padding(.vertical, 8)
// Against the left edge, the art starts where the controls below it do.
.padding(.leading, leading ? edge : inset).padding(.trailing, inset).padding(.vertical, 8)
}
}
@@ -856,7 +840,7 @@ extension MixerPanel {
static func roomyHeight(_ stems: Int) -> CGFloat { roomyChrome + CGFloat(stems) * roomyRow }
}
/// [Chip] in the sheet's own colours: selected is the label colour, so it reads on any tint.
/// [Chip] in the sheet's own colors: selected is the label color, so it reads on any tint.
private struct PresetChip: View {
let text: String
var icon: String? = nil
@@ -972,7 +956,7 @@ struct ToggleBox: View {
}
}
/// An iOS-style slider with a coloured fill and, optionally, a detent that catches the thumb
/// An iOS-style slider with a colored fill and, optionally, a detent that catches the thumb
/// near one value (unity gain) with a tick.
struct FaderSlider: View {
let value: Float
@@ -980,7 +964,7 @@ struct FaderSlider: View {
var detent: Float?
var enabled = true
var thumb: CGFloat = 24
/// 0...1 live level, shown in the full fill colour over the dimmed filled part of the track.
/// 0...1 live level, shown in the full fill color over the dimmed filled part of the track.
var meter: CGFloat?
let onChange: (Float) -> Void
@@ -1000,8 +984,8 @@ struct FaderSlider: View {
let x = CGFloat(min(max(value, 0), 1)) * track
ZStack(alignment: .leading) {
Capsule().fill(p.fillStrong).frame(height: bar).padding(.horizontal, thumb / 2)
// With a meter the set level is a dim band of the stem's colour and the live level
// runs over it in the full colour, so the two never blend.
// With a meter the set level is a dim band of the stem's color and the live level
// runs over it in the full color, so the two never blend.
Capsule().fill(meter == nil ? fill : fill.opacity(0.32)).frame(width: x + thumb / 2, height: bar).padding(.leading, thumb / 2 - 0.01)
if let meter, meter > 0.01 {
Capsule().fill(fill).frame(width: meter * (x + thumb / 2), height: bar)
@@ -1044,11 +1028,10 @@ struct NowPlayingDeck: View {
@Environment(Ui.self) private var ui
@Environment(\.palette) private var base
@AppStorage("duoSwap") private var swap = false
@State private var tint: Color?
private var g: AppGraph { .shared }
var body: some View {
let c = tint.map { base.tinted($0) } ?? base
let c = base
let track = g.playback.current?.track
GeometryReader { _ in
if let track {
@@ -1076,12 +1059,7 @@ struct NowPlayingDeck: View {
.environment(\.palette, c)
.modifier(NpScheme(dark: c.dark, docked: true))
.tint(c.label)
.animation(.easeInOut(duration: 0.3), value: tint)
.animation(.snappy(duration: 0.25), value: ui.deckPage)
.task(id: "\(track?.thumb ?? "")|\(g.settings.albumColorNowPlaying)|\(base.dark)") {
guard g.settings.albumColorNowPlaying, let thumb = track?.thumb else { tint = nil; return }
tint = await albumColor(thumb, dark: base.dark)
}
}
/// The page names, and the button that moves Now Playing to the other side of the hinge.
@@ -1233,7 +1211,7 @@ struct MiniPlayer: View {
.padding(.leading, 8).padding(.trailing, 6)
.frame(height: 60)
.background {
// A solid card in the app's own colours instead of system glass.
// A solid card in the app's own colors instead of system glass.
let shape = RoundedRectangle(cornerRadius: 14, style: .continuous)
ZStack {
shape.fill(p.cell)
@@ -1322,22 +1300,24 @@ private struct LyricsPanel: View {
var body: some View {
VStack(spacing: 0) {
// Soft leaves the singer in quietly as a guide.
HStack(spacing: 12) {
Text("Vocals").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
Picker("Vocals", selection: Binding(get: { g.playback.karaokeVocals }, set: { g.playback.setKaraokeVocals($0) })) {
ForEach(KaraokeVocals.allCases, id: \.self) { Text(String(describing: $0)).tag($0) }
}
.pickerStyle(.segmented)
}
.padding(.horizontal, 28).padding(.top, 8)
if g.playback.karaokeVocals == .Soft {
let db = g.settings.karaokeSoftDb
if g.playback.source == .Stems && g.playback.stemNames.contains("vocals") {
HStack(spacing: 12) {
Text("Softness").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
Slider(value: Binding(get: { Double(db) }, set: { g.playback.setKaraokeSoftDb(Int($0.rounded())) }), in: -30...(-3), step: 1)
Text("\(db) dB").font(.caption).monospacedDigit().foregroundStyle(p.label2).frame(width: 46, alignment: .trailing)
Text("Vocals").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
Picker("Vocals", selection: Binding(get: { g.playback.karaokeVocals }, set: { g.playback.setKaraokeVocals($0) })) {
ForEach(KaraokeVocals.allCases, id: \.self) { Text(String(describing: $0)).tag($0) }
}
.pickerStyle(.segmented)
}
.padding(.horizontal, 28).padding(.top, 8)
if g.playback.karaokeVocals == .Soft {
let db = g.settings.karaokeSoftDb
HStack(spacing: 12) {
Text("Softness").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
Slider(value: Binding(get: { Double(db) }, set: { g.playback.setKaraokeSoftDb(Int($0.rounded())) }), in: -30...(-3), step: 1)
Text("\(db) dB").font(.caption).monospacedDigit().foregroundStyle(p.label2).frame(width: 46, alignment: .trailing)
}
.padding(.horizontal, 28).padding(.top, 8)
}
}
content
}
+14 -2
View File
@@ -159,11 +159,12 @@ struct StemPlaylistScreen: View {
}
.toolbar {
ToolbarItemGroup(placement: .topBarTrailing) {
if !editing { MoreMenu(items: moreItems(pl)) }
if editing { Button("Done") { g.stemPlaylists.setItems(pl.id, items); editing = false }.bold() }
else if !pl.items.isEmpty { Button("Edit") { items = pl.items; editing = true } }
if !editing { MoreMenu(items: moreItems(pl)) }
}
}
.modifier(SplitHidesTitle())
}
private func header(_ pl: StemPlaylist) -> some View {
@@ -267,14 +268,15 @@ struct PlaylistScreen: View {
}
.toolbar {
ToolbarItemGroup(placement: .topBarTrailing) {
if !editing { MoreMenu(items: moreItems(list)) }
if !playlist.smart && !list.isEmpty {
if saving { ProgressView() }
else if editing { Button("Done") { commit(list) }.bold() }
else { Button("Edit") { items = list; removed = []; editing = true } }
}
if !editing { MoreMenu(items: moreItems(list)) }
}
}
.modifier(SplitHidesTitle())
.task(id: reload) {
await LoadState.load($tracks) { try await g.plex.playlistTracks(playlist.ratingKey) }
}
@@ -413,3 +415,13 @@ struct SearchScreen: View {
}
}
}
/// Split at the Duo's hinge the pane's own header already names the playlist, so the bar drops the title.
private struct SplitHidesTitle: ViewModifier {
@Environment(Ui.self) private var ui
func body(content: Content) -> some View {
content.toolbar {
if ui.split { ToolbarItem(placement: .principal) { Color.clear.frame(width: 1, height: 1) } }
}
}
}
+50 -36
View File
@@ -140,7 +140,7 @@ private func clean(_ url: String) -> String {
return u
}
/// Four little faders in the stem colours: the Settings mark.
/// Four little faders in the stem colors: the Settings mark.
private struct StemMark: View {
var scale: CGFloat = 1
var body: some View {
@@ -279,6 +279,7 @@ struct SettingsScreen: View {
case .online(let n, _): "\(n.formatted()) songs with stems"
case .offline(_, let cached): cached > 0 ? "Can't reach it, \(cached.formatted()) songs saved" : "Can't reach it"
case .unknown: "Checking…"
case .off: "Off, Plex only"
}
}
}
@@ -345,7 +346,7 @@ private let maintainers = [
coffee: "https://venmo.com/code?user_id=2910252785729536546&created=1792897467", tipTitle: "Venmo", tipIcon: "dollarsign.circle.fill"),
]
/// A maintainer's picture in a ring of their stem colour, their name and what they look after.
/// A maintainer's picture in a ring of their stem color, their name and what they look after.
private struct MaintainerCard: View {
let m: Maintainer
@Environment(\.palette) private var p
@@ -826,40 +827,51 @@ struct StemServerScreen: View {
let status = g.stems.status
List {
Section {
FieldCell(label: "Address", text: $url, placeholder: "http://192.168.86.2:8765")
FieldCell(label: "Token", text: $token, placeholder: "Optional", secret: true)
ActionCell(title: busy ? "Connecting…" : "Save & Connect") { connect() }
} header: { Header(text: "stemserve") } footer: {
Footer(text: "stemserve shares the Stems folder that stemd fills (port 8765). The app checks it for new stems every minute.\n\n" + matchNote)
}
Section {
ValueCell(title: "Connection", value: {
switch status {
case .online: "Online"
case .offline: "Offline"
case .unknown: "Checking"
}
}()).themedRow()
ValueCell(title: "Songs with Stems", value: {
switch status {
case .online(let n, _): "\(n)"
case .offline(_, let n): "\(n) (cached)"
case .unknown: "—"
}
}()).themedRow()
ValueCell(title: "stemd", value: g.stems.liveLine ?? (g.stems.failed.isEmpty ? "Idle" : "\(g.stems.failed.count) failed")).themedRow()
ValueCell(title: "Opus Transcoding", value: {
if case .online(_, let t) = status { return t ? "Available" : "No ffmpeg" }
return "—"
}()).themedRow()
if case .offline(let reason, _) = status {
VStack(alignment: .leading, spacing: 2) {
Text("Error").foregroundStyle(p.label)
Text(reason).font(.footnote).foregroundStyle(p.label2)
}
Toggle(isOn: Binding(get: { !g.settings.stemServerOff }, set: { on in
g.settings.stemServerOff = !on
Task { await g.stems.refresh(force: true) }
})) { Text("Use Stem Server").foregroundStyle(p.label) }
.tint(Color(hex: 0x34C759))
.themedRow()
}
if !g.settings.stemServerOff {
Section {
FieldCell(label: "Address", text: $url, placeholder: "http://192.168.86.2:8765")
FieldCell(label: "Token", text: $token, placeholder: "Optional", secret: true)
ActionCell(title: busy ? "Connecting…" : "Save & Connect") { connect() }
} header: { Header(text: "stemserve") } footer: {
Footer(text: "stemserve shares the Stems folder that stemd fills (port 8765). The app checks it for new stems every minute.\n\n" + matchNote)
}
} header: { Header(text: "Status") }
Section {
ValueCell(title: "Connection", value: {
switch status {
case .online: "Online"
case .offline: "Offline"
case .unknown: "Checking"
case .off: "Off"
}
}()).themedRow()
ValueCell(title: "Songs with Stems", value: {
switch status {
case .online(let n, _): "\(n)"
case .offline(_, let n): "\(n) (cached)"
case .unknown, .off: "—"
}
}()).themedRow()
ValueCell(title: "stemd", value: g.stems.liveLine ?? (g.stems.failed.isEmpty ? "Idle" : "\(g.stems.failed.count) failed")).themedRow()
ValueCell(title: "Opus Transcoding", value: {
if case .online(_, let t) = status { return t ? "Available" : "No ffmpeg" }
return "—"
}()).themedRow()
if case .offline(let reason, _) = status {
VStack(alignment: .leading, spacing: 2) {
Text("Error").foregroundStyle(p.label)
Text(reason).font(.footnote).foregroundStyle(p.label2)
}
.themedRow()
}
} header: { Header(text: "Status") }
}
}
.listStyle(.insetGrouped)
.themedList()
@@ -1026,13 +1038,15 @@ struct AppearanceScreen: View {
.themedRow()
} header: { Header(text: "Accent") }
Section {
Toggle(isOn: $s.albumColorNowPlaying) { Text("Album Colour Background").foregroundStyle(c.label) }
Toggle(isOn: $s.albumTheme) { Text("Match Album Art").foregroundStyle(c.label) }
.tint(Color(hex: 0x34C759))
.themedRow()
}
Section {
Toggle(isOn: $s.foldedArtLeft) { Text("Left-Align Art When Folded").foregroundStyle(c.label) }
.tint(Color(hex: 0x34C759))
.themedRow()
} header: { Header(text: "Now Playing") } footer: { Footer(text: "Album Colour paints the Now Playing screen in one solid colour taken from the album art. Left-Align moves the art to the left edge on the folded iPhone Duo.") }
} header: { Header(text: "Now Playing") } footer: { Footer(text: "Left-Align moves the art to the left edge on the folded iPhone Duo.") }
Section {
Toggle(isOn: $s.acapella) { Text("Spell It “Acapella”").foregroundStyle(c.label) }
.tint(Color(hex: 0x34C759))
+44 -2
View File
@@ -1,4 +1,5 @@
import SwiftUI
import UIKit
extension Color {
init(hex: UInt32, alpha: Double = 1) {
@@ -7,7 +8,7 @@ extension Color {
}
}
/// The three themes' colours. Black is true black for OLED; no gradients anywhere.
/// The three themes' colors. Black is true black for OLED; no gradients anywhere.
struct Palette {
var dark: Bool
var bg: Color
@@ -59,7 +60,7 @@ extension View {
/// A list on the theme's background instead of the system one.
func themedList(grouped: Bool = true) -> some View { modifier(ThemedList(grouped: grouped)) }
/// Rows on the theme's cell colour.
/// Rows on the theme's cell color.
func themedRow(grouped: Bool = true) -> some View { modifier(ThemedRow(grouped: grouped)) }
}
@@ -84,3 +85,44 @@ private struct ThemedRow: ViewModifier {
content.listRowBackground(grouped ? p.cell : p.bg).listRowSeparatorTint(p.separator)
}
}
// ---- album art theme ----------------------------------------------------------------------------
/// One hue taken from the album art (see vibrant in NowPlayingScreen).
struct ArtHue: Equatable { var h, s, v: CGFloat }
@MainActor
func artHue(_ thumb: String?) async -> ArtHue? {
guard let url = AppGraph.shared.plex.artUrl(thumb, px: 120) else { return nil }
let img: UIImage? = if let c = ArtLoader.shared.cached(url) { c } else { await ArtLoader.shared.image(url) }
guard let cg = img?.cgImage else { return nil }
return await Task.detached { () -> ArtHue? in
guard let (h, s, v) = vibrant(cg), s >= 0.12 else { return nil }
return ArtHue(h: h, s: s, v: v)
}.value
}
extension Palette {
/// The theme recolored around the art's hue: lightly tinted surfaces and an accent in the art's color.
/// Black keeps its true-black background for OLED.
func art(_ a: ArtHue, mode: ThemeMode) -> Palette {
var c = self
let s = min(a.s, 0.9), t = min(s * 0.5, 0.3)
func hsb(_ sat: CGFloat, _ b: CGFloat) -> Color { Color(hue: a.h, saturation: sat, brightness: b) }
switch mode {
case .White:
c.bg = hsb(t * 0.25, 1); c.groupedBg = hsb(t * 0.45, 0.965); c.cell = hsb(t * 0.2, 1)
c.fill = hsb(t * 0.5, 0.94); c.fillStrong = hsb(t * 0.6, 0.89); c.separator = hsb(t * 0.6, 0.86)
c.accent = hsb(max(s, 0.6), min(max(a.v, 0.5), 0.62))
case .Dark:
c.bg = hsb(t, 0.11); c.groupedBg = c.bg; c.cell = hsb(t, 0.17)
c.fill = c.cell; c.fillStrong = hsb(t, 0.27); c.separator = hsb(t, 0.22)
c.accent = hsb(max(s, 0.5), max(a.v, 0.85))
case .Black:
c.cell = hsb(t, 0.11); c.fill = c.cell; c.fillStrong = hsb(t, 0.22); c.separator = hsb(t, 0.17)
c.accent = hsb(max(s, 0.5), max(a.v, 0.85))
}
c.placeholder = c.fill
return c
}
}
+1 -1
View File
@@ -128,7 +128,7 @@ struct Art: View {
}
}
/// The primary-coloured capsule that moves to the next mix.
/// The primary-colored capsule that moves to the next mix.
struct MixPill: View {
let text: String
var icon = "chevron.right"
+3 -3
View File
@@ -7,9 +7,9 @@ settings:
base:
SWIFT_VERSION: "5.0"
# iOS needs a plain number for the bundle version; the label is what the app and releases show.
MARKETING_VERSION: "0.10.0"
VERSION_LABEL: "0.10.0"
CURRENT_PROJECT_VERSION: "40"
MARKETING_VERSION: "0.10.1"
VERSION_LABEL: "0.10.1"
CURRENT_PROJECT_VERSION: "58"
# Dev builds override these (build-ipa.sh dev) so they install next to the release app.
APP_ID: org.cdnutter.stemify
APP_NAME: Stemify
+20
View File
@@ -15,6 +15,26 @@
"tintColor": "#FA2D48",
"category": "entertainment",
"versions": [
{
"version": "0.10.1",
"marketingVersion": "0.10.1",
"buildVersion": "52",
"date": "2026-11-20T12:25:58-08:00",
"localizedDescription": "Folded art-left: art's left edge matches the controls' padding",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v0.10.1/stemify-0.10.1.ipa",
"size": 3142623,
"minOSVersion": "17.0"
},
{
"version": "0.10.0",
"marketingVersion": "0.10.0",
"buildVersion": "40",
"date": "2026-11-19T22:26:40-08:00",
"localizedDescription": "## iOS\n\n- New app icon: glowing stem-colored capsules on a night gradient.\n- Plays straight from Plex when the stem server is off or can't be reached. Stems come back once it's reachable again.\n- Picks the Plex server address again after a network change, when the app returns to the foreground, and when a stream fails.\n- Folded Now Playing uses the space at the bottom and shows bigger art.\n- iPhone Duo:\n - Folded is portrait only, and unfolded is landscape only.\n - Left-aligned art applies only when folded.\n - Unfolded stem bars are full width with roomier rows.\n - Deck stems fill the pane down to the hinge and the bottom edge.\n - Tab bar slots stay put across fold and unfold.\n\n## Web player\n\n- New layout: icon sidebar, blurred-art album headers, track table with an album column, play on card hover.\n- Graphite is the new default theme.\n- Album art can expand into a tile in the sidebar.\n- The mixer has vertical channel strips with live level meters. Drag anywhere on a strip, or use the wheel or arrow keys.\n- Save mix and Add to playlist buttons sit under the mixer.\n- The queue button moved to the right side of the player bar.\n- Tracks without stems are tagged NO STEMS.\n- Explanatory text is gone, and the playlist list is gone from the sidebar.\n- Assets are cache-busted, so a plain reload picks up new versions.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v0.10.0/stemify-0.10.0.ipa",
"size": 3124915,
"minOSVersion": "17.0"
},
{
"version": "0.9.0",
"marketingVersion": "0.9.0",
+406 -135
View File
@@ -3,7 +3,7 @@
import { $, $$, esc, fmtTime, fmtBytes, plural, on, emit, toast, ICON, store, uuid } from "./util.js";
import { S, save, songMixes, saveSongMix, forgetSongMix, playlists, savePlaylists, newPlaylist, addToPlaylist, Offline } from "./store.js";
import { px, img, rawImg, track, sources, liveServers, server, refreshServer, addServer, manualServer, signIn, sortState, pickSort, comparator, sortTracks, Pager, everything } from "./plex.js";
import { px, img, rawImg, track, sources, liveServers, server, refreshServer, addServer, manualServer, signIn, sortState, pickSort, comparator, sortTracks, Pager, everything, pxSend, plexUri } from "./plex.js";
import { Stems, Live, stemNow, stemTrack, stemBase, api } from "./stems.js";
import { E, Q, setting, stemGain, presets, allPresets, presetLabel, applyPreset, currentPreset, nextPreset, savePreset, deletePreset, movePreset, restorePresets, deleteAllCustom, toggleLock,
mixChanged, setKaraoke, setKaraokeMode, sameMix, setSpeed, saveQueue, saveOffline, Radio } from "./player.js";
@@ -14,22 +14,71 @@ const view = $("#view");
// ---- appearance -------------------------------------------------------------------------------
// Same palettes as the iOS app: three appearances and the system accent colors (light / dark variants).
const THEMES = {
graphite: { bg: "#181819", panel: "#101010", raised: "#262628", line: "#2b2b2e", text: "#e7e7e7", muted: "#a8a8a8", accent: "#3a81ed" },
amber: { bg: "#0d0e12", panel: "#15171d", raised: "#1d2028", line: "#262a33", text: "#eceef3", muted: "#8a8f9c", accent: "#f2b544" },
ocean: { bg: "#0a1018", panel: "#101a26", raised: "#172434", line: "#1f2f42", text: "#e6eef7", muted: "#8698ad", accent: "#4cc2ff" },
rose: { bg: "#120c10", panel: "#1b1218", raised: "#251922", line: "#33222e", text: "#f5e9f0", muted: "#a48b99", accent: "#ff6f9f" },
forest: { bg: "#0b110d", panel: "#111a14", raised: "#18241c", line: "#223127", text: "#e8f2ea", muted: "#88a08e", accent: "#62d38a" },
mono: { bg: "#0e0e0e", panel: "#161616", raised: "#202020", line: "#2c2c2c", text: "#f0f0f0", muted: "#8c8c8c", accent: "#f0f0f0" },
oled: { bg: "#000000", panel: "#000000", raised: "#141414", line: "#1e1e1e", text: "#f2f2f2", muted: "#8a8a8a", accent: "#f2b544" },
light: { bg: "#f6f6f3", panel: "#ffffff", raised: "#ebeae5", line: "#dddbd4", text: "#18181b", muted: "#6b6b73", accent: "#c27a06", light: true },
black: { label: "Black", bg: "#000000", panel: "#000000", raised: "#1c1c1e", line: "#2c2c2e", text: "#ffffff", muted: "#8d8d93", fill: "#3a3a3c" },
dark: { label: "Dark", bg: "#1c1c1e", panel: "#161618", raised: "#2c2c2e", line: "#3d3d40", text: "#ffffff", muted: "#98989d", fill: "#48484a" },
white: { label: "White", bg: "#ffffff", panel: "#f2f2f7", raised: "#efeff0", line: "#d8d8dc", text: "#000000", muted: "#8a8a8e", fill: "#e3e3e8", light: true },
};
const ACCENTS = {
music: ["Music", "#fa2d48", "#fc3c44"], pink: ["Pink", "#ff2d55", "#ff375f"], orange: ["Orange", "#ff9500", "#ff9f0a"],
yellow: ["Yellow", "#ffcc00", "#ffd60a"], green: ["Green", "#34c759", "#30d158"], teal: ["Teal", "#30b0c7", "#40c8e0"],
blue: ["Blue", "#007aff", "#0a84ff"], indigo: ["Indigo", "#5856d6", "#5e5ce6"], purple: ["Purple", "#af52de", "#bf5af2"],
};
const accentOf = (base, key = S.accent) => (ACCENTS[key] || ACCENTS.music)[base.light ? 1 : 2];
const inkFor = hex => {
const n = parseInt(hex.slice(1), 16), l = (0.299 * (n >> 16) + 0.587 * (n >> 8 & 255) + 0.114 * (n & 255)) / 255;
return l > 0.6 ? "#141414" : "#ffffff";
};
// Theme from the playing track's art: one hue taken from the art, laid over the chosen theme's lightness.
const hex = (h, s, l) => {
const f = n => { const k = (n + h * 12) % 12, c = l - s * Math.min(l, 1 - l) * Math.max(-1, Math.min(k - 3, 9 - k, 1)); return Math.round(c * 255).toString(16).padStart(2, "0"); };
return "#" + f(0) + f(8) + f(4);
};
function artPalette([h, s0, v], base) {
const s = Math.min(s0, 0.9), tint = Math.min(s * 0.55, 0.32), clamp = (x, a, b) => Math.max(a, Math.min(b, x));
if (base.light) return { bg: hex(h, tint, .955), panel: hex(h, tint, .985), raised: hex(h, tint, .9), line: hex(h, tint, .85),
text: hex(h, .2, .1), muted: hex(h, .08, .42), accent: hex(h, Math.max(s, .55), clamp(v * .45, .32, .42)), light: true };
const black = base.bg === "#000000";
return { bg: black ? "#000000" : hex(h, tint, .09), panel: black ? "#000000" : hex(h, tint, .06), raised: hex(h, tint, black ? .085 : .145), line: hex(h, tint, black ? .12 : .18),
text: hex(h, .15, .93), muted: hex(h, .1, .66), accent: hex(h, Math.max(s, .55), clamp(v * .7, .58, .7)) };
}
// Roughly a vibrant swatch: the circular mean hue of the most colorful mid-bright pixels.
function vibrant(bm) {
const n = 24, cv = new OffscreenCanvas(n, n), cx = cv.getContext("2d", { willReadFrequently: true });
cx.drawImage(bm, 0, 0, n, n);
const d = cx.getImageData(0, 0, n, n).data, px = [];
for (let i = 0; i < d.length; i += 4) {
const r = d[i] / 255, g = d[i + 1] / 255, b = d[i + 2] / 255, mx = Math.max(r, g, b), mn = Math.min(r, g, b), c = mx - mn;
const h = !c ? 0 : mx === r ? ((g - b) / c + 6) % 6 / 6 : mx === g ? ((b - r) / c + 2) / 6 : ((r - g) / c + 4) / 6, s = mx ? c / mx : 0;
px.push([h, s, mx, s * (1 - Math.abs(mx - 0.55) * 1.4)]);
}
const top = px.sort((a, b) => b[3] - a[3]).slice(0, px.length / 6);
let x = 0, y = 0, s = 0, v = 0;
for (const p of top) { x += Math.cos(p[0] * 2 * Math.PI); y += Math.sin(p[0] * 2 * Math.PI); s += p[1]; v += p[2]; }
return s / top.length < 0.12 ? null : [(Math.atan2(y, x) / (2 * Math.PI) + 1) % 1, s / top.length, v / top.length];
}
const ArtTheme = {
url: "", hsv: null, seq: 0, cache: new Map(),
async set(url) {
if (!S.artTheme) url = "";
if (url === this.url) return;
this.url = url;
const n = ++this.seq;
let hsv = url ? this.cache.get(url) : null;
if (url && !this.cache.has(url)) {
try {
const r = await fetch(url, { signal: AbortSignal.timeout(8000) });
hsv = vibrant(await createImageBitmap(await r.blob()));
this.cache.set(url, hsv);
} catch { hsv = null; }
if (n !== this.seq) return;
}
this.hsv = hsv; applyTheme();
},
};
function applyTheme() {
const t = THEMES[S.theme] || THEMES.graphite, a = S.accent || t.accent;
const base = THEMES[S.theme] || THEMES.dark, t = ArtTheme.hsv ? artPalette(ArtTheme.hsv, base) : base, a = ArtTheme.hsv ? t.accent : accentOf(base);
$("#theme").textContent = `:root{--bg:${t.bg};--panel:${t.panel};--raised:${t.raised};--line:${t.line};--text:${t.text};--muted:${t.muted};` +
`--accent:${a};--accent-ink:${inkFor(a)};--glass:${t.panel}ee;--hover:${t.text}0d;--shadow:${t.light ? "#0003" : "#0009"};` +
`--wave:${t.text}44;--wave-ghost:${t.text}14;color-scheme:${t.light ? "light" : "dark"}}`;
@@ -174,7 +223,7 @@ const UI = {
$("#np-title").textContent = st.name;
$("#np-sub").textContent = "Web Radio";
$("#np-art").removeAttribute("src");
$("#b-art").hidden = true; SideArt.fill();
$("#b-art").hidden = true; SideArt.fill(); ArtTheme.set("");
document.title = `${st.name} · Stemify`;
if ("mediaSession" in navigator) navigator.mediaSession.metadata = new MediaMetadata({ title: st.name, artist: "Web Radio" });
return;
@@ -185,7 +234,7 @@ const UI = {
$("#np-sub").textContent = t ? [t.artist, t.album].filter(Boolean).join(" · ") : "";
const art = artOf(t, 120);
if (art) $("#np-art").src = art; else $("#np-art").removeAttribute("src");
$("#b-art").hidden = !art; SideArt.fill();
$("#b-art").hidden = !art; SideArt.fill(); ArtTheme.set(artOf(t, 64));
document.title = t ? `${t.title} · Stemify` : "Stemify";
if ("mediaSession" in navigator) {
navigator.mediaSession.metadata = t ? new MediaMetadata({
@@ -240,7 +289,7 @@ const karaokeHtml = () => `<div class="kara">
<div class="seg">${[["off", "No vocals"], ["soft", "Soft vocals"], ["on", "Vocals on"]].map(([m, l]) => `<button class="${S.karaokeMode === m ? "on" : ""}" data-kmode="${m}">${l}</button>`).join("")}</div>
${S.karaokeMode === "soft" ? `<label class="note">Soft vocals: <b id="softdb">${S.softDb} dB</b><input type="range" min="-30" max="-3" step="1" value="${S.softDb}" data-softdb></label>` : ""}</div>`;
// Stem colours match the iOS app.
// Stem colors match the iOS app.
const STEM_COLORS = { vocals: "#ff7ab6", drums: "#ffb547", bass: "#7c8cff", other: "#4cd07d", guitar: "#ff8a5c", piano: "#b48cff", instrumental: "#3dd6c6" };
const pct = v => Math.round(v * 100) + "%";
function presetsHtml(names) {
@@ -470,7 +519,7 @@ $("#b-mixer").innerHTML = ICON.mixer;
$("#b-lyrics").innerHTML = ICON.lyrics;
$("#b-queue").innerHTML = ICON.queue;
$("#speed").innerHTML = SPEEDS.map(v => `<option value="${v}">${v}×</option>`).join("");
$("#volume").value = S.volume;
$("#volume").value = S.volume; $("#volume").style.setProperty("--v", S.volume * 100 + "%");
const togglePlay = () => { if (Radio.station) return Radio.toggle(); if (!Q.cur()) return; E.playing ? E.pause() : E.play(); saveQueue(); };
$("#b-play").onclick = togglePlay;
@@ -490,7 +539,7 @@ $("#b-mixer").onclick = () => toggleDrawer("mixer");
$("#b-lyrics").onclick = () => toggleDrawer("lyrics");
$("#b-queue").onclick = () => toggleDrawer("queue");
$("#speed").onchange = ev => setSpeed(+ev.target.value);
$("#volume").oninput = ev => { S.volume = +ev.target.value; E.applyGains(); save(); };
$("#volume").oninput = ev => { S.volume = +ev.target.value; ev.target.style.setProperty("--v", S.volume * 100 + "%"); E.applyGains(); save(); };
function applyBar() {
$("#speed").style.display = S.bar.speed ? "" : "none";
for (const k of ["mixer", "lyrics", "queue"]) $(`#b-${k}`).style.display = S.bar[k] ? "" : "none";
@@ -511,13 +560,14 @@ if ("mediaSession" in navigator) {
}
document.addEventListener("keydown", ev => {
if (ev.key === "Escape") return Menu.close();
if (ev.key === "Escape") { Finder.close(); return Menu.close(); }
if (ev.target.closest("input, select, textarea") || ev.metaKey || ev.ctrlKey || ev.altKey) return;
const k = ev.key.toLowerCase();
if (k === "/" || (k === "s" && !ev.shiftKey)) { ev.preventDefault(); return Finder.open(); }
if (k === " ") { ev.preventDefault(); togglePlay(); }
else if (k === "arrowright") E.seek(Math.min(E.duration(), E.position() + (ev.shiftKey ? 30 : 5)));
else if (k === "arrowleft") E.seek(Math.max(0, E.position() - (ev.shiftKey ? 30 : 5)));
else if (k === "s") Q.toggleShuffle();
else if (k === "s") Q.toggleShuffle(); // Shift+S
else if (k === "r") Q.cycleRepeat();
else if (k === "m") toggleDrawer("mixer");
else if (k === "l") toggleDrawer("lyrics");
@@ -599,7 +649,7 @@ const Menu = {
items = items.filter(Boolean);
const m = document.createElement("div");
m.id = "menu";
m.innerHTML = items.map((it, i) => it === "-" ? "<hr>" : `<button data-mi="${i}" ${it.run ? "" : "disabled"}>${esc(it.label)}</button>`).join("");
m.innerHTML = items.map((it, i) => it === "-" ? "<hr>" : it.head ? `<h5>${esc(it.head)}</h5>` : `<button data-mi="${i}" ${it.run ? "" : "disabled"} ${"check" in it ? `class="chk ${it.check ? "on" : ""}"` : ""}>${"check" in it ? ICON.check : ""}${esc(it.label)}</button>`).join("");
document.body.append(m);
const r = m.getBoundingClientRect();
m.style.left = Math.max(8, Math.min(x, innerWidth - r.width - 8)) + "px";
@@ -607,12 +657,105 @@ const Menu = {
m.onclick = ev => { const b = ev.target.closest("[data-mi]"); if (b) { const it = items[+b.dataset.mi]; this.close(); it.run(); } };
this.el = m;
},
close() { this.el?.remove(); this.el = null; },
close() { this.el?.remove(); this.el = this.from = null; },
};
addEventListener("pointerdown", ev => { if (Menu.el && !Menu.el.contains(ev.target)) Menu.close(); }, true);
addEventListener("pointerdown", ev => { if (Menu.el && !Menu.el.contains(ev.target) && !Menu.from?.contains(ev.target)) Menu.close(); }, true);
addEventListener("blur", () => Menu.close());
view.addEventListener("scroll", () => Menu.close(), { passive: true });
// ---- universal search (S) -----------------------------------------------------------------------
// One box over every enabled server: songs, artists, albums and playlists, plus stem playlists.
// Arrow keys move, Enter opens (or plays a song), Esc closes.
const Finder = {
el: null, items: [], at: 0, n: 0, timer: 0, pls: null, plsAt: 0,
build() {
const f = document.createElement("div");
f.id = "finder"; f.hidden = true;
f.innerHTML = `<div class="fbox" role="dialog" aria-label="Search"><label class="fin">${ICON.search}<input type="text" placeholder="Search songs, artists, albums, playlists" autocomplete="off" spellcheck="false"><kbd>esc</kbd></label><div class="fres" role="listbox"></div></div>`;
document.body.append(f);
const inp = f.querySelector("input"), res = f.querySelector(".fres");
f.addEventListener("pointerdown", ev => { if (ev.target === f) this.close(); });
inp.addEventListener("input", () => { clearTimeout(this.timer); this.timer = setTimeout(() => this.run(inp.value.trim()), 180); });
inp.addEventListener("keydown", ev => {
if (ev.key === "ArrowDown" || ev.key === "ArrowUp") { ev.preventDefault(); this.move(ev.key === "ArrowDown" ? 1 : -1); }
else if (ev.key === "Enter") { ev.preventDefault(); this.pick(this.at, ev.shiftKey); }
else if (ev.key === "Escape") { ev.preventDefault(); this.close(); }
});
res.addEventListener("pointermove", ev => { const r = ev.target.closest("[data-fi]"); if (r && +r.dataset.fi !== this.at) this.move(+r.dataset.fi - this.at); });
res.addEventListener("click", ev => { const r = ev.target.closest("[data-fi]"); if (r) this.pick(+r.dataset.fi, ev.shiftKey); });
this.el = f; this.inp = inp; this.res = res;
},
open() {
if (!this.el) this.build();
Menu.close();
this.el.hidden = false;
document.body.classList.add("finding");
this.inp.select(); this.inp.focus();
if (!this.inp.value) this.hint();
},
close() { if (!this.el || this.el.hidden) return; this.el.hidden = true; document.body.classList.remove("finding"); this.inp.blur(); },
hint() { this.items = []; this.res.innerHTML = `<p class="fmsg">Type to search every server. <kbd>↑</kbd><kbd>↓</kbd> to move, <kbd>↵</kbd> to open, <kbd>⇧↵</kbd> to queue a song.</p>`; },
// Plex playlists aren't in hub search results per section, so keep a short-lived list of them.
async plexPlaylists() {
if (!this.pls || Date.now() - this.plsAt > 120000) {
this.plsAt = Date.now();
this.pls = everything(liveServers().map(srv => ({ srv })), "/playlists", { playlistType: "audio" }).catch(() => []);
}
return this.pls;
},
async run(q) {
const n = ++this.n;
if (!q) return this.hint();
this.res.classList.add("busy");
const lq = q.toLowerCase(), has = s => (s || "").toLowerCase().includes(lq);
const [hubs, pls] = await Promise.all([
Promise.all(sources().map(s => px(s.srv, "/hubs/search", { query: q, limit: 8, sectionId: s.sec })
.then(mc => (mc.Hub || []).flatMap(h => (h.Metadata || []).map(m => (m._srv = s.srv.id, m._type = h.type, m)))).catch(() => []))).then(a => a.flat()),
this.plexPlaylists(),
]);
if (n !== this.n) return;
this.res.classList.remove("busy");
const of = t => hubs.filter(m => m._type === t), dedupe = (a, k) => [...new Map(a.map(x => [k(x), x])).values()];
const songs = dedupe(of("track").map(m => track(m._srv, m)), t => t.id).slice(0, 8);
const groups = [
["Songs", songs.map(t => ({ kind: "song", t: t.title, s: [t.artist, t.album].filter(Boolean).join(" · "), art: artOf(t, 96), track: t }))],
["Artists", dedupe(of("artist"), m => m._srv + m.ratingKey).slice(0, 5).map(m => ({ kind: "artist", t: m.title, s: "Artist", art: img(m._srv, m.thumb, 96), round: true, href: `#/artist/${m._srv}:${m.ratingKey}` }))],
["Albums", dedupe(of("album"), m => m._srv + m.ratingKey).slice(0, 6).map(m => ({ kind: "album", t: m.title, s: [m.parentTitle, m.year].filter(Boolean).join(" · "), art: img(m._srv, m.thumb, 96), href: `#/album/${m._srv}:${m.ratingKey}` }))],
["Playlists", [
...playlists.filter(p => has(p.title)).map(p => ({ kind: "playlist", t: p.title, s: `Stem playlist · ${plural(p.items.length, "track")}`, art: artOf(p.items[0]?.track, 96), href: `#/stemplaylist/${p.id}` })),
...pls.filter(p => has(p.title)).map(p => ({ kind: "playlist", t: p.title, s: `Playlist · ${plural(p.leafCount || 0, "track")}`, art: img(p._srv, p.thumb || p.composite, 96), href: `#/playlist/${p._srv}:${p.ratingKey}` })),
].slice(0, 6)],
].filter(g => g[1].length);
this.items = groups.flatMap(g => g[1]);
this.items.push({ kind: "all", t: `See all results for “${q}”`, href: "#/search/" + encodeURIComponent(q) });
let i = 0;
const row = it => `<div class="frow ${it.kind === "all" ? "fall" : ""}" role="option" data-fi="${i++}">${it.kind === "all" ? `<span class="fic">${ICON.search}</span>`
: `<span class="fart ${it.round ? "round" : ""}">${it.art ? `<img src="${esc(it.art)}" alt="" loading="lazy" decoding="async" ${FB}>` : ""}</span>`}
<span class="ftx"><b>${esc(it.t)}</b>${it.s ? `<small>${esc(it.s)}</small>` : ""}</span>${it.kind === "song" ? `<span class="fkey">Play</span>` : it.kind === "all" ? "" : `<span class="fkey">Open</span>`}</div>`;
this.res.innerHTML = (groups.length ? "" : `<p class="fmsg">No matches.</p>`) +
groups.map(([h, its]) => `<div class="fgrp"><h4>${h}</h4>${its.map(row).join("")}</div>`).join("") + row(this.items.at(-1));
this.at = 0; this.move(0);
},
move(d) {
if (!this.items.length) return;
this.at = (this.at + d + this.items.length) % this.items.length;
this.res.querySelector(".frow.on")?.classList.remove("on");
const r = this.res.querySelector(`[data-fi="${this.at}"]`);
r?.classList.add("on");
if (d) r?.scrollIntoView({ block: "nearest" });
},
pick(i, queue) {
const it = this.items[i];
if (!it) return;
this.close();
if (it.track) return queue ? Q.add([it.track], false) : Q.playList([it.track], 0, false);
location.hash = it.href;
},
};
$("#b-search").innerHTML = ICON.search;
$("#b-search").onclick = () => Finder.open();
const download = (tracks, group = null) => saveOffline(tracks, m => m && toast(m, 120000), group);
function stemItem(tracks) {
const need = tracks.filter(t => !Stems.find(t));
@@ -625,12 +768,28 @@ function stemItem(tracks) {
}
return { label: tracks.length === 1 ? "Stem Now" : `Stem Now (${need.length})`, run: () => stemNow(tracks) };
}
function pickPlaylist(x, y, tracks, mix = null) {
// Stem playlists live in the browser. Plex playlists take the songs from their own server.
async function pickPlaylist(x, y, tracks, mix = null) {
const add = p => { addToPlaylist(p, tracks, mix); toast(`Added to “${p.title}”${mix ? " with this mix" : ""}`); };
const srv = tracks.find(t => t.srv && t.key)?.srv, pts = tracks.filter(t => t.srv === srv && t.key);
const pls = srv && server(srv) && !mix ? ((await px(srv, "/playlists", { playlistType: "audio" }).catch(() => ({}))).Metadata || []).filter(p => !p.smart) : [];
const toPlex = async (key, title) => {
try {
const uri = await plexUri(srv, pts.map(t => t.key));
if (key) await pxSend(srv, "PUT", `/playlists/${key}/items`, { uri });
else await pxSend(srv, "POST", "/playlists", { type: "audio", title, smart: 0, uri });
Finder.pls = null;
toast(`Added to “${title}”`);
if (location.hash === `#/playlist/${srv}:${key}`) route();
} catch (e) { toast(e.message); }
};
Menu.open(x, y, [
{ head: "Stem playlists" },
{ label: "New stem playlist…", run: () => { const n = prompt("Stem playlist name"); if (n?.trim()) add(newPlaylist(n.trim())); } },
playlists.length && "-",
...playlists.map(p => ({ label: p.title, run: () => add(p) })),
...(srv && server(srv) && !mix ? ["-", { head: `Plex playlists · ${server(srv).name}` },
{ label: "New Plex playlist…", run: () => { const n = prompt("Plex playlist name"); if (n?.trim()) toPlex(null, n.trim()); } },
...pls.map(p => ({ label: p.title, run: () => toPlex(p.ratingKey, p.title) }))] : []),
]);
}
function trackMenu(x, y, listId, i) {
@@ -641,7 +800,7 @@ function trackMenu(x, y, listId, i) {
{ label: "Add to queue", run: () => Q.add([listItems[listId]?.[i] || t]) },
"-",
stemItem([t]),
{ label: "Add to stem playlist…", run: () => pickPlaylist(x, y, [t]) },
{ label: "Add to playlist…", run: () => pickPlaylist(x, y, [t]) },
Offline.has(t.id) ? { label: "Remove download", run: () => Offline.remove(t.id).then(() => emit("offline")) }
: { label: "Download for offline", run: () => download([t]) },
(t.albumKey || t.artistKey) && "-",
@@ -651,9 +810,15 @@ function trackMenu(x, y, listId, i) {
pl && Q.cur()?.id === t.id && E.entry && { label: "Use the current mix here", run: () => { pl.items[i].mix = JSON.parse(JSON.stringify(S.mix)); savePlaylists(); route(); } },
pl && pl.items[i].mix && { label: "Clear this item's mix", run: () => { pl.items[i].mix = null; savePlaylists(); route(); } },
pl && { label: "Remove from playlist", run: () => { pl.items.splice(i, 1); pl.updated = Date.now(); savePlaylists(); route(); } },
listId === "playlist" && curPx?.editable && t.pid != null && "-",
listId === "playlist" && curPx?.editable && t.pid != null && { label: "Remove from playlist", run: async () => {
try { await pxSend(curPx.srv, "DELETE", `/playlists/${curPx.key}/items/${t.pid}`); Finder.pls = null; route(); } catch (e) { toast(e.message); }
} },
]);
}
async function leaves(srv, key) { return ((await px(srv, `/library/metadata/${key}/allLeaves`)).Metadata || []).map(m => track(srv, m)); }
// The image's current src plus its fallback (Plex playlist composites often fail to transcode).
const artUrls = im => im ? [im.src, im.getAttribute("data-fb")].filter(u => u && !u.startsWith("data:")) : [];
function listMenu(x, y, get, group = null) {
const run = fn => async () => { try { fn(visible(await get())); } catch (e) { toast(e.message); } };
Menu.open(x, y, [
@@ -663,13 +828,14 @@ function listMenu(x, y, get, group = null) {
{ label: "Add to queue", run: run(ts => Q.add(ts)) },
"-",
{ label: "Stem Now", run: run(ts => stemNow(ts)) },
{ label: "Add to stem playlist…", run: run(ts => pickPlaylist(x, y, ts)) },
{ label: "Add to playlist…", run: run(ts => pickPlaylist(x, y, ts)) },
{ label: "Download for offline", run: run(ts => download(ts, group)) },
]);
}
// ---- views --------------------------------------------------------------------------------------
let curPx = null, pxEdit = null;
let lists = {}, listItems = {}, seq = 0, kick = null, genreCache = null;
const visible = tracks => S.stemFilter ? tracks.filter(t => !!Stems.find(t.t || t) === (S.stemFilter === "stems")) : tracks;
function playFrom(listId, i) {
@@ -680,15 +846,16 @@ function playFrom(listId, i) {
// A broken image tries its fallback (data-fb) once, then shows the placeholder.
const FB = `onerror="if(this.dataset.fb){this.src=this.dataset.fb;this.dataset.fb=''}else{this.onerror=null;this.src='data:image/gif;base64,R0lGODlhAQABAAAAACw='}"`;
function card({ href, img: src, fb, t, s = "", round, kind, srv, key }) {
function card({ href, img: src, fb, t, s = "", round, kind, srv, key, dl }) {
const nk = kind === "album" || kind === "artist" ? nameKey(t) : "";
const hide = nk && !stemSets()[kind].has(nk);
return `<a class="card ${round ? "round" : ""} ${hide ? "nostem" : ""}" href="${href}" ${kind ? `data-kind="${kind}" data-srv="${esc(srv)}" data-key="${esc(key)}"` : ""} ${nk ? `data-nk="${esc(nk)}"` : ""}>
<div class="art">${src ? `<img loading="lazy" decoding="async" src="${esc(src)}" ${fb ? `data-fb="${esc(fb)}"` : ""} ${FB} alt="">` : `<div class="ph"></div>`}${kind ? `<button class="cplay" data-cardplay title="Play">${ICON.play}</button>` : ""}</div><div class="t">${esc(t)}</div><div class="s">${esc(s)}</div></a>`;
return `<a class="card ${round ? "round" : ""} ${hide ? "nostem" : ""}" href="${href}" ${kind ? `data-kind="${kind}" data-srv="${esc(srv)}" data-key="${esc(key)}"` : ""} ${dl != null ? `data-dl="${dl}"` : ""} ${nk ? `data-nk="${esc(nk)}"` : ""}>
<div class="art">${src ? `<img loading="lazy" decoding="async" src="${esc(src)}" ${fb ? `data-fb="${esc(fb)}"` : ""} ${FB} alt="">` : `<div class="ph"></div>`}${kind || dl != null ? `<button class="cplay" data-cardplay title="Play">${ICON.play}</button>` : ""}</div><div class="t">${esc(t)}</div><div class="s">${esc(s)}</div></a>`;
}
// Tracks behind a card, for its play button and right-click menu.
async function cardTracks(c) {
const { kind, srv, key } = c.dataset;
const { kind, srv, key, dl } = c.dataset;
if (dl != null) return lists["dl:" + dl] || [];
if (kind === "playlist") return ((await px(srv, `/playlists/${key}/items`)).Metadata || []).map(m => track(srv, m));
return leaves(srv, key);
}
@@ -717,9 +884,20 @@ const stemsChip = () => `<div class="seg stemfilter">${[["stems", "Stems Only"],
`<button class="${S.stemFilter === v ? "on" : ""}" data-stemfilter="${v}">${l}</button>`).join("")}</div>`;
function sortControl(screen) {
const st = sortState(screen);
return `<div class="sort"><select data-sort="${screen}" title="Sort">${st.opts.map((o, i) => `<option value="${i}" ${i === st.i ? "selected" : ""}>${o[0]}</option>`).join("")}</select>
${st.random ? `<button class="chip" data-reshuffle title="Shuffle again">${ICON.shuffle}</button>`
: `<button class="chip" data-sortdir="${screen}" title="Flip order">${st.desc ? st.o[4] : st.o[3]}</button>`}</div>`;
return `<button class="sortbtn" data-sortmenu="${screen}" title="Sort" aria-haspopup="menu">${ICON.sort}<span>${st.o[0]}</span>` +
`${st.random ? "" : `<small>${st.desc ? st.o[4] : st.o[3]}</small>`}<i class="caret"></i></button>`;
}
// The sort menu: fields with a check on the current one, then the two directions (or reshuffle).
function sortMenu(btn) {
const screen = btn.dataset.sortmenu, st = sortState(screen), r = btn.getBoundingClientRect(), go = f => () => { f(); route(); };
Menu.open(r.left, r.bottom + 6, [
{ head: "Sort by" },
...st.opts.map((o, i) => ({ label: o[0], check: i === st.i, run: go(() => i !== st.i && pickSort(screen, i)) })),
"-",
...(st.random ? [{ label: "Shuffle again", run: () => route() }]
: [{ label: st.o[3], check: !st.desc, run: go(() => pickSort(screen, st.i, false)) }, { label: st.o[4], check: st.desc, run: go(() => pickSort(screen, st.i, true)) }]),
]);
Menu.el.classList.add("sortmenu"); Menu.from = btn;
}
const bar = (title, { sort, filter = true, extra = "" } = {}) =>
`<div class="bar"><h1>${esc(title)}</h1><span class="sub" id="count"></span><span class="grow"></span>${extra}${filter ? stemsChip() : ""}${sort ? sortControl(sort) : ""}</div>`;
@@ -778,21 +956,32 @@ async function genres() {
}
const hue = s => [...s].reduce((h, c) => (h * 31 + c.charCodeAt(0)) % 360, 7);
// Downloads by the album or playlist they came from, newest first. Single songs go under Songs.
// Downloads the way iOS shows them: Playlists, Albums and Artists as card grids, then loose songs.
let dlUrls = [];
const DL_KINDS = [["Playlists", h => !/^#\/(album|artist)\//.test(h)], ["Albums", h => h.startsWith("#/album/")], ["Artists", h => h.startsWith("#/artist/")]];
function dlGroups(recs) {
const by = new Map();
const by = new Map(), loose = [];
for (const r of recs) {
const k = r.group?.href || "";
const k = r.group?.href;
if (!k) { loose.push(r); continue; }
if (!by.has(k)) by.set(k, { g: r.group, recs: [] });
by.get(k).recs.push(r);
}
const gs = [...by.values()].sort((a, b) => !a.g - !b.g);
return gs.map(({ g, recs }, n) => {
if (g) recs.sort((a, b) => a.saved - b.saved);
return `<section class="dlgroup"><div class="bar sm"><h2>${g ? `<a href="${esc(g.href)}">${esc(g.title)}</a>` : "Songs"}</h2>
<span class="sub">${plural(recs.length, "track")}, ${fmtBytes(recs.reduce((a, r) => a + r.size, 0))}</span><span class="grow"></span>
<button class="chip" data-dlgroup="${n}">Remove</button></div>${trackTable("dl:" + n, recs.map(r => r.track))}</section>`;
}).join("");
const gs = [...by.values()];
gs.forEach((x, n) => { x.n = n; x.recs.sort((a, b) => a.saved - b.saved); lists["dl:" + n] = x.recs.map(r => r.track); });
dlUrls.forEach(u => URL.revokeObjectURL(u)); dlUrls = [];
const blobUrl = b => b instanceof Blob ? (dlUrls.push(URL.createObjectURL(b)), dlUrls.at(-1)) : "";
const tile = ({ g, recs, n }) => {
const t = recs[0].track, h = g.href, songs = plural(recs.length, "song");
const art = blobUrl(g.art) || blobUrl(recs.find(r => r.group?.art instanceof Blob)?.group.art) || blobUrl(recs.find(r => r.art)?.art) || artOf(recs.find(r => r.track.thumb)?.track, 300);
const s = h.startsWith("#/album/") ? t.artist || "" : h.startsWith("#/artist/") ? songs : `Playlist · ${songs}`;
return card({ href: esc(h), img: art, t: g.title, s, round: h.startsWith("#/artist/"), dl: n });
};
return DL_KINDS.map(([title, test]) => {
const list = gs.filter(x => test(x.g.href));
return list.length ? `<section class="dlgroup"><div class="bar sm"><h2>${title}</h2></div><div class="grid">${list.map(tile).join("")}</div></section>` : "";
}).join("") + (loose.length ? `<section class="dlgroup"><div class="bar sm"><h2>Other Songs</h2><span class="grow"></span>
<button class="chip" data-dlgroup="loose">Remove</button></div>${trackTable("dl:loose", loose.map(r => r.track))}</section>` : "");
}
// Albums whose original release date falls today (or within three days) in an earlier year.
@@ -945,9 +1134,11 @@ const routes = {
const [srv, key] = splitKey(arg);
const [info, items] = await Promise.all([px(srv, `/playlists/${key}`), px(srv, `/playlists/${key}/items`)]);
if (my !== seq) return;
const p = info.Metadata?.[0] || {}, tracks = sortTracks((items.Metadata || []).map(m => track(srv, m)), sortState("playlist"));
view.innerHTML = hero(img(srv, p.thumb || p.composite, 420), "Playlist", p.title, plural(tracks.length, "track"), "playlist", false, p.composite && rawImg(srv, p.composite, 420))
+ `<div class="bar sm"><span class="grow"></span>${stemsChip()}${sortControl("playlist")}</div>` + trackTable("playlist", tracks);
const p = info.Metadata?.[0] || {}, raw = (items.Metadata || []).map(m => track(srv, m)), tracks = sortTracks(raw, sortState("playlist"));
curPx = { srv, key, title: p.title, editable: !p.smart, raw };
const id = esc(arg), tools = p.smart ? " · Smart playlist" : ` · <button class="link" data-pxedit="${id}">Edit</button> · <button class="link" data-pxrename="${id}">Rename</button> · <button class="link" data-pxdelete="${id}">Delete</button>`;
view.innerHTML = hero(img(srv, p.thumb || p.composite, 420), "Playlist", p.title, plural(tracks.length, "track") + tools, "playlist", false, p.composite && rawImg(srv, p.composite, 420))
+ `<div id="pxbody"><div class="bar sm"><span class="grow"></span>${stemsChip()}${sortControl("playlist")}</div>${trackTable("playlist", tracks)}</div>`;
},
async stemplaylist(my, id) {
const p = playlists.find(x => x.id === id);
@@ -978,10 +1169,11 @@ const routes = {
if (my !== seq) return;
const total = recs.reduce((a, r) => a + r.size, 0);
const est = await navigator.storage?.estimate?.().catch(() => null);
lists["dl:all"] = recs.map(r => r.track);
view.innerHTML = bar("Downloads", { filter: false, extra: recs.length ? `<button class="chip" data-dlclear>Remove all</button>` : "" })
+ `<p class="note">${plural(recs.length, "track")}, ${fmtBytes(total)} stored in this browser${est?.quota ? ` (${fmtBytes(est.usage)} of ${fmtBytes(est.quota)} used)` : ""}.
+ `<p class="note">${plural(recs.length, "song")} · ${fmtBytes(total)} stored in this browser${est?.quota && !isSecureContext ? ` (${fmtBytes(est.usage)} of ${fmtBytes(est.quota)} used)` : ""}.
Downloads play without the network. ${isSecureContext ? "" : "This page isn't on HTTPS, so the browser may clear them when space runs low."}</p>`
+ (recs.length ? dlGroups(recs) : `<p class="empty-msg">Nothing downloaded.</p>`);
+ (recs.length ? actions("dl:all") + dlGroups(recs) : `<p class="empty-msg">Nothing downloaded. Right-click any playlist, album or artist and choose Download for offline.</p>`);
count(recs.length, "track");
},
async stems(my) {
@@ -1003,6 +1195,7 @@ const routes = {
async function route() {
const my = ++seq;
pxEdit = null; curPx = null;
const [, name = "home", ...rest] = (location.hash || "#/home").split("/");
const arg = decodeURIComponent(rest.join("/"));
$$("#nav a").forEach(a => a.classList.toggle("on", a.dataset.nav === name || (a.dataset.nav === "genres" && name === "genre") || (a.dataset.nav === "playlists" && /playlist$/.test(name))));
@@ -1015,11 +1208,6 @@ async function route() {
if (my === seq) marks();
}
addEventListener("hashchange", route);
$("#search").onsubmit = ev => {
ev.preventDefault();
const q = ev.target.q.value.trim();
if (q) location.hash = "#/search/" + encodeURIComponent(q);
};
view.addEventListener("click", async ev => {
const el = ev.target.closest("button, tr[data-list]");
@@ -1031,8 +1219,7 @@ view.addEventListener("click", async ev => {
return ts.length ? Q.playList(ts, 0, false) : toast("Nothing to play");
}
if (ds.stemfilter) { S.stemFilter = S.stemFilter === ds.stemfilter ? "" : ds.stemfilter; save(); applyStemFilter(); return; }
if ("sortdir" in ds) { pickSort(ds.sortdir, sortState(ds.sortdir).i); return route(); }
if ("reshuffle" in ds) return route();
if (ds.sortmenu) return Menu.el ? Menu.close() : sortMenu(el);
if ("add" in ds && row) return Q.add([listItems[row.dataset.list]?.[+row.dataset.i] || lists[row.dataset.list][+row.dataset.i]], ev.shiftKey);
if ("menu" in ds && row) { const r = el.getBoundingClientRect(); return trackMenu(r.left, r.bottom, row.dataset.list, +row.dataset.i); }
if (el === row) return playFrom(row.dataset.list, +row.dataset.i);
@@ -1042,7 +1229,7 @@ view.addEventListener("click", async ev => {
if (!tracks.length) return toast(!all.length ? "Still loading…" : S.stemFilter === "nostems" ? "All of these have stems" : "None of these have stems yet");
return Q.playList(tracks, ds.mode === "shuffle" ? -1 : 0, ds.mode === "shuffle");
}
if (ds.listmenu) { const r = el.getBoundingClientRect(); return listMenu(r.left, r.bottom, async () => listItems[ds.listmenu] || lists[ds.listmenu] || [], { title: $(".hero h1", view)?.textContent || "", href: location.hash }); }
if (ds.listmenu) { const r = el.getBoundingClientRect(); return listMenu(r.left, r.bottom, async () => listItems[ds.listmenu] || lists[ds.listmenu] || [], { title: $(".hero h1", view)?.textContent || "", href: location.hash, art: artUrls($(".hero img.art", view)) }); }
if (ds.station) {
try {
let ts;
@@ -1069,11 +1256,7 @@ view.addEventListener("click", async ev => {
S.stations = S.stations.filter(x => x.id !== ds.rddelete); save();
return route();
}
if (ds.dlgroup) {
const ts = lists["dl:" + ds.dlgroup] || [];
if (confirm(`Remove ${plural(ts.length, "download")}?`)) { for (const t of ts) await Offline.remove(t.id); emit("offline"); route(); }
return;
}
if (ds.dlgroup) return removeDl(ds.dlgroup, "these songs");
if ("shuffleall" in ds) {
const ts = (await new Pager(sources(), secPath, { type: 10, sort: "random" }, 200).next(200)).map(m => track(m._srv, m));
return Q.playList(visible(ts), -1, true);
@@ -1084,19 +1267,92 @@ view.addEventListener("click", async ev => {
const ts = (await Promise.all(albums.map(m => leaves(m._srv, m.ratingKey)))).flat();
return Q.playList(visible(ts), -1, true);
}
if (ds.pxrename && curPx) {
const n = prompt("Rename playlist", curPx.title);
if (n?.trim() && n.trim() !== curPx.title) try { await pxSend(curPx.srv, "PUT", `/playlists/${curPx.key}`, { title: n.trim() }); Finder.pls = null; route(); } catch (e) { toast(e.message); }
return;
}
if (ds.pxdelete && curPx) {
if (confirm(`Delete “${curPx.title}” from Plex? This can't be undone.`)) try { await pxSend(curPx.srv, "DELETE", `/playlists/${curPx.key}`); Finder.pls = null; location.hash = "#/playlists"; } catch (e) { toast(e.message); }
return;
}
if (ds.pxedit && curPx) { pxEdit = { orig: curPx.raw, cur: [...curPx.raw] }; drawPxEdit(); return; }
if ("pxcancel" in ds) { pxEdit = null; route(); return; }
if (ds.pxrm != null && pxEdit) { pxEdit.cur.splice(+ds.pxrm, 1); drawPxEdit(); return; }
if ("pxdone" in ds && pxEdit) { el.disabled = true; await commitPxEdit(); return; }
if ("newpl" in ds) { const n = prompt("Stem playlist name"); if (n?.trim()) { newPlaylist(n.trim()); route(); } return; }
if (ds.plrename) { const p = playlists.find(x => x.id === ds.plrename), n = prompt("Rename", p.title); if (n?.trim()) { p.title = n.trim(); savePlaylists(); route(); } return; }
if (ds.pldelete) { if (confirm("Delete this stem playlist?")) { playlists.splice(playlists.findIndex(x => x.id === ds.pldelete), 1); savePlaylists(); location.hash = "#/playlists"; } return; }
if ("dlclear" in ds) { if (confirm("Remove every download?")) { for (const id of [...Offline.ids]) await Offline.remove(id); emit("offline"); route(); } }
});
view.addEventListener("change", ev => {
const s = ev.target.dataset.sort;
if (s) { pickSort(s, +ev.target.value); route(); }
// ---- Plex playlist edit mode (iOS PlaylistScreens): drag to reorder, remove, then Done ----------
function drawPxEdit() {
const body = $("#pxbody", view);
if (!body || !pxEdit) return;
body.innerHTML = `<div class="bar sm"><span class="note">Drag to reorder</span><span class="grow"></span><button class="chip" data-pxcancel>Cancel</button><button class="chip on" data-pxdone>Done</button></div>
<div class="pxedit">${pxEdit.cur.map((t, i) => `<div class="pxrow" data-i="${i}"><span class="grip" title="Drag">${ICON.queue}</span><img src="${esc(artOf(t, 96))}" alt="" ${FB}><div class="pxt"><b>${esc(t.title)}</b><small>${esc(t.artist)}</small></div><button class="ib bad" data-pxrm="${i}" title="Remove">${ICON.x}</button></div>`).join("") || `<p class="empty-msg">Nothing left. Done will empty the playlist.</p>`}</div>`;
}
// Pointer drag on the grip, so it works with touch too. Only transforms move during the drag.
view.addEventListener("pointerdown", e => {
const g = e.target.closest(".pxrow .grip");
if (!g || !pxEdit) return;
e.preventDefault();
const row = g.parentElement, wrap = row.parentElement, rows = [...wrap.children], from = +row.dataset.i;
const h = row.getBoundingClientRect().height + parseFloat(getComputedStyle(wrap).rowGap || 0), y0 = e.clientY;
let to = from;
row.classList.add("drag"); g.setPointerCapture(e.pointerId);
const move = ev => {
const dy = ev.clientY - y0;
to = Math.max(0, Math.min(rows.length - 1, from + Math.round(dy / h)));
row.style.transform = `translateY(${dy}px)`;
rows.forEach((r, i) => { if (r !== row) r.style.transform = i > from && i <= to ? `translateY(${-h}px)` : i < from && i >= to ? `translateY(${h}px)` : ""; });
};
const up = () => {
g.removeEventListener("pointermove", move); g.removeEventListener("pointerup", up); g.removeEventListener("pointercancel", up);
if (to !== from) pxEdit.cur.splice(to, 0, ...pxEdit.cur.splice(from, 1));
drawPxEdit();
};
g.addEventListener("pointermove", move); g.addEventListener("pointerup", up); g.addEventListener("pointercancel", up);
});
// Removals first, then replay the new order as move-after calls against a simulated list.
async function commitPxEdit() {
const { srv, key } = curPx, keep = new Set(pxEdit.cur.map(t => t.pid));
try {
for (const t of pxEdit.orig) if (!keep.has(t.pid)) await pxSend(srv, "DELETE", `/playlists/${key}/items/${t.pid}`);
const sim = pxEdit.orig.filter(t => keep.has(t.pid)).map(t => t.pid);
for (let i = 0; i < pxEdit.cur.length; i++) {
const pid = pxEdit.cur[i].pid;
if (sim[i] === pid) continue;
const after = i ? pxEdit.cur[i - 1].pid : null;
await pxSend(srv, "PUT", `/playlists/${key}/items/${pid}/move`, { after });
sim.splice(sim.indexOf(pid), 1); sim.splice(i, 0, pid);
}
toast("Playlist saved");
} catch (e) { toast(e.message); }
pxEdit = null; Finder.pls = null; route();
}
async function removeDl(n, what) {
const ts = lists["dl:" + n] || [];
if (!confirm(`Remove ${what} (${plural(ts.length, "download")})? They will no longer play offline.`)) return;
for (const t of ts) await Offline.remove(t.id);
emit("offline"); route();
}
function dlMenu(x, y, n, title) {
const ts = () => lists["dl:" + n] || [];
Menu.open(x, y, [
{ label: "Play", run: () => Q.playList(ts(), 0, false) },
{ label: "Shuffle", run: () => Q.playList(ts(), -1, true) },
{ label: "Play next", run: () => Q.add(ts(), true) },
{ label: "Add to queue", run: () => Q.add(ts()) },
"-",
{ label: "Remove download", run: () => removeDl(n, `“${title}”`) },
]);
}
view.addEventListener("contextmenu", ev => {
const row = ev.target.closest("tr[data-list]"), c = ev.target.closest(".card[data-kind]");
if (row) { ev.preventDefault(); trackMenu(ev.clientX, ev.clientY, row.dataset.list, +row.dataset.i); }
else if (c) { ev.preventDefault(); listMenu(ev.clientX, ev.clientY, () => cardTracks(c), { title: $(".t", c).textContent, href: c.getAttribute("href") }); }
const row = ev.target.closest("tr[data-list]"), c = ev.target.closest(".card[data-kind]"), d = ev.target.closest(".card[data-dl]");
if (d) { ev.preventDefault(); dlMenu(ev.clientX, ev.clientY, d.dataset.dl, $(".t", d).textContent); }
else if (row) { ev.preventDefault(); trackMenu(ev.clientX, ev.clientY, row.dataset.list, +row.dataset.i); }
else if (c) { ev.preventDefault(); listMenu(ev.clientX, ev.clientY, () => cardTracks(c), { title: $(".t", c).textContent, href: c.getAttribute("href"), art: artUrls($("img", c)) }); }
});
// ---- settings -----------------------------------------------------------------------------------
@@ -1105,92 +1361,100 @@ const SECTIONS = [["plex", "Plex"], ["stems", "Stem server"], ["stemopts", "Stem
["offline", "Offline"], ["backup", "Backup"], ["keys", "Keys"], ["about", "About"]];
const BAR = [["speed", "Speed"], ["mixer", "Mixer"], ["lyrics", "Lyrics"], ["queue", "Queue"]];
// Settings rows: label on the left, control on the right, grouped into cards.
const srow = (title, ctrl, sub = "") => `<div class="sr"><div class="sl"><span>${title}</span>${sub ? `<small>${sub}</small>` : ""}</div><div class="sc">${ctrl}</div></div>`;
const stog = (title, input, sub = "") => `<label class="sr"><div class="sl"><span>${title}</span>${sub ? `<small>${sub}</small>` : ""}</div><div class="sc">${input}</div></label>`;
const sw = (attrs, on) => `<input type="checkbox" class="sw" ${attrs} ${on ? "checked" : ""}>`;
function presetEditor() {
const ps = presets(), lock = S.lockedPreset && allPresets().find(p => p.id === S.lockedPreset);
return `<h3>Locked</h3>
${lock ? `<div class="prow"><span class="pn">${ICON.lock}${esc(presetLabel(lock.name))}</span><span class="grow"></span><button class="btn small" data-plock="${esc(lock.id)}">Unlock</button></div>` : `<p class="note">Nothing locked.</p>`}
<h3>Mixer Bar</h3><div class="plist">${ps.map((p, i) => `<div class="prow"><span class="pn">${esc(presetLabel(p.name))}${p.custom ? ' <span class="tag">CUSTOM</span>' : ""}</span><span class="grow"></span>
<button class="btn small ${lock?.id === p.id ? "on" : ""}" data-plock="${esc(p.id)}" title="${lock?.id === p.id ? "Unlock" : "Lock"}">${ICON.lock}</button>
<button class="btn small" data-pmove="${esc(p.id)}" data-pdir="-1" ${i ? "" : "disabled"} title="Move up">↑</button>
<button class="btn small" data-pmove="${esc(p.id)}" data-pdir="1" ${i < ps.length - 1 ? "" : "disabled"} title="Move down">↓</button>
<button class="btn small" data-pdel="${esc(p.id)}" ${p.id === "b:Full Mix" ? "disabled" : ""} title="Delete">×</button></div>`).join("")}</div>
<h3>Stems</h3><div class="row">
<button class="btn small" data-padd ${mixNames().length ? "" : "disabled"} title="Play a song with stems to save its mix">Save the current mix as a preset</button>
<button class="btn small" data-prestore ${S.hiddenPresets.length ? "" : "disabled"}>Restore Deleted Presets</button>
<button class="btn small" data-pclear ${S.customPresets.length ? "" : "disabled"}>Delete All Custom Presets</button></div>`;
return `<div class="sg">${srow("Locked preset", lock
? `<span class="val">${ICON.lock}${esc(presetLabel(lock.name))}</span><button class="btn small" data-plock="${esc(lock.id)}">Unlock</button>`
: `<span class="val dim">None</span>`)}</div>
<h3 class="sgh">Mixer bar</h3>
<div class="sg">${ps.map((p, i) => `<div class="sr"><div class="sl"><span>${esc(presetLabel(p.name))}${p.custom ? ' <span class="tag">CUSTOM</span>' : ""}</span></div><div class="sc ibs">
<button class="ib ${lock?.id === p.id ? "on" : ""}" data-plock="${esc(p.id)}" title="${lock?.id === p.id ? "Unlock" : "Lock"}">${ICON.lock}</button>
<button class="ib" data-pmove="${esc(p.id)}" data-pdir="-1" ${i ? "" : "disabled"} title="Move up">${ICON.up}</button>
<button class="ib" data-pmove="${esc(p.id)}" data-pdir="1" ${i < ps.length - 1 ? "" : "disabled"} title="Move down">${ICON.down}</button>
<button class="ib bad" data-pdel="${esc(p.id)}" ${p.id === "b:Full Mix" ? "disabled" : ""} title="Delete">${ICON.x}</button></div></div>`).join("")}</div>
<div class="sg">
<button class="sr act" data-padd ${mixNames().length ? "" : "disabled"}>Save current mix as preset</button>
<button class="sr act" data-prestore ${S.hiddenPresets.length ? "" : "disabled"}>Restore deleted presets</button>
<button class="sr act bad" data-pclear ${S.customPresets.length ? "" : "disabled"}>Delete all custom presets</button></div>`;
}
on("presets", () => { const el = $("#pedit"); if (el) el.innerHTML = presetEditor(); });
const FORMATS = [["opus96", "Opus 96 kbps"], ["opus160", "Opus 160 kbps"], ["opus256", "Opus 256 kbps"], ["flac", "FLAC (original)"]];
function serverHtml(srv) {
const dup = srv.mid && S.servers.find(o => o !== srv && o.mid === srv.mid && S.servers.indexOf(o) < S.servers.indexOf(srv));
return `<div class="srv"><div class="row"><b>${esc(srv.name || srv.url)}</b>
<span class="note">${srv.env ? "through this stemserve (PLEX_URL)" : esc(srv.url)}</span><span class="grow"></span>
const secs = srv.sections || [];
return `<div class="sr srv"><div class="sl"><span>${esc(srv.name || srv.url)}</span><small>${srv.env ? "Through stemserve" : esc(srv.url)}</small></div><div class="sc">
<button class="btn small" data-refsrv="${esc(srv.id)}">Refresh</button>
${srv.env ? "" : `<button class="btn small" data-rmsrv="${esc(srv.id)}">Remove</button>`}</div>
${dup ? `<p class="note">Same Plex server as ${esc(dup.name)}, which is used instead.</p>`
: (srv.sections || []).length ? `<div class="secs">${srv.sections.map(sec => `<label class="check"><input type="checkbox" data-sec="${esc(srv.id)}|${esc(sec.key)}" ${sec.on ? "checked" : ""}>${esc(sec.title)}</label>`).join("")}</div>`
: `<p class="note">No music libraries found. Try Refresh.</p>`}</div>`;
<div class="libs">${dup ? `<small>Duplicate of ${esc(dup.name)}</small>`
: secs.length ? secs.map(sec => `<label class="lib"><input type="checkbox" data-sec="${esc(srv.id)}|${esc(sec.key)}" ${sec.on ? "checked" : ""}>${esc(sec.title)}</label>`).join("")
: `<small>No music libraries</small>`}</div></div>`;
}
const KEYS = [["Space", "Play / pause"], ["← →", "Seek 5 s"], ["⇧ ← →", "Seek 30 s"], ["S", "Search"], ["⇧ S", "Shuffle"], ["R", "Repeat"], ["[ ]", "Speed"],
["M", "Mixer"], ["L", "Lyrics"], ["Q", "Queue"], ["K", "Karaoke"], ["P", "Next preset"]];
function renderSettings() {
const theme = THEMES[S.theme] || THEMES.graphite;
const nMix = Object.keys(songMixes).length;
view.innerHTML = `<div class="settings"><nav class="toc">${SECTIONS.map(([id, l]) => `<a href="#/settings" data-jump="${id}">${l}</a>`).join("")}</nav><div class="panes">
<h1>Settings</h1>
<section id="set-plex"><h2>Plex</h2>
<div id="srvs">${S.servers.map(serverHtml).join("") || `<p class="note">No servers yet.</p>`}</div>
<div class="row"><button class="btn primary" id="signin">Sign in with Plex</button><span class="note" id="sstatus"></span></div>
<details><summary class="note">Add a server by URL and token</summary><div class="form">
<label>Server URL<input type="url" id="purl" placeholder="http://10.0.0.2:32400"></label>
<label>Token<input type="password" id="ptok"></label>
<div class="row"><button class="btn" id="padd">Add server</button></div></div></details>
<div class="sg">${S.servers.map(serverHtml).join("") || srow(`<span class="dim">No servers</span>`, "")}
${srow(`<span class="dim" id="sstatus"></span>`, `<button class="btn primary small" id="signin">Sign in with Plex</button>`)}</div>
<details class="sg"><summary class="sr"><div class="sl"><span>Add by URL and token</span></div><div class="sc chev">${ICON.down}</div></summary>
${srow("Server URL", `<input type="url" id="purl" placeholder="http://10.0.0.2:32400">`)}
${srow("Token", `<input type="password" id="ptok">`)}
<div class="sr end"><button class="btn small" id="padd">Add server</button></div></details>
</section>
<section id="set-stems"><h2>Stem server</h2><div class="form">
<p class="note" id="stem-info">Checking stemserve…</p>
<label>URL (blank = this page's server)<input type="url" id="surl" placeholder="${esc(location.origin)}" value="${esc(S.stemUrl)}"></label>
<label>Token (if stemserve has TOKEN set)<input type="password" id="stok" value="${esc(S.stemToken)}"></label>
<div class="row"><button class="btn" id="ssave">Save and reconnect</button></div></div>
<section id="set-stems"><h2>Stem server</h2><div class="sg">
${srow("Status", `<span class="stat" id="stem-info">Checking…</span>`)}
${srow("URL", `<input type="url" id="surl" placeholder="${esc(location.origin)}" value="${esc(S.stemUrl)}">`)}
${srow("Token", `<input type="password" id="stok" value="${esc(S.stemToken)}" placeholder="None">`)}
<div class="sr end"><button class="btn small" id="ssave">Save and reconnect</button></div></div>
</section>
<section id="set-stemopts"><h2>Stems</h2><div class="form">
<label>Stem format<select id="fmt">${FORMATS.map(([v, l]) => `<option value="${v}" ${S.fmt === v ? "selected" : ""}>${l}</option>`).join("")}</select></label>
<label>Cache Ahead<div class="row"><input type="range" id="precache" min="0" max="50" step="1" value="${S.precache}"><input type="number" id="precachen" min="0" max="50" value="${S.precache}"> songs</div></label>
<label class="check"><input type="checkbox" id="keepmix" ${S.keepMix ? "checked" : ""}>Keep Stem Mix Between Songs</label>
<div class="row"><span class="note">${plural(Object.keys(songMixes).length, "saved song mix")}</span>${Object.keys(songMixes).length ? `<button class="btn small" id="forgetall">Forget all</button>` : ""}</div></div>
<section id="set-stemopts"><h2>Stems</h2><div class="sg">
${srow("Format", `<select id="fmt">${FORMATS.map(([v, l]) => `<option value="${v}" ${S.fmt === v ? "selected" : ""}>${l}</option>`).join("")}</select>`)}
${srow("Cache ahead", `<input type="range" id="precache" min="0" max="50" step="1" value="${S.precache}"><input type="number" id="precachen" min="0" max="50" value="${S.precache}"><span class="dim">songs</span>`)}
${stog("Keep mix between songs", sw(`id="keepmix"`, S.keepMix))}
${srow("Saved song mixes", `<span class="val">${nMix}</span>${nMix ? `<button class="btn small" id="forgetall">Forget all</button>` : ""}`)}</div>
</section>
<section id="set-presets"><h2>Stem Editor</h2><div id="pedit">${presetEditor()}</div></section>
<section id="set-karaoke"><h2>Karaoke</h2><div class="form">
<label class="check"><input type="checkbox" id="kon" ${S.karaoke ? "checked" : ""}>Karaoke on (K)</label>
<label>Vocals in karaoke<select id="kmode">${[["off", "Off"], ["soft", "Soft"], ["on", "Left on (lyrics only)"]].map(([v, l]) => `<option value="${v}" ${S.karaokeMode === v ? "selected" : ""}>${l}</option>`).join("")}</select></label>
<label>Soft vocal level: <span id="kdbv">${S.softDb} dB</span><input type="range" id="kdb" min="-30" max="-3" step="1" value="${S.softDb}"></label></div>
<section id="set-karaoke"><h2>Karaoke</h2><div class="sg">
${stog(`Karaoke <kbd>K</kbd>`, sw(`id="kon"`, S.karaoke))}
${srow("Vocals", `<select id="kmode">${[["off", "Off"], ["soft", "Soft"], ["on", "Left on (lyrics only)"]].map(([v, l]) => `<option value="${v}" ${S.karaokeMode === v ? "selected" : ""}>${l}</option>`).join("")}</select>`)}
${srow("Soft vocal level", `<input type="range" id="kdb" min="-30" max="-3" step="1" value="${S.softDb}"><span class="val num" id="kdbv">${S.softDb} dB</span>`)}</div>
</section>
<section id="set-look"><h2>Appearance</h2><div class="form">
<div class="themes">${Object.entries(THEMES).map(([k, t]) => `<button class="swatch ${S.theme === k ? "on" : ""}" data-theme="${k}" style="background:${t.bg};color:${t.text};border-color:${t.line}"><i style="background:${t.accent}"></i>${k[0].toUpperCase() + k.slice(1)}</button>`).join("")}</div>
<div class="row"><label class="check">Accent <input type="color" id="accent" value="${S.accent || theme.accent}"></label>${S.accent ? `<button class="btn small" id="accentreset">Use the theme's</button>` : ""}</div>
<label class="check"><input type="checkbox" id="acapella" ${S.acapella ? "checked" : ""}>Spell the vocals-only preset “Acapella”</label>
<div class="row"><span class="note">Player bar</span>${BAR.map(([k, l]) => `<label class="check"><input type="checkbox" data-bar="${k}" ${S.bar[k] ? "checked" : ""}>${l}</label>`).join("")}</div>
<label>Custom CSS<textarea id="css" rows="8" spellcheck="false" placeholder=":root { --accent: #7cf; --radius: 4px; }\n.card img { border-radius: 0; }">${esc(S.css)}</textarea></label>
<p class="note">--bg --panel --raised --line --text --muted --accent --accent-ink --radius --wave --wave-ghost</p></div>
<section id="set-look"><h2>Appearance</h2>
<div class="sg"><div class="sr col"><div class="sl"><span>Theme</span></div>
<div class="themes">${Object.entries(THEMES).map(([k, t]) => `<button class="tcard ${S.theme === k ? "on" : ""}" data-theme="${k}">
<span class="tmock" style="background:${t.bg};border-color:${t.line}"><i style="background:${t.text}"></i>${"<b></b>".repeat(3).replaceAll("<b>", `<b style="background:${t.raised === t.bg ? t.panel : t.raised}">`)}<u style="background:${accentOf(t)}"></u></span>${t.label}</button>`).join("")}</div></div>
<div class="sr col"><div class="sl"><span>Accent</span><small>${(ACCENTS[S.accent] || ACCENTS.music)[0]}</small></div>
<div class="accents">${Object.entries(ACCENTS).map(([k, [l]]) => `<button class="dot ${(ACCENTS[S.accent] ? S.accent : "music") === k ? "on" : ""}" data-accent="${k}" title="${l}" aria-label="${l}" style="--c:${accentOf(THEMES[S.theme] || THEMES.dark, k)}"></button>`).join("")}</div></div>
${stog("Match album art", sw(`id="arttheme"`, S.artTheme))}
${stog("Call the vocals-only preset “Acapella”", sw(`id="acapella"`, S.acapella))}</div>
<h3 class="sgh">Player bar</h3>
<div class="sg">${BAR.map(([k, l]) => stog(l, sw(`data-bar="${k}"`, S.bar[k]))).join("")}</div>
<h3 class="sgh">Custom CSS</h3>
<div class="sg"><div class="sr col"><textarea id="css" rows="7" spellcheck="false" placeholder=":root { --accent: #7cf; --radius: 4px; }\n.card img { border-radius: 0; }">${esc(S.css)}</textarea>
<small class="mono">--bg --panel --raised --line --text --muted --accent --accent-ink --radius --wave --wave-ghost</small></div></div>
</section>
<section id="set-offline"><h2>Offline</h2>
<p class="note" id="storage-info">${plural(Offline.ids.size, "track")} downloaded. <a class="link" href="#/downloads">Manage downloads</a></p>
${isSecureContext && navigator.storage?.persist ? `<div class="row"><button class="btn small" id="persist">Ask the browser to keep downloads</button></div>` : ""}
<section id="set-offline"><h2>Offline</h2><div class="sg">
${srow("Downloads", `<span class="val" id="storage-info">${plural(Offline.ids.size, "track")}</span><a class="btn small" href="#/downloads">Manage</a>`)}
${isSecureContext && navigator.storage?.persist ? srow("Keep downloads", `<button class="btn small" id="persist">Ask browser</button>`) : ""}</div>
</section>
<section id="set-backup"><h2>Backup</h2>
<p class="note">Includes your Plex tokens.</p>
<div class="row"><button class="btn" id="export">Export</button><label class="btn">Import<input type="file" id="import" accept="application/json" hidden></label></div>
<section id="set-backup"><h2>Backup</h2><div class="sg">
${srow("Settings, mixes and playlists", `<button class="btn small" id="export">Export</button><label class="btn small">Import<input type="file" id="import" accept="application/json" hidden></label>`, "Includes your Plex tokens")}</div>
</section>
<section id="set-keys"><h2>Keys</h2><p class="note">Space play/pause · ←/→ seek 5s (shift 30s) · S shuffle · R repeat · [ ] speed · M mixer · L lyrics · Q queue · K karaoke · P next preset · hold Next to skip the album · right-click a song or album for more</p></section>
<section id="set-about"><h2>About</h2>
<p><b>Stemify</b> <span class="note" id="about-ver"></span></p>
<p class="note">Your Plex and Jellyfin music, split into stems you can mix.</p>
<div class="people">
<div class="person"><b>Chris Nutter</b><span class="note">Stemify WebUI and the iOS app</span><div class="row">
<a class="btn small" href="https://iamchrisama.com" target="_blank" rel="noopener">iamchrisama.com</a>
<a class="btn small" href="https://buymeacoffee.com/cdnutter" target="_blank" rel="noopener">Buy Me a Coffee</a></div></div>
<div class="person"><b>Kevin Viers</b><span class="note">stemd and the Android app</span><div class="row">
<a class="btn small" href="https://github.com/kevinViers/" target="_blank" rel="noopener">GitHub</a>
<a class="btn small" href="https://venmo.com/code?user_id=2910252785729536546&amp;created=1792897467" target="_blank" rel="noopener">Venmo</a></div></div>
</div>
<p class="note">Stemify is free. A tip goes straight to the person you pick.</p>
<section id="set-keys"><h2>Keys</h2><div class="sg"><div class="keys">${KEYS.map(([k, l]) => `<div><span>${l}</span>${k.split(" ").map(x => `<kbd>${x}</kbd>`).join("")}</div>`).join("")}</div></div></section>
<section id="set-about"><h2>About</h2><div class="sg">
${srow("Stemify", `<span class="val dim" id="about-ver"></span>`, "Your Plex and Jellyfin music, split into stems you can mix")}
${srow("Chris Nutter", `<a class="btn small" href="https://iamchrisama.com" target="_blank" rel="noopener">Website</a><a class="btn small" href="https://buymeacoffee.com/cdnutter" target="_blank" rel="noopener">Buy Me a Coffee</a>`, "Web UI and iOS app")}
${srow("Kevin Viers", `<a class="btn small" href="https://github.com/kevinViers/" target="_blank" rel="noopener">GitHub</a><a class="btn small" href="https://venmo.com/code?user_id=2910252785729536546&amp;created=1792897467" target="_blank" rel="noopener">Venmo</a>`, "stemd and Android app")}</div>
</section>
</div></div>`;
@@ -1199,9 +1463,16 @@ function renderSettings() {
const el = $("#stem-info");
const v = $("#about-ver");
if (v && info) v.textContent = `stemserve v${info.version}`;
if (el) el.textContent = info ? `stemserve v${info.version} at ${stemBase()}, ${info.tracks} tracks with stems${info.ffmpeg ? ", Opus available" : ""}.` : `Can't reach stemserve at ${stemBase()}.`;
if (el) { el.textContent = info ? `v${info.version} · ${info.tracks} tracks${info.ffmpeg ? " · Opus" : ""}` : "Unreachable"; el.classList.add(info ? "ok" : "bad"); }
});
navigator.storage?.estimate?.().then(e => { const el = $("#storage-info"); if (el && e?.quota) el.insertAdjacentText("afterbegin", `${fmtBytes(e.usage)} of ${fmtBytes(e.quota)} used. `); }).catch(() => {});
navigator.storage?.estimate?.().then(e => { const el = $("#storage-info"); if (el && e?.quota) el.insertAdjacentText("beforeend", ` · ${fmtBytes(e.usage)} of ${fmtBytes(e.quota)}`); }).catch(() => {});
// The section in view lights up in the side list.
const toc = [...view.querySelectorAll(".toc a")];
const spy = new IntersectionObserver(es => {
for (const e of es) if (e.isIntersecting) for (const a of toc) a.classList.toggle("on", "set-" + a.dataset.jump === e.target.id);
}, { root: view, rootMargin: "0px 0px -70% 0px" });
view.querySelectorAll(".panes section").forEach(s => spy.observe(s));
const again = () => { if (location.hash.startsWith("#/settings")) renderSettings(); };
const plexChanged = () => { genreCache = null; save(); };
@@ -1226,14 +1497,13 @@ function renderSettings() {
const ahead = v => { S.precache = Math.max(0, Math.min(50, Math.round(+v || 0))); $("#precache").value = $("#precachen").value = S.precache; save(); };
$("#precache").oninput = ev => ahead(ev.target.value);
$("#precachen").onchange = ev => ahead(ev.target.value);
$("#arttheme").onchange = ev => { S.artTheme = ev.target.checked; save(); ArtTheme.set(S.artTheme ? artOf(Q.cur(), 64) : ""); };
$("#acapella").onchange = ev => { S.acapella = ev.target.checked; save(); emit("presets"); emit("mix"); };
if ($("#forgetall")) $("#forgetall").onclick = () => { for (const k of Object.keys(songMixes)) forgetSongMix(k); again(); };
$("#kon").onchange = ev => setKaraoke(ev.target.checked);
$("#kmode").onchange = ev => setKaraokeMode(ev.target.value);
$("#kdb").oninput = ev => { $("#kdbv").textContent = ev.target.value + " dB"; };
$("#kdb").onchange = ev => setKaraokeMode(S.karaokeMode, +ev.target.value);
$("#accent").oninput = ev => { S.accent = ev.target.value; applyTheme(); save(); };
if ($("#accentreset")) $("#accentreset").onclick = () => { S.accent = ""; applyTheme(); save(); again(); };
let cssTimer;
$("#css").oninput = ev => { clearTimeout(cssTimer); cssTimer = setTimeout(() => { S.css = ev.target.value; applyTheme(); save(); }, 250); };
if ($("#persist")) $("#persist").onclick = async () => toast(await navigator.storage.persist() ? "Downloads will be kept" : "The browser said no");
@@ -1254,11 +1524,12 @@ function renderSettings() {
};
const sv = $(".settings");
sv.addEventListener("click", async ev => {
const b = ev.target.closest("[data-jump], [data-theme], [data-refsrv], [data-rmsrv], [data-plock], [data-pmove], [data-pdel], [data-padd], [data-prestore], [data-pclear]");
const b = ev.target.closest("[data-jump], [data-theme], [data-accent], [data-refsrv], [data-rmsrv], [data-plock], [data-pmove], [data-pdel], [data-padd], [data-prestore], [data-pclear]");
if (!b) return;
const ds = b.dataset;
if (ds.jump) { ev.preventDefault(); $("#set-" + ds.jump).scrollIntoView({ behavior: "smooth" }); }
else if (ds.theme) { S.theme = ds.theme; S.accent = ""; applyTheme(); save(); again(); }
if (ds.jump) { ev.preventDefault(); $("#set-" + ds.jump).scrollIntoView({ behavior: "smooth", block: "start" }); }
else if (ds.theme) { S.theme = ds.theme; applyTheme(); save(); again(); }
else if (ds.accent) { S.accent = ds.accent; applyTheme(); save(); again(); }
else if (ds.refsrv) { try { await refreshServer(server(ds.refsrv)); toast("Refreshed"); } catch (e) { toast(e.message); } plexChanged(); again(); }
else if (ds.rmsrv && confirm("Remove this server?")) { S.servers = S.servers.filter(s => s.id !== ds.rmsrv); plexChanged(); again(); }
else if (ds.plock) toggleLock(ds.plock, mixNames());
+2 -3
View File
@@ -12,8 +12,7 @@
<body>
<div id="app">
<aside id="nav">
<div class="brand">stemify</div>
<form id="search"><input type="search" name="q" placeholder="Search" autocomplete="off"></form>
<div class="navtop"><div class="brand">stemify</div><button id="b-search" title="Search (S)" aria-label="Search"></button></div>
<a href="#/home" data-nav="home"><svg viewBox="0 0 24 24"><path d="M12 3l9 7.5V21h-6.5v-6h-5v6H3V10.5L12 3zm0 2.6L5 11.4V19h2.5v-6h9v6H19v-7.6l-7-5.8z"/></svg>Home</a>
<a href="#/albums" data-nav="albums"><svg viewBox="0 0 24 24"><path d="M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>Albums</a>
<a href="#/artists" data-nav="artists"><svg viewBox="0 0 24 24"><path d="M12 3a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9zm0 2a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zm0 8c4.4 0 8 2.2 8 5v3H4v-3c0-2.8 3.6-5 8-5zm0 2c-3.4 0-6 1.6-6 3v1h12v-1c0-1.4-2.6-3-6-3z"/></svg>Artists</a>
@@ -38,7 +37,7 @@
</div>
<div class="center">
<div class="transport">
<button id="b-shuffle" class="side" title="Shuffle (S)"></button>
<button id="b-shuffle" class="side" title="Shuffle (Shift+S)"></button>
<button id="b-prev" title="Previous"></button>
<button id="b-play" class="play" title="Play (Space)"></button>
<button id="b-next" title="Next (hold to skip the album)"></button>
+10 -2
View File
@@ -5,7 +5,7 @@
import { S, save, songMixes, Offline } from "./store.js";
import { Stems, api } from "./stems.js";
import { partUrl } from "./plex.js";
import { partUrl, img } from "./plex.js";
import { emit, load, store, shuffled, toast, clone } from "./util.js";
// ---- mix -------------------------------------------------------------------------------------
@@ -547,8 +547,15 @@ export const Radio = {
// ---- offline ----------------------------------------------------------------------------------
// group: the album or playlist these came from, {title, href}, so Downloads can list them that way.
// Art is stored as Blobs with the songs so Downloads shows it with no network.
const artBlob = url => url && !url.startsWith("data:") ? fetch(url).then(r => r.ok ? r.blob() : null).catch(() => null) : null;
export async function saveOffline(tracks, onStatus, group = null) {
let n = 0;
if (group?.art && !(group.art instanceof Blob)) {
let blob = null;
for (const u of [group.art].flat()) if ((blob = await artBlob(u))) break;
group = { ...group, art: blob };
}
for (const t of tracks) {
if (Offline.has(t.id)) continue;
onStatus?.(`Downloading ${++n} of ${tracks.length}: ${t.title}`);
@@ -566,7 +573,8 @@ export async function saveOffline(tracks, onStatus, group = null) {
blobs = { file: await r.blob() };
}
const size = Object.values(blobs).reduce((a, b) => a + b.size, 0);
await Offline.put({ id: t.id, track: t, entry, fmt: entry ? S.fmt : "original", size, peaks: peaks?.stems || null, blobs, group, saved: Date.now() });
const art = await artBlob(t.srv && t.thumb ? img(t.srv, t.thumb, 300) : "");
await Offline.put({ id: t.id, track: t, entry, art, fmt: entry ? S.fmt : "original", size, peaks: peaks?.stems || null, blobs, group, saved: Date.now() });
} catch (e) { toast(`Couldn't download “${t.title}”: ${e.message}`); }
}
emit("offline");
+19 -1
View File
@@ -23,6 +23,24 @@ export async function px(srv, path, params = {}) {
return (await r.json()).MediaContainer || {};
}
// Writes (playlist edits). Plex answers some of these with an empty body.
export async function pxSend(srv, method, path, params = {}) {
if (typeof srv === "string") srv = server(srv);
if (!srv) throw new Error("That Plex server isn't set up any more");
const u = new URL(srv.url + path, location.href);
for (const [k, v] of Object.entries(params)) if (v != null) u.searchParams.set(k, v);
const r = await fetch(u, { method, headers: headers(srv.token), signal: AbortSignal.timeout(15000) });
if (!r.ok) throw new Error(`Plex ${r.status} from ${srv.name}`);
const txt = await r.text();
try { return JSON.parse(txt).MediaContainer || {}; } catch { return {}; }
}
// The library uri Plex playlists take for a set of items, like iOS PlexServer.itemsURI.
export async function plexUri(srv, keys) {
if (typeof srv === "string") srv = server(srv);
if (!srv.mid) srv.mid = (await px(srv, "/identity")).machineIdentifier;
return `server://${srv.mid}/com.plexapp.plugins.library/library/metadata/${keys.join(",")}`;
}
export function img(srvId, thumb, size = 300) {
const s = server(srvId);
if (!thumb || !s) return "";
@@ -49,7 +67,7 @@ export function track(srvId, m) {
title: m.title, artist: m.originalTitle || m.grandparentTitle || "", album: m.parentTitle || "",
albumKey: m.parentRatingKey, artistKey: m.grandparentRatingKey,
thumb: m.thumb || m.parentThumb || m.grandparentThumb, duration: m.duration || part?.duration || 0,
part: part?.key, file: part?.file, index: m.index,
part: part?.key, file: part?.file, index: m.index, pid: m.playlistItemID,
meta: { titleSort: m.titleSort, addedAt: m.addedAt, lastViewedAt: m.lastViewedAt, viewCount: m.viewCount, userRating: m.userRating },
};
}
+15 -1
View File
@@ -24,11 +24,25 @@ export const S = Object.assign({
acapella: false, // spell "A Cappella" as "Acapella"
bar: { speed: true, mixer: true, lyrics: true, queue: true }, // player bar buttons
stations: [], // web radio: [{id, name, url}]
theme: "graphite", accent: "", css: "", sideArt: false,
theme: "dark", accent: "music", css: "", sideArt: false, artTheme: false,
}, load(KEY) || {});
if (!S.clientId) S.clientId = uuid();
if (!S.ui2) { if (S.theme === "amber" && !S.accent) S.theme = "graphite"; S.ui2 = true; }
// Before the iOS-style appearance: eight preset themes and a free accent color.
if (!["black", "dark", "white"].includes(S.theme)) {
const old = S.theme, hues = { music: 353, pink: 349, orange: 35, yellow: 48, green: 135, teal: 189, blue: 211, indigo: 241, purple: 280 };
S.theme = old === "oled" ? "black" : old === "light" ? "white" : "dark";
let h = { graphite: 216, amber: 39, ocean: 201, rose: 340, forest: 142, mono: 211, oled: 39, light: 37 }[old] ?? 211;
const m = /^#([0-9a-f]{6})$/i.exec(S.accent || "");
if (m) {
const n = parseInt(m[1], 16), r = (n >> 16) / 255, g = (n >> 8 & 255) / 255, b = (n & 255) / 255, mx = Math.max(r, g, b), c = mx - Math.min(r, g, b);
if (c > 0.05) h = 60 * (mx === r ? ((g - b) / c + 6) % 6 : mx === g ? (b - r) / c + 2 : (r - g) / c + 4);
}
const d = x => Math.min(Math.abs(x - h), 360 - Math.abs(x - h));
S.accent = Object.keys(hues).sort((a, b) => d(hues[a]) - d(hues[b]))[0];
}
if (!S.accent || S.accent[0] === "#") S.accent = "music";
if (S.fmt.startsWith("opus") && !new Audio().canPlayType('audio/ogg; codecs="opus"')) S.fmt = "flac";
// Before multiple servers there was one S.plex and one S.section.
+171 -40
View File
@@ -8,7 +8,7 @@
--accent: #3a81ed;
--accent-ink: #ffffff;
--radius: 6px;
--player-h: 90px;
--player-h: 100px;
--nav-w: 240px;
--glass: #101010ee;
--hover: #e7e7e70d;
@@ -41,8 +41,11 @@ svg { width: 1em; height: 1em; fill: currentColor; display: block; }
#nav a svg { width: 18px; height: 18px; flex: none; }
#nav a:hover { color: var(--text); background: var(--hover); }
#nav a.on { background: var(--raised); color: var(--text); }
#search input { width: 100%; margin: 10px 0; padding: 7px 10px; background: var(--raised); border: 1px solid transparent; border-radius: 4px; outline: none; }
#search input:focus { border-color: var(--accent); }
.navtop { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; }
.navtop .brand { padding-bottom: 0; }
#b-search { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex: none; }
#b-search:hover { color: var(--text); background: var(--hover); }
#b-search svg { width: 18px; height: 18px; fill: currentColor; }
.settings-link { margin-top: 2px; }
#sideart { display: none; position: sticky; bottom: 0; z-index: 2; margin-top: auto; padding: 10px 0 12px; background: var(--panel); }
#sideart::before { content: ""; position: absolute; left: -10px; right: -10px; bottom: 100%; height: 28px; pointer-events: none; background: linear-gradient(to top, var(--panel), transparent); }
@@ -75,7 +78,7 @@ select, textarea, input[type=text], input[type=url], input[type=password] { back
.card.round img, .card.round .ph { border-radius: 50%; }
.cplay { position: absolute; right: 8px; bottom: 8px; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
display: grid; place-items: center; font-size: 17px; box-shadow: 0 6px 16px #0008; opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; }
.cplay svg { margin-left: 2px; }
.card:hover .cplay, .cplay:focus-visible { opacity: 1; transform: none; }
.cplay:hover { transform: scale(1.06) !important; }
.card .t { margin-top: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@@ -96,7 +99,7 @@ select, textarea, input[type=text], input[type=url], input[type=password] { back
.actions { display: flex; gap: 14px; align-items: center; margin: 4px 0 6px; padding: 14px 0; }
.bigplay { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 22px;
box-shadow: 0 6px 18px #0006; transition: transform .1s, filter .15s; }
.bigplay svg { margin-left: 3px; }
.bigplay:hover { transform: scale(1.05); filter: brightness(1.1); }
.ibtn { color: var(--muted); font-size: 22px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.ibtn:hover { color: var(--text); }
@@ -124,9 +127,9 @@ select, textarea, input[type=text], input[type=url], input[type=password] { back
.tracks .acts button { opacity: 0; color: var(--muted); font-size: 18px; width: 26px; height: 26px; border-radius: 6px; display: inline-grid; place-items: center; vertical-align: middle; }
.tracks tr:hover .acts button { opacity: 1; }
.tracks .acts button:hover { color: var(--text); background: var(--raised); }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--muted); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 8px; vertical-align: 1px; }
.tag.nostems { color: var(--muted); opacity: .8; }
body.stems-ready .card.nostem .t::after { content: "NO STEMS"; font-size: 9px; font-weight: 700; letter-spacing: .05em; color: var(--muted); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; }
.tag { display: inline-flex; align-items: center; height: 15px; font-size: 9px; line-height: 1; font-weight: 700; letter-spacing: .06em; color: var(--muted); border: 1px solid color-mix(in srgb, currentColor 55%, transparent); border-radius: 4px; padding: 0 4px; margin-left: 8px; vertical-align: 2px; white-space: nowrap; }
.tag.nostems { color: var(--muted); }
body.stems-ready .card.nostem .s::before { content: "NO STEMS"; display: inline-flex; align-items: center; height: 14px; font-size: 8.5px; line-height: 1; font-weight: 700; letter-spacing: .06em; color: var(--muted); border: 1px solid color-mix(in srgb, currentColor 55%, transparent); border-radius: 4px; padding: 0 4px; margin-right: 6px; vertical-align: 1px; }
.tag.queued { color: var(--muted); }
.tag.stemming { color: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.tag.failed { color: #e5534b; }
@@ -138,9 +141,12 @@ body.stems-ready .card.nostem .t::after { content: "NO STEMS"; font-size: 9px; f
.bar.sm { margin: 28px 0 12px; }
.bar.sm h2 { margin: 0; }
.grow { flex: 1; }
.sort { display: flex; gap: 6px; align-items: center; }
.sort select { padding: 5px 8px; font-size: 13px; }
.sort .chip svg { display: inline-block; vertical-align: -2px; }
.sortbtn { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px 0 9px; border-radius: 8px; border: 1px solid var(--line);
font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; transition: background .12s, border-color .12s; }
.sortbtn:hover { background: var(--hover); border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); }
.sortbtn svg { width: 15px; height: 15px; fill: var(--muted); flex: none; }
.sortbtn small { color: var(--muted); font-size: 12px; font-weight: 500; }
.sortbtn .caret { width: 6px; height: 6px; margin: -3px 1px 0 1px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.chip { display: inline-flex; gap: 6px; align-items: center; }
.link { color: var(--accent); cursor: pointer; }
.btn.small { padding: 5px 12px; font-size: 13px; }
@@ -170,6 +176,48 @@ body.no-stems .tracks:not(:has(tbody tr.nostem)) ~ .only-nostems { display: bloc
#menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; }
#menu button:not(:disabled):hover { background: var(--accent); color: var(--accent-ink); }
#menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
#menu h5 { margin: 4px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
#menu button.chk { display: flex; align-items: center; gap: 8px; padding-left: 8px; }
#menu button.chk svg { width: 15px; height: 15px; fill: currentColor; flex: none; visibility: hidden; }
#menu button.chk.on { font-weight: 600; }
#menu button.chk.on svg { visibility: visible; }
#menu.sortmenu { min-width: 190px; }
#finder { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px;
background: color-mix(in srgb, var(--bg) 35%, transparent); animation: ffade .14s ease-out; }
#finder[hidden] { display: none; }
@keyframes ffade { from { opacity: 0; } }
.fbox { width: min(640px, 100%); max-height: 72vh; display: flex; flex-direction: column;
background: color-mix(in srgb, var(--accent) 12%, color-mix(in srgb, var(--raised) 58%, transparent));
-webkit-backdrop-filter: blur(28px) saturate(1.8); backdrop-filter: blur(28px) saturate(1.8);
border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 14%, transparent), 0 24px 60px var(--shadow);
border-radius: 16px; overflow: hidden; animation: fpop .16s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes fpop { from { transform: translateY(-8px) scale(.98); } }
.fin { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 54px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); flex: none; }
.fin svg { fill: var(--accent) !important; }
.fin svg { width: 20px; height: 20px; fill: var(--muted); flex: none; }
.fin input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 17px; padding: 0; }
.fres { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.fres.busy { opacity: .6; }
.fgrp h4 { margin: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.frow { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.frow.on { background: var(--accent); color: var(--accent-ink); }
.frow.on small, .frow.on .fkey { color: inherit; opacity: .8; }
.fart { width: 38px; height: 38px; border-radius: 5px; overflow: hidden; background: var(--line); flex: none; }
.fart.round { border-radius: 50%; }
.fart img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fic { width: 38px; height: 38px; display: grid; place-items: center; flex: none; }
.fic svg { width: 18px; height: 18px; fill: currentColor; }
.ftx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ftx b, .ftx small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftx b { font-weight: 600; font-size: 14px; }
.ftx small { color: var(--muted); font-size: 12px; }
.fkey { font-size: 12px; color: var(--muted); visibility: hidden; }
.frow.on .fkey { visibility: visible; }
.fall { margin-top: 4px; }
.fmsg { margin: 14px 12px; color: var(--muted); font-size: 13px; }
.fmsg kbd { margin: 0 2px; }
body.finding { overflow: hidden; }
#toast { position: fixed; left: 50%; bottom: calc(var(--player-h) + 18px); transform: translate(-50%, 10px); z-index: 60; max-width: min(520px, calc(100% - 32px));
background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-weight: 500; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
@@ -182,32 +230,97 @@ body.no-stems .tracks:not(:has(tbody tr.nostem)) ~ .only-nostems { display: bloc
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.check { display: flex !important; gap: 8px; align-items: center; color: var(--text) !important; font-size: 14px !important; }
textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; color: var(--text); }
.settings { display: grid; grid-template-columns: 150px 1fr; gap: 32px; align-items: start; }
.toc { position: sticky; top: 0; display: grid; gap: 2px; }
.toc a { padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.settings { display: grid; grid-template-columns: 168px minmax(0, 680px); gap: 40px; align-items: start; }
.settings h1 { margin-bottom: 18px; }
.toc { position: sticky; top: 0; display: grid; gap: 2px; padding-top: 52px; }
.toc a { position: relative; padding: 7px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; font-size: 13px; transition: color .12s, background-color .12s; }
.toc a:hover { color: var(--text); background: var(--hover); }
.panes section { max-width: 640px; padding-bottom: 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); scroll-margin-top: 10px; }
.panes section h2 { margin-top: 0; }
.srv { padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.srv .row { margin: 0; }
.secs { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
details summary { cursor: pointer; margin: 12px 0; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.swatch { border: 1px solid; border-radius: 10px; padding: 10px; text-align: left; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.swatch i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
.toc a.on { color: var(--text); background: var(--raised); }
.toc a.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.panes section { scroll-margin-top: 8px; margin-bottom: 34px; }
.panes section h2 { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sgh { margin: 18px 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.sg { display: block; margin-bottom: 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.sr { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 52px; padding: 10px 16px; text-align: left; }
.sr + .sr { border-top: 1px solid var(--line); }
label.sr { cursor: pointer; }
.sl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.sl > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sl small, .libs small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 8px; max-width: 62%; }
.sc input[type=url], .sc input[type=password], .sc select { width: 260px; max-width: 100%; height: 32px; border-radius: 6px; }
.sc input[type=range] { width: 160px; }
.sc input[type=number]#precachen { width: 56px; height: 32px; border-radius: 6px; }
.sr.col { flex-direction: column; align-items: stretch; gap: 12px; }
.sr.end { justify-content: flex-end; }
.sg .val { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.sg .val svg { width: 15px; height: 15px; fill: currentColor; }
.val.num { min-width: 48px; justify-content: flex-end; }
.dim { color: var(--muted); }
.sr.act { justify-content: flex-start; color: var(--accent); font-weight: 500; font-size: 14px; transition: background-color .12s; }
.sr.act:not(:disabled):hover { background: var(--hover); }
.sr.act.bad { color: #ff453a; }
.ibs { gap: 2px; }
.ib { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); transition: color .12s, background-color .12s; }
.ib svg { width: 16px; height: 16px; fill: currentColor; }
.ib:not(:disabled):hover { color: var(--text); background: var(--hover); }
.ib.on { color: var(--accent); }
.ib.bad:not(:disabled):hover { color: #ff453a; }
.sw { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 40px; height: 24px; margin: 0; border-radius: 12px; cursor: pointer;
background: color-mix(in srgb, var(--text) 18%, transparent); transition: background-color .18s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.sw:checked { background: var(--accent); }
.sw:checked::after { transform: translateX(16px); }
.sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.stat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .5; }
.stat.ok::before { background: #30d158; opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, #30d158 22%, transparent); }
.stat.bad::before { background: #ff453a; opacity: 1; }
.sr.srv { flex-wrap: wrap; }
.libs { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.lib { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 13px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted);
background: var(--raised); transition: color .12s, background-color .12s; }
.lib input { display: none; }
.lib:has(:checked) { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--raised)); }
details.sg > summary { list-style: none; cursor: pointer; }
details.sg > summary::-webkit-details-marker { display: none; }
.chev svg { width: 18px; height: 18px; fill: var(--muted); transition: transform .2s; }
details[open] .chev svg { transform: rotate(180deg); }
.sg textarea { min-height: 120px; border-radius: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--muted); line-height: 1.6; }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 5px; font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
color: var(--text); background: var(--raised); box-shadow: inset 0 -1px 0 var(--line), 0 0 0 1px var(--line); }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.keys > div { display: flex; align-items: center; gap: 4px; min-height: 42px; padding: 8px 16px; font-size: 13px; border-top: 1px solid var(--line); margin-top: -1px; }
.keys > div > span { flex: 1; color: var(--muted); }
.themes { display: flex; gap: 14px; flex-wrap: wrap; }
.tcard { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.tcard.on { color: var(--text); font-weight: 600; }
.tmock { width: 92px; height: 64px; border-radius: 10px; border: 1px solid; padding: 9px 10px; display: flex; flex-direction: column; gap: 5px;
box-shadow: 0 0 0 0 var(--accent); transition: box-shadow .14s; }
.tcard:hover .tmock { box-shadow: 0 0 0 2px var(--line); }
.tcard.on .tmock { box-shadow: 0 0 0 3px var(--accent); }
.tmock i { width: 40%; height: 5px; border-radius: 3px; opacity: .9; }
.tmock b { height: 6px; border-radius: 3px; }
.tmock u { width: 30%; height: 6px; border-radius: 3px; margin-top: auto; }
.accents { display: flex; gap: 12px; flex-wrap: wrap; padding: 2px; }
.dot { width: 28px; height: 28px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 0 var(--text); transition: box-shadow .12s, transform .12s; }
.dot:hover { transform: scale(1.08); }
.dot.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; }
.note { color: var(--muted); font-size: 13px; }
#drawer { width: 320px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 22px 20px; }
#drawer h2 { margin: 0 0 14px; }
#drawer { display: flex; flex-direction: column; padding-top: 12px; }
#drawer[hidden] { display: none; }
#drawer.mixing { width: 340px; }
#drawer { width: 340px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; position: sticky; top: -12px; background: var(--panel); padding: 6px 0; z-index: 1; }
.tabs button { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tabs button { flex: 1 1 0; padding: 8px 0; border-radius: 9px; color: var(--muted); font-weight: 700; font-size: 16px; text-align: center; }
.tabs button.on { background: var(--raised); color: var(--text); }
.tabs .x { margin-left: auto; font-size: 20px; }
.tabs .x { flex: 0 0 36px; font-size: 22px; padding: 6px 0; }
.kara { display: grid; gap: 10px; margin-bottom: 16px; }
.kara .chip { justify-self: start; }
.seg { display: flex; background: var(--raised); border-radius: 8px; padding: 3px; }
@@ -272,6 +385,7 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
.q-item .x { color: var(--muted); font-size: 18px; padding: 0 4px; opacity: 0; }
.q-item:hover .x { opacity: 1; }
body, #nav, #player, .sg { transition: background-color .5s; }
#player { position: fixed; left: 0; right: 0; bottom: 0; height: var(--player-h); background: var(--bg);
border-top: 1px solid rgba(50, 50, 50, .7); display: grid; grid-template-columns: minmax(180px, 1fr) minmax(320px, 1.6fr) minmax(180px, 1fr); align-items: center; gap: 20px; padding: 0 20px; }
#player.empty .center, #player.empty .right, #player.empty #b-art { opacity: .35; pointer-events: none; }
@@ -289,7 +403,7 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
.np-text { min-width: 0; }
#np-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#np-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center { display: grid; gap: 4px; }
.center { display: grid; gap: 10px; }
.transport { display: flex; justify-content: center; align-items: center; gap: 20px; font-size: 18px; }
.transport button { color: #c5c5c5; }
.transport button:hover { color: #fff; }
@@ -316,7 +430,7 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
input[type=range] { accent-color: var(--accent); }
@media (max-width: 860px) {
:root { --player-h: 150px; }
:root { --player-h: 162px; }
#app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
#nav { flex-direction: row; overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); align-items: center; }
.brand { padding: 0 8px 0 4px; }
@@ -324,10 +438,14 @@ input[type=range] { accent-color: var(--accent); }
#nav a svg, #sideart, #b-art .exp { display: none !important; }
#nav { overflow-y: hidden; }
#nav a { min-height: 32px; }
#search input { margin: 0; width: 120px; }
.navtop { padding: 0; gap: 4px; }
#live { margin: 0; white-space: nowrap; }
.settings { grid-template-columns: 1fr; }
.toc { position: static; display: flex; flex-wrap: wrap; }
.settings { grid-template-columns: 1fr; gap: 0; }
.toc { display: none; }
.sr:not(.col) { flex-wrap: wrap; gap: 8px 16px; }
.sc { max-width: 100%; }
.sc input[type=url], .sc input[type=password], .sc select { width: 100%; }
.sr:has(input[type=url], input[type=password], select, input[type=range]) .sc { flex: 1 1 100%; }
.tracks .acts button { opacity: 1; }
.tracks .al, .tracks .off { display: none; }
.tracks .n { width: 34px; }
@@ -385,12 +503,25 @@ input[type=number]#precachen { width: 64px; background: var(--raised); border: 1
/* toolbar shares its row with the filter/sort bar on wide screens */
@media (min-width: 861px) {
.actions + .bar.sm { margin: -66px 0 12px auto; min-height: 52px; pointer-events: none; }
.actions + .bar.sm > * { pointer-events: auto; }
.actions + .bar.sm:not(:has(h2)) { margin: -66px 0 12px auto; min-height: 52px; pointer-events: none; }
.actions + .bar.sm:not(:has(h2)) > * { pointer-events: auto; }
}
#volume { -webkit-appearance: none; appearance: none; height: 16px; background: none; cursor: pointer; }
#volume::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #3c3f43; }
#volume::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: #e7e7e7; border: 0; }
#volume::-moz-range-track { height: 4px; border-radius: 2px; background: #3c3f43; }
#volume::-moz-range-progress { height: 4px; border-radius: 2px; background: #cccccc; }
#volume::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #e7e7e7; border: 0; }
#volume::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--v, 85%), color-mix(in srgb, var(--text) 22%, transparent) var(--v, 85%)); }
#volume::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: var(--text); border: 0; }
#volume::-moz-range-track { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text) 22%, transparent); }
#volume::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
#volume::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 0; }
/* Plex playlist edit mode */
.pxedit { display: grid; gap: 4px; }
.pxrow { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 10px; background: var(--panel); transition: transform .15s ease; will-change: transform; }
.pxrow.drag { transition: none; position: relative; z-index: 2; box-shadow: var(--shadow); background: var(--raised); }
.pxrow img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex: none; }
.pxrow .pxt { flex: 1; min-width: 0; display: grid; }
.pxrow .pxt b, .pxrow .pxt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pxrow .pxt b { font-weight: 500; }
.pxrow .pxt small { color: var(--muted); }
.pxrow .grip { cursor: grab; touch-action: none; color: var(--muted); display: grid; place-items: center; padding: 4px; }
.pxrow .grip svg { width: 20px; height: 20px; fill: currentColor; }
.pxrow .ib.bad svg { fill: #ff453a; }
+5 -1
View File
@@ -36,9 +36,13 @@ export const ICON = {
save: '<svg viewBox="0 0 24 24"><path d="M6 3h10l4 4v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm0 2v14h12V7.8L15.2 5H15v4H7V5H6zm3 0v2h4V5H9zm3 7a3 3 0 1 1 0 6 3 3 0 0 1 0-6z"/></svg>',
check: '<svg viewBox="0 0 24 24"><path d="M9.5 16.2L5.3 12l-1.4 1.4 5.6 5.6L20.1 8.4 18.7 7z"/></svg>',
pladd: '<svg viewBox="0 0 24 24"><path d="M3 5h13v2H3zm0 5h13v2H3zm0 5h8v2H3zm15-2h2v3h3v2h-3v3h-2v-3h-3v-2h3z"/></svg>',
up: '<svg viewBox="0 0 24 24"><path d="M12 7.6l7.7 7.7-1.4 1.4-6.3-6.3-6.3 6.3-1.4-1.4z"/></svg>',
down: '<svg viewBox="0 0 24 24"><path d="M12 16.4L4.3 8.7l1.4-1.4 6.3 6.3 6.3-6.3 1.4 1.4z"/></svg>',
search: '<svg viewBox="0 0 24 24"><path d="M10.5 4a6.5 6.5 0 0 1 5.2 10.4l4.4 4.4-1.4 1.4-4.4-4.4A6.5 6.5 0 1 1 10.5 4zm0 2a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9z"/></svg>',
sort: '<svg viewBox="0 0 24 24"><path d="M7 4l4 4H8v12H6V8H3zm10 16l-4-4h3V4h2v12h3z"/></svg>',
x: '<svg viewBox="0 0 24 24"><path d="M6.4 5L12 10.6 17.6 5 19 6.4 13.4 12l5.6 5.6-1.4 1.4-5.6-5.6L6.4 19 5 17.6 10.6 12 5 6.4z"/></svg>',
lock: '<svg viewBox="0 0 24 24"><path d="M7 10V7a5 5 0 0 1 10 0v3h.5A1.5 1.5 0 0 1 19 11.5v8a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 5 19.5v-8A1.5 1.5 0 0 1 6.5 10H7zm2 0h6V7a3 3 0 0 0-6 0v3z"/></svg>',
play: '<svg viewBox="0 0 24 24"><path d="M7 4.5v15a1 1 0 0 0 1.5.86l12.5-7.5a1 1 0 0 0 0-1.72L8.5 3.64A1 1 0 0 0 7 4.5z"/></svg>',
play: '<svg viewBox="0 0 24 24"><path d="M5.5 4.5v15a1 1 0 0 0 1.5.86l12.5-7.5a1 1 0 0 0 0-1.72L7 3.64A1 1 0 0 0 5.5 4.5z"/></svg>',
pause: '<svg viewBox="0 0 24 24"><rect x="5.5" y="4" width="4.5" height="16" rx="1.2"/><rect x="14" y="4" width="4.5" height="16" rx="1.2"/></svg>',
prev: '<svg viewBox="0 0 24 24"><rect x="4" y="5" width="2.5" height="14" rx="1"/><path d="M20 5.7v12.6a1 1 0 0 1-1.55.83L9 12.83a1 1 0 0 1 0-1.66l9.45-6.3A1 1 0 0 1 20 5.7z"/></svg>',
next: '<svg viewBox="0 0 24 24"><rect x="17.5" y="5" width="2.5" height="14" rx="1"/><path d="M4 5.7v12.6a1 1 0 0 0 1.55.83L15 12.83a1 1 0 0 0 0-1.66l-9.45-6.3A1 1 0 0 0 4 5.7z"/></svg>',