@dxos/plugin-board 0.8.4-main.fcfe5033a5 → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/PLUGIN.mdl +337 -0
- package/README.md +1 -1
- package/dist/lib/neutral/BoardArticle-H65K4YGV.mjs +167 -0
- package/dist/lib/neutral/BoardArticle-H65K4YGV.mjs.map +7 -0
- package/dist/lib/neutral/BoardPlugin.mjs +42 -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-HUBZKCPA.mjs +32 -0
- package/dist/lib/neutral/chunk-HUBZKCPA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/{browser/chunk-FL67SBF5.mjs → neutral/chunk-RDP4SXIW.mjs} +8 -13
- package/dist/lib/neutral/chunk-RDP4SXIW.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-BRISOU7F.mjs +28 -0
- package/dist/lib/neutral/create-object-BRISOU7F.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-M5JHK3ZQ.mjs +26 -0
- package/dist/lib/neutral/react-surface-M5JHK3ZQ.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +30 -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 +1 -0
- 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 +6 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/containers/BoardArticle/BoardArticle.d.ts +6 -0
- package/dist/types/src/containers/BoardArticle/BoardArticle.d.ts.map +1 -0
- package/dist/types/src/containers/BoardArticle/BoardArticle.stories.d.ts +54 -0
- package/dist/types/src/containers/BoardArticle/BoardArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/BoardArticle/index.d.ts +2 -0
- package/dist/types/src/containers/BoardArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +1 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- 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 -15
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Board.d.ts +5 -6
- package/dist/types/src/types/Board.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +84 -63
- package/src/BoardPlugin.test.ts +27 -0
- package/src/BoardPlugin.tsx +11 -29
- package/src/capabilities/create-object.ts +31 -0
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/react-surface.tsx +2 -2
- package/src/containers/{BoardContainer/BoardContainer.stories.tsx → BoardArticle/BoardArticle.stories.tsx} +10 -10
- package/src/containers/{BoardContainer/BoardContainer.tsx → BoardArticle/BoardArticle.tsx} +47 -16
- package/src/containers/BoardArticle/index.ts +5 -0
- package/src/containers/index.ts +1 -1
- package/src/index.ts +0 -2
- package/src/meta.ts +16 -6
- package/src/plugin.ts +9 -0
- package/src/translations.ts +2 -1
- package/src/types/Board.ts +5 -11
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/chunk-FL67SBF5.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -92
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node-esm/chunk-5GGKJL4Z.mjs +0 -40
- package/dist/lib/node-esm/chunk-5GGKJL4Z.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -93
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/types/index.mjs +0 -8
- package/dist/types/src/containers/BoardContainer/BoardContainer.d.ts +0 -6
- package/dist/types/src/containers/BoardContainer/BoardContainer.d.ts.map +0 -1
- package/dist/types/src/containers/BoardContainer/BoardContainer.stories.d.ts +0 -47
- package/dist/types/src/containers/BoardContainer/BoardContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/BoardContainer/index.d.ts +0 -2
- package/dist/types/src/containers/BoardContainer/index.d.ts.map +0 -1
- package/src/containers/BoardContainer/index.ts +0 -5
- /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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-board",
|
|
3
|
-
"version": "0.8.4-
|
|
3
|
+
"version": "0.8.4-staging.60fe92afc8",
|
|
4
4
|
"description": "Surface plugin for card baords",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -8,94 +8,115 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/dxos/dxos"
|
|
10
10
|
},
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
15
|
"imports": {
|
|
16
|
-
"#capabilities":
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
}
|
|
21
51
|
},
|
|
22
52
|
"exports": {
|
|
23
53
|
".": {
|
|
24
54
|
"source": "./src/index.ts",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"types": "./dist/types/src/index.d.ts"
|
|
55
|
+
"types": "./dist/types/src/index.d.ts",
|
|
56
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
28
57
|
},
|
|
29
|
-
"./
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
58
|
+
"./assets/PLUGIN.mdl": "./PLUGIN.mdl",
|
|
59
|
+
"./plugin": {
|
|
60
|
+
"source": "./src/plugin.ts",
|
|
61
|
+
"types": "./dist/types/src/plugin.d.ts",
|
|
62
|
+
"default": "./dist/lib/neutral/plugin.mjs"
|
|
63
|
+
},
|
|
64
|
+
"./translations": {
|
|
65
|
+
"source": "./src/translations.ts",
|
|
66
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
67
|
+
"default": "./dist/lib/neutral/translations.mjs"
|
|
34
68
|
}
|
|
35
69
|
},
|
|
36
70
|
"types": "dist/types/src/index.d.ts",
|
|
37
|
-
"typesVersions": {
|
|
38
|
-
"*": {
|
|
39
|
-
"types": [
|
|
40
|
-
"dist/types/src/types/index.d.ts"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
71
|
"files": [
|
|
45
72
|
"dist",
|
|
46
|
-
"src"
|
|
73
|
+
"src",
|
|
74
|
+
"PLUGIN.mdl"
|
|
47
75
|
],
|
|
48
76
|
"dependencies": {
|
|
49
|
-
"effect": "
|
|
50
|
-
"@
|
|
51
|
-
"
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/app-framework": "0.8.4-
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/react-
|
|
69
|
-
"@dxos/react-ui": "0.8.4-
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/react-ui-form": "0.8.4-main.fcfe5033a5",
|
|
72
|
-
"@dxos/react-ui-mosaic": "0.8.4-main.fcfe5033a5",
|
|
73
|
-
"@dxos/react-ui-board": "0.8.4-main.fcfe5033a5",
|
|
74
|
-
"@dxos/react-ui-stack": "0.8.4-main.fcfe5033a5",
|
|
75
|
-
"@dxos/schema": "0.8.4-main.fcfe5033a5",
|
|
76
|
-
"@dxos/types": "0.8.4-main.fcfe5033a5",
|
|
77
|
-
"@dxos/util": "0.8.4-main.fcfe5033a5"
|
|
77
|
+
"@effect-atom/atom": "^0.5.3",
|
|
78
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
79
|
+
"effect": "3.21.3",
|
|
80
|
+
"@dxos/app-toolkit": "0.8.4-staging.60fe92afc8",
|
|
81
|
+
"@dxos/echo": "0.8.4-staging.60fe92afc8",
|
|
82
|
+
"@dxos/invariant": "0.8.4-staging.60fe92afc8",
|
|
83
|
+
"@dxos/app-framework": "0.8.4-staging.60fe92afc8",
|
|
84
|
+
"@dxos/echo-react": "0.8.4-staging.60fe92afc8",
|
|
85
|
+
"@dxos/keys": "0.8.4-staging.60fe92afc8",
|
|
86
|
+
"@dxos/plugin-client": "0.8.4-staging.60fe92afc8",
|
|
87
|
+
"@dxos/plugin-markdown": "0.8.4-staging.60fe92afc8",
|
|
88
|
+
"@dxos/plugin-space": "0.8.4-staging.60fe92afc8",
|
|
89
|
+
"@dxos/random": "0.8.4-staging.60fe92afc8",
|
|
90
|
+
"@dxos/compute": "0.8.4-staging.60fe92afc8",
|
|
91
|
+
"@dxos/react-client": "0.8.4-staging.60fe92afc8",
|
|
92
|
+
"@dxos/react-ui": "0.8.4-staging.60fe92afc8",
|
|
93
|
+
"@dxos/react-ui-board": "0.8.4-staging.60fe92afc8",
|
|
94
|
+
"@dxos/react-ui-stack": "0.8.4-staging.60fe92afc8",
|
|
95
|
+
"@dxos/types": "0.8.4-staging.60fe92afc8",
|
|
96
|
+
"@dxos/react-ui-attention": "0.8.4-staging.60fe92afc8",
|
|
97
|
+
"@dxos/react-ui-form": "0.8.4-staging.60fe92afc8",
|
|
98
|
+
"@dxos/util": "0.8.4-staging.60fe92afc8"
|
|
78
99
|
},
|
|
79
100
|
"devDependencies": {
|
|
80
101
|
"@types/react": "~19.2.7",
|
|
81
102
|
"@types/react-dom": "~19.2.3",
|
|
82
103
|
"react": "~19.2.3",
|
|
83
104
|
"react-dom": "~19.2.3",
|
|
84
|
-
"vite": "^
|
|
85
|
-
"@dxos/plugin-preview": "0.8.4-
|
|
86
|
-
"@dxos/plugin-testing": "0.8.4-
|
|
87
|
-
"@dxos/plugin-theme": "0.8.4-
|
|
88
|
-
"@dxos/react-ui-syntax-highlighter": "0.8.4-
|
|
89
|
-
"@dxos/storybook-utils": "0.8.4-
|
|
90
|
-
"@dxos/test-utils": "0.8.4-
|
|
91
|
-
"@dxos/ui-theme": "0.8.4-
|
|
105
|
+
"vite": "^8.0.16",
|
|
106
|
+
"@dxos/plugin-preview": "0.8.4-staging.60fe92afc8",
|
|
107
|
+
"@dxos/plugin-testing": "0.8.4-staging.60fe92afc8",
|
|
108
|
+
"@dxos/plugin-theme": "0.8.4-staging.60fe92afc8",
|
|
109
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-staging.60fe92afc8",
|
|
110
|
+
"@dxos/storybook-utils": "0.8.4-staging.60fe92afc8",
|
|
111
|
+
"@dxos/test-utils": "0.8.4-staging.60fe92afc8",
|
|
112
|
+
"@dxos/ui-theme": "0.8.4-staging.60fe92afc8"
|
|
92
113
|
},
|
|
93
114
|
"peerDependencies": {
|
|
94
|
-
"effect": "3.
|
|
115
|
+
"effect": "3.21.3",
|
|
95
116
|
"react": "~19.2.3",
|
|
96
117
|
"react-dom": "~19.2.3",
|
|
97
|
-
"@dxos/react-ui": "0.8.4-
|
|
98
|
-
"@dxos/ui-theme": "0.8.4-
|
|
118
|
+
"@dxos/react-ui": "0.8.4-staging.60fe92afc8",
|
|
119
|
+
"@dxos/ui-theme": "0.8.4-staging.60fe92afc8"
|
|
99
120
|
},
|
|
100
121
|
"publishConfig": {
|
|
101
122
|
"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,45 +2,27 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import * as Option from 'effect/Option';
|
|
7
|
-
|
|
8
5
|
import { Plugin } from '@dxos/app-framework';
|
|
9
6
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
10
|
-
import {
|
|
11
|
-
import { Operation } from '@dxos/operation';
|
|
12
|
-
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
13
|
-
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
14
|
-
import { translations as boardTranslations } from '@dxos/react-ui-board';
|
|
7
|
+
import { translations as boardTranslations } from '@dxos/react-ui-board/translations';
|
|
15
8
|
|
|
16
|
-
import { ReactSurface } from '#capabilities';
|
|
9
|
+
import { CreateObject, ReactSurface } from '#capabilities';
|
|
17
10
|
import { meta } from '#meta';
|
|
11
|
+
import { translations } from '#translations';
|
|
18
12
|
import { Board } from '#types';
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
// eslint-disable-next-line import/no-relative-packages
|
|
15
|
+
import pluginSpec from '../PLUGIN.mdl?raw';
|
|
21
16
|
|
|
22
17
|
export const BoardPlugin = Plugin.define(meta).pipe(
|
|
23
|
-
AppPlugin.
|
|
24
|
-
metadata: {
|
|
25
|
-
id: Board.Board.typename,
|
|
26
|
-
metadata: {
|
|
27
|
-
icon: Annotation.IconAnnotation.get(Board.Board).pipe(Option.getOrThrow).icon,
|
|
28
|
-
iconHue: Annotation.IconAnnotation.get(Board.Board).pipe(Option.getOrThrow).hue ?? 'white',
|
|
29
|
-
createObject: ((props, options) =>
|
|
30
|
-
Effect.gen(function* () {
|
|
31
|
-
const object = Board.makeBoard(props);
|
|
32
|
-
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
33
|
-
object,
|
|
34
|
-
target: options.target,
|
|
35
|
-
hidden: true,
|
|
36
|
-
targetNodeId: options.targetNodeId,
|
|
37
|
-
});
|
|
38
|
-
})) satisfies CreateObject,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
18
|
+
AppPlugin.addCreateObjectModule({ activate: CreateObject }),
|
|
42
19
|
AppPlugin.addSchemaModule({ schema: [Board.Board] }),
|
|
43
20
|
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
44
21
|
AppPlugin.addTranslationsModule({ translations: [...translations, ...boardTranslations] }),
|
|
22
|
+
AppPlugin.addPluginAssetModule({
|
|
23
|
+
asset: { pluginId: meta.id, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },
|
|
24
|
+
}),
|
|
45
25
|
Plugin.make,
|
|
46
26
|
);
|
|
27
|
+
|
|
28
|
+
export default BoardPlugin;
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { Type } from '@dxos/echo';
|
|
10
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
11
|
+
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
12
|
+
|
|
13
|
+
import { Board } from '#types';
|
|
14
|
+
|
|
15
|
+
export default Capability.makeModule(
|
|
16
|
+
Effect.fnUntraced(function* () {
|
|
17
|
+
return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {
|
|
18
|
+
id: Type.getTypename(Board.Board),
|
|
19
|
+
createObject: (props, options) =>
|
|
20
|
+
Effect.gen(function* () {
|
|
21
|
+
const object = Board.makeBoard(props);
|
|
22
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
23
|
+
object,
|
|
24
|
+
target: options.target,
|
|
25
|
+
hidden: true,
|
|
26
|
+
targetNodeId: options.targetNodeId,
|
|
27
|
+
});
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
@@ -9,7 +9,7 @@ import { Capabilities, Capability } from '@dxos/app-framework';
|
|
|
9
9
|
import { Surface } from '@dxos/app-framework/ui';
|
|
10
10
|
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { BoardArticle } from '#containers';
|
|
13
13
|
import { Board } from '#types';
|
|
14
14
|
|
|
15
15
|
export default Capability.makeModule(() =>
|
|
@@ -23,7 +23,7 @@ export default Capability.makeModule(() =>
|
|
|
23
23
|
AppSurface.object(AppSurface.Section, Board.Board),
|
|
24
24
|
),
|
|
25
25
|
component: ({ role, data }) => (
|
|
26
|
-
<
|
|
26
|
+
<BoardArticle role={role} subject={data.subject} attendableId={data.attendableId} />
|
|
27
27
|
),
|
|
28
28
|
}),
|
|
29
29
|
]),
|
|
@@ -7,21 +7,21 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import React, { useEffect, useState } from 'react';
|
|
8
8
|
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
10
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
12
12
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
13
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
13
|
+
import { PreviewPlugin } from '@dxos/plugin-preview/testing';
|
|
14
14
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
15
15
|
import { random } from '@dxos/random';
|
|
16
|
-
import {
|
|
17
|
-
import { translations as stackTranslations } from '@dxos/react-ui-stack';
|
|
16
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
17
|
+
import { translations as stackTranslations } from '@dxos/react-ui-stack/translations';
|
|
18
18
|
import { withLayout } from '@dxos/react-ui/testing';
|
|
19
19
|
import { Organization, Person } from '@dxos/types';
|
|
20
20
|
|
|
21
|
+
import { translations } from '#translations';
|
|
21
22
|
import { Board } from '#types';
|
|
22
23
|
|
|
23
|
-
import {
|
|
24
|
-
import { BoardContainer } from './BoardContainer';
|
|
24
|
+
import { BoardArticle } from './BoardArticle';
|
|
25
25
|
|
|
26
26
|
random.seed(0);
|
|
27
27
|
|
|
@@ -62,7 +62,7 @@ const DefaultStory = () => {
|
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
return <
|
|
65
|
+
return <BoardArticle role='board' subject={board} attendableId='test' />;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
//
|
|
@@ -70,7 +70,7 @@ const DefaultStory = () => {
|
|
|
70
70
|
//
|
|
71
71
|
|
|
72
72
|
const meta = {
|
|
73
|
-
title: 'plugins/plugin-board/containers/
|
|
73
|
+
title: 'plugins/plugin-board/containers/BoardArticle',
|
|
74
74
|
render: DefaultStory,
|
|
75
75
|
decorators: [
|
|
76
76
|
withLayout({ layout: 'fullscreen' }),
|
|
@@ -86,7 +86,7 @@ const meta = {
|
|
|
86
86
|
yield* Effect.promise(() => space.waitUntilReady());
|
|
87
87
|
const board = space.db.add(createBoard());
|
|
88
88
|
|
|
89
|
-
Obj.
|
|
89
|
+
Obj.update(board, (board) => {
|
|
90
90
|
// Add some sample items
|
|
91
91
|
Array.from({ length: 10 }).map(() => {
|
|
92
92
|
const org = createOrg();
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Atom from '@effect-atom/atom/Atom';
|
|
5
7
|
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
6
8
|
|
|
7
9
|
import { Surface } from '@dxos/app-framework/ui';
|
|
8
10
|
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
11
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
10
|
-
import { useObject
|
|
12
|
+
import { useObject } from '@dxos/echo-react';
|
|
11
13
|
import { invariant } from '@dxos/invariant';
|
|
14
|
+
import { EID } from '@dxos/keys';
|
|
15
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
12
16
|
import { useQuery } from '@dxos/react-client/echo';
|
|
13
17
|
import { Panel } from '@dxos/react-ui';
|
|
14
18
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
@@ -24,17 +28,32 @@ type PickerState = {
|
|
|
24
28
|
position: Position;
|
|
25
29
|
};
|
|
26
30
|
|
|
27
|
-
export type
|
|
31
|
+
export type BoardArticleProps = AppSurface.ObjectArticleProps<BoardType.Board>;
|
|
28
32
|
|
|
29
|
-
export const
|
|
30
|
-
const
|
|
33
|
+
export const BoardArticle = ({ role, subject: board, attendableId }: BoardArticleProps) => {
|
|
34
|
+
const { hasAttention } = useAttention(attendableId);
|
|
35
|
+
const db = Obj.getDatabase(board);
|
|
31
36
|
const [boardItems] = useObject(board, 'items');
|
|
32
|
-
const
|
|
37
|
+
const itemsAtom = useMemo(
|
|
38
|
+
() =>
|
|
39
|
+
Atom.make((get) => {
|
|
40
|
+
const result: Obj.Unknown[] = [];
|
|
41
|
+
for (const ref of boardItems ?? []) {
|
|
42
|
+
const obj = get(Obj.atomReactive(ref));
|
|
43
|
+
if (obj) {
|
|
44
|
+
result.push(obj);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}),
|
|
49
|
+
[boardItems],
|
|
50
|
+
);
|
|
51
|
+
const items = useAtomValue(itemsAtom);
|
|
52
|
+
|
|
53
|
+
const controller = useRef<BoardController>(null);
|
|
33
54
|
const addTriggerRef = useRef<HTMLButtonElement | null>(null);
|
|
34
55
|
const [pickerState, setPickerState] = useState<PickerState | null>(null);
|
|
35
|
-
const { hasAttention } = useAttention(attendableId);
|
|
36
56
|
|
|
37
|
-
const db = Obj.getDatabase(board);
|
|
38
57
|
// TODO(burdon): Use search.
|
|
39
58
|
const objects = useQuery(db, Filter.everything());
|
|
40
59
|
const options = useMemo<ObjectPickerContentProps['options']>(
|
|
@@ -57,13 +76,22 @@ export const BoardContainer = ({ role, subject: board, attendableId }: BoardCont
|
|
|
57
76
|
);
|
|
58
77
|
|
|
59
78
|
const handleAdd = useCallback<NonNullable<BoardRootProps['onAdd']>>(
|
|
60
|
-
async (anchor, position
|
|
79
|
+
async (anchor, position) => {
|
|
61
80
|
const db = Obj.getDatabase(board);
|
|
62
81
|
invariant(db);
|
|
82
|
+
// Grid backdrop "+" supplies a position → create a new Markdown document directly.
|
|
83
|
+
// Toolbar "+" omits position → fall back to the picker over existing objects.
|
|
84
|
+
if (position) {
|
|
85
|
+
const doc = db.add(Markdown.make());
|
|
86
|
+
Obj.update(board, (board) => {
|
|
87
|
+
board.items.push(Ref.make(doc));
|
|
88
|
+
board.layout.cells[doc.id.toString()] = position;
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
63
93
|
addTriggerRef.current = anchor;
|
|
64
|
-
setPickerState({
|
|
65
|
-
position,
|
|
66
|
-
});
|
|
94
|
+
setPickerState({ position: DEFAULT_POSITION });
|
|
67
95
|
},
|
|
68
96
|
[board],
|
|
69
97
|
);
|
|
@@ -72,8 +100,11 @@ export const BoardContainer = ({ role, subject: board, attendableId }: BoardCont
|
|
|
72
100
|
const handleDelete = useCallback<NonNullable<BoardRootProps['onDelete']>>(
|
|
73
101
|
(id) => {
|
|
74
102
|
// TODO(burdon): Impl. DXN.equals and pass in DXN from `id`.
|
|
75
|
-
const idx = board.items.findIndex((ref) =>
|
|
76
|
-
|
|
103
|
+
const idx = board.items.findIndex((ref) => {
|
|
104
|
+
const echoUri = EID.tryParse(ref.uri);
|
|
105
|
+
return (echoUri ? EID.getEntityId(echoUri) : undefined) === id;
|
|
106
|
+
});
|
|
107
|
+
Obj.update(board, (board) => {
|
|
77
108
|
if (idx !== -1) {
|
|
78
109
|
board.items.splice(idx, 1);
|
|
79
110
|
}
|
|
@@ -86,7 +117,7 @@ export const BoardContainer = ({ role, subject: board, attendableId }: BoardCont
|
|
|
86
117
|
const handleMove = useCallback<NonNullable<BoardRootProps['onMove']>>(
|
|
87
118
|
(id, position) => {
|
|
88
119
|
const layout = board.layout.cells[id];
|
|
89
|
-
Obj.
|
|
120
|
+
Obj.update(board, (board) => {
|
|
90
121
|
board.layout.cells[id] = { ...layout, ...position };
|
|
91
122
|
});
|
|
92
123
|
},
|
|
@@ -106,7 +137,7 @@ export const BoardContainer = ({ role, subject: board, attendableId }: BoardCont
|
|
|
106
137
|
}
|
|
107
138
|
|
|
108
139
|
// Create a reference to the selected object and add it to the board.
|
|
109
|
-
Obj.
|
|
140
|
+
Obj.update(board, (board) => {
|
|
110
141
|
board.items.push(Ref.make(selectedObject));
|
|
111
142
|
|
|
112
143
|
// Set the layout position for the new item.
|
|
@@ -138,7 +169,7 @@ export const BoardContainer = ({ role, subject: board, attendableId }: BoardCont
|
|
|
138
169
|
<Board.Content>
|
|
139
170
|
{items?.map((item, index) => (
|
|
140
171
|
<Board.Cell item={item} key={index} layout={board.layout?.cells[item.id] ?? { x: 0, y: 0 }}>
|
|
141
|
-
<Surface.Surface type={AppSurface.Card} data={{ subject: item }} limit={1} />
|
|
172
|
+
<Surface.Surface type={AppSurface.Card} data={{ subject: item, editable: true }} limit={1} />
|
|
142
173
|
</Board.Cell>
|
|
143
174
|
))}
|
|
144
175
|
</Board.Content>
|
package/src/containers/index.ts
CHANGED
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -2,18 +2,28 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { DXN } from '@dxos/keys';
|
|
6
7
|
import { trim } from '@dxos/util';
|
|
7
8
|
|
|
8
|
-
export const meta
|
|
9
|
-
|
|
9
|
+
export const meta = Plugin.makeMeta({
|
|
10
|
+
key: DXN.make('org.dxos.plugin.board'),
|
|
10
11
|
name: 'Board',
|
|
12
|
+
author: 'DXOS',
|
|
11
13
|
description: trim`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
Board is an infinite spatial canvas that lets you place any ECHO object — documents, tasks, notes, or rich media — anywhere on a two-dimensional grid.
|
|
15
|
+
Items are arranged by dragging, resized freely, and removed from the canvas without deleting the underlying data, so the same object can appear on multiple boards simultaneously.
|
|
16
|
+
|
|
17
|
+
Each board is itself an ECHO object, making it fully collaborative and conflict-free: all participants see live updates as peers add, move, or remove items in real time.
|
|
18
|
+
The canvas scales to any resolution, supports nested surfaces through the Composer slot system, and integrates naturally with other plugins via the shared ObjectPicker.
|
|
19
|
+
|
|
20
|
+
Board is designed as a lightweight composition layer: it imposes no schema on the objects it hosts and delegates rendering to each object's own Card surface, so every plugin contributes its own card representation automatically.
|
|
21
|
+
This makes it ideal for dashboards, mood boards, project overviews, or any context where spatial relationships between heterogeneous objects carry meaning.
|
|
14
22
|
`,
|
|
15
23
|
icon: 'ph--squares-four--regular',
|
|
16
24
|
iconHue: 'green',
|
|
17
25
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-board',
|
|
26
|
+
spec: 'PLUGIN.mdl',
|
|
18
27
|
screenshots: [],
|
|
19
|
-
|
|
28
|
+
tags: ['labs'],
|
|
29
|
+
});
|
package/src/plugin.ts
ADDED
package/src/translations.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Type } from '@dxos/echo';
|
|
5
6
|
import { type Resource } from '@dxos/react-ui';
|
|
6
7
|
|
|
7
8
|
import { meta } from '#meta';
|
|
@@ -10,7 +11,7 @@ import { Board } from '#types';
|
|
|
10
11
|
export const translations = [
|
|
11
12
|
{
|
|
12
13
|
'en-US': {
|
|
13
|
-
[Board.Board
|
|
14
|
+
[Type.getTypename(Board.Board)]: {
|
|
14
15
|
'typename.label': 'Board',
|
|
15
16
|
'typename.label_zero': 'Boards',
|
|
16
17
|
'typename.label_one': 'Board',
|
package/src/types/Board.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
-
import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/
|
|
7
|
+
import { DXN, Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
+
import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/Annotation';
|
|
9
9
|
import { BoardLayout, defaultLayout } from '@dxos/react-ui-board';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -16,18 +16,12 @@ export const Board = Schema.Struct({
|
|
|
16
16
|
items: Ref.Ref(Obj.Unknown).pipe(Schema.Array, FormInputAnnotation.set(false)),
|
|
17
17
|
layout: BoardLayout.pipe(FormInputAnnotation.set(false)),
|
|
18
18
|
}).pipe(
|
|
19
|
-
Type.object({
|
|
20
|
-
typename: 'org.dxos.type.board',
|
|
21
|
-
version: '0.1.0',
|
|
22
|
-
}),
|
|
23
19
|
LabelAnnotation.set(['name']),
|
|
24
|
-
Annotation.IconAnnotation.set({
|
|
25
|
-
|
|
26
|
-
hue: 'green',
|
|
27
|
-
}),
|
|
20
|
+
Annotation.IconAnnotation.set({ icon: 'ph--squares-four--regular', hue: 'green' }),
|
|
21
|
+
Type.makeObject(DXN.make('org.dxos.type.board', '0.1.0')),
|
|
28
22
|
);
|
|
29
23
|
|
|
30
|
-
export
|
|
24
|
+
export type Board = Type.InstanceType<typeof Board>;
|
|
31
25
|
|
|
32
26
|
export const makeBoard = (props: Partial<Obj.MakeProps<typeof Board>> = {}) =>
|
|
33
27
|
Obj.make(Board, {
|