@dxos/react-ui-mosaic 0.8.4-main.fcfe5033a5 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +102 -5
- package/dist/lib/browser/{chunk-33NNDFD6.mjs → chunk-I3M5WM6C.mjs} +45 -73
- package/dist/lib/browser/chunk-I3M5WM6C.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +125 -59
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/playwright/index.mjs +118 -10
- package/dist/lib/browser/playwright/index.mjs.map +3 -3
- package/dist/lib/browser/testing/index.mjs +10 -19
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/translations.mjs +18 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-Y4LG7O67.mjs → chunk-DVJLDZLE.mjs} +45 -73
- package/dist/lib/node-esm/chunk-DVJLDZLE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +125 -59
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/playwright/index.mjs +118 -10
- package/dist/lib/node-esm/playwright/index.mjs.map +3 -3
- package/dist/lib/node-esm/testing/index.mjs +10 -19
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/translations.mjs +20 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/src/components/Board/Board.d.ts +12 -4
- package/dist/types/src/components/Board/Board.d.ts.map +1 -1
- package/dist/types/src/components/Board/Board.stories.d.ts +3 -3
- package/dist/types/src/components/Board/Board.stories.d.ts.map +1 -1
- package/dist/types/src/components/Board/Column.d.ts +5 -5
- package/dist/types/src/components/Board/Column.d.ts.map +1 -1
- package/dist/types/src/components/Board/Item.d.ts +1 -1
- package/dist/types/src/components/Board/Item.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Container.d.ts +9 -1
- package/dist/types/src/components/Mosaic/Container.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Mosaic.d.ts +3 -2
- package/dist/types/src/components/Mosaic/Mosaic.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Placeholder.d.ts +8 -8
- package/dist/types/src/components/Mosaic/Placeholder.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Stack.d.ts +6 -1
- package/dist/types/src/components/Mosaic/Stack.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Stack.stories.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Tile.d.ts +6 -2
- package/dist/types/src/components/Mosaic/Tile.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/extension.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/styles.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/types.d.ts.map +1 -1
- package/dist/types/src/components/SearchStack/SearchStack.d.ts +20 -0
- package/dist/types/src/components/SearchStack/SearchStack.d.ts.map +1 -0
- package/dist/types/src/components/SearchStack/SearchStack.stories.d.ts +10 -0
- package/dist/types/src/components/SearchStack/SearchStack.stories.d.ts.map +1 -0
- package/dist/types/src/components/SearchStack/index.d.ts +2 -0
- package/dist/types/src/components/SearchStack/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useContainerDebug.d.ts.map +1 -1
- package/dist/types/src/hooks/useDefaultColumnEventHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useEventHandlerAdapter.d.ts +1 -1
- package/dist/types/src/hooks/useEventHandlerAdapter.d.ts.map +1 -1
- package/dist/types/src/hooks/useVisibleItems.d.ts.map +1 -1
- package/dist/types/src/playwright/board-manager.d.ts +20 -5
- package/dist/types/src/playwright/board-manager.d.ts.map +1 -1
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/testing/CardContainer.d.ts.map +1 -1
- package/dist/types/src/testing/DefaultStackTile.d.ts.map +1 -1
- package/dist/types/src/testing/types.d.ts +7 -9
- package/dist/types/src/testing/types.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +42 -40
- package/src/components/Board/Board.stories.tsx +11 -10
- package/src/components/Board/Board.tsx +4 -3
- package/src/components/Board/Column.tsx +22 -18
- package/src/components/Board/Item.tsx +14 -10
- package/src/components/Mosaic/Container.tsx +18 -2
- package/src/components/Mosaic/Placeholder.tsx +6 -0
- package/src/components/Mosaic/Stack.tsx +20 -5
- package/src/components/Mosaic/Tile.tsx +11 -2
- package/src/components/Mosaic/extension.ts +1 -1
- package/src/components/SearchStack/SearchStack.stories.tsx +47 -0
- package/src/components/SearchStack/SearchStack.tsx +135 -0
- package/src/components/SearchStack/index.ts +5 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/useContainerDebug.tsx +3 -3
- package/src/hooks/useEventHandlerAdapter.ts +1 -1
- package/src/playwright/board-manager.ts +168 -13
- package/src/playwright/smoke.spec.ts +3 -3
- package/src/testing/CardContainer.tsx +2 -5
- package/src/testing/DefaultStackTile.tsx +11 -5
- package/src/testing/types.ts +7 -17
- package/dist/lib/browser/chunk-33NNDFD6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y4LG7O67.mjs.map +0 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/playwright/board-manager.ts
|
|
4
|
+
import { expect } from "@playwright/test";
|
|
4
5
|
var BoardManager = class {
|
|
5
6
|
locator;
|
|
6
7
|
_page;
|
|
@@ -75,26 +76,113 @@ var ItemManager = class {
|
|
|
75
76
|
async dragTo(target, offset = {
|
|
76
77
|
x: 0,
|
|
77
78
|
y: 0
|
|
78
|
-
}) {
|
|
79
|
+
}, edge) {
|
|
79
80
|
const handle = this.locator.getByTestId("mosaicBoard.cardDragHandle");
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
const handleBox = await handle.boundingBox();
|
|
82
|
+
if (!handleBox) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const targetHandle = await target.elementHandle();
|
|
86
|
+
const box = targetHandle ? await targetHandle.boundingBox() : null;
|
|
87
|
+
if (!targetHandle || !box) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const sourceHandle = await this.locator.elementHandle();
|
|
91
|
+
await handle.hover();
|
|
92
|
+
await this._page.mouse.down();
|
|
93
|
+
await this._page.waitForTimeout(100);
|
|
94
|
+
if (edge) {
|
|
95
|
+
await this._page.mouse.move(handleBox.x + handleBox.width / 2 + 1, handleBox.y + handleBox.height / 2, {
|
|
96
|
+
steps: 1
|
|
97
|
+
});
|
|
98
|
+
await this._page.mouse.move(box.x + box.width / 2, box.y + box.height / 2, {
|
|
99
|
+
steps: 4
|
|
100
|
+
});
|
|
101
|
+
await expect.poll(() => this._page.locator('[data-mosaic-container-state="active"]').count(), {
|
|
102
|
+
timeout: 2e3
|
|
103
|
+
}).toBeGreaterThan(0);
|
|
104
|
+
if (sourceHandle) {
|
|
105
|
+
await this._page.waitForFunction((el) => !el || !el.isConnected, sourceHandle, {
|
|
106
|
+
timeout: 2e3
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const placeholderHandle = await this._adjacentPlaceholder(targetHandle, edge);
|
|
110
|
+
if (placeholderHandle) {
|
|
111
|
+
const phBox = await placeholderHandle.boundingBox();
|
|
112
|
+
if (phBox) {
|
|
113
|
+
const aimX = phBox.x + phBox.width / 2;
|
|
114
|
+
const aimY = phBox.y + Math.max(phBox.height / 2, 1);
|
|
115
|
+
await this._page.mouse.move(aimX, aimY, {
|
|
116
|
+
steps: 4
|
|
117
|
+
});
|
|
118
|
+
const isActive = () => placeholderHandle.evaluate((el) => el.getAttribute("data-mosaic-placeholder-state") === "active");
|
|
119
|
+
if (!await isActive()) {
|
|
120
|
+
const start = Date.now();
|
|
121
|
+
let nudge = 0;
|
|
122
|
+
while (Date.now() - start < 3e3) {
|
|
123
|
+
await this._page.waitForTimeout(100);
|
|
124
|
+
nudge = (nudge + 1) % 4;
|
|
125
|
+
const dx = nudge === 0 || nudge === 2 ? 1 : -1;
|
|
126
|
+
const dy = nudge === 1 || nudge === 2 ? 1 : -1;
|
|
127
|
+
await this._page.mouse.move(aimX + dx, aimY + dy, {
|
|
128
|
+
steps: 1
|
|
129
|
+
});
|
|
130
|
+
if (await isActive()) {
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
await expect.poll(() => placeholderHandle.evaluate((el) => el.getAttribute("data-mosaic-placeholder-state")), {
|
|
135
|
+
timeout: 1e3
|
|
136
|
+
}).toBe("active");
|
|
137
|
+
}
|
|
138
|
+
const expanded = await placeholderHandle.boundingBox();
|
|
139
|
+
if (expanded) {
|
|
140
|
+
await this._page.mouse.move(expanded.x + expanded.width / 2, expanded.y + expanded.height / 2, {
|
|
141
|
+
steps: 2
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
85
147
|
await this._page.mouse.move(offset.x + box.x + box.width / 2, offset.y + box.y + box.height / 2, {
|
|
86
148
|
steps: 4
|
|
87
149
|
});
|
|
88
150
|
await this._page.waitForTimeout(100);
|
|
89
|
-
await this._page.mouse.up();
|
|
90
151
|
}
|
|
152
|
+
await this._page.mouse.up();
|
|
91
153
|
}
|
|
92
154
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
155
|
+
* Find the placeholder element adjacent to `target` on the requested
|
|
156
|
+
* side via DOM walk. Returns `null` if the target has no matching
|
|
157
|
+
* sibling (e.g. when the caller passes a non-tile target).
|
|
158
|
+
*/
|
|
159
|
+
async _adjacentPlaceholder(targetHandle, edge) {
|
|
160
|
+
const before = edge === "top" || edge === "left";
|
|
161
|
+
const result = await targetHandle.evaluateHandle((el, beforeArg) => {
|
|
162
|
+
let sibling = beforeArg ? el.previousElementSibling : el.nextElementSibling;
|
|
163
|
+
while (sibling && !sibling.hasAttribute("data-mosaic-placeholder-location")) {
|
|
164
|
+
sibling = beforeArg ? sibling.previousElementSibling : sibling.nextElementSibling;
|
|
165
|
+
}
|
|
166
|
+
return sibling;
|
|
167
|
+
}, before);
|
|
168
|
+
const handle = result.asElement();
|
|
169
|
+
if (!handle) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
const exists = await handle.evaluate((el) => el !== null);
|
|
173
|
+
return exists ? handle : null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Drag this item to a column's scroll bottom, using auto-scroll when needed,
|
|
177
|
+
* then drop on the target item.
|
|
178
|
+
*
|
|
179
|
+
* When the target is already visible in the viewport (no scrolling needed), the
|
|
180
|
+
* item is dragged directly to the target. When the target is below the viewport,
|
|
181
|
+
* the mouse is held near the footer to trigger pragmatic auto-scroll until the
|
|
182
|
+
* target scrolls into view.
|
|
95
183
|
*
|
|
96
184
|
* @param holdTarget - The footer element; mouse is held ~20px above it to trigger auto-scroll.
|
|
97
|
-
* @param dropTarget - The element to drop on
|
|
185
|
+
* @param dropTarget - The element to drop on.
|
|
98
186
|
* @param dropOffset - Offset from the drop target center.
|
|
99
187
|
*/
|
|
100
188
|
async dragToEndWithAutoScroll(holdTarget, dropTarget, dropOffset = {
|
|
@@ -108,9 +196,29 @@ var ItemManager = class {
|
|
|
108
196
|
}
|
|
109
197
|
const holdX = holdBox.x + holdBox.width / 2;
|
|
110
198
|
const holdY = holdBox.y - 20;
|
|
199
|
+
const preDropBox = await dropTarget.boundingBox();
|
|
200
|
+
const needsScroll = !preDropBox || preDropBox.y >= holdBox.y;
|
|
111
201
|
await handle.hover();
|
|
112
202
|
await this._page.mouse.down();
|
|
113
203
|
await this._page.waitForTimeout(100);
|
|
204
|
+
if (!needsScroll) {
|
|
205
|
+
await this._page.mouse.move(holdX, holdY, {
|
|
206
|
+
steps: 4
|
|
207
|
+
});
|
|
208
|
+
const dropBox = await dropTarget.boundingBox();
|
|
209
|
+
if (dropBox) {
|
|
210
|
+
const dropX = dropOffset.x + dropBox.x + dropBox.width / 2;
|
|
211
|
+
const dropY = dropOffset.y + dropBox.y + dropBox.height / 2;
|
|
212
|
+
await this._page.mouse.move(dropX, dropY, {
|
|
213
|
+
steps: 8
|
|
214
|
+
});
|
|
215
|
+
await this._page.waitForTimeout(200);
|
|
216
|
+
await this._page.mouse.up();
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
await this._page.mouse.up();
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
114
222
|
await this._page.mouse.move(holdX, holdY, {
|
|
115
223
|
steps: 4
|
|
116
224
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/playwright/board-manager.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type { Locator, Page } from '@playwright/test';\n\nexport class BoardManager {\n private readonly _page: Page;\n\n constructor(readonly locator: Locator) {\n this._page = locator.page();\n }\n\n columns(): Locator {\n return this.locator.getByTestId('board-column');\n }\n\n column(index: number): ColumnManager {\n return new ColumnManager(this.locator.getByTestId('board-column').nth(index));\n }\n}\n\nexport class ColumnManager {\n private readonly _page: Page;\n\n constructor(readonly locator: Locator) {\n this._page = locator.page();\n }\n\n items(): Locator {\n return this.locator.getByTestId('board-item');\n }\n\n item(index: number): ItemManager {\n return new ItemManager(this.locator.getByTestId('board-item').nth(index));\n }\n\n async addItem(): Promise<void> {\n await this.locator.getByTestId('board-column-add-item').click();\n }\n\n header(): Locator {\n return this.locator.getByTestId('board-column-header');\n }\n\n title(): Locator {\n return this.locator.getByTestId('mosaicBoard.columnTitle');\n }\n\n async dragTo(target: Locator, offset = { x: 0, y: 0 }): Promise<void> {\n const handle = this.header().getByTestId('mosaicBoard.columnDragHandle');\n const handleBox = await handle.boundingBox();\n if (!handleBox) {\n return;\n }\n\n await handle.hover();\n await this._page.mouse.down();\n // Small initial movement to trigger the native drag start.\n await this._page.mouse.move(handleBox.x + handleBox.width / 2 + 1, handleBox.y + handleBox.height / 2, {\n steps: 1,\n });\n // Allow the drag monitor to register and the DOM to settle\n // (the dragged column is removed from visible items, shifting remaining columns).\n await this._page.waitForTimeout(200);\n const box = await target.boundingBox();\n if (box) {\n await this._page.mouse.move(offset.x + box.x + box.width / 2, offset.y + box.y + box.height / 2, { steps: 4 });\n // Allow the drop target to process the hover before releasing.\n await this._page.waitForTimeout(100);\n await this._page.mouse.up();\n }\n }\n}\n\nexport class ItemManager {\n private readonly _page: Page;\n\n constructor(readonly locator: Locator) {\n this._page = locator.page();\n }\n\n title(): Locator {\n return this.locator.getByTestId('mosaicBoard.cardTitle');\n }\n\n async dragTo(target: Locator, offset = { x: 0, y: 0 }): Promise<void> {\n const handle = this.locator.getByTestId('mosaicBoard.cardDragHandle');\n const box = await target.boundingBox();\n if (box) {\n await handle.hover();\n await this._page.mouse.down();\n // Allow the drag monitor to register the grab before moving.\n await this._page.waitForTimeout(100);\n await this._page.mouse.move(offset.x + box.x + box.width / 2, offset.y + box.y + box.height / 2, { steps: 4 });\n // Allow the drop target to process the hover before releasing.\n await this._page.waitForTimeout(100);\n await this._page.mouse.up();\n }\n }\n\n /**\n * Drag this item to a column's scroll bottom, hold to trigger auto-scroll,\n * then wait for the drop target to become visible and drop on it.\n *\n * @param holdTarget - The footer element; mouse is held ~20px above it to trigger auto-scroll.\n * @param dropTarget - The element to drop on once it scrolls into view.\n * @param dropOffset - Offset from the drop target center.\n */\n async dragToEndWithAutoScroll(holdTarget: Locator, dropTarget: Locator, dropOffset = { x: 0, y: 0 }): Promise<void> {\n const handle = this.locator.getByTestId('mosaicBoard.cardDragHandle');\n const holdBox = await holdTarget.boundingBox();\n if (!holdBox) {\n return;\n }\n\n // The hold position is ~20px above the footer to trigger pragmatic auto-scroll.\n const holdX = holdBox.x + holdBox.width / 2;\n const holdY = holdBox.y - 20;\n\n await handle.hover();\n await this._page.mouse.down();\n // Allow the drag monitor to register the grab before moving.\n await this._page.waitForTimeout(100);\n\n // Move to hold position above the footer to trigger auto-scroll.\n await this._page.mouse.move(holdX, holdY, { steps: 4 });\n\n // Hold and nudge mouse periodically to keep auto-scroll active until drop target is visible.\n for (let i = 0; i < 40; i++) {\n // Wait between nudges to give auto-scroll time to advance.\n await this._page.waitForTimeout(200);\n // Small nudge to keep drag events firing (auto-scroll stalls without movement).\n await this._page.mouse.move(holdX + (i % 2), holdY, { steps: 1 });\n\n const dropBox = await dropTarget.boundingBox();\n if (dropBox && dropBox.y + dropBox.height < holdY) {\n // Drop target has scrolled into view. Re-read box so we use current position (scroll may have moved it).\n const finalBox = await dropTarget.boundingBox();\n if (!finalBox) {\n await this._page.mouse.up();\n return;\n }\n\n const dropX = dropOffset.x + finalBox.x + finalBox.width / 2;\n const dropY = dropOffset.y + finalBox.y + finalBox.height / 2;\n await this._page.mouse.move(dropX, dropY, { steps: 8 });\n // Let drop target receive dragOver and settle (headless is faster; needs a moment to register).\n await dropTarget.waitFor({ state: 'visible' });\n await this._page.waitForTimeout(200);\n await this._page.mouse.up();\n return;\n }\n }\n\n // Fallback: drop wherever we are.\n await this._page.mouse.up();\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;
|
|
6
|
-
"names": ["BoardManager", "_page", "locator", "page", "columns", "getByTestId", "column", "index", "ColumnManager", "nth", "items", "item", "ItemManager", "addItem", "click", "header", "title", "dragTo", "target", "offset", "x", "y", "handle", "handleBox", "boundingBox", "hover", "mouse", "down", "move", "width", "height", "steps", "waitForTimeout", "box", "up", "dragToEndWithAutoScroll", "holdTarget", "dropTarget", "dropOffset", "holdBox", "holdX", "holdY", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Locator, type Page, expect } from '@playwright/test';\n\n/**\n * Edge of the target tile to drop on. Pragmatic-dnd assigns the closest edge\n * based on cursor position; a stale (pre-layout-shift) cursor can land in the\n * wrong half. When `dragTo` is called with an `edge`, the helper waits for the\n * target tile to register the drag, re-measures the target after the\n * placeholder has expanded, repositions the cursor near the requested edge,\n * and confirms via `data-mosaic-tile-edge` before releasing.\n */\nexport type DragEdge = 'top' | 'bottom' | 'left' | 'right';\n\nexport class BoardManager {\n private readonly _page: Page;\n\n constructor(readonly locator: Locator) {\n this._page = locator.page();\n }\n\n columns(): Locator {\n return this.locator.getByTestId('board-column');\n }\n\n column(index: number): ColumnManager {\n return new ColumnManager(this.locator.getByTestId('board-column').nth(index));\n }\n}\n\nexport class ColumnManager {\n private readonly _page: Page;\n\n constructor(readonly locator: Locator) {\n this._page = locator.page();\n }\n\n items(): Locator {\n return this.locator.getByTestId('board-item');\n }\n\n item(index: number): ItemManager {\n return new ItemManager(this.locator.getByTestId('board-item').nth(index));\n }\n\n async addItem(): Promise<void> {\n await this.locator.getByTestId('board-column-add-item').click();\n }\n\n header(): Locator {\n return this.locator.getByTestId('board-column-header');\n }\n\n title(): Locator {\n return this.locator.getByTestId('mosaicBoard.columnTitle');\n }\n\n async dragTo(target: Locator, offset = { x: 0, y: 0 }): Promise<void> {\n const handle = this.header().getByTestId('mosaicBoard.columnDragHandle');\n const handleBox = await handle.boundingBox();\n if (!handleBox) {\n return;\n }\n\n await handle.hover();\n await this._page.mouse.down();\n // Small initial movement to trigger the native drag start.\n await this._page.mouse.move(handleBox.x + handleBox.width / 2 + 1, handleBox.y + handleBox.height / 2, {\n steps: 1,\n });\n // Allow the drag monitor to register and the DOM to settle\n // (the dragged column is removed from visible items, shifting remaining columns).\n await this._page.waitForTimeout(200);\n const box = await target.boundingBox();\n if (box) {\n await this._page.mouse.move(offset.x + box.x + box.width / 2, offset.y + box.y + box.height / 2, { steps: 4 });\n // Allow the drop target to process the hover before releasing.\n await this._page.waitForTimeout(100);\n await this._page.mouse.up();\n }\n }\n}\n\nexport class ItemManager {\n private readonly _page: Page;\n\n constructor(readonly locator: Locator) {\n this._page = locator.page();\n }\n\n title(): Locator {\n return this.locator.getByTestId('mosaicBoard.cardTitle');\n }\n\n async dragTo(target: Locator, offset: { x: number; y: number } = { x: 0, y: 0 }, edge?: DragEdge): Promise<void> {\n const handle = this.locator.getByTestId('mosaicBoard.cardDragHandle');\n const handleBox = await handle.boundingBox();\n if (!handleBox) {\n return;\n }\n\n // Capture stable ElementHandles to source and target before the drag\n // begins. Both `nth(N)` locators shift when `useVisibleItems` filters the\n // source out of its column, so we need raw DOM references that survive\n // the reconciliation.\n const targetHandle = await target.elementHandle();\n const box = targetHandle ? await targetHandle.boundingBox() : null;\n if (!targetHandle || !box) {\n return;\n }\n const sourceHandle = await this.locator.elementHandle();\n\n await handle.hover();\n await this._page.mouse.down();\n // Allow the drag monitor to register the grab before moving.\n await this._page.waitForTimeout(100);\n\n if (edge) {\n // Stage 1: trigger the dragstart. A 1-pixel nudge near the press\n // point primes pragmatic-dnd's HTML5 dragstart, then a long move\n // over the target tile commits the drag past every browser's\n // \"click vs drag\" threshold.\n await this._page.mouse.move(handleBox.x + handleBox.width / 2 + 1, handleBox.y + handleBox.height / 2, {\n steps: 1,\n });\n await this._page.mouse.move(box.x + box.width / 2, box.y + box.height / 2, { steps: 4 });\n\n // Wait for `data-mosaic-container-state=\"active\"` so we know the\n // dragstart has been processed. This alone is *not* enough: pragmatic-\n // dnd's `monitorForElements.onDragStart` (Root.tsx) and the\n // `dropTargetForElements.onDragStart` (Container.tsx) write into\n // independent React state, and only the latter drives the attribute.\n // The former drives `useVisibleItems` filtering, which is what\n // physically reflows the column. So we ALSO wait for the source tile\n // to detach from the DOM — that's the unambiguous signal that the\n // reflow has happened and any cached bbox is stale.\n await expect\n .poll(() => this._page.locator('[data-mosaic-container-state=\"active\"]').count(), { timeout: 2000 })\n .toBeGreaterThan(0);\n if (sourceHandle) {\n await this._page.waitForFunction((el) => !el || !el.isConnected, sourceHandle, { timeout: 2000 });\n }\n\n // Stage 2: walk siblings on the (now reflowed) drag-time DOM and aim\n // at the placeholder representing the requested edge. The Fragment\n // keying on item id keeps the target tile's adjacent placeholder DOM\n // node stable across reconciliation, but its `location` prop and bbox\n // both change once the source is filtered out — measure after the\n // reflow, never before.\n const placeholderHandle = await this._adjacentPlaceholder(targetHandle, edge);\n if (placeholderHandle) {\n const phBox = await placeholderHandle.boundingBox();\n if (phBox) {\n const aimX = phBox.x + phBox.width / 2;\n const aimY = phBox.y + Math.max(phBox.height / 2, 1);\n await this._page.mouse.move(aimX, aimY, { steps: 4 });\n\n // Some browser/CDP combinations need a follow-up nudge to push\n // the dragOver event through — re-aim with a 1px offset and poll.\n const isActive = () =>\n placeholderHandle.evaluate((el) => el.getAttribute('data-mosaic-placeholder-state') === 'active');\n if (!(await isActive())) {\n const start = Date.now();\n let nudge = 0;\n while (Date.now() - start < 3000) {\n await this._page.waitForTimeout(100);\n nudge = (nudge + 1) % 4;\n const dx = nudge === 0 || nudge === 2 ? 1 : -1;\n const dy = nudge === 1 || nudge === 2 ? 1 : -1;\n await this._page.mouse.move(aimX + dx, aimY + dy, { steps: 1 });\n if (await isActive()) {\n break;\n }\n }\n await expect\n .poll(() => placeholderHandle.evaluate((el) => el.getAttribute('data-mosaic-placeholder-state')), {\n timeout: 1000,\n })\n .toBe('active');\n }\n\n // Re-centre on the now-expanded placeholder so the drop lands\n // solidly inside it.\n const expanded = await placeholderHandle.boundingBox();\n if (expanded) {\n await this._page.mouse.move(expanded.x + expanded.width / 2, expanded.y + expanded.height / 2, {\n steps: 2,\n });\n }\n }\n }\n } else {\n // Legacy path: no explicit edge — rely on the offset placement and a\n // small settle delay before releasing.\n await this._page.mouse.move(offset.x + box.x + box.width / 2, offset.y + box.y + box.height / 2, { steps: 4 });\n await this._page.waitForTimeout(100);\n }\n await this._page.mouse.up();\n }\n\n /**\n * Find the placeholder element adjacent to `target` on the requested\n * side via DOM walk. Returns `null` if the target has no matching\n * sibling (e.g. when the caller passes a non-tile target).\n */\n private async _adjacentPlaceholder(\n targetHandle: import('@playwright/test').ElementHandle<Element | SVGElement | HTMLElement>,\n edge: DragEdge,\n ): Promise<import('@playwright/test').ElementHandle<HTMLElement> | null> {\n const before = edge === 'top' || edge === 'left';\n const result = await targetHandle.evaluateHandle((el, beforeArg) => {\n let sibling: Element | null = beforeArg ? el.previousElementSibling : el.nextElementSibling;\n while (sibling && !sibling.hasAttribute('data-mosaic-placeholder-location')) {\n sibling = beforeArg ? sibling.previousElementSibling : sibling.nextElementSibling;\n }\n return sibling as HTMLElement | null;\n }, before);\n const handle = result.asElement() as import('@playwright/test').ElementHandle<HTMLElement> | null;\n if (!handle) {\n return null;\n }\n // `evaluateHandle` returning `null` still produces a non-null JSHandle —\n // verify the underlying element actually exists.\n const exists = await handle.evaluate((el) => el !== null);\n return exists ? handle : null;\n }\n\n /**\n * Drag this item to a column's scroll bottom, using auto-scroll when needed,\n * then drop on the target item.\n *\n * When the target is already visible in the viewport (no scrolling needed), the\n * item is dragged directly to the target. When the target is below the viewport,\n * the mouse is held near the footer to trigger pragmatic auto-scroll until the\n * target scrolls into view.\n *\n * @param holdTarget - The footer element; mouse is held ~20px above it to trigger auto-scroll.\n * @param dropTarget - The element to drop on.\n * @param dropOffset - Offset from the drop target center.\n */\n async dragToEndWithAutoScroll(holdTarget: Locator, dropTarget: Locator, dropOffset = { x: 0, y: 0 }): Promise<void> {\n const handle = this.locator.getByTestId('mosaicBoard.cardDragHandle');\n const holdBox = await holdTarget.boundingBox();\n if (!holdBox) {\n return;\n }\n\n // The hold position is ~20px above the footer to trigger pragmatic auto-scroll.\n const holdX = holdBox.x + holdBox.width / 2;\n const holdY = holdBox.y - 20;\n\n // Check if drop target is already visible before starting the drag.\n // Items may fit in the viewport without scrolling, in which case auto-scroll\n // is not needed and the loop's exit condition would never be satisfied.\n const preDropBox = await dropTarget.boundingBox();\n const needsScroll = !preDropBox || preDropBox.y >= holdBox.y;\n\n await handle.hover();\n await this._page.mouse.down();\n // Allow the drag monitor to register the grab before moving.\n await this._page.waitForTimeout(100);\n\n if (!needsScroll) {\n // Target is already visible — drag directly without auto-scroll.\n await this._page.mouse.move(holdX, holdY, { steps: 4 });\n const dropBox = await dropTarget.boundingBox();\n if (dropBox) {\n const dropX = dropOffset.x + dropBox.x + dropBox.width / 2;\n const dropY = dropOffset.y + dropBox.y + dropBox.height / 2;\n await this._page.mouse.move(dropX, dropY, { steps: 8 });\n await this._page.waitForTimeout(200);\n await this._page.mouse.up();\n return;\n }\n await this._page.mouse.up();\n return;\n }\n\n // Move to hold position above the footer to trigger auto-scroll.\n await this._page.mouse.move(holdX, holdY, { steps: 4 });\n\n // Hold and nudge mouse periodically to keep auto-scroll active until drop target is visible.\n for (let i = 0; i < 40; i++) {\n // Wait between nudges to give auto-scroll time to advance.\n await this._page.waitForTimeout(200);\n // Small nudge to keep drag events firing (auto-scroll stalls without movement).\n await this._page.mouse.move(holdX + (i % 2), holdY, { steps: 1 });\n\n const dropBox = await dropTarget.boundingBox();\n if (dropBox && dropBox.y + dropBox.height < holdY) {\n // Drop target has scrolled into view. Re-read box so we use current position (scroll may have moved it).\n const finalBox = await dropTarget.boundingBox();\n if (!finalBox) {\n await this._page.mouse.up();\n return;\n }\n\n const dropX = dropOffset.x + finalBox.x + finalBox.width / 2;\n const dropY = dropOffset.y + finalBox.y + finalBox.height / 2;\n await this._page.mouse.move(dropX, dropY, { steps: 8 });\n // Let drop target receive dragOver and settle (headless is faster; needs a moment to register).\n await dropTarget.waitFor({ state: 'visible' });\n await this._page.waitForTimeout(200);\n await this._page.mouse.up();\n return;\n }\n }\n\n // Fallback: drop wherever we are.\n await this._page.mouse.up();\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAAkCA,cAAc;AAYzC,IAAMC,eAAN,MAAMA;;EACMC;EAEjB,YAAqBC,SAAkB;SAAlBA,UAAAA;AACnB,SAAKD,QAAQC,QAAQC,KAAI;EA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AAA;AAE/D,YAAMoD,UAAU,MAAMP,WAAWpD,YAAW;AAC5C,UAAI2D,WAAWA,QAAQ9D,IAAI8D,QAAQrD,SAASkD,OAAO;AAEjD,cAAMO,WAAW,MAAMX,WAAWpD,YAAW;AAC7C,YAAI,CAAC+D,UAAU;AACb,gBAAM,KAAKtF,MAAMyB,MAAMQ,GAAE;AACzB;QACF;AAEA,cAAMkD,QAAQP,WAAWzD,IAAImE,SAASnE,IAAImE,SAAS1D,QAAQ;AAC3D,cAAMwD,QAAQR,WAAWxD,IAAIkE,SAASlE,IAAIkE,SAASzD,SAAS;AAC5D,cAAM,KAAK7B,MAAMyB,MAAME,KAAKwD,OAAOC,OAAO;UAAEtD,OAAO;QAAE,CAAA;AAErD,cAAM6C,WAAWY,QAAQ;UAAEC,OAAO;QAAU,CAAA;AAC5C,cAAM,KAAKxF,MAAM+B,eAAe,GAAA;AAChC,cAAM,KAAK/B,MAAMyB,MAAMQ,GAAE;AACzB;MACF;IACF;AAGA,UAAM,KAAKjC,MAAMyB,MAAMQ,GAAE;EAC3B;AACF;",
|
|
6
|
+
"names": ["expect", "BoardManager", "_page", "locator", "page", "columns", "getByTestId", "column", "index", "ColumnManager", "nth", "items", "item", "ItemManager", "addItem", "click", "header", "title", "dragTo", "target", "offset", "x", "y", "handle", "handleBox", "boundingBox", "hover", "mouse", "down", "move", "width", "height", "steps", "waitForTimeout", "box", "up", "edge", "targetHandle", "elementHandle", "sourceHandle", "poll", "count", "timeout", "toBeGreaterThan", "waitForFunction", "el", "isConnected", "placeholderHandle", "_adjacentPlaceholder", "phBox", "aimX", "aimY", "Math", "max", "isActive", "evaluate", "getAttribute", "start", "Date", "now", "nudge", "dx", "dy", "toBe", "expanded", "before", "result", "evaluateHandle", "beforeArg", "sibling", "previousElementSibling", "nextElementSibling", "hasAttribute", "asElement", "exists", "dragToEndWithAutoScroll", "holdTarget", "dropTarget", "dropOffset", "holdBox", "holdX", "holdY", "preDropBox", "needsScroll", "dropBox", "dropX", "dropY", "i", "finalBox", "waitFor", "state"]
|
|
7
7
|
}
|
|
@@ -2,7 +2,7 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
Focus,
|
|
4
4
|
Mosaic
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-DVJLDZLE.mjs";
|
|
6
6
|
|
|
7
7
|
// src/testing/decorator.tsx
|
|
8
8
|
import React from "react";
|
|
@@ -12,24 +12,18 @@ var withMosaic = () => {
|
|
|
12
12
|
|
|
13
13
|
// src/testing/types.ts
|
|
14
14
|
import * as Schema from "effect/Schema";
|
|
15
|
-
import { Ref, Type } from "@dxos/echo";
|
|
16
|
-
import {
|
|
15
|
+
import { DXN, Ref, Type } from "@dxos/echo";
|
|
16
|
+
import { EntityId } from "@dxos/keys";
|
|
17
17
|
var TestItem = Schema.Struct({
|
|
18
18
|
name: Schema.String,
|
|
19
19
|
description: Schema.optional(Schema.String),
|
|
20
20
|
label: Schema.optional(Schema.String)
|
|
21
|
-
}).pipe(Type.
|
|
22
|
-
typename: "com.example.type.item",
|
|
23
|
-
version: "0.1.0"
|
|
24
|
-
}));
|
|
21
|
+
}).pipe(Type.makeObject(DXN.make("com.example.type.item", "0.1.0")));
|
|
25
22
|
var TestColumn = Schema.Struct({
|
|
26
|
-
id:
|
|
23
|
+
id: EntityId,
|
|
27
24
|
name: Schema.String,
|
|
28
25
|
items: Schema.mutable(Schema.Array(Ref.Ref(TestItem)))
|
|
29
|
-
}).pipe(Type.
|
|
30
|
-
typename: "com.example.type.column",
|
|
31
|
-
version: "0.1.0"
|
|
32
|
-
}));
|
|
26
|
+
}).pipe(Type.makeObject(DXN.make("com.example.type.column", "0.1.0")));
|
|
33
27
|
|
|
34
28
|
// src/testing/CardContainer.tsx
|
|
35
29
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
@@ -42,7 +36,6 @@ var CardContainer = ({ children, role, icon = "ph--arrow-line-down--regular" })
|
|
|
42
36
|
switch (role) {
|
|
43
37
|
case "popover":
|
|
44
38
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
45
|
-
role: "none",
|
|
46
39
|
className: "flex justify-center"
|
|
47
40
|
}, /* @__PURE__ */ React2.createElement(PopoverCardContainer, {
|
|
48
41
|
icon
|
|
@@ -72,12 +65,10 @@ var IntrinsicCardContainer = ({ children, defaultSize, size: propSize, onSizeCha
|
|
|
72
65
|
onChange: onSizeChange
|
|
73
66
|
});
|
|
74
67
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
75
|
-
role: "none",
|
|
76
68
|
className: "relative p-2 grid overflow-hidden border-2 border-dashed border-green-500 rounded-lg",
|
|
77
69
|
style: sizeStyle(size, "horizontal"),
|
|
78
70
|
...resizeAttributes
|
|
79
71
|
}, /* @__PURE__ */ React2.createElement("div", {
|
|
80
|
-
role: "none",
|
|
81
72
|
className: "dx-container flex flex-col"
|
|
82
73
|
}, children), /* @__PURE__ */ React2.createElement(ResizeHandle, {
|
|
83
74
|
side: "inline-end",
|
|
@@ -93,14 +84,14 @@ import React3, { useMemo, useRef, useState } from "react";
|
|
|
93
84
|
import { Obj } from "@dxos/echo";
|
|
94
85
|
import { Card, Toolbar } from "@dxos/react-ui";
|
|
95
86
|
import { Menu, createMenuAction } from "@dxos/react-ui-menu";
|
|
96
|
-
import {
|
|
87
|
+
import { JsonHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
97
88
|
var DefaultStackTile = (props) => {
|
|
98
89
|
const dragHandleRef = useRef(null);
|
|
99
90
|
const [open, setOpen] = useState(false);
|
|
100
91
|
const menuItems = useMemo(() => [
|
|
101
92
|
createMenuAction("toggle-details", () => setOpen((prev) => !prev), {
|
|
102
93
|
label: open ? "Hide details" : "Show details",
|
|
103
|
-
icon: "ph--
|
|
94
|
+
icon: "ph--circle-dashed--regular"
|
|
104
95
|
})
|
|
105
96
|
], [
|
|
106
97
|
open
|
|
@@ -112,7 +103,7 @@ var DefaultStackTile = (props) => {
|
|
|
112
103
|
asChild: true
|
|
113
104
|
}, /* @__PURE__ */ React3.createElement(Card.Root, {
|
|
114
105
|
className: "dx-current dx-hover"
|
|
115
|
-
}, /* @__PURE__ */ React3.createElement(Card.
|
|
106
|
+
}, /* @__PURE__ */ React3.createElement(Card.Header, null, /* @__PURE__ */ React3.createElement(Card.DragHandle, {
|
|
116
107
|
ref: dragHandleRef
|
|
117
108
|
}), /* @__PURE__ */ React3.createElement(Card.Title, null, Obj.getLabel(props.data) ?? props.data.id), /* @__PURE__ */ React3.createElement(Menu.Trigger, {
|
|
118
109
|
asChild: true,
|
|
@@ -124,7 +115,7 @@ var DefaultStackTile = (props) => {
|
|
|
124
115
|
label: "Menu"
|
|
125
116
|
})), /* @__PURE__ */ React3.createElement(Menu.Content, {
|
|
126
117
|
items: menuItems
|
|
127
|
-
})), open && /* @__PURE__ */ React3.createElement(Card.Row, null, /* @__PURE__ */ React3.createElement(
|
|
118
|
+
})), open && /* @__PURE__ */ React3.createElement(Card.Row, null, /* @__PURE__ */ React3.createElement(JsonHighlighter, {
|
|
128
119
|
data: props.data,
|
|
129
120
|
classNames: "text-xs"
|
|
130
121
|
}))))));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
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 {
|
|
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;
|
|
6
|
-
"names": ["React", "withMosaic", "Story", "Mosaic", "Root", "Schema", "Ref", "Type", "
|
|
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 { DXN, Ref, Type } from '@dxos/echo';\nimport { EntityId } 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(Type.makeObject(DXN.make('com.example.type.item', '0.1.0')));\n\nexport type TestItem = Type.InstanceType<typeof TestItem>;\n\nexport const TestColumn = Schema.Struct({\n id: EntityId,\n name: Schema.String,\n items: Schema.mutable(Schema.Array(Ref.Ref(TestItem))),\n}).pipe(Type.makeObject(DXN.make('com.example.type.column', '0.1.0')));\n\nexport type TestColumn = Type.InstanceType<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 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 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 className='dx-container flex flex-col'>{children}</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 { JsonHighlighter } 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--circle-dashed--regular',\n }),\n ],\n [open],\n );\n\n return (\n <Menu.Root>\n {/*\n * `Mosaic.Tile` sets `aria-current` from `props.current`, which the\n * Slot composition propagates down to `Card.Root`'s div. That's what\n * makes `dx-current` (an `aria-[current=true]:` utility) actually\n * fire here. See `ui-theme/src/css/components/selected.md`.\n */}\n <Mosaic.Tile {...props} asChild>\n <Focus.Item asChild>\n <Card.Root className='dx-current dx-hover'>\n <Card.Header>\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.Header>\n {open && (\n <Card.Row>\n <JsonHighlighter 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,KAAKC,YAAY;AAC/B,SAASC,gBAAgB;AAMlB,IAAMC,WAA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AAKE,QAAM,MACV,gBAAAV,OAAA,cAACQ,KAAKG,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,cAACqB,QAAQC,YAAU;IAACC,UAAAA;IAASC,SAAQ;IAAQzB,MAAK;IAAmCD,OAAM;OAE7F,gBAAAE,OAAA,cAACC,KAAKwB,SAAO;IAACC,OAAOhC;OAEtBH,QACC,gBAAAS,OAAA,cAACQ,KAAKmB,KAAG,MACP,gBAAA3B,OAAA,cAAC4B,iBAAAA;IAAgBZ,MAAM5B,MAAM4B;IAAMa,YAAW;;AAQ9D;AAEA1C,iBAAiB2C,cAAc;",
|
|
6
|
+
"names": ["React", "withMosaic", "Story", "Mosaic", "Root", "Schema", "DXN", "Ref", "Type", "EntityId", "TestItem", "Struct", "name", "String", "description", "optional", "label", "pipe", "makeObject", "make", "TestColumn", "id", "items", "mutable", "Array", "useControllableState", "React", "Icon", "Popover", "ResizeHandle", "resizeAttributes", "sizeStyle", "DEFAULT_BLOCK_SIZE", "MIN_BLOCK_SIZE", "CardContainer", "children", "role", "icon", "div", "className", "PopoverCardContainer", "IntrinsicCardContainer", "Root", "open", "Trigger", "asChild", "Portal", "Content", "onOpenAutoFocus", "event", "preventDefault", "Viewport", "classNames", "Arrow", "defaultSize", "size", "propSize", "onSizeChange", "setSize", "prop", "defaultProp", "onChange", "style", "side", "fallbackSize", "minSize", "React", "useMemo", "useRef", "useState", "Obj", "Card", "Toolbar", "Menu", "createMenuAction", "JsonHighlighter", "DefaultStackTile", "props", "dragHandleRef", "useRef", "open", "setOpen", "useState", "menuItems", "useMemo", "createMenuAction", "prev", "label", "icon", "React", "Menu", "Root", "Mosaic", "Tile", "asChild", "Focus", "Item", "Card", "className", "Header", "DragHandle", "ref", "Title", "Obj", "getLabel", "data", "id", "Trigger", "disabled", "length", "Toolbar", "IconButton", "iconOnly", "variant", "Content", "items", "Row", "JsonHighlighter", "classNames", "displayName"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/translations.ts
|
|
4
|
+
var translationKey = "@dxos/react-ui-mosaic";
|
|
5
|
+
var translations = [
|
|
6
|
+
{
|
|
7
|
+
"en-US": {
|
|
8
|
+
[translationKey]: {
|
|
9
|
+
"action-menu.label": "Actions",
|
|
10
|
+
"add-item.label": "Add item",
|
|
11
|
+
"delete-menu.label": "Delete"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
];
|
|
16
|
+
export {
|
|
17
|
+
translationKey,
|
|
18
|
+
translations
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=translations.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nexport const translationKey = '@dxos/react-ui-mosaic';\n\nexport const translations = [\n {\n 'en-US': {\n [translationKey]: {\n 'action-menu.label': 'Actions',\n 'add-item.label': 'Add item',\n 'delete-menu.label': 'Delete',\n },\n },\n },\n] as const satisfies Resource[];\n"],
|
|
5
|
+
"mappings": ";;;AAMO,IAAMA,iBAAiB;AAEvB,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACD,cAAAA,GAAiB;QAChB,qBAAqB;QACrB,kBAAkB;QAClB,qBAAqB;MACvB;IACF;EACF;;",
|
|
6
|
+
"names": ["translationKey", "translations"]
|
|
7
|
+
}
|
|
@@ -24,12 +24,20 @@ type BoardContextValue<TColumn = any, TItem = any> = {
|
|
|
24
24
|
/** Hook to read the board model from context (e.g. in custom column tiles). Pass TColumn and TItem for typed model. */
|
|
25
25
|
declare function useBoard<TColumn = any, TItem = any>(displayName?: string): BoardContextValue<TColumn, TItem>;
|
|
26
26
|
type BoardRootProps<TColumn = any, TItem = any> = PropsWithChildren<BoardContextValue<TColumn, TItem>>;
|
|
27
|
+
declare function BoardRootInner({ model, children }: BoardRootProps): React.JSX.Element;
|
|
28
|
+
declare namespace BoardRootInner {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
27
31
|
type BoardContentProps<TColumn = any> = ThemedClassName<{
|
|
28
32
|
id: string;
|
|
29
33
|
debug?: boolean;
|
|
30
34
|
eventHandler?: MosaicEventHandler<TColumn>;
|
|
31
35
|
Tile?: MosaicStackProps<TColumn>['Tile'];
|
|
32
36
|
}>;
|
|
37
|
+
declare function BoardPlaceholder(props: MosaicPlaceholderProps<number>): React.JSX.Element;
|
|
38
|
+
declare namespace BoardPlaceholder {
|
|
39
|
+
var displayName: string;
|
|
40
|
+
}
|
|
33
41
|
export declare const BoardDebug: React.ForwardRefExoticComponent<Omit<{}, "className"> & {
|
|
34
42
|
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
35
43
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -42,7 +50,7 @@ export declare const Board: {
|
|
|
42
50
|
Root: <TColumn = unknown>(props: (BoardColumnProps<TColumn> & {
|
|
43
51
|
children?: React.ReactNode | undefined;
|
|
44
52
|
} & {
|
|
45
|
-
|
|
53
|
+
dragHandle?: HTMLButtonElement | null;
|
|
46
54
|
}) & {
|
|
47
55
|
ref?: ReactRef<HTMLDivElement>;
|
|
48
56
|
}) => ReactElement;
|
|
@@ -51,12 +59,12 @@ export declare const Board: {
|
|
|
51
59
|
dragHandleRef: ReactRef<HTMLButtonElement>;
|
|
52
60
|
}, "className"> & {
|
|
53
61
|
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
54
|
-
} & Pick<React.HTMLAttributes<Element>, "
|
|
62
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
55
63
|
Body: React.ForwardRefExoticComponent<Omit<Pick<BoardColumnProps<any>, "data"> & Pick<import("..").MosaicContainerProps, "debug" | "eventHandler"> & {
|
|
56
|
-
Tile?: MosaicStackProps<import("@dxos/echo/Obj").Unknown>[
|
|
64
|
+
Tile?: MosaicStackProps<import("@dxos/echo/Obj").Unknown>['Tile'];
|
|
57
65
|
}, "className"> & {
|
|
58
66
|
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
59
|
-
} & Pick<React.HTMLAttributes<Element>, "
|
|
67
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
60
68
|
Footer: React.ForwardRefExoticComponent<Omit<{}, "className"> & {
|
|
61
69
|
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
62
70
|
} & {
|
|
@@ -1 +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;
|
|
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;AAE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IA0C7D,KAAK;;;CACN,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AAEpC,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -14,9 +14,9 @@ declare const meta: {
|
|
|
14
14
|
translations: [{
|
|
15
15
|
readonly 'en-US': {
|
|
16
16
|
readonly "@dxos/react-ui-mosaic": {
|
|
17
|
-
readonly 'action-menu.label':
|
|
18
|
-
readonly 'add-item.label':
|
|
19
|
-
readonly 'delete-menu.label':
|
|
17
|
+
readonly 'action-menu.label': 'Actions';
|
|
18
|
+
readonly 'add-item.label': 'Add item';
|
|
19
|
+
readonly 'delete-menu.label': 'Delete';
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
}];
|
|
@@ -1 +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;AA6CnD,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;
|
|
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;AA6CnD,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;;8CAvByD,iBAAiB;;;;;;;;;;;;;;;;;;;;;;CAoD/C,CAAC;eAEvB,IAAI;AAEnB,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { type PropsWithChildren, type ReactElement, type Ref as ReactRef
|
|
1
|
+
import React, { type PropsWithChildren, type ReactElement, type Ref as ReactRef } from 'react';
|
|
2
2
|
import { Obj } from '@dxos/echo';
|
|
3
3
|
import { type MosaicContainerProps, type MosaicStackProps, type MosaicTileProps } from '../Mosaic';
|
|
4
4
|
export type BoardColumnContextValue<TColumn = unknown> = {
|
|
@@ -6,9 +6,9 @@ export type BoardColumnContextValue<TColumn = unknown> = {
|
|
|
6
6
|
};
|
|
7
7
|
/** Returns the current column when rendered inside a board column (e.g., in column header or item tile). */
|
|
8
8
|
export declare function useBoardColumn<TColumn = unknown>(): TColumn | undefined;
|
|
9
|
-
type BoardColumnProps<TColumn = any> = Pick<MosaicTileProps<TColumn>, 'classNames' | 'location' | 'data' | 'debug'>;
|
|
9
|
+
type BoardColumnProps<TColumn = any> = Pick<MosaicTileProps<TColumn>, 'classNames' | 'location' | 'data' | 'debug' | 'draggable'>;
|
|
10
10
|
type BoardColumnRootProps<TColumn = any> = PropsWithChildren<BoardColumnProps<TColumn>> & {
|
|
11
|
-
|
|
11
|
+
dragHandle?: HTMLButtonElement | null;
|
|
12
12
|
};
|
|
13
13
|
type BoardColumnHeaderProps = {
|
|
14
14
|
label: string;
|
|
@@ -24,10 +24,10 @@ export declare const BoardColumn: {
|
|
|
24
24
|
}) => ReactElement;
|
|
25
25
|
Header: React.ForwardRefExoticComponent<Omit<BoardColumnHeaderProps, "className"> & {
|
|
26
26
|
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
27
|
-
} & Pick<React.HTMLAttributes<Element>, "
|
|
27
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
28
28
|
Body: React.ForwardRefExoticComponent<Omit<BoardColumnBodyProps, "className"> & {
|
|
29
29
|
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
30
|
-
} & Pick<React.HTMLAttributes<Element>, "
|
|
30
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
31
31
|
Footer: React.ForwardRefExoticComponent<Omit<{}, "className"> & {
|
|
32
32
|
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
33
33
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Column.d.ts","sourceRoot":"","sources":["../../../../../src/components/Board/Column.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,GAAG,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"Column.d.ts","sourceRoot":"","sources":["../../../../../src/components/Board/Column.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,GAAG,IAAI,QAAQ,EAIrB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,GAAG,EAAO,MAAM,YAAY,CAAC;AAWtC,OAAO,EAAU,KAAK,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAU3G,MA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EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactElement, type Ref as ReactRef } from 'react';
|
|
2
2
|
import { Obj } from '@dxos/echo';
|
|
3
3
|
import { type MosaicTileProps } from '../Mosaic';
|
|
4
|
-
type BoardItemProps<TItem extends Obj.Unknown = any> = Pick<MosaicTileProps<TItem>, 'classNames' | 'location' | 'data' | 'debug'>;
|
|
4
|
+
type BoardItemProps<TItem extends Obj.Unknown = any> = Pick<MosaicTileProps<TItem>, 'classNames' | 'location' | 'data' | 'debug' | 'draggable'>;
|
|
5
5
|
/**
|
|
6
6
|
* Default board tile.
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../src/components/Board/Item.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,KAAK,YAAY,EAAE,KAAK,GAAG,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../src/components/Board/Item.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,KAAK,YAAY,EAAE,KAAK,GAAG,IAAI,QAAQ,EAAyC,MAAM,OAAO,CAAC;AAE9G,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAQjC,OAAO,EAAU,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAMzD,KAAK,cAAc,CAAC,KAAK,SAAS,GAAG,CAAC,OAAO,GAAG,GAAG,IAAI,IAAI,CACzD,eAAe,CAAC,KAAK,CAAC,EACtB,YAAY,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAC3D,CAAC;AAuFF;;GAEG;AACH,QAAA,MAAM,SAAS,EAAqB,CAAC,KAAK,SAAS,GAAG,CAAC,OAAO,GAAG,GAAG,EAClE,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAA;CAAE,KAC9D,YAAY,CAAC;AAElB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,CAAC"}
|
|
@@ -22,6 +22,10 @@ type MosaicContainerContextValue<TData = any, Location = LocationType> = {
|
|
|
22
22
|
currentId?: string;
|
|
23
23
|
/** Set the current item by ID. */
|
|
24
24
|
setCurrentId: (id: string | undefined) => void;
|
|
25
|
+
/** IDs of selected (aria-selected) items. */
|
|
26
|
+
selectedIds?: ReadonlySet<string>;
|
|
27
|
+
/** Request to set or unset selection on an item by ID. */
|
|
28
|
+
setSelected: (id: string, selected: boolean) => void;
|
|
25
29
|
/** Register a scroll-to-item callback (provided by Stack/VirtualStack). */
|
|
26
30
|
registerScrollTo: (fn: ((id: string) => void) | undefined) => void;
|
|
27
31
|
};
|
|
@@ -35,11 +39,15 @@ type MosaicContainerProps = PropsWithChildren<Partial<Pick<MosaicContainerContex
|
|
|
35
39
|
currentId?: string;
|
|
36
40
|
/** Called when a tile requests to become current. */
|
|
37
41
|
onCurrentChange?: (id: string | undefined) => void;
|
|
42
|
+
/** Controlled set of selected item IDs. */
|
|
43
|
+
selectedIds?: ReadonlySet<string>;
|
|
44
|
+
/** Called when a tile requests to toggle selection. */
|
|
45
|
+
onSelectionChange?: (id: string, selected: boolean) => void;
|
|
38
46
|
debug?: () => ReactNode;
|
|
39
47
|
}>;
|
|
40
48
|
declare const MosaicContainer: React.ForwardRefExoticComponent<Omit<MosaicContainerProps, "className"> & {
|
|
41
49
|
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
42
|
-
} & Pick<React.HTMLAttributes<Element>, "
|
|
50
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
43
51
|
export { MosaicContainer, useMosaicContainerContext };
|
|
44
52
|
export type { MosaicContainerProps, MosaicContainerState };
|
|
45
53
|
//# sourceMappingURL=Container.d.ts.map
|