@excalidraw/excalidraw 0.17.0-a528769 → 0.17.0-dd220bc

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 (82) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/excalidraw-assets-dev/{vendor-18203854dd3b1fb2cc41.js → vendor-0aa6bd65c58be7c84e9c.js} +2 -2
  3. package/dist/excalidraw-with-preact.development.js +372 -75
  4. package/dist/excalidraw-with-preact.production.min.js +1 -1
  5. package/dist/excalidraw.development.js +372 -75
  6. package/dist/excalidraw.production.min.js +1 -1
  7. package/package.json +1 -1
  8. package/types/actions/actionAddToLibrary.d.ts +33 -6
  9. package/types/actions/actionBoundText.d.ts +22 -4
  10. package/types/actions/actionCanvas.d.ts +121 -22
  11. package/types/actions/actionClipboard.d.ts +77 -14
  12. package/types/actions/actionDeleteSelected.d.ts +33 -6
  13. package/types/actions/actionElementLock.d.ts +22 -4
  14. package/types/actions/actionExport.d.ts +94 -22
  15. package/types/actions/actionFinalize.d.ts +22 -4
  16. package/types/actions/actionFrame.d.ts +33 -6
  17. package/types/actions/actionGroup.d.ts +22 -4
  18. package/types/actions/actionLinearEditor.d.ts +11 -2
  19. package/types/actions/actionMenu.d.ts +26 -6
  20. package/types/actions/actionProperties.d.ts +143 -26
  21. package/types/actions/actionSelectAll.d.ts +11 -2
  22. package/types/actions/actionStyles.d.ts +11 -2
  23. package/types/actions/actionToggleGridMode.d.ts +11 -2
  24. package/types/actions/actionToggleObjectsSnapMode.d.ts +11 -2
  25. package/types/actions/actionToggleStats.d.ts +11 -2
  26. package/types/actions/actionToggleViewMode.d.ts +11 -2
  27. package/types/actions/actionToggleZenMode.d.ts +11 -2
  28. package/types/appState.d.ts +2 -2
  29. package/types/components/App.d.ts +27 -6
  30. package/types/components/Button.d.ts +1 -1
  31. package/types/components/InlineIcon.d.ts +3 -0
  32. package/types/components/LayerUI.d.ts +5 -1
  33. package/types/components/MagicButton.d.ts +9 -0
  34. package/types/components/MagicSettings.d.ts +8 -0
  35. package/types/components/Paragraph.d.ts +4 -0
  36. package/types/components/TTDDialog/MermaidToExcalidraw.d.ts +6 -0
  37. package/types/components/TTDDialog/TTDDialog.d.ts +29 -0
  38. package/types/components/TTDDialog/TTDDialogInput.d.ts +9 -0
  39. package/types/components/TTDDialog/TTDDialogOutput.d.ts +7 -0
  40. package/types/components/TTDDialog/TTDDialogPanel.d.ts +16 -0
  41. package/types/components/TTDDialog/TTDDialogPanels.d.ts +4 -0
  42. package/types/components/TTDDialog/TTDDialogTab.d.ts +7 -0
  43. package/types/components/TTDDialog/TTDDialogTabTrigger.d.ts +8 -0
  44. package/types/components/TTDDialog/TTDDialogTabTriggers.d.ts +6 -0
  45. package/types/components/TTDDialog/TTDDialogTabs.d.ts +14 -0
  46. package/types/components/TTDDialog/TTDDialogTrigger.d.ts +8 -0
  47. package/types/components/TTDDialog/common.d.ts +33 -0
  48. package/types/components/TextField.d.ts +16 -0
  49. package/types/components/dropdownMenu/DropdownMenu.d.ts +6 -0
  50. package/types/components/dropdownMenu/DropdownMenuItem.d.ts +12 -0
  51. package/types/components/icons.d.ts +6 -0
  52. package/types/components/main-menu/MainMenu.d.ts +6 -0
  53. package/types/constants.d.ts +24 -2
  54. package/types/context/tunnels.d.ts +1 -0
  55. package/types/data/EditorLocalStorage.d.ts +8 -0
  56. package/types/data/ai/types.d.ts +242 -0
  57. package/types/data/index.d.ts +3 -3
  58. package/types/data/magic.d.ts +23 -0
  59. package/types/data/transform.d.ts +11 -7
  60. package/types/element/ElementCanvasButtons.d.ts +6 -0
  61. package/types/element/Hyperlink.d.ts +11 -2
  62. package/types/element/collision.d.ts +2 -2
  63. package/types/element/embeddable.d.ts +17 -21
  64. package/types/element/index.d.ts +3 -4
  65. package/types/element/linearElementEditor.d.ts +12 -3
  66. package/types/element/newElement.d.ts +7 -1
  67. package/types/element/textElement.d.ts +2 -2
  68. package/types/element/typeChecks.d.ts +9 -6
  69. package/types/element/types.d.ts +29 -2
  70. package/types/frame.d.ts +21 -20
  71. package/types/packages/excalidraw/index.d.ts +2 -0
  72. package/types/packages/utils.d.ts +2 -2
  73. package/types/scene/Scene.d.ts +4 -4
  74. package/types/scene/ShapeCache.d.ts +1 -1
  75. package/types/scene/comparisons.d.ts +7 -6
  76. package/types/scene/export.d.ts +3 -3
  77. package/types/scene/types.d.ts +2 -0
  78. package/types/shapes.d.ts +1 -1
  79. package/types/types.d.ts +25 -10
  80. package/types/utils.d.ts +2 -2
  81. package/types/components/MermaidToExcalidraw.d.ts +0 -3
  82. /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-18203854dd3b1fb2cc41.d.ts → vendor-0aa6bd65c58be7c84e9c.d.ts} +0 -0
@@ -0,0 +1,242 @@
1
+ export declare namespace OpenAIInput {
2
+ type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage;
3
+ interface ChatCompletionContentPartImage {
4
+ image_url: ChatCompletionContentPartImage.ImageURL;
5
+ /**
6
+ * The type of the content part.
7
+ */
8
+ type: "image_url";
9
+ }
10
+ namespace ChatCompletionContentPartImage {
11
+ interface ImageURL {
12
+ /**
13
+ * Either a URL of the image or the base64 encoded image data.
14
+ */
15
+ url: string;
16
+ /**
17
+ * Specifies the detail level of the image.
18
+ */
19
+ detail?: "auto" | "low" | "high";
20
+ }
21
+ }
22
+ interface ChatCompletionContentPartText {
23
+ /**
24
+ * The text content.
25
+ */
26
+ text: string;
27
+ /**
28
+ * The type of the content part.
29
+ */
30
+ type: "text";
31
+ }
32
+ interface ChatCompletionUserMessageParam {
33
+ /**
34
+ * The contents of the user message.
35
+ */
36
+ content: string | Array<ChatCompletionContentPart> | null;
37
+ /**
38
+ * The role of the messages author, in this case `user`.
39
+ */
40
+ role: "user";
41
+ }
42
+ interface ChatCompletionSystemMessageParam {
43
+ /**
44
+ * The contents of the system message.
45
+ */
46
+ content: string | null;
47
+ /**
48
+ * The role of the messages author, in this case `system`.
49
+ */
50
+ role: "system";
51
+ }
52
+ export interface ChatCompletionCreateParamsBase {
53
+ /**
54
+ * A list of messages comprising the conversation so far.
55
+ * [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models).
56
+ */
57
+ messages: Array<ChatCompletionUserMessageParam | ChatCompletionSystemMessageParam>;
58
+ /**
59
+ * ID of the model to use. See the
60
+ * [model endpoint compatibility](https://platform.openai.com/docs/models/model-endpoint-compatibility)
61
+ * table for details on which models work with the Chat API.
62
+ */
63
+ model: (string & {}) | "gpt-4-1106-preview" | "gpt-4-vision-preview" | "gpt-4" | "gpt-4-0314" | "gpt-4-0613" | "gpt-4-32k" | "gpt-4-32k-0314" | "gpt-4-32k-0613" | "gpt-3.5-turbo" | "gpt-3.5-turbo-16k" | "gpt-3.5-turbo-0301" | "gpt-3.5-turbo-0613" | "gpt-3.5-turbo-16k-0613";
64
+ /**
65
+ * Number between -2.0 and 2.0. Positive values penalize new tokens based on their
66
+ * existing frequency in the text so far, decreasing the model's likelihood to
67
+ * repeat the same line verbatim.
68
+ *
69
+ * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
70
+ */
71
+ frequency_penalty?: number | null;
72
+ /**
73
+ * Modify the likelihood of specified tokens appearing in the completion.
74
+ *
75
+ * Accepts a JSON object that maps tokens (specified by their token ID in the
76
+ * tokenizer) to an associated bias value from -100 to 100. Mathematically, the
77
+ * bias is added to the logits generated by the model prior to sampling. The exact
78
+ * effect will vary per model, but values between -1 and 1 should decrease or
79
+ * increase likelihood of selection; values like -100 or 100 should result in a ban
80
+ * or exclusive selection of the relevant token.
81
+ */
82
+ logit_bias?: Record<string, number> | null;
83
+ /**
84
+ * The maximum number of [tokens](/tokenizer) to generate in the chat completion.
85
+ *
86
+ * The total length of input tokens and generated tokens is limited by the model's
87
+ * context length.
88
+ * [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken)
89
+ * for counting tokens.
90
+ */
91
+ max_tokens?: number | null;
92
+ /**
93
+ * How many chat completion choices to generate for each input message.
94
+ */
95
+ n?: number | null;
96
+ /**
97
+ * Number between -2.0 and 2.0. Positive values penalize new tokens based on
98
+ * whether they appear in the text so far, increasing the model's likelihood to
99
+ * talk about new topics.
100
+ *
101
+ * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
102
+ */
103
+ presence_penalty?: number | null;
104
+ /**
105
+ * This feature is in Beta. If specified, our system will make a best effort to
106
+ * sample deterministically, such that repeated requests with the same `seed` and
107
+ * parameters should return the same result. Determinism is not guaranteed, and you
108
+ * should refer to the `system_fingerprint` response parameter to monitor changes
109
+ * in the backend.
110
+ */
111
+ seed?: number | null;
112
+ /**
113
+ * Up to 4 sequences where the API will stop generating further tokens.
114
+ */
115
+ stop?: string | null | Array<string>;
116
+ /**
117
+ * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
118
+ * sent as data-only
119
+ * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
120
+ * as they become available, with the stream terminated by a `data: [DONE]`
121
+ * message.
122
+ * [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).
123
+ */
124
+ stream?: boolean | null;
125
+ /**
126
+ * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
127
+ * make the output more random, while lower values like 0.2 will make it more
128
+ * focused and deterministic.
129
+ *
130
+ * We generally recommend altering this or `top_p` but not both.
131
+ */
132
+ temperature?: number | null;
133
+ /**
134
+ * An alternative to sampling with temperature, called nucleus sampling, where the
135
+ * model considers the results of the tokens with top_p probability mass. So 0.1
136
+ * means only the tokens comprising the top 10% probability mass are considered.
137
+ *
138
+ * We generally recommend altering this or `temperature` but not both.
139
+ */
140
+ top_p?: number | null;
141
+ /**
142
+ * A unique identifier representing your end-user, which can help OpenAI to monitor
143
+ * and detect abuse.
144
+ * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).
145
+ */
146
+ user?: string;
147
+ }
148
+ export {};
149
+ }
150
+ export declare namespace OpenAIOutput {
151
+ export interface ChatCompletion {
152
+ /**
153
+ * A unique identifier for the chat completion.
154
+ */
155
+ id: string;
156
+ /**
157
+ * A list of chat completion choices. Can be more than one if `n` is greater
158
+ * than 1.
159
+ */
160
+ choices: Array<Choice>;
161
+ /**
162
+ * The Unix timestamp (in seconds) of when the chat completion was created.
163
+ */
164
+ created: number;
165
+ /**
166
+ * The model used for the chat completion.
167
+ */
168
+ model: string;
169
+ /**
170
+ * The object type, which is always `chat.completion`.
171
+ */
172
+ object: "chat.completion";
173
+ /**
174
+ * This fingerprint represents the backend configuration that the model runs with.
175
+ *
176
+ * Can be used in conjunction with the `seed` request parameter to understand when
177
+ * backend changes have been made that might impact determinism.
178
+ */
179
+ system_fingerprint?: string;
180
+ /**
181
+ * Usage statistics for the completion request.
182
+ */
183
+ usage?: CompletionUsage;
184
+ }
185
+ export interface Choice {
186
+ /**
187
+ * The reason the model stopped generating tokens. This will be `stop` if the model
188
+ * hit a natural stop point or a provided stop sequence, `length` if the maximum
189
+ * number of tokens specified in the request was reached, `content_filter` if
190
+ * content was omitted due to a flag from our content filters, `tool_calls` if the
191
+ * model called a tool, or `function_call` (deprecated) if the model called a
192
+ * function.
193
+ */
194
+ finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call";
195
+ /**
196
+ * The index of the choice in the list of choices.
197
+ */
198
+ index: number;
199
+ /**
200
+ * A chat completion message generated by the model.
201
+ */
202
+ message: ChatCompletionMessage;
203
+ }
204
+ interface ChatCompletionMessage {
205
+ /**
206
+ * The contents of the message.
207
+ */
208
+ content: string | null;
209
+ /**
210
+ * The role of the author of this message.
211
+ */
212
+ role: "assistant";
213
+ }
214
+ /**
215
+ * Usage statistics for the completion request.
216
+ */
217
+ interface CompletionUsage {
218
+ /**
219
+ * Number of tokens in the generated completion.
220
+ */
221
+ completion_tokens: number;
222
+ /**
223
+ * Number of tokens in the prompt.
224
+ */
225
+ prompt_tokens: number;
226
+ /**
227
+ * Total number of tokens used in the request (prompt + completion).
228
+ */
229
+ total_tokens: number;
230
+ }
231
+ export interface APIError {
232
+ readonly status: 400 | 401 | 403 | 404 | 409 | 422 | 429 | 500 | undefined;
233
+ readonly headers: Headers | undefined;
234
+ readonly error: {
235
+ message: string;
236
+ } | undefined;
237
+ readonly code: string | null | undefined;
238
+ readonly param: string | null | undefined;
239
+ readonly type: string | undefined;
240
+ }
241
+ export {};
242
+ }
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, ExcalidrawFrameElement, NonDeletedExcalidrawElement } from "../element/types";
1
+ import { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "../element/types";
2
2
  import { ExportType } from "../scene/types";
3
3
  import { AppState, BinaryFiles } from "../types";
4
4
  import { FileSystemHandle } from "./filesystem";
@@ -8,7 +8,7 @@ export type ExportedElements = readonly NonDeletedExcalidrawElement[] & {
8
8
  _brand: "exportedElements";
9
9
  };
10
10
  export declare const prepareElementsForExport: (elements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
11
- exportingFrame: ExcalidrawFrameElement | null;
11
+ exportingFrame: ExcalidrawFrameLikeElement | null;
12
12
  exportedElements: ExportedElements;
13
13
  };
14
14
  export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, exportingFrame, }: {
@@ -17,5 +17,5 @@ export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements:
17
17
  viewBackgroundColor: string;
18
18
  name: string;
19
19
  fileHandle?: FileSystemHandle | null | undefined;
20
- exportingFrame: ExcalidrawFrameElement | null;
20
+ exportingFrame: ExcalidrawFrameLikeElement | null;
21
21
  }) => Promise<FileSystemHandle | null | undefined>;
@@ -0,0 +1,23 @@
1
+ import { Theme } from "../element/types";
2
+ import { DataURL } from "../types";
3
+ import { OpenAIOutput } from "./ai/types";
4
+ export type MagicCacheData = {
5
+ status: "pending";
6
+ } | {
7
+ status: "done";
8
+ html: string;
9
+ } | {
10
+ status: "error";
11
+ message?: string;
12
+ code: "ERR_GENERATION_INTERRUPTED" | string;
13
+ };
14
+ export declare function diagramToHTML({ image, apiKey, text, theme, }: {
15
+ image: DataURL;
16
+ apiKey: string;
17
+ text: string;
18
+ theme?: Theme;
19
+ }): Promise<({
20
+ ok: true;
21
+ } & OpenAIOutput.ChatCompletion) | ({
22
+ ok: false;
23
+ } & OpenAIOutput.APIError)>;
@@ -1,5 +1,5 @@
1
1
  import { ElementConstructorOpts } from "../element/newElement";
2
- import { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawEmbeddableElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, TextAlign, VerticalAlign } from "../element/types";
2
+ import { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, TextAlign, VerticalAlign } from "../element/types";
3
3
  import { MarkOptional } from "../utility-types";
4
4
  export type ValidLinearElement = {
5
5
  type: "arrow" | "line";
@@ -13,11 +13,11 @@ export type ValidLinearElement = {
13
13
  verticalAlign?: VerticalAlign;
14
14
  } & MarkOptional<ElementConstructorOpts, "x" | "y">;
15
15
  end?: (({
16
- type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
16
+ type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
17
17
  id?: ExcalidrawGenericElement["id"];
18
18
  } | {
19
19
  id: ExcalidrawGenericElement["id"];
20
- type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
20
+ type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
21
21
  }) | (({
22
22
  type: "text";
23
23
  text: string;
@@ -27,11 +27,11 @@ export type ValidLinearElement = {
27
27
  text: string;
28
28
  }) & Partial<ExcalidrawTextElement>)) & MarkOptional<ElementConstructorOpts, "x" | "y">;
29
29
  start?: (({
30
- type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
30
+ type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
31
31
  id?: ExcalidrawGenericElement["id"];
32
32
  } | {
33
33
  id: ExcalidrawGenericElement["id"];
34
- type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
34
+ type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
35
35
  }) | (({
36
36
  type: "text";
37
37
  text: string;
@@ -52,7 +52,7 @@ export type ValidContainer = {
52
52
  verticalAlign?: VerticalAlign;
53
53
  } & MarkOptional<ElementConstructorOpts, "x" | "y">;
54
54
  } & ElementConstructorOpts;
55
- export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawEmbeddableElement | ExcalidrawFreeDrawElement> | ({
55
+ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawIframeLikeElement | ExcalidrawFreeDrawElement> | ({
56
56
  type: Extract<ExcalidrawLinearElement["type"], "line">;
57
57
  x: number;
58
58
  y: number;
@@ -71,7 +71,11 @@ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, Excal
71
71
  type: "frame";
72
72
  children: readonly ExcalidrawElement["id"][];
73
73
  name?: string;
74
- } & Partial<ExcalidrawFrameElement>);
74
+ } & Partial<ExcalidrawFrameElement>) | ({
75
+ type: "magicframe";
76
+ children: readonly ExcalidrawElement["id"][];
77
+ name?: string;
78
+ } & Partial<ExcalidrawMagicFrameElement>);
75
79
  export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
76
80
  regenerateIds: boolean;
77
81
  }) => ExcalidrawElement[];
@@ -0,0 +1,6 @@
1
+ import { NonDeletedExcalidrawElement } from "./types";
2
+ import "./ElementCanvasButtons.scss";
3
+ export declare const ElementCanvasButtons: ({ children, element, }: {
4
+ children: React.ReactNode;
5
+ element: NonDeletedExcalidrawElement;
6
+ }) => JSX.Element | null;
@@ -39,7 +39,7 @@ export declare const actionLink: {
39
39
  isBindingEnabled: boolean;
40
40
  startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
41
41
  suggestedBindings: import("./binding").SuggestedBinding[];
42
- frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameElement> | null;
42
+ frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameLikeElement> | null;
43
43
  frameRendering: {
44
44
  enabled: boolean;
45
45
  name: boolean;
@@ -89,7 +89,16 @@ export declare const actionLink: {
89
89
  name: string;
90
90
  tab?: string | undefined;
91
91
  } | null;
92
- openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
92
+ openDialog: {
93
+ name: "imageExport" | "help" | "jsonExport";
94
+ } | {
95
+ name: "settings";
96
+ source: "settings" | "tool" | "generation";
97
+ tab: "text-to-diagram" | "diagram-to-code";
98
+ } | {
99
+ name: "ttd";
100
+ tab: "mermaid" | "text-to-diagram";
101
+ } | null;
93
102
  defaultSidebarDockedPreference: boolean;
94
103
  lastPointerDownWith: import("./types").PointerType;
95
104
  selectedElementIds: Readonly<{
@@ -1,5 +1,5 @@
1
1
  import * as GA from "../ga";
2
- import { NonDeletedExcalidrawElement, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawRectangleElement, ExcalidrawEmbeddableElement, ExcalidrawDiamondElement, ExcalidrawTextElement, ExcalidrawEllipseElement, NonDeleted, ExcalidrawImageElement, ExcalidrawFrameElement } from "./types";
2
+ import { NonDeletedExcalidrawElement, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawRectangleElement, ExcalidrawDiamondElement, ExcalidrawTextElement, ExcalidrawEllipseElement, NonDeleted, ExcalidrawImageElement, ExcalidrawFrameLikeElement, ExcalidrawIframeLikeElement } from "./types";
3
3
  import { FrameNameBoundsCache, Point } from "../types";
4
4
  import { AppState } from "../types";
5
5
  export declare const hitTest: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number) => boolean;
@@ -18,4 +18,4 @@ export declare const determineFocusPoint: (element: ExcalidrawBindableElement, f
18
18
  export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap?: number) => Point[];
19
19
  export declare const getCircleIntersections: (center: readonly [number, number, number, number, number, number, number, number], radius: number, line: readonly [number, number, number, number, number, number, number, number]) => GA.Point[];
20
20
  export declare const findFocusPointForEllipse: (ellipse: ExcalidrawEllipseElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
21
- export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
21
+ export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
@@ -1,21 +1,9 @@
1
1
  import { ExcalidrawProps } from "../types";
2
- import { ExcalidrawElement, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement, Theme } from "./types";
3
- type EmbeddedLink = ({
4
- aspectRatio: {
5
- w: number;
6
- h: number;
7
- };
8
- warning?: string;
9
- } & ({
10
- type: "video" | "generic";
11
- link: string;
12
- } | {
13
- type: "document";
14
- srcdoc: (theme: Theme) => string;
15
- })) | null;
16
- export declare const getEmbedLink: (link: string | null | undefined) => EmbeddedLink;
17
- export declare const isEmbeddableOrLabel: (element: NonDeletedExcalidrawElement) => Boolean;
18
- export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawEmbeddableElement) => ExcalidrawElement;
2
+ import { ExcalidrawElement, ExcalidrawIframeLikeElement, IframeData, NonDeletedExcalidrawElement } from "./types";
3
+ export declare const createSrcDoc: (body: string) => string;
4
+ export declare const getEmbedLink: (link: string | null | undefined) => IframeData | null;
5
+ export declare const isIframeLikeOrItsLabel: (element: NonDeletedExcalidrawElement) => Boolean;
6
+ export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawIframeLikeElement) => ExcalidrawElement;
19
7
  export declare const actionSetEmbeddableAsActiveTool: {
20
8
  name: "setEmbeddableAsActiveTool";
21
9
  trackEvent: {
@@ -47,7 +35,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
47
35
  isBindingEnabled: boolean;
48
36
  startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
49
37
  suggestedBindings: import("./binding").SuggestedBinding[];
50
- frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameElement> | null;
38
+ frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameLikeElement> | null;
51
39
  frameRendering: {
52
40
  enabled: boolean;
53
41
  name: boolean;
@@ -94,7 +82,16 @@ export declare const actionSetEmbeddableAsActiveTool: {
94
82
  name: string;
95
83
  tab?: string | undefined;
96
84
  } | null;
97
- openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
85
+ openDialog: {
86
+ name: "imageExport" | "help" | "jsonExport";
87
+ } | {
88
+ name: "settings";
89
+ source: "settings" | "tool" | "generation";
90
+ tab: "text-to-diagram" | "diagram-to-code";
91
+ } | {
92
+ name: "ttd";
93
+ tab: "mermaid" | "text-to-diagram";
94
+ } | null;
98
95
  defaultSidebarDockedPreference: boolean;
99
96
  lastPointerDownWith: import("./types").PointerType;
100
97
  selectedElementIds: Readonly<{
@@ -111,7 +108,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
111
108
  duration?: number | undefined;
112
109
  } | null;
113
110
  zenModeEnabled: boolean;
114
- theme: Theme;
111
+ theme: import("./types").Theme;
115
112
  gridSize: number | null;
116
113
  viewModeEnabled: boolean;
117
114
  selectedGroupIds: {
@@ -150,4 +147,3 @@ export declare const actionSetEmbeddableAsActiveTool: {
150
147
  };
151
148
  export declare const extractSrc: (htmlString: string) => string;
152
149
  export declare const embeddableURLValidator: (url: string | null | undefined, validateEmbeddable: ExcalidrawProps["validateEmbeddable"]) => boolean;
153
- export {};
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameElement } from "./types";
1
+ import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
2
2
  export { newElement, newTextElement, updateTextElement, refreshTextDimensions, newLinearElement, newImageElement, duplicateElement, } from "./newElement";
3
3
  export { getElementAbsoluteCoords, getElementBounds, getCommonBounds, getDiamondPoints, getArrowheadPoints, getClosestElementBounds, } from "./bounds";
4
4
  export { OMIT_SIDES_FOR_MULTIPLE_ELEMENTS, getTransformHandlesFromCoords, getTransformHandles, } from "./transformHandles";
@@ -6,15 +6,14 @@ export { hitTest, isHittingElementBoundingBoxWithoutHittingElement, } from "./co
6
6
  export { resizeTest, getCursorForResizingElement, getElementWithTransformHandleType, getTransformHandleTypeFromCoords, } from "./resizeTest";
7
7
  export { transformElements, getResizeOffsetXY, getResizeArrowDirection, } from "./resizeElements";
8
8
  export { dragSelectedElements, getDragOffsetXY, dragNewElement, } from "./dragElements";
9
- export { isTextElement, isExcalidrawElement, isFrameElement, } from "./typeChecks";
9
+ export { isTextElement, isExcalidrawElement } from "./typeChecks";
10
10
  export { textWysiwyg } from "./textWysiwyg";
11
11
  export { redrawTextBoundingBox } from "./textElement";
12
12
  export { getPerfectElementSize, getLockedLinearCursorAlignSize, isInvisiblySmallElement, resizePerfectLineForNWHandler, getNormalizedDimensions, } from "./sizeHelpers";
13
13
  export { showSelectedShapeActions } from "./showSelectedShapeActions";
14
14
  export declare const getSceneVersion: (elements: readonly ExcalidrawElement[]) => number;
15
15
  export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
16
- export declare const getNonDeletedElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
17
- export declare const getNonDeletedFrames: (frames: readonly ExcalidrawFrameElement[]) => readonly NonDeleted<ExcalidrawFrameElement>[];
16
+ export declare const getNonDeletedElements: <T extends ExcalidrawElement>(elements: readonly T[]) => readonly NonDeleted<T>[];
18
17
  export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element: T) => element is NonDeleted<T>;
19
18
  export declare const clearElementsForDatabase: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
20
19
  export declare const clearElementsForExport: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
@@ -126,7 +126,7 @@ export declare class LinearElementEditor {
126
126
  contextMenu: {
127
127
  items: import("../components/ContextMenu").ContextMenuItems;
128
128
  top: number;
129
- left: number;
129
+ left: number; /** @returns whether point was dragged */
130
130
  } | null;
131
131
  showWelcomeScreen: boolean;
132
132
  isLoading: boolean;
@@ -142,7 +142,7 @@ export declare class LinearElementEditor {
142
142
  isBindingEnabled: boolean;
143
143
  startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
144
144
  suggestedBindings: import("./binding").SuggestedBinding[];
145
- frameToHighlight: NonDeleted<import("./types").ExcalidrawFrameElement> | null;
145
+ frameToHighlight: NonDeleted<import("./types").ExcalidrawFrameLikeElement> | null;
146
146
  frameRendering: {
147
147
  enabled: boolean;
148
148
  name: boolean;
@@ -192,7 +192,16 @@ export declare class LinearElementEditor {
192
192
  name: string;
193
193
  tab?: string | undefined;
194
194
  } | null;
195
- openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
195
+ openDialog: {
196
+ name: "imageExport" | "help" | "jsonExport";
197
+ } | {
198
+ name: "settings";
199
+ source: "settings" | "tool" | "generation";
200
+ tab: "text-to-diagram" | "diagram-to-code";
201
+ } | {
202
+ name: "ttd";
203
+ tab: "mermaid" | "text-to-diagram";
204
+ } | null;
196
205
  defaultSidebarDockedPreference: boolean;
197
206
  lastPointerDownWith: import("./types").PointerType;
198
207
  selectedElementIds: Readonly<{
@@ -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
  fontSize?: number;
@@ -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>) => number;
72
72
  export declare const getBoundTextMaxWidth: (container: ExcalidrawElement, boundTextElement?: ExcalidrawTextElement | null) => number;
@@ -1,19 +1,22 @@
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
22
  export declare const isExcalidrawElement: (element: any) => element is ExcalidrawElement;