@gjsify/bridge-types 0.3.13 → 0.3.15
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/esm/bridge-environment.js +24 -15
- package/lib/esm/bridge-window.js +53 -46
- package/lib/esm/index.js +3 -5
- package/package.json +8 -8
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import { Document } from "@gjsify/dom-elements";
|
|
2
1
|
import { BridgeWindow } from "./bridge-window.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { Document } from "@gjsify/dom-elements";
|
|
3
|
+
|
|
4
|
+
//#region src/bridge-environment.ts
|
|
5
|
+
/**
|
|
6
|
+
* An isolated browser-like environment scoped to a single bridge instance.
|
|
7
|
+
*
|
|
8
|
+
* Contains its own `Document` (with a `body` element) and a `BridgeWindow`
|
|
9
|
+
* that delegates animation frames, timing, and viewport dimensions back
|
|
10
|
+
* to the owning GTK widget.
|
|
11
|
+
*/
|
|
12
|
+
var BridgeEnvironment = class {
|
|
13
|
+
constructor(host) {
|
|
14
|
+
this.document = new Document();
|
|
15
|
+
this.window = new BridgeWindow(this, host);
|
|
16
|
+
}
|
|
17
|
+
get body() {
|
|
18
|
+
return this.document.body;
|
|
19
|
+
}
|
|
20
|
+
get [Symbol.toStringTag]() {
|
|
21
|
+
return "BridgeEnvironment";
|
|
22
|
+
}
|
|
17
23
|
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { BridgeEnvironment };
|
package/lib/esm/bridge-window.js
CHANGED
|
@@ -1,48 +1,55 @@
|
|
|
1
1
|
import { EventTarget } from "@gjsify/dom-events";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
2
|
+
|
|
3
|
+
//#region src/bridge-window.ts
|
|
4
|
+
/**
|
|
5
|
+
* A `window`-like object bound to a specific bridge instance.
|
|
6
|
+
*
|
|
7
|
+
* Libraries that access `window.innerWidth`, `window.requestAnimationFrame`,
|
|
8
|
+
* or `window.addEventListener` will work when given this object (or when
|
|
9
|
+
* `installGlobals()` aliases it onto `globalThis`).
|
|
10
|
+
*/
|
|
11
|
+
var BridgeWindow = class extends EventTarget {
|
|
12
|
+
constructor(environment, host) {
|
|
13
|
+
super();
|
|
14
|
+
this._environment = environment;
|
|
15
|
+
this._host = host;
|
|
16
|
+
}
|
|
17
|
+
get document() {
|
|
18
|
+
return this._environment.document;
|
|
19
|
+
}
|
|
20
|
+
get innerWidth() {
|
|
21
|
+
return this._host.getWidth();
|
|
22
|
+
}
|
|
23
|
+
get innerHeight() {
|
|
24
|
+
return this._host.getHeight();
|
|
25
|
+
}
|
|
26
|
+
get devicePixelRatio() {
|
|
27
|
+
return this._host.getDevicePixelRatio();
|
|
28
|
+
}
|
|
29
|
+
requestAnimationFrame(callback) {
|
|
30
|
+
if (this._host.requestAnimationFrame) {
|
|
31
|
+
return this._host.requestAnimationFrame(callback);
|
|
32
|
+
}
|
|
33
|
+
throw new Error("requestAnimationFrame is not supported by this bridge");
|
|
34
|
+
}
|
|
35
|
+
cancelAnimationFrame(id) {
|
|
36
|
+
if (this._host.cancelAnimationFrame) {
|
|
37
|
+
this._host.cancelAnimationFrame(id);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
get performance() {
|
|
41
|
+
const host = this._host;
|
|
42
|
+
return { now() {
|
|
43
|
+
return host.performanceNow();
|
|
44
|
+
} };
|
|
45
|
+
}
|
|
46
|
+
getComputedStyle(_element) {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
get [Symbol.toStringTag]() {
|
|
50
|
+
return "BridgeWindow";
|
|
51
|
+
}
|
|
48
52
|
};
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
export { BridgeWindow };
|
package/lib/esm/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { BridgeEnvironment } from "./bridge-environment.js";
|
|
2
1
|
import { BridgeWindow } from "./bridge-window.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
2
|
+
import { BridgeEnvironment } from "./bridge-environment.js";
|
|
3
|
+
|
|
4
|
+
export { BridgeEnvironment, BridgeWindow };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/bridge-types",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.15",
|
|
4
4
|
"description": "Shared interfaces and environment classes for GTK-DOM bridge containers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"bridge"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@girs/gdk-4.0": "
|
|
29
|
-
"@girs/gjs": "
|
|
30
|
-
"@girs/glib-2.0": "
|
|
31
|
-
"@girs/gtk-4.0": "
|
|
32
|
-
"@gjsify/dom-elements": "^0.3.
|
|
33
|
-
"@gjsify/dom-events": "^0.3.
|
|
28
|
+
"@girs/gdk-4.0": "4.0.0-4.0.0-rc.9",
|
|
29
|
+
"@girs/gjs": "4.0.0-rc.9",
|
|
30
|
+
"@girs/glib-2.0": "2.88.0-4.0.0-rc.9",
|
|
31
|
+
"@girs/gtk-4.0": "4.23.0-4.0.0-rc.9",
|
|
32
|
+
"@gjsify/dom-elements": "^0.3.15",
|
|
33
|
+
"@gjsify/dom-events": "^0.3.15"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@gjsify/cli": "^0.3.
|
|
36
|
+
"@gjsify/cli": "^0.3.15",
|
|
37
37
|
"@types/node": "^25.6.0",
|
|
38
38
|
"typescript": "^6.0.3"
|
|
39
39
|
}
|