@dxos/react-ui-mosaic 0.7.1 → 0.7.2-staging.6d26b2a

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/mosaic/hooks/useContainer.ts", "../../../src/mosaic/Container.tsx", "../../../src/mosaic/hooks/useItemsWithPreview.ts", "../../../src/mosaic/hooks/useMosaic.ts", "../../../src/mosaic/Root.tsx", "../../../src/mosaic/Debug.tsx", "../../../src/mosaic/DefaultComponent.tsx", "../../../src/mosaic/util/data.ts", "../../../src/mosaic/util/path.ts", "../../../src/mosaic/util/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, type DragEndEvent, type DragMoveEvent } from '@dnd-kit/core';\nimport React, {\n createContext,\n useEffect,\n type CSSProperties,\n type HTMLAttributes,\n type PropsWithChildren,\n forwardRef,\n} from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\n\nimport { type MosaicDropAnimation } from './Root';\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';\nexport const DEFAULT_COMPONENT: MosaicTileComponent = forwardRef(() => <>missing component</>);\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 * - `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\n// TODO(wittjosiah): Unify w/ Position.\nexport type DefaultMoveDetails = Pick<DragMoveEvent, 'delta'>;\n\nexport type MosaicMoveEvent<TPosition = unknown, TMoveDetails = DefaultMoveDetails> = {\n active: MosaicDraggedItem<TPosition>;\n over: MosaicDraggedItem<TPosition>;\n details?: TMoveDetails;\n};\n\nexport type MosaicDropEvent<TPosition = unknown, TMoveDetails = DefaultMoveDetails> = MosaicMoveEvent<\n TPosition,\n TMoveDetails\n> & {\n operation: MosaicOperation;\n};\n\nexport type MosaicContainerProps<\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n TMoveDetails = DefaultMoveDetails,\n TTileElement extends HTMLElement = HTMLDivElement,\n TTileProps = {},\n> = ThemedClassName<Omit<HTMLAttributes<TTileElement>, 'onDrop' | 'onSelect'>> &\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, TTileElement, TTileProps>;\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, TMoveDetails>) => MosaicOperation;\n\n /**\n * Called when a tile is dropped on the container.\n */\n onDrop?: (event: MosaicDropEvent<TPosition, TMoveDetails>) => MosaicDropAnimation;\n\n /**\n * Always called when drag ends, no matter what, unlike the other handlers which are only called when relevant.\n */\n onDragEnd?: (event: DragEndEvent) => void;\n\n /**\n * Called on `dragmove` when over the container.\n */\n onMove?: (event: MosaicMoveEvent<TPosition, TMoveDetails>) => {\n operation: MosaicOperation;\n details?: TMoveDetails;\n };\n }>;\n\nexport type MosaicContainerContextType<\n TData extends MosaicDataItem = MosaicDataItem,\n TPosition = unknown,\n TMoveDetails = DefaultMoveDetails,\n> = WithRequiredProperty<Omit<MosaicContainerProps<TData, TPosition, TMoveDetails>, 'children'>, 'type' | 'Component'>;\n\nexport const MosaicContainerContext = createContext<MosaicContainerContextType<any>>({\n id: 'never',\n type: DEFAULT_TYPE,\n Component: DEFAULT_COMPONENT,\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 = DEFAULT_COMPONENT,\n transitionDuration = DEFAULT_TRANSITION,\n modifier,\n getOverlayProps,\n getOverlayStyle,\n onOver,\n onDrop,\n onMove,\n onDragEnd,\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 onMove,\n onDragEnd,\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 && !!overItem.path && 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 type DropAnimation,\n MouseSensor,\n pointerWithin,\n rectIntersection,\n TouchSensor,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport { sortableKeyboardCoordinates } from '@dnd-kit/sortable';\nimport React, { createContext, type FC, type PropsWithChildren, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { pick } from '@dxos/util';\n\nimport {\n DEFAULT_TRANSITION,\n type DefaultMoveDetails,\n type MosaicContainerProps,\n type MosaicOperation,\n} 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 MosaicDropAnimation = DropAnimation | null | undefined | void;\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 moveDetails?: Record<string, unknown>;\n dropAnimation?: MosaicDropAnimation;\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\nconst defaultDropAnimation: MosaicDropAnimation = { duration: 0 };\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 const [moveDetails, setMoveDetails] = useState<(DefaultMoveDetails & Record<string, any>) | undefined>();\n const [dropAnimation, setDropAnimation] = useState<MosaicDropAnimation>(defaultDropAnimation);\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 const nextOverItem = pick(event.over?.data.current as MosaicDraggedItem, ['path', 'type', 'item', 'position']);\n const nextOverContainer =\n nextOverItem && nextOverItem?.path ? containers[Path.first(nextOverItem.path)] : undefined;\n if (!event.over || !nextOverItem || !nextOverContainer) {\n setOperation('reject');\n setOverItem(undefined);\n return;\n }\n\n if (overItem !== nextOverItem) {\n setOverItem(nextOverItem);\n }\n\n if (activeItem && nextOverItem && nextOverContainer?.onMove) {\n const { operation: nextOperation, details: nextDetails } = nextOverContainer.onMove({\n active: activeItem,\n over: nextOverItem,\n details: { delta: event.delta },\n });\n setOperation(nextOperation);\n if (\n // always set falsy symbols\n !nextDetails ||\n // always set if details become truthy\n (!moveDetails && nextDetails) ||\n // only update if details change\n Object.entries(nextDetails).find(([key, value]) => !(key in moveDetails!) || moveDetails![key] !== value)\n ) {\n setMoveDetails(nextDetails);\n }\n }\n };\n\n const handleDragOver = (event: DragOverEvent) => {\n const overItem = pick(event.over?.data.current as MosaicDraggedItem, ['path', 'type', 'item', 'position']);\n const overContainer = overItem && overItem?.path ? containers[Path.first(overItem.path)] : undefined;\n // TODO(wittjosiah): This is over-prescriptive.\n if (overContainer?.onMove) {\n // The over container will have handled this in its move handler.\n return;\n }\n\n const activeContainer = activeItem && containers[Path.first(activeItem.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 (overContainer.onOver) {\n operation = overContainer.onOver({\n active: activeItem,\n over: overItem,\n details: moveDetails,\n });\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 (operation !== 'reject' && activeItem && overItem) {\n let nextDropAnimation: MosaicDropAnimation = defaultDropAnimation;\n const activeContainer = containers[Path.first(activeItem.path)];\n if (activeContainer) {\n nextDropAnimation = activeContainer.onDrop?.({\n operation,\n active: activeItem,\n over: overItem,\n details: moveDetails,\n });\n\n if (overContainer && overContainer !== activeContainer) {\n nextDropAnimation = overContainer.onDrop?.({\n operation,\n active: activeItem,\n over: overItem,\n details: moveDetails,\n });\n }\n }\n setDropAnimation(nextDropAnimation);\n }\n\n Object.values(containers).forEach((container) => container?.onDragEnd?.(event));\n\n setTimeout(() => {\n setOperation('reject');\n setOverItem(undefined);\n setActiveItem(undefined);\n }, overContainer?.transitionDuration ?? DEFAULT_TRANSITION);\n };\n\n return (\n <MosaicContext.Provider\n value={{\n containers,\n setContainer: handleSetContainer,\n activeItem,\n overItem,\n operation,\n moveDetails,\n dropAnimation,\n }}\n >\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, type DropAnimation } from '@dnd-kit/core';\nimport React, {\n Component,\n type ComponentProps,\n type PropsWithChildren,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { log } from '@dxos/log';\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 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, dropAnimation } = 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 // Only attempt to resolve a foreign overlay tile if the operation is not rejected, since droppables *should* reject\n // items they don’t recognize and therefore wouldn’t be able to render a tile for. See dxos/dxos#5082.\n if (activeItem && operation !== 'reject') {\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\n adjustScale={false}\n {...overlayProps}\n dropAnimation={dropAnimation as DropAnimation}\n style={{ ...container?.getOverlayStyle?.() }}\n >\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?: ReactNode }>;\n\nclass OverlayErrorBoundary extends Component<OverlayErrorBoundaryProps> {\n private readonly fallback: 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 log.catch(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 overItem.path &&\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 { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport React, { forwardRef } 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 onDelete?: (force?: boolean) => void;\n onNavigate?: () => void;\n onAddBefore?: () => void;\n onAddAfter?: () => 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 TProps = {},\n> = ForwardRefExoticComponent<RefAttributes<TElement> & MosaicTileComponentProps<TData> & TProps>;\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 = forwardRef<HTMLDivElement | null, MosaicTileProps<any>>(\n ({ path: parentPath, type = DEFAULT_TYPE, item, Component = DefaultComponent, position, ...props }, forwardedRef) => {\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 const ref = useComposedRefs<HTMLDivElement | null>(setNodeRef, forwardedRef);\n\n return (\n <Component\n item={item}\n path={path}\n type={type}\n position={position}\n operation={operation}\n isOver={isOver}\n {...props}\n ref={ref}\n />\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 activeItem.path &&\n overItem.path &&\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 && activeItem.path && 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 type MosaicTileComponentProps as NaturalMosaicTileComponentProps,\n} from './Tile';\nimport { type MosaicDataItem } from './types';\n\nexport { type DefaultMoveDetails } from './Container';\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 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 TMoveDetails = Record<string, unknown>,\n TTileElement extends HTMLElement = HTMLDivElement,\n TTileProps = {},\n> = NaturalMosaicContainerProps<TData, TPosition, TMoveDetails, TTileElement, TTileProps>;\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 TProps = {},\n> = NaturalMosaicTileComponent<TData, TElement, TProps>;\n\nexport type MosaicTileComponentProps<TData extends MosaicDataItem = MosaicDataItem> =\n NaturalMosaicTileComponentProps<TData>;\n\nexport type MosaicMoveEvent<TPosition = unknown, TMoveDetails = Record<string, unknown>> = NaturalMosaicMoveEvent<\n TPosition,\n TMoveDetails\n>;\nexport type MosaicDropEvent<TPosition = unknown, TMoveDetails = Record<string, unknown>> = NaturalMosaicDropEvent<\n TPosition,\n TMoveDetails\n>;\nexport type MosaicOperation = NaturalMosaicOperation;\nexport type MosaicActiveType = NaturalMosaicActiveType;\n\n// TODO(burdon): Remove.\nexport type MosaicDebugProps = DebugProps;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAA2B;ACC3B,IAAAA,gBAOO;ACRP,IAAAA,gBAAoC;ACApC,IAAAA,gBAA2B;AAE3B,mBAAsB;ACFtB,kBAiBO;AACP,sBAA4C;AAC5C,IAAAA,gBAAgF;AAChF,uBAA6B;AAE7B,kBAAqB;ACtBrB,IAAAA,gBAA+B;AAE/B,4BAAmB;ACFnB,IAAAA,gBAAkC;AAElC,2BAAqB;ACFrB,IAAAC,eAA0B;AGE1B,uBAAoC;AEFpC,IAAAC,eAA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,YAAYC,WAAWpJ,WAAWqJ,YAAYI,OAAM,QAAKM,8BAAY;IACvFrO,IAAIiN,YAAY5G,WAAWpD,OAAOA;IAClCvB,MAAM;MAAEuB;MAAMhD;MAAMuC;MAAMb;IAAS;IACnC2M,sBAAsB,CAACxL,aACrByL,8CAA4B;MAAE,GAAGzL;MAAM0L,aAAahM,KAAKxC,OAAOqG,YAAY7D,KAAKxC;IAAG,CAAA;EACxF,CAAA;AAEA,MAAIkI;AACJ,MAAIyF,YAAY;AACd,QAAIvJ,cAAc,eAAeA,cAAc,UAAU;AACvD8D,eAAS;IACX,WAAW7B,cAAcA,WAAWpD,QAAQL,KAAKW,OAAO8C,WAAWpD,IAAI,MAAMsK,YAAY;AACvFrF,eAAS;IACX,OAAO;AACLA,eAAS;IACX;EACF;AAEA,QAAMhI,aAAYiO,qBAAqBC,sBAAsBvJ;AAE7D,SACEjF,+BAAAA,QAAA,cAACM,YAAAA;IACCgF,KAAKsI;IACLhL;IACAS;IACAhD;IACA0B;IACAyC;IACA8D;IACAyF;IACAI;IACAjJ,gBAAgB;MACdR,WAAWD,gBAAgBC,SAAAA;MAC3BmK,YAAYnK,YAAY,aAAahE,kBAAAA,YAA8B;MACnE,GAAGwE;IACL;IACAC,gBAAgB;MAAE,GAAG0I;MAAY,GAAGC;IAAU;IAC7C,GAAGxJ;;AAGV;AC9KO,IAAMwK,SAAS;EACpBzJ,MAAMa;EACN6I,WAAWxO;EACXuL,aAAaT;EACbiC,iBAAiBR;EACjBY;EACAO;EACAK;;EAGArJ;;EAEApD;AACF;",
6
+ "names": ["import_react", "import_util", "import_core", "import_sortable", "DEFAULT_TRANSITION", "DEFAULT_TYPE", "DEFAULT_COMPONENT", "forwardRef", "React", "MosaicOperations", "MosaicContainerContext", "createContext", "id", "type", "Component", "MosaicContainer", "children", "debug", "transitionDuration", "modifier", "getOverlayProps", "getOverlayStyle", "onOver", "onDrop", "onMove", "onDragEnd", "mosaic", "useMosaic", "container", "useEffect", "setContainer", "Object", "values", "Provider", "value", "useContainer", "useContext", "Debug", "data", "position", "pre", "className", "mx", "JSON", "stringify", "undefined", "swapItems", "items", "from", "to", "fromIndex", "findIndex", "item", "toIndex", "arrayMove", "SEPARATOR", "Path", "create", "args", "join", "parts", "path", "split", "length", "first", "last", "at", "parent", "slice", "hasRoot", "hasChild", "compare", "hasDescendent", "startsWith", "siblings", "onPath", "includes", "isTileProps", "props", "isTileComponentProps", "operation", "getTransformCSS", "transform", "CSS", "Transform", "toString", "assign", "scaleX", "scaleY", "DefaultComponent", "draggableStyle", "draggableProps", "Card", "Root", "ref", "style", "Header", "DragHandle", "Title", "title", "classNames", "displayName", "DEFAULT_COMPONENT_ID", "MosaicContext", "defaultDropAnimation", "duration", "MosaicRoot", "containers", "setContainers", "useState", "handleSetContainer", "_", "rest", "activeItem", "setActiveItem", "overItem", "setOverItem", "setOperation", "moveDetails", "setMoveDetails", "dropAnimation", "setDropAnimation", "collisionDetection", "pointerCollisions", "pointerWithin", "rectIntersection", "modifiers", "sensors", "useSensors", "useSensor", "MouseSensor", "activationConstraint", "distance", "TouchSensor", "delay", "tolerance", "KeyboardSensor", "coordinateGetter", "sortableKeyboardCoordinates", "handleDragStart", "event", "pick", "active", "current", "handleDragMove", "nextOverItem", "over", "nextOverContainer", "nextOperation", "details", "nextDetails", "delta", "entries", "find", "key", "handleDragOver", "overContainer", "activeContainer", "handleDragCancel", "handleDragEnd", "nextDropAnimation", "forEach", "setTimeout", "DndContext", "cancelDrop", "onDragStart", "onDragMove", "onDragOver", "onDragCancel", "createPortal", "MosaicDebug", "document", "body", "keys", "map", "part", "raise", "Error", "useItemsWithPreview", "itemsWithPreview", "setItemsWithPreview", "overParent", "lastOverParent", "setLastOverParent", "activeIsChild", "overIsChild", "overSelf", "filter", "useItemsWithOrigin", "MosaicDragOverlay", "overlayProps", "state", "setState", "timer", "useRef", "OverlayComponent", "clearTimeout", "FallbackComponent", "DragOverlay", "adjustScale", "OverlayErrorBoundary", "fallback", "div", "span", "constructor", "error", "p", "String", "getDerivedStateFromError", "componentDidCatch", "info", "log", "catch", "render", "MosaicSortableContext", "direction", "contextId", "Sortable", "Column", "Row", "ids", "isPreview", "SortableContext", "strategy", "verticalListSortingStrategy", "horizontalListSortingStrategy", "DraggableTile", "parentPath", "setNodeRef", "attributes", "listeners", "isDragging", "useDraggable", "DroppableTile", "forwardedRef", "isOver", "useDroppable", "useComposedRefs", "SortableTile", "OverrideComponent", "ContainerComponent", "useSortable", "animateLayoutChanges", "defaultAnimateLayoutChanges", "wasDragging", "transition", "Mosaic", "Container"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"packages/ui/react-ui-mosaic/src/mosaic/Container.tsx":{"bytes":11553,"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":1302,"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":2137,"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":2069,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/path.ts":{"bytes":3475,"imports":[],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/props.ts":{"bytes":2160,"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":1504,"imports":[{"path":"@dnd-kit/utilities","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/util/index.ts":{"bytes":750,"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":2962,"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":32193,"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":"react-dom","kind":"import-statement","external":true},{"path":"@dxos/util","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":1223,"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":9345,"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":3714,"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":850,"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":1072,"imports":[],"format":"esm"},"packages/ui/react-ui-mosaic/src/mosaic/DragOverlay.tsx":{"bytes":16045,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","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":6994,"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":18759,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","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":6732,"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":750,"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":493,"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/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":63269},"packages/ui/react-ui-mosaic/dist/lib/node/index.cjs":{"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":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"@dxos/util","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":"@dxos/log","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":"@radix-ui/react-compose-refs","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":1206},"packages/ui/react-ui-mosaic/src/mosaic/hooks/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useItemsWithPreview.ts":{"bytesInOutput":2042},"packages/ui/react-ui-mosaic/src/mosaic/hooks/useMosaic.ts":{"bytesInOutput":183},"packages/ui/react-ui-mosaic/src/mosaic/Root.tsx":{"bytesInOutput":7050},"packages/ui/react-ui-mosaic/src/mosaic/Debug.tsx":{"bytesInOutput":442},"packages/ui/react-ui-mosaic/src/mosaic/DefaultComponent.tsx":{"bytesInOutput":661},"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":3623},"packages/ui/react-ui-mosaic/src/mosaic/SortableContext.tsx":{"bytesInOutput":1208},"packages/ui/react-ui-mosaic/src/mosaic/Tile.tsx":{"bytesInOutput":3535},"packages/ui/react-ui-mosaic/src/mosaic/Mosaic.ts":{"bytesInOutput":383},"packages/ui/react-ui-mosaic/src/index.ts":{"bytesInOutput":0}},"bytes":23979}}}