@api-client/ui 0.2.2 → 0.2.3

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 (170) hide show
  1. package/package.json +7 -2
  2. package/test/env.ts +15 -0
  3. package/test/tsconfig.json +1 -7
  4. package/web-test-runner.config.js +5 -1
  5. package/build/src/visualization/elements/VizAssociationElement.d.ts +0 -4
  6. package/build/src/visualization/elements/VizAssociationElement.d.ts.map +0 -1
  7. package/build/src/visualization/elements/VizAssociationElement.js +0 -4
  8. package/build/src/visualization/elements/VizAssociationElement.js.map +0 -1
  9. package/build/src/visualization/elements/VizWorkspaceElement.d.ts +0 -110
  10. package/build/src/visualization/elements/VizWorkspaceElement.d.ts.map +0 -1
  11. package/build/src/visualization/elements/VizWorkspaceElement.js +0 -321
  12. package/build/src/visualization/elements/VizWorkspaceElement.js.map +0 -1
  13. package/build/src/visualization/elements/WorkspaceStyles.d.ts +0 -3
  14. package/build/src/visualization/elements/WorkspaceStyles.d.ts.map +0 -1
  15. package/build/src/visualization/elements/WorkspaceStyles.js +0 -168
  16. package/build/src/visualization/elements/WorkspaceStyles.js.map +0 -1
  17. package/build/src/visualization/lib/AnchorFinder.d.ts +0 -64
  18. package/build/src/visualization/lib/AnchorFinder.d.ts.map +0 -1
  19. package/build/src/visualization/lib/AnchorFinder.js +0 -107
  20. package/build/src/visualization/lib/AnchorFinder.js.map +0 -1
  21. package/build/src/visualization/lib/AnchorUtils.d.ts +0 -10
  22. package/build/src/visualization/lib/AnchorUtils.d.ts.map +0 -1
  23. package/build/src/visualization/lib/AnchorUtils.js +0 -44
  24. package/build/src/visualization/lib/AnchorUtils.js.map +0 -1
  25. package/build/src/visualization/lib/AssociationAnchors.d.ts +0 -134
  26. package/build/src/visualization/lib/AssociationAnchors.d.ts.map +0 -1
  27. package/build/src/visualization/lib/AssociationAnchors.js +0 -351
  28. package/build/src/visualization/lib/AssociationAnchors.js.map +0 -1
  29. package/build/src/visualization/lib/LabelSketch.d.ts +0 -16
  30. package/build/src/visualization/lib/LabelSketch.d.ts.map +0 -1
  31. package/build/src/visualization/lib/LabelSketch.js +0 -53
  32. package/build/src/visualization/lib/LabelSketch.js.map +0 -1
  33. package/build/src/visualization/lib/LineSketch.d.ts +0 -26
  34. package/build/src/visualization/lib/LineSketch.d.ts.map +0 -1
  35. package/build/src/visualization/lib/LineSketch.js +0 -55
  36. package/build/src/visualization/lib/LineSketch.js.map +0 -1
  37. package/build/src/visualization/lib/Point.d.ts +0 -74
  38. package/build/src/visualization/lib/Point.d.ts.map +0 -1
  39. package/build/src/visualization/lib/Point.js +0 -121
  40. package/build/src/visualization/lib/Point.js.map +0 -1
  41. package/build/src/visualization/lib/PositionUtils.d.ts +0 -65
  42. package/build/src/visualization/lib/PositionUtils.d.ts.map +0 -1
  43. package/build/src/visualization/lib/PositionUtils.js +0 -205
  44. package/build/src/visualization/lib/PositionUtils.js.map +0 -1
  45. package/build/src/visualization/lib/SelectionManager.d.ts +0 -183
  46. package/build/src/visualization/lib/SelectionManager.d.ts.map +0 -1
  47. package/build/src/visualization/lib/SelectionManager.js +0 -481
  48. package/build/src/visualization/lib/SelectionManager.js.map +0 -1
  49. package/build/src/visualization/lib/ShapeArtist.d.ts +0 -45
  50. package/build/src/visualization/lib/ShapeArtist.d.ts.map +0 -1
  51. package/build/src/visualization/lib/ShapeArtist.js +0 -209
  52. package/build/src/visualization/lib/ShapeArtist.js.map +0 -1
  53. package/build/src/visualization/lib/SvgMarkers.d.ts +0 -14
  54. package/build/src/visualization/lib/SvgMarkers.d.ts.map +0 -1
  55. package/build/src/visualization/lib/SvgMarkers.js +0 -77
  56. package/build/src/visualization/lib/SvgMarkers.js.map +0 -1
  57. package/build/src/visualization/lib/TipSketch.d.ts +0 -26
  58. package/build/src/visualization/lib/TipSketch.d.ts.map +0 -1
  59. package/build/src/visualization/lib/TipSketch.js +0 -77
  60. package/build/src/visualization/lib/TipSketch.js.map +0 -1
  61. package/build/src/visualization/lib/TouchSupport.d.ts +0 -14
  62. package/build/src/visualization/lib/TouchSupport.d.ts.map +0 -1
  63. package/build/src/visualization/lib/TouchSupport.js +0 -55
  64. package/build/src/visualization/lib/TouchSupport.js.map +0 -1
  65. package/build/src/visualization/lib/Utils.d.ts +0 -25
  66. package/build/src/visualization/lib/Utils.d.ts.map +0 -1
  67. package/build/src/visualization/lib/Utils.js +0 -59
  68. package/build/src/visualization/lib/Utils.js.map +0 -1
  69. package/build/src/visualization/lib/VisualizationTypes.d.ts +0 -216
  70. package/build/src/visualization/lib/VisualizationTypes.d.ts.map +0 -1
  71. package/build/src/visualization/lib/VisualizationTypes.js +0 -3
  72. package/build/src/visualization/lib/VisualizationTypes.js.map +0 -1
  73. package/build/src/visualization/lib/WorkspaceAlignment.d.ts +0 -51
  74. package/build/src/visualization/lib/WorkspaceAlignment.d.ts.map +0 -1
  75. package/build/src/visualization/lib/WorkspaceAlignment.js +0 -243
  76. package/build/src/visualization/lib/WorkspaceAlignment.js.map +0 -1
  77. package/build/src/visualization/lib/WorkspaceDebugging.d.ts +0 -104
  78. package/build/src/visualization/lib/WorkspaceDebugging.d.ts.map +0 -1
  79. package/build/src/visualization/lib/WorkspaceDebugging.js +0 -286
  80. package/build/src/visualization/lib/WorkspaceDebugging.js.map +0 -1
  81. package/build/src/visualization/lib/WorkspaceEdges.d.ts +0 -293
  82. package/build/src/visualization/lib/WorkspaceEdges.d.ts.map +0 -1
  83. package/build/src/visualization/lib/WorkspaceEdges.js +0 -1073
  84. package/build/src/visualization/lib/WorkspaceEdges.js.map +0 -1
  85. package/build/src/visualization/lib/WorkspaceGestures.d.ts +0 -119
  86. package/build/src/visualization/lib/WorkspaceGestures.d.ts.map +0 -1
  87. package/build/src/visualization/lib/WorkspaceGestures.js +0 -376
  88. package/build/src/visualization/lib/WorkspaceGestures.js.map +0 -1
  89. package/build/src/visualization/lib/WorkspaceSizing.d.ts +0 -66
  90. package/build/src/visualization/lib/WorkspaceSizing.d.ts.map +0 -1
  91. package/build/src/visualization/lib/WorkspaceSizing.js +0 -168
  92. package/build/src/visualization/lib/WorkspaceSizing.js.map +0 -1
  93. package/build/src/visualization/lib/lines/RectilinearLine.d.ts +0 -114
  94. package/build/src/visualization/lib/lines/RectilinearLine.d.ts.map +0 -1
  95. package/build/src/visualization/lib/lines/RectilinearLine.js +0 -605
  96. package/build/src/visualization/lib/lines/RectilinearLine.js.map +0 -1
  97. package/build/src/visualization/lib/tips/RectilinearTip.d.ts +0 -26
  98. package/build/src/visualization/lib/tips/RectilinearTip.d.ts.map +0 -1
  99. package/build/src/visualization/lib/tips/RectilinearTip.js +0 -149
  100. package/build/src/visualization/lib/tips/RectilinearTip.js.map +0 -1
  101. package/build/src/visualization/lib/tips/TipArtist.d.ts +0 -22
  102. package/build/src/visualization/lib/tips/TipArtist.d.ts.map +0 -1
  103. package/build/src/visualization/lib/tips/TipArtist.js +0 -31
  104. package/build/src/visualization/lib/tips/TipArtist.js.map +0 -1
  105. package/build/src/visualization/lib/types.d.ts +0 -164
  106. package/build/src/visualization/lib/types.d.ts.map +0 -1
  107. package/build/src/visualization/lib/types.js +0 -2
  108. package/build/src/visualization/lib/types.js.map +0 -1
  109. package/build/src/visualization/plugin/dnd/DragAndDropPlugin.d.ts +0 -126
  110. package/build/src/visualization/plugin/dnd/DragAndDropPlugin.d.ts.map +0 -1
  111. package/build/src/visualization/plugin/dnd/DragAndDropPlugin.js +0 -260
  112. package/build/src/visualization/plugin/dnd/DragAndDropPlugin.js.map +0 -1
  113. package/build/src/visualization/plugin/group-selection/GroupSelection.d.ts +0 -93
  114. package/build/src/visualization/plugin/group-selection/GroupSelection.d.ts.map +0 -1
  115. package/build/src/visualization/plugin/group-selection/GroupSelection.js +0 -250
  116. package/build/src/visualization/plugin/group-selection/GroupSelection.js.map +0 -1
  117. package/build/src/visualization/plugin/positioning/DataModelLayout.d.ts +0 -10
  118. package/build/src/visualization/plugin/positioning/DataModelLayout.d.ts.map +0 -1
  119. package/build/src/visualization/plugin/positioning/DataModelLayout.js +0 -105
  120. package/build/src/visualization/plugin/positioning/DataModelLayout.js.map +0 -1
  121. package/build/src/visualization/plugin/positioning/WorkspaceLayout.d.ts +0 -93
  122. package/build/src/visualization/plugin/positioning/WorkspaceLayout.d.ts.map +0 -1
  123. package/build/src/visualization/plugin/positioning/WorkspaceLayout.js +0 -96
  124. package/build/src/visualization/plugin/positioning/WorkspaceLayout.js.map +0 -1
  125. package/build/src/visualization/viz-association.d.ts +0 -7
  126. package/build/src/visualization/viz-association.d.ts.map +0 -1
  127. package/build/src/visualization/viz-association.js +0 -3
  128. package/build/src/visualization/viz-association.js.map +0 -1
  129. package/build/src/visualization/viz-workspace.d.ts +0 -7
  130. package/build/src/visualization/viz-workspace.d.ts.map +0 -1
  131. package/build/src/visualization/viz-workspace.js +0 -3
  132. package/build/src/visualization/viz-workspace.js.map +0 -1
  133. package/src/visualization/elements/VizAssociationElement.ts +0 -3
  134. package/src/visualization/elements/VizWorkspaceElement.ts +0 -302
  135. package/src/visualization/elements/WorkspaceStyles.ts +0 -168
  136. package/src/visualization/lib/AnchorFinder.ts +0 -112
  137. package/src/visualization/lib/AnchorUtils.ts +0 -53
  138. package/src/visualization/lib/AssociationAnchors.ts +0 -418
  139. package/src/visualization/lib/LabelSketch.ts +0 -67
  140. package/src/visualization/lib/LineSketch.ts +0 -62
  141. package/src/visualization/lib/Point.ts +0 -134
  142. package/src/visualization/lib/PositionUtils.ts +0 -218
  143. package/src/visualization/lib/SelectionManager.ts +0 -513
  144. package/src/visualization/lib/ShapeArtist.ts +0 -222
  145. package/src/visualization/lib/SvgMarkers.ts +0 -80
  146. package/src/visualization/lib/TipSketch.ts +0 -91
  147. package/src/visualization/lib/TouchSupport.ts +0 -72
  148. package/src/visualization/lib/Utils.ts +0 -63
  149. package/src/visualization/lib/VisualizationTypes.ts +0 -232
  150. package/src/visualization/lib/WorkspaceAlignment.ts +0 -261
  151. package/src/visualization/lib/WorkspaceDebugging.ts +0 -313
  152. package/src/visualization/lib/WorkspaceEdges.ts +0 -1153
  153. package/src/visualization/lib/WorkspaceGestures.ts +0 -400
  154. package/src/visualization/lib/WorkspaceSizing.ts +0 -181
  155. package/src/visualization/lib/lines/RectilinearLine.ts +0 -589
  156. package/src/visualization/lib/tips/RectilinearTip.ts +0 -156
  157. package/src/visualization/lib/tips/TipArtist.ts +0 -34
  158. package/src/visualization/lib/types.ts +0 -173
  159. package/src/visualization/plugin/dnd/DragAndDropPlugin.ts +0 -294
  160. package/src/visualization/plugin/group-selection/GroupSelection.ts +0 -271
  161. package/src/visualization/plugin/positioning/DataModelLayout.ts +0 -114
  162. package/src/visualization/plugin/positioning/WorkspaceLayout.ts +0 -149
  163. package/src/visualization/viz-association.ts +0 -9
  164. package/src/visualization/viz-workspace.ts +0 -9
  165. package/test/env.d.ts +0 -9
  166. package/test/env.js +0 -7
  167. package/test/visualization/lib/AnchorFinder.test.ts +0 -313
  168. package/test/visualization/lib/AnchorUtils.test.ts +0 -178
  169. package/test/visualization/lib/PositionUtils.test.ts +0 -406
  170. package/test/visualization/lib/test-styles.css +0 -80
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@api-client/ui",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Internal UI component library for the API Client ecosystem.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "build/src/index.js",
@@ -21,7 +21,7 @@
21
21
  "url": "https://github.com/api-client/ui/issues"
22
22
  },
23
23
  "exports": {
24
- ".": "./build/index.js",
24
+ ".": "./build/src/index.js",
25
25
  "./package.json": "./package.json",
26
26
  "./bindings/*.js": "./build/src/bindings/*.js",
27
27
  "./bindings/*": "./build/src/bindings/*",
@@ -66,6 +66,7 @@
66
66
  "format:eslint": "wireit",
67
67
  "test": "wireit",
68
68
  "test:watch": "npm run tsc:all && concurrently --kill-others --raw \"tsc --watch --preserveWatchOutput --project tsconfig.all.json\" \"wtr --watch --playwright --browsers chromium\"",
69
+ "test:coverage": "wireit",
69
70
  "prepare": "husky",
70
71
  "tsc": "wireit",
71
72
  "dev": "wireit",
@@ -98,6 +99,10 @@
98
99
  "command": "wtr --playwright --browsers chromium",
99
100
  "dependencies": ["tsc:all"]
100
101
  },
102
+ "test:coverage": {
103
+ "command": "wtr --playwright --browsers chromium --coverage",
104
+ "dependencies": ["tsc:all"]
105
+ },
101
106
  "tsc:all": {
102
107
  "command": "tsc --project tsconfig.all.json",
103
108
  "clean": "if-file-deleted",
package/test/env.ts ADDED
@@ -0,0 +1,15 @@
1
+ export interface Env {
2
+ oauth2: {
3
+ port: number
4
+ jwtKey: string
5
+ issuer: string
6
+ }
7
+ }
8
+ const value: Env = {
9
+ oauth2: {
10
+ port: 0,
11
+ jwtKey: '',
12
+ issuer: '',
13
+ },
14
+ }
15
+ export default value
@@ -1,13 +1,7 @@
1
1
  {
2
2
  "extends": "../tsconfig",
3
3
  "compilerOptions": {
4
- "outDir": "../.tmp/testing",
5
- "declaration": false,
6
- "declarationMap": false,
7
- "sourceMap": false,
8
- "pretty": false,
9
- "inlineSourceMap": false,
10
- "inlineSources": false
4
+ "outDir": "../.tmp",
11
5
  },
12
6
  "include": ["../src/**/*", "../test/**/*"]
13
7
  }
@@ -65,7 +65,6 @@ export default /** @type TestRunnerConfig */ ({
65
65
  testRunnerHtml: (testFramework) =>
66
66
  `<html class="theme-light">
67
67
  <head>
68
- <link rel="stylesheet" href="/test/visualization/lib/test-styles.css" />
69
68
  <!-- m3 styles -->
70
69
  <link rel="stylesheet" href="/src/styles/m3/tokens.css" data-theme="tokens" />
71
70
  <link rel="stylesheet" href="/src/styles/m3/theme.css" data-theme="light" />
@@ -83,4 +82,9 @@ export default /** @type TestRunnerConfig */ ({
83
82
  browserStartTimeout: 20000,
84
83
  testsStartTimeout: 20000,
85
84
  testsFinishTimeout: 60000,
85
+
86
+ coverageConfig: {
87
+ report: true,
88
+ reporters: ['lcov', 'text'],
89
+ },
86
90
  })
@@ -1,4 +0,0 @@
1
- import { LitElement } from 'lit';
2
- export default class VizAssociationElement extends LitElement {
3
- }
4
- //# sourceMappingURL=VizAssociationElement.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VizAssociationElement.d.ts","sourceRoot":"","sources":["../../../../src/visualization/elements/VizAssociationElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAEhC,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,UAAU;CAAG"}
@@ -1,4 +0,0 @@
1
- import { LitElement } from 'lit';
2
- export default class VizAssociationElement extends LitElement {
3
- }
4
- //# sourceMappingURL=VizAssociationElement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VizAssociationElement.js","sourceRoot":"","sources":["../../../../src/visualization/elements/VizAssociationElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAEhC,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,UAAU;CAAG","sourcesContent":["import { LitElement } from 'lit'\n\nexport default class VizAssociationElement extends LitElement {}\n"]}
@@ -1,110 +0,0 @@
1
- import { CSSResult, LitElement, PropertyValues, SVGTemplateResult, TemplateResult } from 'lit';
2
- import { AssociationAnchors } from '../lib/AssociationAnchors.js';
3
- import { SelectionManager } from '../lib/SelectionManager.js';
4
- import { WorkspaceEdges } from '../lib/WorkspaceEdges.js';
5
- import { WorkspaceGestures } from '../lib/WorkspaceGestures.js';
6
- import { WorkspaceSizing } from '../lib/WorkspaceSizing.js';
7
- export declare const canvasRef: unique symbol;
8
- export declare const svgRef: unique symbol;
9
- export declare const attributeTypeEditHandler: unique symbol;
10
- export declare const attributeTypeDropdownClosedHandler: unique symbol;
11
- export declare const attributeTypeSelectHandler: unique symbol;
12
- export declare const geometryChangeHandler: unique symbol;
13
- export declare const notifyZoom: unique symbol;
14
- export declare const zoomTimeout: unique symbol;
15
- /**
16
- * @fires positionchange
17
- */
18
- export default class VizWorkspaceElement extends LitElement {
19
- static get styles(): CSSResult[];
20
- /**
21
- * The zoom level of the current visualization
22
- * @attribute
23
- */
24
- accessor zoom: number;
25
- /**
26
- * Gets or sets the number of pixels that an element's content is scrolled horizontally.
27
- * Unlike regular HTML elements, this can be a negative value as it is possible to
28
- * scroll outside the working area.
29
- */
30
- get scrollLeft(): number;
31
- /**
32
- * @param value The x-axis position value
33
- */
34
- set scrollLeft(value: number);
35
- /**
36
- * Gets or sets the number of pixels that an element's content is scrolled vertically.
37
- * Unlike regular HTML elements, this can be a negative value as it is possible to
38
- * scroll outside the working area.
39
- */
40
- get scrollTop(): number;
41
- /**
42
- * @param value The y-axis position value
43
- */
44
- set scrollTop(value: number);
45
- [canvasRef]?: HTMLDivElement;
46
- get canvas(): HTMLDivElement | null;
47
- [svgRef]?: SVGElement;
48
- get associationSvg(): SVGElement;
49
- /**
50
- * The width of the canvas element, in pixels
51
- */
52
- accessor width: number;
53
- /**
54
- * The height of the canvas element, in pixels
55
- */
56
- accessor height: number;
57
- /**
58
- * When set it instruct the visualization workspace to grow over the currently set `width` and `height`
59
- * when a new added item is placed outside the bounds of the workspace.
60
- */
61
- accessor autoResize: boolean;
62
- /**
63
- * Enables some limited debugging information.
64
- */
65
- accessor debug: boolean | undefined;
66
- /**
67
- * The current scale of the visualization
68
- */
69
- accessor scale: number;
70
- [zoomTimeout]?: number;
71
- gestures: WorkspaceGestures;
72
- selection: SelectionManager;
73
- edges: WorkspaceEdges;
74
- anchors: AssociationAnchors;
75
- sizing: WorkspaceSizing;
76
- constructor();
77
- connectedCallback(): void;
78
- disconnectedCallback(): void;
79
- protected firstUpdated(cp: PropertyValues<this>): void;
80
- protected willUpdate(cp: PropertyValues<this>): void;
81
- /**
82
- * Clears the state of the workspace.
83
- */
84
- clear(): void;
85
- /**
86
- * Centers the workspace.
87
- */
88
- center(): void;
89
- [notifyZoom](): void;
90
- [geometryChangeHandler](e: Event): Promise<void>;
91
- scrollBy(options: ScrollToOptions): void;
92
- scrollBy(x: number, y: number): void;
93
- scrollTo(options: ScrollToOptions): void;
94
- scrollTo(x: number, y: number): void;
95
- /**
96
- * Scrolls the view if the position defined by `x` and `y` arguments requires
97
- * the view to be moved.
98
- *
99
- * @param x The x coordinate of the point
100
- * @param y The y coordinate of the point
101
- * @returns true if the canvas was moved
102
- */
103
- scrollIfNeeded(x: number, y: number): boolean;
104
- render(): TemplateResult;
105
- /**
106
- * @return {SVGTemplateResult} The template for the associations
107
- */
108
- renderLinesTemplate(): SVGTemplateResult;
109
- }
110
- //# sourceMappingURL=VizWorkspaceElement.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VizWorkspaceElement.d.ts","sourceRoot":"","sources":["../../../../src/visualization/elements/VizWorkspaceElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAQ,UAAU,EAAE,cAAc,EAAO,iBAAiB,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAGzG,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAM3D,eAAO,MAAM,SAAS,eAAsB,CAAA;AAC5C,eAAO,MAAM,MAAM,eAAmB,CAAA;AACtC,eAAO,MAAM,wBAAwB,eAAqC,CAAA;AAC1E,eAAO,MAAM,kCAAkC,eAA+C,CAAA;AAC9F,eAAO,MAAM,0BAA0B,eAAuC,CAAA;AAC9E,eAAO,MAAM,qBAAqB,eAAkC,CAAA;AAEpE,eAAO,MAAM,UAAU,eAAuB,CAAA;AAC9C,eAAO,MAAM,WAAW,eAAwB,CAAA;AAEhD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU;IACzD,WAAoB,MAAM,IAAI,SAAS,EAA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K,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7C,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAExC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAapC,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAExC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAc7C;;;;;;;OAOG;IACH,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;IAIpC,MAAM,IAAI,cAAc;IAejC;;OAEG;IACH,mBAAmB,IAAI,iBAAiB;CA2BzC"}
@@ -1,321 +0,0 @@
1
- import { __esDecorate, __runInitializers } from "tslib";
2
- import { html, LitElement, svg } from 'lit';
3
- import { property } from 'lit/decorators.js';
4
- import { styleMap } from 'lit/directives/style-map.js';
5
- import { AssociationAnchors } from '../lib/AssociationAnchors.js';
6
- import { SelectionManager } from '../lib/SelectionManager.js';
7
- import { ShapeArtist } from '../lib/ShapeArtist.js';
8
- import { WorkspaceEdges } from '../lib/WorkspaceEdges.js';
9
- import { WorkspaceGestures } from '../lib/WorkspaceGestures.js';
10
- import { WorkspaceSizing } from '../lib/WorkspaceSizing.js';
11
- import elementStyles from './WorkspaceStyles.js';
12
- const defaultCanvasWidth = 3840;
13
- const defaultCanvasHeight = 2160;
14
- export const canvasRef = Symbol('canvasRef');
15
- export const svgRef = Symbol('svgRef');
16
- export const attributeTypeEditHandler = Symbol('attributeTypeEditHandler');
17
- export const attributeTypeDropdownClosedHandler = Symbol('attributeTypeDropdownClosedHandler');
18
- export const attributeTypeSelectHandler = Symbol('attributeTypeSelectHandler');
19
- export const geometryChangeHandler = Symbol('geometryChangeHandler');
20
- export const notifyZoom = Symbol('notifyZoom');
21
- export const zoomTimeout = Symbol('zoomTimeout');
22
- let VizWorkspaceElement = (() => {
23
- let _classSuper = LitElement;
24
- let _zoom_decorators;
25
- let _zoom_initializers = [];
26
- let _zoom_extraInitializers = [];
27
- let _width_decorators;
28
- let _width_initializers = [];
29
- let _width_extraInitializers = [];
30
- let _height_decorators;
31
- let _height_initializers = [];
32
- let _height_extraInitializers = [];
33
- let _autoResize_decorators;
34
- let _autoResize_initializers = [];
35
- let _autoResize_extraInitializers = [];
36
- let _debug_decorators;
37
- let _debug_initializers = [];
38
- let _debug_extraInitializers = [];
39
- let _scale_decorators;
40
- let _scale_initializers = [];
41
- let _scale_extraInitializers = [];
42
- return class VizWorkspaceElement extends _classSuper {
43
- static {
44
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
45
- __esDecorate(this, null, _zoom_decorators, { kind: "accessor", name: "zoom", static: false, private: false, access: { has: obj => "zoom" in obj, get: obj => obj.zoom, set: (obj, value) => { obj.zoom = value; } }, metadata: _metadata }, _zoom_initializers, _zoom_extraInitializers);
46
- __esDecorate(this, null, _width_decorators, { kind: "accessor", name: "width", static: false, private: false, access: { has: obj => "width" in obj, get: obj => obj.width, set: (obj, value) => { obj.width = value; } }, metadata: _metadata }, _width_initializers, _width_extraInitializers);
47
- __esDecorate(this, null, _height_decorators, { kind: "accessor", name: "height", static: false, private: false, access: { has: obj => "height" in obj, get: obj => obj.height, set: (obj, value) => { obj.height = value; } }, metadata: _metadata }, _height_initializers, _height_extraInitializers);
48
- __esDecorate(this, null, _autoResize_decorators, { kind: "accessor", name: "autoResize", static: false, private: false, access: { has: obj => "autoResize" in obj, get: obj => obj.autoResize, set: (obj, value) => { obj.autoResize = value; } }, metadata: _metadata }, _autoResize_initializers, _autoResize_extraInitializers);
49
- __esDecorate(this, null, _debug_decorators, { kind: "accessor", name: "debug", static: false, private: false, access: { has: obj => "debug" in obj, get: obj => obj.debug, set: (obj, value) => { obj.debug = value; } }, metadata: _metadata }, _debug_initializers, _debug_extraInitializers);
50
- __esDecorate(this, null, _scale_decorators, { kind: "accessor", name: "scale", static: false, private: false, access: { has: obj => "scale" in obj, get: obj => obj.scale, set: (obj, value) => { obj.scale = value; } }, metadata: _metadata }, _scale_initializers, _scale_extraInitializers);
51
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
52
- }
53
- static get styles() {
54
- return [elementStyles];
55
- }
56
- #zoom_accessor_storage = __runInitializers(this, _zoom_initializers, 0
57
- /**
58
- * Gets or sets the number of pixels that an element's content is scrolled horizontally.
59
- * Unlike regular HTML elements, this can be a negative value as it is possible to
60
- * scroll outside the working area.
61
- */
62
- );
63
- /**
64
- * The zoom level of the current visualization
65
- * @attribute
66
- */
67
- get zoom() { return this.#zoom_accessor_storage; }
68
- set zoom(value) { this.#zoom_accessor_storage = value; }
69
- /**
70
- * Gets or sets the number of pixels that an element's content is scrolled horizontally.
71
- * Unlike regular HTML elements, this can be a negative value as it is possible to
72
- * scroll outside the working area.
73
- */
74
- get scrollLeft() {
75
- const s = this.gestures;
76
- return (s && s.left) || 0;
77
- }
78
- /**
79
- * @param value The x-axis position value
80
- */
81
- set scrollLeft(value) {
82
- this.gestures.left = value;
83
- }
84
- /**
85
- * Gets or sets the number of pixels that an element's content is scrolled vertically.
86
- * Unlike regular HTML elements, this can be a negative value as it is possible to
87
- * scroll outside the working area.
88
- */
89
- get scrollTop() {
90
- const s = this.gestures;
91
- return (s && s.top) || 0;
92
- }
93
- /**
94
- * @param value The y-axis position value
95
- */
96
- set scrollTop(value) {
97
- this.gestures.top = value;
98
- }
99
- [(_zoom_decorators = [property({ type: Number, reflect: true })], canvasRef)] = __runInitializers(this, _zoom_extraInitializers);
100
- get canvas() {
101
- if (!this[canvasRef]) {
102
- this[canvasRef] = this.shadowRoot?.querySelector('.canvas');
103
- }
104
- return this[canvasRef];
105
- }
106
- [svgRef];
107
- get associationSvg() {
108
- if (!this[svgRef]) {
109
- this[svgRef] = this.shadowRoot?.querySelector('.association');
110
- }
111
- return this[svgRef];
112
- }
113
- #width_accessor_storage = __runInitializers(this, _width_initializers, defaultCanvasWidth
114
- /**
115
- * The height of the canvas element, in pixels
116
- */
117
- );
118
- /**
119
- * The width of the canvas element, in pixels
120
- */
121
- get width() { return this.#width_accessor_storage; }
122
- set width(value) { this.#width_accessor_storage = value; }
123
- #height_accessor_storage = (__runInitializers(this, _width_extraInitializers), __runInitializers(this, _height_initializers, defaultCanvasHeight
124
- /**
125
- * When set it instruct the visualization workspace to grow over the currently set `width` and `height`
126
- * when a new added item is placed outside the bounds of the workspace.
127
- */
128
- ));
129
- /**
130
- * The height of the canvas element, in pixels
131
- */
132
- get height() { return this.#height_accessor_storage; }
133
- set height(value) { this.#height_accessor_storage = value; }
134
- #autoResize_accessor_storage = (__runInitializers(this, _height_extraInitializers), __runInitializers(this, _autoResize_initializers, false
135
- /**
136
- * Enables some limited debugging information.
137
- */
138
- ));
139
- /**
140
- * When set it instruct the visualization workspace to grow over the currently set `width` and `height`
141
- * when a new added item is placed outside the bounds of the workspace.
142
- */
143
- get autoResize() { return this.#autoResize_accessor_storage; }
144
- set autoResize(value) { this.#autoResize_accessor_storage = value; }
145
- #debug_accessor_storage = (__runInitializers(this, _autoResize_extraInitializers), __runInitializers(this, _debug_initializers, void 0));
146
- /**
147
- * Enables some limited debugging information.
148
- */
149
- get debug() { return this.#debug_accessor_storage; }
150
- set debug(value) { this.#debug_accessor_storage = value; }
151
- #scale_accessor_storage = (__runInitializers(this, _debug_extraInitializers), __runInitializers(this, _scale_initializers, 1));
152
- /**
153
- * The current scale of the visualization
154
- */
155
- get scale() { return this.#scale_accessor_storage; }
156
- set scale(value) { this.#scale_accessor_storage = value; }
157
- [(_width_decorators = [property({ type: Number })], _height_decorators = [property({ type: Number })], _autoResize_decorators = [property({ type: Boolean, reflect: true })], _debug_decorators = [property({ type: Boolean, reflect: true })], _scale_decorators = [property({ type: Number })], zoomTimeout)] = __runInitializers(this, _scale_extraInitializers);
158
- gestures = new WorkspaceGestures(this);
159
- selection = new SelectionManager(this);
160
- edges = new WorkspaceEdges(this);
161
- anchors = new AssociationAnchors(this);
162
- sizing = new WorkspaceSizing(this);
163
- constructor() {
164
- super();
165
- this.addEventListener('geometrychange', this[geometryChangeHandler].bind(this));
166
- }
167
- connectedCallback() {
168
- super.connectedCallback();
169
- this.gestures.connect();
170
- this.selection.connect();
171
- this.edges.connect();
172
- this.anchors.connect();
173
- }
174
- disconnectedCallback() {
175
- super.disconnectedCallback();
176
- this.gestures.disconnect();
177
- this.selection.disconnect();
178
- this.edges.disconnect();
179
- this.anchors.disconnect();
180
- }
181
- firstUpdated(cp) {
182
- super.firstUpdated(cp);
183
- const { top, left } = this.gestures;
184
- if (top === null || left === null) {
185
- this.gestures.scrollTo(0, 0);
186
- // this.center();
187
- }
188
- this.edges.listenContent();
189
- }
190
- willUpdate(cp) {
191
- if (cp.has('autoResize')) {
192
- const value = cp.get('autoResize');
193
- if (value === true) {
194
- this.sizing.connect();
195
- }
196
- else if (this.sizing.connected) {
197
- this.sizing.disconnect();
198
- }
199
- }
200
- if (cp.has('zoom')) {
201
- this.gestures.updateScale();
202
- }
203
- }
204
- /**
205
- * Clears the state of the workspace.
206
- */
207
- clear() {
208
- this.edges.clear();
209
- this.selection.deselectAll();
210
- }
211
- /**
212
- * Centers the workspace.
213
- */
214
- center() {
215
- const { width: cWidth = defaultCanvasWidth, height: cHeight = defaultCanvasHeight } = this;
216
- const { height, width } = this.getBoundingClientRect();
217
- const midWidth = cWidth / 2;
218
- const midHeight = cHeight / 2;
219
- const left = midWidth - width / 2;
220
- const top = midHeight - height / 2;
221
- this.gestures.left = -left;
222
- this.gestures.top = -top;
223
- }
224
- [notifyZoom]() {
225
- if (this[zoomTimeout]) {
226
- clearTimeout(this[zoomTimeout]);
227
- }
228
- this[zoomTimeout] = setTimeout(() => {
229
- this.dispatchEvent(new Event('zoomchange'));
230
- }, 1);
231
- }
232
- async [geometryChangeHandler](e) {
233
- const source = e.target;
234
- await this.edges.update(source.dataset.key);
235
- }
236
- /**
237
- * Scrolls the element by the given amount.
238
- * @param {ScrollToOptions|number} xCoordOrOptions The horizontal pixel value that you want to scroll by
239
- * or the scroll options. When passed value is the `ScrollToOptions` interface then
240
- * the second argument is ignored.
241
- * @param {number=} yCoord The vertical pixel value that you want to scroll by.
242
- */
243
- scrollBy(xCoordOrOptions, yCoord) {
244
- this.gestures.scrollBy(xCoordOrOptions, yCoord);
245
- }
246
- /**
247
- * Scrolls to a particular set of coordinates inside the element.
248
- *
249
- * @param xCoordOrOptions The pixel along the horizontal axis of the element
250
- * that you want displayed in the upper left. When passed value is the `ScrollToOptions` interface then
251
- * the second argument is ignored.
252
- * @param yCoord The pixel along the vertical axis of the element that you want displayed in the upper left.
253
- */
254
- scrollTo(xCoordOrOptions, yCoord) {
255
- this.gestures.scrollTo(xCoordOrOptions, yCoord);
256
- }
257
- /**
258
- * Scrolls the view if the position defined by `x` and `y` arguments requires
259
- * the view to be moved.
260
- *
261
- * @param x The x coordinate of the point
262
- * @param y The y coordinate of the point
263
- * @returns true if the canvas was moved
264
- */
265
- scrollIfNeeded(x, y) {
266
- return this.gestures.scrollIfNeeded(x, y);
267
- }
268
- render() {
269
- const { scale, scrollLeft, scrollTop } = this;
270
- const styles = {
271
- transform: `scale(${scale}) translate(${scrollLeft}px, ${scrollTop}px)`,
272
- width: `${this.width}px`,
273
- height: `${this.height}px`,
274
- };
275
- return html `
276
- <div class="content canvas" style="${styleMap(styles)}">
277
- ${this.renderLinesTemplate()}
278
- <slot></slot>
279
- </div>
280
- `;
281
- }
282
- /**
283
- * @return {SVGTemplateResult} The template for the associations
284
- */
285
- renderLinesTemplate() {
286
- const { debug } = this;
287
- const { edges } = this.edges;
288
- const primarySelected = [];
289
- const secondarySelected = [];
290
- const hovered = [];
291
- const rest = [];
292
- edges.forEach((item) => {
293
- const line = ShapeArtist.line(item, debug);
294
- const { shape } = item;
295
- const { selection = {} } = shape;
296
- if (selection.primary) {
297
- primarySelected.push(line);
298
- }
299
- else if (selection.secondary) {
300
- secondarySelected.push(line);
301
- }
302
- else if (selection.hover) {
303
- hovered.push(line);
304
- }
305
- else {
306
- rest.push(line);
307
- }
308
- });
309
- const edgesResult = primarySelected.concat(secondarySelected).concat(hovered).concat(rest).reverse();
310
- return svg `
311
- <svg width="100%" height="100%" class="association">
312
- ${edgesResult.length ? edgesResult : ''}
313
- </svg>`;
314
- }
315
- };
316
- })();
317
- /**
318
- * @fires positionchange
319
- */
320
- export default VizWorkspaceElement;
321
- //# sourceMappingURL=VizWorkspaceElement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VizWorkspaceElement.js","sourceRoot":"","sources":["../../../../src/visualization/elements/VizWorkspaceElement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAa,IAAI,EAAE,UAAU,EAAkB,GAAG,EAAqC,MAAM,KAAK,CAAA;AACzG,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,aAAa,MAAM,sBAAsB,CAAA;AAEhD,MAAM,kBAAkB,GAAG,IAAI,CAAA;AAC/B,MAAM,mBAAmB,GAAG,IAAI,CAAA;AAEhC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AAC5C,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AACtC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,C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SAAS,CAAC,OAAO,EAAE,CAAC;oBACtB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBAC5B,CAAC;qBAAM,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;oBAC/B,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBAC9B,CAAC;qBAAM,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;oBAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACpB,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACjB,CAAC;YACH,CAAC,CAAC,CAAA;YACF,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;YACpG,OAAO,GAAG,CAAA;;MAER,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;WAChC,CAAA;QACT,CAAC;;;AApRH;;GAEG;AACH,mCAkRC","sourcesContent":["import { CSSResult, html, LitElement, PropertyValues, svg, SVGTemplateResult, TemplateResult } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { styleMap } from 'lit/directives/style-map.js'\nimport { AssociationAnchors } from '../lib/AssociationAnchors.js'\nimport { SelectionManager } from '../lib/SelectionManager.js'\nimport { ShapeArtist } from '../lib/ShapeArtist.js'\nimport { WorkspaceEdges } from '../lib/WorkspaceEdges.js'\nimport { WorkspaceGestures } from '../lib/WorkspaceGestures.js'\nimport { WorkspaceSizing } from '../lib/WorkspaceSizing.js'\nimport elementStyles from './WorkspaceStyles.js'\n\nconst defaultCanvasWidth = 3840\nconst defaultCanvasHeight = 2160\n\nexport const canvasRef = Symbol('canvasRef')\nexport const svgRef = Symbol('svgRef')\nexport const attributeTypeEditHandler = Symbol('attributeTypeEditHandler')\nexport const attributeTypeDropdownClosedHandler = Symbol('attributeTypeDropdownClosedHandler')\nexport const attributeTypeSelectHandler = Symbol('attributeTypeSelectHandler')\nexport const geometryChangeHandler = Symbol('geometryChangeHandler')\n\nexport const notifyZoom = Symbol('notifyZoom')\nexport const zoomTimeout = Symbol('zoomTimeout')\n\n/**\n * @fires positionchange\n */\nexport default class VizWorkspaceElement extends LitElement {\n static override get styles(): CSSResult[] {\n return [elementStyles]\n }\n\n /**\n * The zoom level of the current visualization\n * @attribute\n */\n @property({ type: Number, reflect: true })\n accessor zoom = 0\n\n /**\n * Gets or sets the number of pixels that an element's content is scrolled horizontally.\n * Unlike regular HTML elements, this can be a negative value as it is possible to\n * scroll outside the working area.\n */\n override get scrollLeft(): number {\n const s = this.gestures\n return (s && s.left) || 0\n }\n\n /**\n * @param value The x-axis position value\n */\n override set scrollLeft(value: number) {\n this.gestures.left = value\n }\n\n /**\n * Gets or sets the number of pixels that an element's content is scrolled vertically.\n * Unlike regular HTML elements, this can be a negative value as it is possible to\n * scroll outside the working area.\n */\n override get scrollTop(): number {\n const s = this.gestures\n return (s && s.top) || 0\n }\n\n /**\n * @param value The y-axis position value\n */\n override set scrollTop(value: number) {\n this.gestures.top = value\n }\n\n [canvasRef]?: HTMLDivElement\n\n get canvas(): HTMLDivElement | null {\n if (!this[canvasRef]) {\n this[canvasRef] = this.shadowRoot?.querySelector('.canvas') as HTMLDivElement\n }\n return this[canvasRef] as HTMLDivElement\n }\n\n [svgRef]?: SVGElement\n\n get associationSvg(): SVGElement {\n if (!this[svgRef]) {\n this[svgRef] = this.shadowRoot?.querySelector('.association') as SVGElement\n }\n return this[svgRef] as SVGElement\n }\n\n /**\n * The width of the canvas element, in pixels\n */\n @property({ type: Number })\n accessor width = defaultCanvasWidth\n\n /**\n * The height of the canvas element, in pixels\n */\n @property({ type: Number })\n accessor height: number = defaultCanvasHeight\n\n /**\n * When set it instruct the visualization workspace to grow over the currently set `width` and `height`\n * when a new added item is placed outside the bounds of the workspace.\n */\n @property({ type: Boolean, reflect: true })\n accessor autoResize = false\n\n /**\n * Enables some limited debugging information.\n */\n @property({ type: Boolean, reflect: true }) accessor debug: boolean | undefined\n\n /**\n * The current scale of the visualization\n */\n @property({ type: Number }) accessor scale = 1;\n\n [zoomTimeout]?: number\n\n gestures = new WorkspaceGestures(this)\n\n selection = new SelectionManager(this)\n\n edges = new WorkspaceEdges(this)\n\n anchors = new AssociationAnchors(this)\n\n sizing = new WorkspaceSizing(this)\n\n constructor() {\n super()\n this.addEventListener('geometrychange', this[geometryChangeHandler].bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.gestures.connect()\n this.selection.connect()\n this.edges.connect()\n this.anchors.connect()\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback()\n this.gestures.disconnect()\n this.selection.disconnect()\n this.edges.disconnect()\n this.anchors.disconnect()\n }\n\n protected override firstUpdated(cp: PropertyValues<this>): void {\n super.firstUpdated(cp)\n const { top, left } = this.gestures\n if (top === null || left === null) {\n this.gestures.scrollTo(0, 0)\n // this.center();\n }\n this.edges.listenContent()\n }\n\n protected override willUpdate(cp: PropertyValues<this>): void {\n if (cp.has('autoResize')) {\n const value = cp.get('autoResize')\n if (value === true) {\n this.sizing.connect()\n } else if (this.sizing.connected) {\n this.sizing.disconnect()\n }\n }\n if (cp.has('zoom')) {\n this.gestures.updateScale()\n }\n }\n\n /**\n * Clears the state of the workspace.\n */\n clear(): void {\n this.edges.clear()\n this.selection.deselectAll()\n }\n\n /**\n * Centers the workspace.\n */\n center(): void {\n const { width: cWidth = defaultCanvasWidth, height: cHeight = defaultCanvasHeight } = this\n const { height, width } = this.getBoundingClientRect()\n const midWidth = cWidth / 2\n const midHeight = cHeight / 2\n const left = midWidth - width / 2\n const top = midHeight - height / 2\n this.gestures.left = -left\n this.gestures.top = -top\n }\n\n [notifyZoom](): void {\n if (this[zoomTimeout]) {\n clearTimeout(this[zoomTimeout])\n }\n this[zoomTimeout] = setTimeout(() => {\n this.dispatchEvent(new Event('zoomchange'))\n }, 1) as unknown as number\n }\n\n async [geometryChangeHandler](e: Event): Promise<void> {\n const source = e.target as HTMLElement\n await this.edges.update(source.dataset.key as string)\n }\n\n override scrollBy(options: ScrollToOptions): void\n\n override scrollBy(x: number, y: number): void\n\n /**\n * Scrolls the element by the given amount.\n * @param {ScrollToOptions|number} xCoordOrOptions The horizontal pixel value that you want to scroll by\n * or the scroll options. When passed value is the `ScrollToOptions` interface then\n * the second argument is ignored.\n * @param {number=} yCoord The vertical pixel value that you want to scroll by.\n */\n override scrollBy(xCoordOrOptions: ScrollToOptions | number, yCoord?: number | undefined): void {\n this.gestures.scrollBy(xCoordOrOptions, yCoord)\n }\n\n override scrollTo(options: ScrollToOptions): void\n\n override scrollTo(x: number, y: number): void\n\n /**\n * Scrolls to a particular set of coordinates inside the element.\n *\n * @param xCoordOrOptions The pixel along the horizontal axis of the element\n * that you want displayed in the upper left. When passed value is the `ScrollToOptions` interface then\n * the second argument is ignored.\n * @param yCoord The pixel along the vertical axis of the element that you want displayed in the upper left.\n */\n override scrollTo(xCoordOrOptions: ScrollToOptions | number, yCoord?: number): void {\n this.gestures.scrollTo(xCoordOrOptions, yCoord)\n }\n\n /**\n * Scrolls the view if the position defined by `x` and `y` arguments requires\n * the view to be moved.\n *\n * @param x The x coordinate of the point\n * @param y The y coordinate of the point\n * @returns true if the canvas was moved\n */\n scrollIfNeeded(x: number, y: number): boolean {\n return this.gestures.scrollIfNeeded(x, y)\n }\n\n override render(): TemplateResult {\n const { scale, scrollLeft, scrollTop } = this\n const styles = {\n transform: `scale(${scale}) translate(${scrollLeft}px, ${scrollTop}px)`,\n width: `${this.width}px`,\n height: `${this.height}px`,\n }\n return html`\n <div class=\"content canvas\" style=\"${styleMap(styles)}\">\n ${this.renderLinesTemplate()}\n <slot></slot>\n </div>\n `\n }\n\n /**\n * @return {SVGTemplateResult} The template for the associations\n */\n renderLinesTemplate(): SVGTemplateResult {\n const { debug } = this\n const { edges } = this.edges\n const primarySelected: (string | SVGTemplateResult)[] = []\n const secondarySelected: (string | SVGTemplateResult)[] = []\n const hovered: (string | SVGTemplateResult)[] = []\n const rest: (string | SVGTemplateResult)[] = []\n edges.forEach((item) => {\n const line = ShapeArtist.line(item, debug)\n const { shape } = item\n const { selection = {} } = shape\n if (selection.primary) {\n primarySelected.push(line)\n } else if (selection.secondary) {\n secondarySelected.push(line)\n } else if (selection.hover) {\n hovered.push(line)\n } else {\n rest.push(line)\n }\n })\n const edgesResult = primarySelected.concat(secondarySelected).concat(hovered).concat(rest).reverse()\n return svg`\n <svg width=\"100%\" height=\"100%\" class=\"association\">\n ${edgesResult.length ? edgesResult : ''}\n </svg>`\n }\n}\n"]}
@@ -1,3 +0,0 @@
1
- declare const _default: import("lit").CSSResult;
2
- export default _default;
3
- //# sourceMappingURL=WorkspaceStyles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorkspaceStyles.d.ts","sourceRoot":"","sources":["../../../../src/visualization/elements/WorkspaceStyles.ts"],"names":[],"mappings":";AAEA,wBAqKC"}