forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
goJS.d.ts
9052 lines (7167 loc) · 383 KB
/
goJS.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for GoJS v1.5.0
// Project: http://gojs.net
// Definitions by: Northwoods Software <https://github.com/NorthwoodsSoftware>
// Definitions: https://github.com/NorthwoodsSoftware/GoJS
/* Copyright (C) 1998-2015 by Northwoods Software Corporation. */
// This is for TypeScript 1.4
// TODO: TypeScript 1.5 modules and destructuring
declare module go {
/** A number in place of a Margin object is treated as a uniform Margin with that thickness */
type MarginLike = Margin | number;
/** A string in place of a Brush object is treated as a Solid Brush of that color. */
type BrushLike = Brush | string;
/** A Key is the type of the unique identifier managed by Models for each node data object. */
type Key = string | number;
/** Either name a property or get the value of a property from an object. */
type PropertyAccessor = string | ((data: any, newval: any) => any);
/** A constructor */
type Constructor = new (...args: any[]) => Object;
/**
* An adornment is a special kind of Part that is associated with another Part,
* the Adornment.adornedPart.
* Adornments are normally associated with a particular GraphObject in the adorned part --
* that is the value of .adornedObject.
* However, the .adornedObject may be null, in which case the .adornedPart will also be null.
*/
class Adornment extends Part {
/**
* @param {EnumValue=} type if not supplied, the default Panel type is Panel.Position.
*/
constructor(type?: EnumValue);
/**Gets or sets the GraphObject that is adorned.*/
adornedObject: GraphObject;
/**This read-only property returns the Part that contains the adorned object.*/
adornedPart: Part;
/**This read-only property returns a Placeholder that this Adornment may contain in its visual tree.*/
placeholder: Placeholder;
}
/**
* This class handles animations in a Diagram. Each Diagram has one, the Diagram.animationManager.
*/
class AnimationManager {
/**You do not normally need to create an instance of this class because one already exists as the Diagram.animationManager, which you can modify.*/
constructor();
/**Gets or sets the duration for animations, in milliseconds. The default value is 600 milliseconds.*/
duration: number;
/**This read-only property is true when the AnimationManager is currently animating.*/
isAnimating: boolean;
/**Gets or sets whether this AnimationManager operates. The default value is true.*/
isEnabled: boolean;
/**This read-only property is true when the animation manager is in the middle of an animation tick.*/
isTicking: boolean;
/**
* Stops any running animation and updates the Diagram to its final state.
*/
stopAnimation(): void;
}
/**
* The Diagram.commandHandler implements various
* commands such as CommandHandler.deleteSelection or CommandHandler.redo.
* The CommandHandler includes keyboard event handling to interpret
* key presses as commands.
*/
class CommandHandler {
/**
* The constructor produces a CommandHandler with the default key bindings.
*/
constructor();
/**Gets or sets a data object that is copied by .groupSelection when creating a new Group. The default value is null.*/
archetypeGroupData: Object;
/**Gets or sets whether copySelection should also copy Links that connect with selected Nodes.*/
copiesConnectedLinks: boolean;
/**Gets or sets whether copySelection and copyToClipboard copy the node data property whose value is the containing group data's key. The default value is false.*/
copiesGroupKey: boolean;
/**Gets or sets whether copySelection and copyToClipboard copy the node data property whose value is the tree-parent node data's key. The default value is false.*/
copiesParentKey: boolean;
/**Gets or sets whether .copySelection should also copy subtrees. The default value is false.*/
copiesTree: boolean;
/**Gets or sets the Diagram.scale set by resetZoom. The default value is 1.0.*/
defaultScale: number;
/**Gets or sets whether .deleteSelection should also delete subtrees. The default value is false.*/
deletesTree: boolean;
/**This read-only property returns the Diagram that is using this CommandHandler.*/
diagram: Diagram;
/**Gets or sets the predicate that determines whether or not a node may become a member of a group. The default predicate is null, which is equivalent to simply returning true.*/
memberValidation: (g: Group, p: Part) => boolean;
/**Gets or sets the amount by which .decreaseZoom and .increaseZoom change the Diagram.scale. The default value is 1.05 (5%).*/
zoomFactor: number;
/**
* Make sure all of the unnested Parts in the given collection are removed from any containing Groups.
* @param {Iterable<Part>} coll a collection of Parts.
* @param {boolean=} check whether to call .isValidMember to confirm that changing the Part to be a top-level Part is valid.
*/
addTopLevelParts(coll: Iterable<Part>, check?: boolean): boolean;
/**
* This predicate controls whether the user can collapse expanded Groups.
* @param {Group=} group if supplied, ignore the selection and consider collapsing this particular Group.
*/
canCollapseSubGraph(group?: Group): boolean;
/**
* This predicate controls whether the user can collapse expanded subtrees of Nodes.
* @param {Node=} node if supplied, ignore the selection and consider collapsing this particular Node.
*/
canCollapseTree(node?: Node): boolean;
/**
* This predicate controls whether or not the user can invoke the .copySelection command.
*/
canCopySelection(): boolean;
/**
* This predicate controls whether or not the user can invoke the .cutSelection command.
*/
canCutSelection(): boolean;
/**
* This predicate controls whether or not the user can invoke the .decreaseZoom command.
* @param {number=} factor This defaults to 1/.zoomFactor. The value should be less than one.
*/
canDecreaseZoom(factor?: number): boolean;
/**
* This predicate controls whether or not the user can invoke the .deleteSelection command.
*/
canDeleteSelection(): boolean;
/**
* This predicate controls whether or not the user can invoke the .editTextBlock command.
* @param {TextBlock=} textblock the TextBlock to consider editing.
*/
canEditTextBlock(textblock?: TextBlock): boolean;
/**
* This predicate controls whether the user can expand collapsed Groups.
* @param {Group=} group if supplied, ignore the selection and consider expanding this particular Group.
*/
canExpandSubGraph(group?: Group): boolean;
/**
* This predicate controls whether the user can expand collapsed subtrees of Nodes.
* @param {Node=} node if supplied, ignore the selection and consider expanding this particular Node.
*/
canExpandTree(node?: Node): boolean;
/**
* This predicate controls whether or not the user can invoke the .groupSelection command.
*/
canGroupSelection(): boolean;
/**
* This predicate controls whether or not the user can invoke the .increaseZoom command.
* @param {number=} factor This defaults to .zoomFactor. The value should be greater than one.
*/
canIncreaseZoom(factor?: number): boolean;
/**
* This predicate controls whether or not the user can invoke the .pasteSelection command.
*/
canPasteSelection(): boolean;
/**
* This predicate controls whether or not the user can invoke the .redo command.
*/
canRedo(): boolean;
/**
* This predicate controls whether or not the user can invoke the .resetZoom command.
* @param {number=} newscale This defaults to 1. The value should be greater than zero.
*/
canResetZoom(newscale?: number): boolean;
/**
* This predicate controls whether or not the user can invoke the .selectAll command.
*/
canSelectAll(): boolean;
/**
* This predicate controls whether or not the user can invoke the .showContextMenu command.
* @param {GraphObject|Diagram=} obj a GraphObject or Diagram with a contextMenu defined.
* If none is given, this method will use the first selected object, or else the Diagram.
*/
canShowContextMenu(obj?: GraphObject | Diagram): boolean;
/**
* This predicate controls whether the user may stop the current tool.
*/
canStopCommand(): boolean;
/**
* This predicate controls whether or not the user can invoke the .undo command.
*/
canUndo(): boolean;
/**
* This predicate controls whether or not the user can invoke the .ungroupSelection command.
* @param {Group=} group if supplied, ignore the selection and consider ungrouping this particular Group.
*/
canUngroupSelection(group?: Group): boolean;
/**
* This predicate controls whether or not the user can invoke the .zoomToFit command.
*/
canZoomToFit(): boolean;
/**
* Collapse all expanded selected Groups.
* @param {Group=} group if supplied, ignore the selection and collapse this particular Group.
*/
collapseSubGraph(group?: Group): void;
/**
* Collapse all expanded selected Nodes.
* @param {Node=} node if supplied, ignore the selection and collapse this particular Node subtree.
*/
collapseTree(node?: Node): void;
/**
* Copy the currently selected parts, Diagram.selection, from the Diagram into the clipboard.
*/
copySelection(): void;
/**
* This makes a copy of the given collection of Parts and stores it in a static variable acting as the clipboard.
* @param {Iterable<Part>} coll A collection of Parts.
*/
copyToClipboard(coll: Iterable<Part>): void;
/**
* Execute a .copySelection followed by a .deleteSelection.
*/
cutSelection(): void;
/**
* Decrease the Diagram.scale by a given factor.
* @param {number=} factor This defaults to 1/.zoomFactor. The value should be less than one.
*/
decreaseZoom(factor?: number): void;
/**
* Delete the currently selected parts from the diagram.
*/
deleteSelection(): void;
/**
* This is called by tools to handle keyboard commands.
*/
doKeyDown(): void;
/**
* This is called by tools to handle keyboard commands.
*/
doKeyUp(): void;
/**
* Start in-place editing of a TextBlock in the selected Part.
* @param {TextBlock=} textblock the TextBlock to start editing.
*/
editTextBlock(textblock?: TextBlock): void;
/**
* Expand all collapsed selected Groups.
* @param {Group=} group if supplied, ignore the selection and expand this particular Group.
*/
expandSubGraph(group?: Group): void;
/**
* Expand all collapsed selected Nodes.
* @param {Node=} node if supplied, ignore the selection and collapse this particular Node subtree.
*/
expandTree(node?: Node): void;
/**
* Add a copy of .archetypeGroupData and add it to the diagram's model to create a new Group and then add the selected Parts to that new group.
*/
groupSelection(): void;
/**
* Increase the Diagram.scale by a given factor.
* @param {number=} factor This defaults to .zoomFactor. The value should be greater than one.
*/
increaseZoom(factor?: Number): void;
/**
* This predicate is called to determine whether a Node may be added as a member of a Group.
* @param {Group} group this may be null if the node is being added as a top-level node.
* @param {Part} part a Part, usually a Node, possibly another Group, but not a Link or an Adornment.
*/
isValidMember(group: Group, part: Part): boolean;
/**
* If the clipboard holds a collection of Parts, and if the Model.dataFormat matches that stored in the clipboard, this makes a copy of the clipboard's parts and adds the copies to this Diagram.
*/
pasteFromClipboard(): Set<Part>;
/**
* Copy the contents of the clipboard into this diagram, and make those new parts the new selection.
* @param {Point=} pos Point at which to center the newly pasted parts; if not present the parts are not moved.
*/
pasteSelection(pos?: Point): void;
/**
* Call UndoManager.redo.
*/
redo(): void;
/**
* Set the Diagram.scale to a new scale value, by default 1.
* @param {number=} newscale This defaults to 1. The value should be greater than zero.
*/
resetZoom(newscale?: number): void;
/**
* Select all of the selectable Parts in the diagram.
*/
selectAll(): void;
/**
* Open the context menu of a given GraphObject.
* The given GraphObject must have a GraphObject.contextMenu
* defined in order to show anything.
* @param {GraphObject|Diagram=} obj a GraphObject or Diagram with a contextMenu defined.
* If none is given, this method will use the first selected object, or else the Diagram.
*/
showContextMenu(obj?: GraphObject | Diagram): void;
/**
* Cancel the operation of the current tool.
*/
stopCommand(): void;
/**
* Call UndoManager.undo.
*/
undo(): void;
/**
* Remove the group from the diagram without removing its members from the diagram.
* @param {Group=} group if supplied, ignore the selection and consider ungrouping this particular Group.
*/
ungroupSelection(group?: Group): void;
/**
* Change the Diagram.scale so that the Diagram.documentBounds fits within the viewport.
*/
zoomToFit(): void;
}
/**
* A Diagram is associated with an HTML DIV element. Constructing a Diagram creates
* an HTML Canvas element which it places inside of the given DIV element, in addition to several helper divs.
* GoJS will manage the contents of this DIV, and the contents should not be modified otherwise,
* though the given DIV may be styled (background, border, etc) and positioned as needed.
*/
class Diagram {
/**
* Construct an empty Diagram for a particular DIV HTML element.
* @param {HTMLDivElement} div A reference to a DIV HTML element in the DOM.
* If no DIV is supplied one will be created in memory. The Diagram's Diagram.div property
* can then be set later on.
*/
constructor(div: HTMLDivElement);
/**
* Construct an empty Diagram for a particular DIV HTML element.
* @param {string=} div The ID of a DIV element in the DOM.
* If no DIV identifier is supplied one will be created in memory. The Diagram's Diagram.div property
* can then be set later on.
*/
constructor(div?: string);
/**Gets or sets whether the user may copy to or paste parts from the internal clipboard.*/
allowClipboard: boolean;
/**Gets or sets whether the user may copy objects.*/
allowCopy: boolean;
/**Gets or sets whether the user may delete objects from the Diagram.*/
allowDelete: boolean;
/**Gets or sets whether the user may start a drag-and-drop in this Diagram, possibly dropping in a different element.*/
allowDragOut: boolean;
/**Gets or sets whether the user may end a drag-and-drop operation in this Diagram.*/
allowDrop: boolean;
/**Gets or sets whether the user may group parts together.*/
allowGroup: boolean;
/**Gets or sets whether the user is allowed to use the horizontal scrollbar.*/
allowHorizontalScroll: boolean;
/**Gets or sets whether the user may add parts to the Diagram.*/
allowInsert: boolean;
/**Gets or sets whether the user may draw new links.*/
allowLink: boolean;
/**Gets or sets whether the user may move objects.*/
allowMove: boolean;
/**Gets or sets whether the user may reconnect existing links.*/
allowRelink: boolean;
/**Gets or sets whether the user may reshape parts.*/
allowReshape: boolean;
/**Gets or sets whether the user may resize parts.*/
allowResize: boolean;
/**Gets or sets whether the user may rotate parts.*/
allowRotate: boolean;
/**Gets or sets whether the user may select objects.*/
allowSelect: boolean;
/**Gets or sets whether the user may do in-place text editing.*/
allowTextEdit: boolean;
/**Gets or sets whether the user may undo or redo any changes.*/
allowUndo: boolean;
/**Gets or sets whether the user may ungroup existing groups.*/
allowUngroup: boolean;
/**Gets or sets whether the user is allowed to use the vertical scrollbar.*/
allowVerticalScroll: boolean;
/**Gets or sets whether the user may zoom into or out of the Diagram.*/
allowZoom: boolean;
/**This read-only property returns the AnimationManager for this Diagram.*/
animationManager: AnimationManager;
/**Gets or sets the autoScale of the Diagram, controlling whether or not the Diagram's bounds automatically scale to fit the view.*/
autoScale: EnumValue;
/**Gets or sets the Margin (or number for a uniform Margin) that describes the Diagram's autoScrollRegion.*/
autoScrollRegion: MarginLike;
/**Gets or sets the function to execute when the user single-primary-clicks on the background of the Diagram.*/
click: (e: InputEvent) => void;
/**Gets or sets the CommandHandler for this Diagram.*/
commandHandler: CommandHandler;
/**Gets or sets the content alignment Spot of this Diagram, to be used in determining how parts are positioned when the .viewportBounds width or height is smaller than the .documentBounds.*/
contentAlignment: Spot;
/**Gets or sets the function to execute when the user single-secondary-clicks on the background of the Diagram.*/
contextClick: (e: InputEvent) => void;
/**This Adornment is shown when the use context clicks in the background.*/
contextMenu: Adornment;
/**Gets or sets the current cursor for the Diagram, overriding the .defaultCursor.*/
currentCursor: string;
/**Gets or sets the current tool for this Diagram that handles all input events.*/
currentTool: Tool;
/**Gets or sets the cursor to be used for the Diagram when no GraphObject specifies a different cursor.*/
defaultCursor: string;
/**Gets or sets the default tool for this Diagram that becomes the current tool when the current tool stops.*/
defaultTool: Tool;
/**Gets or sets the Diagram's HTMLDivElement, via an HTML Element ID.*/
div: HTMLDivElement;
/**This read-only property returns the model-coordinate bounds of the Diagram.*/
documentBounds: Rect;
/**Gets or sets the function to execute when the user double-primary-clicks on the background of the Diagram.*/
doubleClick: (e: InputEvent) => void;
/**Gets or sets the most recent mouse-down InputEvent that occurred.*/
firstInput: InputEvent;
/**Gets or sets a fixed bounding rectangle to be returned by .documentBounds and .computeBounds.*/
fixedBounds: Rect;
/**Gets or sets the scrollMode of the Diagram.*/
scrollMode: EnumValue;
/**Gets or sets the Margin (or number for a uniform Margin) that describes a scrollable area that surrounds the document bounds, allowing the user to scroll into empty space.*/
scrollMargin: MarginLike;
/**Gets or sets the function used to determine the position that this Diagram can be scrolled or moved to.*/
positionComputation: (d: Diagram, p: Point) => Point;
/**Gets or sets the function used to determine the scale that this Diagram can be set to.*/
scaleComputation: (d: Diagram, s: number) => number;
/**Gets or sets a Panel of type Panel.Grid acting as the background grid extending across the whole viewport of this diagram.*/
grid: Panel;
/**Gets or sets the default selection Adornment template, used to adorn selected Groups.*/
groupSelectionAdornmentTemplate: Adornment;
/**Gets or sets the default Group template used as the archetype for group data that is added to the .model.*/
groupTemplate: Group;
/**Gets or sets a Map mapping template names to Groups.*/
groupTemplateMap: Map<string,Group>;
/**Gets or sets whether the Diagram has a horizontal Scrollbar.*/
hasHorizontalScrollbar: boolean;
/**Gets or sets whether the Diagram has a vertical Scrollbar.*/
hasVerticalScrollbar: boolean;
/**This read-only property returns the read-only collection of highlighted Parts.*/
highlighteds: Set<Part>;
/**Gets or sets the initialAutoScale of the Diagram.*/
initialAutoScale: EnumValue;
/**Gets or sets the initial content alignment Spot of this Diagram, to be used in determining how parts are positioned initially relative to the viewport.*/
initialContentAlignment: Spot;
/**Gets or sets the spot in the document's area that should be coincident with the .initialViewportSpot of the viewport when the document is first initialized.*/
initialDocumentSpot: Spot;
/**Gets or sets the initial coordinates of this Diagram in the viewport, eventually setting the .position.*/
initialPosition: Point;
/**Gets or sets the initial scale of this Diagram in the viewport, eventually setting the .scale.*/
initialScale: number;
/**Gets or sets the spot in the viewport that should be coincident with the .initialDocumentSpot of the document when the document is first initialized.*/
initialViewportSpot: Spot;
/**Gets or sets whether the user may interact with the Diagram.*/
isEnabled: boolean;
/**Gets or sets whether the Diagram's Diagram.model is Model.isReadOnly.*/
isModelReadOnly: boolean;
/**Gets or sets whether this Diagram's state has been modified.*/
isModified: boolean;
/**Gets or sets whether mouse events initiated within the Diagram will be captured.*/
isMouseCaptured: boolean;
/**Gets or sets whether the Diagram may be modified by the user, while still allowing the user to scroll, zoom, and select.*/
isReadOnly: boolean;
/**Gets or sets whether the Diagram tree structure is defined by links going from the parent node to their children, or vice-versa.*/
isTreePathToChildren: boolean;
/**Gets or sets the last InputEvent that occurred.*/
lastInput: InputEvent;
/**Gets an iterator for this Diagram's Layers.*/
layers: Iterator<Layer>;
/**Gets or sets the Layout used to position all of the top-level nodes and links in this Diagram.*/
layout: Layout;
/**Returns an iterator of all Links in the Diagram.*/
links: Iterator<Link>;
/**Gets or sets the default selection Adornment template, used to adorn selected Links.*/
linkSelectionAdornmentTemplate: Adornment;
/**Gets or sets the default Link template used as the archetype for link data that is added to the .model.*/
linkTemplate: Link;
/**Gets or sets a Map mapping template names to Links.*/
linkTemplateMap: Map<string,Link>;
/**Gets or sets the largest value that .scale may take.*/
maxScale: number;
/**Gets or sets the maximum number of selected objects.*/
maxSelectionCount: number;
/**Gets or sets the smallest value greater than zero that .scale may take.*/
minScale: number;
/**Gets or sets the Model holding data corresponding to the data-bound nodes and links of this Diagram.*/
model: Model;
/**Gets or sets the function to execute when the user is dragging the selection in the background of the Diagram during a DraggingTool drag-and-drop, not over any GraphObjects.*/
mouseDragOver: (e: InputEvent) => void;
/**Gets or sets the function to execute when the user drops the selection in the background of the Diagram at the end of a DraggingTool drag-and-drop, not onto any GraphObjects.*/
mouseDrop: (e: InputEvent) => void;
/**Gets or sets the function to execute when the user holds the mouse stationary in the background of the Diagram while holding down a button, not over any GraphObjects.*/
mouseHold: (e: InputEvent) => void;
/**Gets or sets the function to execute when the user holds the mouse stationary in the background of the Diagram without holding down any buttons, not over any GraphObjects.*/
mouseHover: (e: InputEvent) => void;
/**Gets or sets the function to execute when the user moves the mouse in the background of the Diagram without holding down any buttons, not over any GraphObjects.*/
mouseOver: (e: InputEvent) => void;
/**Returns an iterator of all Nodes and Groups in the Diagram.*/
nodes: Iterator<Node>;
/**Gets or sets the default selection Adornment template, used to adorn selected Parts other than Groups or Links.*/
nodeSelectionAdornmentTemplate: Adornment;
/**Gets or sets the default Node template used as the archetype for node data that is added to the .model.*/
nodeTemplate: Part;
/**Gets or sets a Map mapping template names to Parts.*/
nodeTemplateMap: Map<string,Part>;
/**Gets or sets the Margin (or number for a uniform Margin) that describes the Diagram's padding, which controls how much extra space there is around the area occupied by the document.*/
padding: MarginLike;
/**Returns an iterator of all Parts in the Diagram that are not Nodes or Links or Adornments.*/
parts: Iterator<Part>;
/**Gets or sets the coordinates of this Diagram in the viewport.*/
position: Point;
/**Gets or sets the scale transform of this Diagram.*/
scale: number;
/**Gets or sets the distance in screen pixels that the horizontal scrollbar will scroll when scrolling by a line.*/
scrollHorizontalLineChange: number;
/**Gets or sets the distance in screen pixels that the vertical scrollbar will scroll when scrolling by a line.*/
scrollVerticalLineChange: number;
/**This read-only property returns the read-only collection of selected Parts.*/
selection: Set<Part>;
/**Gets or sets whether ChangedEvents are not recorded by the UndoManager.*/
skipsUndoManager: boolean;
/**This read-only property returns the ToolManager for this Diagram.*/
toolManager: ToolManager;
/**This Adornment is shown when the mouse stays motionless in the background.*/
toolTip: Adornment;
/**This read-only property returns the UndoManager for this Diagram, which actually belongs to the .model.*/
undoManager: UndoManager;
/**Gets or sets what kinds of graphs this diagram allows the user to draw.*/
validCycle: EnumValue;
/**This read-only property returns the bounds of the portion of the Diagram that is viewable from its HTML Canvas.*/
viewportBounds: Rect;
/**Gets or sets the point, in viewport coordinates, where changes to the .scale will keep the focus in the document.*/
zoomPoint: Point;
/**
* Adds a Part to the Layer that matches the Part's Part.layerName, or else to the default layer, which is named with the empty string.
* @param {Part} part
*/
add(part: Part): void;
/**
* Register an event handler that is called when there is a ChangedEvent.
* @param {function(ChangedEvent)} listener a function that takes a ChangedEvent as its argument.
*/
addChangedListener(listener: (e: ChangedEvent) => void ): void;
/**
* Register an event handler that is called when there is a DiagramEvent of a given name.
* @param {string} name the name is normally capitalized, but this method uses case-insensitive comparison.
* @param {function(DiagramEvent)} listener a function that takes a DiagramEvent as its argument.
*/
addDiagramListener(name: string, listener: (e: DiagramEvent) => void ): void;
/**
* Adds a Layer to the list of layers.
* @param {Layer} layer The Layer to add.
*/
addLayer(layer: Layer): void;
/**
* Adds a layer to the list of layers after a specified layer.
* @param {Layer} layer The Layer to add.
* @param {Layer} existingLayer The layer to insert after.
*/
addLayerAfter(layer: Layer, existingLayer: Layer): void;
/**
* Adds a layer to the list of layers before a specified layer.
* @param {Layer} layer The Layer to add.
* @param {Layer} existingLayer The layer to insert before.
*/
addLayerBefore(layer: Layer, existingLayer: Layer): void;
/**
* Aligns the Diagram's .position based on a desired document Spot and viewport Spot.
* @param {Spot} documentspot
* @param {Spot} viewportspot
*/
alignDocument(documentspot: Spot, viewportspot: Spot): void;
/**
* Modifies the .position to show a given Rect of the Diagram by centering the viewport on that Rect.
* @param {Rect} r
*/
centerRect(r: Rect): void;
/**
* Removes all Parts from the Diagram, including unbound Parts and the background grid, and also clears out the Model and UndoManager.
*/
clear(): void;
/**
* Remove highlights from all Parts.
*/
clearHighlighteds(): void;
/**
* Deselect all selected Parts.
*/
clearSelection(): void;
/**
* Commit the changes of the current transaction.
* This just calls UndoManager.commitTransaction.
* @param {string} tname a descriptive name for the transaction.
*/
commitTransaction(tname: string): boolean;
/**
* This is called during a Diagram update to determine a new value for .documentBounds.
*/
computeBounds(): Rect;
/**
* Find the union of the GraphObject.actualBounds of all of the Parts in the given collection.
* @param {Iterable<Part>} coll a collection of Parts.
*/
computePartsBounds(coll: Iterable<Part>): Rect;
/**
* Make a copy of a collection of Parts and return them in a Map mapping each original Part to its copy.
* @param {Iterable<Part>} coll A List or a Set or Iterator of Parts.
* @param {Diagram} diagram The destination diagram; if null, the copied parts are not added to this diagram.
* @param {boolean} check Whether to check Part.canCopy on each part.
*/
copyParts(coll: Iterable<Part>, diagram: Diagram, check: boolean): void;
/**
* Updates the diagram immediately, then resets initialization flags so that actions taken in the argument function will be considered part of Diagram initialization, and will participate in initial layouts, .initialAutoScale, .initialContentAlignment, etc.
* @param {function()|null=} func an optional function of actions to perform as part of another diagram initialization.
*/
delayInitialization(func?: () => void ): void;
/**
* Finds a layer with a given name.
* @param {string} name
*/
findLayer(name: string): Layer;
/**
* Look for a Link corresponding to a GraphLinksModel's link data object.
* @param {Object} linkdata
*/
findLinkForData(linkdata: Object): Link;
/**
* Return a collection of Links that are bound to data whose properties have values
* that match those specified by the given example data.
* @param {...Object} examples
*/
findLinksByExample(...examples: Array<Object>): Iterator<Link>;
/**
* Look for a Node or Group corresponding to a model's node data object.
* @param {Object} nodedata
*/
findNodeForData(nodedata: Object): Node;
/**
* Look for a Node or Group corresponding to a model's node data object's unique key.
* @param {*} key a string or number.
*/
findNodeForKey(key: Key): Node;
/**
* Return a collection of Nodes and Groups that are bound to data whose properties have values
* that match those specified by the given example data.
* @param {...Object} examples
*/
findNodesByExample(...examples: Array<Object>): Iterator<Node>;
/**
* Find the front-most GraphObject at the given point in document coordinates.
* @param {Point} p A Point in document coordinates.
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and
* returning a GraphObject, defaulting to the identity.
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject
* returned by navig and returning true if that object should be returned,
* defaulting to a predicate that always returns true.
*/
findObjectAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean): GraphObject;
/**
* Return a collection of the GraphObjects at the given point in document coordinates.
* @param {Point} p A Point in document coordinates.
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and
* returning a GraphObject, defaulting to the identity.
* If this function returns null, the given GraphObject will not be included in the results.
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject
* returned by navig and returning true if that object should be returned,
* defaulting to a predicate that always returns true.
* @param {List|Set=} coll An optional collection (List or Set) to add the results to.
*/
findObjectsAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, coll?: List<GraphObject>): List<GraphObject>;
findObjectsAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, coll?: Set<GraphObject>): Set<GraphObject>;
/**
* Returns a collection of all GraphObjects that are inside or that intersect a given Rect in document coordinates.
* @param {Rect} r A Rect in document coordinates.
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and
* returning a GraphObject, defaulting to the identity.
* If this function returns null, the given GraphObject will not be included in the results.
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject
* returned by navig and returning true if that object should be returned,
* defaulting to a predicate that always returns true.
* @param {boolean=} partialInclusion Whether an object can match if it merely intersects the rectangular area (true) or
* if it must be entirely inside the rectangular area (false). The default value is false.
* @param {List|Set=} coll An optional collection (List or Set) to add the results to.
*/
findObjectsIn(r: Rect, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: List<GraphObject>): List<GraphObject>;
findObjectsIn(r: Rect, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set<GraphObject>): Set<GraphObject>;
/**
* Returns a collection of all GraphObjects that are within a certain distance of a given point in document coordinates.
* @param {Point} p A Point in document coordinates.
* @param {number} dist The distance from the point.
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and
* returning a GraphObject, defaulting to the identity.
* If this function returns null, the given GraphObject will not be included in the results.
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject
* returned by navig and returning true if that object should be returned,
* defaulting to a predicate that always returns true.
* @param {boolean=} partialInclusion Whether an object can match if it merely intersects the circular area (true) or
* if it must be entirely inside the circular area (false). The default value is true.
* The default is true.
* @param {List|Set=} coll An optional collection (List or Set) to add the results to.
*/
findObjectsNear(p: Point, dist: number, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: List<GraphObject>): List<GraphObject>;
findObjectsNear(p: Point, dist: number, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set<GraphObject>): Set<GraphObject>;
/**
* This convenience function finds the front-most Part that is at a given point and that might be selectable.
* @param {Point} p a Point in document coordinates.
* @param {boolean} selectable Whether to only consider parts that are Part.selectable.
*/
findPartAt(p: Point, selectable: boolean): Part;
/**
* Look for a Part, Node, Group, or Link corresponding to a Model's data object.
* @param {Object} data
*/
findPartForData(data: Object): Part;
/**
* Look for a Part or Node or Group corresponding to a model's data object's unique key.
* @param {*} key a string or number.
*/
findPartForKey(key: Key): Part;
/**
* Returns an iterator of all Groups that are at top-level, in other words that are not themselves inside other Groups.
*/
findTopLevelGroups(): Iterator<Group>;
/**
* Returns an iterator of all top-level Nodes that have no tree parents.
*/
findTreeRoots(): Iterator<Node>;
/**
* Explicitly bring focus to the Diagram's canvas.
*/
focus(): void;
/**
* This static function gets the Diagram that is attached to an HTML DIV element.
* @param {HTMLDivElement} div
*/
static fromDiv(div: HTMLDivElement): Diagram;
/**
* Make the given part the only highlighted part.
* @param {Part} part
*/
highlight(part: Part): void;
/**
* Highlight all of the Parts supplied in the given collection, and clear all other highlighted Parts.
* @param {Iterable<Part>|Array<Part>} coll an Iterable of Parts
*/
highlightCollection(coll: Iterable<Part> | Array<Part>): void;
/**
* This static function declares that a class (constructor function) derives from another class -- but please note that most classes do not support inheritance.
* @param {Function} derivedclass
* @param {Function} baseclass
*/
static inherit(derivedclass: Constructor, baseclass: Constructor): void;
/**
* Perform all invalid layouts.
* @param {boolean=} invalidateAll If true, this will explicitly set Layout.isValidLayout to false on each Layout in the diagram.
*/
layoutDiagram(invalidateAll?: boolean): void;
/**
* Create an HTMLImageElement that contains a bitmap of the current Diagram.
* @param {Object=} properties For details see the argument description of .makeImageData.
*/
makeImage(properties?: Object): HTMLImageElement;
/**
* Create a bitmap of the current Diagram encoded as a base64 string.
* @param {{ size: Size,
scale: number,
maxSize: Size,
position: Point,
parts: Iterable<Part>,
padding: (Margin|number),
showTemporary: boolean,
showGrid: boolean,
document: Document,
type: string,
details: *
}=} properties a JavaScript object detailing optional arguments for image creation, to be passed to makeImageData.
*/
makeImageData(properties?: Object): string;
/**
* Create an SVGElement that contains a SVG rendering of the current Diagram.
* By default this method returns a snapshot of the visible diagram, but optional arguments give more options.
* @param {{ size: Size,
scale: number,
maxSize: Size,
position: Point,
parts: Iterable<Part>,
padding: (Margin|number),
showTemporary: boolean,
showGrid: boolean,
document: Document,
elementFinished: function(GraphObject, SVGElement),
details: *
}=} properties a JavaScript object detailing optional arguments for SVG creation.
* @return {SVGElement}
*/
makeSvg(properties?: Object): SVGElement;
/**
* Move a collection of Parts in this Diagram by a given offset.
* @param {Iterable<Part>} coll A List or a Set or Iterator of Parts.
* @param {Point} offset the X and Y change to be made to each Part, in document coordinates.
* @param {boolean} check Whether to check Part.canMove on each part.
*/
moveParts(coll: Iterable<Part>, offset: Point, check: boolean): void;
/**
* Remove all of the Parts created from model data and then create them again.
*/
rebuildParts(): void;
/**
* Removes a Part from its Layer, provided the Layer is in this Diagram.