@powerhousedao/connect 6.2.3-dev.10 → 6.2.3-dev.100
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-xAw48kdl.js → AddDriveModal-zMepHdWt.js} +44 -18
- package/dist/AddDriveModal-zMepHdWt.js.map +1 -0
- package/dist/{ClearStorageModal-BHLFpni1.js → ClearStorageModal-CKGhDjIY.js} +11 -13
- package/dist/ClearStorageModal-CKGhDjIY.js.map +1 -0
- package/dist/{ConfirmDocumentUpgradeModal-FUOhZsk7.js → ConfirmDocumentUpgradeModal-CoixS60F.js} +9 -8
- package/dist/ConfirmDocumentUpgradeModal-CoixS60F.js.map +1 -0
- package/dist/{CookiesPolicyModal-BpyPPyxS.js → CookiesPolicyModal-BpFjYc7T.js} +5 -5
- package/dist/{CookiesPolicyModal-BpyPPyxS.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-cFjT1zO6.js → DebugSettingsModal-BBOrCxWG.js} +11 -11
- package/dist/DebugSettingsModal-BBOrCxWG.js.map +1 -0
- package/dist/{DeleteDriveModal-Dug84t1j.js → DeleteDriveModal-1pAIayG_.js} +7 -7
- package/dist/DeleteDriveModal-1pAIayG_.js.map +1 -0
- package/dist/{DeleteItemModal-mMzy3V8o.js → DeleteItemModal-BUpqmFxS.js} +8 -8
- package/dist/DeleteItemModal-BUpqmFxS.js.map +1 -0
- package/dist/{DisclaimerModal-DvpD5dPM.js → DisclaimerModal-TIJXRYLF.js} +7 -7
- package/dist/DisclaimerModal-TIJXRYLF.js.map +1 -0
- package/dist/{DocumentVersionUnsupportedModal-C3Q0V75l.js → DocumentVersionUnsupportedModal-DH9Zzsyw.js} +6 -6
- package/dist/DocumentVersionUnsupportedModal-DH9Zzsyw.js.map +1 -0
- package/dist/{DownloadDocumentWithErrorsModal-IKl0ljQb.js → DownloadDocumentWithErrorsModal-Beh-xw8B.js} +8 -7
- package/dist/DownloadDocumentWithErrorsModal-Beh-xw8B.js.map +1 -0
- package/dist/{DriveAuthRequiredModal-DVK7ZQzO.js → DriveAuthRequiredModal-XTcoJKvj.js} +7 -7
- 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-Z7YMEHRm.js → InspectorModal-DYPBjxGx.js} +71 -31
- package/dist/InspectorModal-DYPBjxGx.js.map +1 -0
- package/dist/{LoginModal-CybbOm3N.js → LoginModal-O06ZvWFI.js} +8 -8
- package/dist/LoginModal-O06ZvWFI.js.map +1 -0
- package/dist/{OpenFileDocumentsModal-JcGCx1ta.js → OpenFileDocumentsModal-DJsC1oR1.js} +22 -16
- package/dist/OpenFileDocumentsModal-DJsC1oR1.js.map +1 -0
- package/dist/{UpgradeDriveModal-_8t9slxQ.js → UpgradeDriveModal-CCWKp5yn.js} +7 -7
- 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-B2DLVZSH.js +4 -0
- package/dist/app-loader-CeBtW7Z9.js +1254 -0
- package/dist/app-loader-CeBtW7Z9.js.map +1 -0
- package/dist/app-skeleton-CMUP2zaz.js +132 -0
- package/dist/app-skeleton-CMUP2zaz.js.map +1 -0
- package/dist/app-skeleton-CdD1m8G3.js +4 -0
- package/dist/boot-BUgLMmER.js +233 -0
- package/dist/boot-BUgLMmER.js.map +1 -0
- package/dist/buffer-DNTcuap_.js +66 -0
- package/dist/buffer-DNTcuap_.js.map +1 -0
- package/dist/{build-info-BPvkFr0E.js → build-info-BFOvZth7.js} +10 -6
- package/dist/build-info-BFOvZth7.js.map +1 -0
- package/dist/components-B47plVap.js +121 -0
- package/dist/components-B47plVap.js.map +1 -0
- package/dist/{connect.config-DaHDEUrw.js → connect.config-DL9nKtlW.js} +28 -15
- package/dist/connect.config-DL9nKtlW.js.map +1 -0
- package/dist/{connection-state-3w4liC1X.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-BH6bIq24.js → cookie-banner-NclLYtB0.js} +7 -7
- package/dist/{cookie-banner-BH6bIq24.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-CWO0vYVd.js → i18n-D9WYPgk9.js} +4 -4
- package/dist/{i18n-CWO0vYVd.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-BJ8uRKR9.js → load-GiLXshXB.js} +48 -46
- package/dist/load-GiLXshXB.js.map +1 -0
- package/dist/load-runtime-config-DyyFME2G.js +14 -0
- package/dist/load-runtime-config-DyyFME2G.js.map +1 -0
- package/dist/main.d.ts +2 -1
- package/dist/main.js +8 -8
- package/dist/main.js.map +1 -1
- package/dist/open-file-uploads-B5pr1sA2.js +183 -0
- package/dist/open-file-uploads-B5pr1sA2.js.map +1 -0
- package/dist/package-manager-D3Sz4TFv.js +550 -0
- package/dist/package-manager-D3Sz4TFv.js.map +1 -0
- package/dist/{pglite-major-B39aOEiE.js → pglite-major-pao-ozRo.js} +23 -5
- package/dist/pglite-major-pao-ozRo.js.map +1 -0
- package/dist/{pglite-migrate-core-Boxqqx-c.js → pglite-migrate-core-B6FqmhH8.js} +9 -7
- package/dist/pglite-migrate-core-B6FqmhH8.js.map +1 -0
- package/dist/{pglite-seed-BqAUvNFw.js → pglite-seed-CZsMNsV8.js} +8 -4
- package/dist/pglite-seed-CZsMNsV8.js.map +1 -0
- package/dist/pglite.worker.d.ts +2 -1
- package/dist/pglite.worker.js +4 -3
- package/dist/pglite.worker.js.map +1 -1
- package/dist/pglite.worker.legacy.d.ts +2 -1
- package/dist/pglite.worker.legacy.js +4 -3
- package/dist/pglite.worker.legacy.js.map +1 -1
- 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-Dubhwfll.js +264 -0
- package/dist/plugins-Dubhwfll.js.map +1 -0
- package/dist/{preferences-store-_5Cw4_YV.js → preferences-store-DxYAnGCc.js} +6 -25
- 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-DIgOSo2Q.js → pwa-manifest-link-DNwWvnLV.js} +5 -5
- package/dist/{pwa-manifest-link-DIgOSo2Q.js.map → pwa-manifest-link-DNwWvnLV.js.map} +1 -1
- package/dist/reactor-B87zAvRS.js +1656 -0
- package/dist/reactor-B87zAvRS.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.d.ts +2 -1
- package/dist/reactor.worker.js +494 -163
- package/dist/reactor.worker.js.map +1 -1
- package/dist/{registerServiceWorker-BSzbNfvz.js → registerServiceWorker-OR8nokAn.js} +5 -5
- package/dist/{registerServiceWorker-BSzbNfvz.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-CtcnMu0v.js +1089 -0
- package/dist/settings-CtcnMu0v.js.map +1 -0
- package/dist/settings-tabs-CjZy2lWA.js +424 -0
- package/dist/settings-tabs-CjZy2lWA.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 +7 -9
- package/dist/start-connect.d.ts.map +1 -1
- package/dist/start-connect.js +9 -8
- 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 +3482 -733
- package/dist/{toast-BXIGd4Eb.js → toast-C6WW-_O-.js} +3 -3
- package/dist/{toast-BXIGd4Eb.js.map → toast-C6WW-_O-.js.map} +1 -1
- package/dist/ui-C1-l-Eyh.js +170 -0
- package/dist/ui-C1-l-Eyh.js.map +1 -0
- package/dist/ui-nH2Q12QU.js +66 -0
- package/dist/ui-nH2Q12QU.js.map +1 -0
- package/dist/{use-renown-login-Cf3va6u_.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 +87 -26
- 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 +8 -23
- package/tailwind.css +12 -0
- package/theme.css +5 -0
- package/dist/AddDriveModal-xAw48kdl.js.map +0 -1
- package/dist/ClearStorageModal-BHLFpni1.js.map +0 -1
- package/dist/ConfirmDocumentUpgradeModal-FUOhZsk7.js.map +0 -1
- package/dist/CreateDocumentModal-C45W8J0V.js +0 -35
- package/dist/CreateDocumentModal-C45W8J0V.js.map +0 -1
- package/dist/DebugSettingsModal-cFjT1zO6.js.map +0 -1
- package/dist/DeleteDriveModal-Dug84t1j.js.map +0 -1
- package/dist/DeleteItemModal-mMzy3V8o.js.map +0 -1
- package/dist/DisclaimerModal-DvpD5dPM.js.map +0 -1
- package/dist/DocumentVersionUnsupportedModal-C3Q0V75l.js.map +0 -1
- package/dist/DownloadDocumentWithErrorsModal-IKl0ljQb.js.map +0 -1
- package/dist/DriveAuthRequiredModal-DVK7ZQzO.js.map +0 -1
- package/dist/DriveSettingsModal-C6-mRQiv.js +0 -57
- package/dist/DriveSettingsModal-C6-mRQiv.js.map +0 -1
- package/dist/InspectorModal-Z7YMEHRm.js.map +0 -1
- package/dist/LoginModal-CybbOm3N.js.map +0 -1
- package/dist/MissingPackageModal-nBnExqO0.js +0 -49
- package/dist/MissingPackageModal-nBnExqO0.js.map +0 -1
- package/dist/OpenFileDocumentsModal-JcGCx1ta.js.map +0 -1
- package/dist/SettingsModal-CgqnSXs5.js +0 -569
- package/dist/SettingsModal-CgqnSXs5.js.map +0 -1
- package/dist/UpgradeDriveModal-_8t9slxQ.js.map +0 -1
- package/dist/app-loader-GDy45Yza.js +0 -2244
- package/dist/app-loader-GDy45Yza.js.map +0 -1
- package/dist/app-loader-WZecUfE8.js +0 -4
- package/dist/build-info-BPvkFr0E.js.map +0 -1
- package/dist/components-Df4NlQZz.js +0 -4
- package/dist/connect.config-DaHDEUrw.js.map +0 -1
- package/dist/connection-state-3w4liC1X.js.map +0 -1
- package/dist/load-BJ8uRKR9.js.map +0 -1
- package/dist/pglite-major-B39aOEiE.js.map +0 -1
- package/dist/pglite-migrate-core-Boxqqx-c.js.map +0 -1
- package/dist/pglite-seed-BqAUvNFw.js.map +0 -1
- package/dist/preferences-store-_5Cw4_YV.js.map +0 -1
- package/dist/reactor-CbgxQyev.js +0 -1464
- package/dist/reactor-CbgxQyev.js.map +0 -1
- package/dist/runtime-config-DL3QjcfM.js +0 -24
- package/dist/runtime-config-DL3QjcfM.js.map +0 -1
- package/dist/sentry-QXKgQmr2.js +0 -15
- package/dist/sentry-QXKgQmr2.js.map +0 -1
- package/dist/use-renown-login-Cf3va6u_.js.map +0 -1
- package/dist/useRegistryPackages-BnUcL_nZ.js +0 -390
- package/dist/useRegistryPackages-BnUcL_nZ.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-CjZy2lWA.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,15 +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 {
|
|
9
|
-
import { n as
|
|
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]="eab6d606-2a7b-590a-8c3a-0b3b1ccb3661")}catch(e){}}();
|
|
3
|
+
import { t as loadRuntimeConfig } from "./load-runtime-config-DyyFME2G.js";
|
|
4
|
+
import { r as connectConfig } from "./connect.config-DL9nKtlW.js";
|
|
5
|
+
import { t as getBuildHash } from "./build-info-BFOvZth7.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-B87zAvRS.js";
|
|
10
11
|
import { useEffect } from "react";
|
|
11
12
|
import { initTheme, useUser } from "@powerhousedao/reactor-browser";
|
|
12
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
|
|
13
48
|
//#region src/hooks/useCheckLatestVersion.ts
|
|
14
49
|
const RELOADED_FOR_KEY = "ph-reloaded-for-build-hash";
|
|
15
50
|
/**
|
|
@@ -60,39 +95,6 @@ const useCheckLatestVersion = () => {
|
|
|
60
95
|
};
|
|
61
96
|
}, []);
|
|
62
97
|
};
|
|
63
|
-
window.navigator.appVersion.includes("Mac");
|
|
64
|
-
/**
|
|
65
|
-
* Same-origin build-identity probe. The build bakes a hash of the inputs that
|
|
66
|
-
* determine the deployed content into the bundle (define
|
|
67
|
-
* `PH_CONNECT_BUILD_HASH`, see builder-tools' connectBuildHashPlugin) and
|
|
68
|
-
* emits `build-hash.json` next to the app (served no-cache). Comparing the
|
|
69
|
-
* two tells us whether the server is serving a different build than the one
|
|
70
|
-
* this page was loaded from — the reliable "a new deploy went out" signal.
|
|
71
|
-
* Unlike the old GitHub-raw version check it works on localhost (it compares
|
|
72
|
-
* against what the origin actually serves, not a remote branch head) and
|
|
73
|
-
* needs no network beyond the app's own origin.
|
|
74
|
-
*
|
|
75
|
-
* Returns null when there is nothing to compare: dev/studio builds (no hash
|
|
76
|
-
* baked), a server predating `build-hash.json`, an offline fetch, or a
|
|
77
|
-
* malformed body.
|
|
78
|
-
*/
|
|
79
|
-
const getBuildHashStatus = async () => {
|
|
80
|
-
const currentHash = getBuildHash();
|
|
81
|
-
if (!currentHash || currentHash === "unknown") return null;
|
|
82
|
-
try {
|
|
83
|
-
const result = await fetch(`${import.meta.env.BASE_URL}build-hash.json`, { cache: "no-cache" });
|
|
84
|
-
if (!result.ok) return null;
|
|
85
|
-
const data = await result.json();
|
|
86
|
-
if (typeof data.hash !== "string" || !data.hash) return null;
|
|
87
|
-
return {
|
|
88
|
-
currentHash,
|
|
89
|
-
deployedHash: data.hash,
|
|
90
|
-
isCurrent: data.hash === currentHash
|
|
91
|
-
};
|
|
92
|
-
} catch {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
98
|
//#endregion
|
|
97
99
|
//#region src/store/user.ts
|
|
98
100
|
function useSetSentryUser() {
|
|
@@ -112,11 +114,11 @@ function useSetSentryUser() {
|
|
|
112
114
|
}
|
|
113
115
|
//#endregion
|
|
114
116
|
//#region src/components/load.tsx
|
|
115
|
-
async function loadComponent(localPackage) {
|
|
117
|
+
async function loadComponent(localPackage, store) {
|
|
116
118
|
await seedPendingPgVersion();
|
|
117
119
|
await Promise.all([detectReactorPgMajor(), detectMigrationMajor()]);
|
|
118
|
-
|
|
119
|
-
await createReactor(localPackage);
|
|
120
|
+
await loadRuntimeConfig();
|
|
121
|
+
await createReactor(await localPackage, store);
|
|
120
122
|
return { default: ({ children }) => {
|
|
121
123
|
initTheme();
|
|
122
124
|
useSetSentryUser();
|
|
@@ -127,5 +129,5 @@ async function loadComponent(localPackage) {
|
|
|
127
129
|
//#endregion
|
|
128
130
|
export { loadComponent };
|
|
129
131
|
|
|
130
|
-
//# sourceMappingURL=load-
|
|
131
|
-
//# debugId=
|
|
132
|
+
//# sourceMappingURL=load-GiLXshXB.js.map
|
|
133
|
+
//# debugId=eab6d606-2a7b-590a-8c3a-0b3b1ccb3661
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-GiLXshXB.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":"eab6d606-2a7b-590a-8c3a-0b3b1ccb3661"}
|
|
@@ -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]="dcb11226-e2b3-5503-9da1-f17b205fd1f1")}catch(e){}}();
|
|
3
|
+
import { loadRuntimeConfig } from "@powerhousedao/connect-core/runtime-config";
|
|
4
|
+
//#region src/load-runtime-config.ts
|
|
5
|
+
const connectPlugins = () => import("./plugins-Dubhwfll.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-DyyFME2G.js.map
|
|
14
|
+
//# debugId=dcb11226-e2b3-5503-9da1-f17b205fd1f1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-runtime-config-DyyFME2G.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":"dcb11226-e2b3-5503-9da1-f17b205fd1f1"}
|
package/dist/main.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
|
2
|
+
export {};
|
package/dist/main.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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 { createRoot } from "react-dom/client";
|
|
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-BUgLMmER.js";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
6
5
|
//#region main.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const { AppLoader } = await import("./app-loader-
|
|
10
|
-
|
|
6
|
+
const root = await bootConnect();
|
|
7
|
+
if (root) {
|
|
8
|
+
const { AppLoader } = await import("./app-loader-B2DLVZSH.js");
|
|
9
|
+
root.render(/* @__PURE__ */ jsx(AppLoader, {}));
|
|
10
|
+
}
|
|
11
11
|
//#endregion
|
|
12
12
|
|
|
13
13
|
//# sourceMappingURL=main.js.map
|
|
14
|
-
//# debugId=
|
|
14
|
+
//# debugId=1f52a123-ef3c-5452-bdfa-b05d09bb17c0
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["../main.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../main.tsx"],"sourcesContent":["import { bootConnect } from \"./src/boot.js\";\n\n// Paint the config-independent skeleton, start the runtime config fetch\n// alongside it, and wait for the config. See src/boot.tsx for why the two\n// overlap and what a failure renders.\nconst root = await bootConnect();\n\n// `null` means startup failed and the error state is already painted. The app\n// graph must not be imported then: its modules read the runtime config at\n// module-evaluation and would throw.\nif (root) {\n const { AppLoader } = await import(\"./src/components/app-loader.js\");\n root.render(<AppLoader />);\n}\n"],"names":[],"mappings":";;;;;AAKA,MAAM,OAAO,MAAM,YAAY;AAK/B,IAAI,MAAM;CACR,MAAM,EAAE,cAAc,MAAM,OAAO;CACnC,KAAK,OAAO,oBAAC,WAAD,CAAY,CAAA,CAAC;AAC3B","debug_id":"1f52a123-ef3c-5452-bdfa-b05d09bb17c0"}
|
|
@@ -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
|