@zsviczian/excalidraw 0.11.0-obsidian-25 → 0.12.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 (81) hide show
  1. package/README.md +352 -42
  2. package/dist/excalidraw.development.js +117 -112
  3. package/dist/excalidraw.production.min.js +1 -1
  4. package/dist/excalidraw.production.min.js.LICENSE.txt +2 -1
  5. package/package.json +22 -24
  6. package/types/actions/actionAddToLibrary.d.ts +13 -3
  7. package/types/actions/actionAlign.d.ts +6 -6
  8. package/types/actions/actionBoundText.d.ts +5 -1
  9. package/types/actions/actionCanvas.d.ts +52 -16
  10. package/types/actions/actionClipboard.d.ts +25 -5
  11. package/types/actions/actionDeleteSelected.d.ts +16 -4
  12. package/types/actions/actionDistribute.d.ts +2 -2
  13. package/types/actions/actionDuplicateSelection.d.ts +1 -1
  14. package/types/actions/actionExport.d.ts +51 -17
  15. package/types/actions/actionFinalize.d.ts +11 -3
  16. package/types/actions/actionGroup.d.ts +2 -2
  17. package/types/actions/actionMenu.d.ts +18 -6
  18. package/types/actions/actionNavigate.d.ts +1 -2
  19. package/types/actions/actionProperties.d.ts +78 -26
  20. package/types/actions/actionSelectAll.d.ts +2 -1
  21. package/types/actions/actionStyles.d.ts +3 -1
  22. package/types/actions/actionToggleGridMode.d.ts +5 -1
  23. package/types/actions/actionToggleStats.d.ts +5 -1
  24. package/types/actions/actionToggleViewMode.d.ts +5 -1
  25. package/types/actions/actionToggleZenMode.d.ts +5 -1
  26. package/types/actions/actionZindex.d.ts +4 -4
  27. package/types/analytics.d.ts +1 -1
  28. package/types/appState.d.ts +1 -0
  29. package/types/clients.d.ts +1 -1
  30. package/types/components/ActiveFile.d.ts +0 -1
  31. package/types/components/App.d.ts +6 -3
  32. package/types/components/ButtonIconSelect.d.ts +0 -1
  33. package/types/components/Card.d.ts +1 -0
  34. package/types/components/CheckboxItem.d.ts +1 -0
  35. package/types/components/ClearCanvas.d.ts +0 -1
  36. package/types/components/CollabButton.d.ts +0 -1
  37. package/types/components/ColorPicker.d.ts +0 -1
  38. package/types/components/ConfirmDialog.d.ts +0 -1
  39. package/types/components/DarkModeToggle.d.ts +0 -1
  40. package/types/components/ErrorDialog.d.ts +0 -1
  41. package/types/components/HelpDialog.d.ts +0 -1
  42. package/types/components/HelpIcon.d.ts +0 -1
  43. package/types/components/HintViewer.d.ts +0 -1
  44. package/types/components/IconPicker.d.ts +0 -1
  45. package/types/components/ImageExportDialog.d.ts +0 -1
  46. package/types/components/JSONExportDialog.d.ts +0 -1
  47. package/types/components/LayerUI.d.ts +1 -4
  48. package/types/components/LibraryMenu.d.ts +0 -1
  49. package/types/components/LibraryUnit.d.ts +0 -1
  50. package/types/components/LockButton.d.ts +0 -1
  51. package/types/components/MobileMenu.d.ts +1 -2
  52. package/types/components/Modal.d.ts +2 -2
  53. package/types/components/PenModeButton.d.ts +0 -1
  54. package/types/components/ProjectName.d.ts +0 -1
  55. package/types/components/PublishLibrary.d.ts +0 -1
  56. package/types/components/Section.d.ts +4 -5
  57. package/types/components/SidebarLockButton.d.ts +0 -1
  58. package/types/components/SingleLibraryItem.d.ts +0 -1
  59. package/types/components/Spinner.d.ts +0 -1
  60. package/types/components/Toast.d.ts +4 -3
  61. package/types/constants.d.ts +0 -1
  62. package/types/data/blob.d.ts +4 -4
  63. package/types/data/filesystem.d.ts +2 -2
  64. package/types/data/json.d.ts +1 -1
  65. package/types/element/Hyperlink.d.ts +6 -2
  66. package/types/element/binding.d.ts +3 -3
  67. package/types/element/dragElements.d.ts +1 -1
  68. package/types/element/index.d.ts +1 -1
  69. package/types/element/linearElementEditor.d.ts +5 -1
  70. package/types/element/mutateElement.d.ts +1 -1
  71. package/types/element/sizeHelpers.d.ts +4 -0
  72. package/types/element/textElement.d.ts +1 -1
  73. package/types/element/typeChecks.d.ts +3 -3
  74. package/types/jotai.d.ts +5 -3
  75. package/types/keys.d.ts +1 -1
  76. package/types/packages/excalidraw/example/App.d.ts +0 -1
  77. package/types/renderer/renderElement.d.ts +1 -1
  78. package/types/renderer/renderScene.d.ts +9 -1
  79. package/types/shapes.d.ts +0 -1
  80. package/types/types.d.ts +7 -2
  81. package/types/utils.d.ts +7 -5
package/types/types.d.ts CHANGED
@@ -113,7 +113,11 @@ export declare type AppState = {
113
113
  };
114
114
  shouldCacheIgnoreZoom: boolean;
115
115
  showHelpDialog: boolean;
116
- toastMessage: string | null;
116
+ toast: {
117
+ message: string;
118
+ closable?: boolean;
119
+ duration?: number;
120
+ } | null;
117
121
  zenModeEnabled: boolean;
118
122
  theme: Theme;
119
123
  gridSize: number | null;
@@ -223,6 +227,7 @@ export interface ExcalidrawProps {
223
227
  zenModeEnabled?: boolean;
224
228
  gridModeEnabled?: boolean;
225
229
  libraryReturnUrl?: string;
230
+ initState?: AppState;
226
231
  theme?: Theme;
227
232
  name?: string;
228
233
  renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => JSX.Element;
@@ -371,7 +376,7 @@ export declare type ExcalidrawImperativeAPI = {
371
376
  getAppState: () => InstanceType<typeof App>["state"];
372
377
  getFiles: () => InstanceType<typeof App>["files"];
373
378
  refresh: InstanceType<typeof App>["refresh"];
374
- setToastMessage: InstanceType<typeof App>["setToastMessage"];
379
+ setToast: InstanceType<typeof App>["setToast"];
375
380
  addFiles: (data: BinaryFileData[]) => void;
376
381
  updateContainerSize: InstanceType<typeof App>["updateContainerSize"];
377
382
  readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
package/types/utils.d.ts CHANGED
@@ -6,8 +6,8 @@ export declare const setDateTimeForTests: (dateTime: string) => void;
6
6
  export declare const getDateTime: () => string;
7
7
  export declare const capitalizeString: (str: string) => string;
8
8
  export declare const isToolIcon: (target: Element | EventTarget | null) => target is HTMLElement;
9
- export declare const isInputLike: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLBRElement | HTMLDivElement;
10
- export declare const isWritableElement: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLTextAreaElement | HTMLBRElement | HTMLDivElement;
9
+ export declare const isInputLike: (target: Element | EventTarget | null) => target is HTMLBRElement | HTMLDivElement | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
10
+ export declare const isWritableElement: (target: Element | EventTarget | null) => target is HTMLBRElement | HTMLDivElement | HTMLInputElement | HTMLTextAreaElement;
11
11
  export declare const getFontFamilyString: ({ fontFamily, }: {
12
12
  fontFamily: FontFamilyValues;
13
13
  }) => string;
@@ -21,7 +21,9 @@ export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeo
21
21
  flush(): void;
22
22
  cancel(): void;
23
23
  };
24
- export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void) => {
24
+ export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void, opts?: {
25
+ trailing?: boolean;
26
+ }) => {
25
27
  (...args: T): void;
26
28
  flush(): void;
27
29
  cancel(): void;
@@ -31,7 +33,7 @@ export declare const selectNode: (node: Element) => void;
31
33
  export declare const removeSelection: () => void;
32
34
  export declare const distance: (x: number, y: number) => number;
33
35
  export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: ({
34
- type: typeof SHAPES[number]["value"] | "eraser";
36
+ type: (typeof SHAPES)[number]["value"] | "eraser";
35
37
  } | {
36
38
  type: "custom";
37
39
  customType: string;
@@ -85,7 +87,7 @@ export declare const tupleToCoors: (xyTuple: readonly [number, number]) => {
85
87
  y: number;
86
88
  };
87
89
  /** use as a rejectionHandler to mute filesystem Abort errors */
88
- export declare const muteFSAbortError: (error?: Error | undefined) => void;
90
+ export declare const muteFSAbortError: (error?: Error) => void;
89
91
  export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
90
92
  export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
91
93
  export declare const isTransparent: (color: string) => boolean;