@dwelle/excalidraw 0.4.0-e3bee83 → 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 +525 -0
- package/README.md +18 -1820
- 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 +3071 -1566
- 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 +103 -55
- package/types/actions/actionAlign.d.ts +33 -28
- package/types/actions/actionBoundText.d.ts +175 -22
- package/types/actions/actionCanvas.d.ts +680 -170
- package/types/actions/actionClipboard.d.ts +174 -100
- package/types/actions/actionDeleteSelected.d.ts +102 -60
- package/types/actions/actionDistribute.d.ts +11 -12
- package/types/actions/actionDuplicateSelection.d.ts +3 -4
- package/types/actions/actionElementLock.d.ts +271 -0
- package/types/actions/actionExport.d.ts +363 -221
- package/types/actions/actionFinalize.d.ts +70 -42
- package/types/actions/actionFlip.d.ts +8 -11
- package/types/actions/actionFrame.d.ts +423 -0
- package/types/actions/actionGroup.d.ts +250 -13
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +37 -21
- package/types/actions/actionMenu.d.ts +108 -62
- package/types/actions/actionNavigate.d.ts +1 -1
- package/types/actions/actionProperties.d.ts +465 -256
- package/types/actions/actionSelectAll.d.ts +123 -4
- package/types/actions/actionStyles.d.ts +39 -24
- package/types/actions/actionToggleGridMode.d.ts +37 -22
- package/types/actions/{actionToggleLock.d.ts → actionToggleObjectsSnapMode.d.ts} +49 -32
- package/types/actions/actionToggleStats.d.ts +37 -22
- package/types/actions/actionToggleViewMode.d.ts +37 -22
- package/types/actions/actionToggleZenMode.d.ts +37 -22
- package/types/actions/actionZindex.d.ts +12 -12
- package/types/actions/index.d.ts +2 -1
- package/types/actions/manager.d.ts +1 -1
- package/types/actions/shortcuts.d.ts +2 -1
- package/types/actions/types.d.ts +11 -9
- package/types/appState.d.ts +18 -18
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +5 -6
- package/types/clipboard.d.ts +8 -7
- 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 +93 -35
- package/types/components/Avatar.d.ts +1 -2
- package/types/components/BraveMeasureTextError.d.ts +2 -0
- package/types/components/Button.d.ts +3 -2
- package/types/components/ButtonIconSelect.d.ts +11 -3
- package/types/components/Card.d.ts +0 -1
- 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 +3 -3
- 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 +5 -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 +9 -15
- 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 -28
- 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 +8 -11
- 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/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 +15 -9
- package/types/components/dropdownMenu/DropdownMenuContent.d.ts +7 -3
- package/types/components/dropdownMenu/DropdownMenuItem.d.ts +4 -4
- package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -1
- package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +4 -2
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -2
- package/types/components/dropdownMenu/common.d.ts +6 -0
- package/types/components/footer/Footer.d.ts +4 -5
- package/types/components/hoc/withInternalFallback.d.ts +4 -0
- package/types/components/icons.d.ts +16 -1
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -1
- package/types/components/main-menu/MainMenu.d.ts +22 -13
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -1
- package/types/components/welcome-screen/WelcomeScreen.d.ts +2 -3
- package/types/constants.d.ts +94 -10
- 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/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 +48 -29
- package/types/element/binding.d.ts +4 -3
- package/types/element/bounds.d.ts +40 -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 +43 -27
- package/types/element/mutateElement.d.ts +3 -2
- package/types/element/newElement.d.ts +48 -15
- package/types/element/resizeElements.d.ts +3 -2
- 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 +43 -17
- package/types/element/textWysiwyg.d.ts +1 -1
- package/types/element/transformHandles.d.ts +16 -8
- package/types/element/typeChecks.d.ts +5 -2
- package/types/element/types.d.ts +59 -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 +5 -4
- package/types/math.d.ts +5 -0
- package/types/packages/bbox.d.ts +11 -0
- package/types/packages/excalidraw/example/App.d.ts +7 -1
- package/types/packages/excalidraw/example/initialData.d.ts +182 -64
- package/types/packages/excalidraw/index.d.ts +11 -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 +11 -2
- package/types/packages/withinBounds.d.ts +19 -0
- package/types/renderer/renderElement.d.ts +12 -22
- package/types/renderer/renderScene.d.ts +19 -27
- package/types/renderer/renderSnaps.d.ts +2 -0
- package/types/renderer/roundRect.d.ts +1 -1
- package/types/scene/Renderer.d.ts +25 -0
- package/types/scene/Scene.d.ts +27 -5
- package/types/scene/Shape.d.ts +12 -0
- package/types/scene/ShapeCache.d.ts +20 -0
- package/types/scene/comparisons.d.ts +0 -1
- package/types/scene/export.d.ts +50 -11
- 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 -34
- package/types/snapping.d.ts +108 -0
- package/types/types.d.ts +200 -84
- package/types/utility-types.d.ts +24 -0
- package/types/utils.d.ts +73 -29
- package/types/zindex.d.ts +4 -4
- package/types/components/ColorPicker.d.ts +0 -14
- package/types/components/LibraryButton.d.ts +0 -8
- package/types/components/SingleLibraryItem.d.ts +0 -10
- 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,16 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import { AppState, ExcalidrawProps } from "../types";
|
|
1
|
+
import { AppState, ExcalidrawProps, UIAppState } from "../types";
|
|
3
2
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
4
3
|
import { Bounds } from "./bounds";
|
|
5
4
|
import "./Hyperlink.scss";
|
|
6
5
|
export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
|
|
7
|
-
export declare const Hyperlink: ({ element, setAppState, onLinkOpen, }: {
|
|
6
|
+
export declare const Hyperlink: ({ element, setAppState, onLinkOpen, setToast, }: {
|
|
8
7
|
element: NonDeletedExcalidrawElement;
|
|
9
8
|
setAppState: React.Component<any, AppState>["setState"];
|
|
10
9
|
onLinkOpen: ExcalidrawProps["onLinkOpen"];
|
|
10
|
+
setToast: (toast: {
|
|
11
|
+
message: string;
|
|
12
|
+
closable?: boolean;
|
|
13
|
+
duration?: number;
|
|
14
|
+
} | null) => void;
|
|
11
15
|
}) => JSX.Element | null;
|
|
12
|
-
export declare const normalizeLink: (link: string) => string;
|
|
13
|
-
export declare const isLocalLink: (link: string | null) => boolean;
|
|
14
16
|
export declare const actionLink: {
|
|
15
17
|
name: "hyperlink";
|
|
16
18
|
perform: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => false | {
|
|
@@ -25,7 +27,11 @@ export declare const actionLink: {
|
|
|
25
27
|
} | null;
|
|
26
28
|
showWelcomeScreen: boolean;
|
|
27
29
|
isLoading: boolean;
|
|
28
|
-
errorMessage:
|
|
30
|
+
errorMessage: import("react").ReactNode;
|
|
31
|
+
activeEmbeddable: {
|
|
32
|
+
element: NonDeletedExcalidrawElement;
|
|
33
|
+
state: "active" | "hover";
|
|
34
|
+
} | null;
|
|
29
35
|
draggingElement: NonDeletedExcalidrawElement | null;
|
|
30
36
|
resizingElement: NonDeletedExcalidrawElement | null;
|
|
31
37
|
multiElement: import("./types").NonDeleted<import("./types").ExcalidrawLinearElement> | null;
|
|
@@ -33,19 +39,21 @@ export declare const actionLink: {
|
|
|
33
39
|
isBindingEnabled: boolean;
|
|
34
40
|
startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
|
|
35
41
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
42
|
+
frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameElement> | null;
|
|
43
|
+
frameRendering: {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
name: boolean;
|
|
46
|
+
outline: boolean;
|
|
47
|
+
clip: boolean;
|
|
48
|
+
};
|
|
49
|
+
editingFrame: string | null;
|
|
50
|
+
elementsToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawElement>[] | null;
|
|
36
51
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
37
52
|
editingLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
38
53
|
activeTool: {
|
|
39
|
-
|
|
40
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
54
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
41
55
|
locked: boolean;
|
|
42
|
-
|
|
43
|
-
} | {
|
|
44
|
-
type: "custom";
|
|
45
|
-
customType: string;
|
|
46
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
47
|
-
locked: boolean;
|
|
48
|
-
};
|
|
56
|
+
} & import("../types").ActiveTool;
|
|
49
57
|
penMode: boolean;
|
|
50
58
|
penDetected: boolean;
|
|
51
59
|
exportBackground: boolean;
|
|
@@ -76,17 +84,21 @@ export declare const actionLink: {
|
|
|
76
84
|
zoom: Readonly<{
|
|
77
85
|
value: import("../types").NormalizedZoomValue;
|
|
78
86
|
}>;
|
|
79
|
-
openPopup: "
|
|
80
|
-
openSidebar:
|
|
87
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
88
|
+
openSidebar: {
|
|
89
|
+
name: string;
|
|
90
|
+
tab?: string | undefined;
|
|
91
|
+
} | null;
|
|
81
92
|
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
82
|
-
|
|
93
|
+
defaultSidebarDockedPreference: boolean;
|
|
83
94
|
lastPointerDownWith: import("./types").PointerType;
|
|
84
|
-
selectedElementIds: {
|
|
85
|
-
[id: string]:
|
|
86
|
-
}
|
|
95
|
+
selectedElementIds: Readonly<{
|
|
96
|
+
[id: string]: true;
|
|
97
|
+
}>;
|
|
87
98
|
previousSelectedElementIds: {
|
|
88
|
-
[id: string]:
|
|
99
|
+
[id: string]: true;
|
|
89
100
|
};
|
|
101
|
+
selectedElementsAreBeingDragged: boolean;
|
|
90
102
|
shouldCacheIgnoreZoom: boolean;
|
|
91
103
|
toast: {
|
|
92
104
|
message: string;
|
|
@@ -94,7 +106,7 @@ export declare const actionLink: {
|
|
|
94
106
|
duration?: number | undefined;
|
|
95
107
|
} | null;
|
|
96
108
|
zenModeEnabled: boolean;
|
|
97
|
-
theme:
|
|
109
|
+
theme: import("./types").Theme;
|
|
98
110
|
gridSize: number | null;
|
|
99
111
|
viewModeEnabled: boolean;
|
|
100
112
|
selectedGroupIds: {
|
|
@@ -118,6 +130,12 @@ export declare const actionLink: {
|
|
|
118
130
|
};
|
|
119
131
|
pendingImageElementId: string | null;
|
|
120
132
|
selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
133
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
134
|
+
originSnapOffset: {
|
|
135
|
+
x: number;
|
|
136
|
+
y: number;
|
|
137
|
+
} | null;
|
|
138
|
+
objectsSnapModeEnabled: boolean;
|
|
121
139
|
};
|
|
122
140
|
commitToHistory: true;
|
|
123
141
|
};
|
|
@@ -125,16 +143,17 @@ export declare const actionLink: {
|
|
|
125
143
|
category: "hyperlink";
|
|
126
144
|
action: string;
|
|
127
145
|
};
|
|
128
|
-
keyTest: (event:
|
|
129
|
-
contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.edit" | "labels.link.create";
|
|
146
|
+
keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
|
|
147
|
+
contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
|
|
130
148
|
predicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
|
|
131
149
|
PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps) => JSX.Element;
|
|
132
150
|
} & {
|
|
133
|
-
keyTest?: ((event:
|
|
151
|
+
keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
|
|
134
152
|
};
|
|
135
|
-
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.edit" | "labels.link.create";
|
|
136
|
-
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState:
|
|
137
|
-
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number]
|
|
153
|
+
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
|
|
154
|
+
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: Pick<UIAppState, "zoom">) => Bounds;
|
|
155
|
+
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number]) => boolean;
|
|
156
|
+
export declare const isPointHittingLink: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number], isMobile: boolean) => boolean;
|
|
138
157
|
export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState) => void;
|
|
139
158
|
export declare const hideHyperlinkToolip: () => void;
|
|
140
159
|
export declare const shouldHideLinkPopup: (element: NonDeletedExcalidrawElement, appState: AppState, [clientX, clientY]: readonly [number, number]) => Boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ExcalidrawLinearElement, ExcalidrawBindableElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawElement } from "./types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import Scene from "../scene/Scene";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
|
|
5
|
+
export type SuggestedPointBinding = [
|
|
6
6
|
NonDeleted<ExcalidrawLinearElement>,
|
|
7
7
|
"start" | "end" | "both",
|
|
8
8
|
NonDeleted<ExcalidrawBindableElement>
|
|
9
9
|
];
|
|
10
|
-
export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<
|
|
10
|
+
export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<HTMLElement>) => boolean;
|
|
11
11
|
export declare const isBindingEnabled: (appState: AppState) => boolean;
|
|
12
12
|
export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep") => void;
|
|
13
13
|
export declare const bindOrUnbindSelectedElements: (elements: NonDeleted<ExcalidrawElement>[]) => void;
|
|
@@ -15,6 +15,7 @@ export declare const maybeBindLinearElement: (linearElement: NonDeleted<Excalidr
|
|
|
15
15
|
x: number;
|
|
16
16
|
y: number;
|
|
17
17
|
}) => void;
|
|
18
|
+
export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => void;
|
|
18
19
|
export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
|
|
19
20
|
export declare const unbindLinearElements: (elements: NonDeleted<ExcalidrawElement>[]) => void;
|
|
20
21
|
export declare const getHoveredElementForBinding: (pointerCoords: {
|
|
@@ -1,21 +1,51 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, NonDeleted } from "./types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted } from "./types";
|
|
2
2
|
import { Drawable, Op } from "roughjs/bin/core";
|
|
3
|
-
|
|
3
|
+
import { Point } from "../types";
|
|
4
|
+
export type RectangleBox = {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
angle: number;
|
|
10
|
+
};
|
|
11
|
+
export type Bounds = readonly [
|
|
12
|
+
minX: number,
|
|
13
|
+
minY: number,
|
|
14
|
+
maxX: number,
|
|
15
|
+
maxY: number
|
|
16
|
+
];
|
|
17
|
+
export declare class ElementBounds {
|
|
18
|
+
private static boundsCache;
|
|
19
|
+
static getBounds(element: ExcalidrawElement): Bounds;
|
|
20
|
+
private static calculateBounds;
|
|
21
|
+
}
|
|
4
22
|
export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, includeBoundText?: boolean) => [number, number, number, number, number, number];
|
|
23
|
+
export declare const getElementLineSegments: (element: ExcalidrawElement) => [Point, Point][];
|
|
24
|
+
/**
|
|
25
|
+
* Scene -> Scene coords, but in x1,x2,y1,y2 format.
|
|
26
|
+
*
|
|
27
|
+
* Rectangle here means any rectangular frame, not an excalidraw element.
|
|
28
|
+
*/
|
|
29
|
+
export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBox) => number[];
|
|
5
30
|
export declare const pointRelativeTo: (element: ExcalidrawElement, absoluteCoords: readonly [number, number]) => readonly [number, number];
|
|
6
31
|
export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
|
|
7
32
|
export declare const getCurvePathOps: (shape: Drawable) => Op[];
|
|
8
|
-
export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((x: number, y: number) => [number, number]) | undefined) =>
|
|
33
|
+
export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((x: number, y: number) => [number, number]) | undefined) => Bounds;
|
|
34
|
+
export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["points"]) => Bounds;
|
|
9
35
|
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
|
|
10
|
-
export declare const getElementBounds: (element: ExcalidrawElement) =>
|
|
11
|
-
export declare const getCommonBounds: (elements: readonly ExcalidrawElement[]) =>
|
|
12
|
-
export declare const
|
|
13
|
-
|
|
36
|
+
export declare const getElementBounds: (element: ExcalidrawElement) => Bounds;
|
|
37
|
+
export declare const getCommonBounds: (elements: readonly ExcalidrawElement[]) => Bounds;
|
|
38
|
+
export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
}) => number[];
|
|
42
|
+
export declare const getResizedElementAbsoluteCoords: (element: ExcalidrawElement, nextWidth: number, nextHeight: number, normalizePoints: boolean) => Bounds;
|
|
43
|
+
export declare const getElementPointsCoords: (element: ExcalidrawLinearElement, points: readonly (readonly [number, number])[]) => Bounds;
|
|
14
44
|
export declare const getClosestElementBounds: (elements: readonly ExcalidrawElement[], from: {
|
|
15
45
|
x: number;
|
|
16
46
|
y: number;
|
|
17
|
-
}) =>
|
|
18
|
-
export interface
|
|
47
|
+
}) => Bounds;
|
|
48
|
+
export interface BoundingBox {
|
|
19
49
|
minX: number;
|
|
20
50
|
minY: number;
|
|
21
51
|
maxX: number;
|
|
@@ -25,4 +55,4 @@ export interface Box {
|
|
|
25
55
|
width: number;
|
|
26
56
|
height: number;
|
|
27
57
|
}
|
|
28
|
-
export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) =>
|
|
58
|
+
export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as GA from "../ga";
|
|
2
|
-
import { NonDeletedExcalidrawElement, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawRectangleElement, ExcalidrawDiamondElement, ExcalidrawTextElement, ExcalidrawEllipseElement, NonDeleted, ExcalidrawImageElement } from "./types";
|
|
3
|
-
import { Point } from "../types";
|
|
2
|
+
import { NonDeletedExcalidrawElement, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawRectangleElement, ExcalidrawEmbeddableElement, ExcalidrawDiamondElement, ExcalidrawTextElement, ExcalidrawEllipseElement, NonDeleted, ExcalidrawImageElement, ExcalidrawFrameElement } from "./types";
|
|
3
|
+
import { FrameNameBoundsCache, Point } from "../types";
|
|
4
4
|
import { AppState } from "../types";
|
|
5
|
-
export declare const hitTest: (element: NonDeletedExcalidrawElement, appState: AppState, x: number, y: number) => boolean;
|
|
6
|
-
export declare const isHittingElementBoundingBoxWithoutHittingElement: (element: NonDeletedExcalidrawElement, appState: AppState, x: number, y: number) => boolean;
|
|
7
|
-
export declare const isHittingElementNotConsideringBoundingBox: (element: NonDeletedExcalidrawElement, appState: AppState, point: readonly [number, number]) => boolean;
|
|
8
|
-
export declare const isPointHittingElementBoundingBox: (element: NonDeleted<ExcalidrawElement>, [x, y]: readonly [number, number], threshold: number) => boolean;
|
|
5
|
+
export declare const hitTest: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number) => boolean;
|
|
6
|
+
export declare const isHittingElementBoundingBoxWithoutHittingElement: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number) => boolean;
|
|
7
|
+
export declare const isHittingElementNotConsideringBoundingBox: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache | null, point: readonly [number, number]) => boolean;
|
|
8
|
+
export declare const isPointHittingElementBoundingBox: (element: NonDeleted<ExcalidrawElement>, [x, y]: readonly [number, number], threshold: number, frameNameBoundsCache: FrameNameBoundsCache | null) => boolean;
|
|
9
9
|
export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
|
|
10
10
|
x: number;
|
|
11
11
|
y: number;
|
|
@@ -18,4 +18,4 @@ export declare const determineFocusPoint: (element: ExcalidrawBindableElement, f
|
|
|
18
18
|
export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap?: number) => Point[];
|
|
19
19
|
export declare const getCircleIntersections: (center: readonly [number, number, number, number, number, number, number, number], radius: number, line: readonly [number, number, number, number, number, number, number, number]) => GA.Point[];
|
|
20
20
|
export declare const findFocusPointForEllipse: (ellipse: ExcalidrawEllipseElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
21
|
-
export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
21
|
+
export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
2
2
|
import { AppState, PointerDownState } from "../types";
|
|
3
|
-
|
|
3
|
+
import Scene from "../scene/Scene";
|
|
4
|
+
export declare const dragSelectedElements: (pointerDownState: PointerDownState, selectedElements: NonDeletedExcalidrawElement[], offset: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}, appState: AppState, scene: Scene, snapOffset: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}, gridSize: AppState["gridSize"]) => void;
|
|
4
11
|
export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
5
|
-
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType: AppState["activeTool"]["type"], originX: number, originY: number, x: number, y: number, width: number, height: number, shouldMaintainAspectRatio: boolean, shouldResizeFromCenter: boolean, widthAspectRatio?: number | null
|
|
12
|
+
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType: AppState["activeTool"]["type"], originX: number, originY: number, x: number, y: number, width: number, height: number, shouldMaintainAspectRatio: boolean, shouldResizeFromCenter: boolean, widthAspectRatio?: number | null, originOffset?: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
} | null) => void;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { ExcalidrawProps } from "../types";
|
|
2
|
+
import { ExcalidrawElement, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement, Theme } from "./types";
|
|
3
|
+
type EmbeddedLink = ({
|
|
4
|
+
aspectRatio: {
|
|
5
|
+
w: number;
|
|
6
|
+
h: number;
|
|
7
|
+
};
|
|
8
|
+
warning?: string;
|
|
9
|
+
} & ({
|
|
10
|
+
type: "video" | "generic";
|
|
11
|
+
link: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: "document";
|
|
14
|
+
srcdoc: (theme: Theme) => string;
|
|
15
|
+
})) | null;
|
|
16
|
+
export declare const getEmbedLink: (link: string | null | undefined) => EmbeddedLink;
|
|
17
|
+
export declare const isEmbeddableOrFrameLabel: (element: NonDeletedExcalidrawElement) => Boolean;
|
|
18
|
+
export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawEmbeddableElement) => ExcalidrawElement;
|
|
19
|
+
export declare const actionSetEmbeddableAsActiveTool: {
|
|
20
|
+
name: "setEmbeddableAsActiveTool";
|
|
21
|
+
trackEvent: {
|
|
22
|
+
category: "toolbar";
|
|
23
|
+
};
|
|
24
|
+
perform: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties) => {
|
|
25
|
+
elements: readonly ExcalidrawElement[];
|
|
26
|
+
appState: {
|
|
27
|
+
activeTool: {
|
|
28
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
29
|
+
locked: boolean;
|
|
30
|
+
} & import("../types").ActiveTool;
|
|
31
|
+
contextMenu: {
|
|
32
|
+
items: import("../components/ContextMenu").ContextMenuItems;
|
|
33
|
+
top: number;
|
|
34
|
+
left: number;
|
|
35
|
+
} | null;
|
|
36
|
+
showWelcomeScreen: boolean;
|
|
37
|
+
isLoading: boolean;
|
|
38
|
+
errorMessage: import("react").ReactNode;
|
|
39
|
+
activeEmbeddable: {
|
|
40
|
+
element: NonDeletedExcalidrawElement;
|
|
41
|
+
state: "active" | "hover";
|
|
42
|
+
} | null;
|
|
43
|
+
draggingElement: NonDeletedExcalidrawElement | null;
|
|
44
|
+
resizingElement: NonDeletedExcalidrawElement | null;
|
|
45
|
+
multiElement: import("./types").NonDeleted<import("./types").ExcalidrawLinearElement> | null;
|
|
46
|
+
selectionElement: NonDeletedExcalidrawElement | null;
|
|
47
|
+
isBindingEnabled: boolean;
|
|
48
|
+
startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
|
|
49
|
+
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
50
|
+
frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameElement> | null;
|
|
51
|
+
frameRendering: {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
name: boolean;
|
|
54
|
+
outline: boolean;
|
|
55
|
+
clip: boolean;
|
|
56
|
+
};
|
|
57
|
+
editingFrame: string | null;
|
|
58
|
+
elementsToHighlight: import("./types").NonDeleted<ExcalidrawElement>[] | null;
|
|
59
|
+
editingElement: NonDeletedExcalidrawElement | null;
|
|
60
|
+
editingLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
61
|
+
penMode: boolean;
|
|
62
|
+
penDetected: boolean;
|
|
63
|
+
exportBackground: boolean;
|
|
64
|
+
exportEmbedScene: boolean;
|
|
65
|
+
exportWithDarkMode: boolean;
|
|
66
|
+
exportScale: number;
|
|
67
|
+
currentItemStrokeColor: string;
|
|
68
|
+
currentItemBackgroundColor: string;
|
|
69
|
+
currentItemFillStyle: import("./types").FillStyle;
|
|
70
|
+
currentItemStrokeWidth: number;
|
|
71
|
+
currentItemStrokeStyle: import("./types").StrokeStyle;
|
|
72
|
+
currentItemRoughness: number;
|
|
73
|
+
currentItemOpacity: number;
|
|
74
|
+
currentItemFontFamily: number;
|
|
75
|
+
currentItemFontSize: number;
|
|
76
|
+
currentItemTextAlign: string;
|
|
77
|
+
currentItemStartArrowhead: import("./types").Arrowhead | null;
|
|
78
|
+
currentItemEndArrowhead: import("./types").Arrowhead | null;
|
|
79
|
+
currentItemRoundness: import("./types").StrokeRoundness;
|
|
80
|
+
viewBackgroundColor: string;
|
|
81
|
+
scrollX: number;
|
|
82
|
+
scrollY: number;
|
|
83
|
+
cursorButton: "up" | "down";
|
|
84
|
+
scrolledOutside: boolean;
|
|
85
|
+
name: string;
|
|
86
|
+
isResizing: boolean;
|
|
87
|
+
isRotating: boolean;
|
|
88
|
+
zoom: Readonly<{
|
|
89
|
+
value: import("../types").NormalizedZoomValue;
|
|
90
|
+
}>;
|
|
91
|
+
openMenu: "canvas" | "shape" | null;
|
|
92
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
93
|
+
openSidebar: {
|
|
94
|
+
name: string;
|
|
95
|
+
tab?: string | undefined;
|
|
96
|
+
} | null;
|
|
97
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
98
|
+
defaultSidebarDockedPreference: boolean;
|
|
99
|
+
lastPointerDownWith: import("./types").PointerType;
|
|
100
|
+
selectedElementIds: Readonly<{
|
|
101
|
+
[id: string]: true;
|
|
102
|
+
}>;
|
|
103
|
+
previousSelectedElementIds: {
|
|
104
|
+
[id: string]: true;
|
|
105
|
+
};
|
|
106
|
+
selectedElementsAreBeingDragged: boolean;
|
|
107
|
+
shouldCacheIgnoreZoom: boolean;
|
|
108
|
+
toast: {
|
|
109
|
+
message: string;
|
|
110
|
+
closable?: boolean | undefined;
|
|
111
|
+
duration?: number | undefined;
|
|
112
|
+
} | null;
|
|
113
|
+
zenModeEnabled: boolean;
|
|
114
|
+
theme: Theme;
|
|
115
|
+
gridSize: number | null;
|
|
116
|
+
viewModeEnabled: boolean;
|
|
117
|
+
selectedGroupIds: {
|
|
118
|
+
[groupId: string]: boolean;
|
|
119
|
+
};
|
|
120
|
+
editingGroupId: string | null;
|
|
121
|
+
width: number;
|
|
122
|
+
height: number;
|
|
123
|
+
offsetTop: number;
|
|
124
|
+
offsetLeft: number;
|
|
125
|
+
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
126
|
+
collaborators: Map<string, import("../types").Collaborator>;
|
|
127
|
+
showStats: boolean;
|
|
128
|
+
currentChartType: import("./types").ChartType;
|
|
129
|
+
pasteDialog: {
|
|
130
|
+
shown: false;
|
|
131
|
+
data: null;
|
|
132
|
+
} | {
|
|
133
|
+
shown: true;
|
|
134
|
+
data: import("../charts").Spreadsheet;
|
|
135
|
+
};
|
|
136
|
+
pendingImageElementId: string | null;
|
|
137
|
+
showHyperlinkPopup: false | "editor" | "info";
|
|
138
|
+
selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
139
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
140
|
+
originSnapOffset: {
|
|
141
|
+
x: number;
|
|
142
|
+
y: number;
|
|
143
|
+
} | null;
|
|
144
|
+
objectsSnapModeEnabled: boolean;
|
|
145
|
+
};
|
|
146
|
+
commitToHistory: false;
|
|
147
|
+
};
|
|
148
|
+
} & {
|
|
149
|
+
keyTest?: undefined;
|
|
150
|
+
};
|
|
151
|
+
export declare const extractSrc: (htmlString: string) => string;
|
|
152
|
+
export declare const embeddableURLValidator: (url: string | null | undefined, validateEmbeddable: ExcalidrawProps["validateEmbeddable"]) => boolean;
|
|
153
|
+
export {};
|
package/types/element/image.d.ts
CHANGED
|
@@ -10,7 +10,17 @@ export declare const updateImageCache: ({ fileIds, files, imageCache, }: {
|
|
|
10
10
|
}) => Promise<{
|
|
11
11
|
imageCache: Map<FileId, {
|
|
12
12
|
image: HTMLImageElement | Promise<HTMLImageElement>;
|
|
13
|
-
mimeType: "
|
|
13
|
+
mimeType: import("../utility-types").ValueOf<{
|
|
14
|
+
readonly svg: "image/svg+xml";
|
|
15
|
+
readonly png: "image/png";
|
|
16
|
+
readonly jpg: "image/jpeg";
|
|
17
|
+
readonly gif: "image/gif";
|
|
18
|
+
readonly webp: "image/webp";
|
|
19
|
+
readonly bmp: "image/bmp";
|
|
20
|
+
readonly ico: "image/x-icon";
|
|
21
|
+
readonly avif: "image/avif";
|
|
22
|
+
readonly jfif: "image/jfif";
|
|
23
|
+
}>;
|
|
14
24
|
}>;
|
|
15
25
|
/** includes errored files because they cache was updated nonetheless */
|
|
16
26
|
updatedFiles: Map<FileId, true>;
|
package/types/element/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
|
|
1
|
+
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameElement } from "./types";
|
|
2
2
|
export { newElement, newTextElement, updateTextElement, refreshTextDimensions, newLinearElement, newImageElement, duplicateElement, } from "./newElement";
|
|
3
3
|
export { getElementAbsoluteCoords, getElementBounds, getCommonBounds, getDiamondPoints, getArrowheadPoints, getClosestElementBounds, } from "./bounds";
|
|
4
4
|
export { OMIT_SIDES_FOR_MULTIPLE_ELEMENTS, getTransformHandlesFromCoords, getTransformHandles, } from "./transformHandles";
|
|
@@ -6,7 +6,7 @@ export { hitTest, isHittingElementBoundingBoxWithoutHittingElement, } from "./co
|
|
|
6
6
|
export { resizeTest, getCursorForResizingElement, getElementWithTransformHandleType, getTransformHandleTypeFromCoords, } from "./resizeTest";
|
|
7
7
|
export { transformElements, getResizeOffsetXY, getResizeArrowDirection, } from "./resizeElements";
|
|
8
8
|
export { dragSelectedElements, getDragOffsetXY, dragNewElement, } from "./dragElements";
|
|
9
|
-
export { isTextElement, isExcalidrawElement } from "./typeChecks";
|
|
9
|
+
export { isTextElement, isExcalidrawElement, isFrameElement, } from "./typeChecks";
|
|
10
10
|
export { textWysiwyg } from "./textWysiwyg";
|
|
11
11
|
export { redrawTextBoundingBox } from "./textElement";
|
|
12
12
|
export { getPerfectElementSize, getLockedLinearCursorAlignSize, isInvisiblySmallElement, resizePerfectLineForNWHandler, getNormalizedDimensions, } from "./sizeHelpers";
|
|
@@ -14,6 +14,7 @@ export { showSelectedShapeActions } from "./showSelectedShapeActions";
|
|
|
14
14
|
export declare const getSceneVersion: (elements: readonly ExcalidrawElement[]) => number;
|
|
15
15
|
export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
|
|
16
16
|
export declare const getNonDeletedElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
|
|
17
|
+
export declare const getNonDeletedFrames: (frames: readonly ExcalidrawFrameElement[]) => readonly NonDeleted<ExcalidrawFrameElement>[];
|
|
17
18
|
export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element: T) => element is NonDeleted<T>;
|
|
18
19
|
export declare const clearElementsForDatabase: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
19
20
|
export declare const clearElementsForExport: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer } from "./types";
|
|
3
|
-
import {
|
|
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: {
|
|
@@ -53,8 +53,8 @@ export declare class LinearElementEditor {
|
|
|
53
53
|
y: number;
|
|
54
54
|
}[]) => void, linearElementEditor: LinearElementEditor): boolean;
|
|
55
55
|
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
|
|
56
|
-
static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, appState:
|
|
57
|
-
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;
|
|
58
58
|
static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
|
|
59
59
|
x: number;
|
|
60
60
|
y: number;
|
|
@@ -62,7 +62,7 @@ export declare class LinearElementEditor {
|
|
|
62
62
|
static isSegmentTooShort(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, zoom: AppState["zoom"]): boolean;
|
|
63
63
|
static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number): readonly [number, number];
|
|
64
64
|
static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: Point): number;
|
|
65
|
-
static handlePointerDown(event: React.PointerEvent<
|
|
65
|
+
static handlePointerDown(event: React.PointerEvent<HTMLElement>, appState: AppState, history: History, scenePointer: {
|
|
66
66
|
x: number;
|
|
67
67
|
y: number;
|
|
68
68
|
}, linearElementEditor: LinearElementEditor): {
|
|
@@ -130,7 +130,11 @@ export declare class LinearElementEditor {
|
|
|
130
130
|
} | null;
|
|
131
131
|
showWelcomeScreen: boolean;
|
|
132
132
|
isLoading: boolean;
|
|
133
|
-
errorMessage:
|
|
133
|
+
errorMessage: import("react").ReactNode;
|
|
134
|
+
activeEmbeddable: {
|
|
135
|
+
element: import("./types").NonDeletedExcalidrawElement;
|
|
136
|
+
state: "active" | "hover";
|
|
137
|
+
} | null;
|
|
134
138
|
draggingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
135
139
|
resizingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
136
140
|
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
@@ -138,18 +142,20 @@ export declare class LinearElementEditor {
|
|
|
138
142
|
isBindingEnabled: boolean;
|
|
139
143
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
140
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;
|
|
141
154
|
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
142
155
|
activeTool: {
|
|
143
|
-
|
|
144
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
156
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
145
157
|
locked: boolean;
|
|
146
|
-
|
|
147
|
-
} | {
|
|
148
|
-
type: "custom";
|
|
149
|
-
customType: string;
|
|
150
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
151
|
-
locked: boolean;
|
|
152
|
-
};
|
|
158
|
+
} & import("../types").ActiveTool;
|
|
153
159
|
penMode: boolean;
|
|
154
160
|
penDetected: boolean;
|
|
155
161
|
exportBackground: boolean;
|
|
@@ -181,25 +187,29 @@ export declare class LinearElementEditor {
|
|
|
181
187
|
value: import("../types").NormalizedZoomValue;
|
|
182
188
|
}>;
|
|
183
189
|
openMenu: "canvas" | "shape" | null;
|
|
184
|
-
openPopup: "
|
|
185
|
-
openSidebar:
|
|
190
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
191
|
+
openSidebar: {
|
|
192
|
+
name: string;
|
|
193
|
+
tab?: string | undefined;
|
|
194
|
+
} | null;
|
|
186
195
|
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
187
|
-
|
|
196
|
+
defaultSidebarDockedPreference: boolean;
|
|
188
197
|
lastPointerDownWith: import("./types").PointerType;
|
|
189
|
-
selectedElementIds: {
|
|
190
|
-
[id: string]:
|
|
191
|
-
}
|
|
198
|
+
selectedElementIds: Readonly<{
|
|
199
|
+
[id: string]: true;
|
|
200
|
+
}>;
|
|
192
201
|
previousSelectedElementIds: {
|
|
193
|
-
[id: string]:
|
|
202
|
+
[id: string]: true;
|
|
194
203
|
};
|
|
204
|
+
selectedElementsAreBeingDragged: boolean;
|
|
195
205
|
shouldCacheIgnoreZoom: boolean;
|
|
196
206
|
toast: {
|
|
197
207
|
message: string;
|
|
198
208
|
closable?: boolean | undefined;
|
|
199
|
-
duration?: number | undefined;
|
|
209
|
+
duration?: number | undefined;
|
|
200
210
|
} | null;
|
|
201
211
|
zenModeEnabled: boolean;
|
|
202
|
-
theme:
|
|
212
|
+
theme: import("./types").Theme;
|
|
203
213
|
gridSize: number | null;
|
|
204
214
|
viewModeEnabled: boolean;
|
|
205
215
|
selectedGroupIds: {
|
|
@@ -222,8 +232,14 @@ export declare class LinearElementEditor {
|
|
|
222
232
|
data: import("../charts").Spreadsheet;
|
|
223
233
|
};
|
|
224
234
|
pendingImageElementId: string | null;
|
|
225
|
-
showHyperlinkPopup: false | "
|
|
235
|
+
showHyperlinkPopup: false | "editor" | "info";
|
|
226
236
|
selectedLinearElement: LinearElementEditor | null;
|
|
237
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
238
|
+
originSnapOffset: {
|
|
239
|
+
x: number;
|
|
240
|
+
y: number;
|
|
241
|
+
} | null;
|
|
242
|
+
objectsSnapModeEnabled: boolean;
|
|
227
243
|
};
|
|
228
244
|
};
|
|
229
245
|
static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
|
|
@@ -239,7 +255,7 @@ export declare class LinearElementEditor {
|
|
|
239
255
|
endBinding?: PointBinding;
|
|
240
256
|
}): void;
|
|
241
257
|
static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState): boolean;
|
|
242
|
-
static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState): {
|
|
258
|
+
static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, snapToGrid: boolean): {
|
|
243
259
|
pointerDownState: LinearElementEditor["pointerDownState"];
|
|
244
260
|
selectedPointsIndices: LinearElementEditor["selectedPointsIndices"];
|
|
245
261
|
} | undefined;
|
|
@@ -249,7 +265,7 @@ export declare class LinearElementEditor {
|
|
|
249
265
|
x: number;
|
|
250
266
|
y: number;
|
|
251
267
|
};
|
|
252
|
-
static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementBounds:
|
|
268
|
+
static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementBounds: Bounds, boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
|
|
253
269
|
static getElementAbsoluteCoords: (element: ExcalidrawLinearElement, includeBoundText?: boolean) => [number, number, number, number, number, number];
|
|
254
270
|
}
|
|
255
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 {};
|