@noya-app/noya-multiplayer-react 0.1.20 → 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.
@@ -5,14 +5,14 @@
5
5
  CLI Target: esnext
6
6
  CJS Build start
7
7
  ESM Build start
8
- ESM dist/index.mjs 37.54 KB
9
- ESM dist/index.mjs.map 68.07 KB
10
- ESM ⚡️ Build success in 21ms
11
- CJS dist/index.js 42.34 KB
12
- CJS dist/index.js.map 67.91 KB
13
- CJS ⚡️ Build success in 22ms
8
+ CJS dist/index.js 44.79 KB
9
+ CJS dist/index.js.map 72.76 KB
10
+ CJS ⚡️ Build success in 46ms
11
+ ESM dist/index.mjs 39.67 KB
12
+ ESM dist/index.mjs.map 72.89 KB
13
+ ESM ⚡️ Build success in 46ms
14
14
  DTS 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
- DTS ⚡️ Build success in 4487ms
17
- DTS dist/index.d.ts 4.71 KB
18
- DTS dist/index.d.mts 4.71 KB
16
+ DTS ⚡️ Build success in 1541ms
17
+ DTS dist/index.d.ts 6.13 KB
18
+ DTS dist/index.d.mts 6.13 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @noya-app/state-manager
2
2
 
3
+ ## 0.1.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 7306000: Improve embedded apis
8
+ - Updated dependencies [7306000]
9
+ - @noya-app/state-manager@0.1.21
10
+
11
+ ## 0.1.21
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [20de550]
16
+ - @noya-app/state-manager@0.1.20
17
+
3
18
  ## 0.1.20
4
19
 
5
20
  ### Patch Changes
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 };