@eclipse-glsp/client 0.10.0-next.88e4725.166 → 0.10.0-next.aa813a8.174

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 (119) hide show
  1. package/lib/base/auto-complete/auto-complete-widget.d.ts +7 -0
  2. package/lib/base/auto-complete/auto-complete-widget.d.ts.map +1 -1
  3. package/lib/base/auto-complete/auto-complete-widget.js +7 -0
  4. package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
  5. package/lib/base/container-modules.d.ts.map +1 -1
  6. package/lib/base/container-modules.js +2 -1
  7. package/lib/base/container-modules.js.map +1 -1
  8. package/lib/base/editor-context-service.d.ts +14 -3
  9. package/lib/base/editor-context-service.d.ts.map +1 -1
  10. package/lib/base/editor-context-service.js +23 -12
  11. package/lib/base/editor-context-service.js.map +1 -1
  12. package/lib/base/source-uri-aware.d.ts +2 -17
  13. package/lib/base/source-uri-aware.d.ts.map +1 -1
  14. package/lib/base/source-uri-aware.js +4 -6
  15. package/lib/base/source-uri-aware.js.map +1 -1
  16. package/lib/features/change-bounds/movement-restrictor.d.ts +36 -6
  17. package/lib/features/change-bounds/movement-restrictor.d.ts.map +1 -1
  18. package/lib/features/change-bounds/movement-restrictor.js +54 -39
  19. package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
  20. package/lib/features/change-bounds/snap.d.ts +2 -3
  21. package/lib/features/change-bounds/snap.d.ts.map +1 -1
  22. package/lib/features/change-bounds/snap.js.map +1 -1
  23. package/lib/features/layout/di.config.d.ts +2 -2
  24. package/lib/features/layout/di.config.d.ts.map +1 -1
  25. package/lib/features/layout/di.config.js +9 -5
  26. package/lib/features/layout/di.config.js.map +1 -1
  27. package/lib/features/layout/hbox-layout.d.ts +41 -0
  28. package/lib/features/layout/hbox-layout.d.ts.map +1 -0
  29. package/lib/features/layout/hbox-layout.js +189 -0
  30. package/lib/features/layout/hbox-layout.js.map +1 -0
  31. package/lib/features/layout/{layout-commands.d.ts → layout-elements-action.d.ts} +75 -57
  32. package/lib/features/layout/layout-elements-action.d.ts.map +1 -0
  33. package/lib/features/layout/{layout-commands.js → layout-elements-action.js} +153 -197
  34. package/lib/features/layout/layout-elements-action.js.map +1 -0
  35. package/lib/features/layout/layout-elements-action.spec.d.ts +3 -0
  36. package/lib/features/layout/layout-elements-action.spec.d.ts.map +1 -0
  37. package/lib/features/layout/{layout-commands.spec.js → layout-elements-action.spec.js} +63 -56
  38. package/lib/features/layout/layout-elements-action.spec.js.map +1 -0
  39. package/lib/features/select/selection-service.d.ts +12 -3
  40. package/lib/features/select/selection-service.d.ts.map +1 -1
  41. package/lib/features/select/selection-service.js +31 -45
  42. package/lib/features/select/selection-service.js.map +1 -1
  43. package/lib/features/select/selection-service.spec.js +1 -1
  44. package/lib/features/select/selection-service.spec.js.map +1 -1
  45. package/lib/features/tool-feedback/change-bounds-tool-feedback.js +1 -1
  46. package/lib/features/tool-feedback/change-bounds-tool-feedback.js.map +1 -1
  47. package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts +3 -2
  48. package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts.map +1 -1
  49. package/lib/features/tool-feedback/edge-edit-tool-feedback.js +13 -6
  50. package/lib/features/tool-feedback/edge-edit-tool-feedback.js.map +1 -1
  51. package/lib/features/tools/di.config.d.ts +9 -2
  52. package/lib/features/tools/di.config.d.ts.map +1 -1
  53. package/lib/features/tools/di.config.js +14 -3
  54. package/lib/features/tools/di.config.js.map +1 -1
  55. package/lib/features/tools/enable-default-tools-on-focus-loss.d.ts +26 -0
  56. package/lib/features/tools/enable-default-tools-on-focus-loss.d.ts.map +1 -0
  57. package/lib/features/tools/enable-default-tools-on-focus-loss.js +29 -0
  58. package/lib/features/tools/enable-default-tools-on-focus-loss.js.map +1 -0
  59. package/lib/features/validation/di.config.d.ts +0 -15
  60. package/lib/features/validation/di.config.d.ts.map +1 -1
  61. package/lib/features/validation/di.config.js +6 -4
  62. package/lib/features/validation/di.config.js.map +1 -1
  63. package/lib/features/validation/marker-navigator.d.ts +11 -17
  64. package/lib/features/validation/marker-navigator.d.ts.map +1 -1
  65. package/lib/features/validation/marker-navigator.js +32 -61
  66. package/lib/features/validation/marker-navigator.js.map +1 -1
  67. package/lib/features/validation/validate.d.ts +8 -19
  68. package/lib/features/validation/validate.d.ts.map +1 -1
  69. package/lib/features/validation/validate.js +23 -52
  70. package/lib/features/validation/validate.js.map +1 -1
  71. package/lib/index.d.ts +4 -4
  72. package/lib/index.d.ts.map +1 -1
  73. package/lib/index.js +5 -4
  74. package/lib/index.js.map +1 -1
  75. package/lib/lib/model.d.ts +1 -1
  76. package/lib/lib/model.d.ts.map +1 -1
  77. package/lib/lib/model.js +3 -3
  78. package/lib/lib/model.js.map +1 -1
  79. package/lib/model-source/glsp-diagram-server.d.ts +1 -1
  80. package/lib/model-source/glsp-diagram-server.d.ts.map +1 -1
  81. package/lib/model-source/glsp-diagram-server.js +1 -1
  82. package/lib/model-source/glsp-diagram-server.js.map +1 -1
  83. package/lib/utils/layout-utils.d.ts +4 -20
  84. package/lib/utils/layout-utils.d.ts.map +1 -1
  85. package/lib/utils/layout-utils.js +1 -1
  86. package/lib/utils/layout-utils.js.map +1 -1
  87. package/lib/views/base-view-module.d.ts.map +1 -1
  88. package/lib/views/base-view-module.js +3 -1
  89. package/lib/views/base-view-module.js.map +1 -1
  90. package/package.json +3 -3
  91. package/src/base/auto-complete/auto-complete-widget.ts +7 -0
  92. package/src/base/container-modules.ts +4 -3
  93. package/src/base/editor-context-service.ts +27 -7
  94. package/src/base/source-uri-aware.ts +5 -4
  95. package/src/features/change-bounds/movement-restrictor.ts +73 -43
  96. package/src/features/change-bounds/snap.ts +2 -3
  97. package/src/features/layout/di.config.ts +10 -6
  98. package/src/features/layout/hbox-layout.ts +256 -0
  99. package/src/features/layout/{layout-commands.spec.ts → layout-elements-action.spec.ts} +56 -48
  100. package/src/features/layout/{layout-commands.ts → layout-elements-action.ts} +195 -207
  101. package/src/features/select/selection-service.spec.ts +1 -1
  102. package/src/features/select/selection-service.ts +37 -50
  103. package/src/features/tool-feedback/change-bounds-tool-feedback.ts +1 -1
  104. package/src/features/tool-feedback/edge-edit-tool-feedback.ts +14 -6
  105. package/src/features/tools/di.config.ts +13 -2
  106. package/src/features/tools/enable-default-tools-on-focus-loss.ts +33 -0
  107. package/src/features/validation/di.config.ts +10 -7
  108. package/src/features/validation/marker-navigator.ts +29 -66
  109. package/src/features/validation/validate.ts +30 -67
  110. package/src/index.ts +5 -4
  111. package/src/lib/model.ts +1 -1
  112. package/src/model-source/glsp-diagram-server.ts +1 -1
  113. package/src/utils/layout-utils.ts +7 -27
  114. package/src/views/base-view-module.ts +5 -1
  115. package/lib/features/layout/layout-commands.d.ts.map +0 -1
  116. package/lib/features/layout/layout-commands.js.map +0 -1
  117. package/lib/features/layout/layout-commands.spec.d.ts +0 -3
  118. package/lib/features/layout/layout-commands.spec.d.ts.map +0 -1
  119. package/lib/features/layout/layout-commands.spec.js.map +0 -1
@@ -0,0 +1,41 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2021-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 { Bounds, Dimension, Point } from '@eclipse-glsp/protocol';
17
+ import { BoundsData, LayoutContainer, SChildElement, SModelElement, SParentElement, StatefulLayouter, HBoxLayouter, HBoxLayoutOptions } from 'sprotty';
18
+ export interface HBoxLayoutOptionsExt extends HBoxLayoutOptions {
19
+ hGrab: boolean;
20
+ vGrab: boolean;
21
+ prefWidth: number | null;
22
+ prefHeight: number | null;
23
+ }
24
+ /**
25
+ * Extends HBoxLayouter to support additional layout options
26
+ */
27
+ export declare class HBoxLayouterExt extends HBoxLayouter {
28
+ static KIND: string;
29
+ layout(container: SParentElement & LayoutContainer, layouter: StatefulLayouter): void;
30
+ protected getChildrenSize(container: SParentElement & LayoutContainer, containerOptions: HBoxLayoutOptionsExt, layouter: StatefulLayouter): Dimension;
31
+ protected layoutChildren(container: SParentElement & LayoutContainer, layouter: StatefulLayouter, containerOptions: HBoxLayoutOptionsExt, maxWidth: number, maxHeight: number, grabWidth?: number, grabbingChildren?: number): Point;
32
+ protected layoutChild(child: SChildElement, boundsData: BoundsData, bounds: Bounds, childOptions: HBoxLayoutOptionsExt, containerOptions: HBoxLayoutOptionsExt, currentOffset: Point, maxWidth: number, maxHeight: number, grabWidth?: number, grabbingChildren?: number): Point;
33
+ protected getFixedContainerBounds(container: SModelElement, layoutOptions: HBoxLayoutOptionsExt, layouter: StatefulLayouter): Bounds;
34
+ protected getChildLayoutOptions(child: SChildElement, containerOptions: HBoxLayoutOptionsExt): HBoxLayoutOptionsExt;
35
+ protected getLayoutOptions(element: SModelElement): HBoxLayoutOptionsExt;
36
+ protected getElementLayoutOptions(element: SModelElement): HBoxLayoutOptionsExt | undefined;
37
+ protected getFinalContainerBounds(container: SParentElement & LayoutContainer, lastOffset: Point, options: HBoxLayoutOptionsExt, maxWidth: number, maxHeight: number): Bounds;
38
+ protected getDefaultLayoutOptions(): HBoxLayoutOptionsExt;
39
+ protected spread(a: HBoxLayoutOptionsExt, b: HBoxLayoutOptionsExt): HBoxLayoutOptionsExt;
40
+ }
41
+ //# sourceMappingURL=hbox-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hbox-layout.d.ts","sourceRoot":"","sources":["../../../src/features/layout/hbox-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM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Aa,EAAE,oBAAoB,EACnC,QAAQ,EAAE,gBAAgB,GAC3B,MAAM;cAaU,qBAAqB,CAAC,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,GAAG,oBAAoB;cAIzG,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,oBAAoB;IAIjF,SAAS,CAAC,uBAAuB,CAAC,OAAO,EAAE,aAAa,GAAG,oBAAoB,GAAG,SAAS;cAIxE,uBAAuB,CACtC,SAAS,EAAE,cAAc,GAAG,eAAe,EAC3C,UAAU,EAAE,KAAK,EACjB,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAClB,MAAM;cAeU,uBAAuB,IAAI,oBAAoB;cAqB/C,MAAM,CAAC,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,oBAAoB,GAAG,oBAAoB;CAGpG"}
@@ -0,0 +1,189 @@
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.HBoxLayouterExt = void 0;
10
+ /********************************************************************************
11
+ * Copyright (c) 2021-2022 EclipseSource and others.
12
+ *
13
+ * This program and the accompanying materials are made available under the
14
+ * terms of the Eclipse Public License v. 2.0 which is available at
15
+ * http://www.eclipse.org/legal/epl-2.0.
16
+ *
17
+ * This Source Code may also be made available under the following Secondary
18
+ * Licenses when the conditions for such availability set forth in the Eclipse
19
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
20
+ * with the GNU Classpath Exception which is available at
21
+ * https://www.gnu.org/software/classpath/license.html.
22
+ *
23
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
24
+ ********************************************************************************/
25
+ const protocol_1 = require("@eclipse-glsp/protocol");
26
+ const inversify_1 = require("inversify");
27
+ const sprotty_1 = require("sprotty");
28
+ /**
29
+ * Extends HBoxLayouter to support additional layout options
30
+ */
31
+ let HBoxLayouterExt = class HBoxLayouterExt extends sprotty_1.HBoxLayouter {
32
+ layout(container, layouter) {
33
+ const boundsData = layouter.getBoundsData(container);
34
+ const options = this.getLayoutOptions(container);
35
+ const childrenSize = this.getChildrenSize(container, options, layouter);
36
+ const fixedSize = this.getFixedContainerBounds(container, options, layouter);
37
+ const maxWidth = options.paddingFactor *
38
+ (options.resizeContainer
39
+ ? Math.max(fixedSize.width - options.paddingLeft - options.paddingRight, childrenSize.width)
40
+ : Math.max(0, fixedSize.width - options.paddingLeft - options.paddingRight));
41
+ const maxHeight = options.paddingFactor *
42
+ (options.resizeContainer
43
+ ? Math.max(fixedSize.height - options.paddingTop - options.paddingBottom, childrenSize.height)
44
+ : Math.max(0, fixedSize.height - options.paddingTop - options.paddingBottom));
45
+ // Remaining size that can be grabbed by children with the hGrab option
46
+ const grabWidth = maxWidth - childrenSize.width;
47
+ // Number of children that request hGrab
48
+ // FIXME: This approach works fine when only 1 child uses HGrab, but may cause rounding issues
49
+ // when the grabHeight can't be equally shared by all children.
50
+ const grabbingChildren = container.children
51
+ .map(child => this.getChildLayoutOptions(child, options))
52
+ .filter(opt => opt.hGrab).length;
53
+ if (maxWidth > 0 && maxHeight > 0) {
54
+ const offset = this.layoutChildren(container, layouter, options, maxWidth, maxHeight, grabWidth, grabbingChildren);
55
+ boundsData.bounds = this.getFinalContainerBounds(container, offset, options, childrenSize.width, childrenSize.height);
56
+ boundsData.boundsChanged = true;
57
+ }
58
+ }
59
+ getChildrenSize(container, containerOptions, layouter) {
60
+ let maxWidth = 0;
61
+ let maxHeight = -1;
62
+ let isFirst = true;
63
+ container.children.forEach(child => {
64
+ if ((0, sprotty_1.isLayoutableChild)(child)) {
65
+ const bounds = layouter.getBoundsData(child).bounds;
66
+ if (bounds !== undefined && protocol_1.Dimension.isValid(bounds)) {
67
+ maxWidth += bounds.width;
68
+ if (isFirst) {
69
+ isFirst = false;
70
+ }
71
+ else {
72
+ maxWidth += containerOptions.hGap;
73
+ }
74
+ maxHeight = Math.max(maxHeight, bounds.height);
75
+ }
76
+ }
77
+ });
78
+ const result = {
79
+ width: maxWidth,
80
+ height: maxHeight
81
+ };
82
+ return result;
83
+ }
84
+ layoutChildren(container, layouter, containerOptions, maxWidth, maxHeight, grabWidth, grabbingChildren) {
85
+ let currentOffset = {
86
+ x: containerOptions.paddingLeft + 0.5 * (maxWidth - maxWidth / containerOptions.paddingFactor),
87
+ y: containerOptions.paddingTop + 0.5 * (maxHeight - maxHeight / containerOptions.paddingFactor)
88
+ };
89
+ container.children.forEach(child => {
90
+ if ((0, sprotty_1.isLayoutableChild)(child)) {
91
+ const boundsData = layouter.getBoundsData(child);
92
+ const bounds = boundsData.bounds;
93
+ const childOptions = this.getChildLayoutOptions(child, containerOptions);
94
+ if (bounds !== undefined && protocol_1.Dimension.isValid(bounds)) {
95
+ currentOffset = this.layoutChild(child, boundsData, bounds, childOptions, containerOptions, currentOffset, maxWidth, maxHeight, grabWidth, grabbingChildren);
96
+ }
97
+ }
98
+ });
99
+ return currentOffset;
100
+ }
101
+ layoutChild(child, boundsData, bounds, childOptions, containerOptions, currentOffset, maxWidth, maxHeight, grabWidth, grabbingChildren) {
102
+ let offset = super.layoutChild(child, boundsData, bounds, childOptions, containerOptions, currentOffset, maxWidth, maxHeight);
103
+ if (childOptions.hGrab) {
104
+ boundsData.bounds = {
105
+ x: boundsData.bounds.x,
106
+ y: boundsData.bounds.y,
107
+ width: boundsData.bounds.width,
108
+ height: maxHeight
109
+ };
110
+ boundsData.boundsChanged = true;
111
+ }
112
+ if (childOptions.hGrab && grabWidth && grabbingChildren) {
113
+ const width = boundsData.bounds.width + grabWidth / grabbingChildren;
114
+ boundsData.bounds = {
115
+ x: boundsData.bounds.x,
116
+ y: boundsData.bounds.y,
117
+ width: width,
118
+ height: boundsData.bounds.height
119
+ };
120
+ boundsData.boundsChanged = true;
121
+ offset = { x: currentOffset.x + width, y: currentOffset.y };
122
+ }
123
+ return offset;
124
+ }
125
+ getFixedContainerBounds(container, layoutOptions, layouter) {
126
+ var _a, _b;
127
+ const currentContainer = container;
128
+ // eslint-disable-next-line no-constant-condition
129
+ if ((0, sprotty_1.isBoundsAware)(currentContainer)) {
130
+ const bounds = currentContainer.bounds;
131
+ const elementOptions = this.getElementLayoutOptions(currentContainer);
132
+ const width = (_a = elementOptions === null || elementOptions === void 0 ? void 0 : elementOptions.prefWidth) !== null && _a !== void 0 ? _a : 0;
133
+ const height = (_b = elementOptions === null || elementOptions === void 0 ? void 0 : elementOptions.prefHeight) !== null && _b !== void 0 ? _b : 0;
134
+ return Object.assign(Object.assign({}, bounds), { width, height });
135
+ }
136
+ return protocol_1.Bounds.EMPTY;
137
+ }
138
+ getChildLayoutOptions(child, containerOptions) {
139
+ return super.getChildLayoutOptions(child, containerOptions);
140
+ }
141
+ getLayoutOptions(element) {
142
+ return super.getLayoutOptions(element);
143
+ }
144
+ getElementLayoutOptions(element) {
145
+ return element.layoutOptions;
146
+ }
147
+ getFinalContainerBounds(container, lastOffset, options, maxWidth, maxHeight) {
148
+ var _a, _b;
149
+ const elementOptions = this.getElementLayoutOptions(container);
150
+ const width = (_a = elementOptions === null || elementOptions === void 0 ? void 0 : elementOptions.prefWidth) !== null && _a !== void 0 ? _a : options.minWidth;
151
+ const height = (_b = elementOptions === null || elementOptions === void 0 ? void 0 : elementOptions.prefHeight) !== null && _b !== void 0 ? _b : options.minHeight;
152
+ const result = {
153
+ x: container.bounds.x,
154
+ y: container.bounds.y,
155
+ width: Math.max(width, maxWidth + options.paddingLeft + options.paddingRight),
156
+ height: Math.max(height, maxHeight + options.paddingTop + options.paddingBottom)
157
+ };
158
+ return result;
159
+ }
160
+ getDefaultLayoutOptions() {
161
+ return {
162
+ resizeContainer: true,
163
+ paddingTop: 5,
164
+ paddingBottom: 5,
165
+ paddingLeft: 5,
166
+ paddingRight: 5,
167
+ paddingFactor: 1,
168
+ hGap: 1,
169
+ vAlign: 'center',
170
+ minWidth: 0,
171
+ minHeight: 0,
172
+ hGrab: false,
173
+ vGrab: false,
174
+ // eslint-disable-next-line no-null/no-null
175
+ prefHeight: null,
176
+ // eslint-disable-next-line no-null/no-null
177
+ prefWidth: null
178
+ };
179
+ }
180
+ spread(a, b) {
181
+ return Object.assign(Object.assign({}, a), b);
182
+ }
183
+ };
184
+ HBoxLayouterExt.KIND = sprotty_1.HBoxLayouter.KIND;
185
+ HBoxLayouterExt = __decorate([
186
+ (0, inversify_1.injectable)()
187
+ ], HBoxLayouterExt);
188
+ exports.HBoxLayouterExt = HBoxLayouterExt;
189
+ //# sourceMappingURL=hbox-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hbox-layout.js","sourceRoot":"","sources":["../../../src/features/layout/hbox-layout.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAkE;AAClE,yCAAuC;AACvC,qCAWiB;AASjB;;GAEG;AAEH,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,sBAAY;IAGpC,MAAM,CAAC,SAA2C,EAAE,QAA0B;QACnF,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACrD,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAExE,MAAM,SAAS,GAAG,IAAI,CAAC,uBAAuB,CAAC,SAAS,EAAE,OAAO,EAAE,QA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;IAEkB,uBAAuB;QACtC,OAAO;YACH,eAAe,EAAE,IAAI;YACrB,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,CAAC;YAChB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;YACf,aAAa,EAAE,CAAC;YAChB,IAAI,EAAE,CAAC;YACP,MAAM,EAAE,QAAQ;YAChB,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,CAAC;YACZ,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,KAAK;YACZ,2CAA2C;YAC3C,UAAU,EAAE,IAAI;YAChB,2CAA2C;YAC3C,SAAS,EAAE,IAAI;SAClB,CAAC;IACN,CAAC;IAEkB,MAAM,CAAC,CAAuB,EAAE,CAAuB;QACtE,uCAAY,CAAC,GAAK,CAAC,EAAG;IAC1B,CAAC;CACJ,CAAA;AArNmB,oBAAI,GAAG,sBAAY,CAAC,IAAK,CAAA;AADhC,eAAe;IAD3B,IAAA,sBAAU,GAAE;GACA,eAAe,CAsN3B;AAtNY,0CAAe"}
@@ -13,9 +13,8 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { Action, ElementAndBounds } from '@eclipse-glsp/protocol';
17
- import { Command, CommandExecutionContext, CommandReturn, ElementMove, IActionDispatcher, SModelElement } from 'sprotty';
18
- import { WriteableElementAndBounds, WriteableElementMove } from '../../utils/layout-utils';
16
+ import { Action, ElementAndBounds, Writable } from '@eclipse-glsp/protocol';
17
+ import { ElementMove, IActionDispatcher, IActionHandler, ICommand, SModelElement } from 'sprotty';
19
18
  import { BoundsAwareModelElement } from '../../utils/smodel-util';
20
19
  import { IMovementRestrictor } from '../change-bounds/movement-restrictor';
21
20
  import { SelectionService } from '../select/selection-service';
@@ -27,7 +26,13 @@ export declare enum ResizeDimension {
27
26
  Height = 1,
28
27
  Width_And_Height = 2
29
28
  }
30
- export declare namespace Reduce {
29
+ /**
30
+ * A function that computes a single number from a set of given numbers
31
+ * i.e. it reduces the given numbers to one single number.
32
+ * Mainly used by the {@link ResizeElementsCommand} to reduce the given dimensions to a target dimension value.
33
+ */
34
+ export declare type ReduceFunction = (...values: number[]) => number;
35
+ export declare namespace ReduceFunction {
31
36
  /**
32
37
  * Returns the minimal value of the given numbers.
33
38
  * @param values Numbers to be evaluated.
@@ -58,12 +63,14 @@ export declare namespace Reduce {
58
63
  */
59
64
  function last(...values: number[]): number;
60
65
  /**
61
- * Returns the reduce function that corresponds to the given {@link ReduceFunctionKind}.
66
+ * Returns the reduce function that corresponds to the given {@link ReduceFunctionType}.
62
67
  * @param type The reduce function kind.
63
68
  * @returns The corresponding reduce function.
64
69
  */
70
+ function get(type: ReduceFunctionType): ReduceFunction;
65
71
  }
66
- declare type ReduceFn = (...values: number[]) => number;
72
+ /** Union type of all {@link ReduceFunction} keys. */
73
+ export declare type ReduceFunctionType = Exclude<keyof typeof ReduceFunction, 'get'>;
67
74
  export interface ResizeElementsAction extends Action {
68
75
  kind: typeof ResizeElementsAction.KIND;
69
76
  /**
@@ -75,9 +82,9 @@ export interface ResizeElementsAction extends Action {
75
82
  */
76
83
  dimension: ResizeDimension;
77
84
  /**
78
- * Function to reduce the dimension to a target dimension value, see Reduce.* for potential functions.
85
+ * Type of the {@link ReduceFunction} that should be used to reduce the dimension to a target dimension value
79
86
  */
80
- reductionFunction: ReduceFn;
87
+ reduceFunction: ReduceFunctionType;
81
88
  }
82
89
  export declare namespace ResizeElementsAction {
83
90
  const KIND = "resizeElementAction";
@@ -85,9 +92,30 @@ export declare namespace ResizeElementsAction {
85
92
  function create(options: {
86
93
  elementIds?: string[];
87
94
  dimension?: ResizeDimension;
88
- reductionFunction: ReduceFn;
95
+ reduceFunction: ReduceFunctionType;
89
96
  }): ResizeElementsAction;
90
97
  }
98
+ export declare abstract class LayoutElementsActionHandler implements IActionHandler {
99
+ protected actionDispatcher: IActionDispatcher;
100
+ protected selectionService: SelectionService;
101
+ protected movementRestrictor?: IMovementRestrictor;
102
+ abstract handle(action: Action): void | Action | ICommand;
103
+ getSelectedElements(selection: {
104
+ elementIds: string[];
105
+ }): BoundsAwareModelElement[];
106
+ protected abstract isActionElement(element: SModelElement): element is BoundsAwareModelElement;
107
+ dispatchAction(action: Action): void;
108
+ dispatchActions(actions: Action[]): void;
109
+ }
110
+ export declare class ResizeElementsActionHandler extends LayoutElementsActionHandler {
111
+ handle(action: ResizeElementsAction): void;
112
+ resizeWidth(elements: BoundsAwareModelElement[], reduceFn: ReduceFunction): void;
113
+ resizeHeight(elements: BoundsAwareModelElement[], reduceFn: ReduceFunction): void;
114
+ resizeWidthAndHeight(elements: BoundsAwareModelElement[], reduceFn: ReduceFunction): void;
115
+ dispatchResizeActions(elements: BoundsAwareModelElement[], change: (element: BoundsAwareModelElement, bounds: Writable<ElementAndBounds>) => void): void;
116
+ createElementAndBounds(element: BoundsAwareModelElement, change: (_element: BoundsAwareModelElement, _bounds: Writable<ElementAndBounds>) => void): Writable<ElementAndBounds> | undefined;
117
+ protected isActionElement(element: SModelElement): element is BoundsAwareModelElement;
118
+ }
91
119
  export declare enum Alignment {
92
120
  Left = 0,
93
121
  Center = 1,
@@ -96,12 +124,39 @@ export declare enum Alignment {
96
124
  Middle = 4,
97
125
  Bottom = 5
98
126
  }
99
- export declare namespace Select {
127
+ /**
128
+ * A function that retrieves a specific (sub)-selection of elements from a given set of elements.
129
+ * Mainly used by the {@link AlignElementsActionHandler}.
130
+ */
131
+ export declare type SelectFunction = (elements: BoundsAwareModelElement[]) => BoundsAwareModelElement[];
132
+ export declare namespace SelectFunction {
133
+ /**
134
+ * Select all elements from the given set of elements.
135
+ * @param elements The set of elements.
136
+ * @returns All elements.
137
+ */
100
138
  function all(elements: BoundsAwareModelElement[]): BoundsAwareModelElement[];
139
+ /**
140
+ * Select the first element from a given set of elements.
141
+ * @param elements The elements.
142
+ * @returns An array containing the first element of the given elements.
143
+ */
101
144
  function first(elements: BoundsAwareModelElement[]): BoundsAwareModelElement[];
145
+ /**
146
+ * Select the last element from a given set of elements.
147
+ * @param elements The elements.
148
+ * @returns An array containing the last element of the given elements.
149
+ */
102
150
  function last(elements: BoundsAwareModelElement[]): BoundsAwareModelElement[];
151
+ /**
152
+ * Returns the select function that corresponds to the given {@link SelectFunctionType}.
153
+ * @param type The select function type.
154
+ * @returns The corresponding select function.
155
+ */
156
+ function get(kind: SelectFunctionType): SelectFunction;
103
157
  }
104
- declare type SelectFn = (elements: BoundsAwareModelElement[]) => BoundsAwareModelElement[];
158
+ /** Union type of all {@link SelectFunction} keys. */
159
+ export declare type SelectFunctionType = Exclude<keyof typeof SelectFunction, 'get'>;
105
160
  export interface AlignElementsAction extends Action {
106
161
  kind: typeof AlignElementsAction.KIND;
107
162
  /**
@@ -113,10 +168,10 @@ export interface AlignElementsAction extends Action {
113
168
  */
114
169
  alignment: Alignment;
115
170
  /**
116
- * Function to selected elements that are considered during alignment calculation, see Select.* for potential functions.
171
+ * Function to selected elements that are considered during alignment calculation.
117
172
  * The default value is {@link Select.all}.
118
173
  */
119
- selectionFunction: SelectFn;
174
+ selectFunction: SelectFunctionType;
120
175
  }
121
176
  export declare namespace AlignElementsAction {
122
177
  const KIND = "alignElements";
@@ -124,57 +179,20 @@ export declare namespace AlignElementsAction {
124
179
  function create(options?: {
125
180
  elementIds?: string[];
126
181
  alignment?: Alignment;
127
- selectionFunction?: SelectFn;
182
+ selectionFunction?: SelectFunctionType;
128
183
  }): AlignElementsAction;
129
184
  }
130
- declare abstract class LayoutElementsCommand extends Command {
131
- protected action: ResizeElementsAction | AlignElementsAction;
132
- protected actionDispatcher: IActionDispatcher;
133
- protected selectionService: SelectionService;
134
- readonly movementRestrictor?: IMovementRestrictor | undefined;
135
- constructor(action: ResizeElementsAction | AlignElementsAction, actionDispatcher: IActionDispatcher, selectionService: SelectionService, movementRestrictor?: IMovementRestrictor | undefined);
136
- getActionElements(context: CommandExecutionContext): BoundsAwareModelElement[];
137
- protected abstract isActionElement(element: SModelElement): element is BoundsAwareModelElement;
138
- dispatchAction(action: Action): void;
139
- dispatchActions(actions: Action[]): void;
140
- }
141
- export declare class ResizeElementsCommand extends LayoutElementsCommand {
142
- protected action: ResizeElementsAction;
143
- protected actionDispatcher: IActionDispatcher;
144
- protected selectionService: SelectionService;
145
- readonly movementRestrictor?: IMovementRestrictor | undefined;
146
- static readonly KIND = "resizeElementAction";
147
- constructor(action: ResizeElementsAction, actionDispatcher: IActionDispatcher, selectionService: SelectionService, movementRestrictor?: IMovementRestrictor | undefined);
148
- protected isActionElement(element: SModelElement): element is BoundsAwareModelElement;
149
- execute(context: CommandExecutionContext): CommandReturn;
150
- resizeWidth(elements: BoundsAwareModelElement[]): void;
151
- resizeHeight(elements: BoundsAwareModelElement[]): void;
152
- resizeWidthAndHeight(elements: BoundsAwareModelElement[]): void;
153
- dispatchResizeActions(elements: BoundsAwareModelElement[], change: (element: BoundsAwareModelElement, bounds: WriteableElementAndBounds) => void): void;
154
- createElementAndBounds(element: BoundsAwareModelElement, change: (_element: BoundsAwareModelElement, _bounds: WriteableElementAndBounds) => void): WriteableElementAndBounds | undefined;
155
- undo(context: CommandExecutionContext): CommandReturn;
156
- redo(context: CommandExecutionContext): CommandReturn;
157
- }
158
- export declare class AlignElementsCommand extends LayoutElementsCommand {
159
- protected action: AlignElementsAction;
160
- protected actionDispatcher: IActionDispatcher;
161
- protected selectionService: SelectionService;
162
- readonly movementRestrictor?: IMovementRestrictor | undefined;
163
- static readonly KIND = "alignElements";
164
- constructor(action: AlignElementsAction, actionDispatcher: IActionDispatcher, selectionService: SelectionService, movementRestrictor?: IMovementRestrictor | undefined);
165
- protected isActionElement(element: SModelElement): element is BoundsAwareModelElement;
166
- execute(context: CommandExecutionContext): CommandReturn;
185
+ export declare class AlignElementsActionHandler extends LayoutElementsActionHandler {
186
+ handle(action: AlignElementsAction): void;
167
187
  alignLeft(elements: BoundsAwareModelElement[]): void;
168
188
  alignCenter(elements: BoundsAwareModelElement[]): void;
169
189
  alignRight(elements: BoundsAwareModelElement[]): void;
170
190
  alignTop(elements: BoundsAwareModelElement[]): void;
171
191
  alignMiddle(elements: BoundsAwareModelElement[]): void;
172
192
  alignBottom(elements: BoundsAwareModelElement[]): void;
173
- dispatchAlignActions(elements: BoundsAwareModelElement[], change: (element: BoundsAwareModelElement, move: WriteableElementMove) => void): void;
174
- createElementMove(element: BoundsAwareModelElement, change: (_element: BoundsAwareModelElement, _move: WriteableElementMove) => void): WriteableElementMove | undefined;
193
+ dispatchAlignActions(elements: BoundsAwareModelElement[], change: (element: BoundsAwareModelElement, move: Writable<ElementMove>) => void): void;
194
+ createElementMove(element: BoundsAwareModelElement, change: (_element: BoundsAwareModelElement, _move: Writable<ElementMove>) => void): Writable<ElementMove> | undefined;
175
195
  createElementAndBounds(element: BoundsAwareModelElement, move: ElementMove): ElementAndBounds;
176
- undo(context: CommandExecutionContext): CommandReturn;
177
- redo(context: CommandExecutionContext): CommandReturn;
196
+ protected isActionElement(element: SModelElement): element is BoundsAwareModelElement;
178
197
  }
179
- export {};
180
- //# sourceMappingURL=layout-commands.d.ts.map
198
+ //# sourceMappingURL=layout-elements-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-elements-action.d.ts","sourceRoot":"","sources":["../../../src/features/layout/layout-elements-action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,MAAM,EAEN,gBAAgB,EAKhB,QAAQ,EACX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAc,aAAa,EAAE,MAAM,SAAS,CAAC;AAG9G,OAAO,EAAE,uBAAuB,EAAe,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;GAEG;AAEH,oBAAY,eAAe;IACvB,KAAK,IAAA;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