@excalidraw/element 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.
Files changed (119) hide show
  1. package/dist/dev/index.js +5645 -3994
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +16 -15
  4. package/dist/types/common/src/colors.d.ts +13 -7
  5. package/dist/types/common/src/constants.d.ts +54 -0
  6. package/dist/types/common/src/keys.d.ts +2 -0
  7. package/dist/types/common/src/random.d.ts +7 -0
  8. package/dist/types/common/src/utils.d.ts +5 -0
  9. package/dist/types/element/src/Scene.d.ts +1 -1
  10. package/dist/types/element/src/binding.d.ts +13 -7
  11. package/dist/types/element/src/collision.d.ts +14 -5
  12. package/dist/types/element/src/comparisons.d.ts +5 -3
  13. package/dist/types/element/src/delta.d.ts +23 -1
  14. package/dist/types/element/src/duplicate.d.ts +60 -0
  15. package/dist/types/element/src/flowchart.d.ts +5 -1
  16. package/dist/types/element/src/frame.d.ts +2 -2
  17. package/dist/types/element/src/index.d.ts +2 -0
  18. package/dist/types/element/src/linearElementEditor.d.ts +10 -0
  19. package/dist/types/element/src/listMarker.d.ts +34 -0
  20. package/dist/types/element/src/mutateElement.d.ts +1 -1
  21. package/dist/types/element/src/newElement.d.ts +39 -3
  22. package/dist/types/element/src/renderElement.d.ts +21 -4
  23. package/dist/types/element/src/shape.d.ts +15 -1
  24. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  25. package/dist/types/element/src/stickyNote.d.ts +183 -0
  26. package/dist/types/element/src/textElement.d.ts +9 -1
  27. package/dist/types/element/src/transform.d.ts +25 -6
  28. package/dist/types/element/src/typeChecks.d.ts +3 -2
  29. package/dist/types/element/src/types.d.ts +35 -6
  30. package/dist/types/element/src/utils.d.ts +15 -4
  31. package/dist/types/element/src/zindex.d.ts +1 -1
  32. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +60 -3
  33. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  34. package/dist/types/excalidraw/actions/actionBoundText.d.ts +40 -2
  35. package/dist/types/excalidraw/actions/actionCanvas.d.ts +140 -7
  36. package/dist/types/excalidraw/actions/actionClipboard.d.ts +40 -2
  37. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +20 -1
  38. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +61 -4
  39. package/dist/types/excalidraw/actions/actionDeselect.d.ts +23 -1
  40. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
  41. package/dist/types/excalidraw/actions/actionElementLink.d.ts +20 -1
  42. package/dist/types/excalidraw/actions/actionElementLock.d.ts +40 -2
  43. package/dist/types/excalidraw/actions/actionExport.d.ts +40 -2
  44. package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
  45. package/dist/types/excalidraw/actions/actionFrame.d.ts +111 -4
  46. package/dist/types/excalidraw/actions/actionGroup.d.ts +40 -2
  47. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +71 -2
  48. package/dist/types/excalidraw/actions/actionLink.d.ts +20 -1
  49. package/dist/types/excalidraw/actions/actionMenu.d.ts +20 -1
  50. package/dist/types/excalidraw/actions/actionProperties.d.ts +50 -8
  51. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +20 -1
  52. package/dist/types/excalidraw/actions/actionStyles.d.ts +21 -2
  53. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +20 -1
  54. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +20 -1
  55. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +20 -1
  56. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +20 -1
  57. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +20 -1
  58. package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +197 -0
  59. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +20 -1
  60. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +20 -1
  61. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +20 -1
  62. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  63. package/dist/types/excalidraw/actions/index.d.ts +1 -0
  64. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  65. package/dist/types/excalidraw/appState.d.ts +23 -1
  66. package/dist/types/excalidraw/components/App.arrowText.d.ts +28 -30
  67. package/dist/types/excalidraw/components/App.bucketFill.d.ts +10 -0
  68. package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
  69. package/dist/types/excalidraw/components/App.cursor.d.ts +8 -0
  70. package/dist/types/excalidraw/components/App.d.ts +110 -199
  71. package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
  72. package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
  73. package/dist/types/excalidraw/components/App.text.d.ts +146 -0
  74. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  75. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  76. package/dist/types/excalidraw/components/App.viewport.d.ts +41 -1
  77. package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
  78. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +6 -2
  79. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  80. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -1
  81. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +4 -2
  82. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
  83. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  84. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  85. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  86. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
  87. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  88. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  89. package/dist/types/excalidraw/components/IconButton.d.ts +2 -0
  90. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
  91. package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
  92. package/dist/types/excalidraw/components/Tools.d.ts +7 -2
  93. package/dist/types/excalidraw/components/Tooltip.d.ts +15 -1
  94. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  95. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  96. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  97. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
  98. package/dist/types/excalidraw/components/icons.d.ts +2 -0
  99. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -0
  100. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +2 -2
  101. package/dist/types/excalidraw/data/blob.d.ts +40 -2
  102. package/dist/types/excalidraw/data/json.d.ts +20 -1
  103. package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
  104. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
  105. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  106. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  107. package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
  108. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
  109. package/dist/types/excalidraw/scene/Renderer.d.ts +64 -2
  110. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  111. package/dist/types/excalidraw/scene/types.d.ts +3 -1
  112. package/dist/types/excalidraw/types.d.ts +140 -18
  113. package/dist/types/excalidraw/viewport.d.ts +33 -1
  114. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -1
  115. package/dist/types/math/src/curve.d.ts +19 -12
  116. package/dist/types/math/src/segment.d.ts +6 -0
  117. package/dist/types/utils/src/export.d.ts +1 -0
  118. package/dist/types/utils/src/shape.d.ts +2 -2
  119. package/package.json +4 -4
@@ -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
@@ -78,7 +78,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
78
78
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
79
79
  midPoint?: import("@excalidraw/math").GlobalPoint;
80
80
  } | null;
81
- hoveredArrowTextAnchor: {
81
+ textToolHover: {
82
+ type: "text";
83
+ elementId: ExcalidrawElement["id"];
84
+ } | {
85
+ type: "container";
86
+ elementId: ExcalidrawElement["id"];
87
+ } | {
88
+ type: "arrow";
82
89
  elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
83
90
  anchor: "start" | "end" | "label";
84
91
  } | null;
@@ -114,6 +121,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
114
121
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
115
122
  boxSelectionMode: import("../types").BoxSelectionMode;
116
123
  bindingPreference: "enabled" | "disabled";
124
+ showHints: boolean;
125
+ inputDevice: import("../types").InputDevice;
117
126
  editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
118
127
  preferredSelectionTool: {
119
128
  type: "selection" | "lasso";
@@ -125,6 +134,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
125
134
  exportEmbedScene: boolean;
126
135
  exportWithDarkMode: boolean;
127
136
  currentItemStrokeColor: string;
137
+ currentItemStickynoteStrokeColor: string;
138
+ currentItemStickynoteBackgroundColor: string;
128
139
  currentItemBackgroundColor: string;
129
140
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
130
141
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -175,6 +186,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
175
186
  lockedMultiSelections: {
176
187
  [groupId: string]: true;
177
188
  };
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
  };
@@ -247,7 +266,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
247
266
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
248
267
  midPoint?: import("@excalidraw/math").GlobalPoint;
249
268
  } | null;
250
- hoveredArrowTextAnchor: {
269
+ textToolHover: {
270
+ type: "text";
271
+ elementId: ExcalidrawElement["id"];
272
+ } | {
273
+ type: "container";
274
+ elementId: ExcalidrawElement["id"];
275
+ } | {
276
+ type: "arrow";
251
277
  elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
252
278
  anchor: "start" | "end" | "label";
253
279
  } | null;
@@ -283,6 +309,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
283
309
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
284
310
  boxSelectionMode: import("../types").BoxSelectionMode;
285
311
  bindingPreference: "enabled" | "disabled";
312
+ showHints: boolean;
313
+ inputDevice: import("../types").InputDevice;
286
314
  editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
287
315
  preferredSelectionTool: {
288
316
  type: "selection" | "lasso";
@@ -294,6 +322,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
294
322
  exportEmbedScene: boolean;
295
323
  exportWithDarkMode: boolean;
296
324
  currentItemStrokeColor: string;
325
+ currentItemStickynoteStrokeColor: string;
326
+ currentItemStickynoteBackgroundColor: string;
297
327
  currentItemBackgroundColor: string;
298
328
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
299
329
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -344,6 +374,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
344
374
  lockedMultiSelections: {
345
375
  [groupId: string]: true;
346
376
  };
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
  }>;
@@ -76,7 +76,14 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
76
76
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
77
77
  midPoint?: import("@excalidraw/math").GlobalPoint;
78
78
  } | null;
79
- hoveredArrowTextAnchor: {
79
+ textToolHover: {
80
+ type: "text";
81
+ elementId: ExcalidrawElement["id"];
82
+ } | {
83
+ type: "container";
84
+ elementId: ExcalidrawElement["id"];
85
+ } | {
86
+ type: "arrow";
80
87
  elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
81
88
  anchor: "start" | "end" | "label";
82
89
  } | null;
@@ -112,6 +119,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
112
119
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
113
120
  boxSelectionMode: import("../types").BoxSelectionMode;
114
121
  bindingPreference: "enabled" | "disabled";
122
+ showHints: boolean;
123
+ inputDevice: import("../types").InputDevice;
115
124
  editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
116
125
  preferredSelectionTool: {
117
126
  type: "selection" | "lasso";
@@ -123,6 +132,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
123
132
  exportEmbedScene: boolean;
124
133
  exportWithDarkMode: boolean;
125
134
  currentItemStrokeColor: string;
135
+ currentItemStickynoteStrokeColor: string;
136
+ currentItemStickynoteBackgroundColor: string;
126
137
  currentItemBackgroundColor: string;
127
138
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
128
139
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -173,6 +184,14 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
173
184
  lockedMultiSelections: {
174
185
  [groupId: string]: true;
175
186
  };
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
- constructor(scene: Scene);
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
  };
@@ -1,7 +1,7 @@
1
1
  import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import type { RenderableElementsMap } from "./types";
4
- import type { AppState } from "../types";
4
+ import type { AppState, ElementRenderOffsets } from "../types";
5
5
  type GetRenderableElementsOpts = {
6
6
  zoom: AppState["zoom"];
7
7
  offsetLeft: AppState["offsetLeft"];
@@ -19,6 +19,19 @@ type GetRenderableElementsOpts = {
19
19
  export declare class Renderer {
20
20
  private scene;
21
21
  constructor(scene: Scene);
22
+ /**
23
+ * Adjusts the document-visible set for render-override translations: an
24
+ * element leaves it when its offset moves it out of view and enters it when
25
+ * its offset brings it in; everything else keeps its document visibility.
26
+ * Only translated elements go through viewport geometry. The result is
27
+ * memoized on the offsets' identity so that opacity-only snapshots don't
28
+ * reach it at all.
29
+ */
30
+ getVisibleElementsWithRenderOffsets(visibleElements: readonly NonDeletedExcalidrawElement[], elementsMap: RenderableElementsMap, appState: AppState, offsets: ElementRenderOffsets): readonly NonDeletedExcalidrawElement[];
31
+ private _getVisibleElementsWithRenderOffsets;
32
+ /** the document-visible elements as a set, cached per visible array */
33
+ private visibleSets;
34
+ private getVisibleSet;
22
35
  private getVisibleCanvasElements;
23
36
  private getRenderableElementsMap;
24
37
  private sortSelectedElementsIntoHighlightedFrame;
@@ -53,6 +66,7 @@ export declare class Renderer {
53
66
  frameId: string | null;
54
67
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
55
68
  updated: number;
69
+ created: number | null;
56
70
  link: string | null;
57
71
  locked: boolean;
58
72
  customData?: Record<string, any>;
@@ -92,6 +106,7 @@ export declare class Renderer {
92
106
  frameId: string | null;
93
107
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
94
108
  updated: number;
109
+ created: number | null;
95
110
  link: string | null;
96
111
  locked: boolean;
97
112
  customData?: Record<string, any>;
@@ -126,6 +141,43 @@ export declare class Renderer {
126
141
  frameId: string | null;
127
142
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
128
143
  updated: number;
144
+ created: number | null;
145
+ link: string | null;
146
+ locked: boolean;
147
+ customData?: Record<string, any>;
148
+ }> & Readonly<{
149
+ type: "stickynote";
150
+ baseHeight: number;
151
+ }> & {
152
+ isDeleted: false;
153
+ }) | (Readonly<{
154
+ id: string;
155
+ x: number;
156
+ y: number;
157
+ strokeColor: string;
158
+ backgroundColor: string;
159
+ fillStyle: import("@excalidraw/element/types").FillStyle;
160
+ strokeWidth: number;
161
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
162
+ roundness: null | {
163
+ type: import("@excalidraw/element/types").RoundnessType;
164
+ value?: number;
165
+ };
166
+ roughness: number;
167
+ opacity: number;
168
+ width: number;
169
+ height: number;
170
+ angle: import("@excalidraw/math").Radians;
171
+ seed: number;
172
+ version: number;
173
+ versionNonce: number;
174
+ index: import("@excalidraw/element/types").FractionalIndex | null;
175
+ isDeleted: boolean;
176
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
177
+ frameId: string | null;
178
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
179
+ updated: number;
180
+ created: number | null;
129
181
  link: string | null;
130
182
  locked: boolean;
131
183
  customData?: Record<string, any>;
@@ -160,6 +212,7 @@ export declare class Renderer {
160
212
  frameId: string | null;
161
213
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
162
214
  updated: number;
215
+ created: number | null;
163
216
  link: string | null;
164
217
  locked: boolean;
165
218
  customData?: Record<string, any>;
@@ -194,6 +247,7 @@ export declare class Renderer {
194
247
  frameId: string | null;
195
248
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
196
249
  updated: number;
250
+ created: number | null;
197
251
  link: string | null;
198
252
  locked: boolean;
199
253
  customData?: Record<string, any>;
@@ -228,6 +282,7 @@ export declare class Renderer {
228
282
  frameId: string | null;
229
283
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
230
284
  updated: number;
285
+ created: number | null;
231
286
  link: string | null;
232
287
  locked: boolean;
233
288
  customData?: Record<string, any>;
@@ -265,6 +320,7 @@ export declare class Renderer {
265
320
  frameId: string | null;
266
321
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
267
322
  updated: number;
323
+ created: number | null;
268
324
  link: string | null;
269
325
  locked: boolean;
270
326
  customData?: Record<string, any>;
@@ -303,6 +359,7 @@ export declare class Renderer {
303
359
  frameId: string | null;
304
360
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
305
361
  updated: number;
362
+ created: number | null;
306
363
  link: string | null;
307
364
  locked: boolean;
308
365
  customData?: Record<string, any>;
@@ -338,6 +395,7 @@ export declare class Renderer {
338
395
  frameId: string | null;
339
396
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
340
397
  updated: number;
398
+ created: number | null;
341
399
  link: string | null;
342
400
  locked: boolean;
343
401
  customData?: Record<string, any>;
@@ -373,6 +431,7 @@ export declare class Renderer {
373
431
  frameId: string | null;
374
432
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
375
433
  updated: number;
434
+ created: number | null;
376
435
  link: string | null;
377
436
  locked: boolean;
378
437
  customData?: Record<string, any>;
@@ -380,15 +439,17 @@ export declare class Renderer {
380
439
  type: "text";
381
440
  fontSize: number;
382
441
  fontFamily: import("@excalidraw/element/types").FontFamilyValues;
442
+ baseFontSize: number | null;
383
443
  text: string;
384
444
  textAlign: import("@excalidraw/element/types").TextAlign;
385
445
  verticalAlign: import("@excalidraw/element/types").VerticalAlign;
386
- containerId: import("@excalidraw/element/types").ExcalidrawGenericElement["id"] | null;
446
+ containerId: import("@excalidraw/element/types").ExcalidrawTextContainer["id"] | null;
387
447
  originalText: string;
388
448
  autoResize: boolean;
389
449
  lineHeight: number & {
390
450
  _brand: "unitlessLineHeight";
391
451
  };
452
+ labelPosition?: number | null;
392
453
  }> & {
393
454
  isDeleted: false;
394
455
  }) | (Readonly<{
@@ -418,6 +479,7 @@ export declare class Renderer {
418
479
  frameId: string | null;
419
480
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
420
481
  updated: number;
482
+ created: number | null;
421
483
  link: string | null;
422
484
  locked: boolean;
423
485
  customData?: Record<string, any>;
@@ -1,4 +1,4 @@
1
1
  export { isSomeElementSelected, getElementsWithinSelection, getSelectedElements, getTargetElements, } from "@excalidraw/element";
2
2
  export { getScrollToContentState } from "../viewport";
3
- export { hasBackground, hasStrokeWidth, hasStrokeStyle, hasFreedrawMode, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
3
+ export { hasBackground, hasFillStyle, hasRoughness, hasStrokeWidth, hasStrokeStyle, hasFreedrawMode, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
4
4
  export { getNormalizedZoom, getNormalizedGridSize, getNormalizedGridStep, } from "./normalize";