EmVB schema contract 1.0
This document describes the stored formats EmVB promises to keep stable through 1.x.
The contract version is CONTRACT_VERSION = "1.0" (exported from packages/emvb/src/core). It covers
layout schema 18 and design schema 17.
- Prose reference for every element, prop and style key, with the CSS each one produces: system/layout-format.md.
- Machine-readable schemas: schema/layout.schema.json and
schema/design.schema.json (JSON Schema 2020-12). These are generated from
packages/emvb/src/core/json-schema.tsbybun scripts/export-json-schema.ts. A test fails when they are out of date (scripts/export-json-schema.test.ts). The MCP resourcesemvb://schema/layoutandemvb://schema/designserve the same schemas. - The source of truth is the Zod schemas in
packages/emvb/src/core/schema/, pluscore/limits.ts,core/contract.tsandcore/migrate/. - Extensions API v1 (custom elements, panels, sources): EXTENSIONS.md.
The promise
From 1.0, within 1.x:
- No key is removed or renamed, and no key changes meaning.
- New keys are additive and optional.
- A 1.x page looks and behaves the same on every later 1.x. The HTML and CSS bytes may still improve for accessibility and page size (since 1.1: the Tabs markup, and theme parts’ shared CSS written once); such a change is listed in the CHANGELOG and checked by comparing screenshots of the saved pages before and after.
- Every older page (0.1–0.9, layout schemas 1–17 and design schemas 1–16) migrates forward
automatically on read and renders as it did. The
packages/emvb/test/compatcorpus pins the exact HTML and CSS of saved pages, and it runs inbun run check; its expected output only changes together with such a listed improvement. - A key written by a newer 1.x is kept and ignored, not stripped (see below).
- Breaking changes only come in 2.0, with a migration.
Unknown keys
A document may carry keys this version does not know. They are allowed in exactly these places:
| Place | Examples |
|---|---|
| a node | root.children[0].futureKey |
a node’s props (for a known element type) |
props.futureProp |
a node’s style records: style, style.wide (since 1.1), states.hover/focus/active, devices.laptop/tablet/mobile, query.style |
style.futureStyle |
a design class’s style, states and devices, and a tag default in defaults |
classes[0].style.futureStyle |
Rules (core/contract.ts, limits in core/limits.ts):
- Stored untouched. The validator sets these keys aside, parses the rest strictly, then puts them back unchanged. A save keeps them.
- Never rendered.
renderPagereads known keys only: no unknown key reaches HTML, CSS or a script. Editors and the MCP tools keep the keys when they edit other fields. - Limits. A name must match
UNKNOWN_KEY_PATTERN,^[A-Za-z][A-Za-z0-9_.:/@-]{0,127}$. At mostMAX_UNKNOWN_KEYS(32) unknown keys are kept in one place, and a value nests at mostMAX_UNKNOWN_DEPTH(16) levels. Beyond that the document is refused with codeunknown_keyand the key’s path. The whole document still has to fit the page and design byte budgets. - Everywhere else stays strict. The top level of a layout or design, variables, binding,
audience, query (other than its
style) and every value shape are still refused when they hold a key EmVB does not know. - An element type EmVB does not know is kept too, as before.
motioninside a state is refused: motion is Normal-only.
Note that a document from a newer schema version is refused as “newer”, not guessed at.
That still holds for schemaVersion above 18. The unknown-key rule is for 1.x documents that still say
schema 18 but were written by a later 1.x that added optional keys.
What changed at 1.0 (layout 17 → 18, design 16 → 17)
Accepted by Charles 2026-11-04. Each rename has a forward migration. The old names are still accepted on input (validation and the MCP tools) and are upgraded when the document is read.
| 0.x (≤ layout 17) | 1.0 (layout 18) | Why |
|---|---|---|
node type section |
part-ref |
It embeds a Theme section part; “section” also meant the HTML tag and the layout-section element |
node label |
editorLabel |
Editor-only name. Avoids a clash with the form fields’ and menus’ props.label, which are rendered |
Loop props.itemPartId |
props.partId |
Same name as on part-ref |
style.transition |
style.motion.transition |
All motion in one place |
style.entrance |
style.motion.entrance |
|
style.scrollMotion |
style.motion.scroll |
|
style.iconAnimation |
style.motion.icon |
motion is { entrance?, scroll?, transition?, icon? }, each part with its 0.x shape. It is
allowed in style, devices.*, query.style and a class’s style, but not in states. The renderer
flattens it back in the 0.x key order, so the CSS is byte-identical.
Added in 1.0 (additive): motion.loop is { effects, duration, easing?, alternate?, loop? }
or { type: "none" }. effects are the scroll-motion effects (fade, move-x, move-y,
scale, rotate, blur, each once, same limits); duration 200–20000 ms; easing one of the
transition easings; alternate (default true) plays back and forth; it stops after about 5 s
unless loop: true. Normal-only, off for reduced motion. It has no 0.x key.
Added in 1.4 (additive, design): a colour variable may have dark (a hex): the colour
when the visitor’s system prefers dark and no Theme toggle chose light, and when one chose dark.
Added in 1.4 (additive, design): a font variable may have family (letters, digits,
spaces, _, ., -; at most 60), faces (up to 60 of { weight: 1–1000, style: "normal" | "italic", src, unicodeRange? }) and source ("upload" or "google", for the editor). A page
whose CSS uses the variable gets one @font-face per face (font-display: swap, WOFF2), before
its other rules; src must be a path on the site (/…, not //host or any other origin, so a
page never asks Google or another host for a font) and pass the media URL check plus a strict
character allowlist, the family is
written as an escaped CSS string, and unicodeRange must read as a U+… list. Faces without a
family are not emitted. EmVB’s own font files are served from
/_emdash/api/plugins/emvb/font?id=<16 hex>.
Added in 1.4 (additive): motion.sticky is { distance?, background?, shadow?, padding?, hide? } (at least one of the last four) or { type: "none" }. Over the page’s first distance px
(10–2000, unset 120) the element takes background (a colour), a shadow and padding (top and
bottom, a length), as CSS scroll-driven animations; hide slides it away while the visitor scrolls
down (the opt-in sticky runtime; down for a bar held at the bottom), per device like the rest. Normal-only, off for reduced motion. It has no 0.x key.
Added in 1.4 (additive): a menu-item may have panelPartId (a Section
theme part’s id, at most 128 characters) and panelWidth (a length): a mega menu panel. Two new
element types, search-form and theme-toggle (props in the table below). As with the 1.2 and 1.3
widgets, EmVB 1.3 keeps them on save without showing them. Neither schema number changes.
Added in 1.1 (additive): a style record may carry viewportUnits, a map from a length key
(height, minHeight, maxHeight and the other box lengths) to "dvh" or "svh". A plain vh
length of that key is then drawn in that unit. The length itself stays vh, so 1.0, which keeps
and ignores the key, draws vh.
Added in 1.1 (additive): an element’s or class’s own style may carry wide, the Wide
screen record (2400 px and up, Elementor’s widescreen): the same keys as style, built on the
Desktop values, plus hidden. hidden: true hides the element on wide screens, hidden: false
shows it there even when it is hidden on Desktop, and without hidden Wide screen follows Desktop.
It is not a devices key or a hiddenOn value, because 1.0 refuses those; 1.0 keeps and ignores
style.wide, so a 1.1 page opens there with its Desktop look on wide screens. Only an own style
reads it: wide inside a state, a device or another wide is kept as an unknown key.
The design moves to 17 only for the motion folding in class styles, their devices, and tag defaults.
On input, a v18 document with a 0.x flat motion key (such as style.entrance) keeps the key as an
unknown key and does not render it. Only documents that say schema 17 or lower, and MCP tool input,
are upgraded. Rendering a raw, unvalidated v17 tree through renderPage is not supported: validate
or upgrade first. The part-ref type and the motion folding only exist after the upgrade.
Shapes
A layout is { schemaVersion: 18, root }, where root is a container node.
Every node has these keys:
id: 4–24 characters, letters, digits,_or-, unique on the page.typeandprops.- Optional:
style,states,devices,hiddenOn,classes,htmlId,attributes,editorLabel(1–80 characters, never rendered),bind,variant,audience,dir,container,query, andchildrenfor parents.
Element types and their props (see layout-format.md for each prop’s type and limits):
| Type | Props |
|---|---|
container |
tag, href, newTab |
div-block |
href, newTab |
layout-section |
tag, contentWidth, fullWidth |
flexbox |
href, newTab |
grid |
columns, columnsTablet, columnsMobile, columnTracks, columnTracksTablet, columnTracksMobile, href, newTab |
svg |
markup, title, decorative, size |
tabs |
(none) |
tab-panel |
label |
heading |
text, level, href, newTab, marks |
toc |
title |
language-switcher |
label |
rating |
value, max, label, size |
alert |
variant, title, text, hideIcon, dismissible, dismissLabel |
icon-box |
iconId, iconSvg, iconSize, title, titleLevel, text, position, href, newTab |
image-box |
src, alt, decorative, mediaId, width, height, focalX, focalY, imageSize, title, titleLevel, text, position, href, newTab |
testimonial |
quote, name, role, src, alt, mediaId, width, height, focalX, focalY, rating, ratingMax |
social-icons |
label, shape, brandColors |
social-link |
network, href, label, newTab |
gallery |
layout, columns, lightbox, label |
gallery-image |
src, alt, decorative, mediaId, width, height, focalX, focalY, caption |
carousel |
label, perView, arrows, dots, autoplay, interval, loop |
carousel-slide |
label |
counter |
value, start, decimals, separator, prefix, suffix, title, countUp, duration |
progress |
value, max, label, showValue, kind, thickness, grow |
countdown |
target, title, label, ticking, hideSeconds, expired, expiredText, expiredHref |
map |
address, provider, lat, lng, zoom, linkText, embed, height |
price-table |
title, titleLevel, description, price, currency, period, regularPrice, features, excluded, buttonText, buttonHref, newTab, featured, ribbon |
price-list |
label |
price-list-item |
title, price, description, src, alt, mediaId, width, height, focalX, focalY, href, newTab |
cta |
title, titleLevel, text, src, alt, mediaId, width, height, focalX, focalY, layout, buttonText, href, newTab, ribbon |
flip-box |
frontTitle, frontText, backTitle, backText, titleLevel, buttonText, href, newTab, direction, toggleLabel |
headline |
level, before, highlight, after, mark, rotate, rotating, interval, turns |
share-buttons |
label, shape, brandColors, nativeShare |
share-link |
network, label |
hotspots |
src, alt, decorative, mediaId, width, height, focalX, focalY, label |
hotspot |
title, text, x, y, xTablet, yTablet, xMobile, yMobile |
search-form |
action, label, placeholder, buttonText |
theme-toggle |
label |
spacer |
height |
divider |
(none) |
text |
text, tag, marks |
label |
text |
link |
text, href, newTab |
button |
text, href, newTab, iconId, iconSvg, iconPosition, iconGap, iconSize |
list |
ordered, marker, start, items |
image |
src, alt, decorative, width, height, mediaId, priority, href, newTab, caption, focalX, focalY, sources, edit |
icon |
iconId, iconSvg, singleColor, size, decorative, title, href, newTab |
video |
url, title, mediaId |
form |
formId, nextLabel, prevLabel |
form-step |
title |
text-input |
field, label, placeholder, inputType, min, max, step, minDate, maxDate |
textarea, select, radio |
field, label, placeholder |
checkbox |
field, label |
submit |
label |
post-title |
level |
post-excerpt |
maxWords |
post-content, post-author |
(none) |
post-image |
decorative |
post-link |
text, newTab |
post-date |
format |
loop |
partId, perPage, collection, limit, order, display, columns, permalink, imageField, excerptField, filter |
loop-empty |
(none) |
pagination |
prevText, nextText, showCount, countText, showLast, lastText, lastLabel, titleText, archiveTitle, navLabel, pageLabel, prevLabel, nextLabel |
part-ref |
partId |
accordion |
(none) |
accordion-item |
summary, open |
menu |
direction, label |
menu-item |
text, href, newTab, wide, panelPartId, panelWidth |
These style keys are allowed in style, devices.*, query.style and class styles; states.* takes
the same keys except motion:
- Layout: flexDirection, flexWrap, justifyContent, alignItems, gap, gridColumnSpan, gridRowSpan, gridColumnStart, gridRowStart, flexGrow, flexShrink, flexBasis, alignSelf, order.
- Size: width, minWidth, maxWidth, height, minHeight, maxHeight, overflow, overflowX, overflowY, aspectRatio, objectFit, objectPosition.
- Spacing: paddingTop, paddingRight, paddingBottom, paddingLeft, marginTop, marginRight, marginBottom, marginLeft.
- Position: position, top, right, bottom, left, zIndex.
- Type: fontFamily, fontSize, fontWeight, lineHeight, letterSpacing, textAlign, textTransform, textDecoration, fontStyle, whiteSpace, overflowWrap, color, markerColor, markerSize.
- Background: backgroundColor, backgroundImage, backgroundSize, backgroundPosition, backgroundRepeat, backgroundVideo, gradient, overlay.
- Border: borderWidth, borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth, borderStyle, borderColor, borderRadius, borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius.
- Effects: opacity, boxShadow, filter, backdropFilter, transform, cursor.
- Icon: iconRotate, iconFlip, iconScale, iconStrokeWidth, iconShadow.
- Motion:
motion.
fontSize, gap, width, height, minWidth, maxWidth, minHeight, maxHeight, padding,
margins and offsets may also be a fluid size, { "fluid": { "min", "max" } } in px.
A design is { schemaVersion: 17, variables, classes?, fluidRange?, direction?, defaults? }.
Limits (core/limits.ts):
| Limit | Value |
|---|---|
| Page JSON | 512 KiB |
| Design JSON | 256 KiB |
| Tree depth | 24 |
| Nodes | 2000 |
| Text length | 2000 |
| Tabs | 12 |
The per-key limits are in layout-format.md and the JSON Schema.
Names we kept, and what they mean
These names are awkward, but changing them would cost more than it gains, so they are frozen as they are (audit):
-
Grid per-device keys.
columns,columnsTablet,columnsMobileandcolumnTracks*are props, notdevicesstyle overrides. The grid’s column count is content structure, not style. Other per-device values live indevices.laptop,devices.tabletanddevices.mobile(laptopsince 1.0;hiddenOnalso takes"laptop"). -
iconSizevssize. Abutton’s icon size isprops.iconSize, because the button’s own size is its style. Aniconorsvgelement’s size isprops.size. -
focalX/focalY. These are image props, whole percentages 0–100 from the left and top. They becomeobject-position. They are not style keys, because they belong to the picture: they stay with the image when it is cropped or replaced in the editor. -
container/div-block/flexbox. These are three box elements with the same structure:containertakes a semantictagand is the root type.div-blockis a plain block.flexboxstarts as a flex row.
They differ in their defaults and their place in the Add panel. The node key
container, which sets container queries, is unrelated to thecontainertype. -
Design
directionvs nodedir. The design’sdirection(ltr,rtl,auto) is the site’s text direction. A node’sdiroverrides it for one element and its children. Amenu’sprops.direction(roworcolumn) is layout, not text direction. -
sectionwords that are notpart-ref. These still say “section” and are not schema names that changed:- the HTML tag
section(container/layout-sectiontag) - the theme part type
section - the CSS class
emvb-section - the editor’s “Theme section” wording
- the HTML tag