Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

slides: the format has a schema — generated from the gate, published at bento.page/schema, named in every file (#488)

nyblnet5bd499713331
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2e505e6d..6a9c5d21 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -654,6 +654,22 @@ jobs:
# configuration — so the generated file is committed and pinned here.
run: node scripts/build-modelkeys.mjs --check
+ - name: Schema is current
+ # schema/slides.json is generated from the gate's tables
+ # (slides/src/schema.ts via scripts/build-schema.mjs) and published at
+ # bento.page/schema/slides.json; a stale file would describe a format
+ # the runtime does not accept, so the committed copy is pinned here.
+ run: node scripts/build-schema.mjs --check
+
+ - name: Document schema rig
+ # one source (file == buildSchema == window.bento.schema()); schema
+ # keys == gate keys per type; the starter deck validates and a typo
+ # does not; $schema is stripped on load and accepted by the 1.1.0 and
+ # main parseDoc (frozen); the URL is never fetched.
+ run: |
+ slides/node_modules/.bin/esbuild scripts/test-slides-schema.ts --bundle --platform=node --format=esm --outfile="$RUNNER_TEMP/test-slides-schema.mjs"
+ node "$RUNNER_TEMP/test-slides-schema.mjs"
+
- name: Document validation rig
# validate() is only useful if it is trusted: the rig proves the starter
# deck and a realistic chart stay silent, and that a deliberately broken
diff --git a/AGENTS.md b/AGENTS.md
index c96864ac..dc5c926d 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -177,6 +177,30 @@ run again. Exit 0 means no finding at or above `--fail-on` (default `error`).
Needs Chrome (`BENTO_CHROME` to point at a binary) and the built shell
(`cd slides && npm run build:single`, or `--shell path`).
+## The document schema
+
+The bento/slides format has a machine-readable schema, generated from the
+runtime's own validation tables (`slides/src/schema.ts` reads what
+`untrusted.ts` accepts; `scripts/build-schema.mjs` prints it; CI fails if
+`schema/slides.json` is stale). One source, reachable four ways:
+
+- **URL** — `https://bento.page/schema/slides.json`, with a version-pinned
+ twin at `schema/slides-<version>.json`. Put
+ `"$schema": "https://bento.page/schema/slides.json"` at the top of a deck
+ you write and any JSON-Schema-aware editor validates it; the runtime strips
+ the key on load and writes it back on save, so every saved deck carries it.
+- **In the file** — the Tooling comment at the top of every `.bento.html`
+ names the URL, and the saved JSON's first key is `$schema`.
+- **`window.bento.schema()`** — the same JSON, built at runtime, for an agent
+ driving the browser (the shell is compressed, so a text reader cannot see
+ the code; use the URL).
+- **`https://bento.page/llms.txt`** — the index: this guide, the schema, the
+ platform invariants, the app.
+
+Which door for which reader: a model that READS the file gets the Tooling
+comment, `$schema` and the URL; a model that DRIVES the app gets `schema()`,
+`validate()`, `measure()` and `loadDoc()`.
+
## Repo layout
```
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 37fe8d83..26ef4af1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,24 @@ pre-1.0.
## [Unreleased]
+- **The format has a schema, and every file says where it is.** A JSON
+ Schema for the bento/slides document is generated from the same tables the
+ app uses to check what it loads, so it cannot describe a deck the app would
+ refuse. It is published at `https://bento.page/schema/slides.json` (and a
+ version-pinned copy beside it), returned by `window.bento.schema()` in a
+ running file, listed in `https://bento.page/llms.txt` for AI agents, and
+ named in the Tooling comment at the top of every deck. A deck that carries
+ `"$schema"` at the top validates in any schema-aware editor; the app ignores
+ the key. Runtime cost: about 2.6 KB in the shell.
+- **A pasted code snippet keeps its code.** The table the app uses to know
+ an element's fields had no entry for the code element, so a pasted or loaded
+ code block kept its box but lost its content, grammar and theme — an empty
+ snippet — and `validate()` did not know its fields. Found while building
+ the schema from that table; fixed.
+- **A saved deck names its schema.** The first key of the saved JSON is now
+ `"$schema": "https://bento.page/schema/slides.json"` — 50 bytes, so a
+ reader with only the file in hand knows the format. Older versions keep the
+ key and write it back unchanged; nothing fetches it.
- **`bento check`: an agent can look at what it wrote.** `node
scripts/bento-check.mjs deck.bento.html` loads the deck in headless Chrome
and prints what the editor would otherwise keep to itself — text that
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index 14f78015..5163d0da 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -6939,3 +6939,46 @@ prepared document. Slides now shares `prepareForSave` across `saveFile`,
`serializeAuto`, and `serializeFile`; the preparation remains copy-on-write so
the live document keeps its assets for undo. `scripts/test-slides-assets.ts`
checks the facade wiring as well as the pure reachability cases.
+
+## 2026-09-15 — The saved deck names its schema
+
+Every deck the app writes now opens with
+`"$schema": "https://bento.page/schema/slides.json"` — the first key of the
+JSON in `#bento-doc`. The schema itself is generated from the runtime's own
+validation tables (`slides/src/schema.ts` reads what `untrusted.ts` accepts
+and what `modelkeys.generated.ts` names; `scripts/build-schema.mjs` prints
+it; CI fails when `schema/slides.json` is stale), so it can never describe a
+deck the app would refuse. It is published at that URL with a version-pinned
+twin, returned by `window.bento.schema()` in a running file, listed in
+`https://bento.page/llms.txt`, and named in the Tooling comment.
+
+**Why a key in the file.** The shell is compressed, so a model that READS a
+`.bento.html` sees only the plaintext: the Tooling comment and the JSON. A
+pointer in the JSON is the one door that travels with the data — through a
+copy, a paste into a chat, a `Copy document JSON`. `window.bento.schema()`
+serves the other reader, an agent driving the browser.
+
+**Additive.** The key is written by `prepareForSave` at serialization only
+and stripped by `parseDoc` on load, so it exists in the bytes on disk and
+nowhere else: not in the live store, the CRDT, a recovery snapshot or a clip.
+The one condition `parseDoc` applies (`format` + a non-empty `slides`) is
+the same in the 1.1.0 release (03280f5) and on main, and neither looks at
+other top-level keys — an older shell keeps the key and writes it back
+unchanged; its `validate()` lists it as an unknown key, a warning. The rig
+holds a frozen copy of that condition. Nothing fetches the URL: the rig
+greps every carrier line for `fetch`/`import`/`href`/`src`, and the load was
+watched in Chrome — zero requests to bento.page.
+
+**Cost.** 50 bytes per saved file, plaintext. The schema machinery in the
+shell is +2,263 B compressed (measured: 756,103 → 758,366), which also
+covers a gap found on the way — the `code` element was missing from the
+model-keys map, so the paste gate dropped every code element and
+`validate()` knew none of its keys.
+
+**Not decided here.** Whether the schema URL should be versioned in the
+pointer itself (`slides-1.1.0.json`). The unpinned URL always describes the
+current release; a deck written by an older shell and read against a newer
+schema only ever gains optional keys, by additivity, so the unpinned form is
+correct for validation and the pinned twins exist for anyone who wants
+exactness.
+
diff --git a/schema/slides-1.1.0.json b/schema/slides-1.1.0.json
new file mode 100644
index 00000000..68974929
--- /dev/null
+++ b/schema/slides-1.1.0.json
@@ -0,0 +1,2379 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://bento.page/schema/slides.json",
+ "title": "bento/slides document",
+ "description": "The #bento-doc JSON of a Bento Slides file, generated from the app's validation tables. Guide: https://bento.page/agents.md",
+ "x-bento-version": "1.1.0",
+ "$ref": "#/$defs/doc",
+ "$defs": {
+ "prop-fx": {
+ "type": "object",
+ "properties": {
+ "ambient": {
+ "type": "string",
+ "enum": [
+ "kenburns"
+ ]
+ },
+ "countUp": {
+ "type": "boolean"
+ },
+ "enter": {
+ "type": "string",
+ "enum": [
+ "fade-up",
+ "fade",
+ "fade-down",
+ "slide-left",
+ "slide-right",
+ "slide-up",
+ "slide-down"
+ ]
+ },
+ "enterDur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 600
+ },
+ "ken": {
+ "type": "object",
+ "properties": {
+ "dir": {
+ "type": "string",
+ "enum": [
+ "drift",
+ "out",
+ "in"
+ ]
+ },
+ "duration": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 3600
+ },
+ "scale": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100
+ }
+ },
+ "additionalProperties": false
+ },
+ "loop": {
+ "type": "object",
+ "properties": {
+ "delay": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 3600
+ },
+ "distance": {
+ "type": "number",
+ "minimum": -100000,
+ "maximum": 100000
+ },
+ "duration": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 3600
+ },
+ "ease": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "path": {
+ "type": "string",
+ "maxLength": 65536,
+ "description": "SVG path data"
+ },
+ "speeds": {
+ "type": "array",
+ "maxItems": 2000,
+ "items": {
+ "type": "number",
+ "minimum": 0.001,
+ "maximum": 1000
+ }
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "dash-march",
+ "motion-path"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type"
+ ]
+ },
+ "order": {
+ "type": "number",
+ "minimum": -10000,
+ "maximum": 10000
+ },
+ "step": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 10000
+ }
+ },
+ "additionalProperties": false
+ },
+ "prop-shadow": {
+ "anyOf": [
+ {
+ "type": "object",
+ "properties": {
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 10000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "x": {
+ "type": "number",
+ "minimum": -10000,
+ "maximum": 10000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -10000,
+ "maximum": 10000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "blur",
+ "color"
+ ]
+ },
+ {
+ "type": "array",
+ "maxItems": 16,
+ "items": {
+ "type": "object",
+ "properties": {
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 10000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "x": {
+ "type": "number",
+ "minimum": -10000,
+ "maximum": 10000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -10000,
+ "maximum": 10000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "blur",
+ "color"
+ ]
+ }
+ }
+ ]
+ },
+ "prop-colorGradient": {
+ "type": "object",
+ "properties": {
+ "angle": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "stops": {
+ "type": "array",
+ "maxItems": 64,
+ "items": {
+ "type": "object",
+ "properties": {
+ "at": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "at",
+ "color"
+ ]
+ }
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "stops"
+ ]
+ },
+ "prop-themeRefs": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "maxProperties": 64,
+ "description": "property path → palette token"
+ },
+ "prop-textStroke": {
+ "type": "object",
+ "properties": {
+ "width": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "fill": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "width",
+ "color"
+ ]
+ },
+ "prop-link": {
+ "type": "string",
+ "maxLength": 4000,
+ "description": "slide id or http(s) URL"
+ },
+ "text": {
+ "type": "object",
+ "properties": {
+ "align": {
+ "type": "string",
+ "enum": [
+ "left",
+ "center",
+ "right"
+ ]
+ },
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "colorGradient": {
+ "$ref": "#/$defs/prop-colorGradient"
+ },
+ "fontFamily": {
+ "type": "string",
+ "maxLength": 300
+ },
+ "fontSize": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 4000
+ },
+ "fontWeight": {
+ "type": "number",
+ "minimum": 1,
+ "maximum": 1000
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "html": {
+ "type": "string",
+ "maxLength": 65536
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "letterSpacing": {
+ "type": "number",
+ "minimum": -1000,
+ "maximum": 1000
+ },
+ "lineHeight": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "placeholder": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "textStroke": {
+ "$ref": "#/$defs/prop-textStroke"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "text"
+ },
+ "valign": {
+ "type": "string",
+ "enum": [
+ "top",
+ "middle",
+ "bottom"
+ ]
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "html"
+ ],
+ "description": "text element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "prop-fillGradient": {
+ "type": "object",
+ "properties": {
+ "angle": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "stops": {
+ "type": "array",
+ "maxItems": 64,
+ "items": {
+ "type": "object",
+ "properties": {
+ "at": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "at",
+ "color"
+ ]
+ }
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "stops"
+ ]
+ },
+ "prop-from": {
+ "type": "object",
+ "properties": {
+ "el": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "side": {
+ "type": "string",
+ "enum": [
+ "auto",
+ "top",
+ "right",
+ "bottom",
+ "left"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "el"
+ ]
+ },
+ "prop-to": {
+ "type": "object",
+ "properties": {
+ "el": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "side": {
+ "type": "string",
+ "enum": [
+ "auto",
+ "top",
+ "right",
+ "bottom",
+ "left"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "el"
+ ]
+ },
+ "shape": {
+ "type": "object",
+ "properties": {
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "d": {
+ "type": "string",
+ "maxLength": 65536,
+ "description": "SVG path data"
+ },
+ "fill": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour or url(#local-id)"
+ },
+ "fillGradient": {
+ "$ref": "#/$defs/prop-fillGradient"
+ },
+ "from": {
+ "$ref": "#/$defs/prop-from"
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "heads": {
+ "type": "number",
+ "minimum": 2,
+ "maximum": 2
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "lineEnd": {
+ "type": "string",
+ "enum": [
+ "none",
+ "arrow",
+ "dot",
+ "bar",
+ "arrow-open",
+ "triangle",
+ "triangle-open",
+ "diamond",
+ "diamond-open",
+ "square",
+ "circle-open"
+ ]
+ },
+ "lineStart": {
+ "type": "string",
+ "enum": [
+ "none",
+ "arrow",
+ "dot",
+ "bar",
+ "arrow-open",
+ "triangle",
+ "triangle-open",
+ "diamond",
+ "diamond-open",
+ "square",
+ "circle-open"
+ ]
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "pathBox": {
+ "type": "array",
+ "minItems": 4,
+ "maxItems": 4,
+ "items": {
+ "type": "number"
+ }
+ },
+ "radius": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100000
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "shape": {
+ "type": "string",
+ "enum": [
+ "rect",
+ "ellipse",
+ "triangle",
+ "arrow",
+ "line",
+ "path"
+ ]
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "stroke": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour or url(#local-id)"
+ },
+ "strokeDash": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 10000
+ },
+ "strokeStyle": {
+ "type": "string",
+ "enum": [
+ "solid",
+ "dashed",
+ "dotted"
+ ]
+ },
+ "strokeWidth": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 10000
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "to": {
+ "$ref": "#/$defs/prop-to"
+ },
+ "type": {
+ "const": "shape"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "shape",
+ "fill"
+ ],
+ "description": "shape element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "prop-crop": {
+ "type": "object",
+ "properties": {
+ "scale": {
+ "type": "number",
+ "minimum": 1,
+ "maximum": 64
+ },
+ "x": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "y": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "x",
+ "y",
+ "scale"
+ ]
+ },
+ "image": {
+ "type": "object",
+ "properties": {
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "crop": {
+ "$ref": "#/$defs/prop-crop"
+ },
+ "fit": {
+ "type": "string",
+ "enum": [
+ "contain",
+ "cover",
+ "fill"
+ ]
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "keepAspectRatio": {
+ "type": "boolean"
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "radius": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100000
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "src": {
+ "type": "string",
+ "maxLength": 33554432,
+ "description": "data: URI, asset:<key> or URL"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "image"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "src"
+ ],
+ "description": "image element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "svg": {
+ "type": "object",
+ "properties": {
+ "asset": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "css": {
+ "type": "string",
+ "maxLength": 131072
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "markup": {
+ "type": "string",
+ "maxLength": 4194304
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "svg"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id"
+ ],
+ "description": "svg element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "prop-source": {
+ "type": "object",
+ "properties": {
+ "tableId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "tableId"
+ ]
+ },
+ "prop-option": {
+ "type": "object",
+ "description": "ECharts-shaped option, plain JSON"
+ },
+ "chart": {
+ "type": "object",
+ "properties": {
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "option": {
+ "$ref": "#/$defs/prop-option"
+ },
+ "preset": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "source": {
+ "$ref": "#/$defs/prop-source"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "chart"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "option"
+ ],
+ "description": "chart element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "prop-style": {
+ "type": "object",
+ "properties": {
+ "borderColor": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "borderWidth": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "cellPadX": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "cellPadY": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "fontFamily": {
+ "type": "string",
+ "maxLength": 300
+ },
+ "fontSize": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 4000
+ },
+ "headerBg": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "headerColor": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "radius": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100000
+ },
+ "zebra": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ }
+ },
+ "additionalProperties": false
+ },
+ "prop-rows": {
+ "type": "array",
+ "maxItems": 2000,
+ "items": {
+ "type": "object",
+ "properties": {
+ "cells": {
+ "type": "array",
+ "maxItems": 200,
+ "items": {
+ "type": "object",
+ "properties": {
+ "align": {
+ "type": "string",
+ "enum": [
+ "left",
+ "center",
+ "right"
+ ]
+ },
+ "bg": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "bold": {
+ "type": "boolean"
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "html": {
+ "type": "string",
+ "maxLength": 65536
+ }
+ },
+ "additionalProperties": false
+ }
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "cells"
+ ]
+ }
+ },
+ "prop-columns": {
+ "type": "array",
+ "maxItems": 200,
+ "items": {
+ "type": "object",
+ "properties": {
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "w"
+ ]
+ }
+ },
+ "table": {
+ "type": "object",
+ "properties": {
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "columns": {
+ "$ref": "#/$defs/prop-columns"
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "header": {
+ "type": "boolean"
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "rows": {
+ "$ref": "#/$defs/prop-rows"
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "style": {
+ "$ref": "#/$defs/prop-style"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "table"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "columns",
+ "rows"
+ ],
+ "description": "table element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "media": {
+ "type": "object",
+ "properties": {
+ "autoplay": {
+ "type": "boolean"
+ },
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "controls": {
+ "type": "boolean"
+ },
+ "fit": {
+ "type": "string",
+ "enum": [
+ "contain",
+ "cover",
+ "fill"
+ ]
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "kind": {
+ "type": "string",
+ "enum": [
+ "video",
+ "audio"
+ ]
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "loop": {
+ "type": "boolean"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "muted": {
+ "type": "boolean"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "poster": {
+ "type": "string",
+ "maxLength": 33554432,
+ "description": "data: URI, asset:<key> or URL"
+ },
+ "radius": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100000
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "src": {
+ "type": "string",
+ "maxLength": 33554432,
+ "description": "data: URI, asset:<key> or URL"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "media"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "kind",
+ "src"
+ ],
+ "description": "media element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "prop-doc": {
+ "anyOf": [
+ {
+ "type": "string",
+ "maxLength": 200
+ },
+ {
+ "type": "object"
+ }
+ ]
+ },
+ "embed": {
+ "type": "object",
+ "properties": {
+ "app": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "doc": {
+ "$ref": "#/$defs/prop-doc"
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "live": {
+ "type": "boolean"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "embed"
+ },
+ "url": {
+ "type": "string",
+ "maxLength": 4000,
+ "pattern": "^https?://"
+ },
+ "view": {
+ "type": "string",
+ "maxLength": 4194304
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id"
+ ],
+ "description": "embed element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "code": {
+ "type": "object",
+ "properties": {
+ "align": {
+ "type": "string",
+ "enum": [
+ "left",
+ "center",
+ "right"
+ ]
+ },
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "content": {
+ "type": "string",
+ "maxLength": 65536
+ },
+ "fontFamily": {
+ "type": "string",
+ "maxLength": 300
+ },
+ "fontSize": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 4000
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "grammarAssetId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "grammarName": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "lineHeight": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeAssetId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeName": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "code"
+ },
+ "valign": {
+ "type": "string",
+ "enum": [
+ "top",
+ "middle",
+ "bottom"
+ ]
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id"
+ ],
+ "description": "code element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "element": {
+ "oneOf": [
+ {
+ "$ref": "#/$defs/text"
+ },
+ {
+ "$ref": "#/$defs/shape"
+ },
+ {
+ "$ref": "#/$defs/image"
+ },
+ {
+ "$ref": "#/$defs/svg"
+ },
+ {
+ "$ref": "#/$defs/chart"
+ },
+ {
+ "$ref": "#/$defs/table"
+ },
+ {
+ "$ref": "#/$defs/media"
+ },
+ {
+ "$ref": "#/$defs/embed"
+ },
+ {
+ "$ref": "#/$defs/code"
+ }
+ ]
+ },
+ "slide": {
+ "type": "object",
+ "properties": {
+ "background": {
+ "type": "string",
+ "maxLength": 200,
+ "description": "CSS colour; no url()"
+ },
+ "comments": {
+ "type": "array",
+ "maxItems": 500,
+ "items": {
+ "type": "object",
+ "properties": {
+ "at": {
+ "type": "string",
+ "maxLength": 200
+ },
+ "author": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "elementId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "replies": {
+ "type": "array",
+ "maxItems": 500,
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "author": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "text": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "at": {
+ "type": "string",
+ "maxLength": 200
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "resolved": {
+ "type": "boolean"
+ },
+ "text": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "elements": {
+ "type": "array",
+ "maxItems": 5000,
+ "items": {
+ "$ref": "#/$defs/element"
+ }
+ },
+ "hidden": {
+ "type": "boolean"
+ },
+ "hover": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "focus-group",
+ "reveal"
+ ]
+ },
+ "dim": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "default": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type"
+ ]
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "name": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "notes": {
+ "type": "string",
+ "maxLength": 65536
+ },
+ "stateOf": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeRefs": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "maxProperties": 64,
+ "description": "property path → palette token"
+ },
+ "transition": {
+ "type": "string",
+ "enum": [
+ "none",
+ "fade",
+ "slide",
+ "zoom",
+ "morph"
+ ]
+ },
+ "unnumbered": {
+ "type": "boolean"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "id"
+ ],
+ "description": "stateOf = hidden variant reached by a link; transition morph pairs same-id elements"
+ },
+ "tableStyle": {
+ "type": "object",
+ "properties": {
+ "borderColor": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "borderWidth": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "cellPadX": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "cellPadY": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "fontFamily": {
+ "type": "string",
+ "maxLength": 300
+ },
+ "fontSize": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 4000
+ },
+ "headerBg": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "headerColor": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "radius": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100000
+ },
+ "zebra": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ }
+ },
+ "additionalProperties": false
+ },
+ "theme": {
+ "type": "object",
+ "properties": {
+ "accent": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "accent colour"
+ },
+ "background": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "slide background"
+ },
+ "chartPalette": {
+ "type": "array",
+ "maxItems": 64,
+ "items": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "series colour"
+ }
+ },
+ "codePalette": {
+ "type": "object",
+ "properties": {
+ "a": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "c": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "d": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "f": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "k": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "n": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "p": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "s": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ }
+ },
+ "additionalProperties": false
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "body text colour"
+ },
+ "fontFamily": {
+ "type": "string",
+ "maxLength": 300,
+ "description": "CSS font-family stack for body text"
+ },
+ "headingFamily": {
+ "type": "string",
+ "maxLength": 300,
+ "description": "display face for headings; absent = fontFamily"
+ },
+ "palette": {
+ "type": "object",
+ "properties": {
+ "accent2": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot accent2"
+ },
+ "accent3": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot accent3"
+ },
+ "accent4": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot accent4"
+ },
+ "accent5": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot accent5"
+ },
+ "accent6": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot accent6"
+ },
+ "bg2": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot bg2"
+ },
+ "folHlink": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot folHlink"
+ },
+ "hlink": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot hlink"
+ },
+ "tx2": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot tx2"
+ }
+ },
+ "additionalProperties": false
+ },
+ "table": {
+ "$ref": "#/$defs/tableStyle"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "background",
+ "color",
+ "accent",
+ "fontFamily"
+ ]
+ },
+ "doc": {
+ "type": "object",
+ "properties": {
+ "assets": {
+ "type": "object",
+ "maxProperties": 2000,
+ "additionalProperties": {
+ "type": "string",
+ "maxLength": 33554432
+ },
+ "description": "key → data: URI or svg, used as asset:<key>"
+ },
+ "blobs": {
+ "type": "object",
+ "description": "runtime-written"
+ },
+ "collab": {
+ "type": "object",
+ "description": "runtime-written credentials; never author"
+ },
+ "docId": {
+ "type": "string",
+ "maxLength": 200,
+ "description": "runtime-minted uuid; omit"
+ },
+ "fonts": {
+ "type": "array",
+ "maxItems": 2000,
+ "items": {
+ "type": "object",
+ "properties": {
+ "asset": {
+ "type": "string",
+ "maxLength": 200,
+ "description": "asset:<key> or builtin:<name>"
+ },
+ "family": {
+ "type": "string",
+ "maxLength": 300
+ },
+ "style": {
+ "type": "string",
+ "maxLength": 64
+ },
+ "weight": {
+ "type": "string",
+ "maxLength": 64
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "family",
+ "asset"
+ ]
+ }
+ },
+ "format": {
+ "const": "bento/slides"
+ },
+ "layouts": {
+ "type": "array",
+ "maxItems": 500,
+ "items": {
+ "$ref": "#/$defs/slide"
+ },
+ "description": "slide templates"
+ },
+ "meta": {
+ "type": "object",
+ "properties": {
+ "author": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "company": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "event": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "keywords": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "subject": {
+ "type": "string",
+ "maxLength": 4000
+ }
+ },
+ "additionalProperties": false
+ },
+ "modified": {
+ "type": "string",
+ "maxLength": 200,
+ "description": "runtime-written"
+ },
+ "present": {
+ "type": "object",
+ "properties": {
+ "controls": {
+ "type": "boolean"
+ },
+ "morphSeconds": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 60
+ },
+ "numberHidden": {
+ "type": "boolean"
+ },
+ "progress": {
+ "type": "boolean"
+ },
+ "slideNumber": {
+ "type": "boolean"
+ }
+ },
+ "additionalProperties": false
+ },
+ "readonly": {
+ "type": "boolean",
+ "description": "presentation package"
+ },
+ "size": {
+ "type": "object",
+ "properties": {
+ "height": {
+ "type": "number",
+ "minimum": 1,
+ "maximum": 100000
+ },
+ "width": {
+ "type": "number",
+ "minimum": 1,
+ "maximum": 100000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "width",
+ "height"
+ ]
+ },
+ "slides": {
+ "type": "array",
+ "minItems": 1,
+ "maxItems": 500,
+ "items": {
+ "$ref": "#/$defs/slide"
+ }
+ },
+ "template": {
+ "type": "boolean"
+ },
+ "theme": {
+ "$ref": "#/$defs/theme"
+ },
+ "title": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "version": {
+ "type": "integer",
+ "minimum": 1,
+ "description": "format version; this shell writes 1"
+ },
+ "$schema": {
+ "type": "string"
+ },
+ "compact": {
+ "const": true,
+ "description": "input only: omitted fields take editor defaults (AGENTS.md)"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "format",
+ "slides"
+ ]
+ }
+ }
+}
diff --git a/schema/slides.json b/schema/slides.json
new file mode 100644
index 00000000..68974929
--- /dev/null
+++ b/schema/slides.json
@@ -0,0 +1,2379 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://bento.page/schema/slides.json",
+ "title": "bento/slides document",
+ "description": "The #bento-doc JSON of a Bento Slides file, generated from the app's validation tables. Guide: https://bento.page/agents.md",
+ "x-bento-version": "1.1.0",
+ "$ref": "#/$defs/doc",
+ "$defs": {
+ "prop-fx": {
+ "type": "object",
+ "properties": {
+ "ambient": {
+ "type": "string",
+ "enum": [
+ "kenburns"
+ ]
+ },
+ "countUp": {
+ "type": "boolean"
+ },
+ "enter": {
+ "type": "string",
+ "enum": [
+ "fade-up",
+ "fade",
+ "fade-down",
+ "slide-left",
+ "slide-right",
+ "slide-up",
+ "slide-down"
+ ]
+ },
+ "enterDur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 600
+ },
+ "ken": {
+ "type": "object",
+ "properties": {
+ "dir": {
+ "type": "string",
+ "enum": [
+ "drift",
+ "out",
+ "in"
+ ]
+ },
+ "duration": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 3600
+ },
+ "scale": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100
+ }
+ },
+ "additionalProperties": false
+ },
+ "loop": {
+ "type": "object",
+ "properties": {
+ "delay": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 3600
+ },
+ "distance": {
+ "type": "number",
+ "minimum": -100000,
+ "maximum": 100000
+ },
+ "duration": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 3600
+ },
+ "ease": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "path": {
+ "type": "string",
+ "maxLength": 65536,
+ "description": "SVG path data"
+ },
+ "speeds": {
+ "type": "array",
+ "maxItems": 2000,
+ "items": {
+ "type": "number",
+ "minimum": 0.001,
+ "maximum": 1000
+ }
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "dash-march",
+ "motion-path"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type"
+ ]
+ },
+ "order": {
+ "type": "number",
+ "minimum": -10000,
+ "maximum": 10000
+ },
+ "step": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 10000
+ }
+ },
+ "additionalProperties": false
+ },
+ "prop-shadow": {
+ "anyOf": [
+ {
+ "type": "object",
+ "properties": {
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 10000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "x": {
+ "type": "number",
+ "minimum": -10000,
+ "maximum": 10000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -10000,
+ "maximum": 10000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "blur",
+ "color"
+ ]
+ },
+ {
+ "type": "array",
+ "maxItems": 16,
+ "items": {
+ "type": "object",
+ "properties": {
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 10000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "x": {
+ "type": "number",
+ "minimum": -10000,
+ "maximum": 10000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -10000,
+ "maximum": 10000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "blur",
+ "color"
+ ]
+ }
+ }
+ ]
+ },
+ "prop-colorGradient": {
+ "type": "object",
+ "properties": {
+ "angle": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "stops": {
+ "type": "array",
+ "maxItems": 64,
+ "items": {
+ "type": "object",
+ "properties": {
+ "at": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "at",
+ "color"
+ ]
+ }
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "stops"
+ ]
+ },
+ "prop-themeRefs": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "maxProperties": 64,
+ "description": "property path → palette token"
+ },
+ "prop-textStroke": {
+ "type": "object",
+ "properties": {
+ "width": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "fill": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "width",
+ "color"
+ ]
+ },
+ "prop-link": {
+ "type": "string",
+ "maxLength": 4000,
+ "description": "slide id or http(s) URL"
+ },
+ "text": {
+ "type": "object",
+ "properties": {
+ "align": {
+ "type": "string",
+ "enum": [
+ "left",
+ "center",
+ "right"
+ ]
+ },
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "colorGradient": {
+ "$ref": "#/$defs/prop-colorGradient"
+ },
+ "fontFamily": {
+ "type": "string",
+ "maxLength": 300
+ },
+ "fontSize": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 4000
+ },
+ "fontWeight": {
+ "type": "number",
+ "minimum": 1,
+ "maximum": 1000
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "html": {
+ "type": "string",
+ "maxLength": 65536
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "letterSpacing": {
+ "type": "number",
+ "minimum": -1000,
+ "maximum": 1000
+ },
+ "lineHeight": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "placeholder": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "textStroke": {
+ "$ref": "#/$defs/prop-textStroke"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "text"
+ },
+ "valign": {
+ "type": "string",
+ "enum": [
+ "top",
+ "middle",
+ "bottom"
+ ]
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "html"
+ ],
+ "description": "text element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "prop-fillGradient": {
+ "type": "object",
+ "properties": {
+ "angle": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "stops": {
+ "type": "array",
+ "maxItems": 64,
+ "items": {
+ "type": "object",
+ "properties": {
+ "at": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "at",
+ "color"
+ ]
+ }
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "stops"
+ ]
+ },
+ "prop-from": {
+ "type": "object",
+ "properties": {
+ "el": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "side": {
+ "type": "string",
+ "enum": [
+ "auto",
+ "top",
+ "right",
+ "bottom",
+ "left"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "el"
+ ]
+ },
+ "prop-to": {
+ "type": "object",
+ "properties": {
+ "el": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "side": {
+ "type": "string",
+ "enum": [
+ "auto",
+ "top",
+ "right",
+ "bottom",
+ "left"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "el"
+ ]
+ },
+ "shape": {
+ "type": "object",
+ "properties": {
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "d": {
+ "type": "string",
+ "maxLength": 65536,
+ "description": "SVG path data"
+ },
+ "fill": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour or url(#local-id)"
+ },
+ "fillGradient": {
+ "$ref": "#/$defs/prop-fillGradient"
+ },
+ "from": {
+ "$ref": "#/$defs/prop-from"
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "heads": {
+ "type": "number",
+ "minimum": 2,
+ "maximum": 2
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "lineEnd": {
+ "type": "string",
+ "enum": [
+ "none",
+ "arrow",
+ "dot",
+ "bar",
+ "arrow-open",
+ "triangle",
+ "triangle-open",
+ "diamond",
+ "diamond-open",
+ "square",
+ "circle-open"
+ ]
+ },
+ "lineStart": {
+ "type": "string",
+ "enum": [
+ "none",
+ "arrow",
+ "dot",
+ "bar",
+ "arrow-open",
+ "triangle",
+ "triangle-open",
+ "diamond",
+ "diamond-open",
+ "square",
+ "circle-open"
+ ]
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "pathBox": {
+ "type": "array",
+ "minItems": 4,
+ "maxItems": 4,
+ "items": {
+ "type": "number"
+ }
+ },
+ "radius": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100000
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "shape": {
+ "type": "string",
+ "enum": [
+ "rect",
+ "ellipse",
+ "triangle",
+ "arrow",
+ "line",
+ "path"
+ ]
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "stroke": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour or url(#local-id)"
+ },
+ "strokeDash": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 10000
+ },
+ "strokeStyle": {
+ "type": "string",
+ "enum": [
+ "solid",
+ "dashed",
+ "dotted"
+ ]
+ },
+ "strokeWidth": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 10000
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "to": {
+ "$ref": "#/$defs/prop-to"
+ },
+ "type": {
+ "const": "shape"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "shape",
+ "fill"
+ ],
+ "description": "shape element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "prop-crop": {
+ "type": "object",
+ "properties": {
+ "scale": {
+ "type": "number",
+ "minimum": 1,
+ "maximum": 64
+ },
+ "x": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "y": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "x",
+ "y",
+ "scale"
+ ]
+ },
+ "image": {
+ "type": "object",
+ "properties": {
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "crop": {
+ "$ref": "#/$defs/prop-crop"
+ },
+ "fit": {
+ "type": "string",
+ "enum": [
+ "contain",
+ "cover",
+ "fill"
+ ]
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "keepAspectRatio": {
+ "type": "boolean"
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "radius": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100000
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "src": {
+ "type": "string",
+ "maxLength": 33554432,
+ "description": "data: URI, asset:<key> or URL"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "image"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "src"
+ ],
+ "description": "image element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "svg": {
+ "type": "object",
+ "properties": {
+ "asset": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "css": {
+ "type": "string",
+ "maxLength": 131072
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "markup": {
+ "type": "string",
+ "maxLength": 4194304
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "svg"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id"
+ ],
+ "description": "svg element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "prop-source": {
+ "type": "object",
+ "properties": {
+ "tableId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "tableId"
+ ]
+ },
+ "prop-option": {
+ "type": "object",
+ "description": "ECharts-shaped option, plain JSON"
+ },
+ "chart": {
+ "type": "object",
+ "properties": {
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "option": {
+ "$ref": "#/$defs/prop-option"
+ },
+ "preset": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "source": {
+ "$ref": "#/$defs/prop-source"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "chart"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "option"
+ ],
+ "description": "chart element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "prop-style": {
+ "type": "object",
+ "properties": {
+ "borderColor": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "borderWidth": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "cellPadX": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "cellPadY": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "fontFamily": {
+ "type": "string",
+ "maxLength": 300
+ },
+ "fontSize": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 4000
+ },
+ "headerBg": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "headerColor": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "radius": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100000
+ },
+ "zebra": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ }
+ },
+ "additionalProperties": false
+ },
+ "prop-rows": {
+ "type": "array",
+ "maxItems": 2000,
+ "items": {
+ "type": "object",
+ "properties": {
+ "cells": {
+ "type": "array",
+ "maxItems": 200,
+ "items": {
+ "type": "object",
+ "properties": {
+ "align": {
+ "type": "string",
+ "enum": [
+ "left",
+ "center",
+ "right"
+ ]
+ },
+ "bg": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "bold": {
+ "type": "boolean"
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "html": {
+ "type": "string",
+ "maxLength": 65536
+ }
+ },
+ "additionalProperties": false
+ }
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "cells"
+ ]
+ }
+ },
+ "prop-columns": {
+ "type": "array",
+ "maxItems": 200,
+ "items": {
+ "type": "object",
+ "properties": {
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "w"
+ ]
+ }
+ },
+ "table": {
+ "type": "object",
+ "properties": {
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "columns": {
+ "$ref": "#/$defs/prop-columns"
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "header": {
+ "type": "boolean"
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "rows": {
+ "$ref": "#/$defs/prop-rows"
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "style": {
+ "$ref": "#/$defs/prop-style"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "table"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "columns",
+ "rows"
+ ],
+ "description": "table element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "media": {
+ "type": "object",
+ "properties": {
+ "autoplay": {
+ "type": "boolean"
+ },
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "controls": {
+ "type": "boolean"
+ },
+ "fit": {
+ "type": "string",
+ "enum": [
+ "contain",
+ "cover",
+ "fill"
+ ]
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "kind": {
+ "type": "string",
+ "enum": [
+ "video",
+ "audio"
+ ]
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "loop": {
+ "type": "boolean"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "muted": {
+ "type": "boolean"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "poster": {
+ "type": "string",
+ "maxLength": 33554432,
+ "description": "data: URI, asset:<key> or URL"
+ },
+ "radius": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100000
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "src": {
+ "type": "string",
+ "maxLength": 33554432,
+ "description": "data: URI, asset:<key> or URL"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "media"
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id",
+ "kind",
+ "src"
+ ],
+ "description": "media element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "prop-doc": {
+ "anyOf": [
+ {
+ "type": "string",
+ "maxLength": 200
+ },
+ {
+ "type": "object"
+ }
+ ]
+ },
+ "embed": {
+ "type": "object",
+ "properties": {
+ "app": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "doc": {
+ "$ref": "#/$defs/prop-doc"
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "live": {
+ "type": "boolean"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "embed"
+ },
+ "url": {
+ "type": "string",
+ "maxLength": 4000,
+ "pattern": "^https?://"
+ },
+ "view": {
+ "type": "string",
+ "maxLength": 4194304
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id"
+ ],
+ "description": "embed element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "code": {
+ "type": "object",
+ "properties": {
+ "align": {
+ "type": "string",
+ "enum": [
+ "left",
+ "center",
+ "right"
+ ]
+ },
+ "backdropFilter": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "blend": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "blur": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "content": {
+ "type": "string",
+ "maxLength": 65536
+ },
+ "fontFamily": {
+ "type": "string",
+ "maxLength": 300
+ },
+ "fontSize": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 4000
+ },
+ "fx": {
+ "$ref": "#/$defs/prop-fx"
+ },
+ "grammarAssetId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "grammarName": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "group": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "groupId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "h": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "lineHeight": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100
+ },
+ "link": {
+ "$ref": "#/$defs/prop-link"
+ },
+ "morphId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "opacity": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "role": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "rotation": {
+ "type": "number",
+ "minimum": -3600,
+ "maximum": 3600
+ },
+ "shadow": {
+ "$ref": "#/$defs/prop-shadow"
+ },
+ "showOnHover": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeAssetId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeName": {
+ "type": "string",
+ "maxLength": 64,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeRefs": {
+ "$ref": "#/$defs/prop-themeRefs"
+ },
+ "type": {
+ "const": "code"
+ },
+ "valign": {
+ "type": "string",
+ "enum": [
+ "top",
+ "middle",
+ "bottom"
+ ]
+ },
+ "w": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "id"
+ ],
+ "description": "code element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs"
+ },
+ "element": {
+ "oneOf": [
+ {
+ "$ref": "#/$defs/text"
+ },
+ {
+ "$ref": "#/$defs/shape"
+ },
+ {
+ "$ref": "#/$defs/image"
+ },
+ {
+ "$ref": "#/$defs/svg"
+ },
+ {
+ "$ref": "#/$defs/chart"
+ },
+ {
+ "$ref": "#/$defs/table"
+ },
+ {
+ "$ref": "#/$defs/media"
+ },
+ {
+ "$ref": "#/$defs/embed"
+ },
+ {
+ "$ref": "#/$defs/code"
+ }
+ ]
+ },
+ "slide": {
+ "type": "object",
+ "properties": {
+ "background": {
+ "type": "string",
+ "maxLength": 200,
+ "description": "CSS colour; no url()"
+ },
+ "comments": {
+ "type": "array",
+ "maxItems": 500,
+ "items": {
+ "type": "object",
+ "properties": {
+ "at": {
+ "type": "string",
+ "maxLength": 200
+ },
+ "author": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "elementId": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "replies": {
+ "type": "array",
+ "maxItems": 500,
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "author": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "text": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "at": {
+ "type": "string",
+ "maxLength": 200
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "resolved": {
+ "type": "boolean"
+ },
+ "text": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "x": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ },
+ "y": {
+ "type": "number",
+ "minimum": -1000000,
+ "maximum": 1000000
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "elements": {
+ "type": "array",
+ "maxItems": 5000,
+ "items": {
+ "$ref": "#/$defs/element"
+ }
+ },
+ "hidden": {
+ "type": "boolean"
+ },
+ "hover": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "focus-group",
+ "reveal"
+ ]
+ },
+ "dim": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "default": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "type"
+ ]
+ },
+ "id": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "name": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "notes": {
+ "type": "string",
+ "maxLength": 65536
+ },
+ "stateOf": {
+ "type": "string",
+ "maxLength": 200,
+ "pattern": "^[^\"'<>{};]*$"
+ },
+ "themeRefs": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "maxProperties": 64,
+ "description": "property path → palette token"
+ },
+ "transition": {
+ "type": "string",
+ "enum": [
+ "none",
+ "fade",
+ "slide",
+ "zoom",
+ "morph"
+ ]
+ },
+ "unnumbered": {
+ "type": "boolean"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "id"
+ ],
+ "description": "stateOf = hidden variant reached by a link; transition morph pairs same-id elements"
+ },
+ "tableStyle": {
+ "type": "object",
+ "properties": {
+ "borderColor": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "borderWidth": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "cellPadX": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "cellPadY": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1000
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "fontFamily": {
+ "type": "string",
+ "maxLength": 300
+ },
+ "fontSize": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 4000
+ },
+ "headerBg": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "headerColor": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ },
+ "radius": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 100000
+ },
+ "zebra": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "CSS colour; no url()"
+ }
+ },
+ "additionalProperties": false
+ },
+ "theme": {
+ "type": "object",
+ "properties": {
+ "accent": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "accent colour"
+ },
+ "background": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "slide background"
+ },
+ "chartPalette": {
+ "type": "array",
+ "maxItems": 64,
+ "items": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "series colour"
+ }
+ },
+ "codePalette": {
+ "type": "object",
+ "properties": {
+ "a": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "c": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "d": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "f": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "k": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "n": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "p": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ },
+ "s": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "token colour"
+ }
+ },
+ "additionalProperties": false
+ },
+ "color": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "body text colour"
+ },
+ "fontFamily": {
+ "type": "string",
+ "maxLength": 300,
+ "description": "CSS font-family stack for body text"
+ },
+ "headingFamily": {
+ "type": "string",
+ "maxLength": 300,
+ "description": "display face for headings; absent = fontFamily"
+ },
+ "palette": {
+ "type": "object",
+ "properties": {
+ "accent2": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot accent2"
+ },
+ "accent3": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot accent3"
+ },
+ "accent4": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot accent4"
+ },
+ "accent5": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot accent5"
+ },
+ "accent6": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot accent6"
+ },
+ "bg2": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot bg2"
+ },
+ "folHlink": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot folHlink"
+ },
+ "hlink": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot hlink"
+ },
+ "tx2": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "brand slot tx2"
+ }
+ },
+ "additionalProperties": false
+ },
+ "table": {
+ "$ref": "#/$defs/tableStyle"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "background",
+ "color",
+ "accent",
+ "fontFamily"
+ ]
+ },
+ "doc": {
+ "type": "object",
+ "properties": {
+ "assets": {
+ "type": "object",
+ "maxProperties": 2000,
+ "additionalProperties": {
+ "type": "string",
+ "maxLength": 33554432
+ },
+ "description": "key → data: URI or svg, used as asset:<key>"
+ },
+ "blobs": {
+ "type": "object",
+ "description": "runtime-written"
+ },
+ "collab": {
+ "type": "object",
+ "description": "runtime-written credentials; never author"
+ },
+ "docId": {
+ "type": "string",
+ "maxLength": 200,
+ "description": "runtime-minted uuid; omit"
+ },
+ "fonts": {
+ "type": "array",
+ "maxItems": 2000,
+ "items": {
+ "type": "object",
+ "properties": {
+ "asset": {
+ "type": "string",
+ "maxLength": 200,
+ "description": "asset:<key> or builtin:<name>"
+ },
+ "family": {
+ "type": "string",
+ "maxLength": 300
+ },
+ "style": {
+ "type": "string",
+ "maxLength": 64
+ },
+ "weight": {
+ "type": "string",
+ "maxLength": 64
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "family",
+ "asset"
+ ]
+ }
+ },
+ "format": {
+ "const": "bento/slides"
+ },
+ "layouts": {
+ "type": "array",
+ "maxItems": 500,
+ "items": {
+ "$ref": "#/$defs/slide"
+ },
+ "description": "slide templates"
+ },
+ "meta": {
+ "type": "object",
+ "properties": {
+ "author": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "company": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "event": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "keywords": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "subject": {
+ "type": "string",
+ "maxLength": 4000
+ }
+ },
+ "additionalProperties": false
+ },
+ "modified": {
+ "type": "string",
+ "maxLength": 200,
+ "description": "runtime-written"
+ },
+ "present": {
+ "type": "object",
+ "properties": {
+ "controls": {
+ "type": "boolean"
+ },
+ "morphSeconds": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 60
+ },
+ "numberHidden": {
+ "type": "boolean"
+ },
+ "progress": {
+ "type": "boolean"
+ },
+ "slideNumber": {
+ "type": "boolean"
+ }
+ },
+ "additionalProperties": false
+ },
+ "readonly": {
+ "type": "boolean",
+ "description": "presentation package"
+ },
+ "size": {
+ "type": "object",
+ "properties": {
+ "height": {
+ "type": "number",
+ "minimum": 1,
+ "maximum": 100000
+ },
+ "width": {
+ "type": "number",
+ "minimum": 1,
+ "maximum": 100000
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "width",
+ "height"
+ ]
+ },
+ "slides": {
+ "type": "array",
+ "minItems": 1,
+ "maxItems": 500,
+ "items": {
+ "$ref": "#/$defs/slide"
+ }
+ },
+ "template": {
+ "type": "boolean"
+ },
+ "theme": {
+ "$ref": "#/$defs/theme"
+ },
+ "title": {
+ "type": "string",
+ "maxLength": 4000
+ },
+ "version": {
+ "type": "integer",
+ "minimum": 1,
+ "description": "format version; this shell writes 1"
+ },
+ "$schema": {
+ "type": "string"
+ },
+ "compact": {
+ "const": true,
+ "description": "input only: omitted fields take editor defaults (AGENTS.md)"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "format",
+ "slides"
+ ]
+ }
+ }
+}
diff --git a/scripts/build-modelkeys.mjs b/scripts/build-modelkeys.mjs
index 144d6c82..2d40b511 100644
--- a/scripts/build-modelkeys.mjs
+++ b/scripts/build-modelkeys.mjs
@@ -74,7 +74,13 @@ function nestedKeys(ownerName, path) {
if (ts.isTypeLiteralNode(t)) return propsOf(t.members)
if (ts.isUnionTypeNode(t)) return t.types.flatMap(collect)
if (ts.isParenthesizedTypeNode(t)) return collect(t.type)
- if (ts.isTypeReferenceNode(t)) return keysOf(t.typeName.getText(src))
+ if (ts.isTypeReferenceNode(t)) {
+ const name = t.typeName.getText(src)
+ // `Array<{…}>` / `Partial<X>` carry their shape in the type argument
+ if ((name === 'Array' || name === 'Partial') && t.typeArguments) return t.typeArguments.flatMap(collect)
+ return keysOf(name)
+ }
+ if (ts.isArrayTypeNode(t)) return collect(t.elementType)
return []
}
return collect(node)
@@ -91,6 +97,7 @@ const ELEMENTS = {
table: 'TableElement',
media: 'MediaElement',
embed: 'EmbedElement', // the embed element (model.ts EmbedElement)
+ code: 'CodeElement', // added with the schema: it was missing, so the gate dropped pasted code elements
}
const tables = {
@@ -110,6 +117,16 @@ const tables = {
tableCell: uniq(keysOf('TableCell')),
gradient: uniq(keysOf('GradientFill')),
imageCrop: uniq(keysOf('ImageCrop')),
+ // the document's own nested objects — the schema (schema.ts) describes the
+ // top level from these, so a field added to the theme reaches the schema
+ // the same way a field added to an element does
+ size: uniq(nestedKeys('BentoDoc', ['size'])),
+ meta: uniq(nestedKeys('BentoDoc', ['meta'])),
+ theme: uniq(nestedKeys('BentoDoc', ['theme'])),
+ themePalette: uniq(nestedKeys('BentoDoc', ['theme', 'palette'])),
+ themeCodePalette: uniq(nestedKeys('BentoDoc', ['theme', 'codePalette'])),
+ present: uniq(nestedKeys('BentoDoc', ['present'])),
+ font: uniq(nestedKeys('BentoDoc', ['fonts'])),
}
const lit = (v, indent = ' ') =>
diff --git a/scripts/build-schema.mjs b/scripts/build-schema.mjs
new file mode 100644
index 00000000..005f1586
--- /dev/null
+++ b/scripts/build-schema.mjs
@@ -0,0 +1,70 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+//
+// Prints the bento/slides JSON Schema (slides/src/schema.ts buildSchema) to
+// schema/slides.json and a version-pinned twin schema/slides-<version>.json.
+//
+// node scripts/build-schema.mjs write the files
+// node scripts/build-schema.mjs --check fail if slides.json is out of date (CI)
+//
+// WHY A FILE AND A FUNCTION. The function is the truth — it reads the gate's
+// own tables, so it cannot describe a format the runtime does not accept. The
+// file is what an agent fetches (https://bento.page/schema/slides.json) and
+// what release.mjs publishes; committing it means a reviewer sees a schema
+// change as a diff, and `--check` means it can never be stale. The same shape
+// as build-modelkeys.mjs, for the same reason.
+//
+// schema.ts pulls in model.ts and the gate, which are not node-importable
+// unbundled (kernel imports with extensions, DOM types) — so it is bundled
+// with esbuild into a temp file first, the way test-validate is in CI.
+
+import { execFileSync } from 'node:child_process'
+import { mkdirSync, readFileSync, writeFileSync, mkdtempSync, rmSync } from 'node:fs'
+import { join, dirname } from 'node:path'
+import { tmpdir } from 'node:os'
+import { fileURLToPath, pathToFileURL } from 'node:url'
+
+const root = join(dirname(fileURLToPath(import.meta.url)), '..')
+const version = JSON.parse(readFileSync(join(root, 'slides/package.json'), 'utf8')).version
+const outDir = join(root, 'schema')
+const OUT = join(outDir, 'slides.json')
+const PINNED = join(outDir, `slides-${version}.json`)
+
+/** Bundle schema.ts and return buildSchema. */
+export async function loadBuildSchema() {
+ const tmp = mkdtempSync(join(tmpdir(), 'bento-schema-'))
+ const entry = join(tmp, 'entry.mjs')
+ execFileSync(join(root, 'slides/node_modules/.bin/esbuild'), [
+ join(root, 'slides/src/schema.ts'), '--bundle', '--platform=node', '--format=esm',
+ `--outfile=${entry}`, '--log-level=error',
+ ])
+ const mod = await import(pathToFileURL(entry).href)
+ rmSync(tmp, { recursive: true, force: true })
+ return mod.buildSchema
+}
+
+/** The canonical text of the schema file for this version. */
+export function schemaText(buildSchema) {
+ return JSON.stringify(buildSchema(version), null, 2) + '\n'
+}
+
+if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
+ const buildSchema = await loadBuildSchema()
+ const body = schemaText(buildSchema)
+ if (process.argv.includes('--check')) {
+ let current = null
+ try { current = readFileSync(OUT, 'utf8') } catch { /* missing = stale */ }
+ if (current !== body) {
+ console.error('schema/slides.json is out of date with slides/src/schema.ts (or the gate / model keys).\nRun: node scripts/build-schema.mjs')
+ process.exit(1)
+ }
+ const parsed = JSON.parse(body)
+ console.log(`schema up to date (${Object.keys(parsed.$defs).length} definitions, bento/slides ${version})`)
+ } else {
+ mkdirSync(outDir, { recursive: true })
+ writeFileSync(OUT, body)
+ writeFileSync(PINNED, body)
+ console.log(`wrote ${OUT} and ${PINNED} (${body.length} B)`)
+ }
+}
diff --git a/scripts/postbuild-compress.mjs b/scripts/postbuild-compress.mjs
index 568a5904..b7aeb670 100644
--- a/scripts/postbuild-compress.mjs
+++ b/scripts/postbuild-compress.mjs
@@ -199,6 +199,7 @@ const SLIDES_TOOLING = `<!--
(open source, https://bento.page) — no user content, leave them alone.
· In a running file, window.bento exposes { doc, serialize(), loadDoc(json),
comments(), updates, i18n }. In the app UI: Save → Copy / Replace JSON.
+ · Schema: https://bento.page/schema/slides.json (= window.bento.schema()); agent index: https://bento.page/llms.txt
MAKE A GREAT DECK, NOT JUST A CORRECT ONE
Bento's whole point is motion + interactivity. A wall of text slides wastes
diff --git a/scripts/release.mjs b/scripts/release.mjs
index a729d9b6..5d5bebb8 100644
--- a/scripts/release.mjs
+++ b/scripts/release.mjs
@@ -363,6 +363,18 @@ if (app.ownsSiteContent) {
mkdirSync(join(site, 'help'), { recursive: true })
cpSync(join(root, 'site-src/help.html'), join(site, 'help/index.html'))
+ // /schema/slides.json (+ the version-pinned twin) and /llms.txt — the
+ // document schema and the agent index, at the URLs every saved deck's
+ // `$schema` key, the Tooling comment and AGENTS.md advertise. The schema
+ // is generated from the gate's tables (scripts/build-schema.mjs, pinned by
+ // CI); pinned twins of earlier versions stay published because the seed
+ // above restores them.
+ mkdirSync(join(site, 'schema'), { recursive: true })
+ for (const f of readdirSync(join(root, 'schema')).filter((f) => f.endsWith('.json'))) {
+ cpSync(join(root, 'schema', f), join(site, 'schema', f))
+ }
+ cpSync(join(root, 'site-src/llms.txt'), join(site, 'llms.txt'))
+
// 404 — of course it's a deck (see build-404-deck.mjs + site-src/404.html).
execFileSync('node', [join(root, 'scripts/build-404-deck.mjs'), join(site, '404.bento.html')], { stdio: 'inherit' })
cpSync(join(root, 'site-src/404.html'), join(site, '404.html'))
diff --git a/scripts/test-gate-parity.ts b/scripts/test-gate-parity.ts
index 0560c63d..4f4bebe8 100644
--- a/scripts/test-gate-parity.ts
+++ b/scripts/test-gate-parity.ts
@@ -139,7 +139,19 @@ const slideCases: Array<[string, unknown]> = [
for (const [n, s] of slideCases) add(`hostile/${n}`, s)
// ---- compare -----------------------------------------------------------------
-const j = (v: unknown) => JSON.stringify(v === undefined ? null : v)
+// ONE deliberate difference from main, excluded here and asserted elsewhere:
+// main's build-modelkeys had no entry for the `code` element, so its gate kept
+// a code block but stripped every code-specific field (content, grammar,
+// theme) — an empty snippet. #488 adds the entry; test-slides-schema asserts a
+// code element's content survives the gate. Parity is asserted for everything
+// else, so a code element is dropped from both sides before comparing.
+const noCode = (v: unknown): unknown => {
+ if (!v || typeof v !== 'object' || Array.isArray(v)) return v
+ const o = v as { elements?: unknown }
+ return Array.isArray(o.elements) ? { ...o, elements: o.elements.filter((e) => !(e && typeof e === 'object' && (e as { type?: unknown }).type === 'code')) } : v
+}
+const isCode = (e: unknown) => !!e && typeof e === 'object' && (e as { type?: unknown }).type === 'code'
+const j = (v: unknown) => JSON.stringify(v === undefined ? null : noCode(v))
let same = 0, elementsCompared = 0
for (const [name, slide] of slides) {
const a = j(branchGate.sanitizeSlide(slide))
@@ -148,6 +160,7 @@ for (const [name, slide] of slides) {
else ok(false, `slide ${name}: branch and main disagree\n branch: ${a.slice(0, 300)}\n main: ${b.slice(0, 300)}`)
const els = (slide as { elements?: unknown }).elements
if (Array.isArray(els)) for (const e of els) {
+ if (isCode(e)) continue
elementsCompared++
const ea = j(branchGate.sanitizeElement(e)), eb = j(mainGate.sanitizeElement(e))
if (ea !== eb) ok(false, `element in ${name}: branch and main disagree\n branch: ${ea.slice(0, 300)}\n main: ${eb.slice(0, 300)}`)
@@ -165,6 +178,7 @@ for (const [name, slide] of slides) {
else ok(false, `slide ${name}: with the collector ON the branch's document differs from main's`)
const els = (slide as { elements?: unknown }).elements
if (Array.isArray(els)) for (const e of els) {
+ if (isCode(e)) continue
elementsOn++
const on = withDropReport(() => branchGate.sanitizeElement(e)).result
if (j(on) !== j(mainGate.sanitizeElement(e))) ok(false, `element in ${name}: with the collector ON the branch's element differs from main's`)
diff --git a/scripts/test-slides-links.ts b/scripts/test-slides-links.ts
index aa66ded1..11ac3438 100644
--- a/scripts/test-slides-links.ts
+++ b/scripts/test-slides-links.ts
@@ -72,7 +72,34 @@ ok(/const link = target\.dataset\.link \?\? ''\s*if \(isWebUrl\(link\)\)/.test(p
ok(/closest\('a\[href\]'\)\) ev\.preventDefault\(\)/.test(read('slides/src/editor/canvas.ts')), 'canvas.ts: a link click in the editor never navigates')
ok(/addEventListener\('auxclick'[\s\S]{0,300}ev\.preventDefault\(\)[\s\S]{0,200}if \(isWebUrl\(href\)\) openWeb\(href\)/.test(present),
'present.ts: a middle-click on an anchor goes through the same door (auxclick would otherwise bypass the offline gate and noreferrer)')
-ok(/link: \(v\) => \(isWebUrl\(v\) \? v : cssValue\(\)\(v\)\)/.test(read('slides/src/untrusted.ts')), 'untrusted.ts: the shape gate accepts a link that is a web URL or a slide id')
+// Behavioural, not a regex over the source: the gate is bundled (it is not
+// node-importable unbundled) and fed a web URL, a slide id and a javascript:
+// URL. #488 wrapped every check in schema metadata and the old source pin
+// broke while the behaviour did not — a pin on the source proves nothing.
+{
+ const { execFileSync } = await import('node:child_process')
+ const { mkdtempSync, writeFileSync, rmSync } = await import('node:fs')
+ const { tmpdir } = await import('node:os')
+ const dir = mkdtempSync(join(tmpdir(), 'links-gate-'))
+ const entry = join(dir, 'probe.ts')
+ writeFileSync(entry, `
+ import { sanitizeElement } from '${join(root, 'slides/src/untrusted.ts').replace(/\\/g, '/')}'
+ const el = (link: string) => ({ id: 'e', type: 'text', x: 0, y: 0, w: 10, h: 10, rotation: 0, opacity: 1, html: 'x', fontSize: 20, link })
+ const out = ['https://example.org/a', 's2', 'javascript:alert(1)', 'data:text/html,x'].map((l) => (sanitizeElement(el(l)) as { link?: string } | null)?.link ?? null)
+ console.log(JSON.stringify(out))
+ `)
+ const bundle = join(dir, 'probe.mjs')
+ execFileSync(join(root, 'slides/node_modules/.bin/esbuild'), [entry, '--bundle', '--platform=node', '--format=esm', '--log-level=error', `--outfile=${bundle}`])
+ const got = JSON.parse(execFileSync(process.execPath, [bundle], { encoding: 'utf8' }).trim()) as (string | null)[]
+ rmSync(dir, { recursive: true, force: true })
+ ok(got[0] === 'https://example.org/a', 'the gate keeps a web link')
+ ok(got[1] === 's2', 'the gate keeps a slide-id link')
+ // A non-web link is a slide id: the gate keeps the string, and present.ts
+ // only ever looks it up as a slide — javascript:/data: are never opened
+ // (asserted on the present side below). What matters here is that the gate
+ // does not turn them into web links.
+ ok(got[2] !== null && !isWebUrl(got[2]) && got[3] !== null && !isWebUrl(got[3]), 'the gate keeps javascript:/data: only as slide-id text, never as a web link')
+}
ok(!/target="_blank"|rel="noopener"/.test(render), 'render.ts stores no target/rel — those are decided at click time, never in the document')
ok(/querySelectorAll<HTMLAnchorElement>\('a\[href\]'\)\)\) a\.rel = 'noopener noreferrer'/.test(present),
'present.ts sets rel at MOUNT on show anchors — the context-menu and drag routes, which bypass the click handler, then send no referrer')
diff --git a/scripts/test-slides-schema.ts b/scripts/test-slides-schema.ts
new file mode 100644
index 00000000..9b01913e
--- /dev/null
+++ b/scripts/test-slides-schema.ts
@@ -0,0 +1,208 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// The bento/slides JSON Schema: built from the gate's tables, published for
+// agents, pinned to the runtime.
+//
+// slides/node_modules/.bin/esbuild scripts/test-slides-schema.ts --bundle --platform=node --format=esm --outfile=/tmp/t.mjs && node /tmp/t.mjs
+//
+// WHAT THIS PROVES. (1) The checked-in schema/slides.json is byte-for-byte
+// what slides/src/schema.ts builds, and window.bento.schema() is that same
+// function — one source. (2) The schema's key set per element type equals the
+// gate's key set: a field taught to the gate and not the schema, or the other
+// way round, fails here. (3) The starter deck (and the gallery fixtures when
+// present) validate against it with a small validator for exactly the subset
+// of JSON Schema the generator emits; a deck with an unknown key does not.
+// (4) `$schema` at the top of a deck is stripped on load, and BOTH the 1.1.0
+// release's parseDoc and main's accept a deck carrying it (frozen copies of
+// their one condition line, sha-noted) — ignored, never rejected — which is
+// what lets save.ts write it. (5) The URL is a pointer, not a beacon: nothing
+// in the runtime fetches, imports or links it.
+
+import { readFileSync, readdirSync, existsSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { dirname, join } from 'node:path'
+import { buildSchema, SCHEMA_URL, stampSchema } from '../slides/src/schema.ts'
+import { starterDoc } from '../slides/src/starterdeck.ts'
+import { parseDoc, FORMAT } from '../slides/src/model.ts'
+import { MODEL_KEYS } from '../slides/src/modelkeys.generated.ts'
+import { CHECKED_KEYS } from '../slides/src/untrusted.ts'
+
+let failures = 0
+let checks = 0
+function ok(cond: boolean, msg: string) {
+ checks++
+ if (!cond) { failures++; console.log(` FAIL ${msg}`) }
+ else console.log(` ok ${msg}`)
+}
+// bundled into a temp file in CI, so the repo root is the cwd, as the other bundled rigs do
+const root = process.cwd()
+const read = (f: string) => readFileSync(join(root, f), 'utf8')
+type J = Record<string, unknown>
+const version = JSON.parse(read('slides/package.json')).version as string
+
+// --- a validator for the subset the generator emits ------------------------
+function validate(schema: J, value: unknown, root: J, path = '$'): string[] {
+ const errs: string[] = []
+ const e = (m: string) => errs.push(`${path}: ${m}`)
+ if (typeof schema.$ref === 'string') {
+ const target = (schema.$ref as string).replace('#/', '').split('/').reduce<unknown>((o, k) => (o as J)?.[k], root) as J
+ if (!target) return [`${path}: dangling $ref ${schema.$ref}`]
+ return validate(target, value, root, path)
+ }
+ if (Array.isArray(schema.anyOf)) {
+ if (!(schema.anyOf as J[]).some((s) => validate(s, value, root, path).length === 0)) e('matches no anyOf branch')
+ return errs
+ }
+ if (Array.isArray(schema.oneOf)) {
+ const branches = schema.oneOf as J[]
+ const n = branches.filter((s) => validate(s, value, root, path).length === 0).length
+ if (n === 1) return errs
+ // the element union is discriminated by `type`: report THAT branch's
+ // errors, so a typo'd key is named rather than "no branch matched"
+ const resolve = (s: J): J => (typeof s.$ref === 'string' ? (s.$ref as string).replace('#/', '').split('/').reduce<unknown>((o, k) => (o as J)?.[k], root) as J : s)
+ const disc = value && typeof value === 'object' ? (value as J).type : undefined
+ const mine = branches.map(resolve).find((s) => ((s.properties as J)?.type as J)?.const === disc)
+ if (mine) errs.push(...validate(mine, value, root, path))
+ else e(`matches ${n} oneOf branches`)
+ return errs
+ }
+ if ('const' in schema && value !== schema.const) e(`expected const ${JSON.stringify(schema.const)}`)
+ if (Array.isArray(schema.enum) && !(schema.enum as unknown[]).includes(value)) e(`not one of ${JSON.stringify(schema.enum)}`)
+ const t = schema.type
+ if (t === 'number' || t === 'integer') {
+ if (typeof value !== 'number' || !Number.isFinite(value)) e('not a number')
+ else {
+ if (t === 'integer' && !Number.isInteger(value)) e('not an integer')
+ if (typeof schema.minimum === 'number' && value < schema.minimum) e(`< ${schema.minimum}`)
+ if (typeof schema.maximum === 'number' && value > schema.maximum) e(`> ${schema.maximum}`)
+ }
+ } else if (t === 'string') {
+ if (typeof value !== 'string') e('not a string')
+ else {
+ if (typeof schema.maxLength === 'number' && value.length > schema.maxLength) e('too long')
+ if (typeof schema.pattern === 'string' && !new RegExp(schema.pattern).test(value)) e(`fails /${schema.pattern}/`)
+ }
+ } else if (t === 'boolean') {
+ if (typeof value !== 'boolean') e('not a boolean')
+ } else if (t === 'array') {
+ if (!Array.isArray(value)) e('not an array')
+ else {
+ if (typeof schema.minItems === 'number' && value.length < schema.minItems) e('too few items')
+ if (typeof schema.maxItems === 'number' && value.length > schema.maxItems) e('too many items')
+ if (schema.items) value.forEach((v, i) => errs.push(...validate(schema.items as J, v, root, `${path}[${i}]`)))
+ }
+ } else if (t === 'object') {
+ if (!value || typeof value !== 'object' || Array.isArray(value)) e('not an object')
+ else {
+ const props = (schema.properties ?? {}) as Record<string, J>
+ for (const k of (schema.required as string[] | undefined) ?? []) if (!(k in (value as J))) e(`missing ${k}`)
+ for (const [k, v] of Object.entries(value as J)) {
+ if (k in props) errs.push(...validate(props[k], v, root, `${path}.${k}`))
+ else if (schema.additionalProperties === false) e(`unknown key ${k}`)
+ else if (schema.additionalProperties && typeof schema.additionalProperties === 'object') errs.push(...validate(schema.additionalProperties as J, v, root, `${path}.${k}`))
+ }
+ if (typeof schema.maxProperties === 'number' && Object.keys(value as J).length > schema.maxProperties) e('too many properties')
+ }
+ }
+ return errs
+}
+const check = (doc: unknown, schema: J) => validate(schema, doc, schema)
+
+console.log('one source\n')
+const built = buildSchema(version)
+const file = JSON.parse(read('schema/slides.json')) as J
+ok(JSON.stringify(built) === JSON.stringify(file), 'schema/slides.json is byte-for-byte what buildSchema(version) returns (build-schema.mjs --check pins it in CI too)')
+ok(file.$id === SCHEMA_URL && file.$id === 'https://bento.page/schema/slides.json', `$id is the published URL (${file.$id})`)
+ok(file['x-bento-version'] === version, `stamped with the shell version ${version}`)
+ok(existsSync(join(root, `schema/slides-${version}.json`)), 'a version-pinned twin exists')
+const mainSrc = read('slides/src/main.ts')
+ok(/schema\(\)\s*\{\s*return buildSchema\(APP_VERSION\)/.test(mainSrc), 'window.bento.schema() is the same function, stamped with the running version')
+
+console.log('\nthe gate and the schema agree\n')
+const defs = file.$defs as Record<string, J>
+for (const type of Object.keys(MODEL_KEYS.element)) {
+ const keys = (MODEL_KEYS.element as Record<string, readonly string[]>)[type]
+ const schemaKeys = Object.keys((defs[type].properties as J)).sort()
+ const gateKeys = keys.filter((k) => CHECKED_KEYS.element.includes(k)).sort()
+ ok(schemaKeys.join() === gateKeys.join(), `${type}: schema keys == gate keys (${schemaKeys.length})`)
+ ok((defs[type].required as string[]).includes('type') && (defs[type].required as string[]).includes('id'), `${type}: type and id required`)
+}
+ok(Object.keys(defs.slide.properties as J).sort().join() === [...MODEL_KEYS.slide].filter((k) => CHECKED_KEYS.slide.includes(k)).sort().join(), 'slide: schema keys == gate keys')
+ok(Object.keys(defs.doc.properties as J).sort().join() === [...MODEL_KEYS.doc, '$schema', 'compact'].sort().join(), 'doc: every model key plus $schema and the compact flag')
+ok(Object.keys(defs.theme.properties as J).sort().join() === [...MODEL_KEYS.theme].sort().join(), 'theme: keys from model.ts (via modelkeys.generated.ts)')
+
+console.log('\nreal decks validate; a typo does not\n')
+const starter = JSON.parse(JSON.stringify(starterDoc()))
+const starterErrs = check(starter, file)
+ok(starterErrs.length === 0, `the starter deck validates (${starterErrs.length} errors${starterErrs.length ? ': ' + starterErrs.slice(0, 3).join('; ') : ''})`)
+const fixtures = join(root, 'scripts/fixtures/compact-decks')
+if (existsSync(fixtures)) {
+ for (const f of readdirSync(fixtures).filter((f) => f.endsWith('.json'))) {
+ const errs = check(JSON.parse(readFileSync(join(fixtures, f), 'utf8')), file)
+ ok(errs.length === 0, `${f} validates (${errs.length}${errs.length ? ': ' + errs.slice(0, 3).join('; ') : ''})`)
+ }
+}
+const typo = JSON.parse(JSON.stringify(starter))
+typo.slides[0].elements[0].fontsize = 12
+ok(check(typo, file).some((m) => /unknown key fontsize/.test(m)), 'an element with `fontsize` (typo) fails with the key named')
+const badEnum = JSON.parse(JSON.stringify(starter))
+badEnum.slides[0].transition = 'wipe'
+ok(check(badEnum, file).some((m) => /transition/.test(m)), 'an unknown transition fails')
+const noFormat = { slides: [] }
+ok(check(noFormat, file).length > 0, 'no format / no slides fails')
+const withSchema = { ...JSON.parse(JSON.stringify(starter)), $schema: SCHEMA_URL }
+ok(check(withSchema, file).length === 0, 'a deck carrying $schema validates')
+
+console.log('\n$schema is a pointer for readers, never document data\n')
+const loaded = parseDoc(JSON.stringify(withSchema))
+ok(!!loaded && !('$schema' in loaded), 'parseDoc strips $schema on load')
+// Frozen from the 1.1.0 release (03280f5) and origin/main (131015e): the one
+// condition parseDoc applies. Neither looks at unknown top-level keys, so a
+// deck carrying $schema is accepted and the key rides along untouched — an
+// old shell keeps it and writes it back; its validate() lists it as unknown.
+const frozenCondition = (doc: J) => !!(doc && doc.format === FORMAT && Array.isArray(doc.slides) && (doc.slides as unknown[]).length > 0)
+const releaseSrc = 'if (doc && doc.format === FORMAT && Array.isArray(doc.slides) && doc.slides.length > 0) {'
+ok(frozenCondition(withSchema), '1.1.0 (03280f5) parseDoc accepts a deck carrying $schema (frozen condition)')
+ok(read('slides/src/model.ts').includes(releaseSrc), "main's parseDoc still applies exactly that condition (source check)")
+
+console.log('\nthe saved JSON opens with its pointer\n')
+{
+ const live = JSON.parse(JSON.stringify(starter))
+ const stamped = stampSchema(live)
+ ok(Object.keys(stamped)[0] === '$schema' && stamped.$schema === SCHEMA_URL, 'stampSchema puts $schema FIRST, with the published URL')
+ ok(!('$schema' in live), 'the input object is untouched (a new object, not a mutation)')
+ ok(JSON.stringify(stamped).startsWith('{"$schema":"https://bento.page/schema/slides.json",'), 'serialized, the file starts with the pointer (50 B)')
+ const again = parseDoc(JSON.stringify(stamped))
+ ok(!!again && !('$schema' in again), 'load → save → load: the live document never carries it')
+ const facade = read('slides/src/save.ts')
+ ok(/function prepareForSave[\s\S]*stampSchema\(pruneUnusedAssets\(adoptBuiltinFonts\(doc\)\)\)/.test(facade), 'prepareForSave stamps the pointer on every write path (⌘S, autosave, exports, serialize())')
+}
+
+console.log('\nno beacon\n')
+const carriers: string[] = []
+for (const dir of ['slides/src', 'kernel/src']) {
+ const walk = (d: string) => {
+ for (const f of readdirSync(join(root, d), { withFileTypes: true })) {
+ const p = `${d}/${f.name}`
+ if (f.isDirectory()) walk(p)
+ else if (/\.(ts|css|html)$/.test(f.name) && !/\.generated\./.test(f.name)) {
+ const src = readFileSync(join(root, p), 'utf8')
+ if (!src.includes('bento.page/schema')) continue
+ carriers.push(p)
+ const lines = src.split('\n').filter((l) => l.includes('bento.page/schema'))
+ ok(!lines.some((l) => /fetch\(|import\(|href=|src=|new URL\(/.test(l)), `${p}: the URL is text only (${lines.length} line${lines.length === 1 ? '' : 's'})`)
+ }
+ }
+ }
+ walk(dir)
+}
+ok(carriers.length > 0 && carriers.includes('slides/src/schema.ts'), `the URL appears as text in: ${carriers.join(', ')}`)
+const tooling = read('scripts/postbuild-compress.mjs')
+ok(tooling.includes('https://bento.page/schema/slides.json') && tooling.includes('https://bento.page/llms.txt') && tooling.includes('window.bento.schema()'), 'the Tooling comment names the URL, schema() and llms.txt')
+const llms = read('site-src/llms.txt')
+ok(/^# /.test(llms) && llms.includes('https://bento.page/schema/slides.json') && llms.includes('agents.md'), 'llms.txt exists with the schema and the agent guide')
+ok(read('scripts/release.mjs').includes("'llms.txt'") && read('scripts/release.mjs').includes("'schema'"), 'release.mjs stages llms.txt and schema/ into the site')
+
+console.log(`\n${checks - failures}/${checks} checks passed`)
+process.exit(failures ? 1 : 0)
diff --git a/site-src/llms.txt b/site-src/llms.txt
new file mode 100644
index 00000000..644be081
--- /dev/null
+++ b/site-src/llms.txt
@@ -0,0 +1,15 @@
+# Bento
+
+> Bento is a self-contained office suite: one HTML file is the document, the viewer and the editor. Bento Slides is the presentation app. The document is plain JSON inside the file's `<script type="application/bento+json" id="bento-doc">` block; an AI agent edits that block in place, or hands the running app a JSON string. Every saved deck names its schema in a top-level `$schema` key.
+
+## Docs
+
+- [Agent authoring guide](https://bento.page/agents.md): how to write and edit a deck, with copy-paste snippets and the compact input form (omit defaults, they are filled on load)
+- [Document schema](https://bento.page/schema/slides.json): JSON Schema 2020-12 for the `#bento-doc` JSON, generated from the app's own validation tables; version-pinned copies live beside it (`slides-<version>.json`)
+- [Platform invariants](https://raw.githubusercontent.com/nyblnet/bento/main/docs/PLATFORM.md): what every Bento file promises (splice contract, additivity, identity)
+- [The app](https://bento.page/slides): opens with the starter deck; `window.bento` exposes `doc`, `serialize()`, `loadDoc(json)`, `validate()`, `measure()`, `schema()`, `comments()`
+
+## Optional
+
+- [Decision log](https://raw.githubusercontent.com/nyblnet/bento/main/docs/DECISIONS.md): why the format and the runtime are the way they are
+- [Source](https://github.com/nyblnet/bento)
diff --git a/slides/src/main.ts b/slides/src/main.ts
index 8a8bc586..0f18ce27 100644
--- a/slides/src/main.ts
+++ b/slides/src/main.ts
@@ -21,6 +21,7 @@ import { parseDoc, type BentoDoc, type TextElement } from './model'
import { compactJson } from './compact'
import { parseDocInputReport, fitAutoHeights, type LoadReport } from './compactload'
import { validateDoc, type ValidateOpts } from './validate'
+import { buildSchema } from './schema'
import { resolveThemeRefs } from './palette'
import { measureText, measureElement, type TextMeasureSpec } from './measure'
import { starterDoc } from './starterdeck'
@@ -406,6 +407,15 @@ if (location.hash === '#present') {
* each item carries the slide, a typed anchor (element / point / slide),
* author, text, replies and resolved state.
*/
+ /**
+ * The document schema (JSON Schema 2020-12), built from the gate's own
+ * tables — the same JSON as https://bento.page/schema/slides.json for
+ * this version. For an agent driving the browser; a text reader takes
+ * the URL from the Tooling comment or the deck's `$schema` key instead.
+ */
+ schema() {
+ return buildSchema(APP_VERSION)
+ },
comments() {
return store.doc.slides.flatMap((s, slideIndex) =>
(s.comments ?? []).map((c) => ({
diff --git a/slides/src/model.ts b/slides/src/model.ts
index e9c1789e..a2be2628 100644
--- a/slides/src/model.ts
+++ b/slides/src/model.ts
@@ -1291,6 +1291,10 @@ export function parseDoc(json: string): BentoDoc | null {
try {
const doc = JSON.parse(json)
if (doc && doc.format === FORMAT && Array.isArray(doc.slides) && doc.slides.length > 0) {
+ // The saved file names its schema (save.ts writes `$schema` first);
+ // it is a pointer for readers, not document data, so it never enters
+ // the live document — validate() would otherwise report it unknown.
+ delete doc.$schema
// Documents from before docId existed get one minted here; it persists
// on the next save and stays stable from then on.
if (typeof doc.docId !== 'string' || !doc.docId) doc.docId = newDocId()
diff --git a/slides/src/modelkeys.generated.ts b/slides/src/modelkeys.generated.ts
index 81194ceb..1804aea2 100644
--- a/slides/src/modelkeys.generated.ts
+++ b/slides/src/modelkeys.generated.ts
@@ -22,6 +22,7 @@ export const MODEL_KEYS = {
"table": ["backdropFilter", "blend", "blur", "columns", "fx", "group", "groupId", "h", "header", "id", "link", "morphId", "opacity", "role", "rotation", "rows", "shadow", "showOnHover", "style", "themeRefs", "type", "w", "x", "y"],
"media": ["autoplay", "backdropFilter", "blend", "blur", "controls", "fit", "fx", "group", "groupId", "h", "id", "kind", "link", "loop", "morphId", "muted", "opacity", "poster", "radius", "role", "rotation", "shadow", "showOnHover", "src", "themeRefs", "type", "w", "x", "y"],
"embed": ["app", "backdropFilter", "blend", "blur", "doc", "fx", "group", "groupId", "h", "id", "link", "live", "morphId", "opacity", "role", "rotation", "shadow", "showOnHover", "themeRefs", "type", "url", "view", "w", "x", "y"],
+ "code": ["align", "backdropFilter", "blend", "blur", "color", "content", "fontFamily", "fontSize", "fx", "grammarAssetId", "grammarName", "group", "groupId", "h", "id", "lineHeight", "link", "morphId", "opacity", "role", "rotation", "shadow", "showOnHover", "themeAssetId", "themeName", "themeRefs", "type", "valign", "w", "x", "y"],
},
"fx": ["ambient", "countUp", "enter", "enterDur", "ken", "loop", "order", "step"],
"fxKen": ["dir", "duration", "scale"],
@@ -33,6 +34,13 @@ export const MODEL_KEYS = {
"tableCell": ["align", "bg", "bold", "color", "html"],
"gradient": ["angle", "stops"],
"imageCrop": ["scale", "x", "y"],
+ "size": ["height", "width"],
+ "meta": ["author", "company", "event", "keywords", "subject"],
+ "theme": ["accent", "background", "chartPalette", "codePalette", "color", "fontFamily", "headingFamily", "palette", "table"],
+ "themePalette": ["accent2", "accent3", "accent4", "accent5", "accent6", "bg2", "folHlink", "hlink", "tx2"],
+ "themeCodePalette": ["a", "c", "d", "f", "k", "n", "p", "s"],
+ "present": ["controls", "morphSeconds", "numberHidden", "progress", "slideNumber"],
+ "font": ["asset", "family", "style", "weight"],
} as const
export type ElementKind = keyof typeof MODEL_KEYS.element
diff --git a/slides/src/save.ts b/slides/src/save.ts
index a4df648c..1d5dd78a 100644
--- a/slides/src/save.ts
+++ b/slides/src/save.ts
@@ -22,9 +22,11 @@ import {
import type { BentoDoc } from './model'
import { pruneUnusedAssets } from './assets'
import { adoptBuiltinFonts } from './fonts'
+import { stampSchema } from './schema'
function prepareForSave(doc: BentoDoc): BentoDoc {
- return pruneUnusedAssets(adoptBuiltinFonts(doc))
+ // …and the written JSON opens with its `$schema` pointer (schema.ts).
+ return stampSchema(pruneUnusedAssets(adoptBuiltinFonts(doc)))
}
/** Encryption-aware serializer, with unreferenced assets pruned from the copy it writes. */
diff --git a/slides/src/schema.ts b/slides/src/schema.ts
new file mode 100644
index 00000000..8ab3db1b
--- /dev/null
+++ b/slides/src/schema.ts
@@ -0,0 +1,130 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+/**
+ * The bento/slides document schema, as JSON Schema (draft 2020-12), built
+ * from the SAME tables that gate a document on the way in: untrusted.ts's
+ * checks describe what they accept, modelkeys.generated.ts says which keys
+ * each type has, and this file assembles the two. There is no hand-written
+ * copy of the format to drift: scripts/build-schema.mjs prints this into
+ * schema/slides.json (published at https://bento.page/schema/slides.json)
+ * and CI fails when the file and the function disagree.
+ *
+ * Reachable four ways: the URL above (and a version-pinned twin), the
+ * `$schema` key every saved deck carries (save.ts), `window.bento.schema()`
+ * in a running file, and https://bento.page/llms.txt. The first, second and
+ * fourth serve a model that READS the file; the third serves one driving a
+ * browser — the shell is deflated, so a text reader never sees this code.
+ *
+ * What the schema says and what the gate does are the same thing by
+ * construction, with one honest gap: the gate REPAIRS a numeric string
+ * ("12" → 12) and DROPS a bad value rather than rejecting the document; a
+ * validator following this schema reports the same values as errors. A deck
+ * that validates here loads with nothing dropped.
+ */
+
+import { FORMAT, FORMAT_VERSION } from './model'
+import { MODEL_KEYS } from './modelkeys.generated'
+import { ELEMENT_CHECKS, SLIDE_CHECKS, REQUIRED_KEYS, LIMITS, objectSchema, type JsonSchema } from './untrusted'
+
+export const SCHEMA_URL = 'https://bento.page/schema/slides.json'
+
+/**
+ * The saved JSON names its schema as its FIRST key, so a reader with only
+ * the file in hand knows the format (50 bytes). A new object — the live
+ * document is never touched — and parseDoc strips the key on load, so it
+ * exists only in the bytes on disk: not in the store, the CRDT, a recovery
+ * snapshot or a clip. Older shells keep the key and write it back; nothing
+ * anywhere fetches it.
+ */
+export const stampSchema = <T extends object>(doc: T): T & { $schema: string } => ({ $schema: SCHEMA_URL, ...doc })
+
+const str = (max: number, description?: string): JsonSchema =>
+ description ? { type: 'string', maxLength: max, description } : { type: 'string', maxLength: max }
+const color = (description: string): JsonSchema => ({ type: 'string', maxLength: LIMITS.color, description })
+const obj = (keys: readonly string[], props: Record<string, JsonSchema>, required: string[] = []): JsonSchema => {
+ const properties: Record<string, JsonSchema> = {}
+ for (const k of keys) properties[k] = props[k] ?? {}
+ const out: JsonSchema = { type: 'object', properties, additionalProperties: false }
+ if (required.length) out.required = required
+ return out
+}
+
+/**
+ * Element properties whose schema is a structure (fx, gradients, shadows,
+ * table rows…) are hoisted into $defs once and referenced from every element
+ * type that carries them — the file is a third the size and a reader sees
+ * one definition of `fx`, not eight.
+ */
+const HOISTED = ['fx', 'shadow', 'colorGradient', 'fillGradient', 'themeRefs', 'from', 'to', 'style', 'rows', 'columns', 'crop', 'textStroke', 'source', 'link', 'option', 'doc'] as const
+
+/** The schema for one element type: exactly that type's keys, each as the gate checks it. */
+function elementSchema(type: string, $defs: Record<string, JsonSchema>): JsonSchema {
+ const keys = (MODEL_KEYS.element as Record<string, readonly string[]>)[type]
+ const s = objectSchema(keys, ELEMENT_CHECKS, ['type', 'id', ...(REQUIRED_KEYS[type] ?? [])])
+ const props = s.properties as Record<string, JsonSchema>
+ props.type = { const: type }
+ for (const key of HOISTED) {
+ if (!(key in props)) continue
+ const name = `prop-${key}`
+ $defs[name] ??= props[key]
+ props[key] = { $ref: `#/$defs/${name}` }
+ }
+ s.description = `${type} element; x/y/w/h in slide px (1280×720 default); a stable id pairs morphs`
+ return s
+}
+
+/** Build the whole schema. `version` stamps which shell it describes. */
+export function buildSchema(version: string): JsonSchema {
+ const elementTypes = Object.keys(MODEL_KEYS.element)
+ const $defs: Record<string, JsonSchema> = {}
+ for (const type of elementTypes) $defs[type] = elementSchema(type, $defs)
+ $defs.element = { oneOf: elementTypes.map((t) => ({ $ref: `#/$defs/${t}` })) }
+ $defs.slide = objectSchema(MODEL_KEYS.slide, SLIDE_CHECKS, ['id'])
+ $defs.slide.description = 'stateOf = hidden variant reached by a link; transition morph pairs same-id elements'
+ $defs.tableStyle = ELEMENT_CHECKS.style.schema!
+ $defs.theme = obj(MODEL_KEYS.theme, {
+ background: color('slide background'), color: color('body text colour'), accent: color('accent colour'),
+ fontFamily: { type: 'string', maxLength: LIMITS.fontStack, description: 'CSS font-family stack for body text' },
+ headingFamily: { type: 'string', maxLength: LIMITS.fontStack, description: 'display face for headings; absent = fontFamily' },
+ palette: obj(MODEL_KEYS.themePalette, Object.fromEntries(MODEL_KEYS.themePalette.map((k) => [k, color(`brand slot ${k}`)]))),
+ chartPalette: { type: 'array', maxItems: 64, items: color('series colour') },
+ table: { $ref: '#/$defs/tableStyle' },
+ codePalette: obj(MODEL_KEYS.themeCodePalette, Object.fromEntries(MODEL_KEYS.themeCodePalette.map((k) => [k, color('token colour')]))),
+ }, ['background', 'color', 'accent', 'fontFamily'])
+ $defs.doc = obj(MODEL_KEYS.doc, {
+ format: { const: FORMAT },
+ version: { type: 'integer', minimum: 1, description: `format version; this shell writes ${FORMAT_VERSION}` },
+ docId: str(LIMITS.scalar, 'runtime-minted uuid; omit'),
+ title: str(LIMITS.prose),
+ meta: obj(MODEL_KEYS.meta, Object.fromEntries(MODEL_KEYS.meta.map((k) => [k, str(LIMITS.prose)]))),
+ size: obj(MODEL_KEYS.size, { width: { type: 'number', minimum: 1, maximum: 1e5 }, height: { type: 'number', minimum: 1, maximum: 1e5 } }, ['width', 'height']),
+ theme: { $ref: '#/$defs/theme' },
+ present: obj(MODEL_KEYS.present, {
+ numberHidden: { type: 'boolean' }, slideNumber: { type: 'boolean' }, controls: { type: 'boolean' }, progress: { type: 'boolean' },
+ morphSeconds: { type: 'number', minimum: 0, maximum: 60 },
+ }),
+ slides: { type: 'array', minItems: 1, maxItems: LIMITS.slides, items: { $ref: '#/$defs/slide' } },
+ layouts: { type: 'array', maxItems: LIMITS.slides, items: { $ref: '#/$defs/slide' }, description: 'slide templates' },
+ assets: { type: 'object', maxProperties: LIMITS.assets, additionalProperties: { type: 'string', maxLength: LIMITS.asset }, description: 'key → data: URI or svg, used as asset:<key>' },
+ blobs: { type: 'object', description: 'runtime-written' },
+ fonts: { type: 'array', maxItems: LIMITS.assets, items: obj(MODEL_KEYS.font, {
+ family: { type: 'string', maxLength: LIMITS.fontStack }, asset: str(LIMITS.scalar, 'asset:<key> or builtin:<name>'),
+ weight: str(64), style: str(64),
+ }, ['family', 'asset']) },
+ modified: str(LIMITS.scalar, 'runtime-written'),
+ readonly: { type: 'boolean', description: 'presentation package' },
+ template: { type: 'boolean' },
+ collab: { type: 'object', description: 'runtime-written credentials; never author' },
+ }, ['format', 'slides'])
+ ;($defs.doc.properties as Record<string, JsonSchema>).$schema = { type: 'string' }
+ ;($defs.doc.properties as Record<string, JsonSchema>).compact = { const: true, description: 'input only: omitted fields take editor defaults (AGENTS.md)' }
+ return {
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
+ $id: SCHEMA_URL,
+ title: 'bento/slides document',
+ description: `The #bento-doc JSON of a Bento Slides file, generated from the app's validation tables. Guide: https://bento.page/agents.md`,
+ 'x-bento-version': version,
+ $ref: '#/$defs/doc',
+ $defs,
+ }
+}
diff --git a/slides/src/untrusted.ts b/slides/src/untrusted.ts
index 9ef14701..cd5eafa5 100644
--- a/slides/src/untrusted.ts
+++ b/slides/src/untrusted.ts
@@ -48,7 +48,17 @@ import { TIP_KINDS } from './tips'
/** Reject. JSON has no `undefined`, so it can never collide with a real value. */
const DROP = undefined
-type Check = (v: unknown) => unknown
+/**
+ * A check carries a DESCRIPTION of what it accepts (a JSON Schema fragment) so
+ * the same table that gates a paste can be printed for agents — schema.ts
+ * builds `https://bento.page/schema/slides.json` and `window.bento.schema()`
+ * from these, and CI pins the checked-in file to them. The description is
+ * metadata on the function: attaching it changes nothing about what the
+ * check does, and a check with none is emitted as an untyped value.
+ */
+export type JsonSchema = Record<string, unknown>
+type Check = ((v: unknown) => unknown) & { schema?: JsonSchema }
+const tag = (fn: (v: unknown) => unknown, schema: JsonSchema): Check => Object.assign(fn, { schema })
/**
* The load report (compact input, round two). The gate drops silently by
@@ -157,18 +167,19 @@ const isPlainObject = (v: unknown): v is Record<string, unknown> =>
typeof v === 'object' && v !== null && !Array.isArray(v)
/** Finite number, or a numeric string coerced to one. Out of range = DROP. */
-const num = (min: number, max: number): Check => (v) => {
+const num = (min: number, max: number): Check => tag((v) => {
const n = typeof v === 'string' && v.trim() !== '' ? Number(v) : v
return typeof n === 'number' && Number.isFinite(n) && n >= min && n <= max ? n : DROP
-}
-const bool: Check = (v) => (typeof v === 'boolean' ? v : DROP)
-const oneOf = (...allowed: string[]): Check => (v) =>
- typeof v === 'string' && allowed.includes(v) ? v : DROP
+}, { type: 'number', minimum: min, maximum: max })
+const bool: Check = tag((v) => (typeof v === 'boolean' ? v : DROP), { type: 'boolean' })
+const oneOf = (...allowed: string[]): Check => tag((v) =>
+ typeof v === 'string' && allowed.includes(v) ? v : DROP, { type: 'string', enum: allowed })
/** Free text that reaches the DOM as text, never as markup. */
-const str = (max: number): Check => (v) => (typeof v === 'string' && v.length <= max ? v : DROP)
+const str = (max: number): Check => tag((v) => (typeof v === 'string' && v.length <= max ? v : DROP), { type: 'string', maxLength: max })
/** A value that ends up inside a CSS declaration or an HTML attribute. */
-const cssValue = (max = LIMITS.scalar): Check => (v) =>
- typeof v === 'string' && v.length <= max && !CSS_BREAKOUT.test(v) ? v : DROP
+const cssValue = (max = LIMITS.scalar): Check => tag((v) =>
+ typeof v === 'string' && v.length <= max && !CSS_BREAKOUT.test(v) ? v : DROP,
+ { type: 'string', maxLength: max, pattern: '^[^"\'<>{};]*$' })
/**
* A COLOUR, judged by exactly the rule render.ts:cssColor applies when it
* writes one into markup — same allowlist, same `url(`/`expression`/`@`/`\`
@@ -182,11 +193,11 @@ const cssValue = (max = LIMITS.scalar): Check => (v) =>
*/
const COLOR_CHARS = /^[#a-zA-Z0-9(),.%\s/-]+$/
const COLOR_TRICKS = /url\s*\(|expression|@|\\/i
-const color = (max = LIMITS.color): Check => (v) => {
+const color = (max = LIMITS.color): Check => tag((v) => {
if (typeof v !== 'string') return DROP
const s = v.trim()
return s && s.length <= max && COLOR_CHARS.test(s) && !COLOR_TRICKS.test(s) ? v : DROP
-}
+}, { type: 'string', maxLength: max, description: 'CSS colour; no url()' })
/**
* An svg PAINT (`fill` / `stroke`): a colour, or a reference to a gradient or
* filter defined inside this document's own markup. The quoted form is what
@@ -198,18 +209,21 @@ const color = (max = LIMITS.color): Check => (v) => {
* asked for, and it is a colour rule that would otherwise wave it through.
*/
const LOCAL_PAINT_REF = /^url\(\s*(?:"#[\w.:-]+"|'#[\w.:-]+'|#[\w.:-]+)\s*\)$/
-const paint: Check = (v) =>
- typeof v === 'string' && v.length <= LIMITS.color && LOCAL_PAINT_REF.test(v.trim()) ? v : color()(v)
+const paint: Check = tag((v) =>
+ typeof v === 'string' && v.length <= LIMITS.color && LOCAL_PAINT_REF.test(v.trim()) ? v : color()(v),
+ { type: 'string', maxLength: LIMITS.color, description: 'CSS colour or url(#local-id)' })
/**
* A font stack, which legitimately quotes multi-word families ('Segoe UI').
* Quotes are therefore allowed here — renderTableHtml escapes them, and
* injectFonts passes the family through JSON.stringify — but a brace or a
* semicolon still ends a declaration, so those are not.
*/
-const fontStack: Check = (v) =>
- typeof v === 'string' && v.length <= LIMITS.fontStack && !/[<>{};]/.test(v) ? v : DROP
-const pathData: Check = (v) =>
- typeof v === 'string' && v.length <= LIMITS.html && PATH_DATA.test(v) ? v : DROP
+const fontStack: Check = tag((v) =>
+ typeof v === 'string' && v.length <= LIMITS.fontStack && !/[<>{};]/.test(v) ? v : DROP,
+ { type: 'string', maxLength: LIMITS.fontStack })
+const pathData: Check = tag((v) =>
+ typeof v === 'string' && v.length <= LIMITS.html && PATH_DATA.test(v) ? v : DROP,
+ { type: 'string', maxLength: LIMITS.html, description: 'SVG path data' })
/**
* src / poster: a data: URI, an asset: key, a URL, or a relative path.
*
@@ -223,11 +237,11 @@ const pathData: Check = (v) =>
* this into an attribute breakout, so it must escape or re-check — noted here
* because the safety lives at the call site, not in this value.
*/
-const mediaRef: Check = (v) => {
+const mediaRef: Check = tag((v) => {
if (typeof v !== 'string' || v.length > LIMITS.asset) return DROP
if (HAS_SCHEME.test(v)) return SAFE_SCHEME.test(v) ? v : DROP
return CSS_BREAKOUT.test(v) ? DROP : v // a bare path still lands in an attribute
-}
+}, { type: 'string', maxLength: LIMITS.asset, description: 'data: URI, asset:<key> or URL' })
/**
* Rebuild an object from a key table, dropping every key and value it fails.
@@ -243,7 +257,7 @@ const mediaRef: Check = (v) => {
function shape(
keys: readonly string[], checks: Record<string, Check>, required: readonly string[] = [],
): Check {
- return (v) => {
+ return tag((v) => {
if (!isPlainObject(v)) return DROP
const out: Record<string, unknown> = {}
for (const key of Object.keys(v)) {
@@ -255,7 +269,18 @@ function shape(
const missing = required.filter((key) => out[key] === DROP)
if (missing.length) { note(null, `missing required ${missing.join(', ')} — object dropped`); return DROP }
return out
- }
+ }, objectSchema(keys, checks, required))
+}
+
+/** The schema of a `shape`: exactly the keys it keeps, each as its check says. */
+export function objectSchema(
+ keys: readonly string[], checks: Record<string, Check>, required: readonly string[] = [],
+): JsonSchema {
+ const properties: Record<string, JsonSchema> = {}
+ for (const key of keys) if (checks[key]) properties[key] = checks[key].schema ?? {}
+ const out: JsonSchema = { type: 'object', properties, additionalProperties: false }
+ if (required.length) out.required = [...required]
+ return out
}
/**
@@ -263,7 +288,7 @@ function shape(
* arrays are positional — a table's cells line up with its columns, a chart's
* data with its labels — and silently closing a hole would misalign the rest.
*/
-const list = (max: number, item: Check): Check => (v) => {
+const list = (max: number, item: Check): Check => tag((v) => {
if (!Array.isArray(v) || v.length > max) { note(null, Array.isArray(v) ? `more than ${max} entries` : 'not a list'); return DROP }
const out: unknown[] = []
for (let i = 0; i < v.length; i++) {
@@ -272,7 +297,7 @@ const list = (max: number, item: Check): Check => (v) => {
out.push(val)
}
return out
-}
+}, { type: 'array', maxItems: max, items: item.schema ?? {} })
const gradient = shape(MODEL_KEYS.gradient, {
angle: num(-3600, 3600),
@@ -331,7 +356,7 @@ const tableRows = list(LIMITS.rows, shape(MODEL_KEYS.tableRow, {
* chartSnapshotSvg already catches), because a half-pruned option is still an
* attacker's shape, kept.
*/
-const chartOption: Check = (v) => {
+const chartOption: Check = tag((v) => {
if (!isPlainObject(v)) return DROP
let nodes = LIMITS.optionNodes
const pure = (node: unknown, depth: number): boolean => {
@@ -351,7 +376,7 @@ const chartOption: Check = (v) => {
)
}
return pure(v, LIMITS.optionDepth) ? v : DROP
-}
+}, { type: 'object', description: 'ECharts-shaped option, plain JSON' })
/**
* The `embed` element. `url` is what a live iframe LOADS, so it
@@ -366,8 +391,9 @@ const chartOption: Check = (v) => {
// Not held to CSS_BREAKOUT: a query string legitimately carries `;` and
// quotes, and the one consumer assigns it as a DOM property (`iframe.src`),
// where it is a value and never re-parsed as markup (the mediaRef argument).
-const webUrl: Check = (v) =>
- typeof v === 'string' && v.length <= LIMITS.prose && isWebUrl(v) ? v : DROP
+const webUrl: Check = tag((v) =>
+ typeof v === 'string' && v.length <= LIMITS.prose && isWebUrl(v) ? v : DROP,
+ { type: 'string', maxLength: LIMITS.prose, pattern: '^https?://' })
// An embedded document is another deck's JSON, and a deck's envelope carries
// its collaboration secrets: `collab` (room, read key, private halves, and the
// saved sync state) and `docId`. Neither is content. Left in place they would
@@ -375,7 +401,8 @@ const webUrl: Check = (v) =>
// and export — and the export-secrets rig reads the top-level block only. So
// an object source leaves here without them, whatever put them there — by the
// same rule the export strip applies on the way out (envelope.ts).
-const embedDoc: Check = (v) => (typeof v === 'string' ? cssValue()(v) : stripEnvelope(chartOption(v)))
+const embedDoc: Check = tag((v) => (typeof v === 'string' ? cssValue()(v) : stripEnvelope(chartOption(v))),
+ { anyOf: [{ type: 'string', maxLength: LIMITS.scalar }, { type: 'object' }] })
// `el` is required: a connector end with no element to anchor to is dangling,
// and editor.syncConnectors drops those anyway
@@ -403,7 +430,7 @@ const connectorEnd = shape(MODEL_KEYS.connectorEnd, {
* not parse is dead weight the validator will report forever, so it is dropped
* here rather than carried.
*/
-const themeRefs: Check = (v) => {
+const themeRefs: Check = tag((v) => {
if (!isPlainObject(v)) return DROP
const out: Record<string, string> = {}
let n = 0
@@ -420,18 +447,18 @@ const themeRefs: Check = (v) => {
out[key] = token
}
return Object.keys(out).length ? out : DROP
-}
+}, { type: 'object', additionalProperties: { type: 'string' }, maxProperties: LIMITS.themeRefs, description: 'property path → palette token' })
-const ELEMENT_CHECKS: Record<string, Check> = {
+export const ELEMENT_CHECKS: Record<string, Check> = {
themeRefs,
// identity + geometry
id: cssValue(), morphId: cssValue(), role: cssValue(), group: cssValue(),
groupId: cssValue(), showOnHover: cssValue(),
// a slide id, or an http(s) URL — the same test the renderer and the show apply
- link: (v) => (isWebUrl(v) ? v : cssValue()(v)),
+ link: tag((v) => (isWebUrl(v) ? v : cssValue()(v)), { type: 'string', maxLength: LIMITS.prose, description: 'slide id or http(s) URL' }),
x: num(-1e6, 1e6), y: num(-1e6, 1e6), w: num(0, 1e6), h: num(0, 1e6),
rotation: num(-3600, 3600), opacity: num(0, 1),
- shadow: (v) => (Array.isArray(v) ? list(16, shadowSpec)(v) : shadowSpec(v)),
+ shadow: tag((v) => (Array.isArray(v) ? list(16, shadowSpec)(v) : shadowSpec(v)), { anyOf: [shadowSpec.schema!, { type: 'array', maxItems: 16, items: shadowSpec.schema! }] }),
blur: num(0, 1000), backdropFilter: num(0, 1000), blend: cssValue(64),
fx,
// text
@@ -452,7 +479,7 @@ const ELEMENT_CHECKS: Record<string, Check> = {
// the tip list is tips.ts's — one catalogue for the gate, the panel and the renderer
lineStart: oneOf(...TIP_KINDS), lineEnd: oneOf(...TIP_KINDS),
radius: num(0, 1e5), d: pathData,
- pathBox: (v) => (Array.isArray(v) && v.length === 4 ? list(4, num(-1e6, 1e6))(v) : DROP),
+ pathBox: tag((v) => (Array.isArray(v) && v.length === 4 ? list(4, num(-1e6, 1e6))(v) : DROP), { type: 'array', minItems: 4, maxItems: 4, items: { type: 'number' } }),
from: connectorEnd, to: connectorEnd,
// image / svg / media
src: mediaRef, poster: mediaRef, asset: cssValue(),
@@ -468,6 +495,12 @@ const ELEMENT_CHECKS: Record<string, Check> = {
rows: tableRows, header: bool, style: tableStyle,
// embed
app: cssValue(), view: str(LIMITS.markup), doc: embedDoc, url: webUrl, live: bool,
+ // code — the raw snippet is text (code.ts tokenizes it, never innerHTML);
+ // grammar/theme names and asset ids land in lookups, not markup. Not in
+ // REQUIRED_ELEMENT_KEYS: renderCodeInto returns false without content and
+ // the caller falls back to plain text — a degrade, not a throw.
+ content: str(LIMITS.html), grammarName: cssValue(64), themeName: cssValue(64),
+ grammarAssetId: cssValue(), themeAssetId: cssValue(),
type: oneOf(...Object.keys(MODEL_KEYS.element)),
}
@@ -555,7 +588,7 @@ export function sanitizeElement(value: unknown): SlideElement | null {
}
-const SLIDE_CHECKS: Record<string, Check> = {
+export const SLIDE_CHECKS: Record<string, Check> = {
id: cssValue(), name: str(LIMITS.prose), stateOf: cssValue(), themeRefs,
// background is a CSS `background` shorthand, so it gets the colour rule at
// the shorthand's length — wide enough for a multi-stop linear-gradient(),
@@ -575,9 +608,9 @@ const SLIDE_CHECKS: Record<string, Check> = {
})),
// elements are dropped INDIVIDUALLY: one hostile element must not cost the
// author the rest of a legitimately copied slide
- elements: (v) => (Array.isArray(v) && v.length <= LIMITS.elements
+ elements: tag((v) => (Array.isArray(v) && v.length <= LIMITS.elements
? v.map((el, i) => within(String(i), () => sanitizeElement(el))).filter((el): el is SlideElement => el !== null)
- : DROP),
+ : DROP), { type: 'array', maxItems: LIMITS.elements, items: { $ref: '#/$defs/element' } }),
}
/**