@noya-app/noya-multiplayer-react 0.1.73 → 0.1.74

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/dist/index.d.mts CHANGED
@@ -149,6 +149,9 @@ type AppData<State> = {
149
149
  userId?: string;
150
150
  isDemo: boolean;
151
151
  access?: AccessType;
152
+ clientId?: string;
153
+ clientName?: string;
154
+ clientImage?: string;
152
155
  };
153
156
  declare function createDefaultAppData<State>(initialState: State): AppData<State>;
154
157
  type GetAppDataOptions = {
package/dist/index.d.ts CHANGED
@@ -149,6 +149,9 @@ type AppData<State> = {
149
149
  userId?: string;
150
150
  isDemo: boolean;
151
151
  access?: AccessType;
152
+ clientId?: string;
153
+ clientName?: string;
154
+ clientImage?: string;
152
155
  };
153
156
  declare function createDefaultAppData<State>(initialState: State): AppData<State>;
154
157
  type GetAppDataOptions = {
package/dist/index.js CHANGED
@@ -6378,6 +6378,10 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
6378
6378
  "noya-multiplayer-react-show-users",
6379
6379
  true
6380
6380
  );
6381
+ const [showUserDetails, setShowUserDetails] = useLocalStorageState(
6382
+ "noya-multiplayer-react-show-user-details",
6383
+ false
6384
+ );
6381
6385
  const [showData, setShowData] = useLocalStorageState(
6382
6386
  "noya-multiplayer-react-show-data",
6383
6387
  true
@@ -6545,9 +6549,17 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
6545
6549
  colorScheme,
6546
6550
  style: {
6547
6551
  flex: "0 0 auto",
6548
- maxHeight: "200px"
6552
+ maxHeight: "50%",
6553
+ overflowY: "auto"
6549
6554
  },
6550
- right: /* @__PURE__ */ import_react15.default.createElement(
6555
+ right: /* @__PURE__ */ import_react15.default.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ import_react15.default.createElement(
6556
+ StateInspectorButton,
6557
+ {
6558
+ theme,
6559
+ onClick: () => setShowUserDetails(!showUserDetails)
6560
+ },
6561
+ "Toggle details"
6562
+ ), /* @__PURE__ */ import_react15.default.createElement(
6551
6563
  StateInspectorToggleButton,
6552
6564
  {
6553
6565
  showInspector,
@@ -6555,10 +6567,9 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
6555
6567
  theme,
6556
6568
  anchor
6557
6569
  }
6558
- )
6570
+ ))
6559
6571
  },
6560
6572
  /* @__PURE__ */ import_react15.default.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.map((user, index, array) => {
6561
- const identifier = user.userId ?? user.connectionId;
6562
6573
  return /* @__PURE__ */ import_react15.default.createElement(
6563
6574
  StateInspectorRow,
6564
6575
  {
@@ -6584,10 +6595,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
6584
6595
  }
6585
6596
  }
6586
6597
  ),
6587
- user.name,
6588
- " (",
6589
- ellipsis(identifier, 8, "middle"),
6590
- ")"
6598
+ showUserDetails ? /* @__PURE__ */ import_react15.default.createElement(import_react_inspector7.ObjectInspector, { data: user, theme }) : user.name
6591
6599
  );
6592
6600
  }), !connectedUsers && /* @__PURE__ */ import_react15.default.createElement(
6593
6601
  "div",
@@ -7192,6 +7200,17 @@ function parseAppDataParameter(options) {
7192
7200
  return null;
7193
7201
  }
7194
7202
  }
7203
+ function applyClientIdentityFromAppData(appData) {
7204
+ if (appData.clientId !== void 0) {
7205
+ (0, import_state_manager3.setClientId)(appData.clientId);
7206
+ }
7207
+ if (appData.clientName !== void 0) {
7208
+ (0, import_state_manager3.setClientName)(appData.clientName);
7209
+ }
7210
+ if (appData.clientImage !== void 0) {
7211
+ (0, import_state_manager3.setClientImage)(appData.clientImage);
7212
+ }
7213
+ }
7195
7214
  function getAppData(initialState, schema, options) {
7196
7215
  const resolvedInitialState = initialState instanceof Function ? initialState() : initialState;
7197
7216
  let appData = parseAppDataParameter(options) ?? createDefaultAppData(resolvedInitialState);
@@ -7202,6 +7221,7 @@ function getAppData(initialState, schema, options) {
7202
7221
  appData.isDemo = appData.isDemo ?? false;
7203
7222
  const fallbackAccess = appData.viewType === "editable" ? "write" : "read";
7204
7223
  appData.access = appData.access ?? fallbackAccess;
7224
+ applyClientIdentityFromAppData(appData);
7205
7225
  return appData;
7206
7226
  }
7207
7227
  function getSyncAdapter(params) {