@astrale-os/shell-react 0.1.0
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/LICENSE +202 -0
- package/dist/application/apps/app-host.d.ts +31 -0
- package/dist/application/apps/app-host.d.ts.map +1 -0
- package/dist/application/apps/app-host.js +59 -0
- package/dist/application/apps/app-logo.d.ts +19 -0
- package/dist/application/apps/app-logo.d.ts.map +1 -0
- package/dist/application/apps/app-logo.js +31 -0
- package/dist/application/apps/apps.hook.d.ts +12 -0
- package/dist/application/apps/apps.hook.d.ts.map +1 -0
- package/dist/application/apps/apps.hook.js +51 -0
- package/dist/application/apps/open-app.hook.d.ts +10 -0
- package/dist/application/apps/open-app.hook.d.ts.map +1 -0
- package/dist/application/apps/open-app.hook.js +7 -0
- package/dist/application/index.d.ts +18 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +12 -0
- package/dist/application/roles.hook.d.ts +7 -0
- package/dist/application/roles.hook.d.ts.map +1 -0
- package/dist/application/roles.hook.js +23 -0
- package/dist/application/spaces/current-space.hook.d.ts +7 -0
- package/dist/application/spaces/current-space.hook.d.ts.map +1 -0
- package/dist/application/spaces/current-space.hook.js +27 -0
- package/dist/application/spaces/current-space.store.d.ts +32 -0
- package/dist/application/spaces/current-space.store.d.ts.map +1 -0
- package/dist/application/spaces/current-space.store.js +79 -0
- package/dist/application/spaces/space.hook.d.ts +5 -0
- package/dist/application/spaces/space.hook.d.ts.map +1 -0
- package/dist/application/spaces/space.hook.js +25 -0
- package/dist/application/spaces/spaces.hook.d.ts +14 -0
- package/dist/application/spaces/spaces.hook.d.ts.map +1 -0
- package/dist/application/spaces/spaces.hook.js +82 -0
- package/dist/application/user/user.hook.d.ts +10 -0
- package/dist/application/user/user.hook.d.ts.map +1 -0
- package/dist/application/user/user.hook.js +19 -0
- package/dist/application/user/user.store.d.ts +35 -0
- package/dist/application/user/user.store.d.ts.map +1 -0
- package/dist/application/user/user.store.js +51 -0
- package/dist/auth/act-as.context.d.ts +40 -0
- package/dist/auth/act-as.context.d.ts.map +1 -0
- package/dist/auth/act-as.context.js +84 -0
- package/dist/auth/auth.hook.d.ts +3 -0
- package/dist/auth/auth.hook.d.ts.map +1 -0
- package/dist/auth/auth.hook.js +25 -0
- package/dist/auth/can.hook.d.ts +40 -0
- package/dist/auth/can.hook.d.ts.map +1 -0
- package/dist/auth/can.hook.js +119 -0
- package/dist/auth/index.d.ts +6 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +5 -0
- package/dist/auth/self.hook.d.ts +3 -0
- package/dist/auth/self.hook.d.ts.map +1 -0
- package/dist/auth/self.hook.js +11 -0
- package/dist/auth/session-kernel.d.ts +4 -0
- package/dist/auth/session-kernel.d.ts.map +1 -0
- package/dist/auth/session-kernel.js +21 -0
- package/dist/graph/action.d.ts +22 -0
- package/dist/graph/action.d.ts.map +1 -0
- package/dist/graph/action.js +85 -0
- package/dist/graph/async.d.ts +11 -0
- package/dist/graph/async.d.ts.map +1 -0
- package/dist/graph/async.js +60 -0
- package/dist/graph/call/call.hook.d.ts +21 -0
- package/dist/graph/call/call.hook.d.ts.map +1 -0
- package/dist/graph/call/call.hook.js +23 -0
- package/dist/graph/call/stream.hook.d.ts +28 -0
- package/dist/graph/call/stream.hook.d.ts.map +1 -0
- package/dist/graph/call/stream.hook.js +137 -0
- package/dist/graph/graph.context.d.ts +4 -0
- package/dist/graph/graph.context.d.ts.map +1 -0
- package/dist/graph/graph.context.js +10 -0
- package/dist/graph/guards.error.d.ts +9 -0
- package/dist/graph/guards.error.d.ts.map +1 -0
- package/dist/graph/guards.error.js +7 -0
- package/dist/graph/index.d.ts +20 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +9 -0
- package/dist/graph/memory/base.d.ts +21 -0
- package/dist/graph/memory/base.d.ts.map +1 -0
- package/dist/graph/memory/base.js +33 -0
- package/dist/graph/memory/read/envelope.d.ts +71 -0
- package/dist/graph/memory/read/envelope.d.ts.map +1 -0
- package/dist/graph/memory/read/envelope.js +29 -0
- package/dist/graph/memory/read/idle.d.ts +18 -0
- package/dist/graph/memory/read/idle.d.ts.map +1 -0
- package/dist/graph/memory/read/idle.js +16 -0
- package/dist/graph/memory/read/read.d.ts +9 -0
- package/dist/graph/memory/read/read.d.ts.map +1 -0
- package/dist/graph/memory/read/read.js +87 -0
- package/dist/graph/memory/scope.d.ts +7 -0
- package/dist/graph/memory/scope.d.ts.map +1 -0
- package/dist/graph/memory/scope.js +25 -0
- package/dist/graph/mutate/move.hook.d.ts +7 -0
- package/dist/graph/mutate/move.hook.d.ts.map +1 -0
- package/dist/graph/mutate/move.hook.js +49 -0
- package/dist/graph/mutate/mutate.hook.d.ts +17 -0
- package/dist/graph/mutate/mutate.hook.d.ts.map +1 -0
- package/dist/graph/mutate/mutate.hook.js +45 -0
- package/dist/graph/query/children.hook.d.ts +29 -0
- package/dist/graph/query/children.hook.d.ts.map +1 -0
- package/dist/graph/query/children.hook.js +64 -0
- package/dist/graph/query/graph.hook.d.ts +9 -0
- package/dist/graph/query/graph.hook.d.ts.map +1 -0
- package/dist/graph/query/graph.hook.js +5 -0
- package/dist/graph/query/neighbors.hook.d.ts +7 -0
- package/dist/graph/query/neighbors.hook.d.ts.map +1 -0
- package/dist/graph/query/neighbors.hook.js +79 -0
- package/dist/graph/query/node.hook.d.ts +14 -0
- package/dist/graph/query/node.hook.d.ts.map +1 -0
- package/dist/graph/query/node.hook.js +43 -0
- package/dist/graph/query/query.hook.d.ts +14 -0
- package/dist/graph/query/query.hook.d.ts.map +1 -0
- package/dist/graph/query/query.hook.js +23 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/intents/envelope.d.ts +33 -0
- package/dist/intents/envelope.d.ts.map +1 -0
- package/dist/intents/envelope.js +19 -0
- package/dist/intents/index.d.ts +6 -0
- package/dist/intents/index.d.ts.map +1 -0
- package/dist/intents/index.js +3 -0
- package/dist/intents/listen-intent.hook.d.ts +16 -0
- package/dist/intents/listen-intent.hook.d.ts.map +1 -0
- package/dist/intents/listen-intent.hook.js +75 -0
- package/dist/intents/reply.d.ts +9 -0
- package/dist/intents/reply.d.ts.map +1 -0
- package/dist/intents/reply.js +14 -0
- package/dist/intents/send-intent.hook.d.ts +12 -0
- package/dist/intents/send-intent.hook.d.ts.map +1 -0
- package/dist/intents/send-intent.hook.js +86 -0
- package/dist/navigation/adapters/adapter.d.ts +15 -0
- package/dist/navigation/adapters/adapter.d.ts.map +1 -0
- package/dist/navigation/adapters/adapter.js +1 -0
- package/dist/navigation/adapters/memory.adapter.d.ts +9 -0
- package/dist/navigation/adapters/memory.adapter.d.ts.map +1 -0
- package/dist/navigation/adapters/memory.adapter.js +15 -0
- package/dist/navigation/adapters/url.adapter.d.ts +6 -0
- package/dist/navigation/adapters/url.adapter.d.ts.map +1 -0
- package/dist/navigation/adapters/url.adapter.js +59 -0
- package/dist/navigation/history.d.ts +63 -0
- package/dist/navigation/history.d.ts.map +1 -0
- package/dist/navigation/history.js +144 -0
- package/dist/navigation/hooks/ancestors.hook.d.ts +13 -0
- package/dist/navigation/hooks/ancestors.hook.d.ts.map +1 -0
- package/dist/navigation/hooks/ancestors.hook.js +56 -0
- package/dist/navigation/hooks/location.hook.d.ts +4 -0
- package/dist/navigation/hooks/location.hook.d.ts.map +1 -0
- package/dist/navigation/hooks/location.hook.js +17 -0
- package/dist/navigation/hooks/navigate.hook.d.ts +12 -0
- package/dist/navigation/hooks/navigate.hook.d.ts.map +1 -0
- package/dist/navigation/hooks/navigate.hook.js +33 -0
- package/dist/navigation/hooks/scope.hook.d.ts +12 -0
- package/dist/navigation/hooks/scope.hook.d.ts.map +1 -0
- package/dist/navigation/hooks/scope.hook.js +21 -0
- package/dist/navigation/index.d.ts +16 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +10 -0
- package/dist/navigation/link.d.ts +11 -0
- package/dist/navigation/link.d.ts.map +1 -0
- package/dist/navigation/link.js +62 -0
- package/dist/navigation/location.d.ts +48 -0
- package/dist/navigation/location.d.ts.map +1 -0
- package/dist/navigation/location.js +88 -0
- package/dist/navigation/scope.context.d.ts +64 -0
- package/dist/navigation/scope.context.d.ts.map +1 -0
- package/dist/navigation/scope.context.js +178 -0
- package/dist/navigation/snapshot.d.ts +22 -0
- package/dist/navigation/snapshot.d.ts.map +1 -0
- package/dist/navigation/snapshot.js +65 -0
- package/dist/schema/bind-read.d.ts +37 -0
- package/dist/schema/bind-read.d.ts.map +1 -0
- package/dist/schema/bind-read.js +205 -0
- package/dist/schema/binding.d.ts +21 -0
- package/dist/schema/binding.d.ts.map +1 -0
- package/dist/schema/binding.js +55 -0
- package/dist/schema/domain.hook.d.ts +10 -0
- package/dist/schema/domain.hook.d.ts.map +1 -0
- package/dist/schema/domain.hook.js +7 -0
- package/dist/schema/function.hook.d.ts +9 -0
- package/dist/schema/function.hook.d.ts.map +1 -0
- package/dist/schema/function.hook.js +40 -0
- package/dist/schema/index.d.ts +10 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +8 -0
- package/dist/schema/kernel.hook.d.ts +10 -0
- package/dist/schema/kernel.hook.d.ts.map +1 -0
- package/dist/schema/kernel.hook.js +8 -0
- package/dist/schema/method.hook.d.ts +14 -0
- package/dist/schema/method.hook.d.ts.map +1 -0
- package/dist/schema/method.hook.js +49 -0
- package/dist/schema/tag.d.ts +11 -0
- package/dist/schema/tag.d.ts.map +1 -0
- package/dist/schema/tag.js +11 -0
- package/dist/schema/types.d.ts +73 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +1 -0
- package/dist/schema/write.d.ts +15 -0
- package/dist/schema/write.d.ts.map +1 -0
- package/dist/schema/write.js +45 -0
- package/dist/selection/index.d.ts +4 -0
- package/dist/selection/index.d.ts.map +1 -0
- package/dist/selection/index.js +4 -0
- package/dist/selection/live.d.ts +21 -0
- package/dist/selection/live.d.ts.map +1 -0
- package/dist/selection/live.js +116 -0
- package/dist/selection/scope.context.d.ts +26 -0
- package/dist/selection/scope.context.d.ts.map +1 -0
- package/dist/selection/scope.context.js +100 -0
- package/dist/selection/selection.hook.d.ts +4 -0
- package/dist/selection/selection.hook.d.ts.map +1 -0
- package/dist/selection/selection.hook.js +14 -0
- package/dist/session/boot/boot.d.ts +19 -0
- package/dist/session/boot/boot.d.ts.map +1 -0
- package/dist/session/boot/boot.js +45 -0
- package/dist/session/boot/ownership.d.ts +18 -0
- package/dist/session/boot/ownership.d.ts.map +1 -0
- package/dist/session/boot/ownership.js +39 -0
- package/dist/session/boot/status.d.ts +24 -0
- package/dist/session/boot/status.d.ts.map +1 -0
- package/dist/session/boot/status.js +11 -0
- package/dist/session/connection/connection.hook.d.ts +3 -0
- package/dist/session/connection/connection.hook.d.ts.map +1 -0
- package/dist/session/connection/connection.hook.js +12 -0
- package/dist/session/connection/connection.store.d.ts +24 -0
- package/dist/session/connection/connection.store.d.ts.map +1 -0
- package/dist/session/connection/connection.store.js +31 -0
- package/dist/session/index.d.ts +8 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +6 -0
- package/dist/session/kernel-client.hook.d.ts +9 -0
- package/dist/session/kernel-client.hook.d.ts.map +1 -0
- package/dist/session/kernel-client.hook.js +5 -0
- package/dist/session/kernel-instance.hook.d.ts +9 -0
- package/dist/session/kernel-instance.hook.d.ts.map +1 -0
- package/dist/session/kernel-instance.hook.js +10 -0
- package/dist/session/provider.d.ts +31 -0
- package/dist/session/provider.d.ts.map +1 -0
- package/dist/session/provider.js +165 -0
- package/dist/session/session.context.d.ts +18 -0
- package/dist/session/session.context.d.ts.map +1 -0
- package/dist/session/session.context.js +8 -0
- package/dist/session/shell.hook.d.ts +4 -0
- package/dist/session/shell.hook.d.ts.map +1 -0
- package/dist/session/shell.hook.js +15 -0
- package/dist/window/adopt.d.ts +27 -0
- package/dist/window/adopt.d.ts.map +1 -0
- package/dist/window/adopt.js +27 -0
- package/dist/window/hooks/close-guard.hook.d.ts +6 -0
- package/dist/window/hooks/close-guard.hook.d.ts.map +1 -0
- package/dist/window/hooks/close-guard.hook.js +90 -0
- package/dist/window/hooks/target-node.hook.d.ts +7 -0
- package/dist/window/hooks/target-node.hook.d.ts.map +1 -0
- package/dist/window/hooks/target-node.hook.js +77 -0
- package/dist/window/hooks/views-for.hook.d.ts +8 -0
- package/dist/window/hooks/views-for.hook.d.ts.map +1 -0
- package/dist/window/hooks/views-for.hook.js +51 -0
- package/dist/window/hooks/window.hook.d.ts +4 -0
- package/dist/window/hooks/window.hook.d.ts.map +1 -0
- package/dist/window/hooks/window.hook.js +14 -0
- package/dist/window/hooks/windows.hook.d.ts +15 -0
- package/dist/window/hooks/windows.hook.d.ts.map +1 -0
- package/dist/window/hooks/windows.hook.js +25 -0
- package/dist/window/host.d.ts +31 -0
- package/dist/window/host.d.ts.map +1 -0
- package/dist/window/host.js +270 -0
- package/dist/window/hub.d.ts +41 -0
- package/dist/window/hub.d.ts.map +1 -0
- package/dist/window/hub.js +100 -0
- package/dist/window/index.d.ts +15 -0
- package/dist/window/index.d.ts.map +1 -0
- package/dist/window/index.js +10 -0
- package/dist/window/lifecycle/mount.d.ts +47 -0
- package/dist/window/lifecycle/mount.d.ts.map +1 -0
- package/dist/window/lifecycle/mount.js +92 -0
- package/dist/window/lifecycle/states.d.ts +33 -0
- package/dist/window/lifecycle/states.d.ts.map +1 -0
- package/dist/window/lifecycle/states.js +7 -0
- package/dist/window/placement.d.ts +33 -0
- package/dist/window/placement.d.ts.map +1 -0
- package/dist/window/placement.js +57 -0
- package/dist/window/stage.d.ts +3 -0
- package/dist/window/stage.d.ts.map +1 -0
- package/dist/window/stage.js +41 -0
- package/package.json +59 -0
- package/src/application/apps/app-host.tsx +113 -0
- package/src/application/apps/app-logo.tsx +56 -0
- package/src/application/apps/apps.hook.ts +81 -0
- package/src/application/apps/open-app.hook.ts +18 -0
- package/src/application/index.ts +22 -0
- package/src/application/roles.hook.ts +41 -0
- package/src/application/spaces/current-space.hook.ts +43 -0
- package/src/application/spaces/current-space.store.ts +110 -0
- package/src/application/spaces/space.hook.ts +41 -0
- package/src/application/spaces/spaces.hook.ts +113 -0
- package/src/application/user/user.hook.ts +27 -0
- package/src/application/user/user.store.ts +85 -0
- package/src/auth/act-as.context.tsx +124 -0
- package/src/auth/auth.hook.ts +36 -0
- package/src/auth/can.hook.ts +149 -0
- package/src/auth/index.ts +6 -0
- package/src/auth/self.hook.ts +14 -0
- package/src/auth/session-kernel.ts +24 -0
- package/src/graph/action.ts +127 -0
- package/src/graph/async.ts +87 -0
- package/src/graph/call/call.hook.ts +42 -0
- package/src/graph/call/stream.hook.ts +200 -0
- package/src/graph/graph.context.ts +14 -0
- package/src/graph/guards.error.ts +58 -0
- package/src/graph/index.ts +20 -0
- package/src/graph/memory/base.ts +50 -0
- package/src/graph/memory/read/envelope.ts +98 -0
- package/src/graph/memory/read/idle.ts +24 -0
- package/src/graph/memory/read/read.ts +103 -0
- package/src/graph/memory/scope.ts +29 -0
- package/src/graph/mutate/move.hook.ts +70 -0
- package/src/graph/mutate/mutate.hook.ts +69 -0
- package/src/graph/query/children.hook.ts +136 -0
- package/src/graph/query/graph.hook.ts +13 -0
- package/src/graph/query/neighbors.hook.ts +124 -0
- package/src/graph/query/node.hook.ts +83 -0
- package/src/graph/query/query.hook.ts +42 -0
- package/src/index.ts +202 -0
- package/src/intents/envelope.ts +52 -0
- package/src/intents/index.ts +6 -0
- package/src/intents/listen-intent.hook.ts +92 -0
- package/src/intents/reply.ts +24 -0
- package/src/intents/send-intent.hook.ts +111 -0
- package/src/navigation/adapters/adapter.ts +13 -0
- package/src/navigation/adapters/memory.adapter.ts +22 -0
- package/src/navigation/adapters/url.adapter.ts +61 -0
- package/src/navigation/history.ts +170 -0
- package/src/navigation/hooks/ancestors.hook.ts +71 -0
- package/src/navigation/hooks/location.hook.ts +21 -0
- package/src/navigation/hooks/navigate.hook.ts +43 -0
- package/src/navigation/hooks/scope.hook.ts +34 -0
- package/src/navigation/index.ts +17 -0
- package/src/navigation/link.tsx +110 -0
- package/src/navigation/location.ts +122 -0
- package/src/navigation/scope.context.tsx +267 -0
- package/src/navigation/snapshot.ts +79 -0
- package/src/schema/bind-read.ts +319 -0
- package/src/schema/binding.ts +91 -0
- package/src/schema/domain.hook.ts +16 -0
- package/src/schema/function.hook.ts +68 -0
- package/src/schema/index.ts +25 -0
- package/src/schema/kernel.hook.ts +17 -0
- package/src/schema/method.hook.ts +103 -0
- package/src/schema/tag.ts +19 -0
- package/src/schema/types.ts +150 -0
- package/src/schema/write.ts +80 -0
- package/src/selection/index.ts +5 -0
- package/src/selection/live.ts +142 -0
- package/src/selection/scope.context.tsx +151 -0
- package/src/selection/selection.hook.ts +18 -0
- package/src/session/boot/boot.ts +57 -0
- package/src/session/boot/ownership.ts +54 -0
- package/src/session/boot/status.ts +32 -0
- package/src/session/connection/connection.hook.ts +16 -0
- package/src/session/connection/connection.store.ts +58 -0
- package/src/session/index.ts +8 -0
- package/src/session/kernel-client.hook.ts +13 -0
- package/src/session/kernel-instance.hook.ts +22 -0
- package/src/session/provider.tsx +205 -0
- package/src/session/session.context.ts +27 -0
- package/src/session/shell.hook.ts +19 -0
- package/src/window/adopt.ts +57 -0
- package/src/window/hooks/close-guard.hook.ts +100 -0
- package/src/window/hooks/target-node.hook.ts +94 -0
- package/src/window/hooks/views-for.hook.ts +82 -0
- package/src/window/hooks/window.hook.ts +18 -0
- package/src/window/hooks/windows.hook.ts +40 -0
- package/src/window/host.tsx +347 -0
- package/src/window/hub.ts +156 -0
- package/src/window/index.ts +17 -0
- package/src/window/lifecycle/mount.ts +134 -0
- package/src/window/lifecycle/states.ts +23 -0
- package/src/window/placement.ts +84 -0
- package/src/window/stage.tsx +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Astrale
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { NodeRefInput } from '@astrale-os/kernel-client';
|
|
2
|
+
import type { ApplicationNode, AppSession, IntentRegistry, SandboxProfile } from '@astrale-os/shell';
|
|
3
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
4
|
+
import type { ViewHostHandle } from '../../window/host';
|
|
5
|
+
import type { WindowState } from '../../window/lifecycle/states';
|
|
6
|
+
/** The states `AppHost`'s fallback answers — the frame's, plus the two OS phases. */
|
|
7
|
+
export type AppHostFallbackState = WindowState | {
|
|
8
|
+
readonly phase: 'opening';
|
|
9
|
+
} | {
|
|
10
|
+
readonly phase: 'no-view';
|
|
11
|
+
};
|
|
12
|
+
export interface AppHostProps {
|
|
13
|
+
app: ApplicationNode | NodeRefInput;
|
|
14
|
+
/**
|
|
15
|
+
* Default target node delivered to the app's view as `targetNodeId` (API §12.2).
|
|
16
|
+
* Container-anchored apps need one — the dock passes the current space. A deeper
|
|
17
|
+
* fix (an install-time app data container + `app::open` returning a default
|
|
18
|
+
* target) is a tracked domain-modeling question; until then the host supplies it.
|
|
19
|
+
*/
|
|
20
|
+
node?: NodeRefInput;
|
|
21
|
+
capabilities?: {
|
|
22
|
+
intents: readonly (keyof IntentRegistry)[];
|
|
23
|
+
};
|
|
24
|
+
sandbox?: SandboxProfile | null;
|
|
25
|
+
fallback?: (state: AppHostFallbackState) => ReactNode;
|
|
26
|
+
onSession?: (session: AppSession) => void;
|
|
27
|
+
className?: string;
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
}
|
|
30
|
+
export declare const AppHost: import("react").ForwardRefExoticComponent<AppHostProps & import("react").RefAttributes<ViewHostHandle>>;
|
|
31
|
+
//# sourceMappingURL=app-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-host.d.ts","sourceRoot":"","sources":["../../../src/application/apps/app-host.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACpG,OAAO,KAAK,EAAE,aAAa,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;AAWnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAMhE,qFAAqF;AACrF,MAAM,MAAM,oBAAoB,GAC5B,WAAW,GACX;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAC7B;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAA;AAEjC,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,eAAe,GAAG,YAAY,CAAA;IACnC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,YAAY,CAAC,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC,MAAM,cAAc,CAAC,EAAE,CAAA;KAAE,CAAA;IAC7D,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IAC/B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CAAA;IACrD,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AAED,eAAO,MAAM,OAAO,yGAoEnB,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* AppHost (API §12.2) = useOpenApp + ViewHost. Opens the app's `AppSession`,
|
|
4
|
+
* mounts its entry view with the session credential, and DISPOSES the session
|
|
5
|
+
* with the window (unmount, or an app change). `opening` renders while the
|
|
6
|
+
* session opens; `no-view` when the app pins no entrypoint; every mounted-frame
|
|
7
|
+
* phase is the window module's `WindowState`.
|
|
8
|
+
*/
|
|
9
|
+
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
10
|
+
import { ViewHost } from '../../window/host';
|
|
11
|
+
import { toRef } from './apps.hook';
|
|
12
|
+
import { useOpenApp } from './open-app.hook';
|
|
13
|
+
export const AppHost = forwardRef(function AppHost(props, ref) {
|
|
14
|
+
const open = useOpenApp();
|
|
15
|
+
const [session, setSession] = useState(null);
|
|
16
|
+
const [error, setError] = useState(undefined);
|
|
17
|
+
const appKey = toRef(props.app);
|
|
18
|
+
const openRef = useRef(open);
|
|
19
|
+
openRef.current = open;
|
|
20
|
+
const appRef = useRef(props.app);
|
|
21
|
+
appRef.current = props.app;
|
|
22
|
+
const onSessionRef = useRef(props.onSession);
|
|
23
|
+
onSessionRef.current = props.onSession;
|
|
24
|
+
// Open (re)opens the session per app; the cleanup disposes it — so the session
|
|
25
|
+
// is torn down with the window (unmount) and swapped on an app change.
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
let cancelled = false;
|
|
28
|
+
let opened = null;
|
|
29
|
+
setSession(null);
|
|
30
|
+
setError(undefined);
|
|
31
|
+
void openRef.current(appRef.current).then((s) => {
|
|
32
|
+
if (cancelled) {
|
|
33
|
+
s.dispose();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
opened = s;
|
|
37
|
+
setSession(s);
|
|
38
|
+
onSessionRef.current?.(s);
|
|
39
|
+
}, (e) => {
|
|
40
|
+
if (!cancelled)
|
|
41
|
+
setError(e);
|
|
42
|
+
});
|
|
43
|
+
return () => {
|
|
44
|
+
cancelled = true;
|
|
45
|
+
opened?.dispose();
|
|
46
|
+
};
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
}, [appKey]);
|
|
49
|
+
const { fallback, className, style } = props;
|
|
50
|
+
const box = (children) => (_jsx("div", { className: className, style: style, children: children }));
|
|
51
|
+
// A session-open failure has no window yet — `windowId` is honestly absent (§10).
|
|
52
|
+
if (error !== undefined)
|
|
53
|
+
return box(fallback?.({ phase: 'crashed', error }) ?? null);
|
|
54
|
+
if (session === null)
|
|
55
|
+
return box(fallback?.({ phase: 'opening' }) ?? null);
|
|
56
|
+
if (session.view === null)
|
|
57
|
+
return box(fallback?.({ phase: 'no-view' }) ?? null);
|
|
58
|
+
return (_jsx(ViewHost, { ref: ref, view: session.view, node: props.node, credential: session.credential, capabilities: props.capabilities ?? { intents: [] }, sandbox: props.sandbox, fallback: fallback ? (s) => fallback(s) : undefined, className: className, style: style }));
|
|
59
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AppLogo (API §12.2) — render a node's logo prop: a url/`data:` URI as `<img>`,
|
|
3
|
+
* or an inline SVG string (sanitized + inlined), else `fallback`. The SVG path is
|
|
4
|
+
* a MINIMAL dependency-free strip (drops `<script>`/`<foreignObject>`, `on*`
|
|
5
|
+
* handlers, `javascript:` URLs); pass pre-sanitized markup for a hardened guard.
|
|
6
|
+
*/
|
|
7
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
8
|
+
export interface AppLogoProps {
|
|
9
|
+
/** The logo string — a url/`data:` URI or an inline `<svg>` string. */
|
|
10
|
+
logo?: string;
|
|
11
|
+
/** `<img>` alt text (url logos only). Default: `''` (decorative). */
|
|
12
|
+
alt?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
/** Rendered when `logo` is absent or unusable (e.g. a letter avatar). */
|
|
16
|
+
fallback?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare function AppLogo({ logo, alt, className, style, fallback }: AppLogoProps): ReactElement;
|
|
19
|
+
//# sourceMappingURL=app-logo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-logo.d.ts","sourceRoot":"","sources":["../../../src/application/apps/app-logo.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAInE,MAAM,WAAW,YAAY;IAC3B,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,YAAY,GAAG,YAAY,CAiB7F"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const URL_LOGO = /^(?:data:|https?:|\/)/i;
|
|
3
|
+
export function AppLogo({ logo, alt, className, style, fallback }) {
|
|
4
|
+
if (logo !== undefined && URL_LOGO.test(logo)) {
|
|
5
|
+
return _jsx("img", { src: logo, alt: alt ?? '', className: className, style: style });
|
|
6
|
+
}
|
|
7
|
+
const svg = logo !== undefined ? sanitizeInlineSvg(logo) : null;
|
|
8
|
+
if (svg !== null) {
|
|
9
|
+
return (_jsx("span", { "aria-hidden": true, className: className, style: style,
|
|
10
|
+
// Minimally sanitized inline SVG — see the module header for the trust boundary.
|
|
11
|
+
dangerouslySetInnerHTML: { __html: svg } }));
|
|
12
|
+
}
|
|
13
|
+
return _jsx(_Fragment, { children: fallback ?? null });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Accept only a string that opens with `<svg`, and strip the obvious script
|
|
17
|
+
* vectors: `<script>`/`<foreignObject>` blocks, `on*=` handlers, `javascript:`
|
|
18
|
+
* URLs. Intentionally minimal (no heavy dep) — not a general HTML sanitizer.
|
|
19
|
+
*/
|
|
20
|
+
function sanitizeInlineSvg(raw) {
|
|
21
|
+
const s = raw.trimStart();
|
|
22
|
+
if (!s.toLowerCase().startsWith('<svg'))
|
|
23
|
+
return null;
|
|
24
|
+
return s
|
|
25
|
+
.replace(/<\s*script[\s\S]*?<\s*\/\s*script\s*>/gi, '')
|
|
26
|
+
.replace(/<\s*foreignObject[\s\S]*?<\s*\/\s*foreignObject\s*>/gi, '')
|
|
27
|
+
.replace(/\son[a-z0-9_-]+\s*=\s*"[^"]*"/gi, '')
|
|
28
|
+
.replace(/\son[a-z0-9_-]+\s*=\s*'[^']*'/gi, '')
|
|
29
|
+
.replace(/\son[a-z0-9_-]+\s*=\s*[^\s>]+/gi, '')
|
|
30
|
+
.replace(/(href|xlink:href|src)\s*=\s*(["'])\s*javascript:[^"']*\2/gi, '');
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NodeRefInput } from '@astrale-os/kernel-client';
|
|
2
|
+
import type { ApplicationNode, SpaceNode } from '@astrale-os/shell';
|
|
3
|
+
import type { ReadState } from '../../graph/memory/read/envelope';
|
|
4
|
+
export interface AppsResult extends ReadState {
|
|
5
|
+
readonly apps: readonly ApplicationNode[];
|
|
6
|
+
}
|
|
7
|
+
export declare function useApps(space?: SpaceNode | NodeRefInput | null): AppsResult;
|
|
8
|
+
/** An `@id` ref for a bound node, else the normalized ref of a raw subject. */
|
|
9
|
+
export declare function toRef(x: NodeRefInput | {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
}): string;
|
|
12
|
+
//# sourceMappingURL=apps.hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.hook.d.ts","sourceRoot":"","sources":["../../../src/application/apps/apps.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAYnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AAWjE,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,QAAQ,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,CAAA;CAC1C;AAED,wBAAgB,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,IAAI,GAAG,UAAU,CA0C3E;AAOD,+EAA+E;AAC/E,wBAAgB,KAAK,CAAC,CAAC,EAAE,YAAY,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEvE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { normalizeRef } from '@astrale-os/kernel-client';
|
|
2
|
+
/**
|
|
3
|
+
* useApps(space?) (API §12.2) — the apps installed in a space (`installed_in`
|
|
4
|
+
* in-edges). No arg targets the CURRENT space (shared store, so a switch anywhere
|
|
5
|
+
* swaps the dock) and is IDLE while none is selected (§1.3); an explicit `null`
|
|
6
|
+
* stays idle; OS plane unavailable → fully idle. Also `toRef`, the app/space
|
|
7
|
+
* subject normalizer the apps hooks share.
|
|
8
|
+
*/
|
|
9
|
+
import { useCallback, useEffect, useMemo, useSyncExternalStore } from 'react';
|
|
10
|
+
import { useAsyncResource } from '../../graph/async';
|
|
11
|
+
import { useShell } from '../../session/shell.hook';
|
|
12
|
+
import { currentSpaceStore } from '../spaces/current-space.store';
|
|
13
|
+
import { isOsPlaneAvailable } from '../user/user.store';
|
|
14
|
+
const NO_APPS = [];
|
|
15
|
+
const IDLE_CURRENT = { space: null, pending: false, error: undefined };
|
|
16
|
+
export function useApps(space) {
|
|
17
|
+
const shell = useShell();
|
|
18
|
+
const available = isOsPlaneAvailable(shell);
|
|
19
|
+
// No arg → the CURRENT space, read through the shared store so a switch in any
|
|
20
|
+
// window swaps the dock here (§12.2). An explicit `null` stays idle; an explicit
|
|
21
|
+
// space bypasses the store entirely (no needless currentSpace fetch). OS plane
|
|
22
|
+
// unavailable (§12.2) → fully idle.
|
|
23
|
+
const useCurrent = space === undefined;
|
|
24
|
+
const store = currentSpaceStore(shell);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (useCurrent && available)
|
|
27
|
+
store.ensure();
|
|
28
|
+
}, [store, useCurrent, available]);
|
|
29
|
+
const subscribe = useCallback((cb) => (useCurrent && available ? store.subscribe(cb) : () => { }), [store, useCurrent, available]);
|
|
30
|
+
const getSnapshot = useCallback(() => (useCurrent && available ? store.getSnapshot() : IDLE_CURRENT), [store, useCurrent, available]);
|
|
31
|
+
const currentSnap = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
32
|
+
const effective = useCurrent ? currentSnap.space : (space ?? null);
|
|
33
|
+
const effRef = effective === null ? null : toRef(effective);
|
|
34
|
+
const appsRes = useAsyncResource(!available || effRef === null ? null : () => shell.apps.in(effRef), NO_APPS, [shell, effRef, available]);
|
|
35
|
+
return useMemo(() => ({
|
|
36
|
+
apps: appsRes.data,
|
|
37
|
+
pending: (useCurrent && currentSnap.pending) || appsRes.pending,
|
|
38
|
+
error: (useCurrent ? currentSnap.error : undefined) ?? appsRes.error,
|
|
39
|
+
live: false,
|
|
40
|
+
seq: 0,
|
|
41
|
+
refetch: appsRes.refetch,
|
|
42
|
+
}), [appsRes.data, appsRes.pending, appsRes.error, appsRes.refetch, useCurrent, currentSnap]);
|
|
43
|
+
}
|
|
44
|
+
/** A bound-node-ish subject carries a graph id. */
|
|
45
|
+
function hasId(x) {
|
|
46
|
+
return typeof x === 'object' && x !== null && 'id' in x;
|
|
47
|
+
}
|
|
48
|
+
/** An `@id` ref for a bound node, else the normalized ref of a raw subject. */
|
|
49
|
+
export function toRef(x) {
|
|
50
|
+
return hasId(x) ? `@${x.id}` : normalizeRef(x);
|
|
51
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useOpenApp (API §12.2) — the Action that opens an `AppSession` (the three-call
|
|
3
|
+
* app-open protocol lives in the shell package). Resolves to the session; disposal
|
|
4
|
+
* is the caller's (AppHost disposes it with the window).
|
|
5
|
+
*/
|
|
6
|
+
import type { NodeRefInput } from '@astrale-os/kernel-client';
|
|
7
|
+
import type { ApplicationNode, AppSession } from '@astrale-os/shell';
|
|
8
|
+
import type { Action } from '../../graph/action';
|
|
9
|
+
export declare function useOpenApp(): Action<[ApplicationNode | NodeRefInput], AppSession>;
|
|
10
|
+
//# sourceMappingURL=open-app.hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-app.hook.d.ts","sourceRoot":"","sources":["../../../src/application/apps/open-app.hook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAMhD,wBAAgB,UAAU,IAAI,MAAM,CAAC,CAAC,eAAe,GAAG,YAAY,CAAC,EAAE,UAAU,CAAC,CAGjF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { useUser } from './user/user.hook';
|
|
2
|
+
export { useSpaces } from './spaces/spaces.hook';
|
|
3
|
+
export type { SpacesResult } from './spaces/spaces.hook';
|
|
4
|
+
export { useCurrentSpace } from './spaces/current-space.hook';
|
|
5
|
+
export type { CurrentSpaceResult } from './spaces/current-space.hook';
|
|
6
|
+
export { useSpace } from './spaces/space.hook';
|
|
7
|
+
export type { SpaceResult } from './spaces/space.hook';
|
|
8
|
+
export { useApps } from './apps/apps.hook';
|
|
9
|
+
export type { AppsResult } from './apps/apps.hook';
|
|
10
|
+
export { useOpenApp } from './apps/open-app.hook';
|
|
11
|
+
export { AppHost } from './apps/app-host';
|
|
12
|
+
export type { AppHostFallbackState, AppHostProps } from './apps/app-host';
|
|
13
|
+
export { AppLogo } from './apps/app-logo';
|
|
14
|
+
export type { AppLogoProps } from './apps/app-logo';
|
|
15
|
+
export { useRoles } from './roles.hook';
|
|
16
|
+
export type { RolesResult } from './roles.hook';
|
|
17
|
+
export type { ApplicationNode, AppSession, RoleNode, SpaceNode, UserNode } from '@astrale-os/shell';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/application/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAG/C,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// application — API §12.2. The OS-plane hooks over the shell package's
|
|
2
|
+
// `shell.user/spaces/apps` namespaces + the window module: useUser, useSpaces,
|
|
3
|
+
// useCurrentSpace, useSpace, useApps, useRoles, useOpenApp, AppHost, AppLogo.
|
|
4
|
+
export { useUser } from './user/user.hook';
|
|
5
|
+
export { useSpaces } from './spaces/spaces.hook';
|
|
6
|
+
export { useCurrentSpace } from './spaces/current-space.hook';
|
|
7
|
+
export { useSpace } from './spaces/space.hook';
|
|
8
|
+
export { useApps } from './apps/apps.hook';
|
|
9
|
+
export { useOpenApp } from './apps/open-app.hook';
|
|
10
|
+
export { AppHost } from './apps/app-host';
|
|
11
|
+
export { AppLogo } from './apps/app-logo';
|
|
12
|
+
export { useRoles } from './roles.hook';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RoleNode } from '@astrale-os/shell';
|
|
2
|
+
import type { ReadState } from '../graph/memory/read/envelope';
|
|
3
|
+
export interface RolesResult extends ReadState {
|
|
4
|
+
readonly roles: readonly RoleNode[];
|
|
5
|
+
}
|
|
6
|
+
export declare function useRoles(): RolesResult;
|
|
7
|
+
//# sourceMappingURL=roles.hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.hook.d.ts","sourceRoot":"","sources":["../../src/application/roles.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAQjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAQ9D,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAA;CACpC;AAED,wBAAgB,QAAQ,IAAI,WAAW,CAoBtC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useRoles (API §12.2) — the roles self holds (`has_role` out-edges), over the
|
|
3
|
+
* async OS namespace (one-shot today, §12 flag).
|
|
4
|
+
*/
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { useAsyncResource } from '../graph/async';
|
|
7
|
+
import { useShell } from '../session/shell.hook';
|
|
8
|
+
import { isOsPlaneAvailable } from './user/user.store';
|
|
9
|
+
const NO_ROLES = [];
|
|
10
|
+
export function useRoles() {
|
|
11
|
+
const shell = useShell();
|
|
12
|
+
// OS plane unavailable (§12.2) → idle: no roles read.
|
|
13
|
+
const available = isOsPlaneAvailable(shell);
|
|
14
|
+
const res = useAsyncResource(available ? () => shell.user.roles() : null, NO_ROLES, [shell, available]);
|
|
15
|
+
return useMemo(() => ({
|
|
16
|
+
roles: res.data,
|
|
17
|
+
pending: res.pending,
|
|
18
|
+
error: res.error,
|
|
19
|
+
live: false,
|
|
20
|
+
seq: 0,
|
|
21
|
+
refetch: res.refetch,
|
|
22
|
+
}), [res]);
|
|
23
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SpaceNode } from '@astrale-os/shell';
|
|
2
|
+
import type { ReadState } from '../../graph/memory/read/envelope';
|
|
3
|
+
export interface CurrentSpaceResult extends ReadState {
|
|
4
|
+
readonly space: SpaceNode | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function useCurrentSpace(): CurrentSpaceResult;
|
|
7
|
+
//# sourceMappingURL=current-space.hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-space.hook.d.ts","sourceRoot":"","sources":["../../../src/application/spaces/current-space.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AASlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AAMjE,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAA;CACjC;AAED,wBAAgB,eAAe,IAAI,kBAAkB,CAuBpD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useCurrentSpace (API §12.2) — the selected space, projected from the shared
|
|
3
|
+
* per-Shell current-space store (so a switch anywhere re-themes it). One-shot
|
|
4
|
+
* today (§12 flag); OS-plane-unavailable reads idle.
|
|
5
|
+
*/
|
|
6
|
+
import { useEffect, useMemo, useSyncExternalStore } from 'react';
|
|
7
|
+
import { useShell } from '../../session/shell.hook';
|
|
8
|
+
import { isOsPlaneAvailable } from '../user/user.store';
|
|
9
|
+
import { currentSpaceStore, idleSnapshot, noopSubscribe } from './current-space.store';
|
|
10
|
+
export function useCurrentSpace() {
|
|
11
|
+
const shell = useShell();
|
|
12
|
+
const available = isOsPlaneAvailable(shell);
|
|
13
|
+
const store = currentSpaceStore(shell);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (available)
|
|
16
|
+
store.ensure();
|
|
17
|
+
}, [store, available]);
|
|
18
|
+
const snap = useSyncExternalStore(available ? store.subscribe : noopSubscribe, available ? store.getSnapshot : idleSnapshot, available ? store.getSnapshot : idleSnapshot);
|
|
19
|
+
return useMemo(() => ({
|
|
20
|
+
space: snap.space,
|
|
21
|
+
pending: snap.pending,
|
|
22
|
+
error: snap.error,
|
|
23
|
+
live: false,
|
|
24
|
+
seq: 0,
|
|
25
|
+
refetch: store.refresh,
|
|
26
|
+
}), [snap, store]);
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared current-space store (API §12.2). ONE reactive resolver per Shell, so
|
|
3
|
+
* useCurrentSpace / useApps / useSpaces.selected all observe the SAME selected
|
|
4
|
+
* space: a `switch` in any window re-themes every consumer in this window at once,
|
|
5
|
+
* with a manual optimistic override applied ahead of the round-trip (§1.6). This
|
|
6
|
+
* closes the same-window cross-hook divergence; cross-WINDOW liveness still waits
|
|
7
|
+
* on the memory-shape move (§12 flag).
|
|
8
|
+
*/
|
|
9
|
+
import type { Shell, SpaceNode } from '@astrale-os/shell';
|
|
10
|
+
export interface CurrentSpaceSnapshot {
|
|
11
|
+
readonly space: SpaceNode | null;
|
|
12
|
+
readonly pending: boolean;
|
|
13
|
+
readonly error: unknown;
|
|
14
|
+
}
|
|
15
|
+
export declare const IDLE_SNAPSHOT: CurrentSpaceSnapshot;
|
|
16
|
+
export declare const idleSnapshot: () => CurrentSpaceSnapshot;
|
|
17
|
+
export declare const noopSubscribe: () => (() => void);
|
|
18
|
+
export interface CurrentSpaceStore {
|
|
19
|
+
subscribe(cb: () => void): () => void;
|
|
20
|
+
getSnapshot(): CurrentSpaceSnapshot;
|
|
21
|
+
/** Kick a first load if the confirmed value was never fetched. */
|
|
22
|
+
ensure(): void;
|
|
23
|
+
/** Refetch the confirmed selected space; resolves when it lands. */
|
|
24
|
+
refresh(): Promise<void>;
|
|
25
|
+
/** Apply an optimistic override (a switch in flight) — every consumer re-renders. */
|
|
26
|
+
setOptimistic(space: SpaceNode | null): void;
|
|
27
|
+
/** Drop the optimistic override, revealing confirmed truth again. */
|
|
28
|
+
clearOptimistic(): void;
|
|
29
|
+
}
|
|
30
|
+
/** The one current-space store for a Shell (created on first touch). */
|
|
31
|
+
export declare function currentSpaceStore(shell: Shell): CurrentSpaceStore;
|
|
32
|
+
//# sourceMappingURL=current-space.store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-space.store.d.ts","sourceRoot":"","sources":["../../../src/application/spaces/current-space.store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB;AAKD,eAAO,MAAM,aAAa,EAAE,oBAAwE,CAAA;AACpG,eAAO,MAAM,YAAY,QAAO,oBAAqC,CAAA;AACrE,eAAO,MAAM,aAAa,QAAO,CAAC,MAAM,IAAI,CAAa,CAAA;AAEzD,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;IACrC,WAAW,IAAI,oBAAoB,CAAA;IACnC,kEAAkE;IAClE,MAAM,IAAI,IAAI,CAAA;IACd,oEAAoE;IACpE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,qFAAqF;IACrF,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAA;IAC5C,qEAAqE;IACrE,eAAe,IAAI,IAAI,CAAA;CACxB;AAmED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,iBAAiB,CAOjE"}
|