@perkyzz/emvb-mcp 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +15 -12
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -6498,7 +6498,7 @@ function duration2(params) {
6498
6498
  return _isoDuration(ZodISODuration, params);
6499
6499
  }
6500
6500
  // ../../docs/system/layout-format.md
6501
- var layout_format_default = "# Layout format (schema 18)\n\nHow EmVB stores a page and its site-wide design, at layout schema 18 and design schema 17, schema contract 1.0 (W-925, D-065: renames, motion under `motion`, unknown keys kept; see [docs/SCHEMA.md](../SCHEMA.md)); Loop forever on an icon animation in W-853, D-059; the image editor's `edit` record on images in W-481; per-element direction, image link and caption, button icons, table of contents, container queries, and focal points in W-341 onward; visitor segments in W-329; Loop fields in W-330; `ch` lengths and negative margins in W-331). The source of truth is the code: `packages/emvb/src/core/schema/` (Zod schemas), `core/limits.ts`, `core/validate.ts` and `core/migrate/`. Update this file in the same change as any of them (ARCHITECTURE.md § Documentation).\n\n## Where it lives\n\n- **Pages** are entries in the hidden `emvb_pages` collection (D-012, D-019). The layout is the `layout` field (EmDash type `json`, shown with the read-only `emvb:layout` widget). The other fields are `title`, `canvas_mode` (`site-layout` or `blank`) and EmDash's own slug, status, revision and SEO fields. EmDash may hand a `json` field back as a string, so readers accept both (`renderStored` in `src/astro/render.ts`).\n- **The design system** (colours, fonts, font sizes, spacings; classes in W-030) is one document in plugin storage, collection `design`, key `system` (D-013). Editors save a draft at key `draft` through `POST /_emdash/api/plugins/emvb/design/save` (W-100, D-040 proposed). `POST .../design/publish` copies that draft onto `system`. The public `GET /_emdash/api/plugins/emvb/design` returns `system` only.\n\n## Page layout\n\n```json\n{\n \"schemaVersion\": 18,\n \"root\": {\n \"id\": \"root0001\",\n \"type\": \"container\",\n \"props\": {},\n \"style\": { \"flexDirection\": \"column\", \"gap\": { \"value\": 16, \"unit\": \"px\" } },\n \"children\": [\n {\n \"id\": \"head0001\",\n \"type\": \"heading\",\n \"props\": { \"text\": \"Welcome\", \"level\": 1 },\n \"style\": { \"color\": { \"var\": \"brand\" } }\n }\n ]\n }\n}\n```\n\n- `schemaVersion` is the literal `18` (D-031, D-032, D-034, D-036, D-038, D-039, D-041, D-042, D-044, W-141, D-045, W-160, W-307, W-329, W-341, W-481, W-885, W-925; older documents are upgraded on read by steps that change nothing, except v11 → v12, which rewrites a gradient's `from` and `to` into `stops`, and v17 → v18 (W-925), which renames `section` to `part-ref`, a node's `label` to `editorLabel` and a Loop's `itemPartId` to `partId`, and moves `transition`, `entrance`, `scrollMotion` and `iconAnimation` under `style.motion`). `root` is always a container.\n- Every node has `id` (4–24 of `A-Z a-z 0-9 _ -`, unique within the page), `type`, `props`, and optional `style`, `states` (W-089, see [State styles](#state-styles-w-089)), `classes` (up to 20 ids of 1–40 of `a-z 0-9 -`, rendered as `emvb-k-<id>`), `bind` (W-307), `variant` (an A/B arm, W-312) and `audience` (who sees it, W-313, W-329).\n- Objects are strict: unknown keys are rejected, not ignored.\n- **Unknown element types** (W-022 / R-033): a node whose `type` is not in the known set is kept on save (`id` rules still apply; `props` is an open record; every shared node field, including `devices` and `hiddenOn`, is allowed and checked as on known nodes; optional `children` are validated recursively). Public pages omit it; the editor shows a selectable placeholder. Damaged known nodes (wrong props) still fail validation with path-specific issues.\n\n\n| Type | `props` | Children | Renders as |\n| --- | --- | --- | --- |\n| `container` | optional `tag` (`div`, `section`, `header`, `footer`, `main`, `article`, `aside`, `nav`), optional `href` and `newTab` (the box is the link; a link inside a link is dropped) | `children: Node[]` (required, may be empty) | that tag (default `div`) with `class=\"emvb-container …\"` |\n| `layout-section` (shown as \"Section\", W-156) | optional `tag` (as `container`, default `section`), `contentWidth` length, `fullWidth` boolean | `children: Node[]` | that tag with `class=\"emvb-layout-section …\"`, wrapping `<div class=\"emvb-layout-section-inner\">` around the children; the inner box is at most `contentWidth` (default 1140 px, none with `fullWidth`) wide and centred |\n| `heading` | `text` (≤ 2000), `level` (1–6), optional `href` (≤ 2000) and `newTab` (W-141), optional `marks` (W-950, see below) | none | `<h1>`–`<h6>`; with a safe `href`, the text is wrapped in `<a class=\"emvb-heading-link\">` (colour and decoration inherited) |\n| `spacer` | `height` length | none | `<div aria-hidden=\"true\">` with height in CSS |\n| `divider` | `{}` | none | `<hr>` |\n| `text` | `text`, optional `tag` (`p` \\| `div`), optional `marks` (W-950) | none | `<p>` or `<div>`; formatted words as below |\n| `label` | `text` | none | `<span>` |\n| `link` | `text`, `href`, optional `newTab` | none | `<a href>` (+ `target`/`rel` when `newTab`) |\n| `button` | `text`, optional `href` and `newTab` | none | `<a href>` when `href` is safe, else `<button type=\"button\">` |\n| `list` | `items` (string[], ≤ 200), optional `ordered`; W-952: optional `marker` (`disc`, `circle`, `square`, `decimal`, `decimal-leading-zero`, `lower-alpha`, `upper-alpha`, `lower-roman`, `upper-roman`, `steps`, `none`; a number style or `steps` makes it numbered) and `start` (1–9999, numbered only) | none | `<ul>` or `<ol>` (with `start`) with `<li>`; the marker is `list-style-type`, `steps` adds `emvb-list--steps` (numbers in circles, CSS sent only when used) |\n| `image` | `src`, `alt`, optional `decorative`, `width`, `height`, `mediaId`, `edit` (editor-only image-editor record, never rendered; see below) | none | `<img loading=\"lazy\">` (decorative → empty `alt` + `role=\"presentation\"`) |\n| `icon` | `iconId` (a bundled Lucide id, or `<set prefix>:<name>` from the icon library, W-236), optional `iconSvg` (the picked icon's SVG, ≤ 32768 chars, W-234 / W-239; `iconId` `upload:<id>` for an uploaded SVG), optional `singleColor` (W-238: `true` paints a picked SVG's own fills, strokes and stops in `currentColor`), `size`, `decorative`, `title`, `href` (≤ 2000) and `newTab` (W-141); a non-empty `href` needs a `title` | none | Inline `<svg>`: `iconSvg` sanitized again at render (allowlist; size, id, role and aria attributes replaced), else the bundled Lucide icon (unknown id and no `iconSvg` → placeholder; never a remote URL); with a safe `href`, the svg is hidden inside `<a class=\"emvb-icon-link\" aria-label=\"title\">` |\n| `video` | `url`, `title`, optional `mediaId` | none | YouTube/Vimeo privacy `<iframe loading=\"lazy\">` or media `<video controls>` (no autoplay) |\n| `form` | `formId` (forms-plugin id; may be empty until bound), optional `nextLabel` and `prevLabel` (≤ 80, W-1065: the step buttons, unset \"Next\" and \"Previous\") | `children: Node[]` (form fields + submit; no nested forms) | Bound: `<form class=\"emvb-form ec-form\" …>`. Unbound: editor placeholder `data-emvb-form-unbound`; omitted on public (no forms runtime). |\n| `form-step` (W-1065) | optional `title` (≤ 200) | `children: Node[]`; only directly inside a `form` | `<fieldset class=\"emvb-form-step ec-form-page\" data-page=\"<n>\" tabindex=\"-1\">` with `<legend>` (untitled: `aria-label=\"Step <n+1>\"`): the forms plugin's multi-page markup. The form adds `<p data-ec-progress aria-live=\"polite\">` before the first step and `<div class=\"emvb-form-step-nav\">` with hidden `data-ec-prev` / `data-ec-next` buttons after the last. The forms script shows one step at a time and checks a step before Next; without it every step shows. Content outside the steps (an intro, Submit) stays outside the pages |\n| `text-input` | `field`, optional `label`, `placeholder`; W-1065: optional `inputType` (`number`, `date`), `min`, `max` (±10¹²), `step` (> 0), `minDate`, `maxDate` (YYYY-MM-DD, a real day) | none | labelled `<input class=\"ec-form-input\">` + `data-error-for`. Type: the bound field's own (`email`, `tel`, `url`, `number`, `date`), else `inputType` when the field is plain text. A number gets `min`/`max` (the field's own limits win) and `step` (unset `any`); a date gets `min`/`max` from `minDate`/`maxDate`. A range with nothing in it is left off |\n| `textarea` | `field`, optional `label`, `placeholder` | none | labelled `<textarea class=\"ec-form-input\">` + `data-error-for` |\n| `select` | `field`, optional `label`, `placeholder` (words the empty first choice; unset is \"Choose…\", W-686) | none | labelled `<select>` (options from the public form definition when available) |\n| `checkbox` | `field`, optional `label` | none | labelled `<input type=\"checkbox\" value=\"true\">` |\n| `radio` | `field`, optional `label`, `placeholder` | none | `<fieldset>` of radios (options from definition when available) |\n| `submit` | optional `label` | none | `<button type=\"submit\" class=\"ec-form-submit\">` |\n| `post-title` | optional `level` (1–6) | none | Dynamic heading from `ThemeDynamicData.post` |\n| `post-excerpt` | optional `maxWords` (whole number, 1–10000, W-177) | none | Dynamic excerpt paragraph; with `maxWords`, cut to that many words with \"…\" |\n| `post-content` | (none) | none | Dynamic body (Portable Text → safe blocks) |\n| `post-image` | optional `decorative` | none | Dynamic featured image when URL present |\n| `post-link` | optional `text`, `newTab` | none | Dynamic permalink; blank text → title |\n| `post-date` | optional `format`: `medium` (default), `short`, `long`, `full` or `numeric` (W-177) | none | `<time datetime>` with the published date in UTC; `numeric` is YYYY-MM-DD |\n| `post-author` | (none) | none | The author's name |\n| `pagination` | optional `prevText`, `nextText`, `showCount` and `countText` (`{page}` and `{total}`; unset text is \"Page {page} of {total}\"), `titleText` (the paged archive title, `{title}` and `{page}`, W-529), `archiveTitle` (replaces \"Posts\" as the posts archive title, ≤ 60, W-532), and screen reader names `navLabel` (\"Pagination\"), `pageLabel` (\"Page {page}\"), `prevLabel` and `nextLabel` (\"Previous page\" / \"Next page\", used when the text is only an arrow), each ≤ 60 (W-689) | none | `nav` of Previous, page numbers and Next. Nothing on a single page, with no archive data, or inside a Loop item |\n| `loop` | optional `partId` (the item part; `itemPartId` before schema 18); `perPage` (1–50, unset = 20) on an archive; a collection Loop also takes `collection`, `limit`, `order`, `display`, `columns`, `permalink`, `imageField`, `excerptField` and `filter` (see [Schema 13](#schema-13-the-w-307-feature-batch) and [Schema 14](#schema-14)) | `children: Node[]` (inline item template when no part id) | Repeats the item template for each post or collection entry |\n| `grid` | `columns` (1–12); optional `columnsTablet` and `columnsMobile` (1–12, W-139); optional `columnTracks`, `columnTracksTablet`, `columnTracksMobile` (1–12 tracks: `1fr`, `2fr`, `3fr`, `auto`, `min-content`, `max-content`, or a length) | `children: Node[]` | `display: grid` with that many equal columns, or the custom tracks when that device sets them; the device values go in the tablet and mobile media queries, and an unset one follows the next wider device |\n| `part-ref` (shown as \"Theme section\"; `section` before schema 18) | optional `partId` | `children: Node[]` (inline contents when no part id) | When `partId` is set, the published Section theme part's children replace the local ones |\n\nAn image's optional `edit` (W-481, D-061) is written by the image editor and never rendered. `src`, `mediaId`, `width` and `height` point at the edited file; `edit` points back at the original: `v` (`1`), `engine` (`\"photocn\"`), `engineVersion` (such as `\"0.1.2\"`), `recipe` (photocn's `RecipeV1`, strict: sliders −1 to 1, blur and curve points 0 to 1, at most 32 points per curve channel, straighten ±45°, a filter name of up to 32 letters, digits, spaces, `_` or `-`, a blend image only as a site path or `https:` URL, at most 16 KB as JSON), optional `originalMediaId`, `originalSrc` (up to 2000 characters), `output` (`format` `webp`, `jpeg` or `png`, optional `quality` 0.1 to 1, optional `maxSide` 16 to 10000 px, `stripGps` boolean) and `editedAt` (an ISO 8601 timestamp).\n\nEvery node may also carry an optional `editorLabel` (`label` before schema 18; 1–80 characters, trimmed; an editor-only name shown in Layers and on the canvas, never rendered, W-157), optional `htmlId` (CSS `id`, unique on the page, theme parts included: a header and a page are rendered apart, so EmVB can't rename an id you chose without breaking links to it (W-1077); since 1.1.2 an id that names a browser global such as `location` or `document` is kept in the layout but not rendered, S-12), `classes` (style-class ids from the design system, S4), `devices` and `hiddenOn` (W-096, below).\n\n**Forms (S5):** form fields are only valid inside a `form` (or under one). Pages with a form set `needsFormsRuntime`; the host route loads `EmVBFormsRuntime` so `initForms` handles AJAX submit. Pages without a form stay zero EmVB JS (R-031).\n\n### Style properties (W-017, extended in W-088)\n\n**Text marks (W-950).** `marks` on a Heading or Text is up to 100 ranges `{ \"start\", \"end\", \"bold\"?: true, \"italic\"?: true, \"color\"?: colour, \"href\"?, \"newTab\"?: true }` over its `text` (characters `start` to `end`, end not included, 0–2000). They render as `<strong>`, `<em>`, `<span class=\"emvb-mark-c<n>\">` (the colour as `--emvb-mark-<n>` on the element, up to 8 per element; `.emvb-mark-c<n>{color:var(--emvb-mark-<n>)}` is sent only when a page uses one) and `<a class=\"emvb-mark-link\">` (checked like any link; left out inside a linked heading). Ranges past the text are clipped when drawn, so editing the text never invalidates a page; the editor moves them with the words.\n\nLengths are `{ \"value\": 0–10000, \"unit\": \"px\" | \"rem\" | \"em\" | \"%\" | \"vw\" | \"vh\" | \"ch\" }` (`vw` and `vh` since W-088, `ch` since W-331). Colours are hex or `{ \"var\": \"<id>\" }`. A **size** is a length, a variable reference or `\"auto\"`. An **offset** is a size whose value may also be negative (−10000 to 10000). A **fluid size** (W-955) is `{ \"fluid\": { \"min\": 0–10000, \"max\": 0–10000 } }` in px: written as `clamp()` growing from `min` on 360 px wide screens to `max` on 1280 px ones (the formula the design's fluid sizes use); `fontSize`, `gap`, the width and height keys, padding and margins (and the offsets) take one.\n\n| Key | Value | CSS |\n| --- | --- | --- |\n| `flexDirection` | `row`, `column`, `row-reverse`, `column-reverse` | `flex-direction` |\n| `flexWrap` | `nowrap`, `wrap`, `wrap-reverse` | `flex-wrap` |\n| `justifyContent` | `flex-start`, `flex-end`, `center`, `space-between`, `space-around`, `space-evenly` | `justify-content` |\n| `alignItems` | `stretch`, `flex-start`, `flex-end`, `center`, `baseline` | `align-items` |\n| `gap` | length | `gap` |\n| `gridColumnSpan` / `gridRowSpan` (W-099) | whole number 1–12 | `grid-column` / `grid-row` as `span N` |\n| `gridColumnStart` / `gridRowStart` | whole number 1–13 | `grid-column` / `grid-row` as the line number, or `start / span N` when a span is set too |\n| `width` / `height` | size | `width` / `height` |\n| `minWidth` / `maxWidth` / `minHeight` / `maxHeight` | length | matching size properties (`maxHeight` since W-088) |\n| `flexGrow`, `flexShrink` (W-954) | number 0–100 | `flex-grow`, `flex-shrink`: a Flexbox or Container child's share of free space, and of the shortfall |\n| `flexBasis` (W-954) | length or `auto` | `flex-basis`: the child's starting size along the row or column |\n| `alignSelf` (W-954) | `auto`, `stretch`, `flex-start`, `flex-end`, `center`, `baseline` | `align-self`: the child's own cross-axis alignment (`auto` follows the parent's Align) |\n| `order` (W-954) | whole number −99 to 99 | `order`: the child's place among its siblings (lower first) |\n| `overflow` | `visible`, `hidden`, `clip`, `scroll`, `auto` | `overflow` |\n| `overflowX`, `overflowY` (W-957) | same as `overflow` | `overflow-x`, `overflow-y`, after `overflow` so one axis wins |\n| `aspectRatio` | `\"auto\"` or `\"w/h\"` with whole numbers 1–9999, such as `\"16/9\"` | `aspect-ratio` (`16 / 9`) |\n| `objectFit` | `fill`, `contain`, `cover`, `none`, `scale-down` | `object-fit` (the editor offers it on Image and Video) |\n| `objectPosition` (W-957) | `center`, `top`, `bottom`, `left`, `right`, `top left`, `top right`, `bottom left`, `bottom right` | `object-position` (Image and Video) |\n| `paddingTop` / `Right` / `Bottom` / `Left` | length | `padding-*` |\n| `marginTop` / `Right` / `Bottom` / `Left` | offset (negative since W-331) | `margin-*` |\n| `position` | `static`, `relative`, `absolute`, `fixed`, `sticky` | `position` |\n| `top` / `right` / `bottom` / `left` | offset | matching inset properties |\n| `zIndex` | whole number −9999 to 9999 | `z-index` |\n| `fontFamily` | a font stack (1–200, checked as safe) or a font variable | `font-family` |\n| `fontSize` | length | `font-size` |\n| `lineHeight` | length, or a unitless number 0–100 | `line-height` |\n| `letterSpacing` | length whose value may be negative (−10000 to 10000) | `letter-spacing` |\n| `fontWeight` | `100`–`900` in steps of 100, `normal`, `bold` | `font-weight` |\n| `textAlign` | `left`, `center`, `right`, `justify` | `text-align` |\n| `textTransform` | `none`, `uppercase`, `lowercase`, `capitalize` | `text-transform` |\n| `textDecoration` | `none`, `underline`, `overline`, `line-through` | `text-decoration` (W-113; a button sets `none` in its base CSS) |\n| `markerColor`, `markerSize` (W-952, Lists) | colour; length | `--emvb-marker-color`, `--emvb-marker-size`, read by the marker and step rules (sent only when a page sets them) |\n| `fontStyle` (W-957) | `normal`, `italic` | `font-style` |\n| `whiteSpace` (W-957) | `normal`, `nowrap`, `pre-line`, `pre-wrap` | `white-space` (a Text element defaults to `pre-line`) |\n| `overflowWrap` (W-957) | `normal`, `break-word`, `anywhere` | `overflow-wrap` |\n| `color` / `backgroundColor` / `borderColor` | colour | matching colour properties |\n| `backgroundImage` (W-094) | http(s) URL or a site path, no spaces, quotes or parentheses | `background-image` as `url(\"…\")`. With no size, position or repeat: `cover`, `center`, `no-repeat` |\n| `backgroundVideo` | the same URL rule as `backgroundImage` | a muted, looping `<video>` behind the content |\n| `backgroundSize` | `auto`, `cover`, `contain` | `background-size` (the image layer) |\n| `backgroundPosition` | `center`, an edge (`top`, `bottom`, `left`, `right`) or a corner (`top left` and the other three) | `background-position` |\n| `backgroundRepeat` | `no-repeat`, `repeat`, `repeat-x`, `repeat-y` | `background-repeat` |\n| `gradient` | `{ type, angle?, position?, stops }`: `type` `linear`, `radial` or `conic`; `angle` whole degrees 0–360 (the linear direction, default 180, or the conic start, default 0); `position` (the radial centre, default `center`) takes the `backgroundPosition` values; `stops` are 2–10 `{ color, at }`, `color` a colour and `at` a whole % 0–100 | `linear-gradient`, `radial-gradient` (a circle) or `conic-gradient`, stops in `at` order, behind the image |\n| `overlay` | `{ color, opacity: 0–1 }`, or since W-949 `{ gradient, opacity?: 0–1 }` with the same `gradient` shape | a colour or gradient layer above the image (a scrim). Hex becomes 8-digit hex; a colour variable becomes `color-mix`; a gradient overlay's `opacity` (unset = 1) fades every stop |\n| `borderWidth` / `borderRadius` | length | matching border properties: every side or corner |\n| `borderTopWidth`, `borderRightWidth`, `borderBottomWidth`, `borderLeftWidth` (W-138) | length | `border-top-width`, `border-inline-end-width`, `border-bottom-width`, `border-inline-start-width`, after `border-width`, so a side beats it |\n| `borderTopLeftRadius`, `borderTopRightRadius`, `borderBottomRightRadius`, `borderBottomLeftRadius` (W-138) | length or a spacing variable | `border-start-start-radius`, `border-start-end-radius`, `border-end-end-radius`, `border-end-start-radius`, after `border-radius` |\n| `borderStyle` | `none`, `solid`, `dashed`, `dotted` | `border-style` |\n| `opacity` | number 0–1 (the editor shows 0–100 %) | `opacity` |\n| `boxShadow` | `{ x, y, blur, spread, color?, inset? }`: px numbers, `x`, `y` and `spread` −1000 to 1000, `blur` 0 to 1000; `color` is a colour; `inset` is a boolean | `box-shadow` as `[inset] Xpx Ypx Bpx Spx [colour]`; no colour means the text colour |\n| `filter` | `{ blur?, brightness?, contrast?, saturate?, grayscale?, hueRotate? }`, at least one set: `blur` 0–100 px, `brightness` / `contrast` / `saturate` 0–300 %, `grayscale` 0–100 %, `hueRotate` 0–360° | `filter`, functions always in that order, such as `blur(2px) grayscale(100%)` |\n| `backdropFilter` (W-957) | the same object as `filter` | `backdrop-filter`, applied to what is behind the element (frosted glass) |\n| `transform` (W-953) | `{ x?, y?, scale?, rotate? }`, at least one: `x` and `y` whole px −2000 to 2000, `scale` whole % 10–400, `rotate` whole degrees −360 to 360 | `translate`, `scale` and `rotate` (CSS's own properties, so an entrance never cancels it; a scroll motion or loop on the same property wins while it runs). In a hover state it is a lift; animate it with a `transform` transition |\n| `cursor` | `default`, `pointer`, `text`, `move`, `grab`, `not-allowed`, `help`, `crosshair`, `zoom-in` | `cursor` |\n| `motion.transition` (W-089, Normal only) | `{ duration, delay?, easing, property }`: `duration` and `delay` whole ms 0–2000; `easing` `ease`, `ease-in`, `ease-out`, `ease-in-out`, `linear`; `property` `all`, `colors`, `opacity`, `shadow`, `filter`, `transform` (W-953). No other keys | `transition`, one entry per CSS property: `colors` is `color`, `background-color` and `border-color`; `shadow` is `box-shadow`; `transform` is `translate`, `scale` and `rotate`. For example `opacity 200ms ease-out 50ms` |\n| `motion.entrance` (W-101, Normal only) | `{ type, duration, delay?, trigger? }`: `type` is `fade`, `fade-up`, `fade-down`, `slide-up`, `slide-down` or `scale`; `duration` and `delay` whole ms 0–2000; `trigger` is `load` (default) or `view` (as it scrolls in; browsers without scroll-driven animations play it on load) | `animation` named `emvb-<type>`, once, `ease-out`, `both`. Reduced motion sets `animation: none` |\n| `motion.sticky` (W-1070, Normal only; 1.4) | `{ distance?, background?, shadow?, padding?, hide? }` (at least one effect) or `{ type: \"none\" }`. `distance` 10–2000 px (unset 120); `background` a colour; `shadow` true; `padding` a length (top and bottom); `hide` true | Page-scroll animations (`animation-timeline: scroll(root)`, range `0px <distance>px`) to the scrolled look, sent only where scroll-driven animations exist; off for reduced motion. `hide` (on any device) adds `data-emvb-sticky-hide` and the `sticky` runtime, which slides the element away while scrolling down (up, or down when it is held by `bottom` with no `top`) and back on scrolling up, never while focus is inside. Each device's `hide` is written as `--emvb-sticky-hide: 1` or `0` (Desktop `0` unless set; unset on a narrower device keeps the wider one's; `{ type: \"none\" }` is `0`), which the runtime reads at the current width. The slide is a Web Animation, so the element's own `transition` is untouched |\n| `motion.loop` (W-938, Normal only; 1.0) | `{ effects, duration, easing?, alternate?, loop? }` or `{ type: \"none\" }`. `effects` as `motion.scroll`; `duration` 200–20000 ms; `easing` a transition easing (default `ease-in-out`); `alternate` false plays one way; `loop: true` never stops | A time-based CSS animation; stops after about 5 s unless `loop`; off for reduced motion. The accessibility check flags Loop forever and runs over 5 s |\n| `motion.scroll` (W-319, Normal only; `scrollMotion` before schema 18) | `{ effects, range }` or `{ type: \"none\" }`. Each effect is `{ type, from, to }`: `type` is `fade`, `move-x`, `move-y`, `scale`, `rotate` or `blur` (one of each). `range` is `enter`, `cross`, `exit` or `page`. `none` stops motion a wider device set | CSS scroll-driven animations. Reduced motion, and browsers without them, show the element still |\n| `iconRotate` (W-237, icons) | whole degrees −360 to 360 | `--emvb-icon-rotate`, read by the icon's `svg` as `rotate` |\n| `iconFlip` (W-237, icons) | `none`, `horizontal`, `vertical`, `both` | `--emvb-icon-flip` (`1 1`, `-1 1`, `1 -1`, `-1 -1`), read by the `svg` as `scale` |\n| `iconScale` (W-237) | number 0.1–4 | `scale` on the element (the icon and its background shape) |\n| `iconStrokeWidth` (W-237, outline icons) | number 0.25–6 | `--emvb-icon-stroke`; applies when the stored SVG's root has a stroke width of 1, 1.5, 2, 2.5 or 3 (render moves it into an `emvb-icon-sw<w>` class) |\n| `iconShadow` (W-237, icons) | `{ x, y, blur, color? }`: px, `x` and `y` −100 to 100, `blur` 0–100 | `--emvb-icon-shadow` as `drop-shadow(Xpx Ypx Bpx [colour])`, read by the `svg` as `filter` (follows the outline) |\n| `motion.icon` (W-237, Normal only; `iconAnimation` before schema 18) | `{ type, duration }`: `type` `spin` or `pulse`; `duration` whole ms 200–10000; optional `loop: true` (W-853, D-059) keeps it running forever. Or `{ type: \"none\" }` (W-248), which stops an animation a device inherits from a wider one | `--emvb-icon-animation` (`emvb-icon-spin <ms> linear <runs>`, `emvb-icon-pulse <ms> ease-in-out <runs> alternate` or `none`; W-848: `<runs>` is as many whole runs as fit in 5 s, at least one, even for a pulse; with `loop: true` it is `infinite`); the icon base CSS turns it off under `prefers-reduced-motion: reduce` |\n\n**W-088 additions are additive.** Every new key and unit is optional and every earlier value keeps its meaning, so stored pages and classes are valid unchanged. The version moved to 2 (D-031) with a v1 → v2 step that changes nothing, so an older EmVB shows \"saved by a newer EmVB\" rather than an invalid-layout error. The keys are the same on `node.style` and on `design.classes[].style`. The generator builds each value from typed numbers and keywords only and runs the same `isSafeCssValue` gate as every other property; anything else is dropped with a `rejected-style` warning. A shadow colour bound to a colour variable counts as a use of that variable, and deleting the variable clears it from the page layout and from class styles.\n\n### State styles (W-089)\n\n`node.states` and `design.classes[].states` are `{ \"hover\"?, \"focus\"?, \"active\"? }`. Each state is a style object with the same keys, limits and variable references as `style`, except `motion` (transition, entrance, scroll and icon motion), which belongs to Normal only. Any other state name is refused. Adding `states` moved the version to 3 (D-032) with a v2 → v3 step that changes nothing.\n\n```json\n{\n \"id\": \"btn00001\",\n \"type\": \"button\",\n \"props\": { \"text\": \"Go\" },\n \"style\": { \"backgroundColor\": \"#1d4ed8\", \"motion\": { \"transition\": { \"duration\": 200, \"easing\": \"ease-out\", \"property\": \"colors\" } } },\n \"states\": { \"hover\": { \"backgroundColor\": \"#1e3a8a\" }, \"focus\": { \"borderColor\": \"#f59e0b\" } }\n}\n```\n\n- **Selectors.** `hover` is `:hover`, `focus` is `:focus-visible` (keyboard focus, so a mouse click leaves no focus style); a linked Heading or Icon also matches when its inner link has keyboard focus (`:has(> :is(.emvb-heading-link,.emvb-icon-link):focus-visible)`, W-242) and `active` is `:active`.\n- **Cascade.** Each selector's base rule is followed by its `:hover`, `:focus-visible` and `:active` rules, classes first and then the local rule. So a state rule beats every Normal rule (a class's Hover colour shows over a local Normal colour), within one state the local rule beats the class, and Active beats Focus, which beats Hover.\n- **Safety.** State values go through the same mappers and `isSafeCssValue` gate as `style`. A rejected value is dropped with a `rejected-style` warning naming `<state>.<key>` (such as `hover.color`); a `motion` inside a state is refused by validation and dropped by the renderer and reported the same way, and so is an unknown state name. An unknown variable in a state is reported like one in `style`. An element whose only styles are states still gets `emvb-e-<id>`.\n- **Reduced motion.** When any rule has a `transition`, the CSS ends with one `@media (prefers-reduced-motion: reduce){…{transition:none}}` block that lists exactly those selectors. Nothing else changes under reduced motion.\n- **Editor preview.** The canvas CSS repeats every state rule for `[data-emvb-state=\"hover\"|\"focus\"|\"active\"]`, and the editor sets that attribute on the selected element while a state is chosen in the Style tab. Public CSS has neither the attribute nor those selectors.\n\n### Per-device styles (W-096)\n\n`node.devices` and `design.classes[].devices` are `{ \"laptop\"?, \"tablet\"?, \"mobile\"? }` (`laptop` since W-956). Each is a style object with the same keys as `style`. Only keys that differ from the wider devices are stored. `node.hiddenOn` and `design.classes[].hiddenOn` are arrays of `\"desktop\"`, `\"laptop\"`, `\"tablet\"` and `\"mobile\"` (at most one of each). Desktop itself stays in `style`.\n\n- **Queries.** Laptop is `@media (max-width: 1366.98px)`, then tablet `@media (max-width: 1024.98px)`, then mobile `@media (max-width: 767.98px)`. A narrower screen matches every wider query, so the narrowest device wins on a shared key, and a laptop-only key still applies on tablets and phones. The tablet and mobile bounds match `deviceForWidth` (under 768 mobile, under 1025 tablet), which popup targeting and visitor rules use (a laptop is desktop there).\n- **Hide.** Each device has its own query, so `display: none` does not leak: desktop `(min-width: 1367px)`, laptop `(min-width: 1025px) and (max-width: 1366.98px)`, tablet `(min-width: 768px) and (max-width: 1024.98px)`, mobile `(max-width: 767.98px)`. An element hidden on both Desktop and Laptop gets the one rule `(min-width: 1025px)`. Before W-956, `\"desktop\"` meant every screen from 1025 px; schema 17 pages are upgraded to `[\"desktop\", \"laptop\", …]` on read, so they render byte for byte as before.\n- **Grids.** Column counts have no laptop value: laptops use the desktop columns. The `.98` keeps fractional widths from zoom or display scaling (1024.5, say) inside one device, so nothing slips between two hide queries (W-506).\n- **Wide screen (W-959, 1.1).** An own `style.wide` record holds the values for 2400 px and up, in `@media (min-width: 2400px)`, built on Desktop's (the narrower devices never overlap it). `style.wide.hidden` overrides the Desktop hide there: `true` adds `(min-width: 2400px)` for an element not hidden on Desktop; `false` on an element hidden on Desktop stops its Desktop rule at `2399.98px`. Without `hidden`, Wide screen follows Desktop and the CSS is what it was. The renderer reads it as one more device (`renderableNode` moves it to `devices.wide` and `wideHidden`). Grid column counts have no Wide screen value.\n- **States.** Hover, focus and active stay all-viewport. Device overrides edit Normal only.\n- **Version.** Adding these fields moved the version to 5 (D-036) with a v4 → v5 step that changes nothing.\n\n## Design system document\n\n```json\n{\n \"schemaVersion\": 17,\n \"variables\": {\n \"colors\": [{ \"id\": \"brand\", \"name\": \"Brand\", \"value\": \"#0055ff\" }],\n \"fonts\": [{ \"id\": \"body\", \"name\": \"Body\", \"value\": \"Noto Sans, sans-serif\" }],\n \"fontSizes\": [{ \"id\": \"lg\", \"name\": \"Large\", \"value\": { \"value\": 24, \"unit\": \"px\" } }],\n \"spacings\": [{ \"id\": \"md\", \"name\": \"Medium\", \"value\": { \"value\": 16, \"unit\": \"px\" } }]\n },\n \"classes\": [{ \"id\": \"card\", \"name\": \"Card\", \"style\": { \"paddingTop\": { \"value\": 16, \"unit\": \"px\" } } }]\n}\n```\n\n- Colour ids are 1–40 of `a-z 0-9 -`, names 1–60 characters, values hex as above. At most 200 colours.\n- A colour may set `dark` (a hex, 1.4, W-1067): its value when the visitor's system prefers dark and no Theme toggle chose light, and whenever one chose dark. The page CSS repeats those variables (with `color-scheme: dark`) under `@media (prefers-color-scheme: dark)` for `.emvb-root` outside `[data-emvb-theme=\"light\"]`, and for `.emvb-root` inside `[data-emvb-theme=\"dark\"]`. Colours without `dark` are the same in both.\n- A font may set `family`, `faces` and `source` (1.4, W-1072): its own WOFF2 files, written as `@font-face` rules on pages whose CSS uses the variable. [SCHEMA.md](../SCHEMA.md) has the limits and checks, [Custom fonts](../guides/custom-fonts.md) the editor side.\n- The document is at most 256 KiB (`MAX_DESIGN_BYTES`).\n- A font size or spacing variable may set `fluid: { min, max }` (px, 0–1000). It is emitted as `clamp()` between `fluidRange` (unset is 360 to 1280 px; `minWidth` must be less than `maxWidth`). `value` stays the fixed fallback (W-316).\n- `direction` is `ltr`, `rtl` or `auto` (unset is left to right). It is `dir` on every EmVB root, and hosts get it back for `<html dir>` (W-230).\n- `defaults` is a starting style per tag (`h1`–`h6`, `p`, `a`, `button`), emitted under `:where(.emvb-root)` so a class still wins. The `button` default also reaches Button elements that have a URL and so render as `<a>` (`:where(.emvb-root) a:where(.emvb-button)`, the same tag weight, after the `a` default so it wins over it there); Link elements get only the `a` default (1.4.1, W-1090).\n\n## Limits and validation\n\n`validateLayout()` runs on every save (the plugin's `beforeSave` hook) and on every read (editor and public render), in this order:\n\n1. **Size:** the JSON is at most 512 KiB (`MAX_LAYOUT_BYTES`) in UTF-8 bytes.\n2. **Version:** `upgradeLayout()` runs the migration chain up to the current version. A document from a newer EmVB is refused with \"Update EmVB to edit it\", never downgraded.\n3. **Structure:** at most 2000 nodes (`MAX_NODES`) and 24 levels (`MAX_DEPTH`), checked iteratively before parsing.\n4. **Schema:** the Zod schema above.\n5. **Ids:** every node id is unique.\n\nIssues carry a path such as `root.children[0].props.level`, which the editor uses to select the element at fault. A layout that fails on read renders nothing on the public page and logs only the page id (R-033).\n\n## Rendered output\n\n- The root gets `emvb-root`, each node `emvb-<type>` and, when its style, a state, a device override or a hide flag yields a rule, `emvb-e-<id>`. Invalid style values are dropped with a render warning. A reference to an unknown variable is kept and also reported as a warning. Unknown element types render nothing publicly and a placeholder with `data-emvb-id` in the editor (warning `unknown-type`). An unknown node still keeps `dir`, `container` and `query` (W-352), so a later version that understands the type still has them.\n- The CSS is, in order: `@font-face` rules for the custom font variables the CSS uses (W-1072, see [Custom fonts](../guides/custom-fonts.md)), variables on `.emvb-root` (`--emvb-c-*` colours, `--emvb-f-*` fonts, `--emvb-fs-*` font sizes, `--emvb-s-*` spacings) and the colours' dark values (W-1067), base CSS for the element types in use, then class rules (W-030), then one `.emvb-e-<id>{…}` rule per styled node (R-021). Each class and local rule is followed by its state rules, then the tablet media query, the mobile media query and the hide queries (see [Per-device styles](#per-device-styles-w-096)). A reduced-motion block closes the CSS when a transition is set (see [State styles](#state-styles-w-089)).\n- **Style classes** (`design.classes[]`): `{ id, name, style, states?, devices?, hiddenOn? }`. Elements list ids in `node.classes`; HTML gets `emvb-k-<id>` in that order. When two classes set the same property, the one later in `design.classes` wins, because its rule comes later in the stylesheet. Local `.emvb-e-<id>` rules come after every class, so local styles win. `classStylesInListOrder` feeds `resolveCascade` in that list order.\n- Length/font style props may use `{ \"var\": \"<id>\", \"from\": \"spacing\"|\"fontSize\"|\"font\" }` (colours keep `{ \"var\": \"<id>\" }`). Offsets (`top`, `right`, `bottom`, `left`) take spacing variables; the shadow colour takes a colour variable.\n- Text and attributes are escaped by the serializer. Public output has no scripts and no editor `data-emvb-*` attributes (such as `data-emvb-id`). The only `data-emvb-*` attributes it carries are these public hooks (`PUBLIC_DATA_ATTRIBUTES` in `core/public-attributes.ts`, kept in step with this list by a test): `data-emvb-theme-part` on a theme part's wrapper ([theme-parts.md](theme-parts.md#public-render)); `data-emvb-loop-item` (the post id) on each Loop item; `data-emvb-popup`, `data-emvb-popup-config` and `data-emvb-popup-dismiss` on popup chrome; `data-emvb-float`, `data-emvb-float-dismiss` and `data-emvb-float-edge` on float chrome; `data-emvb-menu-empty` on an empty Menu; the widget hooks their opt-in runtimes read: `data-emvb-alert-dismiss` (Alert), `data-emvb-lightbox` (Gallery), `data-emvb-arrows`, `data-emvb-dots`, `data-emvb-autoplay` and `data-emvb-loop` (Carousel), `data-emvb-counter` (Counter), `data-emvb-countdown` (Countdown), `data-emvb-map` (Map), `data-emvb-rotate` (Animated headline), `data-emvb-share-list` and `data-emvb-share` (Share buttons); `data-emvb-theme-toggle` on a Theme toggle (W-1067); `data-emvb-sticky-hide` on an element that hides while scrolling down (W-1070); and `data-emvb-ext` (the element type) on an extension element's wrapper. The runtimes may add their own state attributes after load (`data-emvb-menu-dismissed`, `data-emvb-ready`, `data-emvb-shown`, and `data-emvb-theme` on `<html>`).\n\n## Changing the format\n\n- Add a migration `LAYOUT_MIGRATIONS[n]` (pure, version n to n + 1) and bump `LAYOUT_SCHEMA_VERSION` in the same change.\n- Add fixtures and tests for the old and new shapes, and update this file.\n- `test/docs/layout-format.test.ts` checks this file's title, the \"literal `N`\" sentence and the JSON examples against the code, so a schema bump must update them.\n\n## S8 additive elements (W-072–W-074)\n\n- **`div-block`**: block container (`display:block`); children like Container. Optional `href` and `newTab`, like Container.\n- **`flexbox`**: flex container defaulting to row + wrap + gap (Container stays column). Optional `href` and `newTab`.\n- **`svg`**: `props.markup` (sanitized allowlist; no scripts/handlers/`use`/`foreignObject`); optional `title`, `decorative`, `size`. A valid non-square `viewBox` keeps its ratio: the longer side is `size` (48 when unset) and the other side scales. A square, missing, or unreadable `viewBox` stays a square of `size`.\n- **`tabs` / `tab-panel`**: Tabs hold only tab-panels. Public markup is CSS-only (radio + `:has()`); the optional tabs script only takes the hidden radios out of the tab order.\n- **`accordion` / `accordion-item`**: items are `<details>`. An item needs `summary` (1–200) and may start `open`. No script.\n- **`menu` / `menu-item`**: a `nav` (named by `label`, default \"Menu\") of links. `direction` is `row` or `column`. An item with children is a dropdown; `wide` stretches that panel across the menu. A menu with a dropdown can load the optional menu script so Escape closes it. An empty menu is a plain box, not a `nav`.\n - **Mega menu (W-1069, 1.4, additive):** `panelPartId` (string, at most 128) names a Section theme part whose layout fills the item's panel in place of its children; `panelWidth` (a length) is that panel's width, or its widest when `wide` (unset: its content's width, at most the screen less 2rem). The panel is the same `<details>` disclosure as any dropdown (class `emvb-menu-panel--mega`, item `emvb-menu-item--mega`), so it opens by click, tap, Enter or Space and on hover with a fine pointer, with no script; the menu script, loaded as for any dropdown, adds Escape and closing on a click outside. The part renders under the synced-section guards: a part already being rendered (a panel that shows itself, directly or through other parts) and parts past the depth limit (8) or the render's element budget count as missing. A missing, unpublished or empty part leaves the item's own children, so an item without children is a plain link. On phones (below 768px) the panel stacks inline under its item instead of floating. Its rules (`menu-mega` base CSS) are sent only with a page that renders a mega panel, so other menus' markup and CSS are unchanged.\n- **`grid`** also takes optional `href` and `newTab`.\n\n\n## Schema 13: the W-307 feature batch\n\nSchema 13 only adds optional fields, so a v12 document upgrades unchanged.\n\n### Collection Loops (W-308)\n\nA `loop` with `props.collection` (a collection slug) lists that collection's published entries\ninstead of the archive's posts. `limit` (1–50, default 6), `order` (`newest`, `oldest`, `title`),\n`display` (`list`, `grid`, `cards`) and `columns` (1–6) are optional. Hosts fill\n`dynamic.collections[loopId]` (see `collectCollectionLoops`). A `loop-empty` child is left out of\nthe item design and rendered when there are no entries; it is only valid inside a `loop`.\n\n### Data bindings (W-307)\n\nAny node may carry `bind`: prop name → `{ source, key }`. `source` is `post` (a post field such as\n`title`, or any plain field of the entry by name, for example `role`), `site` (a site setting:\n`title`, `tagline`, `url`, `social.github`…) or `param` (a URL parameter). Which props can be bound\nis fixed per element (`BINDABLE_FIELDS`: text, links, image source and alt). The typed prop stays as\nthe fallback when the source has no value. Bound values are plain text, capped at 500 characters,\nand go through the element's own escaping and link and image URL checks.\n\nA link or image bound to `param` only takes same-site URLs: relative ones, or absolute ones on the\npage's origin (hosts pass it as `dynamic.origin`). Anything else shows the typed value, unless the\nbinding sets `outside: true` (\"Allow outside sites\" in the editor). Anyone can craft a URL\nparameter, so that option lets them point the page's links and images at any site.\n\n### A/B tests and visitors (W-312, W-313, W-329)\n\nAny node may set `variant`: `{ test, arm, split? }`. `test` is a name of lowercase letters, digits and `-` (up to 32). `arm` is `a` or `b`. `split` (on the B element, 1–99, unset = 50) is the share of visitors who see B. The host picks one arm per visitor and keeps it in a cookie.\n\n`audience` shows or hides the element. Every field that is set must match, and `hide: true` flips that to \"everyone except\":\n\n- `countries`: two-letter codes, 1–50\n- `devices`: `mobile`, `tablet`, `desktop`\n- `visitor`: `new` or `returning`, from the first-party `emvb_seen` cookie (one year, HttpOnly). Only a page with this rule reads or sets it. `emvb({ visitorCookie: \"consent\" | \"never\" })` holds it back (W-1092), and then everyone counts as `new`\n- `hours`: `{ from, to }` (0–23 and 0–24; wraps past midnight when `to` < `from`) and `days` (0 = Sunday), in `timeZone` (an IANA name; unset = UTC)\n- `segments` (W-329): 1–20 names the host passes (`member`, `pro`), lowercase letters, digits, `-` and `_`\n\nA rule the host cannot check does not match. Pages with a variant or an audience are sent `Cache-Control: private, no-store`.\n\n## Schema 14\n\nSchema 14 only adds optional fields, so a v13 document upgrades unchanged.\n\n- **Visitor segments (W-329).** `audience.segments`, above. Hosts pass them as `resolveEmVBPage(Astro, { visitor: { segments } })` and the same option on `resolveThemeParts`. `country`, `device` and `returning` on that object replace what EmVB detects.\n- **Loop fields (W-330).** On a collection Loop, `permalink` is a site path containing `{slug}` or `{id}` (unset is `/<collection>/{slug}`). `imageField` and `excerptField` name the entry fields Post Image and Post Excerpt read (unset is `featured_image` and `excerpt`; since 1.4.1, an entry with no `featured_image` image shows its first image field, W-1090). The editor offers the collection's image fields as a list. An image field's value is read from its `src` or `url`, or, for an upload picked in EmDash's admin (which stores no `src`), from `meta.storageKey` as `/_emdash/api/media/file/<key>`, as EmDash's own image component does. `filter` is up to five `field=value` pairs separated by `;`. A taxonomy name filters by term, and the same field twice matches either value.\n- **`ch` and negative margins (W-331).** Lengths may use `ch`. Margins may be negative (−10000 to 10000). Padding stays 0 or more.\n\n## Internal proposal records (W-928)\n\nProposals are review data in the plugin-storage collection `emvb_proposals`, not page\nrevisions. A row holds `{ proposal, createdAt }`, keyed by a server-generated 16-hex id.\nThe version-1 proposal is `{ version: 1, target: { collection, id }, baseRevision,\nbaseDesignRevision, ops }`. The plugin adapter currently reads the target entry's\n`layout` field (native visual pages and theme parts); arbitrary host canvas-field\nselection is not part of this transport. `baseRevision` is EmDash's current `_rev`.\n`baseDesignRevision` is the effective draft style revision, or the published style\nrevision when no draft exists, or null on an empty site. It is checked only when\nclass/variable ops are present, so page-only proposals survive unrelated style edits.\n\nOperations run in list order against frozen schema 18 ids and names:\n\n- `insert`: `{ kind, parentId, index, node }` — a complete stored node/subtree.\n- `move`: `{ kind, id, parentId, index }` — uses editor drop rules; index addresses\n the destination children **before** removal, as in `moveNode`.\n- `update`: `{ kind, id, set }` — editable node fields only. `props` shallow-merges;\n other fields replace their whole value, and null clears an optional node field.\n `id`, `type` and `children` cannot be patched. Use `editorLabel`, `props.partId`\n and `style.motion`, not their old aliases.\n- `delete`: `{ kind, id }` — never the root.\n- `class`: `{ kind, id, value }` — full class upsert, or null to remove an existing id.\n- `variable`: `{ kind, group, id, value }` — full variable upsert/removal;\n group is `colors`, `fonts`, `fontSizes` or `spacings`. Payload ids must match the\n operation id. Names must already be clean and unique in their list; no truncation.\n\n`applyProposal(base, proposal, selectedIndexes?)` returns a new `{ layout, design }`\nonly: it cannot save, publish, acquire an edit lock, or change review/undo state.\nSelected indexes refer to the original list; selection order cannot reorder ops.\nEach selected intermediate result passes stored-layout/design validation, nesting\nrules and the existing URL/SVG/CSS/font allowlists. Unknown layout keys still use\nthe frozen contract's keep-and-ignore rules. A dependency on an omitted operation,\na missing id, a bad node, a duplicate id, an invalid index or any other refusal\naborts the entire preview. Nothing is partially returned or persisted. W-930 must\nfeed accepted results through normal undo and draft saves, including the existing\nsite-wide guards for shared-style deletion; this store never writes site styles.\n\nCreation checks **all** ops and re-reads the base before storage. `STALE_BASE` reports\nexpected/current revisions and asks the caller to read the current document and\nsubmit a rebased proposal; there is no merge/retry/override. Preparation rechecks the\nlive revisions, so keeping or reading an old proposal does not make it applicable.\nGet/list are review reads, not an applicability guarantee; malformed rows are refused\nby get and omitted by list. Per-isolate serialization matches saved sections; there\nis no distributed content transaction (the final draft save still needs its own CAS).\n\nBudgets: 100 ops, 512 KiB JSON, 64 JSON nesting levels, and 100 stored proposals per\nsite; resulting layouts/designs retain all existing byte/node/depth limits. Cycles,\nnon-JSON values and prototype-manipulation keys are refused before parsing.\n\nPlugin-local editor transport mirrors saved sections: `proposals` (target-filtered\nlist), `proposals/get`, `proposals/create`, `proposals/withdraw`. Every route requires\n`content:edit_any` and EmDash's private-request/CSRF guard. These are not public/MCP\nAPIs; W-929 adds MCP tools and W-930 adds review UI later. Withdrawal only removes\nreview data; it cannot affect a page. No per-op review states or agent publish path\nare implemented here.\n\n## 1.2 widgets (W-1018–W-1025)\n\nAdded in 1.2, additive: new element types only, so an older 1.x keeps them on save and leaves them out of\nthe page (see Unknown element types above). Each renders without script.\n\n| Type | `props` | Children | Renders as |\n| --- | --- | --- | --- |\n| `rating` (shown as \"Star rating\", W-1023) | `value` (0–10, any decimal; shown to one decimal), optional `max` (whole number 1–10, unset 5; a `value` above it shows as `max`, so lowering it never makes a page invalid), `label` (≤ 120; `{value}` and `{max}` are filled in; unset \"Rated {value} out of {max}\"), `size` (8–128 px per star, unset 20) | none | `<div role=\"img\" aria-label=\"Rated 4.5 out of 5\">` with one `aria-hidden` star SVG per point, filled in the element's text colour; a part-filled star is the filled star cut by its `viewBox` over a 25 % star. Right to left, stars fill from the right |\n| `alert` (W-1025) | `variant` (`info`, `success`, `warning`, `danger`), optional `title` (≤ 200), `text` (≤ 2000; line breaks kept), optional `hideIcon`, `dismissible`, `dismissLabel` (≤ 80, unset \"Dismiss\") | none | `<div role=\"note\" class=\"emvb-alert emvb-alert-<variant>\">` in the variant's colours (text on background at least 7:1, overridable by the element's styles), its `aria-hidden` icon unless `hideIcon`, then the title and text paragraphs. `dismissible` adds `<button type=\"button\" data-emvb-alert-dismiss aria-label=\"Dismiss\">`, hidden by CSS until the opt-in alerts runtime marks it ready; that script hides the Alert on press and moves focus to the next focusable element. The page then lists `\"alerts\"` in `runtimes` |\n| `icon-box` (W-1020) | `iconId` and optional `iconSvg` (as on `icon`), `iconSize` (8–512 px, unset 48), `title` (≤ 200), optional `titleLevel` (2–6, unset 3), `text` (≤ 2000, line breaks kept), optional `position` (`top`, `left`, `right`; unset `top`), `href`, `newTab` | none | `<div class=\"emvb-icon-box emvb-media-box emvb-media-box-<position>\">` with the icon `aria-hidden` in `.emvb-media-box-media`, then `<hN class=\"emvb-media-box-title\">` and `<p class=\"emvb-media-box-text\">`. With a safe `href` the title is wrapped in `<a class=\"emvb-media-box-link\">`, whose `::after` covers the box, so the whole box is clickable through one named link. An empty title or text is left out |\n| `image-box` (W-1021) | the picture keys of `image`: `src`, `alt` (required unless `decorative`), optional `mediaId`, `width`, `height`, `focalX`, `focalY` (kept for the media library; a box doesn't crop); optional `imageSize` (`small` 25 %, `medium` 40 %, `large` 60 %, `full`; the picture's share of the width when beside the words, unset `medium`); and the title, text, position and link keys of `icon-box` | none | as `icon-box`, class `emvb-image-box` (plus `emvb-image-box-<size>` unless medium), with `<img loading=\"lazy\" decoding=\"async\">` and its `width`/`height` in `.emvb-media-box-media`; no media part without a safe `src` |\n| `testimonial` (W-1022) | `quote` (≤ 2000, line breaks kept), `name` (≤ 200), optional `role` (≤ 200), optional photo keys `src`, `alt` (written by the media library, not rendered), `mediaId`, `width`, `height`, `focalX`, `focalY`; optional `rating` (0–10) and `ratingMax` (1–10, unset 5) | none | `<figure class=\"emvb-testimonial\">`: the rating as in `rating` (`role=\"img\"`, \"Rated 5 out of 5\") when `rating` is set, `<blockquote class=\"emvb-testimonial-quote\"><p>`, then `<figcaption>` with the photo (48 px, round, `alt=\"\"`: the name is beside it) and the name and role |\n| `social-icons` (W-1024) | optional `label` (≤ 80, unset \"Social media\"), `shape` (`plain`, `circle`, `rounded`, `square`; unset `plain`), `brandColors` | `children`: Social links only, at most 20 | `<ul class=\"emvb-social-icons emvb-social-<shape>\" aria-label=\"Social media\">`; icons are one em, so the element's font size sizes them (1.5em by default). Badges draw the icon in white on the text colour, or on each network's colour with `brandColors` |\n| `social-link` (W-1024) | `network` (one of `facebook`, `instagram`, `x`, `linkedin`, `youtube`, `tiktok`, `bluesky`, `mastodon`, `threads`, `github`, `pinterest`, `whatsapp`, `discord`, `twitch`, `reddit`, `dribbble`, `behance`, `telegram`, `spotify`, `email`, `rss`, `website`), `href` (≤ 2000), optional `label` (≤ 80, the link's name; unset the network's name), `newTab` | none; only inside `social-icons` | `<li class=\"emvb-social-link emvb-social-<network>\"><a href aria-label=\"Instagram\">` around the preset's `aria-hidden` SVG (Font Awesome Free, CC BY 4.0, generated into `core/icons/social.generated.ts`). Without a safe `href` the icon shows dimmed in a `<span aria-hidden>` with no link |\n| `gallery` (W-1019) | optional `layout` (`grid` squares or `masonry`; unset `grid`), `columns` (1–6, unset 3; at most 2 up to 1024 px wide and 1 up to 767 px), `lightbox`, `label` (≤ 80) | `children`: Gallery images only, at most 60 | `<ul class=\"emvb-gallery emvb-gallery-<layout> emvb-gallery-cols-<n>\">`, named by `label`. `lightbox` adds `data-emvb-lightbox` and lists `\"lightbox\"` in `runtimes`: that script turns each picture into a \"View larger: <alt>\" button opening one native modal `<dialog>` with Previous/Next (and arrow keys), a spoken \"2 of 5\", Close and Escape; focus returns to the picture |\n| `gallery-image` (W-1019) | the picture keys of `image` (`src`, `alt` required unless `decorative`, `mediaId`, `width`, `height`, `focalX`, `focalY`) and optional `caption` (≤ 500) | none; only inside `gallery` | `<li class=\"emvb-gallery-image\"><figure>` with a lazy `<img>` and its `<figcaption>`; no picture without a safe `src` |\n| `carousel` (W-1018) | optional `label` (≤ 80, unset \"Carousel\"), `perView` (1–4, unset 1; at most 2 up to 1024 px, 1 up to 767 px), `arrows`, `dots`, `autoplay`, `interval` (3–30 seconds, unset 6), `loop` | `children`: Slides only, at most 20 | `<section aria-roledescription=\"carousel\" aria-label=\"Carousel\">` with a focusable `<div class=\"emvb-carousel-track\" tabindex=\"0\">` that scrolls and snaps to each slide with no script (`aria-live` polite, off while autoplaying). `arrows`, `dots` or `autoplay` add `data-emvb-*` options and list `\"carousel\"` in `runtimes`: that script adds Previous/Next (disabled at the ends unless `loop`), one \"Go to slide n\" button per view position (`aria-current`), and for autoplay a Pause/Play button before the slides; autoplay pauses while hovered or focused and starts paused under `prefers-reduced-motion` |\n| `carousel-slide` (W-1018) | optional `label` (≤ 80) | `children: Node[]`; only inside `carousel` | `<div role=\"group\" aria-roledescription=\"slide\" aria-label=\"2 of 5\">` (or its `label`) |\n\n**Widget runtimes (W-1025).** `renderPage` returns `runtimes`, the opt-in widget scripts the rendered\nelements asked for (sorted; empty for most pages). `renderStored` and `resolveThemeParts` set it only\nwhen it is not empty. `EmVBPage` mounts them itself; a site layout mounts its theme parts' with\n`<EmVBWidgetRuntimes names={theme.runtimes} />` from `@perkyzz/emvb/astro/widgets`. The HTML/CSS\nexport writes each one next to the pages that use it (`assets/emvb-alerts.js`, `assets/emvb-lightbox.js`, `assets/emvb-carousel.js`). The names are `alerts`, `lightbox` and `carousel` (1.2); `counter`, `countdown`, `map`, `headline` and `share` (1.3); `sticky` (Hide while scrolling down) and `theme` (Theme toggle) (1.4); and `ext:<package>` for an extension's own runtime ([EXTENSIONS.md](../EXTENSIONS.md), 1.4).\n\n## 1.3 marketing widgets (W-1038–W-1048)\n\nNew element types only (layout schema stays 18): a page that uses them can't be opened by EmVB\n1.2, which keeps them on save without showing them. Each renders without script; the opt-in\nscripts are listed in `runtimes`.\n\n| Type | `props` | Children | Renders as |\n| --- | --- | --- | --- |\n| `counter` (W-1038) | `value` (−10¹² to 10¹²), optional `start` (same range, unset 0), `decimals` (0–3, unset 0), `separator` (`,` `.` space or `'`; unset none; with `.` the decimal mark is `,`), `prefix` and `suffix` (≤ 20), `title` (≤ 200), `countUp`, `duration` (300–5000 ms, unset 2000) | none | `<div class=\"emvb-counter\">` with `<p class=\"emvb-counter-number\">` (prefix, `<span class=\"emvb-counter-value\">` holding the final number, suffix) and the title paragraph. `countUp` adds `data-emvb-counter`, `data-from`, `data-to`, `data-decimals`, `data-separator` and `data-duration` to the value and lists `\"counter\"` in `runtimes`; that script counts from `start` when the number scrolls into view, with a hidden copy of the final number for screen readers while it counts, and does nothing under reduced motion |\n| `progress` (shown as \"Progress bar\", W-1039) | `value` (0–10⁶), optional `max` (above 0, ≤ 10⁶, unset 100; a `value` above it shows as full), `label` (≤ 120), `showValue`, `kind` (`meter` or `progressbar`, unset `meter`), `thickness` (2–48 px, unset 8), `grow` | none | `<div class=\"emvb-progress\">` with an optional head (the label and, with `showValue`, an `aria-hidden` percentage), then `<div role=\"meter\" aria-label=\"…\" aria-valuemin=\"0\" aria-valuemax aria-valuenow aria-valuetext=\"75%\">` holding an `aria-hidden` SVG: a 20 % track and a fill `rect` as wide as the share, in the element's text colour, no inline styles. `grow` adds the `emvb-progress-grow` class, whose fill grows in with a CSS scroll-driven animation, only where supported and not under reduced motion. Right to left, it fills from the right |\n| `countdown` (W-1040) | `target` (`YYYY-MM-DDTHH:MM[:SS]` with `Z` or a `±HH:MM` offset, a real date), optional `title` (≤ 200), `label` (≤ 40, unset \"Ends\"), `ticking`, `hideSeconds`, `expired` (`text`, `hide` or `link`, unset `text`), `expiredText` (≤ 200, unset \"This offer has ended.\"), `expiredHref` (a link, sanitised like any) | none | `<div class=\"emvb-countdown\">` with the title and `<p>Ends <time datetime=\"…\">1 Dec 2026, 09:00 UTC−5</time></p>`, the date written in the target's own offset. `ticking` adds `data-emvb-countdown`, `data-target` and `data-expired`, a clock (`aria-hidden` days, hours, minutes and seconds, without seconds under `hideSeconds`) with a `Pause` button (`aria-pressed`), and the ended paragraph (a link with `link`, none with `hide`); CSS hides the clock until the opt-in countdown runtime marks it ready and the ended text until it is shown. The runtime ticks every second (no live region), stops on Pause, and at the target shows the ended text and hides the clock, or hides the Countdown. The page then lists `\"countdown\"` in `runtimes` |\n| `map` (W-1041) | `address` (1–300, line breaks kept), optional `provider` (`osm` or `google`, unset `osm`), `lat` (−90 to 90) and `lng` (−180 to 180), `zoom` (1–19, unset 15), `linkText` (≤ 80, unset \"Open in OpenStreetMap\" or \"Open in Google Maps\"), `embed`, `height` (150–800 px, unset 360) | none | `<div class=\"emvb-map\">` with the address paragraph and `<a class=\"emvb-map-link\" rel=\"noopener\">` to the place (a search for the address, or a marker at `lat`/`lng`). `embed` (with `lat`/`lng` for OpenStreetMap) adds `data-emvb-map` and a `.emvb-map-frame` holding `data-src`, `data-title` (\"Map of\" the address's first line) and `data-height`, a \"Show the map\" button and a note naming the service; CSS hides it until the opt-in map runtime marks the Map ready. Pressed, the runtime replaces it with a titled, lazy `<iframe>` (only `https://www.openstreetmap.org/export/embed.html?…` or `https://www.google.com/maps?…`) and moves focus to it, so the page requests nothing from the map service before that. Hosts with a Content Security Policy add `frame-src https://www.openstreetmap.org https://www.google.com`. The page then lists `\"map\"` in `runtimes` |\n| `price-table` (shown as \"Price table\", W-1042) | `title` (≤ 120), optional `titleLevel` (2–6, unset 3), `description` (≤ 500), `price` (≤ 20, text such as `29.99` or `Free`), optional `currency` (≤ 5), `period` (≤ 40), `regularPrice` (≤ 20), `features` and `excluded` (≤ 30 lines of ≤ 200 each), `buttonText` (≤ 80), `buttonHref` (a link, sanitised), `newTab`, `featured`, `ribbon` (≤ 30, unset \"Featured\") | none | `<div class=\"emvb-price-table\">` (plus `emvb-price-table-featured` and a ribbon paragraph when `featured`), the title heading, the description, `<p class=\"emvb-price-table-price\">` with the regular price in `<s>` when on sale (with \"Regular price:\" and \"Sale price:\" for screen readers only), the amount with its currency and the period; a list of included features with a check mark and excluded ones with a cross, struck through and introduced as \"Not included:\" for screen readers; then the button link (left out without text or a safe link; `newTab` adds `target=\"_blank\" rel=\"noopener noreferrer\"`). No script |\n| `price-list` (shown as \"Price list\", W-1043) | optional `label` (≤ 80) | `children: Node[]`, Price list items only, at most 50 | `<ul class=\"emvb-price-list\" aria-label=\"…\">` (no name without `label`) |\n| `price-list-item` (W-1043) | `title` (≤ 120), `price` (≤ 20, text), optional `description` (≤ 500), `src` with an Image's picture keys and `alt` (≤ 500; unset or empty: decorative), `href` (a link, sanitised), `newTab` | none; only inside `price-list` | `<li class=\"emvb-price-list-item\">` with the picture first (`loading=\"lazy\"`), then `<p class=\"emvb-price-list-head\">` holding the title (a link with `href`), an `aria-hidden` dotted leader and the price, and the description paragraph. No script |\n| `cta` (shown as \"Call to action\", W-1044) | `title` (≤ 200), optional `titleLevel` (2–6, unset 3), `text`, `src` with an Image's picture keys and `alt` (unset or empty: decorative), `layout` (`behind`, `top`, `left`, `right`; unset `behind`), `buttonText` (≤ 80), `href` (a link, sanitised), `newTab`, `ribbon` (≤ 30) | none | `<div class=\"emvb-cta emvb-cta-<layout>\">` (`top` without a picture) with the ribbon, the picture in `.emvb-cta-media` (behind: covering the box under a 55 % black overlay, the words in white), then the title heading, text and button. With a safe `href` the title holds the one link, `emvb-cta-linked` stretches it over the whole box, and the button is an `aria-hidden` span; without one there is no link or button. No script |\n| `flip-box` (shown as \"Flip box\", W-1045) | `frontTitle` (≤ 200), optional `frontText`, `backTitle` (≤ 200), `backText`, `titleLevel` (2–6, unset 3), `buttonText` (≤ 80), `href` (a link, sanitised), `newTab`, `direction` (`right`, `left`, `up`, `down`; unset `right`), `toggleLabel` (≤ 40, unset \"Turn over\") | none | `<div class=\"emvb-flip-box emvb-flip-<direction>\">` holding `.emvb-flip-inner` with two faces stacked in one grid cell (the box is as tall as the taller face), each with its title and text, the back with the button link; then `<label class=\"emvb-flip-toggle\"><input type=\"checkbox\" class=\"emvb-flip-check\">Turn over</label>`. CSS turns the inner on hover (only under `(hover:hover)`), when the checkbox is ticked, and when keyboard focus is inside the back face; both faces stay in the accessibility tree. Reduced motion drops the transition. No script |\n| `headline` (shown as \"Animated headline\", W-1046) | optional `level` (1–6, unset 2), `before` and `after` (≤ 200), `highlight` (1–120), `mark` (`underline`, `circle`, `strike`, `none`; unset `underline`), `rotate` (≤ 10 words of ≤ 120), `rotating`, `interval` (1.5–10 s, unset 2.5), `turns` (1–5, unset 2) | none | `<hN class=\"emvb-headline emvb-headline-<mark>\">before <span class=\"emvb-headline-mark\">highlight</span> after</hN>`, counted as a heading by the accessibility check. The mark is drawn once by CSS (a growing gradient, or an `aria-hidden` SVG circle), already drawn under reduced motion. `rotating` with other words adds `data-emvb-rotate` (the words as JSON), `data-interval` and `data-turns` and lists `\"headline\"` in `runtimes`; the runtime hides the changing word from screen readers (they read the sentence with the first word), adds a Pause button after the heading, and stops on the first word after its rounds or on Pause; nothing rotates under reduced motion |\n| `share-buttons` (shown as \"Share buttons\", W-1047) | optional `label` (≤ 80, unset \"Share this page\"), `shape` (as Social icons), `brandColors`, `nativeShare` | `children: Node[]`, Share links only, at most 12 | `<ul class=\"emvb-share-buttons emvb-share-<shape>\" aria-label=\"Share this page\">`. `nativeShare` adds a last item with `<button type=\"button\" class=\"emvb-share-native\" data-emvb-share>Share…</button>`, hidden by CSS until the opt-in share runtime finds the browser's `navigator.share` and marks the list ready; pressed, it opens the share sheet for the page. The page then lists `\"share\"` in `runtimes` |\n| `share-link` (W-1047) | `network` (`facebook`, `x`, `linkedin`, `whatsapp`, `telegram`, `reddit`, `bluesky`, `threads`, `email`), optional `label` (≤ 80) | none; only inside `share-buttons` | `<li class=\"emvb-share-<network>\"><a href=\"…\" aria-label=\"Share on Facebook\" target=\"_blank\" rel=\"noopener noreferrer\">` with the network's `aria-hidden` icon; the address is the service's own share link with the page URL encoded in it (email: `mailto:?body=…`, same tab). The page URL comes from the host as `dynamic.pageUrl` (`resolveEmVBPage` and `resolveThemeParts` fill it with the request's origin and path when a layout has Share buttons); without it a public page renders no share links, and the editor uses `https://example.com/`. No tracking script |\n| `hotspots` (W-1048) | `src` and `alt` with an Image's picture keys and `decorative`, optional `label` (≤ 80, unset \"Points on the picture\") | `children: Node[]`, Hotspots only, at most 20 | `<div class=\"emvb-hotspots\">` with the picture (`loading=\"lazy\"`; the accessibility check wants its alt text as for an Image) and `<ol class=\"emvb-hotspots-list\" aria-label=\"…\">` of markers numbered by a CSS counter |\n| `hotspot` (W-1048) | `title` (1–120), optional `text` (≤ 1000), `x` and `y` (0–100 %), optional `xTablet`, `yTablet`, `xMobile`, `yMobile` (unset: the wider device's) | none; only inside `hotspots` | `<li>` placed by its own CSS rule (`left`/`top` in percent, tablet and phone values in their media queries), holding `<button type=\"button\" popovertarget=\"emvb-hotspot-<id>\" aria-label=\"title\">` and `<div id=\"emvb-hotspot-<id>\" popover=\"auto\">` with the title and note. The native Popover API opens and closes it (Escape, click outside) with no script; where `position-area` is supported the note sits by its marker, elsewhere in the middle of the screen. `popover`, `popovertarget` and `popovertargetaction` joined the markup attribute allowlist |\n\n## 1.4 additions (W-1067–W-1086)\n\nAdditive, as in 1.2 and 1.3: layout schema 18 and design schema 17 stay, a page that uses a new\nelement type can't be shown by EmVB 1.3, which keeps it on save, and every new key is optional.\nTwo new element types:\n\n| Type | `props` | Children | Renders as |\n| --- | --- | --- | --- |\n| `search-form` (W-1073) | optional `action` (≤ 500; a site path or web address, unset or refused `/search`), `label` (≤ 80, unset \"Search\"), `placeholder` (≤ 120), `buttonText` (≤ 40, unset \"Search\") | none | `<form role=\"search\" aria-label=\"…\" method=\"get\" action=\"…\">` with `<input type=\"search\" name=\"q\" aria-label=\"…\">` and `<button type=\"submit\">`. No script: the browser sends `?q=` to the search page, as EmDash's own Search widget does. Never inside a `form` (the save refuses it, as a form in a form) |\n| `theme-toggle` (W-1067) | optional `label` (≤ 40, unset \"Dark mode\") | none | `<button type=\"button\" aria-pressed=\"false\" data-emvb-theme-toggle>`, shown only once the opt-in `theme` runtime marks it ready. The runtime keeps a choice in `localStorage` (`emvb-theme`) and sets `<html data-emvb-theme=\"light\\|dark\">`, which the page CSS reads before the system setting; `aria-pressed` says whether dark is on |\n\nNew optional keys on existing records:\n\n- `menu-item` `panelPartId` and `panelWidth`: a mega menu panel (see `menu` / `menu-item` above).\n- `motion.sticky` in a style record: scroll effects for a sticky or fixed element (see the style\n table above).\n- A colour variable's `dark` and a font variable's `family`, `faces` and `source` (see Design\n system document above).\n- A popup's triggers: `panel` (off-canvas panel), and `advanced.urlParams`, `advanced.from` and\n `advanced.until` (see [theme-parts.md](theme-parts.md)).\n\nExtensions may also put allowlisted classes on their output and ship their own stylesheet and\nruntime ([EXTENSIONS.md](../EXTENSIONS.md)); none of that is stored in a layout.\n";
6501
+ var layout_format_default = "# Layout format (schema 18)\n\nHow EmVB stores a page and its site-wide design, at layout schema 18 and design schema 17, schema contract 1.0 (W-925, D-065: renames, motion under `motion`, unknown keys kept; see [docs/SCHEMA.md](../SCHEMA.md)); Loop forever on an icon animation in W-853, D-059; the image editor's `edit` record on images in W-481; per-element direction, image link and caption, button icons, table of contents, container queries, and focal points in W-341 onward; visitor segments in W-329; Loop fields in W-330; `ch` lengths and negative margins in W-331). The source of truth is the code: `packages/emvb/src/core/schema/` (Zod schemas), `core/limits.ts`, `core/validate.ts` and `core/migrate/`. Update this file in the same change as any of them (ARCHITECTURE.md § Documentation).\n\n## Where it lives\n\n- **Pages** are entries in the hidden `emvb_pages` collection (D-012, D-019). The layout is the `layout` field (EmDash type `json`, shown with the read-only `emvb:layout` widget). The other fields are `title`, `canvas_mode` (`site-layout` or `blank`) and EmDash's own slug, status, revision and SEO fields. EmDash may hand a `json` field back as a string, so readers accept both (`renderStored` in `src/astro/render.ts`).\n- **The design system** (colours, fonts, font sizes, spacings; classes in W-030) is one document in plugin storage, collection `design`, key `system` (D-013). Editors save a draft at key `draft` through `POST /_emdash/api/plugins/emvb/design/save` (W-100, D-040 proposed). `POST .../design/publish` copies that draft onto `system`. The public `GET /_emdash/api/plugins/emvb/design` returns `system` only.\n\n## Page layout\n\n```json\n{\n \"schemaVersion\": 18,\n \"root\": {\n \"id\": \"root0001\",\n \"type\": \"container\",\n \"props\": {},\n \"style\": { \"flexDirection\": \"column\", \"gap\": { \"value\": 16, \"unit\": \"px\" } },\n \"children\": [\n {\n \"id\": \"head0001\",\n \"type\": \"heading\",\n \"props\": { \"text\": \"Welcome\", \"level\": 1 },\n \"style\": { \"color\": { \"var\": \"brand\" } }\n }\n ]\n }\n}\n```\n\n- `schemaVersion` is the literal `18` (D-031, D-032, D-034, D-036, D-038, D-039, D-041, D-042, D-044, W-141, D-045, W-160, W-307, W-329, W-341, W-481, W-885, W-925; older documents are upgraded on read by steps that change nothing, except v11 → v12, which rewrites a gradient's `from` and `to` into `stops`, and v17 → v18 (W-925), which renames `section` to `part-ref`, a node's `label` to `editorLabel` and a Loop's `itemPartId` to `partId`, and moves `transition`, `entrance`, `scrollMotion` and `iconAnimation` under `style.motion`). `root` is always a container.\n- Every node has `id` (4–24 of `A-Z a-z 0-9 _ -`, unique within the page), `type`, `props`, and optional `style`, `states` (W-089, see [State styles](#state-styles-w-089)), `classes` (up to 20 ids of 1–40 of `a-z 0-9 -`, rendered as `emvb-k-<id>`), `bind` (W-307), `variant` (an A/B arm, W-312) and `audience` (who sees it, W-313, W-329).\n- Objects are strict: unknown keys are rejected, not ignored.\n- **Unknown element types** (W-022 / R-033): a node whose `type` is not in the known set is kept on save (`id` rules still apply; `props` is an open record; every shared node field, including `devices` and `hiddenOn`, is allowed and checked as on known nodes; optional `children` are validated recursively). Public pages omit it; the editor shows a selectable placeholder. Damaged known nodes (wrong props) still fail validation with path-specific issues.\n\n\n| Type | `props` | Children | Renders as |\n| --- | --- | --- | --- |\n| `container` | optional `tag` (`div`, `section`, `header`, `footer`, `main`, `article`, `aside`, `nav`), optional `href` and `newTab` (the box is the link; a link inside a link is dropped) | `children: Node[]` (required, may be empty) | that tag (default `div`) with `class=\"emvb-container …\"` |\n| `layout-section` (shown as \"Section\", W-156) | optional `tag` (as `container`, default `section`), `contentWidth` length, `fullWidth` boolean | `children: Node[]` | that tag with `class=\"emvb-layout-section …\"`, wrapping `<div class=\"emvb-layout-section-inner\">` around the children; the inner box is at most `contentWidth` (default 1140 px, none with `fullWidth`) wide and centred |\n| `heading` | `text` (≤ 2000), `level` (1–6), optional `href` (≤ 2000) and `newTab` (W-141), optional `marks` (W-950, see below) | none | `<h1>`–`<h6>`; with a safe `href`, the text is wrapped in `<a class=\"emvb-heading-link\">` (colour and decoration inherited) |\n| `spacer` | `height` length | none | `<div aria-hidden=\"true\">` with height in CSS |\n| `divider` | `{}` | none | `<hr>` |\n| `text` | `text`, optional `tag` (`p` \\| `div`), optional `marks` (W-950) | none | `<p>` or `<div>`; formatted words as below |\n| `label` | `text` | none | `<span>` |\n| `link` | `text`, `href`, optional `newTab` | none | `<a href>` (+ `target`/`rel` when `newTab`) |\n| `button` | `text`, optional `href` and `newTab` | none | `<a href>` when `href` is safe, else `<button type=\"button\">` |\n| `list` | `items` (string[], ≤ 200), optional `ordered`; W-952: optional `marker` (`disc`, `circle`, `square`, `decimal`, `decimal-leading-zero`, `lower-alpha`, `upper-alpha`, `lower-roman`, `upper-roman`, `steps`, `none`; a number style or `steps` makes it numbered) and `start` (1–9999, numbered only) | none | `<ul>` or `<ol>` (with `start`) with `<li>`; the marker is `list-style-type`, `steps` adds `emvb-list--steps` (numbers in circles, CSS sent only when used) |\n| `image` | `src`, `alt`, optional `decorative`, `width`, `height`, `mediaId`, `edit` (editor-only image-editor record, never rendered; see below) | none | `<img loading=\"lazy\">` (decorative → empty `alt` + `role=\"presentation\"`) |\n| `icon` | `iconId` (a bundled Lucide id, or `<set prefix>:<name>` from the icon library, W-236), optional `iconSvg` (the picked icon's SVG, ≤ 32768 chars, W-234 / W-239; `iconId` `upload:<id>` for an uploaded SVG), optional `singleColor` (W-238: `true` paints a picked SVG's own fills, strokes and stops in `currentColor`), `size`, `decorative`, `title`, `href` (≤ 2000) and `newTab` (W-141); a non-empty `href` needs a `title` | none | Inline `<svg>`: `iconSvg` sanitized again at render (allowlist; size, id, role and aria attributes replaced), else the bundled Lucide icon (unknown id and no `iconSvg` → placeholder; never a remote URL); with a safe `href`, the svg is hidden inside `<a class=\"emvb-icon-link\" aria-label=\"title\">` |\n| `video` | `url`, `title`, optional `mediaId` | none | YouTube/Vimeo privacy `<iframe loading=\"lazy\">` or media `<video controls>` (no autoplay) |\n| `form` | `formId` (forms-plugin id; may be empty until bound), optional `nextLabel` and `prevLabel` (≤ 80, W-1065: the step buttons, unset \"Next\" and \"Previous\") | `children: Node[]` (form fields + submit; no nested forms) | Bound: `<form class=\"emvb-form ec-form\" …>`. Unbound: editor placeholder `data-emvb-form-unbound`; omitted on public (no forms runtime). |\n| `form-step` (W-1065) | optional `title` (≤ 200) | `children: Node[]`; only directly inside a `form` | `<fieldset class=\"emvb-form-step ec-form-page\" data-page=\"<n>\" tabindex=\"-1\">` with `<legend>` (untitled: `aria-label=\"Step <n+1>\"`): the forms plugin's multi-page markup. The form adds `<p data-ec-progress aria-live=\"polite\">` before the first step and `<div class=\"emvb-form-step-nav\">` with hidden `data-ec-prev` / `data-ec-next` buttons after the last. The forms script shows one step at a time and checks a step before Next; without it every step shows. Content outside the steps (an intro, Submit) stays outside the pages |\n| `text-input` | `field`, optional `label`, `placeholder`; W-1065: optional `inputType` (`number`, `date`), `min`, `max` (±10¹²), `step` (> 0), `minDate`, `maxDate` (YYYY-MM-DD, a real day) | none | labelled `<input class=\"ec-form-input\">` + `data-error-for`. Type: the bound field's own (`email`, `tel`, `url`, `number`, `date`), else `inputType` when the field is plain text. A number gets `min`/`max` (the field's own limits win) and `step` (unset `any`); a date gets `min`/`max` from `minDate`/`maxDate`. A range with nothing in it is left off |\n| `textarea` | `field`, optional `label`, `placeholder` | none | labelled `<textarea class=\"ec-form-input\">` + `data-error-for` |\n| `select` | `field`, optional `label`, `placeholder` (words the empty first choice; unset is \"Choose…\", W-686) | none | labelled `<select>` (options from the public form definition when available) |\n| `checkbox` | `field`, optional `label` | none | labelled `<input type=\"checkbox\" value=\"true\">` |\n| `radio` | `field`, optional `label`, `placeholder` | none | `<fieldset>` of radios (options from definition when available) |\n| `submit` | optional `label` | none | `<button type=\"submit\" class=\"ec-form-submit\">` |\n| `post-title` | optional `level` (1–6) | none | Dynamic heading from `ThemeDynamicData.post` |\n| `post-excerpt` | optional `maxWords` (whole number, 1–10000, W-177) | none | Dynamic excerpt paragraph; with `maxWords`, cut to that many words with \"…\" |\n| `post-content` | (none) | none | Dynamic body (Portable Text → safe blocks) |\n| `post-image` | optional `decorative` | none | Dynamic featured image when URL present |\n| `post-link` | optional `text`, `newTab` | none | Dynamic permalink; blank text → title |\n| `post-date` | optional `format`: `medium` (default), `short`, `long`, `full` or `numeric` (W-177) | none | `<time datetime>` with the published date in UTC; `numeric` is YYYY-MM-DD |\n| `post-author` | (none) | none | The author's name |\n| `pagination` | optional `prevText`, `nextText`, `showCount` and `countText` (`{page}` and `{total}`; unset text is \"Page {page} of {total}\"), `titleText` (the paged archive title, `{title}` and `{page}`, W-529), `archiveTitle` (replaces \"Posts\" as the posts archive title, ≤ 60, W-532), and screen reader names `navLabel` (\"Pagination\"), `pageLabel` (\"Page {page}\"), `prevLabel` and `nextLabel` (\"Previous page\" / \"Next page\", used when the text is only an arrow), each ≤ 60 (W-689) | none | `nav` of Previous, page numbers and Next. Nothing on a single page, with no archive data, or inside a Loop item |\n| `loop` | optional `partId` (the item part; `itemPartId` before schema 18); `perPage` (1–50, unset = 20) on an archive; a collection Loop also takes `collection`, `limit`, `order`, `display`, `columns`, `permalink`, `imageField`, `excerptField` and `filter` (see [Schema 13](#schema-13-the-w-307-feature-batch) and [Schema 14](#schema-14)) | `children: Node[]` (inline item template when no part id) | Repeats the item template for each post or collection entry |\n| `grid` | `columns` (1–12); optional `columnsTablet` and `columnsMobile` (1–12, W-139); optional `columnTracks`, `columnTracksTablet`, `columnTracksMobile` (1–12 tracks: `1fr`, `2fr`, `3fr`, `auto`, `min-content`, `max-content`, or a length) | `children: Node[]` | `display: grid` with that many equal columns, or the custom tracks when that device sets them; the device values go in the tablet and mobile media queries, and an unset one follows the next wider device |\n| `part-ref` (shown as \"Theme section\"; `section` before schema 18) | optional `partId` | `children: Node[]` (inline contents when no part id) | When `partId` is set, the published Section theme part's children replace the local ones |\n\nAn image's optional `edit` (W-481, D-061) is written by the image editor and never rendered. `src`, `mediaId`, `width` and `height` point at the edited file; `edit` points back at the original: `v` (`1`), `engine` (`\"photocn\"`), `engineVersion` (such as `\"0.1.2\"`), `recipe` (photocn's `RecipeV1`, strict: sliders −1 to 1, blur and curve points 0 to 1, at most 32 points per curve channel, straighten ±45°, a filter name of up to 32 letters, digits, spaces, `_` or `-`, a blend image only as a site path or `https:` URL, at most 16 KB as JSON), optional `originalMediaId`, `originalSrc` (up to 2000 characters), `output` (`format` `webp`, `jpeg` or `png`, optional `quality` 0.1 to 1, optional `maxSide` 16 to 10000 px, `stripGps` boolean) and `editedAt` (an ISO 8601 timestamp).\n\nEvery node may also carry an optional `editorLabel` (`label` before schema 18; 1–80 characters, trimmed; an editor-only name shown in Layers and on the canvas, never rendered, W-157), optional `htmlId` (CSS `id`, unique on the page, theme parts included: a header and a page are rendered apart, so EmVB can't rename an id you chose without breaking links to it (W-1077); since 1.1.2 an id that names a browser global such as `location` or `document` is kept in the layout but not rendered, S-12), `classes` (style-class ids from the design system, S4), `devices` and `hiddenOn` (W-096, below).\n\n**Forms (S5):** form fields are only valid inside a `form` (or under one). Pages with a form set `needsFormsRuntime`; the host route loads `EmVBFormsRuntime` so `initForms` handles AJAX submit. Pages without a form stay zero EmVB JS (R-031).\n\n### Style properties (W-017, extended in W-088)\n\n**Text marks (W-950).** `marks` on a Heading or Text is up to 100 ranges `{ \"start\", \"end\", \"bold\"?: true, \"italic\"?: true, \"color\"?: colour, \"href\"?, \"newTab\"?: true }` over its `text` (characters `start` to `end`, end not included, 0–2000). They render as `<strong>`, `<em>`, `<span class=\"emvb-mark-c<n>\">` (the colour as `--emvb-mark-<n>` on the element, up to 8 per element; `.emvb-mark-c<n>{color:var(--emvb-mark-<n>)}` is sent only when a page uses one) and `<a class=\"emvb-mark-link\">` (checked like any link; left out inside a linked heading). Ranges past the text are clipped when drawn, so editing the text never invalidates a page; the editor moves them with the words.\n\nLengths are `{ \"value\": 0–10000, \"unit\": \"px\" | \"rem\" | \"em\" | \"%\" | \"vw\" | \"vh\" | \"ch\" }` (`vw` and `vh` since W-088, `ch` since W-331). Colours are hex or `{ \"var\": \"<id>\" }`. A **size** is a length, a variable reference or `\"auto\"`. An **offset** is a size whose value may also be negative (−10000 to 10000). A **fluid size** (W-955) is `{ \"fluid\": { \"min\": 0–10000, \"max\": 0–10000 } }` in px: written as `clamp()` growing from `min` on 360 px wide screens to `max` on 1280 px ones (the formula the design's fluid sizes use); `fontSize`, `gap`, the width and height keys, padding and margins (and the offsets) take one.\n\n| Key | Value | CSS |\n| --- | --- | --- |\n| `flexDirection` | `row`, `column`, `row-reverse`, `column-reverse` | `flex-direction` |\n| `flexWrap` | `nowrap`, `wrap`, `wrap-reverse` | `flex-wrap` |\n| `justifyContent` | `flex-start`, `flex-end`, `center`, `space-between`, `space-around`, `space-evenly` | `justify-content` |\n| `alignItems` | `stretch`, `flex-start`, `flex-end`, `center`, `baseline` | `align-items` |\n| `gap` | length | `gap` |\n| `gridColumnSpan` / `gridRowSpan` (W-099) | whole number 1–12 | `grid-column` / `grid-row` as `span N` |\n| `gridColumnStart` / `gridRowStart` | whole number 1–13 | `grid-column` / `grid-row` as the line number, or `start / span N` when a span is set too |\n| `width` / `height` | size | `width` / `height` |\n| `minWidth` / `maxWidth` / `minHeight` / `maxHeight` | length | matching size properties (`maxHeight` since W-088) |\n| `flexGrow`, `flexShrink` (W-954) | number 0–100 | `flex-grow`, `flex-shrink`: a Flexbox or Container child's share of free space, and of the shortfall |\n| `flexBasis` (W-954) | length or `auto` | `flex-basis`: the child's starting size along the row or column |\n| `alignSelf` (W-954) | `auto`, `stretch`, `flex-start`, `flex-end`, `center`, `baseline` | `align-self`: the child's own cross-axis alignment (`auto` follows the parent's Align) |\n| `order` (W-954) | whole number −99 to 99 | `order`: the child's place among its siblings (lower first) |\n| `overflow` | `visible`, `hidden`, `clip`, `scroll`, `auto` | `overflow` |\n| `overflowX`, `overflowY` (W-957) | same as `overflow` | `overflow-x`, `overflow-y`, after `overflow` so one axis wins |\n| `aspectRatio` | `\"auto\"` or `\"w/h\"` with whole numbers 1–9999, such as `\"16/9\"` | `aspect-ratio` (`16 / 9`) |\n| `objectFit` | `fill`, `contain`, `cover`, `none`, `scale-down` | `object-fit` (the editor offers it on Image and Video) |\n| `objectPosition` (W-957) | `center`, `top`, `bottom`, `left`, `right`, `top left`, `top right`, `bottom left`, `bottom right` | `object-position` (Image and Video) |\n| `paddingTop` / `Right` / `Bottom` / `Left` | length | `padding-*` |\n| `marginTop` / `Right` / `Bottom` / `Left` | offset (negative since W-331) | `margin-*` |\n| `position` | `static`, `relative`, `absolute`, `fixed`, `sticky` | `position` |\n| `top` / `right` / `bottom` / `left` | offset | matching inset properties |\n| `zIndex` | whole number −9999 to 9999 | `z-index` |\n| `fontFamily` | a font stack (1–200, checked as safe) or a font variable | `font-family` |\n| `fontSize` | length | `font-size` |\n| `lineHeight` | length, or a unitless number 0–100 | `line-height` |\n| `letterSpacing` | length whose value may be negative (−10000 to 10000) | `letter-spacing` |\n| `fontWeight` | `100`–`900` in steps of 100, `normal`, `bold` | `font-weight` |\n| `textAlign` | `left`, `center`, `right`, `justify` | `text-align` |\n| `textTransform` | `none`, `uppercase`, `lowercase`, `capitalize` | `text-transform` |\n| `textDecoration` | `none`, `underline`, `overline`, `line-through` | `text-decoration` (W-113; a button sets `none` in its base CSS) |\n| `markerColor`, `markerSize` (W-952, Lists) | colour; length | `--emvb-marker-color`, `--emvb-marker-size`, read by the marker and step rules (sent only when a page sets them) |\n| `fontStyle` (W-957) | `normal`, `italic` | `font-style` |\n| `whiteSpace` (W-957) | `normal`, `nowrap`, `pre-line`, `pre-wrap` | `white-space` (a Text element defaults to `pre-line`) |\n| `overflowWrap` (W-957) | `normal`, `break-word`, `anywhere` | `overflow-wrap` |\n| `color` / `backgroundColor` / `borderColor` | colour | matching colour properties |\n| `backgroundImage` (W-094) | http(s) URL or a site path, no spaces, quotes or parentheses | `background-image` as `url(\"…\")`. With no size, position or repeat: `cover`, `center`, `no-repeat` |\n| `backgroundVideo` | the same URL rule as `backgroundImage` | a muted, looping `<video>` behind the content |\n| `backgroundSize` | `auto`, `cover`, `contain` | `background-size` (the image layer) |\n| `backgroundPosition` | `center`, an edge (`top`, `bottom`, `left`, `right`) or a corner (`top left` and the other three) | `background-position` |\n| `backgroundRepeat` | `no-repeat`, `repeat`, `repeat-x`, `repeat-y` | `background-repeat` |\n| `gradient` | `{ type, angle?, position?, stops }`: `type` `linear`, `radial` or `conic`; `angle` whole degrees 0–360 (the linear direction, default 180, or the conic start, default 0); `position` (the radial centre, default `center`) takes the `backgroundPosition` values; `stops` are 2–10 `{ color, at }`, `color` a colour and `at` a whole % 0–100 | `linear-gradient`, `radial-gradient` (a circle) or `conic-gradient`, stops in `at` order, behind the image |\n| `overlay` | `{ color, opacity: 0–1 }`, or since W-949 `{ gradient, opacity?: 0–1 }` with the same `gradient` shape | a colour or gradient layer above the image (a scrim). Hex becomes 8-digit hex; a colour variable becomes `color-mix`; a gradient overlay's `opacity` (unset = 1) fades every stop |\n| `borderWidth` / `borderRadius` | length | matching border properties: every side or corner |\n| `borderTopWidth`, `borderRightWidth`, `borderBottomWidth`, `borderLeftWidth` (W-138) | length | `border-top-width`, `border-inline-end-width`, `border-bottom-width`, `border-inline-start-width`, after `border-width`, so a side beats it |\n| `borderTopLeftRadius`, `borderTopRightRadius`, `borderBottomRightRadius`, `borderBottomLeftRadius` (W-138) | length or a spacing variable | `border-start-start-radius`, `border-start-end-radius`, `border-end-end-radius`, `border-end-start-radius`, after `border-radius` |\n| `borderStyle` | `none`, `solid`, `dashed`, `dotted` | `border-style` |\n| `opacity` | number 0–1 (the editor shows 0–100 %) | `opacity` |\n| `boxShadow` | `{ x, y, blur, spread, color?, inset? }`: px numbers, `x`, `y` and `spread` −1000 to 1000, `blur` 0 to 1000; `color` is a colour; `inset` is a boolean | `box-shadow` as `[inset] Xpx Ypx Bpx Spx [colour]`; no colour means the text colour |\n| `filter` | `{ blur?, brightness?, contrast?, saturate?, grayscale?, hueRotate? }`, at least one set: `blur` 0–100 px, `brightness` / `contrast` / `saturate` 0–300 %, `grayscale` 0–100 %, `hueRotate` 0–360° | `filter`, functions always in that order, such as `blur(2px) grayscale(100%)` |\n| `backdropFilter` (W-957) | the same object as `filter` | `backdrop-filter`, applied to what is behind the element (frosted glass) |\n| `transform` (W-953) | `{ x?, y?, scale?, rotate? }`, at least one: `x` and `y` whole px −2000 to 2000, `scale` whole % 10–400, `rotate` whole degrees −360 to 360 | `translate`, `scale` and `rotate` (CSS's own properties, so an entrance never cancels it; a scroll motion or loop on the same property wins while it runs). In a hover state it is a lift; animate it with a `transform` transition |\n| `cursor` | `default`, `pointer`, `text`, `move`, `grab`, `not-allowed`, `help`, `crosshair`, `zoom-in` | `cursor` |\n| `motion.transition` (W-089, Normal only) | `{ duration, delay?, easing, property }`: `duration` and `delay` whole ms 0–2000; `easing` `ease`, `ease-in`, `ease-out`, `ease-in-out`, `linear`; `property` `all`, `colors`, `opacity`, `shadow`, `filter`, `transform` (W-953). No other keys | `transition`, one entry per CSS property: `colors` is `color`, `background-color` and `border-color`; `shadow` is `box-shadow`; `transform` is `translate`, `scale` and `rotate`. For example `opacity 200ms ease-out 50ms` |\n| `motion.entrance` (W-101, Normal only) | `{ type, duration, delay?, trigger? }`: `type` is `fade`, `fade-up`, `fade-down`, `slide-up`, `slide-down` or `scale`; `duration` and `delay` whole ms 0–2000; `trigger` is `load` (default) or `view` (as it scrolls in; browsers without scroll-driven animations play it on load) | `animation` named `emvb-<type>`, once, `ease-out`, `both`. Reduced motion sets `animation: none` |\n| `motion.sticky` (W-1070, Normal only; 1.4) | `{ distance?, background?, shadow?, padding?, hide? }` (at least one effect) or `{ type: \"none\" }`. `distance` 10–2000 px (unset 120); `background` a colour; `shadow` true; `padding` a length (top and bottom); `hide` true | Page-scroll animations (`animation-timeline: scroll(root)`, range `0px <distance>px`) to the scrolled look, sent only where scroll-driven animations exist; off for reduced motion. `hide` (on any device) adds `data-emvb-sticky-hide` and the `sticky` runtime, which slides the element away while scrolling down (up, or down when it is held by `bottom` with no `top`) and back on scrolling up, never while focus is inside. Each device's `hide` is written as `--emvb-sticky-hide: 1` or `0` (Desktop `0` unless set; unset on a narrower device keeps the wider one's; `{ type: \"none\" }` is `0`), which the runtime reads at the current width. The slide is a Web Animation, so the element's own `transition` is untouched |\n| `motion.loop` (W-938, Normal only; 1.0) | `{ effects, duration, easing?, alternate?, loop? }` or `{ type: \"none\" }`. `effects` as `motion.scroll`; `duration` 200–20000 ms; `easing` a transition easing (default `ease-in-out`); `alternate` false plays one way; `loop: true` never stops | A time-based CSS animation; stops after about 5 s unless `loop`; off for reduced motion. The accessibility check flags Loop forever and runs over 5 s |\n| `motion.scroll` (W-319, Normal only; `scrollMotion` before schema 18) | `{ effects, range }` or `{ type: \"none\" }`. Each effect is `{ type, from, to }`: `type` is `fade`, `move-x`, `move-y`, `scale`, `rotate` or `blur` (one of each). `range` is `enter`, `cross`, `exit` or `page`. `none` stops motion a wider device set | CSS scroll-driven animations. Reduced motion, and browsers without them, show the element still |\n| `iconRotate` (W-237, icons) | whole degrees −360 to 360 | `--emvb-icon-rotate`, read by the icon's `svg` as `rotate` |\n| `iconFlip` (W-237, icons) | `none`, `horizontal`, `vertical`, `both` | `--emvb-icon-flip` (`1 1`, `-1 1`, `1 -1`, `-1 -1`), read by the `svg` as `scale` |\n| `iconScale` (W-237) | number 0.1–4 | `scale` on the element (the icon and its background shape) |\n| `iconStrokeWidth` (W-237, outline icons) | number 0.25–6 | `--emvb-icon-stroke`; applies when the stored SVG's root has a stroke width of 1, 1.5, 2, 2.5 or 3 (render moves it into an `emvb-icon-sw<w>` class) |\n| `iconShadow` (W-237, icons) | `{ x, y, blur, color? }`: px, `x` and `y` −100 to 100, `blur` 0–100 | `--emvb-icon-shadow` as `drop-shadow(Xpx Ypx Bpx [colour])`, read by the `svg` as `filter` (follows the outline) |\n| `motion.icon` (W-237, Normal only; `iconAnimation` before schema 18) | `{ type, duration }`: `type` `spin` or `pulse`; `duration` whole ms 200–10000; optional `loop: true` (W-853, D-059) keeps it running forever. Or `{ type: \"none\" }` (W-248), which stops an animation a device inherits from a wider one | `--emvb-icon-animation` (`emvb-icon-spin <ms> linear <runs>`, `emvb-icon-pulse <ms> ease-in-out <runs> alternate` or `none`; W-848: `<runs>` is as many whole runs as fit in 5 s, at least one, even for a pulse; with `loop: true` it is `infinite`); the icon base CSS turns it off under `prefers-reduced-motion: reduce` |\n\n**W-088 additions are additive.** Every new key and unit is optional and every earlier value keeps its meaning, so stored pages and classes are valid unchanged. The version moved to 2 (D-031) with a v1 → v2 step that changes nothing, so an older EmVB shows \"saved by a newer EmVB\" rather than an invalid-layout error. The keys are the same on `node.style` and on `design.classes[].style`. The generator builds each value from typed numbers and keywords only and runs the same `isSafeCssValue` gate as every other property; anything else is dropped with a `rejected-style` warning. A shadow colour bound to a colour variable counts as a use of that variable, and deleting the variable clears it from the page layout and from class styles.\n\n### State styles (W-089)\n\n`node.states` and `design.classes[].states` are `{ \"hover\"?, \"focus\"?, \"active\"? }`. Each state is a style object with the same keys, limits and variable references as `style`, except `motion` (transition, entrance, scroll and icon motion), which belongs to Normal only. Any other state name is refused. Adding `states` moved the version to 3 (D-032) with a v2 → v3 step that changes nothing.\n\n```json\n{\n \"id\": \"btn00001\",\n \"type\": \"button\",\n \"props\": { \"text\": \"Go\" },\n \"style\": { \"backgroundColor\": \"#1d4ed8\", \"motion\": { \"transition\": { \"duration\": 200, \"easing\": \"ease-out\", \"property\": \"colors\" } } },\n \"states\": { \"hover\": { \"backgroundColor\": \"#1e3a8a\" }, \"focus\": { \"borderColor\": \"#f59e0b\" } }\n}\n```\n\n- **Selectors.** `hover` is `:hover`, `focus` is `:focus-visible` (keyboard focus, so a mouse click leaves no focus style); a linked Heading or Icon also matches when its inner link has keyboard focus (`:has(> :is(.emvb-heading-link,.emvb-icon-link):focus-visible)`, W-242) and `active` is `:active`.\n- **Cascade.** Each selector's base rule is followed by its `:hover`, `:focus-visible` and `:active` rules, classes first and then the local rule. So a state rule beats every Normal rule (a class's Hover colour shows over a local Normal colour), within one state the local rule beats the class, and Active beats Focus, which beats Hover.\n- **Safety.** State values go through the same mappers and `isSafeCssValue` gate as `style`. A rejected value is dropped with a `rejected-style` warning naming `<state>.<key>` (such as `hover.color`); a `motion` inside a state is refused by validation and dropped by the renderer and reported the same way, and so is an unknown state name. An unknown variable in a state is reported like one in `style`. An element whose only styles are states still gets `emvb-e-<id>`.\n- **Reduced motion.** When any rule has a `transition`, the CSS ends with one `@media (prefers-reduced-motion: reduce){…{transition:none}}` block that lists exactly those selectors. Nothing else changes under reduced motion.\n- **Editor preview.** The canvas CSS repeats every state rule for `[data-emvb-state=\"hover\"|\"focus\"|\"active\"]`, and the editor sets that attribute on the selected element while a state is chosen in the Style tab. Public CSS has neither the attribute nor those selectors.\n\n### Per-device styles (W-096)\n\n`node.devices` and `design.classes[].devices` are `{ \"laptop\"?, \"tablet\"?, \"mobile\"? }` (`laptop` since W-956). Each is a style object with the same keys as `style`. Only keys that differ from the wider devices are stored. `node.hiddenOn` and `design.classes[].hiddenOn` are arrays of `\"desktop\"`, `\"laptop\"`, `\"tablet\"` and `\"mobile\"` (at most one of each). Desktop itself stays in `style`.\n\n- **Queries.** Laptop is `@media (max-width: 1366.98px)`, then tablet `@media (max-width: 1024.98px)`, then mobile `@media (max-width: 767.98px)`. A narrower screen matches every wider query, so the narrowest device wins on a shared key, and a laptop-only key still applies on tablets and phones. The tablet and mobile bounds match `deviceForWidth` (under 768 mobile, under 1025 tablet), which popup targeting and visitor rules use (a laptop is desktop there).\n- **Hide.** Each device has its own query, so `display: none` does not leak: desktop `(min-width: 1367px)`, laptop `(min-width: 1025px) and (max-width: 1366.98px)`, tablet `(min-width: 768px) and (max-width: 1024.98px)`, mobile `(max-width: 767.98px)`. An element hidden on both Desktop and Laptop gets the one rule `(min-width: 1025px)`. Before W-956, `\"desktop\"` meant every screen from 1025 px; schema 17 pages are upgraded to `[\"desktop\", \"laptop\", …]` on read, so they render byte for byte as before.\n- **Grids.** Column counts have no laptop value: laptops use the desktop columns. The `.98` keeps fractional widths from zoom or display scaling (1024.5, say) inside one device, so nothing slips between two hide queries (W-506).\n- **Wide screen (W-959, 1.1).** An own `style.wide` record holds the values for 2400 px and up, in `@media (min-width: 2400px)`, built on Desktop's (the narrower devices never overlap it). `style.wide.hidden` overrides the Desktop hide there: `true` adds `(min-width: 2400px)` for an element not hidden on Desktop; `false` on an element hidden on Desktop stops its Desktop rule at `2399.98px`. Without `hidden`, Wide screen follows Desktop and the CSS is what it was. The renderer reads it as one more device (`renderableNode` moves it to `devices.wide` and `wideHidden`). Grid column counts have no Wide screen value.\n- **States.** Hover, focus and active stay all-viewport. Device overrides edit Normal only.\n- **Version.** Adding these fields moved the version to 5 (D-036) with a v4 → v5 step that changes nothing.\n\n## Design system document\n\n```json\n{\n \"schemaVersion\": 17,\n \"variables\": {\n \"colors\": [{ \"id\": \"brand\", \"name\": \"Brand\", \"value\": \"#0055ff\" }],\n \"fonts\": [{ \"id\": \"body\", \"name\": \"Body\", \"value\": \"Noto Sans, sans-serif\" }],\n \"fontSizes\": [{ \"id\": \"lg\", \"name\": \"Large\", \"value\": { \"value\": 24, \"unit\": \"px\" } }],\n \"spacings\": [{ \"id\": \"md\", \"name\": \"Medium\", \"value\": { \"value\": 16, \"unit\": \"px\" } }]\n },\n \"classes\": [{ \"id\": \"card\", \"name\": \"Card\", \"style\": { \"paddingTop\": { \"value\": 16, \"unit\": \"px\" } } }]\n}\n```\n\n- Colour ids are 1–40 of `a-z 0-9 -`, names 1–60 characters, values hex as above. At most 200 colours.\n- A colour may set `dark` (a hex, 1.4, W-1067): its value when the visitor's system prefers dark and no Theme toggle chose light, and whenever one chose dark. The page CSS repeats those variables (with `color-scheme: dark`) under `@media (prefers-color-scheme: dark)` for `.emvb-root` outside `[data-emvb-theme=\"light\"]`, and for `.emvb-root` inside `[data-emvb-theme=\"dark\"]`. Colours without `dark` are the same in both.\n- A font may set `family`, `faces` and `source` (1.4, W-1072): its own WOFF2 files, written as `@font-face` rules on pages whose CSS uses the variable. [SCHEMA.md](../SCHEMA.md) has the limits and checks, [Custom fonts](../guides/custom-fonts.md) the editor side.\n- The document is at most 256 KiB (`MAX_DESIGN_BYTES`).\n- A font size or spacing variable may set `fluid: { min, max }` (px, 0–1000). It is emitted as `clamp()` between `fluidRange` (unset is 360 to 1280 px; `minWidth` must be less than `maxWidth`). `value` stays the fixed fallback (W-316).\n- `direction` is `ltr`, `rtl` or `auto` (unset is left to right). It is `dir` on every EmVB root, and hosts get it back for `<html dir>` (W-230).\n- `defaults` is a starting style per tag (`h1`–`h6`, `p`, `a`, `button`), emitted under `:where(.emvb-root)` so a class still wins. The `button` default also reaches Button elements that have a URL and so render as `<a>` (`:where(.emvb-root) a:where(.emvb-button)`, the same tag weight, after the `a` default so it wins over it there); Link elements get only the `a` default (1.4.1, W-1090).\n\n## Limits and validation\n\n`validateLayout()` runs on every save (the plugin's `beforeSave` hook) and on every read (editor and public render), in this order:\n\n1. **Size:** the JSON is at most 512 KiB (`MAX_LAYOUT_BYTES`) in UTF-8 bytes.\n2. **Version:** `upgradeLayout()` runs the migration chain up to the current version. A document from a newer EmVB is refused with \"Update EmVB to edit it\", never downgraded.\n3. **Structure:** at most 2000 nodes (`MAX_NODES`) and 24 levels (`MAX_DEPTH`), checked iteratively before parsing.\n4. **Schema:** the Zod schema above.\n5. **Ids:** every node id is unique.\n\nIssues carry a path such as `root.children[0].props.level`, which the editor uses to select the element at fault. A layout that fails on read renders nothing on the public page and logs only the page id (R-033).\n\n## Rendered output\n\n- The root gets `emvb-root`, each node `emvb-<type>` and, when its style, a state, a device override or a hide flag yields a rule, `emvb-e-<id>`. Invalid style values are dropped with a render warning. A reference to an unknown variable is kept and also reported as a warning. Unknown element types render nothing publicly and a placeholder with `data-emvb-id` in the editor (warning `unknown-type`). An unknown node still keeps `dir`, `container` and `query` (W-352), so a later version that understands the type still has them.\n- The CSS is, in order: `@font-face` rules for the custom font variables the CSS uses (W-1072, see [Custom fonts](../guides/custom-fonts.md)), variables on `.emvb-root` (`--emvb-c-*` colours, `--emvb-f-*` fonts, `--emvb-fs-*` font sizes, `--emvb-s-*` spacings) and the colours' dark values (W-1067), base CSS for the element types in use, then class rules (W-030), then one `.emvb-e-<id>{…}` rule per styled node (R-021). Each class and local rule is followed by its state rules, then the tablet media query, the mobile media query and the hide queries (see [Per-device styles](#per-device-styles-w-096)). A reduced-motion block closes the CSS when a transition is set (see [State styles](#state-styles-w-089)).\n- **Style classes** (`design.classes[]`): `{ id, name, style, states?, devices?, hiddenOn? }`. Elements list ids in `node.classes`; HTML gets `emvb-k-<id>` in that order. When two classes set the same property, the one later in `design.classes` wins, because its rule comes later in the stylesheet. Local `.emvb-e-<id>` rules come after every class, so local styles win. `classStylesInListOrder` feeds `resolveCascade` in that list order.\n- Length/font style props may use `{ \"var\": \"<id>\", \"from\": \"spacing\"|\"fontSize\"|\"font\" }` (colours keep `{ \"var\": \"<id>\" }`). Offsets (`top`, `right`, `bottom`, `left`) take spacing variables; the shadow colour takes a colour variable.\n- Text and attributes are escaped by the serializer. Public output has no scripts and no editor `data-emvb-*` attributes (such as `data-emvb-id`). The only `data-emvb-*` attributes it carries are these public hooks (`PUBLIC_DATA_ATTRIBUTES` in `core/public-attributes.ts`, kept in step with this list by a test): `data-emvb-theme-part` on a theme part's wrapper ([theme-parts.md](theme-parts.md#public-render)); `data-emvb-loop-item` (the post id) on each Loop item; `data-emvb-popup`, `data-emvb-popup-config` and `data-emvb-popup-dismiss` on popup chrome; `data-emvb-float`, `data-emvb-float-dismiss` and `data-emvb-float-edge` on float chrome; `data-emvb-menu-empty` on an empty Menu; the widget hooks their opt-in runtimes read: `data-emvb-alert-dismiss` (Alert), `data-emvb-lightbox` (Gallery), `data-emvb-arrows`, `data-emvb-dots`, `data-emvb-autoplay` and `data-emvb-loop` (Carousel), `data-emvb-counter` (Counter), `data-emvb-countdown` (Countdown), `data-emvb-map` (Map), `data-emvb-rotate` (Animated headline), `data-emvb-share-list` and `data-emvb-share` (Share buttons); `data-emvb-theme-toggle` on a Theme toggle (W-1067); `data-emvb-sticky-hide` on an element that hides while scrolling down (W-1070), or on a sticky header or footer part's wrapper (W-1097); and `data-emvb-ext` (the element type) on an extension element's wrapper. The runtimes may add their own state attributes after load (`data-emvb-menu-dismissed`, `data-emvb-ready`, `data-emvb-shown`, and `data-emvb-theme` on `<html>`).\n\n## Changing the format\n\n- Add a migration `LAYOUT_MIGRATIONS[n]` (pure, version n to n + 1) and bump `LAYOUT_SCHEMA_VERSION` in the same change.\n- Add fixtures and tests for the old and new shapes, and update this file.\n- `test/docs/layout-format.test.ts` checks this file's title, the \"literal `N`\" sentence and the JSON examples against the code, so a schema bump must update them.\n\n## S8 additive elements (W-072–W-074)\n\n- **`div-block`**: block container (`display:block`); children like Container. Optional `href` and `newTab`, like Container.\n- **`flexbox`**: flex container defaulting to row + wrap + gap (Container stays column). Optional `href` and `newTab`.\n- **`svg`**: `props.markup` (sanitized allowlist; no scripts/handlers/`use`/`foreignObject`); optional `title`, `decorative`, `size`. A valid non-square `viewBox` keeps its ratio: the longer side is `size` (48 when unset) and the other side scales. A square, missing, or unreadable `viewBox` stays a square of `size`.\n- **`tabs` / `tab-panel`**: Tabs hold only tab-panels. Public markup is CSS-only (radio + `:has()`); the optional tabs script only takes the hidden radios out of the tab order.\n- **`accordion` / `accordion-item`**: items are `<details>`. An item needs `summary` (1–200) and may start `open`. No script.\n- **`menu` / `menu-item`**: a `nav` (named by `label`, default \"Menu\") of links. `direction` is `row` or `column`. An item with children is a dropdown; `wide` stretches that panel across the menu. A menu with a dropdown can load the optional menu script so Escape closes it. An empty menu is a plain box, not a `nav`.\n - **Mega menu (W-1069, 1.4, additive):** `panelPartId` (string, at most 128) names a Section theme part whose layout fills the item's panel in place of its children; `panelWidth` (a length) is that panel's width, or its widest when `wide` (unset: its content's width, at most the screen less 2rem). The panel is the same `<details>` disclosure as any dropdown (class `emvb-menu-panel--mega`, item `emvb-menu-item--mega`), so it opens by click, tap, Enter or Space and on hover with a fine pointer, with no script; the menu script, loaded as for any dropdown, adds Escape and closing on a click outside. The part renders under the synced-section guards: a part already being rendered (a panel that shows itself, directly or through other parts) and parts past the depth limit (8) or the render's element budget count as missing. A missing, unpublished or empty part leaves the item's own children, so an item without children is a plain link. On phones (below 768px) the panel stacks inline under its item instead of floating. Its rules (`menu-mega` base CSS) are sent only with a page that renders a mega panel, so other menus' markup and CSS are unchanged.\n- **`grid`** also takes optional `href` and `newTab`.\n\n\n## Schema 13: the W-307 feature batch\n\nSchema 13 only adds optional fields, so a v12 document upgrades unchanged.\n\n### Collection Loops (W-308)\n\nA `loop` with `props.collection` (a collection slug) lists that collection's published entries\ninstead of the archive's posts. `limit` (1–50, default 6), `order` (`newest`, `oldest`, `title`),\n`display` (`list`, `grid`, `cards`) and `columns` (1–6) are optional. Hosts fill\n`dynamic.collections[loopId]` (see `collectCollectionLoops`). A `loop-empty` child is left out of\nthe item design and rendered when there are no entries; it is only valid inside a `loop`.\n\n### Data bindings (W-307)\n\nAny node may carry `bind`: prop name → `{ source, key }`. `source` is `post` (a post field such as\n`title`, or any plain field of the entry by name, for example `role`), `site` (a site setting:\n`title`, `tagline`, `url`, `social.github`…) or `param` (a URL parameter). Which props can be bound\nis fixed per element (`BINDABLE_FIELDS`: text, links, image source and alt). The typed prop stays as\nthe fallback when the source has no value. Bound values are plain text, capped at 500 characters,\nand go through the element's own escaping and link and image URL checks.\n\nA link or image bound to `param` only takes same-site URLs: relative ones, or absolute ones on the\npage's origin (hosts pass it as `dynamic.origin`). Anything else shows the typed value, unless the\nbinding sets `outside: true` (\"Allow outside sites\" in the editor). Anyone can craft a URL\nparameter, so that option lets them point the page's links and images at any site.\n\n### A/B tests and visitors (W-312, W-313, W-329)\n\nAny node may set `variant`: `{ test, arm, split? }`. `test` is a name of lowercase letters, digits and `-` (up to 32). `arm` is `a` or `b`. `split` (on the B element, 1–99, unset = 50) is the share of visitors who see B. The host picks one arm per visitor and keeps it in a cookie.\n\n`audience` shows or hides the element. Every field that is set must match, and `hide: true` flips that to \"everyone except\":\n\n- `countries`: two-letter codes, 1–50\n- `devices`: `mobile`, `tablet`, `desktop`\n- `visitor`: `new` or `returning`, from the first-party `emvb_seen` cookie (one year, HttpOnly). Only a page with this rule reads or sets it. `emvb({ visitorCookie: \"consent\" | \"never\" })` holds it back (W-1092), and then everyone counts as `new`\n- `hours`: `{ from, to }` (0–23 and 0–24; wraps past midnight when `to` < `from`) and `days` (0 = Sunday), in `timeZone` (an IANA name; unset = UTC)\n- `segments` (W-329): 1–20 names the host passes (`member`, `pro`), lowercase letters, digits, `-` and `_`\n\nA rule the host cannot check does not match. Pages with a variant or an audience are sent `Cache-Control: private, no-store`.\n\n## Schema 14\n\nSchema 14 only adds optional fields, so a v13 document upgrades unchanged.\n\n- **Visitor segments (W-329).** `audience.segments`, above. Hosts pass them as `resolveEmVBPage(Astro, { visitor: { segments } })` and the same option on `resolveThemeParts`. `country`, `device` and `returning` on that object replace what EmVB detects.\n- **Loop fields (W-330).** On a collection Loop, `permalink` is a site path containing `{slug}` or `{id}` (unset is `/<collection>/{slug}`). `imageField` and `excerptField` name the entry fields Post Image and Post Excerpt read (unset is `featured_image` and `excerpt`; since 1.4.1, an entry with no `featured_image` image shows its first image field, W-1090). The editor offers the collection's image fields as a list. An image field's value is read from its `src` or `url`, or, for an upload picked in EmDash's admin (which stores no `src`), from `meta.storageKey` as `/_emdash/api/media/file/<key>`, as EmDash's own image component does. `filter` is up to five `field=value` pairs separated by `;`. A taxonomy name filters by term, and the same field twice matches either value.\n- **`ch` and negative margins (W-331).** Lengths may use `ch`. Margins may be negative (−10000 to 10000). Padding stays 0 or more.\n\n## Internal proposal records (W-928)\n\nProposals are review data in the plugin-storage collection `emvb_proposals`, not page\nrevisions. A row holds `{ proposal, createdAt }`, keyed by a server-generated 16-hex id.\nThe version-1 proposal is `{ version: 1, target: { collection, id }, baseRevision,\nbaseDesignRevision, ops }`. The plugin adapter currently reads the target entry's\n`layout` field (native visual pages and theme parts); arbitrary host canvas-field\nselection is not part of this transport. `baseRevision` is EmDash's current `_rev`.\n`baseDesignRevision` is the effective draft style revision, or the published style\nrevision when no draft exists, or null on an empty site. It is checked only when\nclass/variable ops are present, so page-only proposals survive unrelated style edits.\n\nOperations run in list order against frozen schema 18 ids and names:\n\n- `insert`: `{ kind, parentId, index, node }` — a complete stored node/subtree.\n- `move`: `{ kind, id, parentId, index }` — uses editor drop rules; index addresses\n the destination children **before** removal, as in `moveNode`.\n- `update`: `{ kind, id, set }` — editable node fields only. `props` shallow-merges;\n other fields replace their whole value, and null clears an optional node field.\n `id`, `type` and `children` cannot be patched. Use `editorLabel`, `props.partId`\n and `style.motion`, not their old aliases.\n- `delete`: `{ kind, id }` — never the root.\n- `class`: `{ kind, id, value }` — full class upsert, or null to remove an existing id.\n- `variable`: `{ kind, group, id, value }` — full variable upsert/removal;\n group is `colors`, `fonts`, `fontSizes` or `spacings`. Payload ids must match the\n operation id. Names must already be clean and unique in their list; no truncation.\n\n`applyProposal(base, proposal, selectedIndexes?)` returns a new `{ layout, design }`\nonly: it cannot save, publish, acquire an edit lock, or change review/undo state.\nSelected indexes refer to the original list; selection order cannot reorder ops.\nEach selected intermediate result passes stored-layout/design validation, nesting\nrules and the existing URL/SVG/CSS/font allowlists. Unknown layout keys still use\nthe frozen contract's keep-and-ignore rules. A dependency on an omitted operation,\na missing id, a bad node, a duplicate id, an invalid index or any other refusal\naborts the entire preview. Nothing is partially returned or persisted. W-930 must\nfeed accepted results through normal undo and draft saves, including the existing\nsite-wide guards for shared-style deletion; this store never writes site styles.\n\nCreation checks **all** ops and re-reads the base before storage. `STALE_BASE` reports\nexpected/current revisions and asks the caller to read the current document and\nsubmit a rebased proposal; there is no merge/retry/override. Preparation rechecks the\nlive revisions, so keeping or reading an old proposal does not make it applicable.\nGet/list are review reads, not an applicability guarantee; malformed rows are refused\nby get and omitted by list. Per-isolate serialization matches saved sections; there\nis no distributed content transaction (the final draft save still needs its own CAS).\n\nBudgets: 100 ops, 512 KiB JSON, 64 JSON nesting levels, and 100 stored proposals per\nsite; resulting layouts/designs retain all existing byte/node/depth limits. Cycles,\nnon-JSON values and prototype-manipulation keys are refused before parsing.\n\nPlugin-local editor transport mirrors saved sections: `proposals` (target-filtered\nlist), `proposals/get`, `proposals/create`, `proposals/withdraw`. Every route requires\n`content:edit_any` and EmDash's private-request/CSRF guard. These are not public/MCP\nAPIs; W-929 adds MCP tools and W-930 adds review UI later. Withdrawal only removes\nreview data; it cannot affect a page. No per-op review states or agent publish path\nare implemented here.\n\n## 1.2 widgets (W-1018–W-1025)\n\nAdded in 1.2, additive: new element types only, so an older 1.x keeps them on save and leaves them out of\nthe page (see Unknown element types above). Each renders without script.\n\n| Type | `props` | Children | Renders as |\n| --- | --- | --- | --- |\n| `rating` (shown as \"Star rating\", W-1023) | `value` (0–10, any decimal; shown to one decimal), optional `max` (whole number 1–10, unset 5; a `value` above it shows as `max`, so lowering it never makes a page invalid), `label` (≤ 120; `{value}` and `{max}` are filled in; unset \"Rated {value} out of {max}\"), `size` (8–128 px per star, unset 20) | none | `<div role=\"img\" aria-label=\"Rated 4.5 out of 5\">` with one `aria-hidden` star SVG per point, filled in the element's text colour; a part-filled star is the filled star cut by its `viewBox` over a 25 % star. Right to left, stars fill from the right |\n| `alert` (W-1025) | `variant` (`info`, `success`, `warning`, `danger`), optional `title` (≤ 200), `text` (≤ 2000; line breaks kept), optional `hideIcon`, `dismissible`, `dismissLabel` (≤ 80, unset \"Dismiss\") | none | `<div role=\"note\" class=\"emvb-alert emvb-alert-<variant>\">` in the variant's colours (text on background at least 7:1, overridable by the element's styles), its `aria-hidden` icon unless `hideIcon`, then the title and text paragraphs. `dismissible` adds `<button type=\"button\" data-emvb-alert-dismiss aria-label=\"Dismiss\">`, hidden by CSS until the opt-in alerts runtime marks it ready; that script hides the Alert on press and moves focus to the next focusable element. The page then lists `\"alerts\"` in `runtimes` |\n| `icon-box` (W-1020) | `iconId` and optional `iconSvg` (as on `icon`), `iconSize` (8–512 px, unset 48), `title` (≤ 200), optional `titleLevel` (2–6, unset 3), `text` (≤ 2000, line breaks kept), optional `position` (`top`, `left`, `right`; unset `top`), `href`, `newTab` | none | `<div class=\"emvb-icon-box emvb-media-box emvb-media-box-<position>\">` with the icon `aria-hidden` in `.emvb-media-box-media`, then `<hN class=\"emvb-media-box-title\">` and `<p class=\"emvb-media-box-text\">`. With a safe `href` the title is wrapped in `<a class=\"emvb-media-box-link\">`, whose `::after` covers the box, so the whole box is clickable through one named link. An empty title or text is left out |\n| `image-box` (W-1021) | the picture keys of `image`: `src`, `alt` (required unless `decorative`), optional `mediaId`, `width`, `height`, `focalX`, `focalY` (kept for the media library; a box doesn't crop); optional `imageSize` (`small` 25 %, `medium` 40 %, `large` 60 %, `full`; the picture's share of the width when beside the words, unset `medium`); and the title, text, position and link keys of `icon-box` | none | as `icon-box`, class `emvb-image-box` (plus `emvb-image-box-<size>` unless medium), with `<img loading=\"lazy\" decoding=\"async\">` and its `width`/`height` in `.emvb-media-box-media`; no media part without a safe `src` |\n| `testimonial` (W-1022) | `quote` (≤ 2000, line breaks kept), `name` (≤ 200), optional `role` (≤ 200), optional photo keys `src`, `alt` (written by the media library, not rendered), `mediaId`, `width`, `height`, `focalX`, `focalY`; optional `rating` (0–10) and `ratingMax` (1–10, unset 5) | none | `<figure class=\"emvb-testimonial\">`: the rating as in `rating` (`role=\"img\"`, \"Rated 5 out of 5\") when `rating` is set, `<blockquote class=\"emvb-testimonial-quote\"><p>`, then `<figcaption>` with the photo (48 px, round, `alt=\"\"`: the name is beside it) and the name and role |\n| `social-icons` (W-1024) | optional `label` (≤ 80, unset \"Social media\"), `shape` (`plain`, `circle`, `rounded`, `square`; unset `plain`), `brandColors` | `children`: Social links only, at most 20 | `<ul class=\"emvb-social-icons emvb-social-<shape>\" aria-label=\"Social media\">`; icons are one em, so the element's font size sizes them (1.5em by default). Badges draw the icon in white on the text colour, or on each network's colour with `brandColors` |\n| `social-link` (W-1024) | `network` (one of `facebook`, `instagram`, `x`, `linkedin`, `youtube`, `tiktok`, `bluesky`, `mastodon`, `threads`, `github`, `pinterest`, `whatsapp`, `discord`, `twitch`, `reddit`, `dribbble`, `behance`, `telegram`, `spotify`, `email`, `rss`, `website`), `href` (≤ 2000), optional `label` (≤ 80, the link's name; unset the network's name), `newTab` | none; only inside `social-icons` | `<li class=\"emvb-social-link emvb-social-<network>\"><a href aria-label=\"Instagram\">` around the preset's `aria-hidden` SVG (Font Awesome Free, CC BY 4.0, generated into `core/icons/social.generated.ts`). Without a safe `href` the icon shows dimmed in a `<span aria-hidden>` with no link |\n| `gallery` (W-1019) | optional `layout` (`grid` squares or `masonry`; unset `grid`), `columns` (1–6, unset 3; at most 2 up to 1024 px wide and 1 up to 767 px), `lightbox`, `label` (≤ 80) | `children`: Gallery images only, at most 60 | `<ul class=\"emvb-gallery emvb-gallery-<layout> emvb-gallery-cols-<n>\">`, named by `label`. `lightbox` adds `data-emvb-lightbox` and lists `\"lightbox\"` in `runtimes`: that script turns each picture into a \"View larger: <alt>\" button opening one native modal `<dialog>` with Previous/Next (and arrow keys), a spoken \"2 of 5\", Close and Escape; focus returns to the picture |\n| `gallery-image` (W-1019) | the picture keys of `image` (`src`, `alt` required unless `decorative`, `mediaId`, `width`, `height`, `focalX`, `focalY`) and optional `caption` (≤ 500) | none; only inside `gallery` | `<li class=\"emvb-gallery-image\"><figure>` with a lazy `<img>` and its `<figcaption>`; no picture without a safe `src` |\n| `carousel` (W-1018) | optional `label` (≤ 80, unset \"Carousel\"), `perView` (1–4, unset 1; at most 2 up to 1024 px, 1 up to 767 px), `arrows`, `dots`, `autoplay`, `interval` (3–30 seconds, unset 6), `loop` | `children`: Slides only, at most 20 | `<section aria-roledescription=\"carousel\" aria-label=\"Carousel\">` with a focusable `<div class=\"emvb-carousel-track\" tabindex=\"0\">` that scrolls and snaps to each slide with no script (`aria-live` polite, off while autoplaying). `arrows`, `dots` or `autoplay` add `data-emvb-*` options and list `\"carousel\"` in `runtimes`: that script adds Previous/Next (disabled at the ends unless `loop`), one \"Go to slide n\" button per view position (`aria-current`), and for autoplay a Pause/Play button before the slides; autoplay pauses while hovered or focused and starts paused under `prefers-reduced-motion` |\n| `carousel-slide` (W-1018) | optional `label` (≤ 80) | `children: Node[]`; only inside `carousel` | `<div role=\"group\" aria-roledescription=\"slide\" aria-label=\"2 of 5\">` (or its `label`) |\n\n**Widget runtimes (W-1025).** `renderPage` returns `runtimes`, the opt-in widget scripts the rendered\nelements asked for (sorted; empty for most pages). `renderStored` and `resolveThemeParts` set it only\nwhen it is not empty. `EmVBPage` mounts them itself; a site layout mounts its theme parts' with\n`<EmVBWidgetRuntimes names={theme.runtimes} />` from `@perkyzz/emvb/astro/widgets`. The HTML/CSS\nexport writes each one next to the pages that use it (`assets/emvb-alerts.js`, `assets/emvb-lightbox.js`, `assets/emvb-carousel.js`). The names are `alerts`, `lightbox` and `carousel` (1.2); `counter`, `countdown`, `map`, `headline` and `share` (1.3); `sticky` (Hide while scrolling down) and `theme` (Theme toggle) (1.4); and `ext:<package>` for an extension's own runtime ([EXTENSIONS.md](../EXTENSIONS.md), 1.4).\n\n## 1.3 marketing widgets (W-1038–W-1048)\n\nNew element types only (layout schema stays 18): a page that uses them can't be opened by EmVB\n1.2, which keeps them on save without showing them. Each renders without script; the opt-in\nscripts are listed in `runtimes`.\n\n| Type | `props` | Children | Renders as |\n| --- | --- | --- | --- |\n| `counter` (W-1038) | `value` (−10¹² to 10¹²), optional `start` (same range, unset 0), `decimals` (0–3, unset 0), `separator` (`,` `.` space or `'`; unset none; with `.` the decimal mark is `,`), `prefix` and `suffix` (≤ 20), `title` (≤ 200), `countUp`, `duration` (300–5000 ms, unset 2000) | none | `<div class=\"emvb-counter\">` with `<p class=\"emvb-counter-number\">` (prefix, `<span class=\"emvb-counter-value\">` holding the final number, suffix) and the title paragraph. `countUp` adds `data-emvb-counter`, `data-from`, `data-to`, `data-decimals`, `data-separator` and `data-duration` to the value and lists `\"counter\"` in `runtimes`; that script counts from `start` when the number scrolls into view, with a hidden copy of the final number for screen readers while it counts, and does nothing under reduced motion |\n| `progress` (shown as \"Progress bar\", W-1039) | `value` (0–10⁶), optional `max` (above 0, ≤ 10⁶, unset 100; a `value` above it shows as full), `label` (≤ 120), `showValue`, `kind` (`meter` or `progressbar`, unset `meter`), `thickness` (2–48 px, unset 8), `grow` | none | `<div class=\"emvb-progress\">` with an optional head (the label and, with `showValue`, an `aria-hidden` percentage), then `<div role=\"meter\" aria-label=\"…\" aria-valuemin=\"0\" aria-valuemax aria-valuenow aria-valuetext=\"75%\">` holding an `aria-hidden` SVG: a 20 % track and a fill `rect` as wide as the share, in the element's text colour, no inline styles. `grow` adds the `emvb-progress-grow` class, whose fill grows in with a CSS scroll-driven animation, only where supported and not under reduced motion. Right to left, it fills from the right |\n| `countdown` (W-1040) | `target` (`YYYY-MM-DDTHH:MM[:SS]` with `Z` or a `±HH:MM` offset, a real date), optional `title` (≤ 200), `label` (≤ 40, unset \"Ends\"), `ticking`, `hideSeconds`, `expired` (`text`, `hide` or `link`, unset `text`), `expiredText` (≤ 200, unset \"This offer has ended.\"), `expiredHref` (a link, sanitised like any) | none | `<div class=\"emvb-countdown\">` with the title and `<p>Ends <time datetime=\"…\">1 Dec 2026, 09:00 UTC−5</time></p>`, the date written in the target's own offset. `ticking` adds `data-emvb-countdown`, `data-target` and `data-expired`, a clock (`aria-hidden` days, hours, minutes and seconds, without seconds under `hideSeconds`) with a `Pause` button (`aria-pressed`), and the ended paragraph (a link with `link`, none with `hide`); CSS hides the clock until the opt-in countdown runtime marks it ready and the ended text until it is shown. The runtime ticks every second (no live region), stops on Pause, and at the target shows the ended text and hides the clock, or hides the Countdown. The page then lists `\"countdown\"` in `runtimes` |\n| `map` (W-1041) | `address` (1–300, line breaks kept), optional `provider` (`osm` or `google`, unset `osm`), `lat` (−90 to 90) and `lng` (−180 to 180), `zoom` (1–19, unset 15), `linkText` (≤ 80, unset \"Open in OpenStreetMap\" or \"Open in Google Maps\"), `embed`, `height` (150–800 px, unset 360) | none | `<div class=\"emvb-map\">` with the address paragraph and `<a class=\"emvb-map-link\" rel=\"noopener\">` to the place (a search for the address, or a marker at `lat`/`lng`). `embed` (with `lat`/`lng` for OpenStreetMap) adds `data-emvb-map` and a `.emvb-map-frame` holding `data-src`, `data-title` (\"Map of\" the address's first line) and `data-height`, a \"Show the map\" button and a note naming the service; CSS hides it until the opt-in map runtime marks the Map ready. Pressed, the runtime replaces it with a titled, lazy `<iframe>` (only `https://www.openstreetmap.org/export/embed.html?…` or `https://www.google.com/maps?…`) and moves focus to it, so the page requests nothing from the map service before that. Hosts with a Content Security Policy add `frame-src https://www.openstreetmap.org https://www.google.com`. The page then lists `\"map\"` in `runtimes` |\n| `price-table` (shown as \"Price table\", W-1042) | `title` (≤ 120), optional `titleLevel` (2–6, unset 3), `description` (≤ 500), `price` (≤ 20, text such as `29.99` or `Free`), optional `currency` (≤ 5), `period` (≤ 40), `regularPrice` (≤ 20), `features` and `excluded` (≤ 30 lines of ≤ 200 each), `buttonText` (≤ 80), `buttonHref` (a link, sanitised), `newTab`, `featured`, `ribbon` (≤ 30, unset \"Featured\") | none | `<div class=\"emvb-price-table\">` (plus `emvb-price-table-featured` and a ribbon paragraph when `featured`), the title heading, the description, `<p class=\"emvb-price-table-price\">` with the regular price in `<s>` when on sale (with \"Regular price:\" and \"Sale price:\" for screen readers only), the amount with its currency and the period; a list of included features with a check mark and excluded ones with a cross, struck through and introduced as \"Not included:\" for screen readers; then the button link (left out without text or a safe link; `newTab` adds `target=\"_blank\" rel=\"noopener noreferrer\"`). No script |\n| `price-list` (shown as \"Price list\", W-1043) | optional `label` (≤ 80) | `children: Node[]`, Price list items only, at most 50 | `<ul class=\"emvb-price-list\" aria-label=\"…\">` (no name without `label`) |\n| `price-list-item` (W-1043) | `title` (≤ 120), `price` (≤ 20, text), optional `description` (≤ 500), `src` with an Image's picture keys and `alt` (≤ 500; unset or empty: decorative), `href` (a link, sanitised), `newTab` | none; only inside `price-list` | `<li class=\"emvb-price-list-item\">` with the picture first (`loading=\"lazy\"`), then `<p class=\"emvb-price-list-head\">` holding the title (a link with `href`), an `aria-hidden` dotted leader and the price, and the description paragraph. No script |\n| `cta` (shown as \"Call to action\", W-1044) | `title` (≤ 200), optional `titleLevel` (2–6, unset 3), `text`, `src` with an Image's picture keys and `alt` (unset or empty: decorative), `layout` (`behind`, `top`, `left`, `right`; unset `behind`), `buttonText` (≤ 80), `href` (a link, sanitised), `newTab`, `ribbon` (≤ 30) | none | `<div class=\"emvb-cta emvb-cta-<layout>\">` (`top` without a picture) with the ribbon, the picture in `.emvb-cta-media` (behind: covering the box under a 55 % black overlay, the words in white), then the title heading, text and button. With a safe `href` the title holds the one link, `emvb-cta-linked` stretches it over the whole box, and the button is an `aria-hidden` span; without one there is no link or button. No script |\n| `flip-box` (shown as \"Flip box\", W-1045) | `frontTitle` (≤ 200), optional `frontText`, `backTitle` (≤ 200), `backText`, `titleLevel` (2–6, unset 3), `buttonText` (≤ 80), `href` (a link, sanitised), `newTab`, `direction` (`right`, `left`, `up`, `down`; unset `right`), `toggleLabel` (≤ 40, unset \"Turn over\") | none | `<div class=\"emvb-flip-box emvb-flip-<direction>\">` holding `.emvb-flip-inner` with two faces stacked in one grid cell (the box is as tall as the taller face), each with its title and text, the back with the button link; then `<label class=\"emvb-flip-toggle\"><input type=\"checkbox\" class=\"emvb-flip-check\">Turn over</label>`. CSS turns the inner on hover (only under `(hover:hover)`), when the checkbox is ticked, and when keyboard focus is inside the back face; both faces stay in the accessibility tree. Reduced motion drops the transition. No script |\n| `headline` (shown as \"Animated headline\", W-1046) | optional `level` (1–6, unset 2), `before` and `after` (≤ 200), `highlight` (1–120), `mark` (`underline`, `circle`, `strike`, `none`; unset `underline`), `rotate` (≤ 10 words of ≤ 120), `rotating`, `interval` (1.5–10 s, unset 2.5), `turns` (1–5, unset 2) | none | `<hN class=\"emvb-headline emvb-headline-<mark>\">before <span class=\"emvb-headline-mark\">highlight</span> after</hN>`, counted as a heading by the accessibility check. The mark is drawn once by CSS (a growing gradient, or an `aria-hidden` SVG circle), already drawn under reduced motion. `rotating` with other words adds `data-emvb-rotate` (the words as JSON), `data-interval` and `data-turns` and lists `\"headline\"` in `runtimes`; the runtime hides the changing word from screen readers (they read the sentence with the first word), adds a Pause button after the heading, and stops on the first word after its rounds or on Pause; nothing rotates under reduced motion |\n| `share-buttons` (shown as \"Share buttons\", W-1047) | optional `label` (≤ 80, unset \"Share this page\"), `shape` (as Social icons), `brandColors`, `nativeShare` | `children: Node[]`, Share links only, at most 12 | `<ul class=\"emvb-share-buttons emvb-share-<shape>\" aria-label=\"Share this page\">`. `nativeShare` adds a last item with `<button type=\"button\" class=\"emvb-share-native\" data-emvb-share>Share…</button>`, hidden by CSS until the opt-in share runtime finds the browser's `navigator.share` and marks the list ready; pressed, it opens the share sheet for the page. The page then lists `\"share\"` in `runtimes` |\n| `share-link` (W-1047) | `network` (`facebook`, `x`, `linkedin`, `whatsapp`, `telegram`, `reddit`, `bluesky`, `threads`, `email`), optional `label` (≤ 80) | none; only inside `share-buttons` | `<li class=\"emvb-share-<network>\"><a href=\"…\" aria-label=\"Share on Facebook\" target=\"_blank\" rel=\"noopener noreferrer\">` with the network's `aria-hidden` icon; the address is the service's own share link with the page URL encoded in it (email: `mailto:?body=…`, same tab). The page URL comes from the host as `dynamic.pageUrl` (`resolveEmVBPage` and `resolveThemeParts` fill it with the request's origin and path when a layout has Share buttons); without it a public page renders no share links, and the editor uses `https://example.com/`. No tracking script |\n| `hotspots` (W-1048) | `src` and `alt` with an Image's picture keys and `decorative`, optional `label` (≤ 80, unset \"Points on the picture\") | `children: Node[]`, Hotspots only, at most 20 | `<div class=\"emvb-hotspots\">` with the picture (`loading=\"lazy\"`; the accessibility check wants its alt text as for an Image) and `<ol class=\"emvb-hotspots-list\" aria-label=\"…\">` of markers numbered by a CSS counter |\n| `hotspot` (W-1048) | `title` (1–120), optional `text` (≤ 1000), `x` and `y` (0–100 %), optional `xTablet`, `yTablet`, `xMobile`, `yMobile` (unset: the wider device's) | none; only inside `hotspots` | `<li>` placed by its own CSS rule (`left`/`top` in percent, tablet and phone values in their media queries), holding `<button type=\"button\" popovertarget=\"emvb-hotspot-<id>\" aria-label=\"title\">` and `<div id=\"emvb-hotspot-<id>\" popover=\"auto\">` with the title and note. The native Popover API opens and closes it (Escape, click outside) with no script; where `position-area` is supported the note sits by its marker, elsewhere in the middle of the screen. `popover`, `popovertarget` and `popovertargetaction` joined the markup attribute allowlist |\n\n## 1.4 additions (W-1067–W-1086)\n\nAdditive, as in 1.2 and 1.3: layout schema 18 and design schema 17 stay, a page that uses a new\nelement type can't be shown by EmVB 1.3, which keeps it on save, and every new key is optional.\nTwo new element types:\n\n| Type | `props` | Children | Renders as |\n| --- | --- | --- | --- |\n| `search-form` (W-1073) | optional `action` (≤ 500; a site path or web address, unset or refused `/search`), `label` (≤ 80, unset \"Search\"), `placeholder` (≤ 120), `buttonText` (≤ 40, unset \"Search\") | none | `<form role=\"search\" aria-label=\"…\" method=\"get\" action=\"…\">` with `<input type=\"search\" name=\"q\" aria-label=\"…\">` and `<button type=\"submit\">`. No script: the browser sends `?q=` to the search page, as EmDash's own Search widget does. Never inside a `form` (the save refuses it, as a form in a form) |\n| `theme-toggle` (W-1067) | optional `label` (≤ 40, unset \"Dark mode\") | none | `<button type=\"button\" aria-pressed=\"false\" data-emvb-theme-toggle>`, shown only once the opt-in `theme` runtime marks it ready. The runtime keeps a choice in `localStorage` (`emvb-theme`) and sets `<html data-emvb-theme=\"light\\|dark\">`, which the page CSS reads before the system setting; `aria-pressed` says whether dark is on |\n\nNew optional keys on existing records:\n\n- `menu-item` `panelPartId` and `panelWidth`: a mega menu panel (see `menu` / `menu-item` above).\n- `motion.sticky` in a style record: scroll effects for a sticky or fixed element (see the style\n table above).\n- A colour variable's `dark` and a font variable's `family`, `faces` and `source` (see Design\n system document above).\n- A popup's triggers: `panel` (off-canvas panel), and `advanced.urlParams`, `advanced.from` and\n `advanced.until` (see [theme-parts.md](theme-parts.md)).\n\nExtensions may also put allowlisted classes on their output and ship their own stylesheet and\nruntime ([EXTENSIONS.md](../EXTENSIONS.md)); none of that is stored in a layout.\n";
6502
6502
 
6503
6503
  // skill/emvb-page-builder/SKILL.md
6504
6504
  var SKILL_default = `---
@@ -15404,6 +15404,19 @@ function pruneEmptyLists(nodes) {
15404
15404
  return keep;
15405
15405
  }
15406
15406
 
15407
+ // ../emvb/src/core/sanitize/escape.ts
15408
+ var TEXT_ENTITIES = { "&": "&amp;", "<": "&lt;", ">": "&gt;" };
15409
+ var ATTR_ENTITIES = { ...TEXT_ENTITIES, '"': "&quot;", "'": "&#39;" };
15410
+ function escapeText(value) {
15411
+ return value.replace(/[&<>]/g, (ch) => TEXT_ENTITIES[ch] ?? ch);
15412
+ }
15413
+ function escapeAttr(value) {
15414
+ return value.replace(/[&<>"']/g, (ch) => ATTR_ENTITIES[ch] ?? ch);
15415
+ }
15416
+
15417
+ // ../emvb/src/core/theme/part-wrapper.ts
15418
+ var COPIED = new Set(["top", "bottom", "z-index", "--emvb-sticky-hide"]);
15419
+
15407
15420
  // ../emvb/src/core/design/devices.ts
15408
15421
  function hiddenOnEveryDevice(owner) {
15409
15422
  if (!DEVICES.every((device) => owner.hiddenOn?.includes(device)))
@@ -15598,16 +15611,6 @@ var sizes = new WeakMap;
15598
15611
  var THEME_STORAGE_KEY = "emvb-theme";
15599
15612
  var THEME_BOOT_SCRIPT = `<script>try{var t=localStorage.getItem("${THEME_STORAGE_KEY}");if(t==="light"||t==="dark")document.documentElement.setAttribute("data-emvb-theme",t)}catch(e){}</script>`;
15600
15613
 
15601
- // ../emvb/src/core/sanitize/escape.ts
15602
- var TEXT_ENTITIES = { "&": "&amp;", "<": "&lt;", ">": "&gt;" };
15603
- var ATTR_ENTITIES = { ...TEXT_ENTITIES, '"': "&quot;", "'": "&#39;" };
15604
- function escapeText(value) {
15605
- return value.replace(/[&<>]/g, (ch) => TEXT_ENTITIES[ch] ?? ch);
15606
- }
15607
- function escapeAttr(value) {
15608
- return value.replace(/[&<>"']/g, (ch) => ATTR_ENTITIES[ch] ?? ch);
15609
- }
15610
-
15611
15614
  // ../emvb/src/core/render/vnode.ts
15612
15615
  var TAGS = new Set([
15613
15616
  "div",
@@ -23811,7 +23814,7 @@ function httpRemote(endpoint, token, version) {
23811
23814
  }
23812
23815
 
23813
23816
  // src/bridge.ts
23814
- var BRIDGE_VERSION = "1.4.1";
23817
+ var BRIDGE_VERSION = "1.4.2";
23815
23818
  var failure2 = (message) => ({
23816
23819
  content: [{ type: "text", text: message }],
23817
23820
  isError: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perkyzz/emvb-mcp",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Local (stdio) MCP server for EmVB pages: lets AI agents build EmDash pages through your site's EmDash MCP endpoint.",
5
5
  "keywords": [
6
6
  "emdash",
@@ -41,7 +41,7 @@
41
41
  "@modelcontextprotocol/server": "2.4.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@perkyzz/emvb": "1.4.1",
44
+ "@perkyzz/emvb": "1.4.2",
45
45
  "zod": "~4.5.4"
46
46
  },
47
47
  "engines": {