@powerhousedao/connect 6.2.3-dev.8 → 6.2.3-dev.80
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-CFi-9FQU.js} +28 -15
- package/dist/AddDriveModal-CFi-9FQU.js.map +1 -0
- package/dist/{ClearStorageModal-BAqs4G2s.js → ClearStorageModal-XlHarNph.js} +11 -13
- package/dist/ClearStorageModal-XlHarNph.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-rV_v0F0d.js → DebugSettingsModal-BSafp4hB.js} +9 -9
- package/dist/DebugSettingsModal-BSafp4hB.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-C6-mRQiv.js → DriveSettingsModal-DZKawN7w.js} +6 -6
- package/dist/DriveSettingsModal-DZKawN7w.js.map +1 -0
- package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js +2565 -0
- package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js.map +1 -0
- package/dist/{InspectorModal-CpEhVnM6.js → InspectorModal-BEil2KCK.js} +70 -30
- package/dist/InspectorModal-BEil2KCK.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-BW3ZFRDR.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/app-loader-C1jLx7Yk.js +4 -0
- package/dist/app-loader-i_orb0RX.js +1254 -0
- package/dist/app-loader-i_orb0RX.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-66bf7yVc.js +233 -0
- package/dist/boot-66bf7yVc.js.map +1 -0
- package/dist/buffer-DNTcuap_.js +66 -0
- package/dist/buffer-DNTcuap_.js.map +1 -0
- package/dist/{build-info-D1h45Bga.js → build-info-Dg9V2Zes.js} +10 -6
- package/dist/build-info-Dg9V2Zes.js.map +1 -0
- package/dist/components-C5X9jfPL.js +121 -0
- package/dist/components-C5X9jfPL.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-Bwm9Agwy.js} +20 -9
- package/dist/connection-state-Bwm9Agwy.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-CGLXOl0t.js +4 -0
- package/dist/document-editor-container-FNIEsf8H.js +310 -0
- package/dist/document-editor-container-FNIEsf8H.js.map +1 -0
- package/dist/drive-icon-BIpd8edR.js +49 -0
- package/dist/drive-icon-BIpd8edR.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-B0xIT-MF.js → load-jNCWf-Tp.js} +48 -46
- package/dist/load-jNCWf-Tp.js.map +1 -0
- package/dist/load-runtime-config-BAaAgQg0.js +14 -0
- package/dist/load-runtime-config-BAaAgQg0.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-B-bEk-5n.js +543 -0
- package/dist/package-manager-B-bEk-5n.js.map +1 -0
- package/dist/{pglite-major-B39aOEiE.js → pglite-major-p4_YefAE.js} +23 -5
- package/dist/pglite-major-p4_YefAE.js.map +1 -0
- package/dist/{pglite-migrate-core-Boxqqx-c.js → pglite-migrate-core-DBlU6HIc.js} +9 -7
- package/dist/pglite-migrate-core-DBlU6HIc.js.map +1 -0
- package/dist/{pglite-seed-BqAUvNFw.js → pglite-seed-QPbGbLB_.js} +4 -4
- package/dist/{pglite-seed-BqAUvNFw.js.map → pglite-seed-QPbGbLB_.js.map} +1 -1
- 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-CPd2_0eG.js +264 -0
- package/dist/plugins-CPd2_0eG.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-DQRJpF0r.js} +3 -3
- package/dist/{pwa-manifest-link-DIgOSo2Q.js.map → pwa-manifest-link-DQRJpF0r.js.map} +1 -1
- package/dist/{reactor-B6xhZK1N.js → reactor-BEYvZrpZ.js} +565 -567
- package/dist/reactor-BEYvZrpZ.js.map +1 -0
- package/dist/reactor-chat-BwR9R1ah.js +46 -0
- package/dist/reactor-chat-BwR9R1ah.js.map +1 -0
- package/dist/reactor.worker.d.ts +2 -1
- package/dist/reactor.worker.js +478 -158
- package/dist/reactor.worker.js.map +1 -1
- package/dist/{registerServiceWorker-BSzbNfvz.js → registerServiceWorker-X6fT91iL.js} +5 -5
- package/dist/{registerServiceWorker-BSzbNfvz.js.map → registerServiceWorker-X6fT91iL.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-KlgfolUd.js +1089 -0
- package/dist/settings-KlgfolUd.js.map +1 -0
- package/dist/settings-tabs-CJ40jEPe.js +424 -0
- package/dist/settings-tabs-CJ40jEPe.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 +3340 -755
- 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-DFO6kV2V.js +66 -0
- package/dist/ui-DFO6kV2V.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 +403 -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-BAqs4G2s.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-rV_v0F0d.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.map +0 -1
- package/dist/InspectorModal-CpEhVnM6.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-BW3ZFRDR.js.map +0 -1
- package/dist/SettingsModal-DlxUZEQ4.js +0 -569
- package/dist/SettingsModal-DlxUZEQ4.js.map +0 -1
- package/dist/UpgradeDriveModal-_8t9slxQ.js.map +0 -1
- package/dist/app-loader-D4tbk4ev.js +0 -4
- package/dist/app-loader-Dz_X0r7a.js +0 -2244
- package/dist/app-loader-Dz_X0r7a.js.map +0 -1
- package/dist/build-info-D1h45Bga.js.map +0 -1
- package/dist/components-Bmn9nGdQ.js +0 -4
- package/dist/connect.config-DaHDEUrw.js.map +0 -1
- package/dist/connection-state-3w4liC1X.js.map +0 -1
- package/dist/load-B0xIT-MF.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/preferences-store-_5Cw4_YV.js.map +0 -1
- package/dist/reactor-B6xhZK1N.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,264 @@
|
|
|
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]="0ccc04d6-8b0f-5f9f-8b34-9b042041c765")}catch(e){}}();
|
|
3
|
+
import { a as genericConfigSchema, i as openPanelConfigSchema, n as vetraStudioConfigSchema, o as assistantConfigSchema, r as sentryConfigSchema, t as workflowsConnectConfigSchema } from "./workflows-C3qEvx1R.js";
|
|
4
|
+
import { DEFAULT_CONNECT_CONFIG } from "@powerhousedao/shared/connect";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { PluginError } from "@powerhousedao/host-core/plugins";
|
|
7
|
+
import { findToken } from "@powerhousedao/host-core/schema";
|
|
8
|
+
//#region src/plugins/entry-config.ts
|
|
9
|
+
/**
|
|
10
|
+
* Validate a built-in plugin's entry config against its configSchema, the way
|
|
11
|
+
* host-core's resolveHostPlugins does on the server: a failure names the
|
|
12
|
+
* plugin and every offending key instead of surfacing a bare ZodError from
|
|
13
|
+
* the runtime-config load.
|
|
14
|
+
*/
|
|
15
|
+
function parseEntryConfig(specifier, schema, rawConfig) {
|
|
16
|
+
const parsed = schema.safeParse(rawConfig);
|
|
17
|
+
if (!parsed.success) throw new PluginError(`config for Connect plugin "${specifier}" is invalid:\n` + z.prettifyError(parsed.error), `Fix the entry's config in the host's runner.plugins.`);
|
|
18
|
+
return parsed.data;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/plugins/assistant.ts
|
|
22
|
+
const createAssistantPlugin = (rawConfig) => {
|
|
23
|
+
parseEntryConfig("@powerhousedao/connect/plugins/assistant", assistantConfigSchema, rawConfig);
|
|
24
|
+
return {
|
|
25
|
+
name: "connect-assistant",
|
|
26
|
+
appliesTo: "connect",
|
|
27
|
+
configSchema: assistantConfigSchema,
|
|
28
|
+
hooks: { transformConnectConfig(served) {
|
|
29
|
+
return {
|
|
30
|
+
...served,
|
|
31
|
+
ai: {
|
|
32
|
+
...served.ai,
|
|
33
|
+
assistantEnabled: true
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
} }
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/plugins/generic.ts
|
|
41
|
+
const DEFAULT_DRIVES = DEFAULT_CONNECT_CONFIG.drives;
|
|
42
|
+
const DEFAULT_HOME = DEFAULT_CONNECT_CONFIG.home;
|
|
43
|
+
const createGenericPlugin = (rawConfig) => {
|
|
44
|
+
const config = parseEntryConfig("@powerhousedao/connect/plugins/generic", genericConfigSchema, rawConfig);
|
|
45
|
+
return {
|
|
46
|
+
name: "connect-generic",
|
|
47
|
+
appliesTo: "connect",
|
|
48
|
+
configSchema: genericConfigSchema,
|
|
49
|
+
hooks: { transformConnectConfig(served) {
|
|
50
|
+
const entrySections = config.sections ?? {};
|
|
51
|
+
return {
|
|
52
|
+
...served,
|
|
53
|
+
drives: {
|
|
54
|
+
...served.drives,
|
|
55
|
+
allowAddDrive: config.allowAddDrive ?? DEFAULT_DRIVES?.allowAddDrive,
|
|
56
|
+
sections: {
|
|
57
|
+
remote: {
|
|
58
|
+
...DEFAULT_DRIVES?.sections?.remote,
|
|
59
|
+
...entrySections.remote
|
|
60
|
+
},
|
|
61
|
+
local: {
|
|
62
|
+
...DEFAULT_DRIVES?.sections?.local,
|
|
63
|
+
...entrySections.local
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
icons: config.icons ?? null
|
|
67
|
+
},
|
|
68
|
+
home: {
|
|
69
|
+
...served.home,
|
|
70
|
+
background: config.homeBackground ?? DEFAULT_HOME?.background ?? null
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
} }
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/plugins/openpanel.ts
|
|
78
|
+
const createOpenPanelPlugin = (rawConfig) => {
|
|
79
|
+
const config = parseEntryConfig("@powerhousedao/connect/plugins/openpanel", openPanelConfigSchema, rawConfig);
|
|
80
|
+
return {
|
|
81
|
+
name: "connect-openpanel",
|
|
82
|
+
appliesTo: "connect",
|
|
83
|
+
configSchema: openPanelConfigSchema,
|
|
84
|
+
hooks: { transformConnectConfig(served) {
|
|
85
|
+
return {
|
|
86
|
+
...served,
|
|
87
|
+
openPanel: {
|
|
88
|
+
...served.openPanel,
|
|
89
|
+
...config
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
} }
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/plugins/sentry.ts
|
|
97
|
+
const createSentryPlugin = (rawConfig) => {
|
|
98
|
+
const config = parseEntryConfig("@powerhousedao/connect/plugins/sentry", sentryConfigSchema, rawConfig);
|
|
99
|
+
return {
|
|
100
|
+
name: "connect-sentry",
|
|
101
|
+
appliesTo: "connect",
|
|
102
|
+
configSchema: sentryConfigSchema,
|
|
103
|
+
hooks: { transformConnectConfig(served) {
|
|
104
|
+
return {
|
|
105
|
+
...served,
|
|
106
|
+
sentry: {
|
|
107
|
+
...served.sentry,
|
|
108
|
+
...config
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
} }
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/plugins/ids.ts
|
|
116
|
+
/** The generic shell: Connect's sidebar, home screen and settings tabs. */
|
|
117
|
+
const GENERIC_PLUGIN = "@powerhousedao/connect/plugins/generic";
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/plugins/vetra-studio.ts
|
|
120
|
+
const createVetraStudioPlugin = (rawConfig) => {
|
|
121
|
+
parseEntryConfig("@powerhousedao/vetra-studio/connect", vetraStudioConfigSchema, rawConfig);
|
|
122
|
+
return {
|
|
123
|
+
name: "vetra-studio-connect",
|
|
124
|
+
appliesTo: "connect",
|
|
125
|
+
configSchema: vetraStudioConfigSchema,
|
|
126
|
+
hooks: { transformConnectConfig(served) {
|
|
127
|
+
return {
|
|
128
|
+
...served,
|
|
129
|
+
app: {
|
|
130
|
+
...served.app,
|
|
131
|
+
studioMode: true
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
} }
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/plugins/workflows.ts
|
|
139
|
+
const LOG = "[connect:plugins:workflows]";
|
|
140
|
+
function withDrive(drives, url, name) {
|
|
141
|
+
const existing = drives ?? [];
|
|
142
|
+
if (existing.some((drive) => "url" in drive && drive.url === url)) return existing;
|
|
143
|
+
return [...existing, {
|
|
144
|
+
url,
|
|
145
|
+
name: name ?? null,
|
|
146
|
+
icon: null
|
|
147
|
+
}];
|
|
148
|
+
}
|
|
149
|
+
const createWorkflowsPlugin = (rawConfig) => {
|
|
150
|
+
const config = parseEntryConfig("@powerhousedao/connect/plugins/workflows", workflowsConnectConfigSchema, rawConfig);
|
|
151
|
+
return {
|
|
152
|
+
name: "connect-workflows",
|
|
153
|
+
appliesTo: "connect",
|
|
154
|
+
configSchema: workflowsConnectConfigSchema,
|
|
155
|
+
hooks: { transformConnectConfig(served) {
|
|
156
|
+
const out = {
|
|
157
|
+
...served,
|
|
158
|
+
app: {
|
|
159
|
+
...served.app,
|
|
160
|
+
workflowsEnabled: true
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const drive = config.drive;
|
|
164
|
+
if (typeof drive === "string") out.drives = {
|
|
165
|
+
...served.drives,
|
|
166
|
+
defaultDrives: withDrive(served.drives?.defaultDrives, drive, config.name)
|
|
167
|
+
};
|
|
168
|
+
else if (drive !== void 0) console.warn(`${LOG} drive is an unresolved output token (${findToken(drive)?.key ?? "unknown"}); no Workflows drive attached.`);
|
|
169
|
+
return out;
|
|
170
|
+
} }
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/plugins/index.ts
|
|
175
|
+
const ANALYTICS_CONSENT = { consent: true };
|
|
176
|
+
const driveSectionOff = {
|
|
177
|
+
enabled: false,
|
|
178
|
+
allowAdd: false,
|
|
179
|
+
allowDelete: false
|
|
180
|
+
};
|
|
181
|
+
/** Connect's built-in plugins, by the specifier a composition names. */
|
|
182
|
+
const connectPlugins = {
|
|
183
|
+
[GENERIC_PLUGIN]: {
|
|
184
|
+
create: createGenericPlugin,
|
|
185
|
+
ui: () => import("./ui-DFO6kV2V.js").then((m) => m.default),
|
|
186
|
+
shell: "generic",
|
|
187
|
+
whenAbsent: (config) => ({
|
|
188
|
+
...config,
|
|
189
|
+
drives: {
|
|
190
|
+
...config.drives,
|
|
191
|
+
allowAddDrive: false,
|
|
192
|
+
sections: {
|
|
193
|
+
remote: driveSectionOff,
|
|
194
|
+
local: driveSectionOff
|
|
195
|
+
},
|
|
196
|
+
icons: null
|
|
197
|
+
},
|
|
198
|
+
home: {
|
|
199
|
+
...config.home,
|
|
200
|
+
background: null
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
},
|
|
204
|
+
"@powerhousedao/connect/plugins/sentry": {
|
|
205
|
+
create: createSentryPlugin,
|
|
206
|
+
ui: () => Promise.resolve(ANALYTICS_CONSENT),
|
|
207
|
+
whenAbsent: (config) => ({
|
|
208
|
+
...config,
|
|
209
|
+
sentry: {
|
|
210
|
+
...config.sentry,
|
|
211
|
+
dsn: null
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
},
|
|
215
|
+
"@powerhousedao/connect/plugins/openpanel": {
|
|
216
|
+
create: createOpenPanelPlugin,
|
|
217
|
+
ui: () => Promise.resolve(ANALYTICS_CONSENT),
|
|
218
|
+
whenAbsent: (config) => ({
|
|
219
|
+
...config,
|
|
220
|
+
openPanel: {
|
|
221
|
+
...config.openPanel,
|
|
222
|
+
clientId: "",
|
|
223
|
+
trackUiEvents: false,
|
|
224
|
+
trackOperations: false
|
|
225
|
+
}
|
|
226
|
+
})
|
|
227
|
+
},
|
|
228
|
+
"@powerhousedao/connect/plugins/assistant": {
|
|
229
|
+
create: createAssistantPlugin,
|
|
230
|
+
whenAbsent: (config) => ({
|
|
231
|
+
...config,
|
|
232
|
+
ai: {
|
|
233
|
+
...config.ai,
|
|
234
|
+
assistantEnabled: false
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
},
|
|
238
|
+
"@powerhousedao/connect/plugins/workflows": {
|
|
239
|
+
create: createWorkflowsPlugin,
|
|
240
|
+
whenAbsent: (config) => ({
|
|
241
|
+
...config,
|
|
242
|
+
app: {
|
|
243
|
+
...config.app,
|
|
244
|
+
workflowsEnabled: false
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
},
|
|
248
|
+
"@powerhousedao/vetra-studio/connect": {
|
|
249
|
+
create: createVetraStudioPlugin,
|
|
250
|
+
ui: () => import("./ui-C1-l-Eyh.js").then((m) => m.default),
|
|
251
|
+
whenAbsent: (config) => ({
|
|
252
|
+
...config,
|
|
253
|
+
app: {
|
|
254
|
+
...config.app,
|
|
255
|
+
studioMode: false
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
//#endregion
|
|
261
|
+
export { connectPlugins };
|
|
262
|
+
|
|
263
|
+
//# sourceMappingURL=plugins-CPd2_0eG.js.map
|
|
264
|
+
//# debugId=0ccc04d6-8b0f-5f9f-8b34-9b042041c765
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins-CPd2_0eG.js","sources":["../src/plugins/entry-config.ts","../src/plugins/assistant.ts","../src/plugins/generic.ts","../src/plugins/openpanel.ts","../src/plugins/sentry.ts","../src/plugins/ids.ts","../src/plugins/vetra-studio.ts","../src/plugins/workflows.ts","../src/plugins/index.ts"],"sourcesContent":["import { PluginError } from \"@powerhousedao/host-core/plugins\";\nimport { z } from \"zod\";\n\n/**\n * Validate a built-in plugin's entry config against its configSchema, the way\n * host-core's resolveHostPlugins does on the server: a failure names the\n * plugin and every offending key instead of surfacing a bare ZodError from\n * the runtime-config load.\n */\nexport function parseEntryConfig<S extends z.ZodType>(\n specifier: string,\n schema: S,\n rawConfig: unknown,\n): z.output<S> {\n const parsed = schema.safeParse(rawConfig);\n if (!parsed.success) {\n throw new PluginError(\n `config for Connect plugin \"${specifier}\" is invalid:\\n` +\n z.prettifyError(parsed.error),\n `Fix the entry's config in the host's runner.plugins.`,\n );\n }\n return parsed.data;\n}\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n assistantConfigSchema,\n type AssistantConfigInput,\n} from \"../plugin-configs/assistant.js\";\n\n/**\n * The Connect AI assistant (`@powerhousedao/connect/plugins/assistant`).\n * Presence flips `ai.assistantEnabled` on; absence forces it off. The\n * assistant FAB in app.tsx already renders on `ai.assistantEnabled`, so this\n * plugin's config shuffle is immediately visible in the UI.\n *\n * It takes no entry config: `ai.assistantEnabled` is the only key of the\n * `connect.ai` slice, and presence is that switch. The endpoint and agent are\n * user settings in the browser, not host config.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { assistantConfigSchema, type AssistantConfigInput };\n\nexport const createAssistantPlugin: ConnectPluginFactory = (rawConfig) => {\n parseEntryConfig(\n \"@powerhousedao/connect/plugins/assistant\",\n assistantConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-assistant\",\n appliesTo: \"connect\",\n configSchema: assistantConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n ai: { ...served.ai, assistantEnabled: true },\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createAssistantPlugin;\n","import { DEFAULT_CONNECT_CONFIG } from \"@powerhousedao/shared/connect\";\nimport type {\n PHBackground,\n PHConnectExplorerIcons,\n PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n genericConfigSchema,\n type GenericConfig,\n type GenericConfigInput,\n} from \"../plugin-configs/generic.js\";\n\n/**\n * The generic Connect shell plugin (`@powerhousedao/connect/plugins/generic`).\n *\n * It OWNS the drive-chrome UI toggles — `allowAddDrive` and the per-section\n * `sections.{remote,local}` switches (enabled / allowAdd / allowDelete) —\n * the explorer's `icons` (local/remote drive fallbacks, folder, document and\n * per-type document icons, which override the icons a package ships) and the\n * home screen's `homeBackground` (its layers over a page colour). These\n * describe nothing outside the generic chrome (connect.config.ts reads the\n * toggles to decide whether the add-drive affordance and the drive sections\n * render; the explorer components read the icons; the home screen is the\n * chrome's landing page), so under uniform runners they are configured HERE,\n * through this plugin's entry config, not as free-standing top-level\n * connect.drives / connect.home values:\n *\n * - present + entry provides a value -> that value\n * - present + entry omits it -> inherit DEFAULT_CONNECT_CONFIG\n * - absent from the composition -> zeroed off (see its whenAbsent\n * in ./index.ts — no chrome, no\n * toggles)\n *\n * The top-level served value is deliberately NOT a fallback: ownership means a\n * single source. `branding` is intentionally NOT handled here — it has reach\n * beyond the chrome (e.g. document.title), so it stays a Connect-level config\n * value that survives this plugin's absence.\n *\n * Icons and background images are image refs; a project path in host.js is\n * resolved to a data URI by the Connect build before the composition reaches\n * the browser, a URL or data URI passes through (the only forms for config\n * applied after the build). `null` keeps the built-in icon / gradient.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { genericConfigSchema, type GenericConfig, type GenericConfigInput };\n\nconst DEFAULT_DRIVES = DEFAULT_CONNECT_CONFIG.drives;\nconst DEFAULT_HOME = DEFAULT_CONNECT_CONFIG.home;\n\nexport const createGenericPlugin: ConnectPluginFactory = (rawConfig) => {\n const config: GenericConfig = parseEntryConfig(\n \"@powerhousedao/connect/plugins/generic\",\n genericConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-generic\",\n appliesTo: \"connect\",\n configSchema: genericConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n const entrySections = config.sections ?? {};\n return {\n ...served,\n drives: {\n ...served.drives,\n // Owned: entry value, else the single-source default — never the\n // served top-level value.\n allowAddDrive:\n config.allowAddDrive ?? DEFAULT_DRIVES?.allowAddDrive,\n sections: {\n remote: {\n ...DEFAULT_DRIVES?.sections?.remote,\n ...entrySections.remote,\n },\n local: {\n ...DEFAULT_DRIVES?.sections?.local,\n ...entrySections.local,\n },\n },\n // Owned: the entry's icons (already resolved by the build), else\n // the default — the built-in icons.\n icons: (config.icons ?? null) as PHConnectExplorerIcons | null,\n } as never,\n home: {\n ...served.home,\n // Owned: the entry's background (images resolved by the build),\n // else the default — the bundled gradient.\n background: (config.homeBackground ??\n DEFAULT_HOME?.background ??\n null) as PHBackground | null,\n },\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createGenericPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n openPanelConfigSchema,\n type OpenPanelConfigInput,\n} from \"../plugin-configs/openpanel.js\";\n\n/**\n * OpenPanel analytics (`@powerhousedao/connect/plugins/openpanel`). Presence\n * is activation: the entry config (clientId, trackUiEvents, trackOperations)\n * merges into the served `openPanel` block; absence clears the clientId and\n * turns tracking off. Config shuffle today; the Analytics/OpenPanel\n * components that consume it already live in the app tree.\n *\n * The entry config IS the `connect.openPanel` slice, so it is typed and\n * validated by that slice's single-source schema (a typo'd key fails).\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { openPanelConfigSchema, type OpenPanelConfigInput };\n\nexport const createOpenPanelPlugin: ConnectPluginFactory = (rawConfig) => {\n const config = parseEntryConfig(\n \"@powerhousedao/connect/plugins/openpanel\",\n openPanelConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-openpanel\",\n appliesTo: \"connect\",\n configSchema: openPanelConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n openPanel: { ...served.openPanel, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createOpenPanelPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n sentryConfigSchema,\n type SentryConfigInput,\n} from \"../plugin-configs/sentry.js\";\n\n/**\n * Sentry error reporting (`@powerhousedao/connect/plugins/sentry`). Presence\n * is activation: listing it merges the entry config (dsn, env, tracing) into\n * the served `sentry` block; omitting it nulls the dsn (see the absence\n * zeroing in plugin-host). A thin config shuffle today — the SentryProvider\n * that reads this slice already exists in the app.\n *\n * The entry config IS the `connect.sentry` slice, so it is typed and\n * validated by that slice's single-source schema (a typo'd key fails).\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { sentryConfigSchema, type SentryConfigInput };\n\nexport const createSentryPlugin: ConnectPluginFactory = (rawConfig) => {\n const config = parseEntryConfig(\n \"@powerhousedao/connect/plugins/sentry\",\n sentryConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-sentry\",\n appliesTo: \"connect\",\n configSchema: sentryConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n sentry: { ...served.sentry, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createSentryPlugin;\n","/** The generic shell: Connect's sidebar, home screen and settings tabs. */\nexport const GENERIC_PLUGIN = \"@powerhousedao/connect/plugins/generic\";\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n vetraStudioConfigSchema,\n type VetraStudioConfigInput,\n} from \"../plugin-configs/vetra-studio.js\";\n\n/**\n * Vetra Studio, browser side (`@powerhousedao/vetra-studio/connect`). Its\n * presence turns Connect's studio mode on; the classic `app.studioMode`\n * consumer paths run unchanged, and absence forces studio off (the zeroing in\n * plugin-host). Lives here, in Connect's own source, because the studio-mode\n * behaviour is Connect browser behaviour — the published vetra-studio/connect\n * module is only the server-resolvable identity of the same plugin.\n *\n * It takes no entry config: presence is the switch, and the rest of the\n * `connect.app` slice is Connect-level config, not this plugin's.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { vetraStudioConfigSchema, type VetraStudioConfigInput };\n\nexport const createVetraStudioPlugin: ConnectPluginFactory = (rawConfig) => {\n parseEntryConfig(\n \"@powerhousedao/vetra-studio/connect\",\n vetraStudioConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"vetra-studio-connect\",\n appliesTo: \"connect\",\n configSchema: vetraStudioConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n app: { ...served.app, studioMode: true },\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createVetraStudioPlugin;\n","import { findToken } from \"@powerhousedao/host-core/schema\";\nimport type {\n PHConnectDefaultDrive,\n PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n workflowsConnectConfigSchema,\n type WorkflowsConnectConfig,\n type WorkflowsConnectConfigInput,\n} from \"../plugin-configs/workflows.js\";\n\n/**\n * The workflows plugin, browser side (`@powerhousedao/connect/plugins/\n * workflows`) — the Connect half of the link whose server half is\n * `@powerhousedao/switchboard/plugins/workflows` (workflow-plugins plan).\n *\n * Presence is activation: listed, Connect loads the workflow package (so\n * Workflow Studio, the drive app the Workflows drive names as its preferred\n * editor, exists) and attaches the configured drive as a remote default\n * drive. Absent from a declared composition, `app.workflowsEnabled` is zeroed\n * (its whenAbsent in ./index.ts) — the classic `workflows.enabled` /\n * `connect.app.workflowsEnabled` values stop being the switch.\n *\n * `drive` is the switchboard's drive URL (`http://host:port/d/<slug>`). The\n * drive has to be a REMOTE of the switchboard that runs the workflow runtime:\n * Workflow Studio reaches that runtime through the selected drive's\n * switchboard, so a local copy would render the studio against the wrong\n * endpoint. Host files write it as the output token\n * `switchboard.drives.workflows.url`; `ph run` resolves it (from the\n * compound's live member or the switchboard's run record) before this\n * config reaches the browser.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport {\n workflowsConnectConfigSchema,\n type WorkflowsConnectConfig,\n type WorkflowsConnectConfigInput,\n};\n\nconst LOG = \"[connect:plugins:workflows]\";\n\nfunction withDrive(\n drives: PHConnectDefaultDrive[] | undefined,\n url: string,\n name: string | undefined,\n): PHConnectDefaultDrive[] {\n const existing = drives ?? [];\n if (existing.some((drive) => \"url\" in drive && drive.url === url)) {\n return existing;\n }\n return [...existing, { url, name: name ?? null, icon: null }];\n}\n\nexport const createWorkflowsPlugin: ConnectPluginFactory = (rawConfig) => {\n const config: WorkflowsConnectConfig = parseEntryConfig(\n \"@powerhousedao/connect/plugins/workflows\",\n workflowsConnectConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-workflows\",\n appliesTo: \"connect\",\n configSchema: workflowsConnectConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n const out: PHConnectRuntimeConfig = {\n ...served,\n app: { ...served.app, workflowsEnabled: true } as never,\n };\n const drive = config.drive;\n if (typeof drive === \"string\") {\n out.drives = {\n ...served.drives,\n defaultDrives: withDrive(\n served.drives?.defaultDrives,\n drive,\n config.name,\n ),\n } as never;\n } else if (drive !== undefined) {\n console.warn(\n `${LOG} drive is an unresolved output token (${findToken(drive)?.key ?? \"unknown\"}); no Workflows drive attached.`,\n );\n }\n return out;\n },\n },\n };\n return plugin;\n};\n\nexport default createWorkflowsPlugin;\n","import type { ConnectPluginDefinition } from \"@powerhousedao/connect-core/plugins\";\nimport createAssistantPlugin from \"./assistant.js\";\nimport createGenericPlugin from \"./generic.js\";\nimport createOpenPanelPlugin from \"./openpanel.js\";\nimport createSentryPlugin from \"./sentry.js\";\nimport { GENERIC_PLUGIN } from \"./ids.js\";\nimport createVetraStudioPlugin from \"./vetra-studio.js\";\nimport createWorkflowsPlugin from \"./workflows.js\";\n\nexport { GENERIC_PLUGIN };\n\n// Sentry and OpenPanel start only once the viewer accepts analytics cookies.\nconst ANALYTICS_CONSENT = { consent: true };\n\n// Each built-in zeroes the config slice it owns when a composition leaves it out.\nconst driveSectionOff = { enabled: false, allowAdd: false, allowDelete: false };\n\n/** Connect's built-in plugins, by the specifier a composition names. */\nexport const connectPlugins: Record<string, ConnectPluginDefinition> = {\n [GENERIC_PLUGIN]: {\n create: createGenericPlugin,\n ui: () => import(\"../generic/ui.js\").then((m) => m.default),\n shell: \"generic\",\n // The drive-chrome toggles, explorer icons and home screen go: no\n // add-drive affordance, the sections off, built-in icons, no home\n // background. Branding is not zeroed: it is Connect-level and outlives\n // the plugin.\n whenAbsent: (config) => ({\n ...config,\n drives: {\n ...config.drives,\n allowAddDrive: false,\n sections: { remote: driveSectionOff, local: driveSectionOff },\n icons: null,\n } as never,\n home: { ...config.home, background: null } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/sentry\": {\n create: createSentryPlugin,\n ui: () => Promise.resolve(ANALYTICS_CONSENT),\n whenAbsent: (config) => ({\n ...config,\n sentry: { ...config.sentry, dsn: null } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/openpanel\": {\n create: createOpenPanelPlugin,\n ui: () => Promise.resolve(ANALYTICS_CONSENT),\n whenAbsent: (config) => ({\n ...config,\n openPanel: {\n ...config.openPanel,\n clientId: \"\",\n trackUiEvents: false,\n trackOperations: false,\n } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/assistant\": {\n create: createAssistantPlugin,\n whenAbsent: (config) => ({\n ...config,\n ai: { ...config.ai, assistantEnabled: false } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/workflows\": {\n create: createWorkflowsPlugin,\n // The workflow package (Workflow Studio) loads only when the plugin is\n // composed in; the classic workflows.enabled value is not the switch.\n whenAbsent: (config) => ({\n ...config,\n app: { ...config.app, workflowsEnabled: false } as never,\n }),\n },\n \"@powerhousedao/vetra-studio/connect\": {\n create: createVetraStudioPlugin,\n // Studio sign-in (#studio-sign-in=<bearer>), for agents.\n ui: () => import(\"./vetra-studio/ui.js\").then((m) => m.default),\n whenAbsent: (config) => ({\n ...config,\n app: { ...config.app, studioMode: false } as never,\n }),\n },\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AASA,SAAgB,iBACd,WACA,QACA,WACa;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34-9b042041c765"}
|
|
@@ -1,27 +1,8 @@
|
|
|
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 { r as connectConfig } from "./connect.config-
|
|
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]="12ffe631-da25-51c9-9b9b-215cb5ec2a2e")}catch(e){}}();
|
|
3
|
+
import { r as connectConfig } from "./connect.config-DL9nKtlW.js";
|
|
4
4
|
import { useSyncExternalStore } from "react";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Detects whether Connect is being rendered inside another app (e.g. inside
|
|
8
|
-
* an iframe in the vetra-cli drive editor). When `?embed=1` is present in the
|
|
9
|
-
* URL, chrome that doesn't make sense in the embedded context — the cookie
|
|
10
|
-
* banner, the outer sidebar — is suppressed.
|
|
11
|
-
*/
|
|
12
|
-
function getIsEmbedded() {
|
|
13
|
-
if (typeof window === "undefined") return false;
|
|
14
|
-
try {
|
|
15
|
-
const value = new URLSearchParams(window.location.search).get("embed");
|
|
16
|
-
return value !== null && value !== "0" && value !== "false";
|
|
17
|
-
} catch {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function useIsEmbedded() {
|
|
22
|
-
return getIsEmbedded();
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
5
|
+
import { getIsEmbedded } from "@powerhousedao/connect-core/embedded";
|
|
25
6
|
//#region src/hooks/preferences-store.ts
|
|
26
7
|
const namespace = connectConfig.routerBasename;
|
|
27
8
|
/**
|
|
@@ -98,7 +79,7 @@ const useCookieBanner = () => {
|
|
|
98
79
|
return [useSyncExternalStore(subscribeBannerShown, getBannerShown, getBannerShown), setBannerShown];
|
|
99
80
|
};
|
|
100
81
|
//#endregion
|
|
101
|
-
export {
|
|
82
|
+
export { useAcceptedCookies as n, useCookieBanner as r, setBannerShown as t };
|
|
102
83
|
|
|
103
|
-
//# sourceMappingURL=preferences-store-
|
|
104
|
-
//# debugId=
|
|
84
|
+
//# sourceMappingURL=preferences-store-DxYAnGCc.js.map
|
|
85
|
+
//# debugId=12ffe631-da25-51c9-9b9b-215cb5ec2a2e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preferences-store-DxYAnGCc.js","sources":["../src/hooks/preferences-store.ts"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\nimport { useSyncExternalStore } from \"react\";\n\nimport { getIsEmbedded } from \"@powerhousedao/connect-core/embedded\";\n\nconst namespace = connectConfig.routerBasename;\n\n/**\n * Block-proof home for Connect's consent and banner state.\n *\n * The file name deliberately avoids words that appear in ad-blocker\n * filter lists (cookie, banner, consent, analytics, ...). Modules in the\n * app's critical import chain import from here, never from files whose\n * URLs match those filters. If an ad blocker blocks the lazy-loaded\n * cookie-banner chunk instead, the app simply never shows the banner —\n * which leaves the flags at their rejected defaults (analytics off) —\n * and everything else keeps working.\n */\n\n// ---------------------------------------------------------------------------\n// Accepted cookies (analytics / marketing / functional)\n// ---------------------------------------------------------------------------\n\nexport const ACCEPTED_COOKIES_KEY_STORAGE = `${namespace}:acceptedCookies`;\n\nexport interface AcceptedCookies {\n analytics: boolean;\n marketing: boolean;\n functional: boolean;\n}\n\nconst REJECTED_COOKIES: AcceptedCookies = {\n analytics: false,\n marketing: false,\n functional: false,\n};\n\nconst cookieListeners = new Set<() => void>();\n\nlet acceptedCookies: AcceptedCookies = getInitialAcceptedCookies();\n\nfunction getInitialAcceptedCookies(): AcceptedCookies {\n try {\n const value = localStorage.getItem(ACCEPTED_COOKIES_KEY_STORAGE);\n return value ? (JSON.parse(value) as AcceptedCookies) : REJECTED_COOKIES;\n } catch {\n return REJECTED_COOKIES;\n }\n}\n\nfunction subscribeAcceptedCookies(fn: () => void) {\n cookieListeners.add(fn);\n return () => {\n cookieListeners.delete(fn);\n };\n}\n\nfunction getAcceptedCookies(): AcceptedCookies {\n return acceptedCookies;\n}\n\nexport function setAcceptedCookies(\n setter: (prev: AcceptedCookies) => AcceptedCookies,\n) {\n acceptedCookies = setter(acceptedCookies);\n localStorage.setItem(\n ACCEPTED_COOKIES_KEY_STORAGE,\n JSON.stringify(acceptedCookies),\n );\n cookieListeners.forEach((fn) => fn());\n}\n\nexport const useAcceptedCookies = () => {\n const cookies = useSyncExternalStore(\n subscribeAcceptedCookies,\n getAcceptedCookies,\n getAcceptedCookies,\n );\n return [cookies, setAcceptedCookies] as const;\n};\n\n// ---------------------------------------------------------------------------\n// Cookie banner visibility\n// ---------------------------------------------------------------------------\n\nexport const COOKIE_BANNER_KEY_STORAGE = `${namespace}:display-cookie-banner`;\n\nconst bannerListeners = new Set<() => void>();\n\nlet bannerShown = getInitialBannerShown();\n\nfunction getInitialBannerShown(): boolean {\n if (getIsEmbedded()) return false;\n try {\n const value = localStorage.getItem(COOKIE_BANNER_KEY_STORAGE);\n return value !== \"false\";\n } catch (error) {\n console.error(error);\n return true;\n }\n}\n\nfunction subscribeBannerShown(fn: () => void) {\n bannerListeners.add(fn);\n return () => {\n bannerListeners.delete(fn);\n };\n}\n\nfunction getBannerShown(): boolean {\n return bannerShown;\n}\n\nexport function setBannerShown(state: boolean) {\n bannerShown = state;\n localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));\n bannerListeners.forEach((fn) => fn());\n}\n\nexport const useCookieBanner = () => {\n const shown = useSyncExternalStore(\n subscribeBannerShown,\n getBannerShown,\n getBannerShown,\n );\n return [shown, setBannerShown] as const;\n};\n"],"names":[],"mappings":";;;;;;AAKA,MAAM,YAAY,cAAc;;;;;;;;;;;;AAkBhC,MAAa,+BAA+B,GAAG,UA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A,gBACA,cAEU,GAAG,cAAc;AAC/B","debug_id":"12ffe631-da25-51c9-9b9b-215cb5ec2a2e"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/prerender/app-shell.d.ts
|
|
2
|
+
/** `generic`: Connect's chrome. `core`: core's views. `project`: a project's routes. */
|
|
3
|
+
type AppShellKind = "generic" | "core" | "project";
|
|
4
|
+
/** Rendered where the app's name goes. */
|
|
5
|
+
export declare const APP_NAME_TOKEN = "__PH_SHELL_APP_NAME__";
|
|
6
|
+
/** The rendered shell as #root's static markup: no scripts or title, images as
|
|
7
|
+
* boxes, the app's name delimited. */
|
|
8
|
+
export declare function shellMarkup(rendered: string): string;
|
|
9
|
+
/** #root's markup and <head>'s critical CSS (`css`, see shellCss) and guard.
|
|
10
|
+
* `variant` names it for a server that swaps it. */
|
|
11
|
+
export declare function appShell(kind: AppShellKind, variant: "generic" | "core", markup: string, css: string): {
|
|
12
|
+
body: string;
|
|
13
|
+
head: string;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/prerender/shell-css.d.ts
|
|
17
|
+
/** `entry`, a Tailwind stylesheet (its text `css` when given), built for the
|
|
18
|
+
* classes in `markup` only: its tokens, reset and rules, without third-party CSS. */
|
|
19
|
+
export declare function shellCss(entry: string, markup: string, css?: string): Promise<string>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/prerender/shell.d.ts
|
|
22
|
+
/** Each prerendered shell's plugin, whose presence in a composition picks it; core's has none. */
|
|
23
|
+
export declare function shellPlugins(): Promise<Partial<Record<ShellVariant, string>>>;
|
|
24
|
+
/** `generic`: Connect's chrome. `core`: core's views, for a composition without the generic plugin. */
|
|
25
|
+
export type ShellVariant = "generic" | "core";
|
|
26
|
+
/** Renders the route tree at `/` before the reactor is up. `kind` picks the
|
|
27
|
+
* loader: Connect's logo for its chrome, core's spinner otherwise. */
|
|
28
|
+
export declare function renderShell(variant?: ShellVariant, kind?: AppShellKind): Promise<string>;
|
|
29
|
+
/** A project's shells, one per variant: its route tree rendered at `/`, with
|
|
30
|
+
* CSS that `stylesheet`, its Tailwind entry (text `css`), builds for the markup's classes. */
|
|
31
|
+
export declare function renderProjectShells(stylesheet: string, css?: string): Promise<Partial<Record<ShellVariant, {
|
|
32
|
+
body: string;
|
|
33
|
+
head: string;
|
|
34
|
+
}>>>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export type { AppShellKind };
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=prerender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prerender.d.ts","names":[],"sources":["../src/prerender/app-shell.ts","../src/prerender/shell-css.ts","../src/prerender/shell.tsx"],"mappings":";;KAMY;;qBAGC;;;wBA8DG,YAAY;;;wBAYZ,SACd,MAAM,cACN,6BACA,gBACA;EAME;EAGA;;;;;;wBCnEkB,SACpB,eACA,gBACA,eAAiC;;;;wBCUb,gBAAgB,QACpC,QAAQ,OAAO;;YAUL;;;wBAMU,YACpB,UAAS,cACT,OAAM,eACL;;;wBA2EmB,oBAAoB,oBAAoB,eAAY,QAAA,QAAA,OAAA;EACrB;EAAc"}
|
|
@@ -0,0 +1,195 @@
|
|
|
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]="b14c6d0e-8f4f-5f75-be86-cfd57859628f")}catch(e){}}();
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { primeRuntimeConfig } from "@powerhousedao/connect-core/runtime-config";
|
|
5
|
+
import { PHStoreProvider, createPHStore } from "@powerhousedao/reactor-browser";
|
|
6
|
+
import { RouterProvider, createMemoryHistory } from "@tanstack/react-router";
|
|
7
|
+
import { Icon } from "@powerhousedao/design-system";
|
|
8
|
+
import { DEFAULT_CONNECT_CONFIG } from "@powerhousedao/shared/connect";
|
|
9
|
+
import { getConnectPluginUi, loadConnectPluginUi, registerConnectPlugins, resetConnectPluginUi } from "@powerhousedao/connect-core/plugins";
|
|
10
|
+
import { prerender } from "react-dom/static";
|
|
11
|
+
import { compile, optimize } from "@tailwindcss/node";
|
|
12
|
+
import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
|
|
13
|
+
import { tmpdir } from "node:os";
|
|
14
|
+
import { dirname, join } from "node:path";
|
|
15
|
+
//#region src/prerender/app-shell.ts
|
|
16
|
+
/** The marker boot.tsx and the project build look for. */
|
|
17
|
+
const SHELL_MARKER = "data-ph-shell";
|
|
18
|
+
/** Rendered where the app's name goes. */
|
|
19
|
+
const APP_NAME_TOKEN = "__PH_SHELL_APP_NAME__";
|
|
20
|
+
const APP_NAME_REGION = "<!--ph-shell:app-name-->Connect<!--/ph-shell:app-name-->";
|
|
21
|
+
const GUARD_SCRIPT = "(function(){try{var h=document.documentElement;var e=new URLSearchParams(location.search).get('embed');if(e!==null&&e!=='0'&&e!=='false')h.classList.add('ph-shell-embed');var p=location.pathname;if(!/\\/$/.test(p)||/\\/d\\//.test(p))h.classList.add('ph-shell-route')}catch(x){}})();";
|
|
22
|
+
const CURRENT_GUARD_SCRIPT = `(function(){if(!document.documentElement.classList.contains('ph-shell-route'))return;document.querySelectorAll('[${SHELL_MARKER}] [aria-current]').forEach(function(e){e.removeAttribute('aria-current');e.classList.remove('active')})})();`;
|
|
23
|
+
const LOADER_CSS = "@keyframes ph-shell-loader-in{from{opacity:0}to{opacity:1}}.ph-shell-loader{animation:ph-shell-loader-in .2s ease-in both;animation-delay:calc(.25s + var(--ph-shell-t,0ms))}.ph-shell-loader>*{animation-delay:var(--ph-shell-t,0ms)}";
|
|
24
|
+
const ROUTE_GUARD = `.ph-shell-route [${SHELL_MARKER}] #content-view{visibility:hidden}`;
|
|
25
|
+
const GUARD_CSS = {
|
|
26
|
+
generic: `.ph-shell-embed [${SHELL_MARKER}] #sidebar{display:none}` + ROUTE_GUARD + LOADER_CSS,
|
|
27
|
+
core: `.ph-shell-embed [${SHELL_MARKER}] header{display:none}[${SHELL_MARKER}] header button{visibility:hidden}@keyframes ph-shell-loader-in{from{opacity:0}to{opacity:1}}.ph-shell-loader{animation:ph-shell-loader-in .2s ease-in both;animation-delay:calc(.25s + var(--ph-shell-t,0ms))}.ph-shell-loader>*{animation-delay:var(--ph-shell-t,0ms)}`,
|
|
28
|
+
project: ROUTE_GUARD + LOADER_CSS
|
|
29
|
+
};
|
|
30
|
+
function replaceInlineImages(html) {
|
|
31
|
+
return html.replace(/<img\b[^>]*\bsrc="data:[^"]*"[^>]*>/g, (img) => {
|
|
32
|
+
const attr = (name) => new RegExp(`\\b${name}="([^"]*)"`).exec(img)?.[1];
|
|
33
|
+
if (/(^| )hidden( |$)/.test(attr("class") ?? "")) return "";
|
|
34
|
+
const width = attr("width");
|
|
35
|
+
const height = attr("height");
|
|
36
|
+
return `<span style="display:inline-block;${`${width ? `width:${width}px;` : ""}${height ? `height:${height}px;` : ""}`}"></span>`;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/** The rendered shell as #root's static markup: no scripts or title, images as
|
|
40
|
+
* boxes, the app's name delimited. */
|
|
41
|
+
function shellMarkup(rendered) {
|
|
42
|
+
return replaceInlineImages(rendered.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g, "").replace(/<title\b[^>]*>[\s\S]*?<\/title>/g, "")).replaceAll(APP_NAME_TOKEN, APP_NAME_REGION);
|
|
43
|
+
}
|
|
44
|
+
/** #root's markup and <head>'s critical CSS (`css`, see shellCss) and guard.
|
|
45
|
+
* `variant` names it for a server that swaps it. */
|
|
46
|
+
function appShell(kind, variant, markup, css) {
|
|
47
|
+
const guard = GUARD_CSS[kind];
|
|
48
|
+
const marker = `${SHELL_MARKER}="${variant}"`;
|
|
49
|
+
return {
|
|
50
|
+
body: `<div ${marker} inert style="display:contents">${markup}</div><script ${marker}>${CURRENT_GUARD_SCRIPT}<\/script>`,
|
|
51
|
+
head: `<style ${marker}>${css}${guard}</style><script ${marker}>${GUARD_SCRIPT}<\/script>`
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/prerender/shell-css.ts
|
|
56
|
+
let emptyFile;
|
|
57
|
+
const empty = () => {
|
|
58
|
+
if (!emptyFile) {
|
|
59
|
+
emptyFile = join(mkdtempSync(join(tmpdir(), "ph-shell-")), "empty.css");
|
|
60
|
+
writeFileSync(emptyFile, "");
|
|
61
|
+
}
|
|
62
|
+
return emptyFile;
|
|
63
|
+
};
|
|
64
|
+
const isVendor = (id) => id.endsWith("/vendor.css") || !(id.startsWith(".") || id.startsWith("/") || id.startsWith("tailwindcss") || id.startsWith("@powerhousedao/"));
|
|
65
|
+
const CLASS_ATTRIBUTE = /\sclass="([^"]*)"/g;
|
|
66
|
+
/** `entry`, a Tailwind stylesheet (its text `css` when given), built for the
|
|
67
|
+
* classes in `markup` only: its tokens, reset and rules, without third-party CSS. */
|
|
68
|
+
async function shellCss(entry, markup, css = readFileSync(entry, "utf8")) {
|
|
69
|
+
const compiler = await compile(css, {
|
|
70
|
+
base: dirname(entry),
|
|
71
|
+
from: entry,
|
|
72
|
+
onDependency: () => {},
|
|
73
|
+
customCssResolver: (id) => Promise.resolve(isVendor(id) ? empty() : void 0)
|
|
74
|
+
});
|
|
75
|
+
const classes = new Set([...markup.matchAll(CLASS_ATTRIBUTE)].flatMap((m) => m[1].split(/\s+/)));
|
|
76
|
+
const built = compiler.build([...classes].filter(Boolean));
|
|
77
|
+
return optimize(built, {
|
|
78
|
+
file: entry,
|
|
79
|
+
minify: true
|
|
80
|
+
}).code;
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/prerender/shell-loader.tsx
|
|
84
|
+
/** Class of the shell's loader; scripts/prerender-shell.ts fades it in. */
|
|
85
|
+
const SHELL_LOADER_CLASS = "ph-shell-loader";
|
|
86
|
+
function ShellLoader() {
|
|
87
|
+
return /* @__PURE__ */ jsx("div", {
|
|
88
|
+
role: "status",
|
|
89
|
+
"aria-label": "Starting Connect",
|
|
90
|
+
className: `${SHELL_LOADER_CLASS} pointer-events-none fixed inset-0 z-10 flex items-center justify-center`,
|
|
91
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
92
|
+
"data-ph-loader-slot": "",
|
|
93
|
+
className: "animate-pulse rounded-full bg-background p-4 text-foreground shadow-lg motion-reduce:animate-none",
|
|
94
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
95
|
+
name: "ConnectSmall",
|
|
96
|
+
size: 40
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function CoreShellLoader() {
|
|
102
|
+
return /* @__PURE__ */ jsx("div", {
|
|
103
|
+
role: "status",
|
|
104
|
+
"aria-label": "Starting",
|
|
105
|
+
className: `${SHELL_LOADER_CLASS} pointer-events-none fixed inset-0 z-10 flex items-center justify-center`,
|
|
106
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
107
|
+
"data-ph-loader-slot": "",
|
|
108
|
+
className: "size-5 animate-spin rounded-full border-2 border-core-border border-t-core-muted motion-reduce:animate-none"
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/prerender/shell.tsx
|
|
114
|
+
async function loadDefaultConfig(variant) {
|
|
115
|
+
primeRuntimeConfig({ connect: {
|
|
116
|
+
...DEFAULT_CONNECT_CONFIG,
|
|
117
|
+
composition: variant === "core" ? [] : void 0
|
|
118
|
+
} });
|
|
119
|
+
registerConnectPlugins(connectPlugins);
|
|
120
|
+
const plugin = (await shellPlugins())[variant];
|
|
121
|
+
await loadConnectPluginUi(plugin ? [{ module: plugin }] : []);
|
|
122
|
+
}
|
|
123
|
+
const connectPlugins = () => import("./plugins-CPd2_0eG.js").then((m) => m.connectPlugins);
|
|
124
|
+
/** Each prerendered shell's plugin, whose presence in a composition picks it; core's has none. */
|
|
125
|
+
async function shellPlugins() {
|
|
126
|
+
return Object.fromEntries(Object.entries(await connectPlugins()).flatMap(([module, definition]) => definition.shell ? [[definition.shell, module]] : []));
|
|
127
|
+
}
|
|
128
|
+
/** Renders the route tree at `/` before the reactor is up. `kind` picks the
|
|
129
|
+
* loader: Connect's logo for its chrome, core's spinner otherwise. */
|
|
130
|
+
async function renderShell(variant = "generic", kind = variant) {
|
|
131
|
+
await loadDefaultConfig(variant);
|
|
132
|
+
const [{ routeTree }, { RouterChrome }, routerModule, skeleton] = await Promise.all([
|
|
133
|
+
import("@powerhousedao/connect/route-tree"),
|
|
134
|
+
import("./route-views-C-H3ofJW.js"),
|
|
135
|
+
import("@powerhousedao/connect-core/router"),
|
|
136
|
+
import("./app-skeleton-CdD1m8G3.js")
|
|
137
|
+
]);
|
|
138
|
+
const store = createPHStore();
|
|
139
|
+
delete globalThis.__TSR_CACHE__;
|
|
140
|
+
const connectRouter = routerModule.createConnectRouter({
|
|
141
|
+
routeTree,
|
|
142
|
+
store,
|
|
143
|
+
history: createMemoryHistory({ initialEntries: ["/"] }),
|
|
144
|
+
InnerWrap: RouterChrome,
|
|
145
|
+
appName: APP_NAME_TOKEN,
|
|
146
|
+
shell: kind === "project",
|
|
147
|
+
pluginUi: getConnectPluginUi()
|
|
148
|
+
});
|
|
149
|
+
routerModule.bindConnectRouter(connectRouter, store);
|
|
150
|
+
await connectRouter.router.load();
|
|
151
|
+
const { appRoute } = routerModule.connectRoutes(routeTree);
|
|
152
|
+
const layoutPending = appRoute.options.pendingComponent;
|
|
153
|
+
const Loader = kind === "generic" ? ShellLoader : kind === "project" && layoutPending ? () => null : CoreShellLoader;
|
|
154
|
+
const errors = [];
|
|
155
|
+
const causes = [];
|
|
156
|
+
skeleton.setPrerenderingCustomShell(kind === "project");
|
|
157
|
+
let prelude;
|
|
158
|
+
try {
|
|
159
|
+
({prelude} = await prerender(/* @__PURE__ */ jsxs(PHStoreProvider, {
|
|
160
|
+
store,
|
|
161
|
+
children: [/* @__PURE__ */ jsx(RouterProvider, { router: connectRouter.router }), /* @__PURE__ */ jsx(Loader, {})]
|
|
162
|
+
}), {
|
|
163
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY,
|
|
164
|
+
onError: (error, info) => {
|
|
165
|
+
errors.push(error);
|
|
166
|
+
causes.push(describeRenderError(error, info?.componentStack));
|
|
167
|
+
}
|
|
168
|
+
}));
|
|
169
|
+
} finally {
|
|
170
|
+
skeleton.setPrerenderingCustomShell(false);
|
|
171
|
+
}
|
|
172
|
+
resetConnectPluginUi(routeTree);
|
|
173
|
+
if (errors.length) throw new AggregateError(errors, `The app shell failed to prerender:\n${causes.join("\n")}`);
|
|
174
|
+
return await new Response(prelude).text();
|
|
175
|
+
}
|
|
176
|
+
/** A project's shells, one per variant: its route tree rendered at `/`, with
|
|
177
|
+
* CSS that `stylesheet`, its Tailwind entry (text `css`), builds for the markup's classes. */
|
|
178
|
+
async function renderProjectShells(stylesheet, css) {
|
|
179
|
+
const shells = {};
|
|
180
|
+
for (const variant of ["generic", "core"]) {
|
|
181
|
+
const markup = shellMarkup(await renderShell(variant, "project"));
|
|
182
|
+
shells[variant] = appShell("project", variant, markup, await shellCss(stylesheet, markup, css));
|
|
183
|
+
}
|
|
184
|
+
return shells;
|
|
185
|
+
}
|
|
186
|
+
function describeRenderError(error, componentStack) {
|
|
187
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
188
|
+
const component = componentStack?.trim().split("\n")[0]?.trim();
|
|
189
|
+
return ` - ${message}${component ? ` (${component})` : ""}`;
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
export { APP_NAME_TOKEN, appShell, renderProjectShells, renderShell, shellCss, shellMarkup, shellPlugins };
|
|
193
|
+
|
|
194
|
+
//# sourceMappingURL=prerender.js.map
|
|
195
|
+
//# debugId=b14c6d0e-8f4f-5f75-be86-cfd57859628f
|