Compare commits
54
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac363ea0f7 | ||
|
|
b10528d69c | ||
|
|
42f5eddb36 | ||
|
|
7f4a07d846 | ||
|
|
29cc9a03d4 | ||
|
|
592f623bc2 | ||
|
|
3ec9b043e3 | ||
|
|
cd5a083523 | ||
|
|
6606e4d437 | ||
|
|
d6ba09f14b | ||
|
|
5959c8a347 | ||
|
|
1604a6b3e3 | ||
|
|
7dddc25656 | ||
|
|
452ed6f362 | ||
|
|
536de29e4d | ||
|
|
0ef4c650d1 | ||
|
|
3ecfdaa73b | ||
|
|
d30479c6f7 | ||
|
|
11dffdf9e6 | ||
|
|
a8742e7e3d | ||
|
|
ce6bce4018 | ||
|
|
4860db6f6c | ||
|
|
4c1956d569 | ||
|
|
ed0fd1d184 | ||
|
|
55f8574eaa | ||
|
|
07b5636bac | ||
|
|
88d3aa48e7 | ||
|
|
d6da47db9d | ||
|
|
4dfcfbf434 | ||
|
|
56c92e8b93 | ||
|
|
639b5368ff | ||
|
|
cfaedd06cf | ||
|
|
8f3a10df2f | ||
|
|
5868430f8a | ||
|
|
566c5f7e8f | ||
|
|
e833af2704 | ||
|
|
c9fa90a840 | ||
|
|
0516362461 | ||
|
|
7843ff562b | ||
|
|
9e0d7236c2 | ||
|
|
8e57b9d0cd | ||
|
|
0c9cae5b11 | ||
|
|
a79c134838 | ||
|
|
a0bbb3d52b | ||
|
|
54ba60d554 | ||
|
|
ba1804b87b | ||
|
|
96098a10a9 | ||
|
|
84f351021f | ||
|
|
f624a9866a | ||
|
|
115eb28bdf | ||
|
|
e23311bff6 | ||
|
|
a708d28788 | ||
|
|
3d047fed04 | ||
|
|
343b8c9af8 |
No files matched your search
+1
-1
@@ -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,
|
||||
|
||||
@@ -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"/>',
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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,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] = [
|
||||
@@ -219,11 +219,19 @@ final class PlaybackManager: StemEngineListener, @unchecked Sendable {
|
||||
@ObservationIgnored private var stationGen = 0
|
||||
@ObservationIgnored private var stationBusy = false
|
||||
private static let radioAlbumsAhead = 8
|
||||
private static let radioAlbumsLow = 3
|
||||
/// Each new song adds an album, up to this many ahead (keeps the queue from growing without end).
|
||||
private static let radioAlbumsMax = 40
|
||||
/// Album radio: the song the last top-up saw, and songs started since that haven't added their album yet.
|
||||
@ObservationIgnored private var radioSeenUid: Int64?
|
||||
@ObservationIgnored private var radioOwed = 0
|
||||
private static let radioSongsBatch = 100
|
||||
private static let radioSongsLow = 25
|
||||
|
||||
private func setStation(_ s: Station?) { station = s; stationGen += 1; stationBusy = false }
|
||||
private func setStation(_ s: Station?) {
|
||||
station = s; stationGen += 1; stationBusy = false
|
||||
radioSeenUid = queue.indices.contains(index) ? queue[index].uid : nil
|
||||
radioOwed = 0
|
||||
}
|
||||
|
||||
private func albumDeck() async throws -> [String] {
|
||||
var deck = (try? await plex.albums().map(\.ratingKey)) ?? []
|
||||
@@ -268,18 +276,28 @@ final class PlaybackManager: StemEngineListener, @unchecked Sendable {
|
||||
let gen = stationGen
|
||||
switch st {
|
||||
case .albums(let saved):
|
||||
// Every song that starts (the next track, a skip, a jump to another album) owes one more album,
|
||||
// so the queue always runs on past what's playing.
|
||||
let uid = queue[index].uid
|
||||
if uid != radioSeenUid { radioSeenUid = uid; radioOwed += 1 }
|
||||
let ahead = Set(queue[index...].map { $0.track.albumKey ?? $0.track.album }).count
|
||||
guard ahead <= Self.radioAlbumsLow else { return }
|
||||
let want = min(max(Self.radioAlbumsAhead + 1 - ahead, radioOwed), Self.radioAlbumsMax - ahead)
|
||||
guard want > 0 else { radioOwed = 0; return }
|
||||
stationBusy = true
|
||||
let owed = radioOwed
|
||||
Task { @MainActor in
|
||||
defer { if gen == stationGen { stationBusy = false } }
|
||||
var got = false
|
||||
// Checks again once the albums are in, unless nothing came back (server down: don't spin).
|
||||
defer { if gen == stationGen { stationBusy = false; if got { topUpStation() } } }
|
||||
var deck = saved
|
||||
if deck.isEmpty { deck = (try? await albumDeck()) ?? [] }
|
||||
let take = Array(deck.prefix(Self.radioAlbumsAhead + 1 - ahead))
|
||||
if deck.count < want { deck += (try? await albumDeck()) ?? [] }
|
||||
let take = Array(deck.prefix(want))
|
||||
deck.removeFirst(take.count)
|
||||
let tracks = await albumTracks(take)
|
||||
guard gen == stationGen else { return }
|
||||
station = .albums(deck)
|
||||
radioOwed = max(radioOwed - owed, 0)
|
||||
got = !tracks.isEmpty
|
||||
addToQueue(tracks)
|
||||
}
|
||||
case .songs:
|
||||
@@ -563,14 +581,16 @@ final class PlaybackManager: StemEngineListener, @unchecked Sendable {
|
||||
|
||||
var karaokeVocals: KaraokeVocals { KaraokeVocals(rawValue: settings.karaokeVocals) ?? .Off }
|
||||
|
||||
func setKaraokeVocals(_ v: KaraokeVocals) {
|
||||
/// [engage] (from the lyrics panel) turns karaoke on, so the choice is heard even if lyrics were opened without it.
|
||||
func setKaraokeVocals(_ v: KaraokeVocals, engage: Bool = false) {
|
||||
settings.karaokeVocals = v.rawValue
|
||||
if karaoke { applyMix(karaokeMix) }
|
||||
if karaoke { applyMix(karaokeMix) } else if engage { setKaraoke(true) }
|
||||
}
|
||||
|
||||
func setKaraokeSoftDb(_ db: Int) {
|
||||
func setKaraokeSoftDb(_ db: Int, engage: Bool = false) {
|
||||
settings.karaokeSoftDb = db
|
||||
if karaoke && karaokeVocals == .Soft { applyMix(karaokeMix) }
|
||||
guard karaokeVocals == .Soft else { return }
|
||||
if karaoke { applyMix(karaokeMix) } else if engage { setKaraoke(true) }
|
||||
}
|
||||
|
||||
/// Turning it off puts back the song's saved mix, or the one from before, unless the mix was changed meanwhile.
|
||||
|
||||
@@ -88,15 +88,21 @@ final class StemPlaylists {
|
||||
/// Saves [data] (any image format Photos hands over) as the list's cover, scaled to 1200 px.
|
||||
/// Each pick gets a new file name so cached art doesn't show the old one.
|
||||
@discardableResult
|
||||
func setPhotoArt(_ id: String, _ data: Data) -> Bool {
|
||||
guard let img = UIImage(data: data) else { return false }
|
||||
let side: CGFloat = 1200
|
||||
/// A picked photo as a JPEG no bigger than 2000 px a side. The cropper's JPEGs pass through as they are.
|
||||
static func coverJpeg(_ data: Data) -> Data? {
|
||||
guard let img = UIImage(data: data) else { return nil }
|
||||
let side: CGFloat = 2000
|
||||
if data.starts(with: [0xFF, 0xD8]), max(img.size.width, img.size.height) <= side { return data }
|
||||
let scale = min(1, side / max(img.size.width, img.size.height, 1))
|
||||
let size = CGSize(width: (img.size.width * scale).rounded(), height: (img.size.height * scale).rounded())
|
||||
let fmt = UIGraphicsImageRendererFormat.default(); fmt.scale = 1
|
||||
let jpeg = UIGraphicsImageRenderer(size: size, format: fmt).jpegData(withCompressionQuality: 0.85) { _ in
|
||||
return UIGraphicsImageRenderer(size: size, format: fmt).jpegData(withCompressionQuality: 0.85) { _ in
|
||||
img.draw(in: CGRect(origin: .zero, size: size))
|
||||
}
|
||||
}
|
||||
|
||||
func setPhotoArt(_ id: String, _ data: Data) -> Bool {
|
||||
guard let jpeg = Self.coverJpeg(data) else { return false }
|
||||
let name = "\(id)-\(UUID().uuidString.prefix(8).lowercased()).jpg"
|
||||
do {
|
||||
try FileManager.default.createDirectory(at: Self.artDir, withIntermediateDirectories: true)
|
||||
|
||||
@@ -80,7 +80,8 @@ struct JItem: Decodable {
|
||||
func toArtist() -> Artist { Artist(ratingKey: id, title: name, sortTitle: sortName ?? name, thumb: thumb) }
|
||||
|
||||
func toPlaylist() -> Playlist {
|
||||
Playlist(ratingKey: id, title: name, thumb: thumb, trackCount: childCount ?? 0, durationMs: durationMs)
|
||||
// "id|tag": a new cover changes the tag, so the art cache doesn't keep the old one.
|
||||
Playlist(ratingKey: id, title: name, thumb: primaryTag.map { "\(id)|\($0)" } ?? thumb, trackCount: childCount ?? 0, durationMs: durationMs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,6 +415,15 @@ final class JellyfinClient: MediaSource, @unchecked Sendable {
|
||||
try await send("DELETE", "/Items/\(key)")
|
||||
}
|
||||
|
||||
/// Jellyfin wants the image base64 encoded in the body.
|
||||
func setPlaylistArt(_ key: String, jpeg: Data) async throws {
|
||||
guard server.signedIn else { throw NotSignedIn() }
|
||||
var req = request(try url("/Items/\(key)/Images/Primary"), method: "POST")
|
||||
req.setValue("image/jpeg", forHTTPHeaderField: "Content-Type")
|
||||
req.httpBody = jpeg.base64EncodedData()
|
||||
_ = try await http.data(req)
|
||||
}
|
||||
|
||||
// ---- playback reporting ----------------------------------------------------------------
|
||||
|
||||
func scrobble(_ trackKey: String) async {
|
||||
@@ -431,8 +441,9 @@ final class JellyfinClient: MediaSource, @unchecked Sendable {
|
||||
// ---- URLs ---------------------------------------------------------------------------
|
||||
|
||||
func artUrl(_ thumb: String?, px: Int) -> URL? {
|
||||
guard let thumb, !thumb.isEmpty, server.signedIn, let u = URL(string: base + "/Items/\(thumb)/Images/Primary") else { return nil }
|
||||
return u.with([("fillWidth", px), ("fillHeight", px), ("quality", 90), ("api_key", server.token)])
|
||||
let parts = thumb?.split(separator: "|", maxSplits: 1).map(String.init) ?? []
|
||||
guard let id = parts.first, !id.isEmpty, server.signedIn, let u = URL(string: base + "/Items/\(id)/Images/Primary") else { return nil }
|
||||
return u.with([("fillWidth", px), ("fillHeight", px), ("quality", 90), ("tag", parts.count > 1 ? parts[1] : nil), ("api_key", server.token)])
|
||||
}
|
||||
|
||||
/// The original file, untouched, like Plex's part URL.
|
||||
|
||||
@@ -55,6 +55,8 @@ protocol MediaSource: AnyObject, Sendable {
|
||||
func removeFromPlaylist(_ key: String, playlistItemId: Int64) async throws
|
||||
func movePlaylistItem(_ key: String, playlistItemId: Int64, afterItemId: Int64?) async throws
|
||||
func renamePlaylist(_ key: String, title: String) async throws
|
||||
/// Uploads [jpeg] as the playlist's cover.
|
||||
func setPlaylistArt(_ key: String, jpeg: Data) async throws
|
||||
func deletePlaylist(_ key: String) async throws
|
||||
func scrobble(_ trackKey: String) async
|
||||
func timeline(_ track: Track, state: String, positionMs: Int64) async
|
||||
|
||||
@@ -201,6 +201,16 @@ final class PlexClient: @unchecked Sendable {
|
||||
}
|
||||
|
||||
/// Made on the server of the first song; songs from other servers are left out.
|
||||
/// Servers a new playlist can live on, as (id, name).
|
||||
var playlistServers: [(String, String)] { sources.map { ($0.server.id, $0.server.name) } }
|
||||
|
||||
/// An empty playlist on one server (the only one when [serverId] is nil).
|
||||
func createEmptyPlaylist(_ title: String, serverId: String?) async throws -> Playlist? {
|
||||
let list = sources
|
||||
guard let s = list.first(where: { $0.server.id == serverId }) ?? list.first else { throw NotSignedIn() }
|
||||
return try await s.createPlaylist(title, trackKeys: [])?.tagged(s.server.id)
|
||||
}
|
||||
|
||||
func createPlaylist(_ title: String, trackKeys: [String]) async throws -> Playlist? {
|
||||
guard let first = trackKeys.first else { return nil }
|
||||
let (s, _) = try routed(first)
|
||||
@@ -235,6 +245,13 @@ final class PlexClient: @unchecked Sendable {
|
||||
try await s.deletePlaylist(k)
|
||||
}
|
||||
|
||||
/// Uploads the cover, then returns the playlist's new thumb.
|
||||
func setPlaylistArt(_ key: String, jpeg: Data) async throws -> String? {
|
||||
let (s, k) = try routed(key)
|
||||
try await s.setPlaylistArt(k, jpeg: jpeg)
|
||||
return try await s.playlists(sort: "titleSort").first { $0.ratingKey == k }?.thumb.tagged(s.server.id)
|
||||
}
|
||||
|
||||
// ---- playback reporting ---------------------------------------------------------
|
||||
|
||||
func scrobble(_ trackKey: String) async {
|
||||
|
||||
@@ -266,7 +266,9 @@ final class PlexServer: MediaSource, @unchecked Sendable {
|
||||
}
|
||||
|
||||
func createPlaylist(_ title: String, trackKeys: [String]) async throws -> Playlist? {
|
||||
let uri = try await libraryUri(trackKeys)
|
||||
// No songs: a bare library uri makes an empty playlist (newer Plex servers allow it).
|
||||
if trackKeys.isEmpty, machine.isEmpty { machine = try await machineId() }
|
||||
let uri = trackKeys.isEmpty ? "server://\(machine)/com.plexapp.plugins.library" : try await libraryUri(trackKeys)
|
||||
return try await send("POST", "/playlists", [("type", "audio"), ("title", title), ("smart", 0), ("uri", uri)])
|
||||
.metadata.first?.toPlaylist()
|
||||
}
|
||||
@@ -293,6 +295,15 @@ final class PlexServer: MediaSource, @unchecked Sendable {
|
||||
try await send("DELETE", "/playlists/\(key)")
|
||||
}
|
||||
|
||||
/// Plex takes the image as the raw body and selects it as the poster.
|
||||
func setPlaylistArt(_ key: String, jpeg: Data) async throws {
|
||||
guard signedIn else { throw NotSignedIn() }
|
||||
var req = request(try url("/library/metadata/\(key)/posters"), method: "POST")
|
||||
req.setValue("image/jpeg", forHTTPHeaderField: "Content-Type")
|
||||
req.httpBody = jpeg
|
||||
_ = try await http.data(req)
|
||||
}
|
||||
|
||||
// ---- playback reporting ---------------------------------------------------------
|
||||
|
||||
func scrobble(_ trackKey: String) async {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
@@ -315,11 +315,14 @@ struct HingeEdge: ViewModifier {
|
||||
struct Page<Content: View>: View {
|
||||
let title: String
|
||||
var large = true
|
||||
/// Moves the content up into an empty nav bar.
|
||||
var pullUp: CGFloat = 0
|
||||
@ViewBuilder let content: () -> Content
|
||||
@Environment(\.palette) private var p
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
LazyVStack(alignment: .leading, spacing: 0) { content() }
|
||||
.padding(.top, -pullUp)
|
||||
.padding(.bottom, 24)
|
||||
}
|
||||
.modifier(HingeEdge())
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
import SwiftUI
|
||||
import UIKit
|
||||
|
||||
/// Square crop for a playlist cover: pinch or slide to zoom, drag to place, pick the saved size.
|
||||
struct CoverCropper: View {
|
||||
let image: UIImage
|
||||
let done: (Data?) -> Void
|
||||
|
||||
@State private var zoom: CGFloat = 1
|
||||
@State private var offset: CGSize = .zero
|
||||
@State private var dragStart: CGSize?
|
||||
@State private var zoomStart: CGFloat?
|
||||
@State private var side: CGFloat = 1
|
||||
@State private var saving = false
|
||||
@AppStorage("coverCropSize") private var outSize = 1200
|
||||
|
||||
private static let sizes = [(600, "Small"), (1200, "Medium"), (2000, "Large")]
|
||||
private let maxZoom: CGFloat = 6
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
VStack(spacing: 0) {
|
||||
GeometryReader { geo in
|
||||
let s = max(1, min(geo.size.width, geo.size.height) - 32)
|
||||
ZStack {
|
||||
Color.black
|
||||
Image(uiImage: image)
|
||||
.resizable()
|
||||
.frame(width: shown(s).width, height: shown(s).height)
|
||||
.offset(offset)
|
||||
CropMask(side: s).allowsHitTesting(false)
|
||||
}
|
||||
.frame(width: geo.size.width, height: geo.size.height)
|
||||
.contentShape(Rectangle())
|
||||
.gesture(drag(s).simultaneously(with: pinch(s)))
|
||||
.onAppear { side = s }
|
||||
.onChange(of: s) { _, v in side = v; clamp(v) }
|
||||
}
|
||||
.clipped()
|
||||
controls
|
||||
}
|
||||
.background(Color.black)
|
||||
.navigationTitle("Crop Cover")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbarColorScheme(.dark, for: .navigationBar)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) { Button("Cancel") { done(nil) } }
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
if saving { ProgressView() } else { Button("Apply") { apply() }.bold() }
|
||||
}
|
||||
}
|
||||
}
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
|
||||
private var controls: some View {
|
||||
VStack(spacing: 14) {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: "minus.magnifyingglass").foregroundStyle(.secondary)
|
||||
Slider(value: Binding(get: { zoom }, set: { zoom = $0; clamp(side) }), in: 1...maxZoom)
|
||||
Image(systemName: "plus.magnifyingglass").foregroundStyle(.secondary)
|
||||
}
|
||||
Picker("Size", selection: $outSize) {
|
||||
ForEach(Self.sizes, id: \.0) { Text($0.1).tag($0.0) }
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
Text("\(outSize) × \(outSize) px").font(.caption).monospacedDigit().foregroundStyle(.secondary)
|
||||
Button("Reset") { withAnimation(.snappy(duration: 0.2)) { zoom = 1; offset = .zero } }
|
||||
.font(.subheadline)
|
||||
}
|
||||
.padding(.horizontal, 24).padding(.top, 12).padding(.bottom, 20)
|
||||
}
|
||||
|
||||
/// The image's on-screen size: filling the square at zoom 1.
|
||||
private func shown(_ s: CGFloat) -> CGSize {
|
||||
let w = max(image.size.width, 1), h = max(image.size.height, 1)
|
||||
let k = s / min(w, h) * zoom
|
||||
return CGSize(width: w * k, height: h * k)
|
||||
}
|
||||
|
||||
/// Keeps the square covered by the image.
|
||||
private func clamp(_ s: CGFloat) {
|
||||
let d = shown(s)
|
||||
let mx = max(0, (d.width - s) / 2), my = max(0, (d.height - s) / 2)
|
||||
offset = CGSize(width: min(max(offset.width, -mx), mx), height: min(max(offset.height, -my), my))
|
||||
}
|
||||
|
||||
private func drag(_ s: CGFloat) -> some Gesture {
|
||||
DragGesture(minimumDistance: 0)
|
||||
.onChanged { v in
|
||||
let start = dragStart ?? offset
|
||||
if dragStart == nil { dragStart = start }
|
||||
offset = CGSize(width: start.width + v.translation.width, height: start.height + v.translation.height)
|
||||
clamp(s)
|
||||
}
|
||||
.onEnded { _ in dragStart = nil }
|
||||
}
|
||||
|
||||
private func pinch(_ s: CGFloat) -> some Gesture {
|
||||
MagnifyGesture()
|
||||
.onChanged { v in
|
||||
let start = zoomStart ?? zoom
|
||||
if zoomStart == nil { zoomStart = start }
|
||||
zoom = min(max(start * v.magnification, 1), maxZoom)
|
||||
clamp(s)
|
||||
}
|
||||
.onEnded { _ in zoomStart = nil }
|
||||
}
|
||||
|
||||
private func apply() {
|
||||
let s = side
|
||||
let d = shown(s)
|
||||
let k = d.width / max(image.size.width, 1) // screen points per image point
|
||||
// The square's top-left and side, in image points.
|
||||
let x0 = (d.width / 2 - s / 2 - offset.width) / k
|
||||
let y0 = (d.height / 2 - s / 2 - offset.height) / k
|
||||
let crop = CGRect(x: x0, y: y0, width: s / k, height: s / k)
|
||||
let img = image
|
||||
let out = CGFloat(outSize)
|
||||
saving = true
|
||||
Task {
|
||||
let data = await Task.detached(priority: .userInitiated) { CoverCropper.render(img, crop, out) }.value
|
||||
saving = false
|
||||
done(data)
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated static func render(_ img: UIImage, _ crop: CGRect, _ out: CGFloat) -> Data? {
|
||||
let f = out / max(crop.width, 1)
|
||||
let fmt = UIGraphicsImageRendererFormat.default(); fmt.scale = 1; fmt.opaque = true
|
||||
return UIGraphicsImageRenderer(size: CGSize(width: out, height: out), format: fmt).jpegData(withCompressionQuality: 0.85) { _ in
|
||||
img.draw(in: CGRect(x: -crop.minX * f, y: -crop.minY * f, width: img.size.width * f, height: img.size.height * f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Dims everything outside the centered square and outlines it.
|
||||
private struct CropMask: View {
|
||||
let side: CGFloat
|
||||
var body: some View {
|
||||
GeometryReader { geo in
|
||||
let r = CGRect(x: (geo.size.width - side) / 2, y: (geo.size.height - side) / 2, width: side, height: side)
|
||||
Path { p in p.addRect(CGRect(origin: .zero, size: geo.size)); p.addRect(r) }
|
||||
.fill(Color.black.opacity(0.55), style: FillStyle(eoFill: true))
|
||||
Rectangle().stroke(Color.white.opacity(0.9), lineWidth: 1)
|
||||
.frame(width: side, height: side).position(x: r.midX, y: r.midY)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,14 +54,68 @@ struct MediaMenu {
|
||||
playlistKey: nil, extra: [], confirmDownload: true, stemmed: stemmed(cov))
|
||||
}
|
||||
|
||||
func playlist(_ pl: Playlist, extra: [SheetAction] = []) -> [SheetAction] {
|
||||
/// [changed] hears the playlist after a rename or a new cover, so an open page can follow; [deleted] after a delete.
|
||||
func playlist(_ pl: Playlist, extra: [SheetAction] = [], changed: ((Playlist) -> Void)? = nil, deleted: (() -> Void)? = nil) -> [SheetAction] {
|
||||
let plex = g.plex
|
||||
let copy = SheetAction("Copy to Stem Playlist…", icon: "doc.on.doc") { copyToStems(pl) }
|
||||
let gr = DownloadGroup(kind: .playlist, key: pl.ratingKey, title: pl.title, subtitle: "Playlist", thumb: pl.thumb)
|
||||
return collection(pl.title, gr, { try await plex.playlistTracks(pl.ratingKey) }, playlistKey: pl.ratingKey, extra: [copy] + extra,
|
||||
return collection(pl.title, gr, { try await plex.playlistTracks(pl.ratingKey) }, playlistKey: pl.ratingKey,
|
||||
extra: [copy] + (pl.smart ? [] : playlistEdits(pl, changed)) + extra + [delete(pl, deleted)],
|
||||
confirmDownload: pl.trackCount > 50)
|
||||
}
|
||||
|
||||
/// Rename and Change Cover, saved on the playlist's own server (Plex or Jellyfin).
|
||||
private func playlistEdits(_ pl: Playlist, _ changed: ((Playlist) -> Void)?) -> [SheetAction] {
|
||||
let plex = g.plex
|
||||
let overlays = overlays
|
||||
let ui = ui
|
||||
let rename = SheetAction("Rename…", icon: "pencil") {
|
||||
overlays.prompt("Rename Playlist", nil, initial: pl.title, "Save") { name in
|
||||
Task {
|
||||
do {
|
||||
try await plex.renamePlaylist(pl.ratingKey, title: name)
|
||||
var p = pl; p.title = name
|
||||
ui.playlistEdits += 1
|
||||
changed?(p)
|
||||
} catch { overlays.hud("Couldn't rename: \(error.localizedDescription)", "exclamationmark.triangle") }
|
||||
}
|
||||
}
|
||||
}
|
||||
let cover = SheetAction("Change Cover…", icon: "photo") {
|
||||
overlays.pickPhoto { data in
|
||||
guard let jpeg = StemPlaylists.coverJpeg(data) else { overlays.hud("Couldn't use that photo", "exclamationmark.triangle"); return }
|
||||
Task {
|
||||
do {
|
||||
let thumb = try await plex.setPlaylistArt(pl.ratingKey, jpeg: jpeg)
|
||||
var p = pl; p.thumb = thumb ?? pl.thumb
|
||||
ui.playlistEdits += 1
|
||||
changed?(p)
|
||||
overlays.hud("Cover updated")
|
||||
} catch { overlays.hud("Couldn't upload: \(error.localizedDescription)", "exclamationmark.triangle") }
|
||||
}
|
||||
}
|
||||
}
|
||||
return [rename, cover]
|
||||
}
|
||||
|
||||
private func delete(_ pl: Playlist, _ deleted: (() -> Void)?) -> SheetAction {
|
||||
let plex = g.plex
|
||||
let overlays = overlays
|
||||
let ui = ui
|
||||
return SheetAction("Delete Playlist…", icon: "trash", destructive: true) {
|
||||
overlays.confirm("Delete “\(pl.title)”?", "This removes it from the server for every app.", "Delete") {
|
||||
Task {
|
||||
do {
|
||||
try await plex.deletePlaylist(pl.ratingKey)
|
||||
ui.playlistEdits += 1
|
||||
overlays.hud("Deleted “\(pl.title)”", "trash")
|
||||
deleted?()
|
||||
} catch { overlays.hud("Couldn't delete: \(error.localizedDescription)", "exclamationmark.triangle") }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func stemPlaylist(_ pl: StemPlaylist, extra: [SheetAction] = [], onPage: Bool = false) -> [SheetAction] {
|
||||
var a = [
|
||||
SheetAction("Play Next", icon: "text.line.first.and.arrowtriangle.forward") {
|
||||
@@ -75,23 +129,30 @@ struct MediaMenu {
|
||||
{ pl.tracks }, confirm: false)
|
||||
if pl.items.isEmpty { a = [] }
|
||||
let lists = g.stemPlaylists
|
||||
a.append(SheetAction("Rename…", icon: "pencil") {
|
||||
overlays.prompt("Rename Stem Playlist", nil, initial: pl.title, "Save") { lists.rename(pl.id, $0) }
|
||||
})
|
||||
a.append(SheetAction("Change Cover…", icon: "photo") {
|
||||
var seen = Set<String>()
|
||||
var acts: [SheetAction] = [
|
||||
SheetAction("Choose from Photos…", icon: "photo.on.rectangle") {
|
||||
overlays.pickPhoto { data in
|
||||
if !lists.setPhotoArt(pl.id, data) { overlays.hud("Couldn't use that photo", "exclamationmark.triangle") }
|
||||
}
|
||||
},
|
||||
SheetAction("Automatic", icon: "wand.and.stars") { lists.setArt(pl.id, nil) },
|
||||
]
|
||||
for t in pl.tracks {
|
||||
guard let th = t.thumb, seen.insert(th).inserted, seen.count <= 20 else { continue }
|
||||
acts.append(SheetAction(t.album, icon: th == pl.artThumb ? "checkmark" : "photo") { lists.setArt(pl.id, th) })
|
||||
}
|
||||
overlays.actions("Choose a Cover", acts)
|
||||
})
|
||||
if !pl.items.isEmpty {
|
||||
a.append(SheetAction("Change Cover…", icon: "photo") {
|
||||
var seen = Set<String>()
|
||||
var acts: [SheetAction] = [
|
||||
SheetAction("Choose from Photos…", icon: "photo.on.rectangle") {
|
||||
overlays.pickPhoto { data in
|
||||
if !lists.setPhotoArt(pl.id, data) { overlays.hud("Couldn't use that photo", "exclamationmark.triangle") }
|
||||
}
|
||||
},
|
||||
SheetAction("Automatic", icon: "wand.and.stars") { lists.setArt(pl.id, nil) },
|
||||
]
|
||||
for t in pl.tracks {
|
||||
guard let th = t.thumb, seen.insert(th).inserted, seen.count <= 20 else { continue }
|
||||
acts.append(SheetAction(t.album, icon: th == pl.artThumb ? "checkmark" : "photo") { lists.setArt(pl.id, th) })
|
||||
}
|
||||
overlays.actions("Choose a Cover", acts)
|
||||
a.append(SheetAction("Set Mix for All Songs…", icon: "slider.horizontal.3") {
|
||||
chooseMix(pl.tracks) { m in lists.setItems(pl.id, pl.items.map { var it = $0; it.mix = MixPresets.normalized(m); return it }) }
|
||||
})
|
||||
a.append(SheetAction("Copy to Plex Playlist…", icon: "doc.on.doc") { newPlaylist(pl.tracks) { ui.playlistEdits += 1 } })
|
||||
}
|
||||
a.append(SheetAction("Delete Stem Playlist", icon: "trash", destructive: true) {
|
||||
overlays.confirm("Delete “\(pl.title)”?", "Stem playlists are only on this device.", "Delete") { lists.delete(pl.id); if onPage { ui.pop() } }
|
||||
@@ -260,6 +321,29 @@ struct MediaMenu {
|
||||
}
|
||||
}
|
||||
|
||||
/// Empty playlist; asks which server first when more than one is signed in.
|
||||
func newEmptyPlaylist(onCreated: @escaping () -> Void = {}) {
|
||||
let plex = g.plex
|
||||
let servers = plex.playlistServers
|
||||
let make: (String?) -> Void = { id in
|
||||
overlays.prompt("New Playlist", "Add songs later with “Add to Playlist”.", "Create", placeholder: "Playlist name") { name in
|
||||
Task {
|
||||
do {
|
||||
_ = try await plex.createEmptyPlaylist(name, serverId: id)
|
||||
overlays.hud("Created “\(name)”")
|
||||
ui.playlistEdits += 1
|
||||
onCreated()
|
||||
} catch {
|
||||
overlays.hud("Couldn't create: \(error.localizedDescription)", "exclamationmark.triangle")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if servers.count > 1 {
|
||||
overlays.actions("Which Server?", servers.map { s in SheetAction(s.1.isEmpty ? "Server" : s.1) { make(s.0) } })
|
||||
} else { make(servers.first?.0) }
|
||||
}
|
||||
|
||||
func newPlaylist(_ tracks: [Track], onCreated: @escaping () -> Void = {}) {
|
||||
let plex = g.plex
|
||||
overlays.prompt("New Playlist", "Name it; you can add more songs later.", "Create", placeholder: "Playlist name") { name in
|
||||
|
||||
@@ -33,6 +33,9 @@ final class Overlays {
|
||||
/// Set while the Photos picker is up; gets the picked image's data.
|
||||
var photoPick: ((Data) -> Void)?
|
||||
var photoShown = false
|
||||
/// A picked cover waiting in the cropper.
|
||||
var crop: Crop?
|
||||
struct Crop: Identifiable { let id = UUID(); var image: UIImage; var run: (Data) -> Void }
|
||||
/// 1 while the Now Playing sheet is up, so its host shows overlays instead of the root's.
|
||||
var level = 0
|
||||
|
||||
@@ -95,7 +98,7 @@ struct OverlayHost: ViewModifier {
|
||||
private var mine: Bool { overlays.level == level }
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
content.modifier(CropHost(overlays: overlays, mine: mine))
|
||||
.overlay {
|
||||
if mine, let h = overlays.hud {
|
||||
HudView(hud: h).transition(.opacity.combined(with: .scale(scale: 0.9))).allowsHitTesting(false)
|
||||
@@ -132,8 +135,9 @@ struct OverlayHost: ViewModifier {
|
||||
photo = nil
|
||||
overlays.photoPick = nil
|
||||
Task { @MainActor in
|
||||
if let data = try? await item.loadTransferable(type: Data.self) { run(data) }
|
||||
else { overlays.hud("Couldn't load that photo", "exclamationmark.triangle") }
|
||||
if let data = try? await item.loadTransferable(type: Data.self), let img = UIImage(data: data) {
|
||||
overlays.crop = Overlays.Crop(image: img, run: run)
|
||||
} else { overlays.hud("Couldn't load that photo", "exclamationmark.triangle") }
|
||||
}
|
||||
}
|
||||
.sheet(item: Binding(get: { mine ? overlays.addToPlaylist : nil }, set: { overlays.addToPlaylist = $0 })) { r in
|
||||
@@ -146,6 +150,20 @@ struct OverlayHost: ViewModifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// The cover cropper, split out to keep OverlayHost's chain small enough to type-check.
|
||||
private struct CropHost: ViewModifier {
|
||||
let overlays: Overlays
|
||||
let mine: Bool
|
||||
func body(content: Content) -> some View {
|
||||
content.fullScreenCover(item: Binding(get: { mine ? overlays.crop : nil }, set: { overlays.crop = $0 })) { c in
|
||||
CoverCropper(image: c.image) { data in
|
||||
overlays.crop = nil
|
||||
if let data { c.run(data) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct HudView: View {
|
||||
let hud: Overlays.Hud
|
||||
var body: some View {
|
||||
|
||||
@@ -67,11 +67,15 @@ 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.
|
||||
var deckPage: DeckPage = .Stems
|
||||
let overlays: Overlays
|
||||
/// Bumped when a playlist is renamed or gets a new cover, so the lists reload.
|
||||
var playlistEdits = 0
|
||||
|
||||
init(overlays: Overlays) { self.overlays = overlays }
|
||||
|
||||
@@ -123,7 +127,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 +139,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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3,6 +3,44 @@ 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 }
|
||||
|
||||
/// ProMotion only runs as fast as someone asks. A plain drag asks nothing, and the 30 fps meters and
|
||||
/// bars then set the pace, so the close drag crawled. This display link asks for 120 Hz while held.
|
||||
@MainActor final class FrameBoost: NSObject {
|
||||
static let shared = FrameBoost()
|
||||
private var link: CADisplayLink?
|
||||
private var stopGen = 0
|
||||
|
||||
func start() {
|
||||
stopGen += 1
|
||||
guard link == nil else { return }
|
||||
let l = CADisplayLink(target: self, selector: #selector(tick))
|
||||
l.preferredFrameRateRange = CAFrameRateRange(minimum: 80, maximum: 120, preferred: 120)
|
||||
l.add(to: .main, forMode: .common)
|
||||
link = l
|
||||
}
|
||||
|
||||
/// Keeps the boost through the spring back or the cover's slide down.
|
||||
func stop(after: Double = 0.6) {
|
||||
stopGen += 1
|
||||
let gen = stopGen
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + after) { [weak self] in
|
||||
guard let self, gen == self.stopGen else { return }
|
||||
self.link?.invalidate()
|
||||
self.link = nil
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func tick() {}
|
||||
}
|
||||
|
||||
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 +53,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 +65,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 +79,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 +100,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 +125,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 +136,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 +174,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 +192,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 +224,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 +241,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 +329,28 @@ 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)
|
||||
let y = !docked && top && dy > 0 && dy > abs(v.translation.width) ? dy : 0
|
||||
if y > 0 { FrameBoost.shared.start() }
|
||||
if y != drop.y { drop.y = y }
|
||||
}
|
||||
.onEnded { v in
|
||||
FrameBoost.shared.stop()
|
||||
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 +511,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 +522,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 +873,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 +989,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 +997,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 +1017,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 +1061,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 +1092,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 +1244,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 +1333,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, engage: true) })) {
|
||||
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()), engage: true) }), 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
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ struct PlaylistsScreen: View {
|
||||
@State private var reload = 0
|
||||
@AppStorage("playlistKind") private var kind = PlaylistKind.Plex
|
||||
private let sort = SortState("playlists", PLAYLIST_SORTS)
|
||||
private let stemSort = SortState("stemPlaylists", STEM_PLAYLIST_SORTS)
|
||||
@State private var shuffleSeed = 0
|
||||
private var g: AppGraph { .shared }
|
||||
|
||||
var body: some View {
|
||||
@@ -31,7 +33,7 @@ struct PlaylistsScreen: View {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let stems = g.stemPlaylists.lists
|
||||
let stems = g.stemPlaylists.lists.sorted(stemSort, seed: shuffleSeed)
|
||||
if stems.isEmpty {
|
||||
EmptyState(icon: "slider.horizontal.3", title: "No Stem Playlists",
|
||||
message: "Each song plays with its own mix, like an instrumental or a cappella. Hold any song and choose “Add to Stem Playlist”, or copy a Plex playlist with +.")
|
||||
@@ -42,30 +44,29 @@ struct PlaylistsScreen: View {
|
||||
}
|
||||
}
|
||||
.toolbar {
|
||||
if kind == .Plex { ToolbarItem(placement: .topBarTrailing) { SortMenu(sort: sort) } }
|
||||
ToolbarItem(placement: .topBarTrailing) { SortMenu(sort: kind == .Plex ? sort : stemSort) }
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button { kind == .Plex ? newPlaylist() : newStemPlaylist() } label: { Image(systemName: "plus") }
|
||||
}
|
||||
}
|
||||
.task(id: "\(g.settings.libraryKey)|\(sort.token)|\(reload)") {
|
||||
.onChange(of: stemSort.token) { shuffleSeed += 1 }
|
||||
.task(id: "\(g.settings.libraryKey)|\(sort.token)|\(reload)|\(ui.playlistEdits)") {
|
||||
// /playlists may not take sort=random, so Random shuffles here.
|
||||
let random = sort.option.random
|
||||
await LoadState.load($lists) { try await random ? g.plex.playlists().shuffled() : g.plex.playlists(sort: sort.param) }
|
||||
}
|
||||
}
|
||||
|
||||
/// Plex can't hold an empty playlist, so new ones start from songs you have.
|
||||
private func newPlaylist() {
|
||||
let queue = g.playback.queue
|
||||
var acts: [SheetAction] = []
|
||||
var acts: [SheetAction] = [SheetAction("Empty Playlist…", icon: "plus") { ui.menu.newEmptyPlaylist { reload += 1 } }]
|
||||
if !queue.isEmpty {
|
||||
acts.append(SheetAction("New Playlist from Queue (\(queue.count))") { ui.menu.newPlaylist(queue.map(\.track)) { reload += 1 } })
|
||||
}
|
||||
if let now = g.playback.current?.track {
|
||||
acts.append(SheetAction("New Playlist with “\(now.title)”") { ui.menu.newPlaylist([now]) { reload += 1 } })
|
||||
}
|
||||
if acts.isEmpty { ui.overlays.hud("Play something first, or use “Add to Playlist” on any song.", "info.circle") }
|
||||
else { ui.overlays.actions("New Playlist", acts) }
|
||||
ui.overlays.actions("New Playlist", acts)
|
||||
}
|
||||
|
||||
private func newStemPlaylist() {
|
||||
@@ -142,7 +143,7 @@ struct StemPlaylistScreen: View {
|
||||
.navigationTitle(pl.title)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
} else {
|
||||
Page(title: pl.title, large: false) {
|
||||
Page(title: pl.title, large: false, pullUp: BAR_PULL) {
|
||||
header(pl)
|
||||
if pl.items.isEmpty {
|
||||
EmptyState(icon: "slider.horizontal.3", title: "No Songs",
|
||||
@@ -160,10 +161,10 @@ struct StemPlaylistScreen: View {
|
||||
.toolbar {
|
||||
ToolbarItemGroup(placement: .topBarTrailing) {
|
||||
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)) }
|
||||
else { MoreMenu(items: moreItems(pl)) }
|
||||
}
|
||||
}
|
||||
.modifier(SplitHidesTitle(bare: !editing))
|
||||
}
|
||||
|
||||
private func header(_ pl: StemPlaylist) -> some View {
|
||||
@@ -178,18 +179,40 @@ struct StemPlaylistScreen: View {
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 8).padding(.bottom, 16)
|
||||
.padding(.bottom, 16)
|
||||
}
|
||||
|
||||
private func moreItems(_ pl: StemPlaylist) -> [SheetAction] {
|
||||
let lists = g.stemPlaylists
|
||||
let rename = SheetAction("Rename…", icon: "pencil") {
|
||||
ui.overlays.prompt("Rename Stem Playlist", nil, initial: pl.title, "Save") { lists.rename(pl.id, $0) }
|
||||
let edit = pl.items.isEmpty ? [] : [SheetAction("Edit Songs", icon: "list.bullet") { items = pl.items; editing = true }]
|
||||
return ui.menu.stemPlaylist(pl, extra: edit, onPage: true)
|
||||
}
|
||||
}
|
||||
|
||||
/// Stem playlists live on the device, so they sort here.
|
||||
let STEM_PLAYLIST_SORTS = [
|
||||
SortOption(title: "Title", key: "title", up: "A to Z", down: "Z to A"),
|
||||
SortOption(title: "Date Added", key: "created", desc: true, up: "Oldest First", down: "Newest First"),
|
||||
SortOption(title: "Last Updated", key: "updated", desc: true, up: "Oldest First", down: "Newest First"),
|
||||
SortOption(title: "Songs", key: "count", desc: true, up: "Fewest First", down: "Most First"),
|
||||
SortOption(title: "Duration", key: "duration", desc: true, up: "Shortest First", down: "Longest First"),
|
||||
SortOption(title: "Random", key: "random", up: "Shuffled", down: "Shuffled"),
|
||||
]
|
||||
|
||||
extension [StemPlaylist] {
|
||||
func sorted(_ sort: SortState, seed: Int) -> [StemPlaylist] {
|
||||
let o = sort.option
|
||||
if o.random {
|
||||
return map { ($0, ($0.id + "\(seed)").hashValue) }.sorted { $0.1 < $1.1 }.map(\.0)
|
||||
}
|
||||
let mixAll = SheetAction("Set Mix for All Songs…", icon: "slider.horizontal.3") {
|
||||
ui.menu.chooseMix(pl.tracks) { m in lists.setItems(pl.id, pl.items.map { var it = $0; it.mix = MixPresets.normalized(m); return it }) }
|
||||
let asc: [StemPlaylist]
|
||||
switch o.key {
|
||||
case "created": asc = sorted { $0.created < $1.created }
|
||||
case "updated": asc = sorted { $0.updated < $1.updated }
|
||||
case "count": asc = sorted { $0.items.count < $1.items.count }
|
||||
case "duration": asc = sorted { $0.durationMs < $1.durationMs }
|
||||
default: asc = sorted { $0.title.localizedStandardCompare($1.title) == .orderedAscending }
|
||||
}
|
||||
return ui.menu.stemPlaylist(pl, extra: pl.items.isEmpty ? [rename] : [rename, mixAll], onPage: true)
|
||||
return sort.descending ? asc.reversed() : asc
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,6 +243,7 @@ struct PlaylistScreen: View {
|
||||
@State private var tracks: LoadState<[Track]> = .loading
|
||||
@State private var reload = 0
|
||||
@State private var title: String
|
||||
@State private var thumb: String?
|
||||
@State private var editing = false
|
||||
@State private var items: [Track] = []
|
||||
@State private var removed: [Track] = []
|
||||
@@ -229,6 +253,7 @@ struct PlaylistScreen: View {
|
||||
init(playlist: Playlist) {
|
||||
self.playlist = playlist
|
||||
_title = State(initialValue: playlist.title)
|
||||
_thumb = State(initialValue: playlist.thumb)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
@@ -254,7 +279,7 @@ struct PlaylistScreen: View {
|
||||
.navigationTitle(title)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
} else {
|
||||
Page(title: title, large: false) {
|
||||
Page(title: title, large: false, pullUp: BAR_PULL) {
|
||||
header(list)
|
||||
Loaded(state: tracks, retry: { reload += 1 }) { list in
|
||||
ForEach(Array(list.enumerated()), id: \.element.id) { i, t in
|
||||
@@ -267,14 +292,12 @@ struct PlaylistScreen: View {
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItemGroup(placement: .topBarTrailing) {
|
||||
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)) }
|
||||
if saving { ProgressView() }
|
||||
else if editing { Button("Done") { commit(list) }.bold() }
|
||||
else { MoreMenu(items: moreItems(list)) }
|
||||
}
|
||||
}
|
||||
.modifier(SplitHidesTitle(bare: !editing))
|
||||
.task(id: reload) {
|
||||
await LoadState.load($tracks) { try await g.plex.playlistTracks(playlist.ratingKey) }
|
||||
}
|
||||
@@ -282,7 +305,7 @@ struct PlaylistScreen: View {
|
||||
|
||||
private func header(_ list: [Track]) -> some View {
|
||||
VStack(spacing: 0) {
|
||||
Artwork(thumb: playlist.thumb, size: 230, corner: 10, placeholder: "music.note.list")
|
||||
Artwork(thumb: thumb, size: 230, corner: 10, placeholder: "music.note.list")
|
||||
Text(title).font(.title2.bold()).foregroundStyle(p.label).multilineTextAlignment(.center).lineLimit(2)
|
||||
.padding(.horizontal, 32).padding(.top, 14)
|
||||
if !list.isEmpty {
|
||||
@@ -293,7 +316,7 @@ struct PlaylistScreen: View {
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 8).padding(.bottom, 16)
|
||||
.padding(.bottom, 16)
|
||||
}
|
||||
|
||||
private func removeAction(_ t: Track) -> [SheetAction] {
|
||||
@@ -307,25 +330,13 @@ struct PlaylistScreen: View {
|
||||
}
|
||||
|
||||
private func moreItems(_ list: [Track]) -> [SheetAction] {
|
||||
var extra: [SheetAction] = []
|
||||
let plex = g.plex
|
||||
let key = playlist.ratingKey
|
||||
if !playlist.smart {
|
||||
extra.append(SheetAction("Rename…", icon: "pencil") {
|
||||
ui.overlays.prompt("Rename Playlist", nil, initial: title, "Save") { name in
|
||||
Task { if (try? await plex.renamePlaylist(key, title: name)) != nil { title = name } }
|
||||
}
|
||||
})
|
||||
}
|
||||
extra.append(SheetAction("Delete Playlist", icon: "trash", destructive: true) {
|
||||
ui.overlays.confirm("Delete “\(title)”?", "This removes it from Plex for every app.", "Delete") {
|
||||
Task { if (try? await plex.deletePlaylist(key)) != nil { ui.pop() } }
|
||||
}
|
||||
})
|
||||
let extra = playlist.smart || list.isEmpty ? [] :
|
||||
[SheetAction("Edit Songs", icon: "list.bullet") { items = list; removed = []; editing = true }]
|
||||
var pl = playlist
|
||||
pl.title = title
|
||||
pl.thumb = thumb
|
||||
pl.trackCount = list.count
|
||||
return ui.menu.playlist(pl, extra: extra)
|
||||
return ui.menu.playlist(pl, extra: extra, changed: { title = $0.title; thumb = $0.thumb }, deleted: { ui.pop() })
|
||||
}
|
||||
|
||||
/// Sends removals, then replays the new order as "move after" calls against a simulated server list.
|
||||
@@ -413,3 +424,18 @@ struct SearchScreen: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Split at the Duo's hinge the pane's own header already names the playlist, so the bar drops the title.
|
||||
/// How far a playlist page's header rides up into the empty nav bar, between back and •••.
|
||||
private let BAR_PULL: CGFloat = 40
|
||||
|
||||
/// Hides the bar title in split view, and while [bare] (the header already shows it).
|
||||
private struct SplitHidesTitle: ViewModifier {
|
||||
var bare = false
|
||||
@Environment(Ui.self) private var ui
|
||||
func body(content: Content) -> some View {
|
||||
content.toolbar {
|
||||
if ui.split || bare { ToolbarItem(placement: .principal) { Color.clear.frame(width: 1, height: 1) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
@@ -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.9.0"
|
||||
VERSION_LABEL: "0.9.0"
|
||||
CURRENT_PROJECT_VERSION: "39"
|
||||
MARKETING_VERSION: "0.10.1"
|
||||
VERSION_LABEL: "0.10.1"
|
||||
CURRENT_PROJECT_VERSION: "65"
|
||||
# Dev builds override these (build-ipa.sh dev) so they install next to the release app.
|
||||
APP_ID: org.cdnutter.stemify
|
||||
APP_NAME: Stemify
|
||||
|
||||
@@ -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",
|
||||
|
||||
+43
-5
@@ -30,6 +30,7 @@ import glob
|
||||
import hashlib
|
||||
import json
|
||||
import operator
|
||||
import re
|
||||
import os
|
||||
import shutil
|
||||
import signal
|
||||
@@ -63,6 +64,35 @@ PEAK_RATE = 2000 # Hz the envelope is computed at; plenty for a few hundred bar
|
||||
CHUNK = 1 << 20
|
||||
# The web player. Served without the token; it asks for one in its settings when TOKEN is set.
|
||||
WEB_DIR = os.path.realpath(os.environ.get("WEB_DIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "web")))
|
||||
|
||||
|
||||
# Web player build stamp: changes whenever any file in web/ does.
|
||||
_web_cache = {}
|
||||
|
||||
|
||||
def web_version():
|
||||
try:
|
||||
sig = sorted((e.name, e.stat().st_mtime_ns, e.stat().st_size) for e in os.scandir(WEB_DIR) if e.is_file())
|
||||
except OSError:
|
||||
return "0"
|
||||
return hashlib.sha1(repr(sig).encode()).hexdigest()[:10]
|
||||
|
||||
|
||||
def web_file(full, ver):
|
||||
"""File body with local asset URLs stamped with ?v=ver (html and js), and its ETag."""
|
||||
hit = _web_cache.get(full)
|
||||
if hit and hit[0] == ver:
|
||||
return hit[1], hit[2]
|
||||
with open(full, "rb") as f:
|
||||
body = f.read()
|
||||
ext = os.path.splitext(full)[1]
|
||||
if ext == ".html":
|
||||
body = re.sub(rb'((?:src|href)="(?:\./)?[\w-]+\.(?:js|css))"', rb'\1?v=' + ver.encode() + rb'"', body)
|
||||
elif ext == ".js":
|
||||
body = re.sub(rb'((?:from |import\()"\./[\w-]+\.js)"', rb'\1?v=' + ver.encode() + rb'"', body)
|
||||
etag = '"%s-%s"' % (ver, hashlib.sha1(body).hexdigest()[:8])
|
||||
_web_cache[full] = (ver, body, etag)
|
||||
return body, etag
|
||||
WEB_TYPES = {".html": "text/html; charset=utf-8", ".js": "text/javascript; charset=utf-8", ".css": "text/css; charset=utf-8",
|
||||
".svg": "image/svg+xml", ".png": "image/png", ".ico": "image/x-icon", ".json": "application/json"}
|
||||
|
||||
@@ -315,7 +345,9 @@ class Handler(BaseHTTPRequestHandler):
|
||||
def _error(self, status, msg):
|
||||
self._send(status, json.dumps({"error": msg}).encode())
|
||||
|
||||
def _web(self, path):
|
||||
def _web(self, path, query=""):
|
||||
"""The web player. index.html and the modules point at ?v=<build> URLs, so a new
|
||||
build is picked up on a plain reload and the versioned files cache for good."""
|
||||
if not SERVE_WEB:
|
||||
return self._error(404, "not found")
|
||||
if path == "/":
|
||||
@@ -323,10 +355,16 @@ class Handler(BaseHTTPRequestHandler):
|
||||
full = os.path.realpath(os.path.join(WEB_DIR, path.lstrip("/")))
|
||||
if not full.startswith(WEB_DIR + os.sep) or not os.path.isfile(full):
|
||||
return self._error(404, "not found")
|
||||
with open(full, "rb") as f:
|
||||
body = f.read()
|
||||
ver = web_version()
|
||||
body, etag = web_file(full, ver)
|
||||
ctype = WEB_TYPES.get(os.path.splitext(full)[1], "application/octet-stream")
|
||||
self._send(200, body, ctype, {"Cache-Control": "no-cache"})
|
||||
if "v=" + ver in query.split("&"):
|
||||
cache = "public, max-age=31536000, immutable"
|
||||
else:
|
||||
cache = "no-cache"
|
||||
if self.headers.get("If-None-Match") == etag:
|
||||
return self._send(304, b"", ctype, {"Cache-Control": cache, "ETag": etag})
|
||||
self._send(200, body, ctype, {"Cache-Control": cache, "ETag": etag})
|
||||
|
||||
def do_HEAD(self):
|
||||
self.do_GET()
|
||||
@@ -341,7 +379,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||
if path.startswith("/plex/") and PLEX_URL:
|
||||
return self._plex_proxy(path[len("/plex"):], url.query, query)
|
||||
if not path.startswith(("/api/", "/file/")):
|
||||
return self._web(path)
|
||||
return self._web(path, url.query)
|
||||
if not self._authorized(query):
|
||||
return self._error(HTTPStatus.UNAUTHORIZED, "bad token")
|
||||
try:
|
||||
|
||||
+593
-180
File diff suppressed because it is too large.
Load diff
+16
-14
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="theme-color" content="#0d0e12">
|
||||
<meta name="theme-color" content="#181819">
|
||||
<title>Stemify</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<style id="theme"></style>
|
||||
@@ -12,30 +12,32 @@
|
||||
<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>
|
||||
<a href="#/home" data-nav="home">Home</a>
|
||||
<a href="#/albums" data-nav="albums">Albums</a>
|
||||
<a href="#/artists" data-nav="artists">Artists</a>
|
||||
<a href="#/songs" data-nav="songs">Songs</a>
|
||||
<a href="#/genres" data-nav="genres">Genres</a>
|
||||
<a href="#/playlists" data-nav="playlists">Playlists</a>
|
||||
<a href="#/downloads" data-nav="downloads">Downloads</a>
|
||||
<a href="#/radio" data-nav="radio">Web Radio</a>
|
||||
<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>
|
||||
<a href="#/songs" data-nav="songs"><svg viewBox="0 0 24 24"><path d="M9 4l12-2v13.5a3.5 3.5 0 1 1-2-3.16V6.4l-8 1.33v9.77A3.5 3.5 0 1 1 9 14.34V4zm-3.5 12a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zm12-1a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z"/></svg>Songs</a>
|
||||
<a href="#/genres" data-nav="genres"><svg viewBox="0 0 24 24"><path d="M3 3h8.4l9.3 9.3a1.5 1.5 0 0 1 0 2.1l-6.3 6.3a1.5 1.5 0 0 1-2.1 0L3 11.4V3zm2 2v5.6l8.4 8.4 5.6-5.6L10.6 5H5zm2.5 1.5a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3z"/></svg>Genres</a>
|
||||
<a href="#/playlists" data-nav="playlists"><svg viewBox="0 0 24 24"><path d="M3 5h14v2H3zm0 6h14v2H3zm0 6h9v2H3zm16-4v-2l4 1v2l-2-.5V19a2.5 2.5 0 1 1-2-2.45V13z"/></svg>Playlists</a>
|
||||
<a href="#/downloads" data-nav="downloads"><svg viewBox="0 0 24 24"><path d="M11 3h2v10.2l3.6-3.6 1.4 1.4-6 6-6-6 1.4-1.4 3.6 3.6V3zM4 19h16v2H4z"/></svg>Downloads</a>
|
||||
<a href="#/radio" data-nav="radio"><svg viewBox="0 0 24 24"><path d="M12 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4zM7.8 7.8l1.4 1.4a4 4 0 0 0 0 5.6l-1.4 1.4a6 6 0 0 1 0-8.4zm8.4 0a6 6 0 0 1 0 8.4l-1.4-1.4a4 4 0 0 0 0-5.6l1.4-1.4zM5 5l1.4 1.4a8 8 0 0 0 0 11.2L5 19A10 10 0 0 1 5 5zm14 0a10 10 0 0 1 0 14l-1.4-1.4a8 8 0 0 0 0-11.2L19 5z"/></svg>Web Radio</a>
|
||||
<a href="#/settings" data-nav="settings" class="settings-link"><svg viewBox="0 0 24 24"><path d="M10.3 2h3.4l.5 2.6c.6.2 1.2.5 1.7.9l2.5-.9 1.7 2.9-2 1.8a7 7 0 0 1 0 1.9l2 1.8-1.7 2.9-2.5-.9c-.5.4-1.1.7-1.7.9l-.5 2.6h-3.4l-.5-2.6a7 7 0 0 1-1.7-.9l-2.5.9-1.7-2.9 2-1.8a7 7 0 0 1 0-1.9l-2-1.8 1.7-2.9 2.5.9c.5-.4 1.1-.7 1.7-.9l.5-2.6zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z" transform="translate(0 1)"/></svg>Settings</a>
|
||||
<div id="live" hidden></div>
|
||||
<a href="#/settings" data-nav="settings" class="settings-link">Settings</a>
|
||||
<div id="sideart"><button class="sa-img" title="Go to album"><img alt=""></button><button class="sa-col" title="Collapse art"><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></button></div>
|
||||
</aside>
|
||||
<main id="view"></main>
|
||||
<aside id="drawer" hidden></aside>
|
||||
</div>
|
||||
<footer id="player" class="empty">
|
||||
<div class="left">
|
||||
<div class="np">
|
||||
<img id="np-art" alt="">
|
||||
<button id="b-art" title="Expand art" hidden><img id="np-art" alt=""><span class="exp"><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></span></button>
|
||||
<div class="np-text"><div id="np-title"></div><div id="np-sub"></div></div>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
+28
-7
@@ -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 -------------------------------------------------------------------------------------
|
||||
@@ -193,7 +193,7 @@ const Pre = {
|
||||
// ---- engine -----------------------------------------------------------------------------------
|
||||
|
||||
export const E = {
|
||||
els: [], names: [], gains: [], urls: [], ctx: null, master: null,
|
||||
els: [], names: [], gains: [], meters: [], urls: [], ctx: null, master: null, mbuf: new Float32Array(1024),
|
||||
want: false, stalled: false, loading: false, loadFrac: 0, pendingPos: 0,
|
||||
entry: null, offline: null, ctl: null, gen: 0,
|
||||
|
||||
@@ -262,13 +262,15 @@ export const E = {
|
||||
el.src = s.url;
|
||||
el.playbackRate = el.defaultPlaybackRate = S.speed;
|
||||
if (this.pendingPos) el.currentTime = this.pendingPos;
|
||||
let gain = null;
|
||||
let gain = null, meter = null;
|
||||
if (graph) {
|
||||
gain = this.ctx.createGain();
|
||||
this.ctx.createMediaElementSource(el).connect(gain).connect(this.master);
|
||||
meter = this.ctx.createAnalyser();
|
||||
meter.fftSize = 1024;
|
||||
this.ctx.createMediaElementSource(el).connect(meter).connect(gain).connect(this.master);
|
||||
}
|
||||
if (s.blob) this.urls.push(s.url);
|
||||
this.els.push(el); this.gains.push(gain); this.names.push(s.name);
|
||||
this.els.push(el); this.gains.push(gain); this.meters.push(meter); this.names.push(s.name);
|
||||
}
|
||||
this.graph = graph;
|
||||
const lead = this.els[0];
|
||||
@@ -284,10 +286,21 @@ export const E = {
|
||||
this.ctl?.abort(); this.ctl = null;
|
||||
for (const el of this.els) { el.pause(); el.removeAttribute("src"); el.load(); }
|
||||
for (const u of this.urls) URL.revokeObjectURL(u);
|
||||
this.els = []; this.names = []; this.gains = []; this.urls = [];
|
||||
this.els = []; this.names = []; this.gains = []; this.meters = []; this.urls = [];
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
// A stem's live peak before its fader, 0..1 over a 48 dB range (0 without Web Audio).
|
||||
meter(name) {
|
||||
const a = this.meters[this.names.indexOf(name)];
|
||||
if (!a) return 0;
|
||||
const b = this.mbuf;
|
||||
a.getFloatTimeDomainData(b);
|
||||
let p = 0;
|
||||
for (let i = 0; i < b.length; i++) { const v = b[i] < 0 ? -b[i] : b[i]; if (v > p) p = v; }
|
||||
return p < 0.004 ? 0 : Math.min(1, (20 * Math.log10(p) + 48) / 48);
|
||||
},
|
||||
|
||||
applyGains() {
|
||||
const named = this.names.filter(Boolean);
|
||||
this.els.forEach((el, i) => {
|
||||
@@ -534,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}`);
|
||||
@@ -553,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");
|
||||
|
||||
+25
-4
@@ -23,17 +23,38 @@ 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 "";
|
||||
// Playlist composites are already images Plex renders at any size; the photo transcoder
|
||||
// can't fetch them, so ask for them directly.
|
||||
if (thumb.includes("/composite/")) return `${s.url}${thumb}${thumb.includes("?") ? "&" : "?"}width=${size}&height=${size}&X-Plex-Token=${s.token}`;
|
||||
return thumb && s
|
||||
? `${s.url}/photo/:/transcode?width=${size}&height=${size}&minSize=1&upscale=1&url=${encodeURIComponent(thumb)}&X-Plex-Token=${s.token}`
|
||||
: "";
|
||||
}
|
||||
|
||||
// Straight from Plex, no transcoder: the fallback for playlist composites.
|
||||
export function rawImg(srvId, path, size = 300) {
|
||||
const s = server(srvId);
|
||||
return s && path ? `${s.url}${path}${path.includes("?") ? "&" : "?"}width=${size}&height=${size}&X-Plex-Token=${s.token}` : "";
|
||||
}
|
||||
|
||||
export function partUrl(t) {
|
||||
const s = server(t.srv);
|
||||
return s && t.part ? `${s.url}${t.part}?X-Plex-Token=${s.token}` : null;
|
||||
@@ -46,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 },
|
||||
};
|
||||
}
|
||||
|
||||
+16
-1
@@ -24,10 +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: "amber", accent: "", css: "",
|
||||
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.
|
||||
|
||||
+348
-106
@@ -1,83 +1,135 @@
|
||||
:root {
|
||||
--bg: #0d0e12;
|
||||
--panel: #15171d;
|
||||
--raised: #1d2028;
|
||||
--line: #262a33;
|
||||
--text: #eceef3;
|
||||
--muted: #8a8f9c;
|
||||
--accent: #f2b544;
|
||||
--accent-ink: #1a1306;
|
||||
--radius: 12px;
|
||||
--player-h: 96px;
|
||||
--glass: #15171dee;
|
||||
--hover: #eceef30d;
|
||||
--bg: #181819;
|
||||
--panel: #101010;
|
||||
--raised: #262628;
|
||||
--line: #2b2b2e;
|
||||
--text: #e7e7e7;
|
||||
--muted: #a8a8a8;
|
||||
--accent: #3a81ed;
|
||||
--accent-ink: #ffffff;
|
||||
--radius: 6px;
|
||||
--player-h: 100px;
|
||||
--nav-w: 240px;
|
||||
--glass: #101010ee;
|
||||
--hover: #e7e7e70d;
|
||||
--shadow: #0009;
|
||||
--wave: #eceef344;
|
||||
--wave-ghost: #eceef314;
|
||||
--wave: #e7e7e744;
|
||||
--wave-ghost: #e7e7e714;
|
||||
color-scheme: dark;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
|
||||
font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
|
||||
font: 13px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
|
||||
* { scrollbar-width: thin; scrollbar-color: #5a5a5a80 transparent; }
|
||||
::-webkit-scrollbar { width: 8px; height: 8px; }
|
||||
::-webkit-scrollbar-thumb { background: #5a5a5a80; border-radius: 8px; }
|
||||
::-webkit-scrollbar-thumb:hover { background: #5a5a5a; }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
button, input, select, textarea { font: inherit; color: inherit; }
|
||||
button:disabled { opacity: .4; cursor: default; }
|
||||
button { background: none; border: 0; cursor: pointer; padding: 0; }
|
||||
a { color: inherit; text-decoration: none; }
|
||||
svg { width: 1em; height: 1em; fill: currentColor; display: block; }
|
||||
|
||||
#app { display: grid; grid-template-columns: 210px 1fr auto; height: calc(100% - var(--player-h)); }
|
||||
#nav { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; }
|
||||
.brand { white-space: nowrap; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; padding: 0 10px 18px; }
|
||||
#app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); height: calc(100% - var(--player-h)); }
|
||||
#nav { background: var(--panel); padding: 16px 10px 0; display: flex; flex-direction: column; gap: 1px; min-height: 0; overflow-y: auto; overflow-x: hidden; }
|
||||
#nav > * { flex: none; }
|
||||
.brand { white-space: nowrap; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; padding: 0 10px 6px; }
|
||||
.brand::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 3px; }
|
||||
#nav a { padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
|
||||
#nav a:hover { color: var(--text); }
|
||||
#nav a { display: flex; align-items: center; gap: 12px; min-height: 34px; padding: 0 10px; border-radius: 4px; color: var(--muted); font-weight: 500; white-space: nowrap; transition: color .12s, background-color .12s; }
|
||||
#nav a > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
||||
#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: 12px 0; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; outline: none; }
|
||||
#search input:focus { border-color: var(--accent); }
|
||||
.settings-link { margin-top: auto; }
|
||||
.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); }
|
||||
#app.sideart #sideart { display: block; animation: sain .28s cubic-bezier(.2, .8, .2, 1); }
|
||||
@keyframes sain { from { opacity: 0; transform: translateY(16px); } }
|
||||
#sideart .sa-img { display: block; width: 100%; aspect-ratio: 1; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--raised);
|
||||
box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent), 0 8px 22px rgba(0, 0, 0, .32); }
|
||||
#sideart img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
|
||||
#sideart .sa-img:hover img { transform: scale(1.035); }
|
||||
#sideart img:not([src]) { visibility: hidden; }
|
||||
#sideart .sa-col { position: absolute; top: 18px; right: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
|
||||
background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transform: scale(.9); transition: opacity .15s, transform .15s, background-color .15s; }
|
||||
#sideart .sa-col svg { width: 18px; height: 18px; fill: #fff; }
|
||||
#sideart:hover .sa-col, #sideart .sa-col:focus-visible { opacity: 1; transform: none; }
|
||||
#sideart .sa-col:hover { background: rgba(0, 0, 0, .8); }
|
||||
|
||||
#view { overflow-y: auto; padding: 28px 32px 48px; }
|
||||
h1 { font-size: 28px; letter-spacing: -0.02em; margin: 0 0 4px; }
|
||||
h2 { font-size: 17px; margin: 28px 0 12px; }
|
||||
#view { overflow-y: auto; padding: 24px 32px 48px; background: var(--bg); }
|
||||
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
|
||||
h2 { font-size: 18px; font-weight: 700; margin: 28px 0 12px; }
|
||||
.sub { color: var(--muted); }
|
||||
.bar { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; flex-wrap: wrap; }
|
||||
.bar h1 { margin-right: auto; }
|
||||
select, textarea, input[type=text], input[type=url], input[type=password] { background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; outline: none; }
|
||||
select, textarea, input[type=text], input[type=url], input[type=password] { background: var(--raised); border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; outline: none; }
|
||||
|
||||
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px 18px; }
|
||||
.card { display: block; min-width: 0; }
|
||||
.card img, .card .ph { width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover; background: var(--raised); display: block; transition: transform .15s; }
|
||||
.card:hover img { transform: translateY(-2px); }
|
||||
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
|
||||
.card { display: block; min-width: 0; padding: 10px; border-radius: var(--radius); content-visibility: auto; contain-intrinsic-size: auto 240px; transition: background-color .15s; }
|
||||
.card:hover { background: var(--hover); }
|
||||
.card .art { position: relative; }
|
||||
.card img, .card .ph { width: 100%; aspect-ratio: 1; border-radius: 4px; object-fit: cover; background: var(--raised); display: block; }
|
||||
.card.round img, .card.round .ph { border-radius: 50%; }
|
||||
.card .t { margin-top: 8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.card .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.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; }
|
||||
|
||||
.hero { display: flex; gap: 28px; align-items: flex-end; margin-bottom: 26px; }
|
||||
.hero img { width: 210px; height: 210px; border-radius: var(--radius); object-fit: cover; background: var(--raised); box-shadow: 0 20px 50px var(--shadow); }
|
||||
.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; }
|
||||
.card .s { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
|
||||
.hero { position: relative; isolation: isolate; overflow: hidden; margin: -24px -32px 0; padding: 64px 32px 28px; }
|
||||
.hero-bg { position: absolute; inset: 0; z-index: -1; will-change: transform; }
|
||||
.hero-bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(48px) saturate(1.4); transform: scale(1.3); opacity: .55; }
|
||||
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 0%, color-mix(in srgb, var(--bg) 55%, transparent) 55%, var(--bg) 100%); }
|
||||
.hero-in { display: flex; gap: 28px; align-items: flex-end; }
|
||||
.hero .art { width: 220px; height: 220px; flex: none; border-radius: 4px; object-fit: cover; background: var(--raised); box-shadow: 0 16px 40px #000a; }
|
||||
.hero .meta { min-width: 0; }
|
||||
.hero .kind { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
|
||||
.actions { display: flex; gap: 10px; margin-top: 16px; }
|
||||
.btn { background: var(--raised); border-radius: 999px; padding: 9px 18px; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
|
||||
.hero h1 { font-size: clamp(32px, 4.6vw, 64px); line-height: 1.05; font-weight: 900; margin: 6px 0 12px; overflow-wrap: anywhere;
|
||||
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
||||
.hero .sub { color: var(--text); opacity: .8; }
|
||||
.hero .sub a:hover { text-decoration: underline; }
|
||||
.hero .kind { color: var(--text); opacity: .75; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
|
||||
.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: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); }
|
||||
.btn { background: var(--raised); border-radius: 4px; padding: 8px 16px; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
|
||||
.btn.primary { background: var(--accent); color: var(--accent-ink); }
|
||||
.btn:hover { filter: brightness(1.12); }
|
||||
|
||||
.tracks { width: 100%; border-collapse: collapse; }
|
||||
.tracks tr { border-radius: 8px; }
|
||||
.tracks td { padding: 8px 10px; border-bottom: 1px solid var(--hover); white-space: nowrap; }
|
||||
.tracks tr:hover td { background: var(--panel); }
|
||||
.tracks tr.playing td { color: var(--accent); }
|
||||
.tracks .n { width: 36px; color: var(--muted); text-align: right; }
|
||||
.tracks .ti { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
||||
.tracks .ti small { color: var(--muted); margin-left: 8px; }
|
||||
.tracks .d { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
|
||||
.tracks { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
|
||||
.tracks th { position: sticky; top: -24px; z-index: 1; background: var(--bg); padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left;
|
||||
font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
|
||||
.tracks th svg { width: 14px; height: 14px; margin-left: auto; }
|
||||
.tracks td { padding: 6px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 52px; }
|
||||
.tracks tbody tr:hover td { background: var(--hover); }
|
||||
.tracks td:first-child { border-radius: 4px 0 0 4px; }
|
||||
.tracks td:last-child { border-radius: 0 4px 4px 0; }
|
||||
.tracks tr.playing .tt, .tracks tr.playing .n { color: var(--accent); }
|
||||
.tracks .n { width: 48px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
|
||||
.tracks .ti .tt { overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: 500; }
|
||||
.tracks .ti small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
|
||||
.tracks .al { width: 32%; color: var(--muted); }
|
||||
.tracks .d { width: 64px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
|
||||
.tracks tr { cursor: default; }
|
||||
.tracks .off { color: var(--accent); width: 20px; padding: 0 2px; font-size: 13px; }
|
||||
.tracks .acts { width: 1px; padding: 0 4px; }
|
||||
.tracks .off { color: var(--accent); width: 24px; padding: 0 2px; font-size: 13px; }
|
||||
.tracks .acts { width: 64px; padding: 0 4px; text-align: right; }
|
||||
.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.stems { color: var(--accent); }
|
||||
.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; }
|
||||
@@ -89,23 +141,26 @@ select, textarea, input[type=text], input[type=url], input[type=password] { back
|
||||
.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; }
|
||||
.btn.icon { padding: 9px 12px; }
|
||||
.hero .ph { width: 210px; height: 210px; border-radius: var(--radius); background: var(--raised); flex: none; }
|
||||
.hero .ph { width: 220px; height: 220px; border-radius: 4px; background: var(--raised); flex: none; }
|
||||
.hero .round { border-radius: 50%; }
|
||||
|
||||
/* Stems-only filter hides rows and cards without stems. */
|
||||
body.stems-only .tracks tr.nostem, body.stems-only .card.nostem { display: none; }
|
||||
.only-stems { display: none; }
|
||||
body.stems-only .tracks:not(:has(tr:not(.nostem))) + .only-stems { display: block; }
|
||||
body.stems-only .tracks:not(:has(tbody tr:not(.nostem))) + .only-stems { display: block; }
|
||||
.only-nostems { display: none; }
|
||||
body.no-stems .tracks tr:not(.nostem) { display: none; }
|
||||
body.no-stems .tracks:not(:has(tr.nostem)) ~ .only-nostems { display: block; }
|
||||
body.no-stems .tracks tbody tr:not(.nostem) { display: none; }
|
||||
body.no-stems .tracks:not(:has(tbody tr.nostem)) ~ .only-nostems { display: block; }
|
||||
.seg.stemfilter { display: inline-flex; }
|
||||
.seg.stemfilter button { padding: 5px 10px; white-space: nowrap; }
|
||||
|
||||
@@ -121,6 +176,48 @@ body.no-stems .tracks:not(:has(tr.nostem)) ~ .only-nostems { display: block; }
|
||||
#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; }
|
||||
@@ -133,38 +230,114 @@ body.no-stems .tracks:not(:has(tr.nostem)) ~ .only-nostems { display: block; }
|
||||
.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: 340px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 22px 20px; }
|
||||
#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 { 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; }
|
||||
.seg button { flex: 1; padding: 5px 4px; border-radius: 6px; font-size: 12px; color: var(--muted); }
|
||||
.seg button.on { background: var(--accent); color: var(--accent-ink); }
|
||||
.kara label { display: grid; gap: 4px; }
|
||||
.mixrow { margin-top: 16px; }
|
||||
.mixacts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 18px; }
|
||||
.mixacts:has(.ic) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) 36px; }
|
||||
.mact { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; min-width: 0; padding: 0 8px; border-radius: 8px;
|
||||
background: var(--raised); color: var(--text); font-size: 13px; font-weight: 600; transition: background-color .12s, color .12s, transform .08s; }
|
||||
.mact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.mact svg { width: 17px; height: 17px; flex: none; fill: currentColor; }
|
||||
.mact:hover { background: var(--hover); }
|
||||
.mact:active { transform: scale(.97); }
|
||||
.mact.on { background: color-mix(in srgb, var(--accent) 18%, var(--raised)); color: var(--accent); }
|
||||
.mact.ic { padding: 0; color: var(--muted); }
|
||||
.mact.ic:hover { color: #ff453a; }
|
||||
#lyr.synced p { margin: 0; padding: 7px 4px; font-size: 19px; font-weight: 700; line-height: 1.3; color: var(--muted); opacity: .55; cursor: pointer; transition: opacity .2s, color .2s; }
|
||||
#lyr.synced p:hover { opacity: .85; }
|
||||
#lyr.synced p.on { color: var(--text); opacity: 1; }
|
||||
@@ -175,13 +348,31 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
|
||||
.chip { background: var(--raised); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; }
|
||||
.chip.on { background: var(--accent); color: var(--accent-ink); }
|
||||
.chip:disabled { opacity: .35; cursor: default; }
|
||||
.stem { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 6px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
|
||||
.stem .name { text-transform: capitalize; font-weight: 600; }
|
||||
.stem.silent .name { color: var(--muted); }
|
||||
.stem input { grid-column: 1 / -1; width: 100%; }
|
||||
.ms { width: 30px; height: 26px; border-radius: 6px; background: var(--raised); font-size: 12px; font-weight: 700; color: var(--muted); }
|
||||
.ms.on { background: var(--text); color: var(--bg); }
|
||||
.ms.solo.on { background: var(--accent); color: var(--accent-ink); }
|
||||
.strips { display: flex; gap: 8px; justify-content: center; margin: 4px 0 6px; --fh: clamp(170px, calc(100vh - var(--player-h) - 470px), 320px); }
|
||||
.stem { --c: #8e8e93; flex: 1 1 0; min-width: 0; max-width: 58px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
|
||||
.stem .pct { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
|
||||
.stem .name { text-align: center; text-transform: capitalize; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.fader { position: relative; height: var(--fh); border-radius: 12px; overflow: hidden; cursor: ns-resize; touch-action: none; user-select: none; -webkit-user-select: none; outline: none;
|
||||
background: color-mix(in srgb, var(--c) 9%, var(--raised)); contain: strict; }
|
||||
.fader i { position: absolute; display: block; pointer-events: none; }
|
||||
.fader .lvl, .fader .mtr { inset: 0; transform-origin: bottom; will-change: transform; }
|
||||
.fader .lvl { transform: scaleY(var(--v)); background: linear-gradient(to top, color-mix(in srgb, var(--c) 30%, transparent), color-mix(in srgb, var(--c) 46%, transparent)); }
|
||||
.fader .mtr { transform: scaleY(0); background: linear-gradient(to top, color-mix(in srgb, var(--c) 82%, #000), var(--c)); }
|
||||
.fader .cap { left: 0; right: 0; top: 4px; bottom: 4px; transform: translateY(calc((1 - var(--v)) * 100%)); will-change: transform; }
|
||||
.fader .cap b { position: absolute; left: 6px; right: 6px; top: -3px; height: 6px; border-radius: 3px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); transition: transform .1s; }
|
||||
.fader:hover .cap b, .fader.drag .cap b { transform: scaleY(1.35); }
|
||||
.fader:focus-visible { box-shadow: inset 0 0 0 2px var(--c); }
|
||||
.stem.silent .fader, .stem.silent .name { opacity: .4; }
|
||||
.stem.silent .mtr { visibility: hidden; }
|
||||
.msrow { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
|
||||
.ms { height: 26px; min-width: 0; border-radius: 6px; background: var(--raised); font-size: 11px; font-weight: 800; color: var(--muted);
|
||||
transition: transform .08s, background-color .12s, color .12s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
|
||||
.ms:hover { color: var(--text); }
|
||||
.ms:active { transform: scale(.88); }
|
||||
.ms.mute.on { background: #ff453a; color: #fff; }
|
||||
.ms.solo.on { background: #ffcc00; color: #1a1400; }
|
||||
.chip, .pill, .seg button, .transport button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
|
||||
.chip:active:not(:disabled), .pill:active { transform: scale(.94); }
|
||||
.q-item { display: flex; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 8px; cursor: pointer; }
|
||||
.q-item:hover { background: var(--raised); }
|
||||
.q-item img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; background: var(--raised); flex: none; }
|
||||
@@ -194,30 +385,42 @@ 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; }
|
||||
|
||||
#player { position: fixed; left: 0; right: 0; bottom: 0; height: var(--player-h); background: var(--glass); backdrop-filter: blur(20px);
|
||||
border-top: 1px solid var(--line); 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 { opacity: .35; pointer-events: none; }
|
||||
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; }
|
||||
.left { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
||||
#b-art { position: relative; flex: none; width: 60px; height: 60px; padding: 0; border-radius: 4px; overflow: hidden; }
|
||||
#b-art[hidden] { display: none; }
|
||||
#b-art .exp { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .7);
|
||||
opacity: 0; transform: scale(.85); transition: opacity .15s, transform .15s; }
|
||||
#b-art .exp svg { width: 15px; height: 15px; fill: #fff; }
|
||||
#b-art:hover .exp, #b-art:focus-visible .exp { opacity: 1; transform: none; }
|
||||
#player.sideart #b-art { display: none; }
|
||||
.np { display: flex; gap: 12px; align-items: center; min-width: 0; }
|
||||
#np-art { width: 58px; height: 58px; border-radius: 8px; object-fit: cover; background: var(--raised); flex: none; }
|
||||
#np-art { width: 60px; height: 60px; border-radius: 4px; object-fit: cover; background: var(--raised); flex: none; }
|
||||
#np-art:not([src]) { display: none; }
|
||||
.np-text { min-width: 0; }
|
||||
#np-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
#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; }
|
||||
.transport { display: flex; justify-content: center; align-items: center; gap: 18px; font-size: 20px; }
|
||||
.transport button { color: var(--text); }
|
||||
.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; }
|
||||
.transport .side { color: var(--muted); font-size: 17px; position: relative; }
|
||||
.transport .side.on { color: var(--accent); }
|
||||
.transport .side.on::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
|
||||
.transport .play { width: 40px; height: 40px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 18px; }
|
||||
.transport .play { width: 36px; height: 36px; border-radius: 50%; background: var(--text); color: var(--bg) !important; display: grid; place-items: center; font-size: 16px; transition: transform .1s; }
|
||||
.transport .play:hover { transform: scale(1.06); }
|
||||
.transport .play.busy svg { animation: spin 1s linear infinite; }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
.seek { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
|
||||
.seek span:last-child { text-align: right; }
|
||||
#wave { width: 100%; height: 32px; cursor: pointer; display: block; }
|
||||
.right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
|
||||
.pill { color: var(--muted); font-size: 18px; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; }
|
||||
.pill.on { background: var(--raised); color: var(--accent); }
|
||||
.pill { color: #c5c5c5; font-size: 18px; width: 34px; height: 34px; border-radius: 4px; display: grid; place-items: center; }
|
||||
.pill:hover { color: #fff; }
|
||||
.pill.on { color: var(--accent); }
|
||||
.pill { position: relative; }
|
||||
.pill.dot::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
|
||||
.np { cursor: pointer; }
|
||||
@@ -227,26 +430,40 @@ 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; }
|
||||
#app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
|
||||
: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; }
|
||||
#nav a { white-space: nowrap; }
|
||||
#search input { margin: 0; width: 120px; }
|
||||
#nav a { white-space: nowrap; overflow: visible; }
|
||||
#nav a svg, #sideart, #b-art .exp { display: none !important; }
|
||||
#nav { overflow-y: hidden; }
|
||||
#nav a { min-height: 32px; }
|
||||
.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 .ti small { display: block; margin-left: 0; }
|
||||
.tracks .al, .tracks .off { display: none; }
|
||||
.tracks .n { width: 34px; }
|
||||
.tracks th { top: -20px; }
|
||||
.settings-link { margin-top: 0; }
|
||||
#view { padding: 20px 16px 40px; }
|
||||
#drawer { position: fixed; inset: auto 0 var(--player-h) 0; width: auto; max-height: 60vh; border-left: 0; border-top: 1px solid var(--line); z-index: 5; }
|
||||
#drawer, #drawer.mixing { position: fixed; inset: auto 0 var(--player-h) 0; width: auto; max-height: 60vh; border-left: 0; border-top: 1px solid var(--line); z-index: 5; }
|
||||
#player { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 8px 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
|
||||
.center { grid-column: 1 / -1; grid-row: 2; }
|
||||
.right #volume { display: none; }
|
||||
.hero { flex-direction: column; align-items: flex-start; }
|
||||
.hero img { width: 160px; height: 160px; }
|
||||
.grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px 12px; }
|
||||
.hero { margin: -20px -16px 0; padding: 32px 16px 20px; }
|
||||
.hero-in { flex-direction: column; align-items: flex-start; gap: 18px; }
|
||||
.hero .art, .hero .ph { width: 160px; height: 160px; }
|
||||
.cplay { opacity: 1; transform: none; width: 36px; height: 36px; font-size: 14px; }
|
||||
.grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
|
||||
.card { padding: 6px; }
|
||||
.strips { --fh: clamp(140px, 24vh, 220px); }
|
||||
.stem { max-width: 64px; }
|
||||
}
|
||||
|
||||
/* presets */
|
||||
@@ -260,7 +477,7 @@ input[type=range] { accent-color: var(--accent); }
|
||||
.prow .btn.on { background: var(--accent); color: var(--accent-ink); }
|
||||
|
||||
/* home */
|
||||
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 16px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; }
|
||||
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 170px; gap: 4px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; }
|
||||
.shelf.two { grid-template-rows: auto auto; }
|
||||
.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
|
||||
.station { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 16px; border-radius: 12px; background: var(--raised); }
|
||||
@@ -283,3 +500,28 @@ input[type=number]#precachen { width: 64px; background: var(--raised); border: 1
|
||||
/* about */
|
||||
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; }
|
||||
.person { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; background: var(--raised); }
|
||||
|
||||
/* toolbar shares its row with the filter/sort bar on wide screens */
|
||||
@media (min-width: 861px) {
|
||||
.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: 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; }
|
||||
+9
-1
@@ -33,8 +33,16 @@ export function toast(msg, ms = 2400) {
|
||||
}
|
||||
|
||||
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>',
|
||||
|
||||
Reference in new issue
Block a user