A Jalpi page is one JSON document. It is produced by TypeScript in the browser, validated and stored by PHP, and read back by both. Neither side imports the other, so the document itself is the contract β and knowing its exact shape is what lets you read stored data, write a migration, or add a widget without losing content.
This page is the reference for that shape. It walks the document from the outside in: the page envelope, the node, the three style maps, the settings buckets, and the linking structures that point at site-wide tokens and classes. It then covers what the server actually keeps, which is narrower than what the editor can produce β the single most useful thing to know before writing anything into a node.
The TypeScript definitions live in admin/editor/src/types/index.ts; their enforcement lives in includes/class-jalpi-sanitizer.php.
PageData β the Document Envelope#
The outermost shape is deliberately small:
export interface PageData {
version: string;
sections: CBNode[];
globalStyles?: GlobalStyles;
}sectionsis the document. Despite the name, these are ordinary nodes whosetypeis'section'; the tree grows from here.versiondefaults to'1.0'. The editor seeds it,Jalpi_API::default_page_data()seeds it, andJalpi_Sanitizer::sanitize_page_data()preserves it throughsanitize_text_field(). Nothing else in the codebase reads it β there is no migration branch keyed off it today, so treat it as a reserved field rather than an active one.globalStylesis the legacy per-page style model, kept for backward compatibility with pages saved before the site-wide Design System existed. New work usesDesignSysteminstead.
A page with no stored row does not come back empty: Jalpi_API::load_page_data() falls back to default_page_data(), which returns a single section containing a container, with random_bytes-derived ids.
CBNode β the Node#
Every element in the tree, structural or otherwise, is a CBNode:
export interface CBNode {
id: string;
type: ElementType;
content?: NodeContent;
settings?: SectionSettings | ContainerSettings | Record<string, unknown>;
children?: CBNode[];
styles?: StyleMap;
tabletStyles?: StyleMap;
mobileStyles?: StyleMap;
hideOn?: { desktop?: boolean; tablet?: boolean; mobile?: boolean };
locked?: boolean;
globalStyleRef?: {
typographyId?: string;
buttonId?: string;
tokens?: Record<string, { category: TokenCategory; id: string }>;
};
interactions?: InteractionRule[];
}Only id and type are required. Everything else is optional, and the sanitiser copies each key only when it is present β so a minimal stored node really is just those two fields.
The division of labour between the three data buckets is worth stating plainly:
| Bucket | Holds | Example |
|---|---|---|
content | What the widget says | heading text, image URL, button label |
styles | CSS the renderer emits as declarations | fontSize, color, paddingTop |
settings | Structured configuration the element class interprets | background objects, layout mode, column count, custom CSS |
Backgrounds and borders live in settings, not styles, because they are multi-part objects with normal and hover states rather than single CSS declarations.
Ids#
Ids are generated in the browser as ${type}_${Math.random().toString(36).slice(2, 9)} β type-prefixed and seven random characters, e.g. heading_k3f9a2p.
The server enforces two rules on them: an id is mandatory (sanitize_key() must produce a non-empty string, or the node is dropped), and it must be unique across the entire tree. A repeated id is treated as a circular reference and the second occurrence is discarded.
ElementType#
The union declares 56 types: three structural (section, container, column) and 53 widget types.
They fall into four groups in the source:
- Bespoke widgets β the original set, each with a dedicated
Jalpi_Element_*class and its own editor renderer. - Registry-driven widgets β
marquee,typewriter-text,shape-divider,social-share,whatsapp-button,youtube-gallery,facebook-feed,instagram-feed,icon-box. These flow through the generic path on both sides. - WooCommerce widgets β
products-grid,product-categories,single-product. Explicitly not schema-driven, because they run a server-sideWC_Querywith AJAX pagination. - Structural types, which the renderer treats like any other node except that their element classes call
render_children().
One asymmetry to know: split-text appears in the sanitiser's allowed types and has a Jalpi_Element_Split_Text class, but is not a member of the TypeScript ElementType union β it is applied as a style treatment through the Animation tab rather than inserted as a standalone widget.
Style Maps#
StyleMap is a camelCase CSS bag with an index signature:
export interface StyleMap {
fontSize?: string;
color?: string;
// β¦ ~40 named properties β¦
[key: string]: string | undefined;
}Every value is a string, including numbers β "16px", "1.6", "0.5". The index signature means TypeScript will accept any key, which is how widget-specific keys such as iconSize, iconRotate and outerPaddingTop coexist with standard CSS properties.
A node carries up to three of these maps, and they compose by override rather than replacement:
| Map | Applies to |
|---|---|
styles | Desktop, and the base for every breakpoint |
tabletStyles | Tablet override only |
mobileStyles | Mobile override only |
The inspector reads them merged β desktop base plus non-empty overrides β and writes only into the active breakpoint's map. The renderer keeps them apart, accumulating each into its own bucket and wrapping the tablet and mobile buckets in media queries whose widths come from settings.
An empty string is meaningful: it means "no override", and both the editor's merge and the sanitiser's copy skip it.
What Survives a Save#
This is the most consequential detail in the whole data model. Jalpi_Sanitizer::sanitize_styles() is a strict allowlist: it iterates the incoming map and copies a key only if that key appears in one of two lists or matches one of sixteen explicit cases. Anything else is silently dropped β not rejected, not logged, just absent from the stored JSON.
Colour keys (validated with sanitize_color()): color, backgroundColor, textStrokeColor, textShadowColor, gradientColor1, gradientColor2, gradientColor1Hover, gradientColor2Hover, colorHover, backgroundColorHover, borderColorHover, iconColorHover, iconBoxColor, iconBoxColorHover
Dimension keys (validated with sanitize_dimension()): fontSize, lineHeight, letterSpacing, wordSpacing, marginTop/Bottom/Left/Right, paddingTop/Bottom/Left/Right, width, height, minHeight, borderRadius, the four corner radii, the four border*Width properties, textStrokeWidth, textShadowH/V/Blur, outerPaddingTop/Right/Bottom/Left, iconSize, iconPadding
Enumerated and special cases:
| Key | Accepted values |
|---|---|
fontFamily | Letters, digits, spaces, quotes, commas, hyphens, underscores, dots, parentheses |
fontWeight | normal, bold, bolder, lighter, or three digits |
fontStyle | normal, italic, oblique |
textAlign | left, center, right, justify |
textDecoration | none, underline, line-through, overline |
textTransform | none, uppercase, lowercase, capitalize |
display | block, inline, inline-block, flex, grid, none |
opacity | A float between 0 and 1 |
border, boxShadow, boxShadowHover | Passed through sanitize_css_value() |
backgroundType | classic, gradient |
gradientAngle | ^\d+deg$ |
borderStyle | none, solid, dashed, dotted, double, groove, ridge, inset, outset |
borderColor | sanitize_color() |
iconRotate | ^\d+(\.\d+)?deg$ |
About sixty-three keys in total survive.
The Renderer Accepts More Than the Sanitiser Keeps#
Jalpi_Renderer::styles_to_css() maps well over ninety camelCase keys to CSS properties β including position, top, right, bottom, left, zIndex, gap, rowGap, columnGap, the flexbox set, maxWidth, transform, transition, filter, objectFit, overflow and more.
Most of those never arrive through styles, because the panels store them elsewhere: position and offsets are SectionSettings.position / posTop / posLeft, gaps are ContainerSettings.columnGap / flexGap / gridGap, and layout mode is ContainerSettings.layoutMode. The renderer builds CSS from those settings directly.
Three keys, however, are written into styles by the Style tab and read back from $styles by the element classes, yet have no branch in sanitize_styles():
| Key | Written by | Read by |
|---|---|---|
paragraphSpacing | StyleTab β update({ paragraphSpacing }) | Jalpi_Element_Heading, Jalpi_Element_Text |
linkColor | StyleTab β update({ linkColor }) | Jalpi_Element_Heading, Jalpi_Element_Text |
linkColorHover | StyleTab β update({ linkColorHover }) | Jalpi_Element_Heading, Jalpi_Element_Text |
See the warnings below.
The practical rule for anyone adding a style control: a key that is not in the sanitiser's allowlist does not exist after the next save, no matter how completely the editor and renderer support it.
Accepted Value Formats#
sanitize_dimension() defines what a dimension may look like, and it is more generous than it first appears:
- The keywords
auto,inherit,initial,unset,none,normal, and the empty string - A number with a known unit:
%,px,em,rem,vw,vh,dvh,svh,lvh,s,ms,deg,fr,ch,ex - A bare unitless number, for
line-heightand similar clamp(),min()andmax()β but only when built from plain numeric lengths
The fluid-sizing case is deliberately strict and re-assembles the value from the matched numbers rather than passing the original string through: comma-separated numeric lengths only, no nesting, no calc(), no var(), no arithmetic. The comment explains the necessity β without it, responsive typography through node styles would be impossible, since a stripped clamp() leaves the property unset.
sanitize_dimension_shorthand() handles up to four space-separated dimensions for shorthand properties, returning an empty string if any part fails.
sanitize_css_value(), used for compound values like border and boxShadow, strips tags and then removes expression(, -moz-binding:, javascript:, vbscript:, data:, @import and HTML comments.
Settings Buckets#
settings is typed as a union of the three structural shapes or an open Record<string, unknown>, and in practice most widgets use the open form. Three named interfaces cover the structural types.
Shared Sub-Shapes#
Four object shapes recur across settings buckets:
interface BgData {
type?: 'classic' | 'gradient' | 'video' | 'slideshow';
color?: string;
imageUrl?: string; imagePosition?: string; imageSize?: string;
gradient?: string;
gradientColor1?: string; gradientLocation1?: number;
gradientColor2?: string; gradientLocation2?: number;
gradientType?: 'linear' | 'radial'; gradientAngle?: number;
videoUrl?: string;
opacity?: string;
}
interface BorderData {
borderType?: string; borderColor?: string;
borderWidth?: string; borderRadius?: string; boxShadow?: string;
}
interface Padding { top: string; right: string; bottom: string; left: string; }
interface Background { type: 'color' | 'image' | 'gradient'; value?: string; url?: string; position?: string; size?: string; }BgData and BorderData always appear in normal/hover pairs β bgNormal / bgHover, overlayNormal / overlayHover, borderNormal / borderHover. Background and Padding are the older shapes still used by SectionSettings.background and SectionSettings.padding.
Structural Settings#
SectionSettings β background, padding, minHeight, fullWidth, contentWidth ('full' | 'boxed'), boxedWidth, alignItems; the position group position, posTop, posRight, posBottom, posLeft; the four normal/hover pairs; and the CSS group.
ContainerSettings β everything above plus a layout model:
| Group | Keys |
|---|---|
| Mode | layoutMode: 'block' | 'flex' | 'grid' |
| Flex | flexDirection, flexWrapMode, flexJustify, flexAlign, flexGap |
| Grid | gridAutoMode ('none' | 'fill' | 'fit'), gridColumns, gridRows, gridGap, gridMinColSize |
| Block | columns, columnGap |
It also retains columns, gap, direction, justifyContent and flexWrap explicitly marked "kept for backwards-compat with existing saved pages".
ColumnSettings β width, alignSelf, the normal/hover pairs, and the CSS group.
All three share the same CSS group, which every node type may carry:
| Key | Meaning |
|---|---|
cssId | Written to the element's id attribute |
cssClass | Free-text classes appended to the wrapper |
cssClasses | Attached reusable-class keys, in attach order |
customCss | Raw CSS where selector is replaced server-side with the node's scoped selector |
Content#
NodeContent is a union of eleven named interfaces β HeadingContent, TextContent, ImageContent, ButtonContent, VideoContent, MapsContent, HtmlContent, IconContent, ShortcodeContent, LogoContent, FormContent.
That covers eleven of the 56 node types. Every other widget stores its content as an untyped bag, which the widget registry acknowledges directly: its WidgetDefaultNode type declares content?: Record<string, unknown> with a comment noting that the core union models only about eleven types and that the editor already treats most element content as Record<string, unknown> at runtime.
Two content shapes deserve attention:
Text vs. Heading. HeadingContent uses text plus an optional tag (h1βh6); TextContent uses html, with text retained as a legacy fallback. Heading text may contain a narrow set of inline tags; text content is arbitrary editor HTML.
Icons. IconValue is a structured object rather than a string:
export interface IconValue {
type: 'svg' | 'font' | 'img';
lib: string; // 'builtin' | 'fa-solid' | 'bootstrap' | 'material' | 'tabler' | β¦
name: string;
svg?: string; // cached at pick time for svg type
cls?: string; // e.g. 'fa-solid fa-house'
url?: string; // img type
alt?: string;
}IconContent.icon is typed string | IconValue because the legacy format was a bare key such as 'star'. Both are still handled β the sanitiser returns whichever format it received, and RenderIconValue resolves a bare string against the built-in registry.
globalStyleRef β Linking to Site-Wide Values#
A node does not copy global values; it references them.
globalStyleRef?: {
typographyId?: string;
buttonId?: string;
tokens?: Record<string, { category: TokenCategory; id: string }>;
};typographyId/buttonIdlink the whole node to a composite preset. The preset's field list is fixed βJalpi_Renderer::COMPOSITE_PRESET_FIELDSon the server,getPresetStyles()in the editor.tokenslinks individual style properties to atomic Design System tokens, keyed by the style property name:{ fontSize: { category: 'fontSizes', id: 'lg' } }.
Which properties may be linked, and to which category, is decided by the shared LINKABLE_PROPS table in utils/designTokens.ts.
The precedence rule, stated in the type's own comment: a literal value already present in styles / tabletStyles / mobileStyles for the same property always overrides either kind of link. The link stays stored and inert until the literal is cleared.
The same structure is reused by JalpiClass.globalStyleRef, so a reusable class inherits from the Design System exactly as a node does.
Interactions#
The Interaction Engine stores an array of rules on the node:
export interface InteractionRule {
id: string;
trigger: InteractionTrigger;
action: InteractionAction;
enabled?: boolean;
settings: InteractionSettings;
responsive?: { desktop?: boolean; tablet?: boolean; mobile?: boolean };
}Twelve triggers: pageLoad, hover, parentHover, mouseEnter, mouseLeave, click, doubleClick, scrollIntoView, scrollProgress, mouseMove, focus, blur.
Sixteen actions: fade, slide, scale, rotate, translate, opacity, blur, skew, flip, bounce, zoom, customTransform, jackInTheBox, elastic, reveal, wipe.
InteractionSettings is deliberately one flat bag of optional fields rather than a discriminated union per triggerΓaction combination. The type's own docblock explains the choice: the UI shows and hides field groups based on the rule's trigger and action, while the underlying shape stays uniform β matching the codebase's existing loose settings convention.
The fields group by relevance: generic timing (duration, delay, easing, repeat, infinite, direction), transform parameters (distance, rotationDeg, scaleValue, blurAmount, opacityValue, transformOrigin, customTransform, customFilter, clipShape), scroll-specific (startOffset, endOffset, viewportPct, replay, scrollDirection), hover-specific (hoverInAction, hoverOutAction, transitionDuration, hideAfterPlay) and mouse-move-specific (moveX, moveY, strength, reverse, smoothness).
onceOnly is marked deprecated in the type β never read at runtime, kept only so old saved rules round-trip; replay is the single source of truth.
Server-side validation is strict membership: sanitize_interactions() checks trigger and action against hardcoded allowlists with in_array(), and drops the whole rule on a miss. Notably, it does not run them through sanitize_key() β the comment explains that sanitize_key() lowercases, which would never match camelCase values like scrollIntoView.
responsive is per-breakpoint enable/disable, and an absent tier means enabled β so rules saved before the field existed need no migration.
The Design System#
Site-wide design values live outside the page, in the jalpi_settings_design_system option.
export interface DesignToken {
id: string;
name: string;
value: string;
tabletValue?: string;
mobileValue?: string;
}Tokens carry their own responsive overrides, using the same sibling-value pattern as node styles.
DesignSystem holds ten atomic categories β colors, fontFamilies, fontSizes, lineHeights, letterSpacing, borderRadius, boxShadows, spacing, containerWidths, opacity β plus two composite lists, typography: TypographyPreset[] and buttons: ButtonPreset[].
Each token compiles to a CSS custom property named by cssVarName(category, id) β --jalpi-{prefix}-{id}, with presets using --jalpi-typo-{id}-{prop} and --jalpi-btn-{id}-{prop}. The VAR_PREFIX map carries a comment requiring it to match Jalpi_Settings::TOKEN_VAR_PREFIX exactly.
The legacy model. GlobalStyles β colors: GlobalColor[], typography, buttons, spacing: SpacingScale β is the older per-page equivalent, still present on PageData.globalStyles. The types file states the relationship directly: the Design System superseded it as the real source of truth, and GlobalStyles is kept unchanged for backward compatibility with already-saved pages. The composite preset shapes are shared between the two, which is why getPresetStyles() accepts either.
Reusable Classes#
export interface JalpiClass {
key: string;
name: string;
styles: StyleMap;
tabletStyles?: StyleMap;
mobileStyles?: StyleMap;
settings?: {
bgNormal?: BgData; bgHover?: BgData;
overlayNormal?: BgData; overlayHover?: BgData;
borderNormal?: BorderData; borderHover?: BorderData;
};
globalStyleRef?: CBNode['globalStyleRef'];
favorite: boolean;
sortOrder: number;
updatedAt?: string;
}The type's comment describes it exactly: a class is structurally a headless node β the same three style maps plus the same background and border settings bucket a node uses. That is what allows Jalpi_Renderer::compile_class_css() to compile it with the same styles_to_css(), bg_data_to_css() and border_data_to_css() helpers node styles go through.
Nodes reference classes by key, in settings.cssClasses, and attach order is significant β it is the cascade order. sortOrder orders the class list itself in the manager.
An attached key that no longer resolves is skipped silently on both sides.
How It Is Stored#
Three tables and one option hold everything.
| Location | Contents |
|---|---|
{prefix}jalpi_pages | post_id (unique), page_data LONGTEXT, version INT, created_at, updated_at |
{prefix}jalpi_classes | class_key (unique), name, styles LONGTEXT, favorite, sort_order, created_by, timestamps |
{prefix}jalpi_revisions | post_id, user_id, label, data_hash CHAR(32), data LONGTEXT, is_snapshot, created_at |
jalpi_settings_design_system option | The DesignSystem object |
Note that jalpi_pages.version is an integer row counter incremented on every save β unrelated to PageData.version, which is a string inside the JSON.
Revisions deduplicate by content: data_hash is an md5() of the encoded JSON, and a create request whose hash matches the most recent revision for that post returns { skipped: true, reason: 'no_change' } instead of inserting. Auto-saves are pruned to MAX_AUTO = 50 per post and named snapshots to MAX_SNAPSHOT = 20, tracked separately through the is_snapshot flag.
The REST envelope for reading a page adds post context around the document:
{
"post_id": 42,
"post_title": "Home",
"post_status": "publish",
"page_data": { "version": "1.0", "sections": [] }
}Saving sends only { page_data } back.
Examples#
A complete stored page#
Section β container β column β elements, showing responsive overrides, a settings bucket, a token link and an attached class.
{
"version": "1.0",
"sections": [
{
"id": "section_a1b2c3d",
"type": "section",
"settings": {
"contentWidth": "boxed",
"boxedWidth": "1200px",
"bgNormal": { "type": "classic", "color": "#f8f9fb" },
"cssClasses": ["hero-band"]
},
"styles": { "paddingTop": "80px", "paddingBottom": "80px" },
"mobileStyles": { "paddingTop": "40px", "paddingBottom": "40px" },
"children": [
{
"id": "container_e4f5g6h",
"type": "container",
"settings": { "layoutMode": "flex", "flexJustify": "space-between", "flexGap": "32px" },
"children": [
{
"id": "column_i7j8k9l",
"type": "column",
"settings": { "width": "50%" },
"children": [
{
"id": "heading_m1n2o3p",
"type": "heading",
"content": { "text": "Build faster", "tag": "h1" },
"styles": { "fontSize": "48px", "fontWeight": "700", "color": "#111827" },
"tabletStyles": { "fontSize": "36px" },
"mobileStyles": { "fontSize": "28px" },
"globalStyleRef": {
"tokens": { "color": { "category": "colors", "id": "dark" } }
}
},
{
"id": "button_q4r5s6t",
"type": "button",
"content": { "text": "Get started", "url": "/signup", "newTab": false },
"styles": { "backgroundColor": "#6366f1", "color": "#ffffff", "borderRadius": "8px" },
"globalStyleRef": { "buttonId": "primary" }
}
]
},
{
"id": "column_u7v8w9x",
"type": "column",
"settings": { "width": "50%" },
"hideOn": { "mobile": true },
"children": [
{
"id": "image_y1z2a3b",
"type": "image",
"content": { "url": "https://example.com/hero.jpg", "alt": "Product screenshot" },
"styles": { "width": "100%", "borderRadius": "12px" }
}
]
}
]
}
]
}
]
}An interaction rule#
Stored on node.interactions. Trigger and action must match the server allowlists exactly, including camelCase.
{
"interactions": [
{
"id": "ir_7x2k91",
"trigger": "scrollIntoView",
"action": "slide",
"enabled": true,
"settings": {
"direction": "up",
"distance": "40px",
"duration": "600ms",
"delay": "100ms",
"easing": "cubic-bezier(0.16, 1, 0.3, 1)",
"viewportPct": "20",
"replay": false
},
"responsive": { "mobile": false }
}
]
}A reusable class and a Design System token#
A class is a headless node. A token carries its own breakpoint overrides.
// {prefix}jalpi_classes β styles column
{
"key": "card_shell",
"name": "card-shell",
"styles": { "paddingTop": "24px", "paddingBottom": "24px", "borderRadius": "12px" },
"mobileStyles": { "paddingTop": "16px", "paddingBottom": "16px" },
"settings": {
"bgNormal": { "type": "classic", "color": "#ffffff" },
"borderNormal": { "borderType": "solid", "borderColor": "#e5e7eb", "borderWidth": "1px" }
},
"globalStyleRef": {
"tokens": { "borderRadius": { "category": "borderRadius", "id": "md" } }
},
"favorite": false,
"sortOrder": 3
}
// jalpi_settings_design_system β colors[] / fontSizes[]
{
"id": "lg",
"name": "Large",
"value": "20px",
"tabletValue": "18px",
"mobileValue": "16px"
}Dimension values the sanitiser accepts#
From sanitize_dimension(). Anything not matching one of these forms is dropped, and the property disappears from the stored node.
ACCEPTED
"" auto inherit initial unset none normal
16px 1.5rem 2em 50% 100vw 80vh 50dvh
1.6 (unitless β line-height etc.)
300ms 0.4s 45deg 1fr 2ch 3ex
clamp(1.5rem, 4vw, 3rem) min(90%, 1200px) max(2rem, 5vw)
REJECTED (property silently omitted from stored JSON)
calc(100% - 2rem) -- no arithmetic
var(--my-size) -- no custom properties
clamp(1rem, calc(2vw), 3rem) -- no nesting
20 -- accepted, but stays unitless;
the renderer appends px for dimension propsThe smallest valid node#
Only id and type are required. The sanitiser copies every other key only when present.
{
"id": "spacer_z9y8x7w",
"type": "spacer"
}Notes#
- Every value in
StyleMapis a string, including numbers.StyleMapalso carries an index signature, so widget-specific keys such asiconSize,iconRotateandouterPaddingTopare valid alongside standard CSS property names. - Backgrounds, borders and overlays live in
settingsasBgData/BorderDataobjects in normal/hover pairs β not instyles. They are multi-part structures, not single declarations. PageData.versionandjalpi_pages.versionare unrelated. The first is a string inside the JSON, seeded as'1.0'and only preserved; the second is an integer row counter incremented on every save.- A page with no stored row is not empty.
Jalpi_API::load_page_data()falls back todefault_page_data(), which returns a seeded section and container withrandom_bytes-derived ids. - Interaction
triggerandactionvalues are validated by strictin_array()membership and deliberately not passed throughsanitize_key()β that function lowercases, which would never match camelCase values such asscrollIntoView. InteractionSettings.onceOnlyis marked deprecated in the type: never read at runtime, kept only so old saved rules round-trip.replayis the single source of truth.- Revisions deduplicate on an
md5()of the encoded JSON. An unchanged auto-save returns{ skipped: true, reason: 'no_change' }rather than inserting a row. split-textis in the sanitiser's allowed-type list and has aJalpi_Element_Split_Textclass, but is not a member of the TypeScriptElementTypeunion β it is applied as a treatment through the Animation tab rather than inserted as a widget.
Warnings#
Jalpi_Sanitizer::sanitize_styles()is a strict allowlist. A style key it does not recognise is dropped silently on save β no error, no log, no editor feedback. Before adding a style control, add its key to$color_keys,$dim_keys, or the switch, or the value will not survive.- Three keys are written into
stylesby the Style tab and read from$stylesby the heading and text element classes, but have no branch insanitize_styles():paragraphSpacing,linkColorandlinkColorHover. As the code stands, the editor stores them, the sanitiser discards them on save, and the element code that reads them cannot fire. Jalpi_Renderer::styles_to_css()maps far more keys than the sanitiser preserves. Do not infer from that map that a property can be stored on a node β the sanitiser's allowlist is the authority for what reaches the renderer at all.- Node ids must be unique across the entire tree. The sanitiser drops the second occurrence of any repeated id as a circular-reference guard, so copying a subtree without regenerating ids loses content on save.
- Trees deeper than
MAX_DEPTH(20) are truncated at save time. Nodes below that level are dropped without any warning reaching the editor. NodeContentnames only eleven of the 56 element types. Everything else is an untyped bag, so TypeScript will not catch a misspelled content key for the large majority of widgets β the widget registry's schema and the PHP mirror are the real contract there.- The node tree must stay strictly JSON-serialisable. The editor's undo history clones with
JSON.parse(JSON.stringify(...))and the server round-trips throughwp_json_encode()/json_decode(); functions,Dateobjects,Maps andundefinedarray members survive neither. PageData.globalStylesis legacy. It is still read and preserved for pages saved before the Design System existed, but new values belong in the site-wideDesignSystemβ writing to both leaves two sources of truth for the same presets.
Source Files#
admin/editor/src/types/index.tsadmin/editor/src/store/editorStore.tsadmin/editor/src/utils/designTokens.tsadmin/editor/src/widgets/registry.tsadmin/editor/src/components/canvas/CanvasNode.tsxadmin/editor/src/components/panels/PropertiesPanel.tsxincludes/class-jalpi-sanitizer.phpincludes/class-jalpi-api.phpincludes/class-jalpi-renderer.phpincludes/class-jalpi-revisions.phpincludes/class-jalpi-activator.phpincludes/class-jalpi-settings.phpincludes/class-jalpi-class-manager.phpincludes/widgets-schema.phpincludes/elements/class-jalpi-element-heading.phpincludes/elements/class-jalpi-element-text.phpincludes/elements/class-jalpi-element-container.php
Related#
- Introduction
- Architecture Overview
- The Editor
- Editor Controls
- Widget Registry
- Canvas Rendering
- Create a Widget
- API Reference
Last updated: November 2026