@zsviczian/excalidraw 0.15.2-obsidian-3 → 0.15.2-obsidian-5
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 +4 -0
- package/dist/excalidraw.development.js +333 -171
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +2 -0
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +30 -3
- package/types/actions/actionAlign.d.ts +12 -6
- package/types/actions/actionBoundText.d.ts +21 -3
- package/types/actions/actionCanvas.d.ts +94 -10
- package/types/actions/actionClipboard.d.ts +47 -5
- package/types/actions/actionDeleteSelected.d.ts +27 -3
- package/types/actions/actionDistribute.d.ts +2 -2
- package/types/actions/actionElementLock.d.ts +21 -2
- package/types/actions/actionExport.d.ts +90 -9
- package/types/actions/actionFinalize.d.ts +20 -2
- package/types/actions/actionFlip.d.ts +2 -2
- package/types/actions/actionFrame.d.ts +475 -0
- package/types/actions/actionGroup.d.ts +2 -2
- package/types/actions/actionLinearEditor.d.ts +10 -1
- package/types/actions/actionMenu.d.ts +30 -3
- package/types/actions/actionNavigate.d.ts +1 -1
- package/types/actions/actionProperties.d.ts +130 -13
- package/types/actions/actionStyles.d.ts +10 -1
- package/types/actions/actionToggleGridMode.d.ts +10 -1
- package/types/actions/actionToggleStats.d.ts +10 -1
- package/types/actions/actionToggleViewMode.d.ts +10 -1
- package/types/actions/actionToggleZenMode.d.ts +10 -1
- package/types/actions/actionZindex.d.ts +4 -4
- package/types/actions/types.d.ts +1 -1
- package/types/appState.d.ts +1 -1
- package/types/clients.d.ts +1 -5
- package/types/colors.d.ts +1 -0
- package/types/components/ActiveConfirmDialog.d.ts +1 -21
- package/types/components/App.d.ts +20 -4
- package/types/components/Avatar.d.ts +0 -1
- package/types/components/ColorPicker/ColorInput.d.ts +1 -1
- package/types/components/ColorPicker/ColorPicker.d.ts +3 -2
- package/types/components/ColorPicker/CustomColorList.d.ts +1 -1
- package/types/components/ColorPicker/Picker.d.ts +4 -2
- package/types/components/ColorPicker/PickerColorList.d.ts +1 -1
- package/types/components/ColorPicker/ShadeList.d.ts +1 -1
- package/types/components/ColorPicker/TopPicks.d.ts +1 -1
- package/types/components/ColorPicker/colorPickerUtils.d.ts +4 -24
- package/types/components/ColorPicker/keyboardNavHandlers.d.ts +8 -3
- package/types/components/Dialog.d.ts +2 -3
- package/types/components/EyeDropper.d.ts +18 -0
- package/types/components/FilledButton.d.ts +2 -1
- package/types/components/LibraryMenu.d.ts +1 -21
- package/types/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
- package/types/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
- package/types/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
- package/types/components/Sidebar/Sidebar.d.ts +1 -21
- package/types/components/ToolButton.d.ts +2 -1
- package/types/components/dropdownMenu/DropdownMenu.d.ts +3 -2
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +4 -2
- package/types/components/icons.d.ts +5 -0
- package/types/components/main-menu/MainMenu.d.ts +3 -2
- package/types/constants.d.ts +24 -1
- package/types/context/tunnels.d.ts +1 -0
- package/types/data/library.d.ts +1 -45
- package/types/element/Hyperlink.d.ts +21 -6
- package/types/element/binding.d.ts +1 -1
- package/types/element/bounds.d.ts +31 -6
- package/types/element/collision.d.ts +7 -7
- package/types/element/dragElements.d.ts +2 -1
- package/types/element/iframe.d.ts +173 -0
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +11 -2
- package/types/element/newElement.d.ts +8 -2
- package/types/element/transformHandles.d.ts +8 -1
- package/types/element/typeChecks.d.ts +5 -3
- package/types/element/types.d.ts +13 -4
- package/types/frame.d.ts +40 -0
- package/types/groups.d.ts +4 -0
- package/types/hooks/useCreatePortalContainer.d.ts +5 -0
- package/types/hooks/useLibraryItemSvg.d.ts +1 -21
- package/types/hooks/useOutsideClick.d.ts +19 -1
- package/types/jotai.d.ts +16 -104
- package/types/keys.d.ts +2 -0
- package/types/math.d.ts +1 -0
- package/types/packages/excalidraw/example/initialData.d.ts +6 -0
- package/types/renderer/renderElement.d.ts +3 -2
- package/types/renderer/renderScene.d.ts +12 -3
- package/types/renderer/roundRect.d.ts +1 -1
- package/types/scene/Scene.d.ts +8 -1
- package/types/scene/export.d.ts +1 -0
- package/types/scene/selection.d.ts +13 -3
- package/types/types.d.ts +35 -3
- package/types/utils.d.ts +5 -2
- package/types/zindex.d.ts +4 -4
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { AppState } from "../types";
|
|
2
2
|
import { MarkNonNullable } from "../utility-types";
|
|
3
|
-
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, RoundnessType } from "./types";
|
|
3
|
+
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawIFrameElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType } from "./types";
|
|
4
4
|
export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
|
|
5
5
|
export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
|
|
6
6
|
export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
|
|
7
|
+
export declare const isIFrameElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawIFrameElement;
|
|
7
8
|
export declare const isTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawTextElement;
|
|
9
|
+
export declare const isFrameElement: (element: ExcalidrawElement | null) => element is ExcalidrawFrameElement;
|
|
8
10
|
export declare const isFreeDrawElement: (element?: ExcalidrawElement | null) => element is ExcalidrawFreeDrawElement;
|
|
9
11
|
export declare const isFreeDrawElementType: (elementType: ExcalidrawElement["type"]) => boolean;
|
|
10
12
|
export declare const isLinearElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
|
|
11
13
|
export declare const isArrowElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
|
|
12
|
-
export declare const isLinearElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
14
|
+
export declare const isLinearElementType: (elementType: AppState["activeTool"]["type"] | "iframe") => boolean;
|
|
13
15
|
export declare const isBindingElement: (element?: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawLinearElement;
|
|
14
|
-
export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
16
|
+
export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"] | "iframe") => boolean;
|
|
15
17
|
export declare const isBindableElement: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawBindableElement;
|
|
16
18
|
export declare const isTextBindableContainer: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawTextContainer;
|
|
17
19
|
export declare const isExcalidrawElement: (element: any) => boolean;
|
package/types/element/types.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ type _ExcalidrawElementBase = Readonly<{
|
|
|
49
49
|
/** List of groups the element belongs to.
|
|
50
50
|
Ordered from deepest to shallowest. */
|
|
51
51
|
groupIds: readonly GroupId[];
|
|
52
|
+
frameId: string | null;
|
|
52
53
|
/** other elements that are bound to this element */
|
|
53
54
|
boundElements: readonly Readonly<{
|
|
54
55
|
id: ExcalidrawLinearElement["id"];
|
|
@@ -72,6 +73,10 @@ export type ExcalidrawDiamondElement = _ExcalidrawElementBase & {
|
|
|
72
73
|
export type ExcalidrawEllipseElement = _ExcalidrawElementBase & {
|
|
73
74
|
type: "ellipse";
|
|
74
75
|
};
|
|
76
|
+
export type ExcalidrawIFrameElement = _ExcalidrawElementBase & Readonly<{
|
|
77
|
+
whitelisted?: boolean;
|
|
78
|
+
type: "iframe";
|
|
79
|
+
}>;
|
|
75
80
|
export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
|
76
81
|
type: "image";
|
|
77
82
|
fileId: FileId | null;
|
|
@@ -81,16 +86,20 @@ export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
|
|
81
86
|
scale: [number, number];
|
|
82
87
|
}>;
|
|
83
88
|
export type InitializedExcalidrawImageElement = MarkNonNullable<ExcalidrawImageElement, "fileId">;
|
|
89
|
+
export type ExcalidrawFrameElement = _ExcalidrawElementBase & {
|
|
90
|
+
type: "frame";
|
|
91
|
+
name: string | null;
|
|
92
|
+
};
|
|
84
93
|
/**
|
|
85
94
|
* These are elements that don't have any additional properties.
|
|
86
95
|
*/
|
|
87
|
-
export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
|
|
96
|
+
export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRectangleElement | ExcalidrawIFrameElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
|
|
88
97
|
/**
|
|
89
98
|
* ExcalidrawElement should be JSON serializable and (eventually) contain
|
|
90
99
|
* no computed data. The list of all ExcalidrawElements should be shareable
|
|
91
100
|
* between peers and contain no state local to the peer.
|
|
92
101
|
*/
|
|
93
|
-
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement;
|
|
102
|
+
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement;
|
|
94
103
|
export type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
|
|
95
104
|
isDeleted: boolean;
|
|
96
105
|
};
|
|
@@ -114,8 +123,8 @@ export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
|
114
123
|
_brand: "unitlessLineHeight";
|
|
115
124
|
};
|
|
116
125
|
}>;
|
|
117
|
-
export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement;
|
|
118
|
-
export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement |
|
|
126
|
+
export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawIFrameElement | ExcalidrawFrameElement;
|
|
127
|
+
export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawArrowElement | ExcalidrawIFrameElement;
|
|
119
128
|
export type ExcalidrawTextElementWithContainer = {
|
|
120
129
|
containerId: ExcalidrawTextContainer["id"];
|
|
121
130
|
} & ExcalidrawTextElement;
|
package/types/frame.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawFrameElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
+
import { AppState } from "./types";
|
|
3
|
+
import { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
|
|
4
|
+
export declare const bindElementsToFramesAfterDuplication: (nextElements: ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
5
|
+
export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
6
|
+
export declare const isElementContainingFrame: (elements: readonly ExcalidrawElement[], element: ExcalidrawElement, frame: ExcalidrawFrameElement) => boolean;
|
|
7
|
+
export declare const getElementsIntersectingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
8
|
+
export declare const elementsAreInFrameBounds: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => boolean;
|
|
9
|
+
export declare const elementOverlapsWithFrame: (element: ExcalidrawElement, frame: ExcalidrawFrameElement) => boolean;
|
|
10
|
+
export declare const isCursorInFrame: (cursorCoords: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}, frame: NonDeleted<ExcalidrawFrameElement>) => boolean;
|
|
14
|
+
export declare const groupsAreAtLeastIntersectingTheFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameElement) => boolean;
|
|
15
|
+
export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameElement) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a map of frameId to frame elements. Includes empty frames.
|
|
18
|
+
*/
|
|
19
|
+
export declare const groupByFrames: (elements: readonly ExcalidrawElement[]) => Map<string, ExcalidrawElement[]>;
|
|
20
|
+
export declare const getFrameElements: (allElements: ExcalidrawElementsIncludingDeleted, frameId: string) => ExcalidrawElement[];
|
|
21
|
+
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
|
22
|
+
export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
23
|
+
export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) => ExcalidrawFrameElement | null;
|
|
24
|
+
export declare const addElementsToFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToAdd: NonDeletedExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
25
|
+
export declare const removeElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToRemove: NonDeletedExcalidrawElement[], appState: AppState) => ExcalidrawElement[];
|
|
26
|
+
export declare const removeAllElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
|
27
|
+
export declare const replaceAllElementsInFrame: (allElements: ExcalidrawElementsIncludingDeleted, nextElementsInFrame: ExcalidrawElement[], frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
|
28
|
+
/** does not mutate elements, but return new ones */
|
|
29
|
+
export declare const updateFrameMembershipOfSelectedElements: (allElements: ExcalidrawElementsIncludingDeleted, appState: AppState) => ExcalidrawElementsIncludingDeleted;
|
|
30
|
+
/**
|
|
31
|
+
* filters out elements that are inside groups that contain a frame element
|
|
32
|
+
* anywhere in the group tree
|
|
33
|
+
*/
|
|
34
|
+
export declare const omitGroupsContainingFrames: (allElements: ExcalidrawElementsIncludingDeleted, selectedElements?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
35
|
+
/**
|
|
36
|
+
* depending on the appState, return target frame, which is the frame the given element
|
|
37
|
+
* is going to be added to or remove from
|
|
38
|
+
*/
|
|
39
|
+
export declare const getTargetFrame: (element: ExcalidrawElement, appState: AppState) => ExcalidrawFrameElement | null;
|
|
40
|
+
export declare const isElementInFrame: (element: ExcalidrawElement, allElements: ExcalidrawElementsIncludingDeleted, appState: AppState) => boolean;
|
package/types/groups.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export declare const getSelectedGroupIds: (appState: AppState) => GroupId[];
|
|
|
13
13
|
* you're currently editing that group.
|
|
14
14
|
*/
|
|
15
15
|
export declare const selectGroupsForSelectedElements: (appState: AppState, elements: readonly NonDeleted<ExcalidrawElement>[]) => AppState;
|
|
16
|
+
export declare const selectGroupsFromGivenElements: (elements: readonly NonDeleted<ExcalidrawElement>[], appState: AppState) => {
|
|
17
|
+
[groupId: string]: boolean;
|
|
18
|
+
};
|
|
16
19
|
export declare const editGroupForSelectedElement: (appState: AppState, element: NonDeleted<ExcalidrawElement>) => AppState;
|
|
17
20
|
export declare const isElementInGroup: (element: ExcalidrawElement, groupId: string) => boolean;
|
|
18
21
|
export declare const getElementsInGroup: (elements: readonly ExcalidrawElement[], groupId: string) => ExcalidrawElement[];
|
|
@@ -25,3 +28,4 @@ export declare const removeFromSelectedGroups: (groupIds: ExcalidrawElement["gro
|
|
|
25
28
|
[groupId: string]: boolean;
|
|
26
29
|
}) => string[];
|
|
27
30
|
export declare const getMaximumGroups: (elements: ExcalidrawElement[]) => ExcalidrawElement[][];
|
|
31
|
+
export declare const elementsAreInSameGroup: (elements: ExcalidrawElement[]) => boolean;
|
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
import { LibraryItem } from "../types";
|
|
2
2
|
export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;
|
|
3
|
-
export declare const libraryItemSvgsCache: import("jotai").
|
|
4
|
-
write: (get: {
|
|
5
|
-
<Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
|
|
6
|
-
<Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
|
|
7
|
-
<Value_2>(atom: import("jotai").Atom<Value_2>): Value_2 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_2;
|
|
8
|
-
} & {
|
|
9
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
|
|
10
|
-
unstable_promise: true;
|
|
11
|
-
}): Value_3 | Promise<Value_3>;
|
|
12
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
|
|
13
|
-
unstable_promise: true;
|
|
14
|
-
}): Value_4 | Promise<Value_4>;
|
|
15
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>, options: {
|
|
16
|
-
unstable_promise: true;
|
|
17
|
-
}): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
|
|
18
|
-
}, set: {
|
|
19
|
-
<Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
|
|
20
|
-
<Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
|
|
21
|
-
}, update: SvgCache | ((prev: SvgCache) => SvgCache)) => void;
|
|
22
|
-
onMount?: (<S extends (update: SvgCache | ((prev: SvgCache) => SvgCache)) => void>(setAtom: S) => void | (() => void)) | undefined;
|
|
23
|
-
} & {
|
|
3
|
+
export declare const libraryItemSvgsCache: import("jotai").PrimitiveAtom<SvgCache> & {
|
|
24
4
|
init: SvgCache;
|
|
25
5
|
};
|
|
26
6
|
export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache) => SVGSVGElement | undefined;
|
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare
|
|
2
|
+
export declare function useOutsideClick<T extends HTMLElement>(ref: React.RefObject<T>,
|
|
3
|
+
/** if performance is of concern, memoize the callback */
|
|
4
|
+
callback: (event: Event) => void,
|
|
5
|
+
/**
|
|
6
|
+
* Optional callback which is called on every click.
|
|
7
|
+
*
|
|
8
|
+
* Should return `true` if click should be considered as inside the container,
|
|
9
|
+
* and `false` if it falls outside and should call the `callback`.
|
|
10
|
+
*
|
|
11
|
+
* Returning `true` overrides the default behavior and `callback` won't be
|
|
12
|
+
* called.
|
|
13
|
+
*
|
|
14
|
+
* Returning `undefined` will fallback to the default behavior.
|
|
15
|
+
*/
|
|
16
|
+
isInside?: (event: Event & {
|
|
17
|
+
target: HTMLElement;
|
|
18
|
+
},
|
|
19
|
+
/** the element of the passed ref */
|
|
20
|
+
container: T) => boolean | undefined): void;
|
package/types/jotai.d.ts
CHANGED
|
@@ -1,122 +1,34 @@
|
|
|
1
1
|
import { PrimitiveAtom } from "jotai";
|
|
2
2
|
export declare const jotaiScope: unique symbol;
|
|
3
3
|
export declare const jotaiStore: {
|
|
4
|
-
get: <Value>(atom: import("jotai").Atom<Value>) =>
|
|
5
|
-
asyncGet: <Value_1>(atom: import("jotai").Atom<Value_1>) => Promise<
|
|
4
|
+
get: <Value>(atom: import("jotai").Atom<Value>) => Awaited<Value> | undefined;
|
|
5
|
+
asyncGet: <Value_1>(atom: import("jotai").Atom<Value_1>) => Promise<Awaited<Value_1>>;
|
|
6
6
|
set: <Value_2, Update, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_2, Update, Result>, update: Update) => Result;
|
|
7
|
-
sub: (atom:
|
|
8
|
-
toString: () => string;
|
|
9
|
-
debugLabel?: string | undefined;
|
|
10
|
-
read: (get: {
|
|
11
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
12
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
13
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
14
|
-
}) => unknown;
|
|
15
|
-
}, callback: () => void) => () => void;
|
|
7
|
+
sub: (atom: import("jotai").Atom<unknown>, callback: () => void) => () => void;
|
|
16
8
|
SECRET_INTERNAL_store: {
|
|
17
|
-
r: <
|
|
9
|
+
r: <Value_3>(readingAtom: import("jotai").Atom<Value_3>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_3>;
|
|
18
10
|
w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom: import("jotai").WritableAtom<Value_1_1, Update_1, Result_1>, update: Update_1, version?: import("jotai/core/store").VersionObject | undefined) => Result_1;
|
|
19
|
-
c: (_atom:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
read: (get: {
|
|
23
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
24
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
25
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
26
|
-
}) => unknown;
|
|
27
|
-
} | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
28
|
-
s: (atom: {
|
|
29
|
-
toString: () => string;
|
|
30
|
-
debugLabel?: string | undefined;
|
|
31
|
-
read: (get: {
|
|
32
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
33
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
34
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
35
|
-
}) => unknown;
|
|
36
|
-
}, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void) => () => void;
|
|
37
|
-
h: (values: Iterable<readonly [{
|
|
38
|
-
toString: () => string;
|
|
39
|
-
debugLabel?: string | undefined;
|
|
40
|
-
read: (get: {
|
|
41
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
42
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
43
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
44
|
-
}) => unknown;
|
|
45
|
-
}, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
11
|
+
c: (_atom: import("jotai").Atom<unknown> | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
12
|
+
s: (atom: import("jotai").Atom<unknown>, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void, version?: import("jotai/core/store").VersionObject | undefined) => () => void;
|
|
13
|
+
h: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
46
14
|
n: (l: () => void) => () => void;
|
|
47
|
-
l: () => IterableIterator<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
read: (get: {
|
|
51
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
52
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
53
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
54
|
-
}) => unknown;
|
|
55
|
-
}>;
|
|
56
|
-
a: (a: {
|
|
57
|
-
toString: () => string;
|
|
58
|
-
debugLabel?: string | undefined;
|
|
59
|
-
read: (get: {
|
|
60
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
61
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
62
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
63
|
-
}) => unknown;
|
|
64
|
-
}) => import("jotai/core/store").AtomState<unknown> | undefined;
|
|
65
|
-
m: (a: {
|
|
66
|
-
toString: () => string;
|
|
67
|
-
debugLabel?: string | undefined;
|
|
68
|
-
read: (get: {
|
|
69
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
70
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
71
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
72
|
-
}) => unknown;
|
|
73
|
-
}) => {
|
|
15
|
+
l: () => IterableIterator<import("jotai").Atom<unknown>>;
|
|
16
|
+
a: (a: import("jotai").Atom<unknown>) => import("jotai/core/store").AtomState<unknown> | undefined;
|
|
17
|
+
m: (a: import("jotai").Atom<unknown>) => {
|
|
74
18
|
l: Set<(version?: import("jotai/core/store").VersionObject | undefined) => void>;
|
|
75
|
-
t: Set<
|
|
76
|
-
toString: () => string;
|
|
77
|
-
debugLabel?: string | undefined;
|
|
78
|
-
read: (get: {
|
|
79
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
80
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
81
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
82
|
-
}) => unknown;
|
|
83
|
-
}>;
|
|
19
|
+
t: Set<import("jotai").Atom<unknown>>;
|
|
84
20
|
u?: (() => void) | undefined;
|
|
85
21
|
} | undefined;
|
|
86
22
|
} | {
|
|
87
|
-
r: <
|
|
23
|
+
r: <Value_4>(readingAtom: import("jotai").Atom<Value_4>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_4>;
|
|
88
24
|
w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom: import("jotai").WritableAtom<Value_1_2, Update_2, Result_2>, update: Update_2, version?: import("jotai/core/store").VersionObject | undefined) => Result_2;
|
|
89
|
-
c: (_atom:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
read: (get: {
|
|
93
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
94
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
95
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
96
|
-
}) => unknown;
|
|
97
|
-
} | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
98
|
-
s: (atom: {
|
|
99
|
-
toString: () => string;
|
|
100
|
-
debugLabel?: string | undefined;
|
|
101
|
-
read: (get: {
|
|
102
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
103
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
104
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
105
|
-
}) => unknown;
|
|
106
|
-
}, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void) => () => void;
|
|
107
|
-
h: (values: Iterable<readonly [{
|
|
108
|
-
toString: () => string;
|
|
109
|
-
debugLabel?: string | undefined;
|
|
110
|
-
read: (get: {
|
|
111
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
112
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
113
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
114
|
-
}) => unknown;
|
|
115
|
-
}, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
25
|
+
c: (_atom: import("jotai").Atom<unknown> | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
26
|
+
s: (atom: import("jotai").Atom<unknown>, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void, version?: import("jotai/core/store").VersionObject | undefined) => () => void;
|
|
27
|
+
h: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
116
28
|
n?: undefined;
|
|
117
29
|
l?: undefined;
|
|
118
30
|
a?: undefined;
|
|
119
31
|
m?: undefined;
|
|
120
32
|
};
|
|
121
33
|
};
|
|
122
|
-
export declare const useAtomWithInitialValue: <T extends unknown, A extends PrimitiveAtom<T>>(atom: A, initialValue: T | (() => T)) => readonly [
|
|
34
|
+
export declare const useAtomWithInitialValue: <T extends unknown, A extends PrimitiveAtom<T>>(atom: A, initialValue: T | (() => T)) => readonly [Awaited<T>, import("jotai/core/atom").SetAtom<T | ((prev: T) => T), void>];
|
package/types/keys.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare const KEYS: {
|
|
|
39
39
|
readonly CHEVRON_RIGHT: ">";
|
|
40
40
|
readonly PERIOD: ".";
|
|
41
41
|
readonly COMMA: ",";
|
|
42
|
+
readonly SUBTRACT: "-";
|
|
42
43
|
readonly A: "a";
|
|
43
44
|
readonly C: "c";
|
|
44
45
|
readonly D: "d";
|
|
@@ -59,6 +60,7 @@ export declare const KEYS: {
|
|
|
59
60
|
readonly Y: "y";
|
|
60
61
|
readonly Z: "z";
|
|
61
62
|
readonly K: "k";
|
|
63
|
+
readonly W: "w";
|
|
62
64
|
readonly 0: "0";
|
|
63
65
|
readonly 1: "1";
|
|
64
66
|
readonly 2: "2";
|
package/types/math.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const distance2d: (x1: number, y1: number, x2: number, y2: number
|
|
|
17
17
|
export declare const centerPoint: (a: readonly [number, number], b: readonly [number, number]) => readonly [number, number];
|
|
18
18
|
export declare const isPathALoop: (points: ExcalidrawLinearElement["points"], zoomValue?: Zoom["value"]) => boolean;
|
|
19
19
|
export declare const isPointInPolygon: (points: Point[], x: number, y: number) => boolean;
|
|
20
|
+
export declare const isPointWithinBounds: (p: readonly [number, number], q: readonly [number, number], r: readonly [number, number]) => boolean;
|
|
20
21
|
export declare const getGridPoint: (x: number, y: number, gridSize: number | null) => [number, number];
|
|
21
22
|
export declare const getCornerRadius: (x: number, element: ExcalidrawElement) => number;
|
|
22
23
|
export declare const getControlPointsForBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][] | null;
|
|
@@ -19,6 +19,7 @@ declare namespace _default {
|
|
|
19
19
|
height: number;
|
|
20
20
|
seed: number;
|
|
21
21
|
groupIds: never[];
|
|
22
|
+
frameId: null;
|
|
22
23
|
fileId?: undefined;
|
|
23
24
|
strokeSharpness?: undefined;
|
|
24
25
|
boundElements?: undefined;
|
|
@@ -42,6 +43,7 @@ declare namespace _default {
|
|
|
42
43
|
roughness: number;
|
|
43
44
|
opacity: number;
|
|
44
45
|
groupIds: never[];
|
|
46
|
+
frameId: null;
|
|
45
47
|
strokeSharpness: string;
|
|
46
48
|
seed: number;
|
|
47
49
|
version: number;
|
|
@@ -79,6 +81,7 @@ declare namespace _default {
|
|
|
79
81
|
height: number;
|
|
80
82
|
seed: number;
|
|
81
83
|
groupIds: string[];
|
|
84
|
+
frameId: null;
|
|
82
85
|
strokeSharpness: string;
|
|
83
86
|
boundElementIds: never[];
|
|
84
87
|
startBinding: null;
|
|
@@ -107,6 +110,7 @@ declare namespace _default {
|
|
|
107
110
|
height: number;
|
|
108
111
|
seed: number;
|
|
109
112
|
groupIds: string[];
|
|
113
|
+
frameId: null;
|
|
110
114
|
strokeSharpness: string;
|
|
111
115
|
boundElementIds: string[];
|
|
112
116
|
startBinding?: undefined;
|
|
@@ -135,6 +139,7 @@ declare namespace _default {
|
|
|
135
139
|
height: number;
|
|
136
140
|
seed: number;
|
|
137
141
|
groupIds: string[];
|
|
142
|
+
frameId: null;
|
|
138
143
|
strokeSharpness: string;
|
|
139
144
|
boundElementIds: string[];
|
|
140
145
|
points?: undefined;
|
|
@@ -161,6 +166,7 @@ declare namespace _default {
|
|
|
161
166
|
height: number;
|
|
162
167
|
seed: number;
|
|
163
168
|
groupIds: string[];
|
|
169
|
+
frameId: null;
|
|
164
170
|
strokeSharpness: string;
|
|
165
171
|
boundElementIds: never[];
|
|
166
172
|
points: number[][];
|
|
@@ -13,6 +13,7 @@ export interface ExcalidrawElementWithCanvas {
|
|
|
13
13
|
canvasOffsetX: number;
|
|
14
14
|
canvasOffsetY: number;
|
|
15
15
|
boundTextElementVersion: number | null;
|
|
16
|
+
containingFrameOpacity: number;
|
|
16
17
|
}
|
|
17
18
|
export declare const DEFAULT_LINK_SIZE = 14;
|
|
18
19
|
type ElementShape = Drawable | Drawable[] | null;
|
|
@@ -26,9 +27,9 @@ type ElementShapes = {
|
|
|
26
27
|
export declare const getShapeForElement: <T extends ExcalidrawElement>(element: T) => T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : Drawable | null | undefined;
|
|
27
28
|
export declare const setShapeForElement: <T extends ExcalidrawElement>(element: T, shape: T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable) => WeakMap<ExcalidrawElement, ElementShape>;
|
|
28
29
|
export declare const invalidateShapeForElement: (element: ExcalidrawElement) => boolean;
|
|
29
|
-
export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
|
|
30
|
+
export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean, isExporting?: boolean) => Options;
|
|
30
31
|
export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: RenderConfig, appState: AppState) => void;
|
|
31
|
-
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, exportWithDarkMode?: boolean) => void;
|
|
32
|
+
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, exportWithDarkMode?: boolean, exportingFrameId?: string | null) => void;
|
|
32
33
|
export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
|
|
33
34
|
export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
|
|
34
35
|
export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { RoughCanvas } from "roughjs/bin/canvas";
|
|
2
2
|
import { RoughSVG } from "roughjs/bin/svg";
|
|
3
|
-
import { AppState, BinaryFiles } from "../types";
|
|
4
|
-
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
3
|
+
import { AppState, BinaryFiles, Zoom } from "../types";
|
|
4
|
+
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
5
5
|
import { RenderConfig } from "../scene/types";
|
|
6
|
+
import "canvas-roundrect-polyfill";
|
|
6
7
|
export declare const DEFAULT_SPACING = 2;
|
|
7
8
|
export declare const _renderScene: ({ elements, appState, scale, rc, canvas, renderConfig, }: {
|
|
8
9
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
@@ -34,8 +35,16 @@ export declare const renderScene: <T extends boolean = false>(config: {
|
|
|
34
35
|
atLeastOneVisibleElement: boolean;
|
|
35
36
|
scrollBars: import("../scene/types").ScrollBars | undefined;
|
|
36
37
|
};
|
|
37
|
-
export declare const
|
|
38
|
+
export declare const isVisibleElement: (element: ExcalidrawElement, canvasWidth: number, canvasHeight: number, viewTransformations: {
|
|
39
|
+
zoom: Zoom;
|
|
40
|
+
offsetLeft: number;
|
|
41
|
+
offsetTop: number;
|
|
42
|
+
scrollX: number;
|
|
43
|
+
scrollY: number;
|
|
44
|
+
}) => boolean;
|
|
45
|
+
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, exportingFrameId, }?: {
|
|
38
46
|
offsetX?: number | undefined;
|
|
39
47
|
offsetY?: number | undefined;
|
|
40
48
|
exportWithDarkMode?: boolean | undefined;
|
|
49
|
+
exportingFrameId?: string | null | undefined;
|
|
41
50
|
}) => void;
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* @param {Number} height The height of the rectangle
|
|
9
9
|
* @param {Number} radius The corner radius
|
|
10
10
|
*/
|
|
11
|
-
export declare const roundRect: (context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number) => void;
|
|
11
|
+
export declare const roundRect: (context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number, strokeColor?: string) => void;
|
package/types/scene/Scene.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "../element/types";
|
|
1
|
+
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameElement } from "../element/types";
|
|
2
2
|
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
3
3
|
type ElementIdKey = InstanceType<typeof LinearElementEditor>["elementId"];
|
|
4
4
|
type ElementKey = ExcalidrawElement | ElementIdKey;
|
|
5
5
|
type SceneStateCallback = () => void;
|
|
6
6
|
type SceneStateCallbackRemover = () => void;
|
|
7
|
+
export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
|
|
7
8
|
declare class Scene {
|
|
8
9
|
private static sceneMapByElement;
|
|
9
10
|
private static sceneMapById;
|
|
@@ -12,9 +13,13 @@ declare class Scene {
|
|
|
12
13
|
private callbacks;
|
|
13
14
|
private nonDeletedElements;
|
|
14
15
|
private elements;
|
|
16
|
+
private nonDeletedFrames;
|
|
17
|
+
private frames;
|
|
15
18
|
private elementsMap;
|
|
16
19
|
getElementsIncludingDeleted(): readonly ExcalidrawElement[];
|
|
17
20
|
getNonDeletedElements(): readonly NonDeletedExcalidrawElement[];
|
|
21
|
+
getFramesIncludingDeleted(): readonly ExcalidrawFrameElement[];
|
|
22
|
+
getNonDeletedFrames(): readonly NonDeleted<ExcalidrawFrameElement>[];
|
|
18
23
|
getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
|
|
19
24
|
getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
|
|
20
25
|
/**
|
|
@@ -35,6 +40,8 @@ declare class Scene {
|
|
|
35
40
|
addCallback(cb: SceneStateCallback): SceneStateCallbackRemover;
|
|
36
41
|
destroy(): void;
|
|
37
42
|
insertElementAtIndex(element: ExcalidrawElement, index: number): void;
|
|
43
|
+
insertElementsAtIndex(elements: ExcalidrawElement[], index: number): void;
|
|
44
|
+
addNewElement: (element: ExcalidrawElement) => void;
|
|
38
45
|
getElementIndex(elementId: string): number;
|
|
39
46
|
}
|
|
40
47
|
export default Scene;
|
package/types/scene/export.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
17
17
|
viewBackgroundColor: string;
|
|
18
18
|
exportWithDarkMode?: boolean;
|
|
19
19
|
exportEmbedScene?: boolean;
|
|
20
|
+
renderFrame?: boolean;
|
|
20
21
|
}, files: BinaryFiles | null, opts?: {
|
|
21
22
|
serializeAsJSON?: () => string;
|
|
22
23
|
}) => Promise<SVGSVGElement>;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Frames and their containing elements are not to be selected at the same time.
|
|
5
|
+
* Given an array of selected elements, if there are frames and their containing elements
|
|
6
|
+
* we only keep the frames.
|
|
7
|
+
* @param selectedElements
|
|
8
|
+
*/
|
|
9
|
+
export declare const excludeElementsInFramesFromSelection: <T extends ExcalidrawElement>(selectedElements: readonly T[]) => T[];
|
|
10
|
+
export declare const getElementsWithinSelection: (elements: readonly NonDeletedExcalidrawElement[], selection: NonDeletedExcalidrawElement, excludeElementsInFrames?: boolean) => NonDeletedExcalidrawElement[];
|
|
4
11
|
export declare const isSomeElementSelected: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">) => boolean;
|
|
5
12
|
/**
|
|
6
13
|
* Returns common attribute (picked by `getAttribute` callback) of selected
|
|
7
14
|
* elements. If elements don't share the same value, returns `null`.
|
|
8
15
|
*/
|
|
9
16
|
export declare const getCommonAttributeOfSelectedElements: <T>(elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">, getAttribute: (element: ExcalidrawElement) => T) => T | null;
|
|
10
|
-
export declare const getSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">,
|
|
11
|
-
|
|
17
|
+
export declare const getSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">, opts?: {
|
|
18
|
+
includeBoundTextElement?: boolean;
|
|
19
|
+
includeElementsInFrames?: boolean;
|
|
20
|
+
}) => ExcalidrawElement[];
|
|
21
|
+
export declare const getTargetElements: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds" | "editingElement">) => ExcalidrawElement[];
|