@hydranium/glsp-client 0.0.0-stage → 1.0.0-next.298
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/LICENSE +21 -0
- package/README.md +100 -2
- package/lib/action-dispatcher.d.ts +89 -0
- package/lib/action-dispatcher.d.ts.map +1 -0
- package/lib/action-dispatcher.js +257 -0
- package/lib/action-dispatcher.js.map +1 -0
- package/lib/diagram-load-failed.d.ts +20 -0
- package/lib/diagram-load-failed.d.ts.map +1 -0
- package/lib/diagram-load-failed.js +24 -0
- package/lib/diagram-load-failed.js.map +1 -0
- package/lib/diagram-loader.d.ts +124 -0
- package/lib/diagram-loader.d.ts.map +1 -0
- package/lib/diagram-loader.js +154 -0
- package/lib/diagram-loader.js.map +1 -0
- package/lib/edge.d.ts +40 -0
- package/lib/edge.d.ts.map +1 -0
- package/lib/edge.js +56 -0
- package/lib/edge.js.map +1 -0
- package/lib/glsp-client-module.d.ts +37 -0
- package/lib/glsp-client-module.d.ts.map +1 -0
- package/lib/glsp-client-module.js +66 -0
- package/lib/glsp-client-module.js.map +1 -0
- package/lib/glsp-client.d.ts +17 -0
- package/lib/glsp-client.d.ts.map +1 -0
- package/lib/glsp-client.js +23 -0
- package/lib/glsp-client.js.map +1 -0
- package/lib/hidden-bounds-updater.d.ts +119 -0
- package/lib/hidden-bounds-updater.d.ts.map +1 -0
- package/lib/hidden-bounds-updater.js +210 -0
- package/lib/hidden-bounds-updater.js.map +1 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +41 -0
- package/lib/index.js.map +1 -0
- package/lib/messages/index.d.ts +10 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +20 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/select-mouse-listener.d.ts +30 -0
- package/lib/select-mouse-listener.d.ts.map +1 -0
- package/lib/select-mouse-listener.js +51 -0
- package/lib/select-mouse-listener.js.map +1 -0
- package/lib/sprotty-logger-adapter.d.ts +61 -0
- package/lib/sprotty-logger-adapter.d.ts.map +1 -0
- package/lib/sprotty-logger-adapter.js +130 -0
- package/lib/sprotty-logger-adapter.js.map +1 -0
- package/lib/status-overlay.d.ts +23 -0
- package/lib/status-overlay.d.ts.map +1 -0
- package/lib/status-overlay.js +52 -0
- package/lib/status-overlay.js.map +1 -0
- package/lib/testing/bind-recorder.d.ts +67 -0
- package/lib/testing/bind-recorder.d.ts.map +1 -0
- package/lib/testing/bind-recorder.js +72 -0
- package/lib/testing/bind-recorder.js.map +1 -0
- package/lib/testing/index.d.ts +10 -0
- package/lib/testing/index.d.ts.map +1 -0
- package/lib/testing/index.js +28 -0
- package/lib/testing/index.js.map +1 -0
- package/lib/types.d.ts +27 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +33 -0
- package/lib/types.js.map +1 -0
- package/package.json +79 -4
- package/src/action-dispatcher.ts +273 -0
- package/src/diagram-load-failed.ts +22 -0
- package/src/diagram-loader.ts +173 -0
- package/src/edge.ts +65 -0
- package/src/glsp-client-module.ts +79 -0
- package/src/glsp-client.ts +20 -0
- package/src/hidden-bounds-updater.ts +210 -0
- package/src/index.ts +25 -0
- package/src/messages/index.ts +17 -0
- package/src/select-mouse-listener.ts +54 -0
- package/src/sprotty-logger-adapter.ts +121 -0
- package/src/status-overlay.ts +43 -0
- package/src/testing/bind-recorder.ts +126 -0
- package/src/testing/index.ts +13 -0
- package/src/types.ts +34 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { type Action, type ElementAndRoutingPoints, type GModelElement, type GRoutableElement, GLSPHiddenBoundsUpdater, RequestBoundsAction } from '@eclipse-glsp/client';
|
|
10
|
+
import { type Clock, type Logger } from '@hydranium/protocol';
|
|
11
|
+
import { type VNode } from 'snabbdom';
|
|
12
|
+
/**
|
|
13
|
+
* Instruments sprotty's hidden-bounds pass and repairs degenerate routes before
|
|
14
|
+
* they go on the wire.
|
|
15
|
+
*
|
|
16
|
+
* **Why the framework owns this.** Every GLSP head runs the hidden-bounds pass on
|
|
17
|
+
* every model update, and it is the one client-side phase that scales with the
|
|
18
|
+
* *rendered element count* rather than the model size — labels, compartments and
|
|
19
|
+
* edge decorations expand a modest node count into orders of magnitude more DOM
|
|
20
|
+
* elements. Without a timing line there is no way to tell a slow measurement pass
|
|
21
|
+
* apart from slow edge routing or a slow server round trip; with one,
|
|
22
|
+
* `bounds-request` either exonerates the client in a sentence or names the
|
|
23
|
+
* dominant cost.
|
|
24
|
+
*
|
|
25
|
+
* Emits exactly one `trace` line per bounds request — `trace` because the
|
|
26
|
+
* frequency matches the per-action traffic `HydraniumGlspActionDispatcher` logs
|
|
27
|
+
* there (a bounds request is driven by those actions), so it belongs with them
|
|
28
|
+
* rather than above them. The line carries:
|
|
29
|
+
*
|
|
30
|
+
* - `server` / `local` — whether the request came from the server or from a
|
|
31
|
+
* client-local {@link LocalRequestBoundsAction}
|
|
32
|
+
* - `scope=<ids>` — the elements a scoped request named; absent when the request
|
|
33
|
+
* covers the whole diagram
|
|
34
|
+
* - `measured=N` — DOM elements whose bounds were read. Exceeds the scoped id
|
|
35
|
+
* count because the base class expands each requested element to its
|
|
36
|
+
* descendants
|
|
37
|
+
* - `getBBox=Nms` — {@link getBoundsFromDOM} **only**: the layout pass and the
|
|
38
|
+
* `ComputedBoundsAction` assembly stay outside it, so the number isolates raw
|
|
39
|
+
* measurement cost
|
|
40
|
+
*
|
|
41
|
+
* Composed from {@link Clock.measure} rather than `Tracer.time`, matching
|
|
42
|
+
* `HydraniumDocumentBuilder`'s phase instrumentation. `Tracer.time` is for "tell
|
|
43
|
+
* me when this is slow" and is deliberately silent on a fast success, which would
|
|
44
|
+
* drop the element count on every normal pass — and forcing it to emit costs a
|
|
45
|
+
* paired `[#N start]` line per request. This is a per-occurrence record, so it
|
|
46
|
+
* measures and composes its own line.
|
|
47
|
+
*
|
|
48
|
+
* Bound by `createGlspClientModule` via `rebind(GLSPHiddenBoundsUpdater)`.
|
|
49
|
+
*/
|
|
50
|
+
export declare class HydraniumHiddenBoundsUpdater extends GLSPHiddenBoundsUpdater {
|
|
51
|
+
protected readonly hydraniumLogger: Logger;
|
|
52
|
+
/** The diagram container's {@link Clock}, or a `SystemClock`; it only measures. */
|
|
53
|
+
protected readonly clock: Clock;
|
|
54
|
+
/**
|
|
55
|
+
* Scope description for the in-flight request, read from the `cause` in
|
|
56
|
+
* {@link postUpdate} and consumed by {@link getBoundsFromDOM} — which the base
|
|
57
|
+
* class calls with no arguments, so the cause cannot be threaded through.
|
|
58
|
+
*/
|
|
59
|
+
protected currentScope?: string;
|
|
60
|
+
decorate(vnode: VNode, element: GModelElement): VNode;
|
|
61
|
+
/**
|
|
62
|
+
* Replace the routing entry the base class just pushed when it carries fewer
|
|
63
|
+
* than two points, which is not a valid route for any edge.
|
|
64
|
+
*
|
|
65
|
+
* `calcElementAndRoute` already guards the case where the registered router
|
|
66
|
+
* returns *nothing* — it falls back to source + own routing points + target.
|
|
67
|
+
* The hole is one step further in: `calcRoute` filters duplicate points at
|
|
68
|
+
* `Number.EPSILON`, so while obstacles still carry sprotty's unmeasured-bounds
|
|
69
|
+
* sentinel `(100, 100, -1, -1)` the source and target coincide and a valid
|
|
70
|
+
* two-point route collapses to a single point. That result is defined, so the
|
|
71
|
+
* upstream truthiness guard never fires and the single point ships.
|
|
72
|
+
*
|
|
73
|
+
* The substitute is deliberately upstream's own fallback shape rather than a
|
|
74
|
+
* new invention, so a repaired route is indistinguishable from a route the
|
|
75
|
+
* base class would have produced had it noticed. Only already-invalid payloads
|
|
76
|
+
* are touched, so a head with a working router is unaffected.
|
|
77
|
+
*/
|
|
78
|
+
protected repairLastRoute(element: GRoutableElement): void;
|
|
79
|
+
/** A route needs at least a start and an end point to describe an edge. */
|
|
80
|
+
protected hasValidRoute(route: ElementAndRoutingPoints): boolean;
|
|
81
|
+
/** Upstream's `calcElementAndRoute` no-router fallback: the element's own
|
|
82
|
+
* bendpoints framed by its source and target anchor positions. */
|
|
83
|
+
protected toSourceTargetRoute(element: GRoutableElement): ElementAndRoutingPoints;
|
|
84
|
+
protected getBoundsFromDOM(): void;
|
|
85
|
+
/** Format the per-request line. Override to change the wording. */
|
|
86
|
+
protected formatBoundsRequest(scope: string, measured: number, elapsedMs: number): string;
|
|
87
|
+
postUpdate(cause?: Action): void;
|
|
88
|
+
/**
|
|
89
|
+
* Scope facts for the log line: where the request came from, and which
|
|
90
|
+
* elements it asked for.
|
|
91
|
+
*
|
|
92
|
+
* Origin is read from {@link ServerAction}, the `__receivedFromServer` marker
|
|
93
|
+
* `GLSPModelSource` stamps on inbound actions, rather than from
|
|
94
|
+
* `LocalRequestBoundsAction.is`. The latter would answer the same today, but
|
|
95
|
+
* only incidentally: its `elementIDs` check is declared optional, so it is
|
|
96
|
+
* really just "a bounds request that did not come from the server". Keying on
|
|
97
|
+
* the marker states that directly, and keeps an *unscoped* local request from
|
|
98
|
+
* being mislabelled `server` if GLSP ever tightens that guard.
|
|
99
|
+
*/
|
|
100
|
+
protected formatCause(cause: Action): string;
|
|
101
|
+
/**
|
|
102
|
+
* Name the elements a scoped request asked for, or `undefined` when it covers
|
|
103
|
+
* the whole diagram.
|
|
104
|
+
*
|
|
105
|
+
* Deliberately the ids and not their count. A scoped request in practice names
|
|
106
|
+
* a single element, so a count is always `1` and says nothing, while the id
|
|
107
|
+
* says *which* element was re-measured — and it is the only part of the line
|
|
108
|
+
* that distinguishes one such request from the next. It also stops the line
|
|
109
|
+
* reading as a contradiction: `scope=node0, measured=6` is coherent (the base
|
|
110
|
+
* class expands a requested element to its descendants, so one id measures six
|
|
111
|
+
* DOM elements), where `scoped=1, measured=6` invites the reader to wonder
|
|
112
|
+
* which number is wrong.
|
|
113
|
+
*
|
|
114
|
+
* A request naming only the root is treated as unscoped: it measures
|
|
115
|
+
* everything, so the id adds nothing over the absence of a `scope` tag.
|
|
116
|
+
*/
|
|
117
|
+
protected formatScope(cause: RequestBoundsAction): string | undefined;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=hidden-bounds-updater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden-bounds-updater.d.ts","sourceRoot":"","sources":["../src/hidden-bounds-updater.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,EACX,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,uBAAuB,EAGvB,mBAAmB,EAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAQtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBACa,4BAA6B,SAAQ,uBAAuB;IACjC,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAG,MAAM,CAAC;IAEjF,mFAAmF;IACnC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAqB;IAEpG;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEvB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAM7D;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAMzD;IAED,2EAA2E;IAC3E,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAE/D;IAED;uEACmE;IACnE,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,uBAAuB,CAKhF;IAED,UAAmB,gBAAgB,IAAI,IAAI,CAW1C;IAED,mEAAmE;IACnE,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAExF;IAEQ,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAWxC;IAED;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI3C;IAED;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,GAAG,SAAS,CAapE;CACH"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
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;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.HydraniumHiddenBoundsUpdater = void 0;
|
|
21
|
+
const client_1 = require("@eclipse-glsp/client");
|
|
22
|
+
const protocol_1 = require("@hydranium/protocol");
|
|
23
|
+
const inversify_1 = require("inversify");
|
|
24
|
+
const types_1 = require("./types");
|
|
25
|
+
/** How many scoped element ids the log line names before summarising the rest.
|
|
26
|
+
* A scoped request names one element in practice; the cap only stops a
|
|
27
|
+
* pathological caller from writing a thousand ids into the log. */
|
|
28
|
+
const SCOPE_ID_CAP = 3;
|
|
29
|
+
/**
|
|
30
|
+
* Instruments sprotty's hidden-bounds pass and repairs degenerate routes before
|
|
31
|
+
* they go on the wire.
|
|
32
|
+
*
|
|
33
|
+
* **Why the framework owns this.** Every GLSP head runs the hidden-bounds pass on
|
|
34
|
+
* every model update, and it is the one client-side phase that scales with the
|
|
35
|
+
* *rendered element count* rather than the model size — labels, compartments and
|
|
36
|
+
* edge decorations expand a modest node count into orders of magnitude more DOM
|
|
37
|
+
* elements. Without a timing line there is no way to tell a slow measurement pass
|
|
38
|
+
* apart from slow edge routing or a slow server round trip; with one,
|
|
39
|
+
* `bounds-request` either exonerates the client in a sentence or names the
|
|
40
|
+
* dominant cost.
|
|
41
|
+
*
|
|
42
|
+
* Emits exactly one `trace` line per bounds request — `trace` because the
|
|
43
|
+
* frequency matches the per-action traffic `HydraniumGlspActionDispatcher` logs
|
|
44
|
+
* there (a bounds request is driven by those actions), so it belongs with them
|
|
45
|
+
* rather than above them. The line carries:
|
|
46
|
+
*
|
|
47
|
+
* - `server` / `local` — whether the request came from the server or from a
|
|
48
|
+
* client-local {@link LocalRequestBoundsAction}
|
|
49
|
+
* - `scope=<ids>` — the elements a scoped request named; absent when the request
|
|
50
|
+
* covers the whole diagram
|
|
51
|
+
* - `measured=N` — DOM elements whose bounds were read. Exceeds the scoped id
|
|
52
|
+
* count because the base class expands each requested element to its
|
|
53
|
+
* descendants
|
|
54
|
+
* - `getBBox=Nms` — {@link getBoundsFromDOM} **only**: the layout pass and the
|
|
55
|
+
* `ComputedBoundsAction` assembly stay outside it, so the number isolates raw
|
|
56
|
+
* measurement cost
|
|
57
|
+
*
|
|
58
|
+
* Composed from {@link Clock.measure} rather than `Tracer.time`, matching
|
|
59
|
+
* `HydraniumDocumentBuilder`'s phase instrumentation. `Tracer.time` is for "tell
|
|
60
|
+
* me when this is slow" and is deliberately silent on a fast success, which would
|
|
61
|
+
* drop the element count on every normal pass — and forcing it to emit costs a
|
|
62
|
+
* paired `[#N start]` line per request. This is a per-occurrence record, so it
|
|
63
|
+
* measures and composes its own line.
|
|
64
|
+
*
|
|
65
|
+
* Bound by `createGlspClientModule` via `rebind(GLSPHiddenBoundsUpdater)`.
|
|
66
|
+
*/
|
|
67
|
+
let HydraniumHiddenBoundsUpdater = class HydraniumHiddenBoundsUpdater extends client_1.GLSPHiddenBoundsUpdater {
|
|
68
|
+
hydraniumLogger;
|
|
69
|
+
/** The diagram container's {@link Clock}, or a `SystemClock`; it only measures. */
|
|
70
|
+
clock = new protocol_1.SystemClock();
|
|
71
|
+
/**
|
|
72
|
+
* Scope description for the in-flight request, read from the `cause` in
|
|
73
|
+
* {@link postUpdate} and consumed by {@link getBoundsFromDOM} — which the base
|
|
74
|
+
* class calls with no arguments, so the cause cannot be threaded through.
|
|
75
|
+
*/
|
|
76
|
+
currentScope;
|
|
77
|
+
decorate(vnode, element) {
|
|
78
|
+
super.decorate(vnode, element);
|
|
79
|
+
if ((0, client_1.isRoutable)(element)) {
|
|
80
|
+
this.repairLastRoute(element);
|
|
81
|
+
}
|
|
82
|
+
return vnode;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Replace the routing entry the base class just pushed when it carries fewer
|
|
86
|
+
* than two points, which is not a valid route for any edge.
|
|
87
|
+
*
|
|
88
|
+
* `calcElementAndRoute` already guards the case where the registered router
|
|
89
|
+
* returns *nothing* — it falls back to source + own routing points + target.
|
|
90
|
+
* The hole is one step further in: `calcRoute` filters duplicate points at
|
|
91
|
+
* `Number.EPSILON`, so while obstacles still carry sprotty's unmeasured-bounds
|
|
92
|
+
* sentinel `(100, 100, -1, -1)` the source and target coincide and a valid
|
|
93
|
+
* two-point route collapses to a single point. That result is defined, so the
|
|
94
|
+
* upstream truthiness guard never fires and the single point ships.
|
|
95
|
+
*
|
|
96
|
+
* The substitute is deliberately upstream's own fallback shape rather than a
|
|
97
|
+
* new invention, so a repaired route is indistinguishable from a route the
|
|
98
|
+
* base class would have produced had it noticed. Only already-invalid payloads
|
|
99
|
+
* are touched, so a head with a working router is unaffected.
|
|
100
|
+
*/
|
|
101
|
+
repairLastRoute(element) {
|
|
102
|
+
const addedRoute = this.element2route.pop();
|
|
103
|
+
if (addedRoute === undefined) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this.element2route.push(this.hasValidRoute(addedRoute) ? addedRoute : this.toSourceTargetRoute(element));
|
|
107
|
+
}
|
|
108
|
+
/** A route needs at least a start and an end point to describe an edge. */
|
|
109
|
+
hasValidRoute(route) {
|
|
110
|
+
return route.newRoutingPoints !== undefined && route.newRoutingPoints.length >= 2;
|
|
111
|
+
}
|
|
112
|
+
/** Upstream's `calcElementAndRoute` no-router fallback: the element's own
|
|
113
|
+
* bendpoints framed by its source and target anchor positions. */
|
|
114
|
+
toSourceTargetRoute(element) {
|
|
115
|
+
return {
|
|
116
|
+
elementId: element.id,
|
|
117
|
+
newRoutingPoints: [element.source?.position ?? client_1.Point.ORIGIN, ...element.routingPoints, element.target?.position ?? client_1.Point.ORIGIN]
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
getBoundsFromDOM() {
|
|
121
|
+
if (this.currentScope === undefined) {
|
|
122
|
+
// Not inside an instrumented `postUpdate` (a subclass calling directly);
|
|
123
|
+
// with no cause there is nothing to attribute a measurement to.
|
|
124
|
+
super.getBoundsFromDOM();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
// Read before the pass: the base class clears the map on its way out.
|
|
128
|
+
const measured = this.getElement2BoundsData().size;
|
|
129
|
+
const { elapsedMs } = this.clock.measure(() => super.getBoundsFromDOM());
|
|
130
|
+
this.hydraniumLogger.trace(this.formatBoundsRequest(this.currentScope, measured, elapsedMs));
|
|
131
|
+
}
|
|
132
|
+
/** Format the per-request line. Override to change the wording. */
|
|
133
|
+
formatBoundsRequest(scope, measured, elapsedMs) {
|
|
134
|
+
return `bounds-request[${scope}] measured=${measured} getBBox=${elapsedMs.toFixed(0)}ms`;
|
|
135
|
+
}
|
|
136
|
+
postUpdate(cause) {
|
|
137
|
+
if (cause?.kind !== client_1.RequestBoundsAction.KIND) {
|
|
138
|
+
super.postUpdate(cause);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
this.currentScope = this.formatCause(cause);
|
|
142
|
+
try {
|
|
143
|
+
super.postUpdate(cause);
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
this.currentScope = undefined;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Scope facts for the log line: where the request came from, and which
|
|
151
|
+
* elements it asked for.
|
|
152
|
+
*
|
|
153
|
+
* Origin is read from {@link ServerAction}, the `__receivedFromServer` marker
|
|
154
|
+
* `GLSPModelSource` stamps on inbound actions, rather than from
|
|
155
|
+
* `LocalRequestBoundsAction.is`. The latter would answer the same today, but
|
|
156
|
+
* only incidentally: its `elementIDs` check is declared optional, so it is
|
|
157
|
+
* really just "a bounds request that did not come from the server". Keying on
|
|
158
|
+
* the marker states that directly, and keeps an *unscoped* local request from
|
|
159
|
+
* being mislabelled `server` if GLSP ever tightens that guard.
|
|
160
|
+
*/
|
|
161
|
+
formatCause(cause) {
|
|
162
|
+
const origin = client_1.ServerAction.is(cause) ? 'server' : 'local';
|
|
163
|
+
const scope = this.formatScope(cause);
|
|
164
|
+
return scope ? `${origin} scope=${scope}` : origin;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Name the elements a scoped request asked for, or `undefined` when it covers
|
|
168
|
+
* the whole diagram.
|
|
169
|
+
*
|
|
170
|
+
* Deliberately the ids and not their count. A scoped request in practice names
|
|
171
|
+
* a single element, so a count is always `1` and says nothing, while the id
|
|
172
|
+
* says *which* element was re-measured — and it is the only part of the line
|
|
173
|
+
* that distinguishes one such request from the next. It also stops the line
|
|
174
|
+
* reading as a contradiction: `scope=node0, measured=6` is coherent (the base
|
|
175
|
+
* class expands a requested element to its descendants, so one id measures six
|
|
176
|
+
* DOM elements), where `scoped=1, measured=6` invites the reader to wonder
|
|
177
|
+
* which number is wrong.
|
|
178
|
+
*
|
|
179
|
+
* A request naming only the root is treated as unscoped: it measures
|
|
180
|
+
* everything, so the id adds nothing over the absence of a `scope` tag.
|
|
181
|
+
*/
|
|
182
|
+
formatScope(cause) {
|
|
183
|
+
const scopedIds = cause.elementIDs;
|
|
184
|
+
if (!scopedIds || scopedIds.length === 0) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
const named = scopedIds.filter(id => id !== cause.newRoot?.id);
|
|
188
|
+
if (named.length === 0) {
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
if (named.length > SCOPE_ID_CAP) {
|
|
192
|
+
return `${named.slice(0, SCOPE_ID_CAP).join(',')},+${named.length - SCOPE_ID_CAP} more`;
|
|
193
|
+
}
|
|
194
|
+
return named.join(',');
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
exports.HydraniumHiddenBoundsUpdater = HydraniumHiddenBoundsUpdater;
|
|
198
|
+
__decorate([
|
|
199
|
+
(0, inversify_1.inject)(types_1.HydraniumClientTypes.Logger),
|
|
200
|
+
__metadata("design:type", Object)
|
|
201
|
+
], HydraniumHiddenBoundsUpdater.prototype, "hydraniumLogger", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
(0, inversify_1.inject)(types_1.HydraniumClientTypes.Clock),
|
|
204
|
+
(0, inversify_1.optional)(),
|
|
205
|
+
__metadata("design:type", Object)
|
|
206
|
+
], HydraniumHiddenBoundsUpdater.prototype, "clock", void 0);
|
|
207
|
+
exports.HydraniumHiddenBoundsUpdater = HydraniumHiddenBoundsUpdater = __decorate([
|
|
208
|
+
(0, inversify_1.injectable)()
|
|
209
|
+
], HydraniumHiddenBoundsUpdater);
|
|
210
|
+
//# sourceMappingURL=hidden-bounds-updater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden-bounds-updater.js","sourceRoot":"","sources":["../src/hidden-bounds-updater.ts"],"names":[],"mappings":"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"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
export * from './action-dispatcher';
|
|
10
|
+
export * from './diagram-load-failed';
|
|
11
|
+
export * from './diagram-loader';
|
|
12
|
+
export * from './edge';
|
|
13
|
+
export * from './glsp-client';
|
|
14
|
+
export * from './glsp-client-module';
|
|
15
|
+
export * from './hidden-bounds-updater';
|
|
16
|
+
export * from './select-mouse-listener';
|
|
17
|
+
export * from './sprotty-logger-adapter';
|
|
18
|
+
export * from './status-overlay';
|
|
19
|
+
export * from './types';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAOlF,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
// The host-neutral GLSP client classes and the binder that mounts them. This
|
|
26
|
+
// root is browser-bound, not neutral: it loads `@eclipse-glsp/client`, whose
|
|
27
|
+
// graph imports stylesheets, so it needs a bundler with a CSS loader. It is
|
|
28
|
+
// free of Node and of any host platform, which is the claim `check:neutral`
|
|
29
|
+
// gates.
|
|
30
|
+
__exportStar(require("./action-dispatcher"), exports);
|
|
31
|
+
__exportStar(require("./diagram-load-failed"), exports);
|
|
32
|
+
__exportStar(require("./diagram-loader"), exports);
|
|
33
|
+
__exportStar(require("./edge"), exports);
|
|
34
|
+
__exportStar(require("./glsp-client"), exports);
|
|
35
|
+
__exportStar(require("./glsp-client-module"), exports);
|
|
36
|
+
__exportStar(require("./hidden-bounds-updater"), exports);
|
|
37
|
+
__exportStar(require("./select-mouse-listener"), exports);
|
|
38
|
+
__exportStar(require("./sprotty-logger-adapter"), exports);
|
|
39
|
+
__exportStar(require("./status-overlay"), exports);
|
|
40
|
+
__exportStar(require("./types"), exports);
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,4EAA4E;AAC5E,SAAS;AACT,sDAAoC;AACpC,wDAAsC;AACtC,mDAAiC;AACjC,yCAAuB;AACvB,gDAA8B;AAC9B,uDAAqC;AACrC,0DAAwC;AACxC,0DAAwC;AACxC,2DAAyC;AACzC,mDAAiC;AACjC,0CAAwB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
export { DIAGRAM_LOAD_FAILED } from '../diagram-load-failed';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AASlF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.DIAGRAM_LOAD_FAILED = void 0;
|
|
12
|
+
// Every user-facing message `@hydranium/glsp-client` raises. The client tier
|
|
13
|
+
// renders only its own messages, which fire when no server could have worded
|
|
14
|
+
// them: the loader formats the English, and a host that knows the reading
|
|
15
|
+
// user's locale renders the code through its own mechanism instead, as the
|
|
16
|
+
// Theia loader does through `nls`. The barrel is how an adopter rendering their
|
|
17
|
+
// own diagram chrome discovers the codes exist.
|
|
18
|
+
var diagram_load_failed_1 = require("../diagram-load-failed");
|
|
19
|
+
Object.defineProperty(exports, "DIAGRAM_LOAD_FAILED", { enumerable: true, get: function () { return diagram_load_failed_1.DIAGRAM_LOAD_FAILED; } });
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,6EAA6E;AAC7E,6EAA6E;AAC7E,0EAA0E;AAC1E,2EAA2E;AAC3E,gFAAgF;AAChF,gDAAgD;AAEhD,8DAA6D;AAApD,0HAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { type Action, type GModelElement, RankedSelectMouseListener, type SelectableElement } from '@eclipse-glsp/client';
|
|
10
|
+
/**
|
|
11
|
+
* GLSP's select mouse listener, with a plain click on an unselected element
|
|
12
|
+
* replacing whatever is selected when its action executes.
|
|
13
|
+
*
|
|
14
|
+
* The listener names the elements a click deselects from each element's
|
|
15
|
+
* `selected` flag, which the feedback the previous click's command queues
|
|
16
|
+
* writes only when that feedback runs; a click landing before then names
|
|
17
|
+
* nothing, and both elements end up selected. A plain click sends
|
|
18
|
+
* `deselectAll` instead, which `SelectCommand` resolves against the selection
|
|
19
|
+
* service as it executes. Reading the service from the listener would still
|
|
20
|
+
* race the previous click's command, since dispatch is asynchronous.
|
|
21
|
+
* Ctrl/Cmd-click keeps GLSP's add to the selection; a routing handle keeps
|
|
22
|
+
* GLSP's path, since `deselectAll` cannot spare the handle's own edge.
|
|
23
|
+
*
|
|
24
|
+
* Bound by `createGlspClientModule` via `rebind(RankedSelectMouseListener)`.
|
|
25
|
+
*/
|
|
26
|
+
export declare class HydraniumSelectMouseListener extends RankedSelectMouseListener {
|
|
27
|
+
protected handleSelectTarget(selectableTarget: SelectableElement, deselectedElements: GModelElement[], event: MouseEvent): (Action | Promise<Action>)[];
|
|
28
|
+
protected handleDeselectAll(): (Action | Promise<Action>)[];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=select-mouse-listener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-mouse-listener.d.ts","sourceRoot":"","sources":["../src/select-mouse-listener.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,EAEX,KAAK,aAAa,EAGlB,yBAAyB,EAEzB,KAAK,iBAAiB,EACxB,MAAM,sBAAsB,CAAC;AAG9B;;;;;;;;;;;;;;;GAeG;AACH,qBACa,4BAA6B,SAAQ,yBAAyB;IACxE,UAAmB,kBAAkB,CAClC,gBAAgB,EAAE,iBAAiB,EACnC,kBAAkB,EAAE,aAAa,EAAE,EACnC,KAAK,EAAE,UAAU,GACjB,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAK9B;IAED,UAAmB,iBAAiB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAEnE;CACH"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
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;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.HydraniumSelectMouseListener = void 0;
|
|
18
|
+
const client_1 = require("@eclipse-glsp/client");
|
|
19
|
+
const inversify_1 = require("inversify");
|
|
20
|
+
/**
|
|
21
|
+
* GLSP's select mouse listener, with a plain click on an unselected element
|
|
22
|
+
* replacing whatever is selected when its action executes.
|
|
23
|
+
*
|
|
24
|
+
* The listener names the elements a click deselects from each element's
|
|
25
|
+
* `selected` flag, which the feedback the previous click's command queues
|
|
26
|
+
* writes only when that feedback runs; a click landing before then names
|
|
27
|
+
* nothing, and both elements end up selected. A plain click sends
|
|
28
|
+
* `deselectAll` instead, which `SelectCommand` resolves against the selection
|
|
29
|
+
* service as it executes. Reading the service from the listener would still
|
|
30
|
+
* race the previous click's command, since dispatch is asynchronous.
|
|
31
|
+
* Ctrl/Cmd-click keeps GLSP's add to the selection; a routing handle keeps
|
|
32
|
+
* GLSP's path, since `deselectAll` cannot spare the handle's own edge.
|
|
33
|
+
*
|
|
34
|
+
* Bound by `createGlspClientModule` via `rebind(RankedSelectMouseListener)`.
|
|
35
|
+
*/
|
|
36
|
+
let HydraniumSelectMouseListener = class HydraniumSelectMouseListener extends client_1.RankedSelectMouseListener {
|
|
37
|
+
handleSelectTarget(selectableTarget, deselectedElements, event) {
|
|
38
|
+
if ((0, client_1.isCtrlOrCmd)(event) || selectableTarget instanceof client_1.GRoutingHandle) {
|
|
39
|
+
return super.handleSelectTarget(selectableTarget, deselectedElements, event);
|
|
40
|
+
}
|
|
41
|
+
return [client_1.SelectAction.setSelection([selectableTarget.id]), client_1.BringToFrontAction.create([selectableTarget.id])];
|
|
42
|
+
}
|
|
43
|
+
handleDeselectAll() {
|
|
44
|
+
return [client_1.SelectAction.setSelection([])];
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.HydraniumSelectMouseListener = HydraniumSelectMouseListener;
|
|
48
|
+
exports.HydraniumSelectMouseListener = HydraniumSelectMouseListener = __decorate([
|
|
49
|
+
(0, inversify_1.injectable)()
|
|
50
|
+
], HydraniumSelectMouseListener);
|
|
51
|
+
//# sourceMappingURL=select-mouse-listener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-mouse-listener.js","sourceRoot":"","sources":["../src/select-mouse-listener.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;AAElF,iDAS8B;AAC9B,yCAAuC;AAEvC;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,kCAAyB;IACrD,kBAAkB,CAClC,gBAAmC,EACnC,kBAAmC,EACnC,KAAiB;QAEjB,IAAI,IAAA,oBAAW,EAAC,KAAK,CAAC,IAAI,gBAAgB,YAAY,uBAAc,EAAE,CAAC;YACpE,OAAO,KAAK,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAChF,CAAC;QACD,OAAO,CAAC,qBAAY,CAAC,YAAY,CAAC,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,2BAAkB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/G,CAAC;IAEkB,iBAAiB;QACjC,OAAO,CAAC,qBAAY,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;CACH,CAAA;;uCAfY,4BAA4B;IADxC,IAAA,sBAAU,GAAE;GACA,4BAA4B,CAexC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { type ILogger, LogLevel } from '@eclipse-glsp/client';
|
|
10
|
+
import { Logger } from '@hydranium/protocol';
|
|
11
|
+
/**
|
|
12
|
+
* sprotty's `ILogger` over the host's {@link Logger}, so sprotty's own lines
|
|
13
|
+
* reach the same sink as the framework's: a view-registration failure lands in
|
|
14
|
+
* the Theia Output channel beside the action traffic, or on a page's console.
|
|
15
|
+
* sprotty binds a `NullLogger` by default, which drops those failures.
|
|
16
|
+
*
|
|
17
|
+
* sprotty's `error` and `warn` keep their levels and their parameters, where
|
|
18
|
+
* the parameter is the useful part, such as the element type that has no view.
|
|
19
|
+
*
|
|
20
|
+
* Its `info` is diagnosis, chatty on every hover's feedback, so it goes to
|
|
21
|
+
* `debug`; the one anomaly reported there, a request GLSP resolved silently
|
|
22
|
+
* after its timeout, goes to `warn`, where a default threshold shows it.
|
|
23
|
+
*
|
|
24
|
+
* Its `log` fires per action, per command and per render with the whole action
|
|
25
|
+
* or model as a parameter, so it goes to `trace`, where the framework
|
|
26
|
+
* dispatcher logs that traffic. **At `info` and `log` a parameter is reduced to
|
|
27
|
+
* its name**, an action's `kind` or an object's class, never forwarded whole:
|
|
28
|
+
* the Theia channel logger stringifies every parameter as JSON, so forwarding
|
|
29
|
+
* them would write the model into the Output channel on every action.
|
|
30
|
+
*
|
|
31
|
+
* Each line goes through a logger nested under the host's for the calling
|
|
32
|
+
* class, cached per class, so the origin is a tag the host renders inside its
|
|
33
|
+
* own, `[GLSP client :: Viewer]`, not a prefix inside the message. Where
|
|
34
|
+
* sprotty passes a sentence instead of the caller, as its layout registries
|
|
35
|
+
* do, the sentence prefixes the message. The adapter's own `logLevel` is
|
|
36
|
+
* sprotty's most verbose, so only the framework threshold filters; `info` and
|
|
37
|
+
* `log` check it first, since they run on every action and render and would
|
|
38
|
+
* otherwise format a line the threshold drops.
|
|
39
|
+
*
|
|
40
|
+
* Bound by `createGlspClientModule` via `rebind(TYPES.ILogger)`.
|
|
41
|
+
*/
|
|
42
|
+
export declare class SprottyLoggerAdapter implements ILogger {
|
|
43
|
+
protected readonly logger: Logger;
|
|
44
|
+
logLevel: LogLevel;
|
|
45
|
+
/** Loggers derived per calling class; sprotty logs from a few dozen classes. */
|
|
46
|
+
protected readonly loggers: Map<string, Logger>;
|
|
47
|
+
error(thisArg: unknown, message: string, ...params: unknown[]): void;
|
|
48
|
+
warn(thisArg: unknown, message: string, ...params: unknown[]): void;
|
|
49
|
+
info(thisArg: unknown, message: string, ...params: unknown[]): void;
|
|
50
|
+
log(thisArg: unknown, message: string, ...params: unknown[]): void;
|
|
51
|
+
/** The host's logger with the calling class nested under its tag, or the
|
|
52
|
+
* host's own when the caller is not an object. */
|
|
53
|
+
protected loggerFor(thisArg: unknown): Logger;
|
|
54
|
+
/** The message, behind the sentence sprotty sometimes passes as the caller,
|
|
55
|
+
* followed by the parameters' names. */
|
|
56
|
+
protected formatMessage(thisArg: unknown, message: string, params?: readonly unknown[]): string;
|
|
57
|
+
/** An action's `kind`, also inside the message GLSP sends an action in, a
|
|
58
|
+
* string as it is, any other object's class, else nothing. */
|
|
59
|
+
protected nameOf(value: unknown): string | undefined;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=sprotty-logger-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sprotty-logger-adapter.d.ts","sourceRoot":"","sources":["../src/sprotty-logger-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAQ7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,oBAAqB,YAAW,OAAO;IACZ,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAExE,QAAQ,EAAE,QAAQ,CAAgB;IAElC,gFAAgF;IAChF,SAAS,CAAC,QAAQ,CAAC,OAAO,sBAA6B;IAEvD,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAEnE;IAED,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAElE;IAED,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAMlE;IAED,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAIjE;IAED;uDACmD;IACnD,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAW5C;IAED;6CACyC;IACzC,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,SAAS,OAAO,EAAO,GAAG,MAAM,CAGlG;IAED;mEAC+D;IAC/D,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAenD;CACH"}
|