@powerhousedao/design-system 6.2.0-dev.38 → 6.2.0-dev.39

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.
@@ -6423,20 +6423,20 @@ function sortRemotes(remotes, sort) {
6423
6423
  let bValue;
6424
6424
  switch (sort.column) {
6425
6425
  case "id":
6426
- aValue = a.id;
6427
- bValue = b.id;
6426
+ aValue = a.meta.id;
6427
+ bValue = b.meta.id;
6428
6428
  break;
6429
6429
  case "name":
6430
- aValue = a.name;
6431
- bValue = b.name;
6430
+ aValue = a.meta.name;
6431
+ bValue = b.meta.name;
6432
6432
  break;
6433
6433
  case "collectionId":
6434
- aValue = a.collectionId.key;
6435
- bValue = b.collectionId.key;
6434
+ aValue = a.meta.collectionId.key;
6435
+ bValue = b.meta.collectionId.key;
6436
6436
  break;
6437
6437
  case "filter":
6438
- aValue = formatFilter(a.filter);
6439
- bValue = formatFilter(b.filter);
6438
+ aValue = formatFilter(a.meta.filter);
6439
+ bValue = formatFilter(b.meta.filter);
6440
6440
  break;
6441
6441
  default: return 0;
6442
6442
  }
@@ -6464,7 +6464,7 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6464
6464
  }, [loadRemotes]);
6465
6465
  const handleRefresh = useCallback(async () => {
6466
6466
  await loadRemotes();
6467
- if (selectedRemote) setSelectedRemote(remotes.find((r) => r.id === selectedRemote.id));
6467
+ if (selectedRemote) setSelectedRemote(remotes.find((r) => r.meta.id === selectedRemote.meta.id));
6468
6468
  }, [
6469
6469
  loadRemotes,
6470
6470
  selectedRemote,
@@ -6482,9 +6482,9 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6482
6482
  };
6483
6483
  const handleRemove = useCallback(async (remote) => {
6484
6484
  if (!removeRemote) return;
6485
- await removeRemote(remote.name);
6485
+ await removeRemote(remote.meta.name);
6486
6486
  await loadRemotes();
6487
- if (selectedRemote?.id === remote.id) setSelectedRemote(void 0);
6487
+ if (selectedRemote?.meta.id === remote.meta.id) setSelectedRemote(void 0);
6488
6488
  }, [
6489
6489
  removeRemote,
6490
6490
  loadRemotes,
@@ -6514,14 +6514,14 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6514
6514
  loadRemotes
6515
6515
  ]);
6516
6516
  const handlePull = useCallback((remote) => {
6517
- triggerPull?.(remote.name);
6517
+ triggerPull?.(remote.meta.name);
6518
6518
  }, [triggerPull]);
6519
6519
  if (selectedRemote) return /* @__PURE__ */ jsx(ChannelInspector, {
6520
6520
  channel: selectedRemote.channel,
6521
- connectionState: connectionStates?.get(selectedRemote.name),
6521
+ connectionState: connectionStates?.get(selectedRemote.meta.name),
6522
6522
  onBack: handleBack,
6523
6523
  onRefresh: () => void handleRefresh(),
6524
- remoteName: selectedRemote.name
6524
+ remoteName: selectedRemote.meta.name
6525
6525
  });
6526
6526
  const sortedRemotes = sortRemotes(remotes, sort);
6527
6527
  return /* @__PURE__ */ jsxs("div", {
@@ -6611,23 +6611,23 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6611
6611
  className: "px-3 py-2 text-xs text-foreground",
6612
6612
  children: /* @__PURE__ */ jsx("span", {
6613
6613
  className: "block truncate",
6614
- title: remote.id,
6615
- children: truncateId(remote.id)
6614
+ title: remote.meta.id,
6615
+ children: truncateId(remote.meta.id)
6616
6616
  })
6617
6617
  }),
6618
6618
  /* @__PURE__ */ jsx("td", {
6619
6619
  className: "border-l border-border px-3 py-2 text-xs text-foreground",
6620
6620
  children: /* @__PURE__ */ jsx("span", {
6621
6621
  className: "block truncate",
6622
- title: remote.name,
6623
- children: remote.name
6622
+ title: remote.meta.name,
6623
+ children: remote.meta.name
6624
6624
  })
6625
6625
  }),
6626
6626
  /* @__PURE__ */ jsx("td", {
6627
6627
  className: "border-l border-border px-3 py-2",
6628
- children: connectionStates?.get(remote.name) ? /* @__PURE__ */ jsx(ConnectionStateBadge, {
6629
- failureCount: connectionStates.get(remote.name).failureCount,
6630
- state: connectionStates.get(remote.name).state
6628
+ children: connectionStates?.get(remote.meta.name) ? /* @__PURE__ */ jsx(ConnectionStateBadge, {
6629
+ failureCount: connectionStates.get(remote.meta.name).failureCount,
6630
+ state: connectionStates.get(remote.meta.name).state
6631
6631
  }) : /* @__PURE__ */ jsx("span", {
6632
6632
  className: "text-xs text-muted-foreground",
6633
6633
  children: "-"
@@ -6637,16 +6637,16 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6637
6637
  className: "border-l border-border px-3 py-2 text-xs text-foreground",
6638
6638
  children: /* @__PURE__ */ jsx("span", {
6639
6639
  className: "block truncate",
6640
- title: remote.collectionId.key,
6641
- children: remote.collectionId.key
6640
+ title: remote.meta.collectionId.key,
6641
+ children: remote.meta.collectionId.key
6642
6642
  })
6643
6643
  }),
6644
6644
  /* @__PURE__ */ jsx("td", {
6645
6645
  className: "border-l border-border px-3 py-2 text-xs text-foreground",
6646
6646
  children: /* @__PURE__ */ jsx("span", {
6647
6647
  className: "block truncate",
6648
- title: formatFilter(remote.filter),
6649
- children: formatFilter(remote.filter)
6648
+ title: formatFilter(remote.meta.filter),
6649
+ children: formatFilter(remote.meta.filter)
6650
6650
  })
6651
6651
  }),
6652
6652
  /* @__PURE__ */ jsx("td", {
@@ -6680,7 +6680,7 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6680
6680
  })
6681
6681
  })
6682
6682
  ]
6683
- }, remote.id)) })]
6683
+ }, remote.meta.id)) })]
6684
6684
  })
6685
6685
  }),
6686
6686
  /* @__PURE__ */ jsxs("div", {
@@ -6695,8 +6695,129 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6695
6695
  });
6696
6696
  }
6697
6697
  //#endregion
6698
+ //#region src/connect/components/worker-inspector/worker-inspector.tsx
6699
+ function formatUptime(ms) {
6700
+ const totalSeconds = Math.max(0, Math.floor(ms / 1e3));
6701
+ const hours = Math.floor(totalSeconds / 3600);
6702
+ const minutes = Math.floor(totalSeconds % 3600 / 60);
6703
+ const seconds = totalSeconds % 60;
6704
+ const parts = [];
6705
+ if (hours > 0) parts.push(`${hours}h`);
6706
+ if (hours > 0 || minutes > 0) parts.push(`${minutes}m`);
6707
+ parts.push(`${seconds}s`);
6708
+ return parts.join(" ");
6709
+ }
6710
+ function Field({ label, value }) {
6711
+ return /* @__PURE__ */ jsxs("div", {
6712
+ className: "flex flex-col gap-0.5",
6713
+ children: [/* @__PURE__ */ jsx("span", {
6714
+ className: "text-xs font-medium text-muted-foreground",
6715
+ children: label
6716
+ }), /* @__PURE__ */ jsx("span", {
6717
+ className: "font-mono text-sm break-all text-foreground",
6718
+ children: value
6719
+ })]
6720
+ });
6721
+ }
6722
+ function WorkerInspector({ getInfo, onRestart }) {
6723
+ const [info, setInfo] = useState(null);
6724
+ const [error, setError] = useState(null);
6725
+ const [now, setNow] = useState(() => Date.now());
6726
+ const [restarting, setRestarting] = useState(false);
6727
+ const loadInfo = useCallback(async () => {
6728
+ try {
6729
+ setInfo(await getInfo());
6730
+ setError(null);
6731
+ } catch (e) {
6732
+ setError(e instanceof Error ? e.message : String(e));
6733
+ }
6734
+ }, [getInfo]);
6735
+ useEffect(() => {
6736
+ loadInfo();
6737
+ const interval = setInterval(() => {
6738
+ loadInfo();
6739
+ setNow(Date.now());
6740
+ }, 1e3);
6741
+ return () => clearInterval(interval);
6742
+ }, [loadInfo]);
6743
+ const handleRestart = useCallback(async () => {
6744
+ if (!window.confirm("Restart the reactor worker? All tabs sharing it will reload.")) return;
6745
+ setRestarting(true);
6746
+ try {
6747
+ await onRestart();
6748
+ } finally {
6749
+ setRestarting(false);
6750
+ }
6751
+ }, [onRestart]);
6752
+ return /* @__PURE__ */ jsxs("div", {
6753
+ className: "flex h-full flex-col gap-3",
6754
+ children: [/* @__PURE__ */ jsxs("div", {
6755
+ className: "flex shrink-0 items-center justify-between",
6756
+ children: [/* @__PURE__ */ jsx("h2", {
6757
+ className: "text-lg font-semibold text-foreground",
6758
+ children: "Worker Inspector"
6759
+ }), /* @__PURE__ */ jsxs("button", {
6760
+ className: twMerge("flex items-center gap-1 rounded-sm border px-3 py-1.5 text-sm", "border-warning bg-warning/10 text-warning hover:hover-effect disabled:disabled-effect"),
6761
+ disabled: restarting || !info,
6762
+ onClick: () => void handleRestart(),
6763
+ type: "button",
6764
+ children: [/* @__PURE__ */ jsx(Icon, {
6765
+ name: "Reload",
6766
+ size: 14
6767
+ }), restarting ? "Restarting..." : "Restart Worker"]
6768
+ })]
6769
+ }), error ? /* @__PURE__ */ jsx("div", {
6770
+ className: "rounded-lg bg-destructive/10 px-4 py-3 text-sm text-destructive",
6771
+ children: error
6772
+ }) : !info ? /* @__PURE__ */ jsx("div", {
6773
+ className: "rounded-lg bg-muted px-4 py-8 text-center text-sm text-muted-foreground",
6774
+ children: "Loading worker info..."
6775
+ }) : /* @__PURE__ */ jsxs("div", {
6776
+ className: "grid grid-cols-2 gap-4 rounded-lg border border-border p-4",
6777
+ children: [
6778
+ /* @__PURE__ */ jsx(Field, {
6779
+ label: "Worker name",
6780
+ value: info.namespace
6781
+ }),
6782
+ /* @__PURE__ */ jsx(Field, {
6783
+ label: "Owner ID (boot)",
6784
+ value: info.ownerId
6785
+ }),
6786
+ /* @__PURE__ */ jsx(Field, {
6787
+ label: "Uptime",
6788
+ value: formatUptime(now - info.bootedAtMs)
6789
+ }),
6790
+ /* @__PURE__ */ jsx(Field, {
6791
+ label: "Connected tabs",
6792
+ value: String(info.connectedClients)
6793
+ }),
6794
+ /* @__PURE__ */ jsx(Field, {
6795
+ label: "App build",
6796
+ value: info.appBuildId
6797
+ }),
6798
+ /* @__PURE__ */ jsx(Field, {
6799
+ label: "RPC protocol",
6800
+ value: String(info.rpcProtocolVersion)
6801
+ })
6802
+ ]
6803
+ })]
6804
+ });
6805
+ }
6806
+ //#endregion
6698
6807
  //#region src/connect/components/modal/inspector-modal/inspector-modal.tsx
6699
- function InspectorModal({ open, onOpenChange, modalProps, containerProps, dbExplorerProps, remotesInspectorProps, queueInspectorProps, processorsInspectorProps, integrityInspectorProps, defaultTab = "Database" }) {
6808
+ function InspectorUnavailable({ message }) {
6809
+ return /* @__PURE__ */ jsxs("div", {
6810
+ className: "flex h-full flex-col items-center justify-center gap-2 p-6 text-center",
6811
+ children: [/* @__PURE__ */ jsx("span", {
6812
+ className: "text-sm font-semibold text-muted-foreground",
6813
+ children: "Not available here"
6814
+ }), /* @__PURE__ */ jsx("p", {
6815
+ className: "max-w-md text-sm text-muted-foreground",
6816
+ children: message
6817
+ })]
6818
+ });
6819
+ }
6820
+ function InspectorModal({ open, onOpenChange, modalProps, containerProps, dbExplorerProps, remotesInspectorProps, queueInspectorProps, processorsInspectorProps, integrityInspectorProps, workerInspectorProps, unavailableTabs, defaultTab = "Database" }) {
6700
6821
  return /* @__PURE__ */ jsx(Modal, {
6701
6822
  ...modalProps,
6702
6823
  contentProps: {
@@ -6744,29 +6865,49 @@ function InspectorModal({ open, onOpenChange, modalProps, containerProps, dbExpl
6744
6865
  children: /* @__PURE__ */ jsx(RemotesInspector, { ...remotesInspectorProps })
6745
6866
  })
6746
6867
  }),
6747
- queueInspectorProps && /* @__PURE__ */ jsx(TabContent, {
6868
+ queueInspectorProps ? /* @__PURE__ */ jsx(TabContent, {
6748
6869
  description: "Queue inspector",
6749
6870
  label: "Queue",
6750
6871
  children: /* @__PURE__ */ jsx("div", {
6751
6872
  className: "h-full",
6752
6873
  children: /* @__PURE__ */ jsx(QueueInspector, { ...queueInspectorProps })
6753
6874
  })
6754
- }),
6755
- processorsInspectorProps && /* @__PURE__ */ jsx(TabContent, {
6875
+ }) : unavailableTabs?.Queue ? /* @__PURE__ */ jsx(TabContent, {
6876
+ description: "Queue inspector",
6877
+ label: "Queue",
6878
+ children: /* @__PURE__ */ jsx(InspectorUnavailable, { message: unavailableTabs.Queue })
6879
+ }) : null,
6880
+ processorsInspectorProps ? /* @__PURE__ */ jsx(TabContent, {
6756
6881
  description: "Processors inspector",
6757
6882
  label: "Processors",
6758
6883
  children: /* @__PURE__ */ jsx("div", {
6759
6884
  className: "h-full",
6760
6885
  children: /* @__PURE__ */ jsx(ProcessorsInspector, { ...processorsInspectorProps })
6761
6886
  })
6762
- }),
6763
- integrityInspectorProps && /* @__PURE__ */ jsx(TabContent, {
6887
+ }) : unavailableTabs?.Processors ? /* @__PURE__ */ jsx(TabContent, {
6888
+ description: "Processors inspector",
6889
+ label: "Processors",
6890
+ children: /* @__PURE__ */ jsx(InspectorUnavailable, { message: unavailableTabs.Processors })
6891
+ }) : null,
6892
+ integrityInspectorProps ? /* @__PURE__ */ jsx(TabContent, {
6764
6893
  description: "Integrity inspector",
6765
6894
  label: "Integrity",
6766
6895
  children: /* @__PURE__ */ jsx("div", {
6767
6896
  className: "h-full",
6768
6897
  children: /* @__PURE__ */ jsx(IntegrityInspector, { ...integrityInspectorProps })
6769
6898
  })
6899
+ }) : unavailableTabs?.Integrity ? /* @__PURE__ */ jsx(TabContent, {
6900
+ description: "Integrity inspector",
6901
+ label: "Integrity",
6902
+ children: /* @__PURE__ */ jsx(InspectorUnavailable, { message: unavailableTabs.Integrity })
6903
+ }) : null,
6904
+ workerInspectorProps && /* @__PURE__ */ jsx(TabContent, {
6905
+ description: "Worker inspector",
6906
+ label: "Worker",
6907
+ children: /* @__PURE__ */ jsx("div", {
6908
+ className: "h-full",
6909
+ children: /* @__PURE__ */ jsx(WorkerInspector, { ...workerInspectorProps })
6910
+ })
6770
6911
  })
6771
6912
  ]
6772
6913
  })
@@ -8984,6 +9125,6 @@ const removeSuccessFiles = (files) => {
8984
9125
  return files.filter((file) => file.status !== "SUCCESS");
8985
9126
  };
8986
9127
  //#endregion
8987
- export { About, AccountPopover, AddDriveModal, AddLocalDriveForm, AddRemoteDriveForm, AnimatedLoader, Breadcrumb, Breadcrumbs, CONFLICT, ChannelInspector, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveAuthGate, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, IntegrityInspector, LoadingScreen, LogoAnimation, MISSING, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageManager, PackageManagerInput, PackageManagerList, PackageManagerListItem, ProcessorsInspector, QueueInspector, ReadRequiredModal, RemotesInspector, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, ThemeSwitch, Toggle, ToolbarButton, ToolbarCloseButton, ToolbarContainer, ToolbarControlsContainer, ToolbarDownloadButton, ToolbarHistoryButton, ToolbarInput, ToolbarName, ToolbarRedoButton, ToolbarSwitchboardButton, ToolbarUndoButton, UploadFileItem, UploadFileList, UploadFileListContainer, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, getFolderStatus, locationInfoByLocation, nodeOptions, normalNodeOptions, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useEns, verifyPackageJsonFields };
9128
+ export { About, AccountPopover, AddDriveModal, AddLocalDriveForm, AddRemoteDriveForm, AnimatedLoader, Breadcrumb, Breadcrumbs, CONFLICT, ChannelInspector, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveAuthGate, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, IntegrityInspector, LoadingScreen, LogoAnimation, MISSING, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageManager, PackageManagerInput, PackageManagerList, PackageManagerListItem, ProcessorsInspector, QueueInspector, ReadRequiredModal, RemotesInspector, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, ThemeSwitch, Toggle, ToolbarButton, ToolbarCloseButton, ToolbarContainer, ToolbarControlsContainer, ToolbarDownloadButton, ToolbarHistoryButton, ToolbarInput, ToolbarName, ToolbarRedoButton, ToolbarSwitchboardButton, ToolbarUndoButton, UploadFileItem, UploadFileList, UploadFileListContainer, WorkerInspector, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, getFolderStatus, locationInfoByLocation, nodeOptions, normalNodeOptions, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useEns, verifyPackageJsonFields };
8988
9129
 
8989
9130
  //# sourceMappingURL=index.js.map