@threenative/ui 0.3.0 → 0.3.2
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/dist/index.js +10 -1
- package/package.json +21 -3
package/dist/index.js
CHANGED
|
@@ -11,6 +11,12 @@ function GameCanvas({
|
|
|
11
11
|
const [failure, setFailure] = useState();
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
let cancelled = false;
|
|
14
|
+
const publishStartupPhase = () => {
|
|
15
|
+
const phase = game.ctx?.startup.phase;
|
|
16
|
+
if (!cancelled && phase !== void 0 && host.current !== null)
|
|
17
|
+
host.current.dataset.threenativeStartup = phase;
|
|
18
|
+
};
|
|
19
|
+
const startupTimer = globalThis.setInterval(publishStartupPhase, 100);
|
|
14
20
|
setFailure(void 0);
|
|
15
21
|
void game.start().then(() => {
|
|
16
22
|
const canvas = game.ctx?.renderer.domElement;
|
|
@@ -21,12 +27,14 @@ function GameCanvas({
|
|
|
21
27
|
canvas.style.touchAction = "none";
|
|
22
28
|
host.current.replaceChildren(canvas);
|
|
23
29
|
}
|
|
30
|
+
publishStartupPhase();
|
|
24
31
|
}).catch((error) => {
|
|
25
32
|
if (cancelled) return;
|
|
26
33
|
setFailure(error instanceof Error ? error.message : String(error));
|
|
27
34
|
});
|
|
28
35
|
return () => {
|
|
29
36
|
cancelled = true;
|
|
37
|
+
globalThis.clearInterval(startupTimer);
|
|
30
38
|
game.stop();
|
|
31
39
|
};
|
|
32
40
|
}, [game]);
|
|
@@ -36,8 +44,9 @@ function GameCanvas({
|
|
|
36
44
|
ref: host,
|
|
37
45
|
className,
|
|
38
46
|
"data-threenative-canvas": "true",
|
|
47
|
+
"data-threenative-startup": "starting",
|
|
39
48
|
style: { height: "100%", width: "100%" },
|
|
40
|
-
children: failure === void 0 ? null : /* @__PURE__ */ jsx("div", { "data-threenative-canvas-error": "true", role: "alert", children: failure })
|
|
49
|
+
children: failure === void 0 ? null : /* @__PURE__ */ jsx("div", { id: "threenative-canvas-error", "data-threenative-canvas-error": "true", role: "alert", children: failure })
|
|
41
50
|
}
|
|
42
51
|
);
|
|
43
52
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threenative/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React bindings for mounting a ThreeNative game and reading throttled state.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"threenative",
|
|
8
|
+
"react",
|
|
9
|
+
"tailwind",
|
|
10
|
+
"hud",
|
|
11
|
+
"three",
|
|
12
|
+
"threejs",
|
|
13
|
+
"gamedev"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/ThreeNativeHQ/threenative#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/ThreeNativeHQ/threenative/issues"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/ThreeNativeHQ/threenative.git",
|
|
22
|
+
"directory": "packages/ui"
|
|
23
|
+
},
|
|
6
24
|
"type": "module",
|
|
7
25
|
"files": [
|
|
8
26
|
"dist",
|
|
@@ -23,7 +41,7 @@
|
|
|
23
41
|
},
|
|
24
42
|
"sideEffects": false,
|
|
25
43
|
"peerDependencies": {
|
|
26
|
-
"@threenative/core": ">=0.3.
|
|
44
|
+
"@threenative/core": ">=0.3.2 <0.4.0",
|
|
27
45
|
"react": ">=19.2.0 <20",
|
|
28
46
|
"react-dom": ">=19.2.0 <20"
|
|
29
47
|
},
|
|
@@ -37,7 +55,7 @@
|
|
|
37
55
|
"react-test-renderer": "19.2.0",
|
|
38
56
|
"tsup": "8.5.1",
|
|
39
57
|
"typescript": "5.9.3",
|
|
40
|
-
"@threenative/core": "0.3.
|
|
58
|
+
"@threenative/core": "0.3.2"
|
|
41
59
|
},
|
|
42
60
|
"scripts": {
|
|
43
61
|
"build": "tsup --config tsup.config.ts && publint",
|