@dxos/react-client 0.6.10 → 0.6.11-staging.32b42e4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-NLQLAARM.mjs → chunk-BLQHBTRS.mjs} +67 -39
- package/dist/lib/browser/chunk-BLQHBTRS.mjs.map +7 -0
- package/dist/lib/browser/devtools/index.mjs +6 -18
- package/dist/lib/browser/devtools/index.mjs.map +3 -3
- package/dist/lib/browser/echo/index.mjs +4 -4
- package/dist/lib/browser/echo/index.mjs.map +1 -1
- package/dist/lib/browser/halo/index.mjs +5 -5
- package/dist/lib/browser/halo/index.mjs.map +1 -1
- package/dist/lib/browser/index.mjs +4 -2
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/mesh/index.mjs +2 -2
- package/dist/lib/browser/mesh/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +108 -12
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/{chunk-E3S6YHNJ.cjs → chunk-D7WQQFA3.cjs} +62 -39
- package/dist/lib/node/chunk-D7WQQFA3.cjs.map +7 -0
- package/dist/lib/node/devtools/index.cjs +8 -20
- package/dist/lib/node/devtools/index.cjs.map +3 -3
- package/dist/lib/node/echo/index.cjs +10 -10
- package/dist/lib/node/echo/index.cjs.map +2 -2
- package/dist/lib/node/halo/index.cjs +13 -13
- package/dist/lib/node/halo/index.cjs.map +2 -2
- package/dist/lib/node/index.cjs +16 -14
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/mesh/index.cjs +4 -4
- package/dist/lib/node/mesh/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +106 -10
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/client/AgentHostingProvider.d.ts +6 -0
- package/dist/types/src/client/AgentHostingProvider.d.ts.map +1 -1
- package/dist/types/src/client/{ClientContext.d.ts → ClientProvider.d.ts} +15 -20
- package/dist/types/src/client/ClientProvider.d.ts.map +1 -0
- package/dist/types/src/client/ClientProvider.test.d.ts +2 -0
- package/dist/types/src/client/ClientProvider.test.d.ts.map +1 -0
- package/dist/types/src/client/context.d.ts +9 -0
- package/dist/types/src/client/context.d.ts.map +1 -0
- package/dist/types/src/client/index.d.ts +4 -1
- package/dist/types/src/client/index.d.ts.map +1 -1
- package/dist/types/src/client/useClient.d.ts +6 -0
- package/dist/types/src/client/useClient.d.ts.map +1 -0
- package/dist/types/src/client/useClientServices.d.ts +1 -1
- package/dist/types/src/client/useClientServices.d.ts.map +1 -1
- package/dist/types/src/client/useClientStatus.d.ts +3 -0
- package/dist/types/src/client/useClientStatus.d.ts.map +1 -0
- package/dist/types/src/devtools/useDevtools.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/testing/ClientRepeater.d.ts +6 -5
- package/dist/types/src/testing/ClientRepeater.d.ts.map +1 -1
- package/dist/types/src/testing/{decorators.stories.d.ts → ClientRepeater.stories.d.ts} +3 -3
- package/dist/types/src/testing/ClientRepeater.stories.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/util.d.ts +12 -0
- package/dist/types/src/testing/util.d.ts.map +1 -0
- package/dist/types/src/testing/withClientProvider.d.ts +26 -0
- package/dist/types/src/testing/withClientProvider.d.ts.map +1 -0
- package/dist/types/src/testing/withClientProvider.stories.d.ts +13 -0
- package/dist/types/src/testing/withClientProvider.stories.d.ts.map +1 -0
- package/package.json +23 -20
- package/src/client/AgentHostingProvider.tsx +7 -6
- package/src/client/{ClientContext.test.tsx → ClientProvider.test.tsx} +2 -1
- package/src/client/ClientProvider.tsx +156 -0
- package/src/client/context.ts +20 -0
- package/src/client/index.ts +7 -1
- package/src/client/useClient.ts +18 -0
- package/src/client/useClientServices.ts +2 -2
- package/src/client/useClientStatus.ts +21 -0
- package/src/client/useConfig.test.tsx +1 -1
- package/src/client/useConfig.ts +1 -1
- package/src/client/useShell.ts +1 -1
- package/src/client/useStatus.ts +1 -1
- package/src/devtools/useDevtools.ts +3 -7
- package/src/echo/useMembers.ts +1 -1
- package/src/echo/useSpaceInvitations.ts +1 -1
- package/src/echo/useSpaces.test.tsx +10 -34
- package/src/echo/useSpaces.ts +1 -1
- package/src/halo/useContacts.ts +1 -1
- package/src/halo/useDevices.test.tsx +3 -10
- package/src/halo/useDevices.ts +1 -1
- package/src/halo/useHaloInvitations.ts +1 -1
- package/src/halo/useIdentity.ts +1 -1
- package/src/index.ts +1 -1
- package/src/mesh/useNetworkStatus.ts +1 -1
- package/src/testing/ClientRepeater.stories.tsx +58 -0
- package/src/testing/ClientRepeater.tsx +14 -13
- package/src/testing/index.ts +1 -0
- package/src/testing/util.tsx +34 -0
- package/src/testing/withClientProvider.stories.tsx +56 -0
- package/src/testing/withClientProvider.tsx +142 -0
- package/tsconfig.json +9 -3
- package/dist/lib/browser/chunk-NLQLAARM.mjs.map +0 -7
- package/dist/lib/node/chunk-E3S6YHNJ.cjs.map +0 -7
- package/dist/types/src/client/ClientContext.d.ts.map +0 -1
- package/dist/types/src/client/ClientContext.stories.d.ts +0 -15
- package/dist/types/src/client/ClientContext.stories.d.ts.map +0 -1
- package/dist/types/src/client/ClientContext.test.d.ts +0 -2
- package/dist/types/src/client/ClientContext.test.d.ts.map +0 -1
- package/dist/types/src/testing/decorators.stories.d.ts.map +0 -1
- package/src/client/ClientContext.stories.tsx +0 -94
- package/src/client/ClientContext.tsx +0 -182
- package/src/testing/decorators.stories.tsx +0 -63
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/client/AgentHostingProvider.tsx", "../../../src/client/ClientContext.tsx", "../../../src/banner.ts", "../../../src/client/useClientServices.ts", "../../../src/client/useConfig.ts", "../../../src/client/useShell.ts", "../../../src/client/useStatus.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { createContext, type PropsWithChildren, useContext, useState } from 'react';\n\nimport { type AgentHostingProviderClient, AgentManagerClient, FakeAgentHostingProvider } from '@dxos/client';\nimport { type Halo } from '@dxos/client/halo';\nimport { type Config } from '@dxos/config';\nimport { log } from '@dxos/log';\n\nimport { useClient } from '../client';\n\n/*\n * Interface for invoking the agent hosting provider client.\n * @experimental\n */\n\nexport type AgentHostingProviderProps = { config: Config; halo: Halo };\n\nexport const AgentHostingContext = createContext<AgentHostingProviderClient | null>(null);\n\nexport const AgentHostingProvider = (props: PropsWithChildren<{}>) => {\n const client = useClient();\n const [agentHostingProviderClient] = useState(makeClient(client));\n return (\n <AgentHostingContext.Provider value={agentHostingProviderClient}> {props.children}</AgentHostingContext.Provider>\n );\n};\n\nexport const useAgentHostingClient = () => {\n return useContext(AgentHostingContext);\n};\n\nconst makeClient = ({ config, halo }: AgentHostingProviderProps) => {\n const agentHostingConfig = config.get('runtime.services.agentHosting');\n if (!agentHostingConfig) {\n log('no agent hosting configured');\n return null;\n }\n\n // TODO(nf): Dynamically discover based on runtime config.\n let agentHostingProviderClient: AgentHostingProviderClient | null = null;\n switch (agentHostingConfig.type) {\n case 'LOCAL_TESTING': {\n log('using FakeAgentHostingProvider');\n return new FakeAgentHostingProvider();\n }\n\n case 'AGENTHOSTING_API': {\n agentHostingProviderClient = new AgentManagerClient(config, halo);\n if (agentHostingProviderClient.init()) {\n return agentHostingProviderClient;\n } else {\n // Not authorized or error initializing\n return null;\n }\n }\n\n default: {\n log.error('Unknown agent hosting provider type: ' + agentHostingConfig.type);\n return null;\n }\n }\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport React, {\n type ReactNode,\n useState,\n type Context,\n createContext,\n useContext,\n useEffect,\n type FunctionComponent,\n useMemo,\n} from 'react';\n\nimport {\n Client,\n SystemStatus,\n type ClientOptions,\n type ClientServices,\n type ClientServicesProvider,\n} from '@dxos/client';\nimport { type Config } from '@dxos/config';\nimport { raise } from '@dxos/debug';\nimport { registerSignalFactory } from '@dxos/echo-signals/react';\nimport { log } from '@dxos/log';\nimport { getAsyncValue, type MaybePromise, type Provider } from '@dxos/util'; // TODO(burdon): Deprecate \"util\"?\n\nimport { printBanner } from '../banner';\n\n// TODO(burdon): Reconcile with ClientOptions.\nexport type ClientContextProps = {\n client: Client;\n\n // Optionally expose services (e.g., for devtools).\n // TODO(burdon): Can't this just be accessed via `client.services`?\n services?: ClientServices;\n\n status?: SystemStatus | null;\n};\n\nexport const ClientContext: Context<ClientContextProps | undefined> = createContext<ClientContextProps | undefined>(\n undefined,\n);\n\n/**\n * Hook returning instance of DXOS client.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useClient = () => {\n const { client } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return client;\n};\n\n/**\n * Properties for the ClientProvider.\n */\nexport type ClientProviderProps = Omit<ClientOptions, 'config' | 'services'> & {\n children?: ReactNode;\n\n /**\n * Config object or async provider.\n */\n config?: Config | Provider<Promise<Config>>;\n\n /**\n * Callback to enable the caller to create a custom ClientServicesProvider.\n *\n * Most apps won't need this.\n */\n services?: (config?: Config) => MaybePromise<ClientServicesProvider>;\n\n /**\n * Client object or async provider to enable to caller to do custom initialization.\n *\n * Most apps won't need this.\n */\n // TODO(wittjosiah): Remove async and just use to keeping reference to client?\n // (Prefering `onInitialized` for custom initialization.)\n client?: Client | Provider<Promise<Client>>;\n\n /**\n * ReactNode to display until the client is available.\n */\n // TODO(wittjosiah): Rename to `placeholder`.\n fallback?: FunctionComponent<Partial<ClientContextProps>>;\n\n /**\n * Set to false to stop default signal factory from being registered.\n */\n registerSignalFactory?: boolean;\n\n /**\n * Post initialization hook to enable to caller to do custom initialization.\n *\n * @param Client\n */\n onInitialized?: (client: Client) => MaybePromise<void>;\n};\n\n/**\n * Root component that provides the DXOS client instance to child components.\n * To be used with the `useClient` hook.\n */\nexport const ClientProvider = ({\n children,\n config: configProvider,\n services: createServices,\n client: clientProvider,\n fallback: Fallback = () => null,\n registerSignalFactory: register = true,\n onInitialized,\n ...options\n}: ClientProviderProps) => {\n useMemo(() => {\n // TODO(wittjosiah): Ideally this should be imported asynchronosly because it is optional.\n // Unfortunately, async import seemed to break signals React instrumentation.\n register && registerSignalFactory();\n }, []);\n\n const [client, setClient] = useState(clientProvider instanceof Client ? clientProvider : undefined);\n const [status, setStatus] = useState<SystemStatus | null>(null);\n const [error, setError] = useState();\n if (error) {\n throw error;\n }\n\n useEffect(() => {\n if (!client) {\n return;\n }\n\n const subscription = client.status.subscribe((status) => setStatus(status));\n return () => subscription.unsubscribe();\n }, [client, setStatus]);\n\n useEffect(() => {\n const done = async (client: Client) => {\n await client.initialize().catch(setError);\n log('client ready');\n await onInitialized?.(client);\n log('initialization complete');\n setClient(client);\n setStatus(client.status.get() ?? SystemStatus.ACTIVE);\n printBanner(client);\n };\n\n const timeout = setTimeout(async () => {\n if (clientProvider) {\n // Asynchronously request client.\n const client = await getAsyncValue(clientProvider);\n await done(client);\n } else {\n // Asynchronously construct client (config may be undefined).\n const config = await getAsyncValue(configProvider);\n log('resolved config', { config });\n const services = await createServices?.(config);\n log('created services', { services });\n const client = new Client({ config, services, ...options });\n log('created client');\n await done(client);\n }\n });\n\n return () => {\n log('clean up');\n clearTimeout(timeout);\n void client?.destroy().catch((err) => log.catch(err));\n };\n }, [clientProvider, configProvider, createServices]);\n\n if (!client || status !== SystemStatus.ACTIVE) {\n return <Fallback client={client} status={status} />;\n }\n\n // prettier-ignore\n return (\n <ClientContext.Provider value={{ client, status }}>\n {children}\n </ClientContext.Provider>\n );\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type Client } from '@dxos/client';\n\n// http://patorjk.com/software/taag/#p=testall&f=Patorjk-HeX&t=DXOS\nconst BANNER = (client: Client) => {\n const commitHash = client.config.get('runtime.app.build.commitHash');\n const hash = commitHash ? ` App Commit ${commitHash} \\n` : '';\n\n return (\n '\\n' +\n '_/\\\\/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\______/\\\\/\\\\/\\\\/\\\\/\\\\_\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\__/\\\\/\\\\_________\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\______/\\\\/\\\\______/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\___\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\__________/\\\\/\\\\_\\n' +\n '_/\\\\/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\/\\\\___\\n' +\n `\\n DXOS Client ${client.version} \\n${hash}`\n );\n};\n\nlet bannerPrinted = false;\n\nexport const printBanner = (client: Client) => {\n if (bannerPrinted) {\n return;\n }\n\n bannerPrinted = true;\n // eslint-disable-next-line no-console\n console.log(`%c${BANNER(client)}`, 'font-family: monospace;');\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport type { ClientServices } from '@dxos/client';\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './ClientContext';\n\nexport const useClientServices = (): ClientServices | undefined => {\n const { services } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return services;\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './ClientContext';\n\n/**\n * Hook returning config object used to initialize the DXOS client instance.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useConfig = () => {\n const { client } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return client.config;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type Shell, type ShellDisplay } from '@dxos/client';\n\nimport { useClient } from './ClientContext';\n\n/**\n * Helper hook to access the shell.\n */\nexport const useShell = (): Shell => {\n const client = useClient();\n return client.shell;\n};\n\n/**\n * Hook to access the shell’s display state.\n */\nexport const useShellDisplay = (): ShellDisplay => {\n const client = useClient();\n const [display, setDisplay] = useState(client.shell.display);\n useEffect(() => client.shell.onDisplayChange(setDisplay), [client]);\n return display;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { type SystemStatus } from '@dxos/client';\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './ClientContext';\n\nexport const useStatus = (): SystemStatus | null | undefined => {\n const { status } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return status;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAmF;AAEnF,oBAA8F;AAG9F,iBAAoB;ACLpB,IAAAA,gBASO;AAEP,IAAAC,iBAMO;AAEP,mBAAsB;AACtB,IAAAD,gBAAsC;AACtC,IAAAE,cAAoB;AACpB,kBAAgE;AEtBhE,IAAAF,gBAA2B;AAG3B,IAAAG,gBAAsB;ACHtB,IAAAH,gBAA2B;AAE3B,IAAAG,gBAAsB;ACFtB,IAAAH,gBAAoC;ACApC,IAAAA,gBAA2B;AAG3B,IAAAG,gBAAsB;AJAtB,IAAMC,SAAS,CAACC,WAAAA;AACd,QAAMC,aAAaD,OAAOE,OAAOC,IAAI,8BAAA;AACrC,QAAMC,OAAOH,aAAa,eAAeA,UAAAA;IAAkB;AAE3D,SACE;;;;;;;eAMkBD,OAAOK,OAAO;EAAMD,IAAAA;AAE1C;AAEA,IAAIE,gBAAgB;AAEb,IAAMC,cAAc,CAACP,WAAAA;AAC1B,MAAIM,eAAe;AACjB;EACF;AAEAA,kBAAgB;AAEhBE,UAAQC,IAAI,KAAKV,OAA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2BQ,KAAI,GAAI;AACrC,eAAOR;MACT,OAAO;AAEL,eAAO;MACT;IACF;IAEA,SAAS;AACP1D,iBAAAA,IAAI0B,MAAM,0CAA0CoC,mBAAmBC,MAAI,QAAA;;;;;;AAC3E,aAAO;IACT;EACF;AACF;",
|
|
6
|
-
"names": ["import_react", "import_client", "import_log", "import_debug", "BANNER", "client", "commitHash", "config", "get", "hash", "version", "bannerPrinted", "printBanner", "console", "log", "ClientContext", "createContext", "undefined", "useClient", "useContext", "raise", "Error", "ClientProvider", "children", "configProvider", "services", "createServices", "clientProvider", "fallback", "Fallback", "registerSignalFactory", "register", "onInitialized", "options", "useMemo", "setClient", "useState", "Client", "status", "setStatus", "error", "setError", "useEffect", "subscription", "subscribe", "unsubscribe", "done", "initialize", "catch", "SystemStatus", "ACTIVE", "timeout", "setTimeout", "getAsyncValue", "clearTimeout", "destroy", "err", "React", "Provider", "value", "useClientServices", "useConfig", "useShell", "shell", "useShellDisplay", "display", "setDisplay", "onDisplayChange", "useStatus", "AgentHostingContext", "AgentHostingProvider", "props", "agentHostingProviderClient", "makeClient", "useAgentHostingClient", "halo", "agentHostingConfig", "type", "FakeAgentHostingProvider", "AgentManagerClient", "init"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientContext.d.ts","sourceRoot":"","sources":["../../../../src/client/ClientContext.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAEd,KAAK,OAAO,EAIZ,KAAK,iBAAiB,EAEvB,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,MAAM,EACN,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAK7E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IAIf,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAEjE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,cAGrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,UAAU,CAAC,GAAG;IAC7E,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC,sBAAsB,CAAC,CAAC;IAErE;;;;OAIG;IAGH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5C;;OAEG;IAEH,QAAQ,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAE1D;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CACxD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,2KASxB,mBAAmB,sBAoErB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import '@dxos-theme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: ({ children, config: configProvider, services: createServices, client: clientProvider, fallback: Fallback, registerSignalFactory: register, onInitialized, ...options }: import("./ClientContext").ClientProviderProps) => React.JSX.Element;
|
|
6
|
-
decorators: import("@storybook/react/*").Decorator[];
|
|
7
|
-
};
|
|
8
|
-
export default _default;
|
|
9
|
-
export declare const Default: {
|
|
10
|
-
render: () => React.JSX.Element;
|
|
11
|
-
};
|
|
12
|
-
export declare const Error: {
|
|
13
|
-
render: () => React.JSX.Element;
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=ClientContext.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientContext.stories.d.ts","sourceRoot":"","sources":["../../../../src/client/ClientContext.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAA4C,MAAM,OAAO,CAAC;;;;;;AAQjE,wBAIE;AAoCF,eAAO,MAAM,OAAO;;CAMnB,CAAC;AAyBF,eAAO,MAAM,KAAK;;CAQjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientContext.test.d.ts","sourceRoot":"","sources":["../../../../src/client/ClientContext.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.stories.d.ts","sourceRoot":"","sources":["../../../../src/testing/decorators.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;AAS1B,wBAGE;AAsBF,eAAO,MAAM,UAAU;;CAEtB,CAAC;AAkBF,eAAO,MAAM,eAAe;;CAE3B,CAAC"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2021 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import React, { Component, type PropsWithChildren } from 'react';
|
|
8
|
-
|
|
9
|
-
import { fromHost } from '@dxos/client';
|
|
10
|
-
import { Config } from '@dxos/config';
|
|
11
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
12
|
-
|
|
13
|
-
import { ClientProvider, useClient } from './ClientContext';
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
title: 'react-client/ClientContext',
|
|
17
|
-
component: ClientProvider,
|
|
18
|
-
decorators: [withTheme],
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const JsonPanel = ({ value }: { value: any }) => (
|
|
22
|
-
<pre
|
|
23
|
-
style={{
|
|
24
|
-
margin: 0,
|
|
25
|
-
// code whiteSpace: 'pre-wrap',
|
|
26
|
-
// code wordBreak: 'break-all',
|
|
27
|
-
overflow: 'hidden',
|
|
28
|
-
textOverflow: 'ellipsis',
|
|
29
|
-
}}
|
|
30
|
-
>
|
|
31
|
-
{JSON.stringify(value, undefined, 2)}
|
|
32
|
-
</pre>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const TestApp = () => {
|
|
36
|
-
const client = useClient();
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<div>
|
|
40
|
-
<div style={{ padding: 1 }}>
|
|
41
|
-
<JsonPanel value={client.config} />
|
|
42
|
-
</div>
|
|
43
|
-
<div style={{ padding: 1 }}>
|
|
44
|
-
<JsonPanel value={client.toJSON()} />
|
|
45
|
-
</div>
|
|
46
|
-
<div style={{ padding: 1 }}>
|
|
47
|
-
<JsonPanel value={client.halo.identity} />
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const servicesProvider = (config?: Config) => fromHost(config);
|
|
54
|
-
|
|
55
|
-
export const Default = {
|
|
56
|
-
render: () => (
|
|
57
|
-
<ClientProvider services={servicesProvider}>
|
|
58
|
-
<TestApp />
|
|
59
|
-
</ClientProvider>
|
|
60
|
-
),
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
class ErrorBoundary extends Component<PropsWithChildren<{}>, { hasError: boolean }> {
|
|
64
|
-
constructor(props: any) {
|
|
65
|
-
super(props);
|
|
66
|
-
this.state = { hasError: false };
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static getDerivedStateFromError() {
|
|
70
|
-
// Update state so the next render will show the fallback UI.
|
|
71
|
-
return { hasError: true };
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
override render() {
|
|
75
|
-
if (this.state.hasError) {
|
|
76
|
-
// You can render any custom fallback UI
|
|
77
|
-
return <div>Runtime Error</div>;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return this.props.children;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const config = new Config({ runtime: { client: { remoteSource: 'bad-value' } } });
|
|
85
|
-
|
|
86
|
-
export const Error = {
|
|
87
|
-
render: () => (
|
|
88
|
-
<ErrorBoundary>
|
|
89
|
-
<ClientProvider config={config}>
|
|
90
|
-
<TestApp />
|
|
91
|
-
</ClientProvider>
|
|
92
|
-
</ErrorBoundary>
|
|
93
|
-
),
|
|
94
|
-
};
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2020 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, {
|
|
6
|
-
type ReactNode,
|
|
7
|
-
useState,
|
|
8
|
-
type Context,
|
|
9
|
-
createContext,
|
|
10
|
-
useContext,
|
|
11
|
-
useEffect,
|
|
12
|
-
type FunctionComponent,
|
|
13
|
-
useMemo,
|
|
14
|
-
} from 'react';
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
Client,
|
|
18
|
-
SystemStatus,
|
|
19
|
-
type ClientOptions,
|
|
20
|
-
type ClientServices,
|
|
21
|
-
type ClientServicesProvider,
|
|
22
|
-
} from '@dxos/client';
|
|
23
|
-
import { type Config } from '@dxos/config';
|
|
24
|
-
import { raise } from '@dxos/debug';
|
|
25
|
-
import { registerSignalFactory } from '@dxos/echo-signals/react';
|
|
26
|
-
import { log } from '@dxos/log';
|
|
27
|
-
import { getAsyncValue, type MaybePromise, type Provider } from '@dxos/util'; // TODO(burdon): Deprecate "util"?
|
|
28
|
-
|
|
29
|
-
import { printBanner } from '../banner';
|
|
30
|
-
|
|
31
|
-
// TODO(burdon): Reconcile with ClientOptions.
|
|
32
|
-
export type ClientContextProps = {
|
|
33
|
-
client: Client;
|
|
34
|
-
|
|
35
|
-
// Optionally expose services (e.g., for devtools).
|
|
36
|
-
// TODO(burdon): Can't this just be accessed via `client.services`?
|
|
37
|
-
services?: ClientServices;
|
|
38
|
-
|
|
39
|
-
status?: SystemStatus | null;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const ClientContext: Context<ClientContextProps | undefined> = createContext<ClientContextProps | undefined>(
|
|
43
|
-
undefined,
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Hook returning instance of DXOS client.
|
|
48
|
-
* Requires ClientContext to be set via ClientProvider.
|
|
49
|
-
*/
|
|
50
|
-
export const useClient = () => {
|
|
51
|
-
const { client } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));
|
|
52
|
-
return client;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Properties for the ClientProvider.
|
|
57
|
-
*/
|
|
58
|
-
export type ClientProviderProps = Omit<ClientOptions, 'config' | 'services'> & {
|
|
59
|
-
children?: ReactNode;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Config object or async provider.
|
|
63
|
-
*/
|
|
64
|
-
config?: Config | Provider<Promise<Config>>;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Callback to enable the caller to create a custom ClientServicesProvider.
|
|
68
|
-
*
|
|
69
|
-
* Most apps won't need this.
|
|
70
|
-
*/
|
|
71
|
-
services?: (config?: Config) => MaybePromise<ClientServicesProvider>;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Client object or async provider to enable to caller to do custom initialization.
|
|
75
|
-
*
|
|
76
|
-
* Most apps won't need this.
|
|
77
|
-
*/
|
|
78
|
-
// TODO(wittjosiah): Remove async and just use to keeping reference to client?
|
|
79
|
-
// (Prefering `onInitialized` for custom initialization.)
|
|
80
|
-
client?: Client | Provider<Promise<Client>>;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* ReactNode to display until the client is available.
|
|
84
|
-
*/
|
|
85
|
-
// TODO(wittjosiah): Rename to `placeholder`.
|
|
86
|
-
fallback?: FunctionComponent<Partial<ClientContextProps>>;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Set to false to stop default signal factory from being registered.
|
|
90
|
-
*/
|
|
91
|
-
registerSignalFactory?: boolean;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Post initialization hook to enable to caller to do custom initialization.
|
|
95
|
-
*
|
|
96
|
-
* @param Client
|
|
97
|
-
*/
|
|
98
|
-
onInitialized?: (client: Client) => MaybePromise<void>;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Root component that provides the DXOS client instance to child components.
|
|
103
|
-
* To be used with the `useClient` hook.
|
|
104
|
-
*/
|
|
105
|
-
export const ClientProvider = ({
|
|
106
|
-
children,
|
|
107
|
-
config: configProvider,
|
|
108
|
-
services: createServices,
|
|
109
|
-
client: clientProvider,
|
|
110
|
-
fallback: Fallback = () => null,
|
|
111
|
-
registerSignalFactory: register = true,
|
|
112
|
-
onInitialized,
|
|
113
|
-
...options
|
|
114
|
-
}: ClientProviderProps) => {
|
|
115
|
-
useMemo(() => {
|
|
116
|
-
// TODO(wittjosiah): Ideally this should be imported asynchronosly because it is optional.
|
|
117
|
-
// Unfortunately, async import seemed to break signals React instrumentation.
|
|
118
|
-
register && registerSignalFactory();
|
|
119
|
-
}, []);
|
|
120
|
-
|
|
121
|
-
const [client, setClient] = useState(clientProvider instanceof Client ? clientProvider : undefined);
|
|
122
|
-
const [status, setStatus] = useState<SystemStatus | null>(null);
|
|
123
|
-
const [error, setError] = useState();
|
|
124
|
-
if (error) {
|
|
125
|
-
throw error;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
useEffect(() => {
|
|
129
|
-
if (!client) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const subscription = client.status.subscribe((status) => setStatus(status));
|
|
134
|
-
return () => subscription.unsubscribe();
|
|
135
|
-
}, [client, setStatus]);
|
|
136
|
-
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
const done = async (client: Client) => {
|
|
139
|
-
await client.initialize().catch(setError);
|
|
140
|
-
log('client ready');
|
|
141
|
-
await onInitialized?.(client);
|
|
142
|
-
log('initialization complete');
|
|
143
|
-
setClient(client);
|
|
144
|
-
setStatus(client.status.get() ?? SystemStatus.ACTIVE);
|
|
145
|
-
printBanner(client);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
const timeout = setTimeout(async () => {
|
|
149
|
-
if (clientProvider) {
|
|
150
|
-
// Asynchronously request client.
|
|
151
|
-
const client = await getAsyncValue(clientProvider);
|
|
152
|
-
await done(client);
|
|
153
|
-
} else {
|
|
154
|
-
// Asynchronously construct client (config may be undefined).
|
|
155
|
-
const config = await getAsyncValue(configProvider);
|
|
156
|
-
log('resolved config', { config });
|
|
157
|
-
const services = await createServices?.(config);
|
|
158
|
-
log('created services', { services });
|
|
159
|
-
const client = new Client({ config, services, ...options });
|
|
160
|
-
log('created client');
|
|
161
|
-
await done(client);
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
return () => {
|
|
166
|
-
log('clean up');
|
|
167
|
-
clearTimeout(timeout);
|
|
168
|
-
void client?.destroy().catch((err) => log.catch(err));
|
|
169
|
-
};
|
|
170
|
-
}, [clientProvider, configProvider, createServices]);
|
|
171
|
-
|
|
172
|
-
if (!client || status !== SystemStatus.ACTIVE) {
|
|
173
|
-
return <Fallback client={client} status={status} />;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// prettier-ignore
|
|
177
|
-
return (
|
|
178
|
-
<ClientContext.Provider value={{ client, status }}>
|
|
179
|
-
{children}
|
|
180
|
-
</ClientContext.Provider>
|
|
181
|
-
);
|
|
182
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
import { type PublicKey } from '@dxos/client';
|
|
10
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
11
|
-
|
|
12
|
-
import { ClientRepeater } from './ClientRepeater';
|
|
13
|
-
import { useClient } from '../client';
|
|
14
|
-
import { useSpace } from '../echo';
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
title: 'testing/decorators',
|
|
18
|
-
decorators: [withTheme],
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const JsonPanel = ({ value }: { value: any }) => (
|
|
22
|
-
<pre
|
|
23
|
-
style={{
|
|
24
|
-
margin: 0,
|
|
25
|
-
// code whiteSpace: 'pre-wrap',
|
|
26
|
-
// code wordBreak: 'break-all',
|
|
27
|
-
overflow: 'hidden',
|
|
28
|
-
textOverflow: 'ellipsis',
|
|
29
|
-
}}
|
|
30
|
-
>
|
|
31
|
-
{JSON.stringify(value, undefined, 2)}
|
|
32
|
-
</pre>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const ClientStory = () => {
|
|
36
|
-
const client = useClient();
|
|
37
|
-
|
|
38
|
-
return <JsonPanel value={client.toJSON()} />;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const WithClient = {
|
|
42
|
-
render: () => <ClientRepeater component={ClientStory} count={2} />,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const ClientSpace = ({ spaceKey }: { spaceKey: PublicKey }) => {
|
|
46
|
-
const space = useSpace(spaceKey);
|
|
47
|
-
|
|
48
|
-
if (!space) {
|
|
49
|
-
return <>null</>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<div className='flex-1 min-w-0 p-4'>
|
|
54
|
-
<label>
|
|
55
|
-
Name <input value={space.properties.name} onChange={(event) => (space.properties.name = event.target.value)} />
|
|
56
|
-
</label>
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const WithClientSpace = {
|
|
62
|
-
render: () => <ClientRepeater component={ClientSpace} count={2} createSpace />,
|
|
63
|
-
};
|