A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: output types

+50 -45
+2 -1
deno.jsonc
··· 133 133 "./definitions/types.d.ts": "./src/definitions/types.d.ts", 134 134 135 135 // .ts 136 - "./definitions/types/sh/diffuse/output/tracks.ts": "./src/definitions/types/sh/diffuse/output/tracks.ts", 136 + "./definitions/types/sh/diffuse/output/constituent.ts": "./src/definitions/types/sh/diffuse/output/constituent.ts", 137 + "./definitions/types/sh/diffuse/output/track.ts": "./src/definitions/types/sh/diffuse/output/track.ts", 137 138 }, 138 139 "tasks": { 139 140 "build": {
+3 -3
src/components/configurator/output/element.js
··· 7 7 */ 8 8 9 9 /** 10 - * @typedef {OutputElement<Track[]>} Output 10 + * @typedef {OutputElement} Output 11 11 */ 12 12 13 13 const STORAGE_PREFIX = "diffuse/configurator/output"; ··· 17 17 //////////////////////////////////////////// 18 18 19 19 /** 20 - * @implements {OutputElement<Track[]>} 20 + * @implements {OutputElement} 21 21 */ 22 22 class OutputConfigurator extends DiffuseElement { 23 23 static NAME = "diffuse/configurator/output"; ··· 25 25 constructor() { 26 26 super(); 27 27 28 - /** @type {OutputManagerDeputy<Track[]>} */ 28 + /** @type {OutputManagerDeputy} */ 29 29 const manager = { 30 30 tracks: { 31 31 collection: computed(() => {
+2 -2
src/components/input/opensubsonic/worker.js
··· 152 152 153 153 /** @type {Track} */ 154 154 const track = { 155 - $type: "sh.diffuse.output.tracks", 155 + $type: "sh.diffuse.output.track", 156 156 id: crypto.randomUUID(), 157 157 kind: autoTypeToTrackKind(song.type), 158 158 uri: buildURI(server, { songId: song.id, path }), ··· 235 235 // picked up as a source. 236 236 if (!tracks.length) { 237 237 tracks = [{ 238 - $type: "sh.diffuse.output.tracks", 238 + $type: "sh.diffuse.output.track", 239 239 id: crypto.randomUUID(), 240 240 kind: "placeholder", 241 241 uri: buildURI(server),
+3 -3
src/components/input/s3/worker.js
··· 135 135 136 136 /** @type {Track} */ 137 137 const track = { 138 - $type: "sh.diffuse.output.tracks", 138 + $type: "sh.diffuse.output.track", 139 139 id, 140 140 stats, 141 141 tags, ··· 150 150 // picked up as a source. 151 151 if (!tracks.length) { 152 152 tracks = [{ 153 - $type: "sh.diffuse.output.tracks", 153 + $type: "sh.diffuse.output.track", 154 154 id: crypto.randomUUID(), 155 155 kind: "placeholder", 156 156 uri: buildURI(bucket), ··· 209 209 210 210 /** @type {Track} */ 211 211 const track = { 212 - $type: "sh.diffuse.output.tracks", 212 + $type: "sh.diffuse.output.track", 213 213 id: crypto.randomUUID(), 214 214 kind: "placeholder", 215 215 uri,
+2 -2
src/components/orchestrator/output/element.js
··· 24 24 static NAME = "diffuse/orchestrator/output"; 25 25 26 26 /** 27 - * @returns {OutputElement<Track[]>} 27 + * @returns {OutputElement} 28 28 */ 29 29 get output() { 30 - /** @type {OutputElement<Track[]> | null} */ 30 + /** @type {OutputElement | null} */ 31 31 const output = this.querySelector("#do-output__output"); 32 32 33 33 if (!output) throw new Error("Output orchestrator did not render yet.");
+1 -1
src/components/orchestrator/process-tracks/element.js
··· 64 64 /** @type {InputElement} */ 65 65 const input = query(this, "input-selector"); 66 66 67 - /** @type {OutputElement<Track[]>} */ 67 + /** @type {OutputElement} */ 68 68 const output = query(this, "output-selector"); 69 69 70 70 /** @type {import("@components/processor/metadata/element.js").CLASS} */
+1 -1
src/components/orchestrator/queue-tracks/element.js
··· 54 54 /** @type {InputElement} */ 55 55 const input = query(this, "input-selector"); 56 56 57 - /** @type {OutputElement<Track[]>} */ 57 + /** @type {OutputElement} */ 58 58 const output = query(this, "output-selector"); 59 59 60 60 /** @type {import("@components/engine/queue/element.js").CLASS} */
+1 -1
src/components/orchestrator/search-tracks/element.js
··· 53 53 /** @type {InputElement} */ 54 54 const input = query(this, "input-selector"); 55 55 56 - /** @type {OutputElement<Track[]>} */ 56 + /** @type {OutputElement} */ 57 57 const output = query(this, "output-selector"); 58 58 59 59 /** @type {import("@components/processor/search/element.js").CLASS} */
+1 -1
src/components/orchestrator/sources/element.js
··· 40 40 /** @type {InputElement} */ 41 41 const input = query(this, "input-selector"); 42 42 43 - /** @type {OutputElement<Track[]>} */ 43 + /** @type {OutputElement} */ 44 44 const output = query(this, "output-selector"); 45 45 46 46 // Wait until defined
+7 -4
src/components/output/common.js
··· 1 1 import { computed, signal, untracked } from "@common/signal.js"; 2 2 3 3 /** 4 + * @import {Track} from "@definitions/types.d.ts" 4 5 * @import {OutputManager, OutputManagerProperties} from "./types.d.ts" 5 6 */ 6 7 7 8 /** 8 - * @template Tracks 9 - * @param {OutputManagerProperties<Tracks>} _ 10 - * @returns {OutputManager<Tracks>} 9 + * @template Encoding 10 + * @param {OutputManagerProperties<Encoding>} _ 11 + * @returns {OutputManager<Encoding>} 11 12 */ 12 13 export function outputManager({ init, tracks }) { 13 - const t = signal(/** @type {Tracks} */ (tracks.empty())); 14 + const t = signal( 15 + /** @type {Encoding extends null ? Track[] : Encoding} */ (tracks.empty()), 16 + ); 14 17 const ts = signal( 15 18 /** @type {"loading" | "loaded" | "sleeping"} */ ("sleeping"), 16 19 );
+13 -12
src/components/output/types.d.ts
··· 1 1 import type { Signal, SignalReader } from "@common/signal.d.ts"; 2 2 import type { DiffuseElement } from "@common/element.js"; 3 + import type { Track } from "@definitions/types.d.ts"; 3 4 4 - export type OutputElement<Tracks> = 5 + export type OutputElement<Encoding = null> = 5 6 & DiffuseElement 6 - & OutputManagerDeputy<Tracks>; 7 + & OutputManagerDeputy<Encoding>; 7 8 8 - export type OutputManagerDeputy<Tracks> = Omit< 9 - OutputManager<Tracks>, 9 + export type OutputManagerDeputy<Encoding = null> = Omit< 10 + OutputManager<Encoding>, 10 11 "signals" 11 12 >; 12 13 13 - export type OutputManager<Tracks> = { 14 + export type OutputManager<Encoding = null> = { 14 15 signals: { 15 - tracks: Signal<Tracks>; 16 + tracks: Signal<Encoding extends null ? Track[] : Encoding>; 16 17 }; 17 18 tracks: { 18 - collection: SignalReader<Tracks>; 19 + collection: SignalReader<Encoding extends null ? Track[] : Encoding>; 19 20 reload: () => Promise<void>; 20 - save: (tracks: Tracks) => Promise<void>; 21 + save: (tracks: Encoding extends null ? Track[] : Encoding) => Promise<void>; 21 22 state: SignalReader<"loading" | "loaded" | "sleeping">; 22 23 }; 23 24 }; 24 25 25 - export type OutputManagerProperties<Tracks> = { 26 + export type OutputManagerProperties<Encoding = null> = { 26 27 init?: () => Promise<boolean>; 27 28 tracks: { 28 - empty(): Tracks; 29 - get(): Promise<Tracks>; 30 - put(tracks: Tracks): Promise<void>; 29 + empty(): Encoding extends null ? Track[] : Encoding; 30 + get(): Promise<Encoding extends null ? Track[] : Encoding>; 31 + put(tracks: Encoding extends null ? Track[] : Encoding): Promise<void>; 31 32 }; 32 33 }; 33 34
+1 -1
src/components/transformer/output/base.js
··· 6 6 */ 7 7 8 8 /** 9 - * @template T 9 + * @template [T=null] 10 10 */ 11 11 export class OutputTransformer extends DiffuseElement { 12 12 // SIGNALS
+1 -1
src/components/transformer/output/bytes/automerge/element.js
··· 36 36 } 37 37 }); 38 38 39 - /** @type {OutputManagerDeputy<Track[]>} */ 39 + /** @type {OutputManagerDeputy} */ 40 40 const manager = { 41 41 tracks: { 42 42 ...base.tracks,
+1 -1
src/components/transformer/output/bytes/json/element.js
··· 15 15 16 16 const base = this.base(); 17 17 18 - /** @type {OutputManagerDeputy<Track[]>} */ 18 + /** @type {OutputManagerDeputy} */ 19 19 const manager = { 20 20 tracks: { 21 21 ...base.tracks,
+2 -2
src/components/transformer/output/refiner/default/element.js
··· 7 7 */ 8 8 9 9 /** 10 - * @extends {OutputTransformer<Track[]>} 10 + * @extends {OutputTransformer} 11 11 */ 12 12 class DefaultOutputRefinerTransformer extends OutputTransformer { 13 13 constructor() { ··· 15 15 16 16 const base = this.base(); 17 17 18 - /** @type {OutputManagerDeputy<Track[]>} */ 18 + /** @type {OutputManagerDeputy} */ 19 19 const manager = { 20 20 tracks: { 21 21 ...base.tracks,
+1 -1
src/components/transformer/output/string/json/element.js
··· 15 15 16 16 const base = this.base(); 17 17 18 - /** @type {OutputManagerDeputy<Track[]>} */ 18 + /** @type {OutputManagerDeputy} */ 19 19 const manager = { 20 20 tracks: { 21 21 ...base.tracks,
+2 -2
src/testing/sample/tracks.js
··· 6 6 * @type {Track} 7 7 */ 8 8 export const trackA = { 9 - $type: "sh.diffuse.output.tracks", 9 + $type: "sh.diffuse.output.track", 10 10 id: "sample-a", 11 11 uri: "http://example.com/audio-a.mp3", 12 12 tags: { ··· 19 19 * @type {Track} 20 20 */ 21 21 export const trackB = { 22 - $type: "sh.diffuse.output.tracks", 22 + $type: "sh.diffuse.output.track", 23 23 id: "sample-b", 24 24 uri: "http://example.com/audio-b.mp3", 25 25 tags: {
+2 -2
src/themes/webamp/browser/element.js
··· 27 27 ); 28 28 29 29 $output = signal( 30 - /** @type {OutputElement<Track[]> | undefined} */ (undefined), 30 + /** @type {OutputElement | undefined} */ (undefined), 31 31 ); 32 32 33 33 $queue = signal( ··· 49 49 /** @type {InputElement} */ 50 50 const input = query(this, "input-selector"); 51 51 52 - /** @type {OutputElement<Track[]>} */ 52 + /** @type {OutputElement} */ 53 53 const output = query(this, "output-selector"); 54 54 55 55 /** @type {import("@components/engine/queue/element.js").CLASS} */
+3 -3
src/themes/webamp/configurators/input/element.js
··· 32 32 ); 33 33 34 34 $output = signal( 35 - /** @type {OutputElement<Track[]> | undefined} */ (undefined), 35 + /** @type {OutputElement | undefined} */ (undefined), 36 36 ); 37 37 38 38 $sourcesOrchestrator = signal( ··· 50 50 /** @type {InputElement} */ 51 51 const input = query(this, "input-selector"); 52 52 53 - /** @type {OutputElement<Track[]>} */ 53 + /** @type {OutputElement} */ 54 54 const output = query(this, "output-selector"); 55 55 56 56 /** @type {import("@components/orchestrator/sources/element.js").CLASS} */ ··· 191 191 async addSource(uri) { 192 192 /** @type {Track} */ 193 193 const track = { 194 - $type: "sh.diffuse.output.tracks", 194 + $type: "sh.diffuse.output.track", 195 195 id: crypto.randomUUID(), 196 196 kind: "placeholder", 197 197 uri,
+1 -1
src/themes/webamp/index.js
··· 32 32 const queue = component(Queue); 33 33 const search = component(Search); 34 34 35 - /** @type {OutputElement<Track[]> | null} */ 35 + /** @type {OutputElement | null} */ 36 36 const output = document.querySelector("#output"); 37 37 if (!output) throw new Error("Missing output element"); 38 38