@noya-app/noya-multiplayer-react 0.1.23 → 0.1.25

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
- ESM dist/index.mjs 40.89 KB
9
- ESM dist/index.mjs.map 75.66 KB
10
- ESM ⚡️ Build success in 49ms
11
- CJS dist/index.js 46.11 KB
12
- CJS dist/index.js.map 75.44 KB
13
- CJS ⚡️ Build success in 49ms
8
+ CJS dist/index.js 50.28 KB
9
+ CJS dist/index.js.map 81.82 KB
10
+ CJS ⚡️ Build success in 72ms
11
+ ESM dist/index.mjs 44.75 KB
12
+ ESM dist/index.mjs.map 82.04 KB
13
+ ESM ⚡️ Build success in 72ms
14
14
  DTS Build start
15
- "ComponentPropsWithoutRef" is imported from external module "react" but never used in "src/components/UserPointersOverlay.tsx", "src/inspector/StateInspector.tsx" and "src/hooks.ts".
16
- DTS ⚡️ Build success in 2229ms
17
- DTS dist/index.d.ts 7.15 KB
18
- DTS dist/index.d.mts 7.15 KB
15
+ "ComponentPropsWithoutRef" is imported from external module "react" but never used in "src/inspector/StateInspector.tsx", "src/hooks.ts" and "src/components/UserPointersOverlay.tsx".
16
+ DTS ⚡️ Build success in 4324ms
17
+ DTS dist/index.d.ts 7.30 KB
18
+ DTS dist/index.d.mts 7.30 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @noya-app/state-manager
2
2
 
3
+ ## 0.1.25
4
+
5
+ ### Patch Changes
6
+
7
+ - f3e588d: Improve json editing
8
+ - b104428: Package improvements, mainly around json
9
+ - Updated dependencies [f3e588d]
10
+ - Updated dependencies [04542f5]
11
+ - Updated dependencies [b104428]
12
+ - @noya-app/state-manager@0.1.23
13
+
14
+ ## 0.1.24
15
+
16
+ ### Patch Changes
17
+
18
+ - 57bf0c9: Improve pixel ratio, toolbar, details
19
+
3
20
  ## 0.1.23
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2,6 +2,7 @@ import * as _noya_app_state_manager from '@noya-app/state-manager';
2
2
  import { MultiplayerUser, EphemeralUserData, ConnectionEvent, Task, MultiplayerStateManager, StateManager, Get, StateManagerOptions, MultiplayerStateManagerOptions, SyncAdapterOptions, TSchema } from '@noya-app/state-manager';
3
3
  export * from '@noya-app/state-manager';
4
4
  import React, { SetStateAction } from 'react';
5
+ import { Observable, PathKey, GetWithPath } from '@noya-app/observable';
5
6
 
6
7
  declare function getAvatarInitials(name: string): string;
7
8
  /**
@@ -50,7 +51,7 @@ type StateInspectorOptions = {
50
51
  colorScheme?: "light" | "dark";
51
52
  anchor?: StateInspectorAnchor;
52
53
  };
53
- declare const StateInspector: React.MemoExoticComponent<(<S extends object, M, E>({ state, connectionEvents, connectedUsers, tasks, userId, unstyled, colorScheme, multiplayerStateManager, ephemeralUserData, anchor, forceInit, ...props }: {
54
+ declare const StateInspector: React.MemoExoticComponent<(<S, M, E>({ state, connectionEvents, connectedUsers, tasks, userId, unstyled, colorScheme, multiplayerStateManager, ephemeralUserData, anchor, forceInit, ...props }: {
54
55
  state: S;
55
56
  connectionEvents?: ConnectionEvent<S>[] | undefined;
56
57
  connectedUsers?: MultiplayerUser[] | undefined;
@@ -62,23 +63,25 @@ declare const StateInspector: React.MemoExoticComponent<(<S extends object, M, E
62
63
  forceInit: () => void;
63
64
  } & StateInspectorOptions & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">) => React.JSX.Element | null)>;
64
65
 
65
- declare function useSyncStateManager<S extends object, M>(stateManager: StateManager<S, M>): S;
66
- declare function useSyncStateManager<S extends object, M, P extends string>(stateManager: StateManager<S, M>, path: P): Get<S, P, unknown>;
67
- 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>];
68
- declare function useManagedHistory<S extends object, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
69
- declare function useSyncMultiplayerStateManager<S extends object, M = void>(multiplayerStateManager: MultiplayerStateManager<S, M>): S;
70
- declare function useEphemeralUserData<E>(ephemeralUserData: EphemeralUserData<E>): {
66
+ declare function useSyncStateManager<S, M>(stateManager: StateManager<S, M>): S;
67
+ declare function useSyncStateManager<S, M, P extends string>(stateManager: StateManager<S, M>, path: P): Get<S, P, unknown>;
68
+ declare function useManagedState<S, 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>];
69
+ declare function useManagedHistory<S, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
70
+ declare function useSyncMultiplayerStateManager<S, M = void>(multiplayerStateManager: MultiplayerStateManager<S, M>): S;
71
+ declare function useEphemeralUserData<E>(ephemeralUserData: EphemeralUserData<E>, options?: {
72
+ throttle?: number;
73
+ }): {
71
74
  data: Record<string, E | undefined>;
72
75
  metadata: Record<string, _noya_app_state_manager.EphemeralUserMetadata | undefined>;
73
76
  currentUserId: string | undefined;
74
77
  };
75
- type UseMultiplayerStateOptions<S extends object, M = void, E = void> = MultiplayerStateManagerOptions<S, M> & {
78
+ type UseMultiplayerStateOptions<S, M = void, E = void> = MultiplayerStateManagerOptions<S, M> & {
76
79
  sync?: (options: Pick<SyncAdapterOptions<S, M, E>, "ms" | "ephemeralUserData">) => void;
77
80
  trackConnectionEvents?: boolean;
78
81
  trackTasks?: boolean;
79
82
  inspector?: boolean | StateInspectorOptions;
80
83
  };
81
- declare function useMultiplayerState<S extends object, M = void, E = void>(initialState: S | (() => S), options?: UseMultiplayerStateOptions<S, M, E>): readonly [S, (...args: M extends {} ? [metadata: M, action: S | ((prevState: S) => S)] : [action: S | ((prevState: S) => S)]) => void, {
84
+ declare function useMultiplayerState<S, M = void, E = void>(initialState: S | (() => S), options?: UseMultiplayerStateOptions<S, M, E>): readonly [S, (...args: M extends {} ? [metadata: M, action: S | ((prevState: S) => S)] : [action: S | ((prevState: S) => S)]) => void, {
82
85
  tasks: Task[];
83
86
  userId: string | undefined;
84
87
  connectionEvents: ConnectionEvent<S>[] | undefined;
@@ -105,7 +108,7 @@ type AppDataOptions = {
105
108
  /**
106
109
  * Get data from host app. Fall back to default data.
107
110
  */
108
- declare function useAppData<S extends object>(initialState: S, { schema }?: AppDataOptions): AppData<S>;
111
+ declare function useAppData<S>(initialState: S, { schema }?: AppDataOptions): AppData<S>;
109
112
  type IframeToHostMessage = {
110
113
  type: "application.setMenuItems";
111
114
  payload: {
@@ -126,7 +129,7 @@ type HostToIframeMessage = {
126
129
  declare function useBroadcastConnectedUsers(connectedUsers: MultiplayerUser[]): void;
127
130
  declare function useBroadcastMenuItems<T>(menuItems: any[], handleSelectMenuItem: (value: T) => void): void;
128
131
  declare function isEmbeddedApp(): boolean;
129
- declare function useNoyaAppState<S extends object, M = void, E = void>(initialState: S | (() => S), options: UseMultiplayerStateOptions<S, M, E> & {
132
+ declare function useNoyaAppState<S, M = void, E = void>(initialState: S | (() => S), options: UseMultiplayerStateOptions<S, M, E> & {
130
133
  localStorageKey?: string;
131
134
  }): readonly [S, (...args: M extends {} ? [metadata: M, action: S | ((prevState: S) => S)] : [action: S | ((prevState: S) => S)]) => void, {
132
135
  readonly theme: AppTheme;
@@ -139,4 +142,7 @@ declare function useNoyaAppState<S extends object, M = void, E = void>(initialSt
139
142
  readonly multiplayerStateManager: _noya_app_state_manager.MultiplayerStateManager<S, M>;
140
143
  }];
141
144
 
142
- export { type AppData, type AppTheme, type AppViewType, type HostToIframeMessage, type IframeToHostMessage, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, UserNameTag, UserPointer, UserPointerContainer, type UserPointerData, UserPointerIcon, type UserPointerProps, UserPointersOverlay, type UserPointersOverlayProps, createDefaultAppData, getAppData, getAvatarInitials, getAvatarStyle, isEmbeddedApp, useAppData, useBroadcastConnectedUsers, useBroadcastMenuItems, useEphemeralUserData, useManagedHistory, useManagedState, useMultiplayerState, useNoyaAppState, useSyncMultiplayerStateManager, useSyncStateManager };
145
+ declare function useObservable<T>(observable: Observable<T>): T;
146
+ declare function useObservable<T, P extends PathKey[]>(observable: Observable<T>, path: P): GetWithPath<T, P>;
147
+
148
+ export { type AppData, type AppTheme, type AppViewType, type HostToIframeMessage, type IframeToHostMessage, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, UserNameTag, UserPointer, UserPointerContainer, type UserPointerData, UserPointerIcon, type UserPointerProps, UserPointersOverlay, type UserPointersOverlayProps, createDefaultAppData, getAppData, getAvatarInitials, getAvatarStyle, isEmbeddedApp, useAppData, useBroadcastConnectedUsers, useBroadcastMenuItems, useEphemeralUserData, useManagedHistory, useManagedState, useMultiplayerState, useNoyaAppState, useObservable, useSyncMultiplayerStateManager, useSyncStateManager };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as _noya_app_state_manager from '@noya-app/state-manager';
2
2
  import { MultiplayerUser, EphemeralUserData, ConnectionEvent, Task, MultiplayerStateManager, StateManager, Get, StateManagerOptions, MultiplayerStateManagerOptions, SyncAdapterOptions, TSchema } from '@noya-app/state-manager';
3
3
  export * from '@noya-app/state-manager';
4
4
  import React, { SetStateAction } from 'react';
5
+ import { Observable, PathKey, GetWithPath } from '@noya-app/observable';
5
6
 
6
7
  declare function getAvatarInitials(name: string): string;
7
8
  /**
@@ -50,7 +51,7 @@ type StateInspectorOptions = {
50
51
  colorScheme?: "light" | "dark";
51
52
  anchor?: StateInspectorAnchor;
52
53
  };
53
- declare const StateInspector: React.MemoExoticComponent<(<S extends object, M, E>({ state, connectionEvents, connectedUsers, tasks, userId, unstyled, colorScheme, multiplayerStateManager, ephemeralUserData, anchor, forceInit, ...props }: {
54
+ declare const StateInspector: React.MemoExoticComponent<(<S, M, E>({ state, connectionEvents, connectedUsers, tasks, userId, unstyled, colorScheme, multiplayerStateManager, ephemeralUserData, anchor, forceInit, ...props }: {
54
55
  state: S;
55
56
  connectionEvents?: ConnectionEvent<S>[] | undefined;
56
57
  connectedUsers?: MultiplayerUser[] | undefined;
@@ -62,23 +63,25 @@ declare const StateInspector: React.MemoExoticComponent<(<S extends object, M, E
62
63
  forceInit: () => void;
63
64
  } & StateInspectorOptions & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">) => React.JSX.Element | null)>;
64
65
 
65
- declare function useSyncStateManager<S extends object, M>(stateManager: StateManager<S, M>): S;
66
- declare function useSyncStateManager<S extends object, M, P extends string>(stateManager: StateManager<S, M>, path: P): Get<S, P, unknown>;
67
- 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>];
68
- declare function useManagedHistory<S extends object, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
69
- declare function useSyncMultiplayerStateManager<S extends object, M = void>(multiplayerStateManager: MultiplayerStateManager<S, M>): S;
70
- declare function useEphemeralUserData<E>(ephemeralUserData: EphemeralUserData<E>): {
66
+ declare function useSyncStateManager<S, M>(stateManager: StateManager<S, M>): S;
67
+ declare function useSyncStateManager<S, M, P extends string>(stateManager: StateManager<S, M>, path: P): Get<S, P, unknown>;
68
+ declare function useManagedState<S, 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>];
69
+ declare function useManagedHistory<S, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
70
+ declare function useSyncMultiplayerStateManager<S, M = void>(multiplayerStateManager: MultiplayerStateManager<S, M>): S;
71
+ declare function useEphemeralUserData<E>(ephemeralUserData: EphemeralUserData<E>, options?: {
72
+ throttle?: number;
73
+ }): {
71
74
  data: Record<string, E | undefined>;
72
75
  metadata: Record<string, _noya_app_state_manager.EphemeralUserMetadata | undefined>;
73
76
  currentUserId: string | undefined;
74
77
  };
75
- type UseMultiplayerStateOptions<S extends object, M = void, E = void> = MultiplayerStateManagerOptions<S, M> & {
78
+ type UseMultiplayerStateOptions<S, M = void, E = void> = MultiplayerStateManagerOptions<S, M> & {
76
79
  sync?: (options: Pick<SyncAdapterOptions<S, M, E>, "ms" | "ephemeralUserData">) => void;
77
80
  trackConnectionEvents?: boolean;
78
81
  trackTasks?: boolean;
79
82
  inspector?: boolean | StateInspectorOptions;
80
83
  };
81
- declare function useMultiplayerState<S extends object, M = void, E = void>(initialState: S | (() => S), options?: UseMultiplayerStateOptions<S, M, E>): readonly [S, (...args: M extends {} ? [metadata: M, action: S | ((prevState: S) => S)] : [action: S | ((prevState: S) => S)]) => void, {
84
+ declare function useMultiplayerState<S, M = void, E = void>(initialState: S | (() => S), options?: UseMultiplayerStateOptions<S, M, E>): readonly [S, (...args: M extends {} ? [metadata: M, action: S | ((prevState: S) => S)] : [action: S | ((prevState: S) => S)]) => void, {
82
85
  tasks: Task[];
83
86
  userId: string | undefined;
84
87
  connectionEvents: ConnectionEvent<S>[] | undefined;
@@ -105,7 +108,7 @@ type AppDataOptions = {
105
108
  /**
106
109
  * Get data from host app. Fall back to default data.
107
110
  */
108
- declare function useAppData<S extends object>(initialState: S, { schema }?: AppDataOptions): AppData<S>;
111
+ declare function useAppData<S>(initialState: S, { schema }?: AppDataOptions): AppData<S>;
109
112
  type IframeToHostMessage = {
110
113
  type: "application.setMenuItems";
111
114
  payload: {
@@ -126,7 +129,7 @@ type HostToIframeMessage = {
126
129
  declare function useBroadcastConnectedUsers(connectedUsers: MultiplayerUser[]): void;
127
130
  declare function useBroadcastMenuItems<T>(menuItems: any[], handleSelectMenuItem: (value: T) => void): void;
128
131
  declare function isEmbeddedApp(): boolean;
129
- declare function useNoyaAppState<S extends object, M = void, E = void>(initialState: S | (() => S), options: UseMultiplayerStateOptions<S, M, E> & {
132
+ declare function useNoyaAppState<S, M = void, E = void>(initialState: S | (() => S), options: UseMultiplayerStateOptions<S, M, E> & {
130
133
  localStorageKey?: string;
131
134
  }): readonly [S, (...args: M extends {} ? [metadata: M, action: S | ((prevState: S) => S)] : [action: S | ((prevState: S) => S)]) => void, {
132
135
  readonly theme: AppTheme;
@@ -139,4 +142,7 @@ declare function useNoyaAppState<S extends object, M = void, E = void>(initialSt
139
142
  readonly multiplayerStateManager: _noya_app_state_manager.MultiplayerStateManager<S, M>;
140
143
  }];
141
144
 
142
- export { type AppData, type AppTheme, type AppViewType, type HostToIframeMessage, type IframeToHostMessage, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, UserNameTag, UserPointer, UserPointerContainer, type UserPointerData, UserPointerIcon, type UserPointerProps, UserPointersOverlay, type UserPointersOverlayProps, createDefaultAppData, getAppData, getAvatarInitials, getAvatarStyle, isEmbeddedApp, useAppData, useBroadcastConnectedUsers, useBroadcastMenuItems, useEphemeralUserData, useManagedHistory, useManagedState, useMultiplayerState, useNoyaAppState, useSyncMultiplayerStateManager, useSyncStateManager };
145
+ declare function useObservable<T>(observable: Observable<T>): T;
146
+ declare function useObservable<T, P extends PathKey[]>(observable: Observable<T>, path: P): GetWithPath<T, P>;
147
+
148
+ export { type AppData, type AppTheme, type AppViewType, type HostToIframeMessage, type IframeToHostMessage, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, UserNameTag, UserPointer, UserPointerContainer, type UserPointerData, UserPointerIcon, type UserPointerProps, UserPointersOverlay, type UserPointersOverlayProps, createDefaultAppData, getAppData, getAvatarInitials, getAvatarStyle, isEmbeddedApp, useAppData, useBroadcastConnectedUsers, useBroadcastMenuItems, useEphemeralUserData, useManagedHistory, useManagedState, useMultiplayerState, useNoyaAppState, useObservable, useSyncMultiplayerStateManager, useSyncStateManager };