@threenative/ui 0.3.16 → 0.3.18
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 +2 -42
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, useRef, useState, useEffect, useCallback, useMemo, useSyncExternalStore, useContext } from 'react';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { connectUiBridge, subscribeUiState, publishHitRegions, sendUiIntent, UI_READY_INTENT
|
|
3
|
+
import { connectUiBridge, subscribeUiState, publishHitRegions, sendUiIntent, UI_READY_INTENT } from '@threenative/core/ui-layer';
|
|
4
4
|
|
|
5
5
|
// src/GameCanvas.tsx
|
|
6
6
|
function GameCanvas({
|
|
@@ -458,43 +458,6 @@ function useUiLayer(name) {
|
|
|
458
458
|
}
|
|
459
459
|
return value;
|
|
460
460
|
}
|
|
461
|
-
function DevSceneVerdict({ bridge }) {
|
|
462
|
-
const [verdict, setVerdict] = useState(void 0);
|
|
463
|
-
useEffect(
|
|
464
|
-
() => bridge.onMessage((message) => {
|
|
465
|
-
if (message.type !== UI_DEV_METRICS_MESSAGE) return;
|
|
466
|
-
const warning = message.sceneWarning;
|
|
467
|
-
if (typeof warning === "string" && warning.length > 0) setVerdict(warning);
|
|
468
|
-
}),
|
|
469
|
-
[bridge]
|
|
470
|
-
);
|
|
471
|
-
if (verdict === void 0) return null;
|
|
472
|
-
return (
|
|
473
|
-
// `<output>` carries the status role natively, so the readout is announced without an ARIA
|
|
474
|
-
// attribute standing in for an element that already means this.
|
|
475
|
-
/* @__PURE__ */ jsx(
|
|
476
|
-
"output",
|
|
477
|
-
{
|
|
478
|
-
className: "tn-dev-scene-warning",
|
|
479
|
-
style: {
|
|
480
|
-
position: "absolute",
|
|
481
|
-
top: 8,
|
|
482
|
-
right: 8,
|
|
483
|
-
maxWidth: 420,
|
|
484
|
-
padding: "2px 6px",
|
|
485
|
-
borderRadius: 4,
|
|
486
|
-
background: "rgba(0, 0, 0, 0.55)",
|
|
487
|
-
color: "#ffd98a",
|
|
488
|
-
font: "500 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
489
|
-
whiteSpace: "normal",
|
|
490
|
-
pointerEvents: "none",
|
|
491
|
-
zIndex: 2147483647
|
|
492
|
-
},
|
|
493
|
-
children: verdict
|
|
494
|
-
}
|
|
495
|
-
)
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
461
|
function UiLayer({ children }) {
|
|
499
462
|
const [value, setValue] = useState(void 0);
|
|
500
463
|
const registryRef = useRef(void 0);
|
|
@@ -520,10 +483,7 @@ function UiLayer({ children }) {
|
|
|
520
483
|
};
|
|
521
484
|
}, [value]);
|
|
522
485
|
if (value === void 0) return null;
|
|
523
|
-
return /* @__PURE__ */
|
|
524
|
-
children,
|
|
525
|
-
/* @__PURE__ */ jsx(DevSceneVerdict, { bridge: value.bridge })
|
|
526
|
-
] });
|
|
486
|
+
return /* @__PURE__ */ jsx(UiLayerContext.Provider, { value, children });
|
|
527
487
|
}
|
|
528
488
|
function useUiState(selector) {
|
|
529
489
|
return useMirrorState("useUiState", true, selector);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threenative/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React bindings for mounting a ThreeNative game and reading throttled state.",
|
|
6
6
|
"keywords": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@threenative/core": ">=0.3.
|
|
44
|
+
"@threenative/core": ">=0.3.18 <0.4.0",
|
|
45
45
|
"react": ">=19.2.0 <20",
|
|
46
46
|
"react-dom": ">=19.2.0 <20"
|
|
47
47
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"tsup": "8.5.1",
|
|
57
57
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
58
58
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
59
|
-
"@threenative/core": "0.3.
|
|
59
|
+
"@threenative/core": "0.3.18"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsup --config tsup.config.ts && publint",
|