@excalidraw/math 0.18.0-4ce38fb → 0.18.0-4ce8305
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/utils.d.ts +7 -1
- package/dist/types/element/src/align.d.ts +4 -1
- package/dist/types/element/src/binding.d.ts +36 -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/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/actionBoundText.d.ts +46 -221
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -588
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionExport.d.ts +7 -7
- package/dist/types/excalidraw/actions/actionFrame.d.ts +41 -525
- package/dist/types/excalidraw/actions/actionGroup.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/index.d.ts +1 -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 +7 -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/App.d.ts +34 -20
- package/dist/types/excalidraw/components/App.host.d.ts +102 -0
- package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
- package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
- package/dist/types/excalidraw/components/App.selectionTool.d.ts +93 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +13 -3
- 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/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 +27 -1
- 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/hyperlink/Hyperlink.d.ts +3 -2
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +13 -2
- package/dist/types/excalidraw/data/blob.d.ts +14 -14
- package/dist/types/excalidraw/data/index.d.ts +3 -3
- package/dist/types/excalidraw/data/json.d.ts +7 -7
- package/dist/types/excalidraw/fonts/Fonts.d.ts +9 -6
- package/dist/types/excalidraw/history.d.ts +10 -4
- 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 +49 -1
- 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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RenderEnvironment } from "./renderEnvironment";
|
|
1
2
|
import type { Scene } from "./Scene";
|
|
2
3
|
import type { VerticalResizeAnchor } from "./sizeHelpers";
|
|
3
4
|
import type { TransformHandleDirection } from "./transformHandles";
|
|
@@ -124,6 +125,12 @@ export type StickyNoteLayoutOpts = {
|
|
|
124
125
|
baseFontSize?: number;
|
|
125
126
|
/** the edge that stays put when the content correction changes the height */
|
|
126
127
|
anchor?: StickyNoteLayoutAnchor;
|
|
128
|
+
/**
|
|
129
|
+
* the host whose text metrics the fit measures with; omitted = the global
|
|
130
|
+
* environment. An editor passes its own so a note laid out in one window
|
|
131
|
+
* (or headlessly) is measured with that realm's fonts and canvas.
|
|
132
|
+
*/
|
|
133
|
+
renderEnvironment?: RenderEnvironment;
|
|
127
134
|
};
|
|
128
135
|
export type StickyNoteLayout = {
|
|
129
136
|
container: Pick<ExcalidrawStickyNoteElement, "x" | "y" | "width" | "height" | "baseHeight">;
|
|
@@ -180,4 +187,5 @@ export declare const updateStickyNoteLayout: (container: ExcalidrawStickyNoteEle
|
|
|
180
187
|
*/
|
|
181
188
|
export declare const relayoutStickyNotes: <T extends ExcalidrawElement>(elements: readonly T[], affectedIds: ReadonlySet<ExcalidrawElement["id"]>, opts?: {
|
|
182
189
|
prevElementsMap?: ElementsMap;
|
|
190
|
+
renderEnvironment?: RenderEnvironment;
|
|
183
191
|
}) => readonly T[];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type Radians } from "@excalidraw/math";
|
|
2
2
|
import type { ExtractSetType } from "@excalidraw/common/utility-types";
|
|
3
|
+
import type { RenderEnvironment } from "./renderEnvironment";
|
|
3
4
|
import type { Scene } from "./Scene";
|
|
4
5
|
import type { MaybeTransformHandleType } from "./transformHandles";
|
|
5
6
|
import type { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, NonDeleted } from "./types";
|
|
6
|
-
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, scene: Scene) => void;
|
|
7
|
-
export declare const handleBindTextResize: (container: ExcalidrawElement, scene: Scene, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean, shouldResizeFromCenter?: boolean, flipByY?: boolean) => void;
|
|
7
|
+
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, scene: Scene, renderEnvironment?: RenderEnvironment) => void;
|
|
8
|
+
export declare const handleBindTextResize: (container: ExcalidrawElement, scene: Scene, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean, shouldResizeFromCenter?: boolean, flipByY?: boolean, renderEnvironment?: RenderEnvironment) => void;
|
|
8
9
|
export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
|
|
9
10
|
x: number;
|
|
10
11
|
y: number;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { RenderEnvironment } from "./renderEnvironment";
|
|
1
2
|
import type { FontString, ExcalidrawTextElement } from "./types";
|
|
2
|
-
export declare const measureText: (text: string, font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => {
|
|
3
|
+
export declare const measureText: (text: string, font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"], env?: RenderEnvironment) => {
|
|
3
4
|
width: number;
|
|
4
5
|
height: number;
|
|
5
6
|
};
|
|
6
|
-
export declare const getApproxMinLineWidth: (font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
7
|
-
export declare const getMinTextElementWidth: (font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
7
|
+
export declare const getApproxMinLineWidth: (font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"], env?: RenderEnvironment) => number;
|
|
8
|
+
export declare const getMinTextElementWidth: (font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"], env?: RenderEnvironment) => number;
|
|
8
9
|
export declare const isMeasureTextSupported: () => boolean;
|
|
9
10
|
export declare const normalizeText: (text: string) => string;
|
|
10
11
|
/**
|
|
@@ -19,21 +20,24 @@ export declare const detectLineHeight: (textElement: ExcalidrawTextElement) => E
|
|
|
19
20
|
export declare const getLineHeightInPx: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
20
21
|
export declare const getApproxMinLineHeight: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
21
22
|
/**
|
|
22
|
-
* Set a custom text metrics provider
|
|
23
|
+
* Set a custom text metrics provider, for all text measured in an environment
|
|
24
|
+
* without its own (`RenderEnvironment["textMetrics"]`) -- e.g. elements
|
|
25
|
+
* created outside the editor, on a server. Pass `undefined` to go back to
|
|
26
|
+
* measuring on a canvas.
|
|
23
27
|
*
|
|
24
28
|
* Useful for overriding the width calculation algorithm where canvas API is not available / desired.
|
|
25
29
|
*/
|
|
26
|
-
export declare const setCustomTextMetricsProvider: (provider: TextMetricsProvider) => void;
|
|
30
|
+
export declare const setCustomTextMetricsProvider: (provider: TextMetricsProvider | undefined) => void;
|
|
27
31
|
export interface TextMetricsProvider {
|
|
28
32
|
getLineWidth(text: string, fontString: FontString): number;
|
|
29
33
|
}
|
|
30
|
-
export declare const getLineWidth: (text: string, font: FontString) => number;
|
|
31
|
-
export declare const getTextWidth: (text: string, font: FontString) => number;
|
|
34
|
+
export declare const getLineWidth: (text: string, font: FontString, env?: RenderEnvironment) => number;
|
|
35
|
+
export declare const getTextWidth: (text: string, font: FontString, env?: RenderEnvironment) => number;
|
|
32
36
|
export declare const getTextHeight: (text: string, fontSize: number, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
33
37
|
export declare const charWidth: {
|
|
34
|
-
calculate: (char: string, font: FontString) => number;
|
|
35
|
-
getCache: (font: FontString) => number[];
|
|
38
|
+
calculate: (char: string, font: FontString, env?: RenderEnvironment) => number;
|
|
39
|
+
getCache: (font: FontString, env?: RenderEnvironment) => number[] | undefined;
|
|
36
40
|
clearCache: (font: FontString) => void;
|
|
37
41
|
};
|
|
38
|
-
export declare const getMinCharWidth: (font: FontString) => number;
|
|
39
|
-
export declare const getMaxCharWidth: (font: FontString) => number;
|
|
42
|
+
export declare const getMinCharWidth: (font: FontString, env?: RenderEnvironment) => number;
|
|
43
|
+
export declare const getMaxCharWidth: (font: FontString, env?: RenderEnvironment) => number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RenderEnvironment } from "./renderEnvironment";
|
|
1
2
|
import type { FontString } from "./types";
|
|
2
3
|
/**
|
|
3
4
|
* Test if a given text contains any CJK characters (including symbols, punctuation, etc,).
|
|
@@ -17,7 +18,7 @@ export declare const parseTokens: (line: string) => string[];
|
|
|
17
18
|
* This is a convenience adapter over `getWrappedTextLines()` for call sites
|
|
18
19
|
* that only need the rendered wrapped string and not the source offsets.
|
|
19
20
|
*/
|
|
20
|
-
export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
|
|
21
|
+
export declare const wrapText: (text: string, font: FontString, maxWidth: number, env?: RenderEnvironment) => string;
|
|
21
22
|
/**
|
|
22
23
|
* A single rendered visual line produced from the original text.
|
|
23
24
|
*
|
|
@@ -36,4 +37,4 @@ export type WrappedTextLine = {
|
|
|
36
37
|
* This is the source-of-truth wrapping pipeline for callers that need more than the
|
|
37
38
|
* final wrapped string, for example caret placement or future editor/rich-text mapping.
|
|
38
39
|
*/
|
|
39
|
-
export declare const getWrappedTextLines: (text: string, font: FontString, maxWidth: number) => WrappedTextLine[];
|
|
40
|
+
export declare const getWrappedTextLines: (text: string, font: FontString, maxWidth: number, env?: RenderEnvironment) => WrappedTextLine[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { MarkOptional } from "@excalidraw/common/utility-types";
|
|
2
2
|
import { type ElementConstructorOpts } from "./newElement";
|
|
3
|
+
import type { RenderEnvironment } from "./renderEnvironment";
|
|
3
4
|
import type { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, NonDeletedExcalidrawElement, Ordered, TextAlign, VerticalAlign, ExcalidrawStickyNoteElement } from "./types";
|
|
4
5
|
/**
|
|
5
6
|
* Options for elements generated from a skeleton fragment (bound labels and
|
|
@@ -17,6 +18,8 @@ export type ValidLinearElement = {
|
|
|
17
18
|
fontFamily?: FontFamilyValues;
|
|
18
19
|
textAlign?: TextAlign;
|
|
19
20
|
verticalAlign?: VerticalAlign;
|
|
21
|
+
/** where along an arrow's path (0-1) the label is centered */
|
|
22
|
+
labelPosition?: ExcalidrawTextElement["labelPosition"];
|
|
20
23
|
} & FragmentConstructorOpts;
|
|
21
24
|
end?: (({
|
|
22
25
|
type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
|
|
@@ -95,6 +98,7 @@ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, Excal
|
|
|
95
98
|
name?: string;
|
|
96
99
|
} & Partial<ExcalidrawMagicFrameElement>);
|
|
97
100
|
export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
|
|
98
|
-
regenerateIds
|
|
101
|
+
regenerateIds?: boolean;
|
|
102
|
+
renderEnvironment?: RenderEnvironment;
|
|
99
103
|
}) => Ordered<NonDeletedExcalidrawElement>[];
|
|
100
104
|
export {};
|
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { Scene } from "@excalidraw/element";
|
|
2
|
+
import type { ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
3
|
+
import type { ActionResult } from "./types";
|
|
4
|
+
import type { AppClassProperties, AppState } from "../types";
|
|
5
|
+
/**
|
|
6
|
+
* Frees the container's text as it rendered: wrapped the same, at a fixed
|
|
7
|
+
* width.
|
|
8
|
+
*/
|
|
9
|
+
export declare const unbindTextFromContainer: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, scene: Scene) => void;
|
|
4
10
|
export declare const actionUnbindText: {
|
|
5
11
|
name: "unbindText";
|
|
6
12
|
label: string;
|
|
7
13
|
trackEvent: {
|
|
8
14
|
category: "element";
|
|
9
15
|
};
|
|
10
|
-
predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app:
|
|
11
|
-
perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app:
|
|
16
|
+
predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: AppClassProperties) => boolean;
|
|
17
|
+
perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: AppClassProperties) => {
|
|
12
18
|
elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
13
|
-
appState: Readonly<AppState>;
|
|
14
|
-
captureUpdate: "IMMEDIATELY";
|
|
15
|
-
};
|
|
16
|
-
} & {
|
|
17
|
-
keyTest?: undefined;
|
|
18
|
-
};
|
|
19
|
-
export declare const actionBindText: {
|
|
20
|
-
name: "bindText";
|
|
21
|
-
label: string;
|
|
22
|
-
trackEvent: {
|
|
23
|
-
category: "element";
|
|
24
|
-
};
|
|
25
|
-
predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
|
|
26
|
-
perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: import("../types").AppClassProperties) => {
|
|
27
|
-
elements: ExcalidrawElement[];
|
|
28
19
|
appState: {
|
|
29
|
-
selectedElementIds:
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
selectedElementIds: AppState["selectedElementIds"];
|
|
21
|
+
editingGroupId: AppState["editingGroupId"];
|
|
22
|
+
selectedGroupIds: AppState["selectedGroupIds"];
|
|
23
|
+
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
32
24
|
contextMenu: {
|
|
33
25
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
34
26
|
top: number;
|
|
@@ -38,13 +30,13 @@ export declare const actionBindText: {
|
|
|
38
30
|
isLoading: boolean;
|
|
39
31
|
errorMessage: React.ReactNode;
|
|
40
32
|
activeEmbeddable: {
|
|
41
|
-
element:
|
|
33
|
+
element: NonDeletedExcalidrawElement;
|
|
42
34
|
state: "hover" | "active";
|
|
43
35
|
} | null;
|
|
44
|
-
newElement:
|
|
45
|
-
resizingElement:
|
|
46
|
-
multiElement:
|
|
47
|
-
selectionElement:
|
|
36
|
+
newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
37
|
+
resizingElement: NonDeletedExcalidrawElement | null;
|
|
38
|
+
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
39
|
+
selectionElement: NonDeletedExcalidrawElement | null;
|
|
48
40
|
isBindingEnabled: boolean;
|
|
49
41
|
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
50
42
|
bindingPreference: "enabled" | "disabled";
|
|
@@ -52,7 +44,7 @@ export declare const actionBindText: {
|
|
|
52
44
|
showHints: boolean;
|
|
53
45
|
inputDevice: import("../types").InputDevice;
|
|
54
46
|
suggestedBinding: {
|
|
55
|
-
element:
|
|
47
|
+
element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
56
48
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
57
49
|
} | null;
|
|
58
50
|
textToolHover: {
|
|
@@ -66,7 +58,7 @@ export declare const actionBindText: {
|
|
|
66
58
|
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
67
59
|
anchor: "start" | "end" | "label";
|
|
68
60
|
} | null;
|
|
69
|
-
frameToHighlight:
|
|
61
|
+
frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
70
62
|
frameRendering: {
|
|
71
63
|
enabled: boolean;
|
|
72
64
|
name: boolean;
|
|
@@ -74,7 +66,7 @@ export declare const actionBindText: {
|
|
|
74
66
|
clip: boolean;
|
|
75
67
|
};
|
|
76
68
|
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
77
|
-
elementsToHighlight: readonly
|
|
69
|
+
elementsToHighlight: readonly NonDeletedExcalidrawElement[] | null;
|
|
78
70
|
editingTextElement: ExcalidrawTextElement | null;
|
|
79
71
|
activeTool: {
|
|
80
72
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -163,10 +155,6 @@ export declare const actionBindText: {
|
|
|
163
155
|
gridStep: number;
|
|
164
156
|
gridModeEnabled: boolean;
|
|
165
157
|
viewModeEnabled: boolean;
|
|
166
|
-
selectedGroupIds: {
|
|
167
|
-
[groupId: string]: boolean;
|
|
168
|
-
};
|
|
169
|
-
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
170
158
|
width: number;
|
|
171
159
|
height: number;
|
|
172
160
|
offsetTop: number;
|
|
@@ -178,7 +166,6 @@ export declare const actionBindText: {
|
|
|
178
166
|
panels: number;
|
|
179
167
|
};
|
|
180
168
|
showHyperlinkPopup: false | "info" | "editor";
|
|
181
|
-
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
182
169
|
snapLines: readonly import("../snapping").SnapLine[];
|
|
183
170
|
originSnapOffset: {
|
|
184
171
|
x: number;
|
|
@@ -210,197 +197,35 @@ export declare const actionBindText: {
|
|
|
210
197
|
} & {
|
|
211
198
|
keyTest?: undefined;
|
|
212
199
|
};
|
|
200
|
+
export declare const actionBindText: {
|
|
201
|
+
name: "bindText";
|
|
202
|
+
label: string;
|
|
203
|
+
trackEvent: {
|
|
204
|
+
category: "element";
|
|
205
|
+
};
|
|
206
|
+
predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: AppClassProperties) => boolean;
|
|
207
|
+
perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: AppClassProperties) => ActionResult;
|
|
208
|
+
} & {
|
|
209
|
+
keyTest?: undefined;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* A note and its label share one ink: the text the user styled wins, unless it
|
|
213
|
+
* is transparent (a note's label never is).
|
|
214
|
+
*/
|
|
215
|
+
export declare const getStickyNoteInk: (textElement: ExcalidrawTextElement, container: ExcalidrawElement) => string | null;
|
|
216
|
+
/** binds the text to the (label-less) container, selecting the container */
|
|
217
|
+
export declare const bindTextToContainer: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, textElement: ExcalidrawTextElement, container: NonDeleted<ExcalidrawTextContainer>, app: AppClassProperties) => ActionResult;
|
|
218
|
+
export declare const pushContainerBelowText: (elements: readonly ExcalidrawElement[], container: ExcalidrawElement, textElement: ExcalidrawTextElement) => ExcalidrawElement[];
|
|
213
219
|
export declare const actionWrapTextInContainer: {
|
|
214
220
|
name: "wrapTextInContainer";
|
|
215
221
|
label: string;
|
|
216
222
|
trackEvent: {
|
|
217
223
|
category: "element";
|
|
218
224
|
};
|
|
219
|
-
predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app:
|
|
220
|
-
perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app:
|
|
221
|
-
elements: readonly ExcalidrawElement[];
|
|
222
|
-
appState: {
|
|
223
|
-
selectedElementIds: Mutable<Readonly<{
|
|
224
|
-
[id: string]: true;
|
|
225
|
-
}>>;
|
|
226
|
-
contextMenu: {
|
|
227
|
-
items: import("../components/ContextMenu").ContextMenuItems;
|
|
228
|
-
top: number;
|
|
229
|
-
left: number;
|
|
230
|
-
} | null;
|
|
231
|
-
showWelcomeScreen: boolean;
|
|
232
|
-
isLoading: boolean;
|
|
233
|
-
errorMessage: React.ReactNode;
|
|
234
|
-
activeEmbeddable: {
|
|
235
|
-
element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
|
|
236
|
-
state: "hover" | "active";
|
|
237
|
-
} | null;
|
|
238
|
-
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
239
|
-
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
240
|
-
multiElement: import("@excalidraw/element/types").NonDeleted<ExcalidrawLinearElement> | null;
|
|
241
|
-
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
242
|
-
isBindingEnabled: boolean;
|
|
243
|
-
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
244
|
-
bindingPreference: "enabled" | "disabled";
|
|
245
|
-
isMidpointSnappingEnabled: boolean;
|
|
246
|
-
showHints: boolean;
|
|
247
|
-
inputDevice: import("../types").InputDevice;
|
|
248
|
-
suggestedBinding: {
|
|
249
|
-
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
250
|
-
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
251
|
-
} | null;
|
|
252
|
-
textToolHover: {
|
|
253
|
-
type: "text";
|
|
254
|
-
elementId: ExcalidrawElement["id"];
|
|
255
|
-
} | {
|
|
256
|
-
type: "container";
|
|
257
|
-
elementId: ExcalidrawElement["id"];
|
|
258
|
-
} | {
|
|
259
|
-
type: "arrow";
|
|
260
|
-
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
261
|
-
anchor: "start" | "end" | "label";
|
|
262
|
-
} | null;
|
|
263
|
-
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
264
|
-
frameRendering: {
|
|
265
|
-
enabled: boolean;
|
|
266
|
-
name: boolean;
|
|
267
|
-
outline: boolean;
|
|
268
|
-
clip: boolean;
|
|
269
|
-
};
|
|
270
|
-
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
271
|
-
elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
|
|
272
|
-
editingTextElement: ExcalidrawTextElement | null;
|
|
273
|
-
activeTool: {
|
|
274
|
-
lastActiveTool: import("../types").ActiveTool | null;
|
|
275
|
-
locked: boolean;
|
|
276
|
-
fromSelection: boolean;
|
|
277
|
-
} & import("../types").ActiveTool;
|
|
278
|
-
preferredSelectionTool: {
|
|
279
|
-
type: "selection" | "lasso";
|
|
280
|
-
initialized: boolean;
|
|
281
|
-
};
|
|
282
|
-
penMode: boolean;
|
|
283
|
-
penDetected: boolean;
|
|
284
|
-
exportBackground: boolean;
|
|
285
|
-
exportEmbedScene: boolean;
|
|
286
|
-
exportWithDarkMode: boolean;
|
|
287
|
-
exportScale: number;
|
|
288
|
-
currentItemStrokeColor: string;
|
|
289
|
-
currentItemStickynoteStrokeColor: string;
|
|
290
|
-
currentItemStickynoteBackgroundColor: string;
|
|
291
|
-
currentItemBackgroundColor: string;
|
|
292
|
-
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
293
|
-
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
294
|
-
currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
|
|
295
|
-
currentItemRoughness: number;
|
|
296
|
-
currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
|
|
297
|
-
currentItemOpacity: number;
|
|
298
|
-
currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
|
|
299
|
-
currentItemFontSize: number;
|
|
300
|
-
currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
|
|
301
|
-
currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
302
|
-
currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
303
|
-
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
304
|
-
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
305
|
-
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
306
|
-
viewBackgroundColor: string;
|
|
307
|
-
scrollX: number;
|
|
308
|
-
scrollY: number;
|
|
309
|
-
scrollConstraints: import("../types").ScrollConstraints | null;
|
|
310
|
-
cursorButton: "up" | "down";
|
|
311
|
-
scrolledOutside: boolean;
|
|
312
|
-
name: string | null;
|
|
313
|
-
isResizing: boolean;
|
|
314
|
-
isRotating: boolean;
|
|
315
|
-
zoom: import("../types").Zoom;
|
|
316
|
-
openMenu: "canvas" | null;
|
|
317
|
-
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
318
|
-
openSidebar: {
|
|
319
|
-
name: import("../types").SidebarName;
|
|
320
|
-
tab?: import("../types").SidebarTabName;
|
|
321
|
-
} | null;
|
|
322
|
-
openDialog: null | {
|
|
323
|
-
name: "imageExport" | "help" | "jsonExport";
|
|
324
|
-
} | {
|
|
325
|
-
name: "ttd";
|
|
326
|
-
tab: "text-to-diagram" | "mermaid";
|
|
327
|
-
} | {
|
|
328
|
-
name: "commandPalette";
|
|
329
|
-
} | {
|
|
330
|
-
name: "settings";
|
|
331
|
-
} | {
|
|
332
|
-
name: "elementLinkSelector";
|
|
333
|
-
sourceElementId: ExcalidrawElement["id"];
|
|
334
|
-
} | {
|
|
335
|
-
name: "charts";
|
|
336
|
-
data: import("../charts").Spreadsheet;
|
|
337
|
-
rawText: string;
|
|
338
|
-
};
|
|
339
|
-
defaultSidebarDockedPreference: boolean;
|
|
340
|
-
lastPointerDownWith: import("@excalidraw/element/types").PointerType;
|
|
341
|
-
hoveredElementIds: Readonly<{
|
|
342
|
-
[id: string]: true;
|
|
343
|
-
}>;
|
|
344
|
-
previousSelectedElementIds: {
|
|
345
|
-
[id: string]: true;
|
|
346
|
-
};
|
|
347
|
-
selectedElementsAreBeingDragged: boolean;
|
|
348
|
-
shouldCacheIgnoreZoom: boolean;
|
|
349
|
-
toast: {
|
|
350
|
-
message: React.ReactNode;
|
|
351
|
-
closable?: boolean;
|
|
352
|
-
duration?: number;
|
|
353
|
-
} | null;
|
|
354
|
-
zenModeEnabled: boolean;
|
|
355
|
-
theme: import("@excalidraw/element/types").Theme;
|
|
356
|
-
gridSize: number;
|
|
357
|
-
gridStep: number;
|
|
358
|
-
gridModeEnabled: boolean;
|
|
359
|
-
viewModeEnabled: boolean;
|
|
360
|
-
selectedGroupIds: {
|
|
361
|
-
[groupId: string]: boolean;
|
|
362
|
-
};
|
|
363
|
-
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
364
|
-
width: number;
|
|
365
|
-
height: number;
|
|
366
|
-
offsetTop: number;
|
|
367
|
-
offsetLeft: number;
|
|
368
|
-
fileHandle: FileSystemFileHandle | null;
|
|
369
|
-
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
370
|
-
stats: {
|
|
371
|
-
open: boolean;
|
|
372
|
-
panels: number;
|
|
373
|
-
};
|
|
374
|
-
showHyperlinkPopup: false | "info" | "editor";
|
|
375
|
-
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
376
|
-
snapLines: readonly import("../snapping").SnapLine[];
|
|
377
|
-
originSnapOffset: {
|
|
378
|
-
x: number;
|
|
379
|
-
y: number;
|
|
380
|
-
} | null;
|
|
381
|
-
objectsSnapModeEnabled: boolean;
|
|
382
|
-
isCropping: boolean;
|
|
383
|
-
croppingElementId: ExcalidrawElement["id"] | null;
|
|
384
|
-
searchMatches: Readonly<{
|
|
385
|
-
focusedId: ExcalidrawElement["id"] | null;
|
|
386
|
-
matches: readonly import("../types").SearchMatch[];
|
|
387
|
-
}> | null;
|
|
388
|
-
activeLockedId: string | null;
|
|
389
|
-
lockedMultiSelections: {
|
|
390
|
-
[groupId: string]: true;
|
|
391
|
-
};
|
|
392
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
393
|
-
colorTopPicks: {
|
|
394
|
-
elementStroke: readonly string[] | null;
|
|
395
|
-
elementBackground: readonly string[] | null;
|
|
396
|
-
bucketFill: readonly string[] | null;
|
|
397
|
-
stickyNoteStroke: readonly string[] | null;
|
|
398
|
-
stickyNoteBackground: readonly string[] | null;
|
|
399
|
-
};
|
|
400
|
-
fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
|
|
401
|
-
};
|
|
402
|
-
captureUpdate: "IMMEDIATELY";
|
|
403
|
-
};
|
|
225
|
+
predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: AppClassProperties) => boolean;
|
|
226
|
+
perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: AppClassProperties) => ActionResult;
|
|
404
227
|
} & {
|
|
405
228
|
keyTest?: undefined;
|
|
406
229
|
};
|
|
230
|
+
/** wraps each (unbound) text in a new container, selecting the containers */
|
|
231
|
+
export declare const wrapTextsInContainers: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, textElements: readonly ExcalidrawTextElement[], app: AppClassProperties) => ActionResult;
|
|
@@ -48,6 +48,11 @@ export declare const actionClearCanvas: {
|
|
|
48
48
|
};
|
|
49
49
|
name: string | null;
|
|
50
50
|
zoom: import("../types").Zoom;
|
|
51
|
+
isBindingEnabled: boolean;
|
|
52
|
+
isMidpointSnappingEnabled: boolean;
|
|
53
|
+
selectedElementIds: Readonly<{
|
|
54
|
+
[id: string]: true;
|
|
55
|
+
}>;
|
|
51
56
|
scrollX: number;
|
|
52
57
|
scrollY: number;
|
|
53
58
|
viewModeEnabled: boolean;
|
|
@@ -69,9 +74,6 @@ export declare const actionClearCanvas: {
|
|
|
69
74
|
rawText: string;
|
|
70
75
|
};
|
|
71
76
|
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
72
|
-
selectedElementIds: Readonly<{
|
|
73
|
-
[id: string]: true;
|
|
74
|
-
}>;
|
|
75
77
|
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
76
78
|
activeEmbeddable: {
|
|
77
79
|
element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
|
|
@@ -84,8 +86,6 @@ export declare const actionClearCanvas: {
|
|
|
84
86
|
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
85
87
|
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
86
88
|
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
87
|
-
isBindingEnabled: boolean;
|
|
88
|
-
isMidpointSnappingEnabled: boolean;
|
|
89
89
|
suggestedBinding: {
|
|
90
90
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
91
91
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
@@ -120,7 +120,6 @@ export declare const actionClearCanvas: {
|
|
|
120
120
|
shouldCacheIgnoreZoom: boolean;
|
|
121
121
|
exportScale: number;
|
|
122
122
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
123
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
124
123
|
contextMenu: {
|
|
125
124
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
126
125
|
top: number;
|
|
@@ -188,6 +187,7 @@ export declare const actionClearCanvas: {
|
|
|
188
187
|
lockedMultiSelections: {
|
|
189
188
|
[groupId: string]: true;
|
|
190
189
|
};
|
|
190
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
191
191
|
};
|
|
192
192
|
captureUpdate: "IMMEDIATELY";
|
|
193
193
|
};
|