@zsviczian/excalidraw 0.15.2-obsidian-3 → 0.15.2-obsidian-5

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 (90) hide show
  1. package/README.md +4 -0
  2. package/dist/excalidraw.development.js +333 -171
  3. package/dist/excalidraw.production.min.js +1 -1
  4. package/dist/excalidraw.production.min.js.LICENSE.txt +2 -0
  5. package/package.json +1 -1
  6. package/types/actions/actionAddToLibrary.d.ts +30 -3
  7. package/types/actions/actionAlign.d.ts +12 -6
  8. package/types/actions/actionBoundText.d.ts +21 -3
  9. package/types/actions/actionCanvas.d.ts +94 -10
  10. package/types/actions/actionClipboard.d.ts +47 -5
  11. package/types/actions/actionDeleteSelected.d.ts +27 -3
  12. package/types/actions/actionDistribute.d.ts +2 -2
  13. package/types/actions/actionElementLock.d.ts +21 -2
  14. package/types/actions/actionExport.d.ts +90 -9
  15. package/types/actions/actionFinalize.d.ts +20 -2
  16. package/types/actions/actionFlip.d.ts +2 -2
  17. package/types/actions/actionFrame.d.ts +475 -0
  18. package/types/actions/actionGroup.d.ts +2 -2
  19. package/types/actions/actionLinearEditor.d.ts +10 -1
  20. package/types/actions/actionMenu.d.ts +30 -3
  21. package/types/actions/actionNavigate.d.ts +1 -1
  22. package/types/actions/actionProperties.d.ts +130 -13
  23. package/types/actions/actionStyles.d.ts +10 -1
  24. package/types/actions/actionToggleGridMode.d.ts +10 -1
  25. package/types/actions/actionToggleStats.d.ts +10 -1
  26. package/types/actions/actionToggleViewMode.d.ts +10 -1
  27. package/types/actions/actionToggleZenMode.d.ts +10 -1
  28. package/types/actions/actionZindex.d.ts +4 -4
  29. package/types/actions/types.d.ts +1 -1
  30. package/types/appState.d.ts +1 -1
  31. package/types/clients.d.ts +1 -5
  32. package/types/colors.d.ts +1 -0
  33. package/types/components/ActiveConfirmDialog.d.ts +1 -21
  34. package/types/components/App.d.ts +20 -4
  35. package/types/components/Avatar.d.ts +0 -1
  36. package/types/components/ColorPicker/ColorInput.d.ts +1 -1
  37. package/types/components/ColorPicker/ColorPicker.d.ts +3 -2
  38. package/types/components/ColorPicker/CustomColorList.d.ts +1 -1
  39. package/types/components/ColorPicker/Picker.d.ts +4 -2
  40. package/types/components/ColorPicker/PickerColorList.d.ts +1 -1
  41. package/types/components/ColorPicker/ShadeList.d.ts +1 -1
  42. package/types/components/ColorPicker/TopPicks.d.ts +1 -1
  43. package/types/components/ColorPicker/colorPickerUtils.d.ts +4 -24
  44. package/types/components/ColorPicker/keyboardNavHandlers.d.ts +8 -3
  45. package/types/components/Dialog.d.ts +2 -3
  46. package/types/components/EyeDropper.d.ts +18 -0
  47. package/types/components/FilledButton.d.ts +2 -1
  48. package/types/components/LibraryMenu.d.ts +1 -21
  49. package/types/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
  50. package/types/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
  51. package/types/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
  52. package/types/components/Sidebar/Sidebar.d.ts +1 -21
  53. package/types/components/ToolButton.d.ts +2 -1
  54. package/types/components/dropdownMenu/DropdownMenu.d.ts +3 -2
  55. package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +4 -2
  56. package/types/components/icons.d.ts +5 -0
  57. package/types/components/main-menu/MainMenu.d.ts +3 -2
  58. package/types/constants.d.ts +24 -1
  59. package/types/context/tunnels.d.ts +1 -0
  60. package/types/data/library.d.ts +1 -45
  61. package/types/element/Hyperlink.d.ts +21 -6
  62. package/types/element/binding.d.ts +1 -1
  63. package/types/element/bounds.d.ts +31 -6
  64. package/types/element/collision.d.ts +7 -7
  65. package/types/element/dragElements.d.ts +2 -1
  66. package/types/element/iframe.d.ts +173 -0
  67. package/types/element/index.d.ts +3 -2
  68. package/types/element/linearElementEditor.d.ts +11 -2
  69. package/types/element/newElement.d.ts +8 -2
  70. package/types/element/transformHandles.d.ts +8 -1
  71. package/types/element/typeChecks.d.ts +5 -3
  72. package/types/element/types.d.ts +13 -4
  73. package/types/frame.d.ts +40 -0
  74. package/types/groups.d.ts +4 -0
  75. package/types/hooks/useCreatePortalContainer.d.ts +5 -0
  76. package/types/hooks/useLibraryItemSvg.d.ts +1 -21
  77. package/types/hooks/useOutsideClick.d.ts +19 -1
  78. package/types/jotai.d.ts +16 -104
  79. package/types/keys.d.ts +2 -0
  80. package/types/math.d.ts +1 -0
  81. package/types/packages/excalidraw/example/initialData.d.ts +6 -0
  82. package/types/renderer/renderElement.d.ts +3 -2
  83. package/types/renderer/renderScene.d.ts +12 -3
  84. package/types/renderer/roundRect.d.ts +1 -1
  85. package/types/scene/Scene.d.ts +8 -1
  86. package/types/scene/export.d.ts +1 -0
  87. package/types/scene/selection.d.ts +13 -3
  88. package/types/types.d.ts +35 -3
  89. package/types/utils.d.ts +5 -2
  90. package/types/zindex.d.ts +4 -4
@@ -17,6 +17,10 @@ export declare const actionToggleZenMode: {
17
17
  showWelcomeScreen: boolean;
18
18
  isLoading: boolean;
19
19
  errorMessage: import("react").ReactNode;
20
+ activeIFrame: {
21
+ element: import("../element/types").NonDeletedExcalidrawElement;
22
+ state: "active" | "hover";
23
+ } | null;
20
24
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
21
25
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
22
26
  multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
@@ -24,13 +28,17 @@ export declare const actionToggleZenMode: {
24
28
  isBindingEnabled: boolean;
25
29
  startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
26
30
  suggestedBindings: import("../element/binding").SuggestedBinding[];
31
+ frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
32
+ shouldRenderFrames: boolean;
33
+ editingFrame: string | null;
34
+ elementsToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | null;
27
35
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
28
36
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
29
37
  activeTool: {
30
38
  lastActiveTool: import("../types").LastActiveTool;
31
39
  locked: boolean;
32
40
  } & ({
33
- type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | "hand";
41
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "iframe" | "image" | "frame" | "freedraw" | "eraser" | "hand";
34
42
  customType: null;
35
43
  } | {
36
44
  type: "custom";
@@ -81,6 +89,7 @@ export declare const actionToggleZenMode: {
81
89
  previousSelectedElementIds: {
82
90
  [id: string]: boolean;
83
91
  };
92
+ selectedElementsAreBeingDragged: boolean;
84
93
  shouldCacheIgnoreZoom: boolean;
85
94
  toast: {
86
95
  message: string;
@@ -5,7 +5,7 @@ export declare const actionSendBackward: {
5
5
  category: "element";
6
6
  };
7
7
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
8
- elements: (import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawSelectionElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement)[];
8
+ elements: import("../element/types").ExcalidrawElement[];
9
9
  appState: Readonly<import("../types").AppState>;
10
10
  commitToHistory: true;
11
11
  };
@@ -22,7 +22,7 @@ export declare const actionBringForward: {
22
22
  category: "element";
23
23
  };
24
24
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
25
- elements: (import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawSelectionElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement)[];
25
+ elements: import("../element/types").ExcalidrawElement[];
26
26
  appState: Readonly<import("../types").AppState>;
27
27
  commitToHistory: true;
28
28
  };
@@ -39,7 +39,7 @@ export declare const actionSendToBack: {
39
39
  category: "element";
40
40
  };
41
41
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
42
- elements: readonly import("../element/types").ExcalidrawElement[];
42
+ elements: import("../element/types").ExcalidrawElement[];
43
43
  appState: Readonly<import("../types").AppState>;
44
44
  commitToHistory: true;
45
45
  };
@@ -55,7 +55,7 @@ export declare const actionBringToFront: {
55
55
  category: "element";
56
56
  };
57
57
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
58
- elements: readonly import("../element/types").ExcalidrawElement[];
58
+ elements: import("../element/types").ExcalidrawElement[];
59
59
  appState: Readonly<import("../types").AppState>;
60
60
  commitToHistory: true;
61
61
  };
@@ -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" | "zoomToSelection" | "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" | "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" | "zoomToSelection" | "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;
@@ -7,7 +7,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
7
7
  lastActiveTool: import("./types").LastActiveTool;
8
8
  locked: boolean;
9
9
  } & ({
10
- type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | "hand";
10
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "iframe" | "image" | "frame" | "freedraw" | "eraser" | "hand";
11
11
  customType: null;
12
12
  } | {
13
13
  type: "custom";
@@ -1,8 +1,4 @@
1
- import { AppState } from "./types";
2
- export declare const getClientColors: (clientId: string, appState: AppState) => {
3
- background: string;
4
- stroke: string;
5
- };
1
+ export declare const getClientColor: (id: string) => string;
6
2
  /**
7
3
  * returns first char, capitalized
8
4
  */
package/types/colors.d.ts CHANGED
@@ -58,3 +58,4 @@ export declare const DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE: {
58
58
  readonly bronze: ColorTuple;
59
59
  };
60
60
  export declare const getAllColorsSpecificShade: (index: 0 | 1 | 2 | 3 | 4) => readonly [string, string, string, string, string, string, string, string, string, string];
61
+ export declare const rgbToHex: (r: number, g: number, b: number) => string;
@@ -1,24 +1,4 @@
1
- export declare const activeConfirmDialogAtom: import("jotai").Atom<"clearCanvas" | null> & {
2
- write: (get: {
3
- <Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
4
- <Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
5
- <Value_2>(atom: import("jotai").Atom<Value_2>): Value_2 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_2;
6
- } & {
7
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
8
- unstable_promise: true;
9
- }): Value_3 | Promise<Value_3>;
10
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
11
- unstable_promise: true;
12
- }): Value_4 | Promise<Value_4>;
13
- <Value_5>(atom: import("jotai").Atom<Value_5>, options: {
14
- unstable_promise: true;
15
- }): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
16
- }, set: {
17
- <Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
18
- <Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
19
- }, update: "clearCanvas" | ((prev: "clearCanvas" | null) => "clearCanvas" | null) | null) => void;
20
- onMount?: (<S extends (update: "clearCanvas" | ((prev: "clearCanvas" | null) => "clearCanvas" | null) | null) => void>(setAtom: S) => void | (() => void)) | undefined;
21
- } & {
1
+ export declare const activeConfirmDialogAtom: import("jotai").PrimitiveAtom<"clearCanvas" | null> & {
22
2
  init: "clearCanvas" | null;
23
3
  };
24
4
  export declare const ActiveConfirmDialog: () => JSX.Element | null;
@@ -7,7 +7,7 @@ import { LinearElementEditor } from "../element/linearElementEditor";
7
7
  import { ExcalidrawElement, ExcalidrawLinearElement, NonDeletedExcalidrawElement } from "../element/types";
8
8
  import History from "../history";
9
9
  import Scene from "../scene/Scene";
10
- import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, SidebarName, SidebarTabName } from "../types";
10
+ import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName } from "../types";
11
11
  import { FileSystemHandle } from "../data/filesystem";
12
12
  import { ImportedDataState } from "../data/types";
13
13
  export declare let showFourthFont: boolean;
@@ -53,21 +53,32 @@ declare class App extends React.Component<AppProps, AppState> {
53
53
  files: BinaryFiles;
54
54
  imageCache: AppClassProperties["imageCache"];
55
55
  hitLinkElement?: NonDeletedExcalidrawElement;
56
- lastPointerDown: React.PointerEvent<HTMLCanvasElement> | null;
56
+ lastPointerDown: React.PointerEvent<HTMLElement> | null;
57
57
  lastPointerUp: React.PointerEvent<HTMLElement> | PointerEvent | null;
58
- lastScenePointer: {
58
+ lastViewportPosition: {
59
59
  x: number;
60
60
  y: number;
61
- } | null;
61
+ };
62
+ private iFrameRefs;
62
63
  allowMobileMode: boolean;
63
64
  constructor(props: AppProps);
64
65
  private renderCanvas;
66
+ private onWindowMessage;
67
+ private updateIFrameRef;
68
+ private getIFrameElementById;
69
+ private handleIFrameCenterClick;
70
+ private isIFrameCenter;
71
+ private renderIFrames;
72
+ private getFrameNameDOMId;
73
+ frameNameBoundsCache: FrameNameBoundsCache;
74
+ private renderFrameNames;
65
75
  render(): JSX.Element;
66
76
  focusContainer: AppClassProperties["focusContainer"];
67
77
  getSceneElementsIncludingDeleted: () => readonly ExcalidrawElement[];
68
78
  getSceneElements: () => readonly NonDeletedExcalidrawElement[];
69
79
  onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
70
80
  onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: readonly NonDeletedExcalidrawElement[]) => Promise<void>;
81
+ private openEyeDropper;
71
82
  private syncActionResult;
72
83
  private onBlur;
73
84
  private onUnload;
@@ -101,6 +112,7 @@ declare class App extends React.Component<AppProps, AppState> {
101
112
  setAppState: React.Component<any, AppState>["setState"];
102
113
  removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
103
114
  toggleLock: (source?: "keyboard" | "ui") => void;
115
+ toggleFrameRendering: () => void;
104
116
  togglePenMode: () => void;
105
117
  onHandToolToggle: () => void;
106
118
  /**
@@ -175,6 +187,7 @@ declare class App extends React.Component<AppProps, AppState> {
175
187
  private handleCanvasDoubleClick;
176
188
  private getElementLinkAtPosition;
177
189
  private redirectToLink;
190
+ private getTopLayerFrameAtSceneCoords;
178
191
  private handleCanvasPointerMove;
179
192
  private handleEraser;
180
193
  private handleTouchMove;
@@ -197,9 +210,12 @@ declare class App extends React.Component<AppProps, AppState> {
197
210
  private isHittingCommonBoundingBoxOfSelectedElements;
198
211
  private handleTextOnPointerDown;
199
212
  private handleFreeDrawElementOnPointerDown;
213
+ private insertIFrameElement;
200
214
  private createImageElement;
201
215
  private handleLinearElementOnPointerDown;
216
+ private getCurrentItemRoundness;
202
217
  private createGenericElementOnPointerDown;
218
+ private createFrameElementOnPointerDown;
203
219
  private onKeyDownFromPointerDownHandler;
204
220
  private onKeyUpFromPointerDownHandler;
205
221
  private onPointerMoveFromPointerDownHandler;
@@ -3,7 +3,6 @@ import React from "react";
3
3
  type AvatarProps = {
4
4
  onClick: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
5
5
  color: string;
6
- border: string;
7
6
  name: string;
8
7
  src?: string;
9
8
  };
@@ -1,5 +1,5 @@
1
1
  interface ColorInputProps {
2
- color: string | null;
2
+ color: string;
3
3
  onChange: (color: string) => void;
4
4
  label: string;
5
5
  }
@@ -4,9 +4,9 @@ import { ColorPickerType } from "./colorPickerUtils";
4
4
  import { ColorTuple, ColorPaletteCustom } from "../../colors";
5
5
  import "./ColorPicker.scss";
6
6
  export declare const getColor: (color: string) => string | null;
7
- export interface ColorPickerProps {
7
+ interface ColorPickerProps {
8
8
  type: ColorPickerType;
9
- color: string | null;
9
+ color: string;
10
10
  onChange: (color: string) => void;
11
11
  label: string;
12
12
  elements: readonly ExcalidrawElement[];
@@ -16,3 +16,4 @@ export interface ColorPickerProps {
16
16
  updateData: (formData?: any) => void;
17
17
  }
18
18
  export declare const ColorPicker: ({ type, color, onChange, label, elements, palette, topPicks, updateData, appState, }: ColorPickerProps) => JSX.Element;
19
+ export {};
@@ -1,6 +1,6 @@
1
1
  interface CustomColorListProps {
2
2
  colors: string[];
3
- color: string | null;
3
+ color: string;
4
4
  onChange: (color: string) => void;
5
5
  label: string;
6
6
  }
@@ -3,7 +3,7 @@ import { ExcalidrawElement } from "../../element/types";
3
3
  import { ColorPickerType } from "./colorPickerUtils";
4
4
  import { ColorPaletteCustom } from "../../colors";
5
5
  interface PickerProps {
6
- color: string | null;
6
+ color: string;
7
7
  onChange: (color: string) => void;
8
8
  label: string;
9
9
  type: ColorPickerType;
@@ -11,6 +11,8 @@ interface PickerProps {
11
11
  palette: ColorPaletteCustom;
12
12
  updateData: (formData?: any) => void;
13
13
  children?: React.ReactNode;
14
+ onEyeDropperToggle: (force?: boolean) => void;
15
+ onEscape: (event: React.KeyboardEvent | KeyboardEvent) => void;
14
16
  }
15
- export declare const Picker: ({ color, onChange, label, type, elements, palette, updateData, children, }: PickerProps) => JSX.Element;
17
+ export declare const Picker: ({ color, onChange, label, type, elements, palette, updateData, children, onEyeDropperToggle, onEscape, }: PickerProps) => JSX.Element;
16
18
  export {};
@@ -1,7 +1,7 @@
1
1
  import { ColorPaletteCustom } from "../../colors";
2
2
  interface PickerColorListProps {
3
3
  palette: ColorPaletteCustom;
4
- color: string | null;
4
+ color: string;
5
5
  onChange: (color: string) => void;
6
6
  label: string;
7
7
  activeShade: number;
@@ -1,6 +1,6 @@
1
1
  import { ColorPaletteCustom } from "../../colors";
2
2
  interface ShadeListProps {
3
- hex: string | null;
3
+ hex: string;
4
4
  onChange: (color: string) => void;
5
5
  palette: ColorPaletteCustom;
6
6
  }
@@ -2,7 +2,7 @@ import { ColorPickerType } from "./colorPickerUtils";
2
2
  interface TopPicksProps {
3
3
  onChange: (color: string) => void;
4
4
  type: ColorPickerType;
5
- activeColor: string | null;
5
+ activeColor: string;
6
6
  topPicks?: readonly string[];
7
7
  }
8
8
  export declare const TopPicks: ({ onChange, type, activeColor, topPicks, }: TopPicksProps) => JSX.Element | null;
@@ -1,40 +1,20 @@
1
1
  import { ExcalidrawElement } from "../../element/types";
2
2
  import { ColorPickerColor, ColorPaletteCustom } from "../../colors";
3
- export declare const getColorNameAndShadeFromHex: ({ palette, hex, }: {
3
+ export declare const getColorNameAndShadeFromColor: ({ palette, color, }: {
4
4
  palette: ColorPaletteCustom;
5
- hex: string;
5
+ color: string;
6
6
  }) => {
7
7
  colorName: ColorPickerColor;
8
8
  shade: number | null;
9
9
  } | null;
10
10
  export declare const colorPickerHotkeyBindings: string[];
11
11
  export declare const isCustomColor: ({ color, palette, }: {
12
- color: string | null;
12
+ color: string;
13
13
  palette: ColorPaletteCustom;
14
14
  }) => boolean;
15
15
  export declare const getMostUsedCustomColors: (elements: readonly ExcalidrawElement[], type: "elementBackground" | "elementStroke", palette: ColorPaletteCustom) => string[];
16
16
  export type ActiveColorPickerSectionAtomType = "custom" | "baseColors" | "shades" | "hex" | null;
17
- export declare const activeColorPickerSectionAtom: import("jotai").Atom<ActiveColorPickerSectionAtomType> & {
18
- write: (get: {
19
- <Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
20
- <Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
21
- <Value_2>(atom: import("jotai").Atom<Value_2>): Value_2 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_2;
22
- } & {
23
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
24
- unstable_promise: true;
25
- }): Value_3 | Promise<Value_3>;
26
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
27
- unstable_promise: true;
28
- }): Value_4 | Promise<Value_4>;
29
- <Value_5>(atom: import("jotai").Atom<Value_5>, options: {
30
- unstable_promise: true;
31
- }): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
32
- }, set: {
33
- <Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
34
- <Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
35
- }, update: ActiveColorPickerSectionAtomType | ((prev: ActiveColorPickerSectionAtomType) => ActiveColorPickerSectionAtomType)) => void;
36
- onMount?: (<S extends (update: ActiveColorPickerSectionAtomType | ((prev: ActiveColorPickerSectionAtomType) => ActiveColorPickerSectionAtomType)) => void>(setAtom: S) => void | (() => void)) | undefined;
37
- } & {
17
+ export declare const activeColorPickerSectionAtom: import("jotai").PrimitiveAtom<ActiveColorPickerSectionAtomType> & {
38
18
  init: ActiveColorPickerSectionAtomType;
39
19
  };
40
20
  export declare const getContrastYIQ: (bgHex: string, isCustomColor: boolean) => "white" | "black";
@@ -2,15 +2,20 @@
2
2
  import { ColorPaletteCustom } from "../../colors";
3
3
  import { ActiveColorPickerSectionAtomType } from "./colorPickerUtils";
4
4
  interface ColorPickerKeyNavHandlerProps {
5
- e: React.KeyboardEvent;
5
+ event: React.KeyboardEvent;
6
6
  activeColorPickerSection: ActiveColorPickerSectionAtomType;
7
7
  palette: ColorPaletteCustom;
8
- hex: string | null;
8
+ color: string;
9
9
  onChange: (color: string) => void;
10
10
  customColors: string[];
11
11
  setActiveColorPickerSection: (update: React.SetStateAction<ActiveColorPickerSectionAtomType>) => void;
12
12
  updateData: (formData?: any) => void;
13
13
  activeShade: number;
14
+ onEyeDropperToggle: (force?: boolean) => void;
15
+ onEscape: (event: React.KeyboardEvent | KeyboardEvent) => void;
14
16
  }
15
- export declare const colorPickerKeyNavHandler: ({ e, activeColorPickerSection, palette, hex, onChange, customColors, setActiveColorPickerSection, updateData, activeShade, }: ColorPickerKeyNavHandlerProps) => void;
17
+ /**
18
+ * @returns true if the event was handled
19
+ */
20
+ export declare const colorPickerKeyNavHandler: ({ event, activeColorPickerSection, palette, color, onChange, customColors, setActiveColorPickerSection, updateData, activeShade, onEyeDropperToggle, onEscape, }: ColorPickerKeyNavHandlerProps) => boolean;
16
21
  export {};
@@ -1,14 +1,13 @@
1
1
  import React from "react";
2
2
  import "./Dialog.scss";
3
- import { AppState } from "../types";
3
+ export type DialogSize = number | "small" | "regular" | "wide" | undefined;
4
4
  export interface DialogProps {
5
5
  children: React.ReactNode;
6
6
  className?: string;
7
- size?: "small" | "regular" | "wide";
7
+ size?: DialogSize;
8
8
  onCloseRequest(): void;
9
9
  title: React.ReactNode | false;
10
10
  autofocus?: boolean;
11
- theme?: AppState["theme"];
12
11
  closeOnClickOutside?: boolean;
13
12
  }
14
13
  export declare const Dialog: (props: DialogProps) => JSX.Element;
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import "./EyeDropper.scss";
3
+ type EyeDropperProperties = {
4
+ keepOpenOnAlt: boolean;
5
+ swapPreviewOnAlt?: boolean;
6
+ onSelect?: (color: string, event: PointerEvent) => void;
7
+ previewType?: "strokeColor" | "backgroundColor";
8
+ };
9
+ export declare const activeEyeDropperAtom: import("jotai").PrimitiveAtom<EyeDropperProperties | null> & {
10
+ init: EyeDropperProperties | null;
11
+ };
12
+ export declare const EyeDropper: React.FC<{
13
+ onCancel: () => void;
14
+ onSelect: Required<EyeDropperProperties>["onSelect"];
15
+ swapPreviewOnAlt?: EyeDropperProperties["swapPreviewOnAlt"];
16
+ previewType?: EyeDropperProperties["previewType"];
17
+ }>;
18
+ export {};
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import "./FilledButton.scss";
3
3
  export type ButtonVariant = "filled" | "outlined" | "icon";
4
- export type ButtonColor = "primary" | "danger";
4
+ export type ButtonColor = "primary" | "danger" | "warning" | "muted";
5
5
  export type ButtonSize = "medium" | "large";
6
6
  export type FilledButtonProps = {
7
7
  label: string;
@@ -11,6 +11,7 @@ export type FilledButtonProps = {
11
11
  color?: ButtonColor;
12
12
  size?: ButtonSize;
13
13
  className?: string;
14
+ fullWidth?: boolean;
14
15
  startIcon?: React.ReactNode;
15
16
  };
16
17
  export declare const FilledButton: React.ForwardRefExoticComponent<FilledButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -2,27 +2,7 @@ import React from "react";
2
2
  import Library from "../data/library";
3
3
  import { LibraryItems, LibraryItem, ExcalidrawProps, UIAppState } from "../types";
4
4
  import "./LibraryMenu.scss";
5
- export declare const isLibraryMenuOpenAtom: import("jotai").Atom<boolean> & {
6
- write: (get: {
7
- <Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
8
- <Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
9
- <Value_2>(atom: import("jotai").Atom<Value_2>): Value_2 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_2;
10
- } & {
11
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
12
- unstable_promise: true;
13
- }): Value_3 | Promise<Value_3>;
14
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
15
- unstable_promise: true;
16
- }): Value_4 | Promise<Value_4>;
17
- <Value_5>(atom: import("jotai").Atom<Value_5>, options: {
18
- unstable_promise: true;
19
- }): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
20
- }, set: {
21
- <Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
22
- <Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
23
- }, update: boolean | ((prev: boolean) => boolean)) => void;
24
- onMount?: (<S extends (update: boolean | ((prev: boolean) => boolean)) => void>(setAtom: S) => void | (() => void)) | undefined;
25
- } & {
5
+ export declare const isLibraryMenuOpenAtom: import("jotai").PrimitiveAtom<boolean> & {
26
6
  init: boolean;
27
7
  };
28
8
  export declare const LibraryMenuContent: ({ onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, libraryReturnUrl, library, id, theme, selectedItems, onSelectItems, }: {
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import "./OverwriteConfirm.scss";
3
+ export type OverwriteConfirmDialogProps = {
4
+ children: React.ReactNode;
5
+ };
6
+ declare const OverwriteConfirmDialog: React.FC<OverwriteConfirmDialogProps & {
7
+ __fallback?: boolean | undefined;
8
+ }> & {
9
+ Actions: (({ children }: {
10
+ children: React.ReactNode;
11
+ }) => JSX.Element) & {
12
+ ExportToImage: () => JSX.Element;
13
+ SaveToDisk: () => JSX.Element;
14
+ };
15
+ Action: ({ title, children, actionLabel, onClick, }: import("./OverwriteConfirmActions").ActionProps) => JSX.Element;
16
+ };
17
+ export { OverwriteConfirmDialog };
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ export type ActionProps = {
3
+ title: string;
4
+ children: React.ReactNode;
5
+ actionLabel: string;
6
+ onClick: () => void;
7
+ };
8
+ export declare const Action: ({ title, children, actionLabel, onClick, }: ActionProps) => JSX.Element;
9
+ export declare const ExportToImage: () => JSX.Element;
10
+ export declare const SaveToDisk: () => JSX.Element;
11
+ declare const Actions: (({ children }: {
12
+ children: React.ReactNode;
13
+ }) => JSX.Element) & {
14
+ ExportToImage: () => JSX.Element;
15
+ SaveToDisk: () => JSX.Element;
16
+ };
17
+ export { Actions };
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ export type OverwriteConfirmState = {
3
+ active: true;
4
+ title: string;
5
+ description: React.ReactNode;
6
+ actionLabel: string;
7
+ color: "danger" | "warning";
8
+ onClose: () => void;
9
+ onConfirm: () => void;
10
+ onReject: () => void;
11
+ } | {
12
+ active: false;
13
+ };
14
+ export declare const overwriteConfirmStateAtom: import("jotai").PrimitiveAtom<OverwriteConfirmState> & {
15
+ init: OverwriteConfirmState;
16
+ };
17
+ export declare function openConfirmModal({ title, description, actionLabel, color, }: {
18
+ title: string;
19
+ description: React.ReactNode;
20
+ actionLabel: string;
21
+ color: "danger" | "warning";
22
+ }): Promise<boolean>;
@@ -8,27 +8,7 @@ import "./Sidebar.scss";
8
8
  *
9
9
  * Since we can only render one Sidebar at a time, we can use a simple flag.
10
10
  */
11
- export declare const isSidebarDockedAtom: import("jotai").Atom<boolean> & {
12
- write: (get: {
13
- <Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
14
- <Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
15
- <Value_2>(atom: import("jotai").Atom<Value_2>): Value_2 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_2;
16
- } & {
17
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
18
- unstable_promise: true;
19
- }): Value_3 | Promise<Value_3>;
20
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
21
- unstable_promise: true;
22
- }): Value_4 | Promise<Value_4>;
23
- <Value_5>(atom: import("jotai").Atom<Value_5>, options: {
24
- unstable_promise: true;
25
- }): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
26
- }, set: {
27
- <Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
28
- <Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
29
- }, update: boolean | ((prev: boolean) => boolean)) => void;
30
- onMount?: (<S extends (update: boolean | ((prev: boolean) => boolean)) => void>(setAtom: S) => void | (() => void)) | undefined;
31
- } & {
11
+ export declare const isSidebarDockedAtom: import("jotai").PrimitiveAtom<boolean> & {
32
12
  init: boolean;
33
13
  };
34
14
  export declare const SidebarInner: React.ForwardRefExoticComponent<Pick<{
@@ -1,5 +1,5 @@
1
1
  import "./ToolIcon.scss";
2
- import React from "react";
2
+ import React, { CSSProperties } from "react";
3
3
  import { PointerType } from "../element/types";
4
4
  export type ToolButtonSize = "small" | "medium";
5
5
  type ToolButtonBaseProps = {
@@ -18,6 +18,7 @@ type ToolButtonBaseProps = {
18
18
  visible?: boolean;
19
19
  selected?: boolean;
20
20
  className?: string;
21
+ style?: CSSProperties;
21
22
  isLoading?: boolean;
22
23
  };
23
24
  type ToolButtonProps = (ToolButtonBaseProps & {
@@ -6,11 +6,12 @@ declare const DropdownMenu: {
6
6
  open: boolean;
7
7
  }): JSX.Element;
8
8
  Trigger: {
9
- ({ className, children, onToggle, }: {
9
+ ({ className, children, onToggle, title, ...rest }: {
10
10
  className?: string | undefined;
11
11
  children: React.ReactNode;
12
12
  onToggle: () => void;
13
- }): JSX.Element;
13
+ title?: string | undefined;
14
+ } & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onSelect">): JSX.Element;
14
15
  displayName: string;
15
16
  };
16
17
  Content: {
@@ -1,9 +1,11 @@
1
+ /// <reference types="react" />
1
2
  declare const MenuTrigger: {
2
- ({ className, children, onToggle, }: {
3
+ ({ className, children, onToggle, title, ...rest }: {
3
4
  className?: string | undefined;
4
5
  children: React.ReactNode;
5
6
  onToggle: () => void;
6
- }): JSX.Element;
7
+ title?: string | undefined;
8
+ } & Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "onSelect">): JSX.Element;
7
9
  displayName: string;
8
10
  };
9
11
  export default MenuTrigger;