@zsviczian/excalidraw 0.12.0-obsidian-9 → 0.12.0-obsidian-10

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.
@@ -14,7 +14,7 @@ export declare type ActionResult = {
14
14
  declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
15
15
  export declare type UpdaterFn = (res: ActionResult) => void;
16
16
  export declare type ActionFilterFn = (action: Action) => void;
17
- export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser" | "bindText" | "toggleLock";
17
+ export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser" | "bindText" | "toggleLock" | "toggleLinearEditor";
18
18
  export declare type PanelComponentProps = {
19
19
  elements: readonly ExcalidrawElement[];
20
20
  appState: AppState;
@@ -35,7 +35,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
35
35
  currentItemOpacity?: number | undefined;
36
36
  currentItemFontFamily?: number | undefined;
37
37
  currentItemFontSize?: number | undefined;
38
- currentItemTextAlign?: import("./element/types").TextAlign | undefined;
38
+ currentItemTextAlign?: string | undefined;
39
39
  currentItemStrokeSharpness?: import("./element/types").StrokeSharpness | undefined;
40
40
  currentItemStartArrowhead?: import("./element/types").Arrowhead | null | undefined;
41
41
  currentItemEndArrowhead?: import("./element/types").Arrowhead | null | undefined;
@@ -87,6 +87,13 @@ export declare const MIME_TYPES: {
87
87
  readonly "excalidraw.png": "image/png";
88
88
  readonly jpg: "image/jpeg";
89
89
  readonly gif: "image/gif";
90
+ readonly webp: "image/webp";
91
+ readonly bmp: "image/bmp";
92
+ readonly ico: "image/x-icon";
93
+ readonly heic: "image/heic";
94
+ readonly heif: "image/heif";
95
+ readonly tif: "image/tif";
96
+ readonly tiff: "image/tiff";
90
97
  readonly binary: "application/octet-stream";
91
98
  };
92
99
  export declare const EXPORT_DATA_TYPES: {
@@ -128,7 +135,7 @@ export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
128
135
  export declare const EXPORT_SCALES: number[];
129
136
  export declare const DEFAULT_EXPORT_PADDING = 10;
130
137
  export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
131
- export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif"];
138
+ export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif", "image/webp", "image/bmp", "image/x-icon", "image/heic", "image/heif", "image/tif", "image/tiff"];
132
139
  export declare const MAX_ALLOWED_FILE_BYTES: number;
133
140
  export declare const SVG_NS = "http://www.w3.org/2000/svg";
134
141
  export declare const ENCRYPTION_KEY_BITS = 128;
@@ -142,7 +149,15 @@ export declare const VERTICAL_ALIGN: {
142
149
  MIDDLE: string;
143
150
  BOTTOM: string;
144
151
  };
152
+ export declare const TEXT_ALIGN: {
153
+ LEFT: string;
154
+ CENTER: string;
155
+ RIGHT: string;
156
+ };
145
157
  export declare const ELEMENT_READY_TO_ERASE_OPACITY = 20;
146
158
  export declare const COOKIES: {
147
159
  readonly AUTH_STATE_COOKIE: "excplus-auth";
148
160
  };
161
+ /** key containt id of precedeing elemnt id we use in reconciliation during
162
+ * collaboration */
163
+ export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
@@ -55,7 +55,7 @@ export declare const actionLink: {
55
55
  currentItemOpacity: number;
56
56
  currentItemFontFamily: number;
57
57
  currentItemFontSize: number;
58
- currentItemTextAlign: import("./types").TextAlign;
58
+ currentItemTextAlign: string;
59
59
  currentItemStrokeSharpness: import("./types").StrokeSharpness;
60
60
  currentItemStartArrowhead: import("./types").Arrowhead | null;
61
61
  currentItemEndArrowhead: import("./types").Arrowhead | null;
@@ -10,7 +10,7 @@ export declare const updateImageCache: ({ fileIds, files, imageCache, }: {
10
10
  }) => Promise<{
11
11
  imageCache: Map<FileId, {
12
12
  image: HTMLImageElement | Promise<HTMLImageElement>;
13
- mimeType: "image/svg+xml" | "image/png" | "image/jpeg" | "image/gif";
13
+ mimeType: "image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/heic" | "image/heif" | "image/tif" | "image/tiff";
14
14
  }>;
15
15
  /** includes errored files because they cache was updated nonetheless */
16
16
  updatedFiles: Map<FileId, true>;
@@ -142,7 +142,7 @@ export declare class LinearElementEditor {
142
142
  currentItemOpacity: number;
143
143
  currentItemFontFamily: number;
144
144
  currentItemFontSize: number;
145
- currentItemTextAlign: import("./types").TextAlign;
145
+ currentItemTextAlign: string;
146
146
  currentItemStrokeSharpness: import("./types").StrokeSharpness;
147
147
  currentItemStartArrowhead: import("./types").Arrowhead | null;
148
148
  currentItemEndArrowhead: import("./types").Arrowhead | null;
@@ -13,7 +13,9 @@ export declare const newTextElement: (opts: {
13
13
  verticalAlign: VerticalAlign;
14
14
  containerId?: ExcalidrawRectangleElement["id"];
15
15
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
16
- export declare const updateTextElement: (element: ExcalidrawTextElement, { text, isDeleted, originalText, rawText, link, }: {
16
+ export declare const getMaxContainerWidth: (container: ExcalidrawElement) => number;
17
+ export declare const getMaxContainerHeight: (container: ExcalidrawElement) => number;
18
+ export declare const updateTextElement: (textElement: ExcalidrawTextElement, { text, isDeleted, originalText, rawText, link, }: {
17
19
  text: string;
18
20
  isDeleted?: boolean | undefined;
19
21
  originalText: string;
@@ -33,6 +35,9 @@ export declare const newLinearElement: (opts: {
33
35
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawLinearElement>;
34
36
  export declare const newImageElement: (opts: {
35
37
  type: ExcalidrawImageElement["type"];
38
+ status?: ExcalidrawImageElement["status"];
39
+ fileId?: ExcalidrawImageElement["fileId"];
40
+ scale?: ExcalidrawImageElement["scale"];
36
41
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
37
42
  export declare const deepCopyElement: (val: any, depth?: number) => any;
38
43
  /**
@@ -1,6 +1,6 @@
1
1
  import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontString, NonDeletedExcalidrawElement } from "./types";
2
2
  import { MaybeTransformHandleType } from "./transformHandles";
3
- export declare const redrawTextBoundingBox: (element: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
3
+ export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
4
4
  export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
5
5
  export declare const handleBindTextResize: (element: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType) => void;
6
6
  export declare const measureText: (text: string, font: FontString, maxWidth?: number | null) => {
@@ -9,7 +9,7 @@ export declare const measureText: (text: string, font: FontString, maxWidth?: nu
9
9
  baseline: number;
10
10
  };
11
11
  export declare const getApproxLineHeight: (font: FontString) => number;
12
- export declare const wrapText: (text: string, font: FontString, containerWidth: number) => string;
12
+ export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
13
13
  export declare const charWidth: {
14
14
  calculate: (char: string, font: FontString) => number;
15
15
  getCache: (font: FontString) => number[];
@@ -24,3 +24,7 @@ export declare const getBoundTextElement: (element: ExcalidrawElement | null) =>
24
24
  export declare const getContainerElement: (element: (ExcalidrawElement & {
25
25
  containerId: ExcalidrawElement["id"] | null;
26
26
  }) | null) => ExcalidrawElement | null;
27
+ export declare const getContainerDims: (element: ExcalidrawElement) => {
28
+ width: number;
29
+ height: number;
30
+ };
@@ -1,5 +1,5 @@
1
1
  import { Point } from "../types";
2
- import { FONT_FAMILY, THEME, VERTICAL_ALIGN } from "../constants";
2
+ import { FONT_FAMILY, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
3
3
  export declare type ChartType = "bar" | "line";
4
4
  export declare type FillStyle = "hachure" | "cross-hatch" | "solid";
5
5
  export declare type FontFamilyKeys = keyof typeof FONT_FAMILY;
@@ -12,7 +12,7 @@ export declare type GroupId = string;
12
12
  export declare type PointerType = "mouse" | "pen" | "touch";
13
13
  export declare type StrokeSharpness = "round" | "sharp";
14
14
  export declare type StrokeStyle = "solid" | "dashed" | "dotted";
15
- export declare type TextAlign = "left" | "center" | "right";
15
+ export declare type TextAlign = typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
16
16
  declare type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
17
17
  export declare type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
18
18
  declare type _ExcalidrawElementBase = Readonly<{