@dxos/halo-react 0.0.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 ADDED
@@ -0,0 +1,105 @@
1
+ # Functional Source License, Version 1.1, ALv2 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-Apache-2.0
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @dxos/halo-react
2
+
3
+ React hooks for the [`@dxos/halo`](../halo) services — the reactive, hook-based
4
+ consumer surface that mirrors `@dxos/react-client`'s HALO/space hooks but is
5
+ backed by the HALO Effect services instead of `@dxos/client` directly.
6
+
7
+ Provide the services once via `HaloProvider`, then use the hooks anywhere below
8
+ it. See [`../halo/CONSUMER_MIGRATION.md`](../halo/CONSUMER_MIGRATION.md) for the
9
+ hook-by-hook migration guide.
10
+
11
+ ```tsx
12
+ import { Context } from 'effect';
13
+ import { Identity, Space } from '@dxos/halo';
14
+ import { makeIdentityService, makeSpaceService } from '@dxos/halo-adapter-client';
15
+ import { HaloProvider, useIdentity, useSpaces } from '@dxos/halo-react';
16
+
17
+ const services = Context.empty().pipe(
18
+ Context.add(Identity.Service, makeIdentityService(client)),
19
+ Context.add(Space.Service, makeSpaceService(client)),
20
+ );
21
+
22
+ const App = () => (
23
+ <HaloProvider services={services}>
24
+ <Main />
25
+ </HaloProvider>
26
+ );
27
+
28
+ const Main = () => {
29
+ const identity = useIdentity();
30
+ const spaces = useSpaces();
31
+ // ...
32
+ };
33
+ ```
34
+
35
+ ## DXOS Resources
36
+
37
+ - [Website](https://dxos.org)
38
+ - [Developer Documentation](https://docs.dxos.org)
39
+ - Talk to us on [Discord](https://dxos.org/discord)
40
+
41
+ ## Contributions
42
+
43
+ Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
44
+
45
+ License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2026 © DXOS
@@ -0,0 +1,132 @@
1
+ // src/HaloProvider.tsx
2
+ import React, { createContext, useContext } from "react";
3
+ var HaloServicesContext = /* @__PURE__ */ createContext(void 0);
4
+ var HaloProvider = ({ services, children }) => /* @__PURE__ */ React.createElement(HaloServicesContext.Provider, {
5
+ value: services
6
+ }, children);
7
+ var useHaloServices = () => {
8
+ const services = useContext(HaloServicesContext);
9
+ if (!services) {
10
+ throw new Error("Missing HaloProvider.");
11
+ }
12
+ return services;
13
+ };
14
+
15
+ // src/useCredentials.ts
16
+ import { Atom, Result, useAtomValue } from "@effect-atom/atom-react";
17
+ import * as Stream from "effect/Stream";
18
+ import { useMemo } from "react";
19
+ import { Identity } from "@dxos/halo";
20
+ var EMPTY = [];
21
+ var useCredentials = () => {
22
+ const services = useHaloServices();
23
+ const atom = useMemo(() => Atom.make(Identity.credentials.pipe(Stream.provideContext(services))), [
24
+ services
25
+ ]);
26
+ return Result.getOrElse(useAtomValue(atom), () => EMPTY);
27
+ };
28
+
29
+ // src/useDevices.ts
30
+ import { Atom as Atom2, Result as Result2, useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
31
+ import * as Stream2 from "effect/Stream";
32
+ import { useMemo as useMemo2 } from "react";
33
+ import { Identity as Identity2 } from "@dxos/halo";
34
+ var EMPTY2 = [];
35
+ var useDevices = () => {
36
+ const services = useHaloServices();
37
+ const atom = useMemo2(() => Atom2.make(Identity2.devices.pipe(Stream2.provideContext(services))), [
38
+ services
39
+ ]);
40
+ return Result2.getOrElse(useAtomValue2(atom), () => EMPTY2);
41
+ };
42
+
43
+ // src/useIdentity.ts
44
+ import { Atom as Atom3, Result as Result3, useAtomValue as useAtomValue3 } from "@effect-atom/atom-react";
45
+ import * as Option from "effect/Option";
46
+ import * as Stream3 from "effect/Stream";
47
+ import { useMemo as useMemo3 } from "react";
48
+ import { Identity as Identity3 } from "@dxos/halo";
49
+ var useIdentity = () => {
50
+ const services = useHaloServices();
51
+ const atom = useMemo3(() => Atom3.make(Identity3.identity.pipe(Stream3.provideContext(services), Stream3.map(Option.getOrUndefined))), [
52
+ services
53
+ ]);
54
+ return Result3.getOrElse(useAtomValue3(atom), () => void 0);
55
+ };
56
+
57
+ // src/useInvitations.ts
58
+ import { Atom as Atom4, Result as Result4, useAtomValue as useAtomValue4 } from "@effect-atom/atom-react";
59
+ import * as Stream4 from "effect/Stream";
60
+ import { useMemo as useMemo4 } from "react";
61
+ import { Identity as Identity4, Space } from "@dxos/halo";
62
+ var EMPTY3 = [];
63
+ var useSpaceInvitations = (spaceId) => {
64
+ const services = useHaloServices();
65
+ const atom = useMemo4(() => Atom4.make((spaceId ? Space.invitations(spaceId) : Stream4.empty).pipe(Stream4.provideContext(services))), [
66
+ services,
67
+ spaceId
68
+ ]);
69
+ return Result4.getOrElse(useAtomValue4(atom), () => EMPTY3);
70
+ };
71
+ var useHaloInvitations = () => {
72
+ const services = useHaloServices();
73
+ const atom = useMemo4(() => Atom4.make(Identity4.invitations.pipe(Stream4.provideContext(services))), [
74
+ services
75
+ ]);
76
+ return Result4.getOrElse(useAtomValue4(atom), () => EMPTY3);
77
+ };
78
+
79
+ // src/useMembers.ts
80
+ import { Atom as Atom5, Result as Result5, useAtomValue as useAtomValue5 } from "@effect-atom/atom-react";
81
+ import * as Stream5 from "effect/Stream";
82
+ import { useMemo as useMemo5 } from "react";
83
+ import { Space as Space2 } from "@dxos/halo";
84
+ var EMPTY4 = [];
85
+ var useMembers = (spaceId) => {
86
+ const services = useHaloServices();
87
+ const atom = useMemo5(() => Atom5.make((spaceId ? Space2.members(spaceId) : Stream5.empty).pipe(Stream5.provideContext(services))), [
88
+ services,
89
+ spaceId
90
+ ]);
91
+ return Result5.getOrElse(useAtomValue5(atom), () => EMPTY4);
92
+ };
93
+
94
+ // src/useSpaces.ts
95
+ import { Atom as Atom6, Result as Result6, useAtomValue as useAtomValue6 } from "@effect-atom/atom-react";
96
+ import * as Stream6 from "effect/Stream";
97
+ import { useMemo as useMemo6 } from "react";
98
+ import { Space as Space3 } from "@dxos/halo";
99
+ var EMPTY5 = [];
100
+ var useSpaces = ({ all = false } = {}) => {
101
+ const services = useHaloServices();
102
+ const atom = useMemo6(() => Atom6.make(Space3.spaces.pipe(Stream6.provideContext(services))), [
103
+ services
104
+ ]);
105
+ const spaces = Result6.getOrElse(useAtomValue6(atom), () => EMPTY5);
106
+ return useMemo6(() => all ? spaces : spaces.filter((space) => space.state === "ready"), [
107
+ spaces,
108
+ all
109
+ ]);
110
+ };
111
+ var useSpace = (spaceId) => {
112
+ const spaces = useSpaces({
113
+ all: true
114
+ });
115
+ return useMemo6(() => spaceId ? spaces.find((space) => space.id === spaceId) : void 0, [
116
+ spaces,
117
+ spaceId
118
+ ]);
119
+ };
120
+ export {
121
+ HaloProvider,
122
+ useCredentials,
123
+ useDevices,
124
+ useHaloInvitations,
125
+ useHaloServices,
126
+ useIdentity,
127
+ useMembers,
128
+ useSpace,
129
+ useSpaceInvitations,
130
+ useSpaces
131
+ };
132
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/HaloProvider.tsx", "../../../src/useCredentials.ts", "../../../src/useDevices.ts", "../../../src/useIdentity.ts", "../../../src/useInvitations.ts", "../../../src/useMembers.ts", "../../../src/useSpaces.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport React, { type PropsWithChildren, createContext, useContext } from 'react';\n\nimport { type Identity, type Space } from '@dxos/halo';\n\n/**\n * The HALO services, as the tag union carried in an Effect service {@link Context.Context}.\n */\nexport type HaloServices = Identity.Service | Space.Service;\n\n/**\n * React context carrying the HALO services. Hooks read it, provide it into a service stream, and\n * surface the result through the default {@link Atom} runtime.\n */\nconst HaloServicesContext = createContext<Context.Context<HaloServices> | undefined>(undefined);\n\nexport type HaloProviderProps = PropsWithChildren<{\n /**\n * The HALO services context. Build it from a concrete backing — e.g. the client adapter's\n * `makeIdentityService` / `makeSpaceService` from `@dxos/halo-adapter-client` — and pass it\n * here.\n */\n services: Context.Context<HaloServices>;\n}>;\n\n/**\n * Provides the HALO services to the hook library. Wrap the application (or the subtree that uses\n * the hooks) in this provider. Replaces `ClientProvider` for HALO concerns.\n */\nexport const HaloProvider = ({ services, children }: HaloProviderProps) => (\n <HaloServicesContext.Provider value={services}>{children}</HaloServicesContext.Provider>\n);\n\n/**\n * Returns the HALO services context. Throws if no {@link HaloProvider} is above in the tree.\n */\nexport const useHaloServices = (): Context.Context<HaloServices> => {\n const services = useContext(HaloServicesContext);\n if (!services) {\n throw new Error('Missing HaloProvider.');\n }\n return services;\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Identity } from '@dxos/halo';\n\nimport { useHaloServices } from './HaloProvider';\n\nconst EMPTY: readonly Identity.Credential[] = [];\n\n/**\n * Returns the local identity's HALO credentials. Reactive: re-renders when credentials are\n * written. Replaces `@dxos/react-client`'s `useCredentials`.\n */\nexport const useCredentials = (): readonly Identity.Credential[] => {\n const services = useHaloServices();\n const atom = useMemo(() => Atom.make(Identity.credentials.pipe(Stream.provideContext(services))), [services]);\n return Result.getOrElse(useAtomValue(atom), () => EMPTY);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Identity } from '@dxos/halo';\n\nimport { useHaloServices } from './HaloProvider';\n\nconst EMPTY: readonly Identity.DeviceInfo[] = [];\n\n/**\n * Returns the devices belonging to the local identity. Reactive. Replaces\n * `@dxos/react-client`'s `useDevices`.\n */\nexport const useDevices = (): readonly Identity.DeviceInfo[] => {\n const services = useHaloServices();\n const atom = useMemo(() => Atom.make(Identity.devices.pipe(Stream.provideContext(services))), [services]);\n return Result.getOrElse(useAtomValue(atom), () => EMPTY);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Identity } from '@dxos/halo';\n\nimport { useHaloServices } from './HaloProvider';\n\n/**\n * Returns the local identity, or `undefined` if none exists. Reactive: re-renders when the\n * identity is created or its profile changes. Replaces `@dxos/react-client`'s `useIdentity`.\n */\nexport const useIdentity = (): Identity.Info | undefined => {\n const services = useHaloServices();\n const atom = useMemo(\n () => Atom.make(Identity.identity.pipe(Stream.provideContext(services), Stream.map(Option.getOrUndefined))),\n [services],\n );\n return Result.getOrElse(useAtomValue(atom), () => undefined);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Identity, type Invitation, Space } from '@dxos/halo';\nimport { type SpaceId } from '@dxos/keys';\n\nimport { useHaloServices } from './HaloProvider';\n\nconst EMPTY: readonly Invitation.Flow[] = [];\n\n/**\n * Returns the active (host-created) invitation flows for a space. Reactive. Replaces\n * `@dxos/react-client`'s `useSpaceInvitations`. Drive an individual flow through the\n * `Invitation` verbs (`events` / `authenticate` / `cancel` / `code`).\n */\nexport const useSpaceInvitations = (spaceId?: SpaceId): readonly Invitation.Flow[] => {\n const services = useHaloServices();\n const atom = useMemo(\n () => Atom.make((spaceId ? Space.invitations(spaceId) : Stream.empty).pipe(Stream.provideContext(services))),\n [services, spaceId],\n );\n return Result.getOrElse(useAtomValue(atom), () => EMPTY);\n};\n\n/**\n * Returns the active device-invitation flows for the local identity. Reactive. Replaces\n * `useHaloInvitations`.\n */\nexport const useHaloInvitations = (): readonly Invitation.Flow[] => {\n const services = useHaloServices();\n const atom = useMemo(() => Atom.make(Identity.invitations.pipe(Stream.provideContext(services))), [services]);\n return Result.getOrElse(useAtomValue(atom), () => EMPTY);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Space } from '@dxos/halo';\nimport { type SpaceId } from '@dxos/keys';\n\nimport { useHaloServices } from './HaloProvider';\n\nconst EMPTY: readonly Space.Member[] = [];\n\n/**\n * Returns the membership of a space. Reactive: re-renders on join/leave/role/presence changes.\n * Replaces `@dxos/react-client`'s `useMembers` (which took a `PublicKey`; this takes a\n * {@link SpaceId}).\n */\nexport const useMembers = (spaceId?: SpaceId): readonly Space.Member[] => {\n const services = useHaloServices();\n const atom = useMemo(\n () => Atom.make((spaceId ? Space.members(spaceId) : Stream.empty).pipe(Stream.provideContext(services))),\n [services, spaceId],\n );\n return Result.getOrElse(useAtomValue(atom), () => EMPTY);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Space } from '@dxos/halo';\nimport { type SpaceId } from '@dxos/keys';\n\nimport { useHaloServices } from './HaloProvider';\n\nconst EMPTY: readonly Space.Info[] = [];\n\nexport type UseSpacesOptions = {\n /** Include spaces that are not yet `ready` (default: only `ready` spaces). */\n all?: boolean;\n};\n\n/**\n * Returns the spaces known to the local identity. By default only `ready` spaces are returned;\n * pass `{ all: true }` for every space. Reactive. Replaces `@dxos/react-client`'s `useSpaces`.\n */\nexport const useSpaces = ({ all = false }: UseSpacesOptions = {}): readonly Space.Info[] => {\n const services = useHaloServices();\n const atom = useMemo(() => Atom.make(Space.spaces.pipe(Stream.provideContext(services))), [services]);\n const spaces = Result.getOrElse(useAtomValue(atom), () => EMPTY);\n return useMemo(() => (all ? spaces : spaces.filter((space) => space.state === 'ready')), [spaces, all]);\n};\n\n/**\n * Resolves a single space by id, or `undefined`. Reactive. Replaces `useSpace`. Unlike the\n * legacy hook this takes a {@link SpaceId} only (no `PublicKey`).\n */\nexport const useSpace = (spaceId?: SpaceId): Space.Info | undefined => {\n const spaces = useSpaces({ all: true });\n return useMemo(() => (spaceId ? spaces.find((space) => space.id === spaceId) : undefined), [spaces, spaceId]);\n};\n"],
5
+ "mappings": ";AAKA,OAAOA,SAAiCC,eAAeC,kBAAkB;AAazE,IAAMC,sBAAsBF,8BAAyDG,MAAAA;AAe9E,IAAMC,eAAe,CAAC,EAAEC,UAAUC,SAAQ,MAC/C,sBAAA,cAACJ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AAQ;AAErB,SAAOY,QAAOC,UAAUC,cAAaX,IAAAA,GAAO,MAAML,MAAAA;AACpD;;;ACvBA,SAASiB,QAAAA,OAAMC,UAAAA,SAAQC,gBAAAA,qBAAoB;AAC3C,YAAYC,aAAY;AACxB,SAASC,WAAAA,gBAAe;AAExB,SAASC,SAAAA,cAAa;AAKtB,IAAMC,SAA+B,CAAA;AAW9B,IAAMC,YAAY,CAAC,EAAEC,MAAM,MAAK,IAAuB,CAAC,MAAC;AAC9D,QAAMC,WAAWC,gBAAAA;AACjB,QAAMC,OAAOC,SAAQ,MAAMC,MAAKC,KAAKC,OAAMC,OAAOC,KAAYC,uBAAeT,QAAAA,CAAAA,CAAAA,GAAa;IAACA;GAAS;AACpG,QAAMO,SAASG,QAAOC,UAAUC,cAAaV,IAAAA,GAAO,MAAML,MAAAA;AAC1D,SAAOM,SAAQ,MAAOJ,MAAMQ,SAASA,OAAOM,OAAO,CAACC,UAAUA,MAAMC,UAAU,OAAA,GAAW;IAACR;IAAQR;GAAI;AACxG;AAMO,IAAMiB,WAAW,CAACC,YAAAA;AACvB,QAAMV,SAAST,UAAU;IAAEC,KAAK;EAAK,CAAA;AACrC,SAAOI,SAAQ,MAAOc,UAAUV,OAAOW,KAAK,CAACJ,UAAUA,MAAMK,OAAOF,OAAAA,IAAWG,QAAY;IAACb;IAAQU;GAAQ;AAC9G;",
6
+ "names": ["React", "createContext", "useContext", "HaloServicesContext", "undefined", "HaloProvider", "services", "children", "Provider", "value", "useHaloServices", "Error", "Atom", "Result", "useAtomValue", "Stream", "useMemo", "Identity", "EMPTY", "useCredentials", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Identity", "credentials", "pipe", "provideContext", "Result", "getOrElse", "useAtomValue", "Atom", "Result", "useAtomValue", "Stream", "useMemo", "Identity", "EMPTY", "useDevices", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Identity", "devices", "pipe", "provideContext", "Result", "getOrElse", "useAtomValue", "Atom", "Result", "useAtomValue", "Option", "Stream", "useMemo", "Identity", "useIdentity", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Identity", "identity", "pipe", "provideContext", "map", "getOrUndefined", "Result", "getOrElse", "useAtomValue", "undefined", "Atom", "Result", "useAtomValue", "Stream", "useMemo", "Identity", "Space", "EMPTY", "useSpaceInvitations", "spaceId", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Space", "invitations", "empty", "pipe", "provideContext", "Result", "getOrElse", "useAtomValue", "useHaloInvitations", "Identity", "Atom", "Result", "useAtomValue", "Stream", "useMemo", "Space", "EMPTY", "useMembers", "spaceId", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Space", "members", "empty", "pipe", "provideContext", "Result", "getOrElse", "useAtomValue", "Atom", "Result", "useAtomValue", "Stream", "useMemo", "Space", "EMPTY", "useSpaces", "all", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Space", "spaces", "pipe", "provideContext", "Result", "getOrElse", "useAtomValue", "filter", "space", "state", "useSpace", "spaceId", "find", "id", "undefined"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"src/HaloProvider.tsx":{"bytes":4067,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/useCredentials.ts":{"bytes":2751,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/useDevices.ts":{"bytes":2624,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/useIdentity.ts":{"bytes":3007,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/useInvitations.ts":{"bytes":4621,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/useMembers.ts":{"bytes":3124,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/useSpaces.ts":{"bytes":4853,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/index.ts":{"bytes":972,"imports":[{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"},{"path":"src/useCredentials.ts","kind":"import-statement","original":"./useCredentials"},{"path":"src/useDevices.ts","kind":"import-statement","original":"./useDevices"},{"path":"src/useIdentity.ts","kind":"import-statement","original":"./useIdentity"},{"path":"src/useInvitations.ts","kind":"import-statement","original":"./useInvitations"},{"path":"src/useMembers.ts","kind":"import-statement","original":"./useMembers"},{"path":"src/useSpaces.ts","kind":"import-statement","original":"./useSpaces"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13111},"dist/lib/browser/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true}],"exports":["HaloProvider","useCredentials","useDevices","useHaloInvitations","useHaloServices","useIdentity","useMembers","useSpace","useSpaceInvitations","useSpaces"],"entryPoint":"src/index.ts","inputs":{"src/HaloProvider.tsx":{"bytesInOutput":443},"src/index.ts":{"bytesInOutput":0},"src/useCredentials.ts":{"bytesInOutput":450},"src/useDevices.ts":{"bytesInOutput":513},"src/useIdentity.ts":{"bytesInOutput":575},"src/useInvitations.ts":{"bytesInOutput":848},"src/useMembers.ts":{"bytesInOutput":561},"src/useSpaces.ts":{"bytesInOutput":851}},"bytes":4617}}}
@@ -0,0 +1,134 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // src/HaloProvider.tsx
4
+ import React, { createContext, useContext } from "react";
5
+ var HaloServicesContext = /* @__PURE__ */ createContext(void 0);
6
+ var HaloProvider = ({ services, children }) => /* @__PURE__ */ React.createElement(HaloServicesContext.Provider, {
7
+ value: services
8
+ }, children);
9
+ var useHaloServices = () => {
10
+ const services = useContext(HaloServicesContext);
11
+ if (!services) {
12
+ throw new Error("Missing HaloProvider.");
13
+ }
14
+ return services;
15
+ };
16
+
17
+ // src/useCredentials.ts
18
+ import { Atom, Result, useAtomValue } from "@effect-atom/atom-react";
19
+ import * as Stream from "effect/Stream";
20
+ import { useMemo } from "react";
21
+ import { Identity } from "@dxos/halo";
22
+ var EMPTY = [];
23
+ var useCredentials = () => {
24
+ const services = useHaloServices();
25
+ const atom = useMemo(() => Atom.make(Identity.credentials.pipe(Stream.provideContext(services))), [
26
+ services
27
+ ]);
28
+ return Result.getOrElse(useAtomValue(atom), () => EMPTY);
29
+ };
30
+
31
+ // src/useDevices.ts
32
+ import { Atom as Atom2, Result as Result2, useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
33
+ import * as Stream2 from "effect/Stream";
34
+ import { useMemo as useMemo2 } from "react";
35
+ import { Identity as Identity2 } from "@dxos/halo";
36
+ var EMPTY2 = [];
37
+ var useDevices = () => {
38
+ const services = useHaloServices();
39
+ const atom = useMemo2(() => Atom2.make(Identity2.devices.pipe(Stream2.provideContext(services))), [
40
+ services
41
+ ]);
42
+ return Result2.getOrElse(useAtomValue2(atom), () => EMPTY2);
43
+ };
44
+
45
+ // src/useIdentity.ts
46
+ import { Atom as Atom3, Result as Result3, useAtomValue as useAtomValue3 } from "@effect-atom/atom-react";
47
+ import * as Option from "effect/Option";
48
+ import * as Stream3 from "effect/Stream";
49
+ import { useMemo as useMemo3 } from "react";
50
+ import { Identity as Identity3 } from "@dxos/halo";
51
+ var useIdentity = () => {
52
+ const services = useHaloServices();
53
+ const atom = useMemo3(() => Atom3.make(Identity3.identity.pipe(Stream3.provideContext(services), Stream3.map(Option.getOrUndefined))), [
54
+ services
55
+ ]);
56
+ return Result3.getOrElse(useAtomValue3(atom), () => void 0);
57
+ };
58
+
59
+ // src/useInvitations.ts
60
+ import { Atom as Atom4, Result as Result4, useAtomValue as useAtomValue4 } from "@effect-atom/atom-react";
61
+ import * as Stream4 from "effect/Stream";
62
+ import { useMemo as useMemo4 } from "react";
63
+ import { Identity as Identity4, Space } from "@dxos/halo";
64
+ var EMPTY3 = [];
65
+ var useSpaceInvitations = (spaceId) => {
66
+ const services = useHaloServices();
67
+ const atom = useMemo4(() => Atom4.make((spaceId ? Space.invitations(spaceId) : Stream4.empty).pipe(Stream4.provideContext(services))), [
68
+ services,
69
+ spaceId
70
+ ]);
71
+ return Result4.getOrElse(useAtomValue4(atom), () => EMPTY3);
72
+ };
73
+ var useHaloInvitations = () => {
74
+ const services = useHaloServices();
75
+ const atom = useMemo4(() => Atom4.make(Identity4.invitations.pipe(Stream4.provideContext(services))), [
76
+ services
77
+ ]);
78
+ return Result4.getOrElse(useAtomValue4(atom), () => EMPTY3);
79
+ };
80
+
81
+ // src/useMembers.ts
82
+ import { Atom as Atom5, Result as Result5, useAtomValue as useAtomValue5 } from "@effect-atom/atom-react";
83
+ import * as Stream5 from "effect/Stream";
84
+ import { useMemo as useMemo5 } from "react";
85
+ import { Space as Space2 } from "@dxos/halo";
86
+ var EMPTY4 = [];
87
+ var useMembers = (spaceId) => {
88
+ const services = useHaloServices();
89
+ const atom = useMemo5(() => Atom5.make((spaceId ? Space2.members(spaceId) : Stream5.empty).pipe(Stream5.provideContext(services))), [
90
+ services,
91
+ spaceId
92
+ ]);
93
+ return Result5.getOrElse(useAtomValue5(atom), () => EMPTY4);
94
+ };
95
+
96
+ // src/useSpaces.ts
97
+ import { Atom as Atom6, Result as Result6, useAtomValue as useAtomValue6 } from "@effect-atom/atom-react";
98
+ import * as Stream6 from "effect/Stream";
99
+ import { useMemo as useMemo6 } from "react";
100
+ import { Space as Space3 } from "@dxos/halo";
101
+ var EMPTY5 = [];
102
+ var useSpaces = ({ all = false } = {}) => {
103
+ const services = useHaloServices();
104
+ const atom = useMemo6(() => Atom6.make(Space3.spaces.pipe(Stream6.provideContext(services))), [
105
+ services
106
+ ]);
107
+ const spaces = Result6.getOrElse(useAtomValue6(atom), () => EMPTY5);
108
+ return useMemo6(() => all ? spaces : spaces.filter((space) => space.state === "ready"), [
109
+ spaces,
110
+ all
111
+ ]);
112
+ };
113
+ var useSpace = (spaceId) => {
114
+ const spaces = useSpaces({
115
+ all: true
116
+ });
117
+ return useMemo6(() => spaceId ? spaces.find((space) => space.id === spaceId) : void 0, [
118
+ spaces,
119
+ spaceId
120
+ ]);
121
+ };
122
+ export {
123
+ HaloProvider,
124
+ useCredentials,
125
+ useDevices,
126
+ useHaloInvitations,
127
+ useHaloServices,
128
+ useIdentity,
129
+ useMembers,
130
+ useSpace,
131
+ useSpaceInvitations,
132
+ useSpaces
133
+ };
134
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/HaloProvider.tsx", "../../../src/useCredentials.ts", "../../../src/useDevices.ts", "../../../src/useIdentity.ts", "../../../src/useInvitations.ts", "../../../src/useMembers.ts", "../../../src/useSpaces.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport React, { type PropsWithChildren, createContext, useContext } from 'react';\n\nimport { type Identity, type Space } from '@dxos/halo';\n\n/**\n * The HALO services, as the tag union carried in an Effect service {@link Context.Context}.\n */\nexport type HaloServices = Identity.Service | Space.Service;\n\n/**\n * React context carrying the HALO services. Hooks read it, provide it into a service stream, and\n * surface the result through the default {@link Atom} runtime.\n */\nconst HaloServicesContext = createContext<Context.Context<HaloServices> | undefined>(undefined);\n\nexport type HaloProviderProps = PropsWithChildren<{\n /**\n * The HALO services context. Build it from a concrete backing — e.g. the client adapter's\n * `makeIdentityService` / `makeSpaceService` from `@dxos/halo-adapter-client` — and pass it\n * here.\n */\n services: Context.Context<HaloServices>;\n}>;\n\n/**\n * Provides the HALO services to the hook library. Wrap the application (or the subtree that uses\n * the hooks) in this provider. Replaces `ClientProvider` for HALO concerns.\n */\nexport const HaloProvider = ({ services, children }: HaloProviderProps) => (\n <HaloServicesContext.Provider value={services}>{children}</HaloServicesContext.Provider>\n);\n\n/**\n * Returns the HALO services context. Throws if no {@link HaloProvider} is above in the tree.\n */\nexport const useHaloServices = (): Context.Context<HaloServices> => {\n const services = useContext(HaloServicesContext);\n if (!services) {\n throw new Error('Missing HaloProvider.');\n }\n return services;\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Identity } from '@dxos/halo';\n\nimport { useHaloServices } from './HaloProvider';\n\nconst EMPTY: readonly Identity.Credential[] = [];\n\n/**\n * Returns the local identity's HALO credentials. Reactive: re-renders when credentials are\n * written. Replaces `@dxos/react-client`'s `useCredentials`.\n */\nexport const useCredentials = (): readonly Identity.Credential[] => {\n const services = useHaloServices();\n const atom = useMemo(() => Atom.make(Identity.credentials.pipe(Stream.provideContext(services))), [services]);\n return Result.getOrElse(useAtomValue(atom), () => EMPTY);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Identity } from '@dxos/halo';\n\nimport { useHaloServices } from './HaloProvider';\n\nconst EMPTY: readonly Identity.DeviceInfo[] = [];\n\n/**\n * Returns the devices belonging to the local identity. Reactive. Replaces\n * `@dxos/react-client`'s `useDevices`.\n */\nexport const useDevices = (): readonly Identity.DeviceInfo[] => {\n const services = useHaloServices();\n const atom = useMemo(() => Atom.make(Identity.devices.pipe(Stream.provideContext(services))), [services]);\n return Result.getOrElse(useAtomValue(atom), () => EMPTY);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Identity } from '@dxos/halo';\n\nimport { useHaloServices } from './HaloProvider';\n\n/**\n * Returns the local identity, or `undefined` if none exists. Reactive: re-renders when the\n * identity is created or its profile changes. Replaces `@dxos/react-client`'s `useIdentity`.\n */\nexport const useIdentity = (): Identity.Info | undefined => {\n const services = useHaloServices();\n const atom = useMemo(\n () => Atom.make(Identity.identity.pipe(Stream.provideContext(services), Stream.map(Option.getOrUndefined))),\n [services],\n );\n return Result.getOrElse(useAtomValue(atom), () => undefined);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Identity, type Invitation, Space } from '@dxos/halo';\nimport { type SpaceId } from '@dxos/keys';\n\nimport { useHaloServices } from './HaloProvider';\n\nconst EMPTY: readonly Invitation.Flow[] = [];\n\n/**\n * Returns the active (host-created) invitation flows for a space. Reactive. Replaces\n * `@dxos/react-client`'s `useSpaceInvitations`. Drive an individual flow through the\n * `Invitation` verbs (`events` / `authenticate` / `cancel` / `code`).\n */\nexport const useSpaceInvitations = (spaceId?: SpaceId): readonly Invitation.Flow[] => {\n const services = useHaloServices();\n const atom = useMemo(\n () => Atom.make((spaceId ? Space.invitations(spaceId) : Stream.empty).pipe(Stream.provideContext(services))),\n [services, spaceId],\n );\n return Result.getOrElse(useAtomValue(atom), () => EMPTY);\n};\n\n/**\n * Returns the active device-invitation flows for the local identity. Reactive. Replaces\n * `useHaloInvitations`.\n */\nexport const useHaloInvitations = (): readonly Invitation.Flow[] => {\n const services = useHaloServices();\n const atom = useMemo(() => Atom.make(Identity.invitations.pipe(Stream.provideContext(services))), [services]);\n return Result.getOrElse(useAtomValue(atom), () => EMPTY);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Space } from '@dxos/halo';\nimport { type SpaceId } from '@dxos/keys';\n\nimport { useHaloServices } from './HaloProvider';\n\nconst EMPTY: readonly Space.Member[] = [];\n\n/**\n * Returns the membership of a space. Reactive: re-renders on join/leave/role/presence changes.\n * Replaces `@dxos/react-client`'s `useMembers` (which took a `PublicKey`; this takes a\n * {@link SpaceId}).\n */\nexport const useMembers = (spaceId?: SpaceId): readonly Space.Member[] => {\n const services = useHaloServices();\n const atom = useMemo(\n () => Atom.make((spaceId ? Space.members(spaceId) : Stream.empty).pipe(Stream.provideContext(services))),\n [services, spaceId],\n );\n return Result.getOrElse(useAtomValue(atom), () => EMPTY);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, Result, useAtomValue } from '@effect-atom/atom-react';\nimport * as Stream from 'effect/Stream';\nimport { useMemo } from 'react';\n\nimport { Space } from '@dxos/halo';\nimport { type SpaceId } from '@dxos/keys';\n\nimport { useHaloServices } from './HaloProvider';\n\nconst EMPTY: readonly Space.Info[] = [];\n\nexport type UseSpacesOptions = {\n /** Include spaces that are not yet `ready` (default: only `ready` spaces). */\n all?: boolean;\n};\n\n/**\n * Returns the spaces known to the local identity. By default only `ready` spaces are returned;\n * pass `{ all: true }` for every space. Reactive. Replaces `@dxos/react-client`'s `useSpaces`.\n */\nexport const useSpaces = ({ all = false }: UseSpacesOptions = {}): readonly Space.Info[] => {\n const services = useHaloServices();\n const atom = useMemo(() => Atom.make(Space.spaces.pipe(Stream.provideContext(services))), [services]);\n const spaces = Result.getOrElse(useAtomValue(atom), () => EMPTY);\n return useMemo(() => (all ? spaces : spaces.filter((space) => space.state === 'ready')), [spaces, all]);\n};\n\n/**\n * Resolves a single space by id, or `undefined`. Reactive. Replaces `useSpace`. Unlike the\n * legacy hook this takes a {@link SpaceId} only (no `PublicKey`).\n */\nexport const useSpace = (spaceId?: SpaceId): Space.Info | undefined => {\n const spaces = useSpaces({ all: true });\n return useMemo(() => (spaceId ? spaces.find((space) => space.id === spaceId) : undefined), [spaces, spaceId]);\n};\n"],
5
+ "mappings": ";;;AAKA,OAAOA,SAAiCC,eAAeC,kBAAkB;AAazE,IAAMC,sBAAsBF,8BAAyDG,MAAAA;AAe9E,IAAMC,eAAe,CAAC,EAAEC,UAAUC,SAAQ,MAC/C,sBAAA,cAACJ,oBAAoBK,UAAQ;EAACC,OAAOH;GAAWC,QAAAA;AAM3C,IAAMG,kBAAkB,MAAA;AAC7B,QAAMJ,WAAWJ,WAAWC,mBAAAA;AAC5B,MAAI,CAACG,UAAU;AACb,UAAM,IAAIK,MAAM,uBAAA;EAClB;AACA,SAAOL;AACT;;;AC1CA,SAASM,MAAMC,QAAQC,oBAAoB;AAC3C,YAAYC,YAAY;AACxB,SAASC,eAAe;AAExB,SAASC,gBAAgB;AAIzB,IAAMC,QAAwC,CAAA;AAMvC,IAAMC,iBAAiB,MAAA;AAC5B,QAAMC,WAAWC,gBAAAA;AACjB,QAAMC,OAAOC,QAAQ,MAAMC,KAAKC,KAAKC,SAASC,YAAYC,KAAYC,sBAAeT,QAAAA,CAAAA,CAAAA,GAAa;IAACA;GAAS;AAC5G,SAAOU,OAAOC,UAAUC,aAAaV,IAAAA,GAAO,MAAMJ,KAAAA;AACpD;;;AClBA,SAASe,QAAAA,OAAMC,UAAAA,SAAQC,gBAAAA,qBAAoB;AAC3C,YAAYC,aAAY;AACxB,SAASC,WAAAA,gBAAe;AAExB,SAASC,YAAAA,iBAAgB;AAIzB,IAAMC,SAAwC,CAAA;AAMvC,IAAMC,aAAa,MAAA;AACxB,QAAMC,WAAWC,gBAAAA;AACjB,QAAMC,OAAOC,SAAQ,MAAMC,MAAKC,KAAKC,UAASC,QAAQC,KAAYC,uBAAeT,QAAAA,CAAAA,CAAAA,GAAa;IAACA;GAAS;AACxG,SAAOU,QAAOC,UAAUC,cAAaV,IAAAA,GAAO,MAAMJ,MAAAA;AACpD;;;ACl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,SAAAA,cAAa;AAKtB,IAAMC,SAAiC,CAAA;AAOhC,IAAMC,aAAa,CAACC,YAAAA;AACzB,QAAMC,WAAWC,gBAAAA;AACjB,QAAMC,OAAOC,SACX,MAAMC,MAAKC,MAAMN,UAAUO,OAAMC,QAAQR,OAAAA,IAAkBS,eAAOC,KAAYC,uBAAeV,QAAAA,CAAAA,CAAAA,GAC7F;IAACA;IAAUD;GAAQ;AAErB,SAAOY,QAAOC,UAAUC,cAAaX,IAAAA,GAAO,MAAML,MAAAA;AACpD;;;ACvBA,SAASiB,QAAAA,OAAMC,UAAAA,SAAQC,gBAAAA,qBAAoB;AAC3C,YAAYC,aAAY;AACxB,SAASC,WAAAA,gBAAe;AAExB,SAASC,SAAAA,cAAa;AAKtB,IAAMC,SAA+B,CAAA;AAW9B,IAAMC,YAAY,CAAC,EAAEC,MAAM,MAAK,IAAuB,CAAC,MAAC;AAC9D,QAAMC,WAAWC,gBAAAA;AACjB,QAAMC,OAAOC,SAAQ,MAAMC,MAAKC,KAAKC,OAAMC,OAAOC,KAAYC,uBAAeT,QAAAA,CAAAA,CAAAA,GAAa;IAACA;GAAS;AACpG,QAAMO,SAASG,QAAOC,UAAUC,cAAaV,IAAAA,GAAO,MAAML,MAAAA;AAC1D,SAAOM,SAAQ,MAAOJ,MAAMQ,SAASA,OAAOM,OAAO,CAACC,UAAUA,MAAMC,UAAU,OAAA,GAAW;IAACR;IAAQR;GAAI;AACxG;AAMO,IAAMiB,WAAW,CAACC,YAAAA;AACvB,QAAMV,SAAST,UAAU;IAAEC,KAAK;EAAK,CAAA;AACrC,SAAOI,SAAQ,MAAOc,UAAUV,OAAOW,KAAK,CAACJ,UAAUA,MAAMK,OAAOF,OAAAA,IAAWG,QAAY;IAACb;IAAQU;GAAQ;AAC9G;",
6
+ "names": ["React", "createContext", "useContext", "HaloServicesContext", "undefined", "HaloProvider", "services", "children", "Provider", "value", "useHaloServices", "Error", "Atom", "Result", "useAtomValue", "Stream", "useMemo", "Identity", "EMPTY", "useCredentials", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Identity", "credentials", "pipe", "provideContext", "Result", "getOrElse", "useAtomValue", "Atom", "Result", "useAtomValue", "Stream", "useMemo", "Identity", "EMPTY", "useDevices", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Identity", "devices", "pipe", "provideContext", "Result", "getOrElse", "useAtomValue", "Atom", "Result", "useAtomValue", "Option", "Stream", "useMemo", "Identity", "useIdentity", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Identity", "identity", "pipe", "provideContext", "map", "getOrUndefined", "Result", "getOrElse", "useAtomValue", "undefined", "Atom", "Result", "useAtomValue", "Stream", "useMemo", "Identity", "Space", "EMPTY", "useSpaceInvitations", "spaceId", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Space", "invitations", "empty", "pipe", "provideContext", "Result", "getOrElse", "useAtomValue", "useHaloInvitations", "Identity", "Atom", "Result", "useAtomValue", "Stream", "useMemo", "Space", "EMPTY", "useMembers", "spaceId", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Space", "members", "empty", "pipe", "provideContext", "Result", "getOrElse", "useAtomValue", "Atom", "Result", "useAtomValue", "Stream", "useMemo", "Space", "EMPTY", "useSpaces", "all", "services", "useHaloServices", "atom", "useMemo", "Atom", "make", "Space", "spaces", "pipe", "provideContext", "Result", "getOrElse", "useAtomValue", "filter", "space", "state", "useSpace", "spaceId", "find", "id", "undefined"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"src/HaloProvider.tsx":{"bytes":4067,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/useCredentials.ts":{"bytes":2751,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/useDevices.ts":{"bytes":2624,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/useIdentity.ts":{"bytes":3007,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/useInvitations.ts":{"bytes":4621,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/useMembers.ts":{"bytes":3124,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/useSpaces.ts":{"bytes":4853,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"}],"format":"esm"},"src/index.ts":{"bytes":972,"imports":[{"path":"src/HaloProvider.tsx","kind":"import-statement","original":"./HaloProvider"},{"path":"src/useCredentials.ts","kind":"import-statement","original":"./useCredentials"},{"path":"src/useDevices.ts","kind":"import-statement","original":"./useDevices"},{"path":"src/useIdentity.ts","kind":"import-statement","original":"./useIdentity"},{"path":"src/useInvitations.ts","kind":"import-statement","original":"./useInvitations"},{"path":"src/useMembers.ts","kind":"import-statement","original":"./useMembers"},{"path":"src/useSpaces.ts","kind":"import-statement","original":"./useSpaces"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13113},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/halo","kind":"import-statement","external":true}],"exports":["HaloProvider","useCredentials","useDevices","useHaloInvitations","useHaloServices","useIdentity","useMembers","useSpace","useSpaceInvitations","useSpaces"],"entryPoint":"src/index.ts","inputs":{"src/HaloProvider.tsx":{"bytesInOutput":443},"src/index.ts":{"bytesInOutput":0},"src/useCredentials.ts":{"bytesInOutput":450},"src/useDevices.ts":{"bytesInOutput":513},"src/useIdentity.ts":{"bytesInOutput":575},"src/useInvitations.ts":{"bytesInOutput":848},"src/useMembers.ts":{"bytesInOutput":561},"src/useSpaces.ts":{"bytesInOutput":851}},"bytes":4710}}}
@@ -0,0 +1,25 @@
1
+ import * as Context from 'effect/Context';
2
+ import React, { type PropsWithChildren } from 'react';
3
+ import { type Identity, type Space } from '@dxos/halo';
4
+ /**
5
+ * The HALO services, as the tag union carried in an Effect service {@link Context.Context}.
6
+ */
7
+ export type HaloServices = Identity.Service | Space.Service;
8
+ export type HaloProviderProps = PropsWithChildren<{
9
+ /**
10
+ * The HALO services context. Build it from a concrete backing — e.g. the client adapter's
11
+ * `makeIdentityService` / `makeSpaceService` from `@dxos/halo-adapter-client` — and pass it
12
+ * here.
13
+ */
14
+ services: Context.Context<HaloServices>;
15
+ }>;
16
+ /**
17
+ * Provides the HALO services to the hook library. Wrap the application (or the subtree that uses
18
+ * the hooks) in this provider. Replaces `ClientProvider` for HALO concerns.
19
+ */
20
+ export declare const HaloProvider: ({ services, children }: HaloProviderProps) => React.JSX.Element;
21
+ /**
22
+ * Returns the HALO services context. Throws if no {@link HaloProvider} is above in the tree.
23
+ */
24
+ export declare const useHaloServices: () => Context.Context<HaloServices>;
25
+ //# sourceMappingURL=HaloProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HaloProvider.d.ts","sourceRoot":"","sources":["../../../src/HaloProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAA6B,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAQ5D,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;IAChD;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,YAAY,2BAA4B,iBAAiB,sBAErE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,QAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAM9D,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from './HaloProvider';
2
+ export * from './useCredentials';
3
+ export * from './useDevices';
4
+ export * from './useIdentity';
5
+ export * from './useInvitations';
6
+ export * from './useMembers';
7
+ export * from './useSpaces';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Identity } from '@dxos/halo';
2
+ /**
3
+ * Returns the local identity's HALO credentials. Reactive: re-renders when credentials are
4
+ * written. Replaces `@dxos/react-client`'s `useCredentials`.
5
+ */
6
+ export declare const useCredentials: () => readonly Identity.Credential[];
7
+ //# sourceMappingURL=useCredentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCredentials.d.ts","sourceRoot":"","sources":["../../../src/useCredentials.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtC;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,SAAS,QAAQ,CAAC,UAAU,EAI7D,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Identity } from '@dxos/halo';
2
+ /**
3
+ * Returns the devices belonging to the local identity. Reactive. Replaces
4
+ * `@dxos/react-client`'s `useDevices`.
5
+ */
6
+ export declare const useDevices: () => readonly Identity.DeviceInfo[];
7
+ //# sourceMappingURL=useDevices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDevices.d.ts","sourceRoot":"","sources":["../../../src/useDevices.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtC;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAO,SAAS,QAAQ,CAAC,UAAU,EAIzD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Identity } from '@dxos/halo';
2
+ /**
3
+ * Returns the local identity, or `undefined` if none exists. Reactive: re-renders when the
4
+ * identity is created or its profile changes. Replaces `@dxos/react-client`'s `useIdentity`.
5
+ */
6
+ export declare const useIdentity: () => Identity.Info | undefined;
7
+ //# sourceMappingURL=useIdentity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIdentity.d.ts","sourceRoot":"","sources":["../../../src/useIdentity.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC;;;GAGG;AACH,eAAO,MAAM,WAAW,QAAO,QAAQ,CAAC,IAAI,GAAG,SAO9C,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type Invitation } from '@dxos/halo';
2
+ import { type SpaceId } from '@dxos/keys';
3
+ /**
4
+ * Returns the active (host-created) invitation flows for a space. Reactive. Replaces
5
+ * `@dxos/react-client`'s `useSpaceInvitations`. Drive an individual flow through the
6
+ * `Invitation` verbs (`events` / `authenticate` / `cancel` / `code`).
7
+ */
8
+ export declare const useSpaceInvitations: (spaceId?: SpaceId) => readonly Invitation.Flow[];
9
+ /**
10
+ * Returns the active device-invitation flows for the local identity. Reactive. Replaces
11
+ * `useHaloInvitations`.
12
+ */
13
+ export declare const useHaloInvitations: () => readonly Invitation.Flow[];
14
+ //# sourceMappingURL=useInvitations.d.ts.map