dnd-block-tree 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -765,6 +765,44 @@ declare function generateId(): string;
765
765
  */
766
766
  declare function triggerHaptic(durationMs?: number): void;
767
767
 
768
+ interface DevToolsEventEntry {
769
+ id: number;
770
+ timestamp: number;
771
+ type: 'dragStart' | 'dragEnd' | 'blockMove' | 'expandChange' | 'hoverChange';
772
+ summary: string;
773
+ }
774
+ interface DevToolsCallbacks<T extends BaseBlock = BaseBlock> {
775
+ onDragStart: NonNullable<BlockTreeCallbacks<T>['onDragStart']>;
776
+ onDragEnd: NonNullable<BlockTreeCallbacks<T>['onDragEnd']>;
777
+ onBlockMove: NonNullable<BlockTreeCallbacks<T>['onBlockMove']>;
778
+ onExpandChange: NonNullable<BlockTreeCallbacks<T>['onExpandChange']>;
779
+ onHoverChange: NonNullable<BlockTreeCallbacks<T>['onHoverChange']>;
780
+ }
781
+ interface BlockTreeDevToolsProps<T extends BaseBlock = BaseBlock> {
782
+ blocks: T[];
783
+ containerTypes?: readonly string[];
784
+ events: DevToolsEventEntry[];
785
+ onClearEvents: () => void;
786
+ /** Label function for diff view (default: block.type) */
787
+ getLabel?: (block: T) => string;
788
+ /** Initial open state (default: false) */
789
+ initialOpen?: boolean;
790
+ /** Position of the trigger button (default: 'bottom-left') */
791
+ position?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
792
+ /** Custom inline styles for the trigger button */
793
+ buttonStyle?: React.CSSProperties;
794
+ /** Custom inline styles for the card panel */
795
+ panelStyle?: React.CSSProperties;
796
+ /** Force mount in production (default: false). DevTools renders nothing in production unless this is true. */
797
+ forceMount?: boolean;
798
+ }
799
+ declare function useDevToolsCallbacks<T extends BaseBlock = BaseBlock>(): {
800
+ callbacks: DevToolsCallbacks<T>;
801
+ events: DevToolsEventEntry[];
802
+ clearEvents: () => void;
803
+ };
804
+ declare function BlockTreeDevTools<T extends BaseBlock = BaseBlock>({ blocks, containerTypes, events, onClearEvents, getLabel, initialOpen, position, buttonStyle, panelStyle, forceMount, }: BlockTreeDevToolsProps<T>): react_jsx_runtime.JSX.Element | null;
805
+
768
806
  /**
769
807
  * A nested/tree representation of a block.
770
808
  * Omits `parentId` and `order` since they are reconstructed during flattening.
@@ -833,4 +871,4 @@ declare function initFractionalOrder<T extends {
833
871
  order: number | string;
834
872
  }>(blocks: T[]): T[];
835
873
 
836
- export { type AnimationConfig, type AutoExpandConfig, type BaseBlock, type BlockAction, type BlockAddEvent, type BlockDeleteEvent, type BlockIndex, type BlockMoveEvent, type BlockPosition, type BlockRendererProps, type BlockRenderers, type BlockStateContextValue, type BlockStateProviderProps, BlockTree, type BlockTreeCallbacks, type BlockTreeConfig, type BlockTreeCustomization, type BlockTreeProps, BlockTreeSSR, type BlockTreeSSRProps, type CanDragFn, type CanDropFn, type ContainerRendererProps, type DragEndEvent, type DragMoveEvent, DragOverlay, type DragOverlayProps$1 as DragOverlayProps, type DragStartEvent, DropZone, type DropZoneConfig, type DropZoneProps, type DropZoneType, type ExpandChangeEvent, type HoverChangeEvent, type IdGeneratorFn, type InternalRenderers, type MoveOperation, type NestedBlock, type OrderingStrategy, type RendererPropsFor, type SensorConfig, type SnapshotRectsRef, TreeRenderer, type TreeRendererProps, type TreeStateContextValue, type TreeStateProviderProps, type TreeValidationResult, type UseBlockHistoryOptions, type UseBlockHistoryResult, type UseLayoutAnimationOptions, type UseVirtualTreeOptions, type UseVirtualTreeResult, buildOrderedBlocks, cloneMap, cloneParentMap, closestCenterCollision, compareFractionalKeys, computeNormalizedIndex, createBlockState, createStickyCollision, createTreeState, debounce, deleteBlockAndDescendants, extractBlockId, extractUUID, flatToNested, generateId, generateInitialKeys, generateKeyBetween, generateNKeysBetween, getBlockDepth, getDescendantIds, getDropZoneType, getSensorConfig, getSubtreeDepth, initFractionalOrder, nestedToFlat, reparentBlockIndex, reparentMultipleBlocks, triggerHaptic, useBlockHistory, useConfiguredSensors, useLayoutAnimation, useVirtualTree, validateBlockTree, weightedVerticalCollision };
874
+ export { type AnimationConfig, type AutoExpandConfig, type BaseBlock, type BlockAction, type BlockAddEvent, type BlockDeleteEvent, type BlockIndex, type BlockMoveEvent, type BlockPosition, type BlockRendererProps, type BlockRenderers, type BlockStateContextValue, type BlockStateProviderProps, BlockTree, type BlockTreeCallbacks, type BlockTreeConfig, type BlockTreeCustomization, BlockTreeDevTools, type BlockTreeDevToolsProps, type BlockTreeProps, BlockTreeSSR, type BlockTreeSSRProps, type CanDragFn, type CanDropFn, type ContainerRendererProps, type DevToolsCallbacks, type DevToolsEventEntry, type DragEndEvent, type DragMoveEvent, DragOverlay, type DragOverlayProps$1 as DragOverlayProps, type DragStartEvent, DropZone, type DropZoneConfig, type DropZoneProps, type DropZoneType, type ExpandChangeEvent, type HoverChangeEvent, type IdGeneratorFn, type InternalRenderers, type MoveOperation, type NestedBlock, type OrderingStrategy, type RendererPropsFor, type SensorConfig, type SnapshotRectsRef, TreeRenderer, type TreeRendererProps, type TreeStateContextValue, type TreeStateProviderProps, type TreeValidationResult, type UseBlockHistoryOptions, type UseBlockHistoryResult, type UseLayoutAnimationOptions, type UseVirtualTreeOptions, type UseVirtualTreeResult, buildOrderedBlocks, cloneMap, cloneParentMap, closestCenterCollision, compareFractionalKeys, computeNormalizedIndex, createBlockState, createStickyCollision, createTreeState, debounce, deleteBlockAndDescendants, extractBlockId, extractUUID, flatToNested, generateId, generateInitialKeys, generateKeyBetween, generateNKeysBetween, getBlockDepth, getDescendantIds, getDropZoneType, getSensorConfig, getSubtreeDepth, initFractionalOrder, nestedToFlat, reparentBlockIndex, reparentMultipleBlocks, triggerHaptic, useBlockHistory, useConfiguredSensors, useDevToolsCallbacks, useLayoutAnimation, useVirtualTree, validateBlockTree, weightedVerticalCollision };
package/dist/index.d.ts CHANGED
@@ -765,6 +765,44 @@ declare function generateId(): string;
765
765
  */
766
766
  declare function triggerHaptic(durationMs?: number): void;
767
767
 
768
+ interface DevToolsEventEntry {
769
+ id: number;
770
+ timestamp: number;
771
+ type: 'dragStart' | 'dragEnd' | 'blockMove' | 'expandChange' | 'hoverChange';
772
+ summary: string;
773
+ }
774
+ interface DevToolsCallbacks<T extends BaseBlock = BaseBlock> {
775
+ onDragStart: NonNullable<BlockTreeCallbacks<T>['onDragStart']>;
776
+ onDragEnd: NonNullable<BlockTreeCallbacks<T>['onDragEnd']>;
777
+ onBlockMove: NonNullable<BlockTreeCallbacks<T>['onBlockMove']>;
778
+ onExpandChange: NonNullable<BlockTreeCallbacks<T>['onExpandChange']>;
779
+ onHoverChange: NonNullable<BlockTreeCallbacks<T>['onHoverChange']>;
780
+ }
781
+ interface BlockTreeDevToolsProps<T extends BaseBlock = BaseBlock> {
782
+ blocks: T[];
783
+ containerTypes?: readonly string[];
784
+ events: DevToolsEventEntry[];
785
+ onClearEvents: () => void;
786
+ /** Label function for diff view (default: block.type) */
787
+ getLabel?: (block: T) => string;
788
+ /** Initial open state (default: false) */
789
+ initialOpen?: boolean;
790
+ /** Position of the trigger button (default: 'bottom-left') */
791
+ position?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
792
+ /** Custom inline styles for the trigger button */
793
+ buttonStyle?: React.CSSProperties;
794
+ /** Custom inline styles for the card panel */
795
+ panelStyle?: React.CSSProperties;
796
+ /** Force mount in production (default: false). DevTools renders nothing in production unless this is true. */
797
+ forceMount?: boolean;
798
+ }
799
+ declare function useDevToolsCallbacks<T extends BaseBlock = BaseBlock>(): {
800
+ callbacks: DevToolsCallbacks<T>;
801
+ events: DevToolsEventEntry[];
802
+ clearEvents: () => void;
803
+ };
804
+ declare function BlockTreeDevTools<T extends BaseBlock = BaseBlock>({ blocks, containerTypes, events, onClearEvents, getLabel, initialOpen, position, buttonStyle, panelStyle, forceMount, }: BlockTreeDevToolsProps<T>): react_jsx_runtime.JSX.Element | null;
805
+
768
806
  /**
769
807
  * A nested/tree representation of a block.
770
808
  * Omits `parentId` and `order` since they are reconstructed during flattening.
@@ -833,4 +871,4 @@ declare function initFractionalOrder<T extends {
833
871
  order: number | string;
834
872
  }>(blocks: T[]): T[];
835
873
 
836
- export { type AnimationConfig, type AutoExpandConfig, type BaseBlock, type BlockAction, type BlockAddEvent, type BlockDeleteEvent, type BlockIndex, type BlockMoveEvent, type BlockPosition, type BlockRendererProps, type BlockRenderers, type BlockStateContextValue, type BlockStateProviderProps, BlockTree, type BlockTreeCallbacks, type BlockTreeConfig, type BlockTreeCustomization, type BlockTreeProps, BlockTreeSSR, type BlockTreeSSRProps, type CanDragFn, type CanDropFn, type ContainerRendererProps, type DragEndEvent, type DragMoveEvent, DragOverlay, type DragOverlayProps$1 as DragOverlayProps, type DragStartEvent, DropZone, type DropZoneConfig, type DropZoneProps, type DropZoneType, type ExpandChangeEvent, type HoverChangeEvent, type IdGeneratorFn, type InternalRenderers, type MoveOperation, type NestedBlock, type OrderingStrategy, type RendererPropsFor, type SensorConfig, type SnapshotRectsRef, TreeRenderer, type TreeRendererProps, type TreeStateContextValue, type TreeStateProviderProps, type TreeValidationResult, type UseBlockHistoryOptions, type UseBlockHistoryResult, type UseLayoutAnimationOptions, type UseVirtualTreeOptions, type UseVirtualTreeResult, buildOrderedBlocks, cloneMap, cloneParentMap, closestCenterCollision, compareFractionalKeys, computeNormalizedIndex, createBlockState, createStickyCollision, createTreeState, debounce, deleteBlockAndDescendants, extractBlockId, extractUUID, flatToNested, generateId, generateInitialKeys, generateKeyBetween, generateNKeysBetween, getBlockDepth, getDescendantIds, getDropZoneType, getSensorConfig, getSubtreeDepth, initFractionalOrder, nestedToFlat, reparentBlockIndex, reparentMultipleBlocks, triggerHaptic, useBlockHistory, useConfiguredSensors, useLayoutAnimation, useVirtualTree, validateBlockTree, weightedVerticalCollision };
874
+ export { type AnimationConfig, type AutoExpandConfig, type BaseBlock, type BlockAction, type BlockAddEvent, type BlockDeleteEvent, type BlockIndex, type BlockMoveEvent, type BlockPosition, type BlockRendererProps, type BlockRenderers, type BlockStateContextValue, type BlockStateProviderProps, BlockTree, type BlockTreeCallbacks, type BlockTreeConfig, type BlockTreeCustomization, BlockTreeDevTools, type BlockTreeDevToolsProps, type BlockTreeProps, BlockTreeSSR, type BlockTreeSSRProps, type CanDragFn, type CanDropFn, type ContainerRendererProps, type DevToolsCallbacks, type DevToolsEventEntry, type DragEndEvent, type DragMoveEvent, DragOverlay, type DragOverlayProps$1 as DragOverlayProps, type DragStartEvent, DropZone, type DropZoneConfig, type DropZoneProps, type DropZoneType, type ExpandChangeEvent, type HoverChangeEvent, type IdGeneratorFn, type InternalRenderers, type MoveOperation, type NestedBlock, type OrderingStrategy, type RendererPropsFor, type SensorConfig, type SnapshotRectsRef, TreeRenderer, type TreeRendererProps, type TreeStateContextValue, type TreeStateProviderProps, type TreeValidationResult, type UseBlockHistoryOptions, type UseBlockHistoryResult, type UseLayoutAnimationOptions, type UseVirtualTreeOptions, type UseVirtualTreeResult, buildOrderedBlocks, cloneMap, cloneParentMap, closestCenterCollision, compareFractionalKeys, computeNormalizedIndex, createBlockState, createStickyCollision, createTreeState, debounce, deleteBlockAndDescendants, extractBlockId, extractUUID, flatToNested, generateId, generateInitialKeys, generateKeyBetween, generateNKeysBetween, getBlockDepth, getDescendantIds, getDropZoneType, getSensorConfig, getSubtreeDepth, initFractionalOrder, nestedToFlat, reparentBlockIndex, reparentMultipleBlocks, triggerHaptic, useBlockHistory, useConfiguredSensors, useDevToolsCallbacks, useLayoutAnimation, useVirtualTree, validateBlockTree, weightedVerticalCollision };