@excalidraw/math 0.18.0-7876ee524 → 0.18.0-7f66e1f

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 (89) hide show
  1. package/dist/dev/index.js +58 -61
  2. package/dist/dev/index.js.map +3 -3
  3. package/dist/prod/index.js +1 -1
  4. package/dist/types/common/src/constants.d.ts +18 -15
  5. package/dist/types/common/src/editorInterface.d.ts +34 -0
  6. package/dist/types/common/src/index.d.ts +2 -0
  7. package/dist/types/common/src/utils.d.ts +2 -1
  8. package/dist/types/common/src/visualdebug.d.ts +41 -0
  9. package/dist/types/element/src/bounds.d.ts +1 -1
  10. package/dist/types/element/src/delta.d.ts +1 -2
  11. package/dist/types/element/src/index.d.ts +1 -0
  12. package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
  13. package/dist/types/element/src/renderElement.d.ts +4 -1
  14. package/dist/types/element/src/resizeTest.d.ts +5 -4
  15. package/dist/types/element/src/store.d.ts +3 -2
  16. package/dist/types/element/src/textElement.d.ts +1 -1
  17. package/dist/types/element/src/transformHandles.d.ts +5 -4
  18. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +21 -9
  19. package/dist/types/excalidraw/actions/actionBoundText.d.ts +14 -6
  20. package/dist/types/excalidraw/actions/actionCanvas.d.ts +94 -41
  21. package/dist/types/excalidraw/actions/actionClipboard.d.ts +42 -18
  22. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +7 -3
  23. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +22 -10
  24. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
  25. package/dist/types/excalidraw/actions/actionElementLink.d.ts +7 -3
  26. package/dist/types/excalidraw/actions/actionElementLock.d.ts +14 -6
  27. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +7 -3
  28. package/dist/types/excalidraw/actions/actionExport.d.ts +63 -27
  29. package/dist/types/excalidraw/actions/actionFinalize.d.ts +14 -6
  30. package/dist/types/excalidraw/actions/actionFrame.d.ts +28 -12
  31. package/dist/types/excalidraw/actions/actionGroup.d.ts +14 -6
  32. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +8 -4
  33. package/dist/types/excalidraw/actions/actionLink.d.ts +5 -1
  34. package/dist/types/excalidraw/actions/actionMenu.d.ts +7 -369
  35. package/dist/types/excalidraw/actions/actionNavigate.d.ts +14 -6
  36. package/dist/types/excalidraw/actions/actionProperties.d.ts +122 -53
  37. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +7 -3
  38. package/dist/types/excalidraw/actions/actionStyles.d.ts +7 -3
  39. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +7 -3
  40. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +7 -3
  41. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +7 -3
  42. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +7 -3
  43. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +7 -3
  44. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +8 -4
  45. package/dist/types/excalidraw/actions/index.d.ts +2 -2
  46. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  47. package/dist/types/excalidraw/appState.d.ts +5 -1
  48. package/dist/types/excalidraw/clipboard.d.ts +64 -1
  49. package/dist/types/excalidraw/components/Actions.d.ts +21 -4
  50. package/dist/types/excalidraw/components/App.d.ts +27 -23
  51. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
  52. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
  53. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
  54. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  55. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
  56. package/dist/types/excalidraw/components/FilledButton.d.ts +1 -1
  57. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  58. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  59. package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
  60. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  61. package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
  62. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
  63. package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
  64. package/dist/types/excalidraw/components/MobileToolBar.d.ts +11 -0
  65. package/dist/types/excalidraw/components/Popover.d.ts +2 -1
  66. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
  67. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
  68. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  69. package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
  70. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +6 -3
  71. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
  72. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
  73. package/dist/types/excalidraw/components/icons.d.ts +10 -0
  74. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +13 -1
  75. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
  76. package/dist/types/excalidraw/components/shapes.d.ts +129 -1
  77. package/dist/types/excalidraw/data/blob.d.ts +3 -7
  78. package/dist/types/excalidraw/data/types.d.ts +4 -1
  79. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  80. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +3 -1
  81. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  82. package/dist/types/excalidraw/index.d.ts +2 -3
  83. package/dist/types/excalidraw/renderer/animation.d.ts +12 -0
  84. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +5 -13
  85. package/dist/types/excalidraw/scene/types.d.ts +11 -3
  86. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  87. package/dist/types/excalidraw/types.d.ts +18 -15
  88. package/dist/types/math/src/segment.d.ts +1 -0
  89. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES } from "@excalidraw/common";
1
+ import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, EditorInterface } from "@excalidraw/common";
2
2
  import type { SuggestedBinding } from "@excalidraw/element";
3
3
  import type { LinearElementEditor } from "@excalidraw/element";
4
4
  import type { MaybeTransformHandleType } from "@excalidraw/element";
@@ -221,6 +221,10 @@ export interface AppState {
221
221
  locked: boolean;
222
222
  fromSelection: boolean;
223
223
  } & ActiveTool;
224
+ preferredSelectionTool: {
225
+ type: "selection" | "lasso";
226
+ initialized: boolean;
227
+ };
224
228
  penMode: boolean;
225
229
  penDetected: boolean;
226
230
  exportBackground: boolean;
@@ -251,8 +255,8 @@ export interface AppState {
251
255
  isResizing: boolean;
252
256
  isRotating: boolean;
253
257
  zoom: Zoom;
254
- openMenu: "canvas" | "shape" | null;
255
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | null;
258
+ openMenu: "canvas" | null;
259
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
256
260
  openSidebar: {
257
261
  name: SidebarName;
258
262
  tab?: SidebarTabName;
@@ -441,6 +445,7 @@ export interface ExcalidrawProps {
441
445
  onDuplicate?: (nextElements: readonly ExcalidrawElement[],
442
446
  /** excludes the duplicated elements */
443
447
  prevElements: readonly ExcalidrawElement[]) => ExcalidrawElement[] | void;
448
+ renderTopLeftUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
444
449
  renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
445
450
  langCode?: Language["code"];
446
451
  viewModeEnabled?: boolean;
@@ -498,6 +503,12 @@ export type UIOptions = Partial<{
498
503
  tools: {
499
504
  image: boolean;
500
505
  };
506
+ /**
507
+ * Optionally control the editor form factor and desktop UI mode from the host app.
508
+ * If not provided, we will take care of it internally.
509
+ */
510
+ formFactor?: EditorInterface["formFactor"];
511
+ desktopUIMode?: EditorInterface["desktopUIMode"];
501
512
  /** @deprecated does nothing. Will be removed in 0.15 */
502
513
  welcomeScreen?: boolean;
503
514
  }>;
@@ -528,7 +539,7 @@ export type AppClassProperties = {
528
539
  mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
529
540
  }>;
530
541
  files: BinaryFiles;
531
- device: App["device"];
542
+ editorInterface: App["editorInterface"];
532
543
  scene: App["scene"];
533
544
  syncActionResult: App["syncActionResult"];
534
545
  fonts: App["fonts"];
@@ -557,6 +568,7 @@ export type AppClassProperties = {
557
568
  excalidrawContainerValue: App["excalidrawContainerValue"];
558
569
  onPointerUpEmitter: App["onPointerUpEmitter"];
559
570
  updateEditorAtom: App["updateEditorAtom"];
571
+ onPointerDownEmitter: App["onPointerDownEmitter"];
560
572
  };
561
573
  export type PointerDownState = Readonly<{
562
574
  origin: Readonly<{
@@ -604,6 +616,7 @@ export type PointerDownState = Readonly<{
604
616
  x: number;
605
617
  y: number;
606
618
  };
619
+ blockDragging: boolean;
607
620
  };
608
621
  eventListeners: {
609
622
  onMove: null | ReturnType<typeof throttleRAF>;
@@ -641,6 +654,7 @@ export interface ExcalidrawImperativeAPI {
641
654
  setCursor: InstanceType<typeof App>["setCursor"];
642
655
  resetCursor: InstanceType<typeof App>["resetCursor"];
643
656
  toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
657
+ getEditorInterface: () => EditorInterface;
644
658
  /**
645
659
  * Disables rendering of frames (including element clipping), but currently
646
660
  * the frames are still interactive in edit mode. As such, this API should be
@@ -654,17 +668,6 @@ export interface ExcalidrawImperativeAPI {
654
668
  onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
655
669
  onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
656
670
  }
657
- export type Device = Readonly<{
658
- viewport: {
659
- isMobile: boolean;
660
- isLandscape: boolean;
661
- };
662
- editor: {
663
- isMobile: boolean;
664
- canFitSidebar: boolean;
665
- };
666
- isTouchScreen: boolean;
667
- }>;
668
671
  export type FrameNameBounds = {
669
672
  x: number;
670
673
  y: number;
@@ -37,3 +37,4 @@ export declare const distanceToLineSegment: <Point extends GlobalPoint | LocalPo
37
37
  * @returns
38
38
  */
39
39
  export declare function lineSegmentIntersectionPoints<Point extends GlobalPoint | LocalPoint>(l: LineSegment<Point>, s: LineSegment<Point>, threshold?: number): Point | null;
40
+ export declare function lineSegmentsDistance<Point extends GlobalPoint | LocalPoint>(s1: LineSegment<Point>, s2: LineSegment<Point>): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/math",
3
- "version": "0.18.0-7876ee524",
3
+ "version": "0.18.0-7f66e1f",
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
- "@excalidraw/common": "0.18.0-7876ee524"
64
+ "@excalidraw/common": "0.18.0-7f66e1f"
65
65
  }
66
66
  }