@noya-app/noya-multiplayer-react 0.1.82 → 0.1.84
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 +13 -0
- package/dist/index.bundle.js +24 -24
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noya-app/noya-multiplayer-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.84",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dev": "npm run build -- --watch"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@noya-app/state-manager": "0.1.
|
|
14
|
+
"@noya-app/state-manager": "0.1.66",
|
|
15
15
|
"@noya-app/emitter": "0.1.0",
|
|
16
16
|
"@noya-app/observable": "0.1.12",
|
|
17
17
|
"@noya-app/task-runner": "0.1.7",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { afterEach, expect, it } from "bun:test";
|
|
2
|
+
import { NoyaManager } from "@noya-app/state-manager";
|
|
3
|
+
import { cleanup, render } from "@testing-library/react";
|
|
4
|
+
import { StateInspector } from "./StateInspector";
|
|
5
|
+
|
|
6
|
+
afterEach(() => {
|
|
7
|
+
cleanup();
|
|
8
|
+
localStorage.clear();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("can default to collapsed", () => {
|
|
12
|
+
const noyaManager = new NoyaManager({});
|
|
13
|
+
const view = render(
|
|
14
|
+
<StateInspector noyaManager={noyaManager} defaultCollapsed />
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
expect(view.queryByText("Users")).toBeNull();
|
|
18
|
+
});
|
|
@@ -48,6 +48,7 @@ export type StateInspectorOptions = {
|
|
|
48
48
|
colorScheme?: "light" | "dark";
|
|
49
49
|
anchor?: StateInspectorAnchor;
|
|
50
50
|
advanced?: boolean;
|
|
51
|
+
defaultCollapsed?: boolean;
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
export const StateInspector = memoGeneric(function StateInspector<
|
|
@@ -62,6 +63,7 @@ export const StateInspector = memoGeneric(function StateInspector<
|
|
|
62
63
|
anchor = "right",
|
|
63
64
|
unstyled = false,
|
|
64
65
|
advanced = false,
|
|
66
|
+
defaultCollapsed = false,
|
|
65
67
|
...props
|
|
66
68
|
}: {
|
|
67
69
|
noyaManager: NoyaManager<S, M, E, MenuT, I>;
|
|
@@ -99,7 +101,7 @@ export const StateInspector = memoGeneric(function StateInspector<
|
|
|
99
101
|
|
|
100
102
|
const [showInspector, setShowInspector] = useLocalStorageState(
|
|
101
103
|
"noya-multiplayer-react-show-inspector",
|
|
102
|
-
|
|
104
|
+
!defaultCollapsed
|
|
103
105
|
);
|
|
104
106
|
const [showEvents, setShowEvents] = useLocalStorageState(
|
|
105
107
|
"noya-multiplayer-react-show-events",
|
|
@@ -40,12 +40,14 @@ export function useStateInspector<
|
|
|
40
40
|
noyaManager,
|
|
41
41
|
disabled = false,
|
|
42
42
|
advanced = false,
|
|
43
|
+
defaultCollapsed = false,
|
|
43
44
|
colorScheme,
|
|
44
45
|
anchor,
|
|
45
46
|
}: {
|
|
46
47
|
noyaManager: NoyaManager<S, M, E, MenuT, I>;
|
|
47
48
|
disabled?: boolean;
|
|
48
49
|
advanced?: boolean;
|
|
50
|
+
defaultCollapsed?: boolean;
|
|
49
51
|
colorScheme?: ComponentProps<typeof StateInspector>["colorScheme"];
|
|
50
52
|
anchor?: ComponentProps<typeof StateInspector>["anchor"];
|
|
51
53
|
}) {
|
|
@@ -70,7 +72,8 @@ export function useStateInspector<
|
|
|
70
72
|
anchor={anchor}
|
|
71
73
|
noyaManager={noyaManager}
|
|
72
74
|
advanced={advanced}
|
|
75
|
+
defaultCollapsed={defaultCollapsed}
|
|
73
76
|
/>
|
|
74
77
|
);
|
|
75
|
-
}, [noyaManager, anchor, colorScheme, root, advanced]);
|
|
78
|
+
}, [noyaManager, anchor, colorScheme, root, advanced, defaultCollapsed]);
|
|
76
79
|
}
|
package/src/singleton.tsx
CHANGED
|
@@ -139,6 +139,11 @@ export function initializeNoyaSingleton<
|
|
|
139
139
|
advanced={
|
|
140
140
|
resolvedInspector === true ? false : resolvedInspector.advanced
|
|
141
141
|
}
|
|
142
|
+
defaultCollapsed={
|
|
143
|
+
resolvedInspector === true
|
|
144
|
+
? false
|
|
145
|
+
: resolvedInspector.defaultCollapsed
|
|
146
|
+
}
|
|
142
147
|
/>
|
|
143
148
|
);
|
|
144
149
|
}
|