@excalidraw/element 0.18.0-0457ac9 → 0.18.0-063e025
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 +1305 -895
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +18 -18
- package/dist/types/common/src/colors.d.ts +1 -1
- package/dist/types/common/src/constants.d.ts +9 -7
- package/dist/types/common/src/utils.d.ts +0 -42
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/align.d.ts +2 -2
- package/dist/types/element/src/binding.d.ts +6 -6
- package/dist/types/element/src/bounds.d.ts +19 -6
- package/dist/types/element/src/collision.d.ts +1 -1
- package/dist/types/element/src/comparisons.d.ts +1 -0
- package/dist/types/element/src/distribute.d.ts +2 -2
- package/dist/types/element/src/duplicate.d.ts +3 -3
- package/dist/types/element/src/embeddable.d.ts +2 -2
- package/dist/types/element/src/flowchart.d.ts +3 -3
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +4 -4
- package/dist/types/element/src/groups.d.ts +9 -9
- package/dist/types/element/src/index.d.ts +1 -1
- package/dist/types/element/src/linearElementEditor.d.ts +10 -10
- package/dist/types/element/src/newElement.d.ts +1 -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 +5 -5
- package/dist/types/element/src/textElement.d.ts +7 -7
- package/dist/types/element/src/transform.d.ts +2 -2
- package/dist/types/element/src/typeChecks.d.ts +25 -25
- package/dist/types/element/src/types.d.ts +8 -1
- package/dist/types/element/src/visualdebug.d.ts +1 -2
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +8 -4
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +61 -389
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +8 -4
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +4 -2
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +13 -7
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +4 -2
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +4 -2
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +9 -5
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +4 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +8 -4
- package/dist/types/excalidraw/actions/actionFrame.d.ts +29 -20
- package/dist/types/excalidraw/actions/actionGroup.d.ts +23 -19
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +7 -4
- package/dist/types/excalidraw/actions/actionLink.d.ts +5 -3
- package/dist/types/excalidraw/actions/actionMenu.d.ts +4 -2
- package/dist/types/excalidraw/actions/actionProperties.d.ts +35 -22
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +9 -7
- package/dist/types/excalidraw/actions/actionStyles.d.ts +4 -2
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +5 -3
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +8 -7
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +5 -3
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -3
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +8 -7
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +5 -3
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +5 -3
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +5 -3
- package/dist/types/excalidraw/actions/index.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +4 -4
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +2 -1
- package/dist/types/excalidraw/components/Actions.d.ts +2 -3
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.d.ts +61 -32
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +2 -2
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -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/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- 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/hyperlink/helpers.d.ts +2 -2
- package/dist/types/excalidraw/components/icons.d.ts +2 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +6 -3
- package/dist/types/excalidraw/data/blob.d.ts +8 -4
- package/dist/types/excalidraw/data/index.d.ts +4 -4
- package/dist/types/excalidraw/data/json.d.ts +10 -8
- package/dist/types/excalidraw/data/library.d.ts +1 -1
- 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 +12 -11
- 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 +1 -3
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/types.d.ts +168 -11
- package/dist/types/excalidraw/viewport.d.ts +316 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -3
- 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 +35 -0
- package/dist/types/utils/src/export.d.ts +3 -3
- package/dist/types/utils/src/index.d.ts +1 -2
- package/package.json +4 -4
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const applyDarkModeFilter: (color: string) => string;
|
|
1
|
+
export declare const applyDarkModeFilter: (color: string, enable?: boolean) => string;
|
|
2
2
|
export type ColorTuple = readonly [string, string, string, string, string];
|
|
3
3
|
export type ColorPaletteCustom = {
|
|
4
4
|
[key: string]: ColorTuple | string;
|
|
@@ -240,8 +240,7 @@ export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
|
|
|
240
240
|
export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
241
241
|
export declare const EXPORT_SCALES: number[];
|
|
242
242
|
export declare const DEFAULT_EXPORT_PADDING = 10;
|
|
243
|
-
export declare const
|
|
244
|
-
export declare const MAX_ALLOWED_FILE_BYTES: number;
|
|
243
|
+
export declare const DEFAULT_IMAGE_OPTIONS: AppProps["imageOptions"];
|
|
245
244
|
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
246
245
|
export declare const SVG_DOCUMENT_PREAMBLE = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
|
|
247
246
|
export declare const ENCRYPTION_KEY_BITS = 128;
|
|
@@ -275,11 +274,12 @@ export declare const ROUGHNESS: {
|
|
|
275
274
|
readonly artist: 1;
|
|
276
275
|
readonly cartoonist: 2;
|
|
277
276
|
};
|
|
278
|
-
export
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
277
|
+
export type StrokeWidthKey = "thin" | "medium" | "bold";
|
|
278
|
+
export declare const STROKE_WIDTH_KEYS: readonly StrokeWidthKey[];
|
|
279
|
+
export declare const STROKE_WIDTH: Readonly<Record<StrokeWidthKey | "extraBold", ExcalidrawElement["strokeWidth"]>>;
|
|
280
|
+
export declare const FREEDRAW_STROKE_WIDTH: Readonly<Record<StrokeWidthKey | "extraBold", ExcalidrawElement["strokeWidth"]>>;
|
|
281
|
+
export declare const getStrokeWidthByKey: (elementType: ExcalidrawElement["type"], strokeWidthKey: StrokeWidthKey) => ExcalidrawElement["strokeWidth"];
|
|
282
|
+
export declare const DEFAULT_ELEMENT_STROKE_WIDTH_KEY: StrokeWidthKey;
|
|
283
283
|
export declare const DEFAULT_ELEMENT_PROPS: {
|
|
284
284
|
strokeColor: ExcalidrawElement["strokeColor"];
|
|
285
285
|
backgroundColor: ExcalidrawElement["backgroundColor"];
|
|
@@ -353,3 +353,5 @@ export declare const BIND_MODE_TIMEOUT = 700;
|
|
|
353
353
|
export declare const MOBILE_ACTION_BUTTON_BG: {
|
|
354
354
|
readonly background: "var(--mobile-action-button-bg)";
|
|
355
355
|
};
|
|
356
|
+
export declare const DEFAULT_STROKE_STREAMLINE = 0.5;
|
|
357
|
+
export declare const DEFAULT_STROKE_STREAMLINE_PRECISE = 0.2;
|
|
@@ -37,48 +37,6 @@ export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void) =>
|
|
|
37
37
|
* @returns {number} The tweened value.
|
|
38
38
|
*/
|
|
39
39
|
export declare const easeOut: (k: number) => number;
|
|
40
|
-
/**
|
|
41
|
-
* Animates values from `fromValues` to `toValues` using the requestAnimationFrame API.
|
|
42
|
-
* Executes the `onStep` callback on each step with the interpolated values.
|
|
43
|
-
* Returns a function that can be called to cancel the animation.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* // Example usage:
|
|
47
|
-
* const fromValues = { x: 0, y: 0 };
|
|
48
|
-
* const toValues = { x: 100, y: 200 };
|
|
49
|
-
* const onStep = ({x, y}) => {
|
|
50
|
-
* setState(x, y)
|
|
51
|
-
* };
|
|
52
|
-
* const onCancel = () => {
|
|
53
|
-
* console.log("Animation canceled");
|
|
54
|
-
* };
|
|
55
|
-
*
|
|
56
|
-
* const cancelAnimation = easeToValuesRAF({
|
|
57
|
-
* fromValues,
|
|
58
|
-
* toValues,
|
|
59
|
-
* onStep,
|
|
60
|
-
* onCancel,
|
|
61
|
-
* });
|
|
62
|
-
*
|
|
63
|
-
* // To cancel the animation:
|
|
64
|
-
* cancelAnimation();
|
|
65
|
-
*/
|
|
66
|
-
export declare const easeToValuesRAF: <T extends Record<keyof T, number>, K extends keyof T>({ fromValues, toValues, onStep, duration, interpolateValue, onStart, onEnd, onCancel, }: {
|
|
67
|
-
fromValues: T;
|
|
68
|
-
toValues: T;
|
|
69
|
-
/**
|
|
70
|
-
* Interpolate a single value.
|
|
71
|
-
* Return undefined to be handled by the default interpolator.
|
|
72
|
-
*/
|
|
73
|
-
interpolateValue?: (fromValue: number, toValue: number,
|
|
74
|
-
/** no easing applied */
|
|
75
|
-
progress: number, key: K) => number | undefined;
|
|
76
|
-
onStep: (values: T) => void;
|
|
77
|
-
duration?: number;
|
|
78
|
-
onStart?: () => void;
|
|
79
|
-
onEnd?: () => void;
|
|
80
|
-
onCancel?: () => void;
|
|
81
|
-
}) => () => void;
|
|
82
40
|
export declare const chunk: <T extends any>(array: readonly T[], size: number) => T[][];
|
|
83
41
|
export declare const selectNode: (node: Element) => void;
|
|
84
42
|
export declare const removeSelection: () => void;
|
|
@@ -40,7 +40,7 @@ export declare class Scene {
|
|
|
40
40
|
elements?: ElementsMapOrArray;
|
|
41
41
|
includeBoundTextElement?: boolean;
|
|
42
42
|
includeElementsInFrames?: boolean;
|
|
43
|
-
}):
|
|
43
|
+
}): NonDeletedExcalidrawElement[];
|
|
44
44
|
getNonDeletedFramesLikes(): readonly NonDeleted<ExcalidrawFrameLikeElement>[];
|
|
45
45
|
getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
|
|
46
46
|
getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
2
2
|
import type { Scene } from "./Scene";
|
|
3
|
-
import type {
|
|
3
|
+
import type { NonDeletedExcalidrawElement } from "./types";
|
|
4
4
|
export interface Alignment {
|
|
5
5
|
position: "start" | "center" | "end";
|
|
6
6
|
axis: "x" | "y";
|
|
7
7
|
}
|
|
8
|
-
export declare const alignElements: (selectedElements:
|
|
8
|
+
export declare const alignElements: (selectedElements: NonDeletedExcalidrawElement[], alignment: Alignment, scene: Scene, appState: Readonly<AppState>) => NonDeletedExcalidrawElement[];
|
|
@@ -54,14 +54,14 @@ export declare const getBindingStrategyForDraggingBindingElementEndpoints: (arro
|
|
|
54
54
|
end: BindingStrategy;
|
|
55
55
|
};
|
|
56
56
|
export declare const bindOrUnbindBindingElements: (selectedArrows: NonDeleted<ExcalidrawArrowElement>[], scene: Scene, appState: AppState) => void;
|
|
57
|
-
export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement
|
|
58
|
-
export declare const unbindBindingElement: (arrow:
|
|
57
|
+
export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint, shouldSnapToOutline?: boolean) => void;
|
|
58
|
+
export declare const unbindBindingElement: (arrow: ExcalidrawArrowElement, startOrEnd: "start" | "end", scene: Scene) => ExcalidrawBindableElement["id"] | null;
|
|
59
59
|
export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
|
|
60
|
-
simultaneouslyUpdated?: readonly
|
|
60
|
+
simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
|
|
61
61
|
changedElements?: Map<string, ExcalidrawElement>;
|
|
62
62
|
}) => void;
|
|
63
|
-
export declare const updateBindings: (latestElement:
|
|
64
|
-
simultaneouslyUpdated?: readonly
|
|
63
|
+
export declare const updateBindings: (latestElement: NonDeletedExcalidrawElement, scene: Scene, appState: AppState, options?: {
|
|
64
|
+
simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
|
|
65
65
|
newSize?: {
|
|
66
66
|
width: number;
|
|
67
67
|
height: number;
|
|
@@ -75,7 +75,7 @@ export declare const updateBoundPoint: (arrow: NonDeleted<ExcalidrawArrowElement
|
|
|
75
75
|
export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, shouldSnapToOutline?: boolean, isMidpointSnappingEnabled?: boolean) => {
|
|
76
76
|
fixedPoint: FixedPoint;
|
|
77
77
|
};
|
|
78
|
-
export declare const calculateFixedPointForNonElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement
|
|
78
|
+
export declare const calculateFixedPointForNonElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, startOrEnd: "start" | "end", elementsMap: ElementsMap, focusPoint?: GlobalPoint) => {
|
|
79
79
|
fixedPoint: FixedPoint;
|
|
80
80
|
};
|
|
81
81
|
export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
|
|
@@ -2,7 +2,7 @@ import { type Bounds } from "@excalidraw/common";
|
|
|
2
2
|
import type { Degrees, GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
|
|
3
3
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
4
4
|
import type { Drawable, Op } from "roughjs/bin/core";
|
|
5
|
-
import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawLinearElement, NonDeleted } from "./types";
|
|
5
|
+
import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, NonDeletedExcalidrawElement } from "./types";
|
|
6
6
|
export type RectangleBox = {
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
@@ -46,16 +46,12 @@ export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
|
|
|
46
46
|
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead, offsetMultiplier?: number) => number[] | null;
|
|
47
47
|
export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean) => Bounds;
|
|
48
48
|
export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
|
|
49
|
-
export declare const getDraggedElementsBounds: (elements:
|
|
49
|
+
export declare const getDraggedElementsBounds: (elements: readonly NonDeletedExcalidrawElement[], dragOffset: {
|
|
50
50
|
x: number;
|
|
51
51
|
y: number;
|
|
52
52
|
}) => number[];
|
|
53
53
|
export declare const getResizedElementAbsoluteCoords: (element: ExcalidrawElement, nextWidth: number, nextHeight: number, normalizePoints: boolean) => Bounds;
|
|
54
54
|
export declare const getElementPointsCoords: (element: ExcalidrawLinearElement, points: readonly (readonly [number, number])[]) => Bounds;
|
|
55
|
-
export declare const getClosestElementBounds: (elements: readonly ExcalidrawElement[], from: {
|
|
56
|
-
x: number;
|
|
57
|
-
y: number;
|
|
58
|
-
}) => Bounds;
|
|
59
55
|
export interface BoundingBox {
|
|
60
56
|
minX: number;
|
|
61
57
|
minY: number;
|
|
@@ -80,4 +76,21 @@ export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p:
|
|
|
80
76
|
export declare const pointInsideBoundsInclusive: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
|
|
81
77
|
export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
|
|
82
78
|
export declare const boundsContainBounds: (outerBounds: Bounds, innerBounds: Bounds) => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* High level helper to get elements overlapping a bounding box.
|
|
81
|
+
* It can be used to get elements overlapping a selection box, for example.
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
export declare const elementsOverlappingBBox: <T extends ExcalidrawElement>({ elements, elementsMap, bounds, type, excludeElementsInFrames, shouldIgnoreElementFromSelection, }: {
|
|
85
|
+
elements: readonly T[];
|
|
86
|
+
elementsMap?: ElementsMap;
|
|
87
|
+
bounds: Bounds | ExcalidrawElement;
|
|
88
|
+
/**
|
|
89
|
+
* - overlap: elements overlapping or inside bounds
|
|
90
|
+
* - contain: elements inside bounds
|
|
91
|
+
**/
|
|
92
|
+
type: "contain" | "overlap";
|
|
93
|
+
excludeElementsInFrames?: boolean;
|
|
94
|
+
shouldIgnoreElementFromSelection?: (element: T) => boolean;
|
|
95
|
+
}) => T[];
|
|
83
96
|
export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMap: ElementsMap, xOffset?: number, yOffset?: number) => GlobalPoint;
|
|
@@ -16,7 +16,7 @@ export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsM
|
|
|
16
16
|
export declare const hitElementBoundText: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
|
|
17
17
|
export declare const getAllHoveredElementAtPoint: (point: Readonly<GlobalPoint>, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, tolerance?: number) => NonDeleted<ExcalidrawBindableElement>[];
|
|
18
18
|
export declare const getHoveredElementForBinding: (point: Readonly<GlobalPoint>, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, tolerance?: number) => NonDeleted<ExcalidrawBindableElement> | null;
|
|
19
|
-
export declare const getHoveredElementForFocusPoint: (point: GlobalPoint, arrow: ExcalidrawArrowElement, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, tolerance?: number) => ExcalidrawBindableElement | null;
|
|
19
|
+
export declare const getHoveredElementForFocusPoint: (point: GlobalPoint, arrow: ExcalidrawArrowElement, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, tolerance?: number) => NonDeleted<ExcalidrawBindableElement> | null;
|
|
20
20
|
/**
|
|
21
21
|
* Intersect a line with an element for binding test
|
|
22
22
|
*
|
|
@@ -3,6 +3,7 @@ export declare const hasBackground: (type: ElementOrToolType) => type is "line"
|
|
|
3
3
|
export declare const hasStrokeColor: (type: ElementOrToolType) => type is "line" | "arrow" | "text" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "freedraw";
|
|
4
4
|
export declare const hasStrokeWidth: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw";
|
|
5
5
|
export declare const hasStrokeStyle: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe";
|
|
6
|
+
export declare const hasFreedrawMode: (type: ElementOrToolType) => type is "freedraw";
|
|
6
7
|
export declare const canChangeRoundness: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "embeddable" | "iframe" | "image";
|
|
7
8
|
export declare const toolIsArrow: (type: ElementOrToolType) => type is "arrow";
|
|
8
9
|
export declare const canHaveArrowheads: (type: ElementOrToolType) => type is "arrow";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
2
2
|
import type { Scene } from "./Scene";
|
|
3
|
-
import type { ElementsMap,
|
|
3
|
+
import type { ElementsMap, NonDeletedExcalidrawElement } from "./types";
|
|
4
4
|
export interface Distribution {
|
|
5
5
|
space: "between";
|
|
6
6
|
axis: "x" | "y";
|
|
7
7
|
}
|
|
8
|
-
export declare const distributeElements: (selectedElements:
|
|
8
|
+
export declare const distributeElements: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, distribution: Distribution, appState: Readonly<AppState>, scene: Scene) => NonDeletedExcalidrawElement[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
2
2
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
3
|
-
import type { ExcalidrawElement, GroupId } from "./types";
|
|
3
|
+
import type { ExcalidrawElement, GroupId, NonDeletedExcalidrawElement } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Duplicate an element, often used in the alt-drag operation.
|
|
6
6
|
* Note that this method has gotten a bit complicated since the
|
|
@@ -47,8 +47,8 @@ export declare const duplicateElements: (opts: {
|
|
|
47
47
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
48
48
|
};
|
|
49
49
|
})) => {
|
|
50
|
-
duplicatedElements:
|
|
51
|
-
duplicateElementsMap: Map<string,
|
|
50
|
+
duplicatedElements: NonDeletedExcalidrawElement[];
|
|
51
|
+
duplicateElementsMap: Map<string, NonDeletedExcalidrawElement>;
|
|
52
52
|
elementsWithDuplicates: ExcalidrawElement[];
|
|
53
53
|
origIdToDuplicateId: Map<string, string>;
|
|
54
54
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ExcalidrawProps } from "@excalidraw/excalidraw/types";
|
|
2
2
|
import type { MarkRequired } from "@excalidraw/common/utility-types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ExcalidrawIframeLikeElement, IframeData, NonDeletedExcalidrawElement } from "./types";
|
|
4
4
|
type IframeDataWithSandbox = MarkRequired<IframeData, "sandbox">;
|
|
5
5
|
export declare const createSrcDoc: (body: string) => string;
|
|
6
6
|
export declare const getEmbedLink: (link: string | null | undefined) => IframeDataWithSandbox | null;
|
|
7
|
-
export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawIframeLikeElement) =>
|
|
7
|
+
export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawIframeLikeElement) => NonDeletedExcalidrawElement;
|
|
8
8
|
export declare const maybeParseEmbedSrc: (str: string) => string;
|
|
9
9
|
export declare const embeddableURLValidator: (url: string | null | undefined, validateEmbeddable: ExcalidrawProps["validateEmbeddable"]) => boolean;
|
|
10
10
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AppState, PendingExcalidrawElements } from "@excalidraw/excalidraw/types";
|
|
2
|
-
import { type ElementsMap, type ExcalidrawBindableElement, type ExcalidrawElement, type ExcalidrawFlowchartNodeElement } from "./types";
|
|
2
|
+
import { type NonDeleted, type ElementsMap, type ExcalidrawBindableElement, type ExcalidrawElement, type ExcalidrawFlowchartNodeElement, type NonDeletedExcalidrawElement } from "./types";
|
|
3
3
|
import type { Scene } from "./Scene";
|
|
4
4
|
type LinkDirection = "up" | "right" | "down" | "left";
|
|
5
5
|
export declare const getLinkDirectionFromKey: (key: string) => LinkDirection;
|
|
6
6
|
export declare const getPredecessors: (node: ExcalidrawBindableElement, elementsMap: ElementsMap, direction: LinkDirection) => ExcalidrawBindableElement[];
|
|
7
|
-
export declare const addNewNodes: (startNode: ExcalidrawFlowchartNodeElement
|
|
7
|
+
export declare const addNewNodes: (startNode: NonDeleted<ExcalidrawFlowchartNodeElement>, appState: AppState, direction: LinkDirection, scene: Scene, numberOfNodes: number) => NonDeletedExcalidrawElement[];
|
|
8
8
|
export declare class FlowChartNavigator {
|
|
9
9
|
isExploring: boolean;
|
|
10
10
|
private sameLevelNodes;
|
|
@@ -19,7 +19,7 @@ export declare class FlowChartCreator {
|
|
|
19
19
|
private numberOfNodes;
|
|
20
20
|
private direction;
|
|
21
21
|
pendingNodes: PendingExcalidrawElements | null;
|
|
22
|
-
createNodes(startNode: ExcalidrawFlowchartNodeElement
|
|
22
|
+
createNodes(startNode: NonDeleted<ExcalidrawFlowchartNodeElement>, appState: AppState, direction: LinkDirection, scene: Scene): void;
|
|
23
23
|
clear(): void;
|
|
24
24
|
}
|
|
25
25
|
export declare const isNodeInFlowchart: (element: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ElementsMap, ExcalidrawElement, OrderedExcalidrawElement, SceneElementsMap } from "./types";
|
|
1
|
+
import type { ElementsMap, ExcalidrawElement, Ordered, OrderedExcalidrawElement, SceneElementsMap } from "./types";
|
|
2
2
|
export declare class InvalidFractionalIndexError extends Error {
|
|
3
3
|
code: "ELEMENT_HAS_INVALID_INDEX";
|
|
4
4
|
}
|
|
@@ -48,7 +48,7 @@ export declare const syncMovedIndices: (elements: readonly ExcalidrawElement[],
|
|
|
48
48
|
*
|
|
49
49
|
* WARN: in edge cases it could modify the elements which were not moved, as it's impossible to guess the actually moved elements from the elements array itself.
|
|
50
50
|
*/
|
|
51
|
-
export declare const syncInvalidIndices: (elements: readonly
|
|
51
|
+
export declare const syncInvalidIndices: <T extends ExcalidrawElement>(elements: readonly T[]) => Ordered<T>[];
|
|
52
52
|
/**
|
|
53
53
|
* Synchronizes all invalid fractional indices within the array order by creating new instances of elements with corrected indices.
|
|
54
54
|
*
|
|
@@ -29,7 +29,7 @@ export declare const getFrameLikeElements: (allElements: ExcalidrawElementsInclu
|
|
|
29
29
|
*
|
|
30
30
|
* Considers non-frame bound elements (container or arrow labels) as root.
|
|
31
31
|
*/
|
|
32
|
-
export declare const getRootElements: (allElements:
|
|
32
|
+
export declare const getRootElements: <T extends ExcalidrawElement>(allElements: readonly T[]) => T[];
|
|
33
33
|
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, appState: AppState, elementsMap: ElementsMap) => ExcalidrawElement[];
|
|
34
34
|
export declare const getElementsInNewFrame: (elements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => (import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawFreeDrawElement)[];
|
|
35
35
|
export declare const omitPartialGroups: (elements: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, allElementsMap: ElementsMap) => (import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawFreeDrawElement)[];
|
|
@@ -44,8 +44,8 @@ export declare const getFrameChildrenInsertionIndex: (elements: readonly Excalid
|
|
|
44
44
|
*
|
|
45
45
|
* @returns mutated allElements (same data structure)
|
|
46
46
|
*/
|
|
47
|
-
export declare const addElementsToFrame: <T extends ElementsMapOrArray>(allElements: T, elementsToAdd:
|
|
48
|
-
export declare const removeElementsFromFrame: (elementsToRemove: ReadonlySetLike<
|
|
47
|
+
export declare const addElementsToFrame: <T extends ElementsMapOrArray>(allElements: T, elementsToAdd: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => T;
|
|
48
|
+
export declare const removeElementsFromFrame: (elementsToRemove: ReadonlySetLike<ExcalidrawElement>, elementsMap: ElementsMap) => void;
|
|
49
49
|
export declare const removeAllElementsFromFrame: <T extends ExcalidrawElement>(allElements: readonly T[], frame: ExcalidrawFrameLikeElement) => readonly T[];
|
|
50
50
|
export declare const replaceAllElementsInFrame: <T extends ExcalidrawElement>(allElements: readonly T[], nextElementsInFrame: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => T[];
|
|
51
51
|
/** does not mutate elements, but returns new ones */
|
|
@@ -71,5 +71,5 @@ export declare const isElementInFrame: (element: ExcalidrawElement, allElementsM
|
|
|
71
71
|
export declare const shouldApplyFrameClip: (element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, appState: StaticCanvasAppState, elementsMap: ElementsMap, checkedGroups?: Map<string, boolean>) => boolean;
|
|
72
72
|
export declare const getDefaultFrameName: (element: ExcalidrawFrameLikeElement) => "Frame" | "AI Frame";
|
|
73
73
|
export declare const getFrameLikeTitle: (element: ExcalidrawFrameLikeElement) => string;
|
|
74
|
-
export declare const getElementsOverlappingFrame: (elements: readonly
|
|
74
|
+
export declare const getElementsOverlappingFrame: <T extends ExcalidrawElement>(elements: readonly T[], frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => T[];
|
|
75
75
|
export declare const frameAndChildrenSelectedTogether: (selectedElements: readonly ExcalidrawElement[]) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AppClassProperties, AppState, InteractiveCanvasAppState } from "@excalidraw/excalidraw/types";
|
|
2
2
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
3
|
-
import type { GroupId, ExcalidrawElement, NonDeleted,
|
|
4
|
-
export declare const selectGroup: (groupId: GroupId, appState: InteractiveCanvasAppState, elements: readonly
|
|
3
|
+
import type { GroupId, ExcalidrawElement, NonDeleted, ElementsMapOrArray, ElementsMap, NonDeletedExcalidrawElement, NonDeletedElementsMapOrArray } from "./types";
|
|
4
|
+
export declare const selectGroup: (groupId: GroupId, appState: InteractiveCanvasAppState, elements: readonly NonDeletedExcalidrawElement[]) => Pick<InteractiveCanvasAppState, "selectedGroupIds" | "selectedElementIds" | "editingGroupId">;
|
|
5
5
|
export declare const selectGroupsForSelectedElements: {
|
|
6
6
|
(appState: Pick<AppState, "selectedElementIds" | "editingGroupId">, elements: readonly NonDeletedExcalidrawElement[], prevAppState: InteractiveCanvasAppState, app: AppClassProperties | null): Mutable<Pick<InteractiveCanvasAppState, "selectedGroupIds" | "editingGroupId" | "selectedElementIds">>;
|
|
7
7
|
clearCache(): void;
|
|
@@ -10,15 +10,15 @@ export declare const selectGroupsForSelectedElements: {
|
|
|
10
10
|
* If the element's group is selected, don't render an individual
|
|
11
11
|
* selection border around it.
|
|
12
12
|
*/
|
|
13
|
-
export declare const isSelectedViaGroup: (appState: InteractiveCanvasAppState, element: ExcalidrawElement) => boolean;
|
|
13
|
+
export declare const isSelectedViaGroup: (appState: Pick<InteractiveCanvasAppState, "editingGroupId" | "selectedGroupIds">, element: ExcalidrawElement) => boolean;
|
|
14
14
|
export declare const getSelectedGroupForElement: (appState: Pick<InteractiveCanvasAppState, "editingGroupId" | "selectedGroupIds">, element: ExcalidrawElement) => string | undefined;
|
|
15
|
-
export declare const getSelectedGroupIds: (appState: InteractiveCanvasAppState) => GroupId[];
|
|
16
|
-
export declare const selectGroupsFromGivenElements: (elements: readonly
|
|
15
|
+
export declare const getSelectedGroupIds: (appState: Pick<InteractiveCanvasAppState, "selectedGroupIds">) => GroupId[];
|
|
16
|
+
export declare const selectGroupsFromGivenElements: (elements: readonly NonDeletedExcalidrawElement[], appState: InteractiveCanvasAppState) => {
|
|
17
17
|
[groupId: string]: boolean;
|
|
18
18
|
};
|
|
19
19
|
export declare const editGroupForSelectedElement: (appState: AppState, element: NonDeleted<ExcalidrawElement>) => AppState;
|
|
20
20
|
export declare const isElementInGroup: (element: ExcalidrawElement, groupId: string) => boolean;
|
|
21
|
-
export declare const getElementsInGroup: (elements: ElementsMapOrArray, groupId: string) =>
|
|
21
|
+
export declare const getElementsInGroup: <P extends NonDeletedExcalidrawElement | ExcalidrawElement>(elements: P extends NonDeletedExcalidrawElement ? NonDeletedElementsMapOrArray : ElementsMapOrArray, groupId: string) => P[];
|
|
22
22
|
export declare const getSelectedGroupIdForElement: (element: ExcalidrawElement, selectedGroupIds: {
|
|
23
23
|
[groupId: string]: boolean;
|
|
24
24
|
}) => string | undefined;
|
|
@@ -26,9 +26,9 @@ export declare const addToGroup: (prevGroupIds: ExcalidrawElement["groupIds"], n
|
|
|
26
26
|
export declare const removeFromSelectedGroups: (groupIds: ExcalidrawElement["groupIds"], selectedGroupIds: {
|
|
27
27
|
[groupId: string]: boolean;
|
|
28
28
|
}) => string[];
|
|
29
|
-
export declare const getMaximumGroups: (elements:
|
|
29
|
+
export declare const getMaximumGroups: <T extends NonDeletedExcalidrawElement | ExcalidrawElement>(elements: T[], elementsMap: ElementsMap) => T[][];
|
|
30
30
|
export declare const getNonDeletedGroupIds: (elements: ElementsMap) => Set<string>;
|
|
31
31
|
export declare const elementsAreInSameGroup: (elements: readonly ExcalidrawElement[]) => boolean;
|
|
32
|
-
export declare const isInGroup: (element:
|
|
32
|
+
export declare const isInGroup: (element: ExcalidrawElement) => boolean;
|
|
33
33
|
export declare const getNewGroupIdsForDuplication: (groupIds: ExcalidrawElement["groupIds"], editingGroupId: AppState["editingGroupId"], mapper: (groupId: GroupId) => GroupId) => string[];
|
|
34
|
-
export declare const getSelectedElementsByGroup: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, appState: Readonly<AppState
|
|
34
|
+
export declare const getSelectedElementsByGroup: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, appState: Readonly<Pick<AppState, "selectedGroupIds" | "editingGroupId">>) => NonDeletedExcalidrawElement[][];
|
|
@@ -8,9 +8,9 @@ export declare const getSceneVersion: (elements: readonly ExcalidrawElement[]) =
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const hashElementsVersion: (elements: ElementsMapOrArray) => number;
|
|
10
10
|
export declare const hashString: (s: string) => number;
|
|
11
|
+
export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element: T) => element is NonDeleted<T>;
|
|
11
12
|
export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
|
|
12
13
|
export declare const getNonDeletedElements: <T extends ExcalidrawElement>(elements: readonly T[]) => readonly NonDeleted<T>[];
|
|
13
|
-
export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element: T) => element is NonDeleted<T>;
|
|
14
14
|
export * from "./align";
|
|
15
15
|
export * from "./binding";
|
|
16
16
|
export * from "./bounds";
|
|
@@ -45,18 +45,18 @@ export declare class LinearElementEditor {
|
|
|
45
45
|
* @param id the `elementId` from the instance of this class (so that we can
|
|
46
46
|
* statically guarantee this method returns an ExcalidrawLinearElement)
|
|
47
47
|
*/
|
|
48
|
-
static getElement<T extends ExcalidrawLinearElement>(id: InstanceType<typeof LinearElementEditor>["elementId"], elementsMap: ElementsMap): T | null;
|
|
48
|
+
static getElement<T extends ExcalidrawLinearElement>(id: InstanceType<typeof LinearElementEditor>["elementId"], elementsMap: ElementsMap): NonDeleted<T> | null;
|
|
49
49
|
static handleBoxSelection(event: PointerEvent, appState: AppState, setState: React.Component<any, AppState>["setState"], elementsMap: NonDeletedSceneElementsMap): false | undefined;
|
|
50
50
|
static handlePointerMove(event: PointerEvent, app: AppClassProperties, scenePointerX: number, scenePointerY: number, linearElementEditor: LinearElementEditor): Pick<AppState, "suggestedBinding" | "selectedLinearElement"> | null;
|
|
51
51
|
static handlePointDragging(event: PointerEvent, app: AppClassProperties, scenePointerX: number, scenePointerY: number, linearElementEditor: LinearElementEditor): Pick<AppState, "suggestedBinding" | "selectedLinearElement"> | null;
|
|
52
52
|
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState, scene: Scene): LinearElementEditor;
|
|
53
|
-
static getEditorMidPoints: (element:
|
|
53
|
+
static getEditorMidPoints: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => (GlobalPoint | null)[];
|
|
54
54
|
static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
|
|
55
55
|
x: number;
|
|
56
56
|
y: number;
|
|
57
57
|
}, appState: AppState, elementsMap: ElementsMap) => GlobalPoint | null;
|
|
58
|
-
static isSegmentTooShort<P extends GlobalPoint | LocalPoint>(element:
|
|
59
|
-
static getSegmentMidPoint(element:
|
|
58
|
+
static isSegmentTooShort<P extends GlobalPoint | LocalPoint>(element: ExcalidrawLinearElement, startPoint: P, endPoint: P, index: number, zoom: Zoom, elementsMap: ElementsMap): boolean;
|
|
59
|
+
static getSegmentMidPoint(element: ExcalidrawLinearElement, index: number, elementsMap: ElementsMap): GlobalPoint;
|
|
60
60
|
static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: GlobalPoint, elementsMap: ElementsMap): number;
|
|
61
61
|
static handlePointerDown(event: React.PointerEvent<HTMLElement>, app: AppClassProperties, store: Store, scenePointer: {
|
|
62
62
|
x: number;
|
|
@@ -69,14 +69,14 @@ export declare class LinearElementEditor {
|
|
|
69
69
|
static arePointsEqual<Point extends LocalPoint | GlobalPoint>(point1: Point | null, point2: Point | null): boolean;
|
|
70
70
|
static handlePointerMoveInEditMode(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, app: AppClassProperties): LinearElementEditor | null;
|
|
71
71
|
/** scene coords */
|
|
72
|
-
static getPointGlobalCoordinates(element:
|
|
72
|
+
static getPointGlobalCoordinates(element: ExcalidrawLinearElement, p: LocalPoint, elementsMap: ElementsMap): GlobalPoint;
|
|
73
73
|
/** scene coords */
|
|
74
|
-
static getPointsGlobalCoordinates(element:
|
|
75
|
-
static getPointAtIndexGlobalCoordinates(element:
|
|
74
|
+
static getPointsGlobalCoordinates(element: ExcalidrawLinearElement, elementsMap: ElementsMap): GlobalPoint[];
|
|
75
|
+
static getPointAtIndexGlobalCoordinates(element: ExcalidrawLinearElement, indexMaybeFromEnd: number, // -1 for last element
|
|
76
76
|
elementsMap: ElementsMap): GlobalPoint;
|
|
77
|
-
static pointFromAbsoluteCoords(element:
|
|
78
|
-
static getPointIndexUnderCursor(element:
|
|
79
|
-
static createPointAt(element:
|
|
77
|
+
static pointFromAbsoluteCoords(element: ExcalidrawLinearElement, absoluteCoords: GlobalPoint, elementsMap: ElementsMap): LocalPoint;
|
|
78
|
+
static getPointIndexUnderCursor(element: ExcalidrawLinearElement, elementsMap: ElementsMap, zoom: AppState["zoom"], x: number, y: number): number;
|
|
79
|
+
static createPointAt(element: ExcalidrawLinearElement, elementsMap: ElementsMap, scenePointerX: number, scenePointerY: number, gridSize: NullableGridSize): LocalPoint;
|
|
80
80
|
/**
|
|
81
81
|
* Normalizes line points so that the start point is at [0,0]. This is
|
|
82
82
|
* expected in various parts of the codebase.
|
|
@@ -38,6 +38,7 @@ export declare const newFreeDrawElement: (opts: {
|
|
|
38
38
|
type: "freedraw";
|
|
39
39
|
points?: ExcalidrawFreeDrawElement["points"];
|
|
40
40
|
simulatePressure: boolean;
|
|
41
|
+
strokeOptions?: ExcalidrawFreeDrawElement["strokeOptions"];
|
|
41
42
|
pressures?: ExcalidrawFreeDrawElement["pressures"];
|
|
42
43
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawFreeDrawElement>;
|
|
43
44
|
export declare const newLinearElement: (opts: {
|
|
@@ -9,14 +9,11 @@ export interface ExcalidrawElementWithCanvas {
|
|
|
9
9
|
canvas: HTMLCanvasElement;
|
|
10
10
|
theme: AppState["theme"];
|
|
11
11
|
scale: number;
|
|
12
|
-
angle: number;
|
|
13
12
|
zoomValue: AppState["zoom"]["value"];
|
|
14
13
|
canvasOffsetX: number;
|
|
15
14
|
canvasOffsetY: number;
|
|
16
|
-
boundTextElementVersion: number | null;
|
|
17
15
|
imageCrop: ExcalidrawImageElement["crop"] | null;
|
|
18
16
|
containingFrameOpacity: number;
|
|
19
|
-
boundTextCanvas: HTMLCanvasElement;
|
|
20
17
|
}
|
|
21
18
|
export declare const DEFAULT_LINK_SIZE = 14;
|
|
22
19
|
export declare const elementWithCanvasCache: WeakMap<ExcalidrawElement, ExcalidrawElementWithCanvas>;
|
|
@@ -3,7 +3,7 @@ import type { PointerDownState } from "@excalidraw/excalidraw/types";
|
|
|
3
3
|
import type { Scene } from "./Scene";
|
|
4
4
|
import type { BoundingBox } from "./bounds";
|
|
5
5
|
import type { MaybeTransformHandleType, TransformHandleDirection } from "./transformHandles";
|
|
6
|
-
import type { ExcalidrawLinearElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, NonDeleted,
|
|
6
|
+
import type { ExcalidrawLinearElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, NonDeleted, ElementsMap } from "./types";
|
|
7
7
|
export declare const transformElements: (originalElements: PointerDownState["originalElements"], transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], scene: Scene, shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
|
|
8
8
|
export declare const rescalePointsInElement: (element: NonDeletedExcalidrawElement, width: number, height: number, normalizePoints: boolean) => {
|
|
9
9
|
points: LocalPoint[];
|
|
@@ -16,7 +16,7 @@ export declare const measureFontSizeFromWidth: (element: NonDeleted<ExcalidrawTe
|
|
|
16
16
|
export declare const resizeSingleTextElement: (origElement: NonDeleted<ExcalidrawTextElement>, element: NonDeleted<ExcalidrawTextElement>, scene: Scene, transformHandleType: TransformHandleDirection, shouldResizeFromCenter: boolean, nextWidth: number, nextHeight: number) => void;
|
|
17
17
|
export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, x: number, y: number) => [number, number];
|
|
18
18
|
export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
|
|
19
|
-
export declare const resizeSingleElement: (nextWidth: number, nextHeight: number, latestElement:
|
|
19
|
+
export declare const resizeSingleElement: (nextWidth: number, nextHeight: number, latestElement: NonDeletedExcalidrawElement, origElement: NonDeletedExcalidrawElement, originalElementsMap: ElementsMap, scene: Scene, handleDirection: TransformHandleDirection, { shouldInformMutation, shouldMaintainAspectRatio, shouldResizeFromCenter, }?: {
|
|
20
20
|
shouldMaintainAspectRatio?: boolean;
|
|
21
21
|
shouldResizeFromCenter?: boolean;
|
|
22
22
|
shouldInformMutation?: boolean;
|
|
@@ -8,8 +8,8 @@ import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, NonDeleted, No
|
|
|
8
8
|
* @param selectedElements
|
|
9
9
|
*/
|
|
10
10
|
export declare const excludeElementsInFramesFromSelection: <T extends ExcalidrawElement>(selectedElements: readonly T[]) => T[];
|
|
11
|
-
export declare const getElementsWithinSelection: (elements: readonly
|
|
12
|
-
export declare const getVisibleAndNonSelectedElements: (elements: readonly
|
|
11
|
+
export declare const getElementsWithinSelection: <T extends ExcalidrawElement>(elements: readonly T[], selection: ExcalidrawElement, elementsMap: ElementsMap, excludeElementsInFrames?: boolean, boxSelectionMode?: BoxSelectionMode) => T[];
|
|
12
|
+
export declare const getVisibleAndNonSelectedElements: <T extends NonDeletedExcalidrawElement>(elements: readonly T[], selectedElements: readonly ExcalidrawElement[], appState: AppState, elementsMap: ElementsMap) => T[];
|
|
13
13
|
export declare const isSomeElementSelected: {
|
|
14
14
|
(elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">): boolean;
|
|
15
15
|
clearCache(): void;
|
|
@@ -17,8 +17,8 @@ export declare const isSomeElementSelected: {
|
|
|
17
17
|
export declare const getSelectedElements: (elements: ElementsMapOrArray, appState: Pick<InteractiveCanvasAppState, "selectedElementIds">, opts?: {
|
|
18
18
|
includeBoundTextElement?: boolean;
|
|
19
19
|
includeElementsInFrames?: boolean;
|
|
20
|
-
}) =>
|
|
21
|
-
export declare const getTargetElements: (elements: ElementsMapOrArray, appState: Pick<AppState, "selectedElementIds" | "editingTextElement" | "newElement">) =>
|
|
20
|
+
}) => NonDeletedExcalidrawElement[];
|
|
21
|
+
export declare const getTargetElements: (elements: ElementsMapOrArray, appState: Pick<AppState, "selectedElementIds" | "editingTextElement" | "newElement">) => NonDeletedExcalidrawElement[] | import("./types").ExcalidrawTextElement[];
|
|
22
22
|
/**
|
|
23
23
|
* returns prevState's selectedElementids if no change from previous, so as to
|
|
24
24
|
* retain reference identity for memoization
|
|
@@ -26,7 +26,7 @@ export declare const getTargetElements: (elements: ElementsMapOrArray, appState:
|
|
|
26
26
|
export declare const makeNextSelectedElementIds: (nextSelectedElementIds: AppState["selectedElementIds"], prevState: Pick<AppState, "selectedElementIds">) => Readonly<{
|
|
27
27
|
[id: string]: true;
|
|
28
28
|
}>;
|
|
29
|
-
export declare const getSelectionStateForElements: (targetElements: readonly
|
|
29
|
+
export declare const getSelectionStateForElements: (targetElements: readonly NonDeletedExcalidrawElement[], allElements: readonly NonDeletedExcalidrawElement[], appState: AppState) => {
|
|
30
30
|
editingGroupId: AppState["editingGroupId"];
|
|
31
31
|
selectedElementIds: AppState["selectedElementIds"];
|
|
32
32
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
@@ -3,21 +3,21 @@ import type { AppState } from "@excalidraw/excalidraw/types";
|
|
|
3
3
|
import type { ExtractSetType } from "@excalidraw/common/utility-types";
|
|
4
4
|
import type { Scene } from "./Scene";
|
|
5
5
|
import type { MaybeTransformHandleType } from "./transformHandles";
|
|
6
|
-
import type { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer,
|
|
6
|
+
import type { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, NonDeleted } from "./types";
|
|
7
7
|
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, scene: Scene) => void;
|
|
8
|
-
export declare const handleBindTextResize: (container:
|
|
8
|
+
export declare const handleBindTextResize: (container: ExcalidrawElement, scene: Scene, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean) => void;
|
|
9
9
|
export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
|
|
10
10
|
x: number;
|
|
11
11
|
y: number;
|
|
12
12
|
};
|
|
13
13
|
export declare const getBoundTextElementId: (container: ExcalidrawElement | null) => string | null;
|
|
14
|
-
export declare const getBoundTextElement: (element: ExcalidrawElement | null, elementsMap: ElementsMap) => ExcalidrawTextElementWithContainer | null;
|
|
15
|
-
export declare const getContainerElement: (element:
|
|
14
|
+
export declare const getBoundTextElement: (element: ExcalidrawElement | null, elementsMap: ElementsMap) => NonDeleted<ExcalidrawTextElementWithContainer> | null;
|
|
15
|
+
export declare const getContainerElement: <T extends ExcalidrawTextElement, R extends ExcalidrawTextContainer>(element: T | null, elementsMap: ElementsMap) => R | null;
|
|
16
16
|
export declare const getContainerCenter: (container: ExcalidrawElement, appState: AppState, elementsMap: ElementsMap) => {
|
|
17
17
|
x: number;
|
|
18
18
|
y: number;
|
|
19
19
|
};
|
|
20
|
-
export declare const getContainerCoords: (container:
|
|
20
|
+
export declare const getContainerCoords: (container: ExcalidrawElement) => {
|
|
21
21
|
x: number;
|
|
22
22
|
y: number;
|
|
23
23
|
};
|
|
@@ -26,8 +26,8 @@ export declare const getBoundTextElementPosition: (container: ExcalidrawElement,
|
|
|
26
26
|
x: number;
|
|
27
27
|
y: number;
|
|
28
28
|
} | undefined;
|
|
29
|
-
export declare const shouldAllowVerticalAlign: (selectedElements:
|
|
30
|
-
export declare const suppportsHorizontalAlign: (selectedElements:
|
|
29
|
+
export declare const shouldAllowVerticalAlign: (selectedElements: readonly ExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
30
|
+
export declare const suppportsHorizontalAlign: (selectedElements: readonly ExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
31
31
|
declare const VALID_CONTAINER_TYPES: Set<string>;
|
|
32
32
|
export declare const isValidTextContainer: (element: {
|
|
33
33
|
type: ExcalidrawElementType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MarkOptional } from "@excalidraw/common/utility-types";
|
|
2
2
|
import { type ElementConstructorOpts } from "./newElement";
|
|
3
|
-
import type { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, TextAlign, VerticalAlign } from "./types";
|
|
3
|
+
import type { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, NonDeletedExcalidrawElement, Ordered, TextAlign, VerticalAlign } from "./types";
|
|
4
4
|
export type ValidLinearElement = {
|
|
5
5
|
type: "arrow" | "line";
|
|
6
6
|
x: number;
|
|
@@ -78,4 +78,4 @@ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, Excal
|
|
|
78
78
|
} & Partial<ExcalidrawMagicFrameElement>);
|
|
79
79
|
export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
|
|
80
80
|
regenerateIds: boolean;
|
|
81
|
-
}) =>
|
|
81
|
+
}) => Ordered<NonDeletedExcalidrawElement>[];
|