@eclipse-glsp/client 2.8.0-next.14 → 2.8.0-next.16
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.
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +1 -0
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.js +65 -57
- package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -1
- package/package.json +2 -2
- package/src/features/bounds/glsp-hidden-bounds-updater.ts +65 -58
|
@@ -32,6 +32,7 @@ export declare class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
|
|
|
32
32
|
protected getElement2BoundsData(): Map<BoundsAwareModelElement, BoundsDataExt>;
|
|
33
33
|
decorate(vnode: VNode, element: GModelElement): VNode;
|
|
34
34
|
postUpdate(cause?: Action): void;
|
|
35
|
+
protected cleanUp(): void;
|
|
35
36
|
protected focusOnElements(elementIDs: string[]): void;
|
|
36
37
|
protected expandElementId(id: string, index: ModelIndexImpl, elementIDs: string[]): string[];
|
|
37
38
|
}
|
|
@@ -1 +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,EACN,UAAU,EAEV,kBAAkB,EAIlB,uBAAuB,EAEvB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,cAAc,EAGjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAqD,MAAM,yBAAyB,CAAC;AAIrH,qBAAa,aAAc,SAAQ,UAAU;IACzC,UAAU,CAAC,EAAE,UAAU,CAAC;CAC3B;AA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AAK,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK;IAQrD,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAwEzC,SAAS,CAAC,OAAO,IAAI,IAAI;IAMzB,SAAS,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;IAYrD,SAAS,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;CAG/F"}
|
|
@@ -55,69 +55,77 @@ let GLSPHiddenBoundsUpdater = class GLSPHiddenBoundsUpdater extends sprotty_1.Hi
|
|
|
55
55
|
return vnode;
|
|
56
56
|
}
|
|
57
57
|
postUpdate(cause) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (local_bounds_1.LocalRequestBoundsAction.is(cause) && cause.elementIDs) {
|
|
62
|
-
this.focusOnElements(cause.elementIDs);
|
|
63
|
-
}
|
|
64
|
-
// collect bounds and layout data in element2BoundsData
|
|
65
|
-
this.getBoundsFromDOM();
|
|
66
|
-
this.layouter.layout(this.getElement2BoundsData());
|
|
67
|
-
// prepare data for action
|
|
68
|
-
const resizes = [];
|
|
69
|
-
const alignments = [];
|
|
70
|
-
const layoutData = [];
|
|
71
|
-
this.getElement2BoundsData().forEach((boundsData, element) => {
|
|
72
|
-
if (boundsData.boundsChanged && boundsData.bounds !== undefined) {
|
|
73
|
-
const resize = {
|
|
74
|
-
elementId: element.id,
|
|
75
|
-
newSize: {
|
|
76
|
-
width: boundsData.bounds.width,
|
|
77
|
-
height: boundsData.bounds.height
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
// don't copy position if the element is layouted by the server
|
|
81
|
-
if (element instanceof sprotty_1.GChildElement && (0, sprotty_1.isLayoutContainer)(element.parent)) {
|
|
82
|
-
resize.newPosition = {
|
|
83
|
-
x: boundsData.bounds.x,
|
|
84
|
-
y: boundsData.bounds.y
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
resizes.push(resize);
|
|
58
|
+
try {
|
|
59
|
+
if (cause === undefined || cause.kind !== sprotty_1.RequestBoundsAction.KIND) {
|
|
60
|
+
return;
|
|
88
61
|
}
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
elementId: element.id,
|
|
92
|
-
newAlignment: boundsData.alignment
|
|
93
|
-
});
|
|
62
|
+
if (local_bounds_1.LocalRequestBoundsAction.is(cause) && cause.elementIDs) {
|
|
63
|
+
this.focusOnElements(cause.elementIDs);
|
|
94
64
|
}
|
|
95
|
-
|
|
96
|
-
|
|
65
|
+
// collect bounds and layout data in element2BoundsData
|
|
66
|
+
this.getBoundsFromDOM();
|
|
67
|
+
this.layouter.layout(this.getElement2BoundsData());
|
|
68
|
+
// prepare data for action
|
|
69
|
+
const resizes = [];
|
|
70
|
+
const alignments = [];
|
|
71
|
+
const layoutData = [];
|
|
72
|
+
this.getElement2BoundsData().forEach((boundsData, element) => {
|
|
73
|
+
if (boundsData.boundsChanged && boundsData.bounds !== undefined) {
|
|
74
|
+
const resize = {
|
|
75
|
+
elementId: element.id,
|
|
76
|
+
newSize: {
|
|
77
|
+
width: boundsData.bounds.width,
|
|
78
|
+
height: boundsData.bounds.height
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
// don't copy position if the element is layouted by the server
|
|
82
|
+
if (element instanceof sprotty_1.GChildElement && (0, sprotty_1.isLayoutContainer)(element.parent)) {
|
|
83
|
+
resize.newPosition = {
|
|
84
|
+
x: boundsData.bounds.x,
|
|
85
|
+
y: boundsData.bounds.y
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
resizes.push(resize);
|
|
89
|
+
}
|
|
90
|
+
if (boundsData.alignmentChanged && boundsData.alignment !== undefined) {
|
|
91
|
+
alignments.push({
|
|
92
|
+
elementId: element.id,
|
|
93
|
+
newAlignment: boundsData.alignment
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (layout_data_1.LayoutAware.is(boundsData)) {
|
|
97
|
+
layoutData.push({ elementId: element.id, layoutData: boundsData.layoutData });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
const routes = this.element2route.length === 0 ? undefined : this.element2route;
|
|
101
|
+
// prepare and dispatch action
|
|
102
|
+
const responseId = cause.requestId;
|
|
103
|
+
const revision = this.root !== undefined ? this.root.revision : undefined;
|
|
104
|
+
const canvasBounds = this.editorContext.canvasBounds;
|
|
105
|
+
const viewport = this.editorContext.viewportData;
|
|
106
|
+
const computedBoundsAction = sprotty_1.ComputedBoundsAction.create(resizes, {
|
|
107
|
+
revision,
|
|
108
|
+
alignments,
|
|
109
|
+
layoutData,
|
|
110
|
+
routes,
|
|
111
|
+
responseId,
|
|
112
|
+
canvasBounds,
|
|
113
|
+
viewport
|
|
114
|
+
});
|
|
115
|
+
if (local_bounds_1.LocalRequestBoundsAction.is(cause)) {
|
|
116
|
+
local_bounds_1.LocalComputedBoundsAction.mark(computedBoundsAction);
|
|
97
117
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const canvasBounds = this.editorContext.canvasBounds;
|
|
104
|
-
const viewport = this.editorContext.viewportData;
|
|
105
|
-
const computedBoundsAction = sprotty_1.ComputedBoundsAction.create(resizes, {
|
|
106
|
-
revision,
|
|
107
|
-
alignments,
|
|
108
|
-
layoutData,
|
|
109
|
-
routes,
|
|
110
|
-
responseId,
|
|
111
|
-
canvasBounds,
|
|
112
|
-
viewport
|
|
113
|
-
});
|
|
114
|
-
if (local_bounds_1.LocalRequestBoundsAction.is(cause)) {
|
|
115
|
-
local_bounds_1.LocalComputedBoundsAction.mark(computedBoundsAction);
|
|
118
|
+
this.actionDispatcher.dispatch(computedBoundsAction);
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
// always reset collected data so hidden renderings with other causes (e.g. exports/failures) do not leak into the next run
|
|
122
|
+
this.cleanUp();
|
|
116
123
|
}
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
}
|
|
125
|
+
cleanUp() {
|
|
119
126
|
this.getElement2BoundsData().clear();
|
|
120
127
|
this.element2route = [];
|
|
128
|
+
this.root = undefined;
|
|
121
129
|
}
|
|
122
130
|
focusOnElements(elementIDs) {
|
|
123
131
|
const data = this.getElement2BoundsData();
|
|
@@ -1 +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,mDAgB+B;AAC/B,yCAAyD;AAEzD,8EAAyE;AACzE,yDAAqH;AACrH,+CAA4C;AAC5C,iDAAqF;AAErF,MAAa,aAAc,SAAQ,oBAAU;CAE5C;AAFD,sCAEC;AAED;;;;GAIG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,6BAAmB;IAAzD;;QAIO,kBAAa,GAA8B,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"glsp-hidden-bounds-updater.js","sourceRoot":"","sources":["../../../src/features/bounds/glsp-hidden-bounds-updater.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,mDAgB+B;AAC/B,yCAAyD;AAEzD,8EAAyE;AACzE,yDAAqH;AACrH,+CAA4C;AAC5C,iDAAqF;AAErF,MAAa,aAAc,SAAQ,oBAAU;CAE5C;AAFD,sCAEC;AAED;;;;GAIG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,6BAAmB;IAAzD;;QAIO,kBAAa,GAA8B,EAAE,CAAC;IA2G5D,CAAC;IAzGa,qBAAqB;QAC3B,OAAO,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IAEQ,QAAQ,CAAC,KAAY,EAAE,OAAsB;QAClD,KAAK,CAAC,QAAQ,CAAC,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ES,eAAe,CAAC,EAAU,EAAE,KAAqB,EAAE,UAAoB;QAC7E,OAAO,IAAA,8BAAgB,EAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAA;AA/GY,0DAAuB;AAC2B;IAA1D,IAAA,kBAAM,EAAC,4BAAkB,CAAC;IAAE,IAAA,oBAAQ,GAAE;8BAAyC,4BAAkB;mEAAC;AAC3D;IAAvC,IAAA,kBAAM,EAAC,6CAAoB,CAAC;8BAA0B,6CAAoB;8DAAC;kCAFnE,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CA+GnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/client",
|
|
3
|
-
"version": "2.8.0-next.
|
|
3
|
+
"version": "2.8.0-next.16",
|
|
4
4
|
"description": "A sprotty-based client for GLSP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eclipse",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"file-saver": "^2.0.5",
|
|
45
45
|
"snabbdom": "~3.5.1",
|
|
46
46
|
"vscode-jsonrpc": "8.2.0",
|
|
47
|
-
"@eclipse-glsp/sprotty": "2.8.0-next.
|
|
47
|
+
"@eclipse-glsp/sprotty": "2.8.0-next.16"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/file-saver": "^2.0.5"
|
|
@@ -67,74 +67,81 @@ export class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
override postUpdate(cause?: Action): void {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
try {
|
|
71
|
+
if (cause === undefined || cause.kind !== RequestBoundsAction.KIND) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
if (LocalRequestBoundsAction.is(cause) && cause.elementIDs) {
|
|
76
|
+
this.focusOnElements(cause.elementIDs);
|
|
77
|
+
}
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
// collect bounds and layout data in element2BoundsData
|
|
80
|
+
this.getBoundsFromDOM();
|
|
81
|
+
this.layouter.layout(this.getElement2BoundsData());
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
};
|
|
95
|
-
// don't copy position if the element is layouted by the server
|
|
96
|
-
if (element instanceof GChildElement && isLayoutContainer(element.parent)) {
|
|
97
|
-
resize.newPosition = {
|
|
98
|
-
x: boundsData.bounds.x,
|
|
99
|
-
y: boundsData.bounds.y
|
|
83
|
+
// prepare data for action
|
|
84
|
+
const resizes: ElementAndBounds[] = [];
|
|
85
|
+
const alignments: ElementAndAlignment[] = [];
|
|
86
|
+
const layoutData: ElementAndLayoutData[] = [];
|
|
87
|
+
this.getElement2BoundsData().forEach((boundsData, element) => {
|
|
88
|
+
if (boundsData.boundsChanged && boundsData.bounds !== undefined) {
|
|
89
|
+
const resize: ElementAndBounds = {
|
|
90
|
+
elementId: element.id,
|
|
91
|
+
newSize: {
|
|
92
|
+
width: boundsData.bounds.width,
|
|
93
|
+
height: boundsData.bounds.height
|
|
94
|
+
}
|
|
100
95
|
};
|
|
96
|
+
// don't copy position if the element is layouted by the server
|
|
97
|
+
if (element instanceof GChildElement && isLayoutContainer(element.parent)) {
|
|
98
|
+
resize.newPosition = {
|
|
99
|
+
x: boundsData.bounds.x,
|
|
100
|
+
y: boundsData.bounds.y
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
resizes.push(resize);
|
|
101
104
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
});
|
|
114
|
-
const routes = this.element2route.length === 0 ? undefined : this.element2route;
|
|
105
|
+
if (boundsData.alignmentChanged && boundsData.alignment !== undefined) {
|
|
106
|
+
alignments.push({
|
|
107
|
+
elementId: element.id,
|
|
108
|
+
newAlignment: boundsData.alignment
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (LayoutAware.is(boundsData)) {
|
|
112
|
+
layoutData.push({ elementId: element.id, layoutData: boundsData.layoutData });
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
const routes = this.element2route.length === 0 ? undefined : this.element2route;
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
117
|
+
// prepare and dispatch action
|
|
118
|
+
const responseId = (cause as RequestBoundsAction).requestId;
|
|
119
|
+
const revision = this.root !== undefined ? this.root.revision : undefined;
|
|
120
|
+
const canvasBounds = this.editorContext.canvasBounds;
|
|
121
|
+
const viewport = this.editorContext.viewportData;
|
|
122
|
+
const computedBoundsAction = ComputedBoundsAction.create(resizes, {
|
|
123
|
+
revision,
|
|
124
|
+
alignments,
|
|
125
|
+
layoutData,
|
|
126
|
+
routes,
|
|
127
|
+
responseId,
|
|
128
|
+
canvasBounds,
|
|
129
|
+
viewport
|
|
130
|
+
});
|
|
131
|
+
if (LocalRequestBoundsAction.is(cause)) {
|
|
132
|
+
LocalComputedBoundsAction.mark(computedBoundsAction);
|
|
133
|
+
}
|
|
134
|
+
this.actionDispatcher.dispatch(computedBoundsAction);
|
|
135
|
+
} finally {
|
|
136
|
+
// always reset collected data so hidden renderings with other causes (e.g. exports/failures) do not leak into the next run
|
|
137
|
+
this.cleanUp();
|
|
132
138
|
}
|
|
133
|
-
|
|
139
|
+
}
|
|
134
140
|
|
|
135
|
-
|
|
141
|
+
protected cleanUp(): void {
|
|
136
142
|
this.getElement2BoundsData().clear();
|
|
137
143
|
this.element2route = [];
|
|
144
|
+
this.root = undefined;
|
|
138
145
|
}
|
|
139
146
|
|
|
140
147
|
protected focusOnElements(elementIDs: string[]): void {
|