@joint/core 4.0.3 → 4.1.0-beta.1
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/README.md +2 -10
- package/dist/geometry.js +4962 -6132
- package/dist/geometry.min.js +2 -2
- package/dist/joint.d.ts +338 -52
- package/dist/joint.js +34067 -37525
- package/dist/joint.min.js +2 -2
- package/dist/joint.nowrap.js +34067 -37525
- package/dist/joint.nowrap.min.js +2 -2
- package/dist/vectorizer.js +7288 -8907
- package/dist/vectorizer.min.js +2 -2
- package/dist/version.mjs +1 -1
- package/package.json +10 -15
- package/src/{linkTools → cellTools}/Button.mjs +8 -6
- package/src/{elementTools → cellTools}/Control.mjs +3 -3
- package/src/{linkTools → cellTools}/HoverConnect.mjs +1 -1
- package/src/dia/Cell.mjs +60 -33
- package/src/dia/CellView.mjs +75 -8
- package/src/dia/ElementView.mjs +13 -8
- package/src/dia/Graph.mjs +148 -40
- package/src/dia/HighlighterView.mjs +8 -4
- package/src/dia/LinkView.mjs +61 -4
- package/src/dia/Paper.mjs +84 -0
- package/src/dia/ToolView.mjs +29 -4
- package/src/dia/ToolsView.mjs +25 -10
- package/src/dia/attributes/connection.mjs +5 -0
- package/src/dia/attributes/defs.mjs +3 -0
- package/src/dia/attributes/eval.mjs +3 -3
- package/src/dia/attributes/index.mjs +3 -0
- package/src/dia/attributes/shape.mjs +4 -0
- package/src/dia/attributes/text.mjs +41 -15
- package/src/dia/ports.mjs +4 -0
- package/src/elementTools/HoverConnect.mjs +5 -5
- package/src/elementTools/index.mjs +5 -4
- package/src/env/index.mjs +5 -0
- package/src/g/rect.mjs +13 -5
- package/src/layout/ports/port.mjs +4 -5
- package/src/linkTools/Anchor.mjs +1 -1
- package/src/linkTools/Arrowhead.mjs +2 -1
- package/src/linkTools/RotateLabel.mjs +110 -0
- package/src/linkTools/Segments.mjs +1 -1
- package/src/linkTools/Vertices.mjs +41 -4
- package/src/linkTools/index.mjs +7 -4
- package/src/mvc/View.mjs +0 -1
- package/src/mvc/ViewBase.mjs +2 -1
- package/src/routers/rightAngle.mjs +538 -140
- package/src/shapes/standard.mjs +8 -1
- package/src/{dia/attributes → util}/calc.mjs +24 -12
- package/src/util/index.mjs +1 -0
- package/src/util/util.mjs +39 -0
- package/src/util/utilHelpers.mjs +2 -1
- package/types/geometry.d.ts +6 -1
- package/types/joint.d.ts +331 -50
- /package/src/{linkTools → cellTools}/Boundary.mjs +0 -0
- /package/src/{linkTools → cellTools}/Connect.mjs +0 -0
- /package/src/{linkTools → cellTools}/helpers.mjs +0 -0
package/dist/joint.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! JointJS v4.0.
|
|
1
|
+
/*! JointJS v4.1.0-beta.1 (2024-10-30) - JavaScript diagramming library
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -618,6 +618,16 @@ export declare namespace connectors {
|
|
|
618
618
|
var curve: CurveConnector;
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
+
declare type DeepPartial<T> = _DeepPartial<_DeepRequired<T>>;
|
|
622
|
+
|
|
623
|
+
declare type _DeepPartial<T> = {
|
|
624
|
+
[P in keyof T]?: T[P] extends object ? _DeepPartial<T[P]> : T[P];
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
declare type _DeepRequired<T> = {
|
|
628
|
+
[P in keyof T]-?: T[P] extends object ? _DeepRequired<T[P]> : T[P];
|
|
629
|
+
};
|
|
630
|
+
|
|
621
631
|
export declare namespace dia {
|
|
622
632
|
|
|
623
633
|
export type Event = mvc.TriggeredEvent;
|
|
@@ -661,10 +671,11 @@ export declare namespace dia {
|
|
|
661
671
|
export type OrthogonalDirection =
|
|
662
672
|
'left' | 'top' | 'right' | 'bottom';
|
|
663
673
|
|
|
664
|
-
export type
|
|
665
|
-
OrthogonalDirection |
|
|
674
|
+
export type DiagonalDirection =
|
|
666
675
|
'top-left' | 'top-right' | 'bottom-right' | 'bottom-left';
|
|
667
676
|
|
|
677
|
+
export type Direction = OrthogonalDirection | DiagonalDirection;
|
|
678
|
+
|
|
668
679
|
export type LinkEnd =
|
|
669
680
|
'source' | 'target';
|
|
670
681
|
|
|
@@ -758,6 +769,20 @@ export declare namespace dia {
|
|
|
758
769
|
breadthFirst?: boolean;
|
|
759
770
|
}
|
|
760
771
|
|
|
772
|
+
export interface FindAtPointOptions extends Options {
|
|
773
|
+
strict?: boolean;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
export interface FindInAreaOptions extends Options {
|
|
777
|
+
strict?: boolean;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
export type SearchByKey = 'bbox' | PositionName;
|
|
781
|
+
|
|
782
|
+
export interface FindUnderElementOptions extends FindInAreaOptions, FindAtPointOptions {
|
|
783
|
+
searchBy?: SearchByKey;
|
|
784
|
+
}
|
|
785
|
+
|
|
761
786
|
export class Cells extends mvc.Collection<Cell> {
|
|
762
787
|
graph: Graph;
|
|
763
788
|
cellNamespace: any;
|
|
@@ -834,17 +859,48 @@ export declare namespace dia {
|
|
|
834
859
|
|
|
835
860
|
getCommonAncestor(...cells: Cell[]): Element | undefined;
|
|
836
861
|
|
|
837
|
-
toJSON(): any;
|
|
862
|
+
toJSON(opt?: { cellAttributes?: dia.Cell.ExportOptions }): any;
|
|
838
863
|
|
|
839
864
|
fromJSON(json: any, opt?: S): this;
|
|
840
865
|
|
|
841
866
|
clear(opt?: { [key: string]: any }): this;
|
|
842
867
|
|
|
868
|
+
findElementsAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Element[];
|
|
869
|
+
|
|
870
|
+
findElementsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Element[];
|
|
871
|
+
|
|
872
|
+
findElementsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Element[];
|
|
873
|
+
|
|
874
|
+
findLinksAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Link[];
|
|
875
|
+
|
|
876
|
+
findLinksInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Link[];
|
|
877
|
+
|
|
878
|
+
findLinksUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Link[];
|
|
879
|
+
|
|
880
|
+
findCellsAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Cell[];
|
|
881
|
+
|
|
882
|
+
findCellsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Cell[];
|
|
883
|
+
|
|
884
|
+
findCellsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Cell[];
|
|
885
|
+
|
|
886
|
+
protected _getFindUnderElementGeometry(element: Element, searchBy: Graph.SearchByKey): g.Point | g.Rect;
|
|
887
|
+
|
|
888
|
+
protected _validateCellsUnderElement<T extends Cell[]>(cells: T, element: Element): T;
|
|
889
|
+
|
|
890
|
+
protected _isValidElementUnderElement(el1: Element, el2: Element): boolean;
|
|
891
|
+
|
|
892
|
+
protected _isValidLinkUnderElement(link: Link, element: Element): boolean;
|
|
893
|
+
|
|
894
|
+
protected _filterCellsUnderElement(cells: Cell[], element: Element, opt: Graph.FindUnderElementOptions): Cell[];
|
|
895
|
+
|
|
896
|
+
/** @deprecated use `findElementsAtPoint` instead */
|
|
843
897
|
findModelsFromPoint(p: Point): Element[];
|
|
844
898
|
|
|
845
|
-
|
|
899
|
+
/** @deprecated use `findElementsInArea` instead */
|
|
900
|
+
findModelsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Element[];
|
|
846
901
|
|
|
847
|
-
|
|
902
|
+
/** @deprecated use `findElementsUnderElement` instead */
|
|
903
|
+
findModelsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Element[];
|
|
848
904
|
|
|
849
905
|
getBBox(): g.Rect | null;
|
|
850
906
|
|
|
@@ -858,6 +914,10 @@ export declare namespace dia {
|
|
|
858
914
|
|
|
859
915
|
removeCells(cells: Cell[], opt?: Cell.DisconnectableOptions): this;
|
|
860
916
|
|
|
917
|
+
transferCellEmbeds(sourceCell: Cell, targetCell: Cell, opt?: S): void;
|
|
918
|
+
|
|
919
|
+
transferCellConnectedLinks(sourceCell: Cell, targetCell: Cell, opt?: Graph.ConnectionOptions): void;
|
|
920
|
+
|
|
861
921
|
resize(width: number, height: number, opt?: S): this;
|
|
862
922
|
|
|
863
923
|
resizeCells(width: number, height: number, cells: Cell[], opt?: S): this;
|
|
@@ -902,6 +962,10 @@ export declare namespace dia {
|
|
|
902
962
|
[key: string]: any;
|
|
903
963
|
}
|
|
904
964
|
|
|
965
|
+
export interface EmbedOptions extends Options {
|
|
966
|
+
reparent?: boolean;
|
|
967
|
+
}
|
|
968
|
+
|
|
905
969
|
export interface EmbeddableOptions<T = boolean> extends Options {
|
|
906
970
|
deep?: T;
|
|
907
971
|
}
|
|
@@ -929,11 +993,57 @@ export declare namespace dia {
|
|
|
929
993
|
export interface ConstructorOptions extends Graph.Options {
|
|
930
994
|
mergeArrays?: boolean;
|
|
931
995
|
}
|
|
996
|
+
|
|
997
|
+
export interface ExportOptions {
|
|
998
|
+
ignoreDefault?: boolean | string[];
|
|
999
|
+
ignoreEmptyAttributes?: boolean;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
export type UnsetCallback<V> = (
|
|
1003
|
+
this: V,
|
|
1004
|
+
node: Element,
|
|
1005
|
+
nodeAttributes: { [name: string]: any },
|
|
1006
|
+
cellView: V
|
|
1007
|
+
) => string | Array<string> | null | void;
|
|
1008
|
+
|
|
1009
|
+
export type SetCallback<V> = (
|
|
1010
|
+
this: V,
|
|
1011
|
+
attributeValue: any,
|
|
1012
|
+
refBBox: g.Rect,
|
|
1013
|
+
node: Element,
|
|
1014
|
+
nodeAttributes: { [name: string]: any },
|
|
1015
|
+
cellView: V
|
|
1016
|
+
) => { [key: string]: any } | string | number | void;
|
|
1017
|
+
|
|
1018
|
+
export type PositionCallback<V> = (
|
|
1019
|
+
this: V,
|
|
1020
|
+
attributeValue: any,
|
|
1021
|
+
refBBox: g.Rect,
|
|
1022
|
+
node: Element,
|
|
1023
|
+
nodeAttributes: { [name: string]: any },
|
|
1024
|
+
cellView: V
|
|
1025
|
+
) => dia.Point | null | void;
|
|
1026
|
+
|
|
1027
|
+
export type OffsetCallback<V> = (
|
|
1028
|
+
this: V,
|
|
1029
|
+
attributeValue: any,
|
|
1030
|
+
nodeBBox: g.Rect,
|
|
1031
|
+
node: Element,
|
|
1032
|
+
nodeAttributes: { [name: string]: any },
|
|
1033
|
+
cellView: V
|
|
1034
|
+
) => dia.Point | null | void;
|
|
1035
|
+
|
|
1036
|
+
export interface PresentationAttributeDefinition<V = dia.CellView> {
|
|
1037
|
+
set?: SetCallback<V> | string;
|
|
1038
|
+
unset?: UnsetCallback<V> | string | Array<string>;
|
|
1039
|
+
position?: PositionCallback<V>;
|
|
1040
|
+
offset?: OffsetCallback<V>;
|
|
1041
|
+
}
|
|
932
1042
|
}
|
|
933
1043
|
|
|
934
1044
|
export class Cell<A extends ObjectHash = Cell.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends mvc.Model<A, S> {
|
|
935
1045
|
|
|
936
|
-
constructor(attributes?: A
|
|
1046
|
+
constructor(attributes?: DeepPartial<A>, opt?: Cell.ConstructorOptions);
|
|
937
1047
|
|
|
938
1048
|
id: Cell.ID;
|
|
939
1049
|
graph: Graph;
|
|
@@ -946,7 +1056,7 @@ export declare namespace dia {
|
|
|
946
1056
|
|
|
947
1057
|
protected stopScheduledTransitions(path?: string, delim?: string): void;
|
|
948
1058
|
|
|
949
|
-
toJSON(): Cell.JSON<any, A>;
|
|
1059
|
+
toJSON(opt?: dia.Cell.ExportOptions): Cell.JSON<any, A>;
|
|
950
1060
|
|
|
951
1061
|
remove(opt?: Cell.DisconnectableOptions): this;
|
|
952
1062
|
|
|
@@ -967,7 +1077,7 @@ export declare namespace dia {
|
|
|
967
1077
|
isEmbedded(): boolean;
|
|
968
1078
|
|
|
969
1079
|
prop(key: Path): any;
|
|
970
|
-
prop(object:
|
|
1080
|
+
prop(object: DeepPartial<A>, opt?: Cell.Options): this;
|
|
971
1081
|
prop(key: Path, value: any, opt?: Cell.Options): this;
|
|
972
1082
|
|
|
973
1083
|
removeProp(path: Path, opt?: Cell.Options): this;
|
|
@@ -988,7 +1098,7 @@ export declare namespace dia {
|
|
|
988
1098
|
|
|
989
1099
|
stopTransitions(path?: string, delim?: string): this;
|
|
990
1100
|
|
|
991
|
-
embed(cell: Cell | Cell[], opt?:
|
|
1101
|
+
embed(cell: Cell | Cell[], opt?: Cell.EmbedOptions): this;
|
|
992
1102
|
|
|
993
1103
|
unembed(cell: Cell | Cell[], opt?: Graph.Options): this;
|
|
994
1104
|
|
|
@@ -1099,6 +1209,10 @@ export declare namespace dia {
|
|
|
1099
1209
|
deep?: boolean;
|
|
1100
1210
|
}
|
|
1101
1211
|
|
|
1212
|
+
export interface ResizeOptions extends Cell.Options {
|
|
1213
|
+
direction?: Direction;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1102
1216
|
export interface BBoxOptions extends Cell.EmbeddableOptions {
|
|
1103
1217
|
rotate?: boolean;
|
|
1104
1218
|
}
|
|
@@ -1112,9 +1226,10 @@ export declare namespace dia {
|
|
|
1112
1226
|
position(x: number, y: number, opt?: Element.PositionOptions): this;
|
|
1113
1227
|
|
|
1114
1228
|
size(): Size;
|
|
1115
|
-
size(
|
|
1229
|
+
size(size: Partial<Size>, opt?: Element.ResizeOptions): this;
|
|
1230
|
+
size(width: number, height: number, opt?: Element.ResizeOptions): this;
|
|
1116
1231
|
|
|
1117
|
-
resize(width: number, height: number, opt?:
|
|
1232
|
+
resize(width: number, height: number, opt?: Element.ResizeOptions): this;
|
|
1118
1233
|
|
|
1119
1234
|
rotate(deg: number, absolute?: boolean, origin?: Point, opt?: { [key: string]: any }): this;
|
|
1120
1235
|
|
|
@@ -1154,6 +1269,8 @@ export declare namespace dia {
|
|
|
1154
1269
|
|
|
1155
1270
|
getPortIndex(port: string | Element.Port): number;
|
|
1156
1271
|
|
|
1272
|
+
getPortGroupNames(): string[];
|
|
1273
|
+
|
|
1157
1274
|
portProp(portId: string, path: dia.Path): any;
|
|
1158
1275
|
|
|
1159
1276
|
portProp(portId: string, path: dia.Path, value?: any, opt?: S): Element;
|
|
@@ -1161,6 +1278,8 @@ export declare namespace dia {
|
|
|
1161
1278
|
protected generatePortId(): string | number;
|
|
1162
1279
|
|
|
1163
1280
|
static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Element>;
|
|
1281
|
+
|
|
1282
|
+
static attributes: { [attributeName: string]: Cell.PresentationAttributeDefinition<ElementView> };
|
|
1164
1283
|
}
|
|
1165
1284
|
|
|
1166
1285
|
// dia.Link
|
|
@@ -1309,6 +1428,8 @@ export declare namespace dia {
|
|
|
1309
1428
|
translate(tx: number, ty: number, opt?: S): this;
|
|
1310
1429
|
|
|
1311
1430
|
static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Link>;
|
|
1431
|
+
|
|
1432
|
+
static attributes: { [attributeName: string]: Cell.PresentationAttributeDefinition<LinkView> };
|
|
1312
1433
|
}
|
|
1313
1434
|
|
|
1314
1435
|
// dia.CellView
|
|
@@ -1426,6 +1547,14 @@ export declare namespace dia {
|
|
|
1426
1547
|
|
|
1427
1548
|
isDefaultInteractionPrevented(evt: dia.Event): boolean;
|
|
1428
1549
|
|
|
1550
|
+
isIntersecting(geometryShape: g.Shape, geometryData?: g.SegmentSubdivisionsOpt | null): boolean;
|
|
1551
|
+
|
|
1552
|
+
protected isEnclosedIn(area: g.Rect): boolean;
|
|
1553
|
+
|
|
1554
|
+
protected isInArea(area: g.Rect, options: g.StrictOpt): boolean;
|
|
1555
|
+
|
|
1556
|
+
protected isAtPoint(point: g.Point, options: g.StrictOpt): boolean;
|
|
1557
|
+
|
|
1429
1558
|
protected findBySelector(selector: string, root?: SVGElement): SVGElement[];
|
|
1430
1559
|
|
|
1431
1560
|
protected removeHighlighters(): void;
|
|
@@ -1527,6 +1656,8 @@ export declare namespace dia {
|
|
|
1527
1656
|
|
|
1528
1657
|
getDelegatedView(): ElementView | null;
|
|
1529
1658
|
|
|
1659
|
+
getTargetParentView(evt: dia.Event): CellView | null;
|
|
1660
|
+
|
|
1530
1661
|
findPortNode(portId: string | number): SVGElement | null;
|
|
1531
1662
|
findPortNode(portId: string | number, selector: string): E | null;
|
|
1532
1663
|
|
|
@@ -1615,6 +1746,11 @@ export declare namespace dia {
|
|
|
1615
1746
|
options: LinkView.Options<L>;
|
|
1616
1747
|
sourceAnchor: g.Point;
|
|
1617
1748
|
targetAnchor: g.Point;
|
|
1749
|
+
sourcePoint: g.Point;
|
|
1750
|
+
targetPoint: g.Point;
|
|
1751
|
+
sourceBBox: g.Rect;
|
|
1752
|
+
targetBBox: g.Rect;
|
|
1753
|
+
route: g.Point[];
|
|
1618
1754
|
|
|
1619
1755
|
sendToken(token: SVGElement, duration?: number, callback?: () => void): void;
|
|
1620
1756
|
sendToken(token: SVGElement, opt?: { duration?: number, direction?: string, connection?: string }, callback?: () => void): void;
|
|
@@ -1821,6 +1957,11 @@ export declare namespace dia {
|
|
|
1821
1957
|
afterRender?: AfterRenderCallback;
|
|
1822
1958
|
}
|
|
1823
1959
|
|
|
1960
|
+
export interface SnapLinksOptions {
|
|
1961
|
+
radius?: number;
|
|
1962
|
+
findInAreaOptions?: FindInAreaOptions;
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1824
1965
|
export type PointConstraintCallback = (x: number, y: number, opt: any) => Point;
|
|
1825
1966
|
export type RestrictTranslateCallback = (elementView: ElementView, x0: number, y0: number) => BBox | boolean | PointConstraintCallback;
|
|
1826
1967
|
export type FindParentByType = 'bbox' | 'pointer' | PositionName;
|
|
@@ -1839,7 +1980,7 @@ export declare namespace dia {
|
|
|
1839
1980
|
highlighting?: boolean | Record<string | dia.CellView.Highlighting, highlighters.HighlighterJSON | boolean>;
|
|
1840
1981
|
interactive?: ((cellView: CellView, event: string) => boolean | CellView.InteractivityOptions) | boolean | CellView.InteractivityOptions;
|
|
1841
1982
|
snapLabels?: boolean;
|
|
1842
|
-
snapLinks?: boolean |
|
|
1983
|
+
snapLinks?: boolean | SnapLinksOptions;
|
|
1843
1984
|
snapLinksSelf?: boolean | { distance: number };
|
|
1844
1985
|
markAvailable?: boolean;
|
|
1845
1986
|
// validations
|
|
@@ -2013,6 +2154,20 @@ export declare namespace dia {
|
|
|
2013
2154
|
// custom
|
|
2014
2155
|
[eventName: string]: mvc.EventHandler;
|
|
2015
2156
|
}
|
|
2157
|
+
|
|
2158
|
+
export interface BufferOptions {
|
|
2159
|
+
/**
|
|
2160
|
+
* A buffer around the area to extend the search to
|
|
2161
|
+
* to mitigate the differences between the model and view geometry.
|
|
2162
|
+
*/
|
|
2163
|
+
buffer?: number;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
export interface FindAtPointOptions extends Graph.FindAtPointOptions, BufferOptions {
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
export interface FindInAreaOptions extends Graph.FindInAreaOptions, BufferOptions {
|
|
2170
|
+
}
|
|
2016
2171
|
}
|
|
2017
2172
|
|
|
2018
2173
|
export class Paper extends mvc.View<Graph> {
|
|
@@ -2106,19 +2261,52 @@ export declare namespace dia {
|
|
|
2106
2261
|
|
|
2107
2262
|
findViewByModel<T extends ElementView | LinkView>(model: Cell | Cell.ID): T;
|
|
2108
2263
|
|
|
2109
|
-
|
|
2264
|
+
/**
|
|
2265
|
+
* Finds all the element views at the specified point
|
|
2266
|
+
* @param point a point in local paper coordinates
|
|
2267
|
+
* @param opt options for the search
|
|
2268
|
+
*/
|
|
2269
|
+
findElementViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): ElementView[];
|
|
2110
2270
|
|
|
2111
|
-
|
|
2271
|
+
/**
|
|
2272
|
+
* Finds all the link views at the specified point
|
|
2273
|
+
* @param point a point in local paper coordinates
|
|
2274
|
+
* @param opt options for the search
|
|
2275
|
+
*/
|
|
2276
|
+
findLinkViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): LinkView[];
|
|
2112
2277
|
|
|
2113
|
-
|
|
2114
|
-
|
|
2278
|
+
/**
|
|
2279
|
+
* Finds all the cell views at the specified point
|
|
2280
|
+
* @param point a point in local paper coordinates
|
|
2281
|
+
* @param opt options for the search
|
|
2282
|
+
*/
|
|
2283
|
+
findCellViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): CellView[];
|
|
2115
2284
|
|
|
2116
|
-
|
|
2285
|
+
/**
|
|
2286
|
+
* Finds all the element views in the specified area
|
|
2287
|
+
* @param area a rectangle in local paper coordinates
|
|
2288
|
+
* @param opt options for the search
|
|
2289
|
+
*/
|
|
2290
|
+
findElementViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): ElementView[];
|
|
2117
2291
|
|
|
2118
2292
|
/**
|
|
2119
|
-
*
|
|
2293
|
+
* Finds all the link views in the specified area
|
|
2294
|
+
* @param area a rectangle in local paper coordinates
|
|
2295
|
+
* @param opt options for the search
|
|
2120
2296
|
*/
|
|
2121
|
-
|
|
2297
|
+
findLinkViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): LinkView[];
|
|
2298
|
+
|
|
2299
|
+
/**
|
|
2300
|
+
* Finds all the cell views in the specified area
|
|
2301
|
+
* @param area a rectangle in local paper coordinates
|
|
2302
|
+
* @param opt options for the search
|
|
2303
|
+
*/
|
|
2304
|
+
findCellViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): CellView[];
|
|
2305
|
+
|
|
2306
|
+
fitToContent(opt?: Paper.FitToContentOptions): g.Rect;
|
|
2307
|
+
fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, opt?: any): g.Rect;
|
|
2308
|
+
|
|
2309
|
+
getFitToContentArea(opt?: Paper.FitToContentOptions): g.Rect;
|
|
2122
2310
|
|
|
2123
2311
|
transformToFitContent(opt?: Paper.TransformToFitContentOptions): void;
|
|
2124
2312
|
|
|
@@ -2191,7 +2379,6 @@ export declare namespace dia {
|
|
|
2191
2379
|
mountBatchSize?: number;
|
|
2192
2380
|
unmountBatchSize?: number;
|
|
2193
2381
|
viewport?: Paper.ViewportCallback;
|
|
2194
|
-
progress?: Paper.ProgressCallback;
|
|
2195
2382
|
}): void;
|
|
2196
2383
|
|
|
2197
2384
|
checkViewport(opt?: {
|
|
@@ -2206,10 +2393,10 @@ export declare namespace dia {
|
|
|
2206
2393
|
updateViews(opt?: {
|
|
2207
2394
|
batchSize?: number;
|
|
2208
2395
|
viewport?: Paper.ViewportCallback;
|
|
2209
|
-
progress?: Paper.ProgressCallback;
|
|
2210
2396
|
}): {
|
|
2211
2397
|
updated: number;
|
|
2212
2398
|
batches: number;
|
|
2399
|
+
priority: number;
|
|
2213
2400
|
};
|
|
2214
2401
|
|
|
2215
2402
|
hasScheduledUpdates(): boolean;
|
|
@@ -2349,6 +2536,21 @@ export declare namespace dia {
|
|
|
2349
2536
|
protected customEventTrigger(event: dia.Event, view: CellView, rootNode?: SVGElement): dia.Event | null;
|
|
2350
2537
|
|
|
2351
2538
|
protected addStylesheet(stylesheet: string): void;
|
|
2539
|
+
|
|
2540
|
+
/**
|
|
2541
|
+
* @deprecated use `findElementViewsAtPoint()
|
|
2542
|
+
*/
|
|
2543
|
+
findViewsFromPoint(point: string | Point): ElementView[];
|
|
2544
|
+
|
|
2545
|
+
/**
|
|
2546
|
+
* @deprecated use `findElementViewsInArea()
|
|
2547
|
+
*/
|
|
2548
|
+
findViewsInArea(rect: BBox, opt?: { strict?: boolean }): ElementView[];
|
|
2549
|
+
|
|
2550
|
+
/**
|
|
2551
|
+
* @deprecated use transformToFitContent
|
|
2552
|
+
*/
|
|
2553
|
+
scaleContentToFit(opt?: Paper.ScaleContentOptions): void;
|
|
2352
2554
|
}
|
|
2353
2555
|
|
|
2354
2556
|
export namespace PaperLayer {
|
|
@@ -2410,21 +2612,25 @@ export declare namespace dia {
|
|
|
2410
2612
|
}
|
|
2411
2613
|
|
|
2412
2614
|
export namespace ToolView {
|
|
2413
|
-
|
|
2615
|
+
|
|
2616
|
+
export type VisibilityCallback<V = dia.CellView> = (this: ToolView, view: V, tool: ToolView) => boolean;
|
|
2617
|
+
|
|
2618
|
+
export interface Options<V = dia.CellView> extends mvc.ViewOptions<undefined, SVGElement> {
|
|
2414
2619
|
focusOpacity?: number;
|
|
2620
|
+
visibility?: VisibilityCallback<V>;
|
|
2415
2621
|
}
|
|
2416
2622
|
}
|
|
2417
2623
|
|
|
2418
|
-
export class ToolView extends mvc.View<undefined, SVGElement> {
|
|
2624
|
+
export class ToolView<V = dia.CellView> extends mvc.View<undefined, SVGElement> {
|
|
2419
2625
|
|
|
2420
2626
|
name: string | null;
|
|
2421
2627
|
parentView: ToolsView;
|
|
2422
2628
|
relatedView: dia.CellView;
|
|
2423
2629
|
paper: Paper;
|
|
2424
2630
|
|
|
2425
|
-
constructor(opt?: ToolView.Options);
|
|
2631
|
+
constructor(opt?: ToolView.Options<V>);
|
|
2426
2632
|
|
|
2427
|
-
configure(opt?: ToolView.Options): this;
|
|
2633
|
+
configure(opt?: ToolView.Options<V>): this;
|
|
2428
2634
|
|
|
2429
2635
|
protected simulateRelatedView(el: SVGElement): void;
|
|
2430
2636
|
|
|
@@ -2434,6 +2640,12 @@ export declare namespace dia {
|
|
|
2434
2640
|
|
|
2435
2641
|
isVisible(): boolean;
|
|
2436
2642
|
|
|
2643
|
+
isExplicitlyVisible(): boolean;
|
|
2644
|
+
|
|
2645
|
+
updateVisibility(): void;
|
|
2646
|
+
|
|
2647
|
+
protected computeVisibility(): boolean;
|
|
2648
|
+
|
|
2437
2649
|
focus(): void;
|
|
2438
2650
|
|
|
2439
2651
|
blur(): void;
|
|
@@ -2526,6 +2738,11 @@ export declare namespace dia {
|
|
|
2526
2738
|
cellView: dia.CellView
|
|
2527
2739
|
): T[];
|
|
2528
2740
|
|
|
2741
|
+
static getAll<T extends HighlighterView = HighlighterView>(
|
|
2742
|
+
paper: dia.Paper,
|
|
2743
|
+
id?: string
|
|
2744
|
+
): T[];
|
|
2745
|
+
|
|
2529
2746
|
static update(cellView: dia.CellView, id?: string): void;
|
|
2530
2747
|
|
|
2531
2748
|
static transform(cellView: dia.CellView, id?: string): void;
|
|
@@ -2544,9 +2761,9 @@ export declare namespace elementTools {
|
|
|
2544
2761
|
|
|
2545
2762
|
export namespace Button {
|
|
2546
2763
|
|
|
2547
|
-
export type ActionCallback = (evt: dia.Event, view: dia.ElementView, tool:
|
|
2764
|
+
export type ActionCallback = (evt: dia.Event, view: dia.ElementView, tool: Button) => void;
|
|
2548
2765
|
|
|
2549
|
-
export interface Options extends dia.ToolView.Options {
|
|
2766
|
+
export interface Options extends dia.ToolView.Options<dia.ElementView> {
|
|
2550
2767
|
x?: number | string;
|
|
2551
2768
|
y?: number | string;
|
|
2552
2769
|
offset?: { x?: number, y?: number };
|
|
@@ -2558,7 +2775,7 @@ export declare namespace elementTools {
|
|
|
2558
2775
|
}
|
|
2559
2776
|
}
|
|
2560
2777
|
|
|
2561
|
-
export class Button extends dia.ToolView {
|
|
2778
|
+
export class Button extends dia.ToolView<dia.ElementView> {
|
|
2562
2779
|
|
|
2563
2780
|
constructor(opt?: Button.Options);
|
|
2564
2781
|
|
|
@@ -2600,20 +2817,20 @@ export declare namespace elementTools {
|
|
|
2600
2817
|
}
|
|
2601
2818
|
|
|
2602
2819
|
export namespace Boundary {
|
|
2603
|
-
export interface Options extends dia.ToolView.Options {
|
|
2820
|
+
export interface Options extends dia.ToolView.Options<dia.ElementView> {
|
|
2604
2821
|
padding?: number | dia.Sides;
|
|
2605
2822
|
useModelGeometry?: boolean;
|
|
2606
2823
|
rotate?: boolean;
|
|
2607
2824
|
}
|
|
2608
2825
|
}
|
|
2609
2826
|
|
|
2610
|
-
export class Boundary extends dia.ToolView {
|
|
2827
|
+
export class Boundary extends dia.ToolView<dia.ElementView> {
|
|
2611
2828
|
|
|
2612
2829
|
constructor(opt?: Boundary.Options);
|
|
2613
2830
|
}
|
|
2614
2831
|
|
|
2615
2832
|
export namespace Control {
|
|
2616
|
-
export interface Options extends dia.ToolView.Options {
|
|
2833
|
+
export interface Options extends dia.ToolView.Options<dia.ElementView> {
|
|
2617
2834
|
selector?: string | null;
|
|
2618
2835
|
padding?: number;
|
|
2619
2836
|
handleAttributes?: Partial<attributes.NativeSVGAttributes>;
|
|
@@ -2621,13 +2838,13 @@ export declare namespace elementTools {
|
|
|
2621
2838
|
}
|
|
2622
2839
|
}
|
|
2623
2840
|
|
|
2624
|
-
export abstract class Control<T extends mvc.ViewOptions<undefined, SVGElement> = Control.Options> extends dia.ToolView {
|
|
2841
|
+
export abstract class Control<T extends mvc.ViewOptions<undefined, SVGElement> = Control.Options> extends dia.ToolView<dia.ElementView> {
|
|
2625
2842
|
options: T;
|
|
2626
2843
|
constructor(opt?: T);
|
|
2627
2844
|
|
|
2628
2845
|
protected getPosition(view: dia.ElementView): dia.Point;
|
|
2629
|
-
protected setPosition(view: dia.ElementView, coordinates: g.Point): void;
|
|
2630
|
-
protected resetPosition(view: dia.ElementView): void;
|
|
2846
|
+
protected setPosition(view: dia.ElementView, coordinates: g.Point, evt: dia.Event): void;
|
|
2847
|
+
protected resetPosition(view: dia.ElementView, evt: dia.Event): void;
|
|
2631
2848
|
|
|
2632
2849
|
protected updateHandle(handleNode: SVGElement): void;
|
|
2633
2850
|
protected updateExtras(extrasNode: SVGElement): void;
|
|
@@ -2652,7 +2869,7 @@ export declare namespace elementTools {
|
|
|
2652
2869
|
}
|
|
2653
2870
|
}
|
|
2654
2871
|
|
|
2655
|
-
export class HoverConnect extends
|
|
2872
|
+
export class HoverConnect extends Connect {
|
|
2656
2873
|
|
|
2657
2874
|
constructor(opt?: HoverConnect.Options);
|
|
2658
2875
|
}
|
|
@@ -2704,6 +2921,11 @@ export declare namespace g {
|
|
|
2704
2921
|
precision?: number;
|
|
2705
2922
|
}
|
|
2706
2923
|
|
|
2924
|
+
export interface StrictOpt {
|
|
2925
|
+
|
|
2926
|
+
strict?: boolean;
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2707
2929
|
export interface SubdivisionsOpt extends PrecisionOpt {
|
|
2708
2930
|
|
|
2709
2931
|
subdivisions?: Curve[];
|
|
@@ -3311,7 +3533,7 @@ export declare namespace g {
|
|
|
3311
3533
|
|
|
3312
3534
|
clone(): Rect;
|
|
3313
3535
|
|
|
3314
|
-
containsPoint(p: PlainPoint | string): boolean;
|
|
3536
|
+
containsPoint(p: PlainPoint | string, opt?: StrictOpt): boolean;
|
|
3315
3537
|
|
|
3316
3538
|
containsRect(r: PlainRect): boolean;
|
|
3317
3539
|
|
|
@@ -3751,11 +3973,15 @@ export declare namespace linkTools {
|
|
|
3751
3973
|
protected onPointerClick(evt: dia.Event): void;
|
|
3752
3974
|
}
|
|
3753
3975
|
|
|
3754
|
-
export interface
|
|
3976
|
+
export interface VertexAddingOptions {
|
|
3977
|
+
interactiveLineNode: string;
|
|
3978
|
+
}
|
|
3979
|
+
|
|
3980
|
+
export interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
3755
3981
|
handleClass?: typeof VertexHandle;
|
|
3756
3982
|
snapRadius?: number;
|
|
3757
3983
|
redundancyRemoval?: boolean;
|
|
3758
|
-
vertexAdding?: boolean
|
|
3984
|
+
vertexAdding?: boolean | Partial<VertexAddingOptions>;
|
|
3759
3985
|
vertexRemoving?: boolean;
|
|
3760
3986
|
vertexMoving?: boolean;
|
|
3761
3987
|
stopPropagation?: boolean;
|
|
@@ -3763,7 +3989,7 @@ export declare namespace linkTools {
|
|
|
3763
3989
|
}
|
|
3764
3990
|
}
|
|
3765
3991
|
|
|
3766
|
-
export class Vertices extends dia.ToolView {
|
|
3992
|
+
export class Vertices extends dia.ToolView<dia.LinkView> {
|
|
3767
3993
|
|
|
3768
3994
|
constructor(opt?: Vertices.Options);
|
|
3769
3995
|
}
|
|
@@ -3779,7 +4005,7 @@ export declare namespace linkTools {
|
|
|
3779
4005
|
protected onPointerUp(evt: dia.Event): void;
|
|
3780
4006
|
}
|
|
3781
4007
|
|
|
3782
|
-
export interface Options extends dia.ToolView.Options {
|
|
4008
|
+
export interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
3783
4009
|
handleClass?: typeof SegmentHandle;
|
|
3784
4010
|
snapRadius?: number;
|
|
3785
4011
|
snapHandle?: boolean;
|
|
@@ -3791,19 +4017,19 @@ export declare namespace linkTools {
|
|
|
3791
4017
|
}
|
|
3792
4018
|
}
|
|
3793
4019
|
|
|
3794
|
-
export class Segments extends dia.ToolView {
|
|
4020
|
+
export class Segments extends dia.ToolView<dia.LinkView> {
|
|
3795
4021
|
|
|
3796
4022
|
constructor(opt?: Segments.Options);
|
|
3797
4023
|
}
|
|
3798
4024
|
|
|
3799
4025
|
export namespace Arrowhead {
|
|
3800
4026
|
|
|
3801
|
-
export interface Options extends dia.ToolView.Options {
|
|
4027
|
+
export interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
3802
4028
|
scale?: number;
|
|
3803
4029
|
}
|
|
3804
4030
|
}
|
|
3805
4031
|
|
|
3806
|
-
export abstract class Arrowhead extends dia.ToolView {
|
|
4032
|
+
export abstract class Arrowhead extends dia.ToolView<dia.LinkView> {
|
|
3807
4033
|
|
|
3808
4034
|
ratio: number;
|
|
3809
4035
|
arrowheadType: string;
|
|
@@ -3828,7 +4054,7 @@ export declare namespace linkTools {
|
|
|
3828
4054
|
}
|
|
3829
4055
|
|
|
3830
4056
|
export namespace Anchor {
|
|
3831
|
-
export interface Options extends dia.ToolView.Options {
|
|
4057
|
+
export interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
3832
4058
|
snap?: AnchorCallback<dia.Point>;
|
|
3833
4059
|
anchor?: AnchorCallback<anchors.AnchorJSON>;
|
|
3834
4060
|
resetAnchor?: boolean | anchors.AnchorJSON;
|
|
@@ -3842,7 +4068,7 @@ export declare namespace linkTools {
|
|
|
3842
4068
|
}
|
|
3843
4069
|
}
|
|
3844
4070
|
|
|
3845
|
-
export abstract class Anchor extends dia.ToolView {
|
|
4071
|
+
export abstract class Anchor extends dia.ToolView<dia.LinkView> {
|
|
3846
4072
|
|
|
3847
4073
|
type: string;
|
|
3848
4074
|
|
|
@@ -3861,10 +4087,14 @@ export declare namespace linkTools {
|
|
|
3861
4087
|
|
|
3862
4088
|
export namespace Button {
|
|
3863
4089
|
|
|
3864
|
-
export type ActionCallback = (evt: dia.Event, view: dia.LinkView, tool:
|
|
4090
|
+
export type ActionCallback = (evt: dia.Event, view: dia.LinkView, tool: Button) => void;
|
|
3865
4091
|
|
|
3866
|
-
export
|
|
3867
|
-
|
|
4092
|
+
export type Distance = number | string;
|
|
4093
|
+
|
|
4094
|
+
export type DistanceCallback = (this: Button, view: dia.LinkView, tool: Button) => Distance;
|
|
4095
|
+
|
|
4096
|
+
export interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
4097
|
+
distance?: Distance | DistanceCallback;
|
|
3868
4098
|
offset?: number;
|
|
3869
4099
|
rotate?: boolean;
|
|
3870
4100
|
action?: ActionCallback;
|
|
@@ -3873,7 +4103,7 @@ export declare namespace linkTools {
|
|
|
3873
4103
|
}
|
|
3874
4104
|
}
|
|
3875
4105
|
|
|
3876
|
-
export class Button extends dia.ToolView {
|
|
4106
|
+
export class Button extends dia.ToolView<dia.LinkView> {
|
|
3877
4107
|
|
|
3878
4108
|
constructor(opt?: Button.Options);
|
|
3879
4109
|
|
|
@@ -3907,13 +4137,13 @@ export declare namespace linkTools {
|
|
|
3907
4137
|
}
|
|
3908
4138
|
|
|
3909
4139
|
export namespace Boundary {
|
|
3910
|
-
export interface Options extends dia.ToolView.Options {
|
|
4140
|
+
export interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
3911
4141
|
padding?: number | dia.Sides;
|
|
3912
4142
|
useModelGeometry?: boolean;
|
|
3913
4143
|
}
|
|
3914
4144
|
}
|
|
3915
4145
|
|
|
3916
|
-
export class Boundary extends dia.ToolView {
|
|
4146
|
+
export class Boundary extends dia.ToolView<dia.LinkView> {
|
|
3917
4147
|
|
|
3918
4148
|
constructor(opt?: Boundary.Options);
|
|
3919
4149
|
}
|
|
@@ -3949,6 +4179,54 @@ export declare namespace linkTools {
|
|
|
3949
4179
|
|
|
3950
4180
|
protected onMouseleave(evt: dia.Event): void;
|
|
3951
4181
|
}
|
|
4182
|
+
|
|
4183
|
+
export namespace Control {
|
|
4184
|
+
export interface Options extends dia.ToolView.Options {
|
|
4185
|
+
selector?: string | null;
|
|
4186
|
+
padding?: number;
|
|
4187
|
+
handleAttributes?: Partial<attributes.NativeSVGAttributes>;
|
|
4188
|
+
scale?: number;
|
|
4189
|
+
}
|
|
4190
|
+
}
|
|
4191
|
+
|
|
4192
|
+
export abstract class Control<T extends mvc.ViewOptions<undefined, SVGElement> = Control.Options> extends dia.ToolView {
|
|
4193
|
+
options: T;
|
|
4194
|
+
constructor(opt?: T);
|
|
4195
|
+
|
|
4196
|
+
protected getPosition(view: dia.LinkView): dia.Point;
|
|
4197
|
+
protected setPosition(view: dia.LinkView, coordinates: g.Point): void;
|
|
4198
|
+
protected resetPosition(view: dia.LinkView): void;
|
|
4199
|
+
|
|
4200
|
+
protected updateHandle(handleNode: SVGElement): void;
|
|
4201
|
+
protected updateExtras(extrasNode: SVGElement): void;
|
|
4202
|
+
protected toggleExtras(visible: boolean): void;
|
|
4203
|
+
|
|
4204
|
+
protected onPointerDown(evt: dia.Event): void;
|
|
4205
|
+
protected onPointerMove(evt: dia.Event): void;
|
|
4206
|
+
protected onPointerUp(evt: dia.Event): void;
|
|
4207
|
+
protected onPointerDblClick(evt: dia.Event): void;
|
|
4208
|
+
}
|
|
4209
|
+
|
|
4210
|
+
export namespace RotateLabel {
|
|
4211
|
+
|
|
4212
|
+
export interface Options extends Control.Options {
|
|
4213
|
+
offset?: number | dia.Point;
|
|
4214
|
+
buttonColor?: string;
|
|
4215
|
+
iconColor?: string;
|
|
4216
|
+
outlineColor?: string;
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4220
|
+
export class RotateLabel extends Control<RotateLabel.Options> {
|
|
4221
|
+
|
|
4222
|
+
constructor(opt?: RotateLabel.Options);
|
|
4223
|
+
|
|
4224
|
+
protected getLabelPosition(label: dia.Link.Label): dia.Link.LabelPosition;
|
|
4225
|
+
|
|
4226
|
+
protected getLabelIndex(): number;
|
|
4227
|
+
|
|
4228
|
+
protected getLabel(): dia.Link.Label | null;
|
|
4229
|
+
}
|
|
3952
4230
|
}
|
|
3953
4231
|
|
|
3954
4232
|
export declare namespace mvc {
|
|
@@ -4903,6 +5181,12 @@ export declare namespace shapes {
|
|
|
4903
5181
|
|
|
4904
5182
|
export declare namespace util {
|
|
4905
5183
|
|
|
5184
|
+
export function isCalcExpression(value: any): boolean;
|
|
5185
|
+
|
|
5186
|
+
export function evalCalcFormula(formula: string, rect: g.PlainRect): number;
|
|
5187
|
+
|
|
5188
|
+
export function evalCalcExpression(expression: string, rect: g.PlainRect): string;
|
|
5189
|
+
|
|
4906
5190
|
export function hashCode(str: string): string;
|
|
4907
5191
|
|
|
4908
5192
|
export function getByPath(object: { [key: string]: any }, path: string | string[], delim?: string): any;
|
|
@@ -4973,6 +5257,8 @@ export declare namespace util {
|
|
|
4973
5257
|
|
|
4974
5258
|
export function toggleFullScreen(el?: Element): void;
|
|
4975
5259
|
|
|
5260
|
+
export function objectDifference(object: object, base: object, opt?: { maxDepth?: number }): object;
|
|
5261
|
+
|
|
4976
5262
|
export interface DOMJSONDocument {
|
|
4977
5263
|
fragment: DocumentFragment;
|
|
4978
5264
|
selectors: { [key: string]: Element };
|