@dxos/plugin-board 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203

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 (68) hide show
  1. package/dist/lib/browser/chunk-7VKDDGS7.mjs +36 -0
  2. package/dist/lib/browser/chunk-7VKDDGS7.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-DCLJ4HOC.mjs +159 -0
  4. package/dist/lib/browser/chunk-DCLJ4HOC.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +33 -54
  6. package/dist/lib/browser/index.mjs.map +4 -4
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/react-surface-3ECZMYLQ.mjs +32 -0
  9. package/dist/lib/browser/react-surface-3ECZMYLQ.mjs.map +7 -0
  10. package/dist/lib/browser/types/index.mjs +1 -1
  11. package/dist/lib/node-esm/chunk-HICZFU5T.mjs +161 -0
  12. package/dist/lib/node-esm/chunk-HICZFU5T.mjs.map +7 -0
  13. package/dist/lib/node-esm/chunk-UGVRNKWV.mjs +37 -0
  14. package/dist/lib/node-esm/chunk-UGVRNKWV.mjs.map +7 -0
  15. package/dist/lib/node-esm/index.mjs +33 -54
  16. package/dist/lib/node-esm/index.mjs.map +4 -4
  17. package/dist/lib/node-esm/meta.json +1 -1
  18. package/dist/lib/node-esm/react-surface-W7FPI7BR.mjs +33 -0
  19. package/dist/lib/node-esm/react-surface-W7FPI7BR.mjs.map +7 -0
  20. package/dist/lib/node-esm/types/index.mjs +1 -1
  21. package/dist/types/src/BoardPlugin.d.ts +2 -1
  22. package/dist/types/src/BoardPlugin.d.ts.map +1 -1
  23. package/dist/types/src/capabilities/index.d.ts +1 -2
  24. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  25. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  26. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  28. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  29. package/dist/types/src/components/BoardContainer.d.ts +3 -5
  30. package/dist/types/src/components/BoardContainer.d.ts.map +1 -1
  31. package/dist/types/src/components/BoardContainer.stories.d.ts +2 -3
  32. package/dist/types/src/components/BoardContainer.stories.d.ts.map +1 -1
  33. package/dist/types/src/meta.d.ts +2 -2
  34. package/dist/types/src/meta.d.ts.map +1 -1
  35. package/dist/types/src/types/Board.d.ts +24 -60
  36. package/dist/types/src/types/Board.d.ts.map +1 -1
  37. package/dist/types/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +56 -50
  39. package/src/BoardPlugin.tsx +22 -40
  40. package/src/capabilities/index.ts +1 -4
  41. package/src/capabilities/react-surface/index.ts +7 -0
  42. package/src/capabilities/react-surface/react-surface.tsx +27 -0
  43. package/src/components/BoardContainer.stories.tsx +30 -34
  44. package/src/components/BoardContainer.tsx +29 -24
  45. package/src/meta.ts +2 -2
  46. package/src/types/Board.ts +3 -17
  47. package/dist/lib/browser/chunk-BPWAJIIV.mjs +0 -64
  48. package/dist/lib/browser/chunk-BPWAJIIV.mjs.map +0 -7
  49. package/dist/lib/browser/chunk-Q2FY5QDD.mjs +0 -143
  50. package/dist/lib/browser/chunk-Q2FY5QDD.mjs.map +0 -7
  51. package/dist/lib/browser/intent-resolver-N25TTBCB.mjs +0 -33
  52. package/dist/lib/browser/intent-resolver-N25TTBCB.mjs.map +0 -7
  53. package/dist/lib/browser/react-surface-QP64T3BI.mjs +0 -30
  54. package/dist/lib/browser/react-surface-QP64T3BI.mjs.map +0 -7
  55. package/dist/lib/node-esm/chunk-366TAZLJ.mjs +0 -65
  56. package/dist/lib/node-esm/chunk-366TAZLJ.mjs.map +0 -7
  57. package/dist/lib/node-esm/chunk-WG2I3CAR.mjs +0 -145
  58. package/dist/lib/node-esm/chunk-WG2I3CAR.mjs.map +0 -7
  59. package/dist/lib/node-esm/intent-resolver-IAZULV42.mjs +0 -34
  60. package/dist/lib/node-esm/intent-resolver-IAZULV42.mjs.map +0 -7
  61. package/dist/lib/node-esm/react-surface-D6JA57PU.mjs +0 -31
  62. package/dist/lib/node-esm/react-surface-D6JA57PU.mjs.map +0 -7
  63. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  64. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  65. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  66. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  67. package/src/capabilities/intent-resolver.ts +0 -34
  68. package/src/capabilities/react-surface.tsx +0 -22
package/package.json CHANGED
@@ -1,25 +1,29 @@
1
1
  {
2
2
  "name": "@dxos/plugin-board",
3
- "version": "0.8.4-main.3c1ae3b",
3
+ "version": "0.8.4-main.3eb6e50203",
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,
10
14
  "type": "module",
11
15
  "exports": {
12
16
  ".": {
13
- "source": "./src/index.ts",
14
- "types": "./dist/types/src/index.d.ts",
15
17
  "browser": "./dist/lib/browser/index.mjs",
16
- "node": "./dist/lib/node-esm/index.mjs"
18
+ "node": "./dist/lib/node-esm/index.mjs",
19
+ "source": "./src/index.ts",
20
+ "types": "./dist/types/src/index.d.ts"
17
21
  },
18
22
  "./types": {
19
- "source": "./src/types/index.ts",
20
- "types": "./dist/types/src/types/index.d.ts",
21
23
  "browser": "./dist/lib/browser/types/index.mjs",
22
- "node": "./dist/lib/node-esm/types/index.mjs"
24
+ "node": "./dist/lib/node-esm/types/index.mjs",
25
+ "source": "./src/types/index.ts",
26
+ "types": "./dist/types/src/types/index.d.ts"
23
27
  }
24
28
  },
25
29
  "types": "dist/types/src/index.d.ts",
@@ -35,54 +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.3c1ae3b",
43
- "@dxos/app-framework": "0.8.4-main.3c1ae3b",
44
- "@dxos/async": "0.8.4-main.3c1ae3b",
45
- "@dxos/assistant": "0.8.4-main.3c1ae3b",
46
- "@dxos/blueprints": "0.8.4-main.3c1ae3b",
47
- "@dxos/invariant": "0.8.4-main.3c1ae3b",
48
- "@dxos/client": "0.8.4-main.3c1ae3b",
49
- "@dxos/echo": "0.8.4-main.3c1ae3b",
50
- "@dxos/effect": "0.8.4-main.3c1ae3b",
51
- "@dxos/plugin-client": "0.8.4-main.3c1ae3b",
52
- "@dxos/plugin-graph": "0.8.4-main.3c1ae3b",
53
- "@dxos/react-client": "0.8.4-main.3c1ae3b",
54
- "@dxos/plugin-space": "0.8.4-main.3c1ae3b",
55
- "@dxos/react-ui": "0.8.4-main.3c1ae3b",
56
- "@dxos/plugin-search": "0.8.4-main.3c1ae3b",
57
- "@dxos/log": "0.8.4-main.3c1ae3b",
58
- "@dxos/react-ui-board": "0.8.4-main.3c1ae3b",
59
- "@dxos/react-ui-attention": "0.8.4-main.3c1ae3b",
60
- "@dxos/react-ui-stack": "0.8.4-main.3c1ae3b",
61
- "@dxos/react-ui-form": "0.8.4-main.3c1ae3b",
62
- "@dxos/schema": "0.8.4-main.3c1ae3b",
63
- "@dxos/types": "0.8.4-main.3c1ae3b",
64
- "@dxos/random": "0.8.4-main.3c1ae3b",
65
- "@dxos/util": "0.8.4-main.3c1ae3b"
42
+ "effect": "3.19.16",
43
+ "@dxos/ai": "0.8.4-main.3eb6e50203",
44
+ "@dxos/app-framework": "0.8.4-main.3eb6e50203",
45
+ "@dxos/assistant": "0.8.4-main.3eb6e50203",
46
+ "@dxos/blueprints": "0.8.4-main.3eb6e50203",
47
+ "@dxos/async": "0.8.4-main.3eb6e50203",
48
+ "@dxos/client": "0.8.4-main.3eb6e50203",
49
+ "@dxos/echo": "0.8.4-main.3eb6e50203",
50
+ "@dxos/echo-react": "0.8.4-main.3eb6e50203",
51
+ "@dxos/effect": "0.8.4-main.3eb6e50203",
52
+ "@dxos/invariant": "0.8.4-main.3eb6e50203",
53
+ "@dxos/log": "0.8.4-main.3eb6e50203",
54
+ "@dxos/operation": "0.8.4-main.3eb6e50203",
55
+ "@dxos/plugin-client": "0.8.4-main.3eb6e50203",
56
+ "@dxos/plugin-search": "0.8.4-main.3eb6e50203",
57
+ "@dxos/app-toolkit": "0.8.4-main.3eb6e50203",
58
+ "@dxos/plugin-space": "0.8.4-main.3eb6e50203",
59
+ "@dxos/plugin-graph": "0.8.4-main.3eb6e50203",
60
+ "@dxos/random": "0.8.4-main.3eb6e50203",
61
+ "@dxos/react-ui": "0.8.4-main.3eb6e50203",
62
+ "@dxos/react-ui-attention": "0.8.4-main.3eb6e50203",
63
+ "@dxos/react-ui-form": "0.8.4-main.3eb6e50203",
64
+ "@dxos/react-ui-board": "0.8.4-main.3eb6e50203",
65
+ "@dxos/react-ui-mosaic": "0.8.4-main.3eb6e50203",
66
+ "@dxos/react-ui-stack": "0.8.4-main.3eb6e50203",
67
+ "@dxos/schema": "0.8.4-main.3eb6e50203",
68
+ "@dxos/types": "0.8.4-main.3eb6e50203",
69
+ "@dxos/util": "0.8.4-main.3eb6e50203",
70
+ "@dxos/react-client": "0.8.4-main.3eb6e50203"
66
71
  },
67
72
  "devDependencies": {
68
- "@types/react": "~19.2.2",
69
- "@types/react-dom": "~19.2.2",
70
- "react": "~19.2.0",
71
- "react-dom": "~19.2.0",
73
+ "@types/react": "~19.2.7",
74
+ "@types/react-dom": "~19.2.3",
75
+ "react": "~19.2.3",
76
+ "react-dom": "~19.2.3",
72
77
  "vite": "7.1.9",
73
- "@dxos/plugin-preview": "0.8.4-main.3c1ae3b",
74
- "@dxos/plugin-theme": "0.8.4-main.3c1ae3b",
75
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.3c1ae3b",
76
- "@dxos/react-ui-theme": "0.8.4-main.3c1ae3b",
77
- "@dxos/storybook-utils": "0.8.4-main.3c1ae3b",
78
- "@dxos/test-utils": "0.8.4-main.3c1ae3b"
78
+ "@dxos/plugin-preview": "0.8.4-main.3eb6e50203",
79
+ "@dxos/plugin-testing": "0.8.4-main.3eb6e50203",
80
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.3eb6e50203",
81
+ "@dxos/storybook-utils": "0.8.4-main.3eb6e50203",
82
+ "@dxos/test-utils": "0.8.4-main.3eb6e50203",
83
+ "@dxos/ui-theme": "0.8.4-main.3eb6e50203",
84
+ "@dxos/plugin-theme": "0.8.4-main.3eb6e50203"
79
85
  },
80
86
  "peerDependencies": {
81
- "effect": "^3.13.3",
82
- "react": "^19.0.0",
83
- "react-dom": "^19.0.0",
84
- "@dxos/react-ui": "0.8.4-main.3c1ae3b",
85
- "@dxos/react-ui-theme": "0.8.4-main.3c1ae3b"
87
+ "effect": "3.19.16",
88
+ "react": "~19.2.3",
89
+ "react-dom": "~19.2.3",
90
+ "@dxos/react-ui": "0.8.4-main.3eb6e50203",
91
+ "@dxos/ui-theme": "0.8.4-main.3eb6e50203"
86
92
  },
87
93
  "publishConfig": {
88
94
  "access": "public"
@@ -2,50 +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 { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
7
- import { type CreateObjectIntent } 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';
8
10
  import { translations as boardTranslations } from '@dxos/react-ui-board';
9
11
 
10
- import { IntentResolver, ReactSurface } from './capabilities';
12
+ import { ReactSurface } from './capabilities';
11
13
  import { meta } from './meta';
12
14
  import { translations } from './translations';
13
15
  import { Board } from './types';
14
16
 
15
- export const BoardPlugin = definePlugin(meta, () => [
16
- defineModule({
17
- id: `${meta.id}/module/translations`,
18
- activatesOn: Events.SetupTranslations,
19
- activate: () => contributes(Capabilities.Translations, [...translations, ...boardTranslations]),
20
- }),
21
- defineModule({
22
- id: `${meta.id}/module/metadata`,
23
- activatesOn: Events.SetupMetadata,
24
- activate: () =>
25
- // TODO(burdon): "Metadata" here seems non-descriptive; is this specifically for the type? ObjectMetadata?
26
- contributes(Capabilities.Metadata, {
27
- id: Board.Board.typename,
28
- metadata: {
29
- icon: 'ph--squares-four--regular',
30
- iconHue: 'green',
31
- creatObjectIntent: (() => createIntent(Board.Create)) satisfies CreateObjectIntent,
32
- addToCollectionOnCreate: true,
33
- },
34
- }),
35
- }),
36
- defineModule({
37
- id: `${meta.id}/module/schema`,
38
- activatesOn: ClientEvents.SetupSchema,
39
- activate: () => contributes(ClientCapabilities.Schema, [Board.Board]),
40
- }),
41
- defineModule({
42
- id: `${meta.id}/module/react-surface`,
43
- activatesOn: Events.SetupReactSurface,
44
- activate: ReactSurface,
45
- }),
46
- defineModule({
47
- id: `${meta.id}/module/intent-resolver`,
48
- activatesOn: Events.SetupIntentResolver,
49
- 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
+ },
50
28
  }),
51
- ]);
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 '../../components';
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
+ );
@@ -3,21 +3,18 @@
3
3
  //
4
4
 
5
5
  import { type StoryObj } from '@storybook/react-vite';
6
+ import * as Effect from 'effect/Effect';
6
7
  import React, { useEffect, useState } from 'react';
7
8
 
8
- import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
9
9
  import { withPluginManager } from '@dxos/app-framework/testing';
10
10
  import { Obj } from '@dxos/echo';
11
11
  import { ClientPlugin } from '@dxos/plugin-client';
12
12
  import { PreviewPlugin } from '@dxos/plugin-preview';
13
- import { SpacePlugin } from '@dxos/plugin-space';
14
- import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
15
- import { ThemePlugin } from '@dxos/plugin-theme';
13
+ import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
16
14
  import { faker } from '@dxos/random';
17
15
  import { Filter, Ref, useQuery, useSpaces } from '@dxos/react-client/echo';
18
16
  import { withTheme } from '@dxos/react-ui/testing';
19
17
  import { translations as stackTranslations } from '@dxos/react-ui-stack';
20
- import { defaultTx } from '@dxos/react-ui-theme';
21
18
  import { Organization, Person } from '@dxos/types';
22
19
 
23
20
  import { translations } from '../translations';
@@ -50,7 +47,7 @@ const createOrg = () =>
50
47
  const DefaultStory = () => {
51
48
  const spaces = useSpaces();
52
49
  const space = spaces[spaces.length - 1];
53
- const boards = useQuery(space, Filter.type(Board.Board));
50
+ const boards = useQuery(space?.db, Filter.type(Board.Board));
54
51
  const [board, setBoard] = useState<Board.Board>();
55
52
 
56
53
  useEffect(() => {
@@ -64,7 +61,7 @@ const DefaultStory = () => {
64
61
  return null;
65
62
  }
66
63
 
67
- return <BoardContainer role='board' board={board} />;
64
+ return <BoardContainer role='board' subject={board} />;
68
65
  };
69
66
 
70
67
  //
@@ -75,40 +72,39 @@ const meta = {
75
72
  title: 'plugins/plugin-board/Board',
76
73
  render: DefaultStory,
77
74
  decorators: [
78
- withTheme,
75
+ withTheme(),
79
76
  withPluginManager({
80
77
  plugins: [
78
+ ...corePlugins(),
81
79
  ClientPlugin({
82
80
  types: [Organization.Organization, Person.Person, Board.Board],
83
- onClientInitialized: async ({ client }) => {
84
- await client.halo.createIdentity();
85
- const space = await client.spaces.create();
86
- await space.waitUntilReady();
87
- const board = space.db.add(createBoard());
88
-
89
- // Add some sample items
90
- Array.from({ length: 10 }).map(() => {
91
- const org = createOrg();
92
- space.db.add(org);
93
- board.items.push(Ref.make(org));
94
- board.layout.cells[org.id] = {
95
- x: Math.floor(Math.random() * 5) - 2,
96
- y: Math.floor(Math.random() * 5) - 2,
97
- width: 1,
98
- height: 1,
99
- };
100
- return org;
101
- });
102
- },
81
+ onClientInitialized: ({ client }) =>
82
+ Effect.gen(function* () {
83
+ yield* Effect.promise(() => client.halo.createIdentity());
84
+ const space = yield* Effect.promise(() => client.spaces.create());
85
+ yield* Effect.promise(() => space.waitUntilReady());
86
+ const board = space.db.add(createBoard());
87
+
88
+ Obj.change(board, (b) => {
89
+ // Add some sample items
90
+ Array.from({ length: 10 }).map(() => {
91
+ const org = createOrg();
92
+ space.db.add(org);
93
+ b.items.push(Ref.make(org));
94
+ b.layout.cells[org.id] = {
95
+ x: Math.floor(Math.random() * 5) - 2,
96
+ y: Math.floor(Math.random() * 5) - 2,
97
+ width: 1,
98
+ height: 1,
99
+ };
100
+ return org;
101
+ });
102
+ });
103
+ }),
103
104
  }),
104
- SpacePlugin({}),
105
- IntentPlugin(),
106
- SettingsPlugin(),
107
105
 
108
- // UI
109
- ThemePlugin({ tx: defaultTx }),
106
+ StorybookPlugin({}),
110
107
  PreviewPlugin(),
111
- StorybookLayoutPlugin({}),
112
108
  ],
113
109
  }),
114
110
  ],
@@ -4,16 +4,16 @@
4
4
 
5
5
  import React, { useCallback, useMemo, useRef, useState } from 'react';
6
6
 
7
- import { Surface } from '@dxos/app-framework/react';
8
- import { getSpace } from '@dxos/client/echo';
7
+ import { Surface } from '@dxos/app-framework/ui';
8
+ import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
9
9
  import { Filter, Obj, Ref } from '@dxos/echo';
10
+ import { useObject, useObjects } from '@dxos/echo-react';
10
11
  import { invariant } from '@dxos/invariant';
11
12
  import { useQuery } from '@dxos/react-client/echo';
12
- import { useSignalsMemo } from '@dxos/react-ui';
13
+ import { Layout } from '@dxos/react-ui';
13
14
  import { useAttention } from '@dxos/react-ui-attention';
14
15
  import { Board, type BoardController, type BoardRootProps, type Position } from '@dxos/react-ui-board';
15
16
  import { ObjectPicker, type ObjectPickerContentProps } from '@dxos/react-ui-form';
16
- import { StackItem } from '@dxos/react-ui-stack';
17
17
  import { isNonNullable } from '@dxos/util';
18
18
 
19
19
  import { type Board as BoardType } from '../types';
@@ -24,21 +24,20 @@ type PickerState = {
24
24
  position: Position;
25
25
  };
26
26
 
27
- export type BoardContainerProps = {
28
- role?: string;
29
- board: BoardType.Board;
30
- };
27
+ export type BoardContainerProps = SurfaceComponentProps<BoardType.Board>;
31
28
 
32
- export const BoardContainer = ({ board }: BoardContainerProps) => {
29
+ export const BoardContainer = ({ role, subject: board }: BoardContainerProps) => {
33
30
  const controller = useRef<BoardController>(null);
34
- const items = useSignalsMemo(() => board.items.map((ref) => ref.target).filter(isNonNullable), [board]);
31
+ const [boardItems] = useObject(board, 'items');
32
+ const items = useObjects(boardItems ?? []);
35
33
  const addTriggerRef = useRef<HTMLButtonElement | null>(null);
36
34
  const [pickerState, setPickerState] = useState<PickerState | null>(null);
37
35
  const attendableId = Obj.getDXN(board).toString();
38
36
  const { hasAttention } = useAttention(attendableId);
39
37
 
38
+ const db = Obj.getDatabase(board);
40
39
  // TODO(burdon): Use search.
41
- const objects = useQuery(getSpace(board), Filter.everything());
40
+ const objects = useQuery(db, Filter.everything());
42
41
  const options = useMemo<ObjectPickerContentProps['options']>(
43
42
  () =>
44
43
  objects
@@ -60,8 +59,8 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
60
59
 
61
60
  const handleAdd = useCallback<NonNullable<BoardRootProps['onAdd']>>(
62
61
  async (anchor, position = DEFAULT_POSITION) => {
63
- const space = getSpace(board);
64
- invariant(space);
62
+ const db = Obj.getDatabase(board);
63
+ invariant(db);
65
64
  addTriggerRef.current = anchor;
66
65
  setPickerState({
67
66
  position,
@@ -75,10 +74,12 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
75
74
  (id) => {
76
75
  // TODO(burdon): Impl. DXN.equals and pass in DXN from `id`.
77
76
  const idx = board.items.findIndex((ref) => ref.dxn.asEchoDXN()?.echoId === id);
78
- if (idx !== -1) {
79
- board.items.splice(idx, 1);
80
- }
81
- delete board.layout.cells[id];
77
+ Obj.change(board, (b) => {
78
+ if (idx !== -1) {
79
+ b.items.splice(idx, 1);
80
+ }
81
+ delete b.layout.cells[id];
82
+ });
82
83
  },
83
84
  [board],
84
85
  );
@@ -86,7 +87,9 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
86
87
  const handleMove = useCallback<NonNullable<BoardRootProps['onMove']>>(
87
88
  (id, position) => {
88
89
  const layout = board.layout.cells[id];
89
- board.layout.cells[id] = { ...layout, ...position };
90
+ Obj.change(board, (b) => {
91
+ b.layout.cells[id] = { ...layout, ...position };
92
+ });
90
93
  },
91
94
  [board],
92
95
  );
@@ -104,10 +107,12 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
104
107
  }
105
108
 
106
109
  // Create a reference to the selected object and add it to the board.
107
- board.items.push(Ref.make(selectedObject));
110
+ Obj.change(board, (b) => {
111
+ b.items.push(Ref.make(selectedObject));
108
112
 
109
- // Set the layout position for the new item.
110
- board.layout.cells[selectedObject.id.toString()] = pickerState.position;
113
+ // Set the layout position for the new item.
114
+ b.layout.cells[selectedObject.id.toString()] = pickerState.position;
115
+ });
111
116
 
112
117
  // Close the picker.
113
118
  setPickerState(null);
@@ -123,7 +128,7 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
123
128
  setPickerState(nextOpen ? { position: DEFAULT_POSITION } : null);
124
129
  }}
125
130
  >
126
- <StackItem.Content toolbar>
131
+ <Layout.Main role={role} toolbar>
127
132
  <Board.Toolbar disabled={!hasAttention} />
128
133
  <Board.Container>
129
134
  <Board.Viewport classNames='border-none'>
@@ -131,13 +136,13 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
131
136
  <Board.Content>
132
137
  {items?.map((item, index) => (
133
138
  <Board.Cell item={item} key={index} layout={board.layout?.cells[item.id] ?? { x: 0, y: 0 }}>
134
- <Surface role='card--extrinsic' data={{ subject: item }} limit={1} />
139
+ <Surface.Surface role='card--content' data={{ subject: item }} limit={1} />
135
140
  </Board.Cell>
136
141
  ))}
137
142
  </Board.Content>
138
143
  </Board.Viewport>
139
144
  </Board.Container>
140
- </StackItem.Content>
145
+ </Layout.Main>
141
146
  <ObjectPicker.Content options={options} onSelect={handleSelect} classNames='popover-card-width' />
142
147
  <ObjectPicker.VirtualTrigger virtualRef={addTriggerRef} />
143
148
  </ObjectPicker.Root>
package/src/meta.ts CHANGED
@@ -2,10 +2,10 @@
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
6
  import { trim } from '@dxos/util';
7
7
 
8
- export const meta: PluginMeta = {
8
+ export const meta: Plugin.Meta = {
9
9
  id: 'dxos.org/plugin/board',
10
10
  name: 'Board',
11
11
  description: trim`
@@ -8,17 +8,15 @@ import { Obj, Type } from '@dxos/echo';
8
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
15
  name: Schema.String.pipe(Schema.optional),
18
- items: Type.Ref(Obj.Any).pipe(Schema.Array, Schema.mutable, FormInputAnnotation.set(false)),
19
- layout: BoardLayout.pipe(Schema.mutable, FormInputAnnotation.set(false)),
16
+ items: Type.Ref(Type.Obj).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
- }) {}
@@ -1,64 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // src/types/Board.ts
8
- var Board_exports = {};
9
- __export(Board_exports, {
10
- Board: () => Board,
11
- Create: () => Create,
12
- makeBoard: () => makeBoard
13
- });
14
- import * as Schema from "effect/Schema";
15
- import { Obj, Type } from "@dxos/echo";
16
- import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
17
- import { BoardLayout, defaultLayout } from "@dxos/react-ui-board";
18
-
19
- // src/meta.ts
20
- import { trim } from "@dxos/util";
21
- var meta = {
22
- id: "dxos.org/plugin/board",
23
- name: "Board",
24
- description: trim`
25
- Infinite canvas workspace that combines sticky notes, media, and whiteboarding tools.
26
- Arrange and connect ideas freely in a visual space perfect for brainstorming and creative collaboration.
27
- `,
28
- icon: "ph--squares-four--regular",
29
- iconHue: "green",
30
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-board",
31
- screenshots: []
32
- };
33
-
34
- // src/types/Board.ts
35
- var Board = Schema.Struct({
36
- name: Schema.String.pipe(Schema.optional),
37
- items: Type.Ref(Obj.Any).pipe(Schema.Array, Schema.mutable, FormInputAnnotation.set(false)),
38
- layout: BoardLayout.pipe(Schema.mutable, FormInputAnnotation.set(false))
39
- }).pipe(Type.Obj({
40
- typename: "dxos.org/type/Board",
41
- version: "0.1.0"
42
- }), LabelAnnotation.set([
43
- "name"
44
- ]));
45
- var makeBoard = (props = {}) => Obj.make(Board, {
46
- items: [],
47
- layout: defaultLayout,
48
- ...props
49
- });
50
- var Create = class extends Schema.TaggedClass()(`${meta.id}/action/create`, {
51
- input: Schema.Struct({
52
- name: Schema.optional(Schema.String)
53
- }),
54
- output: Schema.Struct({
55
- object: Board
56
- })
57
- }) {
58
- };
59
-
60
- export {
61
- meta,
62
- Board_exports
63
- };
64
- //# sourceMappingURL=chunk-BPWAJIIV.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/Board.ts", "../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Obj, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { BoardLayout, defaultLayout } from '@dxos/react-ui-board';\n\nimport { meta } from '../meta';\n\n/**\n * Board and layout.\n */\nexport const Board = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n items: Type.Ref(Obj.Any).pipe(Schema.Array, Schema.mutable, FormInputAnnotation.set(false)),\n layout: BoardLayout.pipe(Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Board',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n\nexport interface Board extends Schema.Schema.Type<typeof Board> {}\n\nexport const makeBoard = (props: Partial<Obj.MakeProps<typeof Board>> = {}) =>\n Obj.make(Board, {\n items: [],\n layout: defaultLayout,\n ...props,\n });\n\n/**\n * Create board.\n */\nexport class Create extends Schema.TaggedClass<Create>()(`${meta.id}/action/create`, {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: Board,\n }),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/board',\n name: 'Board',\n description: trim`\n Infinite canvas workspace that combines sticky notes, media, and whiteboarding tools.\n Arrange and connect ideas freely in a visual space perfect for brainstorming and creative collaboration.\n `,\n icon: 'ph--squares-four--regular',\n iconHue: 'green',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-board',\n screenshots: [],\n};\n"],
5
- "mappings": ";;;;;;;AAAA;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,KAAKC,YAAY;AAC1B,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,aAAaC,qBAAqB;;;ACH3C,SAASC,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,aAAa,CAAA;AACf;;;ADHO,IAAMC,QAAeC,cAAO;EACjCC,MAAaC,cAAOC,KAAYC,eAAQ;EACxCC,OAAOC,KAAKC,IAAIC,IAAIC,GAAG,EAAEN,KAAYO,cAAcC,gBAASC,oBAAoBC,IAAI,KAAA,CAAA;EACpFC,QAAQC,YAAYZ,KAAYQ,gBAASC,oBAAoBC,IAAI,KAAA,CAAA;AACnE,CAAA,EAAGV,KACDG,KAAKE,IAAI;EACPQ,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBL,IAAI;EAAC;CAAO,CAAA;AAKvB,IAAMM,YAAY,CAACC,QAA8C,CAAC,MACvEZ,IAAIa,KAAKtB,OAAO;EACdM,OAAO,CAAA;EACPS,QAAQQ;EACR,GAAGF;AACL,CAAA;AAKK,IAAMG,SAAN,cAA4BC,mBAAW,EAAW,GAAGC,KAAKC,EAAE,kBAAkB;EACnFC,OAAc3B,cAAO;IACnBC,MAAaG,gBAAgBF,aAAM;EACrC,CAAA;EACA0B,QAAe5B,cAAO;IACpB6B,QAAQ9B;EACV,CAAA;AACF,CAAA,EAAA;AAAI;",
6
- "names": ["Schema", "Obj", "Type", "FormInputAnnotation", "LabelAnnotation", "BoardLayout", "defaultLayout", "trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "screenshots", "Board", "Struct", "name", "String", "pipe", "optional", "items", "Type", "Ref", "Obj", "Any", "Array", "mutable", "FormInputAnnotation", "set", "layout", "BoardLayout", "typename", "version", "LabelAnnotation", "makeBoard", "props", "make", "defaultLayout", "Create", "TaggedClass", "meta", "id", "input", "output", "object"]
7
- }