@inkandswitch/patchwork-bootloader 0.4.3 → 0.4.4

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/site.d.ts CHANGED
@@ -1,15 +1,13 @@
1
1
  /**
2
- * High-level browser-app boot sequence for a Patchwork site.
2
+ * Browser-app boot sequence for a Patchwork site.
3
3
  *
4
- * Layers on top of {@link setupServiceWorker} (the package default export) to
5
- * construct the Repo, wire up the automerge-worker port, load plugins via the
6
- * ModuleWatcher, resolve the user's account document, and hand control to the
7
- * configured root tool.
4
+ * Layers on top of {@link setupServiceWorker} to construct the Repo, wire up
5
+ * the automerge-worker port, load plugins via the ModuleWatcher, resolve the
6
+ * user's account document, and hand control to the configured root tool.
8
7
  *
9
- * This entry point pulls in DOM- and plugin-layer dependencies (patchwork
10
- * elements, plugins, filesystem) and is intended for use only from a browser
11
- * site's `main.ts`. Non-UI consumers should import the package default (which
12
- * only does SW registration and the automerge-worker handoff).
8
+ * Pulls in DOM- and plugin-layer dependencies, so it is for a browser site's
9
+ * `main.ts` only. Non-UI consumers should import the package default, which
10
+ * does SW registration and the automerge-worker handoff and nothing else.
13
11
  */
14
12
  import { type DocHandle, Repo, type AutomergeUrl } from "@automerge/vanillajs/slim";
15
13
  import { type AutomergeRepoKeyhive } from "@automerge/automerge-repo-keyhive";
@@ -17,6 +15,10 @@ import { ModuleWatcher } from "@inkandswitch/patchwork-filesystem";
17
15
  import { type AccountDoc } from "@inkandswitch/patchwork-plugins";
18
16
  import * as plugins from "@inkandswitch/patchwork-plugins";
19
17
  import type { ServiceWorkerRepoChannelListener, SyncStateDocMessage } from "./types.js";
18
+ type SignerIdentity = {
19
+ peerId: string;
20
+ verifyingKey: string;
21
+ };
20
22
  declare global {
21
23
  interface Window {
22
24
  accountDocHandle: DocHandle<AccountDoc>;
@@ -30,10 +32,7 @@ declare global {
30
32
  packages: ModuleWatcher;
31
33
  plugins: typeof plugins;
32
34
  accountDocHandle: DocHandle<AccountDoc>;
33
- signer?: {
34
- peerId: string;
35
- verifyingKey: string;
36
- };
35
+ signer?: SignerIdentity;
37
36
  sw: {
38
37
  connectClassicSync: (server?: string) => Promise<void>;
39
38
  subscribeToRepoChannel: (listener: ServiceWorkerRepoChannelListener) => Promise<() => void>;
@@ -61,9 +60,7 @@ export interface SiteConfig {
61
60
  * folder docs or plain HTTP(S) bundles, so deployment targets can be freely
62
61
  * mixed.
63
62
  *
64
- * Can be overridden at runtime by setting `localStorage.systemPackageListURL` to
65
- * another `automerge:` URL or manifest URL — useful for local development
66
- * against an unpublished tool set.
63
+ * Overridable at runtime with `localStorage.systemPackageListURL`.
67
64
  */
68
65
  defaultModules?: string | string[];
69
66
  /**
@@ -82,15 +79,11 @@ export interface SiteConfig {
82
79
  * when a document is open. The separator is provided for you.
83
80
  */
84
81
  titleSuffix: string;
85
- /**
86
- * DOM id of the `<patchwork-view>` element that will host the root tool.
87
- * Defaults to `"root"`.
88
- */
82
+ /** DOM id of the `<patchwork-view>` hosting the root tool. Defaults to "root". */
89
83
  rootElementId?: string;
90
84
  /**
91
- * When true, initialize keyhive for access control.
92
- * The Repo will use keyhive's network adapter, peerId, and idFactory
93
- * instead of a sharePolicy.
85
+ * Initialize keyhive for access control. The Repo then uses keyhive's network
86
+ * adapter, peerId and idFactory instead of a sharePolicy.
94
87
  */
95
88
  keyhive?: boolean;
96
89
  }
@@ -99,13 +92,5 @@ export interface BootResult {
99
92
  moduleWatcher: ModuleWatcher;
100
93
  accountDocHandle: DocHandle<AccountDoc>;
101
94
  }
102
- /**
103
- * Boot a Patchwork browser site.
104
- *
105
- * Performs the full application-shell setup: service worker + port, Repo,
106
- * plugin/module loading, account resolution, URL-hash routing, and dev-console
107
- * globals (`window.repo`, `window.patchwork`, `window.uncache`). Returns the
108
- * constructed Repo, ModuleWatcher and account handle for sites that want to
109
- * do additional wiring after boot.
110
- */
111
95
  export declare function bootPatchworkSite(config: SiteConfig): Promise<BootResult>;
96
+ export {};