@zsviczian/excalidraw 0.18.0-6 → 0.18.0-60

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 (199) hide show
  1. package/dist/excalidraw.development.js +757 -504
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/excalidraw.production.min.js.LICENSE.txt +0 -2
  4. package/dist/styles.development.css +1080 -437
  5. package/dist/styles.production.css +26 -22
  6. package/package.json +15 -4
  7. package/types/common/src/commonObsidianUtils.d.ts +20 -0
  8. package/types/common/src/constants.d.ts +42 -18
  9. package/types/common/src/editorInterface.d.ts +35 -0
  10. package/types/{excalidraw → common/src}/emitter.d.ts +1 -1
  11. package/types/common/src/font-metadata.d.ts +4 -2
  12. package/types/common/src/index.d.ts +4 -0
  13. package/types/common/src/utility-types.d.ts +5 -0
  14. package/types/common/src/utils.d.ts +25 -6
  15. package/types/{excalidraw → common/src}/visualdebug.d.ts +2 -2
  16. package/types/{excalidraw/scene → element/src}/Scene.d.ts +16 -15
  17. package/types/element/src/align.d.ts +4 -3
  18. package/types/element/src/binding.d.ts +62 -41
  19. package/types/element/src/bounds.d.ts +14 -6
  20. package/types/element/src/collision.d.ts +23 -13
  21. package/types/element/src/cropElement.d.ts +1 -1
  22. package/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +77 -40
  23. package/types/element/src/distance.d.ts +2 -2
  24. package/types/element/src/distribute.d.ts +2 -1
  25. package/types/element/src/dragElements.d.ts +3 -2
  26. package/types/element/src/duplicate.d.ts +10 -13
  27. package/types/element/src/elbowArrow.d.ts +1 -1
  28. package/types/element/src/flowchart.d.ts +3 -2
  29. package/types/element/src/fractionalIndex.d.ts +9 -3
  30. package/types/element/src/frame.d.ts +5 -4
  31. package/types/element/src/groups.d.ts +1 -0
  32. package/types/element/src/index.d.ts +44 -5
  33. package/types/element/src/linearElementEditor.d.ts +34 -50
  34. package/types/element/src/mutateElement.d.ts +11 -3
  35. package/types/element/src/newElement.d.ts +6 -4
  36. package/types/element/src/positionElementsOnGrid.d.ts +2 -0
  37. package/types/element/src/renderElement.d.ts +5 -2
  38. package/types/element/src/resizeElements.d.ts +6 -5
  39. package/types/element/src/resizeTest.d.ts +5 -4
  40. package/types/element/src/selection.d.ts +11 -5
  41. package/types/element/src/shape.d.ts +42 -0
  42. package/types/element/src/sizeHelpers.d.ts +2 -2
  43. package/types/element/src/store.d.ts +237 -0
  44. package/types/element/src/textElement.d.ts +4 -3
  45. package/types/element/src/transformHandles.d.ts +5 -4
  46. package/types/element/src/typeChecks.d.ts +20 -3
  47. package/types/element/src/types.d.ts +31 -12
  48. package/types/element/src/utils.d.ts +17 -6
  49. package/types/element/src/zindex.d.ts +8 -2
  50. package/types/excalidraw/actions/actionAddToLibrary.d.ts +88 -58
  51. package/types/excalidraw/actions/actionAlign.d.ts +6 -6
  52. package/types/excalidraw/actions/actionBoundText.d.ts +61 -41
  53. package/types/excalidraw/actions/actionCanvas.d.ts +430 -519
  54. package/types/excalidraw/actions/actionClipboard.d.ts +81 -944
  55. package/types/excalidraw/actions/actionCropEditor.d.ts +30 -20
  56. package/types/excalidraw/actions/actionDeleteSelected.d.ts +97 -68
  57. package/types/excalidraw/actions/actionDistribute.d.ts +2 -2
  58. package/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
  59. package/types/excalidraw/actions/actionElementLink.d.ts +28 -20
  60. package/types/excalidraw/actions/actionElementLock.d.ts +73 -54
  61. package/types/excalidraw/actions/actionEmbeddable.d.ts +30 -20
  62. package/types/excalidraw/actions/actionExport.d.ts +142 -1185
  63. package/types/excalidraw/actions/actionFinalize.d.ts +10 -424
  64. package/types/excalidraw/actions/actionFlip.d.ts +2 -2
  65. package/types/excalidraw/actions/actionFrame.d.ts +176 -129
  66. package/types/excalidraw/actions/actionGroup.d.ts +60 -40
  67. package/types/excalidraw/actions/actionHistory.d.ts +1 -2
  68. package/types/excalidraw/actions/actionLinearEditor.d.ts +564 -22
  69. package/types/excalidraw/actions/actionLink.d.ts +27 -17
  70. package/types/excalidraw/actions/actionMenu.d.ts +27 -457
  71. package/types/excalidraw/actions/actionNavigate.d.ts +21 -431
  72. package/types/excalidraw/actions/actionProperties.d.ts +169 -2702
  73. package/types/excalidraw/actions/actionSelectAll.d.ts +30 -20
  74. package/types/excalidraw/actions/actionStyles.d.ts +31 -21
  75. package/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
  76. package/types/excalidraw/actions/actionToggleGridMode.d.ts +29 -19
  77. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +29 -19
  78. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +27 -224
  79. package/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  80. package/types/excalidraw/actions/actionToggleStats.d.ts +29 -19
  81. package/types/excalidraw/actions/actionToggleViewMode.d.ts +30 -20
  82. package/types/excalidraw/actions/actionToggleZenMode.d.ts +30 -20
  83. package/types/excalidraw/actions/actionTrayMenu.d.ts +229 -0
  84. package/types/excalidraw/actions/actionZindex.d.ts +2 -2
  85. package/types/excalidraw/actions/index.d.ts +4 -2
  86. package/types/excalidraw/actions/manager.d.ts +1 -1
  87. package/types/excalidraw/actions/register.d.ts +1 -1
  88. package/types/excalidraw/actions/types.d.ts +7 -6
  89. package/types/excalidraw/appState.d.ts +22 -7
  90. package/types/excalidraw/clipboard.d.ts +68 -5
  91. package/types/excalidraw/components/Actions.d.ts +20 -7
  92. package/types/excalidraw/components/App.d.ts +68 -46
  93. package/types/excalidraw/components/ButtonIcon.d.ts +1 -0
  94. package/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
  95. package/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -1
  96. package/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
  97. package/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -3
  98. package/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +3 -3
  99. package/types/excalidraw/components/ColorPicker/ShadeList.d.ts +3 -2
  100. package/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  101. package/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  102. package/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
  103. package/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  104. package/types/excalidraw/components/CommandPalette/types.d.ts +1 -2
  105. package/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  106. package/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
  107. package/types/excalidraw/components/Ellipsify.d.ts +3 -0
  108. package/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
  109. package/types/excalidraw/components/FilledButton.d.ts +1 -1
  110. package/types/excalidraw/components/FixedSideContainer.d.ts +2 -1
  111. package/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  112. package/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  113. package/types/excalidraw/components/HintViewer.d.ts +4 -3
  114. package/types/excalidraw/components/InlineIcon.d.ts +3 -1
  115. package/types/excalidraw/components/LayerUI.d.ts +2 -1
  116. package/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
  117. package/types/excalidraw/components/LinkButton.d.ts +4 -0
  118. package/types/excalidraw/components/MobileMenu.d.ts +4 -5
  119. package/types/excalidraw/components/MobileToolBar.d.ts +10 -0
  120. package/types/excalidraw/components/Popover.d.ts +2 -1
  121. package/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
  122. package/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
  123. package/types/excalidraw/components/Range.d.ts +3 -3
  124. package/types/excalidraw/components/Section.d.ts +1 -0
  125. package/types/excalidraw/components/Stats/Angle.d.ts +1 -1
  126. package/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  127. package/types/excalidraw/components/Stats/CanvasGridSize.d.ts +1 -1
  128. package/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
  129. package/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
  130. package/types/excalidraw/components/Stats/DragInput.d.ts +12 -2
  131. package/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  132. package/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
  133. package/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  134. package/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  135. package/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  136. package/types/excalidraw/components/Stats/Position.d.ts +1 -1
  137. package/types/excalidraw/components/Stats/utils.d.ts +4 -11
  138. package/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
  139. package/types/excalidraw/components/TextField.d.ts +1 -0
  140. package/types/excalidraw/components/ToolPopover.d.ts +25 -0
  141. package/types/excalidraw/components/TrayMenu.d.ts +26 -0
  142. package/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  143. package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +7 -3
  144. package/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
  145. package/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
  146. package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  147. package/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
  148. package/types/excalidraw/components/icons.d.ts +17 -0
  149. package/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +14 -1
  150. package/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
  151. package/types/excalidraw/components/shapes.d.ts +115 -5
  152. package/types/excalidraw/data/blob.d.ts +3 -7
  153. package/types/excalidraw/data/reconcile.d.ts +1 -0
  154. package/types/excalidraw/data/restore.d.ts +7 -2
  155. package/types/excalidraw/data/transform.d.ts +1 -1
  156. package/types/excalidraw/data/types.d.ts +4 -1
  157. package/types/excalidraw/editor-jotai.d.ts +6 -6
  158. package/types/excalidraw/eraser/index.d.ts +0 -2
  159. package/types/excalidraw/fonts/Fonts.d.ts +1 -1
  160. package/types/excalidraw/history.d.ts +30 -22
  161. package/types/excalidraw/hooks/useEmitter.d.ts +1 -1
  162. package/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  163. package/types/excalidraw/hooks/useOutsideClick.d.ts +3 -1
  164. package/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  165. package/types/excalidraw/index.d.ts +16 -15
  166. package/types/excalidraw/lasso/index.d.ts +1 -0
  167. package/types/excalidraw/lasso/utils.d.ts +2 -1
  168. package/types/excalidraw/obsidianUtils.d.ts +22 -9
  169. package/types/excalidraw/renderer/animation.d.ts +12 -0
  170. package/types/excalidraw/renderer/helpers.d.ts +3 -2
  171. package/types/excalidraw/renderer/interactiveScene.d.ts +5 -13
  172. package/types/excalidraw/renderer/staticScene.d.ts +4 -1
  173. package/types/excalidraw/scene/Renderer.d.ts +1 -2
  174. package/types/excalidraw/scene/index.d.ts +2 -2
  175. package/types/excalidraw/scene/scrollbars.d.ts +2 -3
  176. package/types/excalidraw/scene/types.d.ts +17 -3
  177. package/types/excalidraw/shortcut.d.ts +1 -0
  178. package/types/excalidraw/snapping.d.ts +2 -2
  179. package/types/excalidraw/types.d.ts +83 -33
  180. package/types/excalidraw/webpack.dev.config.d.ts +2 -0
  181. package/types/excalidraw/webpack.prod.config.d.ts +2 -0
  182. package/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
  183. package/types/math/src/angle.d.ts +2 -0
  184. package/types/math/src/constants.d.ts +3 -0
  185. package/types/math/src/curve.d.ts +34 -0
  186. package/types/math/src/index.d.ts +1 -0
  187. package/types/math/src/point.d.ts +1 -1
  188. package/types/math/src/rectangle.d.ts +2 -0
  189. package/types/math/src/segment.d.ts +1 -0
  190. package/types/math/src/vector.d.ts +8 -2
  191. package/types/utils/src/bbox.d.ts +1 -1
  192. package/types/utils/src/index.d.ts +1 -1
  193. package/types/utils/src/withinBounds.d.ts +1 -1
  194. package/types/element/src/Shape.d.ts +0 -17
  195. package/types/element/src/ShapeCache.d.ts +0 -25
  196. package/types/element/src/shapes.d.ts +0 -23
  197. package/types/excalidraw/components/ButtonSelect.d.ts +0 -9
  198. package/types/excalidraw/store.d.ts +0 -129
  199. package/types/utils/src/collision.d.ts +0 -8
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@zsviczian/excalidraw",
3
- "version": "0.18.0-6",
3
+ "version": "0.18.0-60",
4
4
  "main": "main.js",
5
5
  "module": "./dist/prod/index.js",
6
+ "source": "./index.tsx",
6
7
  "types": "types/excalidraw/index.d.ts",
7
8
  "exports": {
8
9
  "./common/*": {
@@ -67,6 +68,13 @@
67
68
  "last 1 safari version"
68
69
  ]
69
70
  },
71
+ "repository": "https://github.com/excalidraw/excalidraw",
72
+ "bugs": "https://github.com/excalidraw/excalidraw/issues",
73
+ "homepage": "https://github.com/excalidraw/excalidraw/tree/master/packages/excalidraw",
74
+ "scripts": {
75
+ "gen:types": "rimraf types && tsc",
76
+ "build:esm": "rimraf dist && node ../../scripts/buildPackage.js && yarn gen:types"
77
+ },
70
78
  "peerDependencies": {
71
79
  "react": "^17.0.2 || ^18.2.0 || ^19.0.0",
72
80
  "react-dom": "^17.0.2 || ^18.2.0 || ^19.0.0"
@@ -74,7 +82,7 @@
74
82
  "dependencies": {
75
83
  "@braintree/sanitize-url": "6.0.2",
76
84
  "@zsviczian/laser-pointer": "1.3.1",
77
- "@zsviczian/mermaid-to-excalidraw": "1.1.2",
85
+ "@zsviczian/mermaid-to-excalidraw": "1.1.3",
78
86
  "@excalidraw/random-username": "1.1.0",
79
87
  "@radix-ui/react-popover": "1.1.6",
80
88
  "@radix-ui/react-tabs": "1.1.3",
@@ -87,8 +95,8 @@
87
95
  "image-blob-reduce": "3.0.1",
88
96
  "jotai": "2.11.0",
89
97
  "jotai-scope": "0.7.2",
90
- "lodash.throttle": "4.1.1",
91
98
  "lodash.debounce": "4.0.8",
99
+ "lodash.throttle": "4.1.1",
92
100
  "nanoid": "3.3.3",
93
101
  "open-color": "1.9.1",
94
102
  "pako": "2.0.3",
@@ -153,7 +161,10 @@
153
161
  "css-loader": "^7.1.2",
154
162
  "esbuild-plugin-external-global": "^1.0.1"
155
163
  },
156
- "repository": "https://github.com/excalidraw/excalidraw",
164
+ "repository": {
165
+ "type": "git",
166
+ "url": "git+https://github.com/zsviczian/excalidraw.git"
167
+ },
157
168
  "bugs": "https://github.com/excalidraw/excalidraw/issues",
158
169
  "homepage": "https://github.com/excalidraw/excalidraw/tree/master/packages/excalidraw",
159
170
  "scripts": {
@@ -0,0 +1,20 @@
1
+ export type ObsidianDeviceType = {
2
+ isDesktop: boolean;
3
+ isPhone: boolean;
4
+ isTablet: boolean;
5
+ isMobile: boolean;
6
+ isLinux: boolean;
7
+ isMacOS: boolean;
8
+ isWindows: boolean;
9
+ isIOS: boolean;
10
+ isAndroid: boolean;
11
+ };
12
+ export declare let hostPlugin: any;
13
+ export declare function destroyObsidianUtils(): void;
14
+ export declare function initializeObsidianUtils(): void;
15
+ export declare function getHostPlugin(): any;
16
+ export declare const getObsidianDeviceInfo: () => ObsidianDeviceType | null;
17
+ export declare const getDesktopUIMode: () => any;
18
+ export declare function getAreaLimit(): any;
19
+ export declare function getWidthHeightLimit(): any;
20
+ export declare function getHighlightColor(sceneBgColor: string, opacity?: number): string;
@@ -1,17 +1,10 @@
1
1
  import type { ExcalidrawElement, FontFamilyValues } from "@excalidraw/element/types";
2
2
  import type { AppProps, AppState } from "@excalidraw/excalidraw/types";
3
- export declare const isDarwin: boolean;
4
- export declare const isWindows: boolean;
5
- export declare const isAndroid: boolean;
6
- export declare const isFirefox: boolean;
7
- export declare const isChrome: boolean;
8
- export declare const isSafari: boolean;
9
- export declare const isIOS: boolean;
10
- export declare const isBrave: () => boolean;
11
3
  export declare const supportsResizeObserver: boolean;
12
4
  export declare const APP_NAME = "Excalidraw";
13
5
  export declare const TEXT_AUTOWRAP_THRESHOLD = 36;
14
6
  export declare const DRAGGING_THRESHOLD = 10;
7
+ export declare const MINIMUM_ARROW_SIZE = 20;
15
8
  export declare const LINE_CONFIRM_THRESHOLD = 8;
16
9
  export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
17
10
  export declare const ELEMENT_TRANSLATE_AMOUNT = 1;
@@ -85,11 +78,16 @@ export declare const ENV: {
85
78
  PRODUCTION: string;
86
79
  };
87
80
  export declare const CLASSES: {
81
+ SIDEBAR: string;
88
82
  SHAPE_ACTIONS_MENU: string;
89
83
  SHAPE_ACTIONS_MOBILE_MENU: string;
84
+ SHAPE_ACTIONS_TRAY_MENU: string;
90
85
  MOBILE_TOOLBAR: string;
91
86
  ZOOM_ACTIONS: string;
92
87
  SEARCH_MENU_INPUT_WRAPPER: string;
88
+ CONVERT_ELEMENT_TYPE_POPUP: string;
89
+ SHAPE_ACTIONS_THEME_SCOPE: string;
90
+ FRAME_NAME: string;
93
91
  };
94
92
  export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
95
93
  export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
@@ -111,11 +109,21 @@ export declare const FONT_FAMILY: {
111
109
  "Lilita One": number;
112
110
  "Comic Shanns": number;
113
111
  "Liberation Sans": number;
112
+ Assistant: number;
113
+ };
114
+ export declare const SANS_SERIF_GENERIC_FONT = "sans-serif";
115
+ export declare const MONOSPACE_GENERIC_FONT = "monospace";
116
+ export declare const FONT_FAMILY_GENERIC_FALLBACKS: {
117
+ "sans-serif": number;
118
+ monospace: number;
114
119
  };
115
120
  export declare const FONT_FAMILY_FALLBACKS: {
116
- Xiaolai: number;
117
121
  "Segoe UI Emoji": number;
122
+ "sans-serif": number;
123
+ monospace: number;
124
+ Xiaolai: number;
118
125
  };
126
+ export declare function getGenericFontFamilyFallback(fontFamily: number): keyof typeof FONT_FAMILY_GENERIC_FALLBACKS;
119
127
  export declare const getFontFamilyFallbacks: (fontFamily: number) => Array<keyof typeof FONT_FAMILY_FALLBACKS>;
120
128
  export declare const THEME: {
121
129
  readonly LIGHT: "light";
@@ -166,6 +174,14 @@ export declare const IMAGE_MIME_TYPES: {
166
174
  readonly avif: "image/avif";
167
175
  readonly jfif: "image/jfif";
168
176
  };
177
+ export declare const STRING_MIME_TYPES: {
178
+ readonly text: "text/plain";
179
+ readonly html: "text/html";
180
+ readonly json: "application/json";
181
+ readonly excalidraw: "application/vnd.excalidraw+json";
182
+ readonly excalidrawlib: "application/vnd.excalidrawlib+json";
183
+ readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
184
+ };
169
185
  export declare const MIME_TYPES: {
170
186
  readonly svg: "image/svg+xml";
171
187
  readonly png: "image/png";
@@ -176,14 +192,15 @@ export declare const MIME_TYPES: {
176
192
  readonly ico: "image/x-icon";
177
193
  readonly avif: "image/avif";
178
194
  readonly jfif: "image/jfif";
195
+ readonly "excalidraw.svg": "image/svg+xml";
196
+ readonly "excalidraw.png": "image/png";
197
+ readonly binary: "application/octet-stream";
179
198
  readonly text: "text/plain";
180
199
  readonly html: "text/html";
181
200
  readonly json: "application/json";
182
201
  readonly excalidraw: "application/vnd.excalidraw+json";
183
202
  readonly excalidrawlib: "application/vnd.excalidrawlib+json";
184
- readonly "excalidraw.svg": "image/svg+xml";
185
- readonly "excalidraw.png": "image/png";
186
- readonly binary: "application/octet-stream";
203
+ readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
187
204
  };
188
205
  export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html", ...("image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/avif" | "image/jfif")[]];
189
206
  export declare const EXPORT_IMAGE_TYPES: {
@@ -197,7 +214,7 @@ export declare const EXPORT_DATA_TYPES: {
197
214
  readonly excalidrawLibrary: "excalidrawlib";
198
215
  readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
199
216
  };
200
- export declare const EXPORT_SOURCE: string;
217
+ export declare const getExportSource: () => string;
201
218
  export declare const IMAGE_RENDER_TIMEOUT = 500;
202
219
  export declare const TAP_TWICE_TIMEOUT = 300;
203
220
  export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
@@ -218,10 +235,6 @@ export declare const URL_HASH_KEYS: {
218
235
  readonly addLibrary: "addLibrary";
219
236
  };
220
237
  export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
221
- export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
222
- export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
223
- export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
224
- export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
225
238
  export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
226
239
  export declare const EXPORT_SCALES: number[];
227
240
  export declare const DEFAULT_EXPORT_PADDING = 10;
@@ -288,7 +301,7 @@ export declare const DEFAULT_SIDEBAR: {
288
301
  readonly name: "default";
289
302
  readonly defaultTab: "library";
290
303
  };
291
- export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "image" | "iframe">;
304
+ export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "iframe" | "image">;
292
305
  export declare const TOOL_TYPE: {
293
306
  readonly selection: "selection";
294
307
  readonly lasso: "lasso";
@@ -334,3 +347,14 @@ export declare enum UserIdleState {
334
347
  AWAY = "away",
335
348
  IDLE = "idle"
336
349
  }
350
+ /**
351
+ * distance at which we merge points instead of adding a new merge-point
352
+ * when converting a line to a polygon (merge currently means overlaping
353
+ * the start and end points)
354
+ */
355
+ export declare const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
356
+ export declare const DOUBLE_TAP_POSITION_THRESHOLD = 35;
357
+ export declare const BIND_MODE_TIMEOUT = 700;
358
+ export declare const MOBILE_ACTION_BUTTON_BG: {
359
+ readonly background: "var(--mobile-action-button-bg)";
360
+ };
@@ -0,0 +1,35 @@
1
+ export type StylesPanelMode = "compact" | "full" | "mobile" | "tray";
2
+ export type EditorInterface = Readonly<{
3
+ formFactor: "phone" | "tablet" | "desktop";
4
+ desktopUIMode: "compact" | "full" | "tray";
5
+ userAgent: Readonly<{
6
+ isMobileDevice: boolean;
7
+ platform: "ios" | "android" | "other" | "unknown";
8
+ }>;
9
+ isTouchScreen: boolean;
10
+ canFitSidebar: boolean;
11
+ isLandscape: boolean;
12
+ preferTrayMode: boolean;
13
+ }>;
14
+ export declare const MQ_MAX_MOBILE = 599;
15
+ export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
16
+ export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
17
+ export declare const MQ_MIN_TABLET: number;
18
+ export declare const MQ_MAX_TABLET = 1400;
19
+ export declare const MQ_MIN_WIDTH_DESKTOP = 1440;
20
+ export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 800;
21
+ export declare const isDarwin: boolean;
22
+ export declare const isWindows: boolean;
23
+ export declare const isAndroid: boolean;
24
+ export declare const isFirefox: boolean;
25
+ export declare const isChrome: boolean;
26
+ export declare const isSafari: boolean;
27
+ export declare const isIOS: boolean;
28
+ export declare const isBrave: () => boolean;
29
+ export declare const isMobileBreakpoint: (width: number, height: number, allowMobile: boolean) => boolean;
30
+ export declare const isTabletBreakpoint: (editorWidth: number, editorHeight: number) => boolean;
31
+ export declare const getFormFactor: (editorWidth: number, editorHeight: number, allowMobile: boolean) => EditorInterface["formFactor"];
32
+ export declare const deriveStylesPanelMode: (editorInterface: EditorInterface) => StylesPanelMode;
33
+ export declare const createUserAgentDescriptor: (userAgentString: string) => EditorInterface["userAgent"];
34
+ export declare const loadDesktopUIModePreference: () => any;
35
+ export declare const setDesktopUIMode: (mode: EditorInterface["desktopUIMode"]) => "tray" | "full" | "compact" | undefined;
@@ -1,4 +1,4 @@
1
- import type { UnsubscribeCallback } from "./types";
1
+ import type { UnsubscribeCallback } from "@excalidraw/excalidraw/types";
2
2
  type Subscriber<T extends any[]> = (...payload: T) => void;
3
3
  export declare class Emitter<T extends any[] = []> {
4
4
  subscribers: Subscriber<T>[];
@@ -16,8 +16,10 @@ export interface FontMetadata {
16
16
  };
17
17
  /** flag to indicate a deprecated font */
18
18
  deprecated?: true;
19
- /** flag to indicate a server-side only font */
20
- serverSide?: true;
19
+ /**
20
+ * whether this is a font that users can use (= shown in font picker)
21
+ */
22
+ private?: true;
21
23
  /** flag to indiccate a local-only font */
22
24
  local?: true;
23
25
  /** flag to indicate a fallback font */
@@ -9,3 +9,7 @@ export * from "./promise-pool";
9
9
  export * from "./random";
10
10
  export * from "./url";
11
11
  export * from "./utils";
12
+ export * from "./emitter";
13
+ export * from "./visualdebug";
14
+ export * from "./editorInterface";
15
+ export * from "./commonObsidianUtils";
@@ -30,3 +30,8 @@ export type MakeBrand<T extends string> = {
30
30
  /** Maybe just promise or already fulfilled one! */
31
31
  export type MaybePromise<T> = T | Promise<T>;
32
32
  export type AllPossibleKeys<T> = T extends any ? keyof T : never;
33
+ /** Strip all the methods or functions from a type */
34
+ export type DTO<T> = {
35
+ [K in keyof T as T[K] extends Function ? never : K]: T[K];
36
+ };
37
+ export type MapEntry<M extends Map<any, any>> = M extends Map<infer K, infer V> ? [K, V] : never;
@@ -1,5 +1,4 @@
1
- import { type GlobalPoint } from "@excalidraw/math";
2
- import type { ExcalidrawBindableElement, FontFamilyValues, FontString, ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { FontFamilyValues, FontString } from "@excalidraw/element/types";
3
2
  import type { ActiveTool, AppState, ToolType, UnsubscribeCallback, Zoom } from "@excalidraw/excalidraw/types";
4
3
  import type { MaybePromise } from "./utility-types";
5
4
  import type { EVENT } from "./constants";
@@ -18,6 +17,8 @@ export declare const getFontString: ({ fontSize, fontFamily, }: {
18
17
  fontSize: number;
19
18
  fontFamily: FontFamilyValues;
20
19
  }) => FontString;
20
+ /** executes callback in the frame that's after the current one */
21
+ export declare const nextAnimationFrame: (cb: () => any) => Promise<void>;
21
22
  export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeout: number) => {
22
23
  (...args: T): void;
23
24
  flush(): void;
@@ -81,6 +82,7 @@ export declare const chunk: <T extends unknown>(array: readonly T[], size: numbe
81
82
  export declare const selectNode: (node: Element) => void;
82
83
  export declare const removeSelection: () => void;
83
84
  export declare const distance: (x: number, y: number) => number;
85
+ export declare const isSelectionLikeTool: (type: ToolType | "custom") => boolean;
84
86
  export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: (({
85
87
  type: ToolType;
86
88
  } | {
@@ -95,7 +97,6 @@ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">,
95
97
  export declare const isFullScreen: () => boolean;
96
98
  export declare const allowFullScreen: () => Promise<void>;
97
99
  export declare const exitFullScreen: () => Promise<void>;
98
- export declare const getShortcutKey: (shortcut: string) => string;
99
100
  export declare const viewportCoordsToSceneCoords: ({ clientX, clientY }: {
100
101
  clientX: number;
101
102
  clientY: number;
@@ -138,8 +139,9 @@ export declare const tupleToCoors: (xyTuple: readonly [number, number]) => {
138
139
  export declare const muteFSAbortError: (error?: Error) => void;
139
140
  export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
140
141
  export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
142
+ /** returns the first non-null mapped value */
143
+ export declare const mapFind: <T, K>(collection: readonly T[], iteratee: (value: T, index: number) => K | null | undefined) => K | undefined;
141
144
  export declare const isTransparent: (color: string) => boolean;
142
- export declare const isBindingFallthroughEnabled: (el: ExcalidrawBindableElement) => boolean;
143
145
  export type ResolvablePromise<T> = Promise<T> & {
144
146
  resolve: [T] extends [undefined] ? (value?: MaybePromise<Awaited<T>>) => void : (value: MaybePromise<Awaited<T>>) => void;
145
147
  reject: (error: Error) => void;
@@ -178,6 +180,15 @@ export type Node<T> = T & {
178
180
  * Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.
179
181
  */
180
182
  export declare const arrayToList: <T>(array: readonly T[]) => Node<T>[];
183
+ /**
184
+ * Converts a readonly array or map into an iterable.
185
+ * Useful for avoiding entry allocations when iterating object / map on each iteration.
186
+ */
187
+ export declare const toIterable: <T>(values: ReadonlyMap<string, T> | readonly T[]) => Iterable<T>;
188
+ /**
189
+ * Converts a readonly array or map into an array.
190
+ */
191
+ export declare const toArray: <T>(values: ReadonlyMap<string, T> | readonly T[]) => T[];
181
192
  export declare const isTestEnv: () => boolean;
182
193
  export declare const isDevEnv: () => boolean;
183
194
  export declare const isProdEnv: () => boolean;
@@ -187,7 +198,7 @@ export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) =
187
198
  }>;
188
199
  export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
189
200
  export declare const isPrimitive: (val: any) => boolean;
190
- export declare const getFrame: () => "iframe" | "top";
201
+ export declare const getFrame: () => "top" | "iframe";
191
202
  export declare const isRunningInIframe: () => boolean;
192
203
  export declare const isPromiseLike: (value: any) => value is Promise<any>;
193
204
  export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
@@ -250,5 +261,13 @@ export declare const safelyParseJSON: (json: string) => Record<string, any> | nu
250
261
  */
251
262
  export declare const escapeDoubleQuotes: (str: string) => string;
252
263
  export declare const castArray: <T>(value: T | T[]) => T[];
253
- export declare const elementCenterPoint: (element: ExcalidrawElement, xOffset?: number, yOffset?: number) => GlobalPoint;
264
+ /** hack for Array.isArray type guard not working with readonly value[] */
265
+ export declare const isReadonlyArray: (value?: any) => value is readonly any[];
266
+ export declare const sizeOf: (value: readonly unknown[] | Readonly<Map<string, unknown>> | Readonly<Record<string, unknown>> | ReadonlySet<unknown>) => number;
267
+ export declare const reduceToCommonValue: <T, R = T>(collection: ReadonlySet<T> | readonly T[], getValue?: ((item: T) => R) | undefined) => R | null;
268
+ type FEATURE_FLAGS = {
269
+ COMPLEX_BINDINGS: boolean;
270
+ };
271
+ export declare const getFeatureFlag: <F extends "COMPLEX_BINDINGS">(flag: F) => FEATURE_FLAGS[F];
272
+ export declare const setFeatureFlag: <F extends "COMPLEX_BINDINGS">(flag: F, value: FEATURE_FLAGS[F]) => void;
254
273
  export {};
@@ -1,7 +1,7 @@
1
1
  import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
2
2
  import type { Curve } from "@excalidraw/math";
3
3
  import type { LineSegment } from "@excalidraw/utils";
4
- import type { Bounds } from "@excalidraw/element/bounds";
4
+ import type { Bounds } from "@excalidraw/element";
5
5
  declare global {
6
6
  interface Window {
7
7
  visualDebug?: {
@@ -35,7 +35,7 @@ export declare const debugDrawBounds: (box: Bounds | Bounds[], opts?: {
35
35
  export declare const debugDrawPoints: ({ x, y, points, }: {
36
36
  x: number;
37
37
  y: number;
38
- points: LocalPoint[];
38
+ points: readonly LocalPoint[];
39
39
  }, options?: any) => void;
40
40
  export declare const debugCloseFrame: () => void;
41
41
  export declare const debugClear: () => void;
@@ -1,19 +1,11 @@
1
- import type { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
1
+ import { type ElementUpdate } from "@excalidraw/element";
2
2
  import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameLikeElement, ElementsMapOrArray, OrderedExcalidrawElement, Ordered } from "@excalidraw/element/types";
3
- import type { AppState } from "../types";
4
- type ElementIdKey = InstanceType<typeof LinearElementEditor>["elementId"];
5
- type ElementKey = ExcalidrawElement | ElementIdKey;
3
+ import type { Mutable } from "@excalidraw/common/utility-types";
4
+ import type { AppState } from "../../excalidraw/types";
6
5
  type SceneStateCallback = () => void;
7
6
  type SceneStateCallbackRemover = () => void;
8
7
  export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
9
- declare class Scene {
10
- private static sceneMapByElement;
11
- private static sceneMapById;
12
- static mapElementToScene(elementKey: ElementKey, scene: Scene): void;
13
- /**
14
- * @deprecated pass down `app.scene` and use it directly
15
- */
16
- static getScene(elementKey: ElementKey): Scene | null;
8
+ export declare class Scene {
17
9
  private callbacks;
18
10
  private nonDeletedElements;
19
11
  private nonDeletedElementsMap;
@@ -35,6 +27,9 @@ declare class Scene {
35
27
  getElementsMapIncludingDeleted(): Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
36
28
  getNonDeletedElements(): readonly Ordered<NonDeletedExcalidrawElement>[];
37
29
  getFramesIncludingDeleted(): readonly ExcalidrawFrameLikeElement[];
30
+ constructor(elements?: ElementsMapOrArray | null, options?: {
31
+ skipValidation?: true;
32
+ });
38
33
  getSelectedElements(opts: {
39
34
  selectedElementIds: AppState["selectedElementIds"];
40
35
  /**
@@ -62,7 +57,9 @@ declare class Scene {
62
57
  * @returns whether a change was made
63
58
  */
64
59
  mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
65
- replaceAllElements(nextElements: ElementsMapOrArray): void;
60
+ replaceAllElements(nextElements: ElementsMapOrArray, options?: {
61
+ skipValidation?: true;
62
+ }): void;
66
63
  triggerUpdate(): void;
67
64
  onUpdate(cb: SceneStateCallback): SceneStateCallbackRemover;
68
65
  destroy(): void;
@@ -73,7 +70,11 @@ declare class Scene {
73
70
  getElementIndex(elementId: string): number;
74
71
  getContainerElement: (element: (ExcalidrawElement & {
75
72
  containerId: ExcalidrawElement["id"] | null;
76
- }) | null) => import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | null;
73
+ }) | null) => import("@excalidraw/element/types").ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | import("@excalidraw/element/types").ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | null;
77
74
  getElementsFromId: (id: string) => ExcalidrawElement[];
75
+ mutateElement<TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, options?: {
76
+ informMutation: boolean;
77
+ isDragging: boolean;
78
+ }): TElement;
78
79
  }
79
- export default Scene;
80
+ export {};
@@ -1,7 +1,8 @@
1
- import type Scene from "@excalidraw/excalidraw/scene/Scene";
2
- import type { ElementsMap, ExcalidrawElement } from "./types";
1
+ import type { AppState } from "@excalidraw/excalidraw/types";
2
+ import type { Scene } from "./Scene";
3
+ import type { ExcalidrawElement } from "./types";
3
4
  export interface Alignment {
4
5
  position: "start" | "center" | "end";
5
6
  axis: "x" | "y";
6
7
  }
7
- export declare const alignElements: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, alignment: Alignment, scene: Scene) => ExcalidrawElement[];
8
+ export declare const alignElements: (selectedElements: ExcalidrawElement[], alignment: Alignment, scene: Scene, appState: Readonly<AppState>) => ExcalidrawElement[];
@@ -1,59 +1,80 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
- import type { LocalPoint } from "@excalidraw/math";
3
- import type Scene from "@excalidraw/excalidraw/scene/Scene";
2
+ import type { LineSegment, LocalPoint } from "@excalidraw/math";
4
3
  import type { AppState } from "@excalidraw/excalidraw/types";
5
4
  import { type Heading } from "./heading";
5
+ import type { Scene } from "./Scene";
6
6
  import type { Bounds } from "./bounds";
7
7
  import type { ElementUpdate } from "./mutateElement";
8
- import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap, OrderedExcalidrawElement, ExcalidrawElbowArrowElement, FixedPoint, SceneElementsMap } from "./types";
9
- export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
10
- export type SuggestedPointBinding = [
11
- NonDeleted<ExcalidrawLinearElement>,
12
- "start" | "end" | "both",
13
- NonDeleted<ExcalidrawBindableElement>
14
- ];
8
+ import type { BindMode, ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, ExcalidrawElbowArrowElement, ExcalidrawElement, FixedPoint, FixedPointBinding, NonDeleted, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap, Ordered, PointsPositionUpdates } from "./types";
9
+ export type BindingStrategy = {
10
+ mode: BindMode;
11
+ element: NonDeleted<ExcalidrawBindableElement>;
12
+ focusPoint: GlobalPoint;
13
+ } | {
14
+ mode: null;
15
+ element?: undefined;
16
+ focusPoint?: undefined;
17
+ } | {
18
+ mode: undefined;
19
+ element?: undefined;
20
+ focusPoint?: undefined;
21
+ };
22
+ /**
23
+ * gaps exclude element strokeWidth
24
+ *
25
+ * IMPORTANT: currently must be > 0 (this also applies to the computed gap)
26
+ */
27
+ export declare const BASE_BINDING_GAP = 10;
28
+ export declare const BASE_BINDING_GAP_ELBOW = 5;
29
+ export declare const getBindingGap: (bindTarget: ExcalidrawBindableElement, opts: Pick<ExcalidrawArrowElement, "elbowed">) => number;
30
+ export declare const maxBindingDistance_simple: (zoom?: AppState["zoom"]) => number;
15
31
  export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<HTMLElement>) => boolean;
16
32
  export declare const isBindingEnabled: (appState: AppState) => boolean;
17
- export declare const FIXED_BINDING_DISTANCE = 5;
18
- export declare const BINDING_HIGHLIGHT_THICKNESS = 10;
19
- export declare const BINDING_HIGHLIGHT_OFFSET = 4;
20
- export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", elementsMap: NonDeletedSceneElementsMap, scene: Scene) => void;
21
- export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, isBindingEnabled: boolean, draggingPoints: readonly number[] | null, zoom?: AppState["zoom"]) => void;
22
- export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => SuggestedBinding[];
23
- export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
24
- x: number;
25
- y: number;
26
- }, elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[]) => void;
27
- export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: NonDeletedSceneElementsMap) => void;
28
- export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
29
- export declare const getHoveredElementForBinding: (pointerCoords: {
30
- x: number;
31
- y: number;
32
- }, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean, considerAllElements?: boolean) => NonDeleted<ExcalidrawBindableElement> | null;
33
- export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, options?: {
33
+ export declare const bindOrUnbindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, draggingPoints: PointsPositionUpdates, scene: Scene, appState: AppState, opts?: {
34
+ newArrow?: boolean;
35
+ altKey?: boolean;
36
+ initialBinding?: boolean;
37
+ }) => {
38
+ start: BindingStrategy;
39
+ end: BindingStrategy;
40
+ };
41
+ export declare const getBindingStrategyForDraggingBindingElementEndpoints: (arrow: NonDeleted<ExcalidrawArrowElement>, draggingPoints: PointsPositionUpdates, elementsMap: NonDeletedSceneElementsMap, elements: readonly Ordered<NonDeletedExcalidrawElement>[], appState: AppState, opts?: {
42
+ newArrow?: boolean;
43
+ shiftKey?: boolean;
44
+ altKey?: boolean;
45
+ finalize?: boolean;
46
+ initialBinding?: boolean;
47
+ zoom?: AppState["zoom"];
48
+ }) => {
49
+ start: BindingStrategy;
50
+ end: BindingStrategy;
51
+ };
52
+ export declare const bindOrUnbindBindingElements: (selectedArrows: NonDeleted<ExcalidrawArrowElement>[], scene: Scene, appState: AppState) => void;
53
+ export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint) => void;
54
+ export declare const unbindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "start" | "end", scene: Scene) => ExcalidrawBindableElement["id"] | null;
55
+ export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
56
+ simultaneouslyUpdated?: readonly ExcalidrawElement[];
57
+ changedElements?: Map<string, ExcalidrawElement>;
58
+ }) => void;
59
+ export declare const updateBindings: (latestElement: ExcalidrawElement, scene: Scene, appState: AppState, options?: {
34
60
  simultaneouslyUpdated?: readonly ExcalidrawElement[];
35
61
  newSize?: {
36
62
  width: number;
37
63
  height: number;
38
64
  };
39
- changedElements?: Map<string, OrderedExcalidrawElement>;
40
65
  }) => void;
41
- export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, elementsMap: ElementsMap, origPoint: GlobalPoint, zoom?: AppState["zoom"]) => Heading;
42
- export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => GlobalPoint;
43
- export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, p: GlobalPoint) => GlobalPoint;
44
- export declare const snapToMid: (element: ExcalidrawBindableElement, p: GlobalPoint, tolerance?: number) => GlobalPoint;
66
+ export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, origPoint: GlobalPoint, elementsMap: ElementsMap, zoom?: AppState["zoom"]) => Heading;
67
+ export declare const bindPointToSnapToElementOutline: (arrowElement: ExcalidrawArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, customIntersector?: LineSegment<GlobalPoint>) => GlobalPoint;
68
+ export declare const avoidRectangularCorner: (arrowElement: ExcalidrawArrowElement, bindTarget: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint) => GlobalPoint;
69
+ export declare const updateBoundPoint: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "startBinding" | "endBinding", binding: FixedPointBinding | null | undefined, bindableElement: ExcalidrawBindableElement, elementsMap: ElementsMap, customIntersector?: LineSegment<GlobalPoint>) => LocalPoint | null;
45
70
  export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => {
46
71
  fixedPoint: FixedPoint;
47
72
  };
48
- export declare const fixDuplicatedBindingsAfterDuplication: (newElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicatedElementsMap: NonDeletedSceneElementsMap) => void;
49
- export declare const fixReversedBindings: (originalElements: Map<string, ExcalidrawElement>, elementsWithClones: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
73
+ export declare const calculateFixedPointForNonElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, focusPoint?: GlobalPoint) => {
74
+ fixedPoint: FixedPoint;
75
+ };
76
+ export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
50
77
  export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
51
- export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
52
- x: number;
53
- y: number;
54
- }, elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean) => boolean;
55
- export declare const maxBindingGap: (element: ExcalidrawElement, elementWidth: number, elementHeight: number, zoom?: AppState["zoom"]) => number;
56
- export declare const determineFocusDistance: (element: ExcalidrawBindableElement, a: GlobalPoint, b: GlobalPoint) => number;
57
78
  export declare const bindingProperties: Set<BindableProp | BindingProp>;
58
79
  export type BindableProp = "boundElements";
59
80
  export type BindingProp = "frameId" | "containerId" | "startBinding" | "endBinding";
@@ -95,7 +116,7 @@ export declare class BindableElement {
95
116
  */
96
117
  static rebindAffected: (elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
97
118
  }
98
- export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement) => GlobalPoint;
99
- export declare const getGlobalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
119
+ export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: FixedPoint, element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint;
120
+ export declare const getGlobalFixedPoints: (arrow: ExcalidrawArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
100
121
  export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => LocalPoint[];
101
122
  export declare const normalizeFixedPoint: <T extends FixedPoint | null>(fixedPoint: T) => T extends null ? null : FixedPoint;