@kabel-project/kabel 1.0.7 → 1.0.8
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/dist/comment-renderer/renderer.d.ts +32 -0
- package/dist/comment-renderer/renderer.d.ts.map +1 -0
- package/dist/controllers/base.d.ts +39 -0
- package/dist/controllers/base.d.ts.map +1 -0
- package/dist/controllers/wasd.d.ts +33 -0
- package/dist/controllers/wasd.d.ts.map +1 -0
- package/dist/events/comment-drag-handle.d.ts +2 -0
- package/dist/events/comment-drag-handle.d.ts.map +1 -0
- package/dist/events/comment-input.d.ts +4 -0
- package/dist/events/comment-input.d.ts.map +1 -0
- package/dist/events/connection-line.d.ts +2 -0
- package/dist/events/connection-line.d.ts.map +1 -0
- package/dist/events/connector.d.ts +2 -0
- package/dist/events/connector.d.ts.map +1 -0
- package/dist/events/draggable.d.ts +2 -0
- package/dist/events/draggable.d.ts.map +1 -0
- package/{events/events.ts → dist/events/events.d.ts} +8 -7
- package/dist/events/events.d.ts.map +1 -0
- package/dist/events/input-box.d.ts +2 -0
- package/dist/events/input-box.d.ts.map +1 -0
- package/dist/events/node-x-btn.d.ts +2 -0
- package/dist/events/node-x-btn.d.ts.map +1 -0
- package/dist/kabel.js +2 -0
- package/dist/kabel.js.map +1 -0
- package/dist/renderers/apollo/apollo.d.ts +12 -0
- package/dist/renderers/apollo/apollo.d.ts.map +1 -0
- package/dist/renderers/apollo/constants.d.ts +21 -0
- package/dist/renderers/apollo/constants.d.ts.map +1 -0
- package/dist/renderers/apollo/renderer.d.ts +97 -0
- package/dist/renderers/apollo/renderer.d.ts.map +1 -0
- package/{renderers/atlas/atlas.ts → dist/renderers/atlas/atlas.d.ts} +6 -15
- package/dist/renderers/atlas/atlas.d.ts.map +1 -0
- package/dist/renderers/constants.d.ts +51 -0
- package/dist/renderers/constants.d.ts.map +1 -0
- package/dist/renderers/renderer.d.ts +470 -0
- package/dist/renderers/renderer.d.ts.map +1 -0
- package/dist/renderers/representer-node.d.ts +27 -0
- package/dist/renderers/representer-node.d.ts.map +1 -0
- package/dist/renderers/representer.d.ts +13 -0
- package/dist/renderers/representer.d.ts.map +1 -0
- package/dist/src/category.d.ts +48 -0
- package/dist/src/category.d.ts.map +1 -0
- package/{src/colors.ts → dist/src/colors.d.ts} +21 -20
- package/dist/src/colors.d.ts.map +1 -0
- package/dist/src/comment.d.ts +88 -0
- package/dist/src/comment.d.ts.map +1 -0
- package/dist/src/connection.d.ts +52 -0
- package/dist/src/connection.d.ts.map +1 -0
- package/dist/src/context-menu.d.ts +76 -0
- package/dist/src/context-menu.d.ts.map +1 -0
- package/dist/src/coordinates.d.ts +52 -0
- package/dist/src/coordinates.d.ts.map +1 -0
- package/dist/src/core.d.ts +153 -0
- package/dist/src/core.d.ts.map +1 -0
- package/dist/src/ctx-menu-registry.d.ts +22 -0
- package/dist/src/ctx-menu-registry.d.ts.map +1 -0
- package/dist/src/dropdown-menu.d.ts +87 -0
- package/dist/src/dropdown-menu.d.ts.map +1 -0
- package/dist/src/field.d.ts +305 -0
- package/dist/src/field.d.ts.map +1 -0
- package/dist/src/flyout.d.ts +41 -0
- package/dist/src/flyout.d.ts.map +1 -0
- package/dist/src/fonts-manager.d.ts +6 -0
- package/dist/src/fonts-manager.d.ts.map +1 -0
- package/dist/src/grid.d.ts +60 -0
- package/dist/src/grid.d.ts.map +1 -0
- package/dist/src/headless-node.d.ts +11 -0
- package/dist/src/headless-node.d.ts.map +1 -0
- package/dist/src/index.d.ts +38 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/inject-headless.d.ts +4 -0
- package/dist/src/inject-headless.d.ts.map +1 -0
- package/{src/inject.ts → dist/src/inject.d.ts} +142 -213
- package/dist/src/inject.d.ts.map +1 -0
- package/{src/main-workspace.ts → dist/src/main-workspace.d.ts} +31 -51
- package/dist/src/main-workspace.d.ts.map +1 -0
- package/dist/src/mutator.d.ts +2 -0
- package/dist/src/mutator.d.ts.map +1 -0
- package/{src/node-types.ts → dist/src/node-types.d.ts} +26 -27
- package/dist/src/node-types.d.ts.map +1 -0
- package/dist/src/nodesvg.d.ts +266 -0
- package/dist/src/nodesvg.d.ts.map +1 -0
- package/{src/prototypes.ts → dist/src/prototypes.d.ts} +10 -9
- package/dist/src/prototypes.d.ts.map +1 -0
- package/{src/renderer-map.ts → dist/src/renderer-map.d.ts} +51 -86
- package/dist/src/renderer-map.d.ts.map +1 -0
- package/dist/src/toolbox.d.ts +51 -0
- package/dist/src/toolbox.d.ts.map +1 -0
- package/{src/types.ts → dist/src/types.d.ts} +159 -205
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/undo-redo.d.ts +15 -0
- package/dist/src/undo-redo.d.ts.map +1 -0
- package/{src/visual-types.ts → dist/src/visual-types.d.ts} +34 -29
- package/dist/src/visual-types.d.ts.map +1 -0
- package/dist/src/widget-prototypes.d.ts +10 -0
- package/dist/src/widget-prototypes.d.ts.map +1 -0
- package/dist/src/widget.d.ts +62 -0
- package/dist/src/widget.d.ts.map +1 -0
- package/{src/workspace-coords.ts → dist/src/workspace-coords.d.ts} +10 -14
- package/dist/src/workspace-coords.d.ts.map +1 -0
- package/dist/src/workspace-svg.d.ts +371 -0
- package/dist/src/workspace-svg.d.ts.map +1 -0
- package/dist/src/workspace.d.ts +50 -0
- package/dist/src/workspace.d.ts.map +1 -0
- package/dist/themes/dark.d.ts +4 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/default.d.ts +4 -0
- package/dist/themes/default.d.ts.map +1 -0
- package/dist/themes/themes.d.ts +6 -0
- package/dist/themes/themes.d.ts.map +1 -0
- package/dist/util/emitter.d.ts +10 -0
- package/dist/util/emitter.d.ts.map +1 -0
- package/dist/util/env.d.ts +7 -0
- package/dist/util/env.d.ts.map +1 -0
- package/{util/escape-html.ts → dist/util/escape-html.d.ts} +16 -22
- package/dist/util/escape-html.d.ts.map +1 -0
- package/dist/util/eventer.d.ts +29 -0
- package/dist/util/eventer.d.ts.map +1 -0
- package/dist/util/has-prop.d.ts +2 -0
- package/dist/util/has-prop.d.ts.map +1 -0
- package/dist/util/parse-color.d.ts +6 -0
- package/dist/util/parse-color.d.ts.map +1 -0
- package/dist/util/path.d.ts +25 -0
- package/dist/util/path.d.ts.map +1 -0
- package/dist/util/styler.d.ts +12 -0
- package/dist/util/styler.d.ts.map +1 -0
- package/dist/util/uid.d.ts +42 -0
- package/dist/util/uid.d.ts.map +1 -0
- package/{util/unescape-html.ts → dist/util/unescape-html.d.ts} +16 -22
- package/dist/util/unescape-html.d.ts.map +1 -0
- package/dist/util/user-state.d.ts +37 -0
- package/dist/util/user-state.d.ts.map +1 -0
- package/{util/wait-anim-frames.ts → dist/util/wait-anim-frames.d.ts} +11 -24
- package/dist/util/wait-anim-frames.d.ts.map +1 -0
- package/dist/util/window-listeners.d.ts +8 -0
- package/dist/util/window-listeners.d.ts.map +1 -0
- package/package.json +4 -1
- package/(1.0.7)kabel.md +0 -18
- package/_READ_ME_MEDIA_/documentation/docs.md +0 -293
- package/_READ_ME_MEDIA_/workspace.png +0 -0
- package/comment-renderer/renderer.ts +0 -228
- package/controllers/base.ts +0 -186
- package/controllers/wasd.ts +0 -132
- package/docs/README.md +0 -98
- package/docs/_media/docs.md +0 -289
- package/docs/_media/workspace.png +0 -0
- package/docs/classes/CommentModel.md +0 -271
- package/docs/classes/CommentRenderer.md +0 -457
- package/docs/classes/ConnectableField.md +0 -597
- package/docs/classes/Connection.md +0 -191
- package/docs/classes/ContextMenuHTML.md +0 -163
- package/docs/classes/Coordinates.md +0 -187
- package/docs/classes/DropdownContainer.md +0 -300
- package/docs/classes/DummyField.md +0 -393
- package/docs/classes/Eventer.md +0 -185
- package/docs/classes/Field.md +0 -461
- package/docs/classes/InjectMsg.md +0 -85
- package/docs/classes/NodeSvg.md +0 -1011
- package/docs/classes/NumberField.md +0 -559
- package/docs/classes/OptConnectField.md +0 -624
- package/docs/classes/Renderer.md +0 -1636
- package/docs/classes/RendererConstants.md +0 -343
- package/docs/classes/Representer.md +0 -95
- package/docs/classes/RepresenterNode.md +0 -175
- package/docs/classes/TextField.md +0 -559
- package/docs/classes/Toolbox.md +0 -172
- package/docs/classes/WASDController.md +0 -616
- package/docs/classes/Widget.md +0 -195
- package/docs/classes/WorkspaceController.md +0 -385
- package/docs/classes/WorkspaceCoords.md +0 -218
- package/docs/classes/WorkspaceSvg.md +0 -1380
- package/docs/functions/clearMainWorkspace.md +0 -20
- package/docs/functions/getMainWorkspace.md +0 -19
- package/docs/functions/inject.md +0 -35
- package/docs/functions/setMainWorkspace.md +0 -28
- package/docs/globals.md +0 -95
- package/docs/interfaces/ColorStyle.md +0 -43
- package/docs/interfaces/ConnectorToFrom.md +0 -57
- package/docs/interfaces/DrawState.md +0 -81
- package/docs/interfaces/FieldConnectionData.md +0 -25
- package/docs/interfaces/FieldOptions.md +0 -63
- package/docs/interfaces/FieldRawBoxData.md +0 -25
- package/docs/interfaces/FieldVisualInfo.md +0 -65
- package/docs/interfaces/GridOptions.md +0 -61
- package/docs/interfaces/InjectOptions.md +0 -133
- package/docs/interfaces/InputFieldJson.md +0 -50
- package/docs/interfaces/KabelCommentRendering.md +0 -31
- package/docs/interfaces/KabelInterface.md +0 -469
- package/docs/interfaces/KabelNodeRendering.md +0 -77
- package/docs/interfaces/KabelUIX.md +0 -105
- package/docs/interfaces/KabelUtils.md +0 -215
- package/docs/interfaces/NodeEvents.md +0 -42
- package/docs/interfaces/NodeJson.md +0 -104
- package/docs/interfaces/NodePrototype.md +0 -82
- package/docs/interfaces/RegisteredEl.md +0 -53
- package/docs/interfaces/SerializedNode.md +0 -128
- package/docs/interfaces/TblxCategoryStruct.md +0 -41
- package/docs/interfaces/TblxFieldStruct.md +0 -28
- package/docs/interfaces/TblxNodeStruct.md +0 -35
- package/docs/interfaces/WidgetOptions.md +0 -115
- package/docs/interfaces/WidgetPrototypeList.md +0 -15
- package/docs/type-aliases/AnyField.md +0 -13
- package/docs/type-aliases/AnyFieldCls.md +0 -13
- package/docs/type-aliases/Color.md +0 -13
- package/docs/type-aliases/Connectable.md +0 -13
- package/docs/type-aliases/EventArgs.md +0 -11
- package/docs/type-aliases/EventSetupFn.md +0 -25
- package/docs/type-aliases/Hex.md +0 -13
- package/docs/type-aliases/RGBObject.md +0 -37
- package/docs/type-aliases/RGBString.md +0 -13
- package/docs/type-aliases/RGBTuple.md +0 -13
- package/docs/type-aliases/TblxObjStruct.md +0 -52
- package/docs/variables/CategoryColors.md +0 -29
- package/docs/variables/FieldMap.md +0 -41
- package/docs/variables/NodePrototypes.md +0 -18
- package/docs/variables/default.md +0 -11
- package/events/comment-drag-handle.ts +0 -61
- package/events/comment-input.ts +0 -291
- package/events/connection-line.ts +0 -68
- package/events/connector.ts +0 -116
- package/events/draggable.ts +0 -119
- package/events/input-box.ts +0 -213
- package/events/node-x-btn.ts +0 -25
- package/index.d.ts +0 -4
- package/renderers/apollo/apollo.ts +0 -21
- package/renderers/apollo/constants.ts +0 -40
- package/renderers/apollo/renderer.ts +0 -331
- package/renderers/constants.ts +0 -87
- package/renderers/renderer.ts +0 -1288
- package/renderers/representer-node.ts +0 -52
- package/renderers/representer.ts +0 -25
- package/src/category.ts +0 -107
- package/src/comment.ts +0 -142
- package/src/connection.ts +0 -114
- package/src/context-menu.ts +0 -194
- package/src/coordinates.ts +0 -74
- package/src/core.ts +0 -202
- package/src/ctx-menu-registry.ts +0 -143
- package/src/dropdown-menu.ts +0 -215
- package/src/field.ts +0 -595
- package/src/flyout.ts +0 -165
- package/src/fonts-manager.ts +0 -38
- package/src/grid.ts +0 -162
- package/src/headless-node.ts +0 -27
- package/src/index.ts +0 -115
- package/src/inject-headless.ts +0 -18
- package/src/mutator.ts +0 -40
- package/src/nodesvg.ts +0 -756
- package/src/styles.css +0 -224
- package/src/toolbox.ts +0 -125
- package/src/undo-redo.ts +0 -87
- package/src/widget-prototypes.ts +0 -11
- package/src/widget.ts +0 -139
- package/src/workspace-svg.ts +0 -736
- package/src/workspace.ts +0 -155
- package/test-server.js +0 -61
- package/themes/dark.ts +0 -32
- package/themes/default.ts +0 -28
- package/themes/themes.ts +0 -9
- package/tsconfig.json +0 -25
- package/typedoc.json +0 -10
- package/util/emitter.ts +0 -33
- package/util/env.ts +0 -11
- package/util/eventer.ts +0 -108
- package/util/has-prop.ts +0 -4
- package/util/parse-color.ts +0 -42
- package/util/path.ts +0 -99
- package/util/styler.ts +0 -41
- package/util/uid.ts +0 -184
- package/util/user-state.ts +0 -68
- package/util/window-listeners.ts +0 -62
- package/webpack.config.js +0 -80
- /package/{docs/_media → dist}/index.html +0 -0
|
@@ -1,213 +1,142 @@
|
|
|
1
|
-
import WorkspaceController from "../controllers/base";
|
|
2
|
-
import Renderer from "../renderers/renderer";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
export interface
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Represents a
|
|
29
|
-
*/
|
|
30
|
-
export interface
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
*
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
* Creates a new InjectMsg instance.
|
|
144
|
-
* @param msg - Message text
|
|
145
|
-
*/
|
|
146
|
-
constructor(msg: string) {
|
|
147
|
-
this.msg = msg;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/** Log as error */
|
|
151
|
-
err() {
|
|
152
|
-
console.error(`Failed to inject workspace: ${this.msg}`);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/** Log as warning */
|
|
156
|
-
wrn() {
|
|
157
|
-
console.warn(`Inject warning: ${this.msg}`);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/** Log as info */
|
|
161
|
-
info() {
|
|
162
|
-
console.info(`Inject info: ${this.msg}`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Injects a new Kabel workspace into the document.
|
|
168
|
-
* Appends the workspace container to the given element (or element ID) and
|
|
169
|
-
* sets it as the main workspace.
|
|
170
|
-
*
|
|
171
|
-
* @param element - HTMLElement or string ID to attach the workspace to
|
|
172
|
-
* @param options - Optional InjectOptions to configure the workspace
|
|
173
|
-
* @returns The newly created WorkspaceSvg instance, or undefined if injection failed
|
|
174
|
-
*/
|
|
175
|
-
export default function inject(
|
|
176
|
-
element: HTMLElement | string,
|
|
177
|
-
options: InjectOptions = {}
|
|
178
|
-
): WorkspaceSvg | undefined {
|
|
179
|
-
if (!env.isBrowser) {
|
|
180
|
-
new InjectMsg(`Cannot inject workspace-svg in non-browser environment (use Kabel.injectHeadless).`).err();
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
// Apply global Kabel styles
|
|
184
|
-
styler.appendStyles('KabelStyles', kabelStyles);
|
|
185
|
-
|
|
186
|
-
const root =
|
|
187
|
-
typeof element === 'string'
|
|
188
|
-
? document.querySelector(`#${element}`) as HTMLElement
|
|
189
|
-
: element as HTMLElement;
|
|
190
|
-
|
|
191
|
-
if (!root) {
|
|
192
|
-
new InjectMsg(`Document does not contain root element (Check element ID).`).err();
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (!document.contains(root)) {
|
|
197
|
-
new InjectMsg(`Document does not contain root element.`).err();
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Create workspace wrapper element
|
|
202
|
-
const wsTop = document.createElement('div');
|
|
203
|
-
wsTop.className = `KabelWorkspaceWrapper`;
|
|
204
|
-
root.appendChild(wsTop);
|
|
205
|
-
|
|
206
|
-
// Initialize workspace
|
|
207
|
-
const ws = new WorkspaceSvg(root, wsTop, options);
|
|
208
|
-
|
|
209
|
-
// Set as the main workspace globally
|
|
210
|
-
setMainWorkspace(ws);
|
|
211
|
-
|
|
212
|
-
return ws;
|
|
213
|
-
}
|
|
1
|
+
import WorkspaceController from "../controllers/base";
|
|
2
|
+
import Renderer from "../renderers/renderer";
|
|
3
|
+
import WorkspaceSvg, { WSTheme } from "./workspace-svg";
|
|
4
|
+
import NodePrototypes from "./prototypes";
|
|
5
|
+
import { Color, Hex } from "./visual-types";
|
|
6
|
+
/**
|
|
7
|
+
* Represents a field in a toolbox node.
|
|
8
|
+
* Can contain any extra properties as needed by the field type.
|
|
9
|
+
*/
|
|
10
|
+
export interface TblxFieldStruct {
|
|
11
|
+
/** Field value */
|
|
12
|
+
value: any;
|
|
13
|
+
/** Additional field-specific properties */
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Represents a node in a toolbox.
|
|
18
|
+
*/
|
|
19
|
+
export interface TblxNodeStruct {
|
|
20
|
+
/** Node type (matches NodePrototypes key or arbitrary string) */
|
|
21
|
+
type: keyof typeof NodePrototypes | string;
|
|
22
|
+
/** Map of field names to field data */
|
|
23
|
+
arguments: {
|
|
24
|
+
[key: string]: TblxFieldStruct;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Represents a category in the toolbox, which contains multiple nodes.
|
|
29
|
+
*/
|
|
30
|
+
export interface TblxCategoryStruct {
|
|
31
|
+
/** Category name */
|
|
32
|
+
name: string;
|
|
33
|
+
/** Category color */
|
|
34
|
+
color: Color;
|
|
35
|
+
/** Nodes contained in this category */
|
|
36
|
+
contents: TblxNodeStruct[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Discriminated union type representing possible toolbox structures.
|
|
40
|
+
* Can be a flyout (list of nodes) or a categorized toolbox.
|
|
41
|
+
*/
|
|
42
|
+
export type TblxObjStruct = {
|
|
43
|
+
/** Flyout toolbox type */
|
|
44
|
+
type: 'flyout';
|
|
45
|
+
contents: TblxNodeStruct[];
|
|
46
|
+
} | {
|
|
47
|
+
/** Categorized toolbox type */
|
|
48
|
+
type?: 'category';
|
|
49
|
+
contents: TblxCategoryStruct[];
|
|
50
|
+
} | {
|
|
51
|
+
/** When type is omitted, defaults to categories */
|
|
52
|
+
type?: undefined;
|
|
53
|
+
contents: TblxCategoryStruct[];
|
|
54
|
+
};
|
|
55
|
+
export interface GridOptions {
|
|
56
|
+
/**
|
|
57
|
+
* The grid's type.
|
|
58
|
+
* 'celled' - The grid is celled.
|
|
59
|
+
* 'dotted' - The grid is dotted.
|
|
60
|
+
*/
|
|
61
|
+
type: 'celled' | 'dotted';
|
|
62
|
+
/**
|
|
63
|
+
* Spacing, optional. Default is 40.
|
|
64
|
+
*/
|
|
65
|
+
spacing?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Dot size for 'dotted' grid type.
|
|
68
|
+
*/
|
|
69
|
+
dotSize?: number;
|
|
70
|
+
/**
|
|
71
|
+
* stroke width for 'celled' grid type.
|
|
72
|
+
*/
|
|
73
|
+
strokeWidth?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Option color for any grid type. Color is #bebebeff by default.
|
|
76
|
+
*/
|
|
77
|
+
color?: Hex;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Options used when injecting a new workspace.
|
|
81
|
+
*/
|
|
82
|
+
export interface InjectOptions {
|
|
83
|
+
/** Optional renderer overrides */
|
|
84
|
+
rendererOverrides?: {
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
};
|
|
87
|
+
/** Theme for the workspace */
|
|
88
|
+
theme?: string | WSTheme;
|
|
89
|
+
/** Optional custom controller class */
|
|
90
|
+
Controller?: typeof WorkspaceController;
|
|
91
|
+
/** Init the workspace's undo state for you, or not. */
|
|
92
|
+
initUndoRedo?: boolean;
|
|
93
|
+
/** Optional controls configuration */
|
|
94
|
+
controls?: {
|
|
95
|
+
zoomSpeed?: number;
|
|
96
|
+
minZoom?: number;
|
|
97
|
+
maxZoom?: number;
|
|
98
|
+
wasd?: boolean;
|
|
99
|
+
wasdSmooth?: boolean;
|
|
100
|
+
wasdAccelerate?: number;
|
|
101
|
+
wasdFriction?: number;
|
|
102
|
+
};
|
|
103
|
+
/** Optional toolbox structure */
|
|
104
|
+
toolbox?: TblxObjStruct;
|
|
105
|
+
/** Optional movement speed of the workspace */
|
|
106
|
+
moveSpeed?: number;
|
|
107
|
+
/** Optional renderer: name string or class */
|
|
108
|
+
renderer?: string | typeof Renderer;
|
|
109
|
+
/**
|
|
110
|
+
* Optional grid settings.
|
|
111
|
+
*/
|
|
112
|
+
grid?: GridOptions;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Utility class for logging injection messages in a structured way.
|
|
116
|
+
*/
|
|
117
|
+
export declare class InjectMsg {
|
|
118
|
+
/** Message content */
|
|
119
|
+
msg: string;
|
|
120
|
+
/**
|
|
121
|
+
* Creates a new InjectMsg instance.
|
|
122
|
+
* @param msg - Message text
|
|
123
|
+
*/
|
|
124
|
+
constructor(msg: string);
|
|
125
|
+
/** Log as error */
|
|
126
|
+
err(): void;
|
|
127
|
+
/** Log as warning */
|
|
128
|
+
wrn(): void;
|
|
129
|
+
/** Log as info */
|
|
130
|
+
info(): void;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Injects a new Kabel workspace into the document.
|
|
134
|
+
* Appends the workspace container to the given element (or element ID) and
|
|
135
|
+
* sets it as the main workspace.
|
|
136
|
+
*
|
|
137
|
+
* @param element - HTMLElement or string ID to attach the workspace to
|
|
138
|
+
* @param options - Optional InjectOptions to configure the workspace
|
|
139
|
+
* @returns The newly created WorkspaceSvg instance, or undefined if injection failed
|
|
140
|
+
*/
|
|
141
|
+
export default function inject(element: HTMLElement | string, options?: InjectOptions): WorkspaceSvg | undefined;
|
|
142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GG;gBACS,GAAG,EAAE,MAAM;IAIvB,mBAAmB;IACnB,GAAG;IAIH,qBAAqB;IACrB,GAAG;IAIH,kBAAkB;IAClB,IAAI;CAGP;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAC1B,OAAO,EAAE,WAAW,GAAG,MAAM,EAC7B,OAAO,GAAE,aAAkB,GAC5B,YAAY,GAAG,SAAS,CAmC1B"}
|
|
@@ -1,51 +1,31 @@
|
|
|
1
|
-
import Workspace from "./workspace";
|
|
2
|
-
import WorkspaceSvg from "./workspace-svg";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* After calling, getMainWorkspace() will return null.
|
|
33
|
-
*
|
|
34
|
-
* @returns Always returns null.
|
|
35
|
-
*/
|
|
36
|
-
function clearMainWorkspace() {
|
|
37
|
-
return (mainws = null);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export {
|
|
41
|
-
getMainWorkspace,
|
|
42
|
-
setMainWorkspace,
|
|
43
|
-
clearMainWorkspace
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Note:
|
|
48
|
-
* This mimics the Blockly.getMainWorkspace API.
|
|
49
|
-
* When you inject a new workspace in Kabel, calling setMainWorkspace
|
|
50
|
-
* sets the global main workspace reference, so you can easily retrieve it later.
|
|
51
|
-
*/
|
|
1
|
+
import Workspace from "./workspace";
|
|
2
|
+
import WorkspaceSvg from "./workspace-svg";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the current main workspace instance.
|
|
5
|
+
*
|
|
6
|
+
* @returns The main WorkspaceSvg or null if none is set.
|
|
7
|
+
*/
|
|
8
|
+
declare function getMainWorkspace(): WorkspaceSvg | Workspace | null;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the main workspace reference.
|
|
11
|
+
* Calling this updates the global "main workspace" for Kabel.
|
|
12
|
+
*
|
|
13
|
+
* @param ws - The WorkspaceSvg instance to set as main, or null to clear.
|
|
14
|
+
* @returns The workspace that was set.
|
|
15
|
+
*/
|
|
16
|
+
declare function setMainWorkspace(ws: WorkspaceSvg | Workspace | null): WorkspaceSvg | Workspace | null;
|
|
17
|
+
/**
|
|
18
|
+
* Clears the main workspace reference.
|
|
19
|
+
* After calling, getMainWorkspace() will return null.
|
|
20
|
+
*
|
|
21
|
+
* @returns Always returns null.
|
|
22
|
+
*/
|
|
23
|
+
declare function clearMainWorkspace(): null;
|
|
24
|
+
export { getMainWorkspace, setMainWorkspace, clearMainWorkspace };
|
|
25
|
+
/**
|
|
26
|
+
* Note:
|
|
27
|
+
* This mimics the Blockly.getMainWorkspace API.
|
|
28
|
+
* When you inject a new workspace in Kabel, calling setMainWorkspace
|
|
29
|
+
* sets the global main workspace reference, so you can easily retrieve it later.
|
|
30
|
+
*/
|
|
31
|
+
//# sourceMappingURL=main-workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main-workspace.d.ts","sourceRoot":"","sources":["../../src/main-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAQ3C;;;;GAIG;AACH,iBAAS,gBAAgB,IAAI,YAAY,GAAG,SAAS,GAAG,IAAI,CAE3D;AAED;;;;;;GAMG;AACH,iBAAS,gBAAgB,CAAC,EAAE,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,mCAE5D;AAED;;;;;GAKG;AACH,iBAAS,kBAAkB,SAE1B;AAED,OAAO,EACH,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACrB,CAAC;AAEF;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutator.d.ts","sourceRoot":"","sources":["../../src/mutator.ts"],"names":[],"mappings":""}
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import NodeSvg from "./nodesvg";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @param
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
1
|
+
import NodeSvg from "./nodesvg";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a prototype definition for a NodeSvg.
|
|
4
|
+
* Prototypes define behavior for initialization and removal of nodes.
|
|
5
|
+
*/
|
|
6
|
+
export interface NodePrototype {
|
|
7
|
+
/**
|
|
8
|
+
* Called when a node is initialized.
|
|
9
|
+
* Use this to set up fields, connections, or any runtime state for the node.
|
|
10
|
+
*
|
|
11
|
+
* @param this - The NodeSvg instance being initialized
|
|
12
|
+
* @param prototype - The prototype object itself
|
|
13
|
+
* @param block - The NodeSvg instance (same as `this`) for convenience
|
|
14
|
+
*/
|
|
15
|
+
init: (this: NodeSvg, prototype: NodePrototype, block: NodeSvg) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Called when a node is being removed from the workspace.
|
|
18
|
+
* Use this to clean up references, event listeners, or related resources.
|
|
19
|
+
*
|
|
20
|
+
* @param this - The NodeSvg instance being removed
|
|
21
|
+
* @param prototype - The prototype object itself
|
|
22
|
+
* @param block - The NodeSvg instance (same as `this`) for convenience
|
|
23
|
+
*/
|
|
24
|
+
removed: (this: NodeSvg, prototype: NodePrototype, block: NodeSvg) => void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=node-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-types.d.ts","sourceRoot":"","sources":["../../src/node-types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B;;;;;;;OAOG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAExE;;;;;;;OAOG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9E"}
|