@statewalker/platform.core 0.1.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/adapters.d.ts +23 -0
  2. package/dist/adapters.d.ts.map +1 -0
  3. package/dist/adapters.js +32 -0
  4. package/dist/adapters.js.map +1 -0
  5. package/dist/commands/copy-to-clipboard/index.d.ts +8 -0
  6. package/dist/commands/copy-to-clipboard/index.d.ts.map +1 -0
  7. package/dist/commands/copy-to-clipboard/index.js +8 -0
  8. package/dist/commands/copy-to-clipboard/index.js.map +1 -0
  9. package/dist/commands/download-blob/index.d.ts +9 -0
  10. package/dist/commands/download-blob/index.d.ts.map +1 -0
  11. package/dist/commands/download-blob/index.js +8 -0
  12. package/dist/commands/download-blob/index.js.map +1 -0
  13. package/dist/commands/download-to-files/index.d.ts +21 -0
  14. package/dist/commands/download-to-files/index.d.ts.map +1 -0
  15. package/dist/commands/download-to-files/index.js +8 -0
  16. package/dist/commands/download-to-files/index.js.map +1 -0
  17. package/dist/commands/index.d.ts +8 -0
  18. package/dist/commands/pick-directory/index.d.ts +13 -0
  19. package/dist/commands/pick-directory/index.d.ts.map +1 -0
  20. package/dist/commands/pick-directory/index.js +8 -0
  21. package/dist/commands/pick-directory/index.js.map +1 -0
  22. package/dist/commands/pick-file/index.d.ts +14 -0
  23. package/dist/commands/pick-file/index.d.ts.map +1 -0
  24. package/dist/commands/pick-file/index.js +8 -0
  25. package/dist/commands/pick-file/index.js.map +1 -0
  26. package/dist/commands/preference-get/index.d.ts +11 -0
  27. package/dist/commands/preference-get/index.d.ts.map +1 -0
  28. package/dist/commands/preference-get/index.js +8 -0
  29. package/dist/commands/preference-get/index.js.map +1 -0
  30. package/dist/commands/preference-set/index.d.ts +9 -0
  31. package/dist/commands/preference-set/index.d.ts.map +1 -0
  32. package/dist/commands/preference-set/index.js +8 -0
  33. package/dist/commands/preference-set/index.js.map +1 -0
  34. package/dist/errors.d.ts +16 -0
  35. package/dist/errors.d.ts.map +1 -0
  36. package/dist/errors.js +22 -0
  37. package/dist/errors.js.map +1 -0
  38. package/dist/index.d.ts +12 -0
  39. package/dist/index.js +11 -0
  40. package/dist/url-state-view.d.ts +46 -0
  41. package/dist/url-state-view.d.ts.map +1 -0
  42. package/dist/url-state-view.js +63 -0
  43. package/dist/url-state-view.js.map +1 -0
  44. package/package.json +11 -6
  45. package/dist/index.d.mts +0 -160
  46. package/dist/index.d.mts.map +0 -1
  47. package/dist/index.mjs +0 -139
  48. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,23 @@
1
+ import { Commands } from "@statewalker/shared-commands";
2
+ //#region src/adapters.d.ts
3
+ /**
4
+ * Resolve the workspace-scoped `Commands` bus for the given context bag.
5
+ * Delegates to `workspace.requireAdapter(Commands)`, which auto-instantiates
6
+ * a single shared bus on first lookup so every fragment composed under the
7
+ * same workspace dispatches through the same instance.
8
+ */
9
+ export declare function getCommands(ctx: Record<string, unknown>): Commands;
10
+ /**
11
+ * @deprecated The commands bus is now workspace-scoped and auto-instantiated;
12
+ * explicit registration is a no-op. Kept for one release so legacy bootstrap
13
+ * code keeps compiling. Will be removed in a follow-up phase.
14
+ */
15
+ export declare function setCommands(_ctx: Record<string, unknown>, _commands: Commands): void;
16
+ /**
17
+ * @deprecated The commands bus is now workspace-scoped and lifecycle-managed by
18
+ * the workspace; explicit removal is a no-op. Kept for one release so legacy
19
+ * teardown code keeps compiling. Will be removed in a follow-up phase.
20
+ */
21
+ export declare function removeCommands(_ctx: Record<string, unknown>): void;
22
+ //#endregion
23
+ //# sourceMappingURL=adapters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapters.d.ts","names":[],"sources":["../src/adapters.ts"],"mappings":";;;;;;;;wBASgB,YAAY,KAAK,0BAA0B;;;;;;wBAS3C,YAAY,MAAM,yBAAyB,WAAW;;;;;;wBAWtD,eAAe,MAAM"}
@@ -0,0 +1,32 @@
1
+ import { Commands } from "@statewalker/shared-commands";
2
+ import { getWorkspace } from "@statewalker/workspace.core";
3
+ //#region src/adapters.ts
4
+ /**
5
+ * Resolve the workspace-scoped `Commands` bus for the given context bag.
6
+ * Delegates to `workspace.requireAdapter(Commands)`, which auto-instantiates
7
+ * a single shared bus on first lookup so every fragment composed under the
8
+ * same workspace dispatches through the same instance.
9
+ */
10
+ function getCommands(ctx) {
11
+ return getWorkspace(ctx).requireAdapter(Commands);
12
+ }
13
+ /**
14
+ * @deprecated The commands bus is now workspace-scoped and auto-instantiated;
15
+ * explicit registration is a no-op. Kept for one release so legacy bootstrap
16
+ * code keeps compiling. Will be removed in a follow-up phase.
17
+ */
18
+ function setCommands(_ctx, _commands) {
19
+ console.warn("[platform-api] setCommands is deprecated and a no-op: the Commands bus is now workspace-bound and auto-instantiated via workspace.requireAdapter(Commands).");
20
+ }
21
+ /**
22
+ * @deprecated The commands bus is now workspace-scoped and lifecycle-managed by
23
+ * the workspace; explicit removal is a no-op. Kept for one release so legacy
24
+ * teardown code keeps compiling. Will be removed in a follow-up phase.
25
+ */
26
+ function removeCommands(_ctx) {
27
+ console.warn("[platform-api] removeCommands is deprecated and a no-op: the Commands bus lifecycle is owned by workspace.close().");
28
+ }
29
+ //#endregion
30
+ export { getCommands, removeCommands, setCommands };
31
+
32
+ //# sourceMappingURL=adapters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapters.js","names":[],"sources":["../src/adapters.ts"],"sourcesContent":["import { Commands } from \"@statewalker/shared-commands\";\nimport { getWorkspace } from \"@statewalker/workspace.core\";\n\n/**\n * Resolve the workspace-scoped `Commands` bus for the given context bag.\n * Delegates to `workspace.requireAdapter(Commands)`, which auto-instantiates\n * a single shared bus on first lookup so every fragment composed under the\n * same workspace dispatches through the same instance.\n */\nexport function getCommands(ctx: Record<string, unknown>): Commands {\n return getWorkspace(ctx).requireAdapter(Commands);\n}\n\n/**\n * @deprecated The commands bus is now workspace-scoped and auto-instantiated;\n * explicit registration is a no-op. Kept for one release so legacy bootstrap\n * code keeps compiling. Will be removed in a follow-up phase.\n */\nexport function setCommands(_ctx: Record<string, unknown>, _commands: Commands): void {\n console.warn(\n \"[platform-api] setCommands is deprecated and a no-op: the Commands bus is now workspace-bound and auto-instantiated via workspace.requireAdapter(Commands).\",\n );\n}\n\n/**\n * @deprecated The commands bus is now workspace-scoped and lifecycle-managed by\n * the workspace; explicit removal is a no-op. Kept for one release so legacy\n * teardown code keeps compiling. Will be removed in a follow-up phase.\n */\nexport function removeCommands(_ctx: Record<string, unknown>): void {\n console.warn(\n \"[platform-api] removeCommands is deprecated and a no-op: the Commands bus lifecycle is owned by workspace.close().\",\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,YAAY,KAAwC;CAClE,OAAO,aAAa,GAAG,CAAC,CAAC,eAAe,QAAQ;AAClD;;;;;;AAOA,SAAgB,YAAY,MAA+B,WAA2B;CACpF,QAAQ,KACN,6JACF;AACF;;;;;;AAOA,SAAgB,eAAe,MAAqC;CAClE,QAAQ,KACN,oHACF;AACF"}
@@ -0,0 +1,8 @@
1
+ //#region src/commands/copy-to-clipboard/index.d.ts
2
+ export declare const COPY_TO_CLIPBOARD_COMMAND_KEY = "platform:copy-to-clipboard";
3
+ export interface CopyToClipboardPayload {
4
+ text: string;
5
+ }
6
+ export declare const CopyToClipboardCommand: import("@statewalker/shared-commands").CommandDeclaration<CopyToClipboardPayload, void>;
7
+ //#endregion
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/commands/copy-to-clipboard/index.ts"],"mappings":";qBAEa;iBAEI;EACf;;qBAGW,+DAAsB,mBAAA"}
@@ -0,0 +1,8 @@
1
+ import { Command, passthrough } from "@statewalker/shared-commands";
2
+ //#region src/commands/copy-to-clipboard/index.ts
3
+ const COPY_TO_CLIPBOARD_COMMAND_KEY = "platform:copy-to-clipboard";
4
+ const CopyToClipboardCommand = Command.silent(COPY_TO_CLIPBOARD_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
5
+ //#endregion
6
+ export { COPY_TO_CLIPBOARD_COMMAND_KEY, CopyToClipboardCommand };
7
+
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/commands/copy-to-clipboard/index.ts"],"sourcesContent":["import { Command, passthrough } from \"@statewalker/shared-commands\";\n\nexport const COPY_TO_CLIPBOARD_COMMAND_KEY = \"platform:copy-to-clipboard\";\n\nexport interface CopyToClipboardPayload {\n text: string;\n}\n\nexport const CopyToClipboardCommand = Command.silent(COPY_TO_CLIPBOARD_COMMAND_KEY)\n .input(passthrough<CopyToClipboardPayload>())\n .output(passthrough<void>())\n .build();\n"],"mappings":";;AAEA,MAAa,gCAAgC;AAM7C,MAAa,yBAAyB,QAAQ,OAAO,6BAA6B,CAAC,CAChF,MAAM,YAAoC,CAAC,CAAC,CAC5C,OAAO,YAAkB,CAAC,CAAC,CAC3B,MAAM"}
@@ -0,0 +1,9 @@
1
+ //#region src/commands/download-blob/index.d.ts
2
+ export declare const DOWNLOAD_BLOB_COMMAND_KEY = "platform:download-blob";
3
+ export interface DownloadBlobPayload {
4
+ blob: Blob;
5
+ filename: string;
6
+ }
7
+ export declare const DownloadBlobCommand: import("@statewalker/shared-commands").CommandDeclaration<DownloadBlobPayload, void>;
8
+ //#endregion
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/commands/download-blob/index.ts"],"mappings":";qBAEa;iBAEI;EACf,MAAM;EACN;;qBAGW,4DAAmB,mBAAA"}
@@ -0,0 +1,8 @@
1
+ import { Command, passthrough } from "@statewalker/shared-commands";
2
+ //#region src/commands/download-blob/index.ts
3
+ const DOWNLOAD_BLOB_COMMAND_KEY = "platform:download-blob";
4
+ const DownloadBlobCommand = Command.silent(DOWNLOAD_BLOB_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
5
+ //#endregion
6
+ export { DOWNLOAD_BLOB_COMMAND_KEY, DownloadBlobCommand };
7
+
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/commands/download-blob/index.ts"],"sourcesContent":["import { Command, passthrough } from \"@statewalker/shared-commands\";\n\nexport const DOWNLOAD_BLOB_COMMAND_KEY = \"platform:download-blob\";\n\nexport interface DownloadBlobPayload {\n blob: Blob;\n filename: string;\n}\n\nexport const DownloadBlobCommand = Command.silent(DOWNLOAD_BLOB_COMMAND_KEY)\n .input(passthrough<DownloadBlobPayload>())\n .output(passthrough<void>())\n .build();\n"],"mappings":";;AAEA,MAAa,4BAA4B;AAOzC,MAAa,sBAAsB,QAAQ,OAAO,yBAAyB,CAAC,CACzE,MAAM,YAAiC,CAAC,CAAC,CACzC,OAAO,YAAkB,CAAC,CAAC,CAC3B,MAAM"}
@@ -0,0 +1,21 @@
1
+ import { FilesApi } from "@statewalker/webrun-files";
2
+ //#region src/commands/download-to-files/index.d.ts
3
+ export declare const DOWNLOAD_TO_FILES_COMMAND_KEY = "platform:download-to-files";
4
+ export interface DownloadProgress {
5
+ loaded: number;
6
+ total?: number;
7
+ }
8
+ export interface DownloadToFilesPayload {
9
+ url: string;
10
+ files: FilesApi;
11
+ path: string;
12
+ resume?: boolean;
13
+ onProgress?: (progress: DownloadProgress) => void;
14
+ signal?: AbortSignal;
15
+ }
16
+ export interface DownloadToFilesResult {
17
+ bytes: number;
18
+ }
19
+ export declare const DownloadToFilesCommand: import("@statewalker/shared-commands").CommandDeclaration<DownloadToFilesPayload, DownloadToFilesResult>;
20
+ //#endregion
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/commands/download-to-files/index.ts"],"mappings":";;qBAGa;iBAEI;EACf;EACA;;iBAGe;EACf;EACA,OAAO;EACP;EACA;EACA,cAAc,UAAU;EACxB,SAAS;;iBAGM;EACf;;qBAGW,+DAAsB,mBAAA,wBAAA"}
@@ -0,0 +1,8 @@
1
+ import { Command, passthrough } from "@statewalker/shared-commands";
2
+ //#region src/commands/download-to-files/index.ts
3
+ const DOWNLOAD_TO_FILES_COMMAND_KEY = "platform:download-to-files";
4
+ const DownloadToFilesCommand = Command.silent(DOWNLOAD_TO_FILES_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
5
+ //#endregion
6
+ export { DOWNLOAD_TO_FILES_COMMAND_KEY, DownloadToFilesCommand };
7
+
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/commands/download-to-files/index.ts"],"sourcesContent":["import { Command, passthrough } from \"@statewalker/shared-commands\";\nimport type { FilesApi } from \"@statewalker/webrun-files\";\n\nexport const DOWNLOAD_TO_FILES_COMMAND_KEY = \"platform:download-to-files\";\n\nexport interface DownloadProgress {\n loaded: number;\n total?: number;\n}\n\nexport interface DownloadToFilesPayload {\n url: string;\n files: FilesApi;\n path: string;\n resume?: boolean;\n onProgress?: (progress: DownloadProgress) => void;\n signal?: AbortSignal;\n}\n\nexport interface DownloadToFilesResult {\n bytes: number;\n}\n\nexport const DownloadToFilesCommand = Command.silent(DOWNLOAD_TO_FILES_COMMAND_KEY)\n .input(passthrough<DownloadToFilesPayload>())\n .output(passthrough<DownloadToFilesResult>())\n .build();\n"],"mappings":";;AAGA,MAAa,gCAAgC;AAoB7C,MAAa,yBAAyB,QAAQ,OAAO,6BAA6B,CAAC,CAChF,MAAM,YAAoC,CAAC,CAAC,CAC5C,OAAO,YAAmC,CAAC,CAAC,CAC5C,MAAM"}
@@ -0,0 +1,8 @@
1
+ import { COPY_TO_CLIPBOARD_COMMAND_KEY, CopyToClipboardCommand, CopyToClipboardPayload } from "./copy-to-clipboard/index.js";
2
+ import { DOWNLOAD_BLOB_COMMAND_KEY, DownloadBlobCommand, DownloadBlobPayload } from "./download-blob/index.js";
3
+ import { DOWNLOAD_TO_FILES_COMMAND_KEY, DownloadProgress, DownloadToFilesCommand, DownloadToFilesPayload, DownloadToFilesResult } from "./download-to-files/index.js";
4
+ import { PICK_DIRECTORY_COMMAND_KEY, PickDirectoryCommand, PickDirectoryPayload, PickDirectoryResult } from "./pick-directory/index.js";
5
+ import { PICK_FILE_COMMAND_KEY, PickFileCommand, PickFilePayload, PickFileResult } from "./pick-file/index.js";
6
+ import { PREFERENCE_GET_COMMAND_KEY, PreferenceGetCommand, PreferenceGetPayload, PreferenceGetResult } from "./preference-get/index.js";
7
+ import { PREFERENCE_SET_COMMAND_KEY, PreferenceSetCommand, PreferenceSetPayload } from "./preference-set/index.js";
8
+ export { COPY_TO_CLIPBOARD_COMMAND_KEY, CopyToClipboardCommand, CopyToClipboardPayload, DOWNLOAD_BLOB_COMMAND_KEY, DOWNLOAD_TO_FILES_COMMAND_KEY, DownloadBlobCommand, DownloadBlobPayload, DownloadProgress, DownloadToFilesCommand, DownloadToFilesPayload, DownloadToFilesResult, PICK_DIRECTORY_COMMAND_KEY, PICK_FILE_COMMAND_KEY, PREFERENCE_GET_COMMAND_KEY, PREFERENCE_SET_COMMAND_KEY, PickDirectoryCommand, PickDirectoryPayload, PickDirectoryResult, PickFileCommand, PickFilePayload, PickFileResult, PreferenceGetCommand, PreferenceGetPayload, PreferenceGetResult, PreferenceSetCommand, PreferenceSetPayload };
@@ -0,0 +1,13 @@
1
+ import { FilesApi } from "@statewalker/webrun-files";
2
+ //#region src/commands/pick-directory/index.d.ts
3
+ export declare const PICK_DIRECTORY_COMMAND_KEY = "platform:pick-directory";
4
+ export interface PickDirectoryPayload {
5
+ title?: string;
6
+ }
7
+ export interface PickDirectoryResult {
8
+ files: FilesApi;
9
+ label: string;
10
+ }
11
+ export declare const PickDirectoryCommand: import("@statewalker/shared-commands").CommandDeclaration<PickDirectoryPayload, PickDirectoryResult>;
12
+ //#endregion
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/commands/pick-directory/index.ts"],"mappings":";;qBAGa;iBAEI;EACf;;iBAGe;EACf,OAAO;EACP;;qBAGW,6DAAoB,mBAAA,sBAAA"}
@@ -0,0 +1,8 @@
1
+ import { Command, passthrough } from "@statewalker/shared-commands";
2
+ //#region src/commands/pick-directory/index.ts
3
+ const PICK_DIRECTORY_COMMAND_KEY = "platform:pick-directory";
4
+ const PickDirectoryCommand = Command.silent(PICK_DIRECTORY_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
5
+ //#endregion
6
+ export { PICK_DIRECTORY_COMMAND_KEY, PickDirectoryCommand };
7
+
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/commands/pick-directory/index.ts"],"sourcesContent":["import { Command, passthrough } from \"@statewalker/shared-commands\";\nimport type { FilesApi } from \"@statewalker/webrun-files\";\n\nexport const PICK_DIRECTORY_COMMAND_KEY = \"platform:pick-directory\";\n\nexport interface PickDirectoryPayload {\n title?: string;\n}\n\nexport interface PickDirectoryResult {\n files: FilesApi;\n label: string;\n}\n\nexport const PickDirectoryCommand = Command.silent(PICK_DIRECTORY_COMMAND_KEY)\n .input(passthrough<PickDirectoryPayload>())\n .output(passthrough<PickDirectoryResult>())\n .build();\n"],"mappings":";;AAGA,MAAa,6BAA6B;AAW1C,MAAa,uBAAuB,QAAQ,OAAO,0BAA0B,CAAC,CAC3E,MAAM,YAAkC,CAAC,CAAC,CAC1C,OAAO,YAAiC,CAAC,CAAC,CAC1C,MAAM"}
@@ -0,0 +1,14 @@
1
+ //#region src/commands/pick-file/index.d.ts
2
+ export declare const PICK_FILE_COMMAND_KEY = "platform:pick-file";
3
+ export interface PickFilePayload {
4
+ title?: string;
5
+ accept?: string[];
6
+ multiple?: boolean;
7
+ }
8
+ export interface PickFileResult {
9
+ blobs: Blob[];
10
+ names: string[];
11
+ }
12
+ export declare const PickFileCommand: import("@statewalker/shared-commands").CommandDeclaration<PickFilePayload, PickFileResult>;
13
+ //#endregion
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/commands/pick-file/index.ts"],"mappings":";qBAEa;iBAEI;EACf;EACA;EACA;;iBAGe;EACf,OAAO;EACP;;qBAGW,wDAAe,mBAAA,iBAAA"}
@@ -0,0 +1,8 @@
1
+ import { Command, passthrough } from "@statewalker/shared-commands";
2
+ //#region src/commands/pick-file/index.ts
3
+ const PICK_FILE_COMMAND_KEY = "platform:pick-file";
4
+ const PickFileCommand = Command.silent(PICK_FILE_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
5
+ //#endregion
6
+ export { PICK_FILE_COMMAND_KEY, PickFileCommand };
7
+
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/commands/pick-file/index.ts"],"sourcesContent":["import { Command, passthrough } from \"@statewalker/shared-commands\";\n\nexport const PICK_FILE_COMMAND_KEY = \"platform:pick-file\";\n\nexport interface PickFilePayload {\n title?: string;\n accept?: string[];\n multiple?: boolean;\n}\n\nexport interface PickFileResult {\n blobs: Blob[];\n names: string[];\n}\n\nexport const PickFileCommand = Command.silent(PICK_FILE_COMMAND_KEY)\n .input(passthrough<PickFilePayload>())\n .output(passthrough<PickFileResult>())\n .build();\n"],"mappings":";;AAEA,MAAa,wBAAwB;AAarC,MAAa,kBAAkB,QAAQ,OAAO,qBAAqB,CAAC,CACjE,MAAM,YAA6B,CAAC,CAAC,CACrC,OAAO,YAA4B,CAAC,CAAC,CACrC,MAAM"}
@@ -0,0 +1,11 @@
1
+ //#region src/commands/preference-get/index.d.ts
2
+ export declare const PREFERENCE_GET_COMMAND_KEY = "platform:preference-get";
3
+ export interface PreferenceGetPayload {
4
+ key: string;
5
+ }
6
+ export interface PreferenceGetResult {
7
+ value: unknown | undefined;
8
+ }
9
+ export declare const PreferenceGetCommand: import("@statewalker/shared-commands").CommandDeclaration<PreferenceGetPayload, PreferenceGetResult>;
10
+ //#endregion
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/commands/preference-get/index.ts"],"mappings":";qBAEa;iBAEI;EACf;;iBAGe;EACf;;qBAGW,6DAAoB,mBAAA,sBAAA"}
@@ -0,0 +1,8 @@
1
+ import { Command, passthrough } from "@statewalker/shared-commands";
2
+ //#region src/commands/preference-get/index.ts
3
+ const PREFERENCE_GET_COMMAND_KEY = "platform:preference-get";
4
+ const PreferenceGetCommand = Command.silent(PREFERENCE_GET_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
5
+ //#endregion
6
+ export { PREFERENCE_GET_COMMAND_KEY, PreferenceGetCommand };
7
+
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/commands/preference-get/index.ts"],"sourcesContent":["import { Command, passthrough } from \"@statewalker/shared-commands\";\n\nexport const PREFERENCE_GET_COMMAND_KEY = \"platform:preference-get\";\n\nexport interface PreferenceGetPayload {\n key: string;\n}\n\nexport interface PreferenceGetResult {\n value: unknown | undefined;\n}\n\nexport const PreferenceGetCommand = Command.silent(PREFERENCE_GET_COMMAND_KEY)\n .input(passthrough<PreferenceGetPayload>())\n .output(passthrough<PreferenceGetResult>())\n .build();\n"],"mappings":";;AAEA,MAAa,6BAA6B;AAU1C,MAAa,uBAAuB,QAAQ,OAAO,0BAA0B,CAAC,CAC3E,MAAM,YAAkC,CAAC,CAAC,CAC1C,OAAO,YAAiC,CAAC,CAAC,CAC1C,MAAM"}
@@ -0,0 +1,9 @@
1
+ //#region src/commands/preference-set/index.d.ts
2
+ export declare const PREFERENCE_SET_COMMAND_KEY = "platform:preference-set";
3
+ export interface PreferenceSetPayload {
4
+ key: string;
5
+ value: unknown;
6
+ }
7
+ export declare const PreferenceSetCommand: import("@statewalker/shared-commands").CommandDeclaration<PreferenceSetPayload, void>;
8
+ //#endregion
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/commands/preference-set/index.ts"],"mappings":";qBAEa;iBAEI;EACf;EACA;;qBAGW,6DAAoB,mBAAA"}
@@ -0,0 +1,8 @@
1
+ import { Command, passthrough } from "@statewalker/shared-commands";
2
+ //#region src/commands/preference-set/index.ts
3
+ const PREFERENCE_SET_COMMAND_KEY = "platform:preference-set";
4
+ const PreferenceSetCommand = Command.silent(PREFERENCE_SET_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
5
+ //#endregion
6
+ export { PREFERENCE_SET_COMMAND_KEY, PreferenceSetCommand };
7
+
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/commands/preference-set/index.ts"],"sourcesContent":["import { Command, passthrough } from \"@statewalker/shared-commands\";\n\nexport const PREFERENCE_SET_COMMAND_KEY = \"platform:preference-set\";\n\nexport interface PreferenceSetPayload {\n key: string;\n value: unknown;\n}\n\nexport const PreferenceSetCommand = Command.silent(PREFERENCE_SET_COMMAND_KEY)\n .input(passthrough<PreferenceSetPayload>())\n .output(passthrough<void>())\n .build();\n"],"mappings":";;AAEA,MAAa,6BAA6B;AAO1C,MAAa,uBAAuB,QAAQ,OAAO,0BAA0B,CAAC,CAC3E,MAAM,YAAkC,CAAC,CAAC,CAC1C,OAAO,YAAkB,CAAC,CAAC,CAC3B,MAAM"}
@@ -0,0 +1,16 @@
1
+ //#region src/errors.d.ts
2
+ /**
3
+ * Canonical signal that the user dismissed an interactive prompt (folder
4
+ * picker, dialog, file picker, etc.). Throwing this class — instead of a
5
+ * raw `DOMException` with `name === "AbortError"` or an ad-hoc string — lets
6
+ * every consumer distinguish cancellation from real failure with a single
7
+ * `instanceof` check.
8
+ */
9
+ export declare class UserCancelledError extends Error {
10
+ readonly name = "UserCancelledError";
11
+ constructor(message?: string);
12
+ }
13
+ /** Returns `true` if `err` is an instance of {@link UserCancelledError}. */
14
+ export declare function isUserCancelled(err: unknown): boolean;
15
+ //#endregion
16
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","names":[],"sources":["../src/errors.ts"],"mappings":";;;;;;;;qBAOa,2BAA2B;WAC7B;EAET,YAAY;;;wBAME,gBAAgB"}
package/dist/errors.js ADDED
@@ -0,0 +1,22 @@
1
+ //#region src/errors.ts
2
+ /**
3
+ * Canonical signal that the user dismissed an interactive prompt (folder
4
+ * picker, dialog, file picker, etc.). Throwing this class — instead of a
5
+ * raw `DOMException` with `name === "AbortError"` or an ad-hoc string — lets
6
+ * every consumer distinguish cancellation from real failure with a single
7
+ * `instanceof` check.
8
+ */
9
+ var UserCancelledError = class extends Error {
10
+ name = "UserCancelledError";
11
+ constructor(message = "User cancelled the operation") {
12
+ super(message);
13
+ }
14
+ };
15
+ /** Returns `true` if `err` is an instance of {@link UserCancelledError}. */
16
+ function isUserCancelled(err) {
17
+ return err instanceof UserCancelledError;
18
+ }
19
+ //#endregion
20
+ export { UserCancelledError, isUserCancelled };
21
+
22
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["/**\n * Canonical signal that the user dismissed an interactive prompt (folder\n * picker, dialog, file picker, etc.). Throwing this class — instead of a\n * raw `DOMException` with `name === \"AbortError\"` or an ad-hoc string — lets\n * every consumer distinguish cancellation from real failure with a single\n * `instanceof` check.\n */\nexport class UserCancelledError extends Error {\n readonly name = \"UserCancelledError\";\n\n constructor(message = \"User cancelled the operation\") {\n super(message);\n }\n}\n\n/** Returns `true` if `err` is an instance of {@link UserCancelledError}. */\nexport function isUserCancelled(err: unknown): boolean {\n return err instanceof UserCancelledError;\n}\n"],"mappings":";;;;;;;;AAOA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,OAAgB;CAEhB,YAAY,UAAU,gCAAgC;EACpD,MAAM,OAAO;CACf;AACF;;AAGA,SAAgB,gBAAgB,KAAuB;CACrD,OAAO,eAAe;AACxB"}
@@ -0,0 +1,12 @@
1
+ import { getCommands, removeCommands, setCommands } from "./adapters.js";
2
+ import { COPY_TO_CLIPBOARD_COMMAND_KEY, CopyToClipboardCommand, CopyToClipboardPayload } from "./commands/copy-to-clipboard/index.js";
3
+ import { DOWNLOAD_BLOB_COMMAND_KEY, DownloadBlobCommand, DownloadBlobPayload } from "./commands/download-blob/index.js";
4
+ import { DOWNLOAD_TO_FILES_COMMAND_KEY, DownloadProgress, DownloadToFilesCommand, DownloadToFilesPayload, DownloadToFilesResult } from "./commands/download-to-files/index.js";
5
+ import { PICK_DIRECTORY_COMMAND_KEY, PickDirectoryCommand, PickDirectoryPayload, PickDirectoryResult } from "./commands/pick-directory/index.js";
6
+ import { PICK_FILE_COMMAND_KEY, PickFileCommand, PickFilePayload, PickFileResult } from "./commands/pick-file/index.js";
7
+ import { PREFERENCE_GET_COMMAND_KEY, PreferenceGetCommand, PreferenceGetPayload, PreferenceGetResult } from "./commands/preference-get/index.js";
8
+ import { PREFERENCE_SET_COMMAND_KEY, PreferenceSetCommand, PreferenceSetPayload } from "./commands/preference-set/index.js";
9
+ import "./commands/index.js";
10
+ import { UserCancelledError, isUserCancelled } from "./errors.js";
11
+ import { Navigation, UrlSerializer, UrlState, getUrlStateView, removeUrlStateView, setUrlStateView } from "./url-state-view.js";
12
+ export { COPY_TO_CLIPBOARD_COMMAND_KEY, CopyToClipboardCommand, CopyToClipboardPayload, DOWNLOAD_BLOB_COMMAND_KEY, DOWNLOAD_TO_FILES_COMMAND_KEY, DownloadBlobCommand, DownloadBlobPayload, DownloadProgress, DownloadToFilesCommand, DownloadToFilesPayload, DownloadToFilesResult, Navigation, Navigation as UrlStateView, PICK_DIRECTORY_COMMAND_KEY, PICK_FILE_COMMAND_KEY, PREFERENCE_GET_COMMAND_KEY, PREFERENCE_SET_COMMAND_KEY, PickDirectoryCommand, PickDirectoryPayload, PickDirectoryResult, PickFileCommand, PickFilePayload, PickFileResult, PreferenceGetCommand, PreferenceGetPayload, PreferenceGetResult, PreferenceSetCommand, PreferenceSetPayload, UrlSerializer, UrlState, UserCancelledError, getCommands, getUrlStateView, isUserCancelled, removeCommands, removeUrlStateView, setCommands, setUrlStateView };
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import { getCommands, removeCommands, setCommands } from "./adapters.js";
2
+ import { COPY_TO_CLIPBOARD_COMMAND_KEY, CopyToClipboardCommand } from "./commands/copy-to-clipboard/index.js";
3
+ import { DOWNLOAD_BLOB_COMMAND_KEY, DownloadBlobCommand } from "./commands/download-blob/index.js";
4
+ import { DOWNLOAD_TO_FILES_COMMAND_KEY, DownloadToFilesCommand } from "./commands/download-to-files/index.js";
5
+ import { PICK_DIRECTORY_COMMAND_KEY, PickDirectoryCommand } from "./commands/pick-directory/index.js";
6
+ import { PICK_FILE_COMMAND_KEY, PickFileCommand } from "./commands/pick-file/index.js";
7
+ import { PREFERENCE_GET_COMMAND_KEY, PreferenceGetCommand } from "./commands/preference-get/index.js";
8
+ import { PREFERENCE_SET_COMMAND_KEY, PreferenceSetCommand } from "./commands/preference-set/index.js";
9
+ import { UserCancelledError, isUserCancelled } from "./errors.js";
10
+ import { Navigation, getUrlStateView, removeUrlStateView, setUrlStateView } from "./url-state-view.js";
11
+ export { COPY_TO_CLIPBOARD_COMMAND_KEY, CopyToClipboardCommand, DOWNLOAD_BLOB_COMMAND_KEY, DOWNLOAD_TO_FILES_COMMAND_KEY, DownloadBlobCommand, DownloadToFilesCommand, Navigation, Navigation as UrlStateView, PICK_DIRECTORY_COMMAND_KEY, PICK_FILE_COMMAND_KEY, PREFERENCE_GET_COMMAND_KEY, PREFERENCE_SET_COMMAND_KEY, PickDirectoryCommand, PickFileCommand, PreferenceGetCommand, PreferenceSetCommand, UserCancelledError, getCommands, getUrlStateView, isUserCancelled, removeCommands, removeUrlStateView, setCommands, setUrlStateView };
@@ -0,0 +1,46 @@
1
+ import { BaseClass } from "@statewalker/shared-baseclass";
2
+ //#region src/url-state-view.d.ts
3
+ /**
4
+ * Serialized URL state — what gets written to / read from the URL hash.
5
+ */
6
+ export interface UrlState {
7
+ path: string;
8
+ query: Record<string, string>;
9
+ }
10
+ /**
11
+ * A reversible mapping between application state and the URL.
12
+ * `serialize` builds an outgoing URL state from the in-memory model;
13
+ * `deserialize` applies an incoming URL state back onto the model.
14
+ */
15
+ export interface UrlSerializer {
16
+ serialize(state: UrlState): UrlState;
17
+ deserialize(state: UrlState): void;
18
+ }
19
+ /**
20
+ * Navigation token — workspace-scoped bidirectional URL ↔ model state
21
+ * synchronisation. Apps reach the workspace-scoped instance via
22
+ * `workspace.requireAdapter(Navigation)`. Models register
23
+ * `UrlSerializer`s; the browser binding (provided by
24
+ * `@statewalker/platform-browser`) flushes the serialized state to
25
+ * `location.hash` whenever `sync()` notifies, and feeds incoming
26
+ * `hashchange` events back to all deserializers via `applyUrl()`.
27
+ *
28
+ * A directional lock prevents feedback loops: at any moment sync flows
29
+ * in only one direction.
30
+ *
31
+ * Inlined into `platform-api` (was re-exported from `workbench-views`)
32
+ * so the substrate can retire the legacy package — see the
33
+ * `workbench-canonical-substrate` capability spec.
34
+ */
35
+ export declare class Navigation extends BaseClass {
36
+ #private;
37
+ register(serializer: UrlSerializer): () => void;
38
+ sync(): void;
39
+ buildState(): UrlState;
40
+ applyUrl(state: UrlState): void;
41
+ get isSyncing(): boolean;
42
+ }
43
+ export declare const getUrlStateView: (context: Record<string, unknown>, optional?: boolean) => Navigation, setUrlStateView: (context: Record<string, unknown>, value: Navigation) => void, removeUrlStateView: (context: Record<string, unknown>) => void;
44
+ //#endregion
45
+ export { Navigation as UrlStateView };
46
+ //# sourceMappingURL=url-state-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-state-view.d.ts","names":[],"sources":["../src/url-state-view.ts"],"mappings":";;;;;iBAMiB;EACf;EACA,OAAO;;;;;;;iBAQQ;EACf,UAAU,OAAO,WAAW;EAC5B,YAAY,OAAO;;;;;;;;;;;;;;;;;;qBAmBR,mBAAmB;;EAI9B,SAAS,YAAY;EAOrB;EAUA,cAAc;EAQd,SAAS,OAAO;MAYZ;;qBAOQ,kBAAe,SAAA,yBAAA,uBAAA,YAAE,kBAAe,SAAA,yBAAA,OAAA,qBAAE,qBAAkB,SAAA"}
@@ -0,0 +1,63 @@
1
+ import { newAdapter } from "@statewalker/shared-adapters";
2
+ import { BaseClass } from "@statewalker/shared-baseclass";
3
+ //#region src/url-state-view.ts
4
+ /**
5
+ * Navigation token — workspace-scoped bidirectional URL ↔ model state
6
+ * synchronisation. Apps reach the workspace-scoped instance via
7
+ * `workspace.requireAdapter(Navigation)`. Models register
8
+ * `UrlSerializer`s; the browser binding (provided by
9
+ * `@statewalker/platform-browser`) flushes the serialized state to
10
+ * `location.hash` whenever `sync()` notifies, and feeds incoming
11
+ * `hashchange` events back to all deserializers via `applyUrl()`.
12
+ *
13
+ * A directional lock prevents feedback loops: at any moment sync flows
14
+ * in only one direction.
15
+ *
16
+ * Inlined into `platform-api` (was re-exported from `workbench-views`)
17
+ * so the substrate can retire the legacy package — see the
18
+ * `workbench-canonical-substrate` capability spec.
19
+ */
20
+ var Navigation = class extends BaseClass {
21
+ #serializers = /* @__PURE__ */ new Set();
22
+ #syncing = false;
23
+ register(serializer) {
24
+ this.#serializers.add(serializer);
25
+ return () => {
26
+ this.#serializers.delete(serializer);
27
+ };
28
+ }
29
+ sync() {
30
+ if (this.#syncing) return;
31
+ this.#syncing = true;
32
+ try {
33
+ this.notify();
34
+ } finally {
35
+ this.#syncing = false;
36
+ }
37
+ }
38
+ buildState() {
39
+ let state = {
40
+ path: "",
41
+ query: {}
42
+ };
43
+ for (const s of this.#serializers) state = s.serialize(state);
44
+ return state;
45
+ }
46
+ applyUrl(state) {
47
+ if (this.#syncing) return;
48
+ this.#syncing = true;
49
+ try {
50
+ for (const s of this.#serializers) s.deserialize(state);
51
+ } finally {
52
+ this.#syncing = false;
53
+ }
54
+ }
55
+ get isSyncing() {
56
+ return this.#syncing;
57
+ }
58
+ };
59
+ const [getUrlStateView, setUrlStateView, removeUrlStateView] = newAdapter("model:url-state", () => new Navigation());
60
+ //#endregion
61
+ export { Navigation, Navigation as UrlStateView, getUrlStateView, removeUrlStateView, setUrlStateView };
62
+
63
+ //# sourceMappingURL=url-state-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-state-view.js","names":[],"sources":["../src/url-state-view.ts"],"sourcesContent":["import { newAdapter } from \"@statewalker/shared-adapters\";\nimport { BaseClass } from \"@statewalker/shared-baseclass\";\n\n/**\n * Serialized URL state — what gets written to / read from the URL hash.\n */\nexport interface UrlState {\n path: string;\n query: Record<string, string>;\n}\n\n/**\n * A reversible mapping between application state and the URL.\n * `serialize` builds an outgoing URL state from the in-memory model;\n * `deserialize` applies an incoming URL state back onto the model.\n */\nexport interface UrlSerializer {\n serialize(state: UrlState): UrlState;\n deserialize(state: UrlState): void;\n}\n\n/**\n * Navigation token — workspace-scoped bidirectional URL ↔ model state\n * synchronisation. Apps reach the workspace-scoped instance via\n * `workspace.requireAdapter(Navigation)`. Models register\n * `UrlSerializer`s; the browser binding (provided by\n * `@statewalker/platform-browser`) flushes the serialized state to\n * `location.hash` whenever `sync()` notifies, and feeds incoming\n * `hashchange` events back to all deserializers via `applyUrl()`.\n *\n * A directional lock prevents feedback loops: at any moment sync flows\n * in only one direction.\n *\n * Inlined into `platform-api` (was re-exported from `workbench-views`)\n * so the substrate can retire the legacy package — see the\n * `workbench-canonical-substrate` capability spec.\n */\nexport class Navigation extends BaseClass {\n #serializers: Set<UrlSerializer> = new Set();\n #syncing = false;\n\n register(serializer: UrlSerializer): () => void {\n this.#serializers.add(serializer);\n return () => {\n this.#serializers.delete(serializer);\n };\n }\n\n sync(): void {\n if (this.#syncing) return;\n this.#syncing = true;\n try {\n this.notify();\n } finally {\n this.#syncing = false;\n }\n }\n\n buildState(): UrlState {\n let state: UrlState = { path: \"\", query: {} };\n for (const s of this.#serializers) {\n state = s.serialize(state);\n }\n return state;\n }\n\n applyUrl(state: UrlState): void {\n if (this.#syncing) return;\n this.#syncing = true;\n try {\n for (const s of this.#serializers) {\n s.deserialize(state);\n }\n } finally {\n this.#syncing = false;\n }\n }\n\n get isSyncing(): boolean {\n return this.#syncing;\n }\n}\n\nexport { Navigation as UrlStateView };\n\nexport const [getUrlStateView, setUrlStateView, removeUrlStateView] = newAdapter<Navigation>(\n \"model:url-state\",\n () => new Navigation(),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,IAAa,aAAb,cAAgC,UAAU;CACxC,+BAAmC,IAAI,IAAI;CAC3C,WAAW;CAEX,SAAS,YAAuC;EAC9C,KAAK,aAAa,IAAI,UAAU;EAChC,aAAa;GACX,KAAK,aAAa,OAAO,UAAU;EACrC;CACF;CAEA,OAAa;EACX,IAAI,KAAK,UAAU;EACnB,KAAK,WAAW;EAChB,IAAI;GACF,KAAK,OAAO;EACd,UAAU;GACR,KAAK,WAAW;EAClB;CACF;CAEA,aAAuB;EACrB,IAAI,QAAkB;GAAE,MAAM;GAAI,OAAO,CAAC;EAAE;EAC5C,KAAK,MAAM,KAAK,KAAK,cACnB,QAAQ,EAAE,UAAU,KAAK;EAE3B,OAAO;CACT;CAEA,SAAS,OAAuB;EAC9B,IAAI,KAAK,UAAU;EACnB,KAAK,WAAW;EAChB,IAAI;GACF,KAAK,MAAM,KAAK,KAAK,cACnB,EAAE,YAAY,KAAK;EAEvB,UAAU;GACR,KAAK,WAAW;EAClB;CACF;CAEA,IAAI,YAAqB;EACvB,OAAO,KAAK;CACd;AACF;AAIA,MAAa,CAAC,iBAAiB,iBAAiB,sBAAsB,WACpE,yBACM,IAAI,WAAW,CACvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statewalker/platform.core",
3
- "version": "0.1.1",
3
+ "version": "0.5.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Platform-capability intent vocabulary shared by every application composed of statewalker-workbench fragments.",
@@ -15,7 +15,12 @@
15
15
  "url": "git+ssh://git@github.com/statewalker/statewalker-workbench.git"
16
16
  },
17
17
  "exports": {
18
- ".": "./src/index.ts"
18
+ ".": {
19
+ "source": "./src/index.ts",
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js",
22
+ "default": "./dist/index.js"
23
+ }
19
24
  },
20
25
  "files": [
21
26
  "dist",
@@ -25,14 +30,14 @@
25
30
  "@statewalker/shared-adapters": "^0.1.0",
26
31
  "@statewalker/shared-baseclass": "^0.1.0",
27
32
  "@statewalker/shared-commands": "^0.2.0",
28
- "@statewalker/webrun-files": "^0.7.0",
29
- "@statewalker/workspace.core": "0.1.1"
33
+ "@statewalker/webrun-files": "^0.10.0",
34
+ "@statewalker/workspace.core": "^0.5.1"
30
35
  },
31
36
  "devDependencies": {
32
37
  "rimraf": "^6.1.3",
33
- "tsdown": "^0.22.14",
38
+ "tsdown": "^0.23.0",
34
39
  "typescript": "^7.0.2",
35
- "vitest": "^4.1.10"
40
+ "vitest": "^5.0.3"
36
41
  },
37
42
  "sideEffects": false,
38
43
  "publishConfig": {
package/dist/index.d.mts DELETED
@@ -1,160 +0,0 @@
1
- import { Commands } from "@statewalker/shared-commands";
2
- import { BaseClass } from "@statewalker/shared-baseclass";
3
- import { FilesApi } from "@statewalker/webrun-files";
4
- //#region src/adapters.d.ts
5
- /**
6
- * Resolve the workspace-scoped `Commands` bus for the given context bag.
7
- * Delegates to `workspace.requireAdapter(Commands)`, which auto-instantiates
8
- * a single shared bus on first lookup so every fragment composed under the
9
- * same workspace dispatches through the same instance.
10
- */
11
- declare function getCommands(ctx: Record<string, unknown>): Commands;
12
- /**
13
- * @deprecated The commands bus is now workspace-scoped and auto-instantiated;
14
- * explicit registration is a no-op. Kept for one release so legacy bootstrap
15
- * code keeps compiling. Will be removed in a follow-up phase.
16
- */
17
- declare function setCommands(_ctx: Record<string, unknown>, _commands: Commands): void;
18
- /**
19
- * @deprecated The commands bus is now workspace-scoped and lifecycle-managed by
20
- * the workspace; explicit removal is a no-op. Kept for one release so legacy
21
- * teardown code keeps compiling. Will be removed in a follow-up phase.
22
- */
23
- declare function removeCommands(_ctx: Record<string, unknown>): void;
24
- //#endregion
25
- //#region src/commands/copy-to-clipboard/index.d.ts
26
- declare const COPY_TO_CLIPBOARD_COMMAND_KEY = "platform:copy-to-clipboard";
27
- interface CopyToClipboardPayload {
28
- text: string;
29
- }
30
- declare const CopyToClipboardCommand: import("@statewalker/shared-commands").CommandDeclaration<CopyToClipboardPayload, void>;
31
- //#endregion
32
- //#region src/commands/download-blob/index.d.ts
33
- declare const DOWNLOAD_BLOB_COMMAND_KEY = "platform:download-blob";
34
- interface DownloadBlobPayload {
35
- blob: Blob;
36
- filename: string;
37
- }
38
- declare const DownloadBlobCommand: import("@statewalker/shared-commands").CommandDeclaration<DownloadBlobPayload, void>;
39
- //#endregion
40
- //#region src/commands/download-to-files/index.d.ts
41
- declare const DOWNLOAD_TO_FILES_COMMAND_KEY = "platform:download-to-files";
42
- interface DownloadProgress {
43
- loaded: number;
44
- total?: number;
45
- }
46
- interface DownloadToFilesPayload {
47
- url: string;
48
- files: FilesApi;
49
- path: string;
50
- resume?: boolean;
51
- onProgress?: (progress: DownloadProgress) => void;
52
- signal?: AbortSignal;
53
- }
54
- interface DownloadToFilesResult {
55
- bytes: number;
56
- }
57
- declare const DownloadToFilesCommand: import("@statewalker/shared-commands").CommandDeclaration<DownloadToFilesPayload, DownloadToFilesResult>;
58
- //#endregion
59
- //#region src/commands/pick-directory/index.d.ts
60
- declare const PICK_DIRECTORY_COMMAND_KEY = "platform:pick-directory";
61
- interface PickDirectoryPayload {
62
- title?: string;
63
- }
64
- interface PickDirectoryResult {
65
- files: FilesApi;
66
- label: string;
67
- }
68
- declare const PickDirectoryCommand: import("@statewalker/shared-commands").CommandDeclaration<PickDirectoryPayload, PickDirectoryResult>;
69
- //#endregion
70
- //#region src/commands/pick-file/index.d.ts
71
- declare const PICK_FILE_COMMAND_KEY = "platform:pick-file";
72
- interface PickFilePayload {
73
- title?: string;
74
- accept?: string[];
75
- multiple?: boolean;
76
- }
77
- interface PickFileResult {
78
- blobs: Blob[];
79
- names: string[];
80
- }
81
- declare const PickFileCommand: import("@statewalker/shared-commands").CommandDeclaration<PickFilePayload, PickFileResult>;
82
- //#endregion
83
- //#region src/commands/preference-get/index.d.ts
84
- declare const PREFERENCE_GET_COMMAND_KEY = "platform:preference-get";
85
- interface PreferenceGetPayload {
86
- key: string;
87
- }
88
- interface PreferenceGetResult {
89
- value: unknown | undefined;
90
- }
91
- declare const PreferenceGetCommand: import("@statewalker/shared-commands").CommandDeclaration<PreferenceGetPayload, PreferenceGetResult>;
92
- //#endregion
93
- //#region src/commands/preference-set/index.d.ts
94
- declare const PREFERENCE_SET_COMMAND_KEY = "platform:preference-set";
95
- interface PreferenceSetPayload {
96
- key: string;
97
- value: unknown;
98
- }
99
- declare const PreferenceSetCommand: import("@statewalker/shared-commands").CommandDeclaration<PreferenceSetPayload, void>;
100
- //#endregion
101
- //#region src/errors.d.ts
102
- /**
103
- * Canonical signal that the user dismissed an interactive prompt (folder
104
- * picker, dialog, file picker, etc.). Throwing this class — instead of a
105
- * raw `DOMException` with `name === "AbortError"` or an ad-hoc string — lets
106
- * every consumer distinguish cancellation from real failure with a single
107
- * `instanceof` check.
108
- */
109
- declare class UserCancelledError extends Error {
110
- readonly name = "UserCancelledError";
111
- constructor(message?: string);
112
- }
113
- /** Returns `true` if `err` is an instance of {@link UserCancelledError}. */
114
- declare function isUserCancelled(err: unknown): boolean;
115
- //#endregion
116
- //#region src/url-state-view.d.ts
117
- /**
118
- * Serialized URL state — what gets written to / read from the URL hash.
119
- */
120
- interface UrlState {
121
- path: string;
122
- query: Record<string, string>;
123
- }
124
- /**
125
- * A reversible mapping between application state and the URL.
126
- * `serialize` builds an outgoing URL state from the in-memory model;
127
- * `deserialize` applies an incoming URL state back onto the model.
128
- */
129
- interface UrlSerializer {
130
- serialize(state: UrlState): UrlState;
131
- deserialize(state: UrlState): void;
132
- }
133
- /**
134
- * Navigation token — workspace-scoped bidirectional URL ↔ model state
135
- * synchronisation. Apps reach the workspace-scoped instance via
136
- * `workspace.requireAdapter(Navigation)`. Models register
137
- * `UrlSerializer`s; the browser binding (provided by
138
- * `@statewalker/platform-browser`) flushes the serialized state to
139
- * `location.hash` whenever `sync()` notifies, and feeds incoming
140
- * `hashchange` events back to all deserializers via `applyUrl()`.
141
- *
142
- * A directional lock prevents feedback loops: at any moment sync flows
143
- * in only one direction.
144
- *
145
- * Inlined into `platform-api` (was re-exported from `workbench-views`)
146
- * so the substrate can retire the legacy package — see the
147
- * `workbench-canonical-substrate` capability spec.
148
- */
149
- declare class Navigation extends BaseClass {
150
- #private;
151
- register(serializer: UrlSerializer): () => void;
152
- sync(): void;
153
- buildState(): UrlState;
154
- applyUrl(state: UrlState): void;
155
- get isSyncing(): boolean;
156
- }
157
- declare const getUrlStateView: (context: Record<string, unknown>, optional?: boolean) => Navigation, setUrlStateView: (context: Record<string, unknown>, value: Navigation) => void, removeUrlStateView: (context: Record<string, unknown>) => void;
158
- //#endregion
159
- export { COPY_TO_CLIPBOARD_COMMAND_KEY, CopyToClipboardCommand, CopyToClipboardPayload, DOWNLOAD_BLOB_COMMAND_KEY, DOWNLOAD_TO_FILES_COMMAND_KEY, DownloadBlobCommand, DownloadBlobPayload, DownloadProgress, DownloadToFilesCommand, DownloadToFilesPayload, DownloadToFilesResult, Navigation, Navigation as UrlStateView, PICK_DIRECTORY_COMMAND_KEY, PICK_FILE_COMMAND_KEY, PREFERENCE_GET_COMMAND_KEY, PREFERENCE_SET_COMMAND_KEY, PickDirectoryCommand, PickDirectoryPayload, PickDirectoryResult, PickFileCommand, PickFilePayload, PickFileResult, PreferenceGetCommand, PreferenceGetPayload, PreferenceGetResult, PreferenceSetCommand, PreferenceSetPayload, UrlSerializer, UrlState, UserCancelledError, getCommands, getUrlStateView, isUserCancelled, removeCommands, removeUrlStateView, setCommands, setUrlStateView };
160
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/adapters.ts","../src/commands/copy-to-clipboard/index.ts","../src/commands/download-blob/index.ts","../src/commands/download-to-files/index.ts","../src/commands/pick-directory/index.ts","../src/commands/pick-file/index.ts","../src/commands/preference-get/index.ts","../src/commands/preference-set/index.ts","../src/errors.ts","../src/url-state-view.ts"],"mappings":";;;;;;;;;;iBASgB,YAAY,KAAK,0BAA0B;;;;;;iBAS3C,YAAY,MAAM,yBAAyB,WAAW;;;;;;iBAWtD,eAAe,MAAM;;;cC3BxB;UAEI;EACf;;cAGW,+DAAsB,mBAAA;;;cCNtB;UAEI;EACf,MAAM;EACN;;cAGW,4DAAmB,mBAAA;;;cCNnB;UAEI;EACf;EACA;;UAGe;EACf;EACA,OAAO;EACP;EACA;EACA,cAAc,UAAU;EACxB,SAAS;;UAGM;EACf;;cAGW,+DAAsB,mBAAA,wBAAA;;;cCpBtB;UAEI;EACf;;UAGe;EACf,OAAO;EACP;;cAGW,6DAAoB,mBAAA,sBAAA;;;cCZpB;UAEI;EACf;EACA;EACA;;UAGe;EACf,OAAO;EACP;;cAGW,wDAAe,mBAAA,iBAAA;;;cCbf;UAEI;EACf;;UAGe;EACf;;cAGW,6DAAoB,mBAAA,sBAAA;;;cCVpB;UAEI;EACf;EACA;;cAGW,6DAAoB,mBAAA;;;;;;;;;;cCFpB,2BAA2B;WAC7B;EAET,YAAY;;;iBAME,gBAAgB;;;;;;UCVf;EACf;EACA,OAAO;;;;;;;UAQQ;EACf,UAAU,OAAO,WAAW;EAC5B,YAAY,OAAO;;;;;;;;;;;;;;;;;;cAmBR,mBAAmB;;EAI9B,SAAS,YAAY;EAOrB;EAUA,cAAc;EAQd,SAAS,OAAO;MAYZ;;cAOQ,kBAAe,SAAA,yBAAA,uBAAA,YAAE,kBAAe,SAAA,yBAAA,OAAA,qBAAE,qBAAkB,SAAA"}
package/dist/index.mjs DELETED
@@ -1,139 +0,0 @@
1
- import { Command, Commands, passthrough } from "@statewalker/shared-commands";
2
- import { getWorkspace } from "@statewalker/workspace.core";
3
- import { newAdapter } from "@statewalker/shared-adapters";
4
- import { BaseClass } from "@statewalker/shared-baseclass";
5
- //#region src/adapters.ts
6
- /**
7
- * Resolve the workspace-scoped `Commands` bus for the given context bag.
8
- * Delegates to `workspace.requireAdapter(Commands)`, which auto-instantiates
9
- * a single shared bus on first lookup so every fragment composed under the
10
- * same workspace dispatches through the same instance.
11
- */
12
- function getCommands(ctx) {
13
- return getWorkspace(ctx).requireAdapter(Commands);
14
- }
15
- /**
16
- * @deprecated The commands bus is now workspace-scoped and auto-instantiated;
17
- * explicit registration is a no-op. Kept for one release so legacy bootstrap
18
- * code keeps compiling. Will be removed in a follow-up phase.
19
- */
20
- function setCommands(_ctx, _commands) {
21
- console.warn("[platform-api] setCommands is deprecated and a no-op: the Commands bus is now workspace-bound and auto-instantiated via workspace.requireAdapter(Commands).");
22
- }
23
- /**
24
- * @deprecated The commands bus is now workspace-scoped and lifecycle-managed by
25
- * the workspace; explicit removal is a no-op. Kept for one release so legacy
26
- * teardown code keeps compiling. Will be removed in a follow-up phase.
27
- */
28
- function removeCommands(_ctx) {
29
- console.warn("[platform-api] removeCommands is deprecated and a no-op: the Commands bus lifecycle is owned by workspace.close().");
30
- }
31
- //#endregion
32
- //#region src/commands/copy-to-clipboard/index.ts
33
- const COPY_TO_CLIPBOARD_COMMAND_KEY = "platform:copy-to-clipboard";
34
- const CopyToClipboardCommand = Command.silent(COPY_TO_CLIPBOARD_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
35
- //#endregion
36
- //#region src/commands/download-blob/index.ts
37
- const DOWNLOAD_BLOB_COMMAND_KEY = "platform:download-blob";
38
- const DownloadBlobCommand = Command.silent(DOWNLOAD_BLOB_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
39
- //#endregion
40
- //#region src/commands/download-to-files/index.ts
41
- const DOWNLOAD_TO_FILES_COMMAND_KEY = "platform:download-to-files";
42
- const DownloadToFilesCommand = Command.silent(DOWNLOAD_TO_FILES_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
43
- //#endregion
44
- //#region src/commands/pick-directory/index.ts
45
- const PICK_DIRECTORY_COMMAND_KEY = "platform:pick-directory";
46
- const PickDirectoryCommand = Command.silent(PICK_DIRECTORY_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
47
- //#endregion
48
- //#region src/commands/pick-file/index.ts
49
- const PICK_FILE_COMMAND_KEY = "platform:pick-file";
50
- const PickFileCommand = Command.silent(PICK_FILE_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
51
- //#endregion
52
- //#region src/commands/preference-get/index.ts
53
- const PREFERENCE_GET_COMMAND_KEY = "platform:preference-get";
54
- const PreferenceGetCommand = Command.silent(PREFERENCE_GET_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
55
- //#endregion
56
- //#region src/commands/preference-set/index.ts
57
- const PREFERENCE_SET_COMMAND_KEY = "platform:preference-set";
58
- const PreferenceSetCommand = Command.silent(PREFERENCE_SET_COMMAND_KEY).input(passthrough()).output(passthrough()).build();
59
- //#endregion
60
- //#region src/errors.ts
61
- /**
62
- * Canonical signal that the user dismissed an interactive prompt (folder
63
- * picker, dialog, file picker, etc.). Throwing this class — instead of a
64
- * raw `DOMException` with `name === "AbortError"` or an ad-hoc string — lets
65
- * every consumer distinguish cancellation from real failure with a single
66
- * `instanceof` check.
67
- */
68
- var UserCancelledError = class extends Error {
69
- name = "UserCancelledError";
70
- constructor(message = "User cancelled the operation") {
71
- super(message);
72
- }
73
- };
74
- /** Returns `true` if `err` is an instance of {@link UserCancelledError}. */
75
- function isUserCancelled(err) {
76
- return err instanceof UserCancelledError;
77
- }
78
- //#endregion
79
- //#region src/url-state-view.ts
80
- /**
81
- * Navigation token — workspace-scoped bidirectional URL ↔ model state
82
- * synchronisation. Apps reach the workspace-scoped instance via
83
- * `workspace.requireAdapter(Navigation)`. Models register
84
- * `UrlSerializer`s; the browser binding (provided by
85
- * `@statewalker/platform-browser`) flushes the serialized state to
86
- * `location.hash` whenever `sync()` notifies, and feeds incoming
87
- * `hashchange` events back to all deserializers via `applyUrl()`.
88
- *
89
- * A directional lock prevents feedback loops: at any moment sync flows
90
- * in only one direction.
91
- *
92
- * Inlined into `platform-api` (was re-exported from `workbench-views`)
93
- * so the substrate can retire the legacy package — see the
94
- * `workbench-canonical-substrate` capability spec.
95
- */
96
- var Navigation = class extends BaseClass {
97
- #serializers = /* @__PURE__ */ new Set();
98
- #syncing = false;
99
- register(serializer) {
100
- this.#serializers.add(serializer);
101
- return () => {
102
- this.#serializers.delete(serializer);
103
- };
104
- }
105
- sync() {
106
- if (this.#syncing) return;
107
- this.#syncing = true;
108
- try {
109
- this.notify();
110
- } finally {
111
- this.#syncing = false;
112
- }
113
- }
114
- buildState() {
115
- let state = {
116
- path: "",
117
- query: {}
118
- };
119
- for (const s of this.#serializers) state = s.serialize(state);
120
- return state;
121
- }
122
- applyUrl(state) {
123
- if (this.#syncing) return;
124
- this.#syncing = true;
125
- try {
126
- for (const s of this.#serializers) s.deserialize(state);
127
- } finally {
128
- this.#syncing = false;
129
- }
130
- }
131
- get isSyncing() {
132
- return this.#syncing;
133
- }
134
- };
135
- const [getUrlStateView, setUrlStateView, removeUrlStateView] = newAdapter("model:url-state", () => new Navigation());
136
- //#endregion
137
- export { COPY_TO_CLIPBOARD_COMMAND_KEY, CopyToClipboardCommand, DOWNLOAD_BLOB_COMMAND_KEY, DOWNLOAD_TO_FILES_COMMAND_KEY, DownloadBlobCommand, DownloadToFilesCommand, Navigation, Navigation as UrlStateView, PICK_DIRECTORY_COMMAND_KEY, PICK_FILE_COMMAND_KEY, PREFERENCE_GET_COMMAND_KEY, PREFERENCE_SET_COMMAND_KEY, PickDirectoryCommand, PickFileCommand, PreferenceGetCommand, PreferenceSetCommand, UserCancelledError, getCommands, getUrlStateView, isUserCancelled, removeCommands, removeUrlStateView, setCommands, setUrlStateView };
138
-
139
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/adapters.ts","../src/commands/copy-to-clipboard/index.ts","../src/commands/download-blob/index.ts","../src/commands/download-to-files/index.ts","../src/commands/pick-directory/index.ts","../src/commands/pick-file/index.ts","../src/commands/preference-get/index.ts","../src/commands/preference-set/index.ts","../src/errors.ts","../src/url-state-view.ts"],"sourcesContent":["import { Commands } from \"@statewalker/shared-commands\";\nimport { getWorkspace } from \"@statewalker/workspace.core\";\n\n/**\n * Resolve the workspace-scoped `Commands` bus for the given context bag.\n * Delegates to `workspace.requireAdapter(Commands)`, which auto-instantiates\n * a single shared bus on first lookup so every fragment composed under the\n * same workspace dispatches through the same instance.\n */\nexport function getCommands(ctx: Record<string, unknown>): Commands {\n return getWorkspace(ctx).requireAdapter(Commands);\n}\n\n/**\n * @deprecated The commands bus is now workspace-scoped and auto-instantiated;\n * explicit registration is a no-op. Kept for one release so legacy bootstrap\n * code keeps compiling. Will be removed in a follow-up phase.\n */\nexport function setCommands(_ctx: Record<string, unknown>, _commands: Commands): void {\n console.warn(\n \"[platform-api] setCommands is deprecated and a no-op: the Commands bus is now workspace-bound and auto-instantiated via workspace.requireAdapter(Commands).\",\n );\n}\n\n/**\n * @deprecated The commands bus is now workspace-scoped and lifecycle-managed by\n * the workspace; explicit removal is a no-op. Kept for one release so legacy\n * teardown code keeps compiling. Will be removed in a follow-up phase.\n */\nexport function removeCommands(_ctx: Record<string, unknown>): void {\n console.warn(\n \"[platform-api] removeCommands is deprecated and a no-op: the Commands bus lifecycle is owned by workspace.close().\",\n );\n}\n","import { Command, passthrough } from \"@statewalker/shared-commands\";\n\nexport const COPY_TO_CLIPBOARD_COMMAND_KEY = \"platform:copy-to-clipboard\";\n\nexport interface CopyToClipboardPayload {\n text: string;\n}\n\nexport const CopyToClipboardCommand = Command.silent(COPY_TO_CLIPBOARD_COMMAND_KEY)\n .input(passthrough<CopyToClipboardPayload>())\n .output(passthrough<void>())\n .build();\n","import { Command, passthrough } from \"@statewalker/shared-commands\";\n\nexport const DOWNLOAD_BLOB_COMMAND_KEY = \"platform:download-blob\";\n\nexport interface DownloadBlobPayload {\n blob: Blob;\n filename: string;\n}\n\nexport const DownloadBlobCommand = Command.silent(DOWNLOAD_BLOB_COMMAND_KEY)\n .input(passthrough<DownloadBlobPayload>())\n .output(passthrough<void>())\n .build();\n","import { Command, passthrough } from \"@statewalker/shared-commands\";\nimport type { FilesApi } from \"@statewalker/webrun-files\";\n\nexport const DOWNLOAD_TO_FILES_COMMAND_KEY = \"platform:download-to-files\";\n\nexport interface DownloadProgress {\n loaded: number;\n total?: number;\n}\n\nexport interface DownloadToFilesPayload {\n url: string;\n files: FilesApi;\n path: string;\n resume?: boolean;\n onProgress?: (progress: DownloadProgress) => void;\n signal?: AbortSignal;\n}\n\nexport interface DownloadToFilesResult {\n bytes: number;\n}\n\nexport const DownloadToFilesCommand = Command.silent(DOWNLOAD_TO_FILES_COMMAND_KEY)\n .input(passthrough<DownloadToFilesPayload>())\n .output(passthrough<DownloadToFilesResult>())\n .build();\n","import { Command, passthrough } from \"@statewalker/shared-commands\";\nimport type { FilesApi } from \"@statewalker/webrun-files\";\n\nexport const PICK_DIRECTORY_COMMAND_KEY = \"platform:pick-directory\";\n\nexport interface PickDirectoryPayload {\n title?: string;\n}\n\nexport interface PickDirectoryResult {\n files: FilesApi;\n label: string;\n}\n\nexport const PickDirectoryCommand = Command.silent(PICK_DIRECTORY_COMMAND_KEY)\n .input(passthrough<PickDirectoryPayload>())\n .output(passthrough<PickDirectoryResult>())\n .build();\n","import { Command, passthrough } from \"@statewalker/shared-commands\";\n\nexport const PICK_FILE_COMMAND_KEY = \"platform:pick-file\";\n\nexport interface PickFilePayload {\n title?: string;\n accept?: string[];\n multiple?: boolean;\n}\n\nexport interface PickFileResult {\n blobs: Blob[];\n names: string[];\n}\n\nexport const PickFileCommand = Command.silent(PICK_FILE_COMMAND_KEY)\n .input(passthrough<PickFilePayload>())\n .output(passthrough<PickFileResult>())\n .build();\n","import { Command, passthrough } from \"@statewalker/shared-commands\";\n\nexport const PREFERENCE_GET_COMMAND_KEY = \"platform:preference-get\";\n\nexport interface PreferenceGetPayload {\n key: string;\n}\n\nexport interface PreferenceGetResult {\n value: unknown | undefined;\n}\n\nexport const PreferenceGetCommand = Command.silent(PREFERENCE_GET_COMMAND_KEY)\n .input(passthrough<PreferenceGetPayload>())\n .output(passthrough<PreferenceGetResult>())\n .build();\n","import { Command, passthrough } from \"@statewalker/shared-commands\";\n\nexport const PREFERENCE_SET_COMMAND_KEY = \"platform:preference-set\";\n\nexport interface PreferenceSetPayload {\n key: string;\n value: unknown;\n}\n\nexport const PreferenceSetCommand = Command.silent(PREFERENCE_SET_COMMAND_KEY)\n .input(passthrough<PreferenceSetPayload>())\n .output(passthrough<void>())\n .build();\n","/**\n * Canonical signal that the user dismissed an interactive prompt (folder\n * picker, dialog, file picker, etc.). Throwing this class — instead of a\n * raw `DOMException` with `name === \"AbortError\"` or an ad-hoc string — lets\n * every consumer distinguish cancellation from real failure with a single\n * `instanceof` check.\n */\nexport class UserCancelledError extends Error {\n readonly name = \"UserCancelledError\";\n\n constructor(message = \"User cancelled the operation\") {\n super(message);\n }\n}\n\n/** Returns `true` if `err` is an instance of {@link UserCancelledError}. */\nexport function isUserCancelled(err: unknown): boolean {\n return err instanceof UserCancelledError;\n}\n","import { newAdapter } from \"@statewalker/shared-adapters\";\nimport { BaseClass } from \"@statewalker/shared-baseclass\";\n\n/**\n * Serialized URL state — what gets written to / read from the URL hash.\n */\nexport interface UrlState {\n path: string;\n query: Record<string, string>;\n}\n\n/**\n * A reversible mapping between application state and the URL.\n * `serialize` builds an outgoing URL state from the in-memory model;\n * `deserialize` applies an incoming URL state back onto the model.\n */\nexport interface UrlSerializer {\n serialize(state: UrlState): UrlState;\n deserialize(state: UrlState): void;\n}\n\n/**\n * Navigation token — workspace-scoped bidirectional URL ↔ model state\n * synchronisation. Apps reach the workspace-scoped instance via\n * `workspace.requireAdapter(Navigation)`. Models register\n * `UrlSerializer`s; the browser binding (provided by\n * `@statewalker/platform-browser`) flushes the serialized state to\n * `location.hash` whenever `sync()` notifies, and feeds incoming\n * `hashchange` events back to all deserializers via `applyUrl()`.\n *\n * A directional lock prevents feedback loops: at any moment sync flows\n * in only one direction.\n *\n * Inlined into `platform-api` (was re-exported from `workbench-views`)\n * so the substrate can retire the legacy package — see the\n * `workbench-canonical-substrate` capability spec.\n */\nexport class Navigation extends BaseClass {\n #serializers: Set<UrlSerializer> = new Set();\n #syncing = false;\n\n register(serializer: UrlSerializer): () => void {\n this.#serializers.add(serializer);\n return () => {\n this.#serializers.delete(serializer);\n };\n }\n\n sync(): void {\n if (this.#syncing) return;\n this.#syncing = true;\n try {\n this.notify();\n } finally {\n this.#syncing = false;\n }\n }\n\n buildState(): UrlState {\n let state: UrlState = { path: \"\", query: {} };\n for (const s of this.#serializers) {\n state = s.serialize(state);\n }\n return state;\n }\n\n applyUrl(state: UrlState): void {\n if (this.#syncing) return;\n this.#syncing = true;\n try {\n for (const s of this.#serializers) {\n s.deserialize(state);\n }\n } finally {\n this.#syncing = false;\n }\n }\n\n get isSyncing(): boolean {\n return this.#syncing;\n }\n}\n\nexport { Navigation as UrlStateView };\n\nexport const [getUrlStateView, setUrlStateView, removeUrlStateView] = newAdapter<Navigation>(\n \"model:url-state\",\n () => new Navigation(),\n);\n"],"mappings":";;;;;;;;;;;AASA,SAAgB,YAAY,KAAwC;CAClE,OAAO,aAAa,GAAG,CAAC,CAAC,eAAe,QAAQ;AAClD;;;;;;AAOA,SAAgB,YAAY,MAA+B,WAA2B;CACpF,QAAQ,KACN,6JACF;AACF;;;;;;AAOA,SAAgB,eAAe,MAAqC;CAClE,QAAQ,KACN,oHACF;AACF;;;AC/BA,MAAa,gCAAgC;AAM7C,MAAa,yBAAyB,QAAQ,OAAO,6BAA6B,CAAC,CAChF,MAAM,YAAoC,CAAC,CAAC,CAC5C,OAAO,YAAkB,CAAC,CAAC,CAC3B,MAAM;;;ACTT,MAAa,4BAA4B;AAOzC,MAAa,sBAAsB,QAAQ,OAAO,yBAAyB,CAAC,CACzE,MAAM,YAAiC,CAAC,CAAC,CACzC,OAAO,YAAkB,CAAC,CAAC,CAC3B,MAAM;;;ACTT,MAAa,gCAAgC;AAoB7C,MAAa,yBAAyB,QAAQ,OAAO,6BAA6B,CAAC,CAChF,MAAM,YAAoC,CAAC,CAAC,CAC5C,OAAO,YAAmC,CAAC,CAAC,CAC5C,MAAM;;;ACvBT,MAAa,6BAA6B;AAW1C,MAAa,uBAAuB,QAAQ,OAAO,0BAA0B,CAAC,CAC3E,MAAM,YAAkC,CAAC,CAAC,CAC1C,OAAO,YAAiC,CAAC,CAAC,CAC1C,MAAM;;;ACfT,MAAa,wBAAwB;AAarC,MAAa,kBAAkB,QAAQ,OAAO,qBAAqB,CAAC,CACjE,MAAM,YAA6B,CAAC,CAAC,CACrC,OAAO,YAA4B,CAAC,CAAC,CACrC,MAAM;;;AChBT,MAAa,6BAA6B;AAU1C,MAAa,uBAAuB,QAAQ,OAAO,0BAA0B,CAAC,CAC3E,MAAM,YAAkC,CAAC,CAAC,CAC1C,OAAO,YAAiC,CAAC,CAAC,CAC1C,MAAM;;;ACbT,MAAa,6BAA6B;AAO1C,MAAa,uBAAuB,QAAQ,OAAO,0BAA0B,CAAC,CAC3E,MAAM,YAAkC,CAAC,CAAC,CAC1C,OAAO,YAAkB,CAAC,CAAC,CAC3B,MAAM;;;;;;;;;;ACLT,IAAa,qBAAb,cAAwC,MAAM;CAC5C,OAAgB;CAEhB,YAAY,UAAU,gCAAgC;EACpD,MAAM,OAAO;CACf;AACF;;AAGA,SAAgB,gBAAgB,KAAuB;CACrD,OAAO,eAAe;AACxB;;;;;;;;;;;;;;;;;;;ACmBA,IAAa,aAAb,cAAgC,UAAU;CACxC,+BAAmC,IAAI,IAAI;CAC3C,WAAW;CAEX,SAAS,YAAuC;EAC9C,KAAK,aAAa,IAAI,UAAU;EAChC,aAAa;GACX,KAAK,aAAa,OAAO,UAAU;EACrC;CACF;CAEA,OAAa;EACX,IAAI,KAAK,UAAU;EACnB,KAAK,WAAW;EAChB,IAAI;GACF,KAAK,OAAO;EACd,UAAU;GACR,KAAK,WAAW;EAClB;CACF;CAEA,aAAuB;EACrB,IAAI,QAAkB;GAAE,MAAM;GAAI,OAAO,CAAC;EAAE;EAC5C,KAAK,MAAM,KAAK,KAAK,cACnB,QAAQ,EAAE,UAAU,KAAK;EAE3B,OAAO;CACT;CAEA,SAAS,OAAuB;EAC9B,IAAI,KAAK,UAAU;EACnB,KAAK,WAAW;EAChB,IAAI;GACF,KAAK,MAAM,KAAK,KAAK,cACnB,EAAE,YAAY,KAAK;EAEvB,UAAU;GACR,KAAK,WAAW;EAClB;CACF;CAEA,IAAI,YAAqB;EACvB,OAAO,KAAK;CACd;AACF;AAIA,MAAa,CAAC,iBAAiB,iBAAiB,sBAAsB,WACpE,yBACM,IAAI,WAAW,CACvB"}