@astrale-os/shell-react 0.2.9 → 0.2.10-beta.3
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 +4 -15
- package/dist/application/apps/app-host.d.ts.map +1 -1
- package/dist/application/apps/app-host.js +1 -1
- 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/astrale.d.ts +14 -0
- package/dist/components/astrale.d.ts.map +1 -0
- package/dist/components/astrale.js +12 -0
- 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 +6 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +3 -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 +9 -11
- package/dist/window/host.d.ts.map +1 -1
- package/dist/window/host.js +26 -62
- 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 +2 -2
- 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/package.json +20 -8
- package/src/application/apps/app-host.tsx +11 -15
- 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/astrale.tsx +40 -0
- package/src/components/boundaries.tsx +113 -0
- package/src/components/can.tsx +16 -0
- package/src/components/index.ts +13 -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 +131 -124
- 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 +35 -77
- package/src/window/hub.ts +33 -0
- package/src/window/index.ts +3 -3
- package/src/window/lifecycle/mount.ts +15 -160
- package/src/window/lifecycle/states.ts +1 -5
- 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
package/dist/session/provider.js
CHANGED
|
@@ -1,38 +1,15 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createShell } from '@astrale-os/shell';
|
|
3
|
-
|
|
4
|
-
* ShellProvider — the composition root (API §2, SPEC §5): owns the shell boot
|
|
5
|
-
* state machine (a config OR a prebuilt Shell; `createShell → init → whoami →
|
|
6
|
-
* ready`), seats `ShellContext` and `GraphContext`, and registers its boot-retry
|
|
7
|
-
* into the per-shell connection store. One live shell per mounted provider,
|
|
8
|
-
* StrictMode/HMR-safe (deferred teardown), keyed on config identity. Children
|
|
9
|
-
* render only at `ready`, so useShell/useSelf are synchronous below.
|
|
10
|
-
*/
|
|
11
|
-
import { useCallback, useEffect, useMemo, useReducer, useRef, useState } from 'react';
|
|
3
|
+
import { useCallback, useEffect, useReducer, useRef, useState } from 'react';
|
|
12
4
|
import { primeUser } from '../application/user/user.store.js';
|
|
13
5
|
import { GraphContext } from '../graph/graph.context.js';
|
|
14
|
-
import {
|
|
6
|
+
import { resolveGraphStoreScope, retainStore, storeFor } from '../graph/store.js';
|
|
15
7
|
import { configIdentity, isShellConfig, resolveSelf } from './boot/boot.js';
|
|
16
8
|
import { cancelTeardown, disposeShell, scheduleTeardown } from './boot/ownership.js';
|
|
17
9
|
import { bootReducer, INITIAL_BOOT } from './boot/status.js';
|
|
18
10
|
import { connectionStore } from './connection/connection.store.js';
|
|
19
11
|
import { ShellContext } from './session.context.js';
|
|
20
|
-
/**
|
|
21
|
-
* Map a memory event to the documented `ShellError` union (API §2). `refresh`
|
|
22
|
-
* (warm-read revalidation failure) and `mutation` (rolled-back write) are the
|
|
23
|
-
* two the channel promises; `divergence`/`invariant` are Tier-0/dev tripwires
|
|
24
|
-
* outside the union and are not bridged here.
|
|
25
|
-
*/
|
|
26
|
-
function toShellError(event) {
|
|
27
|
-
switch (event.kind) {
|
|
28
|
-
case 'refresh':
|
|
29
|
-
return { kind: 'refresh', shape: event.shape, error: event.error };
|
|
30
|
-
case 'mutation':
|
|
31
|
-
return { kind: 'mutation', mutationId: event.mutationId, error: event.error };
|
|
32
|
-
default:
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
12
|
+
/** Own and initialize exactly one Shell for a React subtree. */
|
|
36
13
|
export function ShellProvider(props) {
|
|
37
14
|
const { config, fallback, errorFallback, onError, children } = props;
|
|
38
15
|
const [state, dispatch] = useReducer(bootReducer, INITIAL_BOOT);
|
|
@@ -47,13 +24,13 @@ export function ShellProvider(props) {
|
|
|
47
24
|
const generation = (ref.generation += 1);
|
|
48
25
|
dispatch({ type: 'connecting' });
|
|
49
26
|
let shell;
|
|
50
|
-
const current = configRef.current;
|
|
51
27
|
try {
|
|
28
|
+
const current = configRef.current;
|
|
52
29
|
shell = isShellConfig(current) ? createShell(current) : current;
|
|
53
30
|
}
|
|
54
|
-
catch (
|
|
55
|
-
dispatch({ type: 'error', error
|
|
56
|
-
onErrorRef.current?.({ kind: 'connection', error
|
|
31
|
+
catch (error) {
|
|
32
|
+
dispatch({ type: 'error', error });
|
|
33
|
+
onErrorRef.current?.({ kind: 'connection', error });
|
|
57
34
|
return;
|
|
58
35
|
}
|
|
59
36
|
ref.shell = shell;
|
|
@@ -65,35 +42,33 @@ export function ShellProvider(props) {
|
|
|
65
42
|
const self = await resolveSelf(shell);
|
|
66
43
|
if (generation !== ref.generation)
|
|
67
44
|
return;
|
|
68
|
-
// Pre-resolve the OS-plane user binding (API §2/§12.2) — NON-FATAL: a
|
|
69
|
-
// missing OS plane marks it unavailable without failing boot (whoami above
|
|
70
|
-
// stays the fatal gate). Seeds the user store so `useUser` is synchronous.
|
|
71
45
|
await primeUser(shell);
|
|
72
46
|
if (generation !== ref.generation)
|
|
73
47
|
return;
|
|
74
|
-
|
|
48
|
+
const storeScope = await resolveGraphStoreScope(shell, self);
|
|
49
|
+
if (generation !== ref.generation)
|
|
50
|
+
return;
|
|
51
|
+
const graph = storeFor(shell, storeScope);
|
|
52
|
+
dispatch({
|
|
53
|
+
type: 'ready',
|
|
54
|
+
runtime: { shell, self, storeScope, store: graph.store, ownsStore: graph.owned },
|
|
55
|
+
});
|
|
75
56
|
}
|
|
76
|
-
catch (
|
|
57
|
+
catch (error) {
|
|
77
58
|
if (generation !== ref.generation)
|
|
78
59
|
return;
|
|
79
|
-
dispatch({ type: 'error', error
|
|
80
|
-
onErrorRef.current?.({ kind: 'connection', error
|
|
60
|
+
dispatch({ type: 'error', error });
|
|
61
|
+
onErrorRef.current?.({ kind: 'connection', error });
|
|
81
62
|
}
|
|
82
63
|
})();
|
|
83
64
|
}, []);
|
|
84
65
|
useEffect(() => {
|
|
85
66
|
const ref = bootRef.current;
|
|
86
|
-
// The shell this provider will run with once the effect settles: a prebuilt
|
|
87
|
-
// Shell is the config object itself; a config-built one is whatever this
|
|
88
|
-
// instance already booted (adopted on a StrictMode/HMR re-setup). Cancel any
|
|
89
|
-
// pending deferred teardown for it before deciding — this also cancels a
|
|
90
|
-
// teardown another provider scheduled for the SAME prebuilt Shell.
|
|
91
67
|
const current = configRef.current;
|
|
92
68
|
const adopting = isShellConfig(current) ? ref.shell : current;
|
|
93
69
|
if (adopting !== null)
|
|
94
70
|
cancelTeardown(adopting);
|
|
95
71
|
if (ref.key !== configKey) {
|
|
96
|
-
// First boot, config change, or a retry that cleared the key: reboot fresh.
|
|
97
72
|
if (ref.shell !== null) {
|
|
98
73
|
cancelTeardown(ref.shell);
|
|
99
74
|
disposeShell(ref.shell);
|
|
@@ -102,11 +77,7 @@ export function ShellProvider(props) {
|
|
|
102
77
|
ref.shell = null;
|
|
103
78
|
startBoot(ref);
|
|
104
79
|
}
|
|
105
|
-
// Same key already booting/booted → adopt (StrictMode's second setup).
|
|
106
80
|
return () => {
|
|
107
|
-
// Defer teardown one macrotask; a synchronous re-setup (StrictMode/HMR or a
|
|
108
|
-
// different provider adopting the same prebuilt Shell) cancels it first and
|
|
109
|
-
// keeps the same live shell.
|
|
110
81
|
if (ref.shell !== null)
|
|
111
82
|
scheduleTeardown(ref.shell, ref);
|
|
112
83
|
else
|
|
@@ -122,44 +93,27 @@ export function ShellProvider(props) {
|
|
|
122
93
|
}
|
|
123
94
|
ref.key = null;
|
|
124
95
|
dispatch({ type: 'connecting' });
|
|
125
|
-
setAttempt((
|
|
96
|
+
setAttempt((value) => value + 1);
|
|
126
97
|
}, []);
|
|
127
|
-
// The base (default-scope) memory for the booted Shell — the SAME instance
|
|
128
|
-
// the graph/schema/nav hooks read through `graph/memory/scope.ts`. Seated in
|
|
129
|
-
// `GraphContext` so selection's liveness has a source; null until ready.
|
|
130
98
|
const shell = state.runtime?.shell ?? null;
|
|
131
|
-
const memory = useMemo(() => (shell === null ? null : baseMemoryFor(shell)), [shell]);
|
|
132
|
-
// Bridge the memory's event channel onto the provider `onError` (API §2/§8):
|
|
133
|
-
// warm-refresh failures and rolled-back mutations surface here rather than being
|
|
134
|
-
// swallowed. Registered while the booted shell is live; cleared on teardown.
|
|
135
99
|
useEffect(() => {
|
|
136
|
-
if (shell
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
onErrorRef.current?.(mapped);
|
|
142
|
-
});
|
|
143
|
-
return () => setMemoryErrorSink(shell, null);
|
|
144
|
-
}, [shell]);
|
|
145
|
-
// Register this provider's boot-retry into the shell's connection store (rule 3),
|
|
146
|
-
// so `useConnection().retry` re-runs boot. Status/seq stay a stub ('ready'/0)
|
|
147
|
-
// until the transport-status + result-`seq` feed lands, with no surface change.
|
|
100
|
+
if (shell !== null)
|
|
101
|
+
connectionStore(shell).setRetry(retry);
|
|
102
|
+
}, [shell, retry]);
|
|
103
|
+
const store = state.runtime?.store ?? null;
|
|
104
|
+
const storeScope = state.runtime?.storeScope ?? null;
|
|
148
105
|
useEffect(() => {
|
|
149
|
-
if (shell === null)
|
|
106
|
+
if (shell === null || store === null || storeScope === null)
|
|
150
107
|
return;
|
|
151
|
-
|
|
152
|
-
}, [shell,
|
|
108
|
+
return retainStore(storeFor(shell, storeScope));
|
|
109
|
+
}, [shell, store, storeScope]);
|
|
153
110
|
if (state.status === 'error') {
|
|
154
|
-
// Wrapped in a fragment so the component's declared return type stays
|
|
155
|
-
// `ReactElement | null` — valid JSX under @types/react 18 AND 19 (the react
|
|
156
|
-
// peer range is >=18), even though `errorFallback`/`fallback` yield ReactNode.
|
|
157
111
|
if (errorFallback !== undefined)
|
|
158
112
|
return _jsx(_Fragment, { children: errorFallback(state.error, retry) });
|
|
159
113
|
throw state.error;
|
|
160
114
|
}
|
|
161
115
|
if (state.status !== 'ready' || state.runtime === null) {
|
|
162
|
-
return fallback
|
|
116
|
+
return fallback === undefined ? null : _jsx(_Fragment, { children: fallback });
|
|
163
117
|
}
|
|
164
|
-
return (_jsx(ShellContext.Provider, { value: state.runtime, children: _jsx(GraphContext.Provider, { value:
|
|
118
|
+
return (_jsx(ShellContext.Provider, { value: state.runtime, children: _jsx(GraphContext.Provider, { value: state.runtime.store, children: children }) }));
|
|
165
119
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { GraphStore } from '@astrale-os/kernel-client/store';
|
|
1
2
|
import type { KernelClient, Shell } from '@astrale-os/shell';
|
|
3
|
+
import type { GraphStoreScope } from '../graph/store.js';
|
|
2
4
|
/**
|
|
3
5
|
* whoami's node type, derived from the auth surface so shell-react needs no
|
|
4
6
|
* direct `@astrale-os/kernel-core` dependency (`Node` is not yet re-exported by
|
|
@@ -13,6 +15,9 @@ export interface ShellRuntime {
|
|
|
13
15
|
* bound kernel exposes no auth surface (a bare prebuilt Shell in tests).
|
|
14
16
|
*/
|
|
15
17
|
readonly self: SelfNode | null;
|
|
18
|
+
readonly storeScope: GraphStoreScope;
|
|
19
|
+
readonly store: GraphStore;
|
|
20
|
+
readonly ownsStore: boolean;
|
|
16
21
|
}
|
|
17
22
|
export declare const ShellContext: import("react").Context<ShellRuntime | null>;
|
|
18
23
|
//# sourceMappingURL=session.context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.context.d.ts","sourceRoot":"","sources":["../../src/session/session.context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAS5D;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAE1E,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"session.context.d.ts","sourceRoot":"","sources":["../../src/session/session.context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAS5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAE1E,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAA;IACpC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AACD,eAAO,MAAM,YAAY,8CAA2C,CAAA"}
|
package/dist/window/adopt.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export interface AdoptRecord {
|
|
|
12
12
|
readonly window: Window;
|
|
13
13
|
readonly slot: StageSlot;
|
|
14
14
|
readonly state: WindowState;
|
|
15
|
-
readonly targetId: string | undefined;
|
|
16
15
|
/** Close the window, release its slot, drop it from the registry (fired if unadopted). */
|
|
17
16
|
dispose(): void;
|
|
18
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adopt.d.ts","sourceRoot":"","sources":["../../src/window/adopt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,
|
|
1
|
+
{"version":3,"file":"adopt.d.ts","sourceRoot":"","sources":["../../src/window/adopt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,0FAA0F;IAC1F,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,yFAAyF;IACzF,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;IAC7C,yFAAyF;IACzF,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAA;CACtC;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,IAAI,UAAU,CA2B7C"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { Node } from '@astrale-os/sdk/graph/node';
|
|
2
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
3
|
+
import type { GraphResource } from '../../graph/resource.js';
|
|
4
|
+
/**
|
|
5
|
+
* Read the canonical target admitted by the parent handshake and subsequent
|
|
6
|
+
* parent-owned hot swaps without remounting this View document.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useTargetNode(): GraphResource<Node | null>;
|
|
9
|
+
/** Reactive canonical target Path; null represents an explicit parent clear. */
|
|
10
|
+
export declare function useTargetPath(): Path | null;
|
|
7
11
|
//# sourceMappingURL=target-node.hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target-node.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/target-node.hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"target-node.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/target-node.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AAGjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAK5D;;;GAGG;AACH,wBAAgB,aAAa,IAAI,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,CAE1D;AAED,gFAAgF;AAChF,wBAAgB,aAAa,IAAI,IAAI,GAAG,IAAI,CAS3C"}
|
|
@@ -1,77 +1,19 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
+
import { useCallback, useMemo, useSyncExternalStore } from 'react';
|
|
3
|
+
import { useDynamicObject } from '../../schema/object.hook.js';
|
|
4
|
+
import { useShell } from '../../session/shell.hook.js';
|
|
1
5
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* intent retargets it; the id resolves to a live `Node` through the shell kernel.
|
|
5
|
-
*
|
|
6
|
-
* Honest subset (flagged): the read is a one-shot `kernel.get` re-run on id
|
|
7
|
-
* change, not a memory watch, so `live` is false. Once composed with `useNode(id)`
|
|
8
|
-
* it becomes real stale-while-revalidate liveness with no consumer change.
|
|
6
|
+
* Read the canonical target admitted by the parent handshake and subsequent
|
|
7
|
+
* parent-owned hot swaps without remounting this View document.
|
|
9
8
|
*/
|
|
10
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
11
|
-
import { idleReadState } from '../../graph/memory/read/idle.js';
|
|
12
|
-
import { useShell } from '../../session/shell.hook.js';
|
|
13
|
-
/** Address a bare node id by graph id (`@<id>`); pass paths/anchors through. */
|
|
14
|
-
function toRef(id) {
|
|
15
|
-
return id.startsWith('/') || id.startsWith('@') ? id : `@${id}`;
|
|
16
|
-
}
|
|
17
|
-
const IDLE_READ = { node: null, pending: false, error: undefined };
|
|
18
9
|
export function useTargetNode() {
|
|
19
|
-
|
|
20
|
-
const [id, setId] = useState(() => shell.targetNodeId ?? null);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
const parent = shell.parent;
|
|
23
|
-
if (parent === null)
|
|
24
|
-
return;
|
|
25
|
-
return parent.on('intent', (message) => {
|
|
26
|
-
if (message.envelope.name !== 'setTarget')
|
|
27
|
-
return;
|
|
28
|
-
const nodeId = message.envelope.payload.nodeId;
|
|
29
|
-
if (typeof nodeId === 'string')
|
|
30
|
-
setId(nodeId);
|
|
31
|
-
});
|
|
32
|
-
}, [shell]);
|
|
33
|
-
return useNodeRead(shell.kernel, id);
|
|
10
|
+
return useDynamicObject(useTargetPath());
|
|
34
11
|
}
|
|
35
|
-
/**
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
aliveRef.current = false;
|
|
43
|
-
};
|
|
44
|
-
}, []);
|
|
45
|
-
const load = useCallback(async () => {
|
|
46
|
-
if (id === null) {
|
|
47
|
-
if (aliveRef.current)
|
|
48
|
-
setSnap(IDLE_READ);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (aliveRef.current)
|
|
52
|
-
setSnap((s) => ({ node: s.node, pending: true, error: undefined }));
|
|
53
|
-
try {
|
|
54
|
-
const node = await kernel.get(toRef(id));
|
|
55
|
-
if (aliveRef.current)
|
|
56
|
-
setSnap({ node: node ?? null, pending: false, error: undefined });
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
if (aliveRef.current)
|
|
60
|
-
setSnap((s) => ({ node: s.node, pending: false, error }));
|
|
61
|
-
}
|
|
62
|
-
}, [kernel, id]);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
void load();
|
|
65
|
-
}, [load]);
|
|
66
|
-
if (id === null) {
|
|
67
|
-
return { ...idleReadState(), node: null };
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
node: snap.node,
|
|
71
|
-
pending: snap.pending,
|
|
72
|
-
error: snap.error,
|
|
73
|
-
live: false,
|
|
74
|
-
seq: 0,
|
|
75
|
-
refetch: load,
|
|
76
|
-
};
|
|
12
|
+
/** Reactive canonical target Path; null represents an explicit parent clear. */
|
|
13
|
+
export function useTargetPath() {
|
|
14
|
+
const shell = useShell();
|
|
15
|
+
const subscribe = useCallback((listener) => shell.onTargetChange(() => listener()), [shell]);
|
|
16
|
+
const snapshot = useCallback(() => shell.targetNodeId, [shell]);
|
|
17
|
+
const target = useSyncExternalStore(subscribe, snapshot, snapshot);
|
|
18
|
+
return useMemo(() => (target === undefined ? null : Path.parse(target)), [target]);
|
|
77
19
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Node } from '@astrale-os/sdk/graph/node';
|
|
2
|
+
import type { PathLike } from '@astrale-os/sdk/graph/path';
|
|
3
|
+
import type { ResolvedView } from '@astrale-os/shell';
|
|
2
4
|
import type { ReadState } from '../../graph/memory/read/envelope.js';
|
|
3
|
-
import type { Node, ViewDescriptor } from '../lifecycle/mount.js';
|
|
4
5
|
export interface ViewsForResult extends ReadState {
|
|
5
|
-
readonly views: readonly
|
|
6
|
+
readonly views: readonly ResolvedView[];
|
|
6
7
|
}
|
|
7
8
|
export declare function useViewsFor(node: Node | PathLike | null | undefined): ViewsForResult;
|
|
8
9
|
//# sourceMappingURL=views-for.hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"views-for.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/views-for.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"views-for.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/views-for.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,KAAK,EAAY,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAWrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;AAKpE,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAA;CACxC;AAID,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,cAAc,CAqBpF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
1
2
|
/**
|
|
2
3
|
* useViewsFor (API §10) — "what Views can render this node", as mountable
|
|
3
4
|
* `ViewDescriptor`s for the open-with menu. Backed one-shot (`live:false`) by the
|
|
@@ -11,7 +12,7 @@ const NO_VIEWS = Object.freeze([]);
|
|
|
11
12
|
export function useViewsFor(node) {
|
|
12
13
|
const shell = useShell();
|
|
13
14
|
const target = resolvePath(node);
|
|
14
|
-
const res = useAsyncResource(target === null ? null : () =>
|
|
15
|
+
const res = useAsyncResource(target === null ? null : () => shell.views.resolve(target), NO_VIEWS, [shell, target]);
|
|
15
16
|
return useMemo(() => ({
|
|
16
17
|
views: res.data,
|
|
17
18
|
pending: res.pending,
|
|
@@ -21,28 +22,11 @@ export function useViewsFor(node) {
|
|
|
21
22
|
refetch: res.refetch,
|
|
22
23
|
}), [res.data, res.pending, res.error, res.refetch]);
|
|
23
24
|
}
|
|
24
|
-
/**
|
|
25
|
-
async function resolveViews(shell, node) {
|
|
26
|
-
const rows = await shell.views.resolve(node);
|
|
27
|
-
if (rows.length === 0)
|
|
28
|
-
return NO_VIEWS;
|
|
29
|
-
return rows.map((r) => ({ id: r.id, path: r.path, url: r.url, handshake: r.handshake }));
|
|
30
|
-
}
|
|
31
|
-
/** A path/`@id` the kernel read surface accepts, or `null` for an idle subject. */
|
|
25
|
+
/** One canonical target, or `null` for an idle subject. */
|
|
32
26
|
function resolvePath(node) {
|
|
33
27
|
if (node === null || node === undefined)
|
|
34
28
|
return null;
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return node.startsWith('/') || node.startsWith('@') ? node : `@${node}`;
|
|
39
|
-
}
|
|
40
|
-
const obj = node;
|
|
41
|
-
if (typeof obj.path?.raw === 'string')
|
|
42
|
-
return obj.path.raw;
|
|
43
|
-
if (typeof obj.id === 'string')
|
|
44
|
-
return `@${obj.id}`;
|
|
45
|
-
if (typeof obj.raw === 'string')
|
|
46
|
-
return obj.raw;
|
|
47
|
-
return null;
|
|
29
|
+
if ('id' in node)
|
|
30
|
+
return Path.id(node.id).raw;
|
|
31
|
+
return Path.from(node).raw;
|
|
48
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windows.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/windows.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"windows.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/windows.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAa/C,mFAAmF;AACnF,wBAAgB,UAAU,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxD;AAED,uCAAuC;AACvC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,SAAS,eAAe,EAAE,CAG1D"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* useWindows / useWindowList (API §10) — reactive views over the windows a
|
|
3
|
-
* `ViewHost`/`AppHost`
|
|
4
|
-
* window-change feed, so
|
|
5
|
-
*
|
|
6
|
-
* tracked here — flagged in the module report as a shell foundation gap.
|
|
3
|
+
* `ViewHost`/`AppHost` or the framework-neutral Shell mounts. The hub mirrors
|
|
4
|
+
* Shell's immutable window-change feed, so credential, location, lifecycle,
|
|
5
|
+
* and imperative mounts remain reactive through one snapshot authority.
|
|
7
6
|
*/
|
|
8
7
|
import { useMemo, useSyncExternalStore } from 'react';
|
|
9
8
|
import { useShell } from '../../session/shell.hook.js';
|
package/dist/window/host.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CloseResult, IntentRegistry, MountCredential, SandboxProfile } from '@astrale-os/shell';
|
|
1
|
+
import type { CloseResult, HostCapabilities, MountCredential, ResolvedView, SandboxProfile } from '@astrale-os/shell';
|
|
3
2
|
import type { CSSProperties, ReactNode } from 'react';
|
|
4
|
-
import type { ResolvedSource, ViewSource } from './lifecycle/mount.js';
|
|
5
3
|
import type { WindowState } from './lifecycle/states.js';
|
|
6
4
|
/** Imperative handle on a mounted `ViewHost` (API §10). */
|
|
7
5
|
export interface ViewHostHandle {
|
|
@@ -14,20 +12,20 @@ export interface ViewHostHandle {
|
|
|
14
12
|
refresh(): void;
|
|
15
13
|
}
|
|
16
14
|
/** Static iframe sandbox flags, an explicit opt-out, or a policy over the resolved mount. */
|
|
17
|
-
export type SandboxPolicy = SandboxProfile | null | ((
|
|
18
|
-
export
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
capabilities?:
|
|
22
|
-
intents: readonly (keyof IntentRegistry)[];
|
|
23
|
-
};
|
|
15
|
+
export type SandboxPolicy = SandboxProfile | null | ((view: ResolvedView) => SandboxProfile | null);
|
|
16
|
+
export interface ViewHostProps {
|
|
17
|
+
/** One canonical target paired with one untouched View route. */
|
|
18
|
+
view: ResolvedView;
|
|
19
|
+
capabilities?: HostCapabilities;
|
|
24
20
|
sandbox?: SandboxPolicy;
|
|
25
21
|
credential?: MountCredential;
|
|
22
|
+
handshakeTimeoutMs?: number;
|
|
23
|
+
delegationTtlSeconds?: number;
|
|
26
24
|
/** Rendered inside the anchor while the frame is not `ready`. */
|
|
27
25
|
fallback?: (state: WindowState) => ReactNode;
|
|
28
26
|
onStateChange?: (state: WindowState) => void;
|
|
29
27
|
className?: string;
|
|
30
28
|
style?: CSSProperties;
|
|
31
|
-
}
|
|
29
|
+
}
|
|
32
30
|
export declare const ViewHost: import("react").ForwardRefExoticComponent<ViewHostProps & import("react").RefAttributes<ViewHostHandle>>;
|
|
33
31
|
//# sourceMappingURL=host.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/window/host.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/window/host.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,eAAe,EAEf,YAAY,EACZ,cAAc,EAEf,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;AAsBnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAQxD,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,KAAK,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3E,gCAAgC;IAChC,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,6FAA6F;AAC7F,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,YAAY,KAAK,cAAc,GAAG,IAAI,CAAC,CAAA;AAEnG,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,IAAI,EAAE,YAAY,CAAA;IAClB,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,SAAS,CAAA;IAC5C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AAWD,eAAO,MAAM,QAAQ,0GA+PpB,CAAA"}
|