Skip to content

The VS Code of video editing, built for agents.

TypeScript

Add `<htmlPaint>` element and related documentation for reactive HTML rendering

konstantin-paulus1582db9862d3
diff --git a/apps/cli/reference/jsx/README.md b/apps/cli/reference/jsx/README.md
index 7f1dfd3b..bc5518ef 100644
--- a/apps/cli/reference/jsx/README.md
+++ b/apps/cli/reference/jsx/README.md
@@ -17,6 +17,7 @@ The pipeline is driven by two commands: [`dapi mount`](../mount.md) renders the
| [elements.md](./elements.md) | Element-to-node mapping, coordinates and sizing, the shared property table |
| [scene.md](./scene.md), [group.md](./group.md), [rect.md](./rect.md), [text.md](./text.md), [video.md](./video.md), [image.md](./image.md), [audio.md](./audio.md) | Per-element props |
| [paints.md](./paints.md) | `<solidPaint>`, gradients, `<colorStop>` |
+| [html-paint.md](./html-paint.md) | `<htmlPaint>`: reactive HTML children drawn into the box |
| [media.md](./media.md) | `src` resolution (paths, URLs, asset ids, `AssetRef`) |
| [timing.md](./timing.md) | `start` / `end` / `sourceIn` / `sourceOut`, time formats |
| [keyframes.md](./keyframes.md) | Keyframe animation and easing |
diff --git a/apps/cli/reference/jsx/elements.md b/apps/cli/reference/jsx/elements.md
index ca0154ca..a55479e6 100644
--- a/apps/cli/reference/jsx/elements.md
+++ b/apps/cli/reference/jsx/elements.md
@@ -16,6 +16,7 @@ Lowercase intrinsic elements map 1:1 onto internal node types:
| [`<solidPaint>`](./paints.md) | **Solid paint** | Paint child. |
| [`<linearGradientPaint>` / `<radialGradientPaint>`](./paints.md) | **Gradient paint** | Paint child; takes `<colorStop>` children. |
| [`<colorStop>`](./paints.md) | **Gradient color stop** | Valid only inside gradient paints. |
+| [`<htmlPaint>`](./html-paint.md) | **Html paint** | Paint child whose children are real, reactive HTML drawn by the browser (html-in-canvas, flagged Chromium API). |
User-defined components are ordinary Solid components; they compose intrinsics and carry no runtime cost. Only intrinsic elements produce entities.
diff --git a/apps/cli/reference/jsx/html-paint.md b/apps/cli/reference/jsx/html-paint.md
new file mode 100644
index 00000000..6b79333f
--- /dev/null
+++ b/apps/cli/reference/jsx/html-paint.md
@@ -0,0 +1,47 @@
+# `<htmlPaint>`
+
+A paint whose children are **real HTML**. The browser lays them out at the parent geometry's box size and the result is drawn into the box via the [html-in-canvas](https://github.com/WICG/html-in-canvas) API. Use it for content that is painful to build from `<rect>` and `<text>`: styled cards, tables, code blocks, flex/grid layouts.
+
+```tsx
+<rect x={40} y={40} width={800} height={120} cornerRadius={24}>
+ <htmlPaint>
+ <div style="display:flex;align-items:center;gap:16px;height:100%;
+ background:#111;color:#fff;font:500 40px Inter;padding:0 32px;">
+ <span style="color:#7c9cff;">01</span> Introduction
+ </div>
+ </htmlPaint>
+</rect>
+```
+
+Inside `<htmlPaint>`, lowercase tags are DOM elements with Solid's own HTML typings, not composition elements (`<audio>` and `<video>` stay the editor's). Composition elements cannot nest inside it, and HTML tags are invalid outside it.
+
+## Reactivity
+
+The children are part of the project's Solid graph: signals in attributes and text update the live DOM, and the drawn content follows on the next frame. With [`dapi mount --live`](../mount.md) the graph stays alive, so `useTicker` or timers can drive the markup:
+
+```tsx
+const [count, setCount] = createSignal(0);
+setInterval(() => setCount((c) => c + 1), 1000);
+
+<rect width={400} height={200}>
+ <htmlPaint>
+ <div style="font:700 96px Inter;color:#fff;">{count()}</div>
+ </htmlPaint>
+</rect>
+```
+
+## Props
+
+| Prop | Type | Default | Meaning |
+| ---- | ---- | ------- | ------- |
+| `opacity` | `Animatable<number>` | `1` | Paint opacity, `0`-`1`. |
+
+Like all paints it stacks with siblings in document order and clips to the parent's box (including `cornerRadius`).
+
+## Requirements and limitations
+
+- Requires Chromium's html-in-canvas API, currently behind `chrome://flags/#canvas-draw-element`. Mounting `<htmlPaint>` fails with an explicit error when the API is unavailable.
+- Markup renders with the page's fonts and full CSS. Event handlers are dropped — the content is painted, not interactive.
+- The content lives only as long as its mount: it is not persisted and does not render in exports yet.
+- CSS animations in the markup play on the wall clock, not the composition playhead. Animate the parent element's props with [keyframes](./keyframes.md) for frame-accurate motion.
+- Cross-origin subresources (e.g. remote images) are excluded from the painted output by the browser's read-back rules; use local assets.
diff --git a/apps/cli/reference/jsx/paints.md b/apps/cli/reference/jsx/paints.md
index 5b7fd825..4d018eef 100644
--- a/apps/cli/reference/jsx/paints.md
+++ b/apps/cli/reference/jsx/paints.md
@@ -19,6 +19,7 @@ Paint elements are valid inside any filled visual element (`<rect>`, `<scene>`,
| `<linearGradientPaint>` | `rotation`, `opacity` | Linear gradient across the parent's box; `rotation` in degrees, `0` = left to right. |
| `<radialGradientPaint>` | `rotation`, `opacity` | Radial gradient centered in the parent's box. |
| `<colorStop>` | `offset` (**required**, `0`-`1`), `color` (**required**), `opacity` | Gradient color stop. Valid only inside gradient paints, which take no other children. |
+| [`<htmlPaint>`](./html-paint.md) | `opacity`, HTML children | Reactive HTML laid out and drawn into the parent's box (flagged Chromium API). |
Colors accept any CSS color; alpha is ignored (use `opacity`). `color`, `opacity`, and `offset` are animatable (see [keyframes.md](./keyframes.md)), so gradients can animate. Paints have no spatial or timing props and cannot be document roots.
diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
index 3d51cefe..4be02df8 100644
--- a/apps/desktop/src/main.ts
+++ b/apps/desktop/src/main.ts
@@ -18,6 +18,8 @@ const AUTH_PROTOCOL = "diffusion";
const MACOS_CORNER_RADIUS = 16;
const MACOS_BACKDROP = { blur: 80, red: 0.07, green: 0.07, blue: 0.07, alpha: 0.9 };
+app.commandLine.appendSwitch("enable-blink-features", "CanvasDrawElement");
+
let setNativeCornerRadius: ((handle: Buffer, radius: number) => void) | null = null;
let setNativeBackdrop:
| ((handle: Buffer, blur: number, r: number, g: number, b: number, a: number) => void)
diff --git a/apps/web/src/components/engine/api/utils.ts b/apps/web/src/components/engine/api/utils.ts
index 2ee8a060..4a99a75d 100644
--- a/apps/web/src/components/engine/api/utils.ts
+++ b/apps/web/src/components/engine/api/utils.ts
@@ -134,7 +134,10 @@ export function disposeDecoders(world: EngineWorld, eid: number): void {
const VideoDecoder = world.components.VideoDecoder;
const SequenceDecoder = world.components.SequenceDecoder;
const AudioDecoder = world.components.AudioDecoder;
+ const HtmlHost = world.components.HtmlHost;
+ HtmlHost[eid]?.dispose();
+ HtmlHost[eid] = null;
ImageDecoder[eid]?.dispose();
ImageDecoder[eid] = null;
VideoDecoder[eid]?.dispose();
diff --git a/apps/web/src/components/engine/components/components.ts b/apps/web/src/components/engine/components/components.ts
index e28253f7..5f15e479 100644
--- a/apps/web/src/components/engine/components/components.ts
+++ b/apps/web/src/components/engine/components/components.ts
@@ -6,6 +6,7 @@ import type { VideoCodec, AudioCodec } from "mediabunny";
import type { ContainerFormat } from "../encode/types";
import type { Token } from "../utils/text";
import type { AudioBus as AudioBusInstance } from "../services/audio-bus";
+import type { HtmlHost as HtmlHostInstance } from "../decoders/html";
import type { ImageDecoder as ImageDecoderInstance } from "../decoders/image";
import type { VideoDecoderInstance } from "../decoders/video";
import type { SequenceDecoder as SequenceDecoderInstance } from "../decoders/sequence";
@@ -359,6 +360,8 @@ export const Cache = {
animations: [] as number[][],
};
+export const HtmlHost = [] as (HtmlHostInstance | null)[];
+
export const ImageDecoder = [] as (ImageDecoderInstance | null)[];
export const VideoDecoder = [] as (VideoDecoderInstance | null)[];
diff --git a/apps/web/src/components/engine/components/constants.ts b/apps/web/src/components/engine/components/constants.ts
index 28991aba..b8551719 100644
--- a/apps/web/src/components/engine/components/constants.ts
+++ b/apps/web/src/components/engine/components/constants.ts
@@ -65,6 +65,7 @@ export enum PaintType {
RADIAL_GRADIENT,
SEQUENCE,
WAVEFORM,
+ HTML,
}
export enum EffectType {
diff --git a/apps/web/src/components/engine/decoders/html.ts b/apps/web/src/components/engine/decoders/html.ts
new file mode 100644
index 00000000..87d6f3d6
--- /dev/null
+++ b/apps/web/src/components/engine/decoders/html.ts
@@ -0,0 +1,108 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+import type { EngineWorld } from '../api/world';
+
+type Ctx2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
+
+// html-in-canvas (https://github.com/WICG/html-in-canvas). Chromium only,
+// behind chrome://flags/#canvas-draw-element; the API surface is still
+// moving, so every touchpoint is typed and isolated here.
+type DrawElementContext = Ctx2D & {
+ drawElementImage(source: Element | unknown, dx: number, dy: number, dw: number, dh: number): DOMMatrix;
+};
+
+type CaptureCanvas = HTMLCanvasElement & {
+ captureElementImage?(element: Element): unknown;
+};
+
+export function isHtmlInCanvasSupported(): boolean {
+ return typeof CanvasRenderingContext2D !== 'undefined'
+ && 'drawElementImage' in CanvasRenderingContext2D.prototype;
+}
+
+// drawElementImage only accepts direct children of a canvas carrying the
+// `layoutsubtree` attribute. Hosts normally live under the visible stage
+// canvas and are drawn directly; this hidden singleton is the fallback
+// parent when the world has no DOM canvas, drawable elsewhere only as an
+// ElementImage snapshot via captureElementImage.
+let layoutCanvas: HTMLCanvasElement | null = null;
+
+function getLayoutCanvas(): HTMLCanvasElement {
+ if (!layoutCanvas) {
+ layoutCanvas = document.createElement('canvas');
+ layoutCanvas.width = 1;
+ layoutCanvas.height = 1;
+ layoutCanvas.style.cssText = 'position:fixed;left:0;top:0;visibility:hidden;pointer-events:none;';
+ document.body.appendChild(layoutCanvas);
+ }
+ return layoutCanvas;
+}
+
+/**
+ * DOM host for one HTML paint: a div child of a layoutsubtree canvas. The
+ * mount document inserts the paint's JSX children into `element` as real,
+ * reactive DOM; the browser lays them out at the parent geometry's box size
+ * and `draw` paints the result each frame.
+ */
+export class HtmlHost {
+ public readonly element: HTMLDivElement;
+ private readonly canvas: HTMLCanvasElement;
+ private disposed = false;
+ private warned = false;
+ private width = -1;
+ private height = -1;
+
+ public constructor(world: EngineWorld) {
+ this.canvas = world.canvas instanceof HTMLCanvasElement ? world.canvas : getLayoutCanvas();
+ this.canvas.toggleAttribute('layoutsubtree', true);
+
+ const el = document.createElement('div');
+ // pointer-events: none — layoutsubtree children participate in hit
+ // testing and would otherwise swallow stage interactions.
+ el.style.cssText = 'position:absolute;left:0;top:0;overflow:hidden;pointer-events:none;';
+ this.canvas.appendChild(el);
+ this.element = el;
+ }
+
+ private setSize(width: number, height: number): void {
+ if (width === this.width && height === this.height) return;
+ this.width = width;
+ this.height = height;
+ this.element.style.width = `${width}px`;
+ this.element.style.height = `${height}px`;
+ }
+
+ public draw(ctx: Ctx2D, width: number, height: number): void {
+ if (this.disposed) return;
+
+ this.setSize(width, height);
+
+ try {
+ if (ctx.canvas === this.canvas) {
+ (ctx as DrawElementContext).drawElementImage(this.element, 0, 0, width, height);
+ } else {
+ const capture = (this.canvas as CaptureCanvas).captureElementImage;
+ if (typeof capture !== 'function') {
+ throw new Error('captureElementImage is not available; cannot draw <htmlPaint> content offscreen');
+ }
+ const image = capture.call(this.canvas, this.element);
+ (ctx as DrawElementContext).drawElementImage(image, 0, 0, width, height);
+ }
+ } catch (e) {
+ // A transient failure (subtree not yet laid out) just skips the
+ // frame; only log once so a permanent one doesn't spam per frame.
+ if (!this.warned) {
+ this.warned = true;
+ console.error('Error drawing <htmlPaint> content', e);
+ }
+ }
+ }
+
+ public dispose(): void {
+ if (this.disposed) return;
+ this.disposed = true;
+ this.element.remove();
+ }
+}
diff --git a/apps/web/src/components/engine/decoders/index.ts b/apps/web/src/components/engine/decoders/index.ts
index eb4a8cc2..30d1f985 100644
--- a/apps/web/src/components/engine/decoders/index.ts
+++ b/apps/web/src/components/engine/decoders/index.ts
@@ -5,6 +5,7 @@
export * from './audio';
export * from './audio-peaks';
export * from './caption';
+export * from './html';
export * from './image';
export * from './sequence';
export * from './time-stretcher';
diff --git a/apps/web/src/components/engine/systems/render.ts b/apps/web/src/components/engine/systems/render.ts
index 1c04f38a..1bac052e 100644
--- a/apps/web/src/components/engine/systems/render.ts
+++ b/apps/web/src/components/engine/systems/render.ts
@@ -357,6 +357,15 @@ export function renderFills(world: EngineWorld, eid: number): void {
ctx.fillStyle = MISSING_ASSET_COLOR;
ctx.fill();
}
+ } else if (c.Paint[fid] === PaintType.HTML) {
+ const host = c.HtmlHost[fid];
+
+ if (host) {
+ ctx.save();
+ ctx.clip();
+ host.draw(ctx, c.Computed.width[eid], c.Computed.height[eid]);
+ ctx.restore();
+ }
} else if (c.Paint[fid] === PaintType.SOLID) {
ctx.fillStyle = colorToHex(c.Computed.color[fid]);
ctx.fill();
diff --git a/apps/web/src/components/sidebar-right/inspector/fill-row.tsx b/apps/web/src/components/sidebar-right/inspector/fill-row.tsx
index 9a65da0e..fe3901e9 100644
--- a/apps/web/src/components/sidebar-right/inspector/fill-row.tsx
+++ b/apps/web/src/components/sidebar-right/inspector/fill-row.tsx
@@ -33,6 +33,7 @@ const FILL_TYPE_LABELS: Record<PaintType, string> = {
[PaintType.LINEAR_GRADIENT]: 'Gradient',
[PaintType.RADIAL_GRADIENT]: 'Gradient',
[PaintType.WAVEFORM]: 'Waveform',
+ [PaintType.HTML]: 'Html',
};
export function FillRow(props: FillRowProps) {
diff --git a/apps/web/src/utils/jsx.ts b/apps/web/src/utils/jsx.ts
index 6929041b..addecee1 100644
--- a/apps/web/src/utils/jsx.ts
+++ b/apps/web/src/utils/jsx.ts
@@ -37,6 +37,7 @@ import {
transcribeScene,
transcriptTrim,
} from "@/components/engine";
+import { HtmlHost, isHtmlInCanvasSupported } from "@/components/engine/decoders/html";
import { resolveTranscript } from "@/components/engine/decoders/caption/utils";
import { ChildOf } from "@/components/engine/components";
import { ASPECT_RATIO_DIMENSIONS, findEmptyPlacement } from "@/utils/genai";
@@ -55,6 +56,7 @@ type DocumentNode = {
sourceIn?: number;
sourceOut?: number;
objectFit?: keyof typeof SCALE_MODE_MAP;
+ host?: HtmlHost;
parent?: DocumentNode;
children?: DocumentNode[];
} | {
@@ -65,6 +67,12 @@ type DocumentNode = {
} | {
kind: "text";
text: string;
+ dom?: Text;
+ parent?: DocumentNode;
+ children?: DocumentNode[];
+} | {
+ kind: "dom";
+ el: Element;
parent?: DocumentNode;
children?: DocumentNode[];
};
@@ -548,8 +556,21 @@ export class WorldDocument implements ProjectDocument<DocumentNode> {
const node: DocumentNode = { kind: "element", eid };
setComponent(world, eid, c.ColorStop, {});
return node;
+ } case "htmlPaint": {
+ assert(
+ isHtmlInCanvasSupported(),
+ "<htmlPaint> requires the html-in-canvas API; enable chrome://flags/#canvas-draw-element",
+ );
+ const eid = createEntity(world);
+ setComponent(world, eid, c.Paint, PaintType.HTML);
+ const host = new HtmlHost(world);
+ addComponent(world, eid, c.HtmlHost, false);
+ c.HtmlHost[eid] = host;
+ return { kind: "element", eid, host };
} default: {
- assert(false, `unknown tag: "${tag}"`);
+ // Any tag outside the editor's vocabulary is HTML: a real DOM
+ // element, valid only inside <htmlPaint> (enforced on insert).
+ return { kind: "dom", el: document.createElement(tag) };
}
}
}
@@ -612,6 +633,11 @@ export class WorldDocument implements ProjectDocument<DocumentNode> {
public replaceText(node: DocumentNode, text: string) {
assert(node.kind === "text", "replaceText target is not a text node");
node.text = text;
+ // Text inside HTML content is backed by a live DOM node.
+ if (node.dom) {
+ node.dom.data = text;
+ return;
+ }
// Already-inserted text (a live mount updating a signal inside <text>)
// must land in the world too; insertNode only writes Chars on insert.
const parent = node.parent;
@@ -625,7 +651,12 @@ export class WorldDocument implements ProjectDocument<DocumentNode> {
}
public setProperty(node: DocumentNode, name: string, value: unknown) {
- if (name === "children" || name === "ref" || value === undefined || node.kind !== "element") return;
+ if (name === "children" || name === "ref" || value === undefined) return;
+ if (node.kind === "dom") {
+ setDomProperty(node.el, name, value);
+ return;
+ }
+ if (node.kind !== "element") return;
this.track(() => this.setPropertyImpl(node, name, value));
}
@@ -996,13 +1027,28 @@ export class WorldDocument implements ProjectDocument<DocumentNode> {
}
}
- public insertNode(parent: DocumentNode, node: DocumentNode) {
- this.track(() => this.insertNodeImpl(parent, node));
+ public insertNode(parent: DocumentNode, node: DocumentNode, anchor?: DocumentNode) {
+ this.track(() => this.insertNodeImpl(parent, node, anchor));
}
- private insertNodeImpl(parent: DocumentNode, node: DocumentNode) {
+ private insertNodeImpl(parent: DocumentNode, node: DocumentNode, anchor?: DocumentNode) {
const c = this.world.components;
- if (parent.kind === "root" && node.kind === "element") {
+
+ // HTML content: the parent is <htmlPaint>'s host or a DOM node within it.
+ const domParent = parent.kind === "dom" ? parent.el
+ : parent.kind === "element" && parent.host ? parent.host.element
+ : null;
+
+ if (domParent !== null && node.kind !== "root") {
+ assert(node.kind !== "element", "composition elements cannot nest inside <htmlPaint>");
+ const el = node.kind === "dom" ? node.el : (node.dom ??= document.createTextNode(node.text));
+ const anchorEl = anchor?.kind === "dom" ? anchor.el
+ : anchor?.kind === "text" ? anchor.dom ?? null
+ : null;
+ domParent.insertBefore(el, anchorEl);
+ } else if (node.kind === "dom") {
+ assert(false, `<${node.el.tagName.toLowerCase()}> is only valid inside <htmlPaint>`);
+ } else if (parent.kind === "root" && node.kind === "element") {
if (parent.eid === undefined) {
assert(hasComponent(this.world, node.eid, c.Geometry), "this element cannot be a document root");
const key = c.Key[node.eid];
@@ -1037,8 +1083,15 @@ export class WorldDocument implements ProjectDocument<DocumentNode> {
appendChild(this.world, node.eid, parent.eid);
}
+ // Re-inserting an attached node moves it (how the renderer reorders),
+ // so detach it from its previous position first.
+ if (node.parent) {
+ node.parent.children = node.parent.children?.filter((child) => child !== node);
+ }
parent.children ??= [];
- parent.children.push(node);
+ const index = anchor !== undefined ? parent.children.indexOf(anchor) : -1;
+ if (index === -1) parent.children.push(node);
+ else parent.children.splice(index, 0, node);
node.parent = parent;
}
@@ -1046,7 +1099,11 @@ export class WorldDocument implements ProjectDocument<DocumentNode> {
const c = this.world.components;
this.track(() => {
- if (parent.kind === "element" && node.kind === "text") {
+ if (node.kind === "dom") {
+ node.el.remove();
+ } else if (node.kind === "text" && node.dom) {
+ node.dom.remove();
+ } else if (parent.kind === "element" && node.kind === "text") {
removeComponent(this.world, parent.eid, c.Chars);
} else if (parent.kind === "element" && node.kind === "element") {
removeChild(this.world, node.eid, parent.eid);
@@ -1123,6 +1180,37 @@ export class WorldDocument implements ProjectDocument<DocumentNode> {
}
+/**
+ * Prop assignment for DOM nodes inside <htmlPaint>: enough of Solid's DOM
+ * conventions (style objects, class, classList, innerHTML) for drawn markup.
+ * Event handlers are dropped — the content is painted, not interactive.
+ */
+function setDomProperty(el: Element, name: string, value: unknown): void {
+ if (typeof value === "function") return;
+
+ if (name === "style") {
+ const style = (el as HTMLElement).style;
+ if (typeof value === "string") style.cssText = value;
+ else if (typeof value === "object" && value !== null) Object.assign(style, value);
+ } else if (name === "class" || name === "className") {
+ el.className = String(value);
+ } else if (name === "classList") {
+ if (typeof value === "object" && value !== null) {
+ for (const [key, on] of Object.entries(value)) {
+ el.classList.toggle(key, !!on);
+ }
+ }
+ } else if (name === "innerHTML") {
+ el.innerHTML = String(value);
+ } else if (name === "textContent") {
+ el.textContent = String(value);
+ } else if (value === false || value === null) {
+ el.removeAttribute(name);
+ } else {
+ el.setAttribute(name, value === true ? "" : String(value));
+ }
+}
+
function placeholderSize(spec: AssetSpecInput): { width: number; height: number } {
if (spec.type === "image" || spec.type === "video") {
return ASPECT_RATIO_DIMENSIONS[spec.aspectRatio ?? "16:9"] ?? { width: 1920, height: 1080 };
diff --git a/packages/jsx/src/index.ts b/packages/jsx/src/index.ts
index f7d1cea8..2df7b90b 100644
--- a/packages/jsx/src/index.ts
+++ b/packages/jsx/src/index.ts
@@ -29,6 +29,7 @@ export type {
Fit,
GradientPaintProps,
GroupProps,
+ HtmlPaintProps,
ImageProps,
Keyframe,
PatchProps,
diff --git a/packages/jsx/src/jsx-runtime.ts b/packages/jsx/src/jsx-runtime.ts
index a32442a8..cfe99f62 100644
--- a/packages/jsx/src/jsx-runtime.ts
+++ b/packages/jsx/src/jsx-runtime.ts
@@ -16,6 +16,7 @@ import type {
ColorStopProps,
GradientPaintProps,
GroupProps,
+ HtmlPaintProps,
ImageProps,
RectProps,
SceneProps,
@@ -25,6 +26,8 @@ import type {
VideoProps,
} from "./types";
+type HtmlElementTags = Omit<SolidJSX.HTMLElementTags, "audio" | "video">;
+
export declare namespace JSX {
// Solid's Element type keeps Solid's control flow (<For>, <Show>, …) and
// user components interoperable with this JSX namespace.
@@ -34,7 +37,7 @@ export declare namespace JSX {
children: unknown;
}
- export interface IntrinsicElements {
+ export interface IntrinsicElements extends HtmlElementTags {
scene: SceneProps;
group: GroupProps;
rect: RectProps;
@@ -48,5 +51,6 @@ export declare namespace JSX {
linearGradientPaint: GradientPaintProps;
radialGradientPaint: GradientPaintProps;
colorStop: ColorStopProps;
+ htmlPaint: HtmlPaintProps;
}
}
diff --git a/packages/jsx/src/types.ts b/packages/jsx/src/types.ts
index 34fac85b..7e85d1f1 100644
--- a/packages/jsx/src/types.ts
+++ b/packages/jsx/src/types.ts
@@ -286,6 +286,15 @@ export type ImageProps = CommonProps &
Required<Pick<PatchProps, "src">> &
Pick<PatchProps, "objectFit">;
+export type HtmlPaintProps = Pick<PatchProps, "opacity"> & {
+ /**
+ * HTML children — real DOM elements laid out by the browser at the parent
+ * geometry's box size and drawn into it (html-in-canvas). Fully reactive:
+ * signals in attributes and text update the drawn content.
+ */
+ children?: SolidJSX.Element;
+};
+
export type AudioProps = TimingProps &
Required<Pick<PatchProps, "src">> &
Pick<PatchProps, "name" | "volume" | "muted" | "syncTo" | "animations">;