@dxos/react-ui-mosaic 0.3.3-main.052ad73 → 0.3.3-main.1817c8a

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.
@@ -272,7 +272,7 @@ var MosaicDebug = ({ containers, operation, activeItem, overItem }) => {
272
272
  var useMosaic = () => useContext2(MosaicContext) ?? raise2(new Error("Missing MosaicContext"));
273
273
 
274
274
  // packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts
275
- var useItemsWithPreview = ({ path, items, strategy = "default" }) => {
275
+ var useItemsWithPreview = ({ path, items }) => {
276
276
  const { operation, activeItem, overItem } = useMosaic();
277
277
  const [itemsWithPreview, setItemsWithPreview] = useState2(items);
278
278
  const overParent = (
@@ -282,7 +282,7 @@ var useItemsWithPreview = ({ path, items, strategy = "default" }) => {
282
282
  );
283
283
  const [lastOverParent, setLastOverParent] = useState2(overParent);
284
284
  useEffect2(() => {
285
- if (!activeItem || !overItem) {
285
+ if (operation === "reject" || operation === "rearrange" || !activeItem || !overItem) {
286
286
  setLastOverParent(void 0);
287
287
  setItemsWithPreview(items);
288
288
  return;
@@ -290,56 +290,28 @@ var useItemsWithPreview = ({ path, items, strategy = "default" }) => {
290
290
  if (lastOverParent === overParent) {
291
291
  return;
292
292
  }
293
+ setLastOverParent(overParent);
293
294
  const activeIsChild = Path.hasChild(path, activeItem.path);
294
295
  const overIsChild = Path.hasChild(path, overItem.path);
295
296
  const overSelf = overItem.path === path;
296
- switch (strategy) {
297
- case "layout-stable":
298
- setLastOverParent(overParent);
299
- if (activeIsChild && !overIsChild && operation !== "rearrange") {
300
- setItemsWithPreview((sortedItems) => sortedItems.map((item) => {
301
- if (item.id === activeItem.item.id) {
302
- return {
303
- ...item,
304
- id: `${item.id}--origin`
305
- };
306
- } else {
307
- return item;
308
- }
309
- }));
310
- } else {
311
- setItemsWithPreview(items);
312
- }
313
- break;
314
- case "default":
315
- default:
316
- if (operation === "reject" || operation === "rearrange") {
317
- setLastOverParent(void 0);
318
- setItemsWithPreview(items);
319
- return;
320
- } else {
321
- setLastOverParent(overParent);
322
- }
323
- if (!activeIsChild && overIsChild) {
324
- setItemsWithPreview((items2) => {
325
- const position = overItem.position;
326
- return [
327
- ...items2.slice(0, position),
328
- activeItem.item,
329
- ...items2.slice(position)
330
- ];
331
- });
332
- } else if (!activeIsChild && overSelf) {
333
- setItemsWithPreview((items2) => [
334
- ...items2,
335
- activeItem.item
336
- ]);
337
- } else if (activeIsChild && !overIsChild) {
338
- setItemsWithPreview((items2) => items2.filter((item) => item.id !== activeItem.item.id));
339
- } else {
340
- setItemsWithPreview(items);
341
- }
342
- break;
297
+ if (!activeIsChild && overIsChild) {
298
+ setItemsWithPreview((items2) => {
299
+ const position = overItem.position;
300
+ return [
301
+ ...items2.slice(0, position),
302
+ activeItem.item,
303
+ ...items2.slice(position)
304
+ ];
305
+ });
306
+ } else if (!activeIsChild && overSelf) {
307
+ setItemsWithPreview((items2) => [
308
+ ...items2,
309
+ activeItem.item
310
+ ]);
311
+ } else if (activeIsChild && !overIsChild) {
312
+ setItemsWithPreview((items2) => items2.filter((item) => item.id !== activeItem.item.id));
313
+ } else {
314
+ setItemsWithPreview(items);
343
315
  }
344
316
  }, [
345
317
  operation,
@@ -350,7 +322,15 @@ var useItemsWithPreview = ({ path, items, strategy = "default" }) => {
350
322
  path,
351
323
  items
352
324
  ]);
353
- return strategy !== "layout-stable" && items.length === itemsWithPreview.length ? items : itemsWithPreview;
325
+ return items.length === itemsWithPreview.length ? items : itemsWithPreview;
326
+ };
327
+
328
+ // packages/ui/react-ui-mosaic/src/mosaic/hooks/useSortedItems.ts
329
+ var useSortedItems = (items) => {
330
+ const { compare } = useContainer();
331
+ return compare ? [
332
+ ...items
333
+ ].sort(compare) : items;
354
334
  };
355
335
 
356
336
  // packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx
@@ -951,7 +931,7 @@ var Stack = ({ id, Component: Component2 = Mosaic.DefaultComponent, onOver, onDr
951
931
  };
952
932
 
953
933
  // packages/ui/react-ui-mosaic/src/views/Tree/Tree.tsx
954
- import React11, { forwardRef as forwardRef3, useMemo as useMemo3 } from "react";
934
+ import React11, { forwardRef as forwardRef3 } from "react";
955
935
  import { Card as Card3, Tree as TreeComponent, TreeItem as TreeItemComponent } from "@dxos/react-ui";
956
936
  import { dropRing, mx as mx5 } from "@dxos/react-ui-theme";
957
937
  var Tree = ({ id, Component: Component2 = TreeItem, onOver, onDrop, items = [], debug, compare }) => {
@@ -967,27 +947,15 @@ var Tree = ({ id, Component: Component2 = TreeItem, onOver, onDrop, items = [],
967
947
  }));
968
948
  };
969
949
  var TreeRoot = ({ items }) => {
970
- const { id, Component: Component2, compare } = useContainer();
971
- const sortedItems = useMemo3(() => {
972
- return compare ? [
973
- ...items
974
- ].sort(compare) : items;
975
- }, [
976
- items,
977
- compare
978
- ]);
979
- const itemsWithPreview = useItemsWithPreview({
980
- items: sortedItems,
981
- path: id,
982
- strategy: "layout-stable"
983
- });
950
+ const { id, Component: Component2 } = useContainer();
951
+ const sortedItems = useSortedItems(items);
984
952
  return /* @__PURE__ */ React11.createElement(TreeComponent.Root, {
985
953
  classNames: "flex flex-col"
986
954
  }, /* @__PURE__ */ React11.createElement(Mosaic.SortableContext, {
987
955
  id,
988
- items: itemsWithPreview,
956
+ items: sortedItems,
989
957
  direction: "vertical"
990
- }, itemsWithPreview.map((item, index) => /* @__PURE__ */ React11.createElement(TreeItemComponent.Root, {
958
+ }, sortedItems.map((item, index) => /* @__PURE__ */ React11.createElement(TreeItemComponent.Root, {
991
959
  key: item.id,
992
960
  collapsible: true,
993
961
  defaultOpen: true
@@ -1013,27 +981,15 @@ var TreeItem = /* @__PURE__ */ forwardRef3(({ path, draggableStyle, draggablePro
1013
981
  });
1014
982
  var TreeBranch = ({ path, items }) => {
1015
983
  const { operation, overItem } = useMosaic();
1016
- const { Component: Component2, compare } = useContainer();
1017
- const sortedItems = useMemo3(() => {
1018
- return compare ? [
1019
- ...items
1020
- ].sort(compare) : items;
1021
- }, [
1022
- items,
1023
- compare
1024
- ]);
1025
- const itemsWithPreview = useItemsWithPreview({
1026
- items: sortedItems,
1027
- path,
1028
- strategy: "layout-stable"
1029
- });
984
+ const { Component: Component2 } = useContainer();
985
+ const sortedItems = useSortedItems(items);
1030
986
  return /* @__PURE__ */ React11.createElement(TreeItemComponent.Body, {
1031
987
  className: "pis-4"
1032
988
  }, /* @__PURE__ */ React11.createElement(Mosaic.SortableContext, {
1033
989
  id: path,
1034
- items: itemsWithPreview,
990
+ items: sortedItems,
1035
991
  direction: "vertical"
1036
- }, itemsWithPreview.map((child, index) => /* @__PURE__ */ React11.createElement(TreeComponent.Branch, {
992
+ }, sortedItems.map((child, index) => /* @__PURE__ */ React11.createElement(TreeComponent.Branch, {
1037
993
  key: child.id
1038
994
  }, /* @__PURE__ */ React11.createElement(TreeItemComponent.Root, {
1039
995
  collapsible: true,
@@ -1062,6 +1018,7 @@ export {
1062
1018
  swapItems,
1063
1019
  useContainer,
1064
1020
  useItemsWithPreview,
1065
- useMosaic
1021
+ useMosaic,
1022
+ useSortedItems
1066
1023
  };
1067
1024
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/mosaic/hooks/useContainer.ts", "../../../src/mosaic/Container.tsx", "../../../src/mosaic/hooks/useItemsWithPreview.ts", "../../../src/mosaic/hooks/useMosaic.ts", "../../../src/mosaic/Root.tsx", "../../../src/mosaic/Debug.tsx", "../../../src/mosaic/DefaultComponent.tsx", "../../../src/mosaic/util/data.ts", "../../../src/mosaic/util/path.ts", "../../../src/mosaic/util/styles.ts", "../../../src/mosaic/DragOverlay.tsx", "../../../src/mosaic/SortableContext.tsx", "../../../src/mosaic/Tile.tsx", "../../../src/mosaic/Mosaic.ts", "../../../src/views/Grid/layout.ts", "../../../src/views/Grid/Grid.tsx", "../../../src/views/Kanban/Kanban.tsx", "../../../src/views/Stack/Stack.tsx", "../../../src/views/Tree/Tree.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { MosaicContainerContext, type MosaicContainerProps } from '../Container';\nimport { type MosaicDataItem } from '../types';\n\nexport const useContainer = <\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n>(): MosaicContainerProps<TData, TPosition> =>\n useContext(MosaicContainerContext) ?? raise(new Error('Missing MosaicContainerContext'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Modifier } from '@dnd-kit/core';\nimport React, {\n createContext,\n useEffect,\n type CSSProperties,\n type HTMLAttributes,\n type PropsWithChildren,\n} from 'react';\n\nimport { type MosaicTileComponent } from './Tile';\nimport { useMosaic } from './hooks';\nimport { type MosaicDataItem, type MosaicDraggedItem } from './types';\n\nexport const DEFAULT_TRANSITION = 200;\n\nexport type MosaicTileOverlayProps = {\n grow?: boolean;\n debug?: boolean;\n};\n\n/**\n * Possible operations when dropping a tile.\n *\n * * `transfer` - Remove the tile from it's current path and move to a new path.\n * * `copy` - Add a clone of the tile at a new path.\n * * `rearrange` - Change the order of the tile within it's current path.\n * * `reject` - The tile is not allowed where it was dropped.\n */\n// TODO(wittjosiah): Add 'delete'. Consider adding 'swap'.\nexport type MosaicOperation = 'transfer' | 'copy' | 'rearrange' | 'reject';\n\nexport type MosaicMoveEvent<TPosition = unknown> = {\n active: MosaicDraggedItem<TPosition>;\n over: MosaicDraggedItem<TPosition>;\n};\n\nexport type MosaicDropEvent<TPosition = unknown> = MosaicMoveEvent<TPosition> & {\n operation: MosaicOperation;\n};\n\nexport type MosaicCompareDataItem = Parameters<typeof Array.prototype.sort>[0];\n\nexport type MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = Pick<\n HTMLAttributes<HTMLDivElement>,\n 'className'\n> &\n PropsWithChildren<{\n id: string;\n\n // TODO(wittjosiah): Don't expose externally.\n debug?: boolean;\n\n /**\n * Default component used to render tiles.\n */\n Component?: MosaicTileComponent<TData, any>;\n\n /**\n * Length of transition when moving tiles in milliseconds.\n *\n * @default 200\n */\n transitionDuration?: number;\n\n /**\n * Adapter to transform properties while dragging (e.g., constraint axes).\n * https://github.com/clauderic/dnd-kit/blob/master/packages/core/src/modifiers/types.ts\n */\n modifier?: (activeItem: MosaicDraggedItem, ...modifierArgs: Parameters<Modifier>) => ReturnType<Modifier>;\n\n /**\n * Property overrides for the default overlay.\n */\n getOverlayProps?: () => MosaicTileOverlayProps;\n\n /**\n * Style property overrides for the default overlay.\n */\n getOverlayStyle?: () => CSSProperties;\n\n /**\n * Called when a tile is dragged over the container.\n * Returns true if the tile can be dropped.\n */\n onOver?: (event: MosaicMoveEvent<TPosition>) => MosaicOperation;\n\n /**\n * Called when a tile is dropped on the container.\n */\n onDrop?: (event: MosaicDropEvent<TPosition>) => void;\n\n /**\n * Used to sort items within the container.\n */\n compare?: MosaicCompareDataItem;\n }>;\n\nexport type MosaicContainerContextType = Omit<MosaicContainerProps<any>, 'children'>;\n\nexport const MosaicContainerContext = createContext<MosaicContainerContextType | undefined>(undefined);\n\n/**\n * Root Container that manages the layout of tiles.\n */\nexport const MosaicContainer = ({\n children,\n id,\n debug,\n Component,\n transitionDuration = DEFAULT_TRANSITION,\n modifier,\n getOverlayProps,\n getOverlayStyle,\n onOver,\n onDrop,\n compare,\n}: MosaicContainerProps) => {\n const mosaic = useMosaic();\n const container = {\n id,\n debug,\n Component,\n transitionDuration,\n modifier,\n getOverlayProps,\n getOverlayStyle,\n onOver,\n onDrop,\n compare,\n };\n\n useEffect(() => {\n mosaic.setContainer(container.id, container);\n return () => {\n // TODO(burdon): The overlay unregisters the container after the tile has re-rendered (removing it).\n // mosaic.setContainer(container.id);\n };\n }, Object.values(container));\n\n return <MosaicContainerContext.Provider value={container}>{children}</MosaicContainerContext.Provider>;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { useMosaic } from './useMosaic';\nimport { type MosaicDataItem } from '../types';\nimport { Path } from '../util';\n\n/**\n * Returns a spliced collection of items including a placeholder if items that could drop,\n * and removing any item that is currently being dragged out.\n */\nexport const useItemsWithPreview = <T extends MosaicDataItem>({\n path,\n items,\n strategy = 'default',\n}: {\n path: string;\n items: T[];\n strategy?: 'default' | 'layout-stable';\n}): T[] => {\n const { operation, activeItem, overItem } = useMosaic();\n const [itemsWithPreview, setItemsWithPreview] = useState(items);\n const overParent =\n // If over the sortable context itself & active item is foreign, then treat self as the parent.\n // This allows items to be appended to the end of the sortable.\n overItem?.path === path && activeItem && Path.parent(activeItem.path) !== overItem.path\n ? path\n : overItem && Path.parent(overItem.path);\n const [lastOverParent, setLastOverParent] = useState(overParent);\n\n useEffect(() => {\n if (!activeItem || !overItem) {\n setLastOverParent(undefined);\n setItemsWithPreview(items);\n return;\n }\n\n if (lastOverParent === overParent) {\n return;\n }\n\n const activeIsChild = Path.hasChild(path, activeItem.path);\n const overIsChild = Path.hasChild(path, overItem.path);\n const overSelf = overItem.path === path;\n\n switch (strategy) {\n case 'layout-stable':\n setLastOverParent(overParent);\n if (activeIsChild && !overIsChild && operation !== 'rearrange') {\n // Change the dnd-id of the origin item that may move to a foreign destination\n setItemsWithPreview((sortedItems) =>\n sortedItems.map((item) => {\n if (item.id === activeItem.item.id) {\n return { ...item, id: `${item.id}--origin` };\n } else {\n return item;\n }\n }),\n );\n } else {\n // Reset items.\n setItemsWithPreview(items);\n }\n break;\n case 'default':\n default:\n if (operation === 'reject' || operation === 'rearrange') {\n setLastOverParent(undefined);\n setItemsWithPreview(items);\n return;\n } else {\n setLastOverParent(overParent);\n }\n if (!activeIsChild && overIsChild) {\n // Insert item into sortable.\n setItemsWithPreview((items) => {\n const position = overItem.position as number;\n return [...items.slice(0, position), activeItem.item as T, ...items.slice(position)];\n });\n } else if (!activeIsChild && overSelf) {\n // Append item to end of sortable.\n setItemsWithPreview((items) => [...items, activeItem.item as T]);\n } else if (activeIsChild && !overIsChild) {\n // Remove item being dragged out.\n setItemsWithPreview((items) => items.filter((item) => item.id !== activeItem.item.id));\n } else {\n // Reset items.\n setItemsWithPreview(items);\n }\n break;\n }\n }, [operation, activeItem, overItem, overParent, lastOverParent, path, items]);\n\n // In order to avoid render glitching, rather than waiting for the effect to run,\n // immediately return the new items after dropping an item into a new path.\n return strategy !== 'layout-stable' && items.length === itemsWithPreview.length ? items : itemsWithPreview;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { MosaicContext } from '../Root';\n\nexport const useMosaic = () => useContext(MosaicContext) ?? raise(new Error('Missing MosaicContext'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport {\n type CollisionDetection,\n DndContext,\n type DragCancelEvent,\n type DragEndEvent,\n type DragMoveEvent,\n type DragOverEvent,\n type DragStartEvent,\n KeyboardSensor,\n type Modifier,\n MouseSensor,\n pointerWithin,\n rectIntersection,\n TouchSensor,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport { sortableKeyboardCoordinates } from '@dnd-kit/sortable';\nimport pick from 'lodash.pick';\nimport React, { createContext, type FC, type PropsWithChildren, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { DEFAULT_TRANSITION, type MosaicContainerProps, type MosaicMoveEvent, type MosaicOperation } from './Container';\nimport { Debug } from './Debug';\nimport { DefaultComponent } from './DefaultComponent';\nimport { type MosaicTileComponent } from './Tile';\nimport { type MosaicDraggedItem } from './types';\nimport { Path } from './util';\n\nconst DEFAULT_COMPONENT_ID = '__default';\n\nexport type MosaicContextType = {\n containers: Record<string, MosaicContainerProps<any> | undefined>;\n setContainer: (id: string, container?: MosaicContainerProps<any>) => void;\n activeItem: MosaicDraggedItem | undefined;\n overItem: MosaicDraggedItem | undefined;\n operation: MosaicOperation;\n};\n\nexport const MosaicContext = createContext<MosaicContextType | undefined>(undefined);\n\nexport type MosaicRootProps = PropsWithChildren<{\n /**\n * Default component.\n */\n Component?: MosaicTileComponent<any>;\n debug?: boolean;\n}>;\n\n/**\n * Root context provider.\n */\nexport const MosaicRoot: FC<MosaicRootProps> = ({ Component = DefaultComponent, debug, children }) => {\n const [containers, setContainers] = useState<MosaicContextType['containers']>({\n [DEFAULT_COMPONENT_ID]: { id: DEFAULT_COMPONENT_ID, Component },\n });\n\n const handleSetContainer = (id: string, container?: MosaicContainerProps<any>) => {\n setContainers((containers) => {\n if (container) {\n return { ...containers, [id]: container };\n } else {\n const { [id]: _, ...rest } = containers;\n return rest;\n }\n });\n };\n\n const [activeItem, setActiveItem] = useState<MosaicDraggedItem>();\n const [overItem, setOverItem] = useState<MosaicDraggedItem>();\n const [operation, setOperation] = useState<MosaicOperation>('reject');\n\n //\n // DndKit Defaults\n //\n\n /**\n * See: https://docs.dndkit.com/api-documentation/context-provider/collision-detection-algorithms#custom-collision-detection-algorithms\n * See: https://github.com/clauderic/dnd-kit/tree/master/packages/core/src/utilities/algorithms\n */\n // TODO(burdon): Flickering: should not change while animation is happening.\n const collisionDetection: CollisionDetection = (args) => {\n // pointerWithin is the most accurate (since we're using drag handles), but only works with pointer sensors.\n const pointerCollisions = pointerWithin(args);\n if (pointerCollisions.length > 0) {\n return pointerCollisions;\n }\n\n // If there are no collisions with the pointer, return rectangle intersections.\n return rectIntersection(args);\n };\n\n /**\n * Dragging transformation modifiers adaptable by container.\n * See: https://github.com/clauderic/dnd-kit/tree/master/packages/core/src/modifiers\n */\n const modifiers: Modifier = (props) => {\n const { transform } = props;\n if (activeItem) {\n const container = containers[Path.first(activeItem.path)];\n return container?.modifier?.(activeItem, props) ?? transform;\n } else {\n return transform;\n }\n };\n\n /**\n * See: https://github.com/clauderic/dnd-kit/tree/master/packages/core/src/sensors\n */\n const sensors = useSensors(\n useSensor(MouseSensor, {\n activationConstraint: {\n distance: 10,\n },\n }),\n useSensor(TouchSensor, {\n activationConstraint: {\n delay: 200,\n tolerance: 5,\n },\n }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n //\n // Events\n //\n\n const handleDragStart = (event: DragStartEvent) => {\n setActiveItem(pick(event.active.data.current as MosaicDraggedItem, 'path', 'item', 'position'));\n };\n\n const handleDragMove = (event: DragMoveEvent) => {};\n\n const handleDragOver = (event: DragOverEvent) => {\n const overItem = pick(event.over?.data.current as MosaicDraggedItem, 'path', 'item', 'position');\n\n // If the over item is the same as the active item, do nothing.\n // This happens when moving between containers where a placeholder of itself is rendered where it will be dropped.\n if (overItem?.item?.id === activeItem?.item.id) {\n return;\n }\n\n const activeContainer = activeItem && containers[Path.first(activeItem.path)];\n const overContainer = overItem?.path && containers[Path.first(overItem.path)];\n if (!event.over || !overItem || !overContainer || !activeItem || !activeContainer) {\n setOperation('reject');\n setOverItem(undefined);\n return;\n }\n\n const onOver = ({ active, over }: MosaicMoveEvent) => {\n if (Path.parent(active.path) === Path.parent(over.path)) {\n return 'rearrange';\n } else if (overContainer.onOver) {\n return overContainer.onOver({ active, over });\n } else {\n return 'reject';\n }\n };\n\n setOperation(onOver({ active: activeItem, over: overItem }));\n setOverItem(overItem);\n };\n\n const handleDragCancel = (event: DragCancelEvent) => {\n setOperation('reject');\n setActiveItem(undefined);\n setOverItem(undefined);\n };\n\n const handleDragEnd = (event: DragEndEvent) => {\n const overContainer = overItem && containers[Path.first(overItem.path)];\n\n if (\n operation !== 'reject' &&\n activeItem &&\n overItem &&\n (activeItem.path !== overItem.path || activeItem.position !== overItem.position)\n ) {\n const activeContainer = containers[Path.first(activeItem.path)];\n if (activeContainer) {\n activeContainer.onDrop?.({ operation, active: activeItem, over: overItem });\n\n if (overContainer && overContainer !== activeContainer) {\n overContainer.onDrop?.({ operation, active: activeItem, over: overItem });\n }\n }\n }\n\n setTimeout(() => {\n setOperation('reject');\n setOverItem(undefined);\n setActiveItem(undefined);\n }, overContainer?.transitionDuration ?? DEFAULT_TRANSITION);\n };\n\n return (\n <MosaicContext.Provider value={{ containers, setContainer: handleSetContainer, activeItem, overItem, operation }}>\n <DndContext\n collisionDetection={collisionDetection}\n modifiers={[modifiers]}\n sensors={sensors}\n // TODO(burdon): Allow container to veto drop.\n cancelDrop={(event) => false}\n onDragStart={handleDragStart}\n onDragMove={handleDragMove}\n onDragOver={handleDragOver}\n onDragCancel={handleDragCancel}\n onDragEnd={handleDragEnd}\n >\n {children}\n {debug &&\n createPortal(\n <MosaicDebug containers={containers} operation={operation} activeItem={activeItem} overItem={overItem} />,\n document.body,\n )}\n </DndContext>\n </MosaicContext.Provider>\n );\n};\n\nconst MosaicDebug: FC<{\n containers: MosaicContextType['containers'];\n operation: MosaicOperation;\n activeItem?: MosaicDraggedItem;\n overItem?: MosaicDraggedItem;\n}> = ({ containers, operation, activeItem, overItem }) => {\n return (\n <Debug\n position='bottom-right'\n data={{\n containers: Object.keys(containers).map((id) => id),\n operation,\n active: {\n id: activeItem?.item?.id.slice(0, 16),\n path: activeItem?.path && Path.create(...Path.parts(activeItem.path).map((part) => part.slice(0, 16))),\n position: activeItem?.position,\n },\n over: {\n id: overItem?.item?.id.slice(0, 16),\n path: overItem?.path && Path.create(...Path.parts(overItem.path).map((part) => part.slice(0, 16))),\n position: overItem?.position,\n },\n }}\n />\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { mx } from '@dxos/react-ui-theme';\n\ntype Position = 'bottom-left' | 'bottom-right';\n\nexport type DebugProps = { data: any; position?: Position };\n\nexport const Debug: FC<DebugProps> = ({ data, position }) => (\n <pre\n className={mx(\n 'font-mono text-xs overflow-hidden m-2 p-1 z-[100]',\n 'bg-neutral-50 dark:bg-neutral-700 border border-neutral-300 rounded',\n position === 'bottom-left' && 'fixed left-0 bottom-0',\n position === 'bottom-right' && 'fixed right-0 bottom-0',\n )}\n >\n {JSON.stringify(data, undefined, 1)}\n </pre>\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef } from 'react';\n\nimport { Card } from '@dxos/react-ui';\n\nimport { type MosaicTileComponent } from './Tile';\nimport { type MosaicDataItem } from './types';\nimport { Path } from './util';\n\nexport const DefaultComponent: MosaicTileComponent<MosaicDataItem> = forwardRef(\n ({ draggableStyle, draggableProps, item: { id }, path }, forwardRef) => {\n return (\n <Card.Root ref={forwardRef} style={draggableStyle}>\n <Card.Header>\n <Card.DragHandle {...draggableProps} />\n <Card.Title title={Path.create(path, id)} classNames='truncate font-mono text-xs' />\n </Card.Header>\n </Card.Root>\n );\n },\n);\n\nDefaultComponent.displayName = 'DefaultComponent';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { arrayMove } from '@dxos/util';\n\nimport { type MosaicDataItem } from '../types';\n\n// TODO(wittjosiah): Generalize and expand rearrange utilities.\n\nexport const swapItems = <TItem extends MosaicDataItem, TValue extends MosaicDataItem>(\n items: TItem[],\n from: TValue,\n to: TValue,\n): TItem[] => {\n const fromIndex = items.findIndex((item) => item.id === from.id);\n const toIndex = items.findIndex((item) => item.id === to.id);\n return fromIndex !== -1 && toIndex !== -1 ? arrayMove(items, fromIndex, toIndex) : items;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst SEPARATOR = '/';\n\nexport const Path = {\n create: (...args: string[]) => args.join(SEPARATOR),\n\n parts: (path: string) => path.split(SEPARATOR),\n length: (path: string) => path.split(SEPARATOR).length,\n first: (path: string) => path.split(SEPARATOR)[0] ?? path,\n last: (path: string) => path.split(SEPARATOR).at(-1) ?? path,\n parent: (path: string) => path.split(SEPARATOR).slice(0, -1).join(SEPARATOR),\n\n hasRoot: (path: string, id: string) => Path.first(path) === id,\n hasChild: (path: string, compare: string) => Path.parent(compare) === path,\n hasDescendent: (path: string, compare: string) => compare !== path && compare.startsWith(path),\n siblings: (path: string, compare: string) => Path.parent(path) === Path.parent(compare),\n onPath: (path: string, id: string) => Path.parts(path).includes(id),\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// https://docs.dndkit.com/api-documentation/draggable/usedraggable#transform\n\nimport { CSS, type Transform } from '@dnd-kit/utilities';\n\nexport const getTransformCSS = (transform: Transform | null) =>\n transform ? CSS.Transform.toString(Object.assign(transform, { scaleX: 1, scaleY: 1 })) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DragOverlay } from '@dnd-kit/core';\nimport React, { Component, type PropsWithChildren, useEffect, useRef, useState } from 'react';\n\nimport { DensityProvider } from '@dxos/react-ui';\n\nimport { type MosaicContainerProps } from './Container';\nimport { DefaultComponent } from './DefaultComponent';\nimport { type MosaicTileComponent } from './Tile';\nimport { useMosaic } from './hooks';\nimport { Path } from './util';\n\nexport type MosaicDragOverlayProps = { delay?: number; debug?: boolean } & Omit<\n React.ComponentProps<typeof DragOverlay>,\n 'children'\n>;\n\n/**\n * Render the currently dragged item of the Mosaic.\n */\nexport const MosaicDragOverlay = ({ delay = 200, debug = false, ...overlayProps }: MosaicDragOverlayProps) => {\n const { containers, operation, activeItem, overItem } = useMosaic();\n\n // Get the overlay component from the over container, otherwise default to the original.\n const [state, setState] = useState<{\n container?: MosaicContainerProps<any>;\n OverlayComponent?: MosaicTileComponent<any>;\n }>({});\n\n const timer = useRef<ReturnType<typeof setTimeout>>();\n\n useEffect(() => {\n if (activeItem) {\n let container: MosaicContainerProps<any> | undefined;\n let OverlayComponent: MosaicTileComponent<any> | undefined;\n if (overItem?.path) {\n container = containers[Path.first(overItem.path)];\n OverlayComponent = container?.Component;\n }\n\n if (!OverlayComponent) {\n container = containers[Path.first(activeItem.path)];\n OverlayComponent = container?.Component ?? DefaultComponent;\n }\n\n // Prevent jitter when transitioning across containers.\n clearTimeout(timer.current);\n timer.current = setTimeout(() => setState({ container, OverlayComponent }), timer.current ? delay : 0);\n } else {\n setState({});\n }\n }, [activeItem, overItem]);\n\n // Ensure the overlay is rendered as soon as there's an active item, then use local state.\n const container = state.container ?? (activeItem && containers[Path.first(activeItem.path)]);\n const OverlayComponent = state.OverlayComponent ?? container?.Component;\n // Fallback is always to the active (origin) container.\n const FallbackComponent = (activeItem && containers[Path.first(activeItem.path)])?.Component ?? DefaultComponent;\n\n // NOTE: The DragOverlay wrapper element must always be mounted to support animations. Conditionally render the content.\n return (\n // TODO(burdon): Set custom animations (e.g., in/out/around).\n <DragOverlay adjustScale={false} {...overlayProps} style={{ ...container?.getOverlayStyle?.() }}>\n {/* TODO(burdon): Configure density via getOverlayProps. */}\n {activeItem?.path && container && OverlayComponent && (\n <DensityProvider density='fine'>\n <OverlayErrorBoundary\n fallback={\n <FallbackComponent\n {...container.getOverlayProps?.()}\n item={activeItem.item}\n path={activeItem.path}\n operation={operation}\n active='overlay'\n />\n }\n >\n <OverlayComponent\n {...container.getOverlayProps?.()}\n item={activeItem.item}\n path={activeItem.path}\n operation={operation}\n active='overlay'\n />\n {debug && (\n <div className='flex flex-wrap mt-1 p-1 bg-neutral-50 dark:bg-neutral-700 text-xs border rounded overflow-hidden gap-1'>\n <span className='truncate'>\n <span className='text-neutral-400'>container </span>\n {container.id}\n </span>\n <span className='truncate'>\n <span className='text-neutral-400'>item </span>\n {activeItem.item.id.slice(0, 8)}\n </span>\n </div>\n )}\n </OverlayErrorBoundary>\n </DensityProvider>\n )}\n </DragOverlay>\n );\n};\n\ntype OverlayErrorBoundaryProps = PropsWithChildren<{ fallback?: React.ReactNode }>;\n\nclass OverlayErrorBoundary extends Component<OverlayErrorBoundaryProps> {\n private readonly fallback: React.ReactNode;\n\n constructor(props: OverlayErrorBoundaryProps) {\n super(props);\n this.fallback = props.fallback ?? <p>ERROR: ${String(this.state.error)}</p>;\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override state = {\n error: null,\n };\n\n override componentDidCatch(error: any, info: any) {\n console.warn(error, info);\n }\n\n override render() {\n if (this.state.error) {\n return this.fallback;\n }\n\n return this.props.children;\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SortableContext, horizontalListSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { useContainer, useMosaic } from './hooks';\nimport { type MosaicDataItem } from './types';\nimport { Path } from './util';\n\ntype Direction = 'horizontal' | 'vertical';\n\nexport type MosaicSortableProps<TData extends MosaicDataItem = MosaicDataItem> = PropsWithChildren<{\n id?: string;\n items?: TData[];\n direction?: Direction;\n}>;\n\n/**\n * Mosaic convenience wrapper for dnd-kit SortableContext.\n */\n// TODO(burdon): Remove since just obfuscates SortableContext unless more deeply integrated with useSortableItem.\n// Otherwise accept same props as SortableContext (e.g., verticalListSortingStrategy).\nexport const MosaicSortableContext = ({ id, items = [], direction = 'vertical', children }: MosaicSortableProps) => {\n const { operation, activeItem, overItem } = useMosaic();\n const container = useContainer();\n const contextId = id ?? container.id;\n const Sortable = direction === 'vertical' ? Column : Row;\n\n const ids = items.map((item) => {\n const path = Path.create(contextId, item.id);\n // TODO(wittjosiah): Copied from Tile.tsx. Consider factoring out to ensure logic is consistent.\n const isPreview =\n activeItem &&\n activeItem.item.id === item.id &&\n overItem &&\n (Path.siblings(overItem.path, path) || Path.hasChild(overItem.path, path)) &&\n operation !== 'reject';\n return isPreview ? activeItem.path : path;\n });\n\n return (\n <Sortable id={contextId} items={ids}>\n {children}\n </Sortable>\n );\n};\n\nconst Column = ({ children, id, items }: PropsWithChildren<{ id: string; items: string[] }>) => (\n <SortableContext id={id} items={items} strategy={verticalListSortingStrategy}>\n {children}\n </SortableContext>\n);\n\nconst Row = ({ children, id, items }: PropsWithChildren<{ id: string; items: string[] }>) => (\n <SortableContext id={id} items={items} strategy={horizontalListSortingStrategy}>\n {children}\n </SortableContext>\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type DraggableAttributes, useDraggable, useDroppable } from '@dnd-kit/core';\nimport { defaultAnimateLayoutChanges, useSortable } from '@dnd-kit/sortable';\nimport React from 'react';\nimport type { CSSProperties, ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from 'react';\n\nimport type { MosaicOperation, MosaicTileOverlayProps } from './Container';\nimport { DefaultComponent } from './DefaultComponent';\nimport { useContainer, useMosaic } from './hooks';\nimport type { MosaicDataItem, MosaicDraggedItem } from './types';\nimport { getTransformCSS, Path } from './util';\n\nexport type MosaicActiveType = 'overlay' | 'rearrange' | 'origin' | 'destination';\n\nexport type MosaicTileAction = { id: string; action: string; data?: any };\n\n/**\n * Props passed to mosaic tile.\n */\nexport type MosaicTileProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = Pick<\n HTMLAttributes<HTMLDivElement>,\n 'className'\n> &\n MosaicTileOverlayProps & {\n path: string;\n item: TData;\n Component?: MosaicTileComponent<TData, any>;\n position?: TPosition;\n operation?: MosaicOperation;\n active?: MosaicActiveType; // TODO(burdon): Rename state?\n\n // DndKit props.\n isDragging?: boolean;\n isOver?: boolean;\n draggableStyle?: CSSProperties;\n draggableProps?: DraggableAttributes &\n // TODO(wittjosiah): SyntheticListenerMap.\n HTMLAttributes<HTMLElement>;\n\n // TODO(burdon): Generalize events via onAction?\n onSelect?: () => void;\n onRemove?: () => void;\n onAction?: (action: MosaicTileAction) => void;\n };\n\n/**\n * Mosaic Tile component.\n */\nexport type MosaicTileComponent<\n TData extends MosaicDataItem = MosaicDataItem,\n TElement extends HTMLElement = HTMLDivElement,\n> = ForwardRefExoticComponent<\n RefAttributes<TElement> & Omit<MosaicTileProps<TData>, 'Component' | 'operation'> & { operation: MosaicOperation }\n>;\n\n/**\n * Basic draggable mosaic tile.\n */\nexport const DraggableTile = ({\n path: parentPath,\n item,\n Component = DefaultComponent,\n position,\n draggableStyle,\n ...props\n}: MosaicTileProps<any>) => {\n const { operation } = useMosaic();\n const path = Path.create(parentPath, item.id);\n const { setNodeRef, attributes, listeners, /* transform, */ isDragging } = useDraggable({\n id: path,\n data: { path, item, position } satisfies MosaicDraggedItem,\n });\n\n return (\n <Component\n ref={setNodeRef}\n item={item}\n path={path}\n position={position}\n operation={operation}\n isDragging={isDragging}\n draggableStyle={{\n // TODO(burdon): Override by container?\n // transform: getTransformCSS(transform),\n ...draggableStyle,\n }}\n draggableProps={{ ...attributes, ...listeners }}\n {...props}\n />\n );\n};\n\n/**\n * Basic droppable mosaic tile.\n */\nexport const DroppableTile = ({\n path: parentPath,\n item,\n Component = DefaultComponent,\n position,\n ...props\n}: MosaicTileProps<any>) => {\n const { operation } = useMosaic();\n const path =\n parentPath === item.id\n ? parentPath // If the path is the same as the item id, then this is the root tile.\n : Path.create(parentPath, item.id);\n const { setNodeRef, isOver } = useDroppable({\n id: path,\n data: { path, item, position } satisfies MosaicDraggedItem,\n });\n\n return (\n <Component\n ref={setNodeRef}\n item={item}\n path={path}\n position={position}\n operation={operation}\n isOver={isOver}\n {...props}\n />\n );\n};\n\n/**\n * Mosaic tile that can be sorted.\n */\nexport const SortableTile = ({\n path: parentPath,\n item,\n Component: OverrideComponent,\n position,\n draggableStyle,\n ...props\n}: MosaicTileProps<any, number>) => {\n const { operation, activeItem, overItem } = useMosaic();\n const { transitionDuration, Component: ContainerComponent } = useContainer();\n\n const path = Path.create(parentPath, item.id);\n // Re-use the active path if it's the same item and the item is a preview.\n // This helps dndkit understand that the item is being moved and animate it appropriately.\n const isPreview =\n activeItem &&\n activeItem.item.id === item.id &&\n overItem &&\n !Path.siblings(activeItem.path, overItem.path) &&\n (Path.siblings(overItem.path, path) || Path.hasChild(overItem.path, path)) &&\n operation !== 'reject';\n\n const { setNodeRef, attributes, listeners, transform, isDragging, isOver } = useSortable({\n id: isPreview ? activeItem.path : path,\n data: { path, item, position } satisfies MosaicDraggedItem,\n animateLayoutChanges: (args) =>\n defaultAnimateLayoutChanges({ ...args, wasDragging: item.id !== activeItem?.item.id }),\n });\n\n let active: MosaicActiveType | undefined;\n if (isDragging) {\n if (operation === 'rearrange' || operation === 'reject') {\n active = 'rearrange';\n } else if (activeItem && Path.parent(activeItem.path) !== parentPath) {\n active = 'destination';\n } else {\n active = 'origin';\n }\n }\n\n const Component = OverrideComponent ?? ContainerComponent ?? DefaultComponent;\n\n return (\n <Component\n ref={setNodeRef}\n item={item}\n path={path}\n position={position}\n operation={operation}\n active={active}\n isDragging={isDragging}\n isOver={isOver}\n draggableStyle={{\n transform: getTransformCSS(transform),\n transition: transform ? `transform ${transitionDuration}ms ease` : 'none',\n ...draggableStyle,\n }}\n draggableProps={{ ...attributes, ...listeners }}\n {...props}\n />\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type FC } from 'react';\n\nimport {\n MosaicContainer,\n type MosaicContainerProps as NaturalMosaicContainerProps,\n type MosaicMoveEvent as NaturalMosaicMoveEvent,\n type MosaicDropEvent as NaturalMosaicDropEvent,\n type MosaicOperation as NaturalMosaicOperation,\n type MosaicCompareDataItem as NaturalMosaicCompareDataItem,\n} from './Container';\nimport { Debug, type DebugProps } from './Debug';\nimport { DefaultComponent } from './DefaultComponent';\nimport { MosaicDragOverlay, type MosaicDragOverlayProps } from './DragOverlay';\nimport { MosaicRoot, type MosaicRootProps as NaturalMosaicRootProps } from './Root';\nimport { MosaicSortableContext, type MosaicSortableProps as NaturalMosaicSortableProps } from './SortableContext';\nimport {\n DraggableTile,\n DroppableTile,\n SortableTile,\n type MosaicTileAction as NaturalMosaicTileAction,\n type MosaicTileProps as NaturalMosaicTileProps,\n type MosaicTileComponent as NaturalMosaicTileComponent,\n type MosaicActiveType as NaturalMosaicActiveType,\n} from './Tile';\nimport { type MosaicDataItem } from './types';\n\nexport const Mosaic = {\n Root: MosaicRoot,\n Container: MosaicContainer,\n DragOverlay: MosaicDragOverlay,\n SortableContext: MosaicSortableContext,\n DraggableTile,\n DroppableTile,\n SortableTile,\n\n // TODO(wittjosiah): Consider factoring out or using inline styles instead depending on DXOS UI theme/tailwind.\n DefaultComponent,\n // TODO(burdon): Don't export; move to util.\n Debug,\n} as {\n Root: FC<MosaicRootProps>;\n Container: FC<MosaicContainerProps<any, any>>;\n DragOverlay: FC<MosaicOverlayProps>;\n SortableContext: FC<MosaicSortableProps>;\n DraggableTile: FC<MosaicTileProps<any, any>>;\n DroppableTile: FC<MosaicTileProps<any, any>>;\n SortableTile: FC<MosaicTileProps<any, number>>;\n\n DefaultComponent: MosaicTileComponent;\n Debug: FC<MosaicDebugProps>;\n};\n\nexport type MosaicRootProps = NaturalMosaicRootProps;\n\nexport type MosaicContainerProps<\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n> = NaturalMosaicContainerProps<TData, TPosition>;\n\nexport type MosaicOverlayProps = MosaicDragOverlayProps;\n\nexport type MosaicSortableProps = NaturalMosaicSortableProps;\n\nexport type MosaicTileAction = NaturalMosaicTileAction;\n\nexport type MosaicTileProps<\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n> = NaturalMosaicTileProps<TData, TPosition>;\n\nexport type MosaicTileComponent<\n TData extends MosaicDataItem = MosaicDataItem,\n TElement extends HTMLElement = HTMLDivElement,\n> = NaturalMosaicTileComponent<TData, TElement>;\n\nexport type MosaicMoveEvent<TPosition = unknown> = NaturalMosaicMoveEvent<TPosition>;\nexport type MosaicDropEvent<TPosition = unknown> = NaturalMosaicDropEvent<TPosition>;\nexport type MosaicOperation = NaturalMosaicOperation;\nexport type MosaicActiveType = NaturalMosaicActiveType;\n\nexport type MosaicCompareDataItem = NaturalMosaicCompareDataItem;\n\n// TODO(burdon): Remove.\nexport type MosaicDebugProps = DebugProps;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport type Size = { x: number; y: number };\nexport type Position = { x: number; y: number };\nexport type Dimension = { width: number; height: number };\nexport type Bounds = { left: number; top: number; width: number; height: number };\n\nexport const createMatrix = <TValue>(size: Size, value: (position: Position) => TValue): TValue[][] => {\n const matrix: TValue[][] = [];\n for (let x = 0; x < size.x; x++) {\n matrix.push(Array.from({ length: size.y }, (_, y) => value({ x, y })));\n }\n\n return matrix;\n};\n\nexport const getDimension = ({ width, height }: Dimension, spacing = 0): Dimension => ({\n width: width - spacing * 2,\n height: height - spacing * 2,\n});\n\nexport const getBounds = ({ x, y }: Position, { width, height }: Dimension, spacing = 0): Bounds => ({\n left: x * width + spacing * 2,\n top: y * height + spacing * 2,\n width: width - spacing * 2,\n height: height - spacing * 2,\n});\n\nexport const getPanelBounds = ({ x, y }: Position, { width, height }: Dimension, spacing = 0): Dimension => ({\n width: x * width + spacing * 2,\n height: y * height + spacing * 2,\n});\n\nexport const calculateCellWidth = (\n defaultWidth: number,\n screenWidth: number,\n options: { min: number; max: number } = { min: 260, max: 400 },\n) => {\n return screenWidth > options.min && screenWidth < options.max ? screenWidth : defaultWidth;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useDroppable } from '@dnd-kit/core';\nimport { PlusCircle } from '@phosphor-icons/react';\nimport defaultsDeep from 'lodash.defaultsdeep';\nimport React, { type FC, useState, useMemo, useEffect } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { Button, useMediaQuery } from '@dxos/react-ui';\nimport { getSize, mx } from '@dxos/react-ui-theme';\n\nimport {\n calculateCellWidth,\n createMatrix,\n getBounds,\n getDimension,\n getPanelBounds,\n type Dimension,\n type Position,\n type Size,\n} from './layout';\nimport {\n type MosaicContainerProps,\n type MosaicDataItem,\n type MosaicTileAction,\n Mosaic,\n Path,\n useMosaic,\n} from '../../mosaic';\n\n//\n// Selection\n//\n\n// TODO(burdon): Factor out as mosaic standard.\ntype ControlledSelection = {\n selected?: string;\n onSelect?: (id: string) => void;\n};\n\n//\n// Context.\n//\n\ntype GridOptions = {\n size: Size;\n cellBounds: Dimension;\n spacing?: number;\n};\n\nconst defaultGridOptions: GridOptions = {\n size: { x: 8, y: 8 },\n cellBounds: { width: 272, height: 272 },\n spacing: 6,\n};\n\n//\n// Container.\n//\n\nexport type GridLayout = { [id: string]: Position };\n\nexport type GridProps<TData extends MosaicDataItem = MosaicDataItem> = MosaicContainerProps<TData, Position> &\n ControlledSelection & {\n items?: TData[];\n layout?: GridLayout;\n options?: Partial<GridOptions>;\n margin?: boolean;\n square?: boolean;\n debug?: boolean;\n onCreate?: (position: Position) => void;\n onAction?: (action: MosaicTileAction) => void; // TODO(burdon): Standardize across mosaics?\n };\n\n/**\n * Grid content.\n */\n// TODO(burdon): Make generic (and forwardRef).\nexport const Grid = ({\n id,\n items = [],\n layout = {},\n options: opts,\n margin,\n square = true,\n debug,\n selected: controlledSelected,\n Component = Mosaic.DefaultComponent,\n className,\n onDrop,\n onSelect,\n onCreate,\n onAction,\n}: GridProps) => {\n const { ref: containerRef, width, height } = useResizeDetector({ refreshRate: 200 });\n const options = defaultsDeep({}, opts, defaultGridOptions);\n const { matrix, bounds, cellBounds } = useMemo(() => {\n // Change default cell bounds to screen width if mobile.\n const cellWidth = calculateCellWidth(options.cellBounds.width, width ?? 0);\n const cellBounds = {\n width: cellWidth,\n height: square ? cellWidth : options.cellBounds.height,\n };\n\n return {\n matrix: createMatrix(options.size, ({ x, y }) => ({ x, y })),\n bounds: getPanelBounds(options.size, cellBounds, options.spacing),\n cellBounds,\n };\n }, [options, width]);\n\n // No margin if mobile.\n const [isNotMobile] = useMediaQuery('md');\n const marginSize = margin && !isNotMobile ? Math.max(cellBounds.width, cellBounds.height) : 0;\n\n const [selected, setSelected] = useState(controlledSelected);\n useEffect(() => {\n setSelected(controlledSelected);\n if (controlledSelected) {\n scrollToCenter(controlledSelected);\n }\n }, [controlledSelected]);\n\n const scrollToCenter = (id: string) => {\n const item = items.find((item) => item.id === id);\n if (item && width && height) {\n const pos = getBounds(layout[item.id], cellBounds);\n const top = pos.top + marginSize - (height - cellBounds.height) / 2;\n const left = pos.left + marginSize - (width - cellBounds.width) / 2;\n containerRef.current!.scrollTo({ top, left, behavior: 'smooth' });\n }\n };\n\n // TODO(burdon): Focus ring/navigation.\n // TODO(burdon): Set center point on container (via translation?) Scale container to zoom.\n const handleSelect = (id: string) => {\n setSelected(id);\n scrollToCenter(id);\n onSelect?.(id);\n };\n\n useEffect(() => {\n if (selected) {\n scrollToCenter(selected);\n }\n }, [selected, width, height]);\n\n return (\n <Mosaic.Container\n {...{\n id,\n Component,\n getOverlayProps: () => ({ grow: true }),\n getOverlayStyle: () => getDimension(cellBounds, options.spacing),\n onDrop,\n }}\n >\n <div className={mx('flex grow overflow-auto', className)}>\n <div ref={containerRef} className={mx('grow overflow-auto snap-x snap-mandatory md:snap-none')}>\n <div className='group block relative' style={{ ...bounds, margin: marginSize }}>\n {matrix && (\n <div style={{ padding: options.spacing }}>\n <div className='relative'>\n {matrix.map((row) =>\n row.map(({ x, y }) => (\n <GridCell\n key={`${x}-${y}`}\n path={id}\n position={{ x, y }}\n bounds={getBounds({ x, y }, cellBounds)}\n padding={options.spacing}\n onCreate={onCreate}\n />\n )),\n )}\n </div>\n </div>\n )}\n\n <div>\n {items.map((item) => {\n const position = layout[item.id] ?? { x: 0, y: 0 };\n return (\n <Mosaic.DraggableTile\n key={item.id}\n item={item}\n path={id}\n position={position}\n Component={Component}\n draggableStyle={{\n position: 'absolute',\n ...getBounds(position, cellBounds, options.spacing),\n }}\n onSelect={() => handleSelect(item.id)}\n onAction={onAction}\n // debug={debug}\n />\n );\n })}\n </div>\n </div>\n\n {debug && <Mosaic.Debug data={{ items: items?.length }} position='bottom-right' />}\n </div>\n </div>\n </Mosaic.Container>\n );\n};\n\n/**\n * Grid cell.\n */\nconst GridCell: FC<{\n path: string;\n position: Position;\n bounds: Dimension;\n padding?: number;\n onCreate?: (position: Position) => void;\n}> = ({ path, position, bounds, padding, onCreate }) => {\n const { overItem } = useMosaic();\n const isOverContainer = path === overItem?.path;\n const { setNodeRef, isOver } = useDroppable({\n id: Path.create(path, 'cell', `${position.x}-${position.y}`),\n data: { path, position },\n });\n\n return (\n <div\n ref={setNodeRef}\n style={{ ...bounds, padding }}\n className='absolute flex justify-center items-center grow select-none cursor-pointer'\n >\n <div\n className={mx(\n 'group/cell flex group-hover:flex w-full h-full items-center justify-center',\n 'box-border border-dashed border-4 border-neutral-100 rounded-lg',\n 'transition ease-in-out duration-300',\n isOver && 'flex bg-neutral-200 border-neutral-400',\n )}\n >\n <div\n className={mx(\n 'opacity-10 transition ease-in-out duration-300 group-hover/cell:opacity-100',\n isOverContainer && 'hidden',\n )}\n >\n {onCreate && (\n // TODO(burdon): Style button.\n <Button variant='ghost' onClick={() => onCreate(position)}>\n <PlusCircle className={getSize(8)} />\n </Button>\n )}\n </div>\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef, useMemo } from 'react';\n\nimport { Card } from '@dxos/react-ui';\nimport { groupSurface, mx } from '@dxos/react-ui-theme';\n\nimport {\n Mosaic,\n type MosaicContainerProps,\n type MosaicDataItem,\n type MosaicTileComponent,\n Path,\n useItemsWithPreview,\n useContainer,\n} from '../../mosaic';\n\n// Example:\n// https://master--5fc05e08a4a65d0021ae0bf2.chromatic.com/?path=/story/presets-sortable-multiple-containers--basic-setup\n\nexport type KanbanColumn<TData extends MosaicDataItem = MosaicDataItem> = MosaicDataItem & {\n title: string;\n items: TData[];\n};\n\nexport type KanbanProps<TData extends MosaicDataItem = MosaicDataItem> = MosaicContainerProps<TData, number> & {\n columns: KanbanColumn<TData>[];\n debug?: boolean;\n};\n\nexport const Kanban = ({\n id,\n columns,\n Component: TileComponent = Mosaic.DefaultComponent,\n debug,\n onDrop,\n}: KanbanProps) => {\n const Component = useMemo(() => OverlayComponent(id, TileComponent), [id, TileComponent]);\n\n return (\n <Mosaic.Container\n {...{\n id,\n debug,\n Component,\n // Restrict columns to x-axis.\n modifier: ({ path, item }, { transform }) =>\n path === Path.create(id, item.id) ? { ...transform, y: 0 } : transform,\n // Restrict to objects from other columns.\n // TODO(burdon): Consider objects from other containers.\n // TODO(wittjosiah): Allow override.\n onOver: ({ active, over }) => (Path.length(active.path) >= Path.length(over.path) ? 'transfer' : 'reject'),\n onDrop,\n }}\n >\n <div className='grow flex overflow-y-hidden overflow-x-auto'>\n <div className='flex'>\n <Mosaic.SortableContext items={columns} direction='horizontal'>\n {columns.map((column, index) => (\n <Mosaic.SortableTile\n key={column.id}\n item={column}\n path={id}\n position={index}\n Component={Component}\n debug={debug}\n />\n ))}\n </Mosaic.SortableContext>\n </div>\n </div>\n </Mosaic.Container>\n );\n};\n\nconst OverlayComponent = (id: string, Component: MosaicTileComponent<any>): MosaicTileComponent<any> =>\n forwardRef((props, ref) => {\n const isColumn = Path.hasRoot(props.path, id) && Path.length(props.path) === 2;\n if (isColumn && props.active === 'overlay') {\n return (\n // Needs to not override the main kanban path.\n <Mosaic.Container {...{ id: `${id}-active`, Component }}>\n <KanbanColumnComponent {...props} ref={ref} />\n </Mosaic.Container>\n );\n }\n\n return isColumn ? <KanbanColumnComponent {...props} ref={ref} /> : <Component {...props} ref={ref} />;\n });\n\nconst KanbanColumnComponent: MosaicTileComponent<KanbanColumn> = forwardRef(\n ({ path, item, active, draggableStyle, draggableProps, debug }, forwardRef) => {\n const { id, title, items } = item;\n const { Component } = useContainer();\n const itemsWithPreview = useItemsWithPreview({ path, items });\n\n return (\n <div role='none' className='grow flex flex-col' ref={forwardRef}>\n <div\n className={mx(\n groupSurface,\n 'grow flex flex-col w-[300px] snap-center overflow-hidden m-1',\n active === 'rearrange' && 'opacity-0',\n )}\n style={draggableStyle}\n >\n <Card.Root classNames='shrink-0 bg-cyan-200'>\n <Card.Header>\n <Card.DragHandle {...draggableProps} />\n <Card.Title title={title} />\n <Card.Menu />\n </Card.Header>\n </Card.Root>\n\n <div className={mx('flex flex-col grow overflow-y-scroll')}>\n <div className='flex flex-col my-1'>\n <Mosaic.SortableContext id={path} items={itemsWithPreview} direction='vertical'>\n {itemsWithPreview.map((item, index) => (\n <Mosaic.SortableTile\n key={item.id}\n item={item}\n path={path}\n position={index}\n Component={Component!}\n className='m-1'\n // debug={debug}\n />\n ))}\n </Mosaic.SortableContext>\n </div>\n </div>\n {debug && <Mosaic.Debug data={{ path, id, items: itemsWithPreview.length }} />}\n </div>\n </div>\n );\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { Mosaic, type MosaicContainerProps, type MosaicDataItem, useItemsWithPreview } from '../../mosaic';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type StackProps<TData extends MosaicDataItem = MosaicDataItem> = MosaicContainerProps<TData, number> & {\n items?: TData[];\n direction?: Direction;\n debug?: boolean;\n};\n\n// TODO(burdon): Make generic (and forwardRef).\nexport const Stack = ({\n id,\n Component = Mosaic.DefaultComponent,\n onOver,\n onDrop,\n items = [],\n direction = 'vertical',\n debug,\n}: StackProps) => {\n const itemsWithPreview = useItemsWithPreview({ path: id, items });\n\n return (\n <div className={mx('flex overflow-hidden', direction === 'vertical' && 'w-[300px]')}>\n <div\n className={mx('flex flex-col w-full my-1', direction === 'vertical' ? 'overflow-y-auto' : 'overflow-x-auto')}\n >\n <Mosaic.Container {...{ id, Component, onOver, onDrop }}>\n <Mosaic.SortableContext items={itemsWithPreview} direction={direction}>\n {itemsWithPreview.map((item, index) => (\n <Mosaic.SortableTile\n key={item.id}\n item={item}\n path={id}\n position={index}\n className='m-1'\n // debug={debug}\n />\n ))}\n </Mosaic.SortableContext>\n </Mosaic.Container>\n {debug && (\n <div className='grow'>\n <Mosaic.Debug data={{ id, items: itemsWithPreview.length }} />\n </div>\n )}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef, useMemo } from 'react';\n\nimport { Card, Tree as TreeComponent, TreeItem as TreeItemComponent } from '@dxos/react-ui';\nimport { dropRing, mx } from '@dxos/react-ui-theme';\n\nimport {\n type MosaicContainerProps,\n Mosaic,\n type MosaicDataItem,\n type MosaicTileComponent,\n useContainer,\n useMosaic,\n Path,\n useItemsWithPreview,\n type MosaicCompareDataItem,\n} from '../../mosaic';\n\n// TODO(burdon): Tree data model that provides a pure abstraction of the plugin Graph.\n// - The Tree (like Stack, Grid) is a high level container that assembles Radix style DXOS UI components from a model.\n// - Models in general should be easily mapped from the Graph and/or ECHO queries.\n// - See: https://master--5fc05e08a4a65d0021ae0bf2.chromatic.com/?path=/story/examples-tree-sortable--basic-setup\n\nexport type TreeProps<TData extends MosaicDataItem = TreeData> = MosaicContainerProps<TData, number> & {\n items?: TData[];\n debug?: boolean;\n compare?: MosaicCompareDataItem;\n};\n\nexport type TreeData = {\n id: string;\n label?: string; // TODO(burdon): Provide adapter.\n children: TreeData[];\n};\n\n// TODO(burdon): Make generic (and forwardRef).\nexport const Tree = ({ id, Component = TreeItem, onOver, onDrop, items = [], debug, compare }: TreeProps) => {\n return (\n <Mosaic.Container\n {...{\n id,\n debug,\n Component,\n onOver,\n onDrop,\n compare,\n }}\n >\n <TreeRoot items={items} />\n </Mosaic.Container>\n );\n};\n\nconst TreeRoot = ({ items }: { items: TreeData[] }) => {\n const { id, Component, compare } = useContainer();\n const sortedItems = useMemo(() => {\n return compare ? [...items].sort(compare) : items;\n }, [items, compare]);\n const itemsWithPreview = useItemsWithPreview({ items: sortedItems, path: id, strategy: 'layout-stable' });\n\n return (\n <TreeComponent.Root classNames='flex flex-col'>\n <Mosaic.SortableContext id={id} items={itemsWithPreview} direction='vertical'>\n {itemsWithPreview.map((item, index) => (\n <TreeItemComponent.Root key={item.id} collapsible defaultOpen>\n <Mosaic.SortableTile item={item} path={id} position={index} Component={Component!} />\n </TreeItemComponent.Root>\n ))}\n </Mosaic.SortableContext>\n </TreeComponent.Root>\n );\n};\n\n/**\n * Pure component that is used by the mosaic overlay.\n */\nconst TreeItem: MosaicTileComponent<TreeData> = forwardRef(\n ({ path, draggableStyle, draggableProps, item, operation, active, isOver, isDragging, className }, forwardedRef) => {\n return (\n <div\n ref={forwardedRef}\n style={draggableStyle}\n className={mx(\n 'flex flex-col rounded',\n className,\n (active === 'rearrange' || active === 'origin') && 'opacity-0',\n active === 'destination' && 'opacity-20',\n isOver && dropRing,\n )}\n >\n <Card.Header>\n <Card.DragHandle {...draggableProps} />\n <Card.Title title={item.label ?? path} classNames='truncate' />\n </Card.Header>\n\n {!active && item.children && <TreeBranch path={path} items={item.children} />}\n </div>\n );\n },\n);\n\nconst TreeBranch = ({ path, items }: { path: string; items: TreeData[] }) => {\n const { operation, overItem } = useMosaic();\n const { Component, compare } = useContainer();\n const sortedItems = useMemo(() => {\n return compare ? [...items].sort(compare) : items;\n }, [items, compare]);\n const itemsWithPreview = useItemsWithPreview({ items: sortedItems, path, strategy: 'layout-stable' });\n\n return (\n <TreeItemComponent.Body className='pis-4'>\n <Mosaic.SortableContext id={path} items={itemsWithPreview} direction='vertical'>\n {itemsWithPreview.map((child, index) => (\n <TreeComponent.Branch key={child.id}>\n <TreeItemComponent.Root collapsible defaultOpen>\n <Mosaic.SortableTile\n item={child}\n path={path}\n position={index}\n Component={Component!}\n isOver={\n overItem?.path === Path.create(path, child.id) && (operation === 'transfer' || operation === 'copy')\n }\n />\n </TreeItemComponent.Root>\n </TreeComponent.Branch>\n ))}\n </Mosaic.SortableContext>\n </TreeItemComponent.Body>\n );\n};\n"],
5
- "mappings": ";AAIA,SAASA,kBAAkB;AAE3B,SAASC,aAAa;;;ACDtB,OAAOC,SACLC,eACAC,iBAIK;AAMA,IAAMC,qBAAqB;AAsF3B,IAAMC,yBAAyBC,8BAAsDC,MAAAA;AAKrF,IAAMC,kBAAkB,CAAC,EAC9BC,UACAC,IACAC,OACAC,WAAAA,YACAC,qBAAqBT,oBACrBU,UACAC,iBACAC,iBACAC,QACAC,QACAC,QAAO,MACc;AACrB,QAAMC,SAASC,UAAAA;AACf,QAAMC,YAAY;IAChBZ;IACAC;IACAC,WAAAA;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;EACF;AAEAI,YAAU,MAAA;AACRH,WAAOI,aAAaF,UAAUZ,IAAIY,SAAAA;AAClC,WAAO,MAAA;IAGP;EACF,GAAGG,OAAOC,OAAOJ,SAAAA,CAAAA;AAEjB,SAAO,sBAAA,cAACjB,uBAAuBsB,UAAQ;IAACC,OAAON;KAAYb,QAAAA;AAC7D;;;ADrIO,IAAMoB,eAAe,MAI1BC,WAAWC,sBAAAA,KAA2BC,MAAM,IAAIC,MAAM,gCAAA,CAAA;;;AEXxD,SAASC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cAAcA,cAAc;;AAS/G;",
6
- "names": ["useContext", "raise", "React", "createContext", "useEffect", "DEFAULT_TRANSITION", "MosaicContainerContext", "createContext", "undefined", "MosaicContainer", "children", "id", "debug", "Component", "transitionDuration", "modifier", "getOverlayProps", "getOverlayStyle", "onOver", "onDrop", "compare", "mosaic", "useMosaic", "container", "useEffect", "setContainer", "Object", "values", "Provider", "value", "useContainer", "useContext", "MosaicContainerContext", "raise", "Error", "useEffect", "useState", "useContext", "raise", "DndContext", "KeyboardSensor", "MouseSensor", "pointerWithin", "rectIntersection", "TouchSensor", "useSensor", "useSensors", "sortableKeyboardCoordinates", "pick", "React", "createContext", "useState", "createPortal", "React", "mx", "Debug", "data", "position", "React", "pre", "className", "mx", "JSON", "stringify", "undefined", "React", "forwardRef", "Card", "arrayMove", "swapItems", "items", "from", "to", "fromIndex", "findIndex", "item", "id", "toIndex", "arrayMove", "SEPARATOR", "Path", "create", "args", "join", "parts", "path", "split", "length", "first", "last", "at", "parent", "slice", "hasRoot", "id", "hasChild", "compare", "hasDescendent", "startsWith", "siblings", "onPath", "includes", "CSS", "getTransformCSS", "transform", "CSS", "Transform", "toString", "Object", "assign", "scaleX", "scaleY", "undefined", "DefaultComponent", "forwardRef", "draggableStyle", "draggableProps", "item", "id", "path", "React", "Card", "Root", "ref", "style", "Header", "DragHandle", "Title", "title", "Path", "create", "classNames", "displayName", "DEFAULT_COMPONENT_ID", "MosaicContext", "createContext", "undefined", "MosaicRoot", "Component", "DefaultComponent", "debug", "children", "containers", "setContainers", "useState", "id", "handleSetContainer", "container", "_", "rest", "activeItem", "setActiveItem", "overItem", "setOverItem", "operation", "setOperation", "collisionDetection", "args", "pointerCollisions", "pointerWithin", "length", "rectIntersection", "modifiers", "props", "transform", "Path", "first", "path", "modifier", "sensors", "useSensors", "useSensor", "MouseSensor", "activationConstraint", "distance", "TouchSensor", "delay", "tolerance", "KeyboardSensor", "coordinateGetter", "sortableKeyboardCoordinates", "handleDragStart", "event", "pick", "active", "data", "current", "handleDragMove", "handleDragOver", "over", "item", "activeContainer", "overContainer", "onOver", "parent", "handleDragCancel", "handleDragEnd", "position", "onDrop", "setTimeout", "transitionDuration", "DEFAULT_TRANSITION", "React", "Provider", "value", "setContainer", "DndContext", "cancelDrop", "onDragStart", "onDragMove", "onDragOver", "onDragCancel", "onDragEnd", "createPortal", "MosaicDebug", "document", "body", "Debug", "Object", "keys", "map", "slice", "create", "parts", "part", "useMosaic", "useContext", "MosaicContext", "raise", "Error", "useItemsWithPreview", "path", "items", "strategy", "operation", "activeItem", "overItem", "useMosaic", "itemsWithPreview", "setItemsWithPreview", "useState", "overParent", "Path", "parent", "lastOverParent", "setLastOverParent", "useEffect", "undefined", "activeIsChild", "hasChild", "overIsChild", "overSelf", "sortedItems", "map", "item", "id", "position", "slice", "filter", "length", "DragOverlay", "React", "Component", "useEffect", "useRef", "useState", "DensityProvider", "MosaicDragOverlay", "delay", "debug", "overlayProps", "containers", "operation", "activeItem", "overItem", "useMosaic", "state", "setState", "useState", "timer", "useRef", "useEffect", "container", "OverlayComponent", "path", "Path", "first", "Component", "DefaultComponent", "clearTimeout", "current", "setTimeout", "FallbackComponent", "React", "DragOverlay", "adjustScale", "style", "getOverlayStyle", "DensityProvider", "density", "OverlayErrorBoundary", "fallback", "getOverlayProps", "item", "active", "div", "className", "span", "id", "slice", "constructor", "props", "error", "p", "String", "getDerivedStateFromError", "componentDidCatch", "info", "console", "warn", "render", "children", "SortableContext", "horizontalListSortingStrategy", "verticalListSortingStrategy", "React", "MosaicSortableContext", "id", "items", "direction", "children", "operation", "activeItem", "overItem", "useMosaic", "container", "useContainer", "contextId", "Sortable", "Column", "Row", "ids", "map", "item", "path", "Path", "create", "isPreview", "siblings", "hasChild", "React", "SortableContext", "strategy", "verticalListSortingStrategy", "horizontalListSortingStrategy", "useDraggable", "useDroppable", "defaultAnimateLayoutChanges", "useSortable", "React", "DraggableTile", "path", "parentPath", "item", "Component", "DefaultComponent", "position", "draggableStyle", "props", "operation", "useMosaic", "Path", "create", "id", "setNodeRef", "attributes", "listeners", "isDragging", "useDraggable", "data", "React", "ref", "draggableProps", "DroppableTile", "isOver", "useDroppable", "SortableTile", "OverrideComponent", "activeItem", "overItem", "transitionDuration", "ContainerComponent", "useContainer", "isPreview", "siblings", "hasChild", "transform", "useSortable", "animateLayoutChanges", "args", "defaultAnimateLayoutChanges", "wasDragging", "active", "parent", "getTransformCSS", "transition", "Mosaic", "Root", "MosaicRoot", "Container", "MosaicContainer", "DragOverlay", "MosaicDragOverlay", "SortableContext", "MosaicSortableContext", "DraggableTile", "DroppableTile", "SortableTile", "DefaultComponent", "Debug", "createMatrix", "size", "value", "matrix", "x", "push", "Array", "from", "length", "y", "_", "getDimension", "width", "height", "spacing", "getBounds", "left", "top", "getPanelBounds", "calculateCellWidth", "defaultWidth", "screenWidth", "options", "min", "max", "useDroppable", "PlusCircle", "defaultsDeep", "React", "useState", "useMemo", "useEffect", "useResizeDetector", "Button", "useMediaQuery", "getSize", "mx", "defaultGridOptions", "size", "x", "y", "cellBounds", "width", "height", "spacing", "Grid", "id", "items", "layout", "options", "opts", "margin", "square", "debug", "selected", "controlledSelected", "Component", "Mosaic", "DefaultComponent", "className", "onDrop", "onSelect", "onCreate", "onAction", "ref", "containerRef", "useResizeDetector", "refreshRate", "defaultsDeep", "matrix", "bounds", "useMemo", "cellWidth", "calculateCellWidth", "createMatrix", "getPanelBounds", "isNotMobile", "useMediaQuery", "marginSize", "Math", "max", "setSelected", "useState", "useEffect", "scrollToCenter", "item", "find", "pos", "getBounds", "top", "left", "current", "scrollTo", "behavior", "handleSelect", "React", "Container", "getOverlayProps", "grow", "getOverlayStyle", "getDimension", "div", "mx", "style", "padding", "map", "row", "GridCell", "key", "path", "position", "DraggableTile", "draggableStyle", "Debug", "data", "length", "overItem", "useMosaic", "isOverContainer", "setNodeRef", "isOver", "useDroppable", "Path", "create", "Button", "variant", "onClick", "PlusCircle", "getSize", "React", "forwardRef", "useMemo", "Card", "groupSurface", "mx", "Kanban", "id", "columns", "Component", "TileComponent", "Mosaic", "DefaultComponent", "debug", "onDrop", "useMemo", "OverlayComponent", "React", "Container", "modifier", "path", "item", "transform", "Path", "create", "y", "onOver", "active", "over", "length", "div", "className", "SortableContext", "items", "direction", "map", "column", "index", "SortableTile", "key", "position", "forwardRef", "props", "ref", "isColumn", "hasRoot", "KanbanColumnComponent", "draggableStyle", "draggableProps", "title", "useContainer", "itemsWithPreview", "useItemsWithPreview", "role", "mx", "groupSurface", "style", "Card", "Root", "classNames", "Header", "DragHandle", "Title", "Menu", "Debug", "data", "React", "mx", "Stack", "id", "Component", "Mosaic", "DefaultComponent", "onOver", "onDrop", "items", "direction", "debug", "itemsWithPreview", "useItemsWithPreview", "path", "React", "div", "className", "mx", "Container", "SortableContext", "map", "item", "index", "SortableTile", "key", "position", "Debug", "data", "length", "React", "forwardRef", "useMemo", "Card", "Tree", "TreeComponent", "TreeItem", "TreeItemComponent", "dropRing", "mx", "Tree", "id", "Component", "TreeItem", "onOver", "onDrop", "items", "debug", "compare", "React", "Mosaic", "Container", "TreeRoot", "useContainer", "sortedItems", "useMemo", "sort", "itemsWithPreview", "useItemsWithPreview", "path", "strategy", "TreeComponent", "Root", "classNames", "SortableContext", "direction", "map", "item", "index", "TreeItemComponent", "key", "collapsible", "defaultOpen", "SortableTile", "position", "forwardRef", "draggableStyle", "draggableProps", "operation", "active", "isOver", "isDragging", "className", "forwardedRef", "div", "ref", "style", "mx", "dropRing", "Card", "Header", "DragHandle", "Title", "title", "label", "children", "TreeBranch", "overItem", "useMosaic", "Body", "child", "Branch", "Path", "create"]
3
+ "sources": ["../../../src/mosaic/hooks/useContainer.ts", "../../../src/mosaic/Container.tsx", "../../../src/mosaic/hooks/useItemsWithPreview.ts", "../../../src/mosaic/hooks/useMosaic.ts", "../../../src/mosaic/Root.tsx", "../../../src/mosaic/Debug.tsx", "../../../src/mosaic/DefaultComponent.tsx", "../../../src/mosaic/util/data.ts", "../../../src/mosaic/util/path.ts", "../../../src/mosaic/util/styles.ts", "../../../src/mosaic/hooks/useSortedItems.ts", "../../../src/mosaic/DragOverlay.tsx", "../../../src/mosaic/SortableContext.tsx", "../../../src/mosaic/Tile.tsx", "../../../src/mosaic/Mosaic.ts", "../../../src/views/Grid/layout.ts", "../../../src/views/Grid/Grid.tsx", "../../../src/views/Kanban/Kanban.tsx", "../../../src/views/Stack/Stack.tsx", "../../../src/views/Tree/Tree.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { MosaicContainerContext, type MosaicContainerProps } from '../Container';\nimport { type MosaicDataItem } from '../types';\n\nexport const useContainer = <\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n>(): MosaicContainerProps<TData, TPosition> =>\n useContext(MosaicContainerContext) ?? raise(new Error('Missing MosaicContainerContext'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Modifier } from '@dnd-kit/core';\nimport React, {\n createContext,\n useEffect,\n type CSSProperties,\n type HTMLAttributes,\n type PropsWithChildren,\n} from 'react';\n\nimport { type MosaicTileComponent } from './Tile';\nimport { useMosaic } from './hooks';\nimport { type MosaicDataItem, type MosaicDraggedItem } from './types';\n\nexport const DEFAULT_TRANSITION = 200;\n\nexport type MosaicTileOverlayProps = {\n grow?: boolean;\n debug?: boolean;\n};\n\n/**\n * Possible operations when dropping a tile.\n *\n * * `transfer` - Remove the tile from it's current path and move to a new path.\n * * `copy` - Add a clone of the tile at a new path.\n * * `rearrange` - Change the order of the tile within it's current path.\n * * `reject` - The tile is not allowed where it was dropped.\n */\n// TODO(wittjosiah): Add 'delete'. Consider adding 'swap'.\nexport type MosaicOperation = 'transfer' | 'copy' | 'rearrange' | 'reject';\n\nexport type MosaicMoveEvent<TPosition = unknown> = {\n active: MosaicDraggedItem<TPosition>;\n over: MosaicDraggedItem<TPosition>;\n};\n\nexport type MosaicDropEvent<TPosition = unknown> = MosaicMoveEvent<TPosition> & {\n operation: MosaicOperation;\n};\n\nexport type MosaicCompareDataItem = Parameters<typeof Array.prototype.sort>[0];\n\nexport type MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = Pick<\n HTMLAttributes<HTMLDivElement>,\n 'className'\n> &\n PropsWithChildren<{\n id: string;\n\n // TODO(wittjosiah): Don't expose externally.\n debug?: boolean;\n\n /**\n * Default component used to render tiles.\n */\n Component?: MosaicTileComponent<TData, any>;\n\n /**\n * Length of transition when moving tiles in milliseconds.\n *\n * @default 200\n */\n transitionDuration?: number;\n\n /**\n * Adapter to transform properties while dragging (e.g., constraint axes).\n * https://github.com/clauderic/dnd-kit/blob/master/packages/core/src/modifiers/types.ts\n */\n modifier?: (activeItem: MosaicDraggedItem, ...modifierArgs: Parameters<Modifier>) => ReturnType<Modifier>;\n\n /**\n * Property overrides for the default overlay.\n */\n getOverlayProps?: () => MosaicTileOverlayProps;\n\n /**\n * Style property overrides for the default overlay.\n */\n getOverlayStyle?: () => CSSProperties;\n\n /**\n * Called when a tile is dragged over the container.\n * Returns true if the tile can be dropped.\n */\n onOver?: (event: MosaicMoveEvent<TPosition>) => MosaicOperation;\n\n /**\n * Called when a tile is dropped on the container.\n */\n onDrop?: (event: MosaicDropEvent<TPosition>) => void;\n\n /**\n * Used to sort items within the container.\n */\n compare?: MosaicCompareDataItem;\n }>;\n\nexport type MosaicContainerContextType = Omit<MosaicContainerProps<any>, 'children'>;\n\nexport const MosaicContainerContext = createContext<MosaicContainerContextType | undefined>(undefined);\n\n/**\n * Root Container that manages the layout of tiles.\n */\nexport const MosaicContainer = ({\n children,\n id,\n debug,\n Component,\n transitionDuration = DEFAULT_TRANSITION,\n modifier,\n getOverlayProps,\n getOverlayStyle,\n onOver,\n onDrop,\n compare,\n}: MosaicContainerProps) => {\n const mosaic = useMosaic();\n const container = {\n id,\n debug,\n Component,\n transitionDuration,\n modifier,\n getOverlayProps,\n getOverlayStyle,\n onOver,\n onDrop,\n compare,\n };\n\n useEffect(() => {\n mosaic.setContainer(container.id, container);\n return () => {\n // TODO(burdon): The overlay unregisters the container after the tile has re-rendered (removing it).\n // mosaic.setContainer(container.id);\n };\n }, Object.values(container));\n\n return <MosaicContainerContext.Provider value={container}>{children}</MosaicContainerContext.Provider>;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { useMosaic } from './useMosaic';\nimport { type MosaicDataItem } from '../types';\nimport { Path } from '../util';\n\n/**\n * Returns a spliced collection of items including a placeholder if items that could drop,\n * and removing any item that is currently being dragged out.\n */\nexport const useItemsWithPreview = <T extends MosaicDataItem>({ path, items }: { path: string; items: T[] }): T[] => {\n const { operation, activeItem, overItem } = useMosaic();\n const [itemsWithPreview, setItemsWithPreview] = useState(items);\n const overParent =\n // If over the sortable context itself & active item is foreign, then treat self as the parent.\n // This allows items to be appended to the end of the sortable.\n overItem?.path === path && activeItem && Path.parent(activeItem.path) !== overItem.path\n ? path\n : overItem && Path.parent(overItem.path);\n const [lastOverParent, setLastOverParent] = useState(overParent);\n\n useEffect(() => {\n if (operation === 'reject' || operation === 'rearrange' || !activeItem || !overItem) {\n setLastOverParent(undefined);\n setItemsWithPreview(items);\n return;\n }\n\n if (lastOverParent === overParent) {\n return;\n }\n\n setLastOverParent(overParent);\n\n const activeIsChild = Path.hasChild(path, activeItem.path);\n const overIsChild = Path.hasChild(path, overItem.path);\n const overSelf = overItem.path === path;\n\n if (!activeIsChild && overIsChild) {\n // Insert item into sortable.\n setItemsWithPreview((items) => {\n const position = overItem.position as number;\n return [...items.slice(0, position), activeItem.item as T, ...items.slice(position)];\n });\n } else if (!activeIsChild && overSelf) {\n // Append item to end of sortable.\n setItemsWithPreview((items) => [...items, activeItem.item as T]);\n } else if (activeIsChild && !overIsChild) {\n // Remove item being dragged out.\n setItemsWithPreview((items) => items.filter((item) => item.id !== activeItem.item.id));\n } else {\n // Reset items.\n setItemsWithPreview(items);\n }\n }, [operation, activeItem, overItem, overParent, lastOverParent, path, items]);\n\n // In order to avoid render glitching, rather than waiting for the effect to run,\n // immediately return the new items after dropping an item into a new path.\n return items.length === itemsWithPreview.length ? items : itemsWithPreview;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { MosaicContext } from '../Root';\n\nexport const useMosaic = () => useContext(MosaicContext) ?? raise(new Error('Missing MosaicContext'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport {\n type CollisionDetection,\n DndContext,\n type DragCancelEvent,\n type DragEndEvent,\n type DragMoveEvent,\n type DragOverEvent,\n type DragStartEvent,\n KeyboardSensor,\n type Modifier,\n MouseSensor,\n pointerWithin,\n rectIntersection,\n TouchSensor,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport { sortableKeyboardCoordinates } from '@dnd-kit/sortable';\nimport pick from 'lodash.pick';\nimport React, { createContext, type FC, type PropsWithChildren, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { DEFAULT_TRANSITION, type MosaicContainerProps, type MosaicMoveEvent, type MosaicOperation } from './Container';\nimport { Debug } from './Debug';\nimport { DefaultComponent } from './DefaultComponent';\nimport { type MosaicTileComponent } from './Tile';\nimport { type MosaicDraggedItem } from './types';\nimport { Path } from './util';\n\nconst DEFAULT_COMPONENT_ID = '__default';\n\nexport type MosaicContextType = {\n containers: Record<string, MosaicContainerProps<any> | undefined>;\n setContainer: (id: string, container?: MosaicContainerProps<any>) => void;\n activeItem: MosaicDraggedItem | undefined;\n overItem: MosaicDraggedItem | undefined;\n operation: MosaicOperation;\n};\n\nexport const MosaicContext = createContext<MosaicContextType | undefined>(undefined);\n\nexport type MosaicRootProps = PropsWithChildren<{\n /**\n * Default component.\n */\n Component?: MosaicTileComponent<any>;\n debug?: boolean;\n}>;\n\n/**\n * Root context provider.\n */\nexport const MosaicRoot: FC<MosaicRootProps> = ({ Component = DefaultComponent, debug, children }) => {\n const [containers, setContainers] = useState<MosaicContextType['containers']>({\n [DEFAULT_COMPONENT_ID]: { id: DEFAULT_COMPONENT_ID, Component },\n });\n\n const handleSetContainer = (id: string, container?: MosaicContainerProps<any>) => {\n setContainers((containers) => {\n if (container) {\n return { ...containers, [id]: container };\n } else {\n const { [id]: _, ...rest } = containers;\n return rest;\n }\n });\n };\n\n const [activeItem, setActiveItem] = useState<MosaicDraggedItem>();\n const [overItem, setOverItem] = useState<MosaicDraggedItem>();\n const [operation, setOperation] = useState<MosaicOperation>('reject');\n\n //\n // DndKit Defaults\n //\n\n /**\n * See: https://docs.dndkit.com/api-documentation/context-provider/collision-detection-algorithms#custom-collision-detection-algorithms\n * See: https://github.com/clauderic/dnd-kit/tree/master/packages/core/src/utilities/algorithms\n */\n // TODO(burdon): Flickering: should not change while animation is happening.\n const collisionDetection: CollisionDetection = (args) => {\n // pointerWithin is the most accurate (since we're using drag handles), but only works with pointer sensors.\n const pointerCollisions = pointerWithin(args);\n if (pointerCollisions.length > 0) {\n return pointerCollisions;\n }\n\n // If there are no collisions with the pointer, return rectangle intersections.\n return rectIntersection(args);\n };\n\n /**\n * Dragging transformation modifiers adaptable by container.\n * See: https://github.com/clauderic/dnd-kit/tree/master/packages/core/src/modifiers\n */\n const modifiers: Modifier = (props) => {\n const { transform } = props;\n if (activeItem) {\n const container = containers[Path.first(activeItem.path)];\n return container?.modifier?.(activeItem, props) ?? transform;\n } else {\n return transform;\n }\n };\n\n /**\n * See: https://github.com/clauderic/dnd-kit/tree/master/packages/core/src/sensors\n */\n const sensors = useSensors(\n useSensor(MouseSensor, {\n activationConstraint: {\n distance: 10,\n },\n }),\n useSensor(TouchSensor, {\n activationConstraint: {\n delay: 200,\n tolerance: 5,\n },\n }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n //\n // Events\n //\n\n const handleDragStart = (event: DragStartEvent) => {\n setActiveItem(pick(event.active.data.current as MosaicDraggedItem, 'path', 'item', 'position'));\n };\n\n const handleDragMove = (event: DragMoveEvent) => {};\n\n const handleDragOver = (event: DragOverEvent) => {\n const overItem = pick(event.over?.data.current as MosaicDraggedItem, 'path', 'item', 'position');\n\n // If the over item is the same as the active item, do nothing.\n // This happens when moving between containers where a placeholder of itself is rendered where it will be dropped.\n if (overItem?.item?.id === activeItem?.item.id) {\n return;\n }\n\n const activeContainer = activeItem && containers[Path.first(activeItem.path)];\n const overContainer = overItem?.path && containers[Path.first(overItem.path)];\n if (!event.over || !overItem || !overContainer || !activeItem || !activeContainer) {\n setOperation('reject');\n setOverItem(undefined);\n return;\n }\n\n const onOver = ({ active, over }: MosaicMoveEvent) => {\n if (Path.parent(active.path) === Path.parent(over.path)) {\n return 'rearrange';\n } else if (overContainer.onOver) {\n return overContainer.onOver({ active, over });\n } else {\n return 'reject';\n }\n };\n\n setOperation(onOver({ active: activeItem, over: overItem }));\n setOverItem(overItem);\n };\n\n const handleDragCancel = (event: DragCancelEvent) => {\n setOperation('reject');\n setActiveItem(undefined);\n setOverItem(undefined);\n };\n\n const handleDragEnd = (event: DragEndEvent) => {\n const overContainer = overItem && containers[Path.first(overItem.path)];\n\n if (\n operation !== 'reject' &&\n activeItem &&\n overItem &&\n (activeItem.path !== overItem.path || activeItem.position !== overItem.position)\n ) {\n const activeContainer = containers[Path.first(activeItem.path)];\n if (activeContainer) {\n activeContainer.onDrop?.({ operation, active: activeItem, over: overItem });\n\n if (overContainer && overContainer !== activeContainer) {\n overContainer.onDrop?.({ operation, active: activeItem, over: overItem });\n }\n }\n }\n\n setTimeout(() => {\n setOperation('reject');\n setOverItem(undefined);\n setActiveItem(undefined);\n }, overContainer?.transitionDuration ?? DEFAULT_TRANSITION);\n };\n\n return (\n <MosaicContext.Provider value={{ containers, setContainer: handleSetContainer, activeItem, overItem, operation }}>\n <DndContext\n collisionDetection={collisionDetection}\n modifiers={[modifiers]}\n sensors={sensors}\n // TODO(burdon): Allow container to veto drop.\n cancelDrop={(event) => false}\n onDragStart={handleDragStart}\n onDragMove={handleDragMove}\n onDragOver={handleDragOver}\n onDragCancel={handleDragCancel}\n onDragEnd={handleDragEnd}\n >\n {children}\n {debug &&\n createPortal(\n <MosaicDebug containers={containers} operation={operation} activeItem={activeItem} overItem={overItem} />,\n document.body,\n )}\n </DndContext>\n </MosaicContext.Provider>\n );\n};\n\nconst MosaicDebug: FC<{\n containers: MosaicContextType['containers'];\n operation: MosaicOperation;\n activeItem?: MosaicDraggedItem;\n overItem?: MosaicDraggedItem;\n}> = ({ containers, operation, activeItem, overItem }) => {\n return (\n <Debug\n position='bottom-right'\n data={{\n containers: Object.keys(containers).map((id) => id),\n operation,\n active: {\n id: activeItem?.item?.id.slice(0, 16),\n path: activeItem?.path && Path.create(...Path.parts(activeItem.path).map((part) => part.slice(0, 16))),\n position: activeItem?.position,\n },\n over: {\n id: overItem?.item?.id.slice(0, 16),\n path: overItem?.path && Path.create(...Path.parts(overItem.path).map((part) => part.slice(0, 16))),\n position: overItem?.position,\n },\n }}\n />\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { mx } from '@dxos/react-ui-theme';\n\ntype Position = 'bottom-left' | 'bottom-right';\n\nexport type DebugProps = { data: any; position?: Position };\n\nexport const Debug: FC<DebugProps> = ({ data, position }) => (\n <pre\n className={mx(\n 'font-mono text-xs overflow-hidden m-2 p-1 z-[100]',\n 'bg-neutral-50 dark:bg-neutral-700 border border-neutral-300 rounded',\n position === 'bottom-left' && 'fixed left-0 bottom-0',\n position === 'bottom-right' && 'fixed right-0 bottom-0',\n )}\n >\n {JSON.stringify(data, undefined, 1)}\n </pre>\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef } from 'react';\n\nimport { Card } from '@dxos/react-ui';\n\nimport { type MosaicTileComponent } from './Tile';\nimport { type MosaicDataItem } from './types';\nimport { Path } from './util';\n\nexport const DefaultComponent: MosaicTileComponent<MosaicDataItem> = forwardRef(\n ({ draggableStyle, draggableProps, item: { id }, path }, forwardRef) => {\n return (\n <Card.Root ref={forwardRef} style={draggableStyle}>\n <Card.Header>\n <Card.DragHandle {...draggableProps} />\n <Card.Title title={Path.create(path, id)} classNames='truncate font-mono text-xs' />\n </Card.Header>\n </Card.Root>\n );\n },\n);\n\nDefaultComponent.displayName = 'DefaultComponent';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { arrayMove } from '@dxos/util';\n\nimport { type MosaicDataItem } from '../types';\n\n// TODO(wittjosiah): Generalize and expand rearrange utilities.\n\nexport const swapItems = <TItem extends MosaicDataItem, TValue extends MosaicDataItem>(\n items: TItem[],\n from: TValue,\n to: TValue,\n): TItem[] => {\n const fromIndex = items.findIndex((item) => item.id === from.id);\n const toIndex = items.findIndex((item) => item.id === to.id);\n return fromIndex !== -1 && toIndex !== -1 ? arrayMove(items, fromIndex, toIndex) : items;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst SEPARATOR = '/';\n\nexport const Path = {\n create: (...args: string[]) => args.join(SEPARATOR),\n\n parts: (path: string) => path.split(SEPARATOR),\n length: (path: string) => path.split(SEPARATOR).length,\n first: (path: string) => path.split(SEPARATOR)[0] ?? path,\n last: (path: string) => path.split(SEPARATOR).at(-1) ?? path,\n parent: (path: string) => path.split(SEPARATOR).slice(0, -1).join(SEPARATOR),\n\n hasRoot: (path: string, id: string) => Path.first(path) === id,\n hasChild: (path: string, compare: string) => Path.parent(compare) === path,\n hasDescendent: (path: string, compare: string) => compare !== path && compare.startsWith(path),\n siblings: (path: string, compare: string) => Path.parent(path) === Path.parent(compare),\n onPath: (path: string, id: string) => Path.parts(path).includes(id),\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// https://docs.dndkit.com/api-documentation/draggable/usedraggable#transform\n\nimport { CSS, type Transform } from '@dnd-kit/utilities';\n\nexport const getTransformCSS = (transform: Transform | null) =>\n transform ? CSS.Transform.toString(Object.assign(transform, { scaleX: 1, scaleY: 1 })) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useContainer } from './useContainer';\nimport { type MosaicDataItem } from '../types';\n\n/**\n * Returns a sorted collection of items if a compare function is provided.\n */\nexport const useSortedItems = <T extends MosaicDataItem>(items: T[]): T[] => {\n const { compare } = useContainer();\n return compare ? [...items].sort(compare) : items;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DragOverlay } from '@dnd-kit/core';\nimport React, { Component, type PropsWithChildren, useEffect, useRef, useState } from 'react';\n\nimport { DensityProvider } from '@dxos/react-ui';\n\nimport { type MosaicContainerProps } from './Container';\nimport { DefaultComponent } from './DefaultComponent';\nimport { type MosaicTileComponent } from './Tile';\nimport { useMosaic } from './hooks';\nimport { Path } from './util';\n\nexport type MosaicDragOverlayProps = { delay?: number; debug?: boolean } & Omit<\n React.ComponentProps<typeof DragOverlay>,\n 'children'\n>;\n\n/**\n * Render the currently dragged item of the Mosaic.\n */\nexport const MosaicDragOverlay = ({ delay = 200, debug = false, ...overlayProps }: MosaicDragOverlayProps) => {\n const { containers, operation, activeItem, overItem } = useMosaic();\n\n // Get the overlay component from the over container, otherwise default to the original.\n const [state, setState] = useState<{\n container?: MosaicContainerProps<any>;\n OverlayComponent?: MosaicTileComponent<any>;\n }>({});\n\n const timer = useRef<ReturnType<typeof setTimeout>>();\n\n useEffect(() => {\n if (activeItem) {\n let container: MosaicContainerProps<any> | undefined;\n let OverlayComponent: MosaicTileComponent<any> | undefined;\n if (overItem?.path) {\n container = containers[Path.first(overItem.path)];\n OverlayComponent = container?.Component;\n }\n\n if (!OverlayComponent) {\n container = containers[Path.first(activeItem.path)];\n OverlayComponent = container?.Component ?? DefaultComponent;\n }\n\n // Prevent jitter when transitioning across containers.\n clearTimeout(timer.current);\n timer.current = setTimeout(() => setState({ container, OverlayComponent }), timer.current ? delay : 0);\n } else {\n setState({});\n }\n }, [activeItem, overItem]);\n\n // Ensure the overlay is rendered as soon as there's an active item, then use local state.\n const container = state.container ?? (activeItem && containers[Path.first(activeItem.path)]);\n const OverlayComponent = state.OverlayComponent ?? container?.Component;\n // Fallback is always to the active (origin) container.\n const FallbackComponent = (activeItem && containers[Path.first(activeItem.path)])?.Component ?? DefaultComponent;\n\n // NOTE: The DragOverlay wrapper element must always be mounted to support animations. Conditionally render the content.\n return (\n // TODO(burdon): Set custom animations (e.g., in/out/around).\n <DragOverlay adjustScale={false} {...overlayProps} style={{ ...container?.getOverlayStyle?.() }}>\n {/* TODO(burdon): Configure density via getOverlayProps. */}\n {activeItem?.path && container && OverlayComponent && (\n <DensityProvider density='fine'>\n <OverlayErrorBoundary\n fallback={\n <FallbackComponent\n {...container.getOverlayProps?.()}\n item={activeItem.item}\n path={activeItem.path}\n operation={operation}\n active='overlay'\n />\n }\n >\n <OverlayComponent\n {...container.getOverlayProps?.()}\n item={activeItem.item}\n path={activeItem.path}\n operation={operation}\n active='overlay'\n />\n {debug && (\n <div className='flex flex-wrap mt-1 p-1 bg-neutral-50 dark:bg-neutral-700 text-xs border rounded overflow-hidden gap-1'>\n <span className='truncate'>\n <span className='text-neutral-400'>container </span>\n {container.id}\n </span>\n <span className='truncate'>\n <span className='text-neutral-400'>item </span>\n {activeItem.item.id.slice(0, 8)}\n </span>\n </div>\n )}\n </OverlayErrorBoundary>\n </DensityProvider>\n )}\n </DragOverlay>\n );\n};\n\ntype OverlayErrorBoundaryProps = PropsWithChildren<{ fallback?: React.ReactNode }>;\n\nclass OverlayErrorBoundary extends Component<OverlayErrorBoundaryProps> {\n private readonly fallback: React.ReactNode;\n\n constructor(props: OverlayErrorBoundaryProps) {\n super(props);\n this.fallback = props.fallback ?? <p>ERROR: ${String(this.state.error)}</p>;\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override state = {\n error: null,\n };\n\n override componentDidCatch(error: any, info: any) {\n console.warn(error, info);\n }\n\n override render() {\n if (this.state.error) {\n return this.fallback;\n }\n\n return this.props.children;\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SortableContext, horizontalListSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { useContainer, useMosaic } from './hooks';\nimport { type MosaicDataItem } from './types';\nimport { Path } from './util';\n\ntype Direction = 'horizontal' | 'vertical';\n\nexport type MosaicSortableProps<TData extends MosaicDataItem = MosaicDataItem> = PropsWithChildren<{\n id?: string;\n items?: TData[];\n direction?: Direction;\n}>;\n\n/**\n * Mosaic convenience wrapper for dnd-kit SortableContext.\n */\n// TODO(burdon): Remove since just obfuscates SortableContext unless more deeply integrated with useSortableItem.\n// Otherwise accept same props as SortableContext (e.g., verticalListSortingStrategy).\nexport const MosaicSortableContext = ({ id, items = [], direction = 'vertical', children }: MosaicSortableProps) => {\n const { operation, activeItem, overItem } = useMosaic();\n const container = useContainer();\n const contextId = id ?? container.id;\n const Sortable = direction === 'vertical' ? Column : Row;\n\n const ids = items.map((item) => {\n const path = Path.create(contextId, item.id);\n // TODO(wittjosiah): Copied from Tile.tsx. Consider factoring out to ensure logic is consistent.\n const isPreview =\n activeItem &&\n activeItem.item.id === item.id &&\n overItem &&\n (Path.siblings(overItem.path, path) || Path.hasChild(overItem.path, path)) &&\n operation !== 'reject';\n return isPreview ? activeItem.path : path;\n });\n\n return (\n <Sortable id={contextId} items={ids}>\n {children}\n </Sortable>\n );\n};\n\nconst Column = ({ children, id, items }: PropsWithChildren<{ id: string; items: string[] }>) => (\n <SortableContext id={id} items={items} strategy={verticalListSortingStrategy}>\n {children}\n </SortableContext>\n);\n\nconst Row = ({ children, id, items }: PropsWithChildren<{ id: string; items: string[] }>) => (\n <SortableContext id={id} items={items} strategy={horizontalListSortingStrategy}>\n {children}\n </SortableContext>\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type DraggableAttributes, useDraggable, useDroppable } from '@dnd-kit/core';\nimport { defaultAnimateLayoutChanges, useSortable } from '@dnd-kit/sortable';\nimport React from 'react';\nimport type { CSSProperties, ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from 'react';\n\nimport type { MosaicOperation, MosaicTileOverlayProps } from './Container';\nimport { DefaultComponent } from './DefaultComponent';\nimport { useContainer, useMosaic } from './hooks';\nimport type { MosaicDataItem, MosaicDraggedItem } from './types';\nimport { getTransformCSS, Path } from './util';\n\nexport type MosaicActiveType = 'overlay' | 'rearrange' | 'origin' | 'destination';\n\nexport type MosaicTileAction = { id: string; action: string; data?: any };\n\n/**\n * Props passed to mosaic tile.\n */\nexport type MosaicTileProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = Pick<\n HTMLAttributes<HTMLDivElement>,\n 'className'\n> &\n MosaicTileOverlayProps & {\n path: string;\n item: TData;\n Component?: MosaicTileComponent<TData, any>;\n position?: TPosition;\n operation?: MosaicOperation;\n active?: MosaicActiveType; // TODO(burdon): Rename state?\n\n // DndKit props.\n isDragging?: boolean;\n isOver?: boolean;\n draggableStyle?: CSSProperties;\n draggableProps?: DraggableAttributes &\n // TODO(wittjosiah): SyntheticListenerMap.\n HTMLAttributes<HTMLElement>;\n\n // TODO(burdon): Generalize events via onAction?\n onSelect?: () => void;\n onRemove?: () => void;\n onAction?: (action: MosaicTileAction) => void;\n };\n\n/**\n * Mosaic Tile component.\n */\nexport type MosaicTileComponent<\n TData extends MosaicDataItem = MosaicDataItem,\n TElement extends HTMLElement = HTMLDivElement,\n> = ForwardRefExoticComponent<\n RefAttributes<TElement> & Omit<MosaicTileProps<TData>, 'Component' | 'operation'> & { operation: MosaicOperation }\n>;\n\n/**\n * Basic draggable mosaic tile.\n */\nexport const DraggableTile = ({\n path: parentPath,\n item,\n Component = DefaultComponent,\n position,\n draggableStyle,\n ...props\n}: MosaicTileProps<any>) => {\n const { operation } = useMosaic();\n const path = Path.create(parentPath, item.id);\n const { setNodeRef, attributes, listeners, /* transform, */ isDragging } = useDraggable({\n id: path,\n data: { path, item, position } satisfies MosaicDraggedItem,\n });\n\n return (\n <Component\n ref={setNodeRef}\n item={item}\n path={path}\n position={position}\n operation={operation}\n isDragging={isDragging}\n draggableStyle={{\n // TODO(burdon): Override by container?\n // transform: getTransformCSS(transform),\n ...draggableStyle,\n }}\n draggableProps={{ ...attributes, ...listeners }}\n {...props}\n />\n );\n};\n\n/**\n * Basic droppable mosaic tile.\n */\nexport const DroppableTile = ({\n path: parentPath,\n item,\n Component = DefaultComponent,\n position,\n ...props\n}: MosaicTileProps<any>) => {\n const { operation } = useMosaic();\n const path =\n parentPath === item.id\n ? parentPath // If the path is the same as the item id, then this is the root tile.\n : Path.create(parentPath, item.id);\n const { setNodeRef, isOver } = useDroppable({\n id: path,\n data: { path, item, position } satisfies MosaicDraggedItem,\n });\n\n return (\n <Component\n ref={setNodeRef}\n item={item}\n path={path}\n position={position}\n operation={operation}\n isOver={isOver}\n {...props}\n />\n );\n};\n\n/**\n * Mosaic tile that can be sorted.\n */\nexport const SortableTile = ({\n path: parentPath,\n item,\n Component: OverrideComponent,\n position,\n draggableStyle,\n ...props\n}: MosaicTileProps<any, number>) => {\n const { operation, activeItem, overItem } = useMosaic();\n const { transitionDuration, Component: ContainerComponent } = useContainer();\n\n const path = Path.create(parentPath, item.id);\n // Re-use the active path if it's the same item and the item is a preview.\n // This helps dndkit understand that the item is being moved and animate it appropriately.\n const isPreview =\n activeItem &&\n activeItem.item.id === item.id &&\n overItem &&\n !Path.siblings(activeItem.path, overItem.path) &&\n (Path.siblings(overItem.path, path) || Path.hasChild(overItem.path, path)) &&\n operation !== 'reject';\n\n const { setNodeRef, attributes, listeners, transform, isDragging, isOver } = useSortable({\n id: isPreview ? activeItem.path : path,\n data: { path, item, position } satisfies MosaicDraggedItem,\n animateLayoutChanges: (args) =>\n defaultAnimateLayoutChanges({ ...args, wasDragging: item.id !== activeItem?.item.id }),\n });\n\n let active: MosaicActiveType | undefined;\n if (isDragging) {\n if (operation === 'rearrange' || operation === 'reject') {\n active = 'rearrange';\n } else if (activeItem && Path.parent(activeItem.path) !== parentPath) {\n active = 'destination';\n } else {\n active = 'origin';\n }\n }\n\n const Component = OverrideComponent ?? ContainerComponent ?? DefaultComponent;\n\n return (\n <Component\n ref={setNodeRef}\n item={item}\n path={path}\n position={position}\n operation={operation}\n active={active}\n isDragging={isDragging}\n isOver={isOver}\n draggableStyle={{\n transform: getTransformCSS(transform),\n transition: transform ? `transform ${transitionDuration}ms ease` : 'none',\n ...draggableStyle,\n }}\n draggableProps={{ ...attributes, ...listeners }}\n {...props}\n />\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type FC } from 'react';\n\nimport {\n MosaicContainer,\n type MosaicContainerProps as NaturalMosaicContainerProps,\n type MosaicMoveEvent as NaturalMosaicMoveEvent,\n type MosaicDropEvent as NaturalMosaicDropEvent,\n type MosaicOperation as NaturalMosaicOperation,\n type MosaicCompareDataItem as NaturalMosaicCompareDataItem,\n} from './Container';\nimport { Debug, type DebugProps } from './Debug';\nimport { DefaultComponent } from './DefaultComponent';\nimport { MosaicDragOverlay, type MosaicDragOverlayProps } from './DragOverlay';\nimport { MosaicRoot, type MosaicRootProps as NaturalMosaicRootProps } from './Root';\nimport { MosaicSortableContext, type MosaicSortableProps as NaturalMosaicSortableProps } from './SortableContext';\nimport {\n DraggableTile,\n DroppableTile,\n SortableTile,\n type MosaicTileAction as NaturalMosaicTileAction,\n type MosaicTileProps as NaturalMosaicTileProps,\n type MosaicTileComponent as NaturalMosaicTileComponent,\n type MosaicActiveType as NaturalMosaicActiveType,\n} from './Tile';\nimport { type MosaicDataItem } from './types';\n\nexport const Mosaic = {\n Root: MosaicRoot,\n Container: MosaicContainer,\n DragOverlay: MosaicDragOverlay,\n SortableContext: MosaicSortableContext,\n DraggableTile,\n DroppableTile,\n SortableTile,\n\n // TODO(wittjosiah): Consider factoring out or using inline styles instead depending on DXOS UI theme/tailwind.\n DefaultComponent,\n // TODO(burdon): Don't export; move to util.\n Debug,\n} as {\n Root: FC<MosaicRootProps>;\n Container: FC<MosaicContainerProps<any, any>>;\n DragOverlay: FC<MosaicOverlayProps>;\n SortableContext: FC<MosaicSortableProps>;\n DraggableTile: FC<MosaicTileProps<any, any>>;\n DroppableTile: FC<MosaicTileProps<any, any>>;\n SortableTile: FC<MosaicTileProps<any, number>>;\n\n DefaultComponent: MosaicTileComponent;\n Debug: FC<MosaicDebugProps>;\n};\n\nexport type MosaicRootProps = NaturalMosaicRootProps;\n\nexport type MosaicContainerProps<\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n> = NaturalMosaicContainerProps<TData, TPosition>;\n\nexport type MosaicOverlayProps = MosaicDragOverlayProps;\n\nexport type MosaicSortableProps = NaturalMosaicSortableProps;\n\nexport type MosaicTileAction = NaturalMosaicTileAction;\n\nexport type MosaicTileProps<\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n> = NaturalMosaicTileProps<TData, TPosition>;\n\nexport type MosaicTileComponent<\n TData extends MosaicDataItem = MosaicDataItem,\n TElement extends HTMLElement = HTMLDivElement,\n> = NaturalMosaicTileComponent<TData, TElement>;\n\nexport type MosaicMoveEvent<TPosition = unknown> = NaturalMosaicMoveEvent<TPosition>;\nexport type MosaicDropEvent<TPosition = unknown> = NaturalMosaicDropEvent<TPosition>;\nexport type MosaicOperation = NaturalMosaicOperation;\nexport type MosaicActiveType = NaturalMosaicActiveType;\n\nexport type MosaicCompareDataItem = NaturalMosaicCompareDataItem;\n\n// TODO(burdon): Remove.\nexport type MosaicDebugProps = DebugProps;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport type Size = { x: number; y: number };\nexport type Position = { x: number; y: number };\nexport type Dimension = { width: number; height: number };\nexport type Bounds = { left: number; top: number; width: number; height: number };\n\nexport const createMatrix = <TValue>(size: Size, value: (position: Position) => TValue): TValue[][] => {\n const matrix: TValue[][] = [];\n for (let x = 0; x < size.x; x++) {\n matrix.push(Array.from({ length: size.y }, (_, y) => value({ x, y })));\n }\n\n return matrix;\n};\n\nexport const getDimension = ({ width, height }: Dimension, spacing = 0): Dimension => ({\n width: width - spacing * 2,\n height: height - spacing * 2,\n});\n\nexport const getBounds = ({ x, y }: Position, { width, height }: Dimension, spacing = 0): Bounds => ({\n left: x * width + spacing * 2,\n top: y * height + spacing * 2,\n width: width - spacing * 2,\n height: height - spacing * 2,\n});\n\nexport const getPanelBounds = ({ x, y }: Position, { width, height }: Dimension, spacing = 0): Dimension => ({\n width: x * width + spacing * 2,\n height: y * height + spacing * 2,\n});\n\nexport const calculateCellWidth = (\n defaultWidth: number,\n screenWidth: number,\n options: { min: number; max: number } = { min: 260, max: 400 },\n) => {\n return screenWidth > options.min && screenWidth < options.max ? screenWidth : defaultWidth;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useDroppable } from '@dnd-kit/core';\nimport { PlusCircle } from '@phosphor-icons/react';\nimport defaultsDeep from 'lodash.defaultsdeep';\nimport React, { type FC, useState, useMemo, useEffect } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { Button, useMediaQuery } from '@dxos/react-ui';\nimport { getSize, mx } from '@dxos/react-ui-theme';\n\nimport {\n calculateCellWidth,\n createMatrix,\n getBounds,\n getDimension,\n getPanelBounds,\n type Dimension,\n type Position,\n type Size,\n} from './layout';\nimport {\n type MosaicContainerProps,\n type MosaicDataItem,\n type MosaicTileAction,\n Mosaic,\n Path,\n useMosaic,\n} from '../../mosaic';\n\n//\n// Selection\n//\n\n// TODO(burdon): Factor out as mosaic standard.\ntype ControlledSelection = {\n selected?: string;\n onSelect?: (id: string) => void;\n};\n\n//\n// Context.\n//\n\ntype GridOptions = {\n size: Size;\n cellBounds: Dimension;\n spacing?: number;\n};\n\nconst defaultGridOptions: GridOptions = {\n size: { x: 8, y: 8 },\n cellBounds: { width: 272, height: 272 },\n spacing: 6,\n};\n\n//\n// Container.\n//\n\nexport type GridLayout = { [id: string]: Position };\n\nexport type GridProps<TData extends MosaicDataItem = MosaicDataItem> = MosaicContainerProps<TData, Position> &\n ControlledSelection & {\n items?: TData[];\n layout?: GridLayout;\n options?: Partial<GridOptions>;\n margin?: boolean;\n square?: boolean;\n debug?: boolean;\n onCreate?: (position: Position) => void;\n onAction?: (action: MosaicTileAction) => void; // TODO(burdon): Standardize across mosaics?\n };\n\n/**\n * Grid content.\n */\n// TODO(burdon): Make generic (and forwardRef).\nexport const Grid = ({\n id,\n items = [],\n layout = {},\n options: opts,\n margin,\n square = true,\n debug,\n selected: controlledSelected,\n Component = Mosaic.DefaultComponent,\n className,\n onDrop,\n onSelect,\n onCreate,\n onAction,\n}: GridProps) => {\n const { ref: containerRef, width, height } = useResizeDetector({ refreshRate: 200 });\n const options = defaultsDeep({}, opts, defaultGridOptions);\n const { matrix, bounds, cellBounds } = useMemo(() => {\n // Change default cell bounds to screen width if mobile.\n const cellWidth = calculateCellWidth(options.cellBounds.width, width ?? 0);\n const cellBounds = {\n width: cellWidth,\n height: square ? cellWidth : options.cellBounds.height,\n };\n\n return {\n matrix: createMatrix(options.size, ({ x, y }) => ({ x, y })),\n bounds: getPanelBounds(options.size, cellBounds, options.spacing),\n cellBounds,\n };\n }, [options, width]);\n\n // No margin if mobile.\n const [isNotMobile] = useMediaQuery('md');\n const marginSize = margin && !isNotMobile ? Math.max(cellBounds.width, cellBounds.height) : 0;\n\n const [selected, setSelected] = useState(controlledSelected);\n useEffect(() => {\n setSelected(controlledSelected);\n if (controlledSelected) {\n scrollToCenter(controlledSelected);\n }\n }, [controlledSelected]);\n\n const scrollToCenter = (id: string) => {\n const item = items.find((item) => item.id === id);\n if (item && width && height) {\n const pos = getBounds(layout[item.id], cellBounds);\n const top = pos.top + marginSize - (height - cellBounds.height) / 2;\n const left = pos.left + marginSize - (width - cellBounds.width) / 2;\n containerRef.current!.scrollTo({ top, left, behavior: 'smooth' });\n }\n };\n\n // TODO(burdon): Focus ring/navigation.\n // TODO(burdon): Set center point on container (via translation?) Scale container to zoom.\n const handleSelect = (id: string) => {\n setSelected(id);\n scrollToCenter(id);\n onSelect?.(id);\n };\n\n useEffect(() => {\n if (selected) {\n scrollToCenter(selected);\n }\n }, [selected, width, height]);\n\n return (\n <Mosaic.Container\n {...{\n id,\n Component,\n getOverlayProps: () => ({ grow: true }),\n getOverlayStyle: () => getDimension(cellBounds, options.spacing),\n onDrop,\n }}\n >\n <div className={mx('flex grow overflow-auto', className)}>\n <div ref={containerRef} className={mx('grow overflow-auto snap-x snap-mandatory md:snap-none')}>\n <div className='group block relative' style={{ ...bounds, margin: marginSize }}>\n {matrix && (\n <div style={{ padding: options.spacing }}>\n <div className='relative'>\n {matrix.map((row) =>\n row.map(({ x, y }) => (\n <GridCell\n key={`${x}-${y}`}\n path={id}\n position={{ x, y }}\n bounds={getBounds({ x, y }, cellBounds)}\n padding={options.spacing}\n onCreate={onCreate}\n />\n )),\n )}\n </div>\n </div>\n )}\n\n <div>\n {items.map((item) => {\n const position = layout[item.id] ?? { x: 0, y: 0 };\n return (\n <Mosaic.DraggableTile\n key={item.id}\n item={item}\n path={id}\n position={position}\n Component={Component}\n draggableStyle={{\n position: 'absolute',\n ...getBounds(position, cellBounds, options.spacing),\n }}\n onSelect={() => handleSelect(item.id)}\n onAction={onAction}\n // debug={debug}\n />\n );\n })}\n </div>\n </div>\n\n {debug && <Mosaic.Debug data={{ items: items?.length }} position='bottom-right' />}\n </div>\n </div>\n </Mosaic.Container>\n );\n};\n\n/**\n * Grid cell.\n */\nconst GridCell: FC<{\n path: string;\n position: Position;\n bounds: Dimension;\n padding?: number;\n onCreate?: (position: Position) => void;\n}> = ({ path, position, bounds, padding, onCreate }) => {\n const { overItem } = useMosaic();\n const isOverContainer = path === overItem?.path;\n const { setNodeRef, isOver } = useDroppable({\n id: Path.create(path, 'cell', `${position.x}-${position.y}`),\n data: { path, position },\n });\n\n return (\n <div\n ref={setNodeRef}\n style={{ ...bounds, padding }}\n className='absolute flex justify-center items-center grow select-none cursor-pointer'\n >\n <div\n className={mx(\n 'group/cell flex group-hover:flex w-full h-full items-center justify-center',\n 'box-border border-dashed border-4 border-neutral-100 rounded-lg',\n 'transition ease-in-out duration-300',\n isOver && 'flex bg-neutral-200 border-neutral-400',\n )}\n >\n <div\n className={mx(\n 'opacity-10 transition ease-in-out duration-300 group-hover/cell:opacity-100',\n isOverContainer && 'hidden',\n )}\n >\n {onCreate && (\n // TODO(burdon): Style button.\n <Button variant='ghost' onClick={() => onCreate(position)}>\n <PlusCircle className={getSize(8)} />\n </Button>\n )}\n </div>\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef, useMemo } from 'react';\n\nimport { Card } from '@dxos/react-ui';\nimport { groupSurface, mx } from '@dxos/react-ui-theme';\n\nimport {\n Mosaic,\n type MosaicContainerProps,\n type MosaicDataItem,\n type MosaicTileComponent,\n Path,\n useItemsWithPreview,\n useContainer,\n} from '../../mosaic';\n\n// Example:\n// https://master--5fc05e08a4a65d0021ae0bf2.chromatic.com/?path=/story/presets-sortable-multiple-containers--basic-setup\n\nexport type KanbanColumn<TData extends MosaicDataItem = MosaicDataItem> = MosaicDataItem & {\n title: string;\n items: TData[];\n};\n\nexport type KanbanProps<TData extends MosaicDataItem = MosaicDataItem> = MosaicContainerProps<TData, number> & {\n columns: KanbanColumn<TData>[];\n debug?: boolean;\n};\n\nexport const Kanban = ({\n id,\n columns,\n Component: TileComponent = Mosaic.DefaultComponent,\n debug,\n onDrop,\n}: KanbanProps) => {\n const Component = useMemo(() => OverlayComponent(id, TileComponent), [id, TileComponent]);\n\n return (\n <Mosaic.Container\n {...{\n id,\n debug,\n Component,\n // Restrict columns to x-axis.\n modifier: ({ path, item }, { transform }) =>\n path === Path.create(id, item.id) ? { ...transform, y: 0 } : transform,\n // Restrict to objects from other columns.\n // TODO(burdon): Consider objects from other containers.\n // TODO(wittjosiah): Allow override.\n onOver: ({ active, over }) => (Path.length(active.path) >= Path.length(over.path) ? 'transfer' : 'reject'),\n onDrop,\n }}\n >\n <div className='grow flex overflow-y-hidden overflow-x-auto'>\n <div className='flex'>\n <Mosaic.SortableContext items={columns} direction='horizontal'>\n {columns.map((column, index) => (\n <Mosaic.SortableTile\n key={column.id}\n item={column}\n path={id}\n position={index}\n Component={Component}\n debug={debug}\n />\n ))}\n </Mosaic.SortableContext>\n </div>\n </div>\n </Mosaic.Container>\n );\n};\n\nconst OverlayComponent = (id: string, Component: MosaicTileComponent<any>): MosaicTileComponent<any> =>\n forwardRef((props, ref) => {\n const isColumn = Path.hasRoot(props.path, id) && Path.length(props.path) === 2;\n if (isColumn && props.active === 'overlay') {\n return (\n // Needs to not override the main kanban path.\n <Mosaic.Container {...{ id: `${id}-active`, Component }}>\n <KanbanColumnComponent {...props} ref={ref} />\n </Mosaic.Container>\n );\n }\n\n return isColumn ? <KanbanColumnComponent {...props} ref={ref} /> : <Component {...props} ref={ref} />;\n });\n\nconst KanbanColumnComponent: MosaicTileComponent<KanbanColumn> = forwardRef(\n ({ path, item, active, draggableStyle, draggableProps, debug }, forwardRef) => {\n const { id, title, items } = item;\n const { Component } = useContainer();\n const itemsWithPreview = useItemsWithPreview({ path, items });\n\n return (\n <div role='none' className='grow flex flex-col' ref={forwardRef}>\n <div\n className={mx(\n groupSurface,\n 'grow flex flex-col w-[300px] snap-center overflow-hidden m-1',\n active === 'rearrange' && 'opacity-0',\n )}\n style={draggableStyle}\n >\n <Card.Root classNames='shrink-0 bg-cyan-200'>\n <Card.Header>\n <Card.DragHandle {...draggableProps} />\n <Card.Title title={title} />\n <Card.Menu />\n </Card.Header>\n </Card.Root>\n\n <div className={mx('flex flex-col grow overflow-y-scroll')}>\n <div className='flex flex-col my-1'>\n <Mosaic.SortableContext id={path} items={itemsWithPreview} direction='vertical'>\n {itemsWithPreview.map((item, index) => (\n <Mosaic.SortableTile\n key={item.id}\n item={item}\n path={path}\n position={index}\n Component={Component!}\n className='m-1'\n // debug={debug}\n />\n ))}\n </Mosaic.SortableContext>\n </div>\n </div>\n {debug && <Mosaic.Debug data={{ path, id, items: itemsWithPreview.length }} />}\n </div>\n </div>\n );\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { Mosaic, type MosaicContainerProps, type MosaicDataItem, useItemsWithPreview } from '../../mosaic';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type StackProps<TData extends MosaicDataItem = MosaicDataItem> = MosaicContainerProps<TData, number> & {\n items?: TData[];\n direction?: Direction;\n debug?: boolean;\n};\n\n// TODO(burdon): Make generic (and forwardRef).\nexport const Stack = ({\n id,\n Component = Mosaic.DefaultComponent,\n onOver,\n onDrop,\n items = [],\n direction = 'vertical',\n debug,\n}: StackProps) => {\n const itemsWithPreview = useItemsWithPreview({ path: id, items });\n\n return (\n <div className={mx('flex overflow-hidden', direction === 'vertical' && 'w-[300px]')}>\n <div\n className={mx('flex flex-col w-full my-1', direction === 'vertical' ? 'overflow-y-auto' : 'overflow-x-auto')}\n >\n <Mosaic.Container {...{ id, Component, onOver, onDrop }}>\n <Mosaic.SortableContext items={itemsWithPreview} direction={direction}>\n {itemsWithPreview.map((item, index) => (\n <Mosaic.SortableTile\n key={item.id}\n item={item}\n path={id}\n position={index}\n className='m-1'\n // debug={debug}\n />\n ))}\n </Mosaic.SortableContext>\n </Mosaic.Container>\n {debug && (\n <div className='grow'>\n <Mosaic.Debug data={{ id, items: itemsWithPreview.length }} />\n </div>\n )}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef } from 'react';\n\nimport { Card, Tree as TreeComponent, TreeItem as TreeItemComponent } from '@dxos/react-ui';\nimport { dropRing, mx } from '@dxos/react-ui-theme';\n\nimport {\n type MosaicContainerProps,\n Mosaic,\n type MosaicDataItem,\n type MosaicTileComponent,\n useContainer,\n useMosaic,\n Path,\n useSortedItems,\n type MosaicCompareDataItem,\n} from '../../mosaic';\n\n// TODO(burdon): Tree data model that provides a pure abstraction of the plugin Graph.\n// - The Tree (like Stack, Grid) is a high level container that assembles Radix style DXOS UI components from a model.\n// - Models in general should be easily mapped from the Graph and/or ECHO queries.\n// - See: https://master--5fc05e08a4a65d0021ae0bf2.chromatic.com/?path=/story/examples-tree-sortable--basic-setup\n\nexport type TreeProps<TData extends MosaicDataItem = TreeData> = MosaicContainerProps<TData, number> & {\n items?: TData[];\n debug?: boolean;\n compare?: MosaicCompareDataItem;\n};\n\nexport type TreeData = {\n id: string;\n label?: string; // TODO(burdon): Provide adapter.\n children: TreeData[];\n};\n\n// TODO(burdon): Make generic (and forwardRef).\nexport const Tree = ({ id, Component = TreeItem, onOver, onDrop, items = [], debug, compare }: TreeProps) => {\n return (\n <Mosaic.Container\n {...{\n id,\n debug,\n Component,\n onOver,\n onDrop,\n compare,\n }}\n >\n <TreeRoot items={items} />\n </Mosaic.Container>\n );\n};\n\nconst TreeRoot = ({ items }: { items: TreeData[] }) => {\n const { id, Component } = useContainer();\n const sortedItems = useSortedItems(items);\n\n return (\n <TreeComponent.Root classNames='flex flex-col'>\n <Mosaic.SortableContext id={id} items={sortedItems} direction='vertical'>\n {sortedItems.map((item, index) => (\n <TreeItemComponent.Root key={item.id} collapsible defaultOpen>\n <Mosaic.SortableTile item={item} path={id} position={index} Component={Component!} />\n </TreeItemComponent.Root>\n ))}\n </Mosaic.SortableContext>\n </TreeComponent.Root>\n );\n};\n\n/**\n * Pure component that is used by the mosaic overlay.\n */\nconst TreeItem: MosaicTileComponent<TreeData> = forwardRef(\n ({ path, draggableStyle, draggableProps, item, operation, active, isOver, isDragging, className }, forwardedRef) => {\n return (\n <div\n ref={forwardedRef}\n style={draggableStyle}\n className={mx(\n 'flex flex-col rounded',\n className,\n (active === 'rearrange' || active === 'origin') && 'opacity-0',\n active === 'destination' && 'opacity-20',\n isOver && dropRing,\n )}\n >\n <Card.Header>\n <Card.DragHandle {...draggableProps} />\n <Card.Title title={item.label ?? path} classNames='truncate' />\n </Card.Header>\n\n {!active && item.children && <TreeBranch path={path} items={item.children} />}\n </div>\n );\n },\n);\n\nconst TreeBranch = ({ path, items }: { path: string; items: TreeData[] }) => {\n const { operation, overItem } = useMosaic();\n const { Component } = useContainer();\n const sortedItems = useSortedItems(items);\n\n return (\n <TreeItemComponent.Body className='pis-4'>\n <Mosaic.SortableContext id={path} items={sortedItems} direction='vertical'>\n {sortedItems.map((child, index) => (\n <TreeComponent.Branch key={child.id}>\n <TreeItemComponent.Root collapsible defaultOpen>\n <Mosaic.SortableTile\n item={child}\n path={path}\n position={index}\n Component={Component!}\n isOver={\n overItem?.path === Path.create(path, child.id) && (operation === 'transfer' || operation === 'copy')\n }\n />\n </TreeItemComponent.Root>\n </TreeComponent.Branch>\n ))}\n </Mosaic.SortableContext>\n </TreeItemComponent.Body>\n );\n};\n"],
5
+ "mappings": ";AAIA,SAASA,kBAAkB;AAE3B,SAASC,aAAa;;;ACDtB,OAAOC,SACLC,eACAC,iBAIK;AAMA,IAAMC,qBAAqB;AAsF3B,IAAMC,yBAAyBC,8BAAsDC,MAAAA;AAKrF,IAAMC,kBAAkB,CAAC,EAC9BC,UACAC,IACAC,OACAC,WAAAA,YACAC,qBAAqBT,oBACrBU,UACAC,iBACAC,iBACAC,QACAC,QACAC,QAAO,MACc;AACrB,QAAMC,SAASC,UAAAA;AACf,QAAMC,YAAY;IAChBZ;IACAC;IACAC,WAAAA;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;EACF;AAEAI,YAAU,MAAA;AACRH,WAAOI,aAAaF,UAAUZ,IAAIY,SAAAA;AAClC,WAAO,MAAA;IAGP;EACF,GAAGG,OAAOC,OAAOJ,SAAAA,CAAAA;AAEjB,SAAO,sBAAA,cAACjB,uBAAuBsB,UAAQ;IAACC,OAAON;KAAYb,QAAAA;AAC7D;;;ADrIO,IAAMoB,eAAe,MAI1BC,WAAWC,sBAAAA,KAA2BC,MAAM,IAAIC,MAAM,gCAAA,CAAA;;;AEXxD,SAASC,aAAAA,YAAWC,YAAAA,iBAAgB;;;ACApC,SAASC,cAAAA,mBAAkB;AAE3B,SAASC,SAAAA,cAAa;;;ACFtB,SAEEC,YAMAC,gBAEAC,aACAC,eACAC,kBACAC,aACAC,WACAC,kBACK;AACP,SAASC,mC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gBAAAd,QAAA,cAACO,cAAcyC,QAAM;IAAChC,KAAK+B,MAAMvD;KAC/B,gBAAAQ,QAAA,cAACe,kBAAkBP,MAAI;IAACS,aAAAA;IAAYC,aAAAA;KAClC,gBAAAlB,QAAA,cAACC,OAAOkB,cAAY;IAClBN,MAAMkC;IACN3B;IACAC,UAAUP;IACVrB,WAAWA;IACXkC,QACEiB,UAAUxB,SAAS6B,KAAKC,OAAO9B,MAAM2B,MAAMvD,EAAE,MAAMiC,cAAc,cAAcA,cAAc;;AAS/G;",
6
+ "names": ["useContext", "raise", "React", "createContext", "useEffect", "DEFAULT_TRANSITION", "MosaicContainerContext", "createContext", "undefined", "MosaicContainer", "children", "id", "debug", "Component", "transitionDuration", "modifier", "getOverlayProps", "getOverlayStyle", "onOver", "onDrop", "compare", "mosaic", "useMosaic", "container", "useEffect", "setContainer", "Object", "values", "Provider", "value", "useContainer", "useContext", "MosaicContainerContext", "raise", "Error", "useEffect", "useState", "useContext", "raise", "DndContext", "KeyboardSensor", "MouseSensor", "pointerWithin", "rectIntersection", "TouchSensor", "useSensor", "useSensors", "sortableKeyboardCoordinates", "pick", "React", "createContext", "useState", "createPortal", "React", "mx", "Debug", "data", "position", "React", "pre", "className", "mx", "JSON", "stringify", "undefined", "React", "forwardRef", "Card", "arrayMove", "swapItems", "items", "from", "to", "fromIndex", "findIndex", "item", "id", "toIndex", "arrayMove", "SEPARATOR", "Path", "create", "args", "join", "parts", "path", "split", "length", "first", "last", "at", "parent", "slice", "hasRoot", "id", "hasChild", "compare", "hasDescendent", "startsWith", "siblings", "onPath", "includes", "CSS", "getTransformCSS", "transform", "CSS", "Transform", "toString", "Object", "assign", "scaleX", "scaleY", "undefined", "DefaultComponent", "forwardRef", "draggableStyle", "draggableProps", "item", "id", "path", "React", "Card", "Root", "ref", "style", "Header", "DragHandle", "Title", "title", "Path", "create", "classNames", "displayName", "DEFAULT_COMPONENT_ID", "MosaicContext", "createContext", "undefined", "MosaicRoot", "Component", "DefaultComponent", "debug", "children", "containers", "setContainers", "useState", "id", "handleSetContainer", "container", "_", "rest", "activeItem", "setActiveItem", "overItem", "setOverItem", "operation", "setOperation", "collisionDetection", "args", "pointerCollisions", "pointerWithin", "length", "rectIntersection", "modifiers", "props", "transform", "Path", "first", "path", "modifier", "sensors", "useSensors", "useSensor", "MouseSensor", "activationConstraint", "distance", "TouchSensor", "delay", "tolerance", "KeyboardSensor", "coordinateGetter", "sortableKeyboardCoordinates", "handleDragStart", "event", "pick", "active", "data", "current", "handleDragMove", "handleDragOver", "over", "item", "activeContainer", "overContainer", "onOver", "parent", "handleDragCancel", "handleDragEnd", "position", "onDrop", "setTimeout", "transitionDuration", "DEFAULT_TRANSITION", "React", "Provider", "value", "setContainer", "DndContext", "cancelDrop", "onDragStart", "onDragMove", "onDragOver", "onDragCancel", "onDragEnd", "createPortal", "MosaicDebug", "document", "body", "Debug", "Object", "keys", "map", "slice", "create", "parts", "part", "useMosaic", "useContext", "MosaicContext", "raise", "Error", "useItemsWithPreview", "path", "items", "operation", "activeItem", "overItem", "useMosaic", "itemsWithPreview", "setItemsWithPreview", "useState", "overParent", "Path", "parent", "lastOverParent", "setLastOverParent", "useEffect", "undefined", "activeIsChild", "hasChild", "overIsChild", "overSelf", "position", "slice", "item", "filter", "id", "length", "useSortedItems", "items", "compare", "useContainer", "sort", "DragOverlay", "React", "Component", "useEffect", "useRef", "useState", "DensityProvider", "MosaicDragOverlay", "delay", "debug", "overlayProps", "containers", "operation", "activeItem", "overItem", "useMosaic", "state", "setState", "useState", "timer", "useRef", "useEffect", "container", "OverlayComponent", "path", "Path", "first", "Component", "DefaultComponent", "clearTimeout", "current", "setTimeout", "FallbackComponent", "React", "DragOverlay", "adjustScale", "style", "getOverlayStyle", "DensityProvider", "density", "OverlayErrorBoundary", "fallback", "getOverlayProps", "item", "active", "div", "className", "span", "id", "slice", "constructor", "props", "error", "p", "String", "getDerivedStateFromError", "componentDidCatch", "info", "console", "warn", "render", "children", "SortableContext", "horizontalListSortingStrategy", "verticalListSortingStrategy", "React", "MosaicSortableContext", "id", "items", "direction", "children", "operation", "activeItem", "overItem", "useMosaic", "container", "useContainer", "contextId", "Sortable", "Column", "Row", "ids", "map", "item", "path", "Path", "create", "isPreview", "siblings", "hasChild", "React", "SortableContext", "strategy", "verticalListSortingStrategy", "horizontalListSortingStrategy", "useDraggable", "useDroppable", "defaultAnimateLayoutChanges", "useSortable", "React", "DraggableTile", "path", "parentPath", "item", "Component", "DefaultComponent", "position", "draggableStyle", "props", "operation", "useMosaic", "Path", "create", "id", "setNodeRef", "attributes", "listeners", "isDragging", "useDraggable", "data", "React", "ref", "draggableProps", "DroppableTile", "isOver", "useDroppable", "SortableTile", "OverrideComponent", "activeItem", "overItem", "transitionDuration", "ContainerComponent", "useContainer", "isPreview", "siblings", "hasChild", "transform", "useSortable", "animateLayoutChanges", "args", "defaultAnimateLayoutChanges", "wasDragging", "active", "parent", "getTransformCSS", "transition", "Mosaic", "Root", "MosaicRoot", "Container", "MosaicContainer", "DragOverlay", "MosaicDragOverlay", "SortableContext", "MosaicSortableContext", "DraggableTile", "DroppableTile", "SortableTile", "DefaultComponent", "Debug", "createMatrix", "size", "value", "matrix", "x", "push", "Array", "from", "length", "y", "_", "getDimension", "width", "height", "spacing", "getBounds", "left", "top", "getPanelBounds", "calculateCellWidth", "defaultWidth", "screenWidth", "options", "min", "max", "useDroppable", "PlusCircle", "defaultsDeep", "React", "useState", "useMemo", "useEffect", "useResizeDetector", "Button", "useMediaQuery", "getSize", "mx", "defaultGridOptions", "size", "x", "y", "cellBounds", "width", "height", "spacing", "Grid", "id", "items", "layout", "options", "opts", "margin", "square", "debug", "selected", "controlledSelected", "Component", "Mosaic", "DefaultComponent", "className", "onDrop", "onSelect", "onCreate", "onAction", "ref", "containerRef", "useResizeDetector", "refreshRate", "defaultsDeep", "matrix", "bounds", "useMemo", "cellWidth", "calculateCellWidth", "createMatrix", "getPanelBounds", "isNotMobile", "useMediaQuery", "marginSize", "Math", "max", "setSelected", "useState", "useEffect", "scrollToCenter", "item", "find", "pos", "getBounds", "top", "left", "current", "scrollTo", "behavior", "handleSelect", "React", "Container", "getOverlayProps", "grow", "getOverlayStyle", "getDimension", "div", "mx", "style", "padding", "map", "row", "GridCell", "key", "path", "position", "DraggableTile", "draggableStyle", "Debug", "data", "length", "overItem", "useMosaic", "isOverContainer", "setNodeRef", "isOver", "useDroppable", "Path", "create", "Button", "variant", "onClick", "PlusCircle", "getSize", "React", "forwardRef", "useMemo", "Card", "groupSurface", "mx", "Kanban", "id", "columns", "Component", "TileComponent", "Mosaic", "DefaultComponent", "debug", "onDrop", "useMemo", "OverlayComponent", "React", "Container", "modifier", "path", "item", "transform", "Path", "create", "y", "onOver", "active", "over", "length", "div", "className", "SortableContext", "items", "direction", "map", "column", "index", "SortableTile", "key", "position", "forwardRef", "props", "ref", "isColumn", "hasRoot", "KanbanColumnComponent", "draggableStyle", "draggableProps", "title", "useContainer", "itemsWithPreview", "useItemsWithPreview", "role", "mx", "groupSurface", "style", "Card", "Root", "classNames", "Header", "DragHandle", "Title", "Menu", "Debug", "data", "React", "mx", "Stack", "id", "Component", "Mosaic", "DefaultComponent", "onOver", "onDrop", "items", "direction", "debug", "itemsWithPreview", "useItemsWithPreview", "path", "React", "div", "className", "mx", "Container", "SortableContext", "map", "item", "index", "SortableTile", "key", "position", "Debug", "data", "length", "React", "forwardRef", "Card", "Tree", "TreeComponent", "TreeItem", "TreeItemComponent", "dropRing", "mx", "Tree", "id", "Component", "TreeItem", "onOver", "onDrop", "items", "debug", "compare", "React", "Mosaic", "Container", "TreeRoot", "useContainer", "sortedItems", "useSortedItems", "TreeComponent", "Root", "classNames", "SortableContext", "direction", "map", "item", "index", "TreeItemComponent", "key", "collapsible", "defaultOpen", "SortableTile", "path", "position", "forwardRef", "draggableStyle", "draggableProps", "operation", "active", "isOver", "isDragging", "className", "forwardedRef", "div", "ref", "style", "mx", "dropRing", "Card", "Header", "DragHandle", "Title", "title", "label", "children", "TreeBranch", "overItem", "useMosaic", "Body", "child", "Branch", "Path", "create"]
7
7
  }
@@ -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":23759,"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":88468},"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":5556},"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":36665}}}
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":8761,"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/useSortedItems.ts":{"bytes":1476,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts","kind":"import-statement","original":"./useContainer"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts":{"bytes":806,"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"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useSortedItems.ts","kind":"import-statement","original":"./useSortedItems"}],"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":23759,"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":12625,"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":86749},"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","useSortedItems"],"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":1913},"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/useSortedItems.ts":{"bytesInOutput":136},"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":5556},"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":2967},"packages/ui/react-ui-mosaic/src/views/Tree/index.ts":{"bytesInOutput":0}},"bytes":35512}}}
@@ -1,4 +1,5 @@
1
1
  export * from './useContainer';
2
2
  export * from './useItemsWithPreview';
3
3
  export * from './useMosaic';
4
+ export * from './useSortedItems';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -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,aAAa,CAAC;AAC5B,cAAc,kBAAkB,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, strategy, }: {
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;UAKxB,MAAM;;;SAgFb,CAAC"}
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;;SAiD5F,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type MosaicDataItem } from '../types';
2
+ /**
3
+ * Returns a sorted collection of items if a compare function is provided.
4
+ */
5
+ export declare const useSortedItems: <T extends MosaicDataItem>(items: T[]) => T[];
6
+ //# sourceMappingURL=useSortedItems.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSortedItems.d.ts","sourceRoot":"","sources":["../../../../../src/mosaic/hooks/useSortedItems.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,cAAc,+CAG1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-mosaic",
3
- "version": "0.3.3-main.052ad73",
3
+ "version": "0.3.3-main.1817c8a",
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",
@@ -26,13 +26,13 @@
26
26
  "lodash.defaultsdeep": "^4.6.1",
27
27
  "lodash.pick": "^4.4.0",
28
28
  "react-resize-detector": "^7.1.2",
29
- "@dxos/debug": "0.3.3-main.052ad73",
30
- "@dxos/invariant": "0.3.3-main.052ad73",
31
- "@dxos/keys": "0.3.3-main.052ad73",
32
- "@dxos/react-ui": "0.3.3-main.052ad73",
33
- "@dxos/react-ui-theme": "0.3.3-main.052ad73",
34
- "@dxos/react-ui-types": "0.3.3-main.052ad73",
35
- "@dxos/util": "0.3.3-main.052ad73"
29
+ "@dxos/debug": "0.3.3-main.1817c8a",
30
+ "@dxos/invariant": "0.3.3-main.1817c8a",
31
+ "@dxos/keys": "0.3.3-main.1817c8a",
32
+ "@dxos/react-ui": "0.3.3-main.1817c8a",
33
+ "@dxos/react-ui-theme": "0.3.3-main.1817c8a",
34
+ "@dxos/react-ui-types": "0.3.3-main.1817c8a",
35
+ "@dxos/util": "0.3.3-main.1817c8a"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@faker-js/faker": "^8.0.2",
@@ -48,10 +48,10 @@
48
48
  "react-dom": "^18.2.0",
49
49
  "vite": "^4.3.9",
50
50
  "vite-plugin-turbosnap": "^1.0.2",
51
- "@dxos/app-graph": "0.3.3-main.052ad73",
52
- "@dxos/echo-schema": "0.3.3-main.052ad73",
53
- "@dxos/gem-core": "0.3.3-main.052ad73",
54
- "@dxos/react-client": "0.3.3-main.052ad73"
51
+ "@dxos/app-graph": "0.3.3-main.1817c8a",
52
+ "@dxos/echo-schema": "0.3.3-main.1817c8a",
53
+ "@dxos/gem-core": "0.3.3-main.1817c8a",
54
+ "@dxos/react-client": "0.3.3-main.1817c8a"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@phosphor-icons/react": "^2.0.5",
@@ -5,3 +5,4 @@
5
5
  export * from './useContainer';
6
6
  export * from './useItemsWithPreview';
7
7
  export * from './useMosaic';
8
+ export * from './useSortedItems';
@@ -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 =
@@ -32,7 +24,7 @@ export const useItemsWithPreview = <T extends MosaicDataItem>({
32
24
  const [lastOverParent, setLastOverParent] = useState(overParent);
33
25
 
34
26
  useEffect(() => {
35
- if (!activeItem || !overItem) {
27
+ if (operation === 'reject' || operation === 'rearrange' || !activeItem || !overItem) {
36
28
  setLastOverParent(undefined);
37
29
  setItemsWithPreview(items);
38
30
  return;
@@ -42,59 +34,31 @@ export const useItemsWithPreview = <T extends MosaicDataItem>({
42
34
  return;
43
35
  }
44
36
 
37
+ setLastOverParent(overParent);
38
+
45
39
  const activeIsChild = Path.hasChild(path, activeItem.path);
46
40
  const overIsChild = Path.hasChild(path, overItem.path);
47
41
  const overSelf = overItem.path === path;
48
42
 
49
- switch (strategy) {
50
- case 'layout-stable':
51
- setLastOverParent(overParent);
52
- if (activeIsChild && !overIsChild && operation !== 'rearrange') {
53
- // Change the dnd-id of the origin item that may move to a foreign destination
54
- setItemsWithPreview((sortedItems) =>
55
- sortedItems.map((item) => {
56
- if (item.id === activeItem.item.id) {
57
- return { ...item, id: `${item.id}--origin` };
58
- } else {
59
- return item;
60
- }
61
- }),
62
- );
63
- } else {
64
- // Reset items.
65
- setItemsWithPreview(items);
66
- }
67
- break;
68
- case 'default':
69
- default:
70
- if (operation === 'reject' || operation === 'rearrange') {
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;
43
+ if (!activeIsChild && overIsChild) {
44
+ // Insert item into sortable.
45
+ setItemsWithPreview((items) => {
46
+ const position = overItem.position as number;
47
+ return [...items.slice(0, position), activeItem.item as T, ...items.slice(position)];
48
+ });
49
+ } else if (!activeIsChild && overSelf) {
50
+ // Append item to end of sortable.
51
+ setItemsWithPreview((items) => [...items, activeItem.item as T]);
52
+ } else if (activeIsChild && !overIsChild) {
53
+ // Remove item being dragged out.
54
+ setItemsWithPreview((items) => items.filter((item) => item.id !== activeItem.item.id));
55
+ } else {
56
+ // Reset items.
57
+ setItemsWithPreview(items);
94
58
  }
95
59
  }, [operation, activeItem, overItem, overParent, lastOverParent, path, items]);
96
60
 
97
61
  // In order to avoid render glitching, rather than waiting for the effect to run,
98
62
  // immediately return the new items after dropping an item into a new path.
99
- return strategy !== 'layout-stable' && items.length === itemsWithPreview.length ? items : itemsWithPreview;
63
+ return items.length === itemsWithPreview.length ? items : itemsWithPreview;
100
64
  };
@@ -0,0 +1,14 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { useContainer } from './useContainer';
6
+ import { type MosaicDataItem } from '../types';
7
+
8
+ /**
9
+ * Returns a sorted collection of items if a compare function is provided.
10
+ */
11
+ export const useSortedItems = <T extends MosaicDataItem>(items: T[]): T[] => {
12
+ const { compare } = useContainer();
13
+ return compare ? [...items].sort(compare) : items;
14
+ };
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React, { forwardRef, useMemo } from 'react';
5
+ import React, { forwardRef } from 'react';
6
6
 
7
7
  import { Card, Tree as TreeComponent, TreeItem as TreeItemComponent } from '@dxos/react-ui';
8
8
  import { dropRing, mx } from '@dxos/react-ui-theme';
@@ -15,7 +15,7 @@ import {
15
15
  useContainer,
16
16
  useMosaic,
17
17
  Path,
18
- useItemsWithPreview,
18
+ useSortedItems,
19
19
  type MosaicCompareDataItem,
20
20
  } from '../../mosaic';
21
21
 
@@ -55,16 +55,13 @@ export const Tree = ({ id, Component = TreeItem, onOver, onDrop, items = [], deb
55
55
  };
56
56
 
57
57
  const TreeRoot = ({ items }: { items: TreeData[] }) => {
58
- const { id, Component, compare } = useContainer();
59
- const sortedItems = useMemo(() => {
60
- return compare ? [...items].sort(compare) : items;
61
- }, [items, compare]);
62
- const itemsWithPreview = useItemsWithPreview({ items: sortedItems, path: id, strategy: 'layout-stable' });
58
+ const { id, Component } = useContainer();
59
+ const sortedItems = useSortedItems(items);
63
60
 
64
61
  return (
65
62
  <TreeComponent.Root classNames='flex flex-col'>
66
- <Mosaic.SortableContext id={id} items={itemsWithPreview} direction='vertical'>
67
- {itemsWithPreview.map((item, index) => (
63
+ <Mosaic.SortableContext id={id} items={sortedItems} direction='vertical'>
64
+ {sortedItems.map((item, index) => (
68
65
  <TreeItemComponent.Root key={item.id} collapsible defaultOpen>
69
66
  <Mosaic.SortableTile item={item} path={id} position={index} Component={Component!} />
70
67
  </TreeItemComponent.Root>
@@ -104,16 +101,13 @@ const TreeItem: MosaicTileComponent<TreeData> = forwardRef(
104
101
 
105
102
  const TreeBranch = ({ path, items }: { path: string; items: TreeData[] }) => {
106
103
  const { operation, overItem } = useMosaic();
107
- const { Component, compare } = useContainer();
108
- const sortedItems = useMemo(() => {
109
- return compare ? [...items].sort(compare) : items;
110
- }, [items, compare]);
111
- const itemsWithPreview = useItemsWithPreview({ items: sortedItems, path, strategy: 'layout-stable' });
104
+ const { Component } = useContainer();
105
+ const sortedItems = useSortedItems(items);
112
106
 
113
107
  return (
114
108
  <TreeItemComponent.Body className='pis-4'>
115
- <Mosaic.SortableContext id={path} items={itemsWithPreview} direction='vertical'>
116
- {itemsWithPreview.map((child, index) => (
109
+ <Mosaic.SortableContext id={path} items={sortedItems} direction='vertical'>
110
+ {sortedItems.map((child, index) => (
117
111
  <TreeComponent.Branch key={child.id}>
118
112
  <TreeItemComponent.Root collapsible defaultOpen>
119
113
  <Mosaic.SortableTile