@nous-excalidraw/math 0.18.4 → 0.18.5-beta.5

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 (53) hide show
  1. package/dist/types/common/src/constants.d.ts +1 -0
  2. package/dist/types/common/src/fontSize.d.ts +22 -0
  3. package/dist/types/common/src/index.d.ts +2 -0
  4. package/dist/types/common/src/strokeWidth.d.ts +14 -0
  5. package/dist/types/element/src/Scene.d.ts +1 -1
  6. package/dist/types/element/src/bounds.d.ts +5 -0
  7. package/dist/types/element/src/comparisons.d.ts +5 -5
  8. package/dist/types/element/src/frame.d.ts +2 -2
  9. package/dist/types/element/src/typeChecks.d.ts +3 -1
  10. package/dist/types/element/src/types.d.ts +8 -5
  11. package/dist/types/element/src/utils.d.ts +3 -1
  12. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +6 -0
  13. package/dist/types/excalidraw/actions/actionBoundText.d.ts +4 -0
  14. package/dist/types/excalidraw/actions/actionCanvas.d.ts +31 -7
  15. package/dist/types/excalidraw/actions/actionClipboard.d.ts +4 -0
  16. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +2 -0
  17. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +6 -0
  18. package/dist/types/excalidraw/actions/actionDeselect.d.ts +2 -0
  19. package/dist/types/excalidraw/actions/actionElementLink.d.ts +2 -0
  20. package/dist/types/excalidraw/actions/actionElementLock.d.ts +4 -0
  21. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +2 -0
  22. package/dist/types/excalidraw/actions/actionExport.d.ts +5 -1
  23. package/dist/types/excalidraw/actions/actionFrame.d.ts +42 -0
  24. package/dist/types/excalidraw/actions/actionGroup.d.ts +4 -0
  25. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +36 -0
  26. package/dist/types/excalidraw/actions/actionLink.d.ts +2 -0
  27. package/dist/types/excalidraw/actions/actionMenu.d.ts +2 -0
  28. package/dist/types/excalidraw/actions/actionProperties.d.ts +4 -0
  29. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +2 -0
  30. package/dist/types/excalidraw/actions/actionStyles.d.ts +2 -0
  31. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +2 -0
  32. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +2 -0
  33. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +2 -0
  34. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +2 -0
  35. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +2 -0
  36. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -0
  37. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +2 -0
  38. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -0
  39. package/dist/types/excalidraw/components/App.d.ts +13 -0
  40. package/dist/types/excalidraw/components/FrameResizeDimensionLabel.d.ts +8 -0
  41. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -0
  42. package/dist/types/excalidraw/components/icons.d.ts +1 -0
  43. package/dist/types/excalidraw/components/shapes.d.ts +22 -1
  44. package/dist/types/excalidraw/data/blob.d.ts +6 -2
  45. package/dist/types/excalidraw/data/json.d.ts +3 -1
  46. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
  47. package/dist/types/excalidraw/scene/types.d.ts +3 -0
  48. package/dist/types/excalidraw/scene/zoom.d.ts +2 -0
  49. package/dist/types/excalidraw/snapping.d.ts +1 -1
  50. package/dist/types/excalidraw/types.d.ts +12 -1
  51. package/dist/types/utils/src/shape.d.ts +2 -2
  52. package/package.json +2 -2
  53. package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -5
@@ -36,6 +36,8 @@ export declare const actionSelectAllElementsInFrame: {
36
36
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
37
37
  } | null;
38
38
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
39
+ hoverOutlineElementId: string | null;
40
+ hoveredFrameId: string | null;
39
41
  frameRendering: {
40
42
  enabled: boolean;
41
43
  name: boolean;
@@ -212,6 +214,8 @@ export declare const actionRemoveAllElementsFromFrame: {
212
214
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
213
215
  } | null;
214
216
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
217
+ hoverOutlineElementId: string | null;
218
+ hoveredFrameId: string | null;
215
219
  frameRendering: {
216
220
  enabled: boolean;
217
221
  name: boolean;
@@ -392,6 +396,8 @@ export declare const actionupdateFrameRendering: {
392
396
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
393
397
  } | null;
394
398
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
399
+ hoverOutlineElementId: string | null;
400
+ hoveredFrameId: string | null;
395
401
  editingFrame: string | null;
396
402
  elementsToHighlight: import("@nous-excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
397
403
  editingTextElement: import("@nous-excalidraw/element/types").ExcalidrawTextElement | null;
@@ -565,6 +571,8 @@ export declare const actionSetFrameAsActiveTool: {
565
571
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
566
572
  } | null;
567
573
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
574
+ hoverOutlineElementId: string | null;
575
+ hoveredFrameId: string | null;
568
576
  frameRendering: {
569
577
  enabled: boolean;
570
578
  name: boolean;
@@ -876,6 +884,40 @@ export declare const actionWrapSelectionInFrame: {
876
884
  link: string | null;
877
885
  locked: boolean;
878
886
  customData?: Record<string, any>;
887
+ }> & {
888
+ type: "triangle";
889
+ } & {
890
+ index: import("@nous-excalidraw/element/types").FractionalIndex;
891
+ }) | (Readonly<{
892
+ id: string;
893
+ x: number;
894
+ y: number;
895
+ strokeColor: string;
896
+ backgroundColor: string;
897
+ fillStyle: import("@nous-excalidraw/element/types").FillStyle;
898
+ strokeWidth: number;
899
+ strokeStyle: import("@nous-excalidraw/element/types").StrokeStyle;
900
+ roundness: null | {
901
+ type: import("@nous-excalidraw/element/types").RoundnessType;
902
+ value?: number;
903
+ };
904
+ roughness: number;
905
+ opacity: number;
906
+ width: number;
907
+ height: number;
908
+ angle: import("@nous-excalidraw/math").Radians;
909
+ seed: number;
910
+ version: number;
911
+ versionNonce: number;
912
+ index: import("@nous-excalidraw/element/types").FractionalIndex | null;
913
+ isDeleted: boolean;
914
+ groupIds: readonly import("@nous-excalidraw/element/types").GroupId[];
915
+ frameId: string | null;
916
+ boundElements: readonly import("@nous-excalidraw/element/types").BoundElement[] | null;
917
+ updated: number;
918
+ link: string | null;
919
+ locked: boolean;
920
+ customData?: Record<string, any>;
879
921
  }> & {
880
922
  type: "ellipse";
881
923
  } & {
@@ -42,6 +42,8 @@ export declare const actionGroup: {
42
42
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
43
43
  } | null;
44
44
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
45
+ hoverOutlineElementId: string | null;
46
+ hoveredFrameId: string | null;
45
47
  frameRendering: {
46
48
  enabled: boolean;
47
49
  name: boolean;
@@ -217,6 +219,8 @@ export declare const actionUngroup: {
217
219
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
218
220
  } | null;
219
221
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
222
+ hoverOutlineElementId: string | null;
223
+ hoveredFrameId: string | null;
220
224
  frameRendering: {
221
225
  enabled: boolean;
222
226
  name: boolean;
@@ -69,6 +69,8 @@ export declare const actionToggleLinearEditor: {
69
69
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
70
70
  } | null;
71
71
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
72
+ hoverOutlineElementId: string | null;
73
+ hoveredFrameId: string | null;
72
74
  frameRendering: {
73
75
  enabled: boolean;
74
76
  name: boolean;
@@ -387,6 +389,40 @@ export declare const actionTogglePolygon: {
387
389
  link: string | null;
388
390
  locked: boolean;
389
391
  customData?: Record<string, any>;
392
+ }> & {
393
+ type: "triangle";
394
+ } & {
395
+ index: import("@nous-excalidraw/element/types").FractionalIndex;
396
+ }) | (Readonly<{
397
+ id: string;
398
+ x: number;
399
+ y: number;
400
+ strokeColor: string;
401
+ backgroundColor: string;
402
+ fillStyle: import("@nous-excalidraw/element/types").FillStyle;
403
+ strokeWidth: number;
404
+ strokeStyle: import("@nous-excalidraw/element/types").StrokeStyle;
405
+ roundness: null | {
406
+ type: import("@nous-excalidraw/element/types").RoundnessType;
407
+ value?: number;
408
+ };
409
+ roughness: number;
410
+ opacity: number;
411
+ width: number;
412
+ height: number;
413
+ angle: import("@nous-excalidraw/math").Radians;
414
+ seed: number;
415
+ version: number;
416
+ versionNonce: number;
417
+ index: import("@nous-excalidraw/element/types").FractionalIndex | null;
418
+ isDeleted: boolean;
419
+ groupIds: readonly import("@nous-excalidraw/element/types").GroupId[];
420
+ frameId: string | null;
421
+ boundElements: readonly import("@nous-excalidraw/element/types").BoundElement[] | null;
422
+ updated: number;
423
+ link: string | null;
424
+ locked: boolean;
425
+ customData?: Record<string, any>;
390
426
  }> & {
391
427
  type: "ellipse";
392
428
  } & {
@@ -33,6 +33,8 @@ export declare const actionLink: {
33
33
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
34
34
  } | null;
35
35
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
36
+ hoverOutlineElementId: string | null;
37
+ hoveredFrameId: string | null;
36
38
  frameRendering: {
37
39
  enabled: boolean;
38
40
  name: boolean;
@@ -40,6 +40,8 @@ export declare const actionShortcuts: {
40
40
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
41
41
  } | null;
42
42
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
43
+ hoverOutlineElementId: string | null;
44
+ hoveredFrameId: string | null;
43
45
  frameRendering: {
44
46
  enabled: boolean;
45
47
  name: boolean;
@@ -62,6 +62,8 @@ export declare const actionDecreaseFontSize: {
62
62
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
63
63
  } | null;
64
64
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
65
+ hoverOutlineElementId: string | null;
66
+ hoveredFrameId: string | null;
65
67
  frameRendering: {
66
68
  enabled: boolean;
67
69
  name: boolean;
@@ -233,6 +235,8 @@ export declare const actionIncreaseFontSize: {
233
235
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
234
236
  } | null;
235
237
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
238
+ hoverOutlineElementId: string | null;
239
+ hoveredFrameId: string | null;
236
240
  frameRendering: {
237
241
  enabled: boolean;
238
242
  name: boolean;
@@ -40,6 +40,8 @@ export declare const actionSelectAll: {
40
40
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
41
41
  } | null;
42
42
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
43
+ hoverOutlineElementId: string | null;
44
+ hoveredFrameId: string | null;
43
45
  frameRendering: {
44
46
  enabled: boolean;
45
47
  name: boolean;
@@ -38,6 +38,8 @@ export declare const actionCopyStyles: {
38
38
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
39
39
  } | null;
40
40
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
41
+ hoverOutlineElementId: string | null;
42
+ hoveredFrameId: string | null;
41
43
  frameRendering: {
42
44
  enabled: boolean;
43
45
  name: boolean;
@@ -34,6 +34,8 @@ export declare const actionToggleArrowBinding: {
34
34
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
35
35
  } | null;
36
36
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
37
+ hoverOutlineElementId: string | null;
38
+ hoveredFrameId: string | null;
37
39
  frameRendering: {
38
40
  enabled: boolean;
39
41
  name: boolean;
@@ -39,6 +39,8 @@ export declare const actionToggleGridMode: {
39
39
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
40
40
  } | null;
41
41
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
42
+ hoverOutlineElementId: string | null;
43
+ hoveredFrameId: string | null;
42
44
  frameRendering: {
43
45
  enabled: boolean;
44
46
  name: boolean;
@@ -34,6 +34,8 @@ export declare const actionToggleMidpointSnapping: {
34
34
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
35
35
  } | null;
36
36
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
37
+ hoverOutlineElementId: string | null;
38
+ hoveredFrameId: string | null;
37
39
  frameRendering: {
38
40
  enabled: boolean;
39
41
  name: boolean;
@@ -37,6 +37,8 @@ export declare const actionToggleObjectsSnapMode: {
37
37
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
38
38
  } | null;
39
39
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
40
+ hoverOutlineElementId: string | null;
41
+ hoveredFrameId: string | null;
40
42
  frameRendering: {
41
43
  enabled: boolean;
42
44
  name: boolean;
@@ -43,6 +43,8 @@ export declare const actionToggleSearchMenu: {
43
43
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
44
44
  } | null;
45
45
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
46
+ hoverOutlineElementId: string | null;
47
+ hoveredFrameId: string | null;
46
48
  frameRendering: {
47
49
  enabled: boolean;
48
50
  name: boolean;
@@ -39,6 +39,8 @@ export declare const actionToggleStats: {
39
39
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
40
40
  } | null;
41
41
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
42
+ hoverOutlineElementId: string | null;
43
+ hoveredFrameId: string | null;
42
44
  frameRendering: {
43
45
  enabled: boolean;
44
46
  name: boolean;
@@ -36,6 +36,8 @@ export declare const actionToggleViewMode: {
36
36
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
37
37
  } | null;
38
38
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
39
+ hoverOutlineElementId: string | null;
40
+ hoveredFrameId: string | null;
39
41
  frameRendering: {
40
42
  enabled: boolean;
41
43
  name: boolean;
@@ -36,6 +36,8 @@ export declare const actionToggleZenMode: {
36
36
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
37
37
  } | null;
38
38
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
39
+ hoverOutlineElementId: string | null;
40
+ hoveredFrameId: string | null;
39
41
  frameRendering: {
40
42
  enabled: boolean;
41
43
  name: boolean;
@@ -67,6 +67,7 @@ export declare const useExcalidrawAPI: () => ExcalidrawImperativeAPI | null;
67
67
  declare class App extends React.Component<AppProps, AppState> {
68
68
  canvas: AppClassProperties["canvas"];
69
69
  interactiveCanvas: AppClassProperties["interactiveCanvas"];
70
+ outlineOverlayCanvas: AppClassProperties["outlineOverlayCanvas"];
70
71
  sessionExportThemeOverride: AppState["theme"] | undefined;
71
72
  rc: RoughCanvas;
72
73
  unmounted: boolean;
@@ -481,6 +482,12 @@ declare class App extends React.Component<AppProps, AppState> {
481
482
  private getTextElementAtPosition;
482
483
  private isHittingTextAutoResizeHandle;
483
484
  private handleTextAutoResizeHandlePointerDown;
485
+ /**
486
+ * When a frame wins z-order at a point, its full interior still hits — so
487
+ * images/embeds below it in the stack never surface. Prefer the topmost
488
+ * descendant in the same hit stack that passes a real geometry hit.
489
+ */
490
+ private getTopFrameDescendantHitUnderPoint;
484
491
  private getElementAtPosition;
485
492
  private getElementsAtPosition;
486
493
  getElementHitThreshold(element: ExcalidrawElement): number;
@@ -495,6 +502,11 @@ declare class App extends React.Component<AppProps, AppState> {
495
502
  private getElementLinkAtPosition;
496
503
  private handleElementLinkClick;
497
504
  private getTopLayerFrameAtSceneCoords;
505
+ private clearHoverOutlineIfNeeded;
506
+ /** Unified frame hover: title band, frame interior, or any element inside the frame. */
507
+ private computeHoveredFrameId;
508
+ private updateFrameHoverAndOutline;
509
+ private updateFrameHoverStateFromSceneCoords;
498
510
  private handleCanvasPointerMove;
499
511
  private handleEraser;
500
512
  private handleTouchMove;
@@ -565,6 +577,7 @@ declare class App extends React.Component<AppProps, AppState> {
565
577
  * to render new images. This is just a failsafe */
566
578
  private scheduleImageRefresh;
567
579
  private clearSelection;
580
+ private handleOutlineOverlayCanvasRef;
568
581
  private handleInteractiveCanvasRef;
569
582
  private insertImages;
570
583
  private handleAppOnDrop;
@@ -0,0 +1,8 @@
1
+ import type { ElementsMap, NonDeletedExcalidrawElement } from "@nous-excalidraw/element/types";
2
+ import type { AppState } from "../types";
3
+ import "./FrameResizeDimensionLabel.scss";
4
+ export declare const FrameResizeDimensionLabel: ({ element, elementsMap, appState, }: {
5
+ element: NonDeletedExcalidrawElement;
6
+ elementsMap: ElementsMap;
7
+ appState: AppState;
8
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -7,6 +7,7 @@ import type { DOMAttributes } from "react";
7
7
  type InteractiveCanvasProps = {
8
8
  containerRef: React.RefObject<HTMLDivElement | null>;
9
9
  canvas: HTMLCanvasElement | null;
10
+ outlineOverlayCanvas: HTMLCanvasElement | null;
10
11
  elementsMap: RenderableElementsMap;
11
12
  visibleElements: readonly NonDeletedExcalidrawElement[];
12
13
  selectedElements: readonly NonDeletedExcalidrawElement[];
@@ -25,6 +25,7 @@ export declare const SelectionIcon: import("react/jsx-runtime").JSX.Element;
25
25
  export declare const LassoIcon: import("react/jsx-runtime").JSX.Element;
26
26
  export declare const RectangleIcon: import("react/jsx-runtime").JSX.Element;
27
27
  export declare const DiamondIcon: import("react/jsx-runtime").JSX.Element;
28
+ export declare const TriangleIcon: import("react/jsx-runtime").JSX.Element;
28
29
  export declare const EllipseIcon: import("react/jsx-runtime").JSX.Element;
29
30
  export declare const ArrowIcon: import("react/jsx-runtime").JSX.Element;
30
31
  export declare const LineIcon: import("react/jsx-runtime").JSX.Element;
@@ -27,6 +27,13 @@ export declare const SHAPES: readonly [{
27
27
  readonly numericKey: "3";
28
28
  readonly fillable: true;
29
29
  readonly toolbar: true;
30
+ }, {
31
+ readonly icon: import("react/jsx-runtime").JSX.Element;
32
+ readonly value: "triangle";
33
+ readonly key: "g";
34
+ readonly numericKey: null;
35
+ readonly fillable: true;
36
+ readonly toolbar: true;
30
37
  }, {
31
38
  readonly icon: import("react/jsx-runtime").JSX.Element;
32
39
  readonly value: "ellipse";
@@ -112,6 +119,13 @@ export declare const getToolbarTools: (app: AppClassProperties) => readonly [{
112
119
  readonly numericKey: "3";
113
120
  readonly fillable: true;
114
121
  readonly toolbar: true;
122
+ }, {
123
+ readonly icon: import("react/jsx-runtime").JSX.Element;
124
+ readonly value: "triangle";
125
+ readonly key: "g";
126
+ readonly numericKey: null;
127
+ readonly fillable: true;
128
+ readonly toolbar: true;
115
129
  }, {
116
130
  readonly icon: import("react/jsx-runtime").JSX.Element;
117
131
  readonly value: "ellipse";
@@ -203,6 +217,13 @@ export declare const getToolbarTools: (app: AppClassProperties) => readonly [{
203
217
  readonly numericKey: "3";
204
218
  readonly fillable: true;
205
219
  readonly toolbar: true;
220
+ } | {
221
+ readonly icon: import("react/jsx-runtime").JSX.Element;
222
+ readonly value: "triangle";
223
+ readonly key: "g";
224
+ readonly numericKey: null;
225
+ readonly fillable: true;
226
+ readonly toolbar: true;
206
227
  } | {
207
228
  readonly icon: import("react/jsx-runtime").JSX.Element;
208
229
  readonly value: "ellipse";
@@ -260,4 +281,4 @@ export declare const getToolbarTools: (app: AppClassProperties) => readonly [{
260
281
  readonly fillable: false;
261
282
  readonly toolbar: false;
262
283
  })[]];
263
- export declare const findShapeByKey: (key: string, app: AppClassProperties) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "lasso" | "eraser" | "hand" | "laser" | null;
284
+ export declare const findShapeByKey: (key: string, app: AppClassProperties) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "triangle" | "ellipse" | "image" | "freedraw" | "lasso" | "eraser" | "hand" | "laser" | null;
@@ -55,6 +55,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
55
55
  [id: string]: true;
56
56
  }>;
57
57
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
58
+ hoverOutlineElementId: string | null;
58
59
  activeTool: {
59
60
  lastActiveTool: import("../types").ActiveTool | null;
60
61
  locked: boolean;
@@ -96,6 +97,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
96
97
  shouldCacheIgnoreZoom: boolean;
97
98
  exportScale: number;
98
99
  currentItemArrowType: "sharp" | "round" | "elbow";
100
+ selectedElementsAreBeingDragged: boolean;
99
101
  bindMode: import("@nous-excalidraw/element/types").BindMode;
100
102
  gridSize: number;
101
103
  contextMenu: {
@@ -110,6 +112,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
110
112
  boxSelectionMode: import("../types").BoxSelectionMode;
111
113
  bindingPreference: "enabled" | "disabled";
112
114
  startBoundElement: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawBindableElement> | null;
115
+ hoveredFrameId: string | null;
113
116
  editingFrame: string | null;
114
117
  preferredSelectionTool: {
115
118
  type: "selection" | "lasso";
@@ -148,7 +151,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
148
151
  previousSelectedElementIds: {
149
152
  [id: string]: true;
150
153
  };
151
- selectedElementsAreBeingDragged: boolean;
152
154
  toast: {
153
155
  message: React.ReactNode;
154
156
  closable?: boolean;
@@ -221,6 +223,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
221
223
  [id: string]: true;
222
224
  }>;
223
225
  frameToHighlight: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
226
+ hoverOutlineElementId: string | null;
224
227
  activeTool: {
225
228
  lastActiveTool: import("../types").ActiveTool | null;
226
229
  locked: boolean;
@@ -262,6 +265,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
262
265
  shouldCacheIgnoreZoom: boolean;
263
266
  exportScale: number;
264
267
  currentItemArrowType: "sharp" | "round" | "elbow";
268
+ selectedElementsAreBeingDragged: boolean;
265
269
  bindMode: import("@nous-excalidraw/element/types").BindMode;
266
270
  gridSize: number;
267
271
  contextMenu: {
@@ -276,6 +280,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
276
280
  boxSelectionMode: import("../types").BoxSelectionMode;
277
281
  bindingPreference: "enabled" | "disabled";
278
282
  startBoundElement: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawBindableElement> | null;
283
+ hoveredFrameId: string | null;
279
284
  editingFrame: string | null;
280
285
  preferredSelectionTool: {
281
286
  type: "selection" | "lasso";
@@ -314,7 +319,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
314
319
  previousSelectedElementIds: {
315
320
  [id: string]: true;
316
321
  };
317
- selectedElementsAreBeingDragged: boolean;
318
322
  toast: {
319
323
  message: React.ReactNode;
320
324
  closable?: boolean;
@@ -53,6 +53,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
53
53
  [id: string]: true;
54
54
  }>;
55
55
  frameToHighlight: NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
56
+ hoverOutlineElementId: string | null;
56
57
  activeTool: {
57
58
  lastActiveTool: import("../types").ActiveTool | null;
58
59
  locked: boolean;
@@ -94,6 +95,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
94
95
  shouldCacheIgnoreZoom: boolean;
95
96
  exportScale: number;
96
97
  currentItemArrowType: "sharp" | "round" | "elbow";
98
+ selectedElementsAreBeingDragged: boolean;
97
99
  bindMode: import("@nous-excalidraw/element/types").BindMode;
98
100
  gridSize: number;
99
101
  contextMenu: {
@@ -108,6 +110,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
108
110
  boxSelectionMode: import("../types").BoxSelectionMode;
109
111
  bindingPreference: "enabled" | "disabled";
110
112
  startBoundElement: NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawBindableElement> | null;
113
+ hoveredFrameId: string | null;
111
114
  editingFrame: string | null;
112
115
  preferredSelectionTool: {
113
116
  type: "selection" | "lasso";
@@ -146,7 +149,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
146
149
  previousSelectedElementIds: {
147
150
  [id: string]: true;
148
151
  };
149
- selectedElementsAreBeingDragged: boolean;
150
152
  toast: {
151
153
  message: React.ReactNode;
152
154
  closable?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { getScrollBars } from "../scene/scrollbars";
2
2
  import type { InteractiveSceneRenderConfig, RenderableElementsMap } from "../scene/types";
3
- declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
3
+ declare const _renderInteractiveScene: ({ app, canvas, outlineOverlayCanvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
4
4
  scrollBars?: ReturnType<typeof getScrollBars>;
5
5
  atLeastOneVisibleElement: boolean;
6
6
  elementsMap: RenderableElementsMap;
@@ -74,6 +74,8 @@ export type InteractiveSceneRenderAnimationState = {
74
74
  export type InteractiveSceneRenderConfig = {
75
75
  app: AppClassProperties;
76
76
  canvas: HTMLCanvasElement | null;
77
+ /** When set, hover outline + selection borders render here so they paint above DOM embeds (iframes). */
78
+ outlineOverlayCanvas?: HTMLCanvasElement | null;
77
79
  elementsMap: RenderableElementsMap;
78
80
  visibleElements: readonly NonDeletedExcalidrawElement[];
79
81
  selectedElements: readonly NonDeletedExcalidrawElement[];
@@ -125,6 +127,7 @@ export type ElementShapes = {
125
127
  rectangle: Drawable;
126
128
  ellipse: Drawable;
127
129
  diamond: Drawable;
130
+ triangle: Drawable;
128
131
  iframe: Drawable;
129
132
  embeddable: Drawable;
130
133
  freedraw: (Drawable | SVGPathString)[];
@@ -9,4 +9,6 @@ export declare const getStateForZoom: ({ viewportX, viewportY, nextZoom, }: {
9
9
  zoom: {
10
10
  value: NormalizedZoomValue;
11
11
  };
12
+ currentItemStrokeWidth: number;
13
+ currentItemFontSize: number;
12
14
  };
@@ -107,5 +107,5 @@ export declare const getSnapLinesAtPointer: (elements: readonly ExcalidrawElemen
107
107
  };
108
108
  snapLines: PointerSnapLine[];
109
109
  };
110
- export declare const isActiveToolNonLinearSnappable: (activeToolType: AppState["activeTool"]["type"]) => activeToolType is "text" | "rectangle" | "diamond" | "ellipse" | "image" | "frame" | "magicframe";
110
+ export declare const isActiveToolNonLinearSnappable: (activeToolType: AppState["activeTool"]["type"]) => activeToolType is "text" | "rectangle" | "diamond" | "triangle" | "ellipse" | "image" | "frame" | "magicframe";
111
111
  export {};
@@ -84,7 +84,7 @@ export type BinaryFileData = {
84
84
  };
85
85
  export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
86
86
  export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
87
- export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser";
87
+ export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "triangle" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser";
88
88
  export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
89
89
  export type ActiveTool = {
90
90
  type: ToolType;
@@ -129,6 +129,7 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
129
129
  croppingElementId: AppState["croppingElementId"];
130
130
  }>;
131
131
  export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
132
+ hoverOutlineElementId: AppState["hoverOutlineElementId"];
132
133
  activeTool: AppState["activeTool"];
133
134
  activeEmbeddable: AppState["activeEmbeddable"];
134
135
  selectionElement: AppState["selectionElement"];
@@ -154,6 +155,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
154
155
  shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
155
156
  exportScale: AppState["exportScale"];
156
157
  currentItemArrowType: AppState["currentItemArrowType"];
158
+ selectedElementsAreBeingDragged: AppState["selectedElementsAreBeingDragged"];
157
159
  }>;
158
160
  export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
159
161
  export type ObservedStandaloneAppState = {
@@ -223,6 +225,13 @@ export interface AppState {
223
225
  midPoint?: GlobalPoint;
224
226
  } | null;
225
227
  frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
228
+ /** Interactive canvas: 2px screen hover outline for frame / image / embeddable */
229
+ hoverOutlineElementId: string | null;
230
+ /**
231
+ * Frame under cursor for unified hover (title + outline): frame rect, label,
232
+ * or any child inside the frame.
233
+ */
234
+ hoveredFrameId: string | null;
226
235
  frameRendering: {
227
236
  enabled: boolean;
228
237
  name: boolean;
@@ -601,6 +610,8 @@ export type AppClassProperties = {
601
610
  api: App["api"];
602
611
  sessionExportThemeOverride: App["sessionExportThemeOverride"];
603
612
  interactiveCanvas: HTMLCanvasElement | null;
613
+ /** Renders selection/hover outlines above embed layer; pointer-events none */
614
+ outlineOverlayCanvas: HTMLCanvasElement | null;
604
615
  /** static canvas */
605
616
  canvas: HTMLCanvasElement;
606
617
  focusContainer(): void;
@@ -1,5 +1,5 @@
1
1
  import { type GlobalPoint, type LocalPoint } from "@nous-excalidraw/math";
2
- import type { ElementsMap, ExcalidrawBindableElement, ExcalidrawDiamondElement, ExcalidrawElement, ExcalidrawEllipseElement, ExcalidrawEmbeddableElement, ExcalidrawFrameLikeElement, ExcalidrawFreeDrawElement, ExcalidrawIframeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawRectangleElement, ExcalidrawSelectionElement, ExcalidrawTextElement } from "@nous-excalidraw/element/types";
2
+ import type { ElementsMap, ExcalidrawBindableElement, ExcalidrawDiamondElement, ExcalidrawTriangleElement, ExcalidrawElement, ExcalidrawEllipseElement, ExcalidrawEmbeddableElement, ExcalidrawFrameLikeElement, ExcalidrawFreeDrawElement, ExcalidrawIframeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawRectangleElement, ExcalidrawSelectionElement, ExcalidrawTextElement } from "@nous-excalidraw/element/types";
3
3
  import type { Curve, LineSegment, Polygon, Radians } from "@nous-excalidraw/math";
4
4
  import type { Drawable, Op } from "roughjs/bin/core";
5
5
  export type Polyline<Point extends GlobalPoint | LocalPoint> = LineSegment<Point>[];
@@ -29,7 +29,7 @@ export type GeometricShape<Point extends GlobalPoint | LocalPoint> = {
29
29
  type: "polycurve";
30
30
  data: Polycurve<Point>;
31
31
  };
32
- type RectangularElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawTextElement | ExcalidrawSelectionElement;
32
+ type RectangularElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawTriangleElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawTextElement | ExcalidrawSelectionElement;
33
33
  export declare const getPolygonShape: <Point extends GlobalPoint | LocalPoint>(element: RectangularElement) => GeometricShape<Point>;
34
34
  export declare const getSelectionBoxShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap, padding?: number) => GeometricShape<Point>;
35
35
  export declare const getEllipseShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawEllipseElement) => GeometricShape<Point>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nous-excalidraw/math",
3
- "version": "0.18.4",
3
+ "version": "0.18.5-beta.5",
4
4
  "type": "module",
5
5
  "types": "./dist/types/math/src/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -61,6 +61,6 @@
61
61
  "build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
62
62
  },
63
63
  "dependencies": {
64
- "@nous-excalidraw/common": "0.18.4"
64
+ "@nous-excalidraw/common": "0.18.5-beta.5"
65
65
  }
66
66
  }
@@ -1,5 +0,0 @@
1
- import type { Theme } from "@nous-excalidraw/element/types";
2
- export declare const LoadingMessage: React.FC<{
3
- delay?: number;
4
- theme?: Theme;
5
- }>;