@dxos/react-ui-mosaic 0.3.10-main.3645708 → 0.3.10-main.396fa89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +11 -16
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/mosaic/Container.d.ts +3 -1
- package/dist/types/src/mosaic/Container.d.ts.map +1 -1
- package/dist/types/src/mosaic/Mosaic.d.ts +2 -2
- package/dist/types/src/mosaic/Mosaic.d.ts.map +1 -1
- package/dist/types/src/mosaic/Root.d.ts.map +1 -1
- package/dist/types/src/mosaic/Tile.d.ts +2 -1
- package/dist/types/src/mosaic/Tile.d.ts.map +1 -1
- package/dist/types/src/views/Demo/Echo.stories.d.ts +1 -5
- package/dist/types/src/views/Demo/Echo.stories.d.ts.map +1 -1
- package/dist/types/src/views/Grid/Grid.d.ts +2 -2
- package/dist/types/src/views/Grid/Grid.d.ts.map +1 -1
- package/dist/types/src/views/Grid/Grid.stories.d.ts +1 -1
- package/dist/types/src/views/Grid/testing.d.ts +1 -1
- package/dist/types/src/views/Grid/testing.d.ts.map +1 -1
- package/dist/types/src/views/Kanban/Echo.stories.d.ts +1 -6
- package/dist/types/src/views/Kanban/Echo.stories.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/mosaic/Container.tsx +5 -3
- package/src/mosaic/Mosaic.ts +2 -2
- package/src/mosaic/Root.tsx +9 -11
- package/src/mosaic/Tile.tsx +3 -4
- package/src/testing/Cards.tsx +4 -4
- package/src/views/Demo/Demo.stories.tsx +4 -4
- package/src/views/Demo/Echo.stories.tsx +10 -10
- package/src/views/Grid/Grid.tsx +6 -3
- package/src/views/Grid/testing.tsx +2 -2
- package/src/views/Kanban/Echo.stories.tsx +28 -26
- package/src/views/Kanban/Kanban.tsx +1 -1
- package/src/views/Stack/Stack.tsx +1 -1
- package/src/views/Tree/Tree.tsx +2 -2
|
@@ -176,6 +176,7 @@ var MosaicRoot = ({ Component: Component2 = DefaultComponent, debug, children })
|
|
|
176
176
|
const handleDragOver = (event) => {
|
|
177
177
|
const overItem2 = pick(event.over?.data.current, "path", "type", "item", "position");
|
|
178
178
|
if (overItem2?.item?.id === activeItem?.item.id) {
|
|
179
|
+
setOverItem(overItem2);
|
|
179
180
|
return;
|
|
180
181
|
}
|
|
181
182
|
const activeContainer = activeItem && containers[Path.first(activeItem.path)];
|
|
@@ -185,22 +186,16 @@ var MosaicRoot = ({ Component: Component2 = DefaultComponent, debug, children })
|
|
|
185
186
|
setOverItem(void 0);
|
|
186
187
|
return;
|
|
187
188
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
setOperation(onOver({
|
|
201
|
-
active: activeItem,
|
|
202
|
-
over: overItem2
|
|
203
|
-
}));
|
|
189
|
+
let operation2 = "reject";
|
|
190
|
+
if (Path.parent(activeItem.path) === Path.parent(overItem2.path)) {
|
|
191
|
+
operation2 = "rearrange";
|
|
192
|
+
} else if (overContainer.onOver) {
|
|
193
|
+
operation2 = overContainer.onOver({
|
|
194
|
+
active: activeItem,
|
|
195
|
+
over: overItem2
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
setOperation(operation2);
|
|
204
199
|
setOverItem(overItem2);
|
|
205
200
|
};
|
|
206
201
|
const handleDragCancel = (event) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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/props.ts", "../../../src/mosaic/util/styles.ts", "../../../src/mosaic/hooks/useItemsWithOrigin.ts", "../../../src/mosaic/DragOverlay.tsx", "../../../src/mosaic/SortableContext.tsx", "../../../src/mosaic/Tile.tsx", "../../../src/mosaic/Mosaic.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { MosaicContainerContext, type MosaicContainerContextType } from '../Container';\nimport { type MosaicDataItem } from '../types';\n\nexport const useContainer = <\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n>(): MosaicContainerContextType<TData, TPosition> => useContext(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\n// TODO(wittjosiah): Factor out.\ntype WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\nexport const DEFAULT_TRANSITION = 200;\nexport const DEFAULT_TYPE = 'unknown';\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 const MosaicOperations = ['transfer', 'copy', 'rearrange', 'reject'] as const;\nexport type MosaicOperation = (typeof MosaicOperations)[number];\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 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 * Default type of tiles.\n */\n type?: string;\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\nexport type MosaicContainerContextType<\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n> = WithRequiredProperty<Omit<MosaicContainerProps<TData, TPosition>, 'children'>, 'type'>;\n\nexport const MosaicContainerContext = createContext<MosaicContainerContextType<any>>({\n id: 'never',\n type: DEFAULT_TYPE,\n});\n\n/**\n * Root Container that manages the layout of tiles.\n */\nexport const MosaicContainer = ({\n children,\n id,\n debug,\n type = DEFAULT_TYPE,\n Component,\n transitionDuration = DEFAULT_TRANSITION,\n modifier,\n getOverlayProps,\n getOverlayStyle,\n onOver,\n onDrop,\n}: MosaicContainerProps) => {\n const mosaic = useMosaic();\n const container = {\n id,\n debug,\n type,\n Component,\n transitionDuration,\n modifier,\n getOverlayProps,\n getOverlayStyle,\n onOver,\n onDrop,\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 (!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 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 }, [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', 'type', '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', 'type', '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 type: activeItem?.type,\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 type: overItem?.type,\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-card';\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\nimport { MosaicOperations } from '../Container';\nimport { type MosaicTileComponentProps, type MosaicTileProps } from '../Tile';\n\nexport const isTileProps = (props: Record<string, unknown>): props is MosaicTileProps =>\n typeof props.path === 'string' && typeof props.item === 'object' && props.item\n ? 'id' in props.item && typeof props.item.id === 'string'\n : false;\n\nexport const isTileComponentProps = (props: Record<string, unknown>): props is MosaicTileComponentProps =>\n isTileProps(props) && typeof props.operation === 'string' && MosaicOperations.includes(props.operation);\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 { useMosaic } from './useMosaic';\nimport { type MosaicDataItem } from '../types';\nimport { Path } from '../util';\n\n// TODO(thure): Harmonize this hook signature with its sibling’s.\nexport const useItemsWithOrigin = <T extends MosaicDataItem>(path: string, items: T[]) => {\n const { operation, activeItem, overItem } = useMosaic();\n\n if (!activeItem || !overItem) {\n return items;\n }\n\n const activeIsChild = Path.hasChild(path, activeItem.path);\n const overIsChild = Path.hasChild(path, overItem.path);\n\n if (activeIsChild && !overIsChild && operation !== 'rearrange') {\n // Change the dnd-id of the origin item that may move to a foreign destination\n return items.map((item) => {\n if (item.id === activeItem.item.id) {\n return { ...item, id: `${item.id}--origin` };\n } else {\n return item;\n }\n });\n } else {\n // Reset items.\n return items;\n }\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 { 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 <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 type={activeItem.type}\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 )}\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 { DEFAULT_TYPE, type MosaicOperation, type 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\n// TODO(wittjosiah): `id` should be `path` and `data` should be a `MosaicDataItem`.\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 type?: string;\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 onNavigate?: () => void;\n onAction?: (action: MosaicTileAction) => void;\n };\n\nexport type MosaicTileComponentProps<TData extends MosaicDataItem = MosaicDataItem> = Omit<\n MosaicTileProps<TData>,\n 'Component' | 'operation'\n> & { operation: MosaicOperation };\n\n/**\n * Mosaic Tile component.\n */\nexport type MosaicTileComponent<\n TData extends MosaicDataItem = MosaicDataItem,\n TElement extends HTMLElement = HTMLDivElement,\n> = ForwardRefExoticComponent<RefAttributes<TElement> & MosaicTileComponentProps<TData>>;\n\n/**\n * Basic draggable mosaic tile.\n */\nexport const DraggableTile = ({\n path: parentPath,\n type = DEFAULT_TYPE,\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, type, item, position } satisfies MosaicDraggedItem,\n });\n\n return (\n <Component\n ref={setNodeRef}\n item={item}\n path={path}\n type={type}\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 type = DEFAULT_TYPE,\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, type, item, position } satisfies MosaicDraggedItem,\n });\n\n return (\n <Component\n ref={setNodeRef}\n item={item}\n path={path}\n type={type}\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 type = DEFAULT_TYPE,\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, type, 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 type={type}\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} 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\n// TODO(burdon): Remove.\nexport type MosaicDebugProps = DebugProps;\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,kBAAkB;;;ACC3B,OAAOC,SACLC,eACAC,iBAIK;AAWA,IAAMC,qBAAqB;AAC3B,IAAMC,eAAe;AAgBrB,IAAMC,mBAAmB;EAAC;EAAY;EAAQ;EAAa;;AAwE3D,IAAMC,yBAAyBC,8BAA+C;EACnFC,IAAI;EACJC,MAAML;AACR,CAAA;AAKO,IAAMM,kBAAkB,CAAC,EAC9BC,UACAH,IACAI,OACAH,OAAOL,cACPS,WAAAA,YACAC,qBAAqBX,oBACrBY,UACAC,iBACAC,iBACAC,QACAC,OAAM,MACe;AACrB,QAAMC,SAASC,UAAAA;AACf,QAAMC,YAAY;IAChBd;IACAI;IACAH;IACAI,WAAAA;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;EACF;AAEAI,YAAU,MAAA;AACRH,WAAOI,aAAaF,UAAUd,IAAIc,SAAAA;AAClC,WAAO,MAAA;IAGP;EACF,GAAGG,OAAOC,OAAOJ,SAAAA,CAAAA;AAEjB,SAAO,sBAAA,cAAChB,uBAAuBqB,UAAQ;IAACC,OAAON;KAAYX,QAAAA;AAC7D;;;ADlJO,IAAMkB,e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,GAAGC;IAAU;IAC7C,GAAGR;;AAGV;;;AC/KO,IAAMsC,SAAS;EACpBC,MAAMC;EACNC,WAAWC;EACXC,aAAaC;EACbC,iBAAiBC;EACjBC;EACAC;EACAC;;EAGAC;;EAEAC;AACF;",
|
|
6
|
-
"names": ["useContext", "React", "createContext", "useEffect", "DEFAULT_TRANSITION", "DEFAULT_TYPE", "MosaicOperations", "MosaicContainerContext", "createContext", "id", "type", "MosaicContainer", "children", "debug", "Component", "transitionDuration", "modifier", "getOverlayProps", "getOverlayStyle", "onOver", "onDrop", "mosaic", "useMosaic", "container", "useEffect", "setContainer", "Object", "values", "Provider", "value", "useContainer", "useContext", "MosaicContainerContext", "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", "isTileProps", "props", "path", "item", "id", "isTileComponentProps", "operation", "MosaicOperations", "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", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { MosaicContainerContext, type MosaicContainerContextType } from '../Container';\nimport { type MosaicDataItem } from '../types';\n\nexport const useContainer = <\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n>(): MosaicContainerContextType<TData, TPosition> => useContext(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 ThemedClassName } from '@dxos/react-ui';\n\nimport { type MosaicTileComponent } from './Tile';\nimport { useMosaic } from './hooks';\nimport { type MosaicDataItem, type MosaicDraggedItem } from './types';\n\n// TODO(wittjosiah): Factor out.\ntype WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\nexport const DEFAULT_TRANSITION = 200;\nexport const DEFAULT_TYPE = 'unknown';\n\nexport type MosaicTileOverlayProps = {\n grow?: boolean;\n debug?: boolean;\n itemContext?: Record<string, unknown>;\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 const MosaicOperations = ['transfer', 'copy', 'rearrange', 'reject'] as const;\nexport type MosaicOperation = (typeof MosaicOperations)[number];\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 MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = ThemedClassName<\n Omit<HTMLAttributes<HTMLElement>, 'onDrop'>\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 * Default type of tiles.\n */\n type?: string;\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\nexport type MosaicContainerContextType<\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n> = WithRequiredProperty<Omit<MosaicContainerProps<TData, TPosition>, 'children'>, 'type'>;\n\nexport const MosaicContainerContext = createContext<MosaicContainerContextType<any>>({\n id: 'never',\n type: DEFAULT_TYPE,\n});\n\n/**\n * Root Container that manages the layout of tiles.\n */\nexport const MosaicContainer = ({\n children,\n id,\n debug,\n type = DEFAULT_TYPE,\n Component,\n transitionDuration = DEFAULT_TRANSITION,\n modifier,\n getOverlayProps,\n getOverlayStyle,\n onOver,\n onDrop,\n}: MosaicContainerProps) => {\n const mosaic = useMosaic();\n const container = {\n id,\n debug,\n type,\n Component,\n transitionDuration,\n modifier,\n getOverlayProps,\n getOverlayStyle,\n onOver,\n onDrop,\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 (!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 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 }, [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 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', 'type', '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', 'type', '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 setOverItem(overItem);\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 let operation: MosaicOperation = 'reject' as const;\n if (Path.parent(activeItem.path) === Path.parent(overItem.path)) {\n operation = 'rearrange' as const;\n } else if (overContainer.onOver) {\n operation = overContainer.onOver({ active: activeItem, over: overItem });\n }\n\n setOperation(operation);\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 type: activeItem?.type,\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 type: overItem?.type,\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-card';\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\nimport { MosaicOperations } from '../Container';\nimport { type MosaicTileComponentProps, type MosaicTileProps } from '../Tile';\n\nexport const isTileProps = (props: Record<string, unknown>): props is MosaicTileProps =>\n typeof props.path === 'string' && typeof props.item === 'object' && props.item\n ? 'id' in props.item && typeof props.item.id === 'string'\n : false;\n\nexport const isTileComponentProps = (props: Record<string, unknown>): props is MosaicTileComponentProps =>\n isTileProps(props) && typeof props.operation === 'string' && MosaicOperations.includes(props.operation);\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 { useMosaic } from './useMosaic';\nimport { type MosaicDataItem } from '../types';\nimport { Path } from '../util';\n\n// TODO(thure): Harmonize this hook signature with its sibling’s.\nexport const useItemsWithOrigin = <T extends MosaicDataItem>(path: string, items: T[]) => {\n const { operation, activeItem, overItem } = useMosaic();\n\n if (!activeItem || !overItem) {\n return items;\n }\n\n const activeIsChild = Path.hasChild(path, activeItem.path);\n const overIsChild = Path.hasChild(path, overItem.path);\n\n if (activeIsChild && !overIsChild && operation !== 'rearrange') {\n // Change the dnd-id of the origin item that may move to a foreign destination\n return items.map((item) => {\n if (item.id === activeItem.item.id) {\n return { ...item, id: `${item.id}--origin` };\n } else {\n return item;\n }\n });\n } else {\n // Reset items.\n return items;\n }\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 { 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 <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 type={activeItem.type}\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 )}\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 ThemedClassName } from '@dxos/react-ui';\n\nimport { DEFAULT_TYPE, type MosaicOperation, type 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\n// TODO(wittjosiah): `id` should be `path` and `data` should be a `MosaicDataItem`.\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> = ThemedClassName<{}> &\n MosaicTileOverlayProps & {\n path: string;\n item: TData;\n Component?: MosaicTileComponent<TData, any>;\n position?: TPosition;\n type?: string;\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 onNavigate?: () => void;\n onAction?: (action: MosaicTileAction) => void;\n };\n\nexport type MosaicTileComponentProps<TData extends MosaicDataItem = MosaicDataItem> = Omit<\n MosaicTileProps<TData>,\n 'Component' | 'operation'\n> & { operation: MosaicOperation };\n\n/**\n * Mosaic Tile component.\n */\nexport type MosaicTileComponent<\n TData extends MosaicDataItem = MosaicDataItem,\n TElement extends HTMLElement = HTMLDivElement,\n> = ForwardRefExoticComponent<RefAttributes<TElement> & MosaicTileComponentProps<TData>>;\n\n/**\n * Basic draggable mosaic tile.\n */\nexport const DraggableTile = ({\n path: parentPath,\n type = DEFAULT_TYPE,\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, type, item, position } satisfies MosaicDraggedItem,\n });\n\n return (\n <Component\n ref={setNodeRef}\n item={item}\n path={path}\n type={type}\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 type = DEFAULT_TYPE,\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, type, item, position } satisfies MosaicDraggedItem,\n });\n\n return (\n <Component\n ref={setNodeRef}\n item={item}\n path={path}\n type={type}\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 type = DEFAULT_TYPE,\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, type, 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 type={type}\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, type RefAttributes } 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} 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<RefAttributes<HTMLDivElement> & 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\n// TODO(burdon): Remove.\nexport type MosaicDebugProps = DebugProps;\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,kBAAkB;;;ACC3B,OAAOC,SACLC,eACAC,iBAIK;AAaA,IAAMC,qBAAqB;AAC3B,IAAMC,eAAe;AAiBrB,IAAMC,mBAAmB;EAAC;EAAY;EAAQ;EAAa;;AAuE3D,IAAMC,yBAAyBC,8BAA+C;EACnFC,IAAI;EACJC,MAAML;AACR,CAAA;AAKO,IAAMM,kBAAkB,CAAC,EAC9BC,UACAH,IACAI,OACAH,OAAOL,cACPS,WAAAA,YACAC,qBAAqBX,oBACrBY,UACAC,iBACAC,iBACAC,QACAC,OAAM,MACe;AACrB,QAAMC,SAASC,UAAAA;AACf,QAAMC,YAAY;IAChBd;IACAI;IACAH;IACAI,WAAAA;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;EACF;AAEAI,YAAU,MAAA;AACRH,WAAOI,aAAaF,UAAUd,IAAIc,SAAAA;AAClC,WAAO,MAAA;IAGP;EACF,GAAGG,OAAOC,OA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aN,kBAAAA,YAA8B;MACnE,GAAGvB;IACL;IACAe,gBAAgB;MAAE,GAAGP;MAAY,GAAGC;IAAU;IAC7C,GAAGR;;AAGV;;;AC9KO,IAAMsC,SAAS;EACpBC,MAAMC;EACNC,WAAWC;EACXC,aAAaC;EACbC,iBAAiBC;EACjBC;EACAC;EACAC;;EAGAC;;EAEAC;AACF;",
|
|
6
|
+
"names": ["useContext", "React", "createContext", "useEffect", "DEFAULT_TRANSITION", "DEFAULT_TYPE", "MosaicOperations", "MosaicContainerContext", "createContext", "id", "type", "MosaicContainer", "children", "debug", "Component", "transitionDuration", "modifier", "getOverlayProps", "getOverlayStyle", "onOver", "onDrop", "mosaic", "useMosaic", "container", "useEffect", "setContainer", "Object", "values", "Provider", "value", "useContainer", "useContext", "MosaicContainerContext", "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", "isTileProps", "props", "path", "item", "id", "isTileComponentProps", "operation", "MosaicOperations", "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", "parent", "onOver", "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", "type", "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", "useItemsWithOrigin", "path", "items", "operation", "activeItem", "overItem", "useMosaic", "activeIsChild", "Path", "hasChild", "overIsChild", "map", "item", "id", "DragOverlay", "React", "Component", "useEffect", "useRef", "useState", "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", "OverlayErrorBoundary", "fallback", "getOverlayProps", "item", "active", "type", "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", "type", "DEFAULT_TYPE", "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"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx":{"bytes":9235,"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":1270,"imports":[{"path":"react","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/props.ts":{"bytes":2128,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"../Container"}],"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":714,"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/props.ts","kind":"import-statement","original":"./props"},{"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":2916,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-card","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":26302,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"./Container"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx","kind":"import-statement","original":"./Debug"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts":{"bytes":1191,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx","kind":"import-statement","original":"../Root"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts":{"bytes":9142,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithOrigin.ts":{"bytes":3646,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts":{"bytes":814,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts","kind":"import-statement","original":"./useContainer"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts","kind":"import-statement","original":"./useItemsWithPreview"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithOrigin.ts","kind":"import-statement","original":"./useItemsWithOrigin"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/types.ts":{"bytes":1040,"imports":[],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx":{"bytes":14606,"imports":[{"path":"@dnd-kit/core","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/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":17528,"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/Container.tsx","kind":"import-statement","original":"./Container"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts":{"bytes":5852,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"./Container"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx","kind":"import-statement","original":"./Debug"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx","kind":"import-statement","original":"./DragOverlay"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx","kind":"import-statement","original":"./Root"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/SortableContext.tsx","kind":"import-statement","original":"./SortableContext"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Tile.tsx","kind":"import-statement","original":"./Tile"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/index.ts":{"bytes":714,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts","kind":"import-statement","original":"./Mosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/index.ts":{"bytes":465,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"./mosaic"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-mosaic/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":56944},"packages/ui/react-ui-mosaic/dist/lib/browser/index.mjs":{"imports":[{"path":"react","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-card","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":"@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}],"exports":["Mosaic","Path","getTransformCSS","isTileComponentProps","isTileProps","swapItems","useContainer","useItemsWithOrigin","useItemsWithPreview","useMosaic"],"entryPoint":"packages/ui/react-ui-mosaic/src/index.ts","inputs":{"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts":{"bytesInOutput":97},"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx":{"bytesInOutput":958},"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts":{"bytesInOutput":2023},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts":{"bytesInOutput":183},"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx":{"bytesInOutput":5601},"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx":{"bytesInOutput":442},"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx":{"bytesInOutput":645},"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/props.ts":{"bytesInOutput":318},"packages/ui/react-ui-mosaic/src/mosaic/util/styles.ts":{"bytesInOutput":180},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithOrigin.ts":{"bytesInOutput":594},"packages/ui/react-ui-mosaic/src/mosaic/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx":{"bytesInOutput":3324},"packages/ui/react-ui-mosaic/src/mosaic/SortableContext.tsx":{"bytesInOutput":1191},"packages/ui/react-ui-mosaic/src/mosaic/Tile.tsx":{"bytesInOutput":3297},"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts":{"bytesInOutput":383},"packages/ui/react-ui-mosaic/src/index.ts":{"bytesInOutput":0}},"bytes":21693}}}
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx":{"bytes":9379,"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":1270,"imports":[{"path":"react","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/props.ts":{"bytes":2128,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"../Container"}],"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":714,"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/props.ts","kind":"import-statement","original":"./props"},{"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":2916,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-card","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":26052,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx","kind":"import-statement","original":"./Container"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx","kind":"import-statement","original":"./Debug"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx","kind":"import-statement","original":"./DefaultComponent"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts":{"bytes":1191,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx","kind":"import-statement","original":"../Root"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts":{"bytes":9142,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithOrigin.ts":{"bytes":3646,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts":{"bytes":814,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts","kind":"import-statement","original":"./useContainer"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts","kind":"import-statement","original":"./useItemsWithPreview"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithOrigin.ts","kind":"import-statement","original":"./useItemsWithOrigin"},{"path":"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts","kind":"import-statement","original":"./useMosaic"}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/types.ts":{"bytes":1040,"imports":[],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx":{"bytes":14606,"imports":[{"path":"@dnd-kit/core","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/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":17552,"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/Container.tsx","kind":"import-statement","original":"./Container"},{"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":5924,"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/index.ts":{"bytes":465,"imports":[{"path":"packages/ui/react-ui-mosaic/src/mosaic/index.ts","kind":"import-statement","original":"./mosaic"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-mosaic/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":57033},"packages/ui/react-ui-mosaic/dist/lib/browser/index.mjs":{"imports":[{"path":"react","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-card","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":"@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}],"exports":["Mosaic","Path","getTransformCSS","isTileComponentProps","isTileProps","swapItems","useContainer","useItemsWithOrigin","useItemsWithPreview","useMosaic"],"entryPoint":"packages/ui/react-ui-mosaic/src/index.ts","inputs":{"packages/ui/react-ui-mosaic/src/mosaic/hooks/useContainer.ts":{"bytesInOutput":97},"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx":{"bytesInOutput":958},"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts":{"bytesInOutput":2023},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts":{"bytesInOutput":183},"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx":{"bytesInOutput":5547},"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx":{"bytesInOutput":442},"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx":{"bytesInOutput":645},"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/props.ts":{"bytesInOutput":318},"packages/ui/react-ui-mosaic/src/mosaic/util/styles.ts":{"bytesInOutput":180},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithOrigin.ts":{"bytesInOutput":594},"packages/ui/react-ui-mosaic/src/mosaic/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx":{"bytesInOutput":3324},"packages/ui/react-ui-mosaic/src/mosaic/SortableContext.tsx":{"bytesInOutput":1191},"packages/ui/react-ui-mosaic/src/mosaic/Tile.tsx":{"bytesInOutput":3297},"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts":{"bytesInOutput":383},"packages/ui/react-ui-mosaic/src/index.ts":{"bytesInOutput":0}},"bytes":21639}}}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Modifier } from '@dnd-kit/core';
|
|
2
2
|
import React, { type CSSProperties, type HTMLAttributes, type PropsWithChildren } from 'react';
|
|
3
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
4
|
import { type MosaicTileComponent } from './Tile';
|
|
4
5
|
import { type MosaicDataItem, type MosaicDraggedItem } from './types';
|
|
5
6
|
type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
|
|
@@ -10,6 +11,7 @@ export declare const DEFAULT_TYPE = "unknown";
|
|
|
10
11
|
export type MosaicTileOverlayProps = {
|
|
11
12
|
grow?: boolean;
|
|
12
13
|
debug?: boolean;
|
|
14
|
+
itemContext?: Record<string, unknown>;
|
|
13
15
|
};
|
|
14
16
|
/**
|
|
15
17
|
* Possible operations when dropping a tile.
|
|
@@ -28,7 +30,7 @@ export type MosaicMoveEvent<TPosition = unknown> = {
|
|
|
28
30
|
export type MosaicDropEvent<TPosition = unknown> = MosaicMoveEvent<TPosition> & {
|
|
29
31
|
operation: MosaicOperation;
|
|
30
32
|
};
|
|
31
|
-
export type MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> =
|
|
33
|
+
export type MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = ThemedClassName<Omit<HTMLAttributes<HTMLElement>, 'onDrop'>> & PropsWithChildren<{
|
|
32
34
|
id: string;
|
|
33
35
|
debug?: boolean;
|
|
34
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Container.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,EAGZ,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGtE,KAAK,oBA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AAC,KAAK,EAAE,eAAe,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;CACtD,CAAC,CAAC;AAEL,MAAM,MAAM,0BAA0B,CACpC,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,SAAS,GAAG,OAAO,IACjB,oBAAoB,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;AAE3F,eAAO,MAAM,sBAAsB,yDAGjC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,8HAYzB,oBAAoB,gBAwBtB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FC } from 'react';
|
|
1
|
+
import { type FC, type RefAttributes } from 'react';
|
|
2
2
|
import { type MosaicContainerProps as NaturalMosaicContainerProps, type MosaicMoveEvent as NaturalMosaicMoveEvent, type MosaicDropEvent as NaturalMosaicDropEvent, type MosaicOperation as NaturalMosaicOperation } from './Container';
|
|
3
3
|
import { type DebugProps } from './Debug';
|
|
4
4
|
import { type MosaicDragOverlayProps } from './DragOverlay';
|
|
@@ -12,7 +12,7 @@ export declare const Mosaic: {
|
|
|
12
12
|
DragOverlay: FC<MosaicOverlayProps>;
|
|
13
13
|
SortableContext: FC<MosaicSortableProps>;
|
|
14
14
|
DraggableTile: FC<MosaicTileProps<any, any>>;
|
|
15
|
-
DroppableTile: FC<MosaicTileProps<any, any>>;
|
|
15
|
+
DroppableTile: FC<RefAttributes<HTMLDivElement> & MosaicTileProps<any, any>>;
|
|
16
16
|
SortableTile: FC<MosaicTileProps<any, number>>;
|
|
17
17
|
DefaultComponent: MosaicTileComponent<MosaicDataItem, HTMLDivElement>;
|
|
18
18
|
Debug: FC<MosaicDebugProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mosaic.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Mosaic.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAA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AAC;AAEF,MAAM,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAErD,MAAM,MAAM,oBAAoB,CAC9B,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,SAAS,GAAG,OAAO,IACjB,2BAA2B,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAE7D,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAEvD,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,SAAS,GAAG,OAAO,IACjB,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAE7C,MAAM,MAAM,mBAAmB,CAC7B,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,QAAQ,SAAS,WAAW,GAAG,cAAc,IAC3C,0BAA0B,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAEhD,MAAM,MAAM,eAAe,CAAC,SAAS,GAAG,OAAO,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAAC;AACrF,MAAM,MAAM,eAAe,CAAC,SAAS,GAAG,OAAO,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAAC;AACrF,MAAM,MAAM,eAAe,GAAG,sBAAsB,CAAC;AACrD,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAGvD,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Root.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,EAAiB,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,MAAM,OAAO,CAAC;AAGxF,OAAO,EAAsB,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Root.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,EAAiB,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,MAAM,OAAO,CAAC;AAGxF,OAAO,EAAsB,KAAK,oBAAoB,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAGlG,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAKjD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC;IAClE,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,oBAAoB,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;IAC1E,UAAU,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC1C,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACxC,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,aAAa,8CAA0D,CAAC;AAErF,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAwK1C,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type DraggableAttributes } from '@dnd-kit/core';
|
|
2
2
|
import type { CSSProperties, ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from 'react';
|
|
3
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
4
|
import { type MosaicOperation, type MosaicTileOverlayProps } from './Container';
|
|
4
5
|
import type { MosaicDataItem } from './types';
|
|
5
6
|
export type MosaicActiveType = 'overlay' | 'rearrange' | 'origin' | 'destination';
|
|
@@ -11,7 +12,7 @@ export type MosaicTileAction = {
|
|
|
11
12
|
/**
|
|
12
13
|
* Props passed to mosaic tile.
|
|
13
14
|
*/
|
|
14
|
-
export type MosaicTileProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> =
|
|
15
|
+
export type MosaicTileProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = ThemedClassName<{}> & MosaicTileOverlayProps & {
|
|
15
16
|
path: string;
|
|
16
17
|
item: TData;
|
|
17
18
|
Component?: MosaicTileComponent<TData, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tile.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Tile.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAA8B,MAAM,eAAe,CAAC;AAGrF,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAErG,OAAO,EAAgB,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG9F,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,SAAS,CAAC;AAGjE,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,CAAC;AAGlF,MAAM,MAAM,gBAAgB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,cAAc,GAAG,cAAc,EAAE,SAAS,GAAG,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"Tile.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Tile.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAA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U,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEJ,MAAM,MAAM,wBAAwB,CAAC,KAAK,SAAS,cAAc,GAAG,cAAc,IAAI,IAAI,CACxF,eAAe,CAAC,KAAK,CAAC,EACtB,WAAW,GAAG,WAAW,CAC1B,GAAG;IAAE,SAAS,EAAE,eAAe,CAAA;CAAE,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAC7B,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,QAAQ,SAAS,WAAW,GAAG,cAAc,IAC3C,yBAAyB,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;AAEzF;;GAEG;AACH,eAAO,MAAM,aAAa,oFAQvB,gBAAgB,GAAG,CAAC,gBA0BtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,oEAOvB,gBAAgB,GAAG,CAAC,gBAuBtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,uGAQtB,gBAAgB,GAAG,EAAE,MAAM,CAAC,gBAuD9B,CAAC"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type PublicKey } from '@dxos/react-client';
|
|
3
1
|
declare const _default: {
|
|
4
2
|
title: string;
|
|
5
|
-
render:
|
|
6
|
-
spaceKey: PublicKey;
|
|
7
|
-
}>;
|
|
3
|
+
render: () => JSX.Element;
|
|
8
4
|
decorators: (import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0fc72a6d").R> | import("@storybook/react").Decorator)[];
|
|
9
5
|
};
|
|
10
6
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Echo.stories.d.ts","sourceRoot":"","sources":["../../../../../src/views/Demo/Echo.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Echo.stories.d.ts","sourceRoot":"","sources":["../../../../../src/views/Demo/Echo.stories.tsx"],"names":[],"mappings":";;;;;AA2CA,wBA4BE;AAIF,eAAO,MAAM,IAAI,IAAK,CAAC"}
|
|
@@ -12,7 +12,7 @@ type GridOptions = {
|
|
|
12
12
|
export type GridLayout = {
|
|
13
13
|
[id: string]: Position;
|
|
14
14
|
};
|
|
15
|
-
export type GridProps<TData extends MosaicDataItem = MosaicDataItem> = MosaicContainerProps<TData, Position> & ControlledSelection & {
|
|
15
|
+
export type GridProps<TData extends MosaicDataItem = MosaicDataItem> = Omit<MosaicContainerProps<TData, Position>, 'onSelect'> & ControlledSelection & {
|
|
16
16
|
items?: TData[];
|
|
17
17
|
layout?: GridLayout;
|
|
18
18
|
options?: Partial<GridOptions>;
|
|
@@ -25,6 +25,6 @@ export type GridProps<TData extends MosaicDataItem = MosaicDataItem> = MosaicCon
|
|
|
25
25
|
/**
|
|
26
26
|
* Grid content.
|
|
27
27
|
*/
|
|
28
|
-
export declare const Grid: ({ id, items, layout, options: opts, margin, square, debug, selected: controlledSelected, Component,
|
|
28
|
+
export declare const Grid: ({ id, items, layout, options: opts, margin, square, debug, selected: controlledSelected, Component, classNames, onDrop, onOver, onSelect, onCreate, onAction, }: GridProps) => JSX.Element;
|
|
29
29
|
export {};
|
|
30
30
|
//# sourceMappingURL=Grid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../../../src/views/Grid/Grid.tsx"],"names":[],"mappings":"AAaA,OAAO,EAML,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,IAAI,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAItB,MAAM,cAAc,CAAC;AAOtB,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,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IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEJ;;GAEG;AAEH,eAAO,MAAM,IAAI,oKAgBd,SAAS,gBAoHX,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import '@dxosTheme';
|
|
3
3
|
declare const _default: {
|
|
4
|
-
component: ({ id, items, layout, options: opts, margin, square, debug, selected: controlledSelected, Component,
|
|
4
|
+
component: ({ id, items, layout, options: opts, margin, square, debug, selected: controlledSelected, Component, classNames, onDrop, onOver, onSelect, onCreate, onAction, }: import("./Grid").GridProps<import("../../mosaic").MosaicDataItem>) => JSX.Element;
|
|
5
5
|
render: () => JSX.Element;
|
|
6
6
|
decorators: (import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0fc72a6d").R> | import("@storybook/react").Decorator)[];
|
|
7
7
|
parameters: {
|
|
@@ -6,5 +6,5 @@ export type DemoGridProps = GridProps & {
|
|
|
6
6
|
types?: string[];
|
|
7
7
|
debug?: boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare const DemoGrid: ({ id, options, Component, initialItems, initialLayout, types, debug,
|
|
9
|
+
export declare const DemoGrid: ({ id, options, Component, initialItems, initialLayout, types, debug, classNames, }: DemoGridProps) => JSX.Element;
|
|
10
10
|
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../../src/views/Grid/testing.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAQ,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE/D,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,cAAc,CAAC;AAGzE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACtC,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;IAChC,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../../src/views/Grid/testing.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAQ,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE/D,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,cAAc,CAAC;AAGzE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACtC,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;IAChC,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,QAAQ,uFASlB,aAAa,gBA8Df,CAAC"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type PublicKey } from '@dxos/react-client';
|
|
3
2
|
declare const _default: {
|
|
4
3
|
title: string;
|
|
5
4
|
component: ({ id, columns, Component: TileComponent, debug, onDrop, }: import("./Kanban").KanbanProps<import("../../mosaic").MosaicDataItem>) => JSX.Element;
|
|
6
|
-
render: (
|
|
7
|
-
basePath: string;
|
|
8
|
-
spaceKey: PublicKey;
|
|
9
|
-
debug: boolean;
|
|
10
|
-
}) => JSX.Element;
|
|
5
|
+
render: () => JSX.Element;
|
|
11
6
|
decorators: (import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0fc72a6d").R> | import("@storybook/react").Decorator)[];
|
|
12
7
|
parameters: {
|
|
13
8
|
layout: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Echo.stories.d.ts","sourceRoot":"","sources":["../../../../../src/views/Kanban/Echo.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Echo.stories.d.ts","sourceRoot":"","sources":["../../../../../src/views/Kanban/Echo.stories.tsx"],"names":[],"mappings":";;;;;;;;;;AAoCA,wBAgCE;AAEF,eAAO,MAAM,IAAI,IAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-mosaic",
|
|
3
|
-
"version": "0.3.10-main.
|
|
3
|
+
"version": "0.3.10-main.396fa89",
|
|
4
4
|
"description": "An intermediate interface for drag-and-drop interactions.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"lodash.defaultsdeep": "^4.6.1",
|
|
26
26
|
"lodash.pick": "^4.4.0",
|
|
27
27
|
"react-resize-detector": "^7.1.2",
|
|
28
|
-
"@dxos/debug": "0.3.10-main.
|
|
29
|
-
"@dxos/invariant": "0.3.10-main.
|
|
30
|
-
"@dxos/keys": "0.3.10-main.
|
|
31
|
-
"@dxos/react-ui": "0.3.10-main.
|
|
32
|
-
"@dxos/react-ui-card": "0.3.10-main.
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/react-ui-
|
|
35
|
-
"@dxos/
|
|
28
|
+
"@dxos/debug": "0.3.10-main.396fa89",
|
|
29
|
+
"@dxos/invariant": "0.3.10-main.396fa89",
|
|
30
|
+
"@dxos/keys": "0.3.10-main.396fa89",
|
|
31
|
+
"@dxos/react-ui": "0.3.10-main.396fa89",
|
|
32
|
+
"@dxos/react-ui-card": "0.3.10-main.396fa89",
|
|
33
|
+
"@dxos/react-ui-theme": "0.3.10-main.396fa89",
|
|
34
|
+
"@dxos/react-ui-types": "0.3.10-main.396fa89",
|
|
35
|
+
"@dxos/util": "0.3.10-main.396fa89"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@faker-js/faker": "^8.0.2",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"react-dom": "^18.2.0",
|
|
48
48
|
"vite": "^4.3.9",
|
|
49
49
|
"vite-plugin-turbosnap": "^1.0.2",
|
|
50
|
-
"@dxos/app-graph": "0.3.10-main.
|
|
51
|
-
"@dxos/echo-schema": "0.3.10-main.
|
|
52
|
-
"@dxos/gem-core": "0.3.10-main.
|
|
53
|
-
"@dxos/react-client": "0.3.10-main.
|
|
54
|
-
"@dxos/storybook-utils": "0.3.10-main.
|
|
50
|
+
"@dxos/app-graph": "0.3.10-main.396fa89",
|
|
51
|
+
"@dxos/echo-schema": "0.3.10-main.396fa89",
|
|
52
|
+
"@dxos/gem-core": "0.3.10-main.396fa89",
|
|
53
|
+
"@dxos/react-client": "0.3.10-main.396fa89",
|
|
54
|
+
"@dxos/storybook-utils": "0.3.10-main.396fa89"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@phosphor-icons/react": "^2.0.5",
|
package/src/mosaic/Container.tsx
CHANGED
|
@@ -11,6 +11,8 @@ import React, {
|
|
|
11
11
|
type PropsWithChildren,
|
|
12
12
|
} from 'react';
|
|
13
13
|
|
|
14
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
15
|
+
|
|
14
16
|
import { type MosaicTileComponent } from './Tile';
|
|
15
17
|
import { useMosaic } from './hooks';
|
|
16
18
|
import { type MosaicDataItem, type MosaicDraggedItem } from './types';
|
|
@@ -26,6 +28,7 @@ export const DEFAULT_TYPE = 'unknown';
|
|
|
26
28
|
export type MosaicTileOverlayProps = {
|
|
27
29
|
grow?: boolean;
|
|
28
30
|
debug?: boolean;
|
|
31
|
+
itemContext?: Record<string, unknown>;
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
/**
|
|
@@ -49,9 +52,8 @@ export type MosaicDropEvent<TPosition = unknown> = MosaicMoveEvent<TPosition> &
|
|
|
49
52
|
operation: MosaicOperation;
|
|
50
53
|
};
|
|
51
54
|
|
|
52
|
-
export type MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> =
|
|
53
|
-
HTMLAttributes<
|
|
54
|
-
'className'
|
|
55
|
+
export type MosaicContainerProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = ThemedClassName<
|
|
56
|
+
Omit<HTMLAttributes<HTMLElement>, 'onDrop'>
|
|
55
57
|
> &
|
|
56
58
|
PropsWithChildren<{
|
|
57
59
|
id: string;
|
package/src/mosaic/Mosaic.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type FC } from 'react';
|
|
5
|
+
import { type FC, type RefAttributes } from 'react';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
MosaicContainer,
|
|
@@ -46,7 +46,7 @@ export const Mosaic = {
|
|
|
46
46
|
DragOverlay: FC<MosaicOverlayProps>;
|
|
47
47
|
SortableContext: FC<MosaicSortableProps>;
|
|
48
48
|
DraggableTile: FC<MosaicTileProps<any, any>>;
|
|
49
|
-
DroppableTile: FC<MosaicTileProps<any, any>>;
|
|
49
|
+
DroppableTile: FC<RefAttributes<HTMLDivElement> & MosaicTileProps<any, any>>;
|
|
50
50
|
SortableTile: FC<MosaicTileProps<any, number>>;
|
|
51
51
|
|
|
52
52
|
DefaultComponent: MosaicTileComponent;
|
package/src/mosaic/Root.tsx
CHANGED
|
@@ -24,7 +24,7 @@ import pick from 'lodash.pick';
|
|
|
24
24
|
import React, { createContext, type FC, type PropsWithChildren, useState } from 'react';
|
|
25
25
|
import { createPortal } from 'react-dom';
|
|
26
26
|
|
|
27
|
-
import { DEFAULT_TRANSITION, type MosaicContainerProps, type
|
|
27
|
+
import { DEFAULT_TRANSITION, type MosaicContainerProps, type MosaicOperation } from './Container';
|
|
28
28
|
import { Debug } from './Debug';
|
|
29
29
|
import { DefaultComponent } from './DefaultComponent';
|
|
30
30
|
import { type MosaicTileComponent } from './Tile';
|
|
@@ -144,6 +144,7 @@ export const MosaicRoot: FC<MosaicRootProps> = ({ Component = DefaultComponent,
|
|
|
144
144
|
// If the over item is the same as the active item, do nothing.
|
|
145
145
|
// This happens when moving between containers where a placeholder of itself is rendered where it will be dropped.
|
|
146
146
|
if (overItem?.item?.id === activeItem?.item.id) {
|
|
147
|
+
setOverItem(overItem);
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
149
150
|
|
|
@@ -155,17 +156,14 @@ export const MosaicRoot: FC<MosaicRootProps> = ({ Component = DefaultComponent,
|
|
|
155
156
|
return;
|
|
156
157
|
}
|
|
157
158
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return 'reject';
|
|
165
|
-
}
|
|
166
|
-
};
|
|
159
|
+
let operation: MosaicOperation = 'reject' as const;
|
|
160
|
+
if (Path.parent(activeItem.path) === Path.parent(overItem.path)) {
|
|
161
|
+
operation = 'rearrange' as const;
|
|
162
|
+
} else if (overContainer.onOver) {
|
|
163
|
+
operation = overContainer.onOver({ active: activeItem, over: overItem });
|
|
164
|
+
}
|
|
167
165
|
|
|
168
|
-
setOperation(
|
|
166
|
+
setOperation(operation);
|
|
169
167
|
setOverItem(overItem);
|
|
170
168
|
};
|
|
171
169
|
|
package/src/mosaic/Tile.tsx
CHANGED
|
@@ -7,6 +7,8 @@ import { defaultAnimateLayoutChanges, useSortable } from '@dnd-kit/sortable';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import type { CSSProperties, ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from 'react';
|
|
9
9
|
|
|
10
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
|
+
|
|
10
12
|
import { DEFAULT_TYPE, type MosaicOperation, type MosaicTileOverlayProps } from './Container';
|
|
11
13
|
import { DefaultComponent } from './DefaultComponent';
|
|
12
14
|
import { useContainer, useMosaic } from './hooks';
|
|
@@ -21,10 +23,7 @@ export type MosaicTileAction = { id: string; action: string; data?: any };
|
|
|
21
23
|
/**
|
|
22
24
|
* Props passed to mosaic tile.
|
|
23
25
|
*/
|
|
24
|
-
export type MosaicTileProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> =
|
|
25
|
-
HTMLAttributes<HTMLDivElement>,
|
|
26
|
-
'className'
|
|
27
|
-
> &
|
|
26
|
+
export type MosaicTileProps<TData extends MosaicDataItem = MosaicDataItem, TPosition = unknown> = ThemedClassName<{}> &
|
|
28
27
|
MosaicTileOverlayProps & {
|
|
29
28
|
path: string;
|
|
30
29
|
item: TData;
|
package/src/testing/Cards.tsx
CHANGED
|
@@ -16,7 +16,7 @@ export type SimpleCardProps = { id: string; title?: string; body?: string; image
|
|
|
16
16
|
|
|
17
17
|
export const SimpleCard: MosaicTileComponent<SimpleCardProps> = forwardRef(
|
|
18
18
|
(
|
|
19
|
-
{
|
|
19
|
+
{ classNames, active, draggableStyle, draggableProps, item: { id, title }, path, position, grow, debug, onSelect },
|
|
20
20
|
forwardRef,
|
|
21
21
|
) => {
|
|
22
22
|
const full = !title;
|
|
@@ -25,10 +25,10 @@ export const SimpleCard: MosaicTileComponent<SimpleCardProps> = forwardRef(
|
|
|
25
25
|
<Card.Root
|
|
26
26
|
noPadding={full}
|
|
27
27
|
classNames={mx(
|
|
28
|
-
className,
|
|
29
28
|
'w-full snap-center',
|
|
30
29
|
(active === 'origin' || active === 'rearrange') && 'opacity-0',
|
|
31
30
|
active === 'destination' && 'opacity-20',
|
|
31
|
+
classNames,
|
|
32
32
|
)}
|
|
33
33
|
grow={grow}
|
|
34
34
|
>
|
|
@@ -52,7 +52,7 @@ SimpleCard.displayName = 'SimpleCard';
|
|
|
52
52
|
|
|
53
53
|
export const ComplexCard: MosaicTileComponent<SimpleCardProps> = forwardRef(
|
|
54
54
|
(
|
|
55
|
-
{
|
|
55
|
+
{ classNames, isDragging, draggableStyle, draggableProps, item: { id, title, body, image }, grow, debug, onSelect },
|
|
56
56
|
forwardRef,
|
|
57
57
|
) => {
|
|
58
58
|
const full = !title;
|
|
@@ -60,7 +60,7 @@ export const ComplexCard: MosaicTileComponent<SimpleCardProps> = forwardRef(
|
|
|
60
60
|
<div role='none' ref={forwardRef} className='flex w-full' style={draggableStyle}>
|
|
61
61
|
<Card.Root
|
|
62
62
|
noPadding={full}
|
|
63
|
-
classNames={mx(
|
|
63
|
+
classNames={mx('w-full snap-center', isDragging && 'opacity-20', classNames)}
|
|
64
64
|
grow={grow}
|
|
65
65
|
>
|
|
66
66
|
<Card.Header floating={full} onDoubleClick={() => onSelect?.()}>
|
|
@@ -34,10 +34,10 @@ export const Default = () => (
|
|
|
34
34
|
<Mosaic.DragOverlay />
|
|
35
35
|
<div className='flex grow overflow-hidden'>
|
|
36
36
|
<div className='flex shrink-0 w-[280px] overflow-hidden'>
|
|
37
|
-
<DemoStack id='stack-1' Component={SimpleCard} types={types} debug={debug}
|
|
37
|
+
<DemoStack id='stack-1' Component={SimpleCard} types={types} debug={debug} classNames='p-2' />
|
|
38
38
|
</div>
|
|
39
39
|
<div className='flex grow overflow-hidden bg-neutral-900'>
|
|
40
|
-
<DemoGrid id='grid-1' Component={ComplexCard} types={types} debug={debug}
|
|
40
|
+
<DemoGrid id='grid-1' Component={ComplexCard} types={types} debug={debug} classNames='p-4' />
|
|
41
41
|
</div>
|
|
42
42
|
<div className='flex shrink-0 w-[280px] overflow-hidden bg-neutral-900'>
|
|
43
43
|
<DemoStack id='stack-2' Component={ComplexCard} types={types} debug={debug} />
|
|
@@ -54,7 +54,7 @@ export const Tree = () => (
|
|
|
54
54
|
<DemoTree id='tree-1' types={types} debug={debug} />
|
|
55
55
|
</div>
|
|
56
56
|
<div className='flex grow overflow-hidden'>
|
|
57
|
-
<DemoGrid id='grid-1' Component={ComplexCard} types={types} debug={debug}
|
|
57
|
+
<DemoGrid id='grid-1' Component={ComplexCard} types={types} debug={debug} classNames='p-4 bg-neutral-900' />
|
|
58
58
|
</div>
|
|
59
59
|
<div className='flex shrink-0 w-[280px] overflow-hidden bg-neutral-900'>
|
|
60
60
|
<DemoStack id='stack-2' Component={ComplexCard} types={types} debug={debug} />
|
|
@@ -71,7 +71,7 @@ export const Kanban = () => (
|
|
|
71
71
|
<DemoTree id='tree-1' types={types} debug={debug} />
|
|
72
72
|
</div>
|
|
73
73
|
<div className='flex grow overflow-hidden'>
|
|
74
|
-
<DemoKanban id='kanban-1' Component={SimpleCard} debug={debug}
|
|
74
|
+
<DemoKanban id='kanban-1' Component={SimpleCard} debug={debug} classNames='p-4' />
|
|
75
75
|
</div>
|
|
76
76
|
<div className='flex shrink-0 w-[280px] overflow-hidden bg-neutral-900 pl-2'>
|
|
77
77
|
<DemoStack id='stack-1' Component={ComplexCard} types={types} debug={debug} />
|
|
@@ -7,7 +7,7 @@ import React, { type FC } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { type PublicKey } from '@dxos/react-client';
|
|
9
9
|
import { Expando } from '@dxos/react-client/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { ClientRepeater } from '@dxos/react-client/testing';
|
|
11
11
|
import { withTheme } from '@dxos/storybook-utils';
|
|
12
12
|
|
|
13
13
|
import { Mosaic } from '../../mosaic';
|
|
@@ -43,12 +43,10 @@ const Story: FC<{ spaceKey: PublicKey }> = ({ spaceKey }) => {
|
|
|
43
43
|
|
|
44
44
|
export default {
|
|
45
45
|
title: 'Views/Demo',
|
|
46
|
-
render:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
ClientSpaceDecorator({
|
|
51
|
-
onCreateSpace: async (space) => {
|
|
46
|
+
render: () => (
|
|
47
|
+
<ClientRepeater
|
|
48
|
+
Component={Story}
|
|
49
|
+
onCreateSpace={async (space) => {
|
|
52
50
|
const factory = generator.factories.project;
|
|
53
51
|
const objects = [
|
|
54
52
|
factory.schema,
|
|
@@ -66,9 +64,11 @@ export default {
|
|
|
66
64
|
|
|
67
65
|
// TODO(burdon): Batch API.
|
|
68
66
|
objects.forEach((object) => space.db.add(object));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
}}
|
|
68
|
+
createSpace
|
|
69
|
+
/>
|
|
70
|
+
),
|
|
71
|
+
decorators: [withTheme, FullscreenDecorator()],
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
// TODO(wittjosiah): This currently has a bug where empty over events are fired when dragging from tree onto kanban.
|
package/src/views/Grid/Grid.tsx
CHANGED
|
@@ -62,7 +62,10 @@ const defaultGridOptions: GridOptions = {
|
|
|
62
62
|
|
|
63
63
|
export type GridLayout = { [id: string]: Position };
|
|
64
64
|
|
|
65
|
-
export type GridProps<TData extends MosaicDataItem = MosaicDataItem> =
|
|
65
|
+
export type GridProps<TData extends MosaicDataItem = MosaicDataItem> = Omit<
|
|
66
|
+
MosaicContainerProps<TData, Position>,
|
|
67
|
+
'onSelect'
|
|
68
|
+
> &
|
|
66
69
|
ControlledSelection & {
|
|
67
70
|
items?: TData[];
|
|
68
71
|
layout?: GridLayout;
|
|
@@ -88,7 +91,7 @@ export const Grid = ({
|
|
|
88
91
|
debug,
|
|
89
92
|
selected: controlledSelected,
|
|
90
93
|
Component = Mosaic.DefaultComponent,
|
|
91
|
-
|
|
94
|
+
classNames,
|
|
92
95
|
onDrop,
|
|
93
96
|
onOver,
|
|
94
97
|
onSelect,
|
|
@@ -159,7 +162,7 @@ export const Grid = ({
|
|
|
159
162
|
onOver,
|
|
160
163
|
}}
|
|
161
164
|
>
|
|
162
|
-
<div className={mx('flex grow overflow-auto',
|
|
165
|
+
<div className={mx('flex grow overflow-auto', classNames)}>
|
|
163
166
|
{/* TODO(burdon): Tailwind classes aren't currently processed by labs. */}
|
|
164
167
|
<div ref={containerRef} className={mx('grow overflow-auto snap-x md:snap-none snap-mandatory')}>
|
|
165
168
|
<div className='group block relative' style={{ ...bounds, margin: marginSize }}>
|
|
@@ -25,7 +25,7 @@ export const DemoGrid = ({
|
|
|
25
25
|
initialLayout,
|
|
26
26
|
types,
|
|
27
27
|
debug,
|
|
28
|
-
|
|
28
|
+
classNames,
|
|
29
29
|
}: DemoGridProps) => {
|
|
30
30
|
const [selected, setSelected] = useState<string>();
|
|
31
31
|
const [items, setItems] = useState<MosaicDataItem[]>(
|
|
@@ -80,7 +80,7 @@ export const DemoGrid = ({
|
|
|
80
80
|
layout={layout}
|
|
81
81
|
options={options}
|
|
82
82
|
Component={Component}
|
|
83
|
-
|
|
83
|
+
classNames={classNames}
|
|
84
84
|
debug={debug}
|
|
85
85
|
selected={selected}
|
|
86
86
|
onSelect={setSelected}
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type PublicKey } from '@dxos/react-client';
|
|
8
8
|
import { Expando } from '@dxos/react-client/echo';
|
|
9
|
-
import {
|
|
9
|
+
import { ClientRepeater } from '@dxos/react-client/testing';
|
|
10
10
|
import { withTheme } from '@dxos/storybook-utils';
|
|
11
11
|
|
|
12
12
|
import { Kanban } from './Kanban';
|
|
@@ -16,31 +16,30 @@ import { FullscreenDecorator, TestObjectGenerator, range } from '../../testing';
|
|
|
16
16
|
|
|
17
17
|
const generator = new TestObjectGenerator();
|
|
18
18
|
|
|
19
|
+
const Story = ({
|
|
20
|
+
// TODO(wittjosiah): Can't use id because of ClientSpaceDecorator.
|
|
21
|
+
basePath = 'projects',
|
|
22
|
+
spaceKey,
|
|
23
|
+
debug,
|
|
24
|
+
}: {
|
|
25
|
+
basePath: string;
|
|
26
|
+
spaceKey: PublicKey;
|
|
27
|
+
debug: boolean;
|
|
28
|
+
}) => {
|
|
29
|
+
return (
|
|
30
|
+
<Mosaic.Root debug={debug}>
|
|
31
|
+
<Mosaic.DragOverlay />
|
|
32
|
+
<EchoKanban id={basePath} spaceKey={spaceKey} generator={generator} debug={debug} />
|
|
33
|
+
</Mosaic.Root>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
19
37
|
export default {
|
|
20
38
|
title: 'Views/Kanban',
|
|
21
39
|
component: Kanban,
|
|
22
|
-
render: (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
spaceKey,
|
|
26
|
-
debug,
|
|
27
|
-
}: {
|
|
28
|
-
basePath: string;
|
|
29
|
-
spaceKey: PublicKey;
|
|
30
|
-
debug: boolean;
|
|
31
|
-
}) => {
|
|
32
|
-
return (
|
|
33
|
-
<Mosaic.Root debug={debug}>
|
|
34
|
-
<Mosaic.DragOverlay />
|
|
35
|
-
<EchoKanban id={basePath} spaceKey={spaceKey} generator={generator} debug={debug} />
|
|
36
|
-
</Mosaic.Root>
|
|
37
|
-
);
|
|
38
|
-
},
|
|
39
|
-
decorators: [
|
|
40
|
-
withTheme,
|
|
41
|
-
FullscreenDecorator(),
|
|
42
|
-
ClientSpaceDecorator({
|
|
43
|
-
onCreateSpace: async (space) => {
|
|
40
|
+
render: () => (
|
|
41
|
+
<ClientRepeater
|
|
42
|
+
onCreateSpace={async (space) => {
|
|
44
43
|
const factory = generator.factories.project;
|
|
45
44
|
const objects = [
|
|
46
45
|
factory.schema,
|
|
@@ -58,9 +57,12 @@ export default {
|
|
|
58
57
|
|
|
59
58
|
// TODO(burdon): Batch API.
|
|
60
59
|
objects.forEach((object) => space.db.add(object));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
}}
|
|
61
|
+
Component={Story}
|
|
62
|
+
createSpace
|
|
63
|
+
/>
|
|
64
|
+
),
|
|
65
|
+
decorators: [withTheme, FullscreenDecorator()],
|
|
64
66
|
parameters: {
|
|
65
67
|
layout: 'fullscreen',
|
|
66
68
|
},
|
package/src/views/Tree/Tree.tsx
CHANGED
|
@@ -73,17 +73,17 @@ const TreeRoot = ({ items }: { items: TreeData[] }) => {
|
|
|
73
73
|
* Pure component that is used by the mosaic overlay.
|
|
74
74
|
*/
|
|
75
75
|
const TreeItem: MosaicTileComponent<TreeData> = forwardRef(
|
|
76
|
-
({ path, draggableStyle, draggableProps, item, operation, active, isOver, isDragging,
|
|
76
|
+
({ path, draggableStyle, draggableProps, item, operation, active, isOver, isDragging, classNames }, forwardedRef) => {
|
|
77
77
|
return (
|
|
78
78
|
<div
|
|
79
79
|
ref={forwardedRef}
|
|
80
80
|
style={draggableStyle}
|
|
81
81
|
className={mx(
|
|
82
82
|
'flex flex-col rounded',
|
|
83
|
-
className,
|
|
84
83
|
(active === 'rearrange' || active === 'origin') && 'opacity-0',
|
|
85
84
|
active === 'destination' && 'opacity-20',
|
|
86
85
|
isOver && dropRing,
|
|
86
|
+
classNames,
|
|
87
87
|
)}
|
|
88
88
|
>
|
|
89
89
|
<Card.Header>
|