@dxos/plugin-board 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae

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.
Files changed (96) hide show
  1. package/dist/lib/browser/BoardContainer-QVVN3MXA.mjs +150 -0
  2. package/dist/lib/browser/BoardContainer-QVVN3MXA.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-DX5POLPL.mjs +19 -0
  4. package/dist/lib/browser/chunk-DX5POLPL.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  6. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-KO5FZQGF.mjs +34 -0
  8. package/dist/lib/browser/chunk-KO5FZQGF.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +35 -56
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/react-surface-DBUDXBXD.mjs +38 -0
  13. package/dist/lib/browser/react-surface-DBUDXBXD.mjs.map +7 -0
  14. package/dist/lib/browser/types/index.mjs +2 -1
  15. package/dist/lib/node-esm/BoardContainer-U2P3DS4B.mjs +151 -0
  16. package/dist/lib/node-esm/BoardContainer-U2P3DS4B.mjs.map +7 -0
  17. package/dist/lib/node-esm/chunk-4C3UI73P.mjs +35 -0
  18. package/dist/lib/node-esm/chunk-4C3UI73P.mjs.map +7 -0
  19. package/dist/lib/node-esm/chunk-BKJL6RLQ.mjs +21 -0
  20. package/dist/lib/node-esm/chunk-BKJL6RLQ.mjs.map +7 -0
  21. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  22. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  23. package/dist/lib/node-esm/index.mjs +35 -56
  24. package/dist/lib/node-esm/index.mjs.map +4 -4
  25. package/dist/lib/node-esm/meta.json +1 -1
  26. package/dist/lib/node-esm/react-surface-SFB3GP7U.mjs +39 -0
  27. package/dist/lib/node-esm/react-surface-SFB3GP7U.mjs.map +7 -0
  28. package/dist/lib/node-esm/types/index.mjs +2 -1
  29. package/dist/types/src/BoardPlugin.d.ts +2 -1
  30. package/dist/types/src/BoardPlugin.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/index.d.ts +1 -2
  32. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  33. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  34. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  35. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  36. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  37. package/dist/types/src/components/index.d.ts +0 -1
  38. package/dist/types/src/components/index.d.ts.map +1 -1
  39. package/dist/types/src/containers/BoardContainer/BoardContainer.d.ts +6 -0
  40. package/dist/types/src/containers/BoardContainer/BoardContainer.d.ts.map +1 -0
  41. package/dist/types/src/{components → containers/BoardContainer}/BoardContainer.stories.d.ts +4 -4
  42. package/dist/types/src/containers/BoardContainer/BoardContainer.stories.d.ts.map +1 -0
  43. package/dist/types/src/containers/BoardContainer/index.d.ts +3 -0
  44. package/dist/types/src/containers/BoardContainer/index.d.ts.map +1 -0
  45. package/dist/types/src/containers/index.d.ts +3 -0
  46. package/dist/types/src/containers/index.d.ts.map +1 -0
  47. package/dist/types/src/index.d.ts +0 -1
  48. package/dist/types/src/index.d.ts.map +1 -1
  49. package/dist/types/src/meta.d.ts +2 -2
  50. package/dist/types/src/meta.d.ts.map +1 -1
  51. package/dist/types/src/translations.d.ts +1 -0
  52. package/dist/types/src/translations.d.ts.map +1 -1
  53. package/dist/types/src/types/Board.d.ts +25 -67
  54. package/dist/types/src/types/Board.d.ts.map +1 -1
  55. package/dist/types/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +55 -47
  57. package/src/BoardPlugin.tsx +22 -45
  58. package/src/capabilities/index.ts +1 -4
  59. package/src/capabilities/react-surface/index.ts +7 -0
  60. package/src/capabilities/react-surface/react-surface.tsx +27 -0
  61. package/src/components/index.ts +0 -2
  62. package/src/containers/BoardContainer/BoardContainer.stories.tsx +122 -0
  63. package/src/containers/BoardContainer/BoardContainer.tsx +155 -0
  64. package/src/containers/BoardContainer/index.ts +7 -0
  65. package/src/containers/index.ts +7 -0
  66. package/src/index.ts +0 -1
  67. package/src/meta.ts +8 -4
  68. package/src/translations.ts +1 -0
  69. package/src/types/Board.ts +6 -20
  70. package/dist/lib/browser/chunk-RHMZXTJ7.mjs +0 -129
  71. package/dist/lib/browser/chunk-RHMZXTJ7.mjs.map +0 -7
  72. package/dist/lib/browser/chunk-Z6L4ZVCB.mjs +0 -59
  73. package/dist/lib/browser/chunk-Z6L4ZVCB.mjs.map +0 -7
  74. package/dist/lib/browser/intent-resolver-H6OF7V77.mjs +0 -33
  75. package/dist/lib/browser/intent-resolver-H6OF7V77.mjs.map +0 -7
  76. package/dist/lib/browser/react-surface-37LEVBKY.mjs +0 -30
  77. package/dist/lib/browser/react-surface-37LEVBKY.mjs.map +0 -7
  78. package/dist/lib/node-esm/chunk-AWLY252W.mjs +0 -60
  79. package/dist/lib/node-esm/chunk-AWLY252W.mjs.map +0 -7
  80. package/dist/lib/node-esm/chunk-XZA5WICX.mjs +0 -131
  81. package/dist/lib/node-esm/chunk-XZA5WICX.mjs.map +0 -7
  82. package/dist/lib/node-esm/intent-resolver-L534P6FM.mjs +0 -34
  83. package/dist/lib/node-esm/intent-resolver-L534P6FM.mjs.map +0 -7
  84. package/dist/lib/node-esm/react-surface-GVHSH2W2.mjs +0 -31
  85. package/dist/lib/node-esm/react-surface-GVHSH2W2.mjs.map +0 -7
  86. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  87. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  88. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  89. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  90. package/dist/types/src/components/BoardContainer.d.ts +0 -8
  91. package/dist/types/src/components/BoardContainer.d.ts.map +0 -1
  92. package/dist/types/src/components/BoardContainer.stories.d.ts.map +0 -1
  93. package/src/capabilities/intent-resolver.ts +0 -34
  94. package/src/capabilities/react-surface.tsx +0 -22
  95. package/src/components/BoardContainer.stories.tsx +0 -125
  96. package/src/components/BoardContainer.tsx +0 -136
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@dxos/plugin-board",
3
- "version": "0.8.4-main.c4373fc",
3
+ "version": "0.8.4-main.c85a9c8dae",
4
4
  "description": "Surface plugin for card baords",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
13
  "sideEffects": true,
@@ -11,15 +15,15 @@
11
15
  "exports": {
12
16
  ".": {
13
17
  "source": "./src/index.ts",
14
- "types": "./dist/types/src/index.d.ts",
15
18
  "browser": "./dist/lib/browser/index.mjs",
16
- "node": "./dist/lib/node-esm/index.mjs"
19
+ "node": "./dist/lib/node-esm/index.mjs",
20
+ "types": "./dist/types/src/index.d.ts"
17
21
  },
18
22
  "./types": {
19
23
  "source": "./src/types/index.ts",
20
- "types": "./dist/types/src/types/index.d.ts",
21
24
  "browser": "./dist/lib/browser/types/index.mjs",
22
- "node": "./dist/lib/node-esm/types/index.mjs"
25
+ "node": "./dist/lib/node-esm/types/index.mjs",
26
+ "types": "./dist/types/src/types/index.d.ts"
23
27
  }
24
28
  },
25
29
  "types": "dist/types/src/index.d.ts",
@@ -35,52 +39,56 @@
35
39
  "src"
36
40
  ],
37
41
  "dependencies": {
38
- "@preact-signals/safe-react": "^0.9.0",
39
- "@preact/signals-core": "^1.12.1",
40
- "@preact/signals-react": "^3.3.0",
41
- "effect": "3.18.3",
42
- "@dxos/ai": "0.8.4-main.c4373fc",
43
- "@dxos/app-framework": "0.8.4-main.c4373fc",
44
- "@dxos/assistant": "0.8.4-main.c4373fc",
45
- "@dxos/async": "0.8.4-main.c4373fc",
46
- "@dxos/blueprints": "0.8.4-main.c4373fc",
47
- "@dxos/echo": "0.8.4-main.c4373fc",
48
- "@dxos/client": "0.8.4-main.c4373fc",
49
- "@dxos/effect": "0.8.4-main.c4373fc",
50
- "@dxos/invariant": "0.8.4-main.c4373fc",
51
- "@dxos/log": "0.8.4-main.c4373fc",
52
- "@dxos/plugin-client": "0.8.4-main.c4373fc",
53
- "@dxos/plugin-graph": "0.8.4-main.c4373fc",
54
- "@dxos/plugin-space": "0.8.4-main.c4373fc",
55
- "@dxos/plugin-search": "0.8.4-main.c4373fc",
56
- "@dxos/random": "0.8.4-main.c4373fc",
57
- "@dxos/react-client": "0.8.4-main.c4373fc",
58
- "@dxos/react-ui-board": "0.8.4-main.c4373fc",
59
- "@dxos/react-ui": "0.8.4-main.c4373fc",
60
- "@dxos/react-ui-form": "0.8.4-main.c4373fc",
61
- "@dxos/react-ui-stack": "0.8.4-main.c4373fc",
62
- "@dxos/schema": "0.8.4-main.c4373fc",
63
- "@dxos/util": "0.8.4-main.c4373fc"
42
+ "effect": "3.19.16",
43
+ "@dxos/ai": "0.8.4-main.c85a9c8dae",
44
+ "@dxos/app-toolkit": "0.8.4-main.c85a9c8dae",
45
+ "@dxos/app-framework": "0.8.4-main.c85a9c8dae",
46
+ "@dxos/assistant": "0.8.4-main.c85a9c8dae",
47
+ "@dxos/blueprints": "0.8.4-main.c85a9c8dae",
48
+ "@dxos/echo": "0.8.4-main.c85a9c8dae",
49
+ "@dxos/effect": "0.8.4-main.c85a9c8dae",
50
+ "@dxos/client": "0.8.4-main.c85a9c8dae",
51
+ "@dxos/invariant": "0.8.4-main.c85a9c8dae",
52
+ "@dxos/log": "0.8.4-main.c85a9c8dae",
53
+ "@dxos/operation": "0.8.4-main.c85a9c8dae",
54
+ "@dxos/plugin-client": "0.8.4-main.c85a9c8dae",
55
+ "@dxos/plugin-graph": "0.8.4-main.c85a9c8dae",
56
+ "@dxos/async": "0.8.4-main.c85a9c8dae",
57
+ "@dxos/plugin-search": "0.8.4-main.c85a9c8dae",
58
+ "@dxos/random": "0.8.4-main.c85a9c8dae",
59
+ "@dxos/plugin-space": "0.8.4-main.c85a9c8dae",
60
+ "@dxos/react-client": "0.8.4-main.c85a9c8dae",
61
+ "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
62
+ "@dxos/react-ui-attention": "0.8.4-main.c85a9c8dae",
63
+ "@dxos/react-ui-board": "0.8.4-main.c85a9c8dae",
64
+ "@dxos/react-ui-form": "0.8.4-main.c85a9c8dae",
65
+ "@dxos/react-ui-stack": "0.8.4-main.c85a9c8dae",
66
+ "@dxos/react-ui-mosaic": "0.8.4-main.c85a9c8dae",
67
+ "@dxos/schema": "0.8.4-main.c85a9c8dae",
68
+ "@dxos/types": "0.8.4-main.c85a9c8dae",
69
+ "@dxos/util": "0.8.4-main.c85a9c8dae",
70
+ "@dxos/echo-react": "0.8.4-main.c85a9c8dae"
64
71
  },
65
72
  "devDependencies": {
66
- "@types/react": "~19.2.2",
67
- "@types/react-dom": "~19.2.1",
68
- "react": "~19.2.0",
69
- "react-dom": "~19.2.0",
70
- "vite": "7.1.9",
71
- "@dxos/plugin-preview": "0.8.4-main.c4373fc",
72
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.c4373fc",
73
- "@dxos/react-ui-theme": "0.8.4-main.c4373fc",
74
- "@dxos/plugin-theme": "0.8.4-main.c4373fc",
75
- "@dxos/storybook-utils": "0.8.4-main.c4373fc",
76
- "@dxos/test-utils": "0.8.4-main.c4373fc"
73
+ "@types/react": "~19.2.7",
74
+ "@types/react-dom": "~19.2.3",
75
+ "react": "~19.2.3",
76
+ "react-dom": "~19.2.3",
77
+ "vite": "^7.1.11",
78
+ "@dxos/plugin-testing": "0.8.4-main.c85a9c8dae",
79
+ "@dxos/plugin-theme": "0.8.4-main.c85a9c8dae",
80
+ "@dxos/test-utils": "0.8.4-main.c85a9c8dae",
81
+ "@dxos/storybook-utils": "0.8.4-main.c85a9c8dae",
82
+ "@dxos/plugin-preview": "0.8.4-main.c85a9c8dae",
83
+ "@dxos/ui-theme": "0.8.4-main.c85a9c8dae",
84
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.c85a9c8dae"
77
85
  },
78
86
  "peerDependencies": {
79
- "effect": "^3.13.3",
80
- "react": "^19.0.0",
81
- "react-dom": "^19.0.0",
82
- "@dxos/react-ui": "0.8.4-main.c4373fc",
83
- "@dxos/react-ui-theme": "0.8.4-main.c4373fc"
87
+ "effect": "3.19.16",
88
+ "react": "~19.2.3",
89
+ "react-dom": "~19.2.3",
90
+ "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
91
+ "@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
84
92
  },
85
93
  "publishConfig": {
86
94
  "access": "public"
@@ -2,55 +2,32 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities, Events, contributes, createIntent, defineModule, definePlugin } from '@dxos/app-framework';
6
- import { ClientEvents } from '@dxos/plugin-client';
7
- import { SpaceCapabilities } from '@dxos/plugin-space';
8
- import { defineObjectForm } from '@dxos/plugin-space/types';
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Plugin } from '@dxos/app-framework';
8
+ import { AppPlugin } from '@dxos/app-toolkit';
9
+ import { type CreateObject } from '@dxos/plugin-space/types';
9
10
  import { translations as boardTranslations } from '@dxos/react-ui-board';
10
11
 
11
- import { IntentResolver, ReactSurface } from './capabilities';
12
+ import { ReactSurface } from './capabilities';
12
13
  import { meta } from './meta';
13
14
  import { translations } from './translations';
14
15
  import { Board } from './types';
15
16
 
16
- export const BoardPlugin = definePlugin(meta, () => [
17
- defineModule({
18
- id: `${meta.id}/module/translations`,
19
- activatesOn: Events.SetupTranslations,
20
- activate: () => contributes(Capabilities.Translations, [...translations, ...boardTranslations]),
21
- }),
22
- defineModule({
23
- id: `${meta.id}/module/metadata`,
24
- activatesOn: Events.SetupMetadata,
25
- activate: () =>
26
- // TODO(burdon): "Metadata" here seems non-descriptive; is this specifically for the type? ObjectMetadata?
27
- contributes(Capabilities.Metadata, {
28
- id: Board.Board.typename,
29
- metadata: {
30
- icon: 'ph--squares-four--regular',
31
- },
32
- }),
33
- }),
34
- defineModule({
35
- id: `${meta.id}/module/object-form`,
36
- activatesOn: ClientEvents.SetupSchema,
37
- activate: () =>
38
- contributes(
39
- SpaceCapabilities.ObjectForm,
40
- defineObjectForm({
41
- objectSchema: Board.Board,
42
- getIntent: () => createIntent(Board.Create),
43
- }),
44
- ),
45
- }),
46
- defineModule({
47
- id: `${meta.id}/module/react-surface`,
48
- activatesOn: Events.SetupReactSurface,
49
- activate: ReactSurface,
50
- }),
51
- defineModule({
52
- id: `${meta.id}/module/intent-resolver`,
53
- activatesOn: Events.SetupIntentResolver,
54
- activate: IntentResolver,
17
+ export const BoardPlugin = Plugin.define(meta).pipe(
18
+ AppPlugin.addMetadataModule({
19
+ metadata: {
20
+ id: Board.Board.typename,
21
+ metadata: {
22
+ icon: 'ph--squares-four--regular',
23
+ iconHue: 'green',
24
+ createObject: ((props) => Effect.sync(() => Board.makeBoard(props))) satisfies CreateObject,
25
+ addToCollectionOnCreate: true,
26
+ },
27
+ },
55
28
  }),
56
- ]);
29
+ AppPlugin.addSchemaModule({ schema: [Board.Board] }),
30
+ AppPlugin.addSurfaceModule({ activate: ReactSurface }),
31
+ AppPlugin.addTranslationsModule({ translations: [...translations, ...boardTranslations] }),
32
+ Plugin.make,
33
+ );
@@ -2,7 +2,4 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
6
-
7
- export const IntentResolver = lazy(() => import('./intent-resolver'));
8
- export const ReactSurface = lazy(() => import('./react-surface'));
5
+ export * from './react-surface';
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -0,0 +1,27 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React from 'react';
7
+
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface } from '@dxos/app-framework/ui';
10
+ import { Obj } from '@dxos/echo';
11
+
12
+ import { BoardContainer } from '../../containers';
13
+ import { meta } from '../../meta';
14
+ import { Board } from '../../types';
15
+
16
+ export default Capability.makeModule(() =>
17
+ Effect.succeed(
18
+ Capability.contributes(Capabilities.ReactSurface, [
19
+ Surface.create({
20
+ id: meta.id,
21
+ role: ['article', 'section'],
22
+ filter: (data): data is { subject: Board.Board } => Obj.instanceOf(Board.Board, data.subject),
23
+ component: ({ role, data }) => <BoardContainer role={role} subject={data.subject} />,
24
+ }),
25
+ ]),
26
+ ),
27
+ );
@@ -1,5 +1,3 @@
1
1
  //
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
-
5
- export * from './BoardContainer';
@@ -0,0 +1,122 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { type StoryObj } from '@storybook/react-vite';
6
+ import * as Effect from 'effect/Effect';
7
+ import React, { useEffect, useState } from 'react';
8
+
9
+ import { withPluginManager } from '@dxos/app-framework/testing';
10
+ import { Obj } from '@dxos/echo';
11
+ import { ClientPlugin } from '@dxos/plugin-client';
12
+ import { PreviewPlugin } from '@dxos/plugin-preview';
13
+ import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
14
+ import { faker } from '@dxos/random';
15
+ import { Filter, Ref, useQuery, useSpaces } from '@dxos/react-client/echo';
16
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
17
+ import { translations as stackTranslations } from '@dxos/react-ui-stack';
18
+ import { Organization, Person } from '@dxos/types';
19
+
20
+ import { translations } from '../../translations';
21
+ import { Board } from '../../types';
22
+
23
+ import { BoardContainer } from './BoardContainer';
24
+
25
+ faker.seed(0);
26
+
27
+ const createBoard = () =>
28
+ Obj.make(Board.Board, {
29
+ name: 'Test Board',
30
+ items: [],
31
+ layout: {
32
+ size: { width: 7, height: 5 },
33
+ cells: {},
34
+ },
35
+ });
36
+
37
+ const createOrg = () =>
38
+ Obj.make(Organization.Organization, {
39
+ name: faker.commerce.productName(),
40
+ description: faker.lorem.paragraph(),
41
+ image: faker.image.url(),
42
+ website: faker.internet.url(),
43
+ // TODO(burdon): Fix.
44
+ // status: faker.helpers.arrayElement(Organization.StatusOptions).id,
45
+ });
46
+
47
+ const DefaultStory = () => {
48
+ const spaces = useSpaces();
49
+ const space = spaces[spaces.length - 1];
50
+ const boards = useQuery(space?.db, Filter.type(Board.Board));
51
+ const [board, setBoard] = useState<Board.Board>();
52
+
53
+ useEffect(() => {
54
+ if (boards.length && !board) {
55
+ const board = boards[0];
56
+ setBoard(board);
57
+ }
58
+ }, [boards]);
59
+
60
+ if (!board) {
61
+ return null;
62
+ }
63
+
64
+ return <BoardContainer role='board' subject={board} />;
65
+ };
66
+
67
+ //
68
+ // Story definitions
69
+ //
70
+
71
+ const meta = {
72
+ title: 'plugins/plugin-board/containers/BoardContainer',
73
+ render: DefaultStory,
74
+ decorators: [
75
+ withTheme(),
76
+ withLayout({ layout: 'fullscreen' }),
77
+ withPluginManager({
78
+ plugins: [
79
+ ...corePlugins(),
80
+ ClientPlugin({
81
+ types: [Organization.Organization, Person.Person, Board.Board],
82
+ onClientInitialized: ({ client }) =>
83
+ Effect.gen(function* () {
84
+ yield* Effect.promise(() => client.halo.createIdentity());
85
+ const space = yield* Effect.promise(() => client.spaces.create());
86
+ yield* Effect.promise(() => space.waitUntilReady());
87
+ const board = space.db.add(createBoard());
88
+
89
+ Obj.change(board, (b) => {
90
+ // Add some sample items
91
+ Array.from({ length: 10 }).map(() => {
92
+ const org = createOrg();
93
+ space.db.add(org);
94
+ b.items.push(Ref.make(org));
95
+ b.layout.cells[org.id] = {
96
+ x: Math.floor(Math.random() * 5) - 2,
97
+ y: Math.floor(Math.random() * 5) - 2,
98
+ width: 1,
99
+ height: 1,
100
+ };
101
+ return org;
102
+ });
103
+ });
104
+ }),
105
+ }),
106
+
107
+ StorybookPlugin({}),
108
+ PreviewPlugin(),
109
+ ],
110
+ }),
111
+ ],
112
+ parameters: {
113
+ layout: 'fullscreen',
114
+ translations: [...translations, ...stackTranslations],
115
+ },
116
+ };
117
+
118
+ export default meta;
119
+
120
+ type Story = StoryObj<typeof meta>;
121
+
122
+ export const Default: Story = {};
@@ -0,0 +1,155 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { useCallback, useMemo, useRef, useState } from 'react';
6
+
7
+ import { Surface } from '@dxos/app-framework/ui';
8
+ import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
9
+ import { Filter, Obj, Ref } from '@dxos/echo';
10
+ import { useObject, useObjects } from '@dxos/echo-react';
11
+ import { invariant } from '@dxos/invariant';
12
+ import { useQuery } from '@dxos/react-client/echo';
13
+ import { Panel } from '@dxos/react-ui';
14
+ import { useAttention } from '@dxos/react-ui-attention';
15
+ import { Board, type BoardController, type BoardRootProps, type Position } from '@dxos/react-ui-board';
16
+ import { ObjectPicker, type ObjectPickerContentProps } from '@dxos/react-ui-form';
17
+ import { isNonNullable } from '@dxos/util';
18
+
19
+ import { type Board as BoardType } from '../../types';
20
+
21
+ const DEFAULT_POSITION = { x: 0, y: 0 } satisfies Position;
22
+
23
+ type PickerState = {
24
+ position: Position;
25
+ };
26
+
27
+ export type BoardContainerProps = SurfaceComponentProps<BoardType.Board>;
28
+
29
+ export const BoardContainer = ({ role, subject: board }: BoardContainerProps) => {
30
+ const controller = useRef<BoardController>(null);
31
+ const [boardItems] = useObject(board, 'items');
32
+ const items = useObjects(boardItems ?? []);
33
+ const addTriggerRef = useRef<HTMLButtonElement | null>(null);
34
+ const [pickerState, setPickerState] = useState<PickerState | null>(null);
35
+ const attendableId = Obj.getDXN(board).toString();
36
+ const { hasAttention } = useAttention(attendableId);
37
+
38
+ const db = Obj.getDatabase(board);
39
+ // TODO(burdon): Use search.
40
+ const objects = useQuery(db, Filter.everything());
41
+ const options = useMemo<ObjectPickerContentProps['options']>(
42
+ () =>
43
+ objects
44
+ .filter((obj) => obj.id !== board.id)
45
+ .map((obj) => {
46
+ const label = Obj.getLabel(obj);
47
+ if (label) {
48
+ return {
49
+ id: obj.id,
50
+ label,
51
+ hue: 'neutral' as const,
52
+ };
53
+ }
54
+ })
55
+ .filter(isNonNullable)
56
+ .sort(({ label: a }, { label: b }) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase())),
57
+ [objects],
58
+ );
59
+
60
+ const handleAdd = useCallback<NonNullable<BoardRootProps['onAdd']>>(
61
+ async (anchor, position = DEFAULT_POSITION) => {
62
+ const db = Obj.getDatabase(board);
63
+ invariant(db);
64
+ addTriggerRef.current = anchor;
65
+ setPickerState({
66
+ position,
67
+ });
68
+ },
69
+ [board],
70
+ );
71
+
72
+ // TODO(burdon): Use intents so can be undone.
73
+ const handleDelete = useCallback<NonNullable<BoardRootProps['onDelete']>>(
74
+ (id) => {
75
+ // TODO(burdon): Impl. DXN.equals and pass in DXN from `id`.
76
+ const idx = board.items.findIndex((ref) => ref.dxn.asEchoDXN()?.echoId === id);
77
+ Obj.change(board, (b) => {
78
+ if (idx !== -1) {
79
+ b.items.splice(idx, 1);
80
+ }
81
+ delete b.layout.cells[id];
82
+ });
83
+ },
84
+ [board],
85
+ );
86
+
87
+ const handleMove = useCallback<NonNullable<BoardRootProps['onMove']>>(
88
+ (id, position) => {
89
+ const layout = board.layout.cells[id];
90
+ Obj.change(board, (b) => {
91
+ b.layout.cells[id] = { ...layout, ...position };
92
+ });
93
+ },
94
+ [board],
95
+ );
96
+
97
+ const handleSelect = useCallback<NonNullable<ObjectPickerContentProps['onSelect']>>(
98
+ (id) => {
99
+ if (!pickerState) {
100
+ return;
101
+ }
102
+
103
+ // Find the selected object by id from the space.
104
+ const selectedObject = objects.find((obj) => obj.id === id);
105
+ if (!Obj.isObject(selectedObject)) {
106
+ return;
107
+ }
108
+
109
+ // Create a reference to the selected object and add it to the board.
110
+ Obj.change(board, (b) => {
111
+ b.items.push(Ref.make(selectedObject));
112
+
113
+ // Set the layout position for the new item.
114
+ b.layout.cells[selectedObject.id.toString()] = pickerState.position;
115
+ });
116
+
117
+ // Close the picker.
118
+ setPickerState(null);
119
+ },
120
+ [pickerState, objects, board],
121
+ );
122
+
123
+ return (
124
+ <Board.Root ref={controller} layout={board.layout} onAdd={handleAdd} onDelete={handleDelete} onMove={handleMove}>
125
+ <ObjectPicker.Root
126
+ open={!!pickerState}
127
+ onOpenChange={(nextOpen: boolean) => {
128
+ setPickerState(nextOpen ? { position: DEFAULT_POSITION } : null);
129
+ }}
130
+ >
131
+ <Panel.Root role={role}>
132
+ <Panel.Toolbar asChild>
133
+ <Board.Toolbar disabled={!hasAttention} />
134
+ </Panel.Toolbar>
135
+ <Panel.Content asChild>
136
+ <Board.Container>
137
+ <Board.Viewport classNames='border-none'>
138
+ <Board.Backdrop />
139
+ <Board.Content>
140
+ {items?.map((item, index) => (
141
+ <Board.Cell item={item} key={index} layout={board.layout?.cells[item.id] ?? { x: 0, y: 0 }}>
142
+ <Surface.Surface role='card--content' data={{ subject: item }} limit={1} />
143
+ </Board.Cell>
144
+ ))}
145
+ </Board.Content>
146
+ </Board.Viewport>
147
+ </Board.Container>
148
+ </Panel.Content>
149
+ </Panel.Root>
150
+ <ObjectPicker.Content options={options} onSelect={handleSelect} classNames='dx-card-popover-width' />
151
+ <ObjectPicker.VirtualTrigger virtualRef={addTriggerRef} />
152
+ </ObjectPicker.Root>
153
+ </Board.Root>
154
+ );
155
+ };
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { BoardContainer } from './BoardContainer';
6
+
7
+ export default BoardContainer;
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type ComponentType, lazy } from 'react';
6
+
7
+ export const BoardContainer: ComponentType<any> = lazy(() => import('./BoardContainer'));
package/src/index.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './components';
6
5
  export * from './meta';
7
6
  export * from './types';
8
7
 
package/src/meta.ts CHANGED
@@ -2,14 +2,18 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
+ import { trim } from '@dxos/util';
6
7
 
7
- export const meta: PluginMeta = {
8
+ export const meta: Plugin.Meta = {
8
9
  id: 'dxos.org/plugin/board',
9
10
  name: 'Board',
10
- description:
11
- 'A spatial, infinite canvas app combining notes, media, and whiteboarding in a tactile, visual interface.',
11
+ description: trim`
12
+ Infinite canvas workspace that combines sticky notes, media, and whiteboarding tools.
13
+ Arrange and connect ideas freely in a visual space perfect for brainstorming and creative collaboration.
14
+ `,
12
15
  icon: 'ph--squares-four--regular',
16
+ iconHue: 'green',
13
17
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-board',
14
18
  screenshots: [],
15
19
  };
@@ -18,6 +18,7 @@ export const translations = [
18
18
  'object name placeholder': 'New board',
19
19
  'rename object label': 'Rename board',
20
20
  'delete object label': 'Delete board',
21
+ 'object deleted label': 'Board deleted',
21
22
  },
22
23
  [meta.id]: {
23
24
  'plugin name': 'Board',
@@ -4,21 +4,19 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { Obj, Type } from '@dxos/echo';
8
- import { LabelAnnotation } from '@dxos/echo/internal';
7
+ import { Obj, Ref, Type } from '@dxos/echo';
8
+ import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
9
9
  import { BoardLayout, defaultLayout } from '@dxos/react-ui-board';
10
10
 
11
- import { meta } from '../meta';
12
-
13
11
  /**
14
12
  * Board and layout.
15
13
  */
16
14
  export const Board = Schema.Struct({
17
- name: Schema.optional(Schema.String),
18
- items: Schema.mutable(Schema.Array(Type.Ref(Type.Expando))),
19
- layout: Schema.mutable(BoardLayout),
15
+ name: Schema.String.pipe(Schema.optional),
16
+ items: Ref.Ref(Obj.Unknown).pipe(Schema.Array, FormInputAnnotation.set(false)),
17
+ layout: BoardLayout.pipe(FormInputAnnotation.set(false)),
20
18
  }).pipe(
21
- Type.Obj({
19
+ Type.object({
22
20
  typename: 'dxos.org/type/Board',
23
21
  version: '0.1.0',
24
22
  }),
@@ -33,15 +31,3 @@ export const makeBoard = (props: Partial<Obj.MakeProps<typeof Board>> = {}) =>
33
31
  layout: defaultLayout,
34
32
  ...props,
35
33
  });
36
-
37
- /**
38
- * Create board.
39
- */
40
- export class Create extends Schema.TaggedClass<Create>()(`${meta.id}/action/create`, {
41
- input: Schema.Struct({
42
- name: Schema.optional(Schema.String),
43
- }),
44
- output: Schema.Struct({
45
- object: Board,
46
- }),
47
- }) {}