@dxos/plugin-board 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe
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 → chunk-FL67SBF5.mjs} +9 -6
- package/dist/lib/browser/chunk-FL67SBF5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +60 -36
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/{chunk-VU2JDWBB.mjs → chunk-5GGKJL4Z.mjs} +9 -6
- package/dist/lib/node-esm/chunk-5GGKJL4Z.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +60 -36
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/BoardPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- 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 +47 -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 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +12 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Board.d.ts +7 -7
- package/dist/types/src/types/Board.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +50 -42
- package/src/BoardPlugin.tsx +26 -12
- package/src/capabilities/index.ts +3 -1
- package/src/capabilities/react-surface.tsx +29 -0
- package/src/components/index.ts +0 -2
- package/src/{components → containers/BoardContainer}/BoardContainer.stories.tsx +18 -17
- package/src/{components → containers/BoardContainer}/BoardContainer.tsx +36 -30
- package/src/containers/BoardContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/index.ts +0 -1
- package/src/meta.ts +1 -1
- package/src/translations.ts +12 -11
- package/src/types/Board.ts +8 -4
- package/dist/lib/browser/chunk-LBLHKX5C.mjs.map +0 -7
- package/dist/lib/browser/chunk-RYF2DAG7.mjs +0 -157
- package/dist/lib/browser/chunk-RYF2DAG7.mjs.map +0 -7
- package/dist/lib/browser/react-surface-E72KQ3A6.mjs +0 -31
- package/dist/lib/browser/react-surface-E72KQ3A6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UK23JIUK.mjs +0 -159
- package/dist/lib/node-esm/chunk-UK23JIUK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VU2JDWBB.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-6OXJH5X5.mjs +0 -32
- package/dist/lib/node-esm/react-surface-6OXJH5X5.mjs.map +0 -7
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/BoardContainer.d.ts +0 -6
- package/dist/types/src/components/BoardContainer.d.ts.map +0 -1
- package/dist/types/src/components/BoardContainer.stories.d.ts +0 -45
- package/dist/types/src/components/BoardContainer.stories.d.ts.map +0 -1
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -26
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
// src/components/BoardContainer.tsx
|
|
2
|
-
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { Surface } from "@dxos/app-framework/react";
|
|
4
|
-
import { Filter, Obj, Ref } from "@dxos/echo";
|
|
5
|
-
import { useObject, useObjects } from "@dxos/echo-react";
|
|
6
|
-
import { invariant } from "@dxos/invariant";
|
|
7
|
-
import { useQuery } from "@dxos/react-client/echo";
|
|
8
|
-
import { useAttention } from "@dxos/react-ui-attention";
|
|
9
|
-
import { Board } from "@dxos/react-ui-board";
|
|
10
|
-
import { ObjectPicker } from "@dxos/react-ui-form";
|
|
11
|
-
import { Layout } from "@dxos/react-ui-mosaic";
|
|
12
|
-
import { isNonNullable } from "@dxos/util";
|
|
13
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-board/src/components/BoardContainer.tsx";
|
|
14
|
-
var DEFAULT_POSITION = {
|
|
15
|
-
x: 0,
|
|
16
|
-
y: 0
|
|
17
|
-
};
|
|
18
|
-
var BoardContainer = ({ role, subject: board }) => {
|
|
19
|
-
const controller = useRef(null);
|
|
20
|
-
const [boardItems] = useObject(board, "items");
|
|
21
|
-
const items = useObjects(boardItems ?? []);
|
|
22
|
-
const addTriggerRef = useRef(null);
|
|
23
|
-
const [pickerState, setPickerState] = useState(null);
|
|
24
|
-
const attendableId = Obj.getDXN(board).toString();
|
|
25
|
-
const { hasAttention } = useAttention(attendableId);
|
|
26
|
-
const db = Obj.getDatabase(board);
|
|
27
|
-
const objects = useQuery(db, Filter.everything());
|
|
28
|
-
const options = useMemo(() => objects.filter((obj) => obj.id !== board.id).map((obj) => {
|
|
29
|
-
const label = Obj.getLabel(obj);
|
|
30
|
-
if (label) {
|
|
31
|
-
return {
|
|
32
|
-
id: obj.id,
|
|
33
|
-
label,
|
|
34
|
-
hue: "neutral"
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}).filter(isNonNullable).sort(({ label: a }, { label: b }) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase())), [
|
|
38
|
-
objects
|
|
39
|
-
]);
|
|
40
|
-
const handleAdd = useCallback(async (anchor, position = DEFAULT_POSITION) => {
|
|
41
|
-
const db2 = Obj.getDatabase(board);
|
|
42
|
-
invariant(db2, void 0, {
|
|
43
|
-
F: __dxlog_file,
|
|
44
|
-
L: 62,
|
|
45
|
-
S: void 0,
|
|
46
|
-
A: [
|
|
47
|
-
"db",
|
|
48
|
-
""
|
|
49
|
-
]
|
|
50
|
-
});
|
|
51
|
-
addTriggerRef.current = anchor;
|
|
52
|
-
setPickerState({
|
|
53
|
-
position
|
|
54
|
-
});
|
|
55
|
-
}, [
|
|
56
|
-
board
|
|
57
|
-
]);
|
|
58
|
-
const handleDelete = useCallback((id) => {
|
|
59
|
-
const idx = board.items.findIndex((ref) => ref.dxn.asEchoDXN()?.echoId === id);
|
|
60
|
-
Obj.change(board, (b) => {
|
|
61
|
-
if (idx !== -1) {
|
|
62
|
-
b.items.splice(idx, 1);
|
|
63
|
-
}
|
|
64
|
-
delete b.layout.cells[id];
|
|
65
|
-
});
|
|
66
|
-
}, [
|
|
67
|
-
board
|
|
68
|
-
]);
|
|
69
|
-
const handleMove = useCallback((id, position) => {
|
|
70
|
-
const layout = board.layout.cells[id];
|
|
71
|
-
Obj.change(board, (b) => {
|
|
72
|
-
b.layout.cells[id] = {
|
|
73
|
-
...layout,
|
|
74
|
-
...position
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
}, [
|
|
78
|
-
board
|
|
79
|
-
]);
|
|
80
|
-
const handleSelect = useCallback((id) => {
|
|
81
|
-
if (!pickerState) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const selectedObject = objects.find((obj) => obj.id === id);
|
|
85
|
-
if (!Obj.isObject(selectedObject)) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
board.items.push(Ref.make(selectedObject));
|
|
89
|
-
board.layout.cells[selectedObject.id.toString()] = pickerState.position;
|
|
90
|
-
setPickerState(null);
|
|
91
|
-
}, [
|
|
92
|
-
pickerState,
|
|
93
|
-
objects,
|
|
94
|
-
board
|
|
95
|
-
]);
|
|
96
|
-
return /* @__PURE__ */ React.createElement(Board.Root, {
|
|
97
|
-
ref: controller,
|
|
98
|
-
layout: board.layout,
|
|
99
|
-
onAdd: handleAdd,
|
|
100
|
-
onDelete: handleDelete,
|
|
101
|
-
onMove: handleMove
|
|
102
|
-
}, /* @__PURE__ */ React.createElement(ObjectPicker.Root, {
|
|
103
|
-
open: !!pickerState,
|
|
104
|
-
onOpenChange: (nextOpen) => {
|
|
105
|
-
setPickerState(nextOpen ? {
|
|
106
|
-
position: DEFAULT_POSITION
|
|
107
|
-
} : null);
|
|
108
|
-
}
|
|
109
|
-
}, /* @__PURE__ */ React.createElement(Layout.Main, {
|
|
110
|
-
role,
|
|
111
|
-
toolbar: true
|
|
112
|
-
}, /* @__PURE__ */ React.createElement(Board.Toolbar, {
|
|
113
|
-
disabled: !hasAttention
|
|
114
|
-
}), /* @__PURE__ */ React.createElement(Board.Container, null, /* @__PURE__ */ React.createElement(Board.Viewport, {
|
|
115
|
-
classNames: "border-none"
|
|
116
|
-
}, /* @__PURE__ */ React.createElement(Board.Backdrop, null), /* @__PURE__ */ React.createElement(Board.Content, null, items?.map((item, index) => /* @__PURE__ */ React.createElement(Board.Cell, {
|
|
117
|
-
item,
|
|
118
|
-
key: index,
|
|
119
|
-
layout: board.layout?.cells[item.id] ?? {
|
|
120
|
-
x: 0,
|
|
121
|
-
y: 0
|
|
122
|
-
}
|
|
123
|
-
}, /* @__PURE__ */ React.createElement(Surface, {
|
|
124
|
-
role: "card--content",
|
|
125
|
-
data: {
|
|
126
|
-
subject: item
|
|
127
|
-
},
|
|
128
|
-
limit: 1
|
|
129
|
-
}))))))), /* @__PURE__ */ React.createElement(ObjectPicker.Content, {
|
|
130
|
-
options,
|
|
131
|
-
onSelect: handleSelect,
|
|
132
|
-
classNames: "popover-card-width"
|
|
133
|
-
}), /* @__PURE__ */ React.createElement(ObjectPicker.VirtualTrigger, {
|
|
134
|
-
virtualRef: addTriggerRef
|
|
135
|
-
})));
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// src/meta.ts
|
|
139
|
-
import { trim } from "@dxos/util";
|
|
140
|
-
var meta = {
|
|
141
|
-
id: "dxos.org/plugin/board",
|
|
142
|
-
name: "Board",
|
|
143
|
-
description: trim`
|
|
144
|
-
Infinite canvas workspace that combines sticky notes, media, and whiteboarding tools.
|
|
145
|
-
Arrange and connect ideas freely in a visual space perfect for brainstorming and creative collaboration.
|
|
146
|
-
`,
|
|
147
|
-
icon: "ph--squares-four--regular",
|
|
148
|
-
iconHue: "green",
|
|
149
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-board",
|
|
150
|
-
screenshots: []
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export {
|
|
154
|
-
BoardContainer,
|
|
155
|
-
meta
|
|
156
|
-
};
|
|
157
|
-
//# sourceMappingURL=chunk-RYF2DAG7.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/BoardContainer.tsx", "../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\n\nimport { Surface, type SurfaceComponentProps } from '@dxos/app-framework/react';\nimport { Filter, Obj, Ref } from '@dxos/echo';\nimport { useObject, useObjects } from '@dxos/echo-react';\nimport { invariant } from '@dxos/invariant';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { useAttention } from '@dxos/react-ui-attention';\nimport { Board, type BoardController, type BoardRootProps, type Position } from '@dxos/react-ui-board';\nimport { ObjectPicker, type ObjectPickerContentProps } from '@dxos/react-ui-form';\nimport { Layout } from '@dxos/react-ui-mosaic';\nimport { isNonNullable } from '@dxos/util';\n\nimport { type Board as BoardType } from '../types';\n\nconst DEFAULT_POSITION = { x: 0, y: 0 } satisfies Position;\n\ntype PickerState = {\n position: Position;\n};\n\nexport type BoardContainerProps = SurfaceComponentProps<BoardType.Board>;\n\nexport const BoardContainer = ({ role, subject: board }: BoardContainerProps) => {\n const controller = useRef<BoardController>(null);\n const [boardItems] = useObject(board, 'items');\n const items = useObjects(boardItems ?? []);\n const addTriggerRef = useRef<HTMLButtonElement | null>(null);\n const [pickerState, setPickerState] = useState<PickerState | null>(null);\n const attendableId = Obj.getDXN(board).toString();\n const { hasAttention } = useAttention(attendableId);\n\n const db = Obj.getDatabase(board);\n // TODO(burdon): Use search.\n const objects = useQuery(db, Filter.everything());\n const options = useMemo<ObjectPickerContentProps['options']>(\n () =>\n objects\n .filter((obj) => obj.id !== board.id)\n .map((obj) => {\n const label = Obj.getLabel(obj);\n if (label) {\n return {\n id: obj.id,\n label,\n hue: 'neutral' as const,\n };\n }\n })\n .filter(isNonNullable)\n .sort(({ label: a }, { label: b }) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase())),\n [objects],\n );\n\n const handleAdd = useCallback<NonNullable<BoardRootProps['onAdd']>>(\n async (anchor, position = DEFAULT_POSITION) => {\n const db = Obj.getDatabase(board);\n invariant(db);\n addTriggerRef.current = anchor;\n setPickerState({\n position,\n });\n },\n [board],\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 Obj.change(board, (b) => {\n if (idx !== -1) {\n b.items.splice(idx, 1);\n }\n delete b.layout.cells[id];\n });\n },\n [board],\n );\n\n const handleMove = useCallback<NonNullable<BoardRootProps['onMove']>>(\n (id, position) => {\n const layout = board.layout.cells[id];\n Obj.change(board, (b) => {\n b.layout.cells[id] = { ...layout, ...position };\n });\n },\n [board],\n );\n\n const handleSelect = useCallback<NonNullable<ObjectPickerContentProps['onSelect']>>(\n (id) => {\n if (!pickerState) {\n return;\n }\n\n // Find the selected object by id from the space.\n const selectedObject = objects.find((obj) => obj.id === id);\n if (!Obj.isObject(selectedObject)) {\n return;\n }\n\n // Create a reference to the selected object and add it to the board.\n board.items.push(Ref.make(selectedObject));\n\n // Set the layout position for the new item.\n board.layout.cells[selectedObject.id.toString()] = pickerState.position;\n\n // Close the picker.\n setPickerState(null);\n },\n [pickerState, objects, board],\n );\n\n return (\n <Board.Root ref={controller} layout={board.layout} onAdd={handleAdd} onDelete={handleDelete} onMove={handleMove}>\n <ObjectPicker.Root\n open={!!pickerState}\n onOpenChange={(nextOpen: boolean) => {\n setPickerState(nextOpen ? { position: DEFAULT_POSITION } : null);\n }}\n >\n <Layout.Main role={role} toolbar>\n <Board.Toolbar disabled={!hasAttention} />\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--content' data={{ subject: item }} limit={1} />\n </Board.Cell>\n ))}\n </Board.Content>\n </Board.Viewport>\n </Board.Container>\n </Layout.Main>\n <ObjectPicker.Content options={options} onSelect={handleSelect} classNames='popover-card-width' />\n <ObjectPicker.VirtualTrigger virtualRef={addTriggerRef} />\n </ObjectPicker.Root>\n </Board.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\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://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ACf;",
|
|
6
|
-
"names": ["React", "useCallback", "useMemo", "useRef", "useState", "Surface", "Filter", "Obj", "Ref", "useObject", "useObjects", "invariant", "useQuery", "useAttention", "Board", "ObjectPicker", "Layout", "isNonNullable", "DEFAULT_POSITION", "x", "y", "BoardContainer", "role", "subject", "board", "controller", "boardItems", "items", "addTriggerRef", "pickerState", "setPickerState", "attendableId", "getDXN", "toString", "hasAttention", "db", "getDatabase", "objects", "everything", "options", "filter", "obj", "id", "map", "label", "getLabel", "hue", "sort", "a", "b", "toLocaleLowerCase", "localeCompare", "handleAdd", "anchor", "position", "current", "handleDelete", "idx", "findIndex", "ref", "dxn", "asEchoDXN", "echoId", "change", "splice", "layout", "cells", "handleMove", "handleSelect", "selectedObject", "find", "isObject", "push", "make", "Root", "onAdd", "onDelete", "onMove", "open", "onOpenChange", "nextOpen", "Main", "toolbar", "Toolbar", "disabled", "Container", "Viewport", "classNames", "Backdrop", "Content", "item", "index", "Cell", "key", "data", "limit", "onSelect", "VirtualTrigger", "virtualRef", "trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "screenshots"]
|
|
7
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BoardContainer,
|
|
3
|
-
meta
|
|
4
|
-
} from "./chunk-RYF2DAG7.mjs";
|
|
5
|
-
import {
|
|
6
|
-
Board_exports
|
|
7
|
-
} from "./chunk-LBLHKX5C.mjs";
|
|
8
|
-
|
|
9
|
-
// src/capabilities/react-surface/react-surface.tsx
|
|
10
|
-
import * as Effect from "effect/Effect";
|
|
11
|
-
import React from "react";
|
|
12
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
13
|
-
import { Obj } from "@dxos/echo";
|
|
14
|
-
var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Common.Capability.ReactSurface, [
|
|
15
|
-
Common.createSurface({
|
|
16
|
-
id: meta.id,
|
|
17
|
-
role: [
|
|
18
|
-
"article",
|
|
19
|
-
"section"
|
|
20
|
-
],
|
|
21
|
-
filter: (data) => Obj.instanceOf(Board_exports.Board, data.subject),
|
|
22
|
-
component: ({ role, data }) => /* @__PURE__ */ React.createElement(BoardContainer, {
|
|
23
|
-
role,
|
|
24
|
-
subject: data.subject
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
])));
|
|
28
|
-
export {
|
|
29
|
-
react_surface_default as default
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=react-surface-E72KQ3A6.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface/react-surface.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React from 'react';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\n\nimport { BoardContainer } from '../../components';\nimport { meta } from '../../meta';\nimport { Board } from '../../types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Common.Capability.ReactSurface, [\n Common.createSurface({\n id: meta.id,\n role: ['article', 'section'],\n filter: (data): data is { subject: Board.Board } => Obj.instanceOf(Board.Board, data.subject),\n component: ({ role, data }) => <BoardContainer role={role} subject={data.subject} />,\n }),\n ]),\n ),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,WAAW;AAElB,SAASC,YAAYC,cAAc;AACnC,SAASC,WAAW;AAMpB,IAAA,wBAAeC,WAAWC,WAAW,MAC5BC,eACLF,WAAWG,YAAYC,OAAOJ,WAAWK,cAAc;EACrDD,OAAOE,cAAc;IACnBC,IAAIC,KAAKD;IACTE,MAAM;MAAC;MAAW;;IAClBC,QAAQ,CAACC,SAA2CC,IAAIC,WAAWC,cAAMA,OAAOH,KAAKI,OAAO;IAC5FC,WAAW,CAAC,EAAEP,MAAME,KAAI,MAAO,sBAAA,cAACM,gBAAAA;MAAeR;MAAYM,SAASJ,KAAKI;;EAC3E,CAAA;CACD,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "React", "Capability", "Common", "Obj", "Capability", "makeModule", "succeed", "contributes", "Common", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Board", "subject", "component", "BoardContainer"]
|
|
7
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
// src/components/BoardContainer.tsx
|
|
4
|
-
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
5
|
-
import { Surface } from "@dxos/app-framework/react";
|
|
6
|
-
import { Filter, Obj, Ref } from "@dxos/echo";
|
|
7
|
-
import { useObject, useObjects } from "@dxos/echo-react";
|
|
8
|
-
import { invariant } from "@dxos/invariant";
|
|
9
|
-
import { useQuery } from "@dxos/react-client/echo";
|
|
10
|
-
import { useAttention } from "@dxos/react-ui-attention";
|
|
11
|
-
import { Board } from "@dxos/react-ui-board";
|
|
12
|
-
import { ObjectPicker } from "@dxos/react-ui-form";
|
|
13
|
-
import { Layout } from "@dxos/react-ui-mosaic";
|
|
14
|
-
import { isNonNullable } from "@dxos/util";
|
|
15
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-board/src/components/BoardContainer.tsx";
|
|
16
|
-
var DEFAULT_POSITION = {
|
|
17
|
-
x: 0,
|
|
18
|
-
y: 0
|
|
19
|
-
};
|
|
20
|
-
var BoardContainer = ({ role, subject: board }) => {
|
|
21
|
-
const controller = useRef(null);
|
|
22
|
-
const [boardItems] = useObject(board, "items");
|
|
23
|
-
const items = useObjects(boardItems ?? []);
|
|
24
|
-
const addTriggerRef = useRef(null);
|
|
25
|
-
const [pickerState, setPickerState] = useState(null);
|
|
26
|
-
const attendableId = Obj.getDXN(board).toString();
|
|
27
|
-
const { hasAttention } = useAttention(attendableId);
|
|
28
|
-
const db = Obj.getDatabase(board);
|
|
29
|
-
const objects = useQuery(db, Filter.everything());
|
|
30
|
-
const options = useMemo(() => objects.filter((obj) => obj.id !== board.id).map((obj) => {
|
|
31
|
-
const label = Obj.getLabel(obj);
|
|
32
|
-
if (label) {
|
|
33
|
-
return {
|
|
34
|
-
id: obj.id,
|
|
35
|
-
label,
|
|
36
|
-
hue: "neutral"
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}).filter(isNonNullable).sort(({ label: a }, { label: b }) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase())), [
|
|
40
|
-
objects
|
|
41
|
-
]);
|
|
42
|
-
const handleAdd = useCallback(async (anchor, position = DEFAULT_POSITION) => {
|
|
43
|
-
const db2 = Obj.getDatabase(board);
|
|
44
|
-
invariant(db2, void 0, {
|
|
45
|
-
F: __dxlog_file,
|
|
46
|
-
L: 62,
|
|
47
|
-
S: void 0,
|
|
48
|
-
A: [
|
|
49
|
-
"db",
|
|
50
|
-
""
|
|
51
|
-
]
|
|
52
|
-
});
|
|
53
|
-
addTriggerRef.current = anchor;
|
|
54
|
-
setPickerState({
|
|
55
|
-
position
|
|
56
|
-
});
|
|
57
|
-
}, [
|
|
58
|
-
board
|
|
59
|
-
]);
|
|
60
|
-
const handleDelete = useCallback((id) => {
|
|
61
|
-
const idx = board.items.findIndex((ref) => ref.dxn.asEchoDXN()?.echoId === id);
|
|
62
|
-
Obj.change(board, (b) => {
|
|
63
|
-
if (idx !== -1) {
|
|
64
|
-
b.items.splice(idx, 1);
|
|
65
|
-
}
|
|
66
|
-
delete b.layout.cells[id];
|
|
67
|
-
});
|
|
68
|
-
}, [
|
|
69
|
-
board
|
|
70
|
-
]);
|
|
71
|
-
const handleMove = useCallback((id, position) => {
|
|
72
|
-
const layout = board.layout.cells[id];
|
|
73
|
-
Obj.change(board, (b) => {
|
|
74
|
-
b.layout.cells[id] = {
|
|
75
|
-
...layout,
|
|
76
|
-
...position
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
}, [
|
|
80
|
-
board
|
|
81
|
-
]);
|
|
82
|
-
const handleSelect = useCallback((id) => {
|
|
83
|
-
if (!pickerState) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const selectedObject = objects.find((obj) => obj.id === id);
|
|
87
|
-
if (!Obj.isObject(selectedObject)) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
board.items.push(Ref.make(selectedObject));
|
|
91
|
-
board.layout.cells[selectedObject.id.toString()] = pickerState.position;
|
|
92
|
-
setPickerState(null);
|
|
93
|
-
}, [
|
|
94
|
-
pickerState,
|
|
95
|
-
objects,
|
|
96
|
-
board
|
|
97
|
-
]);
|
|
98
|
-
return /* @__PURE__ */ React.createElement(Board.Root, {
|
|
99
|
-
ref: controller,
|
|
100
|
-
layout: board.layout,
|
|
101
|
-
onAdd: handleAdd,
|
|
102
|
-
onDelete: handleDelete,
|
|
103
|
-
onMove: handleMove
|
|
104
|
-
}, /* @__PURE__ */ React.createElement(ObjectPicker.Root, {
|
|
105
|
-
open: !!pickerState,
|
|
106
|
-
onOpenChange: (nextOpen) => {
|
|
107
|
-
setPickerState(nextOpen ? {
|
|
108
|
-
position: DEFAULT_POSITION
|
|
109
|
-
} : null);
|
|
110
|
-
}
|
|
111
|
-
}, /* @__PURE__ */ React.createElement(Layout.Main, {
|
|
112
|
-
role,
|
|
113
|
-
toolbar: true
|
|
114
|
-
}, /* @__PURE__ */ React.createElement(Board.Toolbar, {
|
|
115
|
-
disabled: !hasAttention
|
|
116
|
-
}), /* @__PURE__ */ React.createElement(Board.Container, null, /* @__PURE__ */ React.createElement(Board.Viewport, {
|
|
117
|
-
classNames: "border-none"
|
|
118
|
-
}, /* @__PURE__ */ React.createElement(Board.Backdrop, null), /* @__PURE__ */ React.createElement(Board.Content, null, items?.map((item, index) => /* @__PURE__ */ React.createElement(Board.Cell, {
|
|
119
|
-
item,
|
|
120
|
-
key: index,
|
|
121
|
-
layout: board.layout?.cells[item.id] ?? {
|
|
122
|
-
x: 0,
|
|
123
|
-
y: 0
|
|
124
|
-
}
|
|
125
|
-
}, /* @__PURE__ */ React.createElement(Surface, {
|
|
126
|
-
role: "card--content",
|
|
127
|
-
data: {
|
|
128
|
-
subject: item
|
|
129
|
-
},
|
|
130
|
-
limit: 1
|
|
131
|
-
}))))))), /* @__PURE__ */ React.createElement(ObjectPicker.Content, {
|
|
132
|
-
options,
|
|
133
|
-
onSelect: handleSelect,
|
|
134
|
-
classNames: "popover-card-width"
|
|
135
|
-
}), /* @__PURE__ */ React.createElement(ObjectPicker.VirtualTrigger, {
|
|
136
|
-
virtualRef: addTriggerRef
|
|
137
|
-
})));
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
// src/meta.ts
|
|
141
|
-
import { trim } from "@dxos/util";
|
|
142
|
-
var meta = {
|
|
143
|
-
id: "dxos.org/plugin/board",
|
|
144
|
-
name: "Board",
|
|
145
|
-
description: trim`
|
|
146
|
-
Infinite canvas workspace that combines sticky notes, media, and whiteboarding tools.
|
|
147
|
-
Arrange and connect ideas freely in a visual space perfect for brainstorming and creative collaboration.
|
|
148
|
-
`,
|
|
149
|
-
icon: "ph--squares-four--regular",
|
|
150
|
-
iconHue: "green",
|
|
151
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-board",
|
|
152
|
-
screenshots: []
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export {
|
|
156
|
-
BoardContainer,
|
|
157
|
-
meta
|
|
158
|
-
};
|
|
159
|
-
//# sourceMappingURL=chunk-UK23JIUK.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/BoardContainer.tsx", "../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\n\nimport { Surface, type SurfaceComponentProps } from '@dxos/app-framework/react';\nimport { Filter, Obj, Ref } from '@dxos/echo';\nimport { useObject, useObjects } from '@dxos/echo-react';\nimport { invariant } from '@dxos/invariant';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { useAttention } from '@dxos/react-ui-attention';\nimport { Board, type BoardController, type BoardRootProps, type Position } from '@dxos/react-ui-board';\nimport { ObjectPicker, type ObjectPickerContentProps } from '@dxos/react-ui-form';\nimport { Layout } from '@dxos/react-ui-mosaic';\nimport { isNonNullable } from '@dxos/util';\n\nimport { type Board as BoardType } from '../types';\n\nconst DEFAULT_POSITION = { x: 0, y: 0 } satisfies Position;\n\ntype PickerState = {\n position: Position;\n};\n\nexport type BoardContainerProps = SurfaceComponentProps<BoardType.Board>;\n\nexport const BoardContainer = ({ role, subject: board }: BoardContainerProps) => {\n const controller = useRef<BoardController>(null);\n const [boardItems] = useObject(board, 'items');\n const items = useObjects(boardItems ?? []);\n const addTriggerRef = useRef<HTMLButtonElement | null>(null);\n const [pickerState, setPickerState] = useState<PickerState | null>(null);\n const attendableId = Obj.getDXN(board).toString();\n const { hasAttention } = useAttention(attendableId);\n\n const db = Obj.getDatabase(board);\n // TODO(burdon): Use search.\n const objects = useQuery(db, Filter.everything());\n const options = useMemo<ObjectPickerContentProps['options']>(\n () =>\n objects\n .filter((obj) => obj.id !== board.id)\n .map((obj) => {\n const label = Obj.getLabel(obj);\n if (label) {\n return {\n id: obj.id,\n label,\n hue: 'neutral' as const,\n };\n }\n })\n .filter(isNonNullable)\n .sort(({ label: a }, { label: b }) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase())),\n [objects],\n );\n\n const handleAdd = useCallback<NonNullable<BoardRootProps['onAdd']>>(\n async (anchor, position = DEFAULT_POSITION) => {\n const db = Obj.getDatabase(board);\n invariant(db);\n addTriggerRef.current = anchor;\n setPickerState({\n position,\n });\n },\n [board],\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 Obj.change(board, (b) => {\n if (idx !== -1) {\n b.items.splice(idx, 1);\n }\n delete b.layout.cells[id];\n });\n },\n [board],\n );\n\n const handleMove = useCallback<NonNullable<BoardRootProps['onMove']>>(\n (id, position) => {\n const layout = board.layout.cells[id];\n Obj.change(board, (b) => {\n b.layout.cells[id] = { ...layout, ...position };\n });\n },\n [board],\n );\n\n const handleSelect = useCallback<NonNullable<ObjectPickerContentProps['onSelect']>>(\n (id) => {\n if (!pickerState) {\n return;\n }\n\n // Find the selected object by id from the space.\n const selectedObject = objects.find((obj) => obj.id === id);\n if (!Obj.isObject(selectedObject)) {\n return;\n }\n\n // Create a reference to the selected object and add it to the board.\n board.items.push(Ref.make(selectedObject));\n\n // Set the layout position for the new item.\n board.layout.cells[selectedObject.id.toString()] = pickerState.position;\n\n // Close the picker.\n setPickerState(null);\n },\n [pickerState, objects, board],\n );\n\n return (\n <Board.Root ref={controller} layout={board.layout} onAdd={handleAdd} onDelete={handleDelete} onMove={handleMove}>\n <ObjectPicker.Root\n open={!!pickerState}\n onOpenChange={(nextOpen: boolean) => {\n setPickerState(nextOpen ? { position: DEFAULT_POSITION } : null);\n }}\n >\n <Layout.Main role={role} toolbar>\n <Board.Toolbar disabled={!hasAttention} />\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--content' data={{ subject: item }} limit={1} />\n </Board.Cell>\n ))}\n </Board.Content>\n </Board.Viewport>\n </Board.Container>\n </Layout.Main>\n <ObjectPicker.Content options={options} onSelect={handleSelect} classNames='popover-card-width' />\n <ObjectPicker.VirtualTrigger virtualRef={addTriggerRef} />\n </ObjectPicker.Root>\n </Board.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\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": ";;;AAIA,OAAOA,SAASC,aAAaC,SAASC,QAAQC,gBAAgB;AAE9D,SAASC,eAA2C;AACpD,SAASC,QAAQC,KAAKC,WAAW;AACjC,SAASC,WAAWC,kBAAkB;AACtC,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;AACzB,SAASC,oBAAoB;AAC7B,SAASC,aAAuE;AAChF,SAASC,oBAAmD;AAC5D,SAASC,cAAc;AACvB,SAASC,qBAAqB;;AAI9B,IAAMC,mBAAmB;EAAEC,GAAG;EAAGC,GAAG;AAAE;AAQ/B,IAAMC,iBAAiB,CAAC,EAAEC,MAAMC,SAASC,MAAK,MAAuB;AAC1E,QAAMC,aAAatB,OAAwB,IAAA;AAC3C,QAAM,CAACuB,UAAAA,IAAcjB,UAAUe,OAAO,OAAA;AACtC,QAAMG,QAAQjB,WAAWgB,cAAc,CAAA,CAAE;AACzC,QAAME,gBAAgBzB,OAAiC,IAAA;AACvD,QAAM,CAAC0B,aAAaC,cAAAA,IAAkB1B,SAA6B,IAAA;AACnE,QAAM2B,eAAexB,IAAIyB,OAAOR,KAAAA,EAAOS,SAAQ;AAC/C,QAAM,EAAEC,aAAY,IAAKrB,aAAakB,YAAAA;AAEtC,QAAMI,KAAK5B,IAAI6B,YAAYZ,KAAAA;AAE3B,QAAMa,UAAUzB,SAASuB,IAAI7B,OAAOgC,WAAU,CAAA;AAC9C,QAAMC,UAAUrC,QACd,MACEmC,QACGG,OAAO,CAACC,QAAQA,IAAIC,OAAOlB,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AAClD;IAAkByD,UAAU5B;IAAcmB,YAAW;MAC3E,sBAAA,cAACxE,aAAakF,gBAAc;IAACC,YAAYtE;;AAIjD;;;AC9IA,SAASuE,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,aAAa,CAAA;AACf;",
|
|
6
|
-
"names": ["React", "useCallback", "useMemo", "useRef", "useState", "Surface", "Filter", "Obj", "Ref", "useObject", "useObjects", "invariant", "useQuery", "useAttention", "Board", "ObjectPicker", "Layout", "isNonNullable", "DEFAULT_POSITION", "x", "y", "BoardContainer", "role", "subject", "board", "controller", "boardItems", "items", "addTriggerRef", "pickerState", "setPickerState", "attendableId", "getDXN", "toString", "hasAttention", "db", "getDatabase", "objects", "everything", "options", "filter", "obj", "id", "map", "label", "getLabel", "hue", "sort", "a", "b", "toLocaleLowerCase", "localeCompare", "handleAdd", "anchor", "position", "current", "handleDelete", "idx", "findIndex", "ref", "dxn", "asEchoDXN", "echoId", "change", "splice", "layout", "cells", "handleMove", "handleSelect", "selectedObject", "find", "isObject", "push", "make", "Root", "onAdd", "onDelete", "onMove", "open", "onOpenChange", "nextOpen", "Main", "toolbar", "Toolbar", "disabled", "Container", "Viewport", "classNames", "Backdrop", "Content", "item", "index", "Cell", "key", "data", "limit", "onSelect", "VirtualTrigger", "virtualRef", "trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "screenshots"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/Board.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\n/**\n * Board and layout.\n */\nexport const Board = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n items: Type.Ref(Type.Obj).pipe(Schema.Array, Schema.mutable, FormInputAnnotation.set(false)),\n layout: BoardLayout.pipe(Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\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"],
|
|
5
|
-
"mappings": ";;;;;;;;AAAA;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,KAAKC,YAAY;AAC1B,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,aAAaC,qBAAqB;AAKpC,IAAMC,QAAeC,cAAO;EACjCC,MAAaC,cAAOC,KAAYC,eAAQ;EACxCC,OAAOC,KAAKC,IAAID,KAAKE,GAAG,EAAEL,KAAYM,cAAcC,gBAASC,oBAAoBC,IAAI,KAAA,CAAA;EACrFC,QAAQC,YAAYX,KAAYO,gBAASC,oBAAoBC,IAAI,KAAA,CAAA;AACnE,CAAA,EAAGT,KACDG,KAAKS,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBN,IAAI;EAAC;CAAO,CAAA;AAKvB,IAAMO,YAAY,CAACC,QAA8C,CAAC,MACvEZ,IAAIa,KAAKtB,OAAO;EACdM,OAAO,CAAA;EACPQ,QAAQS;EACR,GAAGF;AACL,CAAA;",
|
|
6
|
-
"names": ["Schema", "Obj", "Type", "FormInputAnnotation", "LabelAnnotation", "BoardLayout", "defaultLayout", "Board", "Struct", "name", "String", "pipe", "optional", "items", "Type", "Ref", "Obj", "Array", "mutable", "FormInputAnnotation", "set", "layout", "BoardLayout", "object", "typename", "version", "LabelAnnotation", "makeBoard", "props", "make", "defaultLayout"]
|
|
7
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
BoardContainer,
|
|
4
|
-
meta
|
|
5
|
-
} from "./chunk-UK23JIUK.mjs";
|
|
6
|
-
import {
|
|
7
|
-
Board_exports
|
|
8
|
-
} from "./chunk-VU2JDWBB.mjs";
|
|
9
|
-
|
|
10
|
-
// src/capabilities/react-surface/react-surface.tsx
|
|
11
|
-
import * as Effect from "effect/Effect";
|
|
12
|
-
import React from "react";
|
|
13
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
14
|
-
import { Obj } from "@dxos/echo";
|
|
15
|
-
var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Common.Capability.ReactSurface, [
|
|
16
|
-
Common.createSurface({
|
|
17
|
-
id: meta.id,
|
|
18
|
-
role: [
|
|
19
|
-
"article",
|
|
20
|
-
"section"
|
|
21
|
-
],
|
|
22
|
-
filter: (data) => Obj.instanceOf(Board_exports.Board, data.subject),
|
|
23
|
-
component: ({ role, data }) => /* @__PURE__ */ React.createElement(BoardContainer, {
|
|
24
|
-
role,
|
|
25
|
-
subject: data.subject
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
])));
|
|
29
|
-
export {
|
|
30
|
-
react_surface_default as default
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=react-surface-6OXJH5X5.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface/react-surface.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React from 'react';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\n\nimport { BoardContainer } from '../../components';\nimport { meta } from '../../meta';\nimport { Board } from '../../types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Common.Capability.ReactSurface, [\n Common.createSurface({\n id: meta.id,\n role: ['article', 'section'],\n filter: (data): data is { subject: Board.Board } => Obj.instanceOf(Board.Board, data.subject),\n component: ({ role, data }) => <BoardContainer role={role} subject={data.subject} />,\n }),\n ]),\n ),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,WAAW;AAElB,SAASC,YAAYC,cAAc;AACnC,SAASC,WAAW;AAMpB,IAAA,wBAAeC,WAAWC,WAAW,MAC5BC,eACLF,WAAWG,YAAYC,OAAOJ,WAAWK,cAAc;EACrDD,OAAOE,cAAc;IACnBC,IAAIC,KAAKD;IACTE,MAAM;MAAC;MAAW;;IAClBC,QAAQ,CAACC,SAA2CC,IAAIC,WAAWC,cAAMA,OAAOH,KAAKI,OAAO;IAC5FC,WAAW,CAAC,EAAEP,MAAME,KAAI,MAAO,sBAAA,cAACM,gBAAAA;MAAeR;MAAYM,SAASJ,KAAKI;;EAC3E,CAAA;CACD,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "React", "Capability", "Common", "Obj", "Capability", "makeModule", "succeed", "contributes", "Common", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Board", "subject", "component", "BoardContainer"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,YAAY,sJAAmE,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Common.Capability.ReactSurface>>, never, never>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=react-surface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/react-surface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;;AAOzD,wBAWE"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
3
|
-
import { type Board as BoardType } from '../types';
|
|
4
|
-
export type BoardContainerProps = SurfaceComponentProps<BoardType.Board>;
|
|
5
|
-
export declare const BoardContainer: ({ role, subject: board }: BoardContainerProps) => React.JSX.Element;
|
|
6
|
-
//# sourceMappingURL=BoardContainer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BoardContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/BoardContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAW,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAWhF,OAAO,EAAE,KAAK,KAAK,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC;AAQnD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAEzE,eAAO,MAAM,cAAc,GAAI,0BAA0B,mBAAmB,sBAwH3E,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { type StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Board } from '../types';
|
|
4
|
-
declare const meta: {
|
|
5
|
-
title: string;
|
|
6
|
-
render: () => React.JSX.Element | null;
|
|
7
|
-
decorators: import("@storybook/react").Decorator[];
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: string;
|
|
10
|
-
translations: ({
|
|
11
|
-
readonly 'en-US': {
|
|
12
|
-
readonly [Board.Board.typename]: {
|
|
13
|
-
readonly 'typename label': "Board";
|
|
14
|
-
readonly 'typename label_zero': "Boards";
|
|
15
|
-
readonly 'typename label_one': "Board";
|
|
16
|
-
readonly 'typename label_other': "Boards";
|
|
17
|
-
readonly 'object name placeholder': "New board";
|
|
18
|
-
readonly 'rename object label': "Rename board";
|
|
19
|
-
readonly 'delete object label': "Delete board";
|
|
20
|
-
readonly 'object deleted label': "Board deleted";
|
|
21
|
-
};
|
|
22
|
-
readonly [meta.id]: {
|
|
23
|
-
readonly 'plugin name': "Board";
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
} | {
|
|
27
|
-
readonly 'en-US': {
|
|
28
|
-
readonly "@dxos/react-ui-stack": {
|
|
29
|
-
readonly "resize label": "Drag to resize";
|
|
30
|
-
readonly "drag handle label": "Drag to rearrange";
|
|
31
|
-
readonly "pin start label": "Pin to the left sidebar";
|
|
32
|
-
readonly "pin end label": "Pin to the right sidebar";
|
|
33
|
-
readonly "increment start label": "Move to the left";
|
|
34
|
-
readonly "increment end label": "Move to the right";
|
|
35
|
-
readonly "close label": "Close";
|
|
36
|
-
readonly "minify label": "Minify";
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
})[];
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export default meta;
|
|
43
|
-
type Story = StoryObj<typeof meta>;
|
|
44
|
-
export declare const Default: Story;
|
|
45
|
-
//# 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,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAkDjC,QAAA,MAAM,IAAI;;;;;;;;yBA9DG,CAAQ,KAAK,CAAC,KAAK,CAAE,QAAO,CAAC;;;;;;;;;;yBAO5B,CAAQ,IAAI,CAAC,EAAE,CAAC;;;;;;;;;;;;;;;;;;;CAmG7B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
);
|