@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.
Files changed (273) hide show
  1. package/dist/comment-renderer/renderer.d.ts +32 -0
  2. package/dist/comment-renderer/renderer.d.ts.map +1 -0
  3. package/dist/controllers/base.d.ts +39 -0
  4. package/dist/controllers/base.d.ts.map +1 -0
  5. package/dist/controllers/wasd.d.ts +33 -0
  6. package/dist/controllers/wasd.d.ts.map +1 -0
  7. package/dist/events/comment-drag-handle.d.ts +2 -0
  8. package/dist/events/comment-drag-handle.d.ts.map +1 -0
  9. package/dist/events/comment-input.d.ts +4 -0
  10. package/dist/events/comment-input.d.ts.map +1 -0
  11. package/dist/events/connection-line.d.ts +2 -0
  12. package/dist/events/connection-line.d.ts.map +1 -0
  13. package/dist/events/connector.d.ts +2 -0
  14. package/dist/events/connector.d.ts.map +1 -0
  15. package/dist/events/draggable.d.ts +2 -0
  16. package/dist/events/draggable.d.ts.map +1 -0
  17. package/{events/events.ts → dist/events/events.d.ts} +8 -7
  18. package/dist/events/events.d.ts.map +1 -0
  19. package/dist/events/input-box.d.ts +2 -0
  20. package/dist/events/input-box.d.ts.map +1 -0
  21. package/dist/events/node-x-btn.d.ts +2 -0
  22. package/dist/events/node-x-btn.d.ts.map +1 -0
  23. package/dist/kabel.js +2 -0
  24. package/dist/kabel.js.map +1 -0
  25. package/dist/renderers/apollo/apollo.d.ts +12 -0
  26. package/dist/renderers/apollo/apollo.d.ts.map +1 -0
  27. package/dist/renderers/apollo/constants.d.ts +21 -0
  28. package/dist/renderers/apollo/constants.d.ts.map +1 -0
  29. package/dist/renderers/apollo/renderer.d.ts +97 -0
  30. package/dist/renderers/apollo/renderer.d.ts.map +1 -0
  31. package/{renderers/atlas/atlas.ts → dist/renderers/atlas/atlas.d.ts} +6 -15
  32. package/dist/renderers/atlas/atlas.d.ts.map +1 -0
  33. package/dist/renderers/constants.d.ts +51 -0
  34. package/dist/renderers/constants.d.ts.map +1 -0
  35. package/dist/renderers/renderer.d.ts +470 -0
  36. package/dist/renderers/renderer.d.ts.map +1 -0
  37. package/dist/renderers/representer-node.d.ts +27 -0
  38. package/dist/renderers/representer-node.d.ts.map +1 -0
  39. package/dist/renderers/representer.d.ts +13 -0
  40. package/dist/renderers/representer.d.ts.map +1 -0
  41. package/dist/src/category.d.ts +48 -0
  42. package/dist/src/category.d.ts.map +1 -0
  43. package/{src/colors.ts → dist/src/colors.d.ts} +21 -20
  44. package/dist/src/colors.d.ts.map +1 -0
  45. package/dist/src/comment.d.ts +88 -0
  46. package/dist/src/comment.d.ts.map +1 -0
  47. package/dist/src/connection.d.ts +52 -0
  48. package/dist/src/connection.d.ts.map +1 -0
  49. package/dist/src/context-menu.d.ts +76 -0
  50. package/dist/src/context-menu.d.ts.map +1 -0
  51. package/dist/src/coordinates.d.ts +52 -0
  52. package/dist/src/coordinates.d.ts.map +1 -0
  53. package/dist/src/core.d.ts +153 -0
  54. package/dist/src/core.d.ts.map +1 -0
  55. package/dist/src/ctx-menu-registry.d.ts +22 -0
  56. package/dist/src/ctx-menu-registry.d.ts.map +1 -0
  57. package/dist/src/dropdown-menu.d.ts +87 -0
  58. package/dist/src/dropdown-menu.d.ts.map +1 -0
  59. package/dist/src/field.d.ts +305 -0
  60. package/dist/src/field.d.ts.map +1 -0
  61. package/dist/src/flyout.d.ts +41 -0
  62. package/dist/src/flyout.d.ts.map +1 -0
  63. package/dist/src/fonts-manager.d.ts +6 -0
  64. package/dist/src/fonts-manager.d.ts.map +1 -0
  65. package/dist/src/grid.d.ts +60 -0
  66. package/dist/src/grid.d.ts.map +1 -0
  67. package/dist/src/headless-node.d.ts +11 -0
  68. package/dist/src/headless-node.d.ts.map +1 -0
  69. package/dist/src/index.d.ts +38 -0
  70. package/dist/src/index.d.ts.map +1 -0
  71. package/dist/src/inject-headless.d.ts +4 -0
  72. package/dist/src/inject-headless.d.ts.map +1 -0
  73. package/{src/inject.ts → dist/src/inject.d.ts} +142 -213
  74. package/dist/src/inject.d.ts.map +1 -0
  75. package/{src/main-workspace.ts → dist/src/main-workspace.d.ts} +31 -51
  76. package/dist/src/main-workspace.d.ts.map +1 -0
  77. package/dist/src/mutator.d.ts +2 -0
  78. package/dist/src/mutator.d.ts.map +1 -0
  79. package/{src/node-types.ts → dist/src/node-types.d.ts} +26 -27
  80. package/dist/src/node-types.d.ts.map +1 -0
  81. package/dist/src/nodesvg.d.ts +266 -0
  82. package/dist/src/nodesvg.d.ts.map +1 -0
  83. package/{src/prototypes.ts → dist/src/prototypes.d.ts} +10 -9
  84. package/dist/src/prototypes.d.ts.map +1 -0
  85. package/{src/renderer-map.ts → dist/src/renderer-map.d.ts} +51 -86
  86. package/dist/src/renderer-map.d.ts.map +1 -0
  87. package/dist/src/toolbox.d.ts +51 -0
  88. package/dist/src/toolbox.d.ts.map +1 -0
  89. package/{src/types.ts → dist/src/types.d.ts} +159 -205
  90. package/dist/src/types.d.ts.map +1 -0
  91. package/dist/src/undo-redo.d.ts +15 -0
  92. package/dist/src/undo-redo.d.ts.map +1 -0
  93. package/{src/visual-types.ts → dist/src/visual-types.d.ts} +34 -29
  94. package/dist/src/visual-types.d.ts.map +1 -0
  95. package/dist/src/widget-prototypes.d.ts +10 -0
  96. package/dist/src/widget-prototypes.d.ts.map +1 -0
  97. package/dist/src/widget.d.ts +62 -0
  98. package/dist/src/widget.d.ts.map +1 -0
  99. package/{src/workspace-coords.ts → dist/src/workspace-coords.d.ts} +10 -14
  100. package/dist/src/workspace-coords.d.ts.map +1 -0
  101. package/dist/src/workspace-svg.d.ts +371 -0
  102. package/dist/src/workspace-svg.d.ts.map +1 -0
  103. package/dist/src/workspace.d.ts +50 -0
  104. package/dist/src/workspace.d.ts.map +1 -0
  105. package/dist/themes/dark.d.ts +4 -0
  106. package/dist/themes/dark.d.ts.map +1 -0
  107. package/dist/themes/default.d.ts +4 -0
  108. package/dist/themes/default.d.ts.map +1 -0
  109. package/dist/themes/themes.d.ts +6 -0
  110. package/dist/themes/themes.d.ts.map +1 -0
  111. package/dist/util/emitter.d.ts +10 -0
  112. package/dist/util/emitter.d.ts.map +1 -0
  113. package/dist/util/env.d.ts +7 -0
  114. package/dist/util/env.d.ts.map +1 -0
  115. package/{util/escape-html.ts → dist/util/escape-html.d.ts} +16 -22
  116. package/dist/util/escape-html.d.ts.map +1 -0
  117. package/dist/util/eventer.d.ts +29 -0
  118. package/dist/util/eventer.d.ts.map +1 -0
  119. package/dist/util/has-prop.d.ts +2 -0
  120. package/dist/util/has-prop.d.ts.map +1 -0
  121. package/dist/util/parse-color.d.ts +6 -0
  122. package/dist/util/parse-color.d.ts.map +1 -0
  123. package/dist/util/path.d.ts +25 -0
  124. package/dist/util/path.d.ts.map +1 -0
  125. package/dist/util/styler.d.ts +12 -0
  126. package/dist/util/styler.d.ts.map +1 -0
  127. package/dist/util/uid.d.ts +42 -0
  128. package/dist/util/uid.d.ts.map +1 -0
  129. package/{util/unescape-html.ts → dist/util/unescape-html.d.ts} +16 -22
  130. package/dist/util/unescape-html.d.ts.map +1 -0
  131. package/dist/util/user-state.d.ts +37 -0
  132. package/dist/util/user-state.d.ts.map +1 -0
  133. package/{util/wait-anim-frames.ts → dist/util/wait-anim-frames.d.ts} +11 -24
  134. package/dist/util/wait-anim-frames.d.ts.map +1 -0
  135. package/dist/util/window-listeners.d.ts +8 -0
  136. package/dist/util/window-listeners.d.ts.map +1 -0
  137. package/package.json +4 -1
  138. package/(1.0.7)kabel.md +0 -18
  139. package/_READ_ME_MEDIA_/documentation/docs.md +0 -293
  140. package/_READ_ME_MEDIA_/workspace.png +0 -0
  141. package/comment-renderer/renderer.ts +0 -228
  142. package/controllers/base.ts +0 -186
  143. package/controllers/wasd.ts +0 -132
  144. package/docs/README.md +0 -98
  145. package/docs/_media/docs.md +0 -289
  146. package/docs/_media/workspace.png +0 -0
  147. package/docs/classes/CommentModel.md +0 -271
  148. package/docs/classes/CommentRenderer.md +0 -457
  149. package/docs/classes/ConnectableField.md +0 -597
  150. package/docs/classes/Connection.md +0 -191
  151. package/docs/classes/ContextMenuHTML.md +0 -163
  152. package/docs/classes/Coordinates.md +0 -187
  153. package/docs/classes/DropdownContainer.md +0 -300
  154. package/docs/classes/DummyField.md +0 -393
  155. package/docs/classes/Eventer.md +0 -185
  156. package/docs/classes/Field.md +0 -461
  157. package/docs/classes/InjectMsg.md +0 -85
  158. package/docs/classes/NodeSvg.md +0 -1011
  159. package/docs/classes/NumberField.md +0 -559
  160. package/docs/classes/OptConnectField.md +0 -624
  161. package/docs/classes/Renderer.md +0 -1636
  162. package/docs/classes/RendererConstants.md +0 -343
  163. package/docs/classes/Representer.md +0 -95
  164. package/docs/classes/RepresenterNode.md +0 -175
  165. package/docs/classes/TextField.md +0 -559
  166. package/docs/classes/Toolbox.md +0 -172
  167. package/docs/classes/WASDController.md +0 -616
  168. package/docs/classes/Widget.md +0 -195
  169. package/docs/classes/WorkspaceController.md +0 -385
  170. package/docs/classes/WorkspaceCoords.md +0 -218
  171. package/docs/classes/WorkspaceSvg.md +0 -1380
  172. package/docs/functions/clearMainWorkspace.md +0 -20
  173. package/docs/functions/getMainWorkspace.md +0 -19
  174. package/docs/functions/inject.md +0 -35
  175. package/docs/functions/setMainWorkspace.md +0 -28
  176. package/docs/globals.md +0 -95
  177. package/docs/interfaces/ColorStyle.md +0 -43
  178. package/docs/interfaces/ConnectorToFrom.md +0 -57
  179. package/docs/interfaces/DrawState.md +0 -81
  180. package/docs/interfaces/FieldConnectionData.md +0 -25
  181. package/docs/interfaces/FieldOptions.md +0 -63
  182. package/docs/interfaces/FieldRawBoxData.md +0 -25
  183. package/docs/interfaces/FieldVisualInfo.md +0 -65
  184. package/docs/interfaces/GridOptions.md +0 -61
  185. package/docs/interfaces/InjectOptions.md +0 -133
  186. package/docs/interfaces/InputFieldJson.md +0 -50
  187. package/docs/interfaces/KabelCommentRendering.md +0 -31
  188. package/docs/interfaces/KabelInterface.md +0 -469
  189. package/docs/interfaces/KabelNodeRendering.md +0 -77
  190. package/docs/interfaces/KabelUIX.md +0 -105
  191. package/docs/interfaces/KabelUtils.md +0 -215
  192. package/docs/interfaces/NodeEvents.md +0 -42
  193. package/docs/interfaces/NodeJson.md +0 -104
  194. package/docs/interfaces/NodePrototype.md +0 -82
  195. package/docs/interfaces/RegisteredEl.md +0 -53
  196. package/docs/interfaces/SerializedNode.md +0 -128
  197. package/docs/interfaces/TblxCategoryStruct.md +0 -41
  198. package/docs/interfaces/TblxFieldStruct.md +0 -28
  199. package/docs/interfaces/TblxNodeStruct.md +0 -35
  200. package/docs/interfaces/WidgetOptions.md +0 -115
  201. package/docs/interfaces/WidgetPrototypeList.md +0 -15
  202. package/docs/type-aliases/AnyField.md +0 -13
  203. package/docs/type-aliases/AnyFieldCls.md +0 -13
  204. package/docs/type-aliases/Color.md +0 -13
  205. package/docs/type-aliases/Connectable.md +0 -13
  206. package/docs/type-aliases/EventArgs.md +0 -11
  207. package/docs/type-aliases/EventSetupFn.md +0 -25
  208. package/docs/type-aliases/Hex.md +0 -13
  209. package/docs/type-aliases/RGBObject.md +0 -37
  210. package/docs/type-aliases/RGBString.md +0 -13
  211. package/docs/type-aliases/RGBTuple.md +0 -13
  212. package/docs/type-aliases/TblxObjStruct.md +0 -52
  213. package/docs/variables/CategoryColors.md +0 -29
  214. package/docs/variables/FieldMap.md +0 -41
  215. package/docs/variables/NodePrototypes.md +0 -18
  216. package/docs/variables/default.md +0 -11
  217. package/events/comment-drag-handle.ts +0 -61
  218. package/events/comment-input.ts +0 -291
  219. package/events/connection-line.ts +0 -68
  220. package/events/connector.ts +0 -116
  221. package/events/draggable.ts +0 -119
  222. package/events/input-box.ts +0 -213
  223. package/events/node-x-btn.ts +0 -25
  224. package/index.d.ts +0 -4
  225. package/renderers/apollo/apollo.ts +0 -21
  226. package/renderers/apollo/constants.ts +0 -40
  227. package/renderers/apollo/renderer.ts +0 -331
  228. package/renderers/constants.ts +0 -87
  229. package/renderers/renderer.ts +0 -1288
  230. package/renderers/representer-node.ts +0 -52
  231. package/renderers/representer.ts +0 -25
  232. package/src/category.ts +0 -107
  233. package/src/comment.ts +0 -142
  234. package/src/connection.ts +0 -114
  235. package/src/context-menu.ts +0 -194
  236. package/src/coordinates.ts +0 -74
  237. package/src/core.ts +0 -202
  238. package/src/ctx-menu-registry.ts +0 -143
  239. package/src/dropdown-menu.ts +0 -215
  240. package/src/field.ts +0 -595
  241. package/src/flyout.ts +0 -165
  242. package/src/fonts-manager.ts +0 -38
  243. package/src/grid.ts +0 -162
  244. package/src/headless-node.ts +0 -27
  245. package/src/index.ts +0 -115
  246. package/src/inject-headless.ts +0 -18
  247. package/src/mutator.ts +0 -40
  248. package/src/nodesvg.ts +0 -756
  249. package/src/styles.css +0 -224
  250. package/src/toolbox.ts +0 -125
  251. package/src/undo-redo.ts +0 -87
  252. package/src/widget-prototypes.ts +0 -11
  253. package/src/widget.ts +0 -139
  254. package/src/workspace-svg.ts +0 -736
  255. package/src/workspace.ts +0 -155
  256. package/test-server.js +0 -61
  257. package/themes/dark.ts +0 -32
  258. package/themes/default.ts +0 -28
  259. package/themes/themes.ts +0 -9
  260. package/tsconfig.json +0 -25
  261. package/typedoc.json +0 -10
  262. package/util/emitter.ts +0 -33
  263. package/util/env.ts +0 -11
  264. package/util/eventer.ts +0 -108
  265. package/util/has-prop.ts +0 -4
  266. package/util/parse-color.ts +0 -42
  267. package/util/path.ts +0 -99
  268. package/util/styler.ts +0 -41
  269. package/util/uid.ts +0 -184
  270. package/util/user-state.ts +0 -68
  271. package/util/window-listeners.ts +0 -62
  272. package/webpack.config.js +0 -80
  273. /package/{docs/_media → dist}/index.html +0 -0
@@ -1,289 +0,0 @@
1
-
2
- # Kabel Documentation
3
-
4
- **Kabel** is a node-based visual programming editor for building interactive, logic-driven UIs in the browser. It’s built around JavaScript and uses SVG for rendering. Kabel supports node creation, custom fields, widgets, toolboxes, and smooth workspace controls.
5
-
6
- ---
7
-
8
- ## Table of Contents
9
-
10
- 1. Getting Started
11
- 2. Setting Up Your First Workspace
12
- 3. Creating Your First Node Prototype
13
- 4. Creating a Toolbox
14
- 5. Manipulating Nodes
15
- 6. Serializing & Deserializing Nodes
16
- 7. Finishing Up
17
-
18
- ## In-depth Docs
19
- [Kabel API Documentation](../../docs/globals.md)
20
-
21
- ---
22
-
23
- ## 1. Getting Started
24
-
25
- You can include Kabel either via a script tag or import it as a module:
26
-
27
- ```html
28
- <script src="./kabel.js"></script>
29
- ```
30
-
31
- Once loaded:
32
-
33
- ```js
34
- if (typeof Kabel !== 'undefined') {
35
- console.log('Kabel is ready!');
36
- }
37
- ```
38
-
39
- That’s all you need to confirm it’s available before initializing a workspace.
40
-
41
- ---
42
-
43
- ## 2. Setting Up Your First Workspace
44
-
45
- The **workspace** is where nodes live and interact. Start by creating an HTML container:
46
-
47
- ```js
48
- const el = document.createElement('div');
49
- Object.assign(el.style, {
50
- width: '100vw',
51
- height: '100vh',
52
- background: '#f0f0f0'
53
- });
54
- document.body.appendChild(el);
55
- ```
56
-
57
- Then inject Kabel into that container:
58
-
59
- ```js
60
- const ws = Kabel.inject(el, {
61
- moveSpeed: 6,
62
- controls: {
63
- wasd: true,
64
- wasdSmooth: true,
65
- wasdAccelerate: 1,
66
- wasdFriction: 0.9
67
- },
68
- toolbox: { /* defined later */ }
69
- });
70
- ```
71
-
72
- This gives you a fullscreen workspace with smooth WASD movement controls.
73
-
74
- ---
75
-
76
- ## 3. Creating Your First Node Prototype
77
-
78
- Nodes are defined once as **prototypes** under `Kabel.Nodes`. Here’s an example:
79
-
80
- ```js
81
- Kabel.Nodes['my_node'] = {
82
- init() {
83
- this.jsonInit({
84
- previousConnection: true,
85
- nextConnection: true,
86
- labelText: 'TopbarText',
87
- type: 'my_node',
88
- primaryColor: '#cc0c00',
89
- tertiaryColor: '#660500',
90
- arguments: [
91
- { name: 'FLD', type: 'field_str', label: 'LabelText: ', value: 'ValueText' },
92
- { name: 'Dummy', type: 'field_dummy', label: 'Label with no input!' },
93
- { name: 'Conn', type: 'connection', label: 'Label!' },
94
- { name: 'Conn2', type: 'field_both', label: 'lowk: ', value: 'lowk' },
95
- {
96
- name: 'Dropdown',
97
- type: 'dropdown',
98
- label: 'lowk dropdown?: ',
99
- options: ['Oooo option', { text: 'Opt', value: 'opt' }]
100
- }
101
- ]
102
- });
103
- }
104
- };
105
- ```
106
-
107
- **Key options:**
108
-
109
- * `previousConnection` / `nextConnection` → Whether the node can chain with others.
110
- * `arguments` → Defines fields, inputs, and connection points.
111
- * `jsonInit()` → Initializes node configuration.
112
-
113
- ---
114
-
115
- ## 4. Creating a Toolbox
116
-
117
- Toolboxes organize your available nodes:
118
-
119
- ```js
120
- toolbox: {
121
- type: 'category',
122
- contents: [{
123
- name: 'Cat',
124
- color: '#cc0c00',
125
- contents: [{
126
- type: 'my_node',
127
- arguments: {}
128
- }]
129
- }]
130
- }
131
- ```
132
-
133
- **Toolbox types:**
134
-
135
- * `'category'` → Groups nodes visually into collapsible sections.
136
- * `'flyout'` → Displays all nodes in one scrollable list.
137
-
138
- **Category JSON fields:**
139
-
140
- * `name`: The category name.
141
- * `color`: The display color.
142
- * `contents`: Array of node definitions.
143
-
144
- > Currently, categories and flyouts can only contain nodes. Support for buttons or UI elements may be added later.
145
-
146
- ---
147
-
148
- ## 5. Manipulating Node Properties
149
-
150
- Once a node is created, you can move, modify, or connect it programmatically:
151
-
152
- ```js
153
- const node = new Kabel.NodeSvg(Kabel.Nodes['my_node'], ws);
154
- node.init();
155
-
156
- const node2 = new Kabel.NodeSvg(Kabel.Nodes['my_node'], ws);
157
- node2.init();
158
- node2.relativeCoords.set(20, 0);
159
- ```
160
-
161
- Connect them:
162
-
163
- ```js
164
- node.nextConnection.to = node2;
165
- node2.previousConnection.from = node;
166
- ws.redraw();
167
- ```
168
-
169
- You can also manipulate the SVG directly (temporary, not saved across rerenders):
170
-
171
- ```js
172
- node.svg.highlight('#ff0');
173
- node.svg.setScale(1);
174
- node.svg.moveTo(0, 1);
175
- node.svg.applyTransform('translate(0, 1)');
176
- node.svg.getRaw(); // Returns the svg.js G element
177
- ```
178
-
179
- ---
180
-
181
- ### Optional: Widgets
182
-
183
- **Widgets** are custom UI overlays within the workspace:
184
-
185
- ```js
186
- Kabel.Widgets['testWidget'] = {
187
- name: 'Test Widget',
188
- width: 150,
189
- height: 100,
190
- coords: new Kabel.Coordinates(50, 50),
191
- html: '<button id="counterBtn">Count: 0</button>',
192
- init(widget, container) {
193
- let count = 0;
194
- const btn = container.querySelector('#counterBtn');
195
- if (btn) {
196
- btn.addEventListener('click', () => {
197
- count++;
198
- btn.textContent = 'Count: ' + count;
199
- });
200
- }
201
- }
202
- };
203
-
204
- const myWidget = ws.newWidget('testWidget');
205
- if (myWidget) myWidget.show();
206
- ```
207
-
208
- Widgets let you add custom interactivity or information panels.
209
-
210
- ---
211
-
212
- ## 6. Serializing Nodes
213
-
214
- Kabel supports both **circular** and **non-circular** JSON serialization.
215
-
216
- ### Circular Serialization
217
-
218
- Contains live object references (not exportable as plain JSON, but usable within JS).
219
-
220
- ```js
221
- const circular = node.serialize();
222
- ```
223
-
224
- Example (simplified):
225
-
226
- ```json
227
- {
228
- "id": "sisDG24Gp6lc7*S#m#I9c",
229
- "type": "my_node",
230
- "nextConnection": {
231
- "node": "[CircularNodeRef]"
232
- },
233
- "fields": [...]
234
- }
235
- ```
236
-
237
- ---
238
-
239
- ### Non-Circular Serialization
240
-
241
- Safe for exporting or saving to files:
242
-
243
- ```js
244
- const nonCircular = node.toJson();
245
- ```
246
-
247
- Example:
248
-
249
- ```json
250
- {
251
- "7f7#2Rrt16uFuH^2f2^ad": {
252
- "id": "7f7#2Rrt16uFuH^2f2^ad",
253
- "type": "my_node",
254
- "colors": { "primary": "#cc0c00", "tertiary": "#660500" },
255
- "label": "TopbarText",
256
- "nextConnection": { "node": "jX^$kh)yHW5p^bx98vD#s" },
257
- "fields": [...]
258
- }
259
- }
260
- ```
261
-
262
- ---
263
-
264
- ### Workspace Serialization
265
-
266
- ```js
267
- // Serialize
268
- const data = workspace.toJson(false); // false = non-circular
269
-
270
- // Deserialize
271
- workspace.fromJson(data);
272
- ```
273
-
274
- The serialization format automatically includes the circular/non-circular flag internally.
275
-
276
- ---
277
-
278
- ## 7. Finishing Up
279
-
280
- You can expose internals for quick debugging:
281
-
282
- ```js
283
- window.ws = ws;
284
- window.nodes = [node, node2];
285
- ```
286
-
287
- That’s it — you now have a working Kabel workspace with nodes, a toolbox, and serialization support.
288
-
289
- ---
Binary file
@@ -1,271 +0,0 @@
1
- [**Kabel Project Docs v1.0.6**](../README.md)
2
-
3
- ***
4
-
5
- [Kabel Project Docs](../globals.md) / CommentModel
6
-
7
- # Class: CommentModel
8
-
9
- Defined in: [src/comment.ts:18](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L18)
10
-
11
- Represents a comment attached to either a NodeSvg or a WorkspaceSvg.
12
-
13
- ## Constructors
14
-
15
- ### Constructor
16
-
17
- > **new CommentModel**(`parent`): `CommentModel`
18
-
19
- Defined in: [src/comment.ts:47](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L47)
20
-
21
- Creates a new comment attached to a node or workspace.
22
-
23
- #### Parameters
24
-
25
- ##### parent
26
-
27
- NodeSvg or WorkspaceSvg this comment belongs to
28
-
29
- [`NodeSvg`](NodeSvg.md) | [`WorkspaceSvg`](WorkspaceSvg.md) | `Workspace`
30
-
31
- #### Returns
32
-
33
- `CommentModel`
34
-
35
- ## Properties
36
-
37
- ### \_isWorkspaceComment
38
-
39
- > **\_isWorkspaceComment**: `boolean`
40
-
41
- Defined in: [src/comment.ts:23](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L23)
42
-
43
- True if this comment belongs to the workspace instead of a node
44
-
45
- ***
46
-
47
- ### \_parent
48
-
49
- > **\_parent**: [`NodeSvg`](NodeSvg.md) \| [`WorkspaceSvg`](WorkspaceSvg.md) \| `Workspace`
50
-
51
- Defined in: [src/comment.ts:26](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L26)
52
-
53
- Parent NodeSvg or WorkspaceSvg to which this comment belongs
54
-
55
- ***
56
-
57
- ### \_tempInputBBox?
58
-
59
- > `optional` **\_tempInputBBox**: `object`
60
-
61
- Defined in: [src/comment.ts:38](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L38)
62
-
63
- Temporary bounding box info for input handling
64
-
65
- #### height
66
-
67
- > **height**: `number`
68
-
69
- #### textX
70
-
71
- > **textX**: `number`
72
-
73
- #### textY
74
-
75
- > **textY**: `number`
76
-
77
- #### width
78
-
79
- > **width**: `number`
80
-
81
- ***
82
-
83
- ### \_text
84
-
85
- > **\_text**: `string`
86
-
87
- Defined in: [src/comment.ts:20](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L20)
88
-
89
- The comment text
90
-
91
- ***
92
-
93
- ### id
94
-
95
- > **id**: `string`
96
-
97
- Defined in: [src/comment.ts:41](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L41)
98
-
99
- Unique identifier for this comment
100
-
101
- ***
102
-
103
- ### relativeCoords
104
-
105
- > **relativeCoords**: [`Coordinates`](Coordinates.md)
106
-
107
- Defined in: [src/comment.ts:32](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L32)
108
-
109
- Coordinates relative to parent
110
-
111
- ***
112
-
113
- ### svgGroup?
114
-
115
- > `optional` **svgGroup**: `G`
116
-
117
- Defined in: [src/comment.ts:29](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L29)
118
-
119
- SVG group representing this comment in the DOM
120
-
121
- ***
122
-
123
- ### svgLine?
124
-
125
- > `optional` **svgLine**: `Line`
126
-
127
- Defined in: [src/comment.ts:35](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L35)
128
-
129
- Optional SVG line connecting the comment to its node
130
-
131
- ## Methods
132
-
133
- ### getText()
134
-
135
- > **getText**(): `string`
136
-
137
- Defined in: [src/comment.ts:70](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L70)
138
-
139
- Retrieves the current text of the comment.
140
-
141
- #### Returns
142
-
143
- `string`
144
-
145
- The comment text
146
-
147
- ***
148
-
149
- ### getWorkspace()
150
-
151
- > **getWorkspace**(): [`WorkspaceSvg`](WorkspaceSvg.md)
152
-
153
- Defined in: [src/comment.ts:104](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L104)
154
-
155
- Gets the workspace that owns this comment.
156
-
157
- #### Returns
158
-
159
- [`WorkspaceSvg`](WorkspaceSvg.md)
160
-
161
- ***
162
-
163
- ### isNodeComment()
164
-
165
- > **isNodeComment**(): `boolean`
166
-
167
- Defined in: [src/comment.ts:90](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L90)
168
-
169
- Returns true if this comment is attached to a node.
170
-
171
- #### Returns
172
-
173
- `boolean`
174
-
175
- ***
176
-
177
- ### isWorkspaceComment()
178
-
179
- > **isWorkspaceComment**(): `boolean`
180
-
181
- Defined in: [src/comment.ts:97](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L97)
182
-
183
- Returns true if this comment is attached to the workspace.
184
-
185
- #### Returns
186
-
187
- `boolean`
188
-
189
- ***
190
-
191
- ### setText()
192
-
193
- > **setText**(`value`): `string`
194
-
195
- Defined in: [src/comment.ts:79](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L79)
196
-
197
- Sets the text of the comment and triggers a redraw of all comments in the workspace.
198
-
199
- #### Parameters
200
-
201
- ##### value
202
-
203
- `string`
204
-
205
- New text content
206
-
207
- #### Returns
208
-
209
- `string`
210
-
211
- The updated text
212
-
213
- ***
214
-
215
- ### setTextNoRedraw()
216
-
217
- > **setTextNoRedraw**(`value`): `string`
218
-
219
- Defined in: [src/comment.ts:62](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L62)
220
-
221
- Sets the text of the comment without triggering a comment redraw.
222
-
223
- #### Parameters
224
-
225
- ##### value
226
-
227
- `string`
228
-
229
- New text content
230
-
231
- #### Returns
232
-
233
- `string`
234
-
235
- The updated text
236
-
237
- ***
238
-
239
- ### toJson()
240
-
241
- > **toJson**(): `CommentSerialized`
242
-
243
- Defined in: [src/comment.ts:114](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L114)
244
-
245
- Convert to JSON structure holding all important data.
246
-
247
- #### Returns
248
-
249
- `CommentSerialized`
250
-
251
- ***
252
-
253
- ### fromJson()
254
-
255
- > `static` **fromJson**(`data`): `CommentModel`
256
-
257
- Defined in: [src/comment.ts:129](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L129)
258
-
259
- Creates a CommentModel from serialized data.
260
-
261
- #### Parameters
262
-
263
- ##### data
264
-
265
- `CommentSerialized`
266
-
267
- The serialized comment
268
-
269
- #### Returns
270
-
271
- `CommentModel`