@dxos/plugin-board 0.8.4-main.28f8d3d → 0.8.4-main.406dc2a
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-2AR36W5A.mjs → chunk-RHMZXTJ7.mjs} +59 -49
- package/dist/lib/browser/chunk-RHMZXTJ7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-V67SBM4U.mjs → chunk-Z6L4ZVCB.mjs} +3 -3
- package/dist/lib/browser/chunk-Z6L4ZVCB.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +45 -47
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-resolver-6NM32ZSV.mjs → intent-resolver-H6OF7V77.mjs} +4 -4
- package/dist/lib/browser/{intent-resolver-6NM32ZSV.mjs.map → intent-resolver-H6OF7V77.mjs.map} +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-S7H45RGL.mjs → react-surface-37LEVBKY.mjs} +5 -5
- package/dist/lib/browser/{react-surface-S7H45RGL.mjs.map → react-surface-37LEVBKY.mjs.map} +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/{chunk-XCGDC6OV.mjs → chunk-AWLY252W.mjs} +3 -3
- package/dist/lib/node-esm/chunk-AWLY252W.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AWGKINO6.mjs → chunk-XZA5WICX.mjs} +59 -49
- package/dist/lib/node-esm/chunk-XZA5WICX.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +45 -47
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/{intent-resolver-5DQ5PPTT.mjs → intent-resolver-L534P6FM.mjs} +4 -4
- package/dist/lib/node-esm/{intent-resolver-5DQ5PPTT.mjs.map → intent-resolver-L534P6FM.mjs.map} +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-UGBLNFXL.mjs → react-surface-GVHSH2W2.mjs} +5 -5
- package/dist/lib/node-esm/{react-surface-UGBLNFXL.mjs.map → react-surface-GVHSH2W2.mjs.map} +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/BoardPlugin.d.ts +1 -1
- package/dist/types/src/BoardPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/components/BoardContainer.d.ts +1 -1
- package/dist/types/src/components/BoardContainer.d.ts.map +1 -1
- package/dist/types/src/components/BoardContainer.stories.d.ts +42 -5
- package/dist/types/src/components/BoardContainer.stories.d.ts.map +1 -1
- package/dist/types/src/types/Board.d.ts +3 -3
- package/dist/types/src/types/Board.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +41 -42
- package/src/BoardPlugin.tsx +40 -42
- package/src/components/BoardContainer.stories.tsx +27 -45
- package/src/components/BoardContainer.tsx +85 -53
- package/src/types/Board.ts +2 -2
- package/dist/lib/browser/chunk-2AR36W5A.mjs.map +0 -7
- package/dist/lib/browser/chunk-V67SBM4U.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AWGKINO6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XCGDC6OV.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-board",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.406dc2a",
|
|
4
4
|
"description": "Surface plugin for card baords",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -36,52 +36,51 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@preact-signals/safe-react": "^0.9.0",
|
|
39
|
-
"@preact/signals-core": "^1.
|
|
40
|
-
"@preact/signals-react": "^3.
|
|
41
|
-
"effect": "3.
|
|
42
|
-
"@dxos/ai": "0.8.4-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/log": "0.8.4-main.
|
|
53
|
-
"@dxos/plugin-
|
|
54
|
-
"@dxos/plugin-
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/plugin-
|
|
58
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
59
|
-
"@dxos/react-ui-
|
|
60
|
-
"@dxos/react-
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/react-ui-
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/util": "0.8.4-main.28f8d3d"
|
|
39
|
+
"@preact/signals-core": "^1.12.1",
|
|
40
|
+
"@preact/signals-react": "^3.3.0",
|
|
41
|
+
"effect": "3.18.3",
|
|
42
|
+
"@dxos/ai": "0.8.4-main.406dc2a",
|
|
43
|
+
"@dxos/assistant": "0.8.4-main.406dc2a",
|
|
44
|
+
"@dxos/app-framework": "0.8.4-main.406dc2a",
|
|
45
|
+
"@dxos/client": "0.8.4-main.406dc2a",
|
|
46
|
+
"@dxos/echo": "0.8.4-main.406dc2a",
|
|
47
|
+
"@dxos/async": "0.8.4-main.406dc2a",
|
|
48
|
+
"@dxos/blueprints": "0.8.4-main.406dc2a",
|
|
49
|
+
"@dxos/effect": "0.8.4-main.406dc2a",
|
|
50
|
+
"@dxos/invariant": "0.8.4-main.406dc2a",
|
|
51
|
+
"@dxos/plugin-client": "0.8.4-main.406dc2a",
|
|
52
|
+
"@dxos/log": "0.8.4-main.406dc2a",
|
|
53
|
+
"@dxos/plugin-search": "0.8.4-main.406dc2a",
|
|
54
|
+
"@dxos/plugin-space": "0.8.4-main.406dc2a",
|
|
55
|
+
"@dxos/random": "0.8.4-main.406dc2a",
|
|
56
|
+
"@dxos/react-client": "0.8.4-main.406dc2a",
|
|
57
|
+
"@dxos/plugin-graph": "0.8.4-main.406dc2a",
|
|
58
|
+
"@dxos/react-ui": "0.8.4-main.406dc2a",
|
|
59
|
+
"@dxos/react-ui-board": "0.8.4-main.406dc2a",
|
|
60
|
+
"@dxos/react-ui-stack": "0.8.4-main.406dc2a",
|
|
61
|
+
"@dxos/schema": "0.8.4-main.406dc2a",
|
|
62
|
+
"@dxos/react-ui-form": "0.8.4-main.406dc2a",
|
|
63
|
+
"@dxos/util": "0.8.4-main.406dc2a"
|
|
65
64
|
},
|
|
66
65
|
"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/
|
|
74
|
-
"@dxos/react-ui-
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
66
|
+
"@types/react": "~19.2.2",
|
|
67
|
+
"@types/react-dom": "~19.2.1",
|
|
68
|
+
"react": "~19.2.0",
|
|
69
|
+
"react-dom": "~19.2.0",
|
|
70
|
+
"vite": "7.1.9",
|
|
71
|
+
"@dxos/plugin-preview": "0.8.4-main.406dc2a",
|
|
72
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.406dc2a",
|
|
73
|
+
"@dxos/react-ui-theme": "0.8.4-main.406dc2a",
|
|
74
|
+
"@dxos/plugin-theme": "0.8.4-main.406dc2a",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.4-main.406dc2a",
|
|
76
|
+
"@dxos/test-utils": "0.8.4-main.406dc2a"
|
|
78
77
|
},
|
|
79
78
|
"peerDependencies": {
|
|
80
79
|
"effect": "^3.13.3",
|
|
81
|
-
"react": "
|
|
82
|
-
"react-dom": "
|
|
83
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
84
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
80
|
+
"react": "^19.0.0",
|
|
81
|
+
"react-dom": "^19.0.0",
|
|
82
|
+
"@dxos/react-ui": "0.8.4-main.406dc2a",
|
|
83
|
+
"@dxos/react-ui-theme": "0.8.4-main.406dc2a"
|
|
85
84
|
},
|
|
86
85
|
"publishConfig": {
|
|
87
86
|
"access": "public"
|
package/src/BoardPlugin.tsx
CHANGED
|
@@ -13,46 +13,44 @@ 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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
export const BoardPlugin = definePlugin(meta, () => [
|
|
17
|
+
defineModule({
|
|
18
|
+
id: `${meta.id}/module/translations`,
|
|
19
|
+
activatesOn: Events.SetupTranslations,
|
|
20
|
+
activate: () => contributes(Capabilities.Translations, [...translations, ...boardTranslations]),
|
|
21
|
+
}),
|
|
22
|
+
defineModule({
|
|
23
|
+
id: `${meta.id}/module/metadata`,
|
|
24
|
+
activatesOn: Events.SetupMetadata,
|
|
25
|
+
activate: () =>
|
|
26
|
+
// TODO(burdon): "Metadata" here seems non-descriptive; is this specifically for the type? ObjectMetadata?
|
|
27
|
+
contributes(Capabilities.Metadata, {
|
|
28
|
+
id: Board.Board.typename,
|
|
29
|
+
metadata: {
|
|
30
|
+
icon: 'ph--squares-four--regular',
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
}),
|
|
34
|
+
defineModule({
|
|
35
|
+
id: `${meta.id}/module/object-form`,
|
|
36
|
+
activatesOn: ClientEvents.SetupSchema,
|
|
37
|
+
activate: () =>
|
|
38
|
+
contributes(
|
|
39
|
+
SpaceCapabilities.ObjectForm,
|
|
40
|
+
defineObjectForm({
|
|
41
|
+
objectSchema: Board.Board,
|
|
42
|
+
getIntent: () => createIntent(Board.Create),
|
|
33
43
|
}),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
};
|
|
44
|
+
),
|
|
45
|
+
}),
|
|
46
|
+
defineModule({
|
|
47
|
+
id: `${meta.id}/module/react-surface`,
|
|
48
|
+
activatesOn: Events.SetupReactSurface,
|
|
49
|
+
activate: ReactSurface,
|
|
50
|
+
}),
|
|
51
|
+
defineModule({
|
|
52
|
+
id: `${meta.id}/module/intent-resolver`,
|
|
53
|
+
activatesOn: Events.SetupIntentResolver,
|
|
54
|
+
activate: IntentResolver,
|
|
55
|
+
}),
|
|
56
|
+
]);
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
5
|
+
import { type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useEffect, useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
@@ -16,12 +14,11 @@ import { SpacePlugin } from '@dxos/plugin-space';
|
|
|
16
14
|
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
17
15
|
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
18
16
|
import { faker } from '@dxos/random';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
17
|
+
import { Filter, Ref, useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
18
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
21
19
|
import { translations as stackTranslations } from '@dxos/react-ui-stack';
|
|
22
20
|
import { defaultTx } from '@dxos/react-ui-theme';
|
|
23
21
|
import { DataType } from '@dxos/schema';
|
|
24
|
-
import { withLayout } from '@dxos/storybook-utils';
|
|
25
22
|
|
|
26
23
|
import { translations } from '../translations';
|
|
27
24
|
import { Board } from '../types';
|
|
@@ -30,13 +27,8 @@ import { BoardContainer } from './BoardContainer';
|
|
|
30
27
|
|
|
31
28
|
faker.seed(0);
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
const initializeBoard = async ({ space, client }: { space: Space; client: Client }) => {
|
|
38
|
-
// Create a new board
|
|
39
|
-
const board = Obj.make(Board.Board, {
|
|
30
|
+
const createBoard = () =>
|
|
31
|
+
Obj.make(Board.Board, {
|
|
40
32
|
name: 'Test Board',
|
|
41
33
|
items: [],
|
|
42
34
|
layout: {
|
|
@@ -45,25 +37,17 @@ const initializeBoard = async ({ space, client }: { space: Space; client: Client
|
|
|
45
37
|
},
|
|
46
38
|
});
|
|
47
39
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
//
|
|
52
|
-
// Story components
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
const rollOrg = () =>
|
|
56
|
-
({
|
|
40
|
+
const createOrg = () =>
|
|
41
|
+
Obj.make(DataType.Organization, {
|
|
57
42
|
name: faker.commerce.productName(),
|
|
58
43
|
description: faker.lorem.paragraph(),
|
|
59
44
|
image: faker.image.url(),
|
|
60
45
|
website: faker.internet.url(),
|
|
61
|
-
|
|
62
|
-
//
|
|
63
|
-
})
|
|
46
|
+
// TODO(burdon): Fix.
|
|
47
|
+
// status: faker.helpers.arrayElement(DataType.OrganizationStatusOptions).id,
|
|
48
|
+
});
|
|
64
49
|
|
|
65
|
-
const
|
|
66
|
-
const _client = useClient();
|
|
50
|
+
const DefaultStory = () => {
|
|
67
51
|
const spaces = useSpaces();
|
|
68
52
|
const space = spaces[spaces.length - 1];
|
|
69
53
|
const boards = useQuery(space, Filter.type(Board.Board));
|
|
@@ -83,37 +67,28 @@ const StorybookBoard = () => {
|
|
|
83
67
|
return <BoardContainer role='board' board={board} />;
|
|
84
68
|
};
|
|
85
69
|
|
|
86
|
-
type StoryProps = {};
|
|
87
|
-
|
|
88
70
|
//
|
|
89
71
|
// Story definitions
|
|
90
72
|
//
|
|
91
73
|
|
|
92
|
-
const meta
|
|
74
|
+
const meta = {
|
|
93
75
|
title: 'plugins/plugin-board/Board',
|
|
94
|
-
|
|
95
|
-
render: () => <StorybookBoard />,
|
|
96
|
-
parameters: { translations: [...translations, ...stackTranslations] },
|
|
76
|
+
render: DefaultStory,
|
|
97
77
|
decorators: [
|
|
98
|
-
|
|
78
|
+
withTheme,
|
|
99
79
|
withPluginManager({
|
|
100
80
|
plugins: [
|
|
101
|
-
ThemePlugin({ tx: defaultTx }),
|
|
102
81
|
ClientPlugin({
|
|
103
82
|
types: [DataType.Organization, DataType.Person, Board.Board],
|
|
104
83
|
onClientInitialized: async ({ client }) => {
|
|
105
84
|
await client.halo.createIdentity();
|
|
106
85
|
const space = await client.spaces.create();
|
|
107
86
|
await space.waitUntilReady();
|
|
108
|
-
const
|
|
109
|
-
space,
|
|
110
|
-
client,
|
|
111
|
-
});
|
|
112
|
-
space.db.add(board);
|
|
87
|
+
const board = space.db.add(createBoard());
|
|
113
88
|
|
|
114
89
|
// Add some sample items
|
|
115
90
|
Array.from({ length: 10 }).map(() => {
|
|
116
|
-
const org =
|
|
91
|
+
const org = createOrg();
|
|
117
92
|
space.db.add(org);
|
|
118
93
|
board.items.push(Ref.make(org));
|
|
119
94
|
board.layout.cells[org.id] = {
|
|
@@ -126,18 +101,25 @@ const meta: Meta<StoryProps> = {
|
|
|
126
101
|
});
|
|
127
102
|
},
|
|
128
103
|
}),
|
|
129
|
-
|
|
130
|
-
PreviewPlugin(),
|
|
131
|
-
SpacePlugin(),
|
|
104
|
+
SpacePlugin({}),
|
|
132
105
|
IntentPlugin(),
|
|
133
106
|
SettingsPlugin(),
|
|
107
|
+
|
|
108
|
+
// UI
|
|
109
|
+
ThemePlugin({ tx: defaultTx }),
|
|
110
|
+
PreviewPlugin(),
|
|
111
|
+
StorybookLayoutPlugin({}),
|
|
134
112
|
],
|
|
135
113
|
}),
|
|
136
114
|
],
|
|
115
|
+
parameters: {
|
|
116
|
+
layout: 'fullscreen',
|
|
117
|
+
translations: [...translations, ...stackTranslations],
|
|
118
|
+
},
|
|
137
119
|
};
|
|
138
120
|
|
|
139
121
|
export default meta;
|
|
140
122
|
|
|
141
|
-
type Story = StoryObj<
|
|
123
|
+
type Story = StoryObj<typeof meta>;
|
|
142
124
|
|
|
143
125
|
export const Default: Story = {};
|
|
@@ -2,19 +2,18 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
7
6
|
|
|
8
|
-
import { Surface
|
|
9
|
-
import { getSpace } from '@dxos/client/echo';
|
|
10
|
-
import { type Obj, Ref, type Type } from '@dxos/echo';
|
|
7
|
+
import { Surface } from '@dxos/app-framework';
|
|
8
|
+
import { Filter, Ref, getSpace } from '@dxos/client/echo';
|
|
11
9
|
import { invariant } from '@dxos/invariant';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
11
|
+
import { useSignalsMemo } from '@dxos/react-ui';
|
|
12
|
+
import { Board, type BoardController, type BoardRootProps, type Position } from '@dxos/react-ui-board';
|
|
13
|
+
import { ObjectPicker } from '@dxos/react-ui-form';
|
|
14
14
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
15
15
|
import { isNonNullable } from '@dxos/util';
|
|
16
16
|
|
|
17
|
-
// TODO(thure): There is debate about having to rename either the type or the React component. A best practice should be chosen and either Board or Kanban (or both) should be refactored to apply it.
|
|
18
17
|
import { type Board as BoardType } from '../types';
|
|
19
18
|
|
|
20
19
|
export type BoardContainerProps = {
|
|
@@ -22,42 +21,61 @@ export type BoardContainerProps = {
|
|
|
22
21
|
board: BoardType.Board;
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
27
|
-
const controller = useRef<BoardController>(null);
|
|
24
|
+
const DEFAULT_POSITION = { x: 0, y: 0 } satisfies Position;
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
});
|
|
26
|
+
type PickerState = {
|
|
27
|
+
position: Position;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
31
|
+
const controller = useRef<BoardController>(null);
|
|
32
|
+
const items = useSignalsMemo(() => board.items.map((ref) => ref.target).filter(isNonNullable), [board]);
|
|
33
|
+
const addTriggerRef = useRef<HTMLButtonElement | null>(null);
|
|
34
|
+
const [pickerState, setPickerState] = useState<PickerState | null>(null);
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
// Memoize options for ObjectPicker containing all ECHO objects in the same space as the Board.
|
|
37
|
+
const allObjects = useQuery(getSpace(board), Filter.everything());
|
|
38
|
+
const options = useMemo(
|
|
39
|
+
() =>
|
|
40
|
+
allObjects.map((obj) => ({
|
|
41
|
+
id: obj.id,
|
|
42
|
+
label: obj.name || obj.title || obj.id,
|
|
43
|
+
hue: 'neutral' as const,
|
|
44
|
+
})),
|
|
45
|
+
[allObjects],
|
|
46
|
+
);
|
|
43
47
|
|
|
44
48
|
const handleAdd = useCallback<NonNullable<BoardRootProps['onAdd']>>(
|
|
45
|
-
async (position =
|
|
49
|
+
async (anchor, position = DEFAULT_POSITION) => {
|
|
46
50
|
const space = getSpace(board);
|
|
47
51
|
invariant(space);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
52
|
+
addTriggerRef.current = anchor;
|
|
53
|
+
setPickerState({
|
|
54
|
+
position,
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
[board],
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const handleSelect = useCallback(
|
|
61
|
+
(id: string) => {
|
|
62
|
+
if (!pickerState) return;
|
|
63
|
+
|
|
64
|
+
// Find the selected object by id from the space.
|
|
65
|
+
const selectedObject = allObjects.find((obj) => obj.id === id);
|
|
66
|
+
if (!selectedObject) return;
|
|
67
|
+
|
|
68
|
+
// Create a reference to the selected object and add it to the board.
|
|
69
|
+
const ref = Ref.make(selectedObject);
|
|
70
|
+
board.items.push(ref);
|
|
71
|
+
|
|
72
|
+
// Set the layout position for the new item.
|
|
73
|
+
board.layout.cells[selectedObject.id.toString()] = pickerState.position;
|
|
74
|
+
|
|
75
|
+
// Close the picker.
|
|
76
|
+
setPickerState(null);
|
|
59
77
|
},
|
|
60
|
-
[
|
|
78
|
+
[pickerState, allObjects, board],
|
|
61
79
|
);
|
|
62
80
|
|
|
63
81
|
// TODO(burdon): Use intents so can be undone.
|
|
@@ -69,7 +87,6 @@ export const BoardContainer = ({ role, board }: BoardContainerProps) => {
|
|
|
69
87
|
board.items.splice(idx, 1);
|
|
70
88
|
}
|
|
71
89
|
delete board.layout.cells[id];
|
|
72
|
-
setItems((items) => items.filter((item) => item.id !== id));
|
|
73
90
|
},
|
|
74
91
|
[board],
|
|
75
92
|
);
|
|
@@ -84,21 +101,36 @@ export const BoardContainer = ({ role, board }: BoardContainerProps) => {
|
|
|
84
101
|
|
|
85
102
|
return (
|
|
86
103
|
<Board.Root ref={controller} layout={board.layout} onAdd={handleAdd} onDelete={handleDelete} onMove={handleMove}>
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
<ObjectPicker.Root
|
|
105
|
+
open={!!pickerState}
|
|
106
|
+
onOpenChange={(nextOpen: boolean) => {
|
|
107
|
+
setPickerState(
|
|
108
|
+
nextOpen
|
|
109
|
+
? {
|
|
110
|
+
position: DEFAULT_POSITION,
|
|
111
|
+
}
|
|
112
|
+
: null,
|
|
113
|
+
);
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
<StackItem.Content toolbar>
|
|
117
|
+
<Board.Toolbar />
|
|
118
|
+
<Board.Container>
|
|
119
|
+
<Board.Viewport classNames='border-none'>
|
|
120
|
+
<Board.Backdrop />
|
|
121
|
+
<Board.Content>
|
|
122
|
+
{items?.map((item, index) => (
|
|
123
|
+
<Board.Cell item={item} key={index} layout={board.layout?.cells[item.id] ?? { x: 0, y: 0 }}>
|
|
124
|
+
<Surface role='card--extrinsic' data={{ subject: item }} limit={1} />
|
|
125
|
+
</Board.Cell>
|
|
126
|
+
))}
|
|
127
|
+
</Board.Content>
|
|
128
|
+
</Board.Viewport>
|
|
129
|
+
</Board.Container>
|
|
130
|
+
</StackItem.Content>
|
|
131
|
+
<ObjectPicker.Content options={options} onSelect={handleSelect} classNames='popover-card-width' />
|
|
132
|
+
<ObjectPicker.VirtualTrigger virtualRef={addTriggerRef} />
|
|
133
|
+
</ObjectPicker.Root>
|
|
102
134
|
</Board.Root>
|
|
103
135
|
);
|
|
104
136
|
};
|
package/src/types/Board.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Obj, Type } from '@dxos/echo';
|
|
8
|
-
import { LabelAnnotation } from '@dxos/echo
|
|
8
|
+
import { LabelAnnotation } from '@dxos/echo/internal';
|
|
9
9
|
import { BoardLayout, defaultLayout } from '@dxos/react-ui-board';
|
|
10
10
|
|
|
11
11
|
import { meta } from '../meta';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/BoardContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { effect } from '@preact/signals-react';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { Surface, createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { getSpace } from '@dxos/client/echo';\nimport { type Obj, Ref, type Type } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Board, type BoardController, type BoardRootProps } from '@dxos/react-ui-board';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { isNonNullable } from '@dxos/util';\n\n// TODO(thure): There is debate about having to rename either the type or the React component. A best practice should be chosen and either Board or Kanban (or both) should be refactored to apply it.\nimport { type Board as BoardType } from '../types';\n\nexport type BoardContainerProps = {\n role?: string;\n board: BoardType.Board;\n};\n\nexport const BoardContainer = ({ role, board }: BoardContainerProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const controller = useRef<BoardController>(null);\n\n // TODO(burdon): Create effect utility for reactive arrays.\n const [items, setItems] = useState<Type.Expando[]>([]);\n useEffect(() => {\n let t: NodeJS.Timeout;\n effect(() => {\n const refs = [...board.items];\n t = setTimeout(async () => {\n const items = await Ref.Array.loadAll(refs);\n setItems(items.filter(isNonNullable));\n });\n });\n\n return () => clearTimeout(t);\n }, [board.items]);\n\n const handleAdd = useCallback<NonNullable<BoardRootProps['onAdd']>>(\n async (position = { x: 0, y: 0 }) => {\n const space = getSpace(board);\n invariant(space);\n await dispatch(\n createIntent(SpaceAction.OpenCreateObject, {\n target: space,\n navigable: false,\n onCreateObject: (object: Obj.Any) => {\n board.items.push(Ref.make(object));\n board.layout.cells[object.id] = { ...position, width: 1, height: 1 };\n controller.current?.center(position);\n },\n }),\n );\n },\n [board, controller, dispatch],\n );\n\n // TODO(burdon): Use intents so can be undone.\n const handleDelete = useCallback<NonNullable<BoardRootProps['onDelete']>>(\n (id) => {\n // TODO(burdon): Impl. DXN.equals and pass in DXN from `id`.\n const idx = board.items.findIndex((ref) => ref.dxn.asEchoDXN()?.echoId === id);\n if (idx !== -1) {\n board.items.splice(idx, 1);\n }\n delete board.layout.cells[id];\n setItems((items) => items.filter((item) => item.id !== id));\n },\n [board],\n );\n\n const handleMove = useCallback<NonNullable<BoardRootProps['onMove']>>(\n (id, position) => {\n const layout = board.layout.cells[id];\n board.layout.cells[id] = { ...layout, ...position };\n },\n [board],\n );\n\n return (\n <Board.Root ref={controller} layout={board.layout} onAdd={handleAdd} onDelete={handleDelete} onMove={handleMove}>\n <StackItem.Content toolbar classNames='overflow-hidden'>\n <Board.Toolbar />\n <Board.Container>\n <Board.Viewport classNames='border-none'>\n <Board.Backdrop />\n <Board.Content>\n {items?.map((item, index) => (\n <Board.Cell item={item} key={index} layout={board.layout?.cells[item.id] ?? { x: 0, y: 0 }}>\n <Surface role='card--extrinsic' data={{ subject: item }} limit={1} />\n </Board.Cell>\n ))}\n </Board.Content>\n </Board.Viewport>\n </Board.Container>\n </StackItem.Content>\n </Board.Root>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;AAIA,SAASA,cAAc;AACvB,OAAOC,SAASC,aAAaC,WAAWC,QAAQC,gBAAgB;AAEhE,SAASC,SAASC,cAAcC,2BAA2B;AAC3D,SAASC,gBAAgB;AACzB,SAAmBC,WAAsB;AACzC,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,aAAwD;AACjE,SAASC,iBAAiB;AAC1B,SAASC,qBAAqB;;AAUvB,IAAMC,iBAAiB,CAAC,EAAEC,MAAMC,MAAK,MAAuB;;;AACjE,UAAM,EAAEC,iBAAiBC,SAAQ,IAAKZ,oBAAAA;AACtC,UAAMa,aAAajB,OAAwB,IAAA;AAG3C,UAAM,CAACkB,OAAOC,QAAAA,IAAYlB,SAAyB,CAAA,CAAE;AACrDF,cAAU,MAAA;AACR,UAAIqB;AACJxB,aAAO,MAAA;AACL,cAAMyB,OAAO;aAAIP,MAAMI;;AACvBE,YAAIE,WAAW,YAAA;AACb,gBAAMJ,SAAQ,MAAMZ,IAAIiB,MAAMC,QAAQH,IAAAA;AACtCF,mBAASD,OAAMO,OAAOd,aAAAA,CAAAA;QACxB,CAAA;MACF,CAAA;AAEA,aAAO,MAAMe,aAAaN,CAAAA;IAC5B,GAAG;MAACN,MAAMI;KAAM;AAEhB,UAAMS,YAAY7B,YAChB,OAAO8B,WAAW;MAAEC,GAAG;MAAGC,GAAG;IAAE,MAAC;AAC9B,YAAMC,QAAQ1B,SAASS,KAAAA;AACvBP,gBAAUwB,OAAAA,QAAAA;;;;;;;;;AACV,YAAMf,SACJb,aAAaK,YAAYwB,kBAAkB;QACzCC,QAAQF;QACRG,WAAW;QACXC,gBAAgB,CAACC,WAAAA;AACftB,gBAAMI,MAAMmB,KAAK/B,IAAI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AAA,cAAC3D,MAAM4D,MAAI;MAACf;MAAYgB,KAAKF;MAAO7B,QAAQzB,MAAMyB,QAAQC,MAAMc,KAAKb,EAAE,KAAK;QAAEZ,GAAG;QAAGC,GAAG;MAAE;OACvF,sBAAA,cAAC5B,SAAAA;MAAQW,MAAK;MAAkB0D,MAAM;QAAEC,SAASlB;MAAK;MAAGmB,OAAO;;;;;AASlF;",
|
|
6
|
-
"names": ["effect", "React", "useCallback", "useEffect", "useRef", "useState", "Surface", "createIntent", "useIntentDispatcher", "getSpace", "Ref", "invariant", "SpaceAction", "Board", "StackItem", "isNonNullable", "BoardContainer", "role", "board", "dispatchPromise", "dispatch", "controller", "items", "setItems", "t", "refs", "setTimeout", "Array", "loadAll", "filter", "clearTimeout", "handleAdd", "position", "x", "y", "space", "OpenCreateObject", "target", "navigable", "onCreateObject", "object", "push", "make", "layout", "cells", "id", "width", "height", "current", "center", "handleDelete", "idx", "findIndex", "ref", "dxn", "asEchoDXN", "echoId", "splice", "item", "handleMove", "Root", "onAdd", "onDelete", "onMove", "Content", "toolbar", "classNames", "Toolbar", "Container", "Viewport", "Backdrop", "map", "index", "Cell", "key", "data", "subject", "limit"]
|
|
7
|
-
}
|
|
@@ -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 { Schema } from 'effect';\n\nimport { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\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.optional(Schema.String),\n items: Schema.mutable(Schema.Array(Type.Ref(Type.Expando))),\n layout: Schema.mutable(BoardLayout),\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';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/board',\n name: 'Board',\n description:\n 'A spatial, infinite canvas app combining notes, media, and whiteboarding in a tactile, visual interface.',\n icon: 'ph--squares-four--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-board',\n screenshots: [],\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAAA;;;;;;AAIA,SAASA,cAAc;AAEvB,SAASC,KAAKC,YAAY;AAC1B,SAASC,uBAAuB;AAChC,SAASC,aAAaC,qBAAqB;;;ACFpC,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aACE;EACFC,MAAM;EACNC,QAAQ;EACRC,aAAa,CAAA;AACf;;;ADCO,IAAMC,QAAQC,OAAOC,OAAO;EACjCC,MAAMF,OAAOG,SAASH,OAAOI,MAAM;EACnCC,OAAOL,OAAOM,QAAQN,OAAOO,MAAMC,KAAKC,IAAID,KAAKE,OAAO,CAAA,CAAA;EACxDC,QAAQX,OAAOM,QAAQM,WAAAA;AACzB,CAAA,EAAGC,KACDL,KAAKM,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBC,IAAI;EAAC;CAAO,CAAA;AAKvB,IAAMC,YAAY,CAACC,QAA8C,CAAC,MACvEN,IAAIO,KAAKtB,OAAO;EACdM,OAAO,CAAA;EACPM,QAAQW;EACR,GAAGF;AACL,CAAA;AAKK,IAAMG,SAAN,cAAqBvB,OAAOwB,YAAW,EAAW,GAAGC,KAAKC,EAAE,kBAAkB;EACnFC,OAAO3B,OAAOC,OAAO;IACnBC,MAAMF,OAAOG,SAASH,OAAOI,MAAM;EACrC,CAAA;EACAwB,QAAQ5B,OAAOC,OAAO;IACpB4B,QAAQ9B;EACV,CAAA;AACF,CAAA,EAAA;AAAI;",
|
|
6
|
-
"names": ["Schema", "Obj", "Type", "LabelAnnotation", "BoardLayout", "defaultLayout", "meta", "id", "name", "description", "icon", "source", "screenshots", "Board", "Schema", "Struct", "name", "optional", "String", "items", "mutable", "Array", "Type", "Ref", "Expando", "layout", "BoardLayout", "pipe", "Obj", "typename", "version", "LabelAnnotation", "set", "makeBoard", "props", "make", "defaultLayout", "Create", "TaggedClass", "meta", "id", "input", "output", "object"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/BoardContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { effect } from '@preact/signals-react';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { Surface, createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { getSpace } from '@dxos/client/echo';\nimport { type Obj, Ref, type Type } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Board, type BoardController, type BoardRootProps } from '@dxos/react-ui-board';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { isNonNullable } from '@dxos/util';\n\n// TODO(thure): There is debate about having to rename either the type or the React component. A best practice should be chosen and either Board or Kanban (or both) should be refactored to apply it.\nimport { type Board as BoardType } from '../types';\n\nexport type BoardContainerProps = {\n role?: string;\n board: BoardType.Board;\n};\n\nexport const BoardContainer = ({ role, board }: BoardContainerProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const controller = useRef<BoardController>(null);\n\n // TODO(burdon): Create effect utility for reactive arrays.\n const [items, setItems] = useState<Type.Expando[]>([]);\n useEffect(() => {\n let t: NodeJS.Timeout;\n effect(() => {\n const refs = [...board.items];\n t = setTimeout(async () => {\n const items = await Ref.Array.loadAll(refs);\n setItems(items.filter(isNonNullable));\n });\n });\n\n return () => clearTimeout(t);\n }, [board.items]);\n\n const handleAdd = useCallback<NonNullable<BoardRootProps['onAdd']>>(\n async (position = { x: 0, y: 0 }) => {\n const space = getSpace(board);\n invariant(space);\n await dispatch(\n createIntent(SpaceAction.OpenCreateObject, {\n target: space,\n navigable: false,\n onCreateObject: (object: Obj.Any) => {\n board.items.push(Ref.make(object));\n board.layout.cells[object.id] = { ...position, width: 1, height: 1 };\n controller.current?.center(position);\n },\n }),\n );\n },\n [board, controller, dispatch],\n );\n\n // TODO(burdon): Use intents so can be undone.\n const handleDelete = useCallback<NonNullable<BoardRootProps['onDelete']>>(\n (id) => {\n // TODO(burdon): Impl. DXN.equals and pass in DXN from `id`.\n const idx = board.items.findIndex((ref) => ref.dxn.asEchoDXN()?.echoId === id);\n if (idx !== -1) {\n board.items.splice(idx, 1);\n }\n delete board.layout.cells[id];\n setItems((items) => items.filter((item) => item.id !== id));\n },\n [board],\n );\n\n const handleMove = useCallback<NonNullable<BoardRootProps['onMove']>>(\n (id, position) => {\n const layout = board.layout.cells[id];\n board.layout.cells[id] = { ...layout, ...position };\n },\n [board],\n );\n\n return (\n <Board.Root ref={controller} layout={board.layout} onAdd={handleAdd} onDelete={handleDelete} onMove={handleMove}>\n <StackItem.Content toolbar classNames='overflow-hidden'>\n <Board.Toolbar />\n <Board.Container>\n <Board.Viewport classNames='border-none'>\n <Board.Backdrop />\n <Board.Content>\n {items?.map((item, index) => (\n <Board.Cell item={item} key={index} layout={board.layout?.cells[item.id] ?? { x: 0, y: 0 }}>\n <Surface role='card--extrinsic' data={{ subject: item }} limit={1} />\n </Board.Cell>\n ))}\n </Board.Content>\n </Board.Viewport>\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AAK;QAAEZ,GAAG;QAAGC,GAAG;MAAE;OACvF,sBAAA,cAAC5B,SAAAA;MAAQW,MAAK;MAAkB0D,MAAM;QAAEC,SAASlB;MAAK;MAAGmB,OAAO;;;;;AASlF;",
|
|
6
|
-
"names": ["effect", "React", "useCallback", "useEffect", "useRef", "useState", "Surface", "createIntent", "useIntentDispatcher", "getSpace", "Ref", "invariant", "SpaceAction", "Board", "StackItem", "isNonNullable", "BoardContainer", "role", "board", "dispatchPromise", "dispatch", "controller", "items", "setItems", "t", "refs", "setTimeout", "Array", "loadAll", "filter", "clearTimeout", "handleAdd", "position", "x", "y", "space", "OpenCreateObject", "target", "navigable", "onCreateObject", "object", "push", "make", "layout", "cells", "id", "width", "height", "current", "center", "handleDelete", "idx", "findIndex", "ref", "dxn", "asEchoDXN", "echoId", "splice", "item", "handleMove", "Root", "onAdd", "onDelete", "onMove", "Content", "toolbar", "classNames", "Toolbar", "Container", "Viewport", "Backdrop", "map", "index", "Cell", "key", "data", "subject", "limit"]
|
|
7
|
-
}
|
|
@@ -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 { Schema } from 'effect';\n\nimport { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\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.optional(Schema.String),\n items: Schema.mutable(Schema.Array(Type.Ref(Type.Expando))),\n layout: Schema.mutable(BoardLayout),\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';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/board',\n name: 'Board',\n description:\n 'A spatial, infinite canvas app combining notes, media, and whiteboarding in a tactile, visual interface.',\n icon: 'ph--squares-four--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-board',\n screenshots: [],\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAAA;;;;;;AAIA,SAASA,cAAc;AAEvB,SAASC,KAAKC,YAAY;AAC1B,SAASC,uBAAuB;AAChC,SAASC,aAAaC,qBAAqB;;;ACFpC,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aACE;EACFC,MAAM;EACNC,QAAQ;EACRC,aAAa,CAAA;AACf;;;ADCO,IAAMC,QAAQC,OAAOC,OAAO;EACjCC,MAAMF,OAAOG,SAASH,OAAOI,MAAM;EACnCC,OAAOL,OAAOM,QAAQN,OAAOO,MAAMC,KAAKC,IAAID,KAAKE,OAAO,CAAA,CAAA;EACxDC,QAAQX,OAAOM,QAAQM,WAAAA;AACzB,CAAA,EAAGC,KACDL,KAAKM,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBC,IAAI;EAAC;CAAO,CAAA;AAKvB,IAAMC,YAAY,CAACC,QAA8C,CAAC,MACvEN,IAAIO,KAAKtB,OAAO;EACdM,OAAO,CAAA;EACPM,QAAQW;EACR,GAAGF;AACL,CAAA;AAKK,IAAMG,SAAN,cAAqBvB,OAAOwB,YAAW,EAAW,GAAGC,KAAKC,EAAE,kBAAkB;EACnFC,OAAO3B,OAAOC,OAAO;IACnBC,MAAMF,OAAOG,SAASH,OAAOI,MAAM;EACrC,CAAA;EACAwB,QAAQ5B,OAAOC,OAAO;IACpB4B,QAAQ9B;EACV,CAAA;AACF,CAAA,EAAA;AAAI;",
|
|
6
|
-
"names": ["Schema", "Obj", "Type", "LabelAnnotation", "BoardLayout", "defaultLayout", "meta", "id", "name", "description", "icon", "source", "screenshots", "Board", "Schema", "Struct", "name", "optional", "String", "items", "mutable", "Array", "Type", "Ref", "Expando", "layout", "BoardLayout", "pipe", "Obj", "typename", "version", "LabelAnnotation", "set", "makeBoard", "props", "make", "defaultLayout", "Create", "TaggedClass", "meta", "id", "input", "output", "object"]
|
|
7
|
-
}
|