@zsviczian/excalidraw 0.17.1-obsidian-20 → 0.17.1-obsidian-22
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 +217 -96
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/styles.development.css +88 -63
- package/dist/styles.production.css +6 -6
- package/package.json +2 -1
- package/types/excalidraw/actions/actionAddToLibrary.d.ts +4 -4
- package/types/excalidraw/actions/actionAlign.d.ts +22 -22
- package/types/excalidraw/actions/actionBoundText.d.ts +10 -10
- package/types/excalidraw/actions/actionCanvas.d.ts +68 -68
- package/types/excalidraw/actions/actionClipboard.d.ts +24 -24
- package/types/excalidraw/actions/actionDeleteSelected.d.ts +10 -10
- package/types/excalidraw/actions/actionDistribute.d.ts +10 -10
- package/types/excalidraw/actions/actionDuplicateSelection.d.ts +7 -8
- package/types/excalidraw/actions/actionElementLock.d.ts +9 -9
- package/types/excalidraw/actions/actionExport.d.ts +33 -33
- package/types/excalidraw/actions/actionFinalize.d.ts +9 -9
- package/types/excalidraw/actions/actionFlip.d.ts +10 -10
- package/types/excalidraw/actions/actionFrame.d.ts +16 -204
- package/types/excalidraw/actions/actionGroup.d.ts +12 -388
- package/types/excalidraw/actions/actionHistory.d.ts +4 -3
- package/types/excalidraw/actions/actionLinearEditor.d.ts +6 -4
- package/types/excalidraw/actions/actionLink.d.ts +5 -5
- package/types/excalidraw/actions/actionMenu.d.ts +8 -8
- package/types/excalidraw/actions/actionNavigate.d.ts +4 -4
- package/types/excalidraw/actions/actionProperties.d.ts +34 -34
- package/types/excalidraw/actions/actionSelectAll.d.ts +5 -5
- package/types/excalidraw/actions/actionStyles.d.ts +9 -12
- package/types/excalidraw/actions/actionTextAutoResize.d.ts +17 -0
- package/types/excalidraw/actions/actionToggleGridMode.d.ts +7 -5
- package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -4
- package/types/excalidraw/actions/actionToggleStats.d.ts +4 -4
- package/types/excalidraw/actions/actionToggleViewMode.d.ts +4 -4
- package/types/excalidraw/actions/actionToggleZenMode.d.ts +4 -4
- package/types/excalidraw/actions/actionZindex.d.ts +22 -19
- package/types/excalidraw/actions/manager.d.ts +5 -5
- package/types/excalidraw/actions/register.d.ts +1 -1
- package/types/excalidraw/actions/shortcuts.d.ts +2 -2
- package/types/excalidraw/actions/types.d.ts +8 -8
- package/types/excalidraw/align.d.ts +1 -1
- package/types/excalidraw/animated-trail.d.ts +2 -2
- package/types/excalidraw/appState.d.ts +5 -5
- package/types/excalidraw/change.d.ts +191 -0
- package/types/excalidraw/charts.d.ts +1 -1
- package/types/excalidraw/clients.d.ts +2 -2
- package/types/excalidraw/clipboard.d.ts +3 -3
- package/types/excalidraw/colors.d.ts +1 -1
- package/types/excalidraw/components/Actions.d.ts +3 -3
- package/types/excalidraw/components/App.d.ts +28 -14
- package/types/excalidraw/components/ColorPicker/ColorInput.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +4 -4
- package/types/excalidraw/components/ColorPicker/Picker.d.ts +3 -3
- package/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/PickerHeading.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/ShadeList.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +2 -2
- package/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
- package/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -1
- package/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -1
- package/types/excalidraw/components/CommandPalette/types.d.ts +3 -3
- package/types/excalidraw/components/ConfirmDialog.d.ts +1 -1
- package/types/excalidraw/components/ContextMenu.d.ts +2 -2
- package/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/types/excalidraw/components/DefaultSidebar.d.ts +2 -2
- package/types/excalidraw/components/DialogActionButton.d.ts +1 -1
- package/types/excalidraw/components/EyeDropper.d.ts +2 -2
- package/types/excalidraw/components/FollowMode/FollowMode.d.ts +1 -1
- package/types/excalidraw/components/HintViewer.d.ts +1 -1
- package/types/excalidraw/components/ImageExportDialog.d.ts +1 -1
- package/types/excalidraw/components/InitializeApp.d.ts +2 -2
- package/types/excalidraw/components/JSONExportDialog.d.ts +3 -3
- package/types/excalidraw/components/LayerUI.d.ts +4 -4
- package/types/excalidraw/components/LibraryMenu.d.ts +2 -2
- package/types/excalidraw/components/LibraryMenuBrowseButton.d.ts +1 -1
- package/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
- package/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +2 -2
- package/types/excalidraw/components/LibraryMenuItems.d.ts +1 -1
- package/types/excalidraw/components/LibraryMenuSection.d.ts +5 -4
- package/types/excalidraw/components/LibraryUnit.d.ts +2 -2
- package/types/excalidraw/components/LoadingMessage.d.ts +1 -1
- package/types/excalidraw/components/MobileMenu.d.ts +3 -3
- package/types/excalidraw/components/Modal.d.ts +1 -1
- package/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/types/excalidraw/components/PasteChartDialog.d.ts +1 -1
- package/types/excalidraw/components/PublishLibrary.d.ts +1 -1
- package/types/excalidraw/components/RadioGroup.d.ts +2 -1
- package/types/excalidraw/components/SVGLayer.d.ts +1 -1
- package/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -1
- package/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -1
- package/types/excalidraw/components/Sidebar/SidebarTrigger.d.ts +1 -1
- package/types/excalidraw/components/Sidebar/common.d.ts +1 -1
- package/types/excalidraw/components/Stats.d.ts +2 -2
- package/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -2
- package/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +1 -1
- package/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +1 -1
- package/types/excalidraw/components/TTDDialog/TTDDialogPanels.d.ts +1 -1
- package/types/excalidraw/components/TTDDialog/TTDDialogTabs.d.ts +1 -1
- package/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -1
- package/types/excalidraw/components/TTDDialog/common.d.ts +4 -4
- package/types/excalidraw/components/TextField.d.ts +1 -1
- package/types/excalidraw/components/Toast.d.ts +1 -1
- package/types/excalidraw/components/ToolButton.d.ts +4 -2
- package/types/excalidraw/components/Trans.d.ts +1 -1
- package/types/excalidraw/components/UserList.d.ts +1 -1
- package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +3 -2
- package/types/excalidraw/components/canvases/StaticCanvas.d.ts +2 -2
- package/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +17 -0
- package/types/excalidraw/components/footer/Footer.d.ts +2 -2
- package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +2 -2
- package/types/excalidraw/components/hyperlink/helpers.d.ts +3 -3
- package/types/excalidraw/components/icons.d.ts +6 -1
- package/types/excalidraw/components/main-menu/DefaultItems.d.ts +12 -2
- package/types/excalidraw/constants.d.ts +5 -2
- package/types/excalidraw/context/ui-appState.d.ts +1 -1
- package/types/excalidraw/cursor.d.ts +1 -1
- package/types/excalidraw/data/EditorLocalStorage.d.ts +2 -2
- package/types/excalidraw/data/blob.d.ts +5 -5
- package/types/excalidraw/data/filesystem.d.ts +2 -1
- package/types/excalidraw/data/index.d.ts +4 -4
- package/types/excalidraw/data/json.d.ts +3 -3
- package/types/excalidraw/data/library.d.ts +3 -3
- package/types/excalidraw/data/magic.d.ts +3 -3
- package/types/excalidraw/data/reconcile.d.ts +6 -0
- package/types/excalidraw/data/resave.d.ts +2 -2
- package/types/excalidraw/data/restore.d.ts +5 -5
- package/types/excalidraw/data/transform.d.ts +4 -4
- package/types/excalidraw/data/types.d.ts +3 -3
- package/types/excalidraw/data/url.d.ts +1 -0
- package/types/excalidraw/element/ElementCanvasButtons.d.ts +1 -1
- package/types/excalidraw/element/binding.d.ts +52 -9
- package/types/excalidraw/element/bounds.d.ts +3 -4
- package/types/excalidraw/element/collision.d.ts +14 -19
- package/types/excalidraw/element/containerCache.d.ts +1 -1
- package/types/excalidraw/element/dragElements.d.ts +3 -3
- package/types/excalidraw/element/embeddable.d.ts +9 -6
- package/types/excalidraw/element/image.d.ts +2 -2
- package/types/excalidraw/element/index.d.ts +2 -3
- package/types/excalidraw/element/linearElementEditor.d.ts +12 -12
- package/types/excalidraw/element/mutateElement.d.ts +4 -5
- package/types/excalidraw/element/newElement.d.ts +4 -11
- package/types/excalidraw/element/resizeElements.d.ts +4 -4
- package/types/excalidraw/element/resizeTest.d.ts +7 -7
- package/types/excalidraw/element/showSelectedShapeActions.d.ts +2 -2
- package/types/excalidraw/element/sizeHelpers.d.ts +2 -2
- package/types/excalidraw/element/sortElements.d.ts +1 -1
- package/types/excalidraw/element/textElement.d.ts +5 -6
- package/types/excalidraw/element/textWysiwyg.d.ts +10 -5
- package/types/excalidraw/element/transformHandles.d.ts +24 -6
- package/types/excalidraw/element/typeChecks.d.ts +4 -4
- package/types/excalidraw/element/types.d.ts +33 -10
- package/types/excalidraw/emitter.d.ts +1 -1
- package/types/excalidraw/errors.d.ts +3 -0
- package/types/excalidraw/fractionalIndex.d.ts +40 -0
- package/types/excalidraw/frame.d.ts +4 -4
- package/types/excalidraw/gatransforms.d.ts +1 -1
- package/types/excalidraw/gesture.d.ts +1 -1
- package/types/excalidraw/groups.d.ts +5 -3
- package/types/excalidraw/history.d.ts +35 -47
- package/types/excalidraw/hooks/useEmitter.d.ts +2 -0
- package/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/types/excalidraw/i18n.d.ts +1 -1
- package/types/excalidraw/index.d.ts +5 -1
- package/types/excalidraw/jotai.d.ts +1 -1
- package/types/excalidraw/laser-trails.d.ts +3 -2
- package/types/excalidraw/math.d.ts +2 -2
- package/types/excalidraw/points.d.ts +1 -1
- package/types/excalidraw/queue.d.ts +1 -1
- package/types/excalidraw/renderer/helpers.d.ts +2 -2
- package/types/excalidraw/renderer/interactiveScene.d.ts +2 -2
- package/types/excalidraw/renderer/renderElement.d.ts +3 -3
- package/types/excalidraw/renderer/renderSnaps.d.ts +1 -1
- package/types/excalidraw/renderer/staticScene.d.ts +1 -1
- package/types/excalidraw/renderer/staticSvgScene.d.ts +4 -4
- package/types/excalidraw/scene/Fonts.d.ts +2 -4
- package/types/excalidraw/scene/Renderer.d.ts +4 -4
- package/types/excalidraw/scene/Scene.d.ts +19 -12
- package/types/excalidraw/scene/Shape.d.ts +1 -1
- package/types/excalidraw/scene/ShapeCache.d.ts +4 -4
- package/types/excalidraw/scene/comparisons.d.ts +2 -2
- package/types/excalidraw/scene/export.d.ts +2 -2
- package/types/excalidraw/scene/scroll.d.ts +2 -2
- package/types/excalidraw/scene/scrollbars.d.ts +3 -3
- package/types/excalidraw/scene/selection.d.ts +2 -2
- package/types/excalidraw/scene/types.d.ts +5 -4
- package/types/excalidraw/scene/zoom.d.ts +1 -1
- package/types/excalidraw/snapping.d.ts +4 -4
- package/types/excalidraw/store.d.ts +99 -0
- package/types/excalidraw/types.d.ts +38 -20
- package/types/excalidraw/utils.d.ts +11 -4
- package/types/excalidraw/webpack.prod.config.d.ts +1 -1
- package/types/excalidraw/zindex.d.ts +4 -4
- package/types/utils/bbox.d.ts +2 -2
- package/types/utils/collision.d.ts +4 -0
- package/types/utils/export.d.ts +4 -4
- package/types/utils/geometry/geometry.d.ts +71 -0
- package/types/utils/geometry/shape.d.ts +56 -0
- package/types/utils/withinBounds.d.ts +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState, BinaryFiles, LibraryItem } from "../types";
|
|
3
|
-
import { ImportedDataState } from "./types";
|
|
1
|
+
import type { ExcalidrawElement, OrderedExcalidrawElement } from "../element/types";
|
|
2
|
+
import type { AppState, BinaryFiles, LibraryItem } from "../types";
|
|
3
|
+
import type { ImportedDataState } from "./types";
|
|
4
4
|
type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
5
5
|
export declare const AllowedExcalidrawActiveTools: Record<AppState["activeTool"]["type"], boolean>;
|
|
6
6
|
export type RestoredDataState = {
|
|
7
|
-
elements:
|
|
7
|
+
elements: OrderedExcalidrawElement[];
|
|
8
8
|
appState: RestoredAppState;
|
|
9
9
|
files: BinaryFiles;
|
|
10
10
|
};
|
|
11
11
|
export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, opts?: {
|
|
12
12
|
refreshDimensions?: boolean;
|
|
13
13
|
repairBindings?: boolean;
|
|
14
|
-
} | undefined) =>
|
|
14
|
+
} | undefined) => OrderedExcalidrawElement[];
|
|
15
15
|
export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
|
|
16
16
|
export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined, elementsConfig?: {
|
|
17
17
|
refreshDimensions?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ElementConstructorOpts } from "../element/newElement";
|
|
2
|
-
import { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, TextAlign, VerticalAlign } from "../element/types";
|
|
3
|
-
import { MarkOptional } from "../utility-types";
|
|
1
|
+
import type { ElementConstructorOpts } from "../element/newElement";
|
|
2
|
+
import type { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, TextAlign, VerticalAlign } from "../element/types";
|
|
3
|
+
import type { MarkOptional } from "../utility-types";
|
|
4
4
|
export type ValidLinearElement = {
|
|
5
5
|
type: "arrow" | "line";
|
|
6
6
|
x: number;
|
|
@@ -78,4 +78,4 @@ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, Excal
|
|
|
78
78
|
} & Partial<ExcalidrawMagicFrameElement>);
|
|
79
79
|
export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
|
|
80
80
|
regenerateIds: boolean;
|
|
81
|
-
}) =>
|
|
81
|
+
}) => import("../element/types").OrderedExcalidrawElement[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion } from "../types";
|
|
1
|
+
import type { ExcalidrawElement } from "../element/types";
|
|
2
|
+
import type { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion } from "../types";
|
|
3
3
|
import type { cleanAppStateForExport } from "../appState";
|
|
4
|
-
import { VERSIONS } from "../constants";
|
|
4
|
+
import type { VERSIONS } from "../constants";
|
|
5
5
|
export interface ExportedDataState {
|
|
6
6
|
type: string;
|
|
7
7
|
version: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementsMap, NonDeletedExcalidrawElement } from "./types";
|
|
1
|
+
import type { ElementsMap, NonDeletedExcalidrawElement } from "./types";
|
|
2
2
|
import "./ElementCanvasButtons.scss";
|
|
3
3
|
export declare const ElementCanvasButtons: ({ children, element, elementsMap, }: {
|
|
4
4
|
children: React.ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppState } from "../types";
|
|
3
|
-
import
|
|
1
|
+
import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap } from "./types";
|
|
2
|
+
import type { AppClassProperties, AppState, Point } from "../types";
|
|
3
|
+
import type { ElementUpdate } from "./mutateElement";
|
|
4
4
|
export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
|
|
5
5
|
export type SuggestedPointBinding = [
|
|
6
6
|
NonDeleted<ExcalidrawLinearElement>,
|
|
@@ -10,18 +10,18 @@ export type SuggestedPointBinding = [
|
|
|
10
10
|
export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<HTMLElement>) => boolean;
|
|
11
11
|
export declare const isBindingEnabled: (appState: AppState) => boolean;
|
|
12
12
|
export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", elementsMap: NonDeletedSceneElementsMap) => void;
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
13
|
+
export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], app: AppClassProperties, isBindingEnabled: boolean, draggingPoints: readonly number[] | null) => void;
|
|
14
|
+
export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], app: AppClassProperties) => SuggestedBinding[];
|
|
15
|
+
export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
|
|
15
16
|
x: number;
|
|
16
17
|
y: number;
|
|
17
|
-
},
|
|
18
|
+
}, app: AppClassProperties) => void;
|
|
18
19
|
export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: NonDeletedSceneElementsMap) => void;
|
|
19
20
|
export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
|
|
20
|
-
export declare const unbindLinearElements: (elements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap) => void;
|
|
21
21
|
export declare const getHoveredElementForBinding: (pointerCoords: {
|
|
22
22
|
x: number;
|
|
23
23
|
y: number;
|
|
24
|
-
},
|
|
24
|
+
}, app: AppClassProperties) => NonDeleted<ExcalidrawBindableElement> | null;
|
|
25
25
|
export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, elementsMap: ElementsMap, options?: {
|
|
26
26
|
simultaneouslyUpdated?: readonly ExcalidrawElement[];
|
|
27
27
|
newSize?: {
|
|
@@ -29,6 +29,49 @@ export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawE
|
|
|
29
29
|
height: number;
|
|
30
30
|
};
|
|
31
31
|
}) => void;
|
|
32
|
-
export declare const getEligibleElementsForBinding: (selectedElements: NonDeleted<ExcalidrawElement>[], elements: readonly ExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap) => SuggestedBinding[];
|
|
33
32
|
export declare const fixBindingsAfterDuplication: (sceneElements: readonly ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicatesServeAsOld?: "duplicatesServeAsOld" | undefined) => void;
|
|
34
33
|
export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
|
|
34
|
+
export declare const maxBindingGap: (element: ExcalidrawElement, elementWidth: number, elementHeight: number) => number;
|
|
35
|
+
export declare const determineFocusDistance: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], elementsMap: ElementsMap) => number;
|
|
36
|
+
export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap: number | undefined, elementsMap: ElementsMap) => Point[];
|
|
37
|
+
export declare const bindingProperties: Set<BindableProp | BindingProp>;
|
|
38
|
+
export type BindableProp = "boundElements";
|
|
39
|
+
export type BindingProp = "frameId" | "containerId" | "startBinding" | "endBinding";
|
|
40
|
+
/**
|
|
41
|
+
* Bound element containing bindings to `frameId`, `containerId`, `startBinding` or `endBinding`.
|
|
42
|
+
*/
|
|
43
|
+
export declare class BoundElement {
|
|
44
|
+
/**
|
|
45
|
+
* Unbind the affected non deleted bindable elements (removing element from `boundElements`).
|
|
46
|
+
* - iterates non deleted bindable elements (`containerId` | `startBinding.elementId` | `endBinding.elementId`) of the current element
|
|
47
|
+
* - prepares updates to unbind each bindable element's `boundElements` from the current element
|
|
48
|
+
*/
|
|
49
|
+
static unbindAffected(elements: ElementsMap, boundElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void): void;
|
|
50
|
+
/**
|
|
51
|
+
* Rebind the next affected non deleted bindable elements (adding element to `boundElements`).
|
|
52
|
+
* - iterates non deleted bindable elements (`containerId` | `startBinding.elementId` | `endBinding.elementId`) of the current element
|
|
53
|
+
* - prepares updates to rebind each bindable element's `boundElements` to the current element
|
|
54
|
+
*
|
|
55
|
+
* NOTE: rebind expects that affected elements were previously unbound with `BoundElement.unbindAffected`
|
|
56
|
+
*/
|
|
57
|
+
static rebindAffected: (elements: ElementsMap, boundElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Bindable element containing bindings to `boundElements`.
|
|
61
|
+
*/
|
|
62
|
+
export declare class BindableElement {
|
|
63
|
+
/**
|
|
64
|
+
* Unbind the affected non deleted bound elements (resetting `containerId`, `startBinding`, `endBinding` to `null`).
|
|
65
|
+
* - iterates through non deleted `boundElements` of the current element
|
|
66
|
+
* - prepares updates to unbind each bound element from the current element
|
|
67
|
+
*/
|
|
68
|
+
static unbindAffected(elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void): void;
|
|
69
|
+
/**
|
|
70
|
+
* Rebind the affected non deleted bound elements (for now setting only `containerId`, as we cannot rebind arrows atm).
|
|
71
|
+
* - iterates through non deleted `boundElements` of the current element
|
|
72
|
+
* - prepares updates to rebind each bound element to the current element or unbind it from `boundElements` in case of conflicts
|
|
73
|
+
*
|
|
74
|
+
* NOTE: rebind expects that affected elements were previously unbound with `BindaleElement.unbindAffected`
|
|
75
|
+
*/
|
|
76
|
+
static rebindAffected: (elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
|
|
77
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted, ElementsMap } from "./types";
|
|
2
|
-
import { Drawable, Op } from "roughjs/bin/core";
|
|
3
|
-
import { AppState, Point } from "../types";
|
|
1
|
+
import type { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted, ElementsMap } from "./types";
|
|
2
|
+
import type { Drawable, Op } from "roughjs/bin/core";
|
|
3
|
+
import type { AppState, Point } from "../types";
|
|
4
4
|
export type RectangleBox = {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
@@ -36,7 +36,6 @@ export declare const getElementLineSegments: (element: ExcalidrawElement, elemen
|
|
|
36
36
|
* Rectangle here means any rectangular frame, not an excalidraw element.
|
|
37
37
|
*/
|
|
38
38
|
export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBox) => number[];
|
|
39
|
-
export declare const pointRelativeTo: (element: ExcalidrawElement, absoluteCoords: readonly [number, number]) => readonly [number, number];
|
|
40
39
|
export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
|
|
41
40
|
export declare const getCurvePathOps: (shape: Drawable) => Op[];
|
|
42
41
|
export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((x: number, y: number) => [number, number]) | undefined) => Bounds;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export declare const isHittingElementBoundingBoxWithoutHittingElement: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number, elementsMap: ElementsMap) => boolean;
|
|
7
|
-
export declare const isHittingElementNotConsideringBoundingBox: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache | null, point: readonly [number, number], elementsMap: ElementsMap) => boolean;
|
|
8
|
-
export declare const isPointHittingElementBoundingBox: (element: NonDeleted<ExcalidrawElement>, elementsMap: ElementsMap, [x, y]: readonly [number, number], threshold: number, frameNameBoundsCache: FrameNameBoundsCache | null) => boolean;
|
|
9
|
-
export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
|
|
1
|
+
import type { ElementsMap, ExcalidrawElement } from "./types";
|
|
2
|
+
import type { FrameNameBounds } from "../types";
|
|
3
|
+
import type { GeometricShape } from "../../utils/geometry/shape";
|
|
4
|
+
export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
|
|
5
|
+
export type HitTestArgs = {
|
|
10
6
|
x: number;
|
|
11
7
|
y: number;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
8
|
+
element: ExcalidrawElement;
|
|
9
|
+
shape: GeometricShape;
|
|
10
|
+
threshold?: number;
|
|
11
|
+
frameNameBound?: FrameNameBounds | null;
|
|
12
|
+
};
|
|
13
|
+
export declare const hitElementItself: ({ x, y, element, shape, threshold, frameNameBound, }: HitTestArgs) => boolean;
|
|
14
|
+
export declare const hitElementBoundingBox: (x: number, y: number, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
|
|
15
|
+
export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsMap: ElementsMap) => boolean;
|
|
16
|
+
export declare const hitElementBoundText: (x: number, y: number, textShape: GeometricShape | null) => boolean | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NonDeletedExcalidrawElement } from "./types";
|
|
2
|
-
import { AppState, PointerDownState } from "../types";
|
|
3
|
-
import Scene from "../scene/Scene";
|
|
1
|
+
import type { NonDeletedExcalidrawElement } from "./types";
|
|
2
|
+
import type { AppState, PointerDownState } from "../types";
|
|
3
|
+
import type Scene from "../scene/Scene";
|
|
4
4
|
export declare const dragSelectedElements: (pointerDownState: PointerDownState, selectedElements: NonDeletedExcalidrawElement[], offset: {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ExcalidrawProps } from "../types";
|
|
2
|
-
import { ExcalidrawElement, ExcalidrawIframeLikeElement, IframeData } from "./types";
|
|
1
|
+
import type { ExcalidrawProps } from "../types";
|
|
2
|
+
import type { ExcalidrawElement, ExcalidrawIframeLikeElement, IframeData } from "./types";
|
|
3
|
+
import type { MarkRequired } from "../utility-types";
|
|
4
|
+
type IframeDataWithSandbox = MarkRequired<IframeData, "sandbox">;
|
|
3
5
|
export declare const createSrcDoc: (body: string) => string;
|
|
4
|
-
export declare const getEmbedLink: (link: string | null | undefined) =>
|
|
6
|
+
export declare const getEmbedLink: (link: string | null | undefined) => IframeDataWithSandbox | null;
|
|
5
7
|
export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawIframeLikeElement) => ExcalidrawElement;
|
|
6
8
|
export declare const actionSetEmbeddableAsActiveTool: {
|
|
7
9
|
name: "setEmbeddableAsActiveTool";
|
|
@@ -10,8 +12,8 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
10
12
|
};
|
|
11
13
|
target: string;
|
|
12
14
|
label: string;
|
|
13
|
-
perform: (elements: readonly
|
|
14
|
-
elements: readonly
|
|
15
|
+
perform: (elements: readonly import("./types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties) => {
|
|
16
|
+
elements: readonly import("./types").OrderedExcalidrawElement[];
|
|
15
17
|
appState: {
|
|
16
18
|
activeTool: {
|
|
17
19
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -197,10 +199,11 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
197
199
|
userToFollow: import("../types").UserToFollow | null;
|
|
198
200
|
followedBy: Set<import("../types").SocketId>;
|
|
199
201
|
};
|
|
200
|
-
|
|
202
|
+
storeAction: import("../store").StoreActionType;
|
|
201
203
|
};
|
|
202
204
|
} & {
|
|
203
205
|
keyTest?: undefined;
|
|
204
206
|
};
|
|
205
207
|
export declare const maybeParseEmbedSrc: (str: string) => string;
|
|
206
208
|
export declare const embeddableURLValidator: (url: string | null | undefined, validateEmbeddable: ExcalidrawProps["validateEmbeddable"]) => boolean;
|
|
209
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppClassProperties, DataURL, BinaryFiles } from "../types";
|
|
2
|
-
import { ExcalidrawElement, FileId, InitializedExcalidrawImageElement } from "./types";
|
|
1
|
+
import type { AppClassProperties, DataURL, BinaryFiles } from "../types";
|
|
2
|
+
import type { ExcalidrawElement, FileId, InitializedExcalidrawImageElement } from "./types";
|
|
3
3
|
export declare const loadHTMLImageElement: (dataURL: DataURL) => Promise<HTMLImageElement>;
|
|
4
4
|
/** NOTE: updates cache even if already populated with given image. Thus,
|
|
5
5
|
* you should filter out the images upstream if you want to optimize this. */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
|
|
2
|
-
export { newElement, newTextElement,
|
|
1
|
+
import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
|
|
2
|
+
export { newElement, newTextElement, refreshTextDimensions, newLinearElement, newImageElement, duplicateElement, } from "./newElement";
|
|
3
3
|
export { getElementAbsoluteCoords, getElementBounds, getCommonBounds, getDiamondPoints, getArrowheadPoints, getClosestElementBounds, } from "./bounds";
|
|
4
4
|
export { OMIT_SIDES_FOR_MULTIPLE_ELEMENTS, getTransformHandlesFromCoords, getTransformHandles, } from "./transformHandles";
|
|
5
|
-
export { hitTest, isHittingElementBoundingBoxWithoutHittingElement, } from "./collision";
|
|
6
5
|
export { resizeTest, getCursorForResizingElement, getElementWithTransformHandleType, getTransformHandleTypeFromCoords, } from "./resizeTest";
|
|
7
6
|
export { transformElements, getResizeOffsetXY, getResizeArrowDirection, } from "./resizeElements";
|
|
8
7
|
export { dragSelectedElements, getDragOffsetXY, dragNewElement, } from "./dragElements";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap,
|
|
2
|
-
import { Bounds } from "./bounds";
|
|
3
|
-
import { Point, AppState, PointerCoords, InteractiveCanvasAppState } from "../types";
|
|
4
|
-
import
|
|
1
|
+
import type { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap } from "./types";
|
|
2
|
+
import type { Bounds } from "./bounds";
|
|
3
|
+
import type { Point, AppState, PointerCoords, InteractiveCanvasAppState, AppClassProperties } from "../types";
|
|
4
|
+
import type { Store } from "../store";
|
|
5
5
|
declare const editorMidPointsCache: {
|
|
6
6
|
version: number | null;
|
|
7
7
|
points: (Point | null)[];
|
|
@@ -51,7 +51,7 @@ export declare class LinearElementEditor {
|
|
|
51
51
|
x: number;
|
|
52
52
|
y: number;
|
|
53
53
|
}[]) => void, linearElementEditor: LinearElementEditor, elementsMap: NonDeletedSceneElementsMap): boolean;
|
|
54
|
-
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState,
|
|
54
|
+
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState, app: AppClassProperties): LinearElementEditor;
|
|
55
55
|
static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => (typeof editorMidPointsCache)["points"];
|
|
56
56
|
static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => void;
|
|
57
57
|
static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
|
|
@@ -61,10 +61,10 @@ export declare class LinearElementEditor {
|
|
|
61
61
|
static isSegmentTooShort(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, zoom: AppState["zoom"]): boolean;
|
|
62
62
|
static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number, elementsMap: ElementsMap): readonly [number, number];
|
|
63
63
|
static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: Point, elementsMap: ElementsMap): number;
|
|
64
|
-
static handlePointerDown(event: React.PointerEvent<HTMLElement>, appState: AppState,
|
|
64
|
+
static handlePointerDown(event: React.PointerEvent<HTMLElement>, appState: AppState, store: Store, scenePointer: {
|
|
65
65
|
x: number;
|
|
66
66
|
y: number;
|
|
67
|
-
}, linearElementEditor: LinearElementEditor,
|
|
67
|
+
}, linearElementEditor: LinearElementEditor, app: AppClassProperties): {
|
|
68
68
|
didAddPoint: boolean;
|
|
69
69
|
hitElement: NonDeleted<ExcalidrawElement> | null;
|
|
70
70
|
linearElementEditor: LinearElementEditor | null;
|
|
@@ -132,13 +132,13 @@ export declare class LinearElementEditor {
|
|
|
132
132
|
isLoading: boolean;
|
|
133
133
|
errorMessage: import("react").ReactNode;
|
|
134
134
|
activeEmbeddable: {
|
|
135
|
-
element: NonDeletedExcalidrawElement;
|
|
135
|
+
element: import("./types").NonDeletedExcalidrawElement;
|
|
136
136
|
state: "active" | "hover";
|
|
137
137
|
} | null;
|
|
138
|
-
draggingElement: NonDeletedExcalidrawElement | null;
|
|
139
|
-
resizingElement: NonDeletedExcalidrawElement | null;
|
|
138
|
+
draggingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
139
|
+
resizingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
140
140
|
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
141
|
-
selectionElement: NonDeletedExcalidrawElement | null;
|
|
141
|
+
selectionElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
142
142
|
isBindingEnabled: boolean;
|
|
143
143
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
144
144
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
@@ -151,7 +151,7 @@ export declare class LinearElementEditor {
|
|
|
151
151
|
};
|
|
152
152
|
editingFrame: string | null;
|
|
153
153
|
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
154
|
-
editingElement: NonDeletedExcalidrawElement | null;
|
|
154
|
+
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
155
155
|
activeTool: {
|
|
156
156
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
157
157
|
locked: boolean;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { ExcalidrawElement } from "./types";
|
|
2
|
-
import { Mutable } from "../utility-types";
|
|
3
|
-
type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce">;
|
|
1
|
+
import type { ExcalidrawElement } from "./types";
|
|
2
|
+
import type { Mutable } from "../utility-types";
|
|
3
|
+
export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce" | "updated">;
|
|
4
4
|
export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
5
|
-
export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement
|
|
5
|
+
export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>, force?: boolean) => TElement;
|
|
6
6
|
/**
|
|
7
7
|
* Mutates element, bumping `version`, `versionNonce`, and `updated`.
|
|
8
8
|
*
|
|
9
9
|
* NOTE: does not trigger re-render.
|
|
10
10
|
*/
|
|
11
11
|
export declare const bumpVersion: <T extends Mutable<ExcalidrawElement>>(element: T, version?: ExcalidrawElement["version"]) => T;
|
|
12
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap } from "./types";
|
|
2
|
-
import { AppState } from "../types";
|
|
3
|
-
import { MarkOptional, Mutable } from "../utility-types";
|
|
4
|
-
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity" | "customData">;
|
|
1
|
+
import type { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap } from "./types";
|
|
2
|
+
import type { AppState } from "../types";
|
|
3
|
+
import type { MarkOptional, Mutable } from "../utility-types";
|
|
4
|
+
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "index" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity" | "customData">;
|
|
5
5
|
export declare const newElement: (opts: {
|
|
6
6
|
type: ExcalidrawGenericElement["type"];
|
|
7
7
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
@@ -35,13 +35,6 @@ export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement,
|
|
|
35
35
|
height: number;
|
|
36
36
|
text: string;
|
|
37
37
|
} | undefined;
|
|
38
|
-
export declare const updateTextElement: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, elementsMap: ElementsMap, { text, isDeleted, originalText, rawText, link, }: {
|
|
39
|
-
text: string;
|
|
40
|
-
isDeleted?: boolean | undefined;
|
|
41
|
-
originalText: string;
|
|
42
|
-
rawText?: string | undefined;
|
|
43
|
-
link?: string | undefined;
|
|
44
|
-
}) => ExcalidrawTextElement;
|
|
45
38
|
export declare const newFreeDrawElement: (opts: {
|
|
46
39
|
type: "freedraw";
|
|
47
40
|
points?: ExcalidrawFreeDrawElement["points"];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, ElementsMap } from "./types";
|
|
2
|
-
import { MaybeTransformHandleType, TransformHandleDirection } from "./transformHandles";
|
|
3
|
-
import { PointerDownState } from "../types";
|
|
1
|
+
import type { ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, ElementsMap } from "./types";
|
|
2
|
+
import type { MaybeTransformHandleType, TransformHandleDirection } from "./transformHandles";
|
|
3
|
+
import type { PointerDownState } from "../types";
|
|
4
4
|
export declare const normalizeAngle: (angle: number) => number;
|
|
5
5
|
export declare const transformElements: (originalElements: PointerDownState["originalElements"], transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
|
|
6
6
|
export declare const resizeSingleElement: (originalElements: PointerDownState["originalElements"], shouldMaintainAspectRatio: boolean, element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, transformHandleDirection: TransformHandleDirection, shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
|
|
7
|
-
export declare const resizeMultipleElements: (originalElements: PointerDownState["originalElements"], selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, transformHandleType:
|
|
7
|
+
export declare const resizeMultipleElements: (originalElements: PointerDownState["originalElements"], selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, transformHandleType: TransformHandleDirection, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number) => void;
|
|
8
8
|
export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, x: number, y: number) => [number, number];
|
|
9
9
|
export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ExcalidrawElement, PointerType, NonDeletedExcalidrawElement, ElementsMap } from "./types";
|
|
2
|
-
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
|
-
import { AppState, Zoom } from "../types";
|
|
4
|
-
import { Bounds } from "./bounds";
|
|
5
|
-
export declare const resizeTest: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType) => MaybeTransformHandleType;
|
|
6
|
-
export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, elementsMap: ElementsMap) => {
|
|
1
|
+
import type { ExcalidrawElement, PointerType, NonDeletedExcalidrawElement, ElementsMap } from "./types";
|
|
2
|
+
import type { MaybeTransformHandleType } from "./transformHandles";
|
|
3
|
+
import type { AppState, Device, Zoom } from "../types";
|
|
4
|
+
import type { Bounds } from "./bounds";
|
|
5
|
+
export declare const resizeTest: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType, device: Device) => MaybeTransformHandleType;
|
|
6
|
+
export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, elementsMap: ElementsMap, device: Device) => {
|
|
7
7
|
element: NonDeletedExcalidrawElement;
|
|
8
8
|
transformHandleType: MaybeTransformHandleType;
|
|
9
9
|
} | null;
|
|
10
|
-
export declare const getTransformHandleTypeFromCoords: ([x1, y1, x2, y2]: Bounds, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType) => MaybeTransformHandleType;
|
|
10
|
+
export declare const getTransformHandleTypeFromCoords: ([x1, y1, x2, y2]: Bounds, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, device: Device) => MaybeTransformHandleType;
|
|
11
11
|
export declare const getCursorForResizingElement: (resizingElement: {
|
|
12
12
|
element?: ExcalidrawElement;
|
|
13
13
|
transformHandleType: MaybeTransformHandleType;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { NonDeletedExcalidrawElement } from "./types";
|
|
2
|
-
import { UIAppState } from "../types";
|
|
1
|
+
import type { NonDeletedExcalidrawElement } from "./types";
|
|
2
|
+
import type { UIAppState } from "../types";
|
|
3
3
|
export declare const showSelectedShapeActions: (appState: UIAppState, elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ElementsMap, ExcalidrawElement } from "./types";
|
|
2
|
-
import { AppState, Zoom } from "../types";
|
|
1
|
+
import type { ElementsMap, ExcalidrawElement } from "./types";
|
|
2
|
+
import type { AppState, Zoom } from "../types";
|
|
3
3
|
export declare const isInvisiblySmallElement: (element: ExcalidrawElement) => boolean;
|
|
4
4
|
export declare const isElementInViewport: (element: ExcalidrawElement, width: number, height: number, viewTransformations: {
|
|
5
5
|
zoom: Zoom;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ExcalidrawElement } from "./types";
|
|
1
|
+
import type { ExcalidrawElement } from "./types";
|
|
2
2
|
export declare const normalizeElementOrder: (elements: readonly ExcalidrawElement[]) => readonly ExcalidrawElement[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
2
|
-
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
|
-
import { AppState } from "../types";
|
|
4
|
-
import { ExtractSetType, MakeBrand } from "../utility-types";
|
|
1
|
+
import type { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
2
|
+
import type { MaybeTransformHandleType } from "./transformHandles";
|
|
3
|
+
import type { AppState } from "../types";
|
|
4
|
+
import type { ExtractSetType, MakeBrand } from "../utility-types";
|
|
5
5
|
export declare const normalizeText: (text: string) => string;
|
|
6
|
-
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, elementsMap: ElementsMap) => void;
|
|
6
|
+
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, elementsMap: ElementsMap, informMutation?: boolean) => void;
|
|
7
7
|
export declare const bindTextToShapeAfterDuplication: (newElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
8
8
|
export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, elementsMap: ElementsMap, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean) => void;
|
|
9
9
|
export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
|
|
@@ -61,7 +61,6 @@ export declare const getBoundTextElementPosition: (container: ExcalidrawElement,
|
|
|
61
61
|
} | undefined;
|
|
62
62
|
export declare const shouldAllowVerticalAlign: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
63
63
|
export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
64
|
-
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number, elementsMap: ElementsMap) => ExcalidrawTextContainer | null;
|
|
65
64
|
declare const VALID_CONTAINER_TYPES: Set<string>;
|
|
66
65
|
export declare const isValidTextContainer: (element: {
|
|
67
66
|
type: ExcalidrawElementType;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawTextElement } from "./types";
|
|
2
|
-
import App from "../components/App";
|
|
1
|
+
import type { ExcalidrawElement, ExcalidrawTextElement } from "./types";
|
|
2
|
+
import type App from "../components/App";
|
|
3
3
|
export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, }: {
|
|
4
4
|
id: ExcalidrawElement["id"];
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* textWysiwyg only deals with `originalText`
|
|
7
|
+
*
|
|
8
|
+
* Note: `text`, which can be wrapped and therefore different from `originalText`,
|
|
9
|
+
* is derived from `originalText`
|
|
10
|
+
*/
|
|
11
|
+
onChange?: ((nextOriginalText: string) => void) | undefined;
|
|
6
12
|
onSubmit: (data: {
|
|
7
|
-
text: string;
|
|
8
13
|
viaKeyboard: boolean;
|
|
9
|
-
|
|
14
|
+
nextOriginalText: string;
|
|
10
15
|
}) => void;
|
|
11
16
|
getViewportCoords: (x: number, y: number) => [number, number];
|
|
12
17
|
element: ExcalidrawTextElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
|
|
2
|
-
import { Bounds } from "./bounds";
|
|
3
|
-
import { InteractiveCanvasAppState, Zoom } from "../types";
|
|
1
|
+
import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
|
|
2
|
+
import type { Bounds } from "./bounds";
|
|
3
|
+
import type { Device, InteractiveCanvasAppState, Zoom } from "../types";
|
|
4
4
|
export type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
|
|
5
5
|
export type TransformHandleType = TransformHandleDirection | "rotation";
|
|
6
6
|
export type TransformHandle = Bounds;
|
|
@@ -8,6 +8,12 @@ export type TransformHandles = Partial<{
|
|
|
8
8
|
[T in TransformHandleType]: TransformHandle;
|
|
9
9
|
}>;
|
|
10
10
|
export type MaybeTransformHandleType = TransformHandleType | false;
|
|
11
|
+
export declare const DEFAULT_OMIT_SIDES: {
|
|
12
|
+
e: boolean;
|
|
13
|
+
s: boolean;
|
|
14
|
+
n: boolean;
|
|
15
|
+
w: boolean;
|
|
16
|
+
};
|
|
11
17
|
export declare const OMIT_SIDES_FOR_MULTIPLE_ELEMENTS: {
|
|
12
18
|
e: boolean;
|
|
13
19
|
s: boolean;
|
|
@@ -21,16 +27,28 @@ export declare const OMIT_SIDES_FOR_FRAME: {
|
|
|
21
27
|
w: boolean;
|
|
22
28
|
rotation: boolean;
|
|
23
29
|
};
|
|
30
|
+
export declare const canResizeFromSides: (device: Device) => boolean;
|
|
31
|
+
export declare const getOmitSidesForDevice: (device: Device) => {};
|
|
24
32
|
export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [number, number, number, number, number, number], angle: number, zoom: Zoom, pointerType: PointerType, omitSides?: {
|
|
25
33
|
s?: boolean | undefined;
|
|
26
|
-
n?: boolean | undefined;
|
|
27
|
-
w?: boolean | undefined;
|
|
28
34
|
e?: boolean | undefined;
|
|
35
|
+
w?: boolean | undefined;
|
|
36
|
+
n?: boolean | undefined;
|
|
29
37
|
nw?: boolean | undefined;
|
|
30
38
|
ne?: boolean | undefined;
|
|
31
39
|
sw?: boolean | undefined;
|
|
32
40
|
se?: boolean | undefined;
|
|
33
41
|
rotation?: boolean | undefined;
|
|
34
42
|
}, margin?: number) => TransformHandles;
|
|
35
|
-
export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, elementsMap: ElementsMap, pointerType?: PointerType
|
|
43
|
+
export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, elementsMap: ElementsMap, pointerType?: PointerType, omitSides?: {
|
|
44
|
+
s?: boolean | undefined;
|
|
45
|
+
e?: boolean | undefined;
|
|
46
|
+
w?: boolean | undefined;
|
|
47
|
+
n?: boolean | undefined;
|
|
48
|
+
nw?: boolean | undefined;
|
|
49
|
+
ne?: boolean | undefined;
|
|
50
|
+
sw?: boolean | undefined;
|
|
51
|
+
se?: boolean | undefined;
|
|
52
|
+
rotation?: boolean | undefined;
|
|
53
|
+
}) => TransformHandles;
|
|
36
54
|
export declare const shouldShowBoundingBox: (elements: readonly NonDeletedExcalidrawElement[], appState: InteractiveCanvasAppState) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ElementOrToolType } from "../types";
|
|
2
|
-
import { MarkNonNullable } from "../utility-types";
|
|
3
|
-
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement } from "./types";
|
|
1
|
+
import type { ElementOrToolType } from "../types";
|
|
2
|
+
import type { MarkNonNullable } from "../utility-types";
|
|
3
|
+
import type { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement, ExcalidrawArrowElement } from "./types";
|
|
4
4
|
export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
|
|
5
5
|
export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
|
|
6
6
|
export declare const isEmbeddableElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawEmbeddableElement;
|
|
@@ -13,7 +13,7 @@ export declare const isFrameLikeElement: (element: ExcalidrawElement | null) =>
|
|
|
13
13
|
export declare const isFreeDrawElement: (element?: ExcalidrawElement | null) => element is ExcalidrawFreeDrawElement;
|
|
14
14
|
export declare const isFreeDrawElementType: (elementType: ExcalidrawElementType) => boolean;
|
|
15
15
|
export declare const isLinearElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
|
|
16
|
-
export declare const isArrowElement: (element?: ExcalidrawElement | null) => element is
|
|
16
|
+
export declare const isArrowElement: (element?: ExcalidrawElement | null) => element is ExcalidrawArrowElement;
|
|
17
17
|
export declare const isLinearElementType: (elementType: ElementOrToolType) => boolean;
|
|
18
18
|
export declare const isBindingElement: (element?: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawLinearElement;
|
|
19
19
|
export declare const isBindingElementType: (elementType: ElementOrToolType) => boolean;
|