@excalidraw/excalidraw 0.16.1-6920-d3d0bd0 → 0.16.1-7251-fc9c8cd

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/excalidraw",
3
- "version": "0.16.1-6920-d3d0bd0",
3
+ "version": "0.16.1-7251-fc9c8cd",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -18,11 +18,15 @@ export declare const ExcalidrawContainerContext: React.Context<{
18
18
  export declare const useApp: () => AppClassProperties;
19
19
  export declare const useAppProps: () => AppProps;
20
20
  export declare const useDevice: () => Readonly<{
21
- isSmScreen: boolean;
22
- isMobile: boolean;
21
+ viewport: {
22
+ isMobile: boolean;
23
+ isLandscape: boolean;
24
+ };
25
+ editor: {
26
+ isMobile: boolean;
27
+ canFitSidebar: boolean;
28
+ };
23
29
  isTouchScreen: boolean;
24
- canDeviceFitSidebar: boolean;
25
- isLandscape: boolean;
26
30
  }>;
27
31
  export declare const useExcalidrawContainer: () => {
28
32
  container: HTMLDivElement | null;
@@ -39,7 +43,6 @@ declare class App extends React.Component<AppProps, AppState> {
39
43
  unmounted: boolean;
40
44
  actionManager: ActionManager;
41
45
  device: Device;
42
- detachIsMobileMqHandler?: () => void;
43
46
  private excalidrawContainerRef;
44
47
  static defaultProps: Partial<AppProps>;
45
48
  scene: Scene;
@@ -233,7 +236,9 @@ declare class App extends React.Component<AppProps, AppState> {
233
236
  */
234
237
  private resetScene;
235
238
  private initializeScene;
236
- private refreshDeviceState;
239
+ private isMobileBreakpoint;
240
+ private refreshViewportBreakpoints;
241
+ private refreshEditorBreakpoints;
237
242
  componentDidMount(): Promise<void>;
238
243
  componentWillUnmount(): void;
239
244
  private onResize;
@@ -412,7 +417,6 @@ declare class App extends React.Component<AppProps, AppState> {
412
417
  private maybeSuggestBindingAtCursor;
413
418
  private maybeSuggestBindingsForLinearElementAtCoords;
414
419
  private maybeSuggestBindingForAll;
415
- setSelection(elements: readonly NonDeletedExcalidrawElement[]): void;
416
420
  private clearSelection;
417
421
  private handleInteractiveCanvasRef;
418
422
  private handleAppOnDrop;
@@ -171,7 +171,6 @@ export declare const URL_HASH_KEYS: {
171
171
  readonly addLibrary: "addLibrary";
172
172
  };
173
173
  export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
174
- export declare const MQ_SM_MAX_WIDTH = 640;
175
174
  export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
176
175
  export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
177
176
  export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
@@ -1,13 +1,12 @@
1
1
  import React from "react";
2
2
  import "../../css/app.scss";
3
3
  import "../../css/styles.scss";
4
- import { ExcalidrawAPIRefValue, ExcalidrawProps } from "../../types";
4
+ import { ExcalidrawProps } from "../../types";
5
5
  import Footer from "../../components/footer/FooterCenter";
6
6
  import MainMenu from "../../components/main-menu/MainMenu";
7
7
  import WelcomeScreen from "../../components/welcome-screen/WelcomeScreen";
8
8
  import LiveCollaborationTrigger from "../../components/live-collaboration/LiveCollaborationTrigger";
9
- type PublicExcalidrawProps = Omit<ExcalidrawProps, "forwardedRef">;
10
- export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
9
+ export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawProps) => JSX.Element>;
11
10
  export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
12
11
  export { defaultLang, useI18n, languages } from "../../i18n";
13
12
  export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "../../data/restore";
@@ -27,4 +26,5 @@ export { LiveCollaborationTrigger };
27
26
  export { DefaultSidebar } from "../../components/DefaultSidebar";
28
27
  export { normalizeLink } from "../../data/url";
29
28
  export { convertToExcalidrawElements } from "../../data/transform";
29
+ export { getCommonBounds } from "../../element/bounds";
30
30
  export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "../withinBounds";
package/types/types.d.ts CHANGED
@@ -5,7 +5,7 @@ import { LinearElementEditor } from "./element/linearElementEditor";
5
5
  import { SuggestedBinding } from "./element/binding";
6
6
  import { ImportedDataState } from "./data/types";
7
7
  import type App from "./components/App";
8
- import type { ResolvablePromise, throttleRAF } from "./utils";
8
+ import type { throttleRAF } from "./utils";
9
9
  import { Spreadsheet } from "./charts";
10
10
  import { Language } from "./i18n";
11
11
  import { ClipboardData } from "./clipboard";
@@ -16,7 +16,7 @@ import type { FileSystemHandle } from "./data/filesystem";
16
16
  import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
17
17
  import { ContextMenuItems } from "./components/ContextMenu";
18
18
  import { SnapLine } from "./snapping";
19
- import { Merge, ForwardRef, ValueOf } from "./utility-types";
19
+ import { Merge, ValueOf } from "./utility-types";
20
20
  export type Point = Readonly<RoughPoint>;
21
21
  export type Collaborator = {
22
22
  pointer?: CollaboratorPointer;
@@ -283,17 +283,13 @@ export type LibraryItem = {
283
283
  export type LibraryItems = readonly LibraryItem[];
284
284
  export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
285
285
  export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>) | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>;
286
- export type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
287
- readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
288
- ready?: false;
289
- };
290
286
  export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
291
287
  libraryItems?: Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>;
292
288
  }>;
293
289
  export interface ExcalidrawProps {
294
290
  onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
295
291
  initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
296
- excalidrawRef?: ForwardRef<ExcalidrawAPIRefValue>;
292
+ excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
297
293
  isCollaborating?: boolean;
298
294
  onPointerUpdate?: (payload: {
299
295
  pointer: {
@@ -395,7 +391,6 @@ export type AppClassProperties = {
395
391
  lastViewportPosition: App["lastViewportPosition"];
396
392
  scrollToContent: App["scrollToContent"];
397
393
  addFiles: App["addFiles"];
398
- setSelection: App["setSelection"];
399
394
  addElementsFromPasteOrLibrary: App["addElementsFromPasteOrLibrary"];
400
395
  togglePenMode: App["togglePenMode"];
401
396
  setActiveTool: App["setActiveTool"];
@@ -476,8 +471,6 @@ export type ExcalidrawImperativeAPI = {
476
471
  refresh: InstanceType<typeof App>["refresh"];
477
472
  setToast: InstanceType<typeof App>["setToast"];
478
473
  addFiles: (data: BinaryFileData[]) => void;
479
- readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
480
- ready: true;
481
474
  id: string;
482
475
  setActiveTool: InstanceType<typeof App>["setActiveTool"];
483
476
  setCursor: InstanceType<typeof App>["setCursor"];
@@ -494,11 +487,15 @@ export type ExcalidrawImperativeAPI = {
494
487
  onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
495
488
  };
496
489
  export type Device = Readonly<{
497
- isSmScreen: boolean;
498
- isMobile: boolean;
490
+ viewport: {
491
+ isMobile: boolean;
492
+ isLandscape: boolean;
493
+ };
494
+ editor: {
495
+ isMobile: boolean;
496
+ canFitSidebar: boolean;
497
+ };
499
498
  isTouchScreen: boolean;
500
- canDeviceFitSidebar: boolean;
501
- isLandscape: boolean;
502
499
  }>;
503
500
  type FrameNameBounds = {
504
501
  x: number;