diff --git a/src/common/foundation.js b/src/common/foundation.js index 61c96e70..67ecf8f8 100644 --- a/src/common/foundation.js +++ b/src/common/foundation.js @@ -176,7 +176,21 @@ export const config = { */ setup: ({ title }) => { document.title = title; + }, + + /** + * Hide the loader and fade in the facet content by adding the `has-loaded` + * class to `#container` after two animation frames (so the initial opacity:0 + * is painted first and the CSS transition actually runs). + */ + ready: () => { config.hideLoader(); + + requestAnimationFrame(() => { + requestAnimationFrame(() => { + document.querySelector("#container")?.classList.add("has-loaded"); + }); + }); }, }; diff --git a/src/facets/connect/atproto/index.html b/src/facets/connect/atproto/index.html index 89ae5f55..73a40a7a 100644 --- a/src/facets/connect/atproto/index.html +++ b/src/facets/connect/atproto/index.html @@ -8,8 +8,3 @@ - - diff --git a/src/facets/connect/atproto/index.inline.js b/src/facets/connect/atproto/index.inline.js index 2bb5e228..a186e820 100644 --- a/src/facets/connect/atproto/index.inline.js +++ b/src/facets/connect/atproto/index.inline.js @@ -204,7 +204,6 @@ if (atprotoPasskeyEl) { ); }); } - //////////////////////////////////////////// // ACTIONS //////////////////////////////////////////// @@ -257,3 +256,9 @@ async function handlePasskeyRemove() { $passkeyError.value = null; await atprotoPasskeyEl.removePasskey(); } + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/connect/common.css b/src/facets/connect/common.css index 3cd7bf21..54a52250 100644 --- a/src/facets/connect/common.css +++ b/src/facets/connect/common.css @@ -3,15 +3,7 @@ main { align-items: center; justify-content: center; min-height: 100dvh; - opacity: 0; padding: var(--wa-space-m); - pointer-events: none; - transition: opacity 750ms; - - &.has-loaded { - opacity: 1; - pointer-events: auto; - } } wa-card { diff --git a/src/facets/connect/https/index.html b/src/facets/connect/https/index.html index 39022ca4..560cd9e1 100644 --- a/src/facets/connect/https/index.html +++ b/src/facets/connect/https/index.html @@ -8,8 +8,3 @@ - - diff --git a/src/facets/connect/https/index.inline.js b/src/facets/connect/https/index.inline.js index 92aa5a92..8515619e 100644 --- a/src/facets/connect/https/index.inline.js +++ b/src/facets/connect/https/index.inline.js @@ -82,7 +82,6 @@ effect(() => { }), ); }); - //////////////////////////////////////////// // ACTIONS //////////////////////////////////////////// @@ -123,3 +122,9 @@ async function addUrl() { }, ]); } + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/connect/icecast/index.html b/src/facets/connect/icecast/index.html index 940821e6..6d78971d 100644 --- a/src/facets/connect/icecast/index.html +++ b/src/facets/connect/icecast/index.html @@ -8,8 +8,3 @@ - - diff --git a/src/facets/connect/icecast/index.inline.js b/src/facets/connect/icecast/index.inline.js index 5be5fa77..b92b688b 100644 --- a/src/facets/connect/icecast/index.inline.js +++ b/src/facets/connect/icecast/index.inline.js @@ -83,7 +83,6 @@ effect(() => { }), ); }); - //////////////////////////////////////////// // ACTIONS //////////////////////////////////////////// @@ -125,3 +124,9 @@ async function addStream() { }, ]); } + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/connect/index.html b/src/facets/connect/index.html index dc302fda..2a11fd69 100644 --- a/src/facets/connect/index.html +++ b/src/facets/connect/index.html @@ -25,8 +25,3 @@ - - diff --git a/src/facets/connect/index.inline.js b/src/facets/connect/index.inline.js index f7653629..3efaa4fa 100644 --- a/src/facets/connect/index.inline.js +++ b/src/facets/connect/index.inline.js @@ -78,3 +78,9 @@ litRender( `, main, ); + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/connect/local/index.html b/src/facets/connect/local/index.html index 90120042..81ffbc2e 100644 --- a/src/facets/connect/local/index.html +++ b/src/facets/connect/local/index.html @@ -8,8 +8,3 @@ - - diff --git a/src/facets/connect/local/index.inline.js b/src/facets/connect/local/index.inline.js index d376d0f2..831a7acc 100644 --- a/src/facets/connect/local/index.inline.js +++ b/src/facets/connect/local/index.inline.js @@ -176,7 +176,6 @@ effect(() => { })), ); }); - //////////////////////////////////////////// // ACTIONS //////////////////////////////////////////// @@ -375,3 +374,9 @@ async function readDirectoryEntry(dir) { readBatch(); }); } + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/connect/opensubsonic/index.html b/src/facets/connect/opensubsonic/index.html index bf332533..d7a6f669 100644 --- a/src/facets/connect/opensubsonic/index.html +++ b/src/facets/connect/opensubsonic/index.html @@ -8,8 +8,3 @@ - - diff --git a/src/facets/connect/opensubsonic/index.inline.js b/src/facets/connect/opensubsonic/index.inline.js index 9cbfc8cc..daa51a9c 100644 --- a/src/facets/connect/opensubsonic/index.inline.js +++ b/src/facets/connect/opensubsonic/index.inline.js @@ -120,7 +120,6 @@ effect(() => { })), ); }); - //////////////////////////////////////////// // ACTIONS //////////////////////////////////////////// @@ -170,3 +169,9 @@ async function addServer() { }, ]); } + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/connect/s3/index.html b/src/facets/connect/s3/index.html index 38aeb7d4..936da497 100644 --- a/src/facets/connect/s3/index.html +++ b/src/facets/connect/s3/index.html @@ -8,8 +8,3 @@ - - diff --git a/src/facets/connect/s3/index.inline.js b/src/facets/connect/s3/index.inline.js index 95a6a255..d395533d 100644 --- a/src/facets/connect/s3/index.inline.js +++ b/src/facets/connect/s3/index.inline.js @@ -161,7 +161,6 @@ effect(() => { })), ); }); - //////////////////////////////////////////// // ACTIONS //////////////////////////////////////////// @@ -232,3 +231,9 @@ async function addBucket(mode) { await outputOrchestrator.select(OUTPUT_S3_ID); } } + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/data/export-import/index.html b/src/facets/data/export-import/index.html index 5303585b..630e387c 100644 --- a/src/facets/data/export-import/index.html +++ b/src/facets/data/export-import/index.html @@ -50,15 +50,7 @@ } main { - opacity: 0; padding: var(--space-md); - pointer-events: none; - transition: opacity 750ms; - - &.has-loaded { - opacity: 1; - pointer-events: auto; - } } p { diff --git a/src/facets/data/export-import/index.inline.js b/src/facets/data/export-import/index.inline.js index 7133ae49..f0dc2cf0 100644 --- a/src/facets/data/export-import/index.inline.js +++ b/src/facets/data/export-import/index.inline.js @@ -5,11 +5,8 @@ import { effect } from "~/common/signal.js"; // Set doc title foundation.setup({ title: "Export & Import | Diffuse" }); -// Doc loader -const main = /** @type {HTMLElement} */ (document.querySelector("main")); -main.classList.add("has-loaded"); - // Setup +const main = /** @type {HTMLElement} */ (document.querySelector("main")); const output = await foundation.orchestrator.output(); // Elements @@ -140,7 +137,6 @@ importPlaylistItemsBtn.onclick = async () => { showStatus(`Import failed: ${/** @type {Error} */ (err).message}`, "error"); } }; - // Import facets importFacetsBtn.onclick = async () => { /** @type {any[]} */ @@ -155,3 +151,9 @@ importFacetsBtn.onclick = async () => { showStatus(`Import failed: ${/** @type {Error} */ (err).message}`, "error"); } }; + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/data/process-tracks/index.html b/src/facets/data/process-tracks/index.html index 94a91c60..96e39b08 100644 --- a/src/facets/data/process-tracks/index.html +++ b/src/facets/data/process-tracks/index.html @@ -24,15 +24,6 @@ @import "./themes/winamp/98-vars.css"; @import "./themes/winamp/98-extra.css"; - main { - opacity: 0; - pointer-events: none; - - &.has-loaded { - opacity: 1; - pointer-events: auto; - } - } diff --git a/src/facets/data/process-tracks/index.inline.js b/src/facets/data/process-tracks/index.inline.js index 9fc71495..597b82df 100644 --- a/src/facets/data/process-tracks/index.inline.js +++ b/src/facets/data/process-tracks/index.inline.js @@ -6,7 +6,6 @@ import foundation from "~/common/foundation.js"; foundation.setup({ title: "Process Tracks | Diffuse" }); const main = /** @type {HTMLElement} */ (document.querySelector("main")); -main.classList.add("has-loaded"); const orchestrator = await foundation.orchestrator.processTracks({ disableWhenReady: true, @@ -76,3 +75,9 @@ effect(() => { /** @type {HTMLElement} */ (placeholder), ); }); + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/data/v3-import/index.html b/src/facets/data/v3-import/index.html index dcd06b43..831f3c7d 100644 --- a/src/facets/data/v3-import/index.html +++ b/src/facets/data/v3-import/index.html @@ -40,15 +40,7 @@ } main { - opacity: 0; padding: var(--space-md); - pointer-events: none; - transition: opacity 750ms; - - &.has-loaded { - opacity: 1; - pointer-events: auto; - } } p { diff --git a/src/facets/data/v3-import/index.inline.js b/src/facets/data/v3-import/index.inline.js index e3b6ac4e..19f292f8 100644 --- a/src/facets/data/v3-import/index.inline.js +++ b/src/facets/data/v3-import/index.inline.js @@ -4,7 +4,6 @@ import foundation from "~/common/foundation.js"; foundation.setup({ title: "V3.x Import | Diffuse" }); const main = /** @type {HTMLElement} */ (document.querySelector("main")); -main.classList.add("has-loaded"); /** * @import {PlaylistItem, Track} from "~/definitions/types.d.ts" @@ -164,3 +163,9 @@ importPlaylistItemsBtn.onclick = async () => { showStatus(`Import failed: ${/** @type {Error} */ (err).message}`, "error"); } }; + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/examples/generate-playlist/index.inline.js b/src/facets/examples/generate-playlist/index.inline.js index 78029378..59e895da 100644 --- a/src/facets/examples/generate-playlist/index.inline.js +++ b/src/facets/examples/generate-playlist/index.inline.js @@ -39,3 +39,9 @@ function generatePlaylist() { .onclick = () => { generatePlaylist(); }; + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/examples/now-playing/index.inline.js b/src/facets/examples/now-playing/index.inline.js index 1625cac7..0e189d9c 100644 --- a/src/facets/examples/now-playing/index.inline.js +++ b/src/facets/examples/now-playing/index.inline.js @@ -35,3 +35,9 @@ effect(() => { .onclick = () => { queue.shift(); }; + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/misc/scrobble/last.fm/index.html b/src/facets/misc/scrobble/last.fm/index.html index afd5a8bb..2d7c2900 100644 --- a/src/facets/misc/scrobble/last.fm/index.html +++ b/src/facets/misc/scrobble/last.fm/index.html @@ -11,16 +11,6 @@ margin: 0; } - main { - opacity: 0; - pointer-events: none; - transition: opacity 750ms; - - &.has-loaded { - opacity: 1; - pointer-events: auto; - } - } wa-card { width: min(360px, calc(100vw - 2rem)); @@ -104,8 +94,3 @@ - - diff --git a/src/facets/misc/scrobble/last.fm/index.inline.js b/src/facets/misc/scrobble/last.fm/index.inline.js index e469092a..38e7c9a1 100644 --- a/src/facets/misc/scrobble/last.fm/index.inline.js +++ b/src/facets/misc/scrobble/last.fm/index.inline.js @@ -164,3 +164,9 @@ resetCredsBtn.onclick = () => { apiKeyInput.value = ""; apiSecretInput.value = ""; }; + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/misc/split-view/index.inline.js b/src/facets/misc/split-view/index.inline.js index 4273a825..f36b3154 100644 --- a/src/facets/misc/split-view/index.inline.js +++ b/src/facets/misc/split-view/index.inline.js @@ -448,3 +448,9 @@ async function saveSimplifiedCopy() { // ─── Init ───────────────────────────────────────────────────────────────────── render(); + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/facets/playback/auto-queue/index.html b/src/facets/playback/auto-queue/index.html index 2bb806b4..73a73da7 100644 --- a/src/facets/playback/auto-queue/index.html +++ b/src/facets/playback/auto-queue/index.html @@ -56,15 +56,7 @@ } main { - opacity: 0; padding: var(--space-md); - pointer-events: none; - transition: opacity 750ms; - - &.has-loaded { - opacity: 1; - pointer-events: auto; - } } label { diff --git a/src/facets/playback/auto-queue/index.inline.js b/src/facets/playback/auto-queue/index.inline.js index 737f7dc6..d07c34ae 100644 --- a/src/facets/playback/auto-queue/index.inline.js +++ b/src/facets/playback/auto-queue/index.inline.js @@ -7,11 +7,8 @@ const ACTIVE_CLASS = "button--active"; // Set doc title foundation.setup({ title: "Automatic Queue | Diffuse" }); -// Doc load -const main = /** @type {HTMLElement} */ (document.querySelector("main")); -main.classList.add("has-loaded"); - // Setup +const main = /** @type {HTMLElement} */ (document.querySelector("main")); await foundation.orchestrator.autoQueue(); const [repeatShuffle, scope, output] = await Promise.all([ @@ -135,3 +132,9 @@ sortDirectionBtn.onclick = () => { const dir = scope.sortDirection() ?? "desc"; scope.setSortDirection(dir === "asc" ? "desc" : "asc"); }; + +//////////////////////////////////////////// +// 🚀 +//////////////////////////////////////////// + +foundation.ready(); diff --git a/src/l/index.vto b/src/l/index.vto index 05286b7e..e4f1ff33 100644 --- a/src/l/index.vto +++ b/src/l/index.vto @@ -9,10 +9,10 @@ scripts: - l/index.js --- -