@dxos/react-ui-mosaic 0.3.3-main.76bfae3 → 0.3.3-main.8043a2f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +65 -88
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/mosaic/Container.d.ts +1 -6
- package/dist/types/src/mosaic/Container.d.ts.map +1 -1
- package/dist/types/src/mosaic/Mosaic.d.ts +1 -2
- package/dist/types/src/mosaic/Mosaic.d.ts.map +1 -1
- package/dist/types/src/mosaic/hooks/index.d.ts +1 -0
- package/dist/types/src/mosaic/hooks/index.d.ts.map +1 -1
- package/dist/types/src/mosaic/hooks/useItemsWithOrigin.d.ts +3 -0
- package/dist/types/src/mosaic/hooks/useItemsWithOrigin.d.ts.map +1 -0
- package/dist/types/src/mosaic/hooks/useItemsWithPreview.d.ts +1 -2
- package/dist/types/src/mosaic/hooks/useItemsWithPreview.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +0 -7
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/views/Tree/Graph.stories.d.ts +1 -1
- package/dist/types/src/views/Tree/Tree.d.ts +2 -3
- package/dist/types/src/views/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/views/Tree/Tree.stories.d.ts +1 -1
- package/dist/types/src/views/Tree/testing.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/mosaic/Container.tsx +0 -9
- package/src/mosaic/Mosaic.ts +0 -3
- package/src/mosaic/hooks/index.ts +1 -0
- package/src/mosaic/hooks/useItemsWithOrigin.ts +33 -0
- package/src/mosaic/hooks/useItemsWithPreview.ts +24 -55
- package/src/testing/generator.ts +2 -5
- package/src/views/Tree/Tree.tsx +11 -20
- package/src/views/Tree/testing.tsx +2 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx":{"bytes":8053,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts":{"bytes":1561,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"../Container"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx":{"bytes":2101,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/data.ts":{"bytes":2029,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/path.ts":{"bytes":3427,"imports":[],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/styles.ts":{"bytes":1464,"imports":[{"path":"@dnd-kit/utilities","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts":{"bytes":633,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/data.ts","kind":"import-statement","original":"./data"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/path.ts","kind":"import-statement","original":"./path"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/styles.ts","kind":"import-statement","original":"./styles"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx":{"bytes":2903,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx":{"bytes":26016,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"./Container"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx","kind":"import-statement","original":"./Debug"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts":{"bytes":1191,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx","kind":"import-statement","original":"../Root"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts":{"bytes":12334,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts":{"bytes":700,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts","kind":"import-statement","original":"./useContainer"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts","kind":"import-statement","original":"./useItemsWithPreview"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/types.ts":{"bytes":854,"imports":[],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx":{"bytes":14978,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/SortableContext.tsx":{"bytes":6845,"imports":[{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/Tile.tsx":{"bytes":16527,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts":{"bytes":6028,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"./Container"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx","kind":"import-statement","original":"./Debug"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx","kind":"import-statement","original":"./DragOverlay"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx","kind":"import-statement","original":"./Root"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/SortableContext.tsx","kind":"import-statement","original":"./SortableContext"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Tile.tsx","kind":"import-statement","original":"./Tile"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/index.ts":{"bytes":714,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts","kind":"import-statement","original":"./Mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Grid/layout.ts":{"bytes":4883,"imports":[],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Grid/Grid.tsx":{"bytes":23855,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/views/Grid/layout.ts","kind":"import-statement","original":"./layout"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"../../mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Grid/index.ts":{"bytes":556,"imports":[{"path":"packages/ui/react-ui-mosaic/src/views/Grid/layout.ts","kind":"import-statement","original":"./layout"},{"path":"packages/ui/react-ui-mosaic/src/views/Grid/Grid.tsx","kind":"import-statement","original":"./Grid"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Kanban/Kanban.tsx":{"bytes":14820,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"../../mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Kanban/index.ts":{"bytes":478,"imports":[{"path":"packages/ui/react-ui-mosaic/src/views/Kanban/Kanban.tsx","kind":"import-statement","original":"./Kanban"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Stack/Stack.tsx":{"bytes":5469,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"../../mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Stack/index.ts":{"bytes":472,"imports":[{"path":"packages/ui/react-ui-mosaic/src/views/Stack/Stack.tsx","kind":"import-statement","original":"./Stack"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Tree/Tree.tsx":{"bytes":14259,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"../../mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Tree/index.ts":{"bytes":470,"imports":[{"path":"packages/ui/react-ui-mosaic/src/views/Tree/Tree.tsx","kind":"import-statement","original":"./Tree"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/index.ts":{"bytes":708,"imports":[{"path":"packages/ui/react-ui-mosaic/src/views/Grid/index.ts","kind":"import-statement","original":"./Grid"},{"path":"packages/ui/react-ui-mosaic/src/views/Kanban/index.ts","kind":"import-statement","original":"./Kanban"},{"path":"packages/ui/react-ui-mosaic/src/views/Stack/index.ts","kind":"import-statement","original":"./Stack"},{"path":"packages/ui/react-ui-mosaic/src/views/Tree/index.ts","kind":"import-statement","original":"./Tree"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/index.ts":{"bytes":679,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"./mosaic"},{"path":"packages/ui/react-ui-mosaic/src/views/index.ts","kind":"import-statement","original":"./views"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-mosaic/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":88520},"packages/ui/react-ui-mosaic/dist/lib/browser/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dnd-kit/utilities","kind":"import-statement","external":true},{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["Grid","Kanban","Mosaic","Path","Stack","Tree","calculateCellWidth","createMatrix","getBounds","getDimension","getPanelBounds","getTransformCSS","swapItems","useContainer","useItemsWithPreview","useMosaic"],"entryPoint":"packages/ui/react-ui-mosaic/src/index.ts","inputs":{"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts":{"bytesInOutput":188},"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx":{"bytesInOutput":808},"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts":{"bytesInOutput":2792},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts":{"bytesInOutput":194},"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx":{"bytesInOutput":5523},"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx":{"bytesInOutput":442},"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx":{"bytesInOutput":640},"packages/ui/react-ui-mosaic/src/mosaic/util/data.ts":{"bytesInOutput":306},"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/util/path.ts":{"bytesInOutput":678},"packages/ui/react-ui-mosaic/src/mosaic/util/styles.ts":{"bytesInOutput":180},"packages/ui/react-ui-mosaic/src/mosaic/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx":{"bytesInOutput":3434},"packages/ui/react-ui-mosaic/src/mosaic/SortableContext.tsx":{"bytesInOutput":1191},"packages/ui/react-ui-mosaic/src/mosaic/Tile.tsx":{"bytesInOutput":3168},"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts":{"bytesInOutput":383},"packages/ui/react-ui-mosaic/src/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/views/Grid/layout.ts":{"bytesInOutput":877},"packages/ui/react-ui-mosaic/src/views/Grid/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/views/Grid/Grid.tsx":{"bytesInOutput":5576},"packages/ui/react-ui-mosaic/src/views/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/views/Kanban/Kanban.tsx":{"bytesInOutput":3910},"packages/ui/react-ui-mosaic/src/views/Kanban/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/views/Stack/Stack.tsx":{"bytesInOutput":1242},"packages/ui/react-ui-mosaic/src/views/Stack/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/views/Tree/Tree.tsx":{"bytesInOutput":3462},"packages/ui/react-ui-mosaic/src/views/Tree/index.ts":{"bytesInOutput":0}},"bytes":36685}}}
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx":{"bytes":7699,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts":{"bytes":1561,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"../Container"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx":{"bytes":2101,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/data.ts":{"bytes":2029,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/path.ts":{"bytes":3427,"imports":[],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/styles.ts":{"bytes":1464,"imports":[{"path":"@dnd-kit/utilities","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts":{"bytes":633,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/data.ts","kind":"import-statement","original":"./data"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/path.ts","kind":"import-statement","original":"./path"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/styles.ts","kind":"import-statement","original":"./styles"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx":{"bytes":2903,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx":{"bytes":26016,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"./Container"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx","kind":"import-statement","original":"./Debug"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts":{"bytes":1191,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx","kind":"import-statement","original":"../Root"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts":{"bytes":9142,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithOrigin.ts":{"bytes":3646,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts":{"bytes":814,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts","kind":"import-statement","original":"./useContainer"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts","kind":"import-statement","original":"./useItemsWithPreview"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithOrigin.ts","kind":"import-statement","original":"./useItemsWithOrigin"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/types.ts":{"bytes":854,"imports":[],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx":{"bytes":14978,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/SortableContext.tsx":{"bytes":6845,"imports":[{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/Tile.tsx":{"bytes":16527,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts":{"bytes":5852,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"./Container"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx","kind":"import-statement","original":"./Debug"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx","kind":"import-statement","original":"./DragOverlay"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx","kind":"import-statement","original":"./Root"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/SortableContext.tsx","kind":"import-statement","original":"./SortableContext"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Tile.tsx","kind":"import-statement","original":"./Tile"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/index.ts":{"bytes":714,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts","kind":"import-statement","original":"./Mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Grid/layout.ts":{"bytes":4883,"imports":[],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Grid/Grid.tsx":{"bytes":23855,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/views/Grid/layout.ts","kind":"import-statement","original":"./layout"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"../../mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Grid/index.ts":{"bytes":556,"imports":[{"path":"packages/ui/react-ui-mosaic/src/views/Grid/layout.ts","kind":"import-statement","original":"./layout"},{"path":"packages/ui/react-ui-mosaic/src/views/Grid/Grid.tsx","kind":"import-statement","original":"./Grid"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Kanban/Kanban.tsx":{"bytes":14820,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"../../mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Kanban/index.ts":{"bytes":478,"imports":[{"path":"packages/ui/react-ui-mosaic/src/views/Kanban/Kanban.tsx","kind":"import-statement","original":"./Kanban"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Stack/Stack.tsx":{"bytes":5469,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"../../mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Stack/index.ts":{"bytes":472,"imports":[{"path":"packages/ui/react-ui-mosaic/src/views/Stack/Stack.tsx","kind":"import-statement","original":"./Stack"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Tree/Tree.tsx":{"bytes":12593,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"../../mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/Tree/index.ts":{"bytes":470,"imports":[{"path":"packages/ui/react-ui-mosaic/src/views/Tree/Tree.tsx","kind":"import-statement","original":"./Tree"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/views/index.ts":{"bytes":708,"imports":[{"path":"packages/ui/react-ui-mosaic/src/views/Grid/index.ts","kind":"import-statement","original":"./Grid"},{"path":"packages/ui/react-ui-mosaic/src/views/Kanban/index.ts","kind":"import-statement","original":"./Kanban"},{"path":"packages/ui/react-ui-mosaic/src/views/Stack/index.ts","kind":"import-statement","original":"./Stack"},{"path":"packages/ui/react-ui-mosaic/src/views/Tree/index.ts","kind":"import-statement","original":"./Tree"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/index.ts":{"bytes":679,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"./mosaic"},{"path":"packages/ui/react-ui-mosaic/src/views/index.ts","kind":"import-statement","original":"./views"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-mosaic/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":87616},"packages/ui/react-ui-mosaic/dist/lib/browser/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dnd-kit/utilities","kind":"import-statement","external":true},{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["Grid","Kanban","Mosaic","Path","Stack","Tree","calculateCellWidth","createMatrix","getBounds","getDimension","getPanelBounds","getTransformCSS","swapItems","useContainer","useItemsWithOrigin","useItemsWithPreview","useMosaic"],"entryPoint":"packages/ui/react-ui-mosaic/src/index.ts","inputs":{"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts":{"bytesInOutput":188},"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx":{"bytesInOutput":786},"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts":{"bytesInOutput":2023},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts":{"bytesInOutput":194},"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx":{"bytesInOutput":5523},"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx":{"bytesInOutput":442},"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx":{"bytesInOutput":640},"packages/ui/react-ui-mosaic/src/mosaic/util/data.ts":{"bytesInOutput":306},"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/util/path.ts":{"bytesInOutput":678},"packages/ui/react-ui-mosaic/src/mosaic/util/styles.ts":{"bytesInOutput":180},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithOrigin.ts":{"bytesInOutput":594},"packages/ui/react-ui-mosaic/src/mosaic/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx":{"bytesInOutput":3434},"packages/ui/react-ui-mosaic/src/mosaic/SortableContext.tsx":{"bytesInOutput":1191},"packages/ui/react-ui-mosaic/src/mosaic/Tile.tsx":{"bytesInOutput":3168},"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts":{"bytesInOutput":383},"packages/ui/react-ui-mosaic/src/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/views/Grid/layout.ts":{"bytesInOutput":877},"packages/ui/react-ui-mosaic/src/views/Grid/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/views/Grid/Grid.tsx":{"bytesInOutput":5576},"packages/ui/react-ui-mosaic/src/views/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/views/Kanban/Kanban.tsx":{"bytesInOutput":3910},"packages/ui/react-ui-mosaic/src/views/Kanban/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/views/Stack/Stack.tsx":{"bytesInOutput":1242},"packages/ui/react-ui-mosaic/src/views/Stack/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/views/Tree/Tree.tsx":{"bytesInOutput":2987},"packages/ui/react-ui-mosaic/src/views/Tree/index.ts":{"bytesInOutput":0}},"bytes":36106}}}
|
|
@@ -23,7 +23,6 @@ export type MosaicMoveEvent<TPosition = unknown> = {
|
|
|
23
23
|
export type MosaicDropEvent<TPosition = unknown> = MosaicMoveEvent<TPosition> & {
|
|
24
24
|
operation: MosaicOperation;
|
|
25
25
|
};
|
|
26
|
-
export type MosaicCompareDataItem = Parameters<typeof Array.prototype.sort>[0];
|
|
27
26
|
export type MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = Pick<HTMLAttributes<HTMLDivElement>, 'className'> & PropsWithChildren<{
|
|
28
27
|
id: string;
|
|
29
28
|
debug?: boolean;
|
|
@@ -59,15 +58,11 @@ export type MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem,
|
|
|
59
58
|
* Called when a tile is dropped on the container.
|
|
60
59
|
*/
|
|
61
60
|
onDrop?: (event: MosaicDropEvent<TPosition>) => void;
|
|
62
|
-
/**
|
|
63
|
-
* Used to sort items within the container.
|
|
64
|
-
*/
|
|
65
|
-
compare?: MosaicCompareDataItem;
|
|
66
61
|
}>;
|
|
67
62
|
export type MosaicContainerContextType = Omit<MosaicContainerProps<any>, 'children'>;
|
|
68
63
|
export declare const MosaicContainerContext: React.Context<MosaicContainerContextType | undefined>;
|
|
69
64
|
/**
|
|
70
65
|
* Root Container that manages the layout of tiles.
|
|
71
66
|
*/
|
|
72
|
-
export declare const MosaicContainer: ({ children, id, debug, Component, transitionDuration, modifier, getOverlayProps, getOverlayStyle, onOver, onDrop,
|
|
67
|
+
export declare const MosaicContainer: ({ children, id, debug, Component, transitionDuration, modifier, getOverlayProps, getOverlayStyle, onOver, onDrop, }: MosaicContainerProps) => JSX.Element;
|
|
73
68
|
//# sourceMappingURL=Container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Container.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,EAGZ,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEtE,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AAEH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE3E,MAAM,MAAM,eAAe,CAAC,SAAS,GAAG,OAAO,IAAI;IACjD,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,SAAS,GAAG,OAAO,IAAI,eAAe,CAAC,SAAS,CAAC,GAAG;IAC9E,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Container.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,EAGZ,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEtE,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AAEH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE3E,MAAM,MAAM,eAAe,CAAC,SAAS,GAAG,OAAO,IAAI;IACjD,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,SAAS,GAAG,OAAO,IAAI,eAAe,CAAC,SAAS,CAAC,GAAG;IAC9E,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,KAAK,SAAS,cAAc,GAAG,cAAc,EAAE,SAAS,GAAG,OAAO,IAAI,IAAI,CACzG,cAAc,CAAC,cAAc,CAAC,EAC9B,WAAW,CACZ,GACC,iBAAiB,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IAGX,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAE5C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,YAAY,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC,QAAQ,CAAC,CAAC;IAE1G;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,sBAAsB,CAAC;IAE/C;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,aAAa,CAAC;IAEtC;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,SAAS,CAAC,KAAK,eAAe,CAAC;IAEhE;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;CACtD,CAAC,CAAC;AAEL,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;AAErF,eAAO,MAAM,sBAAsB,uDAAmE,CAAC;AAEvG;;GAEG;AACH,eAAO,MAAM,eAAe,wHAWzB,oBAAoB,gBAuBtB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
-
import { type MosaicContainerProps as NaturalMosaicContainerProps, type MosaicMoveEvent as NaturalMosaicMoveEvent, type MosaicDropEvent as NaturalMosaicDropEvent, type MosaicOperation as NaturalMosaicOperation
|
|
2
|
+
import { type MosaicContainerProps as NaturalMosaicContainerProps, type MosaicMoveEvent as NaturalMosaicMoveEvent, type MosaicDropEvent as NaturalMosaicDropEvent, type MosaicOperation as NaturalMosaicOperation } from './Container';
|
|
3
3
|
import { type DebugProps } from './Debug';
|
|
4
4
|
import { type MosaicDragOverlayProps } from './DragOverlay';
|
|
5
5
|
import { type MosaicRootProps as NaturalMosaicRootProps } from './Root';
|
|
@@ -28,6 +28,5 @@ export type MosaicMoveEvent<TPosition = unknown> = NaturalMosaicMoveEvent<TPosit
|
|
|
28
28
|
export type MosaicDropEvent<TPosition = unknown> = NaturalMosaicDropEvent<TPosition>;
|
|
29
29
|
export type MosaicOperation = NaturalMosaicOperation;
|
|
30
30
|
export type MosaicActiveType = NaturalMosaicActiveType;
|
|
31
|
-
export type MosaicCompareDataItem = NaturalMosaicCompareDataItem;
|
|
32
31
|
export type MosaicDebugProps = DebugProps;
|
|
33
32
|
//# sourceMappingURL=Mosaic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mosaic.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Mosaic.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAEL,KAAK,oBAAoB,IAAI,2BAA2B,EACxD,KAAK,eAAe,IAAI,sBAAsB,EAC9C,KAAK,eAAe,IAAI,sBAAsB,EAC9C,KAAK,eAAe,IAAI,sBAAsB,
|
|
1
|
+
{"version":3,"file":"Mosaic.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Mosaic.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAEL,KAAK,oBAAoB,IAAI,2BAA2B,EACxD,KAAK,eAAe,IAAI,sBAAsB,EAC9C,KAAK,eAAe,IAAI,sBAAsB,EAC9C,KAAK,eAAe,IAAI,sBAAsB,EAC/C,MAAM,aAAa,CAAC;AACrB,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAqB,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAc,KAAK,eAAe,IAAI,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AACpF,OAAO,EAAyB,KAAK,mBAAmB,IAAI,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAClH,OAAO,EAIL,KAAK,gBAAgB,IAAI,uBAAuB,EAChD,KAAK,eAAe,IAAI,sBAAsB,EAC9C,KAAK,mBAAmB,IAAI,0BAA0B,EACtD,KAAK,gBAAgB,IAAI,uBAAuB,EACjD,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,MAAM;UAcX,GAAG,eAAe,CAAC;eACd,GAAG,qBAAqB,GAAG,EAAE,GAAG,CAAC,CAAC;iBAChC,GAAG,kBAAkB,CAAC;qBAClB,GAAG,mBAAmB,CAAC;mBACzB,GAAG,gBAAgB,GAAG,EAAE,GAAG,CAAC,CAAC;mBAC7B,GAAG,gBAAgB,GAAG,EAAE,GAAG,CAAC,CAAC;kBAC9B,GAAG,gBAAgB,GAAG,EAAE,MAAM,CAAC,CAAC;;WAGvC,GAAG,gBAAgB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAErD,MAAM,MAAM,oBAAoB,CAC9B,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,SAAS,GAAG,OAAO,IACjB,2BAA2B,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAE7D,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAEvD,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,SAAS,GAAG,OAAO,IACjB,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAE7C,MAAM,MAAM,mBAAmB,CAC7B,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,QAAQ,SAAS,WAAW,GAAG,cAAc,IAC3C,0BAA0B,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAEhD,MAAM,MAAM,eAAe,CAAC,SAAS,GAAG,OAAO,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAAC;AACrF,MAAM,MAAM,eAAe,CAAC,SAAS,GAAG,OAAO,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAAC;AACrF,MAAM,MAAM,eAAe,GAAG,sBAAsB,CAAC;AACrD,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAGvD,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/mosaic/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/mosaic/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useItemsWithOrigin.d.ts","sourceRoot":"","sources":["../../../../../src/mosaic/hooks/useItemsWithOrigin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/C,eAAO,MAAM,kBAAkB,mCAAoC,MAAM,oBAuBxE,CAAC"}
|
|
@@ -3,9 +3,8 @@ import { type MosaicDataItem } from '../types';
|
|
|
3
3
|
* Returns a spliced collection of items including a placeholder if items that could drop,
|
|
4
4
|
* and removing any item that is currently being dragged out.
|
|
5
5
|
*/
|
|
6
|
-
export declare const useItemsWithPreview: <T extends MosaicDataItem>({ path, items
|
|
6
|
+
export declare const useItemsWithPreview: <T extends MosaicDataItem>({ path, items }: {
|
|
7
7
|
path: string;
|
|
8
8
|
items: T[];
|
|
9
|
-
strategy?: "default" | "layout-stable" | undefined;
|
|
10
9
|
}) => T[];
|
|
11
10
|
//# sourceMappingURL=useItemsWithPreview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useItemsWithPreview.d.ts","sourceRoot":"","sources":["../../../../../src/mosaic/hooks/useItemsWithPreview.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C;;;GAGG;AACH,eAAO,MAAM,mBAAmB;
|
|
1
|
+
{"version":3,"file":"useItemsWithPreview.d.ts","sourceRoot":"","sources":["../../../../../src/mosaic/hooks/useItemsWithPreview.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C;;;GAGG;AACH,eAAO,MAAM,mBAAmB;UAAuD,MAAM;;SAsD5F,CAAC"}
|
|
@@ -5,10 +5,6 @@ export type TestItem = {
|
|
|
5
5
|
id: string;
|
|
6
6
|
type: string;
|
|
7
7
|
} & Record<string, any>;
|
|
8
|
-
type ObjectDataGenerator = {
|
|
9
|
-
createSchema?: () => Schema;
|
|
10
|
-
createData: () => any;
|
|
11
|
-
};
|
|
12
8
|
type ObjectFactory<T extends TypedObject> = {
|
|
13
9
|
schema?: Schema;
|
|
14
10
|
createObject: () => T;
|
|
@@ -18,9 +14,6 @@ type ObjectFactoryMap = {
|
|
|
18
14
|
};
|
|
19
15
|
export declare const Status: string[];
|
|
20
16
|
export declare const Priority: number[];
|
|
21
|
-
export declare const defaultGenerators: {
|
|
22
|
-
[type: string]: ObjectDataGenerator;
|
|
23
|
-
};
|
|
24
17
|
/**
|
|
25
18
|
* Typed object generator.
|
|
26
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/testing/generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/testing/generator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG9D,eAAO,MAAM,KAAK,cAAe,MAAM,4BAA4B,MAAM,QAG9C,CAAC;AAE5B,MAAM,MAAM,QAAQ,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAO1E,KAAK,aAAa,CAAC,CAAC,SAAS,WAAW,IAAI;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC,CAAC;CACvB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC;AAW/D,eAAO,MAAM,MAAM,UAAgC,CAAC;AACpD,eAAO,MAAM,QAAQ,UAAkB,CAAC;AAiDxC;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,SAAgB,SAAS,EAAE,gBAAgB,CAAC;gBAEhC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,gBAAgB,CAAA;KAAO;IASzF,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;IAED,YAAY,CAAC,EAAE,KAAK,EAAE,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAO;IAMjD,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAGtE"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import '@dxosTheme';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ id, Component, onOver, onDrop, items, debug
|
|
5
|
+
component: ({ id, Component, onOver, onDrop, items, debug }: import("./Tree").TreeProps<import("./Tree").TreeData>) => JSX.Element;
|
|
6
6
|
render: ({ id, debug }: {
|
|
7
7
|
id: string;
|
|
8
8
|
debug: boolean;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { type MosaicContainerProps, type MosaicDataItem
|
|
1
|
+
import { type MosaicContainerProps, type MosaicDataItem } from '../../mosaic';
|
|
2
2
|
export type TreeProps<TData extends MosaicDataItem = TreeData> = MosaicContainerProps<TData, number> & {
|
|
3
3
|
items?: TData[];
|
|
4
4
|
debug?: boolean;
|
|
5
|
-
compare?: MosaicCompareDataItem;
|
|
6
5
|
};
|
|
7
6
|
export type TreeData = {
|
|
8
7
|
id: string;
|
|
9
8
|
label?: string;
|
|
10
9
|
children: TreeData[];
|
|
11
10
|
};
|
|
12
|
-
export declare const Tree: ({ id, Component, onOver, onDrop, items, debug
|
|
11
|
+
export declare const Tree: ({ id, Component, onOver, onDrop, items, debug }: TreeProps) => JSX.Element;
|
|
13
12
|
//# sourceMappingURL=Tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../../../../src/views/Tree/Tree.tsx"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../../../../src/views/Tree/Tree.tsx"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EAMpB,MAAM,cAAc,CAAC;AAOtB,MAAM,MAAM,SAAS,CAAC,KAAK,SAAS,cAAc,GAAG,QAAQ,IAAI,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG;IACrG,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB,CAAC;AAGF,eAAO,MAAM,IAAI,oDAAqE,SAAS,gBAc9F,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import '@dxosTheme';
|
|
3
3
|
import { type DemoTreeProps } from './testing';
|
|
4
4
|
declare const _default: {
|
|
5
|
-
component: ({ id, Component, onOver, onDrop, items, debug
|
|
5
|
+
component: ({ id, Component, onOver, onDrop, items, debug }: import("./Tree").TreeProps<import("./Tree").TreeData>) => JSX.Element;
|
|
6
6
|
render: (args: DemoTreeProps) => JSX.Element;
|
|
7
7
|
decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0a347bb9").R>[];
|
|
8
8
|
parameters: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../../src/views/Tree/testing.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../../src/views/Tree/testing.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,iBAAiB,CAAC;AAI3D,OAAO,EAAQ,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAM7D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACtC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,QAAQ,uCAAiD,aAAa,gBA0DlF,CAAC;AAEF,eAAO,MAAM,WAAW,aAqBvB,CAAC;AAEF,eAAO,MAAM,SAAS;QAAgD,MAAM;;WAAwB,OAAO;iBA+B1G,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-mosaic",
|
|
3
|
-
"version": "0.3.3-main.
|
|
3
|
+
"version": "0.3.3-main.8043a2f",
|
|
4
4
|
"description": "An intermediate interface for drag-and-drop interactions.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"lodash.defaultsdeep": "^4.6.1",
|
|
26
26
|
"lodash.pick": "^4.4.0",
|
|
27
27
|
"react-resize-detector": "^7.1.2",
|
|
28
|
-
"@dxos/debug": "0.3.3-main.
|
|
29
|
-
"@dxos/invariant": "0.3.3-main.
|
|
30
|
-
"@dxos/keys": "0.3.3-main.
|
|
31
|
-
"@dxos/react-ui": "0.3.3-main.
|
|
32
|
-
"@dxos/react-ui-theme": "0.3.3-main.
|
|
33
|
-
"@dxos/react-ui-types": "0.3.3-main.
|
|
34
|
-
"@dxos/util": "0.3.3-main.
|
|
28
|
+
"@dxos/debug": "0.3.3-main.8043a2f",
|
|
29
|
+
"@dxos/invariant": "0.3.3-main.8043a2f",
|
|
30
|
+
"@dxos/keys": "0.3.3-main.8043a2f",
|
|
31
|
+
"@dxos/react-ui": "0.3.3-main.8043a2f",
|
|
32
|
+
"@dxos/react-ui-theme": "0.3.3-main.8043a2f",
|
|
33
|
+
"@dxos/react-ui-types": "0.3.3-main.8043a2f",
|
|
34
|
+
"@dxos/util": "0.3.3-main.8043a2f"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@faker-js/faker": "^8.0.2",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"react-dom": "^18.2.0",
|
|
48
48
|
"vite": "^4.3.9",
|
|
49
49
|
"vite-plugin-turbosnap": "^1.0.2",
|
|
50
|
-
"@dxos/app-graph": "0.3.3-main.
|
|
51
|
-
"@dxos/echo-schema": "0.3.3-main.
|
|
52
|
-
"@dxos/gem-core": "0.3.3-main.
|
|
53
|
-
"@dxos/react-client": "0.3.3-main.
|
|
50
|
+
"@dxos/app-graph": "0.3.3-main.8043a2f",
|
|
51
|
+
"@dxos/echo-schema": "0.3.3-main.8043a2f",
|
|
52
|
+
"@dxos/gem-core": "0.3.3-main.8043a2f",
|
|
53
|
+
"@dxos/react-client": "0.3.3-main.8043a2f"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@phosphor-icons/react": "^2.0.5",
|
package/src/mosaic/Container.tsx
CHANGED
|
@@ -42,8 +42,6 @@ export type MosaicDropEvent<TPosition = unknown> = MosaicMoveEvent<TPosition> &
|
|
|
42
42
|
operation: MosaicOperation;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
export type MosaicCompareDataItem = Parameters<typeof Array.prototype.sort>[0];
|
|
46
|
-
|
|
47
45
|
export type MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = Pick<
|
|
48
46
|
HTMLAttributes<HTMLDivElement>,
|
|
49
47
|
'className'
|
|
@@ -92,11 +90,6 @@ export type MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem,
|
|
|
92
90
|
* Called when a tile is dropped on the container.
|
|
93
91
|
*/
|
|
94
92
|
onDrop?: (event: MosaicDropEvent<TPosition>) => void;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Used to sort items within the container.
|
|
98
|
-
*/
|
|
99
|
-
compare?: MosaicCompareDataItem;
|
|
100
93
|
}>;
|
|
101
94
|
|
|
102
95
|
export type MosaicContainerContextType = Omit<MosaicContainerProps<any>, 'children'>;
|
|
@@ -117,7 +110,6 @@ export const MosaicContainer = ({
|
|
|
117
110
|
getOverlayStyle,
|
|
118
111
|
onOver,
|
|
119
112
|
onDrop,
|
|
120
|
-
compare,
|
|
121
113
|
}: MosaicContainerProps) => {
|
|
122
114
|
const mosaic = useMosaic();
|
|
123
115
|
const container = {
|
|
@@ -130,7 +122,6 @@ export const MosaicContainer = ({
|
|
|
130
122
|
getOverlayStyle,
|
|
131
123
|
onOver,
|
|
132
124
|
onDrop,
|
|
133
|
-
compare,
|
|
134
125
|
};
|
|
135
126
|
|
|
136
127
|
useEffect(() => {
|
package/src/mosaic/Mosaic.ts
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
type MosaicMoveEvent as NaturalMosaicMoveEvent,
|
|
11
11
|
type MosaicDropEvent as NaturalMosaicDropEvent,
|
|
12
12
|
type MosaicOperation as NaturalMosaicOperation,
|
|
13
|
-
type MosaicCompareDataItem as NaturalMosaicCompareDataItem,
|
|
14
13
|
} from './Container';
|
|
15
14
|
import { Debug, type DebugProps } from './Debug';
|
|
16
15
|
import { DefaultComponent } from './DefaultComponent';
|
|
@@ -82,7 +81,5 @@ export type MosaicDropEvent<TPosition = unknown> = NaturalMosaicDropEvent<TPosit
|
|
|
82
81
|
export type MosaicOperation = NaturalMosaicOperation;
|
|
83
82
|
export type MosaicActiveType = NaturalMosaicActiveType;
|
|
84
83
|
|
|
85
|
-
export type MosaicCompareDataItem = NaturalMosaicCompareDataItem;
|
|
86
|
-
|
|
87
84
|
// TODO(burdon): Remove.
|
|
88
85
|
export type MosaicDebugProps = DebugProps;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useMosaic } from './useMosaic';
|
|
6
|
+
import { type MosaicDataItem } from '../types';
|
|
7
|
+
import { Path } from '../util';
|
|
8
|
+
|
|
9
|
+
// TODO(thure): Harmonize this hook signature with its sibling’s.
|
|
10
|
+
export const useItemsWithOrigin = <T extends MosaicDataItem>(path: string, items: T[]) => {
|
|
11
|
+
const { operation, activeItem, overItem } = useMosaic();
|
|
12
|
+
|
|
13
|
+
if (!activeItem || !overItem) {
|
|
14
|
+
return items;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const activeIsChild = Path.hasChild(path, activeItem.path);
|
|
18
|
+
const overIsChild = Path.hasChild(path, overItem.path);
|
|
19
|
+
|
|
20
|
+
if (activeIsChild && !overIsChild && operation !== 'rearrange') {
|
|
21
|
+
// Change the dnd-id of the origin item that may move to a foreign destination
|
|
22
|
+
return items.map((item) => {
|
|
23
|
+
if (item.id === activeItem.item.id) {
|
|
24
|
+
return { ...item, id: `${item.id}--origin` };
|
|
25
|
+
} else {
|
|
26
|
+
return item;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
// Reset items.
|
|
31
|
+
return items;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -12,15 +12,7 @@ import { Path } from '../util';
|
|
|
12
12
|
* Returns a spliced collection of items including a placeholder if items that could drop,
|
|
13
13
|
* and removing any item that is currently being dragged out.
|
|
14
14
|
*/
|
|
15
|
-
export const useItemsWithPreview = <T extends MosaicDataItem>({
|
|
16
|
-
path,
|
|
17
|
-
items,
|
|
18
|
-
strategy = 'default',
|
|
19
|
-
}: {
|
|
20
|
-
path: string;
|
|
21
|
-
items: T[];
|
|
22
|
-
strategy?: 'default' | 'layout-stable';
|
|
23
|
-
}): T[] => {
|
|
15
|
+
export const useItemsWithPreview = <T extends MosaicDataItem>({ path, items }: { path: string; items: T[] }): T[] => {
|
|
24
16
|
const { operation, activeItem, overItem } = useMosaic();
|
|
25
17
|
const [itemsWithPreview, setItemsWithPreview] = useState(items);
|
|
26
18
|
const overParent =
|
|
@@ -46,55 +38,32 @@ export const useItemsWithPreview = <T extends MosaicDataItem>({
|
|
|
46
38
|
const overIsChild = Path.hasChild(path, overItem.path);
|
|
47
39
|
const overSelf = overItem.path === path;
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
setLastOverParent(undefined);
|
|
72
|
-
setItemsWithPreview(items);
|
|
73
|
-
return;
|
|
74
|
-
} else {
|
|
75
|
-
setLastOverParent(overParent);
|
|
76
|
-
}
|
|
77
|
-
if (!activeIsChild && overIsChild) {
|
|
78
|
-
// Insert item into sortable.
|
|
79
|
-
setItemsWithPreview((items) => {
|
|
80
|
-
const position = overItem.position as number;
|
|
81
|
-
return [...items.slice(0, position), activeItem.item as T, ...items.slice(position)];
|
|
82
|
-
});
|
|
83
|
-
} else if (!activeIsChild && overSelf) {
|
|
84
|
-
// Append item to end of sortable.
|
|
85
|
-
setItemsWithPreview((items) => [...items, activeItem.item as T]);
|
|
86
|
-
} else if (activeIsChild && !overIsChild) {
|
|
87
|
-
// Remove item being dragged out.
|
|
88
|
-
setItemsWithPreview((items) => items.filter((item) => item.id !== activeItem.item.id));
|
|
89
|
-
} else {
|
|
90
|
-
// Reset items.
|
|
91
|
-
setItemsWithPreview(items);
|
|
92
|
-
}
|
|
93
|
-
break;
|
|
41
|
+
if (operation === 'reject' || operation === 'rearrange') {
|
|
42
|
+
setLastOverParent(undefined);
|
|
43
|
+
setItemsWithPreview(items);
|
|
44
|
+
return;
|
|
45
|
+
} else {
|
|
46
|
+
setLastOverParent(overParent);
|
|
47
|
+
}
|
|
48
|
+
if (!activeIsChild && overIsChild) {
|
|
49
|
+
// Insert item into sortable.
|
|
50
|
+
setItemsWithPreview((items) => {
|
|
51
|
+
const position = overItem.position as number;
|
|
52
|
+
return [...items.slice(0, position), activeItem.item as T, ...items.slice(position)];
|
|
53
|
+
});
|
|
54
|
+
} else if (!activeIsChild && overSelf) {
|
|
55
|
+
// Append item to end of sortable.
|
|
56
|
+
setItemsWithPreview((items) => [...items, activeItem.item as T]);
|
|
57
|
+
} else if (activeIsChild && !overIsChild) {
|
|
58
|
+
// Remove item being dragged out.
|
|
59
|
+
setItemsWithPreview((items) => items.filter((item) => item.id !== activeItem.item.id));
|
|
60
|
+
} else {
|
|
61
|
+
// Reset items.
|
|
62
|
+
setItemsWithPreview(items);
|
|
94
63
|
}
|
|
95
64
|
}, [operation, activeItem, overItem, overParent, lastOverParent, path, items]);
|
|
96
65
|
|
|
97
66
|
// In order to avoid render glitching, rather than waiting for the effect to run,
|
|
98
67
|
// immediately return the new items after dropping an item into a new path.
|
|
99
|
-
return
|
|
68
|
+
return items.length === itemsWithPreview.length ? items : itemsWithPreview;
|
|
100
69
|
};
|
package/src/testing/generator.ts
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
// TODO(burdon): Reconcile with @dxos/
|
|
6
|
-
|
|
7
|
-
// TODO(burdon): Bug when adding stale objects to space (e.g., static objects already added in previous story invocation).
|
|
5
|
+
// TODO(burdon): Reconcile with @dxos/echo-generator.
|
|
8
6
|
|
|
9
7
|
import { faker } from '@faker-js/faker';
|
|
10
8
|
|
|
@@ -17,7 +15,6 @@ export const range = <T>(fn: (i: number) => T | undefined, length: number): T[]
|
|
|
17
15
|
.map((_, i) => fn(i))
|
|
18
16
|
.filter(Boolean) as T[];
|
|
19
17
|
|
|
20
|
-
// TODO(burdon): Commit to using ECHO to generate all test data? Or convert from raw data?
|
|
21
18
|
export type TestItem = { id: string; type: string } & Record<string, any>;
|
|
22
19
|
|
|
23
20
|
type ObjectDataGenerator = {
|
|
@@ -44,7 +41,7 @@ const createFactory = ({ createSchema, createData }: ObjectDataGenerator) => {
|
|
|
44
41
|
export const Status = ['pending', 'active', 'done'];
|
|
45
42
|
export const Priority = [1, 2, 3, 4, 5];
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
const defaultGenerators: { [type: string]: ObjectDataGenerator } = {
|
|
48
45
|
document: {
|
|
49
46
|
createData: () => ({
|
|
50
47
|
title: faker.lorem.sentence(3),
|