@powerhousedao/design-system 6.2.0 → 6.2.1-dev.0

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.
@@ -6445,20 +6445,20 @@ function sortRemotes(remotes, sort) {
6445
6445
  let bValue;
6446
6446
  switch (sort.column) {
6447
6447
  case "id":
6448
- aValue = a.id;
6449
- bValue = b.id;
6448
+ aValue = a.meta.id;
6449
+ bValue = b.meta.id;
6450
6450
  break;
6451
6451
  case "name":
6452
- aValue = a.name;
6453
- bValue = b.name;
6452
+ aValue = a.meta.name;
6453
+ bValue = b.meta.name;
6454
6454
  break;
6455
6455
  case "collectionId":
6456
- aValue = a.collectionId.key;
6457
- bValue = b.collectionId.key;
6456
+ aValue = a.meta.collectionId.key;
6457
+ bValue = b.meta.collectionId.key;
6458
6458
  break;
6459
6459
  case "filter":
6460
- aValue = formatFilter(a.filter);
6461
- bValue = formatFilter(b.filter);
6460
+ aValue = formatFilter(a.meta.filter);
6461
+ bValue = formatFilter(b.meta.filter);
6462
6462
  break;
6463
6463
  default: return 0;
6464
6464
  }
@@ -6486,7 +6486,7 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6486
6486
  }, [loadRemotes]);
6487
6487
  const handleRefresh = useCallback(async () => {
6488
6488
  await loadRemotes();
6489
- if (selectedRemote) setSelectedRemote(remotes.find((r) => r.id === selectedRemote.id));
6489
+ if (selectedRemote) setSelectedRemote(remotes.find((r) => r.meta.id === selectedRemote.meta.id));
6490
6490
  }, [
6491
6491
  loadRemotes,
6492
6492
  selectedRemote,
@@ -6504,9 +6504,9 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6504
6504
  };
6505
6505
  const handleRemove = useCallback(async (remote) => {
6506
6506
  if (!removeRemote) return;
6507
- await removeRemote(remote.name);
6507
+ await removeRemote(remote.meta.name);
6508
6508
  await loadRemotes();
6509
- if (selectedRemote?.id === remote.id) setSelectedRemote(void 0);
6509
+ if (selectedRemote?.meta.id === remote.meta.id) setSelectedRemote(void 0);
6510
6510
  }, [
6511
6511
  removeRemote,
6512
6512
  loadRemotes,
@@ -6536,14 +6536,14 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6536
6536
  loadRemotes
6537
6537
  ]);
6538
6538
  const handlePull = useCallback((remote) => {
6539
- triggerPull?.(remote.name);
6539
+ triggerPull?.(remote.meta.name);
6540
6540
  }, [triggerPull]);
6541
6541
  if (selectedRemote) return /* @__PURE__ */ jsx(ChannelInspector, {
6542
6542
  channel: selectedRemote.channel,
6543
- connectionState: connectionStates?.get(selectedRemote.name),
6543
+ connectionState: connectionStates?.get(selectedRemote.meta.name),
6544
6544
  onBack: handleBack,
6545
6545
  onRefresh: () => void handleRefresh(),
6546
- remoteName: selectedRemote.name
6546
+ remoteName: selectedRemote.meta.name
6547
6547
  });
6548
6548
  const sortedRemotes = sortRemotes(remotes, sort);
6549
6549
  return /* @__PURE__ */ jsxs("div", {
@@ -6633,23 +6633,23 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6633
6633
  className: "px-3 py-2 text-xs text-foreground",
6634
6634
  children: /* @__PURE__ */ jsx("span", {
6635
6635
  className: "block truncate",
6636
- title: remote.id,
6637
- children: truncateId(remote.id)
6636
+ title: remote.meta.id,
6637
+ children: truncateId(remote.meta.id)
6638
6638
  })
6639
6639
  }),
6640
6640
  /* @__PURE__ */ jsx("td", {
6641
6641
  className: "border-l border-border px-3 py-2 text-xs text-foreground",
6642
6642
  children: /* @__PURE__ */ jsx("span", {
6643
6643
  className: "block truncate",
6644
- title: remote.name,
6645
- children: remote.name
6644
+ title: remote.meta.name,
6645
+ children: remote.meta.name
6646
6646
  })
6647
6647
  }),
6648
6648
  /* @__PURE__ */ jsx("td", {
6649
6649
  className: "border-l border-border px-3 py-2",
6650
- children: connectionStates?.get(remote.name) ? /* @__PURE__ */ jsx(ConnectionStateBadge, {
6651
- failureCount: connectionStates.get(remote.name).failureCount,
6652
- state: connectionStates.get(remote.name).state
6650
+ children: connectionStates?.get(remote.meta.name) ? /* @__PURE__ */ jsx(ConnectionStateBadge, {
6651
+ failureCount: connectionStates.get(remote.meta.name).failureCount,
6652
+ state: connectionStates.get(remote.meta.name).state
6653
6653
  }) : /* @__PURE__ */ jsx("span", {
6654
6654
  className: "text-xs text-muted-foreground",
6655
6655
  children: "-"
@@ -6659,16 +6659,16 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6659
6659
  className: "border-l border-border px-3 py-2 text-xs text-foreground",
6660
6660
  children: /* @__PURE__ */ jsx("span", {
6661
6661
  className: "block truncate",
6662
- title: remote.collectionId.key,
6663
- children: remote.collectionId.key
6662
+ title: remote.meta.collectionId.key,
6663
+ children: remote.meta.collectionId.key
6664
6664
  })
6665
6665
  }),
6666
6666
  /* @__PURE__ */ jsx("td", {
6667
6667
  className: "border-l border-border px-3 py-2 text-xs text-foreground",
6668
6668
  children: /* @__PURE__ */ jsx("span", {
6669
6669
  className: "block truncate",
6670
- title: formatFilter(remote.filter),
6671
- children: formatFilter(remote.filter)
6670
+ title: formatFilter(remote.meta.filter),
6671
+ children: formatFilter(remote.meta.filter)
6672
6672
  })
6673
6673
  }),
6674
6674
  /* @__PURE__ */ jsx("td", {
@@ -6702,7 +6702,7 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6702
6702
  })
6703
6703
  })
6704
6704
  ]
6705
- }, remote.id)) })]
6705
+ }, remote.meta.id)) })]
6706
6706
  })
6707
6707
  }),
6708
6708
  /* @__PURE__ */ jsxs("div", {
@@ -6717,8 +6717,129 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
6717
6717
  });
6718
6718
  }
6719
6719
  //#endregion
6720
+ //#region src/connect/components/worker-inspector/worker-inspector.tsx
6721
+ function formatUptime(ms) {
6722
+ const totalSeconds = Math.max(0, Math.floor(ms / 1e3));
6723
+ const hours = Math.floor(totalSeconds / 3600);
6724
+ const minutes = Math.floor(totalSeconds % 3600 / 60);
6725
+ const seconds = totalSeconds % 60;
6726
+ const parts = [];
6727
+ if (hours > 0) parts.push(`${hours}h`);
6728
+ if (hours > 0 || minutes > 0) parts.push(`${minutes}m`);
6729
+ parts.push(`${seconds}s`);
6730
+ return parts.join(" ");
6731
+ }
6732
+ function Field({ label, value }) {
6733
+ return /* @__PURE__ */ jsxs("div", {
6734
+ className: "flex flex-col gap-0.5",
6735
+ children: [/* @__PURE__ */ jsx("span", {
6736
+ className: "text-xs font-medium text-muted-foreground",
6737
+ children: label
6738
+ }), /* @__PURE__ */ jsx("span", {
6739
+ className: "font-mono text-sm break-all text-foreground",
6740
+ children: value
6741
+ })]
6742
+ });
6743
+ }
6744
+ function WorkerInspector({ getInfo, onRestart }) {
6745
+ const [info, setInfo] = useState(null);
6746
+ const [error, setError] = useState(null);
6747
+ const [now, setNow] = useState(() => Date.now());
6748
+ const [restarting, setRestarting] = useState(false);
6749
+ const loadInfo = useCallback(async () => {
6750
+ try {
6751
+ setInfo(await getInfo());
6752
+ setError(null);
6753
+ } catch (e) {
6754
+ setError(e instanceof Error ? e.message : String(e));
6755
+ }
6756
+ }, [getInfo]);
6757
+ useEffect(() => {
6758
+ loadInfo();
6759
+ const interval = setInterval(() => {
6760
+ loadInfo();
6761
+ setNow(Date.now());
6762
+ }, 1e3);
6763
+ return () => clearInterval(interval);
6764
+ }, [loadInfo]);
6765
+ const handleRestart = useCallback(async () => {
6766
+ if (!window.confirm("Restart the reactor worker? All tabs sharing it will reload.")) return;
6767
+ setRestarting(true);
6768
+ try {
6769
+ await onRestart();
6770
+ } finally {
6771
+ setRestarting(false);
6772
+ }
6773
+ }, [onRestart]);
6774
+ return /* @__PURE__ */ jsxs("div", {
6775
+ className: "flex h-full flex-col gap-3",
6776
+ children: [/* @__PURE__ */ jsxs("div", {
6777
+ className: "flex shrink-0 items-center justify-between",
6778
+ children: [/* @__PURE__ */ jsx("h2", {
6779
+ className: "text-lg font-semibold text-foreground",
6780
+ children: "Worker Inspector"
6781
+ }), /* @__PURE__ */ jsxs("button", {
6782
+ 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"),
6783
+ disabled: restarting || !info,
6784
+ onClick: () => void handleRestart(),
6785
+ type: "button",
6786
+ children: [/* @__PURE__ */ jsx(Icon, {
6787
+ name: "Reload",
6788
+ size: 14
6789
+ }), restarting ? "Restarting..." : "Restart Worker"]
6790
+ })]
6791
+ }), error ? /* @__PURE__ */ jsx("div", {
6792
+ className: "rounded-lg bg-destructive/10 px-4 py-3 text-sm text-destructive",
6793
+ children: error
6794
+ }) : !info ? /* @__PURE__ */ jsx("div", {
6795
+ className: "rounded-lg bg-muted px-4 py-8 text-center text-sm text-muted-foreground",
6796
+ children: "Loading worker info..."
6797
+ }) : /* @__PURE__ */ jsxs("div", {
6798
+ className: "grid grid-cols-2 gap-4 rounded-lg border border-border p-4",
6799
+ children: [
6800
+ /* @__PURE__ */ jsx(Field, {
6801
+ label: "Worker name",
6802
+ value: info.namespace
6803
+ }),
6804
+ /* @__PURE__ */ jsx(Field, {
6805
+ label: "Owner ID (boot)",
6806
+ value: info.ownerId
6807
+ }),
6808
+ /* @__PURE__ */ jsx(Field, {
6809
+ label: "Uptime",
6810
+ value: formatUptime(now - info.bootedAtMs)
6811
+ }),
6812
+ /* @__PURE__ */ jsx(Field, {
6813
+ label: "Connected tabs",
6814
+ value: String(info.connectedClients)
6815
+ }),
6816
+ /* @__PURE__ */ jsx(Field, {
6817
+ label: "App build",
6818
+ value: info.appBuildId
6819
+ }),
6820
+ /* @__PURE__ */ jsx(Field, {
6821
+ label: "RPC protocol",
6822
+ value: String(info.rpcProtocolVersion)
6823
+ })
6824
+ ]
6825
+ })]
6826
+ });
6827
+ }
6828
+ //#endregion
6720
6829
  //#region src/connect/components/modal/inspector-modal/inspector-modal.tsx
6721
- function InspectorModal({ open, onOpenChange, modalProps, containerProps, dbExplorerProps, remotesInspectorProps, queueInspectorProps, processorsInspectorProps, integrityInspectorProps, defaultTab = "Database" }) {
6830
+ function InspectorUnavailable({ message }) {
6831
+ return /* @__PURE__ */ jsxs("div", {
6832
+ className: "flex h-full flex-col items-center justify-center gap-2 p-6 text-center",
6833
+ children: [/* @__PURE__ */ jsx("span", {
6834
+ className: "text-sm font-semibold text-muted-foreground",
6835
+ children: "Not available here"
6836
+ }), /* @__PURE__ */ jsx("p", {
6837
+ className: "max-w-md text-sm text-muted-foreground",
6838
+ children: message
6839
+ })]
6840
+ });
6841
+ }
6842
+ function InspectorModal({ open, onOpenChange, modalProps, containerProps, dbExplorerProps, remotesInspectorProps, queueInspectorProps, processorsInspectorProps, integrityInspectorProps, workerInspectorProps, unavailableTabs, defaultTab = "Database" }) {
6722
6843
  return /* @__PURE__ */ jsx(Modal, {
6723
6844
  ...modalProps,
6724
6845
  contentProps: {
@@ -6767,29 +6888,49 @@ function InspectorModal({ open, onOpenChange, modalProps, containerProps, dbExpl
6767
6888
  children: /* @__PURE__ */ jsx(RemotesInspector, { ...remotesInspectorProps })
6768
6889
  })
6769
6890
  }),
6770
- queueInspectorProps && /* @__PURE__ */ jsx(TabContent, {
6891
+ queueInspectorProps ? /* @__PURE__ */ jsx(TabContent, {
6771
6892
  description: "Queue inspector",
6772
6893
  label: "Queue",
6773
6894
  children: /* @__PURE__ */ jsx("div", {
6774
6895
  className: "h-full",
6775
6896
  children: /* @__PURE__ */ jsx(QueueInspector, { ...queueInspectorProps })
6776
6897
  })
6777
- }),
6778
- processorsInspectorProps && /* @__PURE__ */ jsx(TabContent, {
6898
+ }) : unavailableTabs?.Queue ? /* @__PURE__ */ jsx(TabContent, {
6899
+ description: "Queue inspector",
6900
+ label: "Queue",
6901
+ children: /* @__PURE__ */ jsx(InspectorUnavailable, { message: unavailableTabs.Queue })
6902
+ }) : null,
6903
+ processorsInspectorProps ? /* @__PURE__ */ jsx(TabContent, {
6779
6904
  description: "Processors inspector",
6780
6905
  label: "Processors",
6781
6906
  children: /* @__PURE__ */ jsx("div", {
6782
6907
  className: "h-full",
6783
6908
  children: /* @__PURE__ */ jsx(ProcessorsInspector, { ...processorsInspectorProps })
6784
6909
  })
6785
- }),
6786
- integrityInspectorProps && /* @__PURE__ */ jsx(TabContent, {
6910
+ }) : unavailableTabs?.Processors ? /* @__PURE__ */ jsx(TabContent, {
6911
+ description: "Processors inspector",
6912
+ label: "Processors",
6913
+ children: /* @__PURE__ */ jsx(InspectorUnavailable, { message: unavailableTabs.Processors })
6914
+ }) : null,
6915
+ integrityInspectorProps ? /* @__PURE__ */ jsx(TabContent, {
6787
6916
  description: "Integrity inspector",
6788
6917
  label: "Integrity",
6789
6918
  children: /* @__PURE__ */ jsx("div", {
6790
6919
  className: "h-full",
6791
6920
  children: /* @__PURE__ */ jsx(IntegrityInspector, { ...integrityInspectorProps })
6792
6921
  })
6922
+ }) : unavailableTabs?.Integrity ? /* @__PURE__ */ jsx(TabContent, {
6923
+ description: "Integrity inspector",
6924
+ label: "Integrity",
6925
+ children: /* @__PURE__ */ jsx(InspectorUnavailable, { message: unavailableTabs.Integrity })
6926
+ }) : null,
6927
+ workerInspectorProps && /* @__PURE__ */ jsx(TabContent, {
6928
+ description: "Worker inspector",
6929
+ label: "Worker",
6930
+ children: /* @__PURE__ */ jsx("div", {
6931
+ className: "h-full",
6932
+ children: /* @__PURE__ */ jsx(WorkerInspector, { ...workerInspectorProps })
6933
+ })
6793
6934
  })
6794
6935
  ]
6795
6936
  })
@@ -9004,6 +9145,6 @@ const removeSuccessFiles = (files) => {
9004
9145
  return files.filter((file) => file.status !== "SUCCESS");
9005
9146
  };
9006
9147
  //#endregion
9007
- 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 };
9148
+ 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 };
9008
9149
 
9009
9150
  //# sourceMappingURL=index.js.map