@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.
Files changed (164) hide show
  1. package/dist/dev/index.js +8 -2
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +1 -1
  4. package/dist/types/common/src/colors.d.ts +3 -0
  5. package/dist/types/common/src/constants.d.ts +56 -0
  6. package/dist/types/common/src/keys.d.ts +4 -0
  7. package/dist/types/common/src/random.d.ts +7 -0
  8. package/dist/types/common/src/utils.d.ts +12 -1
  9. package/dist/types/element/src/Scene.d.ts +1 -1
  10. package/dist/types/element/src/align.d.ts +4 -1
  11. package/dist/types/element/src/binding.d.ts +75 -7
  12. package/dist/types/element/src/bounds.d.ts +10 -2
  13. package/dist/types/element/src/collision.d.ts +21 -5
  14. package/dist/types/element/src/comparisons.d.ts +5 -3
  15. package/dist/types/element/src/cropElement.d.ts +36 -4
  16. package/dist/types/element/src/delta.d.ts +30 -2
  17. package/dist/types/element/src/distribute.d.ts +4 -1
  18. package/dist/types/element/src/dragElements.d.ts +8 -3
  19. package/dist/types/element/src/duplicate.d.ts +60 -0
  20. package/dist/types/element/src/elbowArrow.d.ts +5 -0
  21. package/dist/types/element/src/embeddable.d.ts +2 -1
  22. package/dist/types/element/src/flowchart.d.ts +6 -8
  23. package/dist/types/element/src/frame.d.ts +21 -3
  24. package/dist/types/element/src/groups.d.ts +1 -6
  25. package/dist/types/element/src/image.d.ts +5 -2
  26. package/dist/types/element/src/index.d.ts +3 -0
  27. package/dist/types/element/src/linearElementEditor.d.ts +4 -1
  28. package/dist/types/element/src/listMarker.d.ts +39 -0
  29. package/dist/types/element/src/mutateElement.d.ts +1 -1
  30. package/dist/types/element/src/newElement.d.ts +40 -3
  31. package/dist/types/element/src/renderElement.d.ts +31 -4
  32. package/dist/types/element/src/renderEnvironment.d.ts +66 -0
  33. package/dist/types/element/src/resizeElements.d.ts +15 -5
  34. package/dist/types/element/src/selection.d.ts +4 -10
  35. package/dist/types/element/src/shape.d.ts +17 -1
  36. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  37. package/dist/types/element/src/stickyNote.d.ts +191 -0
  38. package/dist/types/element/src/textElement.d.ts +10 -2
  39. package/dist/types/element/src/textMeasurements.d.ts +15 -11
  40. package/dist/types/element/src/textWrapping.d.ts +3 -2
  41. package/dist/types/element/src/transform.d.ts +30 -7
  42. package/dist/types/element/src/typeChecks.d.ts +3 -2
  43. package/dist/types/element/src/types.d.ts +28 -6
  44. package/dist/types/element/src/utils.d.ts +8 -1
  45. package/dist/types/element/src/zindex.d.ts +1 -1
  46. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +48 -3
  47. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  48. package/dist/types/excalidraw/actions/actionBoundText.d.ts +62 -208
  49. package/dist/types/excalidraw/actions/actionCanvas.d.ts +121 -16
  50. package/dist/types/excalidraw/actions/actionClipboard.d.ts +32 -2
  51. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +16 -1
  52. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -546
  53. package/dist/types/excalidraw/actions/actionDeselect.d.ts +20 -2
  54. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
  55. package/dist/types/excalidraw/actions/actionElementLink.d.ts +16 -1
  56. package/dist/types/excalidraw/actions/actionElementLock.d.ts +32 -2
  57. package/dist/types/excalidraw/actions/actionExport.d.ts +39 -9
  58. package/dist/types/excalidraw/actions/actionFrame.d.ts +92 -479
  59. package/dist/types/excalidraw/actions/actionGroup.d.ts +34 -4
  60. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +66 -2
  61. package/dist/types/excalidraw/actions/actionLink.d.ts +16 -1
  62. package/dist/types/excalidraw/actions/actionMenu.d.ts +16 -1
  63. package/dist/types/excalidraw/actions/actionProperties.d.ts +42 -8
  64. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +17 -2
  65. package/dist/types/excalidraw/actions/actionStyles.d.ts +17 -2
  66. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +452 -6
  67. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +16 -1
  68. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -1
  69. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +16 -1
  70. package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
  71. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +16 -1
  72. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -1
  73. package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +198 -0
  74. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +16 -1
  75. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +16 -1
  76. package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
  77. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +16 -1
  78. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  79. package/dist/types/excalidraw/actions/index.d.ts +3 -0
  80. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  81. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  82. package/dist/types/excalidraw/appState.d.ts +26 -8
  83. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -1
  84. package/dist/types/excalidraw/charts/charts.helpers.d.ts +6 -5
  85. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -1
  86. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -1
  87. package/dist/types/excalidraw/charts/index.d.ts +2 -1
  88. package/dist/types/excalidraw/components/Actions.d.ts +10 -2
  89. package/dist/types/excalidraw/components/App.arrowText.d.ts +5 -39
  90. package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
  91. package/dist/types/excalidraw/components/App.d.ts +129 -218
  92. package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
  93. package/dist/types/excalidraw/components/App.host.d.ts +102 -0
  94. package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
  95. package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
  96. package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
  97. package/dist/types/excalidraw/components/App.selectionTool.d.ts +94 -0
  98. package/dist/types/excalidraw/components/App.text.d.ts +194 -0
  99. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  100. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  101. package/dist/types/excalidraw/components/App.viewport.d.ts +64 -4
  102. package/dist/types/excalidraw/components/App.wheel.d.ts +30 -0
  103. package/dist/types/excalidraw/components/App.wrap.d.ts +39 -0
  104. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
  105. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  106. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -1
  107. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  108. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
  109. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  110. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  111. package/dist/types/excalidraw/components/IconButton.d.ts +2 -0
  112. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
  113. package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
  114. package/dist/types/excalidraw/components/Minimap/Minimap.d.ts +15 -0
  115. package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
  116. package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
  117. package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
  118. package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
  119. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
  120. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
  121. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
  122. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +5 -2
  123. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
  124. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +4 -1
  125. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +3 -2
  126. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +14 -1
  127. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +16 -0
  128. package/dist/types/excalidraw/components/Tools.d.ts +7 -2
  129. package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
  130. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  131. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  132. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  133. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +0 -1
  134. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
  135. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  136. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  137. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +13 -2
  138. package/dist/types/excalidraw/components/icons.d.ts +2 -0
  139. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +3 -0
  140. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +2 -2
  141. package/dist/types/excalidraw/data/blob.d.ts +46 -16
  142. package/dist/types/excalidraw/data/index.d.ts +3 -3
  143. package/dist/types/excalidraw/data/json.d.ts +23 -8
  144. package/dist/types/excalidraw/fonts/Fonts.d.ts +9 -6
  145. package/dist/types/excalidraw/history.d.ts +10 -4
  146. package/dist/types/excalidraw/mermaid.d.ts +7 -0
  147. package/dist/types/excalidraw/reactUtils.d.ts +1 -1
  148. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  149. package/dist/types/excalidraw/renderer/animation.d.ts +11 -4
  150. package/dist/types/excalidraw/renderer/helpers.d.ts +18 -0
  151. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
  152. package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
  153. package/dist/types/excalidraw/scene/Renderer.d.ts +64 -3
  154. package/dist/types/excalidraw/scene/export.d.ts +343 -20
  155. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  156. package/dist/types/excalidraw/scene/types.d.ts +26 -2
  157. package/dist/types/excalidraw/types.d.ts +191 -22
  158. package/dist/types/excalidraw/viewport.d.ts +29 -1
  159. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -1
  160. package/dist/types/utils/src/index.d.ts +3 -1
  161. package/dist/types/utils/src/shape.d.ts +2 -2
  162. package/package.json +2 -2
  163. package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +0 -31
  164. package/dist/types/utils/src/export.d.ts +0 -35
@@ -1,5 +1,11 @@
1
1
  import type { AppState, Offsets, Zoom } from "@excalidraw/excalidraw/types";
2
2
  import type { ElementsMap, ExcalidrawElement } from "./types";
3
+ export type VerticalResizeAnchor = "top" | "bottom" | "center";
4
+ /** Keeps the chosen edge or center fixed when an element's height changes. */
5
+ export declare const getPositionAfterHeightChange: (element: Pick<ExcalidrawElement, "x" | "y" | "height" | "angle">, nextHeight: number, anchor?: VerticalResizeAnchor) => {
6
+ x: number;
7
+ y: number;
8
+ };
3
9
  export declare const INVISIBLY_SMALL_ELEMENT_SIZE = 0.1;
4
10
  export declare const isInvisiblySmallElement: (element: ExcalidrawElement) => boolean;
5
11
  export declare const isElementInViewport: (element: ExcalidrawElement, width: number, height: number, viewTransformations: {
@@ -0,0 +1,191 @@
1
+ import type { RenderEnvironment } from "./renderEnvironment";
2
+ import type { Scene } from "./Scene";
3
+ import type { VerticalResizeAnchor } from "./sizeHelpers";
4
+ import type { TransformHandleDirection } from "./transformHandles";
5
+ import type { ElementsMap, ExcalidrawElement, ExcalidrawStickyNoteElement, ExcalidrawTextElement, NonDeletedExcalidrawElement } from "./types";
6
+ export type StickyNoteRenderPoint = {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ export type StickyNotePathCommand = {
11
+ type: "move";
12
+ point: StickyNoteRenderPoint;
13
+ } | {
14
+ type: "line";
15
+ point: StickyNoteRenderPoint;
16
+ } | {
17
+ type: "quadratic";
18
+ control: StickyNoteRenderPoint;
19
+ point: StickyNoteRenderPoint;
20
+ };
21
+ export declare const normalizeStickyNoteStrokeColor: (strokeColor: string | null | undefined) => string;
22
+ export declare const normalizeStickyNoteBackgroundColor: (backgroundColor: string | null | undefined) => string;
23
+ /**
24
+ * The update that applies a picked color to an element under the sticky
25
+ * note policy: a note is always filled and its label — the visible text,
26
+ * which the note's own `strokeColor` seeds — never goes transparent. Every
27
+ * color surface (actions, both eyedroppers, paste styles, bind) routes
28
+ * through this instead of re-deriving the rule.
29
+ */
30
+ /**
31
+ * The element a color pick on `element` lands on. A note's label has no fill
32
+ * of its own, so a background pick on the label — the styles panel while
33
+ * editing it — goes to the note; everything else colors itself.
34
+ */
35
+ export declare const getColorTargetElement: (element: ExcalidrawElement, property: "strokeColor" | "backgroundColor", elementsMap: ElementsMap) => ExcalidrawElement;
36
+ export declare const getColorUpdate: (element: ExcalidrawElement, property: "strokeColor" | "backgroundColor", color: string, elementsMap: ElementsMap) => {
37
+ strokeColor: string;
38
+ } | {
39
+ backgroundColor: string;
40
+ };
41
+ /**
42
+ * A note's ink is one color: the container's `strokeColor` — the seed for a
43
+ * new label and what the creation-date footer paints with — and its label's.
44
+ * Run after a property write to copy the side that changed onto the other;
45
+ * when both changed, or neither (data that drifted), the label wins: it is
46
+ * the text the user styled. A transparent label always takes the note's
47
+ * color. Returns the same array when nothing needs to change.
48
+ */
49
+ export declare const syncStickyNoteInk: <T extends ExcalidrawElement>(elements: readonly T[], prevElementsMap: ElementsMap) => readonly T[];
50
+ export declare const getStickyNoteCornerRadius: (element: ExcalidrawStickyNoteElement) => number;
51
+ export declare const getStickyNoteRenderPoints: (element: ExcalidrawStickyNoteElement, { offsetX, offsetY, seedOffset, }?: {
52
+ offsetX?: number;
53
+ offsetY?: number;
54
+ seedOffset?: number;
55
+ }) => StickyNoteRenderPoint[];
56
+ export declare const getStickyNotePathCommands: (element: ExcalidrawStickyNoteElement, { shadow }?: {
57
+ shadow?: boolean;
58
+ }) => StickyNotePathCommand[];
59
+ export declare const normalizeStickyNoteFontSize: (fontSize: number) => number;
60
+ /** whether the text element is the label of a sticky note */
61
+ export declare const isStickyNoteBoundText: (textElement: ExcalidrawTextElement, elementsMap: ElementsMap) => boolean;
62
+ /**
63
+ * The font size the user picked: the ceiling the auto-fit shrinks from for a
64
+ * sticky note label, plain `fontSize` for any other text.
65
+ *
66
+ * Container-aware on purpose — generic binding repair (duplication, history)
67
+ * rewrites `containerId` without touching the ceiling, so a numeric
68
+ * `baseFontSize` alone does not prove the text is still sticky-bound.
69
+ */
70
+ export declare const getBaseFontSize: (textElement: ExcalidrawTextElement, elementsMap: ElementsMap) => number;
71
+ /** the update that applies a user-picked font size (see `getBaseFontSize`) */
72
+ export declare const getBaseFontSizeUpdate: (textElement: ExcalidrawTextElement, fontSize: number, elementsMap: ElementsMap) => {
73
+ fontSize: number;
74
+ } | {
75
+ baseFontSize: number;
76
+ };
77
+ /**
78
+ * The creation-date label: absolute, so painting needs no clock and exports
79
+ * don't go stale, and short ("7 Sep") while the year is the current one.
80
+ * `null` when the note has no usable timestamp (files restored without one).
81
+ * Fixed English in the viewer's local time zone — the element package has no
82
+ * locale, and the footer is chosen by width bucket rather than measured.
83
+ */
84
+ export declare const getStickyNoteDateLabel: (created: ExcalidrawStickyNoteElement["created"], { short, now }?: {
85
+ short?: boolean;
86
+ now?: number;
87
+ }) => string | null;
88
+ /**
89
+ * What the footer paints and where, in note-local coordinates — shared by the
90
+ * canvas and SVG renderers, which take the font and opacity from
91
+ * `STICKY_NOTE_FOOTER`. `null` for the 0×0 creation draft and anything under
92
+ * the data floor, where the band would overlap the top padding.
93
+ */
94
+ export declare const getStickyNoteFooter: (element: Pick<ExcalidrawStickyNoteElement, "created" | "width" | "height">, now?: number) => {
95
+ text: string;
96
+ x: number;
97
+ y: number;
98
+ } | null;
99
+ /**
100
+ * The smallest note the UI lets a user create or resize to: one line at the
101
+ * label's font ceiling plus padding (and, vertically, the footer), never below
102
+ * `STICKY_NOTE_MIN_SIZE`. Without the font term a fresh note would grow on
103
+ * the very first keystroke. Data-level passes (restore, action post-passes)
104
+ * only enforce the constant floor — the layout grows a note as needed.
105
+ */
106
+ export declare const getStickyNoteMinSize: ({ fontSize, fontFamily, }: Pick<ExcalidrawTextElement, "fontSize" | "fontFamily">) => {
107
+ width: number;
108
+ height: number;
109
+ };
110
+ export type StickyNoteLayoutAnchor = VerticalResizeAnchor;
111
+ export type StickyNoteLayoutOpts = {
112
+ /** unwrapped text to lay out; defaults to the label's `originalText` */
113
+ originalText?: string;
114
+ /**
115
+ * absolute base-height intent — the gesture-start value to preserve, or the
116
+ * height a resize asked for. Omitted = keep the note's live `baseHeight`
117
+ * (typing, style changes, restore).
118
+ */
119
+ baseHeight?: number;
120
+ /**
121
+ * absolute font-ceiling intent (a proportional resize passes
122
+ * `gesture-start ceiling × scale`). Omitted = keep the label's live ceiling.
123
+ * Never a multiplier on the live value — that compounds across pointer-moves.
124
+ */
125
+ baseFontSize?: number;
126
+ /** the edge that stays put when the content correction changes the height */
127
+ anchor?: StickyNoteLayoutAnchor;
128
+ /**
129
+ * the host whose text metrics the fit measures with; omitted = the global
130
+ * environment. An editor passes its own so a note laid out in one window
131
+ * (or headlessly) is measured with that realm's fonts and canvas.
132
+ */
133
+ renderEnvironment?: RenderEnvironment;
134
+ };
135
+ export type StickyNoteLayout = {
136
+ container: Pick<ExcalidrawStickyNoteElement, "x" | "y" | "width" | "height" | "baseHeight">;
137
+ text: Pick<ExcalidrawTextElement, "text" | "fontSize" | "baseFontSize" | "width" | "height" | "x" | "y" | "angle"> | null;
138
+ };
139
+ /**
140
+ * The single source of truth for a sticky note's geometry: wraps the label at
141
+ * the note's width, fits the font under the ceiling, grows the note past
142
+ * `baseHeight` only when the text still overflows at the minimum size, and
143
+ * positions the label inside. Pure — returns the updates for both elements.
144
+ */
145
+ export declare const getStickyNoteLayout: (container: ExcalidrawStickyNoteElement, textElement: ExcalidrawTextElement | null, opts?: StickyNoteLayoutOpts) => StickyNoteLayout;
146
+ /**
147
+ * Resize intents for a sticky note — the §3.3 matrix of the plan. Every value
148
+ * is absolute and derived from the gesture-start snapshot on each pointer-move,
149
+ * so releasing Shift (or Alt) mid-gesture restores the original base height
150
+ * and ceiling instead of keeping values a previous move scaled.
151
+ *
152
+ * - width-only gestures (free E/W, Stats W) preserve the base height
153
+ * - height-changing gestures use the requested height as the new base
154
+ * - proportional gestures (Shift on any handle, aspect-locked multi-select,
155
+ * Stats group) additionally scale the font ceiling with the note
156
+ * - flips preserve everything
157
+ * - the content correction anchors at the edge the gesture holds still
158
+ */
159
+ export declare const getStickyNoteResizeIntent: (
160
+ /** the note with the requested geometry already applied */
161
+ container: ExcalidrawStickyNoteElement, originalElementsMap: ElementsMap, handleDirection: TransformHandleDirection, { proportional, fromCenter, flip, }: {
162
+ proportional: boolean;
163
+ fromCenter: boolean;
164
+ flip?: boolean;
165
+ }) => Pick<StickyNoteLayoutOpts, "baseHeight" | "baseFontSize" | "anchor">;
166
+ /**
167
+ * Applies `getStickyNoteLayout` to a live scene, then runs the bound-arrow
168
+ * pass unless the caller already owns one (`bindings: false`) or needs to
169
+ * forward its context (`bindings: { simultaneouslyUpdated }` — arrows resized
170
+ * in the same gesture must not be moved by the pass, `updateBoundElements`
171
+ * skips them only when told).
172
+ */
173
+ export declare const updateStickyNoteLayout: (container: ExcalidrawStickyNoteElement, scene: Scene, { text, bindings, ...layoutOpts }?: StickyNoteLayoutOpts & {
174
+ /** the label to lay out when it is an uncommitted clone (font actions clone before install) */
175
+ text?: ExcalidrawTextElement | null;
176
+ bindings?: {
177
+ simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
178
+ } | false;
179
+ }) => StickyNoteLayout;
180
+ /**
181
+ * Applies `getStickyNoteLayout` inside an immutable elements array (property
182
+ * actions, paste styles, restore): the notes among `affectedIds` — or the
183
+ * notes whose labels are — get both halves merged into their clones. Elements
184
+ * that need no change keep their identity and version; when `prevElementsMap`
185
+ * is given, notes whose layout inputs did not change skip the fit entirely.
186
+ * Bound arrows are the caller's job once the result is installed.
187
+ */
188
+ export declare const relayoutStickyNotes: <T extends ExcalidrawElement>(elements: readonly T[], affectedIds: ReadonlySet<ExcalidrawElement["id"]>, opts?: {
189
+ prevElementsMap?: ElementsMap;
190
+ renderEnvironment?: RenderEnvironment;
191
+ }) => readonly T[];
@@ -1,10 +1,11 @@
1
1
  import { type Radians } from "@excalidraw/math";
2
2
  import type { ExtractSetType } from "@excalidraw/common/utility-types";
3
+ import type { RenderEnvironment } from "./renderEnvironment";
3
4
  import type { Scene } from "./Scene";
4
5
  import type { MaybeTransformHandleType } from "./transformHandles";
5
6
  import type { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, NonDeleted } from "./types";
6
- export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, scene: Scene) => void;
7
- export declare const handleBindTextResize: (container: ExcalidrawElement, scene: Scene, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean, shouldResizeFromCenter?: boolean) => void;
7
+ export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, scene: Scene, renderEnvironment?: RenderEnvironment) => void;
8
+ export declare const handleBindTextResize: (container: ExcalidrawElement, scene: Scene, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean, shouldResizeFromCenter?: boolean, flipByY?: boolean, renderEnvironment?: RenderEnvironment) => void;
8
9
  export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
9
10
  x: number;
10
11
  y: number;
@@ -29,6 +30,13 @@ export declare const getBoundTextElementPosition: (container: ExcalidrawElement,
29
30
  x: number;
30
31
  y: number;
31
32
  } | undefined;
33
+ /**
34
+ * Returns the text element with its accurate coords. An arrow label's
35
+ * position is derived from the arrow at render time rather than kept in
36
+ * sync on the element itself (see getBoundTextElementPosition), so
37
+ * consumers reading a label's coords directly must go through this helper.
38
+ */
39
+ export declare const getTextElementWithAccuratePosition: <T extends ExcalidrawTextElement>(textElement: T, elementsMap: ElementsMap) => T;
32
40
  export declare const shouldAllowVerticalAlign: (selectedElements: readonly ExcalidrawElement[], elementsMap: ElementsMap) => boolean;
33
41
  export declare const suppportsHorizontalAlign: (selectedElements: readonly ExcalidrawElement[], elementsMap: ElementsMap) => boolean;
34
42
  declare const VALID_CONTAINER_TYPES: Set<string>;
@@ -1,10 +1,11 @@
1
+ import type { RenderEnvironment } from "./renderEnvironment";
1
2
  import type { FontString, ExcalidrawTextElement } from "./types";
2
- export declare const measureText: (text: string, font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => {
3
+ export declare const measureText: (text: string, font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"], env?: RenderEnvironment) => {
3
4
  width: number;
4
5
  height: number;
5
6
  };
6
- export declare const getApproxMinLineWidth: (font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
7
- export declare const getMinTextElementWidth: (font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
7
+ export declare const getApproxMinLineWidth: (font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"], env?: RenderEnvironment) => number;
8
+ export declare const getMinTextElementWidth: (font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"], env?: RenderEnvironment) => number;
8
9
  export declare const isMeasureTextSupported: () => boolean;
9
10
  export declare const normalizeText: (text: string) => string;
10
11
  /**
@@ -19,21 +20,24 @@ export declare const detectLineHeight: (textElement: ExcalidrawTextElement) => E
19
20
  export declare const getLineHeightInPx: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
20
21
  export declare const getApproxMinLineHeight: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
21
22
  /**
22
- * Set a custom text metrics provider.
23
+ * Set a custom text metrics provider, for all text measured in an environment
24
+ * without its own (`RenderEnvironment["textMetrics"]`) -- e.g. elements
25
+ * created outside the editor, on a server. Pass `undefined` to go back to
26
+ * measuring on a canvas.
23
27
  *
24
28
  * Useful for overriding the width calculation algorithm where canvas API is not available / desired.
25
29
  */
26
- export declare const setCustomTextMetricsProvider: (provider: TextMetricsProvider) => void;
30
+ export declare const setCustomTextMetricsProvider: (provider: TextMetricsProvider | undefined) => void;
27
31
  export interface TextMetricsProvider {
28
32
  getLineWidth(text: string, fontString: FontString): number;
29
33
  }
30
- export declare const getLineWidth: (text: string, font: FontString) => number;
31
- export declare const getTextWidth: (text: string, font: FontString) => number;
34
+ export declare const getLineWidth: (text: string, font: FontString, env?: RenderEnvironment) => number;
35
+ export declare const getTextWidth: (text: string, font: FontString, env?: RenderEnvironment) => number;
32
36
  export declare const getTextHeight: (text: string, fontSize: number, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
33
37
  export declare const charWidth: {
34
- calculate: (char: string, font: FontString) => number;
35
- getCache: (font: FontString) => number[];
38
+ calculate: (char: string, font: FontString, env?: RenderEnvironment) => number;
39
+ getCache: (font: FontString, env?: RenderEnvironment) => number[] | undefined;
36
40
  clearCache: (font: FontString) => void;
37
41
  };
38
- export declare const getMinCharWidth: (font: FontString) => number;
39
- export declare const getMaxCharWidth: (font: FontString) => number;
42
+ export declare const getMinCharWidth: (font: FontString, env?: RenderEnvironment) => number;
43
+ export declare const getMaxCharWidth: (font: FontString, env?: RenderEnvironment) => number;
@@ -1,3 +1,4 @@
1
+ import type { RenderEnvironment } from "./renderEnvironment";
1
2
  import type { FontString } from "./types";
2
3
  /**
3
4
  * Test if a given text contains any CJK characters (including symbols, punctuation, etc,).
@@ -17,7 +18,7 @@ export declare const parseTokens: (line: string) => string[];
17
18
  * This is a convenience adapter over `getWrappedTextLines()` for call sites
18
19
  * that only need the rendered wrapped string and not the source offsets.
19
20
  */
20
- export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
21
+ export declare const wrapText: (text: string, font: FontString, maxWidth: number, env?: RenderEnvironment) => string;
21
22
  /**
22
23
  * A single rendered visual line produced from the original text.
23
24
  *
@@ -36,4 +37,4 @@ export type WrappedTextLine = {
36
37
  * This is the source-of-truth wrapping pipeline for callers that need more than the
37
38
  * final wrapped string, for example caret placement or future editor/rich-text mapping.
38
39
  */
39
- export declare const getWrappedTextLines: (text: string, font: FontString, maxWidth: number) => WrappedTextLine[];
40
+ export declare const getWrappedTextLines: (text: string, font: FontString, maxWidth: number, env?: RenderEnvironment) => WrappedTextLine[];
@@ -1,6 +1,13 @@
1
1
  import type { MarkOptional } from "@excalidraw/common/utility-types";
2
2
  import { type ElementConstructorOpts } from "./newElement";
3
- import type { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, NonDeletedExcalidrawElement, Ordered, TextAlign, VerticalAlign } from "./types";
3
+ import type { RenderEnvironment } from "./renderEnvironment";
4
+ import type { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, NonDeletedExcalidrawElement, Ordered, TextAlign, VerticalAlign, ExcalidrawStickyNoteElement } from "./types";
5
+ /**
6
+ * Options for elements generated from a skeleton fragment (bound labels and
7
+ * binding endpoints). Such elements are always constructed fresh, hence they
8
+ * never carry a creation time of their own.
9
+ */
10
+ type FragmentConstructorOpts = MarkOptional<Omit<ElementConstructorOpts, "created">, "x" | "y">;
4
11
  export type ValidLinearElement = {
5
12
  type: "arrow" | "line";
6
13
  x: number;
@@ -11,7 +18,9 @@ export type ValidLinearElement = {
11
18
  fontFamily?: FontFamilyValues;
12
19
  textAlign?: TextAlign;
13
20
  verticalAlign?: VerticalAlign;
14
- } & MarkOptional<ElementConstructorOpts, "x" | "y">;
21
+ /** where along an arrow's path (0-1) the label is centered */
22
+ labelPosition?: ExcalidrawTextElement["labelPosition"];
23
+ } & FragmentConstructorOpts;
15
24
  end?: (({
16
25
  type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
17
26
  id?: ExcalidrawGenericElement["id"];
@@ -25,7 +34,7 @@ export type ValidLinearElement = {
25
34
  type?: "text";
26
35
  id: ExcalidrawTextElement["id"];
27
36
  text: string;
28
- }) & Partial<ExcalidrawTextElement>)) & MarkOptional<ElementConstructorOpts, "x" | "y">;
37
+ }) & Partial<Omit<ExcalidrawTextElement, "created">>)) & FragmentConstructorOpts;
29
38
  start?: (({
30
39
  type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
31
40
  id?: ExcalidrawGenericElement["id"];
@@ -39,7 +48,7 @@ export type ValidLinearElement = {
39
48
  type?: "text";
40
49
  id: ExcalidrawTextElement["id"];
41
50
  text: string;
42
- }) & Partial<ExcalidrawTextElement>)) & MarkOptional<ElementConstructorOpts, "x" | "y">;
51
+ }) & Partial<Omit<ExcalidrawTextElement, "created">>)) & FragmentConstructorOpts;
43
52
  } & Partial<ExcalidrawLinearElement>;
44
53
  export type ValidContainer = {
45
54
  type: Exclude<ExcalidrawGenericElement["type"], "selection">;
@@ -50,13 +59,25 @@ export type ValidContainer = {
50
59
  fontFamily?: FontFamilyValues;
51
60
  textAlign?: TextAlign;
52
61
  verticalAlign?: VerticalAlign;
53
- } & MarkOptional<ElementConstructorOpts, "x" | "y">;
62
+ } & FragmentConstructorOpts;
54
63
  } & ElementConstructorOpts;
64
+ /**
65
+ * A sticky note: an always-filled note whose label auto-fits. `label.fontSize`
66
+ * is the font ceiling the fit shrinks from; the note grows past its height
67
+ * (kept as `baseHeight`) only once the label hits the minimum font size.
68
+ */
69
+ export type ValidStickyNote = {
70
+ type: "stickynote";
71
+ id?: ExcalidrawStickyNoteElement["id"];
72
+ label?: Extract<ValidContainer, {
73
+ label?: unknown;
74
+ }>["label"];
75
+ } & ElementConstructorOpts & Partial<Pick<ExcalidrawStickyNoteElement, "baseHeight">>;
55
76
  export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawIframeLikeElement | ExcalidrawFreeDrawElement> | ({
56
77
  type: Extract<ExcalidrawLinearElement["type"], "line">;
57
78
  x: number;
58
79
  y: number;
59
- } & Partial<ExcalidrawLinearElement>) | ValidContainer | ValidLinearElement | ({
80
+ } & Partial<ExcalidrawLinearElement>) | ValidContainer | ValidStickyNote | ValidLinearElement | ({
60
81
  type: "text";
61
82
  text: string;
62
83
  x: number;
@@ -77,5 +98,7 @@ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, Excal
77
98
  name?: string;
78
99
  } & Partial<ExcalidrawMagicFrameElement>);
79
100
  export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
80
- regenerateIds: boolean;
101
+ regenerateIds?: boolean;
102
+ renderEnvironment?: RenderEnvironment;
81
103
  }) => Ordered<NonDeletedExcalidrawElement>[];
104
+ export {};
@@ -1,12 +1,13 @@
1
1
  import type { ElementOrToolType } from "@excalidraw/excalidraw/types";
2
2
  import type { MarkNonNullable } from "@excalidraw/common/utility-types";
3
- import type { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement, ExcalidrawArrowElement, ExcalidrawElbowArrowElement, ExcalidrawLineElement, ExcalidrawFlowchartNodeElement, ExcalidrawLinearElementSubType } from "./types";
3
+ import type { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement, ExcalidrawArrowElement, ExcalidrawElbowArrowElement, ExcalidrawLineElement, ExcalidrawFlowchartNodeElement, ExcalidrawLinearElementSubType, ExcalidrawStickyNoteElement } from "./types";
4
4
  export declare const isInitializedImageElement: <T extends ExcalidrawElement>(element: T | null) => element is T & InitializedExcalidrawImageElement;
5
5
  export declare const isImageElement: <T extends ExcalidrawElement>(element: T | null) => element is T & ExcalidrawImageElement;
6
6
  export declare const isEmbeddableElement: <T extends ExcalidrawElement>(element: T | null | undefined) => element is T & ExcalidrawEmbeddableElement;
7
7
  export declare const isIframeElement: <T extends ExcalidrawElement>(element: T | null) => element is T & ExcalidrawIframeElement;
8
8
  export declare const isIframeLikeElement: <T extends ExcalidrawElement>(element: T | null) => element is T & ExcalidrawIframeLikeElement;
9
9
  export declare const isTextElement: <T extends ExcalidrawElement>(element: T | null) => element is T & ExcalidrawTextElement;
10
+ export declare const isStickyNoteElement: <T extends ExcalidrawElement>(element: T | null | undefined) => element is T & ExcalidrawStickyNoteElement;
10
11
  export declare const isFrameElement: <T extends ExcalidrawElement>(element: T | null) => element is T & ExcalidrawFrameElement;
11
12
  export declare const isMagicFrameElement: <T extends ExcalidrawElement>(element: T | null) => element is T & ExcalidrawMagicFrameElement;
12
13
  export declare const isFrameLikeElement: <T extends ExcalidrawElement>(element: T | null) => element is T & ExcalidrawFrameLikeElement;
@@ -35,7 +36,7 @@ export declare const hasBoundTextElement: <T extends ExcalidrawElement>(element:
35
36
  export declare const isBoundToContainer: <T extends ExcalidrawElement>(element: T | null) => element is T & ExcalidrawTextElementWithContainer;
36
37
  export declare const isArrowBoundToElement: (element: ExcalidrawArrowElement) => boolean;
37
38
  export declare const isUsingAdaptiveRadius: (type: string) => type is "rectangle" | "embeddable" | "iframe" | "image";
38
- export declare const isUsingProportionalRadius: (type: string) => type is "line" | "arrow" | "diamond";
39
+ export declare const isUsingProportionalRadius: (type: string) => type is "line" | "arrow" | "stickynote" | "diamond";
39
40
  export declare const canApplyRoundnessTypeToElement: (roundnessType: RoundnessType, element: ExcalidrawElement) => boolean;
40
41
  export declare const getDefaultRoundnessTypeForElement: (element: ExcalidrawElement) => {
41
42
  type: 2;
@@ -66,6 +66,11 @@ type _ExcalidrawElementBase = Readonly<{
66
66
  boundElements: readonly BoundElement[] | null;
67
67
  /** epoch (ms) timestamp of last element update */
68
68
  updated: number;
69
+ /** Client wall-clock creation time in epoch milliseconds; null if unknown.
70
+ Preserved for this element's lifetime, including edits and undo/redo,
71
+ and excluded from `ElementUpdate` (mutateElement / newElementWith).
72
+ Duplicating an element starts a new lifetime. Not an ordering clock. */
73
+ created: number | null;
69
74
  link: string | null;
70
75
  locked: boolean;
71
76
  customData?: Record<string, any>;
@@ -76,6 +81,14 @@ export type ExcalidrawSelectionElement = _ExcalidrawElementBase & {
76
81
  export type ExcalidrawRectangleElement = _ExcalidrawElementBase & {
77
82
  type: "rectangle";
78
83
  };
84
+ export type ExcalidrawStickyNoteElement = _ExcalidrawElementBase & Readonly<{
85
+ type: "stickynote";
86
+ /**
87
+ * The height the user set, from which the layout derives `height`: the
88
+ * note grows above it to fit its label and never shrinks below it
89
+ */
90
+ baseHeight: number;
91
+ }>;
79
92
  export type ExcalidrawDiamondElement = _ExcalidrawElementBase & {
80
93
  type: "diamond";
81
94
  };
@@ -150,14 +163,14 @@ export type ExcalidrawFrameLikeElement = ExcalidrawFrameElement | ExcalidrawMagi
150
163
  * These are elements that don't have any additional properties.
151
164
  */
152
165
  export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
153
- export type ExcalidrawFlowchartNodeElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
154
- export type ExcalidrawRectanguloidElement = ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawTextElement | ExcalidrawFreeDrawElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawSelectionElement;
166
+ export type ExcalidrawFlowchartNodeElement = ExcalidrawRectangleElement | ExcalidrawStickyNoteElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
167
+ export type ExcalidrawRectanguloidElement = ExcalidrawRectangleElement | ExcalidrawStickyNoteElement | ExcalidrawImageElement | ExcalidrawTextElement | ExcalidrawFreeDrawElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawSelectionElement;
155
168
  /**
156
169
  * ExcalidrawElement should be JSON serializable and (eventually) contain
157
170
  * no computed data. The list of all ExcalidrawElements should be shareable
158
171
  * between peers and contain no state local to the peer.
159
172
  */
160
- export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawArrowElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
173
+ export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawStickyNoteElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawArrowElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
161
174
  export type ExcalidrawNonSelectionElement = Exclude<ExcalidrawElement, ExcalidrawSelectionElement>;
162
175
  export type Ordered<TElement extends ExcalidrawElement> = TElement & {
163
176
  index: FractionalIndex;
@@ -171,10 +184,19 @@ export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
171
184
  type: "text";
172
185
  fontSize: number;
173
186
  fontFamily: FontFamilyValues;
187
+ /**
188
+ * The font size the user picked, from which the layout derives `fontSize`.
189
+ * Today only sticky note labels have one: the auto-fit shrinks below it
190
+ * and never above it (compare `baseHeight`, which the note grows above).
191
+ * `null` for every other text. Read it through `getBaseFontSize` —
192
+ * generic binding repair can detach a label without clearing this, so
193
+ * the container decides its meaning.
194
+ */
195
+ baseFontSize: number | null;
174
196
  text: string;
175
197
  textAlign: TextAlign;
176
198
  verticalAlign: VerticalAlign;
177
- containerId: ExcalidrawGenericElement["id"] | null;
199
+ containerId: ExcalidrawTextContainer["id"] | null;
178
200
  originalText: string;
179
201
  /**
180
202
  * If `true` the width will fit the text. If `false`, the text will
@@ -198,8 +220,8 @@ export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
198
220
  * */
199
221
  labelPosition?: number | null;
200
222
  }>;
201
- export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement;
202
- export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawArrowElement;
223
+ export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawStickyNoteElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement;
224
+ export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawStickyNoteElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawArrowElement;
203
225
  export type ExcalidrawTextElementWithContainer = {
204
226
  containerId: ExcalidrawTextContainer["id"];
205
227
  } & ExcalidrawTextElement;
@@ -35,6 +35,13 @@ export declare const isPathALoop: (points: ExcalidrawLinearElement["points"],
35
35
  /** supply if you want the loop detection to account for current zoom */
36
36
  zoomValue?: Zoom["value"]) => boolean;
37
37
  export declare const getCornerRadius: (x: number, element: ExcalidrawElement) => number;
38
- export declare const getSnapOutlineMidPoint: (point: GlobalPoint, element: ExcalidrawBindableElement, elementsMap: ElementsMap, zoom: AppState["zoom"]) => GlobalPoint | undefined;
38
+ export declare const getAllMidpoints: (element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint[];
39
+ export declare const getElbowArrowSnapMidPoint: (point: GlobalPoint, element: ExcalidrawBindableElement, elementsMap: ElementsMap, zoom: AppState["zoom"]) => {
40
+ point: GlobalPoint;
41
+ onAxis: boolean;
42
+ } | undefined;
43
+ export declare const getSnapOutlineMidPoint: (point: GlobalPoint, element: ExcalidrawBindableElement, elementsMap: ElementsMap, zoom: AppState["zoom"], arrow: {
44
+ elbowed: boolean;
45
+ }) => GlobalPoint | undefined;
39
46
  export declare const projectFixedPointOntoDiagonal: (arrow: ExcalidrawArrowElement, point: GlobalPoint, element: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, zoom: AppState["zoom"], isMidpointSnappingEnabled?: boolean) => GlobalPoint | null;
40
47
  export {};
@@ -6,7 +6,7 @@ import type { ExcalidrawArrowElement, ExcalidrawElement, NonDeletedExcalidrawEle
6
6
  * Moves the arrow element above any bindable elements it intersects with or
7
7
  * hovers over.
8
8
  */
9
- export declare const moveArrowAboveBindable: (point: GlobalPoint, arrow: ExcalidrawArrowElement, elements: readonly OrderedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, scene: Scene, hit?: NonDeletedExcalidrawElement) => readonly OrderedExcalidrawElement[];
9
+ export declare const moveArrowAboveBindable: (point: GlobalPoint, arrow: ExcalidrawArrowElement, elements: readonly OrderedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, scene: Scene, hoveredElement: NonDeletedExcalidrawElement) => readonly OrderedExcalidrawElement[];
10
10
  export declare const moveOneLeft: (allElements: readonly ExcalidrawElement[], appState: AppState, scene: Scene) => readonly ExcalidrawElement[];
11
11
  export declare const moveOneRight: (allElements: readonly ExcalidrawElement[], appState: AppState, scene: Scene) => readonly ExcalidrawElement[];
12
12
  export declare const moveAllLeft: (allElements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[] | ExcalidrawElement[];