@kabel-project/kabel 1.0.7
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/(1.0.7)kabel.md +18 -0
- package/README.md +96 -0
- package/_READ_ME_MEDIA_/documentation/docs.md +293 -0
- package/_READ_ME_MEDIA_/workspace.png +0 -0
- package/comment-renderer/renderer.ts +228 -0
- package/controllers/base.ts +186 -0
- package/controllers/wasd.ts +132 -0
- package/docs/README.md +98 -0
- package/docs/_media/docs.md +289 -0
- package/docs/_media/index.html +168 -0
- package/docs/_media/workspace.png +0 -0
- package/docs/classes/CommentModel.md +271 -0
- package/docs/classes/CommentRenderer.md +457 -0
- package/docs/classes/ConnectableField.md +597 -0
- package/docs/classes/Connection.md +191 -0
- package/docs/classes/ContextMenuHTML.md +163 -0
- package/docs/classes/Coordinates.md +187 -0
- package/docs/classes/DropdownContainer.md +300 -0
- package/docs/classes/DummyField.md +393 -0
- package/docs/classes/Eventer.md +185 -0
- package/docs/classes/Field.md +461 -0
- package/docs/classes/InjectMsg.md +85 -0
- package/docs/classes/NodeSvg.md +1011 -0
- package/docs/classes/NumberField.md +559 -0
- package/docs/classes/OptConnectField.md +624 -0
- package/docs/classes/Renderer.md +1636 -0
- package/docs/classes/RendererConstants.md +343 -0
- package/docs/classes/Representer.md +95 -0
- package/docs/classes/RepresenterNode.md +175 -0
- package/docs/classes/TextField.md +559 -0
- package/docs/classes/Toolbox.md +172 -0
- package/docs/classes/WASDController.md +616 -0
- package/docs/classes/Widget.md +195 -0
- package/docs/classes/WorkspaceController.md +385 -0
- package/docs/classes/WorkspaceCoords.md +218 -0
- package/docs/classes/WorkspaceSvg.md +1380 -0
- package/docs/functions/clearMainWorkspace.md +20 -0
- package/docs/functions/getMainWorkspace.md +19 -0
- package/docs/functions/inject.md +35 -0
- package/docs/functions/setMainWorkspace.md +28 -0
- package/docs/globals.md +95 -0
- package/docs/interfaces/ColorStyle.md +43 -0
- package/docs/interfaces/ConnectorToFrom.md +57 -0
- package/docs/interfaces/DrawState.md +81 -0
- package/docs/interfaces/FieldConnectionData.md +25 -0
- package/docs/interfaces/FieldOptions.md +63 -0
- package/docs/interfaces/FieldRawBoxData.md +25 -0
- package/docs/interfaces/FieldVisualInfo.md +65 -0
- package/docs/interfaces/GridOptions.md +61 -0
- package/docs/interfaces/InjectOptions.md +133 -0
- package/docs/interfaces/InputFieldJson.md +50 -0
- package/docs/interfaces/KabelCommentRendering.md +31 -0
- package/docs/interfaces/KabelInterface.md +469 -0
- package/docs/interfaces/KabelNodeRendering.md +77 -0
- package/docs/interfaces/KabelUIX.md +105 -0
- package/docs/interfaces/KabelUtils.md +215 -0
- package/docs/interfaces/NodeEvents.md +42 -0
- package/docs/interfaces/NodeJson.md +104 -0
- package/docs/interfaces/NodePrototype.md +82 -0
- package/docs/interfaces/RegisteredEl.md +53 -0
- package/docs/interfaces/SerializedNode.md +128 -0
- package/docs/interfaces/TblxCategoryStruct.md +41 -0
- package/docs/interfaces/TblxFieldStruct.md +28 -0
- package/docs/interfaces/TblxNodeStruct.md +35 -0
- package/docs/interfaces/WidgetOptions.md +115 -0
- package/docs/interfaces/WidgetPrototypeList.md +15 -0
- package/docs/type-aliases/AnyField.md +13 -0
- package/docs/type-aliases/AnyFieldCls.md +13 -0
- package/docs/type-aliases/Color.md +13 -0
- package/docs/type-aliases/Connectable.md +13 -0
- package/docs/type-aliases/EventArgs.md +11 -0
- package/docs/type-aliases/EventSetupFn.md +25 -0
- package/docs/type-aliases/Hex.md +13 -0
- package/docs/type-aliases/RGBObject.md +37 -0
- package/docs/type-aliases/RGBString.md +13 -0
- package/docs/type-aliases/RGBTuple.md +13 -0
- package/docs/type-aliases/TblxObjStruct.md +52 -0
- package/docs/variables/CategoryColors.md +29 -0
- package/docs/variables/FieldMap.md +41 -0
- package/docs/variables/NodePrototypes.md +18 -0
- package/docs/variables/default.md +11 -0
- package/events/comment-drag-handle.ts +61 -0
- package/events/comment-input.ts +291 -0
- package/events/connection-line.ts +68 -0
- package/events/connector.ts +116 -0
- package/events/draggable.ts +119 -0
- package/events/events.ts +7 -0
- package/events/input-box.ts +213 -0
- package/events/node-x-btn.ts +25 -0
- package/index.d.ts +4 -0
- package/package.json +49 -0
- package/renderers/apollo/apollo.ts +21 -0
- package/renderers/apollo/constants.ts +40 -0
- package/renderers/apollo/renderer.ts +331 -0
- package/renderers/atlas/atlas.ts +15 -0
- package/renderers/constants.ts +87 -0
- package/renderers/renderer.ts +1288 -0
- package/renderers/representer-node.ts +52 -0
- package/renderers/representer.ts +25 -0
- package/src/category.ts +107 -0
- package/src/colors.ts +20 -0
- package/src/comment.ts +142 -0
- package/src/connection.ts +114 -0
- package/src/context-menu.ts +194 -0
- package/src/coordinates.ts +74 -0
- package/src/core.ts +202 -0
- package/src/ctx-menu-registry.ts +143 -0
- package/src/dropdown-menu.ts +215 -0
- package/src/field.ts +595 -0
- package/src/flyout.ts +165 -0
- package/src/fonts-manager.ts +38 -0
- package/src/grid.ts +162 -0
- package/src/headless-node.ts +27 -0
- package/src/index.ts +115 -0
- package/src/inject-headless.ts +18 -0
- package/src/inject.ts +213 -0
- package/src/main-workspace.ts +51 -0
- package/src/mutator.ts +40 -0
- package/src/node-types.ts +27 -0
- package/src/nodesvg.ts +756 -0
- package/src/prototypes.ts +9 -0
- package/src/renderer-map.ts +86 -0
- package/src/styles.css +224 -0
- package/src/toolbox.ts +125 -0
- package/src/types.ts +205 -0
- package/src/undo-redo.ts +87 -0
- package/src/visual-types.ts +29 -0
- package/src/widget-prototypes.ts +11 -0
- package/src/widget.ts +139 -0
- package/src/workspace-coords.ts +14 -0
- package/src/workspace-svg.ts +736 -0
- package/src/workspace.ts +155 -0
- package/test-server.js +61 -0
- package/themes/dark.ts +32 -0
- package/themes/default.ts +28 -0
- package/themes/themes.ts +9 -0
- package/tsconfig.json +25 -0
- package/typedoc.json +10 -0
- package/util/emitter.ts +33 -0
- package/util/env.ts +11 -0
- package/util/escape-html.ts +22 -0
- package/util/eventer.ts +108 -0
- package/util/has-prop.ts +4 -0
- package/util/parse-color.ts +42 -0
- package/util/path.ts +99 -0
- package/util/styler.ts +41 -0
- package/util/uid.ts +184 -0
- package/util/unescape-html.ts +22 -0
- package/util/user-state.ts +68 -0
- package/util/wait-anim-frames.ts +24 -0
- package/util/window-listeners.ts +62 -0
- package/webpack.config.js +80 -0
|
@@ -0,0 +1,1380 @@
|
|
|
1
|
+
[**Kabel Project Docs v1.0.6**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[Kabel Project Docs](../globals.md) / WorkspaceSvg
|
|
6
|
+
|
|
7
|
+
# Class: WorkspaceSvg
|
|
8
|
+
|
|
9
|
+
Defined in: [src/workspace-svg.ts:62](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L62)
|
|
10
|
+
|
|
11
|
+
Represents the visual workspace containing nodes and connections.
|
|
12
|
+
Handles rendering, panning, and coordinate transformations.
|
|
13
|
+
|
|
14
|
+
## Extends
|
|
15
|
+
|
|
16
|
+
- `Workspace`
|
|
17
|
+
|
|
18
|
+
## Constructors
|
|
19
|
+
|
|
20
|
+
### Constructor
|
|
21
|
+
|
|
22
|
+
> **new WorkspaceSvg**(`root`, `wsTop`, `options`): `WorkspaceSvg`
|
|
23
|
+
|
|
24
|
+
Defined in: [src/workspace-svg.ts:147](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L147)
|
|
25
|
+
|
|
26
|
+
Creates a new WorkspaceSvg instance.
|
|
27
|
+
|
|
28
|
+
#### Parameters
|
|
29
|
+
|
|
30
|
+
##### root
|
|
31
|
+
|
|
32
|
+
`HTMLElement`
|
|
33
|
+
|
|
34
|
+
The root HTML element containing the workspace.
|
|
35
|
+
|
|
36
|
+
##### wsTop
|
|
37
|
+
|
|
38
|
+
`HTMLElement`
|
|
39
|
+
|
|
40
|
+
The top-level wrapper element for the SVG.
|
|
41
|
+
|
|
42
|
+
##### options
|
|
43
|
+
|
|
44
|
+
[`InjectOptions`](../interfaces/InjectOptions.md)
|
|
45
|
+
|
|
46
|
+
Configuration and renderer override options.
|
|
47
|
+
|
|
48
|
+
#### Returns
|
|
49
|
+
|
|
50
|
+
`WorkspaceSvg`
|
|
51
|
+
|
|
52
|
+
#### Overrides
|
|
53
|
+
|
|
54
|
+
`Workspace.constructor`
|
|
55
|
+
|
|
56
|
+
## Properties
|
|
57
|
+
|
|
58
|
+
### \_backgroundRect
|
|
59
|
+
|
|
60
|
+
> **\_backgroundRect**: `Rect`
|
|
61
|
+
|
|
62
|
+
Defined in: [src/workspace-svg.ts:89](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L89)
|
|
63
|
+
|
|
64
|
+
The background element
|
|
65
|
+
|
|
66
|
+
***
|
|
67
|
+
|
|
68
|
+
### \_camera
|
|
69
|
+
|
|
70
|
+
> **\_camera**: [`WorkspaceCoords`](WorkspaceCoords.md)
|
|
71
|
+
|
|
72
|
+
Defined in: [src/workspace-svg.ts:75](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L75)
|
|
73
|
+
|
|
74
|
+
Top-left offset of the workspace viewport
|
|
75
|
+
|
|
76
|
+
***
|
|
77
|
+
|
|
78
|
+
### \_commentDB
|
|
79
|
+
|
|
80
|
+
> **\_commentDB**: `Set`\<[`CommentModel`](CommentModel.md)\>
|
|
81
|
+
|
|
82
|
+
Defined in: [src/workspace-svg.ts:118](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L118)
|
|
83
|
+
|
|
84
|
+
A list of comments for this workspace.
|
|
85
|
+
|
|
86
|
+
#### Overrides
|
|
87
|
+
|
|
88
|
+
`Workspace._commentDB`
|
|
89
|
+
|
|
90
|
+
***
|
|
91
|
+
|
|
92
|
+
### \_ctxMenu
|
|
93
|
+
|
|
94
|
+
> **\_ctxMenu**: [`ContextMenuHTML`](ContextMenuHTML.md)
|
|
95
|
+
|
|
96
|
+
Defined in: [src/workspace-svg.ts:114](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L114)
|
|
97
|
+
|
|
98
|
+
A manager for the context menu widget
|
|
99
|
+
|
|
100
|
+
***
|
|
101
|
+
|
|
102
|
+
### \_didMove
|
|
103
|
+
|
|
104
|
+
> **\_didMove**: `boolean` = `false`
|
|
105
|
+
|
|
106
|
+
Defined in: [src/workspace-svg.ts:134](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L134)
|
|
107
|
+
|
|
108
|
+
Internal flag to indicate if the camera has moved this frame.
|
|
109
|
+
|
|
110
|
+
***
|
|
111
|
+
|
|
112
|
+
### \_nodeDB
|
|
113
|
+
|
|
114
|
+
> **\_nodeDB**: `Map`\<`string`, [`NodeSvg`](NodeSvg.md)\>
|
|
115
|
+
|
|
116
|
+
Defined in: [src/workspace-svg.ts:78](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L78)
|
|
117
|
+
|
|
118
|
+
Node storage by unique ID
|
|
119
|
+
|
|
120
|
+
#### Overrides
|
|
121
|
+
|
|
122
|
+
`Workspace._nodeDB`
|
|
123
|
+
|
|
124
|
+
***
|
|
125
|
+
|
|
126
|
+
### \_root
|
|
127
|
+
|
|
128
|
+
> **\_root**: `HTMLElement`
|
|
129
|
+
|
|
130
|
+
Defined in: [src/workspace-svg.ts:81](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L81)
|
|
131
|
+
|
|
132
|
+
Root HTML container for the workspace
|
|
133
|
+
|
|
134
|
+
***
|
|
135
|
+
|
|
136
|
+
### \_widgetDB
|
|
137
|
+
|
|
138
|
+
> **\_widgetDB**: `Map`\<`string`, [`Widget`](Widget.md)\>
|
|
139
|
+
|
|
140
|
+
Defined in: [src/workspace-svg.ts:109](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L109)
|
|
141
|
+
|
|
142
|
+
A list of widgets active in this workspace
|
|
143
|
+
|
|
144
|
+
#### Overrides
|
|
145
|
+
|
|
146
|
+
`Workspace._widgetDB`
|
|
147
|
+
|
|
148
|
+
***
|
|
149
|
+
|
|
150
|
+
### \_wsTop
|
|
151
|
+
|
|
152
|
+
> **\_wsTop**: `HTMLElement`
|
|
153
|
+
|
|
154
|
+
Defined in: [src/workspace-svg.ts:84](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L84)
|
|
155
|
+
|
|
156
|
+
Top-level wrapper for the SVG
|
|
157
|
+
|
|
158
|
+
***
|
|
159
|
+
|
|
160
|
+
### controller
|
|
161
|
+
|
|
162
|
+
> **controller**: [`WorkspaceController`](WorkspaceController.md)
|
|
163
|
+
|
|
164
|
+
Defined in: [src/workspace-svg.ts:101](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L101)
|
|
165
|
+
|
|
166
|
+
A class instance that moves the camera based on user interactions.
|
|
167
|
+
|
|
168
|
+
***
|
|
169
|
+
|
|
170
|
+
### dragState
|
|
171
|
+
|
|
172
|
+
> **dragState**: `IDragState` \| `null` = `null`
|
|
173
|
+
|
|
174
|
+
Defined in: [src/workspace-svg.ts:140](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L140)
|
|
175
|
+
|
|
176
|
+
Current drag state for node dragging
|
|
177
|
+
|
|
178
|
+
***
|
|
179
|
+
|
|
180
|
+
### grid?
|
|
181
|
+
|
|
182
|
+
> `optional` **grid**: `Grid`
|
|
183
|
+
|
|
184
|
+
Defined in: [src/workspace-svg.ts:73](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L73)
|
|
185
|
+
|
|
186
|
+
Workspace background pattern items.
|
|
187
|
+
|
|
188
|
+
***
|
|
189
|
+
|
|
190
|
+
### history
|
|
191
|
+
|
|
192
|
+
> **history**: `UndoRedoHistory`
|
|
193
|
+
|
|
194
|
+
Defined in: [src/workspace-svg.ts:122](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L122)
|
|
195
|
+
|
|
196
|
+
Undo/redo history
|
|
197
|
+
|
|
198
|
+
***
|
|
199
|
+
|
|
200
|
+
### isHeadless
|
|
201
|
+
|
|
202
|
+
> **isHeadless**: `boolean` = `true`
|
|
203
|
+
|
|
204
|
+
Defined in: src/workspace.ts:16
|
|
205
|
+
|
|
206
|
+
#### Inherited from
|
|
207
|
+
|
|
208
|
+
`Workspace.isHeadless`
|
|
209
|
+
|
|
210
|
+
***
|
|
211
|
+
|
|
212
|
+
### moveListeners
|
|
213
|
+
|
|
214
|
+
> **moveListeners**: () => `void`[]
|
|
215
|
+
|
|
216
|
+
Defined in: [src/workspace-svg.ts:138](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L138)
|
|
217
|
+
|
|
218
|
+
Listeners to call when the workspace moves.
|
|
219
|
+
|
|
220
|
+
#### Returns
|
|
221
|
+
|
|
222
|
+
`void`
|
|
223
|
+
|
|
224
|
+
***
|
|
225
|
+
|
|
226
|
+
### noRedraw
|
|
227
|
+
|
|
228
|
+
> **noRedraw**: `boolean`
|
|
229
|
+
|
|
230
|
+
Defined in: [src/workspace-svg.ts:97](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L97)
|
|
231
|
+
|
|
232
|
+
Flag to temporarily prevent redraws
|
|
233
|
+
|
|
234
|
+
***
|
|
235
|
+
|
|
236
|
+
### options
|
|
237
|
+
|
|
238
|
+
> **options**: [`InjectOptions`](../interfaces/InjectOptions.md)
|
|
239
|
+
|
|
240
|
+
Defined in: [src/workspace-svg.ts:94](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L94)
|
|
241
|
+
|
|
242
|
+
Options for workspace behavior and rendering overrides
|
|
243
|
+
|
|
244
|
+
***
|
|
245
|
+
|
|
246
|
+
### recordHistory
|
|
247
|
+
|
|
248
|
+
> **recordHistory**: `boolean` = `true`
|
|
249
|
+
|
|
250
|
+
Defined in: [src/workspace-svg.ts:126](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L126)
|
|
251
|
+
|
|
252
|
+
Whether to record undo/redo history or not
|
|
253
|
+
|
|
254
|
+
***
|
|
255
|
+
|
|
256
|
+
### recordHistoryRecord
|
|
257
|
+
|
|
258
|
+
> **recordHistoryRecord**: `boolean`[]
|
|
259
|
+
|
|
260
|
+
Defined in: [src/workspace-svg.ts:130](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L130)
|
|
261
|
+
|
|
262
|
+
Stack of old recordHistory values for toggleHistory
|
|
263
|
+
|
|
264
|
+
***
|
|
265
|
+
|
|
266
|
+
### renderer
|
|
267
|
+
|
|
268
|
+
> **renderer**: [`Renderer`](Renderer.md)
|
|
269
|
+
|
|
270
|
+
Defined in: [src/workspace-svg.ts:91](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L91)
|
|
271
|
+
|
|
272
|
+
Renderer instance for drawing nodes and connections
|
|
273
|
+
|
|
274
|
+
***
|
|
275
|
+
|
|
276
|
+
### svg
|
|
277
|
+
|
|
278
|
+
> **svg**: `Svg`
|
|
279
|
+
|
|
280
|
+
Defined in: [src/workspace-svg.ts:87](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L87)
|
|
281
|
+
|
|
282
|
+
SVG.js instance for rendering
|
|
283
|
+
|
|
284
|
+
***
|
|
285
|
+
|
|
286
|
+
### theme
|
|
287
|
+
|
|
288
|
+
> **theme**: `WSTheme`
|
|
289
|
+
|
|
290
|
+
Defined in: [src/workspace-svg.ts:69](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L69)
|
|
291
|
+
|
|
292
|
+
Theme of the workspace
|
|
293
|
+
|
|
294
|
+
***
|
|
295
|
+
|
|
296
|
+
### toolbox?
|
|
297
|
+
|
|
298
|
+
> `optional` **toolbox**: [`Toolbox`](Toolbox.md)
|
|
299
|
+
|
|
300
|
+
Defined in: [src/workspace-svg.ts:105](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L105)
|
|
301
|
+
|
|
302
|
+
Toolbox for the workspace.
|
|
303
|
+
|
|
304
|
+
## Accessors
|
|
305
|
+
|
|
306
|
+
### didMove
|
|
307
|
+
|
|
308
|
+
#### Get Signature
|
|
309
|
+
|
|
310
|
+
> **get** **didMove**(): `boolean`
|
|
311
|
+
|
|
312
|
+
Defined in: [src/workspace-svg.ts:205](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L205)
|
|
313
|
+
|
|
314
|
+
Getter and setter for whether we moved or not this frame.
|
|
315
|
+
|
|
316
|
+
##### Returns
|
|
317
|
+
|
|
318
|
+
`boolean`
|
|
319
|
+
|
|
320
|
+
#### Set Signature
|
|
321
|
+
|
|
322
|
+
> **set** **didMove**(`value`): `void`
|
|
323
|
+
|
|
324
|
+
Defined in: [src/workspace-svg.ts:206](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L206)
|
|
325
|
+
|
|
326
|
+
##### Parameters
|
|
327
|
+
|
|
328
|
+
###### value
|
|
329
|
+
|
|
330
|
+
`boolean`
|
|
331
|
+
|
|
332
|
+
##### Returns
|
|
333
|
+
|
|
334
|
+
`void`
|
|
335
|
+
|
|
336
|
+
***
|
|
337
|
+
|
|
338
|
+
### BACKGROUND\_CLASS
|
|
339
|
+
|
|
340
|
+
#### Get Signature
|
|
341
|
+
|
|
342
|
+
> **get** `static` **BACKGROUND\_CLASS**(): `string`
|
|
343
|
+
|
|
344
|
+
Defined in: [src/workspace-svg.ts:63](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L63)
|
|
345
|
+
|
|
346
|
+
##### Returns
|
|
347
|
+
|
|
348
|
+
`string`
|
|
349
|
+
|
|
350
|
+
## Methods
|
|
351
|
+
|
|
352
|
+
### \_addWidgetToDB()
|
|
353
|
+
|
|
354
|
+
> **\_addWidgetToDB**(`wdgt`): `void`
|
|
355
|
+
|
|
356
|
+
Defined in: [src/workspace-svg.ts:408](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L408)
|
|
357
|
+
|
|
358
|
+
Internal: Add widget to DB
|
|
359
|
+
|
|
360
|
+
#### Parameters
|
|
361
|
+
|
|
362
|
+
##### wdgt
|
|
363
|
+
|
|
364
|
+
[`Widget`](Widget.md)
|
|
365
|
+
|
|
366
|
+
The widget
|
|
367
|
+
|
|
368
|
+
#### Returns
|
|
369
|
+
|
|
370
|
+
`void`
|
|
371
|
+
|
|
372
|
+
#### Overrides
|
|
373
|
+
|
|
374
|
+
`Workspace._addWidgetToDB`
|
|
375
|
+
|
|
376
|
+
***
|
|
377
|
+
|
|
378
|
+
### \_delWidgetFromDB()
|
|
379
|
+
|
|
380
|
+
> **\_delWidgetFromDB**(`wdgt`): `void`
|
|
381
|
+
|
|
382
|
+
Defined in: [src/workspace-svg.ts:415](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L415)
|
|
383
|
+
|
|
384
|
+
Internal: Delete a widget from DB.
|
|
385
|
+
|
|
386
|
+
#### Parameters
|
|
387
|
+
|
|
388
|
+
##### wdgt
|
|
389
|
+
|
|
390
|
+
[`Widget`](Widget.md)
|
|
391
|
+
|
|
392
|
+
Widget to delete
|
|
393
|
+
|
|
394
|
+
#### Returns
|
|
395
|
+
|
|
396
|
+
`void`
|
|
397
|
+
|
|
398
|
+
#### Overrides
|
|
399
|
+
|
|
400
|
+
`Workspace._delWidgetFromDB`
|
|
401
|
+
|
|
402
|
+
***
|
|
403
|
+
|
|
404
|
+
### \_initBackground()
|
|
405
|
+
|
|
406
|
+
> **\_initBackground**(): `void`
|
|
407
|
+
|
|
408
|
+
Defined in: [src/workspace-svg.ts:343](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L343)
|
|
409
|
+
|
|
410
|
+
Sets the background grid up based on user selected options.
|
|
411
|
+
|
|
412
|
+
#### Returns
|
|
413
|
+
|
|
414
|
+
`void`
|
|
415
|
+
|
|
416
|
+
***
|
|
417
|
+
|
|
418
|
+
### \_updateBackgroundTransform()
|
|
419
|
+
|
|
420
|
+
> **\_updateBackgroundTransform**(): `void`
|
|
421
|
+
|
|
422
|
+
Defined in: [src/workspace-svg.ts:365](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L365)
|
|
423
|
+
|
|
424
|
+
Updates the transform of the background grid
|
|
425
|
+
|
|
426
|
+
#### Returns
|
|
427
|
+
|
|
428
|
+
`void`
|
|
429
|
+
|
|
430
|
+
***
|
|
431
|
+
|
|
432
|
+
### addComment()
|
|
433
|
+
|
|
434
|
+
> **addComment**(): [`CommentModel`](CommentModel.md)
|
|
435
|
+
|
|
436
|
+
Defined in: [src/workspace-svg.ts:643](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L643)
|
|
437
|
+
|
|
438
|
+
Adds a comment, returns the model.
|
|
439
|
+
|
|
440
|
+
#### Returns
|
|
441
|
+
|
|
442
|
+
[`CommentModel`](CommentModel.md)
|
|
443
|
+
|
|
444
|
+
#### Overrides
|
|
445
|
+
|
|
446
|
+
`Workspace.addComment`
|
|
447
|
+
|
|
448
|
+
***
|
|
449
|
+
|
|
450
|
+
### addMoveListener()
|
|
451
|
+
|
|
452
|
+
> **addMoveListener**(`listener`): () => `void`
|
|
453
|
+
|
|
454
|
+
Defined in: [src/workspace-svg.ts:299](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L299)
|
|
455
|
+
|
|
456
|
+
Adds a move listener to the workspace.
|
|
457
|
+
|
|
458
|
+
#### Parameters
|
|
459
|
+
|
|
460
|
+
##### listener
|
|
461
|
+
|
|
462
|
+
() => `void`
|
|
463
|
+
|
|
464
|
+
The listener function to add.
|
|
465
|
+
|
|
466
|
+
#### Returns
|
|
467
|
+
|
|
468
|
+
A function to remove the added listener.
|
|
469
|
+
|
|
470
|
+
> (): `void`
|
|
471
|
+
|
|
472
|
+
##### Returns
|
|
473
|
+
|
|
474
|
+
`void`
|
|
475
|
+
|
|
476
|
+
***
|
|
477
|
+
|
|
478
|
+
### addNode()
|
|
479
|
+
|
|
480
|
+
> **addNode**(`node`, `nodeId?`): `void`
|
|
481
|
+
|
|
482
|
+
Defined in: [src/workspace-svg.ts:528](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L528)
|
|
483
|
+
|
|
484
|
+
Adds a node to the workspace.
|
|
485
|
+
|
|
486
|
+
#### Parameters
|
|
487
|
+
|
|
488
|
+
##### node
|
|
489
|
+
|
|
490
|
+
[`NodeSvg`](NodeSvg.md)
|
|
491
|
+
|
|
492
|
+
The node instance to add.
|
|
493
|
+
|
|
494
|
+
##### nodeId?
|
|
495
|
+
|
|
496
|
+
`string`
|
|
497
|
+
|
|
498
|
+
Optional custom ID to use instead of node.id.
|
|
499
|
+
|
|
500
|
+
#### Returns
|
|
501
|
+
|
|
502
|
+
`void`
|
|
503
|
+
|
|
504
|
+
#### Overrides
|
|
505
|
+
|
|
506
|
+
`Workspace.addNode`
|
|
507
|
+
|
|
508
|
+
***
|
|
509
|
+
|
|
510
|
+
### beginDrag()
|
|
511
|
+
|
|
512
|
+
> **beginDrag**(`node`, `startX`, `startY`, `offsetX`, `offsetY`): `void`
|
|
513
|
+
|
|
514
|
+
Defined in: [src/workspace-svg.ts:254](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L254)
|
|
515
|
+
|
|
516
|
+
#### Parameters
|
|
517
|
+
|
|
518
|
+
##### node
|
|
519
|
+
|
|
520
|
+
[`NodeSvg`](NodeSvg.md)
|
|
521
|
+
|
|
522
|
+
##### startX
|
|
523
|
+
|
|
524
|
+
`number`
|
|
525
|
+
|
|
526
|
+
##### startY
|
|
527
|
+
|
|
528
|
+
`number`
|
|
529
|
+
|
|
530
|
+
##### offsetX
|
|
531
|
+
|
|
532
|
+
`number` = `0`
|
|
533
|
+
|
|
534
|
+
##### offsetY
|
|
535
|
+
|
|
536
|
+
`number` = `0`
|
|
537
|
+
|
|
538
|
+
#### Returns
|
|
539
|
+
|
|
540
|
+
`void`
|
|
541
|
+
|
|
542
|
+
***
|
|
543
|
+
|
|
544
|
+
### cloneNode()
|
|
545
|
+
|
|
546
|
+
> **cloneNode**(`nodeSvg`): `void`
|
|
547
|
+
|
|
548
|
+
Defined in: [src/workspace-svg.ts:398](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L398)
|
|
549
|
+
|
|
550
|
+
Duplicate node data from one to another
|
|
551
|
+
|
|
552
|
+
#### Parameters
|
|
553
|
+
|
|
554
|
+
##### nodeSvg
|
|
555
|
+
|
|
556
|
+
[`NodeSvg`](NodeSvg.md)
|
|
557
|
+
|
|
558
|
+
The node
|
|
559
|
+
|
|
560
|
+
#### Returns
|
|
561
|
+
|
|
562
|
+
`void`
|
|
563
|
+
|
|
564
|
+
***
|
|
565
|
+
|
|
566
|
+
### derefNode()
|
|
567
|
+
|
|
568
|
+
> **derefNode**(`node`): `void`
|
|
569
|
+
|
|
570
|
+
Defined in: [src/workspace-svg.ts:571](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L571)
|
|
571
|
+
|
|
572
|
+
Dereference a node from all of its connected neighbors
|
|
573
|
+
|
|
574
|
+
#### Parameters
|
|
575
|
+
|
|
576
|
+
##### node
|
|
577
|
+
|
|
578
|
+
[`NodeSvg`](NodeSvg.md)
|
|
579
|
+
|
|
580
|
+
#### Returns
|
|
581
|
+
|
|
582
|
+
`void`
|
|
583
|
+
|
|
584
|
+
#### Overrides
|
|
585
|
+
|
|
586
|
+
`Workspace.derefNode`
|
|
587
|
+
|
|
588
|
+
***
|
|
589
|
+
|
|
590
|
+
### drawAllNodes()
|
|
591
|
+
|
|
592
|
+
> **drawAllNodes**(): `void`
|
|
593
|
+
|
|
594
|
+
Defined in: [src/workspace-svg.ts:471](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L471)
|
|
595
|
+
|
|
596
|
+
Draws all nodes in the workspace. Very heavy.
|
|
597
|
+
|
|
598
|
+
#### Returns
|
|
599
|
+
|
|
600
|
+
`void`
|
|
601
|
+
|
|
602
|
+
***
|
|
603
|
+
|
|
604
|
+
### drawNode()
|
|
605
|
+
|
|
606
|
+
> **drawNode**(`id`): `G` \| `null` \| `undefined`
|
|
607
|
+
|
|
608
|
+
Defined in: [src/workspace-svg.ts:519](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L519)
|
|
609
|
+
|
|
610
|
+
Draws a node by its ID.
|
|
611
|
+
|
|
612
|
+
#### Parameters
|
|
613
|
+
|
|
614
|
+
##### id
|
|
615
|
+
|
|
616
|
+
`string`
|
|
617
|
+
|
|
618
|
+
The ID of the node to render.
|
|
619
|
+
|
|
620
|
+
#### Returns
|
|
621
|
+
|
|
622
|
+
`G` \| `null` \| `undefined`
|
|
623
|
+
|
|
624
|
+
The rendered node.
|
|
625
|
+
|
|
626
|
+
***
|
|
627
|
+
|
|
628
|
+
### emitChange()
|
|
629
|
+
|
|
630
|
+
> **emitChange**(): `void`
|
|
631
|
+
|
|
632
|
+
Defined in: [src/workspace-svg.ts:316](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L316)
|
|
633
|
+
|
|
634
|
+
Emits a change event for the workspace, triggering
|
|
635
|
+
undo/redo history tracking.
|
|
636
|
+
|
|
637
|
+
#### Returns
|
|
638
|
+
|
|
639
|
+
`void`
|
|
640
|
+
|
|
641
|
+
***
|
|
642
|
+
|
|
643
|
+
### endDrag()
|
|
644
|
+
|
|
645
|
+
> **endDrag**(): `void`
|
|
646
|
+
|
|
647
|
+
Defined in: [src/workspace-svg.ts:282](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L282)
|
|
648
|
+
|
|
649
|
+
#### Returns
|
|
650
|
+
|
|
651
|
+
`void`
|
|
652
|
+
|
|
653
|
+
***
|
|
654
|
+
|
|
655
|
+
### fireMoveListeners()
|
|
656
|
+
|
|
657
|
+
> **fireMoveListeners**(): `void`
|
|
658
|
+
|
|
659
|
+
Defined in: [src/workspace-svg.ts:291](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L291)
|
|
660
|
+
|
|
661
|
+
Fires all move listeners registered to this workspace.
|
|
662
|
+
|
|
663
|
+
#### Returns
|
|
664
|
+
|
|
665
|
+
`void`
|
|
666
|
+
|
|
667
|
+
***
|
|
668
|
+
|
|
669
|
+
### fromJson()
|
|
670
|
+
|
|
671
|
+
> **fromJson**(`json`, `recordBigEvent`): `void`
|
|
672
|
+
|
|
673
|
+
Defined in: [src/workspace-svg.ts:686](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L686)
|
|
674
|
+
|
|
675
|
+
Deserialize this workspace from json data.
|
|
676
|
+
|
|
677
|
+
#### Parameters
|
|
678
|
+
|
|
679
|
+
##### json
|
|
680
|
+
|
|
681
|
+
Serialized workspace
|
|
682
|
+
|
|
683
|
+
###### circular
|
|
684
|
+
|
|
685
|
+
`boolean`
|
|
686
|
+
|
|
687
|
+
###### nodes
|
|
688
|
+
|
|
689
|
+
`any`[]
|
|
690
|
+
|
|
691
|
+
##### recordBigEvent
|
|
692
|
+
|
|
693
|
+
`boolean` = `false`
|
|
694
|
+
|
|
695
|
+
#### Returns
|
|
696
|
+
|
|
697
|
+
`void`
|
|
698
|
+
|
|
699
|
+
#### Overrides
|
|
700
|
+
|
|
701
|
+
`Workspace.fromJson`
|
|
702
|
+
|
|
703
|
+
***
|
|
704
|
+
|
|
705
|
+
### getComment()
|
|
706
|
+
|
|
707
|
+
> **getComment**(`id`): [`CommentModel`](CommentModel.md) \| `undefined`
|
|
708
|
+
|
|
709
|
+
Defined in: [src/workspace-svg.ts:653](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L653)
|
|
710
|
+
|
|
711
|
+
Gets a comment by id
|
|
712
|
+
|
|
713
|
+
#### Parameters
|
|
714
|
+
|
|
715
|
+
##### id
|
|
716
|
+
|
|
717
|
+
`string`
|
|
718
|
+
|
|
719
|
+
The comment id.
|
|
720
|
+
|
|
721
|
+
#### Returns
|
|
722
|
+
|
|
723
|
+
[`CommentModel`](CommentModel.md) \| `undefined`
|
|
724
|
+
|
|
725
|
+
#### Overrides
|
|
726
|
+
|
|
727
|
+
`Workspace.getComment`
|
|
728
|
+
|
|
729
|
+
***
|
|
730
|
+
|
|
731
|
+
### getComments()
|
|
732
|
+
|
|
733
|
+
> **getComments**(): [`CommentModel`](CommentModel.md)[]
|
|
734
|
+
|
|
735
|
+
Defined in: [src/workspace-svg.ts:391](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L391)
|
|
736
|
+
|
|
737
|
+
Get all comments
|
|
738
|
+
|
|
739
|
+
#### Returns
|
|
740
|
+
|
|
741
|
+
[`CommentModel`](CommentModel.md)[]
|
|
742
|
+
|
|
743
|
+
#### Overrides
|
|
744
|
+
|
|
745
|
+
`Workspace.getComments`
|
|
746
|
+
|
|
747
|
+
***
|
|
748
|
+
|
|
749
|
+
### getContentSize()
|
|
750
|
+
|
|
751
|
+
> **getContentSize**(): `object`
|
|
752
|
+
|
|
753
|
+
Defined in: [src/workspace-svg.ts:448](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L448)
|
|
754
|
+
|
|
755
|
+
Returns the current width and height of the workspace's svg content size in pixels.
|
|
756
|
+
Useful for camera positioning.
|
|
757
|
+
|
|
758
|
+
#### Returns
|
|
759
|
+
|
|
760
|
+
`object`
|
|
761
|
+
|
|
762
|
+
##### height
|
|
763
|
+
|
|
764
|
+
> **height**: `number`
|
|
765
|
+
|
|
766
|
+
##### width
|
|
767
|
+
|
|
768
|
+
> **width**: `number`
|
|
769
|
+
|
|
770
|
+
***
|
|
771
|
+
|
|
772
|
+
### getNode()
|
|
773
|
+
|
|
774
|
+
> **getNode**(`id`): [`NodeSvg`](NodeSvg.md) \| `undefined`
|
|
775
|
+
|
|
776
|
+
Defined in: [src/workspace-svg.ts:623](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L623)
|
|
777
|
+
|
|
778
|
+
Retrieves a node by its ID.
|
|
779
|
+
|
|
780
|
+
#### Parameters
|
|
781
|
+
|
|
782
|
+
##### id
|
|
783
|
+
|
|
784
|
+
The ID of the node.
|
|
785
|
+
|
|
786
|
+
`string` | [`NodeSvg`](NodeSvg.md)
|
|
787
|
+
|
|
788
|
+
#### Returns
|
|
789
|
+
|
|
790
|
+
[`NodeSvg`](NodeSvg.md) \| `undefined`
|
|
791
|
+
|
|
792
|
+
The NodeSvg instance or undefined if not found.
|
|
793
|
+
|
|
794
|
+
#### Overrides
|
|
795
|
+
|
|
796
|
+
`Workspace.getNode`
|
|
797
|
+
|
|
798
|
+
***
|
|
799
|
+
|
|
800
|
+
### getSize()
|
|
801
|
+
|
|
802
|
+
> **getSize**(): `object`
|
|
803
|
+
|
|
804
|
+
Defined in: [src/workspace-svg.ts:456](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L456)
|
|
805
|
+
|
|
806
|
+
Returns the current width and height of the workspace in pixels.
|
|
807
|
+
Useful for camera centering, zoom calculations, and viewport sizing.
|
|
808
|
+
|
|
809
|
+
#### Returns
|
|
810
|
+
|
|
811
|
+
`object`
|
|
812
|
+
|
|
813
|
+
##### height
|
|
814
|
+
|
|
815
|
+
> **height**: `number`
|
|
816
|
+
|
|
817
|
+
##### width
|
|
818
|
+
|
|
819
|
+
> **width**: `number`
|
|
820
|
+
|
|
821
|
+
***
|
|
822
|
+
|
|
823
|
+
### getWidget()
|
|
824
|
+
|
|
825
|
+
> **getWidget**(`id`): [`Widget`](Widget.md) \| `undefined`
|
|
826
|
+
|
|
827
|
+
Defined in: [src/workspace-svg.ts:440](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L440)
|
|
828
|
+
|
|
829
|
+
Get a widget
|
|
830
|
+
|
|
831
|
+
#### Parameters
|
|
832
|
+
|
|
833
|
+
##### id
|
|
834
|
+
|
|
835
|
+
`string`
|
|
836
|
+
|
|
837
|
+
Identifier
|
|
838
|
+
|
|
839
|
+
#### Returns
|
|
840
|
+
|
|
841
|
+
[`Widget`](Widget.md) \| `undefined`
|
|
842
|
+
|
|
843
|
+
- A widget
|
|
844
|
+
|
|
845
|
+
#### Overrides
|
|
846
|
+
|
|
847
|
+
`Workspace.getWidget`
|
|
848
|
+
|
|
849
|
+
***
|
|
850
|
+
|
|
851
|
+
### getZoom()
|
|
852
|
+
|
|
853
|
+
> **getZoom**(): `number`
|
|
854
|
+
|
|
855
|
+
Defined in: [src/workspace-svg.ts:378](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L378)
|
|
856
|
+
|
|
857
|
+
Get the current zoom factor of the workspace.
|
|
858
|
+
|
|
859
|
+
#### Returns
|
|
860
|
+
|
|
861
|
+
`number`
|
|
862
|
+
|
|
863
|
+
- The zoom factor
|
|
864
|
+
|
|
865
|
+
***
|
|
866
|
+
|
|
867
|
+
### newNode()
|
|
868
|
+
|
|
869
|
+
> **newNode**(`type`, `add`): [`NodeSvg`](NodeSvg.md) \| `undefined`
|
|
870
|
+
|
|
871
|
+
Defined in: [src/workspace-svg.ts:546](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L546)
|
|
872
|
+
|
|
873
|
+
Create a new node of *type*.
|
|
874
|
+
|
|
875
|
+
#### Parameters
|
|
876
|
+
|
|
877
|
+
##### type
|
|
878
|
+
|
|
879
|
+
The node's prototype name.
|
|
880
|
+
|
|
881
|
+
`string` | `number`
|
|
882
|
+
|
|
883
|
+
##### add
|
|
884
|
+
|
|
885
|
+
`boolean` = `true`
|
|
886
|
+
|
|
887
|
+
#### Returns
|
|
888
|
+
|
|
889
|
+
[`NodeSvg`](NodeSvg.md) \| `undefined`
|
|
890
|
+
|
|
891
|
+
#### Overrides
|
|
892
|
+
|
|
893
|
+
`Workspace.newNode`
|
|
894
|
+
|
|
895
|
+
***
|
|
896
|
+
|
|
897
|
+
### newWidget()
|
|
898
|
+
|
|
899
|
+
> **newWidget**(`type`): `void` \| [`Widget`](Widget.md)
|
|
900
|
+
|
|
901
|
+
Defined in: [src/workspace-svg.ts:423](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L423)
|
|
902
|
+
|
|
903
|
+
Create a new widget of type.
|
|
904
|
+
|
|
905
|
+
#### Parameters
|
|
906
|
+
|
|
907
|
+
##### type
|
|
908
|
+
|
|
909
|
+
`string`
|
|
910
|
+
|
|
911
|
+
The prototype
|
|
912
|
+
|
|
913
|
+
#### Returns
|
|
914
|
+
|
|
915
|
+
`void` \| [`Widget`](Widget.md)
|
|
916
|
+
|
|
917
|
+
#### Overrides
|
|
918
|
+
|
|
919
|
+
`Workspace.newWidget`
|
|
920
|
+
|
|
921
|
+
***
|
|
922
|
+
|
|
923
|
+
### pan()
|
|
924
|
+
|
|
925
|
+
> **pan**(`dx`, `dy`): `void`
|
|
926
|
+
|
|
927
|
+
Defined in: [src/workspace-svg.ts:633](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L633)
|
|
928
|
+
|
|
929
|
+
Pans the camera by the given delta values.
|
|
930
|
+
|
|
931
|
+
#### Parameters
|
|
932
|
+
|
|
933
|
+
##### dx
|
|
934
|
+
|
|
935
|
+
`number`
|
|
936
|
+
|
|
937
|
+
Change in X direction.
|
|
938
|
+
|
|
939
|
+
##### dy
|
|
940
|
+
|
|
941
|
+
`number`
|
|
942
|
+
|
|
943
|
+
Change in Y direction.
|
|
944
|
+
|
|
945
|
+
#### Returns
|
|
946
|
+
|
|
947
|
+
`void`
|
|
948
|
+
|
|
949
|
+
***
|
|
950
|
+
|
|
951
|
+
### redraw()
|
|
952
|
+
|
|
953
|
+
> **redraw**(): `void`
|
|
954
|
+
|
|
955
|
+
Defined in: [src/workspace-svg.ts:478](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L478)
|
|
956
|
+
|
|
957
|
+
Redraws the entire workspace unless noRedraw is set.
|
|
958
|
+
|
|
959
|
+
#### Returns
|
|
960
|
+
|
|
961
|
+
`void`
|
|
962
|
+
|
|
963
|
+
***
|
|
964
|
+
|
|
965
|
+
### redrawComments()
|
|
966
|
+
|
|
967
|
+
> **redrawComments**(): `void`
|
|
968
|
+
|
|
969
|
+
Defined in: [src/workspace-svg.ts:678](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L678)
|
|
970
|
+
|
|
971
|
+
Redraw all comments in this workspace.
|
|
972
|
+
|
|
973
|
+
#### Returns
|
|
974
|
+
|
|
975
|
+
`void`
|
|
976
|
+
|
|
977
|
+
***
|
|
978
|
+
|
|
979
|
+
### refresh()
|
|
980
|
+
|
|
981
|
+
> **refresh**(): `void`
|
|
982
|
+
|
|
983
|
+
Defined in: [src/workspace-svg.ts:465](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L465)
|
|
984
|
+
|
|
985
|
+
Updates all connection lines & node screen positions without a full redraw.
|
|
986
|
+
Used when nodes are dragged or the camera moves.
|
|
987
|
+
|
|
988
|
+
#### Returns
|
|
989
|
+
|
|
990
|
+
`void`
|
|
991
|
+
|
|
992
|
+
***
|
|
993
|
+
|
|
994
|
+
### refreshComments()
|
|
995
|
+
|
|
996
|
+
> **refreshComments**(): `void`
|
|
997
|
+
|
|
998
|
+
Defined in: [src/workspace-svg.ts:384](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L384)
|
|
999
|
+
|
|
1000
|
+
Refresh comments.
|
|
1001
|
+
|
|
1002
|
+
#### Returns
|
|
1003
|
+
|
|
1004
|
+
`void`
|
|
1005
|
+
|
|
1006
|
+
***
|
|
1007
|
+
|
|
1008
|
+
### removeComment()
|
|
1009
|
+
|
|
1010
|
+
> **removeComment**(`commentOrId`): `boolean`
|
|
1011
|
+
|
|
1012
|
+
Defined in: [src/workspace-svg.ts:660](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L660)
|
|
1013
|
+
|
|
1014
|
+
Remove a comment by its instance or id.
|
|
1015
|
+
|
|
1016
|
+
#### Parameters
|
|
1017
|
+
|
|
1018
|
+
##### commentOrId
|
|
1019
|
+
|
|
1020
|
+
The comment instance or its id.
|
|
1021
|
+
|
|
1022
|
+
`string` | [`CommentModel`](CommentModel.md)
|
|
1023
|
+
|
|
1024
|
+
#### Returns
|
|
1025
|
+
|
|
1026
|
+
`boolean`
|
|
1027
|
+
|
|
1028
|
+
#### Overrides
|
|
1029
|
+
|
|
1030
|
+
`Workspace.removeComment`
|
|
1031
|
+
|
|
1032
|
+
***
|
|
1033
|
+
|
|
1034
|
+
### removeMoveListener()
|
|
1035
|
+
|
|
1036
|
+
> **removeMoveListener**(`listener`): `void`
|
|
1037
|
+
|
|
1038
|
+
Defined in: [src/workspace-svg.ts:309](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L309)
|
|
1039
|
+
|
|
1040
|
+
Removes a move listener from the workspace.
|
|
1041
|
+
|
|
1042
|
+
#### Parameters
|
|
1043
|
+
|
|
1044
|
+
##### listener
|
|
1045
|
+
|
|
1046
|
+
() => `void`
|
|
1047
|
+
|
|
1048
|
+
The listener function to remove.
|
|
1049
|
+
|
|
1050
|
+
#### Returns
|
|
1051
|
+
|
|
1052
|
+
`void`
|
|
1053
|
+
|
|
1054
|
+
***
|
|
1055
|
+
|
|
1056
|
+
### removeNode()
|
|
1057
|
+
|
|
1058
|
+
> **removeNode**(`node`): `void`
|
|
1059
|
+
|
|
1060
|
+
Defined in: [src/workspace-svg.ts:613](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L613)
|
|
1061
|
+
|
|
1062
|
+
Removes a node by its instance.
|
|
1063
|
+
|
|
1064
|
+
#### Parameters
|
|
1065
|
+
|
|
1066
|
+
##### node
|
|
1067
|
+
|
|
1068
|
+
[`NodeSvg`](NodeSvg.md)
|
|
1069
|
+
|
|
1070
|
+
The node instance to remove.
|
|
1071
|
+
|
|
1072
|
+
#### Returns
|
|
1073
|
+
|
|
1074
|
+
`void`
|
|
1075
|
+
|
|
1076
|
+
#### Overrides
|
|
1077
|
+
|
|
1078
|
+
`Workspace.removeNode`
|
|
1079
|
+
|
|
1080
|
+
***
|
|
1081
|
+
|
|
1082
|
+
### removeNodeById()
|
|
1083
|
+
|
|
1084
|
+
> **removeNodeById**(`id`): `void`
|
|
1085
|
+
|
|
1086
|
+
Defined in: [src/workspace-svg.ts:597](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L597)
|
|
1087
|
+
|
|
1088
|
+
Removes a node by its ID.
|
|
1089
|
+
|
|
1090
|
+
#### Parameters
|
|
1091
|
+
|
|
1092
|
+
##### id
|
|
1093
|
+
|
|
1094
|
+
`string`
|
|
1095
|
+
|
|
1096
|
+
The ID of the node to remove.
|
|
1097
|
+
|
|
1098
|
+
#### Returns
|
|
1099
|
+
|
|
1100
|
+
`void`
|
|
1101
|
+
|
|
1102
|
+
#### Overrides
|
|
1103
|
+
|
|
1104
|
+
`Workspace.removeNodeById`
|
|
1105
|
+
|
|
1106
|
+
***
|
|
1107
|
+
|
|
1108
|
+
### screenToWorkspace()
|
|
1109
|
+
|
|
1110
|
+
> **screenToWorkspace**(`screenX`, `screenY`): `object`
|
|
1111
|
+
|
|
1112
|
+
Defined in: [src/workspace-svg.ts:507](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L507)
|
|
1113
|
+
|
|
1114
|
+
Converts screen (SVG) coordinates to workspace coordinates.
|
|
1115
|
+
|
|
1116
|
+
#### Parameters
|
|
1117
|
+
|
|
1118
|
+
##### screenX
|
|
1119
|
+
|
|
1120
|
+
`number`
|
|
1121
|
+
|
|
1122
|
+
##### screenY
|
|
1123
|
+
|
|
1124
|
+
`number`
|
|
1125
|
+
|
|
1126
|
+
#### Returns
|
|
1127
|
+
|
|
1128
|
+
`object`
|
|
1129
|
+
|
|
1130
|
+
Workspace coordinates as a Coordinates instance.
|
|
1131
|
+
|
|
1132
|
+
##### x
|
|
1133
|
+
|
|
1134
|
+
> **x**: `number` = `workX`
|
|
1135
|
+
|
|
1136
|
+
##### y
|
|
1137
|
+
|
|
1138
|
+
> **y**: `number` = `workY`
|
|
1139
|
+
|
|
1140
|
+
***
|
|
1141
|
+
|
|
1142
|
+
### setDragState()
|
|
1143
|
+
|
|
1144
|
+
> **setDragState**(`params`): `void`
|
|
1145
|
+
|
|
1146
|
+
Defined in: [src/workspace-svg.ts:217](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L217)
|
|
1147
|
+
|
|
1148
|
+
Sets the drag state of the workspace.
|
|
1149
|
+
|
|
1150
|
+
#### Parameters
|
|
1151
|
+
|
|
1152
|
+
##### params
|
|
1153
|
+
|
|
1154
|
+
Drag state parameters.
|
|
1155
|
+
|
|
1156
|
+
###### currentX
|
|
1157
|
+
|
|
1158
|
+
`number`
|
|
1159
|
+
|
|
1160
|
+
###### currentY
|
|
1161
|
+
|
|
1162
|
+
`number`
|
|
1163
|
+
|
|
1164
|
+
###### node
|
|
1165
|
+
|
|
1166
|
+
[`NodeSvg`](NodeSvg.md) \| `null`
|
|
1167
|
+
|
|
1168
|
+
###### offsetX?
|
|
1169
|
+
|
|
1170
|
+
`number`
|
|
1171
|
+
|
|
1172
|
+
###### offsetY?
|
|
1173
|
+
|
|
1174
|
+
`number`
|
|
1175
|
+
|
|
1176
|
+
###### startX
|
|
1177
|
+
|
|
1178
|
+
`number`
|
|
1179
|
+
|
|
1180
|
+
###### startY
|
|
1181
|
+
|
|
1182
|
+
`number`
|
|
1183
|
+
|
|
1184
|
+
#### Returns
|
|
1185
|
+
|
|
1186
|
+
`void`
|
|
1187
|
+
|
|
1188
|
+
Void.
|
|
1189
|
+
|
|
1190
|
+
***
|
|
1191
|
+
|
|
1192
|
+
### setTheme()
|
|
1193
|
+
|
|
1194
|
+
> **setTheme**(`theme`): `void`
|
|
1195
|
+
|
|
1196
|
+
Defined in: [src/workspace-svg.ts:190](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L190)
|
|
1197
|
+
|
|
1198
|
+
#### Parameters
|
|
1199
|
+
|
|
1200
|
+
##### theme
|
|
1201
|
+
|
|
1202
|
+
`WSTheme`
|
|
1203
|
+
|
|
1204
|
+
#### Returns
|
|
1205
|
+
|
|
1206
|
+
`void`
|
|
1207
|
+
|
|
1208
|
+
***
|
|
1209
|
+
|
|
1210
|
+
### spawnAt()
|
|
1211
|
+
|
|
1212
|
+
> **spawnAt**(`type`, `x`, `y`): [`NodeSvg`](NodeSvg.md) \| `undefined`
|
|
1213
|
+
|
|
1214
|
+
Defined in: [src/workspace-svg.ts:560](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L560)
|
|
1215
|
+
|
|
1216
|
+
Spawns a node at x, y of prototype type
|
|
1217
|
+
|
|
1218
|
+
#### Parameters
|
|
1219
|
+
|
|
1220
|
+
##### type
|
|
1221
|
+
|
|
1222
|
+
The node prototype name
|
|
1223
|
+
|
|
1224
|
+
`string` | `number`
|
|
1225
|
+
|
|
1226
|
+
##### x
|
|
1227
|
+
|
|
1228
|
+
`number`
|
|
1229
|
+
|
|
1230
|
+
X position
|
|
1231
|
+
|
|
1232
|
+
##### y
|
|
1233
|
+
|
|
1234
|
+
`number`
|
|
1235
|
+
|
|
1236
|
+
Y position
|
|
1237
|
+
|
|
1238
|
+
#### Returns
|
|
1239
|
+
|
|
1240
|
+
[`NodeSvg`](NodeSvg.md) \| `undefined`
|
|
1241
|
+
|
|
1242
|
+
- The new node
|
|
1243
|
+
|
|
1244
|
+
#### Overrides
|
|
1245
|
+
|
|
1246
|
+
`Workspace.spawnAt`
|
|
1247
|
+
|
|
1248
|
+
***
|
|
1249
|
+
|
|
1250
|
+
### toggleHistory()
|
|
1251
|
+
|
|
1252
|
+
> **toggleHistory**(`value`): `void`
|
|
1253
|
+
|
|
1254
|
+
Defined in: [src/workspace-svg.ts:326](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L326)
|
|
1255
|
+
|
|
1256
|
+
Temporarily sets the workspace's history recording state.
|
|
1257
|
+
Pushes the previous state onto a stack for later restoration.
|
|
1258
|
+
|
|
1259
|
+
#### Parameters
|
|
1260
|
+
|
|
1261
|
+
##### value
|
|
1262
|
+
|
|
1263
|
+
`boolean`
|
|
1264
|
+
|
|
1265
|
+
Whether history recording should be enabled.
|
|
1266
|
+
|
|
1267
|
+
#### Returns
|
|
1268
|
+
|
|
1269
|
+
`void`
|
|
1270
|
+
|
|
1271
|
+
***
|
|
1272
|
+
|
|
1273
|
+
### toJson()
|
|
1274
|
+
|
|
1275
|
+
> **toJson**(`circular`): `object`
|
|
1276
|
+
|
|
1277
|
+
Defined in: [src/workspace-svg.ts:713](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L713)
|
|
1278
|
+
|
|
1279
|
+
Serialize this workspace, optionally using circular references.
|
|
1280
|
+
|
|
1281
|
+
#### Parameters
|
|
1282
|
+
|
|
1283
|
+
##### circular
|
|
1284
|
+
|
|
1285
|
+
`boolean`
|
|
1286
|
+
|
|
1287
|
+
#### Returns
|
|
1288
|
+
|
|
1289
|
+
`object`
|
|
1290
|
+
|
|
1291
|
+
##### circular
|
|
1292
|
+
|
|
1293
|
+
> **circular**: `boolean`
|
|
1294
|
+
|
|
1295
|
+
##### nodes
|
|
1296
|
+
|
|
1297
|
+
> **nodes**: ([`SerializedNode`](../interfaces/SerializedNode.md) \| \{\[`id`: `string`\]: `Omit`\<[`SerializedNode`](../interfaces/SerializedNode.md), `"previousConnection"` \| `"nextConnection"`\> & `object`; \})[]
|
|
1298
|
+
|
|
1299
|
+
#### Overrides
|
|
1300
|
+
|
|
1301
|
+
`Workspace.toJson`
|
|
1302
|
+
|
|
1303
|
+
***
|
|
1304
|
+
|
|
1305
|
+
### untoggleHistory()
|
|
1306
|
+
|
|
1307
|
+
> **untoggleHistory**(): `void`
|
|
1308
|
+
|
|
1309
|
+
Defined in: [src/workspace-svg.ts:335](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L335)
|
|
1310
|
+
|
|
1311
|
+
Restores the previous history recording state from the stack.
|
|
1312
|
+
Use after a temporary toggle to revert to the previous state.
|
|
1313
|
+
|
|
1314
|
+
#### Returns
|
|
1315
|
+
|
|
1316
|
+
`void`
|
|
1317
|
+
|
|
1318
|
+
***
|
|
1319
|
+
|
|
1320
|
+
### updateDrag()
|
|
1321
|
+
|
|
1322
|
+
> **updateDrag**(`currentX`, `currentY`): `void`
|
|
1323
|
+
|
|
1324
|
+
Defined in: [src/workspace-svg.ts:274](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L274)
|
|
1325
|
+
|
|
1326
|
+
Updates the current drag position.
|
|
1327
|
+
|
|
1328
|
+
#### Parameters
|
|
1329
|
+
|
|
1330
|
+
##### currentX
|
|
1331
|
+
|
|
1332
|
+
`number`
|
|
1333
|
+
|
|
1334
|
+
Current X position.
|
|
1335
|
+
|
|
1336
|
+
##### currentY
|
|
1337
|
+
|
|
1338
|
+
`number`
|
|
1339
|
+
|
|
1340
|
+
Current Y position.
|
|
1341
|
+
|
|
1342
|
+
#### Returns
|
|
1343
|
+
|
|
1344
|
+
`void`
|
|
1345
|
+
|
|
1346
|
+
Void.
|
|
1347
|
+
|
|
1348
|
+
***
|
|
1349
|
+
|
|
1350
|
+
### workspaceToScreen()
|
|
1351
|
+
|
|
1352
|
+
> **workspaceToScreen**(`workX`, `workY`): `object`
|
|
1353
|
+
|
|
1354
|
+
Defined in: [src/workspace-svg.ts:493](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/workspace-svg.ts#L493)
|
|
1355
|
+
|
|
1356
|
+
Converts workspace coordinates to screen (SVG) coordinates.
|
|
1357
|
+
|
|
1358
|
+
#### Parameters
|
|
1359
|
+
|
|
1360
|
+
##### workX
|
|
1361
|
+
|
|
1362
|
+
`number`
|
|
1363
|
+
|
|
1364
|
+
##### workY
|
|
1365
|
+
|
|
1366
|
+
`number`
|
|
1367
|
+
|
|
1368
|
+
#### Returns
|
|
1369
|
+
|
|
1370
|
+
`object`
|
|
1371
|
+
|
|
1372
|
+
Screen coordinates as a Coordinates instance.
|
|
1373
|
+
|
|
1374
|
+
##### x
|
|
1375
|
+
|
|
1376
|
+
> **x**: `number`
|
|
1377
|
+
|
|
1378
|
+
##### y
|
|
1379
|
+
|
|
1380
|
+
> **y**: `number`
|