blueprintsjs 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +165 -2
- package/dist/blueprintsjs.umd.cjs +325 -0
- package/dist/blueprintsjs.umd.cjs.map +1 -0
- package/dist/chunks/validate-DHOIGyop.js +860 -0
- package/dist/chunks/validate-DHOIGyop.js.map +1 -0
- package/dist/chunks/validate-Ddbqd8bD.cjs +859 -0
- package/dist/chunks/validate-Ddbqd8bD.cjs.map +1 -0
- package/dist/core/build.d.cts +33 -0
- package/dist/core/build.d.ts +33 -0
- package/dist/core/compile.d.cts +27 -0
- package/dist/core/compile.d.ts +27 -0
- package/dist/core/helpers.d.cts +13 -0
- package/dist/core/helpers.d.ts +13 -0
- package/dist/core/layout.d.cts +19 -0
- package/dist/core/layout.d.ts +19 -0
- package/dist/core/registry.d.cts +23 -0
- package/dist/core/registry.d.ts +23 -0
- package/dist/core/schema.d.cts +14 -0
- package/dist/core/schema.d.ts +14 -0
- package/dist/core/types.d.cts +215 -0
- package/dist/core/types.d.ts +215 -0
- package/dist/core/validate.d.cts +9 -0
- package/dist/core/validate.d.ts +9 -0
- package/dist/editor/GraphEditor.d.cts +181 -0
- package/dist/editor/GraphEditor.d.ts +181 -0
- package/dist/editor/details.d.cts +23 -0
- package/dist/editor/details.d.ts +23 -0
- package/dist/editor/dom.d.cts +20 -0
- package/dist/editor/dom.d.ts +20 -0
- package/dist/editor/highlight.d.cts +7 -0
- package/dist/editor/highlight.d.ts +7 -0
- package/dist/editor/index.d.cts +13 -0
- package/dist/editor/index.d.ts +13 -0
- package/dist/editor/state.d.cts +113 -0
- package/dist/editor/state.d.ts +113 -0
- package/dist/editor/styles.d.cts +7 -0
- package/dist/editor/styles.d.ts +7 -0
- package/dist/editor.cjs +2196 -0
- package/dist/editor.cjs.map +1 -0
- package/dist/editor.js +2196 -0
- package/dist/editor.js.map +1 -0
- package/dist/index.cjs +1251 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +1252 -0
- package/dist/index.js.map +1 -0
- package/dist/locales/index.d.cts +15 -0
- package/dist/locales/index.d.ts +15 -0
- package/dist/locales/ru.d.cts +3 -0
- package/dist/locales/ru.d.ts +3 -0
- package/dist/locales/uk.d.cts +3 -0
- package/dist/locales/uk.d.ts +3 -0
- package/dist/locales.cjs +579 -0
- package/dist/locales.cjs.map +1 -0
- package/dist/locales.js +579 -0
- package/dist/locales.js.map +1 -0
- package/dist/nodes/data.d.cts +26 -0
- package/dist/nodes/data.d.ts +26 -0
- package/dist/nodes/dom.d.cts +27 -0
- package/dist/nodes/dom.d.ts +27 -0
- package/dist/nodes/events.d.cts +11 -0
- package/dist/nodes/events.d.ts +11 -0
- package/dist/nodes/flow.d.cts +10 -0
- package/dist/nodes/flow.d.ts +10 -0
- package/dist/nodes/index.d.cts +11 -0
- package/dist/nodes/index.d.ts +11 -0
- package/dist/nodes/lib.d.cts +7 -0
- package/dist/nodes/lib.d.ts +7 -0
- package/dist/umd.d.cts +5 -0
- package/dist/umd.d.ts +5 -0
- package/dist/version.d.cts +2 -0
- package/dist/version.d.ts +2 -0
- package/docs/compiler.md +149 -0
- package/docs/custom-nodes.md +119 -0
- package/docs/editor.md +166 -0
- package/docs/guide.md +79 -0
- package/docs/nodes.md +494 -0
- package/docs/nodes.ru.md +494 -0
- package/docs/schema.md +64 -0
- package/examples/index.html +110 -0
- package/package.json +107 -4
- package/schema/blueprint.schema.json +102 -0
package/docs/editor.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Editor
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
import { GraphEditor, createText } from 'blueprintsjs/editor';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
`GraphEditor` is a full-window blueprint editor built with plain DOM and SVG. It edits a **copy** of the blueprint and hands it back through callbacks; it never stores anything itself.
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
const editor = new GraphEditor({
|
|
11
|
+
blueprint, // Blueprint (copied)
|
|
12
|
+
registry, // NodeRegistry — the palette and the compiler
|
|
13
|
+
onChange: (bp) => save(bp), // after every edit (not on selection or mid-drag)
|
|
14
|
+
onClose: (bp) => save(bp), // "Done" / close(); bp includes the viewport (bp.editor)
|
|
15
|
+
}).mount(); // appends to document.body and fits the graph
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Options
|
|
19
|
+
|
|
20
|
+
| Option | Type | |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| `blueprint` | `Blueprint` | Required. |
|
|
23
|
+
| `registry` | `NodeRegistry` | Required. Palette = `registry.list()`. |
|
|
24
|
+
| `t` | `Text` | Translations, see below. Default: English. |
|
|
25
|
+
| `onChange` | `(bp) => void` | After every change of the blueprint. Debounce it if saving is expensive. |
|
|
26
|
+
| `onClose` | `(bp) => void` | When the user presses "Done" (or `close()` is called). |
|
|
27
|
+
| `code` | `(bp) => string` | JavaScript shown in the JS tab. Default: the blueprint built alone. |
|
|
28
|
+
| `pages` | `() => { id, name }[]` | Pages offered for `template` blueprints. The page list is shown when there are two or more. |
|
|
29
|
+
| `pickSelector` | `() => Promise<string \| null>` | Adds an eyedropper next to selector fields (e.g. pick an element in a preview). |
|
|
30
|
+
| `validateComponentType` | `(type) => string \| null` | Checks the component type field; return an error message or `null`. |
|
|
31
|
+
| `clipboardKey` | `string \| false` | `localStorage` key for copy/paste between blueprints (default `'bp-clipboard'`); `false` keeps it in memory. |
|
|
32
|
+
| `injectCss` | `boolean` | Add the editor stylesheet to the document (default `true`). |
|
|
33
|
+
| `dir` | `'ltr' \| 'rtl'` | Text direction. |
|
|
34
|
+
| `embedded` | `boolean` | Fill the parent element instead of the window (class `bpe--embedded`). Mount into a positioned element. |
|
|
35
|
+
| `readonly` | `boolean` | Read-only viewer (class `is-readonly`): nodes and links cannot be changed — no palette, details, wiring, deleting, literal editing, undo or search. Pan, zoom, fit, minimap and selection work; left-drag on the empty canvas pans. |
|
|
36
|
+
| `movable` | `boolean` | Read-only mode: nodes can still be dragged for reading (not reported through `onChange`). |
|
|
37
|
+
| `onNodeClick` | `(node, event) => void` | A node was clicked without dragging (both modes; meant for viewers). |
|
|
38
|
+
| `nodeClass` | `(node) => string \| undefined` | Extra CSS classes of a node (statuses such as `done`, `active`); call `refresh()` after they change. |
|
|
39
|
+
| `showCode` | `boolean` | Show the JavaScript tab (default: on when editing, off in read-only mode). |
|
|
40
|
+
| `autoLayout` | `boolean \| { gapX, gapY, origin }` | Lay the graph out on mount by the rendered node sizes (generated graphs without positions). |
|
|
41
|
+
|
|
42
|
+
## Methods and properties
|
|
43
|
+
|
|
44
|
+
| | |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `mount(parent = document.body)` | Insert and fit. Returns the editor. |
|
|
47
|
+
| `close()` | Calls `onClose` with the blueprint (and viewport), then `destroy()`. |
|
|
48
|
+
| `destroy()` | Removes the editor without `onClose`. Dispatches `bpe:closed` on `root`. |
|
|
49
|
+
| `state` | The `GraphState` (see below): `editor.state.toJSON()` is the current blueprint. |
|
|
50
|
+
| `root` | The editor element (`.bpe`). |
|
|
51
|
+
| `setTab('graph' \| 'code')` | Switch between the graph and the JavaScript view. |
|
|
52
|
+
| `fit(onlySelection?)`, `setZoom(z)`, `focusNode(id)` | Viewport. |
|
|
53
|
+
| `addNodeAtCenter(type)` | Add a node; returns its id. |
|
|
54
|
+
| `layout(options?)` | Automatic layered layout by the rendered node sizes (no undo step). |
|
|
55
|
+
| `refresh()` | Re-render nodes and wires (after `nodeClass` results changed). |
|
|
56
|
+
| `readonly` | `true` in the read-only viewer mode. |
|
|
57
|
+
| `copy()`, `paste()`, `commentSelection()` | Same as the shortcuts. |
|
|
58
|
+
|
|
59
|
+
## Controls
|
|
60
|
+
|
|
61
|
+
| Action | |
|
|
62
|
+
|---|---|
|
|
63
|
+
| Add a block | drag from the palette, or click it; right-click / double-click / `Tab` / `A` on the canvas opens the search |
|
|
64
|
+
| Connect | drag from a pin to a pin; incompatible pins dim. Drop on empty space → search filtered to blocks that fit, connected automatically |
|
|
65
|
+
| Disconnect | drag a wire off a connected input; `Alt`+click a pin or a wire |
|
|
66
|
+
| Pan | right or middle mouse button, or `Space` + drag |
|
|
67
|
+
| Zoom | mouse wheel (25–200%, around the cursor) |
|
|
68
|
+
| Select | click; `Shift`/`Ctrl`+click to add; drag a frame on empty space |
|
|
69
|
+
| Delete | `Delete` / `Backspace` |
|
|
70
|
+
| Copy, paste, cut, duplicate, select all | `Ctrl`+`C` / `V` / `X` / `D` / `A` |
|
|
71
|
+
| Undo, redo | `Ctrl`+`Z`, `Ctrl`+`Y` (or `Ctrl`+`Shift`+`Z`) |
|
|
72
|
+
| Comment around the selection | `C` |
|
|
73
|
+
| Fit all / selection | `F` |
|
|
74
|
+
| Close search, clear selection | `Esc` |
|
|
75
|
+
|
|
76
|
+
Every key press inside the editor is stopped at its root, so the host page's shortcuts do not fire behind it.
|
|
77
|
+
|
|
78
|
+
The right panel shows the settings of the selected block (or of the blueprint when nothing is selected: name, description, kind, pages and condition, component settings, variables) and the list of problems. Clicking a problem selects its block. In the JavaScript tab, clicking a `// n3 · …` comment jumps to the block.
|
|
79
|
+
|
|
80
|
+
## Translations
|
|
81
|
+
|
|
82
|
+
The editor takes a `Text` function: `(key, englishFallback, ...args) => string`, with `%s` replaced by `args` in order. `createText(...dictionaries)` builds one: the first dictionary that has the key wins, then English.
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
import { ru, uk, locales } from 'blueprintsjs/locales';
|
|
86
|
+
|
|
87
|
+
createText(ru) // Russian
|
|
88
|
+
createText({ 'ui.done': 'Save' }, ru) // your wording over Russian
|
|
89
|
+
createText(locales[lang]) // by language code (undefined → English)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Keys:
|
|
93
|
+
|
|
94
|
+
| Key | For |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `ui.*` | editor interface |
|
|
97
|
+
| `cat.<category>` | palette categories |
|
|
98
|
+
| `node.<type>`, `desc.<type>` | block titles and descriptions |
|
|
99
|
+
| `label.<English label>` | pin and setting labels (`label.Selector`) |
|
|
100
|
+
| `diag.<code>` | problem messages (`%s` = `args`) |
|
|
101
|
+
|
|
102
|
+
For a new language, copy `src/locales/ru.ts` (≈ 290 keys) and translate the values; English needs no dictionary. Blocks you add get English titles unless you add their keys to your dictionary.
|
|
103
|
+
|
|
104
|
+
`diagnosticText(t, diagnostic)` translates a diagnostic outside the editor.
|
|
105
|
+
|
|
106
|
+
## Styling
|
|
107
|
+
|
|
108
|
+
By default the editor is a fixed, full-window overlay (`.bpe`, `z-index: 10000`); with `embedded: true` it fills its parent instead. It has its own dark theme, so it looks the same in any host. Hooks:
|
|
109
|
+
|
|
110
|
+
- `--bpe-accent` CSS variable — accent colour (buttons, focus).
|
|
111
|
+
- `PIN_COLORS`, `CATEGORY_COLORS` — exported objects; change them before creating the editor.
|
|
112
|
+
- `injectCss: false` + your own copy of `EDITOR_CSS` — full control. `injectEditorCss(doc?)` adds the default stylesheet (`<style id="bpe-style">`) once.
|
|
113
|
+
- A node's `color` sets its header colour.
|
|
114
|
+
- To place the editor in a panel, tab or split view instead of the whole window, pass `embedded: true` and mount it into a positioned element (`position: relative`); it fills that element.
|
|
115
|
+
|
|
116
|
+
## `GraphState`: your own UI
|
|
117
|
+
|
|
118
|
+
`GraphState` is the editing model under the editor, without DOM: use it for a custom editor, tests, or scripted changes.
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
import { GraphState } from 'blueprintsjs/editor';
|
|
122
|
+
|
|
123
|
+
const s = new GraphState(blueprint, registry);
|
|
124
|
+
const a = s.addNode('event.element', [40, 40], { selector: '.btn' });
|
|
125
|
+
const b = s.addNode('dom.toggleClass', [360, 40], { target: '#menu', className: 'open' });
|
|
126
|
+
s.connect([a, 'then'], [b, 'exec']); // false if not allowed; replaces the wire on a data input / exec output
|
|
127
|
+
s.undo();
|
|
128
|
+
s.redo();
|
|
129
|
+
s.on((kind) => render()); // 'graph' | 'move' | 'selection' | 'meta' | 'history'
|
|
130
|
+
s.toJSON(); // the blueprint
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Main methods: `addNode`, `moveBy`, `snapNodes`, `setProps`, `setNodeFlags`, `connect`, `canLink`, `disconnect`, `removeLink`, `linksOf`, `isLinked`, `deleteSelection`, `select`, `toggleSelect`, `selectAll`, `clearSelection`, `setMeta`, `addVariable`, `updateVariable`, `removeVariable`, `addComment`, `updateComment`, `copy`, `paste`, `diagnostics`, `bounds`, `undo`, `redo`, `canUndo`, `canRedo`. Wrap a gesture in `begin()` / `end()` to record it as one undo step; `mutate(fn, kind)` runs a change with history and notification. Node ids are short (`n1`, `n2`…), positions snap to an 8 px grid (`GRID`, `snap`).
|
|
134
|
+
|
|
135
|
+
## Syntax highlighting
|
|
136
|
+
|
|
137
|
+
`highlight(code, prefix = 'bpe')` returns a `<code>` element with one `<span class="bpe-ln">` per line and `<span class="bpe-t-<kind>">` tokens (used by the JS tab); `tokenize(code)` returns the tokens (`{ kind, text }`).
|
|
138
|
+
|
|
139
|
+
## Read-only viewer
|
|
140
|
+
|
|
141
|
+
For graphs generated by an app — dependency trees, quest lines, pipelines — show them with the same look but without editing:
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
import { autoLayout, createBlueprint, defineNode, NodeRegistry } from 'blueprintsjs';
|
|
145
|
+
import { GraphEditor } from 'blueprintsjs/editor';
|
|
146
|
+
|
|
147
|
+
// display-only node types: no `compile`
|
|
148
|
+
const registry = new NodeRegistry().add(defineNode({
|
|
149
|
+
type: 'app.step', category: 'flow', title: 'Step',
|
|
150
|
+
ports: { inputs: [{ id: 'in', type: 'exec' }], outputs: [{ id: 'out', type: 'exec' }] },
|
|
151
|
+
}));
|
|
152
|
+
const bp = createBlueprint({ name: 'Quest' });
|
|
153
|
+
bp.nodes = steps.map((s) => ({ id: s.id, type: 'app.step', pos: [0, 0], title: s.title, lines: s.notes, color: s.done ? '#2e6b5f' : undefined }));
|
|
154
|
+
bp.links = edges.map(([a, b]) => ({ from: [a, 'out'], to: [b, 'in'] }));
|
|
155
|
+
|
|
156
|
+
const viewer = new GraphEditor({
|
|
157
|
+
blueprint: bp, registry, readonly: true, movable: true, embedded: true,
|
|
158
|
+
autoLayout: { gapX: 90, gapY: 18 }, // or autoLayout(bp, …) yourself before mounting
|
|
159
|
+
nodeClass: (n) => (picked.has(n.id) ? 'is-picked' : undefined),
|
|
160
|
+
onNodeClick: (n) => { toggle(n.id); viewer.refresh(); },
|
|
161
|
+
}).mount(panel);
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- Node instances may carry `title`, `lines` (text under the title instead of the settings summary) and `color` (header).
|
|
165
|
+
- `autoLayout(bp, { width, height, gapX, gapY, origin })` — layered layout by the longest path, back edges ignored, barycentre sweeps to reduce crossings. Exported from the core (no DOM).
|
|
166
|
+
- Compiling a graph with display-only nodes yields a warning per node and no code for them.
|
package/docs/guide.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Guide
|
|
2
|
+
|
|
3
|
+
## What a blueprint is
|
|
4
|
+
|
|
5
|
+
A blueprint is a small program drawn as a graph. **Nodes** (blocks) are connected by **wires** between their **pins**:
|
|
6
|
+
|
|
7
|
+
- **exec pins** (white) say *what happens next*. An exec output can feed one exec input; to do several things in a row, use **Sequence** (`flow.sequence`) or chain the blocks.
|
|
8
|
+
- **data pins** carry values. A data input takes one wire; an output can feed many inputs. Pin types: `string`, `number`, `boolean`, `element`, `elements`, `event`, `object`, `any`.
|
|
9
|
+
|
|
10
|
+
Allowed wires: same type; anything ↔ `any`; `element` → `elements`; `number`/`boolean` → `string`; anything → `boolean`. `canConnect(fromType, toType)` implements this rule.
|
|
11
|
+
|
|
12
|
+
An unconnected data input uses the value typed on the block (stored in `node.props[pinId]`). On `element`/`elements` inputs that value is a **CSS selector**, resolved in the blueprint root when the block runs.
|
|
13
|
+
|
|
14
|
+
## How it runs
|
|
15
|
+
|
|
16
|
+
The compiler follows the same model as UE5 Blueprints:
|
|
17
|
+
|
|
18
|
+
1. **Event nodes start chains.** "On element event", "On start", "On page event", "On timer", "On key", "On custom event". Each sets up a listener; its exec output runs when the event fires.
|
|
19
|
+
2. **Action nodes run in exec order.** Each continues with its `then` output (or other exec outputs: `true`/`false` of a Branch, `Then 0…N` of a Sequence, `body`/`completed` of For Each…).
|
|
20
|
+
3. **Pure nodes** (no exec pins: math, compare, concat, find element…) are **evaluated where their value is used**, every time it is used. Data wires that loop back on themselves are reported as `cycle`.
|
|
21
|
+
4. **Outputs of action nodes** (the element of "On element event", the result of "JavaScript") keep **their last value** — they are variables of the blueprint, assigned when the node runs.
|
|
22
|
+
5. **Variables** (`bp.variables`) live as long as the blueprint runs; "Get"/"Set" nodes read and write them.
|
|
23
|
+
6. **Disabled nodes** are compiled as pass-through: execution continues to their first exec output.
|
|
24
|
+
7. Nodes not reachable from any event are reported (`unreachable`) and left out.
|
|
25
|
+
|
|
26
|
+
Element events are **delegated to the root** (the document for page blueprints), so they work for elements added later. `mouseenter`/`mouseleave` and `focus`/`blur` are mapped to bubbling events with the right checks.
|
|
27
|
+
|
|
28
|
+
## Kinds
|
|
29
|
+
|
|
30
|
+
| Kind | Root | When it runs | Built with |
|
|
31
|
+
|---|---|---|---|
|
|
32
|
+
| `global` | `document` | on every page | `buildScript` |
|
|
33
|
+
| `template` | `document` | only where `target.when` (CSS selector) matches the document; `target.pages` lists the host's pages that get it | `buildScript` |
|
|
34
|
+
| `component` | the component element | once per instance; `ctx.params` holds the instance parameters | `buildStandalone` |
|
|
35
|
+
|
|
36
|
+
`target.pages` is metadata for your host: `buildScript` does not filter by it. Pick the blueprints for a page yourself, as `grapesjs-scripts` does:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const forPage = (pageId) => all.filter((b) => b.kind !== 'template' || !b.target?.pages?.length || b.target.pages.includes(pageId));
|
|
40
|
+
buildScript(forPage('about'), registry);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Component blueprints describe the component in `bp.component`: `type`, `label`, `html`, `css`, and `params` (`{ id, label, type: 'string' | 'number' | 'boolean' | 'select', default, options }`). The "Component parameter" node reads `ctx.params[id]`.
|
|
44
|
+
|
|
45
|
+
## Stopping
|
|
46
|
+
|
|
47
|
+
Everything a blueprint sets up — listeners, intervals, timeouts, debounce timers — is registered with a disposer list. Each compiled blueprint returns a function that undoes it:
|
|
48
|
+
|
|
49
|
+
- page script (`target: 'page'`): starts itself; nothing to stop;
|
|
50
|
+
- preview (`target: 'preview'`): evaluates to `start(document) → dispose`;
|
|
51
|
+
- component (`buildStandalone`): `function (root, ctx) → dispose`.
|
|
52
|
+
|
|
53
|
+
A host that previews scripts in an editor (re-running them after each change) calls `dispose()` before starting again.
|
|
54
|
+
|
|
55
|
+
## Errors at runtime
|
|
56
|
+
|
|
57
|
+
Each blueprint runs in its own `try/catch` at start; an error in one does not stop the others (it is logged as `[blueprint <id>]`). Library calls (`lib.call`, `lib.new`, `lib.method`) warn in the console instead of throwing when the global is missing.
|
|
58
|
+
|
|
59
|
+
## Global libraries
|
|
60
|
+
|
|
61
|
+
`lib.call`, `lib.new`, `lib.method`, `lib.get` reach globals by path (`gsap.to`, `Swiper`, `AOS.init`) at the moment the block runs, so the library may load later than the script. Loading the library is the host's job (a `<script>` tag, a CDN link…).
|
|
62
|
+
|
|
63
|
+
## The JavaScript node
|
|
64
|
+
|
|
65
|
+
`code.js` runs your code with `inputs` (its input pins) and `ctx` (`root`, `document`, `window`, `params`). Return an object with the outputs: `return { result: 42 };`. With **Async**, return a Promise; the chain continues when it resolves. Inputs and outputs are edited as a list of pins (the `pins` setting).
|
|
66
|
+
|
|
67
|
+
`code.expression` is the pure version: a single expression of `a` and `b`.
|
|
68
|
+
|
|
69
|
+
## Integrating in a host
|
|
70
|
+
|
|
71
|
+
A host application usually:
|
|
72
|
+
|
|
73
|
+
1. **stores** blueprints as JSON (they are plain data; `normalizeBlueprint` makes any input safe to load);
|
|
74
|
+
2. **edits** them with `GraphEditor` (or its own UI over `GraphState`);
|
|
75
|
+
3. **validates** with `validateBlueprint` / the `diagnostics` of a build, and shows problems;
|
|
76
|
+
4. **previews** with `buildScript(…, { target: 'preview' })` and disposes before each re-run;
|
|
77
|
+
5. **exports** with `buildScript` (page) and `buildStandalone` (components), then optionally minifies.
|
|
78
|
+
|
|
79
|
+
`grapesjs-scripts` is a complete example of such a host (GrapesJS page builder): it adds an element picker (`pickSelector`), page lists (`pages`), component type validation (`validateComponentType`), live preview in the canvas and export to files.
|