@powerhousedao/connect-core 6.2.3-dev.77 → 6.2.3-dev.79

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 (98) hide show
  1. package/dist/connect-router-11uRIT3z.d.ts.map +1 -1
  2. package/dist/{index-Cm8rYUhs.d.ts → index-Bfl1VYdj.d.ts} +21 -2
  3. package/dist/index-Bfl1VYdj.d.ts.map +1 -0
  4. package/dist/index-DQ0nbYne.d.ts.map +1 -1
  5. package/dist/{index-q4bHCPoJ.d.ts → index-r46ba0Kx.d.ts} +9 -6
  6. package/dist/index-r46ba0Kx.d.ts.map +1 -0
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +9 -9
  9. package/dist/{multi-reactor-CPRsFtfd.js → multi-reactor-D_2B4jmu.js} +4 -2
  10. package/dist/multi-reactor-D_2B4jmu.js.map +1 -0
  11. package/dist/{plugin-host-BSFfhXpz.js → plugin-host-D_EW56IQ.js} +2 -2
  12. package/dist/{plugin-host-BSFfhXpz.js.map → plugin-host-D_EW56IQ.js.map} +1 -1
  13. package/dist/{plugin-ui-sO7AJLHj.js → plugin-ui-fDXhKTCK.js} +5 -5
  14. package/dist/plugin-ui-fDXhKTCK.js.map +1 -0
  15. package/dist/plugins.js +2 -2
  16. package/dist/route-tree.d.ts +16 -16
  17. package/dist/route-tree.d.ts.map +1 -1
  18. package/dist/{router-8pekwJsk.js → router-wVNdTI-Y.js} +11 -4
  19. package/dist/router-wVNdTI-Y.js.map +1 -0
  20. package/dist/router.d.ts +2 -2
  21. package/dist/router.js +4 -4
  22. package/dist/routes/__root.d.ts +3 -3
  23. package/dist/routes/__root.d.ts.map +1 -1
  24. package/dist/routes/__root.js +3 -3
  25. package/dist/routes/__root.js.map +1 -1
  26. package/dist/routes/_app/$.d.ts +3 -3
  27. package/dist/routes/_app/$.d.ts.map +1 -1
  28. package/dist/routes/_app/$.js +3 -3
  29. package/dist/routes/_app/$.js.map +1 -1
  30. package/dist/routes/_app/d/$driveSlug/{-$nodeSlug}.d.ts +5 -5
  31. package/dist/routes/_app/d/$driveSlug/{-$nodeSlug}.d.ts.map +1 -1
  32. package/dist/routes/_app/d/$driveSlug/{-$nodeSlug}.js +3 -3
  33. package/dist/routes/_app/d/$driveSlug/{-$nodeSlug}.js.map +1 -1
  34. package/dist/routes/_app/d/$driveSlug.d.ts +4 -4
  35. package/dist/routes/_app/d/$driveSlug.d.ts.map +1 -1
  36. package/dist/routes/_app/d/$driveSlug.js +3 -3
  37. package/dist/routes/_app/d/$driveSlug.js.map +1 -1
  38. package/dist/routes/_app/index.d.ts +41 -2
  39. package/dist/routes/_app/index.d.ts.map +1 -1
  40. package/dist/routes/_app/index.js +2 -2
  41. package/dist/routes/_app/index.js.map +1 -1
  42. package/dist/routes/_app/settings/appearance.d.ts +3 -3
  43. package/dist/routes/_app/settings/appearance.d.ts.map +1 -1
  44. package/dist/routes/_app/settings/appearance.js +3 -3
  45. package/dist/routes/_app/settings/appearance.js.map +1 -1
  46. package/dist/routes/_app/settings/packages.d.ts +3 -3
  47. package/dist/routes/_app/settings/packages.d.ts.map +1 -1
  48. package/dist/routes/_app/settings/packages.js +3 -3
  49. package/dist/routes/_app/settings/packages.js.map +1 -1
  50. package/dist/routes/_app/settings.d.ts +3 -3
  51. package/dist/routes/_app/settings.d.ts.map +1 -1
  52. package/dist/routes/_app/settings.js +3 -3
  53. package/dist/routes/_app/settings.js.map +1 -1
  54. package/dist/routes/_app.d.ts +41 -2
  55. package/dist/routes/_app.d.ts.map +1 -1
  56. package/dist/routes/_app.js +2 -2
  57. package/dist/routes/_app.js.map +1 -1
  58. package/dist/{runtime-D8IBQzHM.js → runtime-BUG9vT2E.js} +20 -8
  59. package/dist/runtime-BUG9vT2E.js.map +1 -0
  60. package/dist/runtime-config.js +4 -4
  61. package/dist/{runtime-flag-CJWngtxE.js → runtime-flag-Bp6QasS8.js} +2 -2
  62. package/dist/{runtime-flag-CJWngtxE.js.map → runtime-flag-Bp6QasS8.js.map} +1 -1
  63. package/dist/runtime.d.ts +2 -2
  64. package/dist/runtime.js +4 -4
  65. package/dist/{sidebar-DVQCwBYR.js → sidebar-C2y4mZnX.js} +16 -5
  66. package/dist/sidebar-C2y4mZnX.js.map +1 -0
  67. package/dist/{views-CAbBIFzO.js → views-Ba9OeN3c.js} +10 -4
  68. package/dist/views-Ba9OeN3c.js.map +1 -0
  69. package/dist/views.js +1 -1
  70. package/package.json +8 -8
  71. package/src/router/connect-router.ts +1 -0
  72. package/src/router/drive-route-loader.ts +3 -1
  73. package/src/router/index.ts +14 -2
  74. package/src/router/route-data.ts +2 -4
  75. package/src/router/route-options.ts +16 -0
  76. package/src/router/sidebar.ts +22 -0
  77. package/src/router/titles.ts +2 -2
  78. package/src/routes/__root.tsx +3 -2
  79. package/src/routes/_app/$.tsx +3 -2
  80. package/src/routes/_app/d/$driveSlug/{-$nodeSlug}.tsx +3 -2
  81. package/src/routes/_app/d/$driveSlug.tsx +3 -2
  82. package/src/routes/_app/index.tsx +2 -2
  83. package/src/routes/_app/settings/appearance.tsx +3 -3
  84. package/src/routes/_app/settings/packages.tsx +3 -3
  85. package/src/routes/_app/settings.tsx +3 -2
  86. package/src/routes/_app.tsx +2 -2
  87. package/src/runtime/graphql-routable-backend.ts +11 -2
  88. package/src/runtime/index.ts +5 -1
  89. package/src/runtime/reactor-client-mode.ts +26 -9
  90. package/src/views/directory-listing.tsx +12 -1
  91. package/dist/index-Cm8rYUhs.d.ts.map +0 -1
  92. package/dist/index-q4bHCPoJ.d.ts.map +0 -1
  93. package/dist/multi-reactor-CPRsFtfd.js.map +0 -1
  94. package/dist/plugin-ui-sO7AJLHj.js.map +0 -1
  95. package/dist/router-8pekwJsk.js.map +0 -1
  96. package/dist/runtime-D8IBQzHM.js.map +0 -1
  97. package/dist/sidebar-DVQCwBYR.js.map +0 -1
  98. package/dist/views-CAbBIFzO.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import { createFileRoute } from "@tanstack/react-router";
2
- import { coreView } from "@powerhousedao/connect-core/router";
2
+ import { coreRouteOptions, coreView } from "@powerhousedao/connect-core/router";
3
3
  //#region src/routes/_app/settings/packages.tsx
4
4
  /** The tab's options: its entry in the settings page. */
5
- const options = { staticData: { settings: {
5
+ const options = coreRouteOptions({ staticData: { settings: {
6
6
  label: "Packages",
7
7
  order: 50
8
- } } };
8
+ } } });
9
9
  const Route = createFileRoute("/_app/settings/packages")({
10
10
  ...options,
11
11
  codeSplitGroupings: [],
@@ -1 +1 @@
1
- {"version":3,"file":"packages.js","names":[],"sources":["../../../../src/routes/_app/settings/packages.tsx"],"sourcesContent":["import { createFileRoute } from \"@tanstack/react-router\";\nimport { coreView } from \"@powerhousedao/connect-core/router\";\n\n/** The tab's options: its entry in the settings page. */\nexport const options = {\n staticData: { settings: { label: \"Packages\", order: 50 } },\n};\n\n// The loaded packages, their document models and editors.\nexport const Route = createFileRoute(\"/_app/settings/packages\")({\n ...options,\n // Core routes stay in the main chunk when a project build splits its routes.\n codeSplitGroupings: [],\n component: coreView(\"PackagesTab\"),\n});\n"],"mappings":";;;;AAIA,MAAa,UAAU,EACrB,YAAY,EAAE,UAAU;CAAE,OAAO;CAAY,OAAO;AAAG,EAAE,EAC3D;AAGA,MAAa,QAAQ,gBAAgB,yBAAyB,CAAC,CAAC;CAC9D,GAAG;CAEH,oBAAoB,CAAC;CACrB,WAAW,SAAS,aAAa;AACnC,CAAC"}
1
+ {"version":3,"file":"packages.js","names":[],"sources":["../../../../src/routes/_app/settings/packages.tsx"],"sourcesContent":["import { createFileRoute } from \"@tanstack/react-router\";\nimport { coreRouteOptions, coreView } from \"@powerhousedao/connect-core/router\";\n\n/** The tab's options: its entry in the settings page. */\nexport const options = coreRouteOptions({\n staticData: { settings: { label: \"Packages\", order: 50 } },\n});\n\n// The loaded packages, their document models and editors.\nexport const Route = createFileRoute(\"/_app/settings/packages\")({\n ...options,\n // Core routes stay in the main chunk when a project build splits its routes.\n codeSplitGroupings: [],\n component: coreView(\"PackagesTab\"),\n});\n"],"mappings":";;;;AAIA,MAAa,UAAU,iBAAiB,EACtC,YAAY,EAAE,UAAU;CAAE,OAAO;CAAY,OAAO;AAAG,EAAE,EAC3D,CAAC;AAGD,MAAa,QAAQ,gBAAgB,yBAAyB,CAAC,CAAC;CAC9D,GAAG;CAEH,oBAAoB,CAAC;CACrB,WAAW,SAAS,aAAa;AACnC,CAAC"}
@@ -4,7 +4,7 @@ import { ConnectRouterContext } from "@powerhousedao/connect-core/router";
4
4
  //#region src/routes/_app/settings.d.ts
5
5
  /** The settings page's options: the tab redirect and title. Its tabs are its
6
6
  * child routes with `staticData.settings`. */
7
- export declare const options: {
7
+ export declare const options: import("@powerhousedao/connect-core/router").CoreRouteOptions<{
8
8
  beforeLoad: (context: any) => void;
9
9
  head: ({ matches, match }: {
10
10
  matches: readonly {
@@ -18,8 +18,8 @@ export declare const options: {
18
18
  title: string;
19
19
  }[];
20
20
  };
21
- };
22
- export declare const Route: Route$1<import("@tanstack/react-router").Register, Route$1<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, (search: Record<string, unknown>) => Record<string, string | undefined>, ConnectRouterContext, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "", "/", "/_app", "/_app", undefined, import("@tanstack/react-router").ResolveParams<"">, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/settings", "/settings", "/_app/settings", "/_app/settings", undefined, import("@tanstack/react-router").ResolveParams<"/settings">, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, (context: any) => void, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
21
+ }>;
22
+ export declare const Route: Route$1<import("@tanstack/react-router").Register, Route$1<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, (search: Record<string, unknown>) => Record<string, string | undefined>, ConnectRouterContext, undefined, undefined, {}, undefined, unknown, unknown, undefined, unknown, undefined>, "", "/", "/_app", "/_app", undefined, import("@tanstack/react-router").ResolveParams<"">, import("@tanstack/react-router").AnyContext, undefined, undefined, {}, undefined, unknown, unknown, undefined, unknown, undefined>, "/settings", "/settings", "/_app/settings", "/_app/settings", undefined, import("@tanstack/react-router").ResolveParams<"/settings">, import("@tanstack/react-router").AnyContext, undefined, (context: any) => void, {}, undefined, unknown, unknown, undefined, unknown, undefined>;
23
23
  //#endregion
24
24
  export {};
25
25
  //# sourceMappingURL=settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","names":[],"sources":["../../../src/routes/_app/settings.tsx"],"mappings":";;;;;;qBAWa;EAG0B,aAAC;EAKnC,SAAA,SAAA;IACD;MAAoB,YAAY;;IAChC;MAAS,SAAS;;;;;;;;qBAcT,OAAK,yCAAA,UAAA,yCAAA,2CAAA,2CAAA,WAAA,QAAA,4BAAA,oCAAA,uDAAA,6CAAA,kJAAA,oDAAA,6CAAA,6CAAA,qLAAA,6DAAA,6CAAA,aAAA"}
1
+ {"version":3,"file":"settings.d.ts","names":[],"sources":["../../../src/routes/_app/settings.tsx"],"mappings":";;;;;;qBAYa,sDAAO;EAGmB,aAAC;EAKnC,SAAA,SAAA;IACD;MAAoB,YAAY;;IAChC;MAAS,SAAS;;;;;;;;qBAcT,OAAK,yCAAA,UAAA,yCAAA,2CAAA,2CAAA,WAAA,QAAA,4BAAA,oCAAA,oLAAA,oDAAA,6MAAA,6DAAA,wBAAA"}
@@ -1,12 +1,12 @@
1
1
  import { createFileRoute } from "@tanstack/react-router";
2
- import { coreView, redirectToSettingsTab, settingsTitle } from "@powerhousedao/connect-core/router";
2
+ import { coreRouteOptions, coreView, redirectToSettingsTab, settingsTitle } from "@powerhousedao/connect-core/router";
3
3
  //#region src/routes/_app/settings.tsx
4
4
  /** The settings page's options: the tab redirect and title. Its tabs are its
5
5
  * child routes with `staticData.settings`. */
6
- const options = {
6
+ const options = coreRouteOptions({
7
7
  beforeLoad: redirectToSettingsTab,
8
8
  head: ({ matches, match }) => ({ meta: [{ title: settingsTitle(matches.at(-1)?.staticData.settings?.label, match.context.appName) }] })
9
- };
9
+ });
10
10
  const Route = createFileRoute("/_app/settings")({
11
11
  ...options,
12
12
  codeSplitGroupings: [],
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","names":[],"sources":["../../../src/routes/_app/settings.tsx"],"sourcesContent":["import type { ConnectRouterContext } from \"@powerhousedao/connect-core/router\";\nimport {\n coreView,\n redirectToSettingsTab,\n settingsTitle,\n} from \"@powerhousedao/connect-core/router\";\nimport type { StaticDataRouteOption } from \"@tanstack/react-router\";\nimport { createFileRoute } from \"@tanstack/react-router\";\n\n/** The settings page's options: the tab redirect and title. Its tabs are its\n * child routes with `staticData.settings`. */\nexport const options = {\n // Bare /settings and a disabled tab go to the first tab. `any`: checking the\n // router's context against a typed parameter here is circular.\n beforeLoad: redirectToSettingsTab as (context: any) => void,\n // The shown tab's label; a tab needs no head of its own.\n head: ({\n matches,\n match,\n }: {\n matches: readonly { staticData: StaticDataRouteOption }[];\n match: { context: ConnectRouterContext };\n }) => ({\n meta: [\n {\n title: settingsTitle(\n matches.at(-1)?.staticData.settings?.label,\n match.context.appName,\n ),\n },\n ],\n }),\n};\n\n// The tab list beside the shown tab.\nexport const Route = createFileRoute(\"/_app/settings\")({\n ...options,\n // Core routes stay in the main chunk when a project build splits its routes.\n codeSplitGroupings: [],\n component: coreView(\"CoreSettingsPage\"),\n});\n"],"mappings":";;;;;AAWA,MAAa,UAAU;CAGrB,YAAY;CAEZ,OAAO,EACL,SACA,aAIK,EACL,MAAM,CACJ,EACE,OAAO,cACL,QAAQ,GAAG,EAAE,CAAC,EAAE,WAAW,UAAU,OACrC,MAAM,QAAQ,OAChB,EACF,CACF,EACF;AACF;AAGA,MAAa,QAAQ,gBAAgB,gBAAgB,CAAC,CAAC;CACrD,GAAG;CAEH,oBAAoB,CAAC;CACrB,WAAW,SAAS,kBAAkB;AACxC,CAAC"}
1
+ {"version":3,"file":"settings.js","names":[],"sources":["../../../src/routes/_app/settings.tsx"],"sourcesContent":["import type { ConnectRouterContext } from \"@powerhousedao/connect-core/router\";\nimport {\n coreRouteOptions,\n coreView,\n redirectToSettingsTab,\n settingsTitle,\n} from \"@powerhousedao/connect-core/router\";\nimport type { StaticDataRouteOption } from \"@tanstack/react-router\";\nimport { createFileRoute } from \"@tanstack/react-router\";\n\n/** The settings page's options: the tab redirect and title. Its tabs are its\n * child routes with `staticData.settings`. */\nexport const options = coreRouteOptions({\n // Bare /settings and a disabled tab go to the first tab. `any`: checking the\n // router's context against a typed parameter here is circular.\n beforeLoad: redirectToSettingsTab as (context: any) => void,\n // The shown tab's label; a tab needs no head of its own.\n head: ({\n matches,\n match,\n }: {\n matches: readonly { staticData: StaticDataRouteOption }[];\n match: { context: ConnectRouterContext };\n }) => ({\n meta: [\n {\n title: settingsTitle(\n matches.at(-1)?.staticData.settings?.label,\n match.context.appName,\n ),\n },\n ],\n }),\n});\n\n// The tab list beside the shown tab.\nexport const Route = createFileRoute(\"/_app/settings\")({\n ...options,\n // Core routes stay in the main chunk when a project build splits its routes.\n codeSplitGroupings: [],\n component: coreView(\"CoreSettingsPage\"),\n});\n"],"mappings":";;;;;AAYA,MAAa,UAAU,iBAAiB;CAGtC,YAAY;CAEZ,OAAO,EACL,SACA,aAIK,EACL,MAAM,CACJ,EACE,OAAO,cACL,QAAQ,GAAG,EAAE,CAAC,EAAE,WAAW,UAAU,OACrC,MAAM,QAAQ,OAChB,EACF,CACF,EACF;AACF,CAAC;AAGD,MAAa,QAAQ,gBAAgB,gBAAgB,CAAC,CAAC;CACrD,GAAG;CAEH,oBAAoB,CAAC;CACrB,WAAW,SAAS,kBAAkB;AACxC,CAAC"}
@@ -1,8 +1,47 @@
1
1
  import { r as Route$1 } from "../index-PjlUqG36.js";
2
2
  //#region src/routes/_app.d.ts
3
3
  /** The layout's options; none yet. */
4
- export declare const options: {};
5
- export declare const Route: Route$1<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, (search: Record<string, unknown>) => Record<string, string | undefined>, import("@powerhousedao/connect-core/router").ConnectRouterContext, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "", "/", "/_app", "/_app", undefined, import("@tanstack/react-router").ResolveParams<"">, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
4
+ export declare const options: {
5
+ beforeLoad?: undefined;
6
+ caseSensitive?: undefined;
7
+ codeSplitGroupings?: undefined;
8
+ component?: undefined;
9
+ context?: undefined;
10
+ errorComponent?: undefined;
11
+ gcTime?: undefined;
12
+ getParentRoute?: undefined;
13
+ head?: undefined;
14
+ headers?: undefined;
15
+ loader?: undefined;
16
+ loaderDeps?: undefined;
17
+ notFoundComponent?: undefined;
18
+ onCatch?: undefined;
19
+ onEnter?: undefined;
20
+ onError?: undefined;
21
+ onLeave?: undefined;
22
+ onStay?: undefined;
23
+ params?: undefined;
24
+ parseParams?: undefined;
25
+ pendingComponent?: undefined;
26
+ pendingMinMs?: undefined;
27
+ pendingMs?: undefined;
28
+ postSearchFilters?: undefined;
29
+ preSearchFilters?: undefined;
30
+ preload?: undefined;
31
+ preloadGcTime?: undefined;
32
+ preloadStaleTime?: undefined;
33
+ remountDeps?: undefined;
34
+ scripts?: undefined;
35
+ search?: undefined;
36
+ shouldReload?: undefined;
37
+ ssr?: undefined;
38
+ staleTime?: undefined;
39
+ staticData?: undefined;
40
+ stringifyParams?: undefined;
41
+ validateSearch?: undefined;
42
+ wrapInSuspense?: undefined;
43
+ };
44
+ export declare const Route: Route$1<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, (search: Record<string, unknown>) => Record<string, string | undefined>, import("@powerhousedao/connect-core/router").ConnectRouterContext, undefined, undefined, {}, undefined, unknown, unknown, undefined, unknown, undefined>, "", "/", "/_app", "/_app", undefined, import("@tanstack/react-router").ResolveParams<"">, import("@tanstack/react-router").AnyContext, undefined, undefined, {}, undefined, unknown, unknown, undefined, unknown, undefined>;
6
45
  //#endregion
7
46
  export {};
8
47
  //# sourceMappingURL=_app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_app.d.ts","names":[],"sources":["../../src/routes/_app.tsx"],"mappings":";;;qBAIa;qBAIA,OAAK,yCAAA,2CAAA,2CAAA,WAAA,QAAA,4BAAA,iFAAA,uDAAA,6CAAA,kJAAA,oDAAA,6CAAA,6CAAA"}
1
+ {"version":3,"file":"_app.d.ts","names":[],"sources":["../../src/routes/_app.tsx"],"mappings":";;;qBAIa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAIA,OAAK,yCAAA,2CAAA,2CAAA,WAAA,QAAA,4BAAA,iFAAA,oLAAA,oDAAA"}
@@ -1,8 +1,8 @@
1
1
  import { createFileRoute } from "@tanstack/react-router";
2
- import { coreView } from "@powerhousedao/connect-core/router";
2
+ import { coreRouteOptions, coreView } from "@powerhousedao/connect-core/router";
3
3
  //#region src/routes/_app.tsx
4
4
  /** The layout's options; none yet. */
5
- const options = {};
5
+ const options = coreRouteOptions({});
6
6
  const Route = createFileRoute("/_app")({
7
7
  ...options,
8
8
  codeSplitGroupings: [],
@@ -1 +1 @@
1
- {"version":3,"file":"_app.js","names":[],"sources":["../../src/routes/_app.tsx"],"sourcesContent":["import { createFileRoute } from \"@tanstack/react-router\";\nimport { coreView } from \"@powerhousedao/connect-core/router\";\n\n/** The layout's options; none yet. */\nexport const options = {};\n\n// Pathless: the header and content area around home, drives, settings and a\n// project's _app/ routes. A layout renders `ContentOutlet` for its content.\nexport const Route = createFileRoute(\"/_app\")({\n ...options,\n // Core routes stay in the main chunk when a project build splits its routes.\n codeSplitGroupings: [],\n component: coreView(\"CoreLayout\"),\n});\n"],"mappings":";;;;AAIA,MAAa,UAAU,CAAC;AAIxB,MAAa,QAAQ,gBAAgB,OAAO,CAAC,CAAC;CAC5C,GAAG;CAEH,oBAAoB,CAAC;CACrB,WAAW,SAAS,YAAY;AAClC,CAAC"}
1
+ {"version":3,"file":"_app.js","names":[],"sources":["../../src/routes/_app.tsx"],"sourcesContent":["import { createFileRoute } from \"@tanstack/react-router\";\nimport { coreRouteOptions, coreView } from \"@powerhousedao/connect-core/router\";\n\n/** The layout's options; none yet. */\nexport const options = coreRouteOptions({});\n\n// Pathless: the header and content area around home, drives, settings and a\n// project's _app/ routes. A layout renders `ContentOutlet` for its content.\nexport const Route = createFileRoute(\"/_app\")({\n ...options,\n // Core routes stay in the main chunk when a project build splits its routes.\n codeSplitGroupings: [],\n component: coreView(\"CoreLayout\"),\n});\n"],"mappings":";;;;AAIA,MAAa,UAAU,iBAAiB,CAAC,CAAC;AAI1C,MAAa,QAAQ,gBAAgB,OAAO,CAAC,CAAC;CAC5C,GAAG;CAEH,oBAAoB,CAAC;CACrB,WAAW,SAAS,YAAY;AAClC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { getRuntimeConfig } from "./runtime-config.js";
2
- import { n as resolveRuntimeFlag, t as isRuntimeFlagEnabled } from "./runtime-flag-CJWngtxE.js";
2
+ import { n as resolveRuntimeFlag, t as isRuntimeFlagEnabled } from "./runtime-flag-Bp6QasS8.js";
3
3
  import { bindPHStoreToWindow, createPHStore, getActivePHStore, getDrives, getPHStore, refreshReactorDataClient, setDrives, setFullReactorClient } from "@powerhousedao/reactor-browser";
4
4
  import { logger } from "document-model";
5
5
  //#region src/runtime/multi-reactor-flag.ts
@@ -28,17 +28,29 @@ const MODES = /* @__PURE__ */ new Set([
28
28
  "remote",
29
29
  "router"
30
30
  ]);
31
- function fromQuery() {
31
+ const REACTOR_CLIENT_QUERY_KEY = "reactorClient";
32
+ const REACTOR_CLIENT_STORAGE_KEY = "ph:reactorClient";
33
+ const asMode = (value) => value && MODES.has(value) ? value : void 0;
34
+ function fromTab() {
32
35
  if (typeof window === "undefined") return void 0;
36
+ let query;
33
37
  try {
34
- const value = new URLSearchParams(window.location.search).get("reactorClient");
35
- return value && MODES.has(value) ? value : void 0;
38
+ query = asMode(new URLSearchParams(window.location.search).get(REACTOR_CLIENT_QUERY_KEY));
36
39
  } catch {
37
40
  return;
38
41
  }
42
+ try {
43
+ if (query) {
44
+ window.localStorage.setItem(REACTOR_CLIENT_STORAGE_KEY, query);
45
+ return query;
46
+ }
47
+ return asMode(window.localStorage.getItem(REACTOR_CLIENT_STORAGE_KEY));
48
+ } catch {
49
+ return query;
50
+ }
39
51
  }
40
52
  function resolveReactorClientMode() {
41
- const override = fromQuery();
53
+ const override = fromTab();
42
54
  if (override) return override;
43
55
  const configured = getRuntimeConfig().connect.instance?.reactorClient;
44
56
  if (configured && MODES.has(configured)) return configured;
@@ -48,7 +60,7 @@ function resolveReactorClientMode() {
48
60
  }
49
61
  //#endregion
50
62
  //#region src/runtime/app-reactor-client.ts
51
- const loadMultiReactor = () => import("./multi-reactor-CPRsFtfd.js");
63
+ const loadMultiReactor = () => import("./multi-reactor-D_2B4jmu.js");
52
64
  function planReactorClient(mode = resolveReactorClientMode()) {
53
65
  const needsLocalReactor = mode !== "remote";
54
66
  return {
@@ -184,6 +196,6 @@ function loadLocalPackage(source) {
184
196
  return pkg;
185
197
  }
186
198
  //#endregion
187
- export { planReactorClient as a, resolveReactorClientMode as c, isReactorWorkerEnabled as d, resolveReactorWorkerEnabled as f, getAppDrives as i, REACTOR_WORKER_QUERY_KEY as l, getConnectPHStore as n, refreshAppDrives as o, isMultiReactorEnabled as p, createAppReactorClient as r, selectAppReactorClient as s, loadLocalPackage as t, REACTOR_WORKER_STORAGE_KEY as u };
199
+ export { planReactorClient as a, REACTOR_CLIENT_QUERY_KEY as c, REACTOR_WORKER_QUERY_KEY as d, REACTOR_WORKER_STORAGE_KEY as f, isMultiReactorEnabled as h, getAppDrives as i, REACTOR_CLIENT_STORAGE_KEY as l, resolveReactorWorkerEnabled as m, getConnectPHStore as n, refreshAppDrives as o, isReactorWorkerEnabled as p, createAppReactorClient as r, selectAppReactorClient as s, loadLocalPackage as t, resolveReactorClientMode as u };
188
200
 
189
- //# sourceMappingURL=runtime-D8IBQzHM.js.map
201
+ //# sourceMappingURL=runtime-BUG9vT2E.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-BUG9vT2E.js","names":[],"sources":["../src/runtime/multi-reactor-flag.ts","../src/runtime/reactor-worker-flag.ts","../src/runtime/reactor-client-mode.ts","../src/runtime/app-reactor-client.ts","../src/runtime/ph-store.ts","../src/runtime/local-package.ts"],"sourcesContent":["import { getRuntimeConfig } from \"./runtime-config.js\";\n\n// Config only: the flag is in the worker fingerprint, so a per-tab value would split tabs.\nexport function isMultiReactorEnabled(): boolean {\n return getRuntimeConfig().connect.instance?.multiReactor ?? false;\n}\n","import { getRuntimeConfig } from \"./runtime-config.js\";\nimport {\n isRuntimeFlagEnabled,\n resolveRuntimeFlag,\n type RuntimeFlagInput,\n} from \"./runtime-flag.js\";\n\nexport const REACTOR_WORKER_QUERY_KEY = \"reactorWorker\";\nexport const REACTOR_WORKER_STORAGE_KEY = \"ph:reactorWorker\";\n\nexport type ReactorWorkerFlagInput = RuntimeFlagInput;\n\nexport function resolveReactorWorkerEnabled(\n input: ReactorWorkerFlagInput,\n): boolean {\n return resolveRuntimeFlag(input);\n}\n\nexport function isReactorWorkerEnabled(): boolean {\n return isRuntimeFlagEnabled({\n queryKey: REACTOR_WORKER_QUERY_KEY,\n storageKey: REACTOR_WORKER_STORAGE_KEY,\n readConfigFlag: () =>\n getRuntimeConfig().connect.instance?.reactorWorker ?? false,\n });\n}\n","import type { PHReactorClientMode } from \"@powerhousedao/shared/clis\";\nimport { getRuntimeConfig } from \"./runtime-config.js\";\nimport { isMultiReactorEnabled } from \"./multi-reactor-flag.js\";\nimport { isReactorWorkerEnabled } from \"./reactor-worker-flag.js\";\n\n/**\n * Which of the four reactor clients Connect boots. Standardized by the\n * multi-reactor work; this resolves the single selector Connect acts on:\n *\n * in-process | worker | remote | router\n *\n * Precedence: an explicit `?reactorClient=` query override (kept in\n * localStorage so it survives a reload), then a stored override, then the\n * served `connect.instance.reactorClient` (projected from the host's reactor\n * backends), then the LEGACY booleans — so a config that only sets\n * reactorWorker/multiReactor behaves exactly as before.\n *\n * `remote` is the only mode that builds NO local reactor (no PGlite): it is a\n * pure client to a remote Switchboard. `router` keeps the local reactor and\n * adds remote backends; `worker`/`in-process` are the local reactor alone.\n */\nexport type ReactorClientMode = PHReactorClientMode;\n\nconst MODES: ReadonlySet<string> = new Set([\n \"in-process\",\n \"worker\",\n \"remote\",\n \"router\",\n]);\n\nexport const REACTOR_CLIENT_QUERY_KEY = \"reactorClient\";\nexport const REACTOR_CLIENT_STORAGE_KEY = \"ph:reactorClient\";\n\nconst asMode = (value: string | null | undefined) =>\n value && MODES.has(value) ? (value as ReactorClientMode) : undefined;\n\nfunction fromTab(): ReactorClientMode | undefined {\n if (typeof window === \"undefined\") return undefined;\n let query: ReactorClientMode | undefined;\n try {\n query = asMode(\n new URLSearchParams(window.location.search).get(REACTOR_CLIENT_QUERY_KEY),\n );\n } catch {\n return undefined;\n }\n try {\n if (query) {\n window.localStorage.setItem(REACTOR_CLIENT_STORAGE_KEY, query);\n return query;\n }\n return asMode(window.localStorage.getItem(REACTOR_CLIENT_STORAGE_KEY));\n } catch {\n // Blocked storage: the query still applies for this page load.\n return query;\n }\n}\n\nexport function resolveReactorClientMode(): ReactorClientMode {\n const override = fromTab();\n if (override) return override;\n const configured = getRuntimeConfig().connect.instance?.reactorClient;\n if (configured && MODES.has(configured)) return configured;\n // Legacy fallback — unchanged behaviour for configs without reactorClient.\n if (isMultiReactorEnabled()) return \"router\";\n if (isReactorWorkerEnabled()) return \"worker\";\n return \"in-process\";\n}\n","import type { IReactorClient } from \"@powerhousedao/reactor\";\nimport {\n getDrives,\n refreshReactorDataClient,\n setDrives,\n setFullReactorClient,\n getPHStore,\n} from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport type { ISigner } from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\nimport type * as MultiReactor from \"./multi-reactor.js\";\nimport type {\n LoadedDocumentModels,\n LocalReactorModule,\n} from \"./multi-reactor.js\";\nimport type { ReactorClientMode } from \"./reactor-client-mode.js\";\nimport { resolveReactorClientMode } from \"./reactor-client-mode.js\";\nimport { isReactorWorkerEnabled } from \"./reactor-worker-flag.js\";\n\ntype MultiReactorModule = typeof MultiReactor;\n\nexport type AppReactorClientParams = {\n mode: ReactorClientMode;\n /** Built, and ready (the worker has started up). Undefined in `remote`\n * mode, where no local reactor is built. */\n module: LocalReactorModule | undefined;\n remoteDriveUrl: string | undefined;\n /** Signs routed writes; unsigned (anonymous) without one. */\n signer?: ISigner;\n documentModelModules: LoadedDocumentModels;\n loadRouter?: () => Promise<MultiReactorModule>;\n};\n\nconst loadMultiReactor = (): Promise<MultiReactorModule> =>\n import(\"./multi-reactor.js\");\n\n/** What a mode builds in the tab; `remote` builds no local reactor (no PGlite). */\nexport type ReactorClientPlan = {\n mode: ReactorClientMode;\n /** `router`: the local reactor plus remote backends. */\n multiReactor: boolean;\n needsLocalReactor: boolean;\n /** The local reactor runs in the shared worker. */\n localAsWorker: boolean;\n};\n\nexport function planReactorClient(\n mode: ReactorClientMode = resolveReactorClientMode(),\n): ReactorClientPlan {\n const needsLocalReactor = mode !== \"remote\";\n return {\n mode,\n multiReactor: mode === \"router\",\n needsLocalReactor,\n localAsWorker:\n needsLocalReactor &&\n (mode === \"worker\" || (mode === \"router\" && isReactorWorkerEnabled())),\n };\n}\n\n/** Builds the tab's reactor, e.g. Connect's PGlite or worker reactor. */\nexport type LocalReactorFactory = (\n plan: ReactorClientPlan,\n) => Promise<LocalReactorModule>;\n\nexport type CreateAppReactorClientOptions = Omit<\n AppReactorClientParams,\n \"mode\" | \"module\"\n> & {\n plan?: ReactorClientPlan;\n /** Called only when the plan needs a local reactor. */\n localReactor?: LocalReactorFactory;\n};\n\n/** Builds the local reactor the plan needs, then selects the app's client. */\nexport async function createAppReactorClient(\n options: CreateAppReactorClientOptions,\n) {\n const { localReactor, ...params } = options;\n const plan = options.plan ?? planReactorClient();\n let module: LocalReactorModule | undefined;\n if (plan.needsLocalReactor) {\n if (!localReactor) {\n throw new Error(\n `reactorClient mode \"${plan.mode}\" needs a local reactor; pass localReactor`,\n );\n }\n module = await localReactor(plan);\n }\n const client = await selectAppReactorClient({\n ...params,\n mode: plan.mode,\n module,\n });\n return { plan, module, client };\n}\n\n/**\n * Pick the client for the resolved mode:\n * - `in-process` / `worker`: the local client, router module never loaded.\n * - `router`: the local reactor plus remote backends.\n * - `remote`: a remote-only router — a full IReactorClient that proxies to\n * the Switchboard over GraphQL with NO local reactor (no PGlite).\n */\nexport async function selectAppReactorClient(\n params: AppReactorClientParams,\n): Promise<IReactorClient> {\n if (params.mode === \"remote\") {\n setFullReactorClient(undefined);\n const remote = await buildRemoteOnly(params);\n setFullReactorClient(remote);\n return remote;\n }\n if (params.mode !== \"router\") {\n if (getPHStore()?.fullReactorClient) {\n setFullReactorClient(undefined);\n }\n return requireModule(params).client;\n }\n setFullReactorClient(undefined);\n const routed = await buildRouter(params);\n setFullReactorClient(routed);\n return routed ?? requireModule(params).client;\n}\n\nfunction requireModule(params: AppReactorClientParams): LocalReactorModule {\n if (!params.module) {\n throw new Error(\n `reactorClient mode \"${params.mode}\" needs a local reactor, but none was built`,\n );\n }\n return params.module;\n}\n\n/** A Switchboard that cannot answer must not fail boot: list the tab's drives. */\nexport async function getAppDrives(\n client: IReactorClient,\n local: IReactorClient,\n): Promise<DocumentDriveDocument[]> {\n if (client === local) {\n return getDrives(local);\n }\n try {\n return await getDrives(client);\n } catch (error) {\n logger.warn(\n \"Could not list drives through the router; listing the local reactor's: @error\",\n error,\n );\n return getDrives(local);\n }\n}\n\nexport async function refreshAppDrives(\n client: IReactorClient,\n local: IReactorClient,\n): Promise<void> {\n if (client === local) {\n return refreshReactorDataClient(client);\n }\n setDrives(await getAppDrives(client, local));\n}\n\nasync function buildRouter(\n params: AppReactorClientParams,\n): Promise<IReactorClient | undefined> {\n if (!params.remoteDriveUrl) {\n logger.warn(\n \"multiReactor is on but no remote drive URL is configured; using the local reactor only\",\n );\n return undefined;\n }\n let multiReactor: MultiReactorModule;\n try {\n multiReactor = await (params.loadRouter ?? loadMultiReactor)();\n } catch (error) {\n logger.error(\"Could not load the multi-reactor router: @error\", error);\n return undefined;\n }\n const remoteGraphqlUrl = multiReactor.deriveSwitchboardGraphqlUrl(\n params.remoteDriveUrl,\n );\n if (!remoteGraphqlUrl) {\n logger.warn(\n \"multiReactor is on but the remote drive URL @url does not parse; using the local reactor only\",\n params.remoteDriveUrl,\n );\n return undefined;\n }\n logger.info(\"Multi-reactor routing to @url\", remoteGraphqlUrl);\n return multiReactor.buildMultiReactorClient({\n module: requireModule(params),\n remoteGraphqlUrl,\n signer: params.signer,\n documentModelModules: params.documentModelModules,\n });\n}\n\n/**\n * The `remote` mode: a remote-only router — a full IReactorClient that proxies\n * to the Switchboard over GraphQL with NO local backend, so no local reactor\n * and no PGlite are ever built. A missing/unparseable remote URL is a hard\n * config error here (unlike `router`, there is no local reactor to fall back\n * to).\n */\nasync function buildRemoteOnly(\n params: AppReactorClientParams,\n): Promise<IReactorClient> {\n if (!params.remoteDriveUrl) {\n throw new Error(\n 'reactorClient \"remote\" needs a remote drive URL — declare a remote backend / default drive the client can proxy to',\n );\n }\n const multiReactor = await (params.loadRouter ?? loadMultiReactor)();\n const remoteGraphqlUrl = multiReactor.deriveSwitchboardGraphqlUrl(\n params.remoteDriveUrl,\n );\n if (!remoteGraphqlUrl) {\n throw new Error(\n `reactorClient \"remote\": the remote drive URL \"${params.remoteDriveUrl}\" does not resolve to a Switchboard GraphQL endpoint`,\n );\n }\n logger.info(\"Remote reactor client → @url\", remoteGraphqlUrl);\n return multiReactor.buildMultiReactorClient({\n module: undefined,\n remoteGraphqlUrl,\n signer: params.signer,\n documentModelModules: params.documentModelModules,\n });\n}\n","import type { PHStore } from \"@powerhousedao/reactor-browser\";\nimport {\n bindPHStoreToWindow,\n createPHStore,\n getActivePHStore,\n} from \"@powerhousedao/reactor-browser\";\n\n/** The app's PH store: the active one, else a new one bound to `window.ph`.\n * Values set on `window.ph` before carry over. */\nexport function getConnectPHStore(): PHStore {\n const active = getActivePHStore();\n if (active) return active;\n const store = createPHStore();\n bindPHStoreToWindow(store);\n return store;\n}\n","import type { DocumentModelLib } from \"document-model\";\n\n/** A module namespace, as `import * as pkg` or Vite HMR hands it over. */\nexport type ModuleNamespace = Record<string, any> & {\n [Symbol.toStringTag]: \"Module\";\n};\n\nexport type LocalPackage = DocumentModelLib<any> | ModuleNamespace;\n\n/** The package itself, or a loader (`() => import(\"./index.js\")`) that keeps it off the boot path. */\nexport type LocalPackageSource = LocalPackage | (() => Promise<LocalPackage>);\n\n/** Starts loading the project's package; a loader runs once, here. */\nexport function loadLocalPackage(\n source: LocalPackageSource | undefined,\n): DocumentModelLib | Promise<DocumentModelLib> | undefined {\n const pkg = (typeof source === \"function\" ? source() : source) as\n | DocumentModelLib\n | Promise<DocumentModelLib>\n | undefined;\n // Consumers await it; this only stops an early rejection being reported as unhandled.\n if (pkg instanceof Promise) pkg.catch(() => undefined);\n return pkg;\n}\n"],"mappings":";;;;;AAGA,SAAgB,wBAAiC;CAC/C,OAAO,iBAAiB,CAAC,CAAC,QAAQ,UAAU,gBAAgB;AAC9D;;;ACEA,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAI1C,SAAgB,4BACd,OACS;CACT,OAAO,mBAAmB,KAAK;AACjC;AAEA,SAAgB,yBAAkC;CAChD,OAAO,qBAAqB;EAC1B,UAAU;EACV,YAAY;EACZ,sBACE,iBAAiB,CAAC,CAAC,QAAQ,UAAU,iBAAiB;CAC1D,CAAC;AACH;;;ACFA,MAAM,wBAA6B,IAAI,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AI,CAAC,kBAAkB;EACrB,OAAO,KACL,iGACA,OAAO,cACT;EACA;CACF;CACA,OAAO,KAAK,iCAAiC,gBAAgB;CAC7D,OAAO,aAAa,wBAAwB;EAC1C,QAAQ,cAAc,MAAM;EAC5B;EACA,QAAQ,OAAO;EACf,sBAAsB,OAAO;CAC/B,CAAC;AACH;;;;;;;;AASA,eAAe,gBACb,QACyB;CACzB,IAAI,CAAC,OAAO,gBACV,MAAM,IAAI,MACR,sHACF;CAEF,MAAM,eAAe,OAAO,OAAO,cAAc,iBAAA,CAAkB;CACnE,MAAM,mBAAmB,aAAa,4BACpC,OAAO,cACT;CACA,IAAI,CAAC,kBACH,MAAM,IAAI,MACR,iDAAiD,OAAO,eAAe,qDACzE;CAEF,OAAO,KAAK,gCAAgC,gBAAgB;CAC5D,OAAO,aAAa,wBAAwB;EAC1C,QAAQ,KAAA;EACR;EACA,QAAQ,OAAO;EACf,sBAAsB,OAAO;CAC/B,CAAC;AACH;;;;;AC7NA,SAAgB,oBAA6B;CAC3C,MAAM,SAAS,iBAAiB;CAChC,IAAI,QAAQ,OAAO;CACnB,MAAM,QAAQ,cAAc;CAC5B,oBAAoB,KAAK;CACzB,OAAO;AACT;;;;ACFA,SAAgB,iBACd,QAC0D;CAC1D,MAAM,MAAO,OAAO,WAAW,aAAa,OAAO,IAAI;CAKvD,IAAI,eAAe,SAAS,IAAI,YAAY,KAAA,CAAS;CACrD,OAAO;AACT"}
@@ -4,23 +4,23 @@ import { JsonConfigAdapter } from "@powerhousedao/shared/connect/json-adapter";
4
4
  //#region src/runtime/runtime-config.ts
5
5
  const loader = () => getConnectRegistry().runtimeConfig ??= new ConfigLoader(new JsonConfigAdapter({ path: `${import.meta.env?.BASE_URL ?? "/"}powerhouse.config.json` }));
6
6
  async function loadRuntimeConfig(options = {}) {
7
- const pluginHost = options.plugins ? import("./plugin-host-BSFfhXpz.js").then((n) => n.r).then(async (host) => {
7
+ const pluginHost = options.plugins ? import("./plugin-host-D_EW56IQ.js").then((n) => n.r).then(async (host) => {
8
8
  host.registerConnectPlugins(options.plugins);
9
9
  await host.knownPlugins();
10
10
  return host;
11
11
  }) : void 0;
12
- const pluginUi = options.plugins ? import("./plugin-ui-sO7AJLHj.js").then((n) => n.a) : void 0;
12
+ const pluginUi = options.plugins ? import("./plugin-ui-fDXhKTCK.js").then((n) => n.a) : void 0;
13
13
  pluginHost?.catch(() => void 0);
14
14
  pluginUi?.catch(() => void 0);
15
15
  const config = await loader().read();
16
16
  if (config.connect?.composition) {
17
- const { isRuntimeFlagEnabled } = await import("./runtime-flag-CJWngtxE.js").then((n) => n.r);
17
+ const { isRuntimeFlagEnabled } = await import("./runtime-flag-Bp6QasS8.js").then((n) => n.r);
18
18
  if (isRuntimeFlagEnabled({
19
19
  queryKey: "pluginRunner",
20
20
  storageKey: "ph:flag:pluginRunner",
21
21
  readConfigFlag: () => true
22
22
  })) {
23
- const { applyComposition } = await pluginHost ?? await import("./plugin-host-BSFfhXpz.js").then((n) => n.r);
23
+ const { applyComposition } = await pluginHost ?? await import("./plugin-host-D_EW56IQ.js").then((n) => n.r);
24
24
  config.connect = await applyComposition(config.connect);
25
25
  loader().prime(config);
26
26
  }
@@ -1,4 +1,4 @@
1
- import { O as __exportAll } from "./views-CAbBIFzO.js";
1
+ import { O as __exportAll } from "./views-Ba9OeN3c.js";
2
2
  //#region src/runtime/runtime-flag.ts
3
3
  var runtime_flag_exports = /* @__PURE__ */ __exportAll({
4
4
  isRuntimeFlagEnabled: () => isRuntimeFlagEnabled,
@@ -44,4 +44,4 @@ function parseFlag(value) {
44
44
  //#endregion
45
45
  export { resolveRuntimeFlag as n, runtime_flag_exports as r, isRuntimeFlagEnabled as t };
46
46
 
47
- //# sourceMappingURL=runtime-flag-CJWngtxE.js.map
47
+ //# sourceMappingURL=runtime-flag-Bp6QasS8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-flag-CJWngtxE.js","names":[],"sources":["../src/runtime/runtime-flag.ts"],"sourcesContent":["export type RuntimeFlagInput = {\n configFlag: boolean;\n queryParam?: string | null;\n storedValue?: string | null;\n};\n\n// A query-param override wins, then a stored dev override, then the config flag.\nexport function resolveRuntimeFlag(input: RuntimeFlagInput): boolean {\n const fromQuery = parseFlag(input.queryParam);\n if (fromQuery !== undefined) {\n return fromQuery;\n }\n const fromStore = parseFlag(input.storedValue);\n if (fromStore !== undefined) {\n return fromStore;\n }\n return input.configFlag;\n}\n\nexport type RuntimeFlagKeys = {\n queryKey: string;\n storageKey: string;\n readConfigFlag: () => boolean;\n};\n\n// Effective flag from config + dev override; a query-param override is persisted\n// to localStorage so it survives a refresh. Blocked storage reads as no override.\nexport function isRuntimeFlagEnabled(keys: RuntimeFlagKeys): boolean {\n const configFlag = keys.readConfigFlag();\n if (typeof window === \"undefined\") {\n return configFlag;\n }\n const queryParam = new URLSearchParams(window.location.search).get(\n keys.queryKey,\n );\n const storedValue = readStoredValue(keys.storageKey);\n const enabled = resolveRuntimeFlag({ configFlag, queryParam, storedValue });\n // Persist only an explicit override, not an unrecognized value.\n if (parseFlag(queryParam) !== undefined) {\n persistStoredValue(keys.storageKey, enabled);\n }\n return enabled;\n}\n\nfunction readStoredValue(storageKey: string): string | null {\n try {\n return window.localStorage.getItem(storageKey);\n } catch {\n return null;\n }\n}\n\nfunction persistStoredValue(storageKey: string, enabled: boolean): void {\n try {\n window.localStorage.setItem(storageKey, enabled ? \"true\" : \"false\");\n } catch {\n // The override still applies for this page load.\n }\n}\n\nfunction parseFlag(value: string | null | undefined): boolean | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n const normalized = value.trim().toLowerCase();\n if (normalized === \"true\" || normalized === \"1\") {\n return true;\n }\n if (normalized === \"false\" || normalized === \"0\") {\n return false;\n }\n // Unrecognized value (e.g. a typo): no override, fall through to store/config.\n return undefined;\n}\n"],"mappings":";;;;;;AAOA,SAAgB,mBAAmB,OAAkC;CACnE,MAAM,YAAY,UAAU,MAAM,UAAU;CAC5C,IAAI,cAAc,KAAA,GAChB,OAAO;CAET,MAAM,YAAY,UAAU,MAAM,WAAW;CAC7C,IAAI,cAAc,KAAA,GAChB,OAAO;CAET,OAAO,MAAM;AACf;AAUA,SAAgB,qBAAqB,MAAgC;CACnE,MAAM,aAAa,KAAK,eAAe;CACvC,IAAI,OAAO,WAAW,aACpB,OAAO;CAET,MAAM,aAAa,IAAI,gBAAgB,OAAO,SAAS,MAAM,CAAC,CAAC,IAC7D,KAAK,QACP;CAEA,MAAM,UAAU,mBAAmB;EAAE;EAAY;EAAY,aADzC,gBAAgB,KAAK,UAC8B;CAAE,CAAC;CAE1E,IAAI,UAAU,UAAU,MAAM,KAAA,GAC5B,mBAAmB,KAAK,YAAY,OAAO;CAE7C,OAAO;AACT;AAEA,SAAS,gBAAgB,YAAmC;CAC1D,IAAI;EACF,OAAO,OAAO,aAAa,QAAQ,UAAU;CAC/C,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,mBAAmB,YAAoB,SAAwB;CACtE,IAAI;EACF,OAAO,aAAa,QAAQ,YAAY,UAAU,SAAS,OAAO;CACpE,QAAQ,CAER;AACF;AAEA,SAAS,UAAU,OAAuD;CACxE,IAAI,UAAU,QAAQ,UAAU,KAAA,GAC9B;CAEF,MAAM,aAAa,MAAM,KAAK,CAAC,CAAC,YAAY;CAC5C,IAAI,eAAe,UAAU,eAAe,KAC1C,OAAO;CAET,IAAI,eAAe,WAAW,eAAe,KAC3C,OAAO;AAIX"}
1
+ {"version":3,"file":"runtime-flag-Bp6QasS8.js","names":[],"sources":["../src/runtime/runtime-flag.ts"],"sourcesContent":["export type RuntimeFlagInput = {\n configFlag: boolean;\n queryParam?: string | null;\n storedValue?: string | null;\n};\n\n// A query-param override wins, then a stored dev override, then the config flag.\nexport function resolveRuntimeFlag(input: RuntimeFlagInput): boolean {\n const fromQuery = parseFlag(input.queryParam);\n if (fromQuery !== undefined) {\n return fromQuery;\n }\n const fromStore = parseFlag(input.storedValue);\n if (fromStore !== undefined) {\n return fromStore;\n }\n return input.configFlag;\n}\n\nexport type RuntimeFlagKeys = {\n queryKey: string;\n storageKey: string;\n readConfigFlag: () => boolean;\n};\n\n// Effective flag from config + dev override; a query-param override is persisted\n// to localStorage so it survives a refresh. Blocked storage reads as no override.\nexport function isRuntimeFlagEnabled(keys: RuntimeFlagKeys): boolean {\n const configFlag = keys.readConfigFlag();\n if (typeof window === \"undefined\") {\n return configFlag;\n }\n const queryParam = new URLSearchParams(window.location.search).get(\n keys.queryKey,\n );\n const storedValue = readStoredValue(keys.storageKey);\n const enabled = resolveRuntimeFlag({ configFlag, queryParam, storedValue });\n // Persist only an explicit override, not an unrecognized value.\n if (parseFlag(queryParam) !== undefined) {\n persistStoredValue(keys.storageKey, enabled);\n }\n return enabled;\n}\n\nfunction readStoredValue(storageKey: string): string | null {\n try {\n return window.localStorage.getItem(storageKey);\n } catch {\n return null;\n }\n}\n\nfunction persistStoredValue(storageKey: string, enabled: boolean): void {\n try {\n window.localStorage.setItem(storageKey, enabled ? \"true\" : \"false\");\n } catch {\n // The override still applies for this page load.\n }\n}\n\nfunction parseFlag(value: string | null | undefined): boolean | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n const normalized = value.trim().toLowerCase();\n if (normalized === \"true\" || normalized === \"1\") {\n return true;\n }\n if (normalized === \"false\" || normalized === \"0\") {\n return false;\n }\n // Unrecognized value (e.g. a typo): no override, fall through to store/config.\n return undefined;\n}\n"],"mappings":";;;;;;AAOA,SAAgB,mBAAmB,OAAkC;CACnE,MAAM,YAAY,UAAU,MAAM,UAAU;CAC5C,IAAI,cAAc,KAAA,GAChB,OAAO;CAET,MAAM,YAAY,UAAU,MAAM,WAAW;CAC7C,IAAI,cAAc,KAAA,GAChB,OAAO;CAET,OAAO,MAAM;AACf;AAUA,SAAgB,qBAAqB,MAAgC;CACnE,MAAM,aAAa,KAAK,eAAe;CACvC,IAAI,OAAO,WAAW,aACpB,OAAO;CAET,MAAM,aAAa,IAAI,gBAAgB,OAAO,SAAS,MAAM,CAAC,CAAC,IAC7D,KAAK,QACP;CAEA,MAAM,UAAU,mBAAmB;EAAE;EAAY;EAAY,aADzC,gBAAgB,KAAK,UAC8B;CAAE,CAAC;CAE1E,IAAI,UAAU,UAAU,MAAM,KAAA,GAC5B,mBAAmB,KAAK,YAAY,OAAO;CAE7C,OAAO;AACT;AAEA,SAAS,gBAAgB,YAAmC;CAC1D,IAAI;EACF,OAAO,OAAO,aAAa,QAAQ,UAAU;CAC/C,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,mBAAmB,YAAoB,SAAwB;CACtE,IAAI;EACF,OAAO,aAAa,QAAQ,YAAY,UAAU,SAAS,OAAO;CACpE,QAAQ,CAER;AACF;AAEA,SAAS,UAAU,OAAuD;CACxE,IAAI,UAAU,QAAQ,UAAU,KAAA,GAC9B;CAEF,MAAM,aAAa,MAAM,KAAK,CAAC,CAAC,YAAY;CAC5C,IAAI,eAAe,UAAU,eAAe,KAC1C,OAAO;CAET,IAAI,eAAe,WAAW,eAAe,KAC3C,OAAO;AAIX"}
package/dist/runtime.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as resolveReactorWorkerEnabled, D as isRuntimeFlagEnabled, E as RuntimeFlagKeys, O as resolveRuntimeFlag, S as isReactorWorkerEnabled, T as RuntimeFlagInput, _ as ReactorClientMode, a as getConnectPHStore, b as REACTOR_WORKER_STORAGE_KEY, c as LocalReactorFactory, d as getAppDrives, f as planReactorClient, g as LocalReactorModule, h as LoadedDocumentModels, i as loadLocalPackage, l as ReactorClientPlan, m as selectAppReactorClient, n as LocalPackageSource, o as AppReactorClientParams, p as refreshAppDrives, r as ModuleNamespace, s as CreateAppReactorClientOptions, t as LocalPackage, u as createAppReactorClient, v as resolveReactorClientMode, w as isMultiReactorEnabled, x as ReactorWorkerFlagInput, y as REACTOR_WORKER_QUERY_KEY } from "./index-q4bHCPoJ.js";
1
+ import { A as resolveRuntimeFlag, C as ReactorWorkerFlagInput, D as RuntimeFlagInput, E as isMultiReactorEnabled, O as RuntimeFlagKeys, S as REACTOR_WORKER_STORAGE_KEY, T as resolveReactorWorkerEnabled, _ as REACTOR_CLIENT_QUERY_KEY, a as getConnectPHStore, b as resolveReactorClientMode, c as LocalReactorFactory, d as getAppDrives, f as planReactorClient, g as LocalReactorModule, h as LoadedDocumentModels, i as loadLocalPackage, k as isRuntimeFlagEnabled, l as ReactorClientPlan, m as selectAppReactorClient, n as LocalPackageSource, o as AppReactorClientParams, p as refreshAppDrives, r as ModuleNamespace, s as CreateAppReactorClientOptions, t as LocalPackage, u as createAppReactorClient, v as REACTOR_CLIENT_STORAGE_KEY, w as isReactorWorkerEnabled, x as REACTOR_WORKER_QUERY_KEY, y as ReactorClientMode } from "./index-r46ba0Kx.js";
2
2
  import { i as primeRuntimeConfig, n as getRuntimeConfig, r as loadRuntimeConfig } from "./runtime-config-D3YPhYyj.js";
3
3
  import { n as useIsEmbedded, t as getIsEmbedded } from "./embedded-DT1C47F0.js";
4
- export { type AppReactorClientParams, type CreateAppReactorClientOptions, type LoadedDocumentModels, type LocalPackage, type LocalPackageSource, type LocalReactorFactory, type LocalReactorModule, type ModuleNamespace, REACTOR_WORKER_QUERY_KEY, REACTOR_WORKER_STORAGE_KEY, type ReactorClientMode, type ReactorClientPlan, type ReactorWorkerFlagInput, type RuntimeFlagInput, type RuntimeFlagKeys, createAppReactorClient, getAppDrives, getConnectPHStore, getIsEmbedded, getRuntimeConfig, isMultiReactorEnabled, isReactorWorkerEnabled, isRuntimeFlagEnabled, loadLocalPackage, loadRuntimeConfig, planReactorClient, primeRuntimeConfig, refreshAppDrives, resolveReactorClientMode, resolveReactorWorkerEnabled, resolveRuntimeFlag, selectAppReactorClient, useIsEmbedded };
4
+ export { type AppReactorClientParams, type CreateAppReactorClientOptions, type LoadedDocumentModels, type LocalPackage, type LocalPackageSource, type LocalReactorFactory, type LocalReactorModule, type ModuleNamespace, REACTOR_CLIENT_QUERY_KEY, REACTOR_CLIENT_STORAGE_KEY, REACTOR_WORKER_QUERY_KEY, REACTOR_WORKER_STORAGE_KEY, type ReactorClientMode, type ReactorClientPlan, type ReactorWorkerFlagInput, type RuntimeFlagInput, type RuntimeFlagKeys, createAppReactorClient, getAppDrives, getConnectPHStore, getIsEmbedded, getRuntimeConfig, isMultiReactorEnabled, isReactorWorkerEnabled, isRuntimeFlagEnabled, loadLocalPackage, loadRuntimeConfig, planReactorClient, primeRuntimeConfig, refreshAppDrives, resolveReactorClientMode, resolveReactorWorkerEnabled, resolveRuntimeFlag, selectAppReactorClient, useIsEmbedded };
5
5
  export {};
package/dist/runtime.js CHANGED
@@ -1,5 +1,5 @@
1
- import { getRuntimeConfig, loadRuntimeConfig, primeRuntimeConfig } from "./runtime-config.js";
2
- import { n as resolveRuntimeFlag, t as isRuntimeFlagEnabled } from "./runtime-flag-CJWngtxE.js";
3
- import { a as planReactorClient, c as resolveReactorClientMode, d as isReactorWorkerEnabled, f as resolveReactorWorkerEnabled, i as getAppDrives, l as REACTOR_WORKER_QUERY_KEY, n as getConnectPHStore, o as refreshAppDrives, p as isMultiReactorEnabled, r as createAppReactorClient, s as selectAppReactorClient, t as loadLocalPackage, u as REACTOR_WORKER_STORAGE_KEY } from "./runtime-D8IBQzHM.js";
4
1
  import { getIsEmbedded, useIsEmbedded } from "./embedded.js";
5
- export { REACTOR_WORKER_QUERY_KEY, REACTOR_WORKER_STORAGE_KEY, createAppReactorClient, getAppDrives, getConnectPHStore, getIsEmbedded, getRuntimeConfig, isMultiReactorEnabled, isReactorWorkerEnabled, isRuntimeFlagEnabled, loadLocalPackage, loadRuntimeConfig, planReactorClient, primeRuntimeConfig, refreshAppDrives, resolveReactorClientMode, resolveReactorWorkerEnabled, resolveRuntimeFlag, selectAppReactorClient, useIsEmbedded };
2
+ import { getRuntimeConfig, loadRuntimeConfig, primeRuntimeConfig } from "./runtime-config.js";
3
+ import { n as resolveRuntimeFlag, t as isRuntimeFlagEnabled } from "./runtime-flag-Bp6QasS8.js";
4
+ import { a as planReactorClient, c as REACTOR_CLIENT_QUERY_KEY, d as REACTOR_WORKER_QUERY_KEY, f as REACTOR_WORKER_STORAGE_KEY, h as isMultiReactorEnabled, i as getAppDrives, l as REACTOR_CLIENT_STORAGE_KEY, m as resolveReactorWorkerEnabled, n as getConnectPHStore, o as refreshAppDrives, p as isReactorWorkerEnabled, r as createAppReactorClient, s as selectAppReactorClient, t as loadLocalPackage, u as resolveReactorClientMode } from "./runtime-BUG9vT2E.js";
5
+ export { REACTOR_CLIENT_QUERY_KEY, REACTOR_CLIENT_STORAGE_KEY, REACTOR_WORKER_QUERY_KEY, REACTOR_WORKER_STORAGE_KEY, createAppReactorClient, getAppDrives, getConnectPHStore, getIsEmbedded, getRuntimeConfig, isMultiReactorEnabled, isReactorWorkerEnabled, isRuntimeFlagEnabled, loadLocalPackage, loadRuntimeConfig, planReactorClient, primeRuntimeConfig, refreshAppDrives, resolveReactorClientMode, resolveReactorWorkerEnabled, resolveRuntimeFlag, selectAppReactorClient, useIsEmbedded };
@@ -1,5 +1,6 @@
1
1
  import { d as useRoutesById } from "./route-tree-D0aszMrk.js";
2
- import { OPENED_FROM_STATE_KEY, SETTINGS_PATH, getDriveName, useDrives } from "@powerhousedao/reactor-browser";
2
+ import { useIsEmbedded } from "./embedded.js";
3
+ import { OPENED_FROM_STATE_KEY, SETTINGS_PATH, getDriveName, peekDriveNode, useDriveNode, useDrives } from "@powerhousedao/reactor-browser";
3
4
  import { Outlet, notFound, redirect, useMatch, useMatches, useRouter, useRouterState } from "@tanstack/react-router";
4
5
  import { useMemo, useState } from "react";
5
6
  import { jsx } from "react/jsx-runtime";
@@ -57,7 +58,7 @@ function notFoundTitle(appName) {
57
58
  function driveTitle(store, data, appName) {
58
59
  const drive = data && store.drives?.find((d) => d.header.id === data.driveId);
59
60
  if (!drive) return appTitle(appName);
60
- return [(data.nodeId ? drive.state.global.nodes.find((n) => n.id === data.nodeId) : void 0)?.name, getDriveName(drive)].filter(Boolean).concat(appTitle(appName)).join(" · ");
61
+ return [(data.nodeId ? peekDriveNode(drive.header.id, data.nodeId, store) : void 0)?.name, getDriveName(drive)].filter(Boolean).concat(appTitle(appName)).join(" · ");
61
62
  }
62
63
  //#endregion
63
64
  //#region src/router/settings.ts
@@ -156,7 +157,7 @@ function useDriveRouteData() {
156
157
  const ids = useDriveRouteIds();
157
158
  const drives = useDrives();
158
159
  const drive = ids && drives?.find((d) => d.header.id === ids.driveId);
159
- const node = ids?.nodeId ? drive?.state.global.nodes.find((n) => n.id === ids.nodeId) : void 0;
160
+ const node = useDriveNode(drive?.header.id, ids?.nodeId);
160
161
  const folder = node?.kind === "folder" ? node : void 0;
161
162
  return {
162
163
  drive,
@@ -206,7 +207,17 @@ function useNavRoutes() {
206
207
  function useSidebarMode() {
207
208
  return useMatches({ select: (matches) => matches.findLast((match) => match.staticData.sidebar !== void 0)?.staticData.sidebar });
208
209
  }
210
+ /** The chrome Connect's `_app` layout shows, for a layout that replaces it. */
211
+ function useConnectChrome() {
212
+ const embedded = useIsEmbedded();
213
+ const mode = useSidebarMode();
214
+ return {
215
+ embedded,
216
+ sidebarHidden: embedded || mode === "hidden",
217
+ sidebarCollapsed: !embedded && mode === "collapsed"
218
+ };
219
+ }
209
220
  //#endregion
210
- export { ContentOutlet as C, useIsColdStart as E, CONTENT_VIEW_ID as S, DrivePending as T, useForgetSettingsOpenedFrom as _, DRIVE_ROUTE_ID as a, driveTitle as b, useDriveRouteIds as c, redirectToSettingsTab as d, setSettingsRoute as f, showsSettingsTab as g, settingsTitle as h, useCreateDocumentTarget as i, SETTINGS_ROUTE_ID as l, settingsTabsOf as m, useNavRoutes as n, NODE_ROUTE_ID as o, settingsTabs as p, useSidebarMode as r, useDriveRouteData as s, navRoutes as t, keepOpenedFrom as u, useSettingsTabs as v, DRIVE_PENDING_MS as w, notFoundTitle as x, appTitle as y };
221
+ export { CONTENT_VIEW_ID as C, useIsColdStart as D, DrivePending as E, notFoundTitle as S, DRIVE_PENDING_MS as T, showsSettingsTab as _, useCreateDocumentTarget as a, appTitle as b, useDriveRouteData as c, keepOpenedFrom as d, redirectToSettingsTab as f, settingsTitle as g, settingsTabsOf as h, useSidebarMode as i, useDriveRouteIds as l, settingsTabs as m, useConnectChrome as n, DRIVE_ROUTE_ID as o, setSettingsRoute as p, useNavRoutes as r, NODE_ROUTE_ID as s, navRoutes as t, SETTINGS_ROUTE_ID as u, useForgetSettingsOpenedFrom as v, ContentOutlet as w, driveTitle as x, useSettingsTabs as y };
211
222
 
212
- //# sourceMappingURL=sidebar-DVQCwBYR.js.map
223
+ //# sourceMappingURL=sidebar-C2y4mZnX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidebar-C2y4mZnX.js","names":[],"sources":["../src/router/cold-start.ts","../src/router/route-components.tsx","../src/router/titles.ts","../src/router/settings.ts","../src/router/route-data.ts","../src/router/create-target.ts","../src/router/sidebar.ts"],"sourcesContent":["import { useRouterState } from \"@tanstack/react-router\";\n\n/** True until the router has resolved its first location. */\nexport function useIsColdStart() {\n return useRouterState({ select: (state) => !state.resolvedLocation });\n}\n","import type {\n AnyRoute,\n AnyRouter,\n RouteComponent,\n} from \"@tanstack/react-router\";\nimport { Outlet, useMatch, useRouter } from \"@tanstack/react-router\";\nimport type { ReactNode } from \"react\";\nimport type {\n DocumentDriveDocument,\n FolderNode,\n} from \"@powerhousedao/shared/document-drive\";\nimport type { PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { useIsColdStart } from \"./cold-start.js\";\n\n/** A drive view's props: drive apps and core's directory listing get the same. */\nexport type DriveViewProps = {\n drive: DocumentDriveDocument;\n /** The open folder; undefined at the drive's root. */\n folder?: FolderNode;\n /** The open document's view, when one is open. */\n children?: ReactNode;\n};\n\n/** A document view's props, e.g. core's JSON view or revision history. */\nexport type DocumentViewProps = { document: PHDocument };\n\n// Open views stay while a navigation loads; the pending view only after this.\nexport const DRIVE_PENDING_MS = 200;\n\n/** The scroll container of the content view. */\nexport const CONTENT_VIEW_ID = \"content-view\";\n\n/** A layout's content area: the matched route, in the container whose scroll\n * Connect resets on new views and restores on back and forward. */\nexport function ContentOutlet(props: { className?: string }) {\n return (\n <div\n className={props.className ?? \"flex h-full flex-col overflow-auto\"}\n id={CONTENT_VIEW_ID}\n data-scroll-restoration-id={CONTENT_VIEW_ID}\n >\n {useRouter().options.context.shell ? <LayoutPending /> : <Outlet />}\n </div>\n );\n}\n\n// The loading shell: the layout's own pendingComponent stands in for its page.\nfunction LayoutPending() {\n const router = useRouter<AnyRouter>();\n const routeId = useMatch({ strict: false, select: (match) => match.routeId });\n const routesById = router.routesById as Partial<Record<string, AnyRoute>>;\n const route = routeId ? routesById[routeId] : undefined;\n const Pending = route?.options.pendingComponent as RouteComponent | undefined;\n return Pending ? <Pending /> : null;\n}\n\n/** A note on a cold start; otherwise the open view stays while loading. */\nexport function DrivePending() {\n const isColdStart = useIsColdStart();\n if (!isColdStart) return null;\n return (\n <p role=\"status\" className=\"p-6 text-core-muted\">\n Loading drive…\n </p>\n );\n}\n","// Document titles for Connect's routes; route heads set them through <HeadContent />.\nimport type { PHStore } from \"@powerhousedao/reactor-browser\";\nimport { getDriveName, peekDriveNode } from \"@powerhousedao/reactor-browser\";\nimport type { DriveRouteData } from \"./drive-route-loader.js\";\n\nconst DEFAULT_APP_NAME = \"Connect\";\n\n/** The configured app name, else \"Connect\". */\nexport function appTitle(appName?: string) {\n return appName || DEFAULT_APP_NAME;\n}\n\n/** `Not found · <app>`. */\nexport function notFoundTitle(appName?: string) {\n return `Not found · ${appTitle(appName)}`;\n}\n\n/** `<node> · <drive> · <app>`, from the store so renames show. */\nexport function driveTitle(\n store: PHStore,\n data: DriveRouteData | undefined,\n appName?: string,\n) {\n const drive = data && store.drives?.find((d) => d.header.id === data.driveId);\n if (!drive) return appTitle(appName);\n const node = data.nodeId\n ? peekDriveNode(drive.header.id, data.nodeId, store)\n : undefined;\n return [node?.name, getDriveName(drive)]\n .filter(Boolean)\n .concat(appTitle(appName))\n .join(\" · \");\n}\n","// The settings page: its tabs are the /settings route's children with `staticData.settings`.\nimport {\n OPENED_FROM_STATE_KEY,\n SETTINGS_PATH,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n AnyRoute,\n AnyRouter,\n HistoryState,\n StaticDataRouteOption,\n} from \"@tanstack/react-router\";\nimport { notFound, redirect, useRouter } from \"@tanstack/react-router\";\nimport type { ComponentType } from \"react\";\nimport { useMemo } from \"react\";\nimport { useRoutesById } from \"./route-tree.js\";\nimport type { ConnectRouterContext } from \"./drive-route-loader.js\";\nimport { appTitle } from \"./titles.js\";\n\n/** A settings tab, as a child route of /settings declares it in `staticData`. */\nexport type ConnectSettingsTab = {\n label: string;\n /** Ascending; Connect's own tabs use multiples of 10. */\n order: number;\n icon?: ComponentType<{ size?: number; className?: string }>;\n /** Marks the tab as destructive, e.g. the danger zone. */\n destructive?: boolean;\n /** Hidden, and redirected away from, when this returns false. */\n enabled?: (context: ConnectRouterContext) => boolean;\n};\n\ndeclare module \"@tanstack/react-router\" {\n interface StaticDataRouteOption {\n settings?: ConnectSettingsTab;\n }\n}\n\n/** The settings layout route's id. */\nexport const SETTINGS_ROUTE_ID = `/_app${SETTINGS_PATH}`;\n\n// Structural, not the router's match union: route options typed with it are circular.\ntype SettingsMatch = { routeId: string; staticData: StaticDataRouteOption };\n\n/** A listed tab: its id is its path below /settings. */\nexport type SettingsTabEntry = ConnectSettingsTab & {\n id: string;\n routeId: string;\n to: string;\n};\n\n/** The enabled tabs below `settingsRoute`, in order. */\nexport function settingsTabsOf(\n settingsRoute: AnyRoute,\n context: ConnectRouterContext,\n): SettingsTabEntry[] {\n const children = (settingsRoute.children ?? []) as AnyRoute[];\n const prefix = `${settingsRoute.fullPath}/`;\n return children\n .flatMap((route) => {\n const tab = (\n route.options as { staticData?: { settings?: ConnectSettingsTab } }\n ).staticData?.settings;\n if (!tab || tab.enabled?.(context) === false) return [];\n const { id: routeId, fullPath } = route as {\n id: string;\n fullPath: string;\n };\n const to = fullPath.replace(/\\/$/, \"\");\n return [{ ...tab, id: to.slice(prefix.length), routeId, to }];\n })\n .sort((a, b) => a.order - b.order || a.label.localeCompare(b.label));\n}\n\n/** The settings tabs of `router`'s tree; empty without a settings route. */\nexport function settingsTabs(router: AnyRouter): SettingsTabEntry[] {\n const settingsRoute = router.routesById[SETTINGS_ROUTE_ID] as\n | AnyRoute\n | undefined;\n if (!settingsRoute) return [];\n return settingsTabsOf(\n settingsRoute,\n router.options.context as ConnectRouterContext,\n );\n}\n\nexport function useSettingsTabs() {\n const router = useRouter();\n const routesById = useRoutesById();\n return useMemo(() => settingsTabs(router), [router, routesById]);\n}\n\n/** Whether `matches` show a tab that may stay: not bare /settings, not a disabled tab. */\nexport function showsSettingsTab(\n matches: readonly SettingsMatch[],\n context: ConnectRouterContext,\n) {\n const leaf = matches.at(-1);\n if (!leaf || leaf.routeId === SETTINGS_ROUTE_ID) return false;\n return leaf.staticData.settings?.enabled?.(context) !== false;\n}\n\nlet routerSettingsRoute: AnyRoute | undefined;\n\n/** The router's settings route: core's, or a project's override of it. */\nexport function setSettingsRoute(route?: AnyRoute) {\n routerSettingsRoute = route;\n}\n\n/** Sends bare /settings and a disabled tab to the first tab. */\nexport function redirectToSettingsTab({\n matches,\n context,\n}: {\n matches: readonly SettingsMatch[];\n context: ConnectRouterContext;\n}): void {\n if (showsSettingsTab(matches, context)) return;\n const first =\n routerSettingsRoute && settingsTabsOf(routerSettingsRoute, context).at(0);\n // oxlint-disable-next-line typescript/only-throw-error -- router control flow\n if (!first) throw notFound();\n // oxlint-disable-next-line typescript/only-throw-error -- router control flow\n throw redirect<AnyRouter>({ to: first.to, replace: true, state: true });\n}\n\n/** `Settings · <tab> · <app>`. */\nexport function settingsTitle(tabLabel: string | undefined, appName?: string) {\n return [\"Settings\", tabLabel, appTitle(appName)].filter(Boolean).join(\" · \");\n}\n\n/** Makes closing settings go home, not back to an entry that may be gone,\n * e.g. a deleted drive. */\nexport function useForgetSettingsOpenedFrom() {\n const router = useRouter();\n return () =>\n router.navigate({\n to: \".\",\n search: true,\n replace: true,\n resetScroll: false,\n state: (prev) =>\n ({ ...prev, [OPENED_FROM_STATE_KEY]: undefined }) as HistoryState,\n });\n}\n\n/** History state that keeps where the settings page was opened from. */\nexport function keepOpenedFrom(state: object) {\n const from: unknown = Reflect.get(state, OPENED_FROM_STATE_KEY);\n return { [OPENED_FROM_STATE_KEY]: from } as unknown as HistoryState;\n}\n","import { useDriveNode, useDrives } from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentDriveDocument,\n FolderNode,\n} from \"@powerhousedao/shared/document-drive\";\nimport { useRouterState } from \"@tanstack/react-router\";\nimport type { DriveRouteData } from \"./drive-route-loader.js\";\n\n/** The drive layout route's id. */\nexport const DRIVE_ROUTE_ID = \"/_app/d/$driveSlug\";\n/** The node route's id: below the drive layout, with an optional node. */\nexport const NODE_ROUTE_ID = \"/_app/d/$driveSlug/{-$nodeSlug}\";\n\n/** The open drive, folder and document, from the node route's loader data.\n * Live: a drive's edits re-render the caller. */\nexport type DriveRouteView = {\n drive: DocumentDriveDocument | undefined;\n /** The open folder; undefined at the drive's root or on a document. */\n folder: FolderNode | undefined;\n /** The open document's id; undefined on a folder or the drive's root. */\n documentId: string | undefined;\n};\n\n/** The ids the node route resolved, or undefined outside a drive. */\nexport function useDriveRouteIds(): DriveRouteData | undefined {\n return useRouterState({\n select: (state) =>\n state.matches.find((match) => match.routeId === NODE_ROUTE_ID)\n ?.loaderData as DriveRouteData | undefined,\n });\n}\n\n/** What the drive routes show: the drive, and the folder or document open in it. */\nexport function useDriveRouteData(): DriveRouteView {\n const ids = useDriveRouteIds();\n const drives = useDrives();\n const drive = ids && drives?.find((d) => d.header.id === ids.driveId);\n const node = useDriveNode(drive?.header.id, ids?.nodeId);\n const folder = node?.kind === \"folder\" ? node : undefined;\n // A node the listed drive doesn't have yet was a document the loader fetched.\n return { drive, folder, documentId: folder ? undefined : ids?.nodeId };\n}\n","import { useDrives } from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport { useState } from \"react\";\nimport { useDriveRouteData } from \"./route-data.js\";\n\nexport type CreateDocumentTarget = {\n /** The drive the document goes in; undefined until one is picked. */\n drive: DocumentDriveDocument | undefined;\n /** The drives to pick from, or undefined when the drive is given. */\n choices: DocumentDriveDocument[] | undefined;\n pick: (driveId: string) => void;\n /** Whether it is the open drive, whose open folder the document goes in. */\n isOpenDrive: boolean;\n};\n\n/** Where a new document goes: the modal's `driveId`, else the open drive, else\n * one the user picks, the only drive preselected. */\nexport function useCreateDocumentTarget(\n driveId: string | undefined,\n): CreateDocumentTarget {\n const { drive: openDrive } = useDriveRouteData();\n const drives = useDrives();\n const [picked, setPicked] = useState<string>();\n const given = driveId ?? openDrive?.header.id;\n const only = drives?.length === 1 ? drives[0].header.id : undefined;\n const id = given ?? picked ?? only;\n return {\n drive: drives?.find((d) => d.header.id === id),\n choices: given ? undefined : (drives ?? []),\n pick: setPicked,\n isOpenDrive: !!openDrive && openDrive.header.id === id,\n };\n}\n","// What routes tell the sidebar layout: nav items and whether to show the sidebar.\nimport type { AnyRoute, AnyRouter } from \"@tanstack/react-router\";\nimport { useMatches, useRouter } from \"@tanstack/react-router\";\nimport type { ComponentType } from \"react\";\nimport { useMemo } from \"react\";\nimport { useIsEmbedded } from \"../runtime/embedded.js\";\nimport { useRoutesById } from \"./route-tree.js\";\n\n/** A sidebar link to the route that declares it in `staticData.nav`. */\nexport type ConnectNavItem = {\n label: string;\n icon?: ComponentType<{ size?: number; className?: string }>;\n /** Ascending, after the drives. */\n order: number;\n};\n\n/** \"hidden\" drops the sidebar; \"collapsed\" keeps only its header and footer. */\nexport type SidebarMode = \"hidden\" | \"collapsed\";\n\ndeclare module \"@tanstack/react-router\" {\n interface StaticDataRouteOption {\n nav?: ConnectNavItem;\n sidebar?: SidebarMode;\n }\n}\n\nexport type NavRouteEntry = ConnectNavItem & { routeId: string; to: string };\n\n/** The routes with `staticData.nav`, in order; routes with params can't be listed. */\nexport function navRoutes(router: AnyRouter): NavRouteEntry[] {\n return Object.values(router.routesById as Record<string, AnyRoute>)\n .flatMap((route) => {\n const nav = (route.options as { staticData?: { nav?: ConnectNavItem } })\n .staticData?.nav;\n const { id: routeId, fullPath } = route as {\n id: string;\n fullPath: string;\n };\n if (!nav || fullPath.includes(\"$\")) return [];\n return [{ ...nav, routeId, to: fullPath.replace(/(.)\\/$/, \"$1\") }];\n })\n .sort((a, b) => a.order - b.order || a.label.localeCompare(b.label));\n}\n\nexport function useNavRoutes() {\n const router = useRouter();\n const routesById = useRoutesById();\n return useMemo(() => navRoutes(router), [router, routesById]);\n}\n\n/** The deepest match's `staticData.sidebar`, if any declares one. */\nexport function useSidebarMode(): SidebarMode | undefined {\n return useMatches({\n select: (matches) =>\n matches.findLast((match) => match.staticData.sidebar !== undefined)\n ?.staticData.sidebar,\n });\n}\n\n/** What a layout shows of Connect's chrome on the matched route. */\nexport type ConnectChrome = {\n /** Connect runs inside another app (`?embed=1`): no sidebar, header or footer. */\n embedded: boolean;\n /** No sidebar: embedded, or the route's `staticData.sidebar` is \"hidden\". */\n sidebarHidden: boolean;\n /** The route's `staticData.sidebar` is \"collapsed\". */\n sidebarCollapsed: boolean;\n};\n\n/** The chrome Connect's `_app` layout shows, for a layout that replaces it. */\nexport function useConnectChrome(): ConnectChrome {\n const embedded = useIsEmbedded();\n const mode = useSidebarMode();\n return {\n embedded,\n sidebarHidden: embedded || mode === \"hidden\",\n sidebarCollapsed: !embedded && mode === \"collapsed\",\n };\n}\n"],"mappings":";;;;;;;;AAGA,SAAgB,iBAAiB;CAC/B,OAAO,eAAe,EAAE,SAAS,UAAU,CAAC,MAAM,iBAAiB,CAAC;AACtE;;;ACsBA,MAAa,mBAAmB;;AAGhC,MAAa,kBAAkB;;;AAI/B,SAAgB,cAAc,OAA+B;CAC3D,OACE,oBAAC,OAAD;EACE,WAAW,MAAM,aAAa;EAC9B,IAAI;EACJ,8BAA4B;EAE3B,UAAA,UAAU,CAAC,CAAC,QAAQ,QAAQ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C,aAAa,UAAU,OAAO,OAAO;CACtD;AACF;;;;ACHA,SAAgB,UAAU,QAAoC;CAC5D,OAAO,OAAO,OAAO,OAAO,UAAsC,CAAC,CAChE,SAAS,UAAU;EAClB,MAAM,MAAO,MAAM,QAChB,YAAY;EACf,MAAM,EAAE,IAAI,SAAS,aAAa;EAIlC,IAAI,CAAC,OAAO,SAAS,SAAS,GAAG,GAAG,OAAO,CAAC;EAC5C,OAAO,CAAC;GAAE,GAAG;GAAK;GAAS,IAAI,SAAS,QAAQ,UAAU,IAAI;EAAE,CAAC;CACnE,CAAC,CAAC,CACD,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,EAAE,KAAK,CAAC;AACvE;AAEA,SAAgB,eAAe;CAC7B,MAAM,SAAS,UAAU;CACzB,MAAM,aAAa,cAAc;CACjC,OAAO,cAAc,UAAU,MAAM,GAAG,CAAC,QAAQ,UAAU,CAAC;AAC9D;;AAGA,SAAgB,iBAA0C;CACxD,OAAO,WAAW,EAChB,SAAS,YACP,QAAQ,UAAU,UAAU,MAAM,WAAW,YAAY,KAAA,CAAS,CAAC,EAC/D,WAAW,QACnB,CAAC;AACH;;AAaA,SAAgB,mBAAkC;CAChD,MAAM,WAAW,cAAc;CAC/B,MAAM,OAAO,eAAe;CAC5B,OAAO;EACL;EACA,eAAe,YAAY,SAAS;EACpC,kBAAkB,CAAC,YAAY,SAAS;CAC1C;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { f as CORE_MODAL_VIEWS, h as useModalFrame, m as ModalDialog, p as ModalOutlet } from "./route-tree-D0aszMrk.js";
2
- import { C as ContentOutlet, i as useCreateDocumentTarget, n as useNavRoutes, r as useSidebarMode, s as useDriveRouteData, v as useSettingsTabs, y as appTitle } from "./sidebar-DVQCwBYR.js";
2
+ import { a as useCreateDocumentTarget, b as appTitle, c as useDriveRouteData, i as useSidebarMode, r as useNavRoutes, w as ContentOutlet, y as useSettingsTabs } from "./sidebar-C2y4mZnX.js";
3
3
  import { useIsEmbedded } from "./embedded.js";
4
- import { DRIVE_DOCUMENT_TYPES, DriveProvider, EditorDocumentProvider, addDocument, closePHModal, deleteNode, exportFile, getDocumentUpgradePreview, getDriveName, getNodeTarget, hideRevisionHistory, initTheme, logout, makeDriveSlug, makeNodeSlug, openRenown, openTarget, preloadDrive, setRevisionHistoryPage, setSelectedNode, showPHModal, upgradeDocument, useAppModuleById, useDispatch, useDocument, useDocumentById, useDocumentModelModuleById, useDrives, useEditorModuleFor, useLinkProps, useModelRegistry, useNodeById, useNodeParentFolderById, usePHModal, usePHNavigation, useReactorClient, useRenownAuth, useRenownLoginMethods, useRevisionHistoryPage, useRevisionHistoryVisible, useTheme, useUser, useVetraPackageManager, useVetraPackages, validateDocument } from "@powerhousedao/reactor-browser";
4
+ import { DRIVE_DOCUMENT_TYPES, DriveProvider, EditorDocumentProvider, addDocument, closePHModal, deleteNode, exportFile, getDocumentUpgradePreview, getDriveName, getNodeTarget, hideRevisionHistory, initTheme, logout, makeDriveSlug, makeNodeSlug, openRenown, openTarget, preloadDrive, setRevisionHistoryPage, setSelectedNode, showPHModal, upgradeDocument, useAppModuleById, useDispatch, useDocument, useDocumentById, useDocumentModelModuleById, useDriveNodes, useDrives, useEditorModuleFor, useLinkProps, useModelRegistry, useNodeById, useNodeParentFolderById, usePHModal, usePHNavigation, useReactorClient, useRenownAuth, useRenownLoginMethods, useRevisionHistoryPage, useRevisionHistoryVisible, useTheme, useUser, useVetraPackageManager, useVetraPackages, validateDocument } from "@powerhousedao/reactor-browser";
5
5
  import { HeadContent, Link, Outlet, useRouter, useRouterState } from "@tanstack/react-router";
6
6
  import { Component, Fragment, Suspense, createElement, useEffect, useId, useMemo, useState } from "react";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -124,7 +124,13 @@ const byKindThenName = (a, b) => a.kind === b.kind ? a.name.localeCompare(b.name
124
124
  /** Core's drive fallback: a listing of the open folder; an open document shows instead. */
125
125
  function DirectoryListing({ drive, folder, children }) {
126
126
  if (children) return children;
127
- const nodes = drive.state.global.nodes;
127
+ return /* @__PURE__ */ jsx(FolderListing, {
128
+ drive,
129
+ folder
130
+ });
131
+ }
132
+ function FolderListing({ drive, folder }) {
133
+ const nodes = useDriveNodes(drive.header.id) ?? [];
128
134
  const path = folderPath(nodes, folder);
129
135
  const parent = path.at(-2);
130
136
  const entries = nodes.filter((node) => (node.parentFolder ?? null) === (folder?.id ?? null)).sort(byKindThenName);
@@ -1290,4 +1296,4 @@ function PackagesTab() {
1290
1296
  //#endregion
1291
1297
  export { DocumentJson as C, formatModified as D, DirectoryListing as E, __exportAll as O, EditorHost as S, HISTORY_PAGE_SIZE as T, ThemeToggle as _, DriveNotFoundPage as a, DriveLayout as b, CoreLayout as c, CreateDocumentModal as d, DeleteItemModal as f, LoginModal as g, DriveAuthRequiredModal as h, CoreRouteError as i, CoreRoot as l, DownloadDocumentWithErrorsModal as m, AppearanceTab as n, NotFoundPage as o, DocumentVersionUnsupportedModal as p, CoreSettingsPage as r, CoreHeader as s, PackagesTab as t, ConfirmDocumentUpgradeModal as u, DriveIndex as v, DocumentHistory as w, NodeView as x, DocumentView as y };
1292
1298
 
1293
- //# sourceMappingURL=views-CAbBIFzO.js.map
1299
+ //# sourceMappingURL=views-Ba9OeN3c.js.map