@dxos/react-client 0.6.11-staging.e6894a4 → 0.6.12-main.5cc132e
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-ESSNDYBJ.mjs} +116 -79
- package/dist/lib/browser/chunk-ESSNDYBJ.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 -4
- package/dist/lib/browser/index.mjs.map +1 -1
- 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-N474KOAU.cjs} +102 -69
- package/dist/lib/node/chunk-N474KOAU.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 +15 -15
- package/dist/lib/node/index.cjs.map +1 -1
- 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/lib/node-esm/chunk-AL2CUQ46.mjs +163 -0
- package/dist/lib/node-esm/chunk-AL2CUQ46.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ESSNDYBJ.mjs +300 -0
- package/dist/lib/node-esm/chunk-ESSNDYBJ.mjs.map +7 -0
- package/dist/lib/node-esm/devtools/index.mjs +43 -0
- package/dist/lib/node-esm/devtools/index.mjs.map +7 -0
- package/dist/lib/node-esm/echo/index.mjs +131 -0
- package/dist/lib/node-esm/echo/index.mjs.map +7 -0
- package/dist/lib/node-esm/halo/index.mjs +99 -0
- package/dist/lib/node-esm/halo/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +32 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/invitations/index.mjs +17 -0
- package/dist/lib/node-esm/invitations/index.mjs.map +7 -0
- package/dist/lib/node-esm/mesh/index.mjs +17 -0
- package/dist/lib/node-esm/mesh/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/testing/index.mjs +165 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/lib/node-esm/worker.mjs +3 -0
- package/dist/lib/node-esm/worker.mjs.map +7 -0
- 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/ClientProvider.d.ts +108 -0
- 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 +6 -0
- package/dist/types/src/client/context.d.ts.map +1 -0
- package/dist/types/src/client/index.d.ts +4 -2
- 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/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/playwright/playwright.config.d.ts +2 -2
- package/dist/types/src/playwright/playwright.config.d.ts.map +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 +14 -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 +46 -34
- package/project.json +3 -23
- package/src/client/AgentHostingProvider.tsx +7 -6
- package/src/client/{ClientContext.test.tsx → ClientProvider.test.tsx} +9 -5
- package/src/client/ClientProvider.tsx +196 -0
- package/src/client/context.ts +20 -0
- package/src/client/index.ts +5 -2
- package/src/client/useClient.ts +18 -0
- package/src/client/useClientStatus.ts +21 -0
- package/src/client/useConfig.test.tsx +7 -11
- 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 +11 -37
- package/src/echo/useSpaces.ts +1 -1
- package/src/halo/useContacts.ts +1 -1
- package/src/halo/useDevices.test.tsx +4 -13
- 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/playwright/playwright.config.ts +13 -2
- package/src/playwright/smoke.spec.ts +5 -10
- 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 +39 -0
- package/src/testing/withClientProvider.stories.tsx +56 -0
- package/src/testing/withClientProvider.tsx +143 -0
- package/tsconfig.json +11 -3
- package/vitest.config.ts +22 -0
- 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 +0 -57
- 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/client/useClientServices.d.ts +0 -3
- package/dist/types/src/client/useClientServices.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/client/useClientServices.ts +0 -15
- package/src/testing/decorators.stories.tsx +0 -63
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/testing/index.ts", "../../../../src/testing/ClientRepeater.tsx", "../../../../src/testing/withClientProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client/testing';\n\nexport * from './ClientRepeater';\nexport * from './withClientProvider';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { useState, type FC, useEffect, useRef } from 'react';\n\nimport { Client, type PublicKey } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { TestBuilder, performInvitation } from '@dxos/client/testing';\nimport { type S } from '@dxos/echo-schema';\nimport { registerSignalFactory } from '@dxos/echo-signals/react';\nimport { faker } from '@dxos/random';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { ClientProvider } from '../client';\n\nexport type ClientRepeatedComponentProps = { id: number; count: number; spaceKey?: PublicKey };\n\nexport type ClientRepeaterProps<P extends ClientRepeatedComponentProps> = {\n className?: string;\n component: FC<ClientRepeatedComponentProps>;\n controls?: FC<{ clients: Client[] }>;\n clients?: Client[];\n count?: number;\n registerSignalFactory?: boolean;\n types?: S.Schema<any>[];\n createIdentity?: boolean;\n createSpace?: boolean;\n onCreateSpace?: (space: Space) => MaybePromise<void>;\n args?: Omit<P, 'id' | 'count'>;\n};\n\n/**\n * Utility component for Storybook stories which sets up clients for n peers.\n * The `Component` property is rendered n times, once for each peer.\n */\n// TODO(burdon): To discuss: evolve ClientRepeater with optional decorator that uses it.\n// NOTE: This is specifically not a storybook decorator because it broke stories as a decorator.\n// This seems primarily due to the fact that it required top-level await for the clients to initialize.\n// Storybook seemed to handle it alright, but Chromatic had a lot of trouble with it.\n// There was also a question of whether or not calling the story function multiple times was a good idea.\nexport const ClientRepeater = <P extends ClientRepeatedComponentProps>(props: ClientRepeaterProps<P>) => {\n const {\n component: Component,\n controls: Controls,\n count = 1,\n types,\n createIdentity,\n createSpace,\n onCreateSpace,\n } = props;\n if (props.registerSignalFactory ?? true) {\n registerSignalFactory();\n }\n\n const [clients, setClients] = useState(props.clients ?? []);\n const [spaceKey, setSpaceKey] = useState<PublicKey>();\n\n const testBuilder = useRef(new TestBuilder());\n useEffect(() => {\n const timeout = setTimeout(async () => {\n const clients = [...Array(count)].map(\n (_) => new Client({ services: testBuilder.current.createLocalClientServices() }),\n );\n await Promise.all(clients.map((client) => client.initialize()));\n types && clients.map((client) => client.addTypes(types));\n\n if (createIdentity || createSpace) {\n await Promise.all(clients.map((client) => client.halo.createIdentity()));\n }\n\n if (createSpace) {\n const space = await clients[0].spaces.create({ name: faker.commerce.productName() });\n setSpaceKey(space.key);\n await onCreateSpace?.(space);\n await Promise.all(\n clients.slice(1).flatMap((client) => performInvitation({ host: space, guest: client.spaces })),\n );\n }\n\n setClients(clients);\n });\n\n return () => clearTimeout(timeout);\n }, []);\n\n if (clients.length === 0) {\n return null;\n }\n\n return (\n <>\n {Controls && <Controls clients={clients} />}\n {clients.map((client, index) => (\n <ClientProvider key={index} client={client}>\n <Component id={index} count={clients.length} spaceKey={spaceKey} {...{ ...props.args }} />\n </ClientProvider>\n ))}\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { useRef } from 'react';\nimport { type FallbackProps, ErrorBoundary } from 'react-error-boundary';\n\nimport { Trigger } from '@dxos/async';\nimport { type Client } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { performInvitation, TestBuilder } from '@dxos/client/testing';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { ClientProvider, type ClientProviderProps } from '../client';\n\ntype InitializeProps = {\n createIdentity?: boolean;\n createSpace?: boolean;\n onSpaceCreated?: (client: Client, space: Space) => MaybePromise<void>;\n};\n\n/**\n * Initialize client, identity and first space.\n */\nconst initializeClient = async (\n client: Client,\n {\n createIdentity,\n createSpace,\n onSpaceCreated,\n onInitialized,\n }: InitializeProps & Pick<WithClientProviderProps, 'onInitialized'>,\n): Promise<Space | undefined> => {\n if (createIdentity) {\n await client.halo.createIdentity();\n }\n\n let space: Space | undefined;\n if (createSpace) {\n space = await client.spaces.create({ name: 'Test Space' });\n await onSpaceCreated?.(client, space);\n }\n\n await onInitialized?.(client);\n return space;\n};\n\nexport type WithClientProviderProps = InitializeProps & ClientProviderProps;\n\n/**\n * Decorator that provides the client context.\n */\nexport const withClientProvider = ({\n createIdentity,\n createSpace,\n onSpaceCreated,\n onInitialized,\n ...props\n}: WithClientProviderProps = {}): Decorator => {\n const handleInitialized = async (client: Client) => {\n await initializeClient(client, { createIdentity, createSpace, onSpaceCreated, onInitialized });\n };\n\n return (Story) => (\n <ErrorBoundary FallbackComponent={ErrorFallback}>\n <ClientProvider onInitialized={handleInitialized} {...props}>\n <Story />\n </ClientProvider>\n </ErrorBoundary>\n );\n};\n\n// TODO(burdon): Implement context per client for context.\n// TODO(burdon): Callback once all invitations have completed.\n// TODO(burdon): Delay/jitter for creation of other clients.\nexport type WithMultiClientProviderProps = InitializeProps & ClientProviderProps & { numClients?: number };\n\n/**\n * Decorator that creates a scaffold for multiple clients.\n * Orchestrates invitations between a randomly selected host and the remaining clients.\n * NOTE: Should come before withLayout.\n */\n// TODO(burdon): Create test.\nexport const withMultiClientProvider = ({\n numClients = 2,\n createIdentity,\n createSpace,\n onSpaceCreated,\n onInitialized,\n ...props\n}: WithMultiClientProviderProps): Decorator => {\n return (Story) => {\n const builder = useRef(new TestBuilder());\n const hostRef = useRef<Client>();\n const spaceReady = useRef(new Trigger<Space | undefined>());\n\n // Handle invitations.\n const handleClientInitialized = async (client: Client) => {\n if (createSpace) {\n if (!hostRef.current) {\n hostRef.current = client;\n const space = await initializeClient(client, { createIdentity, createSpace, onSpaceCreated, onInitialized });\n spaceReady.current.wake(space);\n } else {\n await initializeClient(client, { createIdentity, onInitialized });\n const space = await spaceReady.current.wait();\n if (space) {\n await Promise.all(performInvitation({ host: space, guest: client.spaces }));\n }\n }\n }\n };\n\n return (\n <>\n {Array.from({ length: numClients }).map((_, index) => (\n <ErrorBoundary key={index} FallbackComponent={ErrorFallback}>\n <ClientProvider\n services={builder.current.createLocalClientServices()}\n onInitialized={handleClientInitialized}\n {...props}\n >\n <Story />\n </ClientProvider>\n </ErrorBoundary>\n ))}\n </>\n );\n };\n};\n\nconst ErrorFallback = ({ error }: FallbackProps) => {\n const { name, message, stack } =\n error instanceof Error ? error : { name: 'Error', message: String(error), stack: undefined };\n return (\n <div role='alert' className='flex flex-col gap-4'>\n <h1 className='text-xl text-red-500'>{name}</h1>\n <div className='text-lg'>{message}</div>\n {stack && <pre className='text-sm text-subdued'>{stack}</pre>}\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,cAAc;;;ACAd,OAAO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EA,IAAMI,gBAAgB,CAAC,EAAE4B,MAAK,MAAiB;AAC7C,QAAM,EAAEpC,MAAMqC,SAASC,MAAK,IAC1BF,iBAAiBG,QAAQH,QAAQ;IAAEpC,MAAM;IAASqC,SAASG,OAAOJ,KAAAA;IAAQE,OAAOG;EAAU;AAC7F,SACE,gBAAApC,OAAA,cAACqC,OAAAA;IAAIC,MAAK;IAAQC,WAAU;KAC1B,gBAAAvC,OAAA,cAACwC,MAAAA;IAAGD,WAAU;KAAwB5C,IAAAA,GACtC,gBAAAK,OAAA,cAACqC,OAAAA;IAAIE,WAAU;KAAWP,OAAAA,GACzBC,SAAS,gBAAAjC,OAAA,cAACyC,OAAAA;IAAIF,WAAU;KAAwBN,KAAAA,CAAAA;AAGvD;",
|
|
6
|
+
"names": ["React", "useState", "useEffect", "useRef", "Client", "TestBuilder", "performInvitation", "registerSignalFactory", "faker", "ClientRepeater", "props", "component", "Component", "controls", "Controls", "count", "types", "createIdentity", "createSpace", "onCreateSpace", "registerSignalFactory", "clients", "setClients", "useState", "spaceKey", "setSpaceKey", "testBuilder", "useRef", "TestBuilder", "useEffect", "timeout", "setTimeout", "Array", "map", "_", "Client", "services", "current", "createLocalClientServices", "Promise", "all", "client", "initialize", "addTypes", "halo", "space", "spaces", "create", "name", "faker", "commerce", "productName", "key", "slice", "flatMap", "performInvitation", "host", "guest", "clearTimeout", "length", "index", "ClientProvider", "id", "args", "React", "useRef", "ErrorBoundary", "Trigger", "performInvitation", "TestBuilder", "initializeClient", "client", "createIdentity", "createSpace", "onSpaceCreated", "onInitialized", "halo", "space", "spaces", "create", "name", "withClientProvider", "props", "handleInitialized", "Story", "React", "ErrorBoundary", "FallbackComponent", "ErrorFallback", "ClientProvider", "withMultiClientProvider", "numClients", "builder", "useRef", "TestBuilder", "hostRef", "spaceReady", "Trigger", "handleClientInitialized", "current", "wake", "wait", "Promise", "all", "performInvitation", "host", "guest", "Array", "from", "length", "map", "_", "index", "key", "services", "createLocalClientServices", "error", "message", "stack", "Error", "String", "undefined", "div", "role", "className", "h1", "pre"]
|
|
7
|
+
}
|
|
@@ -7,6 +7,12 @@ export type AgentHostingProviderProps = {
|
|
|
7
7
|
halo: Halo;
|
|
8
8
|
};
|
|
9
9
|
export declare const AgentHostingContext: React.Context<AgentHostingProviderClient | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Experimental agent hosting provider.
|
|
12
|
+
* @param props
|
|
13
|
+
* @constructor
|
|
14
|
+
* @deprecated
|
|
15
|
+
*/
|
|
10
16
|
export declare const AgentHostingProvider: (props: PropsWithChildren<{}>) => React.JSX.Element;
|
|
11
17
|
export declare const useAgentHostingClient: () => AgentHostingProviderClient | null;
|
|
12
18
|
//# sourceMappingURL=AgentHostingProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentHostingProvider.d.ts","sourceRoot":"","sources":["../../../../src/client/AgentHostingProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAiB,KAAK,iBAAiB,EAAwB,MAAM,OAAO,CAAC;AAE3F,OAAO,EAAE,KAAK,0BAA0B,EAAgD,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"AgentHostingProvider.d.ts","sourceRoot":"","sources":["../../../../src/client/AgentHostingProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAiB,KAAK,iBAAiB,EAAwB,MAAM,OAAO,CAAC;AAE3F,OAAO,EAAE,KAAK,0BAA0B,EAAgD,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAK3C,MAAM,MAAM,yBAAyB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAEvE,eAAO,MAAM,mBAAmB,kDAAyD,CAAC;AAE1F;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,UAAW,iBAAiB,CAAC,EAAE,CAAC,sBAMhE,CAAC;AAEF,eAAO,MAAM,qBAAqB,yCAEjC,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React, { type FunctionComponent, type ReactNode } from 'react';
|
|
2
|
+
import { Client, type ClientOptions, type ClientServicesProvider } from '@dxos/client';
|
|
3
|
+
import { type Config } from '@dxos/config';
|
|
4
|
+
import { type S } from '@dxos/echo-schema';
|
|
5
|
+
import { type MaybePromise, type Provider } from '@dxos/util';
|
|
6
|
+
import { type ClientContextProps } from './context';
|
|
7
|
+
/**
|
|
8
|
+
* Properties for the ClientProvider.
|
|
9
|
+
*/
|
|
10
|
+
export type ClientProviderProps = Pick<ClientContextProps, 'status'> & Omit<ClientOptions, 'config' | 'services'> & {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Client object or async provider to enable to caller to do custom initialization.
|
|
14
|
+
*
|
|
15
|
+
* NOTE: For advanced use cases only.
|
|
16
|
+
*/
|
|
17
|
+
client?: Client | Provider<Promise<Client>>;
|
|
18
|
+
/**
|
|
19
|
+
* Config object or async provider.
|
|
20
|
+
*
|
|
21
|
+
* NOTE: If a `client` is provided then `config` is ignored.
|
|
22
|
+
*/
|
|
23
|
+
config?: Config | Provider<Promise<Config>>;
|
|
24
|
+
/**
|
|
25
|
+
* Callback to enable the caller to create a custom ClientServicesProvider.
|
|
26
|
+
*
|
|
27
|
+
* NOTE: If a `client` is provided then `services` is ignored.
|
|
28
|
+
*/
|
|
29
|
+
services?: ClientServicesProvider | ((config?: Config) => MaybePromise<ClientServicesProvider>);
|
|
30
|
+
/**
|
|
31
|
+
* List of schema to register.
|
|
32
|
+
*
|
|
33
|
+
* NOTE: If a `client` is provided then `types` will not be added until after the children are first rendered.
|
|
34
|
+
*/
|
|
35
|
+
types?: S.Schema<any>[];
|
|
36
|
+
/**
|
|
37
|
+
* ReactNode to display until the client is available.
|
|
38
|
+
*/
|
|
39
|
+
fallback?: FunctionComponent<Partial<ClientContextProps>>;
|
|
40
|
+
/**
|
|
41
|
+
* Set to false to stop default signal runtime from being registered.
|
|
42
|
+
*
|
|
43
|
+
* The signals runtime is used to provide reactive updates to ECHO objects.
|
|
44
|
+
*/
|
|
45
|
+
registerSignalRuntime?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Skip the DXOS banner print.
|
|
48
|
+
*/
|
|
49
|
+
disableBanner?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Post initialization hook to enable to caller to do custom initialization.
|
|
52
|
+
*
|
|
53
|
+
* @param Client
|
|
54
|
+
*/
|
|
55
|
+
onInitialized?: (client: Client) => MaybePromise<void>;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Root component that provides the DXOS client instance to child components.
|
|
59
|
+
* To be used with the `useClient` hook.
|
|
60
|
+
*/
|
|
61
|
+
export declare const ClientProvider: React.ForwardRefExoticComponent<Pick<ClientContextProps, "status"> & Omit<ClientOptions, "services" | "config"> & {
|
|
62
|
+
children?: ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Client object or async provider to enable to caller to do custom initialization.
|
|
65
|
+
*
|
|
66
|
+
* NOTE: For advanced use cases only.
|
|
67
|
+
*/
|
|
68
|
+
client?: Client | Provider<Promise<Client>>;
|
|
69
|
+
/**
|
|
70
|
+
* Config object or async provider.
|
|
71
|
+
*
|
|
72
|
+
* NOTE: If a `client` is provided then `config` is ignored.
|
|
73
|
+
*/
|
|
74
|
+
config?: Config | Provider<Promise<Config>>;
|
|
75
|
+
/**
|
|
76
|
+
* Callback to enable the caller to create a custom ClientServicesProvider.
|
|
77
|
+
*
|
|
78
|
+
* NOTE: If a `client` is provided then `services` is ignored.
|
|
79
|
+
*/
|
|
80
|
+
services?: ClientServicesProvider | ((config?: Config) => MaybePromise<ClientServicesProvider>);
|
|
81
|
+
/**
|
|
82
|
+
* List of schema to register.
|
|
83
|
+
*
|
|
84
|
+
* NOTE: If a `client` is provided then `types` will not be added until after the children are first rendered.
|
|
85
|
+
*/
|
|
86
|
+
types?: S.Schema<any>[];
|
|
87
|
+
/**
|
|
88
|
+
* ReactNode to display until the client is available.
|
|
89
|
+
*/
|
|
90
|
+
fallback?: FunctionComponent<Partial<ClientContextProps>>;
|
|
91
|
+
/**
|
|
92
|
+
* Set to false to stop default signal runtime from being registered.
|
|
93
|
+
*
|
|
94
|
+
* The signals runtime is used to provide reactive updates to ECHO objects.
|
|
95
|
+
*/
|
|
96
|
+
registerSignalRuntime?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Skip the DXOS banner print.
|
|
99
|
+
*/
|
|
100
|
+
disableBanner?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Post initialization hook to enable to caller to do custom initialization.
|
|
103
|
+
*
|
|
104
|
+
* @param Client
|
|
105
|
+
*/
|
|
106
|
+
onInitialized?: (client: Client) => MaybePromise<void>;
|
|
107
|
+
} & React.RefAttributes<Client | undefined>>;
|
|
108
|
+
//# sourceMappingURL=ClientProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientProvider.d.ts","sourceRoot":"","sources":["../../../../src/client/ClientProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAEZ,KAAK,iBAAiB,EACtB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,sBAAsB,EAAgB,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAI3C,OAAO,EAAyB,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,C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,MAAM,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC,sBAAsB,CAAC,CAAC;IAE/F;;;;OAIG;YACK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;IAEvB;;OAEG;eACQ,iBAAiB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEzD;;;;OAIG;4BACqB,OAAO;IAE/B;;OAEG;oBACa,OAAO;IAEvB;;;;OAIG;oBACa,CAAC,MAAM,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC;4CAkHzD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientProvider.test.d.ts","sourceRoot":"","sources":["../../../../src/client/ClientProvider.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/client/context.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CAC9B,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './AgentHostingProvider';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
2
|
+
export * from './ClientProvider';
|
|
3
|
+
export * from './context';
|
|
4
|
+
export * from './useClient';
|
|
5
|
+
export * from './useClientStatus';
|
|
4
6
|
export * from './useConfig';
|
|
5
7
|
export * from './useShell';
|
|
6
8
|
export * from './useStatus';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/index.ts"],"names":[],"mappings":"AAIA,cAAc,wBAAwB,CAAC;AACvC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/index.ts"],"names":[],"mappings":"AAIA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAE1B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClient.d.ts","sourceRoot":"","sources":["../../../../src/client/useClient.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,eAAO,MAAM,SAAS,2DAGrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClientStatus.d.ts","sourceRoot":"","sources":["../../../../src/client/useClientStatus.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE9D,eAAO,MAAM,eAAe,WAAY,MAAM,oCAY7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDevtools.d.ts","sourceRoot":"","sources":["../../../../src/devtools/useDevtools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDevtools.d.ts","sourceRoot":"","sources":["../../../../src/devtools/useDevtools.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,eAAO,MAAM,WAAW,QAAO,YAG9B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export default
|
|
1
|
+
declare const _default: import("@playwright/test").PlaywrightTestConfig<{}, {}>;
|
|
2
|
+
export default _default;
|
|
3
3
|
//# sourceMappingURL=playwright.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../../../../src/playwright/playwright.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../../../../src/playwright/playwright.config.ts"],"names":[],"mappings":";AASA,wBAQG"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React, { type FC } from 'react';
|
|
2
|
-
import { Client } from '@dxos/client';
|
|
2
|
+
import { Client, type PublicKey } from '@dxos/client';
|
|
3
3
|
import { type Space } from '@dxos/client/echo';
|
|
4
4
|
import { type S } from '@dxos/echo-schema';
|
|
5
5
|
import { type MaybePromise } from '@dxos/util';
|
|
6
|
-
export type
|
|
6
|
+
export type ClientRepeatedComponentProps = {
|
|
7
7
|
id: number;
|
|
8
8
|
count: number;
|
|
9
|
+
spaceKey?: PublicKey;
|
|
9
10
|
};
|
|
10
|
-
export type ClientRepeaterProps<P extends
|
|
11
|
-
component: FC<any>;
|
|
11
|
+
export type ClientRepeaterProps<P extends ClientRepeatedComponentProps> = {
|
|
12
12
|
className?: string;
|
|
13
|
+
component: FC<ClientRepeatedComponentProps>;
|
|
13
14
|
controls?: FC<{
|
|
14
15
|
clients: Client[];
|
|
15
16
|
}>;
|
|
@@ -26,5 +27,5 @@ export type ClientRepeaterProps<P extends RepeatedComponentProps> = {
|
|
|
26
27
|
* Utility component for Storybook stories which sets up clients for n peers.
|
|
27
28
|
* The `Component` property is rendered n times, once for each peer.
|
|
28
29
|
*/
|
|
29
|
-
export declare const ClientRepeater: <P extends
|
|
30
|
+
export declare const ClientRepeater: <P extends ClientRepeatedComponentProps>(props: ClientRepeaterProps<P>) => React.JSX.Element | null;
|
|
30
31
|
//# sourceMappingURL=ClientRepeater.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientRepeater.d.ts","sourceRoot":"","sources":["../../../../src/testing/ClientRepeater.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAY,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ClientRepeater.d.ts","sourceRoot":"","sources":["../../../../src/testing/ClientRepeater.tsx"],"names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A2DnG,CAAC"}
|
|
@@ -5,10 +5,10 @@ declare const _default: {
|
|
|
5
5
|
decorators: import("@storybook/react/*").Decorator[];
|
|
6
6
|
};
|
|
7
7
|
export default _default;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const Default: {
|
|
9
9
|
render: () => React.JSX.Element;
|
|
10
10
|
};
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const Space: {
|
|
12
12
|
render: () => React.JSX.Element;
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=ClientRepeater.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientRepeater.stories.d.ts","sourceRoot":"","sources":["../../../../src/testing/ClientRepeater.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;AAU1B,wBAGE;AAgCF,eAAO,MAAM,OAAO;;CAEnB,CAAC;AAEF,eAAO,MAAM,KAAK;;CAEjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AAErC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AAErC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Client, type Config } from '@dxos/client';
|
|
3
|
+
import { type Space } from '@dxos/client/echo';
|
|
4
|
+
export declare const createClient: ({ config, createIdentity, createSpace, }?: {
|
|
5
|
+
config?: Config;
|
|
6
|
+
createIdentity?: boolean;
|
|
7
|
+
createSpace?: boolean;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
client: Client;
|
|
10
|
+
space: Space | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const createClientContextProvider: (client: Client) => Promise<({ children }: any) => React.JSX.Element>;
|
|
13
|
+
export declare const createClientProvider: (client: Client) => Promise<({ children }: any) => React.JSX.Element>;
|
|
14
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/testing/util.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAY,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAK/C,eAAO,MAAM,YAAY,8CAItB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE;;;EActE,CAAC;AAEF,eAAO,MAAM,2BAA2B,WAAkB,MAAM,4BACxC,GAAG,uBAC1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,WAAkB,MAAM,4BACjC,GAAG,uBAC1B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Decorator } from '@storybook/react';
|
|
2
|
+
import { type Client } from '@dxos/client';
|
|
3
|
+
import { type Space } from '@dxos/client/echo';
|
|
4
|
+
import { type MaybePromise } from '@dxos/util';
|
|
5
|
+
import { type ClientProviderProps } from '../client';
|
|
6
|
+
type InitializeProps = {
|
|
7
|
+
createIdentity?: boolean;
|
|
8
|
+
createSpace?: boolean;
|
|
9
|
+
onSpaceCreated?: (client: Client, space: Space) => MaybePromise<void>;
|
|
10
|
+
};
|
|
11
|
+
export type WithClientProviderProps = InitializeProps & ClientProviderProps;
|
|
12
|
+
/**
|
|
13
|
+
* Decorator that provides the client context.
|
|
14
|
+
*/
|
|
15
|
+
export declare const withClientProvider: ({ createIdentity, createSpace, onSpaceCreated, onInitialized, ...props }?: WithClientProviderProps) => Decorator;
|
|
16
|
+
export type WithMultiClientProviderProps = InitializeProps & ClientProviderProps & {
|
|
17
|
+
numClients?: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Decorator that creates a scaffold for multiple clients.
|
|
21
|
+
* Orchestrates invitations between a randomly selected host and the remaining clients.
|
|
22
|
+
* NOTE: Should come before withLayout.
|
|
23
|
+
*/
|
|
24
|
+
export declare const withMultiClientProvider: ({ numClients, createIdentity, createSpace, onSpaceCreated, onInitialized, ...props }: WithMultiClientProviderProps) => Decorator;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=withClientProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withClientProvider.d.ts","sourceRoot":"","sources":["../../../../src/testing/withClientProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErE,KAAK,eAAe,GAAG;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CACvE,CAAC;AA4BF,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG,mBAAmB,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,kBAAkB,8EAM5B,uBAAuB,KAAQ,SAYjC,CAAC;AAKF,MAAM,MAAM,4BAA4B,GAAG,eAAe,GAAG,mBAAmB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3G;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB,yFAOjC,4BAA4B,KAAG,SAuCjC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '@dxos-theme';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: () => React.JSX.Element | null;
|
|
6
|
+
decorators: import("@storybook/react/*").Decorator[];
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
export declare const Default: {};
|
|
10
|
+
export declare const Multiple: {
|
|
11
|
+
decorators: import("@storybook/react/*").Decorator[];
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=withClientProvider.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withClientProvider.stories.d.ts","sourceRoot":"","sources":["../../../../src/testing/withClientProvider.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AA+B1B,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC;AAE1B,eAAO,MAAM,QAAQ;;CAUpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,65 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-client",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.12-main.5cc132e",
|
|
4
4
|
"description": "React client API",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "DXOS.org",
|
|
9
9
|
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"browser": "./dist/lib/browser/index.mjs",
|
|
12
|
-
"node": {
|
|
13
|
-
"default": "./dist/lib/node/index.cjs"
|
|
14
|
-
},
|
|
15
|
-
"types": "./dist/types/src/index.d.ts"
|
|
16
|
-
},
|
|
17
10
|
"./devtools": {
|
|
18
11
|
"browser": "./dist/lib/browser/devtools/index.mjs",
|
|
19
12
|
"node": {
|
|
20
|
-
"
|
|
13
|
+
"require": "./dist/lib/node/devtools/index.cjs",
|
|
14
|
+
"default": "./dist/lib/node-esm/devtools/index.mjs"
|
|
21
15
|
},
|
|
22
16
|
"types": "./dist/types/src/devtools/index.d.ts"
|
|
23
17
|
},
|
|
24
18
|
"./echo": {
|
|
25
19
|
"browser": "./dist/lib/browser/echo/index.mjs",
|
|
26
20
|
"node": {
|
|
27
|
-
"
|
|
21
|
+
"require": "./dist/lib/node/echo/index.cjs",
|
|
22
|
+
"default": "./dist/lib/node-esm/echo/index.mjs"
|
|
28
23
|
},
|
|
29
24
|
"types": "./dist/types/src/echo/index.d.ts"
|
|
30
25
|
},
|
|
31
26
|
"./halo": {
|
|
32
27
|
"browser": "./dist/lib/browser/halo/index.mjs",
|
|
33
28
|
"node": {
|
|
34
|
-
"
|
|
29
|
+
"require": "./dist/lib/node/halo/index.cjs",
|
|
30
|
+
"default": "./dist/lib/node-esm/halo/index.mjs"
|
|
35
31
|
},
|
|
36
32
|
"types": "./dist/types/src/halo/index.d.ts"
|
|
37
33
|
},
|
|
34
|
+
".": {
|
|
35
|
+
"browser": "./dist/lib/browser/index.mjs",
|
|
36
|
+
"node": {
|
|
37
|
+
"require": "./dist/lib/node/index.cjs",
|
|
38
|
+
"default": "./dist/lib/node-esm/index.mjs"
|
|
39
|
+
},
|
|
40
|
+
"types": "./dist/types/src/index.d.ts"
|
|
41
|
+
},
|
|
38
42
|
"./invitations": {
|
|
39
43
|
"browser": "./dist/lib/browser/invitations/index.mjs",
|
|
40
44
|
"node": {
|
|
41
|
-
"
|
|
45
|
+
"require": "./dist/lib/node/invitations/index.cjs",
|
|
46
|
+
"default": "./dist/lib/node-esm/invitations/index.mjs"
|
|
42
47
|
},
|
|
43
48
|
"types": "./dist/types/src/invitations/index.d.ts"
|
|
44
49
|
},
|
|
45
50
|
"./mesh": {
|
|
46
51
|
"browser": "./dist/lib/browser/mesh/index.mjs",
|
|
47
52
|
"node": {
|
|
48
|
-
"
|
|
53
|
+
"require": "./dist/lib/node/mesh/index.cjs",
|
|
54
|
+
"default": "./dist/lib/node-esm/mesh/index.mjs"
|
|
49
55
|
},
|
|
50
56
|
"types": "./dist/types/src/mesh/index.d.ts"
|
|
51
57
|
},
|
|
52
58
|
"./testing": {
|
|
53
59
|
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
54
60
|
"node": {
|
|
55
|
-
"
|
|
61
|
+
"require": "./dist/lib/node/testing/index.cjs",
|
|
62
|
+
"default": "./dist/lib/node-esm/testing/index.mjs"
|
|
56
63
|
},
|
|
57
64
|
"types": "./dist/types/src/testing/index.d.ts"
|
|
58
65
|
},
|
|
59
66
|
"./worker": {
|
|
60
67
|
"browser": "./dist/lib/browser/worker.mjs",
|
|
61
68
|
"node": {
|
|
62
|
-
"
|
|
69
|
+
"require": "./dist/lib/node/worker.cjs",
|
|
70
|
+
"default": "./dist/lib/node-esm/worker.mjs"
|
|
63
71
|
},
|
|
64
72
|
"types": "./dist/types/src/worker.d.ts"
|
|
65
73
|
}
|
|
@@ -91,18 +99,20 @@
|
|
|
91
99
|
}
|
|
92
100
|
},
|
|
93
101
|
"dependencies": {
|
|
94
|
-
"
|
|
95
|
-
"@dxos/
|
|
96
|
-
"@dxos/
|
|
97
|
-
"@dxos/
|
|
98
|
-
"@dxos/
|
|
99
|
-
"@dxos/
|
|
100
|
-
"@dxos/
|
|
101
|
-
"@dxos/
|
|
102
|
-
"@dxos/
|
|
103
|
-
"@dxos/
|
|
104
|
-
"@dxos/
|
|
105
|
-
"@dxos/
|
|
102
|
+
"react-error-boundary": "^4.0.13",
|
|
103
|
+
"@dxos/async": "0.6.12-main.5cc132e",
|
|
104
|
+
"@dxos/codec-protobuf": "0.6.12-main.5cc132e",
|
|
105
|
+
"@dxos/client": "0.6.12-main.5cc132e",
|
|
106
|
+
"@dxos/config": "0.6.12-main.5cc132e",
|
|
107
|
+
"@dxos/debug": "0.6.12-main.5cc132e",
|
|
108
|
+
"@dxos/echo-schema": "0.6.12-main.5cc132e",
|
|
109
|
+
"@dxos/invariant": "0.6.12-main.5cc132e",
|
|
110
|
+
"@dxos/log": "0.6.12-main.5cc132e",
|
|
111
|
+
"@dxos/echo-signals": "0.6.12-main.5cc132e",
|
|
112
|
+
"@dxos/node-std": "0.6.12-main.5cc132e",
|
|
113
|
+
"@dxos/protocols": "0.6.12-main.5cc132e",
|
|
114
|
+
"@dxos/react-hooks": "0.6.12-main.5cc132e",
|
|
115
|
+
"@dxos/util": "0.6.12-main.5cc132e"
|
|
106
116
|
},
|
|
107
117
|
"devDependencies": {
|
|
108
118
|
"@testing-library/dom": "^8.17.1",
|
|
@@ -112,19 +122,21 @@
|
|
|
112
122
|
"@types/react-dom": "~18.2.0",
|
|
113
123
|
"react": "~18.2.0",
|
|
114
124
|
"react-dom": "~18.2.0",
|
|
115
|
-
"@dxos/random": "0.6.
|
|
116
|
-
"@dxos/react-ui": "0.6.
|
|
117
|
-
"@dxos/react-ui-
|
|
118
|
-
"@dxos/
|
|
125
|
+
"@dxos/random": "0.6.12-main.5cc132e",
|
|
126
|
+
"@dxos/react-ui": "0.6.12-main.5cc132e",
|
|
127
|
+
"@dxos/react-ui-syntax-highlighter": "0.6.12-main.5cc132e",
|
|
128
|
+
"@dxos/test-utils": "0.6.12-main.5cc132e",
|
|
129
|
+
"@dxos/react-ui-theme": "0.6.12-main.5cc132e",
|
|
130
|
+
"@dxos/storybook-utils": "0.6.12-main.5cc132e"
|
|
119
131
|
},
|
|
120
132
|
"peerDependencies": {
|
|
121
133
|
"react": "^18.0.0",
|
|
122
134
|
"react-dom": "^18.0.0",
|
|
123
|
-
"@dxos/react-ui": "0.6.
|
|
124
|
-
"@dxos/react-ui-theme": "0.6.
|
|
135
|
+
"@dxos/react-ui": "0.6.12-main.5cc132e",
|
|
136
|
+
"@dxos/react-ui-theme": "0.6.12-main.5cc132e"
|
|
125
137
|
},
|
|
126
138
|
"optionalDependencies": {
|
|
127
|
-
"@dxos/random": "0.6.
|
|
139
|
+
"@dxos/random": "0.6.12-main.5cc132e"
|
|
128
140
|
},
|
|
129
141
|
"publishConfig": {
|
|
130
142
|
"access": "public"
|
package/project.json
CHANGED
|
@@ -26,32 +26,12 @@
|
|
|
26
26
|
"dependsOn": [
|
|
27
27
|
"^compile",
|
|
28
28
|
"stories:mkdist"
|
|
29
|
-
]
|
|
30
|
-
"options": {
|
|
31
|
-
"playwrightConfigPath": "{projectRoot}/src/playwright/playwright.config.ts",
|
|
32
|
-
"serve": "stories:storybook-e2e",
|
|
33
|
-
"testPatterns": [
|
|
34
|
-
"{projectRoot}/src/playwright/**/*.spec.{ts,js}"
|
|
35
|
-
],
|
|
36
|
-
"timeout": 60000,
|
|
37
|
-
"watchPatterns": [
|
|
38
|
-
"{projectRoot}/src/**/*"
|
|
39
|
-
]
|
|
40
|
-
}
|
|
29
|
+
]
|
|
41
30
|
},
|
|
42
31
|
"lint": {},
|
|
43
|
-
"test": {
|
|
44
|
-
"options": {
|
|
45
|
-
"ciEnvironments": [
|
|
46
|
-
"nodejs"
|
|
47
|
-
],
|
|
48
|
-
"domRequired": true,
|
|
49
|
-
"forceExit": true
|
|
50
|
-
}
|
|
51
|
-
}
|
|
32
|
+
"test": {}
|
|
52
33
|
},
|
|
53
34
|
"implicitDependencies": [
|
|
54
|
-
"esbuild"
|
|
55
|
-
"test"
|
|
35
|
+
"esbuild"
|
|
56
36
|
]
|
|
57
37
|
}
|