@dxos/plugin-board 0.8.4-main.c1de068

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.
Files changed (62) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +15 -0
  3. package/dist/lib/browser/chunk-TDV6SJ64.mjs +46 -0
  4. package/dist/lib/browser/chunk-TDV6SJ64.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +86 -0
  6. package/dist/lib/browser/index.mjs.map +7 -0
  7. package/dist/lib/browser/intent-resolver-TDOZP647.mjs +33 -0
  8. package/dist/lib/browser/intent-resolver-TDOZP647.mjs.map +7 -0
  9. package/dist/lib/browser/meta.json +1 -0
  10. package/dist/lib/browser/react-surface-XFSXU2JJ.mjs +143 -0
  11. package/dist/lib/browser/react-surface-XFSXU2JJ.mjs.map +7 -0
  12. package/dist/lib/browser/types/index.mjs +7 -0
  13. package/dist/lib/browser/types/index.mjs.map +7 -0
  14. package/dist/lib/node-esm/chunk-K6CHLZYU.mjs +48 -0
  15. package/dist/lib/node-esm/chunk-K6CHLZYU.mjs.map +7 -0
  16. package/dist/lib/node-esm/index.mjs +87 -0
  17. package/dist/lib/node-esm/index.mjs.map +7 -0
  18. package/dist/lib/node-esm/intent-resolver-IHQWKJNT.mjs +34 -0
  19. package/dist/lib/node-esm/intent-resolver-IHQWKJNT.mjs.map +7 -0
  20. package/dist/lib/node-esm/meta.json +1 -0
  21. package/dist/lib/node-esm/react-surface-ZHPQBZWO.mjs +144 -0
  22. package/dist/lib/node-esm/react-surface-ZHPQBZWO.mjs.map +7 -0
  23. package/dist/lib/node-esm/types/index.mjs +8 -0
  24. package/dist/lib/node-esm/types/index.mjs.map +7 -0
  25. package/dist/types/src/BoardPlugin.d.ts +2 -0
  26. package/dist/types/src/BoardPlugin.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/index.d.ts +3 -0
  28. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  29. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  30. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  31. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  32. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  33. package/dist/types/src/components/BoardContainer.d.ts +8 -0
  34. package/dist/types/src/components/BoardContainer.d.ts.map +1 -0
  35. package/dist/types/src/components/BoardContainer.stories.d.ts +8 -0
  36. package/dist/types/src/components/BoardContainer.stories.d.ts.map +1 -0
  37. package/dist/types/src/components/index.d.ts +2 -0
  38. package/dist/types/src/components/index.d.ts.map +1 -0
  39. package/dist/types/src/index.d.ts +3 -0
  40. package/dist/types/src/index.d.ts.map +1 -0
  41. package/dist/types/src/meta.d.ts +3 -0
  42. package/dist/types/src/meta.d.ts.map +1 -0
  43. package/dist/types/src/translations.d.ts +19 -0
  44. package/dist/types/src/translations.d.ts.map +1 -0
  45. package/dist/types/src/types/index.d.ts +2 -0
  46. package/dist/types/src/types/index.d.ts.map +1 -0
  47. package/dist/types/src/types/schema.d.ts +65 -0
  48. package/dist/types/src/types/schema.d.ts.map +1 -0
  49. package/dist/types/tsconfig.tsbuildinfo +1 -0
  50. package/package.json +87 -0
  51. package/src/BoardPlugin.tsx +58 -0
  52. package/src/capabilities/index.ts +8 -0
  53. package/src/capabilities/intent-resolver.ts +34 -0
  54. package/src/capabilities/react-surface.tsx +22 -0
  55. package/src/components/BoardContainer.stories.tsx +142 -0
  56. package/src/components/BoardContainer.tsx +104 -0
  57. package/src/components/index.ts +5 -0
  58. package/src/index.ts +7 -0
  59. package/src/meta.ts +15 -0
  60. package/src/translations.ts +27 -0
  61. package/src/types/index.ts +5 -0
  62. package/src/types/schema.ts +45 -0
@@ -0,0 +1,34 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ Board
4
+ } from "./chunk-K6CHLZYU.mjs";
5
+
6
+ // src/capabilities/intent-resolver.ts
7
+ import { Capabilities, contributes, createResolver } from "@dxos/app-framework";
8
+ import { Obj } from "@dxos/echo";
9
+ var intent_resolver_default = () => [
10
+ contributes(Capabilities.IntentResolver, createResolver({
11
+ intent: Board.Create,
12
+ resolve: ({ name }) => {
13
+ return {
14
+ data: {
15
+ object: Obj.make(Board.Board, {
16
+ name,
17
+ items: [],
18
+ layout: {
19
+ size: {
20
+ width: 5,
21
+ height: 5
22
+ },
23
+ cells: {}
24
+ }
25
+ })
26
+ }
27
+ };
28
+ }
29
+ }))
30
+ ];
31
+ export {
32
+ intent_resolver_default as default
33
+ };
34
+ //# sourceMappingURL=intent-resolver-IHQWKJNT.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, createResolver } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\n\nimport { Board } from '../types';\n\nexport default () => [\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: Board.Create,\n resolve: ({ name }) => {\n return {\n data: {\n object: Obj.make(Board.Board, {\n name,\n items: [],\n layout: {\n size: {\n width: 5,\n height: 5,\n },\n cells: {},\n },\n }),\n },\n };\n },\n }),\n ),\n];\n"],
5
+ "mappings": ";;;;;;AAIA,SAASA,cAAcC,aAAaC,sBAAsB;AAC1D,SAASC,WAAW;AAIpB,IAAA,0BAAe,MAAM;EACnBC,YACEC,aAAaC,gBACbC,eAAe;IACbC,QAAQC,MAAMC;IACdC,SAAS,CAAC,EAAEC,KAAI,MAAE;AAChB,aAAO;QACLC,MAAM;UACJC,QAAQC,IAAIC,KAAKP,MAAMA,OAAO;YAC5BG;YACAK,OAAO,CAAA;YACPC,QAAQ;cACNC,MAAM;gBACJC,OAAO;gBACPC,QAAQ;cACV;cACAC,OAAO,CAAC;YACV;UACF,CAAA;QACF;MACF;IACF;EACF,CAAA,CAAA;;",
6
+ "names": ["Capabilities", "contributes", "createResolver", "Obj", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "Board", "Create", "resolve", "name", "data", "object", "Obj", "make", "items", "layout", "size", "width", "height", "cells"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"src/meta.ts":{"bytes":1492,"imports":[],"format":"esm"},"src/types/schema.ts":{"bytes":3858,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/react-ui-board","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"src/types/index.ts":{"bytes":460,"imports":[{"path":"src/types/schema.ts","kind":"import-statement","original":"./schema"}],"format":"esm"},"src/capabilities/intent-resolver.ts":{"bytes":3014,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/components/BoardContainer.tsx":{"bytes":13860,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@preact/signals-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-ui-board","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/components/index.ts":{"bytes":485,"imports":[{"path":"src/components/BoardContainer.tsx","kind":"import-statement","original":"./BoardContainer"}],"format":"esm"},"src/capabilities/react-surface.tsx":{"bytes":2913,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/capabilities/index.ts":{"bytes":1035,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/intent-resolver.ts","kind":"dynamic-import","original":"./intent-resolver"},{"path":"src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"src/translations.ts":{"bytes":2322,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/BoardPlugin.tsx":{"bytes":7270,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-ui-board","kind":"import-statement","external":true},{"path":"src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/index.ts":{"bytes":547,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/BoardPlugin.tsx","kind":"import-statement","original":"./BoardPlugin"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5021},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-K6CHLZYU.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-ui-board","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/node-esm/intent-resolver-IHQWKJNT.mjs","kind":"dynamic-import"},{"path":"dist/lib/node-esm/react-surface-ZHPQBZWO.mjs","kind":"dynamic-import"}],"exports":["BoardPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/BoardPlugin.tsx":{"bytesInOutput":1684},"src/capabilities/index.ts":{"bytesInOutput":190},"src/translations.ts":{"bytesInOutput":450}},"bytes":2643},"dist/lib/node-esm/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/types/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-K6CHLZYU.mjs","kind":"import-statement"}],"exports":["Board"],"entryPoint":"src/types/index.ts","inputs":{},"bytes":196},"dist/lib/node-esm/intent-resolver-IHQWKJNT.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1474},"dist/lib/node-esm/intent-resolver-IHQWKJNT.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-K6CHLZYU.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/intent-resolver.ts","inputs":{"src/capabilities/intent-resolver.ts":{"bytesInOutput":580}},"bytes":863},"dist/lib/node-esm/react-surface-ZHPQBZWO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8305},"dist/lib/node-esm/react-surface-ZHPQBZWO.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-K6CHLZYU.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@preact/signals-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-ui-board","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/react-surface.tsx","inputs":{"src/capabilities/react-surface.tsx":{"bytesInOutput":520},"src/components/BoardContainer.tsx":{"bytesInOutput":3587},"src/components/index.ts":{"bytesInOutput":0}},"bytes":4470},"dist/lib/node-esm/chunk-K6CHLZYU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2718},"dist/lib/node-esm/chunk-K6CHLZYU.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/react-ui-board","kind":"import-statement","external":true}],"exports":["Board","meta"],"inputs":{"src/types/schema.ts":{"bytesInOutput":787},"src/meta.ts":{"bytesInOutput":324},"src/types/index.ts":{"bytesInOutput":0}},"bytes":1340}}}
@@ -0,0 +1,144 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ Board,
4
+ meta
5
+ } from "./chunk-K6CHLZYU.mjs";
6
+
7
+ // src/capabilities/react-surface.tsx
8
+ import React2 from "react";
9
+ import { contributes, Capabilities, createSurface } from "@dxos/app-framework";
10
+ import { Obj } from "@dxos/echo";
11
+
12
+ // src/components/BoardContainer.tsx
13
+ import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
14
+ import { effect } from "@preact/signals-react";
15
+ import React, { useCallback, useEffect, useRef, useState } from "react";
16
+ import { createIntent, Surface, useIntentDispatcher } from "@dxos/app-framework";
17
+ import { getSpace } from "@dxos/client/echo";
18
+ import { Ref } from "@dxos/echo";
19
+ import { invariant } from "@dxos/invariant";
20
+ import { SpaceAction } from "@dxos/plugin-space/types";
21
+ import { Board as Board2 } from "@dxos/react-ui-board";
22
+ import { StackItem } from "@dxos/react-ui-stack";
23
+ import { isNonNullable } from "@dxos/util";
24
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-board/src/components/BoardContainer.tsx";
25
+ var BoardContainer = ({ role, board }) => {
26
+ var _effect = _useSignals();
27
+ try {
28
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
29
+ const controller = useRef(null);
30
+ const [items, setItems] = useState([]);
31
+ useEffect(() => {
32
+ let t;
33
+ effect(() => {
34
+ const refs = [
35
+ ...board.items
36
+ ];
37
+ t = setTimeout(async () => {
38
+ const items2 = await Ref.Array.loadAll(refs);
39
+ setItems(items2.filter(isNonNullable));
40
+ });
41
+ });
42
+ return () => clearTimeout(t);
43
+ }, [
44
+ board.items
45
+ ]);
46
+ const handleAdd = useCallback(async (position = {
47
+ x: 0,
48
+ y: 0
49
+ }) => {
50
+ const space = getSpace(board);
51
+ invariant(space, void 0, {
52
+ F: __dxlog_file,
53
+ L: 47,
54
+ S: void 0,
55
+ A: [
56
+ "space",
57
+ ""
58
+ ]
59
+ });
60
+ await dispatch(createIntent(SpaceAction.OpenCreateObject, {
61
+ target: space,
62
+ navigable: false,
63
+ onCreateObject: (object) => {
64
+ board.items.push(Ref.make(object));
65
+ board.layout.cells[object.id] = {
66
+ ...position,
67
+ width: 1,
68
+ height: 1
69
+ };
70
+ controller.current?.center(position);
71
+ }
72
+ }));
73
+ }, [
74
+ board,
75
+ controller,
76
+ dispatch
77
+ ]);
78
+ const handleDelete = useCallback((id) => {
79
+ const idx = board.items.findIndex((ref) => ref.dxn.asEchoDXN()?.echoId === id);
80
+ if (idx !== -1) {
81
+ board.items.splice(idx, 1);
82
+ }
83
+ delete board.layout.cells[id];
84
+ setItems((items2) => items2.filter((item) => item.id !== id));
85
+ }, [
86
+ board
87
+ ]);
88
+ const handleMove = useCallback((id, position) => {
89
+ const layout = board.layout.cells[id];
90
+ board.layout.cells[id] = {
91
+ ...layout,
92
+ ...position
93
+ };
94
+ }, [
95
+ board
96
+ ]);
97
+ return /* @__PURE__ */ React.createElement(Board2.Root, {
98
+ ref: controller,
99
+ layout: board.layout,
100
+ onAdd: handleAdd,
101
+ onDelete: handleDelete,
102
+ onMove: handleMove
103
+ }, /* @__PURE__ */ React.createElement(StackItem.Content, {
104
+ toolbar: true
105
+ }, /* @__PURE__ */ React.createElement(Board2.Controls, null), /* @__PURE__ */ React.createElement(Board2.Container, null, /* @__PURE__ */ React.createElement(Board2.Viewport, {
106
+ classNames: "border-none"
107
+ }, /* @__PURE__ */ React.createElement(Board2.Backdrop, null), /* @__PURE__ */ React.createElement(Board2.Content, null, items?.map((item, index) => /* @__PURE__ */ React.createElement(Board2.Cell, {
108
+ item,
109
+ key: index,
110
+ layout: board.layout?.cells[item.id] ?? {
111
+ x: 0,
112
+ y: 0
113
+ }
114
+ }, /* @__PURE__ */ React.createElement(Surface, {
115
+ role: "card--extrinsic",
116
+ data: {
117
+ subject: item
118
+ },
119
+ limit: 1
120
+ }))))))));
121
+ } finally {
122
+ _effect.f();
123
+ }
124
+ };
125
+
126
+ // src/capabilities/react-surface.tsx
127
+ var react_surface_default = (context) => contributes(Capabilities.ReactSurface, [
128
+ createSurface({
129
+ id: meta.id,
130
+ role: [
131
+ "article",
132
+ "section"
133
+ ],
134
+ filter: (data) => Obj.instanceOf(Board.Board, data.subject),
135
+ component: ({ data, role }) => /* @__PURE__ */ React2.createElement(BoardContainer, {
136
+ board: data.subject,
137
+ role
138
+ })
139
+ })
140
+ ]);
141
+ export {
142
+ react_surface_default as default
143
+ };
144
+ //# sourceMappingURL=react-surface-ZHPQBZWO.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/BoardContainer.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { contributes, Capabilities, type PluginContext, createSurface } 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 (context: PluginContext) =>\n contributes(Capabilities.ReactSurface, [\n 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: ({ data, role }) => <BoardContainer board={data.subject} role={role} />,\n }),\n ]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { effect } from '@preact/signals-react';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { createIntent, Surface, 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>\n <Board.Controls />\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,OAAOA,YAAW;AAElB,SAASC,aAAaC,cAAkCC,qBAAqB;AAC7E,SAASC,WAAW;;;;ACHpB,SAASC,cAAc;AACvB,OAAOC,SAASC,aAAaC,WAAWC,QAAQC,gBAAgB;AAEhE,SAASC,cAAcC,SAASC,2BAA2B;AAC3D,SAASC,gBAAgB;AACzB,SAAmBC,WAAsB;AACzC,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,SAAAA,cAAwD;AACjE,SAASC,iBAAiB;A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,KAAKI,OAAO;IAC5FC,WAAW,CAAC,EAAEL,MAAMF,KAAI,MAAO,gBAAAQ,OAAA,cAACC,gBAAAA;MAAeC,OAAOR,KAAKI;MAASN;;EACtE,CAAA;CACD;",
6
+ "names": ["React", "contributes", "Capabilities", "createSurface", "Obj", "effect", "React", "useCallback", "useEffect", "useRef", "useState", "createIntent", "Surface", "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", "Controls", "Container", "Viewport", "classNames", "Backdrop", "map", "index", "Cell", "key", "data", "subject", "limit", "context", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Board", "subject", "component", "React", "BoardContainer", "board"]
7
+ }
@@ -0,0 +1,8 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ Board
4
+ } from "../chunk-K6CHLZYU.mjs";
5
+ export {
6
+ Board
7
+ };
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export declare const BoardPlugin: () => import("@dxos/app-framework").Plugin;
2
+ //# sourceMappingURL=BoardPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoardPlugin.d.ts","sourceRoot":"","sources":["../../../src/BoardPlugin.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,WAAW,4CA0CvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const IntentResolver: (props?: unknown) => Promise<() => Promise<import("@dxos/app-framework").AnyCapability[] | import("@dxos/app-framework").Capability<unknown>>>;
2
+ export declare const ReactSurface: (props?: import("@dxos/app-framework").PluginContext | undefined) => Promise<() => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.ReactSurface> | import("@dxos/app-framework").AnyCapability[]>>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,gJAA0C,CAAC;AACtE,eAAO,MAAM,YAAY,gPAAwC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Capabilities } from '@dxos/app-framework';
2
+ declare const _default: () => import("@dxos/app-framework").Capability<Capabilities.IntentResolver>[];
3
+ export default _default;
4
+ //# sourceMappingURL=intent-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;;AAKhF,wBAwBE"}
@@ -0,0 +1,4 @@
1
+ import { Capabilities, type PluginContext } from '@dxos/app-framework';
2
+ declare const _default: (context: PluginContext) => import("@dxos/app-framework").Capability<Capabilities.ReactSurface>;
3
+ export default _default;
4
+ //# sourceMappingURL=react-surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAe,YAAY,EAAE,KAAK,aAAa,EAAiB,MAAM,qBAAqB,CAAC;yBAOnF,SAAS,aAAa;AAAtC,wBAQK"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { type Board as BoardType } from '../types';
3
+ export type BoardContainerProps = {
4
+ role: string;
5
+ board: BoardType.Board;
6
+ };
7
+ export declare const BoardContainer: ({ role, board }: BoardContainerProps) => React.JSX.Element;
8
+ //# sourceMappingURL=BoardContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoardContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/BoardContainer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAYxE,OAAO,EAAE,KAAK,KAAK,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,iBAAiB,mBAAmB,sBA+ElE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import '@dxos-theme';
2
+ import { type StoryObj, type Meta } from '@storybook/react-vite';
3
+ type StoryProps = {};
4
+ declare const meta: Meta<StoryProps>;
5
+ export default meta;
6
+ type Story = StoryObj<StoryProps>;
7
+ export declare const Default: Story;
8
+ //# sourceMappingURL=BoardContainer.stories.d.ts.map
@@ -0,0 +1 @@
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,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AA8EjE,KAAK,UAAU,GAAG,EAAE,CAAC;AAMrB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,CA6C1B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AAElC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './BoardContainer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './meta';
2
+ export * from './BoardPlugin';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AAEvB,cAAc,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type PluginMeta } from '@dxos/app-framework';
2
+ export declare const meta: PluginMeta;
3
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,eAAO,MAAM,IAAI,EAAE,UAQlB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { meta } from './meta';
2
+ import { Board } from './types';
3
+ export declare const translations: [{
4
+ readonly 'en-US': {
5
+ readonly [Board.Board.typename]: {
6
+ readonly 'typename label': "Board";
7
+ readonly 'typename label_zero': "Boards";
8
+ readonly 'typename label_one': "Board";
9
+ readonly 'typename label_other': "Boards";
10
+ readonly 'object name placeholder': "New board";
11
+ readonly 'rename object label': "Rename board";
12
+ readonly 'delete object label': "Delete board";
13
+ };
14
+ readonly [meta.id]: {
15
+ readonly 'plugin name': "Board";
16
+ };
17
+ };
18
+ }];
19
+ //# sourceMappingURL=translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,eAAO,MAAM,YAAY;;QAGnB,SAAA,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;;;;;;;;UAQrB;QACD,SAAA,CAAC,IAAI,CAAC,EAAE,CAAC;;UAER;;EAGwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './schema';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { Schema } from 'effect';
2
+ import { Type } from '@dxos/echo';
3
+ export declare namespace Board {
4
+ export const Board: Type.obj<Schema.Struct<{
5
+ name: Schema.optional<typeof Schema.String>;
6
+ items: Schema.mutable<Schema.Array$<Type.ref<Schema.Schema<Type.Expando, {
7
+ [x: string]: any;
8
+ id: string;
9
+ }, never>>>>;
10
+ layout: Schema.mutable<Schema.Struct<{
11
+ size: Schema.Struct<{
12
+ width: typeof Schema.Number;
13
+ height: typeof Schema.Number;
14
+ }>;
15
+ cells: Schema.mutable<Schema.Record$<typeof Schema.String, Schema.extend<Schema.Struct<{
16
+ x: typeof Schema.Number;
17
+ y: typeof Schema.Number;
18
+ }>, Schema.SchemaClass<{
19
+ readonly width?: number | undefined;
20
+ readonly height?: number | undefined;
21
+ }, {
22
+ readonly width?: number | undefined;
23
+ readonly height?: number | undefined;
24
+ }, never>>>>;
25
+ }>>;
26
+ }>>;
27
+ export interface Board extends Schema.Schema.Type<typeof Board> {
28
+ }
29
+ const Create_base: Schema.TaggedClass<Create, `${string}/action/create`, {
30
+ readonly _tag: Schema.tag<`${string}/action/create`>;
31
+ } & {
32
+ input: Schema.Struct<{
33
+ name: Schema.optional<typeof Schema.String>;
34
+ }>;
35
+ output: Schema.Struct<{
36
+ object: Type.obj<Schema.Struct<{
37
+ name: Schema.optional<typeof Schema.String>;
38
+ items: Schema.mutable<Schema.Array$<Type.ref<Schema.Schema<Type.Expando, {
39
+ [x: string]: any;
40
+ id: string;
41
+ }, never>>>>;
42
+ layout: Schema.mutable<Schema.Struct<{
43
+ size: Schema.Struct<{
44
+ width: typeof Schema.Number;
45
+ height: typeof Schema.Number;
46
+ }>;
47
+ cells: Schema.mutable<Schema.Record$<typeof Schema.String, Schema.extend<Schema.Struct<{
48
+ x: typeof Schema.Number;
49
+ y: typeof Schema.Number;
50
+ }>, Schema.SchemaClass<{
51
+ readonly width?: number | undefined;
52
+ readonly height?: number | undefined;
53
+ }, {
54
+ readonly width?: number | undefined;
55
+ readonly height?: number | undefined;
56
+ }, never>>>>;
57
+ }>>;
58
+ }>>;
59
+ }>;
60
+ }>;
61
+ export class Create extends Create_base {
62
+ }
63
+ export {};
64
+ }
65
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/types/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAMlC,yBAAiB,KAAK,CAAC;IAMrB,MAAM,CAAC,MAAM,KAAK;;;;;;;;;;;;;;;8BA2BuL,CAAC;+BAA6C,CAAC;;8BAAqD,CAAC;+BAA6C,CAAC;;;OAjB3V,CAAC;IAEF,MAAM,WAAW,KAAM,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC;KAAG;;;;;;;;;;;;;;;;;;;;;;;sCAeuI,CAAC;uCAA6C,CAAC;;sCAAqD,CAAC;uCAA6C,CAAC;;;;;;IAT5V,MAAM,OAAO,MAAO,SAAQ,WAO1B;KAAG;;CACN"}