@zsviczian/excalidraw 0.18.0-46 → 0.18.0-48

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 (55) hide show
  1. package/dist/excalidraw.development.js +191 -114
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/styles.development.css +39 -1
  4. package/dist/styles.production.css +2 -2
  5. package/package.json +2 -1
  6. package/types/common/src/constants.d.ts +0 -16
  7. package/types/common/src/editorInterface.d.ts +35 -0
  8. package/types/common/src/index.d.ts +1 -0
  9. package/types/common/src/utils.d.ts +0 -1
  10. package/types/element/src/resizeTest.d.ts +5 -4
  11. package/types/element/src/transformHandles.d.ts +5 -4
  12. package/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -6
  13. package/types/excalidraw/actions/actionBoundText.d.ts +2 -4
  14. package/types/excalidraw/actions/actionCanvas.d.ts +30 -45
  15. package/types/excalidraw/actions/actionClipboard.d.ts +6 -12
  16. package/types/excalidraw/actions/actionCropEditor.d.ts +1 -2
  17. package/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -7
  18. package/types/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
  19. package/types/excalidraw/actions/actionElementLink.d.ts +1 -2
  20. package/types/excalidraw/actions/actionElementLock.d.ts +2 -4
  21. package/types/excalidraw/actions/actionEmbeddable.d.ts +1 -2
  22. package/types/excalidraw/actions/actionExport.d.ts +9 -18
  23. package/types/excalidraw/actions/actionFinalize.d.ts +3 -6
  24. package/types/excalidraw/actions/actionFrame.d.ts +4 -8
  25. package/types/excalidraw/actions/actionGroup.d.ts +2 -4
  26. package/types/excalidraw/actions/actionLinearEditor.d.ts +1 -2
  27. package/types/excalidraw/actions/actionLink.d.ts +0 -1
  28. package/types/excalidraw/actions/actionMenu.d.ts +1 -2
  29. package/types/excalidraw/actions/actionNavigate.d.ts +2 -4
  30. package/types/excalidraw/actions/actionProperties.d.ts +16 -32
  31. package/types/excalidraw/actions/actionSelectAll.d.ts +1 -2
  32. package/types/excalidraw/actions/actionStyles.d.ts +1 -2
  33. package/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -2
  34. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -2
  35. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +1 -2
  36. package/types/excalidraw/actions/actionToggleStats.d.ts +1 -2
  37. package/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -2
  38. package/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -3
  39. package/types/excalidraw/actions/actionTrayMenu.d.ts +1 -2
  40. package/types/excalidraw/components/Actions.d.ts +4 -1
  41. package/types/excalidraw/components/App.d.ts +21 -18
  42. package/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +0 -1
  43. package/types/excalidraw/components/HintViewer.d.ts +4 -3
  44. package/types/excalidraw/components/TrayMenu.d.ts +4 -3
  45. package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +3 -2
  46. package/types/excalidraw/components/icons.d.ts +1 -0
  47. package/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +14 -1
  48. package/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
  49. package/types/excalidraw/index.d.ts +2 -3
  50. package/types/excalidraw/obsidianUtils.d.ts +2 -2
  51. package/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
  52. package/types/excalidraw/scene/types.d.ts +3 -3
  53. package/types/excalidraw/types.d.ts +12 -18
  54. package/types/excalidraw/webpack.dev.config.d.ts +2 -0
  55. package/types/excalidraw/webpack.prod.config.d.ts +2 -0
@@ -161,7 +161,7 @@ export declare const actionCopyStyles: {
161
161
  shown: true;
162
162
  data: import("../charts").Spreadsheet;
163
163
  };
164
- showHyperlinkPopup: false | "editor" | "info";
164
+ showHyperlinkPopup: false | "info" | "editor";
165
165
  linkOpacity: number;
166
166
  colorPalette?: {
167
167
  canvasBackground: import("@excalidraw/common").ColorPaletteCustom;
@@ -216,7 +216,6 @@ export declare const actionCopyStyles: {
216
216
  lockedMultiSelections: {
217
217
  [groupId: string]: true;
218
218
  };
219
- stylesPanelMode: "compact" | "full" | "mobile" | "tray";
220
219
  };
221
220
  captureUpdate: "EVENTUALLY";
222
221
  };
@@ -167,7 +167,7 @@ export declare const actionToggleGridMode: {
167
167
  shown: true;
168
168
  data: import("../charts").Spreadsheet;
169
169
  };
170
- showHyperlinkPopup: false | "editor" | "info";
170
+ showHyperlinkPopup: false | "info" | "editor";
171
171
  linkOpacity: number;
172
172
  colorPalette?: {
173
173
  canvasBackground: import("@excalidraw/common").ColorPaletteCustom;
@@ -221,7 +221,6 @@ export declare const actionToggleGridMode: {
221
221
  lockedMultiSelections: {
222
222
  [groupId: string]: true;
223
223
  };
224
- stylesPanelMode: "compact" | "full" | "mobile" | "tray";
225
224
  };
226
225
  captureUpdate: "EVENTUALLY";
227
226
  };
@@ -165,7 +165,7 @@ export declare const actionToggleObjectsSnapMode: {
165
165
  shown: true;
166
166
  data: import("../charts").Spreadsheet;
167
167
  };
168
- showHyperlinkPopup: false | "editor" | "info";
168
+ showHyperlinkPopup: false | "info" | "editor";
169
169
  linkOpacity: number;
170
170
  colorPalette?: {
171
171
  canvasBackground: import("@excalidraw/common").ColorPaletteCustom;
@@ -219,7 +219,6 @@ export declare const actionToggleObjectsSnapMode: {
219
219
  lockedMultiSelections: {
220
220
  [groupId: string]: true;
221
221
  };
222
- stylesPanelMode: "compact" | "full" | "mobile" | "tray";
223
222
  };
224
223
  captureUpdate: "EVENTUALLY";
225
224
  };
@@ -157,7 +157,7 @@ export declare const actionToggleSearchMenu: {
157
157
  shown: true;
158
158
  data: import("../charts").Spreadsheet;
159
159
  };
160
- showHyperlinkPopup: false | "editor" | "info";
160
+ showHyperlinkPopup: false | "info" | "editor";
161
161
  linkOpacity: number;
162
162
  colorPalette?: {
163
163
  canvasBackground: import("@excalidraw/common").ColorPaletteCustom;
@@ -212,7 +212,6 @@ export declare const actionToggleSearchMenu: {
212
212
  lockedMultiSelections: {
213
213
  [groupId: string]: true;
214
214
  };
215
- stylesPanelMode: "compact" | "full" | "mobile" | "tray";
216
215
  };
217
216
  captureUpdate: "EVENTUALLY";
218
217
  };
@@ -164,7 +164,7 @@ export declare const actionToggleStats: {
164
164
  shown: true;
165
165
  data: import("../charts").Spreadsheet;
166
166
  };
167
- showHyperlinkPopup: false | "editor" | "info";
167
+ showHyperlinkPopup: false | "info" | "editor";
168
168
  linkOpacity: number;
169
169
  colorPalette?: {
170
170
  canvasBackground: import("@excalidraw/common").ColorPaletteCustom;
@@ -219,7 +219,6 @@ export declare const actionToggleStats: {
219
219
  lockedMultiSelections: {
220
220
  [groupId: string]: true;
221
221
  };
222
- stylesPanelMode: "compact" | "full" | "mobile" | "tray";
223
222
  };
224
223
  captureUpdate: "EVENTUALLY";
225
224
  };
@@ -164,7 +164,7 @@ export declare const actionToggleViewMode: {
164
164
  shown: true;
165
165
  data: import("../charts").Spreadsheet;
166
166
  };
167
- showHyperlinkPopup: false | "editor" | "info";
167
+ showHyperlinkPopup: false | "info" | "editor";
168
168
  linkOpacity: number;
169
169
  colorPalette?: {
170
170
  canvasBackground: import("@excalidraw/common").ColorPaletteCustom;
@@ -219,7 +219,6 @@ export declare const actionToggleViewMode: {
219
219
  lockedMultiSelections: {
220
220
  [groupId: string]: true;
221
221
  };
222
- stylesPanelMode: "compact" | "full" | "mobile" | "tray";
223
222
  };
224
223
  captureUpdate: "EVENTUALLY";
225
224
  };
@@ -164,7 +164,7 @@ export declare const actionToggleZenMode: {
164
164
  shown: true;
165
165
  data: import("../charts").Spreadsheet;
166
166
  };
167
- showHyperlinkPopup: false | "editor" | "info";
167
+ showHyperlinkPopup: false | "info" | "editor";
168
168
  linkOpacity: number;
169
169
  colorPalette?: {
170
170
  canvasBackground: import("@excalidraw/common").ColorPaletteCustom;
@@ -219,12 +219,11 @@ export declare const actionToggleZenMode: {
219
219
  lockedMultiSelections: {
220
220
  [groupId: string]: true;
221
221
  };
222
- stylesPanelMode: "compact" | "full" | "mobile" | "tray";
223
222
  };
224
223
  captureUpdate: "EVENTUALLY";
225
224
  };
226
225
  checked: (appState: Readonly<import("../types").AppState>) => boolean;
227
- predicate: (elements: readonly import("@excalidraw/element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps) => boolean;
226
+ predicate: (elements: readonly import("@excalidraw/element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
228
227
  keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
229
228
  } & {
230
229
  keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
@@ -161,7 +161,7 @@ export declare const actionToggleTrayEditMenu: {
161
161
  shown: true;
162
162
  data: import("../charts").Spreadsheet;
163
163
  };
164
- showHyperlinkPopup: false | "editor" | "info";
164
+ showHyperlinkPopup: false | "info" | "editor";
165
165
  linkOpacity: number;
166
166
  colorPalette?: {
167
167
  canvasBackground: import("@excalidraw/common").ColorPaletteCustom;
@@ -216,7 +216,6 @@ export declare const actionToggleTrayEditMenu: {
216
216
  lockedMultiSelections: {
217
217
  [groupId: string]: true;
218
218
  };
219
- stylesPanelMode: "compact" | "full" | "mobile" | "tray";
220
219
  };
221
220
  captureUpdate: "EVENTUALLY";
222
221
  };
@@ -39,7 +39,10 @@ export declare const UndoRedoActions: ({ renderAction, className, }: {
39
39
  renderAction: ActionManager["renderAction"];
40
40
  className?: string | undefined;
41
41
  }) => import("react/jsx-runtime").JSX.Element;
42
- export declare const ExitZenModeAction: ({ actionManager, showExitZenModeBtn, }: {
42
+ export declare const ExitZenModeButton: ({ actionManager, showExitZenModeBtn, }: {
43
43
  actionManager: ActionManager;
44
44
  showExitZenModeBtn: boolean;
45
45
  }) => import("react/jsx-runtime").JSX.Element;
46
+ export declare const ExitViewModeButton: ({ actionManager, }: {
47
+ actionManager: ActionManager;
48
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
2
+ import { type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
3
3
  import { LinearElementEditor, FlowChartCreator, Scene, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
4
4
  import type { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
5
5
  import type { Mutable } from "@excalidraw/common/utility-types";
@@ -13,7 +13,7 @@ import { LassoTrail } from "../lasso";
13
13
  import { EraserTrail } from "../eraser";
14
14
  import type { ExportedElements } from "../data";
15
15
  import type { FileSystemHandle } from "../data/filesystem";
16
- import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
16
+ import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
17
17
  import type { RoughCanvas } from "roughjs/bin/canvas";
18
18
  import type { ActionResult } from "../actions/types";
19
19
  export declare const ExcalidrawContainerContext: React.Context<{
@@ -22,18 +22,19 @@ export declare const ExcalidrawContainerContext: React.Context<{
22
22
  }>;
23
23
  export declare const useApp: () => AppClassProperties;
24
24
  export declare const useAppProps: () => AppProps;
25
- export declare const useDevice: () => Readonly<{
26
- viewport: {
27
- isMobile: boolean;
28
- isLandscape: boolean;
29
- };
30
- editor: {
31
- isMobile: boolean;
32
- canFitSidebar: boolean;
33
- };
25
+ export declare const useEditorInterface: () => Readonly<{
26
+ formFactor: "phone" | "tablet" | "desktop";
27
+ desktopUIMode: "compact" | "full" | "tray";
28
+ userAgent: Readonly<{
29
+ isMobileDevice: boolean;
30
+ platform: "other" | "unknown" | "ios" | "android";
31
+ }>;
34
32
  isTouchScreen: boolean;
35
- isTrayMode: boolean;
33
+ canFitSidebar: boolean;
34
+ isLandscape: boolean;
35
+ preferTrayMode: boolean;
36
36
  }>;
37
+ export declare const useStylesPanelMode: () => StylesPanelMode;
37
38
  export declare const useExcalidrawContainer: () => {
38
39
  container: HTMLDivElement | null;
39
40
  id: string | null;
@@ -48,7 +49,8 @@ declare class App extends React.Component<AppProps, AppState> {
48
49
  rc: RoughCanvas;
49
50
  unmounted: boolean;
50
51
  actionManager: ActionManager;
51
- device: Device;
52
+ editorInterface: EditorInterface;
53
+ private stylesPanelMode;
52
54
  private excalidrawContainerRef;
53
55
  scene: Scene;
54
56
  fonts: Fonts;
@@ -301,10 +303,12 @@ declare class App extends React.Component<AppProps, AppState> {
301
303
  */
302
304
  private resetScene;
303
305
  private initializeScene;
304
- private isMobileBreakpoint;
305
- private isTabletBreakpoint;
306
- private refreshViewportBreakpoints;
307
- private refreshEditorBreakpoints;
306
+ private getFormFactor;
307
+ refreshEditorInterface: (preferTrayMode?: boolean) => void;
308
+ private reconcileStylesPanelMode;
309
+ /** TO BE USED LATER */
310
+ private setDesktopUIMode;
311
+ private isTouchScreen;
308
312
  private setTrayModeEnabled;
309
313
  isTrayModeEnabled: () => boolean;
310
314
  private clearImageShapeCache;
@@ -397,7 +401,6 @@ declare class App extends React.Component<AppProps, AppState> {
397
401
  * NOTE if file already exists in editor state, the file data is not updated
398
402
  * */
399
403
  addFiles: ExcalidrawImperativeAPI["addFiles"];
400
- setMobileModeAllowed: ExcalidrawImperativeAPI["setMobileModeAllowed"];
401
404
  private debounceClearHighlightSearchResults;
402
405
  selectElements: ExcalidrawImperativeAPI["selectElements"];
403
406
  bringToFront: ExcalidrawImperativeAPI["bringToFront"];
@@ -18,7 +18,6 @@ interface ColorPickerProps {
18
18
  palette?: ColorPaletteCustom | null;
19
19
  topPicks?: ColorTuple;
20
20
  updateData: (formData?: any) => void;
21
- compactMode?: boolean;
22
21
  }
23
22
  export declare const ColorPicker: ({ type, color, onChange, label, elements, palette, topPicks, updateData, appState, }: ColorPickerProps) => import("react/jsx-runtime").JSX.Element;
24
23
  export {};
@@ -1,10 +1,11 @@
1
+ import type { EditorInterface } from "@excalidraw/common";
1
2
  import "./HintViewer.scss";
2
- import type { AppClassProperties, Device, UIAppState } from "../types";
3
+ import type { AppClassProperties, UIAppState } from "../types";
3
4
  interface HintViewerProps {
4
5
  appState: UIAppState;
5
6
  isMobile: boolean;
6
- device: Device;
7
+ editorInterface: EditorInterface;
7
8
  app: AppClassProperties;
8
9
  }
9
- export declare const HintViewer: ({ appState, isMobile, device, app, }: HintViewerProps) => import("react/jsx-runtime").JSX.Element | null;
10
+ export declare const HintViewer: ({ appState, isMobile, editorInterface, app, }: HintViewerProps) => import("react/jsx-runtime").JSX.Element | null;
10
11
  export {};
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
+ import type { EditorInterface } from "@excalidraw/common";
3
4
  import type { ActionManager } from "../actions/manager";
4
- import type { AppClassProperties, AppProps, AppState, Device, ExcalidrawProps, UIAppState } from "../types";
5
+ import type { AppClassProperties, AppProps, AppState, ExcalidrawProps, UIAppState } from "../types";
5
6
  import type { JSX } from "react";
6
7
  type TrayMenuProps = {
7
8
  appState: UIAppState;
@@ -16,10 +17,10 @@ type TrayMenuProps = {
16
17
  renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
17
18
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
18
19
  renderSidebars: () => JSX.Element | null;
19
- device: Device;
20
+ editorInterface: EditorInterface;
20
21
  renderWelcomeScreen: boolean;
21
22
  UIOptions: AppProps["UIOptions"];
22
23
  app: AppClassProperties;
23
24
  };
24
- export declare const TrayMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, UIOptions, app, }: TrayMenuProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const TrayMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, renderTopRightUI, renderCustomStats, renderSidebars, editorInterface, renderWelcomeScreen, UIOptions, app, }: TrayMenuProps) => import("react/jsx-runtime").JSX.Element;
25
26
  export {};
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
+ import { type EditorInterface } from "@excalidraw/common";
2
3
  import type { NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
3
4
  import type { RenderableElementsMap, RenderInteractiveSceneCallback } from "../../scene/types";
4
- import type { Device, InteractiveCanvasAppState } from "../../types";
5
+ import type { InteractiveCanvasAppState } from "../../types";
5
6
  import type { DOMAttributes } from "react";
6
7
  type InteractiveCanvasProps = {
7
8
  containerRef: React.RefObject<HTMLDivElement | null>;
@@ -15,7 +16,7 @@ type InteractiveCanvasProps = {
15
16
  scale: number;
16
17
  appState: InteractiveCanvasAppState;
17
18
  renderScrollbars: boolean;
18
- device: Device;
19
+ editorInterface: EditorInterface;
19
20
  renderInteractiveSceneCallback: (data: RenderInteractiveSceneCallback) => void;
20
21
  handleCanvasRef: (canvas: HTMLCanvasElement | null) => void;
21
22
  onContextMenu: Exclude<DOMAttributes<HTMLCanvasElement | HTMLDivElement>["onContextMenu"], undefined>;
@@ -233,4 +233,5 @@ export declare const Card: import("react/jsx-runtime").JSX.Element;
233
233
  export declare const resizeIcon: import("react/jsx-runtime").JSX.Element;
234
234
  export declare const adjustmentsIcon: import("react/jsx-runtime").JSX.Element;
235
235
  export declare const strokeIcon: import("react/jsx-runtime").JSX.Element;
236
+ export declare const pencilIcon: import("react/jsx-runtime").JSX.Element;
236
237
  export {};
@@ -1,8 +1,21 @@
1
+ import { type EditorInterface } from "@excalidraw/common";
1
2
  import "./LiveCollaborationTrigger.scss";
2
3
  declare const LiveCollaborationTrigger: {
3
- ({ isCollaborating, onSelect, ...rest }: {
4
+ ({ isCollaborating, onSelect, editorInterface, ...rest }: {
4
5
  isCollaborating: boolean;
5
6
  onSelect: () => void;
7
+ editorInterface?: Readonly<{
8
+ formFactor: "phone" | "tablet" | "desktop";
9
+ desktopUIMode: "compact" | "full" | "tray";
10
+ userAgent: Readonly<{
11
+ isMobileDevice: boolean;
12
+ platform: "other" | "unknown" | "ios" | "android";
13
+ }>;
14
+ isTouchScreen: boolean;
15
+ canFitSidebar: boolean;
16
+ isLandscape: boolean;
17
+ preferTrayMode: boolean;
18
+ }> | undefined;
6
19
  } & import("react").ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
7
20
  displayName: string;
8
21
  };
@@ -25,9 +25,6 @@ declare const MainMenu: React.FC<{
25
25
  order?: number | undefined;
26
26
  onSelect?: ((event: Event) => void) | undefined;
27
27
  children: React.ReactNode;
28
- /**
29
- * Called when any menu item is selected (clicked on).
30
- */
31
28
  shortcut?: string | undefined;
32
29
  hovered?: boolean | undefined;
33
30
  selected?: boolean | undefined;
@@ -33,18 +33,17 @@ export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "
33
33
  export { getFreeDrawSvgPath } from "@excalidraw/element";
34
34
  export { mergeLibraryItems, getLibraryItemsHash } from "./data/library";
35
35
  export { isLinearElement } from "@excalidraw/element";
36
- export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, UserIdleState, normalizeLink, } from "@excalidraw/common";
36
+ export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, UserIdleState, normalizeLink, sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, getFormFactor, safelyParseJSON, } from "@excalidraw/common";
37
37
  export { mutateElement, newElementWith, bumpVersion, } from "@excalidraw/element";
38
38
  export { CaptureUpdateAction } from "@excalidraw/element";
39
39
  export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
40
- export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, safelyParseJSON, } from "@excalidraw/common";
41
40
  export { getEmbedLink } from "@excalidraw/element/embeddable";
42
41
  export { Sidebar } from "./components/Sidebar/Sidebar";
43
42
  export { Button } from "./components/Button";
44
43
  export { Footer };
45
44
  export { MainMenu };
46
45
  export { Ellipsify } from "./components/Ellipsify";
47
- export { useDevice } from "./components/App";
46
+ export { useEditorInterface, useStylesPanelMode } from "./components/App";
48
47
  export { WelcomeScreen };
49
48
  export { LiveCollaborationTrigger };
50
49
  export { Stats } from "./components/Stats";
@@ -1,7 +1,7 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math/types";
2
2
  import type { FontMetadata } from "@excalidraw/common";
3
3
  import type { ElementsMap, ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
4
- import type { AppState } from "./types";
4
+ import type { AppClassProperties, AppState } from "./types";
5
5
  import type { MermaidToExcalidrawLibProps } from "./components/TTDDialog/common";
6
6
  export declare let hostPlugin: any;
7
7
  export declare function destroyObsidianUtils(): void;
@@ -42,5 +42,5 @@ export declare const getZoomMax: () => any;
42
42
  export declare const runAction: (action: string) => void;
43
43
  export declare const t2: (key: string) => string;
44
44
  export declare const shouldDisableZoom: (appState: AppState) => boolean;
45
- export declare const isFullPanelMode: (appState: AppState) => boolean;
45
+ export declare const isFullPanelMode: (app: AppClassProperties) => boolean;
46
46
  export declare const isContextMenuDisabled: () => boolean;
@@ -9,7 +9,7 @@ export declare const renderInteractiveSceneThrottled: {
9
9
  * Interactive scene is the ui-canvas where we render bounding boxes, selections
10
10
  * and other ui stuff.
11
11
  */
12
- export declare const renderInteractiveScene: <U extends ({ canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, device, }: InteractiveSceneRenderConfig) => {
12
+ export declare const renderInteractiveScene: <U extends ({ canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, }: InteractiveSceneRenderConfig) => {
13
13
  atLeastOneVisibleElement: boolean;
14
14
  elementsMap: RenderableElementsMap;
15
15
  scrollBars?: undefined;
@@ -1,7 +1,7 @@
1
- import type { UserIdleState } from "@excalidraw/common";
1
+ import type { UserIdleState, EditorInterface } from "@excalidraw/common";
2
2
  import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
3
3
  import type { MakeBrand } from "@excalidraw/common/utility-types";
4
- import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, Device, PendingExcalidrawElements } from "../types";
4
+ import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, PendingExcalidrawElements } from "../types";
5
5
  import type { RoughCanvas } from "roughjs/bin/canvas";
6
6
  import type { Drawable } from "roughjs/bin/core";
7
7
  export type RenderableElementsMap = NonDeletedElementsMap & MakeBrand<"RenderableElementsMap">;
@@ -71,7 +71,7 @@ export type InteractiveSceneRenderConfig = {
71
71
  scale: number;
72
72
  appState: InteractiveCanvasAppState;
73
73
  renderConfig: InteractiveCanvasRenderConfig;
74
- device: Device;
74
+ editorInterface: EditorInterface;
75
75
  callback: (data: RenderInteractiveSceneCallback) => void;
76
76
  };
77
77
  export type NewElementSceneRenderConfig = {
@@ -1,4 +1,4 @@
1
- import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorPaletteCustom } from "@excalidraw/common";
1
+ import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorPaletteCustom, EditorInterface } from "@excalidraw/common";
2
2
  import type { SuggestedBinding } from "@excalidraw/element";
3
3
  import type { LinearElementEditor } from "@excalidraw/element";
4
4
  import type { MaybeTransformHandleType } from "@excalidraw/element";
@@ -400,8 +400,6 @@ export interface AppState {
400
400
  lockedMultiSelections: {
401
401
  [groupId: string]: true;
402
402
  };
403
- /** properties sidebar mode - determines whether to show compact or complete sidebar */
404
- stylesPanelMode: "compact" | "full" | "mobile" | "tray";
405
403
  }
406
404
  export type SearchMatch = {
407
405
  id: string;
@@ -566,6 +564,12 @@ export type UIOptions = Partial<{
566
564
  tools: {
567
565
  image: boolean;
568
566
  };
567
+ /**
568
+ * Optionally control the editor form factor and desktop UI mode from the host app.
569
+ * If not provided, we will take care of it internally.
570
+ */
571
+ formFactor?: EditorInterface["formFactor"];
572
+ desktopUIMode?: EditorInterface["desktopUIMode"];
569
573
  /** @deprecated does nothing. Will be removed in 0.15 */
570
574
  welcomeScreen?: boolean;
571
575
  }>;
@@ -596,7 +600,7 @@ export type AppClassProperties = {
596
600
  mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
597
601
  }>;
598
602
  files: BinaryFiles;
599
- device: App["device"];
603
+ editorInterface: App["editorInterface"];
600
604
  scene: App["scene"];
601
605
  syncActionResult: App["syncActionResult"];
602
606
  fonts: App["fonts"];
@@ -700,8 +704,10 @@ export interface ExcalidrawImperativeAPI {
700
704
  };
701
705
  setForceRenderAllEmbeddables: InstanceType<typeof App>["setForceRenderAllEmbeddables"];
702
706
  zoomToFit: InstanceType<typeof App>["zoomToFit"];
703
- refreshEditorBreakpoints: InstanceType<typeof App>["refreshEditorBreakpoints"];
707
+ refreshEditorInterface: InstanceType<typeof App>["refreshEditorInterface"];
708
+ isTouchScreen: InstanceType<typeof App>["isTouchScreen"];
704
709
  setTrayModeEnabled: InstanceType<typeof App>["setTrayModeEnabled"];
710
+ setDesktopUIMode: InstanceType<typeof App>["setDesktopUIMode"];
705
711
  isTrayModeEnabled: InstanceType<typeof App>["isTrayModeEnabled"];
706
712
  getColorAtScenePoint: InstanceType<typeof App>["getColorAtScenePoint"];
707
713
  startLineEditor: InstanceType<typeof App>["startLineEditor"];
@@ -721,12 +727,12 @@ export interface ExcalidrawImperativeAPI {
721
727
  bringForward: (elements: readonly ExcalidrawElement[]) => void;
722
728
  sendToBack: (elements: readonly ExcalidrawElement[]) => void;
723
729
  bringToFront: (elements: readonly ExcalidrawElement[]) => void;
724
- setMobileModeAllowed: (allow: boolean) => void;
725
730
  setActiveTool: InstanceType<typeof App>["setActiveTool"];
726
731
  setCursor: InstanceType<typeof App>["setCursor"];
727
732
  resetCursor: InstanceType<typeof App>["resetCursor"];
728
733
  toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
729
734
  getHTMLIFrameElement: InstanceType<typeof App>["getHTMLIFrameElement"];
735
+ getEditorInterface: () => EditorInterface;
730
736
  /**
731
737
  * Disables rendering of frames (including element clipping), but currently
732
738
  * the frames are still interactive in edit mode. As such, this API should be
@@ -740,18 +746,6 @@ export interface ExcalidrawImperativeAPI {
740
746
  onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
741
747
  onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
742
748
  }
743
- export type Device = Readonly<{
744
- viewport: {
745
- isMobile: boolean;
746
- isLandscape: boolean;
747
- };
748
- editor: {
749
- isMobile: boolean;
750
- canFitSidebar: boolean;
751
- };
752
- isTouchScreen: boolean;
753
- isTrayMode: boolean;
754
- }>;
755
749
  export type FrameNameBounds = {
756
750
  x: number;
757
751
  y: number;
@@ -14,6 +14,8 @@ export namespace output {
14
14
  }
15
15
  export namespace resolve {
16
16
  const extensions: string[];
17
+ const mainFields: string[];
18
+ const mainFiles: string[];
17
19
  const alias: {
18
20
  "@excalidraw/excalidraw": string;
19
21
  "@excalidraw/utils": string;
@@ -15,6 +15,8 @@ export namespace output {
15
15
  }
16
16
  export namespace resolve {
17
17
  const extensions: string[];
18
+ const mainFields: string[];
19
+ const mainFiles: string[];
18
20
  const alias: {
19
21
  "@excalidraw/excalidraw": string;
20
22
  "@excalidraw/utils": string;