@ngroznykh/papirus 0.1.0
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/LICENSE +21 -0
- package/README.md +177 -0
- package/README.ru.md +178 -0
- package/dist/constants.d.ts +21 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core/AnimationManager.d.ts +24 -0
- package/dist/core/AnimationManager.d.ts.map +1 -0
- package/dist/core/ConnectionManager.d.ts +139 -0
- package/dist/core/ConnectionManager.d.ts.map +1 -0
- package/dist/core/ContextMenuManager.d.ts +72 -0
- package/dist/core/ContextMenuManager.d.ts.map +1 -0
- package/dist/core/DiagramRenderer.d.ts +230 -0
- package/dist/core/DiagramRenderer.d.ts.map +1 -0
- package/dist/core/DragManager.d.ts +67 -0
- package/dist/core/DragManager.d.ts.map +1 -0
- package/dist/core/HistoryManager.d.ts +61 -0
- package/dist/core/HistoryManager.d.ts.map +1 -0
- package/dist/core/InteractionManager.d.ts +78 -0
- package/dist/core/InteractionManager.d.ts.map +1 -0
- package/dist/core/NavigationManager.d.ts +89 -0
- package/dist/core/NavigationManager.d.ts.map +1 -0
- package/dist/core/ResizeManager.d.ts +72 -0
- package/dist/core/ResizeManager.d.ts.map +1 -0
- package/dist/core/SearchManager.d.ts +61 -0
- package/dist/core/SearchManager.d.ts.map +1 -0
- package/dist/core/SelectionManager.d.ts +86 -0
- package/dist/core/SelectionManager.d.ts.map +1 -0
- package/dist/core/history/commands.d.ts +140 -0
- package/dist/core/history/commands.d.ts.map +1 -0
- package/dist/core/overlays/BaseOverlay.d.ts +20 -0
- package/dist/core/overlays/BaseOverlay.d.ts.map +1 -0
- package/dist/core/overlays/GridOverlay.d.ts +15 -0
- package/dist/core/overlays/GridOverlay.d.ts.map +1 -0
- package/dist/core/overlays/GuidesOverlay.d.ts +18 -0
- package/dist/core/overlays/GuidesOverlay.d.ts.map +1 -0
- package/dist/core/overlays/MiniMap.d.ts +22 -0
- package/dist/core/overlays/MiniMap.d.ts.map +1 -0
- package/dist/core/overlays/RulersOverlay.d.ts +18 -0
- package/dist/core/overlays/RulersOverlay.d.ts.map +1 -0
- package/dist/elements/Edge.d.ts +182 -0
- package/dist/elements/Edge.d.ts.map +1 -0
- package/dist/elements/Element.d.ts +131 -0
- package/dist/elements/Element.d.ts.map +1 -0
- package/dist/elements/Group.d.ts +65 -0
- package/dist/elements/Group.d.ts.map +1 -0
- package/dist/elements/Node.d.ts +188 -0
- package/dist/elements/Node.d.ts.map +1 -0
- package/dist/elements/NodeImage.d.ts +51 -0
- package/dist/elements/NodeImage.d.ts.map +1 -0
- package/dist/elements/Port.d.ts +72 -0
- package/dist/elements/Port.d.ts.map +1 -0
- package/dist/elements/TextLabel.d.ts +85 -0
- package/dist/elements/TextLabel.d.ts.map +1 -0
- package/dist/elements/nodes/CircleNode.d.ts +21 -0
- package/dist/elements/nodes/CircleNode.d.ts.map +1 -0
- package/dist/elements/nodes/CustomShapeNode.d.ts +48 -0
- package/dist/elements/nodes/CustomShapeNode.d.ts.map +1 -0
- package/dist/elements/nodes/DiamondNode.d.ts +13 -0
- package/dist/elements/nodes/DiamondNode.d.ts.map +1 -0
- package/dist/elements/nodes/RectangleNode.d.ts +19 -0
- package/dist/elements/nodes/RectangleNode.d.ts.map +1 -0
- package/dist/elements/paths/BezierPathStrategy.d.ts +10 -0
- package/dist/elements/paths/BezierPathStrategy.d.ts.map +1 -0
- package/dist/elements/paths/PathStrategy.d.ts +12 -0
- package/dist/elements/paths/PathStrategy.d.ts.map +1 -0
- package/dist/elements/paths/PolylinePathStrategy.d.ts +11 -0
- package/dist/elements/paths/PolylinePathStrategy.d.ts.map +1 -0
- package/dist/elements/paths/StraightPathStrategy.d.ts +10 -0
- package/dist/elements/paths/StraightPathStrategy.d.ts.map +1 -0
- package/dist/elements/paths/index.d.ts +5 -0
- package/dist/elements/paths/index.d.ts.map +1 -0
- package/dist/events/EventEmitter.d.ts +46 -0
- package/dist/events/EventEmitter.d.ts.map +1 -0
- package/dist/events/InputHandler.d.ts +97 -0
- package/dist/events/InputHandler.d.ts.map +1 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/papirus.js +8419 -0
- package/dist/papirus.js.map +1 -0
- package/dist/styles/StyleManager.d.ts +119 -0
- package/dist/styles/StyleManager.d.ts.map +1 -0
- package/dist/types.d.ts +329 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/AlignDistribute.d.ts +12 -0
- package/dist/utils/AlignDistribute.d.ts.map +1 -0
- package/dist/utils/AutoLayout.d.ts +15 -0
- package/dist/utils/AutoLayout.d.ts.map +1 -0
- package/dist/utils/AutoRouting.d.ts +11 -0
- package/dist/utils/AutoRouting.d.ts.map +1 -0
- package/dist/utils/ImageExporter.d.ts +34 -0
- package/dist/utils/ImageExporter.d.ts.map +1 -0
- package/dist/utils/Serializer.d.ts +63 -0
- package/dist/utils/Serializer.d.ts.map +1 -0
- package/dist/utils/SvgExporter.d.ts +26 -0
- package/dist/utils/SvgExporter.d.ts.map +1 -0
- package/dist/utils/applyStyleManager.d.ts +6 -0
- package/dist/utils/applyStyleManager.d.ts.map +1 -0
- package/dist/utils/contentBounds.d.ts +13 -0
- package/dist/utils/contentBounds.d.ts.map +1 -0
- package/dist/utils/download.d.ts +2 -0
- package/dist/utils/download.d.ts.map +1 -0
- package/dist/utils/geometry.d.ts +71 -0
- package/dist/utils/geometry.d.ts.map +1 -0
- package/dist/utils/style.d.ts +2 -0
- package/dist/utils/style.d.ts.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { EdgeStyle, ElementState, ElementStyle, NodeStyle, TextStyle } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Theme definition
|
|
4
|
+
*/
|
|
5
|
+
export interface Theme {
|
|
6
|
+
name: string;
|
|
7
|
+
colors: {
|
|
8
|
+
background: string;
|
|
9
|
+
grid: string;
|
|
10
|
+
selection: string;
|
|
11
|
+
connectionPreview: string;
|
|
12
|
+
};
|
|
13
|
+
node: {
|
|
14
|
+
default: NodeStyle;
|
|
15
|
+
hover: NodeStyle;
|
|
16
|
+
selected: NodeStyle;
|
|
17
|
+
dragging: NodeStyle;
|
|
18
|
+
};
|
|
19
|
+
edge: {
|
|
20
|
+
default: EdgeStyle;
|
|
21
|
+
hover: EdgeStyle;
|
|
22
|
+
selected: EdgeStyle;
|
|
23
|
+
};
|
|
24
|
+
text: TextStyle;
|
|
25
|
+
port: {
|
|
26
|
+
default: {
|
|
27
|
+
color: string;
|
|
28
|
+
radius: number;
|
|
29
|
+
};
|
|
30
|
+
hover: {
|
|
31
|
+
color: string;
|
|
32
|
+
radius: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
group: {
|
|
36
|
+
default: ElementStyle;
|
|
37
|
+
selected: ElementStyle;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Style class definition
|
|
42
|
+
*/
|
|
43
|
+
export interface StyleClass {
|
|
44
|
+
name: string;
|
|
45
|
+
node?: Partial<NodeStyle>;
|
|
46
|
+
edge?: Partial<EdgeStyle>;
|
|
47
|
+
text?: Partial<TextStyle>;
|
|
48
|
+
port?: Partial<{
|
|
49
|
+
color: string;
|
|
50
|
+
radius: number;
|
|
51
|
+
}>;
|
|
52
|
+
group?: Partial<ElementStyle>;
|
|
53
|
+
}
|
|
54
|
+
declare const DEFAULT_THEME: Theme;
|
|
55
|
+
declare const DARK_THEME: Theme;
|
|
56
|
+
/**
|
|
57
|
+
* Manages styles and themes
|
|
58
|
+
*/
|
|
59
|
+
export declare class StyleManager {
|
|
60
|
+
private _theme;
|
|
61
|
+
private _classes;
|
|
62
|
+
private _builtInThemes;
|
|
63
|
+
constructor(theme?: Theme | string);
|
|
64
|
+
/**
|
|
65
|
+
* Current theme
|
|
66
|
+
*/
|
|
67
|
+
get theme(): Theme;
|
|
68
|
+
/**
|
|
69
|
+
* Set the current theme
|
|
70
|
+
*/
|
|
71
|
+
setTheme(theme: Theme | string): void;
|
|
72
|
+
/**
|
|
73
|
+
* Register a custom theme
|
|
74
|
+
*/
|
|
75
|
+
registerTheme(theme: Theme): void;
|
|
76
|
+
/**
|
|
77
|
+
* Get all available theme names
|
|
78
|
+
*/
|
|
79
|
+
getThemeNames(): string[];
|
|
80
|
+
/**
|
|
81
|
+
* Register a style class
|
|
82
|
+
*/
|
|
83
|
+
registerClass(styleClass: StyleClass): void;
|
|
84
|
+
/**
|
|
85
|
+
* Get a style class
|
|
86
|
+
*/
|
|
87
|
+
getClass(name: string): StyleClass | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Get all registered classes
|
|
90
|
+
*/
|
|
91
|
+
getClasses(): StyleClass[];
|
|
92
|
+
/**
|
|
93
|
+
* Get node style for a state
|
|
94
|
+
*/
|
|
95
|
+
getNodeStyle(state: ElementState, className?: string): NodeStyle;
|
|
96
|
+
/**
|
|
97
|
+
* Get edge style for a state
|
|
98
|
+
*/
|
|
99
|
+
getEdgeStyle(state: ElementState, className?: string): EdgeStyle;
|
|
100
|
+
/**
|
|
101
|
+
* Get text style
|
|
102
|
+
*/
|
|
103
|
+
getTextStyle(className?: string): TextStyle;
|
|
104
|
+
/**
|
|
105
|
+
* Get group style for a state
|
|
106
|
+
*/
|
|
107
|
+
getGroupStyle(selected: boolean, className?: string): ElementStyle;
|
|
108
|
+
/**
|
|
109
|
+
* Get port style
|
|
110
|
+
*/
|
|
111
|
+
getPortStyle(hovered: boolean, className?: string): {
|
|
112
|
+
color: string;
|
|
113
|
+
radius: number;
|
|
114
|
+
};
|
|
115
|
+
private getBaseNodeStyle;
|
|
116
|
+
private getBaseEdgeStyle;
|
|
117
|
+
}
|
|
118
|
+
export { DEFAULT_THEME, DARK_THEME };
|
|
119
|
+
//# sourceMappingURL=StyleManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StyleManager.d.ts","sourceRoot":"","sources":["../../src/styles/StyleManager.ts"],"names":[],"mappings":"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AAE,MAAM,CAAA;KAAE;IAarF,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,gBAAgB;CAUzB;AAGD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 2D point in coordinate space
|
|
3
|
+
*/
|
|
4
|
+
export interface Point {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Size dimensions
|
|
10
|
+
*/
|
|
11
|
+
export interface Size {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Rectangular bounds combining position and size
|
|
17
|
+
*/
|
|
18
|
+
export interface Bounds {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Element interaction states
|
|
26
|
+
*/
|
|
27
|
+
export type ElementState = 'normal' | 'hover' | 'selected' | 'dragging';
|
|
28
|
+
/**
|
|
29
|
+
* Port position on a node
|
|
30
|
+
*/
|
|
31
|
+
export type PortPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
32
|
+
/**
|
|
33
|
+
* Port type for connection directionality
|
|
34
|
+
*/
|
|
35
|
+
export type PortType = 'input' | 'output';
|
|
36
|
+
/**
|
|
37
|
+
* Edge connection endpoint
|
|
38
|
+
*/
|
|
39
|
+
export interface EdgeEndpoint {
|
|
40
|
+
nodeId: string;
|
|
41
|
+
portId?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Edge path type
|
|
45
|
+
*/
|
|
46
|
+
export type EdgePathType = 'straight' | 'polyline' | 'bezier';
|
|
47
|
+
/**
|
|
48
|
+
* Arrow type for edges (legacy, use ArrowMarkerType for new code)
|
|
49
|
+
*/
|
|
50
|
+
export type ArrowType = 'none' | 'single' | 'double';
|
|
51
|
+
/**
|
|
52
|
+
* Arrow marker type
|
|
53
|
+
*/
|
|
54
|
+
export type ArrowMarkerType = 'none' | 'arrow' | 'open' | 'diamond' | 'circle';
|
|
55
|
+
/**
|
|
56
|
+
* Arrow marker configuration
|
|
57
|
+
*/
|
|
58
|
+
export interface ArrowMarkerConfig {
|
|
59
|
+
type: ArrowMarkerType;
|
|
60
|
+
size?: number;
|
|
61
|
+
strokeColor?: string;
|
|
62
|
+
fillColor?: string;
|
|
63
|
+
fillOpacity?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Style properties for elements
|
|
67
|
+
*/
|
|
68
|
+
export interface ElementStyle {
|
|
69
|
+
fillColor?: string;
|
|
70
|
+
strokeColor?: string;
|
|
71
|
+
strokeWidth?: number;
|
|
72
|
+
lineDash?: number[];
|
|
73
|
+
opacity?: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Style properties for nodes
|
|
77
|
+
*/
|
|
78
|
+
export interface NodeStyle extends ElementStyle {
|
|
79
|
+
fillOpacity?: number;
|
|
80
|
+
strokeOpacity?: number;
|
|
81
|
+
cornerRadius?: number;
|
|
82
|
+
lineDash?: number[];
|
|
83
|
+
lineDashOffset?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Placement for label inside node bounds
|
|
87
|
+
*/
|
|
88
|
+
export type LabelPlacement = 'auto' | 'center' | 'top' | 'bottom' | 'left' | 'right';
|
|
89
|
+
/**
|
|
90
|
+
* Style properties for edges
|
|
91
|
+
*/
|
|
92
|
+
export interface EdgeStyle extends ElementStyle {
|
|
93
|
+
strokeOpacity?: number;
|
|
94
|
+
lineDash?: number[];
|
|
95
|
+
lineDashOffset?: number;
|
|
96
|
+
lineCap?: CanvasLineCap;
|
|
97
|
+
lineJoin?: CanvasLineJoin;
|
|
98
|
+
flowSpeed?: number;
|
|
99
|
+
flowDash?: number[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Edge label background configuration
|
|
103
|
+
*/
|
|
104
|
+
export interface EdgeLabelBackground {
|
|
105
|
+
color?: string;
|
|
106
|
+
opacity?: number;
|
|
107
|
+
padding?: number;
|
|
108
|
+
borderRadius?: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Style properties for text
|
|
112
|
+
*/
|
|
113
|
+
export interface TextStyle {
|
|
114
|
+
font?: string;
|
|
115
|
+
fontSize?: number;
|
|
116
|
+
fontFamily?: string;
|
|
117
|
+
fontWeight?: string;
|
|
118
|
+
color?: string;
|
|
119
|
+
opacity?: number;
|
|
120
|
+
align?: CanvasTextAlign;
|
|
121
|
+
baseline?: CanvasTextBaseline;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Configuration options for DiagramRenderer
|
|
125
|
+
*/
|
|
126
|
+
export interface DiagramOptions {
|
|
127
|
+
width?: number;
|
|
128
|
+
height?: number;
|
|
129
|
+
backgroundColor?: string;
|
|
130
|
+
retina?: boolean;
|
|
131
|
+
minZoom?: number;
|
|
132
|
+
maxZoom?: number;
|
|
133
|
+
initialZoom?: number;
|
|
134
|
+
snapToGrid?: boolean;
|
|
135
|
+
scrollbarOverlay?: boolean;
|
|
136
|
+
animations?: AnimationOptions;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Animation configuration for DiagramRenderer
|
|
140
|
+
*/
|
|
141
|
+
export interface AnimationOptions {
|
|
142
|
+
enabled?: boolean;
|
|
143
|
+
enterDuration?: number;
|
|
144
|
+
exitDuration?: number;
|
|
145
|
+
highlightDuration?: number;
|
|
146
|
+
enterScale?: number;
|
|
147
|
+
exitScale?: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Viewport state
|
|
151
|
+
*/
|
|
152
|
+
export interface ViewportState {
|
|
153
|
+
zoom: number;
|
|
154
|
+
offsetX: number;
|
|
155
|
+
offsetY: number;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Serialized diagram data
|
|
159
|
+
*/
|
|
160
|
+
export interface DiagramData {
|
|
161
|
+
version: string;
|
|
162
|
+
nodes: SerializedNode[];
|
|
163
|
+
edges: SerializedEdge[];
|
|
164
|
+
groups: SerializedGroup[];
|
|
165
|
+
viewport: ViewportState;
|
|
166
|
+
theme?: SerializedTheme;
|
|
167
|
+
styleClasses?: SerializedStyleClass[];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Serialized node icon data
|
|
171
|
+
*/
|
|
172
|
+
export interface SerializedNodeIcon {
|
|
173
|
+
source: string;
|
|
174
|
+
width?: number;
|
|
175
|
+
height?: number;
|
|
176
|
+
fit?: 'contain' | 'cover' | 'stretch' | 'none';
|
|
177
|
+
placement?: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
178
|
+
scaleWithBounds?: boolean;
|
|
179
|
+
padding?: number;
|
|
180
|
+
margin?: number;
|
|
181
|
+
gap?: number;
|
|
182
|
+
opacity?: number;
|
|
183
|
+
strokeColor?: string;
|
|
184
|
+
fillColor?: string;
|
|
185
|
+
align?: 'left' | 'center' | 'right';
|
|
186
|
+
verticalAlign?: 'top' | 'center' | 'bottom';
|
|
187
|
+
offsetX?: number;
|
|
188
|
+
offsetY?: number;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Serialized anchor points configuration
|
|
192
|
+
*/
|
|
193
|
+
export interface SerializedAnchorPoints {
|
|
194
|
+
top?: number;
|
|
195
|
+
right?: number;
|
|
196
|
+
bottom?: number;
|
|
197
|
+
left?: number;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Serialized text label data
|
|
201
|
+
*/
|
|
202
|
+
export interface SerializedTextLabel {
|
|
203
|
+
text: string;
|
|
204
|
+
style?: TextStyle;
|
|
205
|
+
maxWidth?: number;
|
|
206
|
+
padding?: number;
|
|
207
|
+
margin?: number;
|
|
208
|
+
styleClass?: string;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Serialized node data
|
|
212
|
+
*/
|
|
213
|
+
export interface SerializedNode {
|
|
214
|
+
id: string;
|
|
215
|
+
type: string;
|
|
216
|
+
x: number;
|
|
217
|
+
y: number;
|
|
218
|
+
width: number;
|
|
219
|
+
height: number;
|
|
220
|
+
style?: NodeStyle;
|
|
221
|
+
styleClass?: string;
|
|
222
|
+
label?: string | SerializedTextLabel;
|
|
223
|
+
labelStyleClass?: string;
|
|
224
|
+
labelPlacement?: LabelPlacement;
|
|
225
|
+
icon?: SerializedNodeIcon;
|
|
226
|
+
anchorPoints?: SerializedAnchorPoints;
|
|
227
|
+
ports?: SerializedPort[];
|
|
228
|
+
data?: Record<string, unknown>;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Serialized port data
|
|
232
|
+
*/
|
|
233
|
+
export interface SerializedPort {
|
|
234
|
+
id: string;
|
|
235
|
+
type: PortType;
|
|
236
|
+
position: PortPosition | Point;
|
|
237
|
+
styleClass?: string;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Serialized edge data
|
|
241
|
+
*/
|
|
242
|
+
export interface SerializedEdge {
|
|
243
|
+
id: string;
|
|
244
|
+
from: EdgeEndpoint;
|
|
245
|
+
to: EdgeEndpoint;
|
|
246
|
+
type: EdgePathType;
|
|
247
|
+
controlPoints?: Point[];
|
|
248
|
+
arrowType?: ArrowType;
|
|
249
|
+
startMarker?: ArrowMarkerConfig;
|
|
250
|
+
endMarker?: ArrowMarkerConfig;
|
|
251
|
+
style?: EdgeStyle;
|
|
252
|
+
styleClass?: string;
|
|
253
|
+
label?: string;
|
|
254
|
+
labelStyleClass?: string;
|
|
255
|
+
labelOffset?: number;
|
|
256
|
+
labelBackground?: EdgeLabelBackground;
|
|
257
|
+
data?: Record<string, unknown>;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Serialized group data
|
|
261
|
+
*/
|
|
262
|
+
export interface SerializedGroup {
|
|
263
|
+
id: string;
|
|
264
|
+
childIds: string[];
|
|
265
|
+
style?: ElementStyle;
|
|
266
|
+
styleClass?: string;
|
|
267
|
+
label?: string;
|
|
268
|
+
data?: Record<string, unknown>;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Serialized theme data (compatible with StyleManager Theme)
|
|
272
|
+
*/
|
|
273
|
+
export interface SerializedTheme {
|
|
274
|
+
name: string;
|
|
275
|
+
colors: {
|
|
276
|
+
background: string;
|
|
277
|
+
grid: string;
|
|
278
|
+
selection: string;
|
|
279
|
+
connectionPreview: string;
|
|
280
|
+
};
|
|
281
|
+
node: {
|
|
282
|
+
default: NodeStyle;
|
|
283
|
+
hover: NodeStyle;
|
|
284
|
+
selected: NodeStyle;
|
|
285
|
+
dragging: NodeStyle;
|
|
286
|
+
};
|
|
287
|
+
edge: {
|
|
288
|
+
default: EdgeStyle;
|
|
289
|
+
hover: EdgeStyle;
|
|
290
|
+
selected: EdgeStyle;
|
|
291
|
+
};
|
|
292
|
+
text: TextStyle;
|
|
293
|
+
port: {
|
|
294
|
+
default: {
|
|
295
|
+
color: string;
|
|
296
|
+
radius: number;
|
|
297
|
+
};
|
|
298
|
+
hover: {
|
|
299
|
+
color: string;
|
|
300
|
+
radius: number;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
group: {
|
|
304
|
+
default: ElementStyle;
|
|
305
|
+
selected: ElementStyle;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Serialized style class data (compatible with StyleManager StyleClass)
|
|
310
|
+
*/
|
|
311
|
+
export interface SerializedStyleClass {
|
|
312
|
+
name: string;
|
|
313
|
+
node?: Partial<NodeStyle>;
|
|
314
|
+
edge?: Partial<EdgeStyle>;
|
|
315
|
+
text?: Partial<TextStyle>;
|
|
316
|
+
port?: Partial<{
|
|
317
|
+
color: string;
|
|
318
|
+
radius: number;
|
|
319
|
+
}>;
|
|
320
|
+
group?: Partial<ElementStyle>;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Command for history/undo system
|
|
324
|
+
*/
|
|
325
|
+
export interface Command {
|
|
326
|
+
execute(): void;
|
|
327
|
+
undo(): void;
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,MAA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C;KACrB,CAAC;IACF,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE;QACJ,OAAO,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QAC3C,KAAK,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;KAC1C,CAAC;IACF,KAAK,EAAE;QACL,OAAO,EAAE,YAAY,CAAC;QACtB,QAAQ,EAAE,YAAY,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,OAAO,IAAI,IAAI,CAAC;IAChB,IAAI,IAAI,IAAI,CAAC;CACd"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Node } from '../elements/Node';
|
|
2
|
+
export type AlignType = 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom';
|
|
3
|
+
export type DistributeType = 'horizontal' | 'vertical';
|
|
4
|
+
/**
|
|
5
|
+
* Align nodes by edge or center
|
|
6
|
+
*/
|
|
7
|
+
export declare function alignNodes(nodes: Node[], type: AlignType): void;
|
|
8
|
+
/**
|
|
9
|
+
* Distribute nodes evenly along axis
|
|
10
|
+
*/
|
|
11
|
+
export declare function distributeNodes(nodes: Node[], type: DistributeType): void;
|
|
12
|
+
//# sourceMappingURL=AlignDistribute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlignDistribute.d.ts","sourceRoot":"","sources":["../../src/utils/AlignDistribute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAClF,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,UAAU,CAAC;AAEvD;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAmC/D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CA4BzE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Node } from '../elements/Node';
|
|
2
|
+
export interface GridLayoutOptions {
|
|
3
|
+
columns?: number;
|
|
4
|
+
rowGap?: number;
|
|
5
|
+
columnGap?: number;
|
|
6
|
+
startX?: number;
|
|
7
|
+
startY?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Basic auto-layout utilities
|
|
11
|
+
*/
|
|
12
|
+
export declare class AutoLayout {
|
|
13
|
+
applyGridLayout(nodes: Node[], options?: GridLayoutOptions): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=AutoLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoLayout.d.ts","sourceRoot":"","sources":["../../src/utils/AutoLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,GAAE,iBAAsB,GAAG,IAAI;CA8BtE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DiagramRenderer } from '../core/DiagramRenderer';
|
|
2
|
+
export interface AutoRoutingOptions {
|
|
3
|
+
type?: 'straight' | 'polyline' | 'bezier';
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Basic edge auto-routing
|
|
7
|
+
*/
|
|
8
|
+
export declare class AutoRouting {
|
|
9
|
+
apply(renderer: DiagramRenderer, options?: AutoRoutingOptions): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=AutoRouting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoRouting.d.ts","sourceRoot":"","sources":["../../src/utils/AutoRouting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;CAC3C;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,KAAK,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,GAAE,kBAAuB,GAAG,IAAI;CAwBzE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DiagramRenderer } from '../core/DiagramRenderer';
|
|
2
|
+
export interface ExportOptions {
|
|
3
|
+
scale?: number;
|
|
4
|
+
backgroundColor?: string;
|
|
5
|
+
padding?: number;
|
|
6
|
+
format?: 'png' | 'jpeg';
|
|
7
|
+
quality?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Exports diagram to image formats
|
|
11
|
+
*/
|
|
12
|
+
export declare class ImageExporter {
|
|
13
|
+
private renderer;
|
|
14
|
+
constructor(renderer: DiagramRenderer);
|
|
15
|
+
/**
|
|
16
|
+
* Export to PNG blob
|
|
17
|
+
*/
|
|
18
|
+
exportPNG(options?: ExportOptions): Promise<Blob>;
|
|
19
|
+
/**
|
|
20
|
+
* Export to JPEG blob
|
|
21
|
+
*/
|
|
22
|
+
exportJPEG(options?: ExportOptions): Promise<Blob>;
|
|
23
|
+
/**
|
|
24
|
+
* Export to data URL
|
|
25
|
+
*/
|
|
26
|
+
exportDataURL(options?: ExportOptions): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Download as file
|
|
29
|
+
*/
|
|
30
|
+
download(filename: string, options?: ExportOptions): Promise<void>;
|
|
31
|
+
private export;
|
|
32
|
+
private createBlankImage;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=ImageExporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageExporter.d.ts","sourceRoot":"","sources":["../../src/utils/ImageExporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAK9D,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAkB;gBAEtB,QAAQ,EAAE,eAAe;IAIrC;;OAEG;IACG,SAAS,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D;;OAEG;IACG,UAAU,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5D;;OAEG;IACG,aAAa,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAUjE;;OAEG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;YAK9D,MAAM;IA+EpB,OAAO,CAAC,gBAAgB;CAgCzB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DiagramRenderer } from '../core/DiagramRenderer';
|
|
2
|
+
import { Node } from '../elements/Node';
|
|
3
|
+
import { Edge } from '../elements/Edge';
|
|
4
|
+
import { Group } from '../elements/Group';
|
|
5
|
+
import { DiagramData, SerializedNode, SerializedEdge, SerializedGroup } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Validation error during deserialization
|
|
8
|
+
*/
|
|
9
|
+
export declare class SerializerValidationError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
export interface NodeFactory {
|
|
13
|
+
(data: SerializedNode): Node;
|
|
14
|
+
}
|
|
15
|
+
export interface EdgeFactory {
|
|
16
|
+
(data: SerializedEdge): Edge;
|
|
17
|
+
}
|
|
18
|
+
export interface GroupFactory {
|
|
19
|
+
(data: SerializedGroup): Group;
|
|
20
|
+
}
|
|
21
|
+
export interface SerializerOptions {
|
|
22
|
+
nodeFactory: NodeFactory;
|
|
23
|
+
edgeFactory: EdgeFactory;
|
|
24
|
+
groupFactory?: GroupFactory;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Serializes and deserializes diagram data
|
|
28
|
+
*/
|
|
29
|
+
export declare class Serializer {
|
|
30
|
+
private renderer;
|
|
31
|
+
private readonly nodeFactory;
|
|
32
|
+
private readonly edgeFactory;
|
|
33
|
+
private readonly groupFactory?;
|
|
34
|
+
constructor(renderer: DiagramRenderer, options: SerializerOptions);
|
|
35
|
+
/**
|
|
36
|
+
* Serialize the diagram to JSON-compatible data
|
|
37
|
+
*/
|
|
38
|
+
serialize(): DiagramData;
|
|
39
|
+
/**
|
|
40
|
+
* Serialize to JSON string
|
|
41
|
+
*/
|
|
42
|
+
toJSON(pretty?: boolean): string;
|
|
43
|
+
/**
|
|
44
|
+
* Deserialize data and populate the diagram
|
|
45
|
+
*/
|
|
46
|
+
deserialize(data: DiagramData): void;
|
|
47
|
+
/**
|
|
48
|
+
* Validate diagram data before deserialization
|
|
49
|
+
*/
|
|
50
|
+
private validate;
|
|
51
|
+
/**
|
|
52
|
+
* Parse JSON string and deserialize
|
|
53
|
+
*/
|
|
54
|
+
fromJSON(json: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Clear the diagram
|
|
57
|
+
*/
|
|
58
|
+
clear(): void;
|
|
59
|
+
private serializeNode;
|
|
60
|
+
private serializeEdge;
|
|
61
|
+
private serializeGroup;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=Serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Serializer.d.ts","sourceRoot":"","sources":["../../src/utils/Serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EAKhB,MAAM,SAAS,CAAC;AAIjB;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,IAAI,EAAE,eAAe,GAAG,KAAK,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAe;gBAEjC,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,iBAAiB;IAOjE;;OAEG;IACH,SAAS,IAAI,WAAW;IAgCxB;;OAEG;IACH,MAAM,CAAC,MAAM,UAAQ,GAAG,MAAM;IAK9B;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IA4CpC;;OAEG;IACH,OAAO,CAAC,QAAQ;IA+BhB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK5B;;OAEG;IACH,KAAK,IAAI,IAAI;IAiBb,OAAO,CAAC,aAAa;IAyFrB,OAAO,CAAC,aAAa;IAoBrB,OAAO,CAAC,cAAc;CAUvB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DiagramRenderer } from '../core/DiagramRenderer';
|
|
2
|
+
export interface SvgExportOptions {
|
|
3
|
+
padding?: number;
|
|
4
|
+
backgroundColor?: string;
|
|
5
|
+
includeBackground?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Exports diagram to SVG
|
|
9
|
+
*/
|
|
10
|
+
export declare class SvgExporter {
|
|
11
|
+
private renderer;
|
|
12
|
+
constructor(renderer: DiagramRenderer);
|
|
13
|
+
exportSVG(options?: SvgExportOptions): string;
|
|
14
|
+
exportDataURL(options?: SvgExportOptions): string;
|
|
15
|
+
download(filename: string, options?: SvgExportOptions): void;
|
|
16
|
+
private renderGroup;
|
|
17
|
+
private renderNode;
|
|
18
|
+
private renderEdge;
|
|
19
|
+
private buildPath;
|
|
20
|
+
private getPathMidpoint;
|
|
21
|
+
private renderTextLabel;
|
|
22
|
+
private arrowDefs;
|
|
23
|
+
private createEmptySvg;
|
|
24
|
+
private escapeText;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=SvgExporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvgExporter.d.ts","sourceRoot":"","sources":["../../src/utils/SvgExporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAU9D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAkB;gBAEtB,QAAQ,EAAE,eAAe;IAIrC,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,MAAM;IA0DjD,aAAa,CAAC,OAAO,GAAE,gBAAqB,GAAG,MAAM;IAMrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,IAAI;IAMhE,OAAO,CAAC,WAAW;IAsBnB,OAAO,CAAC,UAAU;IAgDlB,OAAO,CAAC,UAAU;IA0BlB,OAAO,CAAC,SAAS;IAiBjB,OAAO,CAAC,eAAe;IA8CvB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,UAAU;CAQnB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Edge } from '../elements/Edge';
|
|
2
|
+
import { Group } from '../elements/Group';
|
|
3
|
+
import { Node } from '../elements/Node';
|
|
4
|
+
import { StyleManager } from '../styles/StyleManager';
|
|
5
|
+
export declare function applyStyleManagerToElements(styleManager: StyleManager | null | undefined, groups: Iterable<Group>, edges: Iterable<Edge>, nodes: Iterable<Node>): void;
|
|
6
|
+
//# sourceMappingURL=applyStyleManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyStyleManager.d.ts","sourceRoot":"","sources":["../../src/utils/applyStyleManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EAC7C,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,EACvB,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,EACrB,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,GACpB,IAAI,CAgBN"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Bounds } from '../types';
|
|
2
|
+
export interface BoundsSource {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
getBounds(): Bounds;
|
|
5
|
+
}
|
|
6
|
+
export interface ContentBoundsInput {
|
|
7
|
+
nodes?: Iterable<BoundsSource>;
|
|
8
|
+
edges?: Iterable<BoundsSource>;
|
|
9
|
+
groups?: Iterable<BoundsSource>;
|
|
10
|
+
includeInvisible?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function getContentBounds({ nodes, edges, groups, includeInvisible, }: ContentBoundsInput): Bounds | null;
|
|
13
|
+
//# sourceMappingURL=contentBounds.d.ts.map
|