@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
@@ -155,4 +155,10 @@ export declare const frameToolIcon: import("react/jsx-runtime").JSX.Element;
155
155
  export declare const mermaidLogoIcon: import("react/jsx-runtime").JSX.Element;
156
156
  export declare const ArrowRightIcon: import("react/jsx-runtime").JSX.Element;
157
157
  export declare const laserPointerToolIcon: import("react/jsx-runtime").JSX.Element;
158
+ export declare const MagicIcon: import("react/jsx-runtime").JSX.Element;
159
+ export declare const OpenAIIcon: import("react/jsx-runtime").JSX.Element;
160
+ export declare const fullscreenIcon: import("react/jsx-runtime").JSX.Element;
161
+ export declare const eyeIcon: import("react/jsx-runtime").JSX.Element;
162
+ export declare const eyeClosedIcon: import("react/jsx-runtime").JSX.Element;
163
+ export declare const brainIcon: import("react/jsx-runtime").JSX.Element;
158
164
  export {};
@@ -28,6 +28,12 @@ declare const MainMenu: React.FC<{
28
28
  className?: string | undefined;
29
29
  } & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onSelect">): import("react/jsx-runtime").JSX.Element;
30
30
  displayName: string;
31
+ Badge: {
32
+ ({ children, }: {
33
+ children: React.ReactNode;
34
+ }): import("react/jsx-runtime").JSX.Element;
35
+ displayName: string;
36
+ };
31
37
  };
32
38
  ItemLink: {
33
39
  ({ icon, shortcut, href, children, onSelect, className, selected, ...rest }: {
@@ -63,7 +63,8 @@ export declare enum EVENT {
63
63
  SCROLL = "scroll",
64
64
  EXCALIDRAW_LINK = "excalidraw-link",
65
65
  MENU_ITEM_SELECT = "menu.itemSelect",
66
- MESSAGE = "message"
66
+ MESSAGE = "message",
67
+ FULLSCREENCHANGE = "fullscreenchange"
67
68
  }
68
69
  export declare const YOUTUBE_STATES: {
69
70
  readonly UNSTARTED: -1;
@@ -87,6 +88,7 @@ export declare const FONT_FAMILY: {
87
88
  Helvetica: number;
88
89
  Cascadia: number;
89
90
  LocalFont: number;
91
+ Assistant: number;
90
92
  };
91
93
  export declare const THEME: {
92
94
  readonly LIGHT: "light";
@@ -104,6 +106,11 @@ export declare const FRAME_STYLE: {
104
106
  } | null;
105
107
  backgroundColor: string;
106
108
  radius: number;
109
+ nameOffsetY: number;
110
+ nameColorLightTheme: string;
111
+ nameColorDarkTheme: string;
112
+ nameFontSize: number;
113
+ nameLineHeight: number;
107
114
  };
108
115
  export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
109
116
  export declare const MIN_FONT_SIZE = 1;
@@ -174,7 +181,6 @@ export declare const URL_HASH_KEYS: {
174
181
  readonly addLibrary: "addLibrary";
175
182
  };
176
183
  export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
177
- export declare const MQ_SM_MAX_WIDTH = 640;
178
184
  export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
179
185
  export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
180
186
  export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
@@ -244,4 +250,25 @@ export declare const DEFAULT_SIDEBAR: {
244
250
  readonly name: "default";
245
251
  readonly defaultTab: "library";
246
252
  };
247
- export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "image">;
253
+ export declare const LIBRARY_DISABLED_TYPES: Set<"image" | "embeddable" | "iframe">;
254
+ export declare const TOOL_TYPE: {
255
+ readonly selection: "selection";
256
+ readonly rectangle: "rectangle";
257
+ readonly diamond: "diamond";
258
+ readonly ellipse: "ellipse";
259
+ readonly arrow: "arrow";
260
+ readonly line: "line";
261
+ readonly freedraw: "freedraw";
262
+ readonly text: "text";
263
+ readonly image: "image";
264
+ readonly eraser: "eraser";
265
+ readonly hand: "hand";
266
+ readonly frame: "frame";
267
+ readonly magicframe: "magicframe";
268
+ readonly embeddable: "embeddable";
269
+ readonly laser: "laser";
270
+ };
271
+ export declare const EDITOR_LS_KEYS: {
272
+ readonly OAI_API_KEY: "excalidraw-oai-api-key";
273
+ readonly PUBLISH_LIBRARY: "publish-library-data";
274
+ };
@@ -11,6 +11,7 @@ type TunnelsContextValue = {
11
11
  DefaultSidebarTriggerTunnel: Tunnel;
12
12
  DefaultSidebarTabTriggersTunnel: Tunnel;
13
13
  OverwriteConfirmDialogTunnel: Tunnel;
14
+ TTDDialogTriggerTunnel: Tunnel;
14
15
  jotaiScope: symbol;
15
16
  };
16
17
  export declare const TunnelsContext: React.Context<TunnelsContextValue>;
@@ -0,0 +1,8 @@
1
+ import { EDITOR_LS_KEYS } from "../constants";
2
+ import { JSONValue } from "../types";
3
+ export declare class EditorLocalStorage {
4
+ static has(key: typeof EDITOR_LS_KEYS[keyof typeof EDITOR_LS_KEYS]): boolean;
5
+ static get<T extends JSONValue>(key: typeof EDITOR_LS_KEYS[keyof typeof EDITOR_LS_KEYS]): T | null;
6
+ static set: (key: (typeof EDITOR_LS_KEYS)[keyof typeof EDITOR_LS_KEYS], value: JSONValue) => boolean;
7
+ static delete: (name: (typeof EDITOR_LS_KEYS)[keyof typeof EDITOR_LS_KEYS]) => void;
8
+ }
@@ -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,13 +1,21 @@
1
- import { 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";
5
5
  export { loadFromBlob } from "./blob";
6
6
  export { loadFromJSON, saveAsJSON } from "./json";
7
- export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, }: {
7
+ export type ExportedElements = readonly NonDeletedExcalidrawElement[] & {
8
+ _brand: "exportedElements";
9
+ };
10
+ export declare const prepareElementsForExport: (elements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
11
+ exportingFrame: ExcalidrawFrameLikeElement | null;
12
+ exportedElements: ExportedElements;
13
+ };
14
+ export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, exportingFrame, }: {
8
15
  exportBackground: boolean;
9
16
  exportPadding?: number | undefined;
10
17
  viewBackgroundColor: string;
11
18
  name: string;
12
19
  fileHandle?: FileSystemHandle | null | undefined;
20
+ exportingFrame: ExcalidrawFrameLikeElement | null;
13
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
+ }) => import("react/jsx-runtime").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,15 @@ 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: "magicSettings";
96
+ source: "tool" | "generation" | "settings";
97
+ } | {
98
+ name: "ttd";
99
+ tab: string;
100
+ } | null;
93
101
  defaultSidebarDockedPreference: boolean;
94
102
  lastPointerDownWith: import("./types").PointerType;
95
103
  selectedElementIds: Readonly<{
@@ -159,6 +167,7 @@ export declare const actionLink: {
159
167
  frameColor: {
160
168
  stroke: string;
161
169
  fill: string;
170
+ nameColor: string;
162
171
  };
163
172
  invertBindingBehaviour: boolean;
164
173
  selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
@@ -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 isEmbeddableOrFrameLabel: (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,15 @@ 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: "magicSettings";
89
+ source: "tool" | "generation" | "settings";
90
+ } | {
91
+ name: "ttd";
92
+ tab: string;
93
+ } | null;
98
94
  defaultSidebarDockedPreference: boolean;
99
95
  lastPointerDownWith: import("./types").PointerType;
100
96
  selectedElementIds: Readonly<{
@@ -111,7 +107,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
111
107
  duration?: number | undefined;
112
108
  } | null;
113
109
  zenModeEnabled: boolean;
114
- theme: Theme;
110
+ theme: import("./types").Theme;
115
111
  gridSize: number | null;
116
112
  previousGridSize: number | null;
117
113
  viewModeEnabled: boolean;
@@ -165,6 +161,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
165
161
  frameColor: {
166
162
  stroke: string;
167
163
  fill: string;
164
+ nameColor: string;
168
165
  };
169
166
  invertBindingBehaviour: boolean;
170
167
  selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
@@ -182,4 +179,3 @@ export declare const actionSetEmbeddableAsActiveTool: {
182
179
  };
183
180
  export declare const extractSrc: (htmlString: string) => string;
184
181
  export declare const embeddableURLValidator: (url: string | null | undefined, validateEmbeddable: ExcalidrawProps["validateEmbeddable"]) => boolean;
185
- 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[];
@@ -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,15 @@ 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: "magicSettings";
199
+ source: "tool" | "generation" | "settings";
200
+ } | {
201
+ name: "ttd";
202
+ tab: string;
203
+ } | null;
196
204
  defaultSidebarDockedPreference: boolean;
197
205
  lastPointerDownWith: import("./types").PointerType;
198
206
  selectedElementIds: Readonly<{
@@ -263,6 +271,7 @@ export declare class LinearElementEditor {
263
271
  frameColor: {
264
272
  stroke: string;
265
273
  fill: string;
274
+ nameColor: string;
266
275
  };
267
276
  invertBindingBehaviour: boolean;
268
277
  selectedLinearElement: LinearElementEditor | null;