From f3a24ccd09c7714e3f228766109330dc718f0ec7 Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Mon, 23 Mar 2026 12:03:44 +0100 Subject: [PATCH] chore: more processing improvements --- src/_data/facets.json | 2 +- src/_includes/layouts/diffuse.vto | 7 +- .../orchestrator/process-tracks/element.js | 20 ++- .../orchestrator/sources/element.js | 6 +- src/facets/connect/index.inline.js | 3 +- .../process-tracks/prelude/index.inline.js | 43 +++++- src/guide.vto | 136 ++++++++++-------- src/vendor/throttle-debounce/index.js | 1 + 8 files changed, 144 insertions(+), 74 deletions(-) create mode 100644 src/vendor/throttle-debounce/index.js diff --git a/src/_data/facets.json b/src/_data/facets.json index 8e224e3f..5b3e3d31 100644 --- a/src/_data/facets.json +++ b/src/_data/facets.json @@ -5,7 +5,7 @@ "kind": "prelude", "category": "Playback", "featured": true, - "desc": "Automatically put tracks into the queue. **Always on.**" + "desc": "Automatically put tracks into the queue. **Always on.** These tracks will always be located after the ones you've added manually." }, { "url": "facets/playback/auto-queue/index.html", diff --git a/src/_includes/layouts/diffuse.vto b/src/_includes/layouts/diffuse.vto index 223c6c0e..add6679f 100644 --- a/src/_includes/layouts/diffuse.vto +++ b/src/_includes/layouts/diffuse.vto @@ -42,13 +42,14 @@ base: "./" "imports": { "~/": "./", - "@atcute/tid": "./vendor/@atcute/tid/index.js", - "@awesome.me/webawesome/dist/": "./vendor/@awesome.me/webawesome/", "@awesome.me/webawesome/dist-cdn/": "./vendor/@awesome.me/webawesome/", "@phosphor-icons/web/": "./vendor/@phosphor-icons/web/", + + "@atcute/tid": "./vendor/@atcute/tid/index.js", "idb-keyval": "./vendor/idb-keyval/index.js", - "lit-html": "./vendor/lit-html/index.js" + "lit-html": "./vendor/lit-html/index.js", + "throttle-debounce": "./vendor/throttle-debounce/index.js" } } diff --git a/src/components/orchestrator/process-tracks/element.js b/src/components/orchestrator/process-tracks/element.js index d663174e..fedd9263 100644 --- a/src/components/orchestrator/process-tracks/element.js +++ b/src/components/orchestrator/process-tracks/element.js @@ -63,18 +63,30 @@ class ProcessTracksOrchestrator extends BroadcastableDiffuseElement { strategy: "replicate", fn: this.#performedInitialProcess.set, }, + getIsProcessing: { + strategy: "leaderOnly", + fn: this.#isProcessing.get, + }, + setIsProcessing: { + strategy: "replicate", + fn: this.#isProcessing.set, + }, process: { strategy: "leaderOnly", fn: this.process }, }); if (!actions) return; this.process = actions.process; - this.#isProcessing.set = actions.setPerfInit; + this.#isProcessing.set = actions.setIsProcessing; - // Sync #performedInitialProcess with leader + // Sync #performedInitialProcess and #isProcessing with leader actions.getPerfInit().then((val) => { this.#performedInitialProcess.value = val; }); + + actions.getIsProcessing().then((val) => { + this.#isProcessing.value = val; + }); } // Super @@ -161,7 +173,7 @@ class ProcessTracksOrchestrator extends BroadcastableDiffuseElement { if (this.#isProcessing.value) return; // Start - this.#isProcessing.value = true; + this.#isProcessing.set(true); console.log("🪵 Processing initiated"); const tracksCol = this.output.tracks.collection(); @@ -173,7 +185,7 @@ class ProcessTracksOrchestrator extends BroadcastableDiffuseElement { // Fin console.log("🪵 Processing completed"); - this.#isProcessing.value = false; + this.#isProcessing.set(false); } } diff --git a/src/components/orchestrator/sources/element.js b/src/components/orchestrator/sources/element.js index 268f48f5..4e0d2581 100644 --- a/src/components/orchestrator/sources/element.js +++ b/src/components/orchestrator/sources/element.js @@ -1,3 +1,5 @@ +import deepDiff from "@fry69/deep-diff"; + import { BroadcastableDiffuseElement, query } from "~/common/element.js"; import { groupTracksPerScheme } from "~/common/utils.js"; import { signal } from "~/common/signal.js"; @@ -74,7 +76,9 @@ class Sources extends BroadcastableDiffuseElement { record[scheme] = sources; }); - this.#sources.value = record; + if (deepDiff(this.#sources.value, record)) { + this.#sources.value = record; + } }); } } diff --git a/src/facets/connect/index.inline.js b/src/facets/connect/index.inline.js index b38d6e31..aa3ab8ae 100644 --- a/src/facets/connect/index.inline.js +++ b/src/facets/connect/index.inline.js @@ -49,8 +49,7 @@ litRender(

These are some of the options available to add as an audio source, or to - use as user-data storage. Some offer both, the remainder offers only one - or the other. + use as user-data storage. Some offer both.