@excalidraw/element 0.18.0-3bdaafe → 0.18.0-4e0441e

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 (68) hide show
  1. package/dist/dev/index.js +317 -216
  2. package/dist/dev/index.js.map +3 -3
  3. package/dist/prod/index.js +11 -11
  4. package/dist/types/common/src/constants.d.ts +21 -4
  5. package/dist/types/common/src/utils.d.ts +3 -1
  6. package/dist/types/element/src/renderElement.d.ts +4 -1
  7. package/dist/types/element/src/transformHandles.d.ts +1 -1
  8. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +21 -6
  9. package/dist/types/excalidraw/actions/actionBoundText.d.ts +14 -4
  10. package/dist/types/excalidraw/actions/actionCanvas.d.ts +92 -40
  11. package/dist/types/excalidraw/actions/actionClipboard.d.ts +42 -12
  12. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +7 -2
  13. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +21 -6
  14. package/dist/types/excalidraw/actions/actionElementLink.d.ts +7 -2
  15. package/dist/types/excalidraw/actions/actionElementLock.d.ts +14 -4
  16. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +7 -2
  17. package/dist/types/excalidraw/actions/actionExport.d.ts +63 -18
  18. package/dist/types/excalidraw/actions/actionFinalize.d.ts +14 -4
  19. package/dist/types/excalidraw/actions/actionFrame.d.ts +28 -8
  20. package/dist/types/excalidraw/actions/actionGroup.d.ts +14 -4
  21. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +8 -3
  22. package/dist/types/excalidraw/actions/actionLink.d.ts +6 -1
  23. package/dist/types/excalidraw/actions/actionMenu.d.ts +7 -368
  24. package/dist/types/excalidraw/actions/actionNavigate.d.ts +14 -4
  25. package/dist/types/excalidraw/actions/actionProperties.d.ts +122 -38
  26. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +7 -2
  27. package/dist/types/excalidraw/actions/actionStyles.d.ts +7 -2
  28. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +7 -2
  29. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +7 -2
  30. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +7 -2
  31. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +7 -2
  32. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +7 -2
  33. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +7 -2
  34. package/dist/types/excalidraw/actions/index.d.ts +2 -2
  35. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  36. package/dist/types/excalidraw/appState.d.ts +5 -1
  37. package/dist/types/excalidraw/clipboard.d.ts +63 -1
  38. package/dist/types/excalidraw/components/Actions.d.ts +17 -3
  39. package/dist/types/excalidraw/components/App.d.ts +1 -2
  40. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +1 -0
  41. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
  42. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
  43. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
  44. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  45. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
  46. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  47. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  48. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  49. package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
  50. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
  51. package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
  52. package/dist/types/excalidraw/components/MobileToolBar.d.ts +11 -0
  53. package/dist/types/excalidraw/components/Popover.d.ts +2 -1
  54. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
  55. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
  56. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  57. package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
  58. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
  59. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
  60. package/dist/types/excalidraw/components/icons.d.ts +5 -0
  61. package/dist/types/excalidraw/data/blob.d.ts +2 -9
  62. package/dist/types/excalidraw/data/types.d.ts +4 -1
  63. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  64. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  65. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  66. package/dist/types/excalidraw/types.d.ts +10 -3
  67. package/dist/types/math/src/segment.d.ts +1 -0
  68. package/package.json +3 -3
@@ -0,0 +1,14 @@
1
+ export type CaretPosition = {
2
+ start: number;
3
+ end: number;
4
+ };
5
+ export declare const saveCaretPosition: () => CaretPosition | null;
6
+ export declare const restoreCaretPosition: (position: CaretPosition | null) => void;
7
+ export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void) => void;
8
+ export declare const useTextEditorFocus: () => {
9
+ saveCaretPosition: () => void;
10
+ restoreCaretPosition: () => void;
11
+ clearSavedPosition: () => void;
12
+ hasSavedPosition: boolean;
13
+ };
14
+ export declare const temporarilyDisableTextEditorBlur: (duration?: number) => void;
@@ -0,0 +1 @@
1
+ export declare const getShortcutKey: (shortcut: string) => string;
@@ -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;
@@ -351,6 +355,8 @@ export interface AppState {
351
355
  lockedMultiSelections: {
352
356
  [groupId: string]: true;
353
357
  };
358
+ /** properties sidebar mode - determines whether to show compact or complete sidebar */
359
+ stylesPanelMode: "compact" | "full" | "mobile";
354
360
  }
355
361
  export type SearchMatch = {
356
362
  id: string;
@@ -441,6 +447,7 @@ export interface ExcalidrawProps {
441
447
  onDuplicate?: (nextElements: readonly ExcalidrawElement[],
442
448
  /** excludes the duplicated elements */
443
449
  prevElements: readonly ExcalidrawElement[]) => ExcalidrawElement[] | void;
450
+ renderTopLeftUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
444
451
  renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
445
452
  langCode?: Language["code"];
446
453
  viewModeEnabled?: boolean;
@@ -557,7 +564,7 @@ export type AppClassProperties = {
557
564
  excalidrawContainerValue: App["excalidrawContainerValue"];
558
565
  onPointerUpEmitter: App["onPointerUpEmitter"];
559
566
  updateEditorAtom: App["updateEditorAtom"];
560
- defaultSelectionTool: "selection" | "lasso";
567
+ onPointerDownEmitter: App["onPointerDownEmitter"];
561
568
  };
562
569
  export type PointerDownState = Readonly<{
563
570
  origin: Readonly<{
@@ -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/element",
3
- "version": "0.18.0-3bdaafe",
3
+ "version": "0.18.0-4e0441e",
4
4
  "type": "module",
5
5
  "types": "./dist/types/element/src/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -57,7 +57,7 @@
57
57
  "build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
58
58
  },
59
59
  "dependencies": {
60
- "@excalidraw/common": "0.18.0-3bdaafe",
61
- "@excalidraw/math": "0.18.0-3bdaafe"
60
+ "@excalidraw/common": "0.18.0-4e0441e",
61
+ "@excalidraw/math": "0.18.0-4e0441e"
62
62
  }
63
63
  }