@zsviczian/excalidraw 0.18.0-19 → 0.18.0-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.
Files changed (59) hide show
  1. package/dist/excalidraw.development.js +57 -123
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +1 -1
  4. package/types/common/src/constants.d.ts +10 -1
  5. package/types/common/src/utils.d.ts +2 -2
  6. package/types/element/src/Shape.d.ts +6 -2
  7. package/types/element/src/binding.d.ts +7 -8
  8. package/types/element/src/bounds.d.ts +3 -2
  9. package/types/element/src/collision.d.ts +18 -12
  10. package/types/element/src/cropElement.d.ts +1 -1
  11. package/types/element/src/delta.d.ts +26 -6
  12. package/types/element/src/distance.d.ts +2 -2
  13. package/types/element/src/fractionalIndex.d.ts +8 -2
  14. package/types/element/src/linearElementEditor.d.ts +1 -0
  15. package/types/element/src/mutateElement.d.ts +1 -1
  16. package/types/element/src/shapes.d.ts +1 -1
  17. package/types/element/src/sizeHelpers.d.ts +1 -1
  18. package/types/element/src/store.d.ts +11 -7
  19. package/types/element/src/typeChecks.d.ts +4 -0
  20. package/types/element/src/types.d.ts +1 -1
  21. package/types/element/src/utils.d.ts +2 -1
  22. package/types/excalidraw/actions/actionAddToLibrary.d.ts +0 -3
  23. package/types/excalidraw/actions/actionBoundText.d.ts +0 -2
  24. package/types/excalidraw/actions/actionCanvas.d.ts +0 -15
  25. package/types/excalidraw/actions/actionClipboard.d.ts +1 -6
  26. package/types/excalidraw/actions/actionCropEditor.d.ts +0 -1
  27. package/types/excalidraw/actions/actionDeleteSelected.d.ts +1 -3
  28. package/types/excalidraw/actions/actionElementLink.d.ts +0 -1
  29. package/types/excalidraw/actions/actionElementLock.d.ts +0 -2
  30. package/types/excalidraw/actions/actionEmbeddable.d.ts +0 -1
  31. package/types/excalidraw/actions/actionExport.d.ts +0 -9
  32. package/types/excalidraw/actions/actionFinalize.d.ts +1 -3
  33. package/types/excalidraw/actions/actionFrame.d.ts +0 -4
  34. package/types/excalidraw/actions/actionGroup.d.ts +0 -2
  35. package/types/excalidraw/actions/actionLinearEditor.d.ts +0 -1
  36. package/types/excalidraw/actions/actionLink.d.ts +0 -1
  37. package/types/excalidraw/actions/actionMenu.d.ts +0 -3
  38. package/types/excalidraw/actions/actionNavigate.d.ts +0 -2
  39. package/types/excalidraw/actions/actionProperties.d.ts +0 -15
  40. package/types/excalidraw/actions/actionSelectAll.d.ts +0 -1
  41. package/types/excalidraw/actions/actionStyles.d.ts +0 -1
  42. package/types/excalidraw/actions/actionToggleGridMode.d.ts +0 -1
  43. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +0 -1
  44. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +0 -1
  45. package/types/excalidraw/actions/actionToggleStats.d.ts +0 -1
  46. package/types/excalidraw/actions/actionToggleViewMode.d.ts +0 -1
  47. package/types/excalidraw/actions/actionToggleZenMode.d.ts +0 -1
  48. package/types/excalidraw/components/App.d.ts +7 -13
  49. package/types/excalidraw/eraser/index.d.ts +0 -2
  50. package/types/excalidraw/history.d.ts +21 -5
  51. package/types/excalidraw/lasso/utils.d.ts +2 -1
  52. package/types/excalidraw/renderer/helpers.d.ts +3 -3
  53. package/types/excalidraw/scene/Renderer.d.ts +0 -1
  54. package/types/excalidraw/types.d.ts +2 -4
  55. package/types/math/src/angle.d.ts +2 -0
  56. package/types/math/src/curve.d.ts +4 -0
  57. package/types/math/src/index.d.ts +1 -0
  58. package/types/math/src/vector.d.ts +4 -2
  59. package/types/utils/src/collision.d.ts +0 -8
@@ -2,7 +2,7 @@ import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorPal
2
2
  import type { SuggestedBinding } from "@excalidraw/element";
3
3
  import type { LinearElementEditor } from "@excalidraw/element";
4
4
  import type { MaybeTransformHandleType } from "@excalidraw/element";
5
- import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
5
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
6
6
  import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
7
7
  import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
8
8
  import type { Action } from "./actions/types";
@@ -113,7 +113,6 @@ type _CommonCanvasAppState = {
113
113
  offsetLeft: AppState["offsetLeft"];
114
114
  offsetTop: AppState["offsetTop"];
115
115
  theme: AppState["theme"];
116
- pendingImageElementId: AppState["pendingImageElementId"];
117
116
  };
118
117
  export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
119
118
  shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
@@ -334,8 +333,6 @@ export interface AppState {
334
333
  shown: true;
335
334
  data: Spreadsheet;
336
335
  };
337
- /** imageElement waiting to be placed on canvas */
338
- pendingImageElementId: ExcalidrawImageElement["id"] | null;
339
336
  showHyperlinkPopup: false | "info" | "editor";
340
337
  linkOpacity: number;
341
338
  trayModeEnabled: boolean;
@@ -685,6 +682,7 @@ export interface ExcalidrawImperativeAPI {
685
682
  updateLibrary: InstanceType<typeof Library>["updateLibrary"];
686
683
  resetScene: InstanceType<typeof App>["resetScene"];
687
684
  getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
685
+ getSceneElementsMapIncludingDeleted: InstanceType<typeof App>["getSceneElementsMapIncludingDeleted"];
688
686
  history: {
689
687
  clear: InstanceType<typeof App>["resetHistory"];
690
688
  };
@@ -15,3 +15,5 @@ export declare function radiansToDegrees(degrees: Radians): Degrees;
15
15
  * @returns TRUE if the provided angle is a right angle
16
16
  */
17
17
  export declare function isRightAngleRads(rads: Radians): boolean;
18
+ export declare function radiansBetweenAngles(a: Radians, min: Radians, max: Radians): boolean;
19
+ export declare function radiansDifference(a: Radians, b: Radians): Radians;
@@ -40,3 +40,7 @@ export declare function curvePointDistance<Point extends GlobalPoint | LocalPoin
40
40
  */
41
41
  export declare function isCurve<P extends GlobalPoint | LocalPoint>(v: unknown): v is Curve<P>;
42
42
  export declare function curveTangent<Point extends GlobalPoint | LocalPoint>([p0, p1, p2, p3]: Curve<Point>, t: number): import("./types").Vector;
43
+ export declare function curveCatmullRomQuadraticApproxPoints(points: GlobalPoint[], tension?: number): [GlobalPoint, GlobalPoint][] | undefined;
44
+ export declare function curveCatmullRomCubicApproxPoints<Point extends GlobalPoint | LocalPoint>(points: Point[], tension?: number): Curve<Point>[] | undefined;
45
+ export declare function curveOffsetPoints([p0, p1, p2, p3]: Curve<GlobalPoint>, offset: number, steps?: number): GlobalPoint[];
46
+ export declare function offsetPointsForQuadraticBezier(p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, offsetDist: number, steps?: number): GlobalPoint[];
@@ -1,5 +1,6 @@
1
1
  export * from "./angle";
2
2
  export * from "./curve";
3
+ export * from "./ellipse";
3
4
  export * from "./line";
4
5
  export * from "./point";
5
6
  export * from "./polygon";
@@ -12,9 +12,11 @@ export declare function vector(x: number, y: number, originX?: number, originY?:
12
12
  *
13
13
  * @param p The point to turn into a vector
14
14
  * @param origin The origin point in a given coordiante system
15
- * @returns The created vector from the point and the origin
15
+ * @param threshold The threshold to consider the vector as 'undefined'
16
+ * @param defaultValue The default value to return if the vector is 'undefined'
17
+ * @returns The created vector from the point and the origin or default
16
18
  */
17
- export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point): Vector;
19
+ export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point, threshold?: number, defaultValue?: Vector): Vector;
18
20
  /**
19
21
  * Cross product is a binary operation on two vectors in 2D space.
20
22
  * It results in a vector that is perpendicular to both vectors.
@@ -1,8 +0,0 @@
1
- import { type GlobalPoint, type LocalPoint, type Polygon } from "@excalidraw/math";
2
- import type { Curve } from "@excalidraw/math";
3
- import type { Polyline, GeometricShape } from "./shape";
4
- export declare const isPointOnShape: <Point extends GlobalPoint | LocalPoint>(point: Point, shape: GeometricShape<Point>, tolerance?: number) => boolean;
5
- export declare const isPointInShape: <Point extends GlobalPoint | LocalPoint>(point: Point, shape: GeometricShape<Point>) => boolean;
6
- export declare const isPointInBounds: <Point extends GlobalPoint | LocalPoint>(point: Point, bounds: Polygon<Point>) => boolean;
7
- export declare const pointOnCurve: <Point extends GlobalPoint | LocalPoint>(point: Point, curve: Curve<Point>, threshold: number) => boolean;
8
- export declare const pointOnPolyline: <Point extends GlobalPoint | LocalPoint>(point: Point, polyline: Polyline<Point>, threshold?: number) => boolean;