@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,7 +1,7 @@
|
|
|
1
|
-
import { Point } from "../types";
|
|
2
|
-
import { FONT_FAMILY, ROUNDNESS, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
|
|
3
|
-
import { MakeBrand, MarkNonNullable, ValueOf } from "../utility-types";
|
|
4
|
-
import { MagicCacheData } from "../data/magic";
|
|
1
|
+
import type { Point } from "../types";
|
|
2
|
+
import type { FONT_FAMILY, ROUNDNESS, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
|
|
3
|
+
import type { MakeBrand, MarkNonNullable, ValueOf } from "../utility-types";
|
|
4
|
+
import type { MagicCacheData } from "../data/magic";
|
|
5
5
|
export type ChartType = "bar" | "line";
|
|
6
6
|
export type FillStyle = "hachure" | "cross-hatch" | "solid" | "zigzag";
|
|
7
7
|
export type FontFamilyKeys = keyof typeof FONT_FAMILY;
|
|
@@ -18,6 +18,13 @@ export type StrokeStyle = "solid" | "dashed" | "dotted";
|
|
|
18
18
|
export type TextAlign = typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
|
|
19
19
|
type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
|
|
20
20
|
export type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
|
|
21
|
+
export type FractionalIndex = string & {
|
|
22
|
+
_brand: "franctionalIndex";
|
|
23
|
+
};
|
|
24
|
+
export type BoundElement = Readonly<{
|
|
25
|
+
id: ExcalidrawLinearElement["id"];
|
|
26
|
+
type: "arrow" | "text";
|
|
27
|
+
}>;
|
|
21
28
|
type _ExcalidrawElementBase = Readonly<{
|
|
22
29
|
id: string;
|
|
23
30
|
x: number;
|
|
@@ -46,16 +53,18 @@ type _ExcalidrawElementBase = Readonly<{
|
|
|
46
53
|
Used for deterministic reconciliation of updates during collaboration,
|
|
47
54
|
in case the versions (see above) are identical. */
|
|
48
55
|
versionNonce: number;
|
|
56
|
+
/** String in a fractional form defined by https://github.com/rocicorp/fractional-indexing.
|
|
57
|
+
Used for ordering in multiplayer scenarios, such as during reconciliation or undo / redo.
|
|
58
|
+
Always kept in sync with the array order by `syncMovedIndices` and `syncInvalidIndices`.
|
|
59
|
+
Could be null, i.e. for new elements which were not yet assigned to the scene. */
|
|
60
|
+
index: FractionalIndex | null;
|
|
49
61
|
isDeleted: boolean;
|
|
50
62
|
/** List of groups the element belongs to.
|
|
51
63
|
Ordered from deepest to shallowest. */
|
|
52
64
|
groupIds: readonly GroupId[];
|
|
53
65
|
frameId: string | null;
|
|
54
66
|
/** other elements that are bound to this element */
|
|
55
|
-
boundElements: readonly
|
|
56
|
-
id: ExcalidrawLinearElement["id"];
|
|
57
|
-
type: "arrow" | "text";
|
|
58
|
-
}>[] | null;
|
|
67
|
+
boundElements: readonly BoundElement[] | null;
|
|
59
68
|
/** epoch (ms) timestamp of last element update */
|
|
60
69
|
updated: number;
|
|
61
70
|
link: string | null;
|
|
@@ -92,6 +101,9 @@ export type IframeData = ({
|
|
|
92
101
|
h: number;
|
|
93
102
|
};
|
|
94
103
|
error?: Error;
|
|
104
|
+
sandbox?: {
|
|
105
|
+
allowSameOrigin?: boolean;
|
|
106
|
+
};
|
|
95
107
|
} & ({
|
|
96
108
|
type: "video" | "generic";
|
|
97
109
|
link: string;
|
|
@@ -127,6 +139,10 @@ export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRe
|
|
|
127
139
|
* between peers and contain no state local to the peer.
|
|
128
140
|
*/
|
|
129
141
|
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
|
|
142
|
+
export type Ordered<TElement extends ExcalidrawElement> = TElement & {
|
|
143
|
+
index: FractionalIndex;
|
|
144
|
+
};
|
|
145
|
+
export type OrderedExcalidrawElement = Ordered<ExcalidrawElement>;
|
|
130
146
|
export type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
|
|
131
147
|
isDeleted: boolean;
|
|
132
148
|
};
|
|
@@ -141,6 +157,13 @@ export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
|
141
157
|
verticalAlign: VerticalAlign;
|
|
142
158
|
containerId: ExcalidrawGenericElement["id"] | null;
|
|
143
159
|
originalText: string;
|
|
160
|
+
/**
|
|
161
|
+
* If `true` the width will fit the text. If `false`, the text will
|
|
162
|
+
* wrap to fit the width.
|
|
163
|
+
*
|
|
164
|
+
* @default true
|
|
165
|
+
*/
|
|
166
|
+
autoResize: boolean;
|
|
144
167
|
/**
|
|
145
168
|
* Unitless line height (aligned to W3C). To get line height in px, multiply
|
|
146
169
|
* with font size (using `getLineHeightInPx` helper).
|
|
@@ -198,11 +221,11 @@ export type NonDeletedElementsMap = Map<ExcalidrawElement["id"], NonDeletedExcal
|
|
|
198
221
|
* Map of all excalidraw Scene elements, including deleted.
|
|
199
222
|
* Not a subset. Use this type when you need access to current Scene elements.
|
|
200
223
|
*/
|
|
201
|
-
export type SceneElementsMap = Map<ExcalidrawElement["id"], ExcalidrawElement
|
|
224
|
+
export type SceneElementsMap = Map<ExcalidrawElement["id"], Ordered<ExcalidrawElement>> & MakeBrand<"SceneElementsMap">;
|
|
202
225
|
/**
|
|
203
226
|
* Map of all non-deleted Scene elements.
|
|
204
227
|
* Not a subset. Use this type when you need access to current Scene elements.
|
|
205
228
|
*/
|
|
206
|
-
export type NonDeletedSceneElementsMap = Map<ExcalidrawElement["id"], NonDeletedExcalidrawElement
|
|
229
|
+
export type NonDeletedSceneElementsMap = Map<ExcalidrawElement["id"], Ordered<NonDeletedExcalidrawElement>> & MakeBrand<"NonDeletedSceneElementsMap">;
|
|
207
230
|
export type ElementsMapOrArray = readonly ExcalidrawElement[] | Readonly<ElementsMap>;
|
|
208
231
|
export {};
|
|
@@ -10,4 +10,7 @@ export declare class ImageSceneDataError extends Error {
|
|
|
10
10
|
code: ImageSceneDataErrorCode;
|
|
11
11
|
constructor(message?: string, code?: ImageSceneDataErrorCode);
|
|
12
12
|
}
|
|
13
|
+
export declare class InvalidFractionalIndexError extends Error {
|
|
14
|
+
code: "ELEMENT_HAS_INVALID_INDEX";
|
|
15
|
+
}
|
|
13
16
|
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ExcalidrawElement, OrderedExcalidrawElement } from "./element/types";
|
|
2
|
+
/**
|
|
3
|
+
* Envisioned relation between array order and fractional indices:
|
|
4
|
+
*
|
|
5
|
+
* 1) Array (or array-like ordered data structure) should be used as a cache of elements order, hiding the internal fractional indices implementation.
|
|
6
|
+
* - it's undesirable to to perform reorder for each related operation, thefeore it's necessary to cache the order defined by fractional indices into an ordered data structure
|
|
7
|
+
* - it's easy enough to define the order of the elements from the outside (boundaries), without worrying about the underlying structure of fractional indices (especially for the host apps)
|
|
8
|
+
* - it's necessary to always keep the array support for backwards compatibility (restore) - old scenes, old libraries, supporting multiple excalidraw versions etc.
|
|
9
|
+
* - it's necessary to always keep the fractional indices in sync with the array order
|
|
10
|
+
* - elements with invalid indices should be detected and synced, without altering the already valid indices
|
|
11
|
+
*
|
|
12
|
+
* 2) Fractional indices should be used to reorder the elements, whenever the cached order is expected to be invalidated.
|
|
13
|
+
* - as the fractional indices are encoded as part of the elements, it opens up possibilties for incremental-like APIs
|
|
14
|
+
* - re-order based on fractional indices should be part of (multiplayer) operations such as reconcillitation & undo/redo
|
|
15
|
+
* - technically all the z-index actions could perform also re-order based on fractional indices,but in current state it would not bring much benefits,
|
|
16
|
+
* as it's faster & more efficient to perform re-order based on array manipulation and later synchronisation of moved indices with the array order
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Ensure that all elements have valid fractional indices.
|
|
20
|
+
*
|
|
21
|
+
* @throws `InvalidFractionalIndexError` if invalid index is detected.
|
|
22
|
+
*/
|
|
23
|
+
export declare const validateFractionalIndices: (indices: (ExcalidrawElement["index"] | undefined)[]) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Order the elements based on the fractional indices.
|
|
26
|
+
* - when fractional indices are identical, break the tie based on the element id
|
|
27
|
+
* - when there is no fractional index in one of the elements, respect the order of the array
|
|
28
|
+
*/
|
|
29
|
+
export declare const orderByFractionalIndex: (elements: OrderedExcalidrawElement[]) => OrderedExcalidrawElement[];
|
|
30
|
+
/**
|
|
31
|
+
* Synchronizes invalid fractional indices of moved elements with the array order by mutating passed elements.
|
|
32
|
+
* If the synchronization fails or the result is invalid, it fallbacks to `syncInvalidIndices`.
|
|
33
|
+
*/
|
|
34
|
+
export declare const syncMovedIndices: (elements: readonly ExcalidrawElement[], movedElements: Map<string, ExcalidrawElement>) => OrderedExcalidrawElement[];
|
|
35
|
+
/**
|
|
36
|
+
* Synchronizes all invalid fractional indices with the array order by mutating passed elements.
|
|
37
|
+
*
|
|
38
|
+
* WARN: in edge cases it could modify the elements which were not moved, as it's impossible to guess the actually moved elements from the elements array itself.
|
|
39
|
+
*/
|
|
40
|
+
export declare const syncInvalidIndices: (elements: readonly ExcalidrawElement[]) => OrderedExcalidrawElement[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
-
import { AppClassProperties, AppState, StaticCanvasAppState } from "./types";
|
|
1
|
+
import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
+
import type { AppClassProperties, AppState, StaticCanvasAppState } from "./types";
|
|
3
3
|
import type { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
|
|
4
|
-
import { ReadonlySetLike } from "./utility-types";
|
|
5
|
-
export declare const bindElementsToFramesAfterDuplication: (nextElements: ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
4
|
+
import type { ReadonlySetLike } from "./utility-types";
|
|
5
|
+
export declare const bindElementsToFramesAfterDuplication: (nextElements: readonly ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
6
6
|
export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap): boolean;
|
|
7
7
|
export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => ExcalidrawElement[];
|
|
8
8
|
export declare const isElementContainingFrame: (elements: readonly ExcalidrawElement[], element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GroupId, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ElementsMapOrArray, ElementsMap } from "./element/types";
|
|
2
|
-
import { AppClassProperties, AppState, InteractiveCanvasAppState } from "./types";
|
|
3
|
-
import { Mutable } from "./utility-types";
|
|
1
|
+
import type { GroupId, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ElementsMapOrArray, ElementsMap } from "./element/types";
|
|
2
|
+
import type { AppClassProperties, AppState, InteractiveCanvasAppState } from "./types";
|
|
3
|
+
import type { Mutable } from "./utility-types";
|
|
4
4
|
export declare const selectGroup: (groupId: GroupId, appState: InteractiveCanvasAppState, elements: readonly NonDeleted<ExcalidrawElement>[]) => Pick<InteractiveCanvasAppState, "selectedGroupIds" | "selectedElementIds" | "editingGroupId">;
|
|
5
5
|
export declare const selectGroupsForSelectedElements: {
|
|
6
6
|
(appState: Pick<AppState, "selectedElementIds" | "editingGroupId">, elements: readonly NonDeletedExcalidrawElement[], prevAppState: InteractiveCanvasAppState, app: AppClassProperties | null): Mutable<Pick<InteractiveCanvasAppState, "selectedGroupIds" | "editingGroupId" | "selectedElementIds">>;
|
|
@@ -28,4 +28,6 @@ export declare const removeFromSelectedGroups: (groupIds: ExcalidrawElement["gro
|
|
|
28
28
|
[groupId: string]: boolean;
|
|
29
29
|
}) => string[];
|
|
30
30
|
export declare const getMaximumGroups: (elements: ExcalidrawElement[], elementsMap: ElementsMap) => ExcalidrawElement[][];
|
|
31
|
+
export declare const getNonDeletedGroupIds: (elements: ElementsMap) => Set<string>;
|
|
31
32
|
export declare const elementsAreInSameGroup: (elements: ExcalidrawElement[]) => boolean;
|
|
33
|
+
export declare const isInGroup: (element: NonDeletedExcalidrawElement) => boolean;
|
|
@@ -1,52 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { AppStateChange, ElementsChange } from "./change";
|
|
2
|
+
import type { SceneElementsMap } from "./element/types";
|
|
3
|
+
import { Emitter } from "./emitter";
|
|
4
|
+
import type { Snapshot } from "./store";
|
|
5
|
+
import type { AppState } from "./types";
|
|
6
|
+
export declare class HistoryChangedEvent {
|
|
7
|
+
readonly isUndoStackEmpty: boolean;
|
|
8
|
+
readonly isRedoStackEmpty: boolean;
|
|
9
|
+
constructor(isUndoStackEmpty?: boolean, isRedoStackEmpty?: boolean);
|
|
6
10
|
}
|
|
7
|
-
declare
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
viewBackgroundColor: string;
|
|
15
|
-
editingLinearElement: import("./element/linearElementEditor").LinearElementEditor | null;
|
|
16
|
-
editingGroupId: string | null;
|
|
17
|
-
name: string | null;
|
|
18
|
-
};
|
|
19
|
-
declare class History {
|
|
20
|
-
private elementCache;
|
|
21
|
-
private recording;
|
|
22
|
-
private stateHistory;
|
|
23
|
-
private redoStack;
|
|
24
|
-
private lastEntry;
|
|
25
|
-
private hydrateHistoryEntry;
|
|
26
|
-
private dehydrateHistoryEntry;
|
|
27
|
-
getSnapshotForTest(): {
|
|
28
|
-
recording: boolean;
|
|
29
|
-
stateHistory: HistoryEntry[];
|
|
30
|
-
redoStack: HistoryEntry[];
|
|
31
|
-
};
|
|
11
|
+
export declare class History {
|
|
12
|
+
readonly onHistoryChangedEmitter: Emitter<[HistoryChangedEvent]>;
|
|
13
|
+
private readonly undoStack;
|
|
14
|
+
private readonly redoStack;
|
|
15
|
+
get isUndoStackEmpty(): boolean;
|
|
16
|
+
get isRedoStackEmpty(): boolean;
|
|
32
17
|
clear(): void;
|
|
33
|
-
private generateEntry;
|
|
34
|
-
shouldCreateEntry(nextEntry: HistoryEntry): boolean;
|
|
35
|
-
pushEntry(appState: AppState, elements: readonly ExcalidrawElement[]): void;
|
|
36
|
-
clearRedoStack(): void;
|
|
37
|
-
redoOnce(): HistoryEntry | null;
|
|
38
|
-
undoOnce(): HistoryEntry | null;
|
|
39
18
|
/**
|
|
40
|
-
*
|
|
41
|
-
* when doing undo/redo which itself doesn't commit to history, but updates
|
|
42
|
-
* app state in a way that would break `shouldCreateEntry` which relies on
|
|
43
|
-
* `lastEntry` to reflect last comittable history state.
|
|
44
|
-
* We can't update `lastEntry` from within history when calling undo/redo
|
|
45
|
-
* because the action potentially mutates appState/elements before storing
|
|
46
|
-
* it.
|
|
19
|
+
* Record a local change which will go into the history
|
|
47
20
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
21
|
+
record(elementsChange: ElementsChange, appStateChange: AppStateChange): void;
|
|
22
|
+
undo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): void | [SceneElementsMap, AppState];
|
|
23
|
+
redo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): void | [SceneElementsMap, AppState];
|
|
24
|
+
private perform;
|
|
25
|
+
private static pop;
|
|
26
|
+
private static push;
|
|
27
|
+
}
|
|
28
|
+
export declare class HistoryEntry {
|
|
29
|
+
readonly appStateChange: AppStateChange;
|
|
30
|
+
readonly elementsChange: ElementsChange;
|
|
31
|
+
private constructor();
|
|
32
|
+
static create(appStateChange: AppStateChange, elementsChange: ElementsChange): HistoryEntry;
|
|
33
|
+
inverse(): HistoryEntry;
|
|
34
|
+
applyTo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): [SceneElementsMap, AppState, boolean];
|
|
35
|
+
/**
|
|
36
|
+
* Apply latest (remote) changes to the history entry, creates new instance of `HistoryEntry`.
|
|
37
|
+
*/
|
|
38
|
+
applyLatestChanges(elements: SceneElementsMap): HistoryEntry;
|
|
39
|
+
isEmpty(): boolean;
|
|
51
40
|
}
|
|
52
|
-
export default History;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import "./css/app.scss";
|
|
3
3
|
import "./css/styles.scss";
|
|
4
4
|
import "../../public/fonts/fonts.css";
|
|
5
|
-
import { ExcalidrawProps } from "./types";
|
|
5
|
+
import type { ExcalidrawProps } from "./types";
|
|
6
6
|
import Footer from "./components/footer/FooterCenter";
|
|
7
7
|
import MainMenu from "./components/main-menu/MainMenu";
|
|
8
8
|
import WelcomeScreen from "./components/welcome-screen/WelcomeScreen";
|
|
@@ -11,6 +11,7 @@ export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawPro
|
|
|
11
11
|
export { getSceneVersion, hashElementsVersion, hashString, isInvisiblySmallElement, getNonDeletedElements, } from "./element";
|
|
12
12
|
export { defaultLang, useI18n, languages } from "./i18n";
|
|
13
13
|
export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "./data/restore";
|
|
14
|
+
export { reconcileElements } from "./data/reconcile";
|
|
14
15
|
export { exportToCanvas, exportToBlob, exportToSvg, exportToClipboard, getCommonBoundingBox, //zsviczian
|
|
15
16
|
getMaximumGroups, //zsviczian
|
|
16
17
|
intersectElementWithLine, //zsviczian
|
|
@@ -21,6 +22,8 @@ wrapText, //zsviczian
|
|
|
21
22
|
getFontString, //zsviczian
|
|
22
23
|
getBoundTextMaxWidth, //zsviczian
|
|
23
24
|
mermaidToExcalidraw, } from "../utils/export";
|
|
25
|
+
export { refreshTextDimensions, } from "./element/newElement";
|
|
26
|
+
export { getContainerElement, } from "./element/textElement";
|
|
24
27
|
export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
|
|
25
28
|
export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "./data/blob";
|
|
26
29
|
export { getFreeDrawSvgPath } from "./renderer/renderElement";
|
|
@@ -28,6 +31,7 @@ export { mergeLibraryItems, getLibraryItemsHash } from "./data/library";
|
|
|
28
31
|
export { isLinearElement } from "./element/typeChecks";
|
|
29
32
|
export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, } from "./constants";
|
|
30
33
|
export { mutateElement, newElementWith, bumpVersion, } from "./element/mutateElement";
|
|
34
|
+
export { StoreAction } from "./store";
|
|
31
35
|
export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
|
|
32
36
|
export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "./utils";
|
|
33
37
|
export { getEmbedLink } from "./element/embeddable";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Trail } from "./animated-trail";
|
|
2
|
+
import { AnimatedTrail } from "./animated-trail";
|
|
3
|
+
import type { AnimationFrameHandler } from "./animation-frame-handler";
|
|
3
4
|
import type App from "./components/App";
|
|
4
5
|
export declare class LaserTrails implements Trail {
|
|
5
6
|
private animationFrameHandler;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Point, Zoom } from "./types";
|
|
2
|
-
import { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted } from "./element/types";
|
|
1
|
+
import type { Point, Zoom } from "./types";
|
|
2
|
+
import type { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted } from "./element/types";
|
|
3
3
|
export declare const rotate: (x: number, y: number, cx: number, cy: number, angle: number) => [number, number];
|
|
4
4
|
export declare const rotatePoint: (point: readonly [number, number], center: readonly [number, number], angle: number) => [number, number];
|
|
5
5
|
export declare const adjustXYWithRotation: (sides: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StaticCanvasAppState, AppState } from "../types";
|
|
2
|
-
import { StaticCanvasRenderConfig } from "../scene/types";
|
|
1
|
+
import type { StaticCanvasAppState, AppState } from "../types";
|
|
2
|
+
import type { StaticCanvasRenderConfig } from "../scene/types";
|
|
3
3
|
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke?: boolean) => void;
|
|
4
4
|
export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
|
|
5
5
|
export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InteractiveSceneRenderConfig, RenderableElementsMap } from "../scene/types";
|
|
1
|
+
import type { InteractiveSceneRenderConfig, RenderableElementsMap } from "../scene/types";
|
|
2
2
|
/** throttled to animation framerate */
|
|
3
3
|
export declare const renderInteractiveSceneThrottled: {
|
|
4
4
|
(config: InteractiveSceneRenderConfig): void;
|
|
@@ -9,7 +9,7 @@ export declare const renderInteractiveSceneThrottled: {
|
|
|
9
9
|
* Interactive scene is the ui-canvas where we render bounding boxes, selections
|
|
10
10
|
* and other ui stuff.
|
|
11
11
|
*/
|
|
12
|
-
export declare const renderInteractiveScene: <U extends ({ canvas, elementsMap, visibleElements, selectedElements, scale, appState, renderConfig, }: InteractiveSceneRenderConfig) => {
|
|
12
|
+
export declare const renderInteractiveScene: <U extends ({ canvas, elementsMap, visibleElements, selectedElements, scale, appState, renderConfig, device, }: InteractiveSceneRenderConfig) => {
|
|
13
13
|
atLeastOneVisibleElement: boolean;
|
|
14
14
|
elementsMap: RenderableElementsMap;
|
|
15
15
|
scrollBars?: undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawFrameLikeElement, NonDeletedSceneElementsMap } from "../element/types";
|
|
1
|
+
import type { ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawFrameLikeElement, NonDeletedSceneElementsMap } from "../element/types";
|
|
2
2
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
3
|
-
import { StaticCanvasRenderConfig, RenderableElementsMap } from "../scene/types";
|
|
4
|
-
import { AppState, StaticCanvasAppState, InteractiveCanvasAppState, ElementsPendingErasure } from "../types";
|
|
3
|
+
import type { StaticCanvasRenderConfig, RenderableElementsMap } from "../scene/types";
|
|
4
|
+
import type { AppState, StaticCanvasAppState, InteractiveCanvasAppState, ElementsPendingErasure } from "../types";
|
|
5
5
|
export declare const IMAGE_INVERT_FILTER = "invert(100%) hue-rotate(180deg) saturate(1.25)";
|
|
6
6
|
export declare const getRenderOpacity: (element: ExcalidrawElement, containingFrame: ExcalidrawFrameLikeElement | null, elementsPendingErasure: ElementsPendingErasure) => number;
|
|
7
7
|
export interface ExcalidrawElementWithCanvas {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { InteractiveCanvasAppState } from "../types";
|
|
1
|
+
import type { InteractiveCanvasAppState } from "../types";
|
|
2
2
|
export declare const renderSnaps: (context: CanvasRenderingContext2D, appState: InteractiveCanvasAppState) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RoughSVG } from "roughjs/bin/svg";
|
|
2
|
-
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
3
|
-
import { RenderableElementsMap, SVGRenderConfig } from "../scene/types";
|
|
4
|
-
import { BinaryFiles } from "../types";
|
|
1
|
+
import type { RoughSVG } from "roughjs/bin/svg";
|
|
2
|
+
import type { NonDeletedExcalidrawElement } from "../element/types";
|
|
3
|
+
import type { RenderableElementsMap, SVGRenderConfig } from "../scene/types";
|
|
4
|
+
import type { BinaryFiles } from "../types";
|
|
5
5
|
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], elementsMap: RenderableElementsMap, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, renderConfig: SVGRenderConfig) => void;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { ExcalidrawElement } from "../element/types";
|
|
1
|
+
import type { ExcalidrawElement } from "../element/types";
|
|
2
2
|
import type Scene from "./Scene";
|
|
3
3
|
export declare class Fonts {
|
|
4
4
|
private scene;
|
|
5
|
-
|
|
6
|
-
constructor({ scene, onSceneUpdated, }: {
|
|
5
|
+
constructor({ scene }: {
|
|
7
6
|
scene: Scene;
|
|
8
|
-
onSceneUpdated: () => void;
|
|
9
7
|
});
|
|
10
8
|
private static loadedFontFaces;
|
|
11
9
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState } from "../types";
|
|
3
|
-
import Scene from "./Scene";
|
|
1
|
+
import type { NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
+
import type { AppState } from "../types";
|
|
3
|
+
import type Scene from "./Scene";
|
|
4
4
|
export declare class Renderer {
|
|
5
5
|
private scene;
|
|
6
6
|
constructor(scene: Scene);
|
|
@@ -14,7 +14,7 @@ export declare class Renderer {
|
|
|
14
14
|
width: AppState["width"];
|
|
15
15
|
editingElement: AppState["editingElement"];
|
|
16
16
|
pendingImageElementId: AppState["pendingImageElementId"];
|
|
17
|
-
|
|
17
|
+
sceneNonce: ReturnType<InstanceType<typeof Scene>["getSceneNonce"]>;
|
|
18
18
|
}) => {
|
|
19
19
|
elementsMap: Map<string, NonDeletedExcalidrawElement> & import("../utility-types").MakeBrand<"NonDeletedElementsMap"> & import("../utility-types").MakeBrand<"RenderableElementsMap">;
|
|
20
20
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameLikeElement, ElementsMapOrArray } from "../element/types";
|
|
2
|
-
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
3
|
-
import { AppState } from "../types";
|
|
1
|
+
import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameLikeElement, ElementsMapOrArray, OrderedExcalidrawElement, Ordered } from "../element/types";
|
|
2
|
+
import type { LinearElementEditor } from "../element/linearElementEditor";
|
|
3
|
+
import type { AppState } from "../types";
|
|
4
4
|
type ElementIdKey = InstanceType<typeof LinearElementEditor>["elementId"];
|
|
5
5
|
type ElementKey = ExcalidrawElement | ElementIdKey;
|
|
6
6
|
type SceneStateCallback = () => void;
|
|
@@ -19,11 +19,18 @@ declare class Scene {
|
|
|
19
19
|
private frames;
|
|
20
20
|
private elementsMap;
|
|
21
21
|
private selectedElementsCache;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Random integer regenerated each scene update.
|
|
24
|
+
*
|
|
25
|
+
* Does not relate to elements versions, it's only a renderer
|
|
26
|
+
* cache-invalidation nonce at the moment.
|
|
27
|
+
*/
|
|
28
|
+
private sceneNonce;
|
|
29
|
+
getSceneNonce(): number | undefined;
|
|
30
|
+
getNonDeletedElementsMap(): Map<string, Ordered<NonDeletedExcalidrawElement>> & import("../utility-types").MakeBrand<"NonDeletedSceneElementsMap">;
|
|
31
|
+
getElementsIncludingDeleted(): readonly OrderedExcalidrawElement[];
|
|
32
|
+
getElementsMapIncludingDeleted(): Map<string, Ordered<ExcalidrawElement>> & import("../utility-types").MakeBrand<"SceneElementsMap">;
|
|
33
|
+
getNonDeletedElements(): readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
27
34
|
getFramesIncludingDeleted(): readonly ExcalidrawFrameLikeElement[];
|
|
28
35
|
getSelectedElements(opts: {
|
|
29
36
|
selectedElementIds: AppState["selectedElementIds"];
|
|
@@ -38,7 +45,6 @@ declare class Scene {
|
|
|
38
45
|
}): NonDeleted<ExcalidrawElement>[];
|
|
39
46
|
getNonDeletedFramesLikes(): readonly NonDeleted<ExcalidrawFrameLikeElement>[];
|
|
40
47
|
getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
|
|
41
|
-
getVersionNonce(): number | undefined;
|
|
42
48
|
getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
|
|
43
49
|
/**
|
|
44
50
|
* A utility method to help with updating all scene elements, with the added
|
|
@@ -54,12 +60,13 @@ declare class Scene {
|
|
|
54
60
|
*/
|
|
55
61
|
mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
|
|
56
62
|
replaceAllElements(nextElements: ElementsMapOrArray): void;
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
triggerUpdate(): void;
|
|
64
|
+
onUpdate(cb: SceneStateCallback): SceneStateCallbackRemover;
|
|
59
65
|
destroy(): void;
|
|
60
66
|
insertElementAtIndex(element: ExcalidrawElement, index: number): void;
|
|
61
67
|
insertElementsAtIndex(elements: ExcalidrawElement[], index: number): void;
|
|
62
|
-
|
|
68
|
+
insertElement: (element: ExcalidrawElement, idx?: number) => void;
|
|
69
|
+
insertElements: (elements: ExcalidrawElement[]) => void;
|
|
63
70
|
getElementIndex(elementId: string): number;
|
|
64
71
|
getContainerElement: (element: (ExcalidrawElement & {
|
|
65
72
|
containerId: ExcalidrawElement["id"] | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Drawable, Options } from "roughjs/bin/core";
|
|
2
2
|
import type { RoughGenerator } from "roughjs/bin/generator";
|
|
3
3
|
import type { ExcalidrawElement, NonDeletedExcalidrawElement, ExcalidrawSelectionElement } from "../element/types";
|
|
4
|
-
import { EmbedsValidationStatus } from "../types";
|
|
4
|
+
import type { EmbedsValidationStatus } from "../types";
|
|
5
5
|
export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
|
|
6
6
|
/**
|
|
7
7
|
* Generates the roughjs shape for given element.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Drawable } from "roughjs/bin/core";
|
|
2
|
-
import { ExcalidrawElement } from "../element/types";
|
|
3
|
-
import { ElementShape, ElementShapes } from "./types";
|
|
4
|
-
import { AppState, EmbedsValidationStatus } from "../types";
|
|
1
|
+
import type { Drawable } from "roughjs/bin/core";
|
|
2
|
+
import type { ExcalidrawElement } from "../element/types";
|
|
3
|
+
import type { ElementShape, ElementShapes } from "./types";
|
|
4
|
+
import type { AppState, EmbedsValidationStatus } from "../types";
|
|
5
5
|
export declare class ShapeCache {
|
|
6
6
|
private static rg;
|
|
7
7
|
private static cache;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
-
import { ElementOrToolType } from "../types";
|
|
1
|
+
import type { NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
+
import type { ElementOrToolType } from "../types";
|
|
3
3
|
export declare const hasBackground: (type: ElementOrToolType) => boolean;
|
|
4
4
|
export declare const hasStrokeColor: (type: ElementOrToolType) => boolean;
|
|
5
5
|
export declare const hasStrokeWidth: (type: ElementOrToolType) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState, BinaryFiles } from "../types";
|
|
1
|
+
import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
+
import type { AppState, BinaryFiles } from "../types";
|
|
3
3
|
export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, exportingFrame, }: {
|
|
4
4
|
exportBackground: boolean;
|
|
5
5
|
exportPadding?: number | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppState, PointerCoords, Zoom } from "../types";
|
|
2
|
-
import { ExcalidrawElement } from "../element/types";
|
|
1
|
+
import type { AppState, PointerCoords, Zoom } from "../types";
|
|
2
|
+
import type { ExcalidrawElement } from "../element/types";
|
|
3
3
|
export declare const centerScrollOn: ({ scenePoint, viewportDimensions, zoom, }: {
|
|
4
4
|
scenePoint: PointerCoords;
|
|
5
5
|
viewportDimensions: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InteractiveCanvasAppState } from "../types";
|
|
2
|
-
import { ScrollBars } from "./types";
|
|
3
|
-
import { ExcalidrawElement } from "../element/types";
|
|
1
|
+
import type { InteractiveCanvasAppState } from "../types";
|
|
2
|
+
import type { ScrollBars } from "./types";
|
|
3
|
+
import type { ExcalidrawElement } from "../element/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(128,128,128,0.3)";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ElementsMap, ElementsMapOrArray, ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState, InteractiveCanvasAppState } from "../types";
|
|
1
|
+
import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
+
import type { AppState, InteractiveCanvasAppState } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Frames and their containing elements are not to be selected at the same time.
|
|
5
5
|
* Given an array of selected elements, if there are frames and their containing elements
|