Files
web/packages/sdk-react/mod.ts
Dan Ditomaso e2874ba16a feat(sdk): add MeshRegistry + multi-client React providers
Phase B prep for web migration. Web holds multiple simultaneous device
connections keyed by ConnectionId, so per-slice hook migrations need a
registry-aware provider.

packages/sdk
- MeshRegistry: Map<ConnectionId, MeshClient> with signals for list/active/activeId.
  create()/get()/has()/remove()/setActive().
- First-created client auto-activates.
- remove() disconnects the client and rotates active to another entry.
- 4 vitest cases covering create, auto-activate, duplicate rejection, and remove.

packages/sdk-react
- MeshRegistryProvider + MeshRegistryContext.
- useMeshRegistry, useOptionalMeshRegistry, useActiveClient, useClientById(id).
- useClient now falls back to the registry's active client when no direct
  <MeshProvider> is present, so existing hooks work unchanged under a
  registry-backed app.

No web-facing changes in this commit; used by follow-up slice migrations.
2026-04-23 22:14:32 -04:00

32 lines
1.9 KiB
TypeScript

export { MeshProvider } from "./src/provider/MeshProvider.tsx";
export type { MeshProviderProps } from "./src/provider/MeshProvider.tsx";
export { MeshContext } from "./src/provider/MeshContext.ts";
export { MeshRegistryProvider } from "./src/provider/MeshRegistryProvider.tsx";
export type { MeshRegistryProviderProps } from "./src/provider/MeshRegistryProvider.tsx";
export { MeshRegistryContext } from "./src/provider/MeshRegistryContext.ts";
export { useClient } from "./src/adapters/useClient.ts";
export { useClientById } from "./src/adapters/useClientById.ts";
export { useActiveClient } from "./src/adapters/useActiveClient.ts";
export { useMeshRegistry, useOptionalMeshRegistry } from "./src/adapters/useMeshRegistry.ts";
export { useSignal } from "./src/adapters/useSignal.ts";
export { useSignalValue } from "./src/adapters/useSignalValue.ts";
export { useDevice } from "./src/hooks/useDevice.ts";
export type { UseDeviceResult } from "./src/hooks/useDevice.ts";
export { useConnection } from "./src/hooks/useConnection.ts";
export type { UseConnectionResult } from "./src/hooks/useConnection.ts";
export { useChat } from "./src/hooks/useChat.ts";
export type { UseChatResult } from "./src/hooks/useChat.ts";
export { useNodes } from "./src/hooks/useNodes.ts";
export { useNode } from "./src/hooks/useNode.ts";
export { useChannels, useChannel } from "./src/hooks/useChannels.ts";
export { useConfig, useModuleConfig } from "./src/hooks/useConfig.ts";
export { useTelemetry } from "./src/hooks/useTelemetry.ts";
export type { UseTelemetryResult } from "./src/hooks/useTelemetry.ts";
export { usePosition } from "./src/hooks/usePosition.ts";
export { useTraceroute } from "./src/hooks/useTraceroute.ts";
export { useFileTransfer } from "./src/hooks/useFileTransfer.ts";
export { useFavoriteNode } from "./src/hooks/useFavoriteNode.ts";
export { useIgnoreNode } from "./src/hooks/useIgnoreNode.ts";