@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.
- package/dist/lib/neutral/BoardContainer-HS5KHT4R.mjs +164 -0
- package/dist/lib/neutral/BoardContainer-HS5KHT4R.mjs.map +7 -0
- package/dist/lib/neutral/BoardPlugin.mjs +30 -0
- package/dist/lib/neutral/BoardPlugin.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +11 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-EFV3E7KE.mjs +19 -0
- package/dist/lib/neutral/chunk-EFV3E7KE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-XXGRE3CK.mjs +37 -0
- package/dist/lib/neutral/chunk-XXGRE3CK.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +1 -0
- package/dist/lib/neutral/containers/index.mjs +9 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-OWHPPT3P.mjs +27 -0
- package/dist/lib/neutral/create-object-OWHPPT3P.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +12 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-FZYKJHNB.mjs +26 -0
- package/dist/lib/neutral/react-surface-FZYKJHNB.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +29 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/types/index.mjs +2 -1
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/BoardPlugin.d.ts +3 -1
- package/dist/types/src/BoardPlugin.d.ts.map +1 -1
- package/dist/types/src/BoardPlugin.test.d.ts +2 -0
- package/dist/types/src/BoardPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/BoardContainer/BoardContainer.d.ts +6 -0
- package/dist/types/src/containers/BoardContainer/BoardContainer.d.ts.map +1 -0
- package/dist/types/src/containers/BoardContainer/BoardContainer.stories.d.ts +54 -0
- package/dist/types/src/containers/BoardContainer/BoardContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/BoardContainer/index.d.ts +2 -0
- package/dist/types/src/containers/BoardContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +22 -13
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Board.d.ts +26 -68
- package/dist/types/src/types/Board.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +101 -58
- package/src/BoardPlugin.test.ts +27 -0
- package/src/BoardPlugin.tsx +16 -52
- package/src/capabilities/create-object.ts +30 -0
- package/src/capabilities/index.ts +3 -3
- package/src/capabilities/react-surface.tsx +23 -14
- package/src/components/index.ts +0 -2
- package/src/containers/BoardContainer/BoardContainer.stories.tsx +122 -0
- package/src/containers/BoardContainer/BoardContainer.tsx +182 -0
- package/src/containers/BoardContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/index.ts +0 -3
- package/src/meta.ts +9 -5
- package/src/plugin.ts +9 -0
- package/src/translations.ts +12 -10
- package/src/types/Board.ts +12 -22
- package/dist/lib/browser/chunk-V67SBM4U.mjs +0 -59
- package/dist/lib/browser/chunk-V67SBM4U.mjs.map +0 -7
- package/dist/lib/browser/chunk-YYCPOFRP.mjs +0 -106
- package/dist/lib/browser/chunk-YYCPOFRP.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -91
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-6NM32ZSV.mjs +0 -33
- package/dist/lib/browser/intent-resolver-6NM32ZSV.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-PQP6ODCJ.mjs +0 -30
- package/dist/lib/browser/react-surface-PQP6ODCJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RNEIWFZQ.mjs +0 -108
- package/dist/lib/node-esm/chunk-RNEIWFZQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XCGDC6OV.mjs +0 -60
- package/dist/lib/node-esm/chunk-XCGDC6OV.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -92
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-5DQ5PPTT.mjs +0 -34
- package/dist/lib/node-esm/intent-resolver-5DQ5PPTT.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-KXSZZOEH.mjs +0 -31
- package/dist/lib/node-esm/react-surface-KXSZZOEH.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -8
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/BoardContainer.d.ts +0 -8
- package/dist/types/src/components/BoardContainer.d.ts.map +0 -1
- package/dist/types/src/components/BoardContainer.stories.d.ts +0 -44
- package/dist/types/src/components/BoardContainer.stories.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -34
- package/src/components/BoardContainer.stories.tsx +0 -122
- package/src/components/BoardContainer.tsx +0 -89
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /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.
|
|
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
|
-
"
|
|
16
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
56
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
17
57
|
},
|
|
18
|
-
"./
|
|
19
|
-
"source": "./src/
|
|
20
|
-
"types": "./dist/types/src/
|
|
21
|
-
"
|
|
22
|
-
|
|
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
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/echo": "0.8.4-main.
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/log": "0.8.4-main.
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/plugin-
|
|
55
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/react-
|
|
61
|
-
"@dxos/react-ui
|
|
62
|
-
"@dxos/react-ui-
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
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": "~
|
|
68
|
-
"@types/react-dom": "~
|
|
69
|
-
"react": "~
|
|
70
|
-
"react-dom": "~
|
|
71
|
-
"vite": "
|
|
72
|
-
"@dxos/plugin-preview": "0.8.4-main.
|
|
73
|
-
"@dxos/plugin-
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/react-ui-
|
|
76
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
77
|
-
"@dxos/
|
|
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": "
|
|
81
|
-
"react": "~
|
|
82
|
-
"react-dom": "~
|
|
83
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
84
|
-
"@dxos/
|
|
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
|
+
});
|
package/src/BoardPlugin.tsx
CHANGED
|
@@ -2,57 +2,21 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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 {
|
|
12
|
-
import { meta } from '
|
|
13
|
-
import { translations } from '
|
|
14
|
-
import { Board } from '
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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 {
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const
|
|
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,
|
|
8
|
-
import {
|
|
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 '
|
|
11
|
-
import {
|
|
12
|
-
import { Board } from '../types';
|
|
12
|
+
import { BoardContainer } from '#containers';
|
|
13
|
+
import { Board } from '#types';
|
|
13
14
|
|
|
14
|
-
export default (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
);
|
package/src/components/index.ts
CHANGED
|
@@ -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 = {};
|