Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed0fd1d184 | ||
|
|
55f8574eaa | ||
|
|
07b5636bac | ||
|
|
88d3aa48e7 | ||
|
|
d6da47db9d | ||
|
|
4dfcfbf434 | ||
|
|
56c92e8b93 | ||
|
|
639b5368ff | ||
|
|
cfaedd06cf | ||
|
|
8f3a10df2f | ||
|
|
5868430f8a | ||
|
|
566c5f7e8f | ||
|
|
e833af2704 | ||
|
|
c9fa90a840 | ||
|
|
0516362461 | ||
|
|
7843ff562b | ||
|
|
9e0d7236c2 | ||
|
|
8e57b9d0cd | ||
|
|
0c9cae5b11 | ||
|
|
a79c134838 |
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] = [
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -67,6 +67,8 @@ final class Ui {
|
||||
}
|
||||
/// True while an unfolded iPhone Duo shows Now Playing docked beside the library.
|
||||
private(set) var split = false
|
||||
/// Unfolded Duo in any orientation (a hinge is showing), even before it has turned to landscape.
|
||||
private(set) var unfolded = false
|
||||
/// Split only: the Now Playing tab (the deck) is selected instead of `tab`.
|
||||
var deck = true
|
||||
/// Split only: which of the deck's pages is showing.
|
||||
@@ -123,7 +125,8 @@ final class Ui {
|
||||
/// This phone has shown the Duo's folded status column at least once (saved).
|
||||
private var duo = UserDefaults.standard.bool(forKey: "duoSeen")
|
||||
/// Folded iPhone Duo: the outer display, kept upright.
|
||||
var folded: Bool { duo && !split }
|
||||
var folded: Bool { duo && !split && !unfolded }
|
||||
var isDuo: Bool { duo }
|
||||
|
||||
/// Called with the window's side insets. Upright, only the folded Duo has a trailing one.
|
||||
func sawInsets(trailing: CGFloat, upright: Bool) {
|
||||
@@ -136,8 +139,21 @@ final class Ui {
|
||||
|
||||
/// 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.
|
||||
/// Back in the foreground: the phone may have been folded or unfolded meanwhile.
|
||||
/// The split/unfolded flags are from before the app left, so locking on them at once can force
|
||||
/// landscape on a phone folded meanwhile. Free the rotation while away and decide again once
|
||||
/// the window has settled to the screen it came back on.
|
||||
func resumed() {
|
||||
Task { @MainActor in
|
||||
try? await Task.sleep(for: .milliseconds(300))
|
||||
self.lockOrientation()
|
||||
}
|
||||
}
|
||||
|
||||
func backgrounded() { Orientation.lock(.allButUpsideDown) }
|
||||
|
||||
private func lockOrientation() {
|
||||
if split { Orientation.lock(.landscape); return }
|
||||
if split || unfolded { Orientation.lock(.landscape); return }
|
||||
guard folded else { Orientation.lock(.allButUpsideDown); return }
|
||||
Task { @MainActor in
|
||||
try? await Task.sleep(for: .milliseconds(400))
|
||||
@@ -145,6 +161,12 @@ final class Ui {
|
||||
}
|
||||
}
|
||||
|
||||
func setUnfolded(_ on: Bool) {
|
||||
guard on != unfolded else { return }
|
||||
unfolded = on
|
||||
lockOrientation()
|
||||
}
|
||||
|
||||
func setSplit(_ on: Bool) {
|
||||
guard on != split else { return }
|
||||
split = on
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,25 +15,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 +27,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 +41,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,12 +62,13 @@ 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
|
||||
/// 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
|
||||
/// The screen's height, for the strip at the top that a drag down closes from.
|
||||
@@ -124,7 +82,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,7 +93,7 @@ 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) {
|
||||
panelView(track, header: false)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
@@ -168,11 +126,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) {
|
||||
@@ -190,19 +151,14 @@ struct NowPlayingScreen: View {
|
||||
.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,
|
||||
case .Art: ArtPanel(thumb: track.thumb, playing: g.playback.playWhenReady, inset: header ? artInset : 12,
|
||||
leading: folded && !docked && !ui.split && g.settings.foldedArtLeft).contentShape(Rectangle())
|
||||
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) }) }
|
||||
@@ -219,7 +175,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 +192,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)
|
||||
@@ -856,7 +812,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 +928,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 +936,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 +956,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 +1000,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 +1031,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 +1183,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 +1272,24 @@ private struct LyricsPanel: View {
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
// Soft leaves the singer in quietly as a guide.
|
||||
HStack(spacing: 12) {
|
||||
Text("Vocals").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
|
||||
Picker("Vocals", selection: Binding(get: { g.playback.karaokeVocals }, set: { g.playback.setKaraokeVocals($0) })) {
|
||||
ForEach(KaraokeVocals.allCases, id: \.self) { Text(String(describing: $0)).tag($0) }
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
}
|
||||
.padding(.horizontal, 28).padding(.top, 8)
|
||||
if g.playback.karaokeVocals == .Soft {
|
||||
let db = g.settings.karaokeSoftDb
|
||||
if g.playback.source == .Stems && g.playback.stemNames.contains("vocals") {
|
||||
HStack(spacing: 12) {
|
||||
Text("Softness").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
|
||||
Slider(value: Binding(get: { Double(db) }, set: { g.playback.setKaraokeSoftDb(Int($0.rounded())) }), in: -30...(-3), step: 1)
|
||||
Text("\(db) dB").font(.caption).monospacedDigit().foregroundStyle(p.label2).frame(width: 46, alignment: .trailing)
|
||||
Text("Vocals").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
|
||||
Picker("Vocals", selection: Binding(get: { g.playback.karaokeVocals }, set: { g.playback.setKaraokeVocals($0) })) {
|
||||
ForEach(KaraokeVocals.allCases, id: \.self) { Text(String(describing: $0)).tag($0) }
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
}
|
||||
.padding(.horizontal, 28).padding(.top, 8)
|
||||
if g.playback.karaokeVocals == .Soft {
|
||||
let db = g.settings.karaokeSoftDb
|
||||
HStack(spacing: 12) {
|
||||
Text("Softness").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
|
||||
Slider(value: Binding(get: { Double(db) }, set: { g.playback.setKaraokeSoftDb(Int($0.rounded())) }), in: -30...(-3), step: 1)
|
||||
Text("\(db) dB").font(.caption).monospacedDigit().foregroundStyle(p.label2).frame(width: 46, alignment: .trailing)
|
||||
}
|
||||
.padding(.horizontal, 28).padding(.top, 8)
|
||||
}
|
||||
}
|
||||
content
|
||||
}
|
||||
|
||||
@@ -159,11 +159,12 @@ struct StemPlaylistScreen: View {
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItemGroup(placement: .topBarTrailing) {
|
||||
if !editing { MoreMenu(items: moreItems(pl)) }
|
||||
if editing { Button("Done") { g.stemPlaylists.setItems(pl.id, items); editing = false }.bold() }
|
||||
else if !pl.items.isEmpty { Button("Edit") { items = pl.items; editing = true } }
|
||||
if !editing { MoreMenu(items: moreItems(pl)) }
|
||||
}
|
||||
}
|
||||
.modifier(SplitHidesTitle())
|
||||
}
|
||||
|
||||
private func header(_ pl: StemPlaylist) -> some View {
|
||||
@@ -267,14 +268,15 @@ struct PlaylistScreen: View {
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItemGroup(placement: .topBarTrailing) {
|
||||
if !editing { MoreMenu(items: moreItems(list)) }
|
||||
if !playlist.smart && !list.isEmpty {
|
||||
if saving { ProgressView() }
|
||||
else if editing { Button("Done") { commit(list) }.bold() }
|
||||
else { Button("Edit") { items = list; removed = []; editing = true } }
|
||||
}
|
||||
if !editing { MoreMenu(items: moreItems(list)) }
|
||||
}
|
||||
}
|
||||
.modifier(SplitHidesTitle())
|
||||
.task(id: reload) {
|
||||
await LoadState.load($tracks) { try await g.plex.playlistTracks(playlist.ratingKey) }
|
||||
}
|
||||
@@ -413,3 +415,13 @@ struct SearchScreen: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Split at the Duo's hinge the pane's own header already names the playlist, so the bar drops the title.
|
||||
private struct SplitHidesTitle: ViewModifier {
|
||||
@Environment(Ui.self) private var ui
|
||||
func body(content: Content) -> some View {
|
||||
content.toolbar {
|
||||
if ui.split { ToolbarItem(placement: .principal) { Color.clear.frame(width: 1, height: 1) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.10.0"
|
||||
VERSION_LABEL: "0.10.0"
|
||||
CURRENT_PROJECT_VERSION: "40"
|
||||
MARKETING_VERSION: "0.10.1"
|
||||
VERSION_LABEL: "0.10.1"
|
||||
CURRENT_PROJECT_VERSION: "50"
|
||||
# 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": "49",
|
||||
"date": "2026-11-20T10:33:02-08:00",
|
||||
"localizedDescription": "iOS: full-screen Now Playing watches the hinge so unfolding goes landscape; build 49",
|
||||
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v0.10.1/stemify-0.10.1.ipa",
|
||||
"size": 3141489,
|
||||
"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",
|
||||
|
||||
+131
-70
@@ -28,8 +28,55 @@ const inkFor = hex => {
|
||||
const n = parseInt(hex.slice(1), 16), l = (0.299 * (n >> 16) + 0.587 * (n >> 8 & 255) + 0.114 * (n & 255)) / 255;
|
||||
return l > 0.6 ? "#141414" : "#ffffff";
|
||||
};
|
||||
// Theme from the playing track's art: one hue taken from the art, laid over the chosen theme's lightness.
|
||||
const hex = (h, s, l) => {
|
||||
const f = n => { const k = (n + h * 12) % 12, c = l - s * Math.min(l, 1 - l) * Math.max(-1, Math.min(k - 3, 9 - k, 1)); return Math.round(c * 255).toString(16).padStart(2, "0"); };
|
||||
return "#" + f(0) + f(8) + f(4);
|
||||
};
|
||||
function artPalette([h, s0, v], base) {
|
||||
const s = Math.min(s0, 0.9), tint = Math.min(s * 0.55, 0.32), clamp = (x, a, b) => Math.max(a, Math.min(b, x));
|
||||
if (base.light) return { bg: hex(h, tint, .955), panel: hex(h, tint, .985), raised: hex(h, tint, .9), line: hex(h, tint, .85),
|
||||
text: hex(h, .2, .1), muted: hex(h, .08, .42), accent: hex(h, Math.max(s, .55), clamp(v * .45, .32, .42)), light: true };
|
||||
const black = base.bg === "#000000";
|
||||
return { bg: black ? "#000000" : hex(h, tint, .09), panel: black ? "#000000" : hex(h, tint, .06), raised: hex(h, tint, black ? .085 : .145), line: hex(h, tint, black ? .12 : .18),
|
||||
text: hex(h, .15, .93), muted: hex(h, .1, .66), accent: hex(h, Math.max(s, .55), clamp(v * .7, .58, .7)) };
|
||||
}
|
||||
// Roughly a vibrant swatch: the circular mean hue of the most colorful mid-bright pixels.
|
||||
function vibrant(bm) {
|
||||
const n = 24, cv = new OffscreenCanvas(n, n), cx = cv.getContext("2d", { willReadFrequently: true });
|
||||
cx.drawImage(bm, 0, 0, n, n);
|
||||
const d = cx.getImageData(0, 0, n, n).data, px = [];
|
||||
for (let i = 0; i < d.length; i += 4) {
|
||||
const r = d[i] / 255, g = d[i + 1] / 255, b = d[i + 2] / 255, mx = Math.max(r, g, b), mn = Math.min(r, g, b), c = mx - mn;
|
||||
const h = !c ? 0 : mx === r ? ((g - b) / c + 6) % 6 / 6 : mx === g ? ((b - r) / c + 2) / 6 : ((r - g) / c + 4) / 6, s = mx ? c / mx : 0;
|
||||
px.push([h, s, mx, s * (1 - Math.abs(mx - 0.55) * 1.4)]);
|
||||
}
|
||||
const top = px.sort((a, b) => b[3] - a[3]).slice(0, px.length / 6);
|
||||
let x = 0, y = 0, s = 0, v = 0;
|
||||
for (const p of top) { x += Math.cos(p[0] * 2 * Math.PI); y += Math.sin(p[0] * 2 * Math.PI); s += p[1]; v += p[2]; }
|
||||
return s / top.length < 0.12 ? null : [(Math.atan2(y, x) / (2 * Math.PI) + 1) % 1, s / top.length, v / top.length];
|
||||
}
|
||||
const ArtTheme = {
|
||||
url: "", hsv: null, seq: 0, cache: new Map(),
|
||||
async set(url) {
|
||||
if (!S.artTheme) url = "";
|
||||
if (url === this.url) return;
|
||||
this.url = url;
|
||||
const n = ++this.seq;
|
||||
let hsv = url ? this.cache.get(url) : null;
|
||||
if (url && !this.cache.has(url)) {
|
||||
try {
|
||||
const r = await fetch(url, { signal: AbortSignal.timeout(8000) });
|
||||
hsv = vibrant(await createImageBitmap(await r.blob()));
|
||||
this.cache.set(url, hsv);
|
||||
} catch { hsv = null; }
|
||||
if (n !== this.seq) return;
|
||||
}
|
||||
this.hsv = hsv; applyTheme();
|
||||
},
|
||||
};
|
||||
function applyTheme() {
|
||||
const t = THEMES[S.theme] || THEMES.graphite, a = S.accent || t.accent;
|
||||
const base = THEMES[S.theme] || THEMES.graphite, t = ArtTheme.hsv ? artPalette(ArtTheme.hsv, base) : base, a = ArtTheme.hsv ? t.accent : S.accent || t.accent;
|
||||
$("#theme").textContent = `:root{--bg:${t.bg};--panel:${t.panel};--raised:${t.raised};--line:${t.line};--text:${t.text};--muted:${t.muted};` +
|
||||
`--accent:${a};--accent-ink:${inkFor(a)};--glass:${t.panel}ee;--hover:${t.text}0d;--shadow:${t.light ? "#0003" : "#0009"};` +
|
||||
`--wave:${t.text}44;--wave-ghost:${t.text}14;color-scheme:${t.light ? "light" : "dark"}}`;
|
||||
@@ -174,7 +221,7 @@ const UI = {
|
||||
$("#np-title").textContent = st.name;
|
||||
$("#np-sub").textContent = "Web Radio";
|
||||
$("#np-art").removeAttribute("src");
|
||||
$("#b-art").hidden = true; SideArt.fill();
|
||||
$("#b-art").hidden = true; SideArt.fill(); ArtTheme.set("");
|
||||
document.title = `${st.name} · Stemify`;
|
||||
if ("mediaSession" in navigator) navigator.mediaSession.metadata = new MediaMetadata({ title: st.name, artist: "Web Radio" });
|
||||
return;
|
||||
@@ -185,7 +232,7 @@ const UI = {
|
||||
$("#np-sub").textContent = t ? [t.artist, t.album].filter(Boolean).join(" · ") : "";
|
||||
const art = artOf(t, 120);
|
||||
if (art) $("#np-art").src = art; else $("#np-art").removeAttribute("src");
|
||||
$("#b-art").hidden = !art; SideArt.fill();
|
||||
$("#b-art").hidden = !art; SideArt.fill(); ArtTheme.set(artOf(t, 64));
|
||||
document.title = t ? `${t.title} · Stemify` : "Stemify";
|
||||
if ("mediaSession" in navigator) {
|
||||
navigator.mediaSession.metadata = t ? new MediaMetadata({
|
||||
@@ -240,7 +287,7 @@ const karaokeHtml = () => `<div class="kara">
|
||||
<div class="seg">${[["off", "No vocals"], ["soft", "Soft vocals"], ["on", "Vocals on"]].map(([m, l]) => `<button class="${S.karaokeMode === m ? "on" : ""}" data-kmode="${m}">${l}</button>`).join("")}</div>
|
||||
${S.karaokeMode === "soft" ? `<label class="note">Soft vocals: <b id="softdb">${S.softDb} dB</b><input type="range" min="-30" max="-3" step="1" value="${S.softDb}" data-softdb></label>` : ""}</div>`;
|
||||
|
||||
// Stem colours match the iOS app.
|
||||
// Stem colors match the iOS app.
|
||||
const STEM_COLORS = { vocals: "#ff7ab6", drums: "#ffb547", bass: "#7c8cff", other: "#4cd07d", guitar: "#ff8a5c", piano: "#b48cff", instrumental: "#3dd6c6" };
|
||||
const pct = v => Math.round(v * 100) + "%";
|
||||
function presetsHtml(names) {
|
||||
@@ -1105,92 +1152,98 @@ const SECTIONS = [["plex", "Plex"], ["stems", "Stem server"], ["stemopts", "Stem
|
||||
["offline", "Offline"], ["backup", "Backup"], ["keys", "Keys"], ["about", "About"]];
|
||||
const BAR = [["speed", "Speed"], ["mixer", "Mixer"], ["lyrics", "Lyrics"], ["queue", "Queue"]];
|
||||
|
||||
// Settings rows: label on the left, control on the right, grouped into cards.
|
||||
const srow = (title, ctrl, sub = "") => `<div class="sr"><div class="sl"><span>${title}</span>${sub ? `<small>${sub}</small>` : ""}</div><div class="sc">${ctrl}</div></div>`;
|
||||
const stog = (title, input, sub = "") => `<label class="sr"><div class="sl"><span>${title}</span>${sub ? `<small>${sub}</small>` : ""}</div><div class="sc">${input}</div></label>`;
|
||||
const sw = (attrs, on) => `<input type="checkbox" class="sw" ${attrs} ${on ? "checked" : ""}>`;
|
||||
|
||||
function presetEditor() {
|
||||
const ps = presets(), lock = S.lockedPreset && allPresets().find(p => p.id === S.lockedPreset);
|
||||
return `<h3>Locked</h3>
|
||||
${lock ? `<div class="prow"><span class="pn">${ICON.lock}${esc(presetLabel(lock.name))}</span><span class="grow"></span><button class="btn small" data-plock="${esc(lock.id)}">Unlock</button></div>` : `<p class="note">Nothing locked.</p>`}
|
||||
<h3>Mixer Bar</h3><div class="plist">${ps.map((p, i) => `<div class="prow"><span class="pn">${esc(presetLabel(p.name))}${p.custom ? ' <span class="tag">CUSTOM</span>' : ""}</span><span class="grow"></span>
|
||||
<button class="btn small ${lock?.id === p.id ? "on" : ""}" data-plock="${esc(p.id)}" title="${lock?.id === p.id ? "Unlock" : "Lock"}">${ICON.lock}</button>
|
||||
<button class="btn small" data-pmove="${esc(p.id)}" data-pdir="-1" ${i ? "" : "disabled"} title="Move up">↑</button>
|
||||
<button class="btn small" data-pmove="${esc(p.id)}" data-pdir="1" ${i < ps.length - 1 ? "" : "disabled"} title="Move down">↓</button>
|
||||
<button class="btn small" data-pdel="${esc(p.id)}" ${p.id === "b:Full Mix" ? "disabled" : ""} title="Delete">×</button></div>`).join("")}</div>
|
||||
<h3>Stems</h3><div class="row">
|
||||
<button class="btn small" data-padd ${mixNames().length ? "" : "disabled"} title="Play a song with stems to save its mix">Save the current mix as a preset</button>
|
||||
<button class="btn small" data-prestore ${S.hiddenPresets.length ? "" : "disabled"}>Restore Deleted Presets</button>
|
||||
<button class="btn small" data-pclear ${S.customPresets.length ? "" : "disabled"}>Delete All Custom Presets</button></div>`;
|
||||
return `<div class="sg">${srow("Locked preset", lock
|
||||
? `<span class="val">${ICON.lock}${esc(presetLabel(lock.name))}</span><button class="btn small" data-plock="${esc(lock.id)}">Unlock</button>`
|
||||
: `<span class="val dim">None</span>`)}</div>
|
||||
<h3 class="sgh">Mixer bar</h3>
|
||||
<div class="sg">${ps.map((p, i) => `<div class="sr"><div class="sl"><span>${esc(presetLabel(p.name))}${p.custom ? ' <span class="tag">CUSTOM</span>' : ""}</span></div><div class="sc ibs">
|
||||
<button class="ib ${lock?.id === p.id ? "on" : ""}" data-plock="${esc(p.id)}" title="${lock?.id === p.id ? "Unlock" : "Lock"}">${ICON.lock}</button>
|
||||
<button class="ib" data-pmove="${esc(p.id)}" data-pdir="-1" ${i ? "" : "disabled"} title="Move up">${ICON.up}</button>
|
||||
<button class="ib" data-pmove="${esc(p.id)}" data-pdir="1" ${i < ps.length - 1 ? "" : "disabled"} title="Move down">${ICON.down}</button>
|
||||
<button class="ib bad" data-pdel="${esc(p.id)}" ${p.id === "b:Full Mix" ? "disabled" : ""} title="Delete">${ICON.x}</button></div></div>`).join("")}</div>
|
||||
<div class="sg">
|
||||
<button class="sr act" data-padd ${mixNames().length ? "" : "disabled"}>Save current mix as preset</button>
|
||||
<button class="sr act" data-prestore ${S.hiddenPresets.length ? "" : "disabled"}>Restore deleted presets</button>
|
||||
<button class="sr act bad" data-pclear ${S.customPresets.length ? "" : "disabled"}>Delete all custom presets</button></div>`;
|
||||
}
|
||||
on("presets", () => { const el = $("#pedit"); if (el) el.innerHTML = presetEditor(); });
|
||||
const FORMATS = [["opus96", "Opus 96 kbps"], ["opus160", "Opus 160 kbps"], ["opus256", "Opus 256 kbps"], ["flac", "FLAC (original)"]];
|
||||
|
||||
function serverHtml(srv) {
|
||||
const dup = srv.mid && S.servers.find(o => o !== srv && o.mid === srv.mid && S.servers.indexOf(o) < S.servers.indexOf(srv));
|
||||
return `<div class="srv"><div class="row"><b>${esc(srv.name || srv.url)}</b>
|
||||
<span class="note">${srv.env ? "through this stemserve (PLEX_URL)" : esc(srv.url)}</span><span class="grow"></span>
|
||||
const secs = srv.sections || [];
|
||||
return `<div class="sr srv"><div class="sl"><span>${esc(srv.name || srv.url)}</span><small>${srv.env ? "Through stemserve" : esc(srv.url)}</small></div><div class="sc">
|
||||
<button class="btn small" data-refsrv="${esc(srv.id)}">Refresh</button>
|
||||
${srv.env ? "" : `<button class="btn small" data-rmsrv="${esc(srv.id)}">Remove</button>`}</div>
|
||||
${dup ? `<p class="note">Same Plex server as ${esc(dup.name)}, which is used instead.</p>`
|
||||
: (srv.sections || []).length ? `<div class="secs">${srv.sections.map(sec => `<label class="check"><input type="checkbox" data-sec="${esc(srv.id)}|${esc(sec.key)}" ${sec.on ? "checked" : ""}>${esc(sec.title)}</label>`).join("")}</div>`
|
||||
: `<p class="note">No music libraries found. Try Refresh.</p>`}</div>`;
|
||||
<div class="libs">${dup ? `<small>Duplicate of ${esc(dup.name)}</small>`
|
||||
: secs.length ? secs.map(sec => `<label class="lib"><input type="checkbox" data-sec="${esc(srv.id)}|${esc(sec.key)}" ${sec.on ? "checked" : ""}>${esc(sec.title)}</label>`).join("")
|
||||
: `<small>No music libraries</small>`}</div></div>`;
|
||||
}
|
||||
|
||||
const KEYS = [["Space", "Play / pause"], ["← →", "Seek 5 s"], ["⇧ ← →", "Seek 30 s"], ["S", "Shuffle"], ["R", "Repeat"], ["[ ]", "Speed"],
|
||||
["M", "Mixer"], ["L", "Lyrics"], ["Q", "Queue"], ["K", "Karaoke"], ["P", "Next preset"]];
|
||||
|
||||
function renderSettings() {
|
||||
const theme = THEMES[S.theme] || THEMES.graphite;
|
||||
const theme = THEMES[S.theme] || THEMES.graphite, nMix = Object.keys(songMixes).length;
|
||||
view.innerHTML = `<div class="settings"><nav class="toc">${SECTIONS.map(([id, l]) => `<a href="#/settings" data-jump="${id}">${l}</a>`).join("")}</nav><div class="panes">
|
||||
<h1>Settings</h1>
|
||||
<section id="set-plex"><h2>Plex</h2>
|
||||
<div id="srvs">${S.servers.map(serverHtml).join("") || `<p class="note">No servers yet.</p>`}</div>
|
||||
<div class="row"><button class="btn primary" id="signin">Sign in with Plex</button><span class="note" id="sstatus"></span></div>
|
||||
<details><summary class="note">Add a server by URL and token</summary><div class="form">
|
||||
<label>Server URL<input type="url" id="purl" placeholder="http://10.0.0.2:32400"></label>
|
||||
<label>Token<input type="password" id="ptok"></label>
|
||||
<div class="row"><button class="btn" id="padd">Add server</button></div></div></details>
|
||||
<div class="sg">${S.servers.map(serverHtml).join("") || srow(`<span class="dim">No servers</span>`, "")}
|
||||
${srow(`<span class="dim" id="sstatus"></span>`, `<button class="btn primary small" id="signin">Sign in with Plex</button>`)}</div>
|
||||
<details class="sg"><summary class="sr"><div class="sl"><span>Add by URL and token</span></div><div class="sc chev">${ICON.down}</div></summary>
|
||||
${srow("Server URL", `<input type="url" id="purl" placeholder="http://10.0.0.2:32400">`)}
|
||||
${srow("Token", `<input type="password" id="ptok">`)}
|
||||
<div class="sr end"><button class="btn small" id="padd">Add server</button></div></details>
|
||||
</section>
|
||||
<section id="set-stems"><h2>Stem server</h2><div class="form">
|
||||
<p class="note" id="stem-info">Checking stemserve…</p>
|
||||
<label>URL (blank = this page's server)<input type="url" id="surl" placeholder="${esc(location.origin)}" value="${esc(S.stemUrl)}"></label>
|
||||
<label>Token (if stemserve has TOKEN set)<input type="password" id="stok" value="${esc(S.stemToken)}"></label>
|
||||
<div class="row"><button class="btn" id="ssave">Save and reconnect</button></div></div>
|
||||
<section id="set-stems"><h2>Stem server</h2><div class="sg">
|
||||
${srow("Status", `<span class="stat" id="stem-info">Checking…</span>`)}
|
||||
${srow("URL", `<input type="url" id="surl" placeholder="${esc(location.origin)}" value="${esc(S.stemUrl)}">`)}
|
||||
${srow("Token", `<input type="password" id="stok" value="${esc(S.stemToken)}" placeholder="None">`)}
|
||||
<div class="sr end"><button class="btn small" id="ssave">Save and reconnect</button></div></div>
|
||||
</section>
|
||||
<section id="set-stemopts"><h2>Stems</h2><div class="form">
|
||||
<label>Stem format<select id="fmt">${FORMATS.map(([v, l]) => `<option value="${v}" ${S.fmt === v ? "selected" : ""}>${l}</option>`).join("")}</select></label>
|
||||
<label>Cache Ahead<div class="row"><input type="range" id="precache" min="0" max="50" step="1" value="${S.precache}"><input type="number" id="precachen" min="0" max="50" value="${S.precache}"> songs</div></label>
|
||||
<label class="check"><input type="checkbox" id="keepmix" ${S.keepMix ? "checked" : ""}>Keep Stem Mix Between Songs</label>
|
||||
<div class="row"><span class="note">${plural(Object.keys(songMixes).length, "saved song mix")}</span>${Object.keys(songMixes).length ? `<button class="btn small" id="forgetall">Forget all</button>` : ""}</div></div>
|
||||
<section id="set-stemopts"><h2>Stems</h2><div class="sg">
|
||||
${srow("Format", `<select id="fmt">${FORMATS.map(([v, l]) => `<option value="${v}" ${S.fmt === v ? "selected" : ""}>${l}</option>`).join("")}</select>`)}
|
||||
${srow("Cache ahead", `<input type="range" id="precache" min="0" max="50" step="1" value="${S.precache}"><input type="number" id="precachen" min="0" max="50" value="${S.precache}"><span class="dim">songs</span>`)}
|
||||
${stog("Keep mix between songs", sw(`id="keepmix"`, S.keepMix))}
|
||||
${srow("Saved song mixes", `<span class="val">${nMix}</span>${nMix ? `<button class="btn small" id="forgetall">Forget all</button>` : ""}`)}</div>
|
||||
</section>
|
||||
<section id="set-presets"><h2>Stem Editor</h2><div id="pedit">${presetEditor()}</div></section>
|
||||
<section id="set-karaoke"><h2>Karaoke</h2><div class="form">
|
||||
<label class="check"><input type="checkbox" id="kon" ${S.karaoke ? "checked" : ""}>Karaoke on (K)</label>
|
||||
<label>Vocals in karaoke<select id="kmode">${[["off", "Off"], ["soft", "Soft"], ["on", "Left on (lyrics only)"]].map(([v, l]) => `<option value="${v}" ${S.karaokeMode === v ? "selected" : ""}>${l}</option>`).join("")}</select></label>
|
||||
<label>Soft vocal level: <span id="kdbv">${S.softDb} dB</span><input type="range" id="kdb" min="-30" max="-3" step="1" value="${S.softDb}"></label></div>
|
||||
<section id="set-karaoke"><h2>Karaoke</h2><div class="sg">
|
||||
${stog(`Karaoke <kbd>K</kbd>`, sw(`id="kon"`, S.karaoke))}
|
||||
${srow("Vocals", `<select id="kmode">${[["off", "Off"], ["soft", "Soft"], ["on", "Left on (lyrics only)"]].map(([v, l]) => `<option value="${v}" ${S.karaokeMode === v ? "selected" : ""}>${l}</option>`).join("")}</select>`)}
|
||||
${srow("Soft vocal level", `<input type="range" id="kdb" min="-30" max="-3" step="1" value="${S.softDb}"><span class="val num" id="kdbv">${S.softDb} dB</span>`)}</div>
|
||||
</section>
|
||||
<section id="set-look"><h2>Appearance</h2><div class="form">
|
||||
<div class="themes">${Object.entries(THEMES).map(([k, t]) => `<button class="swatch ${S.theme === k ? "on" : ""}" data-theme="${k}" style="background:${t.bg};color:${t.text};border-color:${t.line}"><i style="background:${t.accent}"></i>${k[0].toUpperCase() + k.slice(1)}</button>`).join("")}</div>
|
||||
<div class="row"><label class="check">Accent <input type="color" id="accent" value="${S.accent || theme.accent}"></label>${S.accent ? `<button class="btn small" id="accentreset">Use the theme's</button>` : ""}</div>
|
||||
<label class="check"><input type="checkbox" id="acapella" ${S.acapella ? "checked" : ""}>Spell the vocals-only preset “Acapella”</label>
|
||||
<div class="row"><span class="note">Player bar</span>${BAR.map(([k, l]) => `<label class="check"><input type="checkbox" data-bar="${k}" ${S.bar[k] ? "checked" : ""}>${l}</label>`).join("")}</div>
|
||||
<label>Custom CSS<textarea id="css" rows="8" spellcheck="false" placeholder=":root { --accent: #7cf; --radius: 4px; }\n.card img { border-radius: 0; }">${esc(S.css)}</textarea></label>
|
||||
<p class="note">--bg --panel --raised --line --text --muted --accent --accent-ink --radius --wave --wave-ghost</p></div>
|
||||
<section id="set-look"><h2>Appearance</h2>
|
||||
<div class="sg"><div class="sr col"><div class="sl"><span>Theme</span></div>
|
||||
<div class="themes">${Object.entries(THEMES).map(([k, t]) => `<button class="swatch ${S.theme === k ? "on" : ""}" data-theme="${k}" style="background:${t.bg};color:${t.text};border-color:${t.line}"><i style="background:${t.accent}"></i>${k[0].toUpperCase() + k.slice(1)}</button>`).join("")}</div></div>
|
||||
${srow("Accent", `${S.accent ? `<button class="btn small" id="accentreset">Reset</button>` : ""}<input type="color" id="accent" value="${S.accent || theme.accent}">`)}
|
||||
${stog("Match album art", sw(`id="arttheme"`, S.artTheme))}
|
||||
${stog("Call the vocals-only preset “Acapella”", sw(`id="acapella"`, S.acapella))}</div>
|
||||
<h3 class="sgh">Player bar</h3>
|
||||
<div class="sg">${BAR.map(([k, l]) => stog(l, sw(`data-bar="${k}"`, S.bar[k]))).join("")}</div>
|
||||
<h3 class="sgh">Custom CSS</h3>
|
||||
<div class="sg"><div class="sr col"><textarea id="css" rows="7" spellcheck="false" placeholder=":root { --accent: #7cf; --radius: 4px; }\n.card img { border-radius: 0; }">${esc(S.css)}</textarea>
|
||||
<small class="mono">--bg --panel --raised --line --text --muted --accent --accent-ink --radius --wave --wave-ghost</small></div></div>
|
||||
</section>
|
||||
<section id="set-offline"><h2>Offline</h2>
|
||||
<p class="note" id="storage-info">${plural(Offline.ids.size, "track")} downloaded. <a class="link" href="#/downloads">Manage downloads</a></p>
|
||||
${isSecureContext && navigator.storage?.persist ? `<div class="row"><button class="btn small" id="persist">Ask the browser to keep downloads</button></div>` : ""}
|
||||
<section id="set-offline"><h2>Offline</h2><div class="sg">
|
||||
${srow("Downloads", `<span class="val" id="storage-info">${plural(Offline.ids.size, "track")}</span><a class="btn small" href="#/downloads">Manage</a>`)}
|
||||
${isSecureContext && navigator.storage?.persist ? srow("Keep downloads", `<button class="btn small" id="persist">Ask browser</button>`) : ""}</div>
|
||||
</section>
|
||||
<section id="set-backup"><h2>Backup</h2>
|
||||
<p class="note">Includes your Plex tokens.</p>
|
||||
<div class="row"><button class="btn" id="export">Export</button><label class="btn">Import<input type="file" id="import" accept="application/json" hidden></label></div>
|
||||
<section id="set-backup"><h2>Backup</h2><div class="sg">
|
||||
${srow("Settings, mixes and playlists", `<button class="btn small" id="export">Export</button><label class="btn small">Import<input type="file" id="import" accept="application/json" hidden></label>`, "Includes your Plex tokens")}</div>
|
||||
</section>
|
||||
<section id="set-keys"><h2>Keys</h2><p class="note">Space play/pause · ←/→ seek 5s (shift 30s) · S shuffle · R repeat · [ ] speed · M mixer · L lyrics · Q queue · K karaoke · P next preset · hold Next to skip the album · right-click a song or album for more</p></section>
|
||||
<section id="set-about"><h2>About</h2>
|
||||
<p><b>Stemify</b> <span class="note" id="about-ver"></span></p>
|
||||
<p class="note">Your Plex and Jellyfin music, split into stems you can mix.</p>
|
||||
<div class="people">
|
||||
<div class="person"><b>Chris Nutter</b><span class="note">Stemify WebUI and the iOS app</span><div class="row">
|
||||
<a class="btn small" href="https://iamchrisama.com" target="_blank" rel="noopener">iamchrisama.com</a>
|
||||
<a class="btn small" href="https://buymeacoffee.com/cdnutter" target="_blank" rel="noopener">Buy Me a Coffee</a></div></div>
|
||||
<div class="person"><b>Kevin Viers</b><span class="note">stemd and the Android app</span><div class="row">
|
||||
<a class="btn small" href="https://github.com/kevinViers/" target="_blank" rel="noopener">GitHub</a>
|
||||
<a class="btn small" href="https://venmo.com/code?user_id=2910252785729536546&created=1792897467" target="_blank" rel="noopener">Venmo</a></div></div>
|
||||
</div>
|
||||
<p class="note">Stemify is free. A tip goes straight to the person you pick.</p>
|
||||
<section id="set-keys"><h2>Keys</h2><div class="sg"><div class="keys">${KEYS.map(([k, l]) => `<div><span>${l}</span>${k.split(" ").map(x => `<kbd>${x}</kbd>`).join("")}</div>`).join("")}</div></div></section>
|
||||
<section id="set-about"><h2>About</h2><div class="sg">
|
||||
${srow("Stemify", `<span class="val dim" id="about-ver"></span>`, "Your Plex and Jellyfin music, split into stems you can mix")}
|
||||
${srow("Chris Nutter", `<a class="btn small" href="https://iamchrisama.com" target="_blank" rel="noopener">Website</a><a class="btn small" href="https://buymeacoffee.com/cdnutter" target="_blank" rel="noopener">Buy Me a Coffee</a>`, "Web UI and iOS app")}
|
||||
${srow("Kevin Viers", `<a class="btn small" href="https://github.com/kevinViers/" target="_blank" rel="noopener">GitHub</a><a class="btn small" href="https://venmo.com/code?user_id=2910252785729536546&created=1792897467" target="_blank" rel="noopener">Venmo</a>`, "stemd and Android app")}</div>
|
||||
</section>
|
||||
</div></div>`;
|
||||
|
||||
@@ -1199,9 +1252,16 @@ function renderSettings() {
|
||||
const el = $("#stem-info");
|
||||
const v = $("#about-ver");
|
||||
if (v && info) v.textContent = `stemserve v${info.version}`;
|
||||
if (el) el.textContent = info ? `stemserve v${info.version} at ${stemBase()}, ${info.tracks} tracks with stems${info.ffmpeg ? ", Opus available" : ""}.` : `Can't reach stemserve at ${stemBase()}.`;
|
||||
if (el) { el.textContent = info ? `v${info.version} · ${info.tracks} tracks${info.ffmpeg ? " · Opus" : ""}` : "Unreachable"; el.classList.add(info ? "ok" : "bad"); }
|
||||
});
|
||||
navigator.storage?.estimate?.().then(e => { const el = $("#storage-info"); if (el && e?.quota) el.insertAdjacentText("afterbegin", `${fmtBytes(e.usage)} of ${fmtBytes(e.quota)} used. `); }).catch(() => {});
|
||||
navigator.storage?.estimate?.().then(e => { const el = $("#storage-info"); if (el && e?.quota) el.insertAdjacentText("beforeend", ` · ${fmtBytes(e.usage)} of ${fmtBytes(e.quota)}`); }).catch(() => {});
|
||||
|
||||
// The section in view lights up in the side list.
|
||||
const toc = [...view.querySelectorAll(".toc a")];
|
||||
const spy = new IntersectionObserver(es => {
|
||||
for (const e of es) if (e.isIntersecting) for (const a of toc) a.classList.toggle("on", "set-" + a.dataset.jump === e.target.id);
|
||||
}, { root: view, rootMargin: "0px 0px -70% 0px" });
|
||||
view.querySelectorAll(".panes section").forEach(s => spy.observe(s));
|
||||
|
||||
const again = () => { if (location.hash.startsWith("#/settings")) renderSettings(); };
|
||||
const plexChanged = () => { genreCache = null; save(); };
|
||||
@@ -1226,6 +1286,7 @@ function renderSettings() {
|
||||
const ahead = v => { S.precache = Math.max(0, Math.min(50, Math.round(+v || 0))); $("#precache").value = $("#precachen").value = S.precache; save(); };
|
||||
$("#precache").oninput = ev => ahead(ev.target.value);
|
||||
$("#precachen").onchange = ev => ahead(ev.target.value);
|
||||
$("#arttheme").onchange = ev => { S.artTheme = ev.target.checked; save(); ArtTheme.set(S.artTheme ? artOf(Q.cur(), 64) : ""); };
|
||||
$("#acapella").onchange = ev => { S.acapella = ev.target.checked; save(); emit("presets"); emit("mix"); };
|
||||
if ($("#forgetall")) $("#forgetall").onclick = () => { for (const k of Object.keys(songMixes)) forgetSongMix(k); again(); };
|
||||
$("#kon").onchange = ev => setKaraoke(ev.target.checked);
|
||||
@@ -1257,7 +1318,7 @@ function renderSettings() {
|
||||
const b = ev.target.closest("[data-jump], [data-theme], [data-refsrv], [data-rmsrv], [data-plock], [data-pmove], [data-pdel], [data-padd], [data-prestore], [data-pclear]");
|
||||
if (!b) return;
|
||||
const ds = b.dataset;
|
||||
if (ds.jump) { ev.preventDefault(); $("#set-" + ds.jump).scrollIntoView({ behavior: "smooth" }); }
|
||||
if (ds.jump) { ev.preventDefault(); $("#set-" + ds.jump).scrollIntoView({ behavior: "smooth", block: "start" }); }
|
||||
else if (ds.theme) { S.theme = ds.theme; S.accent = ""; applyTheme(); save(); again(); }
|
||||
else if (ds.refsrv) { try { await refreshServer(server(ds.refsrv)); toast("Refreshed"); } catch (e) { toast(e.message); } plexChanged(); again(); }
|
||||
else if (ds.rmsrv && confirm("Remove this server?")) { S.servers = S.servers.filter(s => s.id !== ds.rmsrv); plexChanged(); again(); }
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ export const S = Object.assign({
|
||||
acapella: false, // spell "A Cappella" as "Acapella"
|
||||
bar: { speed: true, mixer: true, lyrics: true, queue: true }, // player bar buttons
|
||||
stations: [], // web radio: [{id, name, url}]
|
||||
theme: "graphite", accent: "", css: "", sideArt: false,
|
||||
theme: "graphite", accent: "", css: "", sideArt: false, artTheme: false,
|
||||
}, load(KEY) || {});
|
||||
|
||||
if (!S.clientId) S.clientId = uuid();
|
||||
|
||||
+80
-17
@@ -8,7 +8,7 @@
|
||||
--accent: #3a81ed;
|
||||
--accent-ink: #ffffff;
|
||||
--radius: 6px;
|
||||
--player-h: 90px;
|
||||
--player-h: 100px;
|
||||
--nav-w: 240px;
|
||||
--glass: #101010ee;
|
||||
--hover: #e7e7e70d;
|
||||
@@ -182,21 +182,79 @@ body.no-stems .tracks:not(:has(tbody tr.nostem)) ~ .only-nostems { display: bloc
|
||||
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
|
||||
.check { display: flex !important; gap: 8px; align-items: center; color: var(--text) !important; font-size: 14px !important; }
|
||||
textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; color: var(--text); }
|
||||
.settings { display: grid; grid-template-columns: 150px 1fr; gap: 32px; align-items: start; }
|
||||
.toc { position: sticky; top: 0; display: grid; gap: 2px; }
|
||||
.toc a { padding: 6px 10px; border-radius: 8px; color: var(--muted); }
|
||||
.settings { display: grid; grid-template-columns: 168px minmax(0, 680px); gap: 40px; align-items: start; }
|
||||
.settings h1 { margin-bottom: 18px; }
|
||||
.toc { position: sticky; top: 0; display: grid; gap: 2px; padding-top: 52px; }
|
||||
.toc a { position: relative; padding: 7px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; font-size: 13px; transition: color .12s, background-color .12s; }
|
||||
.toc a:hover { color: var(--text); background: var(--hover); }
|
||||
.panes section { max-width: 640px; padding-bottom: 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); scroll-margin-top: 10px; }
|
||||
.panes section h2 { margin-top: 0; }
|
||||
.srv { padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
|
||||
.srv .row { margin: 0; }
|
||||
.secs { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
|
||||
details summary { cursor: pointer; margin: 12px 0; }
|
||||
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
|
||||
.swatch { border: 1px solid; border-radius: 10px; padding: 10px; text-align: left; font-weight: 600; display: flex; gap: 8px; align-items: center; }
|
||||
.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: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
|
||||
.swatch { border: 1px solid; border-radius: 8px; padding: 10px 12px; text-align: left; font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: center; transition: transform .12s; }
|
||||
.swatch:hover { transform: translateY(-1px); }
|
||||
.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; }
|
||||
input[type=color] { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
|
||||
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
|
||||
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
|
||||
input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; }
|
||||
.note { color: var(--muted); font-size: 13px; }
|
||||
|
||||
#drawer { width: 320px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 22px 20px; }
|
||||
@@ -272,6 +330,7 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
|
||||
.q-item .x { color: var(--muted); font-size: 18px; padding: 0 4px; opacity: 0; }
|
||||
.q-item:hover .x { opacity: 1; }
|
||||
|
||||
body, #nav, #player, .sg { transition: background-color .5s; }
|
||||
#player { position: fixed; left: 0; right: 0; bottom: 0; height: var(--player-h); background: var(--bg);
|
||||
border-top: 1px solid rgba(50, 50, 50, .7); display: grid; grid-template-columns: minmax(180px, 1fr) minmax(320px, 1.6fr) minmax(180px, 1fr); align-items: center; gap: 20px; padding: 0 20px; }
|
||||
#player.empty .center, #player.empty .right, #player.empty #b-art { opacity: .35; pointer-events: none; }
|
||||
@@ -289,7 +348,7 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
|
||||
.np-text { min-width: 0; }
|
||||
#np-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
#np-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.center { display: grid; gap: 4px; }
|
||||
.center { display: grid; gap: 10px; }
|
||||
.transport { display: flex; justify-content: center; align-items: center; gap: 20px; font-size: 18px; }
|
||||
.transport button { color: #c5c5c5; }
|
||||
.transport button:hover { color: #fff; }
|
||||
@@ -316,7 +375,7 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
|
||||
input[type=range] { accent-color: var(--accent); }
|
||||
|
||||
@media (max-width: 860px) {
|
||||
:root { --player-h: 150px; }
|
||||
:root { --player-h: 162px; }
|
||||
#app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
|
||||
#nav { flex-direction: row; overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); align-items: center; }
|
||||
.brand { padding: 0 8px 0 4px; }
|
||||
@@ -326,8 +385,12 @@ input[type=range] { accent-color: var(--accent); }
|
||||
#nav a { min-height: 32px; }
|
||||
#search input { margin: 0; width: 120px; }
|
||||
#live { margin: 0; white-space: nowrap; }
|
||||
.settings { grid-template-columns: 1fr; }
|
||||
.toc { position: static; display: flex; flex-wrap: wrap; }
|
||||
.settings { grid-template-columns: 1fr; gap: 0; }
|
||||
.toc { display: none; }
|
||||
.sr:not(.col) { flex-wrap: wrap; gap: 8px 16px; }
|
||||
.sc { max-width: 100%; }
|
||||
.sc input[type=url], .sc input[type=password], .sc select { width: 100%; }
|
||||
.sr:has(input[type=url], input[type=password], select, input[type=range]) .sc { flex: 1 1 100%; }
|
||||
.tracks .acts button { opacity: 1; }
|
||||
.tracks .al, .tracks .off { display: none; }
|
||||
.tracks .n { width: 34px; }
|
||||
|
||||
@@ -36,6 +36,8 @@ 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>',
|
||||
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>',
|
||||
|
||||
Reference in new issue
Block a user