@excalidraw/math 0.18.0-a9ca16e → 0.18.0-ab0255f
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 +297 -99
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +1 -1
- package/dist/types/common/src/colors.d.ts +17 -1
- package/dist/types/common/src/constants.d.ts +12 -7
- package/dist/types/common/src/keys.d.ts +2 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/utils.d.ts +1 -43
- package/dist/types/element/src/Scene.d.ts +6 -4
- package/dist/types/element/src/align.d.ts +2 -2
- 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 +17 -8
- package/dist/types/element/src/bounds.d.ts +22 -7
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +1 -1
- package/dist/types/element/src/comparisons.d.ts +5 -4
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/distribute.d.ts +2 -2
- package/dist/types/element/src/dragElements.d.ts +27 -0
- package/dist/types/element/src/duplicate.d.ts +4 -3
- package/dist/types/element/src/embeddable.d.ts +2 -2
- package/dist/types/element/src/flowchart.d.ts +7 -7
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +9 -8
- package/dist/types/element/src/groups.d.ts +9 -9
- package/dist/types/element/src/index.d.ts +4 -1
- package/dist/types/element/src/linearElementEditor.d.ts +17 -10
- package/dist/types/element/src/newElement.d.ts +14 -0
- package/dist/types/element/src/renderElement.d.ts +0 -3
- package/dist/types/element/src/resizeElements.d.ts +2 -2
- package/dist/types/element/src/selection.d.ts +6 -6
- package/dist/types/element/src/shape.d.ts +13 -1
- package/dist/types/element/src/textElement.d.ts +12 -9
- package/dist/types/element/src/transform.d.ts +2 -2
- package/dist/types/element/src/typeChecks.d.ts +26 -25
- package/dist/types/element/src/types.d.ts +8 -1
- package/dist/types/element/src/utils.d.ts +1 -1
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +30 -12
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +20 -8
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +132 -926
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +20 -8
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +32 -13
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionDeselect.d.ts} +24 -33
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +21 -9
- package/dist/types/excalidraw/actions/actionExport.d.ts +22 -10
- package/dist/types/excalidraw/actions/actionFrame.d.ts +42 -196
- package/dist/types/excalidraw/actions/actionGroup.d.ts +35 -23
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +14 -6
- package/dist/types/excalidraw/actions/actionLink.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionMenu.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionProperties.d.ts +50 -26
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +15 -9
- package/dist/types/excalidraw/actions/actionStyles.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +14 -9
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +14 -9
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +11 -5
- package/dist/types/excalidraw/actions/index.d.ts +2 -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 +8 -4
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +7 -5
- package/dist/types/excalidraw/components/Actions.d.ts +17 -12
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.arrowText.d.ts +72 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +34 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +31 -0
- package/dist/types/excalidraw/components/App.d.ts +355 -65
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -3
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +1 -0
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +6 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
- package/dist/types/excalidraw/components/{ToolButton.d.ts → IconButton.d.ts} +16 -19
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +4 -2
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- 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/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- 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/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
- 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 +146 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +3 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
- package/dist/types/excalidraw/components/icons.d.ts +3 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +8 -4
- 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 +24 -12
- package/dist/types/excalidraw/data/index.d.ts +4 -4
- package/dist/types/excalidraw/data/json.d.ts +18 -12
- package/dist/types/excalidraw/data/library.d.ts +1 -1
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/renderer/animation.d.ts +5 -1
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -3
- package/dist/types/excalidraw/scene/Renderer.d.ts +426 -19
- package/dist/types/excalidraw/scene/export.d.ts +3 -3
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +4 -3
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/types.d.ts +368 -19
- package/dist/types/excalidraw/viewport.d.ts +272 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -3
- package/dist/types/fractional-indexing/src/index.d.ts +29 -0
- package/dist/types/laser-pointer/src/index.d.ts +2 -0
- package/dist/types/laser-pointer/src/math.d.ts +16 -0
- package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
- package/dist/types/laser-pointer/src/state.d.ts +36 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +4 -1
- 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/point.d.ts +1 -0
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/dist/types/utils/src/export.d.ts +3 -3
- package/dist/types/utils/src/index.d.ts +1 -2
- package/package.json +2 -2
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- 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/shapes.d.ts +0 -263
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -14,10 +14,10 @@ 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" | "changeFillStyle" | "changeStrokeWidth" | "
|
|
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
|
-
appState:
|
|
20
|
+
appState: UIAppState;
|
|
21
21
|
updateData: <T = any>(formData?: T) => void;
|
|
22
22
|
appProps: ExcalidrawProps;
|
|
23
23
|
data?: Record<string, any>;
|
|
@@ -26,7 +26,7 @@ export type PanelComponentProps = {
|
|
|
26
26
|
};
|
|
27
27
|
export interface Action<TData = any> {
|
|
28
28
|
name: ActionName;
|
|
29
|
-
label: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<
|
|
29
|
+
label: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<UIAppState>, app: AppClassProperties) => string);
|
|
30
30
|
keywords?: string[];
|
|
31
31
|
icon?: React.ReactNode | ((appState: UIAppState, elements: readonly ExcalidrawElement[]) => React.ReactNode);
|
|
32
32
|
PanelComponent?: React.FC<PanelComponentProps>;
|
|
@@ -34,7 +34,7 @@ export interface Action<TData = any> {
|
|
|
34
34
|
keyPriority?: number;
|
|
35
35
|
keyTest?: (event: React.KeyboardEvent | KeyboardEvent, appState: AppState, elements: readonly ExcalidrawElement[], app: AppClassProperties) => boolean;
|
|
36
36
|
predicate?: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: ExcalidrawProps, app: AppClassProperties) => boolean;
|
|
37
|
-
checked?: (appState: Readonly<
|
|
37
|
+
checked?: (appState: Readonly<UIAppState>) => boolean;
|
|
38
38
|
trackEvent: false | {
|
|
39
39
|
category: "toolbar" | "element" | "canvas" | "export" | "history" | "menu" | "collab" | "hyperlink" | "search_menu" | "shape_switch";
|
|
40
40
|
action?: string;
|
|
@@ -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,6 +1,5 @@
|
|
|
1
1
|
import { LaserPointer } from "@excalidraw/laser-pointer";
|
|
2
2
|
import type { LaserPointerOptions } from "@excalidraw/laser-pointer";
|
|
3
|
-
import type { AnimationFrameHandler } from "./animation-frame-handler";
|
|
4
3
|
import type App from "./components/App";
|
|
5
4
|
export interface Trail {
|
|
6
5
|
start(container: SVGSVGElement): void;
|
|
@@ -15,7 +14,6 @@ export interface AnimatedTrailOptions {
|
|
|
15
14
|
animateTrail?: boolean;
|
|
16
15
|
}
|
|
17
16
|
export declare class AnimatedTrail implements Trail {
|
|
18
|
-
private animationFrameHandler;
|
|
19
17
|
protected app: App;
|
|
20
18
|
private options;
|
|
21
19
|
private currentTrail?;
|
|
@@ -23,9 +21,12 @@ export declare class AnimatedTrail implements Trail {
|
|
|
23
21
|
private container?;
|
|
24
22
|
private trailElement;
|
|
25
23
|
private trailAnimation?;
|
|
26
|
-
|
|
24
|
+
private key;
|
|
25
|
+
private static counter;
|
|
26
|
+
constructor(app: App, options: Partial<LaserPointerOptions> & Partial<AnimatedTrailOptions>);
|
|
27
27
|
get hasCurrentTrail(): boolean;
|
|
28
28
|
hasLastPoint(x: number, y: number): boolean;
|
|
29
|
+
private cleanup;
|
|
29
30
|
start(container?: SVGSVGElement): void;
|
|
30
31
|
stop(): void;
|
|
31
32
|
startPath(x: number, y: number): void;
|
|
@@ -24,13 +24,15 @@ 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;
|
|
35
|
+
boxSelectionMode?: import("./types").BoxSelectionMode | undefined;
|
|
34
36
|
bindingPreference?: "enabled" | "disabled" | undefined;
|
|
35
37
|
preferredSelectionTool?: {
|
|
36
38
|
type: "selection" | "lasso";
|
|
@@ -44,9 +46,10 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
44
46
|
currentItemStrokeColor?: string | undefined;
|
|
45
47
|
currentItemBackgroundColor?: string | undefined;
|
|
46
48
|
currentItemFillStyle?: import("@excalidraw/element/types").FillStyle | undefined;
|
|
47
|
-
|
|
49
|
+
currentItemStrokeWidthKey?: import("@excalidraw/common").StrokeWidthKey | undefined;
|
|
48
50
|
currentItemStrokeStyle?: import("@excalidraw/element/types").StrokeStyle | undefined;
|
|
49
51
|
currentItemRoughness?: number | undefined;
|
|
52
|
+
currentItemStrokeVariability?: import("@excalidraw/element/types").StrokeVariability | undefined;
|
|
50
53
|
currentItemOpacity?: number | undefined;
|
|
51
54
|
currentItemFontFamily?: number | undefined;
|
|
52
55
|
currentItemFontSize?: number | undefined;
|
|
@@ -67,7 +70,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
67
70
|
[id: string]: true;
|
|
68
71
|
} | undefined;
|
|
69
72
|
gridStep?: number | undefined;
|
|
70
|
-
gridModeEnabled?: boolean | undefined;
|
|
71
73
|
stats?: {
|
|
72
74
|
open: boolean;
|
|
73
75
|
panels: number;
|
|
@@ -79,18 +81,18 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
79
81
|
};
|
|
80
82
|
export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
|
|
81
83
|
viewBackgroundColor?: string | undefined;
|
|
84
|
+
gridModeEnabled?: boolean | undefined;
|
|
82
85
|
gridSize?: number | undefined;
|
|
83
86
|
gridStep?: number | undefined;
|
|
84
|
-
gridModeEnabled?: boolean | undefined;
|
|
85
87
|
lockedMultiSelections?: {
|
|
86
88
|
[groupId: string]: true;
|
|
87
89
|
} | undefined;
|
|
88
90
|
};
|
|
89
91
|
export declare const clearAppStateForDatabase: (appState: Partial<AppState>) => {
|
|
90
92
|
viewBackgroundColor?: string | undefined;
|
|
93
|
+
gridModeEnabled?: boolean | undefined;
|
|
91
94
|
gridSize?: number | undefined;
|
|
92
95
|
gridStep?: number | undefined;
|
|
93
|
-
gridModeEnabled?: boolean | undefined;
|
|
94
96
|
lockedMultiSelections?: {
|
|
95
97
|
[groupId: string]: true;
|
|
96
98
|
} | undefined;
|
|
@@ -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,15 +36,8 @@ 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
|
|
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
|
-
export declare const ZoomActions: ({ renderAction, zoom, }: {
|
|
39
|
+
export declare const ZoomActions: ({ renderAction, }: {
|
|
34
40
|
renderAction: ActionManager["renderAction"];
|
|
35
|
-
zoom: Zoom;
|
|
36
41
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
37
42
|
export declare const UndoRedoActions: ({ renderAction, className, }: {
|
|
38
43
|
renderAction: ActionManager["renderAction"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const activeConfirmDialogAtom: import("jotai
|
|
1
|
+
export declare const activeConfirmDialogAtom: import("jotai").PrimitiveAtom<"clearCanvas" | null> & {
|
|
2
2
|
init: "clearCanvas" | null;
|
|
3
3
|
};
|
|
4
4
|
export declare const ActiveConfirmDialog: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ArrowEndpoint } from "@excalidraw/element";
|
|
2
|
+
import type { ExcalidrawElement, ExcalidrawTextElement, FixedPoint, NonDeleted } from "@excalidraw/element/types";
|
|
3
|
+
import type App from "./App";
|
|
4
|
+
import type { AppState } from "../types";
|
|
5
|
+
/**
|
|
6
|
+
* The text tool's interaction with arrows: the hover affordance showing where
|
|
7
|
+
* a click would attach text to an arrow — a free endpoint (binds the arrow to
|
|
8
|
+
* a new text element positioned against that endpoint) or the arrow's midpoint
|
|
9
|
+
* (adds a label bound to the arrow) — and the endpoint-bound flavor of
|
|
10
|
+
* drag-sizing a new text.
|
|
11
|
+
*
|
|
12
|
+
* The scene-level logic lives in `@excalidraw/element`'s `arrowEndpointText.ts`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AppArrowText {
|
|
15
|
+
private app;
|
|
16
|
+
constructor(app: App);
|
|
17
|
+
/**
|
|
18
|
+
* With the text tool active, an arrow under the cursor is a target for
|
|
19
|
+
* attaching text. Returns where the text would land (if anywhere), and keeps
|
|
20
|
+
* `appState.hoveredArrowTextAnchor` — which drives the highlight — in sync.
|
|
21
|
+
*/
|
|
22
|
+
updateHoveredAnchor: (scenePointer: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}) => AppState["hoveredArrowTextAnchor"];
|
|
26
|
+
/**
|
|
27
|
+
* Re-evaluates the hovered anchor at the last known pointer position — for
|
|
28
|
+
* events that change what a click would do without the pointer moving,
|
|
29
|
+
* i.e. the ctrl/cmd binding toggle. (Events that invalidate the anchor
|
|
30
|
+
* wholesale — tool switches, finalize, deselect — clear it directly
|
|
31
|
+
* instead.)
|
|
32
|
+
*/
|
|
33
|
+
refresh: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* A free arrow endpoint a new text could be bound to. Binding an endpoint is
|
|
36
|
+
* an arrow binding, so it follows the binding toggle (ctrl/cmd) like every
|
|
37
|
+
* other one — holding it makes the text tool drop plain text instead.
|
|
38
|
+
*/
|
|
39
|
+
getBindableEndpointAtPosition(x: number, y: number): ArrowEndpoint | null;
|
|
40
|
+
/**
|
|
41
|
+
* Mirrors what `handleTextOnPointerDown` would do at this position, so the
|
|
42
|
+
* highlight can't promise something the click won't deliver.
|
|
43
|
+
*/
|
|
44
|
+
private getAnchorAtPosition;
|
|
45
|
+
/**
|
|
46
|
+
* How a text should be created to read as a label for this endpoint — the
|
|
47
|
+
* side midpoint to bind, the alignment that pins it, and the scene position
|
|
48
|
+
* it must sit at. `targetStrokeWidth` is the caller's to provide so it can
|
|
49
|
+
* guarantee it matches the stroke width the text is then created with — the
|
|
50
|
+
* binding gap derives from it (see `getTextBindingForArrowEndpoint`).
|
|
51
|
+
*/
|
|
52
|
+
getTextBinding({ arrow, startOrEnd }: ArrowEndpoint, targetStrokeWidth: number): {
|
|
53
|
+
fixedPoint: FixedPoint;
|
|
54
|
+
textAlign: import("@excalidraw/element/types").TextAlign;
|
|
55
|
+
verticalAlign: import("@excalidraw/element/types").VerticalAlign;
|
|
56
|
+
anchor: import("@excalidraw/math").GlobalPoint;
|
|
57
|
+
} | null;
|
|
58
|
+
/**
|
|
59
|
+
* Binds the arrow endpoint to the created text, at the side midpoint the
|
|
60
|
+
* placement resolved (`getTextBinding`'s `fixedPoint`).
|
|
61
|
+
*/
|
|
62
|
+
bindText({ arrow, startOrEnd }: ArrowEndpoint, text: NonDeleted<ExcalidrawTextElement>, fixedPoint: FixedPoint): void;
|
|
63
|
+
/**
|
|
64
|
+
* A text bound to an arrow endpoint can't be positioned by the drag — the
|
|
65
|
+
* binding already placed it — so only its width is dragged out. Returns
|
|
66
|
+
* whether it owned the drag.
|
|
67
|
+
*/
|
|
68
|
+
maybeDragNewText(newElement: ExcalidrawElement, pointerCoords: {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
}): boolean;
|
|
72
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type App from "./App";
|
|
2
|
+
type ScenePoint = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
/** Owns bucket-fill interaction and App-bound scene mutations. */
|
|
7
|
+
export declare class AppBucketFill {
|
|
8
|
+
private app;
|
|
9
|
+
constructor(app: App);
|
|
10
|
+
/**
|
|
11
|
+
* The click armed on pointer down, committed on pointer up. Deferring the
|
|
12
|
+
* scene mutation to pointer up is what lets a pinch/pan second finger, a
|
|
13
|
+
* long-press context menu, or a pointercancel abort the fill — on pointer
|
|
14
|
+
* down the editor cannot yet know the gesture will stay a single-pointer
|
|
15
|
+
* click.
|
|
16
|
+
*/
|
|
17
|
+
private pending;
|
|
18
|
+
/** Arm a fill at the pointer-down position; nothing mutates yet. */
|
|
19
|
+
handlePointerDown: (scenePointer: ScenePoint) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Commit the armed fill, at the pointer-DOWN position (what the user
|
|
22
|
+
* aimed at). No-op when the gesture was aborted in the meantime.
|
|
23
|
+
*/
|
|
24
|
+
handlePointerUp: () => void;
|
|
25
|
+
/** Abort the armed fill (second finger, context menu, pointercancel). */
|
|
26
|
+
cancel: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Apply the current bucket fill settings to an existing fill-compatible
|
|
29
|
+
* element (no-op when nothing would change). One undoable step.
|
|
30
|
+
*/
|
|
31
|
+
private restyle;
|
|
32
|
+
private fill;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type App from "./App";
|
|
2
|
+
import type { AppState } from "../types";
|
|
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 eraserCanvasCache;
|
|
14
|
+
private eraserPreviewDataURL;
|
|
15
|
+
private drawShapeCanvasCache;
|
|
16
|
+
private drawShapePreviewDataURL;
|
|
17
|
+
constructor(app: App);
|
|
18
|
+
private get canvas();
|
|
19
|
+
set: (cursor: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Resets to the resting cursor — the cursor shown when no interaction or
|
|
22
|
+
* hover affordance overrides it: the view-mode grab cursor when
|
|
23
|
+
* drag-to-pan applies, the active tool's cursor otherwise.
|
|
24
|
+
*/
|
|
25
|
+
reset: () => void;
|
|
26
|
+
/** applies the given tool's cursor (defaults to the active tool) */
|
|
27
|
+
applyForTool: (activeTool?: AppState["activeTool"]) => void;
|
|
28
|
+
/** clears the inline cursor so the environment default (CSS) applies */
|
|
29
|
+
private clear;
|
|
30
|
+
private applyEraser;
|
|
31
|
+
}
|