@noya-app/noya-multiplayer-react 0.1.70 → 0.1.72
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 +24 -0
- package/dist/index.bundle.js +46 -20
- package/dist/index.d.mts +84 -55
- package/dist/index.d.ts +84 -55
- package/dist/index.js +518 -273
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +471 -233
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/NoyaStateContext.tsx +156 -105
- package/src/__tests__/noyaApp.test.ts +34 -0
- package/src/__tests__/resourcePayload.test.ts +24 -134
- package/src/components/UserPointersOverlay.tsx +22 -20
- package/src/hooks.ts +22 -14
- package/src/inspector/StateInspector.tsx +318 -255
- package/src/inspector/StateInspectorRow.tsx +3 -1
- package/src/inspector/sections/ServerScriptLogsSection.tsx +128 -0
- package/src/inspector/serialization.ts +4 -2
- package/src/inspector/useStateInspector.tsx +10 -4
- package/src/noyaApp.ts +94 -22
- package/src/singleton.tsx +46 -8
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _noya_app_state_manager from '@noya-app/state-manager';
|
|
2
|
-
import { AIToolDefinition,
|
|
2
|
+
import { AIToolDefinition, UserManager, SharedConnectionDataManager, NoyaManager, StateManagerOptions, StateManager, NoyaManagerOptions, SyncAdapter, TSchema, AccessType, PolicyAuthContext, LocalStorageSyncOptions, Static, ExtractRequestBody, PublishCallback, ResourceManager, TranscriptionManager, AssetTranscriptionResult, StreamFilter, ActivityEventsManager, MultiplayerPatchMetadata, SafeEval, CreateParams, MultiplayerStateManager, ReconnectingWebSocketState, ClientToServerMessage, ServerToClientMessage, MultiplayerStateManagerError } from '@noya-app/state-manager';
|
|
3
3
|
export * from '@noya-app/state-manager';
|
|
4
4
|
import React, { SetStateAction, ComponentProps, Dispatch } from 'react';
|
|
5
|
-
import { Asset, ResourceCreate, CreateResourceParametersWithoutAccessibleByFileId, ModifiedResource,
|
|
5
|
+
import { Asset, ResourceCreate, CreateResourceParametersWithoutAccessibleByFileId, ModifiedResource, Resource, MediaItem, ResourceMap, ResourceCreateMap, OutputTransform, Input } from '@noya-app/noya-schemas';
|
|
6
6
|
import { Root } from 'react-dom/client';
|
|
7
7
|
import { MenuItem } from '@noya-app/noya-designsystem';
|
|
8
8
|
import { ObservableOptions, PathKey, GetAtPath, Observable } from '@noya-app/observable';
|
|
@@ -27,8 +27,8 @@ type RenderUserPointer = {
|
|
|
27
27
|
renderUserPointer: (options: RenderUserPointerProps) => React.ReactNode;
|
|
28
28
|
};
|
|
29
29
|
type UserPointersOverlayProps<E extends UserPointerData> = {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
userManager: UserManager;
|
|
31
|
+
sharedConnectionDataManager: SharedConnectionDataManager<E>;
|
|
32
32
|
} & RenderUserPointer;
|
|
33
33
|
declare const UserPointersOverlay: <E extends UserPointerData>(props: UserPointersOverlayProps<E>) => React.ReactElement<any> | null;
|
|
34
34
|
|
|
@@ -36,24 +36,25 @@ type StateInspectorAnchor = "left" | "right" | "bottom left" | "bottom right";
|
|
|
36
36
|
type StateInspectorOptions = {
|
|
37
37
|
colorScheme?: "light" | "dark";
|
|
38
38
|
anchor?: StateInspectorAnchor;
|
|
39
|
+
advanced?: boolean;
|
|
39
40
|
};
|
|
40
|
-
declare const StateInspector: <S, M extends object, E extends object, MenuT extends string = string>(props: {
|
|
41
|
-
noyaManager: NoyaManager<S, M, E, MenuT>;
|
|
41
|
+
declare const StateInspector: <S, M extends object, E extends object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>>(props: {
|
|
42
|
+
noyaManager: NoyaManager<S, M, E, MenuT, I>;
|
|
42
43
|
unstyled?: boolean;
|
|
43
44
|
} & StateInspectorOptions & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">) => React.ReactElement<any> | null;
|
|
44
45
|
|
|
45
46
|
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>];
|
|
46
47
|
declare function useManagedHistory<S, M = void>(stateManager: StateManager<S, M>): _noya_app_state_manager.HistorySnapshot<S, M>;
|
|
47
|
-
type UseMultiplayerStateOptions<S, M extends object = object, E extends object = object, MenuT extends string = string> = NoyaManagerOptions<S, M> & {
|
|
48
|
-
sync?: SyncAdapter<S, M, E, MenuT>;
|
|
48
|
+
type UseMultiplayerStateOptions<S, M extends object = object, E extends object = object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>> = NoyaManagerOptions<S, M> & {
|
|
49
|
+
sync?: SyncAdapter<S, M, E, MenuT, I>;
|
|
49
50
|
inspector?: boolean | StateInspectorOptions;
|
|
50
51
|
};
|
|
51
|
-
declare function useBindNoyaManager<S, M extends object = object, E extends object = object, MenuT extends string = string>(noyaManager: NoyaManager<S, M, E, MenuT>, options?: Pick<UseMultiplayerStateOptions<S, M, E, MenuT>, "inspector" | "sync">): readonly [S, (...args: [metadata: Partial<M>, action: S | ((prevState: S) => S)] | [action: S | ((prevState: S) => S)]) => void, {
|
|
52
|
+
declare function useBindNoyaManager<S, M extends object = object, E extends object = object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>>(noyaManager: NoyaManager<S, M, E, MenuT, I>, options?: Pick<UseMultiplayerStateOptions<S, M, E, MenuT, I>, "inspector" | "sync">): readonly [S, (...args: [metadata: Partial<M>, action: S | ((prevState: S) => S)] | [action: S | ((prevState: S) => S)]) => void, {
|
|
52
53
|
noyaManager: typeof noyaManager;
|
|
53
54
|
taskManager: typeof noyaManager.taskManager;
|
|
54
55
|
connectionEventManager: typeof noyaManager.connectionEventManager;
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
userManager: typeof noyaManager.userManager;
|
|
57
|
+
sharedConnectionDataManager: typeof noyaManager.sharedConnectionDataManager;
|
|
57
58
|
multiplayerStateManager: typeof noyaManager.multiplayerStateManager;
|
|
58
59
|
assetManager: typeof noyaManager.assetManager;
|
|
59
60
|
aiManager: typeof noyaManager.aiManager;
|
|
@@ -75,12 +76,12 @@ declare function useBindNoyaManager<S, M extends object = object, E extends obje
|
|
|
75
76
|
userId: string | null;
|
|
76
77
|
}[];
|
|
77
78
|
}];
|
|
78
|
-
declare function useMultiplayerState<S, M extends object = object, E extends object = object, MenuT extends string = string>(initialState: S | (() => S), options?: UseMultiplayerStateOptions<S, M, E, MenuT>): readonly [S, (...args: [metadata: Partial<M>, action: S | ((prevState: S) => S)] | [action: S | ((prevState: S) => S)]) => void, {
|
|
79
|
-
noyaManager: NoyaManager<S, M, E, MenuT>;
|
|
79
|
+
declare function useMultiplayerState<S, M extends object = object, E extends object = object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>>(initialState: S | (() => S), options?: UseMultiplayerStateOptions<S, M, E, MenuT, I>): readonly [S, (...args: [metadata: Partial<M>, action: S | ((prevState: S) => S)] | [action: S | ((prevState: S) => S)]) => void, {
|
|
80
|
+
noyaManager: NoyaManager<S, M, E, MenuT, I>;
|
|
80
81
|
taskManager: _noya_app_state_manager.TaskManager;
|
|
81
82
|
connectionEventManager: _noya_app_state_manager.ConnectionEventManager<S>;
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
userManager: _noya_app_state_manager.UserManager;
|
|
84
|
+
sharedConnectionDataManager: _noya_app_state_manager.SharedConnectionDataManager<E>;
|
|
84
85
|
multiplayerStateManager: _noya_app_state_manager.MultiplayerStateManager<S, M>;
|
|
85
86
|
assetManager: _noya_app_state_manager.AssetManager;
|
|
86
87
|
aiManager: _noya_app_state_manager.AIManager;
|
|
@@ -104,14 +105,14 @@ declare function useMultiplayerState<S, M extends object = object, E extends obj
|
|
|
104
105
|
}];
|
|
105
106
|
|
|
106
107
|
declare function fetchAssetMap(assets: Asset[]): Promise<Record<string, Uint8Array>>;
|
|
107
|
-
declare function exportAll(noyaManager: NoyaManager<any, any, any, any>): Promise<Uint8Array>;
|
|
108
|
+
declare function exportAll(noyaManager: NoyaManager<any, any, any, any, any>): Promise<Uint8Array>;
|
|
108
109
|
declare function encodeAll({ state, schema, assets, assetMap, }: {
|
|
109
110
|
state: unknown;
|
|
110
111
|
schema?: TSchema;
|
|
111
112
|
assets: Asset[];
|
|
112
113
|
assetMap: Record<string, Uint8Array>;
|
|
113
114
|
}): Uint8Array;
|
|
114
|
-
declare function importAll(buffer: Uint8Array | ArrayBuffer, noyaManager: NoyaManager<any, any, any, any>, { shouldAllowSchemaChange, }?: {
|
|
115
|
+
declare function importAll(buffer: Uint8Array | ArrayBuffer, noyaManager: NoyaManager<any, any, any, any, any>, { shouldAllowSchemaChange, }?: {
|
|
115
116
|
shouldAllowSchemaChange?: ({ oldSchema, newSchema, }: {
|
|
116
117
|
oldSchema: TSchema;
|
|
117
118
|
newSchema: TSchema;
|
|
@@ -129,10 +130,13 @@ declare function createStateInspectorRoot(): {
|
|
|
129
130
|
root: Root;
|
|
130
131
|
unmount: () => void;
|
|
131
132
|
};
|
|
132
|
-
declare function useStateInspector<S, M extends object, E extends object, MenuT extends string = string>({ noyaManager, disabled, colorScheme, anchor, }: {
|
|
133
|
-
noyaManager: NoyaManager<S, M, E, MenuT>;
|
|
134
|
-
disabled
|
|
135
|
-
|
|
133
|
+
declare function useStateInspector<S, M extends object, E extends object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>>({ noyaManager, disabled, advanced, colorScheme, anchor, }: {
|
|
134
|
+
noyaManager: NoyaManager<S, M, E, MenuT, I>;
|
|
135
|
+
disabled?: boolean;
|
|
136
|
+
advanced?: boolean;
|
|
137
|
+
colorScheme?: ComponentProps<typeof StateInspector>["colorScheme"];
|
|
138
|
+
anchor?: ComponentProps<typeof StateInspector>["anchor"];
|
|
139
|
+
}): void;
|
|
136
140
|
|
|
137
141
|
type AppViewType = "editable" | "readOnly" | "preview";
|
|
138
142
|
type AppTheme = "light" | "dark";
|
|
@@ -142,6 +146,9 @@ type AppData<State> = {
|
|
|
142
146
|
viewType: AppViewType;
|
|
143
147
|
initialState: State;
|
|
144
148
|
inspector: boolean | StateInspectorOptions;
|
|
149
|
+
userId?: string;
|
|
150
|
+
isDemo: boolean;
|
|
151
|
+
access?: AccessType;
|
|
145
152
|
};
|
|
146
153
|
declare function createDefaultAppData<State>(initialState: State): AppData<State>;
|
|
147
154
|
type GetAppDataOptions = {
|
|
@@ -155,20 +162,23 @@ type GetAppDataOptions = {
|
|
|
155
162
|
declare function enforceSchema<State>(initialState: State, schema?: TSchema): State;
|
|
156
163
|
declare function parseAppDataParameter(options?: GetAppDataOptions): AppData<unknown> | null;
|
|
157
164
|
declare function getAppData<State>(initialState: State | (() => State), schema?: TSchema, options?: GetAppDataOptions): AppData<State>;
|
|
158
|
-
declare function getSyncAdapter<S, M extends object = object, E extends object = object, MenuT extends string = string>(params?: {
|
|
165
|
+
declare function getSyncAdapter<S, M extends object = object, E extends object = object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>>(params?: {
|
|
159
166
|
multiplayerUrl?: string;
|
|
160
167
|
offlineStorageKey?: string;
|
|
161
168
|
debug?: boolean;
|
|
162
|
-
|
|
163
|
-
|
|
169
|
+
policyAuthContext?: PolicyAuthContext;
|
|
170
|
+
serverScripts?: LocalStorageSyncOptions["serverScripts"];
|
|
171
|
+
}): SyncAdapter<S, M, E, MenuT, I>;
|
|
172
|
+
type UseNoyaStateOptions<S, M extends object = object, E extends object = object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>> = UseMultiplayerStateOptions<S, M, E, MenuT, I> & {
|
|
164
173
|
offlineStorageKey?: string;
|
|
165
174
|
};
|
|
166
|
-
type UseNoyaStateResult<S, M extends object = object, E extends object = object, MenuT extends string = string> = [
|
|
167
|
-
ReturnType<typeof useBindNoyaManager<S, M, E, MenuT>>[0],
|
|
168
|
-
ReturnType<typeof useBindNoyaManager<S, M, E, MenuT>>[1],
|
|
169
|
-
ReturnType<typeof useBindNoyaManager<S, M, E, MenuT>>[2] & {
|
|
175
|
+
type UseNoyaStateResult<S, M extends object = object, E extends object = object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>> = [
|
|
176
|
+
ReturnType<typeof useBindNoyaManager<S, M, E, MenuT, I>>[0],
|
|
177
|
+
ReturnType<typeof useBindNoyaManager<S, M, E, MenuT, I>>[1],
|
|
178
|
+
ReturnType<typeof useBindNoyaManager<S, M, E, MenuT, I>>[2] & {
|
|
170
179
|
theme: AppTheme;
|
|
171
180
|
viewType: AppViewType;
|
|
181
|
+
isDemo: boolean;
|
|
172
182
|
}
|
|
173
183
|
];
|
|
174
184
|
/**
|
|
@@ -180,38 +190,34 @@ type UseNoyaStateResult<S, M extends object = object, E extends object = object,
|
|
|
180
190
|
* 2. Pass an initial state and a schema: `useNoyaState(initialState, { schema })`
|
|
181
191
|
* 3. Pass only a schema, and a conforming initial state is created automatically: `useNoyaState({ schema })`
|
|
182
192
|
*/
|
|
183
|
-
declare function useNoyaStateInternal<S, M extends object = object, E extends object = object, MenuT extends string = string, O extends UseNoyaStateOptions<S, M, E, MenuT> = UseNoyaStateOptions<S, M, E, MenuT>>(...args: [
|
|
193
|
+
declare function useNoyaStateInternal<S, M extends object = object, E extends object = object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>, O extends UseNoyaStateOptions<S, M, E, MenuT, I> = UseNoyaStateOptions<S, M, E, MenuT, I>>(...args: [
|
|
184
194
|
initialState: O["schema"] extends TSchema ? Static<O["schema"]> | (() => Static<O["schema"]>) : S | (() => S),
|
|
185
195
|
options?: O
|
|
186
196
|
] | [options: O & {
|
|
187
197
|
schema: TSchema;
|
|
188
|
-
}]): UseNoyaStateResult<O["schema"] extends TSchema ? Static<O["schema"]> : S, M, E, MenuT>;
|
|
198
|
+
}]): UseNoyaStateResult<O["schema"] extends TSchema ? Static<O["schema"]> : S, M, E, MenuT, I>;
|
|
189
199
|
|
|
190
200
|
declare function resourceToCreateParameters(resource: ResourceCreate): CreateResourceParametersWithoutAccessibleByFileId;
|
|
191
|
-
type
|
|
201
|
+
type ResourcePatchRequestBody = ExtractRequestBody<"PATCH /api/resources">;
|
|
202
|
+
type BuildResourcePatchPayloadParameters = {
|
|
192
203
|
addedResources: ResourceCreate[];
|
|
193
204
|
modifiedResources: ModifiedResource[];
|
|
194
|
-
|
|
195
|
-
resourceMap: ResourceMap;
|
|
205
|
+
removedResources: Resource[];
|
|
196
206
|
};
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
consumedModifiedResourceIds: string[];
|
|
200
|
-
};
|
|
201
|
-
declare function buildCreateResourcePayload({ addedResources, modifiedResources, newResourceMap, resourceMap, }: BuildCreateResourcePayloadParameters): BuildCreateResourcePayloadResult;
|
|
202
|
-
interface NoyaStateProviderProps<S, M extends object, E extends object, MenuT extends string> extends Omit<UseNoyaStateOptions<S, M, E, MenuT>, "schema" | "mergeHistoryEntries"> {
|
|
207
|
+
declare function buildResourcePatchPayload({ addedResources, modifiedResources, removedResources, }: BuildResourcePatchPayloadParameters): ResourcePatchRequestBody;
|
|
208
|
+
interface NoyaStateProviderProps<S, M extends object, E extends object, MenuT extends string, I extends Record<string, any> = Record<string, unknown>> extends Omit<UseNoyaStateOptions<S, M, E, MenuT, I>, "schema" | "mergeHistoryEntries"> {
|
|
203
209
|
children: React.ReactNode;
|
|
204
210
|
initialState?: S;
|
|
205
211
|
fallback?: React.ReactNode;
|
|
206
212
|
}
|
|
207
213
|
type AnyNoyaStateContextValue = {
|
|
208
|
-
noyaManager: NoyaManager<any, any, any, any>;
|
|
214
|
+
noyaManager: NoyaManager<any, any, any, any, any>;
|
|
209
215
|
theme: AppTheme;
|
|
210
216
|
viewType: AppViewType;
|
|
211
217
|
};
|
|
212
218
|
declare const AnyNoyaStateContext: React.Context<AnyNoyaStateContextValue | undefined>;
|
|
213
219
|
declare function useAnyNoyaStateContext(): AnyNoyaStateContextValue;
|
|
214
|
-
declare function useAnyNoyaManager(): NoyaManager<any, any, any, any>;
|
|
220
|
+
declare function useAnyNoyaManager(): NoyaManager<any, any, any, any, any>;
|
|
215
221
|
declare function useColorScheme(): AppTheme;
|
|
216
222
|
declare function useViewType(): AppViewType;
|
|
217
223
|
declare function useAssets(): {
|
|
@@ -375,16 +381,36 @@ declare function useIOManager(): _noya_app_state_manager.IOManager;
|
|
|
375
381
|
declare function usePublish(callback: PublishCallback): void;
|
|
376
382
|
declare function useIsInitialized(): boolean;
|
|
377
383
|
declare function usePipelineManager(): _noya_app_state_manager.PipelineManager;
|
|
378
|
-
declare function
|
|
384
|
+
declare function useUserManager(): _noya_app_state_manager.UserManager;
|
|
379
385
|
declare function useConnectedUsers(): _noya_app_state_manager.MultiplayerUser[];
|
|
380
386
|
declare function useConnectedUser(userId?: string | null): _noya_app_state_manager.MultiplayerUser | undefined;
|
|
381
|
-
declare function
|
|
382
|
-
declare function
|
|
387
|
+
declare function useAnySharedConnectionData(): SharedConnectionDataManager<any>;
|
|
388
|
+
declare function useEnqueueInput<I extends Record<string, any> = Record<string, unknown>>(): NoyaManager<any, any, any, any, I>["enqueueInput"];
|
|
389
|
+
declare function useNoyaUser(): _noya_app_state_manager.MultiplayerUser | undefined;
|
|
390
|
+
declare function useNoyaId(): string | undefined;
|
|
391
|
+
declare function useNoyaUserId(): string | undefined;
|
|
392
|
+
declare function useNoyaConnectionId(): string | undefined;
|
|
393
|
+
declare function useNoyaClientId(): string | undefined;
|
|
383
394
|
declare function useIsProcessing(): boolean;
|
|
384
395
|
declare function useFileName(): string | undefined;
|
|
385
396
|
declare function useFilePropertyManager(): _noya_app_state_manager.FilePropertyManager;
|
|
386
397
|
declare function useSetFileNameState(): readonly [string | undefined, (name: string) => Promise<string>];
|
|
387
398
|
declare function useResourceManager(): ResourceManager;
|
|
399
|
+
declare function useNoyaTranscriptionManager(): TranscriptionManager;
|
|
400
|
+
type UseNoyaAssetTranscriptionOptions = {
|
|
401
|
+
endpoint?: string;
|
|
402
|
+
apiKey?: string;
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* Returns a text transcription for the given assetId.
|
|
406
|
+
*
|
|
407
|
+
* - This API is available when running your app on noya.io, not when running it locally.
|
|
408
|
+
* - An asset must first be uploaded via the `useAssetManager().create()` method before
|
|
409
|
+
* it can be transcribed via this API.
|
|
410
|
+
* - The asset must be a valid audio or video file.
|
|
411
|
+
*/
|
|
412
|
+
declare function useNoyaAssetTranscription(assetId: string, options?: UseNoyaAssetTranscriptionOptions): AssetTranscriptionResult;
|
|
413
|
+
declare function useNoyaAssetTranscription(assetId?: string, options?: UseNoyaAssetTranscriptionOptions): AssetTranscriptionResult | undefined;
|
|
388
414
|
declare function resourceToMediaItem(resource: Resource): MediaItem;
|
|
389
415
|
declare function useResources({ shouldDeleteAssets, }?: {
|
|
390
416
|
shouldDeleteAssets?: boolean;
|
|
@@ -395,15 +421,15 @@ declare const FallbackUntilInitialized: ({ children, fallback, }: {
|
|
|
395
421
|
children: React.ReactNode;
|
|
396
422
|
fallback?: React.ReactNode;
|
|
397
423
|
}) => React.ReactNode;
|
|
398
|
-
declare function createNoyaContext<Schema extends TSchema, M extends object = object, E extends object = object, MenuT extends string = string>({ schema, mergeHistoryEntries, outputTransforms, inputs, safeEval, }: {
|
|
424
|
+
declare function createNoyaContext<Schema extends TSchema, M extends object = object, E extends object = object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>>({ schema, mergeHistoryEntries, outputTransforms, inputs, safeEval, }: {
|
|
399
425
|
schema: Schema;
|
|
400
426
|
mergeHistoryEntries?: StateManagerOptions<Static<Schema>, M & Pick<MultiplayerPatchMetadata, "name" | "timestamp">>["mergeHistoryEntries"];
|
|
401
427
|
safeEval?: SafeEval;
|
|
402
428
|
outputTransforms?: CreateParams<OutputTransform>[];
|
|
403
429
|
inputs?: CreateParams<Input>[];
|
|
404
430
|
}): {
|
|
405
|
-
Context: React.Context<NoyaManager<Static<Schema>, M, E,
|
|
406
|
-
Provider: ({ children, initialState, ...options }: NoyaStateProviderProps<Static<Schema>, M, E, MenuT>) => React.JSX.Element;
|
|
431
|
+
Context: React.Context<NoyaManager<Static<Schema>, M, E, MenuT, I> | undefined>;
|
|
432
|
+
Provider: ({ children, initialState, ...options }: NoyaStateProviderProps<Static<Schema>, M, E, MenuT, I>) => React.JSX.Element;
|
|
407
433
|
NoyaContextProvider: ({ children, contextValue, }: {
|
|
408
434
|
children: React.ReactNode;
|
|
409
435
|
contextValue: AnyNoyaStateContextValue;
|
|
@@ -423,14 +449,14 @@ declare function createNoyaContext<Schema extends TSchema, M extends object = ob
|
|
|
423
449
|
<P extends PathKey[] | string>(path?: P): [GetAtPath<Static<Schema>, P>, (...args: [metadata: Partial<M & Pick<MultiplayerPatchMetadata, "name" | "timestamp">>, value: SetStateAction<GetAtPath<Static<Schema>, P>>] | [value: SetStateAction<GetAtPath<Static<Schema>, P>>]) => void];
|
|
424
450
|
};
|
|
425
451
|
useStateManager: () => MultiplayerStateManager<Static<Schema>, Partial<M & Pick<MultiplayerPatchMetadata, "name" | "timestamp">>>;
|
|
426
|
-
|
|
452
|
+
useSharedConnectionDataManager: () => SharedConnectionDataManager<E>;
|
|
427
453
|
useLeftMenuItems: () => MenuItem<MenuT>[];
|
|
428
454
|
useSetLeftMenuItems: (leftMenuItems?: MenuItem<MenuT>[]) => void;
|
|
429
455
|
useRightMenuItems: () => MenuItem<MenuT>[];
|
|
430
456
|
useSetRightMenuItems: (rightMenuItems?: MenuItem<MenuT>[]) => void;
|
|
431
457
|
useHandleMenuItem: (callback: (type: MenuT) => void) => void;
|
|
432
458
|
useOnSelectMenuItemCallback: () => (type: MenuT) => void;
|
|
433
|
-
useNoyaManager: () => NoyaManager<Static<Schema>, Partial<M & Pick<MultiplayerPatchMetadata, "name" | "timestamp">>, E, MenuT>;
|
|
459
|
+
useNoyaManager: () => NoyaManager<Static<Schema>, Partial<M & Pick<MultiplayerPatchMetadata, "name" | "timestamp">>, E, MenuT, I>;
|
|
434
460
|
useMenu: (options: {
|
|
435
461
|
leftMenuItems?: MenuItem<MenuT>[];
|
|
436
462
|
rightMenuItems?: MenuItem<MenuT>[];
|
|
@@ -439,22 +465,25 @@ declare function createNoyaContext<Schema extends TSchema, M extends object = ob
|
|
|
439
465
|
};
|
|
440
466
|
|
|
441
467
|
type AnyNoyaSingletonBindings = {
|
|
442
|
-
sync?: SyncAdapter<any, any, any, any>;
|
|
468
|
+
sync?: SyncAdapter<any, any, any, any, any>;
|
|
443
469
|
inspector?: boolean | StateInspectorOptions;
|
|
444
470
|
theme: AppTheme;
|
|
445
471
|
viewType: AppViewType;
|
|
472
|
+
userId?: string;
|
|
473
|
+
isDemo: boolean;
|
|
446
474
|
};
|
|
447
|
-
type AnyNoyaSingletonOptions<S, M extends object, E extends object, MenuT extends string> = NoyaManagerOptions<S, M> & {
|
|
475
|
+
type AnyNoyaSingletonOptions<S, M extends object, E extends object, MenuT extends string, I extends Record<string, any> = Record<string, unknown>> = NoyaManagerOptions<S, M> & {
|
|
448
476
|
initialState?: S | (() => S);
|
|
449
|
-
sync?: SyncAdapter<S, M, E, MenuT>;
|
|
477
|
+
sync?: SyncAdapter<S, M, E, MenuT, I>;
|
|
450
478
|
inspector?: boolean | StateInspectorOptions;
|
|
451
479
|
theme?: AppTheme;
|
|
452
480
|
viewType?: AppViewType;
|
|
453
481
|
offlineStorageKey?: string;
|
|
454
482
|
multiplayerUrl?: string;
|
|
483
|
+
serverScripts?: LocalStorageSyncOptions["serverScripts"];
|
|
455
484
|
};
|
|
456
|
-
declare function initializeNoyaSingleton<S, M extends object, E extends object, MenuT extends string>(options?: AnyNoyaSingletonOptions<S, M, E, MenuT>): void;
|
|
457
|
-
declare function getNoyaManagerSingleton(): NoyaManager<any, any, any, any>;
|
|
485
|
+
declare function initializeNoyaSingleton<S, M extends object, E extends object, MenuT extends string, I extends Record<string, any> = Record<string, unknown>>(options?: AnyNoyaSingletonOptions<S, M, E, MenuT, I>): void;
|
|
486
|
+
declare function getNoyaManagerSingleton(): NoyaManager<any, any, any, any, any>;
|
|
458
487
|
declare function getNoyaSingletonBindings(): AnyNoyaSingletonBindings | undefined;
|
|
459
488
|
declare function deleteNoyaSingleton(): void;
|
|
460
489
|
|
|
@@ -498,4 +527,4 @@ declare class WebSocketConnection<State> {
|
|
|
498
527
|
removeListener(listener: (state: ReconnectingWebSocketState) => void): void;
|
|
499
528
|
}
|
|
500
529
|
|
|
501
|
-
export { type AnyNoyaSingletonBindings, type AnyNoyaSingletonOptions, AnyNoyaStateContext, type AnyNoyaStateContextValue, type AppData, type AppTheme, type AppViewType, 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,
|
|
530
|
+
export { type AnyNoyaSingletonBindings, type AnyNoyaSingletonOptions, AnyNoyaStateContext, type AnyNoyaStateContextValue, type AppData, type AppTheme, type AppViewType, 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, buildResourcePatchPayload, createDefaultAppData, createNoyaContext, createStateInspectorRoot, decodeAll, deleteNoyaSingleton, encodeAll, enforceSchema, exportAll, fetchAssetMap, getAppData, getNoyaManagerSingleton, getNoyaSingletonBindings, getSyncAdapter, importAll, initializeNoyaSingleton, parseAppDataParameter, replaceDeep, resourceToCreateParameters, resourceToMediaItem, useAIManager, useActivityEvents, useActivityEventsForManager, useAnyNoyaManager, useAnyNoyaStateContext, useAnySharedConnectionData, useAsset, useAssetManager, useAssets, useBindNoyaManager, useCallableAITools, useColorScheme, useConnectedUser, useConnectedUsers, useEnqueueInput, useFileName, useFilePropertyManager, useIOManager, useInputs, useIsInitialized, useIsProcessing, useManagedHistory, useManagedState, useMultiplayerState, useNoyaAssetTranscription, useNoyaClientId, useNoyaConnectionId, useNoyaId, useNoyaStateInternal, useNoyaTranscriptionManager, useNoyaUser, useNoyaUserId, useObservable, useOutputTransforms, usePipelineManager, usePublish, useRegisterAITool, useResourceManager, useResources, useSecret, useSecretManager, useSecrets, useSetFileNameState, useStateInspector, useUserManager, useViewType };
|