@noya-app/noya-multiplayer-react 0.1.77 → 0.1.78
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 +9 -0
- package/dist/index.bundle.js +28 -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.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 useEffect7 } from "react";
|
|
1497
1497
|
|
|
1498
1498
|
// ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
1499
1499
|
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
@@ -3980,6 +3980,10 @@ var activityEventSchema = Type.Object({
|
|
|
3980
3980
|
});
|
|
3981
3981
|
|
|
3982
3982
|
// ../noya-schemas/src/asset.ts
|
|
3983
|
+
var assetModeSchema = Type.Union([
|
|
3984
|
+
Type.Literal("immutable"),
|
|
3985
|
+
Type.Literal("mutable")
|
|
3986
|
+
]);
|
|
3983
3987
|
var assetSchema = Type.Object({
|
|
3984
3988
|
id: Type.String(),
|
|
3985
3989
|
stableId: Type.String(),
|
|
@@ -3989,7 +3993,9 @@ var assetSchema = Type.Object({
|
|
|
3989
3993
|
contentType: Type.Optional(Type.String()),
|
|
3990
3994
|
width: Type.Union([Type.Null(), Type.Number()]),
|
|
3991
3995
|
height: Type.Union([Type.Null(), Type.Number()]),
|
|
3992
|
-
userId: Type.Union([Type.Null(), Type.String()])
|
|
3996
|
+
userId: Type.Union([Type.Null(), Type.String()]),
|
|
3997
|
+
mode: Type.Optional(assetModeSchema),
|
|
3998
|
+
version: Type.Optional(Type.Number())
|
|
3993
3999
|
});
|
|
3994
4000
|
|
|
3995
4001
|
// ../noya-schemas/src/encode.ts
|
|
@@ -4508,6 +4514,9 @@ function getChangedResourceProperties({
|
|
|
4508
4514
|
}
|
|
4509
4515
|
return changed;
|
|
4510
4516
|
}
|
|
4517
|
+
function intersectSets(set1, set2) {
|
|
4518
|
+
return new Set([...set1].filter((item) => set2.has(item)));
|
|
4519
|
+
}
|
|
4511
4520
|
function diffResourceMaps(resourceMap, newResourceMap, idProperty) {
|
|
4512
4521
|
const oldIdToPathMap = new Map(
|
|
4513
4522
|
Object.entries(resourceMap).map(([path2, entity]) => [
|
|
@@ -4527,7 +4536,7 @@ function diffResourceMaps(resourceMap, newResourceMap, idProperty) {
|
|
|
4527
4536
|
const newIds = new Set(
|
|
4528
4537
|
Object.values(newResourceMap).map((entity) => entity[idProperty])
|
|
4529
4538
|
);
|
|
4530
|
-
const sameIds = oldIds
|
|
4539
|
+
const sameIds = intersectSets(oldIds, newIds);
|
|
4531
4540
|
const addedResources = Object.values(newResourceMap).filter(
|
|
4532
4541
|
(entity) => !oldIds.has(entity[idProperty])
|
|
4533
4542
|
);
|
|
@@ -4615,13 +4624,13 @@ import { useJsonMemo, useStableCallback } from "@noya-app/react-utils";
|
|
|
4615
4624
|
import {
|
|
4616
4625
|
findNoyaUser
|
|
4617
4626
|
} from "@noya-app/state-manager";
|
|
4618
|
-
import
|
|
4627
|
+
import React20, {
|
|
4619
4628
|
createContext,
|
|
4620
4629
|
useCallback as useCallback3,
|
|
4621
4630
|
useContext,
|
|
4622
|
-
useEffect as
|
|
4631
|
+
useEffect as useEffect6,
|
|
4623
4632
|
useMemo as useMemo4,
|
|
4624
|
-
useState as
|
|
4633
|
+
useState as useState5
|
|
4625
4634
|
} from "react";
|
|
4626
4635
|
|
|
4627
4636
|
// src/noyaApp.ts
|
|
@@ -4638,7 +4647,7 @@ import {
|
|
|
4638
4647
|
TypeGuard,
|
|
4639
4648
|
webSocketSync
|
|
4640
4649
|
} from "@noya-app/state-manager";
|
|
4641
|
-
import { useEffect as
|
|
4650
|
+
import { useEffect as useEffect5, useMemo as useMemo3, useState as useState4 } from "react";
|
|
4642
4651
|
|
|
4643
4652
|
// src/hooks.ts
|
|
4644
4653
|
import {
|
|
@@ -4649,10 +4658,10 @@ import {
|
|
|
4649
4658
|
import {
|
|
4650
4659
|
createElement as createElement2,
|
|
4651
4660
|
useCallback as useCallback2,
|
|
4652
|
-
useEffect as
|
|
4661
|
+
useEffect as useEffect4,
|
|
4653
4662
|
useMemo as useMemo2,
|
|
4654
|
-
useRef as
|
|
4655
|
-
useState as
|
|
4663
|
+
useRef as useRef3,
|
|
4664
|
+
useState as useState3,
|
|
4656
4665
|
useSyncExternalStore as useSyncExternalStore2
|
|
4657
4666
|
} from "react";
|
|
4658
4667
|
import { createRoot as createRoot2 } from "react-dom/client";
|
|
@@ -4732,7 +4741,7 @@ var ErrorOverlay = React.memo(function ErrorOverlay2({
|
|
|
4732
4741
|
});
|
|
4733
4742
|
|
|
4734
4743
|
// src/inspector/useStateInspector.tsx
|
|
4735
|
-
import
|
|
4744
|
+
import React18 from "react";
|
|
4736
4745
|
import { createRoot } from "react-dom/client";
|
|
4737
4746
|
import { useIsomorphicLayoutEffect } from "@noya-app/react-utils";
|
|
4738
4747
|
|
|
@@ -4866,9 +4875,9 @@ function uuid() {
|
|
|
4866
4875
|
|
|
4867
4876
|
// src/inspector/StateInspector.tsx
|
|
4868
4877
|
import { downloadBlob, memoGeneric } from "@noya-app/react-utils";
|
|
4869
|
-
import
|
|
4878
|
+
import React17, {
|
|
4870
4879
|
useCallback,
|
|
4871
|
-
useEffect as
|
|
4880
|
+
useEffect as useEffect3,
|
|
4872
4881
|
useLayoutEffect
|
|
4873
4882
|
} from "react";
|
|
4874
4883
|
import { ObjectInspector as ObjectInspector5 } from "react-inspector";
|
|
@@ -5337,8 +5346,424 @@ function EventsSection({
|
|
|
5337
5346
|
);
|
|
5338
5347
|
}
|
|
5339
5348
|
|
|
5349
|
+
// src/inspector/sections/GitSection.tsx
|
|
5350
|
+
import React11, { useEffect, useRef, useState as useState2 } from "react";
|
|
5351
|
+
|
|
5352
|
+
// src/inspector/StateInspectorTitleLabel.tsx
|
|
5353
|
+
import React10 from "react";
|
|
5354
|
+
function StateInspectorTitleLabel({
|
|
5355
|
+
children
|
|
5356
|
+
}) {
|
|
5357
|
+
return /* @__PURE__ */ React10.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
|
|
5358
|
+
}
|
|
5359
|
+
|
|
5360
|
+
// src/inspector/sections/GitSection.tsx
|
|
5361
|
+
function GitSection({
|
|
5362
|
+
showGit,
|
|
5363
|
+
setShowGit,
|
|
5364
|
+
colorScheme,
|
|
5365
|
+
gitManager
|
|
5366
|
+
}) {
|
|
5367
|
+
const theme = getStateInspectorTheme(colorScheme);
|
|
5368
|
+
const repos = useObservable(gitManager.repos$);
|
|
5369
|
+
const isInitialized = useObservable(gitManager.isInitialized$);
|
|
5370
|
+
const repoFiles = useObservable(gitManager.repoFiles$);
|
|
5371
|
+
const [focusedRepoId, setFocusedRepoId] = useState2(null);
|
|
5372
|
+
const [editingFile, setEditingFile] = useState2(null);
|
|
5373
|
+
const editHandleRef = useRef(null);
|
|
5374
|
+
const [editContent, setEditContent] = useState2("");
|
|
5375
|
+
const [isEditInitialized, setIsEditInitialized] = useState2(false);
|
|
5376
|
+
const focusedRepo = focusedRepoId ? repos.find((r) => r.id === focusedRepoId) : null;
|
|
5377
|
+
const focusedRepoFilesState = focusedRepoId ? repoFiles[focusedRepoId] : null;
|
|
5378
|
+
const handleFocusRepo = async (repoId) => {
|
|
5379
|
+
if (editHandleRef.current) {
|
|
5380
|
+
editHandleRef.current.close();
|
|
5381
|
+
editHandleRef.current = null;
|
|
5382
|
+
setEditingFile(null);
|
|
5383
|
+
setEditContent("");
|
|
5384
|
+
setIsEditInitialized(false);
|
|
5385
|
+
}
|
|
5386
|
+
setFocusedRepoId(repoId);
|
|
5387
|
+
if (repoId && !repoFiles[repoId]) {
|
|
5388
|
+
await gitManager.fetchRepoFiles(repoId);
|
|
5389
|
+
}
|
|
5390
|
+
};
|
|
5391
|
+
const handleEditFile = (filePath) => {
|
|
5392
|
+
if (!focusedRepoId || !focusedRepoFilesState) return;
|
|
5393
|
+
if (editHandleRef.current) {
|
|
5394
|
+
editHandleRef.current.close();
|
|
5395
|
+
}
|
|
5396
|
+
const handle = gitManager.openEditingHandle(
|
|
5397
|
+
focusedRepoId,
|
|
5398
|
+
filePath,
|
|
5399
|
+
focusedRepoFilesState.ref
|
|
5400
|
+
);
|
|
5401
|
+
editHandleRef.current = handle;
|
|
5402
|
+
setEditingFile(filePath);
|
|
5403
|
+
setIsEditInitialized(false);
|
|
5404
|
+
setEditContent("");
|
|
5405
|
+
};
|
|
5406
|
+
const handleCloseEdit = () => {
|
|
5407
|
+
if (editHandleRef.current) {
|
|
5408
|
+
editHandleRef.current.close();
|
|
5409
|
+
editHandleRef.current = null;
|
|
5410
|
+
}
|
|
5411
|
+
setEditingFile(null);
|
|
5412
|
+
setEditContent("");
|
|
5413
|
+
setIsEditInitialized(false);
|
|
5414
|
+
};
|
|
5415
|
+
useEffect(() => {
|
|
5416
|
+
const handle = editHandleRef.current;
|
|
5417
|
+
if (!handle) return;
|
|
5418
|
+
const unsubContent = handle.content$.subscribe((content) => {
|
|
5419
|
+
setEditContent(content);
|
|
5420
|
+
});
|
|
5421
|
+
const unsubInitialized = handle.isInitialized$.subscribe((initialized) => {
|
|
5422
|
+
setIsEditInitialized(initialized);
|
|
5423
|
+
});
|
|
5424
|
+
return () => {
|
|
5425
|
+
unsubContent();
|
|
5426
|
+
unsubInitialized();
|
|
5427
|
+
};
|
|
5428
|
+
}, [editingFile]);
|
|
5429
|
+
const handleContentChange = (newContent) => {
|
|
5430
|
+
const handle = editHandleRef.current;
|
|
5431
|
+
if (!handle) return;
|
|
5432
|
+
handle.setState(newContent);
|
|
5433
|
+
};
|
|
5434
|
+
const handleBranchChange = async (ref) => {
|
|
5435
|
+
if (focusedRepoId) {
|
|
5436
|
+
await gitManager.fetchRepoFiles(focusedRepoId, ref);
|
|
5437
|
+
}
|
|
5438
|
+
};
|
|
5439
|
+
const handleAddFile = async () => {
|
|
5440
|
+
if (!focusedRepoId || !focusedRepoFilesState) return;
|
|
5441
|
+
const path2 = prompt("Enter file path (e.g., src/index.ts):");
|
|
5442
|
+
if (!path2) return;
|
|
5443
|
+
try {
|
|
5444
|
+
await gitManager.patchFiles(
|
|
5445
|
+
focusedRepoId,
|
|
5446
|
+
{ create: [{ path: path2, content: "" }] },
|
|
5447
|
+
focusedRepoFilesState.ref
|
|
5448
|
+
);
|
|
5449
|
+
} catch (error) {
|
|
5450
|
+
alert(`Failed to create file: ${error}`);
|
|
5451
|
+
}
|
|
5452
|
+
};
|
|
5453
|
+
const handleRenameFile = async (oldPath) => {
|
|
5454
|
+
if (!focusedRepoId || !focusedRepoFilesState) return;
|
|
5455
|
+
const newPath = prompt(`Rename "${oldPath}" to:`, oldPath);
|
|
5456
|
+
if (!newPath || newPath === oldPath) return;
|
|
5457
|
+
try {
|
|
5458
|
+
await gitManager.patchFiles(
|
|
5459
|
+
focusedRepoId,
|
|
5460
|
+
{ rename: [{ oldPath, newPath }] },
|
|
5461
|
+
focusedRepoFilesState.ref
|
|
5462
|
+
);
|
|
5463
|
+
} catch (error) {
|
|
5464
|
+
alert(`Failed to rename file: ${error}`);
|
|
5465
|
+
}
|
|
5466
|
+
};
|
|
5467
|
+
const handleDeleteFile = async (path2) => {
|
|
5468
|
+
if (!focusedRepoId || !focusedRepoFilesState) return;
|
|
5469
|
+
const confirmed = confirm(`Delete "${path2}"?`);
|
|
5470
|
+
if (!confirmed) return;
|
|
5471
|
+
try {
|
|
5472
|
+
await gitManager.patchFiles(
|
|
5473
|
+
focusedRepoId,
|
|
5474
|
+
{ delete: [{ path: path2 }] },
|
|
5475
|
+
focusedRepoFilesState.ref
|
|
5476
|
+
);
|
|
5477
|
+
if (editingFile === path2) {
|
|
5478
|
+
handleCloseEdit();
|
|
5479
|
+
}
|
|
5480
|
+
} catch (error) {
|
|
5481
|
+
alert(`Failed to delete file: ${error}`);
|
|
5482
|
+
}
|
|
5483
|
+
};
|
|
5484
|
+
return /* @__PURE__ */ React11.createElement(
|
|
5485
|
+
StateInspectorDisclosureSection,
|
|
5486
|
+
{
|
|
5487
|
+
open: showGit,
|
|
5488
|
+
setOpen: setShowGit,
|
|
5489
|
+
title: /* @__PURE__ */ React11.createElement(StateInspectorTitleLabel, null, "Git Repos (", repos.length, ")", /* @__PURE__ */ React11.createElement(ColoredDot, { type: isInitialized ? "success" : "error" })),
|
|
5490
|
+
colorScheme,
|
|
5491
|
+
right: /* @__PURE__ */ React11.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React11.createElement(
|
|
5492
|
+
StateInspectorButton,
|
|
5493
|
+
{
|
|
5494
|
+
theme,
|
|
5495
|
+
onClick: async () => {
|
|
5496
|
+
try {
|
|
5497
|
+
await gitManager.initRepo();
|
|
5498
|
+
} catch (error) {
|
|
5499
|
+
console.error("[GitSection] Failed to create repo:", error);
|
|
5500
|
+
}
|
|
5501
|
+
}
|
|
5502
|
+
},
|
|
5503
|
+
"Init Repo"
|
|
5504
|
+
))
|
|
5505
|
+
},
|
|
5506
|
+
/* @__PURE__ */ React11.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React11.createElement("div", { style: { padding: "4px 12px", display: "flex", gap: "4px" } }, /* @__PURE__ */ React11.createElement(
|
|
5507
|
+
"select",
|
|
5508
|
+
{
|
|
5509
|
+
name: "repoSelector",
|
|
5510
|
+
value: focusedRepoId ?? "",
|
|
5511
|
+
style: { flex: "1 1 auto", height: "19px", minWidth: 0 },
|
|
5512
|
+
onChange: (e) => {
|
|
5513
|
+
const value = e.target.value;
|
|
5514
|
+
handleFocusRepo(value || null);
|
|
5515
|
+
}
|
|
5516
|
+
},
|
|
5517
|
+
/* @__PURE__ */ React11.createElement("option", { value: "" }, "Select a repo..."),
|
|
5518
|
+
repos.map((repo) => /* @__PURE__ */ React11.createElement("option", { key: repo.id, value: repo.id }, repo.id))
|
|
5519
|
+
), focusedRepoId && /* @__PURE__ */ React11.createElement(
|
|
5520
|
+
StateInspectorButton,
|
|
5521
|
+
{
|
|
5522
|
+
theme,
|
|
5523
|
+
onClick: () => gitManager.fetchRepoFiles(focusedRepoId)
|
|
5524
|
+
},
|
|
5525
|
+
"Refresh"
|
|
5526
|
+
), /* @__PURE__ */ React11.createElement(
|
|
5527
|
+
"label",
|
|
5528
|
+
{
|
|
5529
|
+
style: {
|
|
5530
|
+
display: "flex",
|
|
5531
|
+
alignItems: "center",
|
|
5532
|
+
gap: "4px",
|
|
5533
|
+
fontSize: "11px",
|
|
5534
|
+
whiteSpace: "nowrap"
|
|
5535
|
+
}
|
|
5536
|
+
},
|
|
5537
|
+
"[Include Content = ",
|
|
5538
|
+
gitManager.includeContent ? "true" : "false",
|
|
5539
|
+
"]"
|
|
5540
|
+
)), focusedRepo && focusedRepoFilesState && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
5541
|
+
"div",
|
|
5542
|
+
{
|
|
5543
|
+
style: {
|
|
5544
|
+
padding: "4px 12px",
|
|
5545
|
+
display: "flex",
|
|
5546
|
+
gap: "8px",
|
|
5547
|
+
alignItems: "center",
|
|
5548
|
+
fontSize: "12px"
|
|
5549
|
+
}
|
|
5550
|
+
},
|
|
5551
|
+
/* @__PURE__ */ React11.createElement("span", { style: { color: theme.BASE_COLOR } }, "Branch:"),
|
|
5552
|
+
focusedRepoFilesState.branches.length > 0 ? /* @__PURE__ */ React11.createElement(
|
|
5553
|
+
"select",
|
|
5554
|
+
{
|
|
5555
|
+
value: focusedRepoFilesState.ref,
|
|
5556
|
+
style: { flex: "1 1 auto", height: "19px" },
|
|
5557
|
+
onChange: (e) => handleBranchChange(e.target.value)
|
|
5558
|
+
},
|
|
5559
|
+
focusedRepoFilesState.branches.map((branch) => /* @__PURE__ */ React11.createElement("option", { key: branch.name, value: branch.name }, branch.name))
|
|
5560
|
+
) : /* @__PURE__ */ React11.createElement("span", { style: { opacity: 0.6, fontStyle: "italic" } }, focusedRepoFilesState.ref || "No branches"),
|
|
5561
|
+
focusedRepoFilesState.oid && /* @__PURE__ */ React11.createElement(
|
|
5562
|
+
"span",
|
|
5563
|
+
{
|
|
5564
|
+
style: {
|
|
5565
|
+
fontFamily: "monospace",
|
|
5566
|
+
fontSize: "10px",
|
|
5567
|
+
opacity: 0.6
|
|
5568
|
+
},
|
|
5569
|
+
title: focusedRepoFilesState.oid
|
|
5570
|
+
},
|
|
5571
|
+
focusedRepoFilesState.oid.slice(0, 7),
|
|
5572
|
+
focusedRepoFilesState.fetchState === "refreshing" && "\u2026"
|
|
5573
|
+
),
|
|
5574
|
+
/* @__PURE__ */ React11.createElement(
|
|
5575
|
+
StateInspectorButton,
|
|
5576
|
+
{
|
|
5577
|
+
theme,
|
|
5578
|
+
onClick: handleAddFile,
|
|
5579
|
+
style: { fontSize: "10px", padding: "2px 6px" }
|
|
5580
|
+
},
|
|
5581
|
+
"+ Add File"
|
|
5582
|
+
)
|
|
5583
|
+
), focusedRepoFilesState.fetchState === "loading" && /* @__PURE__ */ React11.createElement(
|
|
5584
|
+
"div",
|
|
5585
|
+
{
|
|
5586
|
+
style: {
|
|
5587
|
+
padding: "12px",
|
|
5588
|
+
fontSize: "12px"
|
|
5589
|
+
}
|
|
5590
|
+
},
|
|
5591
|
+
"Loading files..."
|
|
5592
|
+
), focusedRepoFilesState.error && /* @__PURE__ */ React11.createElement(
|
|
5593
|
+
"div",
|
|
5594
|
+
{
|
|
5595
|
+
style: {
|
|
5596
|
+
padding: "12px",
|
|
5597
|
+
fontSize: "12px",
|
|
5598
|
+
color: "#f44"
|
|
5599
|
+
}
|
|
5600
|
+
},
|
|
5601
|
+
"Error: ",
|
|
5602
|
+
focusedRepoFilesState.error
|
|
5603
|
+
), focusedRepoFilesState.fetchState !== "loading" && !focusedRepoFilesState.error && focusedRepoFilesState.files.length === 0 && /* @__PURE__ */ React11.createElement(
|
|
5604
|
+
"div",
|
|
5605
|
+
{
|
|
5606
|
+
style: {
|
|
5607
|
+
padding: "12px",
|
|
5608
|
+
fontSize: "12px"
|
|
5609
|
+
}
|
|
5610
|
+
},
|
|
5611
|
+
"No files (empty repo)"
|
|
5612
|
+
), !editingFile && focusedRepoFilesState.files.map((file, index) => {
|
|
5613
|
+
const fileInfo = focusedRepoFilesState.fileContents?.find(
|
|
5614
|
+
(f) => f.path === file
|
|
5615
|
+
);
|
|
5616
|
+
let preview = "";
|
|
5617
|
+
if (fileInfo) {
|
|
5618
|
+
try {
|
|
5619
|
+
const decoded = atob(fileInfo.content);
|
|
5620
|
+
preview = decoded.slice(0, 40).replace(/\n/g, " ").replace(/\s+/g, " ");
|
|
5621
|
+
if (decoded.length > 40) preview += "\u2026";
|
|
5622
|
+
} catch {
|
|
5623
|
+
}
|
|
5624
|
+
}
|
|
5625
|
+
return /* @__PURE__ */ React11.createElement(
|
|
5626
|
+
"div",
|
|
5627
|
+
{
|
|
5628
|
+
key: index,
|
|
5629
|
+
style: {
|
|
5630
|
+
padding: "2px 12px",
|
|
5631
|
+
display: "flex",
|
|
5632
|
+
justifyContent: "space-between",
|
|
5633
|
+
alignItems: "center",
|
|
5634
|
+
gap: "8px",
|
|
5635
|
+
borderBottom: `1px solid ${colorScheme === "light" ? "rgb(223 223 223)" : "rgb(29 29 29)"}`
|
|
5636
|
+
}
|
|
5637
|
+
},
|
|
5638
|
+
/* @__PURE__ */ React11.createElement(
|
|
5639
|
+
"span",
|
|
5640
|
+
{
|
|
5641
|
+
style: {
|
|
5642
|
+
fontFamily: "monospace",
|
|
5643
|
+
fontSize: "11px",
|
|
5644
|
+
overflow: "hidden",
|
|
5645
|
+
textOverflow: "ellipsis",
|
|
5646
|
+
whiteSpace: "nowrap",
|
|
5647
|
+
minWidth: 0,
|
|
5648
|
+
display: "flex",
|
|
5649
|
+
gap: "8px"
|
|
5650
|
+
},
|
|
5651
|
+
title: file
|
|
5652
|
+
},
|
|
5653
|
+
/* @__PURE__ */ React11.createElement("span", null, file),
|
|
5654
|
+
preview && /* @__PURE__ */ React11.createElement("span", { style: { opacity: 0.5 } }, preview)
|
|
5655
|
+
),
|
|
5656
|
+
/* @__PURE__ */ React11.createElement("span", { style: { display: "flex", gap: "4px", flexShrink: 0 } }, /* @__PURE__ */ React11.createElement(
|
|
5657
|
+
StateInspectorButton,
|
|
5658
|
+
{
|
|
5659
|
+
theme,
|
|
5660
|
+
onClick: () => handleEditFile(file),
|
|
5661
|
+
style: { fontSize: "10px", padding: "2px 6px" }
|
|
5662
|
+
},
|
|
5663
|
+
"Edit"
|
|
5664
|
+
), /* @__PURE__ */ React11.createElement(
|
|
5665
|
+
StateInspectorButton,
|
|
5666
|
+
{
|
|
5667
|
+
theme,
|
|
5668
|
+
onClick: () => handleRenameFile(file),
|
|
5669
|
+
style: { fontSize: "10px", padding: "2px 6px" }
|
|
5670
|
+
},
|
|
5671
|
+
"Rename"
|
|
5672
|
+
), /* @__PURE__ */ React11.createElement(
|
|
5673
|
+
StateInspectorButton,
|
|
5674
|
+
{
|
|
5675
|
+
theme,
|
|
5676
|
+
onClick: () => handleDeleteFile(file),
|
|
5677
|
+
style: { fontSize: "10px", padding: "2px 6px" }
|
|
5678
|
+
},
|
|
5679
|
+
"Delete"
|
|
5680
|
+
))
|
|
5681
|
+
);
|
|
5682
|
+
}), editingFile && /* @__PURE__ */ React11.createElement(
|
|
5683
|
+
"div",
|
|
5684
|
+
{
|
|
5685
|
+
style: {
|
|
5686
|
+
padding: "8px 12px",
|
|
5687
|
+
borderTop: `1px solid ${theme.DIVIDER_COLOR}`,
|
|
5688
|
+
flex: "1 1 auto",
|
|
5689
|
+
display: "flex",
|
|
5690
|
+
flexDirection: "column",
|
|
5691
|
+
minHeight: 0
|
|
5692
|
+
}
|
|
5693
|
+
},
|
|
5694
|
+
/* @__PURE__ */ React11.createElement(
|
|
5695
|
+
"div",
|
|
5696
|
+
{
|
|
5697
|
+
style: {
|
|
5698
|
+
display: "flex",
|
|
5699
|
+
justifyContent: "space-between",
|
|
5700
|
+
alignItems: "center",
|
|
5701
|
+
marginBottom: "8px",
|
|
5702
|
+
flexShrink: 0
|
|
5703
|
+
}
|
|
5704
|
+
},
|
|
5705
|
+
/* @__PURE__ */ React11.createElement(
|
|
5706
|
+
"span",
|
|
5707
|
+
{
|
|
5708
|
+
style: {
|
|
5709
|
+
fontFamily: "monospace",
|
|
5710
|
+
fontSize: "11px",
|
|
5711
|
+
fontWeight: "bold"
|
|
5712
|
+
}
|
|
5713
|
+
},
|
|
5714
|
+
editingFile,
|
|
5715
|
+
!isEditInitialized && /* @__PURE__ */ React11.createElement("span", { style: { opacity: 0.5, marginLeft: "8px" } }, "Loading...")
|
|
5716
|
+
),
|
|
5717
|
+
/* @__PURE__ */ React11.createElement(
|
|
5718
|
+
StateInspectorButton,
|
|
5719
|
+
{
|
|
5720
|
+
theme,
|
|
5721
|
+
onClick: handleCloseEdit,
|
|
5722
|
+
style: { fontSize: "10px", padding: "2px 6px" }
|
|
5723
|
+
},
|
|
5724
|
+
"Close"
|
|
5725
|
+
)
|
|
5726
|
+
),
|
|
5727
|
+
/* @__PURE__ */ React11.createElement(
|
|
5728
|
+
"textarea",
|
|
5729
|
+
{
|
|
5730
|
+
value: editContent,
|
|
5731
|
+
onChange: (e) => handleContentChange(e.target.value),
|
|
5732
|
+
disabled: !isEditInitialized,
|
|
5733
|
+
style: {
|
|
5734
|
+
width: "100%",
|
|
5735
|
+
flex: "1 1 auto",
|
|
5736
|
+
minHeight: "100px",
|
|
5737
|
+
fontFamily: "monospace",
|
|
5738
|
+
fontSize: "11px",
|
|
5739
|
+
padding: "8px",
|
|
5740
|
+
border: `1px solid ${theme.DIVIDER_COLOR}`,
|
|
5741
|
+
borderRadius: "4px",
|
|
5742
|
+
backgroundColor: theme.ROW_BACKGROUND,
|
|
5743
|
+
color: theme.BASE_COLOR,
|
|
5744
|
+
resize: "none",
|
|
5745
|
+
boxSizing: "border-box"
|
|
5746
|
+
}
|
|
5747
|
+
}
|
|
5748
|
+
)
|
|
5749
|
+
)), repos.length === 0 && /* @__PURE__ */ React11.createElement(
|
|
5750
|
+
"div",
|
|
5751
|
+
{
|
|
5752
|
+
style: {
|
|
5753
|
+
padding: "12px",
|
|
5754
|
+
fontSize: "12px",
|
|
5755
|
+
display: "flex",
|
|
5756
|
+
flexDirection: "column",
|
|
5757
|
+
gap: "4px"
|
|
5758
|
+
}
|
|
5759
|
+
},
|
|
5760
|
+
/* @__PURE__ */ React11.createElement("span", null, "No git repos")
|
|
5761
|
+
))
|
|
5762
|
+
);
|
|
5763
|
+
}
|
|
5764
|
+
|
|
5340
5765
|
// src/inspector/sections/HistorySection.tsx
|
|
5341
|
-
import
|
|
5766
|
+
import React12, { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
5342
5767
|
import { ObjectInspector as ObjectInspector3 } from "react-inspector";
|
|
5343
5768
|
|
|
5344
5769
|
// src/inspector/utils.ts
|
|
@@ -5394,15 +5819,15 @@ function HistorySection({
|
|
|
5394
5819
|
historySnapshot,
|
|
5395
5820
|
multiplayerStateManager
|
|
5396
5821
|
}) {
|
|
5397
|
-
const ref =
|
|
5822
|
+
const ref = useRef2(null);
|
|
5398
5823
|
const theme = getStateInspectorTheme(colorScheme);
|
|
5399
5824
|
const solidBorderColor = getStateInspectorBorderColor(colorScheme);
|
|
5400
|
-
|
|
5825
|
+
useEffect2(() => {
|
|
5401
5826
|
if (ref.current) {
|
|
5402
5827
|
ref.current.scrollTop = ref.current.scrollHeight;
|
|
5403
5828
|
}
|
|
5404
5829
|
}, [historySnapshot]);
|
|
5405
|
-
|
|
5830
|
+
useEffect2(() => {
|
|
5406
5831
|
if (!ref.current) return;
|
|
5407
5832
|
const historyEntry = ref.current.querySelector(
|
|
5408
5833
|
`#${HISTORY_ELEMENT_PREFIX}${historySnapshot.historyIndex}`
|
|
@@ -5414,14 +5839,14 @@ function HistorySection({
|
|
|
5414
5839
|
});
|
|
5415
5840
|
}
|
|
5416
5841
|
}, [historySnapshot.historyIndex]);
|
|
5417
|
-
return /* @__PURE__ */
|
|
5842
|
+
return /* @__PURE__ */ React12.createElement(
|
|
5418
5843
|
StateInspectorDisclosureSection,
|
|
5419
5844
|
{
|
|
5420
5845
|
open: showHistory,
|
|
5421
5846
|
setOpen: setShowHistory,
|
|
5422
5847
|
title: "History",
|
|
5423
5848
|
colorScheme,
|
|
5424
|
-
right: /* @__PURE__ */
|
|
5849
|
+
right: /* @__PURE__ */ React12.createElement(
|
|
5425
5850
|
"span",
|
|
5426
5851
|
{
|
|
5427
5852
|
style: {
|
|
@@ -5429,7 +5854,7 @@ function HistorySection({
|
|
|
5429
5854
|
gap: "4px"
|
|
5430
5855
|
}
|
|
5431
5856
|
},
|
|
5432
|
-
/* @__PURE__ */
|
|
5857
|
+
/* @__PURE__ */ React12.createElement(
|
|
5433
5858
|
StateInspectorButton,
|
|
5434
5859
|
{
|
|
5435
5860
|
disabled: !historySnapshot.canUndo,
|
|
@@ -5438,7 +5863,7 @@ function HistorySection({
|
|
|
5438
5863
|
multiplayerStateManager.undo();
|
|
5439
5864
|
}
|
|
5440
5865
|
},
|
|
5441
|
-
/* @__PURE__ */
|
|
5866
|
+
/* @__PURE__ */ React12.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ React12.createElement(
|
|
5442
5867
|
"svg",
|
|
5443
5868
|
{
|
|
5444
5869
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5446,7 +5871,7 @@ function HistorySection({
|
|
|
5446
5871
|
height: "1em",
|
|
5447
5872
|
viewBox: "0 0 20 20"
|
|
5448
5873
|
},
|
|
5449
|
-
/* @__PURE__ */
|
|
5874
|
+
/* @__PURE__ */ React12.createElement(
|
|
5450
5875
|
"path",
|
|
5451
5876
|
{
|
|
5452
5877
|
fill: "currentColor",
|
|
@@ -5455,7 +5880,7 @@ function HistorySection({
|
|
|
5455
5880
|
)
|
|
5456
5881
|
))
|
|
5457
5882
|
),
|
|
5458
|
-
/* @__PURE__ */
|
|
5883
|
+
/* @__PURE__ */ React12.createElement(
|
|
5459
5884
|
StateInspectorButton,
|
|
5460
5885
|
{
|
|
5461
5886
|
disabled: !historySnapshot.canRedo,
|
|
@@ -5464,7 +5889,7 @@ function HistorySection({
|
|
|
5464
5889
|
multiplayerStateManager.redo();
|
|
5465
5890
|
}
|
|
5466
5891
|
},
|
|
5467
|
-
/* @__PURE__ */
|
|
5892
|
+
/* @__PURE__ */ React12.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ React12.createElement(
|
|
5468
5893
|
"svg",
|
|
5469
5894
|
{
|
|
5470
5895
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5472,7 +5897,7 @@ function HistorySection({
|
|
|
5472
5897
|
height: "1em",
|
|
5473
5898
|
viewBox: "0 0 20 20"
|
|
5474
5899
|
},
|
|
5475
|
-
/* @__PURE__ */
|
|
5900
|
+
/* @__PURE__ */ React12.createElement(
|
|
5476
5901
|
"path",
|
|
5477
5902
|
{
|
|
5478
5903
|
fill: "currentColor",
|
|
@@ -5483,7 +5908,7 @@ function HistorySection({
|
|
|
5483
5908
|
)
|
|
5484
5909
|
)
|
|
5485
5910
|
},
|
|
5486
|
-
/* @__PURE__ */
|
|
5911
|
+
/* @__PURE__ */ React12.createElement(StateInspectorDisclosureRowInner, { ref }, /* @__PURE__ */ React12.createElement(
|
|
5487
5912
|
"div",
|
|
5488
5913
|
{
|
|
5489
5914
|
id: `${HISTORY_ELEMENT_PREFIX}0`,
|
|
@@ -5497,7 +5922,7 @@ function HistorySection({
|
|
|
5497
5922
|
background: historySnapshot.historyIndex === 0 ? "rgb(59 130 246 / 15%)" : void 0
|
|
5498
5923
|
}
|
|
5499
5924
|
},
|
|
5500
|
-
/* @__PURE__ */
|
|
5925
|
+
/* @__PURE__ */ React12.createElement(
|
|
5501
5926
|
"span",
|
|
5502
5927
|
{
|
|
5503
5928
|
style: {
|
|
@@ -5512,7 +5937,7 @@ function HistorySection({
|
|
|
5512
5937
|
), historySnapshot.history.map((entry, index) => {
|
|
5513
5938
|
const metadata = entry.metadata;
|
|
5514
5939
|
const { id, name, timestamp, ...rest } = metadata;
|
|
5515
|
-
return /* @__PURE__ */
|
|
5940
|
+
return /* @__PURE__ */ React12.createElement(
|
|
5516
5941
|
"div",
|
|
5517
5942
|
{
|
|
5518
5943
|
id: `${HISTORY_ELEMENT_PREFIX}${index + 1}`,
|
|
@@ -5523,7 +5948,7 @@ function HistorySection({
|
|
|
5523
5948
|
background: index + 1 === historySnapshot.historyIndex ? "rgb(59 130 246 / 15%)" : void 0
|
|
5524
5949
|
}
|
|
5525
5950
|
},
|
|
5526
|
-
typeof name === "string" && /* @__PURE__ */
|
|
5951
|
+
typeof name === "string" && /* @__PURE__ */ React12.createElement(
|
|
5527
5952
|
"pre",
|
|
5528
5953
|
{
|
|
5529
5954
|
style: {
|
|
@@ -5534,9 +5959,9 @@ function HistorySection({
|
|
|
5534
5959
|
}
|
|
5535
5960
|
},
|
|
5536
5961
|
entry.metadata.name,
|
|
5537
|
-
Object.keys(rest).length > 0 && /* @__PURE__ */
|
|
5962
|
+
Object.keys(rest).length > 0 && /* @__PURE__ */ React12.createElement(ObjectInspector3, { data: rest, theme })
|
|
5538
5963
|
),
|
|
5539
|
-
entry.redoPatches?.map((patch, j) => /* @__PURE__ */
|
|
5964
|
+
entry.redoPatches?.map((patch, j) => /* @__PURE__ */ React12.createElement(
|
|
5540
5965
|
"pre",
|
|
5541
5966
|
{
|
|
5542
5967
|
key: j,
|
|
@@ -5547,10 +5972,10 @@ function HistorySection({
|
|
|
5547
5972
|
margin: 0
|
|
5548
5973
|
}
|
|
5549
5974
|
},
|
|
5550
|
-
patch.op === "add" && /* @__PURE__ */
|
|
5551
|
-
patch.op === "replace" && /* @__PURE__ */
|
|
5552
|
-
patch.op === "remove" && /* @__PURE__ */
|
|
5553
|
-
patch.op === "move" && /* @__PURE__ */
|
|
5975
|
+
patch.op === "add" && /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ React12.createElement(ObjectInspector3, { data: patch.value, theme })),
|
|
5976
|
+
patch.op === "replace" && /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ React12.createElement(ObjectInspector3, { data: patch.value, theme })),
|
|
5977
|
+
patch.op === "remove" && /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("span", { style: { color: theme.OBJECT_VALUE_STRING_COLOR } }, "delete", " "), /* @__PURE__ */ React12.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path))),
|
|
5978
|
+
patch.op === "move" && /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.from)), " -> ", /* @__PURE__ */ React12.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)))
|
|
5554
5979
|
))
|
|
5555
5980
|
);
|
|
5556
5981
|
}))
|
|
@@ -5558,7 +5983,7 @@ function HistorySection({
|
|
|
5558
5983
|
}
|
|
5559
5984
|
|
|
5560
5985
|
// src/inspector/sections/ServerScriptLogsSection.tsx
|
|
5561
|
-
import
|
|
5986
|
+
import React13 from "react";
|
|
5562
5987
|
import { ObjectInspector as ObjectInspector4 } from "react-inspector";
|
|
5563
5988
|
var levelColors = {
|
|
5564
5989
|
error: "#f87171",
|
|
@@ -5579,16 +6004,16 @@ function ServerScriptLogsSection({
|
|
|
5579
6004
|
title = "Server Script Logs"
|
|
5580
6005
|
}) {
|
|
5581
6006
|
const theme = getStateInspectorTheme(colorScheme);
|
|
5582
|
-
return /* @__PURE__ */
|
|
6007
|
+
return /* @__PURE__ */ React13.createElement(
|
|
5583
6008
|
StateInspectorDisclosureSection,
|
|
5584
6009
|
{
|
|
5585
6010
|
open: showLogs,
|
|
5586
6011
|
setOpen: setShowLogs,
|
|
5587
6012
|
title,
|
|
5588
6013
|
colorScheme,
|
|
5589
|
-
right: /* @__PURE__ */
|
|
6014
|
+
right: /* @__PURE__ */ React13.createElement(StateInspectorButton, { theme, onClick: onTogglePaused }, paused ? "Resume" : "Pause")
|
|
5590
6015
|
},
|
|
5591
|
-
/* @__PURE__ */
|
|
6016
|
+
/* @__PURE__ */ React13.createElement(StateInspectorDisclosureRowInner, { ref: containerRef }, paused && /* @__PURE__ */ React13.createElement(
|
|
5592
6017
|
"div",
|
|
5593
6018
|
{
|
|
5594
6019
|
style: {
|
|
@@ -5598,7 +6023,7 @@ function ServerScriptLogsSection({
|
|
|
5598
6023
|
}
|
|
5599
6024
|
},
|
|
5600
6025
|
"Log streaming paused"
|
|
5601
|
-
), logs.map((log) => /* @__PURE__ */
|
|
6026
|
+
), logs.map((log) => /* @__PURE__ */ React13.createElement(StateInspectorRow, { key: log.id, colorScheme }, /* @__PURE__ */ React13.createElement(
|
|
5602
6027
|
"div",
|
|
5603
6028
|
{
|
|
5604
6029
|
style: {
|
|
@@ -5611,9 +6036,9 @@ function ServerScriptLogsSection({
|
|
|
5611
6036
|
textTransform: "uppercase"
|
|
5612
6037
|
}
|
|
5613
6038
|
},
|
|
5614
|
-
/* @__PURE__ */
|
|
5615
|
-
/* @__PURE__ */
|
|
5616
|
-
(log.origin || log.target || log.mode) && /* @__PURE__ */
|
|
6039
|
+
/* @__PURE__ */ React13.createElement("span", null, formatTimestamp(log.timestamp)),
|
|
6040
|
+
/* @__PURE__ */ React13.createElement("span", { style: { color: levelColors[log.level] } }, log.level),
|
|
6041
|
+
(log.origin || log.target || log.mode) && /* @__PURE__ */ React13.createElement(
|
|
5617
6042
|
"span",
|
|
5618
6043
|
{
|
|
5619
6044
|
style: {
|
|
@@ -5625,7 +6050,7 @@ function ServerScriptLogsSection({
|
|
|
5625
6050
|
},
|
|
5626
6051
|
[log.origin ?? log.target, log.mode].filter(Boolean).join(" / ")
|
|
5627
6052
|
),
|
|
5628
|
-
/* @__PURE__ */
|
|
6053
|
+
/* @__PURE__ */ React13.createElement(
|
|
5629
6054
|
"span",
|
|
5630
6055
|
{
|
|
5631
6056
|
style: {
|
|
@@ -5636,7 +6061,7 @@ function ServerScriptLogsSection({
|
|
|
5636
6061
|
},
|
|
5637
6062
|
log.scriptId
|
|
5638
6063
|
)
|
|
5639
|
-
), /* @__PURE__ */
|
|
6064
|
+
), /* @__PURE__ */ React13.createElement(
|
|
5640
6065
|
"div",
|
|
5641
6066
|
{
|
|
5642
6067
|
style: {
|
|
@@ -5645,15 +6070,15 @@ function ServerScriptLogsSection({
|
|
|
5645
6070
|
gap: "4px"
|
|
5646
6071
|
}
|
|
5647
6072
|
},
|
|
5648
|
-
log.values.length > 0 ? log.values.map((value, index) => /* @__PURE__ */
|
|
6073
|
+
log.values.length > 0 ? log.values.map((value, index) => /* @__PURE__ */ React13.createElement(
|
|
5649
6074
|
ObjectInspector4,
|
|
5650
6075
|
{
|
|
5651
6076
|
key: index,
|
|
5652
6077
|
data: value,
|
|
5653
6078
|
theme
|
|
5654
6079
|
}
|
|
5655
|
-
)) : /* @__PURE__ */
|
|
5656
|
-
))), !logs?.length && /* @__PURE__ */
|
|
6080
|
+
)) : /* @__PURE__ */ React13.createElement("span", { style: { fontSize: "11px", opacity: 0.7 } }, "No data")
|
|
6081
|
+
))), !logs?.length && /* @__PURE__ */ React13.createElement(
|
|
5657
6082
|
"div",
|
|
5658
6083
|
{
|
|
5659
6084
|
style: {
|
|
@@ -5664,7 +6089,7 @@ function ServerScriptLogsSection({
|
|
|
5664
6089
|
gap: "4px"
|
|
5665
6090
|
}
|
|
5666
6091
|
},
|
|
5667
|
-
/* @__PURE__ */
|
|
6092
|
+
/* @__PURE__ */ React13.createElement("span", null, "No logs received")
|
|
5668
6093
|
))
|
|
5669
6094
|
);
|
|
5670
6095
|
}
|
|
@@ -6216,16 +6641,8 @@ function replaceDeep(obj, replacementMap) {
|
|
|
6216
6641
|
}
|
|
6217
6642
|
}
|
|
6218
6643
|
|
|
6219
|
-
// src/inspector/StateInspectorTitleLabel.tsx
|
|
6220
|
-
import React12 from "react";
|
|
6221
|
-
function StateInspectorTitleLabel({
|
|
6222
|
-
children
|
|
6223
|
-
}) {
|
|
6224
|
-
return /* @__PURE__ */ React12.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
|
|
6225
|
-
}
|
|
6226
|
-
|
|
6227
6644
|
// src/inspector/StateInspectorToggleButton.tsx
|
|
6228
|
-
import
|
|
6645
|
+
import React14 from "react";
|
|
6229
6646
|
function StateInspectorToggleButton({
|
|
6230
6647
|
showInspector,
|
|
6231
6648
|
setShowInspector,
|
|
@@ -6233,7 +6650,7 @@ function StateInspectorToggleButton({
|
|
|
6233
6650
|
anchor
|
|
6234
6651
|
}) {
|
|
6235
6652
|
const isRightAnchor = anchor === "right";
|
|
6236
|
-
const rightIcon = /* @__PURE__ */
|
|
6653
|
+
const rightIcon = /* @__PURE__ */ React14.createElement(
|
|
6237
6654
|
"svg",
|
|
6238
6655
|
{
|
|
6239
6656
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6243,7 +6660,7 @@ function StateInspectorToggleButton({
|
|
|
6243
6660
|
stroke: "currentColor",
|
|
6244
6661
|
className: "size-6"
|
|
6245
6662
|
},
|
|
6246
|
-
/* @__PURE__ */
|
|
6663
|
+
/* @__PURE__ */ React14.createElement(
|
|
6247
6664
|
"path",
|
|
6248
6665
|
{
|
|
6249
6666
|
strokeLinecap: "round",
|
|
@@ -6252,7 +6669,7 @@ function StateInspectorToggleButton({
|
|
|
6252
6669
|
}
|
|
6253
6670
|
)
|
|
6254
6671
|
);
|
|
6255
|
-
const leftIcon = /* @__PURE__ */
|
|
6672
|
+
const leftIcon = /* @__PURE__ */ React14.createElement(
|
|
6256
6673
|
"svg",
|
|
6257
6674
|
{
|
|
6258
6675
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6262,7 +6679,7 @@ function StateInspectorToggleButton({
|
|
|
6262
6679
|
stroke: "currentColor",
|
|
6263
6680
|
className: "size-6"
|
|
6264
6681
|
},
|
|
6265
|
-
/* @__PURE__ */
|
|
6682
|
+
/* @__PURE__ */ React14.createElement(
|
|
6266
6683
|
"path",
|
|
6267
6684
|
{
|
|
6268
6685
|
strokeLinecap: "round",
|
|
@@ -6271,7 +6688,7 @@ function StateInspectorToggleButton({
|
|
|
6271
6688
|
}
|
|
6272
6689
|
)
|
|
6273
6690
|
);
|
|
6274
|
-
return /* @__PURE__ */
|
|
6691
|
+
return /* @__PURE__ */ React14.createElement(
|
|
6275
6692
|
"span",
|
|
6276
6693
|
{
|
|
6277
6694
|
role: "button",
|
|
@@ -6292,15 +6709,15 @@ function StateInspectorToggleButton({
|
|
|
6292
6709
|
setShowInspector(!showInspector);
|
|
6293
6710
|
}
|
|
6294
6711
|
},
|
|
6295
|
-
showInspector ? "Hide Inspector" : /* @__PURE__ */
|
|
6712
|
+
showInspector ? "Hide Inspector" : /* @__PURE__ */ React14.createElement("span", { style: { width: "12px", height: "12px" } }, isRightAnchor ? rightIcon : leftIcon)
|
|
6296
6713
|
);
|
|
6297
6714
|
}
|
|
6298
6715
|
|
|
6299
6716
|
// src/inspector/useLocalStorageState.tsx
|
|
6300
|
-
import
|
|
6717
|
+
import React15 from "react";
|
|
6301
6718
|
var localStorage = typeof window !== "undefined" ? window.localStorage : null;
|
|
6302
6719
|
function useLocalStorageState(key, defaultValue) {
|
|
6303
|
-
const [state, setState] =
|
|
6720
|
+
const [state, setState] = React15.useState(() => {
|
|
6304
6721
|
const value = localStorage?.getItem(key);
|
|
6305
6722
|
let result = defaultValue;
|
|
6306
6723
|
if (value) {
|
|
@@ -6320,11 +6737,11 @@ function useLocalStorageState(key, defaultValue) {
|
|
|
6320
6737
|
}
|
|
6321
6738
|
|
|
6322
6739
|
// src/inspector/usePausedStream.ts
|
|
6323
|
-
import
|
|
6740
|
+
import React16 from "react";
|
|
6324
6741
|
function usePausedStream(items) {
|
|
6325
|
-
const [paused, setPaused] =
|
|
6326
|
-
const [visibleItems, setVisibleItems] =
|
|
6327
|
-
const togglePaused =
|
|
6742
|
+
const [paused, setPaused] = React16.useState(false);
|
|
6743
|
+
const [visibleItems, setVisibleItems] = React16.useState(items ?? []);
|
|
6744
|
+
const togglePaused = React16.useCallback(() => {
|
|
6328
6745
|
setPaused((value) => {
|
|
6329
6746
|
if (!value) {
|
|
6330
6747
|
setVisibleItems(items ?? []);
|
|
@@ -6332,7 +6749,7 @@ function usePausedStream(items) {
|
|
|
6332
6749
|
return !value;
|
|
6333
6750
|
});
|
|
6334
6751
|
}, [items]);
|
|
6335
|
-
|
|
6752
|
+
React16.useEffect(() => {
|
|
6336
6753
|
if (paused) return;
|
|
6337
6754
|
setVisibleItems(items ?? []);
|
|
6338
6755
|
}, [items, paused]);
|
|
@@ -6364,19 +6781,20 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6364
6781
|
ioManager,
|
|
6365
6782
|
resourceManager,
|
|
6366
6783
|
activityEventsManager,
|
|
6367
|
-
logManager
|
|
6784
|
+
logManager,
|
|
6785
|
+
gitManager
|
|
6368
6786
|
} = noyaManager;
|
|
6369
|
-
const [didMount, setDidMount] =
|
|
6787
|
+
const [didMount, setDidMount] = React17.useState(false);
|
|
6370
6788
|
const tasks = useObservable(taskManager.tasks$);
|
|
6371
6789
|
const inputs = useObservable(ioManager.inputs$);
|
|
6372
6790
|
const outputTransforms = useObservable(ioManager.outputTransforms$);
|
|
6373
6791
|
useLayoutEffect(() => {
|
|
6374
6792
|
setDidMount(true);
|
|
6375
6793
|
}, []);
|
|
6376
|
-
const eventsContainerRef =
|
|
6377
|
-
const activityEventsContainerRef =
|
|
6378
|
-
const serverLogsContainerRef =
|
|
6379
|
-
const serverSimulationLogsContainerRef =
|
|
6794
|
+
const eventsContainerRef = React17.useRef(null);
|
|
6795
|
+
const activityEventsContainerRef = React17.useRef(null);
|
|
6796
|
+
const serverLogsContainerRef = React17.useRef(null);
|
|
6797
|
+
const serverSimulationLogsContainerRef = React17.useRef(null);
|
|
6380
6798
|
const [showInspector, setShowInspector] = useLocalStorageState(
|
|
6381
6799
|
"noya-multiplayer-react-show-inspector",
|
|
6382
6800
|
true
|
|
@@ -6441,6 +6859,10 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6441
6859
|
"noya-multiplayer-react-show-server-simulation-logs",
|
|
6442
6860
|
false
|
|
6443
6861
|
);
|
|
6862
|
+
const [showGit, setShowGit] = useLocalStorageState(
|
|
6863
|
+
"noya-multiplayer-react-show-git",
|
|
6864
|
+
false
|
|
6865
|
+
);
|
|
6444
6866
|
const [showSimulation, setShowSimulation] = useLocalStorageState(
|
|
6445
6867
|
"noya-multiplayer-react-show-simulation",
|
|
6446
6868
|
false
|
|
@@ -6451,7 +6873,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6451
6873
|
paused: connectionEventsPaused,
|
|
6452
6874
|
togglePaused: toggleConnectionEventsPaused
|
|
6453
6875
|
} = usePausedStream(connectionEvents);
|
|
6454
|
-
|
|
6876
|
+
useEffect3(() => {
|
|
6455
6877
|
if (eventsContainerRef.current) {
|
|
6456
6878
|
eventsContainerRef.current.scrollTop = eventsContainerRef.current.scrollHeight;
|
|
6457
6879
|
}
|
|
@@ -6470,13 +6892,13 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6470
6892
|
paused: serverSimulationLogsPaused,
|
|
6471
6893
|
togglePaused: toggleServerSimulationLogsPaused
|
|
6472
6894
|
} = usePausedStream(serverSimulationLogs);
|
|
6473
|
-
|
|
6895
|
+
useEffect3(() => {
|
|
6474
6896
|
if (!showServerLogs) return;
|
|
6475
6897
|
if (serverLogsContainerRef.current) {
|
|
6476
6898
|
serverLogsContainerRef.current.scrollTop = serverLogsContainerRef.current.scrollHeight;
|
|
6477
6899
|
}
|
|
6478
6900
|
}, [showServerLogs, visibleServerLogs]);
|
|
6479
|
-
|
|
6901
|
+
useEffect3(() => {
|
|
6480
6902
|
if (!showServerSimulationLogs) return;
|
|
6481
6903
|
if (serverSimulationLogsContainerRef.current) {
|
|
6482
6904
|
serverSimulationLogsContainerRef.current.scrollTop = serverSimulationLogsContainerRef.current.scrollHeight;
|
|
@@ -6540,7 +6962,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6540
6962
|
}, [noyaManager]);
|
|
6541
6963
|
if (!didMount) return null;
|
|
6542
6964
|
if (!showInspector) {
|
|
6543
|
-
return /* @__PURE__ */
|
|
6965
|
+
return /* @__PURE__ */ React17.createElement(
|
|
6544
6966
|
"div",
|
|
6545
6967
|
{
|
|
6546
6968
|
...props,
|
|
@@ -6552,7 +6974,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6552
6974
|
},
|
|
6553
6975
|
onClick: () => setShowInspector(true)
|
|
6554
6976
|
},
|
|
6555
|
-
/* @__PURE__ */
|
|
6977
|
+
/* @__PURE__ */ React17.createElement(
|
|
6556
6978
|
StateInspectorToggleButton,
|
|
6557
6979
|
{
|
|
6558
6980
|
showInspector,
|
|
@@ -6563,7 +6985,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6563
6985
|
)
|
|
6564
6986
|
);
|
|
6565
6987
|
}
|
|
6566
|
-
return /* @__PURE__ */
|
|
6988
|
+
return /* @__PURE__ */ React17.createElement(
|
|
6567
6989
|
"div",
|
|
6568
6990
|
{
|
|
6569
6991
|
...props,
|
|
@@ -6572,7 +6994,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6572
6994
|
...props.style
|
|
6573
6995
|
}
|
|
6574
6996
|
},
|
|
6575
|
-
/* @__PURE__ */
|
|
6997
|
+
/* @__PURE__ */ React17.createElement(
|
|
6576
6998
|
StateInspectorDisclosureSection,
|
|
6577
6999
|
{
|
|
6578
7000
|
isFirst: true,
|
|
@@ -6585,14 +7007,14 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6585
7007
|
maxHeight: "50%",
|
|
6586
7008
|
overflowY: "auto"
|
|
6587
7009
|
},
|
|
6588
|
-
right: /* @__PURE__ */
|
|
7010
|
+
right: /* @__PURE__ */ React17.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React17.createElement(
|
|
6589
7011
|
StateInspectorButton,
|
|
6590
7012
|
{
|
|
6591
7013
|
theme,
|
|
6592
7014
|
onClick: () => setShowUserDetails(!showUserDetails)
|
|
6593
7015
|
},
|
|
6594
7016
|
"Toggle details"
|
|
6595
|
-
), /* @__PURE__ */
|
|
7017
|
+
), /* @__PURE__ */ React17.createElement(
|
|
6596
7018
|
StateInspectorToggleButton,
|
|
6597
7019
|
{
|
|
6598
7020
|
showInspector,
|
|
@@ -6602,8 +7024,8 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6602
7024
|
}
|
|
6603
7025
|
))
|
|
6604
7026
|
},
|
|
6605
|
-
/* @__PURE__ */
|
|
6606
|
-
return /* @__PURE__ */
|
|
7027
|
+
/* @__PURE__ */ React17.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.filter((user) => showUserDetails || !user.inactive).map((user, index, array) => {
|
|
7028
|
+
return /* @__PURE__ */ React17.createElement(
|
|
6607
7029
|
StateInspectorRow,
|
|
6608
7030
|
{
|
|
6609
7031
|
key: user.connectionId,
|
|
@@ -6614,7 +7036,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6614
7036
|
opacity: user.inactive ? 0.5 : 1
|
|
6615
7037
|
}
|
|
6616
7038
|
},
|
|
6617
|
-
user.image && /* @__PURE__ */
|
|
7039
|
+
user.image && /* @__PURE__ */ React17.createElement(
|
|
6618
7040
|
"img",
|
|
6619
7041
|
{
|
|
6620
7042
|
src: user.image,
|
|
@@ -6631,9 +7053,9 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6631
7053
|
}
|
|
6632
7054
|
}
|
|
6633
7055
|
),
|
|
6634
|
-
showUserDetails ? /* @__PURE__ */
|
|
7056
|
+
showUserDetails ? /* @__PURE__ */ React17.createElement(ObjectInspector5, { data: user, theme }) : user.name
|
|
6635
7057
|
);
|
|
6636
|
-
}), !connectedUsers && /* @__PURE__ */
|
|
7058
|
+
}), !connectedUsers && /* @__PURE__ */ React17.createElement(
|
|
6637
7059
|
"div",
|
|
6638
7060
|
{
|
|
6639
7061
|
style: {
|
|
@@ -6644,13 +7066,13 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6644
7066
|
gap: "4px"
|
|
6645
7067
|
}
|
|
6646
7068
|
},
|
|
6647
|
-
/* @__PURE__ */
|
|
7069
|
+
/* @__PURE__ */ React17.createElement("span", null, "No connected users")
|
|
6648
7070
|
))
|
|
6649
7071
|
),
|
|
6650
|
-
/* @__PURE__ */
|
|
7072
|
+
/* @__PURE__ */ React17.createElement(
|
|
6651
7073
|
StateInspectorDisclosureSection,
|
|
6652
7074
|
{
|
|
6653
|
-
title: /* @__PURE__ */
|
|
7075
|
+
title: /* @__PURE__ */ React17.createElement(StateInspectorTitleLabel, null, "Data", /* @__PURE__ */ React17.createElement(
|
|
6654
7076
|
ColoredDot,
|
|
6655
7077
|
{
|
|
6656
7078
|
type: multipeerStateInitialized ? "success" : "error"
|
|
@@ -6659,7 +7081,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6659
7081
|
colorScheme,
|
|
6660
7082
|
setOpen: setShowData,
|
|
6661
7083
|
open: showData,
|
|
6662
|
-
right: /* @__PURE__ */
|
|
7084
|
+
right: /* @__PURE__ */ React17.createElement(
|
|
6663
7085
|
"span",
|
|
6664
7086
|
{
|
|
6665
7087
|
style: {
|
|
@@ -6667,9 +7089,9 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6667
7089
|
gap: "12px"
|
|
6668
7090
|
}
|
|
6669
7091
|
},
|
|
6670
|
-
/* @__PURE__ */
|
|
6671
|
-
/* @__PURE__ */
|
|
6672
|
-
/* @__PURE__ */
|
|
7092
|
+
/* @__PURE__ */ React17.createElement(StateInspectorButton, { theme, onClick: handleImportAll }, "Import"),
|
|
7093
|
+
/* @__PURE__ */ React17.createElement(StateInspectorButton, { theme, onClick: handleExportAll }, "Export"),
|
|
7094
|
+
/* @__PURE__ */ React17.createElement(
|
|
6673
7095
|
StateInspectorButton,
|
|
6674
7096
|
{
|
|
6675
7097
|
theme,
|
|
@@ -6681,14 +7103,14 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6681
7103
|
)
|
|
6682
7104
|
)
|
|
6683
7105
|
},
|
|
6684
|
-
/* @__PURE__ */
|
|
7106
|
+
/* @__PURE__ */ React17.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React17.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React17.createElement(
|
|
6685
7107
|
ObjectInspector5,
|
|
6686
7108
|
{
|
|
6687
7109
|
name: multiplayerStateManager.schema ? "state" : void 0,
|
|
6688
7110
|
data: state,
|
|
6689
7111
|
theme
|
|
6690
7112
|
}
|
|
6691
|
-
)), multiplayerStateManager.schema && /* @__PURE__ */
|
|
7113
|
+
)), multiplayerStateManager.schema && /* @__PURE__ */ React17.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React17.createElement(
|
|
6692
7114
|
ObjectInspector5,
|
|
6693
7115
|
{
|
|
6694
7116
|
name: "schema",
|
|
@@ -6697,7 +7119,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6697
7119
|
}
|
|
6698
7120
|
)))
|
|
6699
7121
|
),
|
|
6700
|
-
/* @__PURE__ */
|
|
7122
|
+
/* @__PURE__ */ React17.createElement(
|
|
6701
7123
|
HistorySection,
|
|
6702
7124
|
{
|
|
6703
7125
|
showHistory,
|
|
@@ -6707,14 +7129,14 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6707
7129
|
multiplayerStateManager
|
|
6708
7130
|
}
|
|
6709
7131
|
),
|
|
6710
|
-
/* @__PURE__ */
|
|
7132
|
+
/* @__PURE__ */ React17.createElement(
|
|
6711
7133
|
StateInspectorDisclosureSection,
|
|
6712
7134
|
{
|
|
6713
7135
|
open: showAssets,
|
|
6714
7136
|
setOpen: setShowAssets,
|
|
6715
|
-
title: /* @__PURE__ */
|
|
7137
|
+
title: /* @__PURE__ */ React17.createElement(StateInspectorTitleLabel, null, "Assets (", assets.length, ")", /* @__PURE__ */ React17.createElement(ColoredDot, { type: assetsInitialized ? "success" : "error" })),
|
|
6716
7138
|
colorScheme,
|
|
6717
|
-
right: /* @__PURE__ */
|
|
7139
|
+
right: /* @__PURE__ */ React17.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React17.createElement(
|
|
6718
7140
|
StateInspectorButton,
|
|
6719
7141
|
{
|
|
6720
7142
|
theme,
|
|
@@ -6729,7 +7151,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6729
7151
|
}
|
|
6730
7152
|
},
|
|
6731
7153
|
"Delete all"
|
|
6732
|
-
), /* @__PURE__ */
|
|
7154
|
+
), /* @__PURE__ */ React17.createElement(
|
|
6733
7155
|
StateInspectorButton,
|
|
6734
7156
|
{
|
|
6735
7157
|
theme,
|
|
@@ -6742,54 +7164,69 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6742
7164
|
}
|
|
6743
7165
|
},
|
|
6744
7166
|
"Reload"
|
|
6745
|
-
), /* @__PURE__ */
|
|
7167
|
+
), /* @__PURE__ */ React17.createElement(
|
|
6746
7168
|
StateInspectorButton,
|
|
6747
7169
|
{
|
|
6748
7170
|
theme,
|
|
6749
|
-
onClick: () => {
|
|
6750
|
-
const
|
|
6751
|
-
|
|
6752
|
-
input.onchange = () => {
|
|
6753
|
-
const file = input.files?.[0];
|
|
6754
|
-
if (file) {
|
|
6755
|
-
const reader = new FileReader();
|
|
6756
|
-
reader.onload = () => {
|
|
6757
|
-
const buffer = reader.result;
|
|
6758
|
-
assetManager.create(new Uint8Array(buffer));
|
|
6759
|
-
};
|
|
6760
|
-
reader.readAsArrayBuffer(file);
|
|
6761
|
-
}
|
|
6762
|
-
};
|
|
6763
|
-
input.click();
|
|
7171
|
+
onClick: async () => {
|
|
7172
|
+
const file = await uploadFile();
|
|
7173
|
+
assetManager.create(file);
|
|
6764
7174
|
}
|
|
6765
7175
|
},
|
|
6766
7176
|
"Upload"
|
|
7177
|
+
), /* @__PURE__ */ React17.createElement(
|
|
7178
|
+
StateInspectorButton,
|
|
7179
|
+
{
|
|
7180
|
+
theme,
|
|
7181
|
+
onClick: async () => {
|
|
7182
|
+
const file = await uploadFile();
|
|
7183
|
+
assetManager.create({
|
|
7184
|
+
data: new Uint8Array(await file.arrayBuffer()),
|
|
7185
|
+
contentType: file.type,
|
|
7186
|
+
mode: "mutable"
|
|
7187
|
+
});
|
|
7188
|
+
}
|
|
7189
|
+
},
|
|
7190
|
+
"Upload Mutable"
|
|
6767
7191
|
))
|
|
6768
7192
|
},
|
|
6769
|
-
/* @__PURE__ */
|
|
7193
|
+
/* @__PURE__ */ React17.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ React17.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ React17.createElement(
|
|
6770
7194
|
ObjectInspector5,
|
|
6771
7195
|
{
|
|
6772
7196
|
name: asset.id,
|
|
6773
7197
|
data: truncateAsset(asset),
|
|
6774
7198
|
theme
|
|
6775
7199
|
}
|
|
6776
|
-
), /* @__PURE__ */
|
|
7200
|
+
), /* @__PURE__ */ React17.createElement("div", { style: { display: "flex", gap: "4px" } }, asset.mode === "mutable" && /* @__PURE__ */ React17.createElement(
|
|
7201
|
+
StateInspectorButton,
|
|
7202
|
+
{
|
|
7203
|
+
theme,
|
|
7204
|
+
onClick: async () => {
|
|
7205
|
+
const file = await uploadFile();
|
|
7206
|
+
assetManager.update(asset.id, {
|
|
7207
|
+
data: new Uint8Array(await file.arrayBuffer()),
|
|
7208
|
+
contentType: file.type
|
|
7209
|
+
});
|
|
7210
|
+
}
|
|
7211
|
+
},
|
|
7212
|
+
"Replace"
|
|
7213
|
+
), /* @__PURE__ */ React17.createElement(
|
|
6777
7214
|
StateInspectorButton,
|
|
6778
7215
|
{
|
|
6779
7216
|
theme,
|
|
6780
7217
|
onClick: () => assetManager.delete(asset.id)
|
|
6781
7218
|
},
|
|
6782
7219
|
"Delete"
|
|
6783
|
-
))))
|
|
7220
|
+
)))))
|
|
6784
7221
|
),
|
|
6785
|
-
advanced && /* @__PURE__ */
|
|
7222
|
+
advanced && /* @__PURE__ */ React17.createElement(
|
|
6786
7223
|
StateInspectorDisclosureSection,
|
|
6787
7224
|
{
|
|
6788
|
-
title: /* @__PURE__ */
|
|
7225
|
+
title: /* @__PURE__ */ React17.createElement(StateInspectorTitleLabel, null, "Resources (", resources.length, ")", /* @__PURE__ */ React17.createElement(ColoredDot, { type: resourcesInitialized ? "success" : "error" })),
|
|
6789
7226
|
colorScheme,
|
|
6790
7227
|
open: showResources,
|
|
6791
7228
|
setOpen: setShowResources,
|
|
6792
|
-
right: /* @__PURE__ */
|
|
7229
|
+
right: /* @__PURE__ */ React17.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React17.createElement(
|
|
6793
7230
|
StateInspectorButton,
|
|
6794
7231
|
{
|
|
6795
7232
|
theme,
|
|
@@ -6804,7 +7241,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6804
7241
|
}
|
|
6805
7242
|
},
|
|
6806
7243
|
"Delete all"
|
|
6807
|
-
), /* @__PURE__ */
|
|
7244
|
+
), /* @__PURE__ */ React17.createElement(
|
|
6808
7245
|
StateInspectorButton,
|
|
6809
7246
|
{
|
|
6810
7247
|
theme,
|
|
@@ -6817,7 +7254,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6817
7254
|
}
|
|
6818
7255
|
},
|
|
6819
7256
|
"Create Directory"
|
|
6820
|
-
), /* @__PURE__ */
|
|
7257
|
+
), /* @__PURE__ */ React17.createElement(
|
|
6821
7258
|
StateInspectorButton,
|
|
6822
7259
|
{
|
|
6823
7260
|
theme,
|
|
@@ -6837,21 +7274,21 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6837
7274
|
"Create Asset"
|
|
6838
7275
|
))
|
|
6839
7276
|
},
|
|
6840
|
-
/* @__PURE__ */
|
|
7277
|
+
/* @__PURE__ */ React17.createElement(StateInspectorDisclosureRowInner, null, resources?.map((resource) => /* @__PURE__ */ React17.createElement(StateInspectorRow, { key: resource.id, colorScheme }, /* @__PURE__ */ React17.createElement(
|
|
6841
7278
|
ObjectInspector5,
|
|
6842
7279
|
{
|
|
6843
7280
|
name: resource.path,
|
|
6844
7281
|
data: resource,
|
|
6845
7282
|
theme
|
|
6846
7283
|
}
|
|
6847
|
-
), /* @__PURE__ */
|
|
7284
|
+
), /* @__PURE__ */ React17.createElement("div", { style: { display: "flex", gap: "4px" } }, /* @__PURE__ */ React17.createElement(
|
|
6848
7285
|
StateInspectorButton,
|
|
6849
7286
|
{
|
|
6850
7287
|
theme,
|
|
6851
7288
|
onClick: () => resourceManager.deleteResource({ id: resource.id })
|
|
6852
7289
|
},
|
|
6853
7290
|
"Delete"
|
|
6854
|
-
), /* @__PURE__ */
|
|
7291
|
+
), /* @__PURE__ */ React17.createElement(
|
|
6855
7292
|
StateInspectorButton,
|
|
6856
7293
|
{
|
|
6857
7294
|
theme,
|
|
@@ -6864,14 +7301,23 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6864
7301
|
"Rename"
|
|
6865
7302
|
)))))
|
|
6866
7303
|
),
|
|
6867
|
-
advanced && /* @__PURE__ */
|
|
7304
|
+
advanced && /* @__PURE__ */ React17.createElement(
|
|
6868
7305
|
StateInspectorDisclosureSection,
|
|
6869
7306
|
{
|
|
6870
|
-
title: /* @__PURE__ */
|
|
7307
|
+
title: /* @__PURE__ */ React17.createElement(StateInspectorTitleLabel, null, "Secrets (", secrets.length, ")", /* @__PURE__ */ React17.createElement(ColoredDot, { type: secretsInitialized ? "success" : "error" })),
|
|
6871
7308
|
colorScheme,
|
|
6872
7309
|
open: showSecrets,
|
|
6873
7310
|
setOpen: setShowSecrets,
|
|
6874
|
-
right: /* @__PURE__ */
|
|
7311
|
+
right: /* @__PURE__ */ React17.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React17.createElement(
|
|
7312
|
+
StateInspectorButton,
|
|
7313
|
+
{
|
|
7314
|
+
theme,
|
|
7315
|
+
onClick: () => {
|
|
7316
|
+
void secretManager.fetchSecrets();
|
|
7317
|
+
}
|
|
7318
|
+
},
|
|
7319
|
+
"Refresh"
|
|
7320
|
+
), /* @__PURE__ */ React17.createElement(
|
|
6875
7321
|
StateInspectorButton,
|
|
6876
7322
|
{
|
|
6877
7323
|
theme,
|
|
@@ -6884,9 +7330,9 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6884
7330
|
}
|
|
6885
7331
|
},
|
|
6886
7332
|
"Create"
|
|
6887
|
-
)
|
|
7333
|
+
))
|
|
6888
7334
|
},
|
|
6889
|
-
/* @__PURE__ */
|
|
7335
|
+
/* @__PURE__ */ React17.createElement(StateInspectorDisclosureRowInner, null, secrets.map((secret) => /* @__PURE__ */ React17.createElement(StateInspectorRow, { key: secret.id, colorScheme }, /* @__PURE__ */ React17.createElement(ObjectInspector5, { data: secret, theme }), /* @__PURE__ */ React17.createElement(
|
|
6890
7336
|
StateInspectorButton,
|
|
6891
7337
|
{
|
|
6892
7338
|
theme,
|
|
@@ -6895,15 +7341,24 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6895
7341
|
"Delete"
|
|
6896
7342
|
))))
|
|
6897
7343
|
),
|
|
6898
|
-
advanced && /* @__PURE__ */
|
|
7344
|
+
advanced && /* @__PURE__ */ React17.createElement(
|
|
7345
|
+
GitSection,
|
|
7346
|
+
{
|
|
7347
|
+
showGit,
|
|
7348
|
+
setShowGit,
|
|
7349
|
+
colorScheme,
|
|
7350
|
+
gitManager
|
|
7351
|
+
}
|
|
7352
|
+
),
|
|
7353
|
+
advanced && /* @__PURE__ */ React17.createElement(
|
|
6899
7354
|
StateInspectorDisclosureSection,
|
|
6900
7355
|
{
|
|
6901
7356
|
open: showInputs,
|
|
6902
7357
|
setOpen: setShowInputs,
|
|
6903
|
-
title: /* @__PURE__ */
|
|
7358
|
+
title: /* @__PURE__ */ React17.createElement(StateInspectorTitleLabel, null, "Inputs (", inputs.length, ")", /* @__PURE__ */ React17.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
|
|
6904
7359
|
colorScheme
|
|
6905
7360
|
},
|
|
6906
|
-
/* @__PURE__ */
|
|
7361
|
+
/* @__PURE__ */ React17.createElement(StateInspectorDisclosureRowInner, null, inputs?.map((input) => /* @__PURE__ */ React17.createElement(StateInspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ React17.createElement(ObjectInspector5, { data: input, theme }))), !inputs?.length && /* @__PURE__ */ React17.createElement(
|
|
6907
7362
|
"div",
|
|
6908
7363
|
{
|
|
6909
7364
|
style: {
|
|
@@ -6914,15 +7369,15 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6914
7369
|
gap: "4px"
|
|
6915
7370
|
}
|
|
6916
7371
|
},
|
|
6917
|
-
/* @__PURE__ */
|
|
7372
|
+
/* @__PURE__ */ React17.createElement("span", null, "No inputs")
|
|
6918
7373
|
))
|
|
6919
7374
|
),
|
|
6920
|
-
advanced && /* @__PURE__ */
|
|
7375
|
+
advanced && /* @__PURE__ */ React17.createElement(
|
|
6921
7376
|
StateInspectorDisclosureSection,
|
|
6922
7377
|
{
|
|
6923
7378
|
open: showOutputTransforms,
|
|
6924
7379
|
setOpen: setShowOutputTransforms,
|
|
6925
|
-
title: /* @__PURE__ */
|
|
7380
|
+
title: /* @__PURE__ */ React17.createElement(StateInspectorTitleLabel, null, "Output Transforms (", outputTransforms.length, ")", /* @__PURE__ */ React17.createElement(
|
|
6926
7381
|
ColoredDot,
|
|
6927
7382
|
{
|
|
6928
7383
|
type: outputTransformsInitialized ? "success" : "error"
|
|
@@ -6930,7 +7385,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6930
7385
|
)),
|
|
6931
7386
|
colorScheme
|
|
6932
7387
|
},
|
|
6933
|
-
/* @__PURE__ */
|
|
7388
|
+
/* @__PURE__ */ React17.createElement(StateInspectorDisclosureRowInner, null, outputTransforms?.map((transform) => /* @__PURE__ */ React17.createElement(StateInspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ React17.createElement(ObjectInspector5, { data: transform, theme }))), !outputTransforms?.length && /* @__PURE__ */ React17.createElement(
|
|
6934
7389
|
"div",
|
|
6935
7390
|
{
|
|
6936
7391
|
style: {
|
|
@@ -6941,10 +7396,10 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6941
7396
|
gap: "4px"
|
|
6942
7397
|
}
|
|
6943
7398
|
},
|
|
6944
|
-
/* @__PURE__ */
|
|
7399
|
+
/* @__PURE__ */ React17.createElement("span", null, "No output transforms")
|
|
6945
7400
|
))
|
|
6946
7401
|
),
|
|
6947
|
-
advanced && /* @__PURE__ */
|
|
7402
|
+
advanced && /* @__PURE__ */ React17.createElement(
|
|
6948
7403
|
StateInspectorDisclosureSection,
|
|
6949
7404
|
{
|
|
6950
7405
|
title: "Tasks",
|
|
@@ -6952,7 +7407,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6952
7407
|
open: showTasks,
|
|
6953
7408
|
setOpen: setShowTasks
|
|
6954
7409
|
},
|
|
6955
|
-
/* @__PURE__ */
|
|
7410
|
+
/* @__PURE__ */ React17.createElement(StateInspectorDisclosureRowInner, null, tasks?.map((task) => /* @__PURE__ */ React17.createElement(
|
|
6956
7411
|
StateInspectorRow,
|
|
6957
7412
|
{
|
|
6958
7413
|
key: task.id,
|
|
@@ -6961,7 +7416,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6961
7416
|
backgroundColor: task.status === "done" ? "rgba(0,255,0,0.2)" : task.status === "error" ? "rgba(255,0,0,0.2)" : void 0
|
|
6962
7417
|
}
|
|
6963
7418
|
},
|
|
6964
|
-
/* @__PURE__ */
|
|
7419
|
+
/* @__PURE__ */ React17.createElement(
|
|
6965
7420
|
ObjectInspector5,
|
|
6966
7421
|
{
|
|
6967
7422
|
name: task.name,
|
|
@@ -6971,7 +7426,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6971
7426
|
)
|
|
6972
7427
|
)))
|
|
6973
7428
|
),
|
|
6974
|
-
/* @__PURE__ */
|
|
7429
|
+
/* @__PURE__ */ React17.createElement(
|
|
6975
7430
|
StateInspectorDisclosureSection,
|
|
6976
7431
|
{
|
|
6977
7432
|
open: showShared,
|
|
@@ -6979,7 +7434,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6979
7434
|
title: "Shared Connection Data",
|
|
6980
7435
|
colorScheme
|
|
6981
7436
|
},
|
|
6982
|
-
/* @__PURE__ */
|
|
7437
|
+
/* @__PURE__ */ React17.createElement(StateInspectorDisclosureRowInner, null, Object.entries(shared).map(([key, value]) => /* @__PURE__ */ React17.createElement(StateInspectorRow, { key, colorScheme }, /* @__PURE__ */ React17.createElement(
|
|
6983
7438
|
ObjectInspector5,
|
|
6984
7439
|
{
|
|
6985
7440
|
name: key,
|
|
@@ -6989,7 +7444,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
6989
7444
|
}
|
|
6990
7445
|
))))
|
|
6991
7446
|
),
|
|
6992
|
-
/* @__PURE__ */
|
|
7447
|
+
/* @__PURE__ */ React17.createElement(
|
|
6993
7448
|
ServerScriptLogsSection,
|
|
6994
7449
|
{
|
|
6995
7450
|
colorScheme,
|
|
@@ -7001,7 +7456,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
7001
7456
|
containerRef: serverLogsContainerRef
|
|
7002
7457
|
}
|
|
7003
7458
|
),
|
|
7004
|
-
showSimulationLogsSection && /* @__PURE__ */
|
|
7459
|
+
showSimulationLogsSection && /* @__PURE__ */ React17.createElement(
|
|
7005
7460
|
ServerScriptLogsSection,
|
|
7006
7461
|
{
|
|
7007
7462
|
title: "Server Script Simulation Logs",
|
|
@@ -7014,7 +7469,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
7014
7469
|
containerRef: serverSimulationLogsContainerRef
|
|
7015
7470
|
}
|
|
7016
7471
|
),
|
|
7017
|
-
/* @__PURE__ */
|
|
7472
|
+
/* @__PURE__ */ React17.createElement(
|
|
7018
7473
|
StateInspectorDisclosureSection,
|
|
7019
7474
|
{
|
|
7020
7475
|
open: showSimulation,
|
|
@@ -7022,7 +7477,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
7022
7477
|
title: "Server Simulation",
|
|
7023
7478
|
colorScheme
|
|
7024
7479
|
},
|
|
7025
|
-
/* @__PURE__ */
|
|
7480
|
+
/* @__PURE__ */ React17.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React17.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React17.createElement(
|
|
7026
7481
|
ObjectInspector5,
|
|
7027
7482
|
{
|
|
7028
7483
|
name: "status",
|
|
@@ -7038,7 +7493,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
7038
7493
|
}
|
|
7039
7494
|
)))
|
|
7040
7495
|
),
|
|
7041
|
-
advanced && /* @__PURE__ */
|
|
7496
|
+
advanced && /* @__PURE__ */ React17.createElement(
|
|
7042
7497
|
ActivityEventsSection,
|
|
7043
7498
|
{
|
|
7044
7499
|
colorScheme,
|
|
@@ -7048,7 +7503,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
7048
7503
|
activityEventsManager
|
|
7049
7504
|
}
|
|
7050
7505
|
),
|
|
7051
|
-
/* @__PURE__ */
|
|
7506
|
+
/* @__PURE__ */ React17.createElement(
|
|
7052
7507
|
EventsSection,
|
|
7053
7508
|
{
|
|
7054
7509
|
connectionEvents: visibleConnectionEvents,
|
|
@@ -7096,7 +7551,7 @@ function useStateInspector({
|
|
|
7096
7551
|
colorScheme,
|
|
7097
7552
|
anchor
|
|
7098
7553
|
}) {
|
|
7099
|
-
const [root, setRoot] =
|
|
7554
|
+
const [root, setRoot] = React18.useState(null);
|
|
7100
7555
|
useIsomorphicLayoutEffect(() => {
|
|
7101
7556
|
if (disabled) return;
|
|
7102
7557
|
const { root: root2, unmount } = createStateInspectorRoot();
|
|
@@ -7106,7 +7561,7 @@ function useStateInspector({
|
|
|
7106
7561
|
useIsomorphicLayoutEffect(() => {
|
|
7107
7562
|
if (!root) return;
|
|
7108
7563
|
root.render(
|
|
7109
|
-
/* @__PURE__ */
|
|
7564
|
+
/* @__PURE__ */ React18.createElement(
|
|
7110
7565
|
StateInspector,
|
|
7111
7566
|
{
|
|
7112
7567
|
colorScheme,
|
|
@@ -7121,7 +7576,7 @@ function useStateInspector({
|
|
|
7121
7576
|
|
|
7122
7577
|
// src/hooks.ts
|
|
7123
7578
|
function useManagedState(createInitialState, options) {
|
|
7124
|
-
const [stateManager] =
|
|
7579
|
+
const [stateManager] = useState3(
|
|
7125
7580
|
() => new StateManager(createInitialState(), options)
|
|
7126
7581
|
);
|
|
7127
7582
|
const getSnapshot = useCallback2(() => {
|
|
@@ -7198,8 +7653,8 @@ function useBindNoyaManager(noyaManager, options) {
|
|
|
7198
7653
|
assets
|
|
7199
7654
|
};
|
|
7200
7655
|
}, [noyaManager, assets]);
|
|
7201
|
-
const syncRef =
|
|
7202
|
-
|
|
7656
|
+
const syncRef = useRef3(options?.sync);
|
|
7657
|
+
useEffect4(() => {
|
|
7203
7658
|
if (syncRef.current) {
|
|
7204
7659
|
return syncRef.current({ noyaManager });
|
|
7205
7660
|
}
|
|
@@ -7219,7 +7674,7 @@ function useMultiplayerState(initialState, options) {
|
|
|
7219
7674
|
inspector,
|
|
7220
7675
|
...rest
|
|
7221
7676
|
} = options ?? {};
|
|
7222
|
-
const [noyaManager] =
|
|
7677
|
+
const [noyaManager] = useState3(
|
|
7223
7678
|
() => new NoyaManager2(initialState, rest)
|
|
7224
7679
|
);
|
|
7225
7680
|
return useBindNoyaManager(noyaManager, {
|
|
@@ -7229,7 +7684,7 @@ function useMultiplayerState(initialState, options) {
|
|
|
7229
7684
|
}
|
|
7230
7685
|
function useErrorOverlay(noyaManager) {
|
|
7231
7686
|
const unrecoverableError = useObservable(noyaManager.unrecoverableError);
|
|
7232
|
-
|
|
7687
|
+
useEffect4(() => {
|
|
7233
7688
|
if (!unrecoverableError) return;
|
|
7234
7689
|
const el = document.createElement("div");
|
|
7235
7690
|
el.id = "noya-multiplayer-react-error-overlay";
|
|
@@ -7305,11 +7760,13 @@ function getSyncAdapter(params) {
|
|
|
7305
7760
|
offlineStorageKey,
|
|
7306
7761
|
debug,
|
|
7307
7762
|
policyAuthContext,
|
|
7308
|
-
serverScripts
|
|
7763
|
+
serverScripts,
|
|
7764
|
+
git
|
|
7309
7765
|
} = params ?? {};
|
|
7310
7766
|
return isEmbeddedApp() ? parentFrameSync({ debug, policyAuthContext }) : multiplayerUrl ? webSocketSync({ url: multiplayerUrl, debug }) : offlineStorageKey ? localStorageSync({
|
|
7311
7767
|
key: offlineStorageKey,
|
|
7312
|
-
...serverScripts ? { serverScripts } : {}
|
|
7768
|
+
...serverScripts ? { serverScripts } : {},
|
|
7769
|
+
...git ? { git } : {}
|
|
7313
7770
|
}) : stubSync2();
|
|
7314
7771
|
}
|
|
7315
7772
|
function useNoyaStateInternal(...args) {
|
|
@@ -7325,7 +7782,7 @@ function useNoyaStateInternal(...args) {
|
|
|
7325
7782
|
isDemo,
|
|
7326
7783
|
access
|
|
7327
7784
|
}
|
|
7328
|
-
] =
|
|
7785
|
+
] = useState4(() => {
|
|
7329
7786
|
return getAppData(initialState, options?.schema, {
|
|
7330
7787
|
overrideExistingState: options?.overrideExistingState
|
|
7331
7788
|
});
|
|
@@ -7346,24 +7803,28 @@ function useNoyaStateInternal(...args) {
|
|
|
7346
7803
|
multiplayerUrl,
|
|
7347
7804
|
offlineStorageKey: options?.offlineStorageKey,
|
|
7348
7805
|
debug: options?.debug,
|
|
7349
|
-
policyAuthContext: basePolicyAuthContext
|
|
7806
|
+
policyAuthContext: basePolicyAuthContext,
|
|
7807
|
+
serverScripts: options?.serverScripts,
|
|
7808
|
+
git: options?.git
|
|
7350
7809
|
});
|
|
7351
7810
|
}, [
|
|
7352
7811
|
multiplayerUrl,
|
|
7353
7812
|
options?.offlineStorageKey,
|
|
7354
7813
|
options?.debug,
|
|
7355
|
-
basePolicyAuthContext
|
|
7814
|
+
basePolicyAuthContext,
|
|
7815
|
+
options?.serverScripts,
|
|
7816
|
+
options?.git
|
|
7356
7817
|
]);
|
|
7357
|
-
const [noyaManager] =
|
|
7818
|
+
const [noyaManager] = useState4(
|
|
7358
7819
|
() => new NoyaManager3(noyaAppInitialState, options)
|
|
7359
7820
|
);
|
|
7360
|
-
|
|
7821
|
+
useEffect5(() => {
|
|
7361
7822
|
if (!userId) return;
|
|
7362
7823
|
noyaManager.sharedConnectionDataManager.setCurrentConnectionId(userId);
|
|
7363
7824
|
noyaManager.userManager.setCurrentConnectionId(userId);
|
|
7364
7825
|
noyaManager.userManager.setCurrentUserId(userId);
|
|
7365
7826
|
}, [noyaManager, userId]);
|
|
7366
|
-
|
|
7827
|
+
useEffect5(() => {
|
|
7367
7828
|
if (!basePolicyAuthContext) return;
|
|
7368
7829
|
noyaManager.multiplayerStateManager.setPolicyAuthContext(
|
|
7369
7830
|
basePolicyAuthContext
|
|
@@ -7384,7 +7845,7 @@ function useNoyaStateInternal(...args) {
|
|
|
7384
7845
|
import {
|
|
7385
7846
|
NoyaManager as NoyaManager4
|
|
7386
7847
|
} from "@noya-app/state-manager";
|
|
7387
|
-
import
|
|
7848
|
+
import React19 from "react";
|
|
7388
7849
|
var noyaManagerSingleton;
|
|
7389
7850
|
var noyaSingletonBindings;
|
|
7390
7851
|
function initializeNoyaSingleton(options) {
|
|
@@ -7428,6 +7889,7 @@ function initializeNoyaSingleton(options) {
|
|
|
7428
7889
|
offlineStorageKey,
|
|
7429
7890
|
debug: managerOptions?.debug,
|
|
7430
7891
|
serverScripts: managerOptions?.serverScripts,
|
|
7892
|
+
git: managerOptions?.git,
|
|
7431
7893
|
policyAuthContext
|
|
7432
7894
|
});
|
|
7433
7895
|
try {
|
|
@@ -7441,7 +7903,7 @@ function initializeNoyaSingleton(options) {
|
|
|
7441
7903
|
if (resolvedInspector) {
|
|
7442
7904
|
const { root } = createStateInspectorRoot();
|
|
7443
7905
|
root.render(
|
|
7444
|
-
/* @__PURE__ */
|
|
7906
|
+
/* @__PURE__ */ React19.createElement(
|
|
7445
7907
|
StateInspector,
|
|
7446
7908
|
{
|
|
7447
7909
|
noyaManager: noyaManagerSingleton,
|
|
@@ -7632,7 +8094,7 @@ function useIOManager() {
|
|
|
7632
8094
|
function usePublish(callback) {
|
|
7633
8095
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
7634
8096
|
const stableCallback = useStableCallback(callback);
|
|
7635
|
-
|
|
8097
|
+
useEffect6(() => {
|
|
7636
8098
|
noyaManager.publishingManager.setPublishingEnabled(true);
|
|
7637
8099
|
noyaManager.publishingManager.getFilesToPublish = stableCallback;
|
|
7638
8100
|
return () => {
|
|
@@ -7788,9 +8250,9 @@ function useActivityEvents(streamFilter) {
|
|
|
7788
8250
|
);
|
|
7789
8251
|
}
|
|
7790
8252
|
function useActivityEventsForManager(streamFilter, activityEventsManager) {
|
|
7791
|
-
const [streamId, setStreamId] =
|
|
8253
|
+
const [streamId, setStreamId] = useState5(void 0);
|
|
7792
8254
|
const stableStreamFilter = useJsonMemo(streamFilter);
|
|
7793
|
-
|
|
8255
|
+
useEffect6(() => {
|
|
7794
8256
|
if (!stableStreamFilter) return;
|
|
7795
8257
|
const streamId2 = activityEventsManager.subscribe(stableStreamFilter);
|
|
7796
8258
|
setStreamId(streamId2);
|
|
@@ -7821,7 +8283,7 @@ function createNoyaContext({
|
|
|
7821
8283
|
children,
|
|
7822
8284
|
contextValue
|
|
7823
8285
|
}) {
|
|
7824
|
-
return /* @__PURE__ */
|
|
8286
|
+
return /* @__PURE__ */ React20.createElement(AnyNoyaStateContext.Provider, { value: contextValue }, children);
|
|
7825
8287
|
}
|
|
7826
8288
|
function NoyaStateProvider({
|
|
7827
8289
|
children,
|
|
@@ -7844,7 +8306,7 @@ function createNoyaContext({
|
|
|
7844
8306
|
}),
|
|
7845
8307
|
[noyaManager, theme, viewType]
|
|
7846
8308
|
);
|
|
7847
|
-
return /* @__PURE__ */
|
|
8309
|
+
return /* @__PURE__ */ React20.createElement(NoyaContextProvider, { contextValue }, options.fallback !== void 0 ? /* @__PURE__ */ React20.createElement(FallbackUntilInitialized, { fallback: options.fallback }, children) : children);
|
|
7848
8310
|
}
|
|
7849
8311
|
function useValue(path2, options) {
|
|
7850
8312
|
const { noyaManager } = useAnyNoyaStateContext();
|
|
@@ -7898,7 +8360,7 @@ function createNoyaContext({
|
|
|
7898
8360
|
}
|
|
7899
8361
|
function useSetLeftMenuItems(leftMenuItems) {
|
|
7900
8362
|
const { menuManager } = useNoyaManager();
|
|
7901
|
-
|
|
8363
|
+
useEffect6(() => {
|
|
7902
8364
|
if (leftMenuItems) {
|
|
7903
8365
|
menuManager.setLeftMenuItems(leftMenuItems);
|
|
7904
8366
|
}
|
|
@@ -7910,7 +8372,7 @@ function createNoyaContext({
|
|
|
7910
8372
|
}
|
|
7911
8373
|
function useSetRightMenuItems(rightMenuItems) {
|
|
7912
8374
|
const { menuManager } = useNoyaManager();
|
|
7913
|
-
|
|
8375
|
+
useEffect6(() => {
|
|
7914
8376
|
if (rightMenuItems) {
|
|
7915
8377
|
menuManager.setRightMenuItems(rightMenuItems);
|
|
7916
8378
|
}
|
|
@@ -7918,7 +8380,7 @@ function createNoyaContext({
|
|
|
7918
8380
|
}
|
|
7919
8381
|
function useHandleMenuItem(callback) {
|
|
7920
8382
|
const { menuManager } = useNoyaManager();
|
|
7921
|
-
|
|
8383
|
+
useEffect6(() => {
|
|
7922
8384
|
return menuManager.addListener(callback);
|
|
7923
8385
|
}, [menuManager, callback]);
|
|
7924
8386
|
}
|
|
@@ -7957,7 +8419,7 @@ function createNoyaContext({
|
|
|
7957
8419
|
// src/ai.ts
|
|
7958
8420
|
function useRegisterAITool(tool) {
|
|
7959
8421
|
const aiManager = useAIManager();
|
|
7960
|
-
|
|
8422
|
+
useEffect7(() => {
|
|
7961
8423
|
return aiManager.registerTool(tool);
|
|
7962
8424
|
}, [aiManager, tool]);
|
|
7963
8425
|
}
|
|
@@ -7969,7 +8431,7 @@ function useCallableAITools() {
|
|
|
7969
8431
|
// src/components/UserPointersOverlay.tsx
|
|
7970
8432
|
import { Observable as Observable2 } from "@noya-app/observable";
|
|
7971
8433
|
import { memoGeneric as memoGeneric2 } from "@noya-app/react-utils";
|
|
7972
|
-
import
|
|
8434
|
+
import React21, { useEffect as useEffect8, useMemo as useMemo5, useState as useState6 } from "react";
|
|
7973
8435
|
function shouldShow(hideAfter, updatedAt) {
|
|
7974
8436
|
return !!updatedAt && Date.now() - updatedAt < hideAfter;
|
|
7975
8437
|
}
|
|
@@ -7987,10 +8449,10 @@ var UserPointerInternal = memoGeneric2(function UserPointerInternal2({
|
|
|
7987
8449
|
});
|
|
7988
8450
|
}, [sharedConnectionDataManager, user.connectionId]);
|
|
7989
8451
|
const { metadata, data } = useObservable(observable);
|
|
7990
|
-
const [, setForceUpdate] =
|
|
8452
|
+
const [, setForceUpdate] = useState6(0);
|
|
7991
8453
|
const updatedAt = metadata?.updatedAt ?? 0;
|
|
7992
8454
|
const show = shouldShow(hideAfter, updatedAt);
|
|
7993
|
-
|
|
8455
|
+
useEffect8(() => {
|
|
7994
8456
|
if (!show) return;
|
|
7995
8457
|
const timeoutId = setTimeout(() => {
|
|
7996
8458
|
setForceUpdate((prev) => prev + 1);
|
|
@@ -8014,9 +8476,9 @@ var UserPointersOverlay = memoGeneric2(function UserPointers({
|
|
|
8014
8476
|
sharedConnectionDataManager.currentConnectionId$
|
|
8015
8477
|
);
|
|
8016
8478
|
const connectedUsers = useObservable(userManager.connectedUsers$);
|
|
8017
|
-
return /* @__PURE__ */
|
|
8479
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, connectedUsers.map((user) => {
|
|
8018
8480
|
if (user.connectionId === currentConnectionId) return null;
|
|
8019
|
-
return /* @__PURE__ */
|
|
8481
|
+
return /* @__PURE__ */ React21.createElement(
|
|
8020
8482
|
UserPointerInternal,
|
|
8021
8483
|
{
|
|
8022
8484
|
key: user.connectionId,
|