@zsviczian/excalidraw 0.16.1-obsidian-8 → 0.17.0-obsidian-2

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 (87) hide show
  1. package/dist/excalidraw.development.js +407 -110
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/excalidraw.production.min.js.LICENSE.txt +1 -1
  4. package/main.js +7 -1
  5. package/package.json +1 -1
  6. package/types/actions/actionAddToLibrary.d.ts +33 -6
  7. package/types/actions/actionBoundText.d.ts +22 -4
  8. package/types/actions/actionCanvas.d.ts +144 -27
  9. package/types/actions/actionClipboard.d.ts +77 -14
  10. package/types/actions/actionDeleteSelected.d.ts +33 -6
  11. package/types/actions/actionElementLock.d.ts +22 -4
  12. package/types/actions/actionExport.d.ts +96 -23
  13. package/types/actions/actionFinalize.d.ts +22 -4
  14. package/types/actions/actionFrame.d.ts +33 -6
  15. package/types/actions/actionGroup.d.ts +23 -5
  16. package/types/actions/actionLinearEditor.d.ts +11 -2
  17. package/types/actions/actionMenu.d.ts +27 -20
  18. package/types/actions/actionProperties.d.ts +143 -26
  19. package/types/actions/actionSelectAll.d.ts +11 -2
  20. package/types/actions/actionStyles.d.ts +11 -2
  21. package/types/actions/actionToggleGridMode.d.ts +11 -2
  22. package/types/actions/actionToggleObjectsSnapMode.d.ts +11 -2
  23. package/types/actions/actionToggleStats.d.ts +11 -2
  24. package/types/actions/actionToggleViewMode.d.ts +11 -2
  25. package/types/actions/actionToggleZenMode.d.ts +11 -2
  26. package/types/actions/index.d.ts +1 -1
  27. package/types/appState.d.ts +3 -3
  28. package/types/components/Actions.d.ts +3 -2
  29. package/types/components/App.d.ts +43 -13
  30. package/types/components/Button.d.ts +1 -1
  31. package/types/components/ImageExportDialog.d.ts +1 -1
  32. package/types/components/InlineIcon.d.ts +3 -0
  33. package/types/components/LayerUI.d.ts +6 -2
  34. package/types/components/MagicButton.d.ts +9 -0
  35. package/types/components/MagicSettings.d.ts +8 -0
  36. package/types/components/MobileMenu.d.ts +4 -3
  37. package/types/components/Paragraph.d.ts +4 -0
  38. package/types/components/TTDDialog/MermaidToExcalidraw.d.ts +13 -0
  39. package/types/components/TTDDialog/TTDDialog.d.ts +29 -0
  40. package/types/components/TTDDialog/TTDDialogInput.d.ts +9 -0
  41. package/types/components/TTDDialog/TTDDialogOutput.d.ts +7 -0
  42. package/types/components/TTDDialog/TTDDialogPanel.d.ts +16 -0
  43. package/types/components/TTDDialog/TTDDialogPanels.d.ts +4 -0
  44. package/types/components/TTDDialog/TTDDialogTab.d.ts +7 -0
  45. package/types/components/TTDDialog/TTDDialogTabTrigger.d.ts +8 -0
  46. package/types/components/TTDDialog/TTDDialogTabTriggers.d.ts +6 -0
  47. package/types/components/TTDDialog/TTDDialogTabs.d.ts +9 -0
  48. package/types/components/TTDDialog/TTDDialogTrigger.d.ts +8 -0
  49. package/types/components/TTDDialog/common.d.ts +33 -0
  50. package/types/components/TextField.d.ts +16 -0
  51. package/types/components/dropdownMenu/DropdownMenu.d.ts +6 -0
  52. package/types/components/dropdownMenu/DropdownMenuItem.d.ts +12 -0
  53. package/types/components/icons.d.ts +6 -0
  54. package/types/components/main-menu/MainMenu.d.ts +6 -0
  55. package/types/constants.d.ts +30 -3
  56. package/types/context/tunnels.d.ts +1 -0
  57. package/types/data/EditorLocalStorage.d.ts +8 -0
  58. package/types/data/ai/types.d.ts +242 -0
  59. package/types/data/index.d.ts +10 -2
  60. package/types/data/magic.d.ts +23 -0
  61. package/types/data/transform.d.ts +11 -7
  62. package/types/element/ElementCanvasButtons.d.ts +6 -0
  63. package/types/element/Hyperlink.d.ts +11 -2
  64. package/types/element/collision.d.ts +2 -2
  65. package/types/element/embeddable.d.ts +17 -21
  66. package/types/element/index.d.ts +3 -4
  67. package/types/element/linearElementEditor.d.ts +11 -2
  68. package/types/element/newElement.d.ts +7 -1
  69. package/types/element/textElement.d.ts +2 -2
  70. package/types/element/typeChecks.d.ts +10 -7
  71. package/types/element/types.d.ts +31 -2
  72. package/types/errors.d.ts +5 -0
  73. package/types/frame.d.ts +31 -20
  74. package/types/packages/excalidraw/index.d.ts +5 -3
  75. package/types/packages/excalidraw/webpack.preact.config.d.ts +170 -0
  76. package/types/packages/utils.d.ts +5 -4
  77. package/types/packages/withinBounds.d.ts +2 -2
  78. package/types/renderer/renderElement.d.ts +6 -1
  79. package/types/renderer/renderScene.d.ts +10 -5
  80. package/types/scene/Scene.d.ts +11 -6
  81. package/types/scene/ShapeCache.d.ts +1 -1
  82. package/types/scene/comparisons.d.ts +7 -6
  83. package/types/scene/export.d.ts +6 -5
  84. package/types/scene/types.d.ts +2 -0
  85. package/types/shapes.d.ts +1 -1
  86. package/types/types.d.ts +42 -25
  87. package/types/utils.d.ts +8 -3
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement } from "../element/types";
1
+ import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement } from "../element/types";
2
2
  import { AppState } from "../types";
3
3
  import { MarkOptional, Mutable } from "../utility-types";
4
4
  export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
@@ -9,9 +9,15 @@ export declare const newEmbeddableElement: (opts: {
9
9
  type: "embeddable";
10
10
  validated: ExcalidrawEmbeddableElement["validated"];
11
11
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawEmbeddableElement>;
12
+ export declare const newIframeElement: (opts: {
13
+ type: "iframe";
14
+ } & ElementConstructorOpts) => NonDeleted<ExcalidrawIframeElement>;
12
15
  export declare const newFrameElement: (opts: {
13
16
  name?: string;
14
17
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawFrameElement>;
18
+ export declare const newMagicFrameElement: (opts: {
19
+ name?: string;
20
+ } & ElementConstructorOpts) => NonDeleted<ExcalidrawMagicFrameElement>;
15
21
  export declare const newTextElement: (opts: {
16
22
  text: string;
17
23
  rawText: string;
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./types";
1
+ import { ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./types";
2
2
  import { MaybeTransformHandleType } from "./transformHandles";
3
3
  import { AppState } from "../types";
4
4
  import { ExtractSetType } from "../utility-types";
@@ -66,7 +66,7 @@ export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExca
66
66
  export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number) => ExcalidrawTextContainer | null;
67
67
  declare const VALID_CONTAINER_TYPES: Set<string>;
68
68
  export declare const isValidTextContainer: (element: {
69
- type: ExcalidrawElement["type"];
69
+ type: ExcalidrawElementType;
70
70
  }) => boolean;
71
71
  export declare const computeContainerDimensionForBoundText: (dimension: number, containerType: ExtractSetType<typeof VALID_CONTAINER_TYPES>, legacy?: boolean) => number;
72
72
  export declare const getBoundTextMaxWidth: (container: ExcalidrawElement, boundTextElement?: ExcalidrawTextElement | null) => number;
@@ -1,22 +1,25 @@
1
- import { AppState } from "../types";
1
+ import { ElementOrToolType } from "../types";
2
2
  import { MarkNonNullable } from "../utility-types";
3
- import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType } from "./types";
4
- export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
3
+ import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement } from "./types";
5
4
  export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
6
5
  export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
7
6
  export declare const isEmbeddableElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawEmbeddableElement;
7
+ export declare const isIframeElement: (element: ExcalidrawElement | null) => element is ExcalidrawIframeElement;
8
+ export declare const isIframeLikeElement: (element: ExcalidrawElement | null) => element is ExcalidrawIframeLikeElement;
8
9
  export declare const isTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawTextElement;
9
10
  export declare const isFrameElement: (element: ExcalidrawElement | null) => element is ExcalidrawFrameElement;
11
+ export declare const isMagicFrameElement: (element: ExcalidrawElement | null) => element is ExcalidrawMagicFrameElement;
12
+ export declare const isFrameLikeElement: (element: ExcalidrawElement | null) => element is ExcalidrawFrameLikeElement;
10
13
  export declare const isFreeDrawElement: (element?: ExcalidrawElement | null) => element is ExcalidrawFreeDrawElement;
11
- export declare const isFreeDrawElementType: (elementType: ExcalidrawElement["type"]) => boolean;
14
+ export declare const isFreeDrawElementType: (elementType: ExcalidrawElementType) => boolean;
12
15
  export declare const isLinearElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
13
16
  export declare const isArrowElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
14
- export declare const isLinearElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
17
+ export declare const isLinearElementType: (elementType: ElementOrToolType) => boolean;
15
18
  export declare const isBindingElement: (element?: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawLinearElement;
16
- export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
19
+ export declare const isBindingElementType: (elementType: ElementOrToolType) => boolean;
17
20
  export declare const isBindableElement: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawBindableElement;
18
21
  export declare const isTextBindableContainer: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawTextContainer;
19
- export declare const isExcalidrawElement: (element: any) => boolean;
22
+ export declare const isExcalidrawElement: (element: any) => element is ExcalidrawElement;
20
23
  export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is MarkNonNullable<ExcalidrawBindableElement, "boundElements">;
21
24
  export declare const isBoundToContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextElementWithContainer;
22
25
  export declare const isUsingAdaptiveRadius: (type: string) => boolean;
@@ -1,6 +1,7 @@
1
1
  import { Point } from "../types";
2
2
  import { FONT_FAMILY, ROUNDNESS, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
3
3
  import { MarkNonNullable, ValueOf } from "../utility-types";
4
+ import { MagicCacheData } from "../data/magic";
4
5
  export type ChartType = "bar" | "line";
5
6
  export type FillStyle = "hachure" | "cross-hatch" | "solid" | "zigzag";
6
7
  export type FontFamilyKeys = keyof typeof FONT_FAMILY;
@@ -83,7 +84,29 @@ export type ExcalidrawEmbeddableElement = _ExcalidrawElementBase & Readonly<{
83
84
  * may not have access to host-app supplied url validator during restore.
84
85
  */
85
86
  validated: boolean | null;
87
+ scale: [number, number];
88
+ }>;
89
+ export type ExcalidrawIframeElement = _ExcalidrawElementBase & Readonly<{
90
+ type: "iframe";
91
+ customData?: {
92
+ generationData?: MagicCacheData;
93
+ };
94
+ scale: [number, number];
86
95
  }>;
96
+ export type ExcalidrawIframeLikeElement = ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
97
+ export type IframeData = ({
98
+ intrinsicSize: {
99
+ w: number;
100
+ h: number;
101
+ };
102
+ warning?: string;
103
+ } & ({
104
+ type: "video" | "generic";
105
+ link: string;
106
+ } | {
107
+ type: "document";
108
+ srcdoc: (theme: Theme) => string;
109
+ }));
87
110
  export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
88
111
  type: "image";
89
112
  fileId: FileId | null;
@@ -97,6 +120,11 @@ export type ExcalidrawFrameElement = _ExcalidrawElementBase & {
97
120
  type: "frame";
98
121
  name: string | null;
99
122
  };
123
+ export type ExcalidrawMagicFrameElement = _ExcalidrawElementBase & {
124
+ type: "magicframe";
125
+ name: string | null;
126
+ };
127
+ export type ExcalidrawFrameLikeElement = ExcalidrawFrameElement | ExcalidrawMagicFrameElement;
100
128
  /**
101
129
  * These are elements that don't have any additional properties.
102
130
  */
@@ -106,7 +134,7 @@ export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRe
106
134
  * no computed data. The list of all ExcalidrawElements should be shareable
107
135
  * between peers and contain no state local to the peer.
108
136
  */
109
- export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawEmbeddableElement;
137
+ export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
110
138
  export type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
111
139
  isDeleted: boolean;
112
140
  };
@@ -130,7 +158,7 @@ export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
130
158
  _brand: "unitlessLineHeight";
131
159
  };
132
160
  }>;
133
- export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement;
161
+ export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement;
134
162
  export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawArrowElement;
135
163
  export type ExcalidrawTextElementWithContainer = {
136
164
  containerId: ExcalidrawTextContainer["id"];
@@ -163,4 +191,5 @@ export type ExcalidrawFreeDrawElement = _ExcalidrawElementBase & Readonly<{
163
191
  export type FileId = string & {
164
192
  _brand: "FileId";
165
193
  };
194
+ export type ExcalidrawElementType = ExcalidrawElement["type"];
166
195
  export {};
package/types/errors.d.ts CHANGED
@@ -5,4 +5,9 @@ export declare class CanvasError extends Error {
5
5
  export declare class AbortError extends DOMException {
6
6
  constructor(message?: string);
7
7
  }
8
+ type ImageSceneDataErrorCode = "IMAGE_NOT_CONTAINS_SCENE_DATA" | "IMAGE_SCENE_DATA_ERROR";
9
+ export declare class ImageSceneDataError extends Error {
10
+ code: ImageSceneDataErrorCode;
11
+ constructor(message?: string, code?: ImageSceneDataErrorCode);
12
+ }
8
13
  export {};
package/types/frame.d.ts CHANGED
@@ -1,46 +1,57 @@
1
- import { ExcalidrawElement, ExcalidrawFrameElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
1
+ import { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
2
2
  import { AppClassProperties, AppState, StaticCanvasAppState } from "./types";
3
3
  import { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
4
4
  export declare const bindElementsToFramesAfterDuplication: (nextElements: ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
5
- export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameElement): boolean;
6
- export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
7
- export declare const isElementContainingFrame: (elements: readonly ExcalidrawElement[], element: ExcalidrawElement, frame: ExcalidrawFrameElement) => boolean;
8
- export declare const getElementsIntersectingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
9
- export declare const elementsAreInFrameBounds: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => boolean;
10
- export declare const elementOverlapsWithFrame: (element: ExcalidrawElement, frame: ExcalidrawFrameElement) => boolean;
5
+ export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement): boolean;
6
+ export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
7
+ export declare const isElementContainingFrame: (elements: readonly ExcalidrawElement[], element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement) => boolean;
8
+ export declare const getElementsIntersectingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
9
+ export declare const elementsAreInFrameBounds: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => boolean;
10
+ export declare const elementOverlapsWithFrame: (element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement) => boolean;
11
11
  export declare const isCursorInFrame: (cursorCoords: {
12
12
  x: number;
13
13
  y: number;
14
- }, frame: NonDeleted<ExcalidrawFrameElement>) => boolean;
15
- export declare const groupsAreAtLeastIntersectingTheFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameElement) => boolean;
16
- export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameElement) => boolean;
14
+ }, frame: NonDeleted<ExcalidrawFrameLikeElement>) => boolean;
15
+ export declare const groupsAreAtLeastIntersectingTheFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameLikeElement) => boolean;
16
+ export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameLikeElement) => boolean;
17
17
  /**
18
18
  * Returns a map of frameId to frame elements. Includes empty frames.
19
19
  */
20
- export declare const groupByFrames: (elements: readonly ExcalidrawElement[]) => Map<string, ExcalidrawElement[]>;
21
- export declare const getFrameElements: (allElements: ExcalidrawElementsIncludingDeleted, frameId: string) => ExcalidrawElement[];
22
- export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
23
- export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement) => ExcalidrawElement[];
24
- export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) => ExcalidrawFrameElement | null;
20
+ export declare const groupByFrameLikes: (elements: readonly ExcalidrawElement[]) => Map<string, ExcalidrawElement[]>;
21
+ export declare const getFrameChildren: (allElements: ExcalidrawElementsIncludingDeleted, frameId: string) => ExcalidrawElement[];
22
+ export declare const getFrameLikeElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawFrameLikeElement[];
23
+ /**
24
+ * Returns ExcalidrawFrameElements and non-frame-children elements.
25
+ *
26
+ * Considers children as root elements if they point to a frame parent
27
+ * non-existing in the elements set.
28
+ *
29
+ * Considers non-frame bound elements (container or arrow labels) as root.
30
+ */
31
+ export declare const getRootElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawElement[];
32
+ export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, appState: AppState) => ExcalidrawElement[];
33
+ export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
34
+ export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) => ExcalidrawFrameLikeElement | null;
25
35
  /**
26
36
  * Retains (or repairs for target frame) the ordering invriant where children
27
37
  * elements come right before the parent frame:
28
38
  * [el, el, child, child, frame, el]
29
39
  */
30
- export declare const addElementsToFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToAdd: NonDeletedExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
40
+ export declare const addElementsToFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToAdd: NonDeletedExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
31
41
  export declare const removeElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToRemove: NonDeletedExcalidrawElement[], appState: AppState) => ExcalidrawElement[];
32
- export declare const removeAllElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
33
- export declare const replaceAllElementsInFrame: (allElements: ExcalidrawElementsIncludingDeleted, nextElementsInFrame: ExcalidrawElement[], frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
42
+ export declare const removeAllElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, appState: AppState) => ExcalidrawElement[];
43
+ export declare const replaceAllElementsInFrame: (allElements: ExcalidrawElementsIncludingDeleted, nextElementsInFrame: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, appState: AppState) => ExcalidrawElement[];
34
44
  /** does not mutate elements, but returns new ones */
35
45
  export declare const updateFrameMembershipOfSelectedElements: (allElements: ExcalidrawElementsIncludingDeleted, appState: AppState, app: AppClassProperties) => ExcalidrawElementsIncludingDeleted;
36
46
  /**
37
47
  * filters out elements that are inside groups that contain a frame element
38
48
  * anywhere in the group tree
39
49
  */
40
- export declare const omitGroupsContainingFrames: (allElements: ExcalidrawElementsIncludingDeleted, selectedElements?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
50
+ export declare const omitGroupsContainingFrameLikes: (allElements: ExcalidrawElementsIncludingDeleted, selectedElements?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
41
51
  /**
42
52
  * depending on the appState, return target frame, which is the frame the given element
43
53
  * is going to be added to or remove from
44
54
  */
45
- export declare const getTargetFrame: (element: ExcalidrawElement, appState: StaticCanvasAppState) => ExcalidrawFrameElement | null;
55
+ export declare const getTargetFrame: (element: ExcalidrawElement, appState: StaticCanvasAppState) => import("./element/types").ExcalidrawFrameElement | import("./element/types").ExcalidrawMagicFrameElement | null;
46
56
  export declare const isElementInFrame: (element: ExcalidrawElement, allElements: ExcalidrawElementsIncludingDeleted, appState: StaticCanvasAppState) => boolean;
57
+ export declare const getFrameLikeTitle: (element: ExcalidrawFrameLikeElement, frameIdx: number) => string;
@@ -1,13 +1,12 @@
1
1
  import React from "react";
2
2
  import "../../css/app.scss";
3
3
  import "../../css/styles.scss";
4
- import { ExcalidrawAPIRefValue, ExcalidrawProps } from "../../types";
4
+ import { ExcalidrawProps } from "../../types";
5
5
  import Footer from "../../components/footer/FooterCenter";
6
6
  import MainMenu from "../../components/main-menu/MainMenu";
7
7
  import WelcomeScreen from "../../components/welcome-screen/WelcomeScreen";
8
8
  import LiveCollaborationTrigger from "../../components/live-collaboration/LiveCollaborationTrigger";
9
- type PublicExcalidrawProps = Omit<ExcalidrawProps, "forwardedRef">;
10
- export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
9
+ export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawProps) => import("react/jsx-runtime").JSX.Element>;
11
10
  export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
12
11
  export { defaultLang, useI18n, languages } from "../../i18n";
13
12
  export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "../../data/restore";
@@ -35,6 +34,9 @@ export { useDevice } from "../../components/App";
35
34
  export { WelcomeScreen };
36
35
  export { LiveCollaborationTrigger };
37
36
  export { DefaultSidebar } from "../../components/DefaultSidebar";
37
+ export { TTDDialog } from "../../components/TTDDialog/TTDDialog";
38
+ export { TTDDialogTrigger } from "../../components/TTDDialog/TTDDialogTrigger";
38
39
  export { normalizeLink } from "../../data/url";
39
40
  export { convertToExcalidrawElements } from "../../data/transform";
41
+ export { getCommonBounds } from "../../element/bounds";
40
42
  export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "../withinBounds";
@@ -0,0 +1,170 @@
1
+ declare const _exports: {
2
+ mode: string;
3
+ entry: {
4
+ "excalidraw.development": string;
5
+ };
6
+ output: {
7
+ path: string;
8
+ library: string;
9
+ libraryTarget: string;
10
+ filename: string;
11
+ chunkFilename: string;
12
+ assetModuleFilename: string;
13
+ publicPath: string;
14
+ };
15
+ resolve: {
16
+ extensions: string[];
17
+ };
18
+ module: {
19
+ rules: ({
20
+ test: RegExp;
21
+ exclude: RegExp;
22
+ use: (string | {
23
+ loader: string;
24
+ } | {
25
+ loader: string;
26
+ options: {
27
+ postcssOptions: {
28
+ plugins: (import("postcss").Plugin & import("autoprefixer").ExportedAPI)[];
29
+ };
30
+ };
31
+ })[];
32
+ } | {
33
+ test: RegExp;
34
+ resolve: {
35
+ fullySpecified: boolean;
36
+ };
37
+ } | {
38
+ test: RegExp;
39
+ exclude: RegExp;
40
+ use: ({
41
+ loader: string;
42
+ } | {
43
+ loader: string;
44
+ options: {
45
+ transpileOnly: boolean;
46
+ configFile: string;
47
+ };
48
+ })[];
49
+ } | {
50
+ test: RegExp;
51
+ type: string;
52
+ })[];
53
+ };
54
+ optimization: {
55
+ splitChunks: {
56
+ chunks: string;
57
+ cacheGroups: {
58
+ vendors: {
59
+ test: RegExp;
60
+ name: string;
61
+ };
62
+ };
63
+ };
64
+ };
65
+ plugins: any[];
66
+ externals: {
67
+ react: {
68
+ root: string;
69
+ commonjs2: string;
70
+ commonjs: string;
71
+ amd: string;
72
+ };
73
+ "react-dom": {
74
+ root: string;
75
+ commonjs2: string;
76
+ commonjs: string;
77
+ amd: string;
78
+ };
79
+ };
80
+ } | {
81
+ mode: string;
82
+ entry: {
83
+ "excalidraw.production.min": string;
84
+ };
85
+ output: {
86
+ path: string;
87
+ library: string;
88
+ libraryTarget: string;
89
+ filename: string;
90
+ chunkFilename: string;
91
+ assetModuleFilename: string;
92
+ publicPath: string;
93
+ };
94
+ resolve: {
95
+ extensions: string[];
96
+ };
97
+ module: {
98
+ rules: ({
99
+ test: RegExp;
100
+ exclude: RegExp;
101
+ use: (string | {
102
+ loader: string;
103
+ } | {
104
+ loader: string;
105
+ options: {
106
+ postcssOptions: {
107
+ plugins: (import("postcss").Plugin & import("autoprefixer").ExportedAPI)[];
108
+ };
109
+ };
110
+ })[];
111
+ } | {
112
+ test: RegExp;
113
+ resolve: {
114
+ fullySpecified: boolean;
115
+ };
116
+ } | {
117
+ test: RegExp;
118
+ exclude: RegExp;
119
+ use: ({
120
+ loader: string;
121
+ } | {
122
+ loader: string;
123
+ options: {
124
+ transpileOnly: boolean;
125
+ configFile: string;
126
+ };
127
+ } | {
128
+ loader: string;
129
+ options: {
130
+ presets: (string | (string | {
131
+ runtime: string;
132
+ })[])[];
133
+ plugins: string[];
134
+ };
135
+ })[];
136
+ } | {
137
+ test: RegExp;
138
+ type: string;
139
+ })[];
140
+ };
141
+ optimization: {
142
+ minimize: boolean;
143
+ minimizer: import("terser-webpack-plugin")<import("terser").MinifyOptions>[];
144
+ splitChunks: {
145
+ chunks: string;
146
+ cacheGroups: {
147
+ vendors: {
148
+ test: RegExp;
149
+ name: string;
150
+ };
151
+ };
152
+ };
153
+ };
154
+ plugins: any[];
155
+ externals: {
156
+ react: {
157
+ root: string;
158
+ commonjs2: string;
159
+ commonjs: string;
160
+ amd: string;
161
+ };
162
+ "react-dom": {
163
+ root: string;
164
+ commonjs2: string;
165
+ commonjs: string;
166
+ amd: string;
167
+ };
168
+ };
169
+ };
170
+ export = _exports;
@@ -1,5 +1,5 @@
1
1
  import { AppState, BinaryFiles } from "../types";
2
- import { ExcalidrawElement, NonDeleted } from "../element/types";
2
+ import { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted } from "../element/types";
3
3
  import { MIME_TYPES } from "../constants";
4
4
  export { MIME_TYPES };
5
5
  type ExportOpts = {
@@ -7,13 +7,14 @@ type ExportOpts = {
7
7
  appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
8
8
  files: BinaryFiles | null;
9
9
  maxWidthOrHeight?: number;
10
+ exportingFrame?: ExcalidrawFrameLikeElement | null;
10
11
  getDimensions?: (width: number, height: number) => {
11
12
  width: number;
12
13
  height: number;
13
14
  scale?: number;
14
15
  };
15
16
  };
16
- export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, exportPadding, }: ExportOpts & {
17
+ export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, exportPadding, exportingFrame, }: ExportOpts & {
17
18
  exportPadding?: number | undefined;
18
19
  }) => Promise<HTMLCanvasElement>;
19
20
  export declare const exportToBlob: (opts: ExportOpts & {
@@ -21,7 +22,7 @@ export declare const exportToBlob: (opts: ExportOpts & {
21
22
  quality?: number;
22
23
  exportPadding?: number;
23
24
  }) => Promise<Blob>;
24
- export declare const exportToSvg: ({ elements, appState, files, exportPadding, renderEmbeddables, }: Omit<ExportOpts, "getDimensions"> & {
25
+ export declare const exportToSvg: ({ elements, appState, files, exportPadding, renderEmbeddables, exportingFrame, }: Omit<ExportOpts, "getDimensions"> & {
25
26
  exportPadding?: number | undefined;
26
27
  renderEmbeddables?: boolean | undefined;
27
28
  }) => Promise<SVGSVGElement>;
@@ -43,4 +44,4 @@ export { measureText, wrapText, getDefaultLineHeight, } from "../element/textEle
43
44
  export { getFontString } from "../utils";
44
45
  export { getBoundTextMaxWidth } from "../element/textElement";
45
46
  export { mergeLibraryItems } from "../data/library";
46
- export { mermaidToExcalidraw } from "../components/MermaidToExcalidraw";
47
+ export { mermaidToExcalidraw } from "../components/TTDDialog/MermaidToExcalidraw";
@@ -1,4 +1,4 @@
1
- import type { NonDeletedExcalidrawElement } from "../element/types";
1
+ import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
2
2
  import { Bounds } from "../element/bounds";
3
3
  type Element = NonDeletedExcalidrawElement;
4
4
  type Elements = readonly NonDeletedExcalidrawElement[];
@@ -6,7 +6,7 @@ export declare const isElementInsideBBox: (element: Element, bbox: Bounds, eithe
6
6
  export declare const elementPartiallyOverlapsWithOrContainsBBox: (element: Element, bbox: Bounds) => boolean;
7
7
  export declare const elementsOverlappingBBox: ({ elements, bounds, type, errorMargin, }: {
8
8
  elements: Elements;
9
- bounds: Bounds;
9
+ bounds: Bounds | ExcalidrawElement;
10
10
  /** safety offset. Defaults to 0. */
11
11
  errorMargin?: number | undefined;
12
12
  /**
@@ -18,7 +18,12 @@ export declare const DEFAULT_LINK_SIZE = 14;
18
18
  export declare const elementWithCanvasCache: WeakMap<ExcalidrawElement, ExcalidrawElementWithCanvas>;
19
19
  export declare const renderSelectionElement: (element: NonDeletedExcalidrawElement, context: CanvasRenderingContext2D, appState: InteractiveCanvasAppState) => void;
20
20
  export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
21
- export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, exportWithDarkMode?: boolean, exportingFrameId?: string | null, renderEmbeddables?: boolean) => void;
21
+ export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, renderConfig: {
22
+ exportWithDarkMode: boolean;
23
+ renderEmbeddables: boolean;
24
+ frameRendering: AppState["frameRendering"];
25
+ frameColor?: AppState["frameColor"];
26
+ }) => void;
22
27
  export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
23
28
  export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
24
29
  export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
@@ -1,5 +1,5 @@
1
1
  import { RoughSVG } from "roughjs/bin/svg";
2
- import { BinaryFiles } from "../types";
2
+ import { BinaryFiles, AppState } from "../types";
3
3
  import { NonDeletedExcalidrawElement } from "../element/types";
4
4
  import { InteractiveSceneRenderConfig, StaticSceneRenderConfig } from "../scene/types";
5
5
  import "canvas-roundrect-polyfill";
@@ -22,10 +22,15 @@ export declare const renderInteractiveScene: <U extends ({ canvas, elements, vis
22
22
  */
23
23
  export declare const renderStaticScene: (renderConfig: StaticSceneRenderConfig, throttle?: boolean) => void;
24
24
  export declare const cancelRender: () => void;
25
- export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, exportingFrameId, renderEmbeddables, }?: {
25
+ export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, renderEmbeddables, frameRendering, frameColor, }: {
26
26
  offsetX?: number | undefined;
27
27
  offsetY?: number | undefined;
28
- exportWithDarkMode?: boolean | undefined;
29
- exportingFrameId?: string | null | undefined;
30
- renderEmbeddables?: boolean | undefined;
28
+ exportWithDarkMode: boolean;
29
+ renderEmbeddables: boolean;
30
+ frameRendering: AppState["frameRendering"];
31
+ frameColor?: {
32
+ stroke: string;
33
+ fill: string;
34
+ nameColor: string;
35
+ } | undefined;
31
36
  }) => void;
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameElement } from "../element/types";
1
+ import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameLikeElement } from "../element/types";
2
2
  import { LinearElementEditor } from "../element/linearElementEditor";
3
3
  import { AppState } from "../types";
4
4
  type ElementIdKey = InstanceType<typeof LinearElementEditor>["elementId"];
@@ -9,19 +9,24 @@ export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
9
9
  declare class Scene {
10
10
  private static sceneMapByElement;
11
11
  private static sceneMapById;
12
- static mapElementToScene(elementKey: ElementKey, scene: Scene): void;
12
+ static mapElementToScene(elementKey: ElementKey, scene: Scene,
13
+ /**
14
+ * needed because of frame exporting hack.
15
+ * elementId:Scene mapping will be removed completely, soon.
16
+ */
17
+ mapElementIds?: boolean): void;
13
18
  static getScene(elementKey: ElementKey): Scene | null;
14
19
  private callbacks;
15
20
  private nonDeletedElements;
16
21
  private elements;
17
- private nonDeletedFrames;
22
+ private nonDeletedFramesLikes;
18
23
  private frames;
19
24
  private elementsMap;
20
25
  private selectedElementsCache;
21
26
  private versionNonce;
22
27
  getElementsIncludingDeleted(): readonly ExcalidrawElement[];
23
28
  getNonDeletedElements(): readonly NonDeletedExcalidrawElement[];
24
- getFramesIncludingDeleted(): readonly ExcalidrawFrameElement[];
29
+ getFramesIncludingDeleted(): readonly ExcalidrawFrameLikeElement[];
25
30
  getSelectedElements(opts: {
26
31
  selectedElementIds: AppState["selectedElementIds"];
27
32
  /**
@@ -33,7 +38,7 @@ declare class Scene {
33
38
  includeBoundTextElement?: boolean;
34
39
  includeElementsInFrames?: boolean;
35
40
  }): NonDeleted<ExcalidrawElement>[];
36
- getNonDeletedFrames(): readonly NonDeleted<ExcalidrawFrameElement>[];
41
+ getNonDeletedFramesLikes(): readonly NonDeleted<ExcalidrawFrameLikeElement>[];
37
42
  getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
38
43
  getVersionNonce(): number | undefined;
39
44
  getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
@@ -50,7 +55,7 @@ declare class Scene {
50
55
  * @returns whether a change was made
51
56
  */
52
57
  mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
53
- replaceAllElements(nextElements: readonly ExcalidrawElement[]): void;
58
+ replaceAllElements(nextElements: readonly ExcalidrawElement[], mapElementIds?: boolean): void;
54
59
  informMutation(): void;
55
60
  addCallback(cb: SceneStateCallback): SceneStateCallbackRemover;
56
61
  destroy(): void;
@@ -16,5 +16,5 @@ export declare class ShapeCache {
16
16
  * Generates & caches shape for element if not already cached, otherwise
17
17
  * returns cached shape.
18
18
  */
19
- static generateElementShape: <T extends import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawEmbeddableElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement>(element: T, isExporting?: boolean) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
19
+ static generateElementShape: <T extends import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawEmbeddableElement | import("../element/types").ExcalidrawIframeElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawMagicFrameElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement>(element: T, isExporting?: boolean) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
20
20
  }
@@ -1,9 +1,10 @@
1
1
  import { NonDeletedExcalidrawElement } from "../element/types";
2
- export declare const hasBackground: (type: string) => boolean;
3
- export declare const hasStrokeColor: (type: string) => boolean;
4
- export declare const hasStrokeWidth: (type: string) => boolean;
5
- export declare const hasStrokeStyle: (type: string) => boolean;
6
- export declare const canChangeRoundness: (type: string) => boolean;
7
- export declare const canHaveArrowheads: (type: string) => boolean;
2
+ import { ElementOrToolType } from "../types";
3
+ export declare const hasBackground: (type: ElementOrToolType) => boolean;
4
+ export declare const hasStrokeColor: (type: ElementOrToolType) => boolean;
5
+ export declare const hasStrokeWidth: (type: ElementOrToolType) => boolean;
6
+ export declare const hasStrokeStyle: (type: ElementOrToolType) => boolean;
7
+ export declare const canChangeRoundness: (type: ElementOrToolType) => boolean;
8
+ export declare const canHaveArrowheads: (type: ElementOrToolType) => boolean;
8
9
  export declare const getElementAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement | null;
9
10
  export declare const getElementsAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement[];