@zsviczian/excalidraw 0.15.2-obsidian-7 → 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 (45) hide show
  1. package/dist/excalidraw.development.js +50 -50
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +1 -1
  4. package/types/actions/actionAddToLibrary.d.ts +27 -12
  5. package/types/actions/actionAlign.d.ts +19 -19
  6. package/types/actions/actionBoundText.d.ts +24 -14
  7. package/types/actions/actionCanvas.d.ts +120 -60
  8. package/types/actions/actionClipboard.d.ts +47 -22
  9. package/types/actions/actionDeleteSelected.d.ts +27 -12
  10. package/types/actions/actionDistribute.d.ts +5 -5
  11. package/types/actions/actionElementLock.d.ts +23 -13
  12. package/types/actions/actionExport.d.ts +82 -36
  13. package/types/actions/actionFinalize.d.ts +18 -11
  14. package/types/actions/actionFlip.d.ts +2 -2
  15. package/types/actions/actionFrame.d.ts +35 -20
  16. package/types/actions/actionGroup.d.ts +5 -5
  17. package/types/actions/actionLinearEditor.d.ts +11 -6
  18. package/types/actions/actionMenu.d.ts +27 -12
  19. package/types/actions/actionProperties.d.ts +117 -52
  20. package/types/actions/actionStyles.d.ts +9 -4
  21. package/types/actions/actionToggleGridMode.d.ts +9 -4
  22. package/types/actions/actionToggleStats.d.ts +9 -4
  23. package/types/actions/actionToggleViewMode.d.ts +9 -4
  24. package/types/actions/actionToggleZenMode.d.ts +9 -4
  25. package/types/actions/types.d.ts +4 -3
  26. package/types/appState.d.ts +2 -2
  27. package/types/components/App.d.ts +13 -8
  28. package/types/components/HintViewer.d.ts +3 -4
  29. package/types/components/LayerUI.d.ts +2 -1
  30. package/types/components/MobileMenu.d.ts +3 -2
  31. package/types/constants.d.ts +2 -2
  32. package/types/data/url.d.ts +5 -0
  33. package/types/element/Hyperlink.d.ts +9 -4
  34. package/types/element/collision.d.ts +2 -2
  35. package/types/element/embeddable.d.ts +176 -0
  36. package/types/element/linearElementEditor.d.ts +9 -4
  37. package/types/element/newElement.d.ts +4 -4
  38. package/types/element/typeChecks.d.ts +4 -4
  39. package/types/element/types.d.ts +6 -6
  40. package/types/frame.d.ts +2 -2
  41. package/types/groups.d.ts +3 -3
  42. package/types/scene/Scene.d.ts +13 -0
  43. package/types/types.d.ts +15 -10
  44. package/types/utility-types.d.ts +2 -0
  45. package/types/utils.d.ts +1 -1
@@ -17,7 +17,7 @@ export declare const actionToggleViewMode: {
17
17
  showWelcomeScreen: boolean;
18
18
  isLoading: boolean;
19
19
  errorMessage: import("react").ReactNode;
20
- activeIFrame: {
20
+ activeEmbeddable: {
21
21
  element: import("../element/types").NonDeletedExcalidrawElement;
22
22
  state: "active" | "hover";
23
23
  } | null;
@@ -29,7 +29,12 @@ export declare const actionToggleViewMode: {
29
29
  startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
30
30
  suggestedBindings: import("../element/binding").SuggestedBinding[];
31
31
  frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
32
- shouldRenderFrames: boolean;
32
+ frameRendering: {
33
+ enabled: boolean;
34
+ name: boolean;
35
+ outline: boolean;
36
+ clip: boolean;
37
+ };
33
38
  editingFrame: string | null;
34
39
  elementsToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | null;
35
40
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
@@ -38,7 +43,7 @@ export declare const actionToggleViewMode: {
38
43
  lastActiveTool: import("../types").LastActiveTool;
39
44
  locked: boolean;
40
45
  } & ({
41
- type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "iframe" | "image" | "frame" | "freedraw" | "eraser" | "hand";
46
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
42
47
  customType: null;
43
48
  } | {
44
49
  type: "custom";
@@ -97,7 +102,7 @@ export declare const actionToggleViewMode: {
97
102
  duration?: number | undefined;
98
103
  } | null;
99
104
  zenModeEnabled: boolean;
100
- theme: string;
105
+ theme: import("../element/types").Theme;
101
106
  gridSize: number | null;
102
107
  previousGridSize: number | null;
103
108
  selectedGroupIds: {
@@ -17,7 +17,7 @@ export declare const actionToggleZenMode: {
17
17
  showWelcomeScreen: boolean;
18
18
  isLoading: boolean;
19
19
  errorMessage: import("react").ReactNode;
20
- activeIFrame: {
20
+ activeEmbeddable: {
21
21
  element: import("../element/types").NonDeletedExcalidrawElement;
22
22
  state: "active" | "hover";
23
23
  } | null;
@@ -29,7 +29,12 @@ export declare const actionToggleZenMode: {
29
29
  startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
30
30
  suggestedBindings: import("../element/binding").SuggestedBinding[];
31
31
  frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
32
- shouldRenderFrames: boolean;
32
+ frameRendering: {
33
+ enabled: boolean;
34
+ name: boolean;
35
+ outline: boolean;
36
+ clip: boolean;
37
+ };
33
38
  editingFrame: string | null;
34
39
  elementsToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | null;
35
40
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
@@ -38,7 +43,7 @@ export declare const actionToggleZenMode: {
38
43
  lastActiveTool: import("../types").LastActiveTool;
39
44
  locked: boolean;
40
45
  } & ({
41
- type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "iframe" | "image" | "frame" | "freedraw" | "eraser" | "hand";
46
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
42
47
  customType: null;
43
48
  } | {
44
49
  type: "custom";
@@ -96,7 +101,7 @@ export declare const actionToggleZenMode: {
96
101
  closable?: boolean | undefined;
97
102
  duration?: number | undefined;
98
103
  } | null;
99
- theme: string;
104
+ theme: import("../element/types").Theme;
100
105
  gridSize: number | null;
101
106
  previousGridSize: number | null;
102
107
  viewModeEnabled: boolean;
@@ -15,21 +15,22 @@ 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" | "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";
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" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer";
19
19
  export type PanelComponentProps = {
20
20
  elements: readonly ExcalidrawElement[];
21
21
  appState: AppState;
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,13 +1,13 @@
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;
8
8
  locked: boolean;
9
9
  } & ({
10
- type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "iframe" | "image" | "frame" | "freedraw" | "eraser" | "hand";
10
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
11
11
  customType: null;
12
12
  } | {
13
13
  type: "custom";
@@ -64,12 +64,12 @@ declare class App extends React.Component<AppProps, AppState> {
64
64
  constructor(props: AppProps);
65
65
  private renderCanvas;
66
66
  private onWindowMessage;
67
- private updateIFrameRef;
68
- private getIFrameElementById;
69
- private handleIFrameCenterClick;
70
- private isIFrameCenter;
71
- private updateIFrames;
72
- private renderIFrames;
67
+ private updateEmbeddableRef;
68
+ private getHTMLIFrameElement;
69
+ private handleEmbeddableCenterClick;
70
+ private isEmbeddableCenter;
71
+ private updateEmbeddables;
72
+ private renderEmbeddables;
73
73
  private getFrameNameDOMId;
74
74
  frameNameBoundsCache: FrameNameBoundsCache;
75
75
  private renderFrameNames;
@@ -113,7 +113,12 @@ declare class App extends React.Component<AppProps, AppState> {
113
113
  setAppState: React.Component<any, AppState>["setState"];
114
114
  removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
115
115
  toggleLock: (source?: "keyboard" | "ui") => void;
116
- toggleFrameRendering: () => void;
116
+ updateFrameRendering: (opts: Partial<{
117
+ enabled: boolean;
118
+ name: boolean;
119
+ outline: boolean;
120
+ clip: boolean;
121
+ }> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
117
122
  togglePenMode: () => void;
118
123
  onHandToolToggle: () => void;
119
124
  /**
@@ -222,7 +227,7 @@ declare class App extends React.Component<AppProps, AppState> {
222
227
  private isHittingCommonBoundingBoxOfSelectedElements;
223
228
  private handleTextOnPointerDown;
224
229
  private handleFreeDrawElementOnPointerDown;
225
- private insertIFrameElement;
230
+ private insertEmbeddableElement;
226
231
  private createImageElement;
227
232
  private handleLinearElementOnPointerDown;
228
233
  private getCurrentItemRoundness;
@@ -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;
@@ -29,7 +29,7 @@ export declare const actionLink: {
29
29
  showWelcomeScreen: boolean;
30
30
  isLoading: boolean;
31
31
  errorMessage: import("react").ReactNode;
32
- activeIFrame: {
32
+ activeEmbeddable: {
33
33
  element: NonDeletedExcalidrawElement;
34
34
  state: "active" | "hover";
35
35
  } | null;
@@ -41,7 +41,12 @@ export declare const actionLink: {
41
41
  startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
42
42
  suggestedBindings: import("./binding").SuggestedBinding[];
43
43
  frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameElement> | null;
44
- shouldRenderFrames: boolean;
44
+ frameRendering: {
45
+ enabled: boolean;
46
+ name: boolean;
47
+ outline: boolean;
48
+ clip: boolean;
49
+ };
45
50
  editingFrame: string | null;
46
51
  elementsToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawElement>[] | null;
47
52
  editingElement: NonDeletedExcalidrawElement | null;
@@ -50,7 +55,7 @@ export declare const actionLink: {
50
55
  lastActiveTool: import("../types").LastActiveTool;
51
56
  locked: boolean;
52
57
  } & ({
53
- type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "iframe" | "image" | "frame" | "freedraw" | "eraser" | "hand";
58
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
54
59
  customType: null;
55
60
  } | {
56
61
  type: "custom";
@@ -108,7 +113,7 @@ export declare const actionLink: {
108
113
  duration?: number | undefined;
109
114
  } | null;
110
115
  zenModeEnabled: boolean;
111
- theme: string;
116
+ theme: import("./types").Theme;
112
117
  gridSize: number | null;
113
118
  previousGridSize: number | null;
114
119
  viewModeEnabled: boolean;
@@ -1,5 +1,5 @@
1
1
  import * as GA from "../ga";
2
- import { NonDeletedExcalidrawElement, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawRectangleElement, ExcalidrawIFrameElement, ExcalidrawDiamondElement, ExcalidrawTextElement, ExcalidrawEllipseElement, NonDeleted, ExcalidrawImageElement, ExcalidrawFrameElement } from "./types";
2
+ import { NonDeletedExcalidrawElement, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawRectangleElement, ExcalidrawEmbeddableElement, ExcalidrawDiamondElement, ExcalidrawTextElement, ExcalidrawEllipseElement, NonDeleted, ExcalidrawImageElement, ExcalidrawFrameElement } from "./types";
3
3
  import { FrameNameBoundsCache, Point } from "../types";
4
4
  import { AppState } from "../types";
5
5
  export declare const hitTest: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number) => boolean;
@@ -18,4 +18,4 @@ export declare const determineFocusPoint: (element: ExcalidrawBindableElement, f
18
18
  export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap?: number) => Point[];
19
19
  export declare const getCircleIntersections: (center: readonly [number, number, number, number, number, number, number, number], radius: number, line: readonly [number, number, number, number, number, number, number, number]) => GA.Point[];
20
20
  export declare const findFocusPointForEllipse: (ellipse: ExcalidrawEllipseElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
21
- export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement | ExcalidrawIFrameElement | ExcalidrawFrameElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
21
+ export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
@@ -0,0 +1,176 @@
1
+ /// <reference types="react" />
2
+ import { ExcalidrawProps } from "../types";
3
+ import { ExcalidrawElement, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement, Theme } from "./types";
4
+ type EmbeddedLink = ({
5
+ aspectRatio: {
6
+ w: number;
7
+ h: number;
8
+ };
9
+ warning?: string;
10
+ } & ({
11
+ type: "video" | "generic";
12
+ link: string;
13
+ } | {
14
+ type: "document";
15
+ srcdoc: (theme: Theme) => string;
16
+ })) | null;
17
+ export declare const getEmbedLink: (link: string | null | undefined) => EmbeddedLink;
18
+ export declare const isEmbeddableOrFrameLabel: (element: NonDeletedExcalidrawElement) => Boolean;
19
+ export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawEmbeddableElement) => ExcalidrawElement;
20
+ export declare const actionSetEmbeddableAsActiveTool: {
21
+ name: "setEmbeddableAsActiveTool";
22
+ trackEvent: {
23
+ category: "toolbar";
24
+ };
25
+ perform: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties) => {
26
+ elements: readonly ExcalidrawElement[];
27
+ appState: {
28
+ activeTool: {
29
+ lastActiveTool: import("../types").LastActiveTool;
30
+ locked: boolean;
31
+ } & ({
32
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
33
+ customType: null;
34
+ } | {
35
+ type: "custom";
36
+ customType: string;
37
+ });
38
+ contextMenu: {
39
+ items: import("../components/ContextMenu").ContextMenuItems;
40
+ top: number;
41
+ left: number;
42
+ } | null;
43
+ showWelcomeScreen: boolean;
44
+ isLoading: boolean;
45
+ errorMessage: import("react").ReactNode;
46
+ activeEmbeddable: {
47
+ element: NonDeletedExcalidrawElement;
48
+ state: "active" | "hover";
49
+ } | null;
50
+ draggingElement: NonDeletedExcalidrawElement | null;
51
+ resizingElement: NonDeletedExcalidrawElement | null;
52
+ multiElement: import("./types").NonDeleted<import("./types").ExcalidrawLinearElement> | null;
53
+ selectionElement: NonDeletedExcalidrawElement | null;
54
+ isBindingEnabled: boolean;
55
+ startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
56
+ suggestedBindings: import("./binding").SuggestedBinding[];
57
+ frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameElement> | null;
58
+ frameRendering: {
59
+ enabled: boolean;
60
+ name: boolean;
61
+ outline: boolean;
62
+ clip: boolean;
63
+ };
64
+ editingFrame: string | null;
65
+ elementsToHighlight: import("./types").NonDeleted<ExcalidrawElement>[] | null;
66
+ editingElement: NonDeletedExcalidrawElement | null;
67
+ editingLinearElement: import("./linearElementEditor").LinearElementEditor | null;
68
+ penMode: boolean;
69
+ penDetected: boolean;
70
+ exportBackground: boolean;
71
+ exportEmbedScene: boolean;
72
+ exportWithDarkMode: boolean;
73
+ exportScale: number;
74
+ currentItemStrokeColor: string;
75
+ currentItemBackgroundColor: string;
76
+ currentItemFillStyle: import("./types").FillStyle;
77
+ currentItemStrokeWidth: number;
78
+ currentItemStrokeStyle: import("./types").StrokeStyle;
79
+ currentItemRoughness: number;
80
+ currentItemOpacity: number;
81
+ currentItemFontFamily: number;
82
+ currentItemFontSize: number;
83
+ currentItemTextAlign: string;
84
+ currentItemStartArrowhead: import("./types").Arrowhead | null;
85
+ currentItemEndArrowhead: import("./types").Arrowhead | null;
86
+ currentItemRoundness: import("./types").StrokeRoundness;
87
+ viewBackgroundColor: string;
88
+ scrollX: number;
89
+ scrollY: number;
90
+ cursorButton: "up" | "down";
91
+ scrolledOutside: boolean;
92
+ name: string;
93
+ isResizing: boolean;
94
+ isRotating: boolean;
95
+ zoom: Readonly<{
96
+ value: import("../types").NormalizedZoomValue;
97
+ }>;
98
+ openMenu: "canvas" | "shape" | null;
99
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
100
+ openSidebar: {
101
+ name: string;
102
+ tab?: string | undefined;
103
+ } | null;
104
+ openDialog: "imageExport" | "help" | "jsonExport" | null;
105
+ defaultSidebarDockedPreference: boolean;
106
+ lastPointerDownWith: import("./types").PointerType;
107
+ selectedElementIds: Readonly<{
108
+ [id: string]: true;
109
+ }>;
110
+ previousSelectedElementIds: {
111
+ [id: string]: true;
112
+ };
113
+ selectedElementsAreBeingDragged: boolean;
114
+ shouldCacheIgnoreZoom: boolean;
115
+ toast: {
116
+ message: string;
117
+ closable?: boolean | undefined;
118
+ duration?: number | undefined;
119
+ } | null;
120
+ zenModeEnabled: boolean;
121
+ theme: Theme;
122
+ gridSize: number | null;
123
+ previousGridSize: number | null;
124
+ viewModeEnabled: boolean;
125
+ selectedGroupIds: {
126
+ [groupId: string]: boolean;
127
+ };
128
+ editingGroupId: string | null;
129
+ width: number;
130
+ height: number;
131
+ offsetTop: number;
132
+ offsetLeft: number;
133
+ fileHandle: import("browser-fs-access").FileSystemHandle | null;
134
+ collaborators: Map<string, import("../types").Collaborator>;
135
+ showStats: boolean;
136
+ currentChartType: import("./types").ChartType;
137
+ pasteDialog: {
138
+ shown: false;
139
+ data: null;
140
+ } | {
141
+ shown: true;
142
+ data: import("../charts").Spreadsheet;
143
+ };
144
+ pendingImageElementId: string | null;
145
+ showHyperlinkPopup: false | "info" | "editor";
146
+ linkOpacity: number;
147
+ trayModeEnabled: boolean;
148
+ colorPalette?: {
149
+ canvasBackground: import("../colors").ColorPaletteCustom;
150
+ elementBackground: import("../colors").ColorPaletteCustom;
151
+ elementStroke: import("../colors").ColorPaletteCustom;
152
+ topPicks: {
153
+ canvasBackground: [string, string, string, string, string];
154
+ elementStroke: [string, string, string, string, string];
155
+ elementBackground: [string, string, string, string, string];
156
+ };
157
+ } | undefined;
158
+ allowWheelZoom?: boolean | undefined;
159
+ allowPinchZoom?: boolean | undefined;
160
+ pinnedScripts?: string[] | undefined;
161
+ customPens?: any[] | undefined;
162
+ currentStrokeOptions?: any;
163
+ resetCustomPen?: any;
164
+ gridColor: string;
165
+ dynamicStyle: string;
166
+ invertBindingBehaviour: boolean;
167
+ selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
168
+ };
169
+ commitToHistory: false;
170
+ };
171
+ } & {
172
+ keyTest?: undefined;
173
+ };
174
+ export declare const extractSrc: (htmlString: string) => string;
175
+ export declare const embeddableURLValidator: (url: string | null | undefined, validateEmbeddable: ExcalidrawProps["validateEmbeddable"]) => boolean;
176
+ export {};
@@ -131,7 +131,7 @@ export declare class LinearElementEditor {
131
131
  showWelcomeScreen: boolean;
132
132
  isLoading: boolean;
133
133
  errorMessage: import("react").ReactNode;
134
- activeIFrame: {
134
+ activeEmbeddable: {
135
135
  element: import("./types").NonDeletedExcalidrawElement;
136
136
  state: "active" | "hover";
137
137
  } | null;
@@ -143,7 +143,12 @@ export declare class LinearElementEditor {
143
143
  startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
144
144
  suggestedBindings: import("./binding").SuggestedBinding[];
145
145
  frameToHighlight: NonDeleted<import("./types").ExcalidrawFrameElement> | null;
146
- shouldRenderFrames: boolean;
146
+ frameRendering: {
147
+ enabled: boolean;
148
+ name: boolean;
149
+ outline: boolean;
150
+ clip: boolean;
151
+ };
147
152
  editingFrame: string | null;
148
153
  elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
149
154
  editingElement: import("./types").NonDeletedExcalidrawElement | null;
@@ -151,7 +156,7 @@ export declare class LinearElementEditor {
151
156
  lastActiveTool: import("../types").LastActiveTool;
152
157
  locked: boolean;
153
158
  } & ({
154
- type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "iframe" | "image" | "frame" | "freedraw" | "eraser" | "hand";
159
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
155
160
  customType: null;
156
161
  } | {
157
162
  type: "custom";
@@ -210,7 +215,7 @@ export declare class LinearElementEditor {
210
215
  duration?: number | undefined;
211
216
  } | null;
212
217
  zenModeEnabled: boolean;
213
- theme: string;
218
+ theme: import("./types").Theme;
214
219
  gridSize: number | null;
215
220
  previousGridSize: number | null;
216
221
  viewModeEnabled: boolean;
@@ -1,14 +1,14 @@
1
- import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawIFrameElement } from "../element/types";
1
+ import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement } from "../element/types";
2
2
  import { AppState } from "../types";
3
3
  import { MarkOptional, Mutable } from "../utility-types";
4
4
  type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
5
5
  export declare const newElement: (opts: {
6
6
  type: ExcalidrawGenericElement["type"];
7
7
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
8
- export declare const newIFrameElement: (opts: {
9
- type: "iframe";
8
+ export declare const newEmbeddableElement: (opts: {
9
+ type: "embeddable";
10
10
  validated: boolean | undefined;
11
- } & ElementConstructorOpts) => NonDeleted<ExcalidrawIFrameElement>;
11
+ } & ElementConstructorOpts) => NonDeleted<ExcalidrawEmbeddableElement>;
12
12
  export declare const newFrameElement: (opts: ElementConstructorOpts) => NonDeleted<ExcalidrawFrameElement>;
13
13
  export declare const newTextElement: (opts: {
14
14
  text: string;
@@ -1,19 +1,19 @@
1
1
  import { AppState } from "../types";
2
2
  import { MarkNonNullable } from "../utility-types";
3
- import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawIFrameElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType } from "./types";
3
+ import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType } from "./types";
4
4
  export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
5
5
  export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
6
6
  export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
7
- export declare const isIFrameElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawIFrameElement;
7
+ export declare const isEmbeddableElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawEmbeddableElement;
8
8
  export declare const isTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawTextElement;
9
9
  export declare const isFrameElement: (element: ExcalidrawElement | null) => element is ExcalidrawFrameElement;
10
10
  export declare const isFreeDrawElement: (element?: ExcalidrawElement | null) => element is ExcalidrawFreeDrawElement;
11
11
  export declare const isFreeDrawElementType: (elementType: ExcalidrawElement["type"]) => boolean;
12
12
  export declare const isLinearElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
13
13
  export declare const isArrowElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
14
- export declare const isLinearElementType: (elementType: AppState["activeTool"]["type"] | "iframe") => boolean;
14
+ export declare const isLinearElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
15
15
  export declare const isBindingElement: (element?: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawLinearElement;
16
- export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"] | "iframe") => boolean;
16
+ export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
17
17
  export declare const isBindableElement: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawBindableElement;
18
18
  export declare const isTextBindableContainer: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawTextContainer;
19
19
  export declare const isExcalidrawElement: (element: any) => boolean;
@@ -73,16 +73,16 @@ export type ExcalidrawDiamondElement = _ExcalidrawElementBase & {
73
73
  export type ExcalidrawEllipseElement = _ExcalidrawElementBase & {
74
74
  type: "ellipse";
75
75
  };
76
- export type ExcalidrawIFrameElement = _ExcalidrawElementBase & Readonly<{
76
+ export type ExcalidrawEmbeddableElement = _ExcalidrawElementBase & Readonly<{
77
77
  /**
78
- * indicates whether the iframe src (url) has been validated for rendering.
78
+ * indicates whether the embeddable src (url) has been validated for rendering.
79
79
  * nullish value indicates that the validation is pending. We reset the
80
80
  * value on each restore (or url change) so that we can guarantee
81
81
  * the validation came from a trusted source (the editor). Also because we
82
82
  * may not have access to host-app supplied url validator during restore.
83
83
  */
84
84
  validated?: boolean;
85
- type: "iframe";
85
+ type: "embeddable";
86
86
  }>;
87
87
  export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
88
88
  type: "image";
@@ -100,7 +100,7 @@ export type ExcalidrawFrameElement = _ExcalidrawElementBase & {
100
100
  /**
101
101
  * These are elements that don't have any additional properties.
102
102
  */
103
- export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRectangleElement | ExcalidrawIFrameElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
103
+ export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRectangleElement | ExcalidrawEmbeddableElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
104
104
  /**
105
105
  * ExcalidrawElement should be JSON serializable and (eventually) contain
106
106
  * no computed data. The list of all ExcalidrawElements should be shareable
@@ -130,8 +130,8 @@ export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
130
130
  _brand: "unitlessLineHeight";
131
131
  };
132
132
  }>;
133
- export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawIFrameElement | ExcalidrawFrameElement;
134
- export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawArrowElement | ExcalidrawIFrameElement;
133
+ export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement;
134
+ export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawArrowElement;
135
135
  export type ExcalidrawTextElementWithContainer = {
136
136
  containerId: ExcalidrawTextContainer["id"];
137
137
  } & ExcalidrawTextElement;
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