@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noya-app/noya-multiplayer-react",
3
- "version": "0.1.77",
3
+ "version": "0.1.79",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -11,11 +11,11 @@
11
11
  "dev": "npm run build -- --watch"
12
12
  },
13
13
  "dependencies": {
14
- "@noya-app/state-manager": "0.1.61",
14
+ "@noya-app/state-manager": "0.1.63",
15
15
  "@noya-app/emitter": "0.1.0",
16
16
  "@noya-app/observable": "0.1.12",
17
17
  "@noya-app/task-runner": "0.1.6",
18
- "@noya-app/react-utils": "0.1.28",
18
+ "@noya-app/react-utils": "0.1.29",
19
19
  "react-inspector": "6.0.2"
20
20
  },
21
21
  "peerDependencies": {
@@ -22,6 +22,7 @@ import {
22
22
  } from "./inspectorTheme";
23
23
  import { ActivityEventsSection } from "./sections/ActivityEventsSection";
24
24
  import { EventsSection } from "./sections/EventsSection";
25
+ import { GitSection } from "./sections/GitSection";
25
26
  import { HistorySection } from "./sections/HistorySection";
26
27
  import { ServerScriptLogsSection } from "./sections/ServerScriptLogsSection";
27
28
  import { exportAll, importAll } from "./serialization";
@@ -79,6 +80,7 @@ export const StateInspector = memoGeneric(function StateInspector<
79
80
  resourceManager,
80
81
  activityEventsManager,
81
82
  logManager,
83
+ gitManager,
82
84
  } = noyaManager;
83
85
 
84
86
  const [didMount, setDidMount] = React.useState(false);
@@ -160,6 +162,10 @@ export const StateInspector = memoGeneric(function StateInspector<
160
162
  "noya-multiplayer-react-show-server-simulation-logs",
161
163
  false
162
164
  );
165
+ const [showGit, setShowGit] = useLocalStorageState(
166
+ "noya-multiplayer-react-show-git",
167
+ false
168
+ );
163
169
  const [showSimulation, setShowSimulation] = useLocalStorageState(
164
170
  "noya-multiplayer-react-show-simulation",
165
171
  false
@@ -495,26 +501,26 @@ export const StateInspector = memoGeneric(function StateInspector<
495
501
  </StateInspectorButton>
496
502
  <StateInspectorButton
497
503
  theme={theme}
498
- onClick={() => {
499
- // get file input
500
- const input = document.createElement("input");
501
- input.type = "file";
502
- input.onchange = () => {
503
- const file = input.files?.[0];
504
- if (file) {
505
- const reader = new FileReader();
506
- reader.onload = () => {
507
- const buffer = reader.result as ArrayBuffer;
508
- assetManager.create(new Uint8Array(buffer));
509
- };
510
- reader.readAsArrayBuffer(file);
511
- }
512
- };
513
- input.click();
504
+ onClick={async () => {
505
+ const file = await uploadFile();
506
+ assetManager.create(file);
514
507
  }}
515
508
  >
516
509
  Upload
517
510
  </StateInspectorButton>
511
+ <StateInspectorButton
512
+ theme={theme}
513
+ onClick={async () => {
514
+ const file = await uploadFile();
515
+ assetManager.create({
516
+ data: new Uint8Array(await file.arrayBuffer()),
517
+ contentType: file.type,
518
+ mode: "mutable",
519
+ });
520
+ }}
521
+ >
522
+ Upload Mutable
523
+ </StateInspectorButton>
518
524
  </span>
519
525
  }
520
526
  >
@@ -526,12 +532,28 @@ export const StateInspector = memoGeneric(function StateInspector<
526
532
  data={truncateAsset(asset)}
527
533
  theme={theme}
528
534
  />
529
- <StateInspectorButton
530
- theme={theme}
531
- onClick={() => assetManager.delete(asset.id)}
532
- >
533
- Delete
534
- </StateInspectorButton>
535
+ <div style={{ display: "flex", gap: "4px" }}>
536
+ {asset.mode === "mutable" && (
537
+ <StateInspectorButton
538
+ theme={theme}
539
+ onClick={async () => {
540
+ const file = await uploadFile();
541
+ assetManager.update(asset.id, {
542
+ data: new Uint8Array(await file.arrayBuffer()),
543
+ contentType: file.type,
544
+ });
545
+ }}
546
+ >
547
+ Replace
548
+ </StateInspectorButton>
549
+ )}
550
+ <StateInspectorButton
551
+ theme={theme}
552
+ onClick={() => assetManager.delete(asset.id)}
553
+ >
554
+ Delete
555
+ </StateInspectorButton>
556
+ </div>
535
557
  </StateInspectorRow>
536
558
  ))}
537
559
  </StateInspectorDisclosureRowInner>
@@ -633,7 +655,7 @@ export const StateInspector = memoGeneric(function StateInspector<
633
655
  <StateInspectorDisclosureSection
634
656
  title={
635
657
  <StateInspectorTitleLabel>
636
- Secrets
658
+ Secrets ({secrets.length})
637
659
  <ColoredDot type={secretsInitialized ? "success" : "error"} />
638
660
  </StateInspectorTitleLabel>
639
661
  }
@@ -641,18 +663,28 @@ export const StateInspector = memoGeneric(function StateInspector<
641
663
  open={showSecrets}
642
664
  setOpen={setShowSecrets}
643
665
  right={
644
- <StateInspectorButton
645
- theme={theme}
646
- onClick={() => {
647
- const name = prompt("Enter secret name");
648
- if (!name) return;
649
- const value = prompt("Enter secret value");
650
- if (!value) return;
651
- secretManager.createSecret(null, name, value);
652
- }}
653
- >
654
- Create
655
- </StateInspectorButton>
666
+ <span style={{ display: "flex", gap: "10px" }}>
667
+ <StateInspectorButton
668
+ theme={theme}
669
+ onClick={() => {
670
+ void secretManager.fetchSecrets();
671
+ }}
672
+ >
673
+ Refresh
674
+ </StateInspectorButton>
675
+ <StateInspectorButton
676
+ theme={theme}
677
+ onClick={() => {
678
+ const name = prompt("Enter secret name");
679
+ if (!name) return;
680
+ const value = prompt("Enter secret value");
681
+ if (!value) return;
682
+ secretManager.createSecret(null, name, value);
683
+ }}
684
+ >
685
+ Create
686
+ </StateInspectorButton>
687
+ </span>
656
688
  }
657
689
  >
658
690
  <StateInspectorDisclosureRowInner>
@@ -670,13 +702,21 @@ export const StateInspector = memoGeneric(function StateInspector<
670
702
  </StateInspectorDisclosureRowInner>
671
703
  </StateInspectorDisclosureSection>
672
704
  )}
705
+ {advanced && (
706
+ <GitSection
707
+ showGit={showGit}
708
+ setShowGit={setShowGit}
709
+ colorScheme={colorScheme}
710
+ gitManager={gitManager}
711
+ />
712
+ )}
673
713
  {advanced && (
674
714
  <StateInspectorDisclosureSection
675
715
  open={showInputs}
676
716
  setOpen={setShowInputs}
677
717
  title={
678
718
  <StateInspectorTitleLabel>
679
- Inputs
719
+ Inputs ({inputs.length})
680
720
  <ColoredDot type={inputsInitialized ? "success" : "error"} />
681
721
  </StateInspectorTitleLabel>
682
722
  }
@@ -710,7 +750,7 @@ export const StateInspector = memoGeneric(function StateInspector<
710
750
  setOpen={setShowOutputTransforms}
711
751
  title={
712
752
  <StateInspectorTitleLabel>
713
- Output Transforms
753
+ Output Transforms ({outputTransforms.length})
714
754
  <ColoredDot
715
755
  type={outputTransformsInitialized ? "success" : "error"}
716
756
  />