@dxos/react-client 2.19.3-dev.cd87a074 → 2.19.4-dev.aac2d723

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/package.json CHANGED
@@ -1,67 +1,67 @@
1
1
  {
2
- "name": "@dxos/react-client",
3
- "version": "2.19.3-dev.cd87a074",
4
- "description": "React client API",
5
- "keywords": [],
6
- "license": "AGPL-3.0",
7
- "author": "DXOS.org",
8
- "main": "dist/src/index.js",
9
- "types": "dist/src/index.d.ts",
10
- "scripts": {
11
- "book": "esbuild-server book",
12
- "build": "toolchain build",
13
- "build:test": "toolchain build:test",
14
- "lint": "toolchain lint",
15
- "test": "toolchain test"
16
- },
17
- "dependencies": {
18
- "@dxos/async": "2.19.3-dev.cd87a074",
19
- "@dxos/client": "2.19.3-dev.cd87a074",
20
- "@dxos/config": "2.19.3-dev.cd87a074",
21
- "@dxos/credentials": "2.19.3-dev.cd87a074",
22
- "@dxos/crypto": "2.19.3-dev.cd87a074",
23
- "@dxos/debug": "2.19.3-dev.cd87a074",
24
- "@dxos/echo-db": "2.19.3-dev.cd87a074",
25
- "@dxos/esbuild-plugins": "2.19.3-dev.cd87a074",
26
- "@dxos/esbuild-server": "~1.4.1",
27
- "@dxos/util": "2.19.3-dev.cd87a074",
28
- "@types/debug": "^4.1.7",
29
- "assert": "^2.0.0",
30
- "debug": "^4.3.3",
31
- "react-display-name": "^0.2.5",
32
- "use-subscription": "^1.4.1"
33
- },
34
- "devDependencies": {
35
- "@dxos/toolchain-node-library": "2.19.2",
36
- "@mui/material": "^5.0.1",
37
- "@testing-library/react": "^11.0.4",
38
- "@testing-library/react-hooks": "5.1.2",
39
- "@types/debug": "^4.1.7",
40
- "@types/level-js": "~4.0.1",
41
- "@types/mocha": "~8.2.2",
42
- "@types/node": "^14.0.9",
43
- "@types/react": "^17.0.24",
44
- "@types/testing-library__jest-dom": "~5.9.5",
45
- "@types/use-subscription": "^1.0.0",
46
- "expect": "~27.0.2",
47
- "fork-ts-checker-webpack-plugin": "~6.2.5",
48
- "level-js": "^5.0.2",
49
- "react": "^17.0.2",
50
- "react-docgen-typescript-loader": "^3.7.2",
51
- "react-dom": "^17.0.2",
52
- "react-test-renderer": "^17.0.2",
53
- "typescript": "^4.5.2",
54
- "webpack": "4.44.2"
55
- },
56
- "peerDependencies": {
57
- "react": "*"
58
- },
59
- "publishConfig": {
60
- "access": "public"
61
- },
62
- "toolchain": {
63
- "testingFramework": "mocha",
64
- "jsdom": true,
65
- "forceCloseTests": true
66
- }
67
- }
2
+ "name": "@dxos/react-client",
3
+ "version": "2.19.4-dev.aac2d723",
4
+ "description": "React client API",
5
+ "keywords": [],
6
+ "license": "AGPL-3.0",
7
+ "author": "DXOS.org",
8
+ "main": "dist/src/index.js",
9
+ "types": "dist/src/index.d.ts",
10
+ "dependencies": {
11
+ "@dxos/async": "2.19.4-dev.aac2d723",
12
+ "@dxos/client": "2.19.4-dev.aac2d723",
13
+ "@dxos/config": "2.19.4-dev.aac2d723",
14
+ "@dxos/credentials": "2.19.4-dev.aac2d723",
15
+ "@dxos/crypto": "2.19.4-dev.aac2d723",
16
+ "@dxos/debug": "2.19.4-dev.aac2d723",
17
+ "@dxos/echo-db": "2.19.4-dev.aac2d723",
18
+ "@dxos/util": "2.19.4-dev.aac2d723",
19
+ "assert": "^2.0.0",
20
+ "debug": "^4.3.3",
21
+ "react-display-name": "^0.2.5",
22
+ "use-subscription": "^1.4.1"
23
+ },
24
+ "devDependencies": {
25
+ "@dxos/esbuild-plugins": "2.19.4-dev.aac2d723",
26
+ "@dxos/esbuild-server": "~1.7.1",
27
+ "@dxos/toolchain-node-library": "2.19.3",
28
+ "@mui/material": "^5.0.1",
29
+ "@testing-library/react": "^11.0.4",
30
+ "@testing-library/react-hooks": "5.1.2",
31
+ "@types/debug": "^4.1.7",
32
+ "@types/level-js": "~4.0.1",
33
+ "@types/mocha": "~8.2.2",
34
+ "@types/node": "^14.0.9",
35
+ "@types/react": "^17.0.24",
36
+ "@types/testing-library__jest-dom": "~5.9.5",
37
+ "@types/use-subscription": "^1.0.0",
38
+ "expect": "~27.0.2",
39
+ "fork-ts-checker-webpack-plugin": "~6.2.5",
40
+ "level-js": "^5.0.2",
41
+ "react": "^17.0.2",
42
+ "react-docgen-typescript-loader": "^3.7.2",
43
+ "react-dom": "^17.0.2",
44
+ "react-test-renderer": "^17.0.2",
45
+ "typescript": "^4.5.2",
46
+ "webpack": "4.44.2"
47
+ },
48
+ "peerDependencies": {
49
+ "react": "*"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "toolchain": {
55
+ "testingFramework": "mocha",
56
+ "jsdom": true,
57
+ "forceCloseTests": true
58
+ },
59
+ "scripts": {
60
+ "book": "esbuild-server book",
61
+ "build": "toolchain build",
62
+ "build:test": "toolchain build:test",
63
+ "lint": "toolchain lint",
64
+ "test": "toolchain test"
65
+ },
66
+ "readme": "# @dxos/react-client\n\nA react implementation of the DXOS Client APIs.\n\n## Install\n\n```bash\ngit clone git@github.com:dxos/protocols.git\ncd protocols\nrush update\nrush build\n\ncd packages/sdk/demos\nrushx book\n```\n\n## Usage\n\nThe snippet below illustrates a self-contained DXOS application that uses providers to create the client and instantiate a user profile.\n\n```javascript\nimport { useClient, ClientProvider, ProfileInitializer } from '@dxos/react-client';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nconst App = () => {\n const client = useClient();\n\n return (\n <pre>{JSON.stringify(client.info())}</pre>\n );\n};\n\nconst Root = () => (\n <ClientProvider>\n <ProfileInitializer>\n <App />\n </ProfileInitializer>\n </ClientProvider>\n);\n\nReactDOM.render(<Root/>, document.getElementById('root'));\n```\n\n## Storybooks\n\nThe [HALO Invitation Story](./stories/halo-invitations.stories.tsx) demonstrates multiple clients (devices) joining the same HALO.\n\nhttps://user-images.githubusercontent.com/3523355/137532718-a21f1f27-9854-4c0b-831a-e9ff92feac49.mov\n\nThe [Party Invitation Story](./stories/party-invitations.stories.tsx) demonstrates multiple clients creating and sharing parties.\n\nhttps://user-images.githubusercontent.com/3523355/137532717-e77395dc-96f9-4e4b-8f67-e6bd026a3abe.mov\n\n\n## Contributing\n\nPRs accepted.\n\n## License\n\nAGPL-3.0 © DXOS\n"
67
+ }
@@ -1,34 +0,0 @@
1
- Invoking: toolchain build:test
2
-
3
-
4
- typescript
5
- OK in 7183 ms
6
-
7
- eslint
8
- OK in 8554 ms
9
-
10
- mocha
11
- This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
12
- This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
13
-
14
-
15
- ClientProvider
16
- DXOS
17
- ✓ Renders with children (45ms)
18
- ✓ Provides the client
19
-
20
- Client hook
21
- ✓ should throw when used outside a context
22
- ✓ should return client when used properly in a context
23
-
24
- Config hook
25
- ✓ should throw when used outside a context
26
- ✓ should return default client config when no config is passed in a context
27
- ✓ should return custom client config when used properly in a context
28
-
29
-
30
- 7 passing (504ms)
31
-
32
- OK in 12540 ms
33
-
34
- CHECK COMPLETE in 28284 ms
package/src/banner.ts CHANGED
@@ -2,17 +2,26 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
+ import { Client } from '@dxos/client';
6
+
7
+ // TODO(burdon): Print version.
8
+ // http://patorjk.com/software/taag/#p=testall&f=Patorjk-HeX&t=DXOS
9
+
10
+ const BANNER = (client: Client) => '\n' +
11
+ '_/\\/\\/\\/\\/\\____/\\/\\____/\\/\\____/\\/\\/\\/\\______/\\/\\/\\/\\/\\_\n' +
12
+ '_/\\/\\____/\\/\\____/\\/\\/\\/\\____/\\/\\____/\\/\\__/\\/\\_________\n' +
13
+ '_/\\/\\____/\\/\\______/\\/\\______/\\/\\____/\\/\\____/\\/\\/\\/\\___\n' +
14
+ '_/\\/\\____/\\/\\____/\\/\\/\\/\\____/\\/\\____/\\/\\__________/\\/\\_\n' +
15
+ '_/\\/\\/\\/\\/\\____/\\/\\____/\\/\\____/\\/\\/\\/\\____/\\/\\/\\/\\/\\___\n' +
16
+ `\n DXOS Client ${client.version} \n\n`;
17
+
5
18
  let bannerPrinted = false;
6
19
 
7
- export function printBanner () {
20
+ export function printBanner (client: Client) {
8
21
  if (bannerPrinted) {
9
22
  return;
10
23
  }
11
- bannerPrinted = true;
12
24
 
13
- console.log('%cDXOS', `
14
- text-align: center;
15
- text-shadow: #ddd 4px -4px, #bbb 8px -8px, #999 12px -12px, #777 16px -16px;
16
- font-size: 10em;padding:10px;
17
- `);
25
+ bannerPrinted = true;
26
+ console.log(BANNER(client));
18
27
  }
@@ -65,8 +65,6 @@ export const ClientProvider = ({
65
65
 
66
66
  // Async helpers.
67
67
  useEffect(() => {
68
- printBanner();
69
-
70
68
  if (!client) {
71
69
  const done = async (client: Client) => {
72
70
  log(`Created client: ${client}`);
@@ -75,6 +73,7 @@ export const ClientProvider = ({
75
73
  }
76
74
  await onInitialize?.(client);
77
75
  setClient(client);
76
+ printBanner(client);
78
77
  };
79
78
 
80
79
  // TODO(burdon): Error handling.
@@ -2,7 +2,7 @@
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
- import React, { useEffect } from 'react';
5
+ import React, { ReactNode, useEffect } from 'react';
6
6
 
7
7
  import { useClient, useProfile } from '../hooks';
8
8
 
@@ -11,7 +11,7 @@ import { useClient, useProfile } from '../hooks';
11
11
  * @deprecated
12
12
  */
13
13
  // TODO(burdon): Testing-only; replace with useTestProfile();
14
- export const ProfileInitializer = ({ children }: { children: React.ReactNode }) => {
14
+ export const ProfileInitializer = ({ children }: { children: ReactNode }) => {
15
15
  const client = useClient();
16
16
  const profile = useProfile();
17
17
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import React, { ReactNode } from 'react';
6
6
 
7
7
  import { styled } from '@mui/material';
8
8
 
@@ -19,7 +19,7 @@ const FullScreen = styled('div')({
19
19
  backgroundColor: '#EEE'
20
20
  });
21
21
 
22
- export const Container = ({ children }: { children: React.ReactNode }) => (
22
+ export const Container = ({ children }: { children: ReactNode }) => (
23
23
  <FullScreen>
24
24
  <ThemeProvider>
25
25
  {children}
@@ -2,7 +2,7 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import React, { ReactNode } from 'react';
6
6
 
7
7
  import { createTheme, ThemeProvider as MuiThemeProvider } from '@mui/material';
8
8
 
@@ -33,7 +33,7 @@ const theme = createTheme({
33
33
  });
34
34
 
35
35
  // TODO(burdon): Add theme as decorator.
36
- export const ThemeProvider = ({ children }: { children: React.ReactNode }) => (
36
+ export const ThemeProvider = ({ children }: { children: ReactNode }) => (
37
37
  <MuiThemeProvider theme={theme}>
38
38
  {children}
39
39
  </MuiThemeProvider>