@excalidraw/excalidraw 0.14.2-cef6094 → 0.14.2-dd4c333
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/dist/excalidraw.development.js +18 -18
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionDuplicateSelection.d.ts +1 -1
- package/types/actions/shortcuts.d.ts +1 -0
- package/types/actions/types.d.ts +1 -0
- package/types/data/blob.d.ts +1 -0
- package/types/element/mutateElement.d.ts +1 -0
- package/types/element/newElement.d.ts +1 -0
- package/types/element/textElement.d.ts +1 -0
- package/types/element/typeChecks.d.ts +1 -0
- package/types/element/types.d.ts +1 -0
- package/types/types.d.ts +1 -0
- package/types/utility-types.d.ts +22 -0
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ export declare const actionDuplicateSelection: {
|
|
|
9
9
|
perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => false | {
|
|
10
10
|
commitToHistory: true;
|
|
11
11
|
elements?: readonly ExcalidrawElement[] | null | undefined;
|
|
12
|
-
appState?: MarkOptional<AppState, "width" | "height" | "offsetTop" | "offsetLeft"> | null | undefined;
|
|
12
|
+
appState?: import("../utility-types").MarkOptional<AppState, "width" | "height" | "offsetTop" | "offsetLeft"> | null | undefined;
|
|
13
13
|
files?: import("../types").BinaryFiles | null | undefined;
|
|
14
14
|
syncHistory?: boolean | undefined;
|
|
15
15
|
replaceFiles?: boolean | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SubtypeOf } from "../utility-types";
|
|
1
2
|
import { ActionName } from "./types";
|
|
2
3
|
export declare type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleLock"> | "saveScene" | "imageExport";
|
|
3
4
|
export declare const getShortcutFromShortcutName: (name: ShortcutName) => string;
|
package/types/actions/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ExcalidrawElement } from "../element/types";
|
|
3
3
|
import { AppClassProperties, AppState, ExcalidrawProps, BinaryFiles } from "../types";
|
|
4
|
+
import { MarkOptional } from "../utility-types";
|
|
4
5
|
export declare type ActionSource = "ui" | "keyboard" | "contextMenu" | "api";
|
|
5
6
|
/** if false, the action should be prevented */
|
|
6
7
|
export declare type ActionResult = {
|
package/types/data/blob.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
|
|
2
2
|
import { ExcalidrawElement, FileId } from "../element/types";
|
|
3
3
|
import { AppState, DataURL, LibraryItem } from "../types";
|
|
4
|
+
import { ValueOf } from "../utility-types";
|
|
4
5
|
import { FileSystemHandle } from "./filesystem";
|
|
5
6
|
import { ImportedLibraryData } from "./types";
|
|
6
7
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./types";
|
|
2
|
+
import { Mutable } from "../utility-types";
|
|
2
3
|
declare type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce">;
|
|
3
4
|
export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
4
5
|
export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>) => TElement;
|
|
@@ -1,5 +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
|
+
import { MarkOptional, Mutable } from "../utility-types";
|
|
3
4
|
declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElements" | "seed" | "version" | "versionNonce" | "link">;
|
|
4
5
|
export declare const newElement: (opts: {
|
|
5
6
|
type: ExcalidrawGenericElement["type"];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
2
2
|
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
3
|
import { AppState } from "../types";
|
|
4
|
+
import { ExtractSetType } from "../utility-types";
|
|
4
5
|
export declare const normalizeText: (text: string) => string;
|
|
5
6
|
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
|
|
6
7
|
export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppState } from "../types";
|
|
2
|
+
import { MarkNonNullable } from "../utility-types";
|
|
2
3
|
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, RoundnessType } from "./types";
|
|
3
4
|
export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
|
|
4
5
|
export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
|
package/types/element/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Point } from "../types";
|
|
2
2
|
import { FONT_FAMILY, ROUNDNESS, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
|
|
3
|
+
import { MarkNonNullable, ValueOf } from "../utility-types";
|
|
3
4
|
export declare type ChartType = "bar" | "line";
|
|
4
5
|
export declare type FillStyle = "hachure" | "cross-hatch" | "solid";
|
|
5
6
|
export declare type FontFamilyKeys = keyof typeof FONT_FAMILY;
|
package/types/types.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import Library from "./data/library";
|
|
|
16
16
|
import type { FileSystemHandle } from "./data/filesystem";
|
|
17
17
|
import type { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
|
18
18
|
import { ContextMenuItems } from "./components/ContextMenu";
|
|
19
|
+
import { Merge, ForwardRef } from "./utility-types";
|
|
19
20
|
export declare type Point = Readonly<RoughPoint>;
|
|
20
21
|
export declare type Collaborator = {
|
|
21
22
|
pointer?: {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type Mutable<T> = {
|
|
3
|
+
-readonly [P in keyof T]: T[P];
|
|
4
|
+
};
|
|
5
|
+
export declare type ValueOf<T> = T[keyof T];
|
|
6
|
+
export declare type Merge<M, N> = Omit<M, keyof N> & N;
|
|
7
|
+
/** utility type to assert that the second type is a subtype of the first type.
|
|
8
|
+
* Returns the subtype. */
|
|
9
|
+
export declare type SubtypeOf<Supertype, Subtype extends Supertype> = Subtype;
|
|
10
|
+
export declare type ResolutionType<T extends (...args: any) => any> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
11
|
+
export declare type MarkOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
12
|
+
export declare type MarkRequired<T, RK extends keyof T> = Exclude<T, RK> & Required<Pick<T, RK>>;
|
|
13
|
+
export declare type MarkNonNullable<T, K extends keyof T> = {
|
|
14
|
+
[P in K]-?: P extends K ? NonNullable<T[P]> : T[P];
|
|
15
|
+
} & {
|
|
16
|
+
[P in keyof T]: T[P];
|
|
17
|
+
};
|
|
18
|
+
export declare type NonOptional<T> = Exclude<T, undefined>;
|
|
19
|
+
export declare type SignatureType<T> = T extends (...args: infer R) => any ? R : never;
|
|
20
|
+
export declare type CallableType<T extends (...args: any[]) => any> = (...args: SignatureType<T>) => ReturnType<T>;
|
|
21
|
+
export declare type ForwardRef<T, P = any> = Parameters<CallableType<React.ForwardRefRenderFunction<T, P>>>[1];
|
|
22
|
+
export declare type ExtractSetType<T extends Set<any>> = T extends Set<infer U> ? U : never;
|