The VS Code of video editing, built for agents.
TypeScript
Update package.json and README for consistency and clarity
konstantin-paulusc1bc3f0085f3
diff --git a/README.md b/README.mdindex 3fa9f518..86f28ba3 100644--- a/README.md+++ b/README.md@@ -1,8 +1,8 @@# Diffusion Studio-**FFmpeg for agents:** a video editor you drive from the command line, with a generative-AI and vision toolchain built in.+**FFmpeg for agents:** a media compositor you drive from the command line, with a generative-AI and vision toolchain built in.-Diffusion Studio is a canvas-based video editor. What makes it different is `dapi`, its CLI: every part of the editor (projects, the scene graph, the asset library, AI generation, rendering) is scriptable over a local socket, with JSON on stdout and deterministic exit codes. A human uses the canvas; an agent uses `dapi`. Both edit the same document.+What makes Diffusion Studio different is `dapi`, its CLI: every part of the editor (projects, the scene graph, the asset library, AI generation, rendering) is scriptable over a local socket, with JSON on stdout and deterministic exit codes.```shdapi open # use -b to run the editor headless@@ -81,6 +81,9 @@ dapi node capture # see the canvas itself| `dapi media …` | Inspect a file by id or path: `probe`, `grab`, `filmstrip`, `waveform`, `transcribe`, `listen` || `dapi project …` / `dapi folder …` / `dapi selection …` | Projects, library folders, canvas selection || `dapi models` / `dapi voices` / `dapi fonts` | Discover generation models, speech voices, local fonts |+| `dapi screenshot` / `dapi logs` | The app itself: capture the window, read recent console output |+| `dapi fetch` | Download a video from yt/tt/ig, ready for `dapi asset add` |+| `dapi whoami` | The authenticated account |Conventions throughout: single results are one JSON value, collections are JSON Lines, errors go to stderr with exit code `1`. Everything is built to be piped, grepped, and driven by a program.diff --git a/docs/README.md b/docs/README.mddeleted file mode 100644index 296118a1..00000000--- a/docs/README.md+++ /dev/null@@ -1,10 +0,0 @@-# Diffusion Studio documentation--Diffusion Studio is driven through `dapi`, its CLI. Start here:--- [Getting started](getting-started.md): install the CLI, open a project, first mount, first export-- [CLI reference](cli.md): every command, its options, and its output-- [Writing compositions](composition.md): the JSX API with elements, timing, paints, generative assets, and captions-- [Working with media](assets.md): the asset library and the vision/audio toolchain--The exhaustive specification these docs are distilled from lives with the CLI source: [apps/cli/reference](../apps/cli/reference/README.md), one file per command, with the JSX code syntax in [apps/cli/reference/jsx](../apps/cli/reference/jsx/README.md).diff --git a/docs/assets.md b/docs/assets.mddeleted file mode 100644index 7aacc6eb..00000000--- a/docs/assets.md+++ /dev/null@@ -1,96 +0,0 @@-# Working with media--The asset library holds a project's media. Beyond storage, the CLI ships an inspection toolchain under `dapi media` (probe, grab, filmstrip, waveform, transcribe, listen) so an agent can *look at* footage before cutting it. All of it runs locally except `listen` and `transcribe`, which use hosted models.--**Id or path:** every inspection command takes either an asset id or a local file path. A path is read directly, so `dapi media probe clip.mp4` works on a file that isn't in the project yet.--## The library--```sh-dapi asset add <paths...> [--folder <id>] # import files-dapi asset ls [ids...] # raw asset records (all assets if no ids)-dapi asset tree [--folder <id>] [--depth N] # the library as a folder tree-dapi asset mv <ids...> [--to <folderId>] # move assets between folders-dapi asset rm <ids...> # delete assets-dapi asset export <ids...> [-o <path>] # write original file bytes back to disk (no re-encode)-```--Folders nest arbitrarily and are managed with `dapi folder`:--```sh-dapi folder ls [parentId]-dapi folder create <name> [-p, --parent <id>]-dapi folder rename <id> <name>-dapi folder mv <ids...> [--to <folderId>]-dapi folder rm <ids...> # cascades: deletes all descendant folders AND assets;- # the output reports the deleted counts-```--Omitting a folder id anywhere always means the library root. (Opening a folder with `dapi open ./dir` builds this tree automatically from the directory structure; see [Getting started](getting-started.md#turn-a-folder-of-footage-into-a-project).)--## Inspecting media--Inspection lives under its own group, `dapi media`, because none of these commands touch the library: they read a media file by asset id or by local path and never mutate the project.--### `media probe`--```sh-dapi media probe <id|path>-```--Container and per-track technical metadata (format, duration, codec parameters), demuxed locally without decoding, like `ffprobe`. Packet stats (frame rate, bitrate) are estimated from a leading sample, so they're fast but approximate.--### `media grab`--```sh-dapi media grab <id|path> [-t <time...>] [-o <dir>]-```--Decodes video frames at the given timestamps to PNGs, at the asset's full resolution. Prints `{ time, path }` per frame. (For the *composited* canvas instead of the raw asset, use `dapi node capture`.)--### `media filmstrip`--```sh-dapi media filmstrip <id|path> [-s <start>] [-e <end>] [-x <scale>] [-o <path>]-```--Renders a video to a **filmstrip**: a grid of evenly sampled frames with a per-row timestamp ruler. Video only. `-s`/`-e` window the preview; `-x` trades thumbnail size against grid density. Prints `{ path }`.--### `media waveform`--```sh-dapi media waveform <id|path> [-s <start>] [-e <end>] [-x <scale>] [-o <path>]-```--Renders the audio track of a video or audio file as an amplitude **waveform** with a time axis, **highlighting silent stretches in red**. `-s`/`-e` window the preview; `-x` trades row height against grid density. Prints `{ path }`.--### `media transcribe`--```sh-dapi media transcribe <id|path>-```--Transcribes speech in a video or audio file. Returns segments with **word-level start/end times in seconds**: the raw material for caption timing, jump cuts, and content search.--### `media listen`--```sh-dapi media listen <id|path> [-p <prompt>] [-s <start>] [-e <end>]-```--Puts a multimodal model in front of an audio track. Without a prompt, returns a general description of what is heard; with one, answers it ("who is speaking?", "what music is playing?"). Accepts an audio file or a video, but only the audio track is analyzed. `-s`/`-e` scope the analyzed segment; timestamps in the answer are relative to `-s`.---## A typical agent pass--```sh-dapi open -b ./shoot # project from footage-dapi asset tree --depth 1 # what's here?-dapi media probe gbHJ # what format is it?-dapi media filmstrip gbHJ # what does it look like over time?-dapi media transcribe gbHJ # what is said, and when?-dapi media listen gbHJ -p "what is said in the intro?"-dapi mount cut.tsx # compose the edit-dapi node capture # verify visually-dapi node render -o cut.mp4 # ship it-```diff --git a/docs/cli.md b/docs/cli.mddeleted file mode 100644index e464c434..00000000--- a/docs/cli.md+++ /dev/null@@ -1,201 +0,0 @@-# CLI reference--`dapi` drives a running Diffusion Studio instance over a local socket. Every command except `open` and `fonts` needs the app running; launch it with `dapi open` (add `-b` for headless).--## Conventions--- **stdout is JSON.** Single results are one JSON value; collections and batch results are JSON Lines (one object per line, no surrounding array). `mount` and `node insert` print nothing on success.-- **stderr is for humans:** error messages and progress spinners.-- **Exit codes:** `0` on success, `1` on any error.-- **Unix names are canonical:** `ls`, `rm`, `cp`, `mv`, `grep`. The English forms (`list`, `remove`, `duplicate`, `move`) are aliases, and `get` is an alias for every `ls`.-- **Group aliases:** `selection`→`sel`, `node`→`n`, `project`→`p`, `asset`→`a`, `folder`→`fld`, `context`→`ctx`.-- **Batch commands are fail-fast** (`node rm`, `node patch`, `asset add`, …): one invalid input fails the whole command with a single stderr message and exit `1`. Ids are validated before anything changes, so a failed `rm`/`mv`/`cp` changes nothing; there are no per-item partial results.--### Time values--Wherever a command takes a time, three formats are accepted (frames are at 30 fps):--| Format | Example | Meaning |-| --- | --- | --- |-| number | `2.2` | seconds |-| `"<n>f"` | `"45f"` | frames |-| clock | `"02:30"`, `"01:02:30"` | MM:SS or HH:MM:SS |--Times in output are plain seconds, except in `node ls`, whose raw records use engine units (frames, packed `0xRRGGBB` colors, dB).--## App--### `open`--```sh-dapi open [target] [-b, --background]-```--Launches the app, or opens a target: a file, a `diffusion://` deep link, or a **folder**, which creates a project from the folder's media (or switches to the one created earlier; see [Getting started](getting-started.md#turn-a-folder-of-footage-into-a-project)). `--background` launches with no window, for headless use. The only command that doesn't need the app already running (besides `fonts`).--### `whoami`--Prints the signed-in account `{ id, email, provider }`, or `null`.--### `context`--Prints the open project's essentials: project id and name, entity count, scenes with sizes, the active scene, the playhead position (frames), and available font families. Call it first.--## Composing--### `mount`--```sh-dapi mount (<path> | --code <str>)-```--Compiles a Solid JSX module and mounts its rendered roots into the document. Re-mounting rebuilds keyed roots in place, like reloading a webpage. Declared generative assets are produced during the mount, which blocks until they land. With `--code`, a bare JSX expression is wrapped into a module automatically. See [Writing compositions](composition.md).--### `node insert`--```sh-dapi node insert <parentId> (<path> | --code <str>) [-i, --index <N>]-```--Same pipeline as `mount`, but inserts the rendered roots as children of an existing entity instead of mounting document roots. Roots take no `key`; every run inserts fresh nodes. `--index` sets the position among the parent's children (node roots only). Also how you extend sub-entities, e.g. adding a stop to a gradient:--```sh-dapi node insert <paintId> --code '<colorStop offset={0.5} color="#FF0055" />'-```--### `node patch`--```sh-dapi node patch ([path.json] | --json <str>)-```--Assigns JSX props on existing entities. The payload is an array of `{ id, …props }`, taking exactly the props a JSX element takes (see the [element reference](composition.md#elements)). A failing entry applies none of its props and aborts the command. Renaming is patching `name`; recoloring is patching `fill`; paints and color stops are patchable too. A [transition](composition.md#transitions) is patched as a `transition` prop on the outgoing clip (`null` removes it).--```sh-dapi node patch --json '[{ "id": 42, "x": 100, "opacity": 0.5 }]'-```--Note: `src` resolves asynchronously after the other props; patch it on its own to keep failure reporting unambiguous.--## Inspecting the scene graph--### `node tree`--```sh-dapi node tree [id] [--depth N]-```--An entity's subtree as nested JSON: structure only, with a compact `description` per node. The way to discover ids. Default depth `3`; `0` means the full subtree. Omit the id for one tree per top-level node.--### `node ls`--```sh-dapi node ls [ids...]-```--The raw entity records: every component the entity carries, in engine units. The property-level counterpart to `tree`. With no ids, lists the top-level nodes.--### `node grep`--```sh-dapi node grep <pattern> [id] [-i] [-t <types...>] [-k <components...>] [-l] [-c]-```--Searches entity records by regex and prints matching entities with the components that matched. `[id]` scopes to a subtree. `-t` filters by node type, `-k` restricts to specific components, `-l` prints refs only, `-c` prints a count. Find nodes by name with `dapi node grep -k Name Title`; find every entity with a `Trim` component with `dapi node grep -k Trim .`.--### `node capture`--```sh-dapi node capture [id] [-t, --time <time...>] [--no-timestamp]-```--Focuses the node (or the active scene, if omitted) and captures it to a PNG at each given timeline position, each stamped in the top-left with its `HH:MM:SS:FF` timestamp (disable with `--no-timestamp`). Prints one `{ time, path }` JSON line per capture.--### `selection`--```sh-dapi selection ls # the selected nodes-dapi selection set [ids...] # replace the selection (no ids = clear)-dapi selection focus # pan/zoom the canvas to the selection-```--Mutations print the resulting selection, so calls can be chained without a follow-up read.--## Editing nodes--### `node cp`--Deep-clones nodes including descendants: `dapi node cp <ids...>`. Prints `{ sourceId, newId }` per input.--### `node rm`--Deletes nodes and their descendants: `dapi node rm <ids...>`.--## Rendering--### `node render`--```sh-dapi node render [id] [-o, --output <path>] ([config.json] | --json <str>)-```--Renders a scene to a video file, locally. Defaults to the active scene and an MP4 (H.264, 10 Mbps, 1080p, AAC 128 kbps) in the temp directory; prints `{ path }`. Long-running: progress goes to stderr, stdout stays clean JSON. The encode window follows the scene's workarea.--All config fields are optional:--```jsonc-{- "format": "mp4", // "mp4" | "webm" | "ogg" | "mov"- "video": {- "codec": "avc", // "avc" | "hevc" | "vp9" | "av1" | "vp8"- "bitrate": 10000000, // bits/sec- "fps": 30, // default: the scene's frame rate- "resolution": 1080, // target height; width follows the scene's aspect- "enabled": true- },- "audio": {- "codec": "aac", // "aac" | "opus"- "bitrate": 128000,- "sampleRate": 48000,- "numberOfChannels": 2,- "enabled": true // false = video only- },- "trim": { "end": 30 } // seconds; cap the encode-}-```--## Projects--```sh-dapi project active # the open project, or null-dapi project ls # all projects, most recent first-dapi project create [name] # create and open-dapi project set <id> # switch to a project-dapi project rm <id> # delete-```--## Assets and folders--The library commands (`asset add/ls/mv/rm/export`, `folder ls/create/rename/mv/rm`) and the media-inspection commands (`probe`, `transcribe`, `listen`, `filmstrip`, `waveform`, `frame`) are covered in [Working with media](assets.md).--## Discovery--### `models`--```sh-dapi models [image|video|audio]-```--Lists the generation models available per media type, with each model's id and its constraints (durations, aspect ratios, features). These are what you reference from `generate.*` declarations.--### `voices`--Lists the speech voices for `generate.voice` declarations.--### `fonts`--```sh-dapi fonts [-f <pattern>] [-w <weights...>] [-s normal|italic] [-l <n>] [-n]-```--Lists local font families and variants (macOS only). `-n` prints plain family names. Works without the app running.diff --git a/docs/composition.md b/docs/composition.mddeleted file mode 100644index 88bad1ad..00000000--- a/docs/composition.md+++ /dev/null@@ -1,284 +0,0 @@-# Writing compositions--Compositions are **Solid JSX modules**. `dapi mount` compiles the module, runs it in the app, and renders every JSX element into an editable node in the document: no hidden DOM, no CSS, no layout pass. All positioning is explicit pixels.--```tsx-export default function Project() {- return (- <scene key="intro" name="Intro" width={1920} height={1080} fill="black">- {/* ... */}- </scene>- );-}-```---The module's default export is the project component. Solid's control flow (`<For>`, `<Show>`, …) and primitives (`createSignal`, `createMemo`, …) are available to *compose* the tree; the render is one-shot: after commit, the nodes belong to the document and signal changes no longer affect it. The update path is re-running the mount.--**Dependencies:** `solid-js` and `@diffusionstudio/jsx` are provided by the app; everything else you import (npm packages, local files, JSON) is bundled by the CLI. Libraries must be browser-compatible.--## Roots and keys--Every top-level element declares its identity with a `key`:--- Mounting rebuilds the existing node carrying that key, or creates it. Entity id and canvas position are preserved across re-mounts.-- Keyed nodes the render no longer produces are **deleted**; the mount owns its keyed roots. Unkeyed nodes (made by hand in the editor) are never touched.-- Keys must be unique within a render. Give roots a `name` too: the key identifies, the name labels.--The first rendered root becomes the active scene. New roots are auto-placed on the canvas near the viewport center; `<scene>` has no `x`/`y` because canvas arrangement is an editor concern, not part of the composition.--## Elements--| Element | What it makes |-| --- | --- |-| `<scene>` | A scene; clips children to its `width`×`height`. Document root only; scenes don't nest. |-| `<group>` | Container with a transform; give it `fill` to draw a rectangle. |-| `<rect>` | A filled rectangle. |-| `<text>` | Editable text. |-| `<video>` / `<image>` | Media; `src` is required. |-| `<audio>` | Sound only, no spatial props. |-| `<sequence>` | Track container for back-to-back clips (positions are explicit); hosts transitions. |-| `<captions>` | Styled captions: transcribes the scene's audio, or mounts a transcript given via `src`. |-| `<html>` | A rectangle whose children are HTML/SVG, laid out by the browser at the node's box size and drawn into it. Equivalent to a `<rect>` with an `<htmlPaint>`. |-| `<surface>` | A rectangle whose `ref` hands you a canvas to draw yourself (2d, webgl, webgpu); the bitmap is sampled into the box every frame. Equivalent to a `<rect>` with a `<surfacePaint>`. |-| `<solidPaint>`, `<linearGradientPaint>`, `<radialGradientPaint>`, `<colorStop>` | Fills, declared as children; see [Paints](#paints). |--User-defined components are ordinary Solid components; only the built-in camelCase elements produce nodes.--### Common props--| Prop | Default | Meaning |-| --- | --- | --- |-| `key` | none | Stable identity; required on document roots. |-| `name` | none | Node name in the editor. |-| `x`, `y` | `0` | Position in px, relative to the parent, origin top-left. Animatable. |-| `width`, `height` | parent size | Box size in px. Animatable. |-| `rotation` | `0` | Degrees. Animatable. |-| `opacity` | `1` | `0`–`1`. Animatable. |-| `cornerRadius` | `0` | Px. Animatable. |-| `start`, `end`, `sourceIn`, `sourceOut` | see [Timing](#timing) | Temporal placement. |-| `transition` | none | Cut into the next clip; `<sequence>` children only. See [Transitions](#transitions). |--Animatable props also take a keyframe list — see [Animation](#animation).--**Every box defaults to its parent's box**, the JSX analog of `position: absolute; inset: 0`. So a centered full-frame title is just:--```tsx-<text textAlign="center" textBaseline="middle" fontSize={128}>Hello</text>-```--### Per-element props--- **`<scene>`**: `key`, `width`, `height` (all required), `name`, `fill`. No timing or transform props.-- **`<rect>` / `<group>`**: `fill` (any CSS color; alpha is ignored, use `opacity`).-- **`<video>`**: `src` (required), `objectFit` (`"cover"` | `"contain"` | `"fill"`, default `"cover"`), `volume` (dB; `0` = unity, negative attenuates), `muted`, `syncTo` (see [Audio sync](#audio-sync)).-- **`<image>`**: `src` (required), `objectFit` (default `"contain"`).-- **`<audio>`**: `src` (required), `volume` (dB; `0` = unity, negative attenuates), `muted`, `syncTo`, timing props.-- **`<text>`**: string children (required), `fontFamily` (see `dapi fonts`), `fontSize`, `fontWeight`, `fontStyle`, `fill`, `textAlign`, `textBaseline`.-- **`<html>`**: HTML/SVG children. Fully reactive: signals in attributes, styles, and text update the drawn content. Event handlers are dropped (the content is painted, not interactive).-- **`<surface>`**: `ref` (required, callback form) receives the backing `HTMLCanvasElement` once at materialization; draw with any context type, create effects inside the ref to redraw from signals or the ticker.--These same props are what `dapi node patch` assigns on existing nodes.--## Media sources--`src` accepts:--- an **absolute path** like `"/Movies/clip.mp4"`-- a **remote URL**, registered as a remote asset-- an **asset id**: an imported library asset (see `dapi asset tree`)-- an **`AssetRef`**: the value returned by a `generate.*` declaration--To read a source's raw bytes inside an effect instead of mounting it as a node, pass the same input to `useFile`, which resolves it to a `File`. It returns Solid's `createResource` tuple (`[file, { mutate, refetch }]`): the `file` accessor reads `undefined` until it resolves, then the `File`. Useful for drawing a library image onto a `<surface>` or parsing a data file:--```tsx-import { createSignal, createEffect } from "solid-js";-import { useFile } from "@diffusionstudio/jsx";--const [canvas, setCanvas] = createSignal<HTMLCanvasElement>();-const [file] = useFile("/assets/logo.png");--createEffect(async () => {- const el = canvas();- const f = file();- if (!el || !f) return;- el.getContext("2d")!.drawImage(await createImageBitmap(f), 0, 0);-});--// <surface ref={setCanvas} width={640} height={360} />-```--## Timing--`start`/`end` place a clip on the parent timeline; `sourceIn`/`sourceOut` select which part of its source plays. The two are independent. Values take any [time format](cli.md#time-values) (seconds, `"45f"` frames, `"MM:SS"`).--| Prop | Meaning |-| --- | --- |-| `start` / `end` | Parent-timeline window. `start` defaults to 0; omit both and media fits its natural duration, groups auto-fit their children. |-| `sourceIn` / `sourceOut` | The source window to play. Default: the source's natural extent. `end` and `sourceOut` are the same out edge in timeline vs. source time. |--```tsx-<video src="/Movies/clip.mp4" start={5} sourceIn={10} sourceOut={20} />-// plays source seconds 10-20 (a 10 s clip), beginning at timeline second 5--<rect start={2} end={5} fill="red" />-// a sourceless node placed straight on the timeline: on screen from 2 s to 5 s-```--`<sequence>` groups a track of back-to-back clips and hosts clip [transitions](#transitions). It does not position clips at mount — give each an explicit `start` (the next clip's `start` is the previous clip's end). In the editor it keeps children from overlapping as you drag or regroup them.--### Audio sync--`syncTo` computes a node's `start` by cross-correlating its audio against another element's audio (named by `key`), so two recordings of the same take coincide on the timeline: a lav track against camera audio, two cameras, two microphones. Any pairing with audio tracks works (audio-to-video, audio-to-audio, video-to-video). `muted` silences the side that shouldn't be heard; alignment reads source content regardless of `muted` or `volume`.--```tsx-<video key="camera" src="/Movies/take-3.mp4" sourceOut={45} muted />-<audio src="/Movies/lav.wav" syncTo="camera" />-```--`syncTo` and `start` are mutually exclusive; `sourceIn`/`sourceOut` stay yours, and when omitted the window defaults to the overlap with the target's window. Alignment runs after generated assets land (either side may be generated), locally and cached, and blocks the mount; an alignment too weak to trust fails the mount and the node keeps its default placement.--## Transitions--A clip inside a `<sequence>` takes a `transition` prop rendering the cut into the clip that follows it:--```tsx-<sequence>- <video src="/Movies/a.mp4" start={0} end={8} transition={{ type: "fadeToBlack", duration: 0.5 }} />- <video src="/Movies/b.mp4" start={8} />-</sequence>-```--| Type | Effect |-| --- | --- |-| `"dissolve"` (default) | Crossfade: the incoming clip fades in over the outgoing one. |-| `"slideFromRight"` | The incoming clip slides in over the outgoing one, decelerating. |-| `"slideFromLeft"` | Same, from the left. |-| `"fadeToBlack"` | Dip to black: fade out, then fade the incoming clip in. |-| `"fadeToWhite"` | Same, through white. |--- `duration` takes any [time format](cli.md#time-values) (default 1 s) and runs centered on the cut. Timing is untouched: the clips stay back-to-back and the renderer overlaps them only while the transition runs.-- `transition` only renders on a direct child of `<sequence>` that has a clip after it. On the last clip it waits until one follows, matching the editor's inspector; outside a sequence the engine drops it.-- It's the same transition the inspector edits, and `dapi node patch` takes it like any other prop: a partial value merges into the clip's existing transition (`{ "id": 42, "transition": { "duration": 2 } }` keeps the type), and `"transition": null` removes it.--## Animation--Animatable props (`x`, `y`, `width`, `height`, `rotation`, `opacity`, `cornerRadius`, `volume`, `color`, `offset`) accept a keyframe list in place of a static value:--```tsx-<image- src="/photo.jpg"- start={0} end={5}- x={[- { time: 0, value: -400 },- { time: 1, value: 200, easing: "easeOut" },- ]}- opacity={[{ time: 0, value: 0 }, { time: "15f", value: 1 }]}-/>-```--- `time` is **node-local** (0 = the node's in point), in any [time format](cli.md#time-values); animation moves with the clip. Outside the keyframed range the value holds at the first/last keyframe.-- `easing` shapes the segment from its keyframe to the next (ignored on the last). Default `"linear"`.-- A static value replaces any existing keyframes on the property; mounted keyframes are regular editor keyframes, editable in the timeline and inspector. Props the render doesn't set keep their hand-made tracks.-- `color`, `opacity`, and `offset` also animate on paints and color stops, so gradients can move.--| Easing | Use for |-| --- | --- |-| `"linear"` (default) | Constant-rate change. |-| `"easeIn"`, `"easeOut"`, `"easeInOut"` | Standard acceleration curves (CSS equivalents). |-| `"gentle"`, `"snappy"`, `"bouncy"`, `"strong"` | Spring presets, from soft settle to hard overshoot. |-| `"cubicBezier(x1,y1,x2,y2)"` | Custom curve, CSS control points. |-| `"spring(bounce,duration)"` | Custom spring: bounce `0`–`1`, duration in ms. |-| `"steps(n)"` | Discrete hold: n equal steps, no interpolation. |--## Paints--A node's fill is a **paint child**; the `fill` prop is shorthand for a solid paint. Declaring paints as children unlocks gradients and stacking (later paints render on top, including over the media paint of a `<video>` or `<image>`):--```tsx-<rect width={640} height={360} cornerRadius={24}>- <linearGradientPaint rotation={90}>- <colorStop offset={0} color="#FF0055" />- <colorStop offset={1} color="#0055FF" />- </linearGradientPaint>-</rect>-```--`<solidPaint>` takes `color` (required) and `opacity`; gradient paints take `rotation` and `opacity` and only `<colorStop>` children (`offset` and `color` required). Colors are any CSS color; alpha is ignored, use `opacity`. `<htmlPaint>` draws browser-laid-out HTML/SVG children into the node's box; the `<html>` element is shorthand for a `<rect>` carrying one. `<surfacePaint>` draws a canvas your `ref` callback owns into the node's box; the `<surface>` element is likewise shorthand for a `<rect>` carrying one.--## Generated assets--Assets that don't exist yet are declared as values with the `generate` namespace and passed wherever a source is expected:--```tsx-import { generate } from "@diffusionstudio/jsx";--const hero = generate.image({ prompt: "A neon city at night, cinematic", seed: 42 });-const motion = generate.video({ prompt: "slow camera push-in", startFrame: hero, duration: 5 });-const vo = generate.voice({ prompt: "Welcome to the future." });-```--- `generate.image({ prompt, model?, aspectRatio?, refs?, seed? })`-- `generate.video({ prompt, model?, aspectRatio?, duration?, audio?, startFrame?, endFrame?, seed? })`-- `generate.voice({ prompt, voice? })` where `prompt` is the text to speak-- `generate.audio({ prompt, model? })`--Run `dapi models <type>` for valid model ids and per-model constraints, `dapi voices` for voices.--Declarations are pure: nothing generates until the mount commits, and refs never used by a mounted element are dropped. Because `startFrame`/`endFrame`/`refs` take refs as values, dependencies generate in the right order and cycles are impossible.--**Caching:** results are cached by content (model, prompt, resolved refs, seed, …) in the asset library: re-mounting an unchanged project reuses its assets instead of regenerating, even across sessions, and identical declarations collapse to one asset. Deleting a generated asset clears its cache entry. Set `seed` for reproducibility.--## Captions--`<captions />` inside a scene transcribes that scene's audio into a styled, timed caption node. It runs after generated assets land and [audio sync](#audio-sync) resolves (so it can caption generated voice-over at its final placement), attaches asynchronously, and is cached against the scene's audible mix, so re-mounting with unchanged audio doesn't re-transcribe.--```tsx-<captions preset="spotlight" colors={["#FF0055"]} />-```--### Manual captions--`src` supplies the transcript instead of transcribing: a path, URL, or asset id of an `.srt` or `.vtt` subtitle file, or a transcript `.json` (the `dapi transcribe` output format: `[{ text, words: [{ text, start, end }] }]`, times in seconds). Subtitle cues carry no word timings, so word-level presets highlight on timings synthesized within each cue.--```tsx-<captions src="./subtitles.srt" preset="classic" />-```--Times are scene-relative; set `start` to shift the whole caption track when the transcript was written against a clip that begins later in the scene.--| Preset | Style |-| --- | --- |-| `"classic"` (default) | Centered lowercase text, soft drop shadow, a few words at a time. |-| `"cascade"` | Light text lower-left; words appear as spoken. |-| `"spotlight"` | Bold italic centered line; the spoken word lights up (1 color slot). |-| `"whisper"` | Small, wide, understated ~2 s phrases. |-| `"paper"` | Centered two-line block; the spoken line is emphasized. |-| `"guinea"` | Uppercase display; the spoken word enlarges and cycles 3 colors (3 slots). |-| `"stark"` | Heavy uppercase, difference-blended into the footage. |--`colors` fills a preset's color slots in order; presets without slots ignore it.--## Types and tooling--For IntelliSense and typechecking in a project folder:--```sh-npm install --save-dev @diffusionstudio/jsx solid-js-```--```jsonc-// tsconfig.json-{- "compilerOptions": {- "jsx": "preserve",- "jsxImportSource": "@diffusionstudio/jsx"- }-}-```--The CLI strips types without checking them; run `tsc --noEmit` for type safety.--## Errors--Compile errors surface on stderr before the app is contacted. Evaluate/mount errors (invalid props, a root without `key`, nested `<scene>`, an unknown or cyclic `syncTo` key, …) abort with **nothing inserted**. Generation errors surface after all generations settle; the mounted tree stays committed and the affected placeholder is left without media. Audio-sync failures (no decodable audio, no reliable alignment) surface the same way; the node keeps its default placement. Runtime errors map back to your source via sourcemaps.diff --git a/docs/distribution.md b/docs/distribution.mddeleted file mode 100644index 025fbdac..00000000--- a/docs/distribution.md+++ /dev/null@@ -1,80 +0,0 @@-# Distribution (macOS)--The desktop app ships as a signed, notarized macOS build with the `dapi` CLI bundled inside the app (no separate Node or CLI install). Auto-updates come from [update.electronjs.org](https://update.electronjs.org), which serves the ZIP asset of the latest published GitHub release.--## Releasing--There is one global version, shared by the root and all apps (web, desktop, cli); the workflow fails if any of them drift from the tag.--1. `npm run release <patch|minor|major|x.y.z>`: bumps every package.json to the same version, refreshes the lockfile, commits, and tags.-2. Push as printed by the script: `git push origin HEAD v0.130.0`.-3. The `Release` workflow builds, signs, notarizes, and uploads a **draft** GitHub release with two assets:- - `Diffusion Studio-darwin-arm64-<version>.zip`: consumed by the auto-updater.- - `Diffusion-Studio-arm64.dmg`: manual download and Homebrew.-4. Publish the draft release. Installed apps pick up the update on next launch (checked every 10 minutes while running).--Local equivalent without publishing: `npm run make --workspace=@diffusionstudio/desktop` (artifacts in `apps/desktop/out/make`). Set `SKIP_SIGN=1` to build without a signing identity.--## Required repository secrets--| Secret | Value |-|---|---|-| `MACOS_CERT_P12` | Developer ID Application certificate + key, exported as .p12, base64-encoded |-| `MACOS_CERT_PASSWORD` | Password of the .p12 export |-| `APPLE_ID` | Apple ID used for notarization |-| `APPLE_PASSWORD` | App-specific password for that Apple ID (appleid.apple.com) |-| `APPLE_TEAM_ID` | Team id, e.g. `BYVQNNK2TH` |--## App icon--The current icon is a placeholder. To replace it: overwrite `apps/desktop/assets/icon.png` with a 1024x1024 PNG (transparent background, artwork on the macOS icon grid, i.e. a rounded square of ~824px centered), then run `npm run make:icns --workspace=@diffusionstudio/desktop` and commit both files. The build uses `assets/icon.icns` for the app bundle and the DMG volume.--## DMG window--The installer window uses a dark, on-brand background with a glowing arrow pointing from the app to the Applications folder. The source is `apps/desktop/assets/dmg-background.svg` (658x498, matching the DMG window size). To regenerate the raster assets after editing the SVG:--```sh-cd apps/desktop/assets-rsvg-convert -w 658 -h 498 dmg-background.svg -o dmg-background.png-rsvg-convert -w 1316 -h 996 dmg-background.svg -o [email protected]-```--`electron-installer-dmg` picks up the `@2x` sibling automatically for retina. Icon positions and window size live in `forge.config.ts` (the `MakerDMG` `contents` / `additionalDMGOptions`); keep them in sync with the arrow placement if you move things.--## Bundled CLI--`dapi` lives at `Diffusion Studio.app/Contents/Resources/cli/bin/dapi`, a wrapper that runs the CLI bundle on the app's own Electron binary (`ELECTRON_RUN_AS_NODE`). Users get it on their PATH via:--- Homebrew: the cask's `binary` stanza links it automatically.-- Manual install: menu bar > Diffusion Studio > "Install dapi Command Line Tool" links it into `/usr/local/bin`.--## Homebrew cask--Lives in a tap repo (e.g. `diffusionstudio/homebrew-tap`, file `Casks/editor.rb`). Update `version` and `sha256` (`shasum -a 256 <dmg>`) per release, or wire up a bump automation later.--```ruby-cask "editor" do- version "0.129.0"- sha256 "REPLACE_WITH_DMG_SHA256"-- url "https://github.com/diffusionstudio/editor/releases/download/v#{version}/Diffusion-Studio-arm64.dmg"- name "Diffusion Studio"- desc "Agentic video editor"- homepage "https://diffusion.studio"-- depends_on arch: :arm64- depends_on macos: ">= :big_sur"- auto_updates true-- app "Diffusion Studio.app"- binary "#{appdir}/Diffusion Studio.app/Contents/Resources/cli/bin/dapi"-- zap trash: [- "~/Library/Application Support/Diffusion Studio",- "~/Library/Preferences/studio.diffusion.editor.plist",- "~/Library/Saved Application State/studio.diffusion.editor.savedState",- ]-end-```--Install: `brew install --cask diffusionstudio/tap/editor`.diff --git a/docs/getting-started.md b/docs/getting-started.mddeleted file mode 100644index b9fd4d89..00000000--- a/docs/getting-started.md+++ /dev/null@@ -1,78 +0,0 @@-# Getting started--## Install the CLI--The CLI is built from this repository. With Node 20+ installed:--```sh-git clone https://github.com/diffusionstudio/editor.git-cd editor-npm install-npm run symlink:create --workspace=@diffusionstudio/cli-```--`symlink:create` builds `dapi` and links it into `/opt/homebrew/bin` (the macOS/Homebrew layout). On other setups, build with `npm run build --workspace=@diffusionstudio/cli` and link `apps/cli/dist/index.js` onto your PATH yourself.--## Launch the editor--Every `dapi` command except `open` and `fonts` talks to a running Diffusion Studio instance. Start one:--```sh-dapi open # launch the app-dapi open -b # launch headless (no window), ideal for agents and CI-```--When developing from source, `npm run dev:desktop` starts the app too.--## Turn a folder of footage into a project--Point `open` at a directory and it becomes a project: every supported media file underneath is imported, with the directory structure mirrored as library folders.--```sh-dapi open ./shoot-2026-07-```--The first run creates the project and writes a `.dapi` marker file into the folder; later runs read the marker and just switch to that project. Commit the marker to share one project across a team, or add it to `.gitignore` to keep the association per-clone.--You can also manage projects directly: `dapi project create`, `dapi project ls`, `dapi project set <id>`.--## Look around--```sh-dapi context # the open project: scenes, active scene, playhead, fonts-dapi asset tree # the media library as a folder tree-```--`dapi context` (alias `ctx`) is the right first call in any session; it tells you what is on the canvas before you change it.--## Mount your first composition--Compositions are Solid JSX modules rendered into the document with `dapi mount`. For a one-liner, pass code inline:--```sh-dapi mount --code '<scene key="hello" name="Hello" width={1920} height={1080} fill="black">- <text textAlign="center" textBaseline="middle" fontSize={120} fill="white">Hello World</text>-</scene>'-```--The `key` is the scene's stable identity: re-running the mount rebuilds that scene in place instead of adding a copy. For anything real, put the module in a file (`dapi mount hero.tsx`) and see [Writing compositions](composition.md).--Check the result visually:--```sh-dapi node capture # prints { "time": null, "path": "/tmp/….png" }-```--## Render--```sh-dapi node render -o hello.mp4-```--Renders the active scene locally with sensible defaults (MP4, H.264, 1080p). Codec, bitrate, resolution, and trim are configurable; see [`node render`](cli.md#node-render) in the CLI reference.--## Next--- [CLI reference](cli.md): the full command surface-- [Writing compositions](composition.md): timing, paints, generative assets, captions-- [Working with media](assets.md): probe, transcribe, and listen to footagediff --git a/examples/01-basics.tsx b/examples/01-basics.tsxnew file mode 100644index 00000000..b82724a5--- /dev/null+++ b/examples/01-basics.tsx@@ -0,0 +1,79 @@+/* @jsxImportSource @diffusionstudio/jsx */+/* The everyday composition: sequenced A-roll, an image overlay, data-driven+ * titles via <For>, and a music bed under everything.+ *+ * dapi mount examples/01-basics.tsx+ *+ * Sources are remote URLs so the example mounts anywhere; `src` equally takes+ * local paths ("/Movies/clip.mp4") and asset ids (see `dapi asset ls`).+ * A <sequence> does not place its children: each clip gets an explicit+ * `start`, the next clip starts where the previous one ends, and the+ * dissolve declared on the outgoing clip is centered on that cut.+ */++import { For } from "solid-js";+import type { Time } from "@diffusionstudio/jsx";++const VIDEOS = "https://mdn.github.io/shared-assets/videos";+const MUSIC = "https://mdn.github.io/webaudio-examples/audio-basics/outfoxing.mp3";+const STILL = "https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg";++const TITLES: { text: string; start: Time; end: Time }[] = [+ { text: "Chapter One", start: 1, end: 5 },+ { text: "Chapter Two", start: 7, end: 11 },+];++function Title(props: { text: string; start: Time; end: Time }) {+ return (+ <text+ textAlign="center"+ textBaseline="middle"+ fontFamily="Inter"+ fontSize={120}+ fontWeight="bold"+ start={props.start}+ end={props.end}+ animations={[+ { type: "fade", duration: 0.5 },+ { type: "fade", phase: "out", duration: 0.5 },+ ]}+ >+ {props.text}+ </text>+ );+}++export default function Basics() {+ return (+ <scene key="example-basics" name="Basics" width={1920} height={1080} fill="black">+ <sequence name="A-roll">+ <video+ src={`${VIDEOS}/sintel-short.mp4`}+ start={0}+ end={6}+ sourceIn={10}+ volume={-6}+ transition={{ type: "dissolve" }}+ height={1080}+ width={1920}+ />+ <video+ src={`${VIDEOS}/tears-of-steel-battle-clip-medium.mp4`}+ start={6}+ end={12}+ sourceIn={2}+ volume={-6}+ height={1080}+ width={1920}+ />+ </sequence>++ {/* picture-in-picture overlay; media covers its box by default */}+ <image src={STILL} x={1400} y={64} width={440} height={248} cornerRadius={24} start={0} end={12} />++ <For each={TITLES}>{(t) => <Title {...t} />}</For>++ <audio name="Music bed" src={MUSIC} start={0} end={12} volume={-16} />+ </scene>+ );+}diff --git a/examples/02-genai.tsx b/examples/02-genai.tsxnew file mode 100644index 00000000..ef4b55e0--- /dev/null+++ b/examples/02-genai.tsx@@ -0,0 +1,70 @@+/* @jsxImportSource @diffusionstudio/jsx */+/* Multi-stage generation: text-to-image keyframes, image-to-video motion,+ * a text-to-speech voiceover, generated ambience, and captions on top.+ *+ * dapi mount examples/02-genai.tsx+ *+ * `generate.*` declarations are pure values; nothing generates until commit.+ * Refs form a dependency graph (keyframe -> matching second keyframe -> two+ * motion clips) that generates in topological order, blocking the command+ * until every asset lands. <captions> reads the finished scene audio after+ * generation, so caption timing matches the voiceover. Consumes credits;+ * results are cached per session, so re-mounting unchanged specs is free.+ * Discover models and voices with `dapi models <type>` and `dapi voices`;+ * omitted here, so each stage uses the default model.+ */++import { generate } from "@diffusionstudio/jsx";++const SEED = 7;++const keyframe = generate.image({+ prompt: "Lighthouse on a basalt cliff at dawn, low fog rolling in, cinematic wide shot",+ aspectRatio: "16:9",+ seed: SEED,+});++// second keyframe references the first, keeping the location consistent+const counterShot = generate.image({+ prompt: "The same lighthouse seen from the open sea, waves in the foreground, dawn light",+ aspectRatio: "16:9",+ refs: [keyframe],+ seed: SEED,+});++const shot1 = generate.video({+ prompt: "slow aerial push-in toward the lighthouse, fog drifting",+ startFrame: keyframe,+ duration: 5,+});++const shot2 = generate.video({+ prompt: "gentle drift across the waves, lighthouse holding in the distance",+ startFrame: counterShot,+ duration: 5,+});++const voiceover = generate.voice({+ prompt:+ "Long before radar, a single beam of light was the only promise sailors had that land was near.",+});++const ambience = generate.audio({+ prompt: "distant ocean waves, low wind, calm coastal ambience",+});++export default function GenAi() {+ return (+ <scene key="example-genai" name="GenAI" width={1920} height={1080} fill="black">+ <sequence name="Generated shots">+ <video src={shot1} start={0} end={5} transition={{}} />+ <video src={shot2} start={5} end={10} />+ </sequence>++ <audio name="Voiceover" src={voiceover} start={1} />+ <audio name="Ambience" src={ambience} start={0} end={10} volume={-18} />++ <captions preset="spotlight" verticalAlign="bottom" />+ </scene>+ );+}diff --git a/examples/03-ticker.tsx b/examples/03-ticker.tsxnew file mode 100644index 00000000..44e186a2--- /dev/null+++ b/examples/03-ticker.tsx@@ -0,0 +1,66 @@+/* @jsxImportSource @diffusionstudio/jsx */+/* Declarative animation: useTicker exposes the playhead as reactive+ * accessors, createMemo derives values from it, and props consume the memos.+ *+ * dapi mount examples/03-ticker.tsx+ *+ * No timers, no imperative draw loop: each memo recomputes once per tick and+ * every consumer below reads the cached value. Press play; scrubbing works+ * too, and because the playhead is the only clock, exports and captures+ * render the exact same frames.+ */++import { createMemo } from "solid-js";+import { useTicker } from "@diffusionstudio/jsx";++const LOOP = 4; // seconds per revolution++export default function Ticker() {+ const { time, frame } = useTicker();++ // derived values: computed once per tick, shared by every consumer+ const progress = createMemo(() => (time() % LOOP) / LOOP); // 0..1 over the loop+ const angle = createMemo(() => progress() * Math.PI * 2);+ const hue = createMemo(() => Math.round(progress() * 360));+ const eased = createMemo(() => 0.5 - Math.cos(angle()) / 2); // 0..1..0, smooth++ return (+ <scene key="example-ticker" name="Ticker" width={1920} height={1080} fill="#101014">+ {/* center square: rotation and corner radius both derive from progress */}+ <rect+ x={860}+ y={440}+ width={200}+ height={200}+ rotation={progress() * 360}+ cornerRadius={16 + eased() * 84}+ fill={`hsl(${hue()} 90% 60%)`}+ />++ {/* orbiting dot */}+ <rect+ x={910 + Math.cos(angle()) * 420}+ y={490 + Math.sin(angle()) * 300}+ width={100}+ height={100}+ cornerRadius={50}+ fill={`hsl(${(hue() + 120) % 360} 90% 65%)`}+ />++ {/* loop progress bar */}+ <rect x={80} y={980} width={1760} height={12} cornerRadius={6} fill="#ffffff" opacity={0.12} />+ <rect+ x={80}+ y={980}+ width={Math.max(progress() * 1760, 12)}+ height={12}+ cornerRadius={6}+ fill={`hsl(${hue()} 90% 60%)`}+ />++ <text x={80} y={64} fontSize={44} fontFamily="Inter">+ t = {time().toFixed(2)}s / frame {frame()} / loop {Math.round(progress() * 100)}%+ </text>+ </scene>+ );+}diff --git a/examples/04-html-in-canvas.tsx b/examples/04-html-in-canvas.tsxnew file mode 100644index 00000000..45861f25--- /dev/null+++ b/examples/04-html-in-canvas.tsx@@ -0,0 +1,65 @@+/* @jsxImportSource @diffusionstudio/jsx */+/* An AI prompt box as real HTML, centered in the frame.+ *+ * dapi mount examples/04-html-in-canvas.tsx+ *+ * Requires Chromium's html-in-canvas API (chrome://flags/#canvas-draw-element);+ * without it the mount fails with an explicit error. The <html> children are+ * real DOM: the browser lays them out at the box size and the result is drawn+ * into the composition (painted, not interactive; event handlers are dropped).+ * The typed-out prompt and the cursor blink derive from the playhead, so they+ * follow scrubbing and render frame-accurately in exports.+ */++import { createMemo } from "solid-js";+import { useTicker } from "@diffusionstudio/jsx";++const PROMPT = "Cut a 30 second teaser from these clips, punchy captions, synthwave score";+const CHARS_PER_SECOND = 12;++export default function PromptBox() {+ const { time } = useTicker();++ const typed = createMemo(() => PROMPT.slice(0, Math.floor(time() * CHARS_PER_SECOND)));+ const cursorOn = createMemo(() => Math.floor(time() * 2) % 2 === 0);++ return (+ <scene key="example-html" name="Prompt box" width={1920} height={1080} fill="#0b0d12">+ <html+ x={460}+ y={400}+ width={1000}+ height={280}+ animations={[{ type: "slideUp", duration: 0.6 }]}+ end={8}+ >+ <div+ style={`height:100%;box-sizing:border-box;display:flex;flex-direction:column;+ justify-content:space-between;padding:28px 32px;border-radius:24px;+ border:1px solid #ffffff22;background:linear-gradient(180deg,#171a22,#101218);+ font-family:Inter;color:white;`}+ >+ <div style="font-size:15px;letter-spacing:2px;opacity:0.5;">ASK THE EDITOR</div>++ <div style="font-size:30px;line-height:1.4;min-height:84px;">+ {typed()}+ <span style={`opacity:${cursorOn() ? 0.9 : 0};color:#7c9cff;`}>▍</span>+ </div>++ <div style="display:flex;align-items:center;gap:12px;">+ <span style="padding:6px 14px;border-radius:999px;background:#ffffff14;font-size:14px;opacity:0.8;">+ gen-video-pro+ </span>+ <span style="font-size:14px;opacity:0.4;">1080p / 30 fps</span>+ <div+ style={`margin-left:auto;width:48px;height:48px;border-radius:50%;background:#7c9cff;+ display:flex;align-items:center;justify-content:center;font-size:24px;color:#0b0d12;`}+ >+ ↑+ </div>+ </div>+ </div>+ </html>+ </scene>+ );+}diff --git a/samples/reconciler/06-anime-timeline.tsx b/examples/05-anime-timeline.tsxsimilarity index 74%rename from samples/reconciler/06-anime-timeline.tsxrename to examples/05-anime-timeline.tsxindex 275966de..e6097ae9 100644--- a/samples/reconciler/06-anime-timeline.tsx+++ b/examples/05-anime-timeline.tsx@@ -1,9 +1,9 @@/* @jsxImportSource @diffusionstudio/jsx *//* Anime.js timeline scrubbed by the playhead: one clock, two render worlds.*- * dapi mount samples/reconciler/06-anime-timeline.tsx+ * dapi mount examples/05-anime-timeline.tsx*- * Needs the html-in-canvas API (see 05-html-paint.tsx). A paused anime.js+ * Needs the html-in-canvas API (see 04-html-in-canvas.tsx). A paused anime.js* timeline tweens plain-object targets; a createEffect seeks it to the* scene playhead (looping over the timeline length) and mirrors the values* into a store. The same values drive an ECS chip on the canvas and a DOM@@ -19,18 +19,18 @@ import { useTicker } from "@diffusionstudio/jsx";const chip = { x: -160, y: 190, rotation: -90, cornerRadius: 12, opacity: 0 };const card = { rise: 90, opacity: 0, progress: 0, hue: 210 };-const tl = createTimeline({ autoplay: false })- .add(chip, { x: 110, opacity: 1, duration: 1000, ease: "outElastic(1, .6)" }, 0)- .add(chip, { rotation: 270, cornerRadius: 80, duration: 1400, ease: "inOutQuad" }, 1000)- .add(chip, { cornerRadius: 12, rotation: 360, duration: 800, ease: "outBack" }, 2600)- .add(card, { rise: 0, opacity: 1, duration: 800, ease: "outCubic" }, 200)- .add(card, { progress: 100, duration: 2800, ease: "inOutSine" }, 500)- .add(card, { hue: 570, duration: 3400, ease: "linear" }, 0);--export default () => {+export default function AnimeTimeline() {const { time } = useTicker();const [v, setV] = createStore({ chip: { ...chip }, card: { ...card } });+ const tl = createTimeline({ autoplay: false })+ .add(chip, { x: 110, opacity: 1, duration: 1000, ease: "outElastic(1, .6)" }, 0)+ .add(chip, { rotation: 270, cornerRadius: 80, duration: 1400, ease: "inOutQuad" }, 1000)+ .add(chip, { cornerRadius: 12, rotation: 360, duration: 800, ease: "outBack" }, 2600)+ .add(card, { rise: 0, opacity: 1, duration: 800, ease: "outCubic" }, 200)+ .add(card, { progress: 100, duration: 2800, ease: "inOutSine" }, 500)+ .add(card, { hue: 570, duration: 3400, ease: "linear" }, 0);+createEffect(() => {tl.seek((time() * 1000) % tl.duration);setV("chip", { ...chip });@@ -40,7 +40,7 @@ export default () => {const hue = () => Math.round(v.card.hue);return (- <scene key="sample-anime" name="Anime timeline" width={960} height={540} fill="#101014">+ <scene key="example-anime" name="Anime timeline" width={960} height={540} fill="#101014"><rectx={v.chip.x}y={v.chip.y}@@ -50,9 +50,10 @@ export default () => {cornerRadius={v.chip.cornerRadius}opacity={v.chip.opacity}fill={`hsl(${hue()} 90% 60%)`}+ end={3.25}/>- <html x={380} y={120} width={500} height={300}>+ <html x={380} y={120} width={500} height={300} end={3.25}><divstyle={{"font-family": "Inter",@@ -85,4 +86,4 @@ export default () => {</html></scene>);-};+}diff --git a/samples/reconciler/09-three-helmet.tsx b/examples/06-three.tsxsimilarity index 95%rename from samples/reconciler/09-three-helmet.tsxrename to examples/06-three.tsxindex 3d1c28e7..7230bfc3 100644--- a/samples/reconciler/09-three-helmet.tsx+++ b/examples/06-three.tsx@@ -1,7 +1,7 @@/* @jsxImportSource @diffusionstudio/jsx *//* Three.js owning a <surface>: a glTF helmet spun by the playhead.*- * dapi mount samples/reconciler/09-three-helmet.tsx+ * dapi mount examples/06-three.tsx** The <surface> ref hands three.js a detached HTMLCanvasElement to render into;* the engine samples that bitmap into the node's box every frame, so a WebGL@@ -27,7 +27,7 @@ const MODEL_URL =const TURN_SECONDS = 6; // one full revolution per 6s of composition time-export default () => {+export default function ThreeHelmet() {const { time } = useTicker();const [loaded, setLoaded] = createSignal(false);@@ -96,8 +96,8 @@ export default () => {};return (- <scene key="sample-three" name="Three helmet" width={960} height={540} fill="#0b0d12">+ <scene key="example-three" name="Three helmet" width={960} height={540} fill="#0b0d12"><surface x={0} y={0} width={960} height={540} ref={setup} /></scene>);-};+}diff --git a/examples/07-webgpu.tsx b/examples/07-webgpu.tsxnew file mode 100644index 00000000..9a465bcd--- /dev/null+++ b/examples/07-webgpu.tsx@@ -0,0 +1,117 @@+/* @jsxImportSource @diffusionstudio/jsx */+/* WebGPU owning a <surface>: a triangle whose colors cycle with the playhead.+ *+ * dapi mount examples/07-webgpu.tsx+ *+ * The <surface> ref hands a detached canvas to a WebGPU context; the engine+ * samples the bitmap into the node's box every frame. Device setup is async,+ * so the ref creates the draw effect synchronously and a signal wakes it once+ * the pipeline exists. Composition time feeds a uniform and the fragment+ * shader derives the colors from it (a phase-shifted cosine palette), so the+ * playhead is the only clock: scrubbing and exports stay frame-accurate.+ * Fails with a console error where WebGPU is unavailable.+ */++import { createEffect, createSignal, onCleanup } from "solid-js";+import { useTicker } from "@diffusionstudio/jsx";++const SHADER = /* wgsl */ `+ @group(0) @binding(0) var<uniform> time: f32;++ struct VSOut {+ @builtin(position) position: vec4f,+ @location(0) local: vec2f,+ }++ @vertex+ fn vs(@builtin(vertex_index) i: u32) -> VSOut {+ var corners = array<vec2f, 3>(vec2f(0.0, 0.75), vec2f(-0.8, -0.6), vec2f(0.8, -0.6));+ var out: VSOut;+ out.position = vec4f(corners[i], 0.0, 1.0);+ out.local = corners[i];+ return out;+ }++ @fragment+ fn fs(in: VSOut) -> @location(0) vec4f {+ // cosine palette; each corner leads the cycle by a different phase+ let phase = in.local.x * 1.5 + in.local.y;+ let rgb = 0.5 + 0.5 * cos(time + phase + vec3f(0.0, 2.094, 4.188));+ return vec4f(rgb, 1.0);+ }+`;++type Gpu = {+ device: GPUDevice;+ context: GPUCanvasContext;+ pipeline: GPURenderPipeline;+ uniforms: GPUBuffer;+ bindGroup: GPUBindGroup;+};++export default function WebgpuTriangle() {+ const { time } = useTicker();+ const [gpu, setGpu] = createSignal<Gpu>();++ const setup = async (el: HTMLCanvasElement) => {+ const adapter = await navigator.gpu?.requestAdapter();+ if (!adapter) throw new Error("WebGPU is not available");+ const device = await adapter.requestDevice();++ const context = el.getContext("webgpu");+ if (!context) throw new Error("No webgpu context on the surface canvas");+ const format = navigator.gpu.getPreferredCanvasFormat();+ context.configure({ device, format, alphaMode: "premultiplied" });++ const module = device.createShaderModule({ code: SHADER });+ const pipeline = device.createRenderPipeline({+ layout: "auto",+ vertex: { module, entryPoint: "vs" },+ fragment: { module, entryPoint: "fs", targets: [{ format }] },+ });++ const uniforms = device.createBuffer({+ size: 16,+ usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,+ });+ const bindGroup = device.createBindGroup({+ layout: pipeline.getBindGroupLayout(0),+ entries: [{ binding: 0, resource: { buffer: uniforms } }],+ });++ setGpu({ device, context, pipeline, uniforms, bindGroup });+ };++ createEffect(() => {+ const g = gpu();+ const t = time();+ if (!g) return;++ g.device.queue.writeBuffer(g.uniforms, 0, new Float32Array([t]));++ const encoder = g.device.createCommandEncoder();+ const pass = encoder.beginRenderPass({+ colorAttachments: [+ {+ view: g.context.getCurrentTexture().createView(),+ clearValue: { r: 0.04, g: 0.05, b: 0.08, a: 1 },+ loadOp: "clear",+ storeOp: "store",+ },+ ],+ });+ pass.setPipeline(g.pipeline);+ pass.setBindGroup(0, g.bindGroup);+ pass.draw(3);+ pass.end();+ g.device.queue.submit([encoder.finish()]);+ });++ onCleanup(() => gpu()?.device.destroy());++ return (+ <scene key="example-webgpu" name="WebGPU triangle" width={960} height={540} fill="#0b0d12">+ <surface x={0} y={0} width={960} height={540} ref={setup} />+ </scene>+ );+}diff --git a/examples/README.md b/examples/README.mdnew file mode 100644index 00000000..9fcff965--- /dev/null+++ b/examples/README.md@@ -0,0 +1,22 @@+# Examples++Self-contained compositions demonstrating the JSX API (see [reference/jsx](../reference/jsx/README.md)).+Run from the repo root with the editor open (`dapi open`). Each root scene carries a stable+key, so re-mounting an example replaces its scene in place.++| Example | Command | Shows |+| --- | --- | --- |+| [01-basics.tsx](01-basics.tsx) | `dapi mount examples/01-basics.tsx` | `<scene>`, `<sequence>` with a dissolve, `<video>`, `<audio>`, `<image>`, `<text>` titles from data via `<For>` |+| [02-genai.tsx](02-genai.tsx) | `dapi mount examples/02-genai.tsx` | multi-stage generation: `generate.image` refs feeding `generate.video`, TTS voiceover, generated ambience, `<captions>` |+| [03-ticker.tsx](03-ticker.tsx) | `dapi mount examples/03-ticker.tsx` | declarative animation: `useTicker` + `createMemo` derived values driving props |+| [04-html-in-canvas.tsx](04-html-in-canvas.tsx) | `dapi mount examples/04-html-in-canvas.tsx` | `<html>`: an AI prompt box as real DOM, typed out from the playhead |+| [05-anime-timeline.tsx](05-anime-timeline.tsx) | `dapi mount examples/05-anime-timeline.tsx` | anime.js timeline seeked from `useTicker`, driving an ECS node and `<html>` content in lockstep |+| [06-three.tsx](06-three.tsx) | `dapi mount examples/06-three.tsx` | three.js WebGL renderer owning a `<surface>`, glTF model loaded over the network |+| [07-webgpu.tsx](07-webgpu.tsx) | `dapi mount examples/07-webgpu.tsx` | raw WebGPU on a `<surface>`: a triangle whose colors cycle with composition time |++Requirements: `02-genai.tsx` consumes generation credits (results are cached per session);+`04-html-in-canvas.tsx` and `05-anime-timeline.tsx` need Chromium's html-in-canvas API+(`chrome://flags/#canvas-draw-element`); `07-webgpu.tsx` needs WebGPU; `01-basics.tsx` and+`06-three.tsx` fetch remote media.++Typecheck with `tsc -p examples --noEmit` (part of `npm run check`).diff --git a/samples/tsconfig.json b/examples/tsconfig.jsonsimilarity index 77%rename from samples/tsconfig.jsonrename to examples/tsconfig.jsonindex 3d6c076a..bbcb6f5a 100644--- a/samples/tsconfig.json+++ b/examples/tsconfig.json@@ -4,7 +4,7 @@"jsx": "preserve","jsxImportSource": "@diffusionstudio/jsx","lib": ["ES2024", "DOM", "DOM.Iterable"],- "types": []+ "types": ["@webgpu/types"]},- "include": ["reconciler"]+ "include": ["*.tsx"]}diff --git a/package.json b/package.jsonindex 16dbb2f6..c76276c4 100644--- a/package.json+++ b/package.json@@ -15,6 +15,6 @@"make": "npm run make --workspace=@diffusionstudio/desktop","release": "node scripts/release.mjs","lint": "npm run lint --workspaces --if-present",- "check": "npm run check --workspaces --if-present && tsc -p samples --noEmit"+ "check": "npm run check --workspaces --if-present && tsc -p examples --noEmit"}}diff --git a/apps/cli/reference/README.md b/reference/README.mdsimilarity index 100%rename from apps/cli/reference/README.mdrename to reference/README.mddiff --git a/apps/cli/reference/asset/add.md b/reference/asset/add.mdsimilarity index 100%rename from apps/cli/reference/asset/add.mdrename to reference/asset/add.mddiff --git a/apps/cli/reference/asset/export.md b/reference/asset/export.mdsimilarity index 100%rename from apps/cli/reference/asset/export.mdrename to reference/asset/export.mddiff --git a/apps/cli/reference/asset/ls.md b/reference/asset/ls.mdsimilarity index 100%rename from apps/cli/reference/asset/ls.mdrename to reference/asset/ls.mddiff --git a/apps/cli/reference/asset/mv.md b/reference/asset/mv.mdsimilarity index 100%rename from apps/cli/reference/asset/mv.mdrename to reference/asset/mv.mddiff --git a/apps/cli/reference/asset/rm.md b/reference/asset/rm.mdsimilarity index 100%rename from apps/cli/reference/asset/rm.mdrename to reference/asset/rm.mddiff --git a/apps/cli/reference/asset/tree.md b/reference/asset/tree.mdsimilarity index 100%rename from apps/cli/reference/asset/tree.mdrename to reference/asset/tree.mddiff --git a/apps/cli/reference/context.md b/reference/context.mdsimilarity index 100%rename from apps/cli/reference/context.mdrename to reference/context.mddiff --git a/apps/cli/reference/fetch.md b/reference/fetch.mdsimilarity index 100%rename from apps/cli/reference/fetch.mdrename to reference/fetch.mddiff --git a/apps/cli/reference/folder/create.md b/reference/folder/create.mdsimilarity index 100%rename from apps/cli/reference/folder/create.mdrename to reference/folder/create.mddiff --git a/apps/cli/reference/folder/ls.md b/reference/folder/ls.mdsimilarity index 100%rename from apps/cli/reference/folder/ls.mdrename to reference/folder/ls.mddiff --git a/apps/cli/reference/folder/mv.md b/reference/folder/mv.mdsimilarity index 100%rename from apps/cli/reference/folder/mv.mdrename to reference/folder/mv.mddiff --git a/apps/cli/reference/folder/rename.md b/reference/folder/rename.mdsimilarity index 100%rename from apps/cli/reference/folder/rename.mdrename to reference/folder/rename.mddiff --git a/apps/cli/reference/folder/rm.md b/reference/folder/rm.mdsimilarity index 100%rename from apps/cli/reference/folder/rm.mdrename to reference/folder/rm.mddiff --git a/apps/cli/reference/fonts.md b/reference/fonts.mdsimilarity index 100%rename from apps/cli/reference/fonts.mdrename to reference/fonts.mddiff --git a/apps/cli/reference/jsx/README.md b/reference/jsx/README.mdsimilarity index 100%rename from apps/cli/reference/jsx/README.mdrename to reference/jsx/README.mddiff --git a/apps/cli/reference/jsx/animations.md b/reference/jsx/animations.mdsimilarity index 100%rename from apps/cli/reference/jsx/animations.mdrename to reference/jsx/animations.mddiff --git a/apps/cli/reference/jsx/audio-sync.md b/reference/jsx/audio-sync.mdsimilarity index 100%rename from apps/cli/reference/jsx/audio-sync.mdrename to reference/jsx/audio-sync.mddiff --git a/apps/cli/reference/jsx/audio.md b/reference/jsx/audio.mdsimilarity index 100%rename from apps/cli/reference/jsx/audio.mdrename to reference/jsx/audio.mddiff --git a/apps/cli/reference/jsx/captions.md b/reference/jsx/captions.mdsimilarity index 100%rename from apps/cli/reference/jsx/captions.mdrename to reference/jsx/captions.mddiff --git a/apps/cli/reference/jsx/elements.md b/reference/jsx/elements.mdsimilarity index 100%rename from apps/cli/reference/jsx/elements.mdrename to reference/jsx/elements.mddiff --git a/apps/cli/reference/jsx/errors.md b/reference/jsx/errors.mdsimilarity index 100%rename from apps/cli/reference/jsx/errors.mdrename to reference/jsx/errors.mddiff --git a/apps/cli/reference/jsx/generate.md b/reference/jsx/generate.mdsimilarity index 100%rename from apps/cli/reference/jsx/generate.mdrename to reference/jsx/generate.mddiff --git a/apps/cli/reference/jsx/group.md b/reference/jsx/group.mdsimilarity index 100%rename from apps/cli/reference/jsx/group.mdrename to reference/jsx/group.mddiff --git a/apps/cli/reference/jsx/html-paint.md b/reference/jsx/html-paint.mdsimilarity index 100%rename from apps/cli/reference/jsx/html-paint.mdrename to reference/jsx/html-paint.mddiff --git a/apps/cli/reference/jsx/image.md b/reference/jsx/image.mdsimilarity index 100%rename from apps/cli/reference/jsx/image.mdrename to reference/jsx/image.mddiff --git a/apps/cli/reference/jsx/keyframes.md b/reference/jsx/keyframes.mdsimilarity index 100%rename from apps/cli/reference/jsx/keyframes.mdrename to reference/jsx/keyframes.mddiff --git a/apps/cli/reference/jsx/lifecycle.md b/reference/jsx/lifecycle.mdsimilarity index 100%rename from apps/cli/reference/jsx/lifecycle.mdrename to reference/jsx/lifecycle.mddiff --git a/apps/cli/reference/jsx/media.md b/reference/jsx/media.mdsimilarity index 100%rename from apps/cli/reference/jsx/media.mdrename to reference/jsx/media.mddiff --git a/apps/cli/reference/jsx/module.md b/reference/jsx/module.mdsimilarity index 100%rename from apps/cli/reference/jsx/module.mdrename to reference/jsx/module.mddiff --git a/apps/cli/reference/jsx/paints.md b/reference/jsx/paints.mdsimilarity index 100%rename from apps/cli/reference/jsx/paints.mdrename to reference/jsx/paints.mddiff --git a/apps/cli/reference/jsx/rect.md b/reference/jsx/rect.mdsimilarity index 100%rename from apps/cli/reference/jsx/rect.mdrename to reference/jsx/rect.mddiff --git a/apps/cli/reference/jsx/roots.md b/reference/jsx/roots.mdsimilarity index 100%rename from apps/cli/reference/jsx/roots.mdrename to reference/jsx/roots.mddiff --git a/apps/cli/reference/jsx/scene.md b/reference/jsx/scene.mdsimilarity index 100%rename from apps/cli/reference/jsx/scene.mdrename to reference/jsx/scene.mddiff --git a/apps/cli/reference/jsx/sequences.md b/reference/jsx/sequences.mdsimilarity index 100%rename from apps/cli/reference/jsx/sequences.mdrename to reference/jsx/sequences.mddiff --git a/apps/cli/reference/jsx/surface-paint.md b/reference/jsx/surface-paint.mdsimilarity index 100%rename from apps/cli/reference/jsx/surface-paint.mdrename to reference/jsx/surface-paint.mddiff --git a/apps/cli/reference/jsx/text.md b/reference/jsx/text.mdsimilarity index 100%rename from apps/cli/reference/jsx/text.mdrename to reference/jsx/text.mddiff --git a/apps/cli/reference/jsx/timing.md b/reference/jsx/timing.mdsimilarity index 100%rename from apps/cli/reference/jsx/timing.mdrename to reference/jsx/timing.mddiff --git a/apps/cli/reference/jsx/transitions.md b/reference/jsx/transitions.mdsimilarity index 100%rename from apps/cli/reference/jsx/transitions.mdrename to reference/jsx/transitions.mddiff --git a/apps/cli/reference/jsx/video.md b/reference/jsx/video.mdsimilarity index 100%rename from apps/cli/reference/jsx/video.mdrename to reference/jsx/video.mddiff --git a/apps/cli/reference/logs.md b/reference/logs.mdsimilarity index 100%rename from apps/cli/reference/logs.mdrename to reference/logs.mddiff --git a/apps/cli/reference/media/filmstrip.md b/reference/media/filmstrip.mdsimilarity index 100%rename from apps/cli/reference/media/filmstrip.mdrename to reference/media/filmstrip.mddiff --git a/apps/cli/reference/media/grab.md b/reference/media/grab.mdsimilarity index 100%rename from apps/cli/reference/media/grab.mdrename to reference/media/grab.mddiff --git a/apps/cli/reference/media/listen.md b/reference/media/listen.mdsimilarity index 100%rename from apps/cli/reference/media/listen.mdrename to reference/media/listen.mddiff --git a/apps/cli/reference/media/probe.md b/reference/media/probe.mdsimilarity index 100%rename from apps/cli/reference/media/probe.mdrename to reference/media/probe.mddiff --git a/apps/cli/reference/media/transcribe.md b/reference/media/transcribe.mdsimilarity index 100%rename from apps/cli/reference/media/transcribe.mdrename to reference/media/transcribe.mddiff --git a/apps/cli/reference/media/waveform.md b/reference/media/waveform.mdsimilarity index 100%rename from apps/cli/reference/media/waveform.mdrename to reference/media/waveform.mddiff --git a/apps/cli/reference/models.md b/reference/models.mdsimilarity index 100%rename from apps/cli/reference/models.mdrename to reference/models.mddiff --git a/apps/cli/reference/mount.md b/reference/mount.mdsimilarity index 100%rename from apps/cli/reference/mount.mdrename to reference/mount.mddiff --git a/apps/cli/reference/node/capture.md b/reference/node/capture.mdsimilarity index 100%rename from apps/cli/reference/node/capture.mdrename to reference/node/capture.mddiff --git a/apps/cli/reference/node/cp.md b/reference/node/cp.mdsimilarity index 100%rename from apps/cli/reference/node/cp.mdrename to reference/node/cp.mddiff --git a/apps/cli/reference/node/grep.md b/reference/node/grep.mdsimilarity index 100%rename from apps/cli/reference/node/grep.mdrename to reference/node/grep.mddiff --git a/apps/cli/reference/node/insert.md b/reference/node/insert.mdsimilarity index 100%rename from apps/cli/reference/node/insert.mdrename to reference/node/insert.mddiff --git a/apps/cli/reference/node/ls.md b/reference/node/ls.mdsimilarity index 100%rename from apps/cli/reference/node/ls.mdrename to reference/node/ls.mddiff --git a/apps/cli/reference/node/patch.md b/reference/node/patch.mdsimilarity index 100%rename from apps/cli/reference/node/patch.mdrename to reference/node/patch.mddiff --git a/apps/cli/reference/node/render.md b/reference/node/render.mdsimilarity index 100%rename from apps/cli/reference/node/render.mdrename to reference/node/render.mddiff --git a/apps/cli/reference/node/rm.md b/reference/node/rm.mdsimilarity index 100%rename from apps/cli/reference/node/rm.mdrename to reference/node/rm.mddiff --git a/apps/cli/reference/node/tree.md b/reference/node/tree.mdsimilarity index 100%rename from apps/cli/reference/node/tree.mdrename to reference/node/tree.mddiff --git a/apps/cli/reference/open.md b/reference/open.mdsimilarity index 100%rename from apps/cli/reference/open.mdrename to reference/open.mddiff --git a/apps/cli/reference/project/active.md b/reference/project/active.mdsimilarity index 100%rename from apps/cli/reference/project/active.mdrename to reference/project/active.mddiff --git a/apps/cli/reference/project/create.md b/reference/project/create.mdsimilarity index 100%rename from apps/cli/reference/project/create.mdrename to reference/project/create.mddiff --git a/apps/cli/reference/project/ls.md b/reference/project/ls.mdsimilarity index 100%rename from apps/cli/reference/project/ls.mdrename to reference/project/ls.mddiff --git a/apps/cli/reference/project/rm.md b/reference/project/rm.mdsimilarity index 100%rename from apps/cli/reference/project/rm.mdrename to reference/project/rm.mddiff --git a/apps/cli/reference/project/set.md b/reference/project/set.mdsimilarity index 100%rename from apps/cli/reference/project/set.mdrename to reference/project/set.mddiff --git a/apps/cli/reference/screenshot.md b/reference/screenshot.mdsimilarity index 100%rename from apps/cli/reference/screenshot.mdrename to reference/screenshot.mddiff --git a/apps/cli/reference/selection/focus.md b/reference/selection/focus.mdsimilarity index 100%rename from apps/cli/reference/selection/focus.mdrename to reference/selection/focus.mddiff --git a/apps/cli/reference/selection/ls.md b/reference/selection/ls.mdsimilarity index 100%rename from apps/cli/reference/selection/ls.mdrename to reference/selection/ls.mddiff --git a/apps/cli/reference/selection/set.md b/reference/selection/set.mdsimilarity index 100%rename from apps/cli/reference/selection/set.mdrename to reference/selection/set.mddiff --git a/apps/cli/reference/voices.md b/reference/voices.mdsimilarity index 100%rename from apps/cli/reference/voices.mdrename to reference/voices.mddiff --git a/apps/cli/reference/whoami.md b/reference/whoami.mdsimilarity index 100%rename from apps/cli/reference/whoami.mdrename to reference/whoami.mddiff --git a/samples/reconciler/01-static-tree.tsx b/samples/reconciler/01-static-tree.tsxdeleted file mode 100644index c0ec46ce..00000000--- a/samples/reconciler/01-static-tree.tsx+++ /dev/null@@ -1,41 +0,0 @@-/* @jsxImportSource @diffusionstudio/jsx */-/* Static materialization: a deep tree lands in one mount, fully formed.- *- * dapi mount samples/reconciler/01-static-tree.tsx- *- * Check with `dapi node tree`:- * - nested group with children, props replayed in authored order- * - `fill` prop and explicit paint children coexist (no duplicate paints)- * - multi-segment text renders "sum = 42" (concatenated, not last-wins)- * - timing props land as Delay/Trim ("start: 1s; in: 1s; out: 3s")- * Re-mounting replaces the scene in place (same key, same position).- */--export default () => (- <scene key="sample-static" name="Static tree" width={960} height={540} fill="#101014">- <group x={40} y={40}>- <rect width={200} height={120} cornerRadius={16} fill="#ff4466" />- <rect x={220} width={200} height={120} rotation={8} opacity={0.8}>- <linearGradientPaint>- <colorStop offset={0} color="#22ccff" />- <colorStop offset={1} color="#7744ff" opacity={0.5} />- </linearGradientPaint>- </rect>- </group>-- <text x={40} y={220} fontSize={48} fontFamily="Inter" fontWeight={700}>- sum = {6 * 7}- </text>-- <rect- x={40}- y={320}- width={160}- height={90}- fill="#44dd88"- start={1}- end={3}- animations={[{ type: "fade", phase: "in", duration: 0.5 }]}- />- </scene>-);diff --git a/samples/reconciler/02-live-signals.tsx b/samples/reconciler/02-live-signals.tsxdeleted file mode 100644index 8a2b374f..00000000--- a/samples/reconciler/02-live-signals.tsx+++ /dev/null@@ -1,39 +0,0 @@-/* @jsxImportSource @diffusionstudio/jsx */-/* Live reactivity: post-commit updates flow through the materialized nodes.- *- * dapi mount samples/reconciler/02-live-signals.tsx- *- * Watch the stage:- * - the blue rect slides and recolors (reactive setProperty)- * - the counter text updates in place (replaceText into Chars)- * - the green badge blinks (Show insert/remove; its placeholder text node- * sits under the scene without crashing the ECS side)- * Re-mount without to freeze and dispose the graph.- */--import { Show, createSignal } from "solid-js";--const [n, setN] = createSignal(0);-setInterval(() => setN(n() + 1), 400);--export default () => (- <scene key="sample-live" name="Live signals" width={960} height={540} fill="#101014">- <rect- x={40 + (n() * 24) % 700}- y={60}- width={120}- height={120}- cornerRadius={n() % 2 === 0 ? 8 : 60}- fill={n() % 2 === 0 ? "#2288ff" : "#22ccff"}- />-- <text x={40} y={260} fontSize={64} fontFamily="Inter">- tick {n()}- </text>-- <Show when={n() % 4 < 2}>- <rect x={40} y={380} width={80} height={80} fill="#44dd88" />- <text x={140} y={400} fontSize={36}>on air</text>- </Show>- </scene>-);diff --git a/samples/reconciler/03-live-list.tsx b/samples/reconciler/03-live-list.tsxdeleted file mode 100644index 6117379b..00000000--- a/samples/reconciler/03-live-list.tsx+++ /dev/null@@ -1,42 +0,0 @@-/* @jsxImportSource @diffusionstudio/jsx */-/* Keyed list: <For> reorders, inserts, and removes materialized subtrees.- *- * dapi mount samples/reconciler/03-live-list.tsx- *- * Every 1.2s the first card cycles to the back: Solid MOVES the existing- * nodes (reorder/reparent path, not delete + recreate; entity ids in- * `dapi node tree` stay stable across shuffles). Every 4s card E is- * removed or re-inserted (fresh subtree each time).- */--import { For, createSignal } from "solid-js";--const COLORS: Record<string, string> = {- A: "#ff4466",- B: "#22ccff",- C: "#44dd88",- D: "#ffaa22",- E: "#aa66ff",-};--const [items, setItems] = createSignal(["A", "B", "C", "D"]);--setInterval(() => setItems((prev) => [...prev.slice(1), prev[0]]), 1200);-setInterval(() => {- setItems((prev) => (prev.includes("E") ? prev.filter((x) => x !== "E") : [...prev, "E"]));-}, 4000);--export default () => (- <scene key="sample-list" name="Live list" width={960} height={540} fill="#101014">- <For each={items()}>- {(label, i) => (- <group x={40 + i() * 180} y={180}>- <rect width={150} height={150} cornerRadius={16} fill={COLORS[label]} />- <text x={55} y={45} fontSize={56} fontFamily="Inter" fontWeight={700}>- {label}- </text>- </group>- )}- </For>- </scene>-);diff --git a/samples/reconciler/04-ticker.tsx b/samples/reconciler/04-ticker.tsxdeleted file mode 100644index 0d09f044..00000000--- a/samples/reconciler/04-ticker.tsx+++ /dev/null@@ -1,37 +0,0 @@-/* @jsxImportSource @diffusionstudio/jsx */-/* Timeline clock: useTicker drives props from the scene's playhead.- *- * dapi mount samples/reconciler/04-ticker.tsx- *- * Values only move during playback: press play in the editor. The orange- * rect orbits with the frame, the readout shows time/frame, and the- * "PLAYING" badge exists only while the transport runs.- */--import { Show } from "solid-js";-import { useTicker } from "@diffusionstudio/jsx";--export default () => {- const { time, frame, playing } = useTicker();-- return (- <scene key="sample-ticker" name="Ticker" width={960} height={540} fill="#101014">- <rect- x={420 + Math.round(Math.cos(time() * 2) * 300)}- y={220 + Math.round(Math.sin(time() * 2) * 150)}- width={100}- height={100}- cornerRadius={50}- fill="#ffaa22"- />-- <text x={40} y={40} fontSize={40} fontFamily="Inter">- t = {time().toFixed(2)}s / frame {frame()}- </text>-- <Show when={playing()}>- <text x={40} y={460} fontSize={36} fontWeight={700}>PLAYING</text>- </Show>- </scene>- );-};diff --git a/samples/reconciler/05-html-paint.tsx b/samples/reconciler/05-html-paint.tsxdeleted file mode 100644index d7c9b26f..00000000--- a/samples/reconciler/05-html-paint.tsx+++ /dev/null@@ -1,38 +0,0 @@-/* @jsxImportSource @diffusionstudio/jsx */-/* Environment split: the tag (and, for shared names, its SVG ancestry)- * decides the environment.- *- * dapi mount samples/reconciler/05-html-paint.tsx- *- * Requires the html-in-canvas API (chrome://flags/#canvas-draw-element;- * not available in Electron 35, so use a supporting build): without it the- * mount fails cleanly at <html> materialization.- *- * The left <rect> is an ECS entity. <html> is a node too (a rect carrying an- * html paint), but its children are browser DOM. The names both vocabularies- * share (rect/text/image) resolve lexically: the <rect> inside <svg> below is- * the SVG element, <div> is plain HTML, and the counter text updates- * reactively in the drawn DOM.- */--import { createSignal } from "solid-js";--const [n, setN] = createSignal(0);-setInterval(() => setN(n() + 1), 500);--export default () => (- <scene key="sample-html" name="HTML paint" width={960} height={540} fill="#101014">- <rect x={40} y={120} width={200} height={300} cornerRadius={16} fill="#22ccff" />-- <html x={280} y={60} width={640} height={420}>- <div style={{ color: "white", "font-family": "Inter", "font-size": "28px", padding: "16px" }}>- DOM counter: {n()}- </div>- <svg viewBox="0 0 200 100" width={640} height={320}>- <rect x={10} y={10} width={80} height={50} fill="#ff4466" />- <circle cx={140 + (n() % 3) * 15} cy={35} r={20} fill="#44dd88" />- <path d="M 10 80 H 190" stroke="#ffaa22" stroke-width={4} />- </svg>- </html>- </scene>-);diff --git a/samples/reconciler/07-anime-mini.tsx b/samples/reconciler/07-anime-mini.tsxdeleted file mode 100644index a972a210..00000000--- a/samples/reconciler/07-anime-mini.tsx+++ /dev/null@@ -1,35 +0,0 @@-/* @jsxImportSource @diffusionstudio/jsx */-/* Anime.js timeline scrubbed by the playhead: canvas and DOM in lockstep.- * dapi mount samples/reconciler/07-anime-mini.tsx- */-import { createEffect, createSignal } from "solid-js";-import { createTimeline } from "animejs";-import { useTicker } from "@diffusionstudio/jsx";--const box = { x: 60, spin: 0, pct: 0 };--export default function HtmlInCanvasDemo() {- const { time } = useTicker();- const [v, setV] = createSignal(box, { equals: false });-- const tl = createTimeline({ autoplay: false })- .add(box, { x: 700, pct: 100, duration: 2400, ease: "inOutQuad" })- .add(box, { spin: 360, duration: 900, ease: "outBack" });-- createEffect(() => {- tl.seek((time() * 1000) % tl.duration);- setV(box);- });-- return (- <scene key="sample-anime-mini" name="Anime mini" width={960} height={540} fill="#101014">- <rect x={v().x} y={280} width={140} height={140} rotation={v().spin} cornerRadius={28} fill="#22ccff" />-- <html x={60} y={90} width={840} height={120} name="Live HTML">- <div style="color: white; font-family: Inter; font-size: 60px; font-weight: 700">- Timeline at <span style="color: #22ccff">{Math.round(v().pct)}%</span>- </div>- </html>- </scene>- );-};diff --git a/samples/reconciler/08-surface-paint.tsx b/samples/reconciler/08-surface-paint.tsxdeleted file mode 100644index 2dbbb0d8..00000000--- a/samples/reconciler/08-surface-paint.tsx+++ /dev/null@@ -1,51 +0,0 @@-/* @jsxImportSource @diffusionstudio/jsx */-/* Ref-provided canvas: the <surface> element hands its backing bitmap to the- * ref callback, which owns it from then on.- *- * dapi mount samples/reconciler/08-surface-paint.tsx- *- * The ref runs once at materialization, inside the mount's reactive owner:- * the effect below redraws from a signal and the playhead ticker, and the- * engine samples the bitmap into the node's box every frame. The standalone- * <surfacePaint> on the right stacks over a solid fill inside a plain <rect>.- */--import { createEffect, createSignal } from "solid-js";-import { useTicker } from "@diffusionstudio/jsx";--export default () => {- const { time } = useTicker();- const [canvas, setCanvas] = createSignal<HTMLCanvasElement>();-- createEffect(() => {- const cvs = canvas();- const ctx = cvs?.getContext("2d");- if (!ctx || !cvs) return;- ctx.clearRect(0, 0, cvs.width, cvs.height);- ctx.fillStyle = "#1b1b22";- ctx.fillRect(0, 0, cvs.width, cvs.height);- ctx.beginPath();- ctx.arc(- cvs.width / 2 + Math.cos(time() * 2) * 140,- cvs.height / 2 + Math.sin(time() * 2) * 120,- 40,- 0,- Math.PI * 2,- );- ctx.fillStyle = "#44dd88";- ctx.fill();- });-- return (- <scene key="sample-surface" name="Surface paint" width={960} height={540} fill="#101014">- <surface- x={40}- y={60}- width={520}- height={420}- cornerRadius={16}- ref={setCanvas}- />- </scene>- );-};diff --git a/samples/reconciler/README.md b/samples/reconciler/README.mddeleted file mode 100644index d21bd8e4..00000000--- a/samples/reconciler/README.md+++ /dev/null@@ -1,20 +0,0 @@-# Reconciler samples--Mountable projects exercising the shadow-tree reconciler (`WorldDocument`).-Run from the repo root with the editor open:--| Sample | Command | Exercises |-| --- | --- | --- |-| [01-static-tree.tsx](01-static-tree.tsx) | `dapi mount samples/reconciler/01-static-tree.tsx` | deferred materialization, prop replay, paints, text segments, timing |-| [02-live-signals.tsx](02-live-signals.tsx) | `dapi mount samples/reconciler/02-live-signals.tsx` | reactive props, replaceText, Show insert/remove |-| [03-live-list.tsx](03-live-list.tsx) | `dapi mount samples/reconciler/03-live-list.tsx` | \<For\> moves (reorder without recreate), list insert/remove |-| [04-ticker.tsx](04-ticker.tsx) | `dapi mount samples/reconciler/04-ticker.tsx` | useTicker playhead reactivity (press play) |-| [05-html-paint.tsx](05-html-paint.tsx) | `dapi mount samples/reconciler/05-html-paint.tsx` | DOM/SVG materialization under \<html\>; needs html-in-canvas |-| [06-anime-timeline.tsx](06-anime-timeline.tsx) | `dapi mount samples/reconciler/06-anime-timeline.tsx` | anime.js timeline seeked from useTicker, driving an ECS node and \<html\> content in lockstep |-| [07-anime-mini.tsx](07-anime-mini.tsx) | `dapi mount samples/reconciler/07-anime-mini.tsx` | minimal anime.js + useTicker sync, sized for a social post |-| [08-surface-paint.tsx](08-surface-paint.tsx) | `dapi mount samples/reconciler/08-surface-paint.tsx` | ref-provided canvas: \<surface\> element and \<surfacePaint\> child, effect-driven redraws |-| [09-three-helmet.tsx](09-three-helmet.tsx) | `dapi mount samples/reconciler/09-three-helmet.tsx` | three.js WebGL renderer owning a \<surface\>, glTF model loaded over the network, rotation seeked from useTicker |--Each root scene carries a stable key, so re-mounting a sample replaces its-scene in place. Inspect results with `dapi node tree`; entity ids in sample 03-stay stable across shuffles (moves, not recreates).