@powerhousedao/connect 6.2.3-dev.66 → 6.2.3-dev.67
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/CUSTOMIZING.md +77 -0
- package/README.md +18 -91
- package/RUNTIME-CONFIG.md +472 -0
- package/dist/{AddDriveModal-D_3jDwjp.js → AddDriveModal-BjgmiHJr.js} +6 -6
- package/dist/AddDriveModal-BjgmiHJr.js.map +1 -0
- package/dist/{ClearStorageModal-zZ8XzwmR.js → ClearStorageModal-_03VgDb5.js} +6 -6
- package/dist/ClearStorageModal-_03VgDb5.js.map +1 -0
- package/dist/{ConfirmDocumentUpgradeModal-CrU2Z1CL.js → ConfirmDocumentUpgradeModal-CoixS60F.js} +5 -5
- package/dist/ConfirmDocumentUpgradeModal-CoixS60F.js.map +1 -0
- package/dist/{CookiesPolicyModal-DQwsgDI9.js → CookiesPolicyModal-BpFjYc7T.js} +4 -4
- package/dist/{CookiesPolicyModal-DQwsgDI9.js.map → CookiesPolicyModal-BpFjYc7T.js.map} +1 -1
- package/dist/{CreateDocumentModal-Cf1APibL.js → CreateDocumentModal-B-cXzeOA.js} +10 -10
- package/dist/CreateDocumentModal-B-cXzeOA.js.map +1 -0
- package/dist/{DebugSettingsModal-DIc5C2lI.js → DebugSettingsModal-CGScJ_r2.js} +8 -8
- package/dist/DebugSettingsModal-CGScJ_r2.js.map +1 -0
- package/dist/{DeleteDriveModal-lE9eCBua.js → DeleteDriveModal-1pAIayG_.js} +5 -5
- package/dist/DeleteDriveModal-1pAIayG_.js.map +1 -0
- package/dist/{DeleteItemModal-BFgcGsm3.js → DeleteItemModal-BUpqmFxS.js} +5 -5
- package/dist/DeleteItemModal-BUpqmFxS.js.map +1 -0
- package/dist/{DisclaimerModal-CF6JkIIu.js → DisclaimerModal-TIJXRYLF.js} +5 -5
- package/dist/DisclaimerModal-TIJXRYLF.js.map +1 -0
- package/dist/{DocumentVersionUnsupportedModal-Cm9Jb9W7.js → DocumentVersionUnsupportedModal-DH9Zzsyw.js} +5 -5
- package/dist/DocumentVersionUnsupportedModal-DH9Zzsyw.js.map +1 -0
- package/dist/{DownloadDocumentWithErrorsModal-CShKhfEQ.js → DownloadDocumentWithErrorsModal-Beh-xw8B.js} +5 -5
- package/dist/DownloadDocumentWithErrorsModal-Beh-xw8B.js.map +1 -0
- package/dist/{DriveAuthRequiredModal-CMwPUyZf.js → DriveAuthRequiredModal-XTcoJKvj.js} +6 -6
- package/dist/DriveAuthRequiredModal-XTcoJKvj.js.map +1 -0
- package/dist/{DriveSettingsModal-BSImj4BH.js → DriveSettingsModal-DZKawN7w.js} +5 -5
- package/dist/DriveSettingsModal-DZKawN7w.js.map +1 -0
- package/dist/{InspectorModal-Dr8-gj6u.js → InspectorModal-DA_TGmM6.js} +16 -16
- package/dist/InspectorModal-DA_TGmM6.js.map +1 -0
- package/dist/{LoginModal-DT_05uva.js → LoginModal-O06ZvWFI.js} +6 -6
- package/dist/LoginModal-O06ZvWFI.js.map +1 -0
- package/dist/{OpenFileDocumentsModal-X9GnX2Bk.js → OpenFileDocumentsModal-BNHD0vg9.js} +6 -6
- package/dist/OpenFileDocumentsModal-BNHD0vg9.js.map +1 -0
- package/dist/{UpgradeDriveModal-DvM-PNWe.js → UpgradeDriveModal-CCWKp5yn.js} +5 -5
- package/dist/UpgradeDriveModal-CCWKp5yn.js.map +1 -0
- package/dist/{app-loader-DrViXipO.js → app-loader-CEN_4I3I.js} +149 -196
- package/dist/app-loader-CEN_4I3I.js.map +1 -0
- package/dist/app-loader-Cj2p8L1I.js +4 -0
- package/dist/{app-skeleton-gzg8cRzm.js → app-skeleton-BFjvlTWd.js} +11 -11
- package/dist/app-skeleton-BFjvlTWd.js.map +1 -0
- package/dist/{app-skeleton-DYLZ7npI.js → app-skeleton-DFg65Rxa.js} +3 -3
- package/dist/{boot-CC_DgQKX.js → boot-JTGLJtmJ.js} +6 -6
- package/dist/boot-JTGLJtmJ.js.map +1 -0
- package/dist/{build-info-DMrToXJe.js → build-info-DkY9PU7c.js} +5 -5
- package/dist/{build-info-DMrToXJe.js.map → build-info-DkY9PU7c.js.map} +1 -1
- package/dist/{components-CjF9XjxP.js → components-2wvJ3_Ho.js} +11 -10
- package/dist/{components-CjF9XjxP.js.map → components-2wvJ3_Ho.js.map} +1 -1
- package/dist/{connect.config-uZF-gnvV.js → connect.config-D1pGNmaF.js} +4 -4
- package/dist/connect.config-D1pGNmaF.js.map +1 -0
- package/dist/{connection-state-C_477Kr_.js → connection-state-B6fleM37.js} +6 -6
- package/dist/connection-state-B6fleM37.js.map +1 -0
- package/dist/{cookie-banner-HPgyuHM5.js → cookie-banner-CAvd3PC3.js} +6 -6
- package/dist/{cookie-banner-HPgyuHM5.js.map → cookie-banner-CAvd3PC3.js.map} +1 -1
- package/dist/document-editor-container-BnEjlmaN.js +307 -0
- package/dist/document-editor-container-BnEjlmaN.js.map +1 -0
- package/dist/document-editor-container-kgS38mkb.js +4 -0
- package/dist/error-boundary-BsUBww61.js +155 -0
- package/dist/error-boundary-BsUBww61.js.map +1 -0
- package/dist/generic.d.ts +116 -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-B4g8swZG.d.ts +4 -0
- package/dist/layout-BOX6fL5v.js +5 -0
- package/dist/layout.d.ts +2 -28
- package/dist/layout.js +4 -6
- package/dist/{load--K_UgzUy.js → load-CCCHqC0d.js} +11 -11
- package/dist/{load--K_UgzUy.js.map → load-CCCHqC0d.js.map} +1 -1
- package/dist/load-runtime-config-Dhy-b5wT.js +14 -0
- package/dist/load-runtime-config-Dhy-b5wT.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/{open-file-uploads-BcyWmUZn.js → open-file-uploads-B5pr1sA2.js} +4 -4
- package/dist/{open-file-uploads-BcyWmUZn.js.map → open-file-uploads-B5pr1sA2.js.map} +1 -1
- package/dist/{package-manager-BkFRzovd.js → package-manager-x_fK8Hzm.js} +92 -60
- package/dist/package-manager-x_fK8Hzm.js.map +1 -0
- package/dist/{pglite-seed-BsEPByVM.js → pglite-seed-eGzXMld2.js} +4 -4
- package/dist/{pglite-seed-BsEPByVM.js.map → pglite-seed-eGzXMld2.js.map} +1 -1
- package/dist/{plugin-host--lBWChr9.js → plugins-B9VBgzio.js} +75 -83
- package/dist/plugins-B9VBgzio.js.map +1 -0
- package/dist/{preferences-store-DANUajdg.js → preferences-store-CSqauT9V.js} +5 -5
- package/dist/preferences-store-CSqauT9V.js.map +1 -0
- package/dist/prerender.d.ts +38 -0
- package/dist/prerender.d.ts.map +1 -0
- package/dist/prerender.js +177 -0
- package/dist/prerender.js.map +1 -0
- package/dist/{prerendered-shell-DxCUDEXL.js → prerendered-shell-peKE7AqI.js} +10 -4
- package/dist/prerendered-shell-peKE7AqI.js.map +1 -0
- package/dist/{reactor-5nod7BfF.js → reactor-BmI-D8O-.js} +25 -156
- package/dist/reactor-BmI-D8O-.js.map +1 -0
- package/dist/{registerServiceWorker-CkVxA2KC.js → registerServiceWorker-APlHkrmH.js} +4 -4
- package/dist/{registerServiceWorker-CkVxA2KC.js.map → registerServiceWorker-APlHkrmH.js.map} +1 -1
- package/dist/root-B1Pq9x6S.js +24 -0
- package/dist/root-B1Pq9x6S.js.map +1 -0
- package/dist/route-tree.d.ts +147 -156
- package/dist/route-tree.d.ts.map +1 -1
- package/dist/route-tree.js +93 -169
- package/dist/route-tree.js.map +1 -1
- package/dist/route-views-BF0p-4Fi.js +60 -0
- package/dist/route-views-BF0p-4Fi.js.map +1 -0
- package/dist/route-views-CTARvT5N.js +55 -0
- package/dist/route-views-CTARvT5N.js.map +1 -0
- package/dist/route-views-D8I-1PWU.js +4 -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-BguOMBUh.js +4 -0
- package/dist/router-L9X9U-97.js +46 -0
- package/dist/router-L9X9U-97.js.map +1 -0
- package/dist/router.d.ts +1 -3
- package/dist/router.js +3 -7
- package/dist/sentry-Cuc_Nbba.js +22 -0
- package/dist/sentry-Cuc_Nbba.js.map +1 -0
- package/dist/{settings-DkLhRfEI.js → settings-DjQfTrBe.js} +488 -22
- package/dist/settings-DjQfTrBe.js.map +1 -0
- package/dist/settings-tabs-iTlo2pYz.js +365 -0
- package/dist/settings-tabs-iTlo2pYz.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 -1
- package/dist/shell-plugins.json +1 -0
- package/dist/shell.html +1 -1
- package/dist/start-connect.d.ts +5 -9
- package/dist/start-connect.d.ts.map +1 -1
- package/dist/start-connect.js +5 -6
- package/dist/start-connect.js.map +1 -1
- package/dist/style.css +3127 -4014
- package/dist/ui-b6sMhi5V.js +66 -0
- package/dist/ui-b6sMhi5V.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/docs/customizing/data-and-navigation.md +177 -0
- package/docs/customizing/hosts-and-plugins.md +65 -0
- package/docs/customizing/layout.md +149 -0
- package/docs/customizing/modals.md +78 -0
- package/docs/customizing/overrides.md +113 -0
- package/docs/customizing/packages.md +38 -0
- package/docs/customizing/pages.md +136 -0
- package/docs/customizing/styles-and-branding.md +41 -0
- package/docs/customizing/types-and-troubleshooting.md +44 -0
- package/package.json +41 -18
- package/scripts/prerender-shell.ts +35 -84
- package/skills/customize-connect/SKILL.md +74 -0
- package/src/route-tree.ts +3 -0
- package/src/routeTree.gen.ts +134 -192
- package/src/router/index.ts +2 -51
- package/src/router/register.ts +1 -1
- package/src/routes/__root.tsx +8 -24
- 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 +5 -22
- package/tailwind.css +12 -0
- package/dist/AddDriveModal-D_3jDwjp.js.map +0 -1
- package/dist/ClearStorageModal-zZ8XzwmR.js.map +0 -1
- package/dist/ConfirmDocumentUpgradeModal-CrU2Z1CL.js.map +0 -1
- package/dist/CreateDocumentModal-Cf1APibL.js.map +0 -1
- package/dist/DebugSettingsModal-DIc5C2lI.js.map +0 -1
- package/dist/DeleteDriveModal-lE9eCBua.js.map +0 -1
- package/dist/DeleteItemModal-BFgcGsm3.js.map +0 -1
- package/dist/DisclaimerModal-CF6JkIIu.js.map +0 -1
- package/dist/DocumentVersionUnsupportedModal-Cm9Jb9W7.js.map +0 -1
- package/dist/DownloadDocumentWithErrorsModal-CShKhfEQ.js.map +0 -1
- package/dist/DriveAuthRequiredModal-CMwPUyZf.js.map +0 -1
- package/dist/DriveSettingsModal-BSImj4BH.js.map +0 -1
- package/dist/InspectorModal-Dr8-gj6u.js.map +0 -1
- package/dist/LoginModal-DT_05uva.js.map +0 -1
- package/dist/MissingPackageModal-DtISKgub.js +0 -49
- package/dist/MissingPackageModal-DtISKgub.js.map +0 -1
- package/dist/OpenFileDocumentsModal-X9GnX2Bk.js.map +0 -1
- package/dist/UpgradeDriveModal-DvM-PNWe.js.map +0 -1
- package/dist/app-layout-BIq-ZW-6.js +0 -394
- package/dist/app-layout-BIq-ZW-6.js.map +0 -1
- package/dist/app-loader-CWAH-WxW.js +0 -4
- package/dist/app-loader-DrViXipO.js.map +0 -1
- package/dist/app-skeleton-gzg8cRzm.js.map +0 -1
- package/dist/boot-CC_DgQKX.js.map +0 -1
- package/dist/connect-router-KmNBGS0G.js +0 -434
- package/dist/connect-router-KmNBGS0G.js.map +0 -1
- package/dist/connect.config-uZF-gnvV.js.map +0 -1
- package/dist/connection-state-C_477Kr_.js.map +0 -1
- package/dist/index-UrZFqSgm.d.ts +0 -166
- package/dist/index-UrZFqSgm.d.ts.map +0 -1
- package/dist/layout.d.ts.map +0 -1
- package/dist/multi-reactor-fSKpLBjT.js +0 -220
- package/dist/multi-reactor-fSKpLBjT.js.map +0 -1
- package/dist/package-manager-BkFRzovd.js.map +0 -1
- package/dist/plugin-host--lBWChr9.js.map +0 -1
- package/dist/preferences-store-DANUajdg.js.map +0 -1
- package/dist/prerendered-shell-DxCUDEXL.js.map +0 -1
- package/dist/reactor-5nod7BfF.js.map +0 -1
- package/dist/route-components-BkztQruF.js +0 -148
- package/dist/route-components-BkztQruF.js.map +0 -1
- package/dist/router-8RIbbf6v.js +0 -4
- package/dist/router-C37yATTD.js +0 -604
- package/dist/router-C37yATTD.js.map +0 -1
- package/dist/runtime-config-DdN1Frg7.js +0 -34
- package/dist/runtime-config-DdN1Frg7.js.map +0 -1
- package/dist/runtime-flag-B8IYhkz-.js +0 -4
- package/dist/runtime-flag-CT5OKujT.js +0 -45
- package/dist/runtime-flag-CT5OKujT.js.map +0 -1
- package/dist/sentry-CJb7--mu.js +0 -18
- package/dist/sentry-CJb7--mu.js.map +0 -1
- package/dist/settings-CjvK8OKA.js +0 -91
- package/dist/settings-CjvK8OKA.js.map +0 -1
- package/dist/settings-DkLhRfEI.js.map +0 -1
- package/dist/sidebar-BXf8OEwm.d.ts +0 -34
- package/dist/sidebar-BXf8OEwm.d.ts.map +0 -1
- package/dist/sidebar-lAVFRsni.js +0 -31
- package/dist/sidebar-lAVFRsni.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-BqIWwXV-.js +0 -452
- package/dist/useRegistryPackages-BqIWwXV-.js.map +0 -1
- package/scripts/critical-css.ts +0 -243
- package/src/router/connect-router.ts +0 -170
- package/src/router/drive-route-loader.ts +0 -116
- package/src/router/navigation.ts +0 -230
- package/src/router/perf-marks.test.tsx +0 -98
- package/src/router/perf-marks.ts +0 -97
- package/src/router/route-components.tsx +0 -98
- package/src/router/route-tree.ts +0 -88
- package/src/router/scroll.ts +0 -69
- package/src/router/search.ts +0 -66
- package/src/router/settings.ts +0 -120
- package/src/router/sidebar.ts +0 -55
- package/src/router/titles.test.ts +0 -24
- package/src/router/titles.ts +0 -33
- package/src/routes/core/_app/$.tsx +0 -13
- package/src/routes/core/_app/_content/d/$driveSlug/{-$nodeSlug}.tsx +0 -52
- package/src/routes/core/_app/_content/index.tsx +0 -3
- package/src/routes/core/_app/_content.tsx +0 -9
- package/src/routes/core/_app/settings/about.tsx +0 -20
- package/src/routes/core/_app/settings/ai-assistant.tsx +0 -20
- package/src/routes/core/_app/settings/danger-zone.tsx +0 -21
- package/src/routes/core/_app/settings/default-editors.tsx +0 -20
- package/src/routes/core/_app/settings/package-manager.tsx +0 -20
- package/src/routes/core/_app/settings.tsx +0 -35
- package/src/routes/core/_app.tsx +0 -10
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { a as SidebarItem, c as useSidebarMode, i as RouteSelection, n as ModalDialog, o as useDriveRouteData, r as ModalFrameProps, s as useNavRoutes, t as ContentOutlet } from "./index-B4g8swZG.js";
|
|
2
|
+
import React$1, { ReactNode } from "react";
|
|
3
|
+
import { ConnectSettingsTab } from "@powerhousedao/connect-core/router";
|
|
4
|
+
import "@tanstack/react-router";
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/generic/layout/app-layout.d.ts
|
|
7
|
+
type AppLayoutProps = {
|
|
8
|
+
/** Replaces Connect's sidebar, e.g. `<ConnectSidebar extraItems={...} />`. */
|
|
9
|
+
sidebar?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
/** The `_app` layout: the sidebar beside the matched route. Embedded mode and
|
|
12
|
+
* `staticData.sidebar: "hidden"` drop the sidebar. */
|
|
13
|
+
export declare function AppLayout({ sidebar }?: AppLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/generic/layout/route-views.d.ts
|
|
16
|
+
/** A loader on a cold start; otherwise the open view stays while loading. */
|
|
17
|
+
export declare function DrivePending(): import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/generic/layout/sidebar.d.ts
|
|
20
|
+
/** The drives the user may open, and the add-drive item when enabled. */
|
|
21
|
+
export declare function SidebarDriveItems(): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/** Links to the routes that declare `staticData.nav`, in order. */
|
|
23
|
+
export declare function SidebarNavItems(): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
type SidebarProps = {
|
|
25
|
+
/** Items after the drives and nav routes, e.g. a custom layout's links. */
|
|
26
|
+
extraItems?: ReactNode;
|
|
27
|
+
/** Header and footer only, no items. */
|
|
28
|
+
collapsed?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/** Connect's sidebar: drives, nav routes, settings and the user. */
|
|
31
|
+
declare function Sidebar({ extraItems, collapsed }?: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/generic/editors/open-document.d.ts
|
|
34
|
+
/** The route's open document's editor, e.g. in a project's drive route
|
|
35
|
+
* override; nothing while no document is open. */
|
|
36
|
+
export declare function OpenDocument(): import("react/jsx-runtime").JSX.Element | null;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/generic/pages/content.d.ts
|
|
39
|
+
/** Connect's home: the drives, and adding one. */
|
|
40
|
+
export declare function Home(): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
/** Connect's drive layout: the drive app around the open document, or the
|
|
42
|
+
* sign-in gate when the drive's remote refuses the user. */
|
|
43
|
+
export declare function DriveLayout(): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
/** Connect's node route: the open document's editor. */
|
|
45
|
+
export declare function NodeView(): import("react/jsx-runtime").JSX.Element | null;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/generic/settings/about.d.ts
|
|
48
|
+
declare const About: React.FC;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/generic/settings/ai-assistant.d.ts
|
|
51
|
+
/**
|
|
52
|
+
* Settings-modal section for the in-browser AI assistant: the user master
|
|
53
|
+
* toggle, the OpenAI-compatible endpoint configuration, and a
|
|
54
|
+
* save-and-test-connection action. Only mounted when the deployment
|
|
55
|
+
* enables the feature (`connect.ai.assistantEnabled`).
|
|
56
|
+
*/
|
|
57
|
+
declare const AiAssistant: React.FC;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/generic/settings/danger-zone.d.ts
|
|
60
|
+
declare const DangerZone: React.FC;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/generic/settings/default-editor.d.ts
|
|
63
|
+
declare const DefaultEditor: React.FC;
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/generic/settings/package-manager.d.ts
|
|
66
|
+
declare const ConnectPackageManager: React$1.FC;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/generic/settings/settings-page.d.ts
|
|
69
|
+
/** The settings page: its tabs as links beside the open one. */
|
|
70
|
+
declare function SettingsPage$1(): import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
declare namespace index_d_exports {
|
|
72
|
+
export { About, AiAssistant, ConnectPackageManager, DangerZone, DefaultEditor, SettingsPage$1 as SettingsPage };
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/generic/settings/tabs.d.ts
|
|
76
|
+
/** Whether the AI assistant is configured. */
|
|
77
|
+
export declare const aiAssistantEnabled: () => boolean;
|
|
78
|
+
/** Connect's settings page around the shown tab. */
|
|
79
|
+
export declare const SettingsPage: import("@tanstack/react-router").AsyncRouteComponent<unknown>;
|
|
80
|
+
/** One of Connect's settings tabs. */
|
|
81
|
+
export declare function settingsTab(name: Exclude<keyof typeof index_d_exports, "SettingsPage">): import("@tanstack/react-router").AsyncRouteComponent<{}>;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/generic/settings-tabs.d.ts
|
|
84
|
+
/** The generic plugin's settings tabs by path: each tab's route options, which a
|
|
85
|
+
* project file at that path spreads to replace the tab's view. */
|
|
86
|
+
export declare const genericSettingsTabs: {
|
|
87
|
+
"ai-assistant": {
|
|
88
|
+
staticData: {
|
|
89
|
+
settings: ConnectSettingsTab;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
"package-manager": {
|
|
93
|
+
staticData: {
|
|
94
|
+
settings: ConnectSettingsTab;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
"default-editors": {
|
|
98
|
+
staticData: {
|
|
99
|
+
settings: ConnectSettingsTab;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
"danger-zone": {
|
|
103
|
+
staticData: {
|
|
104
|
+
settings: ConnectSettingsTab;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
about: {
|
|
108
|
+
staticData: {
|
|
109
|
+
settings: ConnectSettingsTab;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { type AppLayoutProps, Sidebar as ConnectSidebar, type SidebarProps as ConnectSidebarProps, ContentOutlet, ModalDialog, type ModalFrameProps, RouteSelection, SidebarItem, useDriveRouteData, useNavRoutes, useSidebarMode };
|
|
115
|
+
export {};
|
|
116
|
+
//# 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/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":";;;;;;KAQY;;EAEV,UAAU;;;;wBAKI,YAAY,YAAW,6CAAmB,IAAA;;;;wBCN1C,4CAAY,IAAA;;;;wBC6CZ,iDAAiB,IAAA;;wBAiDjB,+CAAe,IAAA;KAWnB;;EAEV,aAAa;;EAEb;;;iBAIc,UAAU,YAAY,cAAa,2CAAiB,IAAA;;;;;wBC1GpD,4CAAY,IAAA;;;;wBCcZ,oCAAI,IAAA;;;wBAiBJ,2CAAW,IAAA;;wBAyBX,wCAAQ,IAAA;;;cCnDX,OAAO,MAAM;;;;;;;;;cCGb,aAAa,MAAM;;;cCfnB,YAAY,MAAM;;;cCDlB,eAAe,MAAM;;;cCWrB,uBAAuB,QAAM;;;;iBCgB1B,8CAAY,IAAA;;;;;;;qBE9Bf;;qBAMA,+CAAY;;wBAGT,YACd,MAAM,qBAAqB,oEAA+B;;;;;qBCF/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]="f49f081b-fe19-5076-a0f7-06facd312df2")}catch(e){}}();
|
|
3
|
+
import { a as useDriveRouteData, i as SidebarItem, n as ModalDialog, o as useNavRoutes, r as RouteSelection, s as useSidebarMode, t as ContentOutlet } from "./layout-BOX6fL5v.js";
|
|
4
|
+
import { r as ErrorBoundary } from "./error-boundary-BsUBww61.js";
|
|
5
|
+
import { a as settingsTab, c as NodeView, d as AppLayout, f as Sidebar, i as aiAssistantEnabled, l as DrivePending, m as SidebarNavItems, o as DriveLayout, p as SidebarDriveItems, r as SettingsPage, s as Home, t as genericSettingsTabs } from "./settings-tabs-iTlo2pYz.js";
|
|
6
|
+
import { n as EditorLoader } from "./document-editor-container-BnEjlmaN.js";
|
|
7
|
+
import { Suspense, lazy } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { RouteSelection as RouteSelection$1, 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-kgS38mkb.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(RouteSelection$1, { children: /* @__PURE__ */ jsx(DocumentEditorContainer, { documentId }) })
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { AppLayout, Sidebar as ConnectSidebar, ContentOutlet, DriveLayout, DrivePending, Home, ModalDialog, NodeView, OpenDocument, RouteSelection, SettingsPage, SidebarDriveItems, SidebarItem, SidebarNavItems, aiAssistantEnabled, genericSettingsTabs, settingsTab, useDriveRouteData, useNavRoutes, useSidebarMode };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=generic.js.map
|
|
31
|
+
//# debugId=f49f081b-fe19-5076-a0f7-06facd312df2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.js","sources":["../src/generic/editors/open-document.tsx"],"sourcesContent":["import {\n RouteSelection,\n useDriveRouteData,\n} 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 <RouteSelection>\n <DocumentEditorContainer documentId={documentId} />\n </RouteSelection>\n </Suspense>\n </ErrorBoundary>\n );\n}\n"],"names":["useDriveRouteData","RouteSelection"],"mappings":";;;;;;;;;;AAQA,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,oBAACC,kBAAD,EAAA,UACE,oBAAC,yBAAD,EAAqC,WAAa,CAAA,EACpC,CAAA;EACR,CAAA;CACG,CAAA;AAEnB","debug_id":"f49f081b-fe19-5076-a0f7-06facd312df2"}
|
|
@@ -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 { ContentOutlet as ContentOutlet$1, ModalDialog, ModalFrameProps, RouteSelection as RouteSelection$1, useDriveRouteData as useDriveRouteData$1, useNavRoutes as useNavRoutes$1, useSidebarMode as useSidebarMode$1 } from "@powerhousedao/connect-core/router";
|
|
2
|
+
import { SidebarItem as SidebarItem$1 } from "@powerhousedao/design-system/connect";
|
|
3
|
+
export { SidebarItem$1 as a, useSidebarMode$1 as c, RouteSelection$1 as i, ModalDialog as n, useDriveRouteData$1 as o, ModalFrameProps as r, useNavRoutes$1 as s, ContentOutlet$1 as t };
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ContentOutlet as ContentOutlet$1, ModalDialog, RouteSelection as RouteSelection$1, useDriveRouteData as useDriveRouteData$1, useNavRoutes as useNavRoutes$1, useSidebarMode as useSidebarMode$1 } from "@powerhousedao/connect-core/router";
|
|
2
|
+
import { SidebarItem as SidebarItem$1 } from "@powerhousedao/design-system/connect";
|
|
3
|
+
export { useDriveRouteData$1 as a, SidebarItem$1 as i, ModalDialog as n, useNavRoutes$1 as o, RouteSelection$1 as r, useSidebarMode$1 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]="5bf23513-ce30-5774-acb1-92300f1fa8ec")}catch(e){}}();
|
|
5
|
+
//# debugId=5bf23513-ce30-5774-acb1-92300f1fa8ec
|
package/dist/layout.d.ts
CHANGED
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
3
|
-
import { SidebarItem } from "@powerhousedao/design-system/connect";
|
|
4
|
-
//#region src/components/app-layout.d.ts
|
|
5
|
-
type AppLayoutProps = {
|
|
6
|
-
/** Replaces Connect's sidebar, e.g. `<ConnectSidebar extraItems={...} />`. */
|
|
7
|
-
sidebar?: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
/** The `_app` layout: the sidebar beside the matched route. Embedded mode and
|
|
10
|
-
* `staticData.sidebar: "hidden"` drop the sidebar. */
|
|
11
|
-
export declare function AppLayout({ sidebar }?: AppLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/components/sidebar.d.ts
|
|
14
|
-
/** The drives the user may open, and the add-drive item when enabled. */
|
|
15
|
-
export declare function SidebarDriveItems(): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
/** Links to the routes that declare `staticData.nav`, in order. */
|
|
17
|
-
export declare function SidebarNavItems(): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
type SidebarProps = {
|
|
19
|
-
/** Items after the drives and nav routes, e.g. a custom layout's links. */
|
|
20
|
-
extraItems?: ReactNode;
|
|
21
|
-
/** Header and footer only, no items. */
|
|
22
|
-
collapsed?: boolean;
|
|
23
|
-
};
|
|
24
|
-
/** Connect's sidebar: drives, nav routes, settings and the user. */
|
|
25
|
-
declare function Sidebar({ extraItems, collapsed }?: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { type AppLayoutProps, Sidebar as ConnectSidebar, type SidebarProps as ConnectSidebarProps, SidebarItem, useNavRoutes, useSidebarMode };
|
|
1
|
+
import { a as SidebarItem, c as useSidebarMode, i as RouteSelection, n as ModalDialog, o as useDriveRouteData, r as ModalFrameProps, s as useNavRoutes, t as ContentOutlet } from "./index-B4g8swZG.js";
|
|
2
|
+
export { ContentOutlet, ModalDialog, type ModalFrameProps, RouteSelection, SidebarItem, useDriveRouteData, useNavRoutes, useSidebarMode };
|
|
28
3
|
export {};
|
|
29
|
-
//# sourceMappingURL=layout.d.ts.map
|
package/dist/layout.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { n as useNavRoutes, r as useSidebarMode } from "./
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
!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]="869a0af9-3911-52f9-8fa0-b8d574968aa3")}catch(e){}}();
|
|
6
|
-
//# debugId=869a0af9-3911-52f9-8fa0-b8d574968aa3
|
|
1
|
+
import { a as useDriveRouteData, i as SidebarItem, n as ModalDialog, o as useNavRoutes, r as RouteSelection, s as useSidebarMode, t as ContentOutlet } from "./layout-BOX6fL5v.js";
|
|
2
|
+
export { ContentOutlet, ModalDialog, RouteSelection, SidebarItem, 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]="8b6d39bf-eed0-51a4-a354-7ac727afdb3d")}catch(e){}}();
|
|
4
|
+
//# debugId=8b6d39bf-eed0-51a4-a354-7ac727afdb3d
|
|
@@ -1,13 +1,13 @@
|
|
|
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 { r as
|
|
5
|
-
import "./
|
|
6
|
-
import { r as
|
|
7
|
-
import
|
|
8
|
-
import { a as detectMigrationMajor, o as detectReactorPgMajor } from "./connection-state-
|
|
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]="fddef979-e3f9-5d56-8fd1-bc0f4ead157c")}catch(e){}}();
|
|
3
|
+
import { t as loadRuntimeConfig } from "./load-runtime-config-Dhy-b5wT.js";
|
|
4
|
+
import { r as connectConfig } from "./connect.config-D1pGNmaF.js";
|
|
5
|
+
import { t as getBuildHash } from "./build-info-DkY9PU7c.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-B6fleM37.js";
|
|
9
|
+
import { n as seedPendingPgVersion } from "./pglite-seed-eGzXMld2.js";
|
|
10
|
+
import { n as createReactor } from "./reactor-BmI-D8O-.js";
|
|
11
11
|
import { useEffect } from "react";
|
|
12
12
|
import { initTheme, useUser } from "@powerhousedao/reactor-browser";
|
|
13
13
|
import { logger } from "document-model";
|
|
@@ -129,5 +129,5 @@ async function loadComponent(localPackage, store) {
|
|
|
129
129
|
//#endregion
|
|
130
130
|
export { loadComponent };
|
|
131
131
|
|
|
132
|
-
//# sourceMappingURL=load
|
|
133
|
-
//# debugId=
|
|
132
|
+
//# sourceMappingURL=load-CCCHqC0d.js.map
|
|
133
|
+
//# debugId=fddef979-e3f9-5d56-8fd1-bc0f4ead157c
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load
|
|
1
|
+
{"version":3,"file":"load-CCCHqC0d.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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;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":"fddef979-e3f9-5d56-8fd1-bc0f4ead157c"}
|
|
@@ -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]="199608dc-536a-5bb1-95ea-c782d85a9530")}catch(e){}}();
|
|
3
|
+
import { loadRuntimeConfig } from "@powerhousedao/connect-core/runtime-config";
|
|
4
|
+
//#region src/load-runtime-config.ts
|
|
5
|
+
const connectPlugins = () => import("./plugins-B9VBgzio.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-Dhy-b5wT.js.map
|
|
14
|
+
//# debugId=199608dc-536a-5bb1-95ea-c782d85a9530
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-runtime-config-Dhy-b5wT.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":"199608dc-536a-5bb1-95ea-c782d85a9530"}
|
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-JTGLJtmJ.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-Cj2p8L1I.js");
|
|
9
9
|
root.render(/* @__PURE__ */ jsx(AppLoader, {}));
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
@@ -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 { addFileWithProgress, getPHStore, setSelectedNode, showPHModal, subscribeToPHValue } from "@powerhousedao/reactor-browser";
|
|
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){}}();
|
|
4
3
|
import { formatFileSize, mapProgressStageToStatus } from "@powerhousedao/design-system/connect";
|
|
4
|
+
import { addFileWithProgress, getPHStore, setSelectedNode, showPHModal, subscribeToPHValue } from "@powerhousedao/reactor-browser";
|
|
5
5
|
//#region src/utils/launch-queue.ts
|
|
6
6
|
let pendingImportFiles = [];
|
|
7
7
|
const pendingListeners = /* @__PURE__ */ new Set();
|
|
@@ -179,5 +179,5 @@ function runOpenFileImports(args) {
|
|
|
179
179
|
//#endregion
|
|
180
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
181
|
|
|
182
|
-
//# sourceMappingURL=open-file-uploads-
|
|
183
|
-
//# debugId=
|
|
182
|
+
//# sourceMappingURL=open-file-uploads-B5pr1sA2.js.map
|
|
183
|
+
//# debugId=a45854ff-38ca-5447-8b9d-a71fddae89a6
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-file-uploads-BcyWmUZn.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":";;;;;AAiBA,IAAI,qBAA6B,CAAC;AAClC,MAAM,mCAAmB,IAAI,IAAgB;AAE7C,SAAS,yBAAyB;CAChC,KAAK,MAAM,YAAY,kBAAkB,SAAS;AACpD;AAEA,SAAgB,wBAAgC;CAC9C,OAAO;AACT;;AAGA,SAAgB,eAAe,MAAoB;CACjD,OAAO,GAAG,KAAK,KAAK,GAAG,KAAK,KAAK,GAAG,KAAK;AAC3C;AAEA,SAAgB,sBAAsB,OAAe;CAGnD,MAAM,OAAO,IAAI,IAAI,mBAAmB,IAAI,cA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U,SAAS,SAAS,IAAI,CAAC;GAC7D,CAAC;GACD,QAAQ,SAAS,OAAjB;IACE,KAAK;KACH,OAAO,SAAS,QAAQ;KACxB;IACF,KAAK;IACL,KAAK,6BACH,OAAO,KAAA,CAAS;GAIpB;EACF,GACA,eACA,WACF,CAAC,CAAC,YAAY;GAGZ,OAAO,KAAA,CAAS;EAClB,CAAC;CACH,CAAC;AACH;;;;;;AAOA,SAAgB,mBAAmB,MAIjB;CAChB,MAAM,EAAE,SAAS,SAAS,kBAAkB;CAC5C,IAAI,QAAQ,WAAW,GAAG,OAAO;CAEjC,MAAM,OAAO,QAAQ,KAAK,EAAE,MAAM,YAAY;EAC5C,IAAI,aAAa,EAAE;EACnB;EACA;CACF,EAAE;CACF,mBACE,KAAK,KAAK,SAAS;EACjB,IAAI,IAAI;EACR,UAAU,IAAI;EACd,UAAU,eAAe,IAAI,KAAK,IAAI;EACtC,QAAQ;EACR,UAAU;CACZ,EAAE,CACJ;CAEA,MAAM,MAAM,YAAY;EACtB,MAAM,UAAoC,CAAC;EAC3C,KAAK,MAAM,OAAO,MAChB,QAAQ,KAAK,MAAM,UAAU,KAAK,SAAS,aAAa,CAAC;EAI3D,IAAI,KAAK,WAAW,KAAK,QAAQ,IAC/B,gBAAgB,QAAQ,EAAE;CAE9B;CACA,cAAc,YAAY,KAAK,KAAK,GAAG;CACvC,OAAO;AACT","debug_id":"54f17b90-acbe-5ba5-a870-6fd370beb817"}
|
|
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":";;;;;AAiBA,IAAI,qBAA6B,CAAC;AAClC,MAAM,mCAAmB,IAAI,IAAgB;AAE7C,SAAS,yBAAyB;CAChC,KAAK,MAAM,YAAY,kBAAkB,SAAS;AACpD;AAEA,SAAgB,wBAAgC;CAC9C,OAAO;AACT;;AAGA,SAAgB,eAAe,MAAoB;CACjD,OAAO,GAAG,KAAK,KAAK,GAAG,KAAK,KAAK,GAAG,KAAK;AAC3C;AAEA,SAAgB,sBAAsB,OAAe;CAGnD,MAAM,OAAO,IAAI,IAAI,mBAAmB,IAAI,cAAc,CAAC;CAC3D,MAAM,QAAQ,MAAM,QAAQ,SAAS;EACnC,MAAM,MAAM,eAAe,IAAI;EAC/B,IAAI,KAAK,IAAI,GAAG,GAAG,OAAO;EAC1B,KAAK,IAAI,GAAG;EACZ,OAAO;CACT,CAAC;CACD,IAAI,MAAM,WAAW,GAAG;CACxB,qBAAqB,CAAC,GAAG,oBAAoB,GAAG,KAAK;CACrD,uBAAuB;AACzB;AAEA,SAAgB,0BAA0B;CACxC,IAAI,mBAAmB,WAAW,GAAG;CACrC,qBAAqB,CAAC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