@zsviczian/excalidraw 0.18.0-5 → 0.18.0-6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zsviczian/excalidraw",
3
- "version": "0.18.0-5",
3
+ "version": "0.18.0-6",
4
4
  "main": "main.js",
5
5
  "module": "./dist/prod/index.js",
6
6
  "types": "types/excalidraw/index.d.ts",
@@ -82,6 +82,7 @@ export declare const YOUTUBE_STATES: {
82
82
  export declare const ENV: {
83
83
  TEST: string;
84
84
  DEVELOPMENT: string;
85
+ PRODUCTION: string;
85
86
  };
86
87
  export declare const CLASSES: {
87
88
  SHAPE_ACTIONS_MENU: string;
@@ -227,6 +228,7 @@ export declare const DEFAULT_EXPORT_PADDING = 10;
227
228
  export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 2880;
228
229
  export declare const MAX_ALLOWED_FILE_BYTES: number;
229
230
  export declare const SVG_NS = "http://www.w3.org/2000/svg";
231
+ 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";
230
232
  export declare const ENCRYPTION_KEY_BITS = 128;
231
233
  export declare const VERSIONS: {
232
234
  readonly excalidraw: 2;
@@ -180,6 +180,7 @@ export type Node<T> = T & {
180
180
  export declare const arrayToList: <T>(array: readonly T[]) => Node<T>[];
181
181
  export declare const isTestEnv: () => boolean;
182
182
  export declare const isDevEnv: () => boolean;
183
+ export declare const isProdEnv: () => boolean;
183
184
  export declare const isServerEnv: () => boolean;
184
185
  export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) => CustomEvent<{
185
186
  nativeEvent: T;
@@ -1,5 +1,6 @@
1
1
  import type { AppState } from "@excalidraw/excalidraw/types";
2
2
  import type { ExtractSetType } from "@excalidraw/common/utility-types";
3
+ import type { Radians } from "../../math/src";
3
4
  import type { MaybeTransformHandleType } from "./transformHandles";
4
5
  import type { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, NonDeletedExcalidrawElement } from "./types";
5
6
  export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, elementsMap: ElementsMap, informMutation?: boolean) => void;
@@ -19,7 +20,7 @@ export declare const getContainerCoords: (container: NonDeletedExcalidrawElement
19
20
  x: number;
20
21
  y: number;
21
22
  };
22
- export declare const getTextElementAngle: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null) => import("../../math/src").Radians;
23
+ export declare const getTextElementAngle: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null) => 0 | Radians;
23
24
  export declare const getBoundTextElementPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
24
25
  x: number;
25
26
  y: number;
@@ -9,9 +9,9 @@ import Scene from "../scene/Scene";
9
9
  import { Fonts } from "../fonts";
10
10
  import { Renderer } from "../scene/Renderer";
11
11
  import { Emitter } from "../emitter";
12
- import { AnimatedTrail } from "../animated-trail";
13
12
  import { LaserTrails } from "../laser-trails";
14
13
  import { LassoTrail } from "../lasso";
14
+ import { EraserTrail } from "../eraser";
15
15
  import type { ExportedElements } from "../data";
16
16
  import type { FileSystemHandle } from "../data/filesystem";
17
17
  import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
@@ -96,7 +96,7 @@ declare class App extends React.Component<AppProps, AppState> {
96
96
  allowMobileMode: boolean;
97
97
  animationFrameHandler: AnimationFrameHandler;
98
98
  laserTrails: LaserTrails;
99
- eraserTrail: AnimatedTrail;
99
+ eraserTrail: EraserTrail;
100
100
  lassoTrail: LassoTrail;
101
101
  onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
102
102
  onPointerDownEmitter: Emitter<[activeTool: {
@@ -138,6 +138,10 @@ declare class App extends React.Component<AppProps, AppState> {
138
138
  hit: {
139
139
  element: NonDeleted<ExcalidrawElement> | null;
140
140
  allHitElements: NonDeleted<ExcalidrawElement>[];
141
+ /**
142
+ * Returns gridSize taking into account `gridModeEnabled`.
143
+ * If disabled, returns null.
144
+ */
141
145
  wasAddedToSelection: boolean;
142
146
  hasBeenDuplicated: boolean;
143
147
  hasHitCommonBoundingBoxOfSelectedElements: boolean;
@@ -203,6 +207,10 @@ declare class App extends React.Component<AppProps, AppState> {
203
207
  hit: {
204
208
  element: NonDeleted<ExcalidrawElement> | null;
205
209
  allHitElements: NonDeleted<ExcalidrawElement>[];
210
+ /**
211
+ * Returns gridSize taking into account `gridModeEnabled`.
212
+ * If disabled, returns null.
213
+ */
206
214
  wasAddedToSelection: boolean;
207
215
  hasBeenDuplicated: boolean;
208
216
  hasHitCommonBoundingBoxOfSelectedElements: boolean;
@@ -447,7 +455,7 @@ declare class App extends React.Component<AppProps, AppState> {
447
455
  private getTextElementAtPosition;
448
456
  private getElementAtPosition;
449
457
  private getElementsAtPosition;
450
- private getElementHitThreshold;
458
+ getElementHitThreshold(): number;
451
459
  private hitElement;
452
460
  private getTextBindableContainerAtPosition;
453
461
  private startTextEditing;
@@ -0,0 +1,14 @@
1
+ import { AnimatedTrail } from "../animated-trail";
2
+ import type { AnimationFrameHandler } from "../animation-frame-handler";
3
+ import type App from "../components/App";
4
+ export declare class EraserTrail extends AnimatedTrail {
5
+ private elementsToErase;
6
+ private groupsToErase;
7
+ private segmentsCache;
8
+ private geometricShapesCache;
9
+ constructor(animationFrameHandler: AnimationFrameHandler, app: App);
10
+ startPath(x: number, y: number): void;
11
+ addPointToPath(x: number, y: number, restore?: boolean): string[];
12
+ private updateElementsToBeErased;
13
+ endPath(): void;
14
+ }
@@ -1,6 +1,5 @@
1
- import type { GlobalPoint, LineSegment } from "@excalidraw/math/types";
1
+ import type { ElementsSegmentsMap, GlobalPoint } from "@excalidraw/math/types";
2
2
  import type { ExcalidrawElement } from "@excalidraw/element/types";
3
- export type ElementsSegmentsMap = Map<string, LineSegment<GlobalPoint>[]>;
4
3
  export declare const getLassoSelectedElementIds: (input: {
5
4
  lassoPath: GlobalPoint[];
6
5
  elements: readonly ExcalidrawElement[];
@@ -103,3 +103,4 @@ export type Ellipse<Point extends GlobalPoint | LocalPoint> = {
103
103
  } & {
104
104
  _brand: "excalimath_ellipse";
105
105
  };
106
+ export type ElementsSegmentsMap = Map<string, LineSegment<GlobalPoint>[]>;