@excalidraw/math 0.18.0-143b5b6 → 0.18.0-1440f2d
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/types/common/src/constants.d.ts +1 -0
- package/dist/types/common/src/utils.d.ts +7 -1
- package/dist/types/element/src/align.d.ts +4 -1
- package/dist/types/element/src/binding.d.ts +62 -0
- package/dist/types/element/src/bounds.d.ts +10 -2
- package/dist/types/element/src/collision.d.ts +7 -0
- package/dist/types/element/src/cropElement.d.ts +36 -4
- package/dist/types/element/src/delta.d.ts +7 -1
- package/dist/types/element/src/distribute.d.ts +4 -1
- package/dist/types/element/src/dragElements.d.ts +8 -3
- package/dist/types/element/src/elbowArrow.d.ts +5 -0
- package/dist/types/element/src/embeddable.d.ts +2 -1
- package/dist/types/element/src/flowchart.d.ts +1 -7
- package/dist/types/element/src/frame.d.ts +19 -1
- package/dist/types/element/src/groups.d.ts +1 -6
- package/dist/types/element/src/image.d.ts +5 -2
- package/dist/types/element/src/index.d.ts +1 -0
- package/dist/types/element/src/linearElementEditor.d.ts +4 -1
- package/dist/types/element/src/listMarker.d.ts +7 -2
- package/dist/types/element/src/newElement.d.ts +3 -1
- package/dist/types/element/src/renderElement.d.ts +10 -0
- package/dist/types/element/src/renderEnvironment.d.ts +66 -0
- package/dist/types/element/src/resizeElements.d.ts +15 -5
- package/dist/types/element/src/selection.d.ts +1 -7
- package/dist/types/element/src/shape.d.ts +2 -0
- package/dist/types/element/src/stickyNote.d.ts +8 -0
- package/dist/types/element/src/textElement.d.ts +3 -2
- package/dist/types/element/src/textMeasurements.d.ts +15 -11
- package/dist/types/element/src/textWrapping.d.ts +3 -2
- package/dist/types/element/src/transform.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +47 -221
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +13 -9
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +2 -0
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -588
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +2 -1
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -0
- package/dist/types/excalidraw/actions/actionExport.d.ts +9 -7
- package/dist/types/excalidraw/actions/actionFrame.d.ts +44 -525
- package/dist/types/excalidraw/actions/actionGroup.d.ts +4 -2
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionLink.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionProperties.d.ts +2 -0
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +2 -1
- package/dist/types/excalidraw/actions/actionStyles.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +1 -0
- package/dist/types/excalidraw/actions/index.d.ts +2 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/appState.d.ts +8 -7
- package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -1
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +6 -5
- package/dist/types/excalidraw/charts/charts.line.d.ts +2 -1
- package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -1
- package/dist/types/excalidraw/charts/index.d.ts +2 -1
- package/dist/types/excalidraw/components/Actions.d.ts +9 -2
- package/dist/types/excalidraw/components/App.d.ts +23 -8
- package/dist/types/excalidraw/components/App.host.d.ts +102 -0
- package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
- package/dist/types/excalidraw/components/App.selectionTool.d.ts +42 -6
- package/dist/types/excalidraw/components/App.viewport.d.ts +23 -3
- package/dist/types/excalidraw/components/App.wheel.d.ts +6 -2
- package/dist/types/excalidraw/components/App.wrap.d.ts +31 -0
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -1
- package/dist/types/excalidraw/components/Minimap/Minimap.d.ts +15 -0
- package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
- package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
- package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
- package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
- package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +4 -1
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +14 -1
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +16 -0
- package/dist/types/excalidraw/components/Tooltip.d.ts +11 -1
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +1 -1
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +0 -1
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +13 -2
- package/dist/types/excalidraw/components/icons.d.ts +1 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -0
- package/dist/types/excalidraw/data/blob.d.ts +16 -14
- package/dist/types/excalidraw/data/index.d.ts +3 -3
- package/dist/types/excalidraw/data/json.d.ts +8 -7
- package/dist/types/excalidraw/fonts/Fonts.d.ts +9 -6
- package/dist/types/excalidraw/history.d.ts +10 -4
- package/dist/types/excalidraw/mermaid.d.ts +7 -0
- package/dist/types/excalidraw/reactUtils.d.ts +1 -1
- package/dist/types/excalidraw/renderer/animation.d.ts +11 -4
- package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +1 -1
- package/dist/types/excalidraw/scene/export.d.ts +343 -20
- package/dist/types/excalidraw/scene/types.d.ts +23 -1
- package/dist/types/excalidraw/types.d.ts +48 -1
- package/dist/types/excalidraw/viewport.d.ts +1 -0
- package/dist/types/utils/src/index.d.ts +3 -1
- package/package.json +2 -2
- package/dist/types/utils/src/export.d.ts +0 -36
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
|
|
3
3
|
import { LinearElementEditor, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
|
|
4
4
|
import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
|
|
5
|
-
import type { TransformHandleDirection } from "@excalidraw/element";
|
|
5
|
+
import type { RenderEnvironment, TransformHandleDirection } from "@excalidraw/element";
|
|
6
6
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
7
7
|
import { ActionManager } from "../actions/manager";
|
|
8
8
|
import { History } from "../history";
|
|
@@ -28,7 +28,10 @@ import { AppModifiers } from "./App.modifiers";
|
|
|
28
28
|
import { AppPan } from "./App.pan";
|
|
29
29
|
import { AppViewport } from "./App.viewport";
|
|
30
30
|
import { AppWheel } from "./App.wheel";
|
|
31
|
+
import { AppSelection } from "./App.selection";
|
|
31
32
|
import { AppSelectionTool } from "./App.selectionTool";
|
|
33
|
+
import { AppWrap } from "./App.wrap";
|
|
34
|
+
import { AppHost } from "./App.host";
|
|
32
35
|
import { CursorHints } from "./CursorHint";
|
|
33
36
|
import { type OnStateChange } from "./AppStateObserver";
|
|
34
37
|
import type { ExportedElements } from "../data";
|
|
@@ -94,6 +97,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
94
97
|
private zenModeTransitionTimer;
|
|
95
98
|
get ownerDocument(): Document;
|
|
96
99
|
get ownerWindow(): Window & typeof globalThis;
|
|
100
|
+
/**
|
|
101
|
+
* Everything binding this editor to the document/window it renders into
|
|
102
|
+
* (render environment, hyperlink tooltip ownership). Delegated to so the
|
|
103
|
+
* cross-document ownership rules live in one place.
|
|
104
|
+
*/
|
|
105
|
+
host: AppHost;
|
|
106
|
+
/** @see AppHost.renderEnvironment */
|
|
107
|
+
get renderEnvironment(): RenderEnvironment;
|
|
97
108
|
scene: Scene;
|
|
98
109
|
fonts: Fonts;
|
|
99
110
|
renderer: Renderer;
|
|
@@ -142,7 +153,9 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
142
153
|
text: AppText;
|
|
143
154
|
viewport: AppViewport;
|
|
144
155
|
wheel: AppWheel;
|
|
156
|
+
selection: AppSelection;
|
|
145
157
|
selectionTool: AppSelectionTool;
|
|
158
|
+
wrap: AppWrap;
|
|
146
159
|
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
147
160
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
148
161
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
@@ -162,11 +175,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
162
175
|
y: number;
|
|
163
176
|
} | null;
|
|
164
177
|
private lastCompletedCanvasClicks;
|
|
165
|
-
/** previous frame pointer coords */
|
|
166
|
-
previousPointerMoveCoords: {
|
|
167
|
-
x: number;
|
|
168
|
-
y: number;
|
|
169
|
-
} | null;
|
|
170
178
|
drawShape: AppDrawShape;
|
|
171
179
|
laserTrails: LaserTrails;
|
|
172
180
|
eraserTrail: EraserTrail;
|
|
@@ -227,6 +235,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
227
235
|
x: number;
|
|
228
236
|
y: number;
|
|
229
237
|
};
|
|
238
|
+
lastOffset: {
|
|
239
|
+
x: number;
|
|
240
|
+
y: number;
|
|
241
|
+
};
|
|
230
242
|
blockDragging: boolean;
|
|
231
243
|
};
|
|
232
244
|
eventListeners: {
|
|
@@ -293,6 +305,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
293
305
|
x: number;
|
|
294
306
|
y: number;
|
|
295
307
|
};
|
|
308
|
+
lastOffset: {
|
|
309
|
+
x: number;
|
|
310
|
+
y: number;
|
|
311
|
+
};
|
|
296
312
|
blockDragging: boolean;
|
|
297
313
|
};
|
|
298
314
|
eventListeners: {
|
|
@@ -610,7 +626,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
610
626
|
private onGestureStart;
|
|
611
627
|
private onGestureChange;
|
|
612
628
|
private onGestureEnd;
|
|
613
|
-
deselectElements(): void;
|
|
614
629
|
getElementAtPosition(x: number, y: number, opts?: ({
|
|
615
630
|
includeBoundTextElement?: boolean;
|
|
616
631
|
includeLockedElements?: boolean;
|
|
@@ -678,7 +693,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
678
693
|
excludeElementIds?: AppState["selectedElementIds"];
|
|
679
694
|
currentFrameId?: ExcalidrawElement["frameId"];
|
|
680
695
|
}) => NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
681
|
-
|
|
696
|
+
updateFrameToHighlight: (frameToHighlight: AppState["frameToHighlight"]) => void;
|
|
682
697
|
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
683
698
|
insertNewElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
684
699
|
insertNewElement: (element: ExcalidrawElement) => void;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { RenderEnvironment } from "@excalidraw/element";
|
|
2
|
+
import { type EyeDropperProperties } from "./EyeDropper";
|
|
3
|
+
import { type HyperlinkTooltipOwner } from "./hyperlink/Hyperlink";
|
|
4
|
+
import type { AppProps } from "../types";
|
|
5
|
+
import type App from "./App";
|
|
6
|
+
/**
|
|
7
|
+
* Owns everything that ties this editor to the document/window it renders
|
|
8
|
+
* into (cross-document runtime ownership): the render environment the
|
|
9
|
+
* canvases, images and paths are minted from, and the state that has to be
|
|
10
|
+
* re-primed whenever that environment is swapped.
|
|
11
|
+
*/
|
|
12
|
+
export declare class AppHost {
|
|
13
|
+
private app;
|
|
14
|
+
constructor(app: App);
|
|
15
|
+
/**
|
|
16
|
+
* Identity token for the hyperlink tooltip, which is a module-level
|
|
17
|
+
* singleton shared by every editor in the process — the owner tells it
|
|
18
|
+
* which editor the currently shown tooltip belongs to, so one editor never
|
|
19
|
+
* hides (or leaks a timer into) another's tooltip.
|
|
20
|
+
*/
|
|
21
|
+
readonly hyperlinkTooltipOwner: HyperlinkTooltipOwner;
|
|
22
|
+
/**
|
|
23
|
+
* The process-wide interaction slots this editor currently owns: the
|
|
24
|
+
* pointerup handler of the interaction in flight, and the eye dropper (one
|
|
25
|
+
* atom in the editor-wide store). Both hold closures over this editor, so a
|
|
26
|
+
* teardown that leaves one set retains the editor -- and with it its owner
|
|
27
|
+
* window and document, e.g. a closed popout.
|
|
28
|
+
*
|
|
29
|
+
* @see releaseOwnedInteractionState
|
|
30
|
+
*/
|
|
31
|
+
private ownedPointerUp;
|
|
32
|
+
private ownedEyeDropper;
|
|
33
|
+
/** Takes over the pointerup slot (or clears it, on `null`). */
|
|
34
|
+
setPointerUp(handler: (() => void) | null): void;
|
|
35
|
+
/**
|
|
36
|
+
* Runs the pending pointerup, whoever owns it -- pointerup does not always
|
|
37
|
+
* fire (the user tabs away), so interactions are settled manually.
|
|
38
|
+
*/
|
|
39
|
+
runPendingPointerUp(): void;
|
|
40
|
+
/** Opens the eye dropper (or closes it, on `null`), taking ownership. */
|
|
41
|
+
setActiveEyeDropper(eyeDropper: EyeDropperProperties | null): void;
|
|
42
|
+
/**
|
|
43
|
+
* Drops the ownership token without touching the atom -- for callers that
|
|
44
|
+
* have just closed the eye dropper themselves.
|
|
45
|
+
*/
|
|
46
|
+
releaseEyeDropperOwnership(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Releases the process-wide slots this editor owns, so nothing outside it
|
|
49
|
+
* keeps it alive once it is torn down. Ownership-checked: a sibling
|
|
50
|
+
* editor's in-flight interaction must survive our teardown.
|
|
51
|
+
*/
|
|
52
|
+
private releaseOwnedInteractionState;
|
|
53
|
+
/**
|
|
54
|
+
* Render environment scoped to this editor's owner window, so that the
|
|
55
|
+
* canvases, images and paths created during rendering live in the owner
|
|
56
|
+
* document. Memoized keyed on the resolved document because render caches
|
|
57
|
+
* are keyed by environment identity: the identity must not survive a
|
|
58
|
+
* document switch, or caches would mix canvases and images from two realms
|
|
59
|
+
* under one bucket.
|
|
60
|
+
*/
|
|
61
|
+
private _renderEnvironment;
|
|
62
|
+
private _renderEnvironmentDocument;
|
|
63
|
+
get renderEnvironment(): RenderEnvironment;
|
|
64
|
+
/**
|
|
65
|
+
* Re-primes whatever the render environment owns. Called on mount and on
|
|
66
|
+
* every update, so an environment swap is picked up wherever it happens.
|
|
67
|
+
*/
|
|
68
|
+
sync(prevProps?: AppProps): void;
|
|
69
|
+
/**
|
|
70
|
+
* Releases what this editor owns outside itself, so we don't retain the
|
|
71
|
+
* (soon detached) document/window, or leave a pending tooltip timer around.
|
|
72
|
+
*/
|
|
73
|
+
destroy(): void;
|
|
74
|
+
private _destroyed;
|
|
75
|
+
/**
|
|
76
|
+
* Link icons decode asynchronously and the static scene skips an icon that
|
|
77
|
+
* is not decoded yet, so start the decode on mount rather than on the
|
|
78
|
+
* first render that happens to have a link, so the decode is settled long
|
|
79
|
+
* before there is a link element to draw an icon for.
|
|
80
|
+
*
|
|
81
|
+
* Re-run on an environment swap: the images are keyed by env identity, so
|
|
82
|
+
* a new environment starts with none.
|
|
83
|
+
*
|
|
84
|
+
* The decode landing only flips a status, which invalidates nothing, so the
|
|
85
|
+
* scene is nudged once when an icon becomes drawable -- otherwise a scene
|
|
86
|
+
* that paints before the decode settles and is then left alone (an initial
|
|
87
|
+
* scene with links, never scrolled or edited) keeps its icons missing until
|
|
88
|
+
* something unrelated repaints. Same shape as a font or an image file
|
|
89
|
+
* landing: repaint only when there is something new to draw.
|
|
90
|
+
*/
|
|
91
|
+
private _linkImgDecodingEnvironment;
|
|
92
|
+
private ensureLinkImgDecoding;
|
|
93
|
+
/**
|
|
94
|
+
* Every render cache is keyed by environment identity, so a host passing an
|
|
95
|
+
* inline `renderEnvironment` literal re-mints the identity on each render
|
|
96
|
+
* and re-rasterizes everything, with no visible symptom other than being
|
|
97
|
+
* slow. Detected by the factories' source being unchanged across the swap:
|
|
98
|
+
* a genuine environment switch (e.g. a document change) reads differently.
|
|
99
|
+
*/
|
|
100
|
+
private _warnedUnstableRenderEnvironment;
|
|
101
|
+
private warnOnUnstableRenderEnvironment;
|
|
102
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { LinearElementEditor } from "@excalidraw/element";
|
|
2
|
+
import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
3
|
+
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
4
|
+
import type { CaptureUpdateActionType } from "@excalidraw/element";
|
|
5
|
+
import type { AppClassProperties, AppState, InteractiveCanvasAppState } from "../types";
|
|
6
|
+
import type App from "./App";
|
|
7
|
+
export declare const selectGroupsForSelectedElements: {
|
|
8
|
+
(appState: Pick<AppState, "selectedElementIds" | "editingGroupId">, elements: readonly NonDeletedExcalidrawElement[], prevAppState: InteractiveCanvasAppState, app: AppClassProperties | null): Mutable<Pick<InteractiveCanvasAppState, "selectedGroupIds" | "editingGroupId" | "selectedElementIds">>;
|
|
9
|
+
clearCache(): void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The selection of the given elements alone, with their groups (within the
|
|
13
|
+
* edited group): a frame wins over its children, bound text is left to its
|
|
14
|
+
* container, and a lone line or arrow gets its line editor.
|
|
15
|
+
*
|
|
16
|
+
* @param allElements the (non-deleted) elements the selection is in
|
|
17
|
+
* @param deep select the elements themselves rather than their groups,
|
|
18
|
+
* editing their innermost group if they share it (and no group otherwise)
|
|
19
|
+
* — as Ctrl+click does
|
|
20
|
+
*/
|
|
21
|
+
export declare const getSelectionStateForElements: (targetElements: readonly NonDeletedExcalidrawElement[], allElements: readonly NonDeletedExcalidrawElement[], appState: AppState, deep?: boolean) => Mutable<Pick<Readonly<{
|
|
22
|
+
zoom: AppState["zoom"];
|
|
23
|
+
scrollX: AppState["scrollX"];
|
|
24
|
+
scrollY: AppState["scrollY"];
|
|
25
|
+
width: AppState["width"];
|
|
26
|
+
height: AppState["height"];
|
|
27
|
+
viewModeEnabled: AppState["viewModeEnabled"];
|
|
28
|
+
openDialog: AppState["openDialog"];
|
|
29
|
+
editingGroupId: AppState["editingGroupId"];
|
|
30
|
+
selectedElementIds: AppState["selectedElementIds"];
|
|
31
|
+
frameToHighlight: AppState["frameToHighlight"];
|
|
32
|
+
offsetLeft: AppState["offsetLeft"];
|
|
33
|
+
offsetTop: AppState["offsetTop"];
|
|
34
|
+
theme: AppState["theme"];
|
|
35
|
+
} & {
|
|
36
|
+
activeTool: AppState["activeTool"];
|
|
37
|
+
activeEmbeddable: AppState["activeEmbeddable"];
|
|
38
|
+
selectionElement: AppState["selectionElement"];
|
|
39
|
+
selectedGroupIds: AppState["selectedGroupIds"];
|
|
40
|
+
selectedLinearElement: AppState["selectedLinearElement"];
|
|
41
|
+
multiElement: AppState["multiElement"];
|
|
42
|
+
newElement: AppState["newElement"];
|
|
43
|
+
isBindingEnabled: AppState["isBindingEnabled"];
|
|
44
|
+
isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
|
|
45
|
+
gridModeEnabled: AppState["gridModeEnabled"];
|
|
46
|
+
suggestedBinding: AppState["suggestedBinding"];
|
|
47
|
+
textToolHover: AppState["textToolHover"];
|
|
48
|
+
isRotating: AppState["isRotating"];
|
|
49
|
+
elementsToHighlight: AppState["elementsToHighlight"];
|
|
50
|
+
collaborators: AppState["collaborators"];
|
|
51
|
+
snapLines: AppState["snapLines"];
|
|
52
|
+
zenModeEnabled: AppState["zenModeEnabled"];
|
|
53
|
+
editingTextElement: AppState["editingTextElement"];
|
|
54
|
+
isCropping: AppState["isCropping"];
|
|
55
|
+
croppingElementId: AppState["croppingElementId"];
|
|
56
|
+
searchMatches: AppState["searchMatches"];
|
|
57
|
+
activeLockedId: AppState["activeLockedId"];
|
|
58
|
+
hoveredElementIds: AppState["hoveredElementIds"];
|
|
59
|
+
frameRendering: AppState["frameRendering"];
|
|
60
|
+
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
61
|
+
exportScale: AppState["exportScale"];
|
|
62
|
+
currentItemArrowType: AppState["currentItemArrowType"];
|
|
63
|
+
}>, "selectedElementIds" | "editingGroupId" | "selectedGroupIds">> & {
|
|
64
|
+
selectedLinearElement: LinearElementEditor | null;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* The selection with the given elements added, with their groups (within the
|
|
68
|
+
* edited group) — and the line editor of a lone selected line or arrow.
|
|
69
|
+
*
|
|
70
|
+
* A frame and its children aren't selected at the same time: an added frame
|
|
71
|
+
* deselects its children, an added child of a selected (or added) frame is
|
|
72
|
+
* left out, and adding elements grouped with frames deselects those frames'
|
|
73
|
+
* children (and leaves the added ones out). In the element link selector, the
|
|
74
|
+
* added elements replace the selection (unless one's group is selected).
|
|
75
|
+
*
|
|
76
|
+
* @param allElements the (non-deleted) elements the selection is in
|
|
77
|
+
*/
|
|
78
|
+
export declare const getSelectionStateAddingElements: (targetElements: readonly NonDeletedExcalidrawElement[], allElements: readonly NonDeletedExcalidrawElement[], appState: AppState) => Mutable<Pick<Readonly<{
|
|
79
|
+
zoom: AppState["zoom"];
|
|
80
|
+
scrollX: AppState["scrollX"];
|
|
81
|
+
scrollY: AppState["scrollY"];
|
|
82
|
+
width: AppState["width"];
|
|
83
|
+
height: AppState["height"];
|
|
84
|
+
viewModeEnabled: AppState["viewModeEnabled"];
|
|
85
|
+
openDialog: AppState["openDialog"];
|
|
86
|
+
editingGroupId: AppState["editingGroupId"];
|
|
87
|
+
selectedElementIds: AppState["selectedElementIds"];
|
|
88
|
+
frameToHighlight: AppState["frameToHighlight"];
|
|
89
|
+
offsetLeft: AppState["offsetLeft"];
|
|
90
|
+
offsetTop: AppState["offsetTop"];
|
|
91
|
+
theme: AppState["theme"];
|
|
92
|
+
} & {
|
|
93
|
+
activeTool: AppState["activeTool"];
|
|
94
|
+
activeEmbeddable: AppState["activeEmbeddable"];
|
|
95
|
+
selectionElement: AppState["selectionElement"];
|
|
96
|
+
selectedGroupIds: AppState["selectedGroupIds"];
|
|
97
|
+
selectedLinearElement: AppState["selectedLinearElement"];
|
|
98
|
+
multiElement: AppState["multiElement"];
|
|
99
|
+
newElement: AppState["newElement"];
|
|
100
|
+
isBindingEnabled: AppState["isBindingEnabled"];
|
|
101
|
+
isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
|
|
102
|
+
gridModeEnabled: AppState["gridModeEnabled"];
|
|
103
|
+
suggestedBinding: AppState["suggestedBinding"];
|
|
104
|
+
textToolHover: AppState["textToolHover"];
|
|
105
|
+
isRotating: AppState["isRotating"];
|
|
106
|
+
elementsToHighlight: AppState["elementsToHighlight"];
|
|
107
|
+
collaborators: AppState["collaborators"];
|
|
108
|
+
snapLines: AppState["snapLines"];
|
|
109
|
+
zenModeEnabled: AppState["zenModeEnabled"];
|
|
110
|
+
editingTextElement: AppState["editingTextElement"];
|
|
111
|
+
isCropping: AppState["isCropping"];
|
|
112
|
+
croppingElementId: AppState["croppingElementId"];
|
|
113
|
+
searchMatches: AppState["searchMatches"];
|
|
114
|
+
activeLockedId: AppState["activeLockedId"];
|
|
115
|
+
hoveredElementIds: AppState["hoveredElementIds"];
|
|
116
|
+
frameRendering: AppState["frameRendering"];
|
|
117
|
+
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
118
|
+
exportScale: AppState["exportScale"];
|
|
119
|
+
currentItemArrowType: AppState["currentItemArrowType"];
|
|
120
|
+
}>, "selectedElementIds" | "editingGroupId" | "selectedGroupIds">> & {
|
|
121
|
+
selectedLinearElement: LinearElementEditor | null;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* The selection with the given elements removed — with the group they're
|
|
125
|
+
* selected via (if any) — and a lone remaining line or arrow getting its
|
|
126
|
+
* line editor.
|
|
127
|
+
*
|
|
128
|
+
* @param allElements the (non-deleted) elements the selection is in
|
|
129
|
+
*/
|
|
130
|
+
export declare const getSelectionStateRemovingElements: (targetElements: readonly NonDeletedExcalidrawElement[], allElements: readonly NonDeletedExcalidrawElement[], appState: AppState) => Mutable<Pick<Readonly<{
|
|
131
|
+
zoom: AppState["zoom"];
|
|
132
|
+
scrollX: AppState["scrollX"];
|
|
133
|
+
scrollY: AppState["scrollY"];
|
|
134
|
+
width: AppState["width"];
|
|
135
|
+
height: AppState["height"];
|
|
136
|
+
viewModeEnabled: AppState["viewModeEnabled"];
|
|
137
|
+
openDialog: AppState["openDialog"];
|
|
138
|
+
editingGroupId: AppState["editingGroupId"];
|
|
139
|
+
selectedElementIds: AppState["selectedElementIds"];
|
|
140
|
+
frameToHighlight: AppState["frameToHighlight"];
|
|
141
|
+
offsetLeft: AppState["offsetLeft"];
|
|
142
|
+
offsetTop: AppState["offsetTop"];
|
|
143
|
+
theme: AppState["theme"];
|
|
144
|
+
} & {
|
|
145
|
+
activeTool: AppState["activeTool"];
|
|
146
|
+
activeEmbeddable: AppState["activeEmbeddable"];
|
|
147
|
+
selectionElement: AppState["selectionElement"];
|
|
148
|
+
selectedGroupIds: AppState["selectedGroupIds"];
|
|
149
|
+
selectedLinearElement: AppState["selectedLinearElement"];
|
|
150
|
+
multiElement: AppState["multiElement"];
|
|
151
|
+
newElement: AppState["newElement"];
|
|
152
|
+
isBindingEnabled: AppState["isBindingEnabled"];
|
|
153
|
+
isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
|
|
154
|
+
gridModeEnabled: AppState["gridModeEnabled"];
|
|
155
|
+
suggestedBinding: AppState["suggestedBinding"];
|
|
156
|
+
textToolHover: AppState["textToolHover"];
|
|
157
|
+
isRotating: AppState["isRotating"];
|
|
158
|
+
elementsToHighlight: AppState["elementsToHighlight"];
|
|
159
|
+
collaborators: AppState["collaborators"];
|
|
160
|
+
snapLines: AppState["snapLines"];
|
|
161
|
+
zenModeEnabled: AppState["zenModeEnabled"];
|
|
162
|
+
editingTextElement: AppState["editingTextElement"];
|
|
163
|
+
isCropping: AppState["isCropping"];
|
|
164
|
+
croppingElementId: AppState["croppingElementId"];
|
|
165
|
+
searchMatches: AppState["searchMatches"];
|
|
166
|
+
activeLockedId: AppState["activeLockedId"];
|
|
167
|
+
hoveredElementIds: AppState["hoveredElementIds"];
|
|
168
|
+
frameRendering: AppState["frameRendering"];
|
|
169
|
+
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
170
|
+
exportScale: AppState["exportScale"];
|
|
171
|
+
currentItemArrowType: AppState["currentItemArrowType"];
|
|
172
|
+
}>, "selectedElementIds" | "editingGroupId" | "selectedGroupIds">> & {
|
|
173
|
+
selectedLinearElement: LinearElementEditor | null;
|
|
174
|
+
};
|
|
175
|
+
/** elements, or their ids — one or many */
|
|
176
|
+
export type ElementsOrIds = ExcalidrawElement | ExcalidrawElement["id"] | readonly (ExcalidrawElement | ExcalidrawElement["id"])[];
|
|
177
|
+
type SelectionChangeOptions = {
|
|
178
|
+
/**
|
|
179
|
+
* how the change is recorded for undo (see `updateScene()`) — by default,
|
|
180
|
+
* along with the next undoable change
|
|
181
|
+
*/
|
|
182
|
+
captureUpdate?: CaptureUpdateActionType;
|
|
183
|
+
};
|
|
184
|
+
type AddOptions = SelectionChangeOptions & {
|
|
185
|
+
/**
|
|
186
|
+
* select locked elements too — e.g. for the context menu to offer unlocking
|
|
187
|
+
* them
|
|
188
|
+
*/
|
|
189
|
+
includeLocked?: boolean;
|
|
190
|
+
};
|
|
191
|
+
type SelectOptions = AddOptions & {
|
|
192
|
+
/**
|
|
193
|
+
* select the elements themselves rather than their groups, editing their
|
|
194
|
+
* innermost group (if they share it) — as Ctrl+click does
|
|
195
|
+
*/
|
|
196
|
+
deep?: boolean;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* The selection: selecting elements, adding them to or removing them from
|
|
200
|
+
* the selection, and clearing it — keeping its rules: an element is selected
|
|
201
|
+
* with its group (but within the edited group), a frame and its children
|
|
202
|
+
* aren't selected at the same time, locked elements aren't selected, and a
|
|
203
|
+
* lone line or arrow gets its line editor (see the `getSelectionState*()`
|
|
204
|
+
* functions above).
|
|
205
|
+
*
|
|
206
|
+
* What hangs on the selection follows it: the link popup shows for a lone
|
|
207
|
+
* selected element with a link (or an embeddable), an embed stays active only
|
|
208
|
+
* while selected, cropping ends (unless the cropped image is selected again),
|
|
209
|
+
* and selecting (or adding) anything but the edited text ends text editing,
|
|
210
|
+
* submitting the text. The line editor ends once its line is deselected (see
|
|
211
|
+
* `componentDidUpdate()`).
|
|
212
|
+
*
|
|
213
|
+
* Elements are taken by id from the scene: missing and deleted ones are
|
|
214
|
+
* skipped.
|
|
215
|
+
*/
|
|
216
|
+
export declare class AppSelection {
|
|
217
|
+
private app;
|
|
218
|
+
constructor(app: App);
|
|
219
|
+
/**
|
|
220
|
+
* Selects the elements alone (with their groups, unless `deep`).
|
|
221
|
+
*/
|
|
222
|
+
select: (elementsOrIds: ElementsOrIds, opts?: SelectOptions) => void;
|
|
223
|
+
/**
|
|
224
|
+
* Adds the elements (with their groups) to the selection.
|
|
225
|
+
*/
|
|
226
|
+
add: (elementsOrIds: ElementsOrIds, opts?: AddOptions) => void;
|
|
227
|
+
/**
|
|
228
|
+
* Removes the elements from the selection — with the group they're
|
|
229
|
+
* selected via.
|
|
230
|
+
*/
|
|
231
|
+
remove: (elementsOrIds: ElementsOrIds, opts?: SelectionChangeOptions) => void;
|
|
232
|
+
/**
|
|
233
|
+
* Clears the selection, leaving the edited group and ending cropping.
|
|
234
|
+
*
|
|
235
|
+
* (Doesn't end text editing: starting it clears the selection.)
|
|
236
|
+
*/
|
|
237
|
+
clear: (opts?: SelectionChangeOptions) => void;
|
|
238
|
+
/**
|
|
239
|
+
* Ends what changing the selection ends — cropping (unless
|
|
240
|
+
* `keepsCroppedImage`), and text editing (unless selecting the edited text,
|
|
241
|
+
* or its container) — and records the change for undo as asked.
|
|
242
|
+
*
|
|
243
|
+
* @param elements the elements being selected (or added) — none for a
|
|
244
|
+
* change that leaves text editing be
|
|
245
|
+
*/
|
|
246
|
+
private beforeChange;
|
|
247
|
+
/**
|
|
248
|
+
* The next selection state with what follows it: the link popup — shown for
|
|
249
|
+
* a lone selected element with a link (or an embeddable), the link editor
|
|
250
|
+
* staying open if it's the same element, and hidden otherwise — and the
|
|
251
|
+
* active embed, which stays active only while selected.
|
|
252
|
+
*/
|
|
253
|
+
private withFollowingState;
|
|
254
|
+
isASelectedElement(hitElement: ExcalidrawElement | null): boolean;
|
|
255
|
+
isHittingCommonBoundingBoxOfSelectedElements(point: Readonly<{
|
|
256
|
+
x: number;
|
|
257
|
+
y: number;
|
|
258
|
+
}>, selectedElements: readonly ExcalidrawElement[]): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* The scene's (non-deleted) elements, by id, once each — but locked ones,
|
|
261
|
+
* unless `includeLocked`
|
|
262
|
+
*/
|
|
263
|
+
private resolve;
|
|
264
|
+
}
|
|
265
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TransformHandleType } from "@excalidraw/element";
|
|
2
|
+
import type { ExcalidrawElement, ExcalidrawImageElement, NonDeleted, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap, PointerType } from "@excalidraw/element/types";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
import type { PointerDownState } from "../types";
|
|
4
5
|
import type App from "./App";
|
|
@@ -17,7 +18,47 @@ export declare class AppSelectionTool {
|
|
|
17
18
|
*/
|
|
18
19
|
handleSelectionOnPointerDown: (event: React.PointerEvent<HTMLElement>, pointerDownState: PointerDownState) => boolean;
|
|
19
20
|
maybeHandleCrop: (pointerDownState: PointerDownState, event: MouseEvent | KeyboardEvent) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* In the crop editor, a double-click on a handle uncrops its side (a
|
|
23
|
+
* corner's two), and mirrored, the opposite side(s) too.
|
|
24
|
+
*
|
|
25
|
+
* @returns whether the double-click has been handled
|
|
26
|
+
*/
|
|
27
|
+
maybeUncropSides: (image: NonDeleted<ExcalidrawImageElement>, sceneX: number, sceneY: number, mirrored: boolean) => boolean;
|
|
20
28
|
maybeHandleResize: (pointerDownState: PointerDownState, event: MouseEvent | KeyboardEvent) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Drags the selection (or, in the crop editor, the image within its crop) —
|
|
31
|
+
* duplicating it on an alt-drag past the drag threshold.
|
|
32
|
+
*
|
|
33
|
+
* @returns whether the pointer event has been completely handled
|
|
34
|
+
*/
|
|
35
|
+
handleSelectionDragOnPointerMove: (event: PointerEvent, pointerDownState: PointerDownState, pointerCoords: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
}, elementsMap: NonDeletedSceneElementsMap) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Box-selects with the selection tool — the line editor's points, while
|
|
41
|
+
* editing a line.
|
|
42
|
+
*/
|
|
43
|
+
handleBoxSelectionOnPointerMove: (event: PointerEvent, pointerDownState: PointerDownState) => void;
|
|
44
|
+
/**
|
|
45
|
+
* After dragging the selection: the dragged elements join the frame they're
|
|
46
|
+
* dropped in, or leave theirs (and the edited group, if they leave it).
|
|
47
|
+
*/
|
|
48
|
+
handleSelectionDragOnPointerUp: (childEvent: PointerEvent) => void;
|
|
49
|
+
/**
|
|
50
|
+
* The selection's transform handle at the scene point, if any — with its
|
|
51
|
+
* element, for a lone selected element.
|
|
52
|
+
*
|
|
53
|
+
* A lone selected element has none while the line editor is open or one of
|
|
54
|
+
* its line points is hovered, nor does an elbow arrow, a two-point line or
|
|
55
|
+
* arrow, or (on mobile devices) any line or arrow. The selection has none in
|
|
56
|
+
* the element link selector.
|
|
57
|
+
*/
|
|
58
|
+
getTransformHandleAt(selectedElements: readonly NonDeletedExcalidrawElement[], sceneX: number, sceneY: number, pointerType: PointerType): {
|
|
59
|
+
element?: NonDeletedExcalidrawElement;
|
|
60
|
+
transformHandleType: TransformHandleType;
|
|
61
|
+
} | null;
|
|
21
62
|
/**
|
|
22
63
|
* Updates the selection on a click (no drag): the element below the
|
|
23
64
|
* selected one on an alt-click, the clicked element added to or removed
|
|
@@ -28,11 +69,6 @@ export declare class AppSelectionTool {
|
|
|
28
69
|
*/
|
|
29
70
|
handleSelectionOnPointerUp: (childEvent: PointerEvent, pointerDownState: PointerDownState, elementsMap: NonDeletedSceneElementsMap) => boolean;
|
|
30
71
|
clearSelection(hitElement: ExcalidrawElement | null): void;
|
|
31
|
-
isASelectedElement(hitElement: ExcalidrawElement | null): boolean;
|
|
32
|
-
isHittingCommonBoundingBoxOfSelectedElements(point: Readonly<{
|
|
33
|
-
x: number;
|
|
34
|
-
y: number;
|
|
35
|
-
}>, selectedElements: readonly ExcalidrawElement[]): boolean;
|
|
36
72
|
/** whether an alt-click on the selection (over other elements) cycles it */
|
|
37
73
|
canCycleSelection: () => boolean;
|
|
38
74
|
/**
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { type StylesPanelMode } from "@excalidraw/common";
|
|
2
2
|
import type { NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
3
|
+
import { type AnimationKey, type AnimationScheduler } from "../renderer/animation";
|
|
3
4
|
import { type SetViewportOptions } from "../viewport";
|
|
4
5
|
import type { AppProps, AppState, Offsets, ScrollConstraints, ViewportOffsets, ViewportOffsetsOptions, ViewportUIName } from "../types";
|
|
5
6
|
import type App from "./App";
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
/** The AnimationController keys a viewport uses, unique per AppViewport so
|
|
8
|
+
* concurrent editors in the same window never share (or cancel) each
|
|
9
|
+
* other's animations. */
|
|
10
|
+
export type ViewportAnimationKeys = {
|
|
11
|
+
scrollToContent: AnimationKey;
|
|
12
|
+
snapBack: AnimationKey;
|
|
13
|
+
};
|
|
8
14
|
/** single source of truth for the `--right-sidebar-width` CSS variable */
|
|
9
15
|
export declare const RIGHT_SIDEBAR_WIDTH = 302;
|
|
10
16
|
type Viewport = Pick<AppState, "scrollX" | "scrollY" | "zoom">;
|
|
@@ -19,7 +25,7 @@ type AppViewportDependencies = {
|
|
|
19
25
|
* AnimationController. No-op when already within the hard bounds (or when
|
|
20
26
|
* there is no lock).
|
|
21
27
|
*/
|
|
22
|
-
export declare const snapBackToConstraints: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height" | "scrollConstraints">, onFrame: (updater: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height" | "scrollConstraints">) => Viewport | null) => void, duration?: number) => void;
|
|
28
|
+
export declare const snapBackToConstraints: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height" | "scrollConstraints">, onFrame: (updater: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height" | "scrollConstraints">) => Viewport | null) => void, keys: ViewportAnimationKeys, scheduler?: AnimationScheduler, duration?: number) => void;
|
|
23
29
|
/**
|
|
24
30
|
* Owns viewport state transitions and App-bound viewport concerns. Pure
|
|
25
31
|
* viewport geometry remains in `viewport.ts` so actions and public helpers can
|
|
@@ -34,6 +40,12 @@ export declare class AppViewport {
|
|
|
34
40
|
};
|
|
35
41
|
private activeTransition;
|
|
36
42
|
private uiLastMeasured;
|
|
43
|
+
/** @see beginGesture */
|
|
44
|
+
private activeExternalGestures;
|
|
45
|
+
/** Unique per instance (see `ViewportAnimationKeys`); exposed for tests
|
|
46
|
+
* observing the animations. */
|
|
47
|
+
readonly scrollToContentAnimationKey: symbol;
|
|
48
|
+
readonly snapBackAnimationKey: symbol;
|
|
37
49
|
constructor(app: App, dependencies: AppViewportDependencies);
|
|
38
50
|
get isAnimating(): boolean;
|
|
39
51
|
/** Whether a programmatic transition into a locked viewport currently owns
|
|
@@ -103,6 +115,14 @@ export declare class AppViewport {
|
|
|
103
115
|
}) => boolean;
|
|
104
116
|
/** Clamps the viewport into the active scroll constraints. */
|
|
105
117
|
constrain: (overscroll?: number) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Marks a viewport gesture driven from outside of the canvas (e.g. dragging
|
|
120
|
+
* the minimap) as active, so that a rubberband overscroll is held for as
|
|
121
|
+
* long as it lasts, same as during a pan — including one that's snapping
|
|
122
|
+
* back already. Returns the function ending it, which releases the
|
|
123
|
+
* overscroll.
|
|
124
|
+
*/
|
|
125
|
+
beginGesture: () => () => void;
|
|
106
126
|
/** Releases a held rubberband overscroll. */
|
|
107
127
|
releaseOverscroll: () => void;
|
|
108
128
|
private snapBack;
|
|
@@ -21,6 +21,10 @@ export declare class AppWheel {
|
|
|
21
21
|
* ctrl+wheel).
|
|
22
22
|
*/
|
|
23
23
|
preventBrowserZoom: (event: WheelEvent) => void;
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Zooms by a wheel delta (positive = zoom out) — around the pointer, or
|
|
26
|
+
* around the center of the viewport (when wheeling elsewhere than over
|
|
27
|
+
* the canvas, e.g. over the minimap).
|
|
28
|
+
*/
|
|
29
|
+
zoomBy: (deltaY: number, anchor?: "pointer" | "center") => void;
|
|
26
30
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
+
import type { ActionResult } from "../actions/types";
|
|
3
|
+
import type { AppState } from "../types";
|
|
4
|
+
import type App from "./App";
|
|
5
|
+
/**
|
|
6
|
+
* Wraps the selection in what fits it, or unwraps it, preferring containers
|
|
7
|
+
* over frames:
|
|
8
|
+
*
|
|
9
|
+
* 1. a text and a container without one: binds the text to the container
|
|
10
|
+
* 2. texts, with any labeled containers: wraps each text in a container
|
|
11
|
+
* 3. labeled containers: unwraps their texts, removing the containers
|
|
12
|
+
* 4. a frame with any of its children, or all of a frame's children: removes
|
|
13
|
+
* the frame
|
|
14
|
+
* 5. anything else without a frame: wraps it in a frame
|
|
15
|
+
*
|
|
16
|
+
* The containers (3) removed come back in place of new ones while the
|
|
17
|
+
* selection it left stands, so diamonds, notes and arrows survive a toggle.
|
|
18
|
+
*/
|
|
19
|
+
export declare class AppWrap {
|
|
20
|
+
private app;
|
|
21
|
+
private unwrapped;
|
|
22
|
+
constructor(app: App);
|
|
23
|
+
toggle: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => ActionResult;
|
|
24
|
+
/** frees the containers' texts, moving the containers' arrows onto them */
|
|
25
|
+
private unwrap;
|
|
26
|
+
/**
|
|
27
|
+
* puts the unwrapped texts back into their containers, along with the
|
|
28
|
+
* containers' arrows — `null` when any of them is gone
|
|
29
|
+
*/
|
|
30
|
+
private rewrap;
|
|
31
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ConvertibleTypes, ExcalidrawElement, ExcalidrawTextContainer, ExcalidrawTextElementWithContainer } from "@excalidraw/element/types";
|
|
2
2
|
import type { Scene } from "@excalidraw/element";
|
|
3
|
+
import type { RenderEnvironment } from "@excalidraw/element/renderEnvironment";
|
|
3
4
|
import "./ConvertElementTypePopup.scss";
|
|
4
5
|
import type App from "./App";
|
|
5
6
|
export declare const convertElementTypePopupAtom: import("jotai").PrimitiveAtom<{
|
|
@@ -12,7 +13,7 @@ export declare const convertElementTypePopupAtom: import("jotai").PrimitiveAtom<
|
|
|
12
13
|
declare const ConvertElementTypePopup: ({ app }: {
|
|
13
14
|
app: App;
|
|
14
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export declare const adjustBoundTextSize: (container: ExcalidrawTextContainer, boundText: ExcalidrawTextElementWithContainer, scene: Scene) => void;
|
|
16
|
+
export declare const adjustBoundTextSize: (container: ExcalidrawTextContainer, boundText: ExcalidrawTextElementWithContainer, scene: Scene, renderEnvironment?: RenderEnvironment) => void;
|
|
16
17
|
type ConversionType = "generic" | "linear" | null;
|
|
17
18
|
export declare const convertElementTypes: (app: App, { conversionType, nextType, direction, }: {
|
|
18
19
|
conversionType: ConversionType;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./Minimap.scss";
|
|
2
|
+
/**
|
|
3
|
+
* The vertical space (px) the UI above the minimap gives up for it: its
|
|
4
|
+
* height + the gap below it (see Minimap.scss), less a part of the clearance
|
|
5
|
+
* that UI keeps from the footer anyway — the minimap can sit closer to it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MINIMAP_RESERVED_HEIGHT = 138;
|
|
8
|
+
/**
|
|
9
|
+
* The minimap isn't available in editors shorter than this (px): it shares
|
|
10
|
+
* the left edge with the styles panel, which would be left with no room.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MINIMAP_MIN_EDITOR_HEIGHT = 500;
|
|
13
|
+
export declare const Minimap: ({ className }: {
|
|
14
|
+
className?: string;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element;
|