@excalidraw/excalidraw 0.17.0-a528769 → 0.17.0-c7ee46e

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 (62) hide show
  1. package/dist/excalidraw-assets/locales/{gl-ES-json-d11c7966c3c2f95756e0.js → gl-ES-json-95041caf90ef2a7e8a53.js} +1 -1
  2. package/dist/excalidraw-assets-dev/{vendor-18203854dd3b1fb2cc41.js → vendor-37ba5d021227533892ee.js} +2 -2
  3. package/dist/excalidraw-with-preact.development.js +182 -50
  4. package/dist/excalidraw-with-preact.production.min.js +1 -1
  5. package/dist/excalidraw.development.js +182 -50
  6. package/dist/excalidraw.production.min.js +1 -1
  7. package/package.json +1 -1
  8. package/types/actions/actionAddToLibrary.d.ts +6 -6
  9. package/types/actions/actionBoundText.d.ts +4 -4
  10. package/types/actions/actionCanvas.d.ts +22 -22
  11. package/types/actions/actionClipboard.d.ts +14 -14
  12. package/types/actions/actionDeleteSelected.d.ts +6 -6
  13. package/types/actions/actionElementLock.d.ts +4 -4
  14. package/types/actions/actionExport.d.ts +22 -22
  15. package/types/actions/actionFinalize.d.ts +4 -4
  16. package/types/actions/actionFrame.d.ts +6 -6
  17. package/types/actions/actionGroup.d.ts +4 -4
  18. package/types/actions/actionLinearEditor.d.ts +2 -2
  19. package/types/actions/actionMenu.d.ts +5 -5
  20. package/types/actions/actionProperties.d.ts +26 -26
  21. package/types/actions/actionSelectAll.d.ts +2 -2
  22. package/types/actions/actionStyles.d.ts +2 -2
  23. package/types/actions/actionToggleGridMode.d.ts +2 -2
  24. package/types/actions/actionToggleObjectsSnapMode.d.ts +2 -2
  25. package/types/actions/actionToggleStats.d.ts +2 -2
  26. package/types/actions/actionToggleViewMode.d.ts +2 -2
  27. package/types/actions/actionToggleZenMode.d.ts +2 -2
  28. package/types/appState.d.ts +2 -2
  29. package/types/components/App.d.ts +27 -6
  30. package/types/components/LayerUI.d.ts +5 -1
  31. package/types/components/MagicButton.d.ts +9 -0
  32. package/types/components/MagicSettings.d.ts +8 -0
  33. package/types/components/TextField.d.ts +16 -0
  34. package/types/components/icons.d.ts +5 -0
  35. package/types/constants.d.ts +24 -2
  36. package/types/data/EditorLocalStorage.d.ts +8 -0
  37. package/types/data/ai/types.d.ts +242 -0
  38. package/types/data/index.d.ts +3 -3
  39. package/types/data/magic.d.ts +23 -0
  40. package/types/data/transform.d.ts +11 -7
  41. package/types/element/ElementCanvasButtons.d.ts +6 -0
  42. package/types/element/Hyperlink.d.ts +2 -2
  43. package/types/element/collision.d.ts +2 -2
  44. package/types/element/embeddable.d.ts +8 -21
  45. package/types/element/index.d.ts +3 -4
  46. package/types/element/linearElementEditor.d.ts +3 -3
  47. package/types/element/newElement.d.ts +7 -1
  48. package/types/element/textElement.d.ts +2 -2
  49. package/types/element/typeChecks.d.ts +9 -6
  50. package/types/element/types.d.ts +29 -2
  51. package/types/frame.d.ts +21 -20
  52. package/types/packages/utils.d.ts +2 -2
  53. package/types/scene/Scene.d.ts +4 -4
  54. package/types/scene/ShapeCache.d.ts +1 -1
  55. package/types/scene/comparisons.d.ts +7 -6
  56. package/types/scene/export.d.ts +3 -3
  57. package/types/scene/types.d.ts +2 -0
  58. package/types/shapes.d.ts +1 -1
  59. package/types/types.d.ts +16 -10
  60. package/types/utils.d.ts +1 -2
  61. /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{gl-ES-json-d11c7966c3c2f95756e0.d.ts → gl-ES-json-95041caf90ef2a7e8a53.d.ts} +0 -0
  62. /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-18203854dd3b1fb2cc41.d.ts → vendor-37ba5d021227533892ee.d.ts} +0 -0
package/types/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawFrameElement, ExcalidrawEmbeddableElement } from "./element/types";
2
+ import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType } from "./element/types";
3
+ import { Action } from "./actions/types";
3
4
  import { Point as RoughPoint } from "roughjs/bin/geometry";
4
5
  import { LinearElementEditor } from "./element/linearElementEditor";
5
6
  import { SuggestedBinding } from "./element/binding";
@@ -58,7 +59,8 @@ export type BinaryFileData = {
58
59
  };
59
60
  export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
60
61
  export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
61
- export type ToolType = "selection" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "embeddable" | "laser";
62
+ export type ToolType = "selection" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser";
63
+ export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
62
64
  export type ActiveTool = {
63
65
  type: ToolType;
64
66
  customType: null;
@@ -103,13 +105,11 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
103
105
  suggestedBindings: AppState["suggestedBindings"];
104
106
  isRotating: AppState["isRotating"];
105
107
  elementsToHighlight: AppState["elementsToHighlight"];
106
- openSidebar: AppState["openSidebar"];
107
- showHyperlinkPopup: AppState["showHyperlinkPopup"];
108
108
  collaborators: AppState["collaborators"];
109
109
  snapLines: AppState["snapLines"];
110
110
  zenModeEnabled: AppState["zenModeEnabled"];
111
111
  }>;
112
- export type AppState = {
112
+ export interface AppState {
113
113
  contextMenu: {
114
114
  items: ContextMenuItems;
115
115
  top: number;
@@ -129,7 +129,7 @@ export type AppState = {
129
129
  isBindingEnabled: boolean;
130
130
  startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
131
131
  suggestedBindings: SuggestedBinding[];
132
- frameToHighlight: NonDeleted<ExcalidrawFrameElement> | null;
132
+ frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
133
133
  frameRendering: {
134
134
  enabled: boolean;
135
135
  name: boolean;
@@ -182,7 +182,7 @@ export type AppState = {
182
182
  name: SidebarName;
183
183
  tab?: SidebarTabName;
184
184
  } | null;
185
- openDialog: "imageExport" | "help" | "jsonExport" | "mermaid" | null;
185
+ openDialog: "imageExport" | "help" | "jsonExport" | "mermaid" | "magicSettings" | null;
186
186
  /**
187
187
  * Reflects user preference for whether the default sidebar should be docked.
188
188
  *
@@ -241,7 +241,7 @@ export type AppState = {
241
241
  y: number;
242
242
  } | null;
243
243
  objectsSnapModeEnabled: boolean;
244
- };
244
+ }
245
245
  export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
246
246
  export type NormalizedZoomValue = number & {
247
247
  _brand: "normalizedZoom";
@@ -325,6 +325,7 @@ export interface ExcalidrawProps {
325
325
  children?: React.ReactNode;
326
326
  validateEmbeddable?: boolean | string[] | RegExp | RegExp[] | ((link: string) => boolean | undefined);
327
327
  renderEmbeddable?: (element: NonDeleted<ExcalidrawEmbeddableElement>, appState: AppState) => JSX.Element | null;
328
+ aiEnabled?: boolean;
328
329
  }
329
330
  export type SceneData = {
330
331
  elements?: ImportedDataState["elements"];
@@ -370,6 +371,7 @@ export type AppProps = Merge<ExcalidrawProps, {
370
371
  handleKeyboardGlobally: boolean;
371
372
  isCollaborating: boolean;
372
373
  children?: React.ReactNode;
374
+ aiEnabled: boolean;
373
375
  }>;
374
376
  /** A subset of App class properties that we need to use elsewhere
375
377
  * in the app, eg Manager. Factored out into a separate type to keep DRY. */
@@ -398,6 +400,8 @@ export type AppClassProperties = {
398
400
  togglePenMode: App["togglePenMode"];
399
401
  setActiveTool: App["setActiveTool"];
400
402
  setOpenDialog: App["setOpenDialog"];
403
+ insertEmbeddableElement: App["insertEmbeddableElement"];
404
+ onMagicButtonSelect: App["onMagicButtonSelect"];
401
405
  };
402
406
  export type PointerDownState = Readonly<{
403
407
  origin: Readonly<{
@@ -471,6 +475,7 @@ export type ExcalidrawImperativeAPI = {
471
475
  getSceneElements: InstanceType<typeof App>["getSceneElements"];
472
476
  getAppState: () => InstanceType<typeof App>["state"];
473
477
  getFiles: () => InstanceType<typeof App>["files"];
478
+ registerAction: (action: Action) => void;
474
479
  refresh: InstanceType<typeof App>["refresh"];
475
480
  setToast: InstanceType<typeof App>["setToast"];
476
481
  addFiles: (data: BinaryFileData[]) => void;
@@ -508,10 +513,10 @@ type FrameNameBounds = {
508
513
  angle: number;
509
514
  };
510
515
  export type FrameNameBoundsCache = {
511
- get: (frameElement: ExcalidrawFrameElement) => FrameNameBounds | null;
516
+ get: (frameElement: ExcalidrawFrameLikeElement | ExcalidrawMagicFrameElement) => FrameNameBounds | null;
512
517
  _cache: Map<string, FrameNameBounds & {
513
518
  zoom: AppState["zoom"]["value"];
514
- versionNonce: ExcalidrawFrameElement["versionNonce"];
519
+ versionNonce: ExcalidrawFrameLikeElement["versionNonce"];
515
520
  }>;
516
521
  };
517
522
  export type KeyboardModifiersObject = {
@@ -521,4 +526,5 @@ export type KeyboardModifiersObject = {
521
526
  metaKey: boolean;
522
527
  };
523
528
  export type Primitive = number | string | boolean | bigint | symbol | null | undefined;
529
+ export type JSONValue = string | number | boolean | null | object;
524
530
  export {};
package/types/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { EVENT } from "./constants";
2
- import { FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./element/types";
2
+ import { FontFamilyValues, FontString } from "./element/types";
3
3
  import { ActiveTool, AppState, ToolType, Zoom } from "./types";
4
4
  export declare const setDateTimeForTests: (dateTime: string) => void;
5
5
  export declare const getDateTime: () => string;
@@ -186,7 +186,6 @@ export declare const isShallowEqual: <T extends Record<string, any>, I extends k
186
186
  export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E) => void) | undefined, ourEventHandler?: ((event: E) => void) | undefined, { checkForDefaultPrevented }?: {
187
187
  checkForDefaultPrevented?: boolean | undefined;
188
188
  }) => (event: E) => void;
189
- export declare const isOnlyExportingSingleFrame: (elements: readonly NonDeletedExcalidrawElement[]) => boolean;
190
189
  /**
191
190
  * supply `null` as message if non-never value is valid, you just need to
192
191
  * typecheck against it