@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,266 @@
|
|
|
1
|
+
import Connection from "./connection";
|
|
2
|
+
import { NodePrototype } from "./node-types";
|
|
3
|
+
import { ColorStyle, Color } from './visual-types';
|
|
4
|
+
import Field, { AnyField, FieldOptions } from "./field";
|
|
5
|
+
import Coordinates from "./coordinates";
|
|
6
|
+
import EventEmitter from '../util/emitter';
|
|
7
|
+
import { G } from "@svgdotjs/svg.js";
|
|
8
|
+
import WorkspaceSvg from "./workspace-svg";
|
|
9
|
+
import RendererConstants from "../renderers/constants";
|
|
10
|
+
import CommentModel, { CommentSerialized } from "./comment";
|
|
11
|
+
import { RepresenterNode } from '../renderers/representer-node';
|
|
12
|
+
/**
|
|
13
|
+
* Represents the JSON structure used to initialize a field on a node.
|
|
14
|
+
* Each field has a type, label, and name. Additional properties can be included for field-specific configuration.
|
|
15
|
+
*/
|
|
16
|
+
export interface InputFieldJson {
|
|
17
|
+
/** Human-readable label for the field, shown on the node UI */
|
|
18
|
+
label: string;
|
|
19
|
+
/** Field type identifier, corresponding to a field constructor in FieldMap */
|
|
20
|
+
type: string;
|
|
21
|
+
/** Unique field name within the node */
|
|
22
|
+
name: string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional additional properties for field initialization.
|
|
25
|
+
* Can include type-specific options like min/max for number fields,
|
|
26
|
+
* default values, dropdown options, etc.
|
|
27
|
+
*/
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents a JSON structure for initializing a NodeSvg instance.
|
|
32
|
+
* Includes colors, connections, label, fields, category, and type information.
|
|
33
|
+
*/
|
|
34
|
+
export interface NodeJson {
|
|
35
|
+
/** Primary color of the node (e.g., top bar, main connections) */
|
|
36
|
+
primaryColor?: Color | undefined;
|
|
37
|
+
/** Secondary color of the node (e.g., field backgrounds) */
|
|
38
|
+
secondaryColor?: Color | undefined;
|
|
39
|
+
/** Tertiary color of the node (e.g., outlines) */
|
|
40
|
+
tertiaryColor?: Color | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Optional previous connection data.
|
|
43
|
+
* Presence triggers creation of a previous connection when initializing NodeSvg.
|
|
44
|
+
*/
|
|
45
|
+
previousConnection?: any | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Optional next connection data.
|
|
48
|
+
* Presence triggers creation of a next connection when initializing NodeSvg.
|
|
49
|
+
*/
|
|
50
|
+
nextConnection?: any | undefined;
|
|
51
|
+
/** Optional node label text to display */
|
|
52
|
+
labelText?: string | undefined;
|
|
53
|
+
/** Array of field definitions (InputFieldJson) to attach to this node */
|
|
54
|
+
arguments?: InputFieldJson[] | undefined;
|
|
55
|
+
/** Optional category name for color theming */
|
|
56
|
+
category?: string | undefined;
|
|
57
|
+
/** Node type identifier, used to look up the NodePrototype */
|
|
58
|
+
type: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Represents a fully serialized node including its fields, colors, coordinates, connections, and optional comment.
|
|
62
|
+
* Used for saving or transferring node data.
|
|
63
|
+
*/
|
|
64
|
+
export interface SerializedNode {
|
|
65
|
+
/** Node type string */
|
|
66
|
+
type: string;
|
|
67
|
+
/** Unique node ID */
|
|
68
|
+
id: string;
|
|
69
|
+
/** Display label of the node */
|
|
70
|
+
label: string;
|
|
71
|
+
/** Node colors including primary, secondary, tertiary, and category */
|
|
72
|
+
colors: ColorStyle;
|
|
73
|
+
/** Coordinates of the node relative to its workspace */
|
|
74
|
+
relativeCoords: {
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
};
|
|
78
|
+
/** Optional comment text attached to the node */
|
|
79
|
+
comment?: CommentSerialized | undefined;
|
|
80
|
+
/** Array of serialized fields, may contain any field-specific structure */
|
|
81
|
+
fields?: any[] | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Serialized representation of the previous connection.
|
|
84
|
+
* If `field` is true, the connection originates from a field rather than a node.
|
|
85
|
+
*/
|
|
86
|
+
previousConnection?: {
|
|
87
|
+
field?: boolean | undefined;
|
|
88
|
+
node?: SerializedNode | undefined;
|
|
89
|
+
} | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Serialized representation of the next connection.
|
|
92
|
+
* If `field` is true, the connection originates from a field rather than a node.
|
|
93
|
+
*/
|
|
94
|
+
nextConnection?: {
|
|
95
|
+
field?: boolean | undefined;
|
|
96
|
+
node?: SerializedNode | undefined;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* NodeStyle represents the styling configuration of a node.
|
|
101
|
+
* Includes ColorStyle properties plus optional renderer-specific constants and arbitrary additional fields.
|
|
102
|
+
*/
|
|
103
|
+
export type NodeStyle = ColorStyle & {
|
|
104
|
+
[key in keyof RendererConstants]?: RendererConstants[key];
|
|
105
|
+
} & {
|
|
106
|
+
/** Any additional style properties supported by extensions or custom renderers */
|
|
107
|
+
[key: string]: any;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Events emitted by NodeSvg instances.
|
|
111
|
+
* Consumers can listen to these events to react to node lifecycle changes.
|
|
112
|
+
*/
|
|
113
|
+
export interface NodeEvents {
|
|
114
|
+
/** Triggered before the node is removed from the workspace */
|
|
115
|
+
"REMOVING": null;
|
|
116
|
+
/** Triggered immediately after node initialization */
|
|
117
|
+
"INITING": null;
|
|
118
|
+
/** Triggered while the node is being dragged */
|
|
119
|
+
"NODE_DRAG": null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Represents a node in the workspace.
|
|
123
|
+
* Handles connections, fields, colors, serialization, and events.
|
|
124
|
+
*/
|
|
125
|
+
declare class NodeSvg extends EventEmitter<NodeEvents> {
|
|
126
|
+
/** The previous connection for this node (null if none) */
|
|
127
|
+
previousConnection: Connection | null;
|
|
128
|
+
/** The next connection for this node (null if none) */
|
|
129
|
+
nextConnection: Connection | null;
|
|
130
|
+
/** Node type string, usually derived from prototype */
|
|
131
|
+
type: string | null;
|
|
132
|
+
/** Prototype object providing behavior for this node */
|
|
133
|
+
prototype: NodePrototype | null;
|
|
134
|
+
/** Node color style object */
|
|
135
|
+
colors: NodeStyle;
|
|
136
|
+
/** Displayed label text for this node */
|
|
137
|
+
labelText: string;
|
|
138
|
+
/** Set of fields attached to this node */
|
|
139
|
+
_fieldColumn: Set<AnyField>;
|
|
140
|
+
/** Node coordinates relative to workspace */
|
|
141
|
+
relativeCoords: Coordinates;
|
|
142
|
+
/** Unique node ID */
|
|
143
|
+
id: string;
|
|
144
|
+
/** SVG representation of this node */
|
|
145
|
+
svg?: RepresenterNode | object | null;
|
|
146
|
+
/** Workspace this node belongs to */
|
|
147
|
+
workspace: WorkspaceSvg | null;
|
|
148
|
+
/** Optional comment attached to this node */
|
|
149
|
+
comment: CommentModel | null;
|
|
150
|
+
/** Event key: "REMOVING" */
|
|
151
|
+
static REMOVING: keyof NodeEvents;
|
|
152
|
+
/** Event key: "INITING" */
|
|
153
|
+
static INITING: keyof NodeEvents;
|
|
154
|
+
/**
|
|
155
|
+
* Creates a NodeSvg instance.
|
|
156
|
+
* @param prototype Optional NodePrototype to associate with this node.
|
|
157
|
+
* @param workspace Optional WorkspaceSvg this node belongs to.
|
|
158
|
+
* @param svgGroup Optional SVG group to attach node visuals.
|
|
159
|
+
*/
|
|
160
|
+
constructor(prototype: NodePrototype | null, workspace?: WorkspaceSvg, svgGroup?: G);
|
|
161
|
+
/** Returns true if this node has no previous connection (i.e., top-level node) */
|
|
162
|
+
get topLevel(): boolean;
|
|
163
|
+
/** Returns the raw SVG group element if present */
|
|
164
|
+
get svgGroup(): G | null | undefined;
|
|
165
|
+
/** Returns the text of the node's comment, if any */
|
|
166
|
+
getCommentText(): string | undefined;
|
|
167
|
+
/** Returns the CommentModel instance for this node, if any */
|
|
168
|
+
getComment(): CommentModel | null;
|
|
169
|
+
/** Adds a new comment to this node if none exists */
|
|
170
|
+
addComment(): void;
|
|
171
|
+
/** Sets the text for the node's comment, creating one if needed */
|
|
172
|
+
setCommentText(text: string): void;
|
|
173
|
+
/** Removes the comment from the node and triggers workspace redraw */
|
|
174
|
+
removeComment(): void;
|
|
175
|
+
/** Returns an array of all fields attached to this node */
|
|
176
|
+
allFields(): AnyField[];
|
|
177
|
+
/** Retrieves a field by name from this node */
|
|
178
|
+
getFieldByName(name: string): AnyField | null | undefined;
|
|
179
|
+
/** Alias for getFieldByName */
|
|
180
|
+
getField(name: string): AnyField | null | undefined;
|
|
181
|
+
/** Retrieves the current value of a field by name */
|
|
182
|
+
getFieldValue(name: string): any | undefined;
|
|
183
|
+
/** Retrieves the display value of a field by name */
|
|
184
|
+
getFieldDisplayValue(name: string): any | undefined;
|
|
185
|
+
/** Sets the value of a field by name */
|
|
186
|
+
setFieldValue(name: string, value: any): AnyField | null | undefined;
|
|
187
|
+
/**
|
|
188
|
+
* Initiates the node, calling prototype methods.
|
|
189
|
+
*/
|
|
190
|
+
init(): void;
|
|
191
|
+
/** Returns whether this node has a category style applied */
|
|
192
|
+
hasCategoryStyle(): boolean;
|
|
193
|
+
/** Returns the category name or null if none */
|
|
194
|
+
getCategoryName(): string | null;
|
|
195
|
+
/** Returns the node's current ColorStyle */
|
|
196
|
+
getStyle(): NodeStyle;
|
|
197
|
+
/** Internal helper: attach a field to this node */
|
|
198
|
+
_appendFieldItem(field: AnyField): void;
|
|
199
|
+
/** Initialize node from a NodeJson object */
|
|
200
|
+
jsonInit(json: NodeJson): void;
|
|
201
|
+
/** Apply field definitions from a JSON-like array without full NodeJson */
|
|
202
|
+
applyJsonArguments(args: InputFieldJson[]): this;
|
|
203
|
+
/** Appends a connection field to this node */
|
|
204
|
+
appendConnection(name: string): Field;
|
|
205
|
+
/** Appends a numeric input field to this node */
|
|
206
|
+
appendNumber(name: string): Field;
|
|
207
|
+
/** Appends a text input field to this node */
|
|
208
|
+
appendText(name: string): Field;
|
|
209
|
+
/** Appends a field that can hold a connection or raw value */
|
|
210
|
+
appendOptLink(name: string): Field;
|
|
211
|
+
/** Sets the category name for the node */
|
|
212
|
+
setCategoryName(name: string): this;
|
|
213
|
+
/** Applies a ColorStyle to the node */
|
|
214
|
+
setStyle(style: ColorStyle): this;
|
|
215
|
+
/** Sets primary, secondary, and tertiary colors for the node */
|
|
216
|
+
setColor(primary: Color, secondary: Color, tertiary: Color): this;
|
|
217
|
+
/** Sets the label text for the node */
|
|
218
|
+
setLabelText(text: string): this;
|
|
219
|
+
/** Add or replace a previous/next connection based on argument */
|
|
220
|
+
setConnection(prevOrNext: string | number | boolean): this;
|
|
221
|
+
/** Copies another NodeSvg into this node */
|
|
222
|
+
fromNode(other: NodeSvg): this | undefined;
|
|
223
|
+
/** Serializes a Connection object, handling fields and nested nodes */
|
|
224
|
+
_serializeConnection(c: Connection, alreadyProcessed: {
|
|
225
|
+
[key: string]: SerializedNode;
|
|
226
|
+
}): {
|
|
227
|
+
field?: boolean | undefined;
|
|
228
|
+
node?: SerializedNode | undefined;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Serialize a node, this includes circular references. use toJson to avoid those.
|
|
232
|
+
* @param alreadyProcessed - Internal.
|
|
233
|
+
* @returns
|
|
234
|
+
*/
|
|
235
|
+
serialize(alreadyProcessed?: {
|
|
236
|
+
[key: string]: SerializedNode;
|
|
237
|
+
}): SerializedNode;
|
|
238
|
+
/**
|
|
239
|
+
* Return a flattened version of the serialized node structure, which is non-circular.
|
|
240
|
+
* Any node reference inside connections or fields is replaced by its ID.
|
|
241
|
+
*/
|
|
242
|
+
toJson(): {
|
|
243
|
+
[id: string]: Omit<SerializedNode, 'previousConnection' | 'nextConnection'> & {
|
|
244
|
+
previousConnection?: {
|
|
245
|
+
field?: FieldOptions;
|
|
246
|
+
node?: string;
|
|
247
|
+
};
|
|
248
|
+
nextConnection?: {
|
|
249
|
+
field?: FieldOptions;
|
|
250
|
+
node?: string;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Reconstruct a NodeSvg from a SerializedNode structure (handles circular references)
|
|
256
|
+
*/
|
|
257
|
+
static _deserialize(data: SerializedNode, allNodes?: {
|
|
258
|
+
[id: string]: NodeSvg;
|
|
259
|
+
}, workspace?: WorkspaceSvg): NodeSvg;
|
|
260
|
+
/** Public: Deserialize a SerializedNode or plain object into a NodeSvg attached to a workspace */
|
|
261
|
+
static deserialize(json: SerializedNode | any, workspace: WorkspaceSvg): NodeSvg;
|
|
262
|
+
/** Reconstructs nodes from a flattened JSON structure into a NodeSvg tree */
|
|
263
|
+
static fromJson(flat: Record<string, any>, workspace: WorkspaceSvg): any;
|
|
264
|
+
}
|
|
265
|
+
export default NodeSvg;
|
|
266
|
+
//# sourceMappingURL=nodesvg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodesvg.d.ts","sourceRoot":"","sources":["../../src/nodesvg.ts"],"names":[],"mappings":"AAAA,OAAO,UAA2B,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAqC,YAAY,EAAE,MAAM,SAAS,CAAC;AAE3F,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AACrC,OAAO,YAAY,MAAM,iBAAiB,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
|
|
2
|
+
/**
|
|
3
|
+
* A registry of all node prototypes by name.
|
|
4
|
+
* Maps a string key (node type name) to a NodePrototype object
|
|
5
|
+
*/
|
|
6
|
+
declare const NodePrototypes: {
|
|
7
|
+
[key: string]: NodePrototype;
|
|
8
|
+
};
|
|
9
|
+
export default NodePrototypes;
|
|
10
|
+
//# sourceMappingURL=prototypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototypes.d.ts","sourceRoot":"","sources":["../../src/prototypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;GAGG;AACH,QAAA,MAAM,cAAc,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAO,CAAC;AAE5D,eAAe,cAAc,CAAC"}
|
|
@@ -1,86 +1,51 @@
|
|
|
1
|
-
import type RendererType from "../renderers/renderer";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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 };
|
|
1
|
+
import type RendererType from "../renderers/renderer";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for the renderer map.
|
|
4
|
+
* Maps a string key (renderer name) to a renderer class.
|
|
5
|
+
*/
|
|
6
|
+
interface RendererMapInterface {
|
|
7
|
+
[key: string]: typeof RendererType;
|
|
8
|
+
}
|
|
9
|
+
declare const RendererMap: RendererMapInterface;
|
|
10
|
+
/**
|
|
11
|
+
* Class for managing registered renderer classes.
|
|
12
|
+
* Provides methods to register, delete, get, list, and resolve renderers.
|
|
13
|
+
*/
|
|
14
|
+
declare class RMap {
|
|
15
|
+
/**
|
|
16
|
+
* Registers a renderer class under a given name.
|
|
17
|
+
* @param RendererCls The renderer class to register
|
|
18
|
+
* @param optName Optional name to register under. Defaults to `RendererCls.NAME`
|
|
19
|
+
*/
|
|
20
|
+
static register(RendererCls: typeof RendererType, optName?: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Deletes a renderer from the map by name.
|
|
23
|
+
* Cannot delete the "default" renderer.
|
|
24
|
+
* @param name The name of the renderer to delete
|
|
25
|
+
* @returns `true` if deleted, `false` otherwise
|
|
26
|
+
*/
|
|
27
|
+
static delete(name: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves a renderer class by name.
|
|
30
|
+
* Returns the default renderer if the name is not found.
|
|
31
|
+
* @param name The name of the renderer to get
|
|
32
|
+
* @returns The renderer class
|
|
33
|
+
*/
|
|
34
|
+
static get(name: string): typeof RendererType;
|
|
35
|
+
/**
|
|
36
|
+
* Lists all registered renderer names.
|
|
37
|
+
* @returns Array of registered renderer names
|
|
38
|
+
*/
|
|
39
|
+
static list(): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Resolves input into a renderer class.
|
|
42
|
+
* - If `input` is undefined, returns the default renderer
|
|
43
|
+
* - If `input` is a string, returns the renderer with that name
|
|
44
|
+
* - If `input` is a class, returns the class itself
|
|
45
|
+
* @param input Optional renderer name or class
|
|
46
|
+
* @returns Renderer class
|
|
47
|
+
*/
|
|
48
|
+
static resolve(input?: string | typeof RendererType): typeof RendererType;
|
|
49
|
+
}
|
|
50
|
+
export { RMap, RendererMap };
|
|
51
|
+
//# sourceMappingURL=renderer-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer-map.d.ts","sourceRoot":"","sources":["../../src/renderer-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AAEtD;;;GAGG;AACH,UAAU,oBAAoB;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,YAAY,CAAC;CACtC;AAGD,QAAA,MAAM,WAAW,EAAE,oBAAyB,CAAC;AAE7C;;;GAGG;AACH,cAAM,IAAI;IACN;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM;IAKlE;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM;IAS1B;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,YAAY;IAK7C;;;OAGG;IACH,MAAM,CAAC,IAAI;IAIX;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,YAAY,GAAG,OAAO,YAAY;CAW5E;AAID,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
* Represents the toolbox in a Kabel workspace.
|
|
7
|
+
* The toolbox can be either a flyout or a category-based toolbox.
|
|
8
|
+
*/
|
|
9
|
+
declare class Toolbox {
|
|
10
|
+
/** Toolbox type: 1 = category toolbox, 2 = flyout toolbox */
|
|
11
|
+
type: 1 | 2;
|
|
12
|
+
/** Reference to the workspace this toolbox belongs to */
|
|
13
|
+
workspace: WorkspaceSvg;
|
|
14
|
+
/** Workspace options for initialization */
|
|
15
|
+
wsOptions: InjectOptions;
|
|
16
|
+
/** Flyout instance for node display */
|
|
17
|
+
_flyout: Flyout;
|
|
18
|
+
/** Contents of the toolbox (nodes or categories) */
|
|
19
|
+
_contents: TblxNodeStruct[] | TblxCategoryStruct[];
|
|
20
|
+
/** DOM container element for the toolbox */
|
|
21
|
+
container: HTMLDivElement;
|
|
22
|
+
/** List of categories (if using a category toolbox) */
|
|
23
|
+
_categories: Category[];
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new Toolbox instance attached to a workspace.
|
|
26
|
+
* @param workspace The workspace instance to attach this toolbox to
|
|
27
|
+
*/
|
|
28
|
+
constructor(workspace: WorkspaceSvg);
|
|
29
|
+
/**
|
|
30
|
+
* Applies a WSTheme to the toolbox and flyout elements.
|
|
31
|
+
* @param theme The workspace theme to apply
|
|
32
|
+
*/
|
|
33
|
+
updateStyles(theme: WSTheme): void;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves the workspace options.
|
|
36
|
+
* @returns The workspace's InjectOptions
|
|
37
|
+
*/
|
|
38
|
+
getOptions(): InjectOptions;
|
|
39
|
+
/**
|
|
40
|
+
* Initializes a category-based toolbox.
|
|
41
|
+
* Converts the toolbox contents into Category instances and attaches them.
|
|
42
|
+
*/
|
|
43
|
+
initCategoryToolbox(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Initializes a flyout toolbox.
|
|
46
|
+
* Fills the flyout with the node definitions from the toolbox contents.
|
|
47
|
+
*/
|
|
48
|
+
initFlyoutToolbox(): void;
|
|
49
|
+
}
|
|
50
|
+
export default Toolbox;
|
|
51
|
+
//# sourceMappingURL=toolbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbox.d.ts","sourceRoot":"","sources":["../../src/toolbox.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;GAGG;AACH,cAAM,OAAO;IACT,6DAA6D;IAC7D,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IAEZ,yDAAyD;IACzD,SAAS,EAAE,YAAY,CAAC;IAExB,2CAA2C;IAC3C,SAAS,EAAE,aAAa,CAAC;IAEzB,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAEhB,oDAAoD;IACpD,SAAS,EAAE,cAAc,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAEnD,4CAA4C;IAC5C,SAAS,EAAE,cAAc,CAAC;IAE1B,uDAAuD;IACvD,WAAW,EAAE,QAAQ,EAAE,CAAM;IAE7B;;;OAGG;gBACS,SAAS,EAAE,YAAY;IA2BnC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,OAAO;IAwB3B;;;OAGG;IACH,UAAU;IAIV;;;OAGG;IACH,mBAAmB;IAWnB;;;OAGG;IACH,iBAAiB;CAKpB;AAED,eAAe,OAAO,CAAC"}
|