--- layout: layouts/facets.vto base: ../../ title: Build | Facets | Diffuse styles: - styles/base.css - styles/diffuse/page.css - styles/diffuse/code-editor.css - vendor/@phosphor-icons/bold/style.css - vendor/@phosphor-icons/fill/style.css scripts: - facets/build.js 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. ---

Build

Your code here builds on the foundation listed below, and will be injected into a <div id="container"> element in the body.

Foundation

Diffuse comes with a foundation that preconfigures all elements so you don't have to set them up yourself, along with a combination of elements 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.

Refer to the elements index to find out what each element does.

{{- echo -}} import foundation from "common/facets/foundation.js" {{ /echo }} {{ echo -}}foundation.engine.audio(){{- /echo }} {{ echo -}}foundation.engine.queue(){{- /echo }} {{ echo -}}foundation.engine.repeatShuffle(){{- /echo }} {{ echo -}}foundation.engine.scope(){{- /echo }} {{ echo -}}foundation.orchestrator.autoQueue(){{- /echo }} {{ echo -}}foundation.orchestrator.favourites(){{- /echo }} {{ echo -}}foundation.orchestrator.input(){{- /echo }} {{ echo -}}foundation.orchestrator.output(){{- /echo }} {{ echo -}}foundation.orchestrator.queueAudio(){{- /echo }} {{ echo -}}foundation.orchestrator.processTracks(){{- /echo }} {{ echo -}}foundation.orchestrator.scopedTracks(){{- /echo }} {{ echo -}}foundation.orchestrator.sources(){{- /echo }} {{ echo -}}foundation.processor.artwork(){{- /echo }} {{ echo -}}foundation.processor.metadata(){{- /echo }} {{ echo -}}foundation.processor.search(){{- /echo -}}

Features:

Examples

Some simple examples to help you understand how to build your own facet. Click the edit button to load them into the code editor above.

{{ await comp.facets.examples({ id: "examples", items: examples }) }}

Notes

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: