@excalidraw/math 0.18.0-2b1c2a9 → 0.18.0-2c3dcc0
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/dev/index.js +8 -2
- package/dist/dev/index.js.map +2 -2
- package/dist/prod/index.js +1 -1
- package/dist/types/common/src/colors.d.ts +3 -0
- package/dist/types/common/src/constants.d.ts +56 -0
- package/dist/types/common/src/keys.d.ts +4 -0
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utils.d.ts +12 -1
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/align.d.ts +4 -1
- package/dist/types/element/src/binding.d.ts +75 -7
- package/dist/types/element/src/bounds.d.ts +10 -2
- package/dist/types/element/src/collision.d.ts +21 -5
- package/dist/types/element/src/comparisons.d.ts +5 -3
- package/dist/types/element/src/cropElement.d.ts +36 -4
- package/dist/types/element/src/delta.d.ts +30 -2
- 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/duplicate.d.ts +60 -0
- 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 +6 -8
- package/dist/types/element/src/frame.d.ts +21 -3
- 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 +3 -0
- package/dist/types/element/src/linearElementEditor.d.ts +4 -1
- package/dist/types/element/src/listMarker.d.ts +39 -0
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +40 -3
- package/dist/types/element/src/renderElement.d.ts +31 -4
- 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 +4 -10
- package/dist/types/element/src/shape.d.ts +17 -1
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/stickyNote.d.ts +191 -0
- package/dist/types/element/src/textElement.d.ts +10 -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 +30 -7
- package/dist/types/element/src/typeChecks.d.ts +3 -2
- package/dist/types/element/src/types.d.ts +28 -6
- package/dist/types/element/src/utils.d.ts +8 -1
- package/dist/types/element/src/zindex.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +48 -3
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +62 -208
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +121 -16
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +32 -2
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -546
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +20 -2
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +32 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +39 -9
- package/dist/types/excalidraw/actions/actionFrame.d.ts +92 -479
- package/dist/types/excalidraw/actions/actionGroup.d.ts +34 -4
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +66 -2
- package/dist/types/excalidraw/actions/actionLink.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionMenu.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionProperties.d.ts +42 -8
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +17 -2
- package/dist/types/excalidraw/actions/actionStyles.d.ts +17 -2
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +452 -6
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +198 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +16 -1
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +3 -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 +26 -8
- 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 +10 -2
- package/dist/types/excalidraw/components/App.arrowText.d.ts +5 -39
- package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
- package/dist/types/excalidraw/components/App.d.ts +129 -218
- package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
- 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.pan.d.ts +62 -0
- package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
- package/dist/types/excalidraw/components/App.selectionTool.d.ts +94 -0
- package/dist/types/excalidraw/components/App.text.d.ts +194 -0
- package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
- package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +64 -4
- package/dist/types/excalidraw/components/App.wheel.d.ts +30 -0
- package/dist/types/excalidraw/components/App.wrap.d.ts +39 -0
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -1
- package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
- package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
- package/dist/types/excalidraw/components/IconButton.d.ts +2 -0
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
- 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/Tools.d.ts +7 -2
- package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +0 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
- 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 +2 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +3 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +2 -2
- package/dist/types/excalidraw/data/blob.d.ts +46 -16
- package/dist/types/excalidraw/data/index.d.ts +3 -3
- package/dist/types/excalidraw/data/json.d.ts +23 -8
- 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/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/animation.d.ts +11 -4
- package/dist/types/excalidraw/renderer/helpers.d.ts +18 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +64 -3
- package/dist/types/excalidraw/scene/export.d.ts +343 -20
- package/dist/types/excalidraw/scene/index.d.ts +1 -1
- package/dist/types/excalidraw/scene/types.d.ts +26 -2
- package/dist/types/excalidraw/types.d.ts +191 -22
- package/dist/types/excalidraw/viewport.d.ts +29 -1
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -1
- package/dist/types/utils/src/index.d.ts +3 -1
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +2 -2
- package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +0 -31
- package/dist/types/utils/src/export.d.ts +0 -35
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ColorPaletteCustom, ColorTuple } from "@excalidraw/common";
|
|
2
|
+
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
|
+
import type { AppState } from "../types";
|
|
4
|
+
export type ColorProperty = "strokeColor" | "backgroundColor";
|
|
5
|
+
/**
|
|
6
|
+
* Sticky notes are their own color domain: own defaults, own top picks, no
|
|
7
|
+
* transparent. A pick targets the regular domain, the sticky domain, or both
|
|
8
|
+
* ("mixed" selections write both defaults and use the regular picker).
|
|
9
|
+
*/
|
|
10
|
+
export type ColorTargetKind = "regular" | "sticky" | "mixed";
|
|
11
|
+
export type ColorDefaultKey = "currentItemStrokeColor" | "currentItemBackgroundColor" | "currentItemStickynoteStrokeColor" | "currentItemStickynoteBackgroundColor";
|
|
12
|
+
export type ColorTargetAppState = Pick<AppState, "selectedElementIds" | "editingTextElement" | "activeTool" | ColorDefaultKey>;
|
|
13
|
+
export type ColorTarget = {
|
|
14
|
+
kind: ColorTargetKind;
|
|
15
|
+
property: ColorProperty;
|
|
16
|
+
/** the current-item defaults a pick is written to (normalized per domain) */
|
|
17
|
+
appStateKeys: readonly ColorDefaultKey[];
|
|
18
|
+
/** the default shown when no element is targeted */
|
|
19
|
+
currentValue: string;
|
|
20
|
+
palette: ColorPaletteCustom;
|
|
21
|
+
topPicks: ColorTuple;
|
|
22
|
+
customizableTopPicks: keyof AppState["colorTopPicks"];
|
|
23
|
+
excludedColors: readonly string[] | undefined;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Who a stroke/background pick targets. Resolve it from the state an action
|
|
27
|
+
* runs against, at execution time — never capture it in a render closure:
|
|
28
|
+
* the memoized picker keeps a stale `onChange`, and the always-visible top
|
|
29
|
+
* picks fire it without a re-render.
|
|
30
|
+
*
|
|
31
|
+
* Targets are the selected color-capable elements (for stroke incl. bound
|
|
32
|
+
* labels, since a note's visible text is its label) plus the text being
|
|
33
|
+
* edited (`handleTextWysiwyg` deselects while editing) — or, for a
|
|
34
|
+
* background pick on a note's label, the note (see `getColorTargetElement`).
|
|
35
|
+
* With no target, the active tool decides the domain.
|
|
36
|
+
*/
|
|
37
|
+
export declare const resolveColorTarget: (appState: ColorTargetAppState, elements: readonly ExcalidrawElement[], property: ColorProperty) => ColorTarget;
|
|
38
|
+
/** the current-item default updates for a picked color */
|
|
39
|
+
export declare const getColorTargetAppStateUpdates: (target: ColorTarget, color: string) => Partial<AppState>;
|
|
@@ -21,8 +21,11 @@ export { actionToggleZenMode } from "./actionToggleZenMode";
|
|
|
21
21
|
export { actionToggleObjectsSnapMode } from "./actionToggleObjectsSnapMode";
|
|
22
22
|
export { actionToggleArrowBinding } from "./actionToggleArrowBinding";
|
|
23
23
|
export { actionToggleMidpointSnapping } from "./actionToggleMidpointSnapping";
|
|
24
|
+
export { actionToggleShowHints } from "./actionToggleShowHints";
|
|
24
25
|
export { actionToggleStats } from "./actionToggleStats";
|
|
26
|
+
export { actionToggleMinimap } from "./actionToggleMinimap";
|
|
25
27
|
export { actionUnbindText, actionBindText } from "./actionBoundText";
|
|
28
|
+
export { actionToggleWrap } from "./actionToggleWrap";
|
|
26
29
|
export { actionLink } from "./actionLink";
|
|
27
30
|
export { actionToggleElementLock } from "./actionElementLock";
|
|
28
31
|
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" | "autoResize"> | "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" | "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" | "minimap" | "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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppState, NormalizedZoomValue } from "./types";
|
|
1
|
+
import type { AppState, InputDevice, NormalizedZoomValue } from "./types";
|
|
2
2
|
export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
3
3
|
export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
|
|
4
4
|
viewBackgroundColor?: string | undefined;
|
|
@@ -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,18 +24,16 @@ 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;
|
|
35
|
+
showHints?: boolean | undefined;
|
|
36
|
+
inputDevice?: InputDevice | undefined;
|
|
37
37
|
preferredSelectionTool?: {
|
|
38
38
|
type: "selection" | "lasso";
|
|
39
39
|
initialized: boolean;
|
|
@@ -44,6 +44,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
44
44
|
exportEmbedScene?: boolean | undefined;
|
|
45
45
|
exportWithDarkMode?: boolean | undefined;
|
|
46
46
|
currentItemStrokeColor?: string | undefined;
|
|
47
|
+
currentItemStickynoteStrokeColor?: string | undefined;
|
|
48
|
+
currentItemStickynoteBackgroundColor?: string | undefined;
|
|
47
49
|
currentItemBackgroundColor?: string | undefined;
|
|
48
50
|
currentItemFillStyle?: import("@excalidraw/element/types").FillStyle | undefined;
|
|
49
51
|
currentItemStrokeWidthKey?: import("@excalidraw/common").StrokeWidthKey | undefined;
|
|
@@ -69,6 +71,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
69
71
|
previousSelectedElementIds?: {
|
|
70
72
|
[id: string]: true;
|
|
71
73
|
} | undefined;
|
|
74
|
+
minimapEnabled?: boolean | undefined;
|
|
75
|
+
gridSize?: number | undefined;
|
|
72
76
|
gridStep?: number | undefined;
|
|
73
77
|
stats?: {
|
|
74
78
|
open: boolean;
|
|
@@ -78,11 +82,15 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
78
82
|
lockedMultiSelections?: {
|
|
79
83
|
[groupId: string]: true;
|
|
80
84
|
} | undefined;
|
|
85
|
+
bindMode?: import("@excalidraw/element/types").BindMode | undefined;
|
|
81
86
|
colorTopPicks?: {
|
|
82
87
|
elementStroke: readonly string[] | null;
|
|
83
88
|
elementBackground: readonly string[] | null;
|
|
84
89
|
bucketFill: readonly string[] | null;
|
|
90
|
+
stickyNoteStroke: readonly string[] | null;
|
|
91
|
+
stickyNoteBackground: readonly string[] | null;
|
|
85
92
|
} | undefined;
|
|
93
|
+
fontTopPicks?: readonly number[] | null | undefined;
|
|
86
94
|
};
|
|
87
95
|
export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
|
|
88
96
|
viewBackgroundColor?: string | undefined;
|
|
@@ -108,3 +116,13 @@ export declare const isEraserActive: ({ activeTool, }: {
|
|
|
108
116
|
export declare const isHandToolActive: ({ activeTool, }: {
|
|
109
117
|
activeTool: AppState["activeTool"];
|
|
110
118
|
}) => boolean;
|
|
119
|
+
/**
|
|
120
|
+
* The device the wheel mappings follow for the given preference.
|
|
121
|
+
*
|
|
122
|
+
* `auto` is meant to detect the device from the wheel events themselves
|
|
123
|
+
* (line vs. pixel delta modes, whole vs. fractional deltas, one vs. two axes
|
|
124
|
+
* moving, event cadence and momentum tails). That is not implemented yet, so
|
|
125
|
+
* it resolves to `trackpad` — the mapping the editor has always had, and the
|
|
126
|
+
* default to keep until detection exists.
|
|
127
|
+
*/
|
|
128
|
+
export declare const resolveInputDevice: (inputDevice: InputDevice) => Exclude<InputDevice, "auto">;
|
|
@@ -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;
|
|
@@ -36,8 +36,16 @@ export declare const MobileShapeActions: ({ appState, elementsMap, renderAction,
|
|
|
36
36
|
app: AppClassProperties;
|
|
37
37
|
setAppState: React.Component<any, AppState>["setState"];
|
|
38
38
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* The zoom level, opening a menu of the zoom actions, along with the minimap
|
|
41
|
+
* toggle. Without the minimap toggle (removed by the host's `ui` config), the
|
|
42
|
+
* zoom out / zoom level (resetting it) / zoom in buttons instead.
|
|
43
|
+
*/
|
|
44
|
+
export declare const ZoomActions: ({ actionManager, zoomUIEnabled, minimapUIEnabled, zenModeEnabled, }: {
|
|
45
|
+
actionManager: ActionManager;
|
|
46
|
+
zoomUIEnabled: boolean;
|
|
47
|
+
minimapUIEnabled: boolean;
|
|
48
|
+
zenModeEnabled: boolean;
|
|
41
49
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
42
50
|
export declare const UndoRedoActions: ({ renderAction, className, }: {
|
|
43
51
|
renderAction: ActionManager["renderAction"];
|
|
@@ -2,19 +2,16 @@ import { LinearElementEditor } from "@excalidraw/element";
|
|
|
2
2
|
import type { ArrowEndpoint } from "@excalidraw/element";
|
|
3
3
|
import type { ExcalidrawElement, ExcalidrawTextElement, FixedPoint, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
4
4
|
import type App from "./App";
|
|
5
|
-
import type {
|
|
5
|
+
import type { PointerDownState } from "../types";
|
|
6
6
|
/**
|
|
7
7
|
* Text ↔ arrow interactions.
|
|
8
8
|
*
|
|
9
|
-
* With the text tool: the
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* bound to the arrow) — and the endpoint-bound flavor of drag-sizing a new
|
|
13
|
-
* text.
|
|
9
|
+
* With the text tool: the free endpoint a click would bind a new text to
|
|
10
|
+
* (`AppTextTool` resolves and shows it), the binding itself, and the
|
|
11
|
+
* endpoint-bound flavor of drag-sizing a new text.
|
|
14
12
|
*
|
|
15
13
|
* With the selection tool: dragging an arrow's existing label along the arrow
|
|
16
|
-
* — the grab affordance
|
|
17
|
-
* editing a label the drag has moved.
|
|
14
|
+
* — the grab affordance and the drag itself.
|
|
18
15
|
*
|
|
19
16
|
* The scene-level logic lives in `@excalidraw/element`'s
|
|
20
17
|
* `arrowEndpointText.ts` and `linearElementEditor.ts`.
|
|
@@ -22,34 +19,12 @@ import type { AppState, PointerDownState } from "../types";
|
|
|
22
19
|
export declare class AppArrowText {
|
|
23
20
|
private app;
|
|
24
21
|
constructor(app: App);
|
|
25
|
-
/**
|
|
26
|
-
* With the text tool active, an arrow under the cursor is a target for
|
|
27
|
-
* attaching text. Returns where the text would land (if anywhere), and keeps
|
|
28
|
-
* `appState.hoveredArrowTextAnchor` — which drives the highlight — in sync.
|
|
29
|
-
*/
|
|
30
|
-
updateHoveredAnchor: (scenePointer: {
|
|
31
|
-
x: number;
|
|
32
|
-
y: number;
|
|
33
|
-
}) => AppState["hoveredArrowTextAnchor"];
|
|
34
|
-
/**
|
|
35
|
-
* Re-evaluates the hovered anchor at the last known pointer position — for
|
|
36
|
-
* events that change what a click would do without the pointer moving,
|
|
37
|
-
* i.e. the ctrl/cmd binding toggle. (Events that invalidate the anchor
|
|
38
|
-
* wholesale — tool switches, finalize, deselect — clear it directly
|
|
39
|
-
* instead.)
|
|
40
|
-
*/
|
|
41
|
-
refresh: () => void;
|
|
42
22
|
/**
|
|
43
23
|
* A free arrow endpoint a new text could be bound to. Binding an endpoint is
|
|
44
24
|
* an arrow binding, so it follows the binding toggle (ctrl/cmd) like every
|
|
45
25
|
* other one — holding it makes the text tool drop plain text instead.
|
|
46
26
|
*/
|
|
47
27
|
getBindableEndpointAtPosition(x: number, y: number): ArrowEndpoint | null;
|
|
48
|
-
/**
|
|
49
|
-
* Mirrors what `handleTextOnPointerDown` would do at this position, so the
|
|
50
|
-
* highlight can't promise something the click won't deliver.
|
|
51
|
-
*/
|
|
52
|
-
private getAnchorAtPosition;
|
|
53
28
|
/**
|
|
54
29
|
* How a text should be created to read as a label for this endpoint — the
|
|
55
30
|
* side midpoint to bind, the alignment that pins it, and the scene position
|
|
@@ -92,13 +67,4 @@ export declare class AppArrowText {
|
|
|
92
67
|
x: number;
|
|
93
68
|
y: number;
|
|
94
69
|
}): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Where a double-click on a labeled arrow should start text editing: the
|
|
97
|
-
* center of the label itself, which a label drag may have moved away from
|
|
98
|
-
* the arrow's midpoint. Null when the element is not a labeled arrow.
|
|
99
|
-
*/
|
|
100
|
-
getLabelCenter(element: ExcalidrawElement): {
|
|
101
|
-
x: number;
|
|
102
|
-
y: number;
|
|
103
|
-
} | null;
|
|
104
70
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
type AppClipboardDependencies = {
|
|
4
|
+
getContainer: () => HTMLDivElement | null;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The clipboard: cut and copy (through their actions), and paste — the
|
|
8
|
+
* pasted data parsed (`pasteFromClipboard`) and inserted as whatever it is
|
|
9
|
+
* (`insertClipboardContent`): images or SVG code, elements, a Mermaid
|
|
10
|
+
* definition, embeddable URLs, a spreadsheet (as a chart), mixed content,
|
|
11
|
+
* or text. Pasted elements go in through `app.addElementsFromPasteOrLibrary`,
|
|
12
|
+
* as a library item or a drop does.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AppClipboard {
|
|
15
|
+
private app;
|
|
16
|
+
private dependencies;
|
|
17
|
+
constructor(app: App, dependencies: AppClipboardDependencies);
|
|
18
|
+
onCut: (event: ClipboardEvent) => void;
|
|
19
|
+
onCopy: (event: ClipboardEvent) => void;
|
|
20
|
+
private insertClipboardContent;
|
|
21
|
+
/**
|
|
22
|
+
* Ctrl/Cmd+V: whether the paste event that follows is a plain one (with
|
|
23
|
+
* Shift)
|
|
24
|
+
*/
|
|
25
|
+
onPasteShortcut: (event: React.KeyboardEvent | KeyboardEvent) => void;
|
|
26
|
+
clearPlainPaste: () => void;
|
|
27
|
+
pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
|
|
28
|
+
private addElementsFromMixedContentPaste;
|
|
29
|
+
private addTextFromPaste;
|
|
30
|
+
}
|
|
31
|
+
export {};
|