@konitif/workbench-runtime 0.284.4 → 0.284.6

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/README.md CHANGED
@@ -20,7 +20,7 @@ npm install @konitif/workbench-runtime
20
20
  ## Authority boundary
21
21
 
22
22
  This package adapts Workbench authorities; it does not redefine workspace
23
- semantics or own product tools, widgets, Viewers or policies. Supplied providers
23
+ semantics or own hosted tools, widgets, Viewers or domain policies. Supplied providers
24
24
  remain owned by their hosts. Runtime disposal removes subscriptions but does not
25
25
  implicitly flush persistence or close shared native resources.
26
26
 
package/dist/index.d.ts CHANGED
@@ -10,3 +10,4 @@ export * from "./workbench/workbenchToolRuntimeActions.js";
10
10
  export * from "./workbench/workspaceHistoryController.js";
11
11
  export * from "./workbench/workspaceSyncController.js";
12
12
  export type { WorkbenchHostEvents, WorkbenchHostEventHandlers, WorkbenchHostStorageChange } from "./workbench/workbenchHostEvents.js";
13
+ export * from "./workbench/experienceTabLink.js";
package/dist/index.js CHANGED
@@ -9,3 +9,4 @@ export * from "./workbench/workbenchShellActions.js";
9
9
  export * from "./workbench/workbenchToolRuntimeActions.js";
10
10
  export * from "./workbench/workspaceHistoryController.js";
11
11
  export * from "./workbench/workspaceSyncController.js";
12
+ export * from "./workbench/experienceTabLink.js";
@@ -0,0 +1,14 @@
1
+ export declare function experienceTabHref(base: string, id: string, screen?: string): string;
2
+ export declare function requestedExperienceFromUrl(base: string): string | null;
3
+ export declare function requestedExperienceScreenFromUrl(base: string, experienceId: string): string | null;
4
+ export interface ExperienceScreenNavigationPort {
5
+ readHref(): string;
6
+ pushHref(href: string): void;
7
+ activate(screenId: string): boolean;
8
+ }
9
+ /** Bind screen navigation to an experience after its workspace has been restored. */
10
+ export declare function createExperienceScreenNavigation(experienceId: string, primaryScreenId: string, port: ExperienceScreenNavigationPort): {
11
+ href: (screenId: string) => string;
12
+ select(screenId: string): boolean;
13
+ restore(): boolean;
14
+ };
@@ -0,0 +1,52 @@
1
+ const valid = (id) => /^experience\.[a-zA-Z0-9._-]{1,140}$/.test(id);
2
+ const validScreen = (id) => /^[a-z0-9][a-z0-9-]{0,79}$/.test(id);
3
+ export function experienceTabHref(base, id, screen) {
4
+ if (!valid(id))
5
+ throw Error('Référence d’expérience invalide.');
6
+ if (screen !== undefined && !validScreen(screen))
7
+ throw Error('Référence d’écran invalide.');
8
+ const url = new URL(base);
9
+ if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password)
10
+ throw Error('Adresse Workbench invalide.');
11
+ url.searchParams.set('experience', id);
12
+ if (screen)
13
+ url.searchParams.set('screen', screen);
14
+ else
15
+ url.searchParams.delete('screen');
16
+ url.hash = '';
17
+ return url.href;
18
+ }
19
+ export function requestedExperienceFromUrl(base) {
20
+ const id = new URL(base).searchParams.get('experience');
21
+ return id && valid(id) ? id : null;
22
+ }
23
+ export function requestedExperienceScreenFromUrl(base, experienceId) {
24
+ const url = new URL(base);
25
+ const screen = url.searchParams.get('screen');
26
+ return url.searchParams.get('experience') === experienceId && screen && validScreen(screen) ? screen : null;
27
+ }
28
+ /** Bind screen navigation to an experience after its workspace has been restored. */
29
+ export function createExperienceScreenNavigation(experienceId, primaryScreenId, port) {
30
+ function href(screenId) {
31
+ return experienceTabHref(port.readHref(), experienceId, screenId);
32
+ }
33
+ return {
34
+ href,
35
+ select(screenId) {
36
+ if (!validScreen(screenId))
37
+ return false;
38
+ const destination = href(screenId);
39
+ if (!port.activate(screenId))
40
+ return false;
41
+ if (destination !== port.readHref())
42
+ port.pushHref(destination);
43
+ return true;
44
+ },
45
+ restore() {
46
+ const requested = requestedExperienceScreenFromUrl(port.readHref(), experienceId);
47
+ if (requested && port.activate(requested))
48
+ return true;
49
+ return port.activate(primaryScreenId);
50
+ }
51
+ };
52
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@konitif/workbench-runtime",
3
3
  "license": "PolyForm-Noncommercial-1.0.0",
4
- "version": "0.284.4",
4
+ "version": "0.284.6",
5
5
  "description": "Reactive Svelte host adapter for KONITIF Workbench contracts with explicit runtime ports.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -42,7 +42,7 @@
42
42
  "verify:package": "node scripts/verify-package.mjs"
43
43
  },
44
44
  "dependencies": {
45
- "@konitif/workbench": "0.285.2",
45
+ "@konitif/workbench": "0.285.16",
46
46
  "svelte": "^4.2.18"
47
47
  },
48
48
  "devDependencies": {
@@ -22,7 +22,8 @@
22
22
  ],
23
23
  "sources": [
24
24
  "createWorkbenchStore.ts",
25
- "createWorkspaceModeController.ts"
25
+ "createWorkspaceModeController.ts",
26
+ "createCoherentWorkbenchStore.ts"
26
27
  ]
27
28
  },
28
29
  {
@@ -70,7 +71,13 @@
70
71
  "workbenchShellPersistence.ts",
71
72
  "workbenchFocusPersistence.ts",
72
73
  "workspaceHistoryController.ts",
73
- "workspaceSyncController.ts"
74
+ "workspaceSyncController.ts",
75
+ "coherentWorkbenchPersistence.ts"
76
+ ],
77
+ "symbolNames": [
78
+ "WorkbenchHostEventHandlers",
79
+ "WorkbenchHostEvents",
80
+ "WorkbenchHostStorageChange"
74
81
  ]
75
82
  }
76
83
  ]
@@ -63,7 +63,7 @@
63
63
  "to": "resume"
64
64
  }
65
65
  ],
66
- "caption": "The Workbench runtime coordinates hosted domains without inventing their product meaning."
66
+ "caption": "The Workbench runtime coordinates hosted domains without inventing their meaning."
67
67
  }
68
68
  ]
69
69
  }