@cratis/event-models 0.113.0 → 0.114.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.
Files changed (42) hide show
  1. package/README.md +4 -2
  2. package/dist/screen-editor/ScreenEditor/Defaults/defaultComponentIcons.d.ts +3 -0
  3. package/dist/screen-editor/ScreenEditor/Defaults/defaultPackageIcons.d.ts +6 -0
  4. package/dist/screen-editor/ScreenEditor/Document/canvasMoveEdits.d.ts +4 -0
  5. package/dist/screen-editor/ScreenEditor/Document/placeOnCanvas.d.ts +10 -0
  6. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorController.d.ts +6 -3
  7. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorPrimeReactProvider.d.ts +1 -1
  8. package/dist/screen-editor/ScreenEditor/Host/mergeComponentDefaults.d.ts +3 -0
  9. package/dist/screen-editor/ScreenEditor/Host/screenEditorPrimeReactDefaults.d.ts +2 -0
  10. package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +3 -0
  11. package/dist/screen-editor/ScreenEditor/Inspector/StructureTree.d.ts +2 -1
  12. package/dist/screen-editor/ScreenEditor/Palette/PaletteFolders.d.ts +7 -0
  13. package/dist/screen-editor/ScreenEditor/Palette/buildPalette.d.ts +3 -2
  14. package/dist/screen-editor/ScreenEditor/Properties/visibleProperties.d.ts +2 -0
  15. package/dist/screen-editor/ScreenEditor/Runtime/profileColorScheme.d.ts +2 -0
  16. package/dist/screen-editor/ScreenEditor/Runtime/profileTheme.d.ts +3 -0
  17. package/dist/screen-editor/ScreenEditor/Runtime/withSampleContentProperties.d.ts +3 -0
  18. package/dist/screen-editor/ScreenEditor/Selection/sceneTree.d.ts +2 -0
  19. package/dist/screen-editor/ScreenEditor/Structure/isDeleteKey.d.ts +15 -0
  20. package/dist/screen-editor/ScreenEditor/Structure/removal.d.ts +3 -0
  21. package/dist/screen-editor/ScreenEditor/Structure/surfaceMoveEdit.d.ts +3 -0
  22. package/dist/screen-editor/ScreenEditor/Surface/DesignTime/DesignTimeComponent.d.ts +4 -0
  23. package/dist/screen-editor/ScreenEditor/Surface/DesignTime/DesignTimePlaceholder.d.ts +7 -0
  24. package/dist/screen-editor/ScreenEditor/Surface/DesignTime/DesignTimePlaceholderTone.d.ts +5 -0
  25. package/dist/screen-editor/ScreenEditor/Surface/DesignTime/OverlayPreview.d.ts +12 -0
  26. package/dist/screen-editor/ScreenEditor/Surface/DesignTime/SurfaceStrings.d.ts +12 -0
  27. package/dist/screen-editor/ScreenEditor/Surface/DesignTime/designTimeRegistry.d.ts +3 -0
  28. package/dist/screen-editor/ScreenEditor/Surface/DesignTime/designTimeSamples.d.ts +7 -0
  29. package/dist/screen-editor/ScreenEditor/Surface/DesignTime/overlayKinds.d.ts +8 -0
  30. package/dist/screen-editor/ScreenEditor/Surface/DesignTime/useRendersVisibleContent.d.ts +3 -0
  31. package/dist/screen-editor/ScreenEditor/Surface/DropIndicator.d.ts +6 -0
  32. package/dist/screen-editor/ScreenEditor/Surface/ScreenSurface.d.ts +4 -1
  33. package/dist/screen-editor/ScreenEditor/Surface/dragPayload.d.ts +6 -1
  34. package/dist/screen-editor/ScreenEditor/Surface/dropRegionRects.d.ts +0 -1
  35. package/dist/screen-editor/ScreenEditor/Surface/elementRect.d.ts +2 -0
  36. package/dist/screen-editor/ScreenEditor/Surface/resolveDropTarget.d.ts +6 -0
  37. package/dist/screen-editor/ScreenEditor/Surface/useSurfaceDrop.d.ts +22 -0
  38. package/dist/screen-editor/ScreenEditor/Surface/useSurfaceMeasurement.d.ts +9 -0
  39. package/dist/screen-editor/ScreenEditor/index.d.ts +1 -0
  40. package/dist/screen-editor/index.js +2798 -1420
  41. package/dist/screen-editor/screen-editor.css +1 -1
  42. package/package.json +13 -7
package/README.md CHANGED
@@ -45,9 +45,11 @@ The board reports when someone selects a slice's screen preview. `@cratis/event-
45
45
  Install what the editor draws with. These are optional peers, required only by this entry:
46
46
 
47
47
  ```bash
48
- npm install @cratis/scene.model @cratis/scene.engine @cratis/scene.react @cratis/scene.components @cratis/scene.primereact @cratis/scene.tailwind @cratis/scene.blueprint.default @cratis/scene.blueprint.components @primereact/core @primereact/headless primereact lucide-react react-icons chart.js quill
48
+ npm install @cratis/scene.model @cratis/scene.engine @cratis/scene.react @cratis/scene.components @cratis/scene.primereact @cratis/scene.tailwind @cratis/scene.blueprint.default @cratis/scene.blueprint.components @primereact/core @primereact/headless @primereact/styles primereact lucide-react react-icons chart.js quill
49
49
  ```
50
50
 
51
+ PrimeReact must be 11.2.0 or newer (`@primereact/core`, `@primereact/headless`, `@primereact/styles` and `primereact`): the editor imports component styles that 11.2.0 introduced (`@primereact/styles/inputpassword`), so an earlier 11 fails to resolve the entry. `yarn guard:peer-floor` checks every style specifier against the declared floor.
52
+
51
53
  The Scene packages must be 4.7.0 or newer: that release adds the chart, multi-state checkbox, file upload, data scroller, tree table and rich text editor controls and the JSON property type the editor draws a field for. `chart.js` (4.5.1 or newer) draws the chart control and `quill` (2.0.3 or newer) is the rich text control's engine. Both are optional peers of this entry, and a host that offers those controls in its palette installs them. Quill's stylesheet is part of `@cratis/event-models/screen-editor/styles`, so there is nothing more to import.
52
54
 
53
55
  Import the editor's stylesheet beside the board's, and Scene's:
@@ -75,7 +77,7 @@ import { ScreenEditorPrimeReactProvider } from '@cratis/event-models/screen-edit
75
77
  </CratisComponentsProvider>
76
78
  ```
77
79
 
78
- `ScreenEditorPrimeReactProvider` is PrimeReact's own `PrimeReactProvider` under a name this package exports, and it takes the same props (license, theme, locale, pass-through, defaults). It is not a second context: the published bundle imports `@primereact/core/config` from your install, so the provider and every PrimeReact component in the page share one context. Import `PrimeReactProvider` from `@primereact/core/config` yourself if you prefer; the result is identical. Either way, install a single `@primereact/core`.
80
+ `ScreenEditorPrimeReactProvider` is PrimeReact's own `PrimeReactProvider` with one addition, and it takes the same props (license, theme, locale, pass-through, defaults). The addition is the component styles: PrimeReact 11 ships its components as structure with no look, and the look comes from `@primereact/styles`, which a provider has to be handed as `defaults`. Without them a screen drawn in the editor is the right markup with none of the appearance it has in Play - a button that is plain text, a card with no surface, a field with no box. This provider hands them over (`screenEditorPrimeReactDefaults`), and any `defaults` you pass are merged into those component by component and part by part - an entry you give `Button` adds to its styles and never replaces them; where you set the same prop, yours wins. It is not a second context: the published bundle imports `@primereact/core/config` from your install, so the provider and every PrimeReact component in the page share one context. If you use `PrimeReactProvider` from `@primereact/core/config` yourself, pass `defaults={screenEditorPrimeReactDefaults}` to it - and merge your own entries into it with `mergeComponentDefaults`, since a plain object spread replaces a whole component entry, styles included. Either way, install a single `@primereact/core`.
79
81
 
80
82
  - The editor needs no Studio Core, Arc, router or Studio provider. It does need a PrimeReact provider (`ScreenEditorPrimeReactProvider`), because the default palette offers PrimeReact components and those throw without one. If a component does fail, the editor closes with a message and the page it was opened over carries on.
81
83
  - PrimeReact 11 checks a license key at runtime and shows an *Invalid PrimeUI License* badge without one. The key belongs to your application: pass it to the provider. The package never sees it.
@@ -0,0 +1,3 @@
1
+ import type { PackageIcon } from './defaultPackageIcons';
2
+ export declare const defaultComponentIcons: Readonly<Record<string, PackageIcon>>;
3
+ export declare const iconComponentOf: (componentName: string) => PackageIcon;
@@ -0,0 +1,6 @@
1
+ import type { ComponentType } from 'react';
2
+ export type PackageIcon = ComponentType<{
3
+ 'aria-hidden'?: boolean | 'true' | 'false';
4
+ }>;
5
+ export declare const defaultPackageIcons: Readonly<Record<string, PackageIcon>>;
6
+ export declare const unknownPackageIcon: PackageIcon;
@@ -0,0 +1,4 @@
1
+ import { type SceneEdit, type SceneElement } from '@cratis/scene.model';
2
+ import type { StructureEdit } from '../Structure/StructureEdit';
3
+ import { type CanvasPlacement } from './placeOnCanvas';
4
+ export declare function canvasMoveEdits(roots: readonly SceneElement[], edit: StructureEdit, at?: CanvasPlacement): SceneEdit[] | undefined;
@@ -0,0 +1,10 @@
1
+ import type { SceneElement } from '@cratis/scene.model';
2
+ export interface CanvasPlacement {
3
+ left: number;
4
+ top: number;
5
+ }
6
+ export declare const canvasCascadeStep = 32;
7
+ export declare const cascadedPlacement: (siblings: number) => CanvasPlacement;
8
+ export declare function placeOnCanvas<T extends SceneElement>(element: T, placement: CanvasPlacement): T;
9
+ export declare function placementOf(element: SceneElement): CanvasPlacement | undefined;
10
+ export declare function removePlacement<T extends SceneElement>(element: T): T;
@@ -1,3 +1,4 @@
1
+ import type { CanvasPlacement } from '../Document/placeOnCanvas';
1
2
  import type { NodeInspection, SceneDiagnostic, SceneDocument, SceneEdit, SceneElement } from '@cratis/scene.model';
2
3
  import type { EditingContext } from '@cratis/scene.engine';
3
4
  import type { Ownership } from '../Structure/Ownership';
@@ -28,10 +29,12 @@ export interface ScreenEditorController {
28
29
  applied: boolean;
29
30
  diagnostics: SceneDiagnostic[];
30
31
  };
31
- move: (edit: StructureEdit) => StructureEditRejection | undefined;
32
- insertComponent: (componentName: string, parentId: string | undefined, index: number | undefined) => void;
33
- insertLayout: (item: LayoutItem, parentId: string | undefined, index: number | undefined) => void;
32
+ move: (edit: StructureEdit, at?: CanvasPlacement) => StructureEditRejection | undefined;
33
+ validateMove: (edit: StructureEdit) => StructureEditRejection | undefined;
34
+ insertComponent: (componentName: string, parentId: string | undefined, index: number | undefined, at?: CanvasPlacement) => void;
35
+ insertLayout: (item: LayoutItem, parentId: string | undefined, index: number | undefined, at?: CanvasPlacement) => void;
34
36
  remove: (elementId: string) => void;
37
+ canRemove: (elementId: string) => boolean;
35
38
  setProperty: (property: NodeInspection['properties'][number], value: unknown) => void;
36
39
  undo: () => void;
37
40
  redo: () => void;
@@ -1,3 +1,3 @@
1
1
  import { PrimeReactProvider } from '@primereact/core/config';
2
2
  export type ScreenEditorPrimeReactProviderProps = NonNullable<Parameters<typeof PrimeReactProvider>[0]>;
3
- export declare const ScreenEditorPrimeReactProvider: (props: ScreenEditorPrimeReactProviderProps) => import("react").JSX.Element;
3
+ export declare const ScreenEditorPrimeReactProvider: ({ defaults, theme, ...props }: ScreenEditorPrimeReactProviderProps) => import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ type Defaults = Record<string, unknown>;
2
+ export declare function mergeComponentDefaults<T extends Defaults>(editor: T, host: Defaults | undefined): T;
3
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { ComponentDefaults } from '@primereact/types/core';
2
+ export declare const screenEditorPrimeReactDefaults: ComponentDefaults;
@@ -4,6 +4,7 @@ import type { JsonPropertyFieldStrings } from '../PropertyEditors/Json/JsonPrope
4
4
  import type { Ownership } from '../Structure/Ownership';
5
5
  import type { SceneDocumentProblem } from '../Document/readSceneDocument';
6
6
  import type { StructureEditRejection } from '../Structure/StructureEditRejection';
7
+ import type { SurfaceStrings } from '../Surface/DesignTime/SurfaceStrings';
7
8
  export interface ScreenEditorStrings {
8
9
  inspectorTitle: string;
9
10
  windowLabel: string;
@@ -32,10 +33,12 @@ export interface ScreenEditorStrings {
32
33
  message: string;
33
34
  close: string;
34
35
  };
36
+ surface: SurfaceStrings;
35
37
  undo: string;
36
38
  redo: string;
37
39
  palette: string;
38
40
  layoutDrawer: string;
41
+ packageTitles: Record<string, string>;
39
42
  closeDrawer: string;
40
43
  deleteElement: string;
41
44
  saveRefused: string;
@@ -9,5 +9,6 @@ export interface StructureTreeProps<T> {
9
9
  selectedId?: string;
10
10
  onSelect: (id: string) => void;
11
11
  onEdit: (edit: StructureEdit) => StructureEditRejection | undefined;
12
+ onRemove?: (id: string) => void;
12
13
  }
13
- export declare function StructureTree<T>({ roots, adapter, strings, selectedId, onSelect, onEdit }: StructureTreeProps<T>): import("react").JSX.Element;
14
+ export declare function StructureTree<T>({ roots, adapter, strings, selectedId, onSelect, onEdit, onRemove }: StructureTreeProps<T>): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { PaletteDrawer } from './buildPalette';
2
+ export interface PaletteFoldersProps {
3
+ drawers: readonly PaletteDrawer[];
4
+ closeLabel: string;
5
+ onActivate: (payload: unknown) => void;
6
+ }
7
+ export declare const PaletteFolders: ({ drawers, closeLabel, onActivate }: PaletteFoldersProps) => import("react").JSX.Element;
@@ -5,6 +5,7 @@ import type { LayoutItem } from '../Layouts/LayoutItem';
5
5
  export interface PaletteDrawer {
6
6
  id: string;
7
7
  title: string;
8
+ icon: ReactNode;
8
9
  items: ToolbarDrawerItem[];
9
10
  }
10
11
  export interface PaletteSource {
@@ -16,7 +17,7 @@ export interface PaletteIcons {
16
17
  component: (componentName: string) => ReactNode;
17
18
  drawer: {
18
19
  layout: ReactNode;
19
- package: ReactNode;
20
+ package: (packageName: string) => ReactNode;
20
21
  };
21
22
  }
22
- export declare function buildPalette(layoutTitle: string, labels: LayoutLabels, icons: PaletteIcons, sources: readonly PaletteSource[]): PaletteDrawer[];
23
+ export declare function buildPalette(layoutTitle: string, labels: LayoutLabels, icons: PaletteIcons, sources: readonly PaletteSource[], packageTitles?: Readonly<Record<string, string>>): PaletteDrawer[];
@@ -0,0 +1,2 @@
1
+ import type { InspectedProperty } from '@cratis/scene.model';
2
+ export declare function visibleProperties(properties: InspectedProperty[], inCanvas: boolean, placed: Record<string, unknown> | undefined): InspectedProperty[];
@@ -0,0 +1,2 @@
1
+ import type { Theme } from '@cratis/scene.model';
2
+ export declare function profileColorSchemeClasses(theme: Pick<Theme, 'isDark'> | undefined): string;
@@ -0,0 +1,3 @@
1
+ import type { Theme } from '@cratis/scene.model';
2
+ import type { ScreenEditorRuntime } from './screenEditorRuntime';
3
+ export declare function profileTheme(runtime: Pick<ScreenEditorRuntime, 'bundles' | 'profile'>): Theme | undefined;
@@ -0,0 +1,3 @@
1
+ import { type ComponentDescriptor } from '@cratis/scene.model';
2
+ export declare const contentGroup = "Content";
3
+ export declare function withSampleContentProperties(descriptor: ComponentDescriptor): ComponentDescriptor;
@@ -2,3 +2,5 @@ import type { SceneElement } from '@cratis/scene.model';
2
2
  export declare function childrenOfElement(element: SceneElement): SceneElement[];
3
3
  export declare function everyElementId(roots: readonly SceneElement[]): string[];
4
4
  export declare function findSceneElement(roots: readonly SceneElement[], id: string): SceneElement | undefined;
5
+ export declare function parentOf(roots: readonly SceneElement[], id: string): SceneElement | undefined;
6
+ export declare function isCanvasHolding(roots: readonly SceneElement[], id: string): boolean;
@@ -0,0 +1,15 @@
1
+ export declare const isTypingTarget: (target: EventTarget | null) => boolean;
2
+ export interface DeleteKeyEvent {
3
+ key: string;
4
+ ctrlKey: boolean;
5
+ metaKey: boolean;
6
+ altKey: boolean;
7
+ shiftKey: boolean;
8
+ defaultPrevented: boolean;
9
+ repeat?: boolean;
10
+ target: EventTarget | null;
11
+ nativeEvent?: {
12
+ isComposing?: boolean;
13
+ };
14
+ }
15
+ export declare const isDeleteKey: (event: DeleteKeyEvent) => boolean;
@@ -0,0 +1,3 @@
1
+ import type { StructureTreeAdapter } from './StructureTreeAdapter';
2
+ export declare function isRemovable<T>(roots: T[], id: string, adapter: StructureTreeAdapter<T>): boolean;
3
+ export declare function selectionAfterRemoval<T>(roots: T[], id: string, adapter: StructureTreeAdapter<T>): string | undefined;
@@ -0,0 +1,3 @@
1
+ import type { StructureEdit } from './StructureEdit';
2
+ import type { StructureTreeAdapter } from './StructureTreeAdapter';
3
+ export declare function surfaceMoveEdit<T>(roots: T[], adapter: StructureTreeAdapter<T>, movedId: string, containerId: string, markerIndex: number): StructureEdit | undefined;
@@ -0,0 +1,4 @@
1
+ import { type ComponentType } from 'react';
2
+ import type { RegisteredComponentProps } from '@cratis/scene.react';
3
+ import type { SurfaceStrings } from './SurfaceStrings';
4
+ export declare function designTimeComponent(registryKey: string, Component: ComponentType<RegisteredComponentProps>, strings: SurfaceStrings, message?: ComponentType<RegisteredComponentProps>): ComponentType<RegisteredComponentProps>;
@@ -0,0 +1,7 @@
1
+ import { DesignTimePlaceholderTone } from './DesignTimePlaceholderTone';
2
+ export interface DesignTimePlaceholderProps {
3
+ elementId: string;
4
+ tone: DesignTimePlaceholderTone;
5
+ text: string;
6
+ }
7
+ export declare const DesignTimePlaceholder: ({ elementId, tone, text }: DesignTimePlaceholderProps) => import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export declare enum DesignTimePlaceholderTone {
2
+ Empty = "empty",
3
+ Failed = "failed",
4
+ Declaration = "declaration"
5
+ }
@@ -0,0 +1,12 @@
1
+ import { type ComponentType, type ReactNode } from 'react';
2
+ import type { ExternalComponent } from '@cratis/scene.model';
3
+ import type { RegisteredComponentProps } from '@cratis/scene.react';
4
+ import { OverlayKind } from './overlayKinds';
5
+ export interface OverlayPreviewProps {
6
+ kind: OverlayKind;
7
+ tag: string;
8
+ element: ExternalComponent;
9
+ slots: Record<string, ReactNode[]>;
10
+ message?: ComponentType<RegisteredComponentProps>;
11
+ }
12
+ export declare function OverlayPreview({ kind, tag, element, slots, message }: OverlayPreviewProps): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ export interface SurfaceStrings {
2
+ emptyContainer: string;
3
+ moveHandle: (name: string) => string;
4
+ dropTarget: (where: 'into' | 'between') => string;
5
+ dropDenied: string;
6
+ nothingToShow: (name: string) => string;
7
+ declaration: (name: string) => string;
8
+ sampleContent: (properties: string[]) => string;
9
+ overlay: (name: string) => string;
10
+ unavailable: (name: string) => string;
11
+ failedToDraw: (name: string, reason: string) => string;
12
+ }
@@ -0,0 +1,3 @@
1
+ import type { ComponentRegistry } from '@cratis/scene.react';
2
+ import type { SurfaceStrings } from './SurfaceStrings';
3
+ export declare function designTimeRegistry(registry: ComponentRegistry, strings: SurfaceStrings): ComponentRegistry;
@@ -0,0 +1,7 @@
1
+ export type SampleProperties = Readonly<Record<string, unknown>>;
2
+ export declare const designTimeSamples: Readonly<Record<string, SampleProperties>>;
3
+ export declare const declarationComponents: ReadonlySet<string>;
4
+ export declare const bareNameOf: (componentName: string) => string;
5
+ export declare const sampleOf: (registryKey: string, componentName: string) => SampleProperties | undefined;
6
+ export declare function withSampleProperties(registryKey: string, componentName: string, properties: Readonly<Record<string, unknown>> | undefined): Record<string, unknown>;
7
+ export declare function sampleKeysInUse(registryKey: string, componentName: string, properties: Readonly<Record<string, unknown>> | undefined): string[];
@@ -0,0 +1,8 @@
1
+ export declare enum OverlayKind {
2
+ Window = "window",
3
+ Toast = "toast",
4
+ Tooltip = "tooltip",
5
+ Mask = "mask",
6
+ Busy = "busy"
7
+ }
8
+ export declare const overlayKinds: Readonly<Record<string, OverlayKind>>;
@@ -0,0 +1,3 @@
1
+ import { type RefObject } from 'react';
2
+ export declare const holdsVisibleContent: (probe: Element) => boolean;
3
+ export declare function useRendersVisibleContent(probe: RefObject<HTMLElement | null>, dependency: unknown): boolean;
@@ -0,0 +1,6 @@
1
+ import type { DragFeedback } from './useSurfaceDrop';
2
+ export interface DropIndicatorProps {
3
+ feedback: DragFeedback;
4
+ deniedText: string;
5
+ }
6
+ export declare const DropIndicator: ({ feedback, deniedText }: DropIndicatorProps) => import("react").JSX.Element;
@@ -2,10 +2,13 @@ import type { BindingResolver } from '@cratis/scene.engine';
2
2
  import type { EffectiveConfiguration } from '@cratis/scene.model';
3
3
  import type { ScreenEditorController } from '../Host/ScreenEditorController';
4
4
  import type { ScreenEditorEnvironment } from '../Host/ScreenEditorHost';
5
+ import type { SurfaceStrings } from './DesignTime/SurfaceStrings';
5
6
  export interface ScreenSurfaceProps {
6
7
  controller: ScreenEditorController;
7
8
  environment: ScreenEditorEnvironment;
8
9
  resolveBinding: BindingResolver;
9
10
  configuration?: EffectiveConfiguration;
11
+ strings: SurfaceStrings;
12
+ viewportHeight?: number;
10
13
  }
11
- export declare const ScreenSurface: ({ controller, environment, resolveBinding, configuration }: ScreenSurfaceProps) => import("react").JSX.Element;
14
+ export declare const ScreenSurface: ({ controller, environment, resolveBinding, configuration, strings, viewportHeight }: ScreenSurfaceProps) => import("react").JSX.Element;
@@ -2,6 +2,11 @@ import type { DragEvent } from 'react';
2
2
  import { type PalettePayload } from '../Palette/PaletteEntry';
3
3
  export declare const paletteMediaType = "application/x-studio-palette-item";
4
4
  export declare const elementMediaType = "application/x-studio-element";
5
- export declare const setPaletteDrag: (event: DragEvent, payload: PalettePayload) => void;
5
+ export declare function setDragPreview(event: Pick<DragEvent, 'dataTransfer'>, label: string, icon?: Element | null): void;
6
+ export declare const setPaletteDrag: (event: DragEvent, payload: PalettePayload, label?: string) => void;
7
+ export declare const setElementDrag: (event: DragEvent, elementId: string, label: string) => void;
8
+ export declare const readElementDrag: (event: Pick<DragEvent, 'dataTransfer'>) => string | undefined;
9
+ export declare const isElementDrag: (event: Pick<DragEvent, 'dataTransfer'>) => boolean;
10
+ export declare const isSurfaceDrag: (event: Pick<DragEvent, 'dataTransfer'>) => boolean;
6
11
  export declare function readPaletteDrag(event: Pick<DragEvent, 'dataTransfer'>): PalettePayload | undefined;
7
12
  export declare const isPaletteDrag: (event: Pick<DragEvent, 'dataTransfer'>) => boolean;
@@ -11,4 +11,3 @@ export interface PlacedRegion {
11
11
  rect: Rect;
12
12
  }
13
13
  export declare function placeRegion(region: DropRegion, surface: Rect, rectOf: RectOf): Rect | undefined;
14
- export declare function regionAt(regions: readonly PlacedRegion[], x: number, y: number, slop?: number): PlacedRegion | undefined;
@@ -0,0 +1,2 @@
1
+ import type { Rect } from './dropRegionRects';
2
+ export declare function elementRect(surface: Element, elementId: string, origin: DOMRect): Rect | undefined;
@@ -0,0 +1,6 @@
1
+ import type { PlacedRegion, Rect } from './dropRegionRects';
2
+ export interface ResolvedDrop {
3
+ target: PlacedRegion;
4
+ container: Rect;
5
+ }
6
+ export declare function resolveDropTarget(regions: readonly PlacedRegion[], x: number, y: number, edge?: number): ResolvedDrop | undefined;
@@ -0,0 +1,22 @@
1
+ import { type DragEvent, type RefObject } from 'react';
2
+ import type { ScreenEditorController } from '../Host/ScreenEditorController';
3
+ import type { PlacedRegion } from './dropRegionRects';
4
+ import { type ResolvedDrop } from './resolveDropTarget';
5
+ export interface DragFeedback {
6
+ drop?: ResolvedDrop;
7
+ denied: boolean;
8
+ }
9
+ type Controller = Pick<ScreenEditorController, 'insertComponent' | 'insertLayout' | 'ownershipOf' | 'move' | 'validateMove' | 'composition' | 'adapter'>;
10
+ export declare function useSurfaceDrop(surface: RefObject<HTMLDivElement | null>, measureNow: () => PlacedRegion[], controller: Controller): {
11
+ feedback: DragFeedback | undefined;
12
+ draggedId: string | undefined;
13
+ startMoving: (elementId: string) => void;
14
+ endMoving: () => void;
15
+ handlers: {
16
+ onDragEnter: (event: DragEvent) => void;
17
+ onDragOver: (event: DragEvent) => void;
18
+ onDragLeave: (event: DragEvent) => void;
19
+ onDrop: (event: DragEvent) => void;
20
+ };
21
+ };
22
+ export {};
@@ -0,0 +1,9 @@
1
+ import { type RefObject } from 'react';
2
+ import type { DropRegion } from '../DropRegions/DropRegion';
3
+ import { type PlacedRegion, type Rect } from './dropRegionRects';
4
+ export interface SurfaceMeasurement {
5
+ placed: PlacedRegion[];
6
+ selectionRect: Rect | undefined;
7
+ measureNow: () => PlacedRegion[];
8
+ }
9
+ export declare function useSurfaceMeasurement(surface: RefObject<HTMLDivElement | null>, dropRegions: readonly DropRegion[], selectedId: string | undefined): SurfaceMeasurement;
@@ -1,5 +1,6 @@
1
1
  export * from './Host/ScreenEditorOverlay';
2
2
  export * from './Host/ScreenEditorPrimeReactProvider';
3
+ export * from './Host/screenEditorPrimeReactDefaults';
3
4
  export * from './Host/ScreenEditorWorkspace';
4
5
  export * from './Host/ScreenEditorWindow';
5
6
  export * from './Host/ScreenEditorController';