@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.
Files changed (152) hide show
  1. package/(1.0.7)kabel.md +18 -0
  2. package/README.md +96 -0
  3. package/_READ_ME_MEDIA_/documentation/docs.md +293 -0
  4. package/_READ_ME_MEDIA_/workspace.png +0 -0
  5. package/comment-renderer/renderer.ts +228 -0
  6. package/controllers/base.ts +186 -0
  7. package/controllers/wasd.ts +132 -0
  8. package/docs/README.md +98 -0
  9. package/docs/_media/docs.md +289 -0
  10. package/docs/_media/index.html +168 -0
  11. package/docs/_media/workspace.png +0 -0
  12. package/docs/classes/CommentModel.md +271 -0
  13. package/docs/classes/CommentRenderer.md +457 -0
  14. package/docs/classes/ConnectableField.md +597 -0
  15. package/docs/classes/Connection.md +191 -0
  16. package/docs/classes/ContextMenuHTML.md +163 -0
  17. package/docs/classes/Coordinates.md +187 -0
  18. package/docs/classes/DropdownContainer.md +300 -0
  19. package/docs/classes/DummyField.md +393 -0
  20. package/docs/classes/Eventer.md +185 -0
  21. package/docs/classes/Field.md +461 -0
  22. package/docs/classes/InjectMsg.md +85 -0
  23. package/docs/classes/NodeSvg.md +1011 -0
  24. package/docs/classes/NumberField.md +559 -0
  25. package/docs/classes/OptConnectField.md +624 -0
  26. package/docs/classes/Renderer.md +1636 -0
  27. package/docs/classes/RendererConstants.md +343 -0
  28. package/docs/classes/Representer.md +95 -0
  29. package/docs/classes/RepresenterNode.md +175 -0
  30. package/docs/classes/TextField.md +559 -0
  31. package/docs/classes/Toolbox.md +172 -0
  32. package/docs/classes/WASDController.md +616 -0
  33. package/docs/classes/Widget.md +195 -0
  34. package/docs/classes/WorkspaceController.md +385 -0
  35. package/docs/classes/WorkspaceCoords.md +218 -0
  36. package/docs/classes/WorkspaceSvg.md +1380 -0
  37. package/docs/functions/clearMainWorkspace.md +20 -0
  38. package/docs/functions/getMainWorkspace.md +19 -0
  39. package/docs/functions/inject.md +35 -0
  40. package/docs/functions/setMainWorkspace.md +28 -0
  41. package/docs/globals.md +95 -0
  42. package/docs/interfaces/ColorStyle.md +43 -0
  43. package/docs/interfaces/ConnectorToFrom.md +57 -0
  44. package/docs/interfaces/DrawState.md +81 -0
  45. package/docs/interfaces/FieldConnectionData.md +25 -0
  46. package/docs/interfaces/FieldOptions.md +63 -0
  47. package/docs/interfaces/FieldRawBoxData.md +25 -0
  48. package/docs/interfaces/FieldVisualInfo.md +65 -0
  49. package/docs/interfaces/GridOptions.md +61 -0
  50. package/docs/interfaces/InjectOptions.md +133 -0
  51. package/docs/interfaces/InputFieldJson.md +50 -0
  52. package/docs/interfaces/KabelCommentRendering.md +31 -0
  53. package/docs/interfaces/KabelInterface.md +469 -0
  54. package/docs/interfaces/KabelNodeRendering.md +77 -0
  55. package/docs/interfaces/KabelUIX.md +105 -0
  56. package/docs/interfaces/KabelUtils.md +215 -0
  57. package/docs/interfaces/NodeEvents.md +42 -0
  58. package/docs/interfaces/NodeJson.md +104 -0
  59. package/docs/interfaces/NodePrototype.md +82 -0
  60. package/docs/interfaces/RegisteredEl.md +53 -0
  61. package/docs/interfaces/SerializedNode.md +128 -0
  62. package/docs/interfaces/TblxCategoryStruct.md +41 -0
  63. package/docs/interfaces/TblxFieldStruct.md +28 -0
  64. package/docs/interfaces/TblxNodeStruct.md +35 -0
  65. package/docs/interfaces/WidgetOptions.md +115 -0
  66. package/docs/interfaces/WidgetPrototypeList.md +15 -0
  67. package/docs/type-aliases/AnyField.md +13 -0
  68. package/docs/type-aliases/AnyFieldCls.md +13 -0
  69. package/docs/type-aliases/Color.md +13 -0
  70. package/docs/type-aliases/Connectable.md +13 -0
  71. package/docs/type-aliases/EventArgs.md +11 -0
  72. package/docs/type-aliases/EventSetupFn.md +25 -0
  73. package/docs/type-aliases/Hex.md +13 -0
  74. package/docs/type-aliases/RGBObject.md +37 -0
  75. package/docs/type-aliases/RGBString.md +13 -0
  76. package/docs/type-aliases/RGBTuple.md +13 -0
  77. package/docs/type-aliases/TblxObjStruct.md +52 -0
  78. package/docs/variables/CategoryColors.md +29 -0
  79. package/docs/variables/FieldMap.md +41 -0
  80. package/docs/variables/NodePrototypes.md +18 -0
  81. package/docs/variables/default.md +11 -0
  82. package/events/comment-drag-handle.ts +61 -0
  83. package/events/comment-input.ts +291 -0
  84. package/events/connection-line.ts +68 -0
  85. package/events/connector.ts +116 -0
  86. package/events/draggable.ts +119 -0
  87. package/events/events.ts +7 -0
  88. package/events/input-box.ts +213 -0
  89. package/events/node-x-btn.ts +25 -0
  90. package/index.d.ts +4 -0
  91. package/package.json +49 -0
  92. package/renderers/apollo/apollo.ts +21 -0
  93. package/renderers/apollo/constants.ts +40 -0
  94. package/renderers/apollo/renderer.ts +331 -0
  95. package/renderers/atlas/atlas.ts +15 -0
  96. package/renderers/constants.ts +87 -0
  97. package/renderers/renderer.ts +1288 -0
  98. package/renderers/representer-node.ts +52 -0
  99. package/renderers/representer.ts +25 -0
  100. package/src/category.ts +107 -0
  101. package/src/colors.ts +20 -0
  102. package/src/comment.ts +142 -0
  103. package/src/connection.ts +114 -0
  104. package/src/context-menu.ts +194 -0
  105. package/src/coordinates.ts +74 -0
  106. package/src/core.ts +202 -0
  107. package/src/ctx-menu-registry.ts +143 -0
  108. package/src/dropdown-menu.ts +215 -0
  109. package/src/field.ts +595 -0
  110. package/src/flyout.ts +165 -0
  111. package/src/fonts-manager.ts +38 -0
  112. package/src/grid.ts +162 -0
  113. package/src/headless-node.ts +27 -0
  114. package/src/index.ts +115 -0
  115. package/src/inject-headless.ts +18 -0
  116. package/src/inject.ts +213 -0
  117. package/src/main-workspace.ts +51 -0
  118. package/src/mutator.ts +40 -0
  119. package/src/node-types.ts +27 -0
  120. package/src/nodesvg.ts +756 -0
  121. package/src/prototypes.ts +9 -0
  122. package/src/renderer-map.ts +86 -0
  123. package/src/styles.css +224 -0
  124. package/src/toolbox.ts +125 -0
  125. package/src/types.ts +205 -0
  126. package/src/undo-redo.ts +87 -0
  127. package/src/visual-types.ts +29 -0
  128. package/src/widget-prototypes.ts +11 -0
  129. package/src/widget.ts +139 -0
  130. package/src/workspace-coords.ts +14 -0
  131. package/src/workspace-svg.ts +736 -0
  132. package/src/workspace.ts +155 -0
  133. package/test-server.js +61 -0
  134. package/themes/dark.ts +32 -0
  135. package/themes/default.ts +28 -0
  136. package/themes/themes.ts +9 -0
  137. package/tsconfig.json +25 -0
  138. package/typedoc.json +10 -0
  139. package/util/emitter.ts +33 -0
  140. package/util/env.ts +11 -0
  141. package/util/escape-html.ts +22 -0
  142. package/util/eventer.ts +108 -0
  143. package/util/has-prop.ts +4 -0
  144. package/util/parse-color.ts +42 -0
  145. package/util/path.ts +99 -0
  146. package/util/styler.ts +41 -0
  147. package/util/uid.ts +184 -0
  148. package/util/unescape-html.ts +22 -0
  149. package/util/user-state.ts +68 -0
  150. package/util/wait-anim-frames.ts +24 -0
  151. package/util/window-listeners.ts +62 -0
  152. package/webpack.config.js +80 -0
@@ -0,0 +1,9 @@
1
+ import { NodePrototype } from "./node-types";
2
+
3
+ /**
4
+ * A registry of all node prototypes by name.
5
+ * Maps a string key (node type name) to a NodePrototype object
6
+ */
7
+ const NodePrototypes: { [key: string]: NodePrototype } = {};
8
+
9
+ export default NodePrototypes;
@@ -0,0 +1,86 @@
1
+ import type RendererType from "../renderers/renderer";
2
+ import Renderer from "../renderers/renderer";
3
+ /**
4
+ * Interface for the renderer map.
5
+ * Maps a string key (renderer name) to a renderer class.
6
+ */
7
+ interface RendererMapInterface {
8
+ [key: string]: typeof RendererType;
9
+ }
10
+
11
+ // Top-level renderer map storage
12
+ const RendererMap: RendererMapInterface = {};
13
+
14
+ /**
15
+ * Class for managing registered renderer classes.
16
+ * Provides methods to register, delete, get, list, and resolve renderers.
17
+ */
18
+ class RMap {
19
+ /**
20
+ * Registers a renderer class under a given name.
21
+ * @param RendererCls The renderer class to register
22
+ * @param optName Optional name to register under. Defaults to `RendererCls.NAME`
23
+ */
24
+ static register(RendererCls: typeof RendererType, optName?: string) {
25
+ const name = optName ?? RendererCls.NAME;
26
+ RendererMap[name] = RendererCls;
27
+ }
28
+
29
+ /**
30
+ * Deletes a renderer from the map by name.
31
+ * Cannot delete the "default" renderer.
32
+ * @param name The name of the renderer to delete
33
+ * @returns `true` if deleted, `false` otherwise
34
+ */
35
+ static delete(name: string) {
36
+ if (name === 'default') return false;
37
+ if (RendererMap[name]) {
38
+ delete RendererMap[name];
39
+ return true;
40
+ }
41
+ return false;
42
+ }
43
+
44
+ /**
45
+ * Retrieves a renderer class by name.
46
+ * Returns the default renderer if the name is not found.
47
+ * @param name The name of the renderer to get
48
+ * @returns The renderer class
49
+ */
50
+ static get(name: string): typeof RendererType {
51
+ const Renderer = require("../renderers/renderer").default as typeof RendererType;
52
+ return RendererMap[name] ?? RendererMap['default'] ?? Renderer;
53
+ }
54
+
55
+ /**
56
+ * Lists all registered renderer names.
57
+ * @returns Array of registered renderer names
58
+ */
59
+ static list() {
60
+ return Object.keys(RendererMap);
61
+ }
62
+
63
+ /**
64
+ * Resolves input into a renderer class.
65
+ * - If `input` is undefined, returns the default renderer
66
+ * - If `input` is a string, returns the renderer with that name
67
+ * - If `input` is a class, returns the class itself
68
+ * @param input Optional renderer name or class
69
+ * @returns Renderer class
70
+ */
71
+ static resolve(input?: string | typeof RendererType): typeof RendererType {
72
+ const Renderer = require("../renderers/renderer").default as typeof RendererType;
73
+
74
+ if (!input) return RendererMap['default'] ?? Renderer;
75
+
76
+ if (typeof input === 'string') return RMap.get(input);
77
+
78
+ if (typeof input === 'function') return input as typeof RendererType;
79
+
80
+ return RendererMap['default'] ?? Renderer;
81
+ }
82
+ }
83
+
84
+ // Default renderers registered in core.ts
85
+
86
+ export { RMap, RendererMap };
package/src/styles.css ADDED
@@ -0,0 +1,224 @@
1
+ /* Workspace wrapper: horizontal layout */
2
+ .KabelWorkspaceWrapper {
3
+ display: flex;
4
+ flex-direction: row;
5
+ width: 100%;
6
+ height: 100%;
7
+ background: #f0f0f0;
8
+ /* light gray background */
9
+ overflow: hidden;
10
+ position: relative;
11
+ }
12
+
13
+ /* Toolbox panel (left) */
14
+ .KabelToolbox {
15
+ width: 12%;
16
+ min-width: 150px;
17
+ height: 100%;
18
+ background: rgba(240, 240, 240, 0.95);
19
+ border-right: 1px solid #ccc;
20
+ box-sizing: border-box;
21
+ display: flex;
22
+ flex-direction: column;
23
+ padding: 8px;
24
+ overflow-y: auto;
25
+ }
26
+
27
+ /* Context menu container */
28
+ .KabelContextMenu {
29
+ position: absolute;
30
+ background: #1e1e2f;
31
+ color: #000000;
32
+ border-radius: 6px;
33
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
34
+ padding: 4px 0;
35
+ font-family: 'Segoe UI', sans-serif;
36
+ font-size: 14px;
37
+ min-width: 160px;
38
+ z-index: 9999;
39
+ user-select: none;
40
+ overflow: visible;
41
+ height: auto;
42
+ transition: opacity 0.15s ease, transform 0.15s ease;
43
+ opacity: 0;
44
+ transform: scale(0.95);
45
+ display: flex;
46
+ flex-direction: column;
47
+ }
48
+
49
+ /* Show state */
50
+ .KabelContextMenu.show {
51
+ opacity: 1;
52
+ transform: scale(1);
53
+ }
54
+
55
+ /* Individual option */
56
+ .KabelContextOption {
57
+ padding: 8px 16px;
58
+ cursor: pointer;
59
+ transition: background 0.15s ease, color 0.15s ease;
60
+ }
61
+ .KabelContextOption:hover {
62
+ background: #b0adb0;
63
+ color: #fff;
64
+ }
65
+ .KabelContextOption.disabled {
66
+ opacity: 0.35;
67
+ cursor: not-allowed;
68
+ color: #777; /* dim it so it's obviously off */
69
+ background: transparent;
70
+ pointer-events: none;
71
+ }
72
+
73
+ /* make sure hover never triggers visually */
74
+ .KabelContextOption.disabled:hover {
75
+ background: transparent;
76
+ color: #777;
77
+ }
78
+
79
+ /* Optional: active click effect */
80
+ .KabelContextOption:active {
81
+ background: #fff;
82
+ color: #000;
83
+ }
84
+
85
+ /* Scrollbar if too many options */
86
+ .KabelContextMenu::-webkit-scrollbar {
87
+ width: 6px;
88
+ }
89
+
90
+ .KabelContextMenu::-webkit-scrollbar-thumb {
91
+ background: rgba(255, 255, 255, 0.2);
92
+ border-radius: 3px;
93
+ }
94
+
95
+ /* Category buttons */
96
+
97
+ .KabelCategoryRow {
98
+ background: #fff;
99
+ border: 1px solid #ccc;
100
+ padding: 4px 8px;
101
+ margin-bottom: 4px;
102
+ border-radius: 4px;
103
+ height: 5%;
104
+ padding: 6px;
105
+ cursor: pointer;
106
+ text-align: left;
107
+ transition: background 0.2s, color 0.2s;
108
+ }
109
+
110
+ .KabelToolbox button:hover {
111
+ background: #e6e6e6;
112
+ color: #333;
113
+ }
114
+
115
+ .KabelConnectionBubbleHighlight {
116
+ stroke: yellow !important;
117
+ stroke-width: 6px !important;
118
+ stroke-linejoin: round;
119
+ stroke-linecap: round;
120
+ filter: drop-shadow(0 0 6px rgba(255, 255, 0, 0.9));
121
+ }
122
+
123
+ .KabelConnectionBubbleHighlightWrong {
124
+ stroke: rgb(255, 0, 0) !important;
125
+ stroke-width: 6px !important;
126
+ stroke-linejoin: round;
127
+ stroke-linecap: round;
128
+ filter: drop-shadow(0 0 6px rgba(255, 0, 0, 0.9));
129
+ }
130
+
131
+ /* Container */
132
+ .KabelDropdownMenu {
133
+ position: absolute;
134
+ display: none;
135
+ background: #1e1e1e;
136
+ color: #f0f0f0;
137
+ font-family: sans-serif;
138
+ font-size: 14px;
139
+ border: 1px solid #333;
140
+ border-radius: 6px;
141
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
142
+ padding: 4px 0;
143
+ z-index: 9999;
144
+ user-select: none;
145
+ animation: fadeIn 0.15s ease-out;
146
+ }
147
+
148
+ /* Dropdown items */
149
+ .KabelDropdownItem {
150
+ padding: 6px 12px;
151
+ cursor: pointer;
152
+ transition: background 0.15s;
153
+ }
154
+
155
+ /* Hover + focus states */
156
+ .KabelDropdownItem:hover,
157
+ .KabelDropdownItem:focus {
158
+ background: #2d2d2d;
159
+ }
160
+
161
+ /* Active (clicked) state */
162
+ .KabelDropdownItem:active {
163
+ background: #3a3a3a;
164
+ }
165
+
166
+ /* Optional: highlight selected value */
167
+ .KabelDropdownItem.selected {
168
+ background: #444;
169
+ font-weight: 600;
170
+ }
171
+
172
+ /* Smooth open effect */
173
+ @keyframes fadeIn {
174
+ from {
175
+ opacity: 0;
176
+ transform: translateY(-3px);
177
+ }
178
+
179
+ to {
180
+ opacity: 1;
181
+ transform: translateY(0);
182
+ }
183
+ }
184
+
185
+
186
+
187
+ /* Flyout panel (right) */
188
+ .KabelFlyout {
189
+ width: 20%;
190
+ height: 100%;
191
+ background: rgba(255, 255, 255, 0.95);
192
+ border-left: 1px solid #ccc;
193
+ box-sizing: border-box;
194
+ overflow-y: auto;
195
+ position: relative;
196
+ /* for absolute positioning of nodes inside */
197
+ display: none;
198
+ /* hidden by default */
199
+ padding: 8px;
200
+ }
201
+
202
+ /* Flyout nodes */
203
+ .KabelFlyoutNode {
204
+ padding: 6px 10px;
205
+ margin-bottom: 4px;
206
+ border-radius: 4px;
207
+ cursor: pointer;
208
+ user-select: none;
209
+ transition: background 0.2s;
210
+ }
211
+
212
+ .KabelFlyoutNode:hover {
213
+ background: #e0e0e0;
214
+ }
215
+
216
+ /* SVG workspace area */
217
+ .KabelWorkspaceWrapper svg {
218
+ flex: 1;
219
+ width: 100%;
220
+ height: 100%;
221
+ background: #fff;
222
+ /* white canvas background */
223
+ display: block;
224
+ }
package/src/toolbox.ts ADDED
@@ -0,0 +1,125 @@
1
+ import Flyout from "./flyout";
2
+ import { InjectOptions, TblxCategoryStruct, TblxNodeStruct } from "./inject";
3
+ import WorkspaceSvg, { WSTheme } from "./workspace-svg";
4
+ import Category from "./category";
5
+
6
+ /**
7
+ * Represents the toolbox in a Kabel workspace.
8
+ * The toolbox can be either a flyout or a category-based toolbox.
9
+ */
10
+ class Toolbox {
11
+ /** Toolbox type: 1 = category toolbox, 2 = flyout toolbox */
12
+ type: 1 | 2;
13
+
14
+ /** Reference to the workspace this toolbox belongs to */
15
+ workspace: WorkspaceSvg;
16
+
17
+ /** Workspace options for initialization */
18
+ wsOptions: InjectOptions;
19
+
20
+ /** Flyout instance for node display */
21
+ _flyout: Flyout;
22
+
23
+ /** Contents of the toolbox (nodes or categories) */
24
+ _contents: TblxNodeStruct[] | TblxCategoryStruct[];
25
+
26
+ /** DOM container element for the toolbox */
27
+ container: HTMLDivElement;
28
+
29
+ /** List of categories (if using a category toolbox) */
30
+ _categories: Category[] = [];
31
+
32
+ /**
33
+ * Creates a new Toolbox instance attached to a workspace.
34
+ * @param workspace The workspace instance to attach this toolbox to
35
+ */
36
+ constructor(workspace: WorkspaceSvg) {
37
+ this.workspace = workspace;
38
+ this.wsOptions = this.getOptions();
39
+ this.type = this.wsOptions.toolbox?.type == "flyout" ? 2 : 1;
40
+ this._contents = this.wsOptions.toolbox?.contents ?? [];
41
+
42
+ // Pass toolbox reference to flyout
43
+ this._flyout = new Flyout(this);
44
+
45
+ // Create container element
46
+ this.container = document.createElement("div");
47
+ this.container.className = "KabelToolbox";
48
+ this.container.style.position = "absolute";
49
+ this.container.style.left = "0";
50
+ this.container.style.top = "0";
51
+ this.container.style.width = "20%";
52
+ this.container.style.height = "100%";
53
+ this.container.style.background = "rgba(240,240,240,0.9)";
54
+ this.container.style.overflowY = "auto";
55
+
56
+ // Append to workspace top layer
57
+ workspace._wsTop.appendChild(this.container);
58
+
59
+ // Initialize toolbox depending on type
60
+ if (this.type === 1) this.initCategoryToolbox();
61
+ if (this.type === 2) this.initFlyoutToolbox();
62
+ }
63
+ /**
64
+ * Applies a WSTheme to the toolbox and flyout elements.
65
+ * @param theme The workspace theme to apply
66
+ */
67
+ updateStyles(theme: WSTheme) {
68
+ if (!theme?.UIStyles) return;
69
+
70
+ const { toolboxCategoriesBG, toolboxFlyoutBG } = theme.UIStyles;
71
+
72
+ const applyStyles = (el: HTMLElement, styles?: Partial<CSSStyleDeclaration>) => {
73
+ if (!styles) return;
74
+
75
+ for (const key in styles) {
76
+ const k = key as keyof CSSStyleDeclaration;
77
+ const v = styles[k];
78
+ // Only assign if value exists
79
+ if (v !== undefined) {
80
+ // cast to any to avoid TS errors
81
+ (el.style as any)[k] = v;
82
+ }
83
+ }
84
+ };
85
+
86
+ if (this.type === 1) applyStyles(this.container, toolboxCategoriesBG);
87
+ if (this._flyout?.container) applyStyles(this._flyout.container, toolboxFlyoutBG);
88
+ }
89
+
90
+
91
+ /**
92
+ * Retrieves the workspace options.
93
+ * @returns The workspace's InjectOptions
94
+ */
95
+ getOptions() {
96
+ return this.workspace.options;
97
+ }
98
+
99
+ /**
100
+ * Initializes a category-based toolbox.
101
+ * Converts the toolbox contents into Category instances and attaches them.
102
+ */
103
+ initCategoryToolbox() {
104
+ const categories = this._contents as TblxCategoryStruct[];
105
+ categories.forEach(cData => {
106
+ const category = new Category(this, cData);
107
+ this._categories.push(category);
108
+ });
109
+
110
+ // Hide flyout when workspace is clicked
111
+ this.workspace.svg.on("click", () => this._flyout.hide());
112
+ }
113
+
114
+ /**
115
+ * Initializes a flyout toolbox.
116
+ * Fills the flyout with the node definitions from the toolbox contents.
117
+ */
118
+ initFlyoutToolbox() {
119
+ this.container.style.display = "none";
120
+ const nodes = this._contents as TblxNodeStruct[];
121
+ this._flyout.fill(nodes);
122
+ }
123
+ }
124
+
125
+ export default Toolbox;
package/src/types.ts ADDED
@@ -0,0 +1,205 @@
1
+ import Kabel from './core';
2
+ import { DropdownContainer } from './dropdown-menu';
3
+ import WorkspaceSvg from './workspace-svg';
4
+
5
+ // -------------------- Types --------------------
6
+ /**
7
+ * Represents the UIX (UI experience utilities) portion of Kabel.
8
+ */
9
+ export interface KabelUIX {
10
+ /**
11
+ * Event system for SVG.js elements, allowing reusable functionality and event handling.
12
+ */
13
+ events: typeof Kabel.UIX.events;
14
+ /** handles loading fonts from Google fonts and possibly other CDNs in the future. */
15
+ FontManager: typeof Kabel.UIX.FontManager;
16
+ /**
17
+ * Stores the current state of the user.
18
+ */
19
+ userState: typeof Kabel.UIX.userState;
20
+
21
+ /**
22
+ * window listener system.
23
+ */
24
+ windowListeners: typeof Kabel.UIX.windowListeners;
25
+ }
26
+
27
+ /**
28
+ * Utility functions and classes provided by Kabel.
29
+ */
30
+ export interface KabelUtils {
31
+ /** Path manipulation utilities. */
32
+ Path: typeof Kabel.Utils.Path;
33
+
34
+ /** Wait for a number of animation frames. */
35
+ waitFrames: typeof Kabel.Utils.waitFrames;
36
+
37
+ /** SVG utilities. */
38
+ SVG: typeof Kabel.Utils.SVG;
39
+
40
+ /** Parses a color string into an internal format. */
41
+ parseColor: typeof Kabel.Utils.parseColor;
42
+
43
+ /** Unique ID generation utilities. */
44
+ UID: typeof Kabel.Utils.UID;
45
+
46
+ /** Event emitter class for custom events. */
47
+ EventEmitter: typeof Kabel.Utils.EventEmitter;
48
+
49
+ /** Checks if an object has a property. */
50
+ hasProp: typeof Kabel.Utils.hasProp;
51
+
52
+ /** Styler helper functions. */
53
+ styler: typeof Kabel.Utils.styler;
54
+
55
+ /** Styler class for managing styles. */
56
+ Styler: typeof Kabel.Utils.Styler;
57
+
58
+ /** Escapes HTML for safe insertion into the DOM. */
59
+ escapeHTML: typeof Kabel.Utils.escapeHTML;
60
+
61
+ /** Unescapes HTML strings back to their original form. */
62
+ unescapeHTML: typeof Kabel.Utils.unescapeHTML;
63
+ }
64
+
65
+ /**
66
+ * Node rendering utilities and classes.
67
+ */
68
+ export interface KabelNodeRendering {
69
+ /** Map of registered node renderers. */
70
+ rendererMap: typeof Kabel.nodeRendering.rendererMap;
71
+
72
+ Apollo: typeof Kabel.nodeRendering.Apollo;
73
+ Atlas: typeof Kabel.nodeRendering.Atlas;
74
+
75
+ /** Node renderer class. */
76
+ Renderer: typeof Kabel.nodeRendering.Renderer;
77
+
78
+ /** Constant class to be instantiated and used in node rendering. */
79
+ RendererConstants: typeof Kabel.nodeRendering.RendererConstants;
80
+ /**
81
+ * used by the renderer to create RepresenterNodes for each rendered node. (node.svg API is provided by this)
82
+ */
83
+ Representer: typeof Kabel.nodeRendering.Representer;
84
+ /**
85
+ * Class behind node.svg API. Represents a renderer's DrawState.
86
+ */
87
+ RepresenterNode: typeof Kabel.nodeRendering.RepresenterNode;
88
+ }
89
+
90
+ /**
91
+ * Comment rendering utilities and classes.
92
+ */
93
+ export interface KabelCommentRendering {
94
+ /** Comment model class. */
95
+ CommentModel: typeof Kabel.commentRendering.CommentModel;
96
+
97
+ /** Comment renderer class. */
98
+ CommentRenderer: typeof Kabel.commentRendering.CommentRenderer;
99
+ }
100
+ /** The current environment */
101
+ export interface KabelEnv {
102
+ isBrowser: boolean;
103
+ isNode: boolean;
104
+ isWebWorker: boolean;
105
+ }
106
+ /**
107
+ * The main Kabel interface exposing core functionality, utilities, renderers, and UI components.
108
+ */
109
+ export interface KabelInterface {
110
+ env: KabelEnv
111
+ /** UI experience utilities section */
112
+ UIX: KabelUIX;
113
+
114
+ /** Context menu utilities. */
115
+ ContextMenu: typeof Kabel.ContextMenu;
116
+
117
+ /** Utility functions and classes. */
118
+ Utils: KabelUtils;
119
+
120
+ /** Widget system for creating interactive UI components. */
121
+ Widget: typeof Kabel.Widget;
122
+
123
+ /** Color categories for nodes and other UI elements. */
124
+ CategoryColors: typeof Kabel.CategoryColors;
125
+
126
+ /** Connection system for nodes. */
127
+ Connection: typeof Kabel.Connection;
128
+
129
+ /** Coordinates utility. */
130
+ Coordinates: typeof Kabel.Coordinates;
131
+
132
+ /** Base field class for node inputs. */
133
+ Field: typeof Kabel.Field;
134
+
135
+ /** Dummy field placeholder class. */
136
+ DummyField: typeof Kabel.DummyField;
137
+
138
+ /** Mapping of fields by type or ID. */
139
+ FieldMap: typeof Kabel.FieldMap;
140
+
141
+ /** Number input field for nodes. */
142
+ NumberField: typeof Kabel.NumberField;
143
+
144
+ /** Optional connection field. */
145
+ OptConnectField: typeof Kabel.OptConnectField;
146
+
147
+ /** Text input field for nodes. */
148
+ TextField: typeof Kabel.TextField;
149
+
150
+ /** Function to create a new workspace in kabel */
151
+ inject: typeof Kabel.inject;
152
+ /** Function to create a new workspace in kabel (headless) */
153
+ injectHeadless: typeof Kabel.injectHeadless;
154
+ /** Message type for injections. */
155
+ InjectMsg: typeof Kabel.InjectMsg;
156
+
157
+ /** Clears the main workspace. */
158
+ clearMainWorkspace: typeof Kabel.clearMainWorkspace;
159
+
160
+ /** Retrieves the main workspace instance. */
161
+ getMainWorkspace: typeof Kabel.getMainWorkspace;
162
+
163
+ /** Sets the main workspace instance. */
164
+ setMainWorkspace: typeof Kabel.setMainWorkspace;
165
+
166
+ /** NodeSVG class, represents a node in the workspace */
167
+ NodeSvg: typeof Kabel.NodeSvg;
168
+
169
+ /** Collection of registered node prototypes. */
170
+ Nodes: typeof Kabel.Nodes;
171
+
172
+ /** Collection of registered widget prototypes. */
173
+ Widgets: typeof Kabel.Widgets;
174
+
175
+ /** Workspace SVG class. */
176
+ WorkspaceSvg: typeof Kabel.WorkspaceSvg;
177
+
178
+ /** Workspace controller class which moves the workspace camera based on user interactions. */
179
+ WorkspaceController: typeof Kabel.WorkspaceController;
180
+
181
+ /** WASD controller for navigating the workspace. */
182
+ WASDController: typeof Kabel.WASDController;
183
+
184
+ /** Node rendering container, contains Renderer and RendererConstants classes */
185
+ nodeRendering: KabelNodeRendering;
186
+ /**
187
+ * A bunch of atlas renderer related classes.
188
+ */
189
+ atlas: typeof Kabel.atlas;
190
+ /**
191
+ * A bunch of apollo renderer related classes
192
+ */
193
+ apollo: typeof Kabel.apollo;
194
+
195
+ /** Comment rendering container, contains CommentModel and CommentRenderer classes. */
196
+ commentRendering: KabelCommentRendering;
197
+
198
+ /** The currently active main workspace instance. */
199
+ _mainWorkspace: WorkspaceSvg;
200
+
201
+ /** Dropdown UI singleton container. */
202
+ Dropdown: DropdownContainer;
203
+ }
204
+
205
+ export default KabelInterface;