@dxos/plugin-board 0.8.4-main.7ace549 → 0.8.4-main.9735255
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-2XGWSTZV.mjs +159 -0
- package/dist/lib/browser/chunk-2XGWSTZV.mjs.map +7 -0
- package/dist/lib/browser/chunk-7VKDDGS7.mjs +36 -0
- package/dist/lib/browser/chunk-7VKDDGS7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +32 -54
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-BEYXCLXI.mjs +31 -0
- package/dist/lib/browser/react-surface-BEYXCLXI.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/chunk-JKPYRS2Z.mjs +161 -0
- package/dist/lib/node-esm/chunk-JKPYRS2Z.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UGVRNKWV.mjs +37 -0
- package/dist/lib/node-esm/chunk-UGVRNKWV.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +32 -54
- 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-ZFKFUBJM.mjs +32 -0
- package/dist/lib/node-esm/react-surface-ZFKFUBJM.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 +2 -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/types/Board.d.ts +24 -60
- 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 -40
- 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 +28 -24
- package/src/meta.ts +2 -2
- package/src/types/Board.ts +3 -17
- package/dist/lib/browser/chunk-BPWAJIIV.mjs +0 -64
- package/dist/lib/browser/chunk-BPWAJIIV.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q2FY5QDD.mjs +0 -143
- package/dist/lib/browser/chunk-Q2FY5QDD.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-N25TTBCB.mjs +0 -33
- package/dist/lib/browser/intent-resolver-N25TTBCB.mjs.map +0 -7
- package/dist/lib/browser/react-surface-QP64T3BI.mjs +0 -30
- package/dist/lib/browser/react-surface-QP64T3BI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-366TAZLJ.mjs +0 -65
- package/dist/lib/node-esm/chunk-366TAZLJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WG2I3CAR.mjs +0 -145
- package/dist/lib/node-esm/chunk-WG2I3CAR.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-IAZULV42.mjs +0 -34
- package/dist/lib/node-esm/intent-resolver-IAZULV42.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-D6JA57PU.mjs +0 -31
- package/dist/lib/node-esm/react-surface-D6JA57PU.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.9735255",
|
|
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/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/echo": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
53
|
-
"@dxos/plugin-
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
58
|
-
"@dxos/react-ui-attention": "0.8.4-main.
|
|
59
|
-
"@dxos/react-
|
|
60
|
-
"@dxos/react-ui-
|
|
61
|
-
"@dxos/react-ui-stack": "0.8.4-main.
|
|
62
|
-
"@dxos/react-ui-
|
|
63
|
-
"@dxos/schema": "0.8.4-main.
|
|
64
|
-
"@dxos/types": "0.8.4-main.
|
|
65
|
-
"@dxos/util": "0.8.4-main.
|
|
42
|
+
"effect": "3.19.11",
|
|
43
|
+
"@dxos/ai": "0.8.4-main.9735255",
|
|
44
|
+
"@dxos/app-framework": "0.8.4-main.9735255",
|
|
45
|
+
"@dxos/async": "0.8.4-main.9735255",
|
|
46
|
+
"@dxos/assistant": "0.8.4-main.9735255",
|
|
47
|
+
"@dxos/client": "0.8.4-main.9735255",
|
|
48
|
+
"@dxos/blueprints": "0.8.4-main.9735255",
|
|
49
|
+
"@dxos/echo": "0.8.4-main.9735255",
|
|
50
|
+
"@dxos/effect": "0.8.4-main.9735255",
|
|
51
|
+
"@dxos/invariant": "0.8.4-main.9735255",
|
|
52
|
+
"@dxos/echo-react": "0.8.4-main.9735255",
|
|
53
|
+
"@dxos/plugin-client": "0.8.4-main.9735255",
|
|
54
|
+
"@dxos/log": "0.8.4-main.9735255",
|
|
55
|
+
"@dxos/operation": "0.8.4-main.9735255",
|
|
56
|
+
"@dxos/plugin-graph": "0.8.4-main.9735255",
|
|
57
|
+
"@dxos/plugin-search": "0.8.4-main.9735255",
|
|
58
|
+
"@dxos/random": "0.8.4-main.9735255",
|
|
59
|
+
"@dxos/plugin-space": "0.8.4-main.9735255",
|
|
60
|
+
"@dxos/react-client": "0.8.4-main.9735255",
|
|
61
|
+
"@dxos/react-ui": "0.8.4-main.9735255",
|
|
62
|
+
"@dxos/react-ui-attention": "0.8.4-main.9735255",
|
|
63
|
+
"@dxos/react-ui-board": "0.8.4-main.9735255",
|
|
64
|
+
"@dxos/react-ui-form": "0.8.4-main.9735255",
|
|
65
|
+
"@dxos/react-ui-stack": "0.8.4-main.9735255",
|
|
66
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.9735255",
|
|
67
|
+
"@dxos/schema": "0.8.4-main.9735255",
|
|
68
|
+
"@dxos/types": "0.8.4-main.9735255",
|
|
69
|
+
"@dxos/util": "0.8.4-main.9735255"
|
|
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-preview": "0.8.4-main.
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/react-ui-
|
|
77
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
78
|
-
"@dxos/
|
|
77
|
+
"@dxos/plugin-testing": "0.8.4-main.9735255",
|
|
78
|
+
"@dxos/plugin-preview": "0.8.4-main.9735255",
|
|
79
|
+
"@dxos/plugin-theme": "0.8.4-main.9735255",
|
|
80
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.9735255",
|
|
81
|
+
"@dxos/storybook-utils": "0.8.4-main.9735255",
|
|
82
|
+
"@dxos/test-utils": "0.8.4-main.9735255",
|
|
83
|
+
"@dxos/ui-theme": "0.8.4-main.9735255"
|
|
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.9735255",
|
|
90
|
+
"@dxos/ui-theme": "0.8.4-main.9735255"
|
|
86
91
|
},
|
|
87
92
|
"publishConfig": {
|
|
88
93
|
"access": "public"
|
package/src/BoardPlugin.tsx
CHANGED
|
@@ -2,50 +2,31 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
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';
|
|
8
9
|
import { translations as boardTranslations } from '@dxos/react-ui-board';
|
|
9
10
|
|
|
10
|
-
import {
|
|
11
|
+
import { ReactSurface } from './capabilities';
|
|
11
12
|
import { meta } from './meta';
|
|
12
13
|
import { translations } from './translations';
|
|
13
14
|
import { Board } from './types';
|
|
14
15
|
|
|
15
|
-
export const BoardPlugin =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
id: Board.Board.typename,
|
|
28
|
-
metadata: {
|
|
29
|
-
icon: 'ph--squares-four--regular',
|
|
30
|
-
iconHue: 'green',
|
|
31
|
-
creatObjectIntent: (() => createIntent(Board.Create)) satisfies CreateObjectIntent,
|
|
32
|
-
addToCollectionOnCreate: true,
|
|
33
|
-
},
|
|
34
|
-
}),
|
|
35
|
-
}),
|
|
36
|
-
defineModule({
|
|
37
|
-
id: `${meta.id}/module/schema`,
|
|
38
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
39
|
-
activate: () => contributes(ClientCapabilities.Schema, [Board.Board]),
|
|
40
|
-
}),
|
|
41
|
-
defineModule({
|
|
42
|
-
id: `${meta.id}/module/react-surface`,
|
|
43
|
-
activatesOn: Events.SetupReactSurface,
|
|
44
|
-
activate: ReactSurface,
|
|
45
|
-
}),
|
|
46
|
-
defineModule({
|
|
47
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
48
|
-
activatesOn: Events.SetupIntentResolver,
|
|
49
|
-
activate: IntentResolver,
|
|
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
|
+
},
|
|
50
28
|
}),
|
|
51
|
-
])
|
|
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
|
);
|
|
@@ -104,10 +106,12 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
// Create a reference to the selected object and add it to the board.
|
|
107
|
-
|
|
109
|
+
Obj.change(board, (b) => {
|
|
110
|
+
b.items.push(Ref.make(selectedObject));
|
|
108
111
|
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
// Set the layout position for the new item.
|
|
113
|
+
b.layout.cells[selectedObject.id.toString()] = pickerState.position;
|
|
114
|
+
});
|
|
111
115
|
|
|
112
116
|
// Close the picker.
|
|
113
117
|
setPickerState(null);
|
|
@@ -123,7 +127,7 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
|
123
127
|
setPickerState(nextOpen ? { position: DEFAULT_POSITION } : null);
|
|
124
128
|
}}
|
|
125
129
|
>
|
|
126
|
-
<
|
|
130
|
+
<Layout.Main role={role} toolbar>
|
|
127
131
|
<Board.Toolbar disabled={!hasAttention} />
|
|
128
132
|
<Board.Container>
|
|
129
133
|
<Board.Viewport classNames='border-none'>
|
|
@@ -131,13 +135,13 @@ export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
|
131
135
|
<Board.Content>
|
|
132
136
|
{items?.map((item, index) => (
|
|
133
137
|
<Board.Cell item={item} key={index} layout={board.layout?.cells[item.id] ?? { x: 0, y: 0 }}>
|
|
134
|
-
<Surface role='card--
|
|
138
|
+
<Surface role='card--content' data={{ subject: item }} limit={1} />
|
|
135
139
|
</Board.Cell>
|
|
136
140
|
))}
|
|
137
141
|
</Board.Content>
|
|
138
142
|
</Board.Viewport>
|
|
139
143
|
</Board.Container>
|
|
140
|
-
</
|
|
144
|
+
</Layout.Main>
|
|
141
145
|
<ObjectPicker.Content options={options} onSelect={handleSelect} classNames='popover-card-width' />
|
|
142
146
|
<ObjectPicker.VirtualTrigger virtualRef={addTriggerRef} />
|
|
143
147
|
</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/types/Board.ts
CHANGED
|
@@ -8,17 +8,15 @@ import { Obj, Type } from '@dxos/echo';
|
|
|
8
8
|
import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
9
|
import { BoardLayout, defaultLayout } from '@dxos/react-ui-board';
|
|
10
10
|
|
|
11
|
-
import { meta } from '../meta';
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* Board and layout.
|
|
15
13
|
*/
|
|
16
14
|
export const Board = Schema.Struct({
|
|
17
15
|
name: Schema.String.pipe(Schema.optional),
|
|
18
|
-
items: Type.Ref(Obj
|
|
19
|
-
layout: BoardLayout.pipe(
|
|
16
|
+
items: Type.Ref(Type.Obj).pipe(Schema.Array, FormInputAnnotation.set(false)),
|
|
17
|
+
layout: BoardLayout.pipe(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 { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
|
|
17
|
-
import { BoardLayout, defaultLayout } from "@dxos/react-ui-board";
|
|
18
|
-
|
|
19
|
-
// src/meta.ts
|
|
20
|
-
import { trim } from "@dxos/util";
|
|
21
|
-
var meta = {
|
|
22
|
-
id: "dxos.org/plugin/board",
|
|
23
|
-
name: "Board",
|
|
24
|
-
description: trim`
|
|
25
|
-
Infinite canvas workspace that combines sticky notes, media, and whiteboarding tools.
|
|
26
|
-
Arrange and connect ideas freely in a visual space perfect for brainstorming and creative collaboration.
|
|
27
|
-
`,
|
|
28
|
-
icon: "ph--squares-four--regular",
|
|
29
|
-
iconHue: "green",
|
|
30
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-board",
|
|
31
|
-
screenshots: []
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// src/types/Board.ts
|
|
35
|
-
var Board = Schema.Struct({
|
|
36
|
-
name: Schema.String.pipe(Schema.optional),
|
|
37
|
-
items: Type.Ref(Obj.Any).pipe(Schema.Array, Schema.mutable, FormInputAnnotation.set(false)),
|
|
38
|
-
layout: BoardLayout.pipe(Schema.mutable, FormInputAnnotation.set(false))
|
|
39
|
-
}).pipe(Type.Obj({
|
|
40
|
-
typename: "dxos.org/type/Board",
|
|
41
|
-
version: "0.1.0"
|
|
42
|
-
}), LabelAnnotation.set([
|
|
43
|
-
"name"
|
|
44
|
-
]));
|
|
45
|
-
var makeBoard = (props = {}) => Obj.make(Board, {
|
|
46
|
-
items: [],
|
|
47
|
-
layout: defaultLayout,
|
|
48
|
-
...props
|
|
49
|
-
});
|
|
50
|
-
var Create = class extends Schema.TaggedClass()(`${meta.id}/action/create`, {
|
|
51
|
-
input: Schema.Struct({
|
|
52
|
-
name: Schema.optional(Schema.String)
|
|
53
|
-
}),
|
|
54
|
-
output: Schema.Struct({
|
|
55
|
-
object: Board
|
|
56
|
-
})
|
|
57
|
-
}) {
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export {
|
|
61
|
-
meta,
|
|
62
|
-
Board_exports
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=chunk-BPWAJIIV.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/Board.ts", "../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Obj, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { BoardLayout, defaultLayout } from '@dxos/react-ui-board';\n\nimport { meta } from '../meta';\n\n/**\n * Board and layout.\n */\nexport const Board = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n items: Type.Ref(Obj.Any).pipe(Schema.Array, Schema.mutable, FormInputAnnotation.set(false)),\n layout: BoardLayout.pipe(Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Board',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n\nexport interface Board extends Schema.Schema.Type<typeof Board> {}\n\nexport const makeBoard = (props: Partial<Obj.MakeProps<typeof Board>> = {}) =>\n Obj.make(Board, {\n items: [],\n layout: defaultLayout,\n ...props,\n });\n\n/**\n * Create board.\n */\nexport class Create extends Schema.TaggedClass<Create>()(`${meta.id}/action/create`, {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: Board,\n }),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/board',\n name: 'Board',\n description: trim`\n Infinite canvas workspace that combines sticky notes, media, and whiteboarding tools.\n Arrange and connect ideas freely in a visual space perfect for brainstorming and creative collaboration.\n `,\n icon: 'ph--squares-four--regular',\n iconHue: 'green',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-board',\n screenshots: [],\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAAA;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,KAAKC,YAAY;AAC1B,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,aAAaC,qBAAqB;;;ACH3C,SAASC,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,aAAa,CAAA;AACf;;;ADHO,IAAMC,QAAeC,cAAO;EACjCC,MAAaC,cAAOC,KAAYC,eAAQ;EACxCC,OAAOC,KAAKC,IAAIC,IAAIC,GAAG,EAAEN,KAAYO,cAAcC,gBAASC,oBAAoBC,IAAI,KAAA,CAAA;EACpFC,QAAQC,YAAYZ,KAAYQ,gBAASC,oBAAoBC,IAAI,KAAA,CAAA;AACnE,CAAA,EAAGV,KACDG,KAAKE,IAAI;EACPQ,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBL,IAAI;EAAC;CAAO,CAAA;AAKvB,IAAMM,YAAY,CAACC,QAA8C,CAAC,MACvEZ,IAAIa,KAAKtB,OAAO;EACdM,OAAO,CAAA;EACPS,QAAQQ;EACR,GAAGF;AACL,CAAA;AAKK,IAAMG,SAAN,cAA4BC,mBAAW,EAAW,GAAGC,KAAKC,EAAE,kBAAkB;EACnFC,OAAc3B,cAAO;IACnBC,MAAaG,gBAAgBF,aAAM;EACrC,CAAA;EACA0B,QAAe5B,cAAO;IACpB6B,QAAQ9B;EACV,CAAA;AACF,CAAA,EAAA;AAAI;",
|
|
6
|
-
"names": ["Schema", "Obj", "Type", "FormInputAnnotation", "LabelAnnotation", "BoardLayout", "defaultLayout", "trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "screenshots", "Board", "Struct", "name", "String", "pipe", "optional", "items", "Type", "Ref", "Obj", "Any", "Array", "mutable", "FormInputAnnotation", "set", "layout", "BoardLayout", "typename", "version", "LabelAnnotation", "makeBoard", "props", "make", "defaultLayout", "Create", "TaggedClass", "meta", "id", "input", "output", "object"]
|
|
7
|
-
}
|