@dxos/react-ui-mosaic 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6

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 (190) hide show
  1. package/dist/lib/browser/chunk-UTD5AWW5.mjs +1009 -0
  2. package/dist/lib/browser/chunk-UTD5AWW5.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +604 -71
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/playwright/index.mjs +148 -0
  7. package/dist/lib/browser/playwright/index.mjs.map +7 -0
  8. package/dist/lib/browser/testing/index.mjs +69 -236
  9. package/dist/lib/browser/testing/index.mjs.map +4 -4
  10. package/dist/lib/node-esm/chunk-5K56GSJL.mjs +1011 -0
  11. package/dist/lib/node-esm/chunk-5K56GSJL.mjs.map +7 -0
  12. package/dist/lib/node-esm/index.mjs +604 -71
  13. package/dist/lib/node-esm/index.mjs.map +4 -4
  14. package/dist/lib/node-esm/meta.json +1 -1
  15. package/dist/lib/node-esm/playwright/index.mjs +150 -0
  16. package/dist/lib/node-esm/playwright/index.mjs.map +7 -0
  17. package/dist/lib/node-esm/testing/index.mjs +69 -236
  18. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  19. package/dist/types/src/components/Board/Board.d.ts +88 -0
  20. package/dist/types/src/components/Board/Board.d.ts.map +1 -0
  21. package/dist/types/src/components/Board/Board.stories.d.ts +41 -0
  22. package/dist/types/src/components/Board/Board.stories.d.ts.map +1 -0
  23. package/dist/types/src/components/Board/Column.d.ts +48 -0
  24. package/dist/types/src/components/Board/Column.d.ts.map +1 -0
  25. package/dist/types/src/components/Board/Item.d.ts +12 -0
  26. package/dist/types/src/components/Board/Item.d.ts.map +1 -0
  27. package/dist/types/src/components/Board/index.d.ts +2 -0
  28. package/dist/types/src/components/Board/index.d.ts.map +1 -0
  29. package/dist/types/src/components/Focus/Focus.d.ts +1 -24
  30. package/dist/types/src/components/Focus/Focus.d.ts.map +1 -1
  31. package/dist/types/src/components/Focus/index.d.ts +0 -1
  32. package/dist/types/src/components/Focus/index.d.ts.map +1 -1
  33. package/dist/types/src/components/Mosaic/Container.d.ts +49 -0
  34. package/dist/types/src/components/Mosaic/Container.d.ts.map +1 -0
  35. package/dist/types/src/components/Mosaic/Mosaic.d.ts +36 -126
  36. package/dist/types/src/components/Mosaic/Mosaic.d.ts.map +1 -1
  37. package/dist/types/src/components/Mosaic/Placeholder.d.ts +21 -0
  38. package/dist/types/src/components/Mosaic/Placeholder.d.ts.map +1 -0
  39. package/dist/types/src/components/Mosaic/Root.d.ts +36 -0
  40. package/dist/types/src/components/Mosaic/Root.d.ts.map +1 -0
  41. package/dist/types/src/components/Mosaic/Stack.d.ts +23 -0
  42. package/dist/types/src/components/Mosaic/Stack.d.ts.map +1 -0
  43. package/dist/types/src/components/Mosaic/Stack.stories.d.ts +20 -0
  44. package/dist/types/src/components/Mosaic/Stack.stories.d.ts.map +1 -0
  45. package/dist/types/src/components/Mosaic/Tile.d.ts +57 -0
  46. package/dist/types/src/components/Mosaic/Tile.d.ts.map +1 -0
  47. package/dist/types/src/components/Mosaic/styles.d.ts.map +1 -1
  48. package/dist/types/src/components/Mosaic/types.d.ts +9 -2
  49. package/dist/types/src/components/Mosaic/types.d.ts.map +1 -1
  50. package/dist/types/src/components/index.d.ts +1 -4
  51. package/dist/types/src/components/index.d.ts.map +1 -1
  52. package/dist/types/src/hooks/index.d.ts +1 -0
  53. package/dist/types/src/hooks/index.d.ts.map +1 -1
  54. package/dist/types/src/hooks/useDefaultColumnEventHandler.d.ts +15 -0
  55. package/dist/types/src/hooks/useDefaultColumnEventHandler.d.ts.map +1 -0
  56. package/dist/types/src/hooks/useEventHandlerAdapter.d.ts +1 -1
  57. package/dist/types/src/hooks/useEventHandlerAdapter.d.ts.map +1 -1
  58. package/dist/types/src/hooks/useVisibleItems.d.ts +2 -2
  59. package/dist/types/src/hooks/useVisibleItems.d.ts.map +1 -1
  60. package/dist/types/src/playwright/board-manager.d.ts +45 -0
  61. package/dist/types/src/playwright/board-manager.d.ts.map +1 -0
  62. package/dist/types/src/playwright/index.d.ts +9 -0
  63. package/dist/types/src/playwright/index.d.ts.map +1 -0
  64. package/dist/types/src/playwright/playwright.config.d.ts +3 -0
  65. package/dist/types/src/playwright/playwright.config.d.ts.map +1 -0
  66. package/dist/types/src/playwright/smoke.spec.d.ts +2 -0
  67. package/dist/types/src/playwright/smoke.spec.d.ts.map +1 -0
  68. package/dist/types/src/testing/CardContainer.d.ts +5 -4
  69. package/dist/types/src/testing/CardContainer.d.ts.map +1 -1
  70. package/dist/types/src/testing/DefaultStackTile.d.ts +2 -2
  71. package/dist/types/src/testing/DefaultStackTile.d.ts.map +1 -1
  72. package/dist/types/src/testing/index.d.ts +1 -1
  73. package/dist/types/src/testing/index.d.ts.map +1 -1
  74. package/dist/types/src/testing/types.d.ts +21 -0
  75. package/dist/types/src/testing/types.d.ts.map +1 -0
  76. package/dist/types/src/translations.d.ts +5 -1
  77. package/dist/types/src/translations.d.ts.map +1 -1
  78. package/dist/types/tsconfig.tsbuildinfo +1 -1
  79. package/package.json +43 -28
  80. package/src/AUDIT.md +106 -0
  81. package/src/components/Board/Board.stories.tsx +273 -0
  82. package/src/components/Board/Board.tsx +191 -0
  83. package/src/components/Board/Column.tsx +302 -0
  84. package/src/components/Board/Item.tsx +116 -0
  85. package/src/components/{Layout → Board}/index.ts +1 -1
  86. package/src/components/Focus/Focus.tsx +2 -93
  87. package/src/components/Focus/index.ts +0 -2
  88. package/src/components/Mosaic/Container.tsx +318 -0
  89. package/src/components/Mosaic/Mosaic.tsx +35 -913
  90. package/src/components/Mosaic/Placeholder.tsx +133 -0
  91. package/src/components/Mosaic/Root.tsx +292 -0
  92. package/src/components/Mosaic/Stack.stories.tsx +176 -0
  93. package/src/components/Mosaic/Stack.tsx +321 -0
  94. package/src/components/Mosaic/Tile.tsx +247 -0
  95. package/src/components/Mosaic/extension.ts +1 -1
  96. package/src/components/Mosaic/styles.ts +9 -8
  97. package/src/components/Mosaic/types.ts +15 -3
  98. package/src/components/index.ts +1 -4
  99. package/src/hooks/index.ts +1 -0
  100. package/src/hooks/useContainerDebug.tsx +5 -3
  101. package/src/hooks/useDefaultColumnEventHandler.ts +35 -0
  102. package/src/hooks/useEventHandlerAdapter.ts +15 -6
  103. package/src/hooks/useVisibleItems.ts +7 -2
  104. package/src/playwright/board-manager.ts +159 -0
  105. package/src/playwright/index.ts +13 -0
  106. package/src/playwright/playwright.config.ts +17 -0
  107. package/src/playwright/smoke.spec.ts +143 -0
  108. package/src/testing/CardContainer.tsx +31 -19
  109. package/src/testing/DefaultStackTile.tsx +36 -22
  110. package/src/testing/index.ts +1 -1
  111. package/src/testing/types.ts +38 -0
  112. package/src/translations.ts +5 -1
  113. package/dist/lib/browser/chunk-UMBPEG4F.mjs +0 -1637
  114. package/dist/lib/browser/chunk-UMBPEG4F.mjs.map +0 -7
  115. package/dist/lib/browser/index.css +0 -13
  116. package/dist/lib/browser/index.css.map +0 -7
  117. package/dist/lib/browser/testing/index.css +0 -13
  118. package/dist/lib/browser/testing/index.css.map +0 -7
  119. package/dist/lib/node-esm/chunk-X6GV7SMK.mjs +0 -1639
  120. package/dist/lib/node-esm/chunk-X6GV7SMK.mjs.map +0 -7
  121. package/dist/lib/node-esm/index.css +0 -13
  122. package/dist/lib/node-esm/index.css.map +0 -7
  123. package/dist/lib/node-esm/testing/index.css +0 -13
  124. package/dist/lib/node-esm/testing/index.css.map +0 -7
  125. package/dist/types/src/components/Card/Card.d.ts +0 -121
  126. package/dist/types/src/components/Card/Card.d.ts.map +0 -1
  127. package/dist/types/src/components/Card/Card.stories.d.ts +0 -21
  128. package/dist/types/src/components/Card/Card.stories.d.ts.map +0 -1
  129. package/dist/types/src/components/Card/CardDragPreview.d.ts +0 -6
  130. package/dist/types/src/components/Card/CardDragPreview.d.ts.map +0 -1
  131. package/dist/types/src/components/Card/index.d.ts +0 -4
  132. package/dist/types/src/components/Card/index.d.ts.map +0 -1
  133. package/dist/types/src/components/Card/styles.d.ts +0 -13
  134. package/dist/types/src/components/Card/styles.d.ts.map +0 -1
  135. package/dist/types/src/components/Focus/styles.d.ts +0 -6
  136. package/dist/types/src/components/Focus/styles.d.ts.map +0 -1
  137. package/dist/types/src/components/Image/Image.d.ts +0 -14
  138. package/dist/types/src/components/Image/Image.d.ts.map +0 -1
  139. package/dist/types/src/components/Image/Image.stories.d.ts +0 -33
  140. package/dist/types/src/components/Image/Image.stories.d.ts.map +0 -1
  141. package/dist/types/src/components/Image/index.d.ts +0 -2
  142. package/dist/types/src/components/Image/index.d.ts.map +0 -1
  143. package/dist/types/src/components/Layout/Layout.d.ts +0 -33
  144. package/dist/types/src/components/Layout/Layout.d.ts.map +0 -1
  145. package/dist/types/src/components/Layout/Layout.stories.d.ts +0 -10
  146. package/dist/types/src/components/Layout/Layout.stories.d.ts.map +0 -1
  147. package/dist/types/src/components/Layout/index.d.ts +0 -2
  148. package/dist/types/src/components/Layout/index.d.ts.map +0 -1
  149. package/dist/types/src/components/Mosaic/Mosaic.stories.d.ts +0 -27
  150. package/dist/types/src/components/Mosaic/Mosaic.stories.d.ts.map +0 -1
  151. package/dist/types/src/components/Scrollable/Scrollable.d.ts +0 -24
  152. package/dist/types/src/components/Scrollable/Scrollable.d.ts.map +0 -1
  153. package/dist/types/src/components/Scrollable/Scrollable.stories.d.ts +0 -10
  154. package/dist/types/src/components/Scrollable/Scrollable.stories.d.ts.map +0 -1
  155. package/dist/types/src/components/Scrollable/index.d.ts +0 -2
  156. package/dist/types/src/components/Scrollable/index.d.ts.map +0 -1
  157. package/dist/types/src/components/Stack/Stack.d.ts +0 -22
  158. package/dist/types/src/components/Stack/Stack.d.ts.map +0 -1
  159. package/dist/types/src/components/Stack/Stack.stories.d.ts +0 -9
  160. package/dist/types/src/components/Stack/Stack.stories.d.ts.map +0 -1
  161. package/dist/types/src/components/Stack/index.d.ts +0 -2
  162. package/dist/types/src/components/Stack/index.d.ts.map +0 -1
  163. package/dist/types/src/testing/Board.d.ts +0 -45
  164. package/dist/types/src/testing/Board.d.ts.map +0 -1
  165. package/dist/types/src/testing/Slot.stories.d.ts +0 -14
  166. package/dist/types/src/testing/Slot.stories.d.ts.map +0 -1
  167. package/dist/types/src/testing/Virtualizer.stories.d.ts +0 -12
  168. package/dist/types/src/testing/Virtualizer.stories.d.ts.map +0 -1
  169. package/src/components/Card/Card.stories.tsx +0 -148
  170. package/src/components/Card/Card.tsx +0 -458
  171. package/src/components/Card/CardDragPreview.tsx +0 -23
  172. package/src/components/Card/index.ts +0 -8
  173. package/src/components/Card/styles.ts +0 -23
  174. package/src/components/Focus/styles.ts +0 -24
  175. package/src/components/Image/Image.stories.tsx +0 -86
  176. package/src/components/Image/Image.tsx +0 -223
  177. package/src/components/Image/index.ts +0 -5
  178. package/src/components/Layout/Layout.stories.tsx +0 -59
  179. package/src/components/Layout/Layout.tsx +0 -108
  180. package/src/components/Mosaic/Mosaic.stories.tsx +0 -113
  181. package/src/components/Scrollable/Scrollable.stories.tsx +0 -59
  182. package/src/components/Scrollable/Scrollable.tsx +0 -88
  183. package/src/components/Scrollable/index.ts +0 -5
  184. package/src/components/Scrollable/scrollable.css +0 -20
  185. package/src/components/Stack/Stack.stories.tsx +0 -115
  186. package/src/components/Stack/Stack.tsx +0 -210
  187. package/src/components/Stack/index.ts +0 -5
  188. package/src/testing/Board.tsx +0 -278
  189. package/src/testing/Slot.stories.tsx +0 -101
  190. package/src/testing/Virtualizer.stories.tsx +0 -133
@@ -1,13 +1,8 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
- Card,
4
3
  Focus,
5
- Mosaic,
6
- styles3 as styles,
7
- useContainerDebug,
8
- useEventHandlerAdapter,
9
- useRootContext
10
- } from "../chunk-X6GV7SMK.mjs";
4
+ Mosaic
5
+ } from "../chunk-5K56GSJL.mjs";
11
6
 
12
7
  // src/testing/decorator.tsx
13
8
  import React from "react";
@@ -15,241 +10,60 @@ var withMosaic = () => {
15
10
  return (Story) => /* @__PURE__ */ React.createElement(Mosaic.Root, null, /* @__PURE__ */ React.createElement(Story, null));
16
11
  };
17
12
 
18
- // src/testing/Board.tsx
19
- import { useComposedRefs } from "@radix-ui/react-compose-refs";
13
+ // src/testing/types.ts
20
14
  import * as Schema from "effect/Schema";
21
- import React2, { forwardRef, useMemo, useRef, useState } from "react";
22
- import { Obj, Ref, Type } from "@dxos/echo";
15
+ import { Ref, Type } from "@dxos/echo";
23
16
  import { ObjectId } from "@dxos/keys";
24
- import { useObject } from "@dxos/react-client/echo";
25
- import { Tag } from "@dxos/react-ui";
26
- import { Json } from "@dxos/react-ui-syntax-highlighter";
27
- import { getHashStyles, mx } from "@dxos/ui-theme";
28
17
  var TestItem = Schema.Struct({
29
18
  name: Schema.String,
30
19
  description: Schema.optional(Schema.String),
31
20
  label: Schema.optional(Schema.String)
32
21
  }).pipe(Type.object({
33
- typename: "example.com/type/Item",
22
+ typename: "com.example.type.item",
34
23
  version: "0.1.0"
35
24
  }));
36
25
  var TestColumn = Schema.Struct({
37
26
  id: ObjectId,
38
- items: Schema.mutable(Schema.Array(Type.Ref(TestItem)))
27
+ name: Schema.String,
28
+ items: Schema.mutable(Schema.Array(Ref.Ref(TestItem)))
39
29
  }).pipe(Type.object({
40
- typename: "example.com/type/Column",
30
+ typename: "com.example.type.column",
41
31
  version: "0.1.0"
42
32
  }));
43
- var Root = /* @__PURE__ */ forwardRef(({ id, columns, debug }, forwardedRef) => {
44
- const [DebugInfo, debugHandler] = useContainerDebug(debug);
45
- const [viewport, setViewport] = useState(null);
46
- const eventHandler = useEventHandlerAdapter({
47
- id,
48
- items: columns,
49
- getId: (data) => data.id,
50
- get: (data) => data,
51
- make: (object) => object,
52
- canDrop: ({ source }) => Obj.instanceOf(TestColumn, source.data)
53
- });
54
- return /* @__PURE__ */ React2.createElement("div", {
55
- role: "none",
56
- className: mx("plb-2 grid bs-full is-full overflow-hidden", debug && "grid-cols-[1fr_20rem] gap-2"),
57
- ref: forwardedRef
58
- }, /* @__PURE__ */ React2.createElement(Focus.Group, {
59
- asChild: true,
60
- axis: "horizontal"
61
- }, /* @__PURE__ */ React2.createElement(Mosaic.Container, {
62
- asChild: true,
63
- withFocus: true,
64
- axis: "horizontal",
65
- autoScroll: viewport,
66
- eventHandler,
67
- debug: debugHandler
68
- }, /* @__PURE__ */ React2.createElement(Mosaic.Viewport, {
69
- axis: "horizontal",
70
- padding: true,
71
- viewportRef: setViewport
72
- }, /* @__PURE__ */ React2.createElement(Mosaic.Stack, {
73
- axis: "horizontal",
74
- items: columns,
75
- getId: (item) => item.id,
76
- Tile: Column,
77
- debug
78
- })))), /* @__PURE__ */ React2.createElement(DebugInfo, null));
79
- });
80
- var Column = /* @__PURE__ */ forwardRef(({ classNames, location, data, debug }, forwardedRef) => {
81
- const [column, updateColumn] = useObject(data);
82
- const [DebugInfo, debugHandler] = useContainerDebug(debug);
83
- const dragHandleRef = useRef(null);
84
- const [viewport, setViewport] = useState(null);
85
- const eventHandler = useEventHandlerAdapter({
86
- id: data.id,
87
- items: column.items,
88
- getId: (data2) => data2.dxn.toString(),
89
- get: (data2) => data2.target,
90
- make: (object) => Ref.make(object),
91
- canDrop: ({ source }) => Obj.instanceOf(TestItem, source.data.target),
92
- onChange: (mutator) => updateColumn((column2) => mutator(column2.items))
93
- });
94
- const menuItems = useMemo(() => [
95
- {
96
- label: "Delete",
97
- onClick: (obj) => {
98
- updateColumn((column2) => {
99
- const idx = column2.items.findIndex((item) => item.target?.id === obj?.id);
100
- if (idx !== -1) {
101
- column2.items.splice(idx, 1);
102
- }
103
- });
104
- }
105
- }
106
- ], [
107
- updateColumn
108
- ]);
109
- return /* @__PURE__ */ React2.createElement(Mosaic.Tile, {
110
- asChild: true,
111
- dragHandle: dragHandleRef.current,
112
- location,
113
- id: data.id,
114
- data,
115
- debug
116
- }, /* @__PURE__ */ React2.createElement(Focus.Group, {
117
- asChild: true
118
- }, /* @__PURE__ */ React2.createElement("div", {
119
- className: mx("grid bs-full card-default-width overflow-hidden bg-deckSurface", debug ? "grid-rows-[min-content_1fr_20rem]" : "grid-rows-[min-content_1fr_min-content]", classNames),
120
- ref: forwardedRef
121
- }, /* @__PURE__ */ React2.createElement(Card.Toolbar, null, /* @__PURE__ */ React2.createElement(Card.DragHandle, {
122
- ref: dragHandleRef
123
- }), /* @__PURE__ */ React2.createElement(Card.Title, null, column.id), /* @__PURE__ */ React2.createElement(Card.Menu, {
124
- items: []
125
- })), /* @__PURE__ */ React2.createElement(Card.Context, {
126
- value: {
127
- menuItems
128
- }
129
- }, /* @__PURE__ */ React2.createElement(Mosaic.Container, {
130
- asChild: true,
131
- withFocus: true,
132
- axis: "vertical",
133
- autoScroll: viewport,
134
- eventHandler,
135
- debug: debugHandler
136
- }, /* @__PURE__ */ React2.createElement(Mosaic.Viewport, {
137
- axis: "vertical",
138
- padding: true,
139
- viewportRef: setViewport
140
- }, /* @__PURE__ */ React2.createElement(Mosaic.Stack, {
141
- axis: "vertical",
142
- items: column.items,
143
- getId: (data2) => data2.dxn.toString(),
144
- Tile: Item
145
- })))), /* @__PURE__ */ React2.createElement("div", {
146
- role: "none"
147
- }, /* @__PURE__ */ React2.createElement("div", {
148
- className: "grow flex p-1 justify-center text-xs"
149
- }, column.items.length), /* @__PURE__ */ React2.createElement(DebugInfo, null)))));
150
- });
151
- Column.displayName = "Column";
152
- var Item = /* @__PURE__ */ forwardRef(({ classNames, data: ref, location, debug }, forwardedRef) => {
153
- const rootRef = useRef(null);
154
- const composedRef = useComposedRefs(rootRef, forwardedRef);
155
- const dragHandleRef = useRef(null);
156
- const object = ref.target;
157
- if (!object) {
158
- return null;
159
- }
160
- return /* @__PURE__ */ React2.createElement(Mosaic.Tile, {
161
- asChild: true,
162
- dragHandle: dragHandleRef.current,
163
- id: ref.dxn.toString(),
164
- data: ref,
165
- location,
166
- debug
167
- }, /* @__PURE__ */ React2.createElement(Focus.Group, {
168
- asChild: true
169
- }, /* @__PURE__ */ React2.createElement(Card.Root, {
170
- classNames,
171
- onClick: () => rootRef.current?.focus(),
172
- ref: composedRef
173
- }, /* @__PURE__ */ React2.createElement(Card.Toolbar, null, /* @__PURE__ */ React2.createElement(Card.DragHandle, {
174
- ref: dragHandleRef
175
- }), /* @__PURE__ */ React2.createElement(Card.Title, null, object.name), /* @__PURE__ */ React2.createElement(Card.Menu, {
176
- context: object
177
- })), /* @__PURE__ */ React2.createElement(Card.Row, {
178
- icon: "ph--note--regular",
179
- classNames: "text-description"
180
- }, object.description), /* @__PURE__ */ React2.createElement(Card.Row, {
181
- icon: "ph--tag--regular"
182
- }, object.label && /* @__PURE__ */ React2.createElement("div", {
183
- role: "none",
184
- className: "flex shrink-0 gap-1 text-xs items-center"
185
- }, /* @__PURE__ */ React2.createElement(Tag, {
186
- palette: getHashStyles(object.label).hue
187
- }, object.label))))));
188
- });
189
- Item.displayName = "Item";
190
- var Placeholder = (props) => {
191
- return /* @__PURE__ */ React2.createElement(Mosaic.Placeholder, {
192
- ...props,
193
- classNames: styles.placeholder.root
194
- }, /* @__PURE__ */ React2.createElement("div", {
195
- className: mx("flex bs-full border border-dashed border-separator rounded-sm", styles.placeholder.content)
196
- }));
197
- };
198
- Placeholder.displayName = "Placeholder";
199
- var Debug = /* @__PURE__ */ forwardRef(({ classNames }, forwardedRef) => {
200
- const { containers, dragging } = useRootContext(Debug.displayName);
201
- const counter = useRef(0);
202
- return /* @__PURE__ */ React2.createElement(Json, {
203
- data: {
204
- containers,
205
- dragging,
206
- count: counter.current++
207
- },
208
- classNames: mx("text-xs", classNames),
209
- ref: forwardedRef
210
- });
211
- });
212
- Debug.displayName = "Debug";
213
- var Board = {
214
- Root,
215
- Column,
216
- Item,
217
- Placeholder,
218
- Debug
219
- };
220
33
 
221
34
  // src/testing/CardContainer.tsx
222
35
  import { useControllableState } from "@radix-ui/react-use-controllable-state";
223
- import React3 from "react";
36
+ import React2 from "react";
224
37
  import { Icon, Popover } from "@dxos/react-ui";
225
38
  import { ResizeHandle, resizeAttributes, sizeStyle } from "@dxos/react-ui-dnd";
226
39
  var DEFAULT_BLOCK_SIZE = 22;
227
40
  var MIN_BLOCK_SIZE = 8;
228
- var CardContainer = ({ children, icon = "ph--placeholder--regular", role }) => {
41
+ var CardContainer = ({ children, role, icon = "ph--arrow-line-down--regular" }) => {
229
42
  switch (role) {
230
- case "card--popover":
231
- return /* @__PURE__ */ React3.createElement(PopoverCardContainer, {
43
+ case "popover":
44
+ return /* @__PURE__ */ React2.createElement("div", {
45
+ role: "none",
46
+ className: "flex justify-center"
47
+ }, /* @__PURE__ */ React2.createElement(PopoverCardContainer, {
232
48
  icon
233
- }, children);
234
- case "card--intrinsic":
49
+ }, children));
50
+ case "intrinsic":
235
51
  default:
236
- return /* @__PURE__ */ React3.createElement(IntrinsicCardContainer, null, children);
52
+ return /* @__PURE__ */ React2.createElement(IntrinsicCardContainer, null, children);
237
53
  }
238
54
  };
239
- var border = "relative border border-dashed border-subduedSeparator p-4 rounded-lg overflow-x-auto";
240
- var PopoverCardContainer = ({ children, icon = "ph--placeholder--regular" }) => {
241
- return /* @__PURE__ */ React3.createElement(Popover.Root, {
55
+ var PopoverCardContainer = ({ children, icon = "ph--arrow-line-down--regular" }) => {
56
+ return /* @__PURE__ */ React2.createElement(Popover.Root, {
242
57
  open: true
243
- }, /* @__PURE__ */ React3.createElement(Popover.Content, {
244
- onOpenAutoFocus: (event) => event.preventDefault()
245
- }, /* @__PURE__ */ React3.createElement(Popover.Viewport, {
246
- classNames: "popover-card-width"
247
- }, children), /* @__PURE__ */ React3.createElement(Popover.Arrow, null)), /* @__PURE__ */ React3.createElement(Popover.Trigger, {
58
+ }, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
248
59
  asChild: true
249
- }, /* @__PURE__ */ React3.createElement(Icon, {
250
- icon,
251
- size: 5
252
- })));
60
+ }, /* @__PURE__ */ React2.createElement(Icon, {
61
+ icon
62
+ })), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
63
+ onOpenAutoFocus: (event) => event.preventDefault()
64
+ }, /* @__PURE__ */ React2.createElement(Popover.Viewport, {
65
+ classNames: "dx-card-popover"
66
+ }, children), /* @__PURE__ */ React2.createElement(Popover.Arrow, null))));
253
67
  };
254
68
  var IntrinsicCardContainer = ({ children, defaultSize, size: propSize, onSizeChange }) => {
255
69
  const [size = DEFAULT_BLOCK_SIZE, setSize] = useControllableState({
@@ -257,11 +71,15 @@ var IntrinsicCardContainer = ({ children, defaultSize, size: propSize, onSizeCha
257
71
  defaultProp: defaultSize,
258
72
  onChange: onSizeChange
259
73
  });
260
- return /* @__PURE__ */ React3.createElement("div", {
261
- className: border,
74
+ return /* @__PURE__ */ React2.createElement("div", {
75
+ role: "none",
76
+ className: "relative p-2 grid overflow-hidden border-2 border-dashed border-green-500 rounded-lg",
262
77
  style: sizeStyle(size, "horizontal"),
263
78
  ...resizeAttributes
264
- }, children, /* @__PURE__ */ React3.createElement(ResizeHandle, {
79
+ }, /* @__PURE__ */ React2.createElement("div", {
80
+ role: "none",
81
+ className: "dx-container flex flex-col"
82
+ }, children), /* @__PURE__ */ React2.createElement(ResizeHandle, {
265
83
  side: "inline-end",
266
84
  fallbackSize: DEFAULT_BLOCK_SIZE,
267
85
  minSize: MIN_BLOCK_SIZE,
@@ -271,34 +89,49 @@ var IntrinsicCardContainer = ({ children, defaultSize, size: propSize, onSizeCha
271
89
  };
272
90
 
273
91
  // src/testing/DefaultStackTile.tsx
274
- import React4, { useRef as useRef2, useState as useState2 } from "react";
275
- import { Obj as Obj2 } from "@dxos/echo";
276
- import { Json as Json2 } from "@dxos/react-ui-syntax-highlighter";
92
+ import React3, { useMemo, useRef, useState } from "react";
93
+ import { Obj } from "@dxos/echo";
94
+ import { Card, Toolbar } from "@dxos/react-ui";
95
+ import { Menu, createMenuAction } from "@dxos/react-ui-menu";
96
+ import { Json } from "@dxos/react-ui-syntax-highlighter";
277
97
  var DefaultStackTile = (props) => {
278
- const dragHandleRef = useRef2(null);
279
- const [open, setOpen] = useState2(false);
280
- return /* @__PURE__ */ React4.createElement(Mosaic.Tile, {
98
+ const dragHandleRef = useRef(null);
99
+ const [open, setOpen] = useState(false);
100
+ const menuItems = useMemo(() => [
101
+ createMenuAction("toggle-details", () => setOpen((prev) => !prev), {
102
+ label: open ? "Hide details" : "Show details",
103
+ icon: "ph--placeholder--regular"
104
+ })
105
+ ], [
106
+ open
107
+ ]);
108
+ return /* @__PURE__ */ React3.createElement(Menu.Root, null, /* @__PURE__ */ React3.createElement(Mosaic.Tile, {
281
109
  ...props,
282
- className: "border border-separator rounded-sm font-mono"
283
- }, /* @__PURE__ */ React4.createElement(Card.Toolbar, null, /* @__PURE__ */ React4.createElement(Card.DragHandle, {
110
+ asChild: true
111
+ }, /* @__PURE__ */ React3.createElement(Focus.Item, {
112
+ asChild: true
113
+ }, /* @__PURE__ */ React3.createElement(Card.Root, {
114
+ className: "dx-current dx-hover"
115
+ }, /* @__PURE__ */ React3.createElement(Card.Toolbar, null, /* @__PURE__ */ React3.createElement(Card.DragHandle, {
284
116
  ref: dragHandleRef
285
- }), /* @__PURE__ */ React4.createElement(Card.Title, null, Obj2.getLabel(props.data) ?? props.data.id), /* @__PURE__ */ React4.createElement(Card.Menu, {
286
- items: [
287
- {
288
- label: open ? "Hide details" : "Show details",
289
- onClick: () => setOpen((open2) => !open2)
290
- }
291
- ]
292
- })), open && /* @__PURE__ */ React4.createElement(Card.Row, null, /* @__PURE__ */ React4.createElement(Json2, {
117
+ }), /* @__PURE__ */ React3.createElement(Card.Title, null, Obj.getLabel(props.data) ?? props.data.id), /* @__PURE__ */ React3.createElement(Menu.Trigger, {
118
+ asChild: true,
119
+ disabled: !menuItems?.length
120
+ }, /* @__PURE__ */ React3.createElement(Toolbar.IconButton, {
121
+ iconOnly: true,
122
+ variant: "ghost",
123
+ icon: "ph--dots-three-vertical--regular",
124
+ label: "Menu"
125
+ })), /* @__PURE__ */ React3.createElement(Menu.Content, {
126
+ items: menuItems
127
+ })), open && /* @__PURE__ */ React3.createElement(Card.Row, null, /* @__PURE__ */ React3.createElement(Json.Data, {
293
128
  data: props.data,
294
129
  classNames: "text-xs"
295
- })));
130
+ }))))));
296
131
  };
297
132
  DefaultStackTile.displayName = "DefaultStackTile";
298
133
  export {
299
- Board,
300
134
  CardContainer,
301
- Debug,
302
135
  DefaultStackTile,
303
136
  IntrinsicCardContainer,
304
137
  PopoverCardContainer,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../src/testing/decorator.tsx", "../../../../src/testing/Board.tsx", "../../../../src/testing/CardContainer.tsx", "../../../../src/testing/DefaultStackTile.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react-vite';\nimport React from 'react';\n\nimport { Mosaic } from '../components';\n\nexport const withMosaic = (): Decorator => {\n return (Story) => (\n <Mosaic.Root>\n <Story />\n </Mosaic.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as Schema from 'effect/Schema';\nimport React, { forwardRef, useMemo, useRef, useState } from 'react';\n\nimport { Obj, Ref, Type } from '@dxos/echo';\nimport { ObjectId } from '@dxos/keys';\nimport { useObject } from '@dxos/react-client/echo';\nimport { Tag, type ThemedClassName } from '@dxos/react-ui';\nimport { Json } from '@dxos/react-ui-syntax-highlighter';\nimport { getHashStyles, mx } from '@dxos/ui-theme';\n\nimport {\n Card,\n type CardMenuProps,\n Focus,\n Mosaic,\n type MosaicTileProps,\n type MosiacPlaceholderProps,\n mosaicStyles,\n useMosaic,\n} from '../components';\nimport { useContainerDebug, useEventHandlerAdapter } from '../hooks';\n\n//\n// Test Data\n//\n\nexport const TestItem = Schema.Struct({\n name: Schema.String,\n description: Schema.optional(Schema.String),\n label: Schema.optional(Schema.String),\n}).pipe(\n Type.object({\n typename: 'example.com/type/Item',\n version: '0.1.0',\n }),\n);\n\nexport interface TestItem extends Schema.Schema.Type<typeof TestItem> {}\n\nexport const TestColumn = Schema.Struct({\n id: ObjectId,\n items: Schema.mutable(Schema.Array(Type.Ref(TestItem))),\n}).pipe(\n Type.object({\n typename: 'example.com/type/Column',\n version: '0.1.0',\n }),\n);\n\nexport interface TestColumn extends Schema.Schema.Type<typeof TestColumn> {}\n\n//\n// Root\n//\n\ntype RootProps = {\n id: string;\n columns: TestColumn[];\n debug?: boolean;\n};\n\nconst Root = forwardRef<HTMLDivElement, RootProps>(({ id, columns, debug }, forwardedRef) => {\n const [DebugInfo, debugHandler] = useContainerDebug(debug);\n const [viewport, setViewport] = useState<HTMLElement | null>(null);\n\n const eventHandler = useEventHandlerAdapter({\n id,\n items: columns,\n getId: (data) => data.id,\n get: (data) => data,\n make: (object) => object,\n canDrop: ({ source }) => Obj.instanceOf(TestColumn, source.data),\n });\n\n return (\n <div\n role='none'\n className={mx('plb-2 grid bs-full is-full overflow-hidden', debug && 'grid-cols-[1fr_20rem] gap-2')}\n ref={forwardedRef}\n >\n <Focus.Group asChild axis='horizontal'>\n <Mosaic.Container\n asChild\n withFocus\n axis='horizontal'\n autoScroll={viewport}\n eventHandler={eventHandler}\n debug={debugHandler}\n >\n <Mosaic.Viewport axis='horizontal' padding viewportRef={setViewport}>\n <Mosaic.Stack axis='horizontal' items={columns} getId={(item) => item.id} Tile={Column} debug={debug} />\n </Mosaic.Viewport>\n </Mosaic.Container>\n </Focus.Group>\n <DebugInfo />\n </div>\n );\n});\n\n//\n// Column\n//\n\ntype ColumnProps = Pick<MosaicTileProps<TestColumn>, 'classNames' | 'location' | 'data' | 'debug'>;\n\nconst Column = forwardRef<HTMLDivElement, ColumnProps>(({ classNames, location, data, debug }, forwardedRef) => {\n const [column, updateColumn] = useObject(data);\n const [DebugInfo, debugHandler] = useContainerDebug(debug);\n const dragHandleRef = useRef<HTMLButtonElement>(null);\n const [viewport, setViewport] = useState<HTMLElement | null>(null);\n const eventHandler = useEventHandlerAdapter<Ref.Unknown>({\n id: data.id,\n items: column.items,\n getId: (data) => data.dxn.toString(),\n get: (data) => data.target!,\n make: (object) => Ref.make(object),\n canDrop: ({ source }) => Obj.instanceOf(TestItem, source.data.target),\n onChange: (mutator) => updateColumn((column) => mutator(column.items)),\n });\n\n // Context menu.\n const menuItems = useMemo<NonNullable<CardMenuProps<TestItem>['items']>>(\n () => [\n {\n label: 'Delete',\n onClick: (obj) => {\n updateColumn((column) => {\n const idx = column.items.findIndex((item) => item.target?.id === obj?.id);\n if (idx !== -1) {\n column.items.splice(idx, 1);\n }\n });\n },\n },\n ],\n [updateColumn],\n );\n\n return (\n <Mosaic.Tile asChild dragHandle={dragHandleRef.current} location={location} id={data.id} data={data} debug={debug}>\n <Focus.Group asChild>\n <div\n className={mx(\n 'grid bs-full card-default-width overflow-hidden bg-deckSurface',\n debug ? 'grid-rows-[min-content_1fr_20rem]' : 'grid-rows-[min-content_1fr_min-content]',\n classNames,\n )}\n ref={forwardedRef}\n >\n <Card.Toolbar>\n <Card.DragHandle ref={dragHandleRef} />\n <Card.Title>{column.id}</Card.Title>\n <Card.Menu items={[]} />\n </Card.Toolbar>\n <Card.Context value={{ menuItems }}>\n <Mosaic.Container\n asChild\n withFocus\n axis='vertical'\n autoScroll={viewport}\n eventHandler={eventHandler}\n debug={debugHandler}\n >\n <Mosaic.Viewport axis='vertical' padding viewportRef={setViewport}>\n <Mosaic.Stack axis='vertical' items={column.items} getId={(data) => data.dxn.toString()} Tile={Item} />\n </Mosaic.Viewport>\n </Mosaic.Container>\n </Card.Context>\n <div role='none'>\n <div className='grow flex p-1 justify-center text-xs'>{column.items.length}</div>\n <DebugInfo />\n </div>\n </div>\n </Focus.Group>\n </Mosaic.Tile>\n );\n});\n\nColumn.displayName = 'Column';\n\n//\n// Item\n//\n\ntype ItemProps = Pick<MosaicTileProps<Ref.Ref<TestItem>>, 'classNames' | 'location' | 'data' | 'debug'>;\n\nconst Item = forwardRef<HTMLDivElement, ItemProps>(({ classNames, data: ref, location, debug }, forwardedRef) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const composedRef = useComposedRefs<HTMLDivElement>(rootRef, forwardedRef);\n const dragHandleRef = useRef<HTMLButtonElement>(null);\n const object = ref.target;\n if (!object) {\n return null;\n }\n\n return (\n <Mosaic.Tile\n asChild\n dragHandle={dragHandleRef.current}\n id={ref.dxn.toString()}\n data={ref}\n location={location}\n debug={debug}\n >\n <Focus.Group asChild>\n <Card.Root classNames={classNames} onClick={() => rootRef.current?.focus()} ref={composedRef}>\n <Card.Toolbar>\n <Card.DragHandle ref={dragHandleRef} />\n <Card.Title>{object.name}</Card.Title>\n <Card.Menu context={object} />\n </Card.Toolbar>\n <Card.Row icon='ph--note--regular' classNames='text-description'>\n {object.description}\n </Card.Row>\n <Card.Row icon='ph--tag--regular'>\n {object.label && (\n <div role='none' className='flex shrink-0 gap-1 text-xs items-center'>\n <Tag palette={getHashStyles(object.label).hue}>{object.label}</Tag>\n </div>\n )}\n </Card.Row>\n </Card.Root>\n </Focus.Group>\n </Mosaic.Tile>\n );\n});\n\nItem.displayName = 'Item';\n\n//\n// Placeholder\n//\n\nconst Placeholder = (props: MosiacPlaceholderProps<number>) => {\n return (\n <Mosaic.Placeholder {...props} classNames={mosaicStyles.placeholder.root}>\n <div\n className={mx(\n 'flex bs-full border border-dashed border-separator rounded-sm',\n mosaicStyles.placeholder.content,\n )}\n />\n </Mosaic.Placeholder>\n );\n};\n\nPlaceholder.displayName = 'Placeholder';\n\n//\n// Debug\n//\n\nexport const Debug = forwardRef<HTMLDivElement, ThemedClassName>(({ classNames }, forwardedRef) => {\n const { containers, dragging } = useMosaic(Debug.displayName!);\n const counter = useRef(0);\n return (\n <Json\n data={{ containers, dragging, count: counter.current++ }}\n classNames={mx('text-xs', classNames)}\n ref={forwardedRef}\n />\n );\n});\n\nDebug.displayName = 'Debug';\n\n//\n// Board\n//\n\nexport const Board = { Root, Column, Item, Placeholder, Debug };\n\nexport type { RootProps, ColumnProps, ItemProps };\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { Icon, Popover } from '@dxos/react-ui';\nimport { ResizeHandle, type Size, resizeAttributes, sizeStyle } from '@dxos/react-ui-dnd';\n\nconst DEFAULT_BLOCK_SIZE = 22;\nconst MIN_BLOCK_SIZE = 8;\n\n//\n// Card container.\n//\n\nexport const CardContainer = ({\n children,\n icon = 'ph--placeholder--regular',\n role,\n}: PropsWithChildren<{ icon?: string; role?: string }>) => {\n switch (role) {\n case 'card--popover':\n return <PopoverCardContainer icon={icon}>{children}</PopoverCardContainer>;\n case 'card--intrinsic':\n default:\n return <IntrinsicCardContainer>{children}</IntrinsicCardContainer>;\n }\n};\n\nconst border = 'relative border border-dashed border-subduedSeparator p-4 rounded-lg overflow-x-auto';\n\n//\n// Popover\n//\n\nexport type PopoverCardContainerProps = PropsWithChildren<{ icon?: string }>;\n\nexport const PopoverCardContainer = ({ children, icon = 'ph--placeholder--regular' }: PopoverCardContainerProps) => {\n return (\n <Popover.Root open>\n <Popover.Content onOpenAutoFocus={(event) => event.preventDefault()}>\n <Popover.Viewport classNames='popover-card-width'>{children}</Popover.Viewport>\n <Popover.Arrow />\n </Popover.Content>\n <Popover.Trigger asChild>\n <Icon icon={icon} size={5} />\n </Popover.Trigger>\n </Popover.Root>\n );\n};\n\n//\n// Intrinsic card container (size constrained by card).\n//\n\nexport type IntrinsicCardContainerProps = PropsWithChildren<{\n defaultSize?: Size;\n size?: Size;\n onSizeChange?: (size: Size, commit?: boolean) => void;\n}>;\n\nexport const IntrinsicCardContainer = ({\n children,\n defaultSize,\n size: propSize,\n onSizeChange,\n}: IntrinsicCardContainerProps) => {\n const [size = DEFAULT_BLOCK_SIZE, setSize] = useControllableState<Size>({\n prop: propSize,\n defaultProp: defaultSize,\n onChange: onSizeChange,\n });\n\n return (\n <div className={border} style={sizeStyle(size, 'horizontal')} {...resizeAttributes}>\n {children}\n <ResizeHandle\n side='inline-end'\n fallbackSize={DEFAULT_BLOCK_SIZE}\n minSize={MIN_BLOCK_SIZE}\n size={size}\n onSizeChange={setSize}\n />\n </div>\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { useRef, useState } from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { Json } from '@dxos/react-ui-syntax-highlighter';\n\nimport { Card, Mosaic, type StackTileComponent } from '../components';\n\nexport const DefaultStackTile: StackTileComponent<Obj.Any> = (props) => {\n const dragHandleRef = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n return (\n <Mosaic.Tile {...props} className='border border-separator rounded-sm font-mono'>\n <Card.Toolbar>\n <Card.DragHandle ref={dragHandleRef} />\n <Card.Title>{Obj.getLabel(props.data) ?? props.data.id}</Card.Title>\n <Card.Menu\n items={[\n {\n label: open ? 'Hide details' : 'Show details',\n onClick: () => setOpen((open) => !open),\n },\n ]}\n />\n </Card.Toolbar>\n {open && (\n <Card.Row>\n <Json data={props.data} classNames='text-xs' />\n </Card.Row>\n )}\n </Mosaic.Tile>\n );\n};\n\nDefaultStackTile.displayName = 'DefaultStackTile';\n"],
5
- "mappings": ";;;;;;;;;;;;AAKA,OAAOA,WAAW;AAIX,IAAMC,aAAa,MAAA;AACxB,SAAO,CAACC,UACN,sBAAA,cAACC,OAAOC,MAAI,MACV,sBAAA,cAACF,OAAAA,IAAAA,CAAAA;AAGP;;;ACXA,SAASG,uBAAuB;AAChC,YAAYC,YAAY;AACxB,OAAOC,UAASC,YAAYC,SAASC,QAAQC,gBAAgB;AAE7D,SAASC,KAAKC,KAAKC,YAAY;AAC/B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,WAAiC;AAC1C,SAASC,YAAY;AACrB,SAASC,eAAeC,UAAU;AAkB3B,IAAMC,WAAkBC,cAAO;EACpCC,MAAaC;EACbC,aAAoBC,gBAAgBF,aAAM;EAC1CG,OAA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K7C;AAEA1B,iBAAiB2B,cAAc;",
6
- "names": ["React", "withMosaic", "Story", "Mosaic", "Root", "useComposedRefs", "Schema", "React", "forwardRef", "useMemo", "useRef", "useState", "Obj", "Ref", "Type", "ObjectId", "useObject", "Tag", "Json", "getHashStyles", "mx", "TestItem", "Struct", "name", "String", "description", "optional", "label", "pipe", "Type", "object", "typename", "version", "TestColumn", "id", "ObjectId", "items", "mutable", "Array", "Ref", "Root", "forwardRef", "columns", "debug", "forwardedRef", "DebugInfo", "debugHandler", "useContainerDebug", "viewport", "setViewport", "useState", "eventHandler", "useEventHandlerAdapter", "getId", "data", "get", "make", "canDrop", "source", "Obj", "instanceOf", "React", "div", "role", "className", "mx", "ref", "Focus", "Group", "asChild", "axis", "Mosaic", "Container", "withFocus", "autoScroll", "Viewport", "padding", "viewportRef", "Stack", "item", "Tile", "Column", "classNames", "location", "column", "updateColumn", "useObject", "dragHandleRef", "useRef", "dxn", "toString", "target", "onChange", "mutator", "menuItems", "useMemo", "onClick", "obj", "idx", "findIndex", "splice", "dragHandle", "current", "Card", "Toolbar", "DragHandle", "Title", "Menu", "Context", "value", "Item", "length", "displayName", "rootRef", "composedRef", "useComposedRefs", "focus", "context", "Row", "icon", "Tag", "palette", "getHashStyles", "hue", "Placeholder", "props", "mosaicStyles", "placeholder", "root", "content", "Debug", "containers", "dragging", "useMosaic", "counter", "Json", "count", "Board", "useControllableState", "React", "Icon", "Popover", "ResizeHandle", "resizeAttributes", "sizeStyle", "DEFAULT_BLOCK_SIZE", "MIN_BLOCK_SIZE", "CardContainer", "children", "icon", "role", "React", "PopoverCardContainer", "IntrinsicCardContainer", "border", "Popover", "Root", "open", "Content", "onOpenAutoFocus", "event", "preventDefault", "Viewport", "classNames", "Arrow", "Trigger", "asChild", "Icon", "size", "defaultSize", "propSize", "onSizeChange", "setSize", "useControllableState", "prop", "defaultProp", "onChange", "div", "className", "style", "sizeStyle", "resizeAttributes", "ResizeHandle", "side", "fallbackSize", "minSize", "React", "useRef", "useState", "Obj", "Json", "DefaultStackTile", "props", "dragHandleRef", "useRef", "open", "setOpen", "useState", "React", "Mosaic", "Tile", "className", "Card", "Toolbar", "DragHandle", "ref", "Title", "Obj", "getLabel", "data", "id", "Menu", "items", "label", "onClick", "Row", "Json", "classNames", "displayName"]
3
+ "sources": ["../../../../src/testing/decorator.tsx", "../../../../src/testing/types.ts", "../../../../src/testing/CardContainer.tsx", "../../../../src/testing/DefaultStackTile.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react-vite';\nimport React from 'react';\n\nimport { Mosaic } from '../components';\n\nexport const withMosaic = (): Decorator => {\n return (Story) => (\n <Mosaic.Root>\n <Story />\n </Mosaic.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { ObjectId } from '@dxos/keys';\n\n//\n// Test Data\n//\n\nexport const TestItem = Schema.Struct({\n name: Schema.String,\n description: Schema.optional(Schema.String),\n label: Schema.optional(Schema.String),\n}).pipe(\n Type.object({\n typename: 'com.example.type.item',\n version: '0.1.0',\n }),\n);\n\nexport interface TestItem extends Schema.Schema.Type<typeof TestItem> {}\n\nexport const TestColumn = Schema.Struct({\n id: ObjectId,\n name: Schema.String,\n items: Schema.mutable(Schema.Array(Ref.Ref(TestItem))),\n}).pipe(\n Type.object({\n typename: 'com.example.type.column',\n version: '0.1.0',\n }),\n);\n\nexport interface TestColumn extends Schema.Schema.Type<typeof TestColumn> {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { Icon, Popover } from '@dxos/react-ui';\nimport { ResizeHandle, type Size, resizeAttributes, sizeStyle } from '@dxos/react-ui-dnd';\n\nconst DEFAULT_BLOCK_SIZE = 22;\nconst MIN_BLOCK_SIZE = 8;\n\n//\n// Card container.\n//\n\nexport type CardContainerProps = PropsWithChildren<{ role?: 'popover' | 'intrinsic'; icon?: string }>;\n\nexport const CardContainer = ({ children, role, icon = 'ph--arrow-line-down--regular' }: CardContainerProps) => {\n switch (role) {\n case 'popover':\n return (\n <div role='none' className='flex justify-center'>\n <PopoverCardContainer icon={icon}>{children}</PopoverCardContainer>\n </div>\n );\n case 'intrinsic':\n default:\n return <IntrinsicCardContainer>{children}</IntrinsicCardContainer>;\n }\n};\n\n//\n// Popover\n//\n\nexport type PopoverCardContainerProps = PropsWithChildren<{ icon?: string }>;\n\nexport const PopoverCardContainer = ({\n children,\n icon = 'ph--arrow-line-down--regular',\n}: PopoverCardContainerProps) => {\n return (\n <Popover.Root open>\n <Popover.Trigger asChild>\n <Icon icon={icon} />\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content onOpenAutoFocus={(event: Event) => event.preventDefault()}>\n <Popover.Viewport classNames='dx-card-popover'>{children}</Popover.Viewport>\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n\n//\n// Intrinsic card container (size constrained by card itself).\n//\n\nexport type IntrinsicCardContainerProps = PropsWithChildren<{\n defaultSize?: Size;\n size?: Size;\n onSizeChange?: (size: Size, commit?: boolean) => void;\n}>;\n\nexport const IntrinsicCardContainer = ({\n children,\n defaultSize,\n size: propSize,\n onSizeChange,\n}: IntrinsicCardContainerProps) => {\n const [size = DEFAULT_BLOCK_SIZE, setSize] = useControllableState<Size>({\n prop: propSize,\n defaultProp: defaultSize,\n onChange: onSizeChange,\n });\n\n return (\n <div\n role='none'\n className='relative p-2 grid overflow-hidden border-2 border-dashed border-green-500 rounded-lg'\n style={sizeStyle(size, 'horizontal')}\n {...resizeAttributes}\n >\n <div role='none' className='dx-container flex flex-col'>\n {children}\n </div>\n <ResizeHandle\n side='inline-end'\n fallbackSize={DEFAULT_BLOCK_SIZE}\n minSize={MIN_BLOCK_SIZE}\n size={size}\n onSizeChange={setSize}\n />\n </div>\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { useMemo, useRef, useState } from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { Card, Toolbar } from '@dxos/react-ui';\nimport { Menu, createMenuAction } from '@dxos/react-ui-menu';\nimport { Json } from '@dxos/react-ui-syntax-highlighter';\n\nimport { Focus, Mosaic, type MosaicStackTileComponent } from '../components';\n\nexport const DefaultStackTile: MosaicStackTileComponent<Obj.Any> = (props) => {\n const dragHandleRef = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n const menuItems = useMemo(\n () => [\n createMenuAction('toggle-details', () => setOpen((prev) => !prev), {\n label: open ? 'Hide details' : 'Show details',\n icon: 'ph--placeholder--regular',\n }),\n ],\n [open],\n );\n\n return (\n <Menu.Root>\n <Mosaic.Tile {...props} asChild>\n <Focus.Item asChild>\n <Card.Root className='dx-current dx-hover'>\n <Card.Toolbar>\n <Card.DragHandle ref={dragHandleRef} />\n <Card.Title>{Obj.getLabel(props.data) ?? props.data.id}</Card.Title>\n <Menu.Trigger asChild disabled={!menuItems?.length}>\n <Toolbar.IconButton iconOnly variant='ghost' icon='ph--dots-three-vertical--regular' label='Menu' />\n </Menu.Trigger>\n <Menu.Content items={menuItems} />\n </Card.Toolbar>\n {open && (\n <Card.Row>\n <Json.Data data={props.data} classNames='text-xs' />\n </Card.Row>\n )}\n </Card.Root>\n </Focus.Item>\n </Mosaic.Tile>\n </Menu.Root>\n );\n};\n\nDefaultStackTile.displayName = 'DefaultStackTile';\n"],
5
+ "mappings": ";;;;;;;AAKA,OAAOA,WAAW;AAIX,IAAMC,aAAa,MAAA;AACxB,SAAO,CAACC,UACN,sBAAA,cAACC,OAAOC,MAAI,MACV,sBAAA,cAACF,OAAAA,IAAAA,CAAAA;AAGP;;;ACXA,YAAYG,YAAY;AAExB,SAASC,KAAKC,YAAY;AAC1B,SAASC,gBAAgB;AAMlB,IAAMC,WAAkBC,cAAO;EACpCC,MAAaC;EACbC,aAAoBC,gBAAgBF,aA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AAKG,YAAU;IAACC,KAAKvB;MACtB,gBAAAW,OAAA,cAACQ,KAAKK,OAAK,MAAEC,IAAIC,SAAS3B,MAAM4B,IAAI,KAAK5B,MAAM4B,KAAKC,EAAE,GACtD,gBAAAjB,OAAA,cAACC,KAAKiB,SAAO;IAACb,SAAAA;IAAQc,UAAU,CAACzB,WAAW0B;KAC1C,gBAAApB,OAAA,cAACU,QAAQW,YAAU;IAACC,UAAAA;IAASC,SAAQ;IAAQxB,MAAK;IAAmCD,OAAM;OAE7F,gBAAAE,OAAA,cAACC,KAAKuB,SAAO;IAACC,OAAO/B;OAEtBH,QACC,gBAAAS,OAAA,cAACQ,KAAKkB,KAAG,MACP,gBAAA1B,OAAA,cAAC2B,KAAKC,MAAI;IAACZ,MAAM5B,MAAM4B;IAAMa,YAAW;;AAQxD;AAEA1C,iBAAiB2C,cAAc;",
6
+ "names": ["React", "withMosaic", "Story", "Mosaic", "Root", "Schema", "Ref", "Type", "ObjectId", "TestItem", "Struct", "name", "String", "description", "optional", "label", "pipe", "Type", "object", "typename", "version", "TestColumn", "id", "ObjectId", "items", "mutable", "Array", "Ref", "useControllableState", "React", "Icon", "Popover", "ResizeHandle", "resizeAttributes", "sizeStyle", "DEFAULT_BLOCK_SIZE", "MIN_BLOCK_SIZE", "CardContainer", "children", "role", "icon", "React", "div", "className", "PopoverCardContainer", "IntrinsicCardContainer", "Popover", "Root", "open", "Trigger", "asChild", "Icon", "Portal", "Content", "onOpenAutoFocus", "event", "preventDefault", "Viewport", "classNames", "Arrow", "defaultSize", "size", "propSize", "onSizeChange", "setSize", "useControllableState", "prop", "defaultProp", "onChange", "style", "sizeStyle", "resizeAttributes", "ResizeHandle", "side", "fallbackSize", "minSize", "React", "useMemo", "useRef", "useState", "Obj", "Card", "Toolbar", "Menu", "createMenuAction", "Json", "DefaultStackTile", "props", "dragHandleRef", "useRef", "open", "setOpen", "useState", "menuItems", "useMemo", "createMenuAction", "prev", "label", "icon", "React", "Menu", "Root", "Mosaic", "Tile", "asChild", "Focus", "Item", "Card", "className", "Toolbar", "DragHandle", "ref", "Title", "Obj", "getLabel", "data", "id", "Trigger", "disabled", "length", "IconButton", "iconOnly", "variant", "Content", "items", "Row", "Json", "Data", "classNames", "displayName"]
7
7
  }
@@ -0,0 +1,88 @@
1
+ import { type Atom } from '@effect-atom/atom-react';
2
+ import React, { type PropsWithChildren, type ReactElement, type Ref as ReactRef } from 'react';
3
+ import { type ThemedClassName } from '@dxos/react-ui';
4
+ import { type GetId, type MosaicEventHandler, type MosaicPlaceholderProps, type MosaicStackProps } from '../Mosaic';
5
+ import { type BoardColumnProps, useBoardColumn } from './Column';
6
+ import { type BoardItemProps } from './Item';
7
+ export interface BoardModel<TColumn = any, TItem = any> {
8
+ getColumnId: GetId<TColumn>;
9
+ getItemId: GetId<TItem>;
10
+ isColumn: (obj: unknown) => obj is TColumn;
11
+ isItem: (obj: unknown) => obj is TItem;
12
+ columns: Atom.Atom<readonly TColumn[] | TColumn[]>;
13
+ items: (column: TColumn) => Atom.Atom<TItem[]>;
14
+ getColumns: () => TColumn[];
15
+ getItems: (column: TColumn) => TItem[];
16
+ onColumnCreate?: () => Promise<TColumn>;
17
+ onColumnDelete?: (column: TColumn) => void;
18
+ onItemCreate?: (column: TColumn) => Promise<TItem>;
19
+ onItemDelete?: (column: TColumn, item: TItem) => void;
20
+ }
21
+ type BoardContextValue<TColumn = any, TItem = any> = {
22
+ model: BoardModel<TColumn, TItem>;
23
+ };
24
+ /** Hook to read the board model from context (e.g. in custom column tiles). Pass TColumn and TItem for typed model. */
25
+ declare function useBoard<TColumn = any, TItem = any>(displayName?: string): BoardContextValue<TColumn, TItem>;
26
+ type BoardRootProps<TColumn = any, TItem = any> = PropsWithChildren<BoardContextValue<TColumn, TItem>>;
27
+ type BoardContentProps<TColumn = any> = ThemedClassName<{
28
+ id: string;
29
+ debug?: boolean;
30
+ eventHandler?: MosaicEventHandler<TColumn>;
31
+ Tile?: MosaicStackProps<TColumn>['Tile'];
32
+ }>;
33
+ export declare const BoardDebug: React.ForwardRefExoticComponent<Omit<{}, "className"> & {
34
+ classNames?: import("@dxos/ui-types").ClassNameValue;
35
+ } & React.RefAttributes<HTMLDivElement>>;
36
+ export declare const Board: {
37
+ Root: <TColumn = any, TItem = any>(props: BoardRootProps<TColumn, TItem>) => ReactElement;
38
+ Content: <TColumn = any>(props: BoardContentProps<TColumn> & {
39
+ ref?: ReactRef<HTMLDivElement>;
40
+ }) => ReactElement;
41
+ Column: {
42
+ Root: <TColumn = unknown>(props: (BoardColumnProps<TColumn> & {
43
+ children?: React.ReactNode | undefined;
44
+ } & {
45
+ dragHandleRef?: React.RefObject<HTMLButtonElement | null>;
46
+ }) & {
47
+ ref?: ReactRef<HTMLDivElement>;
48
+ }) => ReactElement;
49
+ Header: React.ForwardRefExoticComponent<Omit<{
50
+ label: string;
51
+ dragHandleRef: ReactRef<HTMLButtonElement>;
52
+ }, "className"> & {
53
+ classNames?: import("@dxos/ui-types").ClassNameValue;
54
+ } & {
55
+ className?: string;
56
+ children?: React.ReactNode;
57
+ role?: string;
58
+ } & React.RefAttributes<HTMLDivElement>>;
59
+ Body: React.ForwardRefExoticComponent<Omit<Pick<BoardColumnProps<any>, "data"> & Pick<import("..").MosaicContainerProps, "debug" | "eventHandler"> & {
60
+ Tile?: MosaicStackProps<import("@dxos/echo/Obj").Unknown>["Tile"];
61
+ }, "className"> & {
62
+ classNames?: import("@dxos/ui-types").ClassNameValue;
63
+ } & {
64
+ className?: string;
65
+ children?: React.ReactNode;
66
+ role?: string;
67
+ } & React.RefAttributes<HTMLDivElement>>;
68
+ Footer: React.ForwardRefExoticComponent<Omit<{}, "className"> & {
69
+ classNames?: import("@dxos/ui-types").ClassNameValue;
70
+ } & {
71
+ data?: any;
72
+ onAdd?: () => void;
73
+ } & React.RefAttributes<HTMLDivElement>>;
74
+ };
75
+ Item: <TItem extends import("@dxos/echo/Obj").Unknown = any>(props: BoardItemProps<TItem> & {
76
+ ref?: ReactRef<HTMLDivElement>;
77
+ }) => ReactElement;
78
+ Placeholder: {
79
+ (props: MosaicPlaceholderProps<number>): React.JSX.Element;
80
+ displayName: string;
81
+ };
82
+ Debug: React.ForwardRefExoticComponent<Omit<{}, "className"> & {
83
+ classNames?: import("@dxos/ui-types").ClassNameValue;
84
+ } & React.RefAttributes<HTMLDivElement>>;
85
+ };
86
+ export { useBoard, useBoardColumn };
87
+ export type { BoardRootProps, BoardContentProps, BoardColumnProps, BoardItemProps };
88
+ //# sourceMappingURL=Board.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Board.d.ts","sourceRoot":"","sources":["../../../../../src/components/Board/Board.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAgB,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,GAAG,IAAI,QAAQ,EAIrB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMlE,OAAO,EACL,KAAK,KAAK,EAEV,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EAGtB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAe,KAAK,gBAAgB,EAAsB,cAAc,EAAE,MAAM,UAAU,CAAC;AAClG,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAMxD,MAAM,WAAW,UAAU,CAAC,OAAO,GAAG,GAAG,EAAE,KAAK,GAAG,GAAG;IACpD,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,GAAG,IAAI,OAAO,CAAC;IAC3C,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,GAAG,IAAI,KAAK,CAAC;IACvC,OAAO,EAAE,I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I,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;CAC1C,CAAC,CAAC;AAgEH,eAAO,MAAM,UAAU;;wCAUrB,CAAC;AAQH,eAAO,MAAM,KAAK;WA/FmB,OAAO,QAAQ,KAAK,eAAe,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,YAAY;cAiD5E,OAAO,eACzC,iBAAiB,CAAC,OAAO,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAA;KAAE,KACnE,YAAY;;;;;;;eA3BV,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAYmB,CAAC;;;gBAuBK,sBAAsB,CAAC,MAAM,CAAC;;;;;;CA2C9D,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AAEpC,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { type StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ type DefaultStoryProps = {
4
+ columns?: number;
5
+ items?: (column: number) => number;
6
+ debug?: boolean;
7
+ };
8
+ declare const meta: {
9
+ title: string;
10
+ render: ({ debug }: DefaultStoryProps) => React.JSX.Element;
11
+ decorators: import("@storybook/react").Decorator[];
12
+ parameters: {
13
+ layout: string;
14
+ translations: [{
15
+ readonly 'en-US': {
16
+ readonly "@dxos/react-ui-mosaic": {
17
+ readonly 'action-menu.label': "Actions";
18
+ readonly 'add-item.label': "Add item";
19
+ readonly 'delete-menu.label': "Delete";
20
+ };
21
+ };
22
+ }];
23
+ };
24
+ argTypes: {
25
+ columns: {
26
+ control: "number";
27
+ };
28
+ debug: {
29
+ control: "boolean";
30
+ };
31
+ };
32
+ };
33
+ export default meta;
34
+ type Story = StoryObj<typeof meta>;
35
+ export declare const Default: Story;
36
+ export declare const SingleColumn: Story;
37
+ export declare const Empty: Story;
38
+ export declare const EmptyColumn: Story;
39
+ export declare const Debug: Story;
40
+ export declare const Spec: Story;
41
+ //# sourceMappingURL=Board.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Board.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Board/Board.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAA8B,MAAM,OAAO,CAAC;AA8CnD,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAsIF,QAAA,MAAM,IAAI;;wBAxB+B,iBAAiB;;;;;;;;;;;;;;;;;;;;;;CAqDrB,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAAU,CAAC;AAE/B,eAAO,MAAM,WAAW,EAAE,KAIzB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAkBlB,CAAC"}