diff --git a/web/app.js b/web/app.js index 9c89678..18004b2 100644 --- a/web/app.js +++ b/web/app.js @@ -1105,92 +1105,97 @@ 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 = "") => `
${title}${sub ? `${sub}` : ""}
${ctrl}
`; +const stog = (title, input, sub = "") => ``; +const sw = (attrs, on) => ``; + function presetEditor() { const ps = presets(), lock = S.lockedPreset && allPresets().find(p => p.id === S.lockedPreset); - return `

Locked

- ${lock ? `
${ICON.lock}${esc(presetLabel(lock.name))}
` : `

Nothing locked.

`} -

Mixer Bar

${ps.map((p, i) => `
${esc(presetLabel(p.name))}${p.custom ? ' CUSTOM' : ""} - - - -
`).join("")}
-

Stems

- - -
`; + return `
${srow("Locked preset", lock + ? `${ICON.lock}${esc(presetLabel(lock.name))}` + : `None`)}
+

Mixer bar

+
${ps.map((p, i) => `
${esc(presetLabel(p.name))}${p.custom ? ' CUSTOM' : ""}
+ + + +
`).join("")}
+
+ + +
`; } 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 `
${esc(srv.name || srv.url)} - ${srv.env ? "through this stemserve (PLEX_URL)" : esc(srv.url)} + const secs = srv.sections || []; + return `
${esc(srv.name || srv.url)}${srv.env ? "Through stemserve" : esc(srv.url)}
${srv.env ? "" : ``}
- ${dup ? `

Same Plex server as ${esc(dup.name)}, which is used instead.

` - : (srv.sections || []).length ? `
${srv.sections.map(sec => ``).join("")}
` - : `

No music libraries found. Try Refresh.

`}
`; +
${dup ? `Duplicate of ${esc(dup.name)}` + : secs.length ? secs.map(sec => ``).join("") + : `No music libraries`}
`; } +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 = `
+

Settings

Plex

-
${S.servers.map(serverHtml).join("") || `

No servers yet.

`}
-
-
Add a server by URL and token
- - -
+
${S.servers.map(serverHtml).join("") || srow(`No servers`, "")} + ${srow(``, ``)}
+
Add by URL and token
${ICON.down}
+ ${srow("Server URL", ``)} + ${srow("Token", ``)} +
-

Stem server

-

Checking stemserve…

- - -
+

Stem server

+ ${srow("Status", `Checking…`)} + ${srow("URL", ``)} + ${srow("Token", ``)} +
-

Stems

- - - -
${plural(Object.keys(songMixes).length, "saved song mix")}${Object.keys(songMixes).length ? `` : ""}
+

Stems

+ ${srow("Format", ``)} + ${srow("Cache ahead", `songs`)} + ${stog("Keep mix between songs", sw(`id="keepmix"`, S.keepMix))} + ${srow("Saved song mixes", `${nMix}${nMix ? `` : ""}`)}

Stem Editor

${presetEditor()}
-

Karaoke

- - -
+

Karaoke

+ ${stog(`Karaoke K`, sw(`id="kon"`, S.karaoke))} + ${srow("Vocals", ``)} + ${srow("Soft vocal level", `${S.softDb} dB`)}
-

Appearance

-
${Object.entries(THEMES).map(([k, t]) => ``).join("")}
-
${S.accent ? `` : ""}
- -
Player bar${BAR.map(([k, l]) => ``).join("")}
- -

--bg --panel --raised --line --text --muted --accent --accent-ink --radius --wave --wave-ghost

+

Appearance

+
Theme
+
${Object.entries(THEMES).map(([k, t]) => ``).join("")}
+ ${srow("Accent", `${S.accent ? `` : ""}`)} + ${stog("Call the vocals-only preset “Acapella”", sw(`id="acapella"`, S.acapella))}
+

Player bar

+
${BAR.map(([k, l]) => stog(l, sw(`data-bar="${k}"`, S.bar[k]))).join("")}
+

Custom CSS

+
+ --bg --panel --raised --line --text --muted --accent --accent-ink --radius --wave --wave-ghost
-

Offline

-

${plural(Offline.ids.size, "track")} downloaded. Manage downloads

- ${isSecureContext && navigator.storage?.persist ? `
` : ""} +

Offline

+ ${srow("Downloads", `${plural(Offline.ids.size, "track")}Manage`)} + ${isSecureContext && navigator.storage?.persist ? srow("Keep downloads", ``) : ""}
-

Backup

-

Includes your Plex tokens.

-
+

Backup

+ ${srow("Settings, mixes and playlists", ``, "Includes your Plex tokens")}
-

Keys

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

-

About

-

Stemify

-

Your Plex and Jellyfin music, split into stems you can mix.

-
-
Chris NutterStemify WebUI and the iOS app
-
Kevin Viersstemd and the Android app
-
-

Stemify is free. A tip goes straight to the person you pick.

+

Keys

${KEYS.map(([k, l]) => `
${l}${k.split(" ").map(x => `${x}`).join("")}
`).join("")}
+

About

+ ${srow("Stemify", ``, "Your Plex and Jellyfin music, split into stems you can mix")} + ${srow("Chris Nutter", `WebsiteBuy Me a Coffee`, "Web UI and iOS app")} + ${srow("Kevin Viers", `GitHubVenmo`, "stemd and Android app")}
`; @@ -1199,9 +1204,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(); }; @@ -1257,7 +1269,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(); } diff --git a/web/style.css b/web/style.css index c8cef9c..ad18a5a 100644 --- a/web/style.css +++ b/web/style.css @@ -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; } @@ -326,8 +384,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; } diff --git a/web/util.js b/web/util.js index 19e44ce..072338f 100644 --- a/web/util.js +++ b/web/util.js @@ -36,6 +36,8 @@ export const ICON = { save: '', check: '', pladd: '', + up: '', + down: '', x: '', lock: '', play: '',