@joint/core 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/LICENSE +376 -0
  2. package/README.md +49 -0
  3. package/dist/geometry.js +6486 -0
  4. package/dist/geometry.min.js +8 -0
  5. package/dist/joint.d.ts +5536 -0
  6. package/dist/joint.js +39629 -0
  7. package/dist/joint.min.js +8 -0
  8. package/dist/joint.nowrap.js +39626 -0
  9. package/dist/joint.nowrap.min.js +8 -0
  10. package/dist/vectorizer.js +9135 -0
  11. package/dist/vectorizer.min.js +8 -0
  12. package/dist/version.mjs +3 -0
  13. package/index.js +3 -0
  14. package/joint.mjs +27 -0
  15. package/package.json +192 -0
  16. package/src/V/annotation.mjs +0 -0
  17. package/src/V/index.mjs +2642 -0
  18. package/src/anchors/index.mjs +123 -0
  19. package/src/config/index.mjs +12 -0
  20. package/src/connectionPoints/index.mjs +202 -0
  21. package/src/connectionStrategies/index.mjs +73 -0
  22. package/src/connectors/curve.mjs +553 -0
  23. package/src/connectors/index.mjs +6 -0
  24. package/src/connectors/jumpover.mjs +452 -0
  25. package/src/connectors/normal.mjs +12 -0
  26. package/src/connectors/rounded.mjs +17 -0
  27. package/src/connectors/smooth.mjs +44 -0
  28. package/src/connectors/straight.mjs +110 -0
  29. package/src/dia/Cell.mjs +945 -0
  30. package/src/dia/CellView.mjs +1316 -0
  31. package/src/dia/Element.mjs +519 -0
  32. package/src/dia/ElementView.mjs +859 -0
  33. package/src/dia/Graph.mjs +1112 -0
  34. package/src/dia/HighlighterView.mjs +319 -0
  35. package/src/dia/Link.mjs +565 -0
  36. package/src/dia/LinkView.mjs +2207 -0
  37. package/src/dia/Paper.mjs +3171 -0
  38. package/src/dia/PaperLayer.mjs +75 -0
  39. package/src/dia/ToolView.mjs +69 -0
  40. package/src/dia/ToolsView.mjs +128 -0
  41. package/src/dia/attributes/calc.mjs +128 -0
  42. package/src/dia/attributes/connection.mjs +75 -0
  43. package/src/dia/attributes/defs.mjs +76 -0
  44. package/src/dia/attributes/eval.mjs +64 -0
  45. package/src/dia/attributes/index.mjs +69 -0
  46. package/src/dia/attributes/legacy.mjs +148 -0
  47. package/src/dia/attributes/offset.mjs +53 -0
  48. package/src/dia/attributes/props.mjs +30 -0
  49. package/src/dia/attributes/shape.mjs +92 -0
  50. package/src/dia/attributes/text.mjs +180 -0
  51. package/src/dia/index.mjs +13 -0
  52. package/src/dia/layers/GridLayer.mjs +176 -0
  53. package/src/dia/ports.mjs +874 -0
  54. package/src/elementTools/Control.mjs +153 -0
  55. package/src/elementTools/HoverConnect.mjs +37 -0
  56. package/src/elementTools/index.mjs +5 -0
  57. package/src/env/index.mjs +43 -0
  58. package/src/g/bezier.mjs +175 -0
  59. package/src/g/curve.mjs +956 -0
  60. package/src/g/ellipse.mjs +245 -0
  61. package/src/g/extend.mjs +64 -0
  62. package/src/g/geometry.helpers.mjs +58 -0
  63. package/src/g/index.mjs +17 -0
  64. package/src/g/intersection.mjs +511 -0
  65. package/src/g/line.bearing.mjs +30 -0
  66. package/src/g/line.length.mjs +5 -0
  67. package/src/g/line.mjs +356 -0
  68. package/src/g/line.squaredLength.mjs +10 -0
  69. package/src/g/path.mjs +2260 -0
  70. package/src/g/point.mjs +375 -0
  71. package/src/g/points.mjs +247 -0
  72. package/src/g/polygon.mjs +51 -0
  73. package/src/g/polyline.mjs +523 -0
  74. package/src/g/rect.mjs +556 -0
  75. package/src/g/types.mjs +10 -0
  76. package/src/highlighters/addClass.mjs +27 -0
  77. package/src/highlighters/index.mjs +5 -0
  78. package/src/highlighters/list.mjs +111 -0
  79. package/src/highlighters/mask.mjs +220 -0
  80. package/src/highlighters/opacity.mjs +17 -0
  81. package/src/highlighters/stroke.mjs +100 -0
  82. package/src/layout/index.mjs +4 -0
  83. package/src/layout/ports/port.mjs +188 -0
  84. package/src/layout/ports/portLabel.mjs +224 -0
  85. package/src/linkAnchors/index.mjs +76 -0
  86. package/src/linkTools/Anchor.mjs +235 -0
  87. package/src/linkTools/Arrowhead.mjs +103 -0
  88. package/src/linkTools/Boundary.mjs +48 -0
  89. package/src/linkTools/Button.mjs +121 -0
  90. package/src/linkTools/Connect.mjs +85 -0
  91. package/src/linkTools/HoverConnect.mjs +161 -0
  92. package/src/linkTools/Segments.mjs +393 -0
  93. package/src/linkTools/Vertices.mjs +253 -0
  94. package/src/linkTools/helpers.mjs +33 -0
  95. package/src/linkTools/index.mjs +8 -0
  96. package/src/mvc/Collection.mjs +560 -0
  97. package/src/mvc/Data.mjs +46 -0
  98. package/src/mvc/Dom/Dom.mjs +587 -0
  99. package/src/mvc/Dom/Event.mjs +130 -0
  100. package/src/mvc/Dom/animations.mjs +122 -0
  101. package/src/mvc/Dom/events.mjs +69 -0
  102. package/src/mvc/Dom/index.mjs +13 -0
  103. package/src/mvc/Dom/methods.mjs +392 -0
  104. package/src/mvc/Dom/props.mjs +77 -0
  105. package/src/mvc/Dom/vars.mjs +5 -0
  106. package/src/mvc/Events.mjs +337 -0
  107. package/src/mvc/Listener.mjs +33 -0
  108. package/src/mvc/Model.mjs +239 -0
  109. package/src/mvc/View.mjs +323 -0
  110. package/src/mvc/ViewBase.mjs +182 -0
  111. package/src/mvc/index.mjs +9 -0
  112. package/src/mvc/mvcUtils.mjs +90 -0
  113. package/src/polyfills/array.js +4 -0
  114. package/src/polyfills/base64.js +68 -0
  115. package/src/polyfills/index.mjs +5 -0
  116. package/src/polyfills/number.js +3 -0
  117. package/src/polyfills/string.js +3 -0
  118. package/src/polyfills/typedArray.js +47 -0
  119. package/src/routers/index.mjs +6 -0
  120. package/src/routers/manhattan.mjs +856 -0
  121. package/src/routers/metro.mjs +91 -0
  122. package/src/routers/normal.mjs +6 -0
  123. package/src/routers/oneSide.mjs +60 -0
  124. package/src/routers/orthogonal.mjs +323 -0
  125. package/src/routers/rightAngle.mjs +1056 -0
  126. package/src/shapes/index.mjs +3 -0
  127. package/src/shapes/standard.mjs +755 -0
  128. package/src/util/cloneCells.mjs +67 -0
  129. package/src/util/getRectPoint.mjs +65 -0
  130. package/src/util/index.mjs +5 -0
  131. package/src/util/svgTagTemplate.mjs +110 -0
  132. package/src/util/util.mjs +1754 -0
  133. package/src/util/utilHelpers.mjs +2402 -0
  134. package/src/util/wrappers.mjs +56 -0
  135. package/types/geometry.d.ts +815 -0
  136. package/types/index.d.ts +53 -0
  137. package/types/joint.d.ts +4391 -0
  138. package/types/joint.head.d.ts +12 -0
  139. package/types/vectorizer.d.ts +327 -0
@@ -0,0 +1,12 @@
1
+ // Definitions by:
2
+ // Aidan Reel <http://github.com/areel>,
3
+ // David Durman <http://github.com/DavidDurman>,
4
+ // Ewout Van Gossum <https://github.com/DenEwout>,
5
+ // Federico Caselli <https://github.com/CaselIT>,
6
+ // Chris Moran <https://github.com/ChrisMoran>
7
+ // Michael MacFadden https://github.com/mmacfadden
8
+
9
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
10
+ // typings: https://github.com/CaselIT/typings-jointjs
11
+
12
+ export as namespace joint;
@@ -0,0 +1,327 @@
1
+ import { g } from './geometry';
2
+
3
+ export const V: VCallable;
4
+ export type V = VElement;
5
+
6
+ export const Vectorizer: VCallable;
7
+ export type Vectorizer = VElement;
8
+
9
+ export namespace Vectorizer {
10
+ interface RotateOptions {
11
+ absolute?: boolean;
12
+ }
13
+
14
+ interface AnnotateStringOptions {
15
+ includeAnnotationIndices?: boolean;
16
+ offset?: number;
17
+ }
18
+
19
+ type TextVerticalAnchor = 'top' | 'bottom' | 'middle';
20
+
21
+ interface TextOptions {
22
+ eol?: string;
23
+ x?: number | string;
24
+ textVerticalAnchor?: TextVerticalAnchor | number | string;
25
+ lineHeight?: number | string;
26
+ textPath?: string | { [key: string]: any };
27
+ annotations?: TextAnnotation[];
28
+ includeAnnotationIndices?: boolean;
29
+ displayEmpty?: boolean;
30
+ }
31
+
32
+ interface GetBBoxOptions {
33
+ target?: SVGElement | VElement;
34
+ recursive?: boolean;
35
+ }
36
+
37
+ interface TransformOptions {
38
+ absolute?: boolean;
39
+ }
40
+
41
+ interface ParseXMLOptions {
42
+ async?: boolean;
43
+ }
44
+
45
+ interface TextAnnotation {
46
+ start: number;
47
+ end: number;
48
+ attrs: { [key: string]: any };
49
+ }
50
+
51
+ // modifiable Matrix. SVGMatrix doesn't allow set on properties or a constructor.
52
+ interface Matrix {
53
+ a: number;
54
+ b: number;
55
+ c: number;
56
+ d: number;
57
+ e: number;
58
+ f: number;
59
+ }
60
+
61
+ interface Sample {
62
+ x: number;
63
+ y: number;
64
+ distance: number;
65
+ }
66
+
67
+ interface DecomposedTransformation {
68
+ translateX: number;
69
+ translateY: number;
70
+ scaleX: number;
71
+ scaleY: number;
72
+ skewX: number;
73
+ skewY: number;
74
+ rotation: number;
75
+ }
76
+
77
+ interface RoundedRect extends g.PlainRect {
78
+ 'rx'?: number;
79
+ 'ry'?: number;
80
+ 'top-rx'?: number;
81
+ 'top-ry'?: number;
82
+ 'bottom-rx'?: number;
83
+ 'bottom-ry'?: number;
84
+ }
85
+
86
+ interface Rotation {
87
+ angle: number;
88
+ cx?: number;
89
+ cy?: number;
90
+ }
91
+
92
+ interface Translation {
93
+ tx: number;
94
+ ty: number;
95
+ }
96
+
97
+ interface Scale {
98
+ sx: number;
99
+ sy: number;
100
+ }
101
+
102
+ interface Transform {
103
+ value: string;
104
+ translate: Translation;
105
+ rotate: Rotation;
106
+ scale: Scale;
107
+ }
108
+
109
+ interface QualifiedAttribute {
110
+ ns: string | null;
111
+ local: string;
112
+ }
113
+ }
114
+
115
+ interface VCallable extends VStatic {
116
+
117
+ (
118
+ svg: SVGElement | VElement | string,
119
+ attrs?: { [key: string]: any },
120
+ children?: VElement | VElement[] | SVGElement | SVGElement[]
121
+ ): VElement;
122
+ }
123
+
124
+ export class VElement {
125
+
126
+ id: string;
127
+ node: SVGElement;
128
+
129
+ getTransformToElement(toElem: SVGGElement | VElement): SVGMatrix;
130
+
131
+ transform(): SVGMatrix;
132
+ transform(matrix: SVGMatrix | Vectorizer.Matrix, opt?: Vectorizer.TransformOptions): this;
133
+
134
+ translate(): Vectorizer.Translation;
135
+ translate(tx: number, ty?: number, opt?: Vectorizer.TransformOptions): this;
136
+
137
+ rotate(): Vectorizer.Rotation;
138
+ rotate(angle: number, cx?: number, cy?: number, opt?: Vectorizer.RotateOptions): this;
139
+
140
+ scale(): Vectorizer.Scale;
141
+ scale(sx: number, sy?: number): this;
142
+
143
+ bbox(withoutTransformations?: boolean, target?: SVGElement | VElement): g.Rect;
144
+
145
+ getBBox(opt?: Vectorizer.GetBBoxOptions): g.Rect;
146
+
147
+ text(content: string, opt?: Vectorizer.TextOptions): this;
148
+
149
+ removeAttr(name: string): this;
150
+
151
+ attr(): { [key: string]: string };
152
+ attr(name: string): string | null;
153
+ attr(name: string, value: any): this;
154
+ attr(attrs: { [key: string]: any }): this;
155
+
156
+ normalizePath(): this;
157
+
158
+ remove(): this;
159
+
160
+ empty(): this;
161
+
162
+ append(els: VElement | VElement[] | SVGElement | SVGElement[]): this;
163
+
164
+ prepend(els: VElement | VElement[] | SVGElement | SVGElement[]): this;
165
+
166
+ before(els: VElement | VElement[] | SVGElement | SVGElement[]): this;
167
+
168
+ appendTo(el: SVGElement | VElement): this;
169
+
170
+ parent(): VElement | null;
171
+
172
+ // returns either this or VElement, no point in specifying this.
173
+ svg(): VElement;
174
+
175
+ tagName(): string;
176
+
177
+ defs(): VElement | undefined;
178
+
179
+ clone(): VElement;
180
+
181
+ findOne(selector: string): VElement | undefined;
182
+
183
+ find(selector: string): VElement[];
184
+
185
+ children(): VElement[];
186
+
187
+ index(): number;
188
+
189
+ findParentByClass(className: string, terminator?: SVGElement): VElement | null;
190
+
191
+ contains(el: SVGElement | VElement): boolean;
192
+
193
+ toLocalPoint(x: number, y: number): SVGPoint;
194
+
195
+ translateCenterToPoint(p: g.PlainPoint): this;
196
+
197
+ translateAndAutoOrient(position: g.PlainPoint, reference: g.PlainPoint, target?: SVGElement | VElement): this;
198
+
199
+ animateAlongPath(attrs: { [key: string]: any }, path: SVGElement | VElement): void;
200
+
201
+ hasClass(className: string): boolean;
202
+
203
+ addClass(className: string): VElement;
204
+
205
+ removeClass(className: string): this;
206
+
207
+ toggleClass(className: string, switchArg?: boolean): this;
208
+
209
+ sample(interval?: number): Vectorizer.Sample[];
210
+
211
+ convertToPath(): VElement;
212
+
213
+ convertToPathData(): string;
214
+
215
+ findIntersection(ref: g.PlainPoint, target: SVGElement | VElement): g.PlainPoint | undefined;
216
+
217
+ toGeometryShape(): g.Shape;
218
+
219
+ private setAttributes(attrs: { [key: string]: any }): this;
220
+
221
+ private setAttribute(name: string, value: string): this;
222
+ }
223
+
224
+ interface VStatic {
225
+
226
+ createSVGDocument(content: string): Document;
227
+
228
+ createSVGStyle(stylesheet: string): SVGStyleElement;
229
+
230
+ createCDATASection(data: string): CDATASection;
231
+
232
+ uniqueId(): string;
233
+
234
+ ensureId(node: SVGElement | VElement): string;
235
+
236
+ sanitizeText(text: string): string;
237
+
238
+ isUndefined(value: any): boolean;
239
+
240
+ isString(value: any): boolean;
241
+
242
+ isObject(value: any): boolean;
243
+
244
+ isArray(value: any): boolean;
245
+
246
+ parseXML(data: string, opt?: Vectorizer.ParseXMLOptions): XMLDocument;
247
+
248
+ qualifyAttr(name: string): Vectorizer.QualifiedAttribute;
249
+
250
+ transformStringToMatrix(transform: string): SVGMatrix;
251
+
252
+ matrixToTransformString(matrix: SVGMatrix | Vectorizer.Matrix): string;
253
+
254
+ parseTransformString(transform: string): Vectorizer.Transform;
255
+
256
+ deltaTransformPoint(matrix: SVGMatrix | Vectorizer.Matrix, point: SVGPoint | g.PlainPoint): g.PlainPoint;
257
+
258
+ decomposeMatrix(matrix: SVGMatrix | Vectorizer.Matrix): Vectorizer.DecomposedTransformation;
259
+
260
+ matrixToScale(matrix: SVGMatrix | Vectorizer.Matrix): Vectorizer.Scale;
261
+
262
+ matrixToRotate(matrix: SVGMatrix | Vectorizer.Matrix): Vectorizer.Rotation;
263
+
264
+ matrixToTranslate(matrix: SVGMatrix | Vectorizer.Matrix): Vectorizer.Translation;
265
+
266
+ isV(value: any): boolean;
267
+
268
+ isVElement(value: any): boolean;
269
+
270
+ isSVGGraphicsElement(value: any): boolean;
271
+
272
+ createSVGMatrix(matrix?: SVGMatrix | Partial<Vectorizer.Matrix>): SVGMatrix;
273
+
274
+ createSVGTransform(matrix?: SVGMatrix | Partial<Vectorizer.Matrix>): SVGTransform;
275
+
276
+ createSVGPoint(x: number, y: number): SVGPoint;
277
+
278
+ transformRect(r: g.PlainRect, matrix: SVGMatrix): g.Rect;
279
+
280
+ transformPoint(p: g.PlainPoint, matrix: SVGMatrix): g.Point;
281
+
282
+ transformLine(p: g.Line, matrix: SVGMatrix): g.Line;
283
+
284
+ transformPolyline(p: g.Polyline | g.PlainPoint[], matrix: SVGMatrix): g.Polyline;
285
+
286
+ styleToObject(styleString: string): { [key: string]: string };
287
+
288
+ createSlicePathData(innerRadius: number, outRadius: number, startAngle: number, endAngle: number): string;
289
+
290
+ mergeAttrs(a: any, b: any): any;
291
+
292
+ annotateString(t: string, annotations: Vectorizer.TextAnnotation[], opt?: Vectorizer.AnnotateStringOptions): Array< string | { [key: string]: any }> ;
293
+
294
+ findAnnotationsAtIndex(annotations: Vectorizer.TextAnnotation[], index: number): Vectorizer.TextAnnotation[];
295
+
296
+ findAnnotationsBetweenIndexes(annotations: Vectorizer.TextAnnotation[], start: number, end: number): Vectorizer.TextAnnotation[];
297
+
298
+ shiftAnnotations(annotations: Vectorizer.TextAnnotation[], index: number, offset: number): Vectorizer.TextAnnotation[];
299
+
300
+ convertLineToPathData(line: string | SVGElement | VElement): string;
301
+
302
+ convertPolygonToPathData(line: string | SVGElement | VElement): string;
303
+
304
+ convertPolylineToPathData(line: string | SVGElement | VElement): string;
305
+
306
+ svgPointsToPath(points: g.PlainPoint[] | SVGPoint[]): string;
307
+
308
+ getPointsFromSvgNode(node: SVGElement | VElement): SVGPoint[];
309
+
310
+ convertCircleToPathData(circle: string | SVGElement | VElement): string;
311
+
312
+ convertEllipseToPathData(ellipse: string | SVGElement | VElement): string;
313
+
314
+ convertRectToPathData(rect: string | SVGElement | VElement): string;
315
+
316
+ rectToPath(r: Vectorizer.RoundedRect): string;
317
+
318
+ normalizePathData(path: string): string;
319
+
320
+ toNode(el: SVGElement | VElement | SVGElement[]): SVGElement;
321
+
322
+ prototype: VElement;
323
+
324
+ attributeNames: { [key: string]: string };
325
+
326
+ supportCamelCaseAttributes: boolean;
327
+ }