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
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { type LayoutOptions } from '../core/layout.js';
|
|
2
|
+
import { NodeRegistry } from '../core/registry.js';
|
|
3
|
+
import type { Blueprint, Link, NodeDef, NodeInstance, PinRef } from '../core/types.js';
|
|
4
|
+
import { type Text } from './dom.js';
|
|
5
|
+
import { GraphState } from './state.js';
|
|
6
|
+
export interface GraphEditorOptions {
|
|
7
|
+
blueprint: Blueprint;
|
|
8
|
+
registry: NodeRegistry;
|
|
9
|
+
/** Text lookup (translations). Keys: `ui.*`, `node.<type>`, `desc.<type>`, `cat.<id>`, `label.<English label>`. */
|
|
10
|
+
t?: Text;
|
|
11
|
+
/** JavaScript shown in the JS tab (default: the blueprint built alone). */
|
|
12
|
+
code?: (bp: Blueprint) => string;
|
|
13
|
+
/** Pages for template targets. */
|
|
14
|
+
pages?: () => {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
}[];
|
|
18
|
+
/** Pick a CSS selector (e.g. by clicking in a page); resolves to null when cancelled. */
|
|
19
|
+
pickSelector?: () => Promise<string | null>;
|
|
20
|
+
/** Check a component type; returns an error message or null. */
|
|
21
|
+
validateComponentType?: (type: string) => string | null;
|
|
22
|
+
/** Called after every change of the blueprint (not on selection or while dragging). */
|
|
23
|
+
onChange?: (bp: Blueprint) => void;
|
|
24
|
+
/** The close button / `close()`. */
|
|
25
|
+
onClose?: (bp: Blueprint) => void;
|
|
26
|
+
/** localStorage key for copy/paste between blueprints (`false` = in-memory only). */
|
|
27
|
+
clipboardKey?: string | false;
|
|
28
|
+
/** Inject the editor CSS (default true). */
|
|
29
|
+
injectCss?: boolean;
|
|
30
|
+
/** Text direction. */
|
|
31
|
+
dir?: 'ltr' | 'rtl';
|
|
32
|
+
/**
|
|
33
|
+
* Fill the parent element instead of the whole window (adds the `bpe--embedded` class:
|
|
34
|
+
* `position: absolute`). The parent must be positioned (`position: relative` or similar).
|
|
35
|
+
*/
|
|
36
|
+
embedded?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Read-only viewer: the graph (nodes and links) is shown but cannot be changed — no palette,
|
|
39
|
+
* no wiring, no deleting, no literal editing, no undo. Pan, zoom, fit, minimap and selection work;
|
|
40
|
+
* left-drag on the empty canvas pans. Nodes can still be moved for reading when `movable` is set.
|
|
41
|
+
*/
|
|
42
|
+
readonly?: boolean;
|
|
43
|
+
/** Read-only mode: let the user drag nodes around (positions are not reported as changes). */
|
|
44
|
+
movable?: boolean;
|
|
45
|
+
/** Extra CSS classes of a node (statuses such as "done" / "active"); re-read by `refresh()`. */
|
|
46
|
+
nodeClass?: (node: NodeInstance) => string | undefined;
|
|
47
|
+
/** A node was clicked (without dragging). */
|
|
48
|
+
onNodeClick?: (node: NodeInstance, e: PointerEvent) => void;
|
|
49
|
+
/** Show the JavaScript tab (default: on in edit mode, off in read-only mode). */
|
|
50
|
+
showCode?: boolean;
|
|
51
|
+
/** Lay the graph out on mount by the rendered node sizes (generated graphs without positions). */
|
|
52
|
+
autoLayout?: boolean | Omit<LayoutOptions, 'width' | 'height'>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Visual blueprint editor: palette, graph canvas (pan, zoom, wires, selection, comments),
|
|
56
|
+
* details panel, problems, JS view. Framework-free; mounts into any element.
|
|
57
|
+
*/
|
|
58
|
+
export declare class GraphEditor {
|
|
59
|
+
readonly root: HTMLDivElement;
|
|
60
|
+
readonly state: GraphState;
|
|
61
|
+
readonly t: Text;
|
|
62
|
+
readonly registry: NodeRegistry;
|
|
63
|
+
zoom: number;
|
|
64
|
+
pan: {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
};
|
|
68
|
+
tab: 'graph' | 'code';
|
|
69
|
+
private readonly opts;
|
|
70
|
+
private readonly canvas;
|
|
71
|
+
private readonly viewport;
|
|
72
|
+
private readonly nodesLayer;
|
|
73
|
+
private readonly commentsLayer;
|
|
74
|
+
private readonly wires;
|
|
75
|
+
private readonly overlay;
|
|
76
|
+
private readonly marquee;
|
|
77
|
+
private readonly minimap;
|
|
78
|
+
private readonly hint;
|
|
79
|
+
private readonly zoomLabel;
|
|
80
|
+
private readonly codeView;
|
|
81
|
+
private readonly paletteList;
|
|
82
|
+
private readonly paletteSearch;
|
|
83
|
+
private readonly nameInput;
|
|
84
|
+
private readonly tabs;
|
|
85
|
+
private readonly tools;
|
|
86
|
+
private readonly details;
|
|
87
|
+
private nodeEls;
|
|
88
|
+
private drag;
|
|
89
|
+
private spaceDown;
|
|
90
|
+
private mouse;
|
|
91
|
+
private search;
|
|
92
|
+
private rafQueued;
|
|
93
|
+
private destroyed;
|
|
94
|
+
private readonly offs;
|
|
95
|
+
/** Read-only viewer mode (see `GraphEditorOptions.readonly`). */
|
|
96
|
+
readonly readonly: boolean;
|
|
97
|
+
constructor(opts: GraphEditorOptions);
|
|
98
|
+
/** Insert into the page (default `document.body`) and fit the graph. */
|
|
99
|
+
mount(parent?: HTMLElement): this;
|
|
100
|
+
close(): void;
|
|
101
|
+
destroy(): void;
|
|
102
|
+
nodeTitle(def: NodeDef | undefined, type: string): string;
|
|
103
|
+
nodeDesc(def: NodeDef): string;
|
|
104
|
+
label(s: string | undefined, fallback?: string): string;
|
|
105
|
+
categoryLabel(cat: string): string;
|
|
106
|
+
private kindLabel;
|
|
107
|
+
private renderAll;
|
|
108
|
+
/** Automatic layered layout by the rendered node sizes (does not add an undo step). */
|
|
109
|
+
layout(o?: Omit<LayoutOptions, 'width' | 'height'>): void;
|
|
110
|
+
/** Re-render nodes and wires (e.g. after `nodeClass` results changed). */
|
|
111
|
+
refresh(): void;
|
|
112
|
+
private renderSelection;
|
|
113
|
+
private positionNodes;
|
|
114
|
+
private renderNodes;
|
|
115
|
+
private nodeEl;
|
|
116
|
+
/** Short line under the title: the node's settings (event, selector, operator…). */
|
|
117
|
+
private summary;
|
|
118
|
+
private pinEl;
|
|
119
|
+
private literalEl;
|
|
120
|
+
private renderComments;
|
|
121
|
+
private editCommentText;
|
|
122
|
+
private scheduleWires;
|
|
123
|
+
/** Centre of a pin's dot in graph coordinates. */
|
|
124
|
+
pinPos(ref: PinRef, side: 'in' | 'out'): [number, number] | null;
|
|
125
|
+
renderWires(): void;
|
|
126
|
+
/** Screen (client) point → graph coordinates. */
|
|
127
|
+
toGraph(clientX: number, clientY: number): [number, number];
|
|
128
|
+
private applyView;
|
|
129
|
+
setZoom(z: number, at?: {
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
}): void;
|
|
133
|
+
private nodeSize;
|
|
134
|
+
/** Fit the whole graph (or the selection) into the canvas. */
|
|
135
|
+
fit(onlySelection?: boolean): void;
|
|
136
|
+
/** Centre the view on a node and select it. */
|
|
137
|
+
focusNode(id: string): void;
|
|
138
|
+
setTab(tab: 'graph' | 'code'): void;
|
|
139
|
+
/** The JavaScript of the blueprint as it is now. */
|
|
140
|
+
code(): string;
|
|
141
|
+
private renderCode;
|
|
142
|
+
private renderMinimap;
|
|
143
|
+
private minimapTo;
|
|
144
|
+
private renderPalette;
|
|
145
|
+
/** Definitions matching a query, grouped by category in registry order. */
|
|
146
|
+
groupedDefs(q: string, filter?: (def: NodeDef) => boolean): [string, NodeDef[]][];
|
|
147
|
+
addNodeAtCenter(type: string): string;
|
|
148
|
+
/**
|
|
149
|
+
* Node search popup at a client point. With `from`, only nodes with a pin compatible with a
|
|
150
|
+
* dragged wire are offered, and the new node is wired to it.
|
|
151
|
+
*/
|
|
152
|
+
openSearch(clientX: number, clientY: number, from?: {
|
|
153
|
+
ref: PinRef;
|
|
154
|
+
side: 'in' | 'out';
|
|
155
|
+
type: string;
|
|
156
|
+
}): void;
|
|
157
|
+
private bindCanvas;
|
|
158
|
+
private onDown;
|
|
159
|
+
private capture;
|
|
160
|
+
private startWire;
|
|
161
|
+
private drawTempWire;
|
|
162
|
+
/** Read-only: nodes are selected (and dragged only when `movable`), links selected, the canvas pans. */
|
|
163
|
+
private onDownReadonly;
|
|
164
|
+
private onMove;
|
|
165
|
+
/** The pin element under a client point (a whole pin row counts, not just its dot). */
|
|
166
|
+
private pinAt;
|
|
167
|
+
private onUp;
|
|
168
|
+
private cancelDrag;
|
|
169
|
+
private onWheel;
|
|
170
|
+
private nodesInComment;
|
|
171
|
+
/** A comment box around the selected nodes (or in the middle of the view). */
|
|
172
|
+
commentSelection(): string;
|
|
173
|
+
private bindKeys;
|
|
174
|
+
copy(): boolean;
|
|
175
|
+
paste(): string[];
|
|
176
|
+
get options(): GraphEditorOptions;
|
|
177
|
+
/** A link's endpoints for the details panel. */
|
|
178
|
+
describeLink(l: Link): string;
|
|
179
|
+
}
|
|
180
|
+
/** Bezier wire from an output point to an input point. */
|
|
181
|
+
export declare function wirePath(a: [number, number], b: [number, number]): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { GraphEditor } from './GraphEditor.cjs';
|
|
2
|
+
/** Right panel: the selected node's settings, or the blueprint's settings and variables; problems below. */
|
|
3
|
+
export declare class Details {
|
|
4
|
+
private readonly ed;
|
|
5
|
+
readonly root: HTMLDivElement;
|
|
6
|
+
private problemsEl;
|
|
7
|
+
constructor(ed: GraphEditor);
|
|
8
|
+
private get t();
|
|
9
|
+
private get state();
|
|
10
|
+
focusProblems(): void;
|
|
11
|
+
render(): void;
|
|
12
|
+
private nodePanel;
|
|
13
|
+
private propField;
|
|
14
|
+
/** Editor of dynamic pins (JS code node): name + type rows. */
|
|
15
|
+
private pinsField;
|
|
16
|
+
private multiPanel;
|
|
17
|
+
private linkPanel;
|
|
18
|
+
private blueprintPanel;
|
|
19
|
+
private templateFields;
|
|
20
|
+
private componentFields;
|
|
21
|
+
private variables;
|
|
22
|
+
private problems;
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { GraphEditor } from './GraphEditor.js';
|
|
2
|
+
/** Right panel: the selected node's settings, or the blueprint's settings and variables; problems below. */
|
|
3
|
+
export declare class Details {
|
|
4
|
+
private readonly ed;
|
|
5
|
+
readonly root: HTMLDivElement;
|
|
6
|
+
private problemsEl;
|
|
7
|
+
constructor(ed: GraphEditor);
|
|
8
|
+
private get t();
|
|
9
|
+
private get state();
|
|
10
|
+
focusProblems(): void;
|
|
11
|
+
render(): void;
|
|
12
|
+
private nodePanel;
|
|
13
|
+
private propField;
|
|
14
|
+
/** Editor of dynamic pins (JS code node): name + type rows. */
|
|
15
|
+
private pinsField;
|
|
16
|
+
private multiPanel;
|
|
17
|
+
private linkPanel;
|
|
18
|
+
private blueprintPanel;
|
|
19
|
+
private templateFields;
|
|
20
|
+
private componentFields;
|
|
21
|
+
private variables;
|
|
22
|
+
private problems;
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type Attrs = Record<string, string | number | boolean | null | undefined | EventListener>;
|
|
2
|
+
export type Child = Node | string | number | null | undefined | false | Child[];
|
|
3
|
+
/** Element factory: text via text nodes only, `on*` → listeners, false/null attributes skipped. */
|
|
4
|
+
export declare function h<K extends keyof HTMLElementTagNameMap>(tag: K, attrs?: Attrs, ...kids: Child[]): HTMLElementTagNameMap[K];
|
|
5
|
+
export declare function svg<K extends keyof SVGElementTagNameMap>(tag: K, attrs?: Record<string, string | number>): SVGElementTagNameMap[K];
|
|
6
|
+
/** Text lookup: `(key, fallback, ...args)`, `%s` replaced in order. */
|
|
7
|
+
export type Text = (key: string, fallback: string, ...args: (string | number)[]) => string;
|
|
8
|
+
export declare const defaultText: Text;
|
|
9
|
+
/**
|
|
10
|
+
* Text lookup from dictionaries: the first one that has the key wins, then the English
|
|
11
|
+
* fallback. `createText(overrides, ru)` — your labels over the bundled Russian.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createText(...dicts: (Record<string, string> | null | undefined)[]): Text;
|
|
14
|
+
/** Message of a diagnostic in the UI language: `diag.<code>` with its args (labels translated). */
|
|
15
|
+
export declare function diagnosticText(t: Text, d: {
|
|
16
|
+
code: string;
|
|
17
|
+
message: string;
|
|
18
|
+
args?: string[];
|
|
19
|
+
}): string;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type Attrs = Record<string, string | number | boolean | null | undefined | EventListener>;
|
|
2
|
+
export type Child = Node | string | number | null | undefined | false | Child[];
|
|
3
|
+
/** Element factory: text via text nodes only, `on*` → listeners, false/null attributes skipped. */
|
|
4
|
+
export declare function h<K extends keyof HTMLElementTagNameMap>(tag: K, attrs?: Attrs, ...kids: Child[]): HTMLElementTagNameMap[K];
|
|
5
|
+
export declare function svg<K extends keyof SVGElementTagNameMap>(tag: K, attrs?: Record<string, string | number>): SVGElementTagNameMap[K];
|
|
6
|
+
/** Text lookup: `(key, fallback, ...args)`, `%s` replaced in order. */
|
|
7
|
+
export type Text = (key: string, fallback: string, ...args: (string | number)[]) => string;
|
|
8
|
+
export declare const defaultText: Text;
|
|
9
|
+
/**
|
|
10
|
+
* Text lookup from dictionaries: the first one that has the key wins, then the English
|
|
11
|
+
* fallback. `createText(overrides, ru)` — your labels over the bundled Russian.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createText(...dicts: (Record<string, string> | null | undefined)[]): Text;
|
|
14
|
+
/** Message of a diagnostic in the UI language: `diag.<code>` with its args (labels translated). */
|
|
15
|
+
export declare function diagnosticText(t: Text, d: {
|
|
16
|
+
code: string;
|
|
17
|
+
message: string;
|
|
18
|
+
args?: string[];
|
|
19
|
+
}): string;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type TokenKind = 'comment' | 'string' | 'number' | 'keyword' | 'literal' | 'helper' | 'text';
|
|
2
|
+
export declare function tokenize(code: string): {
|
|
3
|
+
kind: TokenKind;
|
|
4
|
+
text: string;
|
|
5
|
+
}[];
|
|
6
|
+
/** `<code>` with one `<span class="<prefix>-ln">` per line and `<prefix>-t-<kind>` tokens. */
|
|
7
|
+
export declare function highlight(code: string, prefix?: string): HTMLElement;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type TokenKind = 'comment' | 'string' | 'number' | 'keyword' | 'literal' | 'helper' | 'text';
|
|
2
|
+
export declare function tokenize(code: string): {
|
|
3
|
+
kind: TokenKind;
|
|
4
|
+
text: string;
|
|
5
|
+
}[];
|
|
6
|
+
/** `<code>` with one `<span class="<prefix>-ln">` per line and `<prefix>-t-<kind>` tokens. */
|
|
7
|
+
export declare function highlight(code: string, prefix?: string): HTMLElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* blueprintsjs/editor — the visual graph editor (DOM + SVG, no framework) and its
|
|
3
|
+
* framework-free editing model `GraphState`.
|
|
4
|
+
*/
|
|
5
|
+
export { GraphEditor, wirePath } from './GraphEditor.cjs';
|
|
6
|
+
export type { GraphEditorOptions } from './GraphEditor.cjs';
|
|
7
|
+
export { GraphState, GRID, snap } from './state.cjs';
|
|
8
|
+
export type { GraphClip, ChangeKind } from './state.cjs';
|
|
9
|
+
export { highlight, tokenize } from './highlight.cjs';
|
|
10
|
+
export type { TokenKind } from './highlight.cjs';
|
|
11
|
+
export { injectEditorCss, EDITOR_CSS, EDITOR_STYLE_ID, PIN_COLORS, CATEGORY_COLORS } from './styles.cjs';
|
|
12
|
+
export { defaultText, diagnosticText, createText } from './dom.cjs';
|
|
13
|
+
export type { Text } from './dom.cjs';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* blueprintsjs/editor — the visual graph editor (DOM + SVG, no framework) and its
|
|
3
|
+
* framework-free editing model `GraphState`.
|
|
4
|
+
*/
|
|
5
|
+
export { GraphEditor, wirePath } from './GraphEditor.js';
|
|
6
|
+
export type { GraphEditorOptions } from './GraphEditor.js';
|
|
7
|
+
export { GraphState, GRID, snap } from './state.js';
|
|
8
|
+
export type { GraphClip, ChangeKind } from './state.js';
|
|
9
|
+
export { highlight, tokenize } from './highlight.js';
|
|
10
|
+
export type { TokenKind } from './highlight.js';
|
|
11
|
+
export { injectEditorCss, EDITOR_CSS, EDITOR_STYLE_ID, PIN_COLORS, CATEGORY_COLORS } from './styles.js';
|
|
12
|
+
export { defaultText, diagnosticText, createText } from './dom.js';
|
|
13
|
+
export type { Text } from './dom.js';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { NodeRegistry } from '../core/registry.cjs';
|
|
2
|
+
import type { Blueprint, Diagnostic, GraphComment, Link, NodeInstance, PinRef, Variable } from '../core/types.cjs';
|
|
3
|
+
export type ChangeKind = 'graph' | 'move' | 'selection' | 'meta' | 'history';
|
|
4
|
+
type Listener = (kind: ChangeKind) => void;
|
|
5
|
+
/** What goes to the clipboard: a piece of a graph. */
|
|
6
|
+
export interface GraphClip {
|
|
7
|
+
bpClip: 1;
|
|
8
|
+
nodes: NodeInstance[];
|
|
9
|
+
links: Link[];
|
|
10
|
+
comments: GraphComment[];
|
|
11
|
+
}
|
|
12
|
+
export declare const GRID = 8;
|
|
13
|
+
export declare const snap: (v: number) => number;
|
|
14
|
+
/**
|
|
15
|
+
* Editing model of one blueprint: graph operations, selection, undo/redo and clipboard.
|
|
16
|
+
* No DOM: the view renders it and calls these methods.
|
|
17
|
+
*/
|
|
18
|
+
export declare class GraphState {
|
|
19
|
+
readonly registry: NodeRegistry;
|
|
20
|
+
bp: Blueprint;
|
|
21
|
+
/** Selected node ids. */
|
|
22
|
+
readonly selection: Set<string>;
|
|
23
|
+
/** Selected comment ids. */
|
|
24
|
+
readonly selectedComments: Set<string>;
|
|
25
|
+
/** A selected wire. */
|
|
26
|
+
selectedLink: Link | null;
|
|
27
|
+
/** Bumped on every change of the blueprint. */
|
|
28
|
+
version: number;
|
|
29
|
+
private undoStack;
|
|
30
|
+
private redoStack;
|
|
31
|
+
private pending;
|
|
32
|
+
private listeners;
|
|
33
|
+
private diagCache;
|
|
34
|
+
constructor(bp: Blueprint, registry: NodeRegistry);
|
|
35
|
+
on(fn: Listener): () => void;
|
|
36
|
+
private emit;
|
|
37
|
+
/** A copy of the blueprint (what gets saved). */
|
|
38
|
+
toJSON(): Blueprint;
|
|
39
|
+
node(id: string): NodeInstance | undefined;
|
|
40
|
+
/** Runs a change as one undo step. */
|
|
41
|
+
mutate(fn: () => void, kind?: ChangeKind): void;
|
|
42
|
+
private push;
|
|
43
|
+
/** Start of a gesture (drag): one undo step for all `moveBy` calls until `end`. */
|
|
44
|
+
begin(): void;
|
|
45
|
+
end(): void;
|
|
46
|
+
get canUndo(): boolean;
|
|
47
|
+
get canRedo(): boolean;
|
|
48
|
+
undo(): boolean;
|
|
49
|
+
redo(): boolean;
|
|
50
|
+
private dropStaleSelection;
|
|
51
|
+
select(ids: string[], { additive, comments }?: {
|
|
52
|
+
additive?: boolean | undefined;
|
|
53
|
+
comments?: string[] | undefined;
|
|
54
|
+
}): void;
|
|
55
|
+
toggleSelect(id: string): void;
|
|
56
|
+
selectLink(link: Link | null): void;
|
|
57
|
+
selectAll(): void;
|
|
58
|
+
clearSelection(): void;
|
|
59
|
+
nextNodeId(): string;
|
|
60
|
+
addNode(type: string, pos: [number, number], props?: Record<string, unknown>): string;
|
|
61
|
+
/** Move nodes (no undo step by itself: wrap in begin/end or mutate). */
|
|
62
|
+
moveBy(ids: Iterable<string>, dx: number, dy: number): void;
|
|
63
|
+
/** Snap the given nodes to the grid. */
|
|
64
|
+
snapNodes(ids: Iterable<string>): void;
|
|
65
|
+
setProps(id: string, patch: Record<string, unknown>): void;
|
|
66
|
+
setNodeFlags(id: string, flags: {
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
collapsed?: boolean;
|
|
69
|
+
}): void;
|
|
70
|
+
/** Delete the selection (nodes with their wires, comments, or the selected wire). */
|
|
71
|
+
deleteSelection(): void;
|
|
72
|
+
/** Remove wires whose pins disappeared (dynamic pins changed). */
|
|
73
|
+
private dropDeadLinks;
|
|
74
|
+
/** The pin's side and type, or null. */
|
|
75
|
+
pinInfo(ref: PinRef): {
|
|
76
|
+
side: 'in' | 'out';
|
|
77
|
+
type: string;
|
|
78
|
+
} | null;
|
|
79
|
+
/** Whether `from` (output) may be wired to `to` (input). */
|
|
80
|
+
canLink(from: PinRef, to: PinRef): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Wire an output to an input. A data input keeps one wire and an exec output drives one
|
|
83
|
+
* input (as in UE blueprints): the old wire is replaced.
|
|
84
|
+
*/
|
|
85
|
+
connect(from: PinRef, to: PinRef): boolean;
|
|
86
|
+
/** Remove every wire of a pin. */
|
|
87
|
+
disconnect(ref: PinRef, side: 'in' | 'out'): void;
|
|
88
|
+
removeLink(link: Link): void;
|
|
89
|
+
linksOf(nodeId: string): Link[];
|
|
90
|
+
isLinked(ref: PinRef, side: 'in' | 'out'): boolean;
|
|
91
|
+
setMeta(patch: Partial<Pick<Blueprint, 'name' | 'description' | 'enabled' | 'target' | 'component'>>): void;
|
|
92
|
+
addVariable(init?: Partial<Variable>): Variable;
|
|
93
|
+
updateVariable(id: string, patch: Partial<Omit<Variable, 'id'>>): void;
|
|
94
|
+
removeVariable(id: string): void;
|
|
95
|
+
addComment(pos: [number, number], size: [number, number], text?: string): string;
|
|
96
|
+
updateComment(id: string, patch: Partial<Omit<GraphComment, 'id'>>, { history }?: {
|
|
97
|
+
history?: boolean | undefined;
|
|
98
|
+
}): void;
|
|
99
|
+
comment(id: string): GraphComment | undefined;
|
|
100
|
+
/** The selection as a clip (nodes, the wires between them, selected comments). */
|
|
101
|
+
copy(): GraphClip | null;
|
|
102
|
+
/** Insert a clip with new ids; its top-left goes to `at`. Unknown node types are skipped. */
|
|
103
|
+
paste(clip: GraphClip, at: [number, number]): string[];
|
|
104
|
+
diagnostics(): Diagnostic[];
|
|
105
|
+
/** Bounding box of nodes (`ids`) using sizes from `size` (the view measures). */
|
|
106
|
+
bounds(ids: Iterable<string> | null, size: (id: string) => [number, number]): {
|
|
107
|
+
x: number;
|
|
108
|
+
y: number;
|
|
109
|
+
w: number;
|
|
110
|
+
h: number;
|
|
111
|
+
} | null;
|
|
112
|
+
}
|
|
113
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { NodeRegistry } from '../core/registry.js';
|
|
2
|
+
import type { Blueprint, Diagnostic, GraphComment, Link, NodeInstance, PinRef, Variable } from '../core/types.js';
|
|
3
|
+
export type ChangeKind = 'graph' | 'move' | 'selection' | 'meta' | 'history';
|
|
4
|
+
type Listener = (kind: ChangeKind) => void;
|
|
5
|
+
/** What goes to the clipboard: a piece of a graph. */
|
|
6
|
+
export interface GraphClip {
|
|
7
|
+
bpClip: 1;
|
|
8
|
+
nodes: NodeInstance[];
|
|
9
|
+
links: Link[];
|
|
10
|
+
comments: GraphComment[];
|
|
11
|
+
}
|
|
12
|
+
export declare const GRID = 8;
|
|
13
|
+
export declare const snap: (v: number) => number;
|
|
14
|
+
/**
|
|
15
|
+
* Editing model of one blueprint: graph operations, selection, undo/redo and clipboard.
|
|
16
|
+
* No DOM: the view renders it and calls these methods.
|
|
17
|
+
*/
|
|
18
|
+
export declare class GraphState {
|
|
19
|
+
readonly registry: NodeRegistry;
|
|
20
|
+
bp: Blueprint;
|
|
21
|
+
/** Selected node ids. */
|
|
22
|
+
readonly selection: Set<string>;
|
|
23
|
+
/** Selected comment ids. */
|
|
24
|
+
readonly selectedComments: Set<string>;
|
|
25
|
+
/** A selected wire. */
|
|
26
|
+
selectedLink: Link | null;
|
|
27
|
+
/** Bumped on every change of the blueprint. */
|
|
28
|
+
version: number;
|
|
29
|
+
private undoStack;
|
|
30
|
+
private redoStack;
|
|
31
|
+
private pending;
|
|
32
|
+
private listeners;
|
|
33
|
+
private diagCache;
|
|
34
|
+
constructor(bp: Blueprint, registry: NodeRegistry);
|
|
35
|
+
on(fn: Listener): () => void;
|
|
36
|
+
private emit;
|
|
37
|
+
/** A copy of the blueprint (what gets saved). */
|
|
38
|
+
toJSON(): Blueprint;
|
|
39
|
+
node(id: string): NodeInstance | undefined;
|
|
40
|
+
/** Runs a change as one undo step. */
|
|
41
|
+
mutate(fn: () => void, kind?: ChangeKind): void;
|
|
42
|
+
private push;
|
|
43
|
+
/** Start of a gesture (drag): one undo step for all `moveBy` calls until `end`. */
|
|
44
|
+
begin(): void;
|
|
45
|
+
end(): void;
|
|
46
|
+
get canUndo(): boolean;
|
|
47
|
+
get canRedo(): boolean;
|
|
48
|
+
undo(): boolean;
|
|
49
|
+
redo(): boolean;
|
|
50
|
+
private dropStaleSelection;
|
|
51
|
+
select(ids: string[], { additive, comments }?: {
|
|
52
|
+
additive?: boolean | undefined;
|
|
53
|
+
comments?: string[] | undefined;
|
|
54
|
+
}): void;
|
|
55
|
+
toggleSelect(id: string): void;
|
|
56
|
+
selectLink(link: Link | null): void;
|
|
57
|
+
selectAll(): void;
|
|
58
|
+
clearSelection(): void;
|
|
59
|
+
nextNodeId(): string;
|
|
60
|
+
addNode(type: string, pos: [number, number], props?: Record<string, unknown>): string;
|
|
61
|
+
/** Move nodes (no undo step by itself: wrap in begin/end or mutate). */
|
|
62
|
+
moveBy(ids: Iterable<string>, dx: number, dy: number): void;
|
|
63
|
+
/** Snap the given nodes to the grid. */
|
|
64
|
+
snapNodes(ids: Iterable<string>): void;
|
|
65
|
+
setProps(id: string, patch: Record<string, unknown>): void;
|
|
66
|
+
setNodeFlags(id: string, flags: {
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
collapsed?: boolean;
|
|
69
|
+
}): void;
|
|
70
|
+
/** Delete the selection (nodes with their wires, comments, or the selected wire). */
|
|
71
|
+
deleteSelection(): void;
|
|
72
|
+
/** Remove wires whose pins disappeared (dynamic pins changed). */
|
|
73
|
+
private dropDeadLinks;
|
|
74
|
+
/** The pin's side and type, or null. */
|
|
75
|
+
pinInfo(ref: PinRef): {
|
|
76
|
+
side: 'in' | 'out';
|
|
77
|
+
type: string;
|
|
78
|
+
} | null;
|
|
79
|
+
/** Whether `from` (output) may be wired to `to` (input). */
|
|
80
|
+
canLink(from: PinRef, to: PinRef): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Wire an output to an input. A data input keeps one wire and an exec output drives one
|
|
83
|
+
* input (as in UE blueprints): the old wire is replaced.
|
|
84
|
+
*/
|
|
85
|
+
connect(from: PinRef, to: PinRef): boolean;
|
|
86
|
+
/** Remove every wire of a pin. */
|
|
87
|
+
disconnect(ref: PinRef, side: 'in' | 'out'): void;
|
|
88
|
+
removeLink(link: Link): void;
|
|
89
|
+
linksOf(nodeId: string): Link[];
|
|
90
|
+
isLinked(ref: PinRef, side: 'in' | 'out'): boolean;
|
|
91
|
+
setMeta(patch: Partial<Pick<Blueprint, 'name' | 'description' | 'enabled' | 'target' | 'component'>>): void;
|
|
92
|
+
addVariable(init?: Partial<Variable>): Variable;
|
|
93
|
+
updateVariable(id: string, patch: Partial<Omit<Variable, 'id'>>): void;
|
|
94
|
+
removeVariable(id: string): void;
|
|
95
|
+
addComment(pos: [number, number], size: [number, number], text?: string): string;
|
|
96
|
+
updateComment(id: string, patch: Partial<Omit<GraphComment, 'id'>>, { history }?: {
|
|
97
|
+
history?: boolean | undefined;
|
|
98
|
+
}): void;
|
|
99
|
+
comment(id: string): GraphComment | undefined;
|
|
100
|
+
/** The selection as a clip (nodes, the wires between them, selected comments). */
|
|
101
|
+
copy(): GraphClip | null;
|
|
102
|
+
/** Insert a clip with new ids; its top-left goes to `at`. Unknown node types are skipped. */
|
|
103
|
+
paste(clip: GraphClip, at: [number, number]): string[];
|
|
104
|
+
diagnostics(): Diagnostic[];
|
|
105
|
+
/** Bounding box of nodes (`ids`) using sizes from `size` (the view measures). */
|
|
106
|
+
bounds(ids: Iterable<string> | null, size: (id: string) => [number, number]): {
|
|
107
|
+
x: number;
|
|
108
|
+
y: number;
|
|
109
|
+
w: number;
|
|
110
|
+
h: number;
|
|
111
|
+
} | null;
|
|
112
|
+
}
|
|
113
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const EDITOR_STYLE_ID = "bpe-style";
|
|
2
|
+
/** Colours of pin types (wires use the output's colour). */
|
|
3
|
+
export declare const PIN_COLORS: Record<string, string>;
|
|
4
|
+
/** Header colours of node categories. */
|
|
5
|
+
export declare const CATEGORY_COLORS: Record<string, string>;
|
|
6
|
+
export declare const EDITOR_CSS = "\n.bpe{position:fixed;inset:0;z-index:10000;display:flex;flex-direction:column;background:#1b1c1f;color:#d7d9dd;font:13px/1.35 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;text-align:start}\n.bpe.bpe--embedded{position:absolute;z-index:auto}\n.bpe.is-readonly .bpe-canvas{cursor:grab}.bpe.is-readonly .bpe-canvas.is-panning{cursor:grabbing}\n.bpe.is-readonly .bpe-node{cursor:pointer}.bpe.is-readonly .bpe-dot{cursor:inherit}\n.bpe-node-lines{padding:4px 8px 6px;font-size:12px;line-height:1.35;color:#c9ccd1;max-width:260px;display:flex;flex-direction:column;gap:2px}\n.bpe-title{font-weight:600;font-size:14px;padding:0 4px}\n.bpe-lit.is-readonly{opacity:.8;padding:0 4px;font-size:12px;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.bpe *{box-sizing:border-box}\n.bpe button{font:inherit;color:inherit}\n.bpe input,.bpe select,.bpe textarea{font:inherit;color:inherit;background:#121315;border:1px solid #3a3d43;border-radius:3px;padding:4px 6px;min-width:0}\n.bpe input:focus,.bpe select:focus,.bpe textarea:focus{outline:none;border-color:var(--bpe-accent,#d278c9)}\n.bpe select option{background:#222;color:#ddd}\n.bpe input[type=checkbox]{width:auto;accent-color:var(--bpe-accent,#d278c9)}\n.bpe-top{display:flex;align-items:center;gap:6px;padding:6px 8px;background:#26282c;border-bottom:1px solid #111}\n.bpe-name{font-weight:600;font-size:14px;background:transparent !important;border-color:transparent !important;width:260px}\n.bpe-name:hover{border-color:#3a3d43 !important}\n.bpe-badge{font-size:11px;padding:2px 7px;border-radius:9px;background:#3a3d43;white-space:nowrap}\n.bpe-tabs{display:flex;margin-inline-start:12px;background:#121315;border-radius:4px;padding:2px}\n.bpe-tab{border:0;background:none;padding:4px 12px;border-radius:3px;cursor:pointer}\n.bpe-tab.is-active{background:#3a3d43}\n.bpe-spacer{flex:1}\n.bpe-tbtn{border:0;background:none;cursor:pointer;padding:5px 8px;border-radius:3px;line-height:1;white-space:nowrap}\n.bpe-tbtn:hover{background:#3a3d43}\n.bpe-tbtn[disabled]{opacity:.35;cursor:default;background:none}\n.bpe-tbtn.is-primary{background:var(--bpe-accent,#d278c9);color:#fff}\n.bpe-problems-btn.has-errors{color:#ff8a80}\n.bpe-main{flex:1;display:flex;min-height:0}\n.bpe-palette{width:230px;flex-shrink:0;display:flex;flex-direction:column;background:#232528;border-inline-end:1px solid #111}\n.bpe-palette-search{margin:8px;width:calc(100% - 16px)}\n.bpe-palette-list{flex:1;overflow:auto;padding-bottom:12px}\n.bpe-cat{padding:8px 10px 3px;font-size:10px;text-transform:uppercase;letter-spacing:.06em;opacity:.6;display:flex;align-items:center;gap:6px}\n.bpe-cat i{width:8px;height:8px;border-radius:2px;display:inline-block}\n.bpe-pitem{padding:4px 10px 4px 24px;cursor:grab;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.bpe-pitem:hover,.bpe-pitem.is-active{background:#34373c}\n.bpe-canvas{flex:1;position:relative;overflow:hidden;outline:none;background-color:#1b1c1f;background-image:linear-gradient(#26282c 1px,transparent 1px),linear-gradient(90deg,#26282c 1px,transparent 1px);touch-action:none;user-select:none;-webkit-user-select:none}\n.bpe-canvas.is-panning{cursor:grabbing}\n.bpe-viewport{position:absolute;left:0;top:0;transform-origin:0 0}\n.bpe-wires,.bpe-overlay{position:absolute;left:0;top:0;width:1px;height:1px;overflow:visible;pointer-events:none}\n.bpe-wire{fill:none;stroke-width:2;opacity:.9}\n.bpe-wire.is-exec{stroke-width:3}\n.bpe-wire.is-selected{stroke:#ffd54f !important;stroke-width:4;opacity:1}\n.bpe-wire-hit{fill:none;stroke:transparent;stroke-width:12;pointer-events:stroke;cursor:pointer}\n.bpe-temp{fill:none;stroke-width:2;stroke-dasharray:6 4}\n.bpe-node{position:absolute;min-width:150px;background:rgba(32,34,38,.96);border:1px solid #0b0b0c;border-radius:6px;box-shadow:0 2px 8px rgba(0,0,0,.45);cursor:default}\n.bpe-node.is-selected{outline:2px solid #ffb300;outline-offset:1px}\n.bpe-node.has-error{border-color:#e05252;box-shadow:0 0 0 1px #e05252,0 2px 8px rgba(0,0,0,.45)}\n.bpe-node.is-disabled{opacity:.45}\n.bpe-node.is-disabled .bpe-node-head{background-image:repeating-linear-gradient(45deg,transparent 0 6px,rgba(0,0,0,.25) 6px 12px)}\n.bpe-node-head{padding:5px 10px;border-radius:5px 5px 0 0;font-weight:600;color:#fff;cursor:move;white-space:nowrap;display:flex;align-items:center;gap:6px}\n.bpe-node-head .bpe-ev{font-size:10px;opacity:.85}\n.bpe-node-sub{padding:3px 10px 0;font-size:11px;opacity:.65;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:260px}\n.bpe-node-body{display:flex;justify-content:space-between;gap:14px;padding:5px 0 7px}\n.bpe-col{display:flex;flex-direction:column;gap:3px;min-width:0}\n.bpe-col.is-out{align-items:flex-end}\n.bpe-pin{display:flex;align-items:center;gap:5px;min-height:20px;white-space:nowrap}\n.bpe-pin.is-in{padding-inline-start:6px}\n.bpe-pin.is-out{padding-inline-end:6px;flex-direction:row-reverse}\n.bpe-dot{width:12px;height:12px;border-radius:50%;border:2px solid var(--c);background:transparent;cursor:crosshair;flex-shrink:0}\n.bpe-pin.is-linked .bpe-dot{background:var(--c)}\n.bpe-pin[data-type=exec] .bpe-dot{border-radius:0;border:0;background:var(--c);clip-path:polygon(0 0,60% 0,100% 50%,60% 100%,0 100%);opacity:.45;width:13px;height:14px}\n.bpe-pin[data-type=exec].is-linked .bpe-dot{opacity:1}\n.bpe-dot:hover,.bpe-pin.is-target .bpe-dot{box-shadow:0 0 0 3px rgba(255,255,255,.25)}\n.bpe-pin.is-bad .bpe-dot{opacity:.15}\n.bpe-pin-label{font-size:12px;opacity:.9}\n.bpe-lit{width:96px;padding:1px 4px !important;font-size:11px}\n.bpe-lit[type=number]{width:64px}\n.bpe-comment{position:absolute;border-radius:6px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.12)}\n.bpe-comment.is-selected{border-color:#ffb300}\n.bpe-comment-head{padding:4px 8px;font-weight:600;font-size:14px;background:rgba(255,255,255,.08);border-radius:6px 6px 0 0;cursor:move;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.bpe-comment-resize{position:absolute;right:0;bottom:0;width:14px;height:14px;cursor:nwse-resize;background:linear-gradient(135deg,transparent 50%,rgba(255,255,255,.3) 50%)}\n.bpe-marquee{position:absolute;border:1px dashed #ffb300;background:rgba(255,179,0,.08);pointer-events:none}\n.bpe-hint{position:absolute;left:50%;top:45%;transform:translate(-50%,-50%);opacity:.45;text-align:center;pointer-events:none;max-width:360px}\n.bpe-zoom{position:absolute;left:8px;bottom:6px;font-size:11px;opacity:.5;pointer-events:none}\n.bpe-minimap{position:absolute;right:10px;bottom:10px;width:180px;height:116px;opacity:.85;background:rgba(18,19,21,.85);border:1px solid #3a3d43;border-radius:4px;cursor:pointer}\n.bpe-minimap rect.n{fill:#5b5f66}\n.bpe-minimap rect.n.s{fill:#ffb300}\n.bpe-minimap rect.v{fill:rgba(255,255,255,.06);stroke:#d7d9dd;stroke-width:1}\n.bpe-search{position:absolute;z-index:5;width:280px;max-height:360px;display:flex;flex-direction:column;background:#26282c;border:1px solid #111;border-radius:6px;box-shadow:0 6px 20px rgba(0,0,0,.6)}\n.bpe-search input{margin:6px}\n.bpe-search-list{overflow:auto;padding-bottom:6px}\n.bpe-search .bpe-pitem{cursor:pointer;padding-inline-start:16px}\n.bpe-search .bpe-cat{padding-top:6px}\n.bpe-search-desc{padding:6px 10px;border-top:1px solid #111;font-size:11px;opacity:.7;min-height:30px}\n.bpe-details{width:300px;flex-shrink:0;overflow:auto;background:#232528;border-inline-start:1px solid #111;padding:10px 12px 20px}\n.bpe-details h3{margin:0 0 2px;font-size:14px}\n.bpe-details h4{margin:16px 0 6px;font-size:11px;text-transform:uppercase;letter-spacing:.06em;opacity:.6;display:flex;justify-content:space-between;align-items:center}\n.bpe-details .bpe-type{font-size:11px;opacity:.5;font-family:ui-monospace,Menlo,Consolas,monospace}\n.bpe-details p{margin:6px 0;opacity:.75;font-size:12px}\n.bpe-field{margin:0 0 9px}\n.bpe-field>label{display:block;font-size:12px;opacity:.8;margin-bottom:3px}\n.bpe-field input:not([type=checkbox]),.bpe-field select,.bpe-field textarea{width:100%}\n.bpe-field textarea{font:12px/1.45 ui-monospace,Menlo,Consolas,monospace;resize:vertical;min-height:120px;tab-size:2}\n.bpe-field.is-invalid input{border-color:#e05252}\n.bpe-err-msg{color:#ff8a80;font-size:11px;margin-top:2px}\n.bpe-check{display:flex;align-items:center;gap:6px;margin:4px 0}\n.bpe-row{display:flex;gap:4px;align-items:center;margin-bottom:4px}\n.bpe-row input,.bpe-row select{flex:1}\n.bpe-row .bpe-x{flex:0 0 auto}\n.bpe-x{border:0;background:none;cursor:pointer;opacity:.6;padding:2px 6px;border-radius:3px}\n.bpe-x:hover{opacity:1;background:#3a3d43}\n.bpe-add{border:1px dashed #4a4d53;background:none;border-radius:3px;cursor:pointer;padding:3px 8px;font-size:12px;opacity:.8}\n.bpe-add:hover{opacity:1;border-color:#888}\n.bpe-btn{border:0;background:#3a3d43;border-radius:3px;cursor:pointer;padding:5px 10px}\n.bpe-btn:hover{background:#4a4d53}\n.bpe-btn.is-danger:hover{background:#8e2a2a}\n.bpe-inline{display:flex;gap:4px}\n.bpe-inline input{flex:1}\n.bpe-problems{list-style:none;margin:0;padding:0;font-size:12px}\n.bpe-problems li{padding:4px 4px 4px 18px;position:relative;cursor:pointer;border-radius:3px}\n.bpe-problems li:hover{background:#2e3034}\n.bpe-problems li::before{content:'';position:absolute;left:5px;top:9px;width:7px;height:7px;border-radius:50%;background:#e05252}\n.bpe-problems li.is-warning::before{background:#e0a33a}\n.bpe-problems li.is-ok{cursor:default}\n.bpe-problems li.is-ok::before{background:#5cb85c}\n.bpe-code{flex:1;overflow:auto;margin:0;background:#141517;padding:10px 0;font:12px/1.55 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;counter-reset:ln;tab-size:2;direction:ltr;text-align:left}\n.bpe-code[hidden],.bpe-canvas[hidden]{display:none}\n.bpe-code code{display:block;white-space:pre}\n.bpe-ln{display:block;padding-right:12px}\n.bpe-ln::before{counter-increment:ln;content:counter(ln);display:inline-block;width:3.5em;padding-right:1em;text-align:right;opacity:.3;user-select:none}\n.bpe-ln.is-node{cursor:pointer}\n.bpe-ln.is-node:hover{background:#22252a}\n.bpe-t-comment{color:#6a9955}.bpe-t-string{color:#ce9178}.bpe-t-number{color:#b5cea8}.bpe-t-keyword{color:#569cd6}.bpe-t-literal{color:#4fc1ff}.bpe-t-helper{color:#dcdcaa}\n.bpe-help{font-size:11px;opacity:.55;line-height:1.6}\n.bpe-help kbd{background:#3a3d43;border-radius:3px;padding:0 4px;font:11px ui-monospace,Menlo,Consolas,monospace}\n.bpe[dir=rtl] .bpe-pin.is-in{flex-direction:row}\n";
|
|
7
|
+
export declare function injectEditorCss(doc?: Document): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const EDITOR_STYLE_ID = "bpe-style";
|
|
2
|
+
/** Colours of pin types (wires use the output's colour). */
|
|
3
|
+
export declare const PIN_COLORS: Record<string, string>;
|
|
4
|
+
/** Header colours of node categories. */
|
|
5
|
+
export declare const CATEGORY_COLORS: Record<string, string>;
|
|
6
|
+
export declare const EDITOR_CSS = "\n.bpe{position:fixed;inset:0;z-index:10000;display:flex;flex-direction:column;background:#1b1c1f;color:#d7d9dd;font:13px/1.35 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;text-align:start}\n.bpe.bpe--embedded{position:absolute;z-index:auto}\n.bpe.is-readonly .bpe-canvas{cursor:grab}.bpe.is-readonly .bpe-canvas.is-panning{cursor:grabbing}\n.bpe.is-readonly .bpe-node{cursor:pointer}.bpe.is-readonly .bpe-dot{cursor:inherit}\n.bpe-node-lines{padding:4px 8px 6px;font-size:12px;line-height:1.35;color:#c9ccd1;max-width:260px;display:flex;flex-direction:column;gap:2px}\n.bpe-title{font-weight:600;font-size:14px;padding:0 4px}\n.bpe-lit.is-readonly{opacity:.8;padding:0 4px;font-size:12px;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.bpe *{box-sizing:border-box}\n.bpe button{font:inherit;color:inherit}\n.bpe input,.bpe select,.bpe textarea{font:inherit;color:inherit;background:#121315;border:1px solid #3a3d43;border-radius:3px;padding:4px 6px;min-width:0}\n.bpe input:focus,.bpe select:focus,.bpe textarea:focus{outline:none;border-color:var(--bpe-accent,#d278c9)}\n.bpe select option{background:#222;color:#ddd}\n.bpe input[type=checkbox]{width:auto;accent-color:var(--bpe-accent,#d278c9)}\n.bpe-top{display:flex;align-items:center;gap:6px;padding:6px 8px;background:#26282c;border-bottom:1px solid #111}\n.bpe-name{font-weight:600;font-size:14px;background:transparent !important;border-color:transparent !important;width:260px}\n.bpe-name:hover{border-color:#3a3d43 !important}\n.bpe-badge{font-size:11px;padding:2px 7px;border-radius:9px;background:#3a3d43;white-space:nowrap}\n.bpe-tabs{display:flex;margin-inline-start:12px;background:#121315;border-radius:4px;padding:2px}\n.bpe-tab{border:0;background:none;padding:4px 12px;border-radius:3px;cursor:pointer}\n.bpe-tab.is-active{background:#3a3d43}\n.bpe-spacer{flex:1}\n.bpe-tbtn{border:0;background:none;cursor:pointer;padding:5px 8px;border-radius:3px;line-height:1;white-space:nowrap}\n.bpe-tbtn:hover{background:#3a3d43}\n.bpe-tbtn[disabled]{opacity:.35;cursor:default;background:none}\n.bpe-tbtn.is-primary{background:var(--bpe-accent,#d278c9);color:#fff}\n.bpe-problems-btn.has-errors{color:#ff8a80}\n.bpe-main{flex:1;display:flex;min-height:0}\n.bpe-palette{width:230px;flex-shrink:0;display:flex;flex-direction:column;background:#232528;border-inline-end:1px solid #111}\n.bpe-palette-search{margin:8px;width:calc(100% - 16px)}\n.bpe-palette-list{flex:1;overflow:auto;padding-bottom:12px}\n.bpe-cat{padding:8px 10px 3px;font-size:10px;text-transform:uppercase;letter-spacing:.06em;opacity:.6;display:flex;align-items:center;gap:6px}\n.bpe-cat i{width:8px;height:8px;border-radius:2px;display:inline-block}\n.bpe-pitem{padding:4px 10px 4px 24px;cursor:grab;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.bpe-pitem:hover,.bpe-pitem.is-active{background:#34373c}\n.bpe-canvas{flex:1;position:relative;overflow:hidden;outline:none;background-color:#1b1c1f;background-image:linear-gradient(#26282c 1px,transparent 1px),linear-gradient(90deg,#26282c 1px,transparent 1px);touch-action:none;user-select:none;-webkit-user-select:none}\n.bpe-canvas.is-panning{cursor:grabbing}\n.bpe-viewport{position:absolute;left:0;top:0;transform-origin:0 0}\n.bpe-wires,.bpe-overlay{position:absolute;left:0;top:0;width:1px;height:1px;overflow:visible;pointer-events:none}\n.bpe-wire{fill:none;stroke-width:2;opacity:.9}\n.bpe-wire.is-exec{stroke-width:3}\n.bpe-wire.is-selected{stroke:#ffd54f !important;stroke-width:4;opacity:1}\n.bpe-wire-hit{fill:none;stroke:transparent;stroke-width:12;pointer-events:stroke;cursor:pointer}\n.bpe-temp{fill:none;stroke-width:2;stroke-dasharray:6 4}\n.bpe-node{position:absolute;min-width:150px;background:rgba(32,34,38,.96);border:1px solid #0b0b0c;border-radius:6px;box-shadow:0 2px 8px rgba(0,0,0,.45);cursor:default}\n.bpe-node.is-selected{outline:2px solid #ffb300;outline-offset:1px}\n.bpe-node.has-error{border-color:#e05252;box-shadow:0 0 0 1px #e05252,0 2px 8px rgba(0,0,0,.45)}\n.bpe-node.is-disabled{opacity:.45}\n.bpe-node.is-disabled .bpe-node-head{background-image:repeating-linear-gradient(45deg,transparent 0 6px,rgba(0,0,0,.25) 6px 12px)}\n.bpe-node-head{padding:5px 10px;border-radius:5px 5px 0 0;font-weight:600;color:#fff;cursor:move;white-space:nowrap;display:flex;align-items:center;gap:6px}\n.bpe-node-head .bpe-ev{font-size:10px;opacity:.85}\n.bpe-node-sub{padding:3px 10px 0;font-size:11px;opacity:.65;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:260px}\n.bpe-node-body{display:flex;justify-content:space-between;gap:14px;padding:5px 0 7px}\n.bpe-col{display:flex;flex-direction:column;gap:3px;min-width:0}\n.bpe-col.is-out{align-items:flex-end}\n.bpe-pin{display:flex;align-items:center;gap:5px;min-height:20px;white-space:nowrap}\n.bpe-pin.is-in{padding-inline-start:6px}\n.bpe-pin.is-out{padding-inline-end:6px;flex-direction:row-reverse}\n.bpe-dot{width:12px;height:12px;border-radius:50%;border:2px solid var(--c);background:transparent;cursor:crosshair;flex-shrink:0}\n.bpe-pin.is-linked .bpe-dot{background:var(--c)}\n.bpe-pin[data-type=exec] .bpe-dot{border-radius:0;border:0;background:var(--c);clip-path:polygon(0 0,60% 0,100% 50%,60% 100%,0 100%);opacity:.45;width:13px;height:14px}\n.bpe-pin[data-type=exec].is-linked .bpe-dot{opacity:1}\n.bpe-dot:hover,.bpe-pin.is-target .bpe-dot{box-shadow:0 0 0 3px rgba(255,255,255,.25)}\n.bpe-pin.is-bad .bpe-dot{opacity:.15}\n.bpe-pin-label{font-size:12px;opacity:.9}\n.bpe-lit{width:96px;padding:1px 4px !important;font-size:11px}\n.bpe-lit[type=number]{width:64px}\n.bpe-comment{position:absolute;border-radius:6px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.12)}\n.bpe-comment.is-selected{border-color:#ffb300}\n.bpe-comment-head{padding:4px 8px;font-weight:600;font-size:14px;background:rgba(255,255,255,.08);border-radius:6px 6px 0 0;cursor:move;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.bpe-comment-resize{position:absolute;right:0;bottom:0;width:14px;height:14px;cursor:nwse-resize;background:linear-gradient(135deg,transparent 50%,rgba(255,255,255,.3) 50%)}\n.bpe-marquee{position:absolute;border:1px dashed #ffb300;background:rgba(255,179,0,.08);pointer-events:none}\n.bpe-hint{position:absolute;left:50%;top:45%;transform:translate(-50%,-50%);opacity:.45;text-align:center;pointer-events:none;max-width:360px}\n.bpe-zoom{position:absolute;left:8px;bottom:6px;font-size:11px;opacity:.5;pointer-events:none}\n.bpe-minimap{position:absolute;right:10px;bottom:10px;width:180px;height:116px;opacity:.85;background:rgba(18,19,21,.85);border:1px solid #3a3d43;border-radius:4px;cursor:pointer}\n.bpe-minimap rect.n{fill:#5b5f66}\n.bpe-minimap rect.n.s{fill:#ffb300}\n.bpe-minimap rect.v{fill:rgba(255,255,255,.06);stroke:#d7d9dd;stroke-width:1}\n.bpe-search{position:absolute;z-index:5;width:280px;max-height:360px;display:flex;flex-direction:column;background:#26282c;border:1px solid #111;border-radius:6px;box-shadow:0 6px 20px rgba(0,0,0,.6)}\n.bpe-search input{margin:6px}\n.bpe-search-list{overflow:auto;padding-bottom:6px}\n.bpe-search .bpe-pitem{cursor:pointer;padding-inline-start:16px}\n.bpe-search .bpe-cat{padding-top:6px}\n.bpe-search-desc{padding:6px 10px;border-top:1px solid #111;font-size:11px;opacity:.7;min-height:30px}\n.bpe-details{width:300px;flex-shrink:0;overflow:auto;background:#232528;border-inline-start:1px solid #111;padding:10px 12px 20px}\n.bpe-details h3{margin:0 0 2px;font-size:14px}\n.bpe-details h4{margin:16px 0 6px;font-size:11px;text-transform:uppercase;letter-spacing:.06em;opacity:.6;display:flex;justify-content:space-between;align-items:center}\n.bpe-details .bpe-type{font-size:11px;opacity:.5;font-family:ui-monospace,Menlo,Consolas,monospace}\n.bpe-details p{margin:6px 0;opacity:.75;font-size:12px}\n.bpe-field{margin:0 0 9px}\n.bpe-field>label{display:block;font-size:12px;opacity:.8;margin-bottom:3px}\n.bpe-field input:not([type=checkbox]),.bpe-field select,.bpe-field textarea{width:100%}\n.bpe-field textarea{font:12px/1.45 ui-monospace,Menlo,Consolas,monospace;resize:vertical;min-height:120px;tab-size:2}\n.bpe-field.is-invalid input{border-color:#e05252}\n.bpe-err-msg{color:#ff8a80;font-size:11px;margin-top:2px}\n.bpe-check{display:flex;align-items:center;gap:6px;margin:4px 0}\n.bpe-row{display:flex;gap:4px;align-items:center;margin-bottom:4px}\n.bpe-row input,.bpe-row select{flex:1}\n.bpe-row .bpe-x{flex:0 0 auto}\n.bpe-x{border:0;background:none;cursor:pointer;opacity:.6;padding:2px 6px;border-radius:3px}\n.bpe-x:hover{opacity:1;background:#3a3d43}\n.bpe-add{border:1px dashed #4a4d53;background:none;border-radius:3px;cursor:pointer;padding:3px 8px;font-size:12px;opacity:.8}\n.bpe-add:hover{opacity:1;border-color:#888}\n.bpe-btn{border:0;background:#3a3d43;border-radius:3px;cursor:pointer;padding:5px 10px}\n.bpe-btn:hover{background:#4a4d53}\n.bpe-btn.is-danger:hover{background:#8e2a2a}\n.bpe-inline{display:flex;gap:4px}\n.bpe-inline input{flex:1}\n.bpe-problems{list-style:none;margin:0;padding:0;font-size:12px}\n.bpe-problems li{padding:4px 4px 4px 18px;position:relative;cursor:pointer;border-radius:3px}\n.bpe-problems li:hover{background:#2e3034}\n.bpe-problems li::before{content:'';position:absolute;left:5px;top:9px;width:7px;height:7px;border-radius:50%;background:#e05252}\n.bpe-problems li.is-warning::before{background:#e0a33a}\n.bpe-problems li.is-ok{cursor:default}\n.bpe-problems li.is-ok::before{background:#5cb85c}\n.bpe-code{flex:1;overflow:auto;margin:0;background:#141517;padding:10px 0;font:12px/1.55 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;counter-reset:ln;tab-size:2;direction:ltr;text-align:left}\n.bpe-code[hidden],.bpe-canvas[hidden]{display:none}\n.bpe-code code{display:block;white-space:pre}\n.bpe-ln{display:block;padding-right:12px}\n.bpe-ln::before{counter-increment:ln;content:counter(ln);display:inline-block;width:3.5em;padding-right:1em;text-align:right;opacity:.3;user-select:none}\n.bpe-ln.is-node{cursor:pointer}\n.bpe-ln.is-node:hover{background:#22252a}\n.bpe-t-comment{color:#6a9955}.bpe-t-string{color:#ce9178}.bpe-t-number{color:#b5cea8}.bpe-t-keyword{color:#569cd6}.bpe-t-literal{color:#4fc1ff}.bpe-t-helper{color:#dcdcaa}\n.bpe-help{font-size:11px;opacity:.55;line-height:1.6}\n.bpe-help kbd{background:#3a3d43;border-radius:3px;padding:0 4px;font:11px ui-monospace,Menlo,Consolas,monospace}\n.bpe[dir=rtl] .bpe-pin.is-in{flex-direction:row}\n";
|
|
7
|
+
export declare function injectEditorCss(doc?: Document): void;
|