@noya-app/noya-multiplayer-react 0.1.77 → 0.1.79
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 +16 -0
- package/dist/index.bundle.js +34 -28
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +672 -210
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +649 -187
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/inspector/StateInspector.tsx +77 -37
- package/src/inspector/sections/GitSection.tsx +500 -0
- package/src/noyaApp.ts +9 -0
- package/src/singleton.tsx +2 -0
package/dist/index.js
CHANGED
|
@@ -1569,7 +1569,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
1569
1569
|
__reExport(src_exports, require("@noya-app/state-manager"), module.exports);
|
|
1570
1570
|
|
|
1571
1571
|
// src/ai.ts
|
|
1572
|
-
var
|
|
1572
|
+
var import_react23 = require("react");
|
|
1573
1573
|
|
|
1574
1574
|
// ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
1575
1575
|
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
@@ -4056,6 +4056,10 @@ var activityEventSchema = Type.Object({
|
|
|
4056
4056
|
});
|
|
4057
4057
|
|
|
4058
4058
|
// ../noya-schemas/src/asset.ts
|
|
4059
|
+
var assetModeSchema = Type.Union([
|
|
4060
|
+
Type.Literal("immutable"),
|
|
4061
|
+
Type.Literal("mutable")
|
|
4062
|
+
]);
|
|
4059
4063
|
var assetSchema = Type.Object({
|
|
4060
4064
|
id: Type.String(),
|
|
4061
4065
|
stableId: Type.String(),
|
|
@@ -4065,7 +4069,9 @@ var assetSchema = Type.Object({
|
|
|
4065
4069
|
contentType: Type.Optional(Type.String()),
|
|
4066
4070
|
width: Type.Union([Type.Null(), Type.Number()]),
|
|
4067
4071
|
height: Type.Union([Type.Null(), Type.Number()]),
|
|
4068
|
-
userId: Type.Union([Type.Null(), Type.String()])
|
|
4072
|
+
userId: Type.Union([Type.Null(), Type.String()]),
|
|
4073
|
+
mode: Type.Optional(assetModeSchema),
|
|
4074
|
+
version: Type.Optional(Type.Number())
|
|
4069
4075
|
});
|
|
4070
4076
|
|
|
4071
4077
|
// ../noya-schemas/src/encode.ts
|
|
@@ -4584,6 +4590,9 @@ function getChangedResourceProperties({
|
|
|
4584
4590
|
}
|
|
4585
4591
|
return changed;
|
|
4586
4592
|
}
|
|
4593
|
+
function intersectSets(set1, set2) {
|
|
4594
|
+
return new Set([...set1].filter((item) => set2.has(item)));
|
|
4595
|
+
}
|
|
4587
4596
|
function diffResourceMaps(resourceMap, newResourceMap, idProperty) {
|
|
4588
4597
|
const oldIdToPathMap = new Map(
|
|
4589
4598
|
Object.entries(resourceMap).map(([path2, entity]) => [
|
|
@@ -4603,7 +4612,7 @@ function diffResourceMaps(resourceMap, newResourceMap, idProperty) {
|
|
|
4603
4612
|
const newIds = new Set(
|
|
4604
4613
|
Object.values(newResourceMap).map((entity) => entity[idProperty])
|
|
4605
4614
|
);
|
|
4606
|
-
const sameIds = oldIds
|
|
4615
|
+
const sameIds = intersectSets(oldIds, newIds);
|
|
4607
4616
|
const addedResources = Object.values(newResourceMap).filter(
|
|
4608
4617
|
(entity) => !oldIds.has(entity[idProperty])
|
|
4609
4618
|
);
|
|
@@ -4687,15 +4696,15 @@ format_exports.Set("uuid", validateUUID);
|
|
|
4687
4696
|
var import_observable = require("@noya-app/observable");
|
|
4688
4697
|
var import_react_utils3 = require("@noya-app/react-utils");
|
|
4689
4698
|
var import_state_manager5 = require("@noya-app/state-manager");
|
|
4690
|
-
var
|
|
4699
|
+
var import_react22 = __toESM(require("react"));
|
|
4691
4700
|
|
|
4692
4701
|
// src/noyaApp.ts
|
|
4693
4702
|
var import_state_manager3 = require("@noya-app/state-manager");
|
|
4694
|
-
var
|
|
4703
|
+
var import_react20 = require("react");
|
|
4695
4704
|
|
|
4696
4705
|
// src/hooks.ts
|
|
4697
4706
|
var import_state_manager2 = require("@noya-app/state-manager");
|
|
4698
|
-
var
|
|
4707
|
+
var import_react19 = require("react");
|
|
4699
4708
|
var import_client2 = require("react-dom/client");
|
|
4700
4709
|
|
|
4701
4710
|
// src/components/ErrorOverlay.tsx
|
|
@@ -4773,7 +4782,7 @@ var ErrorOverlay = React.memo(function ErrorOverlay2({
|
|
|
4773
4782
|
});
|
|
4774
4783
|
|
|
4775
4784
|
// src/inspector/useStateInspector.tsx
|
|
4776
|
-
var
|
|
4785
|
+
var import_react18 = __toESM(require("react"));
|
|
4777
4786
|
var import_client = require("react-dom/client");
|
|
4778
4787
|
var import_react_utils2 = require("@noya-app/react-utils");
|
|
4779
4788
|
|
|
@@ -4907,7 +4916,7 @@ function uuid() {
|
|
|
4907
4916
|
|
|
4908
4917
|
// src/inspector/StateInspector.tsx
|
|
4909
4918
|
var import_react_utils = require("@noya-app/react-utils");
|
|
4910
|
-
var
|
|
4919
|
+
var import_react17 = __toESM(require("react"));
|
|
4911
4920
|
var import_react_inspector7 = require("react-inspector");
|
|
4912
4921
|
|
|
4913
4922
|
// src/useObservable.ts
|
|
@@ -5372,8 +5381,424 @@ function EventsSection({
|
|
|
5372
5381
|
);
|
|
5373
5382
|
}
|
|
5374
5383
|
|
|
5375
|
-
// src/inspector/sections/
|
|
5384
|
+
// src/inspector/sections/GitSection.tsx
|
|
5385
|
+
var import_react11 = __toESM(require("react"));
|
|
5386
|
+
|
|
5387
|
+
// src/inspector/StateInspectorTitleLabel.tsx
|
|
5376
5388
|
var import_react10 = __toESM(require("react"));
|
|
5389
|
+
function StateInspectorTitleLabel({
|
|
5390
|
+
children
|
|
5391
|
+
}) {
|
|
5392
|
+
return /* @__PURE__ */ import_react10.default.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
|
|
5393
|
+
}
|
|
5394
|
+
|
|
5395
|
+
// src/inspector/sections/GitSection.tsx
|
|
5396
|
+
function GitSection({
|
|
5397
|
+
showGit,
|
|
5398
|
+
setShowGit,
|
|
5399
|
+
colorScheme,
|
|
5400
|
+
gitManager
|
|
5401
|
+
}) {
|
|
5402
|
+
const theme = getStateInspectorTheme(colorScheme);
|
|
5403
|
+
const repos = useObservable(gitManager.repos$);
|
|
5404
|
+
const isInitialized = useObservable(gitManager.isInitialized$);
|
|
5405
|
+
const repoFiles = useObservable(gitManager.repoFiles$);
|
|
5406
|
+
const [focusedRepoId, setFocusedRepoId] = (0, import_react11.useState)(null);
|
|
5407
|
+
const [editingFile, setEditingFile] = (0, import_react11.useState)(null);
|
|
5408
|
+
const editHandleRef = (0, import_react11.useRef)(null);
|
|
5409
|
+
const [editContent, setEditContent] = (0, import_react11.useState)("");
|
|
5410
|
+
const [isEditInitialized, setIsEditInitialized] = (0, import_react11.useState)(false);
|
|
5411
|
+
const focusedRepo = focusedRepoId ? repos.find((r) => r.id === focusedRepoId) : null;
|
|
5412
|
+
const focusedRepoFilesState = focusedRepoId ? repoFiles[focusedRepoId] : null;
|
|
5413
|
+
const handleFocusRepo = async (repoId) => {
|
|
5414
|
+
if (editHandleRef.current) {
|
|
5415
|
+
editHandleRef.current.close();
|
|
5416
|
+
editHandleRef.current = null;
|
|
5417
|
+
setEditingFile(null);
|
|
5418
|
+
setEditContent("");
|
|
5419
|
+
setIsEditInitialized(false);
|
|
5420
|
+
}
|
|
5421
|
+
setFocusedRepoId(repoId);
|
|
5422
|
+
if (repoId && !repoFiles[repoId]) {
|
|
5423
|
+
await gitManager.fetchRepoFiles(repoId);
|
|
5424
|
+
}
|
|
5425
|
+
};
|
|
5426
|
+
const handleEditFile = (filePath) => {
|
|
5427
|
+
if (!focusedRepoId || !focusedRepoFilesState) return;
|
|
5428
|
+
if (editHandleRef.current) {
|
|
5429
|
+
editHandleRef.current.close();
|
|
5430
|
+
}
|
|
5431
|
+
const handle = gitManager.openEditingHandle(
|
|
5432
|
+
focusedRepoId,
|
|
5433
|
+
filePath,
|
|
5434
|
+
focusedRepoFilesState.ref
|
|
5435
|
+
);
|
|
5436
|
+
editHandleRef.current = handle;
|
|
5437
|
+
setEditingFile(filePath);
|
|
5438
|
+
setIsEditInitialized(false);
|
|
5439
|
+
setEditContent("");
|
|
5440
|
+
};
|
|
5441
|
+
const handleCloseEdit = () => {
|
|
5442
|
+
if (editHandleRef.current) {
|
|
5443
|
+
editHandleRef.current.close();
|
|
5444
|
+
editHandleRef.current = null;
|
|
5445
|
+
}
|
|
5446
|
+
setEditingFile(null);
|
|
5447
|
+
setEditContent("");
|
|
5448
|
+
setIsEditInitialized(false);
|
|
5449
|
+
};
|
|
5450
|
+
(0, import_react11.useEffect)(() => {
|
|
5451
|
+
const handle = editHandleRef.current;
|
|
5452
|
+
if (!handle) return;
|
|
5453
|
+
const unsubContent = handle.content$.subscribe((content) => {
|
|
5454
|
+
setEditContent(content);
|
|
5455
|
+
});
|
|
5456
|
+
const unsubInitialized = handle.isInitialized$.subscribe((initialized) => {
|
|
5457
|
+
setIsEditInitialized(initialized);
|
|
5458
|
+
});
|
|
5459
|
+
return () => {
|
|
5460
|
+
unsubContent();
|
|
5461
|
+
unsubInitialized();
|
|
5462
|
+
};
|
|
5463
|
+
}, [editingFile]);
|
|
5464
|
+
const handleContentChange = (newContent) => {
|
|
5465
|
+
const handle = editHandleRef.current;
|
|
5466
|
+
if (!handle) return;
|
|
5467
|
+
handle.setState(newContent);
|
|
5468
|
+
};
|
|
5469
|
+
const handleBranchChange = async (ref) => {
|
|
5470
|
+
if (focusedRepoId) {
|
|
5471
|
+
await gitManager.fetchRepoFiles(focusedRepoId, ref);
|
|
5472
|
+
}
|
|
5473
|
+
};
|
|
5474
|
+
const handleAddFile = async () => {
|
|
5475
|
+
if (!focusedRepoId || !focusedRepoFilesState) return;
|
|
5476
|
+
const path2 = prompt("Enter file path (e.g., src/index.ts):");
|
|
5477
|
+
if (!path2) return;
|
|
5478
|
+
try {
|
|
5479
|
+
await gitManager.patchFiles(
|
|
5480
|
+
focusedRepoId,
|
|
5481
|
+
{ create: [{ path: path2, content: "" }] },
|
|
5482
|
+
focusedRepoFilesState.ref
|
|
5483
|
+
);
|
|
5484
|
+
} catch (error) {
|
|
5485
|
+
alert(`Failed to create file: ${error}`);
|
|
5486
|
+
}
|
|
5487
|
+
};
|
|
5488
|
+
const handleRenameFile = async (oldPath) => {
|
|
5489
|
+
if (!focusedRepoId || !focusedRepoFilesState) return;
|
|
5490
|
+
const newPath = prompt(`Rename "${oldPath}" to:`, oldPath);
|
|
5491
|
+
if (!newPath || newPath === oldPath) return;
|
|
5492
|
+
try {
|
|
5493
|
+
await gitManager.patchFiles(
|
|
5494
|
+
focusedRepoId,
|
|
5495
|
+
{ rename: [{ oldPath, newPath }] },
|
|
5496
|
+
focusedRepoFilesState.ref
|
|
5497
|
+
);
|
|
5498
|
+
} catch (error) {
|
|
5499
|
+
alert(`Failed to rename file: ${error}`);
|
|
5500
|
+
}
|
|
5501
|
+
};
|
|
5502
|
+
const handleDeleteFile = async (path2) => {
|
|
5503
|
+
if (!focusedRepoId || !focusedRepoFilesState) return;
|
|
5504
|
+
const confirmed = confirm(`Delete "${path2}"?`);
|
|
5505
|
+
if (!confirmed) return;
|
|
5506
|
+
try {
|
|
5507
|
+
await gitManager.patchFiles(
|
|
5508
|
+
focusedRepoId,
|
|
5509
|
+
{ delete: [{ path: path2 }] },
|
|
5510
|
+
focusedRepoFilesState.ref
|
|
5511
|
+
);
|
|
5512
|
+
if (editingFile === path2) {
|
|
5513
|
+
handleCloseEdit();
|
|
5514
|
+
}
|
|
5515
|
+
} catch (error) {
|
|
5516
|
+
alert(`Failed to delete file: ${error}`);
|
|
5517
|
+
}
|
|
5518
|
+
};
|
|
5519
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
5520
|
+
StateInspectorDisclosureSection,
|
|
5521
|
+
{
|
|
5522
|
+
open: showGit,
|
|
5523
|
+
setOpen: setShowGit,
|
|
5524
|
+
title: /* @__PURE__ */ import_react11.default.createElement(StateInspectorTitleLabel, null, "Git Repos (", repos.length, ")", /* @__PURE__ */ import_react11.default.createElement(ColoredDot, { type: isInitialized ? "success" : "error" })),
|
|
5525
|
+
colorScheme,
|
|
5526
|
+
right: /* @__PURE__ */ import_react11.default.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ import_react11.default.createElement(
|
|
5527
|
+
StateInspectorButton,
|
|
5528
|
+
{
|
|
5529
|
+
theme,
|
|
5530
|
+
onClick: async () => {
|
|
5531
|
+
try {
|
|
5532
|
+
await gitManager.initRepo();
|
|
5533
|
+
} catch (error) {
|
|
5534
|
+
console.error("[GitSection] Failed to create repo:", error);
|
|
5535
|
+
}
|
|
5536
|
+
}
|
|
5537
|
+
},
|
|
5538
|
+
"Init Repo"
|
|
5539
|
+
))
|
|
5540
|
+
},
|
|
5541
|
+
/* @__PURE__ */ import_react11.default.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ import_react11.default.createElement("div", { style: { padding: "4px 12px", display: "flex", gap: "4px" } }, /* @__PURE__ */ import_react11.default.createElement(
|
|
5542
|
+
"select",
|
|
5543
|
+
{
|
|
5544
|
+
name: "repoSelector",
|
|
5545
|
+
value: focusedRepoId ?? "",
|
|
5546
|
+
style: { flex: "1 1 auto", height: "19px", minWidth: 0 },
|
|
5547
|
+
onChange: (e) => {
|
|
5548
|
+
const value = e.target.value;
|
|
5549
|
+
handleFocusRepo(value || null);
|
|
5550
|
+
}
|
|
5551
|
+
},
|
|
5552
|
+
/* @__PURE__ */ import_react11.default.createElement("option", { value: "" }, "Select a repo..."),
|
|
5553
|
+
repos.map((repo) => /* @__PURE__ */ import_react11.default.createElement("option", { key: repo.id, value: repo.id }, repo.id))
|
|
5554
|
+
), focusedRepoId && /* @__PURE__ */ import_react11.default.createElement(
|
|
5555
|
+
StateInspectorButton,
|
|
5556
|
+
{
|
|
5557
|
+
theme,
|
|
5558
|
+
onClick: () => gitManager.fetchRepoFiles(focusedRepoId)
|
|
5559
|
+
},
|
|
5560
|
+
"Refresh"
|
|
5561
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
|
5562
|
+
"label",
|
|
5563
|
+
{
|
|
5564
|
+
style: {
|
|
5565
|
+
display: "flex",
|
|
5566
|
+
alignItems: "center",
|
|
5567
|
+
gap: "4px",
|
|
5568
|
+
fontSize: "11px",
|
|
5569
|
+
whiteSpace: "nowrap"
|
|
5570
|
+
}
|
|
5571
|
+
},
|
|
5572
|
+
"[Include Content = ",
|
|
5573
|
+
gitManager.includeContent ? "true" : "false",
|
|
5574
|
+
"]"
|
|
5575
|
+
)), focusedRepo && focusedRepoFilesState && /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement(
|
|
5576
|
+
"div",
|
|
5577
|
+
{
|
|
5578
|
+
style: {
|
|
5579
|
+
padding: "4px 12px",
|
|
5580
|
+
display: "flex",
|
|
5581
|
+
gap: "8px",
|
|
5582
|
+
alignItems: "center",
|
|
5583
|
+
fontSize: "12px"
|
|
5584
|
+
}
|
|
5585
|
+
},
|
|
5586
|
+
/* @__PURE__ */ import_react11.default.createElement("span", { style: { color: theme.BASE_COLOR } }, "Branch:"),
|
|
5587
|
+
focusedRepoFilesState.branches.length > 0 ? /* @__PURE__ */ import_react11.default.createElement(
|
|
5588
|
+
"select",
|
|
5589
|
+
{
|
|
5590
|
+
value: focusedRepoFilesState.ref,
|
|
5591
|
+
style: { flex: "1 1 auto", height: "19px" },
|
|
5592
|
+
onChange: (e) => handleBranchChange(e.target.value)
|
|
5593
|
+
},
|
|
5594
|
+
focusedRepoFilesState.branches.map((branch) => /* @__PURE__ */ import_react11.default.createElement("option", { key: branch.name, value: branch.name }, branch.name))
|
|
5595
|
+
) : /* @__PURE__ */ import_react11.default.createElement("span", { style: { opacity: 0.6, fontStyle: "italic" } }, focusedRepoFilesState.ref || "No branches"),
|
|
5596
|
+
focusedRepoFilesState.oid && /* @__PURE__ */ import_react11.default.createElement(
|
|
5597
|
+
"span",
|
|
5598
|
+
{
|
|
5599
|
+
style: {
|
|
5600
|
+
fontFamily: "monospace",
|
|
5601
|
+
fontSize: "10px",
|
|
5602
|
+
opacity: 0.6
|
|
5603
|
+
},
|
|
5604
|
+
title: focusedRepoFilesState.oid
|
|
5605
|
+
},
|
|
5606
|
+
focusedRepoFilesState.oid.slice(0, 7),
|
|
5607
|
+
focusedRepoFilesState.fetchState === "refreshing" && "\u2026"
|
|
5608
|
+
),
|
|
5609
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
|
5610
|
+
StateInspectorButton,
|
|
5611
|
+
{
|
|
5612
|
+
theme,
|
|
5613
|
+
onClick: handleAddFile,
|
|
5614
|
+
style: { fontSize: "10px", padding: "2px 6px" }
|
|
5615
|
+
},
|
|
5616
|
+
"+ Add File"
|
|
5617
|
+
)
|
|
5618
|
+
), focusedRepoFilesState.fetchState === "loading" && /* @__PURE__ */ import_react11.default.createElement(
|
|
5619
|
+
"div",
|
|
5620
|
+
{
|
|
5621
|
+
style: {
|
|
5622
|
+
padding: "12px",
|
|
5623
|
+
fontSize: "12px"
|
|
5624
|
+
}
|
|
5625
|
+
},
|
|
5626
|
+
"Loading files..."
|
|
5627
|
+
), focusedRepoFilesState.error && /* @__PURE__ */ import_react11.default.createElement(
|
|
5628
|
+
"div",
|
|
5629
|
+
{
|
|
5630
|
+
style: {
|
|
5631
|
+
padding: "12px",
|
|
5632
|
+
fontSize: "12px",
|
|
5633
|
+
color: "#f44"
|
|
5634
|
+
}
|
|
5635
|
+
},
|
|
5636
|
+
"Error: ",
|
|
5637
|
+
focusedRepoFilesState.error
|
|
5638
|
+
), focusedRepoFilesState.fetchState !== "loading" && !focusedRepoFilesState.error && focusedRepoFilesState.files.length === 0 && /* @__PURE__ */ import_react11.default.createElement(
|
|
5639
|
+
"div",
|
|
5640
|
+
{
|
|
5641
|
+
style: {
|
|
5642
|
+
padding: "12px",
|
|
5643
|
+
fontSize: "12px"
|
|
5644
|
+
}
|
|
5645
|
+
},
|
|
5646
|
+
"No files (empty repo)"
|
|
5647
|
+
), !editingFile && focusedRepoFilesState.files.map((file, index) => {
|
|
5648
|
+
const fileInfo = focusedRepoFilesState.fileContents?.find(
|
|
5649
|
+
(f) => f.path === file
|
|
5650
|
+
);
|
|
5651
|
+
let preview = "";
|
|
5652
|
+
if (fileInfo) {
|
|
5653
|
+
try {
|
|
5654
|
+
const decoded = atob(fileInfo.content);
|
|
5655
|
+
preview = decoded.slice(0, 40).replace(/\n/g, " ").replace(/\s+/g, " ");
|
|
5656
|
+
if (decoded.length > 40) preview += "\u2026";
|
|
5657
|
+
} catch {
|
|
5658
|
+
}
|
|
5659
|
+
}
|
|
5660
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
5661
|
+
"div",
|
|
5662
|
+
{
|
|
5663
|
+
key: index,
|
|
5664
|
+
style: {
|
|
5665
|
+
padding: "2px 12px",
|
|
5666
|
+
display: "flex",
|
|
5667
|
+
justifyContent: "space-between",
|
|
5668
|
+
alignItems: "center",
|
|
5669
|
+
gap: "8px",
|
|
5670
|
+
borderBottom: `1px solid ${colorScheme === "light" ? "rgb(223 223 223)" : "rgb(29 29 29)"}`
|
|
5671
|
+
}
|
|
5672
|
+
},
|
|
5673
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
|
5674
|
+
"span",
|
|
5675
|
+
{
|
|
5676
|
+
style: {
|
|
5677
|
+
fontFamily: "monospace",
|
|
5678
|
+
fontSize: "11px",
|
|
5679
|
+
overflow: "hidden",
|
|
5680
|
+
textOverflow: "ellipsis",
|
|
5681
|
+
whiteSpace: "nowrap",
|
|
5682
|
+
minWidth: 0,
|
|
5683
|
+
display: "flex",
|
|
5684
|
+
gap: "8px"
|
|
5685
|
+
},
|
|
5686
|
+
title: file
|
|
5687
|
+
},
|
|
5688
|
+
/* @__PURE__ */ import_react11.default.createElement("span", null, file),
|
|
5689
|
+
preview && /* @__PURE__ */ import_react11.default.createElement("span", { style: { opacity: 0.5 } }, preview)
|
|
5690
|
+
),
|
|
5691
|
+
/* @__PURE__ */ import_react11.default.createElement("span", { style: { display: "flex", gap: "4px", flexShrink: 0 } }, /* @__PURE__ */ import_react11.default.createElement(
|
|
5692
|
+
StateInspectorButton,
|
|
5693
|
+
{
|
|
5694
|
+
theme,
|
|
5695
|
+
onClick: () => handleEditFile(file),
|
|
5696
|
+
style: { fontSize: "10px", padding: "2px 6px" }
|
|
5697
|
+
},
|
|
5698
|
+
"Edit"
|
|
5699
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
|
5700
|
+
StateInspectorButton,
|
|
5701
|
+
{
|
|
5702
|
+
theme,
|
|
5703
|
+
onClick: () => handleRenameFile(file),
|
|
5704
|
+
style: { fontSize: "10px", padding: "2px 6px" }
|
|
5705
|
+
},
|
|
5706
|
+
"Rename"
|
|
5707
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
|
5708
|
+
StateInspectorButton,
|
|
5709
|
+
{
|
|
5710
|
+
theme,
|
|
5711
|
+
onClick: () => handleDeleteFile(file),
|
|
5712
|
+
style: { fontSize: "10px", padding: "2px 6px" }
|
|
5713
|
+
},
|
|
5714
|
+
"Delete"
|
|
5715
|
+
))
|
|
5716
|
+
);
|
|
5717
|
+
}), editingFile && /* @__PURE__ */ import_react11.default.createElement(
|
|
5718
|
+
"div",
|
|
5719
|
+
{
|
|
5720
|
+
style: {
|
|
5721
|
+
padding: "8px 12px",
|
|
5722
|
+
borderTop: `1px solid ${theme.DIVIDER_COLOR}`,
|
|
5723
|
+
flex: "1 1 auto",
|
|
5724
|
+
display: "flex",
|
|
5725
|
+
flexDirection: "column",
|
|
5726
|
+
minHeight: 0
|
|
5727
|
+
}
|
|
5728
|
+
},
|
|
5729
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
|
5730
|
+
"div",
|
|
5731
|
+
{
|
|
5732
|
+
style: {
|
|
5733
|
+
display: "flex",
|
|
5734
|
+
justifyContent: "space-between",
|
|
5735
|
+
alignItems: "center",
|
|
5736
|
+
marginBottom: "8px",
|
|
5737
|
+
flexShrink: 0
|
|
5738
|
+
}
|
|
5739
|
+
},
|
|
5740
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
|
5741
|
+
"span",
|
|
5742
|
+
{
|
|
5743
|
+
style: {
|
|
5744
|
+
fontFamily: "monospace",
|
|
5745
|
+
fontSize: "11px",
|
|
5746
|
+
fontWeight: "bold"
|
|
5747
|
+
}
|
|
5748
|
+
},
|
|
5749
|
+
editingFile,
|
|
5750
|
+
!isEditInitialized && /* @__PURE__ */ import_react11.default.createElement("span", { style: { opacity: 0.5, marginLeft: "8px" } }, "Loading...")
|
|
5751
|
+
),
|
|
5752
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
|
5753
|
+
StateInspectorButton,
|
|
5754
|
+
{
|
|
5755
|
+
theme,
|
|
5756
|
+
onClick: handleCloseEdit,
|
|
5757
|
+
style: { fontSize: "10px", padding: "2px 6px" }
|
|
5758
|
+
},
|
|
5759
|
+
"Close"
|
|
5760
|
+
)
|
|
5761
|
+
),
|
|
5762
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
|
5763
|
+
"textarea",
|
|
5764
|
+
{
|
|
5765
|
+
value: editContent,
|
|
5766
|
+
onChange: (e) => handleContentChange(e.target.value),
|
|
5767
|
+
disabled: !isEditInitialized,
|
|
5768
|
+
style: {
|
|
5769
|
+
width: "100%",
|
|
5770
|
+
flex: "1 1 auto",
|
|
5771
|
+
minHeight: "100px",
|
|
5772
|
+
fontFamily: "monospace",
|
|
5773
|
+
fontSize: "11px",
|
|
5774
|
+
padding: "8px",
|
|
5775
|
+
border: `1px solid ${theme.DIVIDER_COLOR}`,
|
|
5776
|
+
borderRadius: "4px",
|
|
5777
|
+
backgroundColor: theme.ROW_BACKGROUND,
|
|
5778
|
+
color: theme.BASE_COLOR,
|
|
5779
|
+
resize: "none",
|
|
5780
|
+
boxSizing: "border-box"
|
|
5781
|
+
}
|
|
5782
|
+
}
|
|
5783
|
+
)
|
|
5784
|
+
)), repos.length === 0 && /* @__PURE__ */ import_react11.default.createElement(
|
|
5785
|
+
"div",
|
|
5786
|
+
{
|
|
5787
|
+
style: {
|
|
5788
|
+
padding: "12px",
|
|
5789
|
+
fontSize: "12px",
|
|
5790
|
+
display: "flex",
|
|
5791
|
+
flexDirection: "column",
|
|
5792
|
+
gap: "4px"
|
|
5793
|
+
}
|
|
5794
|
+
},
|
|
5795
|
+
/* @__PURE__ */ import_react11.default.createElement("span", null, "No git repos")
|
|
5796
|
+
))
|
|
5797
|
+
);
|
|
5798
|
+
}
|
|
5799
|
+
|
|
5800
|
+
// src/inspector/sections/HistorySection.tsx
|
|
5801
|
+
var import_react12 = __toESM(require("react"));
|
|
5377
5802
|
var import_react_inspector5 = require("react-inspector");
|
|
5378
5803
|
|
|
5379
5804
|
// src/inspector/utils.ts
|
|
@@ -5429,15 +5854,15 @@ function HistorySection({
|
|
|
5429
5854
|
historySnapshot,
|
|
5430
5855
|
multiplayerStateManager
|
|
5431
5856
|
}) {
|
|
5432
|
-
const ref = (0,
|
|
5857
|
+
const ref = (0, import_react12.useRef)(null);
|
|
5433
5858
|
const theme = getStateInspectorTheme(colorScheme);
|
|
5434
5859
|
const solidBorderColor = getStateInspectorBorderColor(colorScheme);
|
|
5435
|
-
(0,
|
|
5860
|
+
(0, import_react12.useEffect)(() => {
|
|
5436
5861
|
if (ref.current) {
|
|
5437
5862
|
ref.current.scrollTop = ref.current.scrollHeight;
|
|
5438
5863
|
}
|
|
5439
5864
|
}, [historySnapshot]);
|
|
5440
|
-
(0,
|
|
5865
|
+
(0, import_react12.useEffect)(() => {
|
|
5441
5866
|
if (!ref.current) return;
|
|
5442
5867
|
const historyEntry = ref.current.querySelector(
|
|
5443
5868
|
`#${HISTORY_ELEMENT_PREFIX}${historySnapshot.historyIndex}`
|
|
@@ -5449,14 +5874,14 @@ function HistorySection({
|
|
|
5449
5874
|
});
|
|
5450
5875
|
}
|
|
5451
5876
|
}, [historySnapshot.historyIndex]);
|
|
5452
|
-
return /* @__PURE__ */
|
|
5877
|
+
return /* @__PURE__ */ import_react12.default.createElement(
|
|
5453
5878
|
StateInspectorDisclosureSection,
|
|
5454
5879
|
{
|
|
5455
5880
|
open: showHistory,
|
|
5456
5881
|
setOpen: setShowHistory,
|
|
5457
5882
|
title: "History",
|
|
5458
5883
|
colorScheme,
|
|
5459
|
-
right: /* @__PURE__ */
|
|
5884
|
+
right: /* @__PURE__ */ import_react12.default.createElement(
|
|
5460
5885
|
"span",
|
|
5461
5886
|
{
|
|
5462
5887
|
style: {
|
|
@@ -5464,7 +5889,7 @@ function HistorySection({
|
|
|
5464
5889
|
gap: "4px"
|
|
5465
5890
|
}
|
|
5466
5891
|
},
|
|
5467
|
-
/* @__PURE__ */
|
|
5892
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
5468
5893
|
StateInspectorButton,
|
|
5469
5894
|
{
|
|
5470
5895
|
disabled: !historySnapshot.canUndo,
|
|
@@ -5473,7 +5898,7 @@ function HistorySection({
|
|
|
5473
5898
|
multiplayerStateManager.undo();
|
|
5474
5899
|
}
|
|
5475
5900
|
},
|
|
5476
|
-
/* @__PURE__ */
|
|
5901
|
+
/* @__PURE__ */ import_react12.default.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ import_react12.default.createElement(
|
|
5477
5902
|
"svg",
|
|
5478
5903
|
{
|
|
5479
5904
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5481,7 +5906,7 @@ function HistorySection({
|
|
|
5481
5906
|
height: "1em",
|
|
5482
5907
|
viewBox: "0 0 20 20"
|
|
5483
5908
|
},
|
|
5484
|
-
/* @__PURE__ */
|
|
5909
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
5485
5910
|
"path",
|
|
5486
5911
|
{
|
|
5487
5912
|
fill: "currentColor",
|
|
@@ -5490,7 +5915,7 @@ function HistorySection({
|
|
|
5490
5915
|
)
|
|
5491
5916
|
))
|
|
5492
5917
|
),
|
|
5493
|
-
/* @__PURE__ */
|
|
5918
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
5494
5919
|
StateInspectorButton,
|
|
5495
5920
|
{
|
|
5496
5921
|
disabled: !historySnapshot.canRedo,
|
|
@@ -5499,7 +5924,7 @@ function HistorySection({
|
|
|
5499
5924
|
multiplayerStateManager.redo();
|
|
5500
5925
|
}
|
|
5501
5926
|
},
|
|
5502
|
-
/* @__PURE__ */
|
|
5927
|
+
/* @__PURE__ */ import_react12.default.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ import_react12.default.createElement(
|
|
5503
5928
|
"svg",
|
|
5504
5929
|
{
|
|
5505
5930
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5507,7 +5932,7 @@ function HistorySection({
|
|
|
5507
5932
|
height: "1em",
|
|
5508
5933
|
viewBox: "0 0 20 20"
|
|
5509
5934
|
},
|
|
5510
|
-
/* @__PURE__ */
|
|
5935
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
5511
5936
|
"path",
|
|
5512
5937
|
{
|
|
5513
5938
|
fill: "currentColor",
|
|
@@ -5518,7 +5943,7 @@ function HistorySection({
|
|
|
5518
5943
|
)
|
|
5519
5944
|
)
|
|
5520
5945
|
},
|
|
5521
|
-
/* @__PURE__ */
|
|
5946
|
+
/* @__PURE__ */ import_react12.default.createElement(StateInspectorDisclosureRowInner, { ref }, /* @__PURE__ */ import_react12.default.createElement(
|
|
5522
5947
|
"div",
|
|
5523
5948
|
{
|
|
5524
5949
|
id: `${HISTORY_ELEMENT_PREFIX}0`,
|
|
@@ -5532,7 +5957,7 @@ function HistorySection({
|
|
|
5532
5957
|
background: historySnapshot.historyIndex === 0 ? "rgb(59 130 246 / 15%)" : void 0
|
|
5533
5958
|
}
|
|
5534
5959
|
},
|
|
5535
|
-
/* @__PURE__ */
|
|
5960
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
5536
5961
|
"span",
|
|
5537
5962
|
{
|
|
5538
5963
|
style: {
|
|
@@ -5547,7 +5972,7 @@ function HistorySection({
|
|
|
5547
5972
|
), historySnapshot.history.map((entry, index) => {
|
|
5548
5973
|
const metadata = entry.metadata;
|
|
5549
5974
|
const { id, name, timestamp, ...rest } = metadata;
|
|
5550
|
-
return /* @__PURE__ */
|
|
5975
|
+
return /* @__PURE__ */ import_react12.default.createElement(
|
|
5551
5976
|
"div",
|
|
5552
5977
|
{
|
|
5553
5978
|
id: `${HISTORY_ELEMENT_PREFIX}${index + 1}`,
|
|
@@ -5558,7 +5983,7 @@ function HistorySection({
|
|
|
5558
5983
|
background: index + 1 === historySnapshot.historyIndex ? "rgb(59 130 246 / 15%)" : void 0
|
|
5559
5984
|
}
|
|
5560
5985
|
},
|
|
5561
|
-
typeof name === "string" && /* @__PURE__ */
|
|
5986
|
+
typeof name === "string" && /* @__PURE__ */ import_react12.default.createElement(
|
|
5562
5987
|
"pre",
|
|
5563
5988
|
{
|
|
5564
5989
|
style: {
|
|
@@ -5569,9 +5994,9 @@ function HistorySection({
|
|
|
5569
5994
|
}
|
|
5570
5995
|
},
|
|
5571
5996
|
entry.metadata.name,
|
|
5572
|
-
Object.keys(rest).length > 0 && /* @__PURE__ */
|
|
5997
|
+
Object.keys(rest).length > 0 && /* @__PURE__ */ import_react12.default.createElement(import_react_inspector5.ObjectInspector, { data: rest, theme })
|
|
5573
5998
|
),
|
|
5574
|
-
entry.redoPatches?.map((patch, j) => /* @__PURE__ */
|
|
5999
|
+
entry.redoPatches?.map((patch, j) => /* @__PURE__ */ import_react12.default.createElement(
|
|
5575
6000
|
"pre",
|
|
5576
6001
|
{
|
|
5577
6002
|
key: j,
|
|
@@ -5582,10 +6007,10 @@ function HistorySection({
|
|
|
5582
6007
|
margin: 0
|
|
5583
6008
|
}
|
|
5584
6009
|
},
|
|
5585
|
-
patch.op === "add" && /* @__PURE__ */
|
|
5586
|
-
patch.op === "replace" && /* @__PURE__ */
|
|
5587
|
-
patch.op === "remove" && /* @__PURE__ */
|
|
5588
|
-
patch.op === "move" && /* @__PURE__ */
|
|
6010
|
+
patch.op === "add" && /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ import_react12.default.createElement(import_react_inspector5.ObjectInspector, { data: patch.value, theme })),
|
|
6011
|
+
patch.op === "replace" && /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ import_react12.default.createElement(import_react_inspector5.ObjectInspector, { data: patch.value, theme })),
|
|
6012
|
+
patch.op === "remove" && /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("span", { style: { color: theme.OBJECT_VALUE_STRING_COLOR } }, "delete", " "), /* @__PURE__ */ import_react12.default.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path))),
|
|
6013
|
+
patch.op === "move" && /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.from)), " -> ", /* @__PURE__ */ import_react12.default.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)))
|
|
5589
6014
|
))
|
|
5590
6015
|
);
|
|
5591
6016
|
}))
|
|
@@ -5593,7 +6018,7 @@ function HistorySection({
|
|
|
5593
6018
|
}
|
|
5594
6019
|
|
|
5595
6020
|
// src/inspector/sections/ServerScriptLogsSection.tsx
|
|
5596
|
-
var
|
|
6021
|
+
var import_react13 = __toESM(require("react"));
|
|
5597
6022
|
var import_react_inspector6 = require("react-inspector");
|
|
5598
6023
|
var levelColors = {
|
|
5599
6024
|
error: "#f87171",
|
|
@@ -5614,16 +6039,16 @@ function ServerScriptLogsSection({
|
|
|
5614
6039
|
title = "Server Script Logs"
|
|
5615
6040
|
}) {
|
|
5616
6041
|
const theme = getStateInspectorTheme(colorScheme);
|
|
5617
|
-
return /* @__PURE__ */
|
|
6042
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
5618
6043
|
StateInspectorDisclosureSection,
|
|
5619
6044
|
{
|
|
5620
6045
|
open: showLogs,
|
|
5621
6046
|
setOpen: setShowLogs,
|
|
5622
6047
|
title,
|
|
5623
6048
|
colorScheme,
|
|
5624
|
-
right: /* @__PURE__ */
|
|
6049
|
+
right: /* @__PURE__ */ import_react13.default.createElement(StateInspectorButton, { theme, onClick: onTogglePaused }, paused ? "Resume" : "Pause")
|
|
5625
6050
|
},
|
|
5626
|
-
/* @__PURE__ */
|
|
6051
|
+
/* @__PURE__ */ import_react13.default.createElement(StateInspectorDisclosureRowInner, { ref: containerRef }, paused && /* @__PURE__ */ import_react13.default.createElement(
|
|
5627
6052
|
"div",
|
|
5628
6053
|
{
|
|
5629
6054
|
style: {
|
|
@@ -5633,7 +6058,7 @@ function ServerScriptLogsSection({
|
|
|
5633
6058
|
}
|
|
5634
6059
|
},
|
|
5635
6060
|
"Log streaming paused"
|
|
5636
|
-
), logs.map((log) => /* @__PURE__ */
|
|
6061
|
+
), logs.map((log) => /* @__PURE__ */ import_react13.default.createElement(StateInspectorRow, { key: log.id, colorScheme }, /* @__PURE__ */ import_react13.default.createElement(
|
|
5637
6062
|
"div",
|
|
5638
6063
|
{
|
|
5639
6064
|
style: {
|
|
@@ -5646,9 +6071,9 @@ function ServerScriptLogsSection({
|
|
|
5646
6071
|
textTransform: "uppercase"
|
|
5647
6072
|
}
|
|
5648
6073
|
},
|
|
5649
|
-
/* @__PURE__ */
|
|
5650
|
-
/* @__PURE__ */
|
|
5651
|
-
(log.origin || log.target || log.mode) && /* @__PURE__ */
|
|
6074
|
+
/* @__PURE__ */ import_react13.default.createElement("span", null, formatTimestamp(log.timestamp)),
|
|
6075
|
+
/* @__PURE__ */ import_react13.default.createElement("span", { style: { color: levelColors[log.level] } }, log.level),
|
|
6076
|
+
(log.origin || log.target || log.mode) && /* @__PURE__ */ import_react13.default.createElement(
|
|
5652
6077
|
"span",
|
|
5653
6078
|
{
|
|
5654
6079
|
style: {
|
|
@@ -5660,7 +6085,7 @@ function ServerScriptLogsSection({
|
|
|
5660
6085
|
},
|
|
5661
6086
|
[log.origin ?? log.target, log.mode].filter(Boolean).join(" / ")
|
|
5662
6087
|
),
|
|
5663
|
-
/* @__PURE__ */
|
|
6088
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
5664
6089
|
"span",
|
|
5665
6090
|
{
|
|
5666
6091
|
style: {
|
|
@@ -5671,7 +6096,7 @@ function ServerScriptLogsSection({
|
|
|
5671
6096
|
},
|
|
5672
6097
|
log.scriptId
|
|
5673
6098
|
)
|
|
5674
|
-
), /* @__PURE__ */
|
|
6099
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
5675
6100
|
"div",
|
|
5676
6101
|
{
|
|
5677
6102
|
style: {
|
|
@@ -5680,15 +6105,15 @@ function ServerScriptLogsSection({
|
|
|
5680
6105
|
gap: "4px"
|
|
5681
6106
|
}
|
|
5682
6107
|
},
|
|
5683
|
-
log.values.length > 0 ? log.values.map((value, index) => /* @__PURE__ */
|
|
6108
|
+
log.values.length > 0 ? log.values.map((value, index) => /* @__PURE__ */ import_react13.default.createElement(
|
|
5684
6109
|
import_react_inspector6.ObjectInspector,
|
|
5685
6110
|
{
|
|
5686
6111
|
key: index,
|
|
5687
6112
|
data: value,
|
|
5688
6113
|
theme
|
|
5689
6114
|
}
|
|
5690
|
-
)) : /* @__PURE__ */
|
|
5691
|
-
))), !logs?.length && /* @__PURE__ */
|
|
6115
|
+
)) : /* @__PURE__ */ import_react13.default.createElement("span", { style: { fontSize: "11px", opacity: 0.7 } }, "No data")
|
|
6116
|
+
))), !logs?.length && /* @__PURE__ */ import_react13.default.createElement(
|
|
5692
6117
|
"div",
|
|
5693
6118
|
{
|
|
5694
6119
|
style: {
|
|
@@ -5699,7 +6124,7 @@ function ServerScriptLogsSection({
|
|
|
5699
6124
|
gap: "4px"
|
|
5700
6125
|
}
|
|
5701
6126
|
},
|
|
5702
|
-
/* @__PURE__ */
|
|
6127
|
+
/* @__PURE__ */ import_react13.default.createElement("span", null, "No logs received")
|
|
5703
6128
|
))
|
|
5704
6129
|
);
|
|
5705
6130
|
}
|
|
@@ -6251,16 +6676,8 @@ function replaceDeep(obj, replacementMap) {
|
|
|
6251
6676
|
}
|
|
6252
6677
|
}
|
|
6253
6678
|
|
|
6254
|
-
// src/inspector/StateInspectorTitleLabel.tsx
|
|
6255
|
-
var import_react12 = __toESM(require("react"));
|
|
6256
|
-
function StateInspectorTitleLabel({
|
|
6257
|
-
children
|
|
6258
|
-
}) {
|
|
6259
|
-
return /* @__PURE__ */ import_react12.default.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
|
|
6260
|
-
}
|
|
6261
|
-
|
|
6262
6679
|
// src/inspector/StateInspectorToggleButton.tsx
|
|
6263
|
-
var
|
|
6680
|
+
var import_react14 = __toESM(require("react"));
|
|
6264
6681
|
function StateInspectorToggleButton({
|
|
6265
6682
|
showInspector,
|
|
6266
6683
|
setShowInspector,
|
|
@@ -6268,7 +6685,7 @@ function StateInspectorToggleButton({
|
|
|
6268
6685
|
anchor
|
|
6269
6686
|
}) {
|
|
6270
6687
|
const isRightAnchor = anchor === "right";
|
|
6271
|
-
const rightIcon = /* @__PURE__ */
|
|
6688
|
+
const rightIcon = /* @__PURE__ */ import_react14.default.createElement(
|
|
6272
6689
|
"svg",
|
|
6273
6690
|
{
|
|
6274
6691
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6278,7 +6695,7 @@ function StateInspectorToggleButton({
|
|
|
6278
6695
|
stroke: "currentColor",
|
|
6279
6696
|
className: "size-6"
|
|
6280
6697
|
},
|
|
6281
|
-
/* @__PURE__ */
|
|
6698
|
+
/* @__PURE__ */ import_react14.default.createElement(
|
|
6282
6699
|
"path",
|
|
6283
6700
|
{
|
|
6284
6701
|
strokeLinecap: "round",
|
|
@@ -6287,7 +6704,7 @@ function StateInspectorToggleButton({
|
|
|
6287
6704
|
}
|
|
6288
6705
|
)
|
|
6289
6706
|
);
|
|
6290
|
-
const leftIcon = /* @__PURE__ */
|
|
6707
|
+
const leftIcon = /* @__PURE__ */ import_react14.default.createElement(
|
|
6291
6708
|
"svg",
|
|
6292
6709
|
{
|
|
6293
6710
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6297,7 +6714,7 @@ function StateInspectorToggleButton({
|
|
|
6297
6714
|
stroke: "currentColor",
|
|
6298
6715
|
className: "size-6"
|
|
6299
6716
|
},
|
|
6300
|
-
/* @__PURE__ */
|
|
6717
|
+
/* @__PURE__ */ import_react14.default.createElement(
|
|
6301
6718
|
"path",
|
|
6302
6719
|
{
|
|
6303
6720
|
strokeLinecap: "round",
|
|
@@ -6306,7 +6723,7 @@ function StateInspectorToggleButton({
|
|
|
6306
6723
|
}
|
|
6307
6724
|
)
|
|
6308
6725
|
);
|
|
6309
|
-
return /* @__PURE__ */
|
|
6726
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
6310
6727
|
"span",
|
|
6311
6728
|
{
|
|
6312
6729
|
role: "button",
|
|
@@ -6327,15 +6744,15 @@ function StateInspectorToggleButton({
|
|
|
6327
6744
|
setShowInspector(!showInspector);
|
|
6328
6745
|
}
|
|
6329
6746
|
},
|
|
6330
|
-
showInspector ? "Hide Inspector" : /* @__PURE__ */
|
|
6747
|
+
showInspector ? "Hide Inspector" : /* @__PURE__ */ import_react14.default.createElement("span", { style: { width: "12px", height: "12px" } }, isRightAnchor ? rightIcon : leftIcon)
|
|
6331
6748
|
);
|
|
6332
6749
|
}
|
|
6333
6750
|
|
|
6334
6751
|
// src/inspector/useLocalStorageState.tsx
|
|
6335
|
-
var
|
|
6752
|
+
var import_react15 = __toESM(require("react"));
|
|
6336
6753
|
var localStorage = typeof window !== "undefined" ? window.localStorage : null;
|
|
6337
6754
|
function useLocalStorageState(key, defaultValue) {
|
|
6338
|
-
const [state, setState] =
|
|
6755
|
+
const [state, setState] = import_react15.default.useState(() => {
|
|
6339
6756
|
const value = localStorage?.getItem(key);
|
|
6340
6757
|
let result = defaultValue;
|
|
6341
6758
|
if (value) {
|
|
@@ -6355,11 +6772,11 @@ function useLocalStorageState(key, defaultValue) {
|
|
|
6355
6772
|
}
|
|
6356
6773
|
|
|
6357
6774
|
// src/inspector/usePausedStream.ts
|
|
6358
|
-
var
|
|
6775
|
+
var import_react16 = __toESM(require("react"));
|
|
6359
6776
|
function usePausedStream(items) {
|
|
6360
|
-
const [paused, setPaused] =
|
|
6361
|
-
const [visibleItems, setVisibleItems] =
|
|
6362
|
-
const togglePaused =
|
|
6777
|
+
const [paused, setPaused] = import_react16.default.useState(false);
|
|
6778
|
+
const [visibleItems, setVisibleItems] = import_react16.default.useState(items ?? []);
|
|
6779
|
+
const togglePaused = import_react16.default.useCallback(() => {
|
|
6363
6780
|
setPaused((value) => {
|
|
6364
6781
|
if (!value) {
|
|
6365
6782
|
setVisibleItems(items ?? []);
|
|
@@ -6367,7 +6784,7 @@ function usePausedStream(items) {
|
|
|
6367
6784
|
return !value;
|
|
6368
6785
|
});
|
|
6369
6786
|
}, [items]);
|
|
6370
|
-
|
|
6787
|
+
import_react16.default.useEffect(() => {
|
|
6371
6788
|
if (paused) return;
|
|
6372
6789
|
setVisibleItems(items ?? []);
|
|
6373
6790
|
}, [items, paused]);
|
|
@@ -6399,19 +6816,20 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6399
6816
|
ioManager,
|
|
6400
6817
|
resourceManager,
|
|
6401
6818
|
activityEventsManager,
|
|
6402
|
-
logManager
|
|
6819
|
+
logManager,
|
|
6820
|
+
gitManager
|
|
6403
6821
|
} = noyaManager;
|
|
6404
|
-
const [didMount, setDidMount] =
|
|
6822
|
+
const [didMount, setDidMount] = import_react17.default.useState(false);
|
|
6405
6823
|
const tasks = useObservable(taskManager.tasks$);
|
|
6406
6824
|
const inputs = useObservable(ioManager.inputs$);
|
|
6407
6825
|
const outputTransforms = useObservable(ioManager.outputTransforms$);
|
|
6408
|
-
(0,
|
|
6826
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
6409
6827
|
setDidMount(true);
|
|
6410
6828
|
}, []);
|
|
6411
|
-
const eventsContainerRef =
|
|
6412
|
-
const activityEventsContainerRef =
|
|
6413
|
-
const serverLogsContainerRef =
|
|
6414
|
-
const serverSimulationLogsContainerRef =
|
|
6829
|
+
const eventsContainerRef = import_react17.default.useRef(null);
|
|
6830
|
+
const activityEventsContainerRef = import_react17.default.useRef(null);
|
|
6831
|
+
const serverLogsContainerRef = import_react17.default.useRef(null);
|
|
6832
|
+
const serverSimulationLogsContainerRef = import_react17.default.useRef(null);
|
|
6415
6833
|
const [showInspector, setShowInspector] = useLocalStorageState(
|
|
6416
6834
|
"noya-multiplayer-react-show-inspector",
|
|
6417
6835
|
true
|
|
@@ -6476,6 +6894,10 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6476
6894
|
"noya-multiplayer-react-show-server-simulation-logs",
|
|
6477
6895
|
false
|
|
6478
6896
|
);
|
|
6897
|
+
const [showGit, setShowGit] = useLocalStorageState(
|
|
6898
|
+
"noya-multiplayer-react-show-git",
|
|
6899
|
+
false
|
|
6900
|
+
);
|
|
6479
6901
|
const [showSimulation, setShowSimulation] = useLocalStorageState(
|
|
6480
6902
|
"noya-multiplayer-react-show-simulation",
|
|
6481
6903
|
false
|
|
@@ -6486,7 +6908,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6486
6908
|
paused: connectionEventsPaused,
|
|
6487
6909
|
togglePaused: toggleConnectionEventsPaused
|
|
6488
6910
|
} = usePausedStream(connectionEvents);
|
|
6489
|
-
(0,
|
|
6911
|
+
(0, import_react17.useEffect)(() => {
|
|
6490
6912
|
if (eventsContainerRef.current) {
|
|
6491
6913
|
eventsContainerRef.current.scrollTop = eventsContainerRef.current.scrollHeight;
|
|
6492
6914
|
}
|
|
@@ -6505,13 +6927,13 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6505
6927
|
paused: serverSimulationLogsPaused,
|
|
6506
6928
|
togglePaused: toggleServerSimulationLogsPaused
|
|
6507
6929
|
} = usePausedStream(serverSimulationLogs);
|
|
6508
|
-
(0,
|
|
6930
|
+
(0, import_react17.useEffect)(() => {
|
|
6509
6931
|
if (!showServerLogs) return;
|
|
6510
6932
|
if (serverLogsContainerRef.current) {
|
|
6511
6933
|
serverLogsContainerRef.current.scrollTop = serverLogsContainerRef.current.scrollHeight;
|
|
6512
6934
|
}
|
|
6513
6935
|
}, [showServerLogs, visibleServerLogs]);
|
|
6514
|
-
(0,
|
|
6936
|
+
(0, import_react17.useEffect)(() => {
|
|
6515
6937
|
if (!showServerSimulationLogs) return;
|
|
6516
6938
|
if (serverSimulationLogsContainerRef.current) {
|
|
6517
6939
|
serverSimulationLogsContainerRef.current.scrollTop = serverSimulationLogsContainerRef.current.scrollHeight;
|
|
@@ -6558,11 +6980,11 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6558
6980
|
zIndex: 9999,
|
|
6559
6981
|
lineHeight: "13px"
|
|
6560
6982
|
};
|
|
6561
|
-
const handleExportAll = (0,
|
|
6983
|
+
const handleExportAll = (0, import_react17.useCallback)(async () => {
|
|
6562
6984
|
const buffer = await exportAll(noyaManager);
|
|
6563
6985
|
(0, import_react_utils.downloadBlob)(new Blob([buffer]), "state.zip");
|
|
6564
6986
|
}, [noyaManager]);
|
|
6565
|
-
const handleImportAll = (0,
|
|
6987
|
+
const handleImportAll = (0, import_react17.useCallback)(async () => {
|
|
6566
6988
|
const file = await uploadFile();
|
|
6567
6989
|
const buffer = await file.arrayBuffer();
|
|
6568
6990
|
importAll(buffer, noyaManager, {
|
|
@@ -6575,7 +6997,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6575
6997
|
}, [noyaManager]);
|
|
6576
6998
|
if (!didMount) return null;
|
|
6577
6999
|
if (!showInspector) {
|
|
6578
|
-
return /* @__PURE__ */
|
|
7000
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
6579
7001
|
"div",
|
|
6580
7002
|
{
|
|
6581
7003
|
...props,
|
|
@@ -6587,7 +7009,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6587
7009
|
},
|
|
6588
7010
|
onClick: () => setShowInspector(true)
|
|
6589
7011
|
},
|
|
6590
|
-
/* @__PURE__ */
|
|
7012
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
6591
7013
|
StateInspectorToggleButton,
|
|
6592
7014
|
{
|
|
6593
7015
|
showInspector,
|
|
@@ -6598,7 +7020,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6598
7020
|
)
|
|
6599
7021
|
);
|
|
6600
7022
|
}
|
|
6601
|
-
return /* @__PURE__ */
|
|
7023
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
6602
7024
|
"div",
|
|
6603
7025
|
{
|
|
6604
7026
|
...props,
|
|
@@ -6607,7 +7029,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6607
7029
|
...props.style
|
|
6608
7030
|
}
|
|
6609
7031
|
},
|
|
6610
|
-
/* @__PURE__ */
|
|
7032
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
6611
7033
|
StateInspectorDisclosureSection,
|
|
6612
7034
|
{
|
|
6613
7035
|
isFirst: true,
|
|
@@ -6620,14 +7042,14 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6620
7042
|
maxHeight: "50%",
|
|
6621
7043
|
overflowY: "auto"
|
|
6622
7044
|
},
|
|
6623
|
-
right: /* @__PURE__ */
|
|
7045
|
+
right: /* @__PURE__ */ import_react17.default.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ import_react17.default.createElement(
|
|
6624
7046
|
StateInspectorButton,
|
|
6625
7047
|
{
|
|
6626
7048
|
theme,
|
|
6627
7049
|
onClick: () => setShowUserDetails(!showUserDetails)
|
|
6628
7050
|
},
|
|
6629
7051
|
"Toggle details"
|
|
6630
|
-
), /* @__PURE__ */
|
|
7052
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
6631
7053
|
StateInspectorToggleButton,
|
|
6632
7054
|
{
|
|
6633
7055
|
showInspector,
|
|
@@ -6637,8 +7059,8 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6637
7059
|
}
|
|
6638
7060
|
))
|
|
6639
7061
|
},
|
|
6640
|
-
/* @__PURE__ */
|
|
6641
|
-
return /* @__PURE__ */
|
|
7062
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.filter((user) => showUserDetails || !user.inactive).map((user, index, array) => {
|
|
7063
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
6642
7064
|
StateInspectorRow,
|
|
6643
7065
|
{
|
|
6644
7066
|
key: user.connectionId,
|
|
@@ -6649,7 +7071,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6649
7071
|
opacity: user.inactive ? 0.5 : 1
|
|
6650
7072
|
}
|
|
6651
7073
|
},
|
|
6652
|
-
user.image && /* @__PURE__ */
|
|
7074
|
+
user.image && /* @__PURE__ */ import_react17.default.createElement(
|
|
6653
7075
|
"img",
|
|
6654
7076
|
{
|
|
6655
7077
|
src: user.image,
|
|
@@ -6666,9 +7088,9 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6666
7088
|
}
|
|
6667
7089
|
}
|
|
6668
7090
|
),
|
|
6669
|
-
showUserDetails ? /* @__PURE__ */
|
|
7091
|
+
showUserDetails ? /* @__PURE__ */ import_react17.default.createElement(import_react_inspector7.ObjectInspector, { data: user, theme }) : user.name
|
|
6670
7092
|
);
|
|
6671
|
-
}), !connectedUsers && /* @__PURE__ */
|
|
7093
|
+
}), !connectedUsers && /* @__PURE__ */ import_react17.default.createElement(
|
|
6672
7094
|
"div",
|
|
6673
7095
|
{
|
|
6674
7096
|
style: {
|
|
@@ -6679,13 +7101,13 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6679
7101
|
gap: "4px"
|
|
6680
7102
|
}
|
|
6681
7103
|
},
|
|
6682
|
-
/* @__PURE__ */
|
|
7104
|
+
/* @__PURE__ */ import_react17.default.createElement("span", null, "No connected users")
|
|
6683
7105
|
))
|
|
6684
7106
|
),
|
|
6685
|
-
/* @__PURE__ */
|
|
7107
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
6686
7108
|
StateInspectorDisclosureSection,
|
|
6687
7109
|
{
|
|
6688
|
-
title: /* @__PURE__ */
|
|
7110
|
+
title: /* @__PURE__ */ import_react17.default.createElement(StateInspectorTitleLabel, null, "Data", /* @__PURE__ */ import_react17.default.createElement(
|
|
6689
7111
|
ColoredDot,
|
|
6690
7112
|
{
|
|
6691
7113
|
type: multipeerStateInitialized ? "success" : "error"
|
|
@@ -6694,7 +7116,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6694
7116
|
colorScheme,
|
|
6695
7117
|
setOpen: setShowData,
|
|
6696
7118
|
open: showData,
|
|
6697
|
-
right: /* @__PURE__ */
|
|
7119
|
+
right: /* @__PURE__ */ import_react17.default.createElement(
|
|
6698
7120
|
"span",
|
|
6699
7121
|
{
|
|
6700
7122
|
style: {
|
|
@@ -6702,9 +7124,9 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6702
7124
|
gap: "12px"
|
|
6703
7125
|
}
|
|
6704
7126
|
},
|
|
6705
|
-
/* @__PURE__ */
|
|
6706
|
-
/* @__PURE__ */
|
|
6707
|
-
/* @__PURE__ */
|
|
7127
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorButton, { theme, onClick: handleImportAll }, "Import"),
|
|
7128
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorButton, { theme, onClick: handleExportAll }, "Export"),
|
|
7129
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
6708
7130
|
StateInspectorButton,
|
|
6709
7131
|
{
|
|
6710
7132
|
theme,
|
|
@@ -6716,14 +7138,14 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6716
7138
|
)
|
|
6717
7139
|
)
|
|
6718
7140
|
},
|
|
6719
|
-
/* @__PURE__ */
|
|
7141
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ import_react17.default.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ import_react17.default.createElement(
|
|
6720
7142
|
import_react_inspector7.ObjectInspector,
|
|
6721
7143
|
{
|
|
6722
7144
|
name: multiplayerStateManager.schema ? "state" : void 0,
|
|
6723
7145
|
data: state,
|
|
6724
7146
|
theme
|
|
6725
7147
|
}
|
|
6726
|
-
)), multiplayerStateManager.schema && /* @__PURE__ */
|
|
7148
|
+
)), multiplayerStateManager.schema && /* @__PURE__ */ import_react17.default.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ import_react17.default.createElement(
|
|
6727
7149
|
import_react_inspector7.ObjectInspector,
|
|
6728
7150
|
{
|
|
6729
7151
|
name: "schema",
|
|
@@ -6732,7 +7154,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6732
7154
|
}
|
|
6733
7155
|
)))
|
|
6734
7156
|
),
|
|
6735
|
-
/* @__PURE__ */
|
|
7157
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
6736
7158
|
HistorySection,
|
|
6737
7159
|
{
|
|
6738
7160
|
showHistory,
|
|
@@ -6742,14 +7164,14 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6742
7164
|
multiplayerStateManager
|
|
6743
7165
|
}
|
|
6744
7166
|
),
|
|
6745
|
-
/* @__PURE__ */
|
|
7167
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
6746
7168
|
StateInspectorDisclosureSection,
|
|
6747
7169
|
{
|
|
6748
7170
|
open: showAssets,
|
|
6749
7171
|
setOpen: setShowAssets,
|
|
6750
|
-
title: /* @__PURE__ */
|
|
7172
|
+
title: /* @__PURE__ */ import_react17.default.createElement(StateInspectorTitleLabel, null, "Assets (", assets.length, ")", /* @__PURE__ */ import_react17.default.createElement(ColoredDot, { type: assetsInitialized ? "success" : "error" })),
|
|
6751
7173
|
colorScheme,
|
|
6752
|
-
right: /* @__PURE__ */
|
|
7174
|
+
right: /* @__PURE__ */ import_react17.default.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ import_react17.default.createElement(
|
|
6753
7175
|
StateInspectorButton,
|
|
6754
7176
|
{
|
|
6755
7177
|
theme,
|
|
@@ -6764,7 +7186,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6764
7186
|
}
|
|
6765
7187
|
},
|
|
6766
7188
|
"Delete all"
|
|
6767
|
-
), /* @__PURE__ */
|
|
7189
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
6768
7190
|
StateInspectorButton,
|
|
6769
7191
|
{
|
|
6770
7192
|
theme,
|
|
@@ -6777,54 +7199,69 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6777
7199
|
}
|
|
6778
7200
|
},
|
|
6779
7201
|
"Reload"
|
|
6780
|
-
), /* @__PURE__ */
|
|
7202
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
6781
7203
|
StateInspectorButton,
|
|
6782
7204
|
{
|
|
6783
7205
|
theme,
|
|
6784
|
-
onClick: () => {
|
|
6785
|
-
const
|
|
6786
|
-
|
|
6787
|
-
input.onchange = () => {
|
|
6788
|
-
const file = input.files?.[0];
|
|
6789
|
-
if (file) {
|
|
6790
|
-
const reader = new FileReader();
|
|
6791
|
-
reader.onload = () => {
|
|
6792
|
-
const buffer = reader.result;
|
|
6793
|
-
assetManager.create(new Uint8Array(buffer));
|
|
6794
|
-
};
|
|
6795
|
-
reader.readAsArrayBuffer(file);
|
|
6796
|
-
}
|
|
6797
|
-
};
|
|
6798
|
-
input.click();
|
|
7206
|
+
onClick: async () => {
|
|
7207
|
+
const file = await uploadFile();
|
|
7208
|
+
assetManager.create(file);
|
|
6799
7209
|
}
|
|
6800
7210
|
},
|
|
6801
7211
|
"Upload"
|
|
7212
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
7213
|
+
StateInspectorButton,
|
|
7214
|
+
{
|
|
7215
|
+
theme,
|
|
7216
|
+
onClick: async () => {
|
|
7217
|
+
const file = await uploadFile();
|
|
7218
|
+
assetManager.create({
|
|
7219
|
+
data: new Uint8Array(await file.arrayBuffer()),
|
|
7220
|
+
contentType: file.type,
|
|
7221
|
+
mode: "mutable"
|
|
7222
|
+
});
|
|
7223
|
+
}
|
|
7224
|
+
},
|
|
7225
|
+
"Upload Mutable"
|
|
6802
7226
|
))
|
|
6803
7227
|
},
|
|
6804
|
-
/* @__PURE__ */
|
|
7228
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ import_react17.default.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ import_react17.default.createElement(
|
|
6805
7229
|
import_react_inspector7.ObjectInspector,
|
|
6806
7230
|
{
|
|
6807
7231
|
name: asset.id,
|
|
6808
7232
|
data: truncateAsset(asset),
|
|
6809
7233
|
theme
|
|
6810
7234
|
}
|
|
6811
|
-
), /* @__PURE__ */
|
|
7235
|
+
), /* @__PURE__ */ import_react17.default.createElement("div", { style: { display: "flex", gap: "4px" } }, asset.mode === "mutable" && /* @__PURE__ */ import_react17.default.createElement(
|
|
7236
|
+
StateInspectorButton,
|
|
7237
|
+
{
|
|
7238
|
+
theme,
|
|
7239
|
+
onClick: async () => {
|
|
7240
|
+
const file = await uploadFile();
|
|
7241
|
+
assetManager.update(asset.id, {
|
|
7242
|
+
data: new Uint8Array(await file.arrayBuffer()),
|
|
7243
|
+
contentType: file.type
|
|
7244
|
+
});
|
|
7245
|
+
}
|
|
7246
|
+
},
|
|
7247
|
+
"Replace"
|
|
7248
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
6812
7249
|
StateInspectorButton,
|
|
6813
7250
|
{
|
|
6814
7251
|
theme,
|
|
6815
7252
|
onClick: () => assetManager.delete(asset.id)
|
|
6816
7253
|
},
|
|
6817
7254
|
"Delete"
|
|
6818
|
-
))))
|
|
7255
|
+
)))))
|
|
6819
7256
|
),
|
|
6820
|
-
advanced && /* @__PURE__ */
|
|
7257
|
+
advanced && /* @__PURE__ */ import_react17.default.createElement(
|
|
6821
7258
|
StateInspectorDisclosureSection,
|
|
6822
7259
|
{
|
|
6823
|
-
title: /* @__PURE__ */
|
|
7260
|
+
title: /* @__PURE__ */ import_react17.default.createElement(StateInspectorTitleLabel, null, "Resources (", resources.length, ")", /* @__PURE__ */ import_react17.default.createElement(ColoredDot, { type: resourcesInitialized ? "success" : "error" })),
|
|
6824
7261
|
colorScheme,
|
|
6825
7262
|
open: showResources,
|
|
6826
7263
|
setOpen: setShowResources,
|
|
6827
|
-
right: /* @__PURE__ */
|
|
7264
|
+
right: /* @__PURE__ */ import_react17.default.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ import_react17.default.createElement(
|
|
6828
7265
|
StateInspectorButton,
|
|
6829
7266
|
{
|
|
6830
7267
|
theme,
|
|
@@ -6839,7 +7276,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6839
7276
|
}
|
|
6840
7277
|
},
|
|
6841
7278
|
"Delete all"
|
|
6842
|
-
), /* @__PURE__ */
|
|
7279
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
6843
7280
|
StateInspectorButton,
|
|
6844
7281
|
{
|
|
6845
7282
|
theme,
|
|
@@ -6852,7 +7289,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6852
7289
|
}
|
|
6853
7290
|
},
|
|
6854
7291
|
"Create Directory"
|
|
6855
|
-
), /* @__PURE__ */
|
|
7292
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
6856
7293
|
StateInspectorButton,
|
|
6857
7294
|
{
|
|
6858
7295
|
theme,
|
|
@@ -6872,21 +7309,21 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6872
7309
|
"Create Asset"
|
|
6873
7310
|
))
|
|
6874
7311
|
},
|
|
6875
|
-
/* @__PURE__ */
|
|
7312
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorDisclosureRowInner, null, resources?.map((resource) => /* @__PURE__ */ import_react17.default.createElement(StateInspectorRow, { key: resource.id, colorScheme }, /* @__PURE__ */ import_react17.default.createElement(
|
|
6876
7313
|
import_react_inspector7.ObjectInspector,
|
|
6877
7314
|
{
|
|
6878
7315
|
name: resource.path,
|
|
6879
7316
|
data: resource,
|
|
6880
7317
|
theme
|
|
6881
7318
|
}
|
|
6882
|
-
), /* @__PURE__ */
|
|
7319
|
+
), /* @__PURE__ */ import_react17.default.createElement("div", { style: { display: "flex", gap: "4px" } }, /* @__PURE__ */ import_react17.default.createElement(
|
|
6883
7320
|
StateInspectorButton,
|
|
6884
7321
|
{
|
|
6885
7322
|
theme,
|
|
6886
7323
|
onClick: () => resourceManager.deleteResource({ id: resource.id })
|
|
6887
7324
|
},
|
|
6888
7325
|
"Delete"
|
|
6889
|
-
), /* @__PURE__ */
|
|
7326
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
6890
7327
|
StateInspectorButton,
|
|
6891
7328
|
{
|
|
6892
7329
|
theme,
|
|
@@ -6899,14 +7336,23 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6899
7336
|
"Rename"
|
|
6900
7337
|
)))))
|
|
6901
7338
|
),
|
|
6902
|
-
advanced && /* @__PURE__ */
|
|
7339
|
+
advanced && /* @__PURE__ */ import_react17.default.createElement(
|
|
6903
7340
|
StateInspectorDisclosureSection,
|
|
6904
7341
|
{
|
|
6905
|
-
title: /* @__PURE__ */
|
|
7342
|
+
title: /* @__PURE__ */ import_react17.default.createElement(StateInspectorTitleLabel, null, "Secrets (", secrets.length, ")", /* @__PURE__ */ import_react17.default.createElement(ColoredDot, { type: secretsInitialized ? "success" : "error" })),
|
|
6906
7343
|
colorScheme,
|
|
6907
7344
|
open: showSecrets,
|
|
6908
7345
|
setOpen: setShowSecrets,
|
|
6909
|
-
right: /* @__PURE__ */
|
|
7346
|
+
right: /* @__PURE__ */ import_react17.default.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ import_react17.default.createElement(
|
|
7347
|
+
StateInspectorButton,
|
|
7348
|
+
{
|
|
7349
|
+
theme,
|
|
7350
|
+
onClick: () => {
|
|
7351
|
+
void secretManager.fetchSecrets();
|
|
7352
|
+
}
|
|
7353
|
+
},
|
|
7354
|
+
"Refresh"
|
|
7355
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
6910
7356
|
StateInspectorButton,
|
|
6911
7357
|
{
|
|
6912
7358
|
theme,
|
|
@@ -6919,9 +7365,9 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6919
7365
|
}
|
|
6920
7366
|
},
|
|
6921
7367
|
"Create"
|
|
6922
|
-
)
|
|
7368
|
+
))
|
|
6923
7369
|
},
|
|
6924
|
-
/* @__PURE__ */
|
|
7370
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorDisclosureRowInner, null, secrets.map((secret) => /* @__PURE__ */ import_react17.default.createElement(StateInspectorRow, { key: secret.id, colorScheme }, /* @__PURE__ */ import_react17.default.createElement(import_react_inspector7.ObjectInspector, { data: secret, theme }), /* @__PURE__ */ import_react17.default.createElement(
|
|
6925
7371
|
StateInspectorButton,
|
|
6926
7372
|
{
|
|
6927
7373
|
theme,
|
|
@@ -6930,15 +7376,24 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6930
7376
|
"Delete"
|
|
6931
7377
|
))))
|
|
6932
7378
|
),
|
|
6933
|
-
advanced && /* @__PURE__ */
|
|
7379
|
+
advanced && /* @__PURE__ */ import_react17.default.createElement(
|
|
7380
|
+
GitSection,
|
|
7381
|
+
{
|
|
7382
|
+
showGit,
|
|
7383
|
+
setShowGit,
|
|
7384
|
+
colorScheme,
|
|
7385
|
+
gitManager
|
|
7386
|
+
}
|
|
7387
|
+
),
|
|
7388
|
+
advanced && /* @__PURE__ */ import_react17.default.createElement(
|
|
6934
7389
|
StateInspectorDisclosureSection,
|
|
6935
7390
|
{
|
|
6936
7391
|
open: showInputs,
|
|
6937
7392
|
setOpen: setShowInputs,
|
|
6938
|
-
title: /* @__PURE__ */
|
|
7393
|
+
title: /* @__PURE__ */ import_react17.default.createElement(StateInspectorTitleLabel, null, "Inputs (", inputs.length, ")", /* @__PURE__ */ import_react17.default.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
|
|
6939
7394
|
colorScheme
|
|
6940
7395
|
},
|
|
6941
|
-
/* @__PURE__ */
|
|
7396
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorDisclosureRowInner, null, inputs?.map((input) => /* @__PURE__ */ import_react17.default.createElement(StateInspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ import_react17.default.createElement(import_react_inspector7.ObjectInspector, { data: input, theme }))), !inputs?.length && /* @__PURE__ */ import_react17.default.createElement(
|
|
6942
7397
|
"div",
|
|
6943
7398
|
{
|
|
6944
7399
|
style: {
|
|
@@ -6949,15 +7404,15 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6949
7404
|
gap: "4px"
|
|
6950
7405
|
}
|
|
6951
7406
|
},
|
|
6952
|
-
/* @__PURE__ */
|
|
7407
|
+
/* @__PURE__ */ import_react17.default.createElement("span", null, "No inputs")
|
|
6953
7408
|
))
|
|
6954
7409
|
),
|
|
6955
|
-
advanced && /* @__PURE__ */
|
|
7410
|
+
advanced && /* @__PURE__ */ import_react17.default.createElement(
|
|
6956
7411
|
StateInspectorDisclosureSection,
|
|
6957
7412
|
{
|
|
6958
7413
|
open: showOutputTransforms,
|
|
6959
7414
|
setOpen: setShowOutputTransforms,
|
|
6960
|
-
title: /* @__PURE__ */
|
|
7415
|
+
title: /* @__PURE__ */ import_react17.default.createElement(StateInspectorTitleLabel, null, "Output Transforms (", outputTransforms.length, ")", /* @__PURE__ */ import_react17.default.createElement(
|
|
6961
7416
|
ColoredDot,
|
|
6962
7417
|
{
|
|
6963
7418
|
type: outputTransformsInitialized ? "success" : "error"
|
|
@@ -6965,7 +7420,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6965
7420
|
)),
|
|
6966
7421
|
colorScheme
|
|
6967
7422
|
},
|
|
6968
|
-
/* @__PURE__ */
|
|
7423
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorDisclosureRowInner, null, outputTransforms?.map((transform) => /* @__PURE__ */ import_react17.default.createElement(StateInspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ import_react17.default.createElement(import_react_inspector7.ObjectInspector, { data: transform, theme }))), !outputTransforms?.length && /* @__PURE__ */ import_react17.default.createElement(
|
|
6969
7424
|
"div",
|
|
6970
7425
|
{
|
|
6971
7426
|
style: {
|
|
@@ -6976,10 +7431,10 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6976
7431
|
gap: "4px"
|
|
6977
7432
|
}
|
|
6978
7433
|
},
|
|
6979
|
-
/* @__PURE__ */
|
|
7434
|
+
/* @__PURE__ */ import_react17.default.createElement("span", null, "No output transforms")
|
|
6980
7435
|
))
|
|
6981
7436
|
),
|
|
6982
|
-
advanced && /* @__PURE__ */
|
|
7437
|
+
advanced && /* @__PURE__ */ import_react17.default.createElement(
|
|
6983
7438
|
StateInspectorDisclosureSection,
|
|
6984
7439
|
{
|
|
6985
7440
|
title: "Tasks",
|
|
@@ -6987,7 +7442,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6987
7442
|
open: showTasks,
|
|
6988
7443
|
setOpen: setShowTasks
|
|
6989
7444
|
},
|
|
6990
|
-
/* @__PURE__ */
|
|
7445
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorDisclosureRowInner, null, tasks?.map((task) => /* @__PURE__ */ import_react17.default.createElement(
|
|
6991
7446
|
StateInspectorRow,
|
|
6992
7447
|
{
|
|
6993
7448
|
key: task.id,
|
|
@@ -6996,7 +7451,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
6996
7451
|
backgroundColor: task.status === "done" ? "rgba(0,255,0,0.2)" : task.status === "error" ? "rgba(255,0,0,0.2)" : void 0
|
|
6997
7452
|
}
|
|
6998
7453
|
},
|
|
6999
|
-
/* @__PURE__ */
|
|
7454
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
7000
7455
|
import_react_inspector7.ObjectInspector,
|
|
7001
7456
|
{
|
|
7002
7457
|
name: task.name,
|
|
@@ -7006,7 +7461,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
7006
7461
|
)
|
|
7007
7462
|
)))
|
|
7008
7463
|
),
|
|
7009
|
-
/* @__PURE__ */
|
|
7464
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
7010
7465
|
StateInspectorDisclosureSection,
|
|
7011
7466
|
{
|
|
7012
7467
|
open: showShared,
|
|
@@ -7014,7 +7469,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
7014
7469
|
title: "Shared Connection Data",
|
|
7015
7470
|
colorScheme
|
|
7016
7471
|
},
|
|
7017
|
-
/* @__PURE__ */
|
|
7472
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorDisclosureRowInner, null, Object.entries(shared).map(([key, value]) => /* @__PURE__ */ import_react17.default.createElement(StateInspectorRow, { key, colorScheme }, /* @__PURE__ */ import_react17.default.createElement(
|
|
7018
7473
|
import_react_inspector7.ObjectInspector,
|
|
7019
7474
|
{
|
|
7020
7475
|
name: key,
|
|
@@ -7024,7 +7479,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
7024
7479
|
}
|
|
7025
7480
|
))))
|
|
7026
7481
|
),
|
|
7027
|
-
/* @__PURE__ */
|
|
7482
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
7028
7483
|
ServerScriptLogsSection,
|
|
7029
7484
|
{
|
|
7030
7485
|
colorScheme,
|
|
@@ -7036,7 +7491,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
7036
7491
|
containerRef: serverLogsContainerRef
|
|
7037
7492
|
}
|
|
7038
7493
|
),
|
|
7039
|
-
showSimulationLogsSection && /* @__PURE__ */
|
|
7494
|
+
showSimulationLogsSection && /* @__PURE__ */ import_react17.default.createElement(
|
|
7040
7495
|
ServerScriptLogsSection,
|
|
7041
7496
|
{
|
|
7042
7497
|
title: "Server Script Simulation Logs",
|
|
@@ -7049,7 +7504,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
7049
7504
|
containerRef: serverSimulationLogsContainerRef
|
|
7050
7505
|
}
|
|
7051
7506
|
),
|
|
7052
|
-
/* @__PURE__ */
|
|
7507
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
7053
7508
|
StateInspectorDisclosureSection,
|
|
7054
7509
|
{
|
|
7055
7510
|
open: showSimulation,
|
|
@@ -7057,7 +7512,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
7057
7512
|
title: "Server Simulation",
|
|
7058
7513
|
colorScheme
|
|
7059
7514
|
},
|
|
7060
|
-
/* @__PURE__ */
|
|
7515
|
+
/* @__PURE__ */ import_react17.default.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ import_react17.default.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ import_react17.default.createElement(
|
|
7061
7516
|
import_react_inspector7.ObjectInspector,
|
|
7062
7517
|
{
|
|
7063
7518
|
name: "status",
|
|
@@ -7073,7 +7528,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
7073
7528
|
}
|
|
7074
7529
|
)))
|
|
7075
7530
|
),
|
|
7076
|
-
advanced && /* @__PURE__ */
|
|
7531
|
+
advanced && /* @__PURE__ */ import_react17.default.createElement(
|
|
7077
7532
|
ActivityEventsSection,
|
|
7078
7533
|
{
|
|
7079
7534
|
colorScheme,
|
|
@@ -7083,7 +7538,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
|
|
|
7083
7538
|
activityEventsManager
|
|
7084
7539
|
}
|
|
7085
7540
|
),
|
|
7086
|
-
/* @__PURE__ */
|
|
7541
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
7087
7542
|
EventsSection,
|
|
7088
7543
|
{
|
|
7089
7544
|
connectionEvents: visibleConnectionEvents,
|
|
@@ -7131,7 +7586,7 @@ function useStateInspector({
|
|
|
7131
7586
|
colorScheme,
|
|
7132
7587
|
anchor
|
|
7133
7588
|
}) {
|
|
7134
|
-
const [root, setRoot] =
|
|
7589
|
+
const [root, setRoot] = import_react18.default.useState(null);
|
|
7135
7590
|
(0, import_react_utils2.useIsomorphicLayoutEffect)(() => {
|
|
7136
7591
|
if (disabled) return;
|
|
7137
7592
|
const { root: root2, unmount } = createStateInspectorRoot();
|
|
@@ -7141,7 +7596,7 @@ function useStateInspector({
|
|
|
7141
7596
|
(0, import_react_utils2.useIsomorphicLayoutEffect)(() => {
|
|
7142
7597
|
if (!root) return;
|
|
7143
7598
|
root.render(
|
|
7144
|
-
/* @__PURE__ */
|
|
7599
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
7145
7600
|
StateInspector,
|
|
7146
7601
|
{
|
|
7147
7602
|
colorScheme,
|
|
@@ -7156,18 +7611,18 @@ function useStateInspector({
|
|
|
7156
7611
|
|
|
7157
7612
|
// src/hooks.ts
|
|
7158
7613
|
function useManagedState(createInitialState, options) {
|
|
7159
|
-
const [stateManager] = (0,
|
|
7614
|
+
const [stateManager] = (0, import_react19.useState)(
|
|
7160
7615
|
() => new import_state_manager2.StateManager(createInitialState(), options)
|
|
7161
7616
|
);
|
|
7162
|
-
const getSnapshot = (0,
|
|
7617
|
+
const getSnapshot = (0, import_react19.useCallback)(() => {
|
|
7163
7618
|
return stateManager.getState();
|
|
7164
7619
|
}, [stateManager]);
|
|
7165
|
-
const state = (0,
|
|
7620
|
+
const state = (0, import_react19.useSyncExternalStore)(
|
|
7166
7621
|
stateManager.addListener,
|
|
7167
7622
|
getSnapshot,
|
|
7168
7623
|
getSnapshot
|
|
7169
7624
|
);
|
|
7170
|
-
const setState = (0,
|
|
7625
|
+
const setState = (0, import_react19.useCallback)(
|
|
7171
7626
|
(...args) => {
|
|
7172
7627
|
const [metadata, action] = args.length === 1 ? [void 0, args[0]] : args;
|
|
7173
7628
|
if (metadata === void 0) {
|
|
@@ -7203,7 +7658,7 @@ function useManagedState(createInitialState, options) {
|
|
|
7203
7658
|
return [state, setState, stateManager];
|
|
7204
7659
|
}
|
|
7205
7660
|
function useManagedHistory(stateManager) {
|
|
7206
|
-
return (0,
|
|
7661
|
+
return (0, import_react19.useSyncExternalStore)(
|
|
7207
7662
|
stateManager.historyEmittor.addListener,
|
|
7208
7663
|
stateManager.getHistorySnapshot,
|
|
7209
7664
|
stateManager.getHistorySnapshot
|
|
@@ -7214,7 +7669,7 @@ function useBindNoyaManager(noyaManager, options) {
|
|
|
7214
7669
|
noyaManager.multiplayerStateManager.optimisticState$
|
|
7215
7670
|
);
|
|
7216
7671
|
const assets = useObservable(noyaManager.assetManager.assets$);
|
|
7217
|
-
const extras = (0,
|
|
7672
|
+
const extras = (0, import_react19.useMemo)(() => {
|
|
7218
7673
|
return {
|
|
7219
7674
|
noyaManager,
|
|
7220
7675
|
taskManager: noyaManager.taskManager,
|
|
@@ -7233,8 +7688,8 @@ function useBindNoyaManager(noyaManager, options) {
|
|
|
7233
7688
|
assets
|
|
7234
7689
|
};
|
|
7235
7690
|
}, [noyaManager, assets]);
|
|
7236
|
-
const syncRef = (0,
|
|
7237
|
-
(0,
|
|
7691
|
+
const syncRef = (0, import_react19.useRef)(options?.sync);
|
|
7692
|
+
(0, import_react19.useEffect)(() => {
|
|
7238
7693
|
if (syncRef.current) {
|
|
7239
7694
|
return syncRef.current({ noyaManager });
|
|
7240
7695
|
}
|
|
@@ -7254,7 +7709,7 @@ function useMultiplayerState(initialState, options) {
|
|
|
7254
7709
|
inspector,
|
|
7255
7710
|
...rest
|
|
7256
7711
|
} = options ?? {};
|
|
7257
|
-
const [noyaManager] = (0,
|
|
7712
|
+
const [noyaManager] = (0, import_react19.useState)(
|
|
7258
7713
|
() => new import_state_manager2.NoyaManager(initialState, rest)
|
|
7259
7714
|
);
|
|
7260
7715
|
return useBindNoyaManager(noyaManager, {
|
|
@@ -7264,13 +7719,13 @@ function useMultiplayerState(initialState, options) {
|
|
|
7264
7719
|
}
|
|
7265
7720
|
function useErrorOverlay(noyaManager) {
|
|
7266
7721
|
const unrecoverableError = useObservable(noyaManager.unrecoverableError);
|
|
7267
|
-
(0,
|
|
7722
|
+
(0, import_react19.useEffect)(() => {
|
|
7268
7723
|
if (!unrecoverableError) return;
|
|
7269
7724
|
const el = document.createElement("div");
|
|
7270
7725
|
el.id = "noya-multiplayer-react-error-overlay";
|
|
7271
7726
|
document.body.appendChild(el);
|
|
7272
7727
|
const root = (0, import_client2.createRoot)(el);
|
|
7273
|
-
root.render((0,
|
|
7728
|
+
root.render((0, import_react19.createElement)(ErrorOverlay, { error: unrecoverableError }));
|
|
7274
7729
|
return () => {
|
|
7275
7730
|
root.unmount();
|
|
7276
7731
|
el.remove();
|
|
@@ -7340,11 +7795,13 @@ function getSyncAdapter(params) {
|
|
|
7340
7795
|
offlineStorageKey,
|
|
7341
7796
|
debug,
|
|
7342
7797
|
policyAuthContext,
|
|
7343
|
-
serverScripts
|
|
7798
|
+
serverScripts,
|
|
7799
|
+
git
|
|
7344
7800
|
} = params ?? {};
|
|
7345
7801
|
return (0, import_state_manager3.isEmbeddedApp)() ? (0, import_state_manager3.parentFrameSync)({ debug, policyAuthContext }) : multiplayerUrl ? (0, import_state_manager3.webSocketSync)({ url: multiplayerUrl, debug }) : offlineStorageKey ? (0, import_state_manager3.localStorageSync)({
|
|
7346
7802
|
key: offlineStorageKey,
|
|
7347
|
-
...serverScripts ? { serverScripts } : {}
|
|
7803
|
+
...serverScripts ? { serverScripts } : {},
|
|
7804
|
+
...git ? { git } : {}
|
|
7348
7805
|
}) : (0, import_state_manager3.stubSync)();
|
|
7349
7806
|
}
|
|
7350
7807
|
function useNoyaStateInternal(...args) {
|
|
@@ -7360,12 +7817,12 @@ function useNoyaStateInternal(...args) {
|
|
|
7360
7817
|
isDemo,
|
|
7361
7818
|
access
|
|
7362
7819
|
}
|
|
7363
|
-
] = (0,
|
|
7820
|
+
] = (0, import_react20.useState)(() => {
|
|
7364
7821
|
return getAppData(initialState, options?.schema, {
|
|
7365
7822
|
overrideExistingState: options?.overrideExistingState
|
|
7366
7823
|
});
|
|
7367
7824
|
});
|
|
7368
|
-
const basePolicyAuthContext = (0,
|
|
7825
|
+
const basePolicyAuthContext = (0, import_react20.useMemo)(() => {
|
|
7369
7826
|
if (!access && userId === void 0) return void 0;
|
|
7370
7827
|
const context = {};
|
|
7371
7828
|
if (access) {
|
|
@@ -7376,29 +7833,33 @@ function useNoyaStateInternal(...args) {
|
|
|
7376
7833
|
}
|
|
7377
7834
|
return context;
|
|
7378
7835
|
}, [access, userId]);
|
|
7379
|
-
const sync = (0,
|
|
7836
|
+
const sync = (0, import_react20.useMemo)(() => {
|
|
7380
7837
|
return getSyncAdapter({
|
|
7381
7838
|
multiplayerUrl,
|
|
7382
7839
|
offlineStorageKey: options?.offlineStorageKey,
|
|
7383
7840
|
debug: options?.debug,
|
|
7384
|
-
policyAuthContext: basePolicyAuthContext
|
|
7841
|
+
policyAuthContext: basePolicyAuthContext,
|
|
7842
|
+
serverScripts: options?.serverScripts,
|
|
7843
|
+
git: options?.git
|
|
7385
7844
|
});
|
|
7386
7845
|
}, [
|
|
7387
7846
|
multiplayerUrl,
|
|
7388
7847
|
options?.offlineStorageKey,
|
|
7389
7848
|
options?.debug,
|
|
7390
|
-
basePolicyAuthContext
|
|
7849
|
+
basePolicyAuthContext,
|
|
7850
|
+
options?.serverScripts,
|
|
7851
|
+
options?.git
|
|
7391
7852
|
]);
|
|
7392
|
-
const [noyaManager] = (0,
|
|
7853
|
+
const [noyaManager] = (0, import_react20.useState)(
|
|
7393
7854
|
() => new import_state_manager3.NoyaManager(noyaAppInitialState, options)
|
|
7394
7855
|
);
|
|
7395
|
-
(0,
|
|
7856
|
+
(0, import_react20.useEffect)(() => {
|
|
7396
7857
|
if (!userId) return;
|
|
7397
7858
|
noyaManager.sharedConnectionDataManager.setCurrentConnectionId(userId);
|
|
7398
7859
|
noyaManager.userManager.setCurrentConnectionId(userId);
|
|
7399
7860
|
noyaManager.userManager.setCurrentUserId(userId);
|
|
7400
7861
|
}, [noyaManager, userId]);
|
|
7401
|
-
(0,
|
|
7862
|
+
(0, import_react20.useEffect)(() => {
|
|
7402
7863
|
if (!basePolicyAuthContext) return;
|
|
7403
7864
|
noyaManager.multiplayerStateManager.setPolicyAuthContext(
|
|
7404
7865
|
basePolicyAuthContext
|
|
@@ -7409,7 +7870,7 @@ function useNoyaStateInternal(...args) {
|
|
|
7409
7870
|
sync: options?.sync ?? sync
|
|
7410
7871
|
});
|
|
7411
7872
|
const [, , extras] = result;
|
|
7412
|
-
const mergedExtras = (0,
|
|
7873
|
+
const mergedExtras = (0, import_react20.useMemo)(() => {
|
|
7413
7874
|
return { ...extras, theme, viewType, isDemo };
|
|
7414
7875
|
}, [extras, theme, viewType, isDemo]);
|
|
7415
7876
|
return [result[0], result[1], mergedExtras];
|
|
@@ -7417,7 +7878,7 @@ function useNoyaStateInternal(...args) {
|
|
|
7417
7878
|
|
|
7418
7879
|
// src/singleton.tsx
|
|
7419
7880
|
var import_state_manager4 = require("@noya-app/state-manager");
|
|
7420
|
-
var
|
|
7881
|
+
var import_react21 = __toESM(require("react"));
|
|
7421
7882
|
var noyaManagerSingleton;
|
|
7422
7883
|
var noyaSingletonBindings;
|
|
7423
7884
|
function initializeNoyaSingleton(options) {
|
|
@@ -7461,6 +7922,7 @@ function initializeNoyaSingleton(options) {
|
|
|
7461
7922
|
offlineStorageKey,
|
|
7462
7923
|
debug: managerOptions?.debug,
|
|
7463
7924
|
serverScripts: managerOptions?.serverScripts,
|
|
7925
|
+
git: managerOptions?.git,
|
|
7464
7926
|
policyAuthContext
|
|
7465
7927
|
});
|
|
7466
7928
|
try {
|
|
@@ -7474,7 +7936,7 @@ function initializeNoyaSingleton(options) {
|
|
|
7474
7936
|
if (resolvedInspector) {
|
|
7475
7937
|
const { root } = createStateInspectorRoot();
|
|
7476
7938
|
root.render(
|
|
7477
|
-
/* @__PURE__ */
|
|
7939
|
+
/* @__PURE__ */ import_react21.default.createElement(
|
|
7478
7940
|
StateInspector,
|
|
7479
7941
|
{
|
|
7480
7942
|
noyaManager: noyaManagerSingleton,
|
|
@@ -7575,9 +8037,9 @@ function buildResourcePatchPayload({
|
|
|
7575
8037
|
}
|
|
7576
8038
|
return patch;
|
|
7577
8039
|
}
|
|
7578
|
-
var AnyNoyaStateContext = (0,
|
|
8040
|
+
var AnyNoyaStateContext = (0, import_react22.createContext)(void 0);
|
|
7579
8041
|
function useAnyNoyaStateContext() {
|
|
7580
|
-
const value = (0,
|
|
8042
|
+
const value = (0, import_react22.useContext)(AnyNoyaStateContext);
|
|
7581
8043
|
if (!value) {
|
|
7582
8044
|
const bindings = getNoyaSingletonBindings();
|
|
7583
8045
|
if (bindings) {
|
|
@@ -7611,7 +8073,7 @@ function useAssets() {
|
|
|
7611
8073
|
}
|
|
7612
8074
|
function useAsset(id) {
|
|
7613
8075
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7614
|
-
const observable = (0,
|
|
8076
|
+
const observable = (0, import_react22.useMemo)(
|
|
7615
8077
|
() => noyaManager.assetManager.assets$.map(
|
|
7616
8078
|
(assets) => assets.find((a) => a.stableId === id) ?? assets.find((a) => a.id === id)
|
|
7617
8079
|
),
|
|
@@ -7622,7 +8084,7 @@ function useAsset(id) {
|
|
|
7622
8084
|
function useAssetManager() {
|
|
7623
8085
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7624
8086
|
const isInitialized = useObservable(noyaManager.assetManager.isInitialized$);
|
|
7625
|
-
return (0,
|
|
8087
|
+
return (0, import_react22.useMemo)(
|
|
7626
8088
|
() => ({
|
|
7627
8089
|
create: noyaManager.assetManager.create,
|
|
7628
8090
|
delete: noyaManager.assetManager.delete,
|
|
@@ -7647,7 +8109,7 @@ function useSecret(name) {
|
|
|
7647
8109
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7648
8110
|
return useObservable(
|
|
7649
8111
|
noyaManager.secretManager.secrets$,
|
|
7650
|
-
(0,
|
|
8112
|
+
(0, import_react22.useCallback)((secrets) => secrets.find((s) => s.name === name), [name])
|
|
7651
8113
|
);
|
|
7652
8114
|
}
|
|
7653
8115
|
function useInputs() {
|
|
@@ -7665,7 +8127,7 @@ function useIOManager() {
|
|
|
7665
8127
|
function usePublish(callback) {
|
|
7666
8128
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7667
8129
|
const stableCallback = (0, import_react_utils3.useStableCallback)(callback);
|
|
7668
|
-
(0,
|
|
8130
|
+
(0, import_react22.useEffect)(() => {
|
|
7669
8131
|
noyaManager.publishingManager.setPublishingEnabled(true);
|
|
7670
8132
|
noyaManager.publishingManager.getFilesToPublish = stableCallback;
|
|
7671
8133
|
return () => {
|
|
@@ -7676,7 +8138,7 @@ function usePublish(callback) {
|
|
|
7676
8138
|
}
|
|
7677
8139
|
function useIsInitialized() {
|
|
7678
8140
|
const { noyaManager, viewType } = useAnyNoyaStateContext();
|
|
7679
|
-
const isInitializedObservable = (0,
|
|
8141
|
+
const isInitializedObservable = (0, import_react22.useMemo)(
|
|
7680
8142
|
() => import_observable.Observable.combine(
|
|
7681
8143
|
[
|
|
7682
8144
|
...viewType === "preview" ? [] : [noyaManager.multiplayerStateManager.isInitialized$],
|
|
@@ -7705,7 +8167,7 @@ function useNoyaUser(id) {
|
|
|
7705
8167
|
const userManager = useNoyaUserManager();
|
|
7706
8168
|
return useObservable(
|
|
7707
8169
|
userManager?.allUsers$,
|
|
7708
|
-
(0,
|
|
8170
|
+
(0, import_react22.useCallback)((users) => (0, import_state_manager5.findNoyaUser)(users, id), [id])
|
|
7709
8171
|
);
|
|
7710
8172
|
}
|
|
7711
8173
|
function useNoyaActiveUsers() {
|
|
@@ -7755,7 +8217,7 @@ function useNoyaTranscriptionManager() {
|
|
|
7755
8217
|
}
|
|
7756
8218
|
function useNoyaAssetTranscription(assetId, options) {
|
|
7757
8219
|
const transcriptionManager = useNoyaTranscriptionManager();
|
|
7758
|
-
const observable = (0,
|
|
8220
|
+
const observable = (0, import_react22.useMemo)(() => {
|
|
7759
8221
|
if (!assetId) return void 0;
|
|
7760
8222
|
return transcriptionManager.getAssetTranscription$(assetId, {
|
|
7761
8223
|
endpoint: options?.endpoint,
|
|
@@ -7781,13 +8243,13 @@ function useResources({
|
|
|
7781
8243
|
const assetManager = useAssetManager();
|
|
7782
8244
|
const resourceMap = useObservable(
|
|
7783
8245
|
resourceManager.optimisticResources$,
|
|
7784
|
-
(0,
|
|
8246
|
+
(0, import_react22.useCallback)((resources) => {
|
|
7785
8247
|
return Object.fromEntries(
|
|
7786
8248
|
resources.map((resource) => [resource.path, resource])
|
|
7787
8249
|
);
|
|
7788
8250
|
}, [])
|
|
7789
8251
|
);
|
|
7790
|
-
const setResourceMap = (0,
|
|
8252
|
+
const setResourceMap = (0, import_react22.useCallback)(
|
|
7791
8253
|
async (action) => {
|
|
7792
8254
|
const newResourceMap = action instanceof Function ? action(resourceMap) : action;
|
|
7793
8255
|
const { addedResources, removedResources, modifiedResources } = diffResourceMaps(resourceMap, newResourceMap, "id");
|
|
@@ -7821,9 +8283,9 @@ function useActivityEvents(streamFilter) {
|
|
|
7821
8283
|
);
|
|
7822
8284
|
}
|
|
7823
8285
|
function useActivityEventsForManager(streamFilter, activityEventsManager) {
|
|
7824
|
-
const [streamId, setStreamId] = (0,
|
|
8286
|
+
const [streamId, setStreamId] = (0, import_react22.useState)(void 0);
|
|
7825
8287
|
const stableStreamFilter = (0, import_react_utils3.useJsonMemo)(streamFilter);
|
|
7826
|
-
(0,
|
|
8288
|
+
(0, import_react22.useEffect)(() => {
|
|
7827
8289
|
if (!stableStreamFilter) return;
|
|
7828
8290
|
const streamId2 = activityEventsManager.subscribe(stableStreamFilter);
|
|
7829
8291
|
setStreamId(streamId2);
|
|
@@ -7854,7 +8316,7 @@ function createNoyaContext({
|
|
|
7854
8316
|
children,
|
|
7855
8317
|
contextValue
|
|
7856
8318
|
}) {
|
|
7857
|
-
return /* @__PURE__ */
|
|
8319
|
+
return /* @__PURE__ */ import_react22.default.createElement(AnyNoyaStateContext.Provider, { value: contextValue }, children);
|
|
7858
8320
|
}
|
|
7859
8321
|
function NoyaStateProvider({
|
|
7860
8322
|
children,
|
|
@@ -7869,7 +8331,7 @@ function createNoyaContext({
|
|
|
7869
8331
|
safeEval,
|
|
7870
8332
|
...options
|
|
7871
8333
|
});
|
|
7872
|
-
const contextValue = (0,
|
|
8334
|
+
const contextValue = (0, import_react22.useMemo)(
|
|
7873
8335
|
() => ({
|
|
7874
8336
|
noyaManager,
|
|
7875
8337
|
theme,
|
|
@@ -7877,12 +8339,12 @@ function createNoyaContext({
|
|
|
7877
8339
|
}),
|
|
7878
8340
|
[noyaManager, theme, viewType]
|
|
7879
8341
|
);
|
|
7880
|
-
return /* @__PURE__ */
|
|
8342
|
+
return /* @__PURE__ */ import_react22.default.createElement(NoyaContextProvider, { contextValue }, options.fallback !== void 0 ? /* @__PURE__ */ import_react22.default.createElement(FallbackUntilInitialized, { fallback: options.fallback }, children) : children);
|
|
7881
8343
|
}
|
|
7882
8344
|
function useValue(path2, options) {
|
|
7883
8345
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7884
8346
|
let actualPath = typeof path2 === "function" || !path2 ? "" : path2;
|
|
7885
|
-
const mappedObservable = (0,
|
|
8347
|
+
const mappedObservable = (0, import_react22.useMemo)(() => {
|
|
7886
8348
|
if (typeof path2 === "function") {
|
|
7887
8349
|
return noyaManager.multiplayerStateManager.optimisticState$.map(path2, {
|
|
7888
8350
|
isEqual: options?.isEqual
|
|
@@ -7895,7 +8357,7 @@ function createNoyaContext({
|
|
|
7895
8357
|
}
|
|
7896
8358
|
function useSetValue(path2) {
|
|
7897
8359
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7898
|
-
const setValue = (0,
|
|
8360
|
+
const setValue = (0, import_react22.useCallback)(
|
|
7899
8361
|
(...args) => {
|
|
7900
8362
|
const [metadata, value] = args.length === 2 ? args : [{}, args[0]];
|
|
7901
8363
|
noyaManager.multiplayerStateManager.setStateAtPath(
|
|
@@ -7931,7 +8393,7 @@ function createNoyaContext({
|
|
|
7931
8393
|
}
|
|
7932
8394
|
function useSetLeftMenuItems(leftMenuItems) {
|
|
7933
8395
|
const { menuManager } = useNoyaManager();
|
|
7934
|
-
(0,
|
|
8396
|
+
(0, import_react22.useEffect)(() => {
|
|
7935
8397
|
if (leftMenuItems) {
|
|
7936
8398
|
menuManager.setLeftMenuItems(leftMenuItems);
|
|
7937
8399
|
}
|
|
@@ -7943,7 +8405,7 @@ function createNoyaContext({
|
|
|
7943
8405
|
}
|
|
7944
8406
|
function useSetRightMenuItems(rightMenuItems) {
|
|
7945
8407
|
const { menuManager } = useNoyaManager();
|
|
7946
|
-
(0,
|
|
8408
|
+
(0, import_react22.useEffect)(() => {
|
|
7947
8409
|
if (rightMenuItems) {
|
|
7948
8410
|
menuManager.setRightMenuItems(rightMenuItems);
|
|
7949
8411
|
}
|
|
@@ -7951,19 +8413,19 @@ function createNoyaContext({
|
|
|
7951
8413
|
}
|
|
7952
8414
|
function useHandleMenuItem(callback) {
|
|
7953
8415
|
const { menuManager } = useNoyaManager();
|
|
7954
|
-
(0,
|
|
8416
|
+
(0, import_react22.useEffect)(() => {
|
|
7955
8417
|
return menuManager.addListener(callback);
|
|
7956
8418
|
}, [menuManager, callback]);
|
|
7957
8419
|
}
|
|
7958
8420
|
function useOnSelectMenuItemCallback() {
|
|
7959
8421
|
const { menuManager } = useNoyaManager();
|
|
7960
|
-
return (0,
|
|
8422
|
+
return (0, import_react22.useCallback)((type) => menuManager.emit(type), [menuManager]);
|
|
7961
8423
|
}
|
|
7962
8424
|
function useMenu(options) {
|
|
7963
8425
|
const { leftMenuItems, rightMenuItems, onSelectMenuItem } = options;
|
|
7964
8426
|
useSetLeftMenuItems(leftMenuItems);
|
|
7965
8427
|
useSetRightMenuItems(rightMenuItems);
|
|
7966
|
-
const noop = (0,
|
|
8428
|
+
const noop = (0, import_react22.useCallback)(() => {
|
|
7967
8429
|
}, []);
|
|
7968
8430
|
useHandleMenuItem(onSelectMenuItem ?? noop);
|
|
7969
8431
|
}
|
|
@@ -7990,7 +8452,7 @@ function createNoyaContext({
|
|
|
7990
8452
|
// src/ai.ts
|
|
7991
8453
|
function useRegisterAITool(tool) {
|
|
7992
8454
|
const aiManager = useAIManager();
|
|
7993
|
-
(0,
|
|
8455
|
+
(0, import_react23.useEffect)(() => {
|
|
7994
8456
|
return aiManager.registerTool(tool);
|
|
7995
8457
|
}, [aiManager, tool]);
|
|
7996
8458
|
}
|
|
@@ -8002,7 +8464,7 @@ function useCallableAITools() {
|
|
|
8002
8464
|
// src/components/UserPointersOverlay.tsx
|
|
8003
8465
|
var import_observable2 = require("@noya-app/observable");
|
|
8004
8466
|
var import_react_utils4 = require("@noya-app/react-utils");
|
|
8005
|
-
var
|
|
8467
|
+
var import_react24 = __toESM(require("react"));
|
|
8006
8468
|
function shouldShow(hideAfter, updatedAt) {
|
|
8007
8469
|
return !!updatedAt && Date.now() - updatedAt < hideAfter;
|
|
8008
8470
|
}
|
|
@@ -8012,7 +8474,7 @@ var UserPointerInternal = (0, import_react_utils4.memoGeneric)(function UserPoin
|
|
|
8012
8474
|
hideAfter = 5e3,
|
|
8013
8475
|
renderUserPointer
|
|
8014
8476
|
}) {
|
|
8015
|
-
const observable = (0,
|
|
8477
|
+
const observable = (0, import_react24.useMemo)(() => {
|
|
8016
8478
|
const metadata$ = sharedConnectionDataManager.metadata$.observePath([user.connectionId]).throttle(50);
|
|
8017
8479
|
const data$ = sharedConnectionDataManager.data$.observePath([user.connectionId]).throttle(50);
|
|
8018
8480
|
return import_observable2.Observable.combine([metadata$, data$], ([metadata2, data2]) => {
|
|
@@ -8020,10 +8482,10 @@ var UserPointerInternal = (0, import_react_utils4.memoGeneric)(function UserPoin
|
|
|
8020
8482
|
});
|
|
8021
8483
|
}, [sharedConnectionDataManager, user.connectionId]);
|
|
8022
8484
|
const { metadata, data } = useObservable(observable);
|
|
8023
|
-
const [, setForceUpdate] = (0,
|
|
8485
|
+
const [, setForceUpdate] = (0, import_react24.useState)(0);
|
|
8024
8486
|
const updatedAt = metadata?.updatedAt ?? 0;
|
|
8025
8487
|
const show = shouldShow(hideAfter, updatedAt);
|
|
8026
|
-
(0,
|
|
8488
|
+
(0, import_react24.useEffect)(() => {
|
|
8027
8489
|
if (!show) return;
|
|
8028
8490
|
const timeoutId = setTimeout(() => {
|
|
8029
8491
|
setForceUpdate((prev) => prev + 1);
|
|
@@ -8047,9 +8509,9 @@ var UserPointersOverlay = (0, import_react_utils4.memoGeneric)(function UserPoin
|
|
|
8047
8509
|
sharedConnectionDataManager.currentConnectionId$
|
|
8048
8510
|
);
|
|
8049
8511
|
const connectedUsers = useObservable(userManager.connectedUsers$);
|
|
8050
|
-
return /* @__PURE__ */
|
|
8512
|
+
return /* @__PURE__ */ import_react24.default.createElement(import_react24.default.Fragment, null, connectedUsers.map((user) => {
|
|
8051
8513
|
if (user.connectionId === currentConnectionId) return null;
|
|
8052
|
-
return /* @__PURE__ */
|
|
8514
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
8053
8515
|
UserPointerInternal,
|
|
8054
8516
|
{
|
|
8055
8517
|
key: user.connectionId,
|