Regular .boxes files can be templates#3
Merged
Merged
Conversation
…in file format
- Move template definitions from templates.js inline JS to JSON files in
packages/core/src/templates/ (blank.json, arrows.json, owl-ontology.json)
- Template format now uses 'title'/'description' (replacing 'name') and
'userStylesheet' (consistent with saved file format)
- Add 'palette: { nodeTypes, edgeTypes }' to the graph file format so that
the palette is saved and restored automatically on file load
- BoxesEditor constructor accepts a 'template' option (pre-loaded JSON object);
individual options (style, nodeTypes, edgeTypes, context) still work and
take precedence over template fields
- BoxesEditor.exportGraph() now includes title, description, and palette
- BoxesEditor.importGraph() restores palette (nodeTypes/edgeTypes), title,
and description from the loaded file
- app.js: startWithTemplate() now accepts a full template object (or ID string
for backwards compatibility); loadFromFile() restores palette directly from
the loaded file rather than looking up templateId; saves no longer store
templateId (backwards compat: old files with templateId still load correctly)
- Add loadTemplateFromUrl(url) utility (fetch-based) exported from core;
app.js loadTemplates() accepts optional extra template URL list
- core vite.config.js: copy template JSON files to dist/templates/ so they
are fetch-accessible at /core/templates/*.json
- Update tests: templates.test.js uses title/description/palette fields;
boxes-editor.test.js adds palette export, palette restore, and template
constructor option tests (150 tests pass, up from 146)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Palette items now show edit (✎) and delete (×) buttons on hover. '+ Add node type' and '+ Add edge type' buttons appear below each section. Clicking edit or add opens an inline form with: - Node types: label, id, background color, border color, shape - Edge types: label, id, color, line style - Both: optional JSON data template for default node/edge properties Public API additions on BoxesEditor: addNodeType(type), updateNodeType(id, updates), removeNodeType(id) addEdgeType(type), updateEdgeType(id, updates), removeEdgeType(id) All mutations re-render the palette and emit a 'paletteChanged' event. Together with the palette-in-file-format change, this lets users build and save custom palettes directly from the editor UI, making it easy to create new templates by designing a palette and saving the file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.