@dxos/plugin-board 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29

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 (110) hide show
  1. package/dist/lib/neutral/BoardContainer-HS5KHT4R.mjs +164 -0
  2. package/dist/lib/neutral/BoardContainer-HS5KHT4R.mjs.map +7 -0
  3. package/dist/lib/neutral/BoardPlugin.mjs +30 -0
  4. package/dist/lib/neutral/BoardPlugin.mjs.map +7 -0
  5. package/dist/lib/neutral/capabilities/index.mjs +11 -0
  6. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  7. package/dist/lib/neutral/chunk-EFV3E7KE.mjs +19 -0
  8. package/dist/lib/neutral/chunk-EFV3E7KE.mjs.map +7 -0
  9. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  10. package/dist/lib/neutral/chunk-XXGRE3CK.mjs +37 -0
  11. package/dist/lib/neutral/chunk-XXGRE3CK.mjs.map +7 -0
  12. package/dist/lib/neutral/components/index.mjs +1 -0
  13. package/dist/lib/neutral/containers/index.mjs +9 -0
  14. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  15. package/dist/lib/neutral/create-object-OWHPPT3P.mjs +27 -0
  16. package/dist/lib/neutral/create-object-OWHPPT3P.mjs.map +7 -0
  17. package/dist/lib/neutral/index.mjs +12 -0
  18. package/dist/lib/neutral/index.mjs.map +7 -0
  19. package/dist/lib/neutral/meta.json +1 -0
  20. package/dist/lib/neutral/meta.mjs +8 -0
  21. package/dist/lib/neutral/meta.mjs.map +7 -0
  22. package/dist/lib/neutral/plugin.mjs +12 -0
  23. package/dist/lib/neutral/plugin.mjs.map +7 -0
  24. package/dist/lib/neutral/react-surface-FZYKJHNB.mjs +26 -0
  25. package/dist/lib/neutral/react-surface-FZYKJHNB.mjs.map +7 -0
  26. package/dist/lib/neutral/translations.mjs +29 -0
  27. package/dist/lib/neutral/translations.mjs.map +7 -0
  28. package/dist/lib/{browser → neutral}/types/index.mjs +2 -1
  29. package/dist/lib/neutral/types/index.mjs.map +7 -0
  30. package/dist/types/src/BoardPlugin.d.ts +3 -1
  31. package/dist/types/src/BoardPlugin.d.ts.map +1 -1
  32. package/dist/types/src/BoardPlugin.test.d.ts +2 -0
  33. package/dist/types/src/BoardPlugin.test.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  35. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/index.d.ts +8 -2
  37. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  38. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  39. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  40. package/dist/types/src/components/index.d.ts +0 -1
  41. package/dist/types/src/components/index.d.ts.map +1 -1
  42. package/dist/types/src/containers/BoardContainer/BoardContainer.d.ts +6 -0
  43. package/dist/types/src/containers/BoardContainer/BoardContainer.d.ts.map +1 -0
  44. package/dist/types/src/containers/BoardContainer/BoardContainer.stories.d.ts +54 -0
  45. package/dist/types/src/containers/BoardContainer/BoardContainer.stories.d.ts.map +1 -0
  46. package/dist/types/src/containers/BoardContainer/index.d.ts +2 -0
  47. package/dist/types/src/containers/BoardContainer/index.d.ts.map +1 -0
  48. package/dist/types/src/containers/index.d.ts +3 -0
  49. package/dist/types/src/containers/index.d.ts.map +1 -0
  50. package/dist/types/src/index.d.ts +0 -2
  51. package/dist/types/src/index.d.ts.map +1 -1
  52. package/dist/types/src/meta.d.ts +2 -2
  53. package/dist/types/src/meta.d.ts.map +1 -1
  54. package/dist/types/src/plugin.d.ts +3 -0
  55. package/dist/types/src/plugin.d.ts.map +1 -0
  56. package/dist/types/src/translations.d.ts +22 -13
  57. package/dist/types/src/translations.d.ts.map +1 -1
  58. package/dist/types/src/types/Board.d.ts +26 -68
  59. package/dist/types/src/types/Board.d.ts.map +1 -1
  60. package/dist/types/tsconfig.tsbuildinfo +1 -1
  61. package/package.json +101 -58
  62. package/src/BoardPlugin.test.ts +27 -0
  63. package/src/BoardPlugin.tsx +16 -52
  64. package/src/capabilities/create-object.ts +30 -0
  65. package/src/capabilities/index.ts +3 -3
  66. package/src/capabilities/react-surface.tsx +23 -14
  67. package/src/components/index.ts +0 -2
  68. package/src/containers/BoardContainer/BoardContainer.stories.tsx +122 -0
  69. package/src/containers/BoardContainer/BoardContainer.tsx +182 -0
  70. package/src/containers/BoardContainer/index.ts +5 -0
  71. package/src/containers/index.ts +7 -0
  72. package/src/index.ts +0 -3
  73. package/src/meta.ts +9 -5
  74. package/src/plugin.ts +9 -0
  75. package/src/translations.ts +12 -10
  76. package/src/types/Board.ts +12 -22
  77. package/dist/lib/browser/chunk-V67SBM4U.mjs +0 -59
  78. package/dist/lib/browser/chunk-V67SBM4U.mjs.map +0 -7
  79. package/dist/lib/browser/chunk-YYCPOFRP.mjs +0 -106
  80. package/dist/lib/browser/chunk-YYCPOFRP.mjs.map +0 -7
  81. package/dist/lib/browser/index.mjs +0 -91
  82. package/dist/lib/browser/index.mjs.map +0 -7
  83. package/dist/lib/browser/intent-resolver-6NM32ZSV.mjs +0 -33
  84. package/dist/lib/browser/intent-resolver-6NM32ZSV.mjs.map +0 -7
  85. package/dist/lib/browser/meta.json +0 -1
  86. package/dist/lib/browser/react-surface-PQP6ODCJ.mjs +0 -30
  87. package/dist/lib/browser/react-surface-PQP6ODCJ.mjs.map +0 -7
  88. package/dist/lib/node-esm/chunk-RNEIWFZQ.mjs +0 -108
  89. package/dist/lib/node-esm/chunk-RNEIWFZQ.mjs.map +0 -7
  90. package/dist/lib/node-esm/chunk-XCGDC6OV.mjs +0 -60
  91. package/dist/lib/node-esm/chunk-XCGDC6OV.mjs.map +0 -7
  92. package/dist/lib/node-esm/index.mjs +0 -92
  93. package/dist/lib/node-esm/index.mjs.map +0 -7
  94. package/dist/lib/node-esm/intent-resolver-5DQ5PPTT.mjs +0 -34
  95. package/dist/lib/node-esm/intent-resolver-5DQ5PPTT.mjs.map +0 -7
  96. package/dist/lib/node-esm/meta.json +0 -1
  97. package/dist/lib/node-esm/react-surface-KXSZZOEH.mjs +0 -31
  98. package/dist/lib/node-esm/react-surface-KXSZZOEH.mjs.map +0 -7
  99. package/dist/lib/node-esm/types/index.mjs +0 -8
  100. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  101. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  102. package/dist/types/src/components/BoardContainer.d.ts +0 -8
  103. package/dist/types/src/components/BoardContainer.d.ts.map +0 -1
  104. package/dist/types/src/components/BoardContainer.stories.d.ts +0 -44
  105. package/dist/types/src/components/BoardContainer.stories.d.ts.map +0 -1
  106. package/src/capabilities/intent-resolver.ts +0 -34
  107. package/src/components/BoardContainer.stories.tsx +0 -122
  108. package/src/components/BoardContainer.tsx +0 -89
  109. /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  110. /package/dist/lib/{node-esm/types → neutral/components}/index.mjs.map +0 -0
package/package.json CHANGED
@@ -1,87 +1,130 @@
1
1
  {
2
2
  "name": "@dxos/plugin-board",
3
- "version": "0.8.4-main.dedc0f3",
3
+ "version": "0.8.4-main.dfabb4ec29",
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",
15
+ "imports": {
16
+ "#capabilities": {
17
+ "source": "./src/capabilities/index.ts",
18
+ "types": "./dist/types/src/capabilities/index.d.ts",
19
+ "default": "./dist/lib/neutral/capabilities/index.mjs"
20
+ },
21
+ "#components": {
22
+ "source": "./src/components/index.ts",
23
+ "types": "./dist/types/src/components/index.d.ts",
24
+ "default": "./dist/lib/neutral/components/index.mjs"
25
+ },
26
+ "#containers": {
27
+ "source": "./src/containers/index.ts",
28
+ "types": "./dist/types/src/containers/index.d.ts",
29
+ "default": "./dist/lib/neutral/containers/index.mjs"
30
+ },
31
+ "#meta": {
32
+ "source": "./src/meta.ts",
33
+ "types": "./dist/types/src/meta.d.ts",
34
+ "default": "./dist/lib/neutral/meta.mjs"
35
+ },
36
+ "#plugin": {
37
+ "source": "./src/BoardPlugin.tsx",
38
+ "types": "./dist/types/src/BoardPlugin.d.ts",
39
+ "default": "./dist/lib/neutral/BoardPlugin.mjs"
40
+ },
41
+ "#translations": {
42
+ "source": "./src/translations.ts",
43
+ "types": "./dist/types/src/translations.d.ts",
44
+ "default": "./dist/lib/neutral/translations.mjs"
45
+ },
46
+ "#types": {
47
+ "source": "./src/types/index.ts",
48
+ "types": "./dist/types/src/types/index.d.ts",
49
+ "default": "./dist/lib/neutral/types/index.mjs"
50
+ }
51
+ },
11
52
  "exports": {
12
53
  ".": {
13
54
  "source": "./src/index.ts",
14
55
  "types": "./dist/types/src/index.d.ts",
15
- "browser": "./dist/lib/browser/index.mjs",
16
- "node": "./dist/lib/node-esm/index.mjs"
56
+ "default": "./dist/lib/neutral/index.mjs"
17
57
  },
18
- "./types": {
19
- "source": "./src/types/index.ts",
20
- "types": "./dist/types/src/types/index.d.ts",
21
- "browser": "./dist/lib/browser/types/index.mjs",
22
- "node": "./dist/lib/node-esm/types/index.mjs"
58
+ "./plugin": {
59
+ "source": "./src/plugin.ts",
60
+ "types": "./dist/types/src/plugin.d.ts",
61
+ "default": "./dist/lib/neutral/plugin.mjs"
62
+ },
63
+ "./translations": {
64
+ "source": "./src/translations.ts",
65
+ "types": "./dist/types/src/translations.d.ts",
66
+ "default": "./dist/lib/neutral/translations.mjs"
23
67
  }
24
68
  },
25
69
  "types": "dist/types/src/index.d.ts",
26
- "typesVersions": {
27
- "*": {
28
- "types": [
29
- "dist/types/src/types/index.d.ts"
30
- ]
31
- }
32
- },
33
70
  "files": [
34
71
  "dist",
35
72
  "src"
36
73
  ],
37
74
  "dependencies": {
38
- "@preact-signals/safe-react": "^0.9.0",
39
- "@preact/signals-core": "^1.9.0",
40
- "@preact/signals-react": "^3.2.0",
41
- "effect": "3.17.7",
42
- "@dxos/ai": "0.8.4-main.dedc0f3",
43
- "@dxos/app-framework": "0.8.4-main.dedc0f3",
44
- "@dxos/async": "0.8.4-main.dedc0f3",
45
- "@dxos/blueprints": "0.8.4-main.dedc0f3",
46
- "@dxos/client": "0.8.4-main.dedc0f3",
47
- "@dxos/echo": "0.8.4-main.dedc0f3",
48
- "@dxos/assistant": "0.8.4-main.dedc0f3",
49
- "@dxos/echo-schema": "0.8.4-main.dedc0f3",
50
- "@dxos/effect": "0.8.4-main.dedc0f3",
51
- "@dxos/invariant": "0.8.4-main.dedc0f3",
52
- "@dxos/log": "0.8.4-main.dedc0f3",
53
- "@dxos/plugin-client": "0.8.4-main.dedc0f3",
54
- "@dxos/plugin-search": "0.8.4-main.dedc0f3",
55
- "@dxos/plugin-graph": "0.8.4-main.dedc0f3",
56
- "@dxos/random": "0.8.4-main.dedc0f3",
57
- "@dxos/react-ui": "0.8.4-main.dedc0f3",
58
- "@dxos/plugin-space": "0.8.4-main.dedc0f3",
59
- "@dxos/react-ui-board": "0.8.4-main.dedc0f3",
60
- "@dxos/react-client": "0.8.4-main.dedc0f3",
61
- "@dxos/react-ui-stack": "0.8.4-main.dedc0f3",
62
- "@dxos/react-ui-form": "0.8.4-main.dedc0f3",
63
- "@dxos/schema": "0.8.4-main.dedc0f3",
64
- "@dxos/util": "0.8.4-main.dedc0f3"
75
+ "@effect-atom/atom": "^0.5.1",
76
+ "@effect-atom/atom-react": "^0.5.0",
77
+ "effect": "3.20.0",
78
+ "@dxos/ai": "0.8.4-main.dfabb4ec29",
79
+ "@dxos/app-toolkit": "0.8.4-main.dfabb4ec29",
80
+ "@dxos/app-framework": "0.8.4-main.dfabb4ec29",
81
+ "@dxos/client": "0.8.4-main.dfabb4ec29",
82
+ "@dxos/compute": "0.8.4-main.dfabb4ec29",
83
+ "@dxos/async": "0.8.4-main.dfabb4ec29",
84
+ "@dxos/echo": "0.8.4-main.dfabb4ec29",
85
+ "@dxos/echo-react": "0.8.4-main.dfabb4ec29",
86
+ "@dxos/assistant": "0.8.4-main.dfabb4ec29",
87
+ "@dxos/invariant": "0.8.4-main.dfabb4ec29",
88
+ "@dxos/echo-atom": "0.8.4-main.dfabb4ec29",
89
+ "@dxos/log": "0.8.4-main.dfabb4ec29",
90
+ "@dxos/effect": "0.8.4-main.dfabb4ec29",
91
+ "@dxos/plugin-client": "0.8.4-main.dfabb4ec29",
92
+ "@dxos/plugin-graph": "0.8.4-main.dfabb4ec29",
93
+ "@dxos/plugin-markdown": "0.8.4-main.dfabb4ec29",
94
+ "@dxos/plugin-search": "0.8.4-main.dfabb4ec29",
95
+ "@dxos/random": "0.8.4-main.dfabb4ec29",
96
+ "@dxos/plugin-space": "0.8.4-main.dfabb4ec29",
97
+ "@dxos/react-ui-attention": "0.8.4-main.dfabb4ec29",
98
+ "@dxos/react-ui": "0.8.4-main.dfabb4ec29",
99
+ "@dxos/react-ui-board": "0.8.4-main.dfabb4ec29",
100
+ "@dxos/react-ui-form": "0.8.4-main.dfabb4ec29",
101
+ "@dxos/react-ui-mosaic": "0.8.4-main.dfabb4ec29",
102
+ "@dxos/schema": "0.8.4-main.dfabb4ec29",
103
+ "@dxos/types": "0.8.4-main.dfabb4ec29",
104
+ "@dxos/util": "0.8.4-main.dfabb4ec29",
105
+ "@dxos/react-ui-stack": "0.8.4-main.dfabb4ec29",
106
+ "@dxos/react-client": "0.8.4-main.dfabb4ec29"
65
107
  },
66
108
  "devDependencies": {
67
- "@types/react": "~18.2.0",
68
- "@types/react-dom": "~18.2.0",
69
- "react": "~18.2.0",
70
- "react-dom": "~18.2.0",
71
- "vite": "7.1.1",
72
- "@dxos/plugin-preview": "0.8.4-main.dedc0f3",
73
- "@dxos/plugin-theme": "0.8.4-main.dedc0f3",
74
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.dedc0f3",
75
- "@dxos/react-ui-theme": "0.8.4-main.dedc0f3",
76
- "@dxos/test-utils": "0.8.4-main.dedc0f3",
77
- "@dxos/storybook-utils": "0.8.4-main.dedc0f3"
109
+ "@types/react": "~19.2.7",
110
+ "@types/react-dom": "~19.2.3",
111
+ "react": "~19.2.3",
112
+ "react-dom": "~19.2.3",
113
+ "vite": "^8.0.10",
114
+ "@dxos/plugin-preview": "0.8.4-main.dfabb4ec29",
115
+ "@dxos/plugin-testing": "0.8.4-main.dfabb4ec29",
116
+ "@dxos/plugin-theme": "0.8.4-main.dfabb4ec29",
117
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.dfabb4ec29",
118
+ "@dxos/test-utils": "0.8.4-main.dfabb4ec29",
119
+ "@dxos/ui-theme": "0.8.4-main.dfabb4ec29",
120
+ "@dxos/storybook-utils": "0.8.4-main.dfabb4ec29"
78
121
  },
79
122
  "peerDependencies": {
80
- "effect": "^3.13.3",
81
- "react": "~18.2.0",
82
- "react-dom": "~18.2.0",
83
- "@dxos/react-ui": "0.8.4-main.dedc0f3",
84
- "@dxos/react-ui-theme": "0.8.4-main.dedc0f3"
123
+ "effect": "3.20.0",
124
+ "react": "~19.2.3",
125
+ "react-dom": "~19.2.3",
126
+ "@dxos/react-ui": "0.8.4-main.dfabb4ec29",
127
+ "@dxos/ui-theme": "0.8.4-main.dfabb4ec29"
85
128
  },
86
129
  "publishConfig": {
87
130
  "access": "public"
@@ -0,0 +1,27 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { describe, test } from 'vitest';
6
+
7
+ import { ClientPlugin } from '@dxos/plugin-client/plugin';
8
+ import { createComposerTestApp } from '@dxos/plugin-testing/harness';
9
+
10
+ import { BoardPlugin } from '#plugin';
11
+
12
+ import { meta } from './meta';
13
+
14
+ const moduleId = (name: string) => `${meta.id}.module.${name}`;
15
+
16
+ describe('BoardPlugin', () => {
17
+ test('modules activate on the expected events', async ({ expect }) => {
18
+ await using harness = await createComposerTestApp({
19
+ plugins: [ClientPlugin({}), BoardPlugin()],
20
+ });
21
+
22
+ // Modules expected to be active after a normal startup.
23
+ expect(harness.manager.getActive()).toEqual(
24
+ expect.arrayContaining([moduleId('CreateObject'), moduleId('schema'), moduleId('ReactSurface')]),
25
+ );
26
+ });
27
+ });
@@ -2,57 +2,21 @@
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';
9
- import { translations as boardTranslations } from '@dxos/react-ui-board';
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { AppPlugin } from '@dxos/app-toolkit';
7
+ import { translations as boardTranslations } from '@dxos/react-ui-board/translations';
10
8
 
11
- import { IntentResolver, ReactSurface } from './capabilities';
12
- import { meta } from './meta';
13
- import { translations } from './translations';
14
- import { Board } from './types';
9
+ import { CreateObject, ReactSurface } from '#capabilities';
10
+ import { meta } from '#meta';
11
+ import { translations } from '#translations';
12
+ import { Board } from '#types';
15
13
 
16
- export const BoardPlugin = () => {
17
- return definePlugin(meta, [
18
- defineModule({
19
- id: `${meta.id}/module/translations`,
20
- activatesOn: Events.SetupTranslations,
21
- activate: () => contributes(Capabilities.Translations, [...translations, ...boardTranslations]),
22
- }),
23
- defineModule({
24
- id: `${meta.id}/module/metadata`,
25
- activatesOn: Events.SetupMetadata,
26
- activate: () =>
27
- // TODO(burdon): "Metadata" here seems non-descriptive; is this specifically for the type? ObjectMetadata?
28
- contributes(Capabilities.Metadata, {
29
- id: Board.Board.typename,
30
- metadata: {
31
- icon: 'ph--squares-four--regular',
32
- },
33
- }),
34
- }),
35
- defineModule({
36
- id: `${meta.id}/module/object-form`,
37
- activatesOn: ClientEvents.SetupSchema,
38
- activate: () =>
39
- contributes(
40
- SpaceCapabilities.ObjectForm,
41
- defineObjectForm({
42
- objectSchema: Board.Board,
43
- getIntent: () => createIntent(Board.Create),
44
- }),
45
- ),
46
- }),
47
- defineModule({
48
- id: `${meta.id}/module/react-surface`,
49
- activatesOn: Events.SetupReactSurface,
50
- activate: ReactSurface,
51
- }),
52
- defineModule({
53
- id: `${meta.id}/module/intent-resolver`,
54
- activatesOn: Events.SetupIntentResolver,
55
- activate: IntentResolver,
56
- }),
57
- ]);
58
- };
14
+ export const BoardPlugin = Plugin.define(meta).pipe(
15
+ AppPlugin.addCreateObjectModule({ activate: CreateObject }),
16
+ AppPlugin.addSchemaModule({ schema: [Board.Board] }),
17
+ AppPlugin.addSurfaceModule({ activate: ReactSurface }),
18
+ AppPlugin.addTranslationsModule({ translations: [...translations, ...boardTranslations] }),
19
+ Plugin.make,
20
+ );
21
+
22
+ export default BoardPlugin;
@@ -0,0 +1,30 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { Operation } from '@dxos/compute';
9
+ import { SpaceOperation } from '@dxos/plugin-space';
10
+ import { SpaceCapabilities } from '@dxos/plugin-space';
11
+
12
+ import { Board } from '#types';
13
+
14
+ export default Capability.makeModule(
15
+ Effect.fnUntraced(function* () {
16
+ return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {
17
+ id: Board.Board.typename,
18
+ createObject: (props, options) =>
19
+ Effect.gen(function* () {
20
+ const object = Board.makeBoard(props);
21
+ return yield* Operation.invoke(SpaceOperation.AddObject, {
22
+ object,
23
+ target: options.target,
24
+ hidden: true,
25
+ targetNodeId: options.targetNodeId,
26
+ });
27
+ }),
28
+ });
29
+ }),
30
+ );
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
5
+ import { Capability } from '@dxos/app-framework';
6
6
 
7
- export const IntentResolver = lazy(() => import('./intent-resolver'));
8
- export const ReactSurface = lazy(() => import('./react-surface'));
7
+ export const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));
8
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -2,21 +2,30 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import * as Effect from 'effect/Effect';
5
6
  import React from 'react';
6
7
 
7
- import { Capabilities, type PluginContext, contributes, createSurface } from '@dxos/app-framework';
8
- import { Obj } from '@dxos/echo';
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface } from '@dxos/app-framework/ui';
10
+ import { AppSurface } from '@dxos/app-toolkit/ui';
9
11
 
10
- import { BoardContainer } from '../components';
11
- import { meta } from '../meta';
12
- import { Board } from '../types';
12
+ import { BoardContainer } from '#containers';
13
+ import { Board } from '#types';
13
14
 
14
- export default (context: PluginContext) =>
15
- contributes(Capabilities.ReactSurface, [
16
- createSurface({
17
- id: meta.id,
18
- role: ['article', 'section'],
19
- filter: (data): data is { subject: Board.Board } => Obj.instanceOf(Board.Board, data.subject),
20
- component: ({ data, role }) => <BoardContainer board={data.subject} role={role} />,
21
- }),
22
- ]);
15
+ export default Capability.makeModule(() =>
16
+ Effect.succeed(
17
+ Capability.contributes(Capabilities.ReactSurface, [
18
+ Surface.create({
19
+ id: 'root',
20
+ // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
21
+ filter: AppSurface.oneOf(
22
+ AppSurface.object(AppSurface.Article, Board.Board),
23
+ AppSurface.object(AppSurface.Section, Board.Board),
24
+ ),
25
+ component: ({ role, data }) => (
26
+ <BoardContainer role={role} subject={data.subject} attendableId={data.attendableId} />
27
+ ),
28
+ }),
29
+ ]),
30
+ ),
31
+ );
@@ -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/plugin';
12
+ import { initializeIdentity } from '@dxos/plugin-client/testing';
13
+ import { PreviewPlugin } from '@dxos/plugin-preview/testing';
14
+ import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
15
+ import { random } from '@dxos/random';
16
+ import { Filter, Ref, useQuery, useSpaces } from '@dxos/react-client/echo';
17
+ import { translations as stackTranslations } from '@dxos/react-ui-stack/translations';
18
+ import { withLayout } from '@dxos/react-ui/testing';
19
+ import { Organization, Person } from '@dxos/types';
20
+
21
+ import { translations } from '#translations';
22
+ import { Board } from '#types';
23
+
24
+ import { BoardContainer } from './BoardContainer';
25
+
26
+ random.seed(0);
27
+
28
+ const createBoard = () =>
29
+ Obj.make(Board.Board, {
30
+ name: 'Test Board',
31
+ items: [],
32
+ layout: {
33
+ size: { width: 7, height: 5 },
34
+ cells: {},
35
+ },
36
+ });
37
+
38
+ const createOrg = () =>
39
+ Obj.make(Organization.Organization, {
40
+ name: random.commerce.productName(),
41
+ description: random.lorem.paragraph(),
42
+ image: random.image.url(),
43
+ website: random.internet.url(),
44
+ // TODO(burdon): Fix.
45
+ // status: random.helpers.arrayElement(Organization.StatusOptions).id,
46
+ });
47
+
48
+ const DefaultStory = () => {
49
+ const spaces = useSpaces();
50
+ const space = spaces[spaces.length - 1];
51
+ const boards = useQuery(space?.db, Filter.type(Board.Board));
52
+ const [board, setBoard] = useState<Board.Board>();
53
+
54
+ useEffect(() => {
55
+ if (boards.length && !board) {
56
+ const board = boards[0];
57
+ setBoard(board);
58
+ }
59
+ }, [boards]);
60
+
61
+ if (!board) {
62
+ return null;
63
+ }
64
+
65
+ return <BoardContainer role='board' subject={board} attendableId='test' />;
66
+ };
67
+
68
+ //
69
+ // Story definitions
70
+ //
71
+
72
+ const meta = {
73
+ title: 'plugins/plugin-board/containers/BoardContainer',
74
+ render: DefaultStory,
75
+ decorators: [
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* initializeIdentity(client);
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.update(board, (board) => {
90
+ // Add some sample items
91
+ Array.from({ length: 10 }).map(() => {
92
+ const org = createOrg();
93
+ space.db.add(org);
94
+ board.items.push(Ref.make(org));
95
+ board.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 = {};