@haoxin-web/excalidraw 1.0.0 → 1.0.1

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 (30) hide show
  1. package/README.md +20 -20
  2. package/dist/dev/{chunk-PTYT4VPM.js → chunk-G6EN3STO.js} +3 -3
  3. package/dist/dev/{chunk-VC7V2GEZ.js → chunk-R3GBEHWA.js} +2 -2
  4. package/dist/dev/{chunk-VC7V2GEZ.js.map → chunk-R3GBEHWA.js.map} +1 -1
  5. package/dist/dev/data/{image-CVHJEERS.js → image-QP66FJQD.js} +3 -3
  6. package/dist/dev/index.css.map +2 -2
  7. package/dist/dev/index.js +250 -108
  8. package/dist/dev/index.js.map +3 -3
  9. package/dist/dev/subset-shared.chunk.js +1 -1
  10. package/dist/dev/subset-worker.chunk.js +1 -1
  11. package/dist/prod/{chunk-5BVJZ5IS.js → chunk-57UWYCGH.js} +2 -2
  12. package/dist/prod/{chunk-ZHX5UPTB.js → chunk-T5E2FHQC.js} +1 -1
  13. package/dist/prod/data/image-AJHKS3PW.js +1 -0
  14. package/dist/prod/index.js +26 -26
  15. package/dist/prod/subset-shared.chunk.js +1 -1
  16. package/dist/prod/subset-worker.chunk.js +1 -1
  17. package/dist/types/excalidraw/actions/actionCanvas.d.ts +21 -14
  18. package/dist/types/excalidraw/components/Actions.d.ts +3 -2
  19. package/dist/types/excalidraw/components/App.d.ts +1 -0
  20. package/dist/types/excalidraw/components/HandButton.d.ts +2 -1
  21. package/dist/types/excalidraw/components/LayerUI.d.ts +4 -1
  22. package/dist/types/excalidraw/components/LeftMainToolbar.d.ts +1 -0
  23. package/dist/types/excalidraw/components/LeftToolFlyouts.d.ts +1 -0
  24. package/dist/types/excalidraw/components/MobileMenu.d.ts +2 -1
  25. package/dist/types/excalidraw/components/footer/Footer.d.ts +2 -1
  26. package/dist/types/excalidraw/types.d.ts +4 -0
  27. package/package.json +4 -4
  28. package/dist/prod/data/image-7GV76HIR.js +0 -1
  29. /package/dist/dev/{chunk-PTYT4VPM.js.map → chunk-G6EN3STO.js.map} +0 -0
  30. /package/dist/dev/data/{image-CVHJEERS.js.map → image-QP66FJQD.js.map} +0 -0
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-LS7FJGPW.js";import"./chunk-ZHX5UPTB.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
1
+ import{a,b,c,d}from"./chunk-LS7FJGPW.js";import"./chunk-T5E2FHQC.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
@@ -1 +1 @@
1
- import{a as r,c as t}from"./chunk-LS7FJGPW.js";import"./chunk-ZHX5UPTB.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
1
+ import{a as r,c as t}from"./chunk-LS7FJGPW.js";import"./chunk-T5E2FHQC.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
@@ -209,6 +209,7 @@ export declare const actionZoomIn: {
209
209
  trackEvent: {
210
210
  category: "canvas";
211
211
  };
212
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: import("../types").ExcalidrawProps) => boolean;
212
213
  perform: (_elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
213
214
  appState: {
214
215
  userToFollow: null;
@@ -387,9 +388,9 @@ export declare const actionZoomIn: {
387
388
  captureUpdate: "EVENTUALLY";
388
389
  };
389
390
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
390
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
391
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean;
391
392
  } & {
392
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
393
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean) | undefined;
393
394
  };
394
395
  export declare const actionZoomOut: {
395
396
  name: "zoomOut";
@@ -399,6 +400,7 @@ export declare const actionZoomOut: {
399
400
  trackEvent: {
400
401
  category: "canvas";
401
402
  };
403
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: import("../types").ExcalidrawProps) => boolean;
402
404
  perform: (_elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
403
405
  appState: {
404
406
  userToFollow: null;
@@ -577,9 +579,9 @@ export declare const actionZoomOut: {
577
579
  captureUpdate: "EVENTUALLY";
578
580
  };
579
581
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
580
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
582
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean;
581
583
  } & {
582
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
584
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean) | undefined;
583
585
  };
584
586
  export declare const actionResetZoom: {
585
587
  name: "resetZoom";
@@ -589,6 +591,7 @@ export declare const actionResetZoom: {
589
591
  trackEvent: {
590
592
  category: "canvas";
591
593
  };
594
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: import("../types").ExcalidrawProps) => boolean;
592
595
  perform: (_elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
593
596
  appState: {
594
597
  userToFollow: null;
@@ -767,9 +770,9 @@ export declare const actionResetZoom: {
767
770
  captureUpdate: "EVENTUALLY";
768
771
  };
769
772
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
770
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
773
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean;
771
774
  } & {
772
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
775
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean) | undefined;
773
776
  };
774
777
  export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fitToViewport, viewportZoomFactor, minZoom, maxZoom, }: {
775
778
  bounds: SceneBounds;
@@ -1162,6 +1165,7 @@ export declare const actionZoomToFitSelectionInViewport: {
1162
1165
  trackEvent: {
1163
1166
  category: "canvas";
1164
1167
  };
1168
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: import("../types").ExcalidrawProps) => boolean;
1165
1169
  perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
1166
1170
  appState: {
1167
1171
  scrollX: number;
@@ -1339,9 +1343,9 @@ export declare const actionZoomToFitSelectionInViewport: {
1339
1343
  };
1340
1344
  captureUpdate: "EVENTUALLY";
1341
1345
  };
1342
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
1346
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean;
1343
1347
  } & {
1344
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
1348
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean) | undefined;
1345
1349
  };
1346
1350
  export declare const actionZoomToFitSelection: {
1347
1351
  name: "zoomToFitSelection";
@@ -1350,6 +1354,7 @@ export declare const actionZoomToFitSelection: {
1350
1354
  trackEvent: {
1351
1355
  category: "canvas";
1352
1356
  };
1357
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: import("../types").ExcalidrawProps) => boolean;
1353
1358
  perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
1354
1359
  appState: {
1355
1360
  scrollX: number;
@@ -1527,9 +1532,9 @@ export declare const actionZoomToFitSelection: {
1527
1532
  };
1528
1533
  captureUpdate: "EVENTUALLY";
1529
1534
  };
1530
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
1535
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean;
1531
1536
  } & {
1532
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
1537
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean) | undefined;
1533
1538
  };
1534
1539
  export declare const actionZoomToFit: {
1535
1540
  name: "zoomToFit";
@@ -1539,6 +1544,7 @@ export declare const actionZoomToFit: {
1539
1544
  trackEvent: {
1540
1545
  category: "canvas";
1541
1546
  };
1547
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: import("../types").ExcalidrawProps) => boolean;
1542
1548
  perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
1543
1549
  appState: {
1544
1550
  scrollX: number;
@@ -1716,9 +1722,9 @@ export declare const actionZoomToFit: {
1716
1722
  };
1717
1723
  captureUpdate: "EVENTUALLY";
1718
1724
  };
1719
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
1725
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean;
1720
1726
  } & {
1721
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
1727
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean) | undefined;
1722
1728
  };
1723
1729
  export declare const actionToggleTheme: {
1724
1730
  name: "toggleTheme";
@@ -2280,6 +2286,7 @@ export declare const actionToggleHandTool: {
2280
2286
  };
2281
2287
  icon: import("react/jsx-runtime").JSX.Element;
2282
2288
  viewMode: false;
2289
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: import("../types").ExcalidrawProps) => boolean;
2283
2290
  perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: any, app: import("../types").AppClassProperties) => {
2284
2291
  appState: {
2285
2292
  selectedElementIds: {};
@@ -2450,7 +2457,7 @@ export declare const actionToggleHandTool: {
2450
2457
  };
2451
2458
  captureUpdate: "IMMEDIATELY";
2452
2459
  };
2453
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
2460
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean;
2454
2461
  } & {
2455
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
2462
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState, elements: readonly ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean) | undefined;
2456
2463
  };
@@ -16,10 +16,11 @@ export declare const ShapesSwitcher: ({ activeTool, appState, app, UIOptions, }:
16
16
  app: AppClassProperties;
17
17
  UIOptions: AppProps["UIOptions"];
18
18
  }) => import("react/jsx-runtime").JSX.Element;
19
- export declare const ZoomActions: ({ renderAction, zoom, }: {
19
+ export declare const ZoomActions: ({ renderAction, zoom, visible, }: {
20
20
  renderAction: ActionManager["renderAction"];
21
21
  zoom: Zoom;
22
- }) => import("react/jsx-runtime").JSX.Element;
22
+ visible?: boolean | undefined;
23
+ }) => import("react/jsx-runtime").JSX.Element | null;
23
24
  export declare const UndoRedoActions: ({ renderAction, className, }: {
24
25
  renderAction: ActionManager["renderAction"];
25
26
  className?: string | undefined;
@@ -444,6 +444,7 @@ declare class App extends React.Component<AppProps, AppState> {
444
444
  }) => boolean;
445
445
  private updateCurrentCursorPosition;
446
446
  getEditorUIOffsets: () => Offsets;
447
+ zoomToFit: () => void;
447
448
  private onKeyDown;
448
449
  private onKeyUp;
449
450
  private isToolSupported;
@@ -5,6 +5,7 @@ type LockIconProps = {
5
5
  checked: boolean;
6
6
  onChange?(): void;
7
7
  isMobile?: boolean;
8
+ visible?: boolean;
8
9
  };
9
- export declare const HandButton: (props: LockIconProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const HandButton: (props: LockIconProps) => import("react/jsx-runtime").JSX.Element | null;
10
11
  export {};
@@ -27,6 +27,9 @@ interface LayerUIProps {
27
27
  app: AppClassProperties;
28
28
  isCollaborating: boolean;
29
29
  generateLinkForSelection?: AppProps["generateLinkForSelection"];
30
+ showZoomActions?: boolean;
31
+ showPanActions?: boolean;
32
+ showToolBar?: boolean;
30
33
  }
31
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onExportImage, renderWelcomeScreen, children, app, isCollaborating, generateLinkForSelection, }: LayerUIProps) => import("react/jsx-runtime").JSX.Element>;
34
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onExportImage, renderWelcomeScreen, children, app, isCollaborating, generateLinkForSelection, showZoomActions, showPanActions, showToolBar, }: LayerUIProps) => import("react/jsx-runtime").JSX.Element>;
32
35
  export default _default;
@@ -3,6 +3,7 @@ import type { AppClassProperties, UIAppState } from "../types";
3
3
  type Props = {
4
4
  appState: UIAppState;
5
5
  app: AppClassProperties;
6
+ visible?: boolean;
6
7
  };
7
8
  declare const LeftMainToolbar: React.FC<Props>;
8
9
  export default LeftMainToolbar;
@@ -7,6 +7,7 @@ type Props = {
7
7
  app: AppClassProperties;
8
8
  actionManager: ActionManager;
9
9
  elements: readonly ExcalidrawElement[];
10
+ showToolBar?: boolean;
10
11
  };
11
12
  export declare const LeftToolFlyouts: React.FC<Props>;
12
13
  export default LeftToolFlyouts;
@@ -20,6 +20,7 @@ type MobileMenuProps = {
20
20
  renderWelcomeScreen: boolean;
21
21
  UIOptions: AppProps["UIOptions"];
22
22
  app: AppClassProperties;
23
+ showPanActions?: boolean;
23
24
  };
24
- export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, UIOptions, app, }: MobileMenuProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, UIOptions, app, showPanActions, }: MobileMenuProps) => import("react/jsx-runtime").JSX.Element;
25
26
  export {};
@@ -1,11 +1,12 @@
1
1
  import type { ActionManager } from "../../actions/manager";
2
2
  import type { UIAppState } from "../../types";
3
3
  declare const Footer: {
4
- ({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, }: {
4
+ ({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, showZoomActions, }: {
5
5
  appState: UIAppState;
6
6
  actionManager: ActionManager;
7
7
  showExitZenModeBtn: boolean;
8
8
  renderWelcomeScreen: boolean;
9
+ showZoomActions?: boolean | undefined;
9
10
  }): import("react/jsx-runtime").JSX.Element;
10
11
  displayName: string;
11
12
  };
@@ -478,6 +478,9 @@ export interface ExcalidrawProps {
478
478
  aiEnabled?: boolean;
479
479
  showDeprecatedFonts?: boolean;
480
480
  renderScrollbars?: boolean;
481
+ showZoomActions?: boolean;
482
+ showPanActions?: boolean;
483
+ showToolBar?: boolean;
481
484
  }
482
485
  export type SceneData = {
483
486
  elements?: ImportedDataState["elements"];
@@ -648,6 +651,7 @@ export interface ExcalidrawImperativeAPI {
648
651
  getFiles: () => InstanceType<typeof App>["files"];
649
652
  getName: InstanceType<typeof App>["getName"];
650
653
  scrollToContent: InstanceType<typeof App>["scrollToContent"];
654
+ zoomToFit: InstanceType<typeof App>["zoomToFit"];
651
655
  registerAction: (action: Action) => void;
652
656
  refresh: InstanceType<typeof App>["refresh"];
653
657
  setToast: InstanceType<typeof App>["setToast"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haoxin-web/excalidraw",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -91,9 +91,9 @@
91
91
  "es6-promise-pool": "2.5.0",
92
92
  "fractional-indexing": "3.2.0",
93
93
  "fuzzy": "0.1.3",
94
- "@haoxin-web/excalidraw-common": "^1.0.0",
95
- "@haoxin-web/excalidraw-element": "^1.0.0",
96
- "@haoxin-web/excalidraw-math": "^1.0.0",
94
+ "@haoxin-web/excalidraw-common": "^1.0.1",
95
+ "@haoxin-web/excalidraw-element": "^1.0.1",
96
+ "@haoxin-web/excalidraw-math": "^1.0.1",
97
97
  "image-blob-reduce": "3.0.1",
98
98
  "jotai": "2.11.0",
99
99
  "jotai-scope": "0.7.2",
@@ -1 +0,0 @@
1
- import{X as a,Y as b,Z as c}from"../chunk-5BVJZ5IS.js";import"../chunk-ZHX5UPTB.js";import"../chunk-SRAX5OIU.js";export{c as decodePngMetadata,b as encodePngMetadata,a as getTEXtChunk};