@powerhousedao/connect-core 6.2.3-dev.79 → 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.
Files changed (47) hide show
  1. package/dist/backend-auth-gate-DNKg_v4Y.js +65 -0
  2. package/dist/backend-auth-gate-DNKg_v4Y.js.map +1 -0
  3. package/dist/backend-auth-gate-DiFpY5rt.d.ts +19 -0
  4. package/dist/backend-auth-gate-DiFpY5rt.d.ts.map +1 -0
  5. package/dist/{index-r46ba0Kx.d.ts → index-BMlma368.d.ts} +23 -3
  6. package/dist/{index-r46ba0Kx.d.ts.map → index-BMlma368.d.ts.map} +1 -1
  7. package/dist/{index-DQ0nbYne.d.ts → index-Beqvfchq.d.ts} +16 -3
  8. package/dist/index-Beqvfchq.d.ts.map +1 -0
  9. package/dist/index.d.ts +4 -3
  10. package/dist/index.js +8 -7
  11. package/dist/{plugin-host-D_EW56IQ.js → plugin-host-CMr7lN40.js} +2 -2
  12. package/dist/{plugin-host-D_EW56IQ.js.map → plugin-host-CMr7lN40.js.map} +1 -1
  13. package/dist/{plugin-ui-fDXhKTCK.js → plugin-ui-DHlnXJmN.js} +3 -3
  14. package/dist/{plugin-ui-fDXhKTCK.js.map → plugin-ui-DHlnXJmN.js.map} +1 -1
  15. package/dist/plugins.js +2 -2
  16. package/dist/route-tree-D0aszMrk.js.map +1 -1
  17. package/dist/{router-wVNdTI-Y.js → router-C4hDJ4_J.js} +2 -2
  18. package/dist/{router-wVNdTI-Y.js.map → router-C4hDJ4_J.js.map} +1 -1
  19. package/dist/router.js +2 -2
  20. package/dist/{runtime-BUG9vT2E.js → runtime-D20_LlB_.js} +47 -9
  21. package/dist/runtime-D20_LlB_.js.map +1 -0
  22. package/dist/runtime-config-D3YPhYyj.d.ts.map +1 -1
  23. package/dist/runtime-config.js +11 -5
  24. package/dist/runtime-config.js.map +1 -1
  25. package/dist/{runtime-flag-Bp6QasS8.js → runtime-flag-DvxW_SD4.js} +2 -2
  26. package/dist/{runtime-flag-Bp6QasS8.js.map → runtime-flag-DvxW_SD4.js.map} +1 -1
  27. package/dist/runtime.d.ts +3 -2
  28. package/dist/runtime.js +4 -3
  29. package/dist/{views-Ba9OeN3c.js → views-BtUVboYl.js} +78 -5
  30. package/dist/views-BtUVboYl.js.map +1 -0
  31. package/dist/views.d.ts +3 -2
  32. package/dist/views.js +3 -2
  33. package/package.json +8 -8
  34. package/src/router/modals.tsx +3 -3
  35. package/src/runtime/app-reactor-client.ts +63 -12
  36. package/src/runtime/backend-auth-gate.ts +57 -0
  37. package/src/runtime/drive-relist.ts +18 -0
  38. package/src/runtime/index.ts +3 -0
  39. package/src/runtime/runtime-config.ts +12 -1
  40. package/src/views/backend-auth-gate.tsx +76 -0
  41. package/src/views/directory-listing.tsx +2 -2
  42. package/src/views/editor-host.tsx +3 -3
  43. package/src/views/index.ts +5 -0
  44. package/src/views/layout.tsx +6 -2
  45. package/dist/index-DQ0nbYne.d.ts.map +0 -1
  46. package/dist/runtime-BUG9vT2E.js.map +0 -1
  47. package/dist/views-Ba9OeN3c.js.map +0 -1
@@ -0,0 +1,65 @@
1
+ import { setBackendAuth, useBackendAuth, useUser } from "@powerhousedao/reactor-browser";
2
+ import { useEffect, useRef } from "react";
3
+ import { logger } from "document-model";
4
+ //#region src/runtime/drive-relist.ts
5
+ /**
6
+ * Lists the app's drives again: `app-reactor-client` registers how when it
7
+ * loads, which boot does before anything can ask.
8
+ *
9
+ * The backend auth gate calls through here rather than importing the client:
10
+ * the client reaches the runtime config, which loads the plugin UI and with
11
+ * it core's views, and the gate is one of those views.
12
+ */
13
+ let relist;
14
+ function setDriveRelister(fn) {
15
+ relist = fn;
16
+ }
17
+ /** Nothing to do before the client registered: boot lists the drives itself. */
18
+ function relistDrives() {
19
+ return relist ? relist() : Promise.resolve();
20
+ }
21
+ //#endregion
22
+ //#region src/runtime/backend-auth-gate.ts
23
+ /**
24
+ * The gate decision for the app's backend: "login" when the backend refused
25
+ * an anonymous caller, "unauthorized" when it refused a signed-in one.
26
+ *
27
+ * A change of identity after the refusal (a sign-in landing, a sign-out)
28
+ * clears it and lists the drives again as the new caller; a refusal that
29
+ * stands is recorded afresh by that listing. The caller a refusal was seen
30
+ * for is kept in a ref rather than an effect cleanup: StrictMode runs
31
+ * cleanups on its simulated unmount at mount, which cleared a refusal
32
+ * recorded during boot before the root ever rendered the gate.
33
+ */
34
+ function useBackendAuthGate() {
35
+ const refusal = useBackendAuth();
36
+ const address = useUser()?.address;
37
+ const refusedAt = refusal?.at;
38
+ const refusedAs = useRef(void 0);
39
+ useEffect(() => {
40
+ if (!refusedAt) {
41
+ refusedAs.current = void 0;
42
+ return;
43
+ }
44
+ const seen = refusedAs.current;
45
+ if (seen?.at !== refusedAt) {
46
+ refusedAs.current = {
47
+ at: refusedAt,
48
+ address
49
+ };
50
+ return;
51
+ }
52
+ if (seen.address === address) return;
53
+ refusedAs.current = void 0;
54
+ setBackendAuth(void 0);
55
+ relistDrives().catch((error) => {
56
+ logger.warn("Could not list the drives again after the identity changed: @error", error);
57
+ });
58
+ }, [address, refusedAt]);
59
+ if (!refusal) return null;
60
+ return address ? "unauthorized" : "login";
61
+ }
62
+ //#endregion
63
+ export { setDriveRelister as n, useBackendAuthGate as t };
64
+
65
+ //# sourceMappingURL=backend-auth-gate-DNKg_v4Y.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-auth-gate-DNKg_v4Y.js","names":[],"sources":["../src/runtime/drive-relist.ts","../src/runtime/backend-auth-gate.ts"],"sourcesContent":["/**\n * Lists the app's drives again: `app-reactor-client` registers how when it\n * loads, which boot does before anything can ask.\n *\n * The backend auth gate calls through here rather than importing the client:\n * the client reaches the runtime config, which loads the plugin UI and with\n * it core's views, and the gate is one of those views.\n */\nlet relist: (() => Promise<void>) | undefined;\n\nexport function setDriveRelister(fn: () => Promise<void>): void {\n relist = fn;\n}\n\n/** Nothing to do before the client registered: boot lists the drives itself. */\nexport function relistDrives(): Promise<void> {\n return relist ? relist() : Promise.resolve();\n}\n","import {\n setBackendAuth,\n useBackendAuth,\n useUser,\n} from \"@powerhousedao/reactor-browser\";\nimport { logger } from \"document-model\";\nimport { useEffect, useRef } from \"react\";\nimport { relistDrives } from \"./drive-relist.js\";\n\n/** What the gate shows: nothing, a sign-in, or a \"not allowed\" notice. */\nexport type BackendAuthGateMode = \"login\" | \"unauthorized\" | null;\n\n/**\n * The gate decision for the app's backend: \"login\" when the backend refused\n * an anonymous caller, \"unauthorized\" when it refused a signed-in one.\n *\n * A change of identity after the refusal (a sign-in landing, a sign-out)\n * clears it and lists the drives again as the new caller; a refusal that\n * stands is recorded afresh by that listing. The caller a refusal was seen\n * for is kept in a ref rather than an effect cleanup: StrictMode runs\n * cleanups on its simulated unmount at mount, which cleared a refusal\n * recorded during boot before the root ever rendered the gate.\n */\nexport function useBackendAuthGate(): BackendAuthGateMode {\n const refusal = useBackendAuth();\n const user = useUser();\n const address = user?.address;\n const refusedAt = refusal?.at;\n const refusedAs = useRef<{ at: string; address: string | undefined }>(\n undefined,\n );\n useEffect(() => {\n if (!refusedAt) {\n refusedAs.current = undefined;\n return;\n }\n const seen = refusedAs.current;\n if (seen?.at !== refusedAt) {\n refusedAs.current = { at: refusedAt, address };\n return;\n }\n if (seen.address === address) return;\n refusedAs.current = undefined;\n setBackendAuth(undefined);\n relistDrives().catch((error: unknown) => {\n logger.warn(\n \"Could not list the drives again after the identity changed: @error\",\n error,\n );\n });\n }, [address, refusedAt]);\n if (!refusal) return null;\n // A 403 for a signed-in user is final until they switch account; a 401 for\n // a signed-in user means the token did not reach the backend yet (a stale\n // boot), which signing in again also fixes.\n return address ? \"unauthorized\" : \"login\";\n}\n"],"mappings":";;;;;;;;;;;;AAQA,IAAI;AAEJ,SAAgB,iBAAiB,IAA+B;CAC9D,SAAS;AACX;;AAGA,SAAgB,eAA8B;CAC5C,OAAO,SAAS,OAAO,IAAI,QAAQ,QAAQ;AAC7C;;;;;;;;;;;;;;ACMA,SAAgB,qBAA0C;CACxD,MAAM,UAAU,eAAe;CAE/B,MAAM,UADO,QACM,CAAC,EAAE;CACtB,MAAM,YAAY,SAAS;CAC3B,MAAM,YAAY,OAChB,KAAA,CACF;CACA,gBAAgB;EACd,IAAI,CAAC,WAAW;GACd,UAAU,UAAU,KAAA;GACpB;EACF;EACA,MAAM,OAAO,UAAU;EACvB,IAAI,MAAM,OAAO,WAAW;GAC1B,UAAU,UAAU;IAAE,IAAI;IAAW;GAAQ;GAC7C;EACF;EACA,IAAI,KAAK,YAAY,SAAS;EAC9B,UAAU,UAAU,KAAA;EACpB,eAAe,KAAA,CAAS;EACxB,aAAa,CAAC,CAAC,OAAO,UAAmB;GACvC,OAAO,KACL,sEACA,KACF;EACF,CAAC;CACH,GAAG,CAAC,SAAS,SAAS,CAAC;CACvB,IAAI,CAAC,SAAS,OAAO;CAIrB,OAAO,UAAU,iBAAiB;AACpC"}
@@ -0,0 +1,19 @@
1
+ //#region src/runtime/backend-auth-gate.d.ts
2
+ /** What the gate shows: nothing, a sign-in, or a "not allowed" notice. */
3
+ type BackendAuthGateMode = "login" | "unauthorized" | null;
4
+ /**
5
+ * The gate decision for the app's backend: "login" when the backend refused
6
+ * an anonymous caller, "unauthorized" when it refused a signed-in one.
7
+ *
8
+ * A change of identity after the refusal (a sign-in landing, a sign-out)
9
+ * clears it and lists the drives again as the new caller; a refusal that
10
+ * stands is recorded afresh by that listing. The caller a refusal was seen
11
+ * for is kept in a ref rather than an effect cleanup: StrictMode runs
12
+ * cleanups on its simulated unmount at mount, which cleared a refusal
13
+ * recorded during boot before the root ever rendered the gate.
14
+ */
15
+ declare function useBackendAuthGate(): BackendAuthGateMode;
16
+ //#endregion
17
+ export { useBackendAuthGate as n, BackendAuthGateMode as t };
18
+ export {};
19
+ //# sourceMappingURL=backend-auth-gate-DiFpY5rt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-auth-gate-DiFpY5rt.d.ts","names":[],"sources":["../src/runtime/backend-auth-gate.ts"],"mappings":";;KAUY;;;;;;;;;;;;iBAaI,sBAAsB"}
@@ -154,9 +154,29 @@ declare function createAppReactorClient(options: CreateAppReactorClientOptions):
154
154
  * the Switchboard over GraphQL with NO local reactor (no PGlite).
155
155
  */
156
156
  declare function selectAppReactorClient(params: AppReactorClientParams): Promise<IReactorClient>;
157
- /** A Switchboard that cannot answer must not fail boot: list the tab's drives. */
157
+ /**
158
+ * A Switchboard that cannot answer must not fail boot: list the tab's drives.
159
+ *
160
+ * A Switchboard that REFUSES the caller (401/403) must not fail boot either:
161
+ * the refusal is recorded (`backendAuth`) so the root view shows the sign-in
162
+ * gate, and the drive list is empty until the user is someone the backend
163
+ * accepts. A remote-only client has no local drives to fall back on.
164
+ */
158
165
  declare function getAppDrives(client: IReactorClient, local: IReactorClient): Promise<DocumentDriveDocument[]>;
166
+ /**
167
+ * The boot refresh of the drives store. It lists through `getAppDrives`
168
+ * whichever client is in use, so a Switchboard that refuses the caller is
169
+ * recorded for the sign-in gate here too: the remote-only client is its own
170
+ * `local`, and a bare `refreshReactorDataClient` would let the 401 escape
171
+ * and fail the boot before the gate can render.
172
+ */
159
173
  declare function refreshAppDrives(client: IReactorClient, local: IReactorClient): Promise<void>;
174
+ /**
175
+ * Lists the drives again as the caller the tab now is, through the clients
176
+ * boot left in the store: after a sign-in landing or a sign-out that followed
177
+ * a backend's refusal. Nothing to do before boot has set a client.
178
+ */
179
+ declare function relistAppDrives(): Promise<void>;
160
180
  //#endregion
161
181
  //#region src/runtime/ph-store.d.ts
162
182
  /** The app's PH store: the active one, else a new one bound to `window.ph`.
@@ -174,6 +194,6 @@ type LocalPackageSource = LocalPackage | (() => Promise<LocalPackage>);
174
194
  /** Starts loading the project's package; a loader runs once, here. */
175
195
  declare function loadLocalPackage(source: LocalPackageSource | undefined): DocumentModelLib | Promise<DocumentModelLib> | undefined;
176
196
  //#endregion
177
- export { resolveRuntimeFlag as A, ReactorWorkerFlagInput as C, RuntimeFlagInput as D, isMultiReactorEnabled as E, RuntimeFlagKeys as O, REACTOR_WORKER_STORAGE_KEY as S, resolveReactorWorkerEnabled as T, REACTOR_CLIENT_QUERY_KEY as _, getConnectPHStore as a, resolveReactorClientMode as b, LocalReactorFactory as c, getAppDrives as d, planReactorClient as f, LocalReactorModule as g, LoadedDocumentModels as h, loadLocalPackage as i, isRuntimeFlagEnabled as k, ReactorClientPlan as l, selectAppReactorClient as m, LocalPackageSource as n, AppReactorClientParams as o, refreshAppDrives as p, ModuleNamespace as r, CreateAppReactorClientOptions as s, LocalPackage as t, createAppReactorClient as u, REACTOR_CLIENT_STORAGE_KEY as v, isReactorWorkerEnabled as w, REACTOR_WORKER_QUERY_KEY as x, ReactorClientMode as y };
197
+ export { isRuntimeFlagEnabled as A, REACTOR_WORKER_STORAGE_KEY as C, isMultiReactorEnabled as D, resolveReactorWorkerEnabled as E, RuntimeFlagInput as O, REACTOR_WORKER_QUERY_KEY as S, isReactorWorkerEnabled as T, LocalReactorModule as _, getConnectPHStore as a, ReactorClientMode as b, LocalReactorFactory as c, getAppDrives as d, planReactorClient as f, LoadedDocumentModels as g, selectAppReactorClient as h, loadLocalPackage as i, resolveRuntimeFlag as j, RuntimeFlagKeys as k, ReactorClientPlan as l, relistAppDrives as m, LocalPackageSource as n, AppReactorClientParams as o, refreshAppDrives as p, ModuleNamespace as r, CreateAppReactorClientOptions as s, LocalPackage as t, createAppReactorClient as u, REACTOR_CLIENT_QUERY_KEY as v, ReactorWorkerFlagInput as w, resolveReactorClientMode as x, REACTOR_CLIENT_STORAGE_KEY as y };
178
198
  export {};
179
- //# sourceMappingURL=index-r46ba0Kx.d.ts.map
199
+ //# sourceMappingURL=index-BMlma368.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-r46ba0Kx.d.ts","names":[],"sources":["../src/runtime/runtime-flag.ts","../src/runtime/multi-reactor-flag.ts","../src/runtime/reactor-worker-flag.ts","../src/runtime/reactor-client-mode.ts","../src/runtime/graphql-routable-backend.ts","../src/runtime/multi-reactor.ts","../src/runtime/app-reactor-client.ts","../src/runtime/ph-store.ts","../src/runtime/local-package.ts"],"mappings":";;;;;;;;;;KAAY;EACV;EACA;EACA;;iBAIc,mBAAmB,OAAO;KAY9B;EACV;EACA;EACA;;iBAKc,qBAAqB,MAAM;;;iBCxB3B;;;cCIH;cACA;KAED,yBAAyB;iBAErB,4BACd,OAAO;iBAKO;;;;;;;;;;;;;;;;;;;KCGJ,oBAAoB;cASnB;cACA;iBA2BG,4BAA4B;;;KC2BhC,gCAAgC,KAC1C;KAIU;WACD,SAAS;;EAElB,QAAQ,QAAQ;;EAEhB;;;iBAIc,6BACd,SAAS,gCACR;;;;cCnEU;cACA;KAED,qBACR,6BACA;;cAQS,gBAAgB;iBAIb,WAAW,MAAM,6BAA6B;;iBAO9C,WACd,QAAQ,2BACD,QAAQ;;iBAcD,4BACd;;KAaU,gCACC,wCACO;KAER;;;EAGV,QAAQ;EACR;;EAEA,SAAS;;EAET,sBAAsB;EACtB,eAAe;;;;;cAMJ,iBAAiB;;cAwBjB,6BAA6B;mBACvB;EAEjB,YACE,mBAAmB,yBACnB,SAAS,sBACT,QAAQ,wBACR;;EAYF;;;;;;;;;iBAmBoB,wBACpB,QAAQ,qBACP,QAAQ;;;KCvJN,4BAA4B;KAErB;EACV,MAAM;;;EAGN,QAAQ;EACR;;EAEA,SAAS;EACT,sBAAsB;EACtB,mBAAmB,QAAQ;;;KAOjB;EACV,MAAM;;EAEN;EACA;;EAEA;;iBAGc,kBACd,OAAM,oBACL;;KAaS,uBACV,MAAM,sBACH,QAAQ;KAED,gCAAgC,KAC1C;EAGA,OAAO;;EAEP,eAAe;;;iBAIK,uBACpB,SAAS,gCAA6B;;;;;;;;;;;;iBA4BlB,uBACpB,QAAQ,yBACP,QAAQ;;iBA6BW,aACpB,QAAQ,gBACR,OAAO,iBACN,QAAQ;iBAeW,iBACpB,QAAQ,gBACR,OAAO,iBACN;;;;;iBCpJa,qBAAqB;;;;KCNzB,kBAAkB;GAC3B,OAAO;;KAGE,eAAe,wBAAwB;;KAGvC,qBAAqB,sBAAsB,QAAQ;;iBAG/C,iBACd,QAAQ,iCACP,mBAAmB,QAAQ"}
1
+ {"version":3,"file":"index-BMlma368.d.ts","names":[],"sources":["../src/runtime/runtime-flag.ts","../src/runtime/multi-reactor-flag.ts","../src/runtime/reactor-worker-flag.ts","../src/runtime/reactor-client-mode.ts","../src/runtime/graphql-routable-backend.ts","../src/runtime/multi-reactor.ts","../src/runtime/app-reactor-client.ts","../src/runtime/ph-store.ts","../src/runtime/local-package.ts"],"mappings":";;;;;;;;;;KAAY;EACV;EACA;EACA;;iBAIc,mBAAmB,OAAO;KAY9B;EACV;EACA;EACA;;iBAKc,qBAAqB,MAAM;;;iBCxB3B;;;cCIH;cACA;KAED,yBAAyB;iBAErB,4BACd,OAAO;iBAKO;;;;;;;;;;;;;;;;;;;KCGJ,oBAAoB;cASnB;cACA;iBA2BG,4BAA4B;;;KC2BhC,gCAAgC,KAC1C;KAIU;WACD,SAAS;;EAElB,QAAQ,QAAQ;;EAEhB;;;iBAIc,6BACd,SAAS,gCACR;;;;cCnEU;cACA;KAED,qBACR,6BACA;;cAQS,gBAAgB;iBAIb,WAAW,MAAM,6BAA6B;;iBAO9C,WACd,QAAQ,2BACD,QAAQ;;iBAcD,4BACd;;KAaU,gCACC,wCACO;KAER;;;EAGV,QAAQ;EACR;;EAEA,SAAS;;EAET,sBAAsB;EACtB,eAAe;;;;;cAMJ,iBAAiB;;cAwBjB,6BAA6B;mBACvB;EAEjB,YACE,mBAAmB,yBACnB,SAAS,sBACT,QAAQ,wBACR;;EAYF;;;;;;;;;iBAmBoB,wBACpB,QAAQ,qBACP,QAAQ;;;KCpJN,4BAA4B;KAErB;EACV,MAAM;;;EAGN,QAAQ;EACR;;EAEA,SAAS;EACT,sBAAsB;EACtB,mBAAmB,QAAQ;;;KAOjB;EACV,MAAM;;EAEN;EACA;;EAEA;;iBAGc,kBACd,OAAM,oBACL;;KAaS,uBACV,MAAM,sBACH,QAAQ;KAED,gCAAgC,KAC1C;EAGA,OAAO;;EAEP,eAAe;;;iBAIK,uBACpB,SAAS,gCAA6B;;;;;;;;;;;;iBA4BlB,uBACpB,QAAQ,yBACP,QAAQ;;;;;;;;;iBAoCW,aACpB,QAAQ,gBACR,OAAO,iBACN,QAAQ;;;;;;;;iBA4CW,iBACpB,QAAQ,gBACR,OAAO,iBACN;;;;;;iBASmB,mBAAmB;;;;;iBCpMzB,qBAAqB;;;;KCNzB,kBAAkB;GAC3B,OAAO;;KAGE,eAAe,wBAAwB;;KAGvC,qBAAqB,sBAAsB,QAAQ;;iBAG/C,iBACd,QAAQ,iCACP,mBAAmB,QAAQ"}
@@ -1,4 +1,5 @@
1
1
  import { i as DocumentViewProps, o as DriveViewProps } from "./route-components-1XyfosoL.js";
2
+ import { t as BackendAuthGateMode } from "./backend-auth-gate-DiFpY5rt.js";
2
3
  import { ErrorComponentProps } from "@tanstack/react-router";
3
4
  import { ReactNode } from "react";
4
5
  import { EditorProps, PHDocument } from "@powerhousedao/shared/document-model";
@@ -55,8 +56,20 @@ declare function DriveIndex(): import("react/jsx-runtime").JSX.Element | null;
55
56
  /** `YYYY-MM-DD HH:mm` in UTC, as a server index lists it; "-" when unknown. */
56
57
  declare function formatModified(iso: string | undefined): string;
57
58
  //#endregion
59
+ //#region src/views/backend-auth-gate.d.ts
60
+ /**
61
+ * Full-page gate rendered by the root view in place of the routes when the
62
+ * backend refused the caller. Signing in goes through Renown's redirect, so
63
+ * the page comes back with the user and boots again as them.
64
+ */
65
+ declare function BackendAuthGate({ mode }: {
66
+ mode: Exclude<BackendAuthGateMode, null>;
67
+ }): import("react/jsx-runtime").JSX.Element;
68
+ //#endregion
58
69
  //#region src/views/layout.d.ts
59
- /** Core's root: the page, in the theme. */
70
+ /** Core's root: the page, in the theme. When the app's backend refused the
71
+ * caller, the sign-in gate stands in for every route, so a shell that
72
+ * replaces core's layout still gets it. */
60
73
  declare function CoreRoot(): import("react/jsx-runtime").JSX.Element;
61
74
  /** Core's header: home, the `staticData.nav` routes, settings and the theme. */
62
75
  declare function CoreHeader(): import("react/jsx-runtime").JSX.Element;
@@ -110,6 +123,6 @@ declare function ThemeToggle({ className }: {
110
123
  className?: string;
111
124
  }): import("react/jsx-runtime").JSX.Element;
112
125
  //#endregion
113
- export { DocumentJson as C, DocumentView as D, DirectoryListing as E, DriveLayout as O, EditorHostProps as S, HISTORY_PAGE_SIZE as T, CoreRoot as _, CoreRouteError as a, DocumentEditorProps as b, DeleteItemModal as c, DriveAuthRequiredModal as d, LoginModal as f, CoreLayout as g, CoreHeader as h, CoreSettingsPage as i, NodeView as k, DocumentVersionUnsupportedModal as l, NotFoundPage as m, PackagesTab as n, ConfirmDocumentUpgradeModal as o, DriveNotFoundPage as p, AppearanceTab as r, CreateDocumentModal as s, ThemeToggle as t, DownloadDocumentWithErrorsModal as u, formatModified as v, DocumentHistory as w, EditorHost as x, DriveIndex as y };
126
+ export { NodeView as A, EditorHostProps as C, DirectoryListing as D, HISTORY_PAGE_SIZE as E, DocumentView as O, EditorHost as S, DocumentHistory as T, CoreRoot as _, CoreRouteError as a, DriveIndex as b, DeleteItemModal as c, DriveAuthRequiredModal as d, LoginModal as f, CoreLayout as g, CoreHeader as h, CoreSettingsPage as i, DriveLayout as k, DocumentVersionUnsupportedModal as l, NotFoundPage as m, PackagesTab as n, ConfirmDocumentUpgradeModal as o, DriveNotFoundPage as p, AppearanceTab as r, CreateDocumentModal as s, ThemeToggle as t, DownloadDocumentWithErrorsModal as u, BackendAuthGate as v, DocumentJson as w, DocumentEditorProps as x, formatModified as y };
114
127
  export {};
115
- //# sourceMappingURL=index-DQ0nbYne.d.ts.map
128
+ //# sourceMappingURL=index-Beqvfchq.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Beqvfchq.d.ts","names":[],"sources":["../src/views/content.tsx","../src/views/directory-listing.tsx","../src/views/document-history.tsx","../src/views/document-json.tsx","../src/views/editor-host.tsx","../src/views/home.tsx","../src/views/index-table.tsx","../src/views/backend-auth-gate.tsx","../src/views/layout.tsx","../src/views/not-found-page.tsx","../src/views/modals.tsx","../src/views/route-views.tsx","../src/views/settings.tsx","../src/views/settings-packages.tsx","../src/views/theme-toggle.tsx"],"mappings":";;;;;;;;iBAoBgB,eAAe;EAAc,UAAU;gCAAY,IAAA;;;iBAgCnD,2CAAW,IAAA;;iBAkCX,wCAAQ,IAAA;;;;iBCFR,mBAAmB,OAAO,QAAQ,YAAY,+EAAc,IAAA,UAAA,SAAA,aAAA,6CAAA,SAAA,6BAAA,+CAAA,8CAAA;;;;cCtE/D;;iBAmHG,kBAAkB,YAAY,gDAAiB,IAAA;;;;iBC1F/C,eAAe,YAAY,gDAAiB,IAAA;;;;KClChD,sBAAsB;EAChC;EACA;IAAY;IAAoB;;;KA8CtB;;EAEV;;EAEA;EACA,UAAU;;;iBAII,aACd,WACA,OACA,YACC,8CAAe,IAAA;;;;iBC1BF,0CAAU,IAAA;;;;iBCrCV,eAAe;;;;;;;;iBCef,kBACd;EAEA,MAAM,QAAQ;gCACf,IAAA;;;;;;iBCOe,wCAAQ,IAAA;;iBAiBR,0CAAU,IAAA;;;iBA8BV,0CAAU,IAAA;;;;iBCxEV,eAAe;EAAe;gCAAoB,IAAA;iBAyBlD,oBAAoB;EAAe;gCAAmB,IAAA;;;;;iBCmEtD,mDAAmB,IAAA;;iBAiGnB,0CAAU,IAAA;;iBAuCV,+CAAe,IAAA;;iBAqCf,2DAA2B,IAAA;;iBA0C3B,+DAA+B,IAAA;;iBAiC/B,+DAA+B,IAAA;;iBAgC/B,sDAAsB,IAAA;;;;iBCrXtB,iBAAiB,OAAO,SAAS,kDAAmB,IAAA;;;;iBC2BpD,gDAAgB,IAAA;;iBA+ChB,6CAAa,IAAA;;;;iBCyDb,2CAAW,IAAA;;;;iBCnIX,cAAc;EAAe;gCAAoB,IAAA"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { A as resolveRuntimeFlag, C as ReactorWorkerFlagInput, D as RuntimeFlagInput, E as isMultiReactorEnabled, O as RuntimeFlagKeys, S as REACTOR_WORKER_STORAGE_KEY, T as resolveReactorWorkerEnabled, _ as REACTOR_CLIENT_QUERY_KEY, a as getConnectPHStore, b as resolveReactorClientMode, c as LocalReactorFactory, d as getAppDrives, f as planReactorClient, g as LocalReactorModule, h as LoadedDocumentModels, i as loadLocalPackage, k as isRuntimeFlagEnabled, l as ReactorClientPlan, m as selectAppReactorClient, n as LocalPackageSource, o as AppReactorClientParams, p as refreshAppDrives, r as ModuleNamespace, s as CreateAppReactorClientOptions, t as LocalPackage, u as createAppReactorClient, v as REACTOR_CLIENT_STORAGE_KEY, w as isReactorWorkerEnabled, x as REACTOR_WORKER_QUERY_KEY, y as ReactorClientMode } from "./index-r46ba0Kx.js";
1
+ import { A as isRuntimeFlagEnabled, C as REACTOR_WORKER_STORAGE_KEY, D as isMultiReactorEnabled, E as resolveReactorWorkerEnabled, O as RuntimeFlagInput, S as REACTOR_WORKER_QUERY_KEY, T as isReactorWorkerEnabled, _ as LocalReactorModule, a as getConnectPHStore, b as ReactorClientMode, c as LocalReactorFactory, d as getAppDrives, f as planReactorClient, g as LoadedDocumentModels, h as selectAppReactorClient, i as loadLocalPackage, j as resolveRuntimeFlag, k as RuntimeFlagKeys, l as ReactorClientPlan, m as relistAppDrives, n as LocalPackageSource, o as AppReactorClientParams, p as refreshAppDrives, r as ModuleNamespace, s as CreateAppReactorClientOptions, t as LocalPackage, u as createAppReactorClient, v as REACTOR_CLIENT_QUERY_KEY, w as ReactorWorkerFlagInput, x as resolveReactorClientMode, y as REACTOR_CLIENT_STORAGE_KEY } from "./index-BMlma368.js";
2
2
  import { A as useDriveRouteData, B as ConnectConfigHooks, C as holdConnectRoutes, D as DRIVE_ROUTE_ID, E as removeConnectRoutes, F as DriveRouteData, G as ConnectPluginUi, H as ConnectPluginContext, I as DriveRouteParams, J as ConnectModals, K as ConnectRouteUi, L as isDriveNotFound, M as ConnectRouterContext, N as DriveLoaderOptions, O as DriveRouteView, P as DriveNotFoundData, R as loadDrive, S as connectRoutesSettled, T as registerPackageRoutes, U as ConnectPluginDefinition, V as ConnectPlugin, W as ConnectPluginFactory, Y as ModalOutlet, _ as ConnectRoutes, a as bindConnectRouter, b as addConnectRoutes, c as applyConnectPluginUi, d as mergeConnectPluginUi, f as resetConnectPluginUi, g as ConnectRootRoute, h as APP_ROUTE_ID, i as ConnectRouterOptions, j as useDriveRouteIds, k as NODE_ROUTE_ID, l as getConnectPluginUi, m as ConnectRouteRegistration, n as ConnectRouterBundle, o as createConnectRouter, q as CORE_MODAL_VIEWS, r as ConnectRouterFor, s as ConnectPluginUiSet, t as ConnectRouter, u as loadConnectPluginUi, v as HOME_ROUTE_ID, w as registerConnectRoutes, x as connectRoutes, y as PackageRoute, z as loadNode } from "./connect-router-11uRIT3z.js";
3
3
  import { a as DrivePending, i as DocumentViewProps, n as ContentOutlet, o as DriveViewProps, r as DRIVE_PENDING_MS, t as CONTENT_VIEW_ID } from "./route-components-1XyfosoL.js";
4
4
  import { $ as disposeConnectAppRouter, A as stringifyConnectSearch, B as ConnectCoreApp, C as useSidebarMode, D as connectSearchMiddlewares, E as GLOBAL_SEARCH_PARAMS, F as CoreRouteOptions, G as isCoreView, H as CoreNotFound, I as coreRouteOptions, J as markNavigationClick, K as PERF_STORAGE_KEY, L as ModalDialog, M as validateDriveSearch, N as bindConnectScroll, O as definedSearch, P as connectScrollRestoration, Q as ConnectAppRouterOptions, R as ModalFrameProps, S as useNavRoutes, T as FEATURE_FLAG_PARAM_PREFIX, U as coreModals, V as CoreError, W as coreView, X as routerPerfEnabled, Y as markRouterNavigations, Z as createConnectNavigation, _ as ConnectNavItem, a as SETTINGS_ROUTE_ID, b as navRoutes, c as redirectToSettingsTab, d as settingsTabsOf, et as getConnectAppRouter, f as settingsTitle, g as ConnectChrome, h as useSettingsTabs, i as ConnectSettingsTab, j as validateConnectSearch, k as parseConnectSearch, l as setSettingsRoute, m as useForgetSettingsOpenedFrom, n as driveTitle, nt as CreateDocumentTarget, o as SettingsTabEntry, p as showsSettingsTab, q as ROUTER_MEASURES, r as notFoundTitle, rt as useCreateDocumentTarget, s as keepOpenedFrom, t as appTitle, tt as useIsColdStart, u as settingsTabs, v as NavRouteEntry, w as ConnectSearch, x as useConnectChrome, y as SidebarMode, z as useModalFrame } from "./index-Bfl1VYdj.js";
5
5
  import { a as registerConnectPlugins, i as knownPlugins, n as isPluginActive, r as applyComposition, t as getActivePluginModules } from "./index-xKGW_46_.js";
6
6
  import { i as primeRuntimeConfig, n as getRuntimeConfig, r as loadRuntimeConfig } from "./runtime-config-D3YPhYyj.js";
7
+ import { n as useBackendAuthGate, t as BackendAuthGateMode } from "./backend-auth-gate-DiFpY5rt.js";
7
8
  import { n as useIsEmbedded, t as getIsEmbedded } from "./embedded-DT1C47F0.js";
8
- import { C as DocumentJson, D as DocumentView, E as DirectoryListing, O as DriveLayout, S as EditorHostProps, T as HISTORY_PAGE_SIZE, _ as CoreRoot, a as CoreRouteError, b as DocumentEditorProps, c as DeleteItemModal, d as DriveAuthRequiredModal, f as LoginModal, g as CoreLayout, h as CoreHeader, i as CoreSettingsPage, k as NodeView, l as DocumentVersionUnsupportedModal, m as NotFoundPage, n as PackagesTab, o as ConfirmDocumentUpgradeModal, p as DriveNotFoundPage, r as AppearanceTab, s as CreateDocumentModal, t as ThemeToggle, u as DownloadDocumentWithErrorsModal, v as formatModified, w as DocumentHistory, x as EditorHost, y as DriveIndex } from "./index-DQ0nbYne.js";
9
- export { APP_ROUTE_ID, type AppReactorClientParams, AppearanceTab, CONTENT_VIEW_ID, CORE_MODAL_VIEWS, ConfirmDocumentUpgradeModal, type ConnectAppRouterOptions, type ConnectChrome, type ConnectConfigHooks, ConnectCoreApp, type ConnectModals, type ConnectNavItem, type ConnectPlugin, type ConnectPluginContext, type ConnectPluginDefinition, type ConnectPluginFactory, type ConnectPluginUi, type ConnectPluginUiSet, type ConnectRootRoute, type ConnectRouteRegistration, type ConnectRouteUi, type ConnectRouter, type ConnectRouterBundle, type ConnectRouterContext, type ConnectRouterFor, type ConnectRouterOptions, type ConnectRoutes, type ConnectSearch, type ConnectSettingsTab, ContentOutlet, CoreError, CoreHeader, CoreLayout, CoreNotFound, CoreRoot, CoreRouteError, type CoreRouteOptions, CoreSettingsPage, type CreateAppReactorClientOptions, CreateDocumentModal, type CreateDocumentTarget, DRIVE_PENDING_MS, DRIVE_ROUTE_ID, DeleteItemModal, DirectoryListing, type DocumentEditorProps, DocumentHistory, DocumentJson, DocumentVersionUnsupportedModal, DocumentView, type DocumentViewProps, DownloadDocumentWithErrorsModal, DriveAuthRequiredModal, DriveIndex, DriveLayout, type DriveLoaderOptions, type DriveNotFoundData, DriveNotFoundPage, DrivePending, type DriveRouteData, type DriveRouteParams, type DriveRouteView, type DriveViewProps, EditorHost, type EditorHostProps, FEATURE_FLAG_PARAM_PREFIX, GLOBAL_SEARCH_PARAMS, HISTORY_PAGE_SIZE, HOME_ROUTE_ID, type LoadedDocumentModels, type LocalPackage, type LocalPackageSource, type LocalReactorFactory, type LocalReactorModule, LoginModal, ModalDialog, type ModalFrameProps, ModalOutlet, type ModuleNamespace, NODE_ROUTE_ID, type NavRouteEntry, NodeView, NotFoundPage, PERF_STORAGE_KEY, type PackageRoute, PackagesTab, REACTOR_CLIENT_QUERY_KEY, REACTOR_CLIENT_STORAGE_KEY, REACTOR_WORKER_QUERY_KEY, REACTOR_WORKER_STORAGE_KEY, ROUTER_MEASURES, type ReactorClientMode, type ReactorClientPlan, type ReactorWorkerFlagInput, type RuntimeFlagInput, type RuntimeFlagKeys, SETTINGS_ROUTE_ID, type SettingsTabEntry, type SidebarMode, ThemeToggle, addConnectRoutes, appTitle, applyComposition, applyConnectPluginUi, bindConnectRouter, bindConnectScroll, connectRoutes, connectRoutesSettled, connectScrollRestoration, connectSearchMiddlewares, coreModals, coreRouteOptions, coreView, createAppReactorClient, createConnectNavigation, createConnectRouter, definedSearch, disposeConnectAppRouter, driveTitle, formatModified, getActivePluginModules, getAppDrives, getConnectAppRouter, getConnectPHStore, getConnectPluginUi, getIsEmbedded, getRuntimeConfig, holdConnectRoutes, isCoreView, isDriveNotFound, isMultiReactorEnabled, isPluginActive, isReactorWorkerEnabled, isRuntimeFlagEnabled, keepOpenedFrom, knownPlugins, loadConnectPluginUi, loadDrive, loadLocalPackage, loadNode, loadRuntimeConfig, markNavigationClick, markRouterNavigations, mergeConnectPluginUi, navRoutes, notFoundTitle, parseConnectSearch, planReactorClient, primeRuntimeConfig, redirectToSettingsTab, refreshAppDrives, registerConnectPlugins, registerConnectRoutes, registerPackageRoutes, removeConnectRoutes, resetConnectPluginUi, resolveReactorClientMode, resolveReactorWorkerEnabled, resolveRuntimeFlag, routerPerfEnabled, selectAppReactorClient, setSettingsRoute, settingsTabs, settingsTabsOf, settingsTitle, showsSettingsTab, stringifyConnectSearch, useConnectChrome, useCreateDocumentTarget, useDriveRouteData, useDriveRouteIds, useForgetSettingsOpenedFrom, useIsColdStart, useIsEmbedded, useModalFrame, useNavRoutes, useSettingsTabs, useSidebarMode, validateConnectSearch, validateDriveSearch };
9
+ import { A as NodeView, C as EditorHostProps, D as DirectoryListing, E as HISTORY_PAGE_SIZE, O as DocumentView, S as EditorHost, T as DocumentHistory, _ as CoreRoot, a as CoreRouteError, b as DriveIndex, c as DeleteItemModal, d as DriveAuthRequiredModal, f as LoginModal, g as CoreLayout, h as CoreHeader, i as CoreSettingsPage, k as DriveLayout, l as DocumentVersionUnsupportedModal, m as NotFoundPage, n as PackagesTab, o as ConfirmDocumentUpgradeModal, p as DriveNotFoundPage, r as AppearanceTab, s as CreateDocumentModal, t as ThemeToggle, u as DownloadDocumentWithErrorsModal, v as BackendAuthGate, w as DocumentJson, x as DocumentEditorProps, y as formatModified } from "./index-Beqvfchq.js";
10
+ export { APP_ROUTE_ID, type AppReactorClientParams, AppearanceTab, BackendAuthGate, type BackendAuthGateMode, CONTENT_VIEW_ID, CORE_MODAL_VIEWS, ConfirmDocumentUpgradeModal, type ConnectAppRouterOptions, type ConnectChrome, type ConnectConfigHooks, ConnectCoreApp, type ConnectModals, type ConnectNavItem, type ConnectPlugin, type ConnectPluginContext, type ConnectPluginDefinition, type ConnectPluginFactory, type ConnectPluginUi, type ConnectPluginUiSet, type ConnectRootRoute, type ConnectRouteRegistration, type ConnectRouteUi, type ConnectRouter, type ConnectRouterBundle, type ConnectRouterContext, type ConnectRouterFor, type ConnectRouterOptions, type ConnectRoutes, type ConnectSearch, type ConnectSettingsTab, ContentOutlet, CoreError, CoreHeader, CoreLayout, CoreNotFound, CoreRoot, CoreRouteError, type CoreRouteOptions, CoreSettingsPage, type CreateAppReactorClientOptions, CreateDocumentModal, type CreateDocumentTarget, DRIVE_PENDING_MS, DRIVE_ROUTE_ID, DeleteItemModal, DirectoryListing, type DocumentEditorProps, DocumentHistory, DocumentJson, DocumentVersionUnsupportedModal, DocumentView, type DocumentViewProps, DownloadDocumentWithErrorsModal, DriveAuthRequiredModal, DriveIndex, DriveLayout, type DriveLoaderOptions, type DriveNotFoundData, DriveNotFoundPage, DrivePending, type DriveRouteData, type DriveRouteParams, type DriveRouteView, type DriveViewProps, EditorHost, type EditorHostProps, FEATURE_FLAG_PARAM_PREFIX, GLOBAL_SEARCH_PARAMS, HISTORY_PAGE_SIZE, HOME_ROUTE_ID, type LoadedDocumentModels, type LocalPackage, type LocalPackageSource, type LocalReactorFactory, type LocalReactorModule, LoginModal, ModalDialog, type ModalFrameProps, ModalOutlet, type ModuleNamespace, NODE_ROUTE_ID, type NavRouteEntry, NodeView, NotFoundPage, PERF_STORAGE_KEY, type PackageRoute, PackagesTab, REACTOR_CLIENT_QUERY_KEY, REACTOR_CLIENT_STORAGE_KEY, REACTOR_WORKER_QUERY_KEY, REACTOR_WORKER_STORAGE_KEY, ROUTER_MEASURES, type ReactorClientMode, type ReactorClientPlan, type ReactorWorkerFlagInput, type RuntimeFlagInput, type RuntimeFlagKeys, SETTINGS_ROUTE_ID, type SettingsTabEntry, type SidebarMode, ThemeToggle, addConnectRoutes, appTitle, applyComposition, applyConnectPluginUi, bindConnectRouter, bindConnectScroll, connectRoutes, connectRoutesSettled, connectScrollRestoration, connectSearchMiddlewares, coreModals, coreRouteOptions, coreView, createAppReactorClient, createConnectNavigation, createConnectRouter, definedSearch, disposeConnectAppRouter, driveTitle, formatModified, getActivePluginModules, getAppDrives, getConnectAppRouter, getConnectPHStore, getConnectPluginUi, getIsEmbedded, getRuntimeConfig, holdConnectRoutes, isCoreView, isDriveNotFound, isMultiReactorEnabled, isPluginActive, isReactorWorkerEnabled, isRuntimeFlagEnabled, keepOpenedFrom, knownPlugins, loadConnectPluginUi, loadDrive, loadLocalPackage, loadNode, loadRuntimeConfig, markNavigationClick, markRouterNavigations, mergeConnectPluginUi, navRoutes, notFoundTitle, parseConnectSearch, planReactorClient, primeRuntimeConfig, redirectToSettingsTab, refreshAppDrives, registerConnectPlugins, registerConnectRoutes, registerPackageRoutes, relistAppDrives, removeConnectRoutes, resetConnectPluginUi, resolveReactorClientMode, resolveReactorWorkerEnabled, resolveRuntimeFlag, routerPerfEnabled, selectAppReactorClient, setSettingsRoute, settingsTabs, settingsTabsOf, settingsTitle, showsSettingsTab, stringifyConnectSearch, useBackendAuthGate, useConnectChrome, useCreateDocumentTarget, useDriveRouteData, useDriveRouteIds, useForgetSettingsOpenedFrom, useIsColdStart, useIsEmbedded, useModalFrame, useNavRoutes, useSettingsTabs, useSidebarMode, validateConnectSearch, validateDriveSearch };
10
11
  export {};
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
- import { C as DocumentJson, D as formatModified, E as DirectoryListing, S as EditorHost, T as HISTORY_PAGE_SIZE, _ as ThemeToggle, a as DriveNotFoundPage, b as DriveLayout, c as CoreLayout, d as CreateDocumentModal, f as DeleteItemModal, g as LoginModal, h as DriveAuthRequiredModal, i as CoreRouteError, l as CoreRoot, m as DownloadDocumentWithErrorsModal, n as AppearanceTab, o as NotFoundPage, p as DocumentVersionUnsupportedModal, r as CoreSettingsPage, s as CoreHeader, t as PackagesTab, u as ConfirmDocumentUpgradeModal, v as DriveIndex, w as DocumentHistory, x as NodeView, y as DocumentView } from "./views-Ba9OeN3c.js";
2
- import { c as CoreNotFound, d as isCoreView, f as isDriveNotFound, i as mergeConnectPluginUi, l as coreModals, m as loadNode, n as getConnectPluginUi, o as resetConnectPluginUi, p as loadDrive, r as loadConnectPluginUi, s as CoreError, t as applyConnectPluginUi, u as coreView } from "./plugin-ui-fDXhKTCK.js";
1
+ import { C as EditorHost, D as DirectoryListing, E as HISTORY_PAGE_SIZE, O as formatModified, S as NodeView, T as DocumentHistory, _ as ThemeToggle, a as DriveNotFoundPage, b as DocumentView, c as CoreLayout, d as CreateDocumentModal, f as DeleteItemModal, g as LoginModal, h as DriveAuthRequiredModal, i as CoreRouteError, l as CoreRoot, m as DownloadDocumentWithErrorsModal, n as AppearanceTab, o as NotFoundPage, p as DocumentVersionUnsupportedModal, r as CoreSettingsPage, s as CoreHeader, t as PackagesTab, u as ConfirmDocumentUpgradeModal, v as BackendAuthGate, w as DocumentJson, x as DriveLayout, y as DriveIndex } from "./views-BtUVboYl.js";
2
+ import { c as CoreNotFound, d as isCoreView, f as isDriveNotFound, i as mergeConnectPluginUi, l as coreModals, m as loadNode, n as getConnectPluginUi, o as resetConnectPluginUi, p as loadDrive, r as loadConnectPluginUi, s as CoreError, t as applyConnectPluginUi, u as coreView } from "./plugin-ui-DHlnXJmN.js";
3
3
  import { a as connectRoutesSettled, c as registerPackageRoutes, f as CORE_MODAL_VIEWS, h as useModalFrame, i as connectRoutes, l as removeConnectRoutes, m as ModalDialog, n as HOME_ROUTE_ID, o as holdConnectRoutes, p as ModalOutlet, r as addConnectRoutes, s as registerConnectRoutes, t as APP_ROUTE_ID } from "./route-tree-D0aszMrk.js";
4
4
  import { C as CONTENT_VIEW_ID, D as useIsColdStart, E as DrivePending, S as notFoundTitle, T as DRIVE_PENDING_MS, _ as showsSettingsTab, a as useCreateDocumentTarget, b as appTitle, c as useDriveRouteData, d as keepOpenedFrom, f as redirectToSettingsTab, g as settingsTitle, h as settingsTabsOf, i as useSidebarMode, l as useDriveRouteIds, m as settingsTabs, n as useConnectChrome, o as DRIVE_ROUTE_ID, p as setSettingsRoute, r as useNavRoutes, s as NODE_ROUTE_ID, t as navRoutes, u as SETTINGS_ROUTE_ID, v as useForgetSettingsOpenedFrom, w as ContentOutlet, x as driveTitle, y as useSettingsTabs } from "./sidebar-C2y4mZnX.js";
5
- import { i as registerConnectPlugins, n as knownPlugins, t as applyComposition } from "./plugin-host-D_EW56IQ.js";
6
- import { S as routerPerfEnabled, _ as connectScrollRestoration, a as bindConnectRouter, b as markNavigationClick, c as FEATURE_FLAG_PARAM_PREFIX, d as definedSearch, f as parseConnectSearch, g as bindConnectScroll, h as validateDriveSearch, i as getConnectAppRouter, l as GLOBAL_SEARCH_PARAMS, m as validateConnectSearch, n as ConnectCoreApp, o as createConnectRouter, p as stringifyConnectSearch, r as disposeConnectAppRouter, s as createConnectNavigation, t as coreRouteOptions, u as connectSearchMiddlewares, v as PERF_STORAGE_KEY, x as markRouterNavigations, y as ROUTER_MEASURES } from "./router-wVNdTI-Y.js";
5
+ import { i as registerConnectPlugins, n as knownPlugins, t as applyComposition } from "./plugin-host-CMr7lN40.js";
6
+ import { S as routerPerfEnabled, _ as connectScrollRestoration, a as bindConnectRouter, b as markNavigationClick, c as FEATURE_FLAG_PARAM_PREFIX, d as definedSearch, f as parseConnectSearch, g as bindConnectScroll, h as validateDriveSearch, i as getConnectAppRouter, l as GLOBAL_SEARCH_PARAMS, m as validateConnectSearch, n as ConnectCoreApp, o as createConnectRouter, p as stringifyConnectSearch, r as disposeConnectAppRouter, s as createConnectNavigation, t as coreRouteOptions, u as connectSearchMiddlewares, v as PERF_STORAGE_KEY, x as markRouterNavigations, y as ROUTER_MEASURES } from "./router-C4hDJ4_J.js";
7
7
  import { getIsEmbedded, useIsEmbedded } from "./embedded.js";
8
8
  import { getRuntimeConfig, loadRuntimeConfig, primeRuntimeConfig } from "./runtime-config.js";
9
9
  import { n as isPluginActive, t as getActivePluginModules } from "./plugins-x1XqLPzp.js";
10
- import { n as resolveRuntimeFlag, t as isRuntimeFlagEnabled } from "./runtime-flag-Bp6QasS8.js";
11
- import { a as planReactorClient, c as REACTOR_CLIENT_QUERY_KEY, d as REACTOR_WORKER_QUERY_KEY, f as REACTOR_WORKER_STORAGE_KEY, h as isMultiReactorEnabled, i as getAppDrives, l as REACTOR_CLIENT_STORAGE_KEY, m as resolveReactorWorkerEnabled, n as getConnectPHStore, o as refreshAppDrives, p as isReactorWorkerEnabled, r as createAppReactorClient, s as selectAppReactorClient, t as loadLocalPackage, u as resolveReactorClientMode } from "./runtime-BUG9vT2E.js";
12
- export { APP_ROUTE_ID, AppearanceTab, CONTENT_VIEW_ID, CORE_MODAL_VIEWS, ConfirmDocumentUpgradeModal, ConnectCoreApp, ContentOutlet, CoreError, CoreHeader, CoreLayout, CoreNotFound, CoreRoot, CoreRouteError, CoreSettingsPage, CreateDocumentModal, DRIVE_PENDING_MS, DRIVE_ROUTE_ID, DeleteItemModal, DirectoryListing, DocumentHistory, DocumentJson, DocumentVersionUnsupportedModal, DocumentView, DownloadDocumentWithErrorsModal, DriveAuthRequiredModal, DriveIndex, DriveLayout, DriveNotFoundPage, DrivePending, EditorHost, FEATURE_FLAG_PARAM_PREFIX, GLOBAL_SEARCH_PARAMS, HISTORY_PAGE_SIZE, HOME_ROUTE_ID, LoginModal, ModalDialog, ModalOutlet, NODE_ROUTE_ID, NodeView, NotFoundPage, PERF_STORAGE_KEY, PackagesTab, REACTOR_CLIENT_QUERY_KEY, REACTOR_CLIENT_STORAGE_KEY, REACTOR_WORKER_QUERY_KEY, REACTOR_WORKER_STORAGE_KEY, ROUTER_MEASURES, SETTINGS_ROUTE_ID, ThemeToggle, addConnectRoutes, appTitle, applyComposition, applyConnectPluginUi, bindConnectRouter, bindConnectScroll, connectRoutes, connectRoutesSettled, connectScrollRestoration, connectSearchMiddlewares, coreModals, coreRouteOptions, coreView, createAppReactorClient, createConnectNavigation, createConnectRouter, definedSearch, disposeConnectAppRouter, driveTitle, formatModified, getActivePluginModules, getAppDrives, getConnectAppRouter, getConnectPHStore, getConnectPluginUi, getIsEmbedded, getRuntimeConfig, holdConnectRoutes, isCoreView, isDriveNotFound, isMultiReactorEnabled, isPluginActive, isReactorWorkerEnabled, isRuntimeFlagEnabled, keepOpenedFrom, knownPlugins, loadConnectPluginUi, loadDrive, loadLocalPackage, loadNode, loadRuntimeConfig, markNavigationClick, markRouterNavigations, mergeConnectPluginUi, navRoutes, notFoundTitle, parseConnectSearch, planReactorClient, primeRuntimeConfig, redirectToSettingsTab, refreshAppDrives, registerConnectPlugins, registerConnectRoutes, registerPackageRoutes, removeConnectRoutes, resetConnectPluginUi, resolveReactorClientMode, resolveReactorWorkerEnabled, resolveRuntimeFlag, routerPerfEnabled, selectAppReactorClient, setSettingsRoute, settingsTabs, settingsTabsOf, settingsTitle, showsSettingsTab, stringifyConnectSearch, useConnectChrome, useCreateDocumentTarget, useDriveRouteData, useDriveRouteIds, useForgetSettingsOpenedFrom, useIsColdStart, useIsEmbedded, useModalFrame, useNavRoutes, useSettingsTabs, useSidebarMode, validateConnectSearch, validateDriveSearch };
10
+ import { n as resolveRuntimeFlag, t as isRuntimeFlagEnabled } from "./runtime-flag-DvxW_SD4.js";
11
+ import { a as planReactorClient, c as selectAppReactorClient, d as resolveReactorClientMode, f as REACTOR_WORKER_QUERY_KEY, g as isMultiReactorEnabled, h as resolveReactorWorkerEnabled, i as getAppDrives, l as REACTOR_CLIENT_QUERY_KEY, m as isReactorWorkerEnabled, n as getConnectPHStore, o as refreshAppDrives, p as REACTOR_WORKER_STORAGE_KEY, r as createAppReactorClient, s as relistAppDrives, t as loadLocalPackage, u as REACTOR_CLIENT_STORAGE_KEY } from "./runtime-D20_LlB_.js";
12
+ import { t as useBackendAuthGate } from "./backend-auth-gate-DNKg_v4Y.js";
13
+ export { APP_ROUTE_ID, AppearanceTab, BackendAuthGate, CONTENT_VIEW_ID, CORE_MODAL_VIEWS, ConfirmDocumentUpgradeModal, ConnectCoreApp, ContentOutlet, CoreError, CoreHeader, CoreLayout, CoreNotFound, CoreRoot, CoreRouteError, CoreSettingsPage, CreateDocumentModal, DRIVE_PENDING_MS, DRIVE_ROUTE_ID, DeleteItemModal, DirectoryListing, DocumentHistory, DocumentJson, DocumentVersionUnsupportedModal, DocumentView, DownloadDocumentWithErrorsModal, DriveAuthRequiredModal, DriveIndex, DriveLayout, DriveNotFoundPage, DrivePending, EditorHost, FEATURE_FLAG_PARAM_PREFIX, GLOBAL_SEARCH_PARAMS, HISTORY_PAGE_SIZE, HOME_ROUTE_ID, LoginModal, ModalDialog, ModalOutlet, NODE_ROUTE_ID, NodeView, NotFoundPage, PERF_STORAGE_KEY, PackagesTab, REACTOR_CLIENT_QUERY_KEY, REACTOR_CLIENT_STORAGE_KEY, REACTOR_WORKER_QUERY_KEY, REACTOR_WORKER_STORAGE_KEY, ROUTER_MEASURES, SETTINGS_ROUTE_ID, ThemeToggle, addConnectRoutes, appTitle, applyComposition, applyConnectPluginUi, bindConnectRouter, bindConnectScroll, connectRoutes, connectRoutesSettled, connectScrollRestoration, connectSearchMiddlewares, coreModals, coreRouteOptions, coreView, createAppReactorClient, createConnectNavigation, createConnectRouter, definedSearch, disposeConnectAppRouter, driveTitle, formatModified, getActivePluginModules, getAppDrives, getConnectAppRouter, getConnectPHStore, getConnectPluginUi, getIsEmbedded, getRuntimeConfig, holdConnectRoutes, isCoreView, isDriveNotFound, isMultiReactorEnabled, isPluginActive, isReactorWorkerEnabled, isRuntimeFlagEnabled, keepOpenedFrom, knownPlugins, loadConnectPluginUi, loadDrive, loadLocalPackage, loadNode, loadRuntimeConfig, markNavigationClick, markRouterNavigations, mergeConnectPluginUi, navRoutes, notFoundTitle, parseConnectSearch, planReactorClient, primeRuntimeConfig, redirectToSettingsTab, refreshAppDrives, registerConnectPlugins, registerConnectRoutes, registerPackageRoutes, relistAppDrives, removeConnectRoutes, resetConnectPluginUi, resolveReactorClientMode, resolveReactorWorkerEnabled, resolveRuntimeFlag, routerPerfEnabled, selectAppReactorClient, setSettingsRoute, settingsTabs, settingsTabsOf, settingsTitle, showsSettingsTab, stringifyConnectSearch, useBackendAuthGate, useConnectChrome, useCreateDocumentTarget, useDriveRouteData, useDriveRouteIds, useForgetSettingsOpenedFrom, useIsColdStart, useIsEmbedded, useModalFrame, useNavRoutes, useSettingsTabs, useSidebarMode, validateConnectSearch, validateDriveSearch };
@@ -1,4 +1,4 @@
1
- import { O as __exportAll } from "./views-Ba9OeN3c.js";
1
+ import { k as __exportAll } from "./views-BtUVboYl.js";
2
2
  import { t as getConnectRegistry } from "./registry-DCZHBP7M.js";
3
3
  import { resolveOrder, runTransformHook } from "@powerhousedao/host-core/plugins";
4
4
  //#region src/plugins/plugin-host.ts
@@ -57,4 +57,4 @@ async function applyComposition(config) {
57
57
  //#endregion
58
58
  export { registerConnectPlugins as i, knownPlugins as n, plugin_host_exports as r, applyComposition as t };
59
59
 
60
- //# sourceMappingURL=plugin-host-D_EW56IQ.js.map
60
+ //# sourceMappingURL=plugin-host-CMr7lN40.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-host-D_EW56IQ.js","names":[],"sources":["../src/plugins/plugin-host.ts"],"sourcesContent":["import {\n resolveOrder,\n runTransformHook,\n} from \"@powerhousedao/host-core/plugins\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type { ConnectPluginDefinitions } from \"../registry.js\";\nimport { getConnectRegistry } from \"../registry.js\";\nimport type {\n ConnectPlugin,\n ConnectPluginContext,\n ConnectPluginDefinition,\n} from \"./types.js\";\n\nexport type { ConnectPluginContext } from \"./types.js\";\n\n// ConnectCore's plugin pipeline (rewire plan R3). It runs only when the served\n// config carries a `composition`; presence is activation.\n\ntype PluginDefinitions = ConnectPluginDefinitions;\ntype PluginLoader = () => Promise<PluginDefinitions>;\n\n/** Makes plugin modules known by specifier; a loader runs when a composition applies. */\nexport function registerConnectPlugins(\n plugins: PluginDefinitions | PluginLoader,\n) {\n const registry = getConnectRegistry();\n if (typeof plugins === \"function\") registry.pluginLoaders.push(plugins);\n else Object.assign(registry.plugins, plugins);\n}\n\n/** Every plugin module made known, its loaders run. */\nexport async function knownPlugins(): Promise<PluginDefinitions> {\n const registry = getConnectRegistry();\n const pending = registry.pluginLoaders;\n registry.pluginLoaders = [];\n for (const loaded of await Promise.all(pending.map((load) => load()))) {\n Object.assign(registry.plugins, loaded);\n }\n return registry.plugins;\n}\n\n/** The slices of known plugins absent from the composition, zeroed. */\nfunction zeroAbsentSlices(\n config: PHConnectRuntimeConfig,\n present: ReadonlySet<string>,\n plugins: PluginDefinitions,\n): PHConnectRuntimeConfig {\n let out = { ...config };\n for (const [module, definition] of Object.entries(plugins)) {\n if (!present.has(module) && definition.whenAbsent) {\n out = definition.whenAbsent(out);\n }\n }\n return out;\n}\n\nconst LOG = \"[connect:plugins]\";\n\n/** Applies the composition to the served config; pure, and logs the plan and\n * each hook it fires to the console. */\nexport async function applyComposition(\n config: PHConnectRuntimeConfig,\n): Promise<PHConnectRuntimeConfig> {\n const composition = config.composition;\n if (!composition) return config;\n\n const definitions = await knownPlugins();\n const present = new Set(composition.map((entry) => entry.module));\n const plugins: ConnectPlugin[] = [];\n\n console.info(\n `${LOG} resolving composition — ${composition.length} entr${composition.length === 1 ? \"y\" : \"ies\"}`,\n );\n for (const entry of composition) {\n const definition: ConnectPluginDefinition | undefined =\n definitions[entry.module];\n if (!definition) {\n console.warn(\n `${LOG} ✗ ${entry.module} — unknown (external plugin loading not wired); SKIPPED`,\n );\n continue;\n }\n const plugin = definition.create(entry.config ?? {});\n plugins.push(plugin);\n const cfgKeys = Object.keys(entry.config ?? {});\n console.info(\n `${LOG} ✓ ${plugin.name} (${entry.module})` +\n (cfgKeys.length ? ` config: {${cfgKeys.join(\", \")}}` : \"\"),\n );\n }\n\n const ordered = resolveOrder(plugins);\n const ctx: ConnectPluginContext = { entryConfig: {} };\n const ran = ordered\n .filter((p) => p.hooks?.transformConnectConfig)\n .map((p) => p.name);\n console.info(\n `${LOG} hook transformConnectConfig → ${ran.length ? ran.join(\", \") : \"(none)\"}`,\n );\n return runTransformHook<PHConnectRuntimeConfig, ConnectPluginContext>(\n \"transformConnectConfig\",\n ordered,\n ctx,\n zeroAbsentSlices(config, present, definitions),\n );\n}\n"],"mappings":";;;;;;;;;;AAsBA,SAAgB,uBACd,SACA;CACA,MAAM,WAAW,mBAAmB;CACpC,IAAI,OAAO,YAAY,YAAY,SAAS,cAAc,KAAK,OAAO;MACjE,OAAO,OAAO,SAAS,SAAS,OAAO;AAC9C;;AAGA,eAAsB,eAA2C;CAC/D,MAAM,WAAW,mBAAmB;CACpC,MAAM,UAAU,SAAS;CACzB,SAAS,gBAAgB,CAAC;CAC1B,KAAK,MAAM,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,SAAS,KAAK,CAAC,CAAC,GAClE,OAAO,OAAO,SAAS,SAAS,MAAM;CAExC,OAAO,SAAS;AAClB;;AAGA,SAAS,iBACP,QACA,SACA,SACwB;CACxB,IAAI,MAAM,EAAE,GAAG,OAAO;CACtB,KAAK,MAAM,CAAC,QAAQ,eAAe,OAAO,QAAQ,OAAO,GACvD,IAAI,CAAC,QAAQ,IAAI,MAAM,KAAK,WAAW,YACrC,MAAM,WAAW,WAAW,GAAG;CAGnC,OAAO;AACT;AAEA,MAAM,MAAM;;;AAIZ,eAAsB,iBACpB,QACiC;CACjC,MAAM,cAAc,OAAO;CAC3B,IAAI,CAAC,aAAa,OAAO;CAEzB,MAAM,cAAc,MAAM,aAAa;CACvC,MAAM,UAAU,IAAI,IAAI,YAAY,KAAK,UAAU,MAAM,MAAM,CAAC;CAChE,MAAM,UAA2B,CAAC;CAElC,QAAQ,KACN,GAAG,IAAI,2BAA2B,YAAY,OAAO,OAAO,YAAY,WAAW,IAAI,MAAM,OAC/F;CACA,KAAK,MAAM,SAAS,aAAa;EAC/B,MAAM,aACJ,YAAY,MAAM;EACpB,IAAI,CAAC,YAAY;GACf,QAAQ,KACN,GAAG,IAAI,OAAO,MAAM,OAAO,wDAC7B;GACA;EACF;EACA,MAAM,SAAS,WAAW,OAAO,MAAM,UAAU,CAAC,CAAC;EACnD,QAAQ,KAAK,MAAM;EACnB,MAAM,UAAU,OAAO,KAAK,MAAM,UAAU,CAAC,CAAC;EAC9C,QAAQ,KACN,GAAG,IAAI,OAAO,OAAO,KAAK,IAAI,MAAM,OAAO,MACxC,QAAQ,SAAS,aAAa,QAAQ,KAAK,IAAI,EAAE,KAAK,GAC3D;CACF;CAEA,MAAM,UAAU,aAAa,OAAO;CACpC,MAAM,MAA4B,EAAE,aAAa,CAAC,EAAE;CACpD,MAAM,MAAM,QACT,QAAQ,MAAM,EAAE,OAAO,sBAAsB,CAAC,CAC9C,KAAK,MAAM,EAAE,IAAI;CACpB,QAAQ,KACN,GAAG,IAAI,iCAAiC,IAAI,SAAS,IAAI,KAAK,IAAI,IAAI,UACxE;CACA,OAAO,iBACL,0BACA,SACA,KACA,iBAAiB,QAAQ,SAAS,WAAW,CAC/C;AACF"}
1
+ {"version":3,"file":"plugin-host-CMr7lN40.js","names":[],"sources":["../src/plugins/plugin-host.ts"],"sourcesContent":["import {\n resolveOrder,\n runTransformHook,\n} from \"@powerhousedao/host-core/plugins\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type { ConnectPluginDefinitions } from \"../registry.js\";\nimport { getConnectRegistry } from \"../registry.js\";\nimport type {\n ConnectPlugin,\n ConnectPluginContext,\n ConnectPluginDefinition,\n} from \"./types.js\";\n\nexport type { ConnectPluginContext } from \"./types.js\";\n\n// ConnectCore's plugin pipeline (rewire plan R3). It runs only when the served\n// config carries a `composition`; presence is activation.\n\ntype PluginDefinitions = ConnectPluginDefinitions;\ntype PluginLoader = () => Promise<PluginDefinitions>;\n\n/** Makes plugin modules known by specifier; a loader runs when a composition applies. */\nexport function registerConnectPlugins(\n plugins: PluginDefinitions | PluginLoader,\n) {\n const registry = getConnectRegistry();\n if (typeof plugins === \"function\") registry.pluginLoaders.push(plugins);\n else Object.assign(registry.plugins, plugins);\n}\n\n/** Every plugin module made known, its loaders run. */\nexport async function knownPlugins(): Promise<PluginDefinitions> {\n const registry = getConnectRegistry();\n const pending = registry.pluginLoaders;\n registry.pluginLoaders = [];\n for (const loaded of await Promise.all(pending.map((load) => load()))) {\n Object.assign(registry.plugins, loaded);\n }\n return registry.plugins;\n}\n\n/** The slices of known plugins absent from the composition, zeroed. */\nfunction zeroAbsentSlices(\n config: PHConnectRuntimeConfig,\n present: ReadonlySet<string>,\n plugins: PluginDefinitions,\n): PHConnectRuntimeConfig {\n let out = { ...config };\n for (const [module, definition] of Object.entries(plugins)) {\n if (!present.has(module) && definition.whenAbsent) {\n out = definition.whenAbsent(out);\n }\n }\n return out;\n}\n\nconst LOG = \"[connect:plugins]\";\n\n/** Applies the composition to the served config; pure, and logs the plan and\n * each hook it fires to the console. */\nexport async function applyComposition(\n config: PHConnectRuntimeConfig,\n): Promise<PHConnectRuntimeConfig> {\n const composition = config.composition;\n if (!composition) return config;\n\n const definitions = await knownPlugins();\n const present = new Set(composition.map((entry) => entry.module));\n const plugins: ConnectPlugin[] = [];\n\n console.info(\n `${LOG} resolving composition — ${composition.length} entr${composition.length === 1 ? \"y\" : \"ies\"}`,\n );\n for (const entry of composition) {\n const definition: ConnectPluginDefinition | undefined =\n definitions[entry.module];\n if (!definition) {\n console.warn(\n `${LOG} ✗ ${entry.module} — unknown (external plugin loading not wired); SKIPPED`,\n );\n continue;\n }\n const plugin = definition.create(entry.config ?? {});\n plugins.push(plugin);\n const cfgKeys = Object.keys(entry.config ?? {});\n console.info(\n `${LOG} ✓ ${plugin.name} (${entry.module})` +\n (cfgKeys.length ? ` config: {${cfgKeys.join(\", \")}}` : \"\"),\n );\n }\n\n const ordered = resolveOrder(plugins);\n const ctx: ConnectPluginContext = { entryConfig: {} };\n const ran = ordered\n .filter((p) => p.hooks?.transformConnectConfig)\n .map((p) => p.name);\n console.info(\n `${LOG} hook transformConnectConfig → ${ran.length ? ran.join(\", \") : \"(none)\"}`,\n );\n return runTransformHook<PHConnectRuntimeConfig, ConnectPluginContext>(\n \"transformConnectConfig\",\n ordered,\n ctx,\n zeroAbsentSlices(config, present, definitions),\n );\n}\n"],"mappings":";;;;;;;;;;AAsBA,SAAgB,uBACd,SACA;CACA,MAAM,WAAW,mBAAmB;CACpC,IAAI,OAAO,YAAY,YAAY,SAAS,cAAc,KAAK,OAAO;MACjE,OAAO,OAAO,SAAS,SAAS,OAAO;AAC9C;;AAGA,eAAsB,eAA2C;CAC/D,MAAM,WAAW,mBAAmB;CACpC,MAAM,UAAU,SAAS;CACzB,SAAS,gBAAgB,CAAC;CAC1B,KAAK,MAAM,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,SAAS,KAAK,CAAC,CAAC,GAClE,OAAO,OAAO,SAAS,SAAS,MAAM;CAExC,OAAO,SAAS;AAClB;;AAGA,SAAS,iBACP,QACA,SACA,SACwB;CACxB,IAAI,MAAM,EAAE,GAAG,OAAO;CACtB,KAAK,MAAM,CAAC,QAAQ,eAAe,OAAO,QAAQ,OAAO,GACvD,IAAI,CAAC,QAAQ,IAAI,MAAM,KAAK,WAAW,YACrC,MAAM,WAAW,WAAW,GAAG;CAGnC,OAAO;AACT;AAEA,MAAM,MAAM;;;AAIZ,eAAsB,iBACpB,QACiC;CACjC,MAAM,cAAc,OAAO;CAC3B,IAAI,CAAC,aAAa,OAAO;CAEzB,MAAM,cAAc,MAAM,aAAa;CACvC,MAAM,UAAU,IAAI,IAAI,YAAY,KAAK,UAAU,MAAM,MAAM,CAAC;CAChE,MAAM,UAA2B,CAAC;CAElC,QAAQ,KACN,GAAG,IAAI,2BAA2B,YAAY,OAAO,OAAO,YAAY,WAAW,IAAI,MAAM,OAC/F;CACA,KAAK,MAAM,SAAS,aAAa;EAC/B,MAAM,aACJ,YAAY,MAAM;EACpB,IAAI,CAAC,YAAY;GACf,QAAQ,KACN,GAAG,IAAI,OAAO,MAAM,OAAO,wDAC7B;GACA;EACF;EACA,MAAM,SAAS,WAAW,OAAO,MAAM,UAAU,CAAC,CAAC;EACnD,QAAQ,KAAK,MAAM;EACnB,MAAM,UAAU,OAAO,KAAK,MAAM,UAAU,CAAC,CAAC;EAC9C,QAAQ,KACN,GAAG,IAAI,OAAO,OAAO,KAAK,IAAI,MAAM,OAAO,MACxC,QAAQ,SAAS,aAAa,QAAQ,KAAK,IAAI,EAAE,KAAK,GAC3D;CACF;CAEA,MAAM,UAAU,aAAa,OAAO;CACpC,MAAM,MAA4B,EAAE,aAAa,CAAC,EAAE;CACpD,MAAM,MAAM,QACT,QAAQ,MAAM,EAAE,OAAO,sBAAsB,CAAC,CAC9C,KAAK,MAAM,EAAE,IAAI;CACpB,QAAQ,KACN,GAAG,IAAI,iCAAiC,IAAI,SAAS,IAAI,KAAK,IAAI,IAAI,UACxE;CACA,OAAO,iBACL,0BACA,SACA,KACA,iBAAiB,QAAQ,SAAS,WAAW,CAC/C;AACF"}
@@ -1,7 +1,7 @@
1
- import { O as __exportAll } from "./views-Ba9OeN3c.js";
1
+ import { k as __exportAll } from "./views-BtUVboYl.js";
2
2
  import { t as getConnectRegistry } from "./registry-DCZHBP7M.js";
3
3
  import { f as CORE_MODAL_VIEWS, l as removeConnectRoutes, r as addConnectRoutes, u as resolveConnectRoutes } from "./route-tree-D0aszMrk.js";
4
- import { n as knownPlugins } from "./plugin-host-D_EW56IQ.js";
4
+ import { n as knownPlugins } from "./plugin-host-CMr7lN40.js";
5
5
  import { findDriveBySlugOrId, makeDriveSlug, makeNodeSlug, peekDriveNode, resolveDriveRoute } from "@powerhousedao/reactor-browser";
6
6
  import { lazyRouteComponent, notFound, redirect } from "@tanstack/react-router";
7
7
  import { jsx } from "react/jsx-runtime";
@@ -197,4 +197,4 @@ function resetConnectPluginUi(routeTree) {
197
197
  //#endregion
198
198
  export { plugin_ui_exports as a, CoreNotFound as c, isCoreView as d, isDriveNotFound as f, mergeConnectPluginUi as i, coreModals as l, loadNode as m, getConnectPluginUi as n, resetConnectPluginUi as o, loadDrive as p, loadConnectPluginUi as r, CoreError as s, applyConnectPluginUi as t, coreView as u };
199
199
 
200
- //# sourceMappingURL=plugin-ui-fDXhKTCK.js.map
200
+ //# sourceMappingURL=plugin-ui-DHlnXJmN.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-ui-fDXhKTCK.js","names":[],"sources":["../src/router/drive-route-loader.ts","../src/router/core-views.tsx","../src/plugins/plugin-ui.ts"],"sourcesContent":["// The drive routes' loaders. Server-safe: they read everything from router context.\nimport type { DriveArrivals, PHStore } from \"@powerhousedao/reactor-browser\";\nimport {\n findDriveBySlugOrId,\n makeDriveSlug,\n makeNodeSlug,\n peekDriveNode,\n resolveDriveRoute,\n} from \"@powerhousedao/reactor-browser\";\nimport { notFound, redirect } from \"@tanstack/react-router\";\n\nexport type ConnectRouterContext = {\n store: PHStore;\n /** Without it the drive route never waits for drives to arrive. */\n arrivals?: DriveArrivals;\n /** Ends every document title; \"Connect\" without one. */\n appName?: string;\n /** Rendering the loading shell: a layout shows its pendingComponent in place of its page. */\n shell?: boolean;\n};\n\n/** A missing drive's not-found data. */\nexport type DriveNotFoundData = { driveSlug: string };\n\nexport function isDriveNotFound(data: unknown): data is DriveNotFoundData {\n return (\n typeof data === \"object\" &&\n data !== null &&\n typeof (data as { driveSlug?: unknown }).driveSlug === \"string\"\n );\n}\n\n/** What the drive routes resolved their params to. */\nexport type DriveRouteData = { driveId: string; nodeId?: string };\n\nexport type DriveRouteParams = { driveSlug: string; nodeSlug?: string };\n\nexport type DriveLoaderOptions = {\n params: DriveRouteParams;\n context: ConnectRouterContext;\n abortController: AbortController;\n preload: boolean;\n};\n\nfunction resolve(options: DriveLoaderOptions, params: DriveRouteParams) {\n return resolveDriveRoute({\n store: options.context.store,\n arrivals: options.context.arrivals,\n driveSlug: params.driveSlug,\n nodeSlug: params.nodeSlug,\n signal: options.abortController.signal,\n preload: options.preload,\n });\n}\n\n// At the drive layout, so the 404 takes the drive's place in the layout.\nfunction driveNotFound(driveSlug: string) {\n return notFound({\n routeId: \"/_app/d/$driveSlug\" as never,\n data: { driveSlug } satisfies DriveNotFoundData,\n });\n}\n\n/** The drive layout's loader: the drive, or not found once arrivals settle. */\nexport async function loadDrive(\n options: DriveLoaderOptions,\n): Promise<{ driveId: string }> {\n const { driveSlug } = options.params;\n const result = await resolve(options, { driveSlug });\n if (result.kind === \"drive-not-found\") {\n // oxlint-disable-next-line typescript/only-throw-error -- router control flow\n throw driveNotFound(driveSlug);\n }\n return { driveId: result.driveId };\n}\n\n/** The node route's loader: the drive and the open node. An id or an old name\n * in the URL becomes the current slugs; a missing node leads to its drive. */\nexport async function loadNode(\n options: DriveLoaderOptions,\n): Promise<DriveRouteData> {\n const { params, context, preload } = options;\n const result = await resolve(options, params);\n switch (result.kind) {\n case \"drive\": {\n const data: DriveRouteData = result.nodeId\n ? { driveId: result.driveId, nodeId: result.nodeId }\n : { driveId: result.driveId };\n const canonical = canonicalParams(context.store, data);\n // An id, an old name or an old drive id in the URL becomes the current slugs.\n if (\n !preload &&\n canonical &&\n (canonical.driveSlug !== params.driveSlug ||\n canonical.nodeSlug !== (params.nodeSlug || undefined))\n ) {\n // oxlint-disable-next-line typescript/only-throw-error -- router control flow\n throw redirectTo(canonical);\n }\n return data;\n }\n case \"drive-not-found\":\n // oxlint-disable-next-line typescript/only-throw-error -- router control flow\n throw driveNotFound(params.driveSlug);\n case \"node-not-found\":\n // oxlint-disable-next-line typescript/only-throw-error -- router control flow\n throw redirectTo({\n driveSlug:\n canonicalParams(context.store, { driveId: result.driveId })\n ?.driveSlug ?? params.driveSlug,\n nodeSlug: undefined,\n });\n }\n}\n\n// The slugs links write for `data`; unknown while the drive is unlisted.\nfunction canonicalParams(\n store: PHStore,\n data: DriveRouteData,\n): DriveRouteParams | undefined {\n const drive = findDriveBySlugOrId(store, data.driveId);\n if (!drive) return undefined;\n if (!data.nodeId) return { driveSlug: makeDriveSlug(drive) };\n // resolveDriveRoute cached the node it resolved.\n const node = peekDriveNode(drive.header.id, data.nodeId, store);\n if (!node) return undefined;\n return { driveSlug: makeDriveSlug(drive), nodeSlug: makeNodeSlug(node) };\n}\n\n// In place, with the URL's search params and history state (the opened-from index).\nfunction redirectTo(params: DriveRouteParams) {\n return redirect({\n to: \"/d/$driveSlug/{-$nodeSlug}\",\n params,\n search: true,\n state: true,\n replace: true,\n });\n}\n","// The router's one edge to core's views: views never import this module, so\n// loading them lazily makes no import cycle.\nimport type {\n ErrorRouteComponent,\n NotFoundRouteProps,\n RouteComponent,\n} from \"@tanstack/react-router\";\nimport { lazyRouteComponent } from \"@tanstack/react-router\";\nimport type { ComponentType } from \"react\";\nimport { isDriveNotFound } from \"./drive-route-loader.js\";\nimport type { ConnectModals } from \"./modals.js\";\nimport { CORE_MODAL_VIEWS } from \"./modals.js\";\n\n// Core's views load only when a page shows one.\nconst views = () => import(\"@powerhousedao/connect-core/views\");\n\nconst CORE_VIEW = Symbol.for(\"@powerhousedao/connect-core/core-view\");\n\n/** One of core's views, loaded with the route that shows it. */\nexport function coreView(name: keyof Awaited<ReturnType<typeof views>>) {\n return Object.assign(lazyRouteComponent(views, name), {\n [CORE_VIEW]: true,\n }) as RouteComponent;\n}\n\n/** Whether a route's component is one of core's views, which a plugin's UI replaces. */\nexport function isCoreView(component: unknown) {\n return (\n typeof component === \"function\" &&\n (component as { [CORE_VIEW]?: true })[CORE_VIEW] === true\n );\n}\n\nconst NotFoundPage = coreView(\"NotFoundPage\");\nconst DriveNotFoundPage = coreView(\"DriveNotFoundPage\") as ComponentType<{\n driveSlug: string;\n}>;\n\n/** Core's not-found page; a missing drive's names the drive. */\nexport function CoreNotFound({ data }: Partial<NotFoundRouteProps>) {\n return isDriveNotFound(data) ? (\n <DriveNotFoundPage driveSlug={data.driveSlug} />\n ) : (\n <NotFoundPage />\n );\n}\n\n/** Core's view of a route's loader or render error. */\nexport const CoreError = coreView(\"CoreRouteError\") as ErrorRouteComponent;\n\n/** Core's modals, loaded when one opens. */\nexport const coreModals: ConnectModals = Object.fromEntries(\n Object.entries(CORE_MODAL_VIEWS).map(([type, name]) => [\n type,\n coreView(name),\n ]),\n);\n","import type { AnyRoute, ErrorRouteComponent } from \"@tanstack/react-router\";\nimport type { ComponentType } from \"react\";\nimport type { ConnectRouteRegistration } from \"../registry.js\";\nimport { getConnectRegistry } from \"../registry.js\";\nimport type { ConnectModals } from \"../router/modals.js\";\nimport { isCoreView } from \"../router/core-views.js\";\nimport {\n addConnectRoutes,\n removeConnectRoutes,\n resolveConnectRoutes,\n} from \"../router/route-tree.js\";\nimport { knownPlugins } from \"./plugin-host.js\";\nimport type { ConnectPluginUi, ConnectRouteUi } from \"./types.js\";\n\n/** The active plugins' UI; a later plugin's routes and modals win. */\nexport type ConnectPluginUiSet = {\n routes: Record<string, ConnectRouteUi>;\n addRoutes: ConnectRouteRegistration[];\n modals: ConnectModals;\n roots: ComponentType[];\n errorComponent?: ErrorRouteComponent;\n commonEditors: boolean;\n consent: boolean;\n};\n\nconst NO_UI: ConnectPluginUiSet = {\n routes: {},\n addRoutes: [],\n modals: {},\n roots: [],\n commonEditors: false,\n consent: false,\n};\n\nexport function mergeConnectPluginUi(\n uis: readonly ConnectPluginUi[],\n): ConnectPluginUiSet {\n const set: ConnectPluginUiSet = {\n routes: {},\n addRoutes: [],\n modals: {},\n roots: [],\n commonEditors: false,\n consent: false,\n };\n for (const ui of uis) {\n for (const [id, route] of Object.entries(ui.routes ?? {})) {\n set.routes[id] = { ...set.routes[id], ...route };\n }\n if (ui.addRoutes) set.addRoutes.push(ui.addRoutes);\n Object.assign(set.modals, ui.modals);\n if (ui.Root) set.roots.push(ui.Root);\n set.errorComponent = ui.errorComponent ?? set.errorComponent;\n set.commonEditors ||= ui.commonEditors ?? false;\n set.consent ||= ui.consent ?? false;\n }\n return set;\n}\n\n/** Loads the UI of the plugins `composition` names, or of every known plugin\n * without one (classic Connect), and keeps it for `getConnectPluginUi`. */\nexport async function loadConnectPluginUi(\n composition: readonly { module: string }[] | undefined,\n): Promise<ConnectPluginUiSet> {\n const definitions = await knownPlugins();\n const modules = composition\n ? composition.map((entry) => entry.module)\n : Object.keys(definitions);\n const uis = await Promise.all(\n modules.map(\n (module) => definitions[module]?.ui?.() ?? Promise.resolve(undefined),\n ),\n );\n const set = mergeConnectPluginUi(\n uis.filter((ui): ui is ConnectPluginUi => !!ui),\n );\n getConnectRegistry().ui = set;\n return set;\n}\n\n/** The active plugins' UI; none until `loadRuntimeConfig` has loaded it. */\nexport function getConnectPluginUi(): ConnectPluginUiSet {\n return getConnectRegistry().ui ?? NO_UI;\n}\n\ntype RouteOptions = Record<string, unknown> & { id?: string; path?: string };\n\nconst ROOT_ID = \"__root__\";\n\nfunction forEachRoute(\n route: AnyRoute,\n visit: (route: AnyRoute, id: string) => void,\n parentId?: string,\n) {\n const options = route.options as unknown as RouteOptions;\n const segment = options.id ?? options.path;\n const own =\n parentId === undefined || segment === undefined\n ? ROOT_ID\n : `${parentId === ROOT_ID ? \"\" : parentId}/${segment.replace(/^\\//, \"\")}`;\n visit(route, own);\n for (const child of (route.children ?? []) as AnyRoute[]) {\n forEachRoute(child, visit, own);\n }\n}\n\ntype Applied = { originals: Map<AnyRoute, RouteOptions>; added: AnyRoute[] };\nconst appliedTo = new WeakMap<AnyRoute, Applied>();\n\n/** Sets `ui`'s route options on the tree's routes that still show core's view,\n * and adds its routes; `resetConnectPluginUi` undoes both. */\nexport function applyConnectPluginUi(\n routeTree: AnyRoute,\n ui: ConnectPluginUiSet = getConnectPluginUi(),\n) {\n resetConnectPluginUi(routeTree);\n const applied: Applied = { originals: new Map(), added: [] };\n forEachRoute(routeTree, (route, id) => {\n const routeUi = ui.routes[id];\n const options = route.options as unknown as RouteOptions;\n if (!routeUi || !isCoreView(options.component)) return;\n const { staticData, ...views } = routeUi;\n const keys = [...Object.keys(views), ...(staticData ? [\"staticData\"] : [])];\n applied.originals.set(\n route,\n Object.fromEntries(keys.map((key) => [key, options[key]])),\n );\n Object.assign(options, views);\n if (staticData) {\n options.staticData = {\n ...(options.staticData as object | undefined),\n ...staticData,\n };\n }\n });\n for (const registration of ui.addRoutes) {\n const routes = resolveConnectRoutes(registration, routeTree);\n addConnectRoutes(routes);\n applied.added.push(...routes);\n }\n appliedTo.set(routeTree, applied);\n}\n\n/** Restores the routes `applyConnectPluginUi` changed and removes the ones it added. */\nexport function resetConnectPluginUi(routeTree: AnyRoute) {\n const applied = appliedTo.get(routeTree);\n if (!applied) return;\n for (const [route, originals] of applied.originals) {\n Object.assign(route.options, originals);\n }\n removeConnectRoutes(applied.added);\n appliedTo.delete(routeTree);\n}\n"],"mappings":";;;;;;;;AAwBA,SAAgB,gBAAgB,MAA0C;CACxE,OACE,OAAO,SAAS,YAChB,SAAS,QACT,OAAQ,KAAiC,cAAc;AAE3D;AAcA,SAAS,QAAQ,SAA6B,QAA0B;CACtE,OAAO,kBAAkB;EACvB,OAAO,QAAQ,QAAQ;EACvB,UAAU,QAAQ,QAAQ;EAC1B,WAAW,OAAO;EAClB,UAAU,OAAO;EACjB,QAAQ,QAAQ,gBAAgB;EAChC,SAAS,QAAQ;CACnB,CAAC;AACH;AAGA,SAAS,cAAc,WAAmB;CACxC,OAAO,SAAS;EACd,SAAS;EACT,MAAM,EAAE,UAAU;CACpB,CAAC;AACH;;AAGA,eAAsB,UACpB,SAC8B;CAC9B,MAAM,EAAE,cAAc,QAAQ;CAC9B,MAAM,SAAS,MAAM,QAAQ,SAAS,EAAE,UAAU,CAAC;CACnD,IAAI,OAAO,SAAS,mBAElB,MAAM,cAAc,SAAS;CAE/B,OAAO,EAAE,SAAS,OAAO,QAAQ;AACnC;;;AAIA,eAAsB,SACpB,SACyB;CACzB,MAAM,EAAE,QAAQ,SAAS,YAAY;CACrC,MAAM,SAAS,MAAM,QAAQ,SAAS,MAAM;CAC5C,QAAQ,OAAO,MAAf;EACE,KAAK,SAAS;GACZ,M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QAAQ;GACZ,GAAG;EACL;CAEJ,CAAC;CACD,KAAK,MAAM,gBAAgB,GAAG,WAAW;EACvC,MAAM,SAAS,qBAAqB,cAAc,SAAS;EAC3D,iBAAiB,MAAM;EACvB,QAAQ,MAAM,KAAK,GAAG,MAAM;CAC9B;CACA,UAAU,IAAI,WAAW,OAAO;AAClC;;AAGA,SAAgB,qBAAqB,WAAqB;CACxD,MAAM,UAAU,UAAU,IAAI,SAAS;CACvC,IAAI,CAAC,SAAS;CACd,KAAK,MAAM,CAAC,OAAO,cAAc,QAAQ,WACvC,OAAO,OAAO,MAAM,SAAS,SAAS;CAExC,oBAAoB,QAAQ,KAAK;CACjC,UAAU,OAAO,SAAS;AAC5B"}
1
+ {"version":3,"file":"plugin-ui-DHlnXJmN.js","names":[],"sources":["../src/router/drive-route-loader.ts","../src/router/core-views.tsx","../src/plugins/plugin-ui.ts"],"sourcesContent":["// The drive routes' loaders. Server-safe: they read everything from router context.\nimport type { DriveArrivals, PHStore } from \"@powerhousedao/reactor-browser\";\nimport {\n findDriveBySlugOrId,\n makeDriveSlug,\n makeNodeSlug,\n peekDriveNode,\n resolveDriveRoute,\n} from \"@powerhousedao/reactor-browser\";\nimport { notFound, redirect } from \"@tanstack/react-router\";\n\nexport type ConnectRouterContext = {\n store: PHStore;\n /** Without it the drive route never waits for drives to arrive. */\n arrivals?: DriveArrivals;\n /** Ends every document title; \"Connect\" without one. */\n appName?: string;\n /** Rendering the loading shell: a layout shows its pendingComponent in place of its page. */\n shell?: boolean;\n};\n\n/** A missing drive's not-found data. */\nexport type DriveNotFoundData = { driveSlug: string };\n\nexport function isDriveNotFound(data: unknown): data is DriveNotFoundData {\n return (\n typeof data === \"object\" &&\n data !== null &&\n typeof (data as { driveSlug?: unknown }).driveSlug === \"string\"\n );\n}\n\n/** What the drive routes resolved their params to. */\nexport type DriveRouteData = { driveId: string; nodeId?: string };\n\nexport type DriveRouteParams = { driveSlug: string; nodeSlug?: string };\n\nexport type DriveLoaderOptions = {\n params: DriveRouteParams;\n context: ConnectRouterContext;\n abortController: AbortController;\n preload: boolean;\n};\n\nfunction resolve(options: DriveLoaderOptions, params: DriveRouteParams) {\n return resolveDriveRoute({\n store: options.context.store,\n arrivals: options.context.arrivals,\n driveSlug: params.driveSlug,\n nodeSlug: params.nodeSlug,\n signal: options.abortController.signal,\n preload: options.preload,\n });\n}\n\n// At the drive layout, so the 404 takes the drive's place in the layout.\nfunction driveNotFound(driveSlug: string) {\n return notFound({\n routeId: \"/_app/d/$driveSlug\" as never,\n data: { driveSlug } satisfies DriveNotFoundData,\n });\n}\n\n/** The drive layout's loader: the drive, or not found once arrivals settle. */\nexport async function loadDrive(\n options: DriveLoaderOptions,\n): Promise<{ driveId: string }> {\n const { driveSlug } = options.params;\n const result = await resolve(options, { driveSlug });\n if (result.kind === \"drive-not-found\") {\n // oxlint-disable-next-line typescript/only-throw-error -- router control flow\n throw driveNotFound(driveSlug);\n }\n return { driveId: result.driveId };\n}\n\n/** The node route's loader: the drive and the open node. An id or an old name\n * in the URL becomes the current slugs; a missing node leads to its drive. */\nexport async function loadNode(\n options: DriveLoaderOptions,\n): Promise<DriveRouteData> {\n const { params, context, preload } = options;\n const result = await resolve(options, params);\n switch (result.kind) {\n case \"drive\": {\n const data: DriveRouteData = result.nodeId\n ? { driveId: result.driveId, nodeId: result.nodeId }\n : { driveId: result.driveId };\n const canonical = canonicalParams(context.store, data);\n // An id, an old name or an old drive id in the URL becomes the current slugs.\n if (\n !preload &&\n canonical &&\n (canonical.driveSlug !== params.driveSlug ||\n canonical.nodeSlug !== (params.nodeSlug || undefined))\n ) {\n // oxlint-disable-next-line typescript/only-throw-error -- router control flow\n throw redirectTo(canonical);\n }\n return data;\n }\n case \"drive-not-found\":\n // oxlint-disable-next-line typescript/only-throw-error -- router control flow\n throw driveNotFound(params.driveSlug);\n case \"node-not-found\":\n // oxlint-disable-next-line typescript/only-throw-error -- router control flow\n throw redirectTo({\n driveSlug:\n canonicalParams(context.store, { driveId: result.driveId })\n ?.driveSlug ?? params.driveSlug,\n nodeSlug: undefined,\n });\n }\n}\n\n// The slugs links write for `data`; unknown while the drive is unlisted.\nfunction canonicalParams(\n store: PHStore,\n data: DriveRouteData,\n): DriveRouteParams | undefined {\n const drive = findDriveBySlugOrId(store, data.driveId);\n if (!drive) return undefined;\n if (!data.nodeId) return { driveSlug: makeDriveSlug(drive) };\n // resolveDriveRoute cached the node it resolved.\n const node = peekDriveNode(drive.header.id, data.nodeId, store);\n if (!node) return undefined;\n return { driveSlug: makeDriveSlug(drive), nodeSlug: makeNodeSlug(node) };\n}\n\n// In place, with the URL's search params and history state (the opened-from index).\nfunction redirectTo(params: DriveRouteParams) {\n return redirect({\n to: \"/d/$driveSlug/{-$nodeSlug}\",\n params,\n search: true,\n state: true,\n replace: true,\n });\n}\n","// The router's one edge to core's views: views never import this module, so\n// loading them lazily makes no import cycle.\nimport type {\n ErrorRouteComponent,\n NotFoundRouteProps,\n RouteComponent,\n} from \"@tanstack/react-router\";\nimport { lazyRouteComponent } from \"@tanstack/react-router\";\nimport type { ComponentType } from \"react\";\nimport { isDriveNotFound } from \"./drive-route-loader.js\";\nimport type { ConnectModals } from \"./modals.js\";\nimport { CORE_MODAL_VIEWS } from \"./modals.js\";\n\n// Core's views load only when a page shows one.\nconst views = () => import(\"@powerhousedao/connect-core/views\");\n\nconst CORE_VIEW = Symbol.for(\"@powerhousedao/connect-core/core-view\");\n\n/** One of core's views, loaded with the route that shows it. */\nexport function coreView(name: keyof Awaited<ReturnType<typeof views>>) {\n return Object.assign(lazyRouteComponent(views, name), {\n [CORE_VIEW]: true,\n }) as RouteComponent;\n}\n\n/** Whether a route's component is one of core's views, which a plugin's UI replaces. */\nexport function isCoreView(component: unknown) {\n return (\n typeof component === \"function\" &&\n (component as { [CORE_VIEW]?: true })[CORE_VIEW] === true\n );\n}\n\nconst NotFoundPage = coreView(\"NotFoundPage\");\nconst DriveNotFoundPage = coreView(\"DriveNotFoundPage\") as ComponentType<{\n driveSlug: string;\n}>;\n\n/** Core's not-found page; a missing drive's names the drive. */\nexport function CoreNotFound({ data }: Partial<NotFoundRouteProps>) {\n return isDriveNotFound(data) ? (\n <DriveNotFoundPage driveSlug={data.driveSlug} />\n ) : (\n <NotFoundPage />\n );\n}\n\n/** Core's view of a route's loader or render error. */\nexport const CoreError = coreView(\"CoreRouteError\") as ErrorRouteComponent;\n\n/** Core's modals, loaded when one opens. */\nexport const coreModals: ConnectModals = Object.fromEntries(\n Object.entries(CORE_MODAL_VIEWS).map(([type, name]) => [\n type,\n coreView(name),\n ]),\n);\n","import type { AnyRoute, ErrorRouteComponent } from \"@tanstack/react-router\";\nimport type { ComponentType } from \"react\";\nimport type { ConnectRouteRegistration } from \"../registry.js\";\nimport { getConnectRegistry } from \"../registry.js\";\nimport type { ConnectModals } from \"../router/modals.js\";\nimport { isCoreView } from \"../router/core-views.js\";\nimport {\n addConnectRoutes,\n removeConnectRoutes,\n resolveConnectRoutes,\n} from \"../router/route-tree.js\";\nimport { knownPlugins } from \"./plugin-host.js\";\nimport type { ConnectPluginUi, ConnectRouteUi } from \"./types.js\";\n\n/** The active plugins' UI; a later plugin's routes and modals win. */\nexport type ConnectPluginUiSet = {\n routes: Record<string, ConnectRouteUi>;\n addRoutes: ConnectRouteRegistration[];\n modals: ConnectModals;\n roots: ComponentType[];\n errorComponent?: ErrorRouteComponent;\n commonEditors: boolean;\n consent: boolean;\n};\n\nconst NO_UI: ConnectPluginUiSet = {\n routes: {},\n addRoutes: [],\n modals: {},\n roots: [],\n commonEditors: false,\n consent: false,\n};\n\nexport function mergeConnectPluginUi(\n uis: readonly ConnectPluginUi[],\n): ConnectPluginUiSet {\n const set: ConnectPluginUiSet = {\n routes: {},\n addRoutes: [],\n modals: {},\n roots: [],\n commonEditors: false,\n consent: false,\n };\n for (const ui of uis) {\n for (const [id, route] of Object.entries(ui.routes ?? {})) {\n set.routes[id] = { ...set.routes[id], ...route };\n }\n if (ui.addRoutes) set.addRoutes.push(ui.addRoutes);\n Object.assign(set.modals, ui.modals);\n if (ui.Root) set.roots.push(ui.Root);\n set.errorComponent = ui.errorComponent ?? set.errorComponent;\n set.commonEditors ||= ui.commonEditors ?? false;\n set.consent ||= ui.consent ?? false;\n }\n return set;\n}\n\n/** Loads the UI of the plugins `composition` names, or of every known plugin\n * without one (classic Connect), and keeps it for `getConnectPluginUi`. */\nexport async function loadConnectPluginUi(\n composition: readonly { module: string }[] | undefined,\n): Promise<ConnectPluginUiSet> {\n const definitions = await knownPlugins();\n const modules = composition\n ? composition.map((entry) => entry.module)\n : Object.keys(definitions);\n const uis = await Promise.all(\n modules.map(\n (module) => definitions[module]?.ui?.() ?? Promise.resolve(undefined),\n ),\n );\n const set = mergeConnectPluginUi(\n uis.filter((ui): ui is ConnectPluginUi => !!ui),\n );\n getConnectRegistry().ui = set;\n return set;\n}\n\n/** The active plugins' UI; none until `loadRuntimeConfig` has loaded it. */\nexport function getConnectPluginUi(): ConnectPluginUiSet {\n return getConnectRegistry().ui ?? NO_UI;\n}\n\ntype RouteOptions = Record<string, unknown> & { id?: string; path?: string };\n\nconst ROOT_ID = \"__root__\";\n\nfunction forEachRoute(\n route: AnyRoute,\n visit: (route: AnyRoute, id: string) => void,\n parentId?: string,\n) {\n const options = route.options as unknown as RouteOptions;\n const segment = options.id ?? options.path;\n const own =\n parentId === undefined || segment === undefined\n ? ROOT_ID\n : `${parentId === ROOT_ID ? \"\" : parentId}/${segment.replace(/^\\//, \"\")}`;\n visit(route, own);\n for (const child of (route.children ?? []) as AnyRoute[]) {\n forEachRoute(child, visit, own);\n }\n}\n\ntype Applied = { originals: Map<AnyRoute, RouteOptions>; added: AnyRoute[] };\nconst appliedTo = new WeakMap<AnyRoute, Applied>();\n\n/** Sets `ui`'s route options on the tree's routes that still show core's view,\n * and adds its routes; `resetConnectPluginUi` undoes both. */\nexport function applyConnectPluginUi(\n routeTree: AnyRoute,\n ui: ConnectPluginUiSet = getConnectPluginUi(),\n) {\n resetConnectPluginUi(routeTree);\n const applied: Applied = { originals: new Map(), added: [] };\n forEachRoute(routeTree, (route, id) => {\n const routeUi = ui.routes[id];\n const options = route.options as unknown as RouteOptions;\n if (!routeUi || !isCoreView(options.component)) return;\n const { staticData, ...views } = routeUi;\n const keys = [...Object.keys(views), ...(staticData ? [\"staticData\"] : [])];\n applied.originals.set(\n route,\n Object.fromEntries(keys.map((key) => [key, options[key]])),\n );\n Object.assign(options, views);\n if (staticData) {\n options.staticData = {\n ...(options.staticData as object | undefined),\n ...staticData,\n };\n }\n });\n for (const registration of ui.addRoutes) {\n const routes = resolveConnectRoutes(registration, routeTree);\n addConnectRoutes(routes);\n applied.added.push(...routes);\n }\n appliedTo.set(routeTree, applied);\n}\n\n/** Restores the routes `applyConnectPluginUi` changed and removes the ones it added. */\nexport function resetConnectPluginUi(routeTree: AnyRoute) {\n const applied = appliedTo.get(routeTree);\n if (!applied) return;\n for (const [route, originals] of applied.originals) {\n Object.assign(route.options, originals);\n }\n removeConnectRoutes(applied.added);\n appliedTo.delete(routeTree);\n}\n"],"mappings":";;;;;;;;AAwBA,SAAgB,gBAAgB,MAA0C;CACxE,OACE,OAAO,SAAS,YAChB,SAAS,QACT,OAAQ,KAAiC,cAAc;AAE3D;AAcA,SAAS,QAAQ,SAA6B,QAA0B;CACtE,OAAO,kBAAkB;EACvB,OAAO,QAAQ,QAAQ;EACvB,UAAU,QAAQ,QAAQ;EAC1B,WAAW,OAAO;EAClB,UAAU,OAAO;EACjB,QAAQ,QAAQ,gBAAgB;EAChC,SAAS,QAAQ;CACnB,CAAC;AACH;AAGA,SAAS,cAAc,WAAmB;CACxC,OAAO,SAAS;EACd,SAAS;EACT,MAAM,EAAE,UAAU;CACpB,CAAC;AACH;;AAGA,eAAsB,UACpB,SAC8B;CAC9B,MAAM,EAAE,cAAc,QAAQ;CAC9B,MAAM,SAAS,MAAM,QAAQ,SAAS,EAAE,UAAU,CAAC;CACnD,IAAI,OAAO,SAAS,mBAElB,MAAM,cAAc,SAAS;CAE/B,O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AI,CAAC,CAAE;EAC1E,QAAQ,UAAU,IAChB,OACA,OAAO,YAAY,KAAK,KAAK,QAAQ,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAC3D;EACA,OAAO,OAAO,SAAS,KAAK;EAC5B,IAAI,YACF,QAAQ,aAAa;GACnB,GAAI,QAAQ;GACZ,GAAG;EACL;CAEJ,CAAC;CACD,KAAK,MAAM,gBAAgB,GAAG,WAAW;EACvC,MAAM,SAAS,qBAAqB,cAAc,SAAS;EAC3D,iBAAiB,MAAM;EACvB,QAAQ,MAAM,KAAK,GAAG,MAAM;CAC9B;CACA,UAAU,IAAI,WAAW,OAAO;AAClC;;AAGA,SAAgB,qBAAqB,WAAqB;CACxD,MAAM,UAAU,UAAU,IAAI,SAAS;CACvC,IAAI,CAAC,SAAS;CACd,KAAK,MAAM,CAAC,OAAO,cAAc,QAAQ,WACvC,OAAO,OAAO,MAAM,SAAS,SAAS;CAExC,oBAAoB,QAAQ,KAAK;CACjC,UAAU,OAAO,SAAS;AAC5B"}
package/dist/plugins.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as mergeConnectPluginUi, n as getConnectPluginUi, o as resetConnectPluginUi, r as loadConnectPluginUi, t as applyConnectPluginUi } from "./plugin-ui-fDXhKTCK.js";
2
- import { i as registerConnectPlugins, n as knownPlugins, t as applyComposition } from "./plugin-host-D_EW56IQ.js";
1
+ import { i as mergeConnectPluginUi, n as getConnectPluginUi, o as resetConnectPluginUi, r as loadConnectPluginUi, t as applyConnectPluginUi } from "./plugin-ui-DHlnXJmN.js";
2
+ import { i as registerConnectPlugins, n as knownPlugins, t as applyComposition } from "./plugin-host-CMr7lN40.js";
3
3
  import { n as isPluginActive, t as getActivePluginModules } from "./plugins-x1XqLPzp.js";
4
4
  export { applyComposition, applyConnectPluginUi, getActivePluginModules, getConnectPluginUi, isPluginActive, knownPlugins, loadConnectPluginUi, mergeConnectPluginUi, registerConnectPlugins, resetConnectPluginUi };
@@ -1 +1 @@
1
- {"version":3,"file":"route-tree-D0aszMrk.js","names":[],"sources":["../src/router/modal-frame.tsx","../src/router/modals.tsx","../src/router/route-tree.ts"],"sourcesContent":["import { closePHModal } from \"@powerhousedao/reactor-browser\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { createContext, useContext, useEffect, useRef } from \"react\";\n\n/** What a modal frame lays out: the modal's title, its content and its buttons. */\nexport type ModalFrameProps = {\n title: string;\n /** The title element's id, for the dialog's `aria-labelledby`. */\n titleId: string;\n actions: ReactNode;\n children: ReactNode;\n};\n\ndeclare module \"@tanstack/react-router\" {\n interface StaticDataRouteOption {\n /** Frames every core modal while the route matches; the deepest wins. */\n modalFrame?: ComponentType<ModalFrameProps>;\n }\n}\n\nexport const ModalFrameContext = createContext<\n ComponentType<ModalFrameProps> | undefined\n>(undefined);\n\n/** The frame the matched routes set, if any. */\nexport function useModalFrame() {\n return useContext(ModalFrameContext);\n}\n\n/** A modal `<dialog>`: it opens as a modal, and Escape or a click on the\n * backdrop closes the open modal. */\nexport function ModalDialog(props: {\n labelledBy: string;\n className?: string;\n children: ReactNode;\n}) {\n const ref = useRef<HTMLDialogElement>(null);\n useEffect(() => {\n const dialog = ref.current;\n if (dialog && !dialog.open) dialog.showModal();\n }, []);\n return (\n <dialog\n ref={ref}\n aria-labelledby={props.labelledBy}\n onCancel={(event) => {\n event.preventDefault();\n closePHModal();\n }}\n onClick={(event) => {\n if (event.target === event.currentTarget) closePHModal();\n }}\n // Tailwind's reset drops the margin that centres a modal dialog.\n className={props.className ? `m-auto ${props.className}` : \"m-auto\"}\n >\n {props.children}\n </dialog>\n );\n}\n","import type { PHModal } from \"@powerhousedao/reactor-browser\";\nimport { usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { useMatches } from \"@tanstack/react-router\";\nimport type { ComponentType, ErrorInfo, ReactNode } from \"react\";\nimport { Component, createElement, Suspense } from \"react\";\nimport type * as ModalViews from \"../views/modals.js\";\nimport type { ModalFrameProps } from \"./modal-frame.js\";\nimport { ModalFrameContext } from \"./modal-frame.js\";\n\n/** Modal views by modal type. Each reads the open modal with `usePHModal()`. */\nexport type ConnectModals = Partial<Record<PHModal[\"type\"], ComponentType>>;\n\ndeclare module \"@tanstack/react-router\" {\n interface StaticDataRouteOption {\n /** Replaces the host's view of these modals while the route matches. */\n modals?: ConnectModals;\n }\n}\n\n/** Core's modals: the ones editors, drive apps and the reactor open, so every\n * host has them. Each names its view in `@powerhousedao/connect-core/views`. */\nexport const CORE_MODAL_VIEWS = {\n createDocument: \"CreateDocumentModal\",\n login: \"LoginModal\",\n deleteItem: \"DeleteItemModal\",\n confirmDocumentUpgrade: \"ConfirmDocumentUpgradeModal\",\n downloadDocumentWithErrors: \"DownloadDocumentWithErrorsModal\",\n documentVersionUnsupported: \"DocumentVersionUnsupportedModal\",\n driveAuthRequired: \"DriveAuthRequiredModal\",\n} as const satisfies Partial<Record<PHModal[\"type\"], keyof typeof ModalViews>>;\n\ntype BoundaryProps = { modal: string; children: ReactNode };\n\n// A broken modal closes quietly instead of taking the page down; keyed by\n// modal, so the next one gets a fresh try.\nclass ModalErrorBoundary extends Component<BoundaryProps, { failed: boolean }> {\n state = { failed: false };\n\n static getDerivedStateFromError() {\n return { failed: true };\n }\n\n componentDidCatch(error: unknown, info: ErrorInfo) {\n console.error(\n `[connect] the ${this.props.modal} modal failed:`,\n error,\n info,\n );\n }\n\n render() {\n return this.state.failed ? null : this.props.children;\n }\n}\n\n/** The open modal's view: the deepest matched route's `staticData.modals`\n * entry for it, else `modals`', in the deepest `staticData.modalFrame`. */\nexport function ModalOutlet({ modals }: { modals: ConnectModals }) {\n const type = usePHModal()?.type;\n const routed = useMatches({\n select: (matches) =>\n type &&\n matches.reduce<ComponentType | undefined>(\n (found, match) => match.staticData.modals?.[type] ?? found,\n undefined,\n ),\n });\n const frame = useMatches({\n select: (matches) =>\n matches.reduce<ComponentType<ModalFrameProps> | undefined>(\n (found, match) => match.staticData.modalFrame ?? found,\n undefined,\n ),\n });\n const View = routed || (type && modals[type]);\n if (!type || !View) return null;\n return (\n <ModalErrorBoundary key={type} modal={type}>\n <ModalFrameContext.Provider value={frame}>\n <Suspense name=\"Modal\" fallback={null}>\n {/* A registered view, not one made here. */}\n {createElement(View)}\n </Suspense>\n </ModalFrameContext.Provider>\n </ModalErrorBoundary>\n );\n}\n","// The app's route tree: core's own, or a project's generated one when its\n// tsconfig maps this specifier to the tree.\nimport type { AnyRoute } from \"@tanstack/react-router\";\nimport { useRouter } from \"@tanstack/react-router\";\nimport { useSyncExternalStore } from \"react\";\nimport type {\n FileRoutesById,\n routeTree as appRouteTree,\n} from \"@powerhousedao/connect-core/route-tree\";\nimport type {\n ConnectRouteEntry,\n ConnectRouteRegistration,\n} from \"../registry.js\";\nimport {\n getConnectRegistry,\n notifyConnectRegistry,\n subscribeConnectRegistry,\n} from \"../registry.js\";\nimport type { DRIVE_ROUTE_ID, NODE_ROUTE_ID } from \"./route-data.js\";\n\nexport { DRIVE_PENDING_MS } from \"./route-components.js\";\nexport type { ConnectRouteRegistration } from \"../registry.js\";\n\n/** The home route's id; a tree change that moves it is a type error here. */\nexport const HOME_ROUTE_ID = \"/_app/\" satisfies keyof FileRoutesById;\n/** The `_app` layout's id; a project's _app/ routes nest in it. */\nexport const APP_ROUTE_ID = \"/_app\";\nconst SETTINGS_ROUTE_ID = \"/_app/settings\";\n\ntype RouteOptions = { id?: string; path?: string };\n\n// Generated routes carry their full id only once a router initialises them.\nfunction findChild(parent: AnyRoute, idOrPath: string) {\n const children = (parent.children ?? []) as AnyRoute[];\n const child = children.find((route) => {\n const options = route.options as RouteOptions;\n return options.id === idOrPath || options.path === idOrPath;\n });\n if (!child) throw new Error(`Connect's route tree lacks ${idOrPath}`);\n return child;\n}\n\n// Named, so declarations name the tree instead of inlining its type.\nexport type ConnectRootRoute = typeof appRouteTree;\nexport type ConnectRoutes = {\n routeTree: ConnectRootRoute;\n rootRoute: ConnectRootRoute;\n appRoute: FileRoutesById[typeof APP_ROUTE_ID];\n homeRoute: FileRoutesById[typeof HOME_ROUTE_ID];\n /** The drive layout, around the node route. */\n driveRoute: FileRoutesById[typeof DRIVE_ROUTE_ID];\n /** The open folder or document; the drive's root without a node. */\n nodeRoute: FileRoutesById[typeof NODE_ROUTE_ID];\n settingsRoute: FileRoutesById[typeof SETTINGS_ROUTE_ID];\n};\n\n/** Connect's routes in `routeTree`, core's or a project's generated one, which\n * holds the same routes. Deployment routes attach to these. */\nexport function connectRoutes(routeTree: AnyRoute): ConnectRoutes {\n const appRoute = findChild(routeTree, APP_ROUTE_ID);\n const driveRoute = findChild(appRoute, \"/d/$driveSlug\");\n return {\n routeTree: routeTree as ConnectRootRoute,\n rootRoute: routeTree as ConnectRootRoute,\n appRoute: appRoute as ConnectRoutes[\"appRoute\"],\n homeRoute: findChild(appRoute, \"/\") as ConnectRoutes[\"homeRoute\"],\n driveRoute: driveRoute as ConnectRoutes[\"driveRoute\"],\n nodeRoute: findChild(\n driveRoute,\n \"/{-$nodeSlug}\",\n ) as ConnectRoutes[\"nodeRoute\"],\n settingsRoute: findChild(\n appRoute,\n \"/settings\",\n ) as ConnectRoutes[\"settingsRoute\"],\n };\n}\n\n/** Code routes, e.g. `createRoute({ getParentRoute: () => rootRoute })`, join\n * their parent's file routes; an embedding app without the router plugin adds routes so. */\nexport function addConnectRoutes(routes: readonly AnyRoute[]) {\n for (const route of routes) {\n const parent = route.options.getParentRoute() as AnyRoute | undefined;\n if (!parent) throw new Error(\"A Connect route needs getParentRoute\");\n const children = (parent.children ?? []) as AnyRoute[];\n if (children.includes(route)) continue;\n // A project's file route at its path replaces it, as documented: no warning.\n const path = (route.options as RouteOptions).path;\n if (path && children.some((child) => samePath(child, path))) continue;\n parent.addChildren([...children, route]);\n }\n}\n\nconst trimSlashes = (path: string) => path.replace(/^\\/+|\\/+$/g, \"\");\n\nfunction samePath(route: AnyRoute, path: string) {\n const own = (route.options as RouteOptions).path;\n return own !== undefined && trimSlashes(own) === trimSlashes(path);\n}\n\n/** Takes `routes` out of their parents, e.g. when the module that made them is replaced. */\nexport function removeConnectRoutes(routes: readonly AnyRoute[]) {\n for (const route of routes) {\n const parent = route.options.getParentRoute() as AnyRoute | undefined;\n const children = (parent?.children ?? []) as AnyRoute[];\n if (children.includes(route)) {\n parent?.addChildren(children.filter((child) => child !== route));\n }\n }\n}\n\n/** The routes `registration` gives for `tree`'s core routes. */\nexport function resolveConnectRoutes(\n registration: ConnectRouteRegistration,\n tree: AnyRoute,\n): readonly AnyRoute[] {\n return typeof registration === \"function\"\n ? registration(connectRoutes(tree))\n : registration;\n}\n\n/** Adds code routes to the app's router, e.g. a package's settings tab below\n * `settingsRoute`; a running router takes them in. Returns the unregister. */\nexport function registerConnectRoutes(\n registration: ConnectRouteRegistration,\n): () => void {\n const registry = getConnectRegistry();\n const entry: ConnectRouteEntry = { registration, added: [] };\n registry.routes = [...registry.routes, entry];\n const bound = registry.app;\n if (bound) {\n const tree = bound.bundle.router.routeTree;\n entry.added = [...resolveConnectRoutes(registration, tree)];\n addConnectRoutes(entry.added);\n rebuildRoutes(bound.bundle.router);\n }\n return () => {\n registry.routes = registry.routes.filter((other) => other !== entry);\n const router = registry.app?.bundle.router;\n const ids = new Set<string>(entry.added.map((route) => route.id as string));\n const remove = () => {\n // The router reads a cached match's route later; those go with them.\n router?.clearCache({ filter: (match) => ids.has(match.routeId) });\n removeConnectRoutes(entry.added);\n if (router) rebuildRoutes(router);\n };\n // Leaving a route needs it: from one of these, go home before they go.\n const open = router?.state.matches.some((match) => ids.has(match.routeId));\n if (router && open) {\n void router.navigate({ to: \"/\", replace: true }).then(remove);\n } else {\n remove();\n }\n };\n}\n\n/** A file route a package offers to other Connects; `ph build` generates the\n * list from its hosts/connect/routes, parents before children. */\nexport type PackageRoute = {\n route: AnyRoute;\n /** The route's full id, e.g. `/_app/reports`. */\n id: string;\n /** Its path below its parent, e.g. `/reports`; none for a pathless layout. */\n path?: string;\n /** Its parent's full id: a Connect route's, or one of the package's. */\n parentId: string;\n};\n\nconst ROOT_ID = \"__root__\";\n\n// Before a router initialises a tree, its ids are only in the routes' options.\nfunction findRouteById(tree: AnyRoute, id: string): AnyRoute | undefined {\n if (id === ROOT_ID) return tree;\n const walk = (route: AnyRoute, routeId: string): AnyRoute | undefined => {\n for (const child of (route.children ?? []) as AnyRoute[]) {\n const options = child.options as RouteOptions;\n const own = options.id ?? options.path ?? \"\";\n const childId = `${routeId}${own.startsWith(\"/\") ? \"\" : \"/\"}${own}`;\n if (childId === id) return child;\n if (id.startsWith(childId)) {\n const found = walk(child, childId);\n if (found) return found;\n }\n }\n return undefined;\n };\n return walk(tree, \"\");\n}\n\nfunction routeHolds() {\n const registry = getConnectRegistry();\n registry.routeHolds ??= { count: 0, settled: new Set() };\n return registry.routeHolds;\n}\n\n/** Marks routes as still loading, e.g. a package's; unknown paths wait for\n * them before showing not found. Returns the release. */\nexport function holdConnectRoutes() {\n const holds = routeHolds();\n holds.count++;\n let released = false;\n return () => {\n if (released) return;\n released = true;\n holds.count--;\n if (holds.count > 0) return;\n for (const settle of holds.settled) settle();\n holds.settled.clear();\n };\n}\n\n/** Resolves once no routes are loading, or after `timeoutMs`. */\nexport function connectRoutesSettled(timeoutMs = 10_000) {\n const holds = routeHolds();\n if (holds.count === 0) return Promise.resolve();\n return new Promise<void>((resolve) => {\n const settle = () => {\n clearTimeout(timer);\n holds.settled.delete(settle);\n resolve();\n };\n const timer = setTimeout(settle, timeoutMs);\n holds.settled.add(settle);\n });\n}\n\n/** Adds a package's file routes below the app's routes with the same ids; a\n * route whose id the app already serves is skipped. Returns the unregister. */\nexport function registerPackageRoutes(routes: readonly PackageRoute[]) {\n return registerConnectRoutes(({ routeTree }) => {\n const own = new Map<string, AnyRoute>();\n for (const entry of routes) {\n const parent =\n own.get(entry.parentId) ?? findRouteById(routeTree, entry.parentId);\n if (!parent) {\n console.warn(\n `[connect] no route \"${entry.parentId}\" for \"${entry.id}\"`,\n );\n continue;\n }\n if (findRouteById(routeTree, entry.id)) {\n console.warn(\n `[connect] a route already serves \"${entry.id}\"; skipping`,\n );\n continue;\n }\n const relativeId = entry.path ?? entry.id.slice(entry.parentId.length);\n entry.route.update({\n id: relativeId,\n path: entry.path,\n getParentRoute: () => parent,\n } as never);\n own.set(entry.id, entry.route);\n }\n return [...own.values()];\n });\n}\n\ntype RebuildableRouter = {\n buildRouteTree(): unknown;\n setRoutes(caches: never): void;\n invalidate(): Promise<unknown>;\n};\n\nfunction rebuildRoutes(router: RebuildableRouter) {\n router.setRoutes(router.buildRouteTree() as never);\n void router.invalidate();\n // For views that list routes, e.g. the nav and the settings tabs.\n notifyConnectRegistry();\n}\n\n/** The router's routes by id, read again when routes are added or removed. */\nexport function useRoutesById() {\n const router = useRouter();\n const routesById = () => router.routesById;\n // The server snapshot too: the loading shell is prerendered.\n return useSyncExternalStore(subscribeConnectRegistry, routesById, routesById);\n}\n"],"mappings":";;;;;;AAoBA,MAAa,oBAAoB,cAE/B,KAAA,CAAS;;AAGX,SAAgB,gBAAgB;CAC9B,OAAO,WAAW,iBAAiB;AACrC;;;AAIA,SAAgB,YAAY,OAIzB;CACD,MAAM,MAAM,OAA0B,IAAI;CAC1C,gBAAgB;EACd,MAAM,SAAS,IAAI;EACnB,IAAI,UAAU,CAAC,OAAO,MAAM,OAAO,UAAU;CAC/C,GAAG,CAAC,CAAC;CACL,OACE,oBAAC,UAAD;EACO;EACL,mBAAiB,MAAM;EACvB,WAAW,UAAU;GACnB,MAAM,eAAe;GACrB,aAAa;EACf;EACA,UAAU,UAAU;GAClB,IAAI,MAAM,WAAW,MAAM,eAAe,aAAa;EACzD;EAEA,WAAW,MAAM,YAAY,UAAU,MAAM,cAAc;EAE1D,UAAA,MAAM;CACD,CAAA;AAEZ;;;;;ACrCA,MAAa,mBAAmB;CAC9B,gBAAgB;CAChB,OAAO;CACP,YAAY;CACZ,wBAAwB;CACxB,4BAA4B;CAC5B,4BAA4B;CAC5B,mBAAmB;AACrB;AAMA,IAAM,qBAAN,cAAiC,UAA8C;CAC7E,QAAQ,E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OAAO,CAAC,GAAG,IAAI,OAAO,CAAC;CACzB,CAAC;AACH;AAQA,SAAS,cAAc,QAA2B;CAChD,OAAO,UAAU,OAAO,eAAe,CAAU;CACjD,OAAY,WAAW;CAEvB,sBAAsB;AACxB;;AAGA,SAAgB,gBAAgB;CAC9B,MAAM,SAAS,UAAU;CACzB,MAAM,mBAAmB,OAAO;CAEhC,OAAO,qBAAqB,0BAA0B,YAAY,UAAU;AAC9E"}
1
+ {"version":3,"file":"route-tree-D0aszMrk.js","names":[],"sources":["../src/router/modal-frame.tsx","../src/router/modals.tsx","../src/router/route-tree.ts"],"sourcesContent":["import { closePHModal } from \"@powerhousedao/reactor-browser\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { createContext, useContext, useEffect, useRef } from \"react\";\n\n/** What a modal frame lays out: the modal's title, its content and its buttons. */\nexport type ModalFrameProps = {\n title: string;\n /** The title element's id, for the dialog's `aria-labelledby`. */\n titleId: string;\n actions: ReactNode;\n children: ReactNode;\n};\n\ndeclare module \"@tanstack/react-router\" {\n interface StaticDataRouteOption {\n /** Frames every core modal while the route matches; the deepest wins. */\n modalFrame?: ComponentType<ModalFrameProps>;\n }\n}\n\nexport const ModalFrameContext = createContext<\n ComponentType<ModalFrameProps> | undefined\n>(undefined);\n\n/** The frame the matched routes set, if any. */\nexport function useModalFrame() {\n return useContext(ModalFrameContext);\n}\n\n/** A modal `<dialog>`: it opens as a modal, and Escape or a click on the\n * backdrop closes the open modal. */\nexport function ModalDialog(props: {\n labelledBy: string;\n className?: string;\n children: ReactNode;\n}) {\n const ref = useRef<HTMLDialogElement>(null);\n useEffect(() => {\n const dialog = ref.current;\n if (dialog && !dialog.open) dialog.showModal();\n }, []);\n return (\n <dialog\n ref={ref}\n aria-labelledby={props.labelledBy}\n onCancel={(event) => {\n event.preventDefault();\n closePHModal();\n }}\n onClick={(event) => {\n if (event.target === event.currentTarget) closePHModal();\n }}\n // Tailwind's reset drops the margin that centres a modal dialog.\n className={props.className ? `m-auto ${props.className}` : \"m-auto\"}\n >\n {props.children}\n </dialog>\n );\n}\n","import type { PHModal } from \"@powerhousedao/reactor-browser\";\nimport { usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { useMatches } from \"@tanstack/react-router\";\nimport type { ComponentType, ErrorInfo, ReactNode } from \"react\";\nimport { Component, createElement, Suspense } from \"react\";\nimport type * as ModalViews from \"../views/modals.js\";\nimport type { ModalFrameProps } from \"./modal-frame.js\";\nimport { ModalFrameContext } from \"./modal-frame.js\";\n\n/** Modal views by modal type. Each reads the open modal with `usePHModal()`. */\nexport type ConnectModals = Partial<Record<PHModal[\"type\"], ComponentType>>;\n\ndeclare module \"@tanstack/react-router\" {\n interface StaticDataRouteOption {\n /** Replaces the host's view of these modals while the route matches. */\n modals?: ConnectModals;\n }\n}\n\n/** Core's modals: the ones editors, drive apps and the reactor open, so every\n * host has them. Each names its view in `@powerhousedao/connect-core/views`. */\nexport const CORE_MODAL_VIEWS = {\n createDocument: \"CreateDocumentModal\",\n login: \"LoginModal\",\n deleteItem: \"DeleteItemModal\",\n confirmDocumentUpgrade: \"ConfirmDocumentUpgradeModal\",\n downloadDocumentWithErrors: \"DownloadDocumentWithErrorsModal\",\n documentVersionUnsupported: \"DocumentVersionUnsupportedModal\",\n driveAuthRequired: \"DriveAuthRequiredModal\",\n} as const satisfies Partial<Record<PHModal[\"type\"], keyof typeof ModalViews>>;\n\ntype BoundaryProps = { modal: string; children: ReactNode };\n\n// A broken modal closes quietly instead of taking the page down; keyed by\n// modal, so the next one gets a fresh try.\nclass ModalErrorBoundary extends Component<BoundaryProps, { failed: boolean }> {\n override state = { failed: false };\n\n static getDerivedStateFromError() {\n return { failed: true };\n }\n\n override componentDidCatch(error: unknown, info: ErrorInfo) {\n console.error(\n `[connect] the ${this.props.modal} modal failed:`,\n error,\n info,\n );\n }\n\n override render() {\n return this.state.failed ? null : this.props.children;\n }\n}\n\n/** The open modal's view: the deepest matched route's `staticData.modals`\n * entry for it, else `modals`', in the deepest `staticData.modalFrame`. */\nexport function ModalOutlet({ modals }: { modals: ConnectModals }) {\n const type = usePHModal()?.type;\n const routed = useMatches({\n select: (matches) =>\n type &&\n matches.reduce<ComponentType | undefined>(\n (found, match) => match.staticData.modals?.[type] ?? found,\n undefined,\n ),\n });\n const frame = useMatches({\n select: (matches) =>\n matches.reduce<ComponentType<ModalFrameProps> | undefined>(\n (found, match) => match.staticData.modalFrame ?? found,\n undefined,\n ),\n });\n const View = routed || (type && modals[type]);\n if (!type || !View) return null;\n return (\n <ModalErrorBoundary key={type} modal={type}>\n <ModalFrameContext.Provider value={frame}>\n <Suspense name=\"Modal\" fallback={null}>\n {/* A registered view, not one made here. */}\n {createElement(View)}\n </Suspense>\n </ModalFrameContext.Provider>\n </ModalErrorBoundary>\n );\n}\n","// The app's route tree: core's own, or a project's generated one when its\n// tsconfig maps this specifier to the tree.\nimport type { AnyRoute } from \"@tanstack/react-router\";\nimport { useRouter } from \"@tanstack/react-router\";\nimport { useSyncExternalStore } from \"react\";\nimport type {\n FileRoutesById,\n routeTree as appRouteTree,\n} from \"@powerhousedao/connect-core/route-tree\";\nimport type {\n ConnectRouteEntry,\n ConnectRouteRegistration,\n} from \"../registry.js\";\nimport {\n getConnectRegistry,\n notifyConnectRegistry,\n subscribeConnectRegistry,\n} from \"../registry.js\";\nimport type { DRIVE_ROUTE_ID, NODE_ROUTE_ID } from \"./route-data.js\";\n\nexport { DRIVE_PENDING_MS } from \"./route-components.js\";\nexport type { ConnectRouteRegistration } from \"../registry.js\";\n\n/** The home route's id; a tree change that moves it is a type error here. */\nexport const HOME_ROUTE_ID = \"/_app/\" satisfies keyof FileRoutesById;\n/** The `_app` layout's id; a project's _app/ routes nest in it. */\nexport const APP_ROUTE_ID = \"/_app\";\nconst SETTINGS_ROUTE_ID = \"/_app/settings\";\n\ntype RouteOptions = { id?: string; path?: string };\n\n// Generated routes carry their full id only once a router initialises them.\nfunction findChild(parent: AnyRoute, idOrPath: string) {\n const children = (parent.children ?? []) as AnyRoute[];\n const child = children.find((route) => {\n const options = route.options as RouteOptions;\n return options.id === idOrPath || options.path === idOrPath;\n });\n if (!child) throw new Error(`Connect's route tree lacks ${idOrPath}`);\n return child;\n}\n\n// Named, so declarations name the tree instead of inlining its type.\nexport type ConnectRootRoute = typeof appRouteTree;\nexport type ConnectRoutes = {\n routeTree: ConnectRootRoute;\n rootRoute: ConnectRootRoute;\n appRoute: FileRoutesById[typeof APP_ROUTE_ID];\n homeRoute: FileRoutesById[typeof HOME_ROUTE_ID];\n /** The drive layout, around the node route. */\n driveRoute: FileRoutesById[typeof DRIVE_ROUTE_ID];\n /** The open folder or document; the drive's root without a node. */\n nodeRoute: FileRoutesById[typeof NODE_ROUTE_ID];\n settingsRoute: FileRoutesById[typeof SETTINGS_ROUTE_ID];\n};\n\n/** Connect's routes in `routeTree`, core's or a project's generated one, which\n * holds the same routes. Deployment routes attach to these. */\nexport function connectRoutes(routeTree: AnyRoute): ConnectRoutes {\n const appRoute = findChild(routeTree, APP_ROUTE_ID);\n const driveRoute = findChild(appRoute, \"/d/$driveSlug\");\n return {\n routeTree: routeTree as ConnectRootRoute,\n rootRoute: routeTree as ConnectRootRoute,\n appRoute: appRoute as ConnectRoutes[\"appRoute\"],\n homeRoute: findChild(appRoute, \"/\") as ConnectRoutes[\"homeRoute\"],\n driveRoute: driveRoute as ConnectRoutes[\"driveRoute\"],\n nodeRoute: findChild(\n driveRoute,\n \"/{-$nodeSlug}\",\n ) as ConnectRoutes[\"nodeRoute\"],\n settingsRoute: findChild(\n appRoute,\n \"/settings\",\n ) as ConnectRoutes[\"settingsRoute\"],\n };\n}\n\n/** Code routes, e.g. `createRoute({ getParentRoute: () => rootRoute })`, join\n * their parent's file routes; an embedding app without the router plugin adds routes so. */\nexport function addConnectRoutes(routes: readonly AnyRoute[]) {\n for (const route of routes) {\n const parent = route.options.getParentRoute() as AnyRoute | undefined;\n if (!parent) throw new Error(\"A Connect route needs getParentRoute\");\n const children = (parent.children ?? []) as AnyRoute[];\n if (children.includes(route)) continue;\n // A project's file route at its path replaces it, as documented: no warning.\n const path = (route.options as RouteOptions).path;\n if (path && children.some((child) => samePath(child, path))) continue;\n parent.addChildren([...children, route]);\n }\n}\n\nconst trimSlashes = (path: string) => path.replace(/^\\/+|\\/+$/g, \"\");\n\nfunction samePath(route: AnyRoute, path: string) {\n const own = (route.options as RouteOptions).path;\n return own !== undefined && trimSlashes(own) === trimSlashes(path);\n}\n\n/** Takes `routes` out of their parents, e.g. when the module that made them is replaced. */\nexport function removeConnectRoutes(routes: readonly AnyRoute[]) {\n for (const route of routes) {\n const parent = route.options.getParentRoute() as AnyRoute | undefined;\n const children = (parent?.children ?? []) as AnyRoute[];\n if (children.includes(route)) {\n parent?.addChildren(children.filter((child) => child !== route));\n }\n }\n}\n\n/** The routes `registration` gives for `tree`'s core routes. */\nexport function resolveConnectRoutes(\n registration: ConnectRouteRegistration,\n tree: AnyRoute,\n): readonly AnyRoute[] {\n return typeof registration === \"function\"\n ? registration(connectRoutes(tree))\n : registration;\n}\n\n/** Adds code routes to the app's router, e.g. a package's settings tab below\n * `settingsRoute`; a running router takes them in. Returns the unregister. */\nexport function registerConnectRoutes(\n registration: ConnectRouteRegistration,\n): () => void {\n const registry = getConnectRegistry();\n const entry: ConnectRouteEntry = { registration, added: [] };\n registry.routes = [...registry.routes, entry];\n const bound = registry.app;\n if (bound) {\n const tree = bound.bundle.router.routeTree;\n entry.added = [...resolveConnectRoutes(registration, tree)];\n addConnectRoutes(entry.added);\n rebuildRoutes(bound.bundle.router);\n }\n return () => {\n registry.routes = registry.routes.filter((other) => other !== entry);\n const router = registry.app?.bundle.router;\n const ids = new Set<string>(entry.added.map((route) => route.id as string));\n const remove = () => {\n // The router reads a cached match's route later; those go with them.\n router?.clearCache({ filter: (match) => ids.has(match.routeId) });\n removeConnectRoutes(entry.added);\n if (router) rebuildRoutes(router);\n };\n // Leaving a route needs it: from one of these, go home before they go.\n const open = router?.state.matches.some((match) => ids.has(match.routeId));\n if (router && open) {\n void router.navigate({ to: \"/\", replace: true }).then(remove);\n } else {\n remove();\n }\n };\n}\n\n/** A file route a package offers to other Connects; `ph build` generates the\n * list from its hosts/connect/routes, parents before children. */\nexport type PackageRoute = {\n route: AnyRoute;\n /** The route's full id, e.g. `/_app/reports`. */\n id: string;\n /** Its path below its parent, e.g. `/reports`; none for a pathless layout. */\n path?: string;\n /** Its parent's full id: a Connect route's, or one of the package's. */\n parentId: string;\n};\n\nconst ROOT_ID = \"__root__\";\n\n// Before a router initialises a tree, its ids are only in the routes' options.\nfunction findRouteById(tree: AnyRoute, id: string): AnyRoute | undefined {\n if (id === ROOT_ID) return tree;\n const walk = (route: AnyRoute, routeId: string): AnyRoute | undefined => {\n for (const child of (route.children ?? []) as AnyRoute[]) {\n const options = child.options as RouteOptions;\n const own = options.id ?? options.path ?? \"\";\n const childId = `${routeId}${own.startsWith(\"/\") ? \"\" : \"/\"}${own}`;\n if (childId === id) return child;\n if (id.startsWith(childId)) {\n const found = walk(child, childId);\n if (found) return found;\n }\n }\n return undefined;\n };\n return walk(tree, \"\");\n}\n\nfunction routeHolds() {\n const registry = getConnectRegistry();\n registry.routeHolds ??= { count: 0, settled: new Set() };\n return registry.routeHolds;\n}\n\n/** Marks routes as still loading, e.g. a package's; unknown paths wait for\n * them before showing not found. Returns the release. */\nexport function holdConnectRoutes() {\n const holds = routeHolds();\n holds.count++;\n let released = false;\n return () => {\n if (released) return;\n released = true;\n holds.count--;\n if (holds.count > 0) return;\n for (const settle of holds.settled) settle();\n holds.settled.clear();\n };\n}\n\n/** Resolves once no routes are loading, or after `timeoutMs`. */\nexport function connectRoutesSettled(timeoutMs = 10_000) {\n const holds = routeHolds();\n if (holds.count === 0) return Promise.resolve();\n return new Promise<void>((resolve) => {\n const settle = () => {\n clearTimeout(timer);\n holds.settled.delete(settle);\n resolve();\n };\n const timer = setTimeout(settle, timeoutMs);\n holds.settled.add(settle);\n });\n}\n\n/** Adds a package's file routes below the app's routes with the same ids; a\n * route whose id the app already serves is skipped. Returns the unregister. */\nexport function registerPackageRoutes(routes: readonly PackageRoute[]) {\n return registerConnectRoutes(({ routeTree }) => {\n const own = new Map<string, AnyRoute>();\n for (const entry of routes) {\n const parent =\n own.get(entry.parentId) ?? findRouteById(routeTree, entry.parentId);\n if (!parent) {\n console.warn(\n `[connect] no route \"${entry.parentId}\" for \"${entry.id}\"`,\n );\n continue;\n }\n if (findRouteById(routeTree, entry.id)) {\n console.warn(\n `[connect] a route already serves \"${entry.id}\"; skipping`,\n );\n continue;\n }\n const relativeId = entry.path ?? entry.id.slice(entry.parentId.length);\n entry.route.update({\n id: relativeId,\n path: entry.path,\n getParentRoute: () => parent,\n } as never);\n own.set(entry.id, entry.route);\n }\n return [...own.values()];\n });\n}\n\ntype RebuildableRouter = {\n buildRouteTree(): unknown;\n setRoutes(caches: never): void;\n invalidate(): Promise<unknown>;\n};\n\nfunction rebuildRoutes(router: RebuildableRouter) {\n router.setRoutes(router.buildRouteTree() as never);\n void router.invalidate();\n // For views that list routes, e.g. the nav and the settings tabs.\n notifyConnectRegistry();\n}\n\n/** The router's routes by id, read again when routes are added or removed. */\nexport function useRoutesById() {\n const router = useRouter();\n const routesById = () => router.routesById;\n // The server snapshot too: the loading shell is prerendered.\n return useSyncExternalStore(subscribeConnectRegistry, routesById, routesById);\n}\n"],"mappings":";;;;;;AAoBA,MAAa,oBAAoB,cAE/B,KAAA,CAAS;;AAGX,SAAgB,gBAAgB;CAC9B,OAAO,WAAW,iBAAiB;AACrC;;;AAIA,SAAgB,YAAY,OAIzB;CACD,MAAM,MAAM,OAA0B,IAAI;CAC1C,gBAAgB;EACd,MAAM,SAAS,IAAI;EACnB,IAAI,UAAU,CAAC,OAAO,MAAM,OAAO,UAAU;CAC/C,GAAG,CAAC,CAAC;CACL,OACE,oBAAC,UAAD;EACO;EACL,mBAAiB,MAAM;EACvB,WAAW,UAAU;GACnB,MAAM,eAAe;GACrB,aAAa;EACf;EACA,UAAU,UAAU;GAClB,IAAI,MAA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F;GACA,IAAI,cAAc,WAAW,MAAM,EAAE,GAAG;IACtC,QAAQ,KACN,qCAAqC,MAAM,GAAG,YAChD;IACA;GACF;GACA,MAAM,aAAa,MAAM,QAAQ,MAAM,GAAG,MAAM,MAAM,SAAS,MAAM;GACrE,MAAM,MAAM,OAAO;IACjB,IAAI;IACJ,MAAM,MAAM;IACZ,sBAAsB;GACxB,CAAU;GACV,IAAI,IAAI,MAAM,IAAI,MAAM,KAAK;EAC/B;EACA,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC;CACzB,CAAC;AACH;AAQA,SAAS,cAAc,QAA2B;CAChD,OAAO,UAAU,OAAO,eAAe,CAAU;CACjD,OAAY,WAAW;CAEvB,sBAAsB;AACxB;;AAGA,SAAgB,gBAAgB;CAC9B,MAAM,SAAS,UAAU;CACzB,MAAM,mBAAmB,OAAO;CAEhC,OAAO,qBAAqB,0BAA0B,YAAY,UAAU;AAC9E"}
@@ -1,5 +1,5 @@
1
1
  import { t as getConnectRegistry } from "./registry-DCZHBP7M.js";
2
- import { c as CoreNotFound, n as getConnectPluginUi, s as CoreError, t as applyConnectPluginUi } from "./plugin-ui-fDXhKTCK.js";
2
+ import { c as CoreNotFound, n as getConnectPluginUi, s as CoreError, t as applyConnectPluginUi } from "./plugin-ui-DHlnXJmN.js";
3
3
  import { i as connectRoutes, r as addConnectRoutes, u as resolveConnectRoutes } from "./route-tree-D0aszMrk.js";
4
4
  import { C as CONTENT_VIEW_ID, d as keepOpenedFrom, m as settingsTabs, p as setSettingsRoute, x as driveTitle } from "./sidebar-C2y4mZnX.js";
5
5
  import { FEATURE_FLAG_PARAM_PREFIX, GLOBAL_SEARCH_PARAMS, OPENED_FROM_STATE_KEY, PHStoreProvider, REVISION_HISTORY_PAGE_PARAM, REVISION_HISTORY_PARAM, applySearchUpdate, createDriveArrivals, findDriveBySlugOrId, getPHStoreSubscribe, isRoutedModal, isSettingsTarget, makeDriveSlug, modalFromSearch, openedFromIndex, parseRevisionHistoryPage, resolveSearchUpdate, searchParamsToString } from "@powerhousedao/reactor-browser";
@@ -495,4 +495,4 @@ function coreRouteOptions(options) {
495
495
  //#endregion
496
496
  export { routerPerfEnabled as S, connectScrollRestoration as _, bindConnectRouter as a, markNavigationClick as b, FEATURE_FLAG_PARAM_PREFIX as c, definedSearch as d, parseConnectSearch as f, bindConnectScroll as g, validateDriveSearch as h, getConnectAppRouter as i, GLOBAL_SEARCH_PARAMS as l, validateConnectSearch as m, ConnectCoreApp as n, createConnectRouter as o, stringifyConnectSearch as p, disposeConnectAppRouter as r, createConnectNavigation as s, coreRouteOptions as t, connectSearchMiddlewares as u, PERF_STORAGE_KEY as v, markRouterNavigations as x, ROUTER_MEASURES as y };
497
497
 
498
- //# sourceMappingURL=router-wVNdTI-Y.js.map
498
+ //# sourceMappingURL=router-C4hDJ4_J.js.map