@powerhousedao/connect 6.2.3-staging.0 → 6.3.0-dev.1
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 +29 -1
- package/dist/{AddDriveModal-DhNfP94R.js → AddDriveModal-zMepHdWt.js} +43 -17
- package/dist/AddDriveModal-zMepHdWt.js.map +1 -0
- package/dist/{ClearStorageModal-RRBhBwt9.js → ClearStorageModal-Br-y7qXc.js} +10 -12
- package/dist/ClearStorageModal-Br-y7qXc.js.map +1 -0
- package/dist/{ConfirmDocumentUpgradeModal-DcOZy20m.js → ConfirmDocumentUpgradeModal-CoixS60F.js} +4 -4
- package/dist/ConfirmDocumentUpgradeModal-CoixS60F.js.map +1 -0
- package/dist/{CookiesPolicyModal-BLw4pnhn.js → CookiesPolicyModal-BpFjYc7T.js} +4 -4
- package/dist/{CookiesPolicyModal-BLw4pnhn.js.map → CookiesPolicyModal-BpFjYc7T.js.map} +1 -1
- package/dist/CreateDocumentModal-CiIW3pzx.js +45 -0
- package/dist/CreateDocumentModal-CiIW3pzx.js.map +1 -0
- package/dist/{DebugSettingsModal-CszP0h2F.js → DebugSettingsModal-FALLjVVv.js} +10 -10
- package/dist/DebugSettingsModal-FALLjVVv.js.map +1 -0
- package/dist/{DeleteDriveModal-CjGnG0ht.js → DeleteDriveModal-1pAIayG_.js} +5 -5
- package/dist/DeleteDriveModal-1pAIayG_.js.map +1 -0
- package/dist/{DeleteItemModal-BbY_4_xT.js → DeleteItemModal-BUpqmFxS.js} +6 -6
- package/dist/DeleteItemModal-BUpqmFxS.js.map +1 -0
- package/dist/{DisclaimerModal-DuglmEwL.js → DisclaimerModal-TIJXRYLF.js} +6 -6
- package/dist/DisclaimerModal-TIJXRYLF.js.map +1 -0
- package/dist/{DocumentVersionUnsupportedModal-C4fy7fZ6.js → DocumentVersionUnsupportedModal-DH9Zzsyw.js} +6 -6
- package/dist/DocumentVersionUnsupportedModal-DH9Zzsyw.js.map +1 -0
- package/dist/{DownloadDocumentWithErrorsModal-BsPQ5qgy.js → DownloadDocumentWithErrorsModal-Beh-xw8B.js} +5 -5
- package/dist/DownloadDocumentWithErrorsModal-Beh-xw8B.js.map +1 -0
- package/dist/{DriveAuthRequiredModal-CtsB0kwH.js → DriveAuthRequiredModal-XTcoJKvj.js} +6 -6
- package/dist/DriveAuthRequiredModal-XTcoJKvj.js.map +1 -0
- package/dist/DriveSettingsModal-CGZQhzBa.js +127 -0
- package/dist/DriveSettingsModal-CGZQhzBa.js.map +1 -0
- package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js +2565 -0
- package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js.map +1 -0
- package/dist/{InspectorModal-BirNNcyV.js → InspectorModal-xU_gCAhG.js} +20 -20
- package/dist/InspectorModal-xU_gCAhG.js.map +1 -0
- package/dist/{LoginModal-CI0ogC2-.js → LoginModal-O06ZvWFI.js} +7 -7
- package/dist/LoginModal-O06ZvWFI.js.map +1 -0
- package/dist/{OpenFileDocumentsModal-DKxleujF.js → OpenFileDocumentsModal-DJsC1oR1.js} +19 -14
- package/dist/OpenFileDocumentsModal-DJsC1oR1.js.map +1 -0
- package/dist/{UpgradeDriveModal-CXX6D5Au.js → UpgradeDriveModal-CCWKp5yn.js} +6 -6
- package/dist/UpgradeDriveModal-CCWKp5yn.js.map +1 -0
- package/dist/ai-tools-BGUMFEMV.js +42 -0
- package/dist/ai-tools-BGUMFEMV.js.map +1 -0
- package/dist/ai-tools-D_q-Whju.js +4 -0
- package/dist/app-loader-BQrucpDg.js +4 -0
- package/dist/app-loader-orww5vEA.js +1254 -0
- package/dist/app-loader-orww5vEA.js.map +1 -0
- package/dist/{app-skeleton--Me5zlSz.js → app-skeleton-CMUP2zaz.js} +36 -16
- package/dist/app-skeleton-CMUP2zaz.js.map +1 -0
- package/dist/app-skeleton-CdD1m8G3.js +4 -0
- package/dist/{boot-DPNEOI2A.js → boot-BBIArGAP.js} +32 -9
- package/dist/boot-BBIArGAP.js.map +1 -0
- package/dist/{build-info-DbLCcPJY.js → build-info-BTuoWZYI.js} +10 -6
- package/dist/build-info-BTuoWZYI.js.map +1 -0
- package/dist/components-B3kuhyeE.js +121 -0
- package/dist/components-B3kuhyeE.js.map +1 -0
- package/dist/{connect.config-CaXMoB42.js → connect.config-DL9nKtlW.js} +8 -7
- package/dist/connect.config-DL9nKtlW.js.map +1 -0
- package/dist/{connection-state-Eqc2izmt.js → connection-state-0ippUGEC.js} +28 -12
- package/dist/connection-state-0ippUGEC.js.map +1 -0
- package/dist/context-De2EB1AA-Ni0d829Q.js +1759 -0
- package/dist/context-De2EB1AA-Ni0d829Q.js.map +1 -0
- package/dist/{cookie-banner-BxXvPdIY.js → cookie-banner-NclLYtB0.js} +6 -6
- package/dist/{cookie-banner-BxXvPdIY.js.map → cookie-banner-NclLYtB0.js.map} +1 -1
- package/dist/document-editor-container-C91BsZkt.js +4 -0
- package/dist/document-editor-container-Dkk87_q1.js +311 -0
- package/dist/document-editor-container-Dkk87_q1.js.map +1 -0
- package/dist/drive-icon-BIpd8edR.js +49 -0
- package/dist/drive-icon-BIpd8edR.js.map +1 -0
- package/dist/drive-placements-DjeVpTTm.js +38 -0
- package/dist/drive-placements-DjeVpTTm.js.map +1 -0
- package/dist/error-boundary-BsUBww61.js +155 -0
- package/dist/error-boundary-BsUBww61.js.map +1 -0
- package/dist/esm-BDACZntJ.js +148 -0
- package/dist/esm-BDACZntJ.js.map +1 -0
- package/dist/generic.d.ts +140 -0
- package/dist/generic.d.ts.map +1 -0
- package/dist/generic.js +31 -0
- package/dist/generic.js.map +1 -0
- package/dist/{i18n-CTgT1HG-.js → i18n-D9WYPgk9.js} +4 -4
- package/dist/{i18n-CTgT1HG-.js.map → i18n-D9WYPgk9.js.map} +1 -1
- package/dist/index-D7c2WAbn.d.ts +4 -0
- package/dist/layout-Dj3_KscE.js +5 -0
- package/dist/layout.d.ts +3 -0
- package/dist/layout.js +4 -0
- package/dist/{load-DaOnJm3B.js → load-C0hy-vOY.js} +48 -48
- package/dist/load-C0hy-vOY.js.map +1 -0
- package/dist/load-runtime-config-BoDzcgEV.js +14 -0
- package/dist/load-runtime-config-BoDzcgEV.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/open-file-uploads-B5pr1sA2.js +183 -0
- package/dist/open-file-uploads-B5pr1sA2.js.map +1 -0
- package/dist/{package-manager-BbzIV9aN.js → package-manager-B1Nxbull.js} +96 -31
- package/dist/package-manager-B1Nxbull.js.map +1 -0
- package/dist/{pglite-major-p4_YefAE.js → pglite-major-pao-ozRo.js} +5 -5
- package/dist/pglite-major-pao-ozRo.js.map +1 -0
- package/dist/{pglite-migrate-core-BcXcImng.js → pglite-migrate-core-B6FqmhH8.js} +5 -5
- package/dist/pglite-migrate-core-B6FqmhH8.js.map +1 -0
- package/dist/{pglite-seed-Cl2d-iyl.js → pglite-seed-CZsMNsV8.js} +8 -4
- package/dist/pglite-seed-CZsMNsV8.js.map +1 -0
- package/dist/plugin-configs.d.ts +242 -0
- package/dist/plugin-configs.d.ts.map +1 -0
- package/dist/plugin-configs.js +26 -0
- package/dist/plugin-configs.js.map +1 -0
- package/dist/plugins--mJeXJ7w.js +264 -0
- package/dist/plugins--mJeXJ7w.js.map +1 -0
- package/dist/{preferences-store-DZUIAkHE.js → preferences-store-DxYAnGCc.js} +5 -5
- package/dist/preferences-store-DxYAnGCc.js.map +1 -0
- package/dist/prerender.d.ts +38 -0
- package/dist/prerender.d.ts.map +1 -0
- package/dist/prerender.js +195 -0
- package/dist/prerender.js.map +1 -0
- package/dist/prerendered-shell-peKE7AqI.js +51 -0
- package/dist/prerendered-shell-peKE7AqI.js.map +1 -0
- package/dist/{pwa-manifest-link-DQRJpF0r.js → pwa-manifest-link-DNwWvnLV.js} +5 -5
- package/dist/{pwa-manifest-link-DQRJpF0r.js.map → pwa-manifest-link-DNwWvnLV.js.map} +1 -1
- package/dist/reactor-Drpw-sgc.js +1656 -0
- package/dist/reactor-Drpw-sgc.js.map +1 -0
- package/dist/reactor-chat-C6yp2S37.js +15 -0
- package/dist/reactor-chat-C6yp2S37.js.map +1 -0
- package/dist/reactor.worker.js +444 -168
- package/dist/reactor.worker.js.map +1 -1
- package/dist/{registerServiceWorker-smkROQhm.js → registerServiceWorker-OR8nokAn.js} +5 -5
- package/dist/{registerServiceWorker-smkROQhm.js.map → registerServiceWorker-OR8nokAn.js.map} +1 -1
- package/dist/root-v9fj27sn.js +27 -0
- package/dist/root-v9fj27sn.js.map +1 -0
- package/dist/route-tree.d.ts +2220 -0
- package/dist/route-tree.d.ts.map +1 -0
- package/dist/route-tree.js +135 -0
- package/dist/route-tree.js.map +1 -0
- package/dist/route-views-BovMNHyn.js +60 -0
- package/dist/route-views-BovMNHyn.js.map +1 -0
- package/dist/route-views-C-H3ofJW.js +4 -0
- package/dist/route-views-DzgRMAx8.js +55 -0
- package/dist/route-views-DzgRMAx8.js.map +1 -0
- package/dist/route-views.d.ts +7 -0
- package/dist/route-views.d.ts.map +1 -0
- package/dist/route-views.js +4 -0
- package/dist/router-CWIsjETx.js +54 -0
- package/dist/router-CWIsjETx.js.map +1 -0
- package/dist/router-CnWkTEey.js +4 -0
- package/dist/router.d.ts +2 -0
- package/dist/router.js +3 -0
- package/dist/sentry-Cuc_Nbba.js +22 -0
- package/dist/sentry-Cuc_Nbba.js.map +1 -0
- package/dist/settings-C0o6eJvm.js +1089 -0
- package/dist/settings-C0o6eJvm.js.map +1 -0
- package/dist/settings-tabs-1V-sBOlj.js +424 -0
- package/dist/settings-tabs-1V-sBOlj.js.map +1 -0
- package/dist/shell-core-head.html +2 -0
- package/dist/shell-core.html +1 -0
- package/dist/shell-head.html +2 -0
- package/dist/shell-plugins.json +1 -0
- package/dist/shell.html +1 -0
- package/dist/start-connect.d.ts +5 -6
- package/dist/start-connect.d.ts.map +1 -1
- package/dist/start-connect.js +8 -5
- package/dist/start-connect.js.map +1 -1
- package/dist/store-lock-Bi3B9VJD.js +159 -0
- package/dist/store-lock-Bi3B9VJD.js.map +1 -0
- package/dist/style.css +3510 -3667
- package/dist/ui-BITvvqdH.js +66 -0
- package/dist/ui-BITvvqdH.js.map +1 -0
- package/dist/ui-C1-l-Eyh.js +170 -0
- package/dist/ui-C1-l-Eyh.js.map +1 -0
- package/dist/{use-renown-login-BzOSQETV.js → use-renown-login-dPpDOYq5.js} +4 -4
- package/dist/use-renown-login-dPpDOYq5.js.map +1 -0
- package/dist/workflows-C3qEvx1R.js +63 -0
- package/dist/workflows-C3qEvx1R.js.map +1 -0
- package/fonts.css +177 -0
- package/generic-routes.json +9 -0
- package/package.json +82 -21
- package/scripts/assert-plugin-configs.mjs +47 -0
- package/scripts/prerender-shell.ts +51 -0
- package/skills/customize-connect/SKILL.md +80 -0
- package/skills/customize-connect/references/data-and-navigation.md +315 -0
- package/skills/customize-connect/references/drive-apps.md +44 -0
- package/skills/customize-connect/references/hosts-and-plugins.md +88 -0
- package/skills/customize-connect/references/layout.md +162 -0
- package/skills/customize-connect/references/modals.md +99 -0
- package/skills/customize-connect/references/overrides.md +177 -0
- package/skills/customize-connect/references/packages.md +41 -0
- package/skills/customize-connect/references/pages.md +141 -0
- package/skills/customize-connect/references/runtime-config.md +411 -0
- package/skills/customize-connect/references/styles-and-branding.md +76 -0
- package/skills/customize-connect/references/types-and-troubleshooting.md +64 -0
- package/src/route-tree.ts +3 -0
- package/src/routeTree.gen.ts +235 -0
- package/src/router/index.ts +2 -0
- package/src/router/register.ts +9 -0
- package/src/routes/__root.tsx +12 -0
- package/src/routes/_app/$.tsx +13 -0
- package/src/routes/_app/d/$driveSlug/{-$nodeSlug}.tsx +13 -0
- package/src/routes/_app/d/$driveSlug.tsx +13 -0
- package/src/routes/_app/index.tsx +13 -0
- package/src/routes/_app/settings/appearance.tsx +13 -0
- package/src/routes/_app/settings/packages.tsx +13 -0
- package/src/routes/_app/settings.tsx +13 -0
- package/src/routes/_app.tsx +13 -0
- package/style.css +6 -23
- package/tailwind.css +12 -0
- package/theme.css +5 -0
- package/dist/AddDriveModal-DhNfP94R.js.map +0 -1
- package/dist/ClearStorageModal-RRBhBwt9.js.map +0 -1
- package/dist/ConfirmDocumentUpgradeModal-DcOZy20m.js.map +0 -1
- package/dist/CreateDocumentModal-Bmv0V-kY.js +0 -36
- package/dist/CreateDocumentModal-Bmv0V-kY.js.map +0 -1
- package/dist/DebugSettingsModal-CszP0h2F.js.map +0 -1
- package/dist/DeleteDriveModal-CjGnG0ht.js.map +0 -1
- package/dist/DeleteItemModal-BbY_4_xT.js.map +0 -1
- package/dist/DisclaimerModal-DuglmEwL.js.map +0 -1
- package/dist/DocumentVersionUnsupportedModal-C4fy7fZ6.js.map +0 -1
- package/dist/DownloadDocumentWithErrorsModal-BsPQ5qgy.js.map +0 -1
- package/dist/DriveAuthRequiredModal-CtsB0kwH.js.map +0 -1
- package/dist/DriveSettingsModal-d1L0eYof.js +0 -57
- package/dist/DriveSettingsModal-d1L0eYof.js.map +0 -1
- package/dist/InspectorModal-BirNNcyV.js.map +0 -1
- package/dist/LoginModal-CI0ogC2-.js.map +0 -1
- package/dist/MissingPackageModal-HFUPQMML.js +0 -49
- package/dist/MissingPackageModal-HFUPQMML.js.map +0 -1
- package/dist/OpenFileDocumentsModal-DKxleujF.js.map +0 -1
- package/dist/SettingsModal-C1vvdYGa.js +0 -571
- package/dist/SettingsModal-C1vvdYGa.js.map +0 -1
- package/dist/UpgradeDriveModal-CXX6D5Au.js.map +0 -1
- package/dist/app-loader-BxojpvRl.js +0 -4
- package/dist/app-loader-wu8Nfpe0.js +0 -2283
- package/dist/app-loader-wu8Nfpe0.js.map +0 -1
- package/dist/app-skeleton--Me5zlSz.js.map +0 -1
- package/dist/app-skeleton-CBN4tenZ.js +0 -4
- package/dist/boot-DPNEOI2A.js.map +0 -1
- package/dist/build-info-DbLCcPJY.js.map +0 -1
- package/dist/components-k4a5c62z.js +0 -5
- package/dist/connect.config-CaXMoB42.js.map +0 -1
- package/dist/connection-state-Eqc2izmt.js.map +0 -1
- package/dist/load-DaOnJm3B.js.map +0 -1
- package/dist/package-manager-BbzIV9aN.js.map +0 -1
- package/dist/pglite-major-p4_YefAE.js.map +0 -1
- package/dist/pglite-migrate-core-BcXcImng.js.map +0 -1
- package/dist/pglite-seed-Cl2d-iyl.js.map +0 -1
- package/dist/preferences-store-DZUIAkHE.js.map +0 -1
- package/dist/reactor-DxTnqFry.js +0 -1095
- package/dist/reactor-DxTnqFry.js.map +0 -1
- package/dist/renown-trust-DRgHpxlZ.js +0 -34
- package/dist/renown-trust-DRgHpxlZ.js.map +0 -1
- package/dist/runtime-config-DtJIUgYw.js +0 -24
- package/dist/runtime-config-DtJIUgYw.js.map +0 -1
- package/dist/sentry-jfDyrxdX.js +0 -15
- package/dist/sentry-jfDyrxdX.js.map +0 -1
- package/dist/use-renown-login-BzOSQETV.js.map +0 -1
- package/dist/useIsEmbedded-BWJ0qb7w.js +0 -26
- package/dist/useIsEmbedded-BWJ0qb7w.js.map +0 -1
- package/dist/useRegistryPackages-DuoU75ap.js +0 -453
- package/dist/useRegistryPackages-DuoU75ap.js.map +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { a as SidebarItem, c as useNavRoutes, i as ModalFrameProps, l as useSidebarMode, n as ContentOutlet, o as useConnectChrome, r as ModalDialog, s as useDriveRouteData, t as ConnectChrome } from "./index-D7c2WAbn.js";
|
|
2
|
+
import React$1, { ReactNode } from "react";
|
|
3
|
+
import { ConnectSettingsTab } from "@powerhousedao/connect-core/router";
|
|
4
|
+
import "@powerhousedao/reactor-browser";
|
|
5
|
+
import "@tanstack/react-router";
|
|
6
|
+
import { DocumentDriveDocument } from "@powerhousedao/shared/document-drive";
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/generic/layout/app-layout.d.ts
|
|
9
|
+
type AppLayoutProps = {
|
|
10
|
+
/** Replaces Connect's sidebar, e.g. `<ConnectSidebar extraItems={...} />`. */
|
|
11
|
+
sidebar?: ReactNode;
|
|
12
|
+
/** Above the matched route, beside the sidebar, e.g. a header bar. */
|
|
13
|
+
header?: ReactNode;
|
|
14
|
+
/** Below the matched route, beside the sidebar. */
|
|
15
|
+
footer?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
/** The `_app` layout: the sidebar beside the matched route, with an optional
|
|
18
|
+
* header and footer around it. Embedded mode drops all three, and
|
|
19
|
+
* `staticData.sidebar: "hidden"` the sidebar; `useConnectChrome()` tells a
|
|
20
|
+
* replaced layout the same. */
|
|
21
|
+
export declare function AppLayout({ sidebar, header, footer }?: AppLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/generic/layout/route-views.d.ts
|
|
24
|
+
/** A loader on a cold start; otherwise the open view stays while loading. */
|
|
25
|
+
export declare function DrivePending(): import("react/jsx-runtime").JSX.Element | null;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/generic/layout/sidebar.d.ts
|
|
28
|
+
/** The drives the user may open, and the add-drive item when enabled. */
|
|
29
|
+
export declare function SidebarDriveItems(): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
/** Links to the routes that declare `staticData.nav`, in order. */
|
|
31
|
+
export declare function SidebarNavItems(): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
type SidebarProps = {
|
|
33
|
+
/** Items after the drives and nav routes, e.g. a custom layout's links. */
|
|
34
|
+
extraItems?: ReactNode;
|
|
35
|
+
/** Header and footer only, no items. */
|
|
36
|
+
collapsed?: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** Connect's sidebar: drives, nav routes, settings and the user. */
|
|
39
|
+
declare function Sidebar({ extraItems, collapsed }?: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/generic/editors/open-document.d.ts
|
|
42
|
+
/** The route's open document's editor, e.g. in a project's drive route
|
|
43
|
+
* override; nothing while no document is open. */
|
|
44
|
+
export declare function OpenDocument(): import("react/jsx-runtime").JSX.Element | null;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/generic/pages/content.d.ts
|
|
47
|
+
/** Connect's home: the drives, and adding one. A custom home builds on its
|
|
48
|
+
* parts: ConnectHomeScreen, HomeDriveItem, HomeAddDriveItem, useVisibleDrives. */
|
|
49
|
+
export declare function Home(): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
/** The home's grid, on the configured `home.background`. */
|
|
51
|
+
export declare function ConnectHomeScreen({ children }: {
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
/** The add-drive tile, or nothing where adding drives is turned off. */
|
|
55
|
+
export declare function HomeAddDriveItem(): import("react/jsx-runtime").JSX.Element | null;
|
|
56
|
+
/** Connect's drive layout: the drive app around the open document, or the
|
|
57
|
+
* sign-in gate when the drive's remote refuses the user. */
|
|
58
|
+
export declare function DriveLayout(): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
/** Connect's node route: the open document's editor. */
|
|
60
|
+
export declare function NodeView(): import("react/jsx-runtime").JSX.Element | null;
|
|
61
|
+
/** A drive's card: its name, its app and a link that opens it. */
|
|
62
|
+
export declare function HomeDriveItem({ drive }: {
|
|
63
|
+
drive: DocumentDriveDocument;
|
|
64
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/generic/pages/use-drive-auth-gate.d.ts
|
|
67
|
+
/** `useDrives()` minus the drives dismissed from the auth gate this session. */
|
|
68
|
+
export declare function useVisibleDrives(): DocumentDriveDocument[] | undefined;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/generic/settings/about.d.ts
|
|
71
|
+
declare const About: React.FC;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/generic/settings/ai-assistant.d.ts
|
|
74
|
+
/**
|
|
75
|
+
* Settings-modal section for the in-browser AI assistant: the user master
|
|
76
|
+
* toggle, the OpenAI-compatible endpoint configuration, and a
|
|
77
|
+
* save-and-test-connection action. Only mounted when the deployment
|
|
78
|
+
* enables the feature (`connect.ai.assistantEnabled`).
|
|
79
|
+
*/
|
|
80
|
+
declare const AiAssistant: React.FC;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/generic/settings/danger-zone.d.ts
|
|
83
|
+
declare const DangerZone: React.FC;
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/generic/settings/default-editor.d.ts
|
|
86
|
+
declare const DefaultEditor: React.FC;
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/generic/settings/package-manager.d.ts
|
|
89
|
+
declare const ConnectPackageManager: React$1.FC;
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/generic/settings/settings-page.d.ts
|
|
92
|
+
/** The settings page: its tabs as links beside the open one. */
|
|
93
|
+
declare function SettingsPage$1(): import("react/jsx-runtime").JSX.Element;
|
|
94
|
+
declare namespace index_d_exports {
|
|
95
|
+
export { About, AiAssistant, ConnectPackageManager, DangerZone, DefaultEditor, SettingsPage$1 as SettingsPage };
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/generic/settings/tabs.d.ts
|
|
99
|
+
/** Whether the AI assistant is configured. Not connect.config, which a project
|
|
100
|
+
* route importing the tabs would evaluate before the config loads. */
|
|
101
|
+
export declare const aiAssistantEnabled: () => boolean;
|
|
102
|
+
/** Connect's settings page around the shown tab. */
|
|
103
|
+
export declare const SettingsPage: import("@tanstack/react-router").AsyncRouteComponent<unknown>;
|
|
104
|
+
/** One of Connect's settings tabs. */
|
|
105
|
+
export declare function settingsTab(name: Exclude<keyof typeof index_d_exports, "SettingsPage">): import("@tanstack/react-router").AsyncRouteComponent<{}>;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/generic/settings-tabs.d.ts
|
|
108
|
+
/** The generic plugin's settings tabs by path: each tab's route options, which a
|
|
109
|
+
* project file at that path spreads to replace the tab's view. */
|
|
110
|
+
export declare const genericSettingsTabs: {
|
|
111
|
+
"ai-assistant": {
|
|
112
|
+
staticData: {
|
|
113
|
+
settings: ConnectSettingsTab;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
"package-manager": {
|
|
117
|
+
staticData: {
|
|
118
|
+
settings: ConnectSettingsTab;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
"default-editors": {
|
|
122
|
+
staticData: {
|
|
123
|
+
settings: ConnectSettingsTab;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
"danger-zone": {
|
|
127
|
+
staticData: {
|
|
128
|
+
settings: ConnectSettingsTab;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
about: {
|
|
132
|
+
staticData: {
|
|
133
|
+
settings: ConnectSettingsTab;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
//#endregion
|
|
138
|
+
export { type AppLayoutProps, type ConnectChrome, Sidebar as ConnectSidebar, type SidebarProps as ConnectSidebarProps, ContentOutlet, ModalDialog, type ModalFrameProps, SidebarItem, useConnectChrome, useDriveRouteData, useNavRoutes, useSidebarMode };
|
|
139
|
+
export {};
|
|
140
|
+
//# sourceMappingURL=generic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.d.ts","names":[],"sources":["../src/generic/layout/app-layout.tsx","../src/generic/layout/route-views.tsx","../src/generic/layout/sidebar.tsx","../src/generic/editors/open-document.tsx","../src/generic/pages/content.tsx","../src/generic/pages/use-drive-auth-gate.ts","../src/generic/settings/about.tsx","../src/generic/settings/ai-assistant.tsx","../src/generic/settings/danger-zone.tsx","../src/generic/settings/default-editor.tsx","../src/generic/settings/package-manager.tsx","../src/generic/settings/settings-page.tsx","../src/generic/settings/index.ts","../src/generic/settings/tabs.ts","../src/generic/settings-tabs.ts"],"mappings":";;;;;;;;KAOY;;EAEV,UAAU;;EAEV,SAAS;;EAET,SAAS;;;;;;wBAOK,YAAY,SAAS,QAAQ,WAAU,6CAAmB,IAAA;;;;wBCX1D,4CAAY,IAAA;;;;wBC6CZ,iDAAiB,IAAA;;wBAiDjB,+CAAe,IAAA;KAWnB;;EAEV,aAAa;;EAEb;;;iBAIc,UAAU,YAAY,cAAa,2CAAiB,IAAA;;;;;wBC7GpD,4CAAY,IAAA;;;;;wBCgBZ,oCAAI,IAAA;;wBAaJ,oBAAoB;EAAc,WAAW;gCAAW,IAAA;;wBAMxD,gDAAgB,IAAA;;;wBAMhB,2CAAW,IAAA;;wBAoBX,wCAAQ,IAAA;;wBAQR,gBAAgB;EAAW,OAAO;gCAAuB,IAAA;;;;wBCuBzD,oBAAoB;;;cCpFvB,OAAO,MAAM;;;;;;;;;cCGb,aAAa,MAAM;;;cCfnB,YAAY,MAAM;;;cCDlB,eAAe,MAAM;;;cCWrB,uBAAuB,QAAM;;;;iBCgB1B,8CAAY,IAAA;;;;;;;;qBE7Bf;;qBAOA,+CAAY;;wBAGT,YACd,MAAM,qBAAqB,oEAA+B;;;;;qBCJ/C;EACX;;;;;EAMA;;;;;EAKA;;;;;EAKA;;;;;EAMA"}
|
package/dist/generic.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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]="a22e7ee3-a1b4-5773-abee-29f7a20f6fb3")}catch(e){}}();
|
|
3
|
+
import { a as useDriveRouteData, i as useConnectChrome, n as ModalDialog, o as useNavRoutes, r as SidebarItem, s as useSidebarMode, t as ContentOutlet } from "./layout-Dj3_KscE.js";
|
|
4
|
+
import { r as ErrorBoundary } from "./error-boundary-BsUBww61.js";
|
|
5
|
+
import { _ as SidebarNavItems, a as settingsTab, c as Home, d as NodeView, f as DrivePending, g as SidebarDriveItems, h as Sidebar, i as aiAssistantEnabled, l as HomeAddDriveItem, m as AppLayout, o as ConnectHomeScreen, r as SettingsPage, s as DriveLayout, t as genericSettingsTabs, u as HomeDriveItem, v as useVisibleDrives } from "./settings-tabs-1V-sBOlj.js";
|
|
6
|
+
import { n as EditorLoader } from "./document-editor-container-Dkk87_q1.js";
|
|
7
|
+
import { Suspense, lazy } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { useDriveRouteData as useDriveRouteData$1 } from "@powerhousedao/connect-core/router";
|
|
10
|
+
//#region src/generic/editors/open-document.tsx
|
|
11
|
+
const DocumentEditorContainer = lazy(() => import("./document-editor-container-C91BsZkt.js").then((module) => ({ default: module.DocumentEditorContainer })));
|
|
12
|
+
/** The route's open document's editor, e.g. in a project's drive route
|
|
13
|
+
* override; nothing while no document is open. */
|
|
14
|
+
function OpenDocument() {
|
|
15
|
+
const { documentId } = useDriveRouteData$1();
|
|
16
|
+
if (!documentId) return null;
|
|
17
|
+
return /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
18
|
+
variant: "detailed",
|
|
19
|
+
resetKeys: [documentId],
|
|
20
|
+
loggerContext: ["Connect", "OpenDocument"],
|
|
21
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
22
|
+
fallback: /* @__PURE__ */ jsx(EditorLoader, {}),
|
|
23
|
+
children: /* @__PURE__ */ jsx(DocumentEditorContainer, { documentId })
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { AppLayout, ConnectHomeScreen, Sidebar as ConnectSidebar, ContentOutlet, DriveLayout, DrivePending, Home, HomeAddDriveItem, HomeDriveItem, ModalDialog, NodeView, OpenDocument, SettingsPage, SidebarDriveItems, SidebarItem, SidebarNavItems, aiAssistantEnabled, genericSettingsTabs, settingsTab, useConnectChrome, useDriveRouteData, useNavRoutes, useSidebarMode, useVisibleDrives };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=generic.js.map
|
|
31
|
+
//# debugId=a22e7ee3-a1b4-5773-abee-29f7a20f6fb3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.js","sources":["../src/generic/editors/open-document.tsx"],"sourcesContent":["import { useDriveRouteData } from \"@powerhousedao/connect-core/router\";\nimport { lazy, Suspense } from \"react\";\nimport { EditorLoader } from \"./editor-loader.js\";\nimport { ErrorBoundary } from \"@powerhousedao/connect/components/shared\";\n\nconst DocumentEditorContainer = lazy(() =>\n import(\"./document-editor-container.js\").then((module) => ({\n default: module.DocumentEditorContainer,\n })),\n);\n\n/** The route's open document's editor, e.g. in a project's drive route\n * override; nothing while no document is open. */\nexport function OpenDocument() {\n const { documentId } = useDriveRouteData();\n if (!documentId) return null;\n return (\n <ErrorBoundary\n variant=\"detailed\"\n resetKeys={[documentId]}\n loggerContext={[\"Connect\", \"OpenDocument\"]}\n >\n <Suspense fallback={<EditorLoader />}>\n <DocumentEditorContainer documentId={documentId} />\n </Suspense>\n </ErrorBoundary>\n );\n}\n"],"names":["useDriveRouteData"],"mappings":";;;;;;;;;;AAKA,MAAM,0BAA0B,WAC9B,OAAO,0CAAiC,CAAC,MAAM,YAAY,EACzD,SAAS,OAAO,wBAClB,EAAE,CACJ;;;AAIA,SAAgB,eAAe;CAC7B,MAAM,EAAE,eAAeA,oBAAkB;CACzC,IAAI,CAAC,YAAY,OAAO;CACxB,OACE,oBAAC,eAAD;EACE,SAAQ;EACR,WAAW,CAAC,UAAU;EACtB,eAAe,CAAC,WAAW,cAAc;EAEzC,UAAA,oBAAC,UAAD;GAAU,UAAU,oBAAC,cAAD,CAAe,CAAA;GACjC,UAAA,oBAAC,yBAAD,EAAqC,WAAa,CAAA;EAC1C,CAAA;CACG,CAAA;AAEnB","debug_id":"a22e7ee3-a1b4-5773-abee-29f7a20f6fb3"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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]="
|
|
3
|
-
import i18n from "i18next";
|
|
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]="f0b2e116-91b3-5b5d-95e7-2400fe83b7ae")}catch(e){}}();
|
|
4
3
|
import { initReactI18next } from "react-i18next";
|
|
4
|
+
import i18n from "i18next";
|
|
5
5
|
i18n.use(initReactI18next).init({
|
|
6
6
|
resources: { en: {
|
|
7
7
|
code: "en",
|
|
@@ -140,5 +140,5 @@ i18n.use(initReactI18next).init({
|
|
|
140
140
|
//#endregion
|
|
141
141
|
export { i18n as t };
|
|
142
142
|
|
|
143
|
-
//# sourceMappingURL=i18n-
|
|
144
|
-
//# debugId=
|
|
143
|
+
//# sourceMappingURL=i18n-D9WYPgk9.js.map
|
|
144
|
+
//# debugId=f0b2e116-91b3-5b5d-95e7-2400fe83b7ae
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-
|
|
1
|
+
{"version":3,"file":"i18n-D9WYPgk9.js","sources":["../src/i18n/locales/en.json","../src/i18n/index.ts"],"sourcesContent":["","import type { Resource } from \"i18next\";\nimport i18n from \"i18next\";\nimport { initReactI18next } from \"react-i18next\";\n\nimport translationEN from \"./locales/en.json\" with { type: \"json\" };\n\nconst resources: Resource = {\n en: {\n code: \"en\",\n name: \"English\",\n translation: translationEN,\n },\n};\n\ni18n\n .use(initReactI18next)\n .init({\n resources,\n fallbackLng: \"en\",\n debug: false,\n interpolation: {\n escapeValue: false,\n },\n })\n .catch((e: unknown) => {\n console.error(e);\n });\n\nexport { i18n };\nexport default i18n;\n"],"names":["translationEN"],"mappings":";;;;ACcA,KACG,IAAI,gBAAgB,CAAC,CACrB,KAAK;CACJ,aAVF,IAAI;EACF,MAAM;EACN,MAAM;EACN,aAAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAAA;CACf,EAME;CACA,aAAa;CACb,OAAO;CACP,eAAe,EACb,aAAa,MACf;AACF,CAAC,CAAC,CACD,OAAO,MAAe;CACrB,QAAQ,MAAM,CAAC;AACjB,CAAC","debug_id":"f0b2e116-91b3-5b5d-95e7-2400fe83b7ae"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ConnectChrome, ContentOutlet as ContentOutlet$1, ModalDialog, ModalFrameProps, useConnectChrome as useConnectChrome$1, useDriveRouteData as useDriveRouteData$1, useNavRoutes as useNavRoutes$1, useSidebarMode } from "@powerhousedao/connect-core/router";
|
|
2
|
+
import { SidebarItem as SidebarItem$1 } from "@powerhousedao/design-system/connect";
|
|
3
|
+
export { SidebarItem$1 as a, useNavRoutes$1 as c, ModalFrameProps as i, useSidebarMode as l, ContentOutlet$1 as n, useConnectChrome$1 as o, ModalDialog as r, useDriveRouteData$1 as s, ConnectChrome as t };
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ContentOutlet as ContentOutlet$1, ModalDialog, useConnectChrome as useConnectChrome$1, useDriveRouteData as useDriveRouteData$1, useNavRoutes as useNavRoutes$1, useSidebarMode } from "@powerhousedao/connect-core/router";
|
|
2
|
+
import { SidebarItem as SidebarItem$1 } from "@powerhousedao/design-system/connect";
|
|
3
|
+
export { useDriveRouteData$1 as a, useConnectChrome$1 as i, ModalDialog as n, useNavRoutes$1 as o, SidebarItem$1 as r, useSidebarMode as s, ContentOutlet$1 as t };
|
|
4
|
+
!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]="f1bd78ef-ea93-5f11-a8c5-0242044e36ec")}catch(e){}}();
|
|
5
|
+
//# debugId=f1bd78ef-ea93-5f11-a8c5-0242044e36ec
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as SidebarItem, c as useNavRoutes, i as ModalFrameProps, l as useSidebarMode, n as ContentOutlet, o as useConnectChrome, r as ModalDialog, s as useDriveRouteData, t as ConnectChrome } from "./index-D7c2WAbn.js";
|
|
2
|
+
export { type ConnectChrome, ContentOutlet, ModalDialog, type ModalFrameProps, SidebarItem, useConnectChrome, useDriveRouteData, useNavRoutes, useSidebarMode };
|
|
3
|
+
export {};
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { a as useDriveRouteData, i as useConnectChrome, n as ModalDialog, o as useNavRoutes, r as SidebarItem, s as useSidebarMode, t as ContentOutlet } from "./layout-Dj3_KscE.js";
|
|
2
|
+
export { ContentOutlet, ModalDialog, SidebarItem, useConnectChrome, useDriveRouteData, useNavRoutes, useSidebarMode };
|
|
3
|
+
!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]="d8c2bee4-909a-5cec-b0ec-0ebf05616aa7")}catch(e){}}();
|
|
4
|
+
//# debugId=d8c2bee4-909a-5cec-b0ec-0ebf05616aa7
|
|
@@ -1,16 +1,50 @@
|
|
|
1
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]="
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import { a as
|
|
9
|
-
import { n as seedPendingPgVersion } from "./pglite-seed-
|
|
10
|
-
import { n as createReactor } from "./reactor-
|
|
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]="ee9d69d2-2c4c-5708-8679-8667189cde2c")}catch(e){}}();
|
|
3
|
+
import { t as loadRuntimeConfig } from "./load-runtime-config-BoDzcgEV.js";
|
|
4
|
+
import { r as connectConfig } from "./connect.config-DL9nKtlW.js";
|
|
5
|
+
import { t as getBuildHash } from "./build-info-BTuoWZYI.js";
|
|
6
|
+
import { r as setUser } from "./sentry-Cuc_Nbba.js";
|
|
7
|
+
import "./i18n-D9WYPgk9.js";
|
|
8
|
+
import { a as detectMigrationMajor, o as detectReactorPgMajor } from "./connection-state-0ippUGEC.js";
|
|
9
|
+
import { n as seedPendingPgVersion } from "./pglite-seed-CZsMNsV8.js";
|
|
10
|
+
import { n as createReactor } from "./reactor-Drpw-sgc.js";
|
|
11
11
|
import { useEffect } from "react";
|
|
12
12
|
import { initTheme, useUser } from "@powerhousedao/reactor-browser";
|
|
13
13
|
import { logger } from "document-model";
|
|
14
|
+
window.navigator.appVersion.includes("Mac");
|
|
15
|
+
/**
|
|
16
|
+
* Same-origin build-identity probe. The build bakes a hash of the inputs that
|
|
17
|
+
* determine the deployed content into the bundle (define
|
|
18
|
+
* `PH_CONNECT_BUILD_HASH`, see builder-tools' connectBuildHashPlugin) and
|
|
19
|
+
* emits `build-hash.json` next to the app (served no-cache). Comparing the
|
|
20
|
+
* two tells us whether the server is serving a different build than the one
|
|
21
|
+
* this page was loaded from — the reliable "a new deploy went out" signal.
|
|
22
|
+
* Unlike the old GitHub-raw version check it works on localhost (it compares
|
|
23
|
+
* against what the origin actually serves, not a remote branch head) and
|
|
24
|
+
* needs no network beyond the app's own origin.
|
|
25
|
+
*
|
|
26
|
+
* Returns null when there is nothing to compare: dev/studio builds (no hash
|
|
27
|
+
* baked), a server predating `build-hash.json`, an offline fetch, or a
|
|
28
|
+
* malformed body.
|
|
29
|
+
*/
|
|
30
|
+
const getBuildHashStatus = async () => {
|
|
31
|
+
const currentHash = getBuildHash();
|
|
32
|
+
if (!currentHash || currentHash === "unknown") return null;
|
|
33
|
+
try {
|
|
34
|
+
const result = await fetch(`${import.meta.env.BASE_URL}build-hash.json`, { cache: "no-cache" });
|
|
35
|
+
if (!result.ok) return null;
|
|
36
|
+
const data = await result.json();
|
|
37
|
+
if (typeof data.hash !== "string" || !data.hash) return null;
|
|
38
|
+
return {
|
|
39
|
+
currentHash,
|
|
40
|
+
deployedHash: data.hash,
|
|
41
|
+
isCurrent: data.hash === currentHash
|
|
42
|
+
};
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
14
48
|
//#region src/hooks/useCheckLatestVersion.ts
|
|
15
49
|
const RELOADED_FOR_KEY = "ph-reloaded-for-build-hash";
|
|
16
50
|
/**
|
|
@@ -61,39 +95,6 @@ const useCheckLatestVersion = () => {
|
|
|
61
95
|
};
|
|
62
96
|
}, []);
|
|
63
97
|
};
|
|
64
|
-
window.navigator.appVersion.includes("Mac");
|
|
65
|
-
/**
|
|
66
|
-
* Same-origin build-identity probe. The build bakes a hash of the inputs that
|
|
67
|
-
* determine the deployed content into the bundle (define
|
|
68
|
-
* `PH_CONNECT_BUILD_HASH`, see builder-tools' connectBuildHashPlugin) and
|
|
69
|
-
* emits `build-hash.json` next to the app (served no-cache). Comparing the
|
|
70
|
-
* two tells us whether the server is serving a different build than the one
|
|
71
|
-
* this page was loaded from — the reliable "a new deploy went out" signal.
|
|
72
|
-
* Unlike the old GitHub-raw version check it works on localhost (it compares
|
|
73
|
-
* against what the origin actually serves, not a remote branch head) and
|
|
74
|
-
* needs no network beyond the app's own origin.
|
|
75
|
-
*
|
|
76
|
-
* Returns null when there is nothing to compare: dev/studio builds (no hash
|
|
77
|
-
* baked), a server predating `build-hash.json`, an offline fetch, or a
|
|
78
|
-
* malformed body.
|
|
79
|
-
*/
|
|
80
|
-
const getBuildHashStatus = async () => {
|
|
81
|
-
const currentHash = getBuildHash();
|
|
82
|
-
if (!currentHash || currentHash === "unknown") return null;
|
|
83
|
-
try {
|
|
84
|
-
const result = await fetch(`${import.meta.env.BASE_URL}build-hash.json`, { cache: "no-cache" });
|
|
85
|
-
if (!result.ok) return null;
|
|
86
|
-
const data = await result.json();
|
|
87
|
-
if (typeof data.hash !== "string" || !data.hash) return null;
|
|
88
|
-
return {
|
|
89
|
-
currentHash,
|
|
90
|
-
deployedHash: data.hash,
|
|
91
|
-
isCurrent: data.hash === currentHash
|
|
92
|
-
};
|
|
93
|
-
} catch {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
98
|
//#endregion
|
|
98
99
|
//#region src/store/user.ts
|
|
99
100
|
function useSetSentryUser() {
|
|
@@ -113,12 +114,11 @@ function useSetSentryUser() {
|
|
|
113
114
|
}
|
|
114
115
|
//#endregion
|
|
115
116
|
//#region src/components/load.tsx
|
|
116
|
-
async function loadComponent(localPackage) {
|
|
117
|
+
async function loadComponent(localPackage, store) {
|
|
117
118
|
await seedPendingPgVersion();
|
|
118
119
|
await Promise.all([detectReactorPgMajor(), detectMigrationMajor()]);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
await createReactor(localPackage);
|
|
120
|
+
await loadRuntimeConfig();
|
|
121
|
+
await createReactor(await localPackage, store);
|
|
122
122
|
return { default: ({ children }) => {
|
|
123
123
|
initTheme();
|
|
124
124
|
useSetSentryUser();
|
|
@@ -129,5 +129,5 @@ async function loadComponent(localPackage) {
|
|
|
129
129
|
//#endregion
|
|
130
130
|
export { loadComponent };
|
|
131
131
|
|
|
132
|
-
//# sourceMappingURL=load-
|
|
133
|
-
//# debugId=
|
|
132
|
+
//# sourceMappingURL=load-C0hy-vOY.js.map
|
|
133
|
+
//# debugId=ee9d69d2-2c4c-5708-8679-8667189cde2c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-C0hy-vOY.js","sources":["../src/hooks/utils.ts","../src/hooks/useCheckLatestVersion.ts","../src/store/user.ts","../src/components/load.tsx"],"sourcesContent":["import { getBuildHash } from \"../utils/build-info.js\";\n\nexport const isMac = window.navigator.appVersion.includes(\"Mac\");\n\nexport interface BuildHashStatus {\n /** Hash baked into the running build. */\n currentHash: string;\n /** Hash the server is currently serving. */\n deployedHash: string;\n /** true when the running build matches what the server serves. */\n isCurrent: boolean;\n}\n\n/**\n * Same-origin build-identity probe. The build bakes a hash of the inputs that\n * determine the deployed content into the bundle (define\n * `PH_CONNECT_BUILD_HASH`, see builder-tools' connectBuildHashPlugin) and\n * emits `build-hash.json` next to the app (served no-cache). Comparing the\n * two tells us whether the server is serving a different build than the one\n * this page was loaded from — the reliable \"a new deploy went out\" signal.\n * Unlike the old GitHub-raw version check it works on localhost (it compares\n * against what the origin actually serves, not a remote branch head) and\n * needs no network beyond the app's own origin.\n *\n * Returns null when there is nothing to compare: dev/studio builds (no hash\n * baked), a server predating `build-hash.json`, an offline fetch, or a\n * malformed body.\n */\nexport const getBuildHashStatus = async (): Promise<BuildHashStatus | null> => {\n const currentHash = getBuildHash();\n if (!currentHash || currentHash === \"unknown\") return null;\n try {\n const result = await fetch(`${import.meta.env.BASE_URL}build-hash.json`, {\n cache: \"no-cache\",\n });\n if (!result.ok) return null;\n const data = (await result.json()) as { hash?: unknown };\n if (typeof data.hash !== \"string\" || !data.hash) return null;\n return {\n currentHash,\n deployedHash: data.hash,\n isCurrent: data.hash === currentHash,\n };\n } catch {\n return null;\n }\n};\n","import { connectConfig } from \"@powerhousedao/connect/config\";\nimport { getBuildHashStatus } from \"./utils.js\";\nimport { logger } from \"document-model\";\nimport { useEffect } from \"react\";\n\n// Session-scoped guard: records the deployed hash this tab already reloaded\n// for, so a broken or rolling deploy (server hash keeps changing under us)\n// cannot turn the tab into a reload loop. Cleared implicitly with the tab.\nconst RELOADED_FOR_KEY = \"ph-reloaded-for-build-hash\";\n\n/**\n * Drop the service worker's stale caches (precache + the NetworkFirst shell\n * cache) before reloading onto a new deploy, so the post-reload navigation\n * is answered from the network / fresh build instead of leftovers of the\n * build we are leaving. Best-effort: if the Caches API is unavailable or a\n * delete fails, the reload still picks up the new shell (the navigation\n * route is NetworkFirst).\n */\nasync function clearStaleCaches(): Promise<void> {\n try {\n if (!(\"caches\" in window)) return;\n const keys = await window.caches.keys();\n await Promise.all(\n keys\n .filter((key) => key.includes(\"precache\") || key.includes(\"ph-shell\"))\n .map((key) => window.caches.delete(key)),\n );\n } catch (error) {\n logger.warn(\n \"Failed to clear stale caches before update reload @error\",\n error,\n );\n }\n}\n\n/**\n * Detects that the server is serving a different build than the one this\n * page was loaded from (a new deploy) and reloads onto it — once per session\n * per deployed hash. Checked on mount and whenever the tab returns to the\n * foreground, so a deploy that lands while the tab sits open is picked up on\n * the next focus without a manual reload. The in-tab \"new version available\"\n * service-worker prompt (ServiceWorkerUpdatePrompt) remains the opt-in path\n * for workers that are waiting but not yet controlling.\n */\nexport const useCheckLatestVersion = () => {\n useEffect(() => {\n if (\n import.meta.env.MODE === \"development\" ||\n connectConfig.studioMode ||\n !connectConfig.warnOutdatedApp\n ) {\n return;\n }\n\n const checkBuildHash = async () => {\n const status = await getBuildHashStatus();\n if (!status || status.isCurrent) return;\n\n const reloadedFor = window.sessionStorage.getItem(RELOADED_FOR_KEY);\n if (reloadedFor === status.deployedHash) return;\n window.sessionStorage.setItem(RELOADED_FOR_KEY, status.deployedHash);\n\n logger.info(\n \"New deploy detected — reloading from build @currentHash to @deployedHash\",\n status.currentHash,\n status.deployedHash,\n );\n await clearStaleCaches();\n window.location.reload();\n };\n\n void checkBuildHash();\n const onVisibilityChange = () => {\n if (document.visibilityState === \"visible\") void checkBuildHash();\n };\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return () => {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n };\n }, []);\n};\n","import { useUser } from \"@powerhousedao/reactor-browser\";\nimport type { User as SentryUser } from \"@sentry/react\";\nimport { useEffect } from \"react\";\nimport { setUser as setSentryUser } from \"../services/sentry.js\";\n\nexport function useSetSentryUser() {\n const user = useUser();\n useEffect(() => {\n let sentryUser: SentryUser | null = null;\n if (user) {\n // saves the user info except the credential\n const { credential: _credential, ...rest } = user;\n sentryUser = { id: rest.did, username: rest.ens?.name, ...rest };\n }\n setSentryUser(sentryUser);\n }, [user]);\n}\n","import { useCheckLatestVersion } from \"@powerhousedao/connect/hooks\";\nimport \"@powerhousedao/connect/i18n\";\nimport { createReactor, useSetSentryUser } from \"@powerhousedao/connect/store\";\nimport {\n detectMigrationMajor,\n detectReactorPgMajor,\n seedPendingPgVersion,\n} from \"@powerhousedao/connect/utils\";\nimport type { PHStore } from \"@powerhousedao/reactor-browser\";\nimport { initTheme } from \"@powerhousedao/reactor-browser\";\nimport type { DocumentModelLib } from \"document-model\";\nimport { type ReactNode } from \"react\";\nimport { loadRuntimeConfig } from \"../load-runtime-config.js\";\n\nexport async function loadComponent(\n localPackage: DocumentModelLib | Promise<DocumentModelLib> | undefined,\n store: PHStore,\n) {\n await seedPendingPgVersion();\n await Promise.all([detectReactorPgMajor(), detectMigrationMajor()]);\n await loadRuntimeConfig();\n await createReactor(await localPackage, store);\n return {\n default: ({ children }: { children?: ReactNode }) => {\n initTheme();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useSetSentryUser();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useCheckLatestVersion();\n return children;\n },\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAEqB,OAAO,UAAU,WAAW,SAAS,KAAK;;;;;;;;;;;;;;;;AA0B/D,MAAa,qBAAqB,YAA6C;CAC7E,MAAM,cAAc,aAAa;CACjC,IAAI,CAAC,eAAe,gBAAgB,WAAW,OAAO;CACtD,IAAI;EACF,MAAM,SAAS,MAAM,MAAM,GAAG,YAAY,IAAI,SAAS,kBAAkB,EACvE,OAAO,WACT,CAAC;EACD,IAAI,CAAC,OAAO,IAAI,OAAO;EACvB,MAAM,OAAQ,MAAM,OAAO,KAAK;EAChC,IAAI,OAAO,KAAK,SAAS,YAAY,CAAC,KAAK,MAAM,OAAO;EACxD,OAAO;GACL;GACA,cAAc,KAAK;GACnB,WAAW,KAAK,SAAS;EAC3B;CACF,QAAQ;EACN,OAAO;CACT;AACF;;;ACtCA,MAAM,mBAAmB;;;;;;;;;AAUzB,eAAe,mBAAkC;CAC/C,IAAI;EACF,IAAI,EAAE,YAAY,SAAS;EAC3B,MAAM,OAAO,MAAM,OAAO,OAAO,KAAK;EACtC,MAAM,QAAQ,IACZ,KACG,QAAQ,QAAQ,IAAI,SAAS,UAAU,KAAK,IAAI,SAAS,UAAU,CAAC,CAAC,CACrE,KAAK,QAAQ,OAAO,OAAO,OAAO,GAAG,CAAC,CAC3C;CACF,SAAS,OAAO;EACd,OAAO,KACL,4DACA,KACF;CACF;AACF;;;;;;;;;;AAWA,MAAa,8BAA8B;CACzC,gBAAgB;EACd,IACE,YAAY,IAAI,SAAS,iBACzB,cAAc,cACd,CAAC,cAAc,iBAEf;EAGF,MAAM,iBAAiB,YAAY;GACjC,MAAM,SAAS,MAAM,mBAAmB;GACxC,IAAI,CAAC,UAAU,OAAO,WAAW;GAGjC,IADoB,OAAO,eAAe,QAAQ,gBACpC,MAAM,OAAO,cAAc;GACzC,OAAO,eAAe,QAAQ,kBAAkB,OAAO,YAAY;GAEnE,OAAO,KACL,4EACA,OAAO,aACP,OAAO,YACT;GACA,MAAM,iBAAiB;GACvB,OAAO,SAAS,OAAO;EACzB;EAEA,eAAoB;EACpB,MAAM,2BAA2B;GAC/B,IAAI,SAAS,oBAAoB,WAAW,eAAoB;EAClE;EACA,SAAS,iBAAiB,oBAAoB,kBAAkB;EAChE,aAAa;GACX,SAAS,oBAAoB,oBAAoB,kBAAkB;EACrE;CACF,GAAG,CAAC,CAAC;AACP;;;AC3EA,SAAgB,mBAAmB;CACjC,MAAM,OAAO,QAAQ;CACrB,gBAAgB;EACd,IAAI,aAAgC;EACpC,IAAI,MAAM;GAER,MAAM,EAAE,YAAY,aAAa,GAAG,SAAS;GAC7C,aAAa;IAAE,IAAI,KAAK;IAAK,UAAU,KAAK,KAAK;IAAM,GAAG;GAAK;EACjE;EACA,QAAc,UAAU;CAC1B,GAAG,CAAC,IAAI,CAAC;AACX;;;ACFA,eAAsB,cACpB,cACA,OACA;CACA,MAAM,qBAAqB;CAC3B,MAAM,QAAQ,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC,CAAC;CAClE,MAAM,kBAAkB;CACxB,MAAM,cAAc,MAAM,cAAc,KAAK;CAC7C,OAAO,EACL,UAAU,EAAE,eAAyC;EACnD,UAAU;EAEV,iBAAiB;EAEjB,sBAAsB;EACtB,OAAO;CACT,EACF;AACF","debug_id":"ee9d69d2-2c4c-5708-8679-8667189cde2c"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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]="59a2e9b8-944c-5039-8343-a9f07434dd29")}catch(e){}}();
|
|
3
|
+
import { loadRuntimeConfig } from "@powerhousedao/connect-core/runtime-config";
|
|
4
|
+
//#region src/load-runtime-config.ts
|
|
5
|
+
const connectPlugins = () => import("./plugins--mJeXJ7w.js").then((m) => m.connectPlugins);
|
|
6
|
+
/** Core's loader, with Connect's built-in plugins for the composition. */
|
|
7
|
+
function loadRuntimeConfig$1() {
|
|
8
|
+
return loadRuntimeConfig({ plugins: connectPlugins });
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { loadRuntimeConfig$1 as t };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=load-runtime-config-BoDzcgEV.js.map
|
|
14
|
+
//# debugId=59a2e9b8-944c-5039-8343-a9f07434dd29
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-runtime-config-BoDzcgEV.js","sources":["../src/load-runtime-config.ts"],"sourcesContent":["import { loadRuntimeConfig as loadCoreRuntimeConfig } from \"@powerhousedao/connect-core/runtime-config\";\n\n// The built-ins: a declared composition's transform the config, and the active\n// ones' UI loads (every one's without a composition).\nconst connectPlugins = () =>\n import(\"./plugins/index.js\").then((m) => m.connectPlugins);\n\n/** Core's loader, with Connect's built-in plugins for the composition. */\nexport function loadRuntimeConfig() {\n return loadCoreRuntimeConfig({ plugins: connectPlugins });\n}\n"],"names":["loadRuntimeConfig","loadCoreRuntimeConfig"],"mappings":";;;;AAIA,MAAM,uBACJ,OAAO,wBAAqB,CAAC,MAAM,MAAM,EAAE,cAAc;;AAG3D,SAAgBA,sBAAoB;CAClC,OAAOC,kBAAsB,EAAE,SAAS,eAAe,CAAC;AAC1D","debug_id":"59a2e9b8-944c-5039-8343-a9f07434dd29"}
|
package/dist/main.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
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]="1f52a123-ef3c-5452-bdfa-b05d09bb17c0")}catch(e){}}();
|
|
3
|
-
import { t as bootConnect } from "./boot-
|
|
3
|
+
import { t as bootConnect } from "./boot-BBIArGAP.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region main.tsx
|
|
6
6
|
const root = await bootConnect();
|
|
7
7
|
if (root) {
|
|
8
|
-
const { AppLoader } = await import("./app-loader-
|
|
8
|
+
const { AppLoader } = await import("./app-loader-BQrucpDg.js");
|
|
9
9
|
root.render(/* @__PURE__ */ jsx(AppLoader, {}));
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
@@ -0,0 +1,183 @@
|
|
|
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]="a45854ff-38ca-5447-8b9d-a71fddae89a6")}catch(e){}}();
|
|
3
|
+
import { formatFileSize, mapProgressStageToStatus } from "@powerhousedao/design-system/connect";
|
|
4
|
+
import { addFileWithProgress, getPHStore, setSelectedNode, showPHModal, subscribeToPHValue } from "@powerhousedao/reactor-browser";
|
|
5
|
+
//#region src/utils/launch-queue.ts
|
|
6
|
+
let pendingImportFiles = [];
|
|
7
|
+
const pendingListeners = /* @__PURE__ */ new Set();
|
|
8
|
+
function notifyPendingListeners() {
|
|
9
|
+
for (const listener of pendingListeners) listener();
|
|
10
|
+
}
|
|
11
|
+
function getPendingImportFiles() {
|
|
12
|
+
return pendingImportFiles;
|
|
13
|
+
}
|
|
14
|
+
/** Stable identity of a pending file (also the picker's pre-check cache key). */
|
|
15
|
+
function pendingFileKey(file) {
|
|
16
|
+
return `${file.name}|${file.size}|${file.lastModified}`;
|
|
17
|
+
}
|
|
18
|
+
function addPendingImportFiles(files) {
|
|
19
|
+
const seen = new Set(pendingImportFiles.map(pendingFileKey));
|
|
20
|
+
const fresh = files.filter((file) => {
|
|
21
|
+
const key = pendingFileKey(file);
|
|
22
|
+
if (seen.has(key)) return false;
|
|
23
|
+
seen.add(key);
|
|
24
|
+
return true;
|
|
25
|
+
});
|
|
26
|
+
if (fresh.length === 0) return;
|
|
27
|
+
pendingImportFiles = [...pendingImportFiles, ...fresh];
|
|
28
|
+
notifyPendingListeners();
|
|
29
|
+
}
|
|
30
|
+
function clearPendingImportFiles() {
|
|
31
|
+
if (pendingImportFiles.length === 0) return;
|
|
32
|
+
pendingImportFiles = [];
|
|
33
|
+
notifyPendingListeners();
|
|
34
|
+
}
|
|
35
|
+
function subscribePendingImportFiles(cb) {
|
|
36
|
+
pendingListeners.add(cb);
|
|
37
|
+
return () => {
|
|
38
|
+
pendingListeners.delete(cb);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async function handleLaunchParams(params) {
|
|
42
|
+
const handles = params.files.filter((handle) => handle.kind === "file");
|
|
43
|
+
if (handles.length === 0) return;
|
|
44
|
+
const files = [];
|
|
45
|
+
for (const handle of handles) try {
|
|
46
|
+
files.push(await handle.getFile());
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error("Failed to read launched file:", handle.name, error);
|
|
49
|
+
}
|
|
50
|
+
if (files.length === 0) return;
|
|
51
|
+
addPendingImportFiles(files);
|
|
52
|
+
showPHModal({ type: "openFileDocuments" });
|
|
53
|
+
}
|
|
54
|
+
function maybeReopenImportModal() {
|
|
55
|
+
if (getPendingImportFiles().length === 0) return;
|
|
56
|
+
if (getPHStore()?.modal !== void 0) return;
|
|
57
|
+
showPHModal({ type: "openFileDocuments" });
|
|
58
|
+
}
|
|
59
|
+
let initialized = false;
|
|
60
|
+
/**
|
|
61
|
+
* Register the launchQueue consumer that receives files opened with Connect
|
|
62
|
+
* through the OS file association. Idempotent (safe under StrictMode double
|
|
63
|
+
* effects) and a no-op where the File Handling API doesn't exist — Firefox,
|
|
64
|
+
* Safari, and any context without an installed PWA manifest simply never
|
|
65
|
+
* deliver launches.
|
|
66
|
+
*/
|
|
67
|
+
function initLaunchQueueFileHandling() {
|
|
68
|
+
if (initialized) return;
|
|
69
|
+
initialized = true;
|
|
70
|
+
subscribeToPHValue("modal", maybeReopenImportModal);
|
|
71
|
+
window.launchQueue?.setConsumer((params) => {
|
|
72
|
+
handleLaunchParams(params);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/utils/open-file-uploads.ts
|
|
77
|
+
let uploads = [];
|
|
78
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
79
|
+
function notifyUploadListeners() {
|
|
80
|
+
for (const listener of listeners) listener();
|
|
81
|
+
}
|
|
82
|
+
function getOpenFileUploads() {
|
|
83
|
+
return uploads;
|
|
84
|
+
}
|
|
85
|
+
function subscribeOpenFileUploads(cb) {
|
|
86
|
+
listeners.add(cb);
|
|
87
|
+
return () => {
|
|
88
|
+
listeners.delete(cb);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function removeOpenFileUpload(id) {
|
|
92
|
+
const next = uploads.filter((upload) => upload.id !== id);
|
|
93
|
+
if (next.length === uploads.length) return;
|
|
94
|
+
uploads = next;
|
|
95
|
+
notifyUploadListeners();
|
|
96
|
+
}
|
|
97
|
+
function clearOpenFileUploads() {
|
|
98
|
+
if (uploads.length === 0) return;
|
|
99
|
+
uploads = [];
|
|
100
|
+
notifyUploadListeners();
|
|
101
|
+
}
|
|
102
|
+
function addOpenFileUploads(rows) {
|
|
103
|
+
uploads = [...uploads, ...rows];
|
|
104
|
+
notifyUploadListeners();
|
|
105
|
+
}
|
|
106
|
+
function patchOpenFileUpload(id, patch) {
|
|
107
|
+
uploads = uploads.map((upload) => upload.id === id ? {
|
|
108
|
+
...upload,
|
|
109
|
+
...patch
|
|
110
|
+
} : upload);
|
|
111
|
+
notifyUploadListeners();
|
|
112
|
+
}
|
|
113
|
+
let uploadCounter = 0;
|
|
114
|
+
let importChain = Promise.resolve();
|
|
115
|
+
/**
|
|
116
|
+
* Import one file and resolve once the flow truly ends. Completion is
|
|
117
|
+
* tracked through the progress stages, NOT the returned promise — the
|
|
118
|
+
* package-discovery retry path resolves early and keeps reporting through
|
|
119
|
+
* the callback. `resolveConflict: "duplicate"` is always passed: duplicates
|
|
120
|
+
* were resolved in the picker (rename), so the conflict stage must never
|
|
121
|
+
* fire — this also covers a duplicate appearing between pre-check and import.
|
|
122
|
+
*/
|
|
123
|
+
function importOne(row, driveId, documentTypes) {
|
|
124
|
+
return new Promise((resolve) => {
|
|
125
|
+
let settled = false;
|
|
126
|
+
const settle = (fileNode) => {
|
|
127
|
+
if (settled) return;
|
|
128
|
+
settled = true;
|
|
129
|
+
resolve(fileNode);
|
|
130
|
+
};
|
|
131
|
+
addFileWithProgress(row.file, driveId, row.name, void 0, (progress) => {
|
|
132
|
+
patchOpenFileUpload(row.id, {
|
|
133
|
+
status: mapProgressStageToStatus(progress.stage),
|
|
134
|
+
progress: progress.progress,
|
|
135
|
+
...progress.error ? { errorDetails: progress.error } : {},
|
|
136
|
+
...progress.documentType ? { documentType: progress.documentType } : {},
|
|
137
|
+
...progress.fileNode ? { fileNode: progress.fileNode } : {}
|
|
138
|
+
});
|
|
139
|
+
switch (progress.stage) {
|
|
140
|
+
case "complete":
|
|
141
|
+
settle(progress.fileNode);
|
|
142
|
+
break;
|
|
143
|
+
case "failed":
|
|
144
|
+
case "unsupported-document-type": settle(void 0);
|
|
145
|
+
}
|
|
146
|
+
}, documentTypes, "duplicate").catch(() => {
|
|
147
|
+
settle(void 0);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Run a confirmed batch of imports into a drive, feeding the floating upload
|
|
153
|
+
* panel. Rows appear immediately (queued), files import sequentially, and a
|
|
154
|
+
* single-file batch that succeeds opens its document in the editor.
|
|
155
|
+
*/
|
|
156
|
+
function runOpenFileImports(args) {
|
|
157
|
+
const { driveId, imports, documentTypes } = args;
|
|
158
|
+
if (imports.length === 0) return importChain;
|
|
159
|
+
const rows = imports.map(({ file, name }) => ({
|
|
160
|
+
id: `open-file-${++uploadCounter}`,
|
|
161
|
+
file,
|
|
162
|
+
name
|
|
163
|
+
}));
|
|
164
|
+
addOpenFileUploads(rows.map((row) => ({
|
|
165
|
+
id: row.id,
|
|
166
|
+
fileName: row.name,
|
|
167
|
+
fileSize: formatFileSize(row.file.size),
|
|
168
|
+
status: "pending",
|
|
169
|
+
progress: 0
|
|
170
|
+
})));
|
|
171
|
+
const run = async () => {
|
|
172
|
+
const results = [];
|
|
173
|
+
for (const row of rows) results.push(await importOne(row, driveId, documentTypes));
|
|
174
|
+
if (rows.length === 1 && results[0]) setSelectedNode(results[0]);
|
|
175
|
+
};
|
|
176
|
+
importChain = importChain.then(run, run);
|
|
177
|
+
return importChain;
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
export { subscribeOpenFileUploads as a, initLaunchQueueFileHandling as c, runOpenFileImports as i, pendingFileKey as l, getOpenFileUploads as n, clearPendingImportFiles as o, removeOpenFileUpload as r, getPendingImportFiles as s, clearOpenFileUploads as t, subscribePendingImportFiles as u };
|
|
181
|
+
|
|
182
|
+
//# sourceMappingURL=open-file-uploads-B5pr1sA2.js.map
|
|
183
|
+
//# debugId=a45854ff-38ca-5447-8b9d-a71fddae89a6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-file-uploads-B5pr1sA2.js","sources":["../src/utils/launch-queue.ts","../src/utils/open-file-uploads.ts"],"sourcesContent":["import {\n getPHStore,\n showPHModal,\n subscribeToPHValue,\n} from \"@powerhousedao/reactor-browser\";\n\n// PWA launch handling: consume the files the OS hands the installed Connect app\n// via window.launchQueue when a document is opened through its file association\n// (manifest file_handlers) — stash the files in the pending store below and open\n// the openFileDocuments modal (drive picking + import).\n//\n// Same shape as registerServiceWorker.ts: a module singleton with a tiny\n// external store consumed via useSyncExternalStore.\n\n// External store holding files launched but not yet imported. Repeated\n// launches into an already-focused window (launch_handler: focus-existing)\n// merge into it.\nlet pendingImportFiles: File[] = [];\nconst pendingListeners = new Set<() => void>();\n\nfunction notifyPendingListeners() {\n for (const listener of pendingListeners) listener();\n}\n\nexport function getPendingImportFiles(): File[] {\n return pendingImportFiles;\n}\n\n/** Stable identity of a pending file (also the picker's pre-check cache key). */\nexport function pendingFileKey(file: File): string {\n return `${file.name}|${file.size}|${file.lastModified}`;\n}\n\nexport function addPendingImportFiles(files: File[]) {\n // Re-opening a file that is already waiting (e.g. after detouring to create\n // a drive) must not queue it twice.\n const seen = new Set(pendingImportFiles.map(pendingFileKey));\n const fresh = files.filter((file) => {\n const key = pendingFileKey(file);\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n if (fresh.length === 0) return;\n pendingImportFiles = [...pendingImportFiles, ...fresh];\n notifyPendingListeners();\n}\n\nexport function clearPendingImportFiles() {\n if (pendingImportFiles.length === 0) return;\n pendingImportFiles = [];\n notifyPendingListeners();\n}\n\nexport function subscribePendingImportFiles(cb: () => void): () => void {\n pendingListeners.add(cb);\n return () => {\n pendingListeners.delete(cb);\n };\n}\n\nasync function handleLaunchParams(params: LaunchParams) {\n const handles = params.files.filter(\n (handle): handle is FileSystemFileHandle => handle.kind === \"file\",\n );\n if (handles.length === 0) return;\n\n const files: File[] = [];\n for (const handle of handles) {\n try {\n files.push(await handle.getFile());\n } catch (error) {\n // Permission/IO failure on one file must not drop the rest.\n console.error(\"Failed to read launched file:\", handle.name, error);\n }\n }\n if (files.length === 0) return;\n\n addPendingImportFiles(files);\n showPHModal({ type: \"openFileDocuments\" });\n}\n\n// Re-surface the picker when another modal closes while launched files are\n// still waiting — e.g. after the zero-drives detour through the create-drive\n// modal, so the user doesn't have to open the file again. Cancelling the\n// import clears the pending store BEFORE closing, so this can't loop.\nfunction maybeReopenImportModal() {\n if (getPendingImportFiles().length === 0) return;\n if (getPHStore()?.modal !== undefined) return;\n showPHModal({ type: \"openFileDocuments\" });\n}\n\nlet initialized = false;\n\n/**\n * Register the launchQueue consumer that receives files opened with Connect\n * through the OS file association. Idempotent (safe under StrictMode double\n * effects) and a no-op where the File Handling API doesn't exist — Firefox,\n * Safari, and any context without an installed PWA manifest simply never\n * deliver launches.\n */\nexport function initLaunchQueueFileHandling() {\n if (initialized) return;\n initialized = true;\n subscribeToPHValue(\"modal\", maybeReopenImportModal);\n window.launchQueue?.setConsumer((params) => {\n void handleLaunchParams(params);\n });\n}\n","import {\n formatFileSize,\n mapProgressStageToStatus,\n type UploadFileListContainerProps,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n addFileWithProgress,\n setSelectedNode,\n} from \"@powerhousedao/reactor-browser\";\nimport type { FileNode } from \"@powerhousedao/shared/document-drive\";\n\n// Progress store + import driver for documents opened through the OS file\n// association. Imports run OUTSIDE React (the picker modal closes the moment\n// the user confirms), reporting into a module store rendered by\n// OpenFileUploadList through the same floating panel UI drag-and-drop uses.\n// Memory-only on purpose: persisting rows (as DropZone does) leaves stale\n// frozen \"uploading\" entries after a reload, and launched imports are\n// one-shot. Rows are cleared only by user action, like drag-and-drop.\n\n/** Row shape the design-system upload panel consumes (UploadTracker). */\nexport type OpenFileUpload = NonNullable<\n UploadFileListContainerProps[\"uploadsArray\"][number]\n>;\n\nlet uploads: OpenFileUpload[] = [];\nconst listeners = new Set<() => void>();\n\nfunction notifyUploadListeners() {\n for (const listener of listeners) listener();\n}\n\nexport function getOpenFileUploads(): OpenFileUpload[] {\n return uploads;\n}\n\nexport function subscribeOpenFileUploads(cb: () => void): () => void {\n listeners.add(cb);\n return () => {\n listeners.delete(cb);\n };\n}\n\nexport function removeOpenFileUpload(id: string) {\n const next = uploads.filter((upload) => upload.id !== id);\n if (next.length === uploads.length) return;\n uploads = next;\n notifyUploadListeners();\n}\n\nexport function clearOpenFileUploads() {\n if (uploads.length === 0) return;\n uploads = [];\n notifyUploadListeners();\n}\n\nfunction addOpenFileUploads(rows: OpenFileUpload[]) {\n uploads = [...uploads, ...rows];\n notifyUploadListeners();\n}\n\nfunction patchOpenFileUpload(id: string, patch: Partial<OpenFileUpload>) {\n uploads = uploads.map((upload) =>\n upload.id === id ? { ...upload, ...patch } : upload,\n );\n notifyUploadListeners();\n}\n\nexport type PlannedOpenFileImport = {\n file: File;\n /** Final (possibly renamed) name the document is stored under. */\n name: string;\n};\n\nlet uploadCounter = 0;\n// Batches are serialized: a second OS launch confirmed mid-upload must not\n// race addDocument calls against the same drive.\nlet importChain: Promise<void> = Promise.resolve();\n\n/**\n * Import one file and resolve once the flow truly ends. Completion is\n * tracked through the progress stages, NOT the returned promise — the\n * package-discovery retry path resolves early and keeps reporting through\n * the callback. `resolveConflict: \"duplicate\"` is always passed: duplicates\n * were resolved in the picker (rename), so the conflict stage must never\n * fire — this also covers a duplicate appearing between pre-check and import.\n */\nfunction importOne(\n row: { id: string; file: File; name: string },\n driveId: string,\n documentTypes: string[] | undefined,\n): Promise<FileNode | undefined> {\n return new Promise((resolve) => {\n let settled = false;\n const settle = (fileNode?: FileNode) => {\n if (settled) return;\n settled = true;\n resolve(fileNode);\n };\n addFileWithProgress(\n row.file,\n driveId,\n row.name,\n undefined, // drive root\n (progress) => {\n patchOpenFileUpload(row.id, {\n status: mapProgressStageToStatus(progress.stage),\n progress: progress.progress,\n ...(progress.error ? { errorDetails: progress.error } : {}),\n ...(progress.documentType\n ? { documentType: progress.documentType }\n : {}),\n ...(progress.fileNode ? { fileNode: progress.fileNode } : {}),\n });\n switch (progress.stage) {\n case \"complete\":\n settle(progress.fileNode);\n break;\n case \"failed\":\n case \"unsupported-document-type\":\n settle(undefined);\n break;\n default:\n break;\n }\n },\n documentTypes,\n \"duplicate\",\n ).catch(() => {\n // A terminal stage was already reported through the callback (the\n // action always emits one before throwing); keep the batch going.\n settle(undefined);\n });\n });\n}\n\n/**\n * Run a confirmed batch of imports into a drive, feeding the floating upload\n * panel. Rows appear immediately (queued), files import sequentially, and a\n * single-file batch that succeeds opens its document in the editor.\n */\nexport function runOpenFileImports(args: {\n driveId: string;\n imports: PlannedOpenFileImport[];\n documentTypes: string[] | undefined;\n}): Promise<void> {\n const { driveId, imports, documentTypes } = args;\n if (imports.length === 0) return importChain;\n\n const rows = imports.map(({ file, name }) => ({\n id: `open-file-${++uploadCounter}`,\n file,\n name,\n }));\n addOpenFileUploads(\n rows.map((row) => ({\n id: row.id,\n fileName: row.name,\n fileSize: formatFileSize(row.file.size),\n status: \"pending\",\n progress: 0,\n })),\n );\n\n const run = async () => {\n const results: (FileNode | undefined)[] = [];\n for (const row of rows) {\n results.push(await importOne(row, driveId, documentTypes));\n }\n // Auto-open only for a single-file batch; several files land on the\n // drive and the panel rows carry their own \"Open Document\" links.\n if (rows.length === 1 && results[0]) {\n setSelectedNode(results[0]);\n }\n };\n importChain = importChain.then(run, run);\n return importChain;\n}\n"],"names":[],"mappings":"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","debug_id":"a45854ff-38ca-5447-8b9d-a71fddae89a6"}
|