···11---
22layout: layouts/kitchen.vto
33base: ../
44-title: Code | Diffuse
44+title: Create | Diffuse
5566examples:
77 - url: "facets/examples/now-playing/index.html"
···2222</style>
232324242525-<h1 id="code" hidden>Code</h1>
2525+<h1 id="create" hidden>Create</h1>
262627272828<!-- BUILD -->
···35353636 <div style="flex: 1; font-size: var(--fs-sm); max-width: var(--container-sm)">
3737 <p style="margin-top: 0">
3838- Your code here builds on the <a href="#foundation">foundation</a> listed below, and will be injected into a <span style="white-space: nowrap"><code><div id="container"></code></span> element in the body.
3939- </p>
4040- <p>
4141- <input id="name-input" type="text" placeholder="Name" name="name" required />
3838+ <label for="name-input">Name</label>
3939+ <input id="name-input" type="text" placeholder="Name" name="name" value="New facet" required />
4240 </p>
4341 <p>
4242+ <label for="kind-input">Kind</label>
4443 <select id="kind-input" name="kind">
4545- <option value="interactive" selected>Interactive</option>
4646- <option value="prelude">Prelude</option>
4444+ <option value="interactive" selected>Interactive (Interface)</option>
4545+ <option value="prelude">Prelude (Feature)</option>
4746 </select>
4847 </p>
4948 <p>
4949+ <label for="description-input">Description</label>
5050 <textarea id="description-input" placeholder="Description" name="description" rows="5"></textarea>
5151 </p>
5252 <p>
···5959 </form>
6060</section>
61616262+<!-- GENERATE -->
6363+<div class="columns">
6464+ <section class="flex">
6565+ <h2 id="generate">Generate</h2>
6666+6767+ <p>
6868+ <strong>You can generate interfaces or features easily using AI.</strong> Diffuse provides a skill to use with LLMs. Claude usage example:
6969+ </p>
7070+7171+ <ul>
7272+ <li>
7373+ <p>
7474+ <a href="skills/diffuse-facet.zip" class="button" download>Download skill</a>
7575+ </p>
7676+ </li>
7777+ <li>
7878+ <p>
7979+ Open up <a href="https://claude.ai/customize/skills" target="_blank">skills screen</a> <small>(Customise tab in sidebar)</small>
8080+ </p>
8181+ </li>
8282+ <li>
8383+ <p>
8484+ <span class="with-icon">
8585+ <i class="ph-bold ph-plus"></i>
8686+ <span>Create skill</span>
8787+ <i class="ph-bold ph-arrow-right"></i>
8888+ <span>Upload skill</span>
8989+ </span>
9090+ </p>
9191+ </li>
9292+ <li>
9393+ <p>
9494+ Select downloaded zip file
9595+ </p>
9696+ </li>
9797+ <li>
9898+ <p>
9999+ Try in chat and follow directions
100100+ </p>
101101+ </li>
102102+ </ul>
103103+ </section>
104104+105105+ <section class="flex">
106106+ <h2 id="notes">Notes</h2>
107107+108108+ <p>
109109+ Facets will be injected into a <span style="white-space: nowrap"><code><div id="container"></code></span> element in the body.
110110+ </p>
111111+ <p>
112112+ 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:
113113+ </p>
114114+ <ul>
115115+ <li><span>Prelude (feature) facets are loaded in alphabetical order by the facet loader.</span></li>
116116+ <li><span>Most elements are configured in broadcast mode so they communicate across tabs. There are a few exceptions such as inputs, where we prefer parallelisation.</span></li>
117117+ <li><span>All URLs in a facet are relative to the root of Diffuse (not the root of the server) due to the base element in the header of the facet loader.</span></li>
118118+ </ul>
119119+ </section>
120120+</div>
121121+62122<!-- FOUNDATION -->
63123<div class="columns">
64124 <section class="flex">
65125 <h2 id="foundation">Foundation</h2>
6612667127 <p>
6868- <strong>Diffuse comes with a foundation that preconfigures a lot of elements so you don't have to set them up yourself</strong>, 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. It also provides signals which can be used to track element creations. An example of this can be found in the "scrobbles" feature.
128128+ <strong>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</strong>, 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.
69129 </p>
70130 <p>
71131 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.
···107167 <h2 id="examples">Examples</h2>
108168109169 <p>
110110- 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.
170170+ 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.
111171 </p>
112172113173 {{ await comp.examples({ id: "examples", items: examples }) }}
114114-115115- <h2 id="notes">Notes</h2>
116116- <p>
117117- 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:
118118- </p>
119119- <ul>
120120- <li><span>Prelude (feature) facets are loaded in alphabetical order by the facet loader.</span></li>
121121- <li><span>Most elements are configured in broadcast mode so they communicate across tabs. There are a few exceptions such as inputs, where we prefer parallelisation.</span></li>
122122- <li><span>All URLs in a facet are relative to the root of Diffuse (not the root of the server) due to the base element in the header of the facet loader.</span></li>
123123- </ul>
124174 </section>
125175</div>
···3838 await Grid.setupOutputIndicator();
39394040 switch (path) {
4141- case "/code":
4141+ case "/create":
4242 Build.renderEditor();
4343 Build.handleBuildFormSubmit();
4444 Build.listenForExamplesEdit();
+1-1
src/elements.vto
···2222 Elements
2323 </p>
2424 <p>
2525- Diffuse was built using these web components, consume these using the <a href="../code/">code tool</a>, the Javascript <a href="https://jsr.io/@toko/diffuse">package</a>, or the linked Javascript files down below.
2525+ Diffuse was built using these web components, consume these using the <a href="../create/">create tool</a>, the Javascript <a href="https://jsr.io/@toko/diffuse">package</a>, or the linked Javascript files down below.
2626 </p>
2727 <ul class="table-of-contents">
2828 <li><a href="elements/#artwork">Artwork</a></li>
+2-2
src/skills/diffuse-facet/SKILL.md
···55version: 0.1.0
66---
7788-Create a Diffuse facet and produce the HTML ready to paste into the `code/` page.
88+Create a Diffuse facet and produce the HTML ready to paste into the `create/` page.
991010## Step 1 — Read the docs
1111···161161162162## Step 4 — Deliver
163163164164-Output the complete facet HTML in a code block. Tell the user to open the `code/` page in Diffuse, paste it in, and load it.
164164+Output the complete facet HTML in a code block. Tell the user to open the `create/` page in Diffuse, paste it in, and load it.