@noya-app/noya-multiplayer-react 0.1.53 → 0.1.55
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 -22
- package/CHANGELOG.md +19 -0
- package/dist/index.bundle.js +24 -13
- package/dist/index.d.mts +25 -11
- package/dist/index.d.ts +25 -11
- package/dist/index.js +365 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +365 -155
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/NoyaStateContext.tsx +5 -1
- package/src/components/UserPointersOverlay.tsx +16 -7
- package/src/hooks.ts +8 -5
- package/src/index.ts +1 -0
- package/src/inspector/StateInspector.tsx +45 -35
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as _noya_app_state_manager from '@noya-app/state-manager';
|
|
2
|
-
import { AIToolDefinition, ConnectedUsersManager, EphemeralUserDataManager, NoyaManager, StateManager, StateManagerOptions,
|
|
2
|
+
import { AIToolDefinition, ConnectedUsersManager, EphemeralUserDataManager, NoyaManager, StateManager, StateManagerOptions, NoyaManagerOptions, SyncAdapter, TSchema, Static, SafeEval, CreateParams, MultiplayerStateManager, ReconnectingWebSocketState, ClientToServerMessage, ServerToClientMessage, MultiplayerStateManagerError } from '@noya-app/state-manager';
|
|
3
3
|
export * from '@noya-app/state-manager';
|
|
4
|
-
import React, { SetStateAction } from 'react';
|
|
4
|
+
import React, { SetStateAction, ComponentProps } from 'react';
|
|
5
|
+
import * as _noya_app_noya_schemas from '@noya-app/noya-schemas';
|
|
6
|
+
import { OutputTransform, Input } from '@noya-app/noya-schemas';
|
|
5
7
|
import { GetAtPath, ObservableOptions, PathKey, Observable } from '@noya-app/observable';
|
|
6
8
|
import { MenuItem } from '@noya-app/noya-designsystem';
|
|
7
|
-
import { OutputTransform, Input } from '@noya-app/noya-schemas';
|
|
8
9
|
|
|
9
10
|
declare function useRegisterAITool(tool: AIToolDefinition): void;
|
|
10
11
|
declare function useCallableAITools(): _noya_app_state_manager.CallableAIToolsMap;
|
|
@@ -45,7 +46,7 @@ declare function useSyncStateManager<S, M>(stateManager: StateManager<S, M>): S;
|
|
|
45
46
|
declare function useSyncStateManager<S, M, P extends string>(stateManager: StateManager<S, M>, path: P): GetAtPath<S, P>;
|
|
46
47
|
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>];
|
|
47
48
|
declare function useManagedHistory<S, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
|
|
48
|
-
type UseMultiplayerStateOptions<S, M extends object = object, E extends object = object, MenuT extends string = string> =
|
|
49
|
+
type UseMultiplayerStateOptions<S, M extends object = object, E extends object = object, MenuT extends string = string> = NoyaManagerOptions<S, M> & {
|
|
49
50
|
sync?: SyncAdapter<S, M, E, MenuT>;
|
|
50
51
|
inspector?: boolean | StateInspectorOptions;
|
|
51
52
|
};
|
|
@@ -62,11 +63,16 @@ declare function useMultiplayerState<S, M extends object = object, E extends obj
|
|
|
62
63
|
pipelineManager: _noya_app_state_manager.PipelineManager;
|
|
63
64
|
secretManager: _noya_app_state_manager.SecretManager;
|
|
64
65
|
menuItemsManager: _noya_app_state_manager.MenuManager<MenuT>;
|
|
65
|
-
createAsset: (options: _noya_app_state_manager.CreateAssetOptions | Uint8Array | File | Blob) => Promise<
|
|
66
|
+
createAsset: (options: _noya_app_state_manager.CreateAssetOptions | Uint8Array | File | Blob) => Promise<_noya_app_noya_schemas.Asset>;
|
|
66
67
|
deleteAsset: (id: string) => Promise<void>;
|
|
67
|
-
assets:
|
|
68
|
+
assets: _noya_app_noya_schemas.Asset[];
|
|
68
69
|
}];
|
|
69
70
|
|
|
71
|
+
declare function useStateInspector<S, M extends object, E extends object, MenuT extends string = string>({ noyaManager, disabled, colorScheme, anchor, }: {
|
|
72
|
+
noyaManager: NoyaManager<S, M, E, MenuT>;
|
|
73
|
+
disabled: boolean;
|
|
74
|
+
} & Pick<ComponentProps<typeof StateInspector>, "colorScheme" | "anchor">): void;
|
|
75
|
+
|
|
70
76
|
type AppViewType = "editable" | "readOnly" | "preview";
|
|
71
77
|
type AppTheme = "light" | "dark";
|
|
72
78
|
type AppData<State> = {
|
|
@@ -130,10 +136,10 @@ declare function useAnyNoyaStateContext(): AnyNoyaStateContextValue;
|
|
|
130
136
|
declare function useAnyNoyaManager(): NoyaManager<any, any, any, any>;
|
|
131
137
|
declare function useColorScheme(): AppTheme;
|
|
132
138
|
declare function useViewType(): AppViewType;
|
|
133
|
-
declare function useAssets():
|
|
134
|
-
declare function useAsset(id: string | undefined):
|
|
139
|
+
declare function useAssets(): _noya_app_noya_schemas.Asset[];
|
|
140
|
+
declare function useAsset(id: string | undefined): _noya_app_noya_schemas.Asset | undefined;
|
|
135
141
|
declare function useAssetManager(): {
|
|
136
|
-
create: (options: _noya_app_state_manager.CreateAssetOptions | Uint8Array | File | Blob) => Promise<
|
|
142
|
+
create: (options: _noya_app_state_manager.CreateAssetOptions | Uint8Array | File | Blob) => Promise<_noya_app_noya_schemas.Asset>;
|
|
137
143
|
delete: (id: string) => Promise<void>;
|
|
138
144
|
isInitialized: boolean;
|
|
139
145
|
};
|
|
@@ -147,12 +153,14 @@ declare function useInputs(): ({
|
|
|
147
153
|
name: string;
|
|
148
154
|
required: boolean;
|
|
149
155
|
toolId: string | null;
|
|
156
|
+
stableId: string;
|
|
150
157
|
description: string | null;
|
|
151
158
|
} | {
|
|
152
159
|
id: string;
|
|
153
160
|
kind: "data";
|
|
154
161
|
name: string;
|
|
155
162
|
required: boolean;
|
|
163
|
+
stableId: string;
|
|
156
164
|
description: string | null;
|
|
157
165
|
schema: {
|
|
158
166
|
default?: string | undefined;
|
|
@@ -242,22 +250,27 @@ declare function useInputs(): ({
|
|
|
242
250
|
_kind: "Object";
|
|
243
251
|
} | null;
|
|
244
252
|
} | {
|
|
253
|
+
authProvider?: "github" | "figma" | null | undefined;
|
|
254
|
+
authScope?: string | null | undefined;
|
|
245
255
|
id: string;
|
|
246
256
|
kind: "secret";
|
|
247
257
|
name: string;
|
|
248
258
|
required: boolean;
|
|
259
|
+
stableId: string;
|
|
249
260
|
description: string | null;
|
|
250
261
|
})[];
|
|
251
262
|
declare function useOutputTransforms(): ({
|
|
252
263
|
value: string;
|
|
253
264
|
id: string;
|
|
254
265
|
kind: "script";
|
|
266
|
+
stableId: string;
|
|
255
267
|
location: "state" | "url";
|
|
256
268
|
order: number;
|
|
257
269
|
} | {
|
|
258
270
|
value: string;
|
|
259
271
|
id: string;
|
|
260
272
|
kind: "jsonPointer";
|
|
273
|
+
stableId: string;
|
|
261
274
|
order: number;
|
|
262
275
|
})[];
|
|
263
276
|
declare function useIOManager(): _noya_app_state_manager.IOManager;
|
|
@@ -272,9 +285,10 @@ declare const FallbackUntilInitialized: ({ children, fallback, }: {
|
|
|
272
285
|
children: React.ReactNode;
|
|
273
286
|
fallback?: React.ReactNode;
|
|
274
287
|
}) => React.ReactNode;
|
|
275
|
-
declare function createNoyaContext<Schema extends TSchema, M extends object = object, E extends object = object, MenuT extends string = string>({ schema, mergeHistoryEntries, outputTransforms, inputs, }: {
|
|
288
|
+
declare function createNoyaContext<Schema extends TSchema, M extends object = object, E extends object = object, MenuT extends string = string>({ schema, mergeHistoryEntries, outputTransforms, inputs, safeEval, }: {
|
|
276
289
|
schema: Schema;
|
|
277
290
|
mergeHistoryEntries?: StateManagerOptions<Static<Schema>, M>["mergeHistoryEntries"];
|
|
291
|
+
safeEval?: SafeEval;
|
|
278
292
|
outputTransforms?: CreateParams<OutputTransform>[];
|
|
279
293
|
inputs?: CreateParams<Input>[];
|
|
280
294
|
}): {
|
|
@@ -350,4 +364,4 @@ declare class WebSocketConnection<State> {
|
|
|
350
364
|
removeListener(listener: (state: ReconnectingWebSocketState) => void): void;
|
|
351
365
|
}
|
|
352
366
|
|
|
353
|
-
export { AnyEphemeralUserDataManagerContext, AnyNoyaStateContext, type AnyNoyaStateContextValue, type AppData, type AppTheme, type AppViewType, ConnectedUsersContext, type ConnectionEvent, type ConnectionOptions, FallbackUntilInitialized, type GetAppDataOptions, type RenderUserPointer, type RenderUserPointerProps, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, type UseNoyaStateOptions, type UseNoyaStateResult, type UserPointerData, UserPointersOverlay, type UserPointersOverlayProps, WebSocketConnection, createDefaultAppData, createNoyaContext, enforceSchema, getAppData, parseAppDataParameter, useAIManager, useAnyEphemeralUserData, useAnyNoyaManager, useAnyNoyaStateContext, useAsset, useAssetManager, useAssets, useCallableAITools, useColorScheme, useConnectedUsersManager, useCurrentUserId, useIOManager, useInputs, useIsInitialized, useManagedHistory, useManagedState, useMultiplayerState, useNoyaState, useObservable, useOutputTransforms, usePipelineManager, useRegisterAITool, useSecret, useSecretManager, useSecrets, useSyncStateManager, useViewType };
|
|
367
|
+
export { AnyEphemeralUserDataManagerContext, AnyNoyaStateContext, type AnyNoyaStateContextValue, type AppData, type AppTheme, type AppViewType, ConnectedUsersContext, type ConnectionEvent, type ConnectionOptions, FallbackUntilInitialized, type GetAppDataOptions, type NoyaStateProviderProps, type RenderUserPointer, type RenderUserPointerProps, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, type UseNoyaStateOptions, type UseNoyaStateResult, type UserPointerData, UserPointersOverlay, type UserPointersOverlayProps, WebSocketConnection, createDefaultAppData, createNoyaContext, enforceSchema, getAppData, parseAppDataParameter, useAIManager, useAnyEphemeralUserData, useAnyNoyaManager, useAnyNoyaStateContext, useAsset, useAssetManager, useAssets, useCallableAITools, useColorScheme, useConnectedUsersManager, useCurrentUserId, useIOManager, useInputs, useIsInitialized, useManagedHistory, useManagedState, useMultiplayerState, useNoyaState, useObservable, useOutputTransforms, usePipelineManager, useRegisterAITool, useSecret, useSecretManager, useSecrets, useStateInspector, useSyncStateManager, useViewType };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as _noya_app_state_manager from '@noya-app/state-manager';
|
|
2
|
-
import { AIToolDefinition, ConnectedUsersManager, EphemeralUserDataManager, NoyaManager, StateManager, StateManagerOptions,
|
|
2
|
+
import { AIToolDefinition, ConnectedUsersManager, EphemeralUserDataManager, NoyaManager, StateManager, StateManagerOptions, NoyaManagerOptions, SyncAdapter, TSchema, Static, SafeEval, CreateParams, MultiplayerStateManager, ReconnectingWebSocketState, ClientToServerMessage, ServerToClientMessage, MultiplayerStateManagerError } from '@noya-app/state-manager';
|
|
3
3
|
export * from '@noya-app/state-manager';
|
|
4
|
-
import React, { SetStateAction } from 'react';
|
|
4
|
+
import React, { SetStateAction, ComponentProps } from 'react';
|
|
5
|
+
import * as _noya_app_noya_schemas from '@noya-app/noya-schemas';
|
|
6
|
+
import { OutputTransform, Input } from '@noya-app/noya-schemas';
|
|
5
7
|
import { GetAtPath, ObservableOptions, PathKey, Observable } from '@noya-app/observable';
|
|
6
8
|
import { MenuItem } from '@noya-app/noya-designsystem';
|
|
7
|
-
import { OutputTransform, Input } from '@noya-app/noya-schemas';
|
|
8
9
|
|
|
9
10
|
declare function useRegisterAITool(tool: AIToolDefinition): void;
|
|
10
11
|
declare function useCallableAITools(): _noya_app_state_manager.CallableAIToolsMap;
|
|
@@ -45,7 +46,7 @@ declare function useSyncStateManager<S, M>(stateManager: StateManager<S, M>): S;
|
|
|
45
46
|
declare function useSyncStateManager<S, M, P extends string>(stateManager: StateManager<S, M>, path: P): GetAtPath<S, P>;
|
|
46
47
|
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>];
|
|
47
48
|
declare function useManagedHistory<S, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
|
|
48
|
-
type UseMultiplayerStateOptions<S, M extends object = object, E extends object = object, MenuT extends string = string> =
|
|
49
|
+
type UseMultiplayerStateOptions<S, M extends object = object, E extends object = object, MenuT extends string = string> = NoyaManagerOptions<S, M> & {
|
|
49
50
|
sync?: SyncAdapter<S, M, E, MenuT>;
|
|
50
51
|
inspector?: boolean | StateInspectorOptions;
|
|
51
52
|
};
|
|
@@ -62,11 +63,16 @@ declare function useMultiplayerState<S, M extends object = object, E extends obj
|
|
|
62
63
|
pipelineManager: _noya_app_state_manager.PipelineManager;
|
|
63
64
|
secretManager: _noya_app_state_manager.SecretManager;
|
|
64
65
|
menuItemsManager: _noya_app_state_manager.MenuManager<MenuT>;
|
|
65
|
-
createAsset: (options: _noya_app_state_manager.CreateAssetOptions | Uint8Array | File | Blob) => Promise<
|
|
66
|
+
createAsset: (options: _noya_app_state_manager.CreateAssetOptions | Uint8Array | File | Blob) => Promise<_noya_app_noya_schemas.Asset>;
|
|
66
67
|
deleteAsset: (id: string) => Promise<void>;
|
|
67
|
-
assets:
|
|
68
|
+
assets: _noya_app_noya_schemas.Asset[];
|
|
68
69
|
}];
|
|
69
70
|
|
|
71
|
+
declare function useStateInspector<S, M extends object, E extends object, MenuT extends string = string>({ noyaManager, disabled, colorScheme, anchor, }: {
|
|
72
|
+
noyaManager: NoyaManager<S, M, E, MenuT>;
|
|
73
|
+
disabled: boolean;
|
|
74
|
+
} & Pick<ComponentProps<typeof StateInspector>, "colorScheme" | "anchor">): void;
|
|
75
|
+
|
|
70
76
|
type AppViewType = "editable" | "readOnly" | "preview";
|
|
71
77
|
type AppTheme = "light" | "dark";
|
|
72
78
|
type AppData<State> = {
|
|
@@ -130,10 +136,10 @@ declare function useAnyNoyaStateContext(): AnyNoyaStateContextValue;
|
|
|
130
136
|
declare function useAnyNoyaManager(): NoyaManager<any, any, any, any>;
|
|
131
137
|
declare function useColorScheme(): AppTheme;
|
|
132
138
|
declare function useViewType(): AppViewType;
|
|
133
|
-
declare function useAssets():
|
|
134
|
-
declare function useAsset(id: string | undefined):
|
|
139
|
+
declare function useAssets(): _noya_app_noya_schemas.Asset[];
|
|
140
|
+
declare function useAsset(id: string | undefined): _noya_app_noya_schemas.Asset | undefined;
|
|
135
141
|
declare function useAssetManager(): {
|
|
136
|
-
create: (options: _noya_app_state_manager.CreateAssetOptions | Uint8Array | File | Blob) => Promise<
|
|
142
|
+
create: (options: _noya_app_state_manager.CreateAssetOptions | Uint8Array | File | Blob) => Promise<_noya_app_noya_schemas.Asset>;
|
|
137
143
|
delete: (id: string) => Promise<void>;
|
|
138
144
|
isInitialized: boolean;
|
|
139
145
|
};
|
|
@@ -147,12 +153,14 @@ declare function useInputs(): ({
|
|
|
147
153
|
name: string;
|
|
148
154
|
required: boolean;
|
|
149
155
|
toolId: string | null;
|
|
156
|
+
stableId: string;
|
|
150
157
|
description: string | null;
|
|
151
158
|
} | {
|
|
152
159
|
id: string;
|
|
153
160
|
kind: "data";
|
|
154
161
|
name: string;
|
|
155
162
|
required: boolean;
|
|
163
|
+
stableId: string;
|
|
156
164
|
description: string | null;
|
|
157
165
|
schema: {
|
|
158
166
|
default?: string | undefined;
|
|
@@ -242,22 +250,27 @@ declare function useInputs(): ({
|
|
|
242
250
|
_kind: "Object";
|
|
243
251
|
} | null;
|
|
244
252
|
} | {
|
|
253
|
+
authProvider?: "github" | "figma" | null | undefined;
|
|
254
|
+
authScope?: string | null | undefined;
|
|
245
255
|
id: string;
|
|
246
256
|
kind: "secret";
|
|
247
257
|
name: string;
|
|
248
258
|
required: boolean;
|
|
259
|
+
stableId: string;
|
|
249
260
|
description: string | null;
|
|
250
261
|
})[];
|
|
251
262
|
declare function useOutputTransforms(): ({
|
|
252
263
|
value: string;
|
|
253
264
|
id: string;
|
|
254
265
|
kind: "script";
|
|
266
|
+
stableId: string;
|
|
255
267
|
location: "state" | "url";
|
|
256
268
|
order: number;
|
|
257
269
|
} | {
|
|
258
270
|
value: string;
|
|
259
271
|
id: string;
|
|
260
272
|
kind: "jsonPointer";
|
|
273
|
+
stableId: string;
|
|
261
274
|
order: number;
|
|
262
275
|
})[];
|
|
263
276
|
declare function useIOManager(): _noya_app_state_manager.IOManager;
|
|
@@ -272,9 +285,10 @@ declare const FallbackUntilInitialized: ({ children, fallback, }: {
|
|
|
272
285
|
children: React.ReactNode;
|
|
273
286
|
fallback?: React.ReactNode;
|
|
274
287
|
}) => React.ReactNode;
|
|
275
|
-
declare function createNoyaContext<Schema extends TSchema, M extends object = object, E extends object = object, MenuT extends string = string>({ schema, mergeHistoryEntries, outputTransforms, inputs, }: {
|
|
288
|
+
declare function createNoyaContext<Schema extends TSchema, M extends object = object, E extends object = object, MenuT extends string = string>({ schema, mergeHistoryEntries, outputTransforms, inputs, safeEval, }: {
|
|
276
289
|
schema: Schema;
|
|
277
290
|
mergeHistoryEntries?: StateManagerOptions<Static<Schema>, M>["mergeHistoryEntries"];
|
|
291
|
+
safeEval?: SafeEval;
|
|
278
292
|
outputTransforms?: CreateParams<OutputTransform>[];
|
|
279
293
|
inputs?: CreateParams<Input>[];
|
|
280
294
|
}): {
|
|
@@ -350,4 +364,4 @@ declare class WebSocketConnection<State> {
|
|
|
350
364
|
removeListener(listener: (state: ReconnectingWebSocketState) => void): void;
|
|
351
365
|
}
|
|
352
366
|
|
|
353
|
-
export { AnyEphemeralUserDataManagerContext, AnyNoyaStateContext, type AnyNoyaStateContextValue, type AppData, type AppTheme, type AppViewType, ConnectedUsersContext, type ConnectionEvent, type ConnectionOptions, FallbackUntilInitialized, type GetAppDataOptions, type RenderUserPointer, type RenderUserPointerProps, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, type UseNoyaStateOptions, type UseNoyaStateResult, type UserPointerData, UserPointersOverlay, type UserPointersOverlayProps, WebSocketConnection, createDefaultAppData, createNoyaContext, enforceSchema, getAppData, parseAppDataParameter, useAIManager, useAnyEphemeralUserData, useAnyNoyaManager, useAnyNoyaStateContext, useAsset, useAssetManager, useAssets, useCallableAITools, useColorScheme, useConnectedUsersManager, useCurrentUserId, useIOManager, useInputs, useIsInitialized, useManagedHistory, useManagedState, useMultiplayerState, useNoyaState, useObservable, useOutputTransforms, usePipelineManager, useRegisterAITool, useSecret, useSecretManager, useSecrets, useSyncStateManager, useViewType };
|
|
367
|
+
export { AnyEphemeralUserDataManagerContext, AnyNoyaStateContext, type AnyNoyaStateContextValue, type AppData, type AppTheme, type AppViewType, ConnectedUsersContext, type ConnectionEvent, type ConnectionOptions, FallbackUntilInitialized, type GetAppDataOptions, type NoyaStateProviderProps, type RenderUserPointer, type RenderUserPointerProps, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, type UseNoyaStateOptions, type UseNoyaStateResult, type UserPointerData, UserPointersOverlay, type UserPointersOverlayProps, WebSocketConnection, createDefaultAppData, createNoyaContext, enforceSchema, getAppData, parseAppDataParameter, useAIManager, useAnyEphemeralUserData, useAnyNoyaManager, useAnyNoyaStateContext, useAsset, useAssetManager, useAssets, useCallableAITools, useColorScheme, useConnectedUsersManager, useCurrentUserId, useIOManager, useInputs, useIsInitialized, useManagedHistory, useManagedState, useMultiplayerState, useNoyaState, useObservable, useOutputTransforms, usePipelineManager, useRegisterAITool, useSecret, useSecretManager, useSecrets, useStateInspector, useSyncStateManager, useViewType };
|