@powerhousedao/connect 6.2.3-dev.61 → 6.2.3-dev.62
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/README.md +101 -0
- package/dist/{AddDriveModal-C5odBO8y.js → AddDriveModal-D_3jDwjp.js} +6 -6
- package/dist/AddDriveModal-D_3jDwjp.js.map +1 -0
- package/dist/{ClearStorageModal-nzpz8MeW.js → ClearStorageModal-CXWhHez-.js} +9 -11
- package/dist/ClearStorageModal-CXWhHez-.js.map +1 -0
- package/dist/{ConfirmDocumentUpgradeModal-k79v2wM6.js → ConfirmDocumentUpgradeModal-CrU2Z1CL.js} +5 -5
- package/dist/{ConfirmDocumentUpgradeModal-k79v2wM6.js.map → ConfirmDocumentUpgradeModal-CrU2Z1CL.js.map} +1 -1
- package/dist/{CookiesPolicyModal-BLw4pnhn.js → CookiesPolicyModal-DQwsgDI9.js} +5 -5
- package/dist/{CookiesPolicyModal-BLw4pnhn.js.map → CookiesPolicyModal-DQwsgDI9.js.map} +1 -1
- package/dist/{CreateDocumentModal-Bmv0V-kY.js → CreateDocumentModal-Cf1APibL.js} +4 -4
- package/dist/{CreateDocumentModal-Bmv0V-kY.js.map → CreateDocumentModal-Cf1APibL.js.map} +1 -1
- package/dist/{DebugSettingsModal-BW0HWI1D.js → DebugSettingsModal-C0j4mtkx.js} +8 -8
- package/dist/{DebugSettingsModal-BW0HWI1D.js.map → DebugSettingsModal-C0j4mtkx.js.map} +1 -1
- package/dist/{DeleteDriveModal-CjGnG0ht.js → DeleteDriveModal-lE9eCBua.js} +5 -5
- package/dist/{DeleteDriveModal-CjGnG0ht.js.map → DeleteDriveModal-lE9eCBua.js.map} +1 -1
- package/dist/{DeleteItemModal-BbY_4_xT.js → DeleteItemModal-BFgcGsm3.js} +6 -6
- package/dist/{DeleteItemModal-BbY_4_xT.js.map → DeleteItemModal-BFgcGsm3.js.map} +1 -1
- package/dist/{DisclaimerModal-DuglmEwL.js → DisclaimerModal-CF6JkIIu.js} +6 -6
- package/dist/{DisclaimerModal-DuglmEwL.js.map → DisclaimerModal-CF6JkIIu.js.map} +1 -1
- package/dist/{DocumentVersionUnsupportedModal-C4fy7fZ6.js → DocumentVersionUnsupportedModal-Cm9Jb9W7.js} +5 -5
- package/dist/DocumentVersionUnsupportedModal-Cm9Jb9W7.js.map +1 -0
- package/dist/{DownloadDocumentWithErrorsModal-BsPQ5qgy.js → DownloadDocumentWithErrorsModal-CShKhfEQ.js} +5 -5
- package/dist/{DownloadDocumentWithErrorsModal-BsPQ5qgy.js.map → DownloadDocumentWithErrorsModal-CShKhfEQ.js.map} +1 -1
- package/dist/{DriveAuthRequiredModal-CtsB0kwH.js → DriveAuthRequiredModal-CMwPUyZf.js} +5 -5
- package/dist/{DriveAuthRequiredModal-CtsB0kwH.js.map → DriveAuthRequiredModal-CMwPUyZf.js.map} +1 -1
- package/dist/{DriveSettingsModal-d1L0eYof.js → DriveSettingsModal-BSImj4BH.js} +5 -5
- package/dist/{DriveSettingsModal-d1L0eYof.js.map → DriveSettingsModal-BSImj4BH.js.map} +1 -1
- package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js +2565 -0
- package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js.map +1 -0
- package/dist/{InspectorModal-Dpf-3LVT.js → InspectorModal-CKuKR5g7.js} +9 -9
- package/dist/{InspectorModal-Dpf-3LVT.js.map → InspectorModal-CKuKR5g7.js.map} +1 -1
- package/dist/{LoginModal-CI0ogC2-.js → LoginModal-DT_05uva.js} +6 -6
- package/dist/{LoginModal-CI0ogC2-.js.map → LoginModal-DT_05uva.js.map} +1 -1
- package/dist/{MissingPackageModal-DS3dgJ1K.js → MissingPackageModal-DtISKgub.js} +6 -6
- package/dist/{MissingPackageModal-DS3dgJ1K.js.map → MissingPackageModal-DtISKgub.js.map} +1 -1
- package/dist/{OpenFileDocumentsModal-BOmFtxS1.js → OpenFileDocumentsModal-X9GnX2Bk.js} +13 -12
- package/dist/OpenFileDocumentsModal-X9GnX2Bk.js.map +1 -0
- package/dist/{UpgradeDriveModal-CXX6D5Au.js → UpgradeDriveModal-DvM-PNWe.js} +6 -6
- package/dist/{UpgradeDriveModal-CXX6D5Au.js.map → UpgradeDriveModal-DvM-PNWe.js.map} +1 -1
- package/dist/app-layout-BIq-ZW-6.js +394 -0
- package/dist/app-layout-BIq-ZW-6.js.map +1 -0
- package/dist/app-loader-DqNf3gc0.js +1291 -0
- package/dist/app-loader-DqNf3gc0.js.map +1 -0
- package/dist/app-loader-gMCokq-Y.js +4 -0
- package/dist/{app-skeleton-CBN4tenZ.js → app-skeleton-DYLZ7npI.js} +3 -3
- package/dist/{app-skeleton--Me5zlSz.js → app-skeleton-gzg8cRzm.js} +7 -7
- package/dist/app-skeleton-gzg8cRzm.js.map +1 -0
- package/dist/{boot-CNW7ypcB.js → boot-CC_DgQKX.js} +32 -9
- package/dist/boot-CC_DgQKX.js.map +1 -0
- package/dist/{build-info-DNKZUbvY.js → build-info-BL03di3M.js} +5 -5
- package/dist/{build-info-DNKZUbvY.js.map → build-info-BL03di3M.js.map} +1 -1
- package/dist/components-D4yHqff7.js +120 -0
- package/dist/components-D4yHqff7.js.map +1 -0
- package/dist/connect-router-KmNBGS0G.js +434 -0
- package/dist/connect-router-KmNBGS0G.js.map +1 -0
- package/dist/{connect.config-CB78ZsFz.js → connect.config-uZF-gnvV.js} +7 -7
- package/dist/{connect.config-CB78ZsFz.js.map → connect.config-uZF-gnvV.js.map} +1 -1
- package/dist/{connection-state-BDikOGKo.js → connection-state-C_477Kr_.js} +6 -6
- package/dist/{connection-state-BDikOGKo.js.map → connection-state-C_477Kr_.js.map} +1 -1
- package/dist/context-De2EB1AA-Ni0d829Q.js +1759 -0
- package/dist/context-De2EB1AA-Ni0d829Q.js.map +1 -0
- package/dist/{cookie-banner-D05DZRqY.js → cookie-banner-HPgyuHM5.js} +6 -6
- package/dist/{cookie-banner-D05DZRqY.js.map → cookie-banner-HPgyuHM5.js.map} +1 -1
- package/dist/drive-icon-BiVP8yJc.js +38 -0
- package/dist/drive-icon-BiVP8yJc.js.map +1 -0
- package/dist/esm-BDACZntJ.js +148 -0
- package/dist/esm-BDACZntJ.js.map +1 -0
- package/dist/index-UrZFqSgm.d.ts +166 -0
- package/dist/index-UrZFqSgm.d.ts.map +1 -0
- package/dist/layout.d.ts +29 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +6 -0
- package/dist/{load-BxQ82Cxc.js → load-CEuzCNRz.js} +48 -48
- package/dist/load-CEuzCNRz.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/{multi-reactor-BG-DqUcm.js → multi-reactor-fSKpLBjT.js} +10 -7
- package/dist/multi-reactor-fSKpLBjT.js.map +1 -0
- package/dist/open-file-uploads-BcyWmUZn.js +183 -0
- package/dist/open-file-uploads-BcyWmUZn.js.map +1 -0
- package/dist/{package-manager-BPVMRBoV.js → package-manager-BkFRzovd.js} +52 -45
- package/dist/package-manager-BkFRzovd.js.map +1 -0
- package/dist/{pglite-migrate-core-BcXcImng.js → pglite-migrate-core-DBlU6HIc.js} +4 -4
- package/dist/pglite-migrate-core-DBlU6HIc.js.map +1 -0
- package/dist/{pglite-seed-CQJ97bEt.js → pglite-seed-BsEPByVM.js} +4 -4
- package/dist/{pglite-seed-CQJ97bEt.js.map → pglite-seed-BsEPByVM.js.map} +1 -1
- package/dist/{preferences-store-Cm0BoiHA.js → preferences-store-DANUajdg.js} +4 -4
- package/dist/{preferences-store-Cm0BoiHA.js.map → preferences-store-DANUajdg.js.map} +1 -1
- package/dist/prerendered-shell-DxCUDEXL.js +45 -0
- package/dist/prerendered-shell-DxCUDEXL.js.map +1 -0
- package/dist/{reactor-DHJyk5ow.js → reactor-DmBtssmg.js} +50 -46
- package/dist/reactor-DmBtssmg.js.map +1 -0
- package/dist/reactor-chat-LAB-9G3G.js +50 -0
- package/dist/reactor-chat-LAB-9G3G.js.map +1 -0
- package/dist/reactor.worker.js +85 -27
- package/dist/reactor.worker.js.map +1 -1
- package/dist/{registerServiceWorker-DT6t8wjg.js → registerServiceWorker-CkVxA2KC.js} +4 -4
- package/dist/{registerServiceWorker-DT6t8wjg.js.map → registerServiceWorker-CkVxA2KC.js.map} +1 -1
- package/dist/route-components-BkztQruF.js +148 -0
- package/dist/route-components-BkztQruF.js.map +1 -0
- package/dist/route-tree.d.ts +2229 -0
- package/dist/route-tree.d.ts.map +1 -0
- package/dist/route-tree.js +211 -0
- package/dist/route-tree.js.map +1 -0
- package/dist/router-B4Z1LV9b.js +4 -0
- package/dist/router-BlxJIE3W.js +604 -0
- package/dist/router-BlxJIE3W.js.map +1 -0
- package/dist/router.d.ts +4 -0
- package/dist/router.js +7 -0
- package/dist/{runtime-config-DI5OfIC6.js → runtime-config-DdN1Frg7.js} +6 -9
- package/dist/runtime-config-DdN1Frg7.js.map +1 -0
- package/dist/{sentry-jfDyrxdX.js → sentry-CJb7--mu.js} +7 -4
- package/dist/{sentry-jfDyrxdX.js.map → sentry-CJb7--mu.js.map} +1 -1
- package/dist/{SettingsModal-BJVPEHbo.js → settings-2Id1UgNY.js} +126 -83
- package/dist/settings-2Id1UgNY.js.map +1 -0
- package/dist/settings-CjvK8OKA.js +91 -0
- package/dist/settings-CjvK8OKA.js.map +1 -0
- package/dist/shell-head.html +1 -0
- package/dist/shell.html +1 -0
- package/dist/sidebar-BXf8OEwm.d.ts +34 -0
- package/dist/sidebar-BXf8OEwm.d.ts.map +1 -0
- package/dist/sidebar-lAVFRsni.js +31 -0
- package/dist/sidebar-lAVFRsni.js.map +1 -0
- package/dist/start-connect.d.ts +4 -1
- package/dist/start-connect.d.ts.map +1 -1
- package/dist/start-connect.js +9 -5
- package/dist/start-connect.js.map +1 -1
- package/dist/style.css +36 -18
- package/dist/{useRegistryPackages-3EcR3GOh.js → useRegistryPackages-BqIWwXV-.js} +5 -5
- package/dist/{useRegistryPackages-3EcR3GOh.js.map → useRegistryPackages-BqIWwXV-.js.map} +1 -1
- package/fonts.css +177 -0
- package/package.json +51 -22
- package/scripts/critical-css.ts +243 -0
- package/scripts/prerender-shell.ts +100 -0
- package/src/routeTree.gen.ts +293 -0
- package/src/router/connect-router.ts +170 -0
- package/src/router/drive-route-loader.ts +116 -0
- package/src/router/index.ts +51 -0
- package/src/router/navigation.ts +230 -0
- package/src/router/perf-marks.test.tsx +98 -0
- package/src/router/perf-marks.ts +97 -0
- package/src/router/register.ts +9 -0
- package/src/router/route-components.tsx +98 -0
- package/src/router/route-tree.ts +88 -0
- package/src/router/scroll.ts +69 -0
- package/src/router/search.ts +66 -0
- package/src/router/settings.ts +120 -0
- package/src/router/sidebar.ts +55 -0
- package/src/router/titles.test.ts +24 -0
- package/src/router/titles.ts +33 -0
- package/src/routes/__root.tsx +28 -0
- package/src/routes/core/_app/$.tsx +13 -0
- package/src/routes/core/_app/_content/d/$driveSlug/{-$nodeSlug}.tsx +52 -0
- package/src/routes/core/_app/_content/index.tsx +3 -0
- package/src/routes/core/_app/_content.tsx +9 -0
- package/src/routes/core/_app/settings/about.tsx +20 -0
- package/src/routes/core/_app/settings/ai-assistant.tsx +20 -0
- package/src/routes/core/_app/settings/danger-zone.tsx +21 -0
- package/src/routes/core/_app/settings/default-editors.tsx +20 -0
- package/src/routes/core/_app/settings/package-manager.tsx +20 -0
- package/src/routes/core/_app/settings.tsx +35 -0
- package/src/routes/core/_app.tsx +10 -0
- package/dist/AddDriveModal-C5odBO8y.js.map +0 -1
- package/dist/ClearStorageModal-nzpz8MeW.js.map +0 -1
- package/dist/DocumentVersionUnsupportedModal-C4fy7fZ6.js.map +0 -1
- package/dist/OpenFileDocumentsModal-BOmFtxS1.js.map +0 -1
- package/dist/SettingsModal-BJVPEHbo.js.map +0 -1
- package/dist/app-loader-CNCzLxgV.js +0 -2379
- package/dist/app-loader-CNCzLxgV.js.map +0 -1
- package/dist/app-loader-DvnGgSyC.js +0 -4
- package/dist/app-skeleton--Me5zlSz.js.map +0 -1
- package/dist/boot-CNW7ypcB.js.map +0 -1
- package/dist/components-BKUI79po.js +0 -5
- package/dist/load-BxQ82Cxc.js.map +0 -1
- package/dist/multi-reactor-BG-DqUcm.js.map +0 -1
- package/dist/package-manager-BPVMRBoV.js.map +0 -1
- package/dist/pglite-migrate-core-BcXcImng.js.map +0 -1
- package/dist/reactor-DHJyk5ow.js.map +0 -1
- package/dist/runtime-config-DI5OfIC6.js.map +0 -1
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="32e921d0-865f-52e1-8d3b-0048834f14f3")}catch(e){}}();
|
|
3
|
+
import { i as useReleasePrerenderedShell, t as LoadingShell } from "./prerendered-shell-DxCUDEXL.js";
|
|
4
|
+
import { t as getRuntimeConfig } from "./runtime-config-DdN1Frg7.js";
|
|
5
|
+
import { a as HOME_ROUTE_ID, n as bindConnectRouter, r as createConnectRouter, t as CONTENT_VIEW_ID } from "./connect-router-KmNBGS0G.js";
|
|
6
|
+
import { a as useDriveAuthGate, l as ErrorBoundary, o as useVisibleDrives, s as CenteredErrorMessage, t as AppLayout, u as useIsPluginActive } from "./app-layout-BIq-ZW-6.js";
|
|
7
|
+
import { t as useOpenRenownLogin } from "./use-renown-login-BzOSQETV.js";
|
|
8
|
+
import { t as DriveIcon } from "./drive-icon-BiVP8yJc.js";
|
|
9
|
+
import { t as AppSkeleton } from "./app-skeleton-gzg8cRzm.js";
|
|
10
|
+
import { a as defaultPHDocumentEditorConfig, i as defaultPHAppConfig, r as connectConfig } from "./connect.config-uZF-gnvV.js";
|
|
11
|
+
import { n as dismissToast, r as toast } from "./toast-C6WW-_O-.js";
|
|
12
|
+
import { Suspense, createElement, lazy, useCallback, useEffect, useMemo, useState } from "react";
|
|
13
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { createDriveArrivals, ensurePHStore, getDriveName, getRevisionFromDate, logout, makeDriveSlug, openTarget, preloadDrive, setPHAppConfig, setPHDocumentEditorConfig, setRevisionHistoryVisible, setSelectedDrive, setSelectedNode, showPHModal, useAppModuleById, useDefaultAppModule, useDocumentById, useDocumentModelModuleById, useDocumentOperations, useDocumentVersionStatus, useEditorModuleById, useFallbackEditorModule, useIsAddDriveEnabled, useLinkProps, useNodeParentFolderById, usePHStore, useRevisionHistoryVisible, useSelectedDocument, useSelectedDocumentId, useSelectedDriveSafe, useSelectedFolder, useSelectedTimelineItem, useVetraPackageManager, useVetraPackages } from "@powerhousedao/reactor-browser";
|
|
15
|
+
import { Outlet, RouterProvider, useMatch, useRouter, useRouterState } from "@tanstack/react-router";
|
|
16
|
+
import { DefaultEditorLoader, DriveAuthGate, DropZoneWrapper, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, RevisionHistory } from "@powerhousedao/design-system/connect";
|
|
17
|
+
import { Icon, PowerhouseButton } from "@powerhousedao/design-system";
|
|
18
|
+
import { useTranslation } from "react-i18next";
|
|
19
|
+
import { GenericDriveExplorer } from "@powerhousedao/powerhouse-vetra-packages/editors";
|
|
20
|
+
import { useHotkeys } from "react-hotkeys-hook";
|
|
21
|
+
import { redo, undo } from "@powerhousedao/shared/document-model";
|
|
22
|
+
//#region src/components/root.tsx
|
|
23
|
+
/** What every page shares; the sidebar is the `_app` layout's. */
|
|
24
|
+
function Root() {
|
|
25
|
+
useReleasePrerenderedShell(true);
|
|
26
|
+
return /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: "h-screen overflow-auto bg-background",
|
|
28
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
29
|
+
name: "Root",
|
|
30
|
+
children: /* @__PURE__ */ jsx(Outlet, {})
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/components/editor-loader.tsx
|
|
36
|
+
function EditorLoader(props) {
|
|
37
|
+
const { customEditorLoader, loadingTimeout = 200, ...defaultProps } = props;
|
|
38
|
+
const [showLoading, setShowLoading] = useState(loadingTimeout <= 0);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (loadingTimeout <= 0) return;
|
|
41
|
+
const timer = setTimeout(() => setShowLoading(true), loadingTimeout);
|
|
42
|
+
return () => clearTimeout(timer);
|
|
43
|
+
}, [loadingTimeout]);
|
|
44
|
+
if (!showLoading) return null;
|
|
45
|
+
if (customEditorLoader) return /* @__PURE__ */ jsx(Fragment$1, { children: customEditorLoader });
|
|
46
|
+
return /* @__PURE__ */ jsx(DefaultEditorLoader, { ...defaultProps });
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/hooks/useUndoRedoShortcuts.ts
|
|
50
|
+
const useUndoRedoShortcuts = (props) => {
|
|
51
|
+
const { undo, redo, canRedo, canUndo } = props;
|
|
52
|
+
const isMac = window.navigator.userAgent.includes("Mac");
|
|
53
|
+
let undoShortcut = "ctrl+z";
|
|
54
|
+
let redoShortcut = "ctrl+y";
|
|
55
|
+
if (isMac) {
|
|
56
|
+
undoShortcut = "mod+z";
|
|
57
|
+
redoShortcut = "mod+shift+z";
|
|
58
|
+
}
|
|
59
|
+
useHotkeys(undoShortcut, (event) => {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
if (canUndo) undo();
|
|
62
|
+
}, {}, [canUndo, undo]);
|
|
63
|
+
useHotkeys(redoShortcut, (event) => {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
if (canRedo) redo();
|
|
66
|
+
}, {}, [canRedo, redo]);
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/components/document-upgrade-toast.tsx
|
|
70
|
+
const DocumentUpgradeToast = ({ documentId }) => {
|
|
71
|
+
const { t } = useTranslation();
|
|
72
|
+
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
73
|
+
className: "font-medium",
|
|
74
|
+
children: t("notifications.documentUpgradeAvailable")
|
|
75
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
76
|
+
onClick: () => {
|
|
77
|
+
showPHModal({
|
|
78
|
+
type: "confirmDocumentUpgrade",
|
|
79
|
+
documentId
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
className: "underline decoration-solid underline-offset-2",
|
|
83
|
+
children: t("common.updateDocument")
|
|
84
|
+
})] });
|
|
85
|
+
};
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/components/editors.tsx
|
|
88
|
+
function EditorError({ title, children }) {
|
|
89
|
+
return /* @__PURE__ */ jsx("div", {
|
|
90
|
+
className: "flex size-full items-center justify-center p-6",
|
|
91
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
92
|
+
className: "w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm",
|
|
93
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
94
|
+
className: "mb-3 flex items-center gap-2",
|
|
95
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
96
|
+
name: "Error",
|
|
97
|
+
className: "size-5 shrink-0 text-destructive"
|
|
98
|
+
}), /* @__PURE__ */ jsx("h3", {
|
|
99
|
+
className: "min-w-0 text-lg font-semibold wrap-break-word text-foreground",
|
|
100
|
+
children: title
|
|
101
|
+
})]
|
|
102
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
103
|
+
className: "wrap-break-word",
|
|
104
|
+
children
|
|
105
|
+
})]
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function defaultScope(scopes) {
|
|
110
|
+
return scopes.includes("global") ? "global" : scopes[0];
|
|
111
|
+
}
|
|
112
|
+
function OpenPackageManagerButton() {
|
|
113
|
+
return /* @__PURE__ */ jsx(PowerhouseButton, {
|
|
114
|
+
className: "px-3 py-1.5 text-base font-medium",
|
|
115
|
+
onClick: () => {
|
|
116
|
+
openTarget({ settings: "package-manager" });
|
|
117
|
+
},
|
|
118
|
+
type: "button",
|
|
119
|
+
children: "Open package manager"
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const DocumentEditor = (props) => {
|
|
123
|
+
const { document: initialDocument } = props;
|
|
124
|
+
const selectedTimelineItem = useSelectedTimelineItem();
|
|
125
|
+
const revisionHistoryVisible = useRevisionHistoryVisible();
|
|
126
|
+
const [document, dispatch] = useDocumentById(initialDocument.header.id);
|
|
127
|
+
const documentId = document?.header.id ?? void 0;
|
|
128
|
+
const documentName = document?.header.name ?? void 0;
|
|
129
|
+
const documentType = document?.header.documentType ?? void 0;
|
|
130
|
+
const preferredEditor = document?.header.meta?.preferredEditor ?? void 0;
|
|
131
|
+
const scopes = useMemo(() => {
|
|
132
|
+
const keys = Object.keys(document?.header.revision ?? {});
|
|
133
|
+
return keys.length > 0 ? keys : ["global"];
|
|
134
|
+
}, [document?.header.revision]);
|
|
135
|
+
const [operationScope, setOperationScope] = useState(() => defaultScope(scopes));
|
|
136
|
+
const selectedScope = scopes.includes(operationScope) ? operationScope : defaultScope(scopes);
|
|
137
|
+
const { operations: historyOperations, isLoading: isLoadingHistory, hasNextPage: historyHasNextPage, fetchNextPage: fetchNextHistoryPage, error: historyError } = useDocumentOperations(documentId, selectedScope, {
|
|
138
|
+
enabled: revisionHistoryVisible,
|
|
139
|
+
limit: 500
|
|
140
|
+
});
|
|
141
|
+
const { operations: globalOperations, hasNextPage: globalHasNextPage, isLoading: isLoadingGlobal, fetchNextPage: fetchNextGlobalPage, error: globalError } = useDocumentOperations(documentId, "global", {
|
|
142
|
+
enabled: !!selectedTimelineItem,
|
|
143
|
+
limit: 500
|
|
144
|
+
});
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (!globalHasNextPage || isLoadingGlobal || globalError) return;
|
|
147
|
+
const handle = window.setTimeout(fetchNextGlobalPage, 0);
|
|
148
|
+
return () => window.clearTimeout(handle);
|
|
149
|
+
}, [
|
|
150
|
+
globalHasNextPage,
|
|
151
|
+
isLoadingGlobal,
|
|
152
|
+
fetchNextGlobalPage,
|
|
153
|
+
globalError
|
|
154
|
+
]);
|
|
155
|
+
const globalRevisionNumber = document?.header.revision.global ?? 0;
|
|
156
|
+
const localRevisionNumber = document?.header.revision.local ?? 0;
|
|
157
|
+
const documentModelModule = useDocumentModelModuleById(documentType);
|
|
158
|
+
const preferredEditorModule = useEditorModuleById(preferredEditor);
|
|
159
|
+
const fallbackEditorModule = useFallbackEditorModule(documentType);
|
|
160
|
+
const editorModule = preferredEditorModule ?? fallbackEditorModule;
|
|
161
|
+
const versionStatus = useDocumentVersionStatus(document ?? void 0);
|
|
162
|
+
const versionStatusKind = versionStatus?.kind;
|
|
163
|
+
const upgradeAvailable = versionStatus?.kind === "upgrade-available" && versionStatus.canUpgrade;
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (upgradeAvailable && documentId) toast(createElement(DocumentUpgradeToast, { documentId }), {
|
|
166
|
+
type: "connect-warning",
|
|
167
|
+
toastId: `outdated-document-${documentId}`,
|
|
168
|
+
autoClose: false
|
|
169
|
+
});
|
|
170
|
+
else if (versionStatusKind && versionStatusKind !== "upgrade-available" && documentId) dismissToast(`outdated-document-${documentId}`);
|
|
171
|
+
}, [
|
|
172
|
+
upgradeAvailable,
|
|
173
|
+
versionStatusKind,
|
|
174
|
+
documentId
|
|
175
|
+
]);
|
|
176
|
+
const vetraPackages = useVetraPackages();
|
|
177
|
+
const packageManager = useVetraPackageManager();
|
|
178
|
+
const owningPackageName = editorModule ? vetraPackages.find((pkg) => pkg.editors.includes(editorModule))?.manifest.name : void 0;
|
|
179
|
+
const owningPackageVersion = owningPackageName && packageManager ? packageManager.getPackageVersion(owningPackageName) : void 0;
|
|
180
|
+
const editorBundleKey = owningPackageName ? `${owningPackageName}@${owningPackageVersion ?? "unknown"}` : editorModule?.config.id ?? "no-editor";
|
|
181
|
+
const isLoadingDocument = !document;
|
|
182
|
+
const isLoadingEditor = editorModule && documentType && !editorModule.documentTypes.includes(documentType) && !editorModule.documentTypes.includes("*");
|
|
183
|
+
const canUndo = globalRevisionNumber > 0 || localRevisionNumber > 0;
|
|
184
|
+
const canRedo = !!document?.clipboard.length;
|
|
185
|
+
const addUndoAction = () => dispatch(undo());
|
|
186
|
+
const addRedoAction = () => dispatch(redo());
|
|
187
|
+
useUndoRedoShortcuts({
|
|
188
|
+
undo: addUndoAction,
|
|
189
|
+
redo: addRedoAction,
|
|
190
|
+
canUndo,
|
|
191
|
+
canRedo
|
|
192
|
+
});
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
return () => {
|
|
195
|
+
window.documentEditorDebugTools?.clear();
|
|
196
|
+
};
|
|
197
|
+
}, []);
|
|
198
|
+
const [editorError, setEditorError] = useState(void 0);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
if (editorError && editorError.documentId !== documentId) setEditorError(void 0);
|
|
201
|
+
}, [editorError, documentId]);
|
|
202
|
+
const handleEditorError = (error, info) => {
|
|
203
|
+
setEditorError({
|
|
204
|
+
error,
|
|
205
|
+
documentId,
|
|
206
|
+
info
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
if (isLoadingEditor) return /* @__PURE__ */ jsx(EditorLoader, { message: "Loading editor" });
|
|
210
|
+
if (isLoadingDocument) return /* @__PURE__ */ jsx(EditorLoader, { message: "Loading document" });
|
|
211
|
+
if (!documentModelModule) return /* @__PURE__ */ jsxs(EditorError, {
|
|
212
|
+
title: "Document type not supported",
|
|
213
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
214
|
+
className: "mb-4 text-sm text-foreground",
|
|
215
|
+
children: [
|
|
216
|
+
"This document can't be opened because the \"",
|
|
217
|
+
documentType,
|
|
218
|
+
"\" document model isn't installed. Install the package that provides it to open the document."
|
|
219
|
+
]
|
|
220
|
+
}), /* @__PURE__ */ jsx(OpenPackageManagerButton, {})]
|
|
221
|
+
});
|
|
222
|
+
if (versionStatus?.kind === "unsupported") return /* @__PURE__ */ jsxs(EditorError, {
|
|
223
|
+
title: "Document version not supported",
|
|
224
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
225
|
+
className: "mb-4 text-sm text-foreground",
|
|
226
|
+
children: [
|
|
227
|
+
"This document requires version ",
|
|
228
|
+
versionStatus.documentVersion,
|
|
229
|
+
" of the \"",
|
|
230
|
+
documentType,
|
|
231
|
+
"\" document model, but only version",
|
|
232
|
+
versionStatus.availableVersions.length > 1 ? "s" : "",
|
|
233
|
+
" ",
|
|
234
|
+
versionStatus.availableVersions.join(", "),
|
|
235
|
+
" ",
|
|
236
|
+
versionStatus.availableVersions.length > 1 ? "are" : "is",
|
|
237
|
+
" installed. Update the package that provides \"",
|
|
238
|
+
documentType,
|
|
239
|
+
"\" to open it."
|
|
240
|
+
]
|
|
241
|
+
}), /* @__PURE__ */ jsx(OpenPackageManagerButton, {})]
|
|
242
|
+
});
|
|
243
|
+
if (!editorModule) return /* @__PURE__ */ jsxs(EditorError, {
|
|
244
|
+
title: "No editor available",
|
|
245
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
246
|
+
className: "mb-4 text-sm text-foreground",
|
|
247
|
+
children: [
|
|
248
|
+
"The \"",
|
|
249
|
+
documentType,
|
|
250
|
+
"\" document model is installed, but no editor for it was found. Install a package that provides an editor for this document type."
|
|
251
|
+
]
|
|
252
|
+
}), /* @__PURE__ */ jsx(OpenPackageManagerButton, {})]
|
|
253
|
+
});
|
|
254
|
+
const EditorComponent = editorModule.Component;
|
|
255
|
+
return /* @__PURE__ */ jsx("div", {
|
|
256
|
+
className: "relative h-full",
|
|
257
|
+
id: "document-editor-context",
|
|
258
|
+
"data-editor": editorModule.config.id,
|
|
259
|
+
"data-document-type": documentType,
|
|
260
|
+
children: revisionHistoryVisible ? /* @__PURE__ */ jsx(RevisionHistory, {
|
|
261
|
+
documentTitle: documentName ?? "",
|
|
262
|
+
documentId: documentId ?? "",
|
|
263
|
+
operations: historyOperations,
|
|
264
|
+
isLoading: isLoadingHistory,
|
|
265
|
+
hasNextPage: historyHasNextPage,
|
|
266
|
+
onLoadNextPage: fetchNextHistoryPage,
|
|
267
|
+
error: historyError,
|
|
268
|
+
scopes,
|
|
269
|
+
scope: selectedScope,
|
|
270
|
+
onScopeChange: setOperationScope,
|
|
271
|
+
onClose: () => setRevisionHistoryVisible(false),
|
|
272
|
+
documentState: document.state,
|
|
273
|
+
onCopyState: () => {
|
|
274
|
+
toast("Copied document state to clipboard", { type: "success" });
|
|
275
|
+
},
|
|
276
|
+
onCopyDocId: () => {
|
|
277
|
+
toast("Copied document ID to clipboard", { type: "success" });
|
|
278
|
+
}
|
|
279
|
+
}, documentId) : /* @__PURE__ */ jsx(Suspense, {
|
|
280
|
+
fallback: /* @__PURE__ */ jsx(EditorLoader, { message: "Loading editor" }),
|
|
281
|
+
name: "EditorLoader",
|
|
282
|
+
children: /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
283
|
+
fallbackRender: CenteredErrorMessage,
|
|
284
|
+
resetKeys: [documentId],
|
|
285
|
+
onError: handleEditorError,
|
|
286
|
+
loggerContext: ["Connect", "DocumentEditor"],
|
|
287
|
+
children: !editorError?.error && /* @__PURE__ */ jsx(EditorComponent, {
|
|
288
|
+
context: {
|
|
289
|
+
readMode: !!selectedTimelineItem,
|
|
290
|
+
selectedTimelineRevision: (isLoadingGlobal || globalHasNextPage) && !globalError ? void 0 : getRevisionFromDate(selectedTimelineItem?.startDate, selectedTimelineItem?.endDate, globalOperations)
|
|
291
|
+
},
|
|
292
|
+
documentId: document.header.id
|
|
293
|
+
}, `${editorBundleKey}:${documentId}`)
|
|
294
|
+
})
|
|
295
|
+
})
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/components/document-editor-container.tsx
|
|
300
|
+
function DocumentEditorContainer() {
|
|
301
|
+
const [selectedDocument] = useSelectedDocument();
|
|
302
|
+
const parentFolder = useNodeParentFolderById(selectedDocument.header.id);
|
|
303
|
+
useMemo(() => {
|
|
304
|
+
return async () => {};
|
|
305
|
+
}, []);
|
|
306
|
+
useCallback(() => {
|
|
307
|
+
setSelectedNode(parentFolder);
|
|
308
|
+
}, [parentFolder]);
|
|
309
|
+
return /* @__PURE__ */ jsx("div", {
|
|
310
|
+
id: "document-editor-container",
|
|
311
|
+
className: "flex-1",
|
|
312
|
+
"data-document-type": selectedDocument.header.documentType,
|
|
313
|
+
children: /* @__PURE__ */ jsx(DocumentEditor, { document: selectedDocument })
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/components/app-container.tsx
|
|
318
|
+
function AppContainer() {
|
|
319
|
+
const [selectedDrive] = useSelectedDriveSafe();
|
|
320
|
+
const selectedDocumentId = useSelectedDocumentId();
|
|
321
|
+
const app = useAppModuleById(selectedDrive?.header.meta?.preferredEditor);
|
|
322
|
+
const defaultApp = useDefaultAppModule();
|
|
323
|
+
if (!selectedDrive) return /* @__PURE__ */ jsx(EditorLoader, {});
|
|
324
|
+
const AppComponent = app?.Component ?? defaultApp?.Component ?? GenericDriveExplorer.Component;
|
|
325
|
+
if (!AppComponent) throw new Error("No app component found");
|
|
326
|
+
return /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
327
|
+
variant: "detailed",
|
|
328
|
+
resetKeys: [selectedDrive.header.id],
|
|
329
|
+
loggerContext: ["Connect", "App"],
|
|
330
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
331
|
+
fallback: /* @__PURE__ */ jsx(EditorLoader, {}),
|
|
332
|
+
children: /* @__PURE__ */ jsx(DropZoneWrapper, {
|
|
333
|
+
className: "flex h-full flex-col overflow-auto",
|
|
334
|
+
children: /* @__PURE__ */ jsx(AppComponent, { children: selectedDocumentId ? /* @__PURE__ */ jsx(DocumentEditorContainer, {}) : null })
|
|
335
|
+
})
|
|
336
|
+
})
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/components/if-plugin.tsx
|
|
341
|
+
/**
|
|
342
|
+
* Renders its children only when a plugin is present in the served
|
|
343
|
+
* composition — the runtime gate for generic-chrome deletability (rewire R3).
|
|
344
|
+
*
|
|
345
|
+
* This is the demonstration step ahead of extracting the generic components
|
|
346
|
+
* into their own package: it makes "remove the generic plugin → the chrome is
|
|
347
|
+
* gone" true at render time while the code still lives in the Connect app.
|
|
348
|
+
* When those components move to `@powerhousedao/connect-generic`, this gate
|
|
349
|
+
* becomes the seam where the package is dynamically imported (or not) instead
|
|
350
|
+
* of merely not rendered.
|
|
351
|
+
*
|
|
352
|
+
* Presence is activation, classic-preserving: with no declared composition,
|
|
353
|
+
* every plugin reads active, so the chrome renders unchanged.
|
|
354
|
+
*/
|
|
355
|
+
function IfPlugin(props) {
|
|
356
|
+
return useIsPluginActive(props.module) ? props.children : props.fallback ?? null;
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/components/route-views.tsx
|
|
360
|
+
const PROGRESS_DELAY_MS = 150;
|
|
361
|
+
/** True until the router has resolved its first location. */
|
|
362
|
+
function useIsColdStart() {
|
|
363
|
+
return useRouterState({ select: (state) => !state.resolvedLocation });
|
|
364
|
+
}
|
|
365
|
+
/** Whether the content shows home: a cold deep link shows the pending view. */
|
|
366
|
+
function useShowsHomeScreen(hasSelection) {
|
|
367
|
+
const isColdStart = useIsColdStart();
|
|
368
|
+
const isHomeRoute = !!useMatch({
|
|
369
|
+
from: HOME_ROUTE_ID,
|
|
370
|
+
shouldThrow: false
|
|
371
|
+
});
|
|
372
|
+
return !hasSelection && (isHomeRoute || !isColdStart);
|
|
373
|
+
}
|
|
374
|
+
const DRIVE_PENDING_FADE = "ph-drive-pending-in 200ms ease-in 100ms both";
|
|
375
|
+
/** A loader on a cold start; otherwise the open view stays while loading. */
|
|
376
|
+
function DrivePending() {
|
|
377
|
+
if (!useIsColdStart()) return null;
|
|
378
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
379
|
+
className: "flex size-full items-center justify-center",
|
|
380
|
+
style: { animation: DRIVE_PENDING_FADE },
|
|
381
|
+
children: [/* @__PURE__ */ jsx("style", { children: `@keyframes ph-drive-pending-in{from{opacity:0}to{opacity:1}}` }), /* @__PURE__ */ jsx(DefaultEditorLoader, { message: "Loading drive" })]
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
/** A route's loader or render error, as Connect's error boundaries show it. */
|
|
385
|
+
function RouteError({ error, reset }) {
|
|
386
|
+
return /* @__PURE__ */ jsx(CenteredErrorMessage, {
|
|
387
|
+
error,
|
|
388
|
+
resetErrorBoundary: reset
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
/** A thin top bar while a route takes longer than PROGRESS_DELAY_MS. */
|
|
392
|
+
function RouteProgressBar() {
|
|
393
|
+
const router = useRouter();
|
|
394
|
+
const [visible, setVisible] = useState(false);
|
|
395
|
+
useEffect(() => {
|
|
396
|
+
let timer;
|
|
397
|
+
const start = () => {
|
|
398
|
+
clearTimeout(timer);
|
|
399
|
+
timer = setTimeout(() => setVisible(true), PROGRESS_DELAY_MS);
|
|
400
|
+
};
|
|
401
|
+
const stop = () => {
|
|
402
|
+
clearTimeout(timer);
|
|
403
|
+
setVisible(false);
|
|
404
|
+
};
|
|
405
|
+
if (router.state.isLoading) start();
|
|
406
|
+
const unsubscribes = [router.subscribe("onBeforeLoad", start), router.subscribe("onResolved", stop)];
|
|
407
|
+
return () => {
|
|
408
|
+
clearTimeout(timer);
|
|
409
|
+
for (const unsubscribe of unsubscribes) unsubscribe();
|
|
410
|
+
};
|
|
411
|
+
}, [router]);
|
|
412
|
+
if (!visible) return null;
|
|
413
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
414
|
+
role: "progressbar",
|
|
415
|
+
"aria-label": "Loading",
|
|
416
|
+
className: "pointer-events-none fixed inset-x-0 top-0 z-50 h-[3px] overflow-hidden",
|
|
417
|
+
children: [/* @__PURE__ */ jsx("style", { children: `@keyframes ph-route-progress{0%{transform:translateX(-100%)}100%{transform:translateX(250%)}}` }), /* @__PURE__ */ jsx("div", {
|
|
418
|
+
className: "h-full w-2/5 bg-[#3b82f6]",
|
|
419
|
+
style: { animation: "ph-route-progress 1.1s ease-in-out infinite" }
|
|
420
|
+
})]
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
/** Wraps the matches: the skeleton until the first view shows, and the bar. */
|
|
424
|
+
function RouterChrome({ children }) {
|
|
425
|
+
const isEmpty = useRouterState({ select: (state) => !state.matches.length });
|
|
426
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
427
|
+
isEmpty && /* @__PURE__ */ jsx(LoadingShell, { Fallback: AppSkeleton }),
|
|
428
|
+
children,
|
|
429
|
+
/* @__PURE__ */ jsx(RouteProgressBar, {})
|
|
430
|
+
] });
|
|
431
|
+
}
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/pages/content.tsx
|
|
434
|
+
function Content() {
|
|
435
|
+
const { gate, dismiss } = useDriveAuthGate();
|
|
436
|
+
const openLogin = useOpenRenownLogin();
|
|
437
|
+
const [selectedDrive] = useSelectedDriveSafe();
|
|
438
|
+
const selectedFolder = useSelectedFolder();
|
|
439
|
+
const selectedDocumentId = useSelectedDocumentId();
|
|
440
|
+
useEffect(() => {
|
|
441
|
+
if (!selectedDocumentId) setPHDocumentEditorConfig(defaultPHDocumentEditorConfig);
|
|
442
|
+
}, [selectedDocumentId]);
|
|
443
|
+
useEffect(() => {
|
|
444
|
+
if (!selectedDrive) setPHAppConfig(defaultPHAppConfig);
|
|
445
|
+
}, [selectedDrive]);
|
|
446
|
+
const hasSelection = !!(selectedDocumentId || selectedDrive || selectedFolder);
|
|
447
|
+
const showHomeScreen = useShowsHomeScreen(hasSelection);
|
|
448
|
+
return /* @__PURE__ */ jsxs(ContentContainer, { children: [/* @__PURE__ */ jsx(Outlet, {}), gate ? /* @__PURE__ */ jsx("div", {
|
|
449
|
+
className: "flex h-full items-center justify-center p-4",
|
|
450
|
+
children: /* @__PURE__ */ jsx(DriveAuthGate, {
|
|
451
|
+
mode: gate,
|
|
452
|
+
onLogin: openLogin,
|
|
453
|
+
onLogout: () => void logout(),
|
|
454
|
+
onClose: dismiss
|
|
455
|
+
})
|
|
456
|
+
}) : showHomeScreen ? /* @__PURE__ */ jsx(IfPlugin, {
|
|
457
|
+
module: "@powerhousedao/connect/plugins/generic",
|
|
458
|
+
children: /* @__PURE__ */ jsx(HomeScreenContainer, {})
|
|
459
|
+
}) : hasSelection ? /* @__PURE__ */ jsx(AppContainer, {}) : null] });
|
|
460
|
+
}
|
|
461
|
+
function ContentContainer({ children }) {
|
|
462
|
+
return /* @__PURE__ */ jsx("div", {
|
|
463
|
+
className: "flex h-full flex-col overflow-auto",
|
|
464
|
+
id: CONTENT_VIEW_ID,
|
|
465
|
+
"data-scroll-restoration-id": CONTENT_VIEW_ID,
|
|
466
|
+
children
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
function DriveItem({ drive }) {
|
|
470
|
+
const description = useAppModuleById(drive.header.meta?.preferredEditor)?.config.name || "Drive Explorer App";
|
|
471
|
+
const link = useLinkProps({ driveSlug: makeDriveSlug(drive) }, () => setSelectedDrive(drive));
|
|
472
|
+
return /* @__PURE__ */ jsx(HomeScreenItem, {
|
|
473
|
+
title: getDriveName(drive),
|
|
474
|
+
description,
|
|
475
|
+
icon: /* @__PURE__ */ jsx(DriveIcon, { drive }),
|
|
476
|
+
href: link.href,
|
|
477
|
+
"aria-current": link["aria-current"],
|
|
478
|
+
onClick: link.onClick,
|
|
479
|
+
onPreload: () => preloadDrive(drive)
|
|
480
|
+
}, drive.header.id);
|
|
481
|
+
}
|
|
482
|
+
function HomeScreenContainer() {
|
|
483
|
+
const drives = useVisibleDrives();
|
|
484
|
+
const isAddDriveEnabled = useIsAddDriveEnabled();
|
|
485
|
+
const homeBackground = getRuntimeConfig().connect?.branding?.homeBackground;
|
|
486
|
+
return /* @__PURE__ */ jsxs(HomeScreen, {
|
|
487
|
+
homeBackground,
|
|
488
|
+
children: [drives?.map((drive) => {
|
|
489
|
+
return /* @__PURE__ */ jsx(DriveItem, { drive }, drive.header.id);
|
|
490
|
+
}), isAddDriveEnabled && /* @__PURE__ */ jsx(HomeScreenAddDriveItem, {})]
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region src/components/not-found-page.tsx
|
|
495
|
+
/** The 404 page: what was asked for, and a way home. */
|
|
496
|
+
function NotFoundPage({ driveSlug }) {
|
|
497
|
+
const pathname = useRouterState({ select: (s) => s.location.pathname });
|
|
498
|
+
const home = useLinkProps(void 0);
|
|
499
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
500
|
+
role: "alert",
|
|
501
|
+
className: "flex size-full flex-col items-center justify-center gap-3 p-6 text-center",
|
|
502
|
+
children: [
|
|
503
|
+
/* @__PURE__ */ jsx("h1", {
|
|
504
|
+
className: "text-2xl font-semibold text-foreground",
|
|
505
|
+
children: driveSlug ? `Drive ${driveSlug} not found` : "Page not found"
|
|
506
|
+
}),
|
|
507
|
+
/* @__PURE__ */ jsxs("p", {
|
|
508
|
+
className: "text-muted-foreground",
|
|
509
|
+
children: [
|
|
510
|
+
"Nothing is at",
|
|
511
|
+
" ",
|
|
512
|
+
/* @__PURE__ */ jsx("code", {
|
|
513
|
+
"data-testid": "not-found-path",
|
|
514
|
+
className: "text-foreground",
|
|
515
|
+
children: pathname
|
|
516
|
+
}),
|
|
517
|
+
"."
|
|
518
|
+
]
|
|
519
|
+
}),
|
|
520
|
+
/* @__PURE__ */ jsx("a", {
|
|
521
|
+
...home,
|
|
522
|
+
className: "text-foreground underline",
|
|
523
|
+
children: "Go to the home page"
|
|
524
|
+
})
|
|
525
|
+
]
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
function DriveNotFoundPage({ driveSlug }) {
|
|
529
|
+
return /* @__PURE__ */ jsx(NotFoundPage, { driveSlug });
|
|
530
|
+
}
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region src/components/router.tsx
|
|
533
|
+
const EmptyView = () => null;
|
|
534
|
+
const settingsModule = () => import("./settings-2Id1UgNY.js");
|
|
535
|
+
const lazySettings = (name) => lazy(() => settingsModule().then((m) => ({ default: m[name] })));
|
|
536
|
+
const SettingsPage = lazySettings("SettingsPage");
|
|
537
|
+
const connectRouteComponents = {
|
|
538
|
+
root: () => /* @__PURE__ */ jsx(Suspense, {
|
|
539
|
+
name: "RouteRoot",
|
|
540
|
+
fallback: /* @__PURE__ */ jsx(LoadingShell, { Fallback: EmptyView }),
|
|
541
|
+
children: /* @__PURE__ */ jsx(Root, {})
|
|
542
|
+
}),
|
|
543
|
+
app: () => /* @__PURE__ */ jsx(AppLayout, {}),
|
|
544
|
+
content: () => /* @__PURE__ */ jsx(Suspense, {
|
|
545
|
+
name: "Drive",
|
|
546
|
+
children: /* @__PURE__ */ jsx(Content, {})
|
|
547
|
+
}),
|
|
548
|
+
notFound: NotFoundPage,
|
|
549
|
+
drivePending: DrivePending,
|
|
550
|
+
driveNotFound: DriveNotFoundPage,
|
|
551
|
+
error: RouteError,
|
|
552
|
+
settings: () => /* @__PURE__ */ jsx(Suspense, {
|
|
553
|
+
name: "Settings",
|
|
554
|
+
children: /* @__PURE__ */ jsx(SettingsPage, {})
|
|
555
|
+
}),
|
|
556
|
+
settingsTabs: {
|
|
557
|
+
...connectConfig.aiAssistantEnabled && { "ai-assistant": lazySettings("AiAssistant") },
|
|
558
|
+
"package-manager": lazySettings("ConnectPackageManager"),
|
|
559
|
+
"default-editors": lazySettings("DefaultEditor"),
|
|
560
|
+
"danger-zone": lazySettings("DangerZone"),
|
|
561
|
+
about: lazySettings("About")
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
let connectRouter;
|
|
565
|
+
let routerStore;
|
|
566
|
+
let unbindConnectRouter;
|
|
567
|
+
import.meta.hot?.dispose(() => unbindConnectRouter?.());
|
|
568
|
+
function getConnectRouterFor(store) {
|
|
569
|
+
if (connectRouter) {
|
|
570
|
+
if (import.meta.env.DEV && store !== routerStore) throw new Error("Connect's router is already bound to another PH store");
|
|
571
|
+
return connectRouter;
|
|
572
|
+
}
|
|
573
|
+
routerStore = store;
|
|
574
|
+
connectRouter = createConnectRouter({
|
|
575
|
+
store,
|
|
576
|
+
arrivals: createDriveArrivals(store),
|
|
577
|
+
components: connectRouteComponents,
|
|
578
|
+
basepath: connectConfig.routerBasename,
|
|
579
|
+
InnerWrap: RouterChrome,
|
|
580
|
+
appName: getRuntimeConfig().connect.branding?.appName
|
|
581
|
+
});
|
|
582
|
+
unbindConnectRouter = bindConnectRouter(connectRouter, store);
|
|
583
|
+
return connectRouter;
|
|
584
|
+
}
|
|
585
|
+
/** The app's router, e.g. for tracing. */
|
|
586
|
+
function getConnectRouter() {
|
|
587
|
+
return getConnectRouterFor(ensurePHStore()).router;
|
|
588
|
+
}
|
|
589
|
+
const RouterDevtools = import.meta.env.DEV ? lazy(() => import("./esm-BDACZntJ.js").then((m) => ({ default: m.TanStackRouterDevtools }))) : void 0;
|
|
590
|
+
const Router$1 = () => {
|
|
591
|
+
const { router } = getConnectRouterFor(usePHStore() ?? ensurePHStore());
|
|
592
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RouterProvider, { router }), RouterDevtools && /* @__PURE__ */ jsx(Suspense, {
|
|
593
|
+
name: "RouterDevtools",
|
|
594
|
+
children: /* @__PURE__ */ jsx(RouterDevtools, {
|
|
595
|
+
router,
|
|
596
|
+
position: "bottom-left"
|
|
597
|
+
})
|
|
598
|
+
})] });
|
|
599
|
+
};
|
|
600
|
+
//#endregion
|
|
601
|
+
export { AppContainer as a, EditorLoader as c, IfPlugin as i, Root as l, connectRouteComponents as n, DocumentEditorContainer as o, getConnectRouter as r, DocumentEditor as s, Router$1 as t };
|
|
602
|
+
|
|
603
|
+
//# sourceMappingURL=router-BlxJIE3W.js.map
|
|
604
|
+
//# debugId=32e921d0-865f-52e1-8d3b-0048834f14f3
|