@excalidraw/common 0.18.0-1118751 → 0.18.0-1440f2d

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 (130) hide show
  1. package/dist/dev/index.js +37 -18
  2. package/dist/dev/index.js.map +3 -3
  3. package/dist/prod/index.js +3 -3
  4. package/dist/types/common/src/constants.d.ts +4 -0
  5. package/dist/types/common/src/utils.d.ts +12 -1
  6. package/dist/types/element/src/align.d.ts +4 -1
  7. package/dist/types/element/src/binding.d.ts +70 -0
  8. package/dist/types/element/src/bounds.d.ts +10 -2
  9. package/dist/types/element/src/collision.d.ts +13 -0
  10. package/dist/types/element/src/cropElement.d.ts +36 -4
  11. package/dist/types/element/src/delta.d.ts +7 -1
  12. package/dist/types/element/src/distribute.d.ts +4 -1
  13. package/dist/types/element/src/dragElements.d.ts +8 -3
  14. package/dist/types/element/src/elbowArrow.d.ts +5 -0
  15. package/dist/types/element/src/embeddable.d.ts +2 -1
  16. package/dist/types/element/src/flowchart.d.ts +1 -7
  17. package/dist/types/element/src/frame.d.ts +19 -1
  18. package/dist/types/element/src/groups.d.ts +1 -6
  19. package/dist/types/element/src/image.d.ts +5 -2
  20. package/dist/types/element/src/index.d.ts +2 -0
  21. package/dist/types/element/src/linearElementEditor.d.ts +4 -1
  22. package/dist/types/element/src/listMarker.d.ts +39 -0
  23. package/dist/types/element/src/newElement.d.ts +17 -1
  24. package/dist/types/element/src/renderElement.d.ts +10 -0
  25. package/dist/types/element/src/renderEnvironment.d.ts +66 -0
  26. package/dist/types/element/src/resizeElements.d.ts +15 -5
  27. package/dist/types/element/src/selection.d.ts +1 -7
  28. package/dist/types/element/src/shape.d.ts +2 -0
  29. package/dist/types/element/src/stickyNote.d.ts +8 -0
  30. package/dist/types/element/src/textElement.d.ts +10 -2
  31. package/dist/types/element/src/textMeasurements.d.ts +15 -11
  32. package/dist/types/element/src/textWrapping.d.ts +3 -2
  33. package/dist/types/element/src/transform.d.ts +5 -1
  34. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +30 -3
  35. package/dist/types/excalidraw/actions/actionBoundText.d.ts +56 -214
  36. package/dist/types/excalidraw/actions/actionCanvas.d.ts +72 -12
  37. package/dist/types/excalidraw/actions/actionClipboard.d.ts +20 -2
  38. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +10 -1
  39. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -564
  40. package/dist/types/excalidraw/actions/actionDeselect.d.ts +13 -1
  41. package/dist/types/excalidraw/actions/actionElementLink.d.ts +10 -1
  42. package/dist/types/excalidraw/actions/actionElementLock.d.ts +20 -2
  43. package/dist/types/excalidraw/actions/actionExport.d.ts +22 -4
  44. package/dist/types/excalidraw/actions/actionFrame.d.ts +71 -528
  45. package/dist/types/excalidraw/actions/actionGroup.d.ts +20 -2
  46. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +10 -1
  47. package/dist/types/excalidraw/actions/actionLink.d.ts +10 -1
  48. package/dist/types/excalidraw/actions/actionMenu.d.ts +10 -1
  49. package/dist/types/excalidraw/actions/actionProperties.d.ts +20 -2
  50. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +10 -1
  51. package/dist/types/excalidraw/actions/actionStyles.d.ts +10 -1
  52. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +10 -1
  53. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +10 -1
  54. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +10 -1
  55. package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
  56. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +10 -1
  57. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +10 -1
  58. package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +198 -0
  59. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +10 -1
  60. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +10 -1
  61. package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
  62. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +10 -1
  63. package/dist/types/excalidraw/actions/index.d.ts +3 -0
  64. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  65. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  66. package/dist/types/excalidraw/appState.d.ts +4 -2
  67. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -1
  68. package/dist/types/excalidraw/charts/charts.helpers.d.ts +6 -5
  69. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -1
  70. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -1
  71. package/dist/types/excalidraw/charts/index.d.ts +2 -1
  72. package/dist/types/excalidraw/components/Actions.d.ts +9 -2
  73. package/dist/types/excalidraw/components/App.arrowText.d.ts +5 -39
  74. package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
  75. package/dist/types/excalidraw/components/App.d.ts +79 -264
  76. package/dist/types/excalidraw/components/App.duplicate.d.ts +52 -2
  77. package/dist/types/excalidraw/components/App.host.d.ts +102 -0
  78. package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
  79. package/dist/types/excalidraw/components/App.pan.d.ts +8 -0
  80. package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
  81. package/dist/types/excalidraw/components/App.selectionTool.d.ts +93 -0
  82. package/dist/types/excalidraw/components/App.text.d.ts +146 -0
  83. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  84. package/dist/types/excalidraw/components/App.viewport.d.ts +64 -4
  85. package/dist/types/excalidraw/components/App.wheel.d.ts +6 -2
  86. package/dist/types/excalidraw/components/App.wrap.d.ts +31 -0
  87. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -1
  88. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  89. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
  90. package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
  91. package/dist/types/excalidraw/components/Minimap/Minimap.d.ts +15 -0
  92. package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
  93. package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
  94. package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
  95. package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
  96. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
  97. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
  98. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
  99. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +5 -2
  100. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
  101. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +4 -1
  102. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +3 -2
  103. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +14 -1
  104. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +16 -0
  105. package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
  106. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +1 -1
  107. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +0 -1
  108. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  109. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  110. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +13 -2
  111. package/dist/types/excalidraw/components/icons.d.ts +1 -0
  112. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -0
  113. package/dist/types/excalidraw/data/blob.d.ts +24 -6
  114. package/dist/types/excalidraw/data/index.d.ts +3 -3
  115. package/dist/types/excalidraw/data/json.d.ts +12 -3
  116. package/dist/types/excalidraw/fonts/Fonts.d.ts +9 -6
  117. package/dist/types/excalidraw/history.d.ts +10 -4
  118. package/dist/types/excalidraw/mermaid.d.ts +7 -0
  119. package/dist/types/excalidraw/reactUtils.d.ts +1 -1
  120. package/dist/types/excalidraw/renderer/animation.d.ts +11 -4
  121. package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
  122. package/dist/types/excalidraw/scene/Renderer.d.ts +1 -1
  123. package/dist/types/excalidraw/scene/export.d.ts +343 -20
  124. package/dist/types/excalidraw/scene/types.d.ts +23 -1
  125. package/dist/types/excalidraw/types.d.ts +83 -14
  126. package/dist/types/excalidraw/viewport.d.ts +23 -1
  127. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -1
  128. package/dist/types/utils/src/index.d.ts +3 -1
  129. package/package.json +1 -1
  130. package/dist/types/utils/src/export.d.ts +0 -36
@@ -1,5 +1,6 @@
1
1
  import type { MarkOptional } from "@excalidraw/common/utility-types";
2
2
  import { type ElementConstructorOpts } from "./newElement";
3
+ import type { RenderEnvironment } from "./renderEnvironment";
3
4
  import type { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, NonDeletedExcalidrawElement, Ordered, TextAlign, VerticalAlign, ExcalidrawStickyNoteElement } from "./types";
4
5
  /**
5
6
  * Options for elements generated from a skeleton fragment (bound labels and
@@ -17,6 +18,8 @@ export type ValidLinearElement = {
17
18
  fontFamily?: FontFamilyValues;
18
19
  textAlign?: TextAlign;
19
20
  verticalAlign?: VerticalAlign;
21
+ /** where along an arrow's path (0-1) the label is centered */
22
+ labelPosition?: ExcalidrawTextElement["labelPosition"];
20
23
  } & FragmentConstructorOpts;
21
24
  end?: (({
22
25
  type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
@@ -95,6 +98,7 @@ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, Excal
95
98
  name?: string;
96
99
  } & Partial<ExcalidrawMagicFrameElement>);
97
100
  export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
98
- regenerateIds: boolean;
101
+ regenerateIds?: boolean;
102
+ renderEnvironment?: RenderEnvironment;
99
103
  }) => Ordered<NonDeletedExcalidrawElement>[];
100
104
  export {};
@@ -29,12 +29,20 @@ export declare const actionAddToLibrary: {
29
29
  boxSelectionMode: import("../types").BoxSelectionMode;
30
30
  bindingPreference: "enabled" | "disabled";
31
31
  isMidpointSnappingEnabled: boolean;
32
+ showHints: boolean;
32
33
  inputDevice: import("../types").InputDevice;
33
34
  suggestedBinding: {
34
35
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
35
36
  midPoint?: import("@excalidraw/math").GlobalPoint;
36
37
  } | null;
37
- hoveredArrowTextAnchor: {
38
+ textToolHover: {
39
+ type: "text";
40
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
41
+ } | {
42
+ type: "container";
43
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
44
+ } | {
45
+ type: "arrow";
38
46
  elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
39
47
  anchor: "start" | "end" | "label";
40
48
  } | null;
@@ -128,6 +136,7 @@ export declare const actionAddToLibrary: {
128
136
  selectedElementsAreBeingDragged: boolean;
129
137
  shouldCacheIgnoreZoom: boolean;
130
138
  zenModeEnabled: boolean;
139
+ minimapEnabled: boolean;
131
140
  theme: import("@excalidraw/element/types").Theme;
132
141
  gridSize: number;
133
142
  gridStep: number;
@@ -198,12 +207,20 @@ export declare const actionAddToLibrary: {
198
207
  boxSelectionMode: import("../types").BoxSelectionMode;
199
208
  bindingPreference: "enabled" | "disabled";
200
209
  isMidpointSnappingEnabled: boolean;
210
+ showHints: boolean;
201
211
  inputDevice: import("../types").InputDevice;
202
212
  suggestedBinding: {
203
213
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
204
214
  midPoint?: import("@excalidraw/math").GlobalPoint;
205
215
  } | null;
206
- hoveredArrowTextAnchor: {
216
+ textToolHover: {
217
+ type: "text";
218
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
219
+ } | {
220
+ type: "container";
221
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
222
+ } | {
223
+ type: "arrow";
207
224
  elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
208
225
  anchor: "start" | "end" | "label";
209
226
  } | null;
@@ -302,6 +319,7 @@ export declare const actionAddToLibrary: {
302
319
  duration?: number;
303
320
  } | null;
304
321
  zenModeEnabled: boolean;
322
+ minimapEnabled: boolean;
305
323
  theme: import("@excalidraw/element/types").Theme;
306
324
  gridSize: number;
307
325
  gridStep: number;
@@ -372,12 +390,20 @@ export declare const actionAddToLibrary: {
372
390
  boxSelectionMode: import("../types").BoxSelectionMode;
373
391
  bindingPreference: "enabled" | "disabled";
374
392
  isMidpointSnappingEnabled: boolean;
393
+ showHints: boolean;
375
394
  inputDevice: import("../types").InputDevice;
376
395
  suggestedBinding: {
377
396
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
378
397
  midPoint?: import("@excalidraw/math").GlobalPoint;
379
398
  } | null;
380
- hoveredArrowTextAnchor: {
399
+ textToolHover: {
400
+ type: "text";
401
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
402
+ } | {
403
+ type: "container";
404
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
405
+ } | {
406
+ type: "arrow";
381
407
  elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
382
408
  anchor: "start" | "end" | "label";
383
409
  } | null;
@@ -476,6 +502,7 @@ export declare const actionAddToLibrary: {
476
502
  duration?: number;
477
503
  } | null;
478
504
  zenModeEnabled: boolean;
505
+ minimapEnabled: boolean;
479
506
  theme: import("@excalidraw/element/types").Theme;
480
507
  gridSize: number;
481
508
  gridStep: number;
@@ -1,34 +1,26 @@
1
- import type { ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawTextElement } from "@excalidraw/element/types";
2
- import type { Mutable } from "@excalidraw/common/utility-types";
3
- import type { AppState } from "../types";
1
+ import type { Scene } from "@excalidraw/element";
2
+ import type { ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
+ import type { ActionResult } from "./types";
4
+ import type { AppClassProperties, AppState } from "../types";
5
+ /**
6
+ * Frees the container's text as it rendered: wrapped the same, at a fixed
7
+ * width.
8
+ */
9
+ export declare const unbindTextFromContainer: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, scene: Scene) => void;
4
10
  export declare const actionUnbindText: {
5
11
  name: "unbindText";
6
12
  label: string;
7
13
  trackEvent: {
8
14
  category: "element";
9
15
  };
10
- predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
11
- perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: import("../types").AppClassProperties) => {
16
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: AppClassProperties) => boolean;
17
+ perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: AppClassProperties) => {
12
18
  elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
13
- appState: Readonly<AppState>;
14
- captureUpdate: "IMMEDIATELY";
15
- };
16
- } & {
17
- keyTest?: undefined;
18
- };
19
- export declare const actionBindText: {
20
- name: "bindText";
21
- label: string;
22
- trackEvent: {
23
- category: "element";
24
- };
25
- predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
26
- perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: import("../types").AppClassProperties) => {
27
- elements: ExcalidrawElement[];
28
19
  appState: {
29
- selectedElementIds: {
30
- [x: string]: true;
31
- };
20
+ selectedElementIds: AppState["selectedElementIds"];
21
+ selectedGroupIds: AppState["selectedGroupIds"];
22
+ editingGroupId: AppState["editingGroupId"];
23
+ selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
32
24
  contextMenu: {
33
25
  items: import("../components/ContextMenu").ContextMenuItems;
34
26
  top: number;
@@ -38,27 +30,35 @@ export declare const actionBindText: {
38
30
  isLoading: boolean;
39
31
  errorMessage: React.ReactNode;
40
32
  activeEmbeddable: {
41
- element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
33
+ element: NonDeletedExcalidrawElement;
42
34
  state: "hover" | "active";
43
35
  } | null;
44
- newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
45
- resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
46
- multiElement: import("@excalidraw/element/types").NonDeleted<ExcalidrawLinearElement> | null;
47
- selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
36
+ newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
37
+ resizingElement: NonDeletedExcalidrawElement | null;
38
+ multiElement: NonDeleted<ExcalidrawLinearElement> | null;
39
+ selectionElement: NonDeletedExcalidrawElement | null;
48
40
  isBindingEnabled: boolean;
49
41
  boxSelectionMode: import("../types").BoxSelectionMode;
50
42
  bindingPreference: "enabled" | "disabled";
51
43
  isMidpointSnappingEnabled: boolean;
44
+ showHints: boolean;
52
45
  inputDevice: import("../types").InputDevice;
53
46
  suggestedBinding: {
54
- element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
47
+ element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
55
48
  midPoint?: import("@excalidraw/math").GlobalPoint;
56
49
  } | null;
57
- hoveredArrowTextAnchor: {
50
+ textToolHover: {
51
+ type: "text";
52
+ elementId: ExcalidrawElement["id"];
53
+ } | {
54
+ type: "container";
55
+ elementId: ExcalidrawElement["id"];
56
+ } | {
57
+ type: "arrow";
58
58
  elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
59
59
  anchor: "start" | "end" | "label";
60
60
  } | null;
61
- frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
61
+ frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
62
62
  frameRendering: {
63
63
  enabled: boolean;
64
64
  name: boolean;
@@ -66,7 +66,7 @@ export declare const actionBindText: {
66
66
  clip: boolean;
67
67
  };
68
68
  editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
69
- elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
69
+ elementsToHighlight: readonly NonDeletedExcalidrawElement[] | null;
70
70
  editingTextElement: ExcalidrawTextElement | null;
71
71
  activeTool: {
72
72
  lastActiveTool: import("../types").ActiveTool | null;
@@ -150,15 +150,12 @@ export declare const actionBindText: {
150
150
  duration?: number;
151
151
  } | null;
152
152
  zenModeEnabled: boolean;
153
+ minimapEnabled: boolean;
153
154
  theme: import("@excalidraw/element/types").Theme;
154
155
  gridSize: number;
155
156
  gridStep: number;
156
157
  gridModeEnabled: boolean;
157
158
  viewModeEnabled: boolean;
158
- selectedGroupIds: {
159
- [groupId: string]: boolean;
160
- };
161
- editingGroupId: import("@excalidraw/element/types").GroupId | null;
162
159
  width: number;
163
160
  height: number;
164
161
  offsetTop: number;
@@ -170,7 +167,6 @@ export declare const actionBindText: {
170
167
  panels: number;
171
168
  };
172
169
  showHyperlinkPopup: false | "info" | "editor";
173
- selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
174
170
  snapLines: readonly import("../snapping").SnapLine[];
175
171
  originSnapOffset: {
176
172
  x: number;
@@ -202,189 +198,35 @@ export declare const actionBindText: {
202
198
  } & {
203
199
  keyTest?: undefined;
204
200
  };
201
+ export declare const actionBindText: {
202
+ name: "bindText";
203
+ label: string;
204
+ trackEvent: {
205
+ category: "element";
206
+ };
207
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: AppClassProperties) => boolean;
208
+ perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: AppClassProperties) => ActionResult;
209
+ } & {
210
+ keyTest?: undefined;
211
+ };
212
+ /**
213
+ * A note and its label share one ink: the text the user styled wins, unless it
214
+ * is transparent (a note's label never is).
215
+ */
216
+ export declare const getStickyNoteInk: (textElement: ExcalidrawTextElement, container: ExcalidrawElement) => string | null;
217
+ /** binds the text to the (label-less) container, selecting the container */
218
+ export declare const bindTextToContainer: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, textElement: ExcalidrawTextElement, container: NonDeleted<ExcalidrawTextContainer>, app: AppClassProperties) => ActionResult;
219
+ export declare const pushContainerBelowText: (elements: readonly ExcalidrawElement[], container: ExcalidrawElement, textElement: ExcalidrawTextElement) => ExcalidrawElement[];
205
220
  export declare const actionWrapTextInContainer: {
206
221
  name: "wrapTextInContainer";
207
222
  label: string;
208
223
  trackEvent: {
209
224
  category: "element";
210
225
  };
211
- predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
212
- perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: import("../types").AppClassProperties) => {
213
- elements: readonly ExcalidrawElement[];
214
- appState: {
215
- selectedElementIds: Mutable<Readonly<{
216
- [id: string]: true;
217
- }>>;
218
- contextMenu: {
219
- items: import("../components/ContextMenu").ContextMenuItems;
220
- top: number;
221
- left: number;
222
- } | null;
223
- showWelcomeScreen: boolean;
224
- isLoading: boolean;
225
- errorMessage: React.ReactNode;
226
- activeEmbeddable: {
227
- element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
228
- state: "hover" | "active";
229
- } | null;
230
- newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
231
- resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
232
- multiElement: import("@excalidraw/element/types").NonDeleted<ExcalidrawLinearElement> | null;
233
- selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
234
- isBindingEnabled: boolean;
235
- boxSelectionMode: import("../types").BoxSelectionMode;
236
- bindingPreference: "enabled" | "disabled";
237
- isMidpointSnappingEnabled: boolean;
238
- inputDevice: import("../types").InputDevice;
239
- suggestedBinding: {
240
- element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
241
- midPoint?: import("@excalidraw/math").GlobalPoint;
242
- } | null;
243
- hoveredArrowTextAnchor: {
244
- elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
245
- anchor: "start" | "end" | "label";
246
- } | null;
247
- frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
248
- frameRendering: {
249
- enabled: boolean;
250
- name: boolean;
251
- outline: boolean;
252
- clip: boolean;
253
- };
254
- editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
255
- elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
256
- editingTextElement: ExcalidrawTextElement | null;
257
- activeTool: {
258
- lastActiveTool: import("../types").ActiveTool | null;
259
- locked: boolean;
260
- fromSelection: boolean;
261
- } & import("../types").ActiveTool;
262
- preferredSelectionTool: {
263
- type: "selection" | "lasso";
264
- initialized: boolean;
265
- };
266
- penMode: boolean;
267
- penDetected: boolean;
268
- exportBackground: boolean;
269
- exportEmbedScene: boolean;
270
- exportWithDarkMode: boolean;
271
- exportScale: number;
272
- currentItemStrokeColor: string;
273
- currentItemStickynoteStrokeColor: string;
274
- currentItemStickynoteBackgroundColor: string;
275
- currentItemBackgroundColor: string;
276
- currentItemFillStyle: ExcalidrawElement["fillStyle"];
277
- currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
278
- currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
279
- currentItemRoughness: number;
280
- currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
281
- currentItemOpacity: number;
282
- currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
283
- currentItemFontSize: number;
284
- currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
285
- currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
286
- currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
287
- currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
288
- currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
289
- currentItemArrowType: "sharp" | "round" | "elbow";
290
- viewBackgroundColor: string;
291
- scrollX: number;
292
- scrollY: number;
293
- scrollConstraints: import("../types").ScrollConstraints | null;
294
- cursorButton: "up" | "down";
295
- scrolledOutside: boolean;
296
- name: string | null;
297
- isResizing: boolean;
298
- isRotating: boolean;
299
- zoom: import("../types").Zoom;
300
- openMenu: "canvas" | null;
301
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
302
- openSidebar: {
303
- name: import("../types").SidebarName;
304
- tab?: import("../types").SidebarTabName;
305
- } | null;
306
- openDialog: null | {
307
- name: "imageExport" | "help" | "jsonExport";
308
- } | {
309
- name: "ttd";
310
- tab: "text-to-diagram" | "mermaid";
311
- } | {
312
- name: "commandPalette";
313
- } | {
314
- name: "settings";
315
- } | {
316
- name: "elementLinkSelector";
317
- sourceElementId: ExcalidrawElement["id"];
318
- } | {
319
- name: "charts";
320
- data: import("../charts").Spreadsheet;
321
- rawText: string;
322
- };
323
- defaultSidebarDockedPreference: boolean;
324
- lastPointerDownWith: import("@excalidraw/element/types").PointerType;
325
- hoveredElementIds: Readonly<{
326
- [id: string]: true;
327
- }>;
328
- previousSelectedElementIds: {
329
- [id: string]: true;
330
- };
331
- selectedElementsAreBeingDragged: boolean;
332
- shouldCacheIgnoreZoom: boolean;
333
- toast: {
334
- message: React.ReactNode;
335
- closable?: boolean;
336
- duration?: number;
337
- } | null;
338
- zenModeEnabled: boolean;
339
- theme: import("@excalidraw/element/types").Theme;
340
- gridSize: number;
341
- gridStep: number;
342
- gridModeEnabled: boolean;
343
- viewModeEnabled: boolean;
344
- selectedGroupIds: {
345
- [groupId: string]: boolean;
346
- };
347
- editingGroupId: import("@excalidraw/element/types").GroupId | null;
348
- width: number;
349
- height: number;
350
- offsetTop: number;
351
- offsetLeft: number;
352
- fileHandle: FileSystemFileHandle | null;
353
- collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
354
- stats: {
355
- open: boolean;
356
- panels: number;
357
- };
358
- showHyperlinkPopup: false | "info" | "editor";
359
- selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
360
- snapLines: readonly import("../snapping").SnapLine[];
361
- originSnapOffset: {
362
- x: number;
363
- y: number;
364
- } | null;
365
- objectsSnapModeEnabled: boolean;
366
- isCropping: boolean;
367
- croppingElementId: ExcalidrawElement["id"] | null;
368
- searchMatches: Readonly<{
369
- focusedId: ExcalidrawElement["id"] | null;
370
- matches: readonly import("../types").SearchMatch[];
371
- }> | null;
372
- activeLockedId: string | null;
373
- lockedMultiSelections: {
374
- [groupId: string]: true;
375
- };
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;
385
- };
386
- captureUpdate: "IMMEDIATELY";
387
- };
226
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: AppClassProperties) => boolean;
227
+ perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: AppClassProperties) => ActionResult;
388
228
  } & {
389
229
  keyTest?: undefined;
390
230
  };
231
+ /** wraps each (unbound) text in a new container, selecting the containers */
232
+ export declare const wrapTextsInContainers: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, textElements: readonly ExcalidrawTextElement[], app: AppClassProperties) => ActionResult;