@cratis/event-models 0.251.1 → 0.252.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.
@@ -18,7 +18,8 @@ export interface BoardCollectionViewProps {
18
18
  x: number;
19
19
  y: number;
20
20
  }) => void;
21
+ onCollectionMoveCanceled?: (id: Guid) => void;
21
22
  content: (grid: CollectionGridRenderer) => ReactNode;
22
23
  onGridMounted?: (collection: ModuleCollection, mounted: boolean) => void;
23
24
  }
24
- export declare const BoardCollectionView: import("react").MemoExoticComponent<({ collection, estimatedSize, measuredSize, onSize, getZoom, canMove, onCollectionMoving, onCollectionMoved, content, onGridMounted }: BoardCollectionViewProps) => import("react").JSX.Element>;
25
+ export declare const BoardCollectionView: import("react").MemoExoticComponent<({ collection, estimatedSize, measuredSize, onSize, getZoom, canMove, onCollectionMoving, onCollectionMoved, onCollectionMoveCanceled, content, onGridMounted }: BoardCollectionViewProps) => import("react").JSX.Element>;
@@ -7,7 +7,7 @@ export interface BoardCollection extends CollectionItem {
7
7
  name: string;
8
8
  }[];
9
9
  }
10
- export type CollectionGridContent = Omit<CollectionGridProps, 'getZoom' | 'canMove' | 'onCollectionMoving' | 'onCollectionMoved'>;
10
+ export type CollectionGridContent = Omit<CollectionGridProps, 'getZoom' | 'canMove' | 'onCollectionMoving' | 'onCollectionMoved' | 'onCollectionMoveCanceled'>;
11
11
  export type CollectionGridRenderer = (content: CollectionGridContent) => ReactElement;
12
12
  export interface BoardCollections<T extends BoardCollection> extends CollectionsAreaOptions<T> {
13
13
  estimateSize: (collection: T) => CollectionSizeEstimate;
@@ -12,5 +12,5 @@ export interface EventModelBoardInteractions extends Partial<BoardInteraction> {
12
12
  export interface EventModelBoardEditor extends EventModelBoardInteractions {
13
13
  collections?: Pick<CollectionsAreaOptions<ModuleCollection>, 'onAddCollection' | 'onCollectionMoved' | 'onCollectionsChange' | 'onPersistenceError'>;
14
14
  collectionBoundary?: (collection: ModuleCollection, children: ReactNode) => ReactNode;
15
- collection?: (collection: ModuleCollection) => Omit<CollectionGridProps, 'collection' | 'getZoom' | 'onCollectionMoving' | 'onCollectionMoved' | 'canMove'>;
15
+ collection?: (collection: ModuleCollection) => Omit<CollectionGridProps, 'collection' | 'getZoom' | 'onCollectionMoving' | 'onCollectionMoved' | 'onCollectionMoveCanceled' | 'canMove'>;
16
16
  }
@@ -16,6 +16,7 @@ export interface HostedEventModelBoardProps<T extends BoardCollection> {
16
16
  editor?: EventModelBoardInteractions;
17
17
  canvas?: EventModelBoardCanvas;
18
18
  showMinimap?: boolean;
19
+ separateOverlaps?: boolean;
19
20
  showLogo?: boolean;
20
21
  showViewOptions?: boolean;
21
22
  toolbar?: ReactNode;
@@ -0,0 +1,11 @@
1
+ import type { Guid } from '@cratis/fundamentals';
2
+ import { type CollectionItem } from '../Collections/collectionState';
3
+ import { type CollectionFootprint } from '../Collections/separateCollections';
4
+ import type { CollectionsArea } from '../Collections/useCollectionsArea';
5
+ import type { Position } from '../Model';
6
+ export declare function useCollectionPlacement<T extends CollectionItem>(area: CollectionsArea<T>, footprintOf: (collection: T) => CollectionFootprint, enabled?: boolean): {
7
+ placed: T[];
8
+ moveCollection: (id: Guid, deltaX: number, deltaY: number) => void;
9
+ collectionMoved: (id: Guid, position: Position) => Promise<void>;
10
+ collectionMoveCanceled: (id: Guid) => void;
11
+ };
@@ -14,6 +14,7 @@ export interface CollectionGridProps extends CollectionGridEditor {
14
14
  x: number;
15
15
  y: number;
16
16
  }) => void;
17
+ onCollectionMoveCanceled?: (id: Guid) => void;
17
18
  canMove?: boolean;
18
19
  onAddModule?: () => Promise<Module | undefined>;
19
20
  onModulesReordered?: (ids: Guid[]) => Promise<boolean>;
@@ -25,4 +26,4 @@ export interface CollectionGridProps extends CollectionGridEditor {
25
26
  rowLabels?: (props: RowLabelsColumnProps) => ReactNode;
26
27
  onActorsReordered?: RowLabelsColumnProps['onActorsReordered'];
27
28
  }
28
- export declare const CollectionGrid: ({ collection, getZoom, slots, onDeselect, onCollectionMoving, onCollectionMoved, canMove, onAddModule, onModulesReordered, onCollapseChanged, onRenameModule, onModulesChanged, onFeaturesChanged, onPersistenceError, rowLabels, onActorsReordered, onAddFeature, onRenameFeature, onFeatureCollapseChanged, onFeaturesReordered, onAddSlice, onReorderSlices, onMoveSlice, validateSliceDrop, onSliceCollapseChanged, onSliceRenamed, onSliceDuplicated, takenArtifactNames }: CollectionGridProps) => import("react").JSX.Element;
29
+ export declare const CollectionGrid: ({ collection, getZoom, slots, onDeselect, onCollectionMoving, onCollectionMoved, onCollectionMoveCanceled, canMove, onAddModule, onModulesReordered, onCollapseChanged, onRenameModule, onModulesChanged, onFeaturesChanged, onPersistenceError, rowLabels, onActorsReordered, onAddFeature, onRenameFeature, onFeatureCollapseChanged, onFeaturesReordered, onAddSlice, onReorderSlices, onMoveSlice, validateSliceDrop, onSliceCollapseChanged, onSliceRenamed, onSliceDuplicated, takenArtifactNames }: CollectionGridProps) => import("react").JSX.Element;
@@ -8,5 +8,6 @@ export interface CollectionMoveHandleProps {
8
8
  topOffset?: number;
9
9
  onCollectionMoving?: CollectionMoving;
10
10
  onCollectionMoved?: CollectionMoved;
11
+ onCollectionMoveCanceled?: (id: Guid) => void;
11
12
  }
12
13
  export declare const CollectionMoveHandle: ({ onCollectionMoved, ...props }: CollectionMoveHandleProps) => import("react").JSX.Element | undefined;
@@ -2,6 +2,7 @@ export * from './CollectionMoved';
2
2
  export * from './CollectionMoveHandle';
3
3
  export * from './useCollectionMove';
4
4
  export * from './collectionState';
5
+ export * from './separateCollections';
5
6
  export * from './useCollectionsArea';
6
7
  export * from './CollectionViewport';
7
8
  export * from './collectionFrame';
@@ -0,0 +1,7 @@
1
+ import type { CollectionItem } from './collectionState';
2
+ export interface CollectionFootprint {
3
+ width: number;
4
+ height: number;
5
+ }
6
+ export declare const COLLECTION_SEPARATION_GAP = 48;
7
+ export declare function separateCollections<T extends CollectionItem>(collections: T[], footprintOf: (collection: T) => CollectionFootprint): T[];
@@ -6,5 +6,7 @@ export interface CollectionMoveHandlers {
6
6
  onPointerDown: (event: PointerEvent<HTMLDivElement>) => void;
7
7
  onPointerMove: (event: PointerEvent<HTMLDivElement>) => void;
8
8
  onPointerUp: () => void;
9
+ onPointerCancel: () => void;
10
+ onLostPointerCapture: () => void;
9
11
  }
10
- export declare function useCollectionMove(collectionId: Guid, position: Position, getZoom: () => number, onCollectionMoving?: CollectionMoving, onCollectionMoved?: CollectionMoved): CollectionMoveHandlers;
12
+ export declare function useCollectionMove(collectionId: Guid, position: Position, getZoom: () => number, onCollectionMoving?: CollectionMoving, onCollectionMoved?: CollectionMoved, onCollectionMoveCanceled?: (id: Guid) => void): CollectionMoveHandlers;