--- layout: layouts/kitchen.vto base: ../ title: Create | Diffuse examples: - url: "facets/examples/now-playing/index.html" title: "Now playing" desc: > Shows what's currently set to "now playing" in the queue, along with a button to shift the queue to the next track. - url: "facets/examples/generate-playlist/index.html" title: "Generate playlist" desc: > Make a list of what previously played in the queue. ---
You can generate interfaces or features easily using AI. Diffuse provides a skill to use with LLMs. Claude usage example:
Open up skills screen (Customise tab in sidebar)
Select downloaded zip file
Try in chat and follow directions
Facets will be injected into a <div id="container"> element in the body.
While you have the ability to do whatever you want in a custom facet, the existing facets are designed to work a certain way; so here's some things to keep in mind:
Diffuse comes with a foundation that preconfigures a lot of the built-in Diffuse web components so you don't have to set them up yourself, along with a combination of components for certain features. It internally tracks the DOM addition of the custom elements, so no need to worry about setting up an element multiple times. It also provides signals which can be used to track element creations. An example of this can be found in the "scrobbles" feature.
That said, you are not required not use this! You can, for example, setup a Diffuse audio engine element yourself that's in a different group so that it doesn't communicate with the default one; in case you want to make a dj-deck, or something like that, which would have multiple audio items playing at the same time. This does mean you will need to pay attention to more things, such as, how does this interact with other features the user has enabled.
Refer to the elements index to find out what each element does.
{{- echo -}}
import foundation from "common/foundation.js"
{{ /echo }}
{{ echo -}}await foundation.configurator.artwork(){{- /echo }}
{{ echo -}}await foundation.configurator.input(){{- /echo }}
{{ echo -}}await foundation.configurator.metadata(){{- /echo }}
{{ echo -}}await foundation.configurator.scrobbles(){{- /echo }}
{{ echo -}}await foundation.engine.audio(){{- /echo }}
{{ echo -}}await foundation.engine.queue(){{- /echo }}
{{ echo -}}await foundation.engine.repeatShuffle(){{- /echo }}
{{ echo -}}await foundation.engine.scope(){{- /echo }}
{{ echo -}}await foundation.orchestrator.autoQueue(){{- /echo }}
{{ echo -}}await foundation.orchestrator.favourites(){{- /echo }}
{{ echo -}}await foundation.orchestrator.mediaSession(){{- /echo }}
{{ echo -}}await foundation.orchestrator.output(){{- /echo }}
{{ echo -}}await foundation.orchestrator.queueAudio(){{- /echo }}
{{ echo -}}await foundation.orchestrator.processTracks(){{- /echo }}
{{ echo -}}await foundation.orchestrator.scopedTracks(){{- /echo }}
{{ echo -}}await foundation.orchestrator.scrobbleAudio(){{- /echo }}
{{ echo -}}await foundation.orchestrator.sources(){{- /echo }}
{{ echo -}}await foundation.orchestrator.artwork(){{- /echo -}}
Some simple examples to help you understand how to write your own facet. Click the edit button to load them into the code editor above.
{{ await comp.examples({ id: "examples", items: examples }) }}