@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,88 @@
|
|
|
1
|
+
import { G, Line } from "@svgdotjs/svg.js";
|
|
2
|
+
import NodeSvg from "./nodesvg";
|
|
3
|
+
import WorkspaceSvg from "./workspace-svg";
|
|
4
|
+
import Coordinates from "./coordinates";
|
|
5
|
+
import Workspace from "./workspace";
|
|
6
|
+
export interface CommentSerialized {
|
|
7
|
+
id: string;
|
|
8
|
+
text: string;
|
|
9
|
+
coords: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
parent: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents a comment attached to either a NodeSvg or a WorkspaceSvg.
|
|
17
|
+
*/
|
|
18
|
+
declare class CommentModel {
|
|
19
|
+
/** The comment text */
|
|
20
|
+
_text: string;
|
|
21
|
+
/** True if this comment belongs to the workspace instead of a node */
|
|
22
|
+
_isWorkspaceComment: boolean;
|
|
23
|
+
/** Parent NodeSvg or WorkspaceSvg to which this comment belongs */
|
|
24
|
+
_parent: NodeSvg | WorkspaceSvg | Workspace;
|
|
25
|
+
/** SVG group representing this comment in the DOM */
|
|
26
|
+
svgGroup?: G | undefined;
|
|
27
|
+
/** Coordinates relative to parent */
|
|
28
|
+
relativeCoords: Coordinates;
|
|
29
|
+
/** Optional SVG line connecting the comment to its node */
|
|
30
|
+
svgLine?: Line | undefined;
|
|
31
|
+
/** Temporary bounding box info for input handling */
|
|
32
|
+
_tempInputBBox?: {
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
textX: number;
|
|
36
|
+
textY: number;
|
|
37
|
+
};
|
|
38
|
+
/** Unique identifier for this comment */
|
|
39
|
+
id: string;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new comment attached to a node or workspace.
|
|
42
|
+
* @param parent - NodeSvg or WorkspaceSvg this comment belongs to
|
|
43
|
+
*/
|
|
44
|
+
constructor(parent: NodeSvg | WorkspaceSvg | Workspace);
|
|
45
|
+
/**
|
|
46
|
+
* Sets the text of the comment without triggering a comment redraw.
|
|
47
|
+
* @param value - New text content
|
|
48
|
+
* @returns The updated text
|
|
49
|
+
*/
|
|
50
|
+
setTextNoRedraw(value: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves the current text of the comment.
|
|
53
|
+
* @returns The comment text
|
|
54
|
+
*/
|
|
55
|
+
getText(): string;
|
|
56
|
+
/**
|
|
57
|
+
* Sets the text of the comment and triggers a redraw of all comments in the workspace.
|
|
58
|
+
* @param value - New text content
|
|
59
|
+
* @returns The updated text
|
|
60
|
+
*/
|
|
61
|
+
setText(value: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Returns true if this comment is attached to a node.
|
|
64
|
+
*/
|
|
65
|
+
isNodeComment(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Returns true if this comment is attached to the workspace.
|
|
68
|
+
*/
|
|
69
|
+
isWorkspaceComment(): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the workspace that owns this comment.
|
|
72
|
+
*/
|
|
73
|
+
getWorkspace(): WorkspaceSvg;
|
|
74
|
+
/**
|
|
75
|
+
* Convert to JSON structure holding all important data.
|
|
76
|
+
*/
|
|
77
|
+
toJson(): CommentSerialized;
|
|
78
|
+
/**
|
|
79
|
+
* Creates a CommentModel from serialized data.
|
|
80
|
+
* @param data - The serialized comment
|
|
81
|
+
* @param workspace - The workspace to attach the comment to
|
|
82
|
+
* @param nodeMap - Optional map of node IDs to NodeSvg instances
|
|
83
|
+
*/
|
|
84
|
+
static fromJson(data: CommentSerialized): CommentModel;
|
|
85
|
+
}
|
|
86
|
+
export default CommentModel;
|
|
87
|
+
export { CommentModel };
|
|
88
|
+
//# sourceMappingURL=comment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../src/comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AACD;;GAEG;AACH,cAAM,YAAY;IACd,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IAEd,sEAAsE;IACtE,mBAAmB,EAAE,OAAO,CAAC;IAE7B,mEAAmE;IACnE,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAAC;IAE5C,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;IAEzB,qCAAqC;IACrC,cAAc,EAAE,WAAW,CAAC;IAE5B,2DAA2D;IAC3D,OAAO,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAE3B,qDAAqD;IACrD,cAAc,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAEjF,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;gBACS,MAAM,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS;IAUtD;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAItC;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAQ9B;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,kBAAkB,IAAI,OAAO;IAI7B;;OAEG;IACH,YAAY,IAAI,YAAY;IAO5B;;OAEG;IACH,MAAM,IAAI,iBAAiB;IAS3B;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CACX,IAAI,EAAE,iBAAiB,GACxB,YAAY;CAQlB;AAED,eAAe,YAAY,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Field from "./field";
|
|
2
|
+
import NodeSvg from "./nodesvg";
|
|
3
|
+
/**
|
|
4
|
+
* A node or field that can participate in a connection.
|
|
5
|
+
*/
|
|
6
|
+
export type Connectable = NodeSvg | null | Field;
|
|
7
|
+
/**
|
|
8
|
+
* Represents a connection between two connectable objects.
|
|
9
|
+
*/
|
|
10
|
+
declare class Connection {
|
|
11
|
+
/** The source of the connection */
|
|
12
|
+
from: Connectable;
|
|
13
|
+
/** The target of the connection */
|
|
14
|
+
to: Connectable;
|
|
15
|
+
/** Whether this connection represents a previous connection (affects rendering/logic) */
|
|
16
|
+
isPrevious: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new Connection.
|
|
19
|
+
* @param from - The source NodeSvg or Field
|
|
20
|
+
* @param to - The target NodeSvg or Field
|
|
21
|
+
* @param isPrevious - True if this connection is a previous connection
|
|
22
|
+
*/
|
|
23
|
+
constructor(from: Connectable, to: Connectable, isPrevious?: boolean);
|
|
24
|
+
/** Returns the target of the connection */
|
|
25
|
+
getTo(): Connectable;
|
|
26
|
+
/** Returns the source of the connection */
|
|
27
|
+
getFrom(): Connectable;
|
|
28
|
+
/**
|
|
29
|
+
* Disconnects this connection from its target.
|
|
30
|
+
* Safely handles NodeSvg chains and ConnectableFields.
|
|
31
|
+
*/
|
|
32
|
+
disconnectTo(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Disconnects this connection from its source.
|
|
35
|
+
* Safely handles NodeSvg chains and ConnectableFields.
|
|
36
|
+
*/
|
|
37
|
+
disconnectFrom(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Sets the target of this connection (used during deserialization)
|
|
40
|
+
* @param target - New connection target
|
|
41
|
+
*/
|
|
42
|
+
setTo(target: Connectable): void;
|
|
43
|
+
/**
|
|
44
|
+
* Sets the source of this connection (used during deserialization)
|
|
45
|
+
* @param source - New connection source
|
|
46
|
+
*/
|
|
47
|
+
setFrom(source: Connectable): void;
|
|
48
|
+
/** Completely isolates this connection, clearing both ends */
|
|
49
|
+
isolate(): void;
|
|
50
|
+
}
|
|
51
|
+
export default Connection;
|
|
52
|
+
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,SAAS,CAAC;AAClD,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,IAAI,GAAG,KAAK,CAAC;AAEjD;;GAEG;AACH,cAAM,UAAU;IACf,mCAAmC;IACnC,IAAI,EAAE,WAAW,CAAC;IAClB,mCAAmC;IACnC,EAAE,EAAE,WAAW,CAAC;IAChB,yFAAyF;IACzF,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;gBACS,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,WAAW,EAAE,UAAU,GAAE,OAAe;IAM3E,2CAA2C;IAC3C,KAAK,IAAI,WAAW;IAIpB,2CAA2C;IAC3C,OAAO,IAAI,WAAW;IAItB;;;OAGG;IACH,YAAY;IAqBZ;;;OAGG;IACH,cAAc;IAoBd;;;OAGG;IACH,KAAK,CAAC,MAAM,EAAE,WAAW;IAIzB;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,WAAW;IAI3B,8DAA8D;IAC9D,OAAO;CAIP;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import WorkspaceController from "../controllers/base";
|
|
2
|
+
import CommentModel from "./comment";
|
|
3
|
+
import NodeSvg from "./nodesvg";
|
|
4
|
+
import Widget from "./widget";
|
|
5
|
+
import WorkspaceSvg from "./workspace-svg";
|
|
6
|
+
/**
|
|
7
|
+
* A list of types that a context menu item can show for.
|
|
8
|
+
*/
|
|
9
|
+
export type Showable = 'node' | 'ws' | 'html' | 'comment' | 'any';
|
|
10
|
+
/**
|
|
11
|
+
* Describes a context menu option.
|
|
12
|
+
*/
|
|
13
|
+
export interface ContextMenuOpts {
|
|
14
|
+
/** Function executed when the option is clicked */
|
|
15
|
+
click: (target: NodeSvg | WorkspaceSvg | CommentModel | HTMLElement) => void;
|
|
16
|
+
/** Optional hover start callback */
|
|
17
|
+
onHoverStart?: () => void;
|
|
18
|
+
/** Optional hover end callback */
|
|
19
|
+
onHoverEnd?: () => void;
|
|
20
|
+
/** Specifies which target types this option should appear for */
|
|
21
|
+
showFor?: Showable | Showable[];
|
|
22
|
+
/** Specifies extra logic for drawing */
|
|
23
|
+
onDraw?: (optEl: Node, ws: WorkspaceSvg, opt: ContextMenuOpts) => void;
|
|
24
|
+
/** Text label for the menu option */
|
|
25
|
+
label: string;
|
|
26
|
+
/** Unique ID for the option */
|
|
27
|
+
id: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* HTML context menu rendered on workspace right-click.
|
|
31
|
+
*/
|
|
32
|
+
declare class ContextMenuHTML {
|
|
33
|
+
/**
|
|
34
|
+
* The workspace.
|
|
35
|
+
*/
|
|
36
|
+
workspace: WorkspaceSvg;
|
|
37
|
+
/**
|
|
38
|
+
* The workspace's controller
|
|
39
|
+
*/
|
|
40
|
+
controller: WorkspaceController;
|
|
41
|
+
/**
|
|
42
|
+
* The widget in the workspace to display the menu on.
|
|
43
|
+
*/
|
|
44
|
+
widget: Widget;
|
|
45
|
+
/**
|
|
46
|
+
* Options for the context menu.
|
|
47
|
+
*/
|
|
48
|
+
options: ContextMenuOpts[];
|
|
49
|
+
/**
|
|
50
|
+
* Create a new context menu for a workspace.
|
|
51
|
+
* @param workspace - Workspace to attach the context menu to
|
|
52
|
+
*/
|
|
53
|
+
constructor(workspace: WorkspaceSvg);
|
|
54
|
+
/**
|
|
55
|
+
* Renders context menu options for a given target.
|
|
56
|
+
* @param target - The object the context menu is for
|
|
57
|
+
*/
|
|
58
|
+
renderOptions(target: NodeSvg | WorkspaceSvg | HTMLElement | CommentModel | null): void;
|
|
59
|
+
/**
|
|
60
|
+
* Initializes event listeners for showing/hiding the menu.
|
|
61
|
+
*/
|
|
62
|
+
initListeners(): void;
|
|
63
|
+
/** Hides the context menu */
|
|
64
|
+
hide(): void;
|
|
65
|
+
/** Returns the current mouse position in workspace coordinates */
|
|
66
|
+
get mousePos(): {
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Returns the target element under the mouse for context menu.
|
|
72
|
+
*/
|
|
73
|
+
get target(): NodeSvg | WorkspaceSvg | HTMLElement | CommentModel | null;
|
|
74
|
+
}
|
|
75
|
+
export default ContextMenuHTML;
|
|
76
|
+
//# sourceMappingURL=context-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../../src/context-menu.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,qBAAqB,CAAC;AAEtD,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QAAQ,IAAI;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAEvC;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,IAAI,CA8BvE;CACJ;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a 2D coordinate in space.
|
|
3
|
+
*/
|
|
4
|
+
declare class Coordinates {
|
|
5
|
+
/** X position */
|
|
6
|
+
x: number;
|
|
7
|
+
/** Y position */
|
|
8
|
+
y: number;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new Coordinates instance
|
|
11
|
+
* @param x - The x value (default 0)
|
|
12
|
+
* @param y - The y value (default 0)
|
|
13
|
+
*/
|
|
14
|
+
constructor(x?: number, y?: number);
|
|
15
|
+
/**
|
|
16
|
+
* Set the coordinates to new values
|
|
17
|
+
* @param x - The new x value
|
|
18
|
+
* @param y - The new y value
|
|
19
|
+
*/
|
|
20
|
+
set(x: number, y: number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Returns a copy of this coordinate
|
|
23
|
+
* @returns A new Coordinates instance with the same x and y
|
|
24
|
+
*/
|
|
25
|
+
clone(): Coordinates;
|
|
26
|
+
/**
|
|
27
|
+
* Calculate the Euclidean distance to another coordinate
|
|
28
|
+
* @param other - The target coordinate
|
|
29
|
+
* @returns The distance as a number
|
|
30
|
+
*/
|
|
31
|
+
distanceTo(other: Coordinates): number;
|
|
32
|
+
/**
|
|
33
|
+
* Convert the coordinate to a string representation
|
|
34
|
+
* @returns A string like "(x, y)"
|
|
35
|
+
*/
|
|
36
|
+
toString(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Convert the coordinate to an array [x, y]
|
|
39
|
+
* @returns Tuple of numbers [x, y]
|
|
40
|
+
*/
|
|
41
|
+
toArray(): [number, number];
|
|
42
|
+
/**
|
|
43
|
+
* Convert the coordinate to an object { x, y }
|
|
44
|
+
* @returns Object with x and y properties
|
|
45
|
+
*/
|
|
46
|
+
toObject(): {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export default Coordinates;
|
|
52
|
+
//# sourceMappingURL=coordinates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinates.d.ts","sourceRoot":"","sources":["../../src/coordinates.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAM,WAAW;IAChB,iBAAiB;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,iBAAiB;IACjB,CAAC,EAAE,MAAM,CAAC;IAEV;;;;OAIG;gBACS,CAAC,GAAE,MAAU,EAAE,CAAC,GAAE,MAAU;IAKxC;;;;OAIG;IACH,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAKxB;;;OAGG;IACH,KAAK,IAAI,WAAW;IAIpB;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;IAMtC;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,OAAO,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAI3B;;;OAGG;IACH,QAAQ,IAAI;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;CAGpC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import RendererConstants from '../renderers/constants';
|
|
2
|
+
import Renderer from '../renderers/renderer';
|
|
3
|
+
import Connection from './connection';
|
|
4
|
+
import Coordinates from './coordinates';
|
|
5
|
+
import Field, { AnyFieldCls, DummyField, NumberField, OptConnectField, TextField } from './field';
|
|
6
|
+
import inject, { InjectMsg } from './inject';
|
|
7
|
+
import { clearMainWorkspace, getMainWorkspace, setMainWorkspace } from './main-workspace';
|
|
8
|
+
import NodeSvg from './nodesvg';
|
|
9
|
+
import WorkspaceSvg from './workspace-svg';
|
|
10
|
+
import { NodePrototype } from './node-types';
|
|
11
|
+
import { ColorStyle } from './visual-types';
|
|
12
|
+
import { parseColor } from '../util/parse-color';
|
|
13
|
+
import { Eventer } from '../util/eventer';
|
|
14
|
+
import * as Path from '../util/path';
|
|
15
|
+
import * as SVG from '@svgdotjs/svg.js';
|
|
16
|
+
import * as UID from '../util/uid';
|
|
17
|
+
import hasProp from '../util/has-prop';
|
|
18
|
+
import EventEmitter from '../util/emitter';
|
|
19
|
+
import '../events/events';
|
|
20
|
+
import WorkspaceController from '../controllers/base';
|
|
21
|
+
import WASDController from '../controllers/wasd';
|
|
22
|
+
import { RMap } from './renderer-map';
|
|
23
|
+
import { Styler } from '../util/styler';
|
|
24
|
+
import Widget from './widget';
|
|
25
|
+
import escapeAttr from '../util/escape-html';
|
|
26
|
+
import unescapeAttr from '../util/unescape-html';
|
|
27
|
+
import waitFrames from '../util/wait-anim-frames';
|
|
28
|
+
import CommentModel from './comment';
|
|
29
|
+
import CommentRenderer from '../comment-renderer/renderer';
|
|
30
|
+
import Representer from '../renderers/representer';
|
|
31
|
+
import { RepresenterNode } from '../renderers/representer-node';
|
|
32
|
+
import { addWindowListener, clearWindowListeners, removeWindowListener } from '../util/window-listeners';
|
|
33
|
+
import * as FontManager from './fonts-manager';
|
|
34
|
+
import Workspace from './workspace';
|
|
35
|
+
import injectHeadless from './inject-headless';
|
|
36
|
+
import createHeadlessNode from './headless-node';
|
|
37
|
+
import * as apollo from '../renderers/apollo/apollo';
|
|
38
|
+
import * as atlas from '../renderers/atlas/atlas';
|
|
39
|
+
/**
|
|
40
|
+
* Central Kabel object exposing all main modules, utilities, and defaults
|
|
41
|
+
*/
|
|
42
|
+
declare const Kabel: {
|
|
43
|
+
env: {
|
|
44
|
+
isBrowser: boolean;
|
|
45
|
+
isNode: boolean;
|
|
46
|
+
isWebWorker: boolean;
|
|
47
|
+
};
|
|
48
|
+
UIX: {
|
|
49
|
+
/** Event manager, loads events from '../events' and lets us attach them to svg.js elements to give them behavior that's seperated from the renderer. */
|
|
50
|
+
events: Eventer;
|
|
51
|
+
/** Font manager, used to load fonts. */
|
|
52
|
+
FontManager: typeof FontManager;
|
|
53
|
+
/** * State Manager, Makes things possible: E.G (the 'typing' state when you type in a input box..) * Used in controllers so you dont move when typing characters like a w s or d etc. */
|
|
54
|
+
userState: import("../util/user-state").UserState;
|
|
55
|
+
/** Window listeners manager */
|
|
56
|
+
windowListeners: {
|
|
57
|
+
addWindowListener: typeof addWindowListener;
|
|
58
|
+
removeWindowListener: typeof removeWindowListener;
|
|
59
|
+
clearWindowListeners: typeof clearWindowListeners;
|
|
60
|
+
windowListeners: {
|
|
61
|
+
resize: ((event: Event) => void)[];
|
|
62
|
+
scroll: ((event: Event) => void)[];
|
|
63
|
+
blur: ((event: Event) => void)[];
|
|
64
|
+
focus: ((event: Event) => void)[];
|
|
65
|
+
visibilitychange: ((event: Event) => void)[];
|
|
66
|
+
pointerlockchange: ((event: Event) => void)[];
|
|
67
|
+
beforeunload: ((event: Event) => void)[];
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
Themes: {
|
|
72
|
+
Classic: import("./workspace-svg").WSTheme;
|
|
73
|
+
Dark: import("./workspace-svg").WSTheme;
|
|
74
|
+
};
|
|
75
|
+
/** Context menu manager */
|
|
76
|
+
ContextMenu: {
|
|
77
|
+
registerOption(id: string, option: Omit<import("./context-menu").ContextMenuOpts, "id">): void;
|
|
78
|
+
unregisterOption(id: string): void;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Utility methods and constants for various purposes.
|
|
82
|
+
* @property Path - Utility methods for handling SVG paths.
|
|
83
|
+
* @property waitFrames - Utility method to wait for a certain number of animation frames.
|
|
84
|
+
*/
|
|
85
|
+
Utils: {
|
|
86
|
+
Path: typeof Path;
|
|
87
|
+
waitFrames: typeof waitFrames;
|
|
88
|
+
SVG: typeof SVG;
|
|
89
|
+
parseColor: typeof parseColor;
|
|
90
|
+
UID: typeof UID;
|
|
91
|
+
EventEmitter: typeof EventEmitter;
|
|
92
|
+
hasProp: typeof hasProp;
|
|
93
|
+
styler: Styler;
|
|
94
|
+
Styler: typeof Styler;
|
|
95
|
+
escapeHTML: typeof escapeAttr;
|
|
96
|
+
unescapeHTML: typeof unescapeAttr;
|
|
97
|
+
};
|
|
98
|
+
Widget: typeof Widget;
|
|
99
|
+
CategoryColors: {
|
|
100
|
+
[key: string]: ColorStyle;
|
|
101
|
+
};
|
|
102
|
+
Connection: typeof Connection;
|
|
103
|
+
Coordinates: typeof Coordinates;
|
|
104
|
+
Field: typeof Field;
|
|
105
|
+
DummyField: typeof DummyField;
|
|
106
|
+
FieldMap: {
|
|
107
|
+
[key: string]: AnyFieldCls;
|
|
108
|
+
field_both: typeof OptConnectField;
|
|
109
|
+
field_string: typeof TextField;
|
|
110
|
+
field_num: typeof NumberField;
|
|
111
|
+
field_dummy: typeof DummyField;
|
|
112
|
+
field_str: typeof TextField;
|
|
113
|
+
connection: typeof import("./field").ConnectableField;
|
|
114
|
+
};
|
|
115
|
+
NumberField: typeof NumberField;
|
|
116
|
+
OptConnectField: typeof OptConnectField;
|
|
117
|
+
TextField: typeof TextField;
|
|
118
|
+
inject: typeof inject;
|
|
119
|
+
injectHeadless: typeof injectHeadless;
|
|
120
|
+
createHeadlessNode: typeof createHeadlessNode;
|
|
121
|
+
InjectMsg: typeof InjectMsg;
|
|
122
|
+
clearMainWorkspace: typeof clearMainWorkspace;
|
|
123
|
+
getMainWorkspace: typeof getMainWorkspace;
|
|
124
|
+
setMainWorkspace: typeof setMainWorkspace;
|
|
125
|
+
NodeSvg: typeof NodeSvg;
|
|
126
|
+
Nodes: {
|
|
127
|
+
[key: string]: NodePrototype;
|
|
128
|
+
};
|
|
129
|
+
Widgets: import("./widget-prototypes").WidgetPrototypeList;
|
|
130
|
+
WorkspaceSvg: typeof WorkspaceSvg;
|
|
131
|
+
Workspace: typeof Workspace;
|
|
132
|
+
WorkspaceController: typeof WorkspaceController;
|
|
133
|
+
WASDController: typeof WASDController;
|
|
134
|
+
nodeRendering: {
|
|
135
|
+
SVG: typeof SVG;
|
|
136
|
+
rendererMap: typeof RMap;
|
|
137
|
+
Apollo: typeof apollo;
|
|
138
|
+
Atlas: typeof atlas;
|
|
139
|
+
Renderer: typeof Renderer;
|
|
140
|
+
RendererConstants: typeof RendererConstants;
|
|
141
|
+
Representer: typeof Representer;
|
|
142
|
+
RepresenterNode: typeof RepresenterNode;
|
|
143
|
+
};
|
|
144
|
+
atlas: typeof atlas;
|
|
145
|
+
apollo: typeof apollo;
|
|
146
|
+
commentRendering: {
|
|
147
|
+
CommentModel: typeof CommentModel;
|
|
148
|
+
CommentRenderer: typeof CommentRenderer;
|
|
149
|
+
};
|
|
150
|
+
Dropdown: import("./dropdown-menu").DropdownContainer;
|
|
151
|
+
};
|
|
152
|
+
export default Kabel;
|
|
153
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,wBAAwB,CAAA;AACtD,OAAO,QAAQ,MAAM,uBAAuB,CAAA;AAE5C,OAAO,UAA2B,MAAM,cAAc,CAAA;AACtD,OAAO,WAAW,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,EAAE,EAGV,WAAW,EAEX,UAAU,EAEV,WAAW,EACX,eAAe,EACf,SAAS,EACZ,MAAM,SAAS,CAAA;AAChB,OAAO,MAAM,EAAE,EAAE,SAAS,EAAiB,MAAM,UAAU,CAAA;AAC3D,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,kBAAkB,CAAA;AACzB,OAAO,OAAiD,MAAM,WAAW,CAAA;AAEzE,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,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6BlD;;GAEG;AACH,QAAA,MAAM,KAAK;;;;;;;QAGH,wJAAwJ;gBACrI,OAAO;QAC1B,wCAAwC;;QAExC,yLAAyL;;QAEzL,+BAA+B;;;;;;;;;;;;;;;;;;;;IAYnC,2BAA2B;;;;;IAE3B;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDN,CAAA;AAwBD,eAAe,KAAK,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ContextMenuOpts } from "./context-menu";
|
|
2
|
+
/** Registry for all context menu options */
|
|
3
|
+
declare const ContextOptsRegistry: ContextMenuOpts[];
|
|
4
|
+
/**
|
|
5
|
+
* Global context menu manager
|
|
6
|
+
*/
|
|
7
|
+
declare const ContextMenu: {
|
|
8
|
+
/**
|
|
9
|
+
* Register a new context menu option
|
|
10
|
+
* @param id - Unique identifier for the option
|
|
11
|
+
* @param option - Configuration for the context menu item
|
|
12
|
+
*/
|
|
13
|
+
registerOption(id: string, option: Omit<ContextMenuOpts, "id">): void;
|
|
14
|
+
/**
|
|
15
|
+
* Unregister an existing context menu option by ID
|
|
16
|
+
* @param id - ID of the option to remove
|
|
17
|
+
*/
|
|
18
|
+
unregisterOption(id: string): void;
|
|
19
|
+
};
|
|
20
|
+
export { ContextMenu };
|
|
21
|
+
export default ContextOptsRegistry;
|
|
22
|
+
//# sourceMappingURL=ctx-menu-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ctx-menu-registry.d.ts","sourceRoot":"","sources":["../../src/ctx-menu-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAY,MAAM,gBAAgB,CAAC;AAI3D,4CAA4C;AAC5C,QAAA,MAAM,mBAAmB,EAAE,eAAe,EAAO,CAAC;AAElD;;GAEG;AACH,QAAA,MAAM,WAAW;IACb;;;;OAIG;uBACgB,MAAM,UAAU,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC;IAY9D;;;OAGG;yBACkB,MAAM;CAI9B,CAAC;AAwGF,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { AnyField } from "./field";
|
|
2
|
+
import NodeSvg from "./nodesvg";
|
|
3
|
+
/**
|
|
4
|
+
* Allowed owner types for the dropdown container.
|
|
5
|
+
* Can be either a NodeSvg or a Field.
|
|
6
|
+
*/
|
|
7
|
+
export type AllowedOwner = NodeSvg | AnyField;
|
|
8
|
+
/**
|
|
9
|
+
* Options for creating a dropdown menu.
|
|
10
|
+
*/
|
|
11
|
+
export interface DropdownOptions {
|
|
12
|
+
/** List of items to display in the dropdown */
|
|
13
|
+
items: {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
17
|
+
/** Callback when an item is selected */
|
|
18
|
+
onSelect?: (value: string, item: {
|
|
19
|
+
label: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
/** Optional fixed width of the dropdown */
|
|
23
|
+
width?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Dropdown container for NodeSvg or Field elements.
|
|
27
|
+
* Supports singleton behavior (only one dropdown visible at a time).
|
|
28
|
+
*/
|
|
29
|
+
declare class DropdownContainer {
|
|
30
|
+
private static current;
|
|
31
|
+
private owner;
|
|
32
|
+
private rootEl;
|
|
33
|
+
private options;
|
|
34
|
+
private constraint;
|
|
35
|
+
private offset;
|
|
36
|
+
private currentRemoveListener;
|
|
37
|
+
/**
|
|
38
|
+
* Creates the dropdown container and attaches it to the DOM.
|
|
39
|
+
*/
|
|
40
|
+
constructor();
|
|
41
|
+
/**
|
|
42
|
+
* Move the dropdown by an offset.
|
|
43
|
+
* @param dx - horizontal offset
|
|
44
|
+
* @param dy - vertical offset
|
|
45
|
+
*/
|
|
46
|
+
move(dx: number, dy: number): void;
|
|
47
|
+
/**
|
|
48
|
+
* Update the dropdown position based on constraint and offset.
|
|
49
|
+
*/
|
|
50
|
+
private updatePosition;
|
|
51
|
+
/**
|
|
52
|
+
* Set inner HTML content of the dropdown.
|
|
53
|
+
* @param html - HTML string
|
|
54
|
+
*/
|
|
55
|
+
setContent(html: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Append an element as a child to the dropdown.
|
|
58
|
+
* @param element - Element to append
|
|
59
|
+
* @returns The appended element
|
|
60
|
+
*/
|
|
61
|
+
appendChild(element: Element): Element;
|
|
62
|
+
/**
|
|
63
|
+
* Show the dropdown for a given owner.
|
|
64
|
+
* @param owner - NodeSvg or Field that owns this dropdown
|
|
65
|
+
* @param options - Dropdown configuration options
|
|
66
|
+
*/
|
|
67
|
+
show(owner: AllowedOwner, options: DropdownOptions): void;
|
|
68
|
+
/**
|
|
69
|
+
* Hide this dropdown.
|
|
70
|
+
*/
|
|
71
|
+
hide(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Hide this dropdown if the given owner currently owns it.
|
|
74
|
+
* @param owner - The owner to check
|
|
75
|
+
*/
|
|
76
|
+
hideIfOwner(owner: AllowedOwner): void;
|
|
77
|
+
/** @returns True if the dropdown is currently visible */
|
|
78
|
+
isVisible(): boolean;
|
|
79
|
+
/** @returns The current owner of the dropdown, or null if none */
|
|
80
|
+
getOwner(): AllowedOwner | null;
|
|
81
|
+
/** @returns The currently visible dropdown container singleton */
|
|
82
|
+
static getCurrent(): DropdownContainer | null;
|
|
83
|
+
}
|
|
84
|
+
declare const dropdownContainer: DropdownContainer;
|
|
85
|
+
export default dropdownContainer;
|
|
86
|
+
export { DropdownContainer };
|
|
87
|
+
//# sourceMappingURL=dropdown-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../src/dropdown-menu.ts"],"names":[],"mappings":"AACA,OAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1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