@myoc/excalidraw 0.18.19 → 0.18.20
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/chunk-5IFOUNFV.js +5684 -0
- package/dist/dev/chunk-5IFOUNFV.js.map +7 -0
- package/dist/dev/{chunk-WD4YVUU4.js → chunk-GR6GZQQD.js} +2 -2
- package/dist/dev/data/{image-CW7TABKC.js → image-QMTJGSU7.js} +3 -3
- package/dist/dev/index.css +4 -0
- package/dist/dev/index.css.map +2 -2
- package/dist/dev/index.js +6055 -4020
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-W655L563.js → chunk-PPT7KBS3.js} +1 -1
- package/dist/prod/chunk-SHSFPXHA.js +4 -0
- package/dist/prod/data/image-TZAIFXB2.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +24 -17
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/constants.d.ts +2 -1
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/utils.d.ts +2 -2
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/align.d.ts +2 -1
- package/dist/types/element/src/binding.d.ts +4 -0
- package/dist/types/element/src/bounds.d.ts +3 -1
- package/dist/types/element/src/distribute.d.ts +2 -1
- package/dist/types/element/src/elbowArrow.d.ts +1 -1
- package/dist/types/element/src/frame.d.ts +2 -2
- package/dist/types/element/src/groups.d.ts +1 -0
- package/dist/types/element/src/heading.d.ts +2 -2
- package/dist/types/element/src/linearElementEditor.d.ts +3 -5
- package/dist/types/element/src/resizeTest.d.ts +2 -2
- package/dist/types/element/src/selection.d.ts +1 -1
- package/dist/types/element/src/shape.d.ts +2 -2
- package/dist/types/element/src/shapes.d.ts +8 -8
- package/dist/types/element/src/store.d.ts +3 -2
- package/dist/types/element/src/utils.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +12 -15
- package/dist/types/excalidraw/actions/actionAlign.d.ts +8 -8
- package/dist/types/excalidraw/actions/actionArrange.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +63 -75
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +31 -36
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +4 -5
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +17 -20
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +3 -4
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +10 -12
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +4 -5
- package/dist/types/excalidraw/actions/actionExport.d.ts +121 -130
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +11 -12
- package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionFrame.d.ts +66 -70
- package/dist/types/excalidraw/actions/actionGroup.d.ts +14 -16
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +85 -55
- package/dist/types/excalidraw/actions/actionLink.d.ts +5 -6
- package/dist/types/excalidraw/actions/actionMenu.d.ts +13 -16
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionProperties.d.ts +63 -78
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +7 -8
- package/dist/types/excalidraw/actions/actionSmartZoom.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionStyles.d.ts +8 -9
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +5 -6
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
- package/dist/types/excalidraw/appState.d.ts +21 -21
- package/dist/types/excalidraw/components/Actions.d.ts +0 -4
- package/dist/types/excalidraw/components/App.d.ts +12 -6
- package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +11 -1
- package/dist/types/excalidraw/components/shapes.d.ts +1 -1
- package/dist/types/excalidraw/data/blob.d.ts +1 -1
- package/dist/types/excalidraw/index.d.ts +1 -0
- package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
- package/dist/types/excalidraw/types.d.ts +2 -4
- package/dist/types/math/src/angle.d.ts +1 -1
- package/dist/types/math/src/curve.d.ts +1 -1
- package/dist/types/math/src/ellipse.d.ts +3 -3
- package/dist/types/math/src/point.d.ts +2 -2
- package/dist/types/math/src/polygon.d.ts +2 -2
- package/dist/types/math/src/rectangle.d.ts +2 -0
- package/dist/types/math/src/segment.d.ts +5 -5
- package/dist/types/math/src/utils.d.ts +0 -2
- package/dist/types/utils/src/shape.d.ts +12 -12
- package/package.json +4 -1
- package/dist/dev/chunk-HDRNCSTL.js +0 -23870
- package/dist/dev/chunk-HDRNCSTL.js.map +0 -7
- package/dist/prod/chunk-23G2JOF5.js +0 -33
- package/dist/prod/data/image-TLNQ4QKS.js +0 -1
- package/dist/types/excalidraw/visualdebug.d.ts +0 -41
- /package/dist/dev/{chunk-WD4YVUU4.js.map → chunk-GR6GZQQD.js.map} +0 -0
- /package/dist/dev/data/{image-CW7TABKC.js.map → image-QMTJGSU7.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
|
|
3
3
|
import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate } from "@excalidraw/element";
|
|
4
|
-
import type { ExcalidrawElement, NonDeleted, InitializedExcalidrawImageElement,
|
|
4
|
+
import type { ExcalidrawElement, NonDeleted, InitializedExcalidrawImageElement, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "@excalidraw/element/types";
|
|
5
5
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
6
6
|
import { ActionManager } from "../actions/manager";
|
|
7
7
|
import { AnimationFrameHandler } from "../animation-frame-handler";
|
|
@@ -78,6 +78,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
78
78
|
/** embeds that have been inserted to DOM (as a perf optim, we don't want to
|
|
79
79
|
* insert to DOM before user initially scrolls to them) */
|
|
80
80
|
private initializedEmbeds;
|
|
81
|
+
private handleToastClose;
|
|
81
82
|
private elementsPendingErasure;
|
|
82
83
|
flowChartCreator: FlowChartCreator;
|
|
83
84
|
private flowChartNavigator;
|
|
@@ -315,12 +316,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
315
316
|
private static resetTapTwice;
|
|
316
317
|
private onTouchStart;
|
|
317
318
|
private onTouchEnd;
|
|
318
|
-
addImageElementsToScene: ({ sceneX, sceneY, files, selectAfterInsert, }: {
|
|
319
|
+
addImageElementsToScene: ({ sceneX, sceneY, files, selectAfterInsert, addToFrameUnderCursor, }: {
|
|
319
320
|
sceneX: number;
|
|
320
321
|
sceneY: number;
|
|
321
322
|
files: File[];
|
|
322
323
|
selectAfterInsert?: boolean | undefined;
|
|
323
|
-
|
|
324
|
+
addToFrameUnderCursor?: boolean | undefined;
|
|
325
|
+
}) => Promise<NonDeleted<InitializedExcalidrawImageElement>[]>;
|
|
324
326
|
pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
|
|
325
327
|
addElementsFromPasteOrLibrary: (opts: {
|
|
326
328
|
elements: readonly ExcalidrawElement[];
|
|
@@ -508,12 +510,17 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
508
510
|
private restoreReadyToEraseElements;
|
|
509
511
|
private eraseElements;
|
|
510
512
|
private initializeImage;
|
|
513
|
+
/**
|
|
514
|
+
* use during async image initialization,
|
|
515
|
+
* when the placeholder image could have been modified in the meantime,
|
|
516
|
+
* and when you don't want to loose those modifications
|
|
517
|
+
*/
|
|
518
|
+
private getLatestInitializedImageElement;
|
|
511
519
|
/**
|
|
512
520
|
* inserts image into elements array and rerenders
|
|
513
521
|
*/
|
|
514
|
-
insertImageElement
|
|
522
|
+
private insertImageElement;
|
|
515
523
|
private onImageAction;
|
|
516
|
-
initializeImageDimensions: (imageElement: ExcalidrawImageElement) => void;
|
|
517
524
|
private getImageNaturalDimensions;
|
|
518
525
|
/** updates image cache, refreshing updated elements and/or setting status
|
|
519
526
|
to error for images that fail during <img> element creation */
|
|
@@ -525,7 +532,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
525
532
|
private scheduleImageRefresh;
|
|
526
533
|
private updateBindingEnabledOnPointerMove;
|
|
527
534
|
private maybeSuggestBindingAtCursor;
|
|
528
|
-
private maybeSuggestBindingsForLinearElementAtCoords;
|
|
529
535
|
private clearSelection;
|
|
530
536
|
private handleInteractiveCanvasRef;
|
|
531
537
|
private handleAppOnDrop;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
import type { Scene } from "@excalidraw/element";
|
|
4
|
+
import { useApp, useExcalidrawSetAppState } from "../App";
|
|
4
5
|
import "./DragInput.scss";
|
|
5
6
|
import type { StatsInputProperty } from "./utils";
|
|
6
7
|
import type { AppState } from "../../types";
|
|
@@ -16,6 +17,14 @@ export type DragInputCallbackType<P extends StatsInputProperty, E = ExcalidrawEl
|
|
|
16
17
|
property: P;
|
|
17
18
|
originalAppState: AppState;
|
|
18
19
|
setInputValue: (value: number) => void;
|
|
20
|
+
app: ReturnType<typeof useApp>;
|
|
21
|
+
setAppState: ReturnType<typeof useExcalidrawSetAppState>;
|
|
22
|
+
}) => void;
|
|
23
|
+
export type DragFinishedCallbackType<E = ExcalidrawElement> = (props: {
|
|
24
|
+
app: ReturnType<typeof useApp>;
|
|
25
|
+
setAppState: ReturnType<typeof useExcalidrawSetAppState>;
|
|
26
|
+
originalElements: readonly E[] | null;
|
|
27
|
+
originalAppState: AppState;
|
|
19
28
|
}) => void;
|
|
20
29
|
interface StatsDragInputProps<T extends StatsInputProperty, E = ExcalidrawElement> {
|
|
21
30
|
label: string | React.ReactNode;
|
|
@@ -30,6 +39,7 @@ interface StatsDragInputProps<T extends StatsInputProperty, E = ExcalidrawElemen
|
|
|
30
39
|
appState: AppState;
|
|
31
40
|
/** how many px you need to drag to get 1 unit change */
|
|
32
41
|
sensitivity?: number;
|
|
42
|
+
dragFinishedCallback?: DragFinishedCallbackType;
|
|
33
43
|
}
|
|
34
|
-
declare const StatsDragInput: <T extends StatsInputProperty, E extends ExcalidrawElement = ExcalidrawElement>({ label, icon, dragInputCallback, value, elements, editable, shouldKeepAspectRatio, property, scene, appState, sensitivity, }: StatsDragInputProps<T, E>) => import("react/jsx-runtime").JSX.Element | null;
|
|
44
|
+
declare const StatsDragInput: <T extends StatsInputProperty, E extends ExcalidrawElement = ExcalidrawElement>({ label, icon, dragInputCallback, value, elements, editable, shouldKeepAspectRatio, property, scene, appState, sensitivity, dragFinishedCallback, }: StatsDragInputProps<T, E>) => import("react/jsx-runtime").JSX.Element | null;
|
|
35
45
|
export default StatsDragInput;
|
|
@@ -59,4 +59,4 @@ export declare const SHAPES: readonly [{
|
|
|
59
59
|
readonly fillable: false;
|
|
60
60
|
readonly myocSimplifiedMode: true;
|
|
61
61
|
}];
|
|
62
|
-
export declare const findShapeByKey: (key: string) => "
|
|
62
|
+
export declare const findShapeByKey: (key: string) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | null;
|
|
@@ -6,7 +6,7 @@ import type { FileSystemHandle } from "./filesystem";
|
|
|
6
6
|
import type { ImportedLibraryData } from "./types";
|
|
7
7
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
8
8
|
export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
|
|
9
|
-
export declare const isImageFileHandleType: (type: string | null) => type is "
|
|
9
|
+
export declare const isImageFileHandleType: (type: string | null) => type is "png" | "svg";
|
|
10
10
|
export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boolean;
|
|
11
11
|
export declare const isSupportedImageFileType: (type: string | null | undefined) => boolean;
|
|
12
12
|
export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
|
|
@@ -29,6 +29,7 @@ export { Sidebar } from "./components/Sidebar/Sidebar";
|
|
|
29
29
|
export { Button } from "./components/Button";
|
|
30
30
|
export { Footer };
|
|
31
31
|
export { MainMenu };
|
|
32
|
+
export { Ellipsify } from "./components/Ellipsify";
|
|
32
33
|
export { useDevice } from "./components/App";
|
|
33
34
|
export { WelcomeScreen };
|
|
34
35
|
export { LiveCollaborationTrigger };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ExcalidrawFrameLikeElement } from "@excalidraw/element/types";
|
|
2
|
+
import type { StaticCanvasRenderConfig, StaticSceneRenderConfig } from "../scene/types";
|
|
3
|
+
import type { StaticCanvasAppState } from "../types";
|
|
4
|
+
export declare const frameClip: (frame: ExcalidrawFrameLikeElement, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
|
|
2
5
|
/** throttled to animation framerate */
|
|
3
6
|
export declare const renderStaticSceneThrottled: {
|
|
4
7
|
(config: StaticSceneRenderConfig): void;
|
|
@@ -129,7 +129,6 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
129
129
|
}>;
|
|
130
130
|
export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
131
131
|
activeEmbeddable: AppState["activeEmbeddable"];
|
|
132
|
-
editingLinearElement: AppState["editingLinearElement"];
|
|
133
132
|
selectionElement: AppState["selectionElement"];
|
|
134
133
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
135
134
|
selectedLinearElement: AppState["selectedLinearElement"];
|
|
@@ -156,8 +155,8 @@ export type ObservedElementsAppState = {
|
|
|
156
155
|
editingGroupId: AppState["editingGroupId"];
|
|
157
156
|
selectedElementIds: AppState["selectedElementIds"];
|
|
158
157
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
159
|
-
editingLinearElementId: LinearElementEditor["elementId"] | null;
|
|
160
158
|
selectedLinearElementId: LinearElementEditor["elementId"] | null;
|
|
159
|
+
selectedLinearElementIsEditing: boolean | null;
|
|
161
160
|
croppingElementId: AppState["croppingElementId"];
|
|
162
161
|
lockedMultiSelections: AppState["lockedMultiSelections"];
|
|
163
162
|
activeLockedId: AppState["activeLockedId"];
|
|
@@ -219,7 +218,6 @@ export interface AppState {
|
|
|
219
218
|
* set when a new text is created or when an existing text is being edited
|
|
220
219
|
*/
|
|
221
220
|
editingTextElement: NonDeletedExcalidrawElement | null;
|
|
222
|
-
editingLinearElement: LinearElementEditor | null;
|
|
223
221
|
activeTool: {
|
|
224
222
|
/**
|
|
225
223
|
* indicates a previous tool we should revert back to if we deselect the
|
|
@@ -651,7 +649,7 @@ export interface ExcalidrawImperativeAPI {
|
|
|
651
649
|
sceneY: number;
|
|
652
650
|
files: File[];
|
|
653
651
|
selectAfterInsert?: boolean;
|
|
654
|
-
}) => Promise<
|
|
652
|
+
}) => Promise<ExcalidrawElement[]>;
|
|
655
653
|
id: string;
|
|
656
654
|
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
657
655
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
@@ -5,7 +5,7 @@ export declare const normalizeRadians: (angle: Radians) => Radians;
|
|
|
5
5
|
* (x, y) for the center point 0,0 where the first number returned is the radius,
|
|
6
6
|
* the second is the angle in radians.
|
|
7
7
|
*/
|
|
8
|
-
export declare const cartesian2Polar: <P extends
|
|
8
|
+
export declare const cartesian2Polar: <P extends GlobalPoint | LocalPoint>([x, y,]: P) => PolarCoords;
|
|
9
9
|
export declare function degreesToRadians(degrees: Degrees): Radians;
|
|
10
10
|
export declare function radiansToDegrees(degrees: Radians): Degrees;
|
|
11
11
|
/**
|
|
@@ -8,7 +8,7 @@ import type { Curve, GlobalPoint, LineSegment, LocalPoint } from "./types";
|
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
10
|
export declare function curve<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, c: Point, d: Point): Curve<Point>;
|
|
11
|
-
export declare const bezierEquation: <Point extends
|
|
11
|
+
export declare const bezierEquation: <Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, t: number) => Point;
|
|
12
12
|
/**
|
|
13
13
|
* Computes the intersection between a cubic spline and a line segment.
|
|
14
14
|
*/
|
|
@@ -16,7 +16,7 @@ export declare function ellipse<Point extends GlobalPoint | LocalPoint>(center:
|
|
|
16
16
|
* @param ellipse The ellipse to compare against
|
|
17
17
|
* @returns TRUE if the point is inside or on the outline of the ellipse
|
|
18
18
|
*/
|
|
19
|
-
export declare const ellipseIncludesPoint: <Point extends
|
|
19
|
+
export declare const ellipseIncludesPoint: <Point extends GlobalPoint | LocalPoint>(p: Point, ellipse: Ellipse<Point>) => boolean;
|
|
20
20
|
/**
|
|
21
21
|
* Tests whether a point lies on the outline of the ellipse within a given
|
|
22
22
|
* tolerance
|
|
@@ -26,7 +26,7 @@ export declare const ellipseIncludesPoint: <Point extends LocalPoint | GlobalPoi
|
|
|
26
26
|
* @param threshold The distance to consider a point close enough to be "on" the outline
|
|
27
27
|
* @returns TRUE if the point is on the ellise outline
|
|
28
28
|
*/
|
|
29
|
-
export declare const ellipseTouchesPoint: <Point extends
|
|
29
|
+
export declare const ellipseTouchesPoint: <Point extends GlobalPoint | LocalPoint>(point: Point, ellipse: Ellipse<Point>, threshold?: number) => boolean;
|
|
30
30
|
/**
|
|
31
31
|
* Determine the shortest euclidean distance from a point to the
|
|
32
32
|
* outline of the ellipse
|
|
@@ -35,7 +35,7 @@ export declare const ellipseTouchesPoint: <Point extends LocalPoint | GlobalPoin
|
|
|
35
35
|
* @param ellipse The ellipse to calculate the distance to
|
|
36
36
|
* @returns The eucledian distance
|
|
37
37
|
*/
|
|
38
|
-
export declare const ellipseDistanceFromPoint: <Point extends
|
|
38
|
+
export declare const ellipseDistanceFromPoint: <Point extends GlobalPoint | LocalPoint>(p: Point, ellipse: Ellipse<Point>) => number;
|
|
39
39
|
/**
|
|
40
40
|
* Calculate a maximum of two intercept points for a line going throug an
|
|
41
41
|
* ellipse.
|
|
@@ -109,7 +109,7 @@ export declare function pointDistanceSq<P extends LocalPoint | GlobalPoint>(a: P
|
|
|
109
109
|
* @param multiplier The scaling factor
|
|
110
110
|
* @returns
|
|
111
111
|
*/
|
|
112
|
-
export declare const pointScaleFromOrigin: <P extends
|
|
112
|
+
export declare const pointScaleFromOrigin: <P extends GlobalPoint | LocalPoint>(p: P, mid: P, multiplier: number) => GlobalPoint | LocalPoint;
|
|
113
113
|
/**
|
|
114
114
|
* Returns whether `q` lies inside the segment/rectangle defined by `p` and `r`.
|
|
115
115
|
* This is an approximation to "does `q` lie on a segment `pr`" check.
|
|
@@ -119,4 +119,4 @@ export declare const pointScaleFromOrigin: <P extends LocalPoint | GlobalPoint>(
|
|
|
119
119
|
* @param r The other point to compare against
|
|
120
120
|
* @returns TRUE if q is indeed between p and r
|
|
121
121
|
*/
|
|
122
|
-
export declare const isPointWithinBounds: <P extends
|
|
122
|
+
export declare const isPointWithinBounds: <P extends GlobalPoint | LocalPoint>(p: P, q: P, r: P) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GlobalPoint, LocalPoint, Polygon } from "./types";
|
|
2
2
|
export declare function polygon<Point extends GlobalPoint | LocalPoint>(...points: Point[]): Polygon<Point>;
|
|
3
3
|
export declare function polygonFromPoints<Point extends GlobalPoint | LocalPoint>(points: Point[]): Polygon<Point>;
|
|
4
|
-
export declare const polygonIncludesPoint: <Point extends
|
|
4
|
+
export declare const polygonIncludesPoint: <Point extends GlobalPoint | LocalPoint>(point: Point, polygon: Polygon<Point>) => boolean;
|
|
5
5
|
export declare const polygonIncludesPointNonZero: <Point extends [number, number]>(point: Point, polygon: Point[]) => boolean;
|
|
6
|
-
export declare const pointOnPolygon: <Point extends
|
|
6
|
+
export declare const pointOnPolygon: <Point extends GlobalPoint | LocalPoint>(p: Point, poly: Polygon<Point>, threshold?: number) => boolean;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { GlobalPoint, LineSegment, LocalPoint, Rectangle } from "./types";
|
|
2
2
|
export declare function rectangle<P extends GlobalPoint | LocalPoint>(topLeft: P, bottomRight: P): Rectangle<P>;
|
|
3
|
+
export declare function rectangleFromNumberSequence<Point extends LocalPoint | GlobalPoint>(minX: number, minY: number, maxX: number, maxY: number): Rectangle<Point>;
|
|
3
4
|
export declare function rectangleIntersectLineSegment<Point extends LocalPoint | GlobalPoint>(r: Rectangle<Point>, l: LineSegment<Point>): Point[];
|
|
5
|
+
export declare function rectangleIntersectRectangle<Point extends LocalPoint | GlobalPoint>(rectangle1: Rectangle<Point>, rectangle2: Rectangle<Point>): boolean;
|
|
@@ -11,7 +11,7 @@ export declare function lineSegment<P extends GlobalPoint | LocalPoint>(a: P, b:
|
|
|
11
11
|
* @param segment
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
export declare const isLineSegment: <Point extends
|
|
14
|
+
export declare const isLineSegment: <Point extends GlobalPoint | LocalPoint>(segment: unknown) => segment is LineSegment<Point>;
|
|
15
15
|
/**
|
|
16
16
|
* Return the coordinates resulting from rotating the given line about an origin by an angle in radians
|
|
17
17
|
* note that when the origin is not given, the midpoint of the given line is used as the origin.
|
|
@@ -21,14 +21,14 @@ export declare const isLineSegment: <Point extends LocalPoint | GlobalPoint>(seg
|
|
|
21
21
|
* @param origin
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
|
-
export declare const lineSegmentRotate: <Point extends
|
|
24
|
+
export declare const lineSegmentRotate: <Point extends GlobalPoint | LocalPoint>(l: LineSegment<Point>, angle: Radians, origin?: Point | undefined) => LineSegment<Point>;
|
|
25
25
|
/**
|
|
26
26
|
* Calculates the point two line segments with a definite start and end point
|
|
27
27
|
* intersect at.
|
|
28
28
|
*/
|
|
29
|
-
export declare const segmentsIntersectAt: <Point extends
|
|
30
|
-
export declare const pointOnLineSegment: <Point extends
|
|
31
|
-
export declare const distanceToLineSegment: <Point extends
|
|
29
|
+
export declare const segmentsIntersectAt: <Point extends GlobalPoint | LocalPoint>(a: Readonly<LineSegment<Point>>, b: Readonly<LineSegment<Point>>) => Point | null;
|
|
30
|
+
export declare const pointOnLineSegment: <Point extends GlobalPoint | LocalPoint>(point: Point, line: LineSegment<Point>, threshold?: number) => boolean;
|
|
31
|
+
export declare const distanceToLineSegment: <Point extends GlobalPoint | LocalPoint>(point: Point, line: LineSegment<Point>) => number;
|
|
32
32
|
/**
|
|
33
33
|
* Returns the intersection point of a segment and a line
|
|
34
34
|
*
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type Bounds } from "@excalidraw/element";
|
|
2
1
|
export declare const PRECISION = 0.0001;
|
|
3
2
|
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
4
3
|
export declare const round: (value: number, precision: number, func?: "round" | "floor" | "ceil") => number;
|
|
@@ -6,4 +5,3 @@ export declare const roundToStep: (value: number, step: number, func?: "round" |
|
|
|
6
5
|
export declare const average: (a: number, b: number) => number;
|
|
7
6
|
export declare const isFiniteNumber: (value: any) => value is number;
|
|
8
7
|
export declare const isCloseTo: (a: number, b: number, precision?: number) => boolean;
|
|
9
|
-
export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
|
|
@@ -30,13 +30,13 @@ export type GeometricShape<Point extends GlobalPoint | LocalPoint> = {
|
|
|
30
30
|
data: Polycurve<Point>;
|
|
31
31
|
};
|
|
32
32
|
type RectangularElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawTextElement | ExcalidrawSelectionElement;
|
|
33
|
-
export declare const getPolygonShape: <Point extends
|
|
34
|
-
export declare const getSelectionBoxShape: <Point extends
|
|
35
|
-
export declare const getEllipseShape: <Point extends
|
|
33
|
+
export declare const getPolygonShape: <Point extends GlobalPoint | LocalPoint>(element: RectangularElement) => GeometricShape<Point>;
|
|
34
|
+
export declare const getSelectionBoxShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap, padding?: number) => GeometricShape<Point>;
|
|
35
|
+
export declare const getEllipseShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawEllipseElement) => GeometricShape<Point>;
|
|
36
36
|
export declare const getCurvePathOps: (shape: Drawable) => Op[];
|
|
37
|
-
export declare const getCurveShape: <Point extends
|
|
38
|
-
export declare const getFreedrawShape: <Point extends
|
|
39
|
-
export declare const getClosedCurveShape: <Point extends
|
|
37
|
+
export declare const getCurveShape: <Point extends GlobalPoint | LocalPoint>(roughShape: Drawable, startingPoint: Point | undefined, angleInRadian: Radians, center: Point) => GeometricShape<Point>;
|
|
38
|
+
export declare const getFreedrawShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawFreeDrawElement, center: Point, isClosed?: boolean) => GeometricShape<Point>;
|
|
39
|
+
export declare const getClosedCurveShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawLinearElement, roughShape: Drawable, startingPoint: Point | undefined, angleInRadian: Radians, center: Point) => GeometricShape<Point>;
|
|
40
40
|
/**
|
|
41
41
|
* Determine intersection of a rectangular shaped element and a
|
|
42
42
|
* line segment.
|
|
@@ -46,13 +46,13 @@ export declare const getClosedCurveShape: <Point extends LocalPoint | GlobalPoin
|
|
|
46
46
|
* @param gap Optional value to inflate the shape before testing
|
|
47
47
|
* @returns An array of intersections
|
|
48
48
|
*/
|
|
49
|
-
export declare const segmentIntersectRectangleElement: <Point extends
|
|
50
|
-
export declare const pointOnEllipse: <Point extends
|
|
51
|
-
export declare const pointInEllipse: <Point extends
|
|
52
|
-
export declare const ellipseAxes: <Point extends
|
|
49
|
+
export declare const segmentIntersectRectangleElement: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawBindableElement, segment: LineSegment<Point>, gap?: number) => Point[];
|
|
50
|
+
export declare const pointOnEllipse: <Point extends GlobalPoint | LocalPoint>(point: Point, ellipse: Ellipse<Point>, threshold?: number) => boolean;
|
|
51
|
+
export declare const pointInEllipse: <Point extends GlobalPoint | LocalPoint>(p: Point, ellipse: Ellipse<Point>) => boolean;
|
|
52
|
+
export declare const ellipseAxes: <Point extends GlobalPoint | LocalPoint>(ellipse: Ellipse<Point>) => {
|
|
53
53
|
majorAxis: number;
|
|
54
54
|
minorAxis: number;
|
|
55
55
|
};
|
|
56
|
-
export declare const ellipseFocusToCenter: <Point extends
|
|
57
|
-
export declare const ellipseExtremes: <Point extends
|
|
56
|
+
export declare const ellipseFocusToCenter: <Point extends GlobalPoint | LocalPoint>(ellipse: Ellipse<Point>) => number;
|
|
57
|
+
export declare const ellipseExtremes: <Point extends GlobalPoint | LocalPoint>(ellipse: Ellipse<Point>) => import("@excalidraw/math").Vector[];
|
|
58
58
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myoc/excalidraw",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/excalidraw/index.d.ts",
|
|
6
6
|
"main": "./dist/prod/index.js",
|
|
@@ -72,7 +72,10 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@braintree/sanitize-url": "6.0.2",
|
|
75
|
+
"@excalidraw/common": "0.18.0",
|
|
76
|
+
"@excalidraw/element": "0.18.0",
|
|
75
77
|
"@excalidraw/laser-pointer": "1.3.1",
|
|
78
|
+
"@excalidraw/math": "0.18.0",
|
|
76
79
|
"@excalidraw/mermaid-to-excalidraw": "1.1.2",
|
|
77
80
|
"@excalidraw/random-username": "1.1.0",
|
|
78
81
|
"@radix-ui/react-popover": "1.1.6",
|