@excalidraw/excalidraw 0.15.2-6546-da8e97a → 0.15.2-6546-7560b59

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": "@excalidraw/excalidraw",
3
- "version": "0.15.2-6546-da8e97a",
3
+ "version": "0.15.2-6546-7560b59",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -0,0 +1,4 @@
1
+ import { ExcalidrawElement } from "../element/types";
2
+ import { ImportedDataState } from "./types";
3
+ export declare const ELEMENTS_SUPPORTING_PROGRAMMATIC_API: string[];
4
+ export declare const convertToExcalidrawElements: (elements: ImportedDataState["elements"]) => ExcalidrawElement[];
@@ -1,9 +1,9 @@
1
- import { Arrowhead, ExcalidrawBindableElement, ExcalidrawElement, FontFamilyValues, TextAlign, VerticalAlign } from "../element/types";
1
+ import { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawGenericElement, ExcalidrawLinearElement, ExcalidrawTextElement, FontFamilyValues, TextAlign, VerticalAlign } from "../element/types";
2
2
  import { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion } from "../types";
3
3
  import type { cleanAppStateForExport } from "../appState";
4
4
  import { VERSIONS } from "../constants";
5
5
  import { MarkOptional } from "../utility-types";
6
- import { ElementConstructorOpts, ELEMENTS_SUPPORTING_PROGRAMMATIC_API } from "../element/newElement";
6
+ import { ElementConstructorOpts } from "../element/newElement";
7
7
  export interface ExportedDataState {
8
8
  type: string;
9
9
  version: number;
@@ -27,17 +27,8 @@ export interface ImportedDataState {
27
27
  type?: string;
28
28
  version?: number;
29
29
  source?: string;
30
- elements?: readonly ((ExcalidrawElement & {
31
- id?: ExcalidrawElement["id"];
32
- label?: {
33
- text: string;
34
- fontSize?: number;
35
- fontFamily?: FontFamilyValues;
36
- textAlign?: TextAlign;
37
- verticalAlign?: VerticalAlign;
38
- } & MarkOptional<ElementConstructorOpts, "x" | "y">;
39
- } & ElementConstructorOpts) | ({
40
- type: Exclude<typeof ELEMENTS_SUPPORTING_PROGRAMMATIC_API[number], "text">;
30
+ elements?: readonly (({
31
+ type: Exclude<ExcalidrawElement["type"], "text">;
41
32
  id?: ExcalidrawElement["id"];
42
33
  label?: {
43
34
  text: string;
@@ -49,8 +40,11 @@ export interface ImportedDataState {
49
40
  } & ElementConstructorOpts) | ({
50
41
  type: "text";
51
42
  text: string;
52
- } & ElementConstructorOpts) | ({
53
- type: "arrow";
43
+ id?: ExcalidrawTextElement["id"];
44
+ } & Partial<ExcalidrawTextElement>) | ({
45
+ type: ExcalidrawLinearElement["type"];
46
+ x: number;
47
+ y: number;
54
48
  label?: {
55
49
  text: string;
56
50
  fontSize?: number;
@@ -59,13 +53,14 @@ export interface ImportedDataState {
59
53
  verticalAlign?: VerticalAlign;
60
54
  } & MarkOptional<ElementConstructorOpts, "x" | "y">;
61
55
  start?: {
62
- type: ExcalidrawBindableElement["type"];
56
+ type: Exclude<ExcalidrawBindableElement["type"], "image" | "selection" | "text">;
57
+ id?: ExcalidrawGenericElement["id"];
63
58
  } & MarkOptional<ElementConstructorOpts, "x" | "y">;
64
59
  end?: {
65
- type: ExcalidrawBindableElement["type"];
60
+ type: ExcalidrawGenericElement["type"];
61
+ id?: ExcalidrawGenericElement["id"];
66
62
  } & MarkOptional<ElementConstructorOpts, "x" | "y">;
67
- endArrowhead?: Arrowhead | null;
68
- } & ElementConstructorOpts))[] | null;
63
+ } & Partial<ExcalidrawLinearElement>))[] | null;
69
64
  appState?: Readonly<Partial<AppState & {
70
65
  [T in keyof LegacyAppState]: LegacyAppState[T][0];
71
66
  }>> | null;
@@ -1,8 +1,6 @@
1
1
  import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer } from "../element/types";
2
2
  import { AppState } from "../types";
3
3
  import { MarkOptional, Mutable } from "../utility-types";
4
- import { ImportedDataState } from "../data/types";
5
- export declare const ELEMENTS_SUPPORTING_PROGRAMMATIC_API: string[];
6
4
  export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
7
5
  export declare const newElement: (opts: {
8
6
  type: ExcalidrawGenericElement["type"];
@@ -13,7 +11,7 @@ export declare const newTextElement: (opts: {
13
11
  fontFamily?: FontFamilyValues;
14
12
  textAlign?: TextAlign;
15
13
  verticalAlign?: VerticalAlign;
16
- containerId?: ExcalidrawTextContainer["id"];
14
+ containerId?: ExcalidrawTextContainer["id"] | null;
17
15
  lineHeight?: ExcalidrawTextElement["lineHeight"];
18
16
  strokeWidth?: ExcalidrawTextElement["strokeWidth"];
19
17
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
@@ -57,6 +55,11 @@ export declare const newImageElement: (opts: {
57
55
  * Typed arrays and other non-null objects.
58
56
  */
59
57
  export declare const deepCopyElement: <T extends ExcalidrawElement>(val: T) => Mutable<T>;
58
+ /**
59
+ * utility wrapper to generate new id. In test env it reuses the old + postfix
60
+ * for test assertions.
61
+ */
62
+ export declare const regenerateId: (previousId: string | null) => string;
60
63
  /**
61
64
  * Duplicate an element, often used in the alt-drag operation.
62
65
  * Note that this method has gotten a bit complicated since the
@@ -86,4 +89,3 @@ export declare const duplicateElements: (elements: readonly ExcalidrawElement[],
86
89
  /** NOTE also updates version flags and `updated` */
87
90
  randomizeSeed: boolean;
88
91
  }) => ExcalidrawElement[];
89
- export declare const convertToExcalidrawElements: (elements: ImportedDataState["elements"]) => ExcalidrawElement[];
@@ -1,8 +1,7 @@
1
- import { ExcalidrawElement, ExcalidrawGenericElement, ExcalidrawLinearElement, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./types";
1
+ import { ExcalidrawElement, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./types";
2
2
  import { MaybeTransformHandleType } from "./transformHandles";
3
3
  import { AppState } from "../types";
4
- import { ExtractSetType, MarkOptional } from "../utility-types";
5
- import { ElementConstructorOpts } from "./newElement";
4
+ import { ExtractSetType } from "../utility-types";
6
5
  export declare const normalizeText: (text: string) => string;
7
6
  export declare const splitIntoLines: (text: string) => string[];
8
7
  export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
@@ -80,8 +79,3 @@ export declare const isMeasureTextSupported: () => boolean;
80
79
  export declare const getDefaultLineHeight: (fontFamily: FontFamilyValues) => number & {
81
80
  _brand: "unitlessLineHeight";
82
81
  };
83
- export declare const bindTextToContainer: (containerProps: ({
84
- type: Exclude<ExcalidrawGenericElement["type"], "selection"> | ExcalidrawLinearElement["type"];
85
- } & MarkOptional<ElementConstructorOpts, "x" | "y">), textProps: {
86
- text: string;
87
- } & MarkOptional<ElementConstructorOpts, "x" | "y">) => (ExcalidrawTextElement | import("./types").NonDeleted<ExcalidrawLinearElement> | import("./types").NonDeleted<ExcalidrawGenericElement>)[];
@@ -16,8 +16,8 @@ export declare const OMIT_SIDES_FOR_MULTIPLE_ELEMENTS: {
16
16
  export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [number, number, number, number, number, number], angle: number, zoom: Zoom, pointerType: PointerType, omitSides?: {
17
17
  s?: boolean | undefined;
18
18
  e?: boolean | undefined;
19
- w?: boolean | undefined;
20
19
  n?: boolean | undefined;
20
+ w?: boolean | undefined;
21
21
  nw?: boolean | undefined;
22
22
  ne?: boolean | undefined;
23
23
  sw?: boolean | undefined;