@dwelle/excalidraw 0.5.0-e05a141 → 0.5.0-e2a82c4d8

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 (138) hide show
  1. package/dist/dev/{chunk-JCMFCSXV.js → chunk-7M7SVUYU.js} +121 -7
  2. package/dist/dev/chunk-7M7SVUYU.js.map +7 -0
  3. package/dist/dev/{chunk-P7XQCHXR.js → chunk-HJWER26G.js} +901 -439
  4. package/dist/dev/chunk-HJWER26G.js.map +7 -0
  5. package/dist/dev/{chunk-B7UQ5W6R.js → chunk-Q5BO7QEK.js} +2 -2
  6. package/dist/dev/{chunk-B7UQ5W6R.js.map → chunk-Q5BO7QEK.js.map} +1 -1
  7. package/dist/dev/components/TTDDialog/CodeMirrorEditor-4GD6MAJW.js +259 -0
  8. package/dist/dev/components/TTDDialog/CodeMirrorEditor-4GD6MAJW.js.map +7 -0
  9. package/dist/dev/data/{image-BUI6GQJR.js → image-UQK7BQY4.js} +3 -3
  10. package/dist/dev/index.css +2444 -173
  11. package/dist/dev/index.css.map +3 -3
  12. package/dist/dev/index.js +6875 -1415
  13. package/dist/dev/index.js.map +4 -4
  14. package/dist/dev/locales/{en-SEGQGVZN.js → en-IHKMFGHF.js} +6 -2
  15. package/dist/dev/subset-shared.chunk.js +1 -1
  16. package/dist/dev/subset-worker.chunk.js +1 -1
  17. package/dist/prod/chunk-QHCRJDAB.js +12 -0
  18. package/dist/prod/chunk-R2CZDOAE.js +34 -0
  19. package/dist/prod/{chunk-KDBB3MAO.js → chunk-XXRJJHWR.js} +1 -1
  20. package/dist/prod/components/TTDDialog/CodeMirrorEditor-P2CDXXOC.js +1 -0
  21. package/dist/prod/data/image-WAWRV65K.js +1 -0
  22. package/dist/prod/index.css +1 -1
  23. package/dist/prod/index.js +34 -25
  24. package/dist/prod/locales/en-QQWGF6XN.js +1 -0
  25. package/dist/prod/subset-shared.chunk.js +1 -1
  26. package/dist/prod/subset-worker.chunk.js +1 -1
  27. package/dist/types/common/src/utils.d.ts +5 -3
  28. package/dist/types/element/src/Scene.d.ts +2 -0
  29. package/dist/types/element/src/arrowheads.d.ts +3 -0
  30. package/dist/types/element/src/binding.d.ts +5 -4
  31. package/dist/types/element/src/bounds.d.ts +5 -3
  32. package/dist/types/element/src/elbowArrow.d.ts +2 -0
  33. package/dist/types/element/src/frame.d.ts +1 -1
  34. package/dist/types/element/src/index.d.ts +1 -0
  35. package/dist/types/element/src/linearElementEditor.d.ts +5 -2
  36. package/dist/types/element/src/mutateElement.d.ts +2 -0
  37. package/dist/types/element/src/selection.d.ts +7 -3
  38. package/dist/types/element/src/shape.d.ts +1 -1
  39. package/dist/types/element/src/textElement.d.ts +1 -1
  40. package/dist/types/element/src/textWrapping.d.ts +26 -0
  41. package/dist/types/element/src/types.d.ts +4 -1
  42. package/dist/types/element/src/utils.d.ts +2 -2
  43. package/dist/types/excalidraw/TTA/TTAChatEmptyState.d.ts +7 -0
  44. package/dist/types/excalidraw/TTA/TTAChatMessage.d.ts +15 -0
  45. package/dist/types/excalidraw/TTA/TTAComposer.d.ts +24 -0
  46. package/dist/types/excalidraw/TTA/TTADialog.d.ts +19 -0
  47. package/dist/types/excalidraw/TTA/TTADialogPanel.d.ts +46 -0
  48. package/dist/types/excalidraw/TTA/TTADialogTrigger.d.ts +10 -0
  49. package/dist/types/excalidraw/TTA/TTAHistory.d.ts +11 -0
  50. package/dist/types/excalidraw/TTA/TTAWarningMessage.d.ts +5 -0
  51. package/dist/types/excalidraw/TTA/chatErrors.d.ts +13 -0
  52. package/dist/types/excalidraw/TTA/chatHelpers.d.ts +26 -0
  53. package/dist/types/excalidraw/TTA/client.d.ts +74 -0
  54. package/dist/types/excalidraw/TTA/history.d.ts +2 -0
  55. package/dist/types/excalidraw/TTA/insertAISkeletons.d.ts +20 -0
  56. package/dist/types/excalidraw/TTA/types.d.ts +167 -0
  57. package/dist/types/excalidraw/TTA/useAIAssistantPreview.d.ts +18 -0
  58. package/dist/types/excalidraw/TTA/useAIStreamingCanvasPreview.d.ts +21 -0
  59. package/dist/types/excalidraw/TTA/useAIStreamingLifecycle.d.ts +34 -0
  60. package/dist/types/excalidraw/TTA/useTTAChatHistory.d.ts +18 -0
  61. package/dist/types/excalidraw/TTA/utils.d.ts +14 -0
  62. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +15 -6
  63. package/dist/types/excalidraw/actions/actionBoundText.d.ts +11 -5
  64. package/dist/types/excalidraw/actions/actionCanvas.d.ts +50 -20
  65. package/dist/types/excalidraw/actions/actionClipboard.d.ts +10 -4
  66. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +5 -2
  67. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +15 -6
  68. package/dist/types/excalidraw/actions/actionDeselect.d.ts +161 -0
  69. package/dist/types/excalidraw/actions/actionElementLink.d.ts +5 -2
  70. package/dist/types/excalidraw/actions/actionElementLock.d.ts +10 -4
  71. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +5 -2
  72. package/dist/types/excalidraw/actions/actionExport.d.ts +21 -8
  73. package/dist/types/excalidraw/actions/actionFrame.d.ts +20 -8
  74. package/dist/types/excalidraw/actions/actionGroup.d.ts +11 -5
  75. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +5 -2
  76. package/dist/types/excalidraw/actions/actionLink.d.ts +5 -2
  77. package/dist/types/excalidraw/actions/actionMenu.d.ts +5 -2
  78. package/dist/types/excalidraw/actions/actionProperties.d.ts +12 -6
  79. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +5 -2
  80. package/dist/types/excalidraw/actions/actionStyles.d.ts +6 -2
  81. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
  82. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +174 -0
  83. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +5 -2
  84. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +174 -0
  85. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -2
  86. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +5 -2
  87. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +5 -2
  88. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +5 -2
  89. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +5 -2
  90. package/dist/types/excalidraw/actions/index.d.ts +3 -0
  91. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  92. package/dist/types/excalidraw/aiWarnings.d.ts +7 -0
  93. package/dist/types/excalidraw/appState.d.ts +4 -0
  94. package/dist/types/excalidraw/components/AI/ChatMessage.d.ts +33 -0
  95. package/dist/types/excalidraw/components/AI/index.d.ts +2 -0
  96. package/dist/types/excalidraw/components/App.d.ts +11 -1
  97. package/dist/types/excalidraw/components/FilledButton.d.ts +1 -1
  98. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  99. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  100. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDRateLimitWarningContent.d.ts +5 -0
  101. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  102. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +2 -2
  103. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  104. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +4 -1
  105. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  106. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +5 -1
  107. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +24 -6
  108. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  109. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
  110. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -0
  111. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
  112. package/dist/types/excalidraw/components/icons.d.ts +18 -8
  113. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +3 -0
  114. package/dist/types/excalidraw/context/tunnels.d.ts +1 -0
  115. package/dist/types/excalidraw/data/blob.d.ts +9 -3
  116. package/dist/types/excalidraw/data/filesystem.d.ts +3 -3
  117. package/dist/types/excalidraw/data/index.d.ts +1 -1
  118. package/dist/types/excalidraw/data/json.d.ts +6 -3
  119. package/dist/types/excalidraw/data/resave.d.ts +1 -1
  120. package/dist/types/excalidraw/data/sse.d.ts +15 -0
  121. package/dist/types/excalidraw/index.d.ts +15 -2
  122. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  123. package/dist/types/excalidraw/types.d.ts +15 -2
  124. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +5 -1
  125. package/dist/types/math/src/curve.d.ts +4 -1
  126. package/dist/types/math/src/point.d.ts +1 -1
  127. package/package.json +11 -5
  128. package/CHANGELOG.md +0 -2385
  129. package/dist/dev/chunk-JCMFCSXV.js.map +0 -7
  130. package/dist/dev/chunk-P7XQCHXR.js.map +0 -7
  131. package/dist/prod/chunk-FVPDTNSG.js +0 -12
  132. package/dist/prod/chunk-LRBVLW2I.js +0 -33
  133. package/dist/prod/data/image-KI7JN73E.js +0 -1
  134. package/dist/prod/locales/en-6237XDE7.js +0 -1
  135. package/dist/types/excalidraw/data/ai/types.d.ts +0 -242
  136. package/history.ts +0 -249
  137. /package/dist/dev/data/{image-BUI6GQJR.js.map → image-UQK7BQY4.js.map} +0 -0
  138. /package/dist/dev/locales/{en-SEGQGVZN.js.map → en-IHKMFGHF.js.map} +0 -0
@@ -89,12 +89,14 @@ declare class App extends React.Component<AppProps, AppState> {
89
89
  hitLinkElement?: NonDeletedExcalidrawElement;
90
90
  lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
91
91
  lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
92
+ lastPointerUpIsDoubleClick: boolean;
92
93
  lastPointerMoveEvent: PointerEvent | null;
93
94
  /** current frame pointer cords */
94
95
  lastPointerMoveCoords: {
95
96
  x: number;
96
97
  y: number;
97
98
  } | null;
99
+ private lastCompletedCanvasClicks;
98
100
  /** previous frame pointer coords */
99
101
  previousPointerMoveCoords: {
100
102
  x: number;
@@ -241,6 +243,7 @@ declare class App extends React.Component<AppProps, AppState> {
241
243
  onRemoveEventListenersEmitter: Emitter<[]>;
242
244
  constructor(props: AppProps);
243
245
  updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
246
+ setSessionExportThemeOverride(theme: AppState["theme"]): void;
244
247
  private onWindowMessage;
245
248
  private handleSkipBindMode;
246
249
  private resetDelayedBindMode;
@@ -252,10 +255,12 @@ declare class App extends React.Component<AppProps, AppState> {
252
255
  * If disabled, returns null.
253
256
  */
254
257
  getEffectiveGridSize: () => NullableGridSize;
258
+ private getTextCreationGridPoint;
255
259
  private getHTMLIFrameElement;
256
260
  private handleIframeLikeElementHover;
257
261
  /** @returns true if iframe-like element click handled */
258
262
  private handleIframeLikeCenterClick;
263
+ private isDoubleClick;
259
264
  private isIframeLikeElementCenter;
260
265
  private updateEmbedValidationStatus;
261
266
  private updateEmbeddables;
@@ -453,7 +458,11 @@ declare class App extends React.Component<AppProps, AppState> {
453
458
  private onGestureEnd;
454
459
  private handleTextWysiwyg;
455
460
  private deselectElements;
461
+ private getSelectedTextElement;
462
+ private getSelectedTextEditingContainerAtPosition;
456
463
  private getTextElementAtPosition;
464
+ private isHittingTextAutoResizeHandle;
465
+ private handleTextAutoResizeHandlePointerDown;
457
466
  private getElementAtPosition;
458
467
  private getElementsAtPosition;
459
468
  getElementHitThreshold(element: ExcalidrawElement): number;
@@ -462,7 +471,9 @@ declare class App extends React.Component<AppProps, AppState> {
462
471
  private startTextEditing;
463
472
  private startImageCropping;
464
473
  private finishImageCropping;
474
+ private shouldHandleBrowserCanvasDoubleClick;
465
475
  private handleCanvasDoubleClick;
476
+ private handleCanvasClick;
466
477
  private getElementLinkAtPosition;
467
478
  private handleElementLinkClick;
468
479
  private getTopLayerFrameAtSceneCoords;
@@ -535,7 +546,6 @@ declare class App extends React.Component<AppProps, AppState> {
535
546
  /** generally you should use `addNewImagesToImageCache()` directly if you need
536
547
  * to render new images. This is just a failsafe */
537
548
  private scheduleImageRefresh;
538
- private updateBindingEnabledOnPointerMove;
539
549
  private clearSelection;
540
550
  private handleInteractiveCanvasRef;
541
551
  private insertImages;
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import "./FilledButton.scss";
3
3
  export type ButtonVariant = "filled" | "outlined" | "icon";
4
4
  export type ButtonColor = "primary" | "danger" | "warning" | "muted" | "success";
5
- export type ButtonSize = "medium" | "large";
5
+ export type ButtonSize = "small" | "medium" | "large";
6
6
  export type FilledButtonProps = {
7
7
  label?: string;
8
8
  children?: React.ReactNode;
@@ -1,15 +1,20 @@
1
1
  import "./IconPicker.scss";
2
2
  import type { JSX } from "react";
3
- export declare function IconPicker<T>({ value, label, options, onChange, group, numberOfOptionsToAlwaysShow, }: {
3
+ type Option<T> = {
4
+ value: T;
5
+ text: string;
6
+ icon: JSX.Element;
7
+ keyBinding: string | null;
8
+ };
9
+ type PickerSection<T> = {
10
+ name: string;
11
+ options: readonly Option<T>[];
12
+ };
13
+ export declare function IconPicker<T>({ value, label, visibleSections, hiddenSections, onChange, }: {
4
14
  label: string;
5
15
  value: T;
6
- options: readonly {
7
- value: T;
8
- text: string;
9
- icon: JSX.Element;
10
- keyBinding: string | null;
11
- }[];
16
+ visibleSections: readonly PickerSection<T>[];
17
+ hiddenSections?: readonly PickerSection<T>[];
12
18
  onChange: (value: T) => void;
13
- numberOfOptionsToAlwaysShow?: number;
14
- group?: string;
15
19
  }): import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -1,8 +1,14 @@
1
+ import React from "react";
1
2
  import "./Range.scss";
2
- import type { AppClassProperties } from "../types";
3
3
  export type RangeProps = {
4
- updateData: (value: number) => void;
5
- app: AppClassProperties;
4
+ label: React.ReactNode;
5
+ value: number;
6
+ onChange: (value: number) => void;
7
+ min?: number;
8
+ max?: number;
9
+ step?: number;
10
+ minLabel?: React.ReactNode;
11
+ hasCommonValue?: boolean;
6
12
  testId?: string;
7
13
  };
8
- export declare const Range: ({ updateData, app, testId }: RangeProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const Range: ({ label, value, onChange, min, max, step, minLabel, hasCommonValue, testId, }: RangeProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { AIRateLimitWarningDescriptor } from "../../../aiWarnings";
2
+ export declare const TTDRateLimitWarningContent: ({ warning, onUpgrade, }: {
3
+ warning: AIRateLimitWarningDescriptor;
4
+ onUpgrade?: () => void;
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { Theme } from "@excalidraw/element/types";
2
+ export interface CodeMirrorEditorProps {
3
+ value: string;
4
+ onChange: (value: string) => void;
5
+ onKeyboardSubmit?: () => void;
6
+ placeholder?: string;
7
+ theme: Theme;
8
+ errorLine?: number | null;
9
+ }
10
+ declare const CodeMirrorEditor: ({ value, onChange, onKeyboardSubmit, placeholder, theme, errorLine, }: CodeMirrorEditorProps) => import("react/jsx-runtime").JSX.Element;
11
+ export default CodeMirrorEditor;
@@ -1,8 +1,8 @@
1
1
  import "./TTDDialog.scss";
2
- import type { TTDPersistenceAdapter, TTTDDialog } from "./types";
2
+ import type { TTDPersistenceAdapter, TTDTransportAdapter, TTTDDialog } from "./types";
3
3
  export declare const TTDDialog: {
4
4
  (props: {
5
- onTextSubmit: TTTDDialog.onTextSubmit;
5
+ transportAdapter: TTDTransportAdapter;
6
6
  renderWelcomeScreen?: TTTDDialog.renderWelcomeScreen;
7
7
  renderWarning?: TTTDDialog.renderWarning;
8
8
  persistenceAdapter: TTDPersistenceAdapter;
@@ -1,9 +1,9 @@
1
- import type { ChangeEventHandler } from "react";
2
1
  interface TTDDialogInputProps {
3
2
  input: string;
4
3
  placeholder: string;
5
- onChange: ChangeEventHandler<HTMLTextAreaElement>;
4
+ onChange: (value: string) => void;
6
5
  onKeyboardSubmit?: () => void;
6
+ errorLine?: number | null;
7
7
  }
8
- export declare const TTDDialogInput: ({ input, placeholder, onChange, onKeyboardSubmit, }: TTDDialogInputProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const TTDDialogInput: ({ input, placeholder, onChange, onKeyboardSubmit, errorLine, }: TTDDialogInputProps) => import("react/jsx-runtime").JSX.Element | null;
9
9
  export {};
@@ -3,6 +3,9 @@ interface TTDDialogOutputProps {
3
3
  canvasRef: React.RefObject<HTMLDivElement | null>;
4
4
  loaded: boolean;
5
5
  hideErrorDetails?: boolean;
6
+ sourceText?: string;
7
+ autoFixAvailable?: boolean;
8
+ onApplyAutoFix?: () => void;
6
9
  }
7
- export declare const TTDDialogOutput: ({ error, canvasRef, loaded, hideErrorDetails, }: TTDDialogOutputProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const TTDDialogOutput: ({ error, canvasRef, loaded, hideErrorDetails, sourceText, autoFixAvailable, onApplyAutoFix, }: TTDDialogOutputProps) => import("react/jsx-runtime").JSX.Element;
8
11
  export {};
@@ -0,0 +1,2 @@
1
+ import { StreamLanguage } from "@codemirror/language";
2
+ export declare function mermaidLite(): StreamLanguage<unknown>;
@@ -2,6 +2,7 @@ import type { RequestError } from "@excalidraw/excalidraw/errors";
2
2
  import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
3
  import type { MermaidConfig } from "@excalidraw/mermaid-to-excalidraw";
4
4
  import type { MermaidToExcalidrawResult } from "@excalidraw/mermaid-to-excalidraw/dist/interfaces";
5
+ import type { AIRateLimitWarningDescriptor } from "../../aiWarnings";
5
6
  import type { BinaryFiles } from "../../types";
6
7
  export type LLMMessage = {
7
8
  role: "user" | "assistant";
@@ -56,6 +57,9 @@ export interface TTDPersistenceAdapter {
56
57
  */
57
58
  saveChats(chats: SavedChats): Promise<void>;
58
59
  }
60
+ export interface TTDTransportAdapter {
61
+ stream(props: TTTDDialog.OnTextSubmitProps): Promise<TTTDDialog.OnTextSubmitRetValue>;
62
+ }
59
63
  export interface MermaidToExcalidrawLibProps {
60
64
  loaded: boolean;
61
65
  api: Promise<{
@@ -87,7 +91,7 @@ export declare namespace TTTDDialog {
87
91
  /**
88
92
  * return undefined to use default rendering
89
93
  */
90
- type renderWarning = (chatMessage: TChat.ChatMessage) => React.ReactNode | undefined;
94
+ type renderWarning = (warning: AIRateLimitWarningDescriptor, chatMessage: TChat.ChatMessage) => React.ReactNode | undefined;
91
95
  type renderWelcomeScreen = (props: {
92
96
  /** null if not rate limit data currently available */
93
97
  rateLimits: RateLimits | null;
@@ -1,11 +1,22 @@
1
- import type { LLMMessage, TTTDDialog } from "@excalidraw/excalidraw/components/TTDDialog/types";
2
- interface StreamingOptions {
3
- url: string;
1
+ import type { LLMMessage, TTDTransportAdapter, TTTDDialog } from "../types";
2
+ export interface TTDStreamFetchRequest {
3
+ method: "POST";
4
+ headers: {
5
+ Accept: "text/event-stream";
6
+ "Content-Type": "application/json";
7
+ };
8
+ payload: {
9
+ messages: readonly LLMMessage[];
10
+ };
11
+ signal?: AbortSignal;
12
+ }
13
+ export type TTDStreamResponseFetch = (request: TTDStreamFetchRequest) => Promise<Response>;
14
+ export interface TTDStreamFetchOptions {
4
15
  messages: readonly LLMMessage[];
5
16
  onChunk?: (chunk: string) => void;
6
- extractRateLimits?: boolean;
7
17
  signal?: AbortSignal;
8
18
  onStreamCreated?: () => void;
19
+ fetch: TTDStreamResponseFetch;
9
20
  }
10
21
  export type StreamChunk = {
11
22
  type: "content";
@@ -20,5 +31,12 @@ export type StreamChunk = {
20
31
  status?: number;
21
32
  };
22
33
  };
23
- export declare function TTDStreamFetch(options: StreamingOptions): Promise<TTTDDialog.OnTextSubmitRetValue>;
24
- export {};
34
+ export interface TTDTransportAdapterConfig {
35
+ stream: TTDStreamResponseFetch;
36
+ }
37
+ export declare class TTDDefaultTransportAdapter implements TTDTransportAdapter {
38
+ private readonly config;
39
+ constructor(config: TTDTransportAdapterConfig);
40
+ stream: TTDTransportAdapter["stream"];
41
+ }
42
+ export declare function TTDStreamFetch(options: TTDStreamFetchOptions): Promise<TTTDDialog.OnTextSubmitRetValue>;
@@ -0,0 +1 @@
1
+ export declare const getMermaidAutoFixCandidates: (sourceText: string, errorMessage: string) => string[];
@@ -0,0 +1,10 @@
1
+ export declare const isMermaidParseSyntaxError: (message: string) => boolean;
2
+ export declare const isMermaidAutoFixableError: (message: string) => boolean;
3
+ export declare const isMermaidCaretLine: (line: string) => boolean;
4
+ export declare const getMermaidInactiveParticipant: (message: string) => string | null;
5
+ export declare const getMermaidErrorLineNumber: (message: string, sourceText?: string) => number | null;
6
+ export declare const getMermaidSyntaxErrorGuidance: (message: string, sourceText?: string) => {
7
+ summary: string;
8
+ likelyCauses: string[];
9
+ } | null;
10
+ export declare const formatMermaidParseErrorMessage: (message: string) => string;
@@ -21,6 +21,7 @@ type InteractiveCanvasProps = {
21
21
  renderInteractiveSceneCallback: (data: RenderInteractiveSceneCallback) => void;
22
22
  handleCanvasRef: (canvas: HTMLCanvasElement | null) => void;
23
23
  onContextMenu: Exclude<DOMAttributes<HTMLCanvasElement | HTMLDivElement>["onContextMenu"], undefined>;
24
+ onClick: Exclude<DOMAttributes<HTMLCanvasElement>["onClick"], undefined>;
24
25
  onPointerMove: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerMove"], undefined>;
25
26
  onPointerUp: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerUp"], undefined>;
26
27
  onPointerCancel: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerCancel"], undefined>;
@@ -9,9 +9,10 @@ type Props<T> = {
9
9
  onChange: (value: T) => void;
10
10
  children: React.ReactNode;
11
11
  name: string;
12
+ icon?: React.ReactNode;
12
13
  };
13
14
  declare const DropdownMenuItemContentRadio: {
14
- <T>({ value, shortcut, onChange, choices, children, name, }: Props<T>): import("react/jsx-runtime").JSX.Element;
15
+ <T>({ value, shortcut, onChange, choices, children, name, icon, }: Props<T>): import("react/jsx-runtime").JSX.Element;
15
16
  displayName: string;
16
17
  };
17
18
  export default DropdownMenuItemContentRadio;
@@ -122,34 +122,43 @@ export declare const ArrowheadNoneIcon: React.MemoExoticComponent<({ flip }: {
122
122
  export declare const ArrowheadArrowIcon: React.MemoExoticComponent<({ flip }: {
123
123
  flip?: boolean;
124
124
  }) => import("react/jsx-runtime").JSX.Element>;
125
+ export declare const ArrowheadTriangleIcon: React.MemoExoticComponent<({ flip }: {
126
+ flip?: boolean;
127
+ }) => import("react/jsx-runtime").JSX.Element>;
128
+ export declare const ArrowheadTriangleOutlineIcon: React.MemoExoticComponent<({ flip }: {
129
+ flip?: boolean;
130
+ }) => import("react/jsx-runtime").JSX.Element>;
125
131
  export declare const ArrowheadCircleIcon: React.MemoExoticComponent<({ flip }: {
126
132
  flip?: boolean;
127
133
  }) => import("react/jsx-runtime").JSX.Element>;
128
134
  export declare const ArrowheadCircleOutlineIcon: React.MemoExoticComponent<({ flip }: {
129
135
  flip?: boolean;
130
136
  }) => import("react/jsx-runtime").JSX.Element>;
131
- export declare const ArrowheadBarIcon: React.MemoExoticComponent<({ flip }: {
137
+ export declare const ArrowheadDiamondIcon: React.MemoExoticComponent<({ flip }: {
132
138
  flip?: boolean;
133
139
  }) => import("react/jsx-runtime").JSX.Element>;
134
- export declare const ArrowheadTriangleIcon: React.MemoExoticComponent<({ flip }: {
140
+ export declare const ArrowheadDiamondOutlineIcon: React.MemoExoticComponent<({ flip }: {
135
141
  flip?: boolean;
136
142
  }) => import("react/jsx-runtime").JSX.Element>;
137
- export declare const ArrowheadTriangleOutlineIcon: React.MemoExoticComponent<({ flip }: {
143
+ export declare const ArrowheadBarIcon: React.MemoExoticComponent<({ flip }: {
138
144
  flip?: boolean;
139
145
  }) => import("react/jsx-runtime").JSX.Element>;
140
- export declare const ArrowheadDiamondIcon: React.MemoExoticComponent<({ flip }: {
146
+ export declare const ArrowheadCardinalityOneIcon: React.MemoExoticComponent<({ flip }: {
141
147
  flip?: boolean;
142
148
  }) => import("react/jsx-runtime").JSX.Element>;
143
- export declare const ArrowheadDiamondOutlineIcon: React.MemoExoticComponent<({ flip }: {
149
+ export declare const ArrowheadCardinalityManyIcon: React.MemoExoticComponent<({ flip }: {
150
+ flip?: boolean;
151
+ }) => import("react/jsx-runtime").JSX.Element>;
152
+ export declare const ArrowheadCardinalityOneOrManyIcon: React.MemoExoticComponent<({ flip }: {
144
153
  flip?: boolean;
145
154
  }) => import("react/jsx-runtime").JSX.Element>;
146
- export declare const ArrowheadCrowfootIcon: React.MemoExoticComponent<({ flip }: {
155
+ export declare const ArrowheadCardinalityExactlyOneIcon: React.MemoExoticComponent<({ flip }: {
147
156
  flip?: boolean;
148
157
  }) => import("react/jsx-runtime").JSX.Element>;
149
- export declare const ArrowheadCrowfootOneIcon: React.MemoExoticComponent<({ flip }: {
158
+ export declare const ArrowheadCardinalityZeroOrOneIcon: React.MemoExoticComponent<({ flip }: {
150
159
  flip?: boolean;
151
160
  }) => import("react/jsx-runtime").JSX.Element>;
152
- export declare const ArrowheadCrowfootOneOrManyIcon: React.MemoExoticComponent<({ flip }: {
161
+ export declare const ArrowheadCardinalityZeroOrManyIcon: React.MemoExoticComponent<({ flip }: {
153
162
  flip?: boolean;
154
163
  }) => import("react/jsx-runtime").JSX.Element>;
155
164
  export declare const FontSizeSmallIcon: import("react/jsx-runtime").JSX.Element;
@@ -241,4 +250,5 @@ export declare const presentationIcon: import("react/jsx-runtime").JSX.Element;
241
250
  export declare const emptyIcon: import("react/jsx-runtime").JSX.Element;
242
251
  export declare const chevronRight: import("react/jsx-runtime").JSX.Element;
243
252
  export declare const settingsIcon: import("react/jsx-runtime").JSX.Element;
253
+ export declare const SendIcon: import("react/jsx-runtime").JSX.Element;
244
254
  export {};
@@ -70,7 +70,10 @@ export declare const Preferences: {
70
70
  additionalItems?: React.ReactNode;
71
71
  }): import("react/jsx-runtime").JSX.Element;
72
72
  ToggleToolLock: () => import("react/jsx-runtime").JSX.Element;
73
+ BoxSelectionMode: () => import("react/jsx-runtime").JSX.Element;
73
74
  ToggleSnapMode: () => import("react/jsx-runtime").JSX.Element;
75
+ ToggleArrowBinding: () => import("react/jsx-runtime").JSX.Element;
76
+ ToggleMidpointSnapping: () => import("react/jsx-runtime").JSX.Element;
74
77
  ToggleGridMode: () => import("react/jsx-runtime").JSX.Element;
75
78
  ToggleZenMode: () => import("react/jsx-runtime").JSX.Element;
76
79
  ToggleViewMode: () => import("react/jsx-runtime").JSX.Element;
@@ -13,6 +13,7 @@ type TunnelsContextValue = {
13
13
  DefaultSidebarTabTriggersTunnel: Tunnel;
14
14
  OverwriteConfirmDialogTunnel: Tunnel;
15
15
  TTDDialogTriggerTunnel: Tunnel;
16
+ TTADialogTriggerTunnel: Tunnel;
16
17
  tunnelsJotai: ReturnType<typeof createIsolation>;
17
18
  };
18
19
  export declare const TunnelsContext: React.Context<TunnelsContextValue>;
@@ -2,7 +2,7 @@ import { IMAGE_MIME_TYPES, MIME_TYPES } from "@excalidraw/common";
2
2
  import type { ValueOf } from "@excalidraw/common/utility-types";
3
3
  import type { ExcalidrawElement, FileId } from "@excalidraw/element/types";
4
4
  import type { AppState, DataURL, LibraryItem } from "../types";
5
- import type { FileSystemHandle } from "browser-fs-access";
5
+ import type { FileSystemHandle } from "./filesystem";
6
6
  import type { ImportedLibraryData } from "./types";
7
7
  export declare const getMimeType: (blob: Blob | string) => string;
8
8
  export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
@@ -49,6 +49,9 @@ fileHandle?: FileSystemHandle | null) => Promise<{
49
49
  multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
50
50
  selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
51
51
  isBindingEnabled: boolean;
52
+ boxSelectionMode: import("../types").BoxSelectionMode;
53
+ bindingPreference: "enabled" | "disabled";
54
+ isMidpointSnappingEnabled: boolean;
52
55
  startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
53
56
  suggestedBinding: {
54
57
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
@@ -57,7 +60,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
57
60
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
58
61
  editingFrame: string | null;
59
62
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
60
- editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
63
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
61
64
  activeTool: {
62
65
  lastActiveTool: import("../types").ActiveTool | null;
63
66
  locked: boolean;
@@ -212,6 +215,9 @@ fileHandle?: FileSystemHandle | null) => Promise<{
212
215
  multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
213
216
  selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
214
217
  isBindingEnabled: boolean;
218
+ boxSelectionMode: import("../types").BoxSelectionMode;
219
+ bindingPreference: "enabled" | "disabled";
220
+ isMidpointSnappingEnabled: boolean;
215
221
  startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
216
222
  suggestedBinding: {
217
223
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
@@ -220,7 +226,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
220
226
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
221
227
  editingFrame: string | null;
222
228
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
223
- editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
229
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
224
230
  activeTool: {
225
231
  lastActiveTool: import("../types").ActiveTool | null;
226
232
  locked: boolean;
@@ -1,6 +1,6 @@
1
1
  import { supported as nativeFileSystemSupported } from "browser-fs-access";
2
2
  import { MIME_TYPES } from "@excalidraw/common";
3
- import type { FileSystemHandle } from "browser-fs-access";
3
+ import type { FileSystemHandle as BrowserFileSystemHandle } from "browser-fs-access";
4
4
  type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
5
5
  export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
6
6
  extensions?: FILE_EXTENSION[];
@@ -16,6 +16,6 @@ export declare const fileSave: (blob: Blob | Promise<Blob>, opts: {
16
16
  description: string;
17
17
  /** existing FileSystemHandle */
18
18
  fileHandle?: FileSystemHandle | null;
19
- }) => Promise<FileSystemHandle | null>;
19
+ }) => Promise<FileSystemFileHandle | null>;
20
20
  export { nativeFileSystemSupported };
21
- export type { FileSystemHandle };
21
+ export type FileSystemHandle = BrowserFileSystemHandle | FileSystemFileHandle;
@@ -27,4 +27,4 @@ export declare const exportAsImage: ({ type, data, config, }: {
27
27
  fileHandle?: FileSystemHandle | null;
28
28
  exportingFrame: ExcalidrawFrameLikeElement | null;
29
29
  };
30
- }) => Promise<FileSystemHandle | null | undefined>;
30
+ }) => Promise<FileSystemFileHandle | null | undefined>;
@@ -5,7 +5,7 @@ export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], a
5
5
  export declare const saveAsJSON: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles,
6
6
  /** filename */
7
7
  name?: string) => Promise<{
8
- fileHandle: import("browser-fs-access").FileSystemHandle | null;
8
+ fileHandle: FileSystemFileHandle | null;
9
9
  }>;
10
10
  export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<{
11
11
  elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
@@ -38,6 +38,9 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
38
38
  multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
39
39
  selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
40
40
  isBindingEnabled: boolean;
41
+ boxSelectionMode: import("../types").BoxSelectionMode;
42
+ bindingPreference: "enabled" | "disabled";
43
+ isMidpointSnappingEnabled: boolean;
41
44
  startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
42
45
  suggestedBinding: {
43
46
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
@@ -46,7 +49,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
46
49
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
47
50
  editingFrame: string | null;
48
51
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
49
- editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
52
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
50
53
  activeTool: {
51
54
  lastActiveTool: import("../types").ActiveTool | null;
52
55
  locked: boolean;
@@ -132,7 +135,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
132
135
  [groupId: string]: boolean;
133
136
  };
134
137
  editingGroupId: import("@excalidraw/element/types").GroupId | null;
135
- fileHandle: import("browser-fs-access").FileSystemHandle | null;
138
+ fileHandle: import("./filesystem").FileSystemHandle | null;
136
139
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
137
140
  stats: {
138
141
  open: boolean;
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { AppState, BinaryFiles } from "../types";
3
3
  export declare const resaveAsImageWithScene: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles, name: string) => Promise<{
4
- fileHandle: import("browser-fs-access").FileSystemHandle;
4
+ fileHandle: import("./filesystem").FileSystemHandle;
5
5
  }>;
@@ -0,0 +1,15 @@
1
+ export interface ParseSSEDataOptions {
2
+ signal?: AbortSignal;
3
+ }
4
+ export interface IterateSSEJSONChunksOptions<T> {
5
+ signal?: AbortSignal;
6
+ ignorePayload?: (payload: string) => boolean;
7
+ onInvalidJSON?: (payload: string, error: unknown) => void;
8
+ parse?: (payload: string) => T;
9
+ }
10
+ export declare const extractRateLimitHeaders: (headers: Headers) => {
11
+ rateLimit?: number;
12
+ rateLimitRemaining?: number;
13
+ };
14
+ export declare function parseSSEData(stream: ReadableStream<Uint8Array>, options?: ParseSSEDataOptions): AsyncGenerator<string, void, unknown>;
15
+ export declare function iterateSSEJSONChunks<T>(stream: ReadableStream<Uint8Array>, options?: IterateSSEJSONChunksOptions<T>): AsyncGenerator<T, void, unknown>;
@@ -19,7 +19,7 @@ export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
19
19
  export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "./data/blob";
20
20
  export { mergeLibraryItems, getLibraryItemsHash } from "./data/library";
21
21
  export { isLinearElement } from "@excalidraw/element";
22
- export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, UserIdleState, normalizeLink, sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, getFormFactor, } from "@excalidraw/common";
22
+ export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, UserIdleState, normalizeLink, sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, getFormFactor, throttleRAF, } from "@excalidraw/common";
23
23
  export { mutateElement, newElementWith, bumpVersion, } from "@excalidraw/element";
24
24
  export { CaptureUpdateAction } from "@excalidraw/element";
25
25
  export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
@@ -36,14 +36,27 @@ export { exportToCanvas } from "./scene/export";
36
36
  export { DefaultSidebar } from "./components/DefaultSidebar";
37
37
  export { TTDDialog } from "./components/TTDDialog/TTDDialog";
38
38
  export { TTDDialogTrigger } from "./components/TTDDialog/TTDDialogTrigger";
39
+ export { TTDRateLimitWarningContent } from "./components/TTDDialog/Chat/TTDRateLimitWarningContent";
40
+ export { TTDDefaultTransportAdapter } from "./components/TTDDialog/utils/TTDStreamFetch";
39
41
  export { TTDStreamFetch } from "./components/TTDDialog/utils/TTDStreamFetch";
40
- export type { TTDPersistenceAdapter, SavedChat, SavedChats, } from "./components/TTDDialog/types";
42
+ export { TTADialog } from "./TTA/TTADialog";
43
+ export { TTAIndexedDBAdapter } from "./TTA/history";
44
+ export { TTADefaultTransportAdapter } from "./TTA/client";
45
+ export { TTAStreamFetch } from "./TTA/client";
46
+ export { TTAWarningMessage } from "./TTA/TTAWarningMessage";
47
+ export type { TTDPersistenceAdapter, TTDTransportAdapter, SavedChat, SavedChats, } from "./components/TTDDialog/types";
48
+ export type { TTDStreamFetchRequest, TTDStreamFetchOptions, TTDStreamResponseFetch, TTDTransportAdapterConfig, } from "./components/TTDDialog/utils/TTDStreamFetch";
49
+ export type { TTADialogProps } from "./TTA/TTADialog";
50
+ export type { TTAStreamFetchOptions, TTAStreamFetchRequest, TTAStreamFetchResult, TTAStreamError, TTAStreamResponseFetch, TTATransportAdapter, TTADefaultTransportAdapterConfig, AIChatTruncateRequest, AIChatTruncateResponse, TTATruncateFetchRequest, TTATruncateResponseFetch, } from "./TTA/client";
51
+ export type { TTADialogRenderWarning, TTAPersistenceAdapter, } from "./TTA/types";
52
+ export type { AIRateLimitWarningDescriptor, AIRateLimitWarningVariant, } from "./aiWarnings";
41
53
  export { zoomToFitBounds } from "./actions/actionCanvas";
42
54
  export { getCommonBounds, getVisibleSceneBounds, convertToExcalidrawElements, } from "@excalidraw/element";
43
55
  export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "@excalidraw/utils/withinBounds";
44
56
  export { DiagramToCodePlugin } from "./components/DiagramToCodePlugin/DiagramToCodePlugin";
45
57
  export { getDataURL } from "./data/blob";
46
58
  export { isElementLink } from "@excalidraw/element";
59
+ export { Fonts } from "./fonts/Fonts";
47
60
  export { setCustomTextMetricsProvider } from "@excalidraw/element";
48
61
  export { CommandPalette } from "./components/CommandPalette/CommandPalette";
49
62
  export { renderSpreadsheet, tryParseSpreadsheet, isSpreadsheetValidForChartType, } from "./charts/index";
@@ -0,0 +1,15 @@
1
+ import { type GlobalPoint } from "@excalidraw/math";
2
+ import type { EditorInterface } from "@excalidraw/common";
3
+ import type { ExcalidrawTextElement } from "@excalidraw/element/types";
4
+ export declare const getTextBoxPadding: (zoomValue: number) => number;
5
+ export declare const getTextAutoResizeHandle: (textElement: ExcalidrawTextElement, zoomValue: number, formFactor: EditorInterface["formFactor"]) => {
6
+ center: GlobalPoint | import("@excalidraw/math").LocalPoint;
7
+ start: GlobalPoint;
8
+ end: GlobalPoint;
9
+ hitboxWidth: number;
10
+ hitboxHeight: number;
11
+ } | null;
12
+ export declare const isPointHittingTextAutoResizeHandle: (point: Readonly<{
13
+ x: number;
14
+ y: number;
15
+ }>, textElement: ExcalidrawTextElement, zoomValue: number, formFactor: EditorInterface["formFactor"]) => boolean;
@@ -1,7 +1,7 @@
1
1
  import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, EditorInterface } from "@excalidraw/common";
2
2
  import type { LinearElementEditor } from "@excalidraw/element";
3
3
  import type { MaybeTransformHandleType } from "@excalidraw/element";
4
- import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode } from "@excalidraw/element/types";
4
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode, ExcalidrawTextElement } from "@excalidraw/element/types";
5
5
  import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
6
6
  import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
7
7
  import type { GlobalPoint } from "@excalidraw/math";
@@ -136,6 +136,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
136
136
  multiElement: AppState["multiElement"];
137
137
  newElement: AppState["newElement"];
138
138
  isBindingEnabled: AppState["isBindingEnabled"];
139
+ isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
139
140
  suggestedBinding: AppState["suggestedBinding"];
140
141
  isRotating: AppState["isRotating"];
141
142
  elementsToHighlight: AppState["elementsToHighlight"];
@@ -170,6 +171,7 @@ export type ObservedElementsAppState = {
170
171
  lockedMultiSelections: AppState["lockedMultiSelections"];
171
172
  activeLockedId: AppState["activeLockedId"];
172
173
  };
174
+ export type BoxSelectionMode = "contain" | "overlap";
173
175
  export interface AppState {
174
176
  contextMenu: {
175
177
  items: ContextMenuItems;
@@ -203,7 +205,17 @@ export interface AppState {
203
205
  * - set on pointer down, updated during pointer move
204
206
  */
205
207
  selectionElement: NonDeletedExcalidrawElement | null;
208
+ /**
209
+ * tracking current arrow binding editor state (takes into account
210
+ * `bindingPreference` and keyboard modifiers (ctrl/alt)
211
+ */
206
212
  isBindingEnabled: boolean;
213
+ /** user box selection preference; defaults to "contain" when unset */
214
+ boxSelectionMode: BoxSelectionMode;
215
+ /** user arrow binding preference */
216
+ bindingPreference: "enabled" | "disabled";
217
+ /** user preference whether arrow snap to midpoints while binding */
218
+ isMidpointSnappingEnabled: boolean;
207
219
  startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
208
220
  suggestedBinding: {
209
221
  element: NonDeleted<ExcalidrawBindableElement>;
@@ -221,7 +233,7 @@ export interface AppState {
221
233
  /**
222
234
  * set when a new text is created or when an existing text is being edited
223
235
  */
224
- editingTextElement: NonDeletedExcalidrawElement | null;
236
+ editingTextElement: ExcalidrawTextElement | null;
225
237
  activeTool: {
226
238
  /**
227
239
  * indicates a previous tool we should revert back to if we deselect the
@@ -554,6 +566,7 @@ export type AppProps = Merge<ExcalidrawProps, {
554
566
  export type AppClassProperties = {
555
567
  props: AppProps;
556
568
  state: AppState;
569
+ setSessionExportThemeOverride: App["setSessionExportThemeOverride"];
557
570
  interactiveCanvas: HTMLCanvasElement | null;
558
571
  /** static canvas */
559
572
  canvas: HTMLCanvasElement;