@powerhousedao/connect-core 6.3.0-dev.9 → 6.4.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/{connect-router-11uRIT3z.d.ts → connect-router-P44ov38H.d.ts} +4 -4
  2. package/dist/{connect-router-11uRIT3z.d.ts.map → connect-router-P44ov38H.d.ts.map} +1 -1
  3. package/dist/{index-Bfl1VYdj.d.ts → index-12S96gPF.d.ts} +2 -2
  4. package/dist/{index-Bfl1VYdj.d.ts.map → index-12S96gPF.d.ts.map} +1 -1
  5. package/dist/{index-BEhL5Pyf.d.ts → index-CXPPPM8r.d.ts} +4 -4
  6. package/dist/{index-BEhL5Pyf.d.ts.map → index-CXPPPM8r.d.ts.map} +1 -1
  7. package/dist/{index-xKGW_46_.d.ts → index-NmWuyjQT.d.ts} +9 -11
  8. package/dist/{index-xKGW_46_.d.ts.map → index-NmWuyjQT.d.ts.map} +1 -1
  9. package/dist/index.d.ts +5 -5
  10. package/dist/index.js +4 -5
  11. package/dist/{multi-reactor-CZnlLi8M.js → multi-reactor-D5r70cL2.js} +2 -2
  12. package/dist/{multi-reactor-CZnlLi8M.js.map → multi-reactor-D5r70cL2.js.map} +1 -1
  13. package/dist/plugin-host-CaTO1tq-.js.map +1 -1
  14. package/dist/{plugin-ui-BS5j5g1d.js → plugin-ui-Cvd3Kpgb.js} +4 -4
  15. package/dist/{plugin-ui-BS5j5g1d.js.map → plugin-ui-Cvd3Kpgb.js.map} +1 -1
  16. package/dist/plugins-BZq6MY00.js +27 -0
  17. package/dist/plugins-BZq6MY00.js.map +1 -0
  18. package/dist/plugins.d.ts +2 -2
  19. package/dist/plugins.js +2 -2
  20. package/dist/route-tree.d.ts +1 -1
  21. package/dist/{router-C5uD96ZP.js → router-R54qCm4H.js} +2 -2
  22. package/dist/{router-C5uD96ZP.js.map → router-R54qCm4H.js.map} +1 -1
  23. package/dist/router.d.ts +2 -2
  24. package/dist/router.js +2 -2
  25. package/dist/{runtime-CJ3UJrQ2.js → runtime-DV6oRJYU.js} +44 -6
  26. package/dist/runtime-DV6oRJYU.js.map +1 -0
  27. package/dist/{runtime-config-D3YPhYyj.d.ts → runtime-config-BdPf1LSz.d.ts} +3 -3
  28. package/dist/{runtime-config-D3YPhYyj.d.ts.map → runtime-config-BdPf1LSz.d.ts.map} +1 -1
  29. package/dist/runtime-config.d.ts +1 -1
  30. package/dist/runtime-config.js +13 -13
  31. package/dist/runtime-config.js.map +1 -1
  32. package/dist/runtime.d.ts +2 -2
  33. package/dist/runtime.js +1 -2
  34. package/package.json +8 -8
  35. package/src/plugins/composition.ts +11 -15
  36. package/src/plugins/plugin-host.ts +2 -2
  37. package/src/plugins/plugin-ui.ts +4 -6
  38. package/src/runtime/reactor-client-mode.ts +15 -5
  39. package/src/runtime/runtime-config.ts +17 -21
  40. package/dist/plugins-x1XqLPzp.js +0 -31
  41. package/dist/plugins-x1XqLPzp.js.map +0 -1
  42. package/dist/runtime-CJ3UJrQ2.js.map +0 -1
  43. package/dist/runtime-flag-DwQ3Jpdw.js +0 -47
  44. package/dist/runtime-flag-DwQ3Jpdw.js.map +0 -1
@@ -213,11 +213,11 @@ type ConnectPluginUiSet = {
213
213
  consent: boolean;
214
214
  };
215
215
  declare function mergeConnectPluginUi(uis: readonly ConnectPluginUi[]): ConnectPluginUiSet;
216
- /** Loads the UI of the plugins `composition` names, or of every known plugin
217
- * without one (classic Connect), and keeps it for `getConnectPluginUi`. */
216
+ /** Loads the UI of the plugins `composition` names and keeps it for
217
+ * `getConnectPluginUi`. */
218
218
  declare function loadConnectPluginUi(composition: readonly {
219
219
  module: string;
220
- }[] | undefined): Promise<ConnectPluginUiSet>;
220
+ }[]): Promise<ConnectPluginUiSet>;
221
221
  /** The active plugins' UI; none until `loadRuntimeConfig` has loaded it. */
222
222
  declare function getConnectPluginUi(): ConnectPluginUiSet;
223
223
  /** Sets `ui`'s route options on the tree's routes that still show core's view,
@@ -265,4 +265,4 @@ declare function bindConnectRouter(connectRouter: ConnectRouterBundle, store: PH
265
265
  //#endregion
266
266
  export { useDriveRouteData as A, ConnectConfigHooks as B, holdConnectRoutes as C, DRIVE_ROUTE_ID as D, removeConnectRoutes as E, DriveRouteData as F, ConnectPluginUi as G, ConnectPluginContext as H, DriveRouteParams as I, ConnectModals as J, ConnectRouteUi as K, isDriveNotFound as L, ConnectRouterContext as M, DriveLoaderOptions as N, DriveRouteView as O, DriveNotFoundData as P, loadDrive as R, connectRoutesSettled as S, registerPackageRoutes as T, ConnectPluginDefinition as U, ConnectPlugin as V, ConnectPluginFactory as W, ModalOutlet as Y, ConnectRoutes as _, bindConnectRouter as a, addConnectRoutes as b, applyConnectPluginUi as c, mergeConnectPluginUi as d, resetConnectPluginUi as f, ConnectRootRoute as g, APP_ROUTE_ID as h, ConnectRouterOptions as i, useDriveRouteIds as j, NODE_ROUTE_ID as k, getConnectPluginUi as l, ConnectRouteRegistration as m, ConnectRouterBundle as n, createConnectRouter as o, ConnectPluginDefinitions as p, CORE_MODAL_VIEWS as q, ConnectRouterFor as r, ConnectPluginUiSet as s, ConnectRouter as t, loadConnectPluginUi as u, HOME_ROUTE_ID as v, registerConnectRoutes as w, connectRoutes as x, PackageRoute as y, loadNode as z };
267
267
  export {};
268
- //# sourceMappingURL=connect-router-11uRIT3z.d.ts.map
268
+ //# sourceMappingURL=connect-router-P44ov38H.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect-router-11uRIT3z.d.ts","names":[],"sources":["../src/router/modals.tsx","../src/plugins/types.ts","../src/router/drive-route-loader.ts","../src/router/route-data.ts","../src/router/route-tree.ts","../src/registry.ts","../src/plugins/plugin-ui.ts","../src/router/connect-router.ts"],"mappings":";;;;;;;;;;;KAUY,gBAAgB,QAAQ,OAAO,iBAAiB;;YAGhD;;IAER,SAAS;;;;;cAMA;WACK;WACT;WACK;WACY;WACI;WACA;WACT;;;;iBA6BL,cAAc;EAAY,QAAQ;gCAAe,IAAA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ACV,QAAQ,eAAe;EACvB,WAAW;EACX,QAAQ;EACR,OAAO;EACP,iBAAiB;EACjB;EACA;;iBAYc,qBACd,cAAc,oBACb;;;iBAyBmB,oBACpB;EAAwB;kBACvB,QAAQ;;iBAkBK,sBAAsB;;;iBA8BtB,qBACd,WAAW,UACX,KAAI;;iBA+BU,qBAAqB,WAAW;;;KClHpC;EACV,OAAO;EACP,WAAW;EACX;EACA,UAAU;EACV,aAAa,OAAO,sBAAsB;;EAE1C,mBAAmB;;EAEnB,iBAAiB;;EAEjB,WAAW;;EAEX,oBAAoB;;EAEpB,WAAW;;;EAGX,kBACa,eACP,QAAQ,2BAA2B;;EAEzC,WAAW,gBAAgB,OAAO;;EAElC;;EAEA;;;KAQU,iBAAiB,mBAAmB,YAAY,OAC1D,4BAGA,eACA;KAGU,gBAAgB,iBAAiB;KACjC,sBAAsB,KAChC;EAEI,QAAQ;;iBAEE,oBACd,SAAS,uBACR;;iBA6Ca,kBACd,eAAe,qBACf,OAAO"}
1
+ {"version":3,"file":"connect-router-P44ov38H.d.ts","names":[],"sources":["../src/router/modals.tsx","../src/plugins/types.ts","../src/router/drive-route-loader.ts","../src/router/route-data.ts","../src/router/route-tree.ts","../src/registry.ts","../src/plugins/plugin-ui.ts","../src/router/connect-router.ts"],"mappings":";;;;;;;;;;;KAUY,gBAAgB,QAAQ,OAAO,iBAAiB;;YAGhD;;IAER,SAAS;;;;;cAMA;WACK;WACT;WACK;WACY;WACI;WACA;WACT;;;;iBA6BL,cAAc;EAAY,QAAQ;gCAAe,IAAA;;;;;;;;;;UCtChD;;EAEf,aAAa;;UAGE;EACf,yBACE,QAAQ,wBACR,KAAK,yBACF;EACL,aAAa,KAAK,gCAAgC;;KAGxC,gBAAgB,WAAW;;;KAI3B,wBACV,QAAQ,4BACL;;KAGO;EACV,YAAY;EACZ,mBAAmB;EACnB,iBAAiB;EACjB,oBAAoB;EACpB,aAAa,QAAQ;;;KAIX;;;EAGV,SAAS,eAAe;;EAExB,YAAY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a,OAAO,sBAAsB;;EAE1C,mBAAmB;;EAEnB,iBAAiB;;EAEjB,WAAW;;EAEX,oBAAoB;;EAEpB,WAAW;;;EAGX,kBACa,eACP,QAAQ,2BAA2B;;EAEzC,WAAW,gBAAgB,OAAO;;EAElC;;EAEA;;;KAQU,iBAAiB,mBAAmB,YAAY,OAC1D,4BAGA,eACA;KAGU,gBAAgB,iBAAiB;KACjC,sBAAsB,KAChC;EAEI,QAAQ;;iBAEE,oBACd,SAAS,uBACR;;iBA6Ca,kBACd,eAAe,qBACf,OAAO"}
@@ -1,4 +1,4 @@
1
- import { F as DriveRouteData, J as ConnectModals, M as ConnectRouterContext, i as ConnectRouterOptions, n as ConnectRouterBundle } from "./connect-router-11uRIT3z.js";
1
+ import { F as DriveRouteData, J as ConnectModals, M as ConnectRouterContext, i as ConnectRouterOptions, n as ConnectRouterBundle } from "./connect-router-P44ov38H.js";
2
2
  import "./route-components-1XyfosoL.js";
3
3
  import { FEATURE_FLAG_PARAM_PREFIX, GLOBAL_SEARCH_PARAMS, PHNavigation, PHStore } from "@powerhousedao/reactor-browser";
4
4
  import { AnyRoute, AnyRouter, ErrorRouteComponent, HistoryState, NotFoundRouteProps, ParsedLocation, RouteComponent, RouterHistory, SearchMiddleware, StaticDataRouteOption } from "@tanstack/react-router";
@@ -246,4 +246,4 @@ declare function driveTitle(store: PHStore, data: DriveRouteData | undefined, ap
246
246
  //#endregion
247
247
  export { disposeConnectAppRouter as $, stringifyConnectSearch as A, ConnectCoreApp as B, useSidebarMode as C, connectSearchMiddlewares as D, GLOBAL_SEARCH_PARAMS as E, CoreRouteOptions as F, isCoreView as G, CoreNotFound as H, coreRouteOptions as I, markNavigationClick as J, PERF_STORAGE_KEY as K, ModalDialog as L, validateDriveSearch as M, bindConnectScroll as N, definedSearch as O, connectScrollRestoration as P, ConnectAppRouterOptions as Q, ModalFrameProps as R, useNavRoutes as S, FEATURE_FLAG_PARAM_PREFIX as T, coreModals as U, CoreError as V, coreView as W, routerPerfEnabled as X, markRouterNavigations as Y, createConnectNavigation as Z, ConnectNavItem as _, SETTINGS_ROUTE_ID as a, navRoutes as b, redirectToSettingsTab as c, settingsTabsOf as d, getConnectAppRouter as et, settingsTitle as f, ConnectChrome as g, useSettingsTabs as h, ConnectSettingsTab as i, validateConnectSearch as j, parseConnectSearch as k, setSettingsRoute as l, useForgetSettingsOpenedFrom as m, driveTitle as n, CreateDocumentTarget as nt, SettingsTabEntry as o, showsSettingsTab as p, ROUTER_MEASURES as q, notFoundTitle as r, useCreateDocumentTarget as rt, keepOpenedFrom as s, appTitle as t, useIsColdStart as tt, settingsTabs as u, NavRouteEntry as v, ConnectSearch as w, useConnectChrome as x, SidebarMode as y, useModalFrame as z };
248
248
  export {};
249
- //# sourceMappingURL=index-Bfl1VYdj.d.ts.map
249
+ //# sourceMappingURL=index-12S96gPF.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Bfl1VYdj.d.ts","names":[],"sources":["../src/router/create-target.ts","../src/router/cold-start.ts","../src/router/app-router.ts","../src/router/navigation.ts","../src/router/perf-marks.ts","../src/router/core-views.tsx","../src/router/core-app.tsx","../src/router/modal-frame.tsx","../src/router/route-options.ts","../src/router/scroll.ts","../src/router/search.ts","../src/router/sidebar.ts","../src/router/settings.ts","../src/router/titles.ts"],"mappings":";;;;;;;KAKY;;EAEV,OAAO;;EAEP,SAAS;EACT,OAAO;;EAEP;;;;iBAKc,wBACd,8BACC;;;;iBChBa;;;KCQJ,0BAA0B,KACpC;;;iBAMc,oBACd,OAAO,SACP,eAAe,0BACd;;iBA8Ba;;;;;iBClBA,wBACd,eAAe,sBACd;EAAiB;;;;;cChCP;;cAGA;;WAEX;;WAEA;;WAEA;;WAEA;;;iBAYc,kBAAkB;;iBAalB;;iBAYA,sBACd,QAAQ,KAAK,yBACb;;;cCvCI,aAAK;;iBAKK,SAAS,YAAY,QAAQ,kBAAkB,UAGvD;;iBAIQ,WAAW;;iBAaX,eAAe,QAAQ,QAAQ,kDAAmB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S;;;iBAYK,cAAc,8BAA8B;;;iBAM5C,qCAA2B;;iBAc3B,eAAe,gBAE0B;;;;iBC3IzC,SAAS;;iBAKT,cAAc;;iBAKd,WACd,OAAO,SACP,MAAM,4BACN"}
1
+ {"version":3,"file":"index-12S96gPF.d.ts","names":[],"sources":["../src/router/create-target.ts","../src/router/cold-start.ts","../src/router/app-router.ts","../src/router/navigation.ts","../src/router/perf-marks.ts","../src/router/core-views.tsx","../src/router/core-app.tsx","../src/router/modal-frame.tsx","../src/router/route-options.ts","../src/router/scroll.ts","../src/router/search.ts","../src/router/sidebar.ts","../src/router/settings.ts","../src/router/titles.ts"],"mappings":";;;;;;;KAKY;;EAEV,OAAO;;EAEP,SAAS;EACT,OAAO;;EAEP;;;;iBAKc,wBACd,8BACC;;;;iBChBa;;;KCQJ,0BAA0B,KACpC;;;iBAMc,oBACd,OAAO,SACP,eAAe,0BACd;;iBA8Ba;;;;;iBClBA,wBACd,eAAe,sBACd;EAAiB;;;;;cChCP;;cAGA;;WAEX;;WAEA;;WAEA;;WAEA;;;iBAYc,kBAAkB;;iBAalB;;iBAYA,sBACd,QAAQ,KAAK,yBACb;;;cCvCI,aAAK;;iBAKK,SAAS,YAAY,QAAQ,kBAAkB,UAGvD;;iBAIQ,WAAW;;iBAaX,eAAe,QAAQ,QAAQ,kDAAmB,IAAA;;cASrD,WAA0C;;cAG1C,YAAY;;;;iBC3CT,eAAe;EAC7B,OAAO;EACP,WAAW;EACX;EACA,gBAAgB,KAAK;gCACtB,IAAA;;;;KCRW;EACV;;EAEA;EACA,SAAS;EACT,UAAU;;;YAIA;;IAER,aAAa,cAAc;;;;iBASf,iBAAa,cAAA;;;iBAMb,YAAY;EAC1B;EACA;EACA,UAAU;gCACX,IAAA;;;KCjCI,uBAAuB;;;KAIhB,iBAAiB,oBAAoB,OAC9C,KAAK,QAAQ,sBAAsB;;iBAItB,iBAAiB,kBAC/B,SAAS,IACR,iBAAiB;;;KCPf,eAAe,KAAK;EACvB,SAAS;;;;iBAQK,+BAAwB;EAGL,UAAU;;;iBAO7B,kBAAkB,QAAQ,cAAc;;;;KCV5C,gBAAgB;;cAgBf,0BAA0B,iBAAiB;;iBAMxC,sBACd,QAAQ,0BACP;;iBAKa,mBAAmB,oBAAoB;;iBAKvC,uBAAuB,QAAQ;;;iBAY/B,oBACd,QAAQ,0BACP;;iBAYa,cAAc,iBAAiB;;;;KClEnC;EACV;EACA,OAAO;IAAgB;IAAe;;;EAEtC;;;KAIU;;YAGA;IACR,MAAM;IACN,UAAU;;;KAIF,gBAAgB;EAAmB;EAAiB;;;iBAGhD,UAAU,QAAQ,YAAY;iBAe9B,gBAAY;;iBAOZ,kBAAkB;;KAStB;;EAEV;;EAEA;;EAEA;;;iBAIc,oBAAoB;;;;KCnDxB;EACV;;EAEA;EACA,OAAO;IAAgB;IAAe;;;EAEtC;;EAEA,WAAW,SAAS;;;YAIV;IACR,WAAW;;;;cAKF;KAGR;EAAkB;EAAiB,YAAY;;;KAGxC,mBAAmB;EAC7B;EACA;EACA;;;iBAIc,eACd,eAAe,UACf,SAAS,uBACR;;iBAoBa,aAAa,QAAQ,YAAY;iBAWjC,mBAAe;;iBAOf,iBACd,kBAAkB,iBAClB,SAAS;;iBAUK,iBAAiB,QAAQ;;iBAKzB,wBACd,SACA;EAEA,kBAAkB;EAClB,SAAS;;;iBAYK,cAAc,8BAA8B;;;iBAM5C,qCAA2B;;iBAc3B,eAAe,gBAE0B;;;;iBC3IzC,SAAS;;iBAKT,cAAc;;iBAKd,WACd,OAAO,SACP,MAAM,4BACN"}
@@ -1,4 +1,4 @@
1
- import "./runtime-config-D3YPhYyj.js";
1
+ import "./runtime-config-BdPf1LSz.js";
2
2
  import { BrowserReactorClientModule, PHStore, SwitchboardBackend, SwitchboardBreaker, WorkerReactorClientModule } from "@powerhousedao/reactor-browser";
3
3
  import { PHConnectCollection, PHConnectRemoteBackend, PHConnectRouterSettings, PHConnectRuntimeDefaultDrive, PHReactorClientMode } from "@powerhousedao/shared/clis";
4
4
  import { DocumentDriveDocument } from "@powerhousedao/shared/document-drive";
@@ -41,8 +41,8 @@ declare function isReactorWorkerEnabled(): boolean;
41
41
  * Precedence: an explicit `?reactorClient=` query override (kept in
42
42
  * localStorage so it survives a reload), then a stored override, then the
43
43
  * served `connect.instance.reactorClient` (projected from the host's reactor
44
- * backends), then the LEGACY booleans — so a config that only sets
45
- * reactorWorker/multiReactor behaves exactly as before.
44
+ * backends), then `in-process`. The `reactorWorker`/`multiReactor` booleans
45
+ * no longer select a client.
46
46
  *
47
47
  * `remote` is the only mode that builds NO local reactor (no PGlite): it is a
48
48
  * pure client to a remote Switchboard. `router` keeps the local reactor and
@@ -394,4 +394,4 @@ declare function loadLocalPackage(source: LocalPackageSource | undefined): Docum
394
394
  //#endregion
395
395
  export { ReactorWorkerFlagInput as $, LoadedDocumentModels as A, placementKeys as B, ReactorClientPlan as C, refreshAppDrives as D, planReactorClient as E, ResolvedSwitchboardDrive as F, switchboardDrives as G, resolveSwitchboardDrives as H, SwitchboardDrive as I, ReactorClientMode as J, REACTOR_CLIENT_QUERY_KEY as K, applyPlacementEntries as L, LOCAL_BACKEND_NAME as M, PlacementEntry as N, relistAppDrives as O, ResolveSwitchboardDrivesOptions as P, REACTOR_WORKER_STORAGE_KEY as Q, keepsLocalCopy as R, LocalReactorFactory as S, getAppDrives as T, servedUrl as U, removeLocalCopies as V, servesSlug as W, resolveReactorClientMode as X, newDrivesBlocked as Y, REACTOR_WORKER_QUERY_KEY as Z, NewDriveRefusedError as _, getConnectPHStore as a, isRuntimeFlagEnabled as at, AppReactorClientParams as b, OperationReader as c, PlacementSync as d, isReactorWorkerEnabled as et, actionIdsFrom as f, needsCopy as g, findServedDrive as h, loadLocalPackage as i, RuntimeFlagKeys as it, LocalReactorModule as j, selectAppReactorClient as k, PlacementRouter as l, effectiveBackend as m, LocalPackageSource as n, isMultiReactorEnabled as nt, DrivePlacement as o, resolveRuntimeFlag as ot, caughtUp as p, REACTOR_CLIENT_STORAGE_KEY as q, ModuleNamespace as r, RuntimeFlagInput as rt, DrivePlacements as s, LocalPackage as t, resolveReactorWorkerEnabled as tt, PlacementStore as u, NewDriveUnansweredError as v, createAppReactorClient as w, CreateAppReactorClientOptions as x, newDriveError as y, localDrivePlacements as z };
396
396
  export {};
397
- //# sourceMappingURL=index-BEhL5Pyf.d.ts.map
397
+ //# sourceMappingURL=index-CXPPPM8r.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BEhL5Pyf.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/drive-placement.ts","../src/runtime/multi-reactor.ts","../src/runtime/app-reactor-client.ts","../src/runtime/new-drive.ts","../src/runtime/drive-placements.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;;;;;;;;;;;;;;;;;;;KCIJ,oBAAoB;cASnB;cACA;iBAoDG,4BAA4B;;iBAoB5B,oBAAoB;;;;cC9FvB;;KAGD;;EAEV;EACA;;EAEA;;EAEA;;EAEA;;;KAIU,2BAA2B;EACrC;EACA;;;KAIU;EACV;EACA;EACA;;KAGG;EACH;IAAW,yBAAyB;;EACpC;IACE,0BAA0B;IAC1B,cAAc,eAAe;;;;;iBAMjB,qBACd,wBAAwB,iCACvB;iBAQa,eAAe,OAAO;;iBAKtB,kBAAkB,QAAQ,kBAAkB;;iBAiC5C,sBACd,iBAAiB,oBACjB,kBAAkB;EACf,SAAS;EAAkB,OAAO;;;iBAgBvB,WAAW,kBAAkB;KAQxC;EAAe;EAAY;;KAapB;EACV;;EAEA,cAAc,OAAO,qBAAqB,QAAQ;;;iBAI9B,yBACpB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":[],"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/drive-placement.ts","../src/runtime/multi-reactor.ts","../src/runtime/app-reactor-client.ts","../src/runtime/new-drive.ts","../src/runtime/drive-placements.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;;;;;;;;;;;;;;;;;;;KCIJ,oBAAoB;cASnB;cACA;iBAoDG,4BAA4B;;iBA8B5B,oBAAoB;;;;cCxGvB;;KAGD;;EAEV;EACA;;EAEA;;EAEA;;EAEA;;;KAIU,2BAA2B;EACrC;EACA;;;KAIU;EACV;EACA;EACA;;KAGG;EACH;IAAW,yBAAyB;;EACpC;IACE,0BAA0B;IAC1B,cAAc,eAAe;;;;;iBAMjB,qBACd,wBAAwB,iCACvB;iBAQa,eAAe,OAAO;;iBAKtB,kBAAkB,QAAQ,kBAAkB;;iBAiC5C,sBACd,iBAAiB,oBACjB,kBAAkB;EACf,SAAS;EAAkB,OAAO;;;iBAgBvB,WAAW,kBAAkB;KAQxC;EAAe;EAAY;;KAapB;EACV;;EAEA,cAAc,OAAO,qBAAqB,QAAQ;;;iBAI9B,yBACpB,iBAAiB,oBACjB,YAAY,gBAAgB,QAAQ,eAClC,WAAmB,eAAc,kCAClC,QAAQ;;iBAsCK,UAAU,OAAO;;iBAQjB,cAAc,OAAO;KAMzB;EACV;IACE;MAAQ;MAAc,cAAc;;;EAEtC,OAAO,eAAe;;;iBAIF,kBACpB,MAAM,aACN;EAAqB;MACpB;;;;cCnLU;KAED,qBACR,6BACA;iBAEY,WAAW,MAAM,6BAA6B;;iBAO9C,WACd,QAAQ,2BACD,QAAQ;;iBA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AQF;EACf,QAAQ,QAAQ;EAChB,IAAI,OAAO,iBAAiB;EAC5B,OAAO,eAAe;;;KAIZ;EACV,aAAa,aAAa;EAC1B,uBAAuB,aAAa;;KAG1B,gBAAgB;;EAE1B,IAAI,aAAa,kBAAkB;;EAEnC,YAAY,iBAAiB,iBAAiB;;KAGpC;EACV,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;;cAIW;WAUA,iBAAiB;mBAET;mBACA;UAZX;UACA;UACA;mBACS;UACT;mBACS;UACT;EAER,YACW,iBAAiB,oBAC1B,kBAAkB,kBACD,OAAO,gBACP,MAAM;;SAMZ,KACX,iBAAiB,oBACjB,OAAO,gBACP,MAAM,gBACL,QAAQ;;EAqBX,UAAU,OAAO;;EAKjB,UAAU;;EAMV,UAAU;;EAOV,mBAAmB;;EAUnB,OACE,QAAQ,6BACR,mBAAmB;;;;;EAaf,MACJ,QAAQ,6BACR,mBAAmB,4BACnB,uBACC,QAAQ;;EAeX,YAAY,kBAAkB;EAI9B,UAAU;;EAQJ,KAAK,iBAAiB,kBAAkB;;EA+C9C,MAAM,kBAAkB;;EAMlB,UAAU;;UAkBF;UA8BA;UAYA;UAaN;UAYA;;;;;;iBChXM,qBAAqB;;;;KCNzB,kBAAkB;GAC3B,OAAO;;KAGE,eAAe,wBAAwB;;KAGvC,qBAAqB,sBAAsB,QAAQ;;iBAG/C,iBACd,QAAQ,iCACP,mBAAmB,QAAQ"}
@@ -1,4 +1,4 @@
1
- import { p as ConnectPluginDefinitions } from "./connect-router-11uRIT3z.js";
1
+ import { p as ConnectPluginDefinitions } from "./connect-router-P44ov38H.js";
2
2
  import { PHConnectRuntimeConfig } from "@powerhousedao/shared/clis";
3
3
  //#region src/plugins/plugin-host.d.ts
4
4
  type PluginDefinitions = ConnectPluginDefinitions;
@@ -14,19 +14,17 @@ declare function applyComposition(config: PHConnectRuntimeConfig): Promise<PHCon
14
14
  //#region src/plugins/composition.d.ts
15
15
  /**
16
16
  * Plugin-presence reads for the UI (rewire R3, step toward generic-shell
17
- * deletability). The served runtime config carries `connect.composition` — the
18
- * list of plugins the host declared — when uniform runners project it. UI can
19
- * gate on a plugin being present ("presence is activation").
17
+ * deletability). The runtime config carries `connect.composition`: the list
18
+ * of plugins the host declared, or the default one `loadRuntimeConfig` works
19
+ * out for a config served without. UI can gate on a plugin being present
20
+ * ("presence is activation").
20
21
  *
21
- * Classic semantics are preserved: when there is NO declared composition
22
- * (flag-off, or a host without a plugins list), `null` is returned and every
23
- * plugin is treated as active — so the classic chrome renders exactly as
24
- * before. Gating only hides something when a composition IS declared and the
25
- * plugin is absent from it.
22
+ * A plugin absent from the composition is not active, and with no composition
23
+ * in the config no plugin is.
26
24
  */
27
- declare function getActivePluginModules(): ReadonlySet<string> | null;
25
+ declare function getActivePluginModules(): ReadonlySet<string>;
28
26
  declare function isPluginActive(module: string): boolean;
29
27
  //#endregion
30
28
  export { registerConnectPlugins as a, knownPlugins as i, isPluginActive as n, applyComposition as r, getActivePluginModules as t };
31
29
  export {};
32
- //# sourceMappingURL=index-xKGW_46_.d.ts.map
30
+ //# sourceMappingURL=index-NmWuyjQT.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-xKGW_46_.d.ts","names":[],"sources":["../src/plugins/plugin-host.ts","../src/plugins/composition.ts"],"mappings":";;;KAkBK,oBAAoB;KACpB,qBAAqB,QAAQ;;iBAGlB,uBACd,SAAS,oBAAoB;;iBAQT,gBAAgB,QAAQ;;;iBA6BxB,iBACpB,QAAQ,yBACP,QAAQ;;;;;;;;;;;;;;;iBC/CK,0BAA0B;iBAa1B,eAAe"}
1
+ {"version":3,"file":"index-NmWuyjQT.d.ts","names":[],"sources":["../src/plugins/plugin-host.ts","../src/plugins/composition.ts"],"mappings":";;;KAkBK,oBAAoB;KACpB,qBAAqB,QAAQ;;iBAGlB,uBACd,SAAS,oBAAoB;;iBAQT,gBAAgB,QAAQ;;;iBA6BxB,iBACpB,QAAQ,yBACP,QAAQ;;;;;;;;;;;;;iBCjDK,0BAA0B;iBAY1B,eAAe"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { $ as ReactorWorkerFlagInput, A as LoadedDocumentModels, B as placementKeys, C as ReactorClientPlan, D as refreshAppDrives, E as planReactorClient, F as ResolvedSwitchboardDrive, G as switchboardDrives, H as resolveSwitchboardDrives, I as SwitchboardDrive, J as ReactorClientMode, K as REACTOR_CLIENT_QUERY_KEY, L as applyPlacementEntries, M as LOCAL_BACKEND_NAME, N as PlacementEntry, O as relistAppDrives, P as ResolveSwitchboardDrivesOptions, Q as REACTOR_WORKER_STORAGE_KEY, R as keepsLocalCopy, S as LocalReactorFactory, T as getAppDrives, U as servedUrl, V as removeLocalCopies, W as servesSlug, X as resolveReactorClientMode, Y as newDrivesBlocked, Z as REACTOR_WORKER_QUERY_KEY, _ as NewDriveRefusedError, a as getConnectPHStore, at as isRuntimeFlagEnabled, b as AppReactorClientParams, c as OperationReader, d as PlacementSync, et as isReactorWorkerEnabled, f as actionIdsFrom, g as needsCopy, h as findServedDrive, i as loadLocalPackage, it as RuntimeFlagKeys, j as LocalReactorModule, k as selectAppReactorClient, l as PlacementRouter, m as effectiveBackend, n as LocalPackageSource, nt as isMultiReactorEnabled, o as DrivePlacement, ot as resolveRuntimeFlag, p as caughtUp, q as REACTOR_CLIENT_STORAGE_KEY, r as ModuleNamespace, rt as RuntimeFlagInput, s as DrivePlacements, t as LocalPackage, tt as resolveReactorWorkerEnabled, u as PlacementStore, v as NewDriveUnansweredError, w as createAppReactorClient, x as CreateAppReactorClientOptions, y as newDriveError, z as localDrivePlacements } from "./index-BEhL5Pyf.js";
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";
1
+ import { $ as ReactorWorkerFlagInput, A as LoadedDocumentModels, B as placementKeys, C as ReactorClientPlan, D as refreshAppDrives, E as planReactorClient, F as ResolvedSwitchboardDrive, G as switchboardDrives, H as resolveSwitchboardDrives, I as SwitchboardDrive, J as ReactorClientMode, K as REACTOR_CLIENT_QUERY_KEY, L as applyPlacementEntries, M as LOCAL_BACKEND_NAME, N as PlacementEntry, O as relistAppDrives, P as ResolveSwitchboardDrivesOptions, Q as REACTOR_WORKER_STORAGE_KEY, R as keepsLocalCopy, S as LocalReactorFactory, T as getAppDrives, U as servedUrl, V as removeLocalCopies, W as servesSlug, X as resolveReactorClientMode, Y as newDrivesBlocked, Z as REACTOR_WORKER_QUERY_KEY, _ as NewDriveRefusedError, a as getConnectPHStore, at as isRuntimeFlagEnabled, b as AppReactorClientParams, c as OperationReader, d as PlacementSync, et as isReactorWorkerEnabled, f as actionIdsFrom, g as needsCopy, h as findServedDrive, i as loadLocalPackage, it as RuntimeFlagKeys, j as LocalReactorModule, k as selectAppReactorClient, l as PlacementRouter, m as effectiveBackend, n as LocalPackageSource, nt as isMultiReactorEnabled, o as DrivePlacement, ot as resolveRuntimeFlag, p as caughtUp, q as REACTOR_CLIENT_STORAGE_KEY, r as ModuleNamespace, rt as RuntimeFlagInput, s as DrivePlacements, t as LocalPackage, tt as resolveReactorWorkerEnabled, u as PlacementStore, v as NewDriveUnansweredError, w as createAppReactorClient, x as CreateAppReactorClientOptions, y as newDriveError, z as localDrivePlacements } from "./index-CXPPPM8r.js";
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-P44ov38H.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
- 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
- import { a as registerConnectPlugins, i as knownPlugins, n as isPluginActive, r as applyComposition, t as getActivePluginModules } from "./index-xKGW_46_.js";
6
- import { i as primeRuntimeConfig, n as getRuntimeConfig, r as loadRuntimeConfig } from "./runtime-config-D3YPhYyj.js";
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-12S96gPF.js";
5
+ import { a as registerConnectPlugins, i as knownPlugins, n as isPluginActive, r as applyComposition, t as getActivePluginModules } from "./index-NmWuyjQT.js";
6
+ import { i as primeRuntimeConfig, n as getRuntimeConfig, r as loadRuntimeConfig } from "./runtime-config-BdPf1LSz.js";
7
7
  import { n as useBackendAuthGate, t as BackendAuthGateMode } from "./backend-auth-gate-DiFpY5rt.js";
8
8
  import { n as useIsEmbedded, t as getIsEmbedded } from "./embedded-DT1C47F0.js";
9
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";
package/dist/index.js CHANGED
@@ -1,13 +1,12 @@
1
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-LyRJcSKu.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-BS5j5g1d.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-Cvd3Kpgb.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
5
  import { i as registerConnectPlugins, n as knownPlugins, t as applyComposition } from "./plugin-host-CaTO1tq-.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-C5uD96ZP.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-R54qCm4H.js";
7
7
  import { getIsEmbedded, useIsEmbedded } from "./embedded.js";
8
8
  import { getRuntimeConfig, loadRuntimeConfig, primeRuntimeConfig } from "./runtime-config.js";
9
- import { n as isPluginActive, t as getActivePluginModules } from "./plugins-x1XqLPzp.js";
10
- import { n as resolveRuntimeFlag, t as isRuntimeFlagEnabled } from "./runtime-flag-DwQ3Jpdw.js";
11
- import { A as newDrivesBlocked, C as getAppDrives, D as selectAppReactorClient, E as relistAppDrives, F as resolveReactorWorkerEnabled, I as isMultiReactorEnabled, M as REACTOR_WORKER_QUERY_KEY, N as REACTOR_WORKER_STORAGE_KEY, O as REACTOR_CLIENT_QUERY_KEY, P as isReactorWorkerEnabled, S as createAppReactorClient, T as refreshAppDrives, _ as servesSlug, a as caughtUp, b as NewDriveUnansweredError, c as needsCopy, d as keepsLocalCopy, f as localDrivePlacements, g as servedUrl, h as resolveSwitchboardDrives, i as actionIdsFrom, j as resolveReactorClientMode, k as REACTOR_CLIENT_STORAGE_KEY, l as LOCAL_BACKEND_NAME, m as removeLocalCopies, n as getConnectPHStore, o as effectiveBackend, p as placementKeys, r as DrivePlacements, s as findServedDrive, t as loadLocalPackage, u as applyPlacementEntries, v as switchboardDrives, w as planReactorClient, x as newDriveError, y as NewDriveRefusedError } from "./runtime-CJ3UJrQ2.js";
9
+ import { n as isPluginActive, t as getActivePluginModules } from "./plugins-BZq6MY00.js";
10
+ import { A as newDrivesBlocked, C as getAppDrives, D as selectAppReactorClient, E as relistAppDrives, F as resolveReactorWorkerEnabled, I as isMultiReactorEnabled, L as isRuntimeFlagEnabled, M as REACTOR_WORKER_QUERY_KEY, N as REACTOR_WORKER_STORAGE_KEY, O as REACTOR_CLIENT_QUERY_KEY, P as isReactorWorkerEnabled, R as resolveRuntimeFlag, S as createAppReactorClient, T as refreshAppDrives, _ as servesSlug, a as caughtUp, b as NewDriveUnansweredError, c as needsCopy, d as keepsLocalCopy, f as localDrivePlacements, g as servedUrl, h as resolveSwitchboardDrives, i as actionIdsFrom, j as resolveReactorClientMode, k as REACTOR_CLIENT_STORAGE_KEY, l as LOCAL_BACKEND_NAME, m as removeLocalCopies, n as getConnectPHStore, o as effectiveBackend, p as placementKeys, r as DrivePlacements, s as findServedDrive, t as loadLocalPackage, u as applyPlacementEntries, v as switchboardDrives, w as planReactorClient, x as newDriveError, y as NewDriveRefusedError } from "./runtime-DV6oRJYU.js";
12
11
  import { t as useBackendAuthGate } from "./backend-auth-gate-DNKg_v4Y.js";
13
12
  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, DrivePlacements, EditorHost, FEATURE_FLAG_PARAM_PREFIX, GLOBAL_SEARCH_PARAMS, HISTORY_PAGE_SIZE, HOME_ROUTE_ID, LOCAL_BACKEND_NAME, LoginModal, ModalDialog, ModalOutlet, NODE_ROUTE_ID, NewDriveRefusedError, NewDriveUnansweredError, 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, actionIdsFrom, addConnectRoutes, appTitle, applyComposition, applyConnectPluginUi, applyPlacementEntries, bindConnectRouter, bindConnectScroll, caughtUp, connectRoutes, connectRoutesSettled, connectScrollRestoration, connectSearchMiddlewares, coreModals, coreRouteOptions, coreView, createAppReactorClient, createConnectNavigation, createConnectRouter, definedSearch, disposeConnectAppRouter, driveTitle, effectiveBackend, findServedDrive, formatModified, getActivePluginModules, getAppDrives, getConnectAppRouter, getConnectPHStore, getConnectPluginUi, getIsEmbedded, getRuntimeConfig, holdConnectRoutes, isCoreView, isDriveNotFound, isMultiReactorEnabled, isPluginActive, isReactorWorkerEnabled, isRuntimeFlagEnabled, keepOpenedFrom, keepsLocalCopy, knownPlugins, loadConnectPluginUi, loadDrive, loadLocalPackage, loadNode, loadRuntimeConfig, localDrivePlacements, markNavigationClick, markRouterNavigations, mergeConnectPluginUi, navRoutes, needsCopy, newDriveError, newDrivesBlocked, notFoundTitle, parseConnectSearch, placementKeys, planReactorClient, primeRuntimeConfig, redirectToSettingsTab, refreshAppDrives, registerConnectPlugins, registerConnectRoutes, registerPackageRoutes, relistAppDrives, removeConnectRoutes, removeLocalCopies, resetConnectPluginUi, resolveReactorClientMode, resolveReactorWorkerEnabled, resolveRuntimeFlag, resolveSwitchboardDrives, routerPerfEnabled, selectAppReactorClient, servedUrl, servesSlug, setSettingsRoute, settingsTabs, settingsTabsOf, settingsTitle, showsSettingsTab, stringifyConnectSearch, switchboardDrives, useBackendAuthGate, useConnectChrome, useCreateDocumentTarget, useDriveRouteData, useDriveRouteIds, useForgetSettingsOpenedFrom, useIsColdStart, useIsEmbedded, useModalFrame, useNavRoutes, useSettingsTabs, useSidebarMode, validateConnectSearch, validateDriveSearch };
@@ -1,4 +1,4 @@
1
- import { l as LOCAL_BACKEND_NAME } from "./runtime-CJ3UJrQ2.js";
1
+ import { l as LOCAL_BACKEND_NAME } from "./runtime-DV6oRJYU.js";
2
2
  import { ambientRenownSigner, ambientRenownTokenProvider, createSwitchboardBackend } from "@powerhousedao/reactor-browser";
3
3
  import { logger } from "document-model";
4
4
  import { switchboardOfDrive } from "@powerhousedao/shared/host-tokens";
@@ -131,4 +131,4 @@ async function buildMultiReactorClient(params) {
131
131
  //#endregion
132
132
  export { ConnectRoutingClient, LOCAL_BACKEND_NAME, REMOTE_BACKEND_NAME, buildMultiReactorClient, deriveSwitchboardGraphqlUrl, localFacts, localReach };
133
133
 
134
- //# sourceMappingURL=multi-reactor-CZnlLi8M.js.map
134
+ //# sourceMappingURL=multi-reactor-D5r70cL2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"multi-reactor-CZnlLi8M.js","names":[],"sources":["../src/runtime/multi-reactor.ts"],"sourcesContent":["import {\n createReactorInspector,\n type ReactorInfo,\n} from \"@powerhousedao/reactor\";\nimport {\n ambientRenownSigner,\n ambientRenownTokenProvider,\n createSwitchboardBackend,\n type BrowserReactorClientModule,\n type SwitchboardBackend,\n type SwitchboardBreaker,\n type WorkerReactorClientModule,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n FanInPartialFailureError,\n fromReactorClient,\n RoutingReactorClient,\n type ReactorReach,\n type RoutableBackendConfig,\n type RouterDiagnostic,\n type RoutingClientOptions,\n} from \"@powerhousedao/reactor-router\";\nimport type {\n DocumentModelModule,\n ISigner,\n} from \"@powerhousedao/shared/document-model\";\nimport { switchboardOfDrive } from \"@powerhousedao/shared/host-tokens\";\nimport { logger } from \"document-model\";\nimport { LOCAL_BACKEND_NAME } from \"./drive-placement.js\";\n\nexport { LOCAL_BACKEND_NAME } from \"./drive-placement.js\";\nexport const REMOTE_BACKEND_NAME = \"switchboard-remote\";\n\nexport type LocalReactorModule =\n | BrowserReactorClientModule\n | WorkerReactorClientModule;\n\nexport function localReach(kind: LocalReactorModule[\"kind\"]): ReactorReach {\n return kind === \"worker\"\n ? { hosting: \"worker\", inspection: \"rpc\" }\n : { hosting: \"in-process\", inspection: \"direct\" };\n}\n\n/** Read at every refresh, never kept: a rebuilt reactor reports its own. */\nexport function localFacts(\n module: LocalReactorModule,\n): () => Promise<ReactorInfo> {\n if (module.kind === \"worker\") {\n return () => module.inspector.info();\n }\n return async () => {\n const reactorModule = module.reactorModule;\n if (!reactorModule) {\n throw new Error(\"The in-tab reactor exposes no module to inspect\");\n }\n return createReactorInspector(reactorModule).info();\n };\n}\n\n/** `<origin>[/<prefix>]/d/<slug>` -> `<origin>[/<prefix>]/graphql`. */\nexport function deriveSwitchboardGraphqlUrl(\n remoteDriveUrl: string,\n): string | undefined {\n return switchboardOfDrive(remoteDriveUrl)?.graphql;\n}\n\n/** A switchboard the router reaches, by its router backend name, with its connection settings. */\nexport type SwitchboardRemote = {\n name: string;\n graphqlUrl: string;\n requestTimeoutMs?: number;\n breaker?: SwitchboardBreaker;\n realtime?: boolean;\n};\n\n/** The loaded document models, or a getter that reads the current ones. */\nexport type LoadedDocumentModels =\n | readonly DocumentModelModule[]\n | (() => readonly DocumentModelModule[]);\n\nexport type MultiReactorParams = {\n /** The local module, built and ready. Undefined builds a REMOTE-ONLY router\n * (no local backend → no local reactor, no PGlite): the `remote` client. */\n module: LocalReactorModule | undefined;\n /** One per switchboard; `remoteGraphqlUrl` alone is one named `switchboard-remote`. */\n remotes?: readonly SwitchboardRemote[];\n remoteGraphqlUrl?: string;\n /** Collection key or drive id -> backend; names no backend here are dropped. */\n collections?: Readonly<Record<string, string>>;\n /** The remote new drives are created on, with no copy here. Absent: the\n * local reactor, else the only switchboard. */\n newDrives?: string;\n probeTimeoutMs?: number;\n provisionalRouteMs?: number;\n /** Signs routed writes; unsigned (anonymous) without one. */\n signer?: ISigner;\n /** Signing models when the local module exposes no registry; the router asks the local reactor (or, remote-only, the loaded set). */\n documentModelModules: LoadedDocumentModels;\n onDiagnostic?: RouterDiagnostic;\n};\n\n/**\n * The local answer stands when only the Switchboard could not answer -- but\n * only when there IS a local backend. Remote-only has nothing to fall back to,\n * so its errors surface. Installed as the router's `answerFailedIdCheck`, so\n * the facade and `write.isDocumentIdTaken` both apply it.\n */\nfunction localIdCheckAnswer(\n documentId: string,\n error: unknown,\n remoteNames: ReadonlySet<string>,\n): boolean | undefined {\n if (!failedOnlyOnRemote(error, remoteNames)) {\n return undefined;\n }\n logger.warn(\n \"The Switchboard could not say whether @id is taken; using the local reactor's answer: @error\",\n documentId,\n error,\n );\n return false;\n}\n\n/** The router Connect installs, with Connect's handling of credentials and id checks. */\nexport class ConnectRoutingClient extends RoutingReactorClient {\n private readonly remotes: readonly SwitchboardBackend[];\n /** The switchboard new drives are created on; undefined when it is this browser. */\n readonly newDrives: string | undefined;\n\n constructor(\n backends: readonly RoutableBackendConfig[],\n options: RoutingClientOptions,\n remotes: readonly SwitchboardBackend[],\n hasLocal: boolean,\n ) {\n const remoteNames = new Set(remotes.map((remote) => remote.config.name));\n super(backends, {\n ...options,\n answerFailedIdCheck: hasLocal\n ? (id, error) => localIdCheckAnswer(id, error, remoteNames)\n : options.answerFailedIdCheck,\n });\n this.remotes = remotes;\n const home = options.defaultBackend ?? options.primaryBackend;\n this.newDrives = home && remoteNames.has(home) ? home : undefined;\n }\n\n /** Renown's sign-in and sign-out call this on whatever client is installed. */\n notifyCredentialsChanged(): void {\n for (const remote of this.remotes) remote.notifyCredentialsChanged();\n }\n}\n\nfunction failedOnlyOnRemote(\n error: unknown,\n remoteNames: ReadonlySet<string>,\n): boolean {\n return (\n error instanceof FanInPartialFailureError &&\n error.failures.every((failure) => remoteNames.has(failure.backend))\n );\n}\n\n/** The remotes to build, one per switchboard: the first link to a base wins. */\nfunction remotesOf(params: MultiReactorParams): SwitchboardRemote[] {\n const listed: readonly SwitchboardRemote[] = params.remotes?.length\n ? params.remotes\n : params.remoteGraphqlUrl\n ? [{ name: REMOTE_BACKEND_NAME, graphqlUrl: params.remoteGraphqlUrl }]\n : [];\n const seen = new Set<string>();\n return listed.filter((remote) => {\n if (seen.has(remote.graphqlUrl)) {\n logger.warn(\n \"@name opens the same switchboard as an earlier backend; skipping it\",\n remote.name,\n );\n return false;\n }\n seen.add(remote.graphqlUrl);\n return true;\n });\n}\n\n/**\n * Build the Connect routing client. With a local `module` it is the router\n * over the tab's reactor (primary) and the Switchboard; WITHOUT one it is the\n * `remote` client — a remote-only router whose single backend is the\n * Switchboard, so no local reactor (and no PGlite) is built. Either way the\n * result is a full IReactorClient the app graph consumes unchanged.\n */\nexport async function buildMultiReactorClient(\n params: MultiReactorParams,\n): Promise<ConnectRoutingClient> {\n const module = params.module;\n const registry = module?.reactorModule?.documentModelRegistry;\n const loaded = params.documentModelModules;\n const loadedModules = typeof loaded === \"function\" ? loaded : () => loaded;\n const listed = remotesOf(params);\n if (listed.length === 0) {\n throw new Error(\"A routing client needs at least one switchboard\");\n }\n if (\n params.newDrives !== undefined &&\n !listed.some((remote) => remote.name === params.newDrives)\n ) {\n throw new Error(\n `New drives go to ${params.newDrives}, but this Connect doesn't link to it (it links to ${listed.map((remote) => remote.name).join(\", \")}).`,\n );\n }\n // The logged-in Renown user's token and signer, read per request as before.\n const remotes = listed.map((remote) =>\n createSwitchboardBackend({\n name: remote.name,\n url: remote.graphqlUrl,\n tokenProvider: ambientRenownTokenProvider,\n signer: ambientRenownSigner,\n documentModels: () => registry?.getAllModules() ?? loadedModules(),\n inspection: \"none\",\n requestTimeoutMs: remote.requestTimeoutMs,\n breaker: remote.breaker,\n realtime: remote.realtime,\n }),\n );\n const remoteBackends = remotes.map((remote) => remote.config);\n const backends: RoutableBackendConfig[] = module\n ? [\n {\n name: LOCAL_BACKEND_NAME,\n backend: fromReactorClient(module.client),\n facts: localFacts(module),\n reach: localReach(module.kind),\n refusesMisroutes: false,\n },\n ...remoteBackends,\n ]\n : remoteBackends;\n const names = new Set(backends.map((backend) => backend.name));\n const collections = Object.fromEntries(\n Object.entries(params.collections ?? {}).filter(([, backend]) =>\n names.has(backend),\n ),\n );\n // The local reactor answers the registry and create defaults; remote-only,\n // the switchboard new drives go to does.\n const primary = module\n ? LOCAL_BACKEND_NAME\n : (params.newDrives ?? remoteBackends[0].name);\n const router = new ConnectRoutingClient(\n backends,\n {\n primaryBackend: primary,\n defaultBackend: params.newDrives ?? primary,\n probeTimeoutMs: params.probeTimeoutMs,\n provisionalRouteMs: params.provisionalRouteMs,\n collections,\n signer: params.signer,\n onDiagnostic: params.onDiagnostic,\n // The Switchboard serves no models over GraphQL; remote-only uses the loaded set.\n documentModelModules: module ? undefined : loadedModules,\n },\n remotes,\n Boolean(module),\n );\n await router.refreshFacts();\n return router;\n}\n"],"mappings":";;;;;;;AA+BA,MAAa,sBAAsB;AAMnC,SAAgB,WAAW,MAAgD;CACzE,OAAO,SAAS,WACZ;EAAE,SAAS;EAAU,YAAY;CAAM,IACvC;EAAE,SAAS;EAAc,YAAY;CAAS;AACpD;;AAGA,SAAgB,WACd,QAC4B;CAC5B,IAAI,OAAO,SAAS,UAClB,aAAa,OAAO,UAAU,KAAK;CAErC,OAAO,YAAY;EACjB,MAAM,gBAAgB,OAAO;EAC7B,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AChB,gBAAgB,OAAO,aAAa;EACpC,gBAAgB,OAAO;EACvB,oBAAoB,OAAO;EAC3B;EACA,QAAQ,OAAO;EACf,cAAc,OAAO;EAErB,sBAAsB,SAAS,KAAA,IAAY;CAC7C,GACA,SACA,QAAQ,MAAM,CAChB;CACA,MAAM,OAAO,aAAa;CAC1B,OAAO;AACT"}
1
+ {"version":3,"file":"multi-reactor-D5r70cL2.js","names":[],"sources":["../src/runtime/multi-reactor.ts"],"sourcesContent":["import {\n createReactorInspector,\n type ReactorInfo,\n} from \"@powerhousedao/reactor\";\nimport {\n ambientRenownSigner,\n ambientRenownTokenProvider,\n createSwitchboardBackend,\n type BrowserReactorClientModule,\n type SwitchboardBackend,\n type SwitchboardBreaker,\n type WorkerReactorClientModule,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n FanInPartialFailureError,\n fromReactorClient,\n RoutingReactorClient,\n type ReactorReach,\n type RoutableBackendConfig,\n type RouterDiagnostic,\n type RoutingClientOptions,\n} from \"@powerhousedao/reactor-router\";\nimport type {\n DocumentModelModule,\n ISigner,\n} from \"@powerhousedao/shared/document-model\";\nimport { switchboardOfDrive } from \"@powerhousedao/shared/host-tokens\";\nimport { logger } from \"document-model\";\nimport { LOCAL_BACKEND_NAME } from \"./drive-placement.js\";\n\nexport { LOCAL_BACKEND_NAME } from \"./drive-placement.js\";\nexport const REMOTE_BACKEND_NAME = \"switchboard-remote\";\n\nexport type LocalReactorModule =\n | BrowserReactorClientModule\n | WorkerReactorClientModule;\n\nexport function localReach(kind: LocalReactorModule[\"kind\"]): ReactorReach {\n return kind === \"worker\"\n ? { hosting: \"worker\", inspection: \"rpc\" }\n : { hosting: \"in-process\", inspection: \"direct\" };\n}\n\n/** Read at every refresh, never kept: a rebuilt reactor reports its own. */\nexport function localFacts(\n module: LocalReactorModule,\n): () => Promise<ReactorInfo> {\n if (module.kind === \"worker\") {\n return () => module.inspector.info();\n }\n return async () => {\n const reactorModule = module.reactorModule;\n if (!reactorModule) {\n throw new Error(\"The in-tab reactor exposes no module to inspect\");\n }\n return createReactorInspector(reactorModule).info();\n };\n}\n\n/** `<origin>[/<prefix>]/d/<slug>` -> `<origin>[/<prefix>]/graphql`. */\nexport function deriveSwitchboardGraphqlUrl(\n remoteDriveUrl: string,\n): string | undefined {\n return switchboardOfDrive(remoteDriveUrl)?.graphql;\n}\n\n/** A switchboard the router reaches, by its router backend name, with its connection settings. */\nexport type SwitchboardRemote = {\n name: string;\n graphqlUrl: string;\n requestTimeoutMs?: number;\n breaker?: SwitchboardBreaker;\n realtime?: boolean;\n};\n\n/** The loaded document models, or a getter that reads the current ones. */\nexport type LoadedDocumentModels =\n | readonly DocumentModelModule[]\n | (() => readonly DocumentModelModule[]);\n\nexport type MultiReactorParams = {\n /** The local module, built and ready. Undefined builds a REMOTE-ONLY router\n * (no local backend → no local reactor, no PGlite): the `remote` client. */\n module: LocalReactorModule | undefined;\n /** One per switchboard; `remoteGraphqlUrl` alone is one named `switchboard-remote`. */\n remotes?: readonly SwitchboardRemote[];\n remoteGraphqlUrl?: string;\n /** Collection key or drive id -> backend; names no backend here are dropped. */\n collections?: Readonly<Record<string, string>>;\n /** The remote new drives are created on, with no copy here. Absent: the\n * local reactor, else the only switchboard. */\n newDrives?: string;\n probeTimeoutMs?: number;\n provisionalRouteMs?: number;\n /** Signs routed writes; unsigned (anonymous) without one. */\n signer?: ISigner;\n /** Signing models when the local module exposes no registry; the router asks the local reactor (or, remote-only, the loaded set). */\n documentModelModules: LoadedDocumentModels;\n onDiagnostic?: RouterDiagnostic;\n};\n\n/**\n * The local answer stands when only the Switchboard could not answer -- but\n * only when there IS a local backend. Remote-only has nothing to fall back to,\n * so its errors surface. Installed as the router's `answerFailedIdCheck`, so\n * the facade and `write.isDocumentIdTaken` both apply it.\n */\nfunction localIdCheckAnswer(\n documentId: string,\n error: unknown,\n remoteNames: ReadonlySet<string>,\n): boolean | undefined {\n if (!failedOnlyOnRemote(error, remoteNames)) {\n return undefined;\n }\n logger.warn(\n \"The Switchboard could not say whether @id is taken; using the local reactor's answer: @error\",\n documentId,\n error,\n );\n return false;\n}\n\n/** The router Connect installs, with Connect's handling of credentials and id checks. */\nexport class ConnectRoutingClient extends RoutingReactorClient {\n private readonly remotes: readonly SwitchboardBackend[];\n /** The switchboard new drives are created on; undefined when it is this browser. */\n readonly newDrives: string | undefined;\n\n constructor(\n backends: readonly RoutableBackendConfig[],\n options: RoutingClientOptions,\n remotes: readonly SwitchboardBackend[],\n hasLocal: boolean,\n ) {\n const remoteNames = new Set(remotes.map((remote) => remote.config.name));\n super(backends, {\n ...options,\n answerFailedIdCheck: hasLocal\n ? (id, error) => localIdCheckAnswer(id, error, remoteNames)\n : options.answerFailedIdCheck,\n });\n this.remotes = remotes;\n const home = options.defaultBackend ?? options.primaryBackend;\n this.newDrives = home && remoteNames.has(home) ? home : undefined;\n }\n\n /** Renown's sign-in and sign-out call this on whatever client is installed. */\n notifyCredentialsChanged(): void {\n for (const remote of this.remotes) remote.notifyCredentialsChanged();\n }\n}\n\nfunction failedOnlyOnRemote(\n error: unknown,\n remoteNames: ReadonlySet<string>,\n): boolean {\n return (\n error instanceof FanInPartialFailureError &&\n error.failures.every((failure) => remoteNames.has(failure.backend))\n );\n}\n\n/** The remotes to build, one per switchboard: the first link to a base wins. */\nfunction remotesOf(params: MultiReactorParams): SwitchboardRemote[] {\n const listed: readonly SwitchboardRemote[] = params.remotes?.length\n ? params.remotes\n : params.remoteGraphqlUrl\n ? [{ name: REMOTE_BACKEND_NAME, graphqlUrl: params.remoteGraphqlUrl }]\n : [];\n const seen = new Set<string>();\n return listed.filter((remote) => {\n if (seen.has(remote.graphqlUrl)) {\n logger.warn(\n \"@name opens the same switchboard as an earlier backend; skipping it\",\n remote.name,\n );\n return false;\n }\n seen.add(remote.graphqlUrl);\n return true;\n });\n}\n\n/**\n * Build the Connect routing client. With a local `module` it is the router\n * over the tab's reactor (primary) and the Switchboard; WITHOUT one it is the\n * `remote` client — a remote-only router whose single backend is the\n * Switchboard, so no local reactor (and no PGlite) is built. Either way the\n * result is a full IReactorClient the app graph consumes unchanged.\n */\nexport async function buildMultiReactorClient(\n params: MultiReactorParams,\n): Promise<ConnectRoutingClient> {\n const module = params.module;\n const registry = module?.reactorModule?.documentModelRegistry;\n const loaded = params.documentModelModules;\n const loadedModules = typeof loaded === \"function\" ? loaded : () => loaded;\n const listed = remotesOf(params);\n if (listed.length === 0) {\n throw new Error(\"A routing client needs at least one switchboard\");\n }\n if (\n params.newDrives !== undefined &&\n !listed.some((remote) => remote.name === params.newDrives)\n ) {\n throw new Error(\n `New drives go to ${params.newDrives}, but this Connect doesn't link to it (it links to ${listed.map((remote) => remote.name).join(\", \")}).`,\n );\n }\n // The logged-in Renown user's token and signer, read per request as before.\n const remotes = listed.map((remote) =>\n createSwitchboardBackend({\n name: remote.name,\n url: remote.graphqlUrl,\n tokenProvider: ambientRenownTokenProvider,\n signer: ambientRenownSigner,\n documentModels: () => registry?.getAllModules() ?? loadedModules(),\n inspection: \"none\",\n requestTimeoutMs: remote.requestTimeoutMs,\n breaker: remote.breaker,\n realtime: remote.realtime,\n }),\n );\n const remoteBackends = remotes.map((remote) => remote.config);\n const backends: RoutableBackendConfig[] = module\n ? [\n {\n name: LOCAL_BACKEND_NAME,\n backend: fromReactorClient(module.client),\n facts: localFacts(module),\n reach: localReach(module.kind),\n refusesMisroutes: false,\n },\n ...remoteBackends,\n ]\n : remoteBackends;\n const names = new Set(backends.map((backend) => backend.name));\n const collections = Object.fromEntries(\n Object.entries(params.collections ?? {}).filter(([, backend]) =>\n names.has(backend),\n ),\n );\n // The local reactor answers the registry and create defaults; remote-only,\n // the switchboard new drives go to does.\n const primary = module\n ? LOCAL_BACKEND_NAME\n : (params.newDrives ?? remoteBackends[0].name);\n const router = new ConnectRoutingClient(\n backends,\n {\n primaryBackend: primary,\n defaultBackend: params.newDrives ?? primary,\n probeTimeoutMs: params.probeTimeoutMs,\n provisionalRouteMs: params.provisionalRouteMs,\n collections,\n signer: params.signer,\n onDiagnostic: params.onDiagnostic,\n // The Switchboard serves no models over GraphQL; remote-only uses the loaded set.\n documentModelModules: module ? undefined : loadedModules,\n },\n remotes,\n Boolean(module),\n );\n await router.refreshFacts();\n return router;\n}\n"],"mappings":";;;;;;;AA+BA,MAAa,sBAAsB;AAMnC,SAAgB,WAAW,MAAgD;CACzE,OAAO,SAAS,WACZ;EAAE,SAAS;EAAU,YAAY;CAAM,IACvC;EAAE,SAAS;EAAc,YAAY;CAAS;AACpD;;AAGA,SAAgB,WACd,QAC4B;CAC5B,IAAI,OAAO,SAAS,UAClB,aAAa,OAAO,UAAU,KAAK;CAErC,OAAO,YAAY;EACjB,MAAM,gBAAgB,OAAO;EAC7B,IAAI,CAAC,eACH,MAAM,IAAI,MAAM,iDAAiD;EAEnE,OAAO,uBAAuB,aAAa,CAAC,CAAC,KAAK;CACpD;AACF;;AAGA,SAAgB,4BACd,gBACoB;CACpB,OAAO,mBAAmB,cAAc,CAAC,EAAE;AAC7C;;;;;;;AA2CA,SAAS,mBACP,YACA,OACA,aACqB;CACrB,IAAI,CAAC,mBAAmB,OAAO,WAAW,GACxC;CAEF,OAAO,KACL,gGACA,YACA,KACF;CACA,OAAO;AACT;;AAGA,IAAa,uBAAb,cAA0C,qBAAqB;CAC7D;;CAEA;CAEA,YACE,UACA,SACA,SACA,UACA;EACA,MAAM,cAAc,IAAI,IAAI,QAAQ,KAAK,WAAW,OAAO,OAAO,IAAI,CAAC;EACvE,MAAM,UAAU;GACd,GAAG;GACH,qBAAqB,YAChB,IAAI,UAAU,mBAAmB,IAAI,OAAO,WAAW,IACxD,QAAQ;EACd,CAAC;EACD,KAAK,UAAU;EACf,MAAM,OAAO,QAAQ,kBAAkB,QAAQ;EAC/C,KAAK,YAAY,QAAQ,YAAY,IAAI,IAAI,IAAI,OAAO,KAAA;CAC1D;;CAGA,2BAAiC;EAC/B,KAAK,MAAM,UAAU,KAAK,SAAS,OAAO,yBAAyB;CACrE;AACF;AAEA,SAAS,mBACP,O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EACN,SAAS,kBAAkB,OAAO,MAAM;EACxC,OAAO,WAAW,MAAM;EACxB,OAAO,WAAW,OAAO,IAAI;EAC7B,kBAAkB;CACpB,GACA,GAAG,cACL,IACA;CACJ,MAAM,QAAQ,IAAI,IAAI,SAAS,KAAK,YAAY,QAAQ,IAAI,CAAC;CAC7D,MAAM,cAAc,OAAO,YACzB,OAAO,QAAQ,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,aAClD,MAAM,IAAI,OAAO,CACnB,CACF;CAGA,MAAM,UAAU,SACZ,qBACC,OAAO,aAAa,eAAe,EAAE,CAAC;CAC3C,MAAM,SAAS,IAAI,qBACjB,UACA;EACE,gBAAgB;EAChB,gBAAgB,OAAO,aAAa;EACpC,gBAAgB,OAAO;EACvB,oBAAoB,OAAO;EAC3B;EACA,QAAQ,OAAO;EACf,cAAc,OAAO;EAErB,sBAAsB,SAAS,KAAA,IAAY;CAC7C,GACA,SACA,QAAQ,MAAM,CAChB;CACA,MAAM,OAAO,aAAa;CAC1B,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-host-CaTO1tq-.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-CaTO1tq-.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 over the config's\n// `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"}
@@ -136,11 +136,11 @@ function mergeConnectPluginUi(uis) {
136
136
  }
137
137
  return set;
138
138
  }
139
- /** Loads the UI of the plugins `composition` names, or of every known plugin
140
- * without one (classic Connect), and keeps it for `getConnectPluginUi`. */
139
+ /** Loads the UI of the plugins `composition` names and keeps it for
140
+ * `getConnectPluginUi`. */
141
141
  async function loadConnectPluginUi(composition) {
142
142
  const definitions = await knownPlugins();
143
- const modules = composition ? composition.map((entry) => entry.module) : Object.keys(definitions);
143
+ const modules = composition.map((entry) => entry.module);
144
144
  const set = mergeConnectPluginUi((await Promise.all(modules.map((module) => definitions[module]?.ui?.() ?? Promise.resolve(void 0)))).filter((ui) => !!ui));
145
145
  getConnectRegistry().ui = set;
146
146
  return set;
@@ -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-BS5j5g1d.js.map
200
+ //# sourceMappingURL=plugin-ui-Cvd3Kpgb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-ui-BS5j5g1d.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,MAAM,OAAuB,OAAO,SAChC;IAAE,SAAS,OAAO;IAAS,QAAQ,OAAO;GAAO,IACjD,EAAE,SAAS,O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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-Cvd3Kpgb.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 and keeps it for\n * `getConnectPluginUi`. */\nexport async function loadConnectPluginUi(\n composition: readonly { module: string }[],\n): Promise<ConnectPluginUiSet> {\n const definitions = await knownPlugins();\n const modules = composition.map((entry) => entry.module);\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,S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,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"}
@@ -0,0 +1,27 @@
1
+ import { getRuntimeConfig } from "./runtime-config.js";
2
+ //#region src/plugins/composition.ts
3
+ /**
4
+ * Plugin-presence reads for the UI (rewire R3, step toward generic-shell
5
+ * deletability). The runtime config carries `connect.composition`: the list
6
+ * of plugins the host declared, or the default one `loadRuntimeConfig` works
7
+ * out for a config served without. UI can gate on a plugin being present
8
+ * ("presence is activation").
9
+ *
10
+ * A plugin absent from the composition is not active, and with no composition
11
+ * in the config no plugin is.
12
+ */
13
+ function getActivePluginModules() {
14
+ try {
15
+ const composition = getRuntimeConfig().connect?.composition;
16
+ return new Set((composition ?? []).map((entry) => entry.module));
17
+ } catch {
18
+ return /* @__PURE__ */ new Set();
19
+ }
20
+ }
21
+ function isPluginActive(module) {
22
+ return getActivePluginModules().has(module);
23
+ }
24
+ //#endregion
25
+ export { isPluginActive as n, getActivePluginModules as t };
26
+
27
+ //# sourceMappingURL=plugins-BZq6MY00.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins-BZq6MY00.js","names":[],"sources":["../src/plugins/composition.ts"],"sourcesContent":["import type { PHConnectCompositionEntry } from \"@powerhousedao/shared/clis\";\nimport { getRuntimeConfig } from \"../runtime/runtime-config.js\";\n\n/**\n * Plugin-presence reads for the UI (rewire R3, step toward generic-shell\n * deletability). The runtime config carries `connect.composition`: the list\n * of plugins the host declared, or the default one `loadRuntimeConfig` works\n * out for a config served without. UI can gate on a plugin being present\n * (\"presence is activation\").\n *\n * A plugin absent from the composition is not active, and with no composition\n * in the config no plugin is.\n */\nexport function getActivePluginModules(): ReadonlySet<string> {\n try {\n const composition = getRuntimeConfig().connect?.composition as\n | PHConnectCompositionEntry[]\n | undefined;\n return new Set((composition ?? []).map((entry) => entry.module));\n } catch {\n // Config cache not warm (shouldn't happen post-boot): no plugin is active.\n return new Set();\n }\n}\n\nexport function isPluginActive(module: string): boolean {\n return getActivePluginModules().has(module);\n}\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,yBAA8C;CAC5D,IAAI;EACF,MAAM,cAAc,iBAAiB,CAAC,CAAC,SAAS;EAGhD,OAAO,IAAI,KAAK,eAAe,CAAC,EAAA,CAAG,KAAK,UAAU,MAAM,MAAM,CAAC;CACjE,QAAQ;EAEN,uBAAO,IAAI,IAAI;CACjB;AACF;AAEA,SAAgB,eAAe,QAAyB;CACtD,OAAO,uBAAuB,CAAC,CAAC,IAAI,MAAM;AAC5C"}
package/dist/plugins.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as ConnectConfigHooks, G as ConnectPluginUi, H as ConnectPluginContext, K as ConnectRouteUi, U as ConnectPluginDefinition, V as ConnectPlugin, W as ConnectPluginFactory, c as applyConnectPluginUi, d as mergeConnectPluginUi, f as resetConnectPluginUi, l as getConnectPluginUi, s as ConnectPluginUiSet, u as loadConnectPluginUi } from "./connect-router-11uRIT3z.js";
2
- import { a as registerConnectPlugins, i as knownPlugins, n as isPluginActive, r as applyComposition, t as getActivePluginModules } from "./index-xKGW_46_.js";
1
+ import { B as ConnectConfigHooks, G as ConnectPluginUi, H as ConnectPluginContext, K as ConnectRouteUi, U as ConnectPluginDefinition, V as ConnectPlugin, W as ConnectPluginFactory, c as applyConnectPluginUi, d as mergeConnectPluginUi, f as resetConnectPluginUi, l as getConnectPluginUi, s as ConnectPluginUiSet, u as loadConnectPluginUi } from "./connect-router-P44ov38H.js";
2
+ import { a as registerConnectPlugins, i as knownPlugins, n as isPluginActive, r as applyComposition, t as getActivePluginModules } from "./index-NmWuyjQT.js";
3
3
  export { type ConnectConfigHooks, type ConnectPlugin, type ConnectPluginContext, type ConnectPluginDefinition, type ConnectPluginFactory, type ConnectPluginUi, type ConnectPluginUiSet, type ConnectRouteUi, applyComposition, applyConnectPluginUi, getActivePluginModules, getConnectPluginUi, isPluginActive, knownPlugins, loadConnectPluginUi, mergeConnectPluginUi, registerConnectPlugins, resetConnectPluginUi };
4
4
  export {};
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-BS5j5g1d.js";
1
+ import { i as mergeConnectPluginUi, n as getConnectPluginUi, o as resetConnectPluginUi, r as loadConnectPluginUi, t as applyConnectPluginUi } from "./plugin-ui-Cvd3Kpgb.js";
2
2
  import { i as registerConnectPlugins, n as knownPlugins, t as applyComposition } from "./plugin-host-CaTO1tq-.js";
3
- import { n as isPluginActive, t as getActivePluginModules } from "./plugins-x1XqLPzp.js";
3
+ import { n as isPluginActive, t as getActivePluginModules } from "./plugins-BZq6MY00.js";
4
4
  export { applyComposition, applyConnectPluginUi, getActivePluginModules, getConnectPluginUi, isPluginActive, knownPlugins, loadConnectPluginUi, mergeConnectPluginUi, registerConnectPlugins, resetConnectPluginUi };
@@ -1,4 +1,4 @@
1
- import { F as DriveRouteData, I as DriveRouteParams, M as ConnectRouterContext, N as DriveLoaderOptions } from "./connect-router-11uRIT3z.js";
1
+ import { F as DriveRouteData, I as DriveRouteParams, M as ConnectRouterContext, N as DriveLoaderOptions } from "./connect-router-P44ov38H.js";
2
2
  import "./index.js";
3
3
  import { n as ResolveParams, r as Route, t as AnyContext } from "./index-PjlUqG36.js";
4
4
  import { Route as Route$1 } from "./routes/__root.js";
@@ -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-BS5j5g1d.js";
2
+ import { c as CoreNotFound, n as getConnectPluginUi, s as CoreError, t as applyConnectPluginUi } from "./plugin-ui-Cvd3Kpgb.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-C5uD96ZP.js.map
498
+ //# sourceMappingURL=router-R54qCm4H.js.map