@zsviczian/excalidraw 0.14.2-obsidian-5 → 0.15.2-obsidian-1
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/README.md +2 -2
- package/dist/excalidraw.development.js +88 -109
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +3 -0
- package/types/actions/actionBoundText.d.ts +4 -2
- package/types/actions/actionCanvas.d.ts +10 -0
- package/types/actions/actionClipboard.d.ts +5 -0
- package/types/actions/actionDeleteSelected.d.ts +3 -0
- package/types/actions/actionExport.d.ts +9 -0
- package/types/actions/actionFinalize.d.ts +2 -0
- package/types/actions/actionLinearEditor.d.ts +1 -0
- package/types/actions/actionMenu.d.ts +5 -2
- package/types/actions/actionProperties.d.ts +13 -0
- package/types/actions/actionStyles.d.ts +1 -0
- package/types/actions/actionToggleGridMode.d.ts +1 -0
- package/types/actions/actionToggleLock.d.ts +1 -0
- package/types/actions/actionToggleStats.d.ts +1 -0
- package/types/actions/actionToggleViewMode.d.ts +1 -0
- package/types/actions/actionToggleZenMode.d.ts +1 -0
- package/types/actions/types.d.ts +1 -1
- package/types/constants.d.ts +29 -7
- package/types/data/blob.d.ts +2 -2
- package/types/data/filesystem.d.ts +2 -1
- package/types/element/Hyperlink.d.ts +1 -0
- package/types/element/image.d.ts +11 -1
- package/types/element/linearElementEditor.d.ts +2 -4
- package/types/element/newElement.d.ts +26 -7
- package/types/element/textElement.d.ts +1 -0
- package/types/renderer/renderElement.d.ts +1 -0
- package/types/scene/export.d.ts +4 -1
- package/types/types.d.ts +5 -4
|
@@ -1,19 +1,20 @@
|
|
|
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
|
-
declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElements" | "seed" | "version" | "versionNonce" | "link">;
|
|
4
|
+
declare 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">;
|
|
5
5
|
export declare const newElement: (opts: {
|
|
6
6
|
type: ExcalidrawGenericElement["type"];
|
|
7
7
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
8
8
|
export declare const newTextElement: (opts: {
|
|
9
9
|
text: string;
|
|
10
10
|
rawText: string;
|
|
11
|
-
fontSize
|
|
12
|
-
fontFamily
|
|
13
|
-
textAlign
|
|
14
|
-
verticalAlign
|
|
11
|
+
fontSize?: number;
|
|
12
|
+
fontFamily?: FontFamilyValues;
|
|
13
|
+
textAlign?: TextAlign;
|
|
14
|
+
verticalAlign?: VerticalAlign;
|
|
15
15
|
containerId?: ExcalidrawTextContainer["id"];
|
|
16
16
|
lineHeight?: ExcalidrawTextElement["lineHeight"];
|
|
17
|
+
strokeWidth?: ExcalidrawTextElement["strokeWidth"];
|
|
17
18
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
18
19
|
export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, text?: string) => {
|
|
19
20
|
x: number;
|
|
@@ -47,7 +48,16 @@ export declare const newImageElement: (opts: {
|
|
|
47
48
|
fileId?: ExcalidrawImageElement["fileId"];
|
|
48
49
|
scale?: ExcalidrawImageElement["scale"];
|
|
49
50
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
|
|
50
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Clones ExcalidrawElement data structure. Does not regenerate id, nonce, or
|
|
53
|
+
* any value. The purpose is to to break object references for immutability
|
|
54
|
+
* reasons, whenever we want to keep the original element, but ensure it's not
|
|
55
|
+
* mutated.
|
|
56
|
+
*
|
|
57
|
+
* Only clones plain objects and arrays. Doesn't clone Date, RegExp, Map, Set,
|
|
58
|
+
* Typed arrays and other non-null objects.
|
|
59
|
+
*/
|
|
60
|
+
export declare const deepCopyElement: <T extends ExcalidrawElement>(val: T) => Mutable<T>;
|
|
51
61
|
/**
|
|
52
62
|
* Duplicate an element, often used in the alt-drag operation.
|
|
53
63
|
* Note that this method has gotten a bit complicated since the
|
|
@@ -62,5 +72,14 @@ export declare const deepCopyElement: (val: any, depth?: number) => any;
|
|
|
62
72
|
* @param element Element to duplicate
|
|
63
73
|
* @param overrides Any element properties to override
|
|
64
74
|
*/
|
|
65
|
-
export declare const duplicateElement: <TElement extends
|
|
75
|
+
export declare const duplicateElement: <TElement extends ExcalidrawElement>(editingGroupId: AppState["editingGroupId"], groupIdMapForOperation: Map<GroupId, GroupId>, element: TElement, overrides?: Partial<TElement> | undefined) => Readonly<TElement>;
|
|
76
|
+
/**
|
|
77
|
+
* Clones elements, regenerating their ids (including bindings) and group ids.
|
|
78
|
+
*
|
|
79
|
+
* If bindings don't exist in the elements array, they are removed. Therefore,
|
|
80
|
+
* it's advised to supply the whole elements array, or sets of elements that
|
|
81
|
+
* are encapsulated (such as library items), if the purpose is to retain
|
|
82
|
+
* bindings to the cloned elements intact.
|
|
83
|
+
*/
|
|
84
|
+
export declare const duplicateElements: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
66
85
|
export {};
|
|
@@ -32,6 +32,7 @@ export declare const getLineHeightInPx: (fontSize: ExcalidrawTextElement["fontSi
|
|
|
32
32
|
export declare const getApproxMinLineHeight: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
33
33
|
export declare const getTextWidth: (text: string, font: FontString) => number;
|
|
34
34
|
export declare const getTextHeight: (text: string, fontSize: number, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
35
|
+
export declare const parseTokens: (text: string) => string[];
|
|
35
36
|
export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
|
|
36
37
|
export declare const charWidth: {
|
|
37
38
|
calculate: (char: string, font: FontString) => number;
|
|
@@ -9,6 +9,7 @@ export interface ExcalidrawElementWithCanvas {
|
|
|
9
9
|
canvas: HTMLCanvasElement;
|
|
10
10
|
theme: RenderConfig["theme"];
|
|
11
11
|
scale: number;
|
|
12
|
+
zoomValue: RenderConfig["zoom"]["value"];
|
|
12
13
|
canvasOffsetX: number;
|
|
13
14
|
canvasOffsetY: number;
|
|
14
15
|
boundTextElementVersion: number | null;
|
package/types/scene/export.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, BinaryFiles } from "../types";
|
|
3
|
+
import { serializeAsJSON } from "../data/json";
|
|
3
4
|
export declare const SVG_EXPORT_TAG = "<!-- svg-source:excalidraw -->";
|
|
4
5
|
export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, }: {
|
|
5
6
|
exportBackground: boolean;
|
|
@@ -16,5 +17,7 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
16
17
|
viewBackgroundColor: string;
|
|
17
18
|
exportWithDarkMode?: boolean;
|
|
18
19
|
exportEmbedScene?: boolean;
|
|
19
|
-
}, files: BinaryFiles | null
|
|
20
|
+
}, files: BinaryFiles | null, opts?: {
|
|
21
|
+
serializeAsJSON?: () => string;
|
|
22
|
+
}) => Promise<SVGSVGElement>;
|
|
20
23
|
export declare const getExportSize: (elements: readonly NonDeletedExcalidrawElement[], exportPadding: number, scale: number) => [number, number];
|
package/types/types.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ import { isOverScrollBars } from "./scene";
|
|
|
13
13
|
import { MaybeTransformHandleType } from "./element/transformHandles";
|
|
14
14
|
import Library from "./data/library";
|
|
15
15
|
import type { FileSystemHandle } from "./data/filesystem";
|
|
16
|
-
import type {
|
|
16
|
+
import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
|
17
17
|
import { ContextMenuItems } from "./components/ContextMenu";
|
|
18
|
-
import { Merge, ForwardRef } from "./utility-types";
|
|
18
|
+
import { Merge, ForwardRef, ValueOf } from "./utility-types";
|
|
19
19
|
import React from "react";
|
|
20
20
|
export declare type Point = Readonly<RoughPoint>;
|
|
21
21
|
export declare type Collaborator = {
|
|
@@ -38,7 +38,7 @@ export declare type DataURL = string & {
|
|
|
38
38
|
_brand: "DataURL";
|
|
39
39
|
};
|
|
40
40
|
export declare type BinaryFileData = {
|
|
41
|
-
mimeType: typeof
|
|
41
|
+
mimeType: ValueOf<typeof IMAGE_MIME_TYPES> | typeof MIME_TYPES.binary;
|
|
42
42
|
id: FileId;
|
|
43
43
|
dataURL: DataURL;
|
|
44
44
|
/**
|
|
@@ -186,6 +186,7 @@ export declare type AppState = {
|
|
|
186
186
|
resetCustomPen?: any;
|
|
187
187
|
gridColor: string;
|
|
188
188
|
dynamicStyle: string;
|
|
189
|
+
invertBindingBehaviour: boolean;
|
|
189
190
|
selectedLinearElement: LinearElementEditor | null;
|
|
190
191
|
};
|
|
191
192
|
export declare type NormalizedZoomValue = number & {
|
|
@@ -333,7 +334,7 @@ export declare type AppClassProperties = {
|
|
|
333
334
|
library: Library;
|
|
334
335
|
imageCache: Map<FileId, {
|
|
335
336
|
image: HTMLImageElement | Promise<HTMLImageElement>;
|
|
336
|
-
mimeType: typeof
|
|
337
|
+
mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
337
338
|
}>;
|
|
338
339
|
files: BinaryFiles;
|
|
339
340
|
device: App["device"];
|