@zsviczian/excalidraw 0.17.1-obsidian-51 → 0.17.1-obsidian-54
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 +6977 -0
- package/dist/excalidraw.production.min.js +2 -0
- package/dist/excalidraw.production.min.js.LICENSE.txt +121 -0
- package/dist/styles.development.css +6814 -0
- package/dist/styles.production.css +66 -0
- package/package.json +1 -1
- package/types/excalidraw/actions/actionCanvas.d.ts +20 -4
- package/types/excalidraw/actions/actionClipboard.d.ts +1 -0
- package/types/excalidraw/actions/actionDeleteSelected.d.ts +1 -0
- package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +2 -1
- package/types/excalidraw/components/App.d.ts +7 -8
- package/types/excalidraw/components/DefaultSidebar.d.ts +2 -2
- package/types/excalidraw/constants.d.ts +1 -3
- package/types/excalidraw/data/encode.d.ts +1 -0
- package/types/excalidraw/element/linearElementEditor.d.ts +1 -0
- package/types/excalidraw/element/newElement.d.ts +0 -1
- package/types/excalidraw/element/routing.d.ts +8 -6
- package/types/excalidraw/element/sizeHelpers.d.ts +2 -7
- package/types/excalidraw/element/typeChecks.d.ts +1 -1
- package/types/excalidraw/element/types.d.ts +1 -2
- package/types/excalidraw/obsidianUtils.d.ts +0 -1
- package/types/excalidraw/scene/Scene.d.ts +1 -1
- package/types/excalidraw/scene/ShapeCache.d.ts +1 -1
- package/types/excalidraw/scene/comparisons.d.ts +477 -1
- package/types/excalidraw/scene/scroll.d.ts +8 -2
- package/types/excalidraw/types.d.ts +6 -0
- package/types/excalidraw/visualdebug.d.ts +2 -2
- package/types/math/utils.d.ts +3 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExcalidrawElement } from "../element/types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AppState, Offsets, AppClassProperties } from "../types";
|
|
3
3
|
import type { SceneBounds } from "../element/bounds";
|
|
4
4
|
export declare const actionChangeViewBackgroundColor: {
|
|
5
5
|
name: "changeViewBackgroundColor";
|
|
@@ -864,13 +864,21 @@ export declare const actionResetZoom: {
|
|
|
864
864
|
} & {
|
|
865
865
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
866
866
|
};
|
|
867
|
-
export declare const zoomToFitBounds: ({ bounds, appState, fitToViewport, viewportZoomFactor, }: {
|
|
867
|
+
export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fitToViewport, viewportZoomFactor, minZoom, maxZoom, }: {
|
|
868
868
|
bounds: SceneBounds;
|
|
869
|
+
canvasOffsets?: Partial<{
|
|
870
|
+
top: number;
|
|
871
|
+
right: number;
|
|
872
|
+
bottom: number;
|
|
873
|
+
left: number;
|
|
874
|
+
}> | undefined;
|
|
869
875
|
appState: Readonly<AppState>;
|
|
870
876
|
/** whether to fit content to viewport (beyond >100%) */
|
|
871
877
|
fitToViewport: boolean;
|
|
872
878
|
/** zoom content to cover X of the viewport, when fitToViewport=true */
|
|
873
879
|
viewportZoomFactor?: number | undefined;
|
|
880
|
+
minZoom?: number | undefined;
|
|
881
|
+
maxZoom?: number | undefined;
|
|
874
882
|
}) => {
|
|
875
883
|
appState: {
|
|
876
884
|
scrollX: number;
|
|
@@ -1071,13 +1079,21 @@ export declare const zoomToFitBounds: ({ bounds, appState, fitToViewport, viewpo
|
|
|
1071
1079
|
};
|
|
1072
1080
|
storeAction: "none";
|
|
1073
1081
|
};
|
|
1074
|
-
export declare const zoomToFit: ({ targetElements, appState, fitToViewport, viewportZoomFactor, }: {
|
|
1082
|
+
export declare const zoomToFit: ({ canvasOffsets, targetElements, appState, fitToViewport, viewportZoomFactor, minZoom, maxZoom, }: {
|
|
1083
|
+
canvasOffsets?: Partial<{
|
|
1084
|
+
top: number;
|
|
1085
|
+
right: number;
|
|
1086
|
+
bottom: number;
|
|
1087
|
+
left: number;
|
|
1088
|
+
}> | undefined;
|
|
1075
1089
|
targetElements: readonly ExcalidrawElement[];
|
|
1076
1090
|
appState: Readonly<AppState>;
|
|
1077
1091
|
/** whether to fit content to viewport (beyond >100%) */
|
|
1078
1092
|
fitToViewport: boolean;
|
|
1079
1093
|
/** zoom content to cover X of the viewport, when fitToViewport=true */
|
|
1080
1094
|
viewportZoomFactor?: number | undefined;
|
|
1095
|
+
minZoom?: number | undefined;
|
|
1096
|
+
maxZoom?: number | undefined;
|
|
1081
1097
|
}) => {
|
|
1082
1098
|
appState: {
|
|
1083
1099
|
scrollX: number;
|
|
@@ -1708,7 +1724,7 @@ export declare const actionZoomToFit: {
|
|
|
1708
1724
|
trackEvent: {
|
|
1709
1725
|
category: "canvas";
|
|
1710
1726
|
};
|
|
1711
|
-
perform: (elements: readonly import("../element/types").OrderedExcalidrawElement[], appState: Readonly<AppState
|
|
1727
|
+
perform: (elements: readonly import("../element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: any, app: AppClassProperties) => {
|
|
1712
1728
|
appState: {
|
|
1713
1729
|
scrollX: number;
|
|
1714
1730
|
scrollY: number;
|
|
@@ -664,6 +664,7 @@ export declare const actionCut: {
|
|
|
664
664
|
}>;
|
|
665
665
|
hoverPointIndex: number;
|
|
666
666
|
segmentMidPointHoveredCoords: import("../../math").GlobalPoint | null;
|
|
667
|
+
elbowed: boolean;
|
|
667
668
|
};
|
|
668
669
|
contextMenu: {
|
|
669
670
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
@@ -241,6 +241,7 @@ export declare const actionDeleteSelected: {
|
|
|
241
241
|
}>;
|
|
242
242
|
hoverPointIndex: number;
|
|
243
243
|
segmentMidPointHoveredCoords: import("../../math").GlobalPoint | null;
|
|
244
|
+
elbowed: boolean;
|
|
244
245
|
};
|
|
245
246
|
contextMenu: {
|
|
246
247
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
@@ -8,7 +8,7 @@ import { LinearElementEditor } from "../element/linearElementEditor";
|
|
|
8
8
|
import type { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "../element/types";
|
|
9
9
|
import { History } from "../history";
|
|
10
10
|
import Scene from "../scene/Scene";
|
|
11
|
-
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize } from "../types";
|
|
11
|
+
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
|
|
12
12
|
import type { FileSystemHandle } from "../data/filesystem";
|
|
13
13
|
import { Fonts } from "../fonts";
|
|
14
14
|
import { Renderer } from "../scene/Renderer";
|
|
@@ -328,7 +328,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
328
328
|
*/
|
|
329
329
|
zoomCanvas: (value: number) => void;
|
|
330
330
|
private cancelInProgressAnimation;
|
|
331
|
-
scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[], opts?: {
|
|
331
|
+
scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
|
|
332
332
|
fitToContent?: boolean;
|
|
333
333
|
fitToViewport?: never;
|
|
334
334
|
viewportZoomFactor?: number;
|
|
@@ -343,6 +343,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
343
343
|
viewportZoomFactor?: number;
|
|
344
344
|
animate?: boolean;
|
|
345
345
|
duration?: number;
|
|
346
|
+
}) & {
|
|
347
|
+
minZoom?: number;
|
|
348
|
+
maxZoom?: number;
|
|
349
|
+
canvasOffsets?: Offsets;
|
|
346
350
|
}) => void;
|
|
347
351
|
private maybeUnfollowRemoteUser;
|
|
348
352
|
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
@@ -383,12 +387,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
383
387
|
force?: boolean | undefined;
|
|
384
388
|
}) => boolean;
|
|
385
389
|
private updateCurrentCursorPosition;
|
|
386
|
-
getEditorUIOffsets: () =>
|
|
387
|
-
top: number;
|
|
388
|
-
right: number;
|
|
389
|
-
bottom: number;
|
|
390
|
-
left: number;
|
|
391
|
-
};
|
|
390
|
+
getEditorUIOffsets: () => Offsets;
|
|
392
391
|
private onKeyDown;
|
|
393
392
|
private onKeyUp;
|
|
394
393
|
private isToolSupported;
|
|
@@ -22,9 +22,9 @@ export declare const DefaultSidebar: import("react").FC<Omit<MarkOptional<Omit<{
|
|
|
22
22
|
__fallback?: boolean | undefined;
|
|
23
23
|
}>;
|
|
24
24
|
TabTriggers: {
|
|
25
|
-
({ children
|
|
25
|
+
({ children }: {
|
|
26
26
|
children: React.ReactNode;
|
|
27
|
-
}
|
|
27
|
+
}): JSX.Element;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
@@ -273,13 +273,11 @@ export declare const DEFAULT_ELEMENT_PROPS: {
|
|
|
273
273
|
locked: ExcalidrawElement["locked"];
|
|
274
274
|
};
|
|
275
275
|
export declare const LIBRARY_SIDEBAR_TAB = "library";
|
|
276
|
+
export declare const CANVAS_SEARCH_TAB = "search";
|
|
276
277
|
export declare const DEFAULT_SIDEBAR: {
|
|
277
278
|
readonly name: "default";
|
|
278
279
|
readonly defaultTab: "library";
|
|
279
280
|
};
|
|
280
|
-
export declare const SEARCH_SIDEBAR: {
|
|
281
|
-
name: string;
|
|
282
|
-
};
|
|
283
281
|
export declare const LIBRARY_DISABLED_TYPES: Set<"image" | "iframe" | "embeddable">;
|
|
284
282
|
export declare const TOOL_TYPE: {
|
|
285
283
|
readonly selection: "selection";
|
|
@@ -5,6 +5,7 @@ export declare const toByteString: (data: string | Uint8Array | ArrayBuffer) =>
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const stringToBase64: (str: string, isByteString?: boolean) => Promise<string>;
|
|
7
7
|
export declare const base64ToString: (base64: string, isByteString?: boolean) => Promise<string>;
|
|
8
|
+
export declare const base64ToArrayBuffer: (base64: string) => ArrayBuffer;
|
|
8
9
|
type EncodedData = {
|
|
9
10
|
encoded: string;
|
|
10
11
|
encoding: "bstring";
|
|
@@ -41,6 +41,7 @@ export declare class LinearElementEditor {
|
|
|
41
41
|
readonly endBindingElement: ExcalidrawBindableElement | null | "keep";
|
|
42
42
|
readonly hoverPointIndex: number;
|
|
43
43
|
readonly segmentMidPointHoveredCoords: GlobalPoint | null;
|
|
44
|
+
readonly elbowed: boolean;
|
|
44
45
|
constructor(element: NonDeleted<ExcalidrawLinearElement>);
|
|
45
46
|
static POINT_HANDLE_SIZE: number;
|
|
46
47
|
/**
|
|
@@ -27,7 +27,6 @@ export declare const newTextElement: (opts: {
|
|
|
27
27
|
verticalAlign?: VerticalAlign;
|
|
28
28
|
containerId?: ExcalidrawTextContainer["id"] | null;
|
|
29
29
|
lineHeight?: ExcalidrawTextElement["lineHeight"];
|
|
30
|
-
strokeWidth?: ExcalidrawTextElement["strokeWidth"];
|
|
31
30
|
autoResize?: ExcalidrawTextElement["autoResize"];
|
|
32
31
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
33
32
|
export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, elementsMap: ElementsMap, text?: string) => {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type LocalPoint, type Vector } from "../../math";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
endBinding?: FixedPointBinding | null;
|
|
6
|
-
}, options?: {
|
|
2
|
+
import type { ElementUpdate } from "./mutateElement";
|
|
3
|
+
import type { ExcalidrawElbowArrowElement, NonDeletedSceneElementsMap, SceneElementsMap } from "./types";
|
|
4
|
+
export declare const mutateElbowArrow: (arrow: ExcalidrawElbowArrowElement, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, nextPoints: readonly LocalPoint[], offset?: Vector, otherUpdates?: Omit<ElementUpdate<ExcalidrawElbowArrowElement>, "angle" | "x" | "y" | "width" | "height" | "elbowed" | "points">, options?: {
|
|
7
5
|
isDragging?: boolean;
|
|
8
|
-
disableBinding?: boolean;
|
|
9
6
|
informMutation?: boolean;
|
|
10
7
|
}) => void;
|
|
8
|
+
export declare const updateElbowArrow: (arrow: ExcalidrawElbowArrowElement, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, nextPoints: readonly LocalPoint[], offset?: Vector, options?: {
|
|
9
|
+
isDragging?: boolean;
|
|
10
|
+
disableBinding?: boolean;
|
|
11
|
+
informMutation?: boolean;
|
|
12
|
+
}) => ElementUpdate<ExcalidrawElbowArrowElement> | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementsMap, ExcalidrawElement } from "./types";
|
|
2
|
-
import type { AppState, Zoom } from "../types";
|
|
2
|
+
import type { AppState, Offsets, Zoom } from "../types";
|
|
3
3
|
export declare const isInvisiblySmallElement: (element: ExcalidrawElement) => boolean;
|
|
4
4
|
export declare const isElementInViewport: (element: ExcalidrawElement, width: number, height: number, viewTransformations: {
|
|
5
5
|
zoom: Zoom;
|
|
@@ -14,12 +14,7 @@ export declare const isElementCompletelyInViewport: (elements: ExcalidrawElement
|
|
|
14
14
|
offsetTop: number;
|
|
15
15
|
scrollX: number;
|
|
16
16
|
scrollY: number;
|
|
17
|
-
}, elementsMap: ElementsMap, padding?:
|
|
18
|
-
top: number;
|
|
19
|
-
right: number;
|
|
20
|
-
bottom: number;
|
|
21
|
-
left: number;
|
|
22
|
-
}>) => boolean;
|
|
17
|
+
}, elementsMap: ElementsMap, padding?: Offsets) => boolean;
|
|
23
18
|
/**
|
|
24
19
|
* Makes a perfect shape or diagonal/horizontal/vertical line
|
|
25
20
|
*/
|
|
@@ -35,5 +35,5 @@ export declare const getDefaultRoundnessTypeForElement: (element: ExcalidrawElem
|
|
|
35
35
|
} | {
|
|
36
36
|
type: 3;
|
|
37
37
|
} | null;
|
|
38
|
-
export declare const isFixedPointBinding: (binding: PointBinding) => binding is FixedPointBinding;
|
|
38
|
+
export declare const isFixedPointBinding: (binding: PointBinding | FixedPointBinding) => binding is FixedPointBinding;
|
|
39
39
|
export declare const isBounds: (box: unknown) => box is Bounds;
|
|
@@ -149,7 +149,7 @@ export type ExcalidrawRectanguloidElement = ExcalidrawRectangleElement | Excalid
|
|
|
149
149
|
* no computed data. The list of all ExcalidrawElements should be shareable
|
|
150
150
|
* between peers and contain no state local to the peer.
|
|
151
151
|
*/
|
|
152
|
-
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
|
|
152
|
+
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawArrowElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
|
|
153
153
|
export type ExcalidrawNonSelectionElement = Exclude<ExcalidrawElement, ExcalidrawSelectionElement>;
|
|
154
154
|
export type Ordered<TElement extends ExcalidrawElement> = TElement & {
|
|
155
155
|
index: FractionalIndex;
|
|
@@ -194,7 +194,6 @@ export type PointBinding = {
|
|
|
194
194
|
elementId: ExcalidrawBindableElement["id"];
|
|
195
195
|
focus: number;
|
|
196
196
|
gap: number;
|
|
197
|
-
fixedPoint: FixedPoint | null;
|
|
198
197
|
};
|
|
199
198
|
export type FixedPointBinding = Merge<PointBinding, {
|
|
200
199
|
fixedPoint: FixedPoint;
|
|
@@ -15,4 +15,3 @@ export declare function registerLocalFont(fontMetrics: FontMetadata & {
|
|
|
15
15
|
export declare function getFontFamilies(): string[];
|
|
16
16
|
export declare function registerFontsInCSS(): Promise<void>;
|
|
17
17
|
export declare function getCSSFontDefinition(fontFamily: number): Promise<string>;
|
|
18
|
-
export declare function getArrayBufferFromBase64(url: string): ArrayBuffer;
|
|
@@ -73,6 +73,6 @@ declare class Scene {
|
|
|
73
73
|
getElementIndex(elementId: string): number;
|
|
74
74
|
getContainerElement: (element: (ExcalidrawElement & {
|
|
75
75
|
containerId: ExcalidrawElement["id"] | null;
|
|
76
|
-
}) | null) =>
|
|
76
|
+
}) | null) => import("../element/types").ExcalidrawSelectionElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawFreeDrawElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawMagicFrameElement | import("../element/types").ExcalidrawIframeElement | import("../element/types").ExcalidrawEmbeddableElement | null;
|
|
77
77
|
}
|
|
78
78
|
export default Scene;
|
|
@@ -17,7 +17,7 @@ export declare class ShapeCache {
|
|
|
17
17
|
* Generates & caches shape for element if not already cached, otherwise
|
|
18
18
|
* returns cached shape.
|
|
19
19
|
*/
|
|
20
|
-
static generateElementShape: <T extends import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawFreeDrawElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawMagicFrameElement | import("../element/types").ExcalidrawIframeElement | import("../element/types").ExcalidrawEmbeddableElement>(element: T, renderConfig: {
|
|
20
|
+
static generateElementShape: <T extends import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawArrowElement | import("../element/types").ExcalidrawFreeDrawElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawMagicFrameElement | import("../element/types").ExcalidrawIframeElement | import("../element/types").ExcalidrawEmbeddableElement>(element: T, renderConfig: {
|
|
21
21
|
isExporting: boolean;
|
|
22
22
|
canvasBackgroundColor: AppState["viewBackgroundColor"];
|
|
23
23
|
embedsValidationStatus: EmbedsValidationStatus;
|