@kabel-project/kabel 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/comment-renderer/renderer.d.ts +32 -0
- package/dist/comment-renderer/renderer.d.ts.map +1 -0
- package/dist/controllers/base.d.ts +39 -0
- package/dist/controllers/base.d.ts.map +1 -0
- package/dist/controllers/wasd.d.ts +33 -0
- package/dist/controllers/wasd.d.ts.map +1 -0
- package/dist/events/comment-drag-handle.d.ts +2 -0
- package/dist/events/comment-drag-handle.d.ts.map +1 -0
- package/dist/events/comment-input.d.ts +4 -0
- package/dist/events/comment-input.d.ts.map +1 -0
- package/dist/events/connection-line.d.ts +2 -0
- package/dist/events/connection-line.d.ts.map +1 -0
- package/dist/events/connector.d.ts +2 -0
- package/dist/events/connector.d.ts.map +1 -0
- package/dist/events/draggable.d.ts +2 -0
- package/dist/events/draggable.d.ts.map +1 -0
- package/{events/events.ts → dist/events/events.d.ts} +8 -7
- package/dist/events/events.d.ts.map +1 -0
- package/dist/events/input-box.d.ts +2 -0
- package/dist/events/input-box.d.ts.map +1 -0
- package/dist/events/node-x-btn.d.ts +2 -0
- package/dist/events/node-x-btn.d.ts.map +1 -0
- package/dist/kabel.js +2 -0
- package/dist/kabel.js.map +1 -0
- package/dist/renderers/apollo/apollo.d.ts +12 -0
- package/dist/renderers/apollo/apollo.d.ts.map +1 -0
- package/dist/renderers/apollo/constants.d.ts +21 -0
- package/dist/renderers/apollo/constants.d.ts.map +1 -0
- package/dist/renderers/apollo/renderer.d.ts +97 -0
- package/dist/renderers/apollo/renderer.d.ts.map +1 -0
- package/{renderers/atlas/atlas.ts → dist/renderers/atlas/atlas.d.ts} +6 -15
- package/dist/renderers/atlas/atlas.d.ts.map +1 -0
- package/dist/renderers/constants.d.ts +51 -0
- package/dist/renderers/constants.d.ts.map +1 -0
- package/dist/renderers/renderer.d.ts +470 -0
- package/dist/renderers/renderer.d.ts.map +1 -0
- package/dist/renderers/representer-node.d.ts +27 -0
- package/dist/renderers/representer-node.d.ts.map +1 -0
- package/dist/renderers/representer.d.ts +13 -0
- package/dist/renderers/representer.d.ts.map +1 -0
- package/dist/src/category.d.ts +48 -0
- package/dist/src/category.d.ts.map +1 -0
- package/{src/colors.ts → dist/src/colors.d.ts} +21 -20
- package/dist/src/colors.d.ts.map +1 -0
- package/dist/src/comment.d.ts +88 -0
- package/dist/src/comment.d.ts.map +1 -0
- package/dist/src/connection.d.ts +52 -0
- package/dist/src/connection.d.ts.map +1 -0
- package/dist/src/context-menu.d.ts +76 -0
- package/dist/src/context-menu.d.ts.map +1 -0
- package/dist/src/coordinates.d.ts +52 -0
- package/dist/src/coordinates.d.ts.map +1 -0
- package/dist/src/core.d.ts +153 -0
- package/dist/src/core.d.ts.map +1 -0
- package/dist/src/ctx-menu-registry.d.ts +22 -0
- package/dist/src/ctx-menu-registry.d.ts.map +1 -0
- package/dist/src/dropdown-menu.d.ts +87 -0
- package/dist/src/dropdown-menu.d.ts.map +1 -0
- package/dist/src/field.d.ts +305 -0
- package/dist/src/field.d.ts.map +1 -0
- package/dist/src/flyout.d.ts +41 -0
- package/dist/src/flyout.d.ts.map +1 -0
- package/dist/src/fonts-manager.d.ts +6 -0
- package/dist/src/fonts-manager.d.ts.map +1 -0
- package/dist/src/grid.d.ts +60 -0
- package/dist/src/grid.d.ts.map +1 -0
- package/dist/src/headless-node.d.ts +11 -0
- package/dist/src/headless-node.d.ts.map +1 -0
- package/dist/src/index.d.ts +38 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/inject-headless.d.ts +4 -0
- package/dist/src/inject-headless.d.ts.map +1 -0
- package/{src/inject.ts → dist/src/inject.d.ts} +142 -213
- package/dist/src/inject.d.ts.map +1 -0
- package/{src/main-workspace.ts → dist/src/main-workspace.d.ts} +31 -51
- package/dist/src/main-workspace.d.ts.map +1 -0
- package/dist/src/mutator.d.ts +2 -0
- package/dist/src/mutator.d.ts.map +1 -0
- package/{src/node-types.ts → dist/src/node-types.d.ts} +26 -27
- package/dist/src/node-types.d.ts.map +1 -0
- package/dist/src/nodesvg.d.ts +266 -0
- package/dist/src/nodesvg.d.ts.map +1 -0
- package/{src/prototypes.ts → dist/src/prototypes.d.ts} +10 -9
- package/dist/src/prototypes.d.ts.map +1 -0
- package/{src/renderer-map.ts → dist/src/renderer-map.d.ts} +51 -86
- package/dist/src/renderer-map.d.ts.map +1 -0
- package/dist/src/toolbox.d.ts +51 -0
- package/dist/src/toolbox.d.ts.map +1 -0
- package/{src/types.ts → dist/src/types.d.ts} +159 -205
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/undo-redo.d.ts +15 -0
- package/dist/src/undo-redo.d.ts.map +1 -0
- package/{src/visual-types.ts → dist/src/visual-types.d.ts} +34 -29
- package/dist/src/visual-types.d.ts.map +1 -0
- package/dist/src/widget-prototypes.d.ts +10 -0
- package/dist/src/widget-prototypes.d.ts.map +1 -0
- package/dist/src/widget.d.ts +62 -0
- package/dist/src/widget.d.ts.map +1 -0
- package/{src/workspace-coords.ts → dist/src/workspace-coords.d.ts} +10 -14
- package/dist/src/workspace-coords.d.ts.map +1 -0
- package/dist/src/workspace-svg.d.ts +371 -0
- package/dist/src/workspace-svg.d.ts.map +1 -0
- package/dist/src/workspace.d.ts +50 -0
- package/dist/src/workspace.d.ts.map +1 -0
- package/dist/themes/dark.d.ts +4 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/default.d.ts +4 -0
- package/dist/themes/default.d.ts.map +1 -0
- package/dist/themes/themes.d.ts +6 -0
- package/dist/themes/themes.d.ts.map +1 -0
- package/dist/util/emitter.d.ts +10 -0
- package/dist/util/emitter.d.ts.map +1 -0
- package/dist/util/env.d.ts +7 -0
- package/dist/util/env.d.ts.map +1 -0
- package/{util/escape-html.ts → dist/util/escape-html.d.ts} +16 -22
- package/dist/util/escape-html.d.ts.map +1 -0
- package/dist/util/eventer.d.ts +29 -0
- package/dist/util/eventer.d.ts.map +1 -0
- package/dist/util/has-prop.d.ts +2 -0
- package/dist/util/has-prop.d.ts.map +1 -0
- package/dist/util/parse-color.d.ts +6 -0
- package/dist/util/parse-color.d.ts.map +1 -0
- package/dist/util/path.d.ts +25 -0
- package/dist/util/path.d.ts.map +1 -0
- package/dist/util/styler.d.ts +12 -0
- package/dist/util/styler.d.ts.map +1 -0
- package/dist/util/uid.d.ts +42 -0
- package/dist/util/uid.d.ts.map +1 -0
- package/{util/unescape-html.ts → dist/util/unescape-html.d.ts} +16 -22
- package/dist/util/unescape-html.d.ts.map +1 -0
- package/dist/util/user-state.d.ts +37 -0
- package/dist/util/user-state.d.ts.map +1 -0
- package/{util/wait-anim-frames.ts → dist/util/wait-anim-frames.d.ts} +11 -24
- package/dist/util/wait-anim-frames.d.ts.map +1 -0
- package/dist/util/window-listeners.d.ts +8 -0
- package/dist/util/window-listeners.d.ts.map +1 -0
- package/package.json +4 -1
- package/(1.0.7)kabel.md +0 -18
- package/_READ_ME_MEDIA_/documentation/docs.md +0 -293
- package/_READ_ME_MEDIA_/workspace.png +0 -0
- package/comment-renderer/renderer.ts +0 -228
- package/controllers/base.ts +0 -186
- package/controllers/wasd.ts +0 -132
- package/docs/README.md +0 -98
- package/docs/_media/docs.md +0 -289
- package/docs/_media/workspace.png +0 -0
- package/docs/classes/CommentModel.md +0 -271
- package/docs/classes/CommentRenderer.md +0 -457
- package/docs/classes/ConnectableField.md +0 -597
- package/docs/classes/Connection.md +0 -191
- package/docs/classes/ContextMenuHTML.md +0 -163
- package/docs/classes/Coordinates.md +0 -187
- package/docs/classes/DropdownContainer.md +0 -300
- package/docs/classes/DummyField.md +0 -393
- package/docs/classes/Eventer.md +0 -185
- package/docs/classes/Field.md +0 -461
- package/docs/classes/InjectMsg.md +0 -85
- package/docs/classes/NodeSvg.md +0 -1011
- package/docs/classes/NumberField.md +0 -559
- package/docs/classes/OptConnectField.md +0 -624
- package/docs/classes/Renderer.md +0 -1636
- package/docs/classes/RendererConstants.md +0 -343
- package/docs/classes/Representer.md +0 -95
- package/docs/classes/RepresenterNode.md +0 -175
- package/docs/classes/TextField.md +0 -559
- package/docs/classes/Toolbox.md +0 -172
- package/docs/classes/WASDController.md +0 -616
- package/docs/classes/Widget.md +0 -195
- package/docs/classes/WorkspaceController.md +0 -385
- package/docs/classes/WorkspaceCoords.md +0 -218
- package/docs/classes/WorkspaceSvg.md +0 -1380
- package/docs/functions/clearMainWorkspace.md +0 -20
- package/docs/functions/getMainWorkspace.md +0 -19
- package/docs/functions/inject.md +0 -35
- package/docs/functions/setMainWorkspace.md +0 -28
- package/docs/globals.md +0 -95
- package/docs/interfaces/ColorStyle.md +0 -43
- package/docs/interfaces/ConnectorToFrom.md +0 -57
- package/docs/interfaces/DrawState.md +0 -81
- package/docs/interfaces/FieldConnectionData.md +0 -25
- package/docs/interfaces/FieldOptions.md +0 -63
- package/docs/interfaces/FieldRawBoxData.md +0 -25
- package/docs/interfaces/FieldVisualInfo.md +0 -65
- package/docs/interfaces/GridOptions.md +0 -61
- package/docs/interfaces/InjectOptions.md +0 -133
- package/docs/interfaces/InputFieldJson.md +0 -50
- package/docs/interfaces/KabelCommentRendering.md +0 -31
- package/docs/interfaces/KabelInterface.md +0 -469
- package/docs/interfaces/KabelNodeRendering.md +0 -77
- package/docs/interfaces/KabelUIX.md +0 -105
- package/docs/interfaces/KabelUtils.md +0 -215
- package/docs/interfaces/NodeEvents.md +0 -42
- package/docs/interfaces/NodeJson.md +0 -104
- package/docs/interfaces/NodePrototype.md +0 -82
- package/docs/interfaces/RegisteredEl.md +0 -53
- package/docs/interfaces/SerializedNode.md +0 -128
- package/docs/interfaces/TblxCategoryStruct.md +0 -41
- package/docs/interfaces/TblxFieldStruct.md +0 -28
- package/docs/interfaces/TblxNodeStruct.md +0 -35
- package/docs/interfaces/WidgetOptions.md +0 -115
- package/docs/interfaces/WidgetPrototypeList.md +0 -15
- package/docs/type-aliases/AnyField.md +0 -13
- package/docs/type-aliases/AnyFieldCls.md +0 -13
- package/docs/type-aliases/Color.md +0 -13
- package/docs/type-aliases/Connectable.md +0 -13
- package/docs/type-aliases/EventArgs.md +0 -11
- package/docs/type-aliases/EventSetupFn.md +0 -25
- package/docs/type-aliases/Hex.md +0 -13
- package/docs/type-aliases/RGBObject.md +0 -37
- package/docs/type-aliases/RGBString.md +0 -13
- package/docs/type-aliases/RGBTuple.md +0 -13
- package/docs/type-aliases/TblxObjStruct.md +0 -52
- package/docs/variables/CategoryColors.md +0 -29
- package/docs/variables/FieldMap.md +0 -41
- package/docs/variables/NodePrototypes.md +0 -18
- package/docs/variables/default.md +0 -11
- package/events/comment-drag-handle.ts +0 -61
- package/events/comment-input.ts +0 -291
- package/events/connection-line.ts +0 -68
- package/events/connector.ts +0 -116
- package/events/draggable.ts +0 -119
- package/events/input-box.ts +0 -213
- package/events/node-x-btn.ts +0 -25
- package/index.d.ts +0 -4
- package/renderers/apollo/apollo.ts +0 -21
- package/renderers/apollo/constants.ts +0 -40
- package/renderers/apollo/renderer.ts +0 -331
- package/renderers/constants.ts +0 -87
- package/renderers/renderer.ts +0 -1288
- package/renderers/representer-node.ts +0 -52
- package/renderers/representer.ts +0 -25
- package/src/category.ts +0 -107
- package/src/comment.ts +0 -142
- package/src/connection.ts +0 -114
- package/src/context-menu.ts +0 -194
- package/src/coordinates.ts +0 -74
- package/src/core.ts +0 -202
- package/src/ctx-menu-registry.ts +0 -143
- package/src/dropdown-menu.ts +0 -215
- package/src/field.ts +0 -595
- package/src/flyout.ts +0 -165
- package/src/fonts-manager.ts +0 -38
- package/src/grid.ts +0 -162
- package/src/headless-node.ts +0 -27
- package/src/index.ts +0 -115
- package/src/inject-headless.ts +0 -18
- package/src/mutator.ts +0 -40
- package/src/nodesvg.ts +0 -756
- package/src/styles.css +0 -224
- package/src/toolbox.ts +0 -125
- package/src/undo-redo.ts +0 -87
- package/src/widget-prototypes.ts +0 -11
- package/src/widget.ts +0 -139
- package/src/workspace-svg.ts +0 -736
- package/src/workspace.ts +0 -155
- package/test-server.js +0 -61
- package/themes/dark.ts +0 -32
- package/themes/default.ts +0 -28
- package/themes/themes.ts +0 -9
- package/tsconfig.json +0 -25
- package/typedoc.json +0 -10
- package/util/emitter.ts +0 -33
- package/util/env.ts +0 -11
- package/util/eventer.ts +0 -108
- package/util/has-prop.ts +0 -4
- package/util/parse-color.ts +0 -42
- package/util/path.ts +0 -99
- package/util/styler.ts +0 -41
- package/util/uid.ts +0 -184
- package/util/user-state.ts +0 -68
- package/util/window-listeners.ts +0 -62
- package/webpack.config.js +0 -80
- /package/{docs/_media → dist}/index.html +0 -0
|
@@ -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
|
-
* - `<` with `<`
|
|
6
|
-
* - `>` with `>`
|
|
7
|
-
* - `"` with `"`
|
|
8
|
-
* - `'` with `'`
|
|
9
|
-
* - `&` 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
|
-
|
|
16
|
-
|
|
17
|
-
.replace(/"/g, '"')
|
|
18
|
-
.replace(/'/g, "'")
|
|
19
|
-
.replace(/&/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
|
+
* - `<` with `<`
|
|
6
|
+
* - `>` with `>`
|
|
7
|
+
* - `"` with `"`
|
|
8
|
+
* - `'` with `'`
|
|
9
|
+
* - `&` 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
|
-
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kabel-project/kabel",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node test-server.js",
|
|
@@ -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
|