@finos/legend-vscode-extension-dependencies 3.0.3 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/bundles/bundle.cjs.js +103 -103
- package/lib/bundles/style/bundle.css +2 -2
- package/lib/index.d.ts +6 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/package.json +2 -8
- package/src/index.ts +46 -2
- package/tsconfig.json +1 -8
- package/lib/components/Diagram/DiagramEditor.d.ts +0 -9
- package/lib/components/Diagram/DiagramEditor.d.ts.map +0 -1
- package/lib/components/Diagram/DiagramEditor.js +0 -61
- package/lib/components/Diagram/DiagramEditor.js.map +0 -1
- package/lib/components/Diagram/DiagramEditorDiagramCanvas.d.ts +0 -5
- package/lib/components/Diagram/DiagramEditorDiagramCanvas.d.ts.map +0 -1
- package/lib/components/Diagram/DiagramEditorDiagramCanvas.js +0 -92
- package/lib/components/Diagram/DiagramEditorDiagramCanvas.js.map +0 -1
- package/lib/components/Diagram/DiagramEditorToolPanel.d.ts +0 -7
- package/lib/components/Diagram/DiagramEditorToolPanel.d.ts.map +0 -1
- package/lib/components/Diagram/DiagramEditorToolPanel.js +0 -37
- package/lib/components/Diagram/DiagramEditorToolPanel.js.map +0 -1
- package/lib/components/Diagram/DiagramHeader.d.ts +0 -7
- package/lib/components/Diagram/DiagramHeader.d.ts.map +0 -1
- package/lib/components/Diagram/DiagramHeader.js +0 -39
- package/lib/components/Diagram/DiagramHeader.js.map +0 -1
- package/lib/stores/DiagramEditorState.d.ts +0 -35
- package/lib/stores/DiagramEditorState.d.ts.map +0 -1
- package/lib/stores/DiagramEditorState.js +0 -102
- package/lib/stores/DiagramEditorState.js.map +0 -1
- package/lib/utils/Const.d.ts +0 -20
- package/lib/utils/Const.d.ts.map +0 -1
- package/lib/utils/Const.js +0 -21
- package/lib/utils/Const.js.map +0 -1
- package/lib/utils/VsCodeUtils.d.ts +0 -18
- package/lib/utils/VsCodeUtils.d.ts.map +0 -1
- package/lib/utils/VsCodeUtils.js +0 -19
- package/lib/utils/VsCodeUtils.js.map +0 -1
- package/src/components/Diagram/DiagramEditor.tsx +0 -113
- package/src/components/Diagram/DiagramEditorDiagramCanvas.tsx +0 -150
- package/src/components/Diagram/DiagramEditorToolPanel.tsx +0 -105
- package/src/components/Diagram/DiagramHeader.tsx +0 -230
- package/src/stores/DiagramEditorState.ts +0 -121
- package/src/utils/Const.ts +0 -21
- package/src/utils/VsCodeUtils.ts +0 -27
package/lib/index.d.ts
CHANGED
@@ -13,7 +13,11 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
|
16
|
+
import '../style/index.scss';
|
17
17
|
export * from './graph-manager/index.js';
|
18
|
-
export
|
18
|
+
export { getDiagram, Point, DIAGRAM_INTERACTION_MODE, DIAGRAM_RELATIONSHIP_EDIT_MODE, DiagramRenderer, type Diagram, DIAGRAM_ALIGNER_OPERATOR, DIAGRAM_ZOOM_LEVELS, V1_diagramModelSchema, V1_transformDiagram, } from '@finos/legend-extension-dsl-diagram';
|
19
|
+
export { AlignBottomIcon, AlignCenterIcon, AlignEndIcon, AlignMiddleIcon, AlignStartIcon, AlignTopIcon, CaretDownIcon, CustomSelectorInput, ControlledDropdownMenu, compareLabelFn, DistributeHorizontalIcon, DistributeVerticalIcon, MenuContent, MenuContentDivider, MenuContentItem, SaveIcon, clsx, MousePointerIcon, MoveIcon, ZoomInIcon, ZoomOutIcon, useResizeDetector, LegendStyleProvider, } from '@finos/legend-art';
|
20
|
+
export { Class, type PureModel, CORE_PURE_PATH } from '@finos/legend-graph';
|
21
|
+
export type { Entity } from '@finos/legend-storage';
|
22
|
+
export type { GeneratorFn } from '@finos/legend-shared';
|
19
23
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,qBAAqB,CAAC;AAE7B,cAAc,0BAA0B,CAAC;AACzC,OAAO,EACL,UAAU,EACV,KAAK,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,eAAe,EACf,KAAK,OAAO,EACZ,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,wBAAwB,EACxB,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE5E,YAAY,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
|
package/lib/index.js
CHANGED
@@ -13,7 +13,9 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
|
16
|
+
import '../style/index.scss';
|
17
17
|
export * from './graph-manager/index.js';
|
18
|
-
export
|
18
|
+
export { getDiagram, Point, DIAGRAM_INTERACTION_MODE, DIAGRAM_RELATIONSHIP_EDIT_MODE, DiagramRenderer, DIAGRAM_ALIGNER_OPERATOR, DIAGRAM_ZOOM_LEVELS, V1_diagramModelSchema, V1_transformDiagram, } from '@finos/legend-extension-dsl-diagram';
|
19
|
+
export { AlignBottomIcon, AlignCenterIcon, AlignEndIcon, AlignMiddleIcon, AlignStartIcon, AlignTopIcon, CaretDownIcon, CustomSelectorInput, ControlledDropdownMenu, compareLabelFn, DistributeHorizontalIcon, DistributeVerticalIcon, MenuContent, MenuContentDivider, MenuContentItem, SaveIcon, clsx, MousePointerIcon, MoveIcon, ZoomInIcon, ZoomOutIcon, useResizeDetector, LegendStyleProvider, } from '@finos/legend-art';
|
20
|
+
export { Class, CORE_PURE_PATH } from '@finos/legend-graph';
|
19
21
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,qBAAqB,CAAC;AAE7B,cAAc,0BAA0B,CAAC;AACzC,OAAO,EACL,UAAU,EACV,KAAK,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,eAAe,EAEf,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,wBAAwB,EACxB,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,EAAkB,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@finos/legend-vscode-extension-dependencies",
|
3
|
-
"version": "
|
3
|
+
"version": "4.0.0",
|
4
4
|
"homepage": "https://github.com/finos/legend-studio/tree/master/packages/legend-vscode-extension-dependencies",
|
5
5
|
"bugs": {
|
6
6
|
"url": "https://github.com/finos/legend-studio/issues"
|
@@ -45,12 +45,7 @@
|
|
45
45
|
"@finos/legend-extension-dsl-diagram": "8.1.3",
|
46
46
|
"@finos/legend-graph": "31.10.26",
|
47
47
|
"@finos/legend-shared": "10.0.53",
|
48
|
-
"@finos/legend-storage": "3.0.103"
|
49
|
-
"@types/react": "18.3.5",
|
50
|
-
"mobx": "6.13.1",
|
51
|
-
"mobx-react-lite": "4.0.7",
|
52
|
-
"react": "18.3.1",
|
53
|
-
"serializr": "3.0.2"
|
48
|
+
"@finos/legend-storage": "3.0.103"
|
54
49
|
},
|
55
50
|
"devDependencies": {
|
56
51
|
"@babel/core": "7.25.2",
|
@@ -60,7 +55,6 @@
|
|
60
55
|
"@rollup/plugin-json": "6.1.0",
|
61
56
|
"@rollup/plugin-node-resolve": "15.2.3",
|
62
57
|
"@rollup/plugin-terser": "0.4.4",
|
63
|
-
"@types/vscode": "1.92.0",
|
64
58
|
"cross-env": "7.0.3",
|
65
59
|
"eslint": "8.57.0",
|
66
60
|
"npm-run-all": "4.1.5",
|
package/src/index.ts
CHANGED
@@ -14,6 +14,50 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
|
17
|
+
import '../style/index.scss';
|
18
|
+
|
18
19
|
export * from './graph-manager/index.js';
|
19
|
-
export
|
20
|
+
export {
|
21
|
+
getDiagram,
|
22
|
+
Point,
|
23
|
+
DIAGRAM_INTERACTION_MODE,
|
24
|
+
DIAGRAM_RELATIONSHIP_EDIT_MODE,
|
25
|
+
DiagramRenderer,
|
26
|
+
type Diagram,
|
27
|
+
DIAGRAM_ALIGNER_OPERATOR,
|
28
|
+
DIAGRAM_ZOOM_LEVELS,
|
29
|
+
V1_diagramModelSchema,
|
30
|
+
V1_transformDiagram,
|
31
|
+
} from '@finos/legend-extension-dsl-diagram';
|
32
|
+
|
33
|
+
export {
|
34
|
+
AlignBottomIcon,
|
35
|
+
AlignCenterIcon,
|
36
|
+
AlignEndIcon,
|
37
|
+
AlignMiddleIcon,
|
38
|
+
AlignStartIcon,
|
39
|
+
AlignTopIcon,
|
40
|
+
CaretDownIcon,
|
41
|
+
CustomSelectorInput,
|
42
|
+
ControlledDropdownMenu,
|
43
|
+
compareLabelFn,
|
44
|
+
DistributeHorizontalIcon,
|
45
|
+
DistributeVerticalIcon,
|
46
|
+
MenuContent,
|
47
|
+
MenuContentDivider,
|
48
|
+
MenuContentItem,
|
49
|
+
SaveIcon,
|
50
|
+
clsx,
|
51
|
+
MousePointerIcon,
|
52
|
+
MoveIcon,
|
53
|
+
ZoomInIcon,
|
54
|
+
ZoomOutIcon,
|
55
|
+
useResizeDetector,
|
56
|
+
LegendStyleProvider,
|
57
|
+
} from '@finos/legend-art';
|
58
|
+
|
59
|
+
export { Class, type PureModel, CORE_PURE_PATH } from '@finos/legend-graph';
|
60
|
+
|
61
|
+
export type { Entity } from '@finos/legend-storage';
|
62
|
+
|
63
|
+
export type { GeneratorFn } from '@finos/legend-shared';
|
package/tsconfig.json
CHANGED
@@ -50,14 +50,7 @@
|
|
50
50
|
"files": [
|
51
51
|
"./src/index.ts",
|
52
52
|
"./src/graph-manager/index.ts",
|
53
|
-
"./src/graph-manager/helpers/VSCODE_Extension_GraphManagerHelper.ts"
|
54
|
-
"./src/stores/DiagramEditorState.ts",
|
55
|
-
"./src/utils/Const.ts",
|
56
|
-
"./src/utils/VsCodeUtils.ts",
|
57
|
-
"./src/components/Diagram/DiagramEditor.tsx",
|
58
|
-
"./src/components/Diagram/DiagramEditorDiagramCanvas.tsx",
|
59
|
-
"./src/components/Diagram/DiagramEditorToolPanel.tsx",
|
60
|
-
"./src/components/Diagram/DiagramHeader.tsx"
|
53
|
+
"./src/graph-manager/helpers/VSCODE_Extension_GraphManagerHelper.ts"
|
61
54
|
],
|
62
55
|
"include": [
|
63
56
|
"src/**/*.ts",
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import '../../../style/index.scss';
|
2
|
-
import type { DiagramEditorState } from '../../stores/DiagramEditorState.js';
|
3
|
-
export declare const DiagramEditor: ((props: {
|
4
|
-
diagramId: string;
|
5
|
-
diagramEditorState: DiagramEditorState;
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element) & {
|
7
|
-
displayName: string;
|
8
|
-
};
|
9
|
-
//# sourceMappingURL=DiagramEditor.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DiagramEditor.d.ts","sourceRoot":"","sources":["../../../src/components/Diagram/DiagramEditor.tsx"],"names":[],"mappings":"AAmBA,OAAO,2BAA2B,CAAC;AAOnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAM7E,eAAO,MAAM,aAAa,WAChB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,kBAAkB,CAAA;CAAE;;CA+EtE,CAAC"}
|
@@ -1,61 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
-
/**
|
3
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*/
|
17
|
-
import { getDiagram } from '@finos/legend-extension-dsl-diagram';
|
18
|
-
import { useRef, useEffect, useState } from 'react';
|
19
|
-
import { observer } from 'mobx-react-lite';
|
20
|
-
import '../../../style/index.scss';
|
21
|
-
import { postMessage } from '../../utils/VsCodeUtils.js';
|
22
|
-
import { GET_PROJECT_ENTITIES, GET_PROJECT_ENTITIES_RESPONSE, } from '../../utils/Const.js';
|
23
|
-
import { getPureGraph } from '../../graph-manager/index.js';
|
24
|
-
import { LegendStyleProvider } from '@finos/legend-art';
|
25
|
-
import { DiagramEditorHeader } from './DiagramHeader.js';
|
26
|
-
import { DiagramEditorDiagramCanvas } from './DiagramEditorDiagramCanvas.js';
|
27
|
-
import { DiagramEditorToolPanel } from './DiagramEditorToolPanel.js';
|
28
|
-
export const DiagramEditor = observer((props) => {
|
29
|
-
const diagramCanvasRef = useRef(null);
|
30
|
-
const { diagramId, diagramEditorState } = props;
|
31
|
-
const [entities, setEntities] = useState([]);
|
32
|
-
const [error, setError] = useState();
|
33
|
-
useEffect(() => {
|
34
|
-
postMessage({
|
35
|
-
command: GET_PROJECT_ENTITIES,
|
36
|
-
});
|
37
|
-
}, [diagramId]);
|
38
|
-
window.addEventListener('message', (event) => {
|
39
|
-
const message = event.data;
|
40
|
-
if (message.command === GET_PROJECT_ENTITIES_RESPONSE) {
|
41
|
-
const es = message.result;
|
42
|
-
setEntities(es);
|
43
|
-
}
|
44
|
-
});
|
45
|
-
useEffect(() => {
|
46
|
-
if (entities.length && diagramId) {
|
47
|
-
getPureGraph(entities, [])
|
48
|
-
.then((pureModel) => {
|
49
|
-
const diagram = getDiagram(diagramId, pureModel);
|
50
|
-
diagramEditorState.setDiagram(diagram);
|
51
|
-
diagramEditorState.setGraph(pureModel);
|
52
|
-
setError(null);
|
53
|
-
})
|
54
|
-
.catch((e) => {
|
55
|
-
setError(e.message);
|
56
|
-
});
|
57
|
-
}
|
58
|
-
}, [entities, diagramId, diagramEditorState]);
|
59
|
-
return (_jsx(LegendStyleProvider, { children: _jsx("div", { className: "diagram-editor", children: error ? (_jsxs("div", { className: "diagram-editor__error", children: [_jsx("span", { children: "Something went wrong. Diagram cannot be created." }), _jsx("span", { className: "diagram-editor__error__details", title: `${error}`, children: "Error Details." })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "diagram-editor__header", children: diagramEditorState.isDiagramRendererInitialized && (_jsx(DiagramEditorHeader, { diagramEditorState: diagramEditorState })) }), _jsx("div", { className: "diagram-editor__content", children: _jsxs("div", { className: "diagram-editor__stage", children: [diagramEditorState.isDiagramRendererInitialized && (_jsx(DiagramEditorToolPanel, { diagramEditorState: diagramEditorState })), _jsx(DiagramEditorDiagramCanvas, { diagramEditorState: diagramEditorState, ref: diagramCanvasRef })] }) })] })) }) }));
|
60
|
-
});
|
61
|
-
//# sourceMappingURL=DiagramEditor.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DiagramEditor.js","sourceRoot":"","sources":["../../../src/components/Diagram/DiagramEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,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C,CAAC,CAAC,OAAO,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACP,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAE9C,OAAO,CACL,KAAC,mBAAmB,cAClB,cAAK,SAAS,EAAC,gBAAgB,YAC5B,KAAK,CAAC,CAAC,CAAC,CACP,eAAK,SAAS,EAAC,uBAAuB,aACpC,8EAA6D,EAC7D,eACE,SAAS,EAAC,gCAAgC,EAC1C,KAAK,EAAE,GAAG,KAAK,EAAE,+BAGZ,IACH,CACP,CAAC,CAAC,CAAC,CACF,8BACE,cAAK,SAAS,EAAC,wBAAwB,YACpC,kBAAkB,CAAC,4BAA4B,IAAI,CAClD,KAAC,mBAAmB,IAClB,kBAAkB,EAAE,kBAAkB,GACtC,CACH,GACG,EACN,cAAK,SAAS,EAAC,yBAAyB,YACtC,eAAK,SAAS,EAAC,uBAAuB,aACnC,kBAAkB,CAAC,4BAA4B,IAAI,CAClD,KAAC,sBAAsB,IACrB,kBAAkB,EAAE,kBAAkB,GACtC,CACH,EACD,KAAC,0BAA0B,IACzB,kBAAkB,EAAE,kBAAkB,EACtC,GAAG,EAAE,gBAAgB,GACrB,IACE,GACF,IACL,CACJ,GACG,GACc,CACvB,CAAC;AACJ,CAAC,CACF,CAAC"}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { DiagramEditorState } from '../../stores/DiagramEditorState.js';
|
2
|
-
export declare const DiagramEditorDiagramCanvas: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<{
|
3
|
-
diagramEditorState: DiagramEditorState;
|
4
|
-
} & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>>;
|
5
|
-
//# sourceMappingURL=DiagramEditorDiagramCanvas.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DiagramEditorDiagramCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/Diagram/DiagramEditorDiagramCanvas.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,eAAO,MAAM,0BAA0B;wBAIb,kBAAkB;2GA4G3C,CAAC"}
|
@@ -1,92 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
/**
|
3
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*/
|
17
|
-
import { clsx, useResizeDetector } from '@finos/legend-art';
|
18
|
-
import { DiagramRenderer, Point, V1_diagramModelSchema, V1_transformDiagram, } from '@finos/legend-extension-dsl-diagram';
|
19
|
-
import { Class } from '@finos/legend-graph';
|
20
|
-
import { observer } from 'mobx-react-lite';
|
21
|
-
import { flowResult } from 'mobx';
|
22
|
-
import { forwardRef, useEffect, } from 'react';
|
23
|
-
import { serialize } from 'serializr';
|
24
|
-
import { DIAGRAM_DROP_CLASS_ERROR, WRITE_ENTITY } from '../../utils/Const.js';
|
25
|
-
import { postMessage } from '../../utils/VsCodeUtils.js';
|
26
|
-
export const DiagramEditorDiagramCanvas = observer(forwardRef(function DiagramEditorDiagramCanvas(props, ref) {
|
27
|
-
const { diagramEditorState } = props;
|
28
|
-
const diagram = diagramEditorState.diagram;
|
29
|
-
const diagramCanvasRef = ref;
|
30
|
-
const { width, height } = useResizeDetector({
|
31
|
-
refreshMode: 'debounce',
|
32
|
-
refreshRate: 50,
|
33
|
-
targetRef: diagramCanvasRef,
|
34
|
-
});
|
35
|
-
useEffect(() => {
|
36
|
-
if (diagram) {
|
37
|
-
const renderer = new DiagramRenderer(diagramCanvasRef.current, diagram);
|
38
|
-
diagramEditorState.setRenderer(renderer);
|
39
|
-
diagramEditorState.setupRenderer();
|
40
|
-
renderer.render({ initial: true });
|
41
|
-
}
|
42
|
-
}, [diagramCanvasRef, diagramEditorState, diagram]);
|
43
|
-
useEffect(() => {
|
44
|
-
// since after the diagram render is initialized, we start
|
45
|
-
// showing the toolbar and the header, which causes the auto-zoom fit
|
46
|
-
// to be off, we need to call this method again
|
47
|
-
if (diagramEditorState.isDiagramRendererInitialized) {
|
48
|
-
diagramEditorState.renderer.render({ initial: true });
|
49
|
-
}
|
50
|
-
}, [diagramEditorState, diagramEditorState.isDiagramRendererInitialized]);
|
51
|
-
useEffect(() => {
|
52
|
-
if (diagramEditorState.isDiagramRendererInitialized) {
|
53
|
-
diagramEditorState.renderer.refresh();
|
54
|
-
}
|
55
|
-
}, [diagramEditorState, width, height]);
|
56
|
-
const dropTarget = document.getElementById('root') ?? document.body;
|
57
|
-
dropTarget.addEventListener('dragover', (event) => {
|
58
|
-
// accept any DnD
|
59
|
-
event.preventDefault();
|
60
|
-
});
|
61
|
-
const drop = (event) => {
|
62
|
-
event.preventDefault();
|
63
|
-
const droppedEntityIds = JSON.parse(event.dataTransfer.getData('application/vnd.code.tree.legendConceptTree')).itemHandles.map((item) => item.split('/')[1] ?? '');
|
64
|
-
const position = diagramEditorState.renderer.canvasCoordinateToModelCoordinate(diagramEditorState.renderer.eventCoordinateToCanvasCoordinate(new Point(event.clientX, event.clientY)));
|
65
|
-
droppedEntityIds
|
66
|
-
.filter((entityId) => {
|
67
|
-
const isClassInstance = diagramEditorState.graph?.getElement(entityId) instanceof Class;
|
68
|
-
if (!isClassInstance) {
|
69
|
-
postMessage({
|
70
|
-
command: DIAGRAM_DROP_CLASS_ERROR,
|
71
|
-
});
|
72
|
-
}
|
73
|
-
return isClassInstance;
|
74
|
-
})
|
75
|
-
.forEach((entityId) => {
|
76
|
-
flowResult(diagramEditorState.addClassView(entityId, position)).catch(
|
77
|
-
// eslint-disable-next-line no-console
|
78
|
-
(error) => console.error(error));
|
79
|
-
});
|
80
|
-
};
|
81
|
-
const handleKeyDown = (event) => {
|
82
|
-
if ((event.ctrlKey || event.metaKey) && event.key === 's') {
|
83
|
-
event.preventDefault();
|
84
|
-
postMessage({
|
85
|
-
command: WRITE_ENTITY,
|
86
|
-
msg: serialize(V1_diagramModelSchema, V1_transformDiagram(diagramEditorState._renderer?.diagram)),
|
87
|
-
});
|
88
|
-
}
|
89
|
-
};
|
90
|
-
return (_jsx("div", { onDrop: drop, onKeyDown: handleKeyDown, ref: diagramCanvasRef, className: clsx('diagram-canvas diagram-editor__canvas', diagramEditorState.diagramCursorClass), tabIndex: 0 }));
|
91
|
-
}));
|
92
|
-
//# sourceMappingURL=DiagramEditorDiagramCanvas.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DiagramEditorDiagramCanvas.js","sourceRoot":"","sources":["../../../src/components/Diagram/DiagramEditorDiagramCanvas.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAEL,eAAe,EACf,KAAK,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EACL,UAAU,EACV,SAAS,GAGV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,YAA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;aACD,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACpB,UAAU,CAAC,kBAAkB,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK;YACnE,sCAAsC;YACtC,CAAC,KAAc,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CACzC,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,CAAC,KAAoB,EAAE,EAAE;QAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YAC1D,KAAK,CAAC,cAAc,EAAE,CAAC;YAEvB,WAAW,CAAC;gBACV,OAAO,EAAE,YAAY;gBACrB,GAAG,EAAE,SAAS,CACZ,qBAAqB,EACrB,mBAAmB,CACjB,kBAAkB,CAAC,SAAS,EAAE,OAAkB,CACjD,CACF;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,cACE,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,aAAa,EACxB,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,IAAI,CACb,uCAAuC,EACvC,kBAAkB,CAAC,kBAAkB,CACtC,EACD,QAAQ,EAAE,CAAC,GACX,CACH,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import type { DiagramEditorState } from '../../stores/DiagramEditorState.js';
|
2
|
-
export declare const DiagramEditorToolPanel: ((props: {
|
3
|
-
diagramEditorState: DiagramEditorState;
|
4
|
-
}) => import("react/jsx-runtime").JSX.Element) & {
|
5
|
-
displayName: string;
|
6
|
-
};
|
7
|
-
//# sourceMappingURL=DiagramEditorToolPanel.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DiagramEditorToolPanel.d.ts","sourceRoot":"","sources":["../../../src/components/Diagram/DiagramEditorToolPanel.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,eAAO,MAAM,sBAAsB,WACzB;IAAE,kBAAkB,EAAE,kBAAkB,CAAA;CAAE;;CA0EnD,CAAC"}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
/**
|
3
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*/
|
17
|
-
import { clsx, MousePointerIcon, MoveIcon, ZoomInIcon, ZoomOutIcon, } from '@finos/legend-art';
|
18
|
-
import { DIAGRAM_INTERACTION_MODE, DIAGRAM_RELATIONSHIP_EDIT_MODE, } from '@finos/legend-extension-dsl-diagram';
|
19
|
-
import { observer } from 'mobx-react-lite';
|
20
|
-
export const DiagramEditorToolPanel = observer((props) => {
|
21
|
-
const { diagramEditorState } = props;
|
22
|
-
const renderer = diagramEditorState.renderer;
|
23
|
-
//const isReadOnly = diagramEditorState.isReadOnly;
|
24
|
-
const createModeSwitcher = (editMode, relationshipMode) => () => {
|
25
|
-
renderer.changeMode(editMode, relationshipMode);
|
26
|
-
};
|
27
|
-
return (_jsxs("div", { className: "diagram-editor__tools", children: [_jsx("button", { className: clsx('diagram-editor__tool', {
|
28
|
-
'diagram-editor__tool--active': renderer.interactionMode === DIAGRAM_INTERACTION_MODE.LAYOUT,
|
29
|
-
}), tabIndex: -1, onClick: createModeSwitcher(DIAGRAM_INTERACTION_MODE.LAYOUT, DIAGRAM_RELATIONSHIP_EDIT_MODE.NONE), title: "View Tool (V)", children: _jsx(MousePointerIcon, { className: "diagram-editor__icon--layout" }) }), _jsx("button", { className: clsx('diagram-editor__tool', {
|
30
|
-
'diagram-editor__tool--active': renderer.interactionMode === DIAGRAM_INTERACTION_MODE.PAN,
|
31
|
-
}), tabIndex: -1, onClick: createModeSwitcher(DIAGRAM_INTERACTION_MODE.PAN, DIAGRAM_RELATIONSHIP_EDIT_MODE.NONE), title: "Pan Tool (M)", children: _jsx(MoveIcon, { className: "diagram-editor__icon--pan" }) }), _jsx("button", { className: clsx('diagram-editor__tool', {
|
32
|
-
'diagram-editor__tool--active': renderer.interactionMode === DIAGRAM_INTERACTION_MODE.ZOOM_IN,
|
33
|
-
}), tabIndex: -1, title: "Zoom In (Z)", onClick: createModeSwitcher(DIAGRAM_INTERACTION_MODE.ZOOM_IN, DIAGRAM_RELATIONSHIP_EDIT_MODE.NONE), children: _jsx(ZoomInIcon, { className: "diagram-editor__icon--zoom-in" }) }), _jsx("button", { className: clsx('diagram-editor__tool', {
|
34
|
-
'diagram-editor__tool--active': renderer.interactionMode === DIAGRAM_INTERACTION_MODE.ZOOM_OUT,
|
35
|
-
}), tabIndex: -1, title: "Zoom Out (Z)", onClick: createModeSwitcher(DIAGRAM_INTERACTION_MODE.ZOOM_OUT, DIAGRAM_RELATIONSHIP_EDIT_MODE.NONE), children: _jsx(ZoomOutIcon, { className: "diagram-editor__icon--zoom-out" }) })] }));
|
36
|
-
});
|
37
|
-
//# sourceMappingURL=DiagramEditorToolPanel.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DiagramEditorToolPanel.js","sourceRoot":"","sources":["../../../src/components/Diagram/DiagramEditorToolPanel.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AACH,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,KAAC,QAAQ,IAAC,SAAS,EAAC,2BAA2B,GAAG,GAC3C,EACT,iBACE,SAAS,EAAE,IAAI,CAAC,sBAAsB,EAAE;oBACtC,8BAA8B,EAC5B,QAAQ,CAAC,eAAe,KAAK,wBAAwB,CAAC,OAAO;iBAChE,CAAC,EACF,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAC,aAAa,EACnB,OAAO,EAAE,kBAAkB,CACzB,wBAAwB,CAAC,OAAO,EAChC,8BAA8B,CAAC,IAAI,CACpC,YAED,KAAC,UAAU,IAAC,SAAS,EAAC,+BAA+B,GAAG,GACjD,EACT,iBACE,SAAS,EAAE,IAAI,CAAC,sBAAsB,EAAE;oBACtC,8BAA8B,EAC5B,QAAQ,CAAC,eAAe,KAAK,wBAAwB,CAAC,QAAQ;iBACjE,CAAC,EACF,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAC,cAAc,EACpB,OAAO,EAAE,kBAAkB,CACzB,wBAAwB,CAAC,QAAQ,EACjC,8BAA8B,CAAC,IAAI,CACpC,YAED,KAAC,WAAW,IAAC,SAAS,EAAC,gCAAgC,GAAG,GACnD,IACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import type { DiagramEditorState } from '../../stores/DiagramEditorState.js';
|
2
|
-
export declare const DiagramEditorHeader: ((props: {
|
3
|
-
diagramEditorState: DiagramEditorState;
|
4
|
-
}) => import("react/jsx-runtime").JSX.Element) & {
|
5
|
-
displayName: string;
|
6
|
-
};
|
7
|
-
//# sourceMappingURL=DiagramHeader.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DiagramHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Diagram/DiagramHeader.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAI7E,eAAO,MAAM,mBAAmB,WACtB;IAAE,kBAAkB,EAAE,kBAAkB,CAAA;CAAE;;CAuLnD,CAAC"}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
-
/**
|
3
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*/
|
17
|
-
import { DIAGRAM_ALIGNER_OPERATOR, DIAGRAM_ZOOM_LEVELS, V1_diagramModelSchema, V1_transformDiagram, } from '@finos/legend-extension-dsl-diagram';
|
18
|
-
import { observer } from 'mobx-react-lite';
|
19
|
-
import { serialize } from 'serializr';
|
20
|
-
import { WRITE_ENTITY } from '../../utils/Const.js';
|
21
|
-
import { AlignBottomIcon, AlignCenterIcon, AlignEndIcon, AlignMiddleIcon, AlignStartIcon, AlignTopIcon, CaretDownIcon, ControlledDropdownMenu, DistributeHorizontalIcon, DistributeVerticalIcon, MenuContent, MenuContentDivider, MenuContentItem, SaveIcon, } from '@finos/legend-art';
|
22
|
-
import { postMessage } from '../../utils/VsCodeUtils.js';
|
23
|
-
export const DiagramEditorHeader = observer((props) => {
|
24
|
-
const { diagramEditorState } = props;
|
25
|
-
const createCenterZoomer = (zoomLevel) => () => {
|
26
|
-
diagramEditorState.renderer.zoomCenter(zoomLevel / 100);
|
27
|
-
};
|
28
|
-
const zoomToFit = () => diagramEditorState.renderer.zoomToFit();
|
29
|
-
const isAlignerDisabled = diagramEditorState.renderer.selectedClasses.length < 2;
|
30
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "diagram-editor__header__group", children: [_jsx("button", { className: "diagram-editor__header__action diagram-editor__header__group__action", title: "Save", tabIndex: -1, onClick: () => postMessage({
|
31
|
-
command: WRITE_ENTITY,
|
32
|
-
msg: serialize(V1_diagramModelSchema, V1_transformDiagram(diagramEditorState._renderer?.diagram)),
|
33
|
-
}), children: _jsx(SaveIcon, { className: "diagram-editor__icon--aligner" }) }), _jsx("button", { className: "diagram-editor__header__action diagram-editor__header__group__action", title: "Align left", disabled: isAlignerDisabled, tabIndex: -1, onClick: () => diagramEditorState.renderer.align(DIAGRAM_ALIGNER_OPERATOR.ALIGN_LEFT), children: _jsx(AlignStartIcon, { className: "diagram-editor__icon--aligner" }) }), _jsx("button", { className: "diagram-editor__header__action diagram-editor__header__group__action", title: "Align center", disabled: isAlignerDisabled, tabIndex: -1, onClick: () => diagramEditorState.renderer.align(DIAGRAM_ALIGNER_OPERATOR.ALIGN_CENTER), children: _jsx(AlignCenterIcon, { className: "diagram-editor__icon--aligner" }) }), _jsx("button", { className: "diagram-editor__header__action diagram-editor__header__group__action", title: "Align right", disabled: isAlignerDisabled, tabIndex: -1, onClick: () => diagramEditorState.renderer.align(DIAGRAM_ALIGNER_OPERATOR.ALIGN_RIGHT), children: _jsx(AlignEndIcon, { className: "diagram-editor__icon--aligner" }) })] }), _jsx("div", { className: "diagram-editor__header__group__separator" }), _jsxs("div", { className: "diagram-editor__header__group", children: [_jsx("button", { className: "diagram-editor__header__action diagram-editor__header__group__action", title: "Align top", disabled: isAlignerDisabled, tabIndex: -1, onClick: () => diagramEditorState.renderer.align(DIAGRAM_ALIGNER_OPERATOR.ALIGN_TOP), children: _jsx(AlignTopIcon, { className: "diagram-editor__icon--aligner" }) }), _jsx("button", { className: "diagram-editor__header__action diagram-editor__header__group__action", title: "Align middle", disabled: isAlignerDisabled, tabIndex: -1, onClick: () => diagramEditorState.renderer.align(DIAGRAM_ALIGNER_OPERATOR.ALIGN_MIDDLE), children: _jsx(AlignMiddleIcon, { className: "diagram-editor__icon--aligner" }) }), _jsx("button", { className: "diagram-editor__header__action diagram-editor__header__group__action", title: "Align bottom", disabled: isAlignerDisabled, tabIndex: -1, onClick: () => diagramEditorState.renderer.align(DIAGRAM_ALIGNER_OPERATOR.ALIGN_BOTTOM), children: _jsx(AlignBottomIcon, { className: "diagram-editor__icon--aligner" }) })] }), _jsx("div", { className: "diagram-editor__header__group__separator" }), _jsxs("div", { className: "diagram-editor__header__group", children: [_jsx("button", { className: "diagram-editor__header__action diagram-editor__header__group__action", title: "Space horizontally", disabled: isAlignerDisabled, tabIndex: -1, onClick: () => diagramEditorState.renderer.align(DIAGRAM_ALIGNER_OPERATOR.SPACE_HORIZONTALLY), children: _jsx(DistributeHorizontalIcon, { className: "diagram-editor__icon--aligner" }) }), _jsx("button", { className: "diagram-editor__header__action diagram-editor__header__group__action", title: "Space vertically", disabled: isAlignerDisabled, tabIndex: -1, onClick: () => diagramEditorState.renderer.align(DIAGRAM_ALIGNER_OPERATOR.SPACE_VERTICALLY), children: _jsx(DistributeVerticalIcon, { className: "diagram-editor__icon--aligner" }) })] }), _jsxs(ControlledDropdownMenu, { className: "diagram-editor__header__dropdown", title: "Zoom...", content: _jsxs(MenuContent, { children: [_jsx(MenuContentItem, { className: "diagram-editor__header__zoomer__dropdown__menu__item", onClick: zoomToFit, children: "Fit" }), _jsx(MenuContentDivider, {}), DIAGRAM_ZOOM_LEVELS.map((zoomLevel) => (_jsxs(MenuContentItem, { className: "diagram-editor__header__zoomer__dropdown__menu__item", onClick: createCenterZoomer(zoomLevel), children: [zoomLevel, "%"] }, zoomLevel)))] }), menuProps: {
|
34
|
-
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
35
|
-
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
36
|
-
elevation: 7,
|
37
|
-
}, children: [_jsxs("div", { className: "diagram-editor__header__dropdown__label diagram-editor__header__zoomer__dropdown__label", children: [Math.round(diagramEditorState.renderer.zoom * 100), "%"] }), _jsx("div", { className: "diagram-editor__header__dropdown__trigger diagram-editor__header__zoomer__dropdown__trigger", children: _jsx(CaretDownIcon, {}) })] })] }));
|
38
|
-
});
|
39
|
-
//# sourceMappingURL=DiagramHeader.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DiagramHeader.js","sourceRoot":"","sources":["../../../src/components/Diagram/DiagramHeader.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAEL,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACL,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CACzC,CAAC,KAAiD,EAAE,EAAE;IACpD,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,kBAAkB,GACtB,CAAC,SAAiB,EAAgB,EAAE,CACpC,GAAS,EAAE;QACT,kBAAkB,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC;IAC1D,CAAC,CAAC;IACJ,MAAM,SAAS,GAAG,GAAS,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;IAEtE,MAAM,iBAAiB,GACrB,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|
-
/**
|
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 { type Diagram, type Point } from '@finos/legend-extension-dsl-diagram/graph';
|
17
|
-
import { type PureModel } from '@finos/legend-graph';
|
18
|
-
import { type GeneratorFn } from '@finos/legend-shared';
|
19
|
-
import { type DiagramRenderer } from '@finos/legend-extension-dsl-diagram/application';
|
20
|
-
export declare class DiagramEditorState {
|
21
|
-
_renderer?: DiagramRenderer | undefined;
|
22
|
-
diagramId: string;
|
23
|
-
diagram?: Diagram;
|
24
|
-
graph?: PureModel;
|
25
|
-
constructor(diagramId: string);
|
26
|
-
get renderer(): DiagramRenderer;
|
27
|
-
get isDiagramRendererInitialized(): boolean;
|
28
|
-
get diagramCursorClass(): string;
|
29
|
-
setupRenderer(): void;
|
30
|
-
setRenderer(val: DiagramRenderer): void;
|
31
|
-
setDiagram(val: Diagram): void;
|
32
|
-
setGraph(val: PureModel): void;
|
33
|
-
addClassView(path: string, position: Point | undefined): GeneratorFn<void>;
|
34
|
-
}
|
35
|
-
//# sourceMappingURL=DiagramEditorState.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DiagramEditorState.d.ts","sourceRoot":"","sources":["../../src/stores/DiagramEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EACX,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,WAAW,EAAwB,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,iDAAiD,CAAC;AAEzD,qBAAa,kBAAkB;IAC7B,SAAS,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;gBAEN,SAAS,EAAE,MAAM;IAY7B,IAAI,QAAQ,IAAI,eAAe,CAK9B;IAED,IAAI,4BAA4B,IAAI,OAAO,CAE1C;IAMD,IAAI,kBAAkB,IAAI,MAAM,CAmC/B;IAED,aAAa,IAAI,IAAI;IAIrB,WAAW,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAIvC,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAI9B,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI;IAI7B,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC;CAO5E"}
|
@@ -1,102 +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
|
-
import {} from '@finos/legend-extension-dsl-diagram/graph';
|
17
|
-
import {} from '@finos/legend-graph';
|
18
|
-
import { guaranteeNonNullable } from '@finos/legend-shared';
|
19
|
-
import { action, computed, flow, makeObservable, observable } from 'mobx';
|
20
|
-
import { DIAGRAM_INTERACTION_MODE, } from '@finos/legend-extension-dsl-diagram/application';
|
21
|
-
export class DiagramEditorState {
|
22
|
-
_renderer;
|
23
|
-
diagramId;
|
24
|
-
diagram;
|
25
|
-
graph;
|
26
|
-
constructor(diagramId) {
|
27
|
-
makeObservable(this, {
|
28
|
-
_renderer: observable,
|
29
|
-
diagram: observable,
|
30
|
-
diagramCursorClass: computed,
|
31
|
-
addClassView: flow,
|
32
|
-
setRenderer: action,
|
33
|
-
});
|
34
|
-
this.diagramId = diagramId;
|
35
|
-
}
|
36
|
-
get renderer() {
|
37
|
-
return guaranteeNonNullable(this._renderer, `Diagram renderer must be initialized (this is likely caused by calling this method at the wrong place)`);
|
38
|
-
}
|
39
|
-
get isDiagramRendererInitialized() {
|
40
|
-
return Boolean(this._renderer);
|
41
|
-
}
|
42
|
-
// NOTE: we have tried to use React to control the cursor and
|
43
|
-
// could not overcome the jank/lag problem, so we settle with CSS-based approach
|
44
|
-
// See https://css-tricks.com/using-css-cursors/
|
45
|
-
// See https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
|
46
|
-
get diagramCursorClass() {
|
47
|
-
if (!this.isDiagramRendererInitialized) {
|
48
|
-
return '';
|
49
|
-
}
|
50
|
-
if (this.renderer.middleClick || this.renderer.rightClick) {
|
51
|
-
return 'diagram-editor__cursor--grabbing';
|
52
|
-
}
|
53
|
-
switch (this.renderer.interactionMode) {
|
54
|
-
case DIAGRAM_INTERACTION_MODE.PAN: {
|
55
|
-
return this.renderer.leftClick
|
56
|
-
? 'diagram-editor__cursor--grabbing'
|
57
|
-
: 'diagram-editor__cursor--grab';
|
58
|
-
}
|
59
|
-
case DIAGRAM_INTERACTION_MODE.ZOOM_IN: {
|
60
|
-
return 'diagram-editor__cursor--zoom-in';
|
61
|
-
}
|
62
|
-
case DIAGRAM_INTERACTION_MODE.ZOOM_OUT: {
|
63
|
-
return 'diagram-editor__cursor--zoom-out';
|
64
|
-
}
|
65
|
-
case DIAGRAM_INTERACTION_MODE.LAYOUT: {
|
66
|
-
if (this.renderer.selectionStart) {
|
67
|
-
return 'diagram-editor__cursor--crosshair';
|
68
|
-
}
|
69
|
-
else if (this.renderer.mouseOverClassCorner ||
|
70
|
-
this.renderer.selectedClassCorner) {
|
71
|
-
return 'diagram-editor__cursor--resize';
|
72
|
-
}
|
73
|
-
else if (this.renderer.mouseOverClassView) {
|
74
|
-
return 'diagram-editor__cursor--pointer';
|
75
|
-
}
|
76
|
-
return '';
|
77
|
-
}
|
78
|
-
default:
|
79
|
-
return '';
|
80
|
-
}
|
81
|
-
}
|
82
|
-
setupRenderer() {
|
83
|
-
this.renderer.setIsReadOnly(false);
|
84
|
-
}
|
85
|
-
setRenderer(val) {
|
86
|
-
this._renderer = val;
|
87
|
-
}
|
88
|
-
setDiagram(val) {
|
89
|
-
this.diagram = val;
|
90
|
-
}
|
91
|
-
setGraph(val) {
|
92
|
-
this.graph = val;
|
93
|
-
}
|
94
|
-
*addClassView(path, position) {
|
95
|
-
if (!this.graph || !this.diagram) {
|
96
|
-
return;
|
97
|
-
}
|
98
|
-
const _class = this.graph.getClass(path);
|
99
|
-
this.renderer.addClassView(_class, position);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
//# sourceMappingURL=DiagramEditorState.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DiagramEditorState.js","sourceRoot":"","sources":["../../src/stores/DiagramEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAGN,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAkB,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAoB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EA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