@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/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +8 -0
- package/dist/index.bundle.js +21 -21
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/noyaApp.test.ts +40 -0
- package/src/inspector/StateInspector.tsx +25 -10
- package/src/noyaApp.ts +28 -0
package/dist/index.mjs
CHANGED
|
@@ -4628,6 +4628,9 @@ import {
|
|
|
4628
4628
|
localStorageSync,
|
|
4629
4629
|
NoyaManager as NoyaManager3,
|
|
4630
4630
|
parentFrameSync,
|
|
4631
|
+
setClientId,
|
|
4632
|
+
setClientImage,
|
|
4633
|
+
setClientName,
|
|
4631
4634
|
stubSync as stubSync2,
|
|
4632
4635
|
TypeGuard,
|
|
4633
4636
|
webSocketSync
|
|
@@ -6336,6 +6339,10 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6336
6339
|
"noya-multiplayer-react-show-users",
|
|
6337
6340
|
true
|
|
6338
6341
|
);
|
|
6342
|
+
const [showUserDetails, setShowUserDetails] = useLocalStorageState(
|
|
6343
|
+
"noya-multiplayer-react-show-user-details",
|
|
6344
|
+
false
|
|
6345
|
+
);
|
|
6339
6346
|
const [showData, setShowData] = useLocalStorageState(
|
|
6340
6347
|
"noya-multiplayer-react-show-data",
|
|
6341
6348
|
true
|
|
@@ -6503,9 +6510,17 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6503
6510
|
colorScheme,
|
|
6504
6511
|
style: {
|
|
6505
6512
|
flex: "0 0 auto",
|
|
6506
|
-
maxHeight: "
|
|
6513
|
+
maxHeight: "50%",
|
|
6514
|
+
overflowY: "auto"
|
|
6507
6515
|
},
|
|
6508
|
-
right: /* @__PURE__ */ React15.createElement(
|
|
6516
|
+
right: /* @__PURE__ */ React15.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React15.createElement(
|
|
6517
|
+
StateInspectorButton,
|
|
6518
|
+
{
|
|
6519
|
+
theme,
|
|
6520
|
+
onClick: () => setShowUserDetails(!showUserDetails)
|
|
6521
|
+
},
|
|
6522
|
+
"Toggle details"
|
|
6523
|
+
), /* @__PURE__ */ React15.createElement(
|
|
6509
6524
|
StateInspectorToggleButton,
|
|
6510
6525
|
{
|
|
6511
6526
|
showInspector,
|
|
@@ -6513,10 +6528,9 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6513
6528
|
theme,
|
|
6514
6529
|
anchor
|
|
6515
6530
|
}
|
|
6516
|
-
)
|
|
6531
|
+
))
|
|
6517
6532
|
},
|
|
6518
6533
|
/* @__PURE__ */ React15.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.map((user, index, array) => {
|
|
6519
|
-
const identifier = user.userId ?? user.connectionId;
|
|
6520
6534
|
return /* @__PURE__ */ React15.createElement(
|
|
6521
6535
|
StateInspectorRow,
|
|
6522
6536
|
{
|
|
@@ -6542,10 +6556,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6542
6556
|
}
|
|
6543
6557
|
}
|
|
6544
6558
|
),
|
|
6545
|
-
user.name
|
|
6546
|
-
" (",
|
|
6547
|
-
ellipsis(identifier, 8, "middle"),
|
|
6548
|
-
")"
|
|
6559
|
+
showUserDetails ? /* @__PURE__ */ React15.createElement(ObjectInspector5, { data: user, theme }) : user.name
|
|
6549
6560
|
);
|
|
6550
6561
|
}), !connectedUsers && /* @__PURE__ */ React15.createElement(
|
|
6551
6562
|
"div",
|
|
@@ -7150,6 +7161,17 @@ function parseAppDataParameter(options) {
|
|
|
7150
7161
|
return null;
|
|
7151
7162
|
}
|
|
7152
7163
|
}
|
|
7164
|
+
function applyClientIdentityFromAppData(appData) {
|
|
7165
|
+
if (appData.clientId !== void 0) {
|
|
7166
|
+
setClientId(appData.clientId);
|
|
7167
|
+
}
|
|
7168
|
+
if (appData.clientName !== void 0) {
|
|
7169
|
+
setClientName(appData.clientName);
|
|
7170
|
+
}
|
|
7171
|
+
if (appData.clientImage !== void 0) {
|
|
7172
|
+
setClientImage(appData.clientImage);
|
|
7173
|
+
}
|
|
7174
|
+
}
|
|
7153
7175
|
function getAppData(initialState, schema, options) {
|
|
7154
7176
|
const resolvedInitialState = initialState instanceof Function ? initialState() : initialState;
|
|
7155
7177
|
let appData = parseAppDataParameter(options) ?? createDefaultAppData(resolvedInitialState);
|
|
@@ -7160,6 +7182,7 @@ function getAppData(initialState, schema, options) {
|
|
|
7160
7182
|
appData.isDemo = appData.isDemo ?? false;
|
|
7161
7183
|
const fallbackAccess = appData.viewType === "editable" ? "write" : "read";
|
|
7162
7184
|
appData.access = appData.access ?? fallbackAccess;
|
|
7185
|
+
applyClientIdentityFromAppData(appData);
|
|
7163
7186
|
return appData;
|
|
7164
7187
|
}
|
|
7165
7188
|
function getSyncAdapter(params) {
|