@myoc/math 0.19.521 → 0.19.522
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 +261 -92
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +1 -1
- package/dist/types/common/src/colors.d.ts +14 -0
- package/dist/types/common/src/constants.d.ts +3 -0
- 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 -1
- 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/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 +5 -9
- 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 +4 -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 +3 -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 +4 -4
- 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 +13 -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/shape.d.ts +12 -0
- package/dist/types/element/src/sortElements.d.ts +10 -0
- 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 +25 -25
- package/dist/types/element/src/types.d.ts +2 -1
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +24 -8
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +128 -961
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +24 -8
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +38 -13
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +9 -4
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +25 -9
- package/dist/types/excalidraw/actions/actionExport.d.ts +26 -10
- package/dist/types/excalidraw/actions/actionFrame.d.ts +47 -205
- package/dist/types/excalidraw/actions/actionGroup.d.ts +39 -23
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionLink.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionMenu.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionProperties.d.ts +43 -24
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +17 -9
- package/dist/types/excalidraw/actions/actionStyles.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +14 -6
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -9
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -9
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +14 -6
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +13 -5
- 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 +8 -4
- package/dist/types/excalidraw/appState.d.ts +10 -5
- package/dist/types/excalidraw/components/Actions.d.ts +17 -12
- package/dist/types/excalidraw/components/App.arrowText.d.ts +72 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +30 -0
- package/dist/types/excalidraw/components/App.d.ts +384 -60
- 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 +9 -3
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +3 -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/keyboardNavHandlers.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +31 -0
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- 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 +5 -2
- package/dist/types/excalidraw/components/LockButton.d.ts +9 -0
- 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/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/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/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/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 +4 -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/context/tunnels.d.ts +0 -1
- package/dist/types/excalidraw/data/blob.d.ts +14 -6
- package/dist/types/excalidraw/data/index.d.ts +4 -4
- package/dist/types/excalidraw/data/json.d.ts +20 -12
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +10 -3
- package/dist/types/excalidraw/scene/Renderer.d.ts +11 -11
- package/dist/types/excalidraw/scene/export.d.ts +3 -3
- package/dist/types/excalidraw/scene/index.d.ts +1 -1
- 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 +423 -27
- package/dist/types/excalidraw/viewport.d.ts +283 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -3
- package/dist/types/laser-pointer/src/state.d.ts +1 -0
- 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/utils/src/export.d.ts +3 -3
- package/package.json +2 -2
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -180
- package/dist/types/excalidraw/actions/actionSmartZoom.d.ts +0 -16
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +0 -27
- package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +0 -7
- 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/MagicButton.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -12
- 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/excalidraw/scroll.d.ts +0 -46
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { GlobalPoint } from "@excalidraw/math";
|
|
2
|
+
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
3
|
+
import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawTextElement, FixedPoint, NonDeleted, NonDeletedExcalidrawElement, TextAlign, VerticalAlign } from "./types";
|
|
4
|
+
export type ArrowEndpoint = {
|
|
5
|
+
arrow: NonDeleted<ExcalidrawArrowElement>;
|
|
6
|
+
startOrEnd: "start" | "end";
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Finds a free (unbound) arrow endpoint under the cursor, front-most first.
|
|
10
|
+
* Used by the text tool to offer creating a text label anchored to the tip of
|
|
11
|
+
* an arrow.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getUnboundArrowEndpointAtPoint: (scenePointer: GlobalPoint, elements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, zoom: AppState["zoom"]) => ArrowEndpoint | null;
|
|
14
|
+
/**
|
|
15
|
+
* Describes how a text element should be created so that it reads as a label
|
|
16
|
+
* for the given arrow endpoint.
|
|
17
|
+
*
|
|
18
|
+
* The arrow is treated as fixed: rather than routing the arrow to the text, we
|
|
19
|
+
* pick the side of the text the arrow should attach to (the one it already
|
|
20
|
+
* points at), and place the text so that side's midpoint lands on the existing
|
|
21
|
+
* endpoint. The alignment returned pins that same midpoint while the text is
|
|
22
|
+
* typed, so the arrow doesn't swing around during editing.
|
|
23
|
+
*/
|
|
24
|
+
export declare const getTextBindingForArrowEndpoint: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "start" | "end", elementsMap: ElementsMap,
|
|
25
|
+
/**
|
|
26
|
+
* stroke width the text will be created with — the binding gap is derived
|
|
27
|
+
* from the *bind target*, so using the arrow's would offset the anchor by
|
|
28
|
+
* half the difference between the two
|
|
29
|
+
*/
|
|
30
|
+
targetStrokeWidth: number) => {
|
|
31
|
+
/** the text-local ratio the arrow binds to (a side midpoint) */
|
|
32
|
+
fixedPoint: FixedPoint;
|
|
33
|
+
textAlign: TextAlign;
|
|
34
|
+
verticalAlign: VerticalAlign;
|
|
35
|
+
/** scene position the text's bound side midpoint should sit at */
|
|
36
|
+
anchor: GlobalPoint;
|
|
37
|
+
} | null;
|
|
38
|
+
/**
|
|
39
|
+
* Whether an arrow endpoint is bound to this text — i.e. the text serves as an
|
|
40
|
+
* arrow-endpoint label. Checked on the arrows' own bindings: the text's
|
|
41
|
+
* `boundElements` only says an arrow relates to it, while the binding on the
|
|
42
|
+
* arrow is the authoritative side of the relationship.
|
|
43
|
+
*/
|
|
44
|
+
export declare const isEndpointBoundText: (text: ExcalidrawTextElement, elementsMap: ElementsMap) => boolean;
|
|
45
|
+
/** the anchor a text bound to an arrow endpoint grows away from */
|
|
46
|
+
export declare const getEndpointBoundTextDragAnchor: (newElement: ExcalidrawTextElement) => {
|
|
47
|
+
anchorRatio: number;
|
|
48
|
+
anchorX: number;
|
|
49
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { AppState, NullableGridSize } from "@excalidraw/excalidraw/types";
|
|
3
3
|
import { LinearElementEditor } from "../linearElementEditor";
|
|
4
|
-
import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, NonDeletedSceneElementsMap } from "../types";
|
|
4
|
+
import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, FixedPointBinding, NonDeletedSceneElementsMap } from "../types";
|
|
5
5
|
import type { Scene } from "../Scene";
|
|
6
6
|
export declare const isFocusPointVisible: (focusPoint: GlobalPoint, arrow: ExcalidrawArrowElement, bindableElement: ExcalidrawBindableElement, elementsMap: ElementsMap, appState: {
|
|
7
7
|
isBindingEnabled: AppState["isBindingEnabled"];
|
|
@@ -22,6 +22,9 @@ export declare const handleFocusPointPointerDown: (arrow: ExcalidrawArrowElement
|
|
|
22
22
|
x: number;
|
|
23
23
|
y: number;
|
|
24
24
|
};
|
|
25
|
+
arrowOtherEndpointInitialBinding: FixedPointBinding | null;
|
|
26
|
+
};
|
|
27
|
+
export declare const handleFocusPointPointerUp: (linearElementEditor: LinearElementEditor, scene: Scene) => {
|
|
28
|
+
arrowOtherEndpointInitialBinding: null;
|
|
25
29
|
};
|
|
26
|
-
export declare const handleFocusPointPointerUp: (linearElementEditor: LinearElementEditor, scene: Scene) => void;
|
|
27
30
|
export declare const handleFocusPointHover: (arrow: ExcalidrawArrowElement, scenePointerX: number, scenePointerY: number, scene: Scene, appState: AppState) => "start" | "end" | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { LineSegment, LocalPoint } from "@excalidraw/math";
|
|
3
|
-
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
3
|
+
import type { AppState, NullableGridSize } from "@excalidraw/excalidraw/types";
|
|
4
4
|
import type { Bounds } from "@excalidraw/common";
|
|
5
5
|
import { type Heading } from "./heading";
|
|
6
6
|
import type { Scene } from "./Scene";
|
|
@@ -28,7 +28,7 @@ export declare const BASE_BINDING_GAP = 5;
|
|
|
28
28
|
export declare const BASE_BINDING_GAP_ELBOW = 5;
|
|
29
29
|
export declare const BASE_ARROW_MIN_LENGTH = 10;
|
|
30
30
|
export declare const FOCUS_POINT_SIZE: number;
|
|
31
|
-
export declare const getBindingGap: (bindTarget: ExcalidrawBindableElement, opts: Pick<ExcalidrawArrowElement, "elbowed">) => number;
|
|
31
|
+
export declare const getBindingGap: (bindTarget: Pick<ExcalidrawBindableElement, "strokeWidth">, opts: Pick<ExcalidrawArrowElement, "elbowed">) => number;
|
|
32
32
|
export declare const maxBindingDistance_simple: (zoom?: AppState["zoom"]) => number;
|
|
33
33
|
export declare const isBindingEnabled: (appState: {
|
|
34
34
|
isBindingEnabled: AppState["isBindingEnabled"];
|
|
@@ -38,6 +38,7 @@ export declare const bindOrUnbindBindingElement: (arrow: NonDeleted<ExcalidrawAr
|
|
|
38
38
|
altKey?: boolean;
|
|
39
39
|
angleLocked?: boolean;
|
|
40
40
|
initialBinding?: boolean;
|
|
41
|
+
gridSize?: NullableGridSize;
|
|
41
42
|
}) => {
|
|
42
43
|
start: BindingStrategy;
|
|
43
44
|
end: BindingStrategy;
|
|
@@ -49,19 +50,20 @@ export declare const getBindingStrategyForDraggingBindingElementEndpoints: (arro
|
|
|
49
50
|
finalize?: boolean;
|
|
50
51
|
initialBinding?: boolean;
|
|
51
52
|
zoom?: AppState["zoom"];
|
|
53
|
+
gridSize?: NullableGridSize;
|
|
52
54
|
}) => {
|
|
53
55
|
start: BindingStrategy;
|
|
54
56
|
end: BindingStrategy;
|
|
55
57
|
};
|
|
56
58
|
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:
|
|
59
|
+
export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint, shouldSnapToOutline?: boolean, isMidpointSnappingEnabled?: boolean) => void;
|
|
60
|
+
export declare const unbindBindingElement: (arrow: ExcalidrawArrowElement, startOrEnd: "start" | "end", scene: Scene) => ExcalidrawBindableElement["id"] | null;
|
|
59
61
|
export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
|
|
60
|
-
simultaneouslyUpdated?: readonly
|
|
62
|
+
simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
|
|
61
63
|
changedElements?: Map<string, ExcalidrawElement>;
|
|
62
64
|
}) => void;
|
|
63
|
-
export declare const updateBindings: (latestElement:
|
|
64
|
-
simultaneouslyUpdated?: readonly
|
|
65
|
+
export declare const updateBindings: (latestElement: NonDeletedExcalidrawElement, scene: Scene, appState: AppState, options?: {
|
|
66
|
+
simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
|
|
65
67
|
newSize?: {
|
|
66
68
|
width: number;
|
|
67
69
|
height: number;
|
|
@@ -75,7 +77,7 @@ export declare const updateBoundPoint: (arrow: NonDeleted<ExcalidrawArrowElement
|
|
|
75
77
|
export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, shouldSnapToOutline?: boolean, isMidpointSnappingEnabled?: boolean) => {
|
|
76
78
|
fixedPoint: FixedPoint;
|
|
77
79
|
};
|
|
78
|
-
export declare const calculateFixedPointForNonElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement
|
|
80
|
+
export declare const calculateFixedPointForNonElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, startOrEnd: "start" | "end", elementsMap: ElementsMap, focusPoint?: GlobalPoint) => {
|
|
79
81
|
fixedPoint: FixedPoint;
|
|
80
82
|
};
|
|
81
83
|
export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
|
|
@@ -127,3 +129,10 @@ export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowEleme
|
|
|
127
129
|
export declare const isFixedPoint: (fixedPoint: any) => fixedPoint is FixedPointBinding["fixedPoint"];
|
|
128
130
|
export declare const normalizeFixedPoint: <T extends FixedPoint>(fixedPoint: T) => FixedPoint;
|
|
129
131
|
export declare const getBindingSideMidPoint: (binding: FixedPointBinding, elementsMap: ElementsMap) => GlobalPoint | LocalPoint | null;
|
|
132
|
+
/**
|
|
133
|
+
* Binds an arrow endpoint to an explicit fixed point on a bindable element,
|
|
134
|
+
* bypassing the "derive the ratio from where the endpoint currently is"
|
|
135
|
+
* strategy used when dragging. Needed when the binding target is placed to fit
|
|
136
|
+
* the arrow rather than the other way round.
|
|
137
|
+
*/
|
|
138
|
+
export declare const bindBindingElementToFixedPoint: (arrow: NonDeleted<ExcalidrawArrowElement>, bindableElement: NonDeleted<ExcalidrawBindableElement>, startOrEnd: "start" | "end", fixedPoint: FixedPoint, scene: Scene) => void;
|
|
@@ -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;
|
|
@@ -85,8 +81,8 @@ export declare const boundsContainBounds: (outerBounds: Bounds, innerBounds: Bou
|
|
|
85
81
|
* It can be used to get elements overlapping a selection box, for example.
|
|
86
82
|
*
|
|
87
83
|
*/
|
|
88
|
-
export declare const elementsOverlappingBBox: ({ elements, elementsMap, bounds, type, excludeElementsInFrames, shouldIgnoreElementFromSelection, }: {
|
|
89
|
-
elements: readonly
|
|
84
|
+
export declare const elementsOverlappingBBox: <T extends ExcalidrawElement>({ elements, elementsMap, bounds, type, excludeElementsInFrames, shouldIgnoreElementFromSelection, }: {
|
|
85
|
+
elements: readonly T[];
|
|
90
86
|
elementsMap?: ElementsMap;
|
|
91
87
|
bounds: Bounds | ExcalidrawElement;
|
|
92
88
|
/**
|
|
@@ -95,6 +91,6 @@ export declare const elementsOverlappingBBox: ({ elements, elementsMap, bounds,
|
|
|
95
91
|
**/
|
|
96
92
|
type: "contain" | "overlap";
|
|
97
93
|
excludeElementsInFrames?: boolean;
|
|
98
|
-
shouldIgnoreElementFromSelection?: (element:
|
|
99
|
-
}) =>
|
|
94
|
+
shouldIgnoreElementFromSelection?: (element: T) => boolean;
|
|
95
|
+
}) => T[];
|
|
100
96
|
export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMap: ElementsMap, xOffset?: number, yOffset?: number) => GlobalPoint;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { GlobalPoint } from "@excalidraw/math";
|
|
2
|
+
import type { ElementsMap, ExcalidrawElement, ExcalidrawLineElement, NonDeletedExcalidrawElement } from "./types";
|
|
3
|
+
export type BucketFillOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* geometric fidelity: vertices closer than this collapse to the same graph
|
|
6
|
+
* node, and a node this close to a stroke splits it (T-junction). Keep
|
|
7
|
+
* SMALL — every merge can relocate a vertex by up to this distance, so
|
|
8
|
+
* this value is the upper bound on how far the filled shape may deviate
|
|
9
|
+
* from the actual strokes.
|
|
10
|
+
*/
|
|
11
|
+
snapEpsilon: number;
|
|
12
|
+
/**
|
|
13
|
+
* connectivity: loose stroke ends within this distance of another stroke
|
|
14
|
+
* are bridged with a connector edge so the region reads as closed. Also
|
|
15
|
+
* used as broad-phase padding around the owner bounds. Unlike
|
|
16
|
+
* `snapEpsilon` this does not affect the shape's fidelity (bridges add
|
|
17
|
+
* edges; they never move existing vertices).
|
|
18
|
+
*/
|
|
19
|
+
gapTolerance: number;
|
|
20
|
+
/** discard faces / polygons smaller than this absolute area */
|
|
21
|
+
minArea: number;
|
|
22
|
+
/** bail out with `too_complex` above this many input segments */
|
|
23
|
+
maxBoundarySegments: number;
|
|
24
|
+
/** cap on the number of generated polygon points */
|
|
25
|
+
maxGeneratedPoints: number;
|
|
26
|
+
/**
|
|
27
|
+
* initial half-extent of the owner-less search box around the click
|
|
28
|
+
* (doubles up to 3 times while the found face touches the box frontier)
|
|
29
|
+
*/
|
|
30
|
+
fallbackSearchRadius: number;
|
|
31
|
+
};
|
|
32
|
+
export declare const DEFAULT_BUCKET_FILL_OPTIONS: BucketFillOptions;
|
|
33
|
+
export type BucketFillFailureReason = "no_owner" | "open_region" | "too_complex" | "too_small" | "invalid_polygon";
|
|
34
|
+
/**
|
|
35
|
+
* Where the generated fill element belongs in the scene order, expressed
|
|
36
|
+
* relative to an existing element so the caller can resolve it against
|
|
37
|
+
* whatever (e.g. deleted-inclusive) array it inserts into.
|
|
38
|
+
*/
|
|
39
|
+
export type BucketFillInsertion = {
|
|
40
|
+
placement: "above" | "below";
|
|
41
|
+
elementId: ExcalidrawElement["id"];
|
|
42
|
+
};
|
|
43
|
+
export type BucketFillGeometryResult = {
|
|
44
|
+
ok: true;
|
|
45
|
+
/**
|
|
46
|
+
* the closed element under the click, or null for fills resolved by
|
|
47
|
+
* the owner-less fallback (regions formed by open lines)
|
|
48
|
+
*/
|
|
49
|
+
ownerId: ExcalidrawElement["id"] | null;
|
|
50
|
+
boundaryElementIds: ExcalidrawElement["id"][];
|
|
51
|
+
/**
|
|
52
|
+
* closed polygon ring in scene coordinates. When the region contains
|
|
53
|
+
* islands, this is a keyhole path: the hole contours are spliced in
|
|
54
|
+
* via zero-width bridges, so it still renders as one polygon with
|
|
55
|
+
* unpainted hole interiors
|
|
56
|
+
*/
|
|
57
|
+
scenePoints: GlobalPoint[];
|
|
58
|
+
insertion: BucketFillInsertion;
|
|
59
|
+
} | {
|
|
60
|
+
ok: false;
|
|
61
|
+
reason: BucketFillFailureReason;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Whether the element visually paints an opaque background fill — i.e. can
|
|
65
|
+
* actually hide outlines beneath it. Element types that never render their
|
|
66
|
+
* `backgroundColor` (text, image, frames), see-through fill styles
|
|
67
|
+
* (hachure/cross-hatch), partial element opacity, and colors with an alpha
|
|
68
|
+
* channel below 1 (`#RRGGBBAA`, `rgba(…)`) all don't count — anything under
|
|
69
|
+
* them shows through.
|
|
70
|
+
*
|
|
71
|
+
* Shared with the app layer's z-order pass so "covers" means the same thing
|
|
72
|
+
* in boundary clipping and in fill insertion.
|
|
73
|
+
*/
|
|
74
|
+
export declare const rendersOpaqueFill: (element: ExcalidrawElement) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Whether the element renders as pure paint the bucket tool could have
|
|
77
|
+
* produced: a closed, visible line polygon with a background and no visible
|
|
78
|
+
* stroke. Recognition is by SHAPE, not by a metadata marker — any marker
|
|
79
|
+
* would go stale the moment the user restyles a fill, and a hand-drawn
|
|
80
|
+
* strokeless background polygon is indistinguishable from a generated fill
|
|
81
|
+
* anyway. Such paint never becomes an owner and is what the app layer
|
|
82
|
+
* restyles in place on re-click (see `isRestylableFill`).
|
|
83
|
+
*/
|
|
84
|
+
export declare const isBucketFillCompatible: (element: ExcalidrawElement) => element is ExcalidrawLineElement;
|
|
85
|
+
export declare const computeBucketFillPolygon: (args: {
|
|
86
|
+
point: GlobalPoint;
|
|
87
|
+
elements: readonly NonDeletedExcalidrawElement[];
|
|
88
|
+
elementsMap: ElementsMap;
|
|
89
|
+
options?: Partial<BucketFillOptions>;
|
|
90
|
+
}) => BucketFillGeometryResult;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the element the click landed on is a fill the bucket tool should
|
|
93
|
+
* restyle in place (instead of stacking an identical fill on top), given
|
|
94
|
+
* the computed region.
|
|
95
|
+
*
|
|
96
|
+
* Fill-compatibility is decided by shape (`isBucketFillCompatible`): a fill
|
|
97
|
+
* the user gave a stroke to has been repurposed into an outline and
|
|
98
|
+
* participates as a boundary instead of being restyled.
|
|
99
|
+
*
|
|
100
|
+
* One guard on top: the computed region's net area and bounds must match
|
|
101
|
+
* the element's. Without it, a click inside a shape drawn ON TOP of a
|
|
102
|
+
* filled region would recolor the underlying fill instead of filling that
|
|
103
|
+
* shape; a click on a since-subdivided part of an old fill likewise
|
|
104
|
+
* creates a new (smaller) fill rather than restyling the old one.
|
|
105
|
+
*/
|
|
106
|
+
export declare const isRestylableFill: (args: {
|
|
107
|
+
hitElement: ExcalidrawElement;
|
|
108
|
+
scenePoints: readonly GlobalPoint[];
|
|
109
|
+
elementsMap: ElementsMap;
|
|
110
|
+
}) => boolean;
|
|
@@ -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
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ElementOrToolType } from "@excalidraw/excalidraw/types";
|
|
2
|
-
export declare const hasBackground: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw";
|
|
3
|
-
export declare const hasStrokeColor: (type: ElementOrToolType) => type is "line" | "arrow" | "text" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "freedraw";
|
|
4
|
-
export declare const hasStrokeWidth: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw";
|
|
5
|
-
export declare const hasStrokeStyle: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe";
|
|
2
|
+
export declare const hasBackground: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw" | "autoshape" | "bucketfill";
|
|
3
|
+
export declare const hasStrokeColor: (type: ElementOrToolType) => type is "line" | "arrow" | "text" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "freedraw" | "autoshape";
|
|
4
|
+
export declare const hasStrokeWidth: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw" | "autoshape";
|
|
5
|
+
export declare const hasStrokeStyle: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "autoshape";
|
|
6
6
|
export declare const hasFreedrawMode: (type: ElementOrToolType) => type is "freedraw";
|
|
7
7
|
export declare const canChangeRoundness: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "embeddable" | "iframe" | "image";
|
|
8
8
|
export declare const toolIsArrow: (type: ElementOrToolType) => type is "arrow";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { App, AppState } from "@excalidraw/excalidraw/types";
|
|
2
|
+
import type { LocalPoint, GlobalPoint } from "@excalidraw/math";
|
|
3
|
+
import type { Bounds } from "@excalidraw/common";
|
|
4
|
+
import type { ExcalidrawArrowElement, ExcalidrawDiamondElement, ExcalidrawElement, ExcalidrawEllipseElement, ExcalidrawFreeDrawElement, ExcalidrawFrameLikeElement, ExcalidrawRectangleElement, ElementsMap, NonDeleted, ExcalidrawLineElement } from "@excalidraw/element/types";
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
LAST_POINTS?: readonly GlobalPoint[];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
type NonDeletedRecognizedShapeElement = NonDeleted<ExcalidrawRectangleElement | ExcalidrawEllipseElement | ExcalidrawDiamondElement | ExcalidrawArrowElement | ExcalidrawLineElement | ExcalidrawFreeDrawElement>;
|
|
11
|
+
type Shape = NonDeletedRecognizedShapeElement["type"];
|
|
12
|
+
interface ShapeRecognitionResult<P extends LocalPoint | GlobalPoint> {
|
|
13
|
+
type: Shape;
|
|
14
|
+
points: readonly P[];
|
|
15
|
+
boundingBox: Bounds;
|
|
16
|
+
}
|
|
17
|
+
export declare const recognizeShape: <P extends LocalPoint | GlobalPoint>(points: P[], previousElement: ExcalidrawElement | null, zoom?: number) => ShapeRecognitionResult<P>;
|
|
18
|
+
export declare const convertToShape: (points: GlobalPoint[], appState: AppState, elementsMap: ElementsMap, previousElement: ExcalidrawElement | null, frames?: readonly ExcalidrawFrameLikeElement[]) => NonDeletedRecognizedShapeElement | undefined;
|
|
19
|
+
export declare const convertToShapeHandlePointerMoveFromPointerDown: (app: App, pointerCoords: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}) => boolean;
|
|
23
|
+
export {};
|
|
@@ -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,7 @@
|
|
|
1
1
|
import type { AppState, NormalizedZoomValue, NullableGridSize, PointerDownState } from "@excalidraw/excalidraw/types";
|
|
2
2
|
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
import type { Scene } from "./Scene";
|
|
4
|
+
import type { ExcalidrawTextElement } from "./types";
|
|
4
5
|
export declare const dragSelectedElements: (pointerDownState: PointerDownState, _selectedElements: NonDeletedExcalidrawElement[], offset: {
|
|
5
6
|
x: number;
|
|
6
7
|
y: number;
|
|
@@ -9,6 +10,32 @@ export declare const dragSelectedElements: (pointerDownState: PointerDownState,
|
|
|
9
10
|
y: number;
|
|
10
11
|
}, gridSize: NullableGridSize) => void;
|
|
11
12
|
export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
13
|
+
/**
|
|
14
|
+
* Sizes a text element as it is dragged out.
|
|
15
|
+
*
|
|
16
|
+
* A dragged text pins one point and grows away from it; `anchorRatio` says
|
|
17
|
+
* where along the box that point sits — 0 for its left edge, 1 for its right,
|
|
18
|
+
* 0.5 for its centre.
|
|
19
|
+
*
|
|
20
|
+
* A free text pins the point the drag started from and takes the ratio from
|
|
21
|
+
* the drag direction, so it can be pulled either way. A text bound to an arrow
|
|
22
|
+
* endpoint instead pins whatever the binding placed it against and takes the
|
|
23
|
+
* ratio from its alignment — which is also what keeps it from growing back
|
|
24
|
+
* over the arrow, since dragging that way makes no progress rather than
|
|
25
|
+
* flipping the box around.
|
|
26
|
+
*/
|
|
27
|
+
export declare const dragNewTextElement: ({ newElement, anchorX, anchorRatio, pointerX, nextY, zoom, scene, informMutation, }: {
|
|
28
|
+
newElement: ExcalidrawTextElement;
|
|
29
|
+
anchorX: number;
|
|
30
|
+
/** 0 = anchored by its left edge, 1 = by its right, 0.5 = by its centre */
|
|
31
|
+
anchorRatio: number;
|
|
32
|
+
pointerX: number;
|
|
33
|
+
/** free text re-tops itself to the drag origin; a bound one must not move */
|
|
34
|
+
nextY?: number;
|
|
35
|
+
zoom: NormalizedZoomValue;
|
|
36
|
+
scene: Scene;
|
|
37
|
+
informMutation?: boolean;
|
|
38
|
+
}) => void;
|
|
12
39
|
export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, scene, widthAspectRatio, originOffset, informMutation, }: {
|
|
13
40
|
newElement: NonDeletedExcalidrawElement;
|
|
14
41
|
elementType: AppState["activeTool"]["type"];
|
|
@@ -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,7 @@
|
|
|
1
1
|
import type { AppState, PendingExcalidrawElements } from "@excalidraw/excalidraw/types";
|
|
2
|
-
import { type
|
|
2
|
+
import { type NonDeleted, type ElementsMap, type ExcalidrawElement, type ExcalidrawFlowchartNodeElement } from "./types";
|
|
3
3
|
import type { Scene } from "./Scene";
|
|
4
|
-
type LinkDirection = "up" | "right" | "down" | "left";
|
|
5
|
-
export declare const getLinkDirectionFromKey: (key: string) => LinkDirection;
|
|
6
|
-
export declare const getPredecessors: (node: ExcalidrawBindableElement, elementsMap: ElementsMap, direction: LinkDirection) => ExcalidrawBindableElement[];
|
|
7
|
-
export declare const addNewNodes: (startNode: ExcalidrawFlowchartNodeElement, appState: AppState, direction: LinkDirection, scene: Scene, numberOfNodes: number) => ExcalidrawElement[];
|
|
4
|
+
export type LinkDirection = "up" | "right" | "down" | "left";
|
|
8
5
|
export declare class FlowChartNavigator {
|
|
9
6
|
isExploring: boolean;
|
|
10
7
|
private sameLevelNodes;
|
|
@@ -13,14 +10,17 @@ export declare class FlowChartNavigator {
|
|
|
13
10
|
private visitedNodes;
|
|
14
11
|
clear(): void;
|
|
15
12
|
exploreByDirection(element: ExcalidrawElement, elementsMap: ElementsMap, direction: LinkDirection): ExcalidrawElement["id"] | null;
|
|
13
|
+
private static getNodeRelatives;
|
|
14
|
+
private static getSuccessors;
|
|
15
|
+
private static getPredecessors;
|
|
16
16
|
}
|
|
17
17
|
export declare class FlowChartCreator {
|
|
18
18
|
isCreatingChart: boolean;
|
|
19
19
|
private numberOfNodes;
|
|
20
20
|
private direction;
|
|
21
|
+
private clusterCrossStart;
|
|
21
22
|
pendingNodes: PendingExcalidrawElements | null;
|
|
22
|
-
createNodes(startNode: ExcalidrawFlowchartNodeElement
|
|
23
|
+
createNodes(startNode: NonDeleted<ExcalidrawFlowchartNodeElement>, appState: AppState, direction: LinkDirection, scene: Scene): void;
|
|
23
24
|
clear(): void;
|
|
24
25
|
}
|
|
25
26
|
export declare const isNodeInFlowchart: (element: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap) => boolean;
|
|
26
|
-
export {};
|
|
@@ -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:
|
|
34
|
+
export declare const getSelectedElementsByGroup: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, appState: Readonly<Pick<AppState, "selectedGroupIds" | "editingGroupId">>) => NonDeletedExcalidrawElement[][];
|
|
@@ -8,13 +8,15 @@ 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 "./arrange";
|
|
16
|
+
export * from "./arrowEndpointText";
|
|
16
17
|
export * from "./binding";
|
|
17
18
|
export * from "./bounds";
|
|
19
|
+
export * from "./bucketFill";
|
|
18
20
|
export * from "./collision";
|
|
19
21
|
export * from "./comparisons";
|
|
20
22
|
export * from "./containerCache";
|
|
@@ -60,3 +62,4 @@ export * from "./utils";
|
|
|
60
62
|
export * from "./zindex";
|
|
61
63
|
export * from "./arrows/helpers";
|
|
62
64
|
export * from "./arrowheads";
|
|
65
|
+
export * from "./convertToShape";
|