@noya-app/noya-multiplayer-react 0.1.9

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/.eslintrc.js ADDED
@@ -0,0 +1,11 @@
1
+ /** @type {import("eslint").Linter.Config} */
2
+ module.exports = {
3
+ root: true,
4
+ extends: ["@repo/eslint-config/next.js"],
5
+ parser: "@typescript-eslint/parser",
6
+ rules: {
7
+ "no-unused-vars": "off",
8
+ "no-redeclare": "off",
9
+ },
10
+ ignorePatterns: ["dist/"],
11
+ };
@@ -0,0 +1,18 @@
1
+ $ tsup src/index.ts --format cjs,esm --dts --sourcemap
2
+ CLI Building entry: src/index.ts
3
+ CLI Using tsconfig: tsconfig.json
4
+ CLI tsup v8.0.1
5
+ CLI Target: esnext
6
+ CJS Build start
7
+ ESM Build start
8
+ ESM dist/index.mjs 21.59 KB
9
+ ESM dist/index.mjs.map 40.26 KB
10
+ ESM ⚡️ Build success in 23ms
11
+ CJS dist/index.js 25.07 KB
12
+ CJS dist/index.js.map 40.06 KB
13
+ CJS ⚡️ Build success in 23ms
14
+ DTS Build start
15
+ "ComponentPropsWithoutRef" is imported from external module "react" but never used in "src/inspector/StateInspector.tsx" and "src/hooks.ts".
16
+ DTS ⚡️ Build success in 2122ms
17
+ DTS dist/index.d.ts 2.14 KB
18
+ DTS dist/index.d.mts 2.14 KB
package/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ # @noya-app/state-manager
2
+
3
+ ## 0.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 727c398: Split react state manager UI into separate package
8
+ - Updated dependencies [727c398]
9
+ - @noya-app/state-manager@0.1.9
10
+
11
+ ## 0.1.8
12
+
13
+ ### Patch Changes
14
+
15
+ - 54a55d0: Update deps
16
+
17
+ ## 0.1.7
18
+
19
+ ### Patch Changes
20
+
21
+ - 79f0eff: Improve multiplayer
22
+
23
+ ## 0.1.6
24
+
25
+ ### Patch Changes
26
+
27
+ - 76fdd3e: Improve statemanager history
28
+
29
+ ## 0.1.5
30
+
31
+ ### Patch Changes
32
+
33
+ - 38f863f: Improve history snapshot
34
+
35
+ ## 0.1.4
36
+
37
+ ### Patch Changes
38
+
39
+ - e11010a: Improve isMoving and server snapshots
40
+
41
+ ## 0.1.3
42
+
43
+ ### Patch Changes
44
+
45
+ - b973d2e: Export history entries
46
+
47
+ ## 0.1.2
48
+
49
+ ### Patch Changes
50
+
51
+ - 5fd2338: Improve history
52
+
53
+ ## 0.1.1
54
+
55
+ ### Patch Changes
56
+
57
+ - f7efb8a: Add rebase to state manager
58
+
59
+ ## 0.1.0
60
+
61
+ ### Minor Changes
62
+
63
+ - 84323fe: Add minor version
64
+
65
+ ### Patch Changes
66
+
67
+ - f974ad5: Update versions
68
+ - Updated dependencies [84323fe]
69
+ - Updated dependencies [f974ad5]
70
+ - @noya-app/emitter@0.1.0
71
+ - @noya-app/noya-utils@0.1.0
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Noya State Manager
2
+
3
+ Manage mutable React state
@@ -0,0 +1,29 @@
1
+ import * as _noya_app_state_manager from '@noya-app/state-manager';
2
+ import { StateManager, Get, StateManagerOptions, MultiplayerStateManager, MultiplayerPatchMetadata, ConnectionEvent } from '@noya-app/state-manager';
3
+ export * from '@noya-app/state-manager';
4
+ import React, { SetStateAction } from 'react';
5
+
6
+ declare function useSyncStateManager<S extends object, M>(stateManager: StateManager<S, M>): S;
7
+ declare function useSyncStateManager<S extends object, M, P extends string>(stateManager: StateManager<S, M>, path: P): Get<S, P, unknown>;
8
+ declare function useManagedState<S extends object, M = void>(createInitialState: () => S, options?: StateManagerOptions<S, M>): readonly [S, (...args: M extends {} ? [metadata: M, action: SetStateAction<S>] : [action: SetStateAction<S>]) => void, StateManager<S, M>];
9
+ declare function useManagedHistory<S extends object, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
10
+ declare function useSyncMultiplayerStateManager<S extends object>(multiplayerStateManager: MultiplayerStateManager<S>): S;
11
+ declare function useMultiplayerState<S extends object>(initialState: S | (() => S), options: StateManagerOptions<S, MultiplayerPatchMetadata> & {
12
+ sync?: (self: MultiplayerStateManager<S>) => void;
13
+ trackConnectionEvents?: boolean;
14
+ inspector?: boolean | {
15
+ colorScheme?: "dark" | "light";
16
+ };
17
+ }): readonly [S, (metadata: MultiplayerPatchMetadata, action: S | ((prevState: S) => S)) => void, MultiplayerStateManager<S>, {
18
+ connectionEvents: ConnectionEvent<S>[] | undefined;
19
+ }];
20
+
21
+ declare const StateInspector: React.MemoExoticComponent<(<S extends object, M>({ state, connectionEvents, unstyled, colorScheme, stateManager, ...props }: {
22
+ state: S;
23
+ connectionEvents?: ConnectionEvent<S>[] | undefined;
24
+ unstyled?: boolean | undefined;
25
+ colorScheme?: "light" | "dark" | undefined;
26
+ stateManager: StateManager<S, M>;
27
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">) => React.JSX.Element | null)>;
28
+
29
+ export { StateInspector, useManagedHistory, useManagedState, useMultiplayerState, useSyncMultiplayerStateManager, useSyncStateManager };
@@ -0,0 +1,29 @@
1
+ import * as _noya_app_state_manager from '@noya-app/state-manager';
2
+ import { StateManager, Get, StateManagerOptions, MultiplayerStateManager, MultiplayerPatchMetadata, ConnectionEvent } from '@noya-app/state-manager';
3
+ export * from '@noya-app/state-manager';
4
+ import React, { SetStateAction } from 'react';
5
+
6
+ declare function useSyncStateManager<S extends object, M>(stateManager: StateManager<S, M>): S;
7
+ declare function useSyncStateManager<S extends object, M, P extends string>(stateManager: StateManager<S, M>, path: P): Get<S, P, unknown>;
8
+ declare function useManagedState<S extends object, M = void>(createInitialState: () => S, options?: StateManagerOptions<S, M>): readonly [S, (...args: M extends {} ? [metadata: M, action: SetStateAction<S>] : [action: SetStateAction<S>]) => void, StateManager<S, M>];
9
+ declare function useManagedHistory<S extends object, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
10
+ declare function useSyncMultiplayerStateManager<S extends object>(multiplayerStateManager: MultiplayerStateManager<S>): S;
11
+ declare function useMultiplayerState<S extends object>(initialState: S | (() => S), options: StateManagerOptions<S, MultiplayerPatchMetadata> & {
12
+ sync?: (self: MultiplayerStateManager<S>) => void;
13
+ trackConnectionEvents?: boolean;
14
+ inspector?: boolean | {
15
+ colorScheme?: "dark" | "light";
16
+ };
17
+ }): readonly [S, (metadata: MultiplayerPatchMetadata, action: S | ((prevState: S) => S)) => void, MultiplayerStateManager<S>, {
18
+ connectionEvents: ConnectionEvent<S>[] | undefined;
19
+ }];
20
+
21
+ declare const StateInspector: React.MemoExoticComponent<(<S extends object, M>({ state, connectionEvents, unstyled, colorScheme, stateManager, ...props }: {
22
+ state: S;
23
+ connectionEvents?: ConnectionEvent<S>[] | undefined;
24
+ unstyled?: boolean | undefined;
25
+ colorScheme?: "light" | "dark" | undefined;
26
+ stateManager: StateManager<S, M>;
27
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">) => React.JSX.Element | null)>;
28
+
29
+ export { StateInspector, useManagedHistory, useManagedState, useMultiplayerState, useSyncMultiplayerStateManager, useSyncStateManager };