@cratis/event-models 0.133.0 → 0.134.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.
@@ -9,6 +9,9 @@ export interface BoardEditing extends SpecificationEditing, StickyNoteChanges {
9
9
  onSliceStatusChanged?: (sliceId: Guid, status: SliceStatus) => Promise<boolean | void> | void;
10
10
  onTranslationDirectionChanged?: (sliceId: Guid, direction: TranslationDirection) => Promise<boolean | void> | void;
11
11
  onSliceAdded?: (afterSliceId: Guid, sliceType: SliceType) => void;
12
+ onFeatureAdded?: (moduleId: Guid) => void;
13
+ onSubFeatureAdded?: (featureId: Guid) => void;
14
+ onSliceAddedToFeature?: (featureId: Guid, sliceType: SliceType) => void;
12
15
  onEventAdded?: (sliceId: Guid) => void;
13
16
  onEventReferenced?: (sliceId: Guid, source: EventItem) => void;
14
17
  onEventRenamed?: (sliceId: Guid, eventId: Guid, name: string) => string | void;
@@ -1,5 +1,7 @@
1
1
  import type { Position } from '../Model';
2
+ import type { EventModelImageExportOptions } from './EventModelImageExportOptions';
2
3
  export interface EventModelBoardHandle {
3
4
  addCollection(x: number, y: number): Promise<void>;
4
5
  addStickyNote(center: Position): void;
6
+ exportImage(options?: EventModelImageExportOptions): Promise<Blob>;
5
7
  }
@@ -0,0 +1,5 @@
1
+ export interface EventModelImageExportOptions {
2
+ scale?: number;
3
+ background?: string;
4
+ padding?: number;
5
+ }
@@ -0,0 +1,11 @@
1
+ import type { ReactElement } from 'react';
2
+ export declare const EXPORT_EXCLUDE_ATTRIBUTE = "data-event-model-export-exclude";
3
+ export interface BoardImageCaptureEnvironment {
4
+ createContainer: (width: number, height: number, padding: number) => HTMLElement;
5
+ removeContainer: (container: HTMLElement) => void;
6
+ mount: (container: HTMLElement, element: ReactElement) => () => void;
7
+ waitForLayoutToSettle: () => Promise<void>;
8
+ captureBlob: (container: HTMLElement, pixelRatio: number, backgroundColor: string) => Promise<Blob | null>;
9
+ }
10
+ export declare const defaultBoardImageCaptureEnvironment: BoardImageCaptureEnvironment;
11
+ export declare function captureBoardImage(element: ReactElement, width: number, height: number, padding: number, pixelRatio: number, backgroundColor: string, environment?: BoardImageCaptureEnvironment): Promise<Blob>;
@@ -0,0 +1,13 @@
1
+ import type { Position } from '../Model';
2
+ export interface ContentBoundingBox {
3
+ left: number;
4
+ top: number;
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export declare function contentBoundingBox<T extends {
9
+ position: Position;
10
+ }>(collections: readonly T[], estimateSize: (collection: T) => {
11
+ width: number;
12
+ height: number;
13
+ }): ContentBoundingBox;
@@ -0,0 +1,17 @@
1
+ import type { Guid } from '@cratis/fundamentals';
2
+ import type { CollectionSizeEstimate } from '../Collections';
3
+ import type { ModuleCollectionLink, StickyNote } from '../Model';
4
+ import type { BoardCollection, BoardCollections } from './BoardCollections';
5
+ import { captureBoardImage } from './captureBoardImage';
6
+ import type { EventModelImageExportOptions } from './EventModelImageExportOptions';
7
+ export interface ExportBoardImageParams<T extends BoardCollection> {
8
+ documentId: Guid;
9
+ collections: readonly T[];
10
+ estimateSize: (collection: T) => CollectionSizeEstimate;
11
+ countSlices: (collection: T) => number;
12
+ renderCollection: BoardCollections<T>['renderCollection'];
13
+ links: ModuleCollectionLink[];
14
+ stickyNotes: readonly StickyNote[];
15
+ options?: EventModelImageExportOptions;
16
+ }
17
+ export declare function exportBoardImage<T extends BoardCollection>(params: ExportBoardImageParams<T>, capture?: typeof captureBoardImage): Promise<Blob>;
@@ -0,0 +1,9 @@
1
+ import type { Position } from '../Model';
2
+ import type { ContentBoundingBox } from './contentBoundingBox';
3
+ export interface ExportImageLayout {
4
+ canvasWidth: number;
5
+ canvasHeight: number;
6
+ canvasInitialZoom: number;
7
+ canvasInitialPan: Position;
8
+ }
9
+ export declare function exportImageLayout(boundingBox: ContentBoundingBox): ExportImageLayout;
@@ -12,6 +12,11 @@ export * from './EventModelBoard';
12
12
  export * from './EventModelBoardEditor';
13
13
  export * from './EventModelBoardHandle';
14
14
  export * from './BoardCollections';
15
+ export * from './captureBoardImage';
16
+ export * from './contentBoundingBox';
17
+ export * from './EventModelImageExportOptions';
18
+ export * from './exportBoardImage';
19
+ export * from './exportImageLayout';
15
20
  export * from './HostedEventModelBoard';
16
21
  export * from './boardMinimap';
17
22
  export * from './isLargeBoard';
@@ -21,3 +26,4 @@ export * from './BoardViewOptions';
21
26
  export * from './BoardOverlay';
22
27
  export * from './EditToolbar';
23
28
  export * from './nextModulePosition';
29
+ export * from './structuralAddCallbacks';
@@ -0,0 +1,8 @@
1
+ import type { Guid } from '@cratis/fundamentals';
2
+ import type { SliceType } from '../Model';
3
+ import type { BoardEditing } from './BoardEditing';
4
+ export declare const featureAddCallback: (moduleId: Guid, supplied: (() => void) | undefined, editing: BoardEditing) => (() => void) | undefined;
5
+ export declare const featureStructuralAddCallbacks: (featureId: Guid, onAddSubFeature: (() => void) | undefined, onAddSlice: ((sliceType: SliceType) => void) | undefined, editing: BoardEditing) => {
6
+ onAddSubFeature: (() => void) | undefined;
7
+ onAddSlice: ((sliceType: SliceType) => void) | undefined;
8
+ };