@dxos/plugin-board 0.8.4-main.72ec0f3 → 0.8.4-main.937b3ca
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/browser/chunk-LBLHKX5C.mjs +36 -0
- package/dist/lib/browser/chunk-LBLHKX5C.mjs.map +7 -0
- package/dist/lib/browser/chunk-RYF2DAG7.mjs +157 -0
- package/dist/lib/browser/chunk-RYF2DAG7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +34 -56
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-E72KQ3A6.mjs +31 -0
- package/dist/lib/browser/react-surface-E72KQ3A6.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/chunk-UK23JIUK.mjs +159 -0
- package/dist/lib/node-esm/chunk-UK23JIUK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VU2JDWBB.mjs +37 -0
- package/dist/lib/node-esm/chunk-VU2JDWBB.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +34 -56
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-6OXJH5X5.mjs +32 -0
- package/dist/lib/node-esm/react-surface-6OXJH5X5.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/BoardPlugin.d.ts +2 -1
- package/dist/types/src/BoardPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/BoardContainer.d.ts +3 -5
- package/dist/types/src/components/BoardContainer.d.ts.map +1 -1
- package/dist/types/src/components/BoardContainer.stories.d.ts +3 -3
- package/dist/types/src/components/BoardContainer.stories.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/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Board.d.ts +23 -65
- package/dist/types/src/types/Board.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +55 -50
- package/src/BoardPlugin.tsx +21 -46
- package/src/capabilities/index.ts +1 -4
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +26 -0
- package/src/components/BoardContainer.stories.tsx +29 -33
- package/src/components/BoardContainer.tsx +24 -22
- package/src/meta.ts +2 -2
- package/src/translations.ts +1 -0
- package/src/types/Board.ts +4 -18
- package/dist/lib/browser/chunk-6IYOP7JD.mjs +0 -64
- package/dist/lib/browser/chunk-6IYOP7JD.mjs.map +0 -7
- package/dist/lib/browser/chunk-UDI6JPP5.mjs +0 -143
- package/dist/lib/browser/chunk-UDI6JPP5.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MGJCQT3N.mjs +0 -33
- package/dist/lib/browser/intent-resolver-MGJCQT3N.mjs.map +0 -7
- package/dist/lib/browser/react-surface-PBKZGBFJ.mjs +0 -30
- package/dist/lib/browser/react-surface-PBKZGBFJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LJPQ2ELJ.mjs +0 -145
- package/dist/lib/node-esm/chunk-LJPQ2ELJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WFLKZNL3.mjs +0 -65
- package/dist/lib/node-esm/chunk-WFLKZNL3.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-TV2AARM7.mjs +0 -34
- package/dist/lib/node-esm/intent-resolver-TV2AARM7.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-NELFNJ6M.mjs +0 -31
- package/dist/lib/node-esm/react-surface-NELFNJ6M.mjs.map +0 -7
- 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/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -34
- 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.
|
|
3
|
+
"version": "0.8.4-main.937b3ca",
|
|
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,55 @@
|
|
|
35
39
|
"src"
|
|
36
40
|
],
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/effect": "0.8.4-main.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/plugin-
|
|
52
|
-
"@dxos/plugin-
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/react-ui-
|
|
60
|
-
"@dxos/react-ui-
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/react-ui-
|
|
63
|
-
"@dxos/types": "0.8.4-main.
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
42
|
+
"effect": "3.19.11",
|
|
43
|
+
"@dxos/ai": "0.8.4-main.937b3ca",
|
|
44
|
+
"@dxos/app-framework": "0.8.4-main.937b3ca",
|
|
45
|
+
"@dxos/assistant": "0.8.4-main.937b3ca",
|
|
46
|
+
"@dxos/blueprints": "0.8.4-main.937b3ca",
|
|
47
|
+
"@dxos/client": "0.8.4-main.937b3ca",
|
|
48
|
+
"@dxos/echo-react": "0.8.4-main.937b3ca",
|
|
49
|
+
"@dxos/echo": "0.8.4-main.937b3ca",
|
|
50
|
+
"@dxos/effect": "0.8.4-main.937b3ca",
|
|
51
|
+
"@dxos/invariant": "0.8.4-main.937b3ca",
|
|
52
|
+
"@dxos/log": "0.8.4-main.937b3ca",
|
|
53
|
+
"@dxos/operation": "0.8.4-main.937b3ca",
|
|
54
|
+
"@dxos/plugin-client": "0.8.4-main.937b3ca",
|
|
55
|
+
"@dxos/plugin-graph": "0.8.4-main.937b3ca",
|
|
56
|
+
"@dxos/plugin-search": "0.8.4-main.937b3ca",
|
|
57
|
+
"@dxos/async": "0.8.4-main.937b3ca",
|
|
58
|
+
"@dxos/random": "0.8.4-main.937b3ca",
|
|
59
|
+
"@dxos/react-client": "0.8.4-main.937b3ca",
|
|
60
|
+
"@dxos/react-ui": "0.8.4-main.937b3ca",
|
|
61
|
+
"@dxos/react-ui-attention": "0.8.4-main.937b3ca",
|
|
62
|
+
"@dxos/plugin-space": "0.8.4-main.937b3ca",
|
|
63
|
+
"@dxos/react-ui-stack": "0.8.4-main.937b3ca",
|
|
64
|
+
"@dxos/react-ui-board": "0.8.4-main.937b3ca",
|
|
65
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.937b3ca",
|
|
66
|
+
"@dxos/react-ui-form": "0.8.4-main.937b3ca",
|
|
67
|
+
"@dxos/types": "0.8.4-main.937b3ca",
|
|
68
|
+
"@dxos/schema": "0.8.4-main.937b3ca",
|
|
69
|
+
"@dxos/util": "0.8.4-main.937b3ca"
|
|
66
70
|
},
|
|
67
71
|
"devDependencies": {
|
|
68
|
-
"@types/react": "~19.2.
|
|
69
|
-
"@types/react-dom": "~19.2.
|
|
70
|
-
"react": "~19.2.
|
|
71
|
-
"react-dom": "~19.2.
|
|
72
|
+
"@types/react": "~19.2.7",
|
|
73
|
+
"@types/react-dom": "~19.2.3",
|
|
74
|
+
"react": "~19.2.3",
|
|
75
|
+
"react-dom": "~19.2.3",
|
|
72
76
|
"vite": "7.1.9",
|
|
73
|
-
"@dxos/plugin-
|
|
74
|
-
"@dxos/plugin-
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/react-ui-
|
|
77
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
78
|
-
"@dxos/
|
|
77
|
+
"@dxos/plugin-preview": "0.8.4-main.937b3ca",
|
|
78
|
+
"@dxos/plugin-testing": "0.8.4-main.937b3ca",
|
|
79
|
+
"@dxos/plugin-theme": "0.8.4-main.937b3ca",
|
|
80
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.937b3ca",
|
|
81
|
+
"@dxos/storybook-utils": "0.8.4-main.937b3ca",
|
|
82
|
+
"@dxos/ui-theme": "0.8.4-main.937b3ca",
|
|
83
|
+
"@dxos/test-utils": "0.8.4-main.937b3ca"
|
|
79
84
|
},
|
|
80
85
|
"peerDependencies": {
|
|
81
|
-
"effect": "
|
|
82
|
-
"react": "
|
|
83
|
-
"react-dom": "
|
|
84
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
85
|
-
"@dxos/
|
|
86
|
+
"effect": "3.19.11",
|
|
87
|
+
"react": "~19.2.3",
|
|
88
|
+
"react-dom": "~19.2.3",
|
|
89
|
+
"@dxos/react-ui": "0.8.4-main.937b3ca",
|
|
90
|
+
"@dxos/ui-theme": "0.8.4-main.937b3ca"
|
|
86
91
|
},
|
|
87
92
|
"publishConfig": {
|
|
88
93
|
"access": "public"
|
package/src/BoardPlugin.tsx
CHANGED
|
@@ -2,56 +2,31 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Common, Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
9
9
|
import { translations as boardTranslations } from '@dxos/react-ui-board';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { ReactSurface } from './capabilities';
|
|
12
12
|
import { meta } from './meta';
|
|
13
13
|
import { translations } from './translations';
|
|
14
14
|
import { Board } from './types';
|
|
15
15
|
|
|
16
|
-
export const BoardPlugin =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
id: Board.Board.typename,
|
|
29
|
-
metadata: {
|
|
30
|
-
icon: 'ph--squares-four--regular',
|
|
31
|
-
iconHue: 'green',
|
|
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,
|
|
16
|
+
export const BoardPlugin = Plugin.define(meta).pipe(
|
|
17
|
+
Common.Plugin.addTranslationsModule({ translations: [...translations, ...boardTranslations] }),
|
|
18
|
+
Common.Plugin.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
|
+
},
|
|
56
28
|
}),
|
|
57
|
-
])
|
|
29
|
+
Common.Plugin.addSchemaModule({ schema: [Board.Board] }),
|
|
30
|
+
Common.Plugin.addSurfaceModule({ activate: ReactSurface }),
|
|
31
|
+
Plugin.make,
|
|
32
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
|
|
11
|
+
import { BoardContainer } from '../../components';
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
|
+
import { Board } from '../../types';
|
|
14
|
+
|
|
15
|
+
export default Capability.makeModule(() =>
|
|
16
|
+
Effect.succeed(
|
|
17
|
+
Capability.contributes(Common.Capability.ReactSurface, [
|
|
18
|
+
Common.createSurface({
|
|
19
|
+
id: meta.id,
|
|
20
|
+
role: ['article', 'section'],
|
|
21
|
+
filter: (data): data is { subject: Board.Board } => Obj.instanceOf(Board.Board, data.subject),
|
|
22
|
+
component: ({ role, data }) => <BoardContainer role={role} subject={data.subject} />,
|
|
23
|
+
}),
|
|
24
|
+
]),
|
|
25
|
+
),
|
|
26
|
+
);
|
|
@@ -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 {
|
|
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'
|
|
64
|
+
return <BoardContainer role='board' subject={board} />;
|
|
68
65
|
};
|
|
69
66
|
|
|
70
67
|
//
|
|
@@ -78,37 +75,36 @@ const meta = {
|
|
|
78
75
|
withTheme,
|
|
79
76
|
withPluginManager({
|
|
80
77
|
plugins: [
|
|
78
|
+
...corePlugins(),
|
|
81
79
|
ClientPlugin({
|
|
82
80
|
types: [Organization.Organization, Person.Person, Board.Board],
|
|
83
|
-
onClientInitialized:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
109
|
-
ThemePlugin({ tx: defaultTx }),
|
|
106
|
+
StorybookPlugin({}),
|
|
110
107
|
PreviewPlugin(),
|
|
111
|
-
StorybookLayoutPlugin({}),
|
|
112
108
|
],
|
|
113
109
|
}),
|
|
114
110
|
],
|
|
@@ -4,16 +4,15 @@
|
|
|
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, type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
9
8
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
9
|
+
import { useObject, useObjects } from '@dxos/echo-react';
|
|
10
10
|
import { invariant } from '@dxos/invariant';
|
|
11
11
|
import { useQuery } from '@dxos/react-client/echo';
|
|
12
|
-
import { useSignalsMemo } from '@dxos/react-ui';
|
|
13
12
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
14
13
|
import { Board, type BoardController, type BoardRootProps, type Position } from '@dxos/react-ui-board';
|
|
15
14
|
import { ObjectPicker, type ObjectPickerContentProps } from '@dxos/react-ui-form';
|
|
16
|
-
import {
|
|
15
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
17
16
|
import { isNonNullable } from '@dxos/util';
|
|
18
17
|
|
|
19
18
|
import { type Board as BoardType } from '../types';
|
|
@@ -24,21 +23,20 @@ type PickerState = {
|
|
|
24
23
|
position: Position;
|
|
25
24
|
};
|
|
26
25
|
|
|
27
|
-
export type BoardContainerProps =
|
|
28
|
-
role?: string;
|
|
29
|
-
board: BoardType.Board;
|
|
30
|
-
};
|
|
26
|
+
export type BoardContainerProps = SurfaceComponentProps<BoardType.Board>;
|
|
31
27
|
|
|
32
|
-
export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
28
|
+
export const BoardContainer = ({ role, subject: board }: BoardContainerProps) => {
|
|
33
29
|
const controller = useRef<BoardController>(null);
|
|
34
|
-
const
|
|
30
|
+
const [boardItems] = useObject(board, 'items');
|
|
31
|
+
const items = useObjects(boardItems ?? []);
|
|
35
32
|
const addTriggerRef = useRef<HTMLButtonElement | null>(null);
|
|
36
33
|
const [pickerState, setPickerState] = useState<PickerState | null>(null);
|
|
37
34
|
const attendableId = Obj.getDXN(board).toString();
|
|
38
35
|
const { hasAttention } = useAttention(attendableId);
|
|
39
36
|
|
|
37
|
+
const db = Obj.getDatabase(board);
|
|
40
38
|
// TODO(burdon): Use search.
|
|
41
|
-
const objects = useQuery(
|
|
39
|
+
const objects = useQuery(db, Filter.everything());
|
|
42
40
|
const options = useMemo<ObjectPickerContentProps['options']>(
|
|
43
41
|
() =>
|
|
44
42
|
objects
|
|
@@ -60,8 +58,8 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
|
60
58
|
|
|
61
59
|
const handleAdd = useCallback<NonNullable<BoardRootProps['onAdd']>>(
|
|
62
60
|
async (anchor, position = DEFAULT_POSITION) => {
|
|
63
|
-
const
|
|
64
|
-
invariant(
|
|
61
|
+
const db = Obj.getDatabase(board);
|
|
62
|
+
invariant(db);
|
|
65
63
|
addTriggerRef.current = anchor;
|
|
66
64
|
setPickerState({
|
|
67
65
|
position,
|
|
@@ -75,10 +73,12 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
|
75
73
|
(id) => {
|
|
76
74
|
// TODO(burdon): Impl. DXN.equals and pass in DXN from `id`.
|
|
77
75
|
const idx = board.items.findIndex((ref) => ref.dxn.asEchoDXN()?.echoId === id);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
Obj.change(board, (b) => {
|
|
77
|
+
if (idx !== -1) {
|
|
78
|
+
b.items.splice(idx, 1);
|
|
79
|
+
}
|
|
80
|
+
delete b.layout.cells[id];
|
|
81
|
+
});
|
|
82
82
|
},
|
|
83
83
|
[board],
|
|
84
84
|
);
|
|
@@ -86,7 +86,9 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
|
86
86
|
const handleMove = useCallback<NonNullable<BoardRootProps['onMove']>>(
|
|
87
87
|
(id, position) => {
|
|
88
88
|
const layout = board.layout.cells[id];
|
|
89
|
-
board
|
|
89
|
+
Obj.change(board, (b) => {
|
|
90
|
+
b.layout.cells[id] = { ...layout, ...position };
|
|
91
|
+
});
|
|
90
92
|
},
|
|
91
93
|
[board],
|
|
92
94
|
);
|
|
@@ -99,7 +101,7 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
|
99
101
|
|
|
100
102
|
// Find the selected object by id from the space.
|
|
101
103
|
const selectedObject = objects.find((obj) => obj.id === id);
|
|
102
|
-
if (!selectedObject) {
|
|
104
|
+
if (!Obj.isObject(selectedObject)) {
|
|
103
105
|
return;
|
|
104
106
|
}
|
|
105
107
|
|
|
@@ -123,7 +125,7 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
|
123
125
|
setPickerState(nextOpen ? { position: DEFAULT_POSITION } : null);
|
|
124
126
|
}}
|
|
125
127
|
>
|
|
126
|
-
<
|
|
128
|
+
<Layout.Main role={role} toolbar>
|
|
127
129
|
<Board.Toolbar disabled={!hasAttention} />
|
|
128
130
|
<Board.Container>
|
|
129
131
|
<Board.Viewport classNames='border-none'>
|
|
@@ -131,13 +133,13 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
|
131
133
|
<Board.Content>
|
|
132
134
|
{items?.map((item, index) => (
|
|
133
135
|
<Board.Cell item={item} key={index} layout={board.layout?.cells[item.id] ?? { x: 0, y: 0 }}>
|
|
134
|
-
<Surface role='card--
|
|
136
|
+
<Surface role='card--content' data={{ subject: item }} limit={1} />
|
|
135
137
|
</Board.Cell>
|
|
136
138
|
))}
|
|
137
139
|
</Board.Content>
|
|
138
140
|
</Board.Viewport>
|
|
139
141
|
</Board.Container>
|
|
140
|
-
</
|
|
142
|
+
</Layout.Main>
|
|
141
143
|
<ObjectPicker.Content options={options} onSelect={handleSelect} classNames='popover-card-width' />
|
|
142
144
|
<ObjectPicker.VirtualTrigger virtualRef={addTriggerRef} />
|
|
143
145
|
</ObjectPicker.Root>
|
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/board',
|
|
10
10
|
name: 'Board',
|
|
11
11
|
description: trim`
|
package/src/translations.ts
CHANGED
package/src/types/Board.ts
CHANGED
|
@@ -5,20 +5,18 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Obj, Type } from '@dxos/echo';
|
|
8
|
-
import {
|
|
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(Type.
|
|
19
|
-
layout: BoardLayout.pipe(Schema.mutable,
|
|
16
|
+
items: Type.Ref(Type.Obj).pipe(Schema.Array, Schema.mutable, FormInputAnnotation.set(false)),
|
|
17
|
+
layout: BoardLayout.pipe(Schema.mutable, FormInputAnnotation.set(false)),
|
|
20
18
|
}).pipe(
|
|
21
|
-
Type.
|
|
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 { FormAnnotation, 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(Type.Expando).pipe(Schema.Array, Schema.mutable, FormAnnotation.set(false)),
|
|
38
|
-
layout: BoardLayout.pipe(Schema.mutable, FormAnnotation.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-6IYOP7JD.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 { FormAnnotation, 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(Type.Expando).pipe(Schema.Array, Schema.mutable, FormAnnotation.set(false)),\n layout: BoardLayout.pipe(Schema.mutable, FormAnnotation.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,gBAAgBC,uBAAuB;AAChD,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,IAAID,KAAKE,OAAO,EAAEL,KAAYM,cAAcC,gBAASC,eAAeC,IAAI,KAAA,CAAA;EACpFC,QAAQC,YAAYX,KAAYO,gBAASC,eAAeC,IAAI,KAAA,CAAA;AAC9D,CAAA,EAAGT,KACDG,KAAKS,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBN,IAAI;EAAC;CAAO,CAAA;AAKvB,IAAMO,YAAY,CAACC,QAA8C,CAAC,MACvEL,IAAIM,KAAKtB,OAAO;EACdM,OAAO,CAAA;EACPQ,QAAQS;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", "FormAnnotation", "LabelAnnotation", "BoardLayout", "defaultLayout", "trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "screenshots", "Board", "Struct", "name", "String", "pipe", "optional", "items", "Type", "Ref", "Expando", "Array", "mutable", "FormAnnotation", "set", "layout", "BoardLayout", "Obj", "typename", "version", "LabelAnnotation", "makeBoard", "props", "make", "defaultLayout", "Create", "TaggedClass", "meta", "id", "input", "output", "object"]
|
|
7
|
-
}
|