@dxos/plugin-board 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/neutral/BoardContainer-HS5KHT4R.mjs +164 -0
- package/dist/lib/neutral/BoardContainer-HS5KHT4R.mjs.map +7 -0
- package/dist/lib/neutral/BoardPlugin.mjs +30 -0
- package/dist/lib/neutral/BoardPlugin.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +11 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-EFV3E7KE.mjs +19 -0
- package/dist/lib/neutral/chunk-EFV3E7KE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-XXGRE3CK.mjs +37 -0
- package/dist/lib/neutral/chunk-XXGRE3CK.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +1 -0
- package/dist/lib/neutral/containers/index.mjs +9 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-OWHPPT3P.mjs +27 -0
- package/dist/lib/neutral/create-object-OWHPPT3P.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +12 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-FZYKJHNB.mjs +26 -0
- package/dist/lib/neutral/react-surface-FZYKJHNB.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +29 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/types/index.mjs +2 -1
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/BoardPlugin.d.ts +3 -1
- package/dist/types/src/BoardPlugin.d.ts.map +1 -1
- package/dist/types/src/BoardPlugin.test.d.ts +2 -0
- package/dist/types/src/BoardPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/BoardContainer/BoardContainer.d.ts +6 -0
- package/dist/types/src/containers/BoardContainer/BoardContainer.d.ts.map +1 -0
- package/dist/types/src/containers/BoardContainer/BoardContainer.stories.d.ts +54 -0
- package/dist/types/src/containers/BoardContainer/BoardContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/BoardContainer/index.d.ts +2 -0
- package/dist/types/src/containers/BoardContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +22 -13
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Board.d.ts +26 -68
- package/dist/types/src/types/Board.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +101 -58
- package/src/BoardPlugin.test.ts +27 -0
- package/src/BoardPlugin.tsx +16 -52
- package/src/capabilities/create-object.ts +30 -0
- package/src/capabilities/index.ts +3 -3
- package/src/capabilities/react-surface.tsx +23 -14
- package/src/components/index.ts +0 -2
- package/src/containers/BoardContainer/BoardContainer.stories.tsx +122 -0
- package/src/containers/BoardContainer/BoardContainer.tsx +182 -0
- package/src/containers/BoardContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/index.ts +0 -3
- package/src/meta.ts +9 -5
- package/src/plugin.ts +9 -0
- package/src/translations.ts +12 -10
- package/src/types/Board.ts +12 -22
- package/dist/lib/browser/chunk-V67SBM4U.mjs +0 -59
- package/dist/lib/browser/chunk-V67SBM4U.mjs.map +0 -7
- package/dist/lib/browser/chunk-YYCPOFRP.mjs +0 -106
- package/dist/lib/browser/chunk-YYCPOFRP.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -91
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-6NM32ZSV.mjs +0 -33
- package/dist/lib/browser/intent-resolver-6NM32ZSV.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-PQP6ODCJ.mjs +0 -30
- package/dist/lib/browser/react-surface-PQP6ODCJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RNEIWFZQ.mjs +0 -108
- package/dist/lib/node-esm/chunk-RNEIWFZQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XCGDC6OV.mjs +0 -60
- package/dist/lib/node-esm/chunk-XCGDC6OV.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -92
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-5DQ5PPTT.mjs +0 -34
- package/dist/lib/node-esm/intent-resolver-5DQ5PPTT.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-KXSZZOEH.mjs +0 -31
- package/dist/lib/node-esm/react-surface-KXSZZOEH.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -8
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/BoardContainer.d.ts +0 -8
- package/dist/types/src/components/BoardContainer.d.ts.map +0 -1
- package/dist/types/src/components/BoardContainer.stories.d.ts +0 -44
- package/dist/types/src/components/BoardContainer.stories.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -34
- package/src/components/BoardContainer.stories.tsx +0 -122
- package/src/components/BoardContainer.tsx +0 -89
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral/components}/index.mjs.map +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import '@dxos-theme';
|
|
2
|
-
import { type StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Board } from '../types';
|
|
5
|
-
declare const meta: {
|
|
6
|
-
title: string;
|
|
7
|
-
render: () => React.JSX.Element | null;
|
|
8
|
-
parameters: {
|
|
9
|
-
translations: ({
|
|
10
|
-
readonly 'en-US': {
|
|
11
|
-
readonly [Board.Board.typename]: {
|
|
12
|
-
readonly 'typename label': "Board";
|
|
13
|
-
readonly 'typename label_zero': "Boards";
|
|
14
|
-
readonly 'typename label_one': "Board";
|
|
15
|
-
readonly 'typename label_other': "Boards";
|
|
16
|
-
readonly 'object name placeholder': "New board";
|
|
17
|
-
readonly 'rename object label': "Rename board";
|
|
18
|
-
readonly 'delete object label': "Delete board";
|
|
19
|
-
};
|
|
20
|
-
readonly [meta.id]: {
|
|
21
|
-
readonly 'plugin name': "Board";
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
} | {
|
|
25
|
-
readonly 'en-US': {
|
|
26
|
-
readonly "react-ui-stack": {
|
|
27
|
-
readonly "resize label": "Drag to resize";
|
|
28
|
-
readonly "drag handle label": "Drag to rearrange";
|
|
29
|
-
readonly "pin start label": "Pin to the left sidebar";
|
|
30
|
-
readonly "pin end label": "Pin to the right sidebar";
|
|
31
|
-
readonly "increment start label": "Move to the left";
|
|
32
|
-
readonly "increment end label": "Move to the right";
|
|
33
|
-
readonly "close label": "Close";
|
|
34
|
-
readonly "minify label": "Minify";
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
})[];
|
|
38
|
-
};
|
|
39
|
-
decorators: import("@storybook/react").Decorator[];
|
|
40
|
-
};
|
|
41
|
-
export default meta;
|
|
42
|
-
type Story = StoryObj<typeof meta>;
|
|
43
|
-
export declare const Default: Story;
|
|
44
|
-
//# sourceMappingURL=BoardContainer.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BoardContainer.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/BoardContainer.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAA8B,MAAM,OAAO,CAAC;AAkBnD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAkDjC,QAAA,MAAM,IAAI;;;;;;yBAlEqB,CAAS,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;;;;;;;;;yBAMZ,CAAQ,IAAI,CAAC,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;CAoG/D,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes, createResolver } from '@dxos/app-framework';
|
|
6
|
-
import { Obj } from '@dxos/echo';
|
|
7
|
-
|
|
8
|
-
import { Board } from '../types';
|
|
9
|
-
|
|
10
|
-
export default () => [
|
|
11
|
-
contributes(
|
|
12
|
-
Capabilities.IntentResolver,
|
|
13
|
-
createResolver({
|
|
14
|
-
intent: Board.Create,
|
|
15
|
-
resolve: ({ name }) => {
|
|
16
|
-
return {
|
|
17
|
-
data: {
|
|
18
|
-
object: Obj.make(Board.Board, {
|
|
19
|
-
name,
|
|
20
|
-
items: [],
|
|
21
|
-
layout: {
|
|
22
|
-
size: {
|
|
23
|
-
width: 5,
|
|
24
|
-
height: 5,
|
|
25
|
-
},
|
|
26
|
-
cells: {},
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
}),
|
|
33
|
-
),
|
|
34
|
-
];
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj } from '@storybook/react-vite';
|
|
8
|
-
import React, { useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import { Obj } from '@dxos/echo';
|
|
13
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
14
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
15
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
16
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
17
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
18
|
-
import { faker } from '@dxos/random';
|
|
19
|
-
import { Filter, Ref, useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
20
|
-
import { translations as stackTranslations } from '@dxos/react-ui-stack';
|
|
21
|
-
import { defaultTx } from '@dxos/react-ui-theme';
|
|
22
|
-
import { DataType } from '@dxos/schema';
|
|
23
|
-
import { withLayout } from '@dxos/storybook-utils';
|
|
24
|
-
|
|
25
|
-
import { translations } from '../translations';
|
|
26
|
-
import { Board } from '../types';
|
|
27
|
-
|
|
28
|
-
import { BoardContainer } from './BoardContainer';
|
|
29
|
-
|
|
30
|
-
faker.seed(0);
|
|
31
|
-
|
|
32
|
-
const createBoard = () =>
|
|
33
|
-
Obj.make(Board.Board, {
|
|
34
|
-
name: 'Test Board',
|
|
35
|
-
items: [],
|
|
36
|
-
layout: {
|
|
37
|
-
size: { width: 7, height: 5 },
|
|
38
|
-
cells: {},
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const createOrg = () =>
|
|
43
|
-
Obj.make(DataType.Organization, {
|
|
44
|
-
name: faker.commerce.productName(),
|
|
45
|
-
description: faker.lorem.paragraph(),
|
|
46
|
-
image: faker.image.url(),
|
|
47
|
-
website: faker.internet.url(),
|
|
48
|
-
// TODO(burdon): Fix.
|
|
49
|
-
// status: faker.helpers.arrayElement(DataType.OrganizationStatusOptions).id,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const DefaultStory = () => {
|
|
53
|
-
const spaces = useSpaces();
|
|
54
|
-
const space = spaces[spaces.length - 1];
|
|
55
|
-
const boards = useQuery(space, Filter.type(Board.Board));
|
|
56
|
-
const [board, setBoard] = useState<Board.Board>();
|
|
57
|
-
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (boards.length && !board) {
|
|
60
|
-
const board = boards[0];
|
|
61
|
-
setBoard(board);
|
|
62
|
-
}
|
|
63
|
-
}, [boards]);
|
|
64
|
-
|
|
65
|
-
if (!board) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return <BoardContainer role='board' board={board} />;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
//
|
|
73
|
-
// Story definitions
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
const meta = {
|
|
77
|
-
title: 'plugins/plugin-board/Board',
|
|
78
|
-
render: DefaultStory,
|
|
79
|
-
parameters: { translations: [...translations, ...stackTranslations] },
|
|
80
|
-
decorators: [
|
|
81
|
-
withLayout({ fullscreen: true }),
|
|
82
|
-
withPluginManager({
|
|
83
|
-
plugins: [
|
|
84
|
-
ThemePlugin({ tx: defaultTx }),
|
|
85
|
-
ClientPlugin({
|
|
86
|
-
types: [DataType.Organization, DataType.Person, Board.Board],
|
|
87
|
-
onClientInitialized: async ({ client }) => {
|
|
88
|
-
await client.halo.createIdentity();
|
|
89
|
-
const space = await client.spaces.create();
|
|
90
|
-
await space.waitUntilReady();
|
|
91
|
-
const board = space.db.add(createBoard());
|
|
92
|
-
|
|
93
|
-
// Add some sample items
|
|
94
|
-
Array.from({ length: 10 }).map(() => {
|
|
95
|
-
const org = createOrg();
|
|
96
|
-
space.db.add(org);
|
|
97
|
-
board.items.push(Ref.make(org));
|
|
98
|
-
board.layout.cells[org.id] = {
|
|
99
|
-
x: Math.floor(Math.random() * 5) - 2,
|
|
100
|
-
y: Math.floor(Math.random() * 5) - 2,
|
|
101
|
-
width: 1,
|
|
102
|
-
height: 1,
|
|
103
|
-
};
|
|
104
|
-
return org;
|
|
105
|
-
});
|
|
106
|
-
},
|
|
107
|
-
}),
|
|
108
|
-
StorybookLayoutPlugin(),
|
|
109
|
-
PreviewPlugin(),
|
|
110
|
-
SpacePlugin(),
|
|
111
|
-
IntentPlugin(),
|
|
112
|
-
SettingsPlugin(),
|
|
113
|
-
],
|
|
114
|
-
}),
|
|
115
|
-
],
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export default meta;
|
|
119
|
-
|
|
120
|
-
type Story = StoryObj<typeof meta>;
|
|
121
|
-
|
|
122
|
-
export const Default: Story = {};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useRef } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Surface, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
-
import { getSpace } from '@dxos/client/echo';
|
|
9
|
-
import { type Obj, Ref } from '@dxos/echo';
|
|
10
|
-
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
12
|
-
import { useSignalsMemo } from '@dxos/react-ui';
|
|
13
|
-
import { Board, type BoardController, type BoardRootProps } from '@dxos/react-ui-board';
|
|
14
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
15
|
-
import { isNonNullable } from '@dxos/util';
|
|
16
|
-
|
|
17
|
-
import { type Board as BoardType } from '../types';
|
|
18
|
-
|
|
19
|
-
export type BoardContainerProps = {
|
|
20
|
-
role?: string;
|
|
21
|
-
board: BoardType.Board;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const BoardContainer = ({ board }: BoardContainerProps) => {
|
|
25
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
26
|
-
const controller = useRef<BoardController>(null);
|
|
27
|
-
const items = useSignalsMemo(() => board.items.map((ref) => ref.target).filter(isNonNullable), [board]);
|
|
28
|
-
|
|
29
|
-
const handleAdd = useCallback<NonNullable<BoardRootProps['onAdd']>>(
|
|
30
|
-
async (position = { x: 0, y: 0 }) => {
|
|
31
|
-
const space = getSpace(board);
|
|
32
|
-
invariant(space);
|
|
33
|
-
await dispatch(
|
|
34
|
-
createIntent(SpaceAction.OpenCreateObject, {
|
|
35
|
-
target: space,
|
|
36
|
-
navigable: false,
|
|
37
|
-
onCreateObject: (object: Obj.Any) => {
|
|
38
|
-
board.items.push(Ref.make(object));
|
|
39
|
-
console.log(board.items.length);
|
|
40
|
-
board.layout.cells[object.id] = { ...position, width: 1, height: 1 };
|
|
41
|
-
controller.current?.center(position);
|
|
42
|
-
},
|
|
43
|
-
}),
|
|
44
|
-
);
|
|
45
|
-
},
|
|
46
|
-
[board, controller, dispatch],
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
// TODO(burdon): Use intents so can be undone.
|
|
50
|
-
const handleDelete = useCallback<NonNullable<BoardRootProps['onDelete']>>(
|
|
51
|
-
(id) => {
|
|
52
|
-
// TODO(burdon): Impl. DXN.equals and pass in DXN from `id`.
|
|
53
|
-
const idx = board.items.findIndex((ref) => ref.dxn.asEchoDXN()?.echoId === id);
|
|
54
|
-
if (idx !== -1) {
|
|
55
|
-
board.items.splice(idx, 1);
|
|
56
|
-
}
|
|
57
|
-
delete board.layout.cells[id];
|
|
58
|
-
},
|
|
59
|
-
[board],
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const handleMove = useCallback<NonNullable<BoardRootProps['onMove']>>(
|
|
63
|
-
(id, position) => {
|
|
64
|
-
const layout = board.layout.cells[id];
|
|
65
|
-
board.layout.cells[id] = { ...layout, ...position };
|
|
66
|
-
},
|
|
67
|
-
[board],
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<Board.Root ref={controller} layout={board.layout} onAdd={handleAdd} onDelete={handleDelete} onMove={handleMove}>
|
|
72
|
-
<StackItem.Content toolbar classNames='overflow-hidden'>
|
|
73
|
-
<Board.Toolbar />
|
|
74
|
-
<Board.Container>
|
|
75
|
-
<Board.Viewport classNames='border-none'>
|
|
76
|
-
<Board.Backdrop />
|
|
77
|
-
<Board.Content>
|
|
78
|
-
{items?.map((item, index) => (
|
|
79
|
-
<Board.Cell item={item} key={index} layout={board.layout?.cells[item.id] ?? { x: 0, y: 0 }}>
|
|
80
|
-
<Surface role='card--extrinsic' data={{ subject: item }} limit={1} />
|
|
81
|
-
</Board.Cell>
|
|
82
|
-
))}
|
|
83
|
-
</Board.Content>
|
|
84
|
-
</Board.Viewport>
|
|
85
|
-
</Board.Container>
|
|
86
|
-
</StackItem.Content>
|
|
87
|
-
</Board.Root>
|
|
88
|
-
);
|
|
89
|
-
};
|
|
File without changes
|
|
File without changes
|