@finos/legend-extension-dsl-diagram 8.1.194 → 8.1.196

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 (95) hide show
  1. package/lib/components/DiagramRenderer.d.ts +39 -2
  2. package/lib/components/DiagramRenderer.d.ts.map +1 -1
  3. package/lib/components/DiagramRenderer.js +83 -61
  4. package/lib/components/DiagramRenderer.js.map +1 -1
  5. package/lib/components/DiagramViewer.d.ts +39 -0
  6. package/lib/components/DiagramViewer.d.ts.map +1 -0
  7. package/lib/components/DiagramViewer.js +170 -0
  8. package/lib/components/DiagramViewer.js.map +1 -0
  9. package/lib/components/DiagramViewerState.d.ts +44 -0
  10. package/lib/components/DiagramViewerState.d.ts.map +1 -0
  11. package/lib/components/DiagramViewerState.js +136 -0
  12. package/lib/components/DiagramViewerState.js.map +1 -0
  13. package/lib/components/index.d.ts +4 -1
  14. package/lib/components/index.d.ts.map +1 -1
  15. package/lib/components/index.js +4 -1
  16. package/lib/components/index.js.map +1 -1
  17. package/lib/graph-manager/index.d.ts +3 -0
  18. package/lib/graph-manager/index.d.ts.map +1 -1
  19. package/lib/graph-manager/index.js +3 -0
  20. package/lib/graph-manager/index.js.map +1 -1
  21. package/lib/index.css +2 -2
  22. package/lib/index.css.map +1 -1
  23. package/lib/index.d.ts +0 -1
  24. package/lib/index.d.ts.map +1 -1
  25. package/lib/index.js +0 -1
  26. package/lib/index.js.map +1 -1
  27. package/lib/package.json +1 -2
  28. package/package.json +3 -4
  29. package/src/components/DiagramRenderer.ts +221 -103
  30. package/src/components/DiagramViewer.tsx +650 -0
  31. package/src/components/DiagramViewerState.ts +171 -0
  32. package/src/components/index.ts +4 -0
  33. package/src/graph-manager/index.ts +3 -0
  34. package/src/index.ts +0 -1
  35. package/tsconfig.json +2 -12
  36. package/lib/__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.d.ts +0 -19
  37. package/lib/__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.d.ts.map +0 -1
  38. package/lib/__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.js +0 -20
  39. package/lib/__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.js.map +0 -1
  40. package/lib/__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.d.ts +0 -20
  41. package/lib/__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.d.ts.map +0 -1
  42. package/lib/__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.js +0 -81
  43. package/lib/__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.js.map +0 -1
  44. package/lib/__lib__/studio/DSL_Diagram_LegendStudioCommand.d.ts +0 -28
  45. package/lib/__lib__/studio/DSL_Diagram_LegendStudioCommand.d.ts.map +0 -1
  46. package/lib/__lib__/studio/DSL_Diagram_LegendStudioCommand.js +0 -62
  47. package/lib/__lib__/studio/DSL_Diagram_LegendStudioCommand.js.map +0 -1
  48. package/lib/__lib__/studio/DSL_Diagram_LegendStudioDocumentation.d.ts +0 -20
  49. package/lib/__lib__/studio/DSL_Diagram_LegendStudioDocumentation.d.ts.map +0 -1
  50. package/lib/__lib__/studio/DSL_Diagram_LegendStudioDocumentation.js +0 -21
  51. package/lib/__lib__/studio/DSL_Diagram_LegendStudioDocumentation.js.map +0 -1
  52. package/lib/__lib__/studio/DSL_Diagram_LegendStudioTesting.d.ts +0 -20
  53. package/lib/__lib__/studio/DSL_Diagram_LegendStudioTesting.d.ts.map +0 -1
  54. package/lib/__lib__/studio/DSL_Diagram_LegendStudioTesting.js +0 -21
  55. package/lib/__lib__/studio/DSL_Diagram_LegendStudioTesting.js.map +0 -1
  56. package/lib/components/studio/ClassDiagramPreview.d.ts +0 -22
  57. package/lib/components/studio/ClassDiagramPreview.d.ts.map +0 -1
  58. package/lib/components/studio/ClassDiagramPreview.js +0 -64
  59. package/lib/components/studio/ClassDiagramPreview.js.map +0 -1
  60. package/lib/components/studio/DSL_Diagram_LegendStudioApplicationPlugin.d.ts +0 -42
  61. package/lib/components/studio/DSL_Diagram_LegendStudioApplicationPlugin.d.ts.map +0 -1
  62. package/lib/components/studio/DSL_Diagram_LegendStudioApplicationPlugin.js +0 -216
  63. package/lib/components/studio/DSL_Diagram_LegendStudioApplicationPlugin.js.map +0 -1
  64. package/lib/components/studio/DiagramEditor.d.ts +0 -19
  65. package/lib/components/studio/DiagramEditor.d.ts.map +0 -1
  66. package/lib/components/studio/DiagramEditor.js +0 -436
  67. package/lib/components/studio/DiagramEditor.js.map +0 -1
  68. package/lib/components/studio/InheritanceDiagramRenderer.d.ts +0 -22
  69. package/lib/components/studio/InheritanceDiagramRenderer.d.ts.map +0 -1
  70. package/lib/components/studio/InheritanceDiagramRenderer.js +0 -34
  71. package/lib/components/studio/InheritanceDiagramRenderer.js.map +0 -1
  72. package/lib/components/studio/index.d.ts +0 -18
  73. package/lib/components/studio/index.d.ts.map +0 -1
  74. package/lib/components/studio/index.js +0 -18
  75. package/lib/components/studio/index.js.map +0 -1
  76. package/lib/stores/studio/DSL_Diagram_GraphModifierHelper.d.ts +0 -57
  77. package/lib/stores/studio/DSL_Diagram_GraphModifierHelper.d.ts.map +0 -1
  78. package/lib/stores/studio/DSL_Diagram_GraphModifierHelper.js +0 -94
  79. package/lib/stores/studio/DSL_Diagram_GraphModifierHelper.js.map +0 -1
  80. package/lib/stores/studio/DiagramEditorState.d.ts +0 -88
  81. package/lib/stores/studio/DiagramEditorState.d.ts.map +0 -1
  82. package/lib/stores/studio/DiagramEditorState.js +0 -341
  83. package/lib/stores/studio/DiagramEditorState.js.map +0 -1
  84. package/src/__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.ts +0 -19
  85. package/src/__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.ts +0 -88
  86. package/src/__lib__/studio/DSL_Diagram_LegendStudioCommand.ts +0 -64
  87. package/src/__lib__/studio/DSL_Diagram_LegendStudioDocumentation.ts +0 -20
  88. package/src/__lib__/studio/DSL_Diagram_LegendStudioTesting.ts +0 -20
  89. package/src/components/studio/ClassDiagramPreview.tsx +0 -83
  90. package/src/components/studio/DSL_Diagram_LegendStudioApplicationPlugin.tsx +0 -313
  91. package/src/components/studio/DiagramEditor.tsx +0 -1514
  92. package/src/components/studio/InheritanceDiagramRenderer.ts +0 -50
  93. package/src/components/studio/index.ts +0 -19
  94. package/src/stores/studio/DSL_Diagram_GraphModifierHelper.ts +0 -166
  95. package/src/stores/studio/DiagramEditorState.ts +0 -487
@@ -1,50 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { DiagramRenderer } from '../DiagramRenderer.js';
18
- import { uuid } from '@finos/legend-shared';
19
- import {
20
- type Class,
21
- PackageableElementExplicitReference,
22
- } from '@finos/legend-graph';
23
- import { Diagram } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_Diagram.js';
24
- import { ClassView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_ClassView.js';
25
-
26
- export class InheritanceDiagramRenderer extends DiagramRenderer {
27
- constructor(div: HTMLDivElement, _class: Class) {
28
- super(div, new Diagram(''));
29
- this.loadClass(_class);
30
- }
31
-
32
- loadClass(_class: Class): void {
33
- const cv = new ClassView(
34
- this.diagram,
35
- uuid(),
36
- PackageableElementExplicitReference.create(_class),
37
- );
38
-
39
- this.ensureClassViewMeetMinDimensions(cv);
40
-
41
- const result = this.layoutTaxonomy(
42
- this.getSuperTypeLevels([cv], this.diagram, 0, -1),
43
- this.diagram,
44
- true,
45
- true,
46
- );
47
- this.diagram.classViews = result[0];
48
- this.diagram.generalizationViews = result[1];
49
- }
50
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- export { DSL_Diagram_LegendStudioApplicationPlugin } from './DSL_Diagram_LegendStudioApplicationPlugin.js';
18
-
19
- export { DiagramEditorState } from '../../stores/studio/DiagramEditorState.js';
@@ -1,166 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { addUniqueEntry, changeEntry, deleteEntry } from '@finos/legend-shared';
18
- import { action } from 'mobx';
19
- import type { AssociationView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_AssociationView.js';
20
- import type { ClassView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_ClassView.js';
21
- import type { Diagram } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_Diagram.js';
22
- import type { GeneralizationView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_GeneralizationView.js';
23
- import {
24
- _findOrBuildPoint,
25
- _relationshipView_simplifyPath,
26
- _relationshipView_setPath,
27
- } from '../../graph/helpers/DSL_Diagram_Helper.js';
28
- import type { PropertyView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_PropertyView.js';
29
- import type { RelationshipViewEnd } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_RelationshipViewEnd.js';
30
- import type { RelationshipView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_RelationshipView.js';
31
- import type { Point } from '../../graph/metamodel/pure/packageableElements/diagram/geometry/DSL_Diagram_Point.js';
32
- import type { PositionedRectangle } from '../../graph/metamodel/pure/packageableElements/diagram/geometry/DSL_Diagram_PositionedRectangle.js';
33
- import type { Rectangle } from '../../graph/metamodel/pure/packageableElements/diagram/geometry/DSL_Diagram_Rectangle.js';
34
- import {
35
- observe_AssociationView,
36
- observe_ClassView,
37
- observe_GeneralizationView,
38
- observe_PropertyView,
39
- } from '../../graph-manager/action/changeDetection/DSL_Diagram_ObserverHelper.js';
40
-
41
- export const diagram_setClassViews = action(
42
- (diagram: Diagram, val: ClassView[]): void => {
43
- diagram.classViews = val.map(observe_ClassView);
44
- },
45
- );
46
- export const diagram_addClassView = action(
47
- (diagram: Diagram, val: ClassView): void => {
48
- addUniqueEntry(diagram.classViews, observe_ClassView(val));
49
- },
50
- );
51
- export const diagram_deleteClassView = action(
52
- (diagram: Diagram, val: ClassView): void => {
53
- deleteEntry(diagram.classViews, val);
54
- },
55
- );
56
- export const diagram_setAssociationViews = action(
57
- (diagram: Diagram, val: AssociationView[]): void => {
58
- diagram.associationViews = val.map(observe_AssociationView);
59
- },
60
- );
61
- export const diagram_deleteAssociationView = action(
62
- (diagram: Diagram, val: AssociationView): void => {
63
- deleteEntry(diagram.associationViews, val);
64
- },
65
- );
66
- export const diagram_setGeneralizationViews = action(
67
- (diagram: Diagram, val: GeneralizationView[]): void => {
68
- diagram.generalizationViews = val.map(observe_GeneralizationView);
69
- },
70
- );
71
- export const diagram_addGeneralizationView = action(
72
- (diagram: Diagram, val: GeneralizationView): void => {
73
- addUniqueEntry(
74
- diagram.generalizationViews,
75
- observe_GeneralizationView(val),
76
- );
77
- },
78
- );
79
- export const diagram_deleteGeneralizationView = action(
80
- (diagram: Diagram, val: GeneralizationView): void => {
81
- deleteEntry(diagram.generalizationViews, val);
82
- },
83
- );
84
- export const diagram_setPropertyViews = action(
85
- (diagram: Diagram, val: PropertyView[]): void => {
86
- diagram.propertyViews = val.map(observe_PropertyView);
87
- },
88
- );
89
- export const diagram_addPropertyView = action(
90
- (diagram: Diagram, val: PropertyView): void => {
91
- addUniqueEntry(diagram.propertyViews, observe_PropertyView(val));
92
- },
93
- );
94
- export const diagram_deletePropertyView = action(
95
- (diagram: Diagram, val: PropertyView): void => {
96
- deleteEntry(diagram.propertyViews, val);
97
- },
98
- );
99
-
100
- export const classView_setHideProperties = action(
101
- (cv: ClassView, val: boolean): void => {
102
- cv.hideProperties = val;
103
- },
104
- );
105
- export const classView_setHideStereotypes = action(
106
- (cv: ClassView, val: boolean): void => {
107
- cv.hideStereotypes = val;
108
- },
109
- );
110
- export const classView_setHideTaggedValues = action(
111
- (cv: ClassView, val: boolean): void => {
112
- cv.hideTaggedValues = val;
113
- },
114
- );
115
- export const relationshipEdgeView_setOffsetX = action(
116
- (r: RelationshipViewEnd, val: number): void => {
117
- r._offsetX = val;
118
- },
119
- );
120
- export const relationshipEdgeView_setOffsetY = action(
121
- (r: RelationshipViewEnd, val: number): void => {
122
- r._offsetY = val;
123
- },
124
- );
125
-
126
- // NOTE: To optimize performance, for now, we will not observe point (path)
127
- export const relationshipView_changePoint = action(
128
- (v: RelationshipView, val: Point, newVal: Point): void => {
129
- changeEntry(v.path, val, newVal);
130
- },
131
- );
132
-
133
- export const relationshipView_simplifyPath = action(
134
- _relationshipView_simplifyPath,
135
- );
136
-
137
- export const findOrBuildPoint = action(_findOrBuildPoint);
138
- export const relationshipView_setPath = action(_relationshipView_setPath);
139
-
140
- // NOTE: To optimize performance, for now, we will not observe rectangle
141
- export const positionedRectangle_setRectangle = action(
142
- (pR: PositionedRectangle, value: Rectangle): void => {
143
- pR.rectangle = value;
144
- },
145
- );
146
-
147
- // NOTE: To optimize performance, for now, we will not observe point (path)
148
- export const positionedRectangle_setPosition = action(
149
- (pR: PositionedRectangle, value: Point): void => {
150
- pR.position = value;
151
- },
152
- );
153
-
154
- /**
155
- * NOTE: Having `position` and `rectangle` as observables compromises the performance of diagram
156
- * so we want to have a way to refresh the hash for change detection to pick up new hash when we resize
157
- * the class view box or move it.
158
- *
159
- * We should re-consider the usefulness of this method, maybe it's more worthwhile to recompute hash
160
- * for the whole diagram instead?
161
- */
162
- export const positionedRectangle_forceRefreshHash = action(
163
- (pR: PositionedRectangle): void => {
164
- pR._dummyObservable = {};
165
- },
166
- );