@noya-app/noya-multiplayer-react 0.1.83 → 0.1.85
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/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +14 -0
- package/dist/index.bundle.js +25 -22
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +43 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/NoyaStateContext.tsx +18 -16
- package/src/__tests__/useResourceUrl.test.tsx +92 -0
- package/src/index.ts +1 -0
- package/src/inspector/StateInspector.test.tsx +18 -0
- package/src/inspector/StateInspector.tsx +3 -1
- package/src/inspector/useStateInspector.tsx +4 -1
- package/src/singleton.tsx +5 -0
- package/src/useResourceUrl.ts +19 -0
package/dist/index.mjs
CHANGED
|
@@ -6768,6 +6768,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6768
6768
|
anchor = "right",
|
|
6769
6769
|
unstyled = false,
|
|
6770
6770
|
advanced = false,
|
|
6771
|
+
defaultCollapsed = false,
|
|
6771
6772
|
...props
|
|
6772
6773
|
}) {
|
|
6773
6774
|
const {
|
|
@@ -6797,7 +6798,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6797
6798
|
const serverSimulationLogsContainerRef = React17.useRef(null);
|
|
6798
6799
|
const [showInspector, setShowInspector] = useLocalStorageState(
|
|
6799
6800
|
"noya-multiplayer-react-show-inspector",
|
|
6800
|
-
|
|
6801
|
+
!defaultCollapsed
|
|
6801
6802
|
);
|
|
6802
6803
|
const [showEvents, setShowEvents] = useLocalStorageState(
|
|
6803
6804
|
"noya-multiplayer-react-show-events",
|
|
@@ -7548,6 +7549,7 @@ function useStateInspector({
|
|
|
7548
7549
|
noyaManager,
|
|
7549
7550
|
disabled = false,
|
|
7550
7551
|
advanced = false,
|
|
7552
|
+
defaultCollapsed = false,
|
|
7551
7553
|
colorScheme,
|
|
7552
7554
|
anchor
|
|
7553
7555
|
}) {
|
|
@@ -7567,11 +7569,12 @@ function useStateInspector({
|
|
|
7567
7569
|
colorScheme,
|
|
7568
7570
|
anchor,
|
|
7569
7571
|
noyaManager,
|
|
7570
|
-
advanced
|
|
7572
|
+
advanced,
|
|
7573
|
+
defaultCollapsed
|
|
7571
7574
|
}
|
|
7572
7575
|
)
|
|
7573
7576
|
);
|
|
7574
|
-
}, [noyaManager, anchor, colorScheme, root, advanced]);
|
|
7577
|
+
}, [noyaManager, anchor, colorScheme, root, advanced, defaultCollapsed]);
|
|
7575
7578
|
}
|
|
7576
7579
|
|
|
7577
7580
|
// src/hooks.ts
|
|
@@ -7909,7 +7912,8 @@ function initializeNoyaSingleton(options) {
|
|
|
7909
7912
|
noyaManager: noyaManagerSingleton,
|
|
7910
7913
|
colorScheme: resolvedInspector === true ? resolvedTheme : resolvedInspector.colorScheme,
|
|
7911
7914
|
anchor: resolvedInspector === true ? "bottom right" : resolvedInspector.anchor,
|
|
7912
|
-
advanced: resolvedInspector === true ? false : resolvedInspector.advanced
|
|
7915
|
+
advanced: resolvedInspector === true ? false : resolvedInspector.advanced,
|
|
7916
|
+
defaultCollapsed: resolvedInspector === true ? false : resolvedInspector.defaultCollapsed
|
|
7913
7917
|
}
|
|
7914
7918
|
)
|
|
7915
7919
|
);
|
|
@@ -8005,22 +8009,23 @@ function buildResourcePatchPayload({
|
|
|
8005
8009
|
return patch;
|
|
8006
8010
|
}
|
|
8007
8011
|
var AnyNoyaStateContext = createContext(void 0);
|
|
8008
|
-
function
|
|
8012
|
+
function useOptionalAnyNoyaStateContext() {
|
|
8009
8013
|
const value = useContext(AnyNoyaStateContext);
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8014
|
+
const bindings = getNoyaSingletonBindings();
|
|
8015
|
+
if (value) return value;
|
|
8016
|
+
if (!bindings) return void 0;
|
|
8017
|
+
return {
|
|
8018
|
+
noyaManager: getNoyaManagerSingleton(),
|
|
8019
|
+
theme: bindings.theme,
|
|
8020
|
+
viewType: bindings.viewType
|
|
8021
|
+
};
|
|
8022
|
+
}
|
|
8023
|
+
function useAnyNoyaStateContext() {
|
|
8024
|
+
const value = useOptionalAnyNoyaStateContext();
|
|
8025
|
+
if (value) return value;
|
|
8026
|
+
throw new Error(
|
|
8027
|
+
"useNoyaStateContext must be used within a NoyaStateProvider"
|
|
8028
|
+
);
|
|
8024
8029
|
}
|
|
8025
8030
|
function useAnyNoyaManager() {
|
|
8026
8031
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
@@ -8494,6 +8499,18 @@ var UserPointersOverlay = memoGeneric2(function UserPointers({
|
|
|
8494
8499
|
}));
|
|
8495
8500
|
});
|
|
8496
8501
|
|
|
8502
|
+
// src/useResourceUrl.ts
|
|
8503
|
+
import { getResourceUrl } from "@noya-app/state-manager";
|
|
8504
|
+
function useResourceUrl(idOrStableId) {
|
|
8505
|
+
const { noyaManager } = useAnyNoyaStateContext();
|
|
8506
|
+
const resources = useObservable(
|
|
8507
|
+
noyaManager.resourceManager.optimisticResources$
|
|
8508
|
+
);
|
|
8509
|
+
const assets = useObservable(noyaManager.assetManager.assets$);
|
|
8510
|
+
if (!idOrStableId) return void 0;
|
|
8511
|
+
return getResourceUrl(idOrStableId, resources, assets);
|
|
8512
|
+
}
|
|
8513
|
+
|
|
8497
8514
|
// src/WebSocketConnection.ts
|
|
8498
8515
|
import {
|
|
8499
8516
|
ReconnectingWebSocket,
|
|
@@ -8632,11 +8649,13 @@ export {
|
|
|
8632
8649
|
useNoyaUserManager,
|
|
8633
8650
|
useNoyaUsers,
|
|
8634
8651
|
useObservable,
|
|
8652
|
+
useOptionalAnyNoyaStateContext,
|
|
8635
8653
|
useOutputTransforms,
|
|
8636
8654
|
usePipelineManager,
|
|
8637
8655
|
usePublish,
|
|
8638
8656
|
useRegisterAITool,
|
|
8639
8657
|
useResourceManager,
|
|
8658
|
+
useResourceUrl,
|
|
8640
8659
|
useResources,
|
|
8641
8660
|
useScriptEvaluator,
|
|
8642
8661
|
useSecret,
|