@dxos/react-ui-mosaic 0.8.4-main.ef1bc66f44 → 0.8.4-main.fcc0d83b33

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 (155) hide show
  1. package/dist/lib/browser/chunk-HOLJERCP.mjs +957 -0
  2. package/dist/lib/browser/chunk-HOLJERCP.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +368 -219
  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 +57 -34
  9. package/dist/lib/browser/testing/index.mjs.map +3 -3
  10. package/dist/lib/browser/translations.mjs +18 -0
  11. package/dist/lib/browser/translations.mjs.map +7 -0
  12. package/dist/lib/node-esm/chunk-RNSOVDUU.mjs +959 -0
  13. package/dist/lib/node-esm/chunk-RNSOVDUU.mjs.map +7 -0
  14. package/dist/lib/node-esm/index.mjs +368 -219
  15. package/dist/lib/node-esm/index.mjs.map +4 -4
  16. package/dist/lib/node-esm/meta.json +1 -1
  17. package/dist/lib/node-esm/playwright/index.mjs +150 -0
  18. package/dist/lib/node-esm/playwright/index.mjs.map +7 -0
  19. package/dist/lib/node-esm/testing/index.mjs +57 -34
  20. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  21. package/dist/lib/node-esm/translations.mjs +20 -0
  22. package/dist/lib/node-esm/translations.mjs.map +7 -0
  23. package/dist/types/src/components/Board/Board.d.ts +50 -27
  24. package/dist/types/src/components/Board/Board.d.ts.map +1 -1
  25. package/dist/types/src/components/Board/Board.stories.d.ts +10 -4
  26. package/dist/types/src/components/Board/Board.stories.d.ts.map +1 -1
  27. package/dist/types/src/components/Board/Column.d.ts +31 -20
  28. package/dist/types/src/components/Board/Column.d.ts.map +1 -1
  29. package/dist/types/src/components/Board/Item.d.ts +5 -2
  30. package/dist/types/src/components/Board/Item.d.ts.map +1 -1
  31. package/dist/types/src/components/Focus/Focus.d.ts +1 -25
  32. package/dist/types/src/components/Focus/Focus.d.ts.map +1 -1
  33. package/dist/types/src/components/Focus/index.d.ts +0 -1
  34. package/dist/types/src/components/Focus/index.d.ts.map +1 -1
  35. package/dist/types/src/components/Mosaic/Container.d.ts +45 -0
  36. package/dist/types/src/components/Mosaic/Container.d.ts.map +1 -0
  37. package/dist/types/src/components/Mosaic/Mosaic.d.ts +31 -120
  38. package/dist/types/src/components/Mosaic/Mosaic.d.ts.map +1 -1
  39. package/dist/types/src/components/Mosaic/Placeholder.d.ts +21 -0
  40. package/dist/types/src/components/Mosaic/Placeholder.d.ts.map +1 -0
  41. package/dist/types/src/components/Mosaic/Root.d.ts +35 -0
  42. package/dist/types/src/components/Mosaic/Root.d.ts.map +1 -0
  43. package/dist/types/src/components/Mosaic/Stack.d.ts +29 -0
  44. package/dist/types/src/components/Mosaic/Stack.d.ts.map +1 -0
  45. package/dist/types/src/components/Mosaic/Stack.stories.d.ts +20 -0
  46. package/dist/types/src/components/Mosaic/Stack.stories.d.ts.map +1 -0
  47. package/dist/types/src/components/Mosaic/Tile.d.ts +53 -0
  48. package/dist/types/src/components/Mosaic/Tile.d.ts.map +1 -0
  49. package/dist/types/src/components/Mosaic/extension.d.ts.map +1 -1
  50. package/dist/types/src/components/Mosaic/styles.d.ts.map +1 -1
  51. package/dist/types/src/components/Mosaic/types.d.ts +9 -0
  52. package/dist/types/src/components/Mosaic/types.d.ts.map +1 -1
  53. package/dist/types/src/components/index.d.ts +0 -3
  54. package/dist/types/src/components/index.d.ts.map +1 -1
  55. package/dist/types/src/hooks/index.d.ts +1 -0
  56. package/dist/types/src/hooks/index.d.ts.map +1 -1
  57. package/dist/types/src/hooks/useContainerDebug.d.ts.map +1 -1
  58. package/dist/types/src/hooks/useDefaultColumnEventHandler.d.ts +15 -0
  59. package/dist/types/src/hooks/useDefaultColumnEventHandler.d.ts.map +1 -0
  60. package/dist/types/src/hooks/useEventHandlerAdapter.d.ts +2 -2
  61. package/dist/types/src/hooks/useEventHandlerAdapter.d.ts.map +1 -1
  62. package/dist/types/src/hooks/useVisibleItems.d.ts +2 -2
  63. package/dist/types/src/hooks/useVisibleItems.d.ts.map +1 -1
  64. package/dist/types/src/playwright/board-manager.d.ts +45 -0
  65. package/dist/types/src/playwright/board-manager.d.ts.map +1 -0
  66. package/dist/types/src/playwright/index.d.ts +9 -0
  67. package/dist/types/src/playwright/index.d.ts.map +1 -0
  68. package/dist/types/src/playwright/playwright.config.d.ts +3 -0
  69. package/dist/types/src/playwright/playwright.config.d.ts.map +1 -0
  70. package/dist/types/src/playwright/smoke.spec.d.ts +2 -0
  71. package/dist/types/src/playwright/smoke.spec.d.ts.map +1 -0
  72. package/dist/types/src/testing/CardContainer.d.ts +4 -3
  73. package/dist/types/src/testing/CardContainer.d.ts.map +1 -1
  74. package/dist/types/src/testing/DefaultStackTile.d.ts +2 -2
  75. package/dist/types/src/testing/DefaultStackTile.d.ts.map +1 -1
  76. package/dist/types/src/testing/types.d.ts +3 -3
  77. package/dist/types/src/testing/types.d.ts.map +1 -1
  78. package/dist/types/src/translations.d.ts +3 -2
  79. package/dist/types/src/translations.d.ts.map +1 -1
  80. package/dist/types/tsconfig.tsbuildinfo +1 -1
  81. package/package.json +44 -28
  82. package/src/AUDIT.md +106 -0
  83. package/src/components/Board/Board.stories.tsx +162 -45
  84. package/src/components/Board/Board.tsx +97 -73
  85. package/src/components/Board/Column.tsx +173 -124
  86. package/src/components/Board/Item.tsx +79 -43
  87. package/src/components/Focus/Focus.tsx +2 -91
  88. package/src/components/Focus/index.ts +0 -2
  89. package/src/components/Mosaic/Container.tsx +315 -0
  90. package/src/components/Mosaic/Mosaic.tsx +35 -914
  91. package/src/components/Mosaic/Placeholder.tsx +133 -0
  92. package/src/components/Mosaic/Root.tsx +286 -0
  93. package/src/components/Mosaic/Stack.stories.tsx +175 -0
  94. package/src/components/Mosaic/Stack.tsx +341 -0
  95. package/src/components/Mosaic/Tile.tsx +247 -0
  96. package/src/components/Mosaic/extension.ts +1 -1
  97. package/src/components/Mosaic/styles.ts +8 -8
  98. package/src/components/Mosaic/types.ts +16 -0
  99. package/src/components/index.ts +0 -3
  100. package/src/hooks/index.ts +1 -0
  101. package/src/hooks/useContainerDebug.tsx +2 -2
  102. package/src/hooks/useDefaultColumnEventHandler.ts +34 -0
  103. package/src/hooks/useEventHandlerAdapter.ts +16 -7
  104. package/src/hooks/useVisibleItems.ts +7 -2
  105. package/src/playwright/board-manager.ts +159 -0
  106. package/src/playwright/index.ts +13 -0
  107. package/src/playwright/playwright.config.ts +17 -0
  108. package/src/playwright/smoke.spec.ts +143 -0
  109. package/src/testing/CardContainer.tsx +23 -16
  110. package/src/testing/DefaultStackTile.tsx +37 -23
  111. package/src/testing/types.ts +4 -4
  112. package/src/translations.ts +3 -2
  113. package/dist/lib/browser/chunk-Y6GU2CCU.mjs +0 -1478
  114. package/dist/lib/browser/chunk-Y6GU2CCU.mjs.map +0 -7
  115. package/dist/lib/node-esm/chunk-KTLFCRVA.mjs +0 -1480
  116. package/dist/lib/node-esm/chunk-KTLFCRVA.mjs.map +0 -7
  117. package/dist/types/src/components/Card/Card.d.ts +0 -123
  118. package/dist/types/src/components/Card/Card.d.ts.map +0 -1
  119. package/dist/types/src/components/Card/Card.stories.d.ts +0 -21
  120. package/dist/types/src/components/Card/Card.stories.d.ts.map +0 -1
  121. package/dist/types/src/components/Card/CardDragPreview.d.ts +0 -6
  122. package/dist/types/src/components/Card/CardDragPreview.d.ts.map +0 -1
  123. package/dist/types/src/components/Card/index.d.ts +0 -4
  124. package/dist/types/src/components/Card/index.d.ts.map +0 -1
  125. package/dist/types/src/components/Card/styles.d.ts +0 -13
  126. package/dist/types/src/components/Card/styles.d.ts.map +0 -1
  127. package/dist/types/src/components/Focus/styles.d.ts +0 -6
  128. package/dist/types/src/components/Focus/styles.d.ts.map +0 -1
  129. package/dist/types/src/components/Image/Image.d.ts +0 -14
  130. package/dist/types/src/components/Image/Image.d.ts.map +0 -1
  131. package/dist/types/src/components/Image/Image.stories.d.ts +0 -33
  132. package/dist/types/src/components/Image/Image.stories.d.ts.map +0 -1
  133. package/dist/types/src/components/Image/index.d.ts +0 -2
  134. package/dist/types/src/components/Image/index.d.ts.map +0 -1
  135. package/dist/types/src/components/Stack/Stack.d.ts +0 -22
  136. package/dist/types/src/components/Stack/Stack.d.ts.map +0 -1
  137. package/dist/types/src/components/Stack/Stack.stories.d.ts +0 -9
  138. package/dist/types/src/components/Stack/Stack.stories.d.ts.map +0 -1
  139. package/dist/types/src/components/Stack/index.d.ts +0 -2
  140. package/dist/types/src/components/Stack/index.d.ts.map +0 -1
  141. package/dist/types/src/components/Stack/virtualizer.stories.d.ts +0 -12
  142. package/dist/types/src/components/Stack/virtualizer.stories.d.ts.map +0 -1
  143. package/src/components/Card/Card.stories.tsx +0 -148
  144. package/src/components/Card/Card.tsx +0 -458
  145. package/src/components/Card/CardDragPreview.tsx +0 -23
  146. package/src/components/Card/index.ts +0 -8
  147. package/src/components/Card/styles.ts +0 -23
  148. package/src/components/Focus/styles.ts +0 -21
  149. package/src/components/Image/Image.stories.tsx +0 -86
  150. package/src/components/Image/Image.tsx +0 -223
  151. package/src/components/Image/index.ts +0 -5
  152. package/src/components/Stack/Stack.stories.tsx +0 -119
  153. package/src/components/Stack/Stack.tsx +0 -219
  154. package/src/components/Stack/index.ts +0 -5
  155. package/src/components/Stack/virtualizer.stories.tsx +0 -143
@@ -0,0 +1,957 @@
1
+ // src/hooks/useVisibleItems.ts
2
+ import { useMemo } from "react";
3
+ var useVisibleItems = ({ id, items, dragging, getId }) => {
4
+ const visibleItems = useMemo(() => {
5
+ if (!items || !dragging || id !== dragging.containerId) {
6
+ return items ?? [];
7
+ }
8
+ const idx = items.findIndex((item) => getId(item) === dragging.id);
9
+ if (idx === -1) {
10
+ return items;
11
+ }
12
+ const visibleItems2 = items.slice();
13
+ visibleItems2.splice(idx, 1);
14
+ return visibleItems2;
15
+ }, [
16
+ id,
17
+ items,
18
+ dragging,
19
+ getId
20
+ ]);
21
+ return visibleItems;
22
+ };
23
+
24
+ // src/components/Focus/Focus.tsx
25
+ import { Focus, useFocus } from "@dxos/react-ui";
26
+
27
+ // src/components/Mosaic/styles.ts
28
+ var styles = {
29
+ placeholder: {
30
+ root: [
31
+ "group opacity-0",
32
+ 'group-data-[mosaic-debug="true"]:opacity-100',
33
+ 'group-data-[mosaic-debug="true"]:bg-orange-500',
34
+ "data-[mosaic-placeholder-state=active]:opacity-100",
35
+ "data-[mosaic-placeholder-orientation=vertical]:snap-start",
36
+ "data-[mosaic-placeholder-orientation=vertical]:py-1",
37
+ "data-[mosaic-placeholder-orientation=vertical]:data-[mosaic-placeholder-state=active]:py-2.5",
38
+ "data-[mosaic-placeholder-orientation=horizontal]:px-1",
39
+ "data-[mosaic-placeholder-orientation=horizontal]:data-[mosaic-placeholder-state=active]:px-2.5"
40
+ ],
41
+ content: [
42
+ "transition-all duration-0",
43
+ // TODO(burdon): Don't animate open if placeholder is the source.
44
+ // TODO(burdon): Flickers when start to drag since source is removed and then the placeholder shows up.
45
+ // - Use absolute positioning?
46
+ // 'group-data-[mosaic-placeholder-state=active]:duration-200',
47
+ "group-data-[mosaic-placeholder-orientation=vertical]:h-0",
48
+ "group-data-[mosaic-placeholder-orientation=vertical]:group-data-[mosaic-placeholder-state=active]:h-[var(--mosaic-placeholder-height)]",
49
+ "group-data-[mosaic-placeholder-orientation=horizontal]:w-0",
50
+ "group-data-[mosaic-placeholder-orientation=horizontal]:group-data-[mosaic-placeholder-state=active]:w-[var(--mosaic-placeholder-width)]"
51
+ ]
52
+ }
53
+ };
54
+
55
+ // src/components/Mosaic/types.ts
56
+ var getSourceData = (source) => {
57
+ return source.data.type === "tile" ? source.data : null;
58
+ };
59
+
60
+ // src/components/Mosaic/Root.tsx
61
+ import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
62
+ import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
63
+ import { useComposedRefs } from "@radix-ui/react-compose-refs";
64
+ import { createContext } from "@radix-ui/react-context";
65
+ import { Primitive } from "@radix-ui/react-primitive";
66
+ import { Slot } from "@radix-ui/react-slot";
67
+ import React, { forwardRef, useCallback, useEffect, useRef, useState } from "react";
68
+ import { log } from "@dxos/log";
69
+ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-mosaic/src/components/Mosaic/Root.tsx";
70
+ var [MosaicRootContextProvider, useMosaicRootContext] = createContext("MosaicRoot");
71
+ var MOSAIC_ROOT_NAME = "Mosaic.Root";
72
+ var MOSAIC_ROOT_DEBUG_ATTR = "mosaic-debug";
73
+ var MosaicRoot = /* @__PURE__ */ forwardRef(({ children, asChild, debug }, forwardedRef) => {
74
+ const rootRef = useRef(null);
75
+ const composedRef = useComposedRefs(rootRef, forwardedRef);
76
+ const Comp = asChild ? Slot : Primitive.div;
77
+ const [handlers, setHandlers] = useState({});
78
+ const [dragging, setDragging] = useState();
79
+ const getSourceHandler = useCallback((source) => {
80
+ const data = source.data;
81
+ return {
82
+ data,
83
+ handler: handlers[data.containerId]
84
+ };
85
+ }, [
86
+ handlers
87
+ ]);
88
+ const getTargetHandler = useCallback((location) => {
89
+ for (const target of location.current.dropTargets) {
90
+ const data = target.data;
91
+ let containerId;
92
+ switch (data.type) {
93
+ case "tile":
94
+ case "placeholder":
95
+ containerId = data.containerId;
96
+ break;
97
+ case "container":
98
+ containerId = data.id;
99
+ break;
100
+ }
101
+ const handler = handlers[containerId];
102
+ if (handler) {
103
+ return {
104
+ data,
105
+ handler
106
+ };
107
+ }
108
+ }
109
+ return {};
110
+ }, [
111
+ handlers
112
+ ]);
113
+ useEffect(() => {
114
+ const handleChange = ({ source, location }) => {
115
+ const { data: sourceData } = getSourceHandler(source);
116
+ const { data: targetData, handler } = getTargetHandler(location);
117
+ setDragging((dragging2) => {
118
+ dragging2?.target?.handler?.onCancel?.();
119
+ return {
120
+ source: {
121
+ data: sourceData,
122
+ handler: handlers[sourceData.containerId],
123
+ // TODO(burdon): Check id matches.
124
+ container: location.initial.dropTargets.find((target) => target.data.type === "container")?.element
125
+ },
126
+ target: targetData && {
127
+ data: targetData,
128
+ handler
129
+ }
130
+ };
131
+ });
132
+ };
133
+ const handleCancel = () => {
134
+ setDragging((dragging2) => {
135
+ requestAnimationFrame(() => {
136
+ dragging2?.target?.handler?.onCancel?.();
137
+ dragging2?.source?.container?.dispatchEvent(new CustomEvent("dnd:cancel", {
138
+ bubbles: true
139
+ }));
140
+ });
141
+ return void 0;
142
+ });
143
+ };
144
+ let noTargetTimeout;
145
+ return combine(monitorForElements({
146
+ /**
147
+ * Dragging started within any container.
148
+ */
149
+ onDragStart: ({ source, location }) => {
150
+ log("Root.onDragStart", {
151
+ source: source.data,
152
+ location: location.current.dropTargets.map((target) => target.data)
153
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 96, S: void 0 });
154
+ handleChange({
155
+ source,
156
+ location
157
+ });
158
+ },
159
+ /**
160
+ * Dragging entered a new container.
161
+ */
162
+ onDropTargetChange: ({ source, location }) => {
163
+ clearTimeout(noTargetTimeout);
164
+ log("Root.onDropTargetChange", {
165
+ source: source.data,
166
+ location: location.current.dropTargets.map((target) => target.data)
167
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 109, S: void 0 });
168
+ if (location.current.dropTargets.length === 0) {
169
+ noTargetTimeout = setTimeout(() => setDragging(void 0), 1e3);
170
+ } else {
171
+ handleChange({
172
+ source,
173
+ location
174
+ });
175
+ }
176
+ },
177
+ /**
178
+ * Dragging within any container.
179
+ */
180
+ onDrag: ({ source, location }) => {
181
+ const { data } = getSourceHandler(source);
182
+ const { handler } = getTargetHandler(location);
183
+ if (handler) {
184
+ const { clientX: x, clientY: y } = location.current.input;
185
+ handler.onDrag?.({
186
+ source: data,
187
+ position: {
188
+ x,
189
+ y
190
+ }
191
+ });
192
+ }
193
+ },
194
+ /**
195
+ * Dragging ended.
196
+ */
197
+ onDrop: ({ source, location }) => {
198
+ log.info("Root.onDrop", {
199
+ source: source.data,
200
+ location: location.current.dropTargets.map((target) => target.data)
201
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 142, S: void 0 });
202
+ const { data: sourceData, handler: sourceHandler } = getSourceHandler(source);
203
+ if (!sourceHandler) {
204
+ log.warn("invalid source", {
205
+ source: sourceData,
206
+ handlers: Object.keys(handlers)
207
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 149, S: void 0 });
208
+ return;
209
+ }
210
+ try {
211
+ if (location.current.dropTargets.length === 0) {
212
+ log.info("cancelled", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 163, S: void 0 });
213
+ } else {
214
+ const { data: targetData, handler: targetHandler } = getTargetHandler(location);
215
+ if (!targetHandler) {
216
+ log.warn("invalid target", {
217
+ source: sourceData,
218
+ location,
219
+ handlers: Object.keys(handlers)
220
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 168, S: void 0 });
221
+ return;
222
+ }
223
+ if (sourceHandler === targetHandler) {
224
+ targetHandler.onDrop?.({
225
+ source: sourceData,
226
+ target: targetData
227
+ });
228
+ } else {
229
+ if (!sourceHandler.onTake) {
230
+ log.warn("invalid source", {
231
+ source: sourceData
232
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 183, S: void 0 });
233
+ return;
234
+ }
235
+ sourceHandler.onTake?.({
236
+ source: sourceData
237
+ }, async (object) => {
238
+ targetHandler.onDrop?.({
239
+ source: {
240
+ ...sourceData,
241
+ data: object
242
+ },
243
+ target: targetData
244
+ });
245
+ return true;
246
+ });
247
+ }
248
+ }
249
+ } finally {
250
+ handleCancel();
251
+ }
252
+ }
253
+ }));
254
+ }, [
255
+ handlers,
256
+ getSourceHandler,
257
+ getTargetHandler
258
+ ]);
259
+ return /* @__PURE__ */ React.createElement(MosaicRootContextProvider, {
260
+ containers: handlers,
261
+ addContainer: (container) => setHandlers((containers) => ({
262
+ ...containers,
263
+ [container.id]: container
264
+ })),
265
+ removeContainer: (id) => setHandlers((containers) => {
266
+ delete containers[id];
267
+ return {
268
+ ...containers
269
+ };
270
+ }),
271
+ dragging
272
+ }, /* @__PURE__ */ React.createElement(Comp, {
273
+ className: "contents group",
274
+ [`data-${MOSAIC_ROOT_DEBUG_ATTR}`]: debug,
275
+ ref: composedRef
276
+ }, children));
277
+ });
278
+ MosaicRoot.displayName = MOSAIC_ROOT_NAME;
279
+
280
+ // src/components/Mosaic/Container.tsx
281
+ import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
282
+ import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
283
+ import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
284
+ import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
285
+ import { createContext as createContext2 } from "@radix-ui/react-context";
286
+ import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
287
+ import { Slot as Slot2 } from "@radix-ui/react-slot";
288
+ import { bind } from "bind-event-listener";
289
+ import React2, { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
290
+ import { composable, composableProps } from "@dxos/ui-theme";
291
+ import { isTruthy } from "@dxos/util";
292
+ var MOSAIC_CONTAINER_NAME = "Mosaic.Container";
293
+ var [MosaicContainerContextProvider, useMosaicContainerContext] = createContext2("MosaicContainer");
294
+ var MOSAIC_CONTAINER_STATE_ATTR = "mosaic-container-state";
295
+ var MOSAIC_CONTAINER_PLACEHOLDER_WIDTH = "--mosaic-placeholder-width";
296
+ var MOSAIC_CONTAINER_PLACEHOLDER_HEIGHT = "--mosaic-placeholder-height";
297
+ var counter = 0;
298
+ var MosaicContainer = composable(({ children, eventHandler: eventHandlerProp, orientation = "vertical", asChild, autoScroll: autoscrollElement, withFocus, currentId, onCurrentChange, debug, ...props }, forwardedRef) => {
299
+ const Comp = asChild ? Slot2 : Primitive2.div;
300
+ const rootRef = useRef2(null);
301
+ const composedRef = useComposedRefs2(rootRef, forwardedRef);
302
+ const eventHandler = useMemo2(() => eventHandlerProp ?? {
303
+ id: `mosaic-container-${counter++}`
304
+ }, [
305
+ eventHandlerProp
306
+ ]);
307
+ const { dragging } = useMosaicRootContext(MOSAIC_CONTAINER_NAME);
308
+ const [state, setState] = useState2({
309
+ type: "idle"
310
+ });
311
+ const [activeLocation, setActiveLocation] = useState2();
312
+ const [scrolling, setScrolling] = useState2(false);
313
+ const setCurrentId = useCallback2((id) => onCurrentChange?.(id), [
314
+ onCurrentChange
315
+ ]);
316
+ const scrollToRef = useRef2(void 0);
317
+ const registerScrollTo = useCallback2((fn) => {
318
+ scrollToRef.current = fn;
319
+ }, []);
320
+ useEffect2(() => {
321
+ if (currentId) {
322
+ scrollToRef.current?.(currentId);
323
+ }
324
+ }, [
325
+ currentId
326
+ ]);
327
+ const { setFocus } = useFocus();
328
+ useEffect2(() => {
329
+ if (withFocus) {
330
+ setFocus?.(state.type === "active" ? "active" : void 0);
331
+ }
332
+ }, [
333
+ setFocus,
334
+ withFocus,
335
+ state
336
+ ]);
337
+ const { addContainer, removeContainer } = useMosaicRootContext(eventHandler.id);
338
+ useEffect2(() => {
339
+ addContainer(eventHandler);
340
+ return () => removeContainer(eventHandler.id);
341
+ }, [
342
+ eventHandler
343
+ ]);
344
+ const data = useMemo2(() => ({
345
+ type: "container",
346
+ id: eventHandler.id
347
+ }), [
348
+ eventHandler.id
349
+ ]);
350
+ useEffect2(() => {
351
+ if (!rootRef.current) {
352
+ return;
353
+ }
354
+ let timeout;
355
+ const handleScroll = () => {
356
+ setScrolling(true);
357
+ clearTimeout(timeout);
358
+ timeout = setTimeout(() => {
359
+ setScrolling(false);
360
+ }, 500);
361
+ };
362
+ return combine2(...[
363
+ /**
364
+ * Custom event for dragging cancellation.
365
+ */
366
+ bind(rootRef.current, {
367
+ type: "dnd:cancel",
368
+ listener: () => {
369
+ setState({
370
+ type: "idle"
371
+ });
372
+ }
373
+ }),
374
+ // Target.
375
+ dropTargetForElements({
376
+ element: rootRef.current,
377
+ getData: () => data,
378
+ /**
379
+ * Test if permitted to drop here.
380
+ * NOTE: Contained Tile and Placeholder elements do the same.
381
+ */
382
+ canDrop: ({ source }) => {
383
+ const data2 = getSourceData(source);
384
+ return data2 && eventHandler.canDrop?.({
385
+ source: data2
386
+ }) || false;
387
+ },
388
+ // TODO(burdon): Provide semantic intent to onDrop.
389
+ // getDropEffect: () => {
390
+ // return 'move';
391
+ // },
392
+ /**
393
+ * Dragging started in this container.
394
+ */
395
+ onDragStart: ({ source }) => {
396
+ const sourceData = source.data;
397
+ setState({
398
+ type: "active",
399
+ bounds: sourceData.bounds
400
+ });
401
+ },
402
+ /**
403
+ * Dragging entered this container.
404
+ */
405
+ onDragEnter: ({ source }) => {
406
+ const sourceData = source.data;
407
+ setState({
408
+ type: "active",
409
+ bounds: sourceData.bounds
410
+ });
411
+ },
412
+ /**
413
+ * Dragging left this container.
414
+ * NOTE: If the container isn't full-height, then when the dragged item is temporarily removed the container will shrink,
415
+ * triggering `onDragLeave`, which then causes the item to be added and removed continually (flickering).
416
+ */
417
+ onDragLeave: ({ source }) => {
418
+ const sourceData = source.data;
419
+ if (sourceData.containerId !== eventHandler.id) {
420
+ setState({
421
+ type: "idle"
422
+ });
423
+ }
424
+ },
425
+ /**
426
+ * Dropped in this container.
427
+ */
428
+ onDrop: () => {
429
+ setState({
430
+ type: "idle"
431
+ });
432
+ }
433
+ }),
434
+ // Autoscroll.
435
+ // NOTE: When used with Scrollable we get a spurious warning (in dev mode).
436
+ // "Auto scrolling has been attached to an element that appears not to be scrollable."
437
+ autoscrollElement && [
438
+ autoScrollForElements({
439
+ element: autoscrollElement,
440
+ // canScroll: ({ element: _ }) => {
441
+ // return true;
442
+ // },
443
+ getAllowedAxis: () => orientation,
444
+ getConfiguration: () => ({
445
+ maxScrollSpeed: "fast"
446
+ })
447
+ }),
448
+ bind(autoscrollElement, {
449
+ type: "scroll",
450
+ listener: handleScroll
451
+ }),
452
+ () => setScrolling(false)
453
+ ]
454
+ ].filter(isTruthy).flatMap((x) => x));
455
+ }, [
456
+ rootRef,
457
+ eventHandler,
458
+ data,
459
+ autoscrollElement
460
+ ]);
461
+ return /* @__PURE__ */ React2.createElement(MosaicContainerContextProvider, {
462
+ id: eventHandler.id,
463
+ eventHandler,
464
+ orientation,
465
+ state,
466
+ dragging: state.type === "active" ? dragging : void 0,
467
+ scrolling,
468
+ activeLocation,
469
+ setActiveLocation,
470
+ currentId,
471
+ setCurrentId,
472
+ registerScrollTo
473
+ }, /* @__PURE__ */ React2.createElement(Comp, {
474
+ ...composableProps(props, {
475
+ classNames: "h-full",
476
+ style: {
477
+ [MOSAIC_CONTAINER_PLACEHOLDER_WIDTH]: state.type === "active" && state.bounds ? `${state.bounds.width}px` : "0px",
478
+ [MOSAIC_CONTAINER_PLACEHOLDER_HEIGHT]: state.type === "active" && state.bounds ? `${state.bounds.height}px` : "0px"
479
+ }
480
+ }),
481
+ [`data-${MOSAIC_CONTAINER_STATE_ATTR}`]: state.type,
482
+ ref: composedRef
483
+ }, children), debug?.());
484
+ });
485
+ MosaicContainer.displayName = MOSAIC_CONTAINER_NAME;
486
+
487
+ // src/components/Mosaic/Tile.tsx
488
+ import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
489
+ import { combine as combine3 } from "@atlaskit/pragmatic-drag-and-drop/combine";
490
+ import { draggable, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
491
+ import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
492
+ import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
493
+ import { composeRefs } from "@radix-ui/react-compose-refs";
494
+ import { createContext as createContext3 } from "@radix-ui/react-context";
495
+ import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
496
+ import { Slot as Slot3 } from "@radix-ui/react-slot";
497
+ import React3, { useLayoutEffect, useMemo as useMemo3, useRef as useRef3, useState as useState3 } from "react";
498
+ import { createPortal } from "react-dom";
499
+ import { composableProps as composableProps2, slottable } from "@dxos/ui-theme";
500
+ var MOSAIC_TILE_NAME = "Mosaic.Tile";
501
+ var [MosaicTileContextProvider, useMosaicTileContext] = createContext3("MosaicTile");
502
+ var MOSAIC_TILE_STATE_ATTR = "mosaic-tile-state";
503
+ var MosaicTile = slottable(({ children, asChild, dragHandle, allowedEdges: allowedEdgesProp, location, id, data: dataProp, draggable: draggableProp, current: _current, debug: _, ...props }, forwardedRef) => {
504
+ const Comp = asChild ? Slot3 : Primitive3.div;
505
+ const rootRef = useRef3(null);
506
+ const composedRef = composeRefs(rootRef, forwardedRef);
507
+ const { id: containerId, eventHandler, orientation, scrolling, setActiveLocation } = useMosaicContainerContext(MOSAIC_TILE_NAME);
508
+ const [state, setState] = useState3({
509
+ type: "idle"
510
+ });
511
+ const allowedEdges = useMemo3(() => allowedEdgesProp || (orientation === "vertical" ? [
512
+ "top",
513
+ "bottom"
514
+ ] : [
515
+ "left",
516
+ "right"
517
+ ]), [
518
+ allowedEdgesProp,
519
+ orientation
520
+ ]);
521
+ const data = useMemo3(() => ({
522
+ type: "tile",
523
+ id,
524
+ containerId,
525
+ data: dataProp,
526
+ location
527
+ }), [
528
+ containerId,
529
+ location,
530
+ dataProp
531
+ ]);
532
+ useLayoutEffect(() => {
533
+ const root = rootRef.current;
534
+ if (!draggableProp || !root || !containerId || scrolling) {
535
+ return;
536
+ }
537
+ const handleChange = ({ self, source }) => {
538
+ if (source.data.id !== dataProp.id) {
539
+ const closestEdge = extractClosestEdge(self.data);
540
+ const location2 = data.location + (closestEdge === "top" || closestEdge === "left" ? -0.5 : 0.5);
541
+ setActiveLocation(location2);
542
+ setState({
543
+ type: "target",
544
+ closestEdge
545
+ });
546
+ }
547
+ };
548
+ return combine3(
549
+ // Source.
550
+ draggable({
551
+ element: root,
552
+ dragHandle: dragHandle && state.type !== "preview" ? dragHandle : void 0,
553
+ canDrag: () => true,
554
+ getInitialData: () => data,
555
+ onGenerateDragPreview: ({ location: location2, nativeSetDragImage }) => {
556
+ setCustomNativeDragPreview({
557
+ nativeSetDragImage,
558
+ getOffset: preserveOffsetOnSource({
559
+ element: root,
560
+ input: location2.current.input
561
+ }),
562
+ render: ({ container }) => {
563
+ data.bounds = root.getBoundingClientRect();
564
+ setState({
565
+ type: "preview",
566
+ container,
567
+ rect: root.getBoundingClientRect()
568
+ });
569
+ return () => setState({
570
+ type: "dragging"
571
+ });
572
+ }
573
+ });
574
+ },
575
+ onDragStart: () => {
576
+ setState({
577
+ type: "dragging"
578
+ });
579
+ },
580
+ onDrop: () => {
581
+ setState({
582
+ type: "idle"
583
+ });
584
+ }
585
+ }),
586
+ // Target.
587
+ dropTargetForElements2({
588
+ element: root,
589
+ getData: ({ input, element }) => attachClosestEdge(data, {
590
+ input,
591
+ element,
592
+ allowedEdges
593
+ }),
594
+ canDrop: ({ source }) => {
595
+ const data2 = getSourceData(source);
596
+ return data2 && eventHandler.canDrop?.({
597
+ source: data2
598
+ }) || false;
599
+ },
600
+ onDragEnter: ({ self, source }) => {
601
+ handleChange({
602
+ self,
603
+ source
604
+ });
605
+ },
606
+ onDragLeave: () => {
607
+ setState({
608
+ type: "idle"
609
+ });
610
+ setActiveLocation(void 0);
611
+ },
612
+ onDrag: ({ self, source }) => {
613
+ handleChange({
614
+ self,
615
+ source
616
+ });
617
+ },
618
+ onDrop: () => {
619
+ setState({
620
+ type: "idle"
621
+ });
622
+ setActiveLocation(void 0);
623
+ }
624
+ })
625
+ );
626
+ }, [
627
+ rootRef,
628
+ forwardedRef,
629
+ containerId,
630
+ dragHandle,
631
+ eventHandler,
632
+ data,
633
+ scrolling,
634
+ allowedEdges,
635
+ setActiveLocation
636
+ ]);
637
+ const { className, ...rest } = composableProps2(props, {
638
+ classNames: "relative outline-none"
639
+ });
640
+ return /* @__PURE__ */ React3.createElement(MosaicTileContextProvider, {
641
+ state
642
+ }, /* @__PURE__ */ React3.createElement(Comp, {
643
+ ...rest,
644
+ "data-object-id": id,
645
+ [`data-${MOSAIC_TILE_STATE_ATTR}`]: state.type,
646
+ role: "listitem",
647
+ className,
648
+ ref: composedRef
649
+ }, children), state.type === "preview" && /* @__PURE__ */ createPortal(/* @__PURE__ */ React3.createElement(Comp, {
650
+ // NOTE: Use to control appearance while dragging.
651
+ [`data-${MOSAIC_TILE_STATE_ATTR}`]: state.type,
652
+ className,
653
+ style: {
654
+ width: `${state.rect.width}px`,
655
+ height: `${state.rect.height}px`
656
+ }
657
+ }, children), state.container));
658
+ });
659
+ MosaicTile.displayName = MOSAIC_TILE_NAME;
660
+
661
+ // src/components/Mosaic/Placeholder.tsx
662
+ import { DropIndicator as NaturalDropIndicator } from "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box";
663
+ import { dropTargetForElements as dropTargetForElements3 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
664
+ import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
665
+ import { Slot as Slot4 } from "@radix-ui/react-slot";
666
+ import React4, { useLayoutEffect as useLayoutEffect2, useMemo as useMemo4, useRef as useRef4 } from "react";
667
+ import { mx } from "@dxos/ui-theme";
668
+ var MOSAIC_PLACEHOLDER_NAME = "Mosaic.Placeholder";
669
+ var MOSAIC_PLACEHOLDER_ORIENTATION_ATTR = "mosaic-placeholder-orientation";
670
+ var MOSAIC_PLACEHOLDER_STATE_ATTR = "mosaic-placeholder-state";
671
+ var MosaicPlaceholder = ({ classNames, children, asChild, orientation = "vertical", location }) => {
672
+ const rootRef = useRef4(null);
673
+ const Comp = asChild ? Slot4 : Primitive4.div;
674
+ const { id: containerId, eventHandler, scrolling, activeLocation, setActiveLocation } = useMosaicContainerContext(MOSAIC_PLACEHOLDER_NAME);
675
+ const data = useMemo4(() => ({
676
+ type: "placeholder",
677
+ containerId,
678
+ location
679
+ }), [
680
+ containerId,
681
+ location
682
+ ]);
683
+ useLayoutEffect2(() => {
684
+ const root = rootRef.current;
685
+ if (!root || scrolling) {
686
+ return;
687
+ }
688
+ return dropTargetForElements3({
689
+ element: root,
690
+ getData: () => data,
691
+ canDrop: ({ source }) => {
692
+ const data2 = getSourceData(source);
693
+ return data2 && eventHandler.canDrop?.({
694
+ source: data2
695
+ }) || false;
696
+ },
697
+ onDragEnter: () => {
698
+ setActiveLocation(data.location);
699
+ },
700
+ onDragLeave: () => {
701
+ setActiveLocation(void 0);
702
+ },
703
+ onDrop: () => {
704
+ setActiveLocation(void 0);
705
+ }
706
+ });
707
+ }, [
708
+ rootRef,
709
+ data,
710
+ scrolling,
711
+ setActiveLocation
712
+ ]);
713
+ return /* @__PURE__ */ React4.createElement(Comp, {
714
+ [`data-${MOSAIC_PLACEHOLDER_ORIENTATION_ATTR}`]: orientation,
715
+ [`data-${MOSAIC_PLACEHOLDER_STATE_ATTR}`]: data.location === activeLocation ? "active" : "idle",
716
+ role: "none",
717
+ className: mx("relative", classNames),
718
+ ref: rootRef
719
+ }, children);
720
+ };
721
+ MosaicPlaceholder.displayName = MOSAIC_PLACEHOLDER_NAME;
722
+ var DROP_INDICATOR_NAME = "Mosaic.DropIndicator";
723
+ var MosaicDropIndicator = (props) => {
724
+ const { state } = useMosaicTileContext(DROP_INDICATOR_NAME);
725
+ return state.type === "target" && state.closestEdge ? /* @__PURE__ */ React4.createElement(NaturalDropIndicator, {
726
+ ...props,
727
+ edge: state.closestEdge
728
+ }) : null;
729
+ };
730
+ MosaicDropIndicator.displayName = DROP_INDICATOR_NAME;
731
+
732
+ // src/components/Mosaic/Stack.tsx
733
+ import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
734
+ import { useVirtualizer } from "@tanstack/react-virtual";
735
+ import React5, { forwardRef as forwardRef2, Fragment, useCallback as useCallback3, useEffect as useEffect3, useRef as useRef5 } from "react";
736
+ import { invariant } from "@dxos/invariant";
737
+ import { composable as composable2, composableProps as composableProps3, mx as mx2 } from "@dxos/ui-theme";
738
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-mosaic/src/components/Mosaic/Stack.tsx";
739
+ var MOSAIC_STACK_NAME = "MosaicStack";
740
+ var MosaicStackInner = composable2(({ orientation: orientationProp = "vertical", getId, items, scrollIntoView = true, Tile, draggable: draggable2 = true, debug, ...props }, forwardedRef) => {
741
+ const { id, orientation = orientationProp, dragging, currentId, registerScrollTo } = useMosaicContainerContext(MOSAIC_STACK_NAME);
742
+ const visibleItems = useVisibleItems({
743
+ id,
744
+ items,
745
+ dragging: dragging?.source.data,
746
+ getId
747
+ });
748
+ invariant(orientation === "vertical" || orientation === "horizontal", `Invalid orientation: ${orientation}`, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 45, S: void 0, A: ["orientation === 'vertical' || orientation === 'horizontal'", "`Invalid orientation: ${orientation}`"] });
749
+ const rootRef = useRef5(null);
750
+ const scrollToId = useCallback3((targetId) => {
751
+ if (!scrollIntoView) {
752
+ return;
753
+ }
754
+ const el = rootRef.current?.querySelector(`[data-object-id="${CSS.escape(targetId)}"]`);
755
+ el?.scrollIntoView({
756
+ block: "nearest",
757
+ behavior: "smooth"
758
+ });
759
+ }, [
760
+ scrollIntoView
761
+ ]);
762
+ useEffect3(() => {
763
+ registerScrollTo(scrollToId);
764
+ return () => registerScrollTo(void 0);
765
+ }, [
766
+ registerScrollTo,
767
+ scrollToId
768
+ ]);
769
+ const composedRef = useComposedRefs3(rootRef, forwardedRef);
770
+ return /* @__PURE__ */ React5.createElement("div", {
771
+ ...composableProps3(props, {
772
+ role: "list",
773
+ classNames: [
774
+ "flex",
775
+ orientation === "horizontal" && "h-full [&>*]:shrink-0",
776
+ orientation === "vertical" && "flex-col"
777
+ ]
778
+ }),
779
+ ref: composedRef
780
+ }, draggable2 && /* @__PURE__ */ React5.createElement(InternalPlaceholder, {
781
+ orientation,
782
+ location: 0.5
783
+ }), visibleItems?.map((item, index) => /* @__PURE__ */ React5.createElement(Fragment, {
784
+ key: getId(item)
785
+ }, /* @__PURE__ */ React5.createElement(Tile, {
786
+ id: getId(item),
787
+ data: item,
788
+ location: index + 1,
789
+ draggable: draggable2,
790
+ current: getId(item) === currentId,
791
+ debug
792
+ }), draggable2 && /* @__PURE__ */ React5.createElement(InternalPlaceholder, {
793
+ orientation,
794
+ location: index + 1.5
795
+ }))));
796
+ });
797
+ MosaicStackInner.displayName = MOSAIC_STACK_NAME;
798
+ var MosaicStack = MosaicStackInner;
799
+ var MOSAIC_VIRTUAL_STACK_NAME = "MosaicVirtualStack";
800
+ var MosaicVirtualStackInner = /* @__PURE__ */ forwardRef2(({ orientation = "vertical", getId, items, scrollIntoView = true, Tile, estimateSize, getScrollElement, overscan = 8, gap, onChange, draggable: draggable2 = true, debug, ...props }, forwardedRef) => {
801
+ invariant(Tile, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 101, S: void 0, A: ["Tile", ""] });
802
+ const { id, dragging, currentId, registerScrollTo } = useMosaicContainerContext(MOSAIC_VIRTUAL_STACK_NAME);
803
+ const visibleItems = useVisibleItems({
804
+ id,
805
+ items,
806
+ dragging: dragging?.source.data,
807
+ getId
808
+ });
809
+ const wrappedEstimateSize = draggable2 ? (index) => index % 2 === 0 ? 0 : estimateSize(Math.floor(index / 2)) : estimateSize;
810
+ const virtualizer = useVirtualizer({
811
+ // NOTE: When draggable we double the number of items to allow for placeholders.
812
+ count: draggable2 ? visibleItems.length * 2 + 1 : visibleItems.length,
813
+ estimateSize: wrappedEstimateSize,
814
+ gap,
815
+ // Key measurements by stable item ID so the size cache survives scrolling;
816
+ // without this, measurements are indexed by position and are lost when items reorder.
817
+ getItemKey: draggable2 ? (index) => index % 2 === 0 ? `ph-${index}` : getId(visibleItems[Math.floor(index / 2)]) : (index) => getId(visibleItems[index]),
818
+ getScrollElement,
819
+ overscan,
820
+ onChange
821
+ });
822
+ const scrollToId = useCallback3((targetId) => {
823
+ const itemIndex = visibleItems.findIndex((item) => getId(item) === targetId);
824
+ if (itemIndex >= 0) {
825
+ if (!scrollIntoView) {
826
+ return;
827
+ }
828
+ const virtualIndex = draggable2 ? itemIndex * 2 + 1 : itemIndex;
829
+ virtualizer.scrollToIndex(virtualIndex, {
830
+ align: "start",
831
+ behavior: "smooth"
832
+ });
833
+ }
834
+ }, [
835
+ visibleItems,
836
+ getId,
837
+ draggable2,
838
+ virtualizer,
839
+ scrollIntoView
840
+ ]);
841
+ useEffect3(() => {
842
+ registerScrollTo(scrollToId);
843
+ return () => registerScrollTo(void 0);
844
+ }, [
845
+ registerScrollTo,
846
+ scrollToId
847
+ ]);
848
+ const virtualItems = virtualizer.getVirtualItems();
849
+ const getData = (index) => {
850
+ if (draggable2) {
851
+ if (index % 2 === 0) {
852
+ return {
853
+ location: Math.floor(index / 2) + 0.5
854
+ };
855
+ } else {
856
+ return {
857
+ data: visibleItems[Math.floor(index / 2)],
858
+ location: Math.floor(index / 2) + 1
859
+ };
860
+ }
861
+ } else {
862
+ return {
863
+ data: visibleItems[index],
864
+ location: index + 1
865
+ };
866
+ }
867
+ };
868
+ return /* @__PURE__ */ React5.createElement("div", {
869
+ ...composableProps3(props, {
870
+ role: "list",
871
+ classNames: [
872
+ // shrink-0 is required: this div sets an explicit height via inline style (getTotalSize).
873
+ // Without it, a parent flex container (e.g. ScrollArea.Viewport) would shrink this div
874
+ // to the viewport height, collapsing the scroll content and causing scrollbar drift.
875
+ "flex shrink-0",
876
+ orientation === "horizontal" && "h-full [&>*]:shrink-0",
877
+ orientation === "vertical" && "flex-col"
878
+ ]
879
+ }),
880
+ style: {
881
+ position: "relative",
882
+ ...orientation === "vertical" ? {
883
+ width: "100%",
884
+ height: virtualizer.getTotalSize()
885
+ } : {
886
+ width: virtualizer.getTotalSize(),
887
+ height: "100%"
888
+ }
889
+ },
890
+ ref: forwardedRef
891
+ }, virtualItems.map(({ key, index, start }) => {
892
+ const { data, location } = getData(index);
893
+ return /* @__PURE__ */ React5.createElement("div", {
894
+ key,
895
+ "data-index": index,
896
+ style: {
897
+ position: "absolute",
898
+ top: 0,
899
+ left: 0,
900
+ ...orientation === "vertical" ? {
901
+ width: "100%",
902
+ transform: `translateY(${start}px)`
903
+ } : {
904
+ height: "100%",
905
+ transform: `translateX(${start}px)`
906
+ }
907
+ },
908
+ ref: virtualizer.measureElement
909
+ }, data ? /* @__PURE__ */ React5.createElement(Tile, {
910
+ id: getId(data),
911
+ data,
912
+ location,
913
+ draggable: draggable2,
914
+ current: getId(data) === currentId,
915
+ debug
916
+ }) : /* @__PURE__ */ React5.createElement(InternalPlaceholder, {
917
+ orientation,
918
+ location
919
+ }));
920
+ }));
921
+ });
922
+ MosaicVirtualStackInner.displayName = MOSAIC_VIRTUAL_STACK_NAME;
923
+ var MosaicVirtualStack = MosaicVirtualStackInner;
924
+ MosaicVirtualStack[/* @__PURE__ */ Symbol.for("dxos.composable")] = true;
925
+ var InternalPlaceholder = (props) => {
926
+ return /* @__PURE__ */ React5.createElement(MosaicPlaceholder, {
927
+ ...props,
928
+ classNames: styles.placeholder.root
929
+ }, /* @__PURE__ */ React5.createElement("div", {
930
+ className: mx2("flex h-full bg-base-surface border border-dashed border-separator rounded-xs", styles.placeholder.content)
931
+ }));
932
+ };
933
+ InternalPlaceholder.displayName = "InternalPlaceholder";
934
+
935
+ // src/components/Mosaic/Mosaic.tsx
936
+ var Mosaic = {
937
+ Root: MosaicRoot,
938
+ Container: MosaicContainer,
939
+ Tile: MosaicTile,
940
+ Placeholder: MosaicPlaceholder,
941
+ DropIndicator: MosaicDropIndicator,
942
+ Stack: MosaicStack,
943
+ VirtualStack: MosaicVirtualStack
944
+ };
945
+
946
+ export {
947
+ useVisibleItems,
948
+ Focus,
949
+ useFocus,
950
+ styles,
951
+ getSourceData,
952
+ useMosaicRootContext,
953
+ useMosaicContainerContext,
954
+ useMosaicTileContext,
955
+ Mosaic
956
+ };
957
+ //# sourceMappingURL=chunk-HOLJERCP.mjs.map