@dwelle/excalidraw 0.4.0-e1bdbb6 → 0.4.0-e587816
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/CHANGELOG.md +714 -0
- package/README.md +18 -1422
- package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js → vendor-d415b28e9024dee4bb1b.js} +2 -2
- package/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.js → vendor-a14cd58fa2db417e42b2.js} +6 -6
- package/dist/excalidraw.development.js +3257 -1444
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +20 -0
- package/main.js +1 -8
- package/package.json +9 -4
- package/types/actions/actionAddToLibrary.d.ts +124 -64
- package/types/actions/actionAlign.d.ts +33 -40
- package/types/actions/actionBoundText.d.ts +182 -25
- package/types/actions/actionCanvas.d.ts +754 -220
- package/types/actions/actionClipboard.d.ts +236 -115
- package/types/actions/actionDeleteSelected.d.ts +133 -72
- package/types/actions/actionDistribute.d.ts +11 -16
- package/types/actions/actionDuplicateSelection.d.ts +4 -7
- package/types/actions/actionElementLock.d.ts +271 -0
- package/types/actions/actionExport.d.ts +440 -277
- package/types/actions/actionFinalize.d.ts +85 -51
- package/types/actions/actionFlip.d.ts +8 -11
- package/types/actions/actionFrame.d.ts +423 -0
- package/types/actions/actionGroup.d.ts +252 -19
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +44 -24
- package/types/actions/actionMenu.d.ts +132 -79
- package/types/actions/actionNavigate.d.ts +2 -3
- package/types/actions/actionProperties.d.ts +569 -334
- package/types/actions/actionSelectAll.d.ts +123 -4
- package/types/actions/actionStyles.d.ts +46 -27
- package/types/actions/actionToggleGridMode.d.ts +46 -25
- package/types/actions/{actionToggleLock.d.ts → actionToggleObjectsSnapMode.d.ts} +56 -35
- package/types/actions/actionToggleStats.d.ts +45 -25
- package/types/actions/actionToggleViewMode.d.ts +46 -25
- package/types/actions/actionToggleZenMode.d.ts +46 -25
- package/types/actions/actionZindex.d.ts +16 -24
- package/types/actions/index.d.ts +2 -1
- package/types/actions/manager.d.ts +3 -2
- package/types/actions/shortcuts.d.ts +2 -1
- package/types/actions/types.d.ts +16 -13
- package/types/appState.d.ts +27 -28
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +5 -6
- package/types/clipboard.d.ts +9 -3
- package/types/colors.d.ts +60 -5
- package/types/components/Actions.d.ts +7 -12
- package/types/components/ActiveConfirmDialog.d.ts +4 -0
- package/types/components/App.d.ts +102 -86
- package/types/components/Avatar.d.ts +1 -2
- package/types/components/BraveMeasureTextError.d.ts +2 -0
- package/types/components/Button.d.ts +16 -0
- package/types/components/ButtonIconSelect.d.ts +11 -3
- package/types/components/Card.d.ts +6 -0
- package/types/components/ColorPicker/ColorInput.d.ts +9 -0
- package/types/components/ColorPicker/ColorPicker.d.ts +19 -0
- package/types/components/ColorPicker/CustomColorList.d.ts +8 -0
- package/types/components/ColorPicker/HotkeyLabel.d.ts +8 -0
- package/types/components/ColorPicker/Picker.d.ts +18 -0
- package/types/components/ColorPicker/PickerColorList.d.ts +10 -0
- package/types/components/ColorPicker/PickerHeading.d.ts +5 -0
- package/types/components/ColorPicker/ShadeList.d.ts +8 -0
- package/types/components/ColorPicker/TopPicks.d.ts +9 -0
- package/types/components/ColorPicker/colorPickerUtils.d.ts +21 -0
- package/types/components/ColorPicker/keyboardNavHandlers.d.ts +20 -0
- package/types/components/ContextMenu.d.ts +9 -22
- package/types/components/DefaultSidebar.d.ts +29 -0
- package/types/components/Dialog.d.ts +3 -4
- package/types/components/ErrorDialog.d.ts +3 -2
- package/types/components/ExcalidrawLogo.d.ts +15 -0
- package/types/components/EyeDropper.d.ts +28 -0
- package/types/components/FilledButton.d.ts +17 -0
- package/types/components/FixedSideContainer.d.ts +1 -1
- package/types/components/HandButton.d.ts +10 -0
- package/types/components/HelpButton.d.ts +1 -2
- package/types/components/HintViewer.d.ts +4 -5
- package/types/components/HomeButton.d.ts +1 -1
- package/types/components/ImageExportDialog.d.ts +8 -13
- package/types/components/Island.d.ts +1 -1
- package/types/components/JSONExportDialog.d.ts +7 -5
- package/types/components/LaserTool/LaserPathManager.d.ts +28 -0
- package/types/components/LaserTool/LaserPointerButton.d.ts +10 -0
- package/types/components/LaserTool/LaserTool.d.ts +7 -0
- package/types/components/LayerUI.d.ts +11 -19
- package/types/components/LibraryMenu.d.ts +13 -14
- package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
- package/types/components/LibraryMenuControlButtons.d.ts +9 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +10 -5
- package/types/components/LibraryMenuItems.d.ts +6 -7
- package/types/components/LibraryMenuSection.d.ts +22 -0
- package/types/components/LibraryUnit.d.ts +6 -3
- package/types/components/LoadingMessage.d.ts +0 -1
- package/types/components/LockButton.d.ts +1 -2
- package/types/components/MobileMenu.d.ts +9 -15
- package/types/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
- package/types/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
- package/types/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
- package/types/components/PasteChartDialog.d.ts +4 -5
- package/types/components/PenModeButton.d.ts +1 -1
- package/types/components/Popover.d.ts +1 -1
- package/types/components/ProjectName.d.ts +2 -1
- package/types/components/PublishLibrary.d.ts +2 -2
- package/types/components/RadioGroup.d.ts +12 -0
- package/types/components/Section.d.ts +1 -1
- package/types/components/Sidebar/Sidebar.d.ts +66 -63
- package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
- package/types/components/Sidebar/SidebarTab.d.ts +8 -0
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +9 -0
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +6 -0
- package/types/components/Sidebar/SidebarTabs.d.ts +6 -0
- package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
- package/types/components/Sidebar/common.d.ts +24 -7
- package/types/components/Spinner.d.ts +2 -1
- package/types/components/Stack.d.ts +4 -3
- package/types/components/Stats.d.ts +3 -3
- package/types/components/Switch.d.ts +9 -0
- package/types/components/ToolButton.d.ts +6 -5
- package/types/components/Tooltip.d.ts +1 -1
- package/types/components/Trans.d.ts +9 -0
- package/types/components/UserList.d.ts +0 -2
- package/types/components/canvases/InteractiveCanvas.d.ts +27 -0
- package/types/components/canvases/StaticCanvas.d.ts +18 -0
- package/types/components/canvases/index.d.ts +3 -0
- package/types/components/dropdownMenu/DropdownMenu.d.ts +70 -0
- package/types/components/dropdownMenu/DropdownMenuContent.d.ts +15 -0
- package/types/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
- package/types/components/dropdownMenu/DropdownMenuItem.d.ts +13 -0
- package/types/components/dropdownMenu/DropdownMenuItemContent.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +7 -0
- package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +14 -0
- package/types/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +10 -0
- package/types/components/dropdownMenu/common.d.ts +6 -0
- package/types/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -0
- package/types/components/footer/Footer.d.ts +12 -0
- package/types/components/footer/FooterCenter.d.ts +8 -0
- package/types/components/hoc/withInternalFallback.d.ts +4 -0
- package/types/components/icons.d.ts +17 -2
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +9 -0
- package/types/components/main-menu/DefaultItems.d.ts +47 -0
- package/types/components/main-menu/MainMenu.d.ts +64 -0
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +57 -0
- package/types/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
- package/types/components/welcome-screen/WelcomeScreen.d.ts +84 -0
- package/types/constants.d.ts +105 -18
- package/types/context/tunnels.d.ts +19 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/cursor.d.ts +5 -0
- package/types/data/blob.d.ts +5 -3
- package/types/data/encode.d.ts +1 -1
- package/types/data/filesystem.d.ts +2 -1
- package/types/data/index.d.ts +1 -1
- package/types/data/library.d.ts +3 -45
- package/types/data/restore.d.ts +10 -4
- package/types/data/transform.d.ts +73 -0
- package/types/data/types.d.ts +3 -5
- package/types/data/url.d.ts +7 -0
- package/types/element/Hyperlink.d.ts +57 -36
- package/types/element/binding.d.ts +4 -3
- package/types/element/bounds.d.ts +41 -10
- package/types/element/collision.d.ts +7 -7
- package/types/element/dragElements.d.ts +12 -2
- package/types/element/embeddable.d.ts +153 -0
- package/types/element/image.d.ts +11 -1
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +77 -30
- package/types/element/mutateElement.d.ts +3 -2
- package/types/element/newElement.d.ts +48 -15
- package/types/element/resizeElements.d.ts +3 -3
- package/types/element/resizeTest.d.ts +2 -1
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/sizeHelpers.d.ts +8 -1
- package/types/element/sortElements.d.ts +2 -0
- package/types/element/textElement.d.ts +57 -9
- package/types/element/textWysiwyg.d.ts +7 -2
- package/types/element/transformHandles.d.ts +15 -8
- package/types/element/typeChecks.d.ts +14 -2
- package/types/element/types.d.ts +66 -35
- package/types/emitter.d.ts +1 -2
- package/types/errors.d.ts +1 -1
- package/types/frame.d.ts +46 -0
- package/types/ga.d.ts +5 -5
- package/types/groups.d.ts +15 -11
- package/types/history.d.ts +3 -3
- package/types/hooks/useCreatePortalContainer.d.ts +4 -0
- package/types/hooks/useLibraryItemSvg.d.ts +11 -0
- package/types/hooks/useOutsideClick.d.ts +19 -2
- package/types/hooks/useScrollPosition.d.ts +1 -0
- package/types/hooks/useStable.d.ts +1 -0
- package/types/hooks/useTransition.d.ts +2 -0
- package/types/i18n.d.ts +11 -2
- package/types/jotai.d.ts +20 -108
- package/types/keys.d.ts +7 -4
- package/types/math.d.ts +7 -1
- package/types/packages/bbox.d.ts +11 -0
- package/types/packages/excalidraw/example/App.d.ts +7 -1
- package/types/packages/excalidraw/example/CustomFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/MobileFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/initialData.d.ts +182 -64
- package/types/packages/excalidraw/index.d.ts +22 -4
- package/types/packages/excalidraw/main.d.ts +3 -1
- package/types/packages/excalidraw/webpack.dev.config.d.ts +5 -2
- package/types/packages/excalidraw/webpack.prod.config.d.ts +3 -0
- package/types/packages/utils.d.ts +30 -24
- package/types/packages/withinBounds.d.ts +19 -0
- package/types/renderer/renderElement.d.ts +13 -22
- package/types/renderer/renderScene.d.ts +19 -29
- package/types/renderer/renderSnaps.d.ts +2 -0
- package/types/renderer/roundRect.d.ts +1 -1
- package/types/scene/Fonts.d.ts +21 -0
- package/types/scene/Renderer.d.ts +25 -0
- package/types/scene/Scene.d.ts +42 -5
- package/types/scene/Shape.d.ts +12 -0
- package/types/scene/ShapeCache.d.ts +20 -0
- package/types/scene/comparisons.d.ts +2 -4
- package/types/scene/export.d.ts +183 -10
- package/types/scene/index.d.ts +1 -1
- package/types/scene/scroll.d.ts +1 -1
- package/types/scene/scrollbars.d.ts +2 -6
- package/types/scene/selection.d.ts +27 -6
- package/types/scene/types.d.ts +70 -26
- package/types/snapping.d.ts +108 -0
- package/types/types.d.ts +227 -91
- package/types/utility-types.d.ts +24 -0
- package/types/utils.d.ts +75 -14
- package/types/zindex.d.ts +4 -4
- package/types/components/ActiveFile.d.ts +0 -7
- package/types/components/ClearCanvas.d.ts +0 -4
- package/types/components/CollabButton.d.ts +0 -6
- package/types/components/ColorPicker.d.ts +0 -14
- package/types/components/Footer.d.ts +0 -10
- package/types/components/LibraryButton.d.ts +0 -8
- package/types/components/MenuItem.d.ts +0 -11
- package/types/components/MenuUtils.d.ts +0 -1
- package/types/components/SingleLibraryItem.d.ts +0 -10
- package/types/components/WelcomeScreen.d.ts +0 -10
- package/types/components/WelcomeScreenDecor.d.ts +0 -6
- package/types/components/hoc/withUpstreamOverride.d.ts +0 -10
- /package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js.LICENSE.txt → vendor-d415b28e9024dee4bb1b.js.LICENSE.txt} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.d.ts → vendor-d415b28e9024dee4bb1b.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.d.ts → vendor-a14cd58fa2db417e42b2.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { Point, AppState } from "../types";
|
|
1
|
+
import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer } from "./types";
|
|
2
|
+
import { Bounds } from "./bounds";
|
|
3
|
+
import { Point, AppState, PointerCoords, InteractiveCanvasAppState } from "../types";
|
|
4
4
|
import History from "../history";
|
|
5
5
|
import Scene from "../scene/Scene";
|
|
6
6
|
declare const editorMidPointsCache: {
|
|
@@ -18,6 +18,15 @@ export declare class LinearElementEditor {
|
|
|
18
18
|
prevSelectedPointsIndices: readonly number[] | null;
|
|
19
19
|
/** index */
|
|
20
20
|
lastClickedPoint: number;
|
|
21
|
+
origin: Readonly<{
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
}> | null;
|
|
25
|
+
segmentMidpoint: {
|
|
26
|
+
value: Point | null;
|
|
27
|
+
index: number | null;
|
|
28
|
+
added: boolean;
|
|
29
|
+
};
|
|
21
30
|
}>;
|
|
22
31
|
/** whether you're dragging a point */
|
|
23
32
|
readonly isDragging: boolean;
|
|
@@ -44,8 +53,8 @@ export declare class LinearElementEditor {
|
|
|
44
53
|
y: number;
|
|
45
54
|
}[]) => void, linearElementEditor: LinearElementEditor): boolean;
|
|
46
55
|
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
|
|
47
|
-
static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, appState:
|
|
48
|
-
static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState:
|
|
56
|
+
static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, appState: InteractiveCanvasAppState) => (typeof editorMidPointsCache)["points"];
|
|
57
|
+
static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState: InteractiveCanvasAppState) => void;
|
|
49
58
|
static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
|
|
50
59
|
x: number;
|
|
51
60
|
y: number;
|
|
@@ -53,14 +62,13 @@ export declare class LinearElementEditor {
|
|
|
53
62
|
static isSegmentTooShort(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, zoom: AppState["zoom"]): boolean;
|
|
54
63
|
static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number): readonly [number, number];
|
|
55
64
|
static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: Point): number;
|
|
56
|
-
static handlePointerDown(event: React.PointerEvent<
|
|
65
|
+
static handlePointerDown(event: React.PointerEvent<HTMLElement>, appState: AppState, history: History, scenePointer: {
|
|
57
66
|
x: number;
|
|
58
67
|
y: number;
|
|
59
68
|
}, linearElementEditor: LinearElementEditor): {
|
|
60
69
|
didAddPoint: boolean;
|
|
61
70
|
hitElement: NonDeleted<ExcalidrawElement> | null;
|
|
62
71
|
linearElementEditor: LinearElementEditor | null;
|
|
63
|
-
isMidPoint: boolean;
|
|
64
72
|
};
|
|
65
73
|
static arePointsEqual(point1: Point | null, point2: Point | null): boolean;
|
|
66
74
|
static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, appState: AppState): LinearElementEditor | null;
|
|
@@ -94,6 +102,15 @@ export declare class LinearElementEditor {
|
|
|
94
102
|
prevSelectedPointsIndices: readonly number[] | null;
|
|
95
103
|
/** index */
|
|
96
104
|
lastClickedPoint: number;
|
|
105
|
+
origin: Readonly<{
|
|
106
|
+
x: number;
|
|
107
|
+
y: number;
|
|
108
|
+
}> | null;
|
|
109
|
+
segmentMidpoint: {
|
|
110
|
+
value: readonly [number, number] | null;
|
|
111
|
+
index: number | null;
|
|
112
|
+
added: boolean;
|
|
113
|
+
};
|
|
97
114
|
}>;
|
|
98
115
|
isDragging: boolean;
|
|
99
116
|
lastUncommittedPoint: readonly [number, number] | null;
|
|
@@ -106,9 +123,18 @@ export declare class LinearElementEditor {
|
|
|
106
123
|
hoverPointIndex: number;
|
|
107
124
|
segmentMidPointHoveredCoords: readonly [number, number] | null;
|
|
108
125
|
};
|
|
126
|
+
contextMenu: {
|
|
127
|
+
items: import("../components/ContextMenu").ContextMenuItems;
|
|
128
|
+
top: number;
|
|
129
|
+
left: number;
|
|
130
|
+
} | null;
|
|
109
131
|
showWelcomeScreen: boolean;
|
|
110
132
|
isLoading: boolean;
|
|
111
|
-
errorMessage:
|
|
133
|
+
errorMessage: import("react").ReactNode;
|
|
134
|
+
activeEmbeddable: {
|
|
135
|
+
element: import("./types").NonDeletedExcalidrawElement;
|
|
136
|
+
state: "active" | "hover";
|
|
137
|
+
} | null;
|
|
112
138
|
draggingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
113
139
|
resizingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
114
140
|
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
@@ -116,18 +142,20 @@ export declare class LinearElementEditor {
|
|
|
116
142
|
isBindingEnabled: boolean;
|
|
117
143
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
118
144
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
145
|
+
frameToHighlight: NonDeleted<import("./types").ExcalidrawFrameElement> | null;
|
|
146
|
+
frameRendering: {
|
|
147
|
+
enabled: boolean;
|
|
148
|
+
name: boolean;
|
|
149
|
+
outline: boolean;
|
|
150
|
+
clip: boolean;
|
|
151
|
+
};
|
|
152
|
+
editingFrame: string | null;
|
|
153
|
+
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
119
154
|
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
120
155
|
activeTool: {
|
|
121
|
-
|
|
122
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
156
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
123
157
|
locked: boolean;
|
|
124
|
-
|
|
125
|
-
} | {
|
|
126
|
-
type: "custom";
|
|
127
|
-
customType: string;
|
|
128
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
129
|
-
locked: boolean;
|
|
130
|
-
};
|
|
158
|
+
} & import("../types").ActiveTool;
|
|
131
159
|
penMode: boolean;
|
|
132
160
|
penDetected: boolean;
|
|
133
161
|
exportBackground: boolean;
|
|
@@ -144,10 +172,9 @@ export declare class LinearElementEditor {
|
|
|
144
172
|
currentItemFontFamily: number;
|
|
145
173
|
currentItemFontSize: number;
|
|
146
174
|
currentItemTextAlign: string;
|
|
147
|
-
currentItemStrokeSharpness: import("./types").StrokeSharpness;
|
|
148
175
|
currentItemStartArrowhead: import("./types").Arrowhead | null;
|
|
149
176
|
currentItemEndArrowhead: import("./types").Arrowhead | null;
|
|
150
|
-
|
|
177
|
+
currentItemRoundness: import("./types").StrokeRoundness;
|
|
151
178
|
viewBackgroundColor: string;
|
|
152
179
|
scrollX: number;
|
|
153
180
|
scrollY: number;
|
|
@@ -160,18 +187,21 @@ export declare class LinearElementEditor {
|
|
|
160
187
|
value: import("../types").NormalizedZoomValue;
|
|
161
188
|
}>;
|
|
162
189
|
openMenu: "canvas" | "shape" | null;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
190
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
191
|
+
openSidebar: {
|
|
192
|
+
name: string;
|
|
193
|
+
tab?: string | undefined;
|
|
194
|
+
} | null;
|
|
195
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
196
|
+
defaultSidebarDockedPreference: boolean;
|
|
168
197
|
lastPointerDownWith: import("./types").PointerType;
|
|
169
|
-
selectedElementIds: {
|
|
170
|
-
[id: string]:
|
|
171
|
-
}
|
|
198
|
+
selectedElementIds: Readonly<{
|
|
199
|
+
[id: string]: true;
|
|
200
|
+
}>;
|
|
172
201
|
previousSelectedElementIds: {
|
|
173
|
-
[id: string]:
|
|
202
|
+
[id: string]: true;
|
|
174
203
|
};
|
|
204
|
+
selectedElementsAreBeingDragged: boolean;
|
|
175
205
|
shouldCacheIgnoreZoom: boolean;
|
|
176
206
|
toast: {
|
|
177
207
|
message: string;
|
|
@@ -179,7 +209,7 @@ export declare class LinearElementEditor {
|
|
|
179
209
|
duration?: number | undefined;
|
|
180
210
|
} | null;
|
|
181
211
|
zenModeEnabled: boolean;
|
|
182
|
-
theme:
|
|
212
|
+
theme: import("./types").Theme;
|
|
183
213
|
gridSize: number | null;
|
|
184
214
|
viewModeEnabled: boolean;
|
|
185
215
|
selectedGroupIds: {
|
|
@@ -202,8 +232,14 @@ export declare class LinearElementEditor {
|
|
|
202
232
|
data: import("../charts").Spreadsheet;
|
|
203
233
|
};
|
|
204
234
|
pendingImageElementId: string | null;
|
|
205
|
-
showHyperlinkPopup: false | "
|
|
235
|
+
showHyperlinkPopup: false | "editor" | "info";
|
|
206
236
|
selectedLinearElement: LinearElementEditor | null;
|
|
237
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
238
|
+
originSnapOffset: {
|
|
239
|
+
x: number;
|
|
240
|
+
y: number;
|
|
241
|
+
} | null;
|
|
242
|
+
objectsSnapModeEnabled: boolean;
|
|
207
243
|
};
|
|
208
244
|
};
|
|
209
245
|
static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
|
|
@@ -218,7 +254,18 @@ export declare class LinearElementEditor {
|
|
|
218
254
|
startBinding?: PointBinding;
|
|
219
255
|
endBinding?: PointBinding;
|
|
220
256
|
}): void;
|
|
257
|
+
static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState): boolean;
|
|
258
|
+
static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, snapToGrid: boolean): {
|
|
259
|
+
pointerDownState: LinearElementEditor["pointerDownState"];
|
|
260
|
+
selectedPointsIndices: LinearElementEditor["selectedPointsIndices"];
|
|
261
|
+
} | undefined;
|
|
221
262
|
private static _updatePoints;
|
|
222
263
|
private static _getShiftLockedDelta;
|
|
264
|
+
static getBoundTextElementPosition: (element: ExcalidrawLinearElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
|
|
265
|
+
x: number;
|
|
266
|
+
y: number;
|
|
267
|
+
};
|
|
268
|
+
static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementBounds: Bounds, boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
|
|
269
|
+
static getElementAbsoluteCoords: (element: ExcalidrawLinearElement, includeBoundText?: boolean) => [number, number, number, number, number, number];
|
|
223
270
|
}
|
|
224
271
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./types";
|
|
2
|
-
|
|
2
|
+
import { Mutable } from "../utility-types";
|
|
3
|
+
type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce">;
|
|
3
4
|
export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
4
5
|
export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>) => TElement;
|
|
5
6
|
/**
|
|
@@ -7,5 +8,5 @@ export declare const newElementWith: <TElement extends ExcalidrawElement>(elemen
|
|
|
7
8
|
*
|
|
8
9
|
* NOTE: does not trigger re-render.
|
|
9
10
|
*/
|
|
10
|
-
export declare const bumpVersion:
|
|
11
|
+
export declare const bumpVersion: <T extends Mutable<ExcalidrawElement>>(element: T, version?: ExcalidrawElement["version"]) => T;
|
|
11
12
|
export {};
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues,
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
|
-
|
|
3
|
+
import { MarkOptional, Mutable } from "../utility-types";
|
|
4
|
+
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
|
|
4
5
|
export declare const newElement: (opts: {
|
|
5
6
|
type: ExcalidrawGenericElement["type"];
|
|
6
7
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
8
|
+
export declare const newEmbeddableElement: (opts: {
|
|
9
|
+
type: "embeddable";
|
|
10
|
+
validated: ExcalidrawEmbeddableElement["validated"];
|
|
11
|
+
} & ElementConstructorOpts) => NonDeleted<ExcalidrawEmbeddableElement>;
|
|
12
|
+
export declare const newFrameElement: (opts: ElementConstructorOpts) => NonDeleted<ExcalidrawFrameElement>;
|
|
7
13
|
export declare const newTextElement: (opts: {
|
|
8
14
|
text: string;
|
|
9
|
-
fontSize
|
|
10
|
-
fontFamily
|
|
11
|
-
textAlign
|
|
12
|
-
verticalAlign
|
|
13
|
-
containerId?:
|
|
15
|
+
fontSize?: number;
|
|
16
|
+
fontFamily?: FontFamilyValues;
|
|
17
|
+
textAlign?: TextAlign;
|
|
18
|
+
verticalAlign?: VerticalAlign;
|
|
19
|
+
containerId?: ExcalidrawTextContainer["id"] | null;
|
|
20
|
+
lineHeight?: ExcalidrawTextElement["lineHeight"];
|
|
21
|
+
strokeWidth?: ExcalidrawTextElement["strokeWidth"];
|
|
14
22
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
15
23
|
export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, text?: string) => {
|
|
16
24
|
x: number;
|
|
@@ -19,9 +27,7 @@ export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement,
|
|
|
19
27
|
height: number;
|
|
20
28
|
baseline: number;
|
|
21
29
|
text: string;
|
|
22
|
-
};
|
|
23
|
-
export declare const getMaxContainerWidth: (container: ExcalidrawElement) => number;
|
|
24
|
-
export declare const getMaxContainerHeight: (container: ExcalidrawElement) => number;
|
|
30
|
+
} | undefined;
|
|
25
31
|
export declare const updateTextElement: (textElement: ExcalidrawTextElement, { text, isDeleted, originalText, }: {
|
|
26
32
|
text: string;
|
|
27
33
|
isDeleted?: boolean | undefined;
|
|
@@ -34,8 +40,8 @@ export declare const newFreeDrawElement: (opts: {
|
|
|
34
40
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawFreeDrawElement>;
|
|
35
41
|
export declare const newLinearElement: (opts: {
|
|
36
42
|
type: ExcalidrawLinearElement["type"];
|
|
37
|
-
startArrowhead
|
|
38
|
-
endArrowhead
|
|
43
|
+
startArrowhead?: Arrowhead | null;
|
|
44
|
+
endArrowhead?: Arrowhead | null;
|
|
39
45
|
points?: ExcalidrawLinearElement["points"];
|
|
40
46
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawLinearElement>;
|
|
41
47
|
export declare const newImageElement: (opts: {
|
|
@@ -44,7 +50,21 @@ export declare const newImageElement: (opts: {
|
|
|
44
50
|
fileId?: ExcalidrawImageElement["fileId"];
|
|
45
51
|
scale?: ExcalidrawImageElement["scale"];
|
|
46
52
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
|
|
47
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Clones ExcalidrawElement data structure. Does not regenerate id, nonce, or
|
|
55
|
+
* any value. The purpose is to to break object references for immutability
|
|
56
|
+
* reasons, whenever we want to keep the original element, but ensure it's not
|
|
57
|
+
* mutated.
|
|
58
|
+
*
|
|
59
|
+
* Only clones plain objects and arrays. Doesn't clone Date, RegExp, Map, Set,
|
|
60
|
+
* Typed arrays and other non-null objects.
|
|
61
|
+
*/
|
|
62
|
+
export declare const deepCopyElement: <T extends ExcalidrawElement>(val: T) => Mutable<T>;
|
|
63
|
+
/**
|
|
64
|
+
* utility wrapper to generate new id. In test env it reuses the old + postfix
|
|
65
|
+
* for test assertions.
|
|
66
|
+
*/
|
|
67
|
+
export declare const regenerateId: (previousId: string | null) => string;
|
|
48
68
|
/**
|
|
49
69
|
* Duplicate an element, often used in the alt-drag operation.
|
|
50
70
|
* Note that this method has gotten a bit complicated since the
|
|
@@ -59,5 +79,18 @@ export declare const deepCopyElement: (val: any, depth?: number) => any;
|
|
|
59
79
|
* @param element Element to duplicate
|
|
60
80
|
* @param overrides Any element properties to override
|
|
61
81
|
*/
|
|
62
|
-
export declare const duplicateElement: <TElement extends
|
|
63
|
-
|
|
82
|
+
export declare const duplicateElement: <TElement extends ExcalidrawElement>(editingGroupId: AppState["editingGroupId"], groupIdMapForOperation: Map<GroupId, GroupId>, element: TElement, overrides?: Partial<TElement> | undefined) => Readonly<TElement>;
|
|
83
|
+
/**
|
|
84
|
+
* Clones elements, regenerating their ids (including bindings) and group ids.
|
|
85
|
+
*
|
|
86
|
+
* If bindings don't exist in the elements array, they are removed. Therefore,
|
|
87
|
+
* it's advised to supply the whole elements array, or sets of elements that
|
|
88
|
+
* are encapsulated (such as library items), if the purpose is to retain
|
|
89
|
+
* bindings to the cloned elements intact.
|
|
90
|
+
*
|
|
91
|
+
* NOTE by default does not randomize or regenerate anything except the id.
|
|
92
|
+
*/
|
|
93
|
+
export declare const duplicateElements: (elements: readonly ExcalidrawElement[], opts?: {
|
|
94
|
+
/** NOTE also updates version flags and `updated` */
|
|
95
|
+
randomizeSeed: boolean;
|
|
96
|
+
}) => ExcalidrawElement[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
|
|
2
2
|
import { MaybeTransformHandleType, TransformHandleDirection } from "./transformHandles";
|
|
3
|
-
import { PointerDownState } from "../types";
|
|
3
|
+
import { AppState, PointerDownState } from "../types";
|
|
4
4
|
export declare const normalizeAngle: (angle: number) => number;
|
|
5
|
-
export declare const transformElements: (pointerDownState: PointerDownState, transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], resizeArrowDirection: "origin" | "end", shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
|
|
6
|
-
export declare const reshapeSingleTwoPointElement: (element: NonDeleted<ExcalidrawLinearElement>, resizeArrowDirection: "origin" | "end", shouldRotateWithDiscreteAngle: boolean, pointerX: number, pointerY: number) => void;
|
|
5
|
+
export declare const transformElements: (pointerDownState: PointerDownState, transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], resizeArrowDirection: "origin" | "end", shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number, appState: AppState) => boolean;
|
|
7
6
|
export declare const resizeSingleElement: (originalElements: PointerDownState["originalElements"], shouldMaintainAspectRatio: boolean, element: NonDeletedExcalidrawElement, transformHandleDirection: TransformHandleDirection, shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
|
|
7
|
+
export declare const resizeMultipleElements: (pointerDownState: PointerDownState, selectedElements: readonly NonDeletedExcalidrawElement[], transformHandleType: "nw" | "ne" | "sw" | "se", shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
|
|
8
8
|
export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
9
9
|
export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ExcalidrawElement, PointerType, NonDeletedExcalidrawElement } from "./types";
|
|
2
2
|
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
3
|
import { AppState, Zoom } from "../types";
|
|
4
|
+
import { Bounds } from "./bounds";
|
|
4
5
|
export declare const resizeTest: (element: NonDeletedExcalidrawElement, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType) => MaybeTransformHandleType;
|
|
5
6
|
export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType) => {
|
|
6
7
|
element: NonDeletedExcalidrawElement;
|
|
7
8
|
transformHandleType: MaybeTransformHandleType;
|
|
8
9
|
} | null;
|
|
9
|
-
export declare const getTransformHandleTypeFromCoords: ([x1, y1, x2, y2]:
|
|
10
|
+
export declare const getTransformHandleTypeFromCoords: ([x1, y1, x2, y2]: Bounds, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType) => MaybeTransformHandleType;
|
|
10
11
|
export declare const getCursorForResizingElement: (resizingElement: {
|
|
11
12
|
element?: ExcalidrawElement;
|
|
12
13
|
transformHandleType: MaybeTransformHandleType;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AppState } from "../types";
|
|
2
1
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
3
|
-
|
|
2
|
+
import { UIAppState } from "../types";
|
|
3
|
+
export declare const showSelectedShapeActions: (appState: UIAppState, elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./types";
|
|
2
|
-
import { AppState } from "../types";
|
|
2
|
+
import { AppState, Zoom } from "../types";
|
|
3
3
|
export declare const isInvisiblySmallElement: (element: ExcalidrawElement) => boolean;
|
|
4
|
+
export declare const isElementInViewport: (element: ExcalidrawElement, width: number, height: number, viewTransformations: {
|
|
5
|
+
zoom: Zoom;
|
|
6
|
+
offsetLeft: number;
|
|
7
|
+
offsetTop: number;
|
|
8
|
+
scrollX: number;
|
|
9
|
+
scrollY: number;
|
|
10
|
+
}) => boolean;
|
|
4
11
|
/**
|
|
5
12
|
* Makes a perfect shape or diagonal/horizontal/vertical line
|
|
6
13
|
*/
|
|
@@ -1,21 +1,44 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
2
2
|
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
|
+
import { AppState } from "../types";
|
|
4
|
+
import { ExtractSetType } from "../utility-types";
|
|
5
|
+
export declare const normalizeText: (text: string) => string;
|
|
6
|
+
export declare const splitIntoLines: (text: string) => string[];
|
|
3
7
|
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
|
|
4
8
|
export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
5
|
-
export declare const handleBindTextResize: (
|
|
6
|
-
export declare const
|
|
9
|
+
export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean) => void;
|
|
10
|
+
export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const measureText: (text: string, font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => {
|
|
7
15
|
width: number;
|
|
8
16
|
height: number;
|
|
9
17
|
baseline: number;
|
|
10
18
|
};
|
|
11
|
-
export declare const
|
|
19
|
+
export declare const measureBaseline: (text: string, font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"], wrapInContainer?: boolean) => number;
|
|
20
|
+
/**
|
|
21
|
+
* To get unitless line-height (if unknown) we can calculate it by dividing
|
|
22
|
+
* height-per-line by fontSize.
|
|
23
|
+
*/
|
|
24
|
+
export declare const detectLineHeight: (textElement: ExcalidrawTextElement) => number & {
|
|
25
|
+
_brand: "unitlessLineHeight";
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* We calculate the line height from the font size and the unitless line height,
|
|
29
|
+
* aligning with the W3C spec.
|
|
30
|
+
*/
|
|
31
|
+
export declare const getLineHeightInPx: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
32
|
+
export declare const getApproxMinLineHeight: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
33
|
+
export declare const getTextWidth: (text: string, font: FontString) => number;
|
|
34
|
+
export declare const getTextHeight: (text: string, fontSize: number, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
35
|
+
export declare const parseTokens: (text: string) => string[];
|
|
12
36
|
export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
|
|
13
37
|
export declare const charWidth: {
|
|
14
38
|
calculate: (char: string, font: FontString) => number;
|
|
15
39
|
getCache: (font: FontString) => number[];
|
|
16
40
|
};
|
|
17
|
-
export declare const getApproxMinLineWidth: (font: FontString) => number;
|
|
18
|
-
export declare const getApproxMinLineHeight: (font: FontString) => number;
|
|
41
|
+
export declare const getApproxMinLineWidth: (font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
19
42
|
export declare const getMinCharWidth: (font: FontString) => number;
|
|
20
43
|
export declare const getMaxCharWidth: (font: FontString) => number;
|
|
21
44
|
export declare const getApproxCharsToFitInWidth: (font: FontString, width: number) => number;
|
|
@@ -24,7 +47,32 @@ export declare const getBoundTextElement: (element: ExcalidrawElement | null) =>
|
|
|
24
47
|
export declare const getContainerElement: (element: (ExcalidrawElement & {
|
|
25
48
|
containerId: ExcalidrawElement["id"] | null;
|
|
26
49
|
}) | null) => ExcalidrawElement | null;
|
|
27
|
-
export declare const
|
|
28
|
-
|
|
29
|
-
|
|
50
|
+
export declare const getContainerCenter: (container: ExcalidrawElement, appState: AppState) => {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
};
|
|
54
|
+
export declare const getContainerCoords: (container: NonDeletedExcalidrawElement) => {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
};
|
|
58
|
+
export declare const getTextElementAngle: (textElement: ExcalidrawTextElement) => number;
|
|
59
|
+
export declare const getBoundTextElementOffset: (boundTextElement: ExcalidrawTextElement | null) => number;
|
|
60
|
+
export declare const getBoundTextElementPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
} | undefined;
|
|
64
|
+
export declare const shouldAllowVerticalAlign: (selectedElements: NonDeletedExcalidrawElement[]) => boolean;
|
|
65
|
+
export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExcalidrawElement[]) => boolean;
|
|
66
|
+
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number) => ExcalidrawTextContainer | null;
|
|
67
|
+
declare const VALID_CONTAINER_TYPES: Set<string>;
|
|
68
|
+
export declare const isValidTextContainer: (element: {
|
|
69
|
+
type: ExcalidrawElement["type"];
|
|
70
|
+
}) => boolean;
|
|
71
|
+
export declare const computeContainerDimensionForBoundText: (dimension: number, containerType: ExtractSetType<typeof VALID_CONTAINER_TYPES>) => number;
|
|
72
|
+
export declare const getBoundTextMaxWidth: (container: ExcalidrawElement, boundTextElement?: ExcalidrawTextElement | null) => number;
|
|
73
|
+
export declare const getBoundTextMaxHeight: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => number;
|
|
74
|
+
export declare const isMeasureTextSupported: () => boolean;
|
|
75
|
+
export declare const getDefaultLineHeight: (fontFamily: FontFamilyValues) => number & {
|
|
76
|
+
_brand: "unitlessLineHeight";
|
|
30
77
|
};
|
|
78
|
+
export {};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawTextElement } from "./types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawTextContainer } from "./types";
|
|
2
2
|
import App from "../components/App";
|
|
3
|
+
export declare const updateOriginalContainerCache: (id: ExcalidrawTextContainer["id"], height: ExcalidrawTextContainer["height"]) => {
|
|
4
|
+
height: ExcalidrawTextContainer["height"];
|
|
5
|
+
};
|
|
6
|
+
export declare const resetOriginalContainerCache: (id: ExcalidrawTextContainer["id"]) => void;
|
|
7
|
+
export declare const getOriginalContainerHeightFromCache: (id: ExcalidrawTextContainer["id"]) => number | null;
|
|
3
8
|
export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, }: {
|
|
4
9
|
id: ExcalidrawElement["id"];
|
|
5
10
|
onChange?: ((text: string) => void) | undefined;
|
|
@@ -10,7 +15,7 @@ export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords,
|
|
|
10
15
|
}) => void;
|
|
11
16
|
getViewportCoords: (x: number, y: number) => [number, number];
|
|
12
17
|
element: ExcalidrawTextElement;
|
|
13
|
-
canvas: HTMLCanvasElement
|
|
18
|
+
canvas: HTMLCanvasElement;
|
|
14
19
|
excalidrawContainer: HTMLDivElement | null;
|
|
15
20
|
app: App;
|
|
16
21
|
}) => void;
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
|
|
2
2
|
import { Bounds } from "./bounds";
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
3
|
+
import { InteractiveCanvasAppState, Zoom } from "../types";
|
|
4
|
+
export type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
|
|
5
|
+
export type TransformHandleType = TransformHandleDirection | "rotation";
|
|
6
|
+
export type TransformHandle = Bounds;
|
|
7
|
+
export type TransformHandles = Partial<{
|
|
8
8
|
[T in TransformHandleType]: TransformHandle;
|
|
9
9
|
}>;
|
|
10
|
-
export
|
|
10
|
+
export type MaybeTransformHandleType = TransformHandleType | false;
|
|
11
11
|
export declare const OMIT_SIDES_FOR_MULTIPLE_ELEMENTS: {
|
|
12
12
|
e: boolean;
|
|
13
13
|
s: boolean;
|
|
14
14
|
n: boolean;
|
|
15
15
|
w: boolean;
|
|
16
16
|
};
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const OMIT_SIDES_FOR_FRAME: {
|
|
18
|
+
e: boolean;
|
|
19
|
+
s: boolean;
|
|
20
|
+
n: boolean;
|
|
21
|
+
w: boolean;
|
|
22
|
+
rotation: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [number, number, number, number, number, number], angle: number, zoom: Zoom, pointerType: PointerType, omitSides?: {
|
|
18
25
|
s?: boolean | undefined;
|
|
19
26
|
e?: boolean | undefined;
|
|
20
27
|
w?: boolean | undefined;
|
|
@@ -26,4 +33,4 @@ export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2]: Bounds, a
|
|
|
26
33
|
rotation?: boolean | undefined;
|
|
27
34
|
}, margin?: number) => TransformHandles;
|
|
28
35
|
export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, pointerType?: PointerType) => TransformHandles;
|
|
29
|
-
export declare const shouldShowBoundingBox: (elements: NonDeletedExcalidrawElement[], appState:
|
|
36
|
+
export declare const shouldShowBoundingBox: (elements: readonly NonDeletedExcalidrawElement[], appState: InteractiveCanvasAppState) => boolean;
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import { AppState } from "../types";
|
|
2
|
-
import {
|
|
2
|
+
import { MarkNonNullable } from "../utility-types";
|
|
3
|
+
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType } from "./types";
|
|
3
4
|
export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
|
|
4
5
|
export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
|
|
5
6
|
export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
|
|
7
|
+
export declare const isEmbeddableElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawEmbeddableElement;
|
|
6
8
|
export declare const isTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawTextElement;
|
|
9
|
+
export declare const isFrameElement: (element: ExcalidrawElement | null) => element is ExcalidrawFrameElement;
|
|
7
10
|
export declare const isFreeDrawElement: (element?: ExcalidrawElement | null) => element is ExcalidrawFreeDrawElement;
|
|
8
11
|
export declare const isFreeDrawElementType: (elementType: ExcalidrawElement["type"]) => boolean;
|
|
9
12
|
export declare const isLinearElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
|
|
13
|
+
export declare const isArrowElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
|
|
10
14
|
export declare const isLinearElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
11
15
|
export declare const isBindingElement: (element?: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawLinearElement;
|
|
12
16
|
export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
13
17
|
export declare const isBindableElement: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawBindableElement;
|
|
14
18
|
export declare const isTextBindableContainer: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawTextContainer;
|
|
15
19
|
export declare const isExcalidrawElement: (element: any) => boolean;
|
|
16
|
-
export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement
|
|
20
|
+
export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is MarkNonNullable<ExcalidrawBindableElement, "boundElements">;
|
|
17
21
|
export declare const isBoundToContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextElementWithContainer;
|
|
22
|
+
export declare const isUsingAdaptiveRadius: (type: string) => boolean;
|
|
23
|
+
export declare const isUsingProportionalRadius: (type: string) => boolean;
|
|
24
|
+
export declare const canApplyRoundnessTypeToElement: (roundnessType: RoundnessType, element: ExcalidrawElement) => boolean;
|
|
25
|
+
export declare const getDefaultRoundnessTypeForElement: (element: ExcalidrawElement) => {
|
|
26
|
+
type: 2;
|
|
27
|
+
} | {
|
|
28
|
+
type: 3;
|
|
29
|
+
} | null;
|