@zsviczian/excalidraw 0.15.2-obsidian-8 → 0.15.2-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 (39) hide show
  1. package/dist/excalidraw.development.js +33 -33
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +1 -1
  4. package/types/actions/actionAddToLibrary.d.ts +3 -3
  5. package/types/actions/actionAlign.d.ts +19 -19
  6. package/types/actions/actionBoundText.d.ts +8 -8
  7. package/types/actions/actionCanvas.d.ts +24 -24
  8. package/types/actions/actionClipboard.d.ts +7 -7
  9. package/types/actions/actionDeleteSelected.d.ts +3 -3
  10. package/types/actions/actionDistribute.d.ts +5 -5
  11. package/types/actions/actionElementLock.d.ts +7 -7
  12. package/types/actions/actionExport.d.ts +10 -9
  13. package/types/actions/actionFinalize.d.ts +3 -6
  14. package/types/actions/actionFlip.d.ts +2 -2
  15. package/types/actions/actionFrame.d.ts +9 -9
  16. package/types/actions/actionGroup.d.ts +5 -5
  17. package/types/actions/actionLinearEditor.d.ts +3 -3
  18. package/types/actions/actionMenu.d.ts +3 -3
  19. package/types/actions/actionProperties.d.ts +13 -13
  20. package/types/actions/actionStyles.d.ts +1 -1
  21. package/types/actions/actionToggleGridMode.d.ts +1 -1
  22. package/types/actions/actionToggleStats.d.ts +1 -1
  23. package/types/actions/actionToggleViewMode.d.ts +1 -1
  24. package/types/actions/actionToggleZenMode.d.ts +1 -1
  25. package/types/actions/types.d.ts +3 -2
  26. package/types/appState.d.ts +1 -1
  27. package/types/components/HintViewer.d.ts +3 -4
  28. package/types/components/LayerUI.d.ts +2 -1
  29. package/types/components/MobileMenu.d.ts +3 -2
  30. package/types/constants.d.ts +2 -2
  31. package/types/data/url.d.ts +5 -0
  32. package/types/element/Hyperlink.d.ts +1 -1
  33. package/types/element/embeddable.d.ts +13 -8
  34. package/types/element/linearElementEditor.d.ts +1 -1
  35. package/types/frame.d.ts +2 -2
  36. package/types/groups.d.ts +3 -3
  37. package/types/scene/Scene.d.ts +13 -0
  38. package/types/types.d.ts +1 -1
  39. package/types/utility-types.d.ts +2 -0
@@ -100,7 +100,7 @@ export declare const actionFinalize: {
100
100
  duration?: number | undefined;
101
101
  } | null;
102
102
  zenModeEnabled: boolean;
103
- theme: string;
103
+ theme: import("../element/types").Theme;
104
104
  gridSize: number | null;
105
105
  previousGridSize: number | null;
106
106
  viewModeEnabled: boolean;
@@ -163,6 +163,7 @@ export declare const actionFinalize: {
163
163
  type: "custom";
164
164
  customType: string;
165
165
  });
166
+ activeEmbeddable: null;
166
167
  draggingElement: null;
167
168
  multiElement: null;
168
169
  editingElement: null;
@@ -181,10 +182,6 @@ export declare const actionFinalize: {
181
182
  showWelcomeScreen: boolean;
182
183
  isLoading: boolean;
183
184
  errorMessage: import("react").ReactNode;
184
- activeEmbeddable: {
185
- element: import("../element/types").NonDeletedExcalidrawElement;
186
- state: "active" | "hover";
187
- } | null;
188
185
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
189
186
  selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
190
187
  isBindingEnabled: boolean;
@@ -247,7 +244,7 @@ export declare const actionFinalize: {
247
244
  duration?: number | undefined;
248
245
  } | null;
249
246
  zenModeEnabled: boolean;
250
- theme: string;
247
+ theme: import("../element/types").Theme;
251
248
  gridSize: number | null;
252
249
  previousGridSize: number | null;
253
250
  viewModeEnabled: boolean;
@@ -6,7 +6,7 @@ export declare const actionFlipHorizontal: {
6
6
  trackEvent: {
7
7
  category: "element";
8
8
  };
9
- perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => {
9
+ perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
10
10
  elements: import("../scene/Scene").ExcalidrawElementsIncludingDeleted;
11
11
  appState: Readonly<AppState>;
12
12
  commitToHistory: true;
@@ -21,7 +21,7 @@ export declare const actionFlipVertical: {
21
21
  trackEvent: {
22
22
  category: "element";
23
23
  };
24
- perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => {
24
+ perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
25
25
  elements: import("../scene/Scene").ExcalidrawElementsIncludingDeleted;
26
26
  appState: Readonly<AppState>;
27
27
  commitToHistory: true;
@@ -1,18 +1,18 @@
1
1
  /// <reference types="react" />
2
2
  import { ExcalidrawElement } from "../element/types";
3
- import { AppState } from "../types";
3
+ import { AppClassProperties, AppState } from "../types";
4
4
  export declare const actionSelectAllElementsInFrame: {
5
5
  name: "selectAllElementsInFrame";
6
6
  trackEvent: {
7
7
  category: "canvas";
8
8
  };
9
- perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => {
9
+ perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, _: any, app: AppClassProperties) => {
10
10
  elements: readonly ExcalidrawElement[];
11
11
  appState: Readonly<AppState>;
12
12
  commitToHistory: false;
13
13
  };
14
14
  contextItemLabel: string;
15
- predicate: (elements: readonly ExcalidrawElement[], appState: AppState) => boolean;
15
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: AppClassProperties) => boolean;
16
16
  } & {
17
17
  keyTest?: undefined;
18
18
  };
@@ -21,7 +21,7 @@ export declare const actionRemoveAllElementsFromFrame: {
21
21
  trackEvent: {
22
22
  category: "history";
23
23
  };
24
- perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => {
24
+ perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, _: any, app: AppClassProperties) => {
25
25
  elements: ExcalidrawElement[];
26
26
  appState: {
27
27
  selectedElementIds: {
@@ -117,7 +117,7 @@ export declare const actionRemoveAllElementsFromFrame: {
117
117
  duration?: number | undefined;
118
118
  } | null;
119
119
  zenModeEnabled: boolean;
120
- theme: string;
120
+ theme: import("../element/types").Theme;
121
121
  gridSize: number | null;
122
122
  previousGridSize: number | null;
123
123
  viewModeEnabled: boolean;
@@ -172,7 +172,7 @@ export declare const actionRemoveAllElementsFromFrame: {
172
172
  commitToHistory: false;
173
173
  };
174
174
  contextItemLabel: string;
175
- predicate: (elements: readonly ExcalidrawElement[], appState: AppState) => boolean;
175
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: AppClassProperties) => boolean;
176
176
  } & {
177
177
  keyTest?: undefined;
178
178
  };
@@ -278,7 +278,7 @@ export declare const actionupdateFrameRendering: {
278
278
  duration?: number | undefined;
279
279
  } | null;
280
280
  zenModeEnabled: boolean;
281
- theme: string;
281
+ theme: import("../element/types").Theme;
282
282
  gridSize: number | null;
283
283
  previousGridSize: number | null;
284
284
  viewModeEnabled: boolean;
@@ -338,7 +338,7 @@ export declare const actionSetFrameAsActiveTool: {
338
338
  trackEvent: {
339
339
  category: "toolbar";
340
340
  };
341
- perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
341
+ perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, _: any, app: AppClassProperties) => {
342
342
  elements: readonly ExcalidrawElement[];
343
343
  appState: {
344
344
  activeTool: {
@@ -434,7 +434,7 @@ export declare const actionSetFrameAsActiveTool: {
434
434
  duration?: number | undefined;
435
435
  } | null;
436
436
  zenModeEnabled: boolean;
437
- theme: string;
437
+ theme: import("../element/types").Theme;
438
438
  gridSize: number | null;
439
439
  previousGridSize: number | null;
440
440
  viewModeEnabled: boolean;
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { ExcalidrawElement } from "../element/types";
3
- import { AppState } from "../types";
3
+ import { AppClassProperties, AppState } from "../types";
4
4
  export declare const actionGroup: {
5
5
  name: "group";
6
6
  trackEvent: {
7
7
  category: "element";
8
8
  };
9
- perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
9
+ perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, _: any, app: AppClassProperties) => {
10
10
  appState: Readonly<AppState>;
11
11
  elements: readonly ExcalidrawElement[];
12
12
  commitToHistory: false;
@@ -16,9 +16,9 @@ export declare const actionGroup: {
16
16
  commitToHistory: true;
17
17
  };
18
18
  contextItemLabel: string;
19
- predicate: (elements: readonly ExcalidrawElement[], appState: AppState) => boolean;
19
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: AppClassProperties) => boolean;
20
20
  keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
21
- PanelComponent: ({ elements, appState, updateData }: import("./types").PanelComponentProps) => JSX.Element;
21
+ PanelComponent: ({ elements, appState, updateData, app }: import("./types").PanelComponentProps) => JSX.Element;
22
22
  } & {
23
23
  keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
24
24
  };
@@ -27,7 +27,7 @@ export declare const actionUngroup: {
27
27
  trackEvent: {
28
28
  category: "element";
29
29
  };
30
- perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
30
+ perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, _: any, app: AppClassProperties) => {
31
31
  appState: Readonly<AppState>;
32
32
  elements: readonly ExcalidrawElement[];
33
33
  commitToHistory: false;
@@ -6,7 +6,7 @@ export declare const actionToggleLinearEditor: {
6
6
  trackEvent: {
7
7
  category: "element";
8
8
  };
9
- predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState) => boolean;
9
+ predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, _: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
10
10
  perform(elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties): {
11
11
  appState: {
12
12
  editingLinearElement: LinearElementEditor | null;
@@ -102,7 +102,7 @@ export declare const actionToggleLinearEditor: {
102
102
  duration?: number | undefined;
103
103
  } | null;
104
104
  zenModeEnabled: boolean;
105
- theme: string;
105
+ theme: import("../element/types").Theme;
106
106
  gridSize: number | null;
107
107
  previousGridSize: number | null;
108
108
  viewModeEnabled: boolean;
@@ -152,7 +152,7 @@ export declare const actionToggleLinearEditor: {
152
152
  };
153
153
  commitToHistory: false;
154
154
  };
155
- contextItemLabel: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => "labels.lineEditor.exit" | "labels.lineEditor.edit";
155
+ contextItemLabel: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, app: import("../types").AppClassProperties) => "labels.lineEditor.exit" | "labels.lineEditor.edit";
156
156
  } & {
157
157
  keyTest?: undefined;
158
158
  };
@@ -99,7 +99,7 @@ export declare const actionToggleCanvasMenu: {
99
99
  duration?: number | undefined;
100
100
  } | null;
101
101
  zenModeEnabled: boolean;
102
- theme: string;
102
+ theme: import("../element/types").Theme;
103
103
  gridSize: number | null;
104
104
  previousGridSize: number | null;
105
105
  viewModeEnabled: boolean;
@@ -253,7 +253,7 @@ export declare const actionToggleEditMenu: {
253
253
  duration?: number | undefined;
254
254
  } | null;
255
255
  zenModeEnabled: boolean;
256
- theme: string;
256
+ theme: import("../element/types").Theme;
257
257
  gridSize: number | null;
258
258
  previousGridSize: number | null;
259
259
  viewModeEnabled: boolean;
@@ -423,7 +423,7 @@ export declare const actionShortcuts: {
423
423
  duration?: number | undefined;
424
424
  } | null;
425
425
  zenModeEnabled: boolean;
426
- theme: string;
426
+ theme: import("../element/types").Theme;
427
427
  gridSize: number | null;
428
428
  previousGridSize: number | null;
429
429
  viewModeEnabled: boolean;
@@ -116,7 +116,7 @@ export declare const actionChangeFillStyle: {
116
116
  duration?: number | undefined;
117
117
  } | null;
118
118
  zenModeEnabled: boolean;
119
- theme: string;
119
+ theme: import("../element/types").Theme;
120
120
  gridSize: number | null;
121
121
  previousGridSize: number | null;
122
122
  viewModeEnabled: boolean;
@@ -269,7 +269,7 @@ export declare const actionChangeStrokeWidth: {
269
269
  duration?: number | undefined;
270
270
  } | null;
271
271
  zenModeEnabled: boolean;
272
- theme: string;
272
+ theme: import("../element/types").Theme;
273
273
  gridSize: number | null;
274
274
  previousGridSize: number | null;
275
275
  viewModeEnabled: boolean;
@@ -422,7 +422,7 @@ export declare const actionChangeSloppiness: {
422
422
  duration?: number | undefined;
423
423
  } | null;
424
424
  zenModeEnabled: boolean;
425
- theme: string;
425
+ theme: import("../element/types").Theme;
426
426
  gridSize: number | null;
427
427
  previousGridSize: number | null;
428
428
  viewModeEnabled: boolean;
@@ -575,7 +575,7 @@ export declare const actionChangeStrokeStyle: {
575
575
  duration?: number | undefined;
576
576
  } | null;
577
577
  zenModeEnabled: boolean;
578
- theme: string;
578
+ theme: import("../element/types").Theme;
579
579
  gridSize: number | null;
580
580
  previousGridSize: number | null;
581
581
  viewModeEnabled: boolean;
@@ -728,7 +728,7 @@ export declare const actionChangeOpacity: {
728
728
  duration?: number | undefined;
729
729
  } | null;
730
730
  zenModeEnabled: boolean;
731
- theme: string;
731
+ theme: import("../element/types").Theme;
732
732
  gridSize: number | null;
733
733
  previousGridSize: number | null;
734
734
  viewModeEnabled: boolean;
@@ -881,7 +881,7 @@ export declare const actionChangeFontSize: {
881
881
  duration?: number | undefined;
882
882
  } | null;
883
883
  zenModeEnabled: boolean;
884
- theme: string;
884
+ theme: import("../element/types").Theme;
885
885
  gridSize: number | null;
886
886
  previousGridSize: number | null;
887
887
  viewModeEnabled: boolean;
@@ -1034,7 +1034,7 @@ export declare const actionDecreaseFontSize: {
1034
1034
  duration?: number | undefined;
1035
1035
  } | null;
1036
1036
  zenModeEnabled: boolean;
1037
- theme: string;
1037
+ theme: import("../element/types").Theme;
1038
1038
  gridSize: number | null;
1039
1039
  previousGridSize: number | null;
1040
1040
  viewModeEnabled: boolean;
@@ -1187,7 +1187,7 @@ export declare const actionIncreaseFontSize: {
1187
1187
  duration?: number | undefined;
1188
1188
  } | null;
1189
1189
  zenModeEnabled: boolean;
1190
- theme: string;
1190
+ theme: import("../element/types").Theme;
1191
1191
  gridSize: number | null;
1192
1192
  previousGridSize: number | null;
1193
1193
  viewModeEnabled: boolean;
@@ -1340,7 +1340,7 @@ export declare const actionChangeFontFamily: {
1340
1340
  duration?: number | undefined;
1341
1341
  } | null;
1342
1342
  zenModeEnabled: boolean;
1343
- theme: string;
1343
+ theme: import("../element/types").Theme;
1344
1344
  gridSize: number | null;
1345
1345
  previousGridSize: number | null;
1346
1346
  viewModeEnabled: boolean;
@@ -1493,7 +1493,7 @@ export declare const actionChangeTextAlign: {
1493
1493
  duration?: number | undefined;
1494
1494
  } | null;
1495
1495
  zenModeEnabled: boolean;
1496
- theme: string;
1496
+ theme: import("../element/types").Theme;
1497
1497
  gridSize: number | null;
1498
1498
  previousGridSize: number | null;
1499
1499
  viewModeEnabled: boolean;
@@ -1648,7 +1648,7 @@ export declare const actionChangeVerticalAlign: {
1648
1648
  duration?: number | undefined;
1649
1649
  } | null;
1650
1650
  zenModeEnabled: boolean;
1651
- theme: string;
1651
+ theme: import("../element/types").Theme;
1652
1652
  gridSize: number | null;
1653
1653
  previousGridSize: number | null;
1654
1654
  viewModeEnabled: boolean;
@@ -1801,7 +1801,7 @@ export declare const actionChangeRoundness: {
1801
1801
  duration?: number | undefined;
1802
1802
  } | null;
1803
1803
  zenModeEnabled: boolean;
1804
- theme: string;
1804
+ theme: import("../element/types").Theme;
1805
1805
  gridSize: number | null;
1806
1806
  previousGridSize: number | null;
1807
1807
  viewModeEnabled: boolean;
@@ -1957,7 +1957,7 @@ export declare const actionChangeArrowhead: {
1957
1957
  duration?: number | undefined;
1958
1958
  } | null;
1959
1959
  zenModeEnabled: boolean;
1960
- theme: string;
1960
+ theme: import("../element/types").Theme;
1961
1961
  gridSize: number | null;
1962
1962
  previousGridSize: number | null;
1963
1963
  viewModeEnabled: boolean;
@@ -98,7 +98,7 @@ export declare const actionCopyStyles: {
98
98
  selectedElementsAreBeingDragged: boolean;
99
99
  shouldCacheIgnoreZoom: boolean;
100
100
  zenModeEnabled: boolean;
101
- theme: string;
101
+ theme: import("../element/types").Theme;
102
102
  gridSize: number | null;
103
103
  previousGridSize: number | null;
104
104
  viewModeEnabled: boolean;
@@ -103,7 +103,7 @@ export declare const actionToggleGridMode: {
103
103
  duration?: number | undefined;
104
104
  } | null;
105
105
  zenModeEnabled: boolean;
106
- theme: string;
106
+ theme: import("../element/types").Theme;
107
107
  previousGridSize: number | null;
108
108
  viewModeEnabled: boolean;
109
109
  selectedGroupIds: {
@@ -101,7 +101,7 @@ export declare const actionToggleStats: {
101
101
  duration?: number | undefined;
102
102
  } | null;
103
103
  zenModeEnabled: boolean;
104
- theme: string;
104
+ theme: import("../element/types").Theme;
105
105
  gridSize: number | null;
106
106
  previousGridSize: number | null;
107
107
  viewModeEnabled: boolean;
@@ -102,7 +102,7 @@ export declare const actionToggleViewMode: {
102
102
  duration?: number | undefined;
103
103
  } | null;
104
104
  zenModeEnabled: boolean;
105
- theme: string;
105
+ theme: import("../element/types").Theme;
106
106
  gridSize: number | null;
107
107
  previousGridSize: number | null;
108
108
  selectedGroupIds: {
@@ -101,7 +101,7 @@ export declare const actionToggleZenMode: {
101
101
  closable?: boolean | undefined;
102
102
  duration?: number | undefined;
103
103
  } | null;
104
- theme: string;
104
+ theme: import("../element/types").Theme;
105
105
  gridSize: number | null;
106
106
  previousGridSize: number | null;
107
107
  viewModeEnabled: boolean;
@@ -22,14 +22,15 @@ export type PanelComponentProps = {
22
22
  updateData: (formData?: any) => void;
23
23
  appProps: ExcalidrawProps;
24
24
  data?: Record<string, any>;
25
+ app: AppClassProperties;
25
26
  };
26
27
  export interface Action {
27
28
  name: ActionName;
28
29
  PanelComponent?: React.FC<PanelComponentProps>;
29
30
  perform: ActionFn;
30
31
  keyPriority?: number;
31
- keyTest?: (event: React.KeyboardEvent | KeyboardEvent, appState: AppState, elements: readonly ExcalidrawElement[]) => boolean;
32
- contextItemLabel?: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => string);
32
+ keyTest?: (event: React.KeyboardEvent | KeyboardEvent, appState: AppState, elements: readonly ExcalidrawElement[], app: AppClassProperties) => boolean;
33
+ contextItemLabel?: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, app: AppClassProperties) => string);
33
34
  predicate?: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: ExcalidrawProps, app: AppClassProperties) => boolean;
34
35
  checked?: (appState: Readonly<AppState>) => boolean;
35
36
  trackEvent: false | {
@@ -1,7 +1,7 @@
1
1
  import { AppState, NormalizedZoomValue } from "./types";
2
2
  export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
3
3
  export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
4
- theme?: string | undefined;
4
+ theme?: import("./element/types").Theme | undefined;
5
5
  name?: string | undefined;
6
6
  activeTool?: ({
7
7
  lastActiveTool: import("./types").LastActiveTool;
@@ -1,11 +1,10 @@
1
- import { NonDeletedExcalidrawElement } from "../element/types";
2
- import { Device, UIAppState } from "../types";
1
+ import { AppClassProperties, Device, UIAppState } from "../types";
3
2
  import "./HintViewer.scss";
4
3
  interface HintViewerProps {
5
4
  appState: UIAppState;
6
- elements: readonly NonDeletedExcalidrawElement[];
7
5
  isMobile: boolean;
8
6
  device: Device;
7
+ app: AppClassProperties;
9
8
  }
10
- export declare const HintViewer: ({ appState, elements, isMobile, device, }: HintViewerProps) => JSX.Element | null;
9
+ export declare const HintViewer: ({ appState, isMobile, device, app, }: HintViewerProps) => JSX.Element | null;
11
10
  export {};
@@ -26,6 +26,7 @@ interface LayerUIProps {
26
26
  onExportImage: AppClassProperties["onExportImage"];
27
27
  renderWelcomeScreen: boolean;
28
28
  children?: React.ReactNode;
29
+ app: AppClassProperties;
29
30
  }
30
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, onExportImage, renderWelcomeScreen, children, }: LayerUIProps) => JSX.Element>;
31
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, onExportImage, renderWelcomeScreen, children, app, }: LayerUIProps) => JSX.Element>;
31
32
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { AppState, Device, ExcalidrawProps, UIAppState } from "../types";
2
+ import { AppClassProperties, AppState, Device, ExcalidrawProps, UIAppState } from "../types";
3
3
  import { ActionManager } from "../actions/manager";
4
4
  import { NonDeletedExcalidrawElement } from "../element/types";
5
5
  type MobileMenuProps = {
@@ -21,6 +21,7 @@ type MobileMenuProps = {
21
21
  renderSidebars: () => JSX.Element | null;
22
22
  device: Device;
23
23
  renderWelcomeScreen: boolean;
24
+ app: AppClassProperties;
24
25
  };
25
- export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, canvas, onImageAction, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, }: MobileMenuProps) => JSX.Element;
26
+ export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, canvas, onImageAction, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, app, }: MobileMenuProps) => JSX.Element;
26
27
  export {};
@@ -84,8 +84,8 @@ export declare const FONT_FAMILY: {
84
84
  LocalFont: number;
85
85
  };
86
86
  export declare const THEME: {
87
- LIGHT: string;
88
- DARK: string;
87
+ readonly LIGHT: "light";
88
+ readonly DARK: "dark";
89
89
  };
90
90
  export declare const FRAME_STYLE: {
91
91
  strokeColor: string;
@@ -1,2 +1,7 @@
1
1
  export declare const normalizeLink: (link: string) => string;
2
2
  export declare const isLocalLink: (link: string | null) => boolean;
3
+ /**
4
+ * Returns URL sanitized and safe for usage in places such as
5
+ * iframe's src attribute or <a> href attributes.
6
+ */
7
+ export declare const toValidURL: (link: string) => string;
@@ -113,7 +113,7 @@ export declare const actionLink: {
113
113
  duration?: number | undefined;
114
114
  } | null;
115
115
  zenModeEnabled: boolean;
116
- theme: string;
116
+ theme: import("./types").Theme;
117
117
  gridSize: number | null;
118
118
  previousGridSize: number | null;
119
119
  viewModeEnabled: boolean;
@@ -1,15 +1,20 @@
1
1
  /// <reference types="react" />
2
2
  import { ExcalidrawProps } from "../types";
3
- import { ExcalidrawElement, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement } from "./types";
4
- type EmbeddedLink = {
5
- link: string;
3
+ import { ExcalidrawElement, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement, Theme } from "./types";
4
+ type EmbeddedLink = ({
6
5
  aspectRatio: {
7
6
  w: number;
8
7
  h: number;
9
8
  };
9
+ warning?: string;
10
+ } & ({
10
11
  type: "video" | "generic";
11
- } | null;
12
- export declare const getEmbedLink: (link?: string | null) => EmbeddedLink;
12
+ link: string;
13
+ } | {
14
+ type: "document";
15
+ srcdoc: (theme: Theme) => string;
16
+ })) | null;
17
+ export declare const getEmbedLink: (link: string | null | undefined) => EmbeddedLink;
13
18
  export declare const isEmbeddableOrFrameLabel: (element: NonDeletedExcalidrawElement) => Boolean;
14
19
  export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawEmbeddableElement) => ExcalidrawElement;
15
20
  export declare const actionSetEmbeddableAsActiveTool: {
@@ -113,7 +118,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
113
118
  duration?: number | undefined;
114
119
  } | null;
115
120
  zenModeEnabled: boolean;
116
- theme: string;
121
+ theme: Theme;
117
122
  gridSize: number | null;
118
123
  previousGridSize: number | null;
119
124
  viewModeEnabled: boolean;
@@ -163,9 +168,9 @@ export declare const actionSetEmbeddableAsActiveTool: {
163
168
  };
164
169
  commitToHistory: false;
165
170
  };
166
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
167
171
  } & {
168
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
172
+ keyTest?: undefined;
169
173
  };
174
+ export declare const extractSrc: (htmlString: string) => string;
170
175
  export declare const embeddableURLValidator: (url: string | null | undefined, validateEmbeddable: ExcalidrawProps["validateEmbeddable"]) => boolean;
171
176
  export {};
@@ -215,7 +215,7 @@ export declare class LinearElementEditor {
215
215
  duration?: number | undefined;
216
216
  } | null;
217
217
  zenModeEnabled: boolean;
218
- theme: string;
218
+ theme: import("./types").Theme;
219
219
  gridSize: number | null;
220
220
  previousGridSize: number | null;
221
221
  viewModeEnabled: boolean;
package/types/frame.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ExcalidrawElement, ExcalidrawFrameElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
2
- import { AppState } from "./types";
2
+ import { AppClassProperties, AppState } from "./types";
3
3
  import { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
4
4
  export declare const bindElementsToFramesAfterDuplication: (nextElements: ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
5
5
  export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
@@ -26,7 +26,7 @@ export declare const removeElementsFromFrame: (allElements: ExcalidrawElementsIn
26
26
  export declare const removeAllElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
27
27
  export declare const replaceAllElementsInFrame: (allElements: ExcalidrawElementsIncludingDeleted, nextElementsInFrame: ExcalidrawElement[], frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
28
28
  /** does not mutate elements, but return new ones */
29
- export declare const updateFrameMembershipOfSelectedElements: (allElements: ExcalidrawElementsIncludingDeleted, appState: AppState) => ExcalidrawElementsIncludingDeleted;
29
+ export declare const updateFrameMembershipOfSelectedElements: (allElements: ExcalidrawElementsIncludingDeleted, appState: AppState, app: AppClassProperties) => ExcalidrawElementsIncludingDeleted;
30
30
  /**
31
31
  * filters out elements that are inside groups that contain a frame element
32
32
  * anywhere in the group tree
package/types/groups.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { GroupId, ExcalidrawElement, NonDeleted } from "./element/types";
2
- import { AppState } from "./types";
1
+ import { GroupId, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
2
+ import { AppClassProperties, AppState } from "./types";
3
3
  export declare const selectGroup: (groupId: GroupId, appState: AppState, elements: readonly NonDeleted<ExcalidrawElement>[]) => AppState;
4
4
  /**
5
5
  * If the element's group is selected, don't render an individual
@@ -12,7 +12,7 @@ export declare const getSelectedGroupIds: (appState: AppState) => GroupId[];
12
12
  * When you select an element, you often want to actually select the whole group it's in, unless
13
13
  * you're currently editing that group.
14
14
  */
15
- export declare const selectGroupsForSelectedElements: (appState: AppState, elements: readonly NonDeleted<ExcalidrawElement>[], prevAppState: AppState) => AppState;
15
+ export declare const selectGroupsForSelectedElements: (appState: AppState, elements: readonly NonDeletedExcalidrawElement[], prevAppState: AppState, app: AppClassProperties | null) => AppState;
16
16
  export declare const selectGroupsFromGivenElements: (elements: readonly NonDeleted<ExcalidrawElement>[], appState: AppState) => {
17
17
  [groupId: string]: boolean;
18
18
  };
@@ -1,5 +1,6 @@
1
1
  import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameElement } from "../element/types";
2
2
  import { LinearElementEditor } from "../element/linearElementEditor";
3
+ import { AppState } from "../types";
3
4
  type ElementIdKey = InstanceType<typeof LinearElementEditor>["elementId"];
4
5
  type ElementKey = ExcalidrawElement | ElementIdKey;
5
6
  type SceneStateCallback = () => void;
@@ -16,9 +17,21 @@ declare class Scene {
16
17
  private nonDeletedFrames;
17
18
  private frames;
18
19
  private elementsMap;
20
+ private selectedElementsCache;
19
21
  getElementsIncludingDeleted(): readonly ExcalidrawElement[];
20
22
  getNonDeletedElements(): readonly NonDeletedExcalidrawElement[];
21
23
  getFramesIncludingDeleted(): readonly ExcalidrawFrameElement[];
24
+ getSelectedElements(opts: {
25
+ selectedElementIds: AppState["selectedElementIds"];
26
+ /**
27
+ * for specific cases where you need to use elements not from current
28
+ * scene state. This in effect will likely result in cache-miss, and
29
+ * the cache won't be updated in this case.
30
+ */
31
+ elements?: readonly ExcalidrawElement[];
32
+ includeBoundTextElement?: boolean;
33
+ includeElementsInFrames?: boolean;
34
+ }): NonDeleted<ExcalidrawElement>[];
22
35
  getNonDeletedFrames(): readonly NonDeleted<ExcalidrawFrameElement>[];
23
36
  getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
24
37
  getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
package/types/types.d.ts CHANGED
@@ -311,7 +311,7 @@ export interface ExcalidrawProps {
311
311
  onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
312
312
  onScrollChange?: (scrollX: number, scrollY: number) => void;
313
313
  children?: React.ReactNode;
314
- validateEmbeddable?: boolean | RegExp | RegExp[] | ((link: string) => boolean | undefined);
314
+ validateEmbeddable?: boolean | string[] | RegExp | RegExp[] | ((link: string) => boolean | undefined);
315
315
  renderEmbeddable?: (element: NonDeleted<ExcalidrawEmbeddableElement>, appState: AppState) => JSX.Element | null;
316
316
  renderWebview?: boolean;
317
317
  renderEmbeddableMenu?: (//zsivzian
@@ -20,3 +20,5 @@ export type SignatureType<T> = T extends (...args: infer R) => any ? R : never;
20
20
  export type CallableType<T extends (...args: any[]) => any> = (...args: SignatureType<T>) => ReturnType<T>;
21
21
  export type ForwardRef<T, P = any> = Parameters<CallableType<React.ForwardRefRenderFunction<T, P>>>[1];
22
22
  export type ExtractSetType<T extends Set<any>> = T extends Set<infer U> ? U : never;
23
+ export type SameType<T, U> = T extends U ? (U extends T ? true : false) : false;
24
+ export type Assert<T extends true> = T;