@noya-app/noya-multiplayer-react 0.1.21 → 0.1.22
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 +7 -7
- package/CHANGELOG.md +8 -0
- package/dist/index.d.mts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +190 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +91 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/embedded.ts +134 -0
- package/src/hooks.ts +3 -0
- package/src/index.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
[34mCLI[39m Target: esnext
|
|
6
6
|
[34mCJS[39m Build start
|
|
7
7
|
[34mESM[39m Build start
|
|
8
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
9
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
8
|
+
[32mCJS[39m [1mdist/index.js [22m[32m44.79 KB[39m
|
|
9
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m72.76 KB[39m
|
|
10
10
|
[32mCJS[39m ⚡️ Build success in 46ms
|
|
11
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
12
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m39.67 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m72.89 KB[39m
|
|
13
13
|
[32mESM[39m ⚡️ Build success in 46ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
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
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 1541ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m6.13 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m6.13 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _noya_app_state_manager from '@noya-app/state-manager';
|
|
2
|
-
import { MultiplayerUser, EphemeralUserData, ConnectionEvent, Task, MultiplayerStateManager, StateManager, Get, StateManagerOptions, MultiplayerStateManagerOptions } from '@noya-app/state-manager';
|
|
2
|
+
import { MultiplayerUser, EphemeralUserData, TSchema, ConnectionEvent, 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
|
|
|
@@ -45,6 +45,46 @@ declare const UserPointerIcon: React.NamedExoticComponent<{
|
|
|
45
45
|
color?: string | undefined;
|
|
46
46
|
}>;
|
|
47
47
|
|
|
48
|
+
type AppViewType = "editable" | "readOnly" | "preview";
|
|
49
|
+
type AppTheme = "light" | "dark";
|
|
50
|
+
type AppData<State> = {
|
|
51
|
+
multiplayerUrl?: string;
|
|
52
|
+
theme: AppTheme;
|
|
53
|
+
viewType: AppViewType;
|
|
54
|
+
initialState: State;
|
|
55
|
+
inspector: boolean;
|
|
56
|
+
};
|
|
57
|
+
declare function createDefaultAppData<State>(initialState: State): AppData<State>;
|
|
58
|
+
declare function getAppData<State>(): AppData<State> | undefined;
|
|
59
|
+
declare function getAppData<State>(initialState: State): AppData<State>;
|
|
60
|
+
type NoyaAppOptions = {
|
|
61
|
+
schema?: TSchema;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Get data from host app. Fall back to default data.
|
|
65
|
+
*/
|
|
66
|
+
declare function useNoyaApp<State>(initialState: State, { schema }?: NoyaAppOptions): AppData<State>;
|
|
67
|
+
type IframeToHostMessage = {
|
|
68
|
+
type: "application.setMenuItems";
|
|
69
|
+
payload: {
|
|
70
|
+
menuItems: any[];
|
|
71
|
+
};
|
|
72
|
+
} | {
|
|
73
|
+
type: "multiplayer.setUsers";
|
|
74
|
+
payload: {
|
|
75
|
+
users: any[];
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
type HostToIframeMessage = {
|
|
79
|
+
type: "application.selectMenuItem";
|
|
80
|
+
payload: {
|
|
81
|
+
value: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
declare function useBroadcastConnectedUsers(connectedUsers: MultiplayerUser[]): void;
|
|
85
|
+
declare function useBroadcastMenuItems<T>(menuItems: any[], handleSelectMenuItem: (value: T) => void): void;
|
|
86
|
+
declare function isEmbeddedApp(): boolean;
|
|
87
|
+
|
|
48
88
|
type Anchor = "left" | "right" | "bottom left" | "bottom right";
|
|
49
89
|
declare const StateInspector: React.MemoExoticComponent<(<S extends object, M, E>({ state, connectionEvents, connectedUsers, tasks, userId, unstyled, colorScheme, multiplayerStateManager, ephemeralUserData, anchor, forceInit, ...props }: {
|
|
50
90
|
state: S;
|
|
@@ -86,4 +126,4 @@ declare function useMultiplayerState<S extends object, M = void, E = void>(initi
|
|
|
86
126
|
ephemeralUserData: EphemeralUserData<E>;
|
|
87
127
|
}];
|
|
88
128
|
|
|
89
|
-
export { StateInspector, UserNameTag, UserPointer, UserPointerContainer, type UserPointerData, UserPointerIcon, type UserPointerProps, UserPointersOverlay, type UserPointersOverlayProps, getAvatarInitials, getAvatarStyle, useEphemeralUserData, useManagedHistory, useManagedState, useMultiplayerState, useSyncMultiplayerStateManager, useSyncStateManager };
|
|
129
|
+
export { type AppData, type AppTheme, type AppViewType, type HostToIframeMessage, type IframeToHostMessage, StateInspector, UserNameTag, UserPointer, UserPointerContainer, type UserPointerData, UserPointerIcon, type UserPointerProps, UserPointersOverlay, type UserPointersOverlayProps, createDefaultAppData, getAppData, getAvatarInitials, getAvatarStyle, isEmbeddedApp, useBroadcastConnectedUsers, useBroadcastMenuItems, useEphemeralUserData, useManagedHistory, useManagedState, useMultiplayerState, useNoyaApp, useSyncMultiplayerStateManager, useSyncStateManager };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _noya_app_state_manager from '@noya-app/state-manager';
|
|
2
|
-
import { MultiplayerUser, EphemeralUserData, ConnectionEvent, Task, MultiplayerStateManager, StateManager, Get, StateManagerOptions, MultiplayerStateManagerOptions } from '@noya-app/state-manager';
|
|
2
|
+
import { MultiplayerUser, EphemeralUserData, TSchema, ConnectionEvent, 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
|
|
|
@@ -45,6 +45,46 @@ declare const UserPointerIcon: React.NamedExoticComponent<{
|
|
|
45
45
|
color?: string | undefined;
|
|
46
46
|
}>;
|
|
47
47
|
|
|
48
|
+
type AppViewType = "editable" | "readOnly" | "preview";
|
|
49
|
+
type AppTheme = "light" | "dark";
|
|
50
|
+
type AppData<State> = {
|
|
51
|
+
multiplayerUrl?: string;
|
|
52
|
+
theme: AppTheme;
|
|
53
|
+
viewType: AppViewType;
|
|
54
|
+
initialState: State;
|
|
55
|
+
inspector: boolean;
|
|
56
|
+
};
|
|
57
|
+
declare function createDefaultAppData<State>(initialState: State): AppData<State>;
|
|
58
|
+
declare function getAppData<State>(): AppData<State> | undefined;
|
|
59
|
+
declare function getAppData<State>(initialState: State): AppData<State>;
|
|
60
|
+
type NoyaAppOptions = {
|
|
61
|
+
schema?: TSchema;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Get data from host app. Fall back to default data.
|
|
65
|
+
*/
|
|
66
|
+
declare function useNoyaApp<State>(initialState: State, { schema }?: NoyaAppOptions): AppData<State>;
|
|
67
|
+
type IframeToHostMessage = {
|
|
68
|
+
type: "application.setMenuItems";
|
|
69
|
+
payload: {
|
|
70
|
+
menuItems: any[];
|
|
71
|
+
};
|
|
72
|
+
} | {
|
|
73
|
+
type: "multiplayer.setUsers";
|
|
74
|
+
payload: {
|
|
75
|
+
users: any[];
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
type HostToIframeMessage = {
|
|
79
|
+
type: "application.selectMenuItem";
|
|
80
|
+
payload: {
|
|
81
|
+
value: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
declare function useBroadcastConnectedUsers(connectedUsers: MultiplayerUser[]): void;
|
|
85
|
+
declare function useBroadcastMenuItems<T>(menuItems: any[], handleSelectMenuItem: (value: T) => void): void;
|
|
86
|
+
declare function isEmbeddedApp(): boolean;
|
|
87
|
+
|
|
48
88
|
type Anchor = "left" | "right" | "bottom left" | "bottom right";
|
|
49
89
|
declare const StateInspector: React.MemoExoticComponent<(<S extends object, M, E>({ state, connectionEvents, connectedUsers, tasks, userId, unstyled, colorScheme, multiplayerStateManager, ephemeralUserData, anchor, forceInit, ...props }: {
|
|
50
90
|
state: S;
|
|
@@ -86,4 +126,4 @@ declare function useMultiplayerState<S extends object, M = void, E = void>(initi
|
|
|
86
126
|
ephemeralUserData: EphemeralUserData<E>;
|
|
87
127
|
}];
|
|
88
128
|
|
|
89
|
-
export { StateInspector, UserNameTag, UserPointer, UserPointerContainer, type UserPointerData, UserPointerIcon, type UserPointerProps, UserPointersOverlay, type UserPointersOverlayProps, getAvatarInitials, getAvatarStyle, useEphemeralUserData, useManagedHistory, useManagedState, useMultiplayerState, useSyncMultiplayerStateManager, useSyncStateManager };
|
|
129
|
+
export { type AppData, type AppTheme, type AppViewType, type HostToIframeMessage, type IframeToHostMessage, StateInspector, UserNameTag, UserPointer, UserPointerContainer, type UserPointerData, UserPointerIcon, type UserPointerProps, UserPointersOverlay, type UserPointersOverlayProps, createDefaultAppData, getAppData, getAvatarInitials, getAvatarStyle, isEmbeddedApp, useBroadcastConnectedUsers, useBroadcastMenuItems, useEphemeralUserData, useManagedHistory, useManagedState, useMultiplayerState, useNoyaApp, useSyncMultiplayerStateManager, useSyncStateManager };
|