@dwelle/excalidraw 0.4.0-9e2b706 → 0.4.0-9fa56da
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/CHANGELOG.md +456 -0
- package/README.md +6 -2
- package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js → vendor-d415b28e9024dee4bb1b.js} +2 -2
- package/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.js → vendor-a14cd58fa2db417e42b2.js} +6 -6
- package/dist/excalidraw.development.js +2908 -1612
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +9 -4
- package/types/actions/actionAddToLibrary.d.ts +103 -52
- package/types/actions/actionAlign.d.ts +33 -28
- package/types/actions/actionBoundText.d.ts +176 -22
- package/types/actions/actionCanvas.d.ts +592 -184
- package/types/actions/actionClipboard.d.ts +173 -92
- package/types/actions/actionDeleteSelected.d.ts +101 -54
- package/types/actions/actionDistribute.d.ts +11 -12
- package/types/actions/actionDuplicateSelection.d.ts +3 -4
- package/types/actions/actionElementLock.d.ts +271 -0
- package/types/actions/actionExport.d.ts +366 -213
- package/types/actions/actionFinalize.d.ts +70 -40
- package/types/actions/actionFlip.d.ts +8 -11
- package/types/actions/actionFrame.d.ts +423 -0
- package/types/actions/actionGroup.d.ts +250 -13
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +37 -20
- package/types/actions/actionMenu.d.ts +108 -59
- package/types/actions/actionNavigate.d.ts +1 -1
- package/types/actions/actionProperties.d.ts +464 -242
- package/types/actions/actionSelectAll.d.ts +123 -4
- package/types/actions/actionStyles.d.ts +39 -23
- package/types/actions/actionToggleGridMode.d.ts +37 -21
- package/types/actions/{actionToggleLock.d.ts → actionToggleObjectsSnapMode.d.ts} +49 -31
- package/types/actions/actionToggleStats.d.ts +37 -21
- package/types/actions/actionToggleViewMode.d.ts +37 -21
- package/types/actions/actionToggleZenMode.d.ts +37 -21
- package/types/actions/actionZindex.d.ts +12 -12
- package/types/actions/index.d.ts +2 -1
- package/types/actions/manager.d.ts +1 -1
- package/types/actions/shortcuts.d.ts +2 -1
- package/types/actions/types.d.ts +11 -9
- package/types/appState.d.ts +17 -19
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +5 -6
- package/types/clipboard.d.ts +3 -2
- package/types/colors.d.ts +60 -5
- package/types/components/Actions.d.ts +7 -8
- package/types/components/ActiveConfirmDialog.d.ts +1 -21
- package/types/components/App.d.ts +88 -33
- package/types/components/Avatar.d.ts +1 -2
- package/types/components/BraveMeasureTextError.d.ts +2 -0
- package/types/components/Button.d.ts +3 -2
- package/types/components/ButtonIconSelect.d.ts +11 -3
- package/types/components/Card.d.ts +0 -1
- package/types/components/ColorPicker/ColorInput.d.ts +9 -0
- package/types/components/ColorPicker/ColorPicker.d.ts +19 -0
- package/types/components/ColorPicker/CustomColorList.d.ts +8 -0
- package/types/components/ColorPicker/HotkeyLabel.d.ts +8 -0
- package/types/components/ColorPicker/Picker.d.ts +18 -0
- package/types/components/ColorPicker/PickerColorList.d.ts +10 -0
- package/types/components/ColorPicker/PickerHeading.d.ts +5 -0
- package/types/components/ColorPicker/ShadeList.d.ts +8 -0
- package/types/components/ColorPicker/TopPicks.d.ts +9 -0
- package/types/components/ColorPicker/colorPickerUtils.d.ts +21 -0
- package/types/components/ColorPicker/keyboardNavHandlers.d.ts +20 -0
- package/types/components/ContextMenu.d.ts +3 -3
- package/types/components/DefaultSidebar.d.ts +29 -0
- package/types/components/Dialog.d.ts +3 -4
- package/types/components/ErrorDialog.d.ts +3 -2
- package/types/components/ExcalidrawLogo.d.ts +15 -0
- package/types/components/EyeDropper.d.ts +28 -0
- package/types/components/FilledButton.d.ts +17 -0
- package/types/components/FixedSideContainer.d.ts +1 -1
- package/types/components/HandButton.d.ts +1 -1
- package/types/components/HelpButton.d.ts +1 -2
- package/types/components/HintViewer.d.ts +4 -5
- package/types/components/HomeButton.d.ts +1 -1
- package/types/components/ImageExportDialog.d.ts +8 -13
- package/types/components/Island.d.ts +1 -1
- package/types/components/JSONExportDialog.d.ts +5 -5
- package/types/components/LaserTool/LaserPathManager.d.ts +28 -0
- package/types/components/LaserTool/LaserPointerButton.d.ts +10 -0
- package/types/components/LaserTool/LaserTool.d.ts +7 -0
- package/types/components/LayerUI.d.ts +9 -11
- package/types/components/LibraryMenu.d.ts +13 -14
- package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
- package/types/components/LibraryMenuControlButtons.d.ts +9 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +10 -28
- package/types/components/LibraryMenuItems.d.ts +6 -7
- package/types/components/LibraryMenuSection.d.ts +22 -0
- package/types/components/LibraryUnit.d.ts +6 -3
- package/types/components/LoadingMessage.d.ts +0 -1
- package/types/components/LockButton.d.ts +1 -1
- package/types/components/MobileMenu.d.ts +7 -6
- 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/PasteChartDialog.d.ts +4 -5
- package/types/components/PenModeButton.d.ts +1 -1
- package/types/components/Popover.d.ts +1 -1
- package/types/components/ProjectName.d.ts +2 -1
- package/types/components/PublishLibrary.d.ts +2 -2
- package/types/components/RadioGroup.d.ts +12 -0
- package/types/components/Section.d.ts +1 -1
- package/types/components/Sidebar/Sidebar.d.ts +66 -63
- package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
- package/types/components/Sidebar/SidebarTab.d.ts +8 -0
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +9 -0
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +6 -0
- package/types/components/Sidebar/SidebarTabs.d.ts +6 -0
- package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
- package/types/components/Sidebar/common.d.ts +24 -7
- package/types/components/Spinner.d.ts +2 -1
- package/types/components/Stack.d.ts +4 -3
- package/types/components/Stats.d.ts +3 -3
- package/types/components/Switch.d.ts +9 -0
- package/types/components/ToolButton.d.ts +5 -4
- package/types/components/Tooltip.d.ts +1 -1
- package/types/components/Trans.d.ts +9 -0
- package/types/components/canvases/InteractiveCanvas.d.ts +27 -0
- package/types/components/canvases/StaticCanvas.d.ts +18 -0
- package/types/components/canvases/index.d.ts +3 -0
- package/types/components/dropdownMenu/DropdownMenu.d.ts +9 -5
- package/types/components/dropdownMenu/DropdownMenuItem.d.ts +2 -1
- package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -1
- package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +2 -1
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -2
- package/types/components/dropdownMenu/common.d.ts +1 -1
- package/types/components/footer/Footer.d.ts +2 -2
- package/types/components/icons.d.ts +15 -1
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -1
- package/types/components/main-menu/MainMenu.d.ts +9 -5
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -1
- package/types/components/welcome-screen/WelcomeScreen.d.ts +0 -1
- package/types/constants.d.ts +81 -11
- package/types/context/tunnels.d.ts +19 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/data/blob.d.ts +3 -2
- package/types/data/encode.d.ts +1 -1
- package/types/data/filesystem.d.ts +2 -1
- package/types/data/index.d.ts +1 -1
- package/types/data/library.d.ts +3 -45
- package/types/data/restore.d.ts +2 -2
- package/types/data/transform.d.ts +71 -0
- package/types/data/types.d.ts +3 -5
- package/types/data/url.d.ts +7 -0
- package/types/element/Hyperlink.d.ts +48 -28
- package/types/element/binding.d.ts +4 -3
- package/types/element/bounds.d.ts +30 -6
- package/types/element/collision.d.ts +7 -7
- package/types/element/dragElements.d.ts +12 -2
- package/types/element/embeddable.d.ts +153 -0
- package/types/element/image.d.ts +11 -1
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +40 -24
- package/types/element/mutateElement.d.ts +2 -1
- package/types/element/newElement.d.ts +49 -13
- package/types/element/resizeElements.d.ts +3 -2
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/sizeHelpers.d.ts +8 -1
- package/types/element/textElement.d.ts +40 -15
- package/types/element/textWysiwyg.d.ts +1 -1
- package/types/element/transformHandles.d.ts +15 -8
- package/types/element/typeChecks.d.ts +4 -1
- package/types/element/types.d.ts +60 -35
- package/types/emitter.d.ts +1 -1
- package/types/errors.d.ts +1 -1
- package/types/frame.d.ts +40 -0
- package/types/ga.d.ts +5 -5
- package/types/groups.d.ts +15 -11
- package/types/history.d.ts +3 -3
- package/types/hooks/useCreatePortalContainer.d.ts +4 -0
- package/types/hooks/useLibraryItemSvg.d.ts +11 -0
- package/types/hooks/useOutsideClick.d.ts +19 -2
- package/types/hooks/useScrollPosition.d.ts +1 -0
- package/types/hooks/useStable.d.ts +1 -0
- package/types/hooks/useTransition.d.ts +2 -0
- package/types/i18n.d.ts +7 -4
- package/types/jotai.d.ts +16 -104
- package/types/keys.d.ts +5 -1
- package/types/math.d.ts +3 -0
- package/types/packages/excalidraw/example/initialData.d.ts +182 -64
- package/types/packages/excalidraw/index.d.ts +6 -2
- package/types/packages/excalidraw/webpack.dev.config.d.ts +5 -2
- package/types/packages/excalidraw/webpack.prod.config.d.ts +3 -0
- package/types/packages/utils.d.ts +28 -24
- package/types/renderer/renderElement.d.ts +12 -22
- package/types/renderer/renderScene.d.ts +19 -29
- package/types/renderer/renderSnaps.d.ts +2 -0
- package/types/renderer/roundRect.d.ts +1 -1
- package/types/scene/Renderer.d.ts +25 -0
- package/types/scene/Scene.d.ts +27 -5
- package/types/scene/Shape.d.ts +12 -0
- package/types/scene/ShapeCache.d.ts +20 -0
- package/types/scene/export.d.ts +182 -10
- package/types/scene/scroll.d.ts +1 -1
- package/types/scene/scrollbars.d.ts +2 -6
- package/types/scene/selection.d.ts +27 -6
- package/types/scene/types.d.ts +69 -26
- package/types/snapping.d.ts +108 -0
- package/types/types.d.ts +189 -69
- package/types/utility-types.d.ts +24 -0
- package/types/utils.d.ts +72 -14
- package/types/zindex.d.ts +4 -4
- package/types/components/ColorPicker.d.ts +0 -14
- package/types/components/LibraryButton.d.ts +0 -8
- package/types/components/SingleLibraryItem.d.ts +0 -10
- package/types/components/context/tunnels.d.ts +0 -16
- package/types/components/hoc/withUpstreamOverride.d.ts +0 -10
- /package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js.LICENSE.txt → vendor-d415b28e9024dee4bb1b.js.LICENSE.txt} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.d.ts → vendor-d415b28e9024dee4bb1b.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.d.ts → vendor-a14cd58fa2db417e42b2.d.ts} +0 -0
package/types/constants.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { AppProps } from "./types";
|
|
2
|
-
import { FontFamilyValues } from "./element/types";
|
|
1
|
+
import { AppProps, NormalizedZoomValue } from "./types";
|
|
2
|
+
import { ExcalidrawElement, FontFamilyValues } from "./element/types";
|
|
3
3
|
export declare const isDarwin: boolean;
|
|
4
4
|
export declare const isWindows: boolean;
|
|
5
5
|
export declare const isAndroid: boolean;
|
|
6
6
|
export declare const isFirefox: boolean;
|
|
7
7
|
export declare const isChrome: boolean;
|
|
8
8
|
export declare const isSafari: boolean;
|
|
9
|
+
export declare const isBrave: () => boolean;
|
|
9
10
|
export declare const APP_NAME = "Excalidraw";
|
|
10
11
|
export declare const DRAGGING_THRESHOLD = 10;
|
|
11
12
|
export declare const LINE_CONFIRM_THRESHOLD = 8;
|
|
@@ -28,6 +29,11 @@ export declare const POINTER_BUTTON: {
|
|
|
28
29
|
readonly SECONDARY: 2;
|
|
29
30
|
readonly TOUCH: -1;
|
|
30
31
|
};
|
|
32
|
+
export declare const POINTER_EVENTS: {
|
|
33
|
+
readonly enabled: "all";
|
|
34
|
+
readonly disabled: "none";
|
|
35
|
+
readonly inheritFromUI: any;
|
|
36
|
+
};
|
|
31
37
|
export declare enum EVENT {
|
|
32
38
|
COPY = "copy",
|
|
33
39
|
PASTE = "paste",
|
|
@@ -46,6 +52,7 @@ export declare enum EVENT {
|
|
|
46
52
|
GESTURE_START = "gesturestart",
|
|
47
53
|
GESTURE_CHANGE = "gesturechange",
|
|
48
54
|
POINTER_MOVE = "pointermove",
|
|
55
|
+
POINTER_DOWN = "pointerdown",
|
|
49
56
|
POINTER_UP = "pointerup",
|
|
50
57
|
STATE_CHANGE = "statechange",
|
|
51
58
|
WHEEL = "wheel",
|
|
@@ -55,11 +62,21 @@ export declare enum EVENT {
|
|
|
55
62
|
VISIBILITY_CHANGE = "visibilitychange",
|
|
56
63
|
SCROLL = "scroll",
|
|
57
64
|
EXCALIDRAW_LINK = "excalidraw-link",
|
|
58
|
-
MENU_ITEM_SELECT = "menu.itemSelect"
|
|
65
|
+
MENU_ITEM_SELECT = "menu.itemSelect",
|
|
66
|
+
MESSAGE = "message"
|
|
59
67
|
}
|
|
68
|
+
export declare const YOUTUBE_STATES: {
|
|
69
|
+
readonly UNSTARTED: -1;
|
|
70
|
+
readonly ENDED: 0;
|
|
71
|
+
readonly PLAYING: 1;
|
|
72
|
+
readonly PAUSED: 2;
|
|
73
|
+
readonly BUFFERING: 3;
|
|
74
|
+
readonly CUED: 5;
|
|
75
|
+
};
|
|
60
76
|
export declare const ENV: {
|
|
61
77
|
TEST: string;
|
|
62
78
|
DEVELOPMENT: string;
|
|
79
|
+
PRODUCTION: string;
|
|
63
80
|
};
|
|
64
81
|
export declare const CLASSES: {
|
|
65
82
|
SHAPE_ACTIONS_MENU: string;
|
|
@@ -70,36 +87,72 @@ export declare const FONT_FAMILY: {
|
|
|
70
87
|
Cascadia: number;
|
|
71
88
|
};
|
|
72
89
|
export declare const THEME: {
|
|
73
|
-
LIGHT:
|
|
74
|
-
DARK:
|
|
90
|
+
readonly LIGHT: "light";
|
|
91
|
+
readonly DARK: "dark";
|
|
92
|
+
};
|
|
93
|
+
export declare const FRAME_STYLE: {
|
|
94
|
+
strokeColor: string;
|
|
95
|
+
strokeWidth: number;
|
|
96
|
+
strokeStyle: import("./element/types").StrokeStyle;
|
|
97
|
+
fillStyle: import("./element/types").FillStyle;
|
|
98
|
+
roughness: number;
|
|
99
|
+
roundness: {
|
|
100
|
+
type: import("./element/types").RoundnessType;
|
|
101
|
+
value?: number | undefined;
|
|
102
|
+
} | null;
|
|
103
|
+
backgroundColor: string;
|
|
104
|
+
radius: number;
|
|
75
105
|
};
|
|
76
106
|
export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
|
|
107
|
+
export declare const MIN_FONT_SIZE = 1;
|
|
77
108
|
export declare const DEFAULT_FONT_SIZE = 20;
|
|
78
109
|
export declare const DEFAULT_FONT_FAMILY: FontFamilyValues;
|
|
79
110
|
export declare const DEFAULT_TEXT_ALIGN = "left";
|
|
80
111
|
export declare const DEFAULT_VERTICAL_ALIGN = "top";
|
|
81
112
|
export declare const DEFAULT_VERSION = "{version}";
|
|
113
|
+
export declare const DEFAULT_BACKGROUND_COLOR = "#ffffff";
|
|
114
|
+
export declare const DEFAULT_STROKE_COLOR = "#000000";
|
|
115
|
+
export declare const DEFAULT_ZOOM_VALUE: NormalizedZoomValue;
|
|
82
116
|
export declare const CANVAS_ONLY_ACTIONS: string[];
|
|
83
117
|
export declare const GRID_SIZE = 20;
|
|
118
|
+
export declare const IMAGE_MIME_TYPES: {
|
|
119
|
+
readonly svg: "image/svg+xml";
|
|
120
|
+
readonly png: "image/png";
|
|
121
|
+
readonly jpg: "image/jpeg";
|
|
122
|
+
readonly gif: "image/gif";
|
|
123
|
+
readonly webp: "image/webp";
|
|
124
|
+
readonly bmp: "image/bmp";
|
|
125
|
+
readonly ico: "image/x-icon";
|
|
126
|
+
readonly avif: "image/avif";
|
|
127
|
+
readonly jfif: "image/jfif";
|
|
128
|
+
};
|
|
84
129
|
export declare const MIME_TYPES: {
|
|
85
|
-
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
86
|
-
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
87
|
-
readonly json: "application/json";
|
|
88
130
|
readonly svg: "image/svg+xml";
|
|
89
|
-
readonly "excalidraw.svg": "image/svg+xml";
|
|
90
131
|
readonly png: "image/png";
|
|
91
|
-
readonly "excalidraw.png": "image/png";
|
|
92
132
|
readonly jpg: "image/jpeg";
|
|
93
133
|
readonly gif: "image/gif";
|
|
94
134
|
readonly webp: "image/webp";
|
|
95
135
|
readonly bmp: "image/bmp";
|
|
96
136
|
readonly ico: "image/x-icon";
|
|
137
|
+
readonly avif: "image/avif";
|
|
138
|
+
readonly jfif: "image/jfif";
|
|
139
|
+
readonly json: "application/json";
|
|
140
|
+
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
141
|
+
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
142
|
+
readonly "excalidraw.svg": "image/svg+xml";
|
|
143
|
+
readonly "excalidraw.png": "image/png";
|
|
97
144
|
readonly binary: "application/octet-stream";
|
|
98
145
|
};
|
|
146
|
+
export declare const EXPORT_IMAGE_TYPES: {
|
|
147
|
+
readonly png: "png";
|
|
148
|
+
readonly svg: "svg";
|
|
149
|
+
readonly clipboard: "clipboard";
|
|
150
|
+
};
|
|
99
151
|
export declare const EXPORT_DATA_TYPES: {
|
|
100
152
|
readonly excalidraw: "excalidraw";
|
|
101
153
|
readonly excalidrawClipboard: "excalidraw/clipboard";
|
|
102
154
|
readonly excalidrawLibrary: "excalidrawlib";
|
|
155
|
+
readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
|
|
103
156
|
};
|
|
104
157
|
export declare const EXPORT_SOURCE: string;
|
|
105
158
|
export declare const IMAGE_RENDER_TIMEOUT = 500;
|
|
@@ -131,7 +184,6 @@ export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
|
131
184
|
export declare const EXPORT_SCALES: number[];
|
|
132
185
|
export declare const DEFAULT_EXPORT_PADDING = 10;
|
|
133
186
|
export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
|
|
134
|
-
export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif", "image/webp", "image/bmp", "image/x-icon"];
|
|
135
187
|
export declare const MAX_ALLOWED_FILE_BYTES: number;
|
|
136
188
|
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
137
189
|
export declare const ENCRYPTION_KEY_BITS = 128;
|
|
@@ -140,6 +192,8 @@ export declare const VERSIONS: {
|
|
|
140
192
|
readonly excalidrawLibrary: 2;
|
|
141
193
|
};
|
|
142
194
|
export declare const BOUND_TEXT_PADDING = 5;
|
|
195
|
+
export declare const ARROW_LABEL_WIDTH_FRACTION = 0.7;
|
|
196
|
+
export declare const ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO = 11;
|
|
143
197
|
export declare const VERTICAL_ALIGN: {
|
|
144
198
|
TOP: string;
|
|
145
199
|
MIDDLE: string;
|
|
@@ -161,3 +215,19 @@ export declare const ROUNDNESS: {
|
|
|
161
215
|
/** key containt id of precedeing elemnt id we use in reconciliation during
|
|
162
216
|
* collaboration */
|
|
163
217
|
export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
|
|
218
|
+
export declare const DEFAULT_ELEMENT_PROPS: {
|
|
219
|
+
strokeColor: ExcalidrawElement["strokeColor"];
|
|
220
|
+
backgroundColor: ExcalidrawElement["backgroundColor"];
|
|
221
|
+
fillStyle: ExcalidrawElement["fillStyle"];
|
|
222
|
+
strokeWidth: ExcalidrawElement["strokeWidth"];
|
|
223
|
+
strokeStyle: ExcalidrawElement["strokeStyle"];
|
|
224
|
+
roughness: ExcalidrawElement["roughness"];
|
|
225
|
+
opacity: ExcalidrawElement["opacity"];
|
|
226
|
+
locked: ExcalidrawElement["locked"];
|
|
227
|
+
};
|
|
228
|
+
export declare const LIBRARY_SIDEBAR_TAB = "library";
|
|
229
|
+
export declare const DEFAULT_SIDEBAR: {
|
|
230
|
+
readonly name: "default";
|
|
231
|
+
readonly defaultTab: "library";
|
|
232
|
+
};
|
|
233
|
+
export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "image">;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import tunnel from "tunnel-rat";
|
|
3
|
+
export type Tunnel = ReturnType<typeof tunnel>;
|
|
4
|
+
type TunnelsContextValue = {
|
|
5
|
+
MainMenuTunnel: Tunnel;
|
|
6
|
+
WelcomeScreenMenuHintTunnel: Tunnel;
|
|
7
|
+
WelcomeScreenToolbarHintTunnel: Tunnel;
|
|
8
|
+
WelcomeScreenHelpHintTunnel: Tunnel;
|
|
9
|
+
WelcomeScreenCenterTunnel: Tunnel;
|
|
10
|
+
FooterCenterTunnel: Tunnel;
|
|
11
|
+
DefaultSidebarTriggerTunnel: Tunnel;
|
|
12
|
+
DefaultSidebarTabTriggersTunnel: Tunnel;
|
|
13
|
+
OverwriteConfirmDialogTunnel: Tunnel;
|
|
14
|
+
jotaiScope: symbol;
|
|
15
|
+
};
|
|
16
|
+
export declare const TunnelsContext: React.Context<TunnelsContextValue>;
|
|
17
|
+
export declare const useTunnels: () => TunnelsContextValue;
|
|
18
|
+
export declare const useInitializeTunnels: () => TunnelsContextValue;
|
|
19
|
+
export {};
|
package/types/data/blob.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
|
|
2
2
|
import { ExcalidrawElement, FileId } from "../element/types";
|
|
3
3
|
import { AppState, DataURL, LibraryItem } from "../types";
|
|
4
|
+
import { ValueOf } from "../utility-types";
|
|
4
5
|
import { FileSystemHandle } from "./filesystem";
|
|
5
6
|
import { ImportedLibraryData } from "./types";
|
|
6
7
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
@@ -8,7 +9,7 @@ export declare const getFileHandleType: (handle: FileSystemHandle | null) => str
|
|
|
8
9
|
export declare const isImageFileHandleType: (type: string | null) => type is "svg" | "png";
|
|
9
10
|
export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boolean;
|
|
10
11
|
export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
|
|
11
|
-
type:
|
|
12
|
+
type: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
12
13
|
};
|
|
13
14
|
export declare const loadSceneOrLibraryFromBlob: (blob: Blob | File, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null, fileHandle?: FileSystemHandle | null) => Promise<{
|
|
14
15
|
type: "application/vnd.excalidraw+json";
|
package/types/data/encode.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const toByteString: (data: string | Uint8Array | ArrayBuffer) =>
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const stringToBase64: (str: string, isByteString?: boolean) => Promise<string>;
|
|
7
7
|
export declare const base64ToString: (base64: string, isByteString?: boolean) => Promise<string>;
|
|
8
|
-
|
|
8
|
+
type EncodedData = {
|
|
9
9
|
encoded: string;
|
|
10
10
|
encoding: "bstring";
|
|
11
11
|
/** whether text is compressed (zlib) */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FileSystemHandle, supported as nativeFileSystemSupported } from "browser-fs-access";
|
|
2
|
-
|
|
2
|
+
import { MIME_TYPES } from "../constants";
|
|
3
|
+
type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
|
|
3
4
|
export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
|
|
4
5
|
extensions?: FILE_EXTENSION[] | undefined;
|
|
5
6
|
description: string;
|
package/types/data/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AppState, BinaryFiles } from "../types";
|
|
|
4
4
|
import { FileSystemHandle } from "./filesystem";
|
|
5
5
|
export { loadFromBlob } from "./blob";
|
|
6
6
|
export { loadFromJSON, saveAsJSON } from "./json";
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const exportAsImage: (type: Omit<ExportType, "backend">, elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, }: {
|
|
8
8
|
exportBackground: boolean;
|
|
9
9
|
exportPadding?: number | undefined;
|
|
10
10
|
viewBackgroundColor: string;
|
package/types/data/library.d.ts
CHANGED
|
@@ -1,55 +1,11 @@
|
|
|
1
1
|
import { LibraryItems, ExcalidrawImperativeAPI, LibraryItemsSource } from "../types";
|
|
2
2
|
import type App from "../components/App";
|
|
3
3
|
import { ExcalidrawElement } from "../element/types";
|
|
4
|
-
export declare const libraryItemsAtom: import("jotai").
|
|
4
|
+
export declare const libraryItemsAtom: import("jotai").PrimitiveAtom<{
|
|
5
5
|
status: "loading" | "loaded";
|
|
6
6
|
isInitialized: boolean;
|
|
7
7
|
libraryItems: LibraryItems;
|
|
8
8
|
}> & {
|
|
9
|
-
write: (get: {
|
|
10
|
-
<Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
|
|
11
|
-
<Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
|
|
12
|
-
<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;
|
|
13
|
-
} & {
|
|
14
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
|
|
15
|
-
unstable_promise: true;
|
|
16
|
-
}): Value_3 | Promise<Value_3>;
|
|
17
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
|
|
18
|
-
unstable_promise: true;
|
|
19
|
-
}): Value_4 | Promise<Value_4>;
|
|
20
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>, options: {
|
|
21
|
-
unstable_promise: true;
|
|
22
|
-
}): (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>;
|
|
23
|
-
}, set: {
|
|
24
|
-
<Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
|
|
25
|
-
<Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
|
|
26
|
-
}, update: {
|
|
27
|
-
status: "loading" | "loaded";
|
|
28
|
-
isInitialized: boolean;
|
|
29
|
-
libraryItems: LibraryItems;
|
|
30
|
-
} | ((prev: {
|
|
31
|
-
status: "loading" | "loaded";
|
|
32
|
-
isInitialized: boolean;
|
|
33
|
-
libraryItems: LibraryItems;
|
|
34
|
-
}) => {
|
|
35
|
-
status: "loading" | "loaded";
|
|
36
|
-
isInitialized: boolean;
|
|
37
|
-
libraryItems: LibraryItems;
|
|
38
|
-
})) => void;
|
|
39
|
-
onMount?: (<S extends (update: {
|
|
40
|
-
status: "loading" | "loaded";
|
|
41
|
-
isInitialized: boolean;
|
|
42
|
-
libraryItems: LibraryItems;
|
|
43
|
-
} | ((prev: {
|
|
44
|
-
status: "loading" | "loaded";
|
|
45
|
-
isInitialized: boolean;
|
|
46
|
-
libraryItems: LibraryItems;
|
|
47
|
-
}) => {
|
|
48
|
-
status: "loading" | "loaded";
|
|
49
|
-
isInitialized: boolean;
|
|
50
|
-
libraryItems: LibraryItems;
|
|
51
|
-
})) => void>(setAtom: S) => void | (() => void)) | undefined;
|
|
52
|
-
} & {
|
|
53
9
|
init: {
|
|
54
10
|
status: "loading" | "loaded";
|
|
55
11
|
isInitialized: boolean;
|
|
@@ -70,6 +26,8 @@ declare class Library {
|
|
|
70
26
|
private updateQueue;
|
|
71
27
|
private getLastUpdateTask;
|
|
72
28
|
private notifyListeners;
|
|
29
|
+
/** call on excalidraw instance unmount */
|
|
30
|
+
destroy: () => void;
|
|
73
31
|
resetLibrary: () => Promise<LibraryItems>;
|
|
74
32
|
/**
|
|
75
33
|
* @returns latest cloned libraryItems. Awaits all in-progress updates first.
|
package/types/data/restore.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ExcalidrawElement } 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
|
-
export
|
|
6
|
+
export type RestoredDataState = {
|
|
7
7
|
elements: ExcalidrawElement[];
|
|
8
8
|
appState: RestoredAppState;
|
|
9
9
|
files: BinaryFiles;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ElementConstructorOpts } from "../element/newElement";
|
|
2
|
+
import { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawEmbeddableElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, TextAlign, VerticalAlign } from "../element/types";
|
|
3
|
+
import { MarkOptional } from "../utility-types";
|
|
4
|
+
export type ValidLinearElement = {
|
|
5
|
+
type: "arrow" | "line";
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
label?: {
|
|
9
|
+
text: string;
|
|
10
|
+
fontSize?: number;
|
|
11
|
+
fontFamily?: FontFamilyValues;
|
|
12
|
+
textAlign?: TextAlign;
|
|
13
|
+
verticalAlign?: VerticalAlign;
|
|
14
|
+
} & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
15
|
+
end?: (({
|
|
16
|
+
type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
17
|
+
id?: ExcalidrawGenericElement["id"];
|
|
18
|
+
} | {
|
|
19
|
+
id: ExcalidrawGenericElement["id"];
|
|
20
|
+
type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
21
|
+
}) | (({
|
|
22
|
+
type: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
} | {
|
|
25
|
+
type?: "text";
|
|
26
|
+
id: ExcalidrawTextElement["id"];
|
|
27
|
+
text: string;
|
|
28
|
+
}) & Partial<ExcalidrawTextElement>)) & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
29
|
+
start?: (({
|
|
30
|
+
type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
31
|
+
id?: ExcalidrawGenericElement["id"];
|
|
32
|
+
} | {
|
|
33
|
+
id: ExcalidrawGenericElement["id"];
|
|
34
|
+
type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
35
|
+
}) | (({
|
|
36
|
+
type: "text";
|
|
37
|
+
text: string;
|
|
38
|
+
} | {
|
|
39
|
+
type?: "text";
|
|
40
|
+
id: ExcalidrawTextElement["id"];
|
|
41
|
+
text: string;
|
|
42
|
+
}) & Partial<ExcalidrawTextElement>)) & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
43
|
+
} & Partial<ExcalidrawLinearElement>;
|
|
44
|
+
export type ValidContainer = {
|
|
45
|
+
type: Exclude<ExcalidrawGenericElement["type"], "selection">;
|
|
46
|
+
id?: ExcalidrawGenericElement["id"];
|
|
47
|
+
label?: {
|
|
48
|
+
text: string;
|
|
49
|
+
fontSize?: number;
|
|
50
|
+
fontFamily?: FontFamilyValues;
|
|
51
|
+
textAlign?: TextAlign;
|
|
52
|
+
verticalAlign?: VerticalAlign;
|
|
53
|
+
} & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
54
|
+
} & ElementConstructorOpts;
|
|
55
|
+
export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawEmbeddableElement | ExcalidrawFreeDrawElement | ExcalidrawFrameElement> | ({
|
|
56
|
+
type: Extract<ExcalidrawLinearElement["type"], "line">;
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
} & Partial<ExcalidrawLinearElement>) | ValidContainer | ValidLinearElement | ({
|
|
60
|
+
type: "text";
|
|
61
|
+
text: string;
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
id?: ExcalidrawTextElement["id"];
|
|
65
|
+
} & Partial<ExcalidrawTextElement>) | ({
|
|
66
|
+
type: Extract<ExcalidrawImageElement["type"], "image">;
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
fileId: FileId;
|
|
70
|
+
} & Partial<ExcalidrawImageElement>);
|
|
71
|
+
export declare const convertToExcalidrawElements: (elements: ExcalidrawElementSkeleton[] | null) => ExcalidrawElement[];
|
package/types/data/types.d.ts
CHANGED
|
@@ -17,11 +17,9 @@ export interface ExportedDataState {
|
|
|
17
17
|
* This is a helper type used in downstream abstractions.
|
|
18
18
|
* Don't consume on its own.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
21
|
-
/** @deprecated #
|
|
22
|
-
|
|
23
|
-
/** @deprecated #5663 TODO remove 22-12-15 */
|
|
24
|
-
isLibraryMenuDocked: [boolean, "isSidebarDocked"];
|
|
20
|
+
export type LegacyAppState = {
|
|
21
|
+
/** @deprecated #6213 TODO remove 23-06-01 */
|
|
22
|
+
isSidebarDocked: [boolean, "defaultSidebarDockedPreference"];
|
|
25
23
|
};
|
|
26
24
|
export interface ImportedDataState {
|
|
27
25
|
type?: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const normalizeLink: (link: string) => string;
|
|
2
|
+
export declare const isLocalLink: (link: string | null) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Returns URL sanitized and safe for usage in places such as
|
|
5
|
+
* iframe's src attribute or <a> href attributes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const toValidURL: (link: string) => string;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import { AppState, ExcalidrawProps } from "../types";
|
|
1
|
+
import { AppState, ExcalidrawProps, UIAppState } from "../types";
|
|
3
2
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
4
3
|
import { Bounds } from "./bounds";
|
|
5
4
|
import "./Hyperlink.scss";
|
|
6
5
|
export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
|
|
7
|
-
export declare const Hyperlink: ({ element, setAppState, onLinkOpen, }: {
|
|
6
|
+
export declare const Hyperlink: ({ element, setAppState, onLinkOpen, setToast, }: {
|
|
8
7
|
element: NonDeletedExcalidrawElement;
|
|
9
8
|
setAppState: React.Component<any, AppState>["setState"];
|
|
10
9
|
onLinkOpen: ExcalidrawProps["onLinkOpen"];
|
|
10
|
+
setToast: (toast: {
|
|
11
|
+
message: string;
|
|
12
|
+
closable?: boolean;
|
|
13
|
+
duration?: number;
|
|
14
|
+
} | null) => void;
|
|
11
15
|
}) => JSX.Element | null;
|
|
12
|
-
export declare const normalizeLink: (link: string) => string;
|
|
13
|
-
export declare const isLocalLink: (link: string | null) => boolean;
|
|
14
16
|
export declare const actionLink: {
|
|
15
17
|
name: "hyperlink";
|
|
16
18
|
perform: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => false | {
|
|
@@ -25,7 +27,11 @@ export declare const actionLink: {
|
|
|
25
27
|
} | null;
|
|
26
28
|
showWelcomeScreen: boolean;
|
|
27
29
|
isLoading: boolean;
|
|
28
|
-
errorMessage:
|
|
30
|
+
errorMessage: import("react").ReactNode;
|
|
31
|
+
activeEmbeddable: {
|
|
32
|
+
element: NonDeletedExcalidrawElement;
|
|
33
|
+
state: "active" | "hover";
|
|
34
|
+
} | null;
|
|
29
35
|
draggingElement: NonDeletedExcalidrawElement | null;
|
|
30
36
|
resizingElement: NonDeletedExcalidrawElement | null;
|
|
31
37
|
multiElement: import("./types").NonDeleted<import("./types").ExcalidrawLinearElement> | null;
|
|
@@ -33,18 +39,21 @@ export declare const actionLink: {
|
|
|
33
39
|
isBindingEnabled: boolean;
|
|
34
40
|
startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
|
|
35
41
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
42
|
+
frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameElement> | null;
|
|
43
|
+
frameRendering: {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
name: boolean;
|
|
46
|
+
outline: boolean;
|
|
47
|
+
clip: boolean;
|
|
48
|
+
};
|
|
49
|
+
editingFrame: string | null;
|
|
50
|
+
elementsToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawElement>[] | null;
|
|
36
51
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
37
52
|
editingLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
38
53
|
activeTool: {
|
|
39
|
-
lastActiveTool: import("../types").
|
|
54
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
40
55
|
locked: boolean;
|
|
41
|
-
} & (
|
|
42
|
-
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | "hand";
|
|
43
|
-
customType: null;
|
|
44
|
-
} | {
|
|
45
|
-
type: "custom";
|
|
46
|
-
customType: string;
|
|
47
|
-
});
|
|
56
|
+
} & import("../types").ActiveTool;
|
|
48
57
|
penMode: boolean;
|
|
49
58
|
penDetected: boolean;
|
|
50
59
|
exportBackground: boolean;
|
|
@@ -75,17 +84,21 @@ export declare const actionLink: {
|
|
|
75
84
|
zoom: Readonly<{
|
|
76
85
|
value: import("../types").NormalizedZoomValue;
|
|
77
86
|
}>;
|
|
78
|
-
openPopup: "
|
|
79
|
-
openSidebar:
|
|
87
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
88
|
+
openSidebar: {
|
|
89
|
+
name: string;
|
|
90
|
+
tab?: string | undefined;
|
|
91
|
+
} | null;
|
|
80
92
|
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
81
|
-
|
|
93
|
+
defaultSidebarDockedPreference: boolean;
|
|
82
94
|
lastPointerDownWith: import("./types").PointerType;
|
|
83
|
-
selectedElementIds: {
|
|
84
|
-
[id: string]:
|
|
85
|
-
}
|
|
95
|
+
selectedElementIds: Readonly<{
|
|
96
|
+
[id: string]: true;
|
|
97
|
+
}>;
|
|
86
98
|
previousSelectedElementIds: {
|
|
87
|
-
[id: string]:
|
|
99
|
+
[id: string]: true;
|
|
88
100
|
};
|
|
101
|
+
selectedElementsAreBeingDragged: boolean;
|
|
89
102
|
shouldCacheIgnoreZoom: boolean;
|
|
90
103
|
toast: {
|
|
91
104
|
message: string;
|
|
@@ -93,7 +106,7 @@ export declare const actionLink: {
|
|
|
93
106
|
duration?: number | undefined;
|
|
94
107
|
} | null;
|
|
95
108
|
zenModeEnabled: boolean;
|
|
96
|
-
theme:
|
|
109
|
+
theme: import("./types").Theme;
|
|
97
110
|
gridSize: number | null;
|
|
98
111
|
viewModeEnabled: boolean;
|
|
99
112
|
selectedGroupIds: {
|
|
@@ -117,6 +130,12 @@ export declare const actionLink: {
|
|
|
117
130
|
};
|
|
118
131
|
pendingImageElementId: string | null;
|
|
119
132
|
selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
133
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
134
|
+
originSnapOffset: {
|
|
135
|
+
x: number;
|
|
136
|
+
y: number;
|
|
137
|
+
} | null;
|
|
138
|
+
objectsSnapModeEnabled: boolean;
|
|
120
139
|
};
|
|
121
140
|
commitToHistory: true;
|
|
122
141
|
};
|
|
@@ -124,16 +143,17 @@ export declare const actionLink: {
|
|
|
124
143
|
category: "hyperlink";
|
|
125
144
|
action: string;
|
|
126
145
|
};
|
|
127
|
-
keyTest: (event:
|
|
128
|
-
contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.edit" | "labels.link.create";
|
|
146
|
+
keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
|
|
147
|
+
contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
|
|
129
148
|
predicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
|
|
130
149
|
PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps) => JSX.Element;
|
|
131
150
|
} & {
|
|
132
|
-
keyTest?: ((event:
|
|
151
|
+
keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
|
|
133
152
|
};
|
|
134
|
-
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.edit" | "labels.link.create";
|
|
135
|
-
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState:
|
|
136
|
-
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number]
|
|
153
|
+
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
|
|
154
|
+
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: Pick<UIAppState, "zoom">) => [x: number, y: number, width: number, height: number];
|
|
155
|
+
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number]) => boolean;
|
|
156
|
+
export declare const isPointHittingLink: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number], isMobile: boolean) => boolean;
|
|
137
157
|
export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState) => void;
|
|
138
158
|
export declare const hideHyperlinkToolip: () => void;
|
|
139
159
|
export declare const shouldHideLinkPopup: (element: NonDeletedExcalidrawElement, appState: AppState, [clientX, clientY]: readonly [number, number]) => Boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ExcalidrawLinearElement, ExcalidrawBindableElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawElement } from "./types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import Scene from "../scene/Scene";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
|
|
5
|
+
export type SuggestedPointBinding = [
|
|
6
6
|
NonDeleted<ExcalidrawLinearElement>,
|
|
7
7
|
"start" | "end" | "both",
|
|
8
8
|
NonDeleted<ExcalidrawBindableElement>
|
|
9
9
|
];
|
|
10
|
-
export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<
|
|
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") => void;
|
|
13
13
|
export declare const bindOrUnbindSelectedElements: (elements: NonDeleted<ExcalidrawElement>[]) => void;
|
|
@@ -15,6 +15,7 @@ export declare const maybeBindLinearElement: (linearElement: NonDeleted<Excalidr
|
|
|
15
15
|
x: number;
|
|
16
16
|
y: number;
|
|
17
17
|
}) => void;
|
|
18
|
+
export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => void;
|
|
18
19
|
export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
|
|
19
20
|
export declare const unbindLinearElements: (elements: NonDeleted<ExcalidrawElement>[]) => void;
|
|
20
21
|
export declare const getHoveredElementForBinding: (pointerCoords: {
|
|
@@ -1,21 +1,45 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, NonDeleted } from "./types";
|
|
2
2
|
import { Drawable, Op } from "roughjs/bin/core";
|
|
3
|
-
|
|
3
|
+
import { Point } from "../types";
|
|
4
|
+
export type RectangleBox = {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
angle: number;
|
|
10
|
+
};
|
|
11
|
+
export type Bounds = readonly [x1: number, y1: number, x2: number, y2: number];
|
|
12
|
+
export declare class ElementBounds {
|
|
13
|
+
private static boundsCache;
|
|
14
|
+
static getBounds(element: ExcalidrawElement): Bounds;
|
|
15
|
+
private static calculateBounds;
|
|
16
|
+
}
|
|
4
17
|
export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, includeBoundText?: boolean) => [number, number, number, number, number, number];
|
|
18
|
+
export declare const getElementLineSegments: (element: ExcalidrawElement) => [Point, Point][];
|
|
19
|
+
/**
|
|
20
|
+
* Scene -> Scene coords, but in x1,x2,y1,y2 format.
|
|
21
|
+
*
|
|
22
|
+
* Rectangle here means any rectangular frame, not an excalidraw element.
|
|
23
|
+
*/
|
|
24
|
+
export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBox) => number[];
|
|
5
25
|
export declare const pointRelativeTo: (element: ExcalidrawElement, absoluteCoords: readonly [number, number]) => readonly [number, number];
|
|
6
26
|
export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
|
|
7
27
|
export declare const getCurvePathOps: (shape: Drawable) => Op[];
|
|
8
28
|
export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((x: number, y: number) => [number, number]) | undefined) => [number, number, number, number];
|
|
9
29
|
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
|
|
10
|
-
export declare const getElementBounds: (element: ExcalidrawElement) =>
|
|
11
|
-
export declare const getCommonBounds: (elements: readonly ExcalidrawElement[]) =>
|
|
30
|
+
export declare const getElementBounds: (element: ExcalidrawElement) => Bounds;
|
|
31
|
+
export declare const getCommonBounds: (elements: readonly ExcalidrawElement[]) => Bounds;
|
|
32
|
+
export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
}) => number[];
|
|
12
36
|
export declare const getResizedElementAbsoluteCoords: (element: ExcalidrawElement, nextWidth: number, nextHeight: number, normalizePoints: boolean) => [number, number, number, number];
|
|
13
37
|
export declare const getElementPointsCoords: (element: ExcalidrawLinearElement, points: readonly (readonly [number, number])[]) => [number, number, number, number];
|
|
14
38
|
export declare const getClosestElementBounds: (elements: readonly ExcalidrawElement[], from: {
|
|
15
39
|
x: number;
|
|
16
40
|
y: number;
|
|
17
|
-
}) =>
|
|
18
|
-
export interface
|
|
41
|
+
}) => Bounds;
|
|
42
|
+
export interface BoundingBox {
|
|
19
43
|
minX: number;
|
|
20
44
|
minY: number;
|
|
21
45
|
maxX: number;
|
|
@@ -25,4 +49,4 @@ export interface Box {
|
|
|
25
49
|
width: number;
|
|
26
50
|
height: number;
|
|
27
51
|
}
|
|
28
|
-
export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) =>
|
|
52
|
+
export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
|