@zsviczian/excalidraw 0.17.1-obsidian-19 → 0.17.1-obsidian-21
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 +267 -92
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/styles.development.css +1103 -854
- package/dist/styles.production.css +16 -15
- package/package.json +5 -3
- package/types/excalidraw/actions/actionAddToLibrary.d.ts +20 -5
- package/types/excalidraw/actions/actionAlign.d.ts +39 -27
- package/types/excalidraw/actions/actionBoundText.d.ts +20 -10
- package/types/excalidraw/actions/actionCanvas.d.ts +148 -52
- package/types/excalidraw/actions/actionClipboard.d.ts +72 -30
- package/types/excalidraw/actions/actionDeleteSelected.d.ts +25 -9
- package/types/excalidraw/actions/actionDistribute.d.ts +10 -8
- package/types/excalidraw/actions/actionDuplicateSelection.d.ts +7 -7
- package/types/excalidraw/actions/actionElementLock.d.ts +24 -11
- package/types/excalidraw/actions/actionExport.d.ts +85 -32
- package/types/excalidraw/actions/actionFinalize.d.ts +19 -8
- package/types/excalidraw/actions/actionFlip.d.ts +13 -11
- package/types/excalidraw/actions/actionFrame.d.ts +30 -200
- package/types/excalidraw/actions/actionGroup.d.ts +15 -379
- package/types/excalidraw/actions/actionHistory.d.ts +3 -2
- package/types/excalidraw/actions/actionLinearEditor.d.ts +9 -3
- package/types/excalidraw/actions/actionLink.d.ts +12 -6
- package/types/excalidraw/actions/actionMenu.d.ts +25 -8
- package/types/excalidraw/actions/actionNavigate.d.ts +14 -3
- package/types/excalidraw/actions/actionProperties.d.ts +114 -32
- package/types/excalidraw/actions/actionSelectAll.d.ts +12 -5
- package/types/excalidraw/actions/actionStyles.d.ts +18 -14
- package/types/excalidraw/actions/actionToggleGridMode.d.ts +12 -5
- package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +12 -6
- package/types/excalidraw/actions/actionToggleStats.d.ts +12 -5
- package/types/excalidraw/actions/actionToggleViewMode.d.ts +12 -5
- package/types/excalidraw/actions/actionToggleZenMode.d.ts +12 -5
- package/types/excalidraw/actions/actionZindex.d.ts +26 -23
- package/types/excalidraw/actions/manager.d.ts +3 -3
- package/types/excalidraw/actions/shortcuts.d.ts +2 -2
- package/types/excalidraw/actions/types.d.ts +10 -8
- package/types/excalidraw/appState.d.ts +4 -4
- package/types/excalidraw/change.d.ts +191 -0
- package/types/excalidraw/clients.d.ts +10 -1
- package/types/excalidraw/components/Actions.d.ts +3 -1
- package/types/excalidraw/components/App.d.ts +23 -9
- package/types/excalidraw/components/Avatar.d.ts +2 -3
- package/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +18 -0
- package/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +2 -0
- package/types/excalidraw/components/CommandPalette/types.d.ts +25 -0
- package/types/excalidraw/components/InlineIcon.d.ts +1 -1
- package/types/excalidraw/components/RadioGroup.d.ts +2 -1
- package/types/excalidraw/components/ToolButton.d.ts +1 -0
- package/types/excalidraw/components/UserList.d.ts +3 -7
- package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -1
- package/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +17 -0
- package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +2 -2
- package/types/excalidraw/components/icons.d.ts +26 -1
- package/types/excalidraw/components/main-menu/DefaultItems.d.ts +15 -1
- package/types/excalidraw/constants.d.ts +8 -0
- package/types/excalidraw/data/reconcile.d.ts +6 -0
- package/types/excalidraw/data/restore.d.ts +3 -3
- package/types/excalidraw/data/transform.d.ts +1 -1
- package/types/excalidraw/data/url.d.ts +1 -0
- package/types/excalidraw/deburr.d.ts +1 -0
- package/types/excalidraw/element/binding.d.ts +52 -9
- package/types/excalidraw/element/bounds.d.ts +0 -1
- package/types/excalidraw/element/collision.d.ts +14 -19
- package/types/excalidraw/element/embeddable.d.ts +14 -4
- package/types/excalidraw/element/index.d.ts +0 -1
- package/types/excalidraw/element/linearElementEditor.d.ts +17 -12
- package/types/excalidraw/element/mutateElement.d.ts +1 -2
- package/types/excalidraw/element/newElement.d.ts +1 -1
- package/types/excalidraw/element/resizeElements.d.ts +1 -1
- package/types/excalidraw/element/resizeTest.d.ts +4 -4
- package/types/excalidraw/element/textElement.d.ts +1 -7
- package/types/excalidraw/element/transformHandles.d.ts +22 -4
- package/types/excalidraw/element/typeChecks.d.ts +2 -2
- package/types/excalidraw/element/types.d.ts +22 -6
- package/types/excalidraw/errors.d.ts +3 -0
- package/types/excalidraw/fractionalIndex.d.ts +40 -0
- package/types/excalidraw/frame.d.ts +1 -1
- package/types/excalidraw/groups.d.ts +2 -0
- package/types/excalidraw/history.d.ts +34 -46
- package/types/excalidraw/hooks/useEmitter.d.ts +2 -0
- package/types/excalidraw/hooks/useStableCallback.d.ts +4 -0
- package/types/excalidraw/index.d.ts +3 -1
- package/types/excalidraw/keys.d.ts +1 -0
- package/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/types/excalidraw/scene/Scene.d.ts +7 -6
- package/types/excalidraw/scene/types.d.ts +11 -20
- package/types/excalidraw/store.d.ts +99 -0
- package/types/excalidraw/types.d.ts +39 -6
- package/types/excalidraw/utils.d.ts +7 -0
- package/types/excalidraw/webpack.prod.config.d.ts +1 -1
- package/types/excalidraw/zindex.d.ts +2 -2
- package/types/utils/collision.d.ts +4 -0
- package/types/utils/export.d.ts +2 -2
- package/types/utils/geometry/geometry.d.ts +71 -0
- package/types/utils/geometry/shape.d.ts +56 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OrderedExcalidrawElement } from "../element/types";
|
|
2
|
+
import { AppState } from "../types";
|
|
3
|
+
import { MakeBrand } from "../utility-types";
|
|
4
|
+
export type ReconciledExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"ReconciledElement">;
|
|
5
|
+
export type RemoteExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"RemoteExcalidrawElement">;
|
|
6
|
+
export declare const reconcileElements: (localElements: readonly OrderedExcalidrawElement[], remoteElements: readonly RemoteExcalidrawElement[], localAppState: AppState) => ReconciledExcalidrawElement[];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ExcalidrawElement } from "../element/types";
|
|
1
|
+
import { ExcalidrawElement, OrderedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, BinaryFiles, LibraryItem } from "../types";
|
|
3
3
|
import { ImportedDataState } from "./types";
|
|
4
4
|
type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
5
5
|
export declare const AllowedExcalidrawActiveTools: Record<AppState["activeTool"]["type"], boolean>;
|
|
6
6
|
export type RestoredDataState = {
|
|
7
|
-
elements:
|
|
7
|
+
elements: OrderedExcalidrawElement[];
|
|
8
8
|
appState: RestoredAppState;
|
|
9
9
|
files: BinaryFiles;
|
|
10
10
|
};
|
|
11
11
|
export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, opts?: {
|
|
12
12
|
refreshDimensions?: boolean;
|
|
13
13
|
repairBindings?: boolean;
|
|
14
|
-
} | undefined) =>
|
|
14
|
+
} | undefined) => OrderedExcalidrawElement[];
|
|
15
15
|
export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
|
|
16
16
|
export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined, elementsConfig?: {
|
|
17
17
|
refreshDimensions?: boolean;
|
|
@@ -78,4 +78,4 @@ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, Excal
|
|
|
78
78
|
} & Partial<ExcalidrawMagicFrameElement>);
|
|
79
79
|
export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
|
|
80
80
|
regenerateIds: boolean;
|
|
81
|
-
}) =>
|
|
81
|
+
}) => import("../element/types").OrderedExcalidrawElement[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const deburr: (str: string) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppState } from "../types";
|
|
3
|
-
import
|
|
1
|
+
import { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap } from "./types";
|
|
2
|
+
import { AppClassProperties, AppState, Point } from "../types";
|
|
3
|
+
import { ElementUpdate } from "./mutateElement";
|
|
4
4
|
export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
|
|
5
5
|
export type SuggestedPointBinding = [
|
|
6
6
|
NonDeleted<ExcalidrawLinearElement>,
|
|
@@ -10,18 +10,18 @@ export type SuggestedPointBinding = [
|
|
|
10
10
|
export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<HTMLElement>) => boolean;
|
|
11
11
|
export declare const isBindingEnabled: (appState: AppState) => boolean;
|
|
12
12
|
export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", elementsMap: NonDeletedSceneElementsMap) => void;
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
13
|
+
export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], app: AppClassProperties, isBindingEnabled: boolean, draggingPoints: readonly number[] | null) => void;
|
|
14
|
+
export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], app: AppClassProperties) => SuggestedBinding[];
|
|
15
|
+
export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
|
|
15
16
|
x: number;
|
|
16
17
|
y: number;
|
|
17
|
-
},
|
|
18
|
+
}, app: AppClassProperties) => void;
|
|
18
19
|
export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: NonDeletedSceneElementsMap) => void;
|
|
19
20
|
export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
|
|
20
|
-
export declare const unbindLinearElements: (elements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap) => void;
|
|
21
21
|
export declare const getHoveredElementForBinding: (pointerCoords: {
|
|
22
22
|
x: number;
|
|
23
23
|
y: number;
|
|
24
|
-
},
|
|
24
|
+
}, app: AppClassProperties) => NonDeleted<ExcalidrawBindableElement> | null;
|
|
25
25
|
export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, elementsMap: ElementsMap, options?: {
|
|
26
26
|
simultaneouslyUpdated?: readonly ExcalidrawElement[];
|
|
27
27
|
newSize?: {
|
|
@@ -29,6 +29,49 @@ export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawE
|
|
|
29
29
|
height: number;
|
|
30
30
|
};
|
|
31
31
|
}) => void;
|
|
32
|
-
export declare const getEligibleElementsForBinding: (selectedElements: NonDeleted<ExcalidrawElement>[], elements: readonly ExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap) => SuggestedBinding[];
|
|
33
32
|
export declare const fixBindingsAfterDuplication: (sceneElements: readonly ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicatesServeAsOld?: "duplicatesServeAsOld" | undefined) => void;
|
|
34
33
|
export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
|
|
34
|
+
export declare const maxBindingGap: (element: ExcalidrawElement, elementWidth: number, elementHeight: number) => number;
|
|
35
|
+
export declare const determineFocusDistance: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], elementsMap: ElementsMap) => number;
|
|
36
|
+
export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap: number | undefined, elementsMap: ElementsMap) => Point[];
|
|
37
|
+
export declare const bindingProperties: Set<BindableProp | BindingProp>;
|
|
38
|
+
export type BindableProp = "boundElements";
|
|
39
|
+
export type BindingProp = "frameId" | "containerId" | "startBinding" | "endBinding";
|
|
40
|
+
/**
|
|
41
|
+
* Bound element containing bindings to `frameId`, `containerId`, `startBinding` or `endBinding`.
|
|
42
|
+
*/
|
|
43
|
+
export declare class BoundElement {
|
|
44
|
+
/**
|
|
45
|
+
* Unbind the affected non deleted bindable elements (removing element from `boundElements`).
|
|
46
|
+
* - iterates non deleted bindable elements (`containerId` | `startBinding.elementId` | `endBinding.elementId`) of the current element
|
|
47
|
+
* - prepares updates to unbind each bindable element's `boundElements` from the current element
|
|
48
|
+
*/
|
|
49
|
+
static unbindAffected(elements: ElementsMap, boundElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void): void;
|
|
50
|
+
/**
|
|
51
|
+
* Rebind the next affected non deleted bindable elements (adding element to `boundElements`).
|
|
52
|
+
* - iterates non deleted bindable elements (`containerId` | `startBinding.elementId` | `endBinding.elementId`) of the current element
|
|
53
|
+
* - prepares updates to rebind each bindable element's `boundElements` to the current element
|
|
54
|
+
*
|
|
55
|
+
* NOTE: rebind expects that affected elements were previously unbound with `BoundElement.unbindAffected`
|
|
56
|
+
*/
|
|
57
|
+
static rebindAffected: (elements: ElementsMap, boundElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Bindable element containing bindings to `boundElements`.
|
|
61
|
+
*/
|
|
62
|
+
export declare class BindableElement {
|
|
63
|
+
/**
|
|
64
|
+
* Unbind the affected non deleted bound elements (resetting `containerId`, `startBinding`, `endBinding` to `null`).
|
|
65
|
+
* - iterates through non deleted `boundElements` of the current element
|
|
66
|
+
* - prepares updates to unbind each bound element from the current element
|
|
67
|
+
*/
|
|
68
|
+
static unbindAffected(elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void): void;
|
|
69
|
+
/**
|
|
70
|
+
* Rebind the affected non deleted bound elements (for now setting only `containerId`, as we cannot rebind arrows atm).
|
|
71
|
+
* - iterates through non deleted `boundElements` of the current element
|
|
72
|
+
* - prepares updates to rebind each bound element to the current element or unbind it from `boundElements` in case of conflicts
|
|
73
|
+
*
|
|
74
|
+
* NOTE: rebind expects that affected elements were previously unbound with `BindaleElement.unbindAffected`
|
|
75
|
+
*/
|
|
76
|
+
static rebindAffected: (elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
|
|
77
|
+
}
|
|
@@ -36,7 +36,6 @@ export declare const getElementLineSegments: (element: ExcalidrawElement, elemen
|
|
|
36
36
|
* Rectangle here means any rectangular frame, not an excalidraw element.
|
|
37
37
|
*/
|
|
38
38
|
export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBox) => number[];
|
|
39
|
-
export declare const pointRelativeTo: (element: ExcalidrawElement, absoluteCoords: readonly [number, number]) => readonly [number, number];
|
|
40
39
|
export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
|
|
41
40
|
export declare const getCurvePathOps: (shape: Drawable) => Op[];
|
|
42
41
|
export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((x: number, y: number) => [number, number]) | undefined) => Bounds;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export declare const isHittingElementBoundingBoxWithoutHittingElement: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number, elementsMap: ElementsMap) => boolean;
|
|
7
|
-
export declare const isHittingElementNotConsideringBoundingBox: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache | null, point: readonly [number, number], elementsMap: ElementsMap) => boolean;
|
|
8
|
-
export declare const isPointHittingElementBoundingBox: (element: NonDeleted<ExcalidrawElement>, elementsMap: ElementsMap, [x, y]: readonly [number, number], threshold: number, frameNameBoundsCache: FrameNameBoundsCache | null) => boolean;
|
|
9
|
-
export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
|
|
1
|
+
import { ElementsMap, ExcalidrawElement } from "./types";
|
|
2
|
+
import { FrameNameBounds } from "../types";
|
|
3
|
+
import { GeometricShape } from "../../utils/geometry/shape";
|
|
4
|
+
export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
|
|
5
|
+
export type HitTestArgs = {
|
|
10
6
|
x: number;
|
|
11
7
|
y: number;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
8
|
+
element: ExcalidrawElement;
|
|
9
|
+
shape: GeometricShape;
|
|
10
|
+
threshold?: number;
|
|
11
|
+
frameNameBound?: FrameNameBounds | null;
|
|
12
|
+
};
|
|
13
|
+
export declare const hitElementItself: ({ x, y, element, shape, threshold, frameNameBound, }: HitTestArgs) => boolean;
|
|
14
|
+
export declare const hitElementBoundingBox: (x: number, y: number, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
|
|
15
|
+
export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsMap: ElementsMap) => boolean;
|
|
16
|
+
export declare const hitElementBoundText: (x: number, y: number, textShape: GeometricShape | null) => boolean | null;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { ExcalidrawProps } from "../types";
|
|
2
2
|
import { ExcalidrawElement, ExcalidrawIframeLikeElement, IframeData } from "./types";
|
|
3
|
+
import { MarkRequired } from "../utility-types";
|
|
4
|
+
type IframeDataWithSandbox = MarkRequired<IframeData, "sandbox">;
|
|
3
5
|
export declare const createSrcDoc: (body: string) => string;
|
|
4
|
-
export declare const getEmbedLink: (link: string | null | undefined) =>
|
|
6
|
+
export declare const getEmbedLink: (link: string | null | undefined) => IframeDataWithSandbox | null;
|
|
5
7
|
export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawIframeLikeElement) => ExcalidrawElement;
|
|
6
8
|
export declare const actionSetEmbeddableAsActiveTool: {
|
|
7
9
|
name: "setEmbeddableAsActiveTool";
|
|
8
10
|
trackEvent: {
|
|
9
11
|
category: "toolbar";
|
|
10
12
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
target: string;
|
|
14
|
+
label: string;
|
|
15
|
+
perform: (elements: readonly import("./types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties) => {
|
|
16
|
+
elements: readonly import("./types").OrderedExcalidrawElement[];
|
|
13
17
|
appState: {
|
|
14
18
|
activeTool: {
|
|
15
19
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -90,6 +94,8 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
90
94
|
} | {
|
|
91
95
|
name: "ttd";
|
|
92
96
|
tab: "mermaid" | "text-to-diagram";
|
|
97
|
+
} | {
|
|
98
|
+
name: "commandPalette";
|
|
93
99
|
} | null;
|
|
94
100
|
defaultSidebarDockedPreference: boolean;
|
|
95
101
|
lastPointerDownWith: import("./types").PointerType;
|
|
@@ -136,6 +142,9 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
136
142
|
id?: string | undefined;
|
|
137
143
|
socketId?: import("../types").SocketId | undefined;
|
|
138
144
|
isCurrentUser?: boolean | undefined;
|
|
145
|
+
isInCall?: boolean | undefined;
|
|
146
|
+
isSpeaking?: boolean | undefined;
|
|
147
|
+
isMuted?: boolean | undefined;
|
|
139
148
|
}>>;
|
|
140
149
|
showStats: boolean;
|
|
141
150
|
currentChartType: import("./types").ChartType;
|
|
@@ -190,10 +199,11 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
190
199
|
userToFollow: import("../types").UserToFollow | null;
|
|
191
200
|
followedBy: Set<import("../types").SocketId>;
|
|
192
201
|
};
|
|
193
|
-
|
|
202
|
+
storeAction: import("../store").StoreActionType;
|
|
194
203
|
};
|
|
195
204
|
} & {
|
|
196
205
|
keyTest?: undefined;
|
|
197
206
|
};
|
|
198
207
|
export declare const maybeParseEmbedSrc: (str: string) => string;
|
|
199
208
|
export declare const embeddableURLValidator: (url: string | null | undefined, validateEmbeddable: ExcalidrawProps["validateEmbeddable"]) => boolean;
|
|
209
|
+
export {};
|
|
@@ -2,7 +2,6 @@ import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./ty
|
|
|
2
2
|
export { newElement, newTextElement, updateTextElement, refreshTextDimensions, newLinearElement, newImageElement, duplicateElement, } from "./newElement";
|
|
3
3
|
export { getElementAbsoluteCoords, getElementBounds, getCommonBounds, getDiamondPoints, getArrowheadPoints, getClosestElementBounds, } from "./bounds";
|
|
4
4
|
export { OMIT_SIDES_FOR_MULTIPLE_ELEMENTS, getTransformHandlesFromCoords, getTransformHandles, } from "./transformHandles";
|
|
5
|
-
export { hitTest, isHittingElementBoundingBoxWithoutHittingElement, } from "./collision";
|
|
6
5
|
export { resizeTest, getCursorForResizingElement, getElementWithTransformHandleType, getTransformHandleTypeFromCoords, } from "./resizeTest";
|
|
7
6
|
export { transformElements, getResizeOffsetXY, getResizeArrowDirection, } from "./resizeElements";
|
|
8
7
|
export { dragSelectedElements, getDragOffsetXY, dragNewElement, } from "./dragElements";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap,
|
|
1
|
+
import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap } from "./types";
|
|
2
2
|
import { Bounds } from "./bounds";
|
|
3
|
-
import { Point, AppState, PointerCoords, InteractiveCanvasAppState } from "../types";
|
|
4
|
-
import
|
|
3
|
+
import { Point, AppState, PointerCoords, InteractiveCanvasAppState, AppClassProperties } from "../types";
|
|
4
|
+
import { Store } from "../store";
|
|
5
5
|
declare const editorMidPointsCache: {
|
|
6
6
|
version: number | null;
|
|
7
7
|
points: (Point | null)[];
|
|
@@ -51,7 +51,7 @@ export declare class LinearElementEditor {
|
|
|
51
51
|
x: number;
|
|
52
52
|
y: number;
|
|
53
53
|
}[]) => void, linearElementEditor: LinearElementEditor, elementsMap: NonDeletedSceneElementsMap): boolean;
|
|
54
|
-
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState,
|
|
54
|
+
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState, app: AppClassProperties): LinearElementEditor;
|
|
55
55
|
static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => (typeof editorMidPointsCache)["points"];
|
|
56
56
|
static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => void;
|
|
57
57
|
static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
|
|
@@ -61,10 +61,10 @@ export declare class LinearElementEditor {
|
|
|
61
61
|
static isSegmentTooShort(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, zoom: AppState["zoom"]): boolean;
|
|
62
62
|
static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number, elementsMap: ElementsMap): readonly [number, number];
|
|
63
63
|
static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: Point, elementsMap: ElementsMap): number;
|
|
64
|
-
static handlePointerDown(event: React.PointerEvent<HTMLElement>, appState: AppState,
|
|
64
|
+
static handlePointerDown(event: React.PointerEvent<HTMLElement>, appState: AppState, store: Store, scenePointer: {
|
|
65
65
|
x: number;
|
|
66
66
|
y: number;
|
|
67
|
-
}, linearElementEditor: LinearElementEditor,
|
|
67
|
+
}, linearElementEditor: LinearElementEditor, app: AppClassProperties): {
|
|
68
68
|
didAddPoint: boolean;
|
|
69
69
|
hitElement: NonDeleted<ExcalidrawElement> | null;
|
|
70
70
|
linearElementEditor: LinearElementEditor | null;
|
|
@@ -132,13 +132,13 @@ export declare class LinearElementEditor {
|
|
|
132
132
|
isLoading: boolean;
|
|
133
133
|
errorMessage: import("react").ReactNode;
|
|
134
134
|
activeEmbeddable: {
|
|
135
|
-
element: NonDeletedExcalidrawElement;
|
|
135
|
+
element: import("./types").NonDeletedExcalidrawElement;
|
|
136
136
|
state: "active" | "hover";
|
|
137
137
|
} | null;
|
|
138
|
-
draggingElement: NonDeletedExcalidrawElement | null;
|
|
139
|
-
resizingElement: NonDeletedExcalidrawElement | null;
|
|
138
|
+
draggingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
139
|
+
resizingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
140
140
|
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
141
|
-
selectionElement: NonDeletedExcalidrawElement | null;
|
|
141
|
+
selectionElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
142
142
|
isBindingEnabled: boolean;
|
|
143
143
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
144
144
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
@@ -151,7 +151,7 @@ export declare class LinearElementEditor {
|
|
|
151
151
|
};
|
|
152
152
|
editingFrame: string | null;
|
|
153
153
|
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
154
|
-
editingElement: NonDeletedExcalidrawElement | null;
|
|
154
|
+
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
155
155
|
activeTool: {
|
|
156
156
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
157
157
|
locked: boolean;
|
|
@@ -201,6 +201,8 @@ export declare class LinearElementEditor {
|
|
|
201
201
|
} | {
|
|
202
202
|
name: "ttd";
|
|
203
203
|
tab: "mermaid" | "text-to-diagram";
|
|
204
|
+
} | {
|
|
205
|
+
name: "commandPalette";
|
|
204
206
|
} | null;
|
|
205
207
|
defaultSidebarDockedPreference: boolean;
|
|
206
208
|
lastPointerDownWith: import("./types").PointerType;
|
|
@@ -236,7 +238,7 @@ export declare class LinearElementEditor {
|
|
|
236
238
|
button?: "up" | "down" | undefined;
|
|
237
239
|
selectedElementIds?: Readonly<{
|
|
238
240
|
[id: string]: true;
|
|
239
|
-
}> | undefined;
|
|
241
|
+
}> | undefined; /** index */
|
|
240
242
|
username?: string | null | undefined;
|
|
241
243
|
userState?: import("../types").UserIdleState | undefined;
|
|
242
244
|
color?: {
|
|
@@ -247,6 +249,9 @@ export declare class LinearElementEditor {
|
|
|
247
249
|
id?: string | undefined;
|
|
248
250
|
socketId?: import("../types").SocketId | undefined;
|
|
249
251
|
isCurrentUser?: boolean | undefined;
|
|
252
|
+
isInCall?: boolean | undefined;
|
|
253
|
+
isSpeaking?: boolean | undefined;
|
|
254
|
+
isMuted?: boolean | undefined;
|
|
250
255
|
}>>;
|
|
251
256
|
showStats: boolean;
|
|
252
257
|
currentChartType: import("./types").ChartType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./types";
|
|
2
2
|
import { Mutable } from "../utility-types";
|
|
3
|
-
type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce">;
|
|
3
|
+
export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce" | "updated">;
|
|
4
4
|
export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
5
5
|
export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>) => TElement;
|
|
6
6
|
/**
|
|
@@ -9,4 +9,3 @@ export declare const newElementWith: <TElement extends ExcalidrawElement>(elemen
|
|
|
9
9
|
* NOTE: does not trigger re-render.
|
|
10
10
|
*/
|
|
11
11
|
export declare const bumpVersion: <T extends Mutable<ExcalidrawElement>>(element: T, version?: ExcalidrawElement["version"]) => T;
|
|
12
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap } from "./types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import { MarkOptional, Mutable } from "../utility-types";
|
|
4
|
-
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity" | "customData">;
|
|
4
|
+
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "index" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity" | "customData">;
|
|
5
5
|
export declare const newElement: (opts: {
|
|
6
6
|
type: ExcalidrawGenericElement["type"];
|
|
7
7
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
@@ -4,6 +4,6 @@ import { PointerDownState } from "../types";
|
|
|
4
4
|
export declare const normalizeAngle: (angle: number) => number;
|
|
5
5
|
export declare const transformElements: (originalElements: PointerDownState["originalElements"], transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
|
|
6
6
|
export declare const resizeSingleElement: (originalElements: PointerDownState["originalElements"], shouldMaintainAspectRatio: boolean, element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, transformHandleDirection: TransformHandleDirection, shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
|
|
7
|
-
export declare const resizeMultipleElements: (originalElements: PointerDownState["originalElements"], selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, transformHandleType:
|
|
7
|
+
export declare const resizeMultipleElements: (originalElements: PointerDownState["originalElements"], selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, transformHandleType: TransformHandleDirection, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number) => void;
|
|
8
8
|
export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, x: number, y: number) => [number, number];
|
|
9
9
|
export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ExcalidrawElement, PointerType, NonDeletedExcalidrawElement, ElementsMap } from "./types";
|
|
2
2
|
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
|
-
import { AppState, Zoom } from "../types";
|
|
3
|
+
import { AppState, Device, Zoom } from "../types";
|
|
4
4
|
import { Bounds } from "./bounds";
|
|
5
|
-
export declare const resizeTest: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType) => MaybeTransformHandleType;
|
|
6
|
-
export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, elementsMap: ElementsMap) => {
|
|
5
|
+
export declare const resizeTest: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType, device: Device) => MaybeTransformHandleType;
|
|
6
|
+
export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, elementsMap: ElementsMap, device: Device) => {
|
|
7
7
|
element: NonDeletedExcalidrawElement;
|
|
8
8
|
transformHandleType: MaybeTransformHandleType;
|
|
9
9
|
} | null;
|
|
10
|
-
export declare const getTransformHandleTypeFromCoords: ([x1, y1, x2, y2]: Bounds, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType) => MaybeTransformHandleType;
|
|
10
|
+
export declare const getTransformHandleTypeFromCoords: ([x1, y1, x2, y2]: Bounds, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, device: Device) => MaybeTransformHandleType;
|
|
11
11
|
export declare const getCursorForResizingElement: (resizingElement: {
|
|
12
12
|
element?: ExcalidrawElement;
|
|
13
13
|
transformHandleType: MaybeTransformHandleType;
|
|
@@ -3,7 +3,7 @@ import { MaybeTransformHandleType } from "./transformHandles";
|
|
|
3
3
|
import { AppState } from "../types";
|
|
4
4
|
import { ExtractSetType, MakeBrand } from "../utility-types";
|
|
5
5
|
export declare const normalizeText: (text: string) => string;
|
|
6
|
-
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, elementsMap: ElementsMap) => void;
|
|
6
|
+
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, elementsMap: ElementsMap, informMutation?: boolean) => void;
|
|
7
7
|
export declare const bindTextToShapeAfterDuplication: (newElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
8
8
|
export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, elementsMap: ElementsMap, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean) => void;
|
|
9
9
|
export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
|
|
@@ -11,13 +11,8 @@ export declare const computeBoundTextPosition: (container: ExcalidrawElement, bo
|
|
|
11
11
|
y: number;
|
|
12
12
|
};
|
|
13
13
|
export declare const measureText: (text: string, font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => {
|
|
14
|
-
baseline: number;
|
|
15
|
-
height: number;
|
|
16
|
-
width: number;
|
|
17
|
-
} | {
|
|
18
14
|
width: number;
|
|
19
15
|
height: number;
|
|
20
|
-
baseline?: undefined;
|
|
21
16
|
};
|
|
22
17
|
/**
|
|
23
18
|
* To get unitless line-height (if unknown) we can calculate it by dividing
|
|
@@ -66,7 +61,6 @@ export declare const getBoundTextElementPosition: (container: ExcalidrawElement,
|
|
|
66
61
|
} | undefined;
|
|
67
62
|
export declare const shouldAllowVerticalAlign: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
68
63
|
export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
69
|
-
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number, elementsMap: ElementsMap) => ExcalidrawTextContainer | null;
|
|
70
64
|
declare const VALID_CONTAINER_TYPES: Set<string>;
|
|
71
65
|
export declare const isValidTextContainer: (element: {
|
|
72
66
|
type: ExcalidrawElementType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
|
|
2
2
|
import { Bounds } from "./bounds";
|
|
3
|
-
import { InteractiveCanvasAppState, Zoom } from "../types";
|
|
3
|
+
import { Device, InteractiveCanvasAppState, Zoom } from "../types";
|
|
4
4
|
export type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
|
|
5
5
|
export type TransformHandleType = TransformHandleDirection | "rotation";
|
|
6
6
|
export type TransformHandle = Bounds;
|
|
@@ -8,6 +8,12 @@ export type TransformHandles = Partial<{
|
|
|
8
8
|
[T in TransformHandleType]: TransformHandle;
|
|
9
9
|
}>;
|
|
10
10
|
export type MaybeTransformHandleType = TransformHandleType | false;
|
|
11
|
+
export declare const DEFAULT_OMIT_SIDES: {
|
|
12
|
+
e: boolean;
|
|
13
|
+
s: boolean;
|
|
14
|
+
n: boolean;
|
|
15
|
+
w: boolean;
|
|
16
|
+
};
|
|
11
17
|
export declare const OMIT_SIDES_FOR_MULTIPLE_ELEMENTS: {
|
|
12
18
|
e: boolean;
|
|
13
19
|
s: boolean;
|
|
@@ -21,16 +27,28 @@ export declare const OMIT_SIDES_FOR_FRAME: {
|
|
|
21
27
|
w: boolean;
|
|
22
28
|
rotation: boolean;
|
|
23
29
|
};
|
|
30
|
+
export declare const canResizeFromSides: (device: Device) => boolean;
|
|
31
|
+
export declare const getOmitSidesForDevice: (device: Device) => {};
|
|
24
32
|
export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [number, number, number, number, number, number], angle: number, zoom: Zoom, pointerType: PointerType, omitSides?: {
|
|
25
33
|
s?: boolean | undefined;
|
|
26
|
-
n?: boolean | undefined;
|
|
27
|
-
w?: boolean | undefined;
|
|
28
34
|
e?: boolean | undefined;
|
|
35
|
+
w?: boolean | undefined;
|
|
36
|
+
n?: boolean | undefined;
|
|
29
37
|
nw?: boolean | undefined;
|
|
30
38
|
ne?: boolean | undefined;
|
|
31
39
|
sw?: boolean | undefined;
|
|
32
40
|
se?: boolean | undefined;
|
|
33
41
|
rotation?: boolean | undefined;
|
|
34
42
|
}, margin?: number) => TransformHandles;
|
|
35
|
-
export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, elementsMap: ElementsMap, pointerType?: PointerType
|
|
43
|
+
export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, elementsMap: ElementsMap, pointerType?: PointerType, omitSides?: {
|
|
44
|
+
s?: boolean | undefined;
|
|
45
|
+
e?: boolean | undefined;
|
|
46
|
+
w?: boolean | undefined;
|
|
47
|
+
n?: boolean | undefined;
|
|
48
|
+
nw?: boolean | undefined;
|
|
49
|
+
ne?: boolean | undefined;
|
|
50
|
+
sw?: boolean | undefined;
|
|
51
|
+
se?: boolean | undefined;
|
|
52
|
+
rotation?: boolean | undefined;
|
|
53
|
+
}) => TransformHandles;
|
|
36
54
|
export declare const shouldShowBoundingBox: (elements: readonly NonDeletedExcalidrawElement[], appState: InteractiveCanvasAppState) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ElementOrToolType } from "../types";
|
|
2
2
|
import { MarkNonNullable } from "../utility-types";
|
|
3
|
-
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement } from "./types";
|
|
3
|
+
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement, ExcalidrawArrowElement } from "./types";
|
|
4
4
|
export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
|
|
5
5
|
export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
|
|
6
6
|
export declare const isEmbeddableElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawEmbeddableElement;
|
|
@@ -13,7 +13,7 @@ export declare const isFrameLikeElement: (element: ExcalidrawElement | null) =>
|
|
|
13
13
|
export declare const isFreeDrawElement: (element?: ExcalidrawElement | null) => element is ExcalidrawFreeDrawElement;
|
|
14
14
|
export declare const isFreeDrawElementType: (elementType: ExcalidrawElementType) => boolean;
|
|
15
15
|
export declare const isLinearElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
|
|
16
|
-
export declare const isArrowElement: (element?: ExcalidrawElement | null) => element is
|
|
16
|
+
export declare const isArrowElement: (element?: ExcalidrawElement | null) => element is ExcalidrawArrowElement;
|
|
17
17
|
export declare const isLinearElementType: (elementType: ElementOrToolType) => boolean;
|
|
18
18
|
export declare const isBindingElement: (element?: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawLinearElement;
|
|
19
19
|
export declare const isBindingElementType: (elementType: ElementOrToolType) => boolean;
|
|
@@ -18,6 +18,13 @@ export type StrokeStyle = "solid" | "dashed" | "dotted";
|
|
|
18
18
|
export type TextAlign = typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
|
|
19
19
|
type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
|
|
20
20
|
export type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
|
|
21
|
+
export type FractionalIndex = string & {
|
|
22
|
+
_brand: "franctionalIndex";
|
|
23
|
+
};
|
|
24
|
+
export type BoundElement = Readonly<{
|
|
25
|
+
id: ExcalidrawLinearElement["id"];
|
|
26
|
+
type: "arrow" | "text";
|
|
27
|
+
}>;
|
|
21
28
|
type _ExcalidrawElementBase = Readonly<{
|
|
22
29
|
id: string;
|
|
23
30
|
x: number;
|
|
@@ -46,16 +53,18 @@ type _ExcalidrawElementBase = Readonly<{
|
|
|
46
53
|
Used for deterministic reconciliation of updates during collaboration,
|
|
47
54
|
in case the versions (see above) are identical. */
|
|
48
55
|
versionNonce: number;
|
|
56
|
+
/** String in a fractional form defined by https://github.com/rocicorp/fractional-indexing.
|
|
57
|
+
Used for ordering in multiplayer scenarios, such as during reconciliation or undo / redo.
|
|
58
|
+
Always kept in sync with the array order by `syncMovedIndices` and `syncInvalidIndices`.
|
|
59
|
+
Could be null, i.e. for new elements which were not yet assigned to the scene. */
|
|
60
|
+
index: FractionalIndex | null;
|
|
49
61
|
isDeleted: boolean;
|
|
50
62
|
/** List of groups the element belongs to.
|
|
51
63
|
Ordered from deepest to shallowest. */
|
|
52
64
|
groupIds: readonly GroupId[];
|
|
53
65
|
frameId: string | null;
|
|
54
66
|
/** other elements that are bound to this element */
|
|
55
|
-
boundElements: readonly
|
|
56
|
-
id: ExcalidrawLinearElement["id"];
|
|
57
|
-
type: "arrow" | "text";
|
|
58
|
-
}>[] | null;
|
|
67
|
+
boundElements: readonly BoundElement[] | null;
|
|
59
68
|
/** epoch (ms) timestamp of last element update */
|
|
60
69
|
updated: number;
|
|
61
70
|
link: string | null;
|
|
@@ -92,6 +101,9 @@ export type IframeData = ({
|
|
|
92
101
|
h: number;
|
|
93
102
|
};
|
|
94
103
|
error?: Error;
|
|
104
|
+
sandbox?: {
|
|
105
|
+
allowSameOrigin?: boolean;
|
|
106
|
+
};
|
|
95
107
|
} & ({
|
|
96
108
|
type: "video" | "generic";
|
|
97
109
|
link: string;
|
|
@@ -127,6 +139,10 @@ export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRe
|
|
|
127
139
|
* between peers and contain no state local to the peer.
|
|
128
140
|
*/
|
|
129
141
|
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
|
|
142
|
+
export type Ordered<TElement extends ExcalidrawElement> = TElement & {
|
|
143
|
+
index: FractionalIndex;
|
|
144
|
+
};
|
|
145
|
+
export type OrderedExcalidrawElement = Ordered<ExcalidrawElement>;
|
|
130
146
|
export type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
|
|
131
147
|
isDeleted: boolean;
|
|
132
148
|
};
|
|
@@ -198,11 +214,11 @@ export type NonDeletedElementsMap = Map<ExcalidrawElement["id"], NonDeletedExcal
|
|
|
198
214
|
* Map of all excalidraw Scene elements, including deleted.
|
|
199
215
|
* Not a subset. Use this type when you need access to current Scene elements.
|
|
200
216
|
*/
|
|
201
|
-
export type SceneElementsMap = Map<ExcalidrawElement["id"], ExcalidrawElement
|
|
217
|
+
export type SceneElementsMap = Map<ExcalidrawElement["id"], Ordered<ExcalidrawElement>> & MakeBrand<"SceneElementsMap">;
|
|
202
218
|
/**
|
|
203
219
|
* Map of all non-deleted Scene elements.
|
|
204
220
|
* Not a subset. Use this type when you need access to current Scene elements.
|
|
205
221
|
*/
|
|
206
|
-
export type NonDeletedSceneElementsMap = Map<ExcalidrawElement["id"], NonDeletedExcalidrawElement
|
|
222
|
+
export type NonDeletedSceneElementsMap = Map<ExcalidrawElement["id"], Ordered<NonDeletedExcalidrawElement>> & MakeBrand<"NonDeletedSceneElementsMap">;
|
|
207
223
|
export type ElementsMapOrArray = readonly ExcalidrawElement[] | Readonly<ElementsMap>;
|
|
208
224
|
export {};
|
|
@@ -10,4 +10,7 @@ export declare class ImageSceneDataError extends Error {
|
|
|
10
10
|
code: ImageSceneDataErrorCode;
|
|
11
11
|
constructor(message?: string, code?: ImageSceneDataErrorCode);
|
|
12
12
|
}
|
|
13
|
+
export declare class InvalidFractionalIndexError extends Error {
|
|
14
|
+
code: "ELEMENT_HAS_INVALID_INDEX";
|
|
15
|
+
}
|
|
13
16
|
export {};
|