@astrale-os/shell-react 0.2.8 → 0.2.10-beta.2
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/application/apps/app-host.d.ts +7 -15
- package/dist/application/apps/app-host.d.ts.map +1 -1
- package/dist/application/apps/app-host.js +3 -2
- package/dist/application/apps/apps.hook.d.ts +7 -4
- package/dist/application/apps/apps.hook.d.ts.map +1 -1
- package/dist/application/apps/apps.hook.js +10 -2
- package/dist/application/apps/domains.hook.d.ts +1 -1
- package/dist/application/apps/domains.hook.d.ts.map +1 -1
- package/dist/application/apps/domains.hook.js +1 -1
- package/dist/application/apps/open-app.hook.d.ts +2 -3
- package/dist/application/apps/open-app.hook.d.ts.map +1 -1
- package/dist/application/index.d.ts +2 -4
- package/dist/application/index.d.ts.map +1 -1
- package/dist/application/index.js +2 -3
- package/dist/application/spaces/space.hook.d.ts +2 -2
- package/dist/application/spaces/space.hook.d.ts.map +1 -1
- package/dist/application/spaces/space.hook.js +2 -2
- package/dist/application/spaces/spaces.hook.d.ts +2 -3
- package/dist/application/spaces/spaces.hook.d.ts.map +1 -1
- package/dist/application/spaces/spaces.hook.js +10 -3
- package/dist/auth/act-as.context.d.ts +15 -32
- package/dist/auth/act-as.context.d.ts.map +1 -1
- package/dist/auth/act-as.context.js +22 -66
- package/dist/auth/auth.hook.d.ts +1 -0
- package/dist/auth/auth.hook.d.ts.map +1 -1
- package/dist/auth/auth.hook.js +2 -22
- package/dist/auth/can.hook.d.ts +10 -38
- package/dist/auth/can.hook.d.ts.map +1 -1
- package/dist/auth/can.hook.js +35 -110
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/self.hook.d.ts +2 -2
- package/dist/auth/self.hook.d.ts.map +1 -1
- package/dist/auth/self.hook.js +0 -7
- package/dist/auth/session-kernel.d.ts +2 -3
- package/dist/auth/session-kernel.d.ts.map +1 -1
- package/dist/auth/session-kernel.js +4 -13
- package/dist/components/boundaries.d.ts +47 -0
- package/dist/components/boundaries.d.ts.map +1 -0
- package/dist/components/boundaries.js +55 -0
- package/dist/components/can.d.ts +11 -0
- package/dist/components/can.d.ts.map +1 -0
- package/dist/components/can.js +5 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +4 -0
- package/dist/components/mount-domain-frontend.d.ts +22 -0
- package/dist/components/mount-domain-frontend.d.ts.map +1 -0
- package/dist/components/mount-domain-frontend.js +85 -0
- package/dist/components/view-app.d.ts +16 -0
- package/dist/components/view-app.d.ts.map +1 -0
- package/dist/components/view-app.js +16 -0
- package/dist/graph/call/call.hook.d.ts +8 -18
- package/dist/graph/call/call.hook.d.ts.map +1 -1
- package/dist/graph/call/call.hook.js +7 -13
- package/dist/graph/call/stream.hook.d.ts +12 -20
- package/dist/graph/call/stream.hook.d.ts.map +1 -1
- package/dist/graph/call/stream.hook.js +55 -111
- package/dist/graph/graph.context.d.ts +4 -3
- package/dist/graph/graph.context.d.ts.map +1 -1
- package/dist/graph/graph.context.js +2 -8
- package/dist/graph/guards.error.d.ts +7 -8
- package/dist/graph/guards.error.d.ts.map +1 -1
- package/dist/graph/guards.error.js +11 -7
- package/dist/graph/index.d.ts +8 -16
- package/dist/graph/index.d.ts.map +1 -1
- package/dist/graph/index.js +3 -7
- package/dist/graph/memory/read/envelope.d.ts +22 -54
- package/dist/graph/memory/read/envelope.d.ts.map +1 -1
- package/dist/graph/memory/read/envelope.js +26 -20
- package/dist/graph/memory/read/idle.d.ts +1 -15
- package/dist/graph/memory/read/idle.d.ts.map +1 -1
- package/dist/graph/memory/read/idle.js +4 -13
- package/dist/graph/query-definition.hook.d.ts +11 -0
- package/dist/graph/query-definition.hook.d.ts.map +1 -0
- package/dist/graph/query-definition.hook.js +205 -0
- package/dist/graph/resource.d.ts +34 -0
- package/dist/graph/resource.d.ts.map +1 -0
- package/dist/graph/resource.js +244 -0
- package/dist/graph/store.d.ts +25 -0
- package/dist/graph/store.d.ts.map +1 -0
- package/dist/graph/store.js +69 -0
- package/dist/host/actions.hook.d.ts +34 -0
- package/dist/host/actions.hook.d.ts.map +1 -0
- package/dist/host/actions.hook.js +125 -0
- package/dist/host/components.d.ts +15 -0
- package/dist/host/components.d.ts.map +1 -0
- package/dist/host/components.js +14 -0
- package/dist/host/index.d.ts +5 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +3 -0
- package/dist/index.d.ts +26 -37
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -31
- package/dist/intents/envelope.d.ts +7 -19
- package/dist/intents/envelope.d.ts.map +1 -1
- package/dist/intents/envelope.js +2 -3
- package/dist/intents/send-intent.hook.d.ts +5 -7
- package/dist/intents/send-intent.hook.d.ts.map +1 -1
- package/dist/intents/send-intent.hook.js +17 -75
- package/dist/navigation/adapters/adapter.d.ts +5 -0
- package/dist/navigation/adapters/adapter.d.ts.map +1 -1
- package/dist/navigation/adapters/memory.adapter.d.ts.map +1 -1
- package/dist/navigation/adapters/memory.adapter.js +4 -0
- package/dist/navigation/adapters/url.adapter.d.ts.map +1 -1
- package/dist/navigation/adapters/url.adapter.js +57 -10
- package/dist/navigation/codec.d.ts +60 -0
- package/dist/navigation/codec.d.ts.map +1 -0
- package/dist/navigation/codec.js +121 -0
- package/dist/navigation/history.d.ts +11 -9
- package/dist/navigation/history.d.ts.map +1 -1
- package/dist/navigation/history.js +6 -8
- package/dist/navigation/hooks/ancestors.hook.d.ts +5 -7
- package/dist/navigation/hooks/ancestors.hook.d.ts.map +1 -1
- package/dist/navigation/hooks/ancestors.hook.js +7 -51
- package/dist/navigation/hooks/location.hook.d.ts.map +1 -1
- package/dist/navigation/hooks/location.hook.js +4 -6
- package/dist/navigation/hooks/scope.hook.d.ts.map +1 -1
- package/dist/navigation/hooks/scope.hook.js +4 -6
- package/dist/navigation/index.d.ts +4 -2
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +2 -1
- package/dist/navigation/link.d.ts +12 -0
- package/dist/navigation/link.d.ts.map +1 -1
- package/dist/navigation/link.js +13 -2
- package/dist/navigation/location.d.ts +13 -40
- package/dist/navigation/location.d.ts.map +1 -1
- package/dist/navigation/location.js +14 -76
- package/dist/navigation/scope.context.d.ts +17 -26
- package/dist/navigation/scope.context.d.ts.map +1 -1
- package/dist/navigation/scope.context.js +140 -108
- package/dist/navigation/snapshot.d.ts +14 -19
- package/dist/navigation/snapshot.d.ts.map +1 -1
- package/dist/navigation/snapshot.js +48 -44
- package/dist/schema/action.hook.d.ts +44 -0
- package/dist/schema/action.hook.d.ts.map +1 -0
- package/dist/schema/action.hook.js +72 -0
- package/dist/schema/domain.hook.d.ts +12 -7
- package/dist/schema/domain.hook.d.ts.map +1 -1
- package/dist/schema/domain.hook.js +101 -4
- package/dist/schema/index.d.ts +9 -8
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +5 -7
- package/dist/schema/kernel.hook.d.ts +4 -9
- package/dist/schema/kernel.hook.d.ts.map +1 -1
- package/dist/schema/kernel.hook.js +4 -6
- package/dist/schema/mutation.hook.d.ts +9 -0
- package/dist/schema/mutation.hook.d.ts.map +1 -0
- package/dist/schema/mutation.hook.js +41 -0
- package/dist/schema/object.hook.d.ts +16 -0
- package/dist/schema/object.hook.d.ts.map +1 -0
- package/dist/schema/object.hook.js +46 -0
- package/dist/schema/relation.hook.d.ts +46 -0
- package/dist/schema/relation.hook.d.ts.map +1 -0
- package/dist/schema/relation.hook.js +136 -0
- package/dist/selection/live.d.ts +9 -17
- package/dist/selection/live.d.ts.map +1 -1
- package/dist/selection/live.js +65 -112
- package/dist/selection/scope.context.js +5 -4
- package/dist/session/boot/boot.d.ts +1 -13
- package/dist/session/boot/boot.d.ts.map +1 -1
- package/dist/session/boot/boot.js +9 -27
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/kernel-instance.hook.d.ts +1 -4
- package/dist/session/kernel-instance.hook.d.ts.map +1 -1
- package/dist/session/kernel-instance.hook.js +1 -5
- package/dist/session/provider.d.ts +9 -23
- package/dist/session/provider.d.ts.map +1 -1
- package/dist/session/provider.js +29 -75
- package/dist/session/session.context.d.ts +5 -0
- package/dist/session/session.context.d.ts.map +1 -1
- package/dist/window/adopt.d.ts +0 -1
- package/dist/window/adopt.d.ts.map +1 -1
- package/dist/window/hooks/target-node.hook.d.ts +10 -6
- package/dist/window/hooks/target-node.hook.d.ts.map +1 -1
- package/dist/window/hooks/target-node.hook.js +14 -72
- package/dist/window/hooks/views-for.hook.d.ts +4 -3
- package/dist/window/hooks/views-for.hook.d.ts.map +1 -1
- package/dist/window/hooks/views-for.hook.js +6 -22
- package/dist/window/hooks/windows.hook.d.ts.map +1 -1
- package/dist/window/hooks/windows.hook.js +3 -4
- package/dist/window/host.d.ts +11 -11
- package/dist/window/host.d.ts.map +1 -1
- package/dist/window/host.js +38 -54
- package/dist/window/hub.d.ts +2 -0
- package/dist/window/hub.d.ts.map +1 -1
- package/dist/window/hub.js +33 -0
- package/dist/window/index.d.ts +3 -3
- package/dist/window/index.d.ts.map +1 -1
- package/dist/window/index.js +2 -2
- package/dist/window/lifecycle/mount.d.ts +5 -44
- package/dist/window/lifecycle/mount.d.ts.map +1 -1
- package/dist/window/lifecycle/mount.js +14 -120
- package/dist/window/lifecycle/states.d.ts +0 -5
- package/dist/window/lifecycle/states.d.ts.map +1 -1
- package/dist/window/stage.d.ts.map +1 -1
- package/dist/window/stage.js +1 -0
- package/package.json +9 -8
- package/src/application/apps/app-host.tsx +17 -18
- package/src/application/apps/apps.hook.ts +13 -6
- package/src/application/apps/domains.hook.ts +1 -1
- package/src/application/apps/open-app.hook.ts +3 -4
- package/src/application/index.ts +4 -6
- package/src/application/spaces/space.hook.ts +5 -6
- package/src/application/spaces/spaces.hook.ts +14 -9
- package/src/auth/act-as.context.tsx +37 -91
- package/src/auth/auth.hook.ts +2 -30
- package/src/auth/can.hook.ts +44 -135
- package/src/auth/index.ts +1 -0
- package/src/auth/self.hook.ts +2 -9
- package/src/auth/session-kernel.ts +6 -16
- package/src/components/boundaries.tsx +113 -0
- package/src/components/can.tsx +16 -0
- package/src/components/index.ts +14 -0
- package/src/components/mount-domain-frontend.tsx +158 -0
- package/src/components/view-app.tsx +49 -0
- package/src/graph/call/call.hook.ts +22 -27
- package/src/graph/call/stream.hook.ts +66 -143
- package/src/graph/graph.context.ts +6 -11
- package/src/graph/guards.error.ts +17 -55
- package/src/graph/index.ts +23 -17
- package/src/graph/memory/read/envelope.ts +40 -65
- package/src/graph/memory/read/idle.ts +5 -18
- package/src/graph/query-definition.hook.ts +270 -0
- package/src/graph/resource.ts +358 -0
- package/src/graph/store.ts +97 -0
- package/src/host/actions.hook.ts +165 -0
- package/src/host/components.tsx +29 -0
- package/src/host/index.ts +17 -0
- package/src/index.ts +137 -123
- package/src/intents/envelope.ts +7 -23
- package/src/intents/send-intent.hook.ts +24 -79
- package/src/navigation/adapters/adapter.ts +3 -0
- package/src/navigation/adapters/memory.adapter.ts +4 -0
- package/src/navigation/adapters/url.adapter.ts +48 -8
- package/src/navigation/codec.ts +190 -0
- package/src/navigation/history.ts +20 -11
- package/src/navigation/hooks/ancestors.hook.ts +10 -60
- package/src/navigation/hooks/location.hook.ts +4 -6
- package/src/navigation/hooks/scope.hook.ts +4 -6
- package/src/navigation/index.ts +18 -2
- package/src/navigation/link.tsx +27 -2
- package/src/navigation/location.ts +26 -93
- package/src/navigation/scope.context.tsx +151 -136
- package/src/navigation/snapshot.ts +69 -50
- package/src/schema/action.hook.ts +146 -0
- package/src/schema/domain.hook.ts +127 -11
- package/src/schema/index.ts +9 -30
- package/src/schema/kernel.hook.ts +6 -13
- package/src/schema/mutation.hook.ts +63 -0
- package/src/schema/object.hook.ts +85 -0
- package/src/schema/relation.hook.ts +253 -0
- package/src/selection/live.ts +75 -125
- package/src/selection/scope.context.tsx +4 -4
- package/src/session/boot/boot.ts +8 -33
- package/src/session/index.ts +1 -0
- package/src/session/kernel-instance.hook.ts +2 -11
- package/src/session/provider.tsx +34 -103
- package/src/session/session.context.ts +6 -0
- package/src/window/adopt.ts +0 -1
- package/src/window/hooks/target-node.hook.ts +20 -85
- package/src/window/hooks/views-for.hook.ts +12 -25
- package/src/window/hooks/windows.hook.ts +3 -4
- package/src/window/host.tsx +51 -68
- package/src/window/hub.ts +33 -0
- package/src/window/index.ts +4 -4
- package/src/window/lifecycle/mount.ts +15 -160
- package/src/window/lifecycle/states.ts +1 -5
- package/src/window/stage.tsx +1 -0
- package/dist/application/roles.hook.d.ts +0 -7
- package/dist/application/roles.hook.d.ts.map +0 -1
- package/dist/application/roles.hook.js +0 -23
- package/dist/graph/memory/base.d.ts +0 -21
- package/dist/graph/memory/base.d.ts.map +0 -1
- package/dist/graph/memory/base.js +0 -33
- package/dist/graph/memory/read/read.d.ts +0 -9
- package/dist/graph/memory/read/read.d.ts.map +0 -1
- package/dist/graph/memory/read/read.js +0 -87
- package/dist/graph/memory/scope.d.ts +0 -7
- package/dist/graph/memory/scope.d.ts.map +0 -1
- package/dist/graph/memory/scope.js +0 -25
- package/dist/graph/mutate/move.hook.d.ts +0 -7
- package/dist/graph/mutate/move.hook.d.ts.map +0 -1
- package/dist/graph/mutate/move.hook.js +0 -49
- package/dist/graph/mutate/mutate.hook.d.ts +0 -17
- package/dist/graph/mutate/mutate.hook.d.ts.map +0 -1
- package/dist/graph/mutate/mutate.hook.js +0 -45
- package/dist/graph/query/children.hook.d.ts +0 -29
- package/dist/graph/query/children.hook.d.ts.map +0 -1
- package/dist/graph/query/children.hook.js +0 -64
- package/dist/graph/query/graph.hook.d.ts +0 -9
- package/dist/graph/query/graph.hook.d.ts.map +0 -1
- package/dist/graph/query/graph.hook.js +0 -5
- package/dist/graph/query/neighbors.hook.d.ts +0 -7
- package/dist/graph/query/neighbors.hook.d.ts.map +0 -1
- package/dist/graph/query/neighbors.hook.js +0 -104
- package/dist/graph/query/node.hook.d.ts +0 -14
- package/dist/graph/query/node.hook.d.ts.map +0 -1
- package/dist/graph/query/node.hook.js +0 -43
- package/dist/graph/query/query.hook.d.ts +0 -14
- package/dist/graph/query/query.hook.d.ts.map +0 -1
- package/dist/graph/query/query.hook.js +0 -23
- package/dist/schema/bind-read.d.ts +0 -37
- package/dist/schema/bind-read.d.ts.map +0 -1
- package/dist/schema/bind-read.js +0 -205
- package/dist/schema/binding.d.ts +0 -21
- package/dist/schema/binding.d.ts.map +0 -1
- package/dist/schema/binding.js +0 -99
- package/dist/schema/function.hook.d.ts +0 -9
- package/dist/schema/function.hook.d.ts.map +0 -1
- package/dist/schema/function.hook.js +0 -40
- package/dist/schema/method.hook.d.ts +0 -14
- package/dist/schema/method.hook.d.ts.map +0 -1
- package/dist/schema/method.hook.js +0 -49
- package/dist/schema/tag.d.ts +0 -11
- package/dist/schema/tag.d.ts.map +0 -1
- package/dist/schema/tag.js +0 -11
- package/dist/schema/types.d.ts +0 -73
- package/dist/schema/types.d.ts.map +0 -1
- package/dist/schema/types.js +0 -1
- package/dist/schema/write.d.ts +0 -16
- package/dist/schema/write.d.ts.map +0 -1
- package/dist/schema/write.js +0 -56
- package/src/application/roles.hook.ts +0 -41
- package/src/graph/memory/base.ts +0 -50
- package/src/graph/memory/read/read.ts +0 -103
- package/src/graph/memory/scope.ts +0 -29
- package/src/graph/mutate/move.hook.ts +0 -70
- package/src/graph/mutate/mutate.hook.ts +0 -69
- package/src/graph/query/children.hook.ts +0 -136
- package/src/graph/query/graph.hook.ts +0 -13
- package/src/graph/query/neighbors.hook.ts +0 -159
- package/src/graph/query/node.hook.ts +0 -83
- package/src/graph/query/query.hook.ts +0 -42
- package/src/schema/bind-read.ts +0 -319
- package/src/schema/binding.ts +0 -146
- package/src/schema/function.hook.ts +0 -68
- package/src/schema/method.hook.ts +0 -103
- package/src/schema/tag.ts +0 -19
- package/src/schema/types.ts +0 -150
- package/src/schema/write.ts +0 -96
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useSendIntent } from '../intents/send-intent.hook.js';
|
|
3
|
+
import { useShell } from '../session/shell.hook.js';
|
|
4
|
+
export function useHostCapabilities() {
|
|
5
|
+
return useShell().hostCapabilities;
|
|
6
|
+
}
|
|
7
|
+
export class HostCapabilityUnavailableError extends Error {
|
|
8
|
+
capability;
|
|
9
|
+
code = 'SHELL_REACT_HOST_CAPABILITY_UNAVAILABLE';
|
|
10
|
+
constructor(capability) {
|
|
11
|
+
super(`Host capability '${capability}' is unavailable.`);
|
|
12
|
+
this.capability = capability;
|
|
13
|
+
this.name = 'HostCapabilityUnavailableError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function useHostDialog() {
|
|
17
|
+
const capabilities = useHostCapabilities();
|
|
18
|
+
const send = useSendIntent();
|
|
19
|
+
return useMemo(() => ({
|
|
20
|
+
supported: capabilities.actions.modal !== undefined,
|
|
21
|
+
open: (request) => {
|
|
22
|
+
if (capabilities.actions.modal === undefined)
|
|
23
|
+
return unsupported('actions.modal');
|
|
24
|
+
portable(request);
|
|
25
|
+
return send('actions.modal', request);
|
|
26
|
+
},
|
|
27
|
+
confirm: async (request) => {
|
|
28
|
+
if (capabilities.actions.modal === undefined)
|
|
29
|
+
return unsupported('actions.modal');
|
|
30
|
+
portable(request);
|
|
31
|
+
return (await send('actions.modal', request)).outcome === 'confirmed';
|
|
32
|
+
},
|
|
33
|
+
}), [capabilities, send]);
|
|
34
|
+
}
|
|
35
|
+
export function useNotify() {
|
|
36
|
+
const capabilities = useHostCapabilities();
|
|
37
|
+
const send = useSendIntent();
|
|
38
|
+
return useMemo(() => {
|
|
39
|
+
const notify = ((request) => {
|
|
40
|
+
if (capabilities.actions.notify === undefined)
|
|
41
|
+
return unsupported('actions.notify');
|
|
42
|
+
portable(request);
|
|
43
|
+
return send('actions.notify', request);
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(notify, 'supported', {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
value: capabilities.actions.notify !== undefined,
|
|
48
|
+
});
|
|
49
|
+
return notify;
|
|
50
|
+
}, [capabilities, send]);
|
|
51
|
+
}
|
|
52
|
+
export function useOpenView() {
|
|
53
|
+
const capabilities = useHostCapabilities();
|
|
54
|
+
const send = useSendIntent();
|
|
55
|
+
return useMemo(() => {
|
|
56
|
+
const open = ((request) => {
|
|
57
|
+
if (capabilities.navigation.openView === undefined)
|
|
58
|
+
return unsupported('view.open');
|
|
59
|
+
portable(request);
|
|
60
|
+
return send('view.open', request);
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(open, 'supported', {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
value: capabilities.navigation.openView !== undefined,
|
|
65
|
+
});
|
|
66
|
+
return open;
|
|
67
|
+
}, [capabilities, send]);
|
|
68
|
+
}
|
|
69
|
+
export function useExternalOpen() {
|
|
70
|
+
const capabilities = useHostCapabilities();
|
|
71
|
+
const send = useSendIntent();
|
|
72
|
+
return useMemo(() => {
|
|
73
|
+
const open = ((request) => {
|
|
74
|
+
if (capabilities.navigation.external === undefined)
|
|
75
|
+
return unsupported('browser.openExternal');
|
|
76
|
+
portable(request);
|
|
77
|
+
return send('browser.openExternal', request);
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(open, 'supported', {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
value: capabilities.navigation.external !== undefined,
|
|
82
|
+
});
|
|
83
|
+
return open;
|
|
84
|
+
}, [capabilities, send]);
|
|
85
|
+
}
|
|
86
|
+
export function useRequestAccess() {
|
|
87
|
+
const capabilities = useHostCapabilities();
|
|
88
|
+
const send = useSendIntent();
|
|
89
|
+
return useMemo(() => {
|
|
90
|
+
const request = ((input) => {
|
|
91
|
+
if (capabilities.access.request === undefined)
|
|
92
|
+
return unsupported('access.request');
|
|
93
|
+
portable(input);
|
|
94
|
+
return send('access.request', input);
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(request, 'supported', {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
value: capabilities.access.request !== undefined,
|
|
99
|
+
});
|
|
100
|
+
return request;
|
|
101
|
+
}, [capabilities, send]);
|
|
102
|
+
}
|
|
103
|
+
function unsupported(capability) {
|
|
104
|
+
return Promise.reject(new HostCapabilityUnavailableError(capability));
|
|
105
|
+
}
|
|
106
|
+
function portable(input) {
|
|
107
|
+
const seen = new WeakSet();
|
|
108
|
+
const visit = (value) => {
|
|
109
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean')
|
|
110
|
+
return;
|
|
111
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
112
|
+
return;
|
|
113
|
+
if (typeof value !== 'object' || ArrayBuffer.isView(value) || value instanceof ArrayBuffer) {
|
|
114
|
+
throw new TypeError('Host action payload must be serializable data.');
|
|
115
|
+
}
|
|
116
|
+
if (seen.has(value))
|
|
117
|
+
throw new TypeError('Host action payload cannot contain cycles.');
|
|
118
|
+
seen.add(value);
|
|
119
|
+
if (Array.isArray(value))
|
|
120
|
+
value.forEach(visit);
|
|
121
|
+
else
|
|
122
|
+
Object.values(value).forEach(visit);
|
|
123
|
+
};
|
|
124
|
+
visit(input);
|
|
125
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { HostDialogApi, NotifyApi, OpenViewApi, RequestAccessApi } from './actions.hook.js';
|
|
3
|
+
export declare function HostDialog(props: {
|
|
4
|
+
readonly children: (dialog: HostDialogApi) => ReactNode;
|
|
5
|
+
}): ReactElement;
|
|
6
|
+
export declare function Notify(props: {
|
|
7
|
+
readonly children: (notify: NotifyApi) => ReactNode;
|
|
8
|
+
}): ReactElement;
|
|
9
|
+
export declare function NestedView(props: {
|
|
10
|
+
readonly children: (open: OpenViewApi) => ReactNode;
|
|
11
|
+
}): ReactElement;
|
|
12
|
+
export declare function RequestAccess(props: {
|
|
13
|
+
readonly children: (request: RequestAccessApi) => ReactNode;
|
|
14
|
+
}): ReactElement;
|
|
15
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/host/components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAIhG,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAChC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,SAAS,CAAA;CACxD,GAAG,YAAY,CAEf;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,CAAA;CACpD,GAAG,YAAY,CAEf;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAChC,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,SAAS,CAAA;CACpD,GAAG,YAAY,CAEf;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,SAAS,CAAA;CAC5D,GAAG,YAAY,CAEf"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useHostDialog, useNotify, useOpenView, useRequestAccess } from './actions.hook.js';
|
|
3
|
+
export function HostDialog(props) {
|
|
4
|
+
return _jsx(_Fragment, { children: props.children(useHostDialog()) });
|
|
5
|
+
}
|
|
6
|
+
export function Notify(props) {
|
|
7
|
+
return _jsx(_Fragment, { children: props.children(useNotify()) });
|
|
8
|
+
}
|
|
9
|
+
export function NestedView(props) {
|
|
10
|
+
return _jsx(_Fragment, { children: props.children(useOpenView()) });
|
|
11
|
+
}
|
|
12
|
+
export function RequestAccess(props) {
|
|
13
|
+
return _jsx(_Fragment, { children: props.children(useRequestAccess()) });
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useExternalOpen, useHostCapabilities, useHostDialog, useNotify, useOpenView, useRequestAccess, } from './actions.hook.js';
|
|
2
|
+
export type { ExternalOpenApi, HostDialogApi, NotifyApi, OpenViewApi, RequestAccessApi, } from './actions.hook.js';
|
|
3
|
+
export { HostDialog, NestedView, Notify, RequestAccess } from './components.js';
|
|
4
|
+
export { HostCapabilityUnavailableError } from './actions.hook.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,WAAW,EACX,gBAAgB,GACjB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,eAAe,EACf,aAAa,EACb,SAAS,EACT,WAAW,EACX,gBAAgB,GACjB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/E,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useExternalOpen, useHostCapabilities, useHostDialog, useNotify, useOpenView, useRequestAccess, } from './actions.hook.js';
|
|
2
|
+
export { HostDialog, NestedView, Notify, RequestAccess } from './components.js';
|
|
3
|
+
export { HostCapabilityUnavailableError } from './actions.hook.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,43 +1,32 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* the module structure, not subpaths. This public barrel composes the context
|
|
5
|
-
* barrels. Settled naming (§0): useKernelClient = the raw handle (session);
|
|
6
|
-
* useKernel() = the TYPED kernel (schema, no arg); useDomain(schema) = a typed
|
|
7
|
-
* domain binding. `useNode`/`useChildren` are single overloaded symbols (untyped
|
|
8
|
-
* floor + typed overloads) exported from the graph plane.
|
|
9
|
-
*/
|
|
10
|
-
export { ShellProvider } from './session/index.js';
|
|
11
|
-
export type { ShellError, ShellProviderProps } from './session/index.js';
|
|
12
|
-
export { useConnection, useKernelClient, useKernelInstance, useShell } from './session/index.js';
|
|
13
|
-
export type { KernelInstance } from './session/index.js';
|
|
1
|
+
/** @astrale-os/shell-react — curated React runtime over Shell and Kernel Client Store. */
|
|
2
|
+
export { ShellProvider, useConnection, useKernelClient, useKernelInstance, useShell, } from './session/index.js';
|
|
3
|
+
export type { KernelInstance, ShellError, ShellProviderProps } from './session/index.js';
|
|
14
4
|
export { ActAs, useAuth, useCan, useSelf } from './auth/index.js';
|
|
15
|
-
export type { ActAsProps } from './auth/index.js';
|
|
16
|
-
export {
|
|
17
|
-
export type {
|
|
18
|
-
export
|
|
19
|
-
export {
|
|
20
|
-
export
|
|
21
|
-
export type {
|
|
22
|
-
export type { AutoMethodAction, BoundMethodAction, EndpointResult, FunctionNames, FunctionParams, FunctionResult, MethodIsStatic, MethodNames, MethodParams, MethodResult, TargetedMethodAction, TypedChildrenResult, TypedNodeResult, } from './schema/index.js';
|
|
23
|
-
export { Link, NavScope, memoryAdapter, urlAdapter, useAncestors, useLocation, useNavScope, useNavigate, } from './navigation/index.js';
|
|
24
|
-
export type { LinkProps, MissingPolicy, NavAdapter, NavLocation, NavScopeHandle, NavScopeProps, NavSnapshot, NavTarget, Navigate, SerializedLocation, } from './navigation/index.js';
|
|
5
|
+
export type { ActAsProps, PolicyObject } from './auth/index.js';
|
|
6
|
+
export { ClientError, NodeUnavailableError, ProtocolError, ResponseError, StaleRouteError, TransportError, isClientError, isNodeUnavailableError, useCall, useGraphStore, useQuery, useStream, } from './graph/index.js';
|
|
7
|
+
export type { CallOptions, GraphResource, GraphResourceState, GraphStore, QueryResourceOptions, StreamHandle, StreamOptions, } from './graph/index.js';
|
|
8
|
+
export { RelationUnavailableError, queryRefresh, useAction, useDomain, useDomains, useDynamicDomain, useDynamicObject, useKernel, useMutation, useObject, useRelation, } from './schema/index.js';
|
|
9
|
+
export type { ActionOptions, ActionRefresh, DomainAction, MutationOptions, QueryRefresh, RelationOptions, RelationResource, RelationUnavailable, RichReadOptions, } from './schema/index.js';
|
|
10
|
+
export { Link, NavigationScope, NavScope, NodeLink, pathParam, ViewLink, defineNavigation, enumParam, location, memoryAdapter, urlAdapter, useAncestors, useLocation, useNavigate, useNavigation, useNavScope, } from './navigation/index.js';
|
|
11
|
+
export type { LinkProps, LocationDefinition, MissingPolicy, NavAdapter, NavLocation, NavScopeHandle, NavScopeProps, NavSnapshot, NavTarget, NavigationDefinition, NavigationParam, NavigationParams, NavigationRoutes, NavigationTarget, NodeLinkProps, Navigate, SerializedLocation, ViewLinkProps, } from './navigation/index.js';
|
|
25
12
|
export { SelectionScope, useSelection } from './selection/index.js';
|
|
26
13
|
export type { Selection, SelectionScopeProps } from './selection/index.js';
|
|
27
|
-
export { useCloseGuard, useTargetNode, useViewsFor, useWindow, useWindowList, useWindows,
|
|
28
|
-
export type { CloseGuard, CloseVerdict,
|
|
14
|
+
export { ViewHost, ViewStage, useCloseGuard, useTargetNode, useTargetPath, useViewsFor, useWindow, useWindowList, useWindows, } from './window/index.js';
|
|
15
|
+
export type { CloseGuard, CloseVerdict, ResolvedView, SandboxPolicy, ViewHostHandle, ViewHostProps, ViewsForResult, WindowListEntry, WindowState, WindowView, } from './window/index.js';
|
|
16
|
+
export { HostDialog, NestedView, Notify, RequestAccess, useExternalOpen, useHostCapabilities, useHostDialog, useNotify, useOpenView, useRequestAccess, } from './host/index.js';
|
|
17
|
+
export type { ExternalOpenApi, HostDialogApi, NotifyApi, OpenViewApi, RequestAccessApi, } from './host/index.js';
|
|
18
|
+
export { HostCapabilityUnavailableError } from './host/index.js';
|
|
29
19
|
export { useEmitIntent, useIntent, useSendIntent } from './intents/index.js';
|
|
30
20
|
export type { EmitIntent, IntentCtx, IntentPayload, IntentReply, SendIntent, } from './intents/index.js';
|
|
31
|
-
export {
|
|
32
|
-
export type {
|
|
33
|
-
export
|
|
34
|
-
export type {
|
|
35
|
-
export
|
|
36
|
-
export {
|
|
37
|
-
export type {
|
|
38
|
-
export type {
|
|
39
|
-
export type { AuthApi,
|
|
40
|
-
export type {
|
|
41
|
-
export type { CloseResult, KernelClient, MountCredential, Shell, ShellConfig, Window, } from '@astrale-os/shell';
|
|
42
|
-
export type { IntentRegistry } from '@astrale-os/shell';
|
|
21
|
+
export { Can, ConnectionBoundary, CredentialBoundary, defaultViewError, defaultViewLoading, GraphBoundary, mountDomainFrontend, ViewApp, ViewBoundary, ViewErrorBoundary, } from './components/index.js';
|
|
22
|
+
export type { MountedDomainFrontend, MountDomainFrontendOptions, ViewErrorBoundaryProps, } from './components/index.js';
|
|
23
|
+
export { AppHost, AppLogo, useApps, useCurrentSpace, useInstalledDomains, useOpenApp, useSpace, useSpaces, useUser, } from './application/index.js';
|
|
24
|
+
export type { AppHostFallbackState, AppHostProps, AppLogoProps, AppsResult, CurrentSpaceResult, DomainsResult, SpaceResult, SpacesResult, } from './application/index.js';
|
|
25
|
+
export { NodeId } from '@astrale-os/sdk/graph/node';
|
|
26
|
+
export { NodePath, Path } from '@astrale-os/sdk/graph/path';
|
|
27
|
+
export type { Node } from '@astrale-os/sdk/graph/node';
|
|
28
|
+
export type { PathLike } from '@astrale-os/sdk/graph/path';
|
|
29
|
+
export type { AuthApi, Identity, PolicyDecisionInput } from '@astrale-os/kernel-client/auth';
|
|
30
|
+
export type { DomainBinding, DomainInvokeOptions } from '@astrale-os/shell';
|
|
31
|
+
export type { ApplicationNode, AppSession, CloseResult, CredentialSnapshot, DomainSearchResult, HostCapabilities, IntentRegistry, KernelClient, MountCredential, NodeTarget, Shell, ShellConfig, SpaceNode, UserNode, ViewLocation, ViewPresentation, ViewPresentationRequest, Window, } from '@astrale-os/shell';
|
|
43
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* the module structure, not subpaths. This public barrel composes the context
|
|
5
|
-
* barrels. Settled naming (§0): useKernelClient = the raw handle (session);
|
|
6
|
-
* useKernel() = the TYPED kernel (schema, no arg); useDomain(schema) = a typed
|
|
7
|
-
* domain binding. `useNode`/`useChildren` are single overloaded symbols (untyped
|
|
8
|
-
* floor + typed overloads) exported from the graph plane.
|
|
9
|
-
*/
|
|
10
|
-
// ─── session (§2 provider + §3) ──────────────────────────────────────────────
|
|
11
|
-
export { ShellProvider } from './session/index.js';
|
|
12
|
-
export { useConnection, useKernelClient, useKernelInstance, useShell } from './session/index.js';
|
|
13
|
-
// ─── auth (§4) ───────────────────────────────────────────────────────────────
|
|
1
|
+
/** @astrale-os/shell-react — curated React runtime over Shell and Kernel Client Store. */
|
|
2
|
+
// Root/provider and authenticated caller.
|
|
3
|
+
export { ShellProvider, useConnection, useKernelClient, useKernelInstance, useShell, } from './session/index.js';
|
|
14
4
|
export { ActAs, useAuth, useCan, useSelf } from './auth/index.js';
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
//
|
|
18
|
-
export {
|
|
19
|
-
//
|
|
20
|
-
export {
|
|
21
|
-
// ─── navigation (§8) ─────────────────────────────────────────────────────────
|
|
22
|
-
export { Link, NavScope, memoryAdapter, urlAdapter, useAncestors, useLocation, useNavScope, useNavigate, } from './navigation/index.js';
|
|
23
|
-
// ─── selection (§9) ──────────────────────────────────────────────────────────
|
|
5
|
+
// One Store path and named SDK definitions. Raw Query/Mutation builders are intentionally absent.
|
|
6
|
+
export { ClientError, NodeUnavailableError, ProtocolError, ResponseError, StaleRouteError, TransportError, isClientError, isNodeUnavailableError, useCall, useGraphStore, useQuery, useStream, } from './graph/index.js';
|
|
7
|
+
// Rich exact Domain bindings.
|
|
8
|
+
export { RelationUnavailableError, queryRefresh, useAction, useDomain, useDomains, useDynamicDomain, useDynamicObject, useKernel, useMutation, useObject, useRelation, } from './schema/index.js';
|
|
9
|
+
// Typed navigation and selection.
|
|
10
|
+
export { Link, NavigationScope, NavScope, NodeLink, pathParam, ViewLink, defineNavigation, enumParam, location, memoryAdapter, urlAdapter, useAncestors, useLocation, useNavigate, useNavigation, useNavScope, } from './navigation/index.js';
|
|
24
11
|
export { SelectionScope, useSelection } from './selection/index.js';
|
|
25
|
-
//
|
|
26
|
-
export { useCloseGuard, useTargetNode, useViewsFor, useWindow, useWindowList, useWindows,
|
|
27
|
-
|
|
12
|
+
// View/window lifecycle and host effects.
|
|
13
|
+
export { ViewHost, ViewStage, useCloseGuard, useTargetNode, useTargetPath, useViewsFor, useWindow, useWindowList, useWindows, } from './window/index.js';
|
|
14
|
+
export { HostDialog, NestedView, Notify, RequestAccess, useExternalOpen, useHostCapabilities, useHostDialog, useNotify, useOpenView, useRequestAccess, } from './host/index.js';
|
|
15
|
+
export { HostCapabilityUnavailableError } from './host/index.js';
|
|
28
16
|
export { useEmitIntent, useIntent, useSendIntent } from './intents/index.js';
|
|
29
|
-
//
|
|
30
|
-
export {
|
|
31
|
-
//
|
|
32
|
-
export
|
|
33
|
-
//
|
|
34
|
-
export {
|
|
17
|
+
// Headless composition kit.
|
|
18
|
+
export { Can, ConnectionBoundary, CredentialBoundary, defaultViewError, defaultViewLoading, GraphBoundary, mountDomainFrontend, ViewApp, ViewBoundary, ViewErrorBoundary, } from './components/index.js';
|
|
19
|
+
// Shell application conveniences.
|
|
20
|
+
export { AppHost, AppLogo, useApps, useCurrentSpace, useInstalledDomains, useOpenApp, useSpace, useSpaces, useUser, } from './application/index.js';
|
|
21
|
+
// Canonical identity carriers used by View props and rich hooks.
|
|
22
|
+
export { NodeId } from '@astrale-os/sdk/graph/node';
|
|
23
|
+
export { NodePath, Path } from '@astrale-os/sdk/graph/path';
|
|
@@ -3,31 +3,19 @@
|
|
|
3
3
|
* a registry entry, the wire constants, and `intentMessage` — the single builder
|
|
4
4
|
* both directions (send + reply) share.
|
|
5
5
|
*/
|
|
6
|
-
import type { IntentMessage, IntentRegistry } from '@astrale-os/shell';
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
export type IntentPayload<K extends keyof IntentRegistry> = IntentRegistry[K] extends {
|
|
13
|
-
payload: infer P;
|
|
14
|
-
} ? P : IntentRegistry[K];
|
|
15
|
-
/**
|
|
16
|
-
* Reply of a registry entry: the `{ reply }` field when declared, else `void`
|
|
17
|
-
* (bare-payload and today's reply-less entries — forward-compatible with G4).
|
|
18
|
-
*/
|
|
19
|
-
export type IntentReply<K extends keyof IntentRegistry> = IntentRegistry[K] extends {
|
|
20
|
-
reply: infer R;
|
|
21
|
-
} ? R : void;
|
|
6
|
+
import type { IntentMessage, IntentRegistry, PayloadOf, ReplyOf } from '@astrale-os/shell';
|
|
7
|
+
/** Payload declared by the canonical Shell intent registry entry. */
|
|
8
|
+
export type IntentPayload<K extends keyof IntentRegistry> = PayloadOf<K>;
|
|
9
|
+
/** Reply declared by the canonical Shell intent registry entry. */
|
|
10
|
+
export type IntentReply<K extends keyof IntentRegistry> = ReplyOf<K>;
|
|
22
11
|
/** Sentinel `ctx.sender` carries for a parent-delivered intent (the shell stamps it). */
|
|
23
12
|
export declare const PARENT_SENDER = "<parent>";
|
|
24
13
|
/** Correlated-reply channel name (the shell's fire-and-forget reply protocol). */
|
|
25
14
|
export declare const INTENT_REPLY = "intentReply";
|
|
26
15
|
export declare const NOOP: () => void;
|
|
27
16
|
/**
|
|
28
|
-
* Build an intent wire message.
|
|
29
|
-
*
|
|
30
|
-
* bridges the correlated name↔payload the union type cannot express.
|
|
17
|
+
* Build an intent wire message. The cast bridges the correlated name↔payload
|
|
18
|
+
* relation that the generic union type cannot express.
|
|
31
19
|
*/
|
|
32
20
|
export declare function intentMessage(name: string, payload: unknown, correlationId?: string): IntentMessage;
|
|
33
21
|
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/intents/envelope.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/intents/envelope.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE1F,qEAAqE;AACrE,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,cAAc,IAAI,SAAS,CAAC,CAAC,CAAC,CAAA;AAExE,mEAAmE;AACnE,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,cAAc,IAAI,OAAO,CAAC,CAAC,CAAC,CAAA;AAEpE,yFAAyF;AACzF,eAAO,MAAM,aAAa,aAAa,CAAA;AAGvC,kFAAkF;AAClF,eAAO,MAAM,YAAY,gBAAgB,CAAA;AACzC,eAAO,MAAM,IAAI,QAAO,IAAU,CAAA;AAElC;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,aAAa,CAAC,EAAE,MAAM,GACrB,aAAa,CAMf"}
|
package/dist/intents/envelope.js
CHANGED
|
@@ -6,9 +6,8 @@ const SELF_SENDER = 'self';
|
|
|
6
6
|
export const INTENT_REPLY = 'intentReply';
|
|
7
7
|
export const NOOP = () => { };
|
|
8
8
|
/**
|
|
9
|
-
* Build an intent wire message.
|
|
10
|
-
*
|
|
11
|
-
* bridges the correlated name↔payload the union type cannot express.
|
|
9
|
+
* Build an intent wire message. The cast bridges the correlated name↔payload
|
|
10
|
+
* relation that the generic union type cannot express.
|
|
12
11
|
*/
|
|
13
12
|
export function intentMessage(name, payload, correlationId) {
|
|
14
13
|
return {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { IntentRegistry } from '@astrale-os/shell';
|
|
1
|
+
import type { IntentRegistry, RequestIntentOptions } from '@astrale-os/shell';
|
|
2
2
|
import type { IntentPayload, IntentReply } from './envelope.js';
|
|
3
|
-
/**
|
|
3
|
+
/** Typed request sender backed exclusively by Shell's core correlation implementation. */
|
|
4
4
|
export interface SendIntent {
|
|
5
|
-
<K extends keyof IntentRegistry>(name: K, payload: IntentPayload<K>,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
to?: 'parent' | string;
|
|
9
|
-
}): Promise<IntentReply<K> | void>;
|
|
5
|
+
<K extends keyof IntentRegistry>(name: K, payload: IntentPayload<K>, options?: RequestIntentOptions & {
|
|
6
|
+
readonly to?: 'parent' | string;
|
|
7
|
+
}): Promise<IntentReply<K>>;
|
|
10
8
|
}
|
|
11
9
|
export declare function useSendIntent(): SendIntent;
|
|
12
10
|
//# sourceMappingURL=send-intent.hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-intent.hook.d.ts","sourceRoot":"","sources":["../../src/intents/send-intent.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"send-intent.hook.d.ts","sourceRoot":"","sources":["../../src/intents/send-intent.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAK7E,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAK/D,0FAA0F;AAC1F,MAAM,WAAW,UAAU;IACzB,CAAC,CAAC,SAAS,MAAM,cAAc,EAC7B,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,EACzB,OAAO,CAAC,EAAE,oBAAoB,GAAG;QAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;KAAE,GACnE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;CAC3B;AAED,wBAAgB,aAAa,IAAI,UAAU,CAkC1C"}
|
|
@@ -1,87 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
* useSendIntent (API §11) — a stable typed sender. Each call attaches a
|
|
3
|
-
* `correlationId`, subscribes for the matching `intentReply` on the origin channel
|
|
4
|
-
* BEFORE sending, then resolves with the reply's result. The promise also resolves
|
|
5
|
-
* (`void`) if the target window closes or this hook unmounts — a pending reply
|
|
6
|
-
* never strands.
|
|
7
|
-
*/
|
|
1
|
+
import { requestChildIntent, requestIntent } from '@astrale-os/shell';
|
|
8
2
|
import { useCallback, useEffect, useRef } from 'react';
|
|
9
3
|
import { useShell } from '../session/shell.hook.js';
|
|
10
|
-
import { INTENT_REPLY, NOOP, intentMessage } from './envelope.js';
|
|
11
4
|
import { resolveIntentTarget } from './resolve-intent-target.js';
|
|
12
5
|
export function useSendIntent() {
|
|
13
6
|
const shell = useShell();
|
|
14
|
-
|
|
15
|
-
const pendingRef = useRef(new Set());
|
|
7
|
+
const lifetime = useRef(new AbortController());
|
|
16
8
|
useEffect(() => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
settle();
|
|
21
|
-
pending.clear();
|
|
22
|
-
};
|
|
9
|
+
const controller = lifetime.current.signal.aborted ? new AbortController() : lifetime.current;
|
|
10
|
+
lifetime.current = controller;
|
|
11
|
+
return () => controller.abort(new Error('Intent requester unmounted'));
|
|
23
12
|
}, []);
|
|
24
|
-
return useCallback((name, payload,
|
|
25
|
-
const target = resolveIntentTarget(shell,
|
|
13
|
+
return useCallback((name, payload, options) => {
|
|
14
|
+
const target = resolveIntentTarget(shell, options?.to);
|
|
26
15
|
if (target.kind === 'invalid') {
|
|
27
16
|
return Promise.reject(new Error(`useSendIntent: ${target.reason}`));
|
|
28
17
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return;
|
|
40
|
-
done = true;
|
|
41
|
-
offReply();
|
|
42
|
-
offClose();
|
|
43
|
-
pending.delete(onUnmount);
|
|
44
|
-
resolve(value);
|
|
45
|
-
}
|
|
46
|
-
function fail(error) {
|
|
47
|
-
if (done)
|
|
48
|
-
return;
|
|
49
|
-
done = true;
|
|
50
|
-
offReply();
|
|
51
|
-
offClose();
|
|
52
|
-
pending.delete(onUnmount);
|
|
53
|
-
reject(error);
|
|
54
|
-
}
|
|
55
|
-
const onReply = (m) => {
|
|
56
|
-
if (m.envelope.name !== INTENT_REPLY)
|
|
57
|
-
return;
|
|
58
|
-
const reply = m.envelope.payload;
|
|
59
|
-
if (reply.correlationId !== correlationId)
|
|
60
|
-
return;
|
|
61
|
-
if (reply.error) {
|
|
62
|
-
fail(new Error(reply.error.message));
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
settle(reply.result);
|
|
66
|
-
};
|
|
67
|
-
pending.add(onUnmount);
|
|
68
|
-
if (target.kind === 'parent') {
|
|
69
|
-
const parent = shell.parent;
|
|
70
|
-
offReply = parent.on('intent', onReply);
|
|
71
|
-
parent.send(message);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
const { windowId } = target;
|
|
75
|
-
offReply = shell.children.on('intent', (wid, m) => {
|
|
76
|
-
if (wid === windowId)
|
|
77
|
-
onReply(m);
|
|
78
|
-
});
|
|
79
|
-
offClose = shell.children.onClose((wid) => {
|
|
80
|
-
if (wid === windowId)
|
|
81
|
-
settle(undefined);
|
|
82
|
-
});
|
|
83
|
-
shell.children.send(windowId, message);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
18
|
+
const signal = options?.signal === undefined
|
|
19
|
+
? lifetime.current.signal
|
|
20
|
+
: AbortSignal.any([lifetime.current.signal, options.signal]);
|
|
21
|
+
const requestOptions = {
|
|
22
|
+
signal,
|
|
23
|
+
...(options?.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
|
|
24
|
+
};
|
|
25
|
+
return target.kind === 'parent'
|
|
26
|
+
? requestIntent(shell.parent, name, payload, requestOptions)
|
|
27
|
+
: requestChildIntent(shell.children, target.windowId, name, payload, requestOptions);
|
|
86
28
|
}, [shell]);
|
|
87
29
|
}
|
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { SerializedLocation } from '../history.js';
|
|
7
7
|
export interface NavAdapter {
|
|
8
|
+
readonly kind: 'memory' | 'browser';
|
|
8
9
|
read(): SerializedLocation | null;
|
|
9
10
|
write(loc: SerializedLocation, opts: {
|
|
10
11
|
replace: boolean;
|
|
11
12
|
}): void;
|
|
13
|
+
/** Remove only this adapter's owned projection when no history entry survives. */
|
|
14
|
+
clear(opts: {
|
|
15
|
+
replace: boolean;
|
|
16
|
+
}): void;
|
|
12
17
|
subscribe(onExternalChange: () => void): () => void;
|
|
13
18
|
href?(loc: SerializedLocation): string;
|
|
14
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/navigation/adapters/adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAEvD,MAAM,WAAW,UAAU;IACzB,IAAI,IAAI,kBAAkB,GAAG,IAAI,CAAA;IACjC,KAAK,CAAC,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;IAChE,SAAS,CAAC,gBAAgB,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;IACnD,IAAI,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAAA;CACvC"}
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/navigation/adapters/adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAEvD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;IACnC,IAAI,IAAI,kBAAkB,GAAG,IAAI,CAAA;IACjC,KAAK,CAAC,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;IAChE,kFAAkF;IAClF,KAAK,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;IACvC,SAAS,CAAC,gBAAgB,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;IACnD,IAAI,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAAA;CACvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.adapter.d.ts","sourceRoot":"","sources":["../../../src/navigation/adapters/memory.adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"memory.adapter.d.ts","sourceRoot":"","sources":["../../../src/navigation/adapters/memory.adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,UAAU,CAiBtE"}
|
|
@@ -3,10 +3,14 @@ export function memoryAdapter(initial) {
|
|
|
3
3
|
let current = initial ?? null;
|
|
4
4
|
const listeners = new Set();
|
|
5
5
|
return {
|
|
6
|
+
kind: 'memory',
|
|
6
7
|
read: () => current,
|
|
7
8
|
write: (loc) => {
|
|
8
9
|
current = loc;
|
|
9
10
|
},
|
|
11
|
+
clear: () => {
|
|
12
|
+
current = null;
|
|
13
|
+
},
|
|
10
14
|
subscribe: (cb) => {
|
|
11
15
|
listeners.add(cb);
|
|
12
16
|
return () => listeners.delete(cb);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.adapter.d.ts","sourceRoot":"","sources":["../../../src/navigation/adapters/url.adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"url.adapter.d.ts","sourceRoot":"","sources":["../../../src/navigation/adapters/url.adapter.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAK9C,oEAAoE;AACpE,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAiFhE"}
|