@hydranium/glsp-client 0.0.0-stage → 1.0.0-next
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 +97 -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 +36 -0
- package/lib/glsp-client-module.d.ts.map +1 -0
- package/lib/glsp-client-module.js +63 -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 +19 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +40 -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/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 +75 -0
- package/src/glsp-client.ts +20 -0
- package/src/hidden-bounds-updater.ts +210 -0
- package/src/index.ts +24 -0
- package/src/messages/index.ts +17 -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 @@
|
|
|
1
|
+
{"version":3,"file":"sprotty-logger-adapter.js","sourceRoot":"","sources":["../src/sprotty-logger-adapter.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;AAElF,iDAA8D;AAC9D,kDAA6C;AAC7C,yCAA+C;AAC/C,mCAA+C;AAE/C;mFACmF;AACnF,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC0B,MAAM,CAAU;IAExE,QAAQ,GAAa,iBAAQ,CAAC,GAAG,CAAC;IAElC,gFAAgF;IAC7D,OAAO,GAAG,IAAI,GAAG,EAA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QACD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAwD,CAAC;QAClF,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACf,CAAC;QACD,IAAI,OAAO,MAAM,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;YACpC,OAAO,MAAM,CAAC,IAAI,CAAC;QACtB,CAAC;QACD,OAAO,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC;IAClC,CAAC;CACH,CAAA;;AArE0D;IAAvD,IAAA,kBAAM,EAAC,4BAAoB,CAAC,MAAM,CAAC;;oDAAoC;+BAD9D,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CAsEhC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 StatusAction, StatusOverlay } from '@eclipse-glsp/client';
|
|
10
|
+
/**
|
|
11
|
+
* GLSP's status overlay, kept on the page.
|
|
12
|
+
*
|
|
13
|
+
* It inserts its element into the diagram's base div when the diagram starts,
|
|
14
|
+
* and sprotty's first render then replaces that div with its own, so the element
|
|
15
|
+
* is left detached and no status it shows is ever seen. This puts the element
|
|
16
|
+
* back into the current base div before it shows anything.
|
|
17
|
+
*/
|
|
18
|
+
export declare class HydraniumStatusOverlay extends StatusOverlay {
|
|
19
|
+
handle(action: StatusAction): void;
|
|
20
|
+
show(...args: Parameters<StatusOverlay['show']>): void;
|
|
21
|
+
protected reattach(): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=status-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-overlay.d.ts","sourceRoot":"","sources":["../src/status-overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGxE;;;;;;;GAOG;AACH,qBACa,sBAAuB,SAAQ,aAAa;IAC7C,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAG1C;IAEQ,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAG9D;IAED,SAAS,CAAC,QAAQ,IAAI,IAAI,CASzB;CACH"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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.HydraniumStatusOverlay = void 0;
|
|
18
|
+
const client_1 = require("@eclipse-glsp/client");
|
|
19
|
+
const inversify_1 = require("inversify");
|
|
20
|
+
/**
|
|
21
|
+
* GLSP's status overlay, kept on the page.
|
|
22
|
+
*
|
|
23
|
+
* It inserts its element into the diagram's base div when the diagram starts,
|
|
24
|
+
* and sprotty's first render then replaces that div with its own, so the element
|
|
25
|
+
* is left detached and no status it shows is ever seen. This puts the element
|
|
26
|
+
* back into the current base div before it shows anything.
|
|
27
|
+
*/
|
|
28
|
+
let HydraniumStatusOverlay = class HydraniumStatusOverlay extends client_1.StatusOverlay {
|
|
29
|
+
handle(action) {
|
|
30
|
+
this.reattach();
|
|
31
|
+
super.handle(action);
|
|
32
|
+
}
|
|
33
|
+
show(...args) {
|
|
34
|
+
super.show(...args);
|
|
35
|
+
this.reattach();
|
|
36
|
+
}
|
|
37
|
+
reattach() {
|
|
38
|
+
const container = this.containerElement;
|
|
39
|
+
if (!container || container.isConnected) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const parent = this.getParentContainer();
|
|
43
|
+
if (parent) {
|
|
44
|
+
this.insertContainerIntoParent(container, parent);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.HydraniumStatusOverlay = HydraniumStatusOverlay;
|
|
49
|
+
exports.HydraniumStatusOverlay = HydraniumStatusOverlay = __decorate([
|
|
50
|
+
(0, inversify_1.injectable)()
|
|
51
|
+
], HydraniumStatusOverlay);
|
|
52
|
+
//# sourceMappingURL=status-overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-overlay.js","sourceRoot":"","sources":["../src/status-overlay.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;AAElF,iDAAwE;AACxE,yCAAuC;AAEvC;;;;;;;GAOG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,sBAAa;IAC7C,MAAM,CAAC,MAAoB;QACjC,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAEQ,IAAI,CAAC,GAAG,IAAuC;QACrD,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC;IAES,QAAQ;QACf,MAAM,SAAS,GAAG,IAAI,CAAC,gBAA2C,CAAC;QACnE,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;YACvC,OAAO;QACV,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACzC,IAAI,MAAM,EAAE,CAAC;YACV,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACrD,CAAC;IACJ,CAAC;CACH,CAAA;;iCArBY,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CAqBlC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { interfaces } from 'inversify';
|
|
10
|
+
/**
|
|
11
|
+
* One captured `bind(...)` or `rebind(...)` call on a {@link BindRecorder}.
|
|
12
|
+
*
|
|
13
|
+
* `chain` holds the follow-up methods in invocation order, one string per call,
|
|
14
|
+
* rendered as `name(arg, …)`. Arguments are stringified inline so assertions
|
|
15
|
+
* can compare structure without re-resolving service identifiers.
|
|
16
|
+
*/
|
|
17
|
+
export interface BindRecorderEntry {
|
|
18
|
+
readonly kind: 'bind' | 'rebind';
|
|
19
|
+
readonly token: unknown;
|
|
20
|
+
readonly chain: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A spy set of Inversify binding hooks that records every call and its chain.
|
|
24
|
+
* Hand them to a module-factory under test — they satisfy Inversify's
|
|
25
|
+
* `interfaces.Bind` / `interfaces.Rebind` / `interfaces.Unbind` /
|
|
26
|
+
* `interfaces.IsBound` shapes at the call site but never resolve real services.
|
|
27
|
+
*
|
|
28
|
+
* Together they match GLSP's `BindingContext`, so a factory taking the whole
|
|
29
|
+
* context is called as `factory(recorder, options)` — the recorder *is*
|
|
30
|
+
* structurally a context.
|
|
31
|
+
*
|
|
32
|
+
* Use {@link captured} to assert which tokens were touched and with what
|
|
33
|
+
* fluent chain. {@link find} is a small ergonomic helper for the common
|
|
34
|
+
* lookup pattern.
|
|
35
|
+
*/
|
|
36
|
+
export interface BindRecorder {
|
|
37
|
+
readonly bind: interfaces.Bind;
|
|
38
|
+
readonly rebind: interfaces.Rebind;
|
|
39
|
+
readonly unbind: interfaces.Unbind;
|
|
40
|
+
readonly isBound: interfaces.IsBound;
|
|
41
|
+
readonly captured: readonly BindRecorderEntry[];
|
|
42
|
+
/** Convenience lookup — returns the first entry matching both `kind` and `token`, or `undefined`. */
|
|
43
|
+
find(kind: 'bind' | 'rebind', token: unknown): BindRecorderEntry | undefined;
|
|
44
|
+
}
|
|
45
|
+
/** Options for {@link makeBindRecorder}. */
|
|
46
|
+
export interface BindRecorderOptions {
|
|
47
|
+
/**
|
|
48
|
+
* What `isBound` answers. Defaults to `true` for every token, matching
|
|
49
|
+
* production: a head registers its own module *after* the GLSP default
|
|
50
|
+
* modules, so the tokens a framework module rebinds are already bound. Pass a
|
|
51
|
+
* list to model a container where only those tokens are bound — e.g. to
|
|
52
|
+
* exercise a factory's bind-instead-of-rebind fallback.
|
|
53
|
+
*/
|
|
54
|
+
readonly boundTokens?: readonly unknown[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Build a {@link BindRecorder} for testing Inversify module factories without a
|
|
58
|
+
* real container: hand it to the factory, then assert over {@link BindRecorder.find}.
|
|
59
|
+
*
|
|
60
|
+
* The `bind` / `rebind` functions return a chained proxy that ignores its
|
|
61
|
+
* arguments structurally but records every method invocation as a string.
|
|
62
|
+
* Stringification: functions → `<className>`, symbols → `Symbol(desc).toString()`,
|
|
63
|
+
* everything else → `String(value)`. This is enough to assert which tokens are
|
|
64
|
+
* involved without dragging real service resolution into the test.
|
|
65
|
+
*/
|
|
66
|
+
export declare function makeBindRecorder(options?: BindRecorderOptions): BindRecorder;
|
|
67
|
+
//# sourceMappingURL=bind-recorder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-recorder.d.ts","sourceRoot":"","sources":["../../src/testing/bind-recorder.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,YAAY;IAC1B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAChD,qGAAqG;IACrG,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAG,iBAAiB,GAAG,SAAS,CAAC;CAC/E;AAED,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC5C;AAuBD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAkChF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
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.makeBindRecorder = makeBindRecorder;
|
|
12
|
+
/** Methods on Inversify's binding builder that the recorder traps verbatim. */
|
|
13
|
+
const RECORDED_CHAIN_METHODS = [
|
|
14
|
+
'toSelf',
|
|
15
|
+
'to',
|
|
16
|
+
'toService',
|
|
17
|
+
'toConstantValue',
|
|
18
|
+
'toDynamicValue',
|
|
19
|
+
'toFactory',
|
|
20
|
+
'toFunction',
|
|
21
|
+
'toAutoFactory',
|
|
22
|
+
'toProvider',
|
|
23
|
+
'inSingletonScope',
|
|
24
|
+
'inTransientScope',
|
|
25
|
+
'inRequestScope',
|
|
26
|
+
'whenTargetNamed',
|
|
27
|
+
'whenTargetTagged',
|
|
28
|
+
'whenInjectedInto',
|
|
29
|
+
'onActivation',
|
|
30
|
+
'onDeactivation'
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Build a {@link BindRecorder} for testing Inversify module factories without a
|
|
34
|
+
* real container: hand it to the factory, then assert over {@link BindRecorder.find}.
|
|
35
|
+
*
|
|
36
|
+
* The `bind` / `rebind` functions return a chained proxy that ignores its
|
|
37
|
+
* arguments structurally but records every method invocation as a string.
|
|
38
|
+
* Stringification: functions → `<className>`, symbols → `Symbol(desc).toString()`,
|
|
39
|
+
* everything else → `String(value)`. This is enough to assert which tokens are
|
|
40
|
+
* involved without dragging real service resolution into the test.
|
|
41
|
+
*/
|
|
42
|
+
function makeBindRecorder(options = {}) {
|
|
43
|
+
const captured = [];
|
|
44
|
+
const stringifyArg = (value) => {
|
|
45
|
+
if (typeof value === 'function') {
|
|
46
|
+
return `<${value.name || 'fn'}>`;
|
|
47
|
+
}
|
|
48
|
+
if (typeof value === 'symbol') {
|
|
49
|
+
return value.toString();
|
|
50
|
+
}
|
|
51
|
+
return String(value);
|
|
52
|
+
};
|
|
53
|
+
const beginEntry = (kind, token) => {
|
|
54
|
+
const entry = { kind, token, chain: [] };
|
|
55
|
+
captured.push(entry);
|
|
56
|
+
const proxy = {};
|
|
57
|
+
for (const method of RECORDED_CHAIN_METHODS) {
|
|
58
|
+
proxy[method] = (...args) => {
|
|
59
|
+
entry.chain.push(`${method}(${args.map(stringifyArg).join(', ')})`);
|
|
60
|
+
return proxy;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return proxy;
|
|
64
|
+
};
|
|
65
|
+
const bind = ((token) => beginEntry('bind', token));
|
|
66
|
+
const rebind = ((token) => beginEntry('rebind', token));
|
|
67
|
+
const unbind = (() => undefined);
|
|
68
|
+
const isBound = ((token) => options.boundTokens?.includes(token) ?? true);
|
|
69
|
+
const find = (kind, token) => captured.find(entry => entry.kind === kind && entry.token === token);
|
|
70
|
+
return { bind, rebind, unbind, isBound, captured, find };
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=bind-recorder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-recorder.js","sourceRoot":"","sources":["../../src/testing/bind-recorder.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAqDlF,+EAA+E;AAC/E,MAAM,sBAAsB,GAAG;IAC5B,QAAQ;IACR,IAAI;IACJ,WAAW;IACX,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;IACX,YAAY;IACZ,eAAe;IACf,YAAY;IACZ,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;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EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAsB,CAAC;IACtF,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAiC,CAAC;IACjE,MAAM,OAAO,GAAG,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAuB,CAAC;IACzG,MAAM,IAAI,GAAG,CAAC,IAAuB,EAAE,KAAc,EAAiC,EAAE,CACrF,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IAExE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -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 * from './bind-recorder';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAKlF,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
// Subpath barrel for `@hydranium/glsp-client/testing` — the Inversify binding
|
|
26
|
+
// recorder for testing a module factory without a container.
|
|
27
|
+
__exportStar(require("./bind-recorder"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,8EAA8E;AAC9E,6DAA6D;AAE7D,kDAAgC"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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 { Clock, Logger, Tracer } from '@hydranium/protocol';
|
|
10
|
+
import type { interfaces } from 'inversify';
|
|
11
|
+
/**
|
|
12
|
+
* The DI tokens the framework's client classes inject, typed by the protocol
|
|
13
|
+
* interfaces so a host binds whatever implementation it has: a Theia frontend
|
|
14
|
+
* binds its Output-channel logger, a page or webview a console logger. Kept in
|
|
15
|
+
* a registry so a token's name cannot collide with the type it injects.
|
|
16
|
+
*
|
|
17
|
+
* `Logger` and `Tracer` are required, so a host that binds neither fails at
|
|
18
|
+
* resolution rather than running silent; `createGlspClientModule` binds
|
|
19
|
+
* defaults for a host that passes none. `Clock` is optional: the classes fall
|
|
20
|
+
* back to a `SystemClock`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const HydraniumClientTypes: {
|
|
23
|
+
readonly Logger: interfaces.ServiceIdentifier<Logger>;
|
|
24
|
+
readonly Tracer: interfaces.ServiceIdentifier<Tracer>;
|
|
25
|
+
readonly Clock: interfaces.ServiceIdentifier<Clock>;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAQ5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB;aAC9B,MAAM;aACN,MAAM;aACN,KAAK;CACE,CAAC"}
|
package/lib/types.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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.HydraniumClientTypes = void 0;
|
|
12
|
+
/** A fresh `Symbol` cast to inversify's typed identifier, so `bind` and
|
|
13
|
+
* `@inject` sites type-check against `T` rather than `any`. */
|
|
14
|
+
function serviceIdentifier(description) {
|
|
15
|
+
return Symbol(description);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The DI tokens the framework's client classes inject, typed by the protocol
|
|
19
|
+
* interfaces so a host binds whatever implementation it has: a Theia frontend
|
|
20
|
+
* binds its Output-channel logger, a page or webview a console logger. Kept in
|
|
21
|
+
* a registry so a token's name cannot collide with the type it injects.
|
|
22
|
+
*
|
|
23
|
+
* `Logger` and `Tracer` are required, so a host that binds neither fails at
|
|
24
|
+
* resolution rather than running silent; `createGlspClientModule` binds
|
|
25
|
+
* defaults for a host that passes none. `Clock` is optional: the classes fall
|
|
26
|
+
* back to a `SystemClock`.
|
|
27
|
+
*/
|
|
28
|
+
exports.HydraniumClientTypes = {
|
|
29
|
+
Logger: serviceIdentifier('HydraniumClientLogger'),
|
|
30
|
+
Tracer: serviceIdentifier('HydraniumClientTracer'),
|
|
31
|
+
Clock: serviceIdentifier('HydraniumClientClock')
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=types.js.map
|
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAKlF;gEACgE;AAChE,SAAS,iBAAiB,CAAI,WAAmB;IAC9C,OAAO,MAAM,CAAC,WAAW,CAAoC,CAAC;AACjE,CAAC;AAED;;;;;;;;;;GAUG;AACU,QAAA,oBAAoB,GAAG;IACjC,MAAM,EAAE,iBAAiB,CAAS,uBAAuB,CAAC;IAC1D,MAAM,EAAE,iBAAiB,CAAS,uBAAuB,CAAC;IAC1D,KAAK,EAAE,iBAAiB,CAAQ,sBAAsB,CAAC;CAChD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydranium/glsp-client",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0-next",
|
|
4
|
+
"description": "Host-neutral client classes for GLSP heads built on @hydranium/glsp-server, the binder that mounts them in a Theia frontend, a VS Code webview or a plain browser page, and the edge whose labels keep finite bounds without bendpoints.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"diagram",
|
|
7
|
+
"glsp",
|
|
8
|
+
"hydranium",
|
|
9
|
+
"langium",
|
|
10
|
+
"language-server",
|
|
11
|
+
"lsp"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/eclipse-emfcloud/hydranium/tree/main/packages/glsp-client",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/eclipse-emfcloud/hydranium/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Hydranium Team"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/eclipse-emfcloud/hydranium.git",
|
|
24
|
+
"directory": "packages/glsp-client"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"lib",
|
|
28
|
+
"src",
|
|
29
|
+
"!lib/**/*.tsbuildinfo"
|
|
30
|
+
],
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"main": "lib/index.js",
|
|
33
|
+
"types": "lib/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./lib/index.d.ts",
|
|
37
|
+
"default": "./lib/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./messages": {
|
|
40
|
+
"types": "./lib/messages/index.d.ts",
|
|
41
|
+
"default": "./lib/messages/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./testing": {
|
|
44
|
+
"types": "./lib/testing/index.d.ts",
|
|
45
|
+
"default": "./lib/testing/index.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsc -b",
|
|
53
|
+
"clean": "rimraf lib tsconfig.tsbuildinfo",
|
|
54
|
+
"lint": "oxlint --format stylish --config ../../oxlint.config.cjs src test --max-warnings 0",
|
|
55
|
+
"prepack": "node -e \"const m=require('./package.json'),fs=require('node:fs');const missing=[m.main,...Object.values(m.bin||{})].filter(entry=>entry&&!fs.existsSync(entry));if(missing.length){console.error('prepack '+m.name+': not built ('+missing.join(', ')+' missing). Run the build before packing: a files entry that matches nothing is skipped silently, so the tarball would ship src only.');process.exit(1);}\"",
|
|
56
|
+
"test": "npm run typecheck:test && vitest run",
|
|
57
|
+
"typecheck:test": "tsc --noEmit -p tsconfig.test.json",
|
|
58
|
+
"watch": "tsc -b -w --preserveWatchOutput"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@eclipse-glsp/client": "2.7.0",
|
|
62
|
+
"@hydranium/protocol": "1.0.0-next",
|
|
63
|
+
"@types/node": "^22.0.0",
|
|
64
|
+
"inversify": "6.2.2",
|
|
65
|
+
"reflect-metadata": "0.2.2",
|
|
66
|
+
"rimraf": "^5.0.0",
|
|
67
|
+
"snabbdom": "3.5.1",
|
|
68
|
+
"typescript": "^7.0.2"
|
|
69
|
+
},
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"@eclipse-glsp/client": "^2.6.0",
|
|
72
|
+
"@hydranium/protocol": "^1.0.0-next",
|
|
73
|
+
"inversify": "^6.0.0",
|
|
74
|
+
"snabbdom": "^3.5.1"
|
|
75
|
+
},
|
|
76
|
+
"engines": {
|
|
77
|
+
"node": ">=22.13"
|
|
78
|
+
},
|
|
79
|
+
"//peerDependencies": "`inversify` is imported plainly, as `@eclipse-glsp/client` imports it, and peered so the classes here decorate with the same copy the diagram container resolves; `@theia/core/shared/inversify` re-exports that copy, so a Theia frontend satisfies it without a second install. `snabbdom` is a peer for the `VNode` type the hidden-bounds updater reads, the same reason the Theia package peers it.",
|
|
80
|
+
"//prepack": "The publish guard, a `prepack` rather than a `prepare`: `prepack` runs only when a tarball is made (`npm pack`, `npm publish`) and never on install, so it cannot break the install it has no business touching. What it defends against: `files` lists `lib`, `lib` is gitignored, and a `files` entry matching nothing is skipped SILENTLY — so `npm publish` from an unbuilt tree emits a tarball of `src` and nothing else, with no error."
|
|
81
|
+
}
|