Layout Template Guide
A layout template describes a page skeleton: background, header, footer, sidebar and content area. Pages only draw business content; the skeleton is provided once and shared. Change the template once and every associated page follows.
1. When to use
- A project has several pages that must share the exact same header/footer/background.
- Station name, product identity, version and data-source notes must be maintained in one place.
- Page content must be prevented from overlapping the header/footer (region locking).
Not a fit: single-page projects, or pages with intentionally different frames.
2. Builtin layout templates
Five skeletons ship with the system (source: builtin, read-only originals):
| id | Name | Canvas | Regions (locked in bold) | Best for |
|---|---|---|---|---|
sys-standard-monitor |
Standard monitoring | 1920×1080, #0A1929 |
header 0,0,1920×64; sidebar 0,64,240×976; content 240,64,1680×976; footer 0,1040,1920×40 | Generic monitoring pages |
sys-top-nav |
Top navigation | 1920×1080, #0A1929 |
header height 80 with screen-switch buttons; content fills the rest | Multi-screen switching |
sys-left-nav |
Left navigation | 1920×1080, #101C2B |
header height 56; sidebar; content | Menu-heavy operation screens, no footer |
sys-big-screen |
Big-screen visualization | 3840×2160, #060C29 |
header 120; left 480; content 2880×1920; right 480; footer 120 | 4K control-room walls |
sys-kanban-light |
Light kanban | 1920×1080 | header + three-card content area | Shop-floor boards, daily reports |
Region rects follow the builtin definitions in code; the template editor's lock outlines are authoritative.
3. Data model
interface LayoutTemplate {
id: string;
name: string;
source: 'builtin' | 'user'; // system original / project copy
originTemplateId?: string; // provenance of a project copy
templateType: 'layout';
schemaVersion: number;
pageConfig?: { width; height; backgroundColor }; // optionally inherited on association
graphics: IGraphicJSON[]; // skeleton graphics
regions: Array<{ id; name; rect; locked }>;
thumbnail?: string;
tags?: string[];
}
A page only stores:
| Field | Meaning |
|---|---|
layoutTemplateId |
Associated template id (project copy and system template share the id) |
layoutRegions |
Region snapshot captured on association; realigned with the template on page load |
4. Regions and locking
locked: trueregions (header/sidebar/footer) accept layout graphics only; page graphics are rejected (drag, marquee selection and paste are all constrained).contentis unlocked; all page content lives there.- In design mode layout graphics render with their real style but are not selectable, draggable or deletable (they are not part of the page graphic collection).
- Rule of thumb: a page graphic is out of bounds when its center falls inside a locked region; this applies to move and resize as well.
5. Association flow
- Open a page and find "Layout Template" in the property panel.
- The dropdown has two groups: project templates first, system templates second.
- Selecting a system template first copies it into
projects/{projectId}/canvas-templates/layouts/(same id, same file name) and then associates the page with that copy. An existing copy with the same id is reused. - "Not associated" removes the layout; the page keeps only its own graphics.
- On association, the template's
pageConfigcan optionally be inherited (page size and background).
If the copy or the template read fails, the association is aborted instead of binding the page to a read-only system original.
6. Editing and propagation
- Where to edit: template editor only. Pages are always read-only.
- Editing a system template: it cannot be saved in place; entering edit from a page saves a project copy and re-points the current page to it on return.
- Scope: a template update reaches all pages associated with that copy (visible after a runtime refresh); no per-page sync is needed.
- Cross-project isolation: each project has its own copy file; editing project A never affects project B. Only a system seed upgrade changes builtins globally.
- Deleting a copy: pages fall back to the system original with the same id instead of going blank.
7. Page design guidance
| Owner | Content |
|---|---|
| Layout template | Background, header (station/brand), footer (version/data source), decorative lines, region locking |
| Page | Page title, business graphics, charts, alarms, in-page navigation |
- Keep navigation inside page content: layout graphics are read-only decoration and do not handle clicks.
- Keep page graphics fully inside the content region to avoid clipping by locked regions.
- All pages under one template share background and header; pages express only their own business.
8. FAQ
| Symptom | Cause and fix |
|---|---|
| Design mode shows only lock outlines, no layout content | Template graphics failed to load or were not normalized (legacy rect/text compact format). Refresh; if still empty, inspect the template file's graphics and re-save it in the template editor |
Runtime error 404 Layout template does not exist |
The page references a project copy but the runtime had no project scope, so it queried the system endpoint. The preview route must carry projectId (current versions set the scope and load project templates automatically); a deleted copy also falls back to the system original |
| Template changed but pages did not | Make sure you edited the project copy, that the page uses that copy, and refresh the preview (runtime caches are rebuilt after refresh) |
| Do different projects interfere? | No. Association copies into each project; editing is isolated, system templates are read-only |
| The system template disappeared from the picker | The project already has a copy with the same id and shadows it; remove the association/copy to see it again |
| Page graphics cannot be dropped into some areas | Those regions are locked: true and reserved by the layout |
9. Relation to AI page generation
layout-presets.md / layout-rules.md under the AI page generator describe section layouts of generated DSL (metric-grid, gauge-grid, chart, alarm). This guide covers the editor-level page skeleton (header/footer/region locking). They compose: lock the frame with a layout template, then generate business content inside the content region.