forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
goJS.d.ts
8123 lines (6395 loc) · 335 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 1.2
// Project: http://gojs.net
// Definitions by: Barbara Duckworth <https://github.com/barbara42/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/* Copyright (C) 1998-2013 by Northwoods Software Corporation. */
// A number of types have been declared "any" because they would best be described by a union of specific types,
// not as truly "any" type, and TypeScript does not support union types. Most of the cases are due to:
// - a property of type Margin whose setter also accepts a number, for a uniform Margin of that thickness
// - a property of type Brush whose setter also accepts a string, a CSS color string for a solid color Brush
// - a boolean property that may also be null (tri-state)
// - a key type, which may be a string or a number, uniquely identifying a node data within a Model
// - a property that is string that names a property or that is a function that gets or sets a value, on an Object in a Model
declare module go {
/**
* 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;
/**Gets the Part that contains the adorned object.*/
adornedPart: Part;
/**Gets a Placeholder that this Adornment may contain in its visual tree.*/
placeholder: Placeholder;
}
/**
* 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.*/
archetypeGroupData: Object;
/**Gets or sets whether #copySelection should also copy subtrees.*/
copiesTree: boolean;
/**Gets or sets whether #deleteSelection should also delete subtrees.*/
deletesTree: boolean;
/**Gets 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.*/
memberValidation: (g: Group, p: Part) => boolean;
/**Gets or sets the amount by which #decreaseZoom and #increaseZoom change the Diagram#scale; default is 1.05.*/
zoomFactor: number;
/**
* Make sure all of the unnested Parts in the given collection are removed from any containing Groups.
* @param {Iterable} 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, 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 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);
/**
* Collapse all expanded selected Nodes.
* @param {Node=} node if supplied, ignore the selection and collapse this particular Node subtree.
*/
collapseTree(node?: Node);
/**
* Copy the currently selected parts, Diagram#selection, from the Diagram into the clipboard.
*/
copySelection();
/**
* This makes a copy of the given collection of Parts and stores it in a static variable acting as the clipboard.
* @param {Iterable} coll A collection of Parts.
*/
copyToClipboard(coll: Iterable);
/**
* Execute a #copySelection followed by a #deleteSelection.
*/
cutSelection();
/**
* 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);
/**
* Delete the currently selected parts from the diagram.
*/
deleteSelection();
/**
* This is called by tools to handle keyboard commands.
*/
doKeyDown();
/**
* This is called by tools to handle keyboard commands.
*/
doKeyUp();
/**
* Start in-place editing of a TextBlock in the selected Part.
* @param {TextBlock=} textblock the TextBlock to start editing.
*/
editTextBlock(textblock?: TextBlock);
/**
* Expand all collapsed selected Groups.
* @param {Group=} group if supplied, ignore the selection and expand this particular Group.
*/
expandSubGraph(group?: Group);
/**
* Expand all collapsed selected Nodes.
* @param {Node=} node if supplied, ignore the selection and collapse this particular Node subtree.
*/
expandTree(node?: Node);
/**
* 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();
/**
* 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);
/**
* 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;
/**
* 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);
/**
* Call UndoManager#redo.
*/
redo();
/**
* 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);
/**
* Select all of the selectable Parts in the diagram.
*/
selectAll();
/**
* Cancel the operation of the current tool.
*/
stopCommand();
/**
* Call UndoManager#undo.
*/
undo();
/**
* 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);
/**
* Change the Diagram#scale so that the Diagram#documentBounds fits within the viewport.
*/
zoomToFit();
}
/**
* 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;
/**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: any;
/**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;
/**Gets 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 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;
/**Gets or sets whether the Diagram has a horizontal Scrollbar.*/
hasHorizontalScrollbar: boolean;
/**Gets or sets whether the Diagram has a vertical Scrollbar.*/
hasVerticalScrollbar: boolean;
/**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;
/**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;
/**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;
/**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;
/**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;
/**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: any;
/**Returns an iterator of all Parts in the Diagram that are not Nodes or Links or Adornments.*/
parts: Iterator;
/**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;
/**Gets the read-only collection of selected objects.*/
selection: Set;
/**Gets or sets whether ChangedEvents are not recorded by the UndoManager.*/
skipsUndoManager: boolean;
/**Gets the UndoManager for this Diagram, which actually belongs to the #model.*/
toolManager: ToolManager;
/**This Adornment is shown when the mouse stays motionless in the background.*/
toolTip: Adornment;
/**Gets 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;
/**Gets 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);
/**
* 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);
/**
* 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);
/**
* Adds a Layer to the list of layers.
* @param {Layer} layer The Layer to add.
*/
addLayer(layer: Layer);
/**
* 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);
/**
* 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);
/**
* 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);
/**
* Modifies the #position to show a given Rect of the Diagram by centering the viewport on that Rect.
* @param {Rect} r
*/
centerRect(r: Rect);
/**
* Removes all Parts from the Diagram, including unbound Parts and the background grid, and also clears out the Model and UndoManager.
*/
clear();
/**
* Deselect all selected Parts.
*/
clearSelection();
/**
* Commit the changes of the current transaction.
* @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} coll a collection of Parts.
*/
computePartsBounds(coll: Iterable): Rect;
/**
* 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);
/**
* 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;
/**
* 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: any): 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): Iterable;
findObjectsAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, coll?: Set): Iterable;
/**
* 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): Iterable;
findObjectsIn(r: Rect, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set): Iterable;
/**
* 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): Iterable;
findObjectsNear(p: Point, dist: number, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set): Iterable;
/**
* 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: any): Part;
/**
* Returns an iterator of all Groups that are at top-level, in other words that are not themselves inside other Groups.
*/
findTopLevelGroups(): Iterator;
/**
* Returns an iterator of all top-level Nodes that have no tree parents.
*/
findTreeRoots(): Iterator;
/**
* Explicitly bring focus to the Diagram's canvas.
*/
focus();
/**
* This static method gets the Diagram that is attached to an HTML DIV element.
* @param {HTMLDivElement} div
*/
static fromDiv(div: HTMLDivElement): Diagram;
/**
* 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: new(...args: any[]) => Object, baseclass: new(...args: any[]) => Object);
/**
* 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);
/**
* 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,
padding: (Margin|number),
showTemporary: boolean,
showGrid: boolean,
type: string,
details: Object}=} properties a JavaScript object detailing optional arguments for image creation, to be passed to makeImageData.
*/
makeImageData(properties?: Object): string;
/**
* Remove all of the Parts created from model data and then create them again.
*/
rebuildParts();
/**
* Removes a Part from its Layer, provided the Layer is in this Diagram.
* @param {Part} part
*/
remove(part: Part);
/**
* Unregister an event handler listener.
* @param {function(ChangedEvent)} listener a function that takes a ChangedEvent as its argument.
*/
removeChangedListener(listener: (e: ChangedEvent) => void);
/**
* Unregister a DiagramEvent handler.
* @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.
*/
removeDiagramListener(name: string, listener: (e: DiagramEvent) => void);
/**
* Removes the given layer from the list of layers.
* @param {Layer} layer
*/
removeLayer(layer: Layer);
/**
* Rollback the current transaction, undoing any recorded changes.
*/
rollbackTransaction(): boolean;
/**
* Scrolling function used by primarily by #commandHandler's CommandHandler#doKeyDown.
* @param {string} unit A string representing the unit of the scroll operation. Can be 'pixel', 'line', or 'page'.
* @param {string} dir The direction of the scroll operation. Can be 'up', 'down', 'left', or 'right'.
* @param {number=} dist An optional distance multiplier, for multiple pixels, lines, or pages. Default is 1.
*/
scroll(unit: string, dir: string, dist?: number);
/**
* Modifies the #position to show a given Rect of the Diagram by centering the viewport on that Rect.
* @param {Rect} r
*/
scrollToRect(r: Rect);
/**
* Make the given object the only selected object.
* @param {GraphObject} part a GraphObject that is already in a layer of this Diagram.
* If the value is null, this does nothing.
*/
select(part: Part);
/**
* Select all of the Parts supplied in the given collection.
* @param {Iterable} coll a List or Set of Parts to be selected.
*/
selectCollection(coll: Iterable);
/**
* Begin a transaction, where the changes are held by a Transaction object in the UndoManager.
* @param {string=} tname a descriptive name for the transaction.
*/
startTransaction(tname?: string): boolean;
/**
* Given a Point in document coordinates, return a new Point in viewport coordinates.
* @param {Point} p
*/
transformDocToView(p: Point): Point;
/**
* Given a point in viewport coordinates, return a new point in document coordinates.
* @param {Point} p
*/
transformViewToDoc(p: Point): Point;
/**
* Update all of the data-bound properties of Nodes and Links in this diagram.
*/
updateAllTargetBindings();
/**
* Scales the Diagram to uniformly fit into the viewport.
*/
zoomToFit();
/**
* Modifies the #scale and #position of the Diagram so that the viewport displays a given document-coordinates rectangle.
* @param {Rect} r rectangular bounds in document coordinates.
* @param {EnumValue=} scaling an optional value of either #Uniform (the default) or #UniformToFill.
*/
zoomToRect(r: Rect, scaling?: EnumValue);
/**This value for Diagram#validCycle states that there are no restrictions on making cycles of links.*/
static CycleAll: EnumValue;
/**This value for Diagram#validCycle states that any number of destination links may go out of a node, but at most one source link may come into a node, and there are no directed cycles.*/
static CycleDestinationTree: EnumValue;
/**This value for Diagram#validCycle states that a valid link from a node will not produce a directed cycle in the graph.*/
static CycleNotDirected: EnumValue;
/**This value for Diagram#validCycle states that a valid link from a node will not produce an undirected cycle in the graph.*/
static CycleNotUndirected: EnumValue;
/**This value for Diagram#validCycle states that any number of source links may come into a node, but at most one destination link may go out of a node, and there are no directed cycles.*/
static CycleSourceTree: EnumValue;
/**The default autoScale type, used as the value of Diagram#autoScale: The Diagram does not attempt to scale its bounds to fit the view.*/
static None: EnumValue;
/**Diagrams with this autoScale type, used as the value of Diagram#autoScale, are scaled uniformly until the documentBounds fits in the view.*/
static Uniform: EnumValue;
/**Diagrams with this autoScale type, used as the value of Diagram#autoScale, are scaled uniformly until the documentBounds fits in the view.*/
static UniformToFill: EnumValue;
maybeUpdate(); // undocumented
requestUpdate(); // undocumented
}
/**
* A DiagramEvent represents a more abstract event than an InputEvent.
* They are raised on the Diagram class.
* One can receive such events by registering a DiagramEvent listener on a Diagram
* by calling Diagram#addDiagramListener.
* Some DiagramEvents such as "ObjectSingleClicked" are normally
* associated with InputEvents.
* Some DiagramEvents such as "SelectionMoved" or "PartRotated" are associated with the
* results of Tool-handled gestures or CommandHandler actions.
* Some DiagramEvents are not necessarily associated with any input events at all,
* such as "ViewportBoundsChanged", which can happen due to programmatic
* changes to the Diagram#position and Diagram#scale properties.
*/
class DiagramEvent {
/**
* The DiagramEvent class constructor produces an empty DiagramEvent.
*/
constructor();
/**Gets or sets whether any default actions associated with this diagram event should be avoided or cancelled.*/
cancel: boolean;
/**Gets the diagram associated with the event.*/
diagram: Diagram;
/**Gets or sets the name of the kind of diagram event that this represents.*/
name: string;
/**Gets or sets an optional object that describes the change to the subject of the diagram event.*/
parameter: any;