@zsviczian/excalidraw 0.15.2-obsidian-5 → 0.15.2-obsidian-6
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/dist/excalidraw.development.js +42 -20
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionCanvas.d.ts +303 -7
- package/types/actions/types.d.ts +1 -1
- package/types/components/App.d.ts +13 -1
- package/types/constants.d.ts +8 -8
- package/types/data/url.d.ts +2 -0
- package/types/element/Hyperlink.d.ts +0 -2
- package/types/element/iframe.d.ts +1 -7
- package/types/element/newElement.d.ts +1 -2
- package/types/element/types.d.ts +8 -1
- package/types/keys.d.ts +1 -0
- package/types/packages/excalidraw/index.d.ts +1 -0
- package/types/types.d.ts +5 -1
- package/types/utils.d.ts +41 -14
package/package.json
CHANGED
|
@@ -613,13 +613,20 @@ export declare const actionResetZoom: {
|
|
|
613
613
|
} & {
|
|
614
614
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
615
615
|
};
|
|
616
|
-
export declare const
|
|
616
|
+
export declare const zoomToFit: ({ targetElements, appState, fitToViewport, viewportZoomFactor, }: {
|
|
617
|
+
targetElements: readonly ExcalidrawElement[];
|
|
618
|
+
appState: Readonly<AppState>;
|
|
619
|
+
/** whether to fit content to viewport (beyond >100%) */
|
|
620
|
+
fitToViewport: boolean;
|
|
621
|
+
/** zoom content to cover X of the viewport, when fitToViewport=true */
|
|
622
|
+
viewportZoomFactor?: number | undefined;
|
|
623
|
+
}) => {
|
|
617
624
|
appState: {
|
|
625
|
+
scrollX: number;
|
|
626
|
+
scrollY: number;
|
|
618
627
|
zoom: {
|
|
619
628
|
value: NormalizedZoomValue;
|
|
620
629
|
};
|
|
621
|
-
scrollX: number;
|
|
622
|
-
scrollY: number;
|
|
623
630
|
contextMenu: {
|
|
624
631
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
625
632
|
top: number;
|
|
@@ -753,18 +760,167 @@ export declare const zoomToFitElements: (elements: readonly ExcalidrawElement[],
|
|
|
753
760
|
};
|
|
754
761
|
commitToHistory: boolean;
|
|
755
762
|
};
|
|
756
|
-
export declare const
|
|
757
|
-
name: "
|
|
763
|
+
export declare const actionZoomToFitSelectionInViewport: {
|
|
764
|
+
name: "zoomToFitSelectionInViewport";
|
|
758
765
|
trackEvent: {
|
|
759
766
|
category: "canvas";
|
|
760
767
|
};
|
|
761
768
|
perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => {
|
|
762
769
|
appState: {
|
|
770
|
+
scrollX: number;
|
|
771
|
+
scrollY: number;
|
|
763
772
|
zoom: {
|
|
764
773
|
value: NormalizedZoomValue;
|
|
765
774
|
};
|
|
775
|
+
contextMenu: {
|
|
776
|
+
items: import("../components/ContextMenu").ContextMenuItems;
|
|
777
|
+
top: number;
|
|
778
|
+
left: number;
|
|
779
|
+
} | null;
|
|
780
|
+
showWelcomeScreen: boolean;
|
|
781
|
+
isLoading: boolean;
|
|
782
|
+
errorMessage: import("react").ReactNode;
|
|
783
|
+
activeIFrame: {
|
|
784
|
+
element: import("../element/types").NonDeletedExcalidrawElement;
|
|
785
|
+
state: "active" | "hover";
|
|
786
|
+
} | null;
|
|
787
|
+
draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
788
|
+
resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
789
|
+
multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
|
|
790
|
+
selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
791
|
+
isBindingEnabled: boolean;
|
|
792
|
+
startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
|
|
793
|
+
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
794
|
+
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
|
|
795
|
+
shouldRenderFrames: boolean;
|
|
796
|
+
editingFrame: string | null;
|
|
797
|
+
elementsToHighlight: import("../element/types").NonDeleted<ExcalidrawElement>[] | null;
|
|
798
|
+
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
799
|
+
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
800
|
+
activeTool: {
|
|
801
|
+
lastActiveTool: import("../types").LastActiveTool;
|
|
802
|
+
locked: boolean;
|
|
803
|
+
} & ({
|
|
804
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "iframe" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
805
|
+
customType: null;
|
|
806
|
+
} | {
|
|
807
|
+
type: "custom";
|
|
808
|
+
customType: string;
|
|
809
|
+
});
|
|
810
|
+
penMode: boolean;
|
|
811
|
+
penDetected: boolean;
|
|
812
|
+
exportBackground: boolean;
|
|
813
|
+
exportEmbedScene: boolean;
|
|
814
|
+
exportWithDarkMode: boolean;
|
|
815
|
+
exportScale: number;
|
|
816
|
+
currentItemStrokeColor: string;
|
|
817
|
+
currentItemBackgroundColor: string;
|
|
818
|
+
currentItemFillStyle: import("../element/types").FillStyle;
|
|
819
|
+
currentItemStrokeWidth: number;
|
|
820
|
+
currentItemStrokeStyle: import("../element/types").StrokeStyle;
|
|
821
|
+
currentItemRoughness: number;
|
|
822
|
+
currentItemOpacity: number;
|
|
823
|
+
currentItemFontFamily: number;
|
|
824
|
+
currentItemFontSize: number;
|
|
825
|
+
currentItemTextAlign: string;
|
|
826
|
+
currentItemStartArrowhead: import("../element/types").Arrowhead | null;
|
|
827
|
+
currentItemEndArrowhead: import("../element/types").Arrowhead | null;
|
|
828
|
+
currentItemRoundness: import("../element/types").StrokeRoundness;
|
|
829
|
+
viewBackgroundColor: string;
|
|
830
|
+
cursorButton: "up" | "down";
|
|
831
|
+
scrolledOutside: boolean;
|
|
832
|
+
name: string;
|
|
833
|
+
isResizing: boolean;
|
|
834
|
+
isRotating: boolean;
|
|
835
|
+
openMenu: "canvas" | "shape" | null;
|
|
836
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
837
|
+
openSidebar: {
|
|
838
|
+
name: string;
|
|
839
|
+
tab?: string | undefined;
|
|
840
|
+
} | null;
|
|
841
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
842
|
+
defaultSidebarDockedPreference: boolean;
|
|
843
|
+
lastPointerDownWith: import("../element/types").PointerType;
|
|
844
|
+
selectedElementIds: {
|
|
845
|
+
[id: string]: boolean;
|
|
846
|
+
};
|
|
847
|
+
previousSelectedElementIds: {
|
|
848
|
+
[id: string]: boolean;
|
|
849
|
+
};
|
|
850
|
+
selectedElementsAreBeingDragged: boolean;
|
|
851
|
+
shouldCacheIgnoreZoom: boolean;
|
|
852
|
+
toast: {
|
|
853
|
+
message: string;
|
|
854
|
+
closable?: boolean | undefined;
|
|
855
|
+
duration?: number | undefined;
|
|
856
|
+
} | null;
|
|
857
|
+
zenModeEnabled: boolean;
|
|
858
|
+
theme: string;
|
|
859
|
+
gridSize: number | null;
|
|
860
|
+
previousGridSize: number | null;
|
|
861
|
+
viewModeEnabled: boolean;
|
|
862
|
+
selectedGroupIds: {
|
|
863
|
+
[groupId: string]: boolean;
|
|
864
|
+
};
|
|
865
|
+
editingGroupId: string | null;
|
|
866
|
+
width: number;
|
|
867
|
+
height: number;
|
|
868
|
+
offsetTop: number;
|
|
869
|
+
offsetLeft: number;
|
|
870
|
+
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
871
|
+
collaborators: Map<string, import("../types").Collaborator>;
|
|
872
|
+
showStats: boolean;
|
|
873
|
+
currentChartType: import("../element/types").ChartType;
|
|
874
|
+
pasteDialog: {
|
|
875
|
+
shown: false;
|
|
876
|
+
data: null;
|
|
877
|
+
} | {
|
|
878
|
+
shown: true;
|
|
879
|
+
data: import("../charts").Spreadsheet;
|
|
880
|
+
};
|
|
881
|
+
pendingImageElementId: string | null;
|
|
882
|
+
showHyperlinkPopup: false | "info" | "editor";
|
|
883
|
+
linkOpacity: number;
|
|
884
|
+
trayModeEnabled: boolean;
|
|
885
|
+
colorPalette?: {
|
|
886
|
+
canvasBackground: import("../colors").ColorPaletteCustom;
|
|
887
|
+
elementBackground: import("../colors").ColorPaletteCustom;
|
|
888
|
+
elementStroke: import("../colors").ColorPaletteCustom;
|
|
889
|
+
topPicks: {
|
|
890
|
+
canvasBackground: [string, string, string, string, string];
|
|
891
|
+
elementStroke: [string, string, string, string, string];
|
|
892
|
+
elementBackground: [string, string, string, string, string];
|
|
893
|
+
};
|
|
894
|
+
} | undefined;
|
|
895
|
+
allowWheelZoom?: boolean | undefined;
|
|
896
|
+
allowPinchZoom?: boolean | undefined;
|
|
897
|
+
pinnedScripts?: string[] | undefined;
|
|
898
|
+
customPens?: any[] | undefined;
|
|
899
|
+
currentStrokeOptions?: any;
|
|
900
|
+
resetCustomPen?: any;
|
|
901
|
+
gridColor: string;
|
|
902
|
+
dynamicStyle: string;
|
|
903
|
+
invertBindingBehaviour: boolean;
|
|
904
|
+
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
905
|
+
};
|
|
906
|
+
commitToHistory: boolean;
|
|
907
|
+
};
|
|
908
|
+
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
909
|
+
} & {
|
|
910
|
+
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
911
|
+
};
|
|
912
|
+
export declare const actionZoomToFitSelection: {
|
|
913
|
+
name: "zoomToFitSelection";
|
|
914
|
+
trackEvent: {
|
|
915
|
+
category: "canvas";
|
|
916
|
+
};
|
|
917
|
+
perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => {
|
|
918
|
+
appState: {
|
|
766
919
|
scrollX: number;
|
|
767
920
|
scrollY: number;
|
|
921
|
+
zoom: {
|
|
922
|
+
value: NormalizedZoomValue;
|
|
923
|
+
};
|
|
768
924
|
contextMenu: {
|
|
769
925
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
770
926
|
top: number;
|
|
@@ -910,11 +1066,11 @@ export declare const actionZoomToFit: {
|
|
|
910
1066
|
};
|
|
911
1067
|
perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => {
|
|
912
1068
|
appState: {
|
|
1069
|
+
scrollX: number;
|
|
1070
|
+
scrollY: number;
|
|
913
1071
|
zoom: {
|
|
914
1072
|
value: NormalizedZoomValue;
|
|
915
1073
|
};
|
|
916
|
-
scrollX: number;
|
|
917
|
-
scrollY: number;
|
|
918
1074
|
contextMenu: {
|
|
919
1075
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
920
1076
|
top: number;
|
|
@@ -1487,3 +1643,143 @@ export declare const actionToggleHandTool: {
|
|
|
1487
1643
|
} & {
|
|
1488
1644
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
1489
1645
|
};
|
|
1646
|
+
export declare const zoomToFitElements: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, zoomToSelection: boolean, maxZoom?: number, margin?: number) => {
|
|
1647
|
+
appState: {
|
|
1648
|
+
zoom: {
|
|
1649
|
+
value: NormalizedZoomValue;
|
|
1650
|
+
};
|
|
1651
|
+
scrollX: number;
|
|
1652
|
+
scrollY: number;
|
|
1653
|
+
contextMenu: {
|
|
1654
|
+
items: import("../components/ContextMenu").ContextMenuItems;
|
|
1655
|
+
top: number;
|
|
1656
|
+
left: number;
|
|
1657
|
+
} | null;
|
|
1658
|
+
showWelcomeScreen: boolean;
|
|
1659
|
+
isLoading: boolean;
|
|
1660
|
+
errorMessage: import("react").ReactNode;
|
|
1661
|
+
activeIFrame: {
|
|
1662
|
+
element: import("../element/types").NonDeletedExcalidrawElement;
|
|
1663
|
+
state: "active" | "hover";
|
|
1664
|
+
} | null;
|
|
1665
|
+
draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
1666
|
+
resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
1667
|
+
multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
|
|
1668
|
+
selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
1669
|
+
isBindingEnabled: boolean;
|
|
1670
|
+
startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
|
|
1671
|
+
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
1672
|
+
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
|
|
1673
|
+
shouldRenderFrames: boolean;
|
|
1674
|
+
editingFrame: string | null;
|
|
1675
|
+
elementsToHighlight: import("../element/types").NonDeleted<ExcalidrawElement>[] | null;
|
|
1676
|
+
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
1677
|
+
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
1678
|
+
activeTool: {
|
|
1679
|
+
lastActiveTool: import("../types").LastActiveTool;
|
|
1680
|
+
locked: boolean;
|
|
1681
|
+
} & ({
|
|
1682
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "iframe" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
1683
|
+
customType: null;
|
|
1684
|
+
} | {
|
|
1685
|
+
type: "custom";
|
|
1686
|
+
customType: string;
|
|
1687
|
+
});
|
|
1688
|
+
penMode: boolean;
|
|
1689
|
+
penDetected: boolean;
|
|
1690
|
+
exportBackground: boolean;
|
|
1691
|
+
exportEmbedScene: boolean;
|
|
1692
|
+
exportWithDarkMode: boolean;
|
|
1693
|
+
exportScale: number;
|
|
1694
|
+
currentItemStrokeColor: string;
|
|
1695
|
+
currentItemBackgroundColor: string;
|
|
1696
|
+
currentItemFillStyle: import("../element/types").FillStyle;
|
|
1697
|
+
currentItemStrokeWidth: number;
|
|
1698
|
+
currentItemStrokeStyle: import("../element/types").StrokeStyle;
|
|
1699
|
+
currentItemRoughness: number;
|
|
1700
|
+
currentItemOpacity: number;
|
|
1701
|
+
currentItemFontFamily: number;
|
|
1702
|
+
currentItemFontSize: number;
|
|
1703
|
+
currentItemTextAlign: string;
|
|
1704
|
+
currentItemStartArrowhead: import("../element/types").Arrowhead | null;
|
|
1705
|
+
currentItemEndArrowhead: import("../element/types").Arrowhead | null;
|
|
1706
|
+
currentItemRoundness: import("../element/types").StrokeRoundness;
|
|
1707
|
+
viewBackgroundColor: string;
|
|
1708
|
+
cursorButton: "up" | "down";
|
|
1709
|
+
scrolledOutside: boolean;
|
|
1710
|
+
name: string;
|
|
1711
|
+
isResizing: boolean;
|
|
1712
|
+
isRotating: boolean;
|
|
1713
|
+
openMenu: "canvas" | "shape" | null;
|
|
1714
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
1715
|
+
openSidebar: {
|
|
1716
|
+
name: string;
|
|
1717
|
+
tab?: string | undefined;
|
|
1718
|
+
} | null;
|
|
1719
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
1720
|
+
defaultSidebarDockedPreference: boolean;
|
|
1721
|
+
lastPointerDownWith: import("../element/types").PointerType;
|
|
1722
|
+
selectedElementIds: {
|
|
1723
|
+
[id: string]: boolean;
|
|
1724
|
+
};
|
|
1725
|
+
previousSelectedElementIds: {
|
|
1726
|
+
[id: string]: boolean;
|
|
1727
|
+
};
|
|
1728
|
+
selectedElementsAreBeingDragged: boolean;
|
|
1729
|
+
shouldCacheIgnoreZoom: boolean;
|
|
1730
|
+
toast: {
|
|
1731
|
+
message: string;
|
|
1732
|
+
closable?: boolean | undefined;
|
|
1733
|
+
duration?: number | undefined;
|
|
1734
|
+
} | null;
|
|
1735
|
+
zenModeEnabled: boolean;
|
|
1736
|
+
theme: string;
|
|
1737
|
+
gridSize: number | null;
|
|
1738
|
+
previousGridSize: number | null;
|
|
1739
|
+
viewModeEnabled: boolean;
|
|
1740
|
+
selectedGroupIds: {
|
|
1741
|
+
[groupId: string]: boolean;
|
|
1742
|
+
};
|
|
1743
|
+
editingGroupId: string | null;
|
|
1744
|
+
width: number;
|
|
1745
|
+
height: number;
|
|
1746
|
+
offsetTop: number;
|
|
1747
|
+
offsetLeft: number;
|
|
1748
|
+
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
1749
|
+
collaborators: Map<string, import("../types").Collaborator>;
|
|
1750
|
+
showStats: boolean;
|
|
1751
|
+
currentChartType: import("../element/types").ChartType;
|
|
1752
|
+
pasteDialog: {
|
|
1753
|
+
shown: false;
|
|
1754
|
+
data: null;
|
|
1755
|
+
} | {
|
|
1756
|
+
shown: true;
|
|
1757
|
+
data: import("../charts").Spreadsheet;
|
|
1758
|
+
};
|
|
1759
|
+
pendingImageElementId: string | null;
|
|
1760
|
+
showHyperlinkPopup: false | "info" | "editor";
|
|
1761
|
+
linkOpacity: number;
|
|
1762
|
+
trayModeEnabled: boolean;
|
|
1763
|
+
colorPalette?: {
|
|
1764
|
+
canvasBackground: import("../colors").ColorPaletteCustom;
|
|
1765
|
+
elementBackground: import("../colors").ColorPaletteCustom;
|
|
1766
|
+
elementStroke: import("../colors").ColorPaletteCustom;
|
|
1767
|
+
topPicks: {
|
|
1768
|
+
canvasBackground: [string, string, string, string, string];
|
|
1769
|
+
elementStroke: [string, string, string, string, string];
|
|
1770
|
+
elementBackground: [string, string, string, string, string];
|
|
1771
|
+
};
|
|
1772
|
+
} | undefined;
|
|
1773
|
+
allowWheelZoom?: boolean | undefined;
|
|
1774
|
+
allowPinchZoom?: boolean | undefined;
|
|
1775
|
+
pinnedScripts?: string[] | undefined;
|
|
1776
|
+
customPens?: any[] | undefined;
|
|
1777
|
+
currentStrokeOptions?: any;
|
|
1778
|
+
resetCustomPen?: any;
|
|
1779
|
+
gridColor: string;
|
|
1780
|
+
dynamicStyle: string;
|
|
1781
|
+
invertBindingBehaviour: boolean;
|
|
1782
|
+
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
1783
|
+
};
|
|
1784
|
+
commitToHistory: boolean;
|
|
1785
|
+
};
|
package/types/actions/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type ActionResult = {
|
|
|
15
15
|
type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
16
16
|
export type UpdaterFn = (res: ActionResult) => void;
|
|
17
17
|
export type ActionFilterFn = (action: Action) => void;
|
|
18
|
-
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "
|
|
18
|
+
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "toggleFrameRendering" | "setFrameAsActiveTool" | "setIFrameAsActiveTool" | "createContainerFromText" | "wrapTextInContainer";
|
|
19
19
|
export type PanelComponentProps = {
|
|
20
20
|
elements: readonly ExcalidrawElement[];
|
|
21
21
|
appState: AppState;
|
|
@@ -52,6 +52,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
52
52
|
private excalidrawContainerValue;
|
|
53
53
|
files: BinaryFiles;
|
|
54
54
|
imageCache: AppClassProperties["imageCache"];
|
|
55
|
+
private iFrameRefs;
|
|
55
56
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
56
57
|
lastPointerDown: React.PointerEvent<HTMLElement> | null;
|
|
57
58
|
lastPointerUp: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
@@ -59,7 +60,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
59
60
|
x: number;
|
|
60
61
|
y: number;
|
|
61
62
|
};
|
|
62
|
-
private iFrameRefs;
|
|
63
63
|
allowMobileMode: boolean;
|
|
64
64
|
constructor(props: AppProps);
|
|
65
65
|
private renderCanvas;
|
|
@@ -68,6 +68,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
68
68
|
private getIFrameElementById;
|
|
69
69
|
private handleIFrameCenterClick;
|
|
70
70
|
private isIFrameCenter;
|
|
71
|
+
private updateIFrames;
|
|
71
72
|
private renderIFrames;
|
|
72
73
|
private getFrameNameDOMId;
|
|
73
74
|
frameNameBoundsCache: FrameNameBoundsCache;
|
|
@@ -122,6 +123,17 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
122
123
|
private cancelInProgresAnimation;
|
|
123
124
|
scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[], opts?: {
|
|
124
125
|
fitToContent?: boolean;
|
|
126
|
+
fitToViewport?: never;
|
|
127
|
+
viewportZoomFactor?: never;
|
|
128
|
+
animate?: boolean;
|
|
129
|
+
duration?: number;
|
|
130
|
+
} | {
|
|
131
|
+
fitToContent?: never;
|
|
132
|
+
fitToViewport?: boolean;
|
|
133
|
+
/** when fitToViewport=true, how much screen should the content cover,
|
|
134
|
+
* between 0.1 (10%) and 1 (100%)
|
|
135
|
+
*/
|
|
136
|
+
viewportZoomFactor?: number;
|
|
125
137
|
animate?: boolean;
|
|
126
138
|
duration?: number;
|
|
127
139
|
}) => void;
|
package/types/constants.d.ts
CHANGED
|
@@ -60,14 +60,14 @@ export declare enum EVENT {
|
|
|
60
60
|
MENU_ITEM_SELECT = "menu.itemSelect",
|
|
61
61
|
MESSAGE = "message"
|
|
62
62
|
}
|
|
63
|
-
export declare
|
|
64
|
-
UNSTARTED
|
|
65
|
-
ENDED
|
|
66
|
-
PLAYING
|
|
67
|
-
PAUSED
|
|
68
|
-
BUFFERING
|
|
69
|
-
CUED
|
|
70
|
-
}
|
|
63
|
+
export declare const YOUTUBE_STATES: {
|
|
64
|
+
readonly UNSTARTED: -1;
|
|
65
|
+
readonly ENDED: 0;
|
|
66
|
+
readonly PLAYING: 1;
|
|
67
|
+
readonly PAUSED: 2;
|
|
68
|
+
readonly BUFFERING: 3;
|
|
69
|
+
readonly CUED: 5;
|
|
70
|
+
};
|
|
71
71
|
export declare const ENV: {
|
|
72
72
|
TEST: string;
|
|
73
73
|
DEVELOPMENT: string;
|
|
@@ -14,8 +14,6 @@ export declare const Hyperlink: ({ element, setAppState, onLinkOpen, setToast, }
|
|
|
14
14
|
duration?: number;
|
|
15
15
|
} | null) => void;
|
|
16
16
|
}) => JSX.Element | null;
|
|
17
|
-
export declare const normalizeLink: (link: string) => string;
|
|
18
|
-
export declare const isLocalLink: (link: string | null | undefined) => boolean;
|
|
19
17
|
export declare const actionLink: {
|
|
20
18
|
name: "hyperlink";
|
|
21
19
|
perform: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => false | {
|
|
@@ -163,11 +163,5 @@ export declare const actionSetIFrameAsActiveTool: {
|
|
|
163
163
|
} & {
|
|
164
164
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
165
165
|
};
|
|
166
|
-
export declare
|
|
167
|
-
private static instance;
|
|
168
|
-
private validators;
|
|
169
|
-
private constructor();
|
|
170
|
-
static getInstance(validators?: RegExp[]): IFrameURLValidator;
|
|
171
|
-
run(url: string | null | undefined): boolean;
|
|
172
|
-
}
|
|
166
|
+
export declare const iframeURLValidator: (url: string | null | undefined, validateIFrame: ExcalidrawProps["validateIFrame"]) => boolean;
|
|
173
167
|
export {};
|
|
@@ -7,7 +7,7 @@ export declare const newElement: (opts: {
|
|
|
7
7
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
8
8
|
export declare const newIFrameElement: (opts: {
|
|
9
9
|
type: "iframe";
|
|
10
|
-
|
|
10
|
+
validated: boolean | undefined;
|
|
11
11
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawIFrameElement>;
|
|
12
12
|
export declare const newFrameElement: (opts: ElementConstructorOpts) => NonDeleted<ExcalidrawFrameElement>;
|
|
13
13
|
export declare const newTextElement: (opts: {
|
|
@@ -20,7 +20,6 @@ export declare const newTextElement: (opts: {
|
|
|
20
20
|
containerId?: ExcalidrawTextContainer["id"];
|
|
21
21
|
lineHeight?: ExcalidrawTextElement["lineHeight"];
|
|
22
22
|
strokeWidth?: ExcalidrawTextElement["strokeWidth"];
|
|
23
|
-
isFrameName?: boolean;
|
|
24
23
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
25
24
|
export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, text?: string) => {
|
|
26
25
|
x: number;
|
package/types/element/types.d.ts
CHANGED
|
@@ -74,7 +74,14 @@ export type ExcalidrawEllipseElement = _ExcalidrawElementBase & {
|
|
|
74
74
|
type: "ellipse";
|
|
75
75
|
};
|
|
76
76
|
export type ExcalidrawIFrameElement = _ExcalidrawElementBase & Readonly<{
|
|
77
|
-
|
|
77
|
+
/**
|
|
78
|
+
* indicates whether the iframe src (url) has been validated for rendering.
|
|
79
|
+
* nullish value indicates that the validation is pending. We reset the
|
|
80
|
+
* value on each restore (or url change) so that we can guarantee
|
|
81
|
+
* the validation came from a trusted source (the editor). Also because we
|
|
82
|
+
* may not have access to host-app supplied url validator during restore.
|
|
83
|
+
*/
|
|
84
|
+
validated?: boolean;
|
|
78
85
|
type: "iframe";
|
|
79
86
|
}>;
|
|
80
87
|
export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
package/types/keys.d.ts
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -306,8 +306,11 @@ export interface ExcalidrawProps {
|
|
|
306
306
|
onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
|
|
307
307
|
onScrollChange?: (scrollX: number, scrollY: number) => void;
|
|
308
308
|
children?: React.ReactNode;
|
|
309
|
-
|
|
309
|
+
validateIFrame?: boolean | RegExp | RegExp[] | ((link: string) => boolean | undefined);
|
|
310
310
|
renderCustomIFrame?: (element: NonDeletedExcalidrawElement, radius: number, appState: UIAppState) => JSX.Element | null;
|
|
311
|
+
renderWebview?: boolean;
|
|
312
|
+
renderIFrameMenu?: (//zsivzian
|
|
313
|
+
appState: AppState) => JSX.Element | null;
|
|
311
314
|
}
|
|
312
315
|
export type SceneData = {
|
|
313
316
|
elements?: ImportedDataState["elements"];
|
|
@@ -463,6 +466,7 @@ export type ExcalidrawImperativeAPI = {
|
|
|
463
466
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
464
467
|
resetCursor: InstanceType<typeof App>["resetCursor"];
|
|
465
468
|
toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
|
|
469
|
+
getIFrameElementById: InstanceType<typeof App>["getIFrameElementById"];
|
|
466
470
|
/**
|
|
467
471
|
* Disables rendering of frames (including element clipping), but currently
|
|
468
472
|
* the frames are still interactive in edit mode. As such, this API should be
|
package/types/utils.d.ts
CHANGED
|
@@ -30,25 +30,52 @@ export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void, op
|
|
|
30
30
|
cancel(): void;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
* callback through a requestAnimationFrame call
|
|
33
|
+
* Exponential ease-out method
|
|
35
34
|
*
|
|
36
|
-
*
|
|
35
|
+
* @param {number} k - The value to be tweened.
|
|
36
|
+
* @returns {number} The tweened value.
|
|
37
|
+
*/
|
|
38
|
+
export declare const easeOut: (k: number) => number;
|
|
39
|
+
/**
|
|
40
|
+
* Animates values from `fromValues` to `toValues` using the requestAnimationFrame API.
|
|
41
|
+
* Executes the `onStep` callback on each step with the interpolated values.
|
|
42
|
+
* Returns a function that can be called to cancel the animation.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Example usage:
|
|
46
|
+
* const fromValues = { x: 0, y: 0 };
|
|
47
|
+
* const toValues = { x: 100, y: 200 };
|
|
48
|
+
* const onStep = ({x, y}) => {
|
|
49
|
+
* setState(x, y)
|
|
50
|
+
* };
|
|
51
|
+
* const onCancel = () => {
|
|
52
|
+
* console.log("Animation canceled");
|
|
53
|
+
* };
|
|
37
54
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
55
|
+
* const cancelAnimation = easeToValuesRAF({
|
|
56
|
+
* fromValues,
|
|
57
|
+
* toValues,
|
|
58
|
+
* onStep,
|
|
59
|
+
* onCancel,
|
|
60
|
+
* });
|
|
42
61
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* @param callback The callback receiving the values
|
|
46
|
-
* @param opts default to 250ms duration and the easeOut function
|
|
62
|
+
* // To cancel the animation:
|
|
63
|
+
* cancelAnimation();
|
|
47
64
|
*/
|
|
48
|
-
export declare const easeToValuesRAF: (fromValues
|
|
65
|
+
export declare const easeToValuesRAF: <T extends Record<keyof T, number>, K extends keyof T>({ fromValues, toValues, onStep, duration, interpolateValue, onStart, onEnd, onCancel, }: {
|
|
66
|
+
fromValues: T;
|
|
67
|
+
toValues: T;
|
|
68
|
+
/**
|
|
69
|
+
* Interpolate a single value.
|
|
70
|
+
* Return undefined to be handled by the default interpolator.
|
|
71
|
+
*/
|
|
72
|
+
interpolateValue?: ((fromValue: number, toValue: number, progress: number, key: K) => number | undefined) | undefined;
|
|
73
|
+
onStep: (values: T) => void;
|
|
49
74
|
duration?: number | undefined;
|
|
50
|
-
|
|
51
|
-
|
|
75
|
+
onStart?: (() => void) | undefined;
|
|
76
|
+
onEnd?: (() => void) | undefined;
|
|
77
|
+
onCancel?: (() => void) | undefined;
|
|
78
|
+
}) => () => void;
|
|
52
79
|
export declare const chunk: <T extends unknown>(array: readonly T[], size: number) => T[][];
|
|
53
80
|
export declare const selectNode: (node: Element) => void;
|
|
54
81
|
export declare const removeSelection: () => void;
|