@eclipse-glsp/client 1.1.0-next.7ff1b00.184 → 1.1.0-next.a07a5f7.197

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 (73) hide show
  1. package/lib/base/container-modules.js +37 -36
  2. package/lib/base/container-modules.js.map +1 -1
  3. package/lib/base/types.d.ts +2 -0
  4. package/lib/base/types.d.ts.map +1 -1
  5. package/lib/features/bounds/di.config.d.ts +20 -0
  6. package/lib/features/bounds/di.config.d.ts.map +1 -0
  7. package/lib/features/bounds/di.config.js +36 -0
  8. package/lib/features/bounds/di.config.js.map +1 -0
  9. package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +34 -0
  10. package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -0
  11. package/lib/features/bounds/glsp-hidden-bounds-updater.js +98 -0
  12. package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -0
  13. package/lib/features/export/glsp-svg-exporter.d.ts +22 -0
  14. package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -0
  15. package/lib/features/export/glsp-svg-exporter.js +45 -0
  16. package/lib/features/export/glsp-svg-exporter.js.map +1 -0
  17. package/lib/features/layout/tests/freeform-layout.spec.d.ts +3 -0
  18. package/lib/features/layout/tests/freeform-layout.spec.d.ts.map +1 -0
  19. package/lib/features/layout/tests/freeform-layout.spec.js +201 -0
  20. package/lib/features/layout/tests/freeform-layout.spec.js.map +1 -0
  21. package/lib/features/layout/tests/hbox-layout.spec.d.ts +3 -0
  22. package/lib/features/layout/tests/hbox-layout.spec.d.ts.map +1 -0
  23. package/lib/features/layout/tests/hbox-layout.spec.js +161 -0
  24. package/lib/features/layout/tests/hbox-layout.spec.js.map +1 -0
  25. package/lib/features/layout/tests/layouter-test-util.d.ts +34 -0
  26. package/lib/features/layout/tests/layouter-test-util.d.ts.map +1 -0
  27. package/lib/features/layout/tests/layouter-test-util.js +96 -0
  28. package/lib/features/layout/tests/layouter-test-util.js.map +1 -0
  29. package/lib/features/layout/tests/vbox-layout.spec.d.ts +3 -0
  30. package/lib/features/layout/tests/vbox-layout.spec.d.ts.map +1 -0
  31. package/lib/features/layout/tests/vbox-layout.spec.js +161 -0
  32. package/lib/features/layout/tests/vbox-layout.spec.js.map +1 -0
  33. package/lib/features/tools/change-bounds-tool.d.ts.map +1 -1
  34. package/lib/features/tools/change-bounds-tool.js +13 -10
  35. package/lib/features/tools/change-bounds-tool.js.map +1 -1
  36. package/lib/features/tools/di.config.d.ts.map +1 -1
  37. package/lib/features/tools/di.config.js +7 -1
  38. package/lib/features/tools/di.config.js.map +1 -1
  39. package/lib/features/tools/edge-edit-tool.d.ts +2 -2
  40. package/lib/features/tools/edge-edit-tool.d.ts.map +1 -1
  41. package/lib/features/tools/edge-edit-tool.js +3 -2
  42. package/lib/features/tools/edge-edit-tool.js.map +1 -1
  43. package/lib/features/tools/glsp-manhattan-edge-router.d.ts +20 -0
  44. package/lib/features/tools/glsp-manhattan-edge-router.d.ts.map +1 -0
  45. package/lib/features/tools/glsp-manhattan-edge-router.js +69 -0
  46. package/lib/features/tools/glsp-manhattan-edge-router.js.map +1 -0
  47. package/lib/sprotty-reexport.d.ts +1 -1
  48. package/lib/sprotty-reexport.d.ts.map +1 -1
  49. package/lib/sprotty-reexport.js +6 -4
  50. package/lib/sprotty-reexport.js.map +1 -1
  51. package/lib/utils/smodel-util.d.ts +32 -2
  52. package/lib/utils/smodel-util.d.ts.map +1 -1
  53. package/lib/utils/smodel-util.js +50 -2
  54. package/lib/utils/smodel-util.js.map +1 -1
  55. package/lib/views/glsp-projection-view.d.ts.map +1 -1
  56. package/lib/views/glsp-projection-view.js +8 -2
  57. package/lib/views/glsp-projection-view.js.map +1 -1
  58. package/package.json +6 -5
  59. package/src/base/container-modules.ts +2 -2
  60. package/src/features/bounds/di.config.ts +39 -0
  61. package/src/features/bounds/glsp-hidden-bounds-updater.ts +88 -0
  62. package/src/features/export/glsp-svg-exporter.ts +50 -0
  63. package/src/features/layout/tests/freeform-layout.spec.ts +216 -0
  64. package/src/features/layout/tests/hbox-layout.spec.ts +171 -0
  65. package/src/features/layout/tests/layouter-test-util.ts +122 -0
  66. package/src/features/layout/tests/vbox-layout.spec.ts +171 -0
  67. package/src/features/tools/change-bounds-tool.ts +16 -13
  68. package/src/features/tools/di.config.ts +10 -2
  69. package/src/features/tools/edge-edit-tool.ts +5 -6
  70. package/src/features/tools/glsp-manhattan-edge-router.ts +57 -0
  71. package/src/sprotty-reexport.ts +6 -1
  72. package/src/utils/smodel-util.ts +60 -4
  73. package/src/views/glsp-projection-view.tsx +10 -3
@@ -18,28 +18,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.createClientContainer = exports.DEFAULT_MODULES = void 0;
19
19
  const inversify_1 = require("inversify");
20
20
  const sprotty_1 = require("sprotty");
21
- const di_config_1 = require("../features/command-palette/di.config");
22
- const di_config_2 = require("../features/context-menu/di.config");
23
- const di_config_3 = require("../features/copy-paste/di.config");
24
- const di_config_4 = require("../features/decoration/di.config");
25
- const di_config_5 = require("../features/edit-label/di.config");
26
- const di_config_6 = require("../features/hints/di.config");
27
- const di_config_7 = require("../features/hover/di.config");
28
- const di_config_8 = require("../features/layout/di.config");
29
- const di_config_9 = require("../features/mouse-tool/di.config");
30
- const di_config_10 = require("../features/navigation/di.config");
31
- const di_config_11 = require("../features/select/di.config");
32
- const di_config_12 = require("../features/source-model-watcher/di.config");
33
- const di_config_13 = require("../features/tool-feedback/di.config");
34
- const di_config_14 = require("../features/tool-palette/di.config");
35
- const di_config_15 = require("../features/tools/di.config");
36
- const di_config_16 = require("../features/validation/di.config");
37
- const di_config_17 = require("../features/viewport/di.config");
38
- const di_config_18 = require("./di.config");
21
+ const di_config_1 = require("../features/bounds/di.config");
22
+ const di_config_2 = require("../features/command-palette/di.config");
23
+ const di_config_3 = require("../features/context-menu/di.config");
24
+ const di_config_4 = require("../features/copy-paste/di.config");
25
+ const di_config_5 = require("../features/decoration/di.config");
26
+ const di_config_6 = require("../features/edit-label/di.config");
27
+ const di_config_7 = require("../features/hints/di.config");
28
+ const di_config_8 = require("../features/hover/di.config");
29
+ const di_config_9 = require("../features/layout/di.config");
30
+ const di_config_10 = require("../features/mouse-tool/di.config");
31
+ const di_config_11 = require("../features/navigation/di.config");
32
+ const di_config_12 = require("../features/select/di.config");
33
+ const di_config_13 = require("../features/source-model-watcher/di.config");
34
+ const di_config_14 = require("../features/tool-feedback/di.config");
35
+ const di_config_15 = require("../features/tool-palette/di.config");
36
+ const di_config_16 = require("../features/tools/di.config");
37
+ const di_config_17 = require("../features/validation/di.config");
38
+ const di_config_18 = require("../features/viewport/di.config");
39
+ const di_config_19 = require("./di.config");
39
40
  exports.DEFAULT_MODULES = [
40
41
  sprotty_1.defaultModule,
41
- di_config_18.default,
42
- sprotty_1.boundsModule,
42
+ di_config_19.default,
43
43
  sprotty_1.buttonModule,
44
44
  sprotty_1.edgeIntersectionModule,
45
45
  sprotty_1.edgeLayoutModule,
@@ -48,27 +48,28 @@ exports.DEFAULT_MODULES = [
48
48
  sprotty_1.fadeModule,
49
49
  di_config_1.default,
50
50
  di_config_2.default,
51
- di_config_4.default,
51
+ di_config_3.default,
52
52
  di_config_5.default,
53
- di_config_7.default,
54
- di_config_9.default,
55
- di_config_11.default,
56
- di_config_3.glspServerCopyPasteModule,
57
- di_config_17.default,
58
- sprotty_1.labelEditUiModule,
59
- di_config_8.default,
60
- di_config_16.markerNavigatorModule,
61
53
  di_config_6.default,
62
- sprotty_1.modelSourceModule,
54
+ di_config_8.default,
55
+ di_config_10.default,
63
56
  di_config_12.default,
64
- di_config_10.navigationModule,
57
+ di_config_4.glspServerCopyPasteModule,
58
+ di_config_18.default,
59
+ sprotty_1.labelEditUiModule,
60
+ di_config_9.default,
61
+ di_config_17.markerNavigatorModule,
62
+ di_config_7.default,
63
+ sprotty_1.modelSourceModule,
64
+ di_config_13.default,
65
+ di_config_11.navigationModule,
65
66
  sprotty_1.openModule,
66
- di_config_14.default,
67
+ di_config_15.default,
67
68
  sprotty_1.routingModule,
68
- di_config_13.default,
69
- di_config_15.toolsModule,
70
- di_config_15.enableDefaultToolsOnFocusLossModule,
71
- di_config_16.validationModule,
69
+ di_config_14.default,
70
+ di_config_16.toolsModule,
71
+ di_config_16.enableDefaultToolsOnFocusLossModule,
72
+ di_config_17.validationModule,
72
73
  sprotty_1.zorderModule
73
74
  ];
74
75
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"container-modules.js","sourceRoot":"","sources":["../../src/base/container-modules.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,yCAAuD;AACvD,qCAciB;AACjB,qEAA6E;AAC7E,kEAAuE;AACvE,gEAA6E;AAC7E,gEAAoE;AACpE,gEAAmE;AACnE,2DAA2D;AAC3D,2DAA0D;AAC1D,4DAAwD;AACxD,gEAAmE;AACnE,iEAAoE;AACpE,6DAA4D;AAC5D,2EAAkF;AAClF,oEAAqE;AACrE,mEAAmE;AACnE,4DAA+F;AAC/F,iEAA2F;AAC3F,+DAAgE;AAChE,4CAA4C;AAE/B,QAAA,eAAe,GAAG;IAC3B,uBAAa;IACb,oBAAiB;IACjB,sBAAY;IACZ,sBAAY;IACZ,gCAAsB;IACtB,0BAAgB;IAChB,sBAAY;IACZ,sBAAY;IACZ,oBAAU;IACV,mBAAwB;IACxB,mBAAqB;IACrB,mBAAoB;IACpB,mBAAmB;IACnB,mBAAe;IACf,mBAAmB;IACnB,oBAAgB;IAChB,qCAAyB;IACzB,oBAAkB;IAClB,2BAAiB;IACjB,mBAAY;IACZ,kCAAqB;IACrB,mBAAgB;IAChB,2BAAiB;IACjB,oBAAwB;IACxB,6BAAgB;IAChB,oBAAU;IACV,oBAAiB;IACjB,uBAAa;IACb,oBAAkB;IAClB,wBAAW;IACX,gDAAmC;IACnC,6BAAgB;IAChB,sBAAY;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,qBAAqB,CAAC,GAAG,OAA0B;IAC/D,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;IAClC,SAAS,CAAC,IAAI,CAAC,GAAG,uBAAe,EAAE,GAAG,OAAO,CAAC,CAAC;IAC/C,OAAO,SAAS,CAAC;AACrB,CAAC;AAJD,sDAIC"}
1
+ {"version":3,"file":"container-modules.js","sourceRoot":"","sources":["../../src/base/container-modules.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,yCAAuD;AACvD,qCAaiB;AACjB,4DAA4D;AAC5D,qEAA6E;AAC7E,kEAAuE;AACvE,gEAA6E;AAC7E,gEAAoE;AACpE,gEAAmE;AACnE,2DAA2D;AAC3D,2DAA0D;AAC1D,4DAAwD;AACxD,iEAAmE;AACnE,iEAAoE;AACpE,6DAA4D;AAC5D,2EAAkF;AAClF,oEAAqE;AACrE,mEAAmE;AACnE,4DAA+F;AAC/F,iEAA2F;AAC3F,+DAAgE;AAChE,4CAA4C;AAE/B,QAAA,eAAe,GAAG;IAC3B,uBAAa;IACb,oBAAiB;IACjB,sBAAY;IACZ,gCAAsB;IACtB,0BAAgB;IAChB,sBAAY;IACZ,sBAAY;IACZ,oBAAU;IACV,mBAAgB;IAChB,mBAAwB;IACxB,mBAAqB;IACrB,mBAAoB;IACpB,mBAAmB;IACnB,mBAAe;IACf,oBAAmB;IACnB,oBAAgB;IAChB,qCAAyB;IACzB,oBAAkB;IAClB,2BAAiB;IACjB,mBAAY;IACZ,kCAAqB;IACrB,mBAAgB;IAChB,2BAAiB;IACjB,oBAAwB;IACxB,6BAAgB;IAChB,oBAAU;IACV,oBAAiB;IACjB,uBAAa;IACb,oBAAkB;IAClB,wBAAW;IACX,gDAAmC;IACnC,6BAAgB;IAChB,sBAAY;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,qBAAqB,CAAC,GAAG,OAA0B;IAC/D,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;IAClC,SAAS,CAAC,IAAI,CAAC,GAAG,uBAAe,EAAE,GAAG,OAAO,CAAC,CAAC;IAC/C,OAAO,SAAS,CAAC;AACrB,CAAC;AAJD,sDAIC"}
@@ -28,6 +28,7 @@ export declare const TYPES: {
28
28
  IAnchorComputer: symbol;
29
29
  AnimationFrameSyncer: symbol;
30
30
  IButtonHandler: symbol;
31
+ IButtonHandlerRegistration: symbol;
31
32
  ICommandPaletteActionProvider: symbol;
32
33
  ICommandPaletteActionProviderRegistry: symbol;
33
34
  CommandRegistration: symbol;
@@ -110,6 +111,7 @@ export declare const GLSP_TYPES: {
110
111
  IAnchorComputer: symbol;
111
112
  AnimationFrameSyncer: symbol;
112
113
  IButtonHandler: symbol;
114
+ IButtonHandlerRegistration: symbol;
113
115
  ICommandPaletteActionProvider: symbol;
114
116
  ICommandPaletteActionProviderRegistry: symbol;
115
117
  CommandRegistration: symbol;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/base/types.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBjB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAQ,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/base/types.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBjB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAQ,CAAC"}
@@ -0,0 +1,20 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2022 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { ContainerModule } from 'inversify';
17
+ import '../../../css/command-palette.css';
18
+ declare const glspBoundsModule: ContainerModule;
19
+ export default glspBoundsModule;
20
+ //# sourceMappingURL=di.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"di.config.d.ts","sourceRoot":"","sources":["../../../src/features/bounds/di.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAK5C,OAAO,kCAAkC,CAAC;AAI1C,QAAA,MAAM,gBAAgB,iBAYpB,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /********************************************************************************
4
+ * Copyright (c) 2022 EclipseSource and others.
5
+ *
6
+ * This program and the accompanying materials are made available under the
7
+ * terms of the Eclipse Public License v. 2.0 which is available at
8
+ * http://www.eclipse.org/legal/epl-2.0.
9
+ *
10
+ * This Source Code may also be made available under the following Secondary
11
+ * Licenses when the conditions for such availability set forth in the Eclipse
12
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
13
+ * with the GNU Classpath Exception which is available at
14
+ * https://www.gnu.org/software/classpath/license.html.
15
+ *
16
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
17
+ ********************************************************************************/
18
+ const inversify_1 = require("inversify");
19
+ const sprotty_1 = require("sprotty");
20
+ require("../../../css/command-palette.css");
21
+ const types_1 = require("../../base/types");
22
+ const glsp_hidden_bounds_updater_1 = require("./glsp-hidden-bounds-updater");
23
+ const glspBoundsModule = new inversify_1.ContainerModule((bind, _unbind, isBound, _rebind) => {
24
+ (0, sprotty_1.configureCommand)({ bind, isBound }, sprotty_1.SetBoundsCommand);
25
+ (0, sprotty_1.configureCommand)({ bind, isBound }, sprotty_1.RequestBoundsCommand);
26
+ bind(sprotty_1.HiddenBoundsUpdater).toSelf().inSingletonScope();
27
+ bind(glsp_hidden_bounds_updater_1.GLSPHiddenBoundsUpdater).toSelf().inSingletonScope();
28
+ bind(types_1.TYPES.HiddenVNodePostprocessor).toService(glsp_hidden_bounds_updater_1.GLSPHiddenBoundsUpdater);
29
+ bind(types_1.TYPES.Layouter).to(sprotty_1.Layouter).inSingletonScope();
30
+ bind(types_1.TYPES.LayoutRegistry).to(sprotty_1.LayoutRegistry).inSingletonScope();
31
+ (0, sprotty_1.configureLayout)({ bind, isBound }, sprotty_1.VBoxLayouter.KIND, sprotty_1.VBoxLayouter);
32
+ (0, sprotty_1.configureLayout)({ bind, isBound }, sprotty_1.HBoxLayouter.KIND, sprotty_1.HBoxLayouter);
33
+ (0, sprotty_1.configureLayout)({ bind, isBound }, sprotty_1.StackLayouter.KIND, sprotty_1.StackLayouter);
34
+ });
35
+ exports.default = glspBoundsModule;
36
+ //# sourceMappingURL=di.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"di.config.js","sourceRoot":"","sources":["../../../src/features/bounds/di.config.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAA4C;AAC5C,qCAGiB;AACjB,4CAA0C;AAC1C,4CAAyC;AACzC,6EAAuE;AAEvE,MAAM,gBAAgB,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IAC7E,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,0BAAgB,CAAC,CAAC;IACtD,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,8BAAoB,CAAC,CAAC;IAC1D,IAAI,CAAC,6BAAmB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACtD,IAAI,CAAC,oDAAuB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC1D,IAAI,CAAC,aAAK,CAAC,wBAAwB,CAAC,CAAC,SAAS,CAAC,oDAAuB,CAAC,CAAC;IACxE,IAAI,CAAC,aAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,kBAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACrD,IAAI,CAAC,aAAK,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,wBAAc,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAEjE,IAAA,yBAAe,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,sBAAY,CAAC,IAAI,EAAE,sBAAY,CAAC,CAAC;IACpE,IAAA,yBAAe,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,sBAAY,CAAC,IAAI,EAAE,sBAAY,CAAC,CAAC;IACpE,IAAA,yBAAe,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,uBAAa,CAAC,IAAI,EAAE,uBAAa,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC;AAEH,kBAAe,gBAAgB,CAAC"}
@@ -0,0 +1,34 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2022 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Action, ComputedBoundsAction, ElementAndRoutingPoints } from '@eclipse-glsp/protocol';
17
+ import { VNode } from 'snabbdom';
18
+ import { EdgeRouterRegistry, HiddenBoundsUpdater, SModelElement, SRoutableElement } from 'sprotty';
19
+ /**
20
+ * Grabs the bounds from hidden SVG DOM elements, applies layouts, collects routes and fires {@link ComputedBoundsAction}s.
21
+ *
22
+ * The actions will contain the bound, alignment, and routing points of elements.
23
+ */
24
+ export declare class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
25
+ protected readonly edgeRouterRegistry?: EdgeRouterRegistry;
26
+ protected element2route: ElementAndRoutingPoints[];
27
+ protected edges: SRoutableElement[];
28
+ protected nodes: VNode[];
29
+ decorate(vnode: VNode, element: SModelElement): VNode;
30
+ postUpdate(cause?: Action): void;
31
+ protected captureActions(call: () => void): Action[];
32
+ protected enhanceAction(action: ComputedBoundsAction): ComputedBoundsAction;
33
+ }
34
+ //# sourceMappingURL=glsp-hidden-bounds-updater.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glsp-hidden-bounds-updater.d.ts","sourceRoot":"","sources":["../../../src/features/bounds/glsp-hidden-bounds-updater.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EACH,MAAM,EAAE,oBAAoB,EAAY,uBAAuB,EAElE,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAqB,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGtH;;;;GAIG;AACH,qBACa,uBAAwB,SAAQ,mBAAmB;IAEpB,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IAEnG,SAAS,CAAC,aAAa,EAAE,uBAAuB,EAAE,CAAM;IACxD,SAAS,CAAC,KAAK,EAAE,gBAAgB,EAAE,CAAM;IACzC,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,CAAM;IAErB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK;IAQrD,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAOzC,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,MAAM,EAAE;IAYpD,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,oBAAoB;CAI9E"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2022 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.GLSPHiddenBoundsUpdater = void 0;
28
+ const protocol_1 = require("@eclipse-glsp/protocol");
29
+ const inversify_1 = require("inversify");
30
+ const sprotty_1 = require("sprotty");
31
+ const smodel_util_1 = require("../../utils/smodel-util");
32
+ /**
33
+ * Grabs the bounds from hidden SVG DOM elements, applies layouts, collects routes and fires {@link ComputedBoundsAction}s.
34
+ *
35
+ * The actions will contain the bound, alignment, and routing points of elements.
36
+ */
37
+ let GLSPHiddenBoundsUpdater = class GLSPHiddenBoundsUpdater extends sprotty_1.HiddenBoundsUpdater {
38
+ constructor() {
39
+ super(...arguments);
40
+ this.element2route = [];
41
+ this.edges = [];
42
+ this.nodes = [];
43
+ }
44
+ decorate(vnode, element) {
45
+ super.decorate(vnode, element);
46
+ if ((0, smodel_util_1.isRoutable)(element)) {
47
+ this.element2route.push((0, smodel_util_1.calcElementAndRoute)(element, this.edgeRouterRegistry));
48
+ }
49
+ return vnode;
50
+ }
51
+ postUpdate(cause) {
52
+ const actions = this.captureActions(() => super.postUpdate(cause));
53
+ actions.filter(action => protocol_1.ComputedBoundsAction.is(action))
54
+ .forEach(action => this.actionDispatcher.dispatch(this.enhanceAction(action)));
55
+ this.element2route = [];
56
+ }
57
+ captureActions(call) {
58
+ const capturingActionDispatcher = new CapturingActionDispatcher();
59
+ const actualActionDispatcher = this.actionDispatcher;
60
+ this.actionDispatcher = capturingActionDispatcher;
61
+ try {
62
+ call();
63
+ return capturingActionDispatcher.actions;
64
+ }
65
+ finally {
66
+ this.actionDispatcher = actualActionDispatcher;
67
+ }
68
+ }
69
+ enhanceAction(action) {
70
+ action.routes = this.element2route.length === 0 ? undefined : this.element2route;
71
+ return action;
72
+ }
73
+ };
74
+ __decorate([
75
+ (0, inversify_1.inject)(sprotty_1.EdgeRouterRegistry),
76
+ (0, inversify_1.optional)(),
77
+ __metadata("design:type", sprotty_1.EdgeRouterRegistry)
78
+ ], GLSPHiddenBoundsUpdater.prototype, "edgeRouterRegistry", void 0);
79
+ GLSPHiddenBoundsUpdater = __decorate([
80
+ (0, inversify_1.injectable)()
81
+ ], GLSPHiddenBoundsUpdater);
82
+ exports.GLSPHiddenBoundsUpdater = GLSPHiddenBoundsUpdater;
83
+ class CapturingActionDispatcher {
84
+ constructor() {
85
+ this.actions = [];
86
+ }
87
+ async dispatch(action) {
88
+ this.actions.push(action);
89
+ }
90
+ async dispatchAll(actions) {
91
+ this.actions.push(...actions);
92
+ }
93
+ async request(action) {
94
+ // ignore, not needed for our purposes
95
+ return new protocol_1.Deferred().promise;
96
+ }
97
+ }
98
+ //# sourceMappingURL=glsp-hidden-bounds-updater.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glsp-hidden-bounds-updater.js","sourceRoot":"","sources":["../../../src/features/bounds/glsp-hidden-bounds-updater.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,qDAGgC;AAChC,yCAAyD;AAEzD,qCAAsH;AACtH,yDAA0E;AAE1E;;;;GAIG;AAEH,IAAa,uBAAuB,GAApC,MAAa,uBAAwB,SAAQ,6BAAmB;IAAhE;;QAIc,kBAAa,GAA8B,EAAE,CAAC;QAC9C,UAAK,GAAuB,EAAE,CAAC;QAC/B,UAAK,GAAY,EAAE,CAAC;IAiClC,CAAC;IA/BY,QAAQ,CAAC,KAAY,EAAE,OAAsB;QAClD,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC/B,IAAI,IAAA,wBAAU,EAAC,OAAO,CAAC,EAAE;YACrB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAA,iCAAmB,EAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;SAClF;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEQ,UAAU,CAAC,KAAc;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QACnE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,+BAAoB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;aACpD,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,MAA8B,CAAC,CAAC,CAAC,CAAC;QAC3G,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;IAC5B,CAAC;IAES,cAAc,CAAC,IAAgB;QACrC,MAAM,yBAAyB,GAAG,IAAI,yBAAyB,EAAE,CAAC;QAClE,MAAM,sBAAsB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QACrD,IAAI,CAAC,gBAAgB,GAAG,yBAAyB,CAAC;QAClD,IAAI;YACA,IAAI,EAAE,CAAC;YACP,OAAO,yBAAyB,CAAC,OAAO,CAAC;SAC5C;gBAAS;YACN,IAAI,CAAC,gBAAgB,GAAG,sBAAsB,CAAC;SAClD;IACL,CAAC;IAES,aAAa,CAAC,MAA4B;QAChD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;QACjF,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AArC2C;IAAvC,IAAA,kBAAM,EAAC,4BAAkB,CAAC;IAAE,IAAA,oBAAQ,GAAE;8BAAyC,4BAAkB;mEAAC;AAF1F,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CAuCnC;AAvCY,0DAAuB;AAyCpC,MAAM,yBAAyB;IAA/B;QACa,YAAO,GAAa,EAAE,CAAC;IAcpC,CAAC;IAZG,KAAK,CAAC,QAAQ,CAAC,MAAc;QACzB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAiB;QAC/B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,OAAO,CAA6B,MAA0B;QAChE,sCAAsC;QACtC,OAAO,IAAI,mBAAQ,EAAO,CAAC,OAAO,CAAC;IACvC,CAAC;CACJ"}
@@ -0,0 +1,22 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2022 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { RequestAction } from '@eclipse-glsp/protocol';
17
+ import { ExportSvgAction, SModelRoot, SvgExporter } from 'sprotty';
18
+ export declare class GLSPSvgExporter extends SvgExporter {
19
+ export(root: SModelRoot, _request?: RequestAction<ExportSvgAction>): void;
20
+ protected findSvgElement(): SVGSVGElement | null;
21
+ }
22
+ //# sourceMappingURL=glsp-svg-exporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glsp-svg-exporter.d.ts","sourceRoot":"","sources":["../../../src/features/export/glsp-svg-exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGlE,qBACa,eAAgB,SAAQ,WAAW;IACpC,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,IAAI;IAsBlF,SAAS,CAAC,cAAc,IAAI,aAAa,GAAG,IAAI;CAKlD"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.GLSPSvgExporter = void 0;
10
+ const inversify_1 = require("inversify");
11
+ const sprotty_1 = require("sprotty");
12
+ const uuid_1 = require("uuid");
13
+ let GLSPSvgExporter = class GLSPSvgExporter extends sprotty_1.SvgExporter {
14
+ export(root, _request) {
15
+ if (typeof document !== 'undefined') {
16
+ const svgElement = this.findSvgElement();
17
+ if (svgElement) {
18
+ // createSvg requires the svg to have a non-empty id, so we generate one if necessary
19
+ const originalId = svgElement.id;
20
+ try {
21
+ svgElement.id = originalId || (0, uuid_1.v4)();
22
+ // provide generated svg code with respective sizing for proper viewing in browser and remove undesired border
23
+ const bounds = this.getBounds(root);
24
+ const svg = this.createSvg(svgElement, root)
25
+ .replace('style="', `style="width: ${bounds.width}px !important;height: ${bounds.height}px !important;border: none !important;`);
26
+ // do not give request/response id here as otherwise the action is treated as an unrequested response
27
+ this.actionDispatcher.dispatch(sprotty_1.ExportSvgAction.create(svg, ''));
28
+ }
29
+ finally {
30
+ svgElement.id = originalId;
31
+ }
32
+ }
33
+ }
34
+ }
35
+ findSvgElement() {
36
+ const div = document.getElementById(this.options.hiddenDiv);
37
+ // search for first svg element as hierarchy within Sprotty might change
38
+ return div && div.querySelector('svg');
39
+ }
40
+ };
41
+ GLSPSvgExporter = __decorate([
42
+ (0, inversify_1.injectable)()
43
+ ], GLSPSvgExporter);
44
+ exports.GLSPSvgExporter = GLSPSvgExporter;
45
+ //# sourceMappingURL=glsp-svg-exporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glsp-svg-exporter.js","sourceRoot":"","sources":["../../../src/features/export/glsp-svg-exporter.ts"],"names":[],"mappings":";;;;;;;;;AAgBA,yCAAuC;AACvC,qCAAmE;AACnE,+BAAkC;AAGjC,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,qBAAW;IACpC,MAAM,CAAC,IAAgB,EAAE,QAAyC;QACvE,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;YACjC,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YACzC,IAAI,UAAU,EAAE;gBACZ,qFAAqF;gBACrF,MAAM,UAAU,GAAG,UAAU,CAAC,EAAE,CAAC;gBACjC,IAAI;oBACA,UAAU,CAAC,EAAE,GAAG,UAAU,IAAI,IAAA,SAAI,GAAE,CAAC;oBACrC,8GAA8G;oBAC9G,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;oBACpC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC;yBACvC,OAAO,CAAC,SAAS,EACd,iBAAiB,MAAM,CAAC,KAAK,yBAAyB,MAAM,CAAC,MAAM,wCAAwC,CAAC,CAAC;oBACrH,qGAAqG;oBACrG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,yBAAe,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;iBACnE;wBAAS;oBACN,UAAU,CAAC,EAAE,GAAG,UAAU,CAAC;iBAC9B;aACJ;SACJ;IACL,CAAC;IAES,cAAc;QACpB,MAAM,GAAG,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5D,wEAAwE;QACxE,OAAO,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;CACH,CAAA;AA5BY,eAAe;IAD3B,IAAA,sBAAU,GAAE;GACA,eAAe,CA4B3B;AA5BY,0CAAe"}
@@ -0,0 +1,3 @@
1
+ import 'mocha';
2
+ import 'reflect-metadata';
3
+ //# sourceMappingURL=freeform-layout.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"freeform-layout.spec.d.ts","sourceRoot":"","sources":["../../../../src/features/layout/tests/freeform-layout.spec.ts"],"names":[],"mappings":"AAgBA,OAAO,OAAO,CAAC;AACf,OAAO,kBAAkB,CAAC"}
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /********************************************************************************
4
+ * Copyright (c) 2022 STMicroelectronics and others.
5
+ *
6
+ * This program and the accompanying materials are made available under the
7
+ * terms of the Eclipse Public License v. 2.0 which is available at
8
+ * http://www.eclipse.org/legal/epl-2.0.
9
+ *
10
+ * This Source Code may also be made available under the following Secondary
11
+ * Licenses when the conditions for such availability set forth in the Eclipse
12
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
13
+ * with the GNU Classpath Exception which is available at
14
+ * https://www.gnu.org/software/classpath/license.html.
15
+ *
16
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
17
+ ********************************************************************************/
18
+ const chai_1 = require("chai");
19
+ require("mocha");
20
+ require("reflect-metadata");
21
+ const sprotty_1 = require("sprotty");
22
+ const layouter_test_util_1 = require("./layouter-test-util");
23
+ describe('FreeFormLayouter', () => {
24
+ const layoutRegistry = (0, layouter_test_util_1.setupLayoutRegistry)();
25
+ const log = new sprotty_1.ConsoleLogger();
26
+ const map = new Map();
27
+ describe('issue-610', () => {
28
+ it('recursive hGrab/vGrab', () => {
29
+ /**
30
+ * _________________________
31
+ * | Category 1 |
32
+ * | _______________________ |
33
+ * || ||
34
+ * || ||
35
+ * || ||
36
+ * || ||
37
+ * ||_______________________||
38
+ * | _______________________ |
39
+ * ||_left____________right_||
40
+ * |_________________________|
41
+ *
42
+ * This test case checks recursive hGrab/vGrab functionality of nested compartments
43
+ * See also issue 610 for details and an example model https://github.com/eclipse-glsp/glsp/issues/610.
44
+ */
45
+ const model = (0, layouter_test_util_1.gModel)();
46
+ const category = (0, layouter_test_util_1.sNode)('category', 'vbox', { width: 410.0, height: 215.0 }, undefined, {
47
+ vGrab: false,
48
+ hGrab: false,
49
+ hAlign: 'center',
50
+ prefWidth: 410.0,
51
+ prefHeight: 215.0
52
+ });
53
+ const headerComp = (0, layouter_test_util_1.sComp)('comp:header', 'hbox');
54
+ headerComp.children = [(0, layouter_test_util_1.sLabel)('Category 1')];
55
+ const childContainer = (0, layouter_test_util_1.sComp)('struct', 'freeform', { hGrab: true, vGrab: true });
56
+ const labelContainer = (0, layouter_test_util_1.sComp)('struct', 'hbox', { hGrab: true });
57
+ labelContainer.children = [(0, layouter_test_util_1.sLabel)('left text', { hGrab: true }), (0, layouter_test_util_1.sLabel)('right text')];
58
+ category.children = [headerComp, childContainer, labelContainer];
59
+ model.add(category);
60
+ (0, layouter_test_util_1.layout)(layoutRegistry, log, map, model);
61
+ // check category
62
+ (0, chai_1.expect)(map.get(category).bounds).to.deep.equal({ x: 0, y: 0, width: 410.0, height: 215.0 });
63
+ // check header compartment
64
+ (0, chai_1.expect)(map.get(category.children[0]).bounds).to.deep.equal({ x: 0, y: 0, width: -1, height: -1 });
65
+ // check child freeform compartment
66
+ (0, chai_1.expect)(map.get(category.children[1]).bounds).to.deep.equal({ x: 5, y: 5, width: 400.0, height: 205.0 });
67
+ // check label compartment
68
+ (0, chai_1.expect)(map.get(category.children[2]).bounds).to.deep.equal({ x: 0, y: 0, width: -1, height: -1 });
69
+ });
70
+ });
71
+ describe('issue-694', () => {
72
+ it('Structure compartment (hGrab=true, vGrab=true), Left-aligned label (hGrab=true), right-aligned label (hGrab=false)', () => {
73
+ /**
74
+ * _________________________
75
+ * | Category 2 |
76
+ * | _______________________ |
77
+ * || ||
78
+ * || ||
79
+ * || Task node ||
80
+ * || ||
81
+ * ||_______________________||
82
+ * | _______________________ |
83
+ * ||_left____________right_||
84
+ * |_________________________|
85
+ */
86
+ const model = (0, layouter_test_util_1.gModel)();
87
+ const category = (0, layouter_test_util_1.sNode)('category', 'vbox', { width: 500.0, height: 375.0 }, undefined, {
88
+ vGrab: false,
89
+ hGrab: false,
90
+ hAlign: 'center',
91
+ prefWidth: 500.0,
92
+ prefHeight: 375.0
93
+ });
94
+ const headerComp = (0, layouter_test_util_1.sComp)('comp:header', 'hbox');
95
+ headerComp.children = [(0, layouter_test_util_1.sLabel)('Category 2')];
96
+ const childContainer = (0, layouter_test_util_1.sComp)('struct', 'freeform', { hGrab: true, vGrab: true });
97
+ const childNode = (0, layouter_test_util_1.sNode)('task', 'hbox', undefined, { x: 170, y: 190 });
98
+ childNode.children = [(0, layouter_test_util_1.sLabel)('Task node', undefined, { x: 5.0, y: 5.0 }, { width: 25.0, height: 20.0 })];
99
+ childContainer.children = [childNode];
100
+ const labelContainer = (0, layouter_test_util_1.sComp)('struct', 'hbox', { hGrab: true });
101
+ labelContainer.children = [(0, layouter_test_util_1.sLabel)('left text', { hGrab: true }), (0, layouter_test_util_1.sLabel)('right text')];
102
+ category.children = [headerComp, childContainer, labelContainer];
103
+ model.add(category);
104
+ // layout graph
105
+ (0, layouter_test_util_1.layout)(layoutRegistry, log, map, model);
106
+ // check category
107
+ (0, chai_1.expect)(map.get(category).bounds).to.deep.equal({ x: 0, y: 0, width: 500.0, height: 375.0 });
108
+ // check header compartment
109
+ (0, chai_1.expect)(map.get(category.children[0]).bounds).to.deep.equal({ x: 0, y: 0, width: -1, height: -1 });
110
+ // check child freeform compartment
111
+ (0, chai_1.expect)(map.get(category.children[1]).bounds).to.deep.equal({ x: 5.0, y: 5.0, width: 490.0, height: 365.0 });
112
+ // check child task node
113
+ (0, chai_1.expect)(map.get(category.children[1].children[0]).bounds).to.deep.equal({ x: 170.0, y: 190.0, width: 35.0, height: 30.0 });
114
+ // check label compartment
115
+ (0, chai_1.expect)(map.get(category.children[2]).bounds).to.deep.equal({ x: 0, y: 0, width: -1, height: -1 });
116
+ });
117
+ it('Structure compartment (hGrab=true, vGrab=true)', () => {
118
+ /**
119
+ * _________________________
120
+ * | Category 2 |
121
+ * | _______________________ |
122
+ * || ||
123
+ * || Task node ||
124
+ * || ||
125
+ * || ||
126
+ * ||_______________________||
127
+ * |_________________________|
128
+ */
129
+ const model = (0, layouter_test_util_1.gModel)();
130
+ const category = (0, layouter_test_util_1.sNode)('category', 'vbox', { width: 500.0, height: 375.0 }, undefined, {
131
+ vGrab: false,
132
+ hGrab: false,
133
+ hAlign: 'center',
134
+ prefWidth: 500.0,
135
+ prefHeight: 375.0
136
+ });
137
+ const headerComp = (0, layouter_test_util_1.sComp)('comp:header', 'hbox');
138
+ headerComp.children = [(0, layouter_test_util_1.sLabel)('Category 2')];
139
+ const childContainer = (0, layouter_test_util_1.sComp)('struct', 'freeform', { hGrab: true, vGrab: true });
140
+ const childNode = (0, layouter_test_util_1.sNode)('task', 'hbox', undefined, { x: 55, y: 15 });
141
+ childNode.children = [(0, layouter_test_util_1.sLabel)('Task node', undefined, undefined, { width: 50.0, height: 35.0 })];
142
+ childContainer.children = [childNode];
143
+ category.children = [headerComp, childContainer];
144
+ model.add(category);
145
+ // layout graph
146
+ (0, layouter_test_util_1.layout)(layoutRegistry, log, map, model);
147
+ // check category
148
+ (0, chai_1.expect)(map.get(category).bounds).to.deep.equal({ x: 0, y: 0, width: 500.0, height: 375.0 });
149
+ // check header compartment
150
+ (0, chai_1.expect)(map.get(category.children[0]).bounds).to.deep.equal({ x: 0, y: 0, width: -1, height: -1 });
151
+ // check child freeform compartment
152
+ (0, chai_1.expect)(map.get(category.children[1]).bounds).to.deep.equal({ x: 5.0, y: 5.0, width: 490.0, height: 365.0 });
153
+ // check child task node
154
+ (0, chai_1.expect)(map.get(category.children[1].children[0]).bounds).to.deep.equal({ x: 55.0, y: 15.0, width: 60.0, height: 45.0 });
155
+ });
156
+ it('Structure compartment (hGrab=true, vGrab=true, padding*=10)', () => {
157
+ /**
158
+ * _________________________
159
+ * | Category 2 |
160
+ * | _______________________ |
161
+ * || ||
162
+ * || Task node ||
163
+ * || ||
164
+ * || ||
165
+ * ||_______________________||
166
+ * |_________________________|
167
+ */
168
+ const model = (0, layouter_test_util_1.gModel)();
169
+ const category = (0, layouter_test_util_1.sNode)('category', 'vbox', { width: 500.0, height: 375.0 }, undefined, {
170
+ vGrab: false,
171
+ hGrab: false,
172
+ hAlign: 'center',
173
+ prefWidth: 500.0,
174
+ prefHeight: 375.0,
175
+ paddingLeft: 10,
176
+ paddingRight: 10,
177
+ paddingTop: 10,
178
+ paddingBottom: 10
179
+ });
180
+ const headerComp = (0, layouter_test_util_1.sComp)('comp:header', 'hbox');
181
+ headerComp.children = [(0, layouter_test_util_1.sLabel)('Category 2')];
182
+ const childContainer = (0, layouter_test_util_1.sComp)('struct', 'freeform', { hGrab: true, vGrab: true });
183
+ const childNode = (0, layouter_test_util_1.sNode)('task', 'hbox', undefined, { x: 55, y: 15 }, { paddingLeft: 10, paddingRight: 10, paddingTop: 10, paddingBottom: 10 });
184
+ childNode.children = [(0, layouter_test_util_1.sLabel)('Task node', undefined, undefined, { width: 50.0, height: 35.0 })];
185
+ childContainer.children = [childNode];
186
+ category.children = [headerComp, childContainer];
187
+ model.add(category);
188
+ // layout graph
189
+ (0, layouter_test_util_1.layout)(layoutRegistry, log, map, model);
190
+ // check category
191
+ (0, chai_1.expect)(map.get(category).bounds).to.deep.equal({ x: 0, y: 0, width: 500.0, height: 375.0 });
192
+ // check header compartment
193
+ (0, chai_1.expect)(map.get(category.children[0]).bounds).to.deep.equal({ x: 0, y: 0, width: -1, height: -1 });
194
+ // check child freeform compartment
195
+ (0, chai_1.expect)(map.get(category.children[1]).bounds).to.deep.equal({ x: 10.0, y: 10.0, width: 480.0, height: 355.0 });
196
+ // check child task node
197
+ (0, chai_1.expect)(map.get(category.children[1].children[0]).bounds).to.deep.equal({ x: 55.0, y: 15.0, width: 70.0, height: 55.0 });
198
+ });
199
+ });
200
+ });
201
+ //# sourceMappingURL=freeform-layout.spec.js.map