@finos/legend-extension-dsl-diagram 1.0.36 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. package/lib/components/studio/DSLDiagram_CodeSnippets.d.ts +20 -0
  2. package/lib/components/studio/DSLDiagram_CodeSnippets.d.ts.map +1 -0
  3. package/lib/components/studio/DSLDiagram_CodeSnippets.js +81 -0
  4. package/lib/components/studio/DSLDiagram_CodeSnippets.js.map +1 -0
  5. package/lib/components/studio/DSLDiagram_LegendStudioDocumentation.d.ts +32 -0
  6. package/lib/components/studio/DSLDiagram_LegendStudioDocumentation.d.ts.map +1 -0
  7. package/lib/components/studio/DSLDiagram_LegendStudioDocumentation.js +33 -0
  8. package/lib/components/studio/DSLDiagram_LegendStudioDocumentation.js.map +1 -0
  9. package/lib/components/studio/DSLDiagram_LegendStudioPlugin.d.ts +8 -2
  10. package/lib/components/studio/DSLDiagram_LegendStudioPlugin.d.ts.map +1 -1
  11. package/lib/components/studio/DSLDiagram_LegendStudioPlugin.js +70 -1
  12. package/lib/components/studio/DSLDiagram_LegendStudioPlugin.js.map +1 -1
  13. package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.d.ts +2 -0
  14. package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.d.ts.map +1 -1
  15. package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.js +2 -2
  16. package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.js.map +1 -1
  17. package/lib/index.css +1 -1
  18. package/lib/package.json +12 -9
  19. package/package.json +19 -16
  20. package/src/components/studio/DSLDiagram_CodeSnippets.ts +88 -0
  21. package/src/components/studio/DSLDiagram_LegendStudioDocumentation.ts +33 -0
  22. package/src/components/studio/DSLDiagram_LegendStudioPlugin.tsx +114 -1
  23. package/src/graphManager/DSLDiagram_PureGraphManagerPlugin.ts +2 -2
  24. package/tsconfig.json +2 -0
@@ -0,0 +1,20 @@
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
+ export declare const EMPTY_DIAGRAM_SNIPPET = "Diagram ${1:model::NewDiagram}\n{\n ${2:// diagram content: it is highly recommended to create diagrams using\n // diagram editor as it gives better visual guidance and less error-prone}\n}";
17
+ export declare const getDiagramSnippetWithOneClassView: () => string;
18
+ export declare const getDiagramSnippetWithPropertyView: () => string;
19
+ export declare const getDiagramSnippetWithGeneralizationView: () => string;
20
+ //# sourceMappingURL=DSLDiagram_CodeSnippets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DSLDiagram_CodeSnippets.d.ts","sourceRoot":"","sources":["../../../src/components/studio/DSLDiagram_CodeSnippets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,eAAO,MAAM,qBAAqB,oMAGhC,CAAC;AAEH,eAAO,MAAM,iCAAiC,QACxC,MAQJ,CAAC;AAEH,eAAO,MAAM,iCAAiC,QAAO,MA0BpD,CAAC;AAEF,eAAO,MAAM,uCAAuC,QAAO,MAyB1D,CAAC"}
@@ -0,0 +1,81 @@
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
+ import { uuid } from '@finos/legend-shared';
17
+ export const EMPTY_DIAGRAM_SNIPPET = `Diagram \${1:model::NewDiagram}
18
+ {
19
+ \${2:// diagram content: it is highly recommended to create diagrams using\n // diagram editor as it gives better visual guidance and less error-prone}
20
+ }`;
21
+ export const getDiagramSnippetWithOneClassView = () => `Diagram \${1:model::NewDiagram}
22
+ {
23
+ classView ${uuid()}
24
+ {
25
+ class: \${2:model::SomeClass};
26
+ position: (0.0,0.0);
27
+ rectangle: (10.0, 10.0);
28
+ }
29
+ }`;
30
+ export const getDiagramSnippetWithPropertyView = () => {
31
+ const classId1 = uuid();
32
+ const classId2 = uuid();
33
+ return `Diagram \${1:model::NewDiagram}
34
+ {
35
+ classView ${classId1}
36
+ {
37
+ class: \${2:model::Class1};
38
+ position: (0.0,0.0);
39
+ rectangle: (10.0, 10.0);
40
+ }
41
+ classView ${classId2}
42
+ {
43
+ class: \${3:model::Class2};
44
+ position: (0.0,0.0);
45
+ rectangle: (10.0, 10.0);
46
+ }
47
+ propertyView
48
+ {
49
+ property: \${4:model::Class1.prop1};
50
+ source: ${classId1};
51
+ target: ${classId2};
52
+ points: [];
53
+ }
54
+ }`;
55
+ };
56
+ export const getDiagramSnippetWithGeneralizationView = () => {
57
+ const classId1 = uuid();
58
+ const classId2 = uuid();
59
+ return `Diagram \${1:model::NewDiagram}
60
+ {
61
+ classView ${classId1}
62
+ {
63
+ class: \${2:model::Class1};
64
+ position: (0.0,0.0);
65
+ rectangle: (10.0, 10.0);
66
+ }
67
+ classView ${classId2}
68
+ {
69
+ class: \${3:model::Class2};
70
+ position: (0.0,0.0);
71
+ rectangle: (10.0, 10.0);
72
+ }
73
+ generalizationView
74
+ {
75
+ source: ${classId1};
76
+ target: ${classId2};
77
+ points: [];
78
+ }
79
+ }`;
80
+ };
81
+ //# sourceMappingURL=DSLDiagram_CodeSnippets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DSLDiagram_CodeSnippets.js","sourceRoot":"","sources":["../../../src/components/studio/DSLDiagram_CodeSnippets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;EAGnC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAC5C,GAAW,EAAE,CAAC;;cAEF,IAAI,EAAE;;;;;;EAMlB,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAW,EAAE;IAC5D,MAAM,QAAQ,GAAG,IAAI,EAAE,CAAC;IACxB,MAAM,QAAQ,GAAG,IAAI,EAAE,CAAC;IAExB,OAAO;;cAEK,QAAQ;;;;;;cAMR,QAAQ;;;;;;;;;cASR,QAAQ;cACR,QAAQ;;;EAGpB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAW,EAAE;IAClE,MAAM,QAAQ,GAAG,IAAI,EAAE,CAAC;IACxB,MAAM,QAAQ,GAAG,IAAI,EAAE,CAAC;IAExB,OAAO;;cAEK,QAAQ;;;;;;cAMR,QAAQ;;;;;;;;cAQR,QAAQ;cACR,QAAQ;;;EAGpB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,32 @@
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
+ export declare enum DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY {
17
+ GRAMMAR_PARSER = "dsl-diagram__grammar-parser",
18
+ GRAMMAR_DIAGRAM_ELEMENT = "dsl-diagram__grammar-diagram-element"
19
+ }
20
+ export declare const DSL_DIAGRAM_DOCUMENTATION_ENTRIES: {
21
+ "dsl-diagram__grammar-parser": {
22
+ markdownText: {
23
+ value: string;
24
+ };
25
+ };
26
+ "dsl-diagram__grammar-diagram-element": {
27
+ markdownText: {
28
+ value: string;
29
+ };
30
+ };
31
+ };
32
+ //# sourceMappingURL=DSLDiagram_LegendStudioDocumentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DSLDiagram_LegendStudioDocumentation.d.ts","sourceRoot":"","sources":["../../../src/components/studio/DSLDiagram_LegendStudioDocumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,oBAAY,2CAA2C;IACrD,cAAc,gCAAgC;IAC9C,uBAAuB,yCAAyC;CACjE;AAED,eAAO,MAAM,iCAAiC;;;;;;;;;;;CAW7C,CAAC"}
@@ -0,0 +1,33 @@
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
+ export var DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY;
17
+ (function (DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY) {
18
+ DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY["GRAMMAR_PARSER"] = "dsl-diagram__grammar-parser";
19
+ DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY["GRAMMAR_DIAGRAM_ELEMENT"] = "dsl-diagram__grammar-diagram-element";
20
+ })(DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY || (DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY = {}));
21
+ export const DSL_DIAGRAM_DOCUMENTATION_ENTRIES = {
22
+ [DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER]: {
23
+ markdownText: {
24
+ value: `DSL Diagram (\`###Diagram\`) concerns with visualizing data models and their relationship`,
25
+ },
26
+ },
27
+ [DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_DIAGRAM_ELEMENT]: {
28
+ markdownText: {
29
+ value: `A diagram element specifies the visualization/rendering of data models and their relationship`,
30
+ },
31
+ },
32
+ };
33
+ //# sourceMappingURL=DSLDiagram_LegendStudioDocumentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DSLDiagram_LegendStudioDocumentation.js","sourceRoot":"","sources":["../../../src/components/studio/DSLDiagram_LegendStudioDocumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAN,IAAY,2CAGX;AAHD,WAAY,2CAA2C;IACrD,6FAA8C,CAAA;IAC9C,+GAAgE,CAAA;AAClE,CAAC,EAHW,2CAA2C,KAA3C,2CAA2C,QAGtD;AAED,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,CAAC,2CAA2C,CAAC,cAAc,CAAC,EAAE;QAC5D,YAAY,EAAE;YACZ,KAAK,EAAE,2FAA2F;SACnG;KACF;IACD,CAAC,2CAA2C,CAAC,uBAAuB,CAAC,EAAE;QACrE,YAAY,EAAE;YACZ,KAAK,EAAE,+FAA+F;SACvG;KACF;CACF,CAAC"}
@@ -13,9 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { LegendStudioPlugin, type NewElementFromStateCreator, type ElementEditorStateCreator, type ElementTypeGetter, type ElementProjectExplorerDnDTypeGetter, type ElementIconGetter, type ElementEditorRenderer, type DSL_LegendStudioPlugin_Extension, type ElementEditorPostDeleteAction, type ElementEditorPostRenameAction, type ClassPreviewRenderer } from '@finos/legend-studio';
16
+ import { LegendStudioPlugin, type NewElementFromStateCreator, type ElementEditorStateCreator, type ElementTypeGetter, type ElementProjectExplorerDnDTypeGetter, type ElementIconGetter, type ElementEditorRenderer, type DSL_LegendStudioPlugin_Extension, type ElementEditorPostDeleteAction, type ElementEditorPostRenameAction, type ClassPreviewRenderer, type PureGrammarParserDocumentationGetter, type PureGrammarParserElementDocumentationGetter, type PureGrammarParserKeywordSuggestionGetter, type PureGrammarParserElementSnippetSuggestionsGetter } from '@finos/legend-studio';
17
+ import { type LegendApplicationKeyedDocumentationEntry } from '@finos/legend-application';
17
18
  export declare class DSLDiagram_LegendStudioPlugin extends LegendStudioPlugin implements DSL_LegendStudioPlugin_Extension {
18
19
  constructor();
20
+ getExtraKeyedDocumentationEntries(): LegendApplicationKeyedDocumentationEntry[];
19
21
  getExtraClassPreviewRenderers(): ClassPreviewRenderer[];
20
22
  getExtraSupportedElementTypes(): string[];
21
23
  getExtraElementTypeGetters(): ElementTypeGetter[];
@@ -24,8 +26,12 @@ export declare class DSLDiagram_LegendStudioPlugin extends LegendStudioPlugin im
24
26
  getExtraNewElementFromStateCreators(): NewElementFromStateCreator[];
25
27
  getExtraElementEditorStateCreators(): ElementEditorStateCreator[];
26
28
  getExtraElementProjectExplorerDnDTypeGetters(): ElementProjectExplorerDnDTypeGetter[];
27
- getExtraGrammarTextEditorDnDTypes(): string[];
29
+ getExtraPureGrammarTextEditorDnDTypes(): string[];
28
30
  getExtraElementEditorPostRenameActions(): ElementEditorPostRenameAction[];
29
31
  getExtraElementEditorPostDeleteActions(): ElementEditorPostDeleteAction[];
32
+ getExtraPureGrammarParserElementDocumentationGetters(): PureGrammarParserElementDocumentationGetter[];
33
+ getExtraPureGrammarParserDocumentationGetters(): PureGrammarParserDocumentationGetter[];
34
+ getExtraPureGrammarParserKeywordSuggestionGetters(): PureGrammarParserKeywordSuggestionGetter[];
35
+ getExtraPureGrammarParserElementSnippetSuggestionsGetters(): PureGrammarParserElementSnippetSuggestionsGetter[];
30
36
  }
31
37
  //# sourceMappingURL=DSLDiagram_LegendStudioPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DSLDiagram_LegendStudioPlugin.d.ts","sourceRoot":"","sources":["../../../src/components/studio/DSLDiagram_LegendStudioPlugin.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,kBAAkB,EAClB,KAAK,0BAA0B,EAG/B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,mCAAmC,EACxC,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EAErC,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAW9B,qBAAa,6BACX,SAAQ,kBACR,YAAW,gCAAgC;;IAMlC,6BAA6B,IAAI,oBAAoB,EAAE;IAQhE,6BAA6B,IAAI,MAAM,EAAE;IAIzC,0BAA0B,IAAI,iBAAiB,EAAE;IAWjD,0BAA0B,IAAI,iBAAiB,EAAE;IAejD,8BAA8B,IAAI,qBAAqB,EAAE;IAWzD,mCAAmC,IAAI,0BAA0B,EAAE;IAenE,kCAAkC,IAAI,yBAAyB,EAAE;IAcjE,4CAA4C,IAAI,mCAAmC,EAAE;IAWrF,iCAAiC,IAAI,MAAM,EAAE;IAI7C,sCAAsC,IAAI,6BAA6B,EAAE;IAWzE,sCAAsC,IAAI,6BAA6B,EAAE;CAU1E"}
1
+ {"version":3,"file":"DSLDiagram_LegendStudioPlugin.d.ts","sourceRoot":"","sources":["../../../src/components/studio/DSLDiagram_LegendStudioPlugin.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,kBAAkB,EAClB,KAAK,0BAA0B,EAG/B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,mCAAmC,EACxC,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EAErC,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,oCAAoC,EACzC,KAAK,2CAA2C,EAChD,KAAK,wCAAwC,EAE7C,KAAK,gDAAgD,EACtD,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EAEL,KAAK,wCAAwC,EAE9C,MAAM,2BAA2B,CAAC;AAmBnC,qBAAa,6BACX,SAAQ,kBACR,YAAW,gCAAgC;;IAMlC,iCAAiC,IAAI,wCAAwC,EAAE;IAM/E,6BAA6B,IAAI,oBAAoB,EAAE;IAQhE,6BAA6B,IAAI,MAAM,EAAE;IAIzC,0BAA0B,IAAI,iBAAiB,EAAE;IAWjD,0BAA0B,IAAI,iBAAiB,EAAE;IAejD,8BAA8B,IAAI,qBAAqB,EAAE;IAWzD,mCAAmC,IAAI,0BAA0B,EAAE;IAenE,kCAAkC,IAAI,yBAAyB,EAAE;IAcjE,4CAA4C,IAAI,mCAAmC,EAAE;IAWrF,qCAAqC,IAAI,MAAM,EAAE;IAIjD,sCAAsC,IAAI,6BAA6B,EAAE;IAWzE,sCAAsC,IAAI,6BAA6B,EAAE;IAWzE,oDAAoD,IAAI,2CAA2C,EAAE;IAmBrG,6CAA6C,IAAI,oCAAoC,EAAE;IAgBvF,iDAAiD,IAAI,wCAAwC,EAAE;IAe/F,yDAAyD,IAAI,gDAAgD,EAAE;CAgChH"}
@@ -21,12 +21,19 @@ import { Diagram } from '../../models/metamodels/pure/packageableElements/diagra
21
21
  import { DiagramEditorState } from '../../stores/studio/DiagramEditorState';
22
22
  import { DiagramEditor } from './DiagramEditor';
23
23
  import { ClassDiagramPreview } from './ClassDiagramPreview';
24
+ import { collectKeyedDocumnetationEntriesFromConfig, } from '@finos/legend-application';
25
+ import { PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL, PURE_GRAMMAR_DIAGRAM_PARSER_NAME, } from '../../graphManager/DSLDiagram_PureGraphManagerPlugin';
26
+ import { DSL_DIAGRAM_DOCUMENTATION_ENTRIES, DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY, } from './DSLDiagram_LegendStudioDocumentation';
27
+ import { EMPTY_DIAGRAM_SNIPPET, getDiagramSnippetWithGeneralizationView, getDiagramSnippetWithOneClassView, getDiagramSnippetWithPropertyView, } from './DSLDiagram_CodeSnippets';
24
28
  const DIAGRAM_ELEMENT_TYPE = 'DIAGRAM';
25
29
  const DIAGRAM_ELEMENT_PROJECT_EXPLORER_DND_TYPE = 'PROJECT_EXPLORER_DIAGRAM';
26
30
  export class DSLDiagram_LegendStudioPlugin extends LegendStudioPlugin {
27
31
  constructor() {
28
32
  super(packageJson.extensions.studioPlugin, packageJson.version);
29
33
  }
34
+ getExtraKeyedDocumentationEntries() {
35
+ return collectKeyedDocumnetationEntriesFromConfig(DSL_DIAGRAM_DOCUMENTATION_ENTRIES);
36
+ }
30
37
  getExtraClassPreviewRenderers() {
31
38
  return [
32
39
  (_class) => (_jsx(ClassDiagramPreview, { _class: _class })),
@@ -95,7 +102,7 @@ export class DSLDiagram_LegendStudioPlugin extends LegendStudioPlugin {
95
102
  },
96
103
  ];
97
104
  }
98
- getExtraGrammarTextEditorDnDTypes() {
105
+ getExtraPureGrammarTextEditorDnDTypes() {
99
106
  return [DIAGRAM_ELEMENT_PROJECT_EXPLORER_DND_TYPE];
100
107
  }
101
108
  getExtraElementEditorPostRenameActions() {
@@ -118,5 +125,67 @@ export class DSLDiagram_LegendStudioPlugin extends LegendStudioPlugin {
118
125
  },
119
126
  ];
120
127
  }
128
+ getExtraPureGrammarParserElementDocumentationGetters() {
129
+ return [
130
+ (editorStore, parserKeyword, elementKeyword) => {
131
+ if (parserKeyword === PURE_GRAMMAR_DIAGRAM_PARSER_NAME) {
132
+ if (elementKeyword === PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL) {
133
+ return editorStore.applicationStore.docRegistry.getEntry(DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_DIAGRAM_ELEMENT);
134
+ }
135
+ }
136
+ return undefined;
137
+ },
138
+ ];
139
+ }
140
+ getExtraPureGrammarParserDocumentationGetters() {
141
+ return [
142
+ (editorStore, parserKeyword) => {
143
+ if (parserKeyword === PURE_GRAMMAR_DIAGRAM_PARSER_NAME) {
144
+ return editorStore.applicationStore.docRegistry.getEntry(DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER);
145
+ }
146
+ return undefined;
147
+ },
148
+ ];
149
+ }
150
+ getExtraPureGrammarParserKeywordSuggestionGetters() {
151
+ return [
152
+ (editorStore) => [
153
+ {
154
+ text: PURE_GRAMMAR_DIAGRAM_PARSER_NAME,
155
+ description: `(dsl)`,
156
+ documentation: editorStore.applicationStore.docRegistry.getEntry(DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER),
157
+ insertText: PURE_GRAMMAR_DIAGRAM_PARSER_NAME,
158
+ },
159
+ ],
160
+ ];
161
+ }
162
+ getExtraPureGrammarParserElementSnippetSuggestionsGetters() {
163
+ return [
164
+ (editorStore, parserKeyword) => parserKeyword === PURE_GRAMMAR_DIAGRAM_PARSER_NAME
165
+ ? [
166
+ {
167
+ text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
168
+ description: '(blank)',
169
+ insertText: EMPTY_DIAGRAM_SNIPPET,
170
+ },
171
+ {
172
+ text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
173
+ description: 'with class',
174
+ insertText: getDiagramSnippetWithOneClassView(),
175
+ },
176
+ {
177
+ text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
178
+ description: 'with inheritance',
179
+ insertText: getDiagramSnippetWithGeneralizationView(),
180
+ },
181
+ {
182
+ text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
183
+ description: 'with composition',
184
+ insertText: getDiagramSnippetWithPropertyView(),
185
+ },
186
+ ]
187
+ : undefined,
188
+ ];
189
+ }
121
190
  }
122
191
  //# sourceMappingURL=DSLDiagram_LegendStudioPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DSLDiagram_LegendStudioPlugin.js","sourceRoot":"","sources":["../../../src/components/studio/DSLDiagram_LegendStudioPlugin.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,kBAAkB,GAcnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,6EAA6E,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,oBAAoB,GAAG,SAAS,CAAC;AACvC,MAAM,yCAAyC,GAAG,0BAA0B,CAAC;AAE7E,MAAM,OAAO,6BACX,SAAQ,kBAAkB;IAG1B;QACE,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;IAEQ,6BAA6B;QACpC,OAAO;YACL,CAAC,MAAa,EAAmB,EAAE,CAAC,CAClC,KAAC,mBAAmB,IAAC,MAAM,EAAE,MAAM,GAAI,CACxC;SACF,CAAC;IACJ,CAAC;IAED,6BAA6B;QAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAChC,CAAC;IAED,0BAA0B;QACxB,OAAO;YACL,CAAC,OAA2B,EAAsB,E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CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC;IAED,iCAAiC;QAC/B,OAAO,CAAC,yCAAyC,CAAC,CAAC;IACrD,CAAC;IAED,sCAAsC;QACpC,OAAO;YACL,CAAC,WAAwB,EAAE,OAA2B,EAAQ,EAAE;gBAC9D,oCAAoC;gBACpC,IAAI,WAAW,CAAC,kBAAkB,YAAY,kBAAkB,EAAE;oBAChE,WAAW,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;iBAClD;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IAED,sCAAsC;QACpC,OAAO;YACL,CAAC,WAAwB,EAAE,OAA2B,EAAQ,EAAE;gBAC9D,oCAAoC;gBACpC,IAAI,WAAW,CAAC,kBAAkB,YAAY,kBAAkB,EAAE;oBAChE,WAAW,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;iBAClD;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"DSLDiagram_LegendStudioPlugin.js","sourceRoot":"","sources":["../../../src/components/studio/DSLDiagram_LegendStudioPlugin.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,kBAAkB,GAmBnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,6EAA6E,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAGL,0CAA0C,GAC3C,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,uCAAuC,EACvC,gCAAgC,GACjC,MAAM,sDAAsD,CAAC;AAC9D,OAA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AAY;wBACzB,UAAU,EAAE,iCAAiC,EAAE;qBAChD;oBACD;wBACE,IAAI,EAAE,uCAAuC;wBAC7C,WAAW,EAAE,kBAAkB;wBAC/B,UAAU,EAAE,uCAAuC,EAAE;qBACtD;oBACD;wBACE,IAAI,EAAE,uCAAuC;wBAC7C,WAAW,EAAE,kBAAkB;wBAC/B,UAAU,EAAE,iCAAiC,EAAE;qBAChD;iBACF;gBACH,CAAC,CAAC,SAAS;SAChB,CAAC;IACJ,CAAC;CACF"}
@@ -14,6 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { PureGraphManagerPlugin, type ElementObserver, type PureGrammarElementLabeler } from '@finos/legend-graph';
17
+ export declare const PURE_GRAMMAR_DIAGRAM_PARSER_NAME = "Diagram";
18
+ export declare const PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL = "Diagram";
17
19
  export declare class DSLDiagram_PureGraphManagerPlugin extends PureGraphManagerPlugin {
18
20
  constructor();
19
21
  getExtraPureGrammarParserNames(): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"DSLDiagram_PureGraphManagerPlugin.d.ts","sourceRoot":"","sources":["../../src/graphManager/DSLDiagram_PureGraphManagerPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,sBAAsB,EAEtB,KAAK,eAAe,EAEpB,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAO7B,qBAAa,iCAAkC,SAAQ,sBAAsB;;IAKlE,8BAA8B,IAAI,MAAM,EAAE;IAI1C,2BAA2B,IAAI,MAAM,EAAE;IAIvC,kCAAkC,IAAI,yBAAyB,EAAE;IAWjE,wBAAwB,IAAI,eAAe,EAAE;CAavD"}
1
+ {"version":3,"file":"DSLDiagram_PureGraphManagerPlugin.d.ts","sourceRoot":"","sources":["../../src/graphManager/DSLDiagram_PureGraphManagerPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,sBAAsB,EAEtB,KAAK,eAAe,EAEpB,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,gCAAgC,YAAY,CAAC;AAC1D,eAAO,MAAM,uCAAuC,YAAY,CAAC;AAEjE,qBAAa,iCAAkC,SAAQ,sBAAsB;;IAKlE,8BAA8B,IAAI,MAAM,EAAE;IAI1C,2BAA2B,IAAI,MAAM,EAAE;IAIvC,kCAAkC,IAAI,yBAAyB,EAAE;IAWjE,wBAAwB,IAAI,eAAe,EAAE;CAavD"}
@@ -17,8 +17,8 @@ import packageJson from '../../package.json';
17
17
  import { PureGraphManagerPlugin, } from '@finos/legend-graph';
18
18
  import { Diagram } from '../models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram';
19
19
  import { observe_Diagram } from './action/changeDetection/DSLDiagram_ObserverHelper';
20
- const PURE_GRAMMAR_DIAGRAM_PARSER_NAME = 'Diagram';
21
- const PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL = 'Diagram';
20
+ export const PURE_GRAMMAR_DIAGRAM_PARSER_NAME = 'Diagram';
21
+ export const PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL = 'Diagram';
22
22
  export class DSLDiagram_PureGraphManagerPlugin extends PureGraphManagerPlugin {
23
23
  constructor() {
24
24
  super(packageJson.extensions.pureGraphManagerPlugin, packageJson.version);
@@ -1 +1 @@
1
- {"version":3,"file":"DSLDiagram_PureGraphManagerPlugin.js","sourceRoot":"","sources":["../../src/graphManager/DSLDiagram_PureGraphManagerPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EACL,sBAAsB,GAKvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,0EAA0E,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AAErF,MAAM,gCAAg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,sBAAsB;IAC3E;QACE,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,sBAAsB,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5E,CAAC;IAEQ,8BAA8B;QACrC,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAC5C,CAAC;IAEQ,2BAA2B;QAClC,OAAO,CAAC,uCAAuC,CAAC,CAAC;IACnD,CAAC;IAEQ,kCAAkC;QACzC,OAAO;YACL,CAAC,OAA2B,EAAsB,EAAE;gBAClD,IAAI,OAAO,YAAY,OAAO,EAAE;oBAC9B,OAAO,uCAAuC,CAAC;iBAChD;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC;IAEQ,wBAAwB;QAC/B,OAAO;YACL,CACE,OAA2B,EAC3B,OAAwB,EACQ,EAAE;gBAClC,IAAI,OAAO,YAAY,OAAO,EAAE;oBAC9B,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;iBACjC;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
package/lib/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /** @license @finos/legend-extension-dsl-diagram v1.0.36
1
+ /** @license @finos/legend-extension-dsl-diagram v2.0.0
2
2
  * Copyright (c) 2020-present, Goldman Sachs
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-extension-dsl-diagram",
3
- "version": "1.0.36",
3
+ "version": "2.0.0",
4
4
  "description": "Legend extension for Diagram DSL",
5
5
  "keywords": [
6
6
  "legend",
@@ -20,7 +20,10 @@
20
20
  "license": "Apache-2.0",
21
21
  "sideEffects": false,
22
22
  "type": "module",
23
- "main": "lib/index.js",
23
+ "exports": {
24
+ ".": "./lib/index.js",
25
+ "./lib/index.css": "./lib/index.css"
26
+ },
24
27
  "module": "lib/index.js",
25
28
  "types": "lib/index.d.ts",
26
29
  "scripts": {
@@ -46,7 +49,7 @@
46
49
  "@finos/legend-model-storage": "workspace:*",
47
50
  "@finos/legend-shared": "workspace:*",
48
51
  "@finos/legend-studio": "workspace:*",
49
- "@types/react": "17.0.43",
52
+ "@types/react": "17.0.44",
50
53
  "mobx": "6.5.0",
51
54
  "mobx-react-lite": "3.3.0",
52
55
  "react": "17.0.2",
@@ -57,15 +60,15 @@
57
60
  },
58
61
  "devDependencies": {
59
62
  "@finos/legend-dev-utils": "workspace:*",
60
- "@testing-library/react": "12.1.4",
63
+ "@testing-library/react": "12.1.5",
61
64
  "cross-env": "7.0.3",
62
- "eslint": "8.13.0",
63
- "jest": "27.5.1",
64
- "jest-canvas-mock": "2.3.1",
65
+ "eslint": "8.14.0",
66
+ "jest": "28.0.3",
67
+ "jest-canvas-mock": "2.4.0",
65
68
  "npm-run-all": "4.1.5",
66
69
  "rimraf": "3.0.2",
67
- "sass": "1.50.1",
68
- "typescript": "4.6.3"
70
+ "sass": "1.51.0",
71
+ "typescript": "4.6.4"
69
72
  },
70
73
  "peerDependencies": {
71
74
  "react": "^17.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-extension-dsl-diagram",
3
- "version": "1.0.36",
3
+ "version": "2.0.0",
4
4
  "description": "Legend extension for Diagram DSL",
5
5
  "keywords": [
6
6
  "legend",
@@ -20,7 +20,10 @@
20
20
  "license": "Apache-2.0",
21
21
  "sideEffects": false,
22
22
  "type": "module",
23
- "main": "lib/index.js",
23
+ "exports": {
24
+ ".": "./lib/index.js",
25
+ "./lib/index.css": "./lib/index.css"
26
+ },
24
27
  "module": "lib/index.js",
25
28
  "types": "lib/index.d.ts",
26
29
  "scripts": {
@@ -40,13 +43,13 @@
40
43
  "test:watch": "jest --watch"
41
44
  },
42
45
  "dependencies": {
43
- "@finos/legend-application": "2.0.14",
44
- "@finos/legend-art": "0.3.18",
45
- "@finos/legend-graph": "5.0.0",
46
- "@finos/legend-model-storage": "0.0.30",
47
- "@finos/legend-shared": "1.3.1",
48
- "@finos/legend-studio": "8.0.0",
49
- "@types/react": "17.0.43",
46
+ "@finos/legend-application": "3.0.0",
47
+ "@finos/legend-art": "1.0.0",
48
+ "@finos/legend-graph": "6.0.0",
49
+ "@finos/legend-model-storage": "1.0.0",
50
+ "@finos/legend-shared": "2.0.0",
51
+ "@finos/legend-studio": "9.0.0",
52
+ "@types/react": "17.0.44",
50
53
  "mobx": "6.5.0",
51
54
  "mobx-react-lite": "3.3.0",
52
55
  "react": "17.0.2",
@@ -56,16 +59,16 @@
56
59
  "serializr": "2.0.5"
57
60
  },
58
61
  "devDependencies": {
59
- "@finos/legend-dev-utils": "0.3.21",
60
- "@testing-library/react": "12.1.4",
62
+ "@finos/legend-dev-utils": "1.0.0",
63
+ "@testing-library/react": "12.1.5",
61
64
  "cross-env": "7.0.3",
62
- "eslint": "8.13.0",
63
- "jest": "27.5.1",
64
- "jest-canvas-mock": "2.3.1",
65
+ "eslint": "8.14.0",
66
+ "jest": "28.0.3",
67
+ "jest-canvas-mock": "2.4.0",
65
68
  "npm-run-all": "4.1.5",
66
69
  "rimraf": "3.0.2",
67
- "sass": "1.50.1",
68
- "typescript": "4.6.3"
70
+ "sass": "1.51.0",
71
+ "typescript": "4.6.4"
69
72
  },
70
73
  "peerDependencies": {
71
74
  "react": "^17.0.0"
@@ -0,0 +1,88 @@
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 { uuid } from '@finos/legend-shared';
18
+
19
+ export const EMPTY_DIAGRAM_SNIPPET = `Diagram \${1:model::NewDiagram}
20
+ {
21
+ \${2:// diagram content: it is highly recommended to create diagrams using\n // diagram editor as it gives better visual guidance and less error-prone}
22
+ }`;
23
+
24
+ export const getDiagramSnippetWithOneClassView =
25
+ (): string => `Diagram \${1:model::NewDiagram}
26
+ {
27
+ classView ${uuid()}
28
+ {
29
+ class: \${2:model::SomeClass};
30
+ position: (0.0,0.0);
31
+ rectangle: (10.0, 10.0);
32
+ }
33
+ }`;
34
+
35
+ export const getDiagramSnippetWithPropertyView = (): string => {
36
+ const classId1 = uuid();
37
+ const classId2 = uuid();
38
+
39
+ return `Diagram \${1:model::NewDiagram}
40
+ {
41
+ classView ${classId1}
42
+ {
43
+ class: \${2:model::Class1};
44
+ position: (0.0,0.0);
45
+ rectangle: (10.0, 10.0);
46
+ }
47
+ classView ${classId2}
48
+ {
49
+ class: \${3:model::Class2};
50
+ position: (0.0,0.0);
51
+ rectangle: (10.0, 10.0);
52
+ }
53
+ propertyView
54
+ {
55
+ property: \${4:model::Class1.prop1};
56
+ source: ${classId1};
57
+ target: ${classId2};
58
+ points: [];
59
+ }
60
+ }`;
61
+ };
62
+
63
+ export const getDiagramSnippetWithGeneralizationView = (): string => {
64
+ const classId1 = uuid();
65
+ const classId2 = uuid();
66
+
67
+ return `Diagram \${1:model::NewDiagram}
68
+ {
69
+ classView ${classId1}
70
+ {
71
+ class: \${2:model::Class1};
72
+ position: (0.0,0.0);
73
+ rectangle: (10.0, 10.0);
74
+ }
75
+ classView ${classId2}
76
+ {
77
+ class: \${3:model::Class2};
78
+ position: (0.0,0.0);
79
+ rectangle: (10.0, 10.0);
80
+ }
81
+ generalizationView
82
+ {
83
+ source: ${classId1};
84
+ target: ${classId2};
85
+ points: [];
86
+ }
87
+ }`;
88
+ };
@@ -0,0 +1,33 @@
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 enum DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY {
18
+ GRAMMAR_PARSER = 'dsl-diagram__grammar-parser',
19
+ GRAMMAR_DIAGRAM_ELEMENT = 'dsl-diagram__grammar-diagram-element',
20
+ }
21
+
22
+ export const DSL_DIAGRAM_DOCUMENTATION_ENTRIES = {
23
+ [DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER]: {
24
+ markdownText: {
25
+ value: `DSL Diagram (\`###Diagram\`) concerns with visualizing data models and their relationship`,
26
+ },
27
+ },
28
+ [DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_DIAGRAM_ELEMENT]: {
29
+ markdownText: {
30
+ value: `A diagram element specifies the visualization/rendering of data models and their relationship`,
31
+ },
32
+ },
33
+ };
@@ -30,6 +30,11 @@ import {
30
30
  type ElementEditorPostDeleteAction,
31
31
  type ElementEditorPostRenameAction,
32
32
  type ClassPreviewRenderer,
33
+ type PureGrammarParserDocumentationGetter,
34
+ type PureGrammarParserElementDocumentationGetter,
35
+ type PureGrammarParserKeywordSuggestionGetter,
36
+ type PureGrammarTextSuggestion,
37
+ type PureGrammarParserElementSnippetSuggestionsGetter,
33
38
  } from '@finos/legend-studio';
34
39
  import { ShapesIcon } from '@finos/legend-art';
35
40
  import type { Class, PackageableElement } from '@finos/legend-graph';
@@ -37,6 +42,25 @@ import { Diagram } from '../../models/metamodels/pure/packageableElements/diagra
37
42
  import { DiagramEditorState } from '../../stores/studio/DiagramEditorState';
38
43
  import { DiagramEditor } from './DiagramEditor';
39
44
  import { ClassDiagramPreview } from './ClassDiagramPreview';
45
+ import {
46
+ type LegendApplicationDocumentationEntry,
47
+ type LegendApplicationKeyedDocumentationEntry,
48
+ collectKeyedDocumnetationEntriesFromConfig,
49
+ } from '@finos/legend-application';
50
+ import {
51
+ PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
52
+ PURE_GRAMMAR_DIAGRAM_PARSER_NAME,
53
+ } from '../../graphManager/DSLDiagram_PureGraphManagerPlugin';
54
+ import {
55
+ DSL_DIAGRAM_DOCUMENTATION_ENTRIES,
56
+ DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY,
57
+ } from './DSLDiagram_LegendStudioDocumentation';
58
+ import {
59
+ EMPTY_DIAGRAM_SNIPPET,
60
+ getDiagramSnippetWithGeneralizationView,
61
+ getDiagramSnippetWithOneClassView,
62
+ getDiagramSnippetWithPropertyView,
63
+ } from './DSLDiagram_CodeSnippets';
40
64
 
41
65
  const DIAGRAM_ELEMENT_TYPE = 'DIAGRAM';
42
66
  const DIAGRAM_ELEMENT_PROJECT_EXPLORER_DND_TYPE = 'PROJECT_EXPLORER_DIAGRAM';
@@ -49,6 +73,12 @@ export class DSLDiagram_LegendStudioPlugin
49
73
  super(packageJson.extensions.studioPlugin, packageJson.version);
50
74
  }
51
75
 
76
+ override getExtraKeyedDocumentationEntries(): LegendApplicationKeyedDocumentationEntry[] {
77
+ return collectKeyedDocumnetationEntriesFromConfig(
78
+ DSL_DIAGRAM_DOCUMENTATION_ENTRIES,
79
+ );
80
+ }
81
+
52
82
  override getExtraClassPreviewRenderers(): ClassPreviewRenderer[] {
53
83
  return [
54
84
  (_class: Class): React.ReactNode => (
@@ -138,7 +168,7 @@ export class DSLDiagram_LegendStudioPlugin
138
168
  ];
139
169
  }
140
170
 
141
- getExtraGrammarTextEditorDnDTypes(): string[] {
171
+ getExtraPureGrammarTextEditorDnDTypes(): string[] {
142
172
  return [DIAGRAM_ELEMENT_PROJECT_EXPLORER_DND_TYPE];
143
173
  }
144
174
 
@@ -163,4 +193,87 @@ export class DSLDiagram_LegendStudioPlugin
163
193
  },
164
194
  ];
165
195
  }
196
+
197
+ getExtraPureGrammarParserElementDocumentationGetters(): PureGrammarParserElementDocumentationGetter[] {
198
+ return [
199
+ (
200
+ editorStore: EditorStore,
201
+ parserKeyword: string,
202
+ elementKeyword: string,
203
+ ): LegendApplicationDocumentationEntry | undefined => {
204
+ if (parserKeyword === PURE_GRAMMAR_DIAGRAM_PARSER_NAME) {
205
+ if (elementKeyword === PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL) {
206
+ return editorStore.applicationStore.docRegistry.getEntry(
207
+ DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_DIAGRAM_ELEMENT,
208
+ );
209
+ }
210
+ }
211
+ return undefined;
212
+ },
213
+ ];
214
+ }
215
+
216
+ getExtraPureGrammarParserDocumentationGetters(): PureGrammarParserDocumentationGetter[] {
217
+ return [
218
+ (
219
+ editorStore: EditorStore,
220
+ parserKeyword: string,
221
+ ): LegendApplicationDocumentationEntry | undefined => {
222
+ if (parserKeyword === PURE_GRAMMAR_DIAGRAM_PARSER_NAME) {
223
+ return editorStore.applicationStore.docRegistry.getEntry(
224
+ DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER,
225
+ );
226
+ }
227
+ return undefined;
228
+ },
229
+ ];
230
+ }
231
+
232
+ getExtraPureGrammarParserKeywordSuggestionGetters(): PureGrammarParserKeywordSuggestionGetter[] {
233
+ return [
234
+ (editorStore: EditorStore): PureGrammarTextSuggestion[] => [
235
+ {
236
+ text: PURE_GRAMMAR_DIAGRAM_PARSER_NAME,
237
+ description: `(dsl)`,
238
+ documentation: editorStore.applicationStore.docRegistry.getEntry(
239
+ DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER,
240
+ ),
241
+ insertText: PURE_GRAMMAR_DIAGRAM_PARSER_NAME,
242
+ },
243
+ ],
244
+ ];
245
+ }
246
+
247
+ getExtraPureGrammarParserElementSnippetSuggestionsGetters(): PureGrammarParserElementSnippetSuggestionsGetter[] {
248
+ return [
249
+ (
250
+ editorStore: EditorStore,
251
+ parserKeyword: string,
252
+ ): PureGrammarTextSuggestion[] | undefined =>
253
+ parserKeyword === PURE_GRAMMAR_DIAGRAM_PARSER_NAME
254
+ ? [
255
+ {
256
+ text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
257
+ description: '(blank)',
258
+ insertText: EMPTY_DIAGRAM_SNIPPET,
259
+ },
260
+ {
261
+ text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
262
+ description: 'with class',
263
+ insertText: getDiagramSnippetWithOneClassView(),
264
+ },
265
+ {
266
+ text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
267
+ description: 'with inheritance',
268
+ insertText: getDiagramSnippetWithGeneralizationView(),
269
+ },
270
+ {
271
+ text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
272
+ description: 'with composition',
273
+ insertText: getDiagramSnippetWithPropertyView(),
274
+ },
275
+ ]
276
+ : undefined,
277
+ ];
278
+ }
166
279
  }
@@ -25,8 +25,8 @@ import {
25
25
  import { Diagram } from '../models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram';
26
26
  import { observe_Diagram } from './action/changeDetection/DSLDiagram_ObserverHelper';
27
27
 
28
- const PURE_GRAMMAR_DIAGRAM_PARSER_NAME = 'Diagram';
29
- const PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL = 'Diagram';
28
+ export const PURE_GRAMMAR_DIAGRAM_PARSER_NAME = 'Diagram';
29
+ export const PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL = 'Diagram';
30
30
 
31
31
  export class DSLDiagram_PureGraphManagerPlugin extends PureGraphManagerPlugin {
32
32
  constructor() {
package/tsconfig.json CHANGED
@@ -39,6 +39,8 @@
39
39
  "./src/DSLDiagram_Extension.ts",
40
40
  "./src/DiagramRenderer.ts",
41
41
  "./src/index.ts",
42
+ "./src/components/studio/DSLDiagram_CodeSnippets.ts",
43
+ "./src/components/studio/DSLDiagram_LegendStudioDocumentation.ts",
42
44
  "./src/components/studio/DSLDiagram_TestID.ts",
43
45
  "./src/components/studio/InheritanceDiagramRenderer.ts",
44
46
  "./src/graph/DSLDiagram_PureGraphPlugin.ts",