Experiment to rebuild Diffuse using web applets.
0
fork

Configure Feed

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

feat: unshift queue

+19 -2
+1 -2
src/pages/constituents/blur/artwork-controller/_applet.astro
··· 585 585 } 586 586 587 587 function previous() { 588 - // TODO: 589 - // engine.queue.sendAction("shift"); 588 + engine.queue.sendAction("unshift"); 590 589 } 591 590 592 591 function next() {
+14
src/pages/engine/queue/_applet.astro
··· 26 26 //////////////////////////////////////////// 27 27 context.setActionHandler("add", add); 28 28 context.setActionHandler("shift", shift); 29 + context.setActionHandler("unshift", unshift); 29 30 30 31 function add(items: Track[]) { 31 32 update({ future: [...context.data.future, ...items] }); ··· 39 40 update({ past, now, future }); 40 41 41 42 return now; 43 + } 44 + 45 + function unshift() { 46 + if (context.data.past.length === 0) return; 47 + 48 + const past = [...context.data.past]; 49 + const [last] = past.splice(past.length - 1, 1); 50 + const now = last ?? null; 51 + const future = context.data.now 52 + ? [context.data.now, ...context.data.future] 53 + : context.data.future; 54 + 55 + update({ past, now, future }); 42 56 } 43 57 </script>
+4
src/pages/engine/queue/_manifest.json
··· 25 25 "shift": { 26 26 "title": "Shift", 27 27 "description": "Shift the queue, picking the first item from the up next array and putting the currently playing item into the history list." 28 + }, 29 + "unshift": { 30 + "title": "Unshift", 31 + "description": "Unshift the queue, going backwards in time, picking the last item from the history array and putting the currently playing item into the up next list." 28 32 } 29 33 } 30 34 }