@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
|
@@ -13,8 +13,8 @@ export declare const actionGroup: {
|
|
|
13
13
|
captureUpdate: "EVENTUALLY";
|
|
14
14
|
} | {
|
|
15
15
|
appState: {
|
|
16
|
-
editingGroupId: import("../types").AppState["editingGroupId"];
|
|
17
16
|
selectedElementIds: import("../types").AppState["selectedElementIds"];
|
|
17
|
+
editingGroupId: import("../types").AppState["editingGroupId"];
|
|
18
18
|
selectedGroupIds: import("../types").AppState["selectedGroupIds"];
|
|
19
19
|
contextMenu: {
|
|
20
20
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
@@ -210,8 +210,8 @@ export declare const actionUngroup: {
|
|
|
210
210
|
captureUpdate: "EVENTUALLY";
|
|
211
211
|
} | {
|
|
212
212
|
appState: {
|
|
213
|
-
editingGroupId: import("../types").AppState["editingGroupId"];
|
|
214
213
|
selectedElementIds: import("../types").AppState["selectedElementIds"];
|
|
214
|
+
editingGroupId: import("../types").AppState["editingGroupId"];
|
|
215
215
|
selectedGroupIds: import("../types").AppState["selectedGroupIds"];
|
|
216
216
|
contextMenu: {
|
|
217
217
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
@@ -11,8 +11,8 @@ export declare const actionSelectAll: {
|
|
|
11
11
|
perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, value: unknown, app: import("../types").AppClassProperties) => false | {
|
|
12
12
|
appState: {
|
|
13
13
|
selectedLinearElement: LinearElementEditor | null;
|
|
14
|
-
editingGroupId: import("../types").AppState["editingGroupId"];
|
|
15
14
|
selectedElementIds: import("../types").AppState["selectedElementIds"];
|
|
15
|
+
editingGroupId: import("../types").AppState["editingGroupId"];
|
|
16
16
|
selectedGroupIds: import("../types").AppState["selectedGroupIds"];
|
|
17
17
|
contextMenu: {
|
|
18
18
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const actionToggleWrap: {
|
|
2
|
+
name: "toggleWrap";
|
|
3
|
+
label: string;
|
|
4
|
+
trackEvent: {
|
|
5
|
+
category: "element";
|
|
6
|
+
};
|
|
7
|
+
predicate: (elements: readonly import("@excalidraw/element/types").ExcalidrawElement[], appState: import("../types").AppState, _: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
|
|
8
|
+
perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: unknown, app: import("../types").AppClassProperties) => import("./types").ActionResult;
|
|
9
|
+
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: import("../types").AppState, elements: readonly import("@excalidraw/element/types").ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean;
|
|
10
|
+
} & {
|
|
11
|
+
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: import("../types").AppState, elements: readonly import("@excalidraw/element/types").ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean) | undefined;
|
|
12
|
+
};
|
|
@@ -24,6 +24,7 @@ export { actionToggleMidpointSnapping } from "./actionToggleMidpointSnapping";
|
|
|
24
24
|
export { actionToggleShowHints } from "./actionToggleShowHints";
|
|
25
25
|
export { actionToggleStats } from "./actionToggleStats";
|
|
26
26
|
export { actionUnbindText, actionBindText } from "./actionBoundText";
|
|
27
|
+
export { actionToggleWrap } from "./actionToggleWrap";
|
|
27
28
|
export { actionLink } from "./actionLink";
|
|
28
29
|
export { actionToggleElementLock } from "./actionElementLock";
|
|
29
30
|
export { actionToggleLinearEditor } from "./actionLinearEditor";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SubtypeOf } from "@excalidraw/common/utility-types";
|
|
2
2
|
import type { ActionName } from "./types";
|
|
3
|
-
export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts" | "wrapSelectionInFrame"> | "saveScene" | "imageExport" | "commandPalette" | "searchMenu" | "toolLock";
|
|
3
|
+
export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts" | "wrapSelectionInFrame" | "toggleWrap"> | "saveScene" | "imageExport" | "commandPalette" | "searchMenu" | "toolLock";
|
|
4
4
|
export declare const getShortcutFromShortcutName: (name: ShortcutName, idx?: number) => string;
|
|
@@ -14,7 +14,7 @@ export type ActionResult = {
|
|
|
14
14
|
type ActionFn<TData = any> = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: TData | undefined, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
15
15
|
export type UpdaterFn = (res: ActionResult) => void;
|
|
16
16
|
export type ActionFilterFn = (action: Action) => void;
|
|
17
|
-
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "showHints" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeBucketFillBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "toggleShapeSwitch" | "togglePolygon";
|
|
17
|
+
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "showHints" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeBucketFillBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "toggleWrap" | "toggleShapeSwitch" | "togglePolygon";
|
|
18
18
|
export type PanelComponentProps = {
|
|
19
19
|
elements: readonly ExcalidrawElement[];
|
|
20
20
|
appState: UIAppState;
|
|
@@ -7,12 +7,14 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
7
7
|
zoom?: Readonly<{
|
|
8
8
|
value: NormalizedZoomValue;
|
|
9
9
|
}> | undefined;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
editingGroupId?: string | null | undefined;
|
|
10
|
+
isBindingEnabled?: boolean | undefined;
|
|
11
|
+
isMidpointSnappingEnabled?: boolean | undefined;
|
|
13
12
|
selectedElementIds?: Readonly<{
|
|
14
13
|
[id: string]: true;
|
|
15
14
|
}> | undefined;
|
|
15
|
+
scrollX?: number | undefined;
|
|
16
|
+
scrollY?: number | undefined;
|
|
17
|
+
editingGroupId?: string | null | undefined;
|
|
16
18
|
activeTool?: ({
|
|
17
19
|
lastActiveTool: import("./types").ActiveTool | null;
|
|
18
20
|
locked: boolean;
|
|
@@ -22,15 +24,11 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
22
24
|
[groupId: string]: boolean;
|
|
23
25
|
} | undefined;
|
|
24
26
|
selectedLinearElement?: import("@excalidraw/element").LinearElementEditor | null | undefined;
|
|
25
|
-
isBindingEnabled?: boolean | undefined;
|
|
26
|
-
isMidpointSnappingEnabled?: boolean | undefined;
|
|
27
27
|
gridModeEnabled?: boolean | undefined;
|
|
28
28
|
zenModeEnabled?: boolean | undefined;
|
|
29
29
|
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
30
30
|
exportScale?: number | undefined;
|
|
31
31
|
currentItemArrowType?: "round" | "sharp" | "elbow" | undefined;
|
|
32
|
-
gridSize?: number | undefined;
|
|
33
|
-
bindMode?: import("@excalidraw/element/types").BindMode | undefined;
|
|
34
32
|
showWelcomeScreen?: boolean | undefined;
|
|
35
33
|
boxSelectionMode?: import("./types").BoxSelectionMode | undefined;
|
|
36
34
|
bindingPreference?: "enabled" | "disabled" | undefined;
|
|
@@ -73,6 +71,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
73
71
|
previousSelectedElementIds?: {
|
|
74
72
|
[id: string]: true;
|
|
75
73
|
} | undefined;
|
|
74
|
+
gridSize?: number | undefined;
|
|
76
75
|
gridStep?: number | undefined;
|
|
77
76
|
stats?: {
|
|
78
77
|
open: boolean;
|
|
@@ -82,6 +81,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
82
81
|
lockedMultiSelections?: {
|
|
83
82
|
[groupId: string]: true;
|
|
84
83
|
} | undefined;
|
|
84
|
+
bindMode?: import("@excalidraw/element/types").BindMode | undefined;
|
|
85
85
|
colorTopPicks?: {
|
|
86
86
|
elementStroke: readonly string[] | null;
|
|
87
87
|
elementBackground: readonly string[] | null;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { RenderEnvironment } from "@excalidraw/element";
|
|
1
2
|
import type { ChartElements, Spreadsheet } from "./charts.types";
|
|
2
|
-
export declare const renderBarChart: (spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number) => ChartElements;
|
|
3
|
+
export declare const renderBarChart: (spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number, renderEnvironment?: RenderEnvironment) => ChartElements;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getFontString } from "@excalidraw/common";
|
|
2
|
+
import type { RenderEnvironment } from "@excalidraw/element";
|
|
2
3
|
import type { ChartType } from "@excalidraw/element/types";
|
|
3
4
|
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
4
5
|
import { type CartesianChartLayout, type CartesianChartType } from "./charts.constants";
|
|
@@ -20,13 +21,13 @@ export declare const getRadarValueScale: (series: SpreadsheetSeries[], _labelsLe
|
|
|
20
21
|
renderSteps: boolean;
|
|
21
22
|
normalize: (value: number, _axisIndex: number) => number;
|
|
22
23
|
};
|
|
23
|
-
export declare const getRadarDisplayText: (text: string, fontString: ReturnType<typeof getFontString>, maxWidth: number) => string;
|
|
24
|
-
export declare const createRadarAxisLabels: (labels: readonly string[], angles: readonly number[], centerX: number, centerY: number, radius: number, backgroundColor: string) => {
|
|
24
|
+
export declare const getRadarDisplayText: (text: string, fontString: ReturnType<typeof getFontString>, maxWidth: number, renderEnvironment?: RenderEnvironment) => string;
|
|
25
|
+
export declare const createRadarAxisLabels: (labels: readonly string[], angles: readonly number[], centerX: number, centerY: number, radius: number, backgroundColor: string, renderEnvironment?: RenderEnvironment) => {
|
|
25
26
|
axisLabels: ChartElements;
|
|
26
27
|
axisLabelTopY: number;
|
|
27
28
|
axisLabelBottomY: number;
|
|
28
29
|
};
|
|
29
|
-
export declare const createSeriesLegend: (series: SpreadsheetSeries[], seriesColors: readonly string[], centerX: number, minLegendTopY: number, fallbackLegendY: number, backgroundColor: string) => ChartElements;
|
|
30
|
+
export declare const createSeriesLegend: (series: SpreadsheetSeries[], seriesColors: readonly string[], centerX: number, minLegendTopY: number, fallbackLegendY: number, backgroundColor: string, renderEnvironment?: RenderEnvironment) => ChartElements;
|
|
30
31
|
export declare const getRotatedTextElementBottom: (element: NonDeletedExcalidrawElement) => number;
|
|
31
|
-
export declare const chartXLabels: (spreadsheet: Spreadsheet, x: number, y: number, backgroundColor: string, layout: CartesianChartLayout) => ChartElements;
|
|
32
|
-
export declare const chartBaseElements: (spreadsheet: Spreadsheet, x: number, y: number, backgroundColor: string, layout: CartesianChartLayout, maxValue?: number, debug?: boolean) => ChartElements;
|
|
32
|
+
export declare const chartXLabels: (spreadsheet: Spreadsheet, x: number, y: number, backgroundColor: string, layout: CartesianChartLayout, renderEnvironment?: RenderEnvironment) => ChartElements;
|
|
33
|
+
export declare const chartBaseElements: (spreadsheet: Spreadsheet, x: number, y: number, backgroundColor: string, layout: CartesianChartLayout, maxValue?: number, debug?: boolean, renderEnvironment?: RenderEnvironment) => ChartElements;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { RenderEnvironment } from "@excalidraw/element";
|
|
1
2
|
import type { ChartElements, Spreadsheet } from "./charts.types";
|
|
2
|
-
export declare const renderLineChart: (spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number) => ChartElements;
|
|
3
|
+
export declare const renderLineChart: (spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number, renderEnvironment?: RenderEnvironment) => ChartElements;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { RenderEnvironment } from "@excalidraw/element";
|
|
1
2
|
import type { ChartElements, Spreadsheet } from "./charts.types";
|
|
2
|
-
export declare const renderRadarChart: (spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number) => ChartElements | null;
|
|
3
|
+
export declare const renderRadarChart: (spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number, renderEnvironment?: RenderEnvironment) => ChartElements | null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ChartType } from "@excalidraw/element/types";
|
|
2
|
+
import type { RenderEnvironment } from "@excalidraw/element";
|
|
2
3
|
import { tryParseCells, tryParseNumber, tryParseSpreadsheet } from "./charts.parse";
|
|
3
4
|
import type { ChartElements, Spreadsheet } from "./charts.types";
|
|
4
5
|
export { type ParseSpreadsheetResult, type Spreadsheet, type SpreadsheetSeries, type ChartElements, } from "./charts.types";
|
|
5
6
|
export { isSpreadsheetValidForChartType } from "./charts.helpers";
|
|
6
7
|
export { tryParseCells, tryParseNumber, tryParseSpreadsheet };
|
|
7
|
-
export declare const renderSpreadsheet: (chartType: ChartType, spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number) => ChartElements | null;
|
|
8
|
+
export declare const renderSpreadsheet: (chartType: ChartType, spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number, renderEnvironment?: RenderEnvironment) => ChartElements | null;
|
|
@@ -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";
|
|
@@ -24,9 +24,14 @@ import { AppCursor } from "./App.cursor";
|
|
|
24
24
|
import { AppDrawShape } from "./App.drawshape";
|
|
25
25
|
import { AppDuplicate } from "./App.duplicate";
|
|
26
26
|
import { AppFlowchart } from "./App.flowchart";
|
|
27
|
+
import { AppModifiers } from "./App.modifiers";
|
|
27
28
|
import { AppPan } from "./App.pan";
|
|
28
29
|
import { AppViewport } from "./App.viewport";
|
|
29
30
|
import { AppWheel } from "./App.wheel";
|
|
31
|
+
import { AppSelection } from "./App.selection";
|
|
32
|
+
import { AppSelectionTool } from "./App.selectionTool";
|
|
33
|
+
import { AppWrap } from "./App.wrap";
|
|
34
|
+
import { AppHost } from "./App.host";
|
|
30
35
|
import { CursorHints } from "./CursorHint";
|
|
31
36
|
import { type OnStateChange } from "./AppStateObserver";
|
|
32
37
|
import type { ExportedElements } from "../data";
|
|
@@ -92,6 +97,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
92
97
|
private zenModeTransitionTimer;
|
|
93
98
|
get ownerDocument(): Document;
|
|
94
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;
|
|
95
108
|
scene: Scene;
|
|
96
109
|
fonts: Fonts;
|
|
97
110
|
renderer: Renderer;
|
|
@@ -140,6 +153,9 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
140
153
|
text: AppText;
|
|
141
154
|
viewport: AppViewport;
|
|
142
155
|
wheel: AppWheel;
|
|
156
|
+
selection: AppSelection;
|
|
157
|
+
selectionTool: AppSelectionTool;
|
|
158
|
+
wrap: AppWrap;
|
|
143
159
|
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
144
160
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
145
161
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
@@ -159,11 +175,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
159
175
|
y: number;
|
|
160
176
|
} | null;
|
|
161
177
|
private lastCompletedCanvasClicks;
|
|
162
|
-
/** previous frame pointer coords */
|
|
163
|
-
previousPointerMoveCoords: {
|
|
164
|
-
x: number;
|
|
165
|
-
y: number;
|
|
166
|
-
} | null;
|
|
167
178
|
drawShape: AppDrawShape;
|
|
168
179
|
laserTrails: LaserTrails;
|
|
169
180
|
eraserTrail: EraserTrail;
|
|
@@ -206,6 +217,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
206
217
|
element: NonDeleted<ExcalidrawElement> | null;
|
|
207
218
|
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
208
219
|
wasAddedToSelection: boolean;
|
|
220
|
+
cycleTarget: NonDeleted<ExcalidrawElement> | null;
|
|
209
221
|
hasBeenDuplicated: boolean;
|
|
210
222
|
advancedListMarkers: readonly import("@excalidraw/element").ListMarkerAdvance[];
|
|
211
223
|
editedTextId: import("@excalidraw/element/types").ExcalidrawTextElement["id"] | null;
|
|
@@ -223,6 +235,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
223
235
|
x: number;
|
|
224
236
|
y: number;
|
|
225
237
|
};
|
|
238
|
+
lastOffset: {
|
|
239
|
+
x: number;
|
|
240
|
+
y: number;
|
|
241
|
+
};
|
|
226
242
|
blockDragging: boolean;
|
|
227
243
|
};
|
|
228
244
|
eventListeners: {
|
|
@@ -271,6 +287,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
271
287
|
element: NonDeleted<ExcalidrawElement> | null;
|
|
272
288
|
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
273
289
|
wasAddedToSelection: boolean;
|
|
290
|
+
cycleTarget: NonDeleted<ExcalidrawElement> | null;
|
|
274
291
|
hasBeenDuplicated: boolean;
|
|
275
292
|
advancedListMarkers: readonly import("@excalidraw/element").ListMarkerAdvance[];
|
|
276
293
|
editedTextId: import("@excalidraw/element/types").ExcalidrawTextElement["id"] | null;
|
|
@@ -288,6 +305,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
288
305
|
x: number;
|
|
289
306
|
y: number;
|
|
290
307
|
};
|
|
308
|
+
lastOffset: {
|
|
309
|
+
x: number;
|
|
310
|
+
y: number;
|
|
311
|
+
};
|
|
291
312
|
blockDragging: boolean;
|
|
292
313
|
};
|
|
293
314
|
eventListeners: {
|
|
@@ -306,6 +327,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
306
327
|
}>]>;
|
|
307
328
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
308
329
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
330
|
+
modifiers: AppModifiers;
|
|
309
331
|
api: ExcalidrawImperativeAPI;
|
|
310
332
|
private elementRenderOverrides;
|
|
311
333
|
/** offsets of `elementRenderOverrides`; keeps its identity while they don't change */
|
|
@@ -604,7 +626,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
604
626
|
private onGestureStart;
|
|
605
627
|
private onGestureChange;
|
|
606
628
|
private onGestureEnd;
|
|
607
|
-
deselectElements(): void;
|
|
608
629
|
getElementAtPosition(x: number, y: number, opts?: ({
|
|
609
630
|
includeBoundTextElement?: boolean;
|
|
610
631
|
includeLockedElements?: boolean;
|
|
@@ -625,11 +646,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
625
646
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
626
647
|
hitElement(x: number, y: number, element: NonDeletedExcalidrawElement, considerBoundingBox?: boolean): boolean;
|
|
627
648
|
private startImageCropping;
|
|
628
|
-
|
|
649
|
+
finishImageCropping: () => void;
|
|
629
650
|
private shouldHandleBrowserCanvasDoubleClick;
|
|
630
651
|
private handleCanvasDoubleClick;
|
|
631
652
|
private handleCanvasClick;
|
|
632
|
-
|
|
653
|
+
getElementLinkAtPosition: (scenePointer: Readonly<{
|
|
654
|
+
x: number;
|
|
655
|
+
y: number;
|
|
656
|
+
}>, hitElementMightBeLocked: NonDeletedExcalidrawElement | null) => NonDeletedExcalidrawElement | undefined;
|
|
633
657
|
private handleElementLinkClick;
|
|
634
658
|
/**
|
|
635
659
|
* Applies (or clears) the element-link hover affordances — pointer cursor
|
|
@@ -669,7 +693,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
669
693
|
excludeElementIds?: AppState["selectedElementIds"];
|
|
670
694
|
currentFrameId?: ExcalidrawElement["frameId"];
|
|
671
695
|
}) => NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
672
|
-
|
|
696
|
+
updateFrameToHighlight: (frameToHighlight: AppState["frameToHighlight"]) => void;
|
|
673
697
|
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
674
698
|
insertNewElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
675
699
|
insertNewElement: (element: ExcalidrawElement) => void;
|
|
@@ -706,13 +730,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
706
730
|
private updateMultiTouchGesture;
|
|
707
731
|
private initialPointerDownState;
|
|
708
732
|
private handleDraggingScrollBar;
|
|
709
|
-
private clearSelectionIfNotUsingSelection;
|
|
710
|
-
/**
|
|
711
|
-
* @returns whether the pointer event has been completely handled
|
|
712
|
-
*/
|
|
713
|
-
private handleSelectionOnPointerDown;
|
|
714
|
-
private isASelectedElement;
|
|
715
|
-
private isHittingCommonBoundingBoxOfSelectedElements;
|
|
716
733
|
private handleFreeDrawElementOnPointerDown;
|
|
717
734
|
insertIframeElement: ({ sceneX, sceneY, width, height, }: {
|
|
718
735
|
sceneX: number;
|
|
@@ -759,7 +776,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
759
776
|
/** generally you should use `addNewImagesToImageCache()` directly if you need
|
|
760
777
|
* to render new images. This is just a failsafe */
|
|
761
778
|
private scheduleImageRefresh;
|
|
762
|
-
private clearSelection;
|
|
763
779
|
private handleInteractiveCanvasRef;
|
|
764
780
|
insertImages: (imageFiles: File[], sceneX: number, sceneY: number) => Promise<void>;
|
|
765
781
|
private handleAppOnDrop;
|
|
@@ -777,8 +793,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
777
793
|
pointerType?: string;
|
|
778
794
|
}) => void;
|
|
779
795
|
maybeDragNewGenericElement: (pointerDownState: PointerDownState, event: MouseEvent | KeyboardEvent, informMutation?: boolean) => void;
|
|
780
|
-
private maybeHandleCrop;
|
|
781
|
-
private maybeHandleResize;
|
|
782
796
|
private getContextMenuItems;
|
|
783
797
|
savePointer: (x: number, y: number, button: "up" | "down") => void;
|
|
784
798
|
resetShouldCacheIgnoreZoomDebounced: {
|
|
@@ -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,38 @@
|
|
|
1
|
+
import { Emitter } from "@excalidraw/common";
|
|
2
|
+
export type HeldModifiers = Readonly<{
|
|
3
|
+
alt: boolean;
|
|
4
|
+
shift: boolean;
|
|
5
|
+
/** Ctrl, or Cmd on macOS */
|
|
6
|
+
ctrlOrCmd: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* The modifier keys held over the editor, synced from the flags of its
|
|
10
|
+
* keyboard and pointer events. Kept out of appState so that pressing one
|
|
11
|
+
* re-renders only its subscribers (e.g. the hint).
|
|
12
|
+
*/
|
|
13
|
+
export declare class AppModifiers {
|
|
14
|
+
private held;
|
|
15
|
+
/** fires with a new snapshot whenever a modifier is pressed or released */
|
|
16
|
+
readonly onChange: Emitter<[held: Readonly<{
|
|
17
|
+
alt: boolean;
|
|
18
|
+
shift: boolean;
|
|
19
|
+
/** Ctrl, or Cmd on macOS */
|
|
20
|
+
ctrlOrCmd: boolean;
|
|
21
|
+
}>]>;
|
|
22
|
+
get: () => HeldModifiers;
|
|
23
|
+
/**
|
|
24
|
+
* A hook re-rendering on the held modifiers: all of them, or with
|
|
25
|
+
* `modifier`, only on that one being pressed or released.
|
|
26
|
+
*/
|
|
27
|
+
useHeld(): HeldModifiers;
|
|
28
|
+
useHeld(modifier: keyof HeldModifiers): boolean;
|
|
29
|
+
sync: (event: {
|
|
30
|
+
altKey: boolean;
|
|
31
|
+
shiftKey: boolean;
|
|
32
|
+
ctrlKey: boolean;
|
|
33
|
+
metaKey: boolean;
|
|
34
|
+
}) => void;
|
|
35
|
+
/** releases them all — e.g. on blur, as Alt+Tab never delivers the keyup */
|
|
36
|
+
reset: () => void;
|
|
37
|
+
private set;
|
|
38
|
+
}
|