@zsviczian/excalidraw 0.14.1-obsidian → 0.14.2-1-obsidian

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 (48) hide show
  1. package/README.md +16 -1823
  2. package/dist/excalidraw.development.js +207 -97
  3. package/dist/excalidraw.production.min.js +1 -1
  4. package/dist/excalidraw.production.min.js.LICENSE.txt +20 -0
  5. package/package.json +1 -1
  6. package/types/actions/actionAddToLibrary.d.ts +12 -0
  7. package/types/actions/actionBoundText.d.ts +4 -0
  8. package/types/actions/actionCanvas.d.ts +40 -0
  9. package/types/actions/actionClipboard.d.ts +20 -0
  10. package/types/actions/actionDeleteSelected.d.ts +14 -2
  11. package/types/actions/actionExport.d.ts +36 -0
  12. package/types/actions/actionFinalize.d.ts +8 -0
  13. package/types/actions/actionLinearEditor.d.ts +4 -0
  14. package/types/actions/actionMenu.d.ts +12 -0
  15. package/types/actions/actionProperties.d.ts +52 -0
  16. package/types/actions/actionStyles.d.ts +4 -0
  17. package/types/actions/actionToggleGridMode.d.ts +4 -0
  18. package/types/actions/actionToggleLock.d.ts +4 -0
  19. package/types/actions/actionToggleStats.d.ts +4 -0
  20. package/types/actions/actionToggleViewMode.d.ts +4 -0
  21. package/types/actions/actionToggleZenMode.d.ts +4 -0
  22. package/types/actions/shortcuts.d.ts +1 -1
  23. package/types/components/App.d.ts +2 -1
  24. package/types/components/LayerUI.d.ts +1 -2
  25. package/types/components/MobileMenu.d.ts +3 -4
  26. package/types/components/context/tunnels.d.ts +16 -0
  27. package/types/components/dropdownMenu/common.d.ts +1 -1
  28. package/types/components/footer/Footer.d.ts +3 -4
  29. package/types/components/hoc/withInternalFallback.d.ts +4 -0
  30. package/types/components/main-menu/MainMenu.d.ts +9 -9
  31. package/types/components/welcome-screen/WelcomeScreen.d.ts +2 -2
  32. package/types/constants.d.ts +5 -0
  33. package/types/data/restore.d.ts +8 -2
  34. package/types/element/Hyperlink.d.ts +4 -0
  35. package/types/element/linearElementEditor.d.ts +4 -0
  36. package/types/element/newElement.d.ts +0 -3
  37. package/types/element/sortElements.d.ts +2 -0
  38. package/types/element/textElement.d.ts +9 -8
  39. package/types/element/typeChecks.d.ts +1 -1
  40. package/types/element/types.d.ts +0 -1
  41. package/types/i18n.d.ts +6 -0
  42. package/types/jotai.d.ts +5 -5
  43. package/types/math.d.ts +1 -0
  44. package/types/packages/excalidraw/example/App.d.ts +7 -1
  45. package/types/packages/excalidraw/index.d.ts +1 -1
  46. package/types/packages/utils.d.ts +1 -1
  47. package/types/types.d.ts +8 -17
  48. package/types/utils.d.ts +3 -16
@@ -1,3 +1,3 @@
1
1
  import { ActionName } from "./types";
2
- export declare type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleLock"> | "saveScene" | "imageExport";
2
+ export declare type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleLock"> | "saveScene" | "imageExport";
3
3
  export declare const getShortcutFromShortcutName: (name: ShortcutName) => string;
@@ -3,7 +3,7 @@ import { RoughCanvas } from "roughjs/bin/canvas";
3
3
  import { ActionManager } from "../actions/manager";
4
4
  import { RestoredDataState } from "../data/restore";
5
5
  import { LinearElementEditor } from "../element/linearElementEditor";
6
- import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
6
+ import { ExcalidrawElement, ExcalidrawLinearElement, NonDeletedExcalidrawElement } from "../element/types";
7
7
  import History from "../history";
8
8
  import Scene from "../scene/Scene";
9
9
  import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device } from "../types";
@@ -99,6 +99,7 @@ declare class App extends React.Component<AppProps, AppState> {
99
99
  onHandToolToggle: () => void;
100
100
  scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[]) => void;
101
101
  zoomToFit: (target?: readonly ExcalidrawElement[], maxZoom?: number, margin?: number) => void;
102
+ startLineEditor: (el: ExcalidrawLinearElement, selectedPointsIndices?: number[] | null) => void;
102
103
  updateContainerSize: (containers: NonDeletedExcalidrawElement[]) => void;
103
104
  restore: (data: ImportedDataState) => RestoredDataState;
104
105
  setToast: (toast: {
@@ -19,7 +19,6 @@ interface LayerUIProps {
19
19
  onInsertElements: (elements: readonly NonDeletedExcalidrawElement[]) => void;
20
20
  showExitZenModeBtn: boolean;
21
21
  langCode: Language["code"];
22
- isCollaborating: boolean;
23
22
  renderTopRightUI?: ExcalidrawProps["renderTopRightUI"];
24
23
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
25
24
  renderCustomSidebar?: ExcalidrawProps["renderSidebar"];
@@ -34,5 +33,5 @@ interface LayerUIProps {
34
33
  renderWelcomeScreen: boolean;
35
34
  children?: React.ReactNode;
36
35
  }
37
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, isCollaborating, renderTopRightUI, renderCustomStats, renderCustomSidebar, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, renderWelcomeScreen, children, }: LayerUIProps) => JSX.Element>;
36
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, renderTopRightUI, renderCustomStats, renderCustomSidebar, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, renderWelcomeScreen, children, }: LayerUIProps) => JSX.Element>;
38
37
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { AppState, Device, ExcalidrawProps, UIWelcomeScreenComponents } from "../types";
2
+ import { AppState, Device, ExcalidrawProps } from "../types";
3
3
  import { ActionManager } from "../actions/manager";
4
4
  import { NonDeletedExcalidrawElement } from "../element/types";
5
5
  declare type MobileMenuProps = {
@@ -20,8 +20,7 @@ declare type MobileMenuProps = {
20
20
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
21
21
  renderSidebars: () => JSX.Element | null;
22
22
  device: Device;
23
- renderMenu: () => React.ReactNode;
24
- welcomeScreenCenter: UIWelcomeScreenComponents["Center"];
23
+ renderWelcomeScreen: boolean;
25
24
  };
26
- export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, canvas, onImageAction, renderTopRightUI, renderCustomStats, renderSidebars, device, renderMenu, welcomeScreenCenter, }: MobileMenuProps) => JSX.Element;
25
+ export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, canvas, onImageAction, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, }: MobileMenuProps) => JSX.Element;
27
26
  export {};
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import tunnel from "@dwelle/tunnel-rat";
3
+ declare type Tunnel = ReturnType<typeof tunnel>;
4
+ declare type TunnelsContextValue = {
5
+ mainMenuTunnel: Tunnel;
6
+ welcomeScreenMenuHintTunnel: Tunnel;
7
+ welcomeScreenToolbarHintTunnel: Tunnel;
8
+ welcomeScreenHelpHintTunnel: Tunnel;
9
+ welcomeScreenCenterTunnel: Tunnel;
10
+ footerCenterTunnel: Tunnel;
11
+ jotaiScope: symbol;
12
+ };
13
+ export declare const TunnelsContext: React.Context<TunnelsContextValue>;
14
+ export declare const useTunnels: () => TunnelsContextValue;
15
+ export declare const useInitializeTunnels: () => TunnelsContextValue;
16
+ export {};
@@ -2,5 +2,5 @@ import React from "react";
2
2
  export declare const DropdownMenuContentPropsContext: React.Context<{
3
3
  onSelect?: ((event: Event) => void) | undefined;
4
4
  }>;
5
- export declare const getDrodownMenuItemClassName: (className?: string) => string;
5
+ export declare const getDropdownMenuItemClassName: (className?: string) => string;
6
6
  export declare const useHandleDropdownMenuItemClick: (origOnClick: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement> | undefined, onSelect: ((event: Event) => void) | undefined) => (event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>) => void;
@@ -1,12 +1,11 @@
1
1
  import { ActionManager } from "../../actions/manager";
2
- import { AppState, UIChildrenComponents, UIWelcomeScreenComponents } from "../../types";
2
+ import { AppState } from "../../types";
3
3
  declare const Footer: {
4
- ({ appState, actionManager, showExitZenModeBtn, footerCenter, welcomeScreenHelp, }: {
4
+ ({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, }: {
5
5
  appState: AppState;
6
6
  actionManager: ActionManager;
7
7
  showExitZenModeBtn: boolean;
8
- footerCenter: UIChildrenComponents["FooterCenter"];
9
- welcomeScreenHelp: UIWelcomeScreenComponents["HelpHint"];
8
+ renderWelcomeScreen: boolean;
10
9
  }): JSX.Element;
11
10
  displayName: string;
12
11
  };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ export declare const withInternalFallback: <P>(componentName: string, Component: React.FC<P>) => React.FC<P & {
3
+ __fallback?: boolean | undefined;
4
+ }>;
@@ -1,13 +1,14 @@
1
1
  import React from "react";
2
2
  import * as DefaultItems from "./DefaultItems";
3
- declare const MainMenu: {
4
- ({ children, onSelect, }: {
5
- children?: React.ReactNode;
6
- /**
7
- * Called when any menu item is selected (clicked on).
8
- */
9
- onSelect?: ((event: Event) => void) | undefined;
10
- }): JSX.Element;
3
+ declare const MainMenu: React.FC<{
4
+ children?: React.ReactNode;
5
+ /**
6
+ * Called when any menu item is selected (clicked on).
7
+ */
8
+ onSelect?: ((event: Event) => void) | undefined;
9
+ } & {
10
+ __fallback?: boolean | undefined;
11
+ }> & {
11
12
  Trigger: {
12
13
  ({ className, children, onToggle, }: {
13
14
  className?: string | undefined;
@@ -55,6 +56,5 @@ declare const MainMenu: {
55
56
  displayName: string;
56
57
  };
57
58
  DefaultItems: typeof DefaultItems;
58
- displayName: string;
59
59
  };
60
60
  export default MainMenu;
@@ -2,8 +2,8 @@
2
2
  import "./WelcomeScreen.scss";
3
3
  declare const WelcomeScreen: {
4
4
  (props: {
5
- children: React.ReactNode;
6
- }): null;
5
+ children?: React.ReactNode;
6
+ }): JSX.Element;
7
7
  displayName: string;
8
8
  Center: {
9
9
  ({ children }: {
@@ -4,6 +4,8 @@ export declare const isDarwin: boolean;
4
4
  export declare const isWindows: boolean;
5
5
  export declare const isAndroid: boolean;
6
6
  export declare const isFirefox: boolean;
7
+ export declare const isChrome: boolean;
8
+ export declare const isSafari: boolean;
7
9
  export declare const APP_NAME = "Excalidraw";
8
10
  export declare const DRAGGING_THRESHOLD = 10;
9
11
  export declare const LINE_CONFIRM_THRESHOLD = 8;
@@ -162,3 +164,6 @@ export declare const ROUNDNESS: {
162
164
  /** key containt id of precedeing elemnt id we use in reconciliation during
163
165
  * collaboration */
164
166
  export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
167
+ export declare const COLOR_NAMES: {
168
+ [key: string]: string;
169
+ };
@@ -8,8 +8,14 @@ export declare type RestoredDataState = {
8
8
  appState: RestoredAppState;
9
9
  files: BinaryFiles;
10
10
  };
11
- export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, refreshDimensions?: boolean) => ExcalidrawElement[];
11
+ export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, opts?: {
12
+ refreshDimensions?: boolean;
13
+ repairBindings?: boolean;
14
+ } | undefined) => ExcalidrawElement[];
12
15
  export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
13
- export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined) => RestoredDataState;
16
+ export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined, elementsConfig?: {
17
+ refreshDimensions?: boolean;
18
+ repairBindings?: boolean;
19
+ }) => RestoredDataState;
14
20
  export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
15
21
  export {};
@@ -126,6 +126,10 @@ export declare const actionLink: {
126
126
  };
127
127
  allowWheelZoom?: boolean | undefined;
128
128
  allowPinchZoom?: boolean | undefined;
129
+ pinnedScripts?: string[] | undefined;
130
+ customPens?: any[] | undefined;
131
+ currentStrokeOptions?: any;
132
+ resetCustomPen?: any;
129
133
  selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
130
134
  };
131
135
  commitToHistory: true;
@@ -233,6 +233,10 @@ export declare class LinearElementEditor {
233
233
  };
234
234
  allowWheelZoom?: boolean | undefined;
235
235
  allowPinchZoom?: boolean | undefined;
236
+ pinnedScripts?: string[] | undefined;
237
+ customPens?: any[] | undefined;
238
+ currentStrokeOptions?: any;
239
+ resetCustomPen?: any;
236
240
  selectedLinearElement: LinearElementEditor | null;
237
241
  };
238
242
  };
@@ -18,11 +18,8 @@ export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement,
18
18
  y: number;
19
19
  width: number;
20
20
  height: number;
21
- baseline: number;
22
21
  text: string;
23
22
  };
24
- export declare const getMaxContainerWidth: (container: ExcalidrawElement) => number;
25
- export declare const getMaxContainerHeight: (container: ExcalidrawElement) => number;
26
23
  export declare const updateTextElement: (textElement: ExcalidrawTextElement, { text, isDeleted, originalText, rawText, link, }: {
27
24
  text: string;
28
25
  isDeleted?: boolean | undefined;
@@ -0,0 +1,2 @@
1
+ import { ExcalidrawElement } from "./types";
2
+ export declare const normalizeElementOrder: (elements: readonly ExcalidrawElement[]) => readonly ExcalidrawElement[];
@@ -5,19 +5,13 @@ export declare const normalizeText: (text: string) => string;
5
5
  export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
6
6
  export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
7
7
  export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType) => void;
8
- export declare const measureText: (text: string, font: FontString, maxWidth?: number | null) => {
8
+ export declare const measureText: (text: string, font: FontString) => {
9
9
  width: number;
10
10
  height: number;
11
- baseline: number;
12
- container: HTMLDivElement;
13
- } | {
14
- width: number;
15
- height: number;
16
- baseline: number;
17
- container?: undefined;
18
11
  };
19
12
  export declare const getApproxLineHeight: (font: FontString) => number;
20
13
  export declare const getTextWidth: (text: string, font: FontString) => number;
14
+ export declare const getTextHeight: (text: string, font: FontString) => number;
21
15
  export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
22
16
  export declare const charWidth: {
23
17
  calculate: (char: string, font: FontString) => number;
@@ -41,6 +35,10 @@ export declare const getContainerCenter: (container: ExcalidrawElement, appState
41
35
  x: number;
42
36
  y: number;
43
37
  };
38
+ export declare const getContainerCoords: (container: NonDeletedExcalidrawElement) => {
39
+ x: number;
40
+ y: number;
41
+ };
44
42
  export declare const getTextElementAngle: (textElement: ExcalidrawTextElement) => number;
45
43
  export declare const getBoundTextElementOffset: (boundTextElement: ExcalidrawTextElement | null) => number;
46
44
  export declare const getBoundTextElementPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
@@ -50,3 +48,6 @@ export declare const getBoundTextElementPosition: (container: ExcalidrawElement,
50
48
  export declare const shouldAllowVerticalAlign: (selectedElements: NonDeletedExcalidrawElement[]) => boolean;
51
49
  export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number) => ExcalidrawTextContainer | null;
52
50
  export declare const isValidTextContainer: (element: ExcalidrawElement) => boolean;
51
+ export declare const computeContainerHeightForBoundText: (container: NonDeletedExcalidrawElement, boundTextElementHeight: number) => number;
52
+ export declare const getMaxContainerWidth: (container: ExcalidrawElement) => number;
53
+ export declare const getMaxContainerHeight: (container: ExcalidrawElement) => number;
@@ -14,7 +14,7 @@ export declare const isBindingElementType: (elementType: AppState["activeTool"][
14
14
  export declare const isBindableElement: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawBindableElement;
15
15
  export declare const isTextBindableContainer: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawTextContainer;
16
16
  export declare const isExcalidrawElement: (element: any) => boolean;
17
- export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
17
+ export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is MarkNonNullable<ExcalidrawBindableElement, "boundElements">;
18
18
  export declare const isBoundToContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextElementWithContainer;
19
19
  export declare const isUsingAdaptiveRadius: (type: string) => boolean;
20
20
  export declare const isUsingProportionalRadius: (type: string) => boolean;
@@ -100,7 +100,6 @@ export declare type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
100
100
  fontFamily: FontFamilyValues;
101
101
  text: string;
102
102
  rawText: string;
103
- baseline: number;
104
103
  textAlign: TextAlign;
105
104
  verticalAlign: VerticalAlign;
106
105
  containerId: ExcalidrawGenericElement["id"] | null;
package/types/i18n.d.ts CHANGED
@@ -13,3 +13,9 @@ export declare const getLanguage: () => Language;
13
13
  export declare const t: (path: string, replacement?: {
14
14
  [key: string]: string | number;
15
15
  } | undefined) => string;
16
+ export declare const useI18n: () => {
17
+ t: (path: string, replacement?: {
18
+ [key: string]: string | number;
19
+ } | undefined) => string;
20
+ langCode: string;
21
+ };
package/types/jotai.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { WritableAtom } from "jotai";
1
+ import { PrimitiveAtom } from "jotai";
2
2
  export declare const jotaiScope: unique symbol;
3
3
  export declare const jotaiStore: {
4
4
  get: <Value>(atom: import("jotai").Atom<Value>) => (Value 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) | undefined;
5
5
  asyncGet: <Value_1>(atom: import("jotai").Atom<Value_1>) => Promise<Value_1 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_1>;
6
- set: <Value_2, Update, Result extends void | Promise<void>>(atom: WritableAtom<Value_2, Update, Result>, update: Update) => Result;
6
+ set: <Value_2, Update, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_2, Update, Result>, update: Update) => Result;
7
7
  sub: (atom: {
8
8
  toString: () => string;
9
9
  debugLabel?: string | undefined;
@@ -15,7 +15,7 @@ export declare const jotaiStore: {
15
15
  }, callback: () => void) => () => void;
16
16
  SECRET_INTERNAL_store: {
17
17
  r: <Value_6>(readingAtom: import("jotai").Atom<Value_6>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_6>;
18
- w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom: WritableAtom<Value_1_1, Update_1, Result_1>, update: Update_1, version?: import("jotai/core/store").VersionObject | undefined) => Result_1;
18
+ w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom: import("jotai").WritableAtom<Value_1_1, Update_1, Result_1>, update: Update_1, version?: import("jotai/core/store").VersionObject | undefined) => Result_1;
19
19
  c: (_atom: {
20
20
  toString: () => string;
21
21
  debugLabel?: string | undefined;
@@ -85,7 +85,7 @@ export declare const jotaiStore: {
85
85
  } | undefined;
86
86
  } | {
87
87
  r: <Value_7>(readingAtom: import("jotai").Atom<Value_7>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_7>;
88
- w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom: WritableAtom<Value_1_2, Update_2, Result_2>, update: Update_2, version?: import("jotai/core/store").VersionObject | undefined) => Result_2;
88
+ w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom: import("jotai").WritableAtom<Value_1_2, Update_2, Result_2>, update: Update_2, version?: import("jotai/core/store").VersionObject | undefined) => Result_2;
89
89
  c: (_atom: {
90
90
  toString: () => string;
91
91
  debugLabel?: string | undefined;
@@ -119,4 +119,4 @@ export declare const jotaiStore: {
119
119
  m?: undefined;
120
120
  };
121
121
  };
122
- export declare const useAtomWithInitialValue: <T extends unknown, A extends WritableAtom<T, T, void>>(atom: A, initialValue: T | (() => T)) => readonly [T 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 : T, import("jotai/core/atom").SetAtom<T, void>];
122
+ export declare const useAtomWithInitialValue: <T extends unknown, A extends PrimitiveAtom<T>>(atom: A, initialValue: T | (() => T)) => readonly [T 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 : T, import("jotai/core/atom").SetAtom<T | ((prev: T) => T), void>];
package/types/math.d.ts CHANGED
@@ -26,3 +26,4 @@ export declare const getBezierCurveArcLengths: (element: NonDeleted<ExcalidrawLi
26
26
  export declare const getBezierCurveLength: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => number;
27
27
  export declare const mapIntervalToBezierT: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number], interval: number) => number;
28
28
  export declare const arePointsEqual: (p1: readonly [number, number], p2: readonly [number, number]) => boolean;
29
+ export declare const isRightAngle: (angle: number) => boolean;
@@ -1,8 +1,14 @@
1
1
  import type * as TExcalidraw from "../index";
2
2
  import "./App.scss";
3
+ import { ExcalidrawImperativeAPI } from "../../../types";
3
4
  declare global {
4
5
  interface Window {
5
6
  ExcalidrawLib: typeof TExcalidraw;
6
7
  }
7
8
  }
8
- export default function App(): JSX.Element;
9
+ export interface AppProps {
10
+ appTitle: string;
11
+ useCustom: (api: ExcalidrawImperativeAPI | null, customArgs?: any[]) => void;
12
+ customArgs?: any[];
13
+ }
14
+ export default function App({ appTitle, useCustom, customArgs }: AppProps): JSX.Element;
@@ -9,7 +9,7 @@ import LiveCollaborationTrigger from "../../components/live-collaboration/LiveCo
9
9
  declare type PublicExcalidrawProps = Omit<ExcalidrawProps, "forwardedRef">;
10
10
  export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
11
11
  export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
12
- export { defaultLang, languages } from "../../i18n";
12
+ export { defaultLang, useI18n, languages } from "../../i18n";
13
13
  export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "../../data/restore";
14
14
  export { exportToCanvas, exportToBlob, exportToSvg, serializeAsJSON, serializeLibraryAsJSON, loadLibraryFromBlob, loadFromBlob, loadSceneOrLibraryFromBlob, getFreeDrawSvgPath, getCommonBoundingBox, //zsviczian
15
15
  getMaximumGroups, //zsviczian
@@ -38,5 +38,5 @@ export { intersectElementWithLine } from "../element/collision";
38
38
  export { determineFocusDistance } from "../element/collision";
39
39
  export { measureText, wrapText } from "../element/textElement";
40
40
  export { getFontString } from "../utils";
41
- export { getMaxContainerWidth } from "../element/newElement";
41
+ export { getMaxContainerWidth } from "../element/textElement";
42
42
  export { mergeLibraryItems } from "../data/library";
package/types/types.d.ts CHANGED
@@ -179,6 +179,10 @@ export declare type AppState = {
179
179
  };
180
180
  allowWheelZoom?: boolean;
181
181
  allowPinchZoom?: boolean;
182
+ pinnedScripts?: string[];
183
+ customPens?: any[];
184
+ currentStrokeOptions?: any;
185
+ resetCustomPen?: any;
182
186
  selectedLinearElement: LinearElementEditor | null;
183
187
  };
184
188
  export declare type NormalizedZoomValue = number & {
@@ -302,11 +306,12 @@ declare type CanvasActions = Partial<{
302
306
  }>;
303
307
  declare type UIOptions = Partial<{
304
308
  dockedSidebarBreakpoint: number;
305
- welcomeScreen: boolean;
306
309
  canvasActions: CanvasActions;
310
+ /** @deprecated does nothing. Will be removed in 0.15 */
311
+ welcomeScreen?: boolean;
307
312
  }>;
308
313
  export declare type AppProps = Merge<ExcalidrawProps, {
309
- UIOptions: Merge<MarkRequired<UIOptions, "welcomeScreen">, {
314
+ UIOptions: Merge<UIOptions, {
310
315
  canvasActions: Required<CanvasActions> & {
311
316
  export: ExportOpts;
312
317
  };
@@ -401,6 +406,7 @@ export declare type ExcalidrawImperativeAPI = {
401
406
  };
402
407
  scrollToContent: InstanceType<typeof App>["scrollToContent"];
403
408
  zoomToFit: InstanceType<typeof App>["zoomToFit"];
409
+ startLineEditor: InstanceType<typeof App>["startLineEditor"];
404
410
  getSceneElements: InstanceType<typeof App>["getSceneElements"];
405
411
  getAppState: () => InstanceType<typeof App>["state"];
406
412
  getFiles: () => InstanceType<typeof App>["files"];
@@ -430,19 +436,4 @@ export declare type Device = Readonly<{
430
436
  isTouchScreen: boolean;
431
437
  canDeviceFitSidebar: boolean;
432
438
  }>;
433
- export declare type UIChildrenComponents = {
434
- [k in "FooterCenter" | "Menu" | "WelcomeScreen"]?: React.ReactElement<{
435
- children?: React.ReactNode;
436
- }, React.JSXElementConstructor<any>>;
437
- };
438
- export declare type UIWelcomeScreenComponents = {
439
- [k in "Center" | "MenuHint" | "ToolbarHint" | "HelpHint"]?: React.ReactElement<{
440
- children?: React.ReactNode;
441
- }, React.JSXElementConstructor<any>>;
442
- };
443
- export declare type UIWelcomeScreenCenterComponents = {
444
- [k in "Logo" | "Heading" | "Menu" | "MenuItemLoadScene" | "MenuItemHelp"]?: React.ReactElement<{
445
- children?: React.ReactNode;
446
- }, React.JSXElementConstructor<any>>;
447
- };
448
439
  export {};
package/types/utils.d.ts CHANGED
@@ -2,7 +2,6 @@ import { EVENT } from "./constants";
2
2
  import { FontFamilyValues, FontString } from "./element/types";
3
3
  import { AppState, LastActiveTool, Zoom } from "./types";
4
4
  import { SHAPES } from "./shapes";
5
- import React from "react";
6
5
  export declare const setDateTimeForTests: (dateTime: string) => void;
7
6
  export declare const getDateTime: () => string;
8
7
  export declare const capitalizeString: (str: string) => string;
@@ -125,6 +124,9 @@ export declare const getUpdatedTimestamp: () => number;
125
124
  export declare const arrayToMap: <T extends string | {
126
125
  id: string;
127
126
  }>(items: readonly T[]) => Map<string, T>;
127
+ export declare const arrayToMapWithIndex: <T extends {
128
+ id: string;
129
+ }>(elements: readonly T[]) => Map<string, [element: T, index: number]>;
128
130
  export declare const isTestEnv: () => boolean;
129
131
  export declare const isProdEnv: () => boolean;
130
132
  export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) => CustomEvent<{
@@ -135,21 +137,6 @@ export declare const isPrimitive: (val: any) => boolean;
135
137
  export declare const getFrame: () => "top" | "iframe";
136
138
  export declare const isPromiseLike: (value: any) => value is Promise<any>;
137
139
  export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
138
- /**
139
- * Partitions React children into named components and the rest of children.
140
- *
141
- * Returns known children as a dictionary of react children keyed by their
142
- * displayName, and the rest children as an array.
143
- *
144
- * NOTE all named react components are included in the dictionary, irrespective
145
- * of the supplied type parameter. This means you may be throwing away
146
- * children that you aren't expecting, but should nonetheless be rendered.
147
- * To guard against this (provided you care about the rest children at all),
148
- * supply a second parameter with an object with keys of the expected children.
149
- */
150
- export declare const getReactChildren: <KnownChildren extends {
151
- [x: string]: React.ReactNode;
152
- }>(children: React.ReactNode, expectedComponents?: Record<keyof KnownChildren, any> | undefined) => readonly [Partial<KnownChildren>, React.ReactNode[]];
153
140
  export declare const isShallowEqual: <T extends Record<string, any>>(objA: T, objB: T) => boolean;
154
141
  export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E) => void) | undefined, ourEventHandler?: ((event: E) => void) | undefined, { checkForDefaultPrevented }?: {
155
142
  checkForDefaultPrevented?: boolean | undefined;