@zsviczian/excalidraw 0.9.0-obsidian-9 → 0.9.0-obsidian-image-support-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 (53) hide show
  1. package/CHANGELOG.md +3 -2
  2. package/dist/excalidraw-assets-dev/{image-cacb3d0c02eb2e346ecc.js → image-2767e46ad3f3f29617ea.js} +0 -10
  3. package/dist/excalidraw-assets-dev/vendor-b648d92c35e91de1648e.js +323 -0
  4. package/dist/excalidraw.development.js +327 -42
  5. package/dist/excalidraw.production.min.js +1 -1
  6. package/dist/excalidraw.production.min.js.LICENSE.txt +115 -0
  7. package/package.json +1 -1
  8. package/types/actions/actionCanvas.d.ts +3 -1
  9. package/types/actions/manager.d.ts +3 -11
  10. package/types/actions/types.d.ts +2 -8
  11. package/types/appState.d.ts +59 -4
  12. package/types/components/Actions.d.ts +5 -2
  13. package/types/components/App.d.ts +20 -5
  14. package/types/components/LayerUI.d.ts +4 -1
  15. package/types/components/LibraryUnit.d.ts +3 -2
  16. package/types/components/MobileMenu.d.ts +4 -1
  17. package/types/components/Spinner.d.ts +7 -0
  18. package/types/components/ToolButton.d.ts +5 -2
  19. package/types/constants.d.ts +1 -0
  20. package/types/createInverseContext.d.ts +1 -0
  21. package/types/data/blob.d.ts +3 -1
  22. package/types/data/encode.d.ts +2 -1
  23. package/types/data/json.d.ts +1 -1
  24. package/types/element/collision.d.ts +2 -2
  25. package/types/element/dragElements.d.ts +1 -1
  26. package/types/element/image.d.ts +13 -0
  27. package/types/element/index.d.ts +2 -1
  28. package/types/element/mutateElement.d.ts +1 -1
  29. package/types/element/newElement.d.ts +6 -2
  30. package/types/element/resizeElements.d.ts +3 -3
  31. package/types/element/typeChecks.d.ts +2 -1
  32. package/types/element/types.d.ts +14 -2
  33. package/types/errors.d.ts +3 -0
  34. package/types/excalidraw-app/app_constants.d.ts +19 -0
  35. package/types/excalidraw-app/collab/CollabWrapper.d.ts +92 -0
  36. package/types/excalidraw-app/collab/Portal.d.ts +28 -0
  37. package/types/excalidraw-app/collab/RoomDialog.d.ts +14 -0
  38. package/types/excalidraw-app/data/FileSync.d.ts +39 -0
  39. package/types/excalidraw-app/data/firebase.d.ts +22 -0
  40. package/types/excalidraw-app/data/index.d.ts +161 -0
  41. package/types/excalidraw-app/data/localStorage.d.ts +98 -0
  42. package/types/keys.d.ts +4 -3
  43. package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-2767e46ad3f3f29617ea.d.ts +0 -0
  44. package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-b648d92c35e91de1648e.d.ts +0 -0
  45. package/types/packages/utils.d.ts +1 -1
  46. package/types/renderer/renderElement.d.ts +3 -2
  47. package/types/renderer/renderScene.d.ts +3 -2
  48. package/types/scene/export.d.ts +2 -1
  49. package/types/scene/types.d.ts +4 -3
  50. package/types/shapes.d.ts +5 -1
  51. package/types/types.d.ts +23 -1
  52. package/types/zindex.d.ts +2 -2
  53. package/dist/excalidraw-assets-dev/vendor-7ad6c104c3421ae6511d.js +0 -356
@@ -1,10 +1,9 @@
1
- import { ExcalidrawTextElement } from "../element/types";
2
- import { Zoom } from "../types";
1
+ import { ExcalidrawTextElement, ImageId } from "../element/types";
2
+ import { AppState, Zoom } from "../types";
3
3
  export declare type SceneState = {
4
4
  scrollX: number;
5
5
  scrollY: number;
6
6
  viewBackgroundColor: string | null;
7
- exportWithDarkMode?: boolean;
8
7
  zoom: Zoom;
9
8
  shouldCacheIgnoreZoom: boolean;
10
9
  remotePointerViewportCoords: {
@@ -25,6 +24,8 @@ export declare type SceneState = {
25
24
  remotePointerUserStates: {
26
25
  [id: string]: string;
27
26
  };
27
+ theme: AppState["theme"];
28
+ imageCache: Map<ImageId, HTMLImageElement>;
28
29
  };
29
30
  export declare type SceneScroll = {
30
31
  scrollX: number;
package/types/shapes.d.ts CHANGED
@@ -31,5 +31,9 @@ export declare const SHAPES: readonly [{
31
31
  readonly icon: JSX.Element;
32
32
  readonly value: "text";
33
33
  readonly key: "t";
34
+ }, {
35
+ readonly icon: JSX.Element;
36
+ readonly value: "image";
37
+ readonly key: "i";
34
38
  }];
35
- export declare const findShapeByKey: (key: string) => "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "text" | "arrow" | "freedraw" | null;
39
+ export declare const findShapeByKey: (key: string) => "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "text" | "arrow" | "freedraw" | null;
package/types/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement } from "./element/types";
2
+ import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, ImageId, ExcalidrawImageElement } from "./element/types";
3
3
  import { SHAPES } from "./shapes";
4
4
  import { Point as RoughPoint } from "roughjs/bin/geometry";
5
5
  import { LinearElementEditor } from "./element/linearElementEditor";
@@ -12,6 +12,7 @@ import { Language } from "./i18n";
12
12
  import { ClipboardData } from "./clipboard";
13
13
  import { isOverScrollBars } from "./scene";
14
14
  import { MaybeTransformHandleType } from "./element/transformHandles";
15
+ import Library from "./data/library";
15
16
  export declare type Point = Readonly<RoughPoint>;
16
17
  export declare type Collaborator = {
17
18
  pointer?: {
@@ -27,7 +28,16 @@ export declare type Collaborator = {
27
28
  stroke: string;
28
29
  };
29
30
  };
31
+ export declare type DataURL = string & {
32
+ _brand: "DataURL";
33
+ };
34
+ export declare type BinaryFileData = {
35
+ type: "image" | "other";
36
+ id: ImageId;
37
+ dataURL: DataURL;
38
+ };
30
39
  export declare type AppState = {
40
+ files: Record<ExcalidrawElement["id"], BinaryFileData>;
31
41
  isLoading: boolean;
32
42
  errorMessage: string | null;
33
43
  draggingElement: NonDeletedExcalidrawElement | null;
@@ -107,6 +117,8 @@ export declare type AppState = {
107
117
  shown: true;
108
118
  data: Spreadsheet;
109
119
  };
120
+ /** imageElement waiting to be placed on canvas */
121
+ pendingImageElement: NonDeleted<ExcalidrawImageElement> | null;
110
122
  };
111
123
  export declare type NormalizedZoomValue = number & {
112
124
  _brand: "normalizedZoom";
@@ -212,6 +224,15 @@ export declare type AppProps = ExcalidrawProps & {
212
224
  detectScroll: boolean;
213
225
  handleKeyboardGlobally: boolean;
214
226
  };
227
+ /** A subset of App class properties that we need to use elsewhere
228
+ * in the app, eg Manager. Factored out into a separate type to keep DRY. */
229
+ export declare type AppClassProperties = {
230
+ props: AppProps;
231
+ canvas: HTMLCanvasElement | null;
232
+ focusContainer(): void;
233
+ library: Library;
234
+ imageCache: Map<ImageId, HTMLImageElement>;
235
+ };
215
236
  export declare type PointerDownState = Readonly<{
216
237
  origin: Readonly<{
217
238
  x: number;
@@ -276,6 +297,7 @@ export declare type ExcalidrawImperativeAPI = {
276
297
  refresh: InstanceType<typeof App>["refresh"];
277
298
  importLibrary: InstanceType<typeof App>["importLibraryFromUrl"];
278
299
  setToastMessage: InstanceType<typeof App>["setToastMessage"];
300
+ setFiles: (data: AppState["files"][number][]) => void;
279
301
  readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
280
302
  ready: true;
281
303
  id: string;
package/types/zindex.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ExcalidrawElement } from "./element/types";
2
2
  import { AppState } from "./types";
3
- export declare const moveOneLeft: (elements: readonly ExcalidrawElement[], appState: AppState) => (import("./element/types").ExcalidrawLinearElement | import("./element/types").ExcalidrawSelectionElement | import("./element/types").ExcalidrawRectangleElement | import("./element/types").ExcalidrawDiamondElement | import("./element/types").ExcalidrawEllipseElement | import("./element/types").ExcalidrawTextElement | import("./element/types").ExcalidrawFreeDrawElement)[];
4
- export declare const moveOneRight: (elements: readonly ExcalidrawElement[], appState: AppState) => (import("./element/types").ExcalidrawLinearElement | import("./element/types").ExcalidrawSelectionElement | import("./element/types").ExcalidrawRectangleElement | import("./element/types").ExcalidrawDiamondElement | import("./element/types").ExcalidrawEllipseElement | import("./element/types").ExcalidrawTextElement | import("./element/types").ExcalidrawFreeDrawElement)[];
3
+ export declare const moveOneLeft: (elements: readonly ExcalidrawElement[], appState: AppState) => (import("./element/types").ExcalidrawLinearElement | import("./element/types").ExcalidrawSelectionElement | import("./element/types").ExcalidrawRectangleElement | import("./element/types").ExcalidrawDiamondElement | import("./element/types").ExcalidrawEllipseElement | import("./element/types").ExcalidrawImageElement | import("./element/types").ExcalidrawTextElement | import("./element/types").ExcalidrawFreeDrawElement)[];
4
+ export declare const moveOneRight: (elements: readonly ExcalidrawElement[], appState: AppState) => (import("./element/types").ExcalidrawLinearElement | import("./element/types").ExcalidrawSelectionElement | import("./element/types").ExcalidrawRectangleElement | import("./element/types").ExcalidrawDiamondElement | import("./element/types").ExcalidrawEllipseElement | import("./element/types").ExcalidrawImageElement | import("./element/types").ExcalidrawTextElement | import("./element/types").ExcalidrawFreeDrawElement)[];
5
5
  export declare const moveAllLeft: (elements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[];
6
6
  export declare const moveAllRight: (elements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[];