The VS Code of video editing, built for agents.
TypeScript
Remove example HTML scene and update documentation references
konstantin-paulus2899573a36c7
diff --git a/examples/09-html-scene.tsx b/examples/09-html-scene.tsxdeleted file mode 100644index 79e2fe6a..00000000--- a/examples/09-html-scene.tsx+++ /dev/null@@ -1,52 +0,0 @@-/* @jsxImportSource @diffusionstudio/jsx */-/* An HTML scene: the mount root is <html>, so the whole frame is one DOM tree- * laid out by the browser (flexbox here), not a box placed inside a scene.- *- * dapi mount examples/09-html-scene.tsx- *- * The `scene` prop promotes any rectangle geometry to a mount root; on <html>- * that means the browser lays the DOM out at the full composition size and the- * result is drawn into the frame (html-in-canvas). Requires Chromium's- * html-in-canvas API (chrome://flags/#canvas-draw-element). The count-up and- * the progress bar derive from the playhead, so they scrub and export- * frame-accurately. Event handlers are dropped: this is painted, not- * interactive.- */--import { createMemo } from "solid-js";-import { useTicker } from "@diffusionstudio/jsx";--const DURATION = 6; // seconds-const TARGET = 128; // final count-up value--export default function HtmlScene() {- const { time } = useTicker();-- const t = createMemo(() => Math.min(time() / DURATION, 1)); // 0..1 clamped- const count = createMemo(() => Math.round(t() * TARGET));-- return (- <html scene="html-scene" name="HTML scene" width={1920} height={1080}>- <div- style={`width:1920px;height:1080px;box-sizing:border-box;- display:flex;flex-direction:column;justify-content:center;gap:48px;- padding:160px;font-family:Inter;color:white;- background:radial-gradient(120% 120% at 20% 0%,#1a2030,#0b0d12);`}- >- <div style="font-size:22px;letter-spacing:6px;opacity:0.5;">DIFFUSION STUDIO</div>-- <div style="display:flex;align-items:baseline;gap:24px;">- <div style="font-size:220px;font-weight:800;line-height:1;">{count()}</div>- <div style="font-size:40px;opacity:0.6;">frames composed</div>- </div>-- <div style="width:100%;height:14px;border-radius:999px;background:#ffffff1a;overflow:hidden;">- <div- style={`width:${(t() * 100).toFixed(2)}%;height:100%;border-radius:999px;- background:linear-gradient(90deg,#7c9cff,#c07cff);`}- />- </div>- </div>- </html>- );-}diff --git a/examples/README.md b/examples/README.mdindex 5a5ece98..e1754002 100644--- a/examples/README.md+++ b/examples/README.md@@ -14,11 +14,8 @@ identity, so re-mounting an example replaces its scene in place.| [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 || [08-shader-paint.tsx](08-shader-paint.tsx) | `dapi mount examples/08-shader-paint.tsx` | `<shaderPaint>` post-processing a `<video>`: WGSL chromatic aberration + vignette, uniforms patchable live |-| [09-html-scene.tsx](09-html-scene.tsx) | `dapi mount examples/09-html-scene.tsx` | an HTML scene: `<html scene=...>` as the mount root, the whole frame laid out as DOM and counting up from the playhead |Requirements: `02-genai.tsx` consumes generation credits (results are cached per session);-`04-html-in-canvas.tsx`, `05-anime-timeline.tsx`, and `09-html-scene.tsx` need Chromium's-html-in-canvas API (`chrome://flags/#canvas-draw-element`); `07-webgpu.tsx` and `08-shader-paint.tsx` need WebGPU;`01-basics.tsx`, `06-three.tsx`, and `08-shader-paint.tsx` fetch remote media.Typecheck with `tsc -p examples --noEmit` (part of `npm run check`).diff --git a/packages/jsx/src/types.ts b/packages/jsx/src/types.tsindex 345da255..554507d6 100644--- a/packages/jsx/src/types.ts+++ b/packages/jsx/src/types.ts@@ -125,10 +125,9 @@ export type PatchProps = {/*** Promotes this element to a scene (mount root), and is the root's stable* identity across mounts: re-mounting replaces the scene carrying the same- * `scene` value, or creates it if absent. Only valid on a rectangle geometry- * (`<rect>`, `<group>`, `<html>`, `<image>`, `<video>`); a scene root cannot- * also carry placement or timing props (`x`/`y`/`start`/`end`/`transition`/- * `animations`) or a separate `key`.+ * `scene` value, or creates it if absent. Only valid on `<rect>`; a scene+ * root cannot also carry placement or timing props (`x`/`y`/`start`/`end`/+ * `transition`/`animations`) or a separate `key`.*/scene?: string;/** Human-readable node name. */diff --git a/reference/jsx/elements.md b/reference/jsx/elements.mdindex 26949068..c99d0cb5 100644--- a/reference/jsx/elements.md+++ b/reference/jsx/elements.md@@ -18,7 +18,7 @@ camelCase composition elements map 1:1 onto internal node types. Lowercase DOM v| [`<html>`](./html.md) | **Geometry with Html paint** | Children are real, reactive HTML drawn into the box by the browser (html-in-canvas, flagged Chromium API). `<htmlPaint>` is the paint child form. || [`<surface>`](./surface-paint.md) | **Geometry with Surface paint** | `ref` hands you a canvas to draw with any context type (2d, webgl, webgpu); sampled every frame. `<surfacePaint>` is the paint child form. |-Any rectangle geometry above (`<rect>`, `<video>`, `<image>`, `<html>`, `<surface>`) becomes a **scene** (the composition root) when given a `scene` identity: it then clips its children to `width`×`height` and is valid only at the document top level. See [scene.md](./scene.md).+A `<rect>` becomes a **scene** (the composition root) when given a `scene` identity: it then clips its children to `width`×`height` and is valid only at the document top level. See [scene.md](./scene.md).User-defined components are ordinary Solid components; they compose the elements above and carry no runtime cost. Only the elements above produce entities.@@ -35,7 +35,7 @@ All visual elements accept:| Prop | Type | Default | Meaning || ---- | ---- | ------- | ------- || `key` | `string` | none | A within-render label so another node can reference this one (e.g. [`syncTo`](./audio-sync.md)); |-| `scene` | `string` | none | Promotes a rectangle geometry to a scene, the only mountable root, and is its identity across mounts (see [scene.md](./scene.md)). |+| `scene` | `string` | none | Promotes a `<rect>` to a scene, the only mountable root, and is its identity across mounts (see [scene.md](./scene.md)). || `name` | `string` | none | Human-readable node name. || `x`, `y` | `Animatable<number>` | `0` | Position relative to the parent, px. || `offsetX`, `offsetY` | `Animatable<number>` | `0` | Render-time translation on top of `x`/`y`, px; moves the drawn content without changing the layout box. Subpixel values are kept. |diff --git a/reference/jsx/roots.md b/reference/jsx/roots.mdindex 9a3c6a08..fb14827f 100644--- a/reference/jsx/roots.md+++ b/reference/jsx/roots.md@@ -1,6 +1,6 @@# Roots-A mount renders one or more root elements (a fragment of roots is allowed) and **refreshes the document**: like reloading a webpage, re-running a mount rebuilds its roots in place instead of accumulating copies; a rendered root with no existing node to replace is created. **Only a [scene](./scene.md) is mountable as a root** (a rectangle geometry promoted with the `scene` property); every top-level element declares its identity with `scene`.+A mount renders one or more root elements (a fragment of roots is allowed) and **refreshes the document**: like reloading a webpage, re-running a mount rebuilds its roots in place instead of accumulating copies; a rendered root with no existing node to replace is created. **Only a [scene](./scene.md) is mountable as a root** (a `<rect>` promoted with the `scene` property); every top-level element declares its identity with `scene`.| Identity | Contract || -------- | -------- |diff --git a/reference/jsx/scene.md b/reference/jsx/scene.mdindex f4bfe049..65af0bb2 100644--- a/reference/jsx/scene.md+++ b/reference/jsx/scene.md@@ -1,19 +1,12 @@# Scenes (the `scene` property)-A scene is the composition root: it clips its children to `width`×`height`. The **`scene` property promotes a rectangle geometry** (`<rect>`,`<html>`, `<surface>`) to a mount root. The property's value is the scene's identity across mounts. Scenes are valid **only** at the document top level; the first rendered root becomes the active scene (see [roots.md](./roots.md)).+A scene is the composition root: it clips its children to `width`×`height`. The **`scene` property promotes a `<rect>`** to a mount root. The property's value is the scene's identity across mounts. Scenes are valid **only** at the document top level; the first rendered root becomes the active scene (see [roots.md](./roots.md)).```tsx-// A plain scene: a rectangle promoted to the root.+// A scene: a rectangle promoted to the root.<rect scene="intro" name="Intro" fill="black" width={1920} height={1080}>{/* children */}</rect>--// An HTML scene: the whole frame is one DOM tree laid out by the browser.-<html scene="landing" name="Landing" width={1920} height={1080}>- <div style="width:100%;height:100%;display:flex;align-items:center;justify-content:center;">- Hello- </div>-</html>```## The `scene` property@@ -32,5 +25,5 @@ Alongside it a scene uses the ordinary geometry props:## Constraints-- **Rectangle geometry only.** `scene` on a `<text>`, paint, or other non-rectangle element is an error.+- **`<rect>` only.** `scene` on any other element is an error.- **No placement.** A scene root will be auto positioned