Template Management
The editor ships three kinds of templates so that finished work can be reused on new pages or in new projects. Understanding how each one is reused is the key to avoiding "change one thing, break many".
1. Three template kinds
| Aspect | Page template | Widget template | Layout template |
|---|---|---|---|
| Reused object | A whole page (size, theme, graphics) | A single graphic or group | Page skeleton (header/sidebar/footer + content) |
| Instantiation | Copy a snapshot into a new page | Copy a snapshot and group it | No copy; composed at runtime |
| Updating later | Manual "sync template", three-way merge | Manual sync, whole instance rebuilt with variables kept | Template change takes effect after refresh |
| Typical use | Create pages from a standard screen | Repeat a widget many times | One header/footer/background for all pages |
| Details | Page template panel | Widget template panel | Layout Template Guide |
2. Project materialization (copy-on-use)
System templates (source: builtin) are read-only originals. Pages and instances never bind to them directly, and they cannot be edited in place. Every association/instantiation first copies the template into the project directory:
ss-run/ss/data/projects/{projectId}/canvas-templates/
├── pages/
├── widget-templates/
└── layouts/
Rules:
| Rule | Description |
|---|---|
| System templates are read-only | data/canvas-templates/** only holds builtins; the UI offers no in-place editing |
| Copy on use | Association/instantiation copies the template into the project; pages reference the project copy |
| Keep the original id | Copies keep the original id and file name; only the path changes. Resolution is project first, system as fallback |
| Reuse copies | An existing copy with the same id is reused instead of creating one duplicate per association |
| Edit location | Only the template editor can modify a project copy; layout graphics stay read-only on pages |
| Selection order | Every picker shows project templates first, system templates after |
3. Choosing a template
- "Create a complete screen in one click" → page template.
- "Reuse one widget on many pages with different parameters" → widget template.
- "Share one header/footer/background across pages and change it once" → layout template.
See Layout Template Guide for the builtin list, region locking, association flow and FAQ.