@excalidraw/element 0.18.0-063e025 → 0.18.0-1118751
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/index.js +13047 -9808
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +19 -19
- package/dist/types/common/src/colors.d.ts +22 -0
- package/dist/types/common/src/constants.d.ts +54 -0
- package/dist/types/common/src/keys.d.ts +4 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utils.d.ts +1 -1
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
- package/dist/types/element/src/arrows/focus.d.ts +5 -2
- package/dist/types/element/src/binding.d.ts +15 -8
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +8 -5
- package/dist/types/element/src/comparisons.d.ts +7 -5
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/delta.d.ts +23 -1
- package/dist/types/element/src/dragElements.d.ts +27 -0
- package/dist/types/element/src/duplicate.d.ts +60 -0
- package/dist/types/element/src/flowchart.d.ts +10 -6
- package/dist/types/element/src/frame.d.ts +2 -2
- package/dist/types/element/src/groups.d.ts +1 -1
- package/dist/types/element/src/index.d.ts +4 -0
- package/dist/types/element/src/linearElementEditor.d.ts +17 -0
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +37 -2
- package/dist/types/element/src/renderElement.d.ts +21 -4
- package/dist/types/element/src/selection.d.ts +1 -1
- package/dist/types/element/src/shape.d.ts +27 -1
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/stickyNote.d.ts +183 -0
- package/dist/types/element/src/textElement.d.ts +7 -3
- package/dist/types/element/src/transform.d.ts +25 -6
- package/dist/types/element/src/typeChecks.d.ts +3 -2
- package/dist/types/element/src/types.d.ts +35 -6
- package/dist/types/element/src/utils.d.ts +15 -4
- package/dist/types/element/src/zindex.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +48 -9
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +32 -6
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +173 -576
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +32 -6
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +50 -10
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +13 -3
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +32 -6
- package/dist/types/excalidraw/actions/actionExport.d.ts +34 -8
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +99 -185
- package/dist/types/excalidraw/actions/actionGroup.d.ts +33 -7
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +68 -4
- package/dist/types/excalidraw/actions/actionLink.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionMenu.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionProperties.d.ts +45 -12
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionStyles.d.ts +17 -4
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +17 -4
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +16 -3
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +1 -2
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +5 -1
- package/dist/types/excalidraw/appState.d.ts +26 -5
- package/dist/types/excalidraw/components/Actions.d.ts +16 -10
- package/dist/types/excalidraw/components/App.arrowText.d.ts +104 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +468 -99
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.duplicate.d.ts +51 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +54 -0
- package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +8 -2
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +5 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
- package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
- package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
- package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +1 -3
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +151 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
- package/dist/types/excalidraw/components/UserList.d.ts +3 -2
- package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/icons.d.ts +5 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -1
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/data/blob.d.ts +36 -10
- package/dist/types/excalidraw/data/json.d.ts +18 -5
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/dist/types/excalidraw/scene/Renderer.d.ts +64 -2
- package/dist/types/excalidraw/scene/index.d.ts +1 -1
- package/dist/types/excalidraw/scene/types.d.ts +6 -1
- package/dist/types/excalidraw/types.d.ts +341 -21
- package/dist/types/excalidraw/viewport.d.ts +31 -66
- package/dist/types/laser-pointer/src/state.d.ts +1 -0
- package/dist/types/math/src/curve.d.ts +19 -12
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/dist/types/math/src/segment.d.ts +6 -0
- package/dist/types/utils/src/export.d.ts +1 -0
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +4 -4
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -173
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
- package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
- package/dist/types/excalidraw/components/shapes.d.ts +0 -270
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
|
@@ -2,9 +2,8 @@ export { actionDeleteSelected } from "./actionDeleteSelected";
|
|
|
2
2
|
export { actionBringForward, actionBringToFront, actionSendBackward, actionSendToBack, } from "./actionZindex";
|
|
3
3
|
export { actionSelectAll } from "./actionSelectAll";
|
|
4
4
|
export { actionDuplicateSelection } from "./actionDuplicateSelection";
|
|
5
|
-
export { actionChangeStrokeColor, actionChangeBackgroundColor, actionChangeStrokeWidth, actionChangeFillStyle, actionChangeSloppiness, actionChangeFreedrawMode, actionChangeOpacity, actionChangeFontSize, actionChangeFontFamily, actionChangeTextAlign, actionChangeVerticalAlign, actionChangeArrowProperties, } from "./actionProperties";
|
|
5
|
+
export { actionChangeStrokeColor, actionChangeBackgroundColor, actionChangeBucketFillBackgroundColor, actionChangeStrokeWidth, actionChangeFillStyle, actionChangeSloppiness, actionChangeFreedrawMode, actionChangeOpacity, actionChangeFontSize, actionChangeFontFamily, actionChangeTextAlign, actionChangeVerticalAlign, actionChangeArrowProperties, } from "./actionProperties";
|
|
6
6
|
export { actionChangeViewBackgroundColor, actionClearCanvas, actionZoomIn, actionZoomOut, actionResetZoom, actionZoomToFit, actionToggleTheme, } from "./actionCanvas";
|
|
7
|
-
export { actionSetEmbeddableAsActiveTool } from "./actionEmbeddable";
|
|
8
7
|
export { actionFinalize } from "./actionFinalize";
|
|
9
8
|
export { actionDeselect } from "./actionDeselect";
|
|
10
9
|
export { actionChangeProjectName, actionChangeExportBackground, actionSaveToActiveFile, actionSaveFileToDisk, actionLoadScene, } from "./actionExport";
|
|
@@ -11,6 +11,7 @@ export declare class ActionManager {
|
|
|
11
11
|
constructor(updater: UpdaterFn, getAppState: () => AppState, getElementsIncludingDeleted: () => readonly OrderedExcalidrawElement[], app: AppClassProperties);
|
|
12
12
|
registerAction(action: Action): void;
|
|
13
13
|
registerAll(actions: readonly Action[]): void;
|
|
14
|
+
private isActionBlockedByViewportTransition;
|
|
14
15
|
handleKeyDown(event: React.KeyboardEvent | KeyboardEvent): boolean;
|
|
15
16
|
executeAction<T extends Action>(action: T, source?: ActionSource, value?: Parameters<T["perform"]>[2]): void;
|
|
16
17
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SubtypeOf } from "@excalidraw/common/utility-types";
|
|
2
2
|
import type { ActionName } from "./types";
|
|
3
|
-
export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "
|
|
3
|
+
export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts" | "wrapSelectionInFrame"> | "saveScene" | "imageExport" | "commandPalette" | "searchMenu" | "toolLock";
|
|
4
4
|
export declare const getShortcutFromShortcutName: (name: ShortcutName, idx?: number) => string;
|
|
@@ -14,7 +14,7 @@ export type ActionResult = {
|
|
|
14
14
|
type ActionFn<TData = any> = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: TData | undefined, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
15
15
|
export type UpdaterFn = (res: ActionResult) => void;
|
|
16
16
|
export type ActionFilterFn = (action: Action) => void;
|
|
17
|
-
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "
|
|
17
|
+
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeBucketFillBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "toggleShapeSwitch" | "togglePolygon";
|
|
18
18
|
export type PanelComponentProps = {
|
|
19
19
|
elements: readonly ExcalidrawElement[];
|
|
20
20
|
appState: UIAppState;
|
|
@@ -43,5 +43,9 @@ export interface Action<TData = any> {
|
|
|
43
43
|
/** if set to `true`, allow action to be performed in viewMode.
|
|
44
44
|
* Defaults to `false` */
|
|
45
45
|
viewMode?: boolean;
|
|
46
|
+
/** if set to `true`, the action counts as canvas navigation and remains
|
|
47
|
+
* available in the non-interactive editor when
|
|
48
|
+
* `interaction: { enabled: { navigation: true } }`. Defaults to `false` */
|
|
49
|
+
navigation?: boolean;
|
|
46
50
|
}
|
|
47
51
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppState, NormalizedZoomValue } from "./types";
|
|
1
|
+
import type { AppState, InputDevice, NormalizedZoomValue } from "./types";
|
|
2
2
|
export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
3
3
|
export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
|
|
4
4
|
viewBackgroundColor?: string | undefined;
|
|
@@ -24,15 +24,17 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
24
24
|
selectedLinearElement?: import("@excalidraw/element").LinearElementEditor | null | undefined;
|
|
25
25
|
isBindingEnabled?: boolean | undefined;
|
|
26
26
|
isMidpointSnappingEnabled?: boolean | undefined;
|
|
27
|
+
gridModeEnabled?: boolean | undefined;
|
|
27
28
|
zenModeEnabled?: boolean | undefined;
|
|
28
29
|
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
29
30
|
exportScale?: number | undefined;
|
|
30
31
|
currentItemArrowType?: "round" | "sharp" | "elbow" | undefined;
|
|
31
|
-
bindMode?: import("@excalidraw/element/types").BindMode | undefined;
|
|
32
32
|
gridSize?: number | undefined;
|
|
33
|
+
bindMode?: import("@excalidraw/element/types").BindMode | undefined;
|
|
33
34
|
showWelcomeScreen?: boolean | undefined;
|
|
34
35
|
boxSelectionMode?: import("./types").BoxSelectionMode | undefined;
|
|
35
36
|
bindingPreference?: "enabled" | "disabled" | undefined;
|
|
37
|
+
inputDevice?: InputDevice | undefined;
|
|
36
38
|
preferredSelectionTool?: {
|
|
37
39
|
type: "selection" | "lasso";
|
|
38
40
|
initialized: boolean;
|
|
@@ -43,6 +45,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
43
45
|
exportEmbedScene?: boolean | undefined;
|
|
44
46
|
exportWithDarkMode?: boolean | undefined;
|
|
45
47
|
currentItemStrokeColor?: string | undefined;
|
|
48
|
+
currentItemStickynoteStrokeColor?: string | undefined;
|
|
49
|
+
currentItemStickynoteBackgroundColor?: string | undefined;
|
|
46
50
|
currentItemBackgroundColor?: string | undefined;
|
|
47
51
|
currentItemFillStyle?: import("@excalidraw/element/types").FillStyle | undefined;
|
|
48
52
|
currentItemStrokeWidthKey?: import("@excalidraw/common").StrokeWidthKey | undefined;
|
|
@@ -69,7 +73,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
69
73
|
[id: string]: true;
|
|
70
74
|
} | undefined;
|
|
71
75
|
gridStep?: number | undefined;
|
|
72
|
-
gridModeEnabled?: boolean | undefined;
|
|
73
76
|
stats?: {
|
|
74
77
|
open: boolean;
|
|
75
78
|
panels: number;
|
|
@@ -78,21 +81,29 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
78
81
|
lockedMultiSelections?: {
|
|
79
82
|
[groupId: string]: true;
|
|
80
83
|
} | undefined;
|
|
84
|
+
colorTopPicks?: {
|
|
85
|
+
elementStroke: readonly string[] | null;
|
|
86
|
+
elementBackground: readonly string[] | null;
|
|
87
|
+
bucketFill: readonly string[] | null;
|
|
88
|
+
stickyNoteStroke: readonly string[] | null;
|
|
89
|
+
stickyNoteBackground: readonly string[] | null;
|
|
90
|
+
} | undefined;
|
|
91
|
+
fontTopPicks?: readonly number[] | null | undefined;
|
|
81
92
|
};
|
|
82
93
|
export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
|
|
83
94
|
viewBackgroundColor?: string | undefined;
|
|
95
|
+
gridModeEnabled?: boolean | undefined;
|
|
84
96
|
gridSize?: number | undefined;
|
|
85
97
|
gridStep?: number | undefined;
|
|
86
|
-
gridModeEnabled?: boolean | undefined;
|
|
87
98
|
lockedMultiSelections?: {
|
|
88
99
|
[groupId: string]: true;
|
|
89
100
|
} | undefined;
|
|
90
101
|
};
|
|
91
102
|
export declare const clearAppStateForDatabase: (appState: Partial<AppState>) => {
|
|
92
103
|
viewBackgroundColor?: string | undefined;
|
|
104
|
+
gridModeEnabled?: boolean | undefined;
|
|
93
105
|
gridSize?: number | undefined;
|
|
94
106
|
gridStep?: number | undefined;
|
|
95
|
-
gridModeEnabled?: boolean | undefined;
|
|
96
107
|
lockedMultiSelections?: {
|
|
97
108
|
[groupId: string]: true;
|
|
98
109
|
} | undefined;
|
|
@@ -103,3 +114,13 @@ export declare const isEraserActive: ({ activeTool, }: {
|
|
|
103
114
|
export declare const isHandToolActive: ({ activeTool, }: {
|
|
104
115
|
activeTool: AppState["activeTool"];
|
|
105
116
|
}) => boolean;
|
|
117
|
+
/**
|
|
118
|
+
* The device the wheel mappings follow for the given preference.
|
|
119
|
+
*
|
|
120
|
+
* `auto` is meant to detect the device from the wheel events themselves
|
|
121
|
+
* (line vs. pixel delta modes, whole vs. fractional deltas, one vs. two axes
|
|
122
|
+
* moving, event cadence and momentum tails). That is not implemented yet, so
|
|
123
|
+
* it resolves to `trackpad` — the mapping the editor has always had, and the
|
|
124
|
+
* default to keep until detection exists.
|
|
125
|
+
*/
|
|
126
|
+
export declare const resolveInputDevice: (inputDevice: InputDevice) => Exclude<InputDevice, "auto">;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NonDeletedElementsMap, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
2
2
|
import "./Actions.scss";
|
|
3
|
-
import type { AppClassProperties,
|
|
3
|
+
import type { AppClassProperties, UIAppState, AppState } from "../types";
|
|
4
4
|
import type { ActionManager } from "../actions/manager";
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
export { canChangeStrokeColor, canChangeBackgroundColor, } from "./shapeActionPredicates";
|
|
6
|
+
/**
|
|
7
|
+
* Full styles panel: the wide, always-expanded layout used on desktop when the
|
|
8
|
+
* UI is in "full" mode.
|
|
9
|
+
*/
|
|
7
10
|
export declare const SelectedShapeActions: ({ appState, elementsMap, renderAction, app, }: {
|
|
8
11
|
appState: UIAppState;
|
|
9
12
|
elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
|
|
10
13
|
renderAction: ActionManager["renderAction"];
|
|
11
14
|
app: AppClassProperties;
|
|
12
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* Compact styles panel — the collapsed, popover-driven layout used on tablets
|
|
18
|
+
* and on desktop when the UI is in "compact" mode.
|
|
19
|
+
*/
|
|
13
20
|
export declare const CompactShapeActions: ({ appState, elementsMap, renderAction, app, setAppState, }: {
|
|
14
21
|
appState: UIAppState;
|
|
15
22
|
elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
|
|
@@ -17,6 +24,11 @@ export declare const CompactShapeActions: ({ appState, elementsMap, renderAction
|
|
|
17
24
|
app: AppClassProperties;
|
|
18
25
|
setAppState: React.Component<any, AppState>["setState"];
|
|
19
26
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Mobile styles panel — the horizontal action bar used on phones, with an
|
|
29
|
+
* overflow measurement that promotes duplicate/delete out of the popover when
|
|
30
|
+
* there is room.
|
|
31
|
+
*/
|
|
20
32
|
export declare const MobileShapeActions: ({ appState, elementsMap, renderAction, app, setAppState, }: {
|
|
21
33
|
appState: UIAppState;
|
|
22
34
|
elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
|
|
@@ -24,12 +36,6 @@ export declare const MobileShapeActions: ({ appState, elementsMap, renderAction,
|
|
|
24
36
|
app: AppClassProperties;
|
|
25
37
|
setAppState: React.Component<any, AppState>["setState"];
|
|
26
38
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
export declare const ShapesSwitcher: ({ activeTool, setAppState, app, UIOptions, }: {
|
|
28
|
-
activeTool: UIAppState["activeTool"];
|
|
29
|
-
setAppState: React.Component<any, AppState>["setState"];
|
|
30
|
-
app: AppClassProperties;
|
|
31
|
-
UIOptions: AppProps["UIOptions"];
|
|
32
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
33
39
|
export declare const ZoomActions: ({ renderAction, }: {
|
|
34
40
|
renderAction: ActionManager["renderAction"];
|
|
35
41
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { LinearElementEditor } from "@excalidraw/element";
|
|
2
|
+
import type { ArrowEndpoint } from "@excalidraw/element";
|
|
3
|
+
import type { ExcalidrawElement, ExcalidrawTextElement, FixedPoint, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
4
|
+
import type App from "./App";
|
|
5
|
+
import type { AppState, PointerDownState } from "../types";
|
|
6
|
+
/**
|
|
7
|
+
* Text ↔ arrow interactions.
|
|
8
|
+
*
|
|
9
|
+
* With the text tool: the hover affordance showing where a click would attach
|
|
10
|
+
* text to an arrow — a free endpoint (binds the arrow to a new text element
|
|
11
|
+
* positioned against that endpoint) or the arrow's midpoint (adds a label
|
|
12
|
+
* bound to the arrow) — and the endpoint-bound flavor of drag-sizing a new
|
|
13
|
+
* text.
|
|
14
|
+
*
|
|
15
|
+
* With the selection tool: dragging an arrow's existing label along the arrow
|
|
16
|
+
* — the grab affordance, the drag itself, and where a double-click starts
|
|
17
|
+
* editing a label the drag has moved.
|
|
18
|
+
*
|
|
19
|
+
* The scene-level logic lives in `@excalidraw/element`'s
|
|
20
|
+
* `arrowEndpointText.ts` and `linearElementEditor.ts`.
|
|
21
|
+
*/
|
|
22
|
+
export declare class AppArrowText {
|
|
23
|
+
private app;
|
|
24
|
+
constructor(app: App);
|
|
25
|
+
/**
|
|
26
|
+
* With the text tool active, an arrow under the cursor is a target for
|
|
27
|
+
* attaching text. Returns where the text would land (if anywhere), and keeps
|
|
28
|
+
* `appState.hoveredArrowTextAnchor` — which drives the highlight — in sync.
|
|
29
|
+
*/
|
|
30
|
+
updateHoveredAnchor: (scenePointer: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
}) => AppState["hoveredArrowTextAnchor"];
|
|
34
|
+
/**
|
|
35
|
+
* Re-evaluates the hovered anchor at the last known pointer position — for
|
|
36
|
+
* events that change what a click would do without the pointer moving,
|
|
37
|
+
* i.e. the ctrl/cmd binding toggle. (Events that invalidate the anchor
|
|
38
|
+
* wholesale — tool switches, finalize, deselect — clear it directly
|
|
39
|
+
* instead.)
|
|
40
|
+
*/
|
|
41
|
+
refresh: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* A free arrow endpoint a new text could be bound to. Binding an endpoint is
|
|
44
|
+
* an arrow binding, so it follows the binding toggle (ctrl/cmd) like every
|
|
45
|
+
* other one — holding it makes the text tool drop plain text instead.
|
|
46
|
+
*/
|
|
47
|
+
getBindableEndpointAtPosition(x: number, y: number): ArrowEndpoint | null;
|
|
48
|
+
/**
|
|
49
|
+
* Mirrors what `handleTextOnPointerDown` would do at this position, so the
|
|
50
|
+
* highlight can't promise something the click won't deliver.
|
|
51
|
+
*/
|
|
52
|
+
private getAnchorAtPosition;
|
|
53
|
+
/**
|
|
54
|
+
* How a text should be created to read as a label for this endpoint — the
|
|
55
|
+
* side midpoint to bind, the alignment that pins it, and the scene position
|
|
56
|
+
* it must sit at. `targetStrokeWidth` is the caller's to provide so it can
|
|
57
|
+
* guarantee it matches the stroke width the text is then created with — the
|
|
58
|
+
* binding gap derives from it (see `getTextBindingForArrowEndpoint`).
|
|
59
|
+
*/
|
|
60
|
+
getTextBinding({ arrow, startOrEnd }: ArrowEndpoint, targetStrokeWidth: number): {
|
|
61
|
+
fixedPoint: FixedPoint;
|
|
62
|
+
textAlign: import("@excalidraw/element/types").TextAlign;
|
|
63
|
+
verticalAlign: import("@excalidraw/element/types").VerticalAlign;
|
|
64
|
+
anchor: import("@excalidraw/math").GlobalPoint;
|
|
65
|
+
} | null;
|
|
66
|
+
/**
|
|
67
|
+
* Binds the arrow endpoint to the created text, at the side midpoint the
|
|
68
|
+
* placement resolved (`getTextBinding`'s `fixedPoint`).
|
|
69
|
+
*/
|
|
70
|
+
bindText({ arrow, startOrEnd }: ArrowEndpoint, text: NonDeleted<ExcalidrawTextElement>, fixedPoint: FixedPoint): void;
|
|
71
|
+
/**
|
|
72
|
+
* A text bound to an arrow endpoint can't be positioned by the drag — the
|
|
73
|
+
* binding already placed it — so only its width is dragged out. Returns
|
|
74
|
+
* whether it owned the drag.
|
|
75
|
+
*/
|
|
76
|
+
maybeDragNewText(newElement: ExcalidrawElement, pointerCoords: {
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
}): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the arrow's label is what a grab at this position would pick up:
|
|
82
|
+
* the pointer is over the label, and no element stacked above the arrow
|
|
83
|
+
* owns the hit instead.
|
|
84
|
+
*/
|
|
85
|
+
isBoundTextGrabbable(element: NonDeletedExcalidrawElement, x: number, y: number): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The pointer-move half of dragging a label along its arrow. Owns the move
|
|
88
|
+
* whenever the gesture started on the label (`pointerDownState.hit.arrowLabel`),
|
|
89
|
+
* dragging only once past the threshold. Returns whether it owned it.
|
|
90
|
+
*/
|
|
91
|
+
maybeDragLabel(linearElementEditor: LinearElementEditor, pointerDownState: PointerDownState, pointerCoords: {
|
|
92
|
+
x: number;
|
|
93
|
+
y: number;
|
|
94
|
+
}): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Where a double-click on a labeled arrow should start text editing: the
|
|
97
|
+
* center of the label itself, which a label drag may have moved away from
|
|
98
|
+
* the arrow's midpoint. Null when the element is not a labeled arrow.
|
|
99
|
+
*/
|
|
100
|
+
getLabelCenter(element: ExcalidrawElement): {
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
} | null;
|
|
104
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Theme } from "@excalidraw/element/types";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
type ScenePoint = {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
/** Owns bucket-fill interaction and App-bound scene mutations. */
|
|
8
|
+
export declare class AppBucketFill {
|
|
9
|
+
private app;
|
|
10
|
+
constructor(app: App);
|
|
11
|
+
private temporaryEyeDropper;
|
|
12
|
+
/**
|
|
13
|
+
* The click armed on pointer down, committed on pointer up. Deferring the
|
|
14
|
+
* scene mutation to pointer up is what lets a pinch/pan second finger, a
|
|
15
|
+
* long-press context menu, or a pointercancel abort the fill — on pointer
|
|
16
|
+
* down the editor cannot yet know the gesture will stay a single-pointer
|
|
17
|
+
* click.
|
|
18
|
+
*/
|
|
19
|
+
private pending;
|
|
20
|
+
/** Arm a fill at the pointer-down position; nothing mutates yet. */
|
|
21
|
+
handlePointerDown: (scenePointer: ScenePoint) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Commit the armed fill, at the pointer-DOWN position (what the user
|
|
24
|
+
* aimed at). No-op when the gesture was aborted in the meantime.
|
|
25
|
+
*/
|
|
26
|
+
handlePointerUp: () => void;
|
|
27
|
+
/** Abort the armed fill (second finger, context menu, pointercancel). */
|
|
28
|
+
cancel: () => void;
|
|
29
|
+
cycleBackgroundColor: () => void;
|
|
30
|
+
openTemporaryEyeDropper: () => void;
|
|
31
|
+
closeTemporaryEyeDropper: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Apply the current bucket fill settings to an existing fill-compatible
|
|
34
|
+
* element (no-op when nothing would change). One undoable step.
|
|
35
|
+
*/
|
|
36
|
+
private restyle;
|
|
37
|
+
private fill;
|
|
38
|
+
/**
|
|
39
|
+
* The color the bucket fill tool actually fills with: the shared
|
|
40
|
+
* `currentItemBackgroundColor`, falling back to green when that is
|
|
41
|
+
* transparent (the tool's picker doesn't offer transparent, but the shared
|
|
42
|
+
* state can hold it from the generic shape picker).
|
|
43
|
+
*/
|
|
44
|
+
getBucketFillBackgroundColor: (backgroundColor: string,
|
|
45
|
+
/** supply only for display purposes such as when applying to the cursor */
|
|
46
|
+
theme?: Theme) => string;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AppState } from "../types";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
/**
|
|
4
|
+
* Captures all cursor management for the interactive canvas.
|
|
5
|
+
*
|
|
6
|
+
* The canvas cursor is set exclusively imperatively, through this class —
|
|
7
|
+
* never via inline styles or React-rendered `style.cursor`, which React
|
|
8
|
+
* would rewrite on rerender whenever the computed value changes, clobbering
|
|
9
|
+
* cursors set here.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AppCursor {
|
|
12
|
+
private app;
|
|
13
|
+
private toolCursorMemo;
|
|
14
|
+
private eraserCanvasCache;
|
|
15
|
+
private eraserPreviewDataURL;
|
|
16
|
+
constructor(app: App);
|
|
17
|
+
private get canvas();
|
|
18
|
+
set: (cursor: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Resets to the resting cursor — the cursor shown when no interaction or
|
|
21
|
+
* hover affordance overrides it: the view-mode grab cursor when
|
|
22
|
+
* drag-to-pan applies, the active tool's cursor otherwise.
|
|
23
|
+
*/
|
|
24
|
+
reset: () => void;
|
|
25
|
+
/** applies the given tool's cursor (defaults to the active tool) */
|
|
26
|
+
applyForTool: (activeTool?: AppState["activeTool"]) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Re-runs the hover cursor logic at the last known pointer position by
|
|
29
|
+
* re-dispatching a synthetic pointermove — for state changes that alter
|
|
30
|
+
* what hovering means without the pointer moving (e.g. the tool reverting
|
|
31
|
+
* to selection after an element is created). Mouse only: touch and pen
|
|
32
|
+
* have no resting hover to restore.
|
|
33
|
+
*/
|
|
34
|
+
refreshHover: () => void;
|
|
35
|
+
/** clears the inline cursor so the environment default (CSS) applies */
|
|
36
|
+
private clear;
|
|
37
|
+
private applyEraser;
|
|
38
|
+
}
|