@kabel-project/kabel 1.0.7 → 1.0.9

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 +5 -2
  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
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Strategy used to generate UIDs.
3
+ */
4
+ export type UIDStrategy = "uuidv4" | "ulid" | "nanoid" | "short";
5
+ export interface UIDOptions {
6
+ /** For "nanoid": length of the id (default 21) */
7
+ size?: number;
8
+ /** For "nanoid": custom alphabet (default URL-safe) */
9
+ alphabet?: string;
10
+ }
11
+ /**
12
+ * Generates an RFC4122-compliant UUID v4.
13
+ * Uses `crypto.randomUUID` if available.
14
+ *
15
+ * @returns {string} UUID v4 string.
16
+ */
17
+ export declare function uuidv4(): string;
18
+ /**
19
+ * Generates a 26-character ULID (time-sortable unique ID).
20
+ *
21
+ * @param {number} [date] - Optional timestamp in milliseconds. Defaults to `Date.now()`.
22
+ * @returns {string} ULID string.
23
+ */
24
+ export declare function ulid(date?: number): string;
25
+ /**
26
+ * Generates a NanoID-style string.
27
+ *
28
+ * @param {number} [size=21] - Length of the generated ID.
29
+ * @param {string} [alphabet=DEFAULT_ALPHABET] - Alphabet to use.
30
+ * @returns {string} Generated NanoID string.
31
+ */
32
+ export declare function nanoid(size?: number, alphabet?: string): string;
33
+ export declare function shortId(): string;
34
+ /**
35
+ * Generates a UID using the specified strategy.
36
+ *
37
+ * @param {UIDStrategy} [strategy="uuidv4"] - The UID strategy to use.
38
+ * @param {UIDOptions} [opts={}] - Options for the selected strategy.
39
+ * @returns {string} Generated UID.
40
+ */
41
+ export declare function generateUID(strategy?: UIDStrategy, opts?: UIDOptions): string;
42
+ //# sourceMappingURL=uid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uid.d.ts","sourceRoot":"","sources":["../../util/uid.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjE,MAAM,WAAW,UAAU;IACvB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAyBD;;;;;GAKG;AACH,wBAAgB,MAAM,IAAI,MAAM,CA0B/B;AAKD;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CA0C1C;AAKD;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,GAAE,MAAW,EAAE,QAAQ,GAAE,MAAyB,GAAG,MAAM,CAWrF;AASD,wBAAgB,OAAO,IAAI,MAAM,CAShC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,GAAE,WAAsB,EAAE,IAAI,GAAE,UAAe,GAAG,MAAM,CAW3F"}
@@ -1,22 +1,16 @@
1
- /**
2
- * Converts HTML-escaped characters in a string back to their literal form.
3
- *
4
- * Specifically, it replaces:
5
- * - `&lt;` with `<`
6
- * - `&gt;` with `>`
7
- * - `&quot;` with `"`
8
- * - `&apos;` with `'`
9
- * - `&amp;` with `&`
10
- *
11
- * @param {string} s - The string containing HTML-escaped characters.
12
- * @returns {string} The unescaped string with HTML entities replaced by their literal characters.
13
- */
14
- function unescapeAttr(s: string): string {
15
- return s.replace(/&lt;/g, "<")
16
- .replace(/&gt;/g, ">")
17
- .replace(/&quot;/g, '"')
18
- .replace(/&apos;/g, "'")
19
- .replace(/&amp;/g, "&");
20
- }
21
-
22
- export default unescapeAttr;
1
+ /**
2
+ * Converts HTML-escaped characters in a string back to their literal form.
3
+ *
4
+ * Specifically, it replaces:
5
+ * - `&lt;` with `<`
6
+ * - `&gt;` with `>`
7
+ * - `&quot;` with `"`
8
+ * - `&apos;` with `'`
9
+ * - `&amp;` with `&`
10
+ *
11
+ * @param {string} s - The string containing HTML-escaped characters.
12
+ * @returns {string} The unescaped string with HTML entities replaced by their literal characters.
13
+ */
14
+ declare function unescapeAttr(s: string): string;
15
+ export default unescapeAttr;
16
+ //# sourceMappingURL=unescape-html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unescape-html.d.ts","sourceRoot":"","sources":["../../util/unescape-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,iBAAS,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAMvC;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,37 @@
1
+ type StateChangeCallback = (addedOrRemoved: 0 | 1) => void;
2
+ declare class UserState {
3
+ private state;
4
+ private callbacks;
5
+ /**
6
+ * Stores the user's current UIX state
7
+ * Ex: 'typing'
8
+ */
9
+ constructor();
10
+ /**
11
+ * Adds a state
12
+ * @param name - The name of the state (ex: 'typing')
13
+ */
14
+ setState(name: string): void;
15
+ /**
16
+ * Removes a state
17
+ * @param name - The name of the state (ex: 'typing')
18
+ */
19
+ removeState(name: string): void;
20
+ /**
21
+ * Checks if a state is active
22
+ * @param name - The name of the state (ex: 'typing')
23
+ */
24
+ hasState(name: string): boolean;
25
+ /**
26
+ * Registers a callback for state changes
27
+ * @param name - Name of the state to check changes for.
28
+ * @param cb - Callback to call on state change.
29
+ */
30
+ onStateChange(name: string, cb: StateChangeCallback): void;
31
+ /** Internal: triggers callbacks for a state */
32
+ private triggerCallbacks;
33
+ }
34
+ declare const userState: UserState;
35
+ export default userState;
36
+ export { UserState };
37
+ //# sourceMappingURL=user-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-state.d.ts","sourceRoot":"","sources":["../../util/user-state.ts"],"names":[],"mappings":"AAAA,KAAK,mBAAmB,GAAG,CAAC,cAAc,EAAE,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAE3D,cAAM,SAAS;IACX,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,SAAS,CAAqC;IACtD;;;OAGG;;IAMH;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM;IAQrB;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM;IAQxB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM;IAIrB;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,mBAAmB;IAKnD,+CAA+C;IAC/C,OAAO,CAAC,gBAAgB;CAK3B;AACD,QAAA,MAAM,SAAS,WAAkB,CAAC;AAClC,eAAe,SAAS,CAAC;AACzB,OAAO,EACH,SAAS,EACZ,CAAC"}
@@ -1,24 +1,11 @@
1
- /**
2
- * Delays execution of a callback by a specified number of animation frames.
3
- *
4
- * Uses `requestAnimationFrame` to count frames, then calls the provided callback.
5
- *
6
- * @param {number} frames - The number of animation frames to wait before executing the callback.
7
- * @param {() => void} callback - The function to execute after the specified frames have passed.
8
- */
9
- function waitFrames(frames: number, callback: () => void): void {
10
- let count = 0;
11
-
12
- function step() {
13
- count++;
14
- if (count >= frames) {
15
- callback();
16
- } else {
17
- requestAnimationFrame(step);
18
- }
19
- }
20
-
21
- requestAnimationFrame(step);
22
- }
23
-
24
- export default waitFrames;
1
+ /**
2
+ * Delays execution of a callback by a specified number of animation frames.
3
+ *
4
+ * Uses `requestAnimationFrame` to count frames, then calls the provided callback.
5
+ *
6
+ * @param {number} frames - The number of animation frames to wait before executing the callback.
7
+ * @param {() => void} callback - The function to execute after the specified frames have passed.
8
+ */
9
+ declare function waitFrames(frames: number, callback: () => void): void;
10
+ export default waitFrames;
11
+ //# sourceMappingURL=wait-anim-frames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-anim-frames.d.ts","sourceRoot":"","sources":["../../util/wait-anim-frames.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,iBAAS,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAa9D;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ type WindowEventKeys = 'resize' | 'scroll' | 'blur' | 'focus' | 'visibilitychange' | 'pointerlockchange' | 'beforeunload';
2
+ type WindowListenersMap = Record<WindowEventKeys, Array<(event: Event) => void>>;
3
+ declare const windowListeners: WindowListenersMap;
4
+ export declare function addWindowListener(type: WindowEventKeys, fn: (event: Event) => void): void;
5
+ export declare function removeWindowListener(type: WindowEventKeys, fn: (event: Event) => void): void;
6
+ export declare function clearWindowListeners(type?: WindowEventKeys): void;
7
+ export default windowListeners;
8
+ //# sourceMappingURL=window-listeners.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window-listeners.d.ts","sourceRoot":"","sources":["../../util/window-listeners.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GACjB,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,kBAAkB,GAClB,mBAAmB,GACnB,cAAc,CAAC;AAElB,KAAK,kBAAkB,GAAG,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC;AAEjF,QAAA,MAAM,eAAe,EAAE,kBAQtB,CAAC;AAmBF,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,eAAe,EACrB,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,QAG1B;AAED,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,eAAe,EACrB,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,QAK1B;AAED,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,eAAe,QAK1D;AAED,eAAe,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kabel-project/kabel",
3
- "version": "1.0.7",
4
- "main": "index.js",
3
+ "version": "1.0.9",
4
+ "main": "dist/kabel.js",
5
5
  "scripts": {
6
6
  "test": "node test-server.js",
7
7
  "build": "npx webpack",
@@ -16,6 +16,9 @@
16
16
  "node",
17
17
  "graph"
18
18
  ],
19
+ "files": [
20
+ "dist"
21
+ ],
19
22
  "repository": "https://github.com/FentFentFent/Kabel",
20
23
  "author": "fentiefentfent",
21
24
  "license": "ISC",
package/(1.0.7)kabel.md DELETED
@@ -1,18 +0,0 @@
1
- **chore(release): Kabel 1.0.6 release**
2
- - Implemented the Apollo renderer, a renderer that tries to match the "sticky note" style of other blueprint interfaces.
3
- - Added shadow FX to default renderer.
4
- - Added background pattern system under wsSvg.grid, options in Kabel.inject for grid added as well.
5
- - Created new /themes folder, created dark and classic (Default) themes, added theme options to inject.
6
- - Fixed input boxes (comment, raw field) so that when you click at a specific point, the caret starts there.
7
- - Decided that where you click within a comment input is where it should start editing at.
8
- - Added wsSvg.dragState to store information about the current block being dragged.
9
- - Cleaned up the Flyout class to break up large methods into multiple. This makes extensions easier.
10
- - Implemented headless inject method along with the WorkspaceSVG's headless counterpart class. (Creating simulated workspaces)
11
- - Cleaned up renderer which was in preparation for the second default renderer.
12
- - Added full JSDoc comments to renderer for cleanliness and maintainability.
13
- - Cleaned up comment renderer for easier subclassing.
14
- - Removed two useless frame-waits in WorkspaceSVG class.
15
-
16
-
17
- **chore(release): Kabel 1.0.7 release**
18
- - Very minor documentation update.
@@ -1,293 +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
- theme: 'Dark',
62
- renderer: 'atlas', // Or `Apollo`
63
- moveSpeed: 6,
64
- controls: {
65
- wasd: true,
66
- wasdSmooth: true,
67
- wasdAccelerate: 1,
68
- wasdFriction: 0.9
69
- },
70
- toolbox: { /* defined later */ }
71
- });
72
- ```
73
-
74
- This gives you a fullscreen workspace with smooth WASD movement controls.
75
-
76
- ---
77
-
78
- ## 3. Creating Your First Node Prototype
79
-
80
- Nodes are defined once as **prototypes** under `Kabel.Nodes`. Here’s an example:
81
-
82
- ```js
83
- Kabel.Nodes['my_node'] = {
84
- init() {
85
- this.jsonInit({
86
- previousConnection: true,
87
- nextConnection: true,
88
- labelText: 'TopbarText',
89
- type: 'my_node',
90
- primaryColor: '#cc0c00',
91
- tertiaryColor: '#660500',
92
- arguments: [
93
- { name: 'FLD', type: 'field_str', label: 'LabelText: ', value: 'ValueText' },
94
- { name: 'Dummy', type: 'field_dummy', label: 'Label with no input!' },
95
- { name: 'Conn', type: 'connection', label: 'Label!' },
96
- { name: 'Conn2', type: 'field_both', label: 'lowk: ', value: 'lowk' },
97
- {
98
- name: 'Dropdown',
99
- type: 'dropdown',
100
- label: 'lowk dropdown?: ',
101
- options: ['Oooo option', { text: 'Opt', value: 'opt' }]
102
- }
103
- ]
104
- });
105
- }
106
- };
107
- ```
108
-
109
- **Key options:**
110
-
111
- * `previousConnection` / `nextConnection` → Whether the node can chain with others.
112
- * `arguments` → Defines fields, inputs, and connection points.
113
- * `jsonInit()` → Initializes node configuration.
114
-
115
- ---
116
-
117
- ## 4. Creating a Toolbox
118
-
119
- Toolboxes organize your available nodes:
120
-
121
- ```js
122
- toolbox: {
123
- type: 'category',
124
- contents: [{
125
- name: 'Cat',
126
- color: '#cc0c00',
127
- contents: [{
128
- type: 'my_node',
129
- arguments: {
130
- //FIELD_NAME: FIELD_VALUE
131
- }
132
- }]
133
- }]
134
- }
135
- ```
136
-
137
- **Toolbox types:**
138
-
139
- * `'category'` → Groups nodes visually into collapsible sections.
140
- * `'flyout'` → Displays all nodes in one scrollable list.
141
-
142
- **Category JSON fields:**
143
-
144
- * `name`: The category name.
145
- * `color`: The display color.
146
- * `contents`: Array of node definitions.
147
-
148
- > Currently, categories and flyouts can only contain nodes. Support for buttons or UI elements may be added later.
149
-
150
- ---
151
-
152
- ## 5. Manipulating Node Properties
153
-
154
- Once a node is created, you can move, modify, or connect it programmatically:
155
-
156
- ```js
157
- const node = new Kabel.NodeSvg(Kabel.Nodes['my_node'], ws);
158
- node.init();
159
-
160
- const node2 = new Kabel.NodeSvg(Kabel.Nodes['my_node'], ws);
161
- node2.init();
162
- node2.relativeCoords.set(20, 0);
163
- ```
164
-
165
- Connect them:
166
-
167
- ```js
168
- node.nextConnection.to = node2;
169
- node2.previousConnection.from = node;
170
- ws.redraw();
171
- ```
172
-
173
- You can also manipulate the SVG directly (temporary, not saved across rerenders):
174
-
175
- ```js
176
- node.svg.highlight('#ff0');
177
- node.svg.setScale(1);
178
- node.svg.moveTo(0, 1);
179
- node.svg.applyTransform('translate(0, 1)');
180
- node.svg.getRaw(); // Returns the svg.js G element
181
- ```
182
-
183
- ---
184
-
185
- ### Optional: Widgets
186
-
187
- **Widgets** are custom UI overlays within the workspace:
188
-
189
- ```js
190
- Kabel.Widgets['testWidget'] = {
191
- name: 'Test Widget',
192
- width: 150,
193
- height: 100,
194
- coords: new Kabel.Coordinates(50, 50),
195
- html: '<button id="counterBtn">Count: 0</button>',
196
- init(widget, container) {
197
- let count = 0;
198
- const btn = container.querySelector('#counterBtn');
199
- if (btn) {
200
- btn.addEventListener('click', () => {
201
- count++;
202
- btn.textContent = 'Count: ' + count;
203
- });
204
- }
205
- }
206
- };
207
-
208
- const myWidget = ws.newWidget('testWidget');
209
- if (myWidget) myWidget.show();
210
- ```
211
-
212
- Widgets let you add custom interactivity or information panels.
213
-
214
- ---
215
-
216
- ## 6. Serializing Nodes
217
-
218
- Kabel supports both **circular** and **non-circular** JSON serialization.
219
-
220
- ### Circular Serialization
221
-
222
- Contains live object references (not exportable as plain JSON, but usable within JS).
223
-
224
- ```js
225
- const circular = node.serialize();
226
- ```
227
-
228
- Example (simplified):
229
-
230
- ```json
231
- {
232
- "id": "sisDG24Gp6lc7*S#m#I9c",
233
- "type": "my_node",
234
- "nextConnection": {
235
- "node": "[CircularNodeRef]"
236
- },
237
- "fields": [...]
238
- }
239
- ```
240
-
241
- ---
242
-
243
- ### Non-Circular Serialization
244
-
245
- Safe for exporting or saving to files:
246
-
247
- ```js
248
- const nonCircular = node.toJson();
249
- ```
250
-
251
- Example:
252
-
253
- ```json
254
- {
255
- "7f7#2Rrt16uFuH^2f2^ad": {
256
- "id": "7f7#2Rrt16uFuH^2f2^ad",
257
- "type": "my_node",
258
- "colors": { "primary": "#cc0c00", "tertiary": "#660500" },
259
- "label": "TopbarText",
260
- "nextConnection": { "node": "jX^$kh)yHW5p^bx98vD#s" },
261
- "fields": [...]
262
- }
263
- }
264
- ```
265
-
266
- ---
267
-
268
- ### Workspace Serialization
269
-
270
- ```js
271
- // Serialize
272
- const data = workspace.toJson(false); // false = non-circular
273
-
274
- // Deserialize
275
- workspace.fromJson(data);
276
- ```
277
-
278
- The serialization format automatically includes the circular/non-circular flag internally.
279
-
280
- ---
281
-
282
- ## 7. Finishing Up
283
-
284
- You can expose internals for quick debugging:
285
-
286
- ```js
287
- window.ws = ws;
288
- window.nodes = [node, node2];
289
- ```
290
-
291
- That’s it — you now have a working Kabel workspace with nodes, a toolbox, and serialization support.
292
-
293
- ---
Binary file