@kabel-project/kabel 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/dist/comment-renderer/renderer.d.ts +32 -0
  2. package/dist/comment-renderer/renderer.d.ts.map +1 -0
  3. package/dist/controllers/base.d.ts +39 -0
  4. package/dist/controllers/base.d.ts.map +1 -0
  5. package/dist/controllers/wasd.d.ts +33 -0
  6. package/dist/controllers/wasd.d.ts.map +1 -0
  7. package/dist/events/comment-drag-handle.d.ts +2 -0
  8. package/dist/events/comment-drag-handle.d.ts.map +1 -0
  9. package/dist/events/comment-input.d.ts +4 -0
  10. package/dist/events/comment-input.d.ts.map +1 -0
  11. package/dist/events/connection-line.d.ts +2 -0
  12. package/dist/events/connection-line.d.ts.map +1 -0
  13. package/dist/events/connector.d.ts +2 -0
  14. package/dist/events/connector.d.ts.map +1 -0
  15. package/dist/events/draggable.d.ts +2 -0
  16. package/dist/events/draggable.d.ts.map +1 -0
  17. package/{events/events.ts → dist/events/events.d.ts} +8 -7
  18. package/dist/events/events.d.ts.map +1 -0
  19. package/dist/events/input-box.d.ts +2 -0
  20. package/dist/events/input-box.d.ts.map +1 -0
  21. package/dist/events/node-x-btn.d.ts +2 -0
  22. package/dist/events/node-x-btn.d.ts.map +1 -0
  23. package/dist/kabel.js +2 -0
  24. package/dist/kabel.js.map +1 -0
  25. package/dist/renderers/apollo/apollo.d.ts +12 -0
  26. package/dist/renderers/apollo/apollo.d.ts.map +1 -0
  27. package/dist/renderers/apollo/constants.d.ts +21 -0
  28. package/dist/renderers/apollo/constants.d.ts.map +1 -0
  29. package/dist/renderers/apollo/renderer.d.ts +97 -0
  30. package/dist/renderers/apollo/renderer.d.ts.map +1 -0
  31. package/{renderers/atlas/atlas.ts → dist/renderers/atlas/atlas.d.ts} +6 -15
  32. package/dist/renderers/atlas/atlas.d.ts.map +1 -0
  33. package/dist/renderers/constants.d.ts +51 -0
  34. package/dist/renderers/constants.d.ts.map +1 -0
  35. package/dist/renderers/renderer.d.ts +470 -0
  36. package/dist/renderers/renderer.d.ts.map +1 -0
  37. package/dist/renderers/representer-node.d.ts +27 -0
  38. package/dist/renderers/representer-node.d.ts.map +1 -0
  39. package/dist/renderers/representer.d.ts +13 -0
  40. package/dist/renderers/representer.d.ts.map +1 -0
  41. package/dist/src/category.d.ts +48 -0
  42. package/dist/src/category.d.ts.map +1 -0
  43. package/{src/colors.ts → dist/src/colors.d.ts} +21 -20
  44. package/dist/src/colors.d.ts.map +1 -0
  45. package/dist/src/comment.d.ts +88 -0
  46. package/dist/src/comment.d.ts.map +1 -0
  47. package/dist/src/connection.d.ts +52 -0
  48. package/dist/src/connection.d.ts.map +1 -0
  49. package/dist/src/context-menu.d.ts +76 -0
  50. package/dist/src/context-menu.d.ts.map +1 -0
  51. package/dist/src/coordinates.d.ts +52 -0
  52. package/dist/src/coordinates.d.ts.map +1 -0
  53. package/dist/src/core.d.ts +153 -0
  54. package/dist/src/core.d.ts.map +1 -0
  55. package/dist/src/ctx-menu-registry.d.ts +22 -0
  56. package/dist/src/ctx-menu-registry.d.ts.map +1 -0
  57. package/dist/src/dropdown-menu.d.ts +87 -0
  58. package/dist/src/dropdown-menu.d.ts.map +1 -0
  59. package/dist/src/field.d.ts +305 -0
  60. package/dist/src/field.d.ts.map +1 -0
  61. package/dist/src/flyout.d.ts +41 -0
  62. package/dist/src/flyout.d.ts.map +1 -0
  63. package/dist/src/fonts-manager.d.ts +6 -0
  64. package/dist/src/fonts-manager.d.ts.map +1 -0
  65. package/dist/src/grid.d.ts +60 -0
  66. package/dist/src/grid.d.ts.map +1 -0
  67. package/dist/src/headless-node.d.ts +11 -0
  68. package/dist/src/headless-node.d.ts.map +1 -0
  69. package/dist/src/index.d.ts +38 -0
  70. package/dist/src/index.d.ts.map +1 -0
  71. package/dist/src/inject-headless.d.ts +4 -0
  72. package/dist/src/inject-headless.d.ts.map +1 -0
  73. package/{src/inject.ts → dist/src/inject.d.ts} +142 -213
  74. package/dist/src/inject.d.ts.map +1 -0
  75. package/{src/main-workspace.ts → dist/src/main-workspace.d.ts} +31 -51
  76. package/dist/src/main-workspace.d.ts.map +1 -0
  77. package/dist/src/mutator.d.ts +2 -0
  78. package/dist/src/mutator.d.ts.map +1 -0
  79. package/{src/node-types.ts → dist/src/node-types.d.ts} +26 -27
  80. package/dist/src/node-types.d.ts.map +1 -0
  81. package/dist/src/nodesvg.d.ts +266 -0
  82. package/dist/src/nodesvg.d.ts.map +1 -0
  83. package/{src/prototypes.ts → dist/src/prototypes.d.ts} +10 -9
  84. package/dist/src/prototypes.d.ts.map +1 -0
  85. package/{src/renderer-map.ts → dist/src/renderer-map.d.ts} +51 -86
  86. package/dist/src/renderer-map.d.ts.map +1 -0
  87. package/dist/src/toolbox.d.ts +51 -0
  88. package/dist/src/toolbox.d.ts.map +1 -0
  89. package/{src/types.ts → dist/src/types.d.ts} +159 -205
  90. package/dist/src/types.d.ts.map +1 -0
  91. package/dist/src/undo-redo.d.ts +15 -0
  92. package/dist/src/undo-redo.d.ts.map +1 -0
  93. package/{src/visual-types.ts → dist/src/visual-types.d.ts} +34 -29
  94. package/dist/src/visual-types.d.ts.map +1 -0
  95. package/dist/src/widget-prototypes.d.ts +10 -0
  96. package/dist/src/widget-prototypes.d.ts.map +1 -0
  97. package/dist/src/widget.d.ts +62 -0
  98. package/dist/src/widget.d.ts.map +1 -0
  99. package/{src/workspace-coords.ts → dist/src/workspace-coords.d.ts} +10 -14
  100. package/dist/src/workspace-coords.d.ts.map +1 -0
  101. package/dist/src/workspace-svg.d.ts +371 -0
  102. package/dist/src/workspace-svg.d.ts.map +1 -0
  103. package/dist/src/workspace.d.ts +50 -0
  104. package/dist/src/workspace.d.ts.map +1 -0
  105. package/dist/themes/dark.d.ts +4 -0
  106. package/dist/themes/dark.d.ts.map +1 -0
  107. package/dist/themes/default.d.ts +4 -0
  108. package/dist/themes/default.d.ts.map +1 -0
  109. package/dist/themes/themes.d.ts +6 -0
  110. package/dist/themes/themes.d.ts.map +1 -0
  111. package/dist/util/emitter.d.ts +10 -0
  112. package/dist/util/emitter.d.ts.map +1 -0
  113. package/dist/util/env.d.ts +7 -0
  114. package/dist/util/env.d.ts.map +1 -0
  115. package/{util/escape-html.ts → dist/util/escape-html.d.ts} +16 -22
  116. package/dist/util/escape-html.d.ts.map +1 -0
  117. package/dist/util/eventer.d.ts +29 -0
  118. package/dist/util/eventer.d.ts.map +1 -0
  119. package/dist/util/has-prop.d.ts +2 -0
  120. package/dist/util/has-prop.d.ts.map +1 -0
  121. package/dist/util/parse-color.d.ts +6 -0
  122. package/dist/util/parse-color.d.ts.map +1 -0
  123. package/dist/util/path.d.ts +25 -0
  124. package/dist/util/path.d.ts.map +1 -0
  125. package/dist/util/styler.d.ts +12 -0
  126. package/dist/util/styler.d.ts.map +1 -0
  127. package/dist/util/uid.d.ts +42 -0
  128. package/dist/util/uid.d.ts.map +1 -0
  129. package/{util/unescape-html.ts → dist/util/unescape-html.d.ts} +16 -22
  130. package/dist/util/unescape-html.d.ts.map +1 -0
  131. package/dist/util/user-state.d.ts +37 -0
  132. package/dist/util/user-state.d.ts.map +1 -0
  133. package/{util/wait-anim-frames.ts → dist/util/wait-anim-frames.d.ts} +11 -24
  134. package/dist/util/wait-anim-frames.d.ts.map +1 -0
  135. package/dist/util/window-listeners.d.ts +8 -0
  136. package/dist/util/window-listeners.d.ts.map +1 -0
  137. package/package.json +5 -2
  138. package/(1.0.7)kabel.md +0 -18
  139. package/_READ_ME_MEDIA_/documentation/docs.md +0 -293
  140. package/_READ_ME_MEDIA_/workspace.png +0 -0
  141. package/comment-renderer/renderer.ts +0 -228
  142. package/controllers/base.ts +0 -186
  143. package/controllers/wasd.ts +0 -132
  144. package/docs/README.md +0 -98
  145. package/docs/_media/docs.md +0 -289
  146. package/docs/_media/workspace.png +0 -0
  147. package/docs/classes/CommentModel.md +0 -271
  148. package/docs/classes/CommentRenderer.md +0 -457
  149. package/docs/classes/ConnectableField.md +0 -597
  150. package/docs/classes/Connection.md +0 -191
  151. package/docs/classes/ContextMenuHTML.md +0 -163
  152. package/docs/classes/Coordinates.md +0 -187
  153. package/docs/classes/DropdownContainer.md +0 -300
  154. package/docs/classes/DummyField.md +0 -393
  155. package/docs/classes/Eventer.md +0 -185
  156. package/docs/classes/Field.md +0 -461
  157. package/docs/classes/InjectMsg.md +0 -85
  158. package/docs/classes/NodeSvg.md +0 -1011
  159. package/docs/classes/NumberField.md +0 -559
  160. package/docs/classes/OptConnectField.md +0 -624
  161. package/docs/classes/Renderer.md +0 -1636
  162. package/docs/classes/RendererConstants.md +0 -343
  163. package/docs/classes/Representer.md +0 -95
  164. package/docs/classes/RepresenterNode.md +0 -175
  165. package/docs/classes/TextField.md +0 -559
  166. package/docs/classes/Toolbox.md +0 -172
  167. package/docs/classes/WASDController.md +0 -616
  168. package/docs/classes/Widget.md +0 -195
  169. package/docs/classes/WorkspaceController.md +0 -385
  170. package/docs/classes/WorkspaceCoords.md +0 -218
  171. package/docs/classes/WorkspaceSvg.md +0 -1380
  172. package/docs/functions/clearMainWorkspace.md +0 -20
  173. package/docs/functions/getMainWorkspace.md +0 -19
  174. package/docs/functions/inject.md +0 -35
  175. package/docs/functions/setMainWorkspace.md +0 -28
  176. package/docs/globals.md +0 -95
  177. package/docs/interfaces/ColorStyle.md +0 -43
  178. package/docs/interfaces/ConnectorToFrom.md +0 -57
  179. package/docs/interfaces/DrawState.md +0 -81
  180. package/docs/interfaces/FieldConnectionData.md +0 -25
  181. package/docs/interfaces/FieldOptions.md +0 -63
  182. package/docs/interfaces/FieldRawBoxData.md +0 -25
  183. package/docs/interfaces/FieldVisualInfo.md +0 -65
  184. package/docs/interfaces/GridOptions.md +0 -61
  185. package/docs/interfaces/InjectOptions.md +0 -133
  186. package/docs/interfaces/InputFieldJson.md +0 -50
  187. package/docs/interfaces/KabelCommentRendering.md +0 -31
  188. package/docs/interfaces/KabelInterface.md +0 -469
  189. package/docs/interfaces/KabelNodeRendering.md +0 -77
  190. package/docs/interfaces/KabelUIX.md +0 -105
  191. package/docs/interfaces/KabelUtils.md +0 -215
  192. package/docs/interfaces/NodeEvents.md +0 -42
  193. package/docs/interfaces/NodeJson.md +0 -104
  194. package/docs/interfaces/NodePrototype.md +0 -82
  195. package/docs/interfaces/RegisteredEl.md +0 -53
  196. package/docs/interfaces/SerializedNode.md +0 -128
  197. package/docs/interfaces/TblxCategoryStruct.md +0 -41
  198. package/docs/interfaces/TblxFieldStruct.md +0 -28
  199. package/docs/interfaces/TblxNodeStruct.md +0 -35
  200. package/docs/interfaces/WidgetOptions.md +0 -115
  201. package/docs/interfaces/WidgetPrototypeList.md +0 -15
  202. package/docs/type-aliases/AnyField.md +0 -13
  203. package/docs/type-aliases/AnyFieldCls.md +0 -13
  204. package/docs/type-aliases/Color.md +0 -13
  205. package/docs/type-aliases/Connectable.md +0 -13
  206. package/docs/type-aliases/EventArgs.md +0 -11
  207. package/docs/type-aliases/EventSetupFn.md +0 -25
  208. package/docs/type-aliases/Hex.md +0 -13
  209. package/docs/type-aliases/RGBObject.md +0 -37
  210. package/docs/type-aliases/RGBString.md +0 -13
  211. package/docs/type-aliases/RGBTuple.md +0 -13
  212. package/docs/type-aliases/TblxObjStruct.md +0 -52
  213. package/docs/variables/CategoryColors.md +0 -29
  214. package/docs/variables/FieldMap.md +0 -41
  215. package/docs/variables/NodePrototypes.md +0 -18
  216. package/docs/variables/default.md +0 -11
  217. package/events/comment-drag-handle.ts +0 -61
  218. package/events/comment-input.ts +0 -291
  219. package/events/connection-line.ts +0 -68
  220. package/events/connector.ts +0 -116
  221. package/events/draggable.ts +0 -119
  222. package/events/input-box.ts +0 -213
  223. package/events/node-x-btn.ts +0 -25
  224. package/index.d.ts +0 -4
  225. package/renderers/apollo/apollo.ts +0 -21
  226. package/renderers/apollo/constants.ts +0 -40
  227. package/renderers/apollo/renderer.ts +0 -331
  228. package/renderers/constants.ts +0 -87
  229. package/renderers/renderer.ts +0 -1288
  230. package/renderers/representer-node.ts +0 -52
  231. package/renderers/representer.ts +0 -25
  232. package/src/category.ts +0 -107
  233. package/src/comment.ts +0 -142
  234. package/src/connection.ts +0 -114
  235. package/src/context-menu.ts +0 -194
  236. package/src/coordinates.ts +0 -74
  237. package/src/core.ts +0 -202
  238. package/src/ctx-menu-registry.ts +0 -143
  239. package/src/dropdown-menu.ts +0 -215
  240. package/src/field.ts +0 -595
  241. package/src/flyout.ts +0 -165
  242. package/src/fonts-manager.ts +0 -38
  243. package/src/grid.ts +0 -162
  244. package/src/headless-node.ts +0 -27
  245. package/src/index.ts +0 -115
  246. package/src/inject-headless.ts +0 -18
  247. package/src/mutator.ts +0 -40
  248. package/src/nodesvg.ts +0 -756
  249. package/src/styles.css +0 -224
  250. package/src/toolbox.ts +0 -125
  251. package/src/undo-redo.ts +0 -87
  252. package/src/widget-prototypes.ts +0 -11
  253. package/src/widget.ts +0 -139
  254. package/src/workspace-svg.ts +0 -736
  255. package/src/workspace.ts +0 -155
  256. package/test-server.js +0 -61
  257. package/themes/dark.ts +0 -32
  258. package/themes/default.ts +0 -28
  259. package/themes/themes.ts +0 -9
  260. package/tsconfig.json +0 -25
  261. package/typedoc.json +0 -10
  262. package/util/emitter.ts +0 -33
  263. package/util/env.ts +0 -11
  264. package/util/eventer.ts +0 -108
  265. package/util/has-prop.ts +0 -4
  266. package/util/parse-color.ts +0 -42
  267. package/util/path.ts +0 -99
  268. package/util/styler.ts +0 -41
  269. package/util/uid.ts +0 -184
  270. package/util/user-state.ts +0 -68
  271. package/util/window-listeners.ts +0 -62
  272. package/webpack.config.js +0 -80
  273. /package/{docs/_media → dist}/index.html +0 -0
@@ -0,0 +1,371 @@
1
+ import NodeSvg from "./nodesvg";
2
+ import { Svg, Rect } from '@svgdotjs/svg.js';
3
+ import Renderer from '../renderers/renderer';
4
+ import { InjectOptions } from "./inject";
5
+ import WorkspaceCoords from "./workspace-coords";
6
+ import WorkspaceController from '../controllers/base';
7
+ import Toolbox from "./toolbox";
8
+ import NodePrototypes from "./prototypes";
9
+ import Widget from "./widget";
10
+ import ContextMenuHTML from "./context-menu";
11
+ import CommentModel from "./comment";
12
+ import Grid from "./grid";
13
+ import UndoRedoHistory from "./undo-redo";
14
+ import Workspace from "./workspace";
15
+ import { Color } from "./visual-types";
16
+ export interface IDragState {
17
+ isDragging: boolean;
18
+ startX: number;
19
+ startY: number;
20
+ lastX: number;
21
+ lastY: number;
22
+ deltaX: number;
23
+ deltaY: number;
24
+ offsetX: number;
25
+ offsetY: number;
26
+ node: NodeSvg | null;
27
+ }
28
+ export interface WSTheme {
29
+ UIStyles?: {
30
+ workspaceBGColor?: Color;
31
+ toolboxCategoriesBG?: Partial<CSSStyleDeclaration>;
32
+ toolboxFlyoutBG?: Partial<CSSStyleDeclaration>;
33
+ };
34
+ }
35
+ /**
36
+ * Represents the visual workspace containing nodes and connections.
37
+ * Handles rendering, panning, and coordinate transformations.
38
+ */
39
+ declare class WorkspaceSvg extends Workspace {
40
+ static get BACKGROUND_CLASS(): string;
41
+ /**
42
+ * Theme of the workspace
43
+ */
44
+ theme: WSTheme;
45
+ /**
46
+ * Workspace background pattern items.
47
+ */
48
+ grid?: Grid;
49
+ /** Top-left offset of the workspace viewport */
50
+ _camera: WorkspaceCoords;
51
+ /** Node storage by unique ID */
52
+ _nodeDB: Map<string, NodeSvg>;
53
+ /** Root HTML container for the workspace */
54
+ _root: HTMLElement;
55
+ /** Top-level wrapper for the SVG */
56
+ _wsTop: HTMLElement;
57
+ /** SVG.js instance for rendering */
58
+ svg: Svg;
59
+ /** The background element */
60
+ _backgroundRect: Rect;
61
+ /** Renderer instance for drawing nodes and connections */
62
+ renderer: Renderer;
63
+ /** Options for workspace behavior and rendering overrides */
64
+ options: InjectOptions;
65
+ /** Flag to temporarily prevent redraws */
66
+ noRedraw: boolean;
67
+ /**
68
+ * A class instance that moves the camera based on user interactions.
69
+ */
70
+ controller: WorkspaceController;
71
+ /**
72
+ * Toolbox for the workspace.
73
+ */
74
+ toolbox?: Toolbox;
75
+ /**
76
+ * A list of widgets active in this workspace
77
+ */
78
+ _widgetDB: Map<string, Widget>;
79
+ /**
80
+ * A manager for the context menu widget
81
+ */
82
+ _ctxMenu: ContextMenuHTML;
83
+ /**
84
+ * A list of comments for this workspace.
85
+ */
86
+ _commentDB: Set<CommentModel>;
87
+ /**
88
+ * Undo/redo history
89
+ */
90
+ history: UndoRedoHistory;
91
+ /**
92
+ * Whether to record undo/redo history or not
93
+ */
94
+ recordHistory: boolean;
95
+ /**
96
+ * Stack of old recordHistory values for toggleHistory
97
+ */
98
+ recordHistoryRecord: boolean[];
99
+ /**
100
+ * Internal flag to indicate if the camera has moved this frame.
101
+ */
102
+ _didMove: boolean;
103
+ /**
104
+ * Listeners to call when the workspace moves.
105
+ */
106
+ moveListeners: (() => void)[];
107
+ /** Current drag state for node dragging */
108
+ dragState: IDragState | null;
109
+ /**
110
+ * Creates a new WorkspaceSvg instance.
111
+ * @param root - The root HTML element containing the workspace.
112
+ * @param wsTop - The top-level wrapper element for the SVG.
113
+ * @param options - Configuration and renderer override options.
114
+ */
115
+ constructor(root: HTMLElement, wsTop: HTMLElement, options: InjectOptions);
116
+ setTheme(theme: WSTheme): void;
117
+ /**
118
+ * Getter and setter for whether we moved or not this frame.
119
+ */
120
+ get didMove(): boolean;
121
+ set didMove(value: boolean);
122
+ /**
123
+ * Sets the drag state of the workspace.
124
+ * @param params - Drag state parameters.
125
+ * @returns Void.
126
+ */
127
+ setDragState(params: {
128
+ node: NodeSvg | null;
129
+ startX: number;
130
+ startY: number;
131
+ currentX: number;
132
+ currentY: number;
133
+ offsetX?: number;
134
+ offsetY?: number;
135
+ }): void;
136
+ beginDrag(node: NodeSvg, startX: number, startY: number, offsetX?: number, offsetY?: number): void;
137
+ /**
138
+ * Updates the current drag position.
139
+ * @param currentX - Current X position.
140
+ * @param currentY - Current Y position.
141
+ * @returns Void.
142
+ */
143
+ updateDrag(currentX: number, currentY: number): void;
144
+ endDrag(): void;
145
+ /**
146
+ * Fires all move listeners registered to this workspace.
147
+ */
148
+ fireMoveListeners(): void;
149
+ /**
150
+ * Adds a move listener to the workspace.
151
+ * @param listener - The listener function to add.
152
+ * @returns A function to remove the added listener.
153
+ */
154
+ addMoveListener(listener: () => void): () => void;
155
+ /**
156
+ * Removes a move listener from the workspace.
157
+ * @param listener - The listener function to remove.
158
+ */
159
+ removeMoveListener(listener: () => void): void;
160
+ /**
161
+ * Emits a change event for the workspace, triggering
162
+ * undo/redo history tracking.
163
+ */
164
+ emitChange(): void;
165
+ /**
166
+ * Temporarily sets the workspace's history recording state.
167
+ * Pushes the previous state onto a stack for later restoration.
168
+ *
169
+ * @param {boolean} value - Whether history recording should be enabled.
170
+ */
171
+ toggleHistory(value: boolean): void;
172
+ /**
173
+ * Restores the previous history recording state from the stack.
174
+ * Use after a temporary toggle to revert to the previous state.
175
+ */
176
+ untoggleHistory(): void;
177
+ /**
178
+ * Sets the background grid up based on user selected options.
179
+ */
180
+ _initBackground(): void;
181
+ /**
182
+ * Updates the transform of the background grid
183
+ */
184
+ _updateBackgroundTransform(): void;
185
+ /**
186
+ * Get the current zoom factor of the workspace.
187
+ * @returns - The zoom factor
188
+ */
189
+ getZoom(): number;
190
+ /**
191
+ * Refresh comments.
192
+ */
193
+ refreshComments(): void;
194
+ /**
195
+ * Get all comments
196
+ * @returns {CommentModel[]}
197
+ */
198
+ getComments(): CommentModel[];
199
+ /**
200
+ * Duplicate node data from one to another
201
+ * @param nodeSvg - The node
202
+ */
203
+ cloneNode(nodeSvg: NodeSvg): void;
204
+ /**
205
+ * Internal: Add widget to DB
206
+ * @param wdgt - The widget
207
+ */
208
+ _addWidgetToDB(wdgt: Widget): void;
209
+ /**
210
+ * Internal: Delete a widget from DB.
211
+ * @param wdgt - Widget to delete
212
+ */
213
+ _delWidgetFromDB(wdgt: Widget): void;
214
+ /**
215
+ * Create a new widget of type.
216
+ * @param type - The prototype
217
+ * @returns {Widget|void}
218
+ */
219
+ newWidget(type: string): void | Widget;
220
+ /**
221
+ * Get a widget
222
+ * @param id - Identifier
223
+ * @returns {Widget|undefined} - A widget
224
+ */
225
+ getWidget(id: string): Widget | undefined;
226
+ /**
227
+ * Returns the current width and height of the workspace's svg content size in pixels.
228
+ * Useful for camera positioning.
229
+ */
230
+ getContentSize(): {
231
+ width: number;
232
+ height: number;
233
+ };
234
+ /**
235
+ * Returns the current width and height of the workspace in pixels.
236
+ * Useful for camera centering, zoom calculations, and viewport sizing.
237
+ */
238
+ getSize(): {
239
+ width: number;
240
+ height: number;
241
+ };
242
+ /**
243
+ * Updates all connection lines & node screen positions without a full redraw.
244
+ * Used when nodes are dragged or the camera moves.
245
+ */
246
+ refresh(): void;
247
+ /** Draws all nodes in the workspace. Very heavy. */
248
+ drawAllNodes(): void;
249
+ /** Redraws the entire workspace unless noRedraw is set. */
250
+ redraw(): void;
251
+ /**
252
+ * Converts workspace coordinates to screen (SVG) coordinates.
253
+ * @param x - X position in workspace coordinates.
254
+ * @param y - Y position in workspace coordinates.
255
+ * @returns Screen coordinates as a Coordinates instance.
256
+ */
257
+ workspaceToScreen(workX: number, workY: number): {
258
+ x: number;
259
+ y: number;
260
+ };
261
+ /**
262
+ * Converts screen (SVG) coordinates to workspace coordinates.
263
+ * @param x - X position in screen coordinates.
264
+ * @param y - Y position in screen coordinates.
265
+ * @returns Workspace coordinates as a Coordinates instance.
266
+ */
267
+ screenToWorkspace(screenX: number, screenY: number): {
268
+ x: number;
269
+ y: number;
270
+ };
271
+ /**
272
+ * Draws a node by its ID.
273
+ * @param id - The ID of the node to render.
274
+ * @returns The rendered node.
275
+ */
276
+ drawNode(id: string): import("@svgdotjs/svg.js", { with: { "resolution-mode": "import" } }).G | null | undefined;
277
+ /**
278
+ * Adds a node to the workspace.
279
+ * @param node - The node instance to add.
280
+ * @param nodeId - Optional custom ID to use instead of node.id.
281
+ */
282
+ addNode(node: NodeSvg, nodeId?: string): void;
283
+ /**
284
+ * Create a new node of *type*.
285
+ * @param type - The node's prototype name.
286
+ */
287
+ newNode(type: keyof typeof NodePrototypes, add?: boolean): NodeSvg | undefined;
288
+ /**
289
+ * Spawns a node at x, y of prototype type
290
+ * @param type - The node prototype name
291
+ * @param x - X position
292
+ * @param y - Y position
293
+ * @returns {Node} - The new node
294
+ */
295
+ spawnAt(type: keyof typeof NodePrototypes, x: number, y: number): NodeSvg | undefined;
296
+ /**
297
+ * Dereference a node from all of its connected neighbors
298
+ */
299
+ derefNode(node: NodeSvg): void;
300
+ /**
301
+ * Removes a node by its ID.
302
+ * @param id - The ID of the node to remove.
303
+ */
304
+ removeNodeById(id: string): void;
305
+ /**
306
+ * Removes a node by its instance.
307
+ * @param node - The node instance to remove.
308
+ */
309
+ removeNode(node: NodeSvg): void;
310
+ /**
311
+ * Retrieves a node by its ID.
312
+ * @param id - The ID of the node.
313
+ * @returns The NodeSvg instance or undefined if not found.
314
+ */
315
+ getNode(id: string | NodeSvg): NodeSvg | undefined;
316
+ /**
317
+ * Pans the camera by the given delta values.
318
+ * @param dx - Change in X direction.
319
+ * @param dy - Change in Y direction.
320
+ */
321
+ pan(dx: number, dy: number): void;
322
+ /**
323
+ * Comment methods
324
+ */
325
+ /**
326
+ * Adds a comment, returns the model.
327
+ */
328
+ addComment(): CommentModel;
329
+ /**
330
+ * Gets a comment by id
331
+ * @param id - The comment id.
332
+ */
333
+ getComment(id: string): CommentModel | undefined;
334
+ /**
335
+ * Remove a comment by its instance or id.
336
+ * @param commentOrId - The comment instance or its id.
337
+ */
338
+ removeComment(commentOrId: CommentModel | string): boolean;
339
+ /**
340
+ * Redraw all comments in this workspace.
341
+ */
342
+ redrawComments(): void;
343
+ /**
344
+ * Deserialize this workspace from json data.
345
+ * @param json - Serialized workspace
346
+ */
347
+ fromJson(json: {
348
+ nodes: any[];
349
+ circular: boolean;
350
+ }, recordBigEvent?: boolean): void;
351
+ /**
352
+ * Serialize this workspace, optionally using circular references.
353
+ */
354
+ toJson(circular: boolean): {
355
+ circular: boolean;
356
+ nodes: (import("./nodesvg").SerializedNode | {
357
+ [id: string]: Omit<import("./nodesvg").SerializedNode, "previousConnection" | "nextConnection"> & {
358
+ previousConnection?: {
359
+ field?: import("./field").FieldOptions;
360
+ node?: string;
361
+ };
362
+ nextConnection?: {
363
+ field?: import("./field").FieldOptions;
364
+ node?: string;
365
+ };
366
+ };
367
+ })[];
368
+ };
369
+ }
370
+ export default WorkspaceSvg;
371
+ //# sourceMappingURL=workspace-svg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-svg.d.ts","sourceRoot":"","sources":["../../src/workspace-svg.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,GAAG,EAAgB,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,mBAAmB,MAAM,qBAAqB,CAAC;AAGtD,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,cAAc,MAAM,cAAc,CAAC;AAE1C,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,eAAe,MAAM,gBAAgB,CAAC;AAC7C,OAAO,YAAY,MAAM,WAAW,CAAC;AAIrC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,eAAe,MAAM,aAAa,CAAC;AAE1C,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,WAAW,UAAU;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,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,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAQrF;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,OAAO;IAsBvB;;;OAGG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM;IAYzB;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,OAAO;IAKxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS;IAKlD;;;;OAIG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAG1B;;OAEG;IAEH;;OAEG;IACH,UAAU;IAMV;;;OAGG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM;IAGrB;;;OAGG;IACH,aAAa,CAAC,WAAW,EAAE,YAAY,GAAG,MAAM;IAehD;;OAEG;IACH,cAAc;IAId;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,EAAE,cAAc,GAAE,OAAe;IAwBnF;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,OAAO;;;;;yBAXH,CAAC;wBAAoB,CAAC;;;yBAEpB,CAAC;wBAAoB,CAAC;;;;;CA8BhD;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,50 @@
1
+ import NodePrototypes from "./prototypes";
2
+ import Widget from "./widget";
3
+ import CommentModel from "./comment";
4
+ /**
5
+ * Headless workspace that holds nodes, widgets, and comments without any rendering or camera.
6
+ */
7
+ declare class Workspace {
8
+ _nodeDB: Map<string, any>;
9
+ _widgetDB: Map<string, Widget>;
10
+ _commentDB: Set<CommentModel>;
11
+ isHeadless: boolean;
12
+ constructor();
13
+ /** Node management */
14
+ addNode(node: any, nodeId?: string): void;
15
+ newNode(type: keyof typeof NodePrototypes, add?: boolean): import("./nodesvg").default | undefined;
16
+ spawnAt(type: keyof typeof NodePrototypes, x: number, y: number): import("./nodesvg").default | undefined;
17
+ getNode(id: string | any): any;
18
+ removeNodeById(id: string): void;
19
+ removeNode(node: any): void;
20
+ derefNode(node: any): void;
21
+ /** Widget management */
22
+ newWidget(type: string): Widget | void;
23
+ getWidget(id: string): Widget | undefined;
24
+ /** Comment management */
25
+ addComment(): CommentModel;
26
+ getComment(id: string): CommentModel | undefined;
27
+ removeComment(commentOrId: CommentModel | string): boolean;
28
+ getComments(): CommentModel[];
29
+ /**
30
+ * Internal: Add widget to DB
31
+ * @param wdgt - The widget
32
+ */
33
+ _addWidgetToDB(wdgt: Widget): void;
34
+ /**
35
+ * Internal: Delete a widget from DB.
36
+ * @param wdgt - Widget to delete
37
+ */
38
+ _delWidgetFromDB(wdgt: Widget): void;
39
+ /** Serialization */
40
+ fromJson(json: {
41
+ nodes: any[];
42
+ circular: boolean;
43
+ }, recordBigEvent?: boolean): void;
44
+ toJson(circular: boolean): {
45
+ circular: boolean;
46
+ nodes: any[];
47
+ };
48
+ }
49
+ export default Workspace;
50
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,cAAc,CAAC;AAE1C,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,YAAY,MAAM,WAAW,CAAC;AAIrC;;GAEG;AACH,cAAM,SAAS;IACd,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAQ;;IAO9B,sBAAsB;IACtB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM;IASlC,OAAO,CAAC,IAAI,EAAE,MAAM,OAAO,cAAc,EAAE,GAAG,GAAE,OAAc;IAQ9D,OAAO,CAAC,IAAI,EAAE,MAAM,OAAO,cAAc,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAQ/D,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG;IAKxB,cAAc,CAAC,EAAE,EAAE,MAAM;IAOzB,UAAU,CAAC,IAAI,EAAE,GAAG;IAKpB,SAAS,CAAC,IAAI,EAAE,GAAG;IAanB,wBAAwB;IACxB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAQtC,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIzC,yBAAyB;IACzB,UAAU;IAMV,UAAU,CAAC,EAAE,EAAE,MAAM;IAIrB,aAAa,CAAC,WAAW,EAAE,YAAY,GAAG,MAAM;IAShD,WAAW;IAIR;;;OAGG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM;IAG3B;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAIhC,oBAAoB;IACpB,QAAQ,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,EAAE,cAAc,GAAE,OAAe;IAcnF,MAAM,CAAC,QAAQ,EAAE,OAAO;;;;CAOxB;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { WSTheme } from '../src/workspace-svg';
2
+ declare const KabelDarkTheme: WSTheme;
3
+ export default KabelDarkTheme;
4
+ //# sourceMappingURL=dark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../themes/dark.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,QAAA,MAAM,cAAc,EAAE,OA2BrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { WSTheme } from '../src/workspace-svg';
2
+ declare const KabelWSTheme: WSTheme;
3
+ export default KabelWSTheme;
4
+ //# sourceMappingURL=default.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../themes/default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAA;AAIjD,QAAA,MAAM,YAAY,EAAE,OAqBnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare const Themes: {
2
+ Classic: import("../src/workspace-svg").WSTheme;
3
+ Dark: import("../src/workspace-svg").WSTheme;
4
+ };
5
+ export default Themes;
6
+ //# sourceMappingURL=themes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../themes/themes.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM;;;CAGX,CAAA;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,10 @@
1
+ type EventHandler<T = any> = (payload: T) => void;
2
+ declare class EventEmitter<Events extends Record<string, any>> {
3
+ private listeners;
4
+ on<K extends keyof Events>(event: K, handler: EventHandler<Events[K]>): this;
5
+ off<K extends keyof Events>(event: K, handler: EventHandler<Events[K]>): this;
6
+ emit<K extends keyof Events>(event: K, payload: Events[K]): boolean;
7
+ once<K extends keyof Events>(event: K, handler: EventHandler<Events[K]>): this;
8
+ }
9
+ export default EventEmitter;
10
+ //# sourceMappingURL=emitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../util/emitter.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;AAElD,cAAM,YAAY,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACpD,OAAO,CAAC,SAAS,CAA2D;IAE5E,EAAE,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAMrE,GAAG,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAMtE,IAAI,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAMzD,IAAI,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAQvE;AACD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ declare const env: {
2
+ isBrowser: boolean;
3
+ isNode: boolean;
4
+ isWebWorker: boolean;
5
+ };
6
+ export default env;
7
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../util/env.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,GAAG,EAAE;IACP,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACa,CAAC;AAEvC,eAAe,GAAG,CAAC"}
@@ -1,22 +1,16 @@
1
- /**
2
- * Escapes special characters in a string to their corresponding HTML entities.
3
- *
4
- * Specifically, it replaces:
5
- * - `&` with `&amp;`
6
- * - `'` with `&apos;`
7
- * - `"` with `&quot;`
8
- * - `<` with `&lt;`
9
- * - `>` with `&gt;`
10
- *
11
- * @param {string} s - The string to escape.
12
- * @returns {string} The escaped string with special characters replaced by HTML entities.
13
- */
14
- function escapeAttr(s: string): string {
15
- return s.replace(/&/g, "&amp;")
16
- .replace(/'/g, "&apos;")
17
- .replace(/"/g, "&quot;")
18
- .replace(/</g, "&lt;")
19
- .replace(/>/g, "&gt;");
20
- }
21
-
22
- export default escapeAttr;
1
+ /**
2
+ * Escapes special characters in a string to their corresponding HTML entities.
3
+ *
4
+ * Specifically, it replaces:
5
+ * - `&` with `&amp;`
6
+ * - `'` with `&apos;`
7
+ * - `"` with `&quot;`
8
+ * - `<` with `&lt;`
9
+ * - `>` with `&gt;`
10
+ *
11
+ * @param {string} s - The string to escape.
12
+ * @returns {string} The escaped string with special characters replaced by HTML entities.
13
+ */
14
+ declare function escapeAttr(s: string): string;
15
+ export default escapeAttr;
16
+ //# sourceMappingURL=escape-html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escape-html.d.ts","sourceRoot":"","sources":["../../util/escape-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,iBAAS,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAMrC;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { Element } from '@svgdotjs/svg.js';
2
+ export type EventType = string;
3
+ export type EventArgs = Record<string, any>;
4
+ export type EventSetupFn = (el: Element, args?: EventArgs) => (() => void) | void;
5
+ export interface RegisteredEl {
6
+ tags: string[];
7
+ el: Element;
8
+ type: EventType;
9
+ args?: EventArgs | undefined;
10
+ destroyFn?: (() => void) | undefined;
11
+ }
12
+ /**
13
+ * Used by the Kabel renderer to tag svg.js elements as interactable with the kabel system.
14
+ */
15
+ declare class Eventer {
16
+ private elements;
17
+ private eventRegistry;
18
+ registerEvent(type: EventType, setupFn: EventSetupFn): this;
19
+ tagElement(el: Element, tags?: string[] | string): this;
20
+ destroyByTag(tag: string): 1 | 0;
21
+ addElement(el: Element, types: EventType | EventType[], args?: EventArgs): this;
22
+ refresh(): void;
23
+ destroyElement(el: Element, type?: EventType): 1 | 0;
24
+ private setupElement;
25
+ }
26
+ declare const eventer: Eventer;
27
+ export default eventer;
28
+ export { Eventer };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,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default function hasProp(obj: object, name: string): boolean;
2
+ //# sourceMappingURL=has-prop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-prop.d.ts","sourceRoot":"","sources":["../../util/has-prop.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,WAExD"}
@@ -0,0 +1,6 @@
1
+ import type { Color, Hex } from '../src/visual-types';
2
+ /**
3
+ * Parse any Color type into a hex string "#RRGGBB"
4
+ */
5
+ export declare function parseColor(color: Color): Hex;
6
+ //# sourceMappingURL=parse-color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-color.d.ts","sourceRoot":"","sources":["../../util/parse-color.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAmC5C"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Utility functions to generate SVG path strings or translate them.
3
+ */
4
+ /** Rounded rectangle */
5
+ export declare function roundedRect(width: number, height: number, radius: number): string;
6
+ /** Rounded triangle pointing up */
7
+ export declare function roundedTri(width: number, height: number, radius: number): string;
8
+ /** Circle */
9
+ export declare function circle(radius: number): string;
10
+ /** Ellipse */
11
+ export declare function ellipse(rx: number, ry: number): string;
12
+ /** Star with n points */
13
+ export declare function star(radius: number, points?: number): string;
14
+ /** Regular polygon (triangle, pentagon, hexagon, etc) */
15
+ export declare function polygon(radius: number, sides?: number): string;
16
+ /**
17
+ * Rotate an SVG path string around a given point
18
+ * @param path - SVG path string
19
+ * @param angle - rotation angle in degrees
20
+ * @param cx - x-coordinate of rotation center (default 0)
21
+ * @param cy - y-coordinate of rotation center (default 0)
22
+ * @returns new rotated SVG path string
23
+ */
24
+ export declare function rotatePath(path: string, angle: number, cx?: number, cy?: number): string;
25
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../util/path.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,wBAAwB;AACxB,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAcjF;AAED,mCAAmC;AACnC,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAWhF;AAED,aAAa;AACb,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAO7C;AAED,cAAc;AACd,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAOtD;AAED,yBAAyB;AACzB,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,CAY/D;AAED,yDAAyD;AACzD,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,MAAM,CAWjE;AAGD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,SAAI,EAAE,EAAE,SAAI,GAAG,MAAM,CAI9E"}
@@ -0,0 +1,12 @@
1
+ declare class Styler {
2
+ private styles;
3
+ constructor();
4
+ appendStyles(id: string, css: string): void;
5
+ removeStyles(id: string): void;
6
+ updateStyles(id: string, css: string): void;
7
+ hasStyles(id: string): boolean;
8
+ }
9
+ export { Styler };
10
+ declare const styler: Styler;
11
+ export default styler;
12
+ //# sourceMappingURL=styler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styler.d.ts","sourceRoot":"","sources":["../../util/styler.ts"],"names":[],"mappings":"AAAA,cAAM,MAAM;IACX,OAAO,CAAC,MAAM,CAAgC;;IAM9C,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAU3C,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAQ9B,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAO3C,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;CAG9B;AACD,OAAO,EACH,MAAM,EACT,CAAA;AACD,QAAA,MAAM,MAAM,QAAe,CAAC;AAC5B,eAAe,MAAM,CAAC"}