@excalidraw/common 0.18.0-4872083 → 0.18.0-4ce38fb
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 +145 -14
- package/dist/dev/index.js.map +2 -2
- package/dist/prod/index.js +3 -3
- package/dist/types/common/src/colors.d.ts +13 -7
- package/dist/types/common/src/constants.d.ts +54 -0
- package/dist/types/common/src/keys.d.ts +2 -0
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utils.d.ts +5 -0
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/binding.d.ts +13 -7
- package/dist/types/element/src/collision.d.ts +14 -5
- package/dist/types/element/src/comparisons.d.ts +5 -3
- package/dist/types/element/src/delta.d.ts +23 -1
- package/dist/types/element/src/duplicate.d.ts +60 -0
- package/dist/types/element/src/flowchart.d.ts +5 -1
- package/dist/types/element/src/frame.d.ts +2 -2
- package/dist/types/element/src/index.d.ts +2 -0
- package/dist/types/element/src/linearElementEditor.d.ts +10 -0
- package/dist/types/element/src/listMarker.d.ts +34 -0
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +39 -3
- package/dist/types/element/src/renderElement.d.ts +21 -4
- package/dist/types/element/src/shape.d.ts +15 -1
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/stickyNote.d.ts +183 -0
- package/dist/types/element/src/textElement.d.ts +9 -1
- package/dist/types/element/src/transform.d.ts +25 -6
- package/dist/types/element/src/typeChecks.d.ts +3 -2
- package/dist/types/element/src/types.d.ts +35 -6
- package/dist/types/element/src/utils.d.ts +15 -4
- package/dist/types/element/src/zindex.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +60 -3
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +40 -2
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +147 -14
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +40 -2
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +61 -4
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +23 -1
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +40 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +41 -3
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +111 -4
- package/dist/types/excalidraw/actions/actionGroup.d.ts +40 -2
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +71 -2
- package/dist/types/excalidraw/actions/actionLink.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionMenu.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionProperties.d.ts +50 -8
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionStyles.d.ts +21 -2
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +197 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +20 -1
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +20 -1
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +1 -0
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/appState.d.ts +26 -4
- package/dist/types/excalidraw/components/App.arrowText.d.ts +28 -30
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +10 -0
- package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +8 -0
- package/dist/types/excalidraw/components/App.d.ts +110 -199
- package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
- package/dist/types/excalidraw/components/App.text.d.ts +146 -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 +41 -1
- package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +6 -2
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +4 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- 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/Tools.d.ts +7 -2
- package/dist/types/excalidraw/components/Tooltip.d.ts +15 -1
- 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/NewElementCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/icons.d.ts +2 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +2 -2
- package/dist/types/excalidraw/data/blob.d.ts +42 -4
- package/dist/types/excalidraw/data/json.d.ts +21 -2
- package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/dist/types/excalidraw/scene/Renderer.d.ts +64 -2
- package/dist/types/excalidraw/scene/index.d.ts +1 -1
- package/dist/types/excalidraw/scene/types.d.ts +3 -1
- package/dist/types/excalidraw/types.d.ts +140 -18
- package/dist/types/excalidraw/viewport.d.ts +33 -1
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -1
- package/dist/types/math/src/curve.d.ts +19 -12
- package/dist/types/math/src/segment.d.ts +6 -0
- package/dist/types/utils/src/export.d.ts +1 -0
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AppClassProperties, AppState, ToolType, UIAppState } from "../types";
|
|
2
2
|
export type ToolConfig = {
|
|
3
3
|
icon: React.ReactNode;
|
|
4
|
-
/** letter shortcut(s) — the first one is shown in tooltips */
|
|
4
|
+
/** letter shortcut(s) — the first one is shown in tooltips and badges */
|
|
5
5
|
letterKey?: string | readonly string[];
|
|
6
6
|
/** whether `letterKey` requires Shift to be held (e.g. Shift+X) */
|
|
7
7
|
shiftKey?: boolean;
|
|
@@ -31,6 +31,7 @@ export declare const TOOLS: {
|
|
|
31
31
|
line: ToolConfig;
|
|
32
32
|
freedraw: ToolConfig;
|
|
33
33
|
text: ToolConfig;
|
|
34
|
+
stickynote: ToolConfig;
|
|
34
35
|
image: ToolConfig;
|
|
35
36
|
eraser: ToolConfig;
|
|
36
37
|
frame: ToolConfig;
|
|
@@ -49,7 +50,7 @@ export declare const TOGGLE_TOOLS: readonly (ToolType | "custom")[];
|
|
|
49
50
|
export declare const getToolLetter: (type: ToolbarToolType) => string | undefined;
|
|
50
51
|
/** human-readable shortcut hint, e.g. "R or 2", used in tooltips & aria */
|
|
51
52
|
export declare const getToolShortcut: (type: ToolbarToolType) => string;
|
|
52
|
-
export declare const findShapeByKey: (key: string, app: AppClassProperties, shiftKey?: boolean) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "lasso" | "eraser" | "hand" | "laser" | "autoshape" | "bucketfill" | null;
|
|
53
|
+
export declare const findShapeByKey: (key: string, app: AppClassProperties, shiftKey?: boolean) => "line" | "arrow" | "text" | "selection" | "rectangle" | "stickynote" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "lasso" | "eraser" | "hand" | "laser" | "autoshape" | "bucketfill" | null;
|
|
53
54
|
/**
|
|
54
55
|
* Whether a toolbar entry activating the given tool renders disabled — true
|
|
55
56
|
* when the active tool is host-controlled (`props.activeTool`) and the entry
|
|
@@ -99,6 +100,10 @@ export declare const TextToolButton: {
|
|
|
99
100
|
({ app, activeTool, hideKeyBinding, hideShortcut, }: ToolButtonComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
100
101
|
displayName: string;
|
|
101
102
|
};
|
|
103
|
+
export declare const StickyNoteToolButton: {
|
|
104
|
+
({ app, activeTool, hideKeyBinding, hideShortcut, }: ToolButtonComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
105
|
+
displayName: string;
|
|
106
|
+
};
|
|
102
107
|
export declare const ImageToolButton: {
|
|
103
108
|
({ app, activeTool, hideKeyBinding, hideShortcut, }: ToolButtonComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
104
109
|
displayName: string;
|
|
@@ -7,12 +7,26 @@ export declare const updateTooltipPosition: (tooltip: HTMLDivElement, item: {
|
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
9
|
}, position?: "bottom" | "top") => void;
|
|
10
|
+
export declare const hideTooltip: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Shows the tooltip for `item`. For elements that can't be wrapped
|
|
13
|
+
* in <Tooltip>. Pair with `hideTooltip()`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const showTooltip: (item: HTMLElement, label: string, { long, delay, position, }?: {
|
|
16
|
+
long?: boolean;
|
|
17
|
+
/** show after a short delay (unless a tooltip was visible just now) */
|
|
18
|
+
delay?: boolean;
|
|
19
|
+
position?: "bottom" | "top";
|
|
20
|
+
}) => void;
|
|
10
21
|
type TooltipProps = {
|
|
11
22
|
children: React.ReactNode;
|
|
12
23
|
label: string;
|
|
13
24
|
long?: boolean;
|
|
14
25
|
style?: React.CSSProperties;
|
|
26
|
+
className?: string;
|
|
15
27
|
disabled?: boolean;
|
|
28
|
+
/** show after a short delay (unless a tooltip was visible just now) */
|
|
29
|
+
delay?: boolean;
|
|
16
30
|
};
|
|
17
|
-
export declare const Tooltip: ({ children, label, long, style, disabled, }: TooltipProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
31
|
+
export declare const Tooltip: ({ children, label, long, style, className, disabled, delay, }: TooltipProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
32
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* right-click context menu of a customizable top-picks strip, resetting it
|
|
4
|
+
* to its default picks. Renders the strip as-is when not customizable.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TopPicksContextMenu: ({ children, onReset, isCustomized, resetLabel, }: {
|
|
7
|
+
/** the strip (must accept a ref — used as the menu trigger) */
|
|
8
|
+
children: ReactElement;
|
|
9
|
+
/** present when the strip is user-customizable */
|
|
10
|
+
onReset?: () => void;
|
|
11
|
+
/** whether custom picks are currently applied (enables the reset item) */
|
|
12
|
+
isCustomized: boolean;
|
|
13
|
+
resetLabel: string;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "drag to pin" hint shown in a picker popup whose top picks are
|
|
3
|
+
* customizable — with a reset link while the picks are customized
|
|
4
|
+
*/
|
|
5
|
+
export declare const TopPicksTip: ({ className, tip, onReset, resetTitle, }: {
|
|
6
|
+
className?: string;
|
|
7
|
+
tip: string;
|
|
8
|
+
/** present only while the top picks are customized */
|
|
9
|
+
onReset?: () => void;
|
|
10
|
+
resetTitle: string;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "./TopPicksDnD.scss";
|
|
2
|
+
type DragOrigin = {
|
|
3
|
+
kind: "source";
|
|
4
|
+
} | {
|
|
5
|
+
kind: "pick";
|
|
6
|
+
index: number;
|
|
7
|
+
};
|
|
8
|
+
export type TopPicksDragState<T> = {
|
|
9
|
+
value: T;
|
|
10
|
+
origin: DragOrigin;
|
|
11
|
+
/** hovered strip slot — the slot to replace (source drags) or the final
|
|
12
|
+
* position (pick reorders). null while the pointer is outside the strip */
|
|
13
|
+
overIndex: number | null;
|
|
14
|
+
/** index of an already-pinned identical value that blocks the drop */
|
|
15
|
+
duplicateIndex: number | null;
|
|
16
|
+
/** signed distance between strip slot centers (for reorder preview) */
|
|
17
|
+
slotSpan: number;
|
|
18
|
+
} | null;
|
|
19
|
+
export type TopPicksGhost = {
|
|
20
|
+
/** the ghost's visual. Rendered into `document.body` — outside the
|
|
21
|
+
* editor's CSS scope, so theme-dependent styling must be resolved from the
|
|
22
|
+
* rendered DOM (computed styles) rather than CSS variables */
|
|
23
|
+
content: HTMLElement;
|
|
24
|
+
/** where the ghost spawns (its size) and flies back to on cancel */
|
|
25
|
+
rect: DOMRect;
|
|
26
|
+
};
|
|
27
|
+
/** called on pointerdown (the source may not stay mounted until the drag
|
|
28
|
+
* activates), for every potential drag — keep it cheap */
|
|
29
|
+
export type CreateTopPicksGhost<T> = (args: {
|
|
30
|
+
value: T;
|
|
31
|
+
/** the element the drag started on */
|
|
32
|
+
sourceEl: HTMLElement;
|
|
33
|
+
/** the registered strip */
|
|
34
|
+
stripEl: HTMLElement;
|
|
35
|
+
}) => TopPicksGhost;
|
|
36
|
+
export type TopPicksDnD<T> = {
|
|
37
|
+
dragState: TopPicksDragState<T>;
|
|
38
|
+
startSourceDrag: (event: React.PointerEvent, value: T | null) => void;
|
|
39
|
+
startPickDrag: (event: React.PointerEvent, index: number, value: T) => void;
|
|
40
|
+
setStripEl: (el: HTMLDivElement | null) => void;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* live preview of the reorder result — the translation (px) moving the pick
|
|
44
|
+
* at `index` to the slot it would occupy if dropped right now
|
|
45
|
+
*/
|
|
46
|
+
export declare const getTopPickReorderOffset: (dragState: TopPicksDragState<unknown>, index: number) => number;
|
|
47
|
+
/** "marching ants" outline hinting that the strip accepts the drop — SVG
|
|
48
|
+
* because CSS dashed outlines/borders can't animate their dash offset */
|
|
49
|
+
export declare const TopPicksDnDOutline: () => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export declare const useTopPicksDnD: <T>({ enabled, picks, onPicksChange, isSamePick, createGhost, }: {
|
|
51
|
+
enabled: boolean;
|
|
52
|
+
picks: readonly T[];
|
|
53
|
+
onPicksChange: (picks: T[]) => void;
|
|
54
|
+
/** value-equality — pins identical to an existing pick are refused */
|
|
55
|
+
isSamePick?: (a: T, b: T) => boolean;
|
|
56
|
+
createGhost: CreateTopPicksGhost<T>;
|
|
57
|
+
}) => TopPicksDnD<T>;
|
|
58
|
+
export {};
|
|
@@ -10,6 +10,8 @@ interface NewElementCanvasProps {
|
|
|
10
10
|
scale: number;
|
|
11
11
|
rc: RoughCanvas;
|
|
12
12
|
renderConfig: StaticCanvasRenderConfig;
|
|
13
|
+
/** CSS opacity of the whole canvas — a translucent preview of a finished element */
|
|
14
|
+
opacity?: number;
|
|
13
15
|
}
|
|
14
16
|
declare const NewElementCanvas: (props: NewElementCanvasProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
export default NewElementCanvas;
|
|
@@ -197,8 +197,10 @@ export declare const playerPlayIcon: import("react/jsx-runtime").JSX.Element;
|
|
|
197
197
|
export declare const playerStopFilledIcon: import("react/jsx-runtime").JSX.Element;
|
|
198
198
|
export declare const tablerCheckIcon: import("react/jsx-runtime").JSX.Element;
|
|
199
199
|
export declare const alertTriangleIcon: import("react/jsx-runtime").JSX.Element;
|
|
200
|
+
export declare const eyeDropperIconSvgPaths: readonly ["M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z", "M11 7l6 6"];
|
|
200
201
|
export declare const eyeDropperIcon: import("react/jsx-runtime").JSX.Element;
|
|
201
202
|
export declare const frameToolIcon: import("react/jsx-runtime").JSX.Element;
|
|
203
|
+
export declare const stickyNoteToolIcon: import("react/jsx-runtime").JSX.Element;
|
|
202
204
|
export declare const mermaidLogoIcon: import("react/jsx-runtime").JSX.Element;
|
|
203
205
|
export declare const RetryIcon: import("react/jsx-runtime").JSX.Element;
|
|
204
206
|
export declare const stackPushIcon: import("react/jsx-runtime").JSX.Element;
|
|
@@ -74,9 +74,11 @@ export declare const Preferences: {
|
|
|
74
74
|
}): import("react/jsx-runtime").JSX.Element;
|
|
75
75
|
ToggleToolLock: () => import("react/jsx-runtime").JSX.Element;
|
|
76
76
|
BoxSelectionMode: () => import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
InputDevice: () => import("react/jsx-runtime").JSX.Element;
|
|
77
78
|
ToggleSnapMode: () => import("react/jsx-runtime").JSX.Element;
|
|
78
79
|
ToggleArrowBinding: () => import("react/jsx-runtime").JSX.Element;
|
|
79
80
|
ToggleMidpointSnapping: () => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
ToggleShowHints: () => import("react/jsx-runtime").JSX.Element;
|
|
80
82
|
ToggleGridMode: () => import("react/jsx-runtime").JSX.Element;
|
|
81
83
|
ToggleZenMode: () => import("react/jsx-runtime").JSX.Element;
|
|
82
84
|
ToggleViewMode: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
1
|
+
import type { ElementsMap, ExcalidrawElement, NonDeletedElementsMap, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
2
2
|
import type { AppClassProperties, UIAppState } from "../types";
|
|
3
3
|
export declare const canChangeStrokeColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
|
|
4
|
-
export declare const canChangeBackgroundColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
|
|
4
|
+
export declare const canChangeBackgroundColor: (appState: UIAppState, targetElements: ExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Single source of truth for "which shape-action controls are relevant right
|
|
7
7
|
* now". Each flag answers whether a given control should be shown, given the
|
|
@@ -20,6 +20,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
20
20
|
data: {
|
|
21
21
|
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
22
22
|
appState: {
|
|
23
|
+
zoom: import("../types").Zoom;
|
|
23
24
|
viewModeEnabled: boolean;
|
|
24
25
|
activeTool: {
|
|
25
26
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -53,11 +54,20 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
53
54
|
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
54
55
|
bindingPreference: "enabled" | "disabled";
|
|
55
56
|
isMidpointSnappingEnabled: boolean;
|
|
57
|
+
showHints: boolean;
|
|
58
|
+
inputDevice: import("../types").InputDevice;
|
|
56
59
|
suggestedBinding: {
|
|
57
60
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
58
61
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
59
62
|
} | null;
|
|
60
|
-
|
|
63
|
+
textToolHover: {
|
|
64
|
+
type: "text";
|
|
65
|
+
elementId: ExcalidrawElement["id"];
|
|
66
|
+
} | {
|
|
67
|
+
type: "container";
|
|
68
|
+
elementId: ExcalidrawElement["id"];
|
|
69
|
+
} | {
|
|
70
|
+
type: "arrow";
|
|
61
71
|
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
62
72
|
anchor: "start" | "end" | "label";
|
|
63
73
|
} | null;
|
|
@@ -82,6 +92,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
82
92
|
exportWithDarkMode: boolean;
|
|
83
93
|
exportScale: number;
|
|
84
94
|
currentItemStrokeColor: string;
|
|
95
|
+
currentItemStickynoteStrokeColor: string;
|
|
96
|
+
currentItemStickynoteBackgroundColor: string;
|
|
85
97
|
currentItemBackgroundColor: string;
|
|
86
98
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
87
99
|
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
@@ -104,7 +116,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
104
116
|
scrolledOutside: boolean;
|
|
105
117
|
isResizing: boolean;
|
|
106
118
|
isRotating: boolean;
|
|
107
|
-
zoom: import("../types").Zoom;
|
|
108
119
|
openMenu: "canvas" | null;
|
|
109
120
|
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
110
121
|
openSidebar: {
|
|
@@ -175,6 +186,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
175
186
|
[groupId: string]: true;
|
|
176
187
|
};
|
|
177
188
|
bindMode: import("@excalidraw/element/types").BindMode;
|
|
189
|
+
colorTopPicks: {
|
|
190
|
+
elementStroke: readonly string[] | null;
|
|
191
|
+
elementBackground: readonly string[] | null;
|
|
192
|
+
bucketFill: readonly string[] | null;
|
|
193
|
+
stickyNoteStroke: readonly string[] | null;
|
|
194
|
+
stickyNoteBackground: readonly string[] | null;
|
|
195
|
+
};
|
|
196
|
+
fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
|
|
178
197
|
};
|
|
179
198
|
files: import("../types").BinaryFiles;
|
|
180
199
|
};
|
|
@@ -189,6 +208,7 @@ localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | nu
|
|
|
189
208
|
fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
190
209
|
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
191
210
|
appState: {
|
|
211
|
+
zoom: import("../types").Zoom;
|
|
192
212
|
viewModeEnabled: boolean;
|
|
193
213
|
activeTool: {
|
|
194
214
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -222,11 +242,20 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
222
242
|
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
223
243
|
bindingPreference: "enabled" | "disabled";
|
|
224
244
|
isMidpointSnappingEnabled: boolean;
|
|
245
|
+
showHints: boolean;
|
|
246
|
+
inputDevice: import("../types").InputDevice;
|
|
225
247
|
suggestedBinding: {
|
|
226
248
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
227
249
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
228
250
|
} | null;
|
|
229
|
-
|
|
251
|
+
textToolHover: {
|
|
252
|
+
type: "text";
|
|
253
|
+
elementId: ExcalidrawElement["id"];
|
|
254
|
+
} | {
|
|
255
|
+
type: "container";
|
|
256
|
+
elementId: ExcalidrawElement["id"];
|
|
257
|
+
} | {
|
|
258
|
+
type: "arrow";
|
|
230
259
|
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
231
260
|
anchor: "start" | "end" | "label";
|
|
232
261
|
} | null;
|
|
@@ -251,6 +280,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
251
280
|
exportWithDarkMode: boolean;
|
|
252
281
|
exportScale: number;
|
|
253
282
|
currentItemStrokeColor: string;
|
|
283
|
+
currentItemStickynoteStrokeColor: string;
|
|
284
|
+
currentItemStickynoteBackgroundColor: string;
|
|
254
285
|
currentItemBackgroundColor: string;
|
|
255
286
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
256
287
|
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
@@ -273,7 +304,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
273
304
|
scrolledOutside: boolean;
|
|
274
305
|
isResizing: boolean;
|
|
275
306
|
isRotating: boolean;
|
|
276
|
-
zoom: import("../types").Zoom;
|
|
277
307
|
openMenu: "canvas" | null;
|
|
278
308
|
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
279
309
|
openSidebar: {
|
|
@@ -344,6 +374,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
344
374
|
[groupId: string]: true;
|
|
345
375
|
};
|
|
346
376
|
bindMode: import("@excalidraw/element/types").BindMode;
|
|
377
|
+
colorTopPicks: {
|
|
378
|
+
elementStroke: readonly string[] | null;
|
|
379
|
+
elementBackground: readonly string[] | null;
|
|
380
|
+
bucketFill: readonly string[] | null;
|
|
381
|
+
stickyNoteStroke: readonly string[] | null;
|
|
382
|
+
stickyNoteBackground: readonly string[] | null;
|
|
383
|
+
};
|
|
384
|
+
fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
|
|
347
385
|
};
|
|
348
386
|
files: import("../types").BinaryFiles;
|
|
349
387
|
}>;
|
|
@@ -18,6 +18,7 @@ export declare const saveAsJSON: ({ data, filename, fileHandle, }: {
|
|
|
18
18
|
export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<{
|
|
19
19
|
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
20
20
|
appState: {
|
|
21
|
+
zoom: import("../types").Zoom;
|
|
21
22
|
viewModeEnabled: boolean;
|
|
22
23
|
activeTool: {
|
|
23
24
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -51,11 +52,20 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
51
52
|
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
52
53
|
bindingPreference: "enabled" | "disabled";
|
|
53
54
|
isMidpointSnappingEnabled: boolean;
|
|
55
|
+
showHints: boolean;
|
|
56
|
+
inputDevice: import("../types").InputDevice;
|
|
54
57
|
suggestedBinding: {
|
|
55
58
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
56
59
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
57
60
|
} | null;
|
|
58
|
-
|
|
61
|
+
textToolHover: {
|
|
62
|
+
type: "text";
|
|
63
|
+
elementId: ExcalidrawElement["id"];
|
|
64
|
+
} | {
|
|
65
|
+
type: "container";
|
|
66
|
+
elementId: ExcalidrawElement["id"];
|
|
67
|
+
} | {
|
|
68
|
+
type: "arrow";
|
|
59
69
|
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
60
70
|
anchor: "start" | "end" | "label";
|
|
61
71
|
} | null;
|
|
@@ -80,6 +90,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
80
90
|
exportWithDarkMode: boolean;
|
|
81
91
|
exportScale: number;
|
|
82
92
|
currentItemStrokeColor: string;
|
|
93
|
+
currentItemStickynoteStrokeColor: string;
|
|
94
|
+
currentItemStickynoteBackgroundColor: string;
|
|
83
95
|
currentItemBackgroundColor: string;
|
|
84
96
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
85
97
|
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
@@ -102,7 +114,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
102
114
|
scrolledOutside: boolean;
|
|
103
115
|
isResizing: boolean;
|
|
104
116
|
isRotating: boolean;
|
|
105
|
-
zoom: import("../types").Zoom;
|
|
106
117
|
openMenu: "canvas" | null;
|
|
107
118
|
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
108
119
|
openSidebar: {
|
|
@@ -173,6 +184,14 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
173
184
|
[groupId: string]: true;
|
|
174
185
|
};
|
|
175
186
|
bindMode: import("@excalidraw/element/types").BindMode;
|
|
187
|
+
colorTopPicks: {
|
|
188
|
+
elementStroke: readonly string[] | null;
|
|
189
|
+
elementBackground: readonly string[] | null;
|
|
190
|
+
bucketFill: readonly string[] | null;
|
|
191
|
+
stickyNoteStroke: readonly string[] | null;
|
|
192
|
+
stickyNoteBackground: readonly string[] | null;
|
|
193
|
+
};
|
|
194
|
+
fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
|
|
176
195
|
};
|
|
177
196
|
files: BinaryFiles;
|
|
178
197
|
}>;
|
|
@@ -15,7 +15,8 @@ export declare class Fonts {
|
|
|
15
15
|
fontFaces: ExcalidrawFontFace[];
|
|
16
16
|
}>;
|
|
17
17
|
private readonly scene;
|
|
18
|
-
|
|
18
|
+
private readonly ownerDocument;
|
|
19
|
+
constructor(scene: Scene, ownerDocument?: Document);
|
|
19
20
|
/**
|
|
20
21
|
* Get all the font families for the given scene.
|
|
21
22
|
*/
|
|
@@ -36,7 +37,7 @@ export declare class Fonts {
|
|
|
36
37
|
/**
|
|
37
38
|
* Load font faces for passed elements - use when the scene is unavailable (i.e. export).
|
|
38
39
|
*/
|
|
39
|
-
static loadElementsFonts: (elements: readonly ExcalidrawElement[]) => Promise<FontFace[]>;
|
|
40
|
+
static loadElementsFonts: (elements: readonly ExcalidrawElement[], ownerDocument?: Document) => Promise<FontFace[]>;
|
|
40
41
|
/**
|
|
41
42
|
* Generate CSS @font-face declarations for the given elements.
|
|
42
43
|
*/
|
|
@@ -2,13 +2,13 @@ export type CaretPosition = {
|
|
|
2
2
|
start: number;
|
|
3
3
|
end: number;
|
|
4
4
|
};
|
|
5
|
-
export declare const saveCaretPosition: () => CaretPosition | null;
|
|
6
|
-
export declare const restoreCaretPosition: (position: CaretPosition | null) => void;
|
|
7
|
-
export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void) => void;
|
|
8
|
-
export declare const useTextEditorFocus: () => {
|
|
5
|
+
export declare const saveCaretPosition: (ownerDocument?: Document) => CaretPosition | null;
|
|
6
|
+
export declare const restoreCaretPosition: (position: CaretPosition | null, ownerDocument?: Document) => void;
|
|
7
|
+
export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void, ownerDocument?: Document) => void;
|
|
8
|
+
export declare const useTextEditorFocus: (ownerDocument?: Document) => {
|
|
9
9
|
saveCaretPosition: () => void;
|
|
10
10
|
restoreCaretPosition: () => void;
|
|
11
11
|
clearSavedPosition: () => void;
|
|
12
12
|
hasSavedPosition: boolean;
|
|
13
13
|
};
|
|
14
|
-
export declare const temporarilyDisableTextEditorBlur: (duration?: number) => void;
|
|
14
|
+
export declare const temporarilyDisableTextEditorBlur: (ownerDocument?: Document, duration?: number) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ElementsSegmentsMap, GlobalPoint } from "@excalidraw/math/types";
|
|
2
2
|
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
|
+
import type { BoxSelectionMode } from "../types";
|
|
3
4
|
export declare const getLassoSelectedElementIds: (input: {
|
|
4
5
|
lassoPath: GlobalPoint[];
|
|
5
6
|
elements: readonly ExcalidrawElement[];
|
|
@@ -8,6 +9,7 @@ export declare const getLassoSelectedElementIds: (input: {
|
|
|
8
9
|
intersectedElements: Set<ExcalidrawElement["id"]>;
|
|
9
10
|
enclosedElements: Set<ExcalidrawElement["id"]>;
|
|
10
11
|
simplifyDistance?: number;
|
|
12
|
+
mode?: BoxSelectionMode;
|
|
11
13
|
}) => {
|
|
12
14
|
selectedElementIds: string[];
|
|
13
15
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ElementRenderOffsets, ElementRenderOverrides } from "./types";
|
|
2
|
+
/** Validate and copy before publishing, so a rejected snapshot changes nothing. */
|
|
3
|
+
export declare const copyElementRenderOverrides: (overrides: ElementRenderOverrides | null) => ElementRenderOverrides;
|
|
4
|
+
/**
|
|
5
|
+
* Extracts the offsets of a snapshot, returning `previous` when they are the
|
|
6
|
+
* same. Visibility is memoized on this map's identity, so a snapshot that only
|
|
7
|
+
* changes opacities (a fade) never re-runs viewport geometry.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getElementRenderOffsets: (overrides: ElementRenderOverrides, previous: ElementRenderOffsets) => ElementRenderOffsets;
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import type { StaticCanvasRenderConfig } from "../scene/types";
|
|
2
2
|
import type { AppState, StaticCanvasAppState } from "../types";
|
|
3
|
+
export declare const DEFAULT_SELECTION_COLOR = "#6965db";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the theme's selection color (`--color-selection`), read from the
|
|
6
|
+
* computed style of any element inside the editor container so that host
|
|
7
|
+
* overrides are respected. Falls back to the default when unavailable.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getSelectionColor: (element: Element | null | undefined) => string;
|
|
3
10
|
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
|
|
11
|
+
/**
|
|
12
|
+
* The scroll the renderers draw at: the real one, rounded to whole device
|
|
13
|
+
* pixels. Panning writes a fractional scroll (pointer delta ÷ zoom), and an
|
|
14
|
+
* element's cached bitmap blitted at a fractional device offset gets
|
|
15
|
+
* resampled — so as the fraction drifts under a pan, every element pulses
|
|
16
|
+
* between crisp and soft. A whole-pixel scroll moves the scene the way a
|
|
17
|
+
* browser scrolls a page: each element keeps its own, constant sub-pixel
|
|
18
|
+
* phase and a pan never changes how anything is filtered. The difference
|
|
19
|
+
* stays under half a device pixel, so hit-testing and DOM overlays keep
|
|
20
|
+
* using the real scroll. Identity when nothing needs to change.
|
|
21
|
+
*/
|
|
22
|
+
export declare const snapScrollToDevicePixels: <T extends {
|
|
23
|
+
scrollX: number;
|
|
24
|
+
scrollY: number;
|
|
25
|
+
zoom: {
|
|
26
|
+
value: number;
|
|
27
|
+
};
|
|
28
|
+
}>(appState: T, scale: number) => T;
|
|
4
29
|
export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
|
|
5
30
|
export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
|
|
6
31
|
canvas: HTMLCanvasElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getScrollBars } from "../scene/scrollbars";
|
|
2
2
|
import type { InteractiveSceneRenderConfig } from "../scene/types";
|
|
3
|
-
declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
|
|
3
|
+
declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState: unsnappedAppState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
|
|
4
4
|
scrollBars?: ReturnType<typeof getScrollBars>;
|
|
5
5
|
animationState?: typeof animationState;
|
|
6
6
|
};
|