@dwelle/excalidraw 0.4.0-e1bdbb6 → 0.4.0-e587816
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +714 -0
- package/README.md +18 -1422
- package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js → vendor-d415b28e9024dee4bb1b.js} +2 -2
- package/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.js → vendor-a14cd58fa2db417e42b2.js} +6 -6
- package/dist/excalidraw.development.js +3257 -1444
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +20 -0
- package/main.js +1 -8
- package/package.json +9 -4
- package/types/actions/actionAddToLibrary.d.ts +124 -64
- package/types/actions/actionAlign.d.ts +33 -40
- package/types/actions/actionBoundText.d.ts +182 -25
- package/types/actions/actionCanvas.d.ts +754 -220
- package/types/actions/actionClipboard.d.ts +236 -115
- package/types/actions/actionDeleteSelected.d.ts +133 -72
- package/types/actions/actionDistribute.d.ts +11 -16
- package/types/actions/actionDuplicateSelection.d.ts +4 -7
- package/types/actions/actionElementLock.d.ts +271 -0
- package/types/actions/actionExport.d.ts +440 -277
- package/types/actions/actionFinalize.d.ts +85 -51
- package/types/actions/actionFlip.d.ts +8 -11
- package/types/actions/actionFrame.d.ts +423 -0
- package/types/actions/actionGroup.d.ts +252 -19
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +44 -24
- package/types/actions/actionMenu.d.ts +132 -79
- package/types/actions/actionNavigate.d.ts +2 -3
- package/types/actions/actionProperties.d.ts +569 -334
- package/types/actions/actionSelectAll.d.ts +123 -4
- package/types/actions/actionStyles.d.ts +46 -27
- package/types/actions/actionToggleGridMode.d.ts +46 -25
- package/types/actions/{actionToggleLock.d.ts → actionToggleObjectsSnapMode.d.ts} +56 -35
- package/types/actions/actionToggleStats.d.ts +45 -25
- package/types/actions/actionToggleViewMode.d.ts +46 -25
- package/types/actions/actionToggleZenMode.d.ts +46 -25
- package/types/actions/actionZindex.d.ts +16 -24
- package/types/actions/index.d.ts +2 -1
- package/types/actions/manager.d.ts +3 -2
- package/types/actions/shortcuts.d.ts +2 -1
- package/types/actions/types.d.ts +16 -13
- package/types/appState.d.ts +27 -28
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +5 -6
- package/types/clipboard.d.ts +9 -3
- package/types/colors.d.ts +60 -5
- package/types/components/Actions.d.ts +7 -12
- package/types/components/ActiveConfirmDialog.d.ts +4 -0
- package/types/components/App.d.ts +102 -86
- package/types/components/Avatar.d.ts +1 -2
- package/types/components/BraveMeasureTextError.d.ts +2 -0
- package/types/components/Button.d.ts +16 -0
- package/types/components/ButtonIconSelect.d.ts +11 -3
- package/types/components/Card.d.ts +6 -0
- package/types/components/ColorPicker/ColorInput.d.ts +9 -0
- package/types/components/ColorPicker/ColorPicker.d.ts +19 -0
- package/types/components/ColorPicker/CustomColorList.d.ts +8 -0
- package/types/components/ColorPicker/HotkeyLabel.d.ts +8 -0
- package/types/components/ColorPicker/Picker.d.ts +18 -0
- package/types/components/ColorPicker/PickerColorList.d.ts +10 -0
- package/types/components/ColorPicker/PickerHeading.d.ts +5 -0
- package/types/components/ColorPicker/ShadeList.d.ts +8 -0
- package/types/components/ColorPicker/TopPicks.d.ts +9 -0
- package/types/components/ColorPicker/colorPickerUtils.d.ts +21 -0
- package/types/components/ColorPicker/keyboardNavHandlers.d.ts +20 -0
- package/types/components/ContextMenu.d.ts +9 -22
- package/types/components/DefaultSidebar.d.ts +29 -0
- package/types/components/Dialog.d.ts +3 -4
- package/types/components/ErrorDialog.d.ts +3 -2
- package/types/components/ExcalidrawLogo.d.ts +15 -0
- package/types/components/EyeDropper.d.ts +28 -0
- package/types/components/FilledButton.d.ts +17 -0
- package/types/components/FixedSideContainer.d.ts +1 -1
- package/types/components/HandButton.d.ts +10 -0
- package/types/components/HelpButton.d.ts +1 -2
- package/types/components/HintViewer.d.ts +4 -5
- package/types/components/HomeButton.d.ts +1 -1
- package/types/components/ImageExportDialog.d.ts +8 -13
- package/types/components/Island.d.ts +1 -1
- package/types/components/JSONExportDialog.d.ts +7 -5
- package/types/components/LaserTool/LaserPathManager.d.ts +28 -0
- package/types/components/LaserTool/LaserPointerButton.d.ts +10 -0
- package/types/components/LaserTool/LaserTool.d.ts +7 -0
- package/types/components/LayerUI.d.ts +11 -19
- package/types/components/LibraryMenu.d.ts +13 -14
- package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
- package/types/components/LibraryMenuControlButtons.d.ts +9 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +10 -5
- package/types/components/LibraryMenuItems.d.ts +6 -7
- package/types/components/LibraryMenuSection.d.ts +22 -0
- package/types/components/LibraryUnit.d.ts +6 -3
- package/types/components/LoadingMessage.d.ts +0 -1
- package/types/components/LockButton.d.ts +1 -2
- package/types/components/MobileMenu.d.ts +9 -15
- package/types/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
- package/types/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
- package/types/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
- package/types/components/PasteChartDialog.d.ts +4 -5
- package/types/components/PenModeButton.d.ts +1 -1
- package/types/components/Popover.d.ts +1 -1
- package/types/components/ProjectName.d.ts +2 -1
- package/types/components/PublishLibrary.d.ts +2 -2
- package/types/components/RadioGroup.d.ts +12 -0
- package/types/components/Section.d.ts +1 -1
- package/types/components/Sidebar/Sidebar.d.ts +66 -63
- package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
- package/types/components/Sidebar/SidebarTab.d.ts +8 -0
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +9 -0
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +6 -0
- package/types/components/Sidebar/SidebarTabs.d.ts +6 -0
- package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
- package/types/components/Sidebar/common.d.ts +24 -7
- package/types/components/Spinner.d.ts +2 -1
- package/types/components/Stack.d.ts +4 -3
- package/types/components/Stats.d.ts +3 -3
- package/types/components/Switch.d.ts +9 -0
- package/types/components/ToolButton.d.ts +6 -5
- package/types/components/Tooltip.d.ts +1 -1
- package/types/components/Trans.d.ts +9 -0
- package/types/components/UserList.d.ts +0 -2
- package/types/components/canvases/InteractiveCanvas.d.ts +27 -0
- package/types/components/canvases/StaticCanvas.d.ts +18 -0
- package/types/components/canvases/index.d.ts +3 -0
- package/types/components/dropdownMenu/DropdownMenu.d.ts +70 -0
- package/types/components/dropdownMenu/DropdownMenuContent.d.ts +15 -0
- package/types/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
- package/types/components/dropdownMenu/DropdownMenuItem.d.ts +13 -0
- package/types/components/dropdownMenu/DropdownMenuItemContent.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +7 -0
- package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +14 -0
- package/types/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +10 -0
- package/types/components/dropdownMenu/common.d.ts +6 -0
- package/types/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -0
- package/types/components/footer/Footer.d.ts +12 -0
- package/types/components/footer/FooterCenter.d.ts +8 -0
- package/types/components/hoc/withInternalFallback.d.ts +4 -0
- package/types/components/icons.d.ts +17 -2
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +9 -0
- package/types/components/main-menu/DefaultItems.d.ts +47 -0
- package/types/components/main-menu/MainMenu.d.ts +64 -0
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +57 -0
- package/types/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
- package/types/components/welcome-screen/WelcomeScreen.d.ts +84 -0
- package/types/constants.d.ts +105 -18
- package/types/context/tunnels.d.ts +19 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/cursor.d.ts +5 -0
- package/types/data/blob.d.ts +5 -3
- package/types/data/encode.d.ts +1 -1
- package/types/data/filesystem.d.ts +2 -1
- package/types/data/index.d.ts +1 -1
- package/types/data/library.d.ts +3 -45
- package/types/data/restore.d.ts +10 -4
- package/types/data/transform.d.ts +73 -0
- package/types/data/types.d.ts +3 -5
- package/types/data/url.d.ts +7 -0
- package/types/element/Hyperlink.d.ts +57 -36
- package/types/element/binding.d.ts +4 -3
- package/types/element/bounds.d.ts +41 -10
- package/types/element/collision.d.ts +7 -7
- package/types/element/dragElements.d.ts +12 -2
- package/types/element/embeddable.d.ts +153 -0
- package/types/element/image.d.ts +11 -1
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +77 -30
- package/types/element/mutateElement.d.ts +3 -2
- package/types/element/newElement.d.ts +48 -15
- package/types/element/resizeElements.d.ts +3 -3
- package/types/element/resizeTest.d.ts +2 -1
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/sizeHelpers.d.ts +8 -1
- package/types/element/sortElements.d.ts +2 -0
- package/types/element/textElement.d.ts +57 -9
- package/types/element/textWysiwyg.d.ts +7 -2
- package/types/element/transformHandles.d.ts +15 -8
- package/types/element/typeChecks.d.ts +14 -2
- package/types/element/types.d.ts +66 -35
- package/types/emitter.d.ts +1 -2
- package/types/errors.d.ts +1 -1
- package/types/frame.d.ts +46 -0
- package/types/ga.d.ts +5 -5
- package/types/groups.d.ts +15 -11
- package/types/history.d.ts +3 -3
- package/types/hooks/useCreatePortalContainer.d.ts +4 -0
- package/types/hooks/useLibraryItemSvg.d.ts +11 -0
- package/types/hooks/useOutsideClick.d.ts +19 -2
- package/types/hooks/useScrollPosition.d.ts +1 -0
- package/types/hooks/useStable.d.ts +1 -0
- package/types/hooks/useTransition.d.ts +2 -0
- package/types/i18n.d.ts +11 -2
- package/types/jotai.d.ts +20 -108
- package/types/keys.d.ts +7 -4
- package/types/math.d.ts +7 -1
- package/types/packages/bbox.d.ts +11 -0
- package/types/packages/excalidraw/example/App.d.ts +7 -1
- package/types/packages/excalidraw/example/CustomFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/MobileFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/initialData.d.ts +182 -64
- package/types/packages/excalidraw/index.d.ts +22 -4
- package/types/packages/excalidraw/main.d.ts +3 -1
- package/types/packages/excalidraw/webpack.dev.config.d.ts +5 -2
- package/types/packages/excalidraw/webpack.prod.config.d.ts +3 -0
- package/types/packages/utils.d.ts +30 -24
- package/types/packages/withinBounds.d.ts +19 -0
- package/types/renderer/renderElement.d.ts +13 -22
- package/types/renderer/renderScene.d.ts +19 -29
- package/types/renderer/renderSnaps.d.ts +2 -0
- package/types/renderer/roundRect.d.ts +1 -1
- package/types/scene/Fonts.d.ts +21 -0
- package/types/scene/Renderer.d.ts +25 -0
- package/types/scene/Scene.d.ts +42 -5
- package/types/scene/Shape.d.ts +12 -0
- package/types/scene/ShapeCache.d.ts +20 -0
- package/types/scene/comparisons.d.ts +2 -4
- package/types/scene/export.d.ts +183 -10
- package/types/scene/index.d.ts +1 -1
- package/types/scene/scroll.d.ts +1 -1
- package/types/scene/scrollbars.d.ts +2 -6
- package/types/scene/selection.d.ts +27 -6
- package/types/scene/types.d.ts +70 -26
- package/types/snapping.d.ts +108 -0
- package/types/types.d.ts +227 -91
- package/types/utility-types.d.ts +24 -0
- package/types/utils.d.ts +75 -14
- package/types/zindex.d.ts +4 -4
- package/types/components/ActiveFile.d.ts +0 -7
- package/types/components/ClearCanvas.d.ts +0 -4
- package/types/components/CollabButton.d.ts +0 -6
- package/types/components/ColorPicker.d.ts +0 -14
- package/types/components/Footer.d.ts +0 -10
- package/types/components/LibraryButton.d.ts +0 -8
- package/types/components/MenuItem.d.ts +0 -11
- package/types/components/MenuUtils.d.ts +0 -1
- package/types/components/SingleLibraryItem.d.ts +0 -10
- package/types/components/WelcomeScreen.d.ts +0 -10
- package/types/components/WelcomeScreenDecor.d.ts +0 -6
- package/types/components/hoc/withUpstreamOverride.d.ts +0 -10
- /package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js.LICENSE.txt → vendor-d415b28e9024dee4bb1b.js.LICENSE.txt} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.d.ts → vendor-d415b28e9024dee4bb1b.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.d.ts → vendor-a14cd58fa2db417e42b2.d.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ExcalidrawElement } from "../element/types";
|
|
2
|
+
import type Scene from "./Scene";
|
|
3
|
+
export declare class Fonts {
|
|
4
|
+
private scene;
|
|
5
|
+
private onSceneUpdated;
|
|
6
|
+
constructor({ scene, onSceneUpdated, }: {
|
|
7
|
+
scene: Scene;
|
|
8
|
+
onSceneUpdated: () => void;
|
|
9
|
+
});
|
|
10
|
+
private static loadedFontFaces;
|
|
11
|
+
/**
|
|
12
|
+
* if we load a (new) font, it's likely that text elements using it have
|
|
13
|
+
* already been rendered using a fallback font. Thus, we want invalidate
|
|
14
|
+
* their shapes and rerender. See #637.
|
|
15
|
+
*
|
|
16
|
+
* Invalidates text elements and rerenders scene, provided that at least one
|
|
17
|
+
* of the supplied fontFaces has not already been processed.
|
|
18
|
+
*/
|
|
19
|
+
onFontsLoaded: (fontFaces: readonly FontFace[]) => false | undefined;
|
|
20
|
+
loadFontsForElements: (elements: readonly ExcalidrawElement[]) => Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
+
import { AppState } from "../types";
|
|
3
|
+
import Scene from "./Scene";
|
|
4
|
+
export declare class Renderer {
|
|
5
|
+
private scene;
|
|
6
|
+
constructor(scene: Scene);
|
|
7
|
+
getRenderableElements: ((opts: {
|
|
8
|
+
zoom: AppState["zoom"];
|
|
9
|
+
offsetLeft: AppState["offsetLeft"];
|
|
10
|
+
offsetTop: AppState["offsetTop"];
|
|
11
|
+
scrollX: AppState["scrollX"];
|
|
12
|
+
scrollY: AppState["scrollY"];
|
|
13
|
+
height: AppState["height"];
|
|
14
|
+
width: AppState["width"];
|
|
15
|
+
editingElement: AppState["editingElement"];
|
|
16
|
+
pendingImageElementId: AppState["pendingImageElementId"];
|
|
17
|
+
versionNonce: ReturnType<InstanceType<typeof Scene>["getVersionNonce"]>;
|
|
18
|
+
}) => {
|
|
19
|
+
canvasElements: NonDeletedExcalidrawElement[];
|
|
20
|
+
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
21
|
+
}) & {
|
|
22
|
+
clear: () => void;
|
|
23
|
+
};
|
|
24
|
+
destroy(): void;
|
|
25
|
+
}
|
package/types/scene/Scene.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "../element/types";
|
|
1
|
+
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameElement } from "../element/types";
|
|
2
2
|
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { AppState } from "../types";
|
|
4
|
+
type ElementIdKey = InstanceType<typeof LinearElementEditor>["elementId"];
|
|
5
|
+
type ElementKey = ExcalidrawElement | ElementIdKey;
|
|
6
|
+
type SceneStateCallback = () => void;
|
|
7
|
+
type SceneStateCallbackRemover = () => void;
|
|
8
|
+
export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
|
|
7
9
|
declare class Scene {
|
|
8
10
|
private static sceneMapByElement;
|
|
9
11
|
private static sceneMapById;
|
|
@@ -12,14 +14,49 @@ declare class Scene {
|
|
|
12
14
|
private callbacks;
|
|
13
15
|
private nonDeletedElements;
|
|
14
16
|
private elements;
|
|
17
|
+
private nonDeletedFrames;
|
|
18
|
+
private frames;
|
|
15
19
|
private elementsMap;
|
|
20
|
+
private selectedElementsCache;
|
|
21
|
+
private versionNonce;
|
|
16
22
|
getElementsIncludingDeleted(): readonly ExcalidrawElement[];
|
|
17
23
|
getNonDeletedElements(): readonly NonDeletedExcalidrawElement[];
|
|
24
|
+
getFramesIncludingDeleted(): readonly ExcalidrawFrameElement[];
|
|
25
|
+
getSelectedElements(opts: {
|
|
26
|
+
selectedElementIds: AppState["selectedElementIds"];
|
|
27
|
+
/**
|
|
28
|
+
* for specific cases where you need to use elements not from current
|
|
29
|
+
* scene state. This in effect will likely result in cache-miss, and
|
|
30
|
+
* the cache won't be updated in this case.
|
|
31
|
+
*/
|
|
32
|
+
elements?: readonly ExcalidrawElement[];
|
|
33
|
+
includeBoundTextElement?: boolean;
|
|
34
|
+
includeElementsInFrames?: boolean;
|
|
35
|
+
}): NonDeleted<ExcalidrawElement>[];
|
|
36
|
+
getNonDeletedFrames(): readonly NonDeleted<ExcalidrawFrameElement>[];
|
|
18
37
|
getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
|
|
38
|
+
getVersionNonce(): number | undefined;
|
|
19
39
|
getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
|
|
40
|
+
/**
|
|
41
|
+
* A utility method to help with updating all scene elements, with the added
|
|
42
|
+
* performance optimization of not renewing the array if no change is made.
|
|
43
|
+
*
|
|
44
|
+
* Maps all current excalidraw elements, invoking the callback for each
|
|
45
|
+
* element. The callback should either return a new mapped element, or the
|
|
46
|
+
* original element if no changes are made. If no changes are made to any
|
|
47
|
+
* element, this results in a no-op. Otherwise, the newly mapped elements
|
|
48
|
+
* are set as the next scene's elements.
|
|
49
|
+
*
|
|
50
|
+
* @returns whether a change was made
|
|
51
|
+
*/
|
|
52
|
+
mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
|
|
20
53
|
replaceAllElements(nextElements: readonly ExcalidrawElement[]): void;
|
|
21
54
|
informMutation(): void;
|
|
22
55
|
addCallback(cb: SceneStateCallback): SceneStateCallbackRemover;
|
|
23
56
|
destroy(): void;
|
|
57
|
+
insertElementAtIndex(element: ExcalidrawElement, index: number): void;
|
|
58
|
+
insertElementsAtIndex(elements: ExcalidrawElement[], index: number): void;
|
|
59
|
+
addNewElement: (element: ExcalidrawElement) => void;
|
|
60
|
+
getElementIndex(elementId: string): number;
|
|
24
61
|
}
|
|
25
62
|
export default Scene;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Drawable, Options } from "roughjs/bin/core";
|
|
2
|
+
import type { RoughGenerator } from "roughjs/bin/generator";
|
|
3
|
+
import type { ExcalidrawElement, NonDeletedExcalidrawElement, ExcalidrawSelectionElement } from "../element/types";
|
|
4
|
+
export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
|
|
5
|
+
/**
|
|
6
|
+
* Generates the roughjs shape for given element.
|
|
7
|
+
*
|
|
8
|
+
* Low-level. Use `ShapeCache.generateElementShape` instead.
|
|
9
|
+
*
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare const _generateElementShape: (element: Exclude<NonDeletedExcalidrawElement, ExcalidrawSelectionElement>, generator: RoughGenerator, isExporting?: boolean) => Drawable | Drawable[] | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Drawable } from "roughjs/bin/core";
|
|
2
|
+
import { ExcalidrawElement } from "../element/types";
|
|
3
|
+
import { ElementShape, ElementShapes } from "./types";
|
|
4
|
+
export declare class ShapeCache {
|
|
5
|
+
private static rg;
|
|
6
|
+
private static cache;
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves shape from cache if available. Use this only if shape
|
|
9
|
+
* is optional and you have a fallback in case it's not cached.
|
|
10
|
+
*/
|
|
11
|
+
static get: <T extends ExcalidrawElement>(element: T) => T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined;
|
|
12
|
+
static set: <T extends ExcalidrawElement>(element: T, shape: T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable) => WeakMap<ExcalidrawElement, ElementShape>;
|
|
13
|
+
static delete: (element: ExcalidrawElement) => boolean;
|
|
14
|
+
static destroy: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Generates & caches shape for element if not already cached, otherwise
|
|
17
|
+
* returns cached shape.
|
|
18
|
+
*/
|
|
19
|
+
static generateElementShape: <T extends import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawEmbeddableElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement>(element: T, isExporting?: boolean) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
|
|
20
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
export declare const hasBackground: (type: string) => boolean;
|
|
3
3
|
export declare const hasStrokeColor: (type: string) => boolean;
|
|
4
4
|
export declare const hasStrokeWidth: (type: string) => boolean;
|
|
5
5
|
export declare const hasStrokeStyle: (type: string) => boolean;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const hasText: (type: string) => boolean;
|
|
6
|
+
export declare const canChangeRoundness: (type: string) => boolean;
|
|
8
7
|
export declare const canHaveArrowheads: (type: string) => boolean;
|
|
9
8
|
export declare const getElementAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement | null;
|
|
10
9
|
export declare const getElementsAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement[];
|
|
11
|
-
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], x: number, y: number) => ExcalidrawTextContainer | null;
|
package/types/scene/export.d.ts
CHANGED
|
@@ -1,13 +1,182 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bounds } from "../element/bounds";
|
|
2
|
+
import { NonDeletedExcalidrawElement, Theme } from "../element/types";
|
|
2
3
|
import { AppState, BinaryFiles } from "../types";
|
|
4
|
+
import { serializeAsJSON } from "../data/json";
|
|
3
5
|
export declare const SVG_EXPORT_TAG = "<!-- svg-source:excalidraw -->";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export type ExportToCanvasData = {
|
|
7
|
+
elements: readonly NonDeletedExcalidrawElement[];
|
|
8
|
+
appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
|
|
9
|
+
files: BinaryFiles | null;
|
|
10
|
+
};
|
|
11
|
+
export type ExportToCanvasConfig = {
|
|
12
|
+
theme?: Theme;
|
|
13
|
+
/**
|
|
14
|
+
* Canvas background. Valid values are:
|
|
15
|
+
*
|
|
16
|
+
* - `undefined` - the background of "appState.viewBackgroundColor" is used.
|
|
17
|
+
* - `false` - no background is used (set to "transparent").
|
|
18
|
+
* - `string` - should be a valid CSS color.
|
|
19
|
+
*
|
|
20
|
+
* @default undefined
|
|
21
|
+
*/
|
|
22
|
+
canvasBackgroundColor?: string | false;
|
|
23
|
+
/**
|
|
24
|
+
* Canvas padding in pixels. Affected by `scale`.
|
|
25
|
+
*
|
|
26
|
+
* When `fit` is set to `none`, padding is added to the content bounding box
|
|
27
|
+
* (including if you set `width` or `height` or `maxWidthOrHeight` or
|
|
28
|
+
* `widthOrHeight`).
|
|
29
|
+
*
|
|
30
|
+
* When `fit` set to `contain`, padding is subtracted from the content
|
|
31
|
+
* bounding box (ensuring the size doesn't exceed the supplied values, with
|
|
32
|
+
* the exeception of using alongside `scale` as noted above), and the padding
|
|
33
|
+
* serves as a minimum distance between the content and the canvas edges, as
|
|
34
|
+
* it may exceed the supplied padding value from one side or the other in
|
|
35
|
+
* order to maintain the aspect ratio. It is recommended to set `position`
|
|
36
|
+
* to `center` when using `fit=contain`.
|
|
37
|
+
*
|
|
38
|
+
* When `fit` is set to `cover`, padding is disabled (set to 0).
|
|
39
|
+
*
|
|
40
|
+
* When `fit` is set to `none` and either `width` or `height` or
|
|
41
|
+
* `maxWidthOrHeight` is set, padding is simply adding to the bounding box
|
|
42
|
+
* and the content may overflow the canvas, thus right or bottom padding
|
|
43
|
+
* may be ignored.
|
|
44
|
+
*
|
|
45
|
+
* @default 0
|
|
46
|
+
*/
|
|
47
|
+
padding?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Makes sure the canvas content fits into a frame of width/height no larger
|
|
50
|
+
* than this value, while maintaining the aspect ratio.
|
|
51
|
+
*
|
|
52
|
+
* Final dimensions can get smaller/larger if used in conjunction with
|
|
53
|
+
* `scale`.
|
|
54
|
+
*/
|
|
55
|
+
maxWidthOrHeight?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Scale the canvas content to be excatly this many pixels wide/tall,
|
|
58
|
+
* maintaining the aspect ratio.
|
|
59
|
+
*
|
|
60
|
+
* Cannot be used in conjunction with `maxWidthOrHeight`.
|
|
61
|
+
*
|
|
62
|
+
* Final dimensions can get smaller/larger if used in conjunction with
|
|
63
|
+
* `scale`.
|
|
64
|
+
*/
|
|
65
|
+
widthOrHeight?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Width of the frame. Supply `x` or `y` if you want to ofsset the canvas
|
|
68
|
+
* content.
|
|
69
|
+
*
|
|
70
|
+
* If `width` omitted but `height` supplied, `width` is calculated from the
|
|
71
|
+
* the content's bounding box to preserve the aspect ratio.
|
|
72
|
+
*
|
|
73
|
+
* Defaults to the content bounding box width when both `width` and `height`
|
|
74
|
+
* are omitted.
|
|
75
|
+
*/
|
|
76
|
+
width?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Height of the frame.
|
|
79
|
+
*
|
|
80
|
+
* If `height` omitted but `width` supplied, `height` is calculated from the
|
|
81
|
+
* content's bounding box to preserve the aspect ratio.
|
|
82
|
+
*
|
|
83
|
+
* Defaults to the content bounding box height when both `width` and `height`
|
|
84
|
+
* are omitted.
|
|
85
|
+
*/
|
|
86
|
+
height?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Left canvas offset. By default the coordinate is relative to the canvas.
|
|
89
|
+
* You can switch to content coordinates by setting `origin` to `content`.
|
|
90
|
+
*
|
|
91
|
+
* Defaults to the `x` postion of the content bounding box.
|
|
92
|
+
*/
|
|
93
|
+
x?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Top canvas offset. By default the coordinate is relative to the canvas.
|
|
96
|
+
* You can switch to content coordinates by setting `origin` to `content`.
|
|
97
|
+
*
|
|
98
|
+
* Defaults to the `y` postion of the content bounding box.
|
|
99
|
+
*/
|
|
100
|
+
y?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Indicates the coordinate system of the `x` and `y` values.
|
|
103
|
+
*
|
|
104
|
+
* - `canvas` - `x` and `y` are relative to the canvas [0, 0] position.
|
|
105
|
+
* - `content` - `x` and `y` are relative to the content bounding box.
|
|
106
|
+
*
|
|
107
|
+
* @default "canvas"
|
|
108
|
+
*/
|
|
109
|
+
origin?: "canvas" | "content";
|
|
110
|
+
/**
|
|
111
|
+
* If dimensions specified and `x` and `y` are not specified, this indicates
|
|
112
|
+
* how the canvas should be scaled.
|
|
113
|
+
*
|
|
114
|
+
* Behavior aligns with the `object-fit` CSS property.
|
|
115
|
+
*
|
|
116
|
+
* - `none` - no scaling.
|
|
117
|
+
* - `contain` - scale to fit the frame. Includes `padding`.
|
|
118
|
+
* - `cover` - scale to fill the frame while maintaining aspect ratio. If
|
|
119
|
+
* content overflows, it will be cropped.
|
|
120
|
+
*
|
|
121
|
+
* If `maxWidthOrHeight` or `widthOrHeight` is set, `fit` is ignored.
|
|
122
|
+
*
|
|
123
|
+
* @default "contain" unless `width`, `height`, `maxWidthOrHeight`, or
|
|
124
|
+
* `widthOrHeight` is specified in which case `none` is the default (can be
|
|
125
|
+
* changed). If `x` or `y` are specified, `none` is forced.
|
|
126
|
+
*/
|
|
127
|
+
fit?: "none" | "contain" | "cover";
|
|
128
|
+
/**
|
|
129
|
+
* When either `x` or `y` are not specified, indicates how the canvas should
|
|
130
|
+
* be aligned on the respective axis.
|
|
131
|
+
*
|
|
132
|
+
* - `none` - canvas aligned to top left.
|
|
133
|
+
* - `center` - canvas is centered on the axis which is not specified
|
|
134
|
+
* (or both).
|
|
135
|
+
*
|
|
136
|
+
* If `maxWidthOrHeight` or `widthOrHeight` is set, `position` is ignored.
|
|
137
|
+
*
|
|
138
|
+
* @default "center"
|
|
139
|
+
*/
|
|
140
|
+
position?: "center" | "topLeft";
|
|
141
|
+
/**
|
|
142
|
+
* A multiplier to increase/decrease the frame dimensions
|
|
143
|
+
* (content resolution).
|
|
144
|
+
*
|
|
145
|
+
* For example, if your canvas is 300x150 and you set scale to 2, the
|
|
146
|
+
* resulting size will be 600x300.
|
|
147
|
+
*
|
|
148
|
+
* @default 1
|
|
149
|
+
*/
|
|
150
|
+
scale?: number;
|
|
151
|
+
/**
|
|
152
|
+
* If you need to suply your own canvas, e.g. in test environments or in
|
|
153
|
+
* Node.js.
|
|
154
|
+
*
|
|
155
|
+
* Do not set `canvas.width/height` or modify the canvas context as that's
|
|
156
|
+
* handled by Excalidraw.
|
|
157
|
+
*
|
|
158
|
+
* Defaults to `document.createElement("canvas")`.
|
|
159
|
+
*/
|
|
160
|
+
createCanvas?: () => HTMLCanvasElement;
|
|
161
|
+
/**
|
|
162
|
+
* If you want to supply `width`/`height` dynamically (or derive from the
|
|
163
|
+
* content bounding box), you can use this function.
|
|
164
|
+
*
|
|
165
|
+
* Ignored if `maxWidthOrHeight`, `width`, or `height` is set.
|
|
166
|
+
*/
|
|
167
|
+
getDimensions?: (width: number, height: number) => {
|
|
168
|
+
width: number;
|
|
169
|
+
height: number;
|
|
170
|
+
scale?: number;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* This API is usually used as a precursor to searializing to Blob or PNG,
|
|
175
|
+
* but can also be used to create a canvas for other purposes.
|
|
176
|
+
*/
|
|
177
|
+
export declare const exportToCanvas: ({ data, config, }: {
|
|
178
|
+
data: ExportToCanvasData;
|
|
179
|
+
config?: ExportToCanvasConfig | undefined;
|
|
11
180
|
}) => Promise<HTMLCanvasElement>;
|
|
12
181
|
export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElement[], appState: {
|
|
13
182
|
exportBackground: boolean;
|
|
@@ -16,5 +185,9 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
16
185
|
viewBackgroundColor: string;
|
|
17
186
|
exportWithDarkMode?: boolean;
|
|
18
187
|
exportEmbedScene?: boolean;
|
|
19
|
-
|
|
20
|
-
|
|
188
|
+
renderFrame?: boolean;
|
|
189
|
+
}, files: BinaryFiles | null, opts?: {
|
|
190
|
+
serializeAsJSON?: () => string;
|
|
191
|
+
renderEmbeddables?: boolean;
|
|
192
|
+
}) => Promise<SVGSVGElement>;
|
|
193
|
+
export declare const getCanvasSize: (elements: readonly NonDeletedExcalidrawElement[]) => Bounds;
|
package/types/scene/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { isOverScrollBars } from "./scrollbars";
|
|
2
2
|
export { isSomeElementSelected, getElementsWithinSelection, getCommonAttributeOfSelectedElements, getSelectedElements, getTargetElements, } from "./selection";
|
|
3
3
|
export { calculateScrollCenter } from "./scroll";
|
|
4
|
-
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads,
|
|
4
|
+
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, getElementAtPosition, getElementsAtPosition, } from "./comparisons";
|
|
5
5
|
export { getNormalizedZoom } from "./zoom";
|
package/types/scene/scroll.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const centerScrollOn: ({ scenePoint, viewportDimensions, zoom, }:
|
|
|
11
11
|
scrollX: number;
|
|
12
12
|
scrollY: number;
|
|
13
13
|
};
|
|
14
|
-
export declare const calculateScrollCenter: (elements: readonly ExcalidrawElement[], appState: AppState
|
|
14
|
+
export declare const calculateScrollCenter: (elements: readonly ExcalidrawElement[], appState: AppState) => {
|
|
15
15
|
scrollX: number;
|
|
16
16
|
scrollY: number;
|
|
17
17
|
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "../element/types";
|
|
2
|
-
import {
|
|
2
|
+
import { InteractiveCanvasAppState } from "../types";
|
|
3
3
|
import { ScrollBars } from "./types";
|
|
4
4
|
export declare const SCROLLBAR_MARGIN = 4;
|
|
5
5
|
export declare const SCROLLBAR_WIDTH = 6;
|
|
6
6
|
export declare const SCROLLBAR_COLOR = "rgba(0,0,0,0.3)";
|
|
7
|
-
export declare const getScrollBars: (elements: readonly ExcalidrawElement[], viewportWidth: number, viewportHeight: number,
|
|
8
|
-
scrollX: number;
|
|
9
|
-
scrollY: number;
|
|
10
|
-
zoom: Zoom;
|
|
11
|
-
}) => ScrollBars;
|
|
7
|
+
export declare const getScrollBars: (elements: readonly ExcalidrawElement[], viewportWidth: number, viewportHeight: number, appState: InteractiveCanvasAppState) => ScrollBars;
|
|
12
8
|
export declare const isOverScrollBars: (scrollBars: ScrollBars, x: number, y: number) => {
|
|
13
9
|
isOverEither: boolean;
|
|
14
10
|
isOverHorizontal: boolean;
|
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState } from "../types";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { AppState, InteractiveCanvasAppState } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Frames and their containing elements are not to be selected at the same time.
|
|
5
|
+
* Given an array of selected elements, if there are frames and their containing elements
|
|
6
|
+
* we only keep the frames.
|
|
7
|
+
* @param selectedElements
|
|
8
|
+
*/
|
|
9
|
+
export declare const excludeElementsInFramesFromSelection: <T extends ExcalidrawElement>(selectedElements: readonly T[]) => T[];
|
|
10
|
+
export declare const getElementsWithinSelection: (elements: readonly NonDeletedExcalidrawElement[], selection: NonDeletedExcalidrawElement, excludeElementsInFrames?: boolean) => NonDeletedExcalidrawElement[];
|
|
11
|
+
export declare const getVisibleAndNonSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], selectedElements: readonly NonDeletedExcalidrawElement[], appState: AppState) => NonDeletedExcalidrawElement[];
|
|
12
|
+
export declare const isSomeElementSelected: {
|
|
13
|
+
(elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">): boolean;
|
|
14
|
+
clearCache(): void;
|
|
15
|
+
};
|
|
5
16
|
/**
|
|
6
17
|
* Returns common attribute (picked by `getAttribute` callback) of selected
|
|
7
18
|
* elements. If elements don't share the same value, returns `null`.
|
|
8
19
|
*/
|
|
9
|
-
export declare const getCommonAttributeOfSelectedElements: <T>(elements: readonly NonDeletedExcalidrawElement[], appState: AppState, getAttribute: (element: ExcalidrawElement) => T) => T | null;
|
|
10
|
-
export declare const getSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], appState:
|
|
11
|
-
|
|
20
|
+
export declare const getCommonAttributeOfSelectedElements: <T>(elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">, getAttribute: (element: ExcalidrawElement) => T) => T | null;
|
|
21
|
+
export declare const getSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<InteractiveCanvasAppState, "selectedElementIds">, opts?: {
|
|
22
|
+
includeBoundTextElement?: boolean;
|
|
23
|
+
includeElementsInFrames?: boolean;
|
|
24
|
+
}) => ExcalidrawElement[];
|
|
25
|
+
export declare const getTargetElements: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds" | "editingElement">) => ExcalidrawElement[];
|
|
26
|
+
/**
|
|
27
|
+
* returns prevState's selectedElementids if no change from previous, so as to
|
|
28
|
+
* retain reference identity for memoization
|
|
29
|
+
*/
|
|
30
|
+
export declare const makeNextSelectedElementIds: (nextSelectedElementIds: AppState["selectedElementIds"], prevState: Pick<AppState, "selectedElementIds">) => Readonly<{
|
|
31
|
+
[id: string]: true;
|
|
32
|
+
}>;
|
package/types/scene/types.d.ts
CHANGED
|
@@ -1,49 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
2
|
+
import { Drawable } from "roughjs/bin/core";
|
|
3
|
+
import { ExcalidrawTextElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
4
|
+
import { AppClassProperties, InteractiveCanvasAppState, StaticCanvasAppState } from "../types";
|
|
5
|
+
export type RenderConfig = {};
|
|
6
|
+
export type StaticCanvasRenderConfig = {
|
|
7
|
+
imageCache: AppClassProperties["imageCache"];
|
|
8
|
+
renderGrid: boolean;
|
|
9
|
+
/** when exporting the behavior is slightly different (e.g. we can't use
|
|
10
|
+
CSS filters), and we disable render optimizations for best output */
|
|
11
|
+
isExporting: boolean;
|
|
6
12
|
/** null indicates transparent bg */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
canvasBackgroundColor: string | null;
|
|
14
|
+
};
|
|
15
|
+
export type InteractiveCanvasRenderConfig = {
|
|
16
|
+
remoteSelectedElementIds: {
|
|
17
|
+
[elementId: string]: string[];
|
|
18
|
+
};
|
|
11
19
|
remotePointerViewportCoords: {
|
|
12
20
|
[id: string]: {
|
|
13
21
|
x: number;
|
|
14
22
|
y: number;
|
|
23
|
+
id: string;
|
|
15
24
|
};
|
|
16
25
|
};
|
|
17
|
-
|
|
18
|
-
[id: string]: string
|
|
19
|
-
};
|
|
20
|
-
remoteSelectedElementIds: {
|
|
21
|
-
[elementId: string]: string[];
|
|
26
|
+
remotePointerUserStates: {
|
|
27
|
+
[id: string]: string;
|
|
22
28
|
};
|
|
23
29
|
remotePointerUsernames: {
|
|
24
30
|
[id: string]: string;
|
|
25
31
|
};
|
|
26
|
-
|
|
27
|
-
[id: string]: string;
|
|
32
|
+
remotePointerButton?: {
|
|
33
|
+
[id: string]: string | undefined;
|
|
28
34
|
};
|
|
29
|
-
imageCache: AppClassProperties["imageCache"];
|
|
30
|
-
renderScrollbars?: boolean;
|
|
31
|
-
renderSelection?: boolean;
|
|
32
|
-
renderGrid?: boolean;
|
|
33
|
-
/** when exporting the behavior is slightly different (e.g. we can't use
|
|
34
|
-
CSS filters), and we disable render optimizations for best output */
|
|
35
|
-
isExporting: boolean;
|
|
36
35
|
selectionColor?: string;
|
|
36
|
+
renderScrollbars?: boolean;
|
|
37
|
+
};
|
|
38
|
+
export type RenderInteractiveSceneCallback = {
|
|
39
|
+
atLeastOneVisibleElement: boolean;
|
|
40
|
+
elements: readonly NonDeletedExcalidrawElement[];
|
|
41
|
+
scrollBars?: ScrollBars;
|
|
37
42
|
};
|
|
38
|
-
export
|
|
43
|
+
export type StaticSceneRenderConfig = {
|
|
44
|
+
canvas: HTMLCanvasElement;
|
|
45
|
+
rc: RoughCanvas;
|
|
46
|
+
elements: readonly NonDeletedExcalidrawElement[];
|
|
47
|
+
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
48
|
+
/**
|
|
49
|
+
* canvas scale factor. Not related to zoom. In browsers, it's the
|
|
50
|
+
* devicePixelRatio. For export, it's the `appState.exportScale`
|
|
51
|
+
* (user setting) or whatever scale you want to use when exporting elsewhere.
|
|
52
|
+
*
|
|
53
|
+
* Bigger the scale, the more pixels (=quality).
|
|
54
|
+
*/
|
|
55
|
+
scale: number;
|
|
56
|
+
appState: StaticCanvasAppState;
|
|
57
|
+
renderConfig: StaticCanvasRenderConfig;
|
|
58
|
+
};
|
|
59
|
+
export type InteractiveSceneRenderConfig = {
|
|
60
|
+
canvas: HTMLCanvasElement | null;
|
|
61
|
+
elements: readonly NonDeletedExcalidrawElement[];
|
|
62
|
+
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
63
|
+
selectedElements: readonly NonDeletedExcalidrawElement[];
|
|
64
|
+
scale: number;
|
|
65
|
+
appState: InteractiveCanvasAppState;
|
|
66
|
+
renderConfig: InteractiveCanvasRenderConfig;
|
|
67
|
+
callback: (data: RenderInteractiveSceneCallback) => void;
|
|
68
|
+
};
|
|
69
|
+
export type SceneScroll = {
|
|
39
70
|
scrollX: number;
|
|
40
71
|
scrollY: number;
|
|
41
72
|
};
|
|
42
73
|
export interface Scene {
|
|
43
74
|
elements: ExcalidrawTextElement[];
|
|
44
75
|
}
|
|
45
|
-
export
|
|
46
|
-
export
|
|
76
|
+
export type ExportType = "png" | "clipboard" | "clipboard-svg" | "backend" | "svg";
|
|
77
|
+
export type ScrollBars = {
|
|
47
78
|
horizontal: {
|
|
48
79
|
x: number;
|
|
49
80
|
y: number;
|
|
@@ -57,3 +88,16 @@ export declare type ScrollBars = {
|
|
|
57
88
|
height: number;
|
|
58
89
|
} | null;
|
|
59
90
|
};
|
|
91
|
+
export type ElementShape = Drawable | Drawable[] | null;
|
|
92
|
+
export type ElementShapes = {
|
|
93
|
+
rectangle: Drawable;
|
|
94
|
+
ellipse: Drawable;
|
|
95
|
+
diamond: Drawable;
|
|
96
|
+
embeddable: Drawable;
|
|
97
|
+
freedraw: Drawable | null;
|
|
98
|
+
arrow: Drawable[];
|
|
99
|
+
line: Drawable[];
|
|
100
|
+
text: null;
|
|
101
|
+
image: null;
|
|
102
|
+
frame: null;
|
|
103
|
+
};
|