@zsviczian/excalidraw 0.18.0-5 → 0.18.0-51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/excalidraw.development.js +746 -504
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +0 -2
- package/dist/styles.development.css +1080 -437
- package/dist/styles.production.css +26 -22
- package/package.json +14 -3
- package/types/common/src/commonObsidianUtils.d.ts +13 -0
- package/types/common/src/constants.d.ts +42 -18
- package/types/common/src/editorInterface.d.ts +35 -0
- package/types/{excalidraw → common/src}/emitter.d.ts +1 -1
- package/types/common/src/font-metadata.d.ts +4 -2
- package/types/common/src/index.d.ts +2 -0
- package/types/common/src/utility-types.d.ts +5 -0
- package/types/common/src/utils.d.ts +20 -5
- package/types/{excalidraw/scene → element/src}/Scene.d.ts +16 -15
- package/types/element/src/align.d.ts +4 -3
- package/types/element/src/binding.d.ts +27 -17
- package/types/element/src/bounds.d.ts +14 -6
- package/types/element/src/collision.d.ts +18 -12
- package/types/element/src/cropElement.d.ts +1 -1
- package/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +77 -40
- package/types/element/src/distance.d.ts +2 -2
- package/types/element/src/distribute.d.ts +2 -1
- package/types/element/src/dragElements.d.ts +3 -2
- package/types/element/src/duplicate.d.ts +10 -13
- package/types/element/src/elbowArrow.d.ts +1 -1
- package/types/element/src/flowchart.d.ts +3 -2
- package/types/element/src/fractionalIndex.d.ts +9 -3
- package/types/element/src/frame.d.ts +5 -4
- package/types/element/src/groups.d.ts +1 -0
- package/types/element/src/index.d.ts +44 -2
- package/types/element/src/linearElementEditor.d.ts +23 -36
- package/types/element/src/mutateElement.d.ts +11 -3
- package/types/element/src/newElement.d.ts +6 -4
- package/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/types/element/src/renderElement.d.ts +4 -1
- package/types/element/src/resizeElements.d.ts +6 -5
- package/types/element/src/resizeTest.d.ts +5 -4
- package/types/element/src/selection.d.ts +11 -5
- package/types/element/src/shape.d.ts +42 -0
- package/types/element/src/sizeHelpers.d.ts +2 -2
- package/types/element/src/store.d.ts +237 -0
- package/types/element/src/textElement.d.ts +5 -3
- package/types/element/src/transformHandles.d.ts +5 -4
- package/types/element/src/typeChecks.d.ts +19 -1
- package/types/element/src/types.d.ts +25 -2
- package/types/element/src/utils.d.ts +16 -6
- package/types/element/src/zindex.d.ts +1 -1
- package/types/excalidraw/actions/actionAddToLibrary.d.ts +75 -54
- package/types/excalidraw/actions/actionBoundText.d.ts +50 -36
- package/types/excalidraw/actions/actionCanvas.d.ts +388 -282
- package/types/excalidraw/actions/actionClipboard.d.ts +151 -107
- package/types/excalidraw/actions/actionCropEditor.d.ts +25 -18
- package/types/excalidraw/actions/actionDeleteSelected.d.ts +77 -55
- package/types/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
- package/types/excalidraw/actions/actionElementLink.d.ts +25 -18
- package/types/excalidraw/actions/actionElementLock.d.ts +65 -52
- package/types/excalidraw/actions/actionEmbeddable.d.ts +25 -18
- package/types/excalidraw/actions/actionExport.d.ts +237 -174
- package/types/excalidraw/actions/actionFinalize.d.ts +307 -43
- package/types/excalidraw/actions/actionFrame.d.ts +157 -120
- package/types/excalidraw/actions/actionGroup.d.ts +50 -36
- package/types/excalidraw/actions/actionHistory.d.ts +1 -2
- package/types/excalidraw/actions/actionLinearEditor.d.ts +563 -20
- package/types/excalidraw/actions/actionLink.d.ts +23 -16
- package/types/excalidraw/actions/actionMenu.d.ts +25 -456
- package/types/excalidraw/actions/actionNavigate.d.ts +49 -35
- package/types/excalidraw/actions/actionProperties.d.ts +629 -273
- package/types/excalidraw/actions/actionSelectAll.d.ts +25 -18
- package/types/excalidraw/actions/actionStyles.d.ts +25 -18
- package/types/excalidraw/actions/actionToggleGridMode.d.ts +25 -18
- package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +25 -18
- package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +25 -223
- package/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
- package/types/excalidraw/actions/actionToggleStats.d.ts +25 -18
- package/types/excalidraw/actions/actionToggleViewMode.d.ts +25 -18
- package/types/excalidraw/actions/actionToggleZenMode.d.ts +26 -19
- package/types/excalidraw/actions/actionTrayMenu.d.ts +226 -0
- package/types/excalidraw/actions/index.d.ts +4 -2
- package/types/excalidraw/actions/types.d.ts +4 -3
- package/types/excalidraw/appState.d.ts +24 -10
- package/types/excalidraw/clipboard.d.ts +68 -5
- package/types/excalidraw/components/Actions.d.ts +20 -7
- package/types/excalidraw/components/App.d.ts +63 -38
- package/types/excalidraw/components/ButtonIcon.d.ts +1 -0
- package/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
- package/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -1
- package/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -3
- package/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +3 -3
- package/types/excalidraw/components/ColorPicker/ShadeList.d.ts +3 -2
- package/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
- package/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
- package/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
- package/types/excalidraw/components/Ellipsify.d.ts +3 -0
- package/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
- package/types/excalidraw/components/FilledButton.d.ts +1 -1
- package/types/excalidraw/components/FixedSideContainer.d.ts +2 -1
- package/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
- package/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
- package/types/excalidraw/components/HintViewer.d.ts +4 -3
- package/types/excalidraw/components/InlineIcon.d.ts +3 -1
- package/types/excalidraw/components/LayerUI.d.ts +2 -1
- package/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
- package/types/excalidraw/components/LinkButton.d.ts +4 -0
- package/types/excalidraw/components/MobileMenu.d.ts +4 -5
- package/types/excalidraw/components/MobileToolBar.d.ts +10 -0
- package/types/excalidraw/components/Popover.d.ts +2 -1
- package/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
- package/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
- package/types/excalidraw/components/Range.d.ts +3 -3
- package/types/excalidraw/components/Section.d.ts +1 -0
- package/types/excalidraw/components/Stats/Angle.d.ts +1 -1
- package/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
- package/types/excalidraw/components/Stats/CanvasGridSize.d.ts +1 -1
- package/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
- package/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
- package/types/excalidraw/components/Stats/DragInput.d.ts +12 -2
- package/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
- package/types/excalidraw/components/Stats/Position.d.ts +1 -1
- package/types/excalidraw/components/Stats/utils.d.ts +4 -11
- package/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
- package/types/excalidraw/components/TextField.d.ts +1 -0
- package/types/excalidraw/components/ToolPopover.d.ts +25 -0
- package/types/excalidraw/components/TrayMenu.d.ts +26 -0
- package/types/excalidraw/components/UnlockPopup.d.ts +8 -0
- package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +4 -2
- package/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
- package/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
- package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
- package/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
- package/types/excalidraw/components/icons.d.ts +17 -0
- package/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +14 -1
- package/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
- package/types/excalidraw/components/shapes.d.ts +115 -5
- package/types/excalidraw/data/blob.d.ts +3 -7
- package/types/excalidraw/data/reconcile.d.ts +1 -0
- package/types/excalidraw/data/restore.d.ts +6 -1
- package/types/excalidraw/data/transform.d.ts +1 -1
- package/types/excalidraw/data/types.d.ts +4 -1
- package/types/excalidraw/editor-jotai.d.ts +6 -6
- package/types/excalidraw/eraser/index.d.ts +12 -0
- package/types/excalidraw/fonts/Fonts.d.ts +1 -1
- package/types/excalidraw/history.d.ts +30 -22
- package/types/excalidraw/hooks/useEmitter.d.ts +1 -1
- package/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/types/excalidraw/hooks/useOutsideClick.d.ts +3 -1
- package/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
- package/types/excalidraw/index.d.ts +15 -14
- package/types/excalidraw/lasso/index.d.ts +1 -0
- package/types/excalidraw/lasso/utils.d.ts +3 -3
- package/types/excalidraw/obsidianUtils.d.ts +22 -4
- package/types/excalidraw/renderer/helpers.d.ts +7 -2
- package/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/types/excalidraw/renderer/staticScene.d.ts +4 -1
- package/types/excalidraw/scene/Renderer.d.ts +1 -2
- package/types/excalidraw/scene/index.d.ts +2 -2
- package/types/excalidraw/scene/scrollbars.d.ts +2 -3
- package/types/excalidraw/scene/types.d.ts +5 -3
- package/types/excalidraw/shortcut.d.ts +1 -0
- package/types/excalidraw/snapping.d.ts +2 -2
- package/types/excalidraw/types.d.ts +68 -30
- package/types/excalidraw/webpack.dev.config.d.ts +2 -0
- package/types/excalidraw/webpack.prod.config.d.ts +2 -0
- package/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
- package/types/math/src/angle.d.ts +2 -0
- package/types/math/src/constants.d.ts +3 -0
- package/types/math/src/curve.d.ts +34 -0
- package/types/math/src/index.d.ts +1 -0
- package/types/math/src/point.d.ts +1 -1
- package/types/math/src/rectangle.d.ts +2 -0
- package/types/math/src/segment.d.ts +1 -0
- package/types/math/src/types.d.ts +1 -0
- package/types/math/src/vector.d.ts +8 -2
- package/types/utils/src/bbox.d.ts +1 -1
- package/types/utils/src/index.d.ts +1 -1
- package/types/utils/src/withinBounds.d.ts +1 -1
- package/types/element/src/Shape.d.ts +0 -17
- package/types/element/src/ShapeCache.d.ts +0 -25
- package/types/element/src/shapes.d.ts +0 -23
- package/types/excalidraw/components/ButtonSelect.d.ts +0 -9
- package/types/excalidraw/store.d.ts +0 -129
- package/types/excalidraw/visualdebug.d.ts +0 -41
- package/types/utils/src/collision.d.ts +0 -8
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zsviczian/excalidraw",
|
|
3
|
-
"version": "0.18.0-
|
|
3
|
+
"version": "0.18.0-51",
|
|
4
4
|
"main": "main.js",
|
|
5
5
|
"module": "./dist/prod/index.js",
|
|
6
|
+
"source": "./index.tsx",
|
|
6
7
|
"types": "types/excalidraw/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
9
|
"./common/*": {
|
|
@@ -67,6 +68,13 @@
|
|
|
67
68
|
"last 1 safari version"
|
|
68
69
|
]
|
|
69
70
|
},
|
|
71
|
+
"repository": "https://github.com/excalidraw/excalidraw",
|
|
72
|
+
"bugs": "https://github.com/excalidraw/excalidraw/issues",
|
|
73
|
+
"homepage": "https://github.com/excalidraw/excalidraw/tree/master/packages/excalidraw",
|
|
74
|
+
"scripts": {
|
|
75
|
+
"gen:types": "rimraf types && tsc",
|
|
76
|
+
"build:esm": "rimraf dist && node ../../scripts/buildPackage.js && yarn gen:types"
|
|
77
|
+
},
|
|
70
78
|
"peerDependencies": {
|
|
71
79
|
"react": "^17.0.2 || ^18.2.0 || ^19.0.0",
|
|
72
80
|
"react-dom": "^17.0.2 || ^18.2.0 || ^19.0.0"
|
|
@@ -74,7 +82,7 @@
|
|
|
74
82
|
"dependencies": {
|
|
75
83
|
"@braintree/sanitize-url": "6.0.2",
|
|
76
84
|
"@zsviczian/laser-pointer": "1.3.1",
|
|
77
|
-
"@zsviczian/mermaid-to-excalidraw": "1.1.
|
|
85
|
+
"@zsviczian/mermaid-to-excalidraw": "1.1.3",
|
|
78
86
|
"@excalidraw/random-username": "1.1.0",
|
|
79
87
|
"@radix-ui/react-popover": "1.1.6",
|
|
80
88
|
"@radix-ui/react-tabs": "1.1.3",
|
|
@@ -153,7 +161,10 @@
|
|
|
153
161
|
"css-loader": "^7.1.2",
|
|
154
162
|
"esbuild-plugin-external-global": "^1.0.1"
|
|
155
163
|
},
|
|
156
|
-
"repository":
|
|
164
|
+
"repository": {
|
|
165
|
+
"type": "git",
|
|
166
|
+
"url": "git+https://github.com/zsviczian/excalidraw.git"
|
|
167
|
+
},
|
|
157
168
|
"bugs": "https://github.com/excalidraw/excalidraw/issues",
|
|
158
169
|
"homepage": "https://github.com/excalidraw/excalidraw/tree/master/packages/excalidraw",
|
|
159
170
|
"scripts": {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ObsidianDeviceType = {
|
|
2
|
+
isDesktop: boolean;
|
|
3
|
+
isPhone: boolean;
|
|
4
|
+
isTablet: boolean;
|
|
5
|
+
isMobile: boolean;
|
|
6
|
+
isLinux: boolean;
|
|
7
|
+
isMacOS: boolean;
|
|
8
|
+
isWindows: boolean;
|
|
9
|
+
isIOS: boolean;
|
|
10
|
+
isAndroid: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const getObsidianDeviceInfo: () => ObsidianDeviceType | null;
|
|
13
|
+
export declare const getDesktopUIMode: () => any;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import type { ExcalidrawElement, FontFamilyValues } from "@excalidraw/element/types";
|
|
2
2
|
import type { AppProps, AppState } from "@excalidraw/excalidraw/types";
|
|
3
|
-
export declare const isDarwin: boolean;
|
|
4
|
-
export declare const isWindows: boolean;
|
|
5
|
-
export declare const isAndroid: boolean;
|
|
6
|
-
export declare const isFirefox: boolean;
|
|
7
|
-
export declare const isChrome: boolean;
|
|
8
|
-
export declare const isSafari: boolean;
|
|
9
|
-
export declare const isIOS: boolean;
|
|
10
|
-
export declare const isBrave: () => boolean;
|
|
11
3
|
export declare const supportsResizeObserver: boolean;
|
|
12
4
|
export declare const APP_NAME = "Excalidraw";
|
|
13
5
|
export declare const TEXT_AUTOWRAP_THRESHOLD = 36;
|
|
14
6
|
export declare const DRAGGING_THRESHOLD = 10;
|
|
7
|
+
export declare const MINIMUM_ARROW_SIZE = 20;
|
|
15
8
|
export declare const LINE_CONFIRM_THRESHOLD = 8;
|
|
16
9
|
export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
|
|
17
10
|
export declare const ELEMENT_TRANSLATE_AMOUNT = 1;
|
|
@@ -82,13 +75,18 @@ export declare const YOUTUBE_STATES: {
|
|
|
82
75
|
export declare const ENV: {
|
|
83
76
|
TEST: string;
|
|
84
77
|
DEVELOPMENT: string;
|
|
78
|
+
PRODUCTION: string;
|
|
85
79
|
};
|
|
86
80
|
export declare const CLASSES: {
|
|
81
|
+
SIDEBAR: string;
|
|
87
82
|
SHAPE_ACTIONS_MENU: string;
|
|
88
83
|
SHAPE_ACTIONS_MOBILE_MENU: string;
|
|
84
|
+
SHAPE_ACTIONS_TRAY_MENU: string;
|
|
89
85
|
MOBILE_TOOLBAR: string;
|
|
90
86
|
ZOOM_ACTIONS: string;
|
|
91
87
|
SEARCH_MENU_INPUT_WRAPPER: string;
|
|
88
|
+
CONVERT_ELEMENT_TYPE_POPUP: string;
|
|
89
|
+
SHAPE_ACTIONS_THEME_SCOPE: string;
|
|
92
90
|
};
|
|
93
91
|
export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
|
|
94
92
|
export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
|
|
@@ -110,11 +108,21 @@ export declare const FONT_FAMILY: {
|
|
|
110
108
|
"Lilita One": number;
|
|
111
109
|
"Comic Shanns": number;
|
|
112
110
|
"Liberation Sans": number;
|
|
111
|
+
Assistant: number;
|
|
112
|
+
};
|
|
113
|
+
export declare const SANS_SERIF_GENERIC_FONT = "sans-serif";
|
|
114
|
+
export declare const MONOSPACE_GENERIC_FONT = "monospace";
|
|
115
|
+
export declare const FONT_FAMILY_GENERIC_FALLBACKS: {
|
|
116
|
+
"sans-serif": number;
|
|
117
|
+
monospace: number;
|
|
113
118
|
};
|
|
114
119
|
export declare const FONT_FAMILY_FALLBACKS: {
|
|
115
|
-
Xiaolai: number;
|
|
116
120
|
"Segoe UI Emoji": number;
|
|
121
|
+
"sans-serif": number;
|
|
122
|
+
monospace: number;
|
|
123
|
+
Xiaolai: number;
|
|
117
124
|
};
|
|
125
|
+
export declare function getGenericFontFamilyFallback(fontFamily: number): keyof typeof FONT_FAMILY_GENERIC_FALLBACKS;
|
|
118
126
|
export declare const getFontFamilyFallbacks: (fontFamily: number) => Array<keyof typeof FONT_FAMILY_FALLBACKS>;
|
|
119
127
|
export declare const THEME: {
|
|
120
128
|
readonly LIGHT: "light";
|
|
@@ -165,6 +173,14 @@ export declare const IMAGE_MIME_TYPES: {
|
|
|
165
173
|
readonly avif: "image/avif";
|
|
166
174
|
readonly jfif: "image/jfif";
|
|
167
175
|
};
|
|
176
|
+
export declare const STRING_MIME_TYPES: {
|
|
177
|
+
readonly text: "text/plain";
|
|
178
|
+
readonly html: "text/html";
|
|
179
|
+
readonly json: "application/json";
|
|
180
|
+
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
181
|
+
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
182
|
+
readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
|
|
183
|
+
};
|
|
168
184
|
export declare const MIME_TYPES: {
|
|
169
185
|
readonly svg: "image/svg+xml";
|
|
170
186
|
readonly png: "image/png";
|
|
@@ -175,14 +191,15 @@ export declare const MIME_TYPES: {
|
|
|
175
191
|
readonly ico: "image/x-icon";
|
|
176
192
|
readonly avif: "image/avif";
|
|
177
193
|
readonly jfif: "image/jfif";
|
|
194
|
+
readonly "excalidraw.svg": "image/svg+xml";
|
|
195
|
+
readonly "excalidraw.png": "image/png";
|
|
196
|
+
readonly binary: "application/octet-stream";
|
|
178
197
|
readonly text: "text/plain";
|
|
179
198
|
readonly html: "text/html";
|
|
180
199
|
readonly json: "application/json";
|
|
181
200
|
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
182
201
|
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
183
|
-
readonly
|
|
184
|
-
readonly "excalidraw.png": "image/png";
|
|
185
|
-
readonly binary: "application/octet-stream";
|
|
202
|
+
readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
|
|
186
203
|
};
|
|
187
204
|
export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html", ...("image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/avif" | "image/jfif")[]];
|
|
188
205
|
export declare const EXPORT_IMAGE_TYPES: {
|
|
@@ -196,7 +213,7 @@ export declare const EXPORT_DATA_TYPES: {
|
|
|
196
213
|
readonly excalidrawLibrary: "excalidrawlib";
|
|
197
214
|
readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
|
|
198
215
|
};
|
|
199
|
-
export declare const
|
|
216
|
+
export declare const getExportSource: () => string;
|
|
200
217
|
export declare const IMAGE_RENDER_TIMEOUT = 500;
|
|
201
218
|
export declare const TAP_TWICE_TIMEOUT = 300;
|
|
202
219
|
export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
|
|
@@ -217,16 +234,13 @@ export declare const URL_HASH_KEYS: {
|
|
|
217
234
|
readonly addLibrary: "addLibrary";
|
|
218
235
|
};
|
|
219
236
|
export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
|
|
220
|
-
export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
|
|
221
|
-
export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
|
|
222
|
-
export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
|
|
223
|
-
export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
|
|
224
237
|
export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
225
238
|
export declare const EXPORT_SCALES: number[];
|
|
226
239
|
export declare const DEFAULT_EXPORT_PADDING = 10;
|
|
227
240
|
export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 2880;
|
|
228
241
|
export declare const MAX_ALLOWED_FILE_BYTES: number;
|
|
229
242
|
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
243
|
+
export declare const SVG_DOCUMENT_PREAMBLE = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
|
|
230
244
|
export declare const ENCRYPTION_KEY_BITS = 128;
|
|
231
245
|
export declare const VERSIONS: {
|
|
232
246
|
readonly excalidraw: 2;
|
|
@@ -286,7 +300,7 @@ export declare const DEFAULT_SIDEBAR: {
|
|
|
286
300
|
readonly name: "default";
|
|
287
301
|
readonly defaultTab: "library";
|
|
288
302
|
};
|
|
289
|
-
export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "
|
|
303
|
+
export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "iframe" | "image">;
|
|
290
304
|
export declare const TOOL_TYPE: {
|
|
291
305
|
readonly selection: "selection";
|
|
292
306
|
readonly lasso: "lasso";
|
|
@@ -332,3 +346,13 @@ export declare enum UserIdleState {
|
|
|
332
346
|
AWAY = "away",
|
|
333
347
|
IDLE = "idle"
|
|
334
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* distance at which we merge points instead of adding a new merge-point
|
|
351
|
+
* when converting a line to a polygon (merge currently means overlaping
|
|
352
|
+
* the start and end points)
|
|
353
|
+
*/
|
|
354
|
+
export declare const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
|
|
355
|
+
export declare const DOUBLE_TAP_POSITION_THRESHOLD = 35;
|
|
356
|
+
export declare const MOBILE_ACTION_BUTTON_BG: {
|
|
357
|
+
readonly background: "var(--mobile-action-button-bg)";
|
|
358
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type StylesPanelMode = "compact" | "full" | "mobile" | "tray";
|
|
2
|
+
export type EditorInterface = Readonly<{
|
|
3
|
+
formFactor: "phone" | "tablet" | "desktop";
|
|
4
|
+
desktopUIMode: "compact" | "full" | "tray";
|
|
5
|
+
userAgent: Readonly<{
|
|
6
|
+
isMobileDevice: boolean;
|
|
7
|
+
platform: "ios" | "android" | "other" | "unknown";
|
|
8
|
+
}>;
|
|
9
|
+
isTouchScreen: boolean;
|
|
10
|
+
canFitSidebar: boolean;
|
|
11
|
+
isLandscape: boolean;
|
|
12
|
+
preferTrayMode: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const MQ_MAX_MOBILE = 599;
|
|
15
|
+
export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
|
|
16
|
+
export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
|
|
17
|
+
export declare const MQ_MIN_TABLET: number;
|
|
18
|
+
export declare const MQ_MAX_TABLET = 1400;
|
|
19
|
+
export declare const MQ_MIN_WIDTH_DESKTOP = 1440;
|
|
20
|
+
export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 800;
|
|
21
|
+
export declare const isDarwin: boolean;
|
|
22
|
+
export declare const isWindows: boolean;
|
|
23
|
+
export declare const isAndroid: boolean;
|
|
24
|
+
export declare const isFirefox: boolean;
|
|
25
|
+
export declare const isChrome: boolean;
|
|
26
|
+
export declare const isSafari: boolean;
|
|
27
|
+
export declare const isIOS: boolean;
|
|
28
|
+
export declare const isBrave: () => boolean;
|
|
29
|
+
export declare const isMobileBreakpoint: (width: number, height: number) => boolean;
|
|
30
|
+
export declare const isTabletBreakpoint: (editorWidth: number, editorHeight: number) => boolean;
|
|
31
|
+
export declare const getFormFactor: (editorWidth: number, editorHeight: number) => EditorInterface["formFactor"];
|
|
32
|
+
export declare const deriveStylesPanelMode: (editorInterface: EditorInterface) => StylesPanelMode;
|
|
33
|
+
export declare const createUserAgentDescriptor: (userAgentString: string) => EditorInterface["userAgent"];
|
|
34
|
+
export declare const loadDesktopUIModePreference: () => any;
|
|
35
|
+
export declare const setDesktopUIMode: (mode: EditorInterface["desktopUIMode"]) => "compact" | "full" | "tray" | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UnsubscribeCallback } from "
|
|
1
|
+
import type { UnsubscribeCallback } from "@excalidraw/excalidraw/types";
|
|
2
2
|
type Subscriber<T extends any[]> = (...payload: T) => void;
|
|
3
3
|
export declare class Emitter<T extends any[] = []> {
|
|
4
4
|
subscribers: Subscriber<T>[];
|
|
@@ -16,8 +16,10 @@ export interface FontMetadata {
|
|
|
16
16
|
};
|
|
17
17
|
/** flag to indicate a deprecated font */
|
|
18
18
|
deprecated?: true;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* whether this is a font that users can use (= shown in font picker)
|
|
21
|
+
*/
|
|
22
|
+
private?: true;
|
|
21
23
|
/** flag to indiccate a local-only font */
|
|
22
24
|
local?: true;
|
|
23
25
|
/** flag to indicate a fallback font */
|
|
@@ -30,3 +30,8 @@ export type MakeBrand<T extends string> = {
|
|
|
30
30
|
/** Maybe just promise or already fulfilled one! */
|
|
31
31
|
export type MaybePromise<T> = T | Promise<T>;
|
|
32
32
|
export type AllPossibleKeys<T> = T extends any ? keyof T : never;
|
|
33
|
+
/** Strip all the methods or functions from a type */
|
|
34
|
+
export type DTO<T> = {
|
|
35
|
+
[K in keyof T as T[K] extends Function ? never : K]: T[K];
|
|
36
|
+
};
|
|
37
|
+
export type MapEntry<M extends Map<any, any>> = M extends Map<infer K, infer V> ? [K, V] : never;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ExcalidrawBindableElement, FontFamilyValues, FontString, ExcalidrawElement } from "@excalidraw/element/types";
|
|
1
|
+
import type { ExcalidrawBindableElement, FontFamilyValues, FontString } from "@excalidraw/element/types";
|
|
3
2
|
import type { ActiveTool, AppState, ToolType, UnsubscribeCallback, Zoom } from "@excalidraw/excalidraw/types";
|
|
4
3
|
import type { MaybePromise } from "./utility-types";
|
|
5
4
|
import type { EVENT } from "./constants";
|
|
@@ -18,6 +17,8 @@ export declare const getFontString: ({ fontSize, fontFamily, }: {
|
|
|
18
17
|
fontSize: number;
|
|
19
18
|
fontFamily: FontFamilyValues;
|
|
20
19
|
}) => FontString;
|
|
20
|
+
/** executes callback in the frame that's after the current one */
|
|
21
|
+
export declare const nextAnimationFrame: (cb: () => any) => Promise<void>;
|
|
21
22
|
export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeout: number) => {
|
|
22
23
|
(...args: T): void;
|
|
23
24
|
flush(): void;
|
|
@@ -95,7 +96,6 @@ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">,
|
|
|
95
96
|
export declare const isFullScreen: () => boolean;
|
|
96
97
|
export declare const allowFullScreen: () => Promise<void>;
|
|
97
98
|
export declare const exitFullScreen: () => Promise<void>;
|
|
98
|
-
export declare const getShortcutKey: (shortcut: string) => string;
|
|
99
99
|
export declare const viewportCoordsToSceneCoords: ({ clientX, clientY }: {
|
|
100
100
|
clientX: number;
|
|
101
101
|
clientY: number;
|
|
@@ -138,6 +138,8 @@ export declare const tupleToCoors: (xyTuple: readonly [number, number]) => {
|
|
|
138
138
|
export declare const muteFSAbortError: (error?: Error) => void;
|
|
139
139
|
export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
140
140
|
export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
141
|
+
/** returns the first non-null mapped value */
|
|
142
|
+
export declare const mapFind: <T, K>(collection: readonly T[], iteratee: (value: T, index: number) => K | null | undefined) => K | undefined;
|
|
141
143
|
export declare const isTransparent: (color: string) => boolean;
|
|
142
144
|
export declare const isBindingFallthroughEnabled: (el: ExcalidrawBindableElement) => boolean;
|
|
143
145
|
export type ResolvablePromise<T> = Promise<T> & {
|
|
@@ -178,15 +180,25 @@ export type Node<T> = T & {
|
|
|
178
180
|
* Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.
|
|
179
181
|
*/
|
|
180
182
|
export declare const arrayToList: <T>(array: readonly T[]) => Node<T>[];
|
|
183
|
+
/**
|
|
184
|
+
* Converts a readonly array or map into an iterable.
|
|
185
|
+
* Useful for avoiding entry allocations when iterating object / map on each iteration.
|
|
186
|
+
*/
|
|
187
|
+
export declare const toIterable: <T>(values: ReadonlyMap<string, T> | readonly T[]) => Iterable<T>;
|
|
188
|
+
/**
|
|
189
|
+
* Converts a readonly array or map into an array.
|
|
190
|
+
*/
|
|
191
|
+
export declare const toArray: <T>(values: ReadonlyMap<string, T> | readonly T[]) => T[];
|
|
181
192
|
export declare const isTestEnv: () => boolean;
|
|
182
193
|
export declare const isDevEnv: () => boolean;
|
|
194
|
+
export declare const isProdEnv: () => boolean;
|
|
183
195
|
export declare const isServerEnv: () => boolean;
|
|
184
196
|
export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) => CustomEvent<{
|
|
185
197
|
nativeEvent: T;
|
|
186
198
|
}>;
|
|
187
199
|
export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
|
|
188
200
|
export declare const isPrimitive: (val: any) => boolean;
|
|
189
|
-
export declare const getFrame: () => "
|
|
201
|
+
export declare const getFrame: () => "top" | "iframe";
|
|
190
202
|
export declare const isRunningInIframe: () => boolean;
|
|
191
203
|
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
192
204
|
export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
|
|
@@ -249,5 +261,8 @@ export declare const safelyParseJSON: (json: string) => Record<string, any> | nu
|
|
|
249
261
|
*/
|
|
250
262
|
export declare const escapeDoubleQuotes: (str: string) => string;
|
|
251
263
|
export declare const castArray: <T>(value: T | T[]) => T[];
|
|
252
|
-
|
|
264
|
+
/** hack for Array.isArray type guard not working with readonly value[] */
|
|
265
|
+
export declare const isReadonlyArray: (value?: any) => value is readonly any[];
|
|
266
|
+
export declare const sizeOf: (value: readonly unknown[] | Readonly<Map<string, unknown>> | Readonly<Record<string, unknown>> | ReadonlySet<unknown>) => number;
|
|
267
|
+
export declare const reduceToCommonValue: <T, R = T>(collection: ReadonlySet<T> | readonly T[], getValue?: ((item: T) => R) | undefined) => R | null;
|
|
253
268
|
export {};
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ElementUpdate } from "@excalidraw/element";
|
|
2
2
|
import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameLikeElement, ElementsMapOrArray, OrderedExcalidrawElement, Ordered } from "@excalidraw/element/types";
|
|
3
|
-
import type {
|
|
4
|
-
type
|
|
5
|
-
type ElementKey = ExcalidrawElement | ElementIdKey;
|
|
3
|
+
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
4
|
+
import type { AppState } from "../../excalidraw/types";
|
|
6
5
|
type SceneStateCallback = () => void;
|
|
7
6
|
type SceneStateCallbackRemover = () => void;
|
|
8
7
|
export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
|
|
9
|
-
declare class Scene {
|
|
10
|
-
private static sceneMapByElement;
|
|
11
|
-
private static sceneMapById;
|
|
12
|
-
static mapElementToScene(elementKey: ElementKey, scene: Scene): void;
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated pass down `app.scene` and use it directly
|
|
15
|
-
*/
|
|
16
|
-
static getScene(elementKey: ElementKey): Scene | null;
|
|
8
|
+
export declare class Scene {
|
|
17
9
|
private callbacks;
|
|
18
10
|
private nonDeletedElements;
|
|
19
11
|
private nonDeletedElementsMap;
|
|
@@ -35,6 +27,9 @@ declare class Scene {
|
|
|
35
27
|
getElementsMapIncludingDeleted(): Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
|
|
36
28
|
getNonDeletedElements(): readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
37
29
|
getFramesIncludingDeleted(): readonly ExcalidrawFrameLikeElement[];
|
|
30
|
+
constructor(elements?: ElementsMapOrArray | null, options?: {
|
|
31
|
+
skipValidation?: true;
|
|
32
|
+
});
|
|
38
33
|
getSelectedElements(opts: {
|
|
39
34
|
selectedElementIds: AppState["selectedElementIds"];
|
|
40
35
|
/**
|
|
@@ -62,7 +57,9 @@ declare class Scene {
|
|
|
62
57
|
* @returns whether a change was made
|
|
63
58
|
*/
|
|
64
59
|
mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
|
|
65
|
-
replaceAllElements(nextElements: ElementsMapOrArray
|
|
60
|
+
replaceAllElements(nextElements: ElementsMapOrArray, options?: {
|
|
61
|
+
skipValidation?: true;
|
|
62
|
+
}): void;
|
|
66
63
|
triggerUpdate(): void;
|
|
67
64
|
onUpdate(cb: SceneStateCallback): SceneStateCallbackRemover;
|
|
68
65
|
destroy(): void;
|
|
@@ -73,7 +70,11 @@ declare class Scene {
|
|
|
73
70
|
getElementIndex(elementId: string): number;
|
|
74
71
|
getContainerElement: (element: (ExcalidrawElement & {
|
|
75
72
|
containerId: ExcalidrawElement["id"] | null;
|
|
76
|
-
}) | null) => import("@excalidraw/element/types").
|
|
73
|
+
}) | null) => import("@excalidraw/element/types").ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | import("@excalidraw/element/types").ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | null;
|
|
77
74
|
getElementsFromId: (id: string) => ExcalidrawElement[];
|
|
75
|
+
mutateElement<TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, options?: {
|
|
76
|
+
informMutation: boolean;
|
|
77
|
+
isDragging: boolean;
|
|
78
|
+
}): TElement;
|
|
78
79
|
}
|
|
79
|
-
export
|
|
80
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
1
|
+
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
2
|
+
import type { Scene } from "./Scene";
|
|
3
|
+
import type { ExcalidrawElement } from "./types";
|
|
3
4
|
export interface Alignment {
|
|
4
5
|
position: "start" | "center" | "end";
|
|
5
6
|
axis: "x" | "y";
|
|
6
7
|
}
|
|
7
|
-
export declare const alignElements: (selectedElements: ExcalidrawElement[],
|
|
8
|
+
export declare const alignElements: (selectedElements: ExcalidrawElement[], alignment: Alignment, scene: Scene, appState: Readonly<AppState>) => ExcalidrawElement[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { LocalPoint } from "@excalidraw/math";
|
|
3
|
-
import type Scene from "@excalidraw/excalidraw/scene/Scene";
|
|
4
3
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
5
4
|
import { type Heading } from "./heading";
|
|
5
|
+
import type { Scene } from "./Scene";
|
|
6
6
|
import type { Bounds } from "./bounds";
|
|
7
7
|
import type { ElementUpdate } from "./mutateElement";
|
|
8
|
-
import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap,
|
|
8
|
+
import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap, ExcalidrawElbowArrowElement, FixedPoint } from "./types";
|
|
9
9
|
export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
|
|
10
10
|
export type SuggestedPointBinding = [
|
|
11
11
|
NonDeleted<ExcalidrawLinearElement>,
|
|
@@ -16,44 +16,54 @@ export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEv
|
|
|
16
16
|
export declare const isBindingEnabled: (appState: AppState) => boolean;
|
|
17
17
|
export declare const FIXED_BINDING_DISTANCE = 5;
|
|
18
18
|
export declare const BINDING_HIGHLIGHT_THICKNESS = 10;
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, isBindingEnabled: boolean, draggingPoints: readonly number[] | null, zoom?: AppState["zoom"]) => void;
|
|
19
|
+
export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", scene: Scene) => void;
|
|
20
|
+
export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], isBindingEnabled: boolean, draggingPoints: readonly number[] | null, scene: Scene, zoom?: AppState["zoom"]) => void;
|
|
22
21
|
export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => SuggestedBinding[];
|
|
22
|
+
export declare const maybeSuggestBindingsForLinearElementAtCoords: (linearElement: NonDeleted<ExcalidrawLinearElement>, pointerCoords: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}[], scene: Scene, zoom: AppState["zoom"], oppositeBindingBoundElement?: ExcalidrawBindableElement | null) => ExcalidrawBindableElement[];
|
|
23
26
|
export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
|
|
24
27
|
x: number;
|
|
25
28
|
y: number;
|
|
26
|
-
},
|
|
27
|
-
export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end",
|
|
29
|
+
}, scene: Scene) => void;
|
|
30
|
+
export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", scene: Scene) => void;
|
|
28
31
|
export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
|
|
29
32
|
export declare const getHoveredElementForBinding: (pointerCoords: {
|
|
30
33
|
x: number;
|
|
31
34
|
y: number;
|
|
32
35
|
}, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean, considerAllElements?: boolean) => NonDeleted<ExcalidrawBindableElement> | null;
|
|
33
|
-
export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement,
|
|
36
|
+
export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
|
|
37
|
+
simultaneouslyUpdated?: readonly ExcalidrawElement[];
|
|
38
|
+
newSize?: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
};
|
|
42
|
+
changedElements?: Map<string, ExcalidrawElement>;
|
|
43
|
+
}) => void;
|
|
44
|
+
export declare const updateBindings: (latestElement: ExcalidrawElement, scene: Scene, options?: {
|
|
34
45
|
simultaneouslyUpdated?: readonly ExcalidrawElement[];
|
|
35
46
|
newSize?: {
|
|
36
47
|
width: number;
|
|
37
48
|
height: number;
|
|
38
49
|
};
|
|
39
|
-
|
|
50
|
+
zoom?: AppState["zoom"];
|
|
40
51
|
}) => void;
|
|
41
|
-
export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null,
|
|
42
|
-
export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => GlobalPoint;
|
|
43
|
-
export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, p: GlobalPoint) => GlobalPoint;
|
|
44
|
-
export declare const snapToMid: (element: ExcalidrawBindableElement, p: GlobalPoint, tolerance?: number) => GlobalPoint;
|
|
52
|
+
export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, origPoint: GlobalPoint, elementsMap: ElementsMap, zoom?: AppState["zoom"]) => Heading;
|
|
53
|
+
export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => GlobalPoint;
|
|
54
|
+
export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint) => GlobalPoint;
|
|
55
|
+
export declare const snapToMid: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint, tolerance?: number) => GlobalPoint;
|
|
45
56
|
export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => {
|
|
46
57
|
fixedPoint: FixedPoint;
|
|
47
58
|
};
|
|
48
|
-
export declare const fixDuplicatedBindingsAfterDuplication: (
|
|
49
|
-
export declare const fixReversedBindings: (originalElements: Map<string, ExcalidrawElement>, elementsWithClones: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
59
|
+
export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
|
|
50
60
|
export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
|
|
51
61
|
export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
|
|
52
62
|
x: number;
|
|
53
63
|
y: number;
|
|
54
64
|
}, elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean) => boolean;
|
|
55
65
|
export declare const maxBindingGap: (element: ExcalidrawElement, elementWidth: number, elementHeight: number, zoom?: AppState["zoom"]) => number;
|
|
56
|
-
export declare const determineFocusDistance: (element: ExcalidrawBindableElement, a: GlobalPoint, b: GlobalPoint) => number;
|
|
66
|
+
export declare const determineFocusDistance: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, a: GlobalPoint, b: GlobalPoint) => number;
|
|
57
67
|
export declare const bindingProperties: Set<BindableProp | BindingProp>;
|
|
58
68
|
export type BindableProp = "boundElements";
|
|
59
69
|
export type BindingProp = "frameId" | "containerId" | "startBinding" | "endBinding";
|
|
@@ -95,7 +105,7 @@ export declare class BindableElement {
|
|
|
95
105
|
*/
|
|
96
106
|
static rebindAffected: (elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
|
|
97
107
|
}
|
|
98
|
-
export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement) => GlobalPoint;
|
|
108
|
+
export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint;
|
|
99
109
|
export declare const getGlobalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
|
|
100
110
|
export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => LocalPoint[];
|
|
101
111
|
export declare const normalizeFixedPoint: <T extends FixedPoint | null>(fixedPoint: T) => T extends null ? null : FixedPoint;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Degrees, GlobalPoint, LineSegment } from "@excalidraw/math";
|
|
1
|
+
import type { Degrees, GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
3
|
-
import type { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted, ElementsMap } from "./types";
|
|
4
3
|
import type { Drawable, Op } from "roughjs/bin/core";
|
|
4
|
+
import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, NonDeleted } from "./types";
|
|
5
5
|
export type RectangleBox = {
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
@@ -26,7 +26,8 @@ export type SceneBounds = readonly [
|
|
|
26
26
|
];
|
|
27
27
|
export declare class ElementBounds {
|
|
28
28
|
private static boundsCache;
|
|
29
|
-
static
|
|
29
|
+
private static nonRotatedBoundsCache;
|
|
30
|
+
static getBounds(element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean): Bounds;
|
|
30
31
|
private static calculateBounds;
|
|
31
32
|
}
|
|
32
33
|
export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
|
|
@@ -43,6 +44,7 @@ export declare const getElementLineSegments: (element: ExcalidrawElement, elemen
|
|
|
43
44
|
*/
|
|
44
45
|
export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBox) => number[];
|
|
45
46
|
export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
|
|
47
|
+
export declare const getCubicBezierCurveBound: (p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, p3: GlobalPoint) => Bounds;
|
|
46
48
|
export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((p: GlobalPoint) => GlobalPoint) | undefined) => Bounds;
|
|
47
49
|
export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["points"]) => Bounds;
|
|
48
50
|
/** @returns number in pixels */
|
|
@@ -50,8 +52,8 @@ export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
|
|
|
50
52
|
/** @returns number in degrees */
|
|
51
53
|
export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
|
|
52
54
|
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
|
|
53
|
-
export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap) => Bounds;
|
|
54
|
-
export declare const getCommonBounds: (elements:
|
|
55
|
+
export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean) => Bounds;
|
|
56
|
+
export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
|
|
55
57
|
export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
|
|
56
58
|
x: number;
|
|
57
59
|
y: number;
|
|
@@ -72,10 +74,16 @@ export interface BoundingBox {
|
|
|
72
74
|
width: number;
|
|
73
75
|
height: number;
|
|
74
76
|
}
|
|
75
|
-
export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
|
|
77
|
+
export declare const getCommonBoundingBox: (elements: readonly ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
|
|
76
78
|
/**
|
|
77
79
|
* returns scene coords of user's editor viewport (visible canvas area) bounds
|
|
78
80
|
*/
|
|
79
81
|
export declare const getVisibleSceneBounds: ({ scrollX, scrollY, width, height, zoom, }: AppState) => SceneBounds;
|
|
80
82
|
export declare const getCenterForBounds: (bounds: Bounds) => GlobalPoint;
|
|
83
|
+
/**
|
|
84
|
+
* Get the axis-aligned bounding box for a given element
|
|
85
|
+
*/
|
|
86
|
+
export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, elementsMap: ElementsMap, offset?: [number, number, number, number]) => Bounds;
|
|
87
|
+
export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
|
|
81
88
|
export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
|
|
89
|
+
export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMap: ElementsMap, xOffset?: number, yOffset?: number) => GlobalPoint;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
|
|
1
|
+
import type { GlobalPoint, LineSegment } from "@excalidraw/math";
|
|
3
2
|
import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
|
|
4
3
|
import type { ElementsMap, ExcalidrawElement } from "./types";
|
|
5
4
|
export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
|
|
6
|
-
export type HitTestArgs
|
|
7
|
-
|
|
8
|
-
y: number;
|
|
5
|
+
export type HitTestArgs = {
|
|
6
|
+
point: GlobalPoint;
|
|
9
7
|
element: ExcalidrawElement;
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
threshold: number;
|
|
9
|
+
elementsMap: ElementsMap;
|
|
12
10
|
frameNameBound?: FrameNameBounds | null;
|
|
13
11
|
};
|
|
14
|
-
export declare const hitElementItself:
|
|
15
|
-
export declare const hitElementBoundingBox: (
|
|
16
|
-
export declare const hitElementBoundingBoxOnly:
|
|
17
|
-
export declare const hitElementBoundText:
|
|
12
|
+
export declare const hitElementItself: ({ point, element, threshold, elementsMap, frameNameBound, }: HitTestArgs) => boolean;
|
|
13
|
+
export declare const hitElementBoundingBox: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
|
|
14
|
+
export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsMap: ElementsMap) => boolean;
|
|
15
|
+
export declare const hitElementBoundText: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
|
|
18
16
|
/**
|
|
19
17
|
* Intersect a line with an element for binding test
|
|
20
18
|
*
|
|
@@ -23,4 +21,12 @@ export declare const hitElementBoundText: <Point extends GlobalPoint | LocalPoin
|
|
|
23
21
|
* @param offset
|
|
24
22
|
* @returns
|
|
25
23
|
*/
|
|
26
|
-
export declare const intersectElementWithLineSegment: (element: ExcalidrawElement, line: LineSegment<GlobalPoint>, offset?: number) => GlobalPoint[];
|
|
24
|
+
export declare const intersectElementWithLineSegment: (element: ExcalidrawElement, elementsMap: ElementsMap, line: LineSegment<GlobalPoint>, offset?: number, onlyFirst?: boolean) => GlobalPoint[];
|
|
25
|
+
/**
|
|
26
|
+
* Check if the given point is considered inside the element's border
|
|
27
|
+
*
|
|
28
|
+
* @param point
|
|
29
|
+
* @param element
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
export declare const isPointInElement: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TransformHandleType } from "./transformHandles";
|
|
2
2
|
import type { ElementsMap, ExcalidrawImageElement, ImageCrop } from "./types";
|
|
3
3
|
export declare const MINIMAL_CROP_SIZE = 10;
|
|
4
|
-
export declare const cropElement: (element: ExcalidrawImageElement, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
|
|
4
|
+
export declare const cropElement: (element: ExcalidrawImageElement, elementsMap: ElementsMap, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
7
7
|
width: number;
|