@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.mjs
CHANGED
|
@@ -1493,7 +1493,7 @@ var require_lib2 = __commonJS({
|
|
|
1493
1493
|
export * from "@noya-app/state-manager";
|
|
1494
1494
|
|
|
1495
1495
|
// src/ai.ts
|
|
1496
|
-
import { useEffect as
|
|
1496
|
+
import { useEffect as useEffect6 } from "react";
|
|
1497
1497
|
|
|
1498
1498
|
// ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
1499
1499
|
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
@@ -4612,11 +4612,11 @@ import {
|
|
|
4612
4612
|
Observable
|
|
4613
4613
|
} from "@noya-app/observable";
|
|
4614
4614
|
import { useJsonMemo, useStableCallback } from "@noya-app/react-utils";
|
|
4615
|
-
import
|
|
4615
|
+
import React18, {
|
|
4616
4616
|
createContext,
|
|
4617
4617
|
useCallback as useCallback3,
|
|
4618
4618
|
useContext,
|
|
4619
|
-
useEffect as
|
|
4619
|
+
useEffect as useEffect5,
|
|
4620
4620
|
useMemo as useMemo4,
|
|
4621
4621
|
useState as useState4
|
|
4622
4622
|
} from "react";
|
|
@@ -4632,7 +4632,7 @@ import {
|
|
|
4632
4632
|
TypeGuard,
|
|
4633
4633
|
webSocketSync
|
|
4634
4634
|
} from "@noya-app/state-manager";
|
|
4635
|
-
import { useMemo as useMemo3, useState as useState3 } from "react";
|
|
4635
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useState as useState3 } from "react";
|
|
4636
4636
|
|
|
4637
4637
|
// src/hooks.ts
|
|
4638
4638
|
import {
|
|
@@ -4726,7 +4726,7 @@ var ErrorOverlay = React.memo(function ErrorOverlay2({
|
|
|
4726
4726
|
});
|
|
4727
4727
|
|
|
4728
4728
|
// src/inspector/useStateInspector.tsx
|
|
4729
|
-
import
|
|
4729
|
+
import React16 from "react";
|
|
4730
4730
|
import { createRoot } from "react-dom/client";
|
|
4731
4731
|
import { useIsomorphicLayoutEffect } from "@noya-app/react-utils";
|
|
4732
4732
|
|
|
@@ -4860,12 +4860,12 @@ function uuid() {
|
|
|
4860
4860
|
|
|
4861
4861
|
// src/inspector/StateInspector.tsx
|
|
4862
4862
|
import { downloadBlob, memoGeneric } from "@noya-app/react-utils";
|
|
4863
|
-
import
|
|
4863
|
+
import React15, {
|
|
4864
4864
|
useCallback,
|
|
4865
4865
|
useEffect as useEffect2,
|
|
4866
4866
|
useLayoutEffect
|
|
4867
4867
|
} from "react";
|
|
4868
|
-
import { ObjectInspector as
|
|
4868
|
+
import { ObjectInspector as ObjectInspector5 } from "react-inspector";
|
|
4869
4869
|
|
|
4870
4870
|
// src/useObservable.ts
|
|
4871
4871
|
import { useMemo, useSyncExternalStore } from "react";
|
|
@@ -5084,14 +5084,15 @@ function StateInspectorRow({
|
|
|
5084
5084
|
colorScheme,
|
|
5085
5085
|
selected,
|
|
5086
5086
|
style,
|
|
5087
|
-
variant
|
|
5087
|
+
variant,
|
|
5088
|
+
bordered = true
|
|
5088
5089
|
}) {
|
|
5089
5090
|
const solidBorderColor = colorScheme === "light" ? "rgb(223 223 223)" : "rgb(29 29 29)";
|
|
5090
5091
|
return /* @__PURE__ */ React6.createElement(
|
|
5091
5092
|
"div",
|
|
5092
5093
|
{
|
|
5093
5094
|
style: {
|
|
5094
|
-
borderBottom: `1px solid ${solidBorderColor}
|
|
5095
|
+
borderBottom: bordered ? `1px solid ${solidBorderColor}` : void 0,
|
|
5095
5096
|
fontSize: "12px",
|
|
5096
5097
|
fontFamily: "Menlo, monospace",
|
|
5097
5098
|
padding: "2px 12px 1px",
|
|
@@ -5537,6 +5538,106 @@ function HistorySection({
|
|
|
5537
5538
|
);
|
|
5538
5539
|
}
|
|
5539
5540
|
|
|
5541
|
+
// src/inspector/sections/ServerScriptLogsSection.tsx
|
|
5542
|
+
import React11 from "react";
|
|
5543
|
+
import { ObjectInspector as ObjectInspector4 } from "react-inspector";
|
|
5544
|
+
var levelColors = {
|
|
5545
|
+
error: "#f87171",
|
|
5546
|
+
warn: "#facc15",
|
|
5547
|
+
log: "#9ca3af"
|
|
5548
|
+
};
|
|
5549
|
+
function formatTimestamp(timestamp) {
|
|
5550
|
+
return new Date(timestamp).toLocaleTimeString();
|
|
5551
|
+
}
|
|
5552
|
+
function ServerScriptLogsSection({
|
|
5553
|
+
showLogs,
|
|
5554
|
+
setShowLogs,
|
|
5555
|
+
colorScheme,
|
|
5556
|
+
logs,
|
|
5557
|
+
containerRef,
|
|
5558
|
+
paused,
|
|
5559
|
+
onTogglePaused
|
|
5560
|
+
}) {
|
|
5561
|
+
const theme = getStateInspectorTheme(colorScheme);
|
|
5562
|
+
return /* @__PURE__ */ React11.createElement(
|
|
5563
|
+
StateInspectorDisclosureSection,
|
|
5564
|
+
{
|
|
5565
|
+
open: showLogs,
|
|
5566
|
+
setOpen: setShowLogs,
|
|
5567
|
+
title: "Server Script Logs",
|
|
5568
|
+
colorScheme,
|
|
5569
|
+
right: /* @__PURE__ */ React11.createElement(StateInspectorButton, { theme, onClick: onTogglePaused }, paused ? "Resume" : "Pause")
|
|
5570
|
+
},
|
|
5571
|
+
/* @__PURE__ */ React11.createElement(StateInspectorDisclosureRowInner, { ref: containerRef }, paused && /* @__PURE__ */ React11.createElement(
|
|
5572
|
+
"div",
|
|
5573
|
+
{
|
|
5574
|
+
style: {
|
|
5575
|
+
padding: "4px 12px",
|
|
5576
|
+
fontSize: "11px",
|
|
5577
|
+
opacity: 0.7
|
|
5578
|
+
}
|
|
5579
|
+
},
|
|
5580
|
+
"Log streaming paused"
|
|
5581
|
+
), logs.map((log) => /* @__PURE__ */ React11.createElement(StateInspectorRow, { key: log.id, colorScheme }, /* @__PURE__ */ React11.createElement(
|
|
5582
|
+
"div",
|
|
5583
|
+
{
|
|
5584
|
+
style: {
|
|
5585
|
+
display: "flex",
|
|
5586
|
+
gap: "6px",
|
|
5587
|
+
alignItems: "center",
|
|
5588
|
+
fontSize: "10px",
|
|
5589
|
+
color: "inherit",
|
|
5590
|
+
marginBottom: log.values.length ? "4px" : 0,
|
|
5591
|
+
textTransform: "uppercase"
|
|
5592
|
+
}
|
|
5593
|
+
},
|
|
5594
|
+
/* @__PURE__ */ React11.createElement("span", null, formatTimestamp(log.timestamp)),
|
|
5595
|
+
/* @__PURE__ */ React11.createElement("span", { style: { color: levelColors[log.level] } }, log.level),
|
|
5596
|
+
/* @__PURE__ */ React11.createElement(
|
|
5597
|
+
"span",
|
|
5598
|
+
{
|
|
5599
|
+
style: {
|
|
5600
|
+
fontFamily: "monospace",
|
|
5601
|
+
textTransform: "none",
|
|
5602
|
+
fontSize: "10px"
|
|
5603
|
+
}
|
|
5604
|
+
},
|
|
5605
|
+
log.scriptId
|
|
5606
|
+
)
|
|
5607
|
+
), /* @__PURE__ */ React11.createElement(
|
|
5608
|
+
"div",
|
|
5609
|
+
{
|
|
5610
|
+
style: {
|
|
5611
|
+
display: "flex",
|
|
5612
|
+
flexDirection: "column",
|
|
5613
|
+
gap: "4px"
|
|
5614
|
+
}
|
|
5615
|
+
},
|
|
5616
|
+
log.values.length > 0 ? log.values.map((value, index) => /* @__PURE__ */ React11.createElement(
|
|
5617
|
+
ObjectInspector4,
|
|
5618
|
+
{
|
|
5619
|
+
key: index,
|
|
5620
|
+
data: value,
|
|
5621
|
+
theme,
|
|
5622
|
+
expandLevel: 3
|
|
5623
|
+
}
|
|
5624
|
+
)) : /* @__PURE__ */ React11.createElement("span", { style: { fontSize: "11px", opacity: 0.7 } }, "No data")
|
|
5625
|
+
))), !logs?.length && /* @__PURE__ */ React11.createElement(
|
|
5626
|
+
"div",
|
|
5627
|
+
{
|
|
5628
|
+
style: {
|
|
5629
|
+
padding: "12px",
|
|
5630
|
+
fontSize: "12px",
|
|
5631
|
+
display: "flex",
|
|
5632
|
+
flexDirection: "column",
|
|
5633
|
+
gap: "4px"
|
|
5634
|
+
}
|
|
5635
|
+
},
|
|
5636
|
+
/* @__PURE__ */ React11.createElement("span", null, "No logs received")
|
|
5637
|
+
))
|
|
5638
|
+
);
|
|
5639
|
+
}
|
|
5640
|
+
|
|
5540
5641
|
// src/inspector/serialization.ts
|
|
5541
5642
|
import { createHash } from "@noya-app/state-manager";
|
|
5542
5643
|
|
|
@@ -6085,15 +6186,15 @@ function replaceDeep(obj, replacementMap) {
|
|
|
6085
6186
|
}
|
|
6086
6187
|
|
|
6087
6188
|
// src/inspector/StateInspectorTitleLabel.tsx
|
|
6088
|
-
import
|
|
6189
|
+
import React12 from "react";
|
|
6089
6190
|
function StateInspectorTitleLabel({
|
|
6090
6191
|
children
|
|
6091
6192
|
}) {
|
|
6092
|
-
return /* @__PURE__ */
|
|
6193
|
+
return /* @__PURE__ */ React12.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
|
|
6093
6194
|
}
|
|
6094
6195
|
|
|
6095
6196
|
// src/inspector/StateInspectorToggleButton.tsx
|
|
6096
|
-
import
|
|
6197
|
+
import React13 from "react";
|
|
6097
6198
|
function StateInspectorToggleButton({
|
|
6098
6199
|
showInspector,
|
|
6099
6200
|
setShowInspector,
|
|
@@ -6101,7 +6202,7 @@ function StateInspectorToggleButton({
|
|
|
6101
6202
|
anchor
|
|
6102
6203
|
}) {
|
|
6103
6204
|
const isRightAnchor = anchor === "right";
|
|
6104
|
-
const rightIcon = /* @__PURE__ */
|
|
6205
|
+
const rightIcon = /* @__PURE__ */ React13.createElement(
|
|
6105
6206
|
"svg",
|
|
6106
6207
|
{
|
|
6107
6208
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6111,7 +6212,7 @@ function StateInspectorToggleButton({
|
|
|
6111
6212
|
stroke: "currentColor",
|
|
6112
6213
|
className: "size-6"
|
|
6113
6214
|
},
|
|
6114
|
-
/* @__PURE__ */
|
|
6215
|
+
/* @__PURE__ */ React13.createElement(
|
|
6115
6216
|
"path",
|
|
6116
6217
|
{
|
|
6117
6218
|
strokeLinecap: "round",
|
|
@@ -6120,7 +6221,7 @@ function StateInspectorToggleButton({
|
|
|
6120
6221
|
}
|
|
6121
6222
|
)
|
|
6122
6223
|
);
|
|
6123
|
-
const leftIcon = /* @__PURE__ */
|
|
6224
|
+
const leftIcon = /* @__PURE__ */ React13.createElement(
|
|
6124
6225
|
"svg",
|
|
6125
6226
|
{
|
|
6126
6227
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6130,7 +6231,7 @@ function StateInspectorToggleButton({
|
|
|
6130
6231
|
stroke: "currentColor",
|
|
6131
6232
|
className: "size-6"
|
|
6132
6233
|
},
|
|
6133
|
-
/* @__PURE__ */
|
|
6234
|
+
/* @__PURE__ */ React13.createElement(
|
|
6134
6235
|
"path",
|
|
6135
6236
|
{
|
|
6136
6237
|
strokeLinecap: "round",
|
|
@@ -6139,7 +6240,7 @@ function StateInspectorToggleButton({
|
|
|
6139
6240
|
}
|
|
6140
6241
|
)
|
|
6141
6242
|
);
|
|
6142
|
-
return /* @__PURE__ */
|
|
6243
|
+
return /* @__PURE__ */ React13.createElement(
|
|
6143
6244
|
"span",
|
|
6144
6245
|
{
|
|
6145
6246
|
role: "button",
|
|
@@ -6160,15 +6261,15 @@ function StateInspectorToggleButton({
|
|
|
6160
6261
|
setShowInspector(!showInspector);
|
|
6161
6262
|
}
|
|
6162
6263
|
},
|
|
6163
|
-
showInspector ? "Hide Inspector" : /* @__PURE__ */
|
|
6264
|
+
showInspector ? "Hide Inspector" : /* @__PURE__ */ React13.createElement("span", { style: { width: "12px", height: "12px" } }, isRightAnchor ? rightIcon : leftIcon)
|
|
6164
6265
|
);
|
|
6165
6266
|
}
|
|
6166
6267
|
|
|
6167
6268
|
// src/inspector/useLocalStorageState.tsx
|
|
6168
|
-
import
|
|
6269
|
+
import React14 from "react";
|
|
6169
6270
|
var localStorage = typeof window !== "undefined" ? window.localStorage : null;
|
|
6170
6271
|
function useLocalStorageState(key, defaultValue) {
|
|
6171
|
-
const [state, setState] =
|
|
6272
|
+
const [state, setState] = React14.useState(() => {
|
|
6172
6273
|
const value = localStorage?.getItem(key);
|
|
6173
6274
|
let result = defaultValue;
|
|
6174
6275
|
if (value) {
|
|
@@ -6193,29 +6294,32 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6193
6294
|
colorScheme = "light",
|
|
6194
6295
|
anchor = "right",
|
|
6195
6296
|
unstyled = false,
|
|
6297
|
+
advanced = false,
|
|
6196
6298
|
...props
|
|
6197
6299
|
}) {
|
|
6198
6300
|
const {
|
|
6199
6301
|
multiplayerStateManager,
|
|
6200
6302
|
assetManager,
|
|
6201
|
-
|
|
6303
|
+
userManager,
|
|
6202
6304
|
secretManager,
|
|
6203
|
-
|
|
6305
|
+
sharedConnectionDataManager,
|
|
6204
6306
|
connectionEventManager,
|
|
6205
6307
|
taskManager,
|
|
6206
6308
|
ioManager,
|
|
6207
6309
|
resourceManager,
|
|
6208
|
-
activityEventsManager
|
|
6310
|
+
activityEventsManager,
|
|
6311
|
+
logManager
|
|
6209
6312
|
} = noyaManager;
|
|
6210
|
-
const [didMount, setDidMount] =
|
|
6313
|
+
const [didMount, setDidMount] = React15.useState(false);
|
|
6211
6314
|
const tasks = useObservable(taskManager.tasks$);
|
|
6212
6315
|
const inputs = useObservable(ioManager.inputs$);
|
|
6213
6316
|
const outputTransforms = useObservable(ioManager.outputTransforms$);
|
|
6214
6317
|
useLayoutEffect(() => {
|
|
6215
6318
|
setDidMount(true);
|
|
6216
6319
|
}, []);
|
|
6217
|
-
const eventsContainerRef =
|
|
6218
|
-
const activityEventsContainerRef =
|
|
6320
|
+
const eventsContainerRef = React15.useRef(null);
|
|
6321
|
+
const activityEventsContainerRef = React15.useRef(null);
|
|
6322
|
+
const serverLogsContainerRef = React15.useRef(null);
|
|
6219
6323
|
const [showInspector, setShowInspector] = useLocalStorageState(
|
|
6220
6324
|
"noya-multiplayer-react-show-inspector",
|
|
6221
6325
|
true
|
|
@@ -6240,8 +6344,8 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6240
6344
|
"noya-multiplayer-react-show-tasks",
|
|
6241
6345
|
false
|
|
6242
6346
|
);
|
|
6243
|
-
const [
|
|
6244
|
-
"noya-multiplayer-react-show-
|
|
6347
|
+
const [showShared, setShowShared] = useLocalStorageState(
|
|
6348
|
+
"noya-multiplayer-react-show-shared",
|
|
6245
6349
|
false
|
|
6246
6350
|
);
|
|
6247
6351
|
const [showAssets, setShowAssets] = useLocalStorageState(
|
|
@@ -6268,16 +6372,43 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6268
6372
|
"noya-multiplayer-react-show-activity-events",
|
|
6269
6373
|
false
|
|
6270
6374
|
);
|
|
6375
|
+
const [showServerLogs, setShowServerLogs] = useLocalStorageState(
|
|
6376
|
+
"noya-multiplayer-react-show-server-logs",
|
|
6377
|
+
false
|
|
6378
|
+
);
|
|
6271
6379
|
const connectionEvents = useObservable(connectionEventManager.events$);
|
|
6272
6380
|
useEffect2(() => {
|
|
6273
6381
|
if (eventsContainerRef.current) {
|
|
6274
6382
|
eventsContainerRef.current.scrollTop = eventsContainerRef.current.scrollHeight;
|
|
6275
6383
|
}
|
|
6276
6384
|
}, [connectionEvents]);
|
|
6385
|
+
const serverLogs = useObservable(logManager.logs$);
|
|
6386
|
+
const [serverLogsPaused, setServerLogsPaused] = React15.useState(false);
|
|
6387
|
+
const [visibleServerLogs, setVisibleServerLogs] = React15.useState(
|
|
6388
|
+
serverLogs ?? []
|
|
6389
|
+
);
|
|
6390
|
+
const toggleServerLogsPaused = useCallback(() => {
|
|
6391
|
+
setServerLogsPaused((value) => {
|
|
6392
|
+
if (!value) {
|
|
6393
|
+
setVisibleServerLogs(serverLogs ?? []);
|
|
6394
|
+
}
|
|
6395
|
+
return !value;
|
|
6396
|
+
});
|
|
6397
|
+
}, [serverLogs]);
|
|
6398
|
+
useEffect2(() => {
|
|
6399
|
+
if (serverLogsPaused) return;
|
|
6400
|
+
setVisibleServerLogs(serverLogs ?? []);
|
|
6401
|
+
}, [serverLogs, serverLogsPaused]);
|
|
6402
|
+
useEffect2(() => {
|
|
6403
|
+
if (!showServerLogs) return;
|
|
6404
|
+
if (serverLogsContainerRef.current) {
|
|
6405
|
+
serverLogsContainerRef.current.scrollTop = serverLogsContainerRef.current.scrollHeight;
|
|
6406
|
+
}
|
|
6407
|
+
}, [showServerLogs, visibleServerLogs]);
|
|
6277
6408
|
const multipeerStateInitialized = useObservable(
|
|
6278
6409
|
multiplayerStateManager.isInitialized$
|
|
6279
6410
|
);
|
|
6280
|
-
const
|
|
6411
|
+
const shared = useObservable(sharedConnectionDataManager.data$);
|
|
6281
6412
|
const historySnapshot = useManagedHistory(multiplayerStateManager.sm);
|
|
6282
6413
|
const assets = useObservable(assetManager.assets$);
|
|
6283
6414
|
const resources = useObservable(resourceManager.resources$);
|
|
@@ -6285,8 +6416,8 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6285
6416
|
const assetsInitialized = useObservable(assetManager.isInitialized$);
|
|
6286
6417
|
const secrets = useObservable(secretManager.secrets$);
|
|
6287
6418
|
const secretsInitialized = useObservable(secretManager.isInitialized$);
|
|
6288
|
-
const connectedUsers = useObservable(
|
|
6289
|
-
const
|
|
6419
|
+
const connectedUsers = useObservable(userManager.connectedUsers$);
|
|
6420
|
+
const connectionId = useObservable(userManager.currentConnectionId$);
|
|
6290
6421
|
const state = useObservable(multiplayerStateManager.optimisticState$);
|
|
6291
6422
|
const inputsInitialized = useObservable(ioManager.inputsInitialized$);
|
|
6292
6423
|
const outputTransformsInitialized = useObservable(
|
|
@@ -6330,7 +6461,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6330
6461
|
}, [noyaManager]);
|
|
6331
6462
|
if (!didMount) return null;
|
|
6332
6463
|
if (!showInspector) {
|
|
6333
|
-
return /* @__PURE__ */
|
|
6464
|
+
return /* @__PURE__ */ React15.createElement(
|
|
6334
6465
|
"div",
|
|
6335
6466
|
{
|
|
6336
6467
|
...props,
|
|
@@ -6342,7 +6473,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6342
6473
|
},
|
|
6343
6474
|
onClick: () => setShowInspector(true)
|
|
6344
6475
|
},
|
|
6345
|
-
/* @__PURE__ */
|
|
6476
|
+
/* @__PURE__ */ React15.createElement(
|
|
6346
6477
|
StateInspectorToggleButton,
|
|
6347
6478
|
{
|
|
6348
6479
|
showInspector,
|
|
@@ -6353,7 +6484,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6353
6484
|
)
|
|
6354
6485
|
);
|
|
6355
6486
|
}
|
|
6356
|
-
return /* @__PURE__ */
|
|
6487
|
+
return /* @__PURE__ */ React15.createElement(
|
|
6357
6488
|
"div",
|
|
6358
6489
|
{
|
|
6359
6490
|
...props,
|
|
@@ -6362,7 +6493,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6362
6493
|
...props.style
|
|
6363
6494
|
}
|
|
6364
6495
|
},
|
|
6365
|
-
/* @__PURE__ */
|
|
6496
|
+
/* @__PURE__ */ React15.createElement(
|
|
6366
6497
|
StateInspectorDisclosureSection,
|
|
6367
6498
|
{
|
|
6368
6499
|
isFirst: true,
|
|
@@ -6374,7 +6505,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6374
6505
|
flex: "0 0 auto",
|
|
6375
6506
|
maxHeight: "200px"
|
|
6376
6507
|
},
|
|
6377
|
-
right: /* @__PURE__ */
|
|
6508
|
+
right: /* @__PURE__ */ React15.createElement(
|
|
6378
6509
|
StateInspectorToggleButton,
|
|
6379
6510
|
{
|
|
6380
6511
|
showInspector,
|
|
@@ -6384,35 +6515,39 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6384
6515
|
}
|
|
6385
6516
|
)
|
|
6386
6517
|
},
|
|
6387
|
-
/* @__PURE__ */
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
colorScheme,
|
|
6392
|
-
variant: user.id === userId ? "up" : void 0
|
|
6393
|
-
},
|
|
6394
|
-
user.image && /* @__PURE__ */ React14.createElement(
|
|
6395
|
-
"img",
|
|
6518
|
+
/* @__PURE__ */ React15.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.map((user, index, array) => {
|
|
6519
|
+
const identifier = user.userId ?? user.connectionId;
|
|
6520
|
+
return /* @__PURE__ */ React15.createElement(
|
|
6521
|
+
StateInspectorRow,
|
|
6396
6522
|
{
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6523
|
+
key: user.connectionId,
|
|
6524
|
+
colorScheme,
|
|
6525
|
+
variant: user.connectionId === connectionId ? "up" : void 0,
|
|
6526
|
+
bordered: index !== array.length - 1
|
|
6527
|
+
},
|
|
6528
|
+
user.image && /* @__PURE__ */ React15.createElement(
|
|
6529
|
+
"img",
|
|
6530
|
+
{
|
|
6531
|
+
src: user.image,
|
|
6532
|
+
alt: user.name,
|
|
6533
|
+
style: {
|
|
6534
|
+
width: "13px",
|
|
6535
|
+
height: "13px",
|
|
6536
|
+
borderRadius: "50%",
|
|
6537
|
+
marginRight: "4px",
|
|
6538
|
+
display: "inline-block",
|
|
6539
|
+
position: "relative",
|
|
6540
|
+
background: solidBorderColor,
|
|
6541
|
+
verticalAlign: "middle"
|
|
6542
|
+
}
|
|
6408
6543
|
}
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
)
|
|
6544
|
+
),
|
|
6545
|
+
user.name,
|
|
6546
|
+
" (",
|
|
6547
|
+
ellipsis(identifier, 8, "middle"),
|
|
6548
|
+
")"
|
|
6549
|
+
);
|
|
6550
|
+
}), !connectedUsers && /* @__PURE__ */ React15.createElement(
|
|
6416
6551
|
"div",
|
|
6417
6552
|
{
|
|
6418
6553
|
style: {
|
|
@@ -6423,13 +6558,13 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6423
6558
|
gap: "4px"
|
|
6424
6559
|
}
|
|
6425
6560
|
},
|
|
6426
|
-
/* @__PURE__ */
|
|
6561
|
+
/* @__PURE__ */ React15.createElement("span", null, "No connected users")
|
|
6427
6562
|
))
|
|
6428
6563
|
),
|
|
6429
|
-
/* @__PURE__ */
|
|
6564
|
+
/* @__PURE__ */ React15.createElement(
|
|
6430
6565
|
StateInspectorDisclosureSection,
|
|
6431
6566
|
{
|
|
6432
|
-
title: /* @__PURE__ */
|
|
6567
|
+
title: /* @__PURE__ */ React15.createElement(StateInspectorTitleLabel, null, "Data", /* @__PURE__ */ React15.createElement(
|
|
6433
6568
|
ColoredDot,
|
|
6434
6569
|
{
|
|
6435
6570
|
type: multipeerStateInitialized ? "success" : "error"
|
|
@@ -6438,7 +6573,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6438
6573
|
colorScheme,
|
|
6439
6574
|
setOpen: setShowData,
|
|
6440
6575
|
open: showData,
|
|
6441
|
-
right: /* @__PURE__ */
|
|
6576
|
+
right: /* @__PURE__ */ React15.createElement(
|
|
6442
6577
|
"span",
|
|
6443
6578
|
{
|
|
6444
6579
|
style: {
|
|
@@ -6446,9 +6581,9 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6446
6581
|
gap: "12px"
|
|
6447
6582
|
}
|
|
6448
6583
|
},
|
|
6449
|
-
/* @__PURE__ */
|
|
6450
|
-
/* @__PURE__ */
|
|
6451
|
-
/* @__PURE__ */
|
|
6584
|
+
/* @__PURE__ */ React15.createElement(StateInspectorButton, { theme, onClick: handleImportAll }, "Import"),
|
|
6585
|
+
/* @__PURE__ */ React15.createElement(StateInspectorButton, { theme, onClick: handleExportAll }, "Export"),
|
|
6586
|
+
/* @__PURE__ */ React15.createElement(
|
|
6452
6587
|
StateInspectorButton,
|
|
6453
6588
|
{
|
|
6454
6589
|
theme,
|
|
@@ -6460,15 +6595,15 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6460
6595
|
)
|
|
6461
6596
|
)
|
|
6462
6597
|
},
|
|
6463
|
-
/* @__PURE__ */
|
|
6464
|
-
|
|
6598
|
+
/* @__PURE__ */ React15.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React15.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React15.createElement(
|
|
6599
|
+
ObjectInspector5,
|
|
6465
6600
|
{
|
|
6466
6601
|
name: multiplayerStateManager.schema ? "state" : void 0,
|
|
6467
6602
|
data: state,
|
|
6468
6603
|
theme
|
|
6469
6604
|
}
|
|
6470
|
-
)), multiplayerStateManager.schema && /* @__PURE__ */
|
|
6471
|
-
|
|
6605
|
+
)), multiplayerStateManager.schema && /* @__PURE__ */ React15.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React15.createElement(
|
|
6606
|
+
ObjectInspector5,
|
|
6472
6607
|
{
|
|
6473
6608
|
name: "schema",
|
|
6474
6609
|
data: multiplayerStateManager.schema,
|
|
@@ -6476,7 +6611,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6476
6611
|
}
|
|
6477
6612
|
)))
|
|
6478
6613
|
),
|
|
6479
|
-
/* @__PURE__ */
|
|
6614
|
+
/* @__PURE__ */ React15.createElement(
|
|
6480
6615
|
HistorySection,
|
|
6481
6616
|
{
|
|
6482
6617
|
showHistory,
|
|
@@ -6486,14 +6621,14 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6486
6621
|
multiplayerStateManager
|
|
6487
6622
|
}
|
|
6488
6623
|
),
|
|
6489
|
-
/* @__PURE__ */
|
|
6624
|
+
/* @__PURE__ */ React15.createElement(
|
|
6490
6625
|
StateInspectorDisclosureSection,
|
|
6491
6626
|
{
|
|
6492
6627
|
open: showAssets,
|
|
6493
6628
|
setOpen: setShowAssets,
|
|
6494
|
-
title: /* @__PURE__ */
|
|
6629
|
+
title: /* @__PURE__ */ React15.createElement(StateInspectorTitleLabel, null, "Assets (", assets.length, ")", /* @__PURE__ */ React15.createElement(ColoredDot, { type: assetsInitialized ? "success" : "error" })),
|
|
6495
6630
|
colorScheme,
|
|
6496
|
-
right: /* @__PURE__ */
|
|
6631
|
+
right: /* @__PURE__ */ React15.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React15.createElement(
|
|
6497
6632
|
StateInspectorButton,
|
|
6498
6633
|
{
|
|
6499
6634
|
theme,
|
|
@@ -6508,7 +6643,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6508
6643
|
}
|
|
6509
6644
|
},
|
|
6510
6645
|
"Delete all"
|
|
6511
|
-
), /* @__PURE__ */
|
|
6646
|
+
), /* @__PURE__ */ React15.createElement(
|
|
6512
6647
|
StateInspectorButton,
|
|
6513
6648
|
{
|
|
6514
6649
|
theme,
|
|
@@ -6521,7 +6656,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6521
6656
|
}
|
|
6522
6657
|
},
|
|
6523
6658
|
"Reload"
|
|
6524
|
-
), /* @__PURE__ */
|
|
6659
|
+
), /* @__PURE__ */ React15.createElement(
|
|
6525
6660
|
StateInspectorButton,
|
|
6526
6661
|
{
|
|
6527
6662
|
theme,
|
|
@@ -6545,14 +6680,14 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6545
6680
|
"Upload"
|
|
6546
6681
|
))
|
|
6547
6682
|
},
|
|
6548
|
-
/* @__PURE__ */
|
|
6549
|
-
|
|
6683
|
+
/* @__PURE__ */ React15.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ React15.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ React15.createElement(
|
|
6684
|
+
ObjectInspector5,
|
|
6550
6685
|
{
|
|
6551
6686
|
name: asset.id,
|
|
6552
6687
|
data: truncateAsset(asset),
|
|
6553
6688
|
theme
|
|
6554
6689
|
}
|
|
6555
|
-
), /* @__PURE__ */
|
|
6690
|
+
), /* @__PURE__ */ React15.createElement(
|
|
6556
6691
|
StateInspectorButton,
|
|
6557
6692
|
{
|
|
6558
6693
|
theme,
|
|
@@ -6561,14 +6696,14 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6561
6696
|
"Delete"
|
|
6562
6697
|
))))
|
|
6563
6698
|
),
|
|
6564
|
-
/* @__PURE__ */
|
|
6699
|
+
advanced && /* @__PURE__ */ React15.createElement(
|
|
6565
6700
|
StateInspectorDisclosureSection,
|
|
6566
6701
|
{
|
|
6567
|
-
title: /* @__PURE__ */
|
|
6702
|
+
title: /* @__PURE__ */ React15.createElement(StateInspectorTitleLabel, null, "Resources (", resources.length, ")", /* @__PURE__ */ React15.createElement(ColoredDot, { type: resourcesInitialized ? "success" : "error" })),
|
|
6568
6703
|
colorScheme,
|
|
6569
6704
|
open: showResources,
|
|
6570
6705
|
setOpen: setShowResources,
|
|
6571
|
-
right: /* @__PURE__ */
|
|
6706
|
+
right: /* @__PURE__ */ React15.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React15.createElement(
|
|
6572
6707
|
StateInspectorButton,
|
|
6573
6708
|
{
|
|
6574
6709
|
theme,
|
|
@@ -6583,7 +6718,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6583
6718
|
}
|
|
6584
6719
|
},
|
|
6585
6720
|
"Delete all"
|
|
6586
|
-
), /* @__PURE__ */
|
|
6721
|
+
), /* @__PURE__ */ React15.createElement(
|
|
6587
6722
|
StateInspectorButton,
|
|
6588
6723
|
{
|
|
6589
6724
|
theme,
|
|
@@ -6596,7 +6731,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6596
6731
|
}
|
|
6597
6732
|
},
|
|
6598
6733
|
"Create Directory"
|
|
6599
|
-
), /* @__PURE__ */
|
|
6734
|
+
), /* @__PURE__ */ React15.createElement(
|
|
6600
6735
|
StateInspectorButton,
|
|
6601
6736
|
{
|
|
6602
6737
|
theme,
|
|
@@ -6616,21 +6751,21 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6616
6751
|
"Create Asset"
|
|
6617
6752
|
))
|
|
6618
6753
|
},
|
|
6619
|
-
/* @__PURE__ */
|
|
6620
|
-
|
|
6754
|
+
/* @__PURE__ */ React15.createElement(StateInspectorDisclosureRowInner, null, resources?.map((resource) => /* @__PURE__ */ React15.createElement(StateInspectorRow, { key: resource.id, colorScheme }, /* @__PURE__ */ React15.createElement(
|
|
6755
|
+
ObjectInspector5,
|
|
6621
6756
|
{
|
|
6622
6757
|
name: resource.path,
|
|
6623
6758
|
data: resource,
|
|
6624
6759
|
theme
|
|
6625
6760
|
}
|
|
6626
|
-
), /* @__PURE__ */
|
|
6761
|
+
), /* @__PURE__ */ React15.createElement("div", { style: { display: "flex", gap: "4px" } }, /* @__PURE__ */ React15.createElement(
|
|
6627
6762
|
StateInspectorButton,
|
|
6628
6763
|
{
|
|
6629
6764
|
theme,
|
|
6630
6765
|
onClick: () => resourceManager.deleteResource({ id: resource.id })
|
|
6631
6766
|
},
|
|
6632
6767
|
"Delete"
|
|
6633
|
-
), /* @__PURE__ */
|
|
6768
|
+
), /* @__PURE__ */ React15.createElement(
|
|
6634
6769
|
StateInspectorButton,
|
|
6635
6770
|
{
|
|
6636
6771
|
theme,
|
|
@@ -6643,14 +6778,14 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6643
6778
|
"Rename"
|
|
6644
6779
|
)))))
|
|
6645
6780
|
),
|
|
6646
|
-
/* @__PURE__ */
|
|
6781
|
+
advanced && /* @__PURE__ */ React15.createElement(
|
|
6647
6782
|
StateInspectorDisclosureSection,
|
|
6648
6783
|
{
|
|
6649
|
-
title: /* @__PURE__ */
|
|
6784
|
+
title: /* @__PURE__ */ React15.createElement(StateInspectorTitleLabel, null, "Secrets", /* @__PURE__ */ React15.createElement(ColoredDot, { type: secretsInitialized ? "success" : "error" })),
|
|
6650
6785
|
colorScheme,
|
|
6651
6786
|
open: showSecrets,
|
|
6652
6787
|
setOpen: setShowSecrets,
|
|
6653
|
-
right: /* @__PURE__ */
|
|
6788
|
+
right: /* @__PURE__ */ React15.createElement(
|
|
6654
6789
|
StateInspectorButton,
|
|
6655
6790
|
{
|
|
6656
6791
|
theme,
|
|
@@ -6665,7 +6800,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6665
6800
|
"Create"
|
|
6666
6801
|
)
|
|
6667
6802
|
},
|
|
6668
|
-
/* @__PURE__ */
|
|
6803
|
+
/* @__PURE__ */ React15.createElement(StateInspectorDisclosureRowInner, null, secrets.map((secret) => /* @__PURE__ */ React15.createElement(StateInspectorRow, { key: secret.id, colorScheme }, /* @__PURE__ */ React15.createElement(ObjectInspector5, { data: secret, theme }), /* @__PURE__ */ React15.createElement(
|
|
6669
6804
|
StateInspectorButton,
|
|
6670
6805
|
{
|
|
6671
6806
|
theme,
|
|
@@ -6674,16 +6809,15 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6674
6809
|
"Delete"
|
|
6675
6810
|
))))
|
|
6676
6811
|
),
|
|
6677
|
-
|
|
6678
|
-
/* @__PURE__ */ React14.createElement(
|
|
6812
|
+
advanced && /* @__PURE__ */ React15.createElement(
|
|
6679
6813
|
StateInspectorDisclosureSection,
|
|
6680
6814
|
{
|
|
6681
6815
|
open: showInputs,
|
|
6682
6816
|
setOpen: setShowInputs,
|
|
6683
|
-
title: /* @__PURE__ */
|
|
6817
|
+
title: /* @__PURE__ */ React15.createElement(StateInspectorTitleLabel, null, "Inputs", /* @__PURE__ */ React15.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
|
|
6684
6818
|
colorScheme
|
|
6685
6819
|
},
|
|
6686
|
-
/* @__PURE__ */
|
|
6820
|
+
/* @__PURE__ */ React15.createElement(StateInspectorDisclosureRowInner, null, inputs?.map((input) => /* @__PURE__ */ React15.createElement(StateInspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ React15.createElement(ObjectInspector5, { data: input, theme }))), !inputs?.length && /* @__PURE__ */ React15.createElement(
|
|
6687
6821
|
"div",
|
|
6688
6822
|
{
|
|
6689
6823
|
style: {
|
|
@@ -6694,15 +6828,15 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6694
6828
|
gap: "4px"
|
|
6695
6829
|
}
|
|
6696
6830
|
},
|
|
6697
|
-
/* @__PURE__ */
|
|
6831
|
+
/* @__PURE__ */ React15.createElement("span", null, "No inputs")
|
|
6698
6832
|
))
|
|
6699
6833
|
),
|
|
6700
|
-
/* @__PURE__ */
|
|
6834
|
+
advanced && /* @__PURE__ */ React15.createElement(
|
|
6701
6835
|
StateInspectorDisclosureSection,
|
|
6702
6836
|
{
|
|
6703
6837
|
open: showOutputTransforms,
|
|
6704
6838
|
setOpen: setShowOutputTransforms,
|
|
6705
|
-
title: /* @__PURE__ */
|
|
6839
|
+
title: /* @__PURE__ */ React15.createElement(StateInspectorTitleLabel, null, "Output Transforms", /* @__PURE__ */ React15.createElement(
|
|
6706
6840
|
ColoredDot,
|
|
6707
6841
|
{
|
|
6708
6842
|
type: outputTransformsInitialized ? "success" : "error"
|
|
@@ -6710,7 +6844,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6710
6844
|
)),
|
|
6711
6845
|
colorScheme
|
|
6712
6846
|
},
|
|
6713
|
-
/* @__PURE__ */
|
|
6847
|
+
/* @__PURE__ */ React15.createElement(StateInspectorDisclosureRowInner, null, outputTransforms?.map((transform) => /* @__PURE__ */ React15.createElement(StateInspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ React15.createElement(ObjectInspector5, { data: transform, theme }))), !outputTransforms?.length && /* @__PURE__ */ React15.createElement(
|
|
6714
6848
|
"div",
|
|
6715
6849
|
{
|
|
6716
6850
|
style: {
|
|
@@ -6721,10 +6855,10 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6721
6855
|
gap: "4px"
|
|
6722
6856
|
}
|
|
6723
6857
|
},
|
|
6724
|
-
/* @__PURE__ */
|
|
6858
|
+
/* @__PURE__ */ React15.createElement("span", null, "No output transforms")
|
|
6725
6859
|
))
|
|
6726
6860
|
),
|
|
6727
|
-
/* @__PURE__ */
|
|
6861
|
+
advanced && /* @__PURE__ */ React15.createElement(
|
|
6728
6862
|
StateInspectorDisclosureSection,
|
|
6729
6863
|
{
|
|
6730
6864
|
title: "Tasks",
|
|
@@ -6732,7 +6866,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6732
6866
|
open: showTasks,
|
|
6733
6867
|
setOpen: setShowTasks
|
|
6734
6868
|
},
|
|
6735
|
-
/* @__PURE__ */
|
|
6869
|
+
/* @__PURE__ */ React15.createElement(StateInspectorDisclosureRowInner, null, tasks?.map((task) => /* @__PURE__ */ React15.createElement(
|
|
6736
6870
|
StateInspectorRow,
|
|
6737
6871
|
{
|
|
6738
6872
|
key: task.id,
|
|
@@ -6741,8 +6875,8 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6741
6875
|
backgroundColor: task.status === "done" ? "rgba(0,255,0,0.2)" : task.status === "error" ? "rgba(255,0,0,0.2)" : void 0
|
|
6742
6876
|
}
|
|
6743
6877
|
},
|
|
6744
|
-
/* @__PURE__ */
|
|
6745
|
-
|
|
6878
|
+
/* @__PURE__ */ React15.createElement(
|
|
6879
|
+
ObjectInspector5,
|
|
6746
6880
|
{
|
|
6747
6881
|
name: task.name,
|
|
6748
6882
|
data: task.payload,
|
|
@@ -6751,16 +6885,16 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6751
6885
|
)
|
|
6752
6886
|
)))
|
|
6753
6887
|
),
|
|
6754
|
-
/* @__PURE__ */
|
|
6888
|
+
/* @__PURE__ */ React15.createElement(
|
|
6755
6889
|
StateInspectorDisclosureSection,
|
|
6756
6890
|
{
|
|
6757
|
-
open:
|
|
6758
|
-
setOpen:
|
|
6759
|
-
title: "
|
|
6891
|
+
open: showShared,
|
|
6892
|
+
setOpen: setShowShared,
|
|
6893
|
+
title: "Shared Connection Data",
|
|
6760
6894
|
colorScheme
|
|
6761
6895
|
},
|
|
6762
|
-
/* @__PURE__ */
|
|
6763
|
-
|
|
6896
|
+
/* @__PURE__ */ React15.createElement(StateInspectorDisclosureRowInner, null, Object.entries(shared).map(([key, value]) => /* @__PURE__ */ React15.createElement(StateInspectorRow, { key, colorScheme }, /* @__PURE__ */ React15.createElement(
|
|
6897
|
+
ObjectInspector5,
|
|
6764
6898
|
{
|
|
6765
6899
|
name: key,
|
|
6766
6900
|
data: value,
|
|
@@ -6769,7 +6903,19 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6769
6903
|
}
|
|
6770
6904
|
))))
|
|
6771
6905
|
),
|
|
6772
|
-
/* @__PURE__ */
|
|
6906
|
+
/* @__PURE__ */ React15.createElement(
|
|
6907
|
+
ServerScriptLogsSection,
|
|
6908
|
+
{
|
|
6909
|
+
colorScheme,
|
|
6910
|
+
showLogs: showServerLogs,
|
|
6911
|
+
setShowLogs: setShowServerLogs,
|
|
6912
|
+
logs: visibleServerLogs,
|
|
6913
|
+
paused: serverLogsPaused,
|
|
6914
|
+
onTogglePaused: toggleServerLogsPaused,
|
|
6915
|
+
containerRef: serverLogsContainerRef
|
|
6916
|
+
}
|
|
6917
|
+
),
|
|
6918
|
+
advanced && /* @__PURE__ */ React15.createElement(
|
|
6773
6919
|
ActivityEventsSection,
|
|
6774
6920
|
{
|
|
6775
6921
|
colorScheme,
|
|
@@ -6779,7 +6925,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6779
6925
|
activityEventsManager
|
|
6780
6926
|
}
|
|
6781
6927
|
),
|
|
6782
|
-
/* @__PURE__ */
|
|
6928
|
+
/* @__PURE__ */ React15.createElement(
|
|
6783
6929
|
EventsSection,
|
|
6784
6930
|
{
|
|
6785
6931
|
connectionEvents,
|
|
@@ -6821,10 +6967,11 @@ function createStateInspectorRoot() {
|
|
|
6821
6967
|
function useStateInspector({
|
|
6822
6968
|
noyaManager,
|
|
6823
6969
|
disabled = false,
|
|
6970
|
+
advanced = false,
|
|
6824
6971
|
colorScheme,
|
|
6825
6972
|
anchor
|
|
6826
6973
|
}) {
|
|
6827
|
-
const [root, setRoot] =
|
|
6974
|
+
const [root, setRoot] = React16.useState(null);
|
|
6828
6975
|
useIsomorphicLayoutEffect(() => {
|
|
6829
6976
|
if (disabled) return;
|
|
6830
6977
|
const { root: root2, unmount } = createStateInspectorRoot();
|
|
@@ -6834,16 +6981,17 @@ function useStateInspector({
|
|
|
6834
6981
|
useIsomorphicLayoutEffect(() => {
|
|
6835
6982
|
if (!root) return;
|
|
6836
6983
|
root.render(
|
|
6837
|
-
/* @__PURE__ */
|
|
6984
|
+
/* @__PURE__ */ React16.createElement(
|
|
6838
6985
|
StateInspector,
|
|
6839
6986
|
{
|
|
6840
6987
|
colorScheme,
|
|
6841
6988
|
anchor,
|
|
6842
|
-
noyaManager
|
|
6989
|
+
noyaManager,
|
|
6990
|
+
advanced
|
|
6843
6991
|
}
|
|
6844
6992
|
)
|
|
6845
6993
|
);
|
|
6846
|
-
}, [noyaManager, anchor, colorScheme, root]);
|
|
6994
|
+
}, [noyaManager, anchor, colorScheme, root, advanced]);
|
|
6847
6995
|
}
|
|
6848
6996
|
|
|
6849
6997
|
// src/hooks.ts
|
|
@@ -6911,8 +7059,8 @@ function useBindNoyaManager(noyaManager, options) {
|
|
|
6911
7059
|
noyaManager,
|
|
6912
7060
|
taskManager: noyaManager.taskManager,
|
|
6913
7061
|
connectionEventManager: noyaManager.connectionEventManager,
|
|
6914
|
-
|
|
6915
|
-
|
|
7062
|
+
userManager: noyaManager.userManager,
|
|
7063
|
+
sharedConnectionDataManager: noyaManager.sharedConnectionDataManager,
|
|
6916
7064
|
multiplayerStateManager: noyaManager.multiplayerStateManager,
|
|
6917
7065
|
assetManager: noyaManager.assetManager,
|
|
6918
7066
|
aiManager: noyaManager.aiManager,
|
|
@@ -6935,6 +7083,7 @@ function useBindNoyaManager(noyaManager, options) {
|
|
|
6935
7083
|
useStateInspector({
|
|
6936
7084
|
noyaManager,
|
|
6937
7085
|
disabled: !options?.inspector,
|
|
7086
|
+
advanced: true,
|
|
6938
7087
|
...typeof options?.inspector === "object" && options?.inspector
|
|
6939
7088
|
});
|
|
6940
7089
|
return [state, noyaManager.multiplayerStateManager.setState, extras];
|
|
@@ -6948,7 +7097,10 @@ function useMultiplayerState(initialState, options) {
|
|
|
6948
7097
|
const [noyaManager] = useState2(
|
|
6949
7098
|
() => new NoyaManager2(initialState, rest)
|
|
6950
7099
|
);
|
|
6951
|
-
return useBindNoyaManager(noyaManager, {
|
|
7100
|
+
return useBindNoyaManager(noyaManager, {
|
|
7101
|
+
sync,
|
|
7102
|
+
inspector
|
|
7103
|
+
});
|
|
6952
7104
|
}
|
|
6953
7105
|
function useErrorOverlay(noyaManager) {
|
|
6954
7106
|
const unrecoverableError = useObservable(noyaManager.unrecoverableError);
|
|
@@ -6972,7 +7124,9 @@ function createDefaultAppData(initialState) {
|
|
|
6972
7124
|
theme: "light",
|
|
6973
7125
|
viewType: "editable",
|
|
6974
7126
|
initialState,
|
|
6975
|
-
inspector: false
|
|
7127
|
+
inspector: false,
|
|
7128
|
+
isDemo: false,
|
|
7129
|
+
access: void 0
|
|
6976
7130
|
};
|
|
6977
7131
|
}
|
|
6978
7132
|
function enforceSchema(initialState, schema) {
|
|
@@ -7003,11 +7157,23 @@ function getAppData(initialState, schema, options) {
|
|
|
7003
7157
|
appData.initialState = resolvedInitialState;
|
|
7004
7158
|
}
|
|
7005
7159
|
appData.initialState = enforceSchema(appData.initialState, schema);
|
|
7160
|
+
appData.isDemo = appData.isDemo ?? false;
|
|
7161
|
+
const fallbackAccess = appData.viewType === "editable" ? "write" : "read";
|
|
7162
|
+
appData.access = appData.access ?? fallbackAccess;
|
|
7006
7163
|
return appData;
|
|
7007
7164
|
}
|
|
7008
7165
|
function getSyncAdapter(params) {
|
|
7009
|
-
const {
|
|
7010
|
-
|
|
7166
|
+
const {
|
|
7167
|
+
multiplayerUrl,
|
|
7168
|
+
offlineStorageKey,
|
|
7169
|
+
debug,
|
|
7170
|
+
policyAuthContext,
|
|
7171
|
+
serverScripts
|
|
7172
|
+
} = params ?? {};
|
|
7173
|
+
return isEmbeddedApp() ? parentFrameSync({ debug, policyAuthContext }) : multiplayerUrl ? webSocketSync({ url: multiplayerUrl, debug }) : offlineStorageKey ? localStorageSync({
|
|
7174
|
+
key: offlineStorageKey,
|
|
7175
|
+
...serverScripts ? { serverScripts } : {}
|
|
7176
|
+
}) : stubSync2();
|
|
7011
7177
|
}
|
|
7012
7178
|
function useNoyaStateInternal(...args) {
|
|
7013
7179
|
const [initialState, options] = typeof args[0] === "object" && args[0] !== null && "schema" in args[0] && TypeGuard.IsSchema(args[0].schema) ? [null, args[0]] : [args[0], args[1]];
|
|
@@ -7017,31 +7183,63 @@ function useNoyaStateInternal(...args) {
|
|
|
7017
7183
|
inspector,
|
|
7018
7184
|
initialState: noyaAppInitialState,
|
|
7019
7185
|
theme,
|
|
7020
|
-
viewType
|
|
7186
|
+
viewType,
|
|
7187
|
+
userId,
|
|
7188
|
+
isDemo,
|
|
7189
|
+
access
|
|
7021
7190
|
}
|
|
7022
7191
|
] = useState3(() => {
|
|
7023
7192
|
return getAppData(initialState, options?.schema, {
|
|
7024
7193
|
overrideExistingState: options?.overrideExistingState
|
|
7025
7194
|
});
|
|
7026
7195
|
});
|
|
7196
|
+
const basePolicyAuthContext = useMemo3(() => {
|
|
7197
|
+
if (!access && userId === void 0) return void 0;
|
|
7198
|
+
const context = {};
|
|
7199
|
+
if (access) {
|
|
7200
|
+
context.access = access;
|
|
7201
|
+
}
|
|
7202
|
+
if (userId !== void 0) {
|
|
7203
|
+
context.id = userId ?? null;
|
|
7204
|
+
}
|
|
7205
|
+
return context;
|
|
7206
|
+
}, [access, userId]);
|
|
7027
7207
|
const sync = useMemo3(() => {
|
|
7028
7208
|
return getSyncAdapter({
|
|
7029
7209
|
multiplayerUrl,
|
|
7030
7210
|
offlineStorageKey: options?.offlineStorageKey,
|
|
7031
|
-
debug: options?.debug
|
|
7211
|
+
debug: options?.debug,
|
|
7212
|
+
policyAuthContext: basePolicyAuthContext
|
|
7032
7213
|
});
|
|
7033
|
-
}, [
|
|
7214
|
+
}, [
|
|
7215
|
+
multiplayerUrl,
|
|
7216
|
+
options?.offlineStorageKey,
|
|
7217
|
+
options?.debug,
|
|
7218
|
+
basePolicyAuthContext
|
|
7219
|
+
]);
|
|
7034
7220
|
const [noyaManager] = useState3(
|
|
7035
7221
|
() => new NoyaManager3(noyaAppInitialState, options)
|
|
7036
7222
|
);
|
|
7223
|
+
useEffect4(() => {
|
|
7224
|
+
if (!userId) return;
|
|
7225
|
+
noyaManager.sharedConnectionDataManager.setCurrentConnectionId(userId);
|
|
7226
|
+
noyaManager.userManager.setCurrentConnectionId(userId);
|
|
7227
|
+
noyaManager.userManager.setCurrentUserId(userId);
|
|
7228
|
+
}, [noyaManager, userId]);
|
|
7229
|
+
useEffect4(() => {
|
|
7230
|
+
if (!basePolicyAuthContext) return;
|
|
7231
|
+
noyaManager.multiplayerStateManager.setPolicyAuthContext(
|
|
7232
|
+
basePolicyAuthContext
|
|
7233
|
+
);
|
|
7234
|
+
}, [noyaManager, basePolicyAuthContext]);
|
|
7037
7235
|
const result = useBindNoyaManager(noyaManager, {
|
|
7038
7236
|
inspector: options?.inspector ?? inspector,
|
|
7039
7237
|
sync: options?.sync ?? sync
|
|
7040
7238
|
});
|
|
7041
7239
|
const [, , extras] = result;
|
|
7042
7240
|
const mergedExtras = useMemo3(() => {
|
|
7043
|
-
return { ...extras, theme, viewType };
|
|
7044
|
-
}, [extras, theme, viewType]);
|
|
7241
|
+
return { ...extras, theme, viewType, isDemo };
|
|
7242
|
+
}, [extras, theme, viewType, isDemo]);
|
|
7045
7243
|
return [result[0], result[1], mergedExtras];
|
|
7046
7244
|
}
|
|
7047
7245
|
|
|
@@ -7049,7 +7247,7 @@ function useNoyaStateInternal(...args) {
|
|
|
7049
7247
|
import {
|
|
7050
7248
|
NoyaManager as NoyaManager4
|
|
7051
7249
|
} from "@noya-app/state-manager";
|
|
7052
|
-
import
|
|
7250
|
+
import React17 from "react";
|
|
7053
7251
|
var noyaManagerSingleton;
|
|
7054
7252
|
var noyaSingletonBindings;
|
|
7055
7253
|
function initializeNoyaSingleton(options) {
|
|
@@ -7066,6 +7264,7 @@ function initializeNoyaSingleton(options) {
|
|
|
7066
7264
|
viewType,
|
|
7067
7265
|
offlineStorageKey,
|
|
7068
7266
|
multiplayerUrl,
|
|
7267
|
+
serverScripts,
|
|
7069
7268
|
...managerOptions
|
|
7070
7269
|
} = options ?? {};
|
|
7071
7270
|
const appData = getAppData(
|
|
@@ -7073,14 +7272,27 @@ function initializeNoyaSingleton(options) {
|
|
|
7073
7272
|
managerOptions?.schema,
|
|
7074
7273
|
{ overrideExistingState: managerOptions?.overrideExistingState }
|
|
7075
7274
|
);
|
|
7275
|
+
const policyAuthContext = appData.access || appData.userId !== void 0 ? {
|
|
7276
|
+
...appData.access ? { access: appData.access } : {},
|
|
7277
|
+
...appData.userId !== void 0 ? { id: appData.userId ?? null } : {}
|
|
7278
|
+
} : void 0;
|
|
7076
7279
|
noyaManagerSingleton = new NoyaManager4(
|
|
7077
7280
|
appData.initialState,
|
|
7078
7281
|
managerOptions
|
|
7079
7282
|
);
|
|
7283
|
+
if (appData.userId) {
|
|
7284
|
+
noyaManagerSingleton.sharedConnectionDataManager.setCurrentConnectionId(
|
|
7285
|
+
appData.userId
|
|
7286
|
+
);
|
|
7287
|
+
noyaManagerSingleton.userManager.setCurrentConnectionId(appData.userId);
|
|
7288
|
+
noyaManagerSingleton.userManager.setCurrentUserId(appData.userId);
|
|
7289
|
+
}
|
|
7080
7290
|
const resolvedSync = sync ?? getSyncAdapter({
|
|
7081
7291
|
multiplayerUrl: multiplayerUrl ?? appData.multiplayerUrl,
|
|
7082
7292
|
offlineStorageKey,
|
|
7083
|
-
debug: managerOptions?.debug
|
|
7293
|
+
debug: managerOptions?.debug,
|
|
7294
|
+
serverScripts,
|
|
7295
|
+
policyAuthContext
|
|
7084
7296
|
});
|
|
7085
7297
|
try {
|
|
7086
7298
|
resolvedSync({ noyaManager: noyaManagerSingleton });
|
|
@@ -7093,12 +7305,13 @@ function initializeNoyaSingleton(options) {
|
|
|
7093
7305
|
if (resolvedInspector) {
|
|
7094
7306
|
const { root } = createStateInspectorRoot();
|
|
7095
7307
|
root.render(
|
|
7096
|
-
/* @__PURE__ */
|
|
7308
|
+
/* @__PURE__ */ React17.createElement(
|
|
7097
7309
|
StateInspector,
|
|
7098
7310
|
{
|
|
7099
7311
|
noyaManager: noyaManagerSingleton,
|
|
7100
7312
|
colorScheme: resolvedInspector === true ? resolvedTheme : resolvedInspector.colorScheme,
|
|
7101
|
-
anchor: resolvedInspector === true ? "bottom right" : resolvedInspector.anchor
|
|
7313
|
+
anchor: resolvedInspector === true ? "bottom right" : resolvedInspector.anchor,
|
|
7314
|
+
advanced: resolvedInspector === true ? false : resolvedInspector.advanced
|
|
7102
7315
|
}
|
|
7103
7316
|
)
|
|
7104
7317
|
);
|
|
@@ -7107,7 +7320,9 @@ function initializeNoyaSingleton(options) {
|
|
|
7107
7320
|
sync: resolvedSync,
|
|
7108
7321
|
inspector: resolvedInspector,
|
|
7109
7322
|
theme: resolvedTheme,
|
|
7110
|
-
viewType: resolvedViewType
|
|
7323
|
+
viewType: resolvedViewType,
|
|
7324
|
+
userId: appData.userId,
|
|
7325
|
+
isDemo: appData.isDemo
|
|
7111
7326
|
};
|
|
7112
7327
|
}
|
|
7113
7328
|
function getNoyaManagerSingleton() {
|
|
@@ -7158,40 +7373,38 @@ function resourceToCreateParameters(resource) {
|
|
|
7158
7373
|
throw new Error(`Unknown resource type: ${resource.type}`);
|
|
7159
7374
|
}
|
|
7160
7375
|
}
|
|
7161
|
-
function
|
|
7376
|
+
function buildResourcePatchPayload({
|
|
7162
7377
|
addedResources,
|
|
7163
7378
|
modifiedResources,
|
|
7164
|
-
|
|
7165
|
-
resourceMap
|
|
7379
|
+
removedResources
|
|
7166
7380
|
}) {
|
|
7167
|
-
const
|
|
7168
|
-
const
|
|
7169
|
-
|
|
7381
|
+
const createEntries = addedResources.map(resourceToCreateParameters);
|
|
7382
|
+
const dedupedCreateEntries = Array.from(
|
|
7383
|
+
new Map(createEntries.map((entry) => [entry.path, entry])).values()
|
|
7170
7384
|
);
|
|
7171
|
-
const
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
if (!updated || updated.type !== "asset") return void 0;
|
|
7183
|
-
handledModifiedResourceIds.push(resource.id);
|
|
7184
|
-
return toCreateParameters(updated);
|
|
7185
|
-
}).filter(
|
|
7186
|
-
(resource) => resource !== void 0
|
|
7187
|
-
);
|
|
7188
|
-
const deduped = new Map(
|
|
7189
|
-
[...payload, ...assetReplacements].map((item) => [item.path, item])
|
|
7385
|
+
const updateEntries = modifiedResources.map((resource) => {
|
|
7386
|
+
const update = {
|
|
7387
|
+
id: resource.id,
|
|
7388
|
+
...resource.path !== void 0 ? { path: resource.path } : {},
|
|
7389
|
+
...resource.assetId !== void 0 ? { assetId: resource.assetId } : {},
|
|
7390
|
+
...resource.asset ? { asset: resource.asset } : {}
|
|
7391
|
+
};
|
|
7392
|
+
return update;
|
|
7393
|
+
}) ?? [];
|
|
7394
|
+
const deleteEntries = removedResources.map(
|
|
7395
|
+
(resource) => ({ id: resource.id })
|
|
7190
7396
|
);
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
}
|
|
7397
|
+
const patch = {};
|
|
7398
|
+
if (dedupedCreateEntries.length) {
|
|
7399
|
+
patch.create = dedupedCreateEntries;
|
|
7400
|
+
}
|
|
7401
|
+
if (updateEntries.length) {
|
|
7402
|
+
patch.update = updateEntries;
|
|
7403
|
+
}
|
|
7404
|
+
if (deleteEntries.length) {
|
|
7405
|
+
patch.delete = deleteEntries;
|
|
7406
|
+
}
|
|
7407
|
+
return patch;
|
|
7195
7408
|
}
|
|
7196
7409
|
var AnyNoyaStateContext = createContext(void 0);
|
|
7197
7410
|
function useAnyNoyaStateContext() {
|
|
@@ -7283,7 +7496,7 @@ function useIOManager() {
|
|
|
7283
7496
|
function usePublish(callback) {
|
|
7284
7497
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7285
7498
|
const stableCallback = useStableCallback(callback);
|
|
7286
|
-
|
|
7499
|
+
useEffect5(() => {
|
|
7287
7500
|
noyaManager.publishingManager.setPublishingEnabled(true);
|
|
7288
7501
|
noyaManager.publishingManager.getFilesToPublish = stableCallback;
|
|
7289
7502
|
return () => {
|
|
@@ -7311,22 +7524,22 @@ function usePipelineManager() {
|
|
|
7311
7524
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7312
7525
|
return noyaManager.pipelineManager;
|
|
7313
7526
|
}
|
|
7314
|
-
function
|
|
7527
|
+
function useUserManager() {
|
|
7315
7528
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7316
|
-
return noyaManager.
|
|
7529
|
+
return noyaManager.userManager;
|
|
7317
7530
|
}
|
|
7318
7531
|
function useConnectedUsers() {
|
|
7319
|
-
const
|
|
7320
|
-
return useObservable(
|
|
7532
|
+
const userManager = useUserManager();
|
|
7533
|
+
return useObservable(userManager?.connectedUsers$);
|
|
7321
7534
|
}
|
|
7322
7535
|
function useConnectedUser(userId) {
|
|
7323
|
-
const
|
|
7536
|
+
const userManager = useUserManager();
|
|
7324
7537
|
return useObservable(
|
|
7325
|
-
|
|
7538
|
+
userManager?.connectedUsers$,
|
|
7326
7539
|
useCallback3(
|
|
7327
7540
|
(users) => {
|
|
7328
7541
|
return users.find((user) => {
|
|
7329
|
-
const prefix = user.
|
|
7542
|
+
const prefix = user.connectionId.slice(0, 8);
|
|
7330
7543
|
return userId?.includes(prefix);
|
|
7331
7544
|
});
|
|
7332
7545
|
},
|
|
@@ -7334,13 +7547,33 @@ function useConnectedUser(userId) {
|
|
|
7334
7547
|
)
|
|
7335
7548
|
);
|
|
7336
7549
|
}
|
|
7337
|
-
function
|
|
7550
|
+
function useAnySharedConnectionData() {
|
|
7338
7551
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7339
|
-
return noyaManager.
|
|
7552
|
+
return noyaManager.sharedConnectionDataManager;
|
|
7553
|
+
}
|
|
7554
|
+
function useEnqueueInput() {
|
|
7555
|
+
const { noyaManager } = useAnyNoyaStateContext();
|
|
7556
|
+
return noyaManager.enqueueInput;
|
|
7557
|
+
}
|
|
7558
|
+
function useNoyaUser() {
|
|
7559
|
+
const userManager = useUserManager();
|
|
7560
|
+
return useObservable(userManager?.currentUser$);
|
|
7561
|
+
}
|
|
7562
|
+
function useNoyaId() {
|
|
7563
|
+
const userManager = useUserManager();
|
|
7564
|
+
return useObservable(userManager?.currentId$);
|
|
7340
7565
|
}
|
|
7341
|
-
function
|
|
7342
|
-
const
|
|
7343
|
-
return useObservable(
|
|
7566
|
+
function useNoyaUserId() {
|
|
7567
|
+
const userManager = useUserManager();
|
|
7568
|
+
return useObservable(userManager?.currentUserId$);
|
|
7569
|
+
}
|
|
7570
|
+
function useNoyaConnectionId() {
|
|
7571
|
+
const userManager = useUserManager();
|
|
7572
|
+
return useObservable(userManager?.currentConnectionId$);
|
|
7573
|
+
}
|
|
7574
|
+
function useNoyaClientId() {
|
|
7575
|
+
const userManager = useUserManager();
|
|
7576
|
+
return useObservable(userManager?.currentClientId$);
|
|
7344
7577
|
}
|
|
7345
7578
|
function useIsProcessing() {
|
|
7346
7579
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
@@ -7363,6 +7596,21 @@ function useResourceManager() {
|
|
|
7363
7596
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7364
7597
|
return noyaManager.resourceManager;
|
|
7365
7598
|
}
|
|
7599
|
+
function useNoyaTranscriptionManager() {
|
|
7600
|
+
const { noyaManager } = useAnyNoyaStateContext();
|
|
7601
|
+
return noyaManager.transcriptionManager;
|
|
7602
|
+
}
|
|
7603
|
+
function useNoyaAssetTranscription(assetId, options) {
|
|
7604
|
+
const transcriptionManager = useNoyaTranscriptionManager();
|
|
7605
|
+
const observable = useMemo4(() => {
|
|
7606
|
+
if (!assetId) return void 0;
|
|
7607
|
+
return transcriptionManager.getAssetTranscription$(assetId, {
|
|
7608
|
+
endpoint: options?.endpoint,
|
|
7609
|
+
apiKey: options?.apiKey
|
|
7610
|
+
});
|
|
7611
|
+
}, [transcriptionManager, assetId, options?.endpoint, options?.apiKey]);
|
|
7612
|
+
return useObservable(observable);
|
|
7613
|
+
}
|
|
7366
7614
|
function resourceToMediaItem(resource) {
|
|
7367
7615
|
switch (resource.type) {
|
|
7368
7616
|
case "asset":
|
|
@@ -7390,24 +7638,15 @@ function useResources({
|
|
|
7390
7638
|
async (action) => {
|
|
7391
7639
|
const newResourceMap = action instanceof Function ? action(resourceMap) : action;
|
|
7392
7640
|
const { addedResources, removedResources, modifiedResources } = diffResourceMaps(resourceMap, newResourceMap, "id");
|
|
7393
|
-
const
|
|
7641
|
+
const patchPayload = buildResourcePatchPayload({
|
|
7394
7642
|
addedResources,
|
|
7395
7643
|
modifiedResources,
|
|
7396
|
-
|
|
7397
|
-
resourceMap
|
|
7644
|
+
removedResources
|
|
7398
7645
|
});
|
|
7399
|
-
|
|
7400
|
-
|
|
7646
|
+
const hasPatchOperations = (patchPayload.create?.length ?? 0) > 0 || (patchPayload.update?.length ?? 0) > 0 || (patchPayload.delete?.length ?? 0) > 0;
|
|
7647
|
+
if (hasPatchOperations) {
|
|
7648
|
+
await resourceManager.patchResources(patchPayload);
|
|
7401
7649
|
}
|
|
7402
|
-
const consumedModifiedResourceIdsSet = new Set(
|
|
7403
|
-
consumedModifiedResourceIds
|
|
7404
|
-
);
|
|
7405
|
-
const remainingModifiedResources = modifiedResources.filter(
|
|
7406
|
-
(resource) => !consumedModifiedResourceIdsSet.has(resource.id)
|
|
7407
|
-
);
|
|
7408
|
-
await resourceManager.deleteResource(
|
|
7409
|
-
removedResources.map((resource) => ({ id: resource.id }))
|
|
7410
|
-
);
|
|
7411
7650
|
if (shouldDeleteAssets) {
|
|
7412
7651
|
for (const resource of removedResources) {
|
|
7413
7652
|
if (resource.type === "asset") {
|
|
@@ -7415,16 +7654,6 @@ function useResources({
|
|
|
7415
7654
|
}
|
|
7416
7655
|
}
|
|
7417
7656
|
}
|
|
7418
|
-
await Promise.all(
|
|
7419
|
-
remainingModifiedResources.map(
|
|
7420
|
-
({ id, path: path2, assetId, asset }) => resourceManager.updateResource({
|
|
7421
|
-
id,
|
|
7422
|
-
path: path2,
|
|
7423
|
-
assetId,
|
|
7424
|
-
...assetId ? {} : asset ? { asset } : {}
|
|
7425
|
-
})
|
|
7426
|
-
)
|
|
7427
|
-
);
|
|
7428
7657
|
},
|
|
7429
7658
|
[resourceMap, resourceManager, shouldDeleteAssets, assetManager]
|
|
7430
7659
|
);
|
|
@@ -7441,7 +7670,7 @@ function useActivityEvents(streamFilter) {
|
|
|
7441
7670
|
function useActivityEventsForManager(streamFilter, activityEventsManager) {
|
|
7442
7671
|
const [streamId, setStreamId] = useState4(void 0);
|
|
7443
7672
|
const stableStreamFilter = useJsonMemo(streamFilter);
|
|
7444
|
-
|
|
7673
|
+
useEffect5(() => {
|
|
7445
7674
|
if (!stableStreamFilter) return;
|
|
7446
7675
|
const streamId2 = activityEventsManager.subscribe(stableStreamFilter);
|
|
7447
7676
|
setStreamId(streamId2);
|
|
@@ -7472,7 +7701,7 @@ function createNoyaContext({
|
|
|
7472
7701
|
children,
|
|
7473
7702
|
contextValue
|
|
7474
7703
|
}) {
|
|
7475
|
-
return /* @__PURE__ */
|
|
7704
|
+
return /* @__PURE__ */ React18.createElement(AnyNoyaStateContext.Provider, { value: contextValue }, children);
|
|
7476
7705
|
}
|
|
7477
7706
|
function NoyaStateProvider({
|
|
7478
7707
|
children,
|
|
@@ -7495,7 +7724,7 @@ function createNoyaContext({
|
|
|
7495
7724
|
}),
|
|
7496
7725
|
[noyaManager, theme, viewType]
|
|
7497
7726
|
);
|
|
7498
|
-
return /* @__PURE__ */
|
|
7727
|
+
return /* @__PURE__ */ React18.createElement(NoyaContextProvider, { contextValue }, options.fallback !== void 0 ? /* @__PURE__ */ React18.createElement(FallbackUntilInitialized, { fallback: options.fallback }, children) : children);
|
|
7499
7728
|
}
|
|
7500
7729
|
function useValue(path2, options) {
|
|
7501
7730
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
@@ -7536,9 +7765,9 @@ function createNoyaContext({
|
|
|
7536
7765
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7537
7766
|
return noyaManager.multiplayerStateManager;
|
|
7538
7767
|
}
|
|
7539
|
-
function
|
|
7768
|
+
function useSharedConnectionDataManager() {
|
|
7540
7769
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7541
|
-
return noyaManager.
|
|
7770
|
+
return noyaManager.sharedConnectionDataManager;
|
|
7542
7771
|
}
|
|
7543
7772
|
function useNoyaManager() {
|
|
7544
7773
|
return useAnyNoyaStateContext().noyaManager;
|
|
@@ -7549,7 +7778,7 @@ function createNoyaContext({
|
|
|
7549
7778
|
}
|
|
7550
7779
|
function useSetLeftMenuItems(leftMenuItems) {
|
|
7551
7780
|
const { menuManager } = useNoyaManager();
|
|
7552
|
-
|
|
7781
|
+
useEffect5(() => {
|
|
7553
7782
|
if (leftMenuItems) {
|
|
7554
7783
|
menuManager.setLeftMenuItems(leftMenuItems);
|
|
7555
7784
|
}
|
|
@@ -7561,7 +7790,7 @@ function createNoyaContext({
|
|
|
7561
7790
|
}
|
|
7562
7791
|
function useSetRightMenuItems(rightMenuItems) {
|
|
7563
7792
|
const { menuManager } = useNoyaManager();
|
|
7564
|
-
|
|
7793
|
+
useEffect5(() => {
|
|
7565
7794
|
if (rightMenuItems) {
|
|
7566
7795
|
menuManager.setRightMenuItems(rightMenuItems);
|
|
7567
7796
|
}
|
|
@@ -7569,7 +7798,7 @@ function createNoyaContext({
|
|
|
7569
7798
|
}
|
|
7570
7799
|
function useHandleMenuItem(callback) {
|
|
7571
7800
|
const { menuManager } = useNoyaManager();
|
|
7572
|
-
|
|
7801
|
+
useEffect5(() => {
|
|
7573
7802
|
return menuManager.addListener(callback);
|
|
7574
7803
|
}, [menuManager, callback]);
|
|
7575
7804
|
}
|
|
@@ -7593,7 +7822,7 @@ function createNoyaContext({
|
|
|
7593
7822
|
useSetValue,
|
|
7594
7823
|
useValueState,
|
|
7595
7824
|
useStateManager,
|
|
7596
|
-
|
|
7825
|
+
useSharedConnectionDataManager,
|
|
7597
7826
|
useLeftMenuItems,
|
|
7598
7827
|
useSetLeftMenuItems,
|
|
7599
7828
|
useRightMenuItems,
|
|
@@ -7608,7 +7837,7 @@ function createNoyaContext({
|
|
|
7608
7837
|
// src/ai.ts
|
|
7609
7838
|
function useRegisterAITool(tool) {
|
|
7610
7839
|
const aiManager = useAIManager();
|
|
7611
|
-
|
|
7840
|
+
useEffect6(() => {
|
|
7612
7841
|
return aiManager.registerTool(tool);
|
|
7613
7842
|
}, [aiManager, tool]);
|
|
7614
7843
|
}
|
|
@@ -7620,28 +7849,28 @@ function useCallableAITools() {
|
|
|
7620
7849
|
// src/components/UserPointersOverlay.tsx
|
|
7621
7850
|
import { Observable as Observable2 } from "@noya-app/observable";
|
|
7622
7851
|
import { memoGeneric as memoGeneric2 } from "@noya-app/react-utils";
|
|
7623
|
-
import
|
|
7852
|
+
import React19, { useEffect as useEffect7, useMemo as useMemo5, useState as useState5 } from "react";
|
|
7624
7853
|
function shouldShow(hideAfter, updatedAt) {
|
|
7625
7854
|
return !!updatedAt && Date.now() - updatedAt < hideAfter;
|
|
7626
7855
|
}
|
|
7627
7856
|
var UserPointerInternal = memoGeneric2(function UserPointerInternal2({
|
|
7628
7857
|
user,
|
|
7629
|
-
|
|
7858
|
+
sharedConnectionDataManager,
|
|
7630
7859
|
hideAfter = 5e3,
|
|
7631
7860
|
renderUserPointer
|
|
7632
7861
|
}) {
|
|
7633
7862
|
const observable = useMemo5(() => {
|
|
7634
|
-
const metadata$ =
|
|
7635
|
-
const data$ =
|
|
7863
|
+
const metadata$ = sharedConnectionDataManager.metadata$.observePath([user.connectionId]).throttle(50);
|
|
7864
|
+
const data$ = sharedConnectionDataManager.data$.observePath([user.connectionId]).throttle(50);
|
|
7636
7865
|
return Observable2.combine([metadata$, data$], ([metadata2, data2]) => {
|
|
7637
7866
|
return { metadata: metadata2, data: data2 };
|
|
7638
7867
|
});
|
|
7639
|
-
}, [
|
|
7868
|
+
}, [sharedConnectionDataManager, user.connectionId]);
|
|
7640
7869
|
const { metadata, data } = useObservable(observable);
|
|
7641
7870
|
const [, setForceUpdate] = useState5(0);
|
|
7642
7871
|
const updatedAt = metadata?.updatedAt ?? 0;
|
|
7643
7872
|
const show = shouldShow(hideAfter, updatedAt);
|
|
7644
|
-
|
|
7873
|
+
useEffect7(() => {
|
|
7645
7874
|
if (!show) return;
|
|
7646
7875
|
const timeoutId = setTimeout(() => {
|
|
7647
7876
|
setForceUpdate((prev) => prev + 1);
|
|
@@ -7650,27 +7879,29 @@ var UserPointerInternal = memoGeneric2(function UserPointerInternal2({
|
|
|
7650
7879
|
}, [hideAfter, show, updatedAt]);
|
|
7651
7880
|
if (!data?.pointer) return null;
|
|
7652
7881
|
return renderUserPointer({
|
|
7653
|
-
userId: user.
|
|
7882
|
+
userId: user.connectionId,
|
|
7654
7883
|
name: user.name,
|
|
7655
7884
|
point: data.pointer,
|
|
7656
7885
|
visible: show
|
|
7657
7886
|
});
|
|
7658
7887
|
});
|
|
7659
7888
|
var UserPointersOverlay = memoGeneric2(function UserPointers({
|
|
7660
|
-
|
|
7661
|
-
|
|
7889
|
+
userManager,
|
|
7890
|
+
sharedConnectionDataManager,
|
|
7662
7891
|
renderUserPointer
|
|
7663
7892
|
}) {
|
|
7664
|
-
const
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7893
|
+
const currentConnectionId = useObservable(
|
|
7894
|
+
sharedConnectionDataManager.currentConnectionId$
|
|
7895
|
+
);
|
|
7896
|
+
const connectedUsers = useObservable(userManager.connectedUsers$);
|
|
7897
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, connectedUsers.map((user) => {
|
|
7898
|
+
if (user.connectionId === currentConnectionId) return null;
|
|
7899
|
+
return /* @__PURE__ */ React19.createElement(
|
|
7669
7900
|
UserPointerInternal,
|
|
7670
7901
|
{
|
|
7671
|
-
key: user.
|
|
7902
|
+
key: user.connectionId,
|
|
7672
7903
|
user,
|
|
7673
|
-
|
|
7904
|
+
sharedConnectionDataManager,
|
|
7674
7905
|
renderUserPointer
|
|
7675
7906
|
}
|
|
7676
7907
|
);
|
|
@@ -7763,7 +7994,7 @@ export {
|
|
|
7763
7994
|
StateInspector,
|
|
7764
7995
|
UserPointersOverlay,
|
|
7765
7996
|
WebSocketConnection,
|
|
7766
|
-
|
|
7997
|
+
buildResourcePatchPayload,
|
|
7767
7998
|
createDefaultAppData,
|
|
7768
7999
|
createNoyaContext,
|
|
7769
8000
|
createStateInspectorRoot,
|
|
@@ -7786,9 +8017,9 @@ export {
|
|
|
7786
8017
|
useAIManager,
|
|
7787
8018
|
useActivityEvents,
|
|
7788
8019
|
useActivityEventsForManager,
|
|
7789
|
-
useAnyEphemeralUserData,
|
|
7790
8020
|
useAnyNoyaManager,
|
|
7791
8021
|
useAnyNoyaStateContext,
|
|
8022
|
+
useAnySharedConnectionData,
|
|
7792
8023
|
useAsset,
|
|
7793
8024
|
useAssetManager,
|
|
7794
8025
|
useAssets,
|
|
@@ -7797,8 +8028,7 @@ export {
|
|
|
7797
8028
|
useColorScheme,
|
|
7798
8029
|
useConnectedUser,
|
|
7799
8030
|
useConnectedUsers,
|
|
7800
|
-
|
|
7801
|
-
useCurrentUserId,
|
|
8031
|
+
useEnqueueInput,
|
|
7802
8032
|
useFileName,
|
|
7803
8033
|
useFilePropertyManager,
|
|
7804
8034
|
useIOManager,
|
|
@@ -7808,7 +8038,14 @@ export {
|
|
|
7808
8038
|
useManagedHistory,
|
|
7809
8039
|
useManagedState,
|
|
7810
8040
|
useMultiplayerState,
|
|
8041
|
+
useNoyaAssetTranscription,
|
|
8042
|
+
useNoyaClientId,
|
|
8043
|
+
useNoyaConnectionId,
|
|
8044
|
+
useNoyaId,
|
|
7811
8045
|
useNoyaStateInternal,
|
|
8046
|
+
useNoyaTranscriptionManager,
|
|
8047
|
+
useNoyaUser,
|
|
8048
|
+
useNoyaUserId,
|
|
7812
8049
|
useObservable,
|
|
7813
8050
|
useOutputTransforms,
|
|
7814
8051
|
usePipelineManager,
|
|
@@ -7821,6 +8058,7 @@ export {
|
|
|
7821
8058
|
useSecrets,
|
|
7822
8059
|
useSetFileNameState,
|
|
7823
8060
|
useStateInspector,
|
|
8061
|
+
useUserManager,
|
|
7824
8062
|
useViewType
|
|
7825
8063
|
};
|
|
7826
8064
|
//# sourceMappingURL=index.mjs.map
|