@zsviczian/excalidraw 0.11.0-obsidian-8 → 0.11.0-obsidian-9

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 (64) hide show
  1. package/dist/excalidraw.development.js +84 -73
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +3 -3
  4. package/types/actions/actionAddToLibrary.d.ts +18 -6
  5. package/types/actions/actionAlign.d.ts +18 -0
  6. package/types/actions/actionBoundText.d.ts +123 -0
  7. package/types/actions/actionCanvas.d.ts +72 -19
  8. package/types/actions/actionClipboard.d.ts +50 -10
  9. package/types/actions/actionDeleteSelected.d.ts +19 -6
  10. package/types/actions/actionDistribute.d.ts +6 -0
  11. package/types/actions/actionDuplicateSelection.d.ts +3 -0
  12. package/types/actions/actionExport.d.ts +71 -18
  13. package/types/actions/actionFinalize.d.ts +13 -6
  14. package/types/actions/actionFlip.d.ts +6 -0
  15. package/types/actions/actionGroup.d.ts +6 -0
  16. package/types/actions/actionMenu.d.ts +29 -6
  17. package/types/actions/actionNavigate.d.ts +3 -0
  18. package/types/actions/actionProperties.d.ts +82 -26
  19. package/types/actions/actionSelectAll.d.ts +3 -0
  20. package/types/actions/actionStyles.d.ts +11 -2
  21. package/types/actions/actionToggleGridMode.d.ts +9 -2
  22. package/types/actions/actionToggleLock.d.ts +17 -0
  23. package/types/actions/actionToggleStats.d.ts +8 -2
  24. package/types/actions/actionToggleViewMode.d.ts +9 -2
  25. package/types/actions/actionToggleZenMode.d.ts +9 -2
  26. package/types/actions/actionZindex.d.ts +12 -0
  27. package/types/actions/index.d.ts +3 -2
  28. package/types/actions/manager.d.ts +3 -3
  29. package/types/actions/shortcuts.d.ts +1 -1
  30. package/types/actions/types.d.ts +7 -9
  31. package/types/appState.d.ts +9 -4
  32. package/types/clipboard.d.ts +1 -1
  33. package/types/components/Actions.d.ts +4 -4
  34. package/types/components/App.d.ts +3 -2
  35. package/types/components/ImageExportDialog.d.ts +2 -2
  36. package/types/components/JSONExportDialog.d.ts +2 -2
  37. package/types/components/ToolButton.d.ts +3 -0
  38. package/types/constants.d.ts +1 -0
  39. package/types/createInverseContext.d.ts +20 -1
  40. package/types/data/index.d.ts +1 -1
  41. package/types/data/json.d.ts +1 -0
  42. package/types/data/restore.d.ts +1 -1
  43. package/types/element/Hyperlink.d.ts +9 -3
  44. package/types/element/dragElements.d.ts +1 -1
  45. package/types/element/linearElementEditor.d.ts +6 -3
  46. package/types/element/sizeHelpers.d.ts +2 -1
  47. package/types/element/textElement.d.ts +1 -2
  48. package/types/element/typeChecks.d.ts +5 -5
  49. package/types/element/types.d.ts +1 -0
  50. package/types/excalidraw-app/app_constants.d.ts +13 -1
  51. package/types/excalidraw-app/collab/CollabWrapper.d.ts +20 -8
  52. package/types/excalidraw-app/collab/Portal.d.ts +2 -2
  53. package/types/excalidraw-app/collab/reconciliation.d.ts +9 -0
  54. package/types/excalidraw-app/data/FileManager.d.ts +66 -0
  55. package/types/excalidraw-app/data/firebase.d.ts +11 -11
  56. package/types/excalidraw-app/data/index.d.ts +32 -27
  57. package/types/excalidraw-app/data/localStorage.d.ts +19 -19
  58. package/types/excalidraw-app/data/tabSync.d.ts +9 -0
  59. package/types/packages/excalidraw/index.d.ts +1 -1
  60. package/types/packages/utils.d.ts +1 -1
  61. package/types/scene/Scene.d.ts +1 -1
  62. package/types/shapes.d.ts +1 -1
  63. package/types/types.d.ts +10 -3
  64. package/types/utils.d.ts +3 -0
@@ -1,29 +1,24 @@
1
1
  import { ExcalidrawElement } from "../../element/types";
2
2
  import { AppState } from "../../types";
3
- export declare const STORAGE_KEYS: {
4
- LOCAL_STORAGE_ELEMENTS: string;
5
- LOCAL_STORAGE_APP_STATE: string;
6
- LOCAL_STORAGE_COLLAB: string;
7
- LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: string;
8
- };
9
3
  export declare const saveUsernameToLocalStorage: (username: string) => void;
10
4
  export declare const importUsernameFromLocalStorage: () => string | null;
11
5
  export declare const saveToLocalStorage: (elements: readonly ExcalidrawElement[], appState: AppState) => void;
12
6
  export declare const importFromLocalStorage: () => {
13
7
  elements: ExcalidrawElement[];
14
8
  appState: {
15
- theme: "light" | "dark";
9
+ elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
10
+ scrollX: number;
11
+ scrollY: number;
12
+ viewBackgroundColor: string;
16
13
  zoom: Readonly<{
17
14
  value: import("../../types").NormalizedZoomValue;
18
- translation: Readonly<{
19
- x: number;
20
- y: number;
21
- }>;
22
15
  }>;
23
- scrollX: number;
24
- scrollY: number;
25
- elementType: "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "text" | "arrow" | "freedraw";
16
+ shouldCacheIgnoreZoom: boolean;
17
+ theme: string;
18
+ name: string;
26
19
  elementLocked: boolean;
20
+ penMode: boolean;
21
+ penDetected: boolean;
27
22
  exportBackground: boolean;
28
23
  exportEmbedScene: boolean;
29
24
  exportWithDarkMode: boolean;
@@ -42,10 +37,8 @@ export declare const importFromLocalStorage: () => {
42
37
  currentItemStartArrowhead: import("../../element/types").Arrowhead | null;
43
38
  currentItemEndArrowhead: import("../../element/types").Arrowhead | null;
44
39
  currentItemLinearStrokeSharpness: import("../../element/types").StrokeSharpness;
45
- viewBackgroundColor: string;
46
40
  cursorButton: "up" | "down";
47
41
  scrolledOutside: boolean;
48
- name: string;
49
42
  openMenu: "canvas" | "shape" | null;
50
43
  lastPointerDownWith: import("../../element/types").PointerType;
51
44
  selectedElementIds: {
@@ -54,7 +47,6 @@ export declare const importFromLocalStorage: () => {
54
47
  previousSelectedElementIds: {
55
48
  [id: string]: boolean;
56
49
  };
57
- shouldCacheIgnoreZoom: boolean;
58
50
  zenModeEnabled: boolean;
59
51
  gridSize: number | null;
60
52
  selectedGroupIds: {
@@ -63,7 +55,6 @@ export declare const importFromLocalStorage: () => {
63
55
  editingGroupId: string | null;
64
56
  showStats: boolean;
65
57
  currentChartType: import("../../element/types").ChartType;
66
- files: Record<string, import("../../types").BinaryFileData>;
67
58
  isLoading: boolean;
68
59
  errorMessage: string | null;
69
60
  draggingElement: import("../../element/types").NonDeletedExcalidrawElement | null;
@@ -82,7 +73,7 @@ export declare const importFromLocalStorage: () => {
82
73
  toastMessage: string | null;
83
74
  viewModeEnabled: boolean;
84
75
  isLibraryOpen: boolean;
85
- fileHandle: import("@dwelle/browser-fs-access").FileSystemHandle | null;
76
+ fileHandle: import("browser-fs-access").FileSystemHandle | null;
86
77
  collaborators: Map<string, import("../../types").Collaborator>;
87
78
  pasteDialog: {
88
79
  shown: false;
@@ -92,7 +83,16 @@ export declare const importFromLocalStorage: () => {
92
83
  data: import("../../charts").Spreadsheet;
93
84
  };
94
85
  pendingImageElement: import("../../element/types").NonDeleted<import("../../element/types").ExcalidrawImageElement> | null;
86
+ showHyperlinkPopup: false | "info" | "editor";
87
+ linkOpacity: number;
88
+ trayModeEnabled: boolean;
89
+ colorPalette: {
90
+ canvasBackground?: string[] | undefined;
91
+ elementBackground?: string[] | undefined;
92
+ elementStroke?: string[] | undefined;
93
+ };
95
94
  } | null;
96
95
  };
97
96
  export declare const getElementsStorageSize: () => number;
98
97
  export declare const getTotalStorageSize: () => number;
98
+ export declare const getLibraryItemsFromStorage: () => any;
@@ -0,0 +1,9 @@
1
+ declare const LOCAL_STATE_VERSIONS: {
2
+ "version-dataState": number;
3
+ "version-files": number;
4
+ };
5
+ declare type BrowserStateTypes = keyof typeof LOCAL_STATE_VERSIONS;
6
+ export declare const isBrowserStorageStateNewer: (type: BrowserStateTypes) => boolean;
7
+ export declare const updateBrowserStateVersion: (type: BrowserStateTypes) => void;
8
+ export declare const resetBrowserStateVersions: () => void;
9
+ export {};
@@ -9,7 +9,7 @@ export default _default;
9
9
  export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
10
10
  export { defaultLang, languages } from "../../i18n";
11
11
  export { restore, restoreAppState, restoreElements } from "../../data/restore";
12
- export { exportToCanvas, exportToBlob, exportToSvg, serializeAsJSON, loadLibraryFromBlob, loadFromBlob, getFreeDrawSvgPath, getCommonBoundingBox, //zsviczian
12
+ export { exportToCanvas, exportToBlob, exportToSvg, serializeAsJSON, serializeLibraryAsJSON, loadLibraryFromBlob, loadFromBlob, getFreeDrawSvgPath, getCommonBoundingBox, //zsviczian
13
13
  getMaximumGroups, //zsviczian
14
14
  intersectElementWithLine, //zsviczian
15
15
  determineFocusDistance, //zsviczian
@@ -19,7 +19,7 @@ export declare const exportToBlob: (opts: ExportOpts & {
19
19
  export declare const exportToSvg: ({ elements, appState, files, exportPadding, }: Omit<ExportOpts, "getDimensions"> & {
20
20
  exportPadding?: number | undefined;
21
21
  }) => Promise<SVGSVGElement>;
22
- export { serializeAsJSON } from "../data/json";
22
+ export { serializeAsJSON, serializeLibraryAsJSON } from "../data/json";
23
23
  export { loadFromBlob, loadLibraryFromBlob } from "../data/blob";
24
24
  export { getFreeDrawSvgPath } from "../renderer/renderElement";
25
25
  export { getCommonBoundingBox } from "../element/bounds";
@@ -15,7 +15,7 @@ declare class Scene {
15
15
  private elementsMap;
16
16
  getElementsIncludingDeleted(): readonly ExcalidrawElement[];
17
17
  getElements(): readonly NonDeletedExcalidrawElement[];
18
- getElement(id: ExcalidrawElement["id"]): ExcalidrawElement | null;
18
+ getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
19
19
  getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
20
20
  getNonDeletedElements(ids: readonly ExcalidrawElement["id"][]): NonDeleted<ExcalidrawElement>[];
21
21
  replaceAllElements(nextElements: readonly ExcalidrawElement[]): void;
package/types/shapes.d.ts CHANGED
@@ -14,7 +14,7 @@ export declare const SHAPES: readonly [{
14
14
  }, {
15
15
  readonly icon: JSX.Element;
16
16
  readonly value: "ellipse";
17
- readonly key: "e";
17
+ readonly key: "o";
18
18
  }, {
19
19
  readonly icon: JSX.Element;
20
20
  readonly value: "arrow";
package/types/types.d.ts CHANGED
@@ -53,8 +53,11 @@ export declare type AppState = {
53
53
  suggestedBindings: SuggestedBinding[];
54
54
  editingElement: NonDeletedExcalidrawElement | null;
55
55
  editingLinearElement: LinearElementEditor | null;
56
- elementType: typeof SHAPES[number]["value"] | "eraser";
57
- elementLocked: boolean;
56
+ activeTool: {
57
+ type: typeof SHAPES[number]["value"] | "eraser";
58
+ lastActiveToolBeforeEraser: typeof SHAPES[number]["value"] | null;
59
+ locked: boolean;
60
+ };
58
61
  penMode: boolean;
59
62
  penDetected: boolean;
60
63
  exportBackground: boolean;
@@ -268,6 +271,7 @@ export declare type AppClassProperties = {
268
271
  mimeType: typeof ALLOWED_IMAGE_MIME_TYPES[number];
269
272
  }>;
270
273
  files: BinaryFiles;
274
+ deviceType: App["deviceType"];
271
275
  };
272
276
  export declare type PointerDownState = Readonly<{
273
277
  origin: Readonly<{
@@ -323,7 +327,10 @@ export declare type PointerDownState = Readonly<{
323
327
  hasOccurred: boolean;
324
328
  };
325
329
  elementIdsToErase: {
326
- [key: ExcalidrawElement["id"]]: boolean;
330
+ [key: ExcalidrawElement["id"]]: {
331
+ opacity: ExcalidrawElement["opacity"];
332
+ erase: boolean;
333
+ };
327
334
  };
328
335
  }>;
329
336
  export declare type ExcalidrawImperativeAPI = {
package/types/utils.d.ts CHANGED
@@ -118,3 +118,6 @@ export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) =
118
118
  nativeEvent: T;
119
119
  }>;
120
120
  export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
121
+ export declare const isPrimitive: (val: any) => boolean;
122
+ export declare const getFrame: () => "top" | "iframe";
123
+ export declare const isPromiseLike: (value: any) => value is Promise<any>;