@excalidraw/math 0.18.0-0457ac9 → 0.18.0-063e025

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 (119) hide show
  1. package/dist/types/common/src/colors.d.ts +1 -1
  2. package/dist/types/common/src/constants.d.ts +9 -7
  3. package/dist/types/common/src/utils.d.ts +0 -42
  4. package/dist/types/element/src/Scene.d.ts +1 -1
  5. package/dist/types/element/src/align.d.ts +2 -2
  6. package/dist/types/element/src/binding.d.ts +6 -6
  7. package/dist/types/element/src/bounds.d.ts +19 -6
  8. package/dist/types/element/src/collision.d.ts +1 -1
  9. package/dist/types/element/src/comparisons.d.ts +1 -0
  10. package/dist/types/element/src/distribute.d.ts +2 -2
  11. package/dist/types/element/src/duplicate.d.ts +3 -3
  12. package/dist/types/element/src/embeddable.d.ts +2 -2
  13. package/dist/types/element/src/flowchart.d.ts +3 -3
  14. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  15. package/dist/types/element/src/frame.d.ts +4 -4
  16. package/dist/types/element/src/groups.d.ts +9 -9
  17. package/dist/types/element/src/index.d.ts +1 -1
  18. package/dist/types/element/src/linearElementEditor.d.ts +10 -10
  19. package/dist/types/element/src/newElement.d.ts +1 -0
  20. package/dist/types/element/src/renderElement.d.ts +0 -3
  21. package/dist/types/element/src/resizeElements.d.ts +2 -2
  22. package/dist/types/element/src/selection.d.ts +5 -5
  23. package/dist/types/element/src/textElement.d.ts +7 -7
  24. package/dist/types/element/src/transform.d.ts +2 -2
  25. package/dist/types/element/src/typeChecks.d.ts +25 -25
  26. package/dist/types/element/src/types.d.ts +8 -1
  27. package/dist/types/element/src/zindex.d.ts +2 -2
  28. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +12 -6
  29. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  30. package/dist/types/excalidraw/actions/actionBoundText.d.ts +8 -4
  31. package/dist/types/excalidraw/actions/actionCanvas.d.ts +61 -389
  32. package/dist/types/excalidraw/actions/actionClipboard.d.ts +8 -4
  33. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +4 -2
  34. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +13 -7
  35. package/dist/types/excalidraw/actions/actionDeselect.d.ts +4 -2
  36. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
  37. package/dist/types/excalidraw/actions/actionElementLink.d.ts +4 -2
  38. package/dist/types/excalidraw/actions/actionElementLock.d.ts +9 -5
  39. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +4 -2
  40. package/dist/types/excalidraw/actions/actionExport.d.ts +8 -4
  41. package/dist/types/excalidraw/actions/actionFrame.d.ts +29 -20
  42. package/dist/types/excalidraw/actions/actionGroup.d.ts +23 -19
  43. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +7 -4
  44. package/dist/types/excalidraw/actions/actionLink.d.ts +5 -3
  45. package/dist/types/excalidraw/actions/actionMenu.d.ts +4 -2
  46. package/dist/types/excalidraw/actions/actionProperties.d.ts +35 -22
  47. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +9 -7
  48. package/dist/types/excalidraw/actions/actionStyles.d.ts +4 -2
  49. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +5 -3
  50. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +8 -7
  51. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +5 -3
  52. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -3
  53. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +8 -7
  54. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
  55. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +5 -3
  56. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +5 -3
  57. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +5 -3
  58. package/dist/types/excalidraw/actions/index.d.ts +1 -1
  59. package/dist/types/excalidraw/actions/types.d.ts +4 -4
  60. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  61. package/dist/types/excalidraw/appState.d.ts +2 -1
  62. package/dist/types/excalidraw/components/Actions.d.ts +2 -3
  63. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  64. package/dist/types/excalidraw/components/App.d.ts +61 -32
  65. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +2 -2
  66. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  67. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  68. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
  69. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  70. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  71. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  72. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  73. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  74. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  75. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  76. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
  77. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  78. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  79. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
  80. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  81. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  82. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  83. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  84. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
  85. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
  86. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
  87. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
  88. package/dist/types/excalidraw/components/icons.d.ts +2 -0
  89. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +6 -3
  90. package/dist/types/excalidraw/data/blob.d.ts +8 -4
  91. package/dist/types/excalidraw/data/index.d.ts +4 -4
  92. package/dist/types/excalidraw/data/json.d.ts +10 -8
  93. package/dist/types/excalidraw/data/library.d.ts +1 -1
  94. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  95. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  96. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  97. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  98. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  99. package/dist/types/excalidraw/renderer/animation.d.ts +5 -1
  100. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -3
  101. package/dist/types/excalidraw/scene/Renderer.d.ts +12 -11
  102. package/dist/types/excalidraw/scene/export.d.ts +3 -3
  103. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  104. package/dist/types/excalidraw/scene/types.d.ts +1 -3
  105. package/dist/types/excalidraw/snapping.d.ts +7 -7
  106. package/dist/types/excalidraw/types.d.ts +168 -11
  107. package/dist/types/excalidraw/viewport.d.ts +316 -0
  108. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -3
  109. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  110. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  111. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  112. package/dist/types/laser-pointer/src/state.d.ts +35 -0
  113. package/dist/types/utils/src/export.d.ts +3 -3
  114. package/dist/types/utils/src/index.d.ts +1 -2
  115. package/package.json +2 -2
  116. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  117. package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
  118. package/dist/types/utils/src/bbox.d.ts +0 -9
  119. package/dist/types/utils/src/withinBounds.d.ts +0 -19
@@ -1,10 +1,17 @@
1
1
  import React from "react";
2
2
  import "./Island.scss";
3
+ import type { ViewportUIDock, ViewportUIName } from "../types";
3
4
  type IslandProps = {
4
5
  children: React.ReactNode;
5
6
  padding?: number;
6
7
  className?: string | boolean;
7
8
  style?: object;
9
+ /** marks the island as a canvas-occluding UI surface measured by
10
+ * `getViewportOffsets` (see {@link ViewportUIDock}) */
11
+ "data-viewport-ui"?: ViewportUIDock;
12
+ /** identifies the surface so `getViewportOffsets` can reserve space for
13
+ * it while hidden (see {@link ViewportUIName}) */
14
+ "data-viewport-ui-name"?: ViewportUIName;
8
15
  };
9
16
  export declare const Island: React.ForwardRefExoticComponent<IslandProps & React.RefAttributes<HTMLDivElement>>;
10
17
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "./LibraryMenu.scss";
3
- export declare const isLibraryMenuOpenAtom: import("jotai/vanilla/atom").PrimitiveAtom<boolean> & {
3
+ export declare const isLibraryMenuOpenAtom: import("jotai").PrimitiveAtom<boolean> & {
4
4
  init: boolean;
5
5
  };
6
6
  /**
@@ -11,7 +11,7 @@ export type OverwriteConfirmState = {
11
11
  } | {
12
12
  active: false;
13
13
  };
14
- export declare const overwriteConfirmStateAtom: import("jotai/vanilla/atom").PrimitiveAtom<OverwriteConfirmState> & {
14
+ export declare const overwriteConfirmStateAtom: import("jotai").PrimitiveAtom<OverwriteConfirmState> & {
15
15
  init: OverwriteConfirmState;
16
16
  };
17
17
  export declare function openConfirmModal({ title, description, actionLabel, color, }: {
@@ -1,5 +1,5 @@
1
1
  import "./SVGLayer.scss";
2
- import type { Trail } from "../animated-trail";
2
+ import type { Trail } from "../animatedTrail";
3
3
  type SVGLayerProps = {
4
4
  trails: Trail[];
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import "./SearchMenu.scss";
2
- export declare const searchItemInFocusAtom: import("jotai/vanilla/atom").PrimitiveAtom<number | null> & {
2
+ export declare const searchItemInFocusAtom: import("jotai").PrimitiveAtom<number | null> & {
3
3
  init: number | null;
4
4
  };
5
5
  export declare const SearchMenu: () => import("react/jsx-runtime").JSX.Element;
@@ -8,7 +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/vanilla/atom").PrimitiveAtom<boolean> & {
11
+ export declare const isSidebarDockedAtom: import("jotai").PrimitiveAtom<boolean> & {
12
12
  init: boolean;
13
13
  };
14
14
  export declare const SidebarInner: React.ForwardRefExoticComponent<Omit<{
@@ -1,8 +1,8 @@
1
- import type { ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface AngleProps {
5
- element: ExcalidrawElement;
5
+ element: NonDeletedExcalidrawElement;
6
6
  scene: Scene;
7
7
  appState: AppState;
8
8
  property: "angle";
@@ -1,9 +1,9 @@
1
- import type { ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface DimensionDragInputProps {
5
5
  property: "width" | "height";
6
- element: ExcalidrawElement;
6
+ element: NonDeletedExcalidrawElement;
7
7
  scene: Scene;
8
8
  appState: AppState;
9
9
  }
@@ -1,10 +1,10 @@
1
- import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import { useApp, useExcalidrawSetAppState } from "../App";
4
4
  import "./DragInput.scss";
5
5
  import type { StatsInputProperty } from "./utils";
6
6
  import type { AppState } from "../../types";
7
- export type DragInputCallbackType<P extends StatsInputProperty, E = ExcalidrawElement> = (props: {
7
+ export type DragInputCallbackType<P extends StatsInputProperty, E = NonDeletedExcalidrawElement> = (props: {
8
8
  accumulatedChange: number;
9
9
  instantChange: number;
10
10
  originalElements: readonly E[];
@@ -1,8 +1,8 @@
1
- import type { ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface MultiAngleProps {
5
- elements: readonly ExcalidrawElement[];
5
+ elements: readonly NonDeletedExcalidrawElement[];
6
6
  scene: Scene;
7
7
  appState: AppState;
8
8
  property: "angle";
@@ -1,10 +1,10 @@
1
- import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
1
+ import type { NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import type { AtomicUnit } from "./utils";
4
4
  import type { AppState } from "../../types";
5
5
  interface MultiDimensionProps {
6
6
  property: "width" | "height";
7
- elements: readonly ExcalidrawElement[];
7
+ elements: readonly NonDeletedExcalidrawElement[];
8
8
  elementsMap: NonDeletedSceneElementsMap;
9
9
  atomicUnits: AtomicUnit[];
10
10
  scene: Scene;
@@ -1,10 +1,10 @@
1
- import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ElementsMap, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import type { AtomicUnit } from "./utils";
4
4
  import type { AppState } from "../../types";
5
5
  interface MultiPositionProps {
6
6
  property: "x" | "y";
7
- elements: readonly ExcalidrawElement[];
7
+ elements: readonly NonDeletedExcalidrawElement[];
8
8
  elementsMap: ElementsMap;
9
9
  atomicUnits: AtomicUnit[];
10
10
  scene: Scene;
@@ -1,12 +1,12 @@
1
- import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ElementsMap, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface PositionProps {
5
5
  property: "x" | "y";
6
- element: ExcalidrawElement;
6
+ element: NonDeletedExcalidrawElement;
7
7
  elementsMap: ElementsMap;
8
8
  scene: Scene;
9
9
  appState: AppState;
10
10
  }
11
- declare const Position: ({ property, element, elementsMap, scene, appState, }: PositionProps) => import("react/jsx-runtime").JSX.Element;
11
+ declare const Position: ({ property, element, scene, appState }: PositionProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export default Position;
@@ -15,5 +15,5 @@ export declare const newOrigin: (x1: number, y1: number, w1: number, h1: number,
15
15
  x: number;
16
16
  y: number;
17
17
  };
18
- export declare const moveElement: (newTopLeftX: number, newTopLeftY: number, originalElement: ExcalidrawElement, scene: Scene, appState: AppState, originalElementsMap: ElementsMap, shouldInformMutation?: boolean) => void;
18
+ export declare const moveElement: (newTopLeftX: number, newTopLeftY: number, originalElement: NonDeletedExcalidrawElement, scene: Scene, appState: AppState, originalElementsMap: ElementsMap, shouldInformMutation?: boolean) => void;
19
19
  export declare const getAtomicUnits: (targetElements: readonly ExcalidrawElement[], appState: AppState) => AtomicUnit[];
@@ -1,13 +1,13 @@
1
1
  import type { RateLimits, TChat } from "./types";
2
- export declare const rateLimitsAtom: import("jotai/vanilla/atom").PrimitiveAtom<RateLimits | null> & {
2
+ export declare const rateLimitsAtom: import("jotai").PrimitiveAtom<RateLimits | null> & {
3
3
  init: RateLimits | null;
4
4
  };
5
- export declare const showPreviewAtom: import("jotai/vanilla/atom").PrimitiveAtom<boolean> & {
5
+ export declare const showPreviewAtom: import("jotai").PrimitiveAtom<boolean> & {
6
6
  init: boolean;
7
7
  };
8
- export declare const errorAtom: import("jotai/vanilla/atom").PrimitiveAtom<Error | null> & {
8
+ export declare const errorAtom: import("jotai").PrimitiveAtom<Error | null> & {
9
9
  init: Error | null;
10
10
  };
11
- export declare const chatHistoryAtom: import("jotai/vanilla/atom").PrimitiveAtom<TChat.ChatHistory> & {
11
+ export declare const chatHistoryAtom: import("jotai").PrimitiveAtom<TChat.ChatHistory> & {
12
12
  init: TChat.ChatHistory;
13
13
  };
@@ -9,13 +9,13 @@ interface UseTTDChatStorageReturn {
9
9
  restoreChat: (chat: SavedChat) => SavedChat;
10
10
  createNewChatId: () => Promise<string>;
11
11
  }
12
- export declare const savedChatsAtom: import("jotai/vanilla/atom").PrimitiveAtom<SavedChats> & {
12
+ export declare const savedChatsAtom: import("jotai").PrimitiveAtom<SavedChats> & {
13
13
  init: SavedChats;
14
14
  };
15
- export declare const isLoadingChatsAtom: import("jotai/vanilla/atom").PrimitiveAtom<boolean> & {
15
+ export declare const isLoadingChatsAtom: import("jotai").PrimitiveAtom<boolean> & {
16
16
  init: boolean;
17
17
  };
18
- export declare const chatsLoadedAtom: import("jotai/vanilla/atom").PrimitiveAtom<boolean> & {
18
+ export declare const chatsLoadedAtom: import("jotai").PrimitiveAtom<boolean> & {
19
19
  init: boolean;
20
20
  };
21
21
  export declare const useTTDChatStorage: ({ persistenceAdapter, }: UseTTDChatStorageProps) => UseTTDChatStorageReturn;
@@ -1,10 +1,10 @@
1
1
  import type { GlobalPoint, Radians } from "@excalidraw/math";
2
2
  import type { Bounds } from "@excalidraw/common";
3
3
  import type { ElementsMap, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
4
- import type { AppState, UIAppState } from "../../types";
4
+ import type { AppState } from "../../types";
5
5
  export declare const DEFAULT_LINK_SIZE = 12;
6
6
  export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
7
7
  export declare const ELEMENT_LINK_IMG: HTMLImageElement;
8
- export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: Radians, appState: Pick<UIAppState, "zoom">) => Bounds;
8
+ export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: Radians, appState: Pick<AppState, "zoom">) => Bounds;
9
9
  export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, [x, y]: GlobalPoint) => boolean;
10
10
  export declare const isPointHittingLink: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, [x, y]: GlobalPoint, isMobile: boolean) => boolean;
@@ -114,6 +114,8 @@ export declare const StrokeStyleDottedIcon: import("react/jsx-runtime").JSX.Elem
114
114
  export declare const SloppinessArchitectIcon: import("react/jsx-runtime").JSX.Element;
115
115
  export declare const SloppinessArtistIcon: import("react/jsx-runtime").JSX.Element;
116
116
  export declare const SloppinessCartoonistIcon: import("react/jsx-runtime").JSX.Element;
117
+ export declare const strokeVariabilityConstantIcon: import("react/jsx-runtime").JSX.Element;
118
+ export declare const strokeVariabilityVariableIcon: import("react/jsx-runtime").JSX.Element;
117
119
  export declare const EdgeSharpIcon: import("react/jsx-runtime").JSX.Element;
118
120
  export declare const EdgeRoundIcon: import("react/jsx-runtime").JSX.Element;
119
121
  export declare const ArrowheadNoneIcon: React.MemoExoticComponent<({ flip }: {
@@ -35,11 +35,14 @@ export declare const ClearCanvas: {
35
35
  export declare const ToggleTheme: {
36
36
  (props: {
37
37
  allowSystemTheme: true;
38
+ /**
39
+ * Controls the theme of this UI component only.
40
+ * You should subscribe to `props.onThemeChange` and control the theme
41
+ * upstream.
42
+ */
38
43
  theme: Theme | "system";
39
- onSelect: (theme: Theme | "system") => void;
40
44
  } | {
41
- allowSystemTheme?: false;
42
- onSelect?: (theme: Theme) => void;
45
+ allowSystemTheme: false;
43
46
  }): import("react/jsx-runtime").JSX.Element | null;
44
47
  displayName: string;
45
48
  };
@@ -78,7 +78,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
78
78
  midPoint?: import("@excalidraw/math").GlobalPoint;
79
79
  } | null;
80
80
  isRotating: boolean;
81
- elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
81
+ elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
82
82
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
83
83
  snapLines: readonly import("../snapping").SnapLine[];
84
84
  zenModeEnabled: boolean;
@@ -122,9 +122,10 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
122
122
  currentItemStrokeColor: string;
123
123
  currentItemBackgroundColor: string;
124
124
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
125
- currentItemStrokeWidth: number;
125
+ currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
126
126
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
127
127
  currentItemRoughness: number;
128
+ currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
128
129
  currentItemOpacity: number;
129
130
  currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
130
131
  currentItemFontSize: number;
@@ -133,6 +134,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
133
134
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
134
135
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
135
136
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
137
+ scrollConstraints: import("../types").ScrollConstraints | null;
136
138
  cursorButton: "up" | "down";
137
139
  scrolledOutside: boolean;
138
140
  isResizing: boolean;
@@ -243,7 +245,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
243
245
  midPoint?: import("@excalidraw/math").GlobalPoint;
244
246
  } | null;
245
247
  isRotating: boolean;
246
- elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
248
+ elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
247
249
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
248
250
  snapLines: readonly import("../snapping").SnapLine[];
249
251
  zenModeEnabled: boolean;
@@ -287,9 +289,10 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
287
289
  currentItemStrokeColor: string;
288
290
  currentItemBackgroundColor: string;
289
291
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
290
- currentItemStrokeWidth: number;
292
+ currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
291
293
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
292
294
  currentItemRoughness: number;
295
+ currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
293
296
  currentItemOpacity: number;
294
297
  currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
295
298
  currentItemFontSize: number;
@@ -298,6 +301,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
298
301
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
299
302
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
300
303
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
304
+ scrollConstraints: import("../types").ScrollConstraints | null;
301
305
  cursorButton: "up" | "down";
302
306
  scrolledOutside: boolean;
303
307
  isResizing: boolean;
@@ -1,4 +1,4 @@
1
- import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { ExportType } from "../scene/types";
3
3
  import type { AppState, BinaryFiles } from "../types";
4
4
  export { loadFromBlob } from "./blob";
@@ -6,8 +6,8 @@ export { loadFromJSON, saveAsJSON } from "./json";
6
6
  export type ExportedElements = readonly NonDeletedExcalidrawElement[] & {
7
7
  _brand: "exportedElements";
8
8
  };
9
- export declare const prepareElementsForExport: (elements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
10
- exportingFrame: ExcalidrawFrameLikeElement | null;
9
+ export declare const prepareElementsForExport: (allElements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
10
+ exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
11
11
  exportedElements: ExportedElements;
12
12
  };
13
13
  export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, exportingFrame, }: {
@@ -17,5 +17,5 @@ export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements:
17
17
  /** filename, if applicable */
18
18
  name?: string;
19
19
  fileHandle?: FileSystemFileHandle | null;
20
- exportingFrame: ExcalidrawFrameLikeElement | null;
20
+ exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
21
21
  }) => Promise<FileSystemFileHandle | null | undefined>;
@@ -1,9 +1,9 @@
1
- import type { ExcalidrawElement, NonDeleted } from "@excalidraw/element/types";
1
+ import type { ExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { MaybePromise } from "@excalidraw/common/utility-types";
3
3
  import type { AppState, BinaryFiles, LibraryItems } from "../types";
4
4
  import type { ImportedDataState, ImportedLibraryData } from "./types";
5
5
  export type JSONExportData = {
6
- elements: readonly NonDeleted<ExcalidrawElement>[];
6
+ elements: readonly ExcalidrawElement[];
7
7
  appState: AppState;
8
8
  files: BinaryFiles;
9
9
  };
@@ -52,7 +52,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
52
52
  selectedElementIds: Readonly<{
53
53
  [id: string]: true;
54
54
  }>;
55
- frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
55
+ frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
56
56
  activeTool: {
57
57
  lastActiveTool: import("../types").ActiveTool | null;
58
58
  locked: boolean;
@@ -67,16 +67,16 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
67
67
  [groupId: string]: boolean;
68
68
  };
69
69
  selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
70
- multiElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
71
- newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
70
+ multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
71
+ newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
72
72
  isBindingEnabled: boolean;
73
73
  isMidpointSnappingEnabled: boolean;
74
74
  suggestedBinding: {
75
- element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
75
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
76
76
  midPoint?: import("@excalidraw/math").GlobalPoint;
77
77
  } | null;
78
78
  isRotating: boolean;
79
- elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
79
+ elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
80
80
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
81
81
  snapLines: readonly import("../snapping").SnapLine[];
82
82
  zenModeEnabled: boolean;
@@ -120,9 +120,10 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
120
120
  currentItemStrokeColor: string;
121
121
  currentItemBackgroundColor: string;
122
122
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
123
- currentItemStrokeWidth: number;
123
+ currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
124
124
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
125
125
  currentItemRoughness: number;
126
+ currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
126
127
  currentItemOpacity: number;
127
128
  currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
128
129
  currentItemFontSize: number;
@@ -131,6 +132,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
131
132
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
132
133
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
133
134
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
135
+ scrollConstraints: import("../types").ScrollConstraints | null;
134
136
  cursorButton: "up" | "down";
135
137
  scrolledOutside: boolean;
136
138
  isResizing: boolean;
@@ -37,7 +37,7 @@ export interface LibraryMigrationAdapter {
37
37
  /** clears entire storage afterwards */
38
38
  clear(): MaybePromise<void>;
39
39
  }
40
- export declare const libraryItemsAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
40
+ export declare const libraryItemsAtom: import("jotai").PrimitiveAtom<{
41
41
  status: "loading" | "loaded";
42
42
  /** indicates whether library is initialized with library items (has gone
43
43
  * through at least one update). Used in UI. Specific to this atom only. */
@@ -1,10 +1,9 @@
1
- import { AnimatedTrail } from "../animated-trail";
2
- import type { AnimationFrameHandler } from "../animation-frame-handler";
1
+ import { AnimatedTrail } from "../animatedTrail";
3
2
  import type App from "../components/App";
4
3
  export declare class EraserTrail extends AnimatedTrail {
5
4
  private elementsToErase;
6
5
  private groupsToErase;
7
- constructor(animationFrameHandler: AnimationFrameHandler, app: App);
6
+ constructor(app: App);
8
7
  startPath(x: number, y: number): void;
9
8
  addPointToPath(x: number, y: number, restore?: boolean): string[];
10
9
  private updateElementsToBeErased;
@@ -0,0 +1,29 @@
1
+ import type { AppState } from "../types";
2
+ /**
3
+ * Subscribes to specific appState changes. The component re-renders
4
+ * only when the specified prop(s) change — not on every appState update.
5
+ *
6
+ * Works both inside and outside the <Excalidraw> tree, as long as
7
+ * ExcalidrawAPIContext.Provider is an ancestor (automatically provided
8
+ * inside <Excalidraw>, or manually by the host app).
9
+ *
10
+ * Returns the narrowed value depending on prop form:
11
+ * - `keyof AppState` → `AppState[K]`
12
+ * - `(keyof AppState)[]` → whole `AppState`
13
+ * - selector function → selector's return type `T`
14
+ *
15
+ * If excalidrawAPI is not ready yet (host apps), hook is rerendered with latest
16
+ * value once available.
17
+ */
18
+ export declare function useAppStateValue<K extends keyof AppState>(prop: K, _internal?: boolean): AppState[K];
19
+ export declare function useAppStateValue(props: (keyof AppState)[], _internal?: boolean): AppState;
20
+ export declare function useAppStateValue<T>(selector: (appState: AppState) => T, _internal?: boolean): T;
21
+ /**
22
+ * Subscribes to specific appState changes without causing component rerenders.
23
+ *
24
+ * The callback is called on every matching change, but also on initial render
25
+ * so you can initialize your state.
26
+ */
27
+ export declare function useOnAppStateChange<K extends keyof AppState>(prop: K, callback: (value: AppState[K], appState: AppState) => void): undefined;
28
+ export declare function useOnAppStateChange(props: (keyof AppState)[], callback: (props: AppState, appState: AppState) => void): undefined;
29
+ export declare function useOnAppStateChange<T>(selector: (appState: AppState) => T, callback: (value: T, appState: AppState) => void): undefined;
@@ -1,6 +1,6 @@
1
1
  import type { LibraryItem } from "../types";
2
2
  export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;
3
- export declare const libraryItemSvgsCache: import("jotai/vanilla/atom").PrimitiveAtom<SvgCache> & {
3
+ export declare const libraryItemSvgsCache: import("jotai").PrimitiveAtom<SvgCache> & {
4
4
  init: SvgCache;
5
5
  };
6
6
  export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache, ref: React.RefObject<HTMLDivElement | null>) => SVGSVGElement | undefined;
@@ -1,20 +1,18 @@
1
- import { AnimatedTrail } from "./animated-trail";
2
- import type { Trail } from "./animated-trail";
3
- import type { AnimationFrameHandler } from "./animation-frame-handler";
1
+ import { AnimatedTrail } from "./animatedTrail";
2
+ import type { Trail } from "./animatedTrail";
4
3
  import type App from "./components/App";
5
4
  export declare class LaserTrails implements Trail {
6
- private animationFrameHandler;
7
5
  private app;
8
6
  localTrail: AnimatedTrail;
9
7
  private collabTrails;
10
8
  private container?;
11
- constructor(animationFrameHandler: AnimationFrameHandler, app: App);
9
+ constructor(app: App);
12
10
  private getTrailOptions;
13
11
  startPath(x: number, y: number): void;
14
12
  addPointToPath(x: number, y: number): void;
15
13
  endPath(): void;
16
14
  start(container: SVGSVGElement): void;
17
15
  stop(): void;
18
- onFrame(): void;
19
- private updateCollabTrails;
16
+ private stopCollabTrails;
17
+ updateCollabTrails(collaborators: App["state"]["collaborators"]): void;
20
18
  }
@@ -1,5 +1,4 @@
1
- import { type AnimationFrameHandler } from "../animation-frame-handler";
2
- import { AnimatedTrail } from "../animated-trail";
1
+ import { AnimatedTrail } from "../animatedTrail";
3
2
  import type App from "../components/App";
4
3
  export declare class LassoTrail extends AnimatedTrail {
5
4
  private intersectedElements;
@@ -7,7 +6,7 @@ export declare class LassoTrail extends AnimatedTrail {
7
6
  private elementsSegments;
8
7
  private canvasTranslate;
9
8
  private keepPreviousSelection;
10
- constructor(animationFrameHandler: AnimationFrameHandler, app: App);
9
+ constructor(app: App);
11
10
  startPath(x: number, y: number, keepPreviousSelection?: boolean): void;
12
11
  selectElementsFromIds: (ids: string[]) => void;
13
12
  addPointToPath: (x: number, y: number, keepPreviousSelection?: boolean) => void;
@@ -3,10 +3,14 @@ export type Animation<R extends object> = (params: {
3
3
  state?: R;
4
4
  }) => R | null | undefined;
5
5
  export declare class AnimationController {
6
- private static isRunning;
6
+ private static scheduledFrame;
7
7
  private static animations;
8
8
  static start<R extends object>(key: string, animation: Animation<R>): void;
9
+ private static scheduleNextFrame;
10
+ private static cancelScheduledFrame;
11
+ private static cancelScheduledFrameIfIdle;
9
12
  private static tick;
10
13
  static running(key: string): boolean;
11
14
  static cancel(key: string): void;
15
+ static reset(): void;
12
16
  }
@@ -1,9 +1,7 @@
1
1
  import { getScrollBars } from "../scene/scrollbars";
2
- import type { InteractiveSceneRenderConfig, RenderableElementsMap } from "../scene/types";
2
+ import type { InteractiveSceneRenderConfig } from "../scene/types";
3
3
  declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
4
4
  scrollBars?: ReturnType<typeof getScrollBars>;
5
- atLeastOneVisibleElement: boolean;
6
- elementsMap: RenderableElementsMap;
7
5
  animationState?: typeof animationState;
8
6
  };
9
7
  /**
@@ -64,7 +64,7 @@ export declare class Renderer {
64
64
  startArrowhead: import("@excalidraw/element/types").Arrowhead | null;
65
65
  endArrowhead: import("@excalidraw/element/types").Arrowhead | null;
66
66
  }> & {
67
- isDeleted: boolean;
67
+ isDeleted: false;
68
68
  }) | (Readonly<{
69
69
  id: string;
70
70
  x: number;
@@ -98,7 +98,7 @@ export declare class Renderer {
98
98
  }> & {
99
99
  type: "rectangle";
100
100
  } & {
101
- isDeleted: boolean;
101
+ isDeleted: false;
102
102
  }) | (Readonly<{
103
103
  id: string;
104
104
  x: number;
@@ -132,7 +132,7 @@ export declare class Renderer {
132
132
  }> & {
133
133
  type: "diamond";
134
134
  } & {
135
- isDeleted: boolean;
135
+ isDeleted: false;
136
136
  }) | (Readonly<{
137
137
  id: string;
138
138
  x: number;
@@ -166,7 +166,7 @@ export declare class Renderer {
166
166
  }> & {
167
167
  type: "ellipse";
168
168
  } & {
169
- isDeleted: boolean;
169
+ isDeleted: false;
170
170
  }) | (Readonly<{
171
171
  id: string;
172
172
  x: number;
@@ -200,7 +200,7 @@ export declare class Renderer {
200
200
  }> & Readonly<{
201
201
  type: "embeddable";
202
202
  }> & {
203
- isDeleted: boolean;
203
+ isDeleted: false;
204
204
  }) | (Readonly<{
205
205
  id: string;
206
206
  x: number;
@@ -237,7 +237,7 @@ export declare class Renderer {
237
237
  generationData?: import("@excalidraw/element/types").MagicGenerationData;
238
238
  };
239
239
  }> & {
240
- isDeleted: boolean;
240
+ isDeleted: false;
241
241
  }) | (Readonly<{
242
242
  id: string;
243
243
  x: number;
@@ -275,7 +275,7 @@ export declare class Renderer {
275
275
  scale: [number, number];
276
276
  crop: import("@excalidraw/element/types").ImageCrop | null;
277
277
  }> & {
278
- isDeleted: boolean;
278
+ isDeleted: false;
279
279
  }) | (Readonly<{
280
280
  id: string;
281
281
  x: number;
@@ -310,7 +310,7 @@ export declare class Renderer {
310
310
  type: "frame";
311
311
  name: string | null;
312
312
  } & {
313
- isDeleted: boolean;
313
+ isDeleted: false;
314
314
  }) | (Readonly<{
315
315
  id: string;
316
316
  x: number;
@@ -345,7 +345,7 @@ export declare class Renderer {
345
345
  type: "magicframe";
346
346
  name: string | null;
347
347
  } & {
348
- isDeleted: boolean;
348
+ isDeleted: false;
349
349
  }) | (Readonly<{
350
350
  id: string;
351
351
  x: number;
@@ -390,7 +390,7 @@ export declare class Renderer {
390
390
  _brand: "unitlessLineHeight";
391
391
  };
392
392
  }> & {
393
- isDeleted: boolean;
393
+ isDeleted: false;
394
394
  }) | (Readonly<{
395
395
  id: string;
396
396
  x: number;
@@ -426,8 +426,9 @@ export declare class Renderer {
426
426
  points: readonly import("@excalidraw/math").LocalPoint[];
427
427
  pressures: readonly number[];
428
428
  simulatePressure: boolean;
429
+ strokeOptions: import("@excalidraw/element/types").StrokeOptions;
429
430
  }> & {
430
- isDeleted: boolean;
431
+ isDeleted: false;
431
432
  }) | null;
432
433
  canvasNonce: string;
433
434
  };