@zsviczian/excalidraw 0.18.0-5 → 0.18.0-50
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.
- package/dist/excalidraw.development.js +745 -503
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +0 -2
- package/dist/styles.development.css +1062 -429
- package/dist/styles.production.css +26 -22
- package/package.json +14 -3
- package/types/common/src/commonObsidianUtils.d.ts +13 -0
- package/types/common/src/constants.d.ts +42 -18
- package/types/common/src/editorInterface.d.ts +35 -0
- package/types/{excalidraw → common/src}/emitter.d.ts +1 -1
- package/types/common/src/font-metadata.d.ts +4 -2
- package/types/common/src/index.d.ts +2 -0
- package/types/common/src/utility-types.d.ts +5 -0
- package/types/common/src/utils.d.ts +20 -5
- package/types/{excalidraw/scene → element/src}/Scene.d.ts +16 -15
- package/types/element/src/align.d.ts +4 -3
- package/types/element/src/binding.d.ts +27 -17
- package/types/element/src/bounds.d.ts +14 -6
- package/types/element/src/collision.d.ts +18 -12
- package/types/element/src/cropElement.d.ts +1 -1
- package/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +77 -40
- package/types/element/src/distance.d.ts +2 -2
- package/types/element/src/distribute.d.ts +2 -1
- package/types/element/src/dragElements.d.ts +3 -2
- package/types/element/src/duplicate.d.ts +10 -13
- package/types/element/src/elbowArrow.d.ts +1 -1
- package/types/element/src/flowchart.d.ts +3 -2
- package/types/element/src/fractionalIndex.d.ts +9 -3
- package/types/element/src/frame.d.ts +5 -4
- package/types/element/src/groups.d.ts +1 -0
- package/types/element/src/index.d.ts +44 -2
- package/types/element/src/linearElementEditor.d.ts +23 -36
- package/types/element/src/mutateElement.d.ts +11 -3
- package/types/element/src/newElement.d.ts +6 -4
- package/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/types/element/src/renderElement.d.ts +4 -1
- package/types/element/src/resizeElements.d.ts +6 -5
- package/types/element/src/resizeTest.d.ts +5 -4
- package/types/element/src/selection.d.ts +11 -5
- package/types/element/src/shape.d.ts +42 -0
- package/types/element/src/sizeHelpers.d.ts +2 -2
- package/types/element/src/store.d.ts +237 -0
- package/types/element/src/textElement.d.ts +5 -3
- package/types/element/src/transformHandles.d.ts +5 -4
- package/types/element/src/typeChecks.d.ts +19 -1
- package/types/element/src/types.d.ts +25 -2
- package/types/element/src/utils.d.ts +16 -6
- package/types/element/src/zindex.d.ts +1 -1
- package/types/excalidraw/actions/actionAddToLibrary.d.ts +75 -54
- package/types/excalidraw/actions/actionBoundText.d.ts +50 -36
- package/types/excalidraw/actions/actionCanvas.d.ts +388 -282
- package/types/excalidraw/actions/actionClipboard.d.ts +151 -107
- package/types/excalidraw/actions/actionCropEditor.d.ts +25 -18
- package/types/excalidraw/actions/actionDeleteSelected.d.ts +77 -55
- package/types/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
- package/types/excalidraw/actions/actionElementLink.d.ts +25 -18
- package/types/excalidraw/actions/actionElementLock.d.ts +65 -52
- package/types/excalidraw/actions/actionEmbeddable.d.ts +25 -18
- package/types/excalidraw/actions/actionExport.d.ts +237 -174
- package/types/excalidraw/actions/actionFinalize.d.ts +307 -43
- package/types/excalidraw/actions/actionFrame.d.ts +157 -120
- package/types/excalidraw/actions/actionGroup.d.ts +50 -36
- package/types/excalidraw/actions/actionHistory.d.ts +1 -2
- package/types/excalidraw/actions/actionLinearEditor.d.ts +563 -20
- package/types/excalidraw/actions/actionLink.d.ts +23 -16
- package/types/excalidraw/actions/actionMenu.d.ts +25 -456
- package/types/excalidraw/actions/actionNavigate.d.ts +49 -35
- package/types/excalidraw/actions/actionProperties.d.ts +629 -273
- package/types/excalidraw/actions/actionSelectAll.d.ts +25 -18
- package/types/excalidraw/actions/actionStyles.d.ts +25 -18
- package/types/excalidraw/actions/actionToggleGridMode.d.ts +25 -18
- package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +25 -18
- package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +25 -223
- package/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
- package/types/excalidraw/actions/actionToggleStats.d.ts +25 -18
- package/types/excalidraw/actions/actionToggleViewMode.d.ts +25 -18
- package/types/excalidraw/actions/actionToggleZenMode.d.ts +26 -19
- package/types/excalidraw/actions/actionTrayMenu.d.ts +226 -0
- package/types/excalidraw/actions/index.d.ts +4 -2
- package/types/excalidraw/actions/types.d.ts +4 -3
- package/types/excalidraw/appState.d.ts +24 -10
- package/types/excalidraw/clipboard.d.ts +68 -5
- package/types/excalidraw/components/Actions.d.ts +20 -7
- package/types/excalidraw/components/App.d.ts +63 -38
- package/types/excalidraw/components/ButtonIcon.d.ts +1 -0
- package/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
- package/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -1
- package/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -3
- package/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +3 -3
- package/types/excalidraw/components/ColorPicker/ShadeList.d.ts +3 -2
- package/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
- package/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
- package/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
- package/types/excalidraw/components/Ellipsify.d.ts +3 -0
- package/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
- package/types/excalidraw/components/FixedSideContainer.d.ts +2 -1
- package/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
- package/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
- package/types/excalidraw/components/HintViewer.d.ts +4 -3
- package/types/excalidraw/components/InlineIcon.d.ts +3 -1
- package/types/excalidraw/components/LayerUI.d.ts +2 -1
- package/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
- package/types/excalidraw/components/MobileMenu.d.ts +4 -5
- package/types/excalidraw/components/MobileToolBar.d.ts +10 -0
- package/types/excalidraw/components/Popover.d.ts +2 -1
- package/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
- package/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
- package/types/excalidraw/components/Range.d.ts +3 -3
- package/types/excalidraw/components/Section.d.ts +1 -0
- package/types/excalidraw/components/Stats/Angle.d.ts +1 -1
- package/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
- package/types/excalidraw/components/Stats/CanvasGridSize.d.ts +1 -1
- package/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
- package/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
- package/types/excalidraw/components/Stats/DragInput.d.ts +12 -2
- package/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
- package/types/excalidraw/components/Stats/Position.d.ts +1 -1
- package/types/excalidraw/components/Stats/utils.d.ts +4 -11
- package/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
- package/types/excalidraw/components/TextField.d.ts +1 -0
- package/types/excalidraw/components/ToolPopover.d.ts +25 -0
- package/types/excalidraw/components/TrayMenu.d.ts +26 -0
- package/types/excalidraw/components/UnlockPopup.d.ts +8 -0
- package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +4 -2
- package/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
- package/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
- package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
- package/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
- package/types/excalidraw/components/icons.d.ts +13 -0
- package/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +14 -1
- package/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
- package/types/excalidraw/components/shapes.d.ts +115 -5
- package/types/excalidraw/data/blob.d.ts +3 -7
- package/types/excalidraw/data/reconcile.d.ts +1 -0
- package/types/excalidraw/data/restore.d.ts +6 -1
- package/types/excalidraw/data/transform.d.ts +1 -1
- package/types/excalidraw/data/types.d.ts +4 -1
- package/types/excalidraw/editor-jotai.d.ts +6 -6
- package/types/excalidraw/eraser/index.d.ts +12 -0
- package/types/excalidraw/fonts/Fonts.d.ts +1 -1
- package/types/excalidraw/history.d.ts +30 -22
- package/types/excalidraw/hooks/useEmitter.d.ts +1 -1
- package/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
- package/types/excalidraw/index.d.ts +15 -14
- package/types/excalidraw/lasso/index.d.ts +1 -0
- package/types/excalidraw/lasso/utils.d.ts +3 -3
- package/types/excalidraw/obsidianUtils.d.ts +22 -4
- package/types/excalidraw/renderer/helpers.d.ts +7 -2
- package/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/types/excalidraw/renderer/staticScene.d.ts +4 -1
- package/types/excalidraw/scene/Renderer.d.ts +1 -2
- package/types/excalidraw/scene/index.d.ts +2 -2
- package/types/excalidraw/scene/scrollbars.d.ts +2 -3
- package/types/excalidraw/scene/types.d.ts +5 -3
- package/types/excalidraw/shortcut.d.ts +1 -0
- package/types/excalidraw/snapping.d.ts +2 -2
- package/types/excalidraw/types.d.ts +68 -30
- package/types/excalidraw/webpack.dev.config.d.ts +2 -0
- package/types/excalidraw/webpack.prod.config.d.ts +2 -0
- package/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
- package/types/math/src/angle.d.ts +2 -0
- package/types/math/src/constants.d.ts +3 -0
- package/types/math/src/curve.d.ts +34 -0
- package/types/math/src/index.d.ts +1 -0
- package/types/math/src/point.d.ts +1 -1
- package/types/math/src/rectangle.d.ts +2 -0
- package/types/math/src/segment.d.ts +1 -0
- package/types/math/src/types.d.ts +1 -0
- package/types/math/src/vector.d.ts +8 -2
- package/types/utils/src/bbox.d.ts +1 -1
- package/types/utils/src/index.d.ts +1 -1
- package/types/utils/src/withinBounds.d.ts +1 -1
- package/types/element/src/Shape.d.ts +0 -17
- package/types/element/src/ShapeCache.d.ts +0 -25
- package/types/element/src/shapes.d.ts +0 -23
- package/types/excalidraw/components/ButtonSelect.d.ts +0 -9
- package/types/excalidraw/store.d.ts +0 -129
- package/types/excalidraw/visualdebug.d.ts +0 -41
- package/types/utils/src/collision.d.ts +0 -8
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorPaletteCustom } from "@excalidraw/common";
|
|
2
|
-
import type { SuggestedBinding } from "@excalidraw/element
|
|
3
|
-
import type { LinearElementEditor } from "@excalidraw/element
|
|
4
|
-
import type { MaybeTransformHandleType } from "@excalidraw/element
|
|
5
|
-
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId,
|
|
1
|
+
import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorPaletteCustom, EditorInterface } from "@excalidraw/common";
|
|
2
|
+
import type { SuggestedBinding } from "@excalidraw/element";
|
|
3
|
+
import type { LinearElementEditor } from "@excalidraw/element";
|
|
4
|
+
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
5
|
+
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
|
|
6
6
|
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
|
|
7
|
+
import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
|
|
7
8
|
import type { Action } from "./actions/types";
|
|
8
9
|
import type { Spreadsheet } from "./charts";
|
|
9
10
|
import type { ClipboardData } from "./clipboard";
|
|
@@ -12,7 +13,6 @@ import type Library from "./data/library";
|
|
|
12
13
|
import type { FileSystemHandle } from "./data/filesystem";
|
|
13
14
|
import type { ContextMenuItems } from "./components/ContextMenu";
|
|
14
15
|
import type { SnapLine } from "./snapping";
|
|
15
|
-
import type { CaptureUpdateActionType } from "./store";
|
|
16
16
|
import type { ImportedDataState } from "./data/types";
|
|
17
17
|
import type { Language } from "./i18n";
|
|
18
18
|
import type { isOverScrollBars } from "./scene/scrollbars";
|
|
@@ -113,7 +113,6 @@ type _CommonCanvasAppState = {
|
|
|
113
113
|
offsetLeft: AppState["offsetLeft"];
|
|
114
114
|
offsetTop: AppState["offsetTop"];
|
|
115
115
|
theme: AppState["theme"];
|
|
116
|
-
pendingImageElementId: AppState["pendingImageElementId"];
|
|
117
116
|
};
|
|
118
117
|
export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
119
118
|
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
@@ -126,6 +125,7 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
126
125
|
frameRendering: AppState["frameRendering"];
|
|
127
126
|
linkOpacity: AppState["linkOpacity"];
|
|
128
127
|
gridColor: AppState["gridColor"];
|
|
128
|
+
gridDirection: AppState["gridDirection"];
|
|
129
129
|
frameColor: AppState["frameColor"];
|
|
130
130
|
currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
|
|
131
131
|
hoveredElementIds: AppState["hoveredElementIds"];
|
|
@@ -133,7 +133,6 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
133
133
|
}>;
|
|
134
134
|
export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
135
135
|
activeEmbeddable: AppState["activeEmbeddable"];
|
|
136
|
-
editingLinearElement: AppState["editingLinearElement"];
|
|
137
136
|
selectionElement: AppState["selectionElement"];
|
|
138
137
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
139
138
|
selectedLinearElement: AppState["selectedLinearElement"];
|
|
@@ -147,10 +146,12 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
147
146
|
zenModeEnabled: AppState["zenModeEnabled"];
|
|
148
147
|
editingTextElement: AppState["editingTextElement"];
|
|
149
148
|
gridColor: AppState["gridColor"];
|
|
149
|
+
gridDirection: AppState["gridDirection"];
|
|
150
150
|
highlightSearchResult: AppState["highlightSearchResult"];
|
|
151
151
|
isCropping: AppState["isCropping"];
|
|
152
152
|
croppingElementId: AppState["croppingElementId"];
|
|
153
153
|
searchMatches: AppState["searchMatches"];
|
|
154
|
+
activeLockedId: AppState["activeLockedId"];
|
|
154
155
|
}>;
|
|
155
156
|
export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
|
|
156
157
|
export type ObservedStandaloneAppState = {
|
|
@@ -161,9 +162,13 @@ export type ObservedElementsAppState = {
|
|
|
161
162
|
editingGroupId: AppState["editingGroupId"];
|
|
162
163
|
selectedElementIds: AppState["selectedElementIds"];
|
|
163
164
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
selectedLinearElement: {
|
|
166
|
+
elementId: LinearElementEditor["elementId"];
|
|
167
|
+
isEditing: boolean;
|
|
168
|
+
} | null;
|
|
166
169
|
croppingElementId: AppState["croppingElementId"];
|
|
170
|
+
lockedMultiSelections: AppState["lockedMultiSelections"];
|
|
171
|
+
activeLockedId: AppState["activeLockedId"];
|
|
167
172
|
};
|
|
168
173
|
export interface AppState {
|
|
169
174
|
contextMenu: {
|
|
@@ -207,6 +212,8 @@ export interface AppState {
|
|
|
207
212
|
name: boolean;
|
|
208
213
|
outline: boolean;
|
|
209
214
|
clip: boolean;
|
|
215
|
+
markerName: boolean;
|
|
216
|
+
markerEnabled: boolean;
|
|
210
217
|
};
|
|
211
218
|
editingFrame: string | null;
|
|
212
219
|
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
@@ -214,7 +221,6 @@ export interface AppState {
|
|
|
214
221
|
* set when a new text is created or when an existing text is being edited
|
|
215
222
|
*/
|
|
216
223
|
editingTextElement: NonDeletedExcalidrawElement | null;
|
|
217
|
-
editingLinearElement: LinearElementEditor | null;
|
|
218
224
|
activeTool: {
|
|
219
225
|
/**
|
|
220
226
|
* indicates a previous tool we should revert back to if we deselect the
|
|
@@ -224,6 +230,10 @@ export interface AppState {
|
|
|
224
230
|
locked: boolean;
|
|
225
231
|
fromSelection: boolean;
|
|
226
232
|
} & ActiveTool;
|
|
233
|
+
preferredSelectionTool: {
|
|
234
|
+
type: "selection" | "lasso";
|
|
235
|
+
initialized: boolean;
|
|
236
|
+
};
|
|
227
237
|
penMode: boolean;
|
|
228
238
|
penDetected: boolean;
|
|
229
239
|
exportBackground: boolean;
|
|
@@ -245,6 +255,7 @@ export interface AppState {
|
|
|
245
255
|
currentHoveredFontFamily: FontFamilyValues | null;
|
|
246
256
|
currentItemRoundness: StrokeRoundness;
|
|
247
257
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
258
|
+
currentItemFrameRole: ExcalidrawFrameLikeElement["frameRole"] | null;
|
|
248
259
|
viewBackgroundColor: string;
|
|
249
260
|
scrollX: number;
|
|
250
261
|
scrollY: number;
|
|
@@ -255,7 +266,7 @@ export interface AppState {
|
|
|
255
266
|
isRotating: boolean;
|
|
256
267
|
zoom: Zoom;
|
|
257
268
|
openMenu: "canvas" | "shape" | null;
|
|
258
|
-
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | null;
|
|
269
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
259
270
|
openSidebar: {
|
|
260
271
|
name: SidebarName;
|
|
261
272
|
tab?: SidebarTabName;
|
|
@@ -329,11 +340,8 @@ export interface AppState {
|
|
|
329
340
|
shown: true;
|
|
330
341
|
data: Spreadsheet;
|
|
331
342
|
};
|
|
332
|
-
/** imageElement waiting to be placed on canvas */
|
|
333
|
-
pendingImageElementId: ExcalidrawImageElement["id"] | null;
|
|
334
343
|
showHyperlinkPopup: false | "info" | "editor";
|
|
335
344
|
linkOpacity: number;
|
|
336
|
-
trayModeEnabled: boolean;
|
|
337
345
|
colorPalette?: {
|
|
338
346
|
canvasBackground: ColorPaletteCustom;
|
|
339
347
|
elementBackground: ColorPaletteCustom;
|
|
@@ -346,6 +354,7 @@ export interface AppState {
|
|
|
346
354
|
};
|
|
347
355
|
allowWheelZoom?: boolean;
|
|
348
356
|
allowPinchZoom?: boolean;
|
|
357
|
+
disableContextMenu: boolean;
|
|
349
358
|
pinnedScripts?: string[];
|
|
350
359
|
customPens?: any[];
|
|
351
360
|
currentStrokeOptions?: any;
|
|
@@ -354,6 +363,10 @@ export interface AppState {
|
|
|
354
363
|
Bold: string;
|
|
355
364
|
Regular: string;
|
|
356
365
|
};
|
|
366
|
+
gridDirection: {
|
|
367
|
+
horizontal: boolean;
|
|
368
|
+
vertical: boolean;
|
|
369
|
+
};
|
|
357
370
|
highlightSearchResult: boolean;
|
|
358
371
|
dynamicStyle: {
|
|
359
372
|
[x: string]: string;
|
|
@@ -378,9 +391,18 @@ export interface AppState {
|
|
|
378
391
|
/** image cropping */
|
|
379
392
|
isCropping: boolean;
|
|
380
393
|
croppingElementId: ExcalidrawElement["id"] | null;
|
|
381
|
-
|
|
394
|
+
/** null if no search matches found / search closed */
|
|
395
|
+
searchMatches: Readonly<{
|
|
396
|
+
focusedId: ExcalidrawElement["id"] | null;
|
|
397
|
+
matches: readonly SearchMatch[];
|
|
398
|
+
}> | null;
|
|
399
|
+
/** the locked element/group that's active and shows unlock popup */
|
|
400
|
+
activeLockedId: string | null;
|
|
401
|
+
lockedMultiSelections: {
|
|
402
|
+
[groupId: string]: true;
|
|
403
|
+
};
|
|
382
404
|
}
|
|
383
|
-
type SearchMatch = {
|
|
405
|
+
export type SearchMatch = {
|
|
384
406
|
id: string;
|
|
385
407
|
focus: boolean;
|
|
386
408
|
matchedLines: {
|
|
@@ -388,6 +410,7 @@ type SearchMatch = {
|
|
|
388
410
|
offsetY: number;
|
|
389
411
|
width: number;
|
|
390
412
|
height: number;
|
|
413
|
+
showOnCanvas: boolean;
|
|
391
414
|
}[];
|
|
392
415
|
};
|
|
393
416
|
export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
|
|
@@ -440,6 +463,7 @@ export type OnUserFollowedPayload = {
|
|
|
440
463
|
};
|
|
441
464
|
export interface ExcalidrawProps {
|
|
442
465
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
466
|
+
onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
|
|
443
467
|
initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
|
|
444
468
|
excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
|
|
445
469
|
isCollaborating?: boolean;
|
|
@@ -468,6 +492,7 @@ export interface ExcalidrawProps {
|
|
|
468
492
|
onDuplicate?: (nextElements: readonly ExcalidrawElement[],
|
|
469
493
|
/** excludes the duplicated elements */
|
|
470
494
|
prevElements: readonly ExcalidrawElement[]) => ExcalidrawElement[] | void;
|
|
495
|
+
renderTopLeftUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
471
496
|
renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
472
497
|
langCode?: Language["code"];
|
|
473
498
|
viewModeEnabled?: boolean;
|
|
@@ -512,6 +537,7 @@ export interface ExcalidrawProps {
|
|
|
512
537
|
aiEnabled?: boolean;
|
|
513
538
|
showDeprecatedFonts?: boolean;
|
|
514
539
|
insertLinkAction?: (linkVal: string) => void;
|
|
540
|
+
renderScrollbars?: boolean;
|
|
515
541
|
}
|
|
516
542
|
export type SceneData = {
|
|
517
543
|
elements?: ImportedDataState["elements"];
|
|
@@ -539,6 +565,12 @@ export type UIOptions = Partial<{
|
|
|
539
565
|
tools: {
|
|
540
566
|
image: boolean;
|
|
541
567
|
};
|
|
568
|
+
/**
|
|
569
|
+
* Optionally control the editor form factor and desktop UI mode from the host app.
|
|
570
|
+
* If not provided, we will take care of it internally.
|
|
571
|
+
*/
|
|
572
|
+
formFactor?: EditorInterface["formFactor"];
|
|
573
|
+
desktopUIMode?: EditorInterface["desktopUIMode"];
|
|
542
574
|
/** @deprecated does nothing. Will be removed in 0.15 */
|
|
543
575
|
welcomeScreen?: boolean;
|
|
544
576
|
}>;
|
|
@@ -569,7 +601,7 @@ export type AppClassProperties = {
|
|
|
569
601
|
mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
570
602
|
}>;
|
|
571
603
|
files: BinaryFiles;
|
|
572
|
-
|
|
604
|
+
editorInterface: App["editorInterface"];
|
|
573
605
|
scene: App["scene"];
|
|
574
606
|
syncActionResult: App["syncActionResult"];
|
|
575
607
|
fonts: App["fonts"];
|
|
@@ -598,6 +630,8 @@ export type AppClassProperties = {
|
|
|
598
630
|
visibleElements: App["visibleElements"];
|
|
599
631
|
excalidrawContainerValue: App["excalidrawContainerValue"];
|
|
600
632
|
onPointerUpEmitter: App["onPointerUpEmitter"];
|
|
633
|
+
updateEditorAtom: App["updateEditorAtom"];
|
|
634
|
+
onPointerDownEmitter: App["onPointerDownEmitter"];
|
|
601
635
|
};
|
|
602
636
|
export type PointerDownState = Readonly<{
|
|
603
637
|
origin: Readonly<{
|
|
@@ -641,6 +675,11 @@ export type PointerDownState = Readonly<{
|
|
|
641
675
|
x: number;
|
|
642
676
|
y: number;
|
|
643
677
|
} | null;
|
|
678
|
+
origin: {
|
|
679
|
+
x: number;
|
|
680
|
+
y: number;
|
|
681
|
+
};
|
|
682
|
+
blockDragging: boolean;
|
|
644
683
|
};
|
|
645
684
|
eventListeners: {
|
|
646
685
|
onMove: null | ReturnType<typeof throttleRAF>;
|
|
@@ -655,13 +694,22 @@ export type PointerDownState = Readonly<{
|
|
|
655
694
|
export type UnsubscribeCallback = () => void;
|
|
656
695
|
export interface ExcalidrawImperativeAPI {
|
|
657
696
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
697
|
+
applyDeltas: InstanceType<typeof App>["applyDeltas"];
|
|
698
|
+
mutateElement: InstanceType<typeof App>["mutateElement"];
|
|
658
699
|
updateLibrary: InstanceType<typeof Library>["updateLibrary"];
|
|
659
700
|
resetScene: InstanceType<typeof App>["resetScene"];
|
|
660
701
|
getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
|
|
702
|
+
getSceneElementsMapIncludingDeleted: InstanceType<typeof App>["getSceneElementsMapIncludingDeleted"];
|
|
661
703
|
history: {
|
|
662
704
|
clear: InstanceType<typeof App>["resetHistory"];
|
|
663
705
|
};
|
|
706
|
+
setForceRenderAllEmbeddables: InstanceType<typeof App>["setForceRenderAllEmbeddables"];
|
|
664
707
|
zoomToFit: InstanceType<typeof App>["zoomToFit"];
|
|
708
|
+
refreshEditorInterface: InstanceType<typeof App>["refreshEditorInterface"];
|
|
709
|
+
isTouchScreen: InstanceType<typeof App>["isTouchScreen"];
|
|
710
|
+
setTrayModeEnabled: InstanceType<typeof App>["setTrayModeEnabled"];
|
|
711
|
+
setDesktopUIMode: InstanceType<typeof App>["setDesktopUIMode"];
|
|
712
|
+
isTrayModeEnabled: InstanceType<typeof App>["isTrayModeEnabled"];
|
|
665
713
|
getColorAtScenePoint: InstanceType<typeof App>["getColorAtScenePoint"];
|
|
666
714
|
startLineEditor: InstanceType<typeof App>["startLineEditor"];
|
|
667
715
|
getSceneElements: InstanceType<typeof App>["getSceneElements"];
|
|
@@ -680,12 +728,12 @@ export interface ExcalidrawImperativeAPI {
|
|
|
680
728
|
bringForward: (elements: readonly ExcalidrawElement[]) => void;
|
|
681
729
|
sendToBack: (elements: readonly ExcalidrawElement[]) => void;
|
|
682
730
|
bringToFront: (elements: readonly ExcalidrawElement[]) => void;
|
|
683
|
-
setMobileModeAllowed: (allow: boolean) => void;
|
|
684
731
|
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
685
732
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
686
733
|
resetCursor: InstanceType<typeof App>["resetCursor"];
|
|
687
734
|
toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
|
|
688
735
|
getHTMLIFrameElement: InstanceType<typeof App>["getHTMLIFrameElement"];
|
|
736
|
+
getEditorInterface: () => EditorInterface;
|
|
689
737
|
/**
|
|
690
738
|
* Disables rendering of frames (including element clipping), but currently
|
|
691
739
|
* the frames are still interactive in edit mode. As such, this API should be
|
|
@@ -693,22 +741,12 @@ export interface ExcalidrawImperativeAPI {
|
|
|
693
741
|
*/
|
|
694
742
|
updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
|
|
695
743
|
onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
|
|
744
|
+
onIncrement: (callback: (event: DurableIncrement | EphemeralIncrement) => void) => UnsubscribeCallback;
|
|
696
745
|
onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
|
|
697
746
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
698
747
|
onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
|
|
699
748
|
onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
|
|
700
749
|
}
|
|
701
|
-
export type Device = Readonly<{
|
|
702
|
-
viewport: {
|
|
703
|
-
isMobile: boolean;
|
|
704
|
-
isLandscape: boolean;
|
|
705
|
-
};
|
|
706
|
-
editor: {
|
|
707
|
-
isMobile: boolean;
|
|
708
|
-
canFitSidebar: boolean;
|
|
709
|
-
};
|
|
710
|
-
isTouchScreen: boolean;
|
|
711
|
-
}>;
|
|
712
750
|
export type FrameNameBounds = {
|
|
713
751
|
x: number;
|
|
714
752
|
y: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
2
2
|
import type App from "../components/App";
|
|
3
|
+
type SubmitHandler = () => void;
|
|
3
4
|
export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, autoSelect, }: {
|
|
4
5
|
id: ExcalidrawElement["id"];
|
|
5
6
|
/**
|
|
@@ -19,4 +20,5 @@ export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords,
|
|
|
19
20
|
excalidrawContainer: HTMLDivElement | null;
|
|
20
21
|
app: App;
|
|
21
22
|
autoSelect?: boolean | undefined;
|
|
22
|
-
}) =>
|
|
23
|
+
}) => SubmitHandler;
|
|
24
|
+
export {};
|
|
@@ -15,3 +15,5 @@ export declare function radiansToDegrees(degrees: Radians): Degrees;
|
|
|
15
15
|
* @returns TRUE if the provided angle is a right angle
|
|
16
16
|
*/
|
|
17
17
|
export declare function isRightAngleRads(rads: Radians): boolean;
|
|
18
|
+
export declare function radiansBetweenAngles(a: Radians, min: Radians, max: Radians): boolean;
|
|
19
|
+
export declare function radiansDifference(a: Radians, b: Radians): Radians;
|
|
@@ -8,6 +8,7 @@ import type { Curve, GlobalPoint, LineSegment, LocalPoint } from "./types";
|
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
10
|
export declare function curve<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, c: Point, d: Point): Curve<Point>;
|
|
11
|
+
export declare const bezierEquation: <Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, t: number) => Point;
|
|
11
12
|
/**
|
|
12
13
|
* Computes the intersection between a cubic spline and a line segment.
|
|
13
14
|
*/
|
|
@@ -38,3 +39,36 @@ export declare function curvePointDistance<Point extends GlobalPoint | LocalPoin
|
|
|
38
39
|
* Determines if the parameter is a Curve
|
|
39
40
|
*/
|
|
40
41
|
export declare function isCurve<P extends GlobalPoint | LocalPoint>(v: unknown): v is Curve<P>;
|
|
42
|
+
export declare function curveTangent<Point extends GlobalPoint | LocalPoint>([p0, p1, p2, p3]: Curve<Point>, t: number): import("./types").Vector;
|
|
43
|
+
export declare function curveCatmullRomQuadraticApproxPoints(points: GlobalPoint[], tension?: number): [GlobalPoint, GlobalPoint][] | undefined;
|
|
44
|
+
export declare function curveCatmullRomCubicApproxPoints<Point extends GlobalPoint | LocalPoint>(points: Point[], tension?: number): Curve<Point>[] | undefined;
|
|
45
|
+
export declare function curveOffsetPoints([p0, p1, p2, p3]: Curve<GlobalPoint>, offset: number, steps?: number): GlobalPoint[];
|
|
46
|
+
export declare function offsetPointsForQuadraticBezier(p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, offsetDist: number, steps?: number): GlobalPoint[];
|
|
47
|
+
/**
|
|
48
|
+
* Implementation based on Legendre-Gauss quadrature for more accurate arc
|
|
49
|
+
* length calculation.
|
|
50
|
+
*
|
|
51
|
+
* Reference: https://pomax.github.io/bezierinfo/#arclength
|
|
52
|
+
*
|
|
53
|
+
* @param c The curve to calculate the length of
|
|
54
|
+
* @returns The approximated length of the curve
|
|
55
|
+
*/
|
|
56
|
+
export declare function curveLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>): number;
|
|
57
|
+
/**
|
|
58
|
+
* Calculates the curve length from t=0 to t=parameter using the same
|
|
59
|
+
* Legendre-Gauss quadrature method used in curveLength
|
|
60
|
+
*
|
|
61
|
+
* @param c The curve to calculate the partial length for
|
|
62
|
+
* @param t The parameter value (0 to 1) to calculate length up to
|
|
63
|
+
* @returns The length of the curve from beginning to parameter t
|
|
64
|
+
*/
|
|
65
|
+
export declare function curveLengthAtParameter<P extends GlobalPoint | LocalPoint>(c: Curve<P>, t: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* Calculates the point at a specific percentage of a curve's total length
|
|
68
|
+
* using binary search for improved efficiency and accuracy.
|
|
69
|
+
*
|
|
70
|
+
* @param c The curve to calculate point on
|
|
71
|
+
* @param percent A value between 0 and 1 representing the percentage of the curve's length
|
|
72
|
+
* @returns The point at the specified percentage of curve length
|
|
73
|
+
*/
|
|
74
|
+
export declare function curvePointAtLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>, percent: number): P;
|
|
@@ -43,7 +43,7 @@ export declare function isPoint(p: unknown): p is LocalPoint | GlobalPoint;
|
|
|
43
43
|
* @param b Point The second point to compare
|
|
44
44
|
* @returns TRUE if the points are sufficiently close to each other
|
|
45
45
|
*/
|
|
46
|
-
export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point): boolean;
|
|
46
|
+
export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, tolerance?: number): boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Rotate a point by [angle] radians.
|
|
49
49
|
*
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { GlobalPoint, LineSegment, LocalPoint, Rectangle } from "./types";
|
|
2
2
|
export declare function rectangle<P extends GlobalPoint | LocalPoint>(topLeft: P, bottomRight: P): Rectangle<P>;
|
|
3
|
+
export declare function rectangleFromNumberSequence<Point extends LocalPoint | GlobalPoint>(minX: number, minY: number, maxX: number, maxY: number): Rectangle<Point>;
|
|
3
4
|
export declare function rectangleIntersectLineSegment<Point extends LocalPoint | GlobalPoint>(r: Rectangle<Point>, l: LineSegment<Point>): Point[];
|
|
5
|
+
export declare function rectangleIntersectRectangle<Point extends LocalPoint | GlobalPoint>(rectangle1: Rectangle<Point>, rectangle2: Rectangle<Point>): boolean;
|
|
@@ -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;
|
|
@@ -12,9 +12,11 @@ export declare function vector(x: number, y: number, originX?: number, originY?:
|
|
|
12
12
|
*
|
|
13
13
|
* @param p The point to turn into a vector
|
|
14
14
|
* @param origin The origin point in a given coordiante system
|
|
15
|
-
* @
|
|
15
|
+
* @param threshold The threshold to consider the vector as 'undefined'
|
|
16
|
+
* @param defaultValue The default value to return if the vector is 'undefined'
|
|
17
|
+
* @returns The created vector from the point and the origin or default
|
|
16
18
|
*/
|
|
17
|
-
export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point): Vector;
|
|
19
|
+
export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point, threshold?: number, defaultValue?: Vector): Vector;
|
|
18
20
|
/**
|
|
19
21
|
* Cross product is a binary operation on two vectors in 2D space.
|
|
20
22
|
* It results in a vector that is perpendicular to both vectors.
|
|
@@ -86,3 +88,7 @@ export declare function vectorMagnitude(v: Vector): number;
|
|
|
86
88
|
* @returns The new normalized vector
|
|
87
89
|
*/
|
|
88
90
|
export declare const vectorNormalize: (v: Vector) => Vector;
|
|
91
|
+
/**
|
|
92
|
+
* Calculate the right-hand normal of the vector.
|
|
93
|
+
*/
|
|
94
|
+
export declare const vectorNormal: (v: Vector) => Vector;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
|
|
2
|
-
import type { Bounds } from "@excalidraw/element
|
|
2
|
+
import type { Bounds } from "@excalidraw/element";
|
|
3
3
|
export type LineSegment<P extends LocalPoint | GlobalPoint> = [P, P];
|
|
4
4
|
export declare function getBBox<P extends LocalPoint | GlobalPoint>(line: LineSegment<P>): Bounds;
|
|
5
5
|
export declare function doBBoxesIntersect(a: Bounds, b: Bounds): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Bounds } from "@excalidraw/element
|
|
1
|
+
import type { Bounds } from "@excalidraw/element";
|
|
2
2
|
import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
type Element = NonDeletedExcalidrawElement;
|
|
4
4
|
type Elements = readonly NonDeletedExcalidrawElement[];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { EmbedsValidationStatus } from "@excalidraw/excalidraw/types";
|
|
2
|
-
import type { ExcalidrawElement, NonDeletedExcalidrawElement, ExcalidrawSelectionElement } from "./types";
|
|
3
|
-
import type { Drawable, Options } from "roughjs/bin/core";
|
|
4
|
-
import type { RoughGenerator } from "roughjs/bin/generator";
|
|
5
|
-
export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
|
|
6
|
-
/**
|
|
7
|
-
* Generates the roughjs shape for given element.
|
|
8
|
-
*
|
|
9
|
-
* Low-level. Use `ShapeCache.generateElementShape` instead.
|
|
10
|
-
*
|
|
11
|
-
* @private
|
|
12
|
-
*/
|
|
13
|
-
export declare const _generateElementShape: (element: Exclude<NonDeletedExcalidrawElement, ExcalidrawSelectionElement>, generator: RoughGenerator, { isExporting, canvasBackgroundColor, embedsValidationStatus, }: {
|
|
14
|
-
isExporting: boolean;
|
|
15
|
-
canvasBackgroundColor: string;
|
|
16
|
-
embedsValidationStatus: EmbedsValidationStatus | null;
|
|
17
|
-
}) => Drawable | Drawable[] | null;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { AppState, EmbedsValidationStatus } from "@excalidraw/excalidraw/types";
|
|
2
|
-
import type { ElementShape, ElementShapes } from "@excalidraw/excalidraw/scene/types";
|
|
3
|
-
import type { ExcalidrawElement } from "./types";
|
|
4
|
-
import type { Drawable } from "roughjs/bin/core";
|
|
5
|
-
export declare class ShapeCache {
|
|
6
|
-
private static rg;
|
|
7
|
-
private static cache;
|
|
8
|
-
/**
|
|
9
|
-
* Retrieves shape from cache if available. Use this only if shape
|
|
10
|
-
* is optional and you have a fallback in case it's not cached.
|
|
11
|
-
*/
|
|
12
|
-
static get: <T extends ExcalidrawElement>(element: T) => T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined;
|
|
13
|
-
static set: <T extends ExcalidrawElement>(element: T, shape: T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable) => WeakMap<ExcalidrawElement, ElementShape>;
|
|
14
|
-
static delete: (element: ExcalidrawElement) => boolean;
|
|
15
|
-
static destroy: () => void;
|
|
16
|
-
/**
|
|
17
|
-
* Generates & caches shape for element if not already cached, otherwise
|
|
18
|
-
* returns cached shape.
|
|
19
|
-
*/
|
|
20
|
-
static generateElementShape: <T extends import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawArrowElement | import("./types").ExcalidrawFreeDrawElement>(element: T, renderConfig: {
|
|
21
|
-
isExporting: boolean;
|
|
22
|
-
canvasBackgroundColor: AppState["viewBackgroundColor"];
|
|
23
|
-
embedsValidationStatus: EmbedsValidationStatus;
|
|
24
|
-
} | null) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
|
|
25
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
|
|
2
|
-
import { type GeometricShape } from "@excalidraw/utils/shape";
|
|
3
|
-
import type { Zoom } from "@excalidraw/excalidraw/types";
|
|
4
|
-
import { type Bounds } from "./bounds";
|
|
5
|
-
import type { ElementsMap, ExcalidrawElement, ExcalidrawLinearElement, NonDeleted } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
* get the pure geometric shape of an excalidraw elementw
|
|
8
|
-
* which is then used for hit detection
|
|
9
|
-
*/
|
|
10
|
-
export declare const getElementShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap) => GeometricShape<Point>;
|
|
11
|
-
export declare const getBoundTextShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap) => GeometricShape<Point> | null;
|
|
12
|
-
export declare const getControlPointsForBezierCurve: <P extends GlobalPoint | LocalPoint>(element: NonDeleted<ExcalidrawLinearElement>, endPoint: P) => P[] | null;
|
|
13
|
-
export declare const getBezierXY: <P extends GlobalPoint | LocalPoint>(p0: P, p1: P, p2: P, p3: P, t: number) => P;
|
|
14
|
-
export declare const getBezierCurveLength: <P extends GlobalPoint | LocalPoint>(element: NonDeleted<ExcalidrawLinearElement>, endPoint: P) => number;
|
|
15
|
-
export declare const mapIntervalToBezierT: <P extends GlobalPoint | LocalPoint>(element: NonDeleted<ExcalidrawLinearElement>, endPoint: P, interval: number) => number;
|
|
16
|
-
/**
|
|
17
|
-
* Get the axis-aligned bounding box for a given element
|
|
18
|
-
*/
|
|
19
|
-
export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, offset?: [number, number, number, number]) => Bounds;
|
|
20
|
-
export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
|
|
21
|
-
export declare const aabbsOverlapping: (a: Bounds, b: Bounds) => boolean;
|
|
22
|
-
export declare const getCornerRadius: (x: number, element: ExcalidrawElement) => number;
|
|
23
|
-
export declare const isPathALoop: (points: ExcalidrawLinearElement["points"], zoomValue?: Zoom["value"]) => boolean;
|