@powerhousedao/connect-core 6.2.3-dev.71 → 6.2.3-dev.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connect-router-11uRIT3z.d.ts.map +1 -1
- package/dist/{index-CL4fj0Pl.d.ts → index-Cm8rYUhs.d.ts} +17 -2
- package/dist/index-Cm8rYUhs.d.ts.map +1 -0
- package/dist/{index-DP1NfCUn.d.ts → index-DQ0nbYne.d.ts} +3 -2
- package/dist/{index-DP1NfCUn.d.ts.map → index-DQ0nbYne.d.ts.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/{plugin-host-DVwFg7-D.js → plugin-host-BSFfhXpz.js} +2 -2
- package/dist/{plugin-host-DVwFg7-D.js.map → plugin-host-BSFfhXpz.js.map} +1 -1
- package/dist/{plugin-ui-Br91idOH.js → plugin-ui-sO7AJLHj.js} +4 -4
- package/dist/{plugin-ui-Br91idOH.js.map → plugin-ui-sO7AJLHj.js.map} +1 -1
- package/dist/plugins.js +2 -2
- package/dist/{route-tree-91OurkPS.js → route-tree-D0aszMrk.js} +3 -6
- package/dist/route-tree-D0aszMrk.js.map +1 -0
- package/dist/{router-uK9fOfed.js → router-8pekwJsk.js} +6 -6
- package/dist/router-8pekwJsk.js.map +1 -0
- package/dist/router.d.ts +2 -2
- package/dist/router.js +5 -5
- package/dist/{runtime-CYADuBKe.js → runtime-Y9B9UJK1.js} +2 -2
- package/dist/{runtime-CYADuBKe.js.map → runtime-Y9B9UJK1.js.map} +1 -1
- package/dist/runtime-config-D3YPhYyj.d.ts.map +1 -1
- package/dist/runtime-config.js +5 -5
- package/dist/runtime-config.js.map +1 -1
- package/dist/{runtime-flag-JJ_8aMvi.js → runtime-flag-CJWngtxE.js} +2 -2
- package/dist/{runtime-flag-JJ_8aMvi.js.map → runtime-flag-CJWngtxE.js.map} +1 -1
- package/dist/runtime.js +2 -2
- package/dist/{sidebar-C0RvssAJ.js → sidebar-DVQCwBYR.js} +22 -4
- package/dist/sidebar-DVQCwBYR.js.map +1 -0
- package/dist/{views-BOajEGgQ.js → views-CAbBIFzO.js} +40 -13
- package/dist/views-CAbBIFzO.js.map +1 -0
- package/dist/views.d.ts +1 -1
- package/dist/views.js +1 -1
- package/package.json +8 -8
- package/src/router/app-router.ts +1 -1
- package/src/router/create-target.ts +33 -0
- package/src/router/index.ts +2 -0
- package/src/router/modal-frame.tsx +2 -1
- package/src/router/perf-marks.ts +1 -1
- package/src/router/route-tree.ts +2 -5
- package/src/runtime/runtime-config.ts +2 -1
- package/src/views/modals.tsx +41 -5
- package/dist/index-CL4fj0Pl.d.ts.map +0 -1
- package/dist/route-tree-91OurkPS.js.map +0 -1
- package/dist/router-uK9fOfed.js.map +0 -1
- package/dist/sidebar-C0RvssAJ.js.map +0 -1
- package/dist/views-BOajEGgQ.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getRuntimeConfig } from "./runtime-config.js";
|
|
2
|
-
import { n as resolveRuntimeFlag, t as isRuntimeFlagEnabled } from "./runtime-flag-
|
|
2
|
+
import { n as resolveRuntimeFlag, t as isRuntimeFlagEnabled } from "./runtime-flag-CJWngtxE.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
|
|
@@ -186,4 +186,4 @@ function loadLocalPackage(source) {
|
|
|
186
186
|
//#endregion
|
|
187
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 };
|
|
188
188
|
|
|
189
|
-
//# sourceMappingURL=runtime-
|
|
189
|
+
//# sourceMappingURL=runtime-Y9B9UJK1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-CYADuBKe.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 (handy for a quick\n * check), then the served `connect.instance.reactorClient` (projected from the\n * host's reactor backends), then the LEGACY booleans — so a config that only\n * sets 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\nfunction fromQuery(): ReactorClientMode | undefined {\n if (typeof window === \"undefined\") return undefined;\n try {\n const value = new URLSearchParams(window.location.search).get(\n \"reactorClient\",\n );\n return value && MODES.has(value) ? (value as ReactorClientMode) : undefined;\n } catch {\n return undefined;\n }\n}\n\nexport function resolveReactorClientMode(): ReactorClientMode {\n const override = fromQuery();\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;;;ACHA,MAAM,wBAA6B,IAAI,IAAI;CACzC;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,YAA2C;CAClD,IAAI,OAAO,WAAW,aAAa,OAAO,KAAA;CAC1C,IAAI;EACF,MAAM,QAAQ,IAAI,gBAAgB,OAAO,SAAS,MAAM,CAAC,CAAC,IACxD,eACF;EACA,OAAO,SAAS,MAAM,IAAI,KAAK,IAAK,QAA8B,KAAA;CACpE,QAAQ;EACN;CACF;AACF;AAEA,SAAgB,2BAA8C;CAC5D,MAAM,WAAW,UAAU;CAC3B,IAAI,UAAU,OAAO;CACrB,MAAM,aAAa,iBAAiB,CAAC,CAAC,QAAQ,UAAU;CACxD,IAAI,cAAc,MAAM,IAAI,UAAU,GAAG,OAAO;CAEhD,IAAI,sBAAsB,GAAG,O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AC5B,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"}
|
|
1
|
+
{"version":3,"file":"runtime-Y9B9UJK1.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 (handy for a quick\n * check), then the served `connect.instance.reactorClient` (projected from the\n * host's reactor backends), then the LEGACY booleans — so a config that only\n * sets 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\nfunction fromQuery(): ReactorClientMode | undefined {\n if (typeof window === \"undefined\") return undefined;\n try {\n const value = new URLSearchParams(window.location.search).get(\n \"reactorClient\",\n );\n return value && MODES.has(value) ? (value as ReactorClientMode) : undefined;\n } catch {\n return undefined;\n }\n}\n\nexport function resolveReactorClientMode(): ReactorClientMode {\n const override = fromQuery();\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;;;ACHA,MAAM,wBAA6B,IAAI,IAAI;CACzC;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,YAA2C;CAClD,IAAI,OAAO,WAAW,aAAa,OAAO,KAAA;CAC1C,IAAI;EACF,MAAM,QAAQ,IAAI,gBAAgB,OAAO,SAAS,MAAM,CAAC,CAAC,IACxD,eACF;EACA,OAAO,SAAS,MAAM,IAAI,KAAK,IAAK,QAA8B,KAAA;CACpE,QAAQ;EACN;CACF;AACF;AAEA,SAAgB,2BAA8C;CAC5D,MAAM,WAAW,UAAU;CAC3B,IAAI,UAAU,OAAO;CACrB,MAAM,aAAa,iBAAiB,CAAC,CAAC,QAAQ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A6B;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-config-D3YPhYyj.d.ts","names":[],"sources":["../src/runtime/runtime-config.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"runtime-config-D3YPhYyj.d.ts","names":[],"sources":["../src/runtime/runtime-config.ts"],"mappings":";;;KAgBY;;;EAGV,gBAAgB,QAAQ,eAAe;;iBAGnB,kBACpB,UAAS,2BACR,QAAQ;;;;;iBAiDK,oBAAoB;;iBAKpB,mBAAmB,QAAQ"}
|
package/dist/runtime-config.js
CHANGED
|
@@ -2,25 +2,25 @@ import { t as getConnectRegistry } from "./registry-DCZHBP7M.js";
|
|
|
2
2
|
import { ConfigLoader } from "@powerhousedao/shared/connect/config-loader";
|
|
3
3
|
import { JsonConfigAdapter } from "@powerhousedao/shared/connect/json-adapter";
|
|
4
4
|
//#region src/runtime/runtime-config.ts
|
|
5
|
-
const loader = () => getConnectRegistry().runtimeConfig ??= new ConfigLoader(new JsonConfigAdapter({ path: `${import.meta.env
|
|
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-
|
|
7
|
+
const pluginHost = options.plugins ? import("./plugin-host-BSFfhXpz.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-
|
|
12
|
+
const pluginUi = options.plugins ? import("./plugin-ui-sO7AJLHj.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-
|
|
17
|
+
const { isRuntimeFlagEnabled } = await import("./runtime-flag-CJWngtxE.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-
|
|
23
|
+
const { applyComposition } = await pluginHost ?? await import("./plugin-host-BSFfhXpz.js").then((n) => n.r);
|
|
24
24
|
config.connect = await applyComposition(config.connect);
|
|
25
25
|
loader().prime(config);
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-config.js","names":[],"sources":["../src/runtime/runtime-config.ts"],"sourcesContent":["// Narrow subpaths: the shared/connect barrel puts zod and semver on the boot path.\nimport type { RuntimePowerhouseConfig } from \"@powerhousedao/shared/connect\";\nimport { ConfigLoader } from \"@powerhousedao/shared/connect/config-loader\";\nimport { JsonConfigAdapter } from \"@powerhousedao/shared/connect/json-adapter\";\nimport type { ConnectPluginDefinition } from \"../plugins/types.js\";\nimport { getConnectRegistry } from \"../registry.js\";\n\n// Shared and made on first use: the app's boot copy makes it, with the app's base.\nconst loader = () =>\n (getConnectRegistry().runtimeConfig ??= new ConfigLoader(\n new JsonConfigAdapter({\n path: `${import.meta.env
|
|
1
|
+
{"version":3,"file":"runtime-config.js","names":[],"sources":["../src/runtime/runtime-config.ts"],"sourcesContent":["// Narrow subpaths: the shared/connect barrel puts zod and semver on the boot path.\nimport type { RuntimePowerhouseConfig } from \"@powerhousedao/shared/connect\";\nimport { ConfigLoader } from \"@powerhousedao/shared/connect/config-loader\";\nimport { JsonConfigAdapter } from \"@powerhousedao/shared/connect/json-adapter\";\nimport type { ConnectPluginDefinition } from \"../plugins/types.js\";\nimport { getConnectRegistry } from \"../registry.js\";\n\n// Shared and made on first use: the app's boot copy makes it, with the app's base.\nconst loader = () =>\n (getConnectRegistry().runtimeConfig ??= new ConfigLoader(\n new JsonConfigAdapter({\n // Optional: Node runs this file untransformed when it prerenders the shell.\n path: `${import.meta.env?.BASE_URL ?? \"/\"}powerhouse.config.json`,\n }),\n ));\n\nexport type LoadRuntimeConfigOptions = {\n /** The host's plugin modules: the composition's transform the config, and\n * the active ones' UI loads (every one's without a composition). */\n plugins?: () => Promise<Record<string, ConnectPluginDefinition>>;\n};\n\nexport async function loadRuntimeConfig(\n options: LoadRuntimeConfigOptions = {},\n): Promise<RuntimePowerhouseConfig> {\n // Beside the config's fetch: the plugin modules and the UI loader don't\n // depend on it; only which plugins' UI loads does.\n const pluginHost = options.plugins\n ? import(\"../plugins/plugin-host.js\").then(async (host) => {\n host.registerConnectPlugins(options.plugins!);\n await host.knownPlugins();\n return host;\n })\n : undefined;\n const pluginUi = options.plugins\n ? import(\"../plugins/plugin-ui.js\")\n : undefined;\n // Handled here so a failed config read doesn't leave them unhandled.\n void pluginHost?.catch(() => undefined);\n void pluginUi?.catch(() => undefined);\n const config = (await loader().read()) as RuntimePowerhouseConfig;\n // R3: a served composition (projected from host.js runner.plugins by the\n // uniform-runners connect runner) runs the plugin pipeline over the config\n // BEFORE the cache warms — every downstream consumer sees the transformed\n // config through the classic paths. Runtime-flagged (query/stored override\n // beats the composition's own presence acting as the config flag); no\n // composition = classic boot, byte-identical.\n if (config.connect?.composition) {\n const { isRuntimeFlagEnabled } = await import(\"./runtime-flag.js\");\n const enabled = isRuntimeFlagEnabled({\n queryKey: \"pluginRunner\",\n storageKey: \"ph:flag:pluginRunner\",\n readConfigFlag: () => true,\n });\n if (enabled) {\n const { applyComposition } =\n (await pluginHost) ?? (await import(\"../plugins/plugin-host.js\"));\n config.connect = await applyComposition(config.connect);\n loader().prime(config);\n }\n }\n if (pluginHost && pluginUi) {\n await pluginHost;\n const { loadConnectPluginUi } = await pluginUi;\n await loadConnectPluginUi(config.connect.composition);\n }\n return config;\n}\n\n/**\n * Returns the cached config synchronously.\n * Must be called after `loadRuntimeConfig()` has resolved.\n */\nexport function getRuntimeConfig(): RuntimePowerhouseConfig {\n return loader().getCached() as RuntimePowerhouseConfig;\n}\n\n/** Warms the cache with `config` without a fetch, e.g. in a test or an embedding app. */\nexport function primeRuntimeConfig(config: RuntimePowerhouseConfig) {\n loader().prime(config);\n}\n"],"mappings":";;;;AAQA,MAAM,eACH,mBAAmB,CAAC,CAAC,kBAAkB,IAAI,aAC1C,IAAI,kBAAkB,EAEpB,MAAM,GAAG,YAAY,KAAK,YAAY,IAAI,wBAC5C,CAAC,CACH;AAQF,eAAsB,kBACpB,UAAoC,CAAC,GACH;CAGlC,MAAM,aAAa,QAAQ,UACvB,OAAO,4BAA4B,CAAA,MAAA,MAAA,EAAA,CAAA,CAAA,CAAC,KAAK,OAAO,SAAS;EACvD,KAAK,uBAAuB,QAAQ,OAAQ;EAC5C,MAAM,KAAK,aAAa;EACxB,OAAO;CACT,CAAC,IACD,KAAA;CACJ,MAAM,WAAW,QAAQ,UACrB,OAAO,0BAA0B,CAAA,MAAA,MAAA,EAAA,CAAA,IACjC,KAAA;CAEJ,YAAiB,YAAY,KAAA,CAAS;CACtC,UAAe,YAAY,KAAA,CAAS;CACpC,MAAM,SAAU,MAAM,OAAO,CAAC,CAAC,KAAK;CAOpC,IAAI,OAAO,SAAS,aAAa;EAC/B,MAAM,EAAE,yBAAyB,MAAM,OAAO,6BAAoB,CAAA,MAAA,MAAA,EAAA,CAAA;EAMlE,IALgB,qBAAqB;GACnC,UAAU;GACV,YAAY;GACZ,sBAAsB;EACxB,CACU,GAAG;GACX,MAAM,EAAE,qBACL,MAAM,cAAgB,MAAM,OAAO,4BAA4B,CAAA,MAAA,MAAA,EAAA,CAAA;GAClE,OAAO,UAAU,MAAM,iBAAiB,OAAO,OAAO;GACtD,OAAO,CAAC,CAAC,MAAM,MAAM;EACvB;CACF;CACA,IAAI,cAAc,UAAU;EAC1B,MAAM;EACN,MAAM,EAAE,wBAAwB,MAAM;EACtC,MAAM,oBAAoB,OAAO,QAAQ,WAAW;CACtD;CACA,OAAO;AACT;;;;;AAMA,SAAgB,mBAA4C;CAC1D,OAAO,OAAO,CAAC,CAAC,UAAU;AAC5B;;AAGA,SAAgB,mBAAmB,QAAiC;CAClE,OAAO,CAAC,CAAC,MAAM,MAAM;AACvB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as __exportAll } from "./views-
|
|
1
|
+
import { O as __exportAll } from "./views-CAbBIFzO.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-
|
|
47
|
+
//# sourceMappingURL=runtime-flag-CJWngtxE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-flag-
|
|
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"}
|
package/dist/runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getRuntimeConfig, loadRuntimeConfig, primeRuntimeConfig } from "./runtime-config.js";
|
|
2
|
-
import { n as resolveRuntimeFlag, t as isRuntimeFlagEnabled } from "./runtime-flag-
|
|
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-
|
|
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-Y9B9UJK1.js";
|
|
4
4
|
import { getIsEmbedded, useIsEmbedded } from "./embedded.js";
|
|
5
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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as useRoutesById } from "./route-tree-
|
|
1
|
+
import { d as useRoutesById } from "./route-tree-D0aszMrk.js";
|
|
2
2
|
import { OPENED_FROM_STATE_KEY, SETTINGS_PATH, getDriveName, useDrives } from "@powerhousedao/reactor-browser";
|
|
3
3
|
import { Outlet, notFound, redirect, useMatch, useMatches, useRouter, useRouterState } from "@tanstack/react-router";
|
|
4
|
-
import { useMemo } from "react";
|
|
4
|
+
import { useMemo, useState } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/router/cold-start.ts
|
|
7
7
|
/** True until the router has resolved its first location. */
|
|
@@ -165,6 +165,24 @@ function useDriveRouteData() {
|
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
//#endregion
|
|
168
|
+
//#region src/router/create-target.ts
|
|
169
|
+
/** Where a new document goes: the modal's `driveId`, else the open drive, else
|
|
170
|
+
* one the user picks, the only drive preselected. */
|
|
171
|
+
function useCreateDocumentTarget(driveId) {
|
|
172
|
+
const { drive: openDrive } = useDriveRouteData();
|
|
173
|
+
const drives = useDrives();
|
|
174
|
+
const [picked, setPicked] = useState();
|
|
175
|
+
const given = driveId ?? openDrive?.header.id;
|
|
176
|
+
const only = drives?.length === 1 ? drives[0].header.id : void 0;
|
|
177
|
+
const id = given ?? picked ?? only;
|
|
178
|
+
return {
|
|
179
|
+
drive: drives?.find((d) => d.header.id === id),
|
|
180
|
+
choices: given ? void 0 : drives ?? [],
|
|
181
|
+
pick: setPicked,
|
|
182
|
+
isOpenDrive: !!openDrive && openDrive.header.id === id
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
168
186
|
//#region src/router/sidebar.ts
|
|
169
187
|
/** The routes with `staticData.nav`, in order; routes with params can't be listed. */
|
|
170
188
|
function navRoutes(router) {
|
|
@@ -189,6 +207,6 @@ function useSidebarMode() {
|
|
|
189
207
|
return useMatches({ select: (matches) => matches.findLast((match) => match.staticData.sidebar !== void 0)?.staticData.sidebar });
|
|
190
208
|
}
|
|
191
209
|
//#endregion
|
|
192
|
-
export {
|
|
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 };
|
|
193
211
|
|
|
194
|
-
//# sourceMappingURL=sidebar-
|
|
212
|
+
//# sourceMappingURL=sidebar-DVQCwBYR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-DVQCwBYR.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 } 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 ? drive.state.global.nodes.find((n) => n.id === data.nodeId)\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 { 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 = ids?.nodeId\n ? drive?.state.global.nodes.find((n) => n.id === ids.nodeId)\n : undefined;\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 { 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"],"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,QAAQ,oBAAC,eAAD,CAAgB,CAAA,IAAI,oBAAC,QAAD,CAAS,CAAA;CAC/D,CAAA;AAET;AAGA,SAAS,gBAAgB;CACvB,MAAM,SAAS,UAAqB;CACpC,MAAM,UAAU,SAAS;EAAE,QAAQ;EAAO,SAAS,UAAU,MAAM;CAAQ,CAAC;CAC5E,MAAM,aAAa,OAAO;CAE1B,MAAM,WADQ,UAAU,WAAW,WAAW,KAAA,EAAA,EACvB,QAAQ;CAC/B,OAAO,UAAU,oBAAC,SAAD,CAAU,CAAA,IAAI;AACjC;;AAGA,SAAgB,eAAe;CAE7B,IAAI,CADgB,eACL,GAAG,OAAO;CACzB,OACE,oBAAC,KAAD;EAAG,MAAK;EAAS,WAAU;EAAsB,UAAA;CAE9C,CAAA;AAEP;;;AC5DA,MAAM,mBAAmB;;AAGzB,SAAgB,SAAS,SAAkB;CACzC,OAAO,WAAW;AACpB;;AAGA,SAAgB,cAAc,SAAkB;CAC9C,OAAO,eAAe,SAAS,OAAO;AACxC;;AAGA,SAAgB,WACd,OACA,MACA,SACA;CACA,MAAM,QAAQ,QAAQ,MAAM,QAAQ,MAAM,MAAM,EAAE,OAAO,OAAO,KAAK,OAAO;CAC5E,IAAI,CAAC,OAAO,OAAO,SAAS,OAAO;CAInC,OAAO,EAHM,KAAK,SACd,MAAM,MAAM,OAA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|
|
1
|
-
import { f as CORE_MODAL_VIEWS, h as useModalFrame, m as ModalDialog, p as ModalOutlet } from "./route-tree-
|
|
2
|
-
import {
|
|
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";
|
|
3
3
|
import { useIsEmbedded } from "./embedded.js";
|
|
4
|
-
import { DRIVE_DOCUMENT_TYPES, DriveProvider, EditorDocumentProvider, addDocument, closePHModal, deleteNode, exportFile, getDocumentUpgradePreview, getDriveName, 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, 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";
|
|
@@ -688,18 +688,21 @@ function useModal(type) {
|
|
|
688
688
|
const modal = usePHModal();
|
|
689
689
|
return modal?.type === type ? modal : void 0;
|
|
690
690
|
}
|
|
691
|
-
/** A new document of the modal's type
|
|
691
|
+
/** A new document of the modal's type: in its `driveId`, else the open drive
|
|
692
|
+
* and folder, else a drive picked here. */
|
|
692
693
|
function CreateDocumentModal() {
|
|
693
694
|
const modal = useModal("createDocument");
|
|
694
695
|
const module = useDocumentModelModuleById(modal?.documentType, modal?.documentModelVersion);
|
|
695
|
-
const {
|
|
696
|
+
const { folder } = useDriveRouteData();
|
|
697
|
+
const target = useCreateDocumentTarget(modal?.driveId);
|
|
698
|
+
const { drive } = target;
|
|
696
699
|
const [name, setName] = useState("");
|
|
697
700
|
const typeName = module?.documentModel.global.name ?? modal?.documentType;
|
|
698
701
|
const create = async () => {
|
|
699
702
|
if (!drive || !module || !modal) return;
|
|
700
703
|
closePHModal();
|
|
701
|
-
const node = await addDocument(drive.header.id, name.trim() || `New ${typeName}`, module.documentModel.global.id, folder?.id, void 0, void 0, void 0, modal.documentModelVersion);
|
|
702
|
-
|
|
704
|
+
const node = await addDocument(drive.header.id, name.trim() || `New ${typeName}`, module.documentModel.global.id, target.isOpenDrive ? folder?.id : void 0, void 0, void 0, void 0, modal.documentModelVersion);
|
|
705
|
+
openTarget(getNodeTarget(node, drive));
|
|
703
706
|
};
|
|
704
707
|
return /* @__PURE__ */ jsxs(Dialog, {
|
|
705
708
|
title: `New ${typeName ?? "document"}`,
|
|
@@ -710,13 +713,14 @@ function CreateDocumentModal() {
|
|
|
710
713
|
disabled: !drive || !module,
|
|
711
714
|
children: "Create"
|
|
712
715
|
})] }),
|
|
713
|
-
children: [/* @__PURE__ */
|
|
716
|
+
children: [/* @__PURE__ */ jsxs("form", {
|
|
714
717
|
id: "create-document",
|
|
718
|
+
className: "flex flex-col gap-2",
|
|
715
719
|
onSubmit: (event) => {
|
|
716
720
|
event.preventDefault();
|
|
717
721
|
create();
|
|
718
722
|
},
|
|
719
|
-
children: /* @__PURE__ */ jsxs("label", {
|
|
723
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
720
724
|
className: "flex flex-col gap-1",
|
|
721
725
|
children: ["Name", /* @__PURE__ */ jsx("input", {
|
|
722
726
|
autoFocus: true,
|
|
@@ -725,10 +729,33 @@ function CreateDocumentModal() {
|
|
|
725
729
|
placeholder: `New ${typeName}`,
|
|
726
730
|
className: "rounded border border-core-border bg-core-bg px-2 py-1"
|
|
727
731
|
})]
|
|
728
|
-
})
|
|
729
|
-
|
|
732
|
+
}), !!target.choices?.length && /* @__PURE__ */ jsxs("label", {
|
|
733
|
+
className: "flex flex-col gap-1",
|
|
734
|
+
children: ["Drive", /* @__PURE__ */ jsxs("select", {
|
|
735
|
+
value: drive?.header.id ?? "",
|
|
736
|
+
onChange: (event) => target.pick(event.target.value),
|
|
737
|
+
className: "rounded border border-core-border bg-core-bg px-2 py-1",
|
|
738
|
+
children: [!drive && /* @__PURE__ */ jsx("option", {
|
|
739
|
+
value: "",
|
|
740
|
+
children: "Choose a drive"
|
|
741
|
+
}), target.choices.map((choice) => /* @__PURE__ */ jsx("option", {
|
|
742
|
+
value: choice.header.id,
|
|
743
|
+
children: getDriveName(choice)
|
|
744
|
+
}, choice.header.id))]
|
|
745
|
+
})]
|
|
746
|
+
})]
|
|
747
|
+
}), target.choices?.length === 0 && /* @__PURE__ */ jsxs("p", {
|
|
730
748
|
className: "text-core-muted",
|
|
731
|
-
children:
|
|
749
|
+
children: [
|
|
750
|
+
"There's no drive to create it in.",
|
|
751
|
+
" ",
|
|
752
|
+
/* @__PURE__ */ jsx("button", {
|
|
753
|
+
type: "button",
|
|
754
|
+
className: "underline",
|
|
755
|
+
onClick: () => showPHModal({ type: "addDrive" }),
|
|
756
|
+
children: "Add a drive"
|
|
757
|
+
})
|
|
758
|
+
]
|
|
732
759
|
})]
|
|
733
760
|
});
|
|
734
761
|
}
|
|
@@ -1263,4 +1290,4 @@ function PackagesTab() {
|
|
|
1263
1290
|
//#endregion
|
|
1264
1291
|
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 };
|
|
1265
1292
|
|
|
1266
|
-
//# sourceMappingURL=views-
|
|
1293
|
+
//# sourceMappingURL=views-CAbBIFzO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views-CAbBIFzO.js","names":["modalViews"],"sources":["../src/views/index-table.tsx","../src/views/directory-listing.tsx","../src/views/document-history.tsx","../src/views/document-json.tsx","../src/views/editor-host.tsx","../src/views/content.tsx","../src/views/home.tsx","../src/views/theme-toggle.tsx","../src/views/modals.tsx","../src/views/layout.tsx","../src/views/not-found-page.tsx","../src/views/route-views.tsx","../src/views/settings.tsx","../src/views/settings-packages.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\n/** `YYYY-MM-DD HH:mm` in UTC, as a server index lists it; \"-\" when unknown. */\nexport function formatModified(iso: string | undefined) {\n if (!iso) return \"-\";\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return \"-\";\n return date.toISOString().slice(0, 16).replace(\"T\", \" \");\n}\n\n/** An \"Index of\" page: a title above a name / type / last modified table. */\nexport function IndexTable(props: {\n title: ReactNode;\n label: string;\n children: ReactNode;\n}) {\n return (\n <div className=\"p-6 font-mono text-sm text-core-fg\">\n <h1 className=\"mb-4 text-xl font-semibold\">{props.title}</h1>\n <table aria-label={props.label} className=\"w-full border-collapse\">\n <thead>\n <tr className=\"border-b border-core-border text-left text-core-muted\">\n <th className=\"py-1 pr-6 font-normal\">Name</th>\n <th className=\"py-1 pr-6 font-normal\">Type</th>\n <th className=\"py-1 font-normal\">Last modified</th>\n </tr>\n </thead>\n <tbody>{props.children}</tbody>\n </table>\n </div>\n );\n}\n\nexport function IndexRow(props: {\n name: ReactNode;\n type: ReactNode;\n modified: ReactNode;\n}) {\n return (\n <tr className=\"border-b border-core-border/50 hover:bg-core-hover\">\n <td className=\"py-1 pr-6\">{props.name}</td>\n <td className=\"py-1 pr-6 text-core-muted\">{props.type}</td>\n <td className=\"py-1 whitespace-nowrap text-core-muted\">\n {props.modified}\n </td>\n </tr>\n );\n}\n\nexport const linkClass = \"text-core-link underline-offset-2 hover:underline\";\n","import {\n getDriveName,\n makeDriveSlug,\n makeNodeSlug,\n useDocumentById,\n useLinkProps,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentDriveDocument,\n FolderNode,\n Node,\n} from \"@powerhousedao/shared/document-drive\";\nimport { isFileNode } from \"@powerhousedao/shared/document-drive\";\nimport type { ReactNode } from \"react\";\nimport { Component, Fragment, Suspense } from \"react\";\nimport type { DriveViewProps } from \"../router/route-components.js\";\nimport {\n formatModified,\n IndexRow,\n IndexTable,\n linkClass,\n} from \"./index-table.js\";\n\nfunction NodeLink(props: {\n drive: DocumentDriveDocument;\n node: Node | undefined;\n children: ReactNode;\n}) {\n const link = useLinkProps({\n driveSlug: makeDriveSlug(props.drive),\n nodeSlug: props.node ? makeNodeSlug(props.node) : undefined,\n });\n return (\n <a {...link} className={linkClass}>\n {props.children}\n </a>\n );\n}\n\nfunction HomeLink(props: { children: ReactNode }) {\n const link = useLinkProps(undefined);\n return (\n <a {...link} className={linkClass}>\n {props.children}\n </a>\n );\n}\n\n// A row's date is a nicety: it shows \"-\" when the document can't load.\nclass Quiet extends Component<{ children: ReactNode }, { failed: boolean }> {\n state = { failed: false };\n static getDerivedStateFromError() {\n return { failed: true };\n }\n render() {\n return this.state.failed ? \"-\" : this.props.children;\n }\n}\n\nfunction DocumentModified({ id }: { id: string }) {\n const [document] = useDocumentById(id);\n return formatModified(document?.header.lastModifiedAtUtcIso);\n}\n\n/** The folders from the drive's root down to `folder`. */\nfunction folderPath(nodes: readonly Node[], folder: FolderNode | undefined) {\n const path: Node[] = [];\n for (let node: Node | undefined = folder; node;) {\n path.unshift(node);\n const parentId: string | null | undefined = node.parentFolder;\n node = parentId ? nodes.find((n) => n.id === parentId) : undefined;\n }\n return path;\n}\n\nconst byKindThenName = (a: Node, b: Node) =>\n a.kind === b.kind\n ? a.name.localeCompare(b.name)\n : a.kind === \"folder\"\n ? -1\n : 1;\n\n/** Core's drive fallback: a listing of the open folder; an open document shows instead. */\nexport function DirectoryListing({ drive, folder, children }: DriveViewProps) {\n if (children) return children;\n const nodes = drive.state.global.nodes;\n const path = folderPath(nodes, folder);\n const parent = path.at(-2);\n const entries = nodes\n .filter((node) => (node.parentFolder ?? null) === (folder?.id ?? null))\n .sort(byKindThenName);\n const title = (\n <>\n Index of /\n <NodeLink drive={drive} node={undefined}>\n {getDriveName(drive)}\n </NodeLink>\n /\n {path.map((node) => (\n <Fragment key={node.id}>\n <NodeLink drive={drive} node={node}>\n {node.name}\n </NodeLink>\n /\n </Fragment>\n ))}\n </>\n );\n return (\n <IndexTable title={title} label=\"Directory listing\">\n <IndexRow\n name={\n folder ? (\n <NodeLink drive={drive} node={parent}>\n Parent Directory\n </NodeLink>\n ) : (\n <HomeLink>Parent Directory</HomeLink>\n )\n }\n type=\"-\"\n modified=\"-\"\n />\n {entries.map((node) => (\n <IndexRow\n key={node.id}\n name={\n <NodeLink drive={drive} node={node}>\n {node.kind === \"folder\" ? `${node.name}/` : node.name}\n </NodeLink>\n }\n type={isFileNode(node) ? node.documentType : \"Folder\"}\n modified={\n node.kind === \"folder\" ? (\n \"-\"\n ) : (\n <Quiet>\n <Suspense fallback=\"…\">\n <DocumentModified id={node.id} />\n </Suspense>\n </Quiet>\n )\n }\n />\n ))}\n </IndexTable>\n );\n}\n","import {\n hideRevisionHistory,\n setRevisionHistoryPage,\n useReactorClient,\n useRevisionHistoryPage,\n} from \"@powerhousedao/reactor-browser\";\nimport type { Operation } from \"@powerhousedao/shared/document-model\";\nimport { useEffect, useState } from \"react\";\nimport type { DocumentViewProps } from \"../router/route-components.js\";\nimport { formatModified, linkClass } from \"./index-table.js\";\n\nconst pagerClass = `${linkClass} disabled:text-core-muted disabled:no-underline`;\n\n/** Operations per scope on a history page. */\nexport const HISTORY_PAGE_SIZE = 50;\n\n/** Page `page`'s index range of a scope with `count` operations, newest first. */\nexport function historyPageRange(count: number, page: number) {\n const end = Math.max(count - (page - 1) * HISTORY_PAGE_SIZE, 0);\n return { start: Math.max(end - HISTORY_PAGE_SIZE, 0), end };\n}\n\ntype PageState =\n | { status: \"loading\" }\n | { status: \"ready\"; operations: Operation[] }\n | { status: \"error\"; error: Error };\n\n// Fetches only the page's range: `sinceRevision` and a limit of the page size.\nfunction useScopePage(\n documentId: string,\n scope: string,\n start: number,\n end: number,\n) {\n const client = useReactorClient();\n // Each result is kept with its request; a newer request reads as loading.\n const key = `${documentId}:${scope}:${start}:${end}`;\n const [result, setResult] = useState<{ key: string; state: PageState }>();\n const empty = !client || end <= start;\n useEffect(() => {\n if (empty) return;\n const controller = new AbortController();\n const setState = (state: PageState) => setResult({ key, state });\n client\n .getOperations(\n documentId,\n { scopes: [scope] },\n { sinceRevision: start },\n { cursor: \"\", limit: end - start },\n controller.signal,\n )\n .then(\n (page) => {\n const operations = page.results\n .filter((operation) => operation.index < end)\n .sort((a, b) => b.index - a.index);\n setState({ status: \"ready\", operations });\n },\n (reason: unknown) => {\n if (controller.signal.aborted) return;\n setState({\n status: \"error\",\n error: reason instanceof Error ? reason : new Error(String(reason)),\n });\n },\n );\n return () => controller.abort();\n }, [client, empty, key, documentId, scope, start, end]);\n if (empty) return { status: \"ready\", operations: [] } as const;\n return result?.key === key ? result.state : ({ status: \"loading\" } as const);\n}\n\nfunction ScopeOperations(props: {\n documentId: string;\n scope: string;\n count: number;\n page: number;\n}) {\n const { start, end } = historyPageRange(props.count, props.page);\n const state = useScopePage(props.documentId, props.scope, start, end);\n return (\n <section className=\"mb-6\">\n <h2 className=\"mb-2 font-semibold\">\n {props.scope}{\" \"}\n <span className=\"font-normal text-core-muted\">\n {end > start\n ? `${end - start} of ${props.count}, ${start}-${end - 1}`\n : `0 of ${props.count}`}\n </span>\n </h2>\n {state.status === \"error\" ? (\n <p className=\"text-core-danger\">{state.error.message}</p>\n ) : state.status === \"loading\" ? (\n <p className=\"text-core-muted\">Loading…</p>\n ) : state.operations.length === 0 ? (\n <p className=\"text-core-muted\">No operations on this page.</p>\n ) : (\n <table\n aria-label={`${props.scope} operations`}\n className=\"w-full border-collapse\"\n >\n <thead>\n <tr className=\"border-b border-core-border text-left text-core-muted\">\n <th className=\"py-1 pr-6 font-normal\">Index</th>\n <th className=\"py-1 pr-6 font-normal\">Action</th>\n <th className=\"py-1 font-normal\">Timestamp</th>\n </tr>\n </thead>\n <tbody>\n {state.operations.map((operation) => (\n <tr\n key={operation.index}\n className=\"border-b border-core-border/50 hover:bg-core-hover\"\n >\n <td className=\"py-1 pr-6\">{operation.index}</td>\n <td className=\"py-1 pr-6\">{operation.action.type}</td>\n <td className=\"py-1\">\n {formatModified(operation.timestampUtcMs)}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n )}\n </section>\n );\n}\n\n/** Core's revision history: each scope's operations, newest first, a page at a time. */\nexport function DocumentHistory({ document }: DocumentViewProps) {\n const page = useRevisionHistoryPage();\n const { header } = document;\n const scopes = Object.entries(header.revision);\n const pageCount = Math.max(\n 1,\n ...scopes.map(([, count]) => Math.ceil(count / HISTORY_PAGE_SIZE)),\n );\n const pager = (\n <nav aria-label=\"History pages\" className=\"flex items-center gap-4\">\n <button\n type=\"button\"\n className={pagerClass}\n disabled={page <= 1}\n onClick={() => setRevisionHistoryPage(page - 1)}\n >\n Newer\n </button>\n <span className=\"text-core-muted\">\n Page {page} of {pageCount}\n </span>\n <button\n type=\"button\"\n className={pagerClass}\n disabled={page >= pageCount}\n onClick={() => setRevisionHistoryPage(page + 1)}\n >\n Older\n </button>\n </nav>\n );\n return (\n <div className=\"p-6 font-mono text-sm text-core-fg\">\n <div className=\"mb-4 flex items-baseline justify-between\">\n <h1 className=\"text-xl font-semibold\">\n History of {header.name || header.id}\n </h1>\n <button\n type=\"button\"\n className={linkClass}\n onClick={hideRevisionHistory}\n >\n Close\n </button>\n </div>\n <div className=\"mb-4\">{pager}</div>\n {scopes.length === 0 ? (\n <p className=\"text-core-muted\">No operations yet.</p>\n ) : (\n scopes.map(([scope, count]) => (\n <ScopeOperations\n key={scope}\n documentId={header.id}\n scope={scope}\n count={count}\n page={page}\n />\n ))\n )}\n </div>\n );\n}\n","import type { ReactNode } from \"react\";\nimport type { DocumentViewProps } from \"../router/route-components.js\";\nimport { formatModified } from \"./index-table.js\";\n\nfunction Leaf({ value }: { value: unknown }) {\n if (value === null) return <span className=\"text-core-muted\">null</span>;\n if (typeof value === \"string\") {\n return <span className=\"text-core-string\">{JSON.stringify(value)}</span>;\n }\n return <span className=\"text-core-number\">{JSON.stringify(value)}</span>;\n}\n\nfunction JsonNode(props: { name: ReactNode; value: unknown; open?: boolean }) {\n const { name, value } = props;\n if (value === null || typeof value !== \"object\") {\n return (\n <div className=\"pl-4\">\n <span className=\"text-core-muted\">{name}: </span>\n <Leaf value={value} />\n </div>\n );\n }\n const entries = Object.entries(value as Record<string, unknown>);\n const isArray = Array.isArray(value);\n const summary = isArray ? `[${entries.length}]` : `{${entries.length}}`;\n return (\n <details open={props.open} className=\"pl-4\">\n <summary className=\"cursor-pointer select-none\">\n <span className=\"text-core-muted\">{name}: </span>\n <span className=\"text-core-muted\">{summary}</span>\n </summary>\n {entries.map(([key, child]) => (\n <JsonNode key={key} name={key} value={child} />\n ))}\n </details>\n );\n}\n\n/** Core's document fallback: the document's state, read-only, as a JSON tree. */\nexport function DocumentJson({ document }: DocumentViewProps) {\n const { header } = document;\n const revisions = Object.entries(header.revision);\n const operations = revisions.reduce((sum, [, count]) => sum + count, 0);\n const state = document.state as Record<string, unknown>;\n const scopes = [\"global\", \"local\"].filter((scope) => scope in state);\n return (\n <div className=\"p-6 font-mono text-sm text-core-fg\">\n <h1 className=\"mb-1 text-xl font-semibold\">{header.name || header.id}</h1>\n <dl className=\"mb-4 grid grid-cols-[max-content_1fr] gap-x-4 text-core-muted\">\n <dt>Type</dt>\n <dd>{header.documentType}</dd>\n <dt>Id</dt>\n <dd>{header.id}</dd>\n <dt>Last modified</dt>\n <dd>{formatModified(header.lastModifiedAtUtcIso)}</dd>\n <dt>Operations</dt>\n <dd data-testid=\"operation-count\">\n {operations}\n {revisions.length > 0 &&\n ` (${revisions.map(([scope, count]) => `${scope} ${count}`).join(\", \")})`}\n </dd>\n </dl>\n <p className=\"mb-2 text-core-muted\">\n No editor is installed for this document type; its state is shown\n read-only.\n </p>\n <div aria-label=\"Document state\" className=\"-ml-4\">\n {scopes.map((scope) => (\n <JsonNode key={scope} name={scope} value={state[scope]} open />\n ))}\n </div>\n </div>\n );\n}\n","import type { EditorProps } from \"@powerhousedao/shared/document-model\";\nimport type { ErrorInfo, ReactNode } from \"react\";\nimport { Component, Suspense } from \"react\";\n\n/** What core passes a document editor; drive apps get `DriveViewProps`. */\nexport type DocumentEditorProps = EditorProps & {\n documentId: string;\n context?: { readMode?: boolean; selectedTimelineRevision?: number };\n};\n\ntype BoundaryProps = {\n resetKeys: readonly unknown[];\n label: string;\n children: ReactNode;\n};\ntype BoundaryState = { error?: unknown; keys: readonly unknown[] };\n\nclass EditorErrorBoundary extends Component<BoundaryProps, BoundaryState> {\n state: BoundaryState = { keys: this.props.resetKeys };\n\n static getDerivedStateFromError(error: unknown): Partial<BoundaryState> {\n return { error };\n }\n\n // A new document or drive gets a fresh try.\n static getDerivedStateFromProps(\n props: BoundaryProps,\n state: BoundaryState,\n ): Partial<BoundaryState> | null {\n const changed =\n props.resetKeys.length !== state.keys.length ||\n props.resetKeys.some((key, i) => !Object.is(key, state.keys[i]));\n return changed ? { error: undefined, keys: props.resetKeys } : null;\n }\n\n componentDidCatch(error: unknown, info: ErrorInfo) {\n console.error(`[connect] ${this.props.label} failed:`, error, info);\n }\n\n render() {\n const { error } = this.state;\n if (error === undefined) return this.props.children;\n return (\n <div role=\"alert\" className=\"p-6 text-core-fg\">\n <h2 className=\"font-semibold\">The {this.props.label} failed</h2>\n <pre className=\"mt-2 overflow-x-auto text-sm text-core-muted\">\n {error instanceof Error ? error.message : JSON.stringify(error)}\n </pre>\n </div>\n );\n }\n}\n\nexport type EditorHostProps = {\n /** A change shows the editor again after an error. */\n resetKeys?: readonly unknown[];\n /** Names what failed, e.g. \"editor\" or \"drive app\". */\n label?: string;\n children: ReactNode;\n};\n\n/** Hosts a drive app or an editor: it loads in Suspense, and an error stays inside. */\nexport function EditorHost({\n resetKeys = [],\n label = \"editor\",\n children,\n}: EditorHostProps) {\n return (\n <EditorErrorBoundary resetKeys={resetKeys} label={label}>\n <Suspense\n name=\"EditorHost\"\n fallback={\n <p role=\"status\" className=\"p-6 text-core-muted\">\n Loading {label}…\n </p>\n }\n >\n {children}\n </Suspense>\n </EditorErrorBoundary>\n );\n}\n","import {\n DriveProvider,\n EditorDocumentProvider,\n useAppModuleById,\n useDispatch,\n useDocument,\n useEditorModuleFor,\n useRevisionHistoryVisible,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { Outlet } from \"@tanstack/react-router\";\nimport { useMemo } from \"react\";\nimport { useDriveRouteData } from \"../router/route-data.js\";\nimport { DirectoryListing } from \"./directory-listing.js\";\nimport { DocumentHistory } from \"./document-history.js\";\nimport { DocumentJson } from \"./document-json.js\";\nimport { EditorHost } from \"./editor-host.js\";\n\n/** `document`: its revision history while `?history` is set, else its\n * editor (given `document` and `dispatch`), else its JSON. */\nexport function DocumentView({ document }: { document: PHDocument }) {\n const [, dispatch] = useDispatch(document);\n const editor = useEditorModuleFor(document);\n const historyVisible = useRevisionHistoryVisible();\n if (historyVisible) return <DocumentHistory document={document} />;\n if (!editor) return <DocumentJson document={document} />;\n const Editor = editor.Component;\n return (\n <div\n className=\"relative h-full\"\n data-editor={editor.config.id}\n data-document-type={document.header.documentType}\n >\n <EditorDocumentProvider document={document} dispatch={dispatch}>\n <Editor\n documentId={document.header.id}\n document={document}\n dispatch={dispatch}\n context={{ readMode: false }}\n />\n </EditorDocumentProvider>\n </div>\n );\n}\n\nfunction OpenDocument({ documentId }: { documentId: string }) {\n const document = useDocument(documentId);\n return document ? <DocumentView document={document} /> : null;\n}\n\n/** The drive layout: the drive app its `preferredEditor` names (given the\n * drive as `document`), else the directory listing, around the node route. */\nexport function DriveLayout() {\n const { drive, folder, documentId } = useDriveRouteData();\n const app = useAppModuleById(drive?.header.meta?.preferredEditor);\n const [, dispatch] = useDispatch(drive);\n const nodeId = documentId ?? folder?.id;\n const context = useMemo(\n () => drive && { drive, dispatch, folder, nodeId },\n [drive, dispatch, folder, nodeId],\n );\n if (!drive || !context) return null;\n const App = app?.Component;\n // Drive apps show their own view until they get a document to show.\n const document = documentId ? <Outlet /> : null;\n return (\n <DriveProvider value={context}>\n <EditorHost\n resetKeys={[drive.header.id]}\n label={App ? \"drive app\" : \"drive view\"}\n >\n {App ? (\n <App document={drive} dispatch={dispatch}>\n {document}\n </App>\n ) : (\n <DirectoryListing drive={drive} folder={folder}>\n {document}\n </DirectoryListing>\n )}\n </EditorHost>\n </DriveProvider>\n );\n}\n\n/** The node route: the open document, or nothing on a folder or the drive's root. */\nexport function NodeView() {\n const { documentId } = useDriveRouteData();\n if (!documentId) return null;\n return (\n <EditorHost resetKeys={[documentId]} label=\"editor\">\n <OpenDocument documentId={documentId} />\n </EditorHost>\n );\n}\n","import {\n getDriveName,\n makeDriveSlug,\n preloadDrive,\n useAppModuleById,\n useDrives,\n useLinkProps,\n} from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport {\n formatModified,\n IndexRow,\n IndexTable,\n linkClass,\n} from \"./index-table.js\";\n\nfunction DriveRow({ drive }: { drive: DocumentDriveDocument }) {\n const app = useAppModuleById(drive.header.meta?.preferredEditor);\n const link = useLinkProps({ driveSlug: makeDriveSlug(drive) });\n return (\n <IndexRow\n name={\n <a\n {...link}\n className={linkClass}\n onMouseEnter={() => {\n link.onMouseEnter();\n preloadDrive(drive);\n }}\n >\n {getDriveName(drive)}/\n </a>\n }\n type={app?.config.name ?? \"Drive\"}\n modified={formatModified(drive.header.lastModifiedAtUtcIso)}\n />\n );\n}\n\n/** Core's home: an index of the drives. */\nexport function DriveIndex() {\n const drives = useDrives();\n // Empty until the reactor lists its drives, e.g. in the prerendered shell.\n if (!drives) return null;\n return (\n <IndexTable title=\"Index of /\" label=\"Drives\">\n {drives.map((drive) => (\n <DriveRow key={drive.header.id} drive={drive} />\n ))}\n {!drives.length && (\n <tr>\n <td colSpan={3} className=\"py-2 text-core-muted\">\n No drives yet.\n </td>\n </tr>\n )}\n </IndexTable>\n );\n}\n","import { useTheme } from \"@powerhousedao/reactor-browser\";\n\n/** Flips between light and dark; the first flip pins the system theme's opposite. */\nexport function ThemeToggle({ className }: { className?: string }) {\n const { theme, setTheme } = useTheme();\n const next = theme === \"dark\" ? \"light\" : \"dark\";\n return (\n <button\n type=\"button\"\n aria-label={`Switch to ${next} theme`}\n title={`Switch to ${next} theme`}\n className={\n className ??\n \"rounded px-2 py-1 text-core-muted hover:bg-core-hover hover:text-core-fg\"\n }\n onClick={() => setTheme(next)}\n >\n {theme === \"dark\" ? \"☾\" : \"☀\"}\n </button>\n );\n}\n","// Core's modals: the ones editors, drive apps and the reactor open, in core's plain style.\nimport {\n addDocument,\n closePHModal,\n deleteNode,\n exportFile,\n getDocumentUpgradePreview,\n getDriveName,\n getNodeTarget,\n logout,\n openRenown,\n openTarget,\n setSelectedNode,\n showPHModal,\n upgradeDocument,\n useDocumentById,\n useDocumentModelModuleById,\n useModelRegistry,\n useNodeById,\n useNodeParentFolderById,\n usePHModal,\n useRenownAuth,\n useRenownLoginMethods,\n useUser,\n validateDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHModal } from \"@powerhousedao/reactor-browser\";\nimport type { ReactNode } from \"react\";\nimport { createElement, useEffect, useId, useState } from \"react\";\nimport type { ModalFrameProps } from \"../router/modal-frame.js\";\nimport { ModalDialog, useModalFrame } from \"../router/modal-frame.js\";\nimport { useCreateDocumentTarget } from \"../router/create-target.js\";\nimport { useDriveRouteData } from \"../router/route-data.js\";\n\nconst buttonClass =\n \"rounded border border-core-border px-3 py-1 text-sm hover:bg-core-hover disabled:opacity-50\";\nconst primaryClass = `${buttonClass} font-semibold`;\n\n/** Core's modal frame: title, content, and the buttons on the right. */\nfunction CoreModalFrame({\n title,\n titleId,\n actions,\n children,\n}: ModalFrameProps) {\n return (\n <ModalDialog\n labelledBy={titleId}\n className=\"m-auto w-96 max-w-[calc(100vw-2rem)] rounded border border-core-border bg-core-bg p-5 text-core-fg backdrop:bg-black/30\"\n >\n <h2 id={titleId} className=\"mb-3 text-lg font-semibold\">\n {title}\n </h2>\n <div className=\"flex flex-col gap-2 text-sm\">{children}</div>\n <div className=\"mt-4 flex justify-end gap-2\">{actions}</div>\n </ModalDialog>\n );\n}\n\n/** A modal in the routes' frame, else core's. */\nfunction Dialog(props: {\n title: string;\n children: ReactNode;\n actions?: ReactNode;\n}) {\n const Frame = useModalFrame() ?? CoreModalFrame;\n const titleId = useId();\n const actions = props.actions ?? (\n <button type=\"button\" className={buttonClass} onClick={closePHModal}>\n Close\n </button>\n );\n // A registered frame, not one made here.\n return createElement(Frame, {\n title: props.title,\n titleId,\n actions,\n children: props.children,\n });\n}\n\nconst Cancel = () => (\n <button type=\"button\" className={buttonClass} onClick={closePHModal}>\n Cancel\n </button>\n);\n\nfunction useModal<T extends PHModal[\"type\"]>(type: T) {\n const modal = usePHModal();\n return modal?.type === type\n ? (modal as Extract<PHModal, { type: T }>)\n : undefined;\n}\n\n/** A new document of the modal's type: in its `driveId`, else the open drive\n * and folder, else a drive picked here. */\nexport function CreateDocumentModal() {\n const modal = useModal(\"createDocument\");\n const module = useDocumentModelModuleById(\n modal?.documentType,\n modal?.documentModelVersion,\n );\n const { folder } = useDriveRouteData();\n const target = useCreateDocumentTarget(modal?.driveId);\n const { drive } = target;\n const [name, setName] = useState(\"\");\n const typeName = module?.documentModel.global.name ?? modal?.documentType;\n const create = async () => {\n if (!drive || !module || !modal) return;\n closePHModal();\n const node = await addDocument(\n drive.header.id,\n name.trim() || `New ${typeName}`,\n module.documentModel.global.id,\n target.isOpenDrive ? folder?.id : undefined,\n undefined,\n undefined,\n undefined,\n modal.documentModelVersion,\n );\n // Opens it in its drive, wherever the modal was opened.\n openTarget(getNodeTarget(node, drive));\n };\n return (\n <Dialog\n title={`New ${typeName ?? \"document\"}`}\n actions={\n <>\n <Cancel />\n <button\n type=\"submit\"\n form=\"create-document\"\n className={primaryClass}\n disabled={!drive || !module}\n >\n Create\n </button>\n </>\n }\n >\n <form\n id=\"create-document\"\n className=\"flex flex-col gap-2\"\n onSubmit={(event) => {\n event.preventDefault();\n void create();\n }}\n >\n <label className=\"flex flex-col gap-1\">\n Name\n <input\n autoFocus\n value={name}\n onChange={(event) => setName(event.target.value)}\n placeholder={`New ${typeName}`}\n className=\"rounded border border-core-border bg-core-bg px-2 py-1\"\n />\n </label>\n {!!target.choices?.length && (\n <label className=\"flex flex-col gap-1\">\n Drive\n <select\n value={drive?.header.id ?? \"\"}\n onChange={(event) => target.pick(event.target.value)}\n className=\"rounded border border-core-border bg-core-bg px-2 py-1\"\n >\n {!drive && <option value=\"\">Choose a drive</option>}\n {target.choices.map((choice) => (\n <option key={choice.header.id} value={choice.header.id}>\n {getDriveName(choice)}\n </option>\n ))}\n </select>\n </label>\n )}\n </form>\n {target.choices?.length === 0 && (\n <p className=\"text-core-muted\">\n There's no drive to create it in.{\" \"}\n <button\n type=\"button\"\n className=\"underline\"\n onClick={() => showPHModal({ type: \"addDrive\" })}\n >\n Add a drive\n </button>\n </p>\n )}\n </Dialog>\n );\n}\n\n/** Signs in with Renown: the configured methods, else its portal. */\nexport function LoginModal() {\n const user = useUser();\n const methods = useRenownLoginMethods();\n const { login, pending, error } = useRenownAuth();\n useEffect(() => {\n if (user) closePHModal();\n }, [user]);\n return (\n <Dialog title=\"Log in\">\n {methods.length ? (\n methods.map((method) => (\n <button\n key={method.id}\n type=\"button\"\n className={buttonClass}\n disabled={pending}\n onClick={() => {\n closePHModal();\n login(undefined, method.id);\n }}\n >\n {method.label}\n </button>\n ))\n ) : (\n <button\n type=\"button\"\n className={primaryClass}\n onClick={() => openRenown()}\n >\n Continue with Renown\n </button>\n )}\n {error && <p className=\"text-core-muted\">{error.message}</p>}\n </Dialog>\n );\n}\n\n/** Deletes a file or folder, then opens its parent. */\nexport function DeleteItemModal() {\n const modal = useModal(\"deleteItem\");\n const node = useNodeById(modal?.id);\n const parent = useNodeParentFolderById(modal?.id);\n const { drive } = useDriveRouteData();\n const remove = async () => {\n closePHModal();\n if (!drive || !modal) return;\n await deleteNode(drive.header.id, modal.id);\n setSelectedNode(parent);\n };\n return (\n <Dialog\n title={`Delete ${node?.name ?? \"item\"}?`}\n actions={\n <>\n <Cancel />\n <button\n type=\"button\"\n className={primaryClass}\n onClick={() => void remove()}\n >\n Delete\n </button>\n </>\n }\n >\n <p>\n {node?.kind === \"folder\"\n ? \"The folder and everything in it will be deleted.\"\n : \"The document will be deleted.\"}\n </p>\n </Dialog>\n );\n}\n\n/** Upgrades a document to its model's latest version. */\nexport function ConfirmDocumentUpgradeModal() {\n const modal = useModal(\"confirmDocumentUpgrade\");\n const [document] = useDocumentById(modal?.documentId);\n const registry = useModelRegistry();\n const preview = document\n ? getDocumentUpgradePreview(document, registry)\n : undefined;\n if (!document || !preview) return null;\n const upgrade = () => {\n closePHModal();\n upgradeDocument(document.header.id).catch((error: unknown) => {\n console.error(\"[connect] the document upgrade failed:\", error);\n });\n };\n return (\n <Dialog\n title=\"Update document\"\n actions={\n <>\n <Cancel />\n <button type=\"button\" className={primaryClass} onClick={upgrade}>\n Update document\n </button>\n </>\n }\n >\n <p>\n From version {preview.fromVersion} to {preview.toVersion}. Existing\n content is migrated; this can't be undone.\n </p>\n {preview.steps\n .filter((step) => step.description)\n .map((step) => (\n <p key={step.toVersion}>\n v{step.toVersion}: {step.description}\n </p>\n ))}\n </Dialog>\n );\n}\n\n/** Exports a document that has validation errors, after listing them. */\nexport function DownloadDocumentWithErrorsModal() {\n const modal = useModal(\"downloadDocumentWithErrors\");\n const [document] = useDocumentById(modal?.documentId);\n if (!document) return null;\n const errors = validateDocument(document);\n const download = () => {\n closePHModal();\n exportFile(document).catch((error: unknown) => {\n console.error(\"[connect] the export failed:\", error);\n });\n };\n return (\n <Dialog\n title=\"The document has errors\"\n actions={\n <>\n <Cancel />\n <button type=\"button\" className={primaryClass} onClick={download}>\n Export anyway\n </button>\n </>\n }\n >\n <ul className=\"list-disc pl-5 text-core-muted\">\n {errors.map((error, index) => (\n <li key={index}>{error.message}</li>\n ))}\n </ul>\n </Dialog>\n );\n}\n\n/** A document whose model version no installed package provides. */\nexport function DocumentVersionUnsupportedModal() {\n const modal = useModal(\"documentVersionUnsupported\");\n if (!modal) return null;\n const { documentType, requiredVersion, availableVersions } = modal;\n return (\n <Dialog\n title=\"Document version not supported\"\n actions={\n <>\n <Cancel />\n <button\n type=\"button\"\n className={primaryClass}\n onClick={() => {\n closePHModal();\n openTarget({ settings: \"packages\" });\n }}\n >\n Show packages\n </button>\n </>\n }\n >\n <p>\n This document needs version {requiredVersion} of \"{documentType}\"; the\n installed packages provide {availableVersions.join(\", \")}.\n </p>\n </Dialog>\n );\n}\n\n/** A protected drive that couldn't be added: sign in, or as someone else. */\nexport function DriveAuthRequiredModal() {\n const user = useUser();\n return (\n <Dialog\n title={user ? \"No access to this drive\" : \"Log in to access this drive\"}\n actions={\n <>\n <Cancel />\n {user ? (\n <button\n type=\"button\"\n className={primaryClass}\n onClick={() => {\n closePHModal();\n void logout();\n }}\n >\n Log out\n </button>\n ) : (\n <button\n type=\"button\"\n className={primaryClass}\n onClick={() => showPHModal({ type: \"login\" })}\n >\n Log in\n </button>\n )}\n </>\n }\n >\n <p>\n {user\n ? \"The account you're signed in with can't open this drive.\"\n : \"This drive is only open to signed-in users.\"}\n </p>\n </Dialog>\n );\n}\n","import {\n initTheme,\n useLinkProps,\n useTheme,\n} from \"@powerhousedao/reactor-browser\";\nimport { HeadContent, Link, Outlet, useRouter } from \"@tanstack/react-router\";\nimport { Suspense } from \"react\";\nimport type { ConnectModals } from \"../router/modals.js\";\nimport { CORE_MODAL_VIEWS, ModalOutlet } from \"../router/modals.js\";\nimport { ContentOutlet } from \"../router/route-components.js\";\nimport { useNavRoutes, useSidebarMode } from \"../router/sidebar.js\";\nimport { appTitle } from \"../router/titles.js\";\nimport { useIsEmbedded } from \"../runtime/embedded.js\";\nimport { ThemeToggle } from \"./theme-toggle.js\";\nimport { linkClass } from \"./index-table.js\";\nimport * as modalViews from \"./modals.js\";\n\n// The layout shares the modals' chunk, so it renders them directly.\nconst coreModals: ConnectModals = Object.fromEntries(\n Object.entries(CORE_MODAL_VIEWS).map(([type, name]) => [\n type,\n modalViews[name],\n ]),\n);\n\n/** Core's root: the page, in the theme. */\nexport function CoreRoot() {\n initTheme();\n useTheme();\n return (\n <div className=\"h-screen overflow-auto bg-core-bg text-core-fg\">\n {/* The matched routes' head: the document title. */}\n <HeadContent />\n <Suspense name=\"CoreRoot\">\n <Outlet />\n </Suspense>\n <ModalOutlet modals={coreModals} />\n </div>\n );\n}\n\n/** Core's header: home, the `staticData.nav` routes, settings and the theme. */\nexport function CoreHeader() {\n const appName = useRouter().options.context.appName;\n const home = useLinkProps(undefined);\n const settings = useLinkProps({ settings: true });\n const navRoutes = useNavRoutes();\n return (\n <header className=\"flex items-center gap-4 border-b border-core-border px-4 py-2 text-sm\">\n <a {...home} className=\"font-semibold text-core-fg\">\n {appTitle(appName)}\n </a>\n <nav aria-label=\"Pages\" className=\"flex gap-3\">\n {navRoutes.map((item) => (\n // `to` is a plain string: the routes are only known at runtime.\n <Link key={item.routeId} to={item.to as never} className={linkClass}>\n {item.label}\n </Link>\n ))}\n </nav>\n <div className=\"ml-auto flex items-center gap-2\">\n <a {...settings} className={linkClass}>\n Settings\n </a>\n <ThemeToggle />\n </div>\n </header>\n );\n}\n\n/** Core's `_app` layout: the header above the matched route. Embedded mode\n * and `staticData.sidebar: \"hidden\"` drop the header. */\nexport function CoreLayout() {\n const isEmbedded = useIsEmbedded();\n const hidden = useSidebarMode() === \"hidden\";\n return (\n <div className=\"flex h-full flex-col\">\n {!isEmbedded && !hidden && <CoreHeader />}\n <main className=\"relative min-h-0 flex-1\">\n <ContentOutlet />\n </main>\n </div>\n );\n}\n","import { useLinkProps } from \"@powerhousedao/reactor-browser\";\nimport { useRouterState } from \"@tanstack/react-router\";\n\n/** The 404 page: what was asked for, and a way home. */\nexport function NotFoundPage({ driveSlug }: { driveSlug?: string }) {\n const pathname = useRouterState({ select: (s) => s.location.pathname });\n const home = useLinkProps(undefined);\n return (\n <div\n role=\"alert\"\n className=\"flex size-full flex-col items-center justify-center gap-3 p-6 text-center\"\n >\n <h1 className=\"text-2xl font-semibold text-core-fg\">\n {driveSlug ? `Drive ${driveSlug} not found` : \"Page not found\"}\n </h1>\n <p className=\"text-core-muted\">\n Nothing is at{\" \"}\n <code data-testid=\"not-found-path\" className=\"text-core-fg\">\n {pathname}\n </code>\n .\n </p>\n <a {...home} className=\"text-core-fg underline\">\n Go to the home page\n </a>\n </div>\n );\n}\n\nexport function DriveNotFoundPage({ driveSlug }: { driveSlug: string }) {\n return <NotFoundPage driveSlug={driveSlug} />;\n}\n","import type { ErrorComponentProps } from \"@tanstack/react-router\";\n\n/** A route's loader or render error. */\nexport function CoreRouteError({ error, reset }: ErrorComponentProps) {\n return (\n <div role=\"alert\" className=\"flex flex-col gap-2 p-6 text-core-fg\">\n <h1 className=\"text-lg font-semibold\">Something went wrong</h1>\n <pre className=\"overflow-x-auto text-sm text-core-muted\">\n {error instanceof Error ? error.message : JSON.stringify(error)}\n </pre>\n <button\n type=\"button\"\n className=\"self-start rounded border border-core-border px-3 py-1 hover:bg-core-hover\"\n onClick={reset}\n >\n Try again\n </button>\n </div>\n );\n}\n","import {\n useLinkProps,\n usePHNavigation,\n useTheme,\n} from \"@powerhousedao/reactor-browser\";\nimport { Outlet } from \"@tanstack/react-router\";\nimport { Suspense } from \"react\";\nimport type { SettingsTabEntry } from \"../router/settings.js\";\nimport { useSettingsTabs } from \"../router/settings.js\";\n\nfunction TabLink({ tab }: { tab: SettingsTabEntry }) {\n const link = useLinkProps({ settings: tab.id });\n const current = link[\"aria-current\"] === \"page\";\n const Icon = tab.icon;\n return (\n <a\n {...link}\n className={[\n \"flex items-center gap-2 rounded px-3 py-1.5\",\n current ? \"bg-core-hover font-semibold\" : \"hover:bg-core-hover\",\n tab.destructive ? \"text-core-danger\" : \"text-core-fg\",\n ].join(\" \")}\n >\n {Icon && <Icon size={16} />}\n {tab.label}\n </a>\n );\n}\n\n/** Core's settings page: the tabs from `staticData.settings` beside the open one. */\nexport function CoreSettingsPage() {\n const tabs = useSettingsTabs();\n const navigation = usePHNavigation();\n // Back to where settings was opened from, else home.\n const close = () => {\n if (navigation.closeOpened?.()) return;\n navigation.open(undefined, { replace: true });\n };\n return (\n <div className=\"flex h-full flex-col text-core-fg\">\n <div className=\"flex items-center justify-between border-b border-core-border px-4 py-3\">\n <h1 className=\"text-lg font-semibold\">Settings</h1>\n <button\n type=\"button\"\n className=\"rounded px-2 text-core-muted hover:bg-core-hover\"\n onClick={close}\n >\n Close\n </button>\n </div>\n <div className=\"flex min-h-0 flex-1\">\n <nav aria-label=\"Settings\" className=\"w-48 shrink-0 p-3\">\n <ul className=\"flex flex-col gap-1\">\n {tabs.map((tab) => (\n <li key={tab.id}>\n <TabLink tab={tab} />\n </li>\n ))}\n </ul>\n </nav>\n <section className=\"min-w-0 flex-1 overflow-auto p-6\">\n <Suspense name=\"SettingsTab\">\n <Outlet />\n </Suspense>\n </section>\n </div>\n </div>\n );\n}\n\nconst THEMES = [\n { value: \"light\", label: \"Light\" },\n { value: \"dark\", label: \"Dark\" },\n { value: \"system\", label: \"System\" },\n] as const;\n\n/** Core's Appearance tab: light, dark, or the system's. */\nexport function AppearanceTab() {\n const { theme, isSystem, setTheme } = useTheme();\n const selected = isSystem ? \"system\" : theme;\n return (\n <fieldset className=\"flex flex-col gap-2\">\n <legend className=\"mb-2 font-semibold\">Theme</legend>\n {THEMES.map((option) => (\n <label key={option.value} className=\"flex items-center gap-2\">\n <input\n type=\"radio\"\n name=\"theme\"\n value={option.value}\n checked={selected === option.value}\n onChange={() => setTheme(option.value)}\n />\n {option.label}\n </label>\n ))}\n </fieldset>\n );\n}\n","import {\n DRIVE_DOCUMENT_TYPES,\n useVetraPackageManager,\n useVetraPackages,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentModelLib,\n EditorModule,\n} from \"@powerhousedao/shared/document-model\";\nimport type { ReactNode } from \"react\";\n\nconst SOURCE_LABELS: Record<string, string> = {\n common: \"built-in\",\n project: \"project\",\n \"local-install\": \"local\",\n \"registry-install\": \"registry\",\n};\n\nconst isDriveApp = (editor: EditorModule) =>\n editor.documentTypes.some((type) =>\n (DRIVE_DOCUMENT_TYPES as readonly string[]).includes(type),\n );\n\n/** A package's document models by type, with every version it ships. */\nfunction modelsOf(pkg: DocumentModelLib) {\n const byType = new Map<string, { name: string; versions: number[] }>();\n for (const model of pkg.documentModels) {\n const { id, name } = model.documentModel.global;\n const entry = byType.get(id) ?? { name, versions: [] };\n entry.versions.push(model.version ?? 1);\n byType.set(id, entry);\n }\n return [...byType].map(([type, { name, versions }]) => ({\n type,\n name,\n versions: versions.sort((a, b) => a - b),\n }));\n}\n\nfunction Section(props: { title: string; children: ReactNode }) {\n return (\n <div className=\"mt-3\">\n <h3 className=\"mb-1 text-xs font-semibold tracking-wide text-core-muted uppercase\">\n {props.title}\n </h3>\n {props.children}\n </div>\n );\n}\n\nconst cell = \"py-1 pr-4 align-top break-words\";\n\nfunction EditorTable(props: { label: string; editors: EditorModule[] }) {\n return (\n <table\n aria-label={props.label}\n className=\"w-full table-fixed border-collapse text-sm\"\n >\n <tbody>\n {props.editors.map((editor) => (\n <tr key={editor.config.id} className=\"border-t border-core-border/50\">\n <td className={`${cell} w-1/3`}>{editor.config.name}</td>\n <td className={`${cell} w-1/3 font-mono text-core-muted`}>\n {editor.config.id}\n </td>\n <td className={`${cell} font-mono`}>\n {editor.documentTypes.join(\", \")}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n\nfunction PackageEntry({ pkg }: { pkg: DocumentModelLib }) {\n const manager = useVetraPackageManager();\n const name = pkg.manifest.name;\n const version = manager?.getPackageVersion(name);\n const source = manager?.getPackageSource(name);\n const models = modelsOf(pkg);\n const apps = pkg.editors.filter(isDriveApp);\n const editors = pkg.editors.filter((editor) => !isDriveApp(editor));\n return (\n <li\n aria-label={name}\n className=\"rounded border border-core-border px-4 py-3\"\n >\n <div className=\"flex flex-wrap items-baseline gap-x-3\">\n <h2 className=\"font-semibold\">{name}</h2>\n {version && (\n <span className=\"font-mono text-sm text-core-muted\">{version}</span>\n )}\n {source && (\n <span className=\"rounded border border-core-border px-1.5 text-xs text-core-muted\">\n {SOURCE_LABELS[source] ?? source}\n </span>\n )}\n </div>\n {models.length > 0 && (\n <Section title=\"Document models\">\n <table\n aria-label={`${name} document models`}\n className=\"w-full table-fixed border-collapse text-sm\"\n >\n <tbody>\n {models.map((model) => (\n <tr key={model.type} className=\"border-t border-core-border/50\">\n <td className={`${cell} w-1/3`}>{model.name}</td>\n <td className={`${cell} w-1/3 font-mono`}>{model.type}</td>\n <td className={`${cell} text-core-muted`}>\n {model.versions.map((v) => `v${v}`).join(\", \")}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </Section>\n )}\n {editors.length > 0 && (\n <Section title=\"Editors\">\n <EditorTable label={`${name} editors`} editors={editors} />\n </Section>\n )}\n {apps.length > 0 && (\n <Section title=\"Drive apps\">\n <EditorTable label={`${name} drive apps`} editors={apps} />\n </Section>\n )}\n </li>\n );\n}\n\n/** Core's Packages tab: the loaded packages, their document models, editors and drive apps. */\nexport function PackagesTab() {\n const packages = useVetraPackages();\n return (\n <div className=\"w-full max-w-3xl\">\n {packages.length === 0 ? (\n <p className=\"text-core-muted\">No packages are loaded.</p>\n ) : (\n <ul aria-label=\"Packages\" className=\"flex flex-col gap-3\">\n {packages.map((pkg, index) => (\n <PackageEntry key={`${pkg.manifest.name}:${index}`} pkg={pkg} />\n ))}\n </ul>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGA,SAAgB,eAAe,KAAyB;CACtD,IAAI,CAAC,KAAK,OAAO;CACjB,MAAM,OAAO,IAAI,KAAK,GAAG;CACzB,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,GAAG,OAAO;CACzC,OAAO,KAAK,YAAY,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,QAAQ,KAAK,GAAG;AACzD;;AAGA,SAAgB,WAAW,OAIxB;CACD,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,MAAD;GAAI,WAAU;GAA8B,UAAA,MAAM;EAAU,CAAA,GAC5D,qBAAC,SAAD;GAAO,cAAY,MAAM;GAAO,WAAU;GAA1C,UAAA,CACE,oBAAC,SAAD,EAAA,UACE,qBAAC,MAAD;IAAI,WAAU;IAAd,UAAA;KACE,oBAAC,MAAD;MAAI,WAAU;MAAwB,UAAA;KAAQ,CA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ANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as DocumentJson, D as DocumentView, E as DirectoryListing, O as DriveLayout, S as EditorHostProps, T as HISTORY_PAGE_SIZE, _ as CoreRoot, a as CoreRouteError, b as DocumentEditorProps, c as DeleteItemModal, d as DriveAuthRequiredModal, f as LoginModal, g as CoreLayout, h as CoreHeader, i as CoreSettingsPage, k as NodeView, l as DocumentVersionUnsupportedModal, m as NotFoundPage, n as PackagesTab, o as ConfirmDocumentUpgradeModal, p as DriveNotFoundPage, r as AppearanceTab, s as CreateDocumentModal, t as ThemeToggle, u as DownloadDocumentWithErrorsModal, v as formatModified, w as DocumentHistory, x as EditorHost, y as DriveIndex } from "./index-
|
|
1
|
+
import { C as DocumentJson, D as DocumentView, E as DirectoryListing, O as DriveLayout, S as EditorHostProps, T as HISTORY_PAGE_SIZE, _ as CoreRoot, a as CoreRouteError, b as DocumentEditorProps, c as DeleteItemModal, d as DriveAuthRequiredModal, f as LoginModal, g as CoreLayout, h as CoreHeader, i as CoreSettingsPage, k as NodeView, l as DocumentVersionUnsupportedModal, m as NotFoundPage, n as PackagesTab, o as ConfirmDocumentUpgradeModal, p as DriveNotFoundPage, r as AppearanceTab, s as CreateDocumentModal, t as ThemeToggle, u as DownloadDocumentWithErrorsModal, v as formatModified, w as DocumentHistory, x as EditorHost, y as DriveIndex } from "./index-DQ0nbYne.js";
|
|
2
2
|
export { AppearanceTab, ConfirmDocumentUpgradeModal, CoreHeader, CoreLayout, CoreRoot, CoreRouteError, CoreSettingsPage, CreateDocumentModal, DeleteItemModal, DirectoryListing, type DocumentEditorProps, DocumentHistory, DocumentJson, DocumentVersionUnsupportedModal, DocumentView, DownloadDocumentWithErrorsModal, DriveAuthRequiredModal, DriveIndex, DriveLayout, DriveNotFoundPage, EditorHost, type EditorHostProps, HISTORY_PAGE_SIZE, LoginModal, NodeView, NotFoundPage, PackagesTab, ThemeToggle, formatModified };
|
|
3
3
|
export {};
|