@noya-app/noya-multiplayer-react 0.1.11 → 0.1.13

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.
@@ -5,14 +5,14 @@
5
5
  CLI Target: esnext
6
6
  CJS Build start
7
7
  ESM Build start
8
- CJS dist/index.js 25.32 KB
9
- CJS dist/index.js.map 40.59 KB
10
- CJS ⚡️ Build success in 18ms
11
- ESM dist/index.mjs 21.85 KB
12
- ESM dist/index.mjs.map 40.79 KB
13
- ESM ⚡️ Build success in 18ms
8
+ ESM dist/index.mjs 25.93 KB
9
+ ESM dist/index.mjs.map 47.90 KB
10
+ ESM ⚡️ Build success in 21ms
11
+ CJS dist/index.js 29.76 KB
12
+ CJS dist/index.js.map 47.69 KB
13
+ CJS ⚡️ Build success in 21ms
14
14
  DTS Build start
15
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 1599ms
17
- DTS dist/index.d.ts 2.32 KB
18
- DTS dist/index.d.mts 2.32 KB
16
+ DTS ⚡️ Build success in 1253ms
17
+ DTS dist/index.d.ts 2.65 KB
18
+ DTS dist/index.d.mts 2.65 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @noya-app/state-manager
2
2
 
3
+ ## 0.1.13
4
+
5
+ ### Patch Changes
6
+
7
+ - 149f2f9: Improve multiplayer
8
+ - Updated dependencies [149f2f9]
9
+ - @noya-app/state-manager@0.1.13
10
+
11
+ ## 0.1.12
12
+
13
+ ### Patch Changes
14
+
15
+ - b06dd3a: Add user auth to ws sync
16
+ - Updated dependencies [b06dd3a]
17
+ - @noya-app/state-manager@0.1.12
18
+
3
19
  ## 0.1.11
4
20
 
5
21
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,15 +1,18 @@
1
1
  import * as _noya_app_state_manager from '@noya-app/state-manager';
2
- import { ConnectionEvent, StateManager, Get, StateManagerOptions, MultiplayerStateManager, MultiplayerStateManagerOptions } from '@noya-app/state-manager';
2
+ import { ConnectionEvent, MultiplayerUser, Task, MultiplayerStateManager, StateManager, Get, StateManagerOptions, MultiplayerStateManagerOptions } from '@noya-app/state-manager';
3
3
  export * from '@noya-app/state-manager';
4
4
  import React, { SetStateAction, ComponentProps } from 'react';
5
5
 
6
- type Anchor = "left" | "right";
7
- declare const StateInspector: React.MemoExoticComponent<(<S extends object, M>({ state, connectionEvents, unstyled, colorScheme, stateManager, anchor, ...props }: {
6
+ type Anchor = "left" | "right" | "bottom left" | "bottom right";
7
+ declare const StateInspector: React.MemoExoticComponent<(<S extends object, M>({ state, connectionEvents, connectedUsers, tasks, userId, unstyled, colorScheme, multiplayerStateManager, anchor, ...props }: {
8
8
  state: S;
9
9
  connectionEvents?: ConnectionEvent<S>[] | undefined;
10
+ connectedUsers?: MultiplayerUser[] | undefined;
11
+ tasks?: Task[] | undefined;
12
+ userId?: string | undefined;
10
13
  unstyled?: boolean | undefined;
11
14
  colorScheme?: "light" | "dark" | undefined;
12
- stateManager: StateManager<S, M>;
15
+ multiplayerStateManager: MultiplayerStateManager<S, M>;
13
16
  anchor?: Anchor | undefined;
14
17
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">) => React.JSX.Element | null)>;
15
18
 
@@ -18,12 +21,17 @@ declare function useSyncStateManager<S extends object, M, P extends string>(stat
18
21
  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>];
19
22
  declare function useManagedHistory<S extends object, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
20
23
  declare function useSyncMultiplayerStateManager<S extends object, M = void>(multiplayerStateManager: MultiplayerStateManager<S, M>): S;
21
- declare function useMultiplayerState<S extends object, M = void>(initialState: S | (() => S), options: MultiplayerStateManagerOptions<S, M> & {
22
- sync?: (self: MultiplayerStateManager<S, M>) => void;
24
+ declare function useMultiplayerState<S extends object, M = void>(initialState: S | (() => S), options?: MultiplayerStateManagerOptions<S, M> & {
25
+ sync?: (options: {
26
+ ms: MultiplayerStateManager<S, M>;
27
+ }) => void;
23
28
  trackConnectionEvents?: boolean;
29
+ trackTasks?: boolean;
24
30
  inspector?: boolean | Pick<ComponentProps<typeof StateInspector>, "colorScheme" | "anchor">;
25
31
  }): readonly [S, (...args: M extends {} ? [metadata: M, action: S | ((prevState: S) => S)] : [action: S | ((prevState: S) => S)]) => void, MultiplayerStateManager<S, M>, {
32
+ tasks: Task[];
26
33
  connectionEvents: ConnectionEvent<S>[] | undefined;
34
+ connectedUsers: MultiplayerUser[];
27
35
  }];
28
36
 
29
37
  export { StateInspector, useManagedHistory, useManagedState, useMultiplayerState, useSyncMultiplayerStateManager, useSyncStateManager };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,18 @@
1
1
  import * as _noya_app_state_manager from '@noya-app/state-manager';
2
- import { ConnectionEvent, StateManager, Get, StateManagerOptions, MultiplayerStateManager, MultiplayerStateManagerOptions } from '@noya-app/state-manager';
2
+ import { ConnectionEvent, MultiplayerUser, Task, MultiplayerStateManager, StateManager, Get, StateManagerOptions, MultiplayerStateManagerOptions } from '@noya-app/state-manager';
3
3
  export * from '@noya-app/state-manager';
4
4
  import React, { SetStateAction, ComponentProps } from 'react';
5
5
 
6
- type Anchor = "left" | "right";
7
- declare const StateInspector: React.MemoExoticComponent<(<S extends object, M>({ state, connectionEvents, unstyled, colorScheme, stateManager, anchor, ...props }: {
6
+ type Anchor = "left" | "right" | "bottom left" | "bottom right";
7
+ declare const StateInspector: React.MemoExoticComponent<(<S extends object, M>({ state, connectionEvents, connectedUsers, tasks, userId, unstyled, colorScheme, multiplayerStateManager, anchor, ...props }: {
8
8
  state: S;
9
9
  connectionEvents?: ConnectionEvent<S>[] | undefined;
10
+ connectedUsers?: MultiplayerUser[] | undefined;
11
+ tasks?: Task[] | undefined;
12
+ userId?: string | undefined;
10
13
  unstyled?: boolean | undefined;
11
14
  colorScheme?: "light" | "dark" | undefined;
12
- stateManager: StateManager<S, M>;
15
+ multiplayerStateManager: MultiplayerStateManager<S, M>;
13
16
  anchor?: Anchor | undefined;
14
17
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">) => React.JSX.Element | null)>;
15
18
 
@@ -18,12 +21,17 @@ declare function useSyncStateManager<S extends object, M, P extends string>(stat
18
21
  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>];
19
22
  declare function useManagedHistory<S extends object, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
20
23
  declare function useSyncMultiplayerStateManager<S extends object, M = void>(multiplayerStateManager: MultiplayerStateManager<S, M>): S;
21
- declare function useMultiplayerState<S extends object, M = void>(initialState: S | (() => S), options: MultiplayerStateManagerOptions<S, M> & {
22
- sync?: (self: MultiplayerStateManager<S, M>) => void;
24
+ declare function useMultiplayerState<S extends object, M = void>(initialState: S | (() => S), options?: MultiplayerStateManagerOptions<S, M> & {
25
+ sync?: (options: {
26
+ ms: MultiplayerStateManager<S, M>;
27
+ }) => void;
23
28
  trackConnectionEvents?: boolean;
29
+ trackTasks?: boolean;
24
30
  inspector?: boolean | Pick<ComponentProps<typeof StateInspector>, "colorScheme" | "anchor">;
25
31
  }): readonly [S, (...args: M extends {} ? [metadata: M, action: S | ((prevState: S) => S)] : [action: S | ((prevState: S) => S)]) => void, MultiplayerStateManager<S, M>, {
32
+ tasks: Task[];
26
33
  connectionEvents: ConnectionEvent<S>[] | undefined;
34
+ connectedUsers: MultiplayerUser[];
27
35
  }];
28
36
 
29
37
  export { StateInspector, useManagedHistory, useManagedState, useMultiplayerState, useSyncMultiplayerStateManager, useSyncStateManager };