@myoc/element 0.19.521 → 0.19.523

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 (152) hide show
  1. package/dist/dev/index.js +3049 -1222
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +17 -17
  4. package/dist/types/common/src/colors.d.ts +14 -0
  5. package/dist/types/common/src/constants.d.ts +3 -0
  6. package/dist/types/common/src/keys.d.ts +2 -0
  7. package/dist/types/common/src/points.d.ts +1 -1
  8. package/dist/types/common/src/utils.d.ts +1 -1
  9. package/dist/types/element/src/Scene.d.ts +1 -1
  10. package/dist/types/element/src/align.d.ts +2 -2
  11. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  12. package/dist/types/element/src/arrows/focus.d.ts +5 -2
  13. package/dist/types/element/src/binding.d.ts +17 -8
  14. package/dist/types/element/src/bounds.d.ts +5 -9
  15. package/dist/types/element/src/bucketFill.d.ts +110 -0
  16. package/dist/types/element/src/collision.d.ts +1 -1
  17. package/dist/types/element/src/comparisons.d.ts +4 -4
  18. package/dist/types/element/src/convertToShape.d.ts +23 -0
  19. package/dist/types/element/src/distribute.d.ts +2 -2
  20. package/dist/types/element/src/dragElements.d.ts +27 -0
  21. package/dist/types/element/src/duplicate.d.ts +3 -3
  22. package/dist/types/element/src/embeddable.d.ts +2 -2
  23. package/dist/types/element/src/flowchart.d.ts +7 -7
  24. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  25. package/dist/types/element/src/frame.d.ts +4 -4
  26. package/dist/types/element/src/groups.d.ts +9 -9
  27. package/dist/types/element/src/index.d.ts +4 -1
  28. package/dist/types/element/src/linearElementEditor.d.ts +17 -10
  29. package/dist/types/element/src/newElement.d.ts +13 -0
  30. package/dist/types/element/src/renderElement.d.ts +0 -3
  31. package/dist/types/element/src/resizeElements.d.ts +2 -2
  32. package/dist/types/element/src/selection.d.ts +5 -5
  33. package/dist/types/element/src/shape.d.ts +12 -0
  34. package/dist/types/element/src/sortElements.d.ts +10 -0
  35. package/dist/types/element/src/textElement.d.ts +12 -9
  36. package/dist/types/element/src/transform.d.ts +2 -2
  37. package/dist/types/element/src/typeChecks.d.ts +25 -25
  38. package/dist/types/element/src/types.d.ts +2 -1
  39. package/dist/types/element/src/zindex.d.ts +2 -2
  40. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  41. package/dist/types/excalidraw/actions/actionBoundText.d.ts +24 -8
  42. package/dist/types/excalidraw/actions/actionCanvas.d.ts +134 -967
  43. package/dist/types/excalidraw/actions/actionClipboard.d.ts +24 -8
  44. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +12 -4
  45. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +38 -13
  46. package/dist/types/excalidraw/actions/actionDeselect.d.ts +9 -4
  47. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
  48. package/dist/types/excalidraw/actions/actionElementLink.d.ts +12 -4
  49. package/dist/types/excalidraw/actions/actionElementLock.d.ts +25 -9
  50. package/dist/types/excalidraw/actions/actionExport.d.ts +26 -10
  51. package/dist/types/excalidraw/actions/actionFrame.d.ts +47 -205
  52. package/dist/types/excalidraw/actions/actionGroup.d.ts +39 -23
  53. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +15 -6
  54. package/dist/types/excalidraw/actions/actionLink.d.ts +13 -5
  55. package/dist/types/excalidraw/actions/actionMenu.d.ts +12 -4
  56. package/dist/types/excalidraw/actions/actionProperties.d.ts +43 -24
  57. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +17 -9
  58. package/dist/types/excalidraw/actions/actionStyles.d.ts +12 -4
  59. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
  60. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +14 -6
  61. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -9
  62. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +13 -5
  63. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +13 -5
  64. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -9
  65. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +13 -5
  66. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +14 -6
  67. package/dist/types/excalidraw/actions/index.d.ts +2 -3
  68. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  69. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  70. package/dist/types/excalidraw/actions/types.d.ts +8 -4
  71. package/dist/types/excalidraw/appState.d.ts +10 -5
  72. package/dist/types/excalidraw/components/Actions.d.ts +18 -14
  73. package/dist/types/excalidraw/components/App.arrowText.d.ts +72 -0
  74. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  75. package/dist/types/excalidraw/components/App.cursor.d.ts +30 -0
  76. package/dist/types/excalidraw/components/App.d.ts +389 -61
  77. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  78. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  79. package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
  80. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
  81. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  82. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +3 -1
  83. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
  84. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
  85. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  86. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
  87. package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +31 -0
  88. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
  89. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  90. package/dist/types/excalidraw/components/{ToolButton.d.ts → IconButton.d.ts} +16 -19
  91. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  92. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  93. package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
  94. package/dist/types/excalidraw/components/LockButton.d.ts +9 -0
  95. package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
  96. package/dist/types/excalidraw/components/{MobileToolBar.d.ts → MobileToolbar.d.ts} +3 -4
  97. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  98. package/dist/types/excalidraw/components/Popover.d.ts +1 -3
  99. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  100. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  101. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  102. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
  103. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  104. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  105. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  106. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  107. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
  108. package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
  109. package/dist/types/excalidraw/components/Toolbar.d.ts +13 -0
  110. package/dist/types/excalidraw/components/Tools.d.ts +151 -0
  111. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  112. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  113. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -0
  114. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  115. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
  116. package/dist/types/excalidraw/components/icons.d.ts +4 -1
  117. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +0 -2
  118. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  119. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  120. package/dist/types/excalidraw/context/tunnels.d.ts +0 -1
  121. package/dist/types/excalidraw/data/blob.d.ts +14 -6
  122. package/dist/types/excalidraw/data/index.d.ts +4 -4
  123. package/dist/types/excalidraw/data/json.d.ts +20 -12
  124. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  125. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  126. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  127. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +10 -3
  128. package/dist/types/excalidraw/scene/Renderer.d.ts +11 -11
  129. package/dist/types/excalidraw/scene/export.d.ts +3 -3
  130. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  131. package/dist/types/excalidraw/scene/types.d.ts +4 -3
  132. package/dist/types/excalidraw/snapping.d.ts +7 -7
  133. package/dist/types/excalidraw/types.d.ts +432 -28
  134. package/dist/types/excalidraw/viewport.d.ts +283 -0
  135. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -3
  136. package/dist/types/laser-pointer/src/state.d.ts +1 -0
  137. package/dist/types/math/src/index.d.ts +1 -0
  138. package/dist/types/math/src/pca.d.ts +79 -0
  139. package/dist/types/math/src/polygon.d.ts +25 -1
  140. package/dist/types/utils/src/export.d.ts +3 -3
  141. package/package.json +4 -4
  142. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -180
  143. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +0 -183
  144. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +0 -27
  145. package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +0 -7
  146. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  147. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  148. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -10
  149. package/dist/types/excalidraw/cursor.d.ts +0 -5
  150. package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
  151. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
  152. package/dist/types/excalidraw/scroll.d.ts +0 -46
@@ -1,183 +0,0 @@
1
- export declare const actionToggleZenMode: {
2
- name: "zenMode";
3
- label: string;
4
- icon: import("react/jsx-runtime").JSX.Element;
5
- viewMode: true;
6
- trackEvent: {
7
- category: "canvas";
8
- predicate: (appState: Readonly<import("../types").AppState>) => boolean;
9
- };
10
- perform(elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>): {
11
- appState: {
12
- zenModeEnabled: boolean;
13
- contextMenu: {
14
- items: import("../components/ContextMenu").ContextMenuItems;
15
- top: number;
16
- left: number;
17
- } | null;
18
- showWelcomeScreen: boolean;
19
- isLoading: boolean;
20
- myocSimplifiedMode: boolean;
21
- dontResizeLimitMBs: number;
22
- hideMainMenus: boolean;
23
- wheelZoomsOnDefault?: boolean;
24
- arrangeConfiguration: {
25
- algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
26
- gap: number;
27
- };
28
- normaliseConfiguration: {
29
- mode: import("../types").NormaliseMode;
30
- metric: import("../types").NormaliseMetric;
31
- };
32
- errorMessage: React.ReactNode;
33
- activeEmbeddable: {
34
- element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
35
- state: "hover" | "active";
36
- } | null;
37
- newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
38
- resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
39
- multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
40
- selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
41
- isBindingEnabled: boolean;
42
- boxSelectionMode: import("../types").BoxSelectionMode;
43
- bindingPreference: "enabled" | "disabled";
44
- isMidpointSnappingEnabled: boolean;
45
- suggestedBinding: {
46
- element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
47
- midPoint?: import("@excalidraw/math").GlobalPoint;
48
- } | null;
49
- frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
50
- frameRendering: {
51
- enabled: boolean;
52
- name: boolean;
53
- outline: boolean;
54
- clip: boolean;
55
- };
56
- editingFrame: string | null;
57
- elementsToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawElement>[] | null;
58
- editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
59
- activeTool: {
60
- lastActiveTool: import("../types").ActiveTool | null;
61
- locked: boolean;
62
- fromSelection: boolean;
63
- } & import("../types").ActiveTool;
64
- preferredSelectionTool: {
65
- type: "selection" | "lasso";
66
- initialized: boolean;
67
- };
68
- penMode: boolean;
69
- penDetected: boolean;
70
- exportBackground: boolean;
71
- exportEmbedScene: boolean;
72
- exportWithDarkMode: boolean;
73
- exportScale: number;
74
- currentItemStrokeColor: string;
75
- currentItemBackgroundColor: string;
76
- currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
77
- currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
78
- currentItemStrokeStyle: import("@excalidraw/element/types").ExcalidrawElement["strokeStyle"];
79
- currentItemRoughness: number;
80
- currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
81
- currentItemOpacity: number;
82
- currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
83
- currentItemFontSize: number;
84
- currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
85
- currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
86
- currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
87
- currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
88
- currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
89
- currentItemArrowType: "sharp" | "round" | "elbow";
90
- viewBackgroundColor: string;
91
- scrollX: number;
92
- scrollY: number;
93
- cursorButton: "up" | "down";
94
- scrolledOutside: boolean;
95
- name: string | null;
96
- isResizing: boolean;
97
- isRotating: boolean;
98
- zoom: import("../types").Zoom;
99
- openMenu: "canvas" | null;
100
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
101
- openSidebar: {
102
- name: import("../types").SidebarName;
103
- tab?: import("../types").SidebarTabName;
104
- } | null;
105
- openDialog: null | {
106
- name: "imageExport" | "help" | "jsonExport";
107
- } | {
108
- name: "settings";
109
- } | {
110
- name: "elementLinkSelector";
111
- sourceElementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
112
- } | {
113
- name: "charts";
114
- data: import("../charts").Spreadsheet;
115
- rawText: string;
116
- };
117
- defaultSidebarDockedPreference: boolean;
118
- lastPointerDownWith: import("@excalidraw/element/types").PointerType;
119
- selectedElementIds: Readonly<{
120
- [id: string]: true;
121
- }>;
122
- hoveredElementIds: Readonly<{
123
- [id: string]: true;
124
- }>;
125
- previousSelectedElementIds: {
126
- [id: string]: true;
127
- };
128
- selectedElementsAreBeingDragged: boolean;
129
- shouldCacheIgnoreZoom: boolean;
130
- toast: {
131
- message: React.ReactNode;
132
- closable?: boolean;
133
- duration?: number;
134
- } | null;
135
- theme: import("@excalidraw/element/types").Theme;
136
- gridSize: number;
137
- gridStep: number;
138
- gridModeEnabled: boolean;
139
- viewModeEnabled: boolean;
140
- viewModeOnly: boolean;
141
- selectedGroupIds: {
142
- [groupId: string]: boolean;
143
- };
144
- editingGroupId: import("@excalidraw/element/types").GroupId | null;
145
- width: number;
146
- height: number;
147
- offsetTop: number;
148
- offsetLeft: number;
149
- fileHandle: FileSystemFileHandle | null;
150
- collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
151
- stats: {
152
- open: boolean;
153
- panels: number;
154
- };
155
- showHyperlinkPopup: false | "info" | "editor";
156
- selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
157
- snapLines: readonly import("../snapping").SnapLine[];
158
- originSnapOffset: {
159
- x: number;
160
- y: number;
161
- } | null;
162
- objectsSnapModeEnabled: boolean;
163
- userToFollow: import("../types").UserToFollow | null;
164
- followedBy: Set<import("../types").SocketId>;
165
- isCropping: boolean;
166
- croppingElementId: import("@excalidraw/element/types").ExcalidrawElement["id"] | null;
167
- searchMatches: Readonly<{
168
- focusedId: import("@excalidraw/element/types").ExcalidrawElement["id"] | null;
169
- matches: readonly import("../types").SearchMatch[];
170
- }> | null;
171
- activeLockedId: string | null;
172
- lockedMultiSelections: {
173
- [groupId: string]: true;
174
- };
175
- bindMode: import("@excalidraw/element/types").BindMode;
176
- };
177
- captureUpdate: "EVENTUALLY";
178
- };
179
- checked: (appState: Readonly<import("../types").AppState>) => boolean;
180
- predicate: (elements: readonly import("@excalidraw/element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
181
- } & {
182
- keyTest?: undefined;
183
- };
@@ -1,27 +0,0 @@
1
- import type { MarkOptional } from "@excalidraw/common/utility-types";
2
- import "../components/dropdownMenu/DropdownMenu.scss";
3
- import type { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
4
- export declare const DefaultSidebar: import("react").FC<Omit<MarkOptional<Omit<{
5
- name: import("../types").SidebarName;
6
- children: React.ReactNode;
7
- onStateChange?: (state: import("../types").AppState["openSidebar"]) => void;
8
- onDock?: (docked: boolean) => void;
9
- docked?: boolean;
10
- className?: string;
11
- __fallback?: boolean;
12
- }, "name">, "children">, "onDock"> & {
13
- /** pass `false` to disable docking */
14
- onDock?: SidebarProps["onDock"] | false;
15
- } & {
16
- __fallback?: boolean;
17
- }> & {
18
- Trigger: import("react").FC<Omit<SidebarTriggerProps, "name"> & import("react").HTMLAttributes<HTMLDivElement> & {
19
- __fallback?: boolean;
20
- }>;
21
- TabTriggers: {
22
- ({ children }: {
23
- children: React.ReactNode;
24
- }): import("react/jsx-runtime").JSX.Element;
25
- displayName: string;
26
- };
27
- };
@@ -1,7 +0,0 @@
1
- import type { ElementsMap, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
- import "./ElementCanvasButtons.scss";
3
- export declare const ElementCanvasButtons: ({ children, element, elementsMap, }: {
4
- children: React.ReactNode;
5
- element: NonDeletedExcalidrawElement;
6
- elementsMap: ElementsMap;
7
- }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,10 +0,0 @@
1
- import "./FollowMode.scss";
2
- import type { UserToFollow } from "../../types";
3
- interface FollowModeProps {
4
- width: number;
5
- height: number;
6
- userToFollow: UserToFollow;
7
- onDisconnect: () => void;
8
- }
9
- declare const FollowMode: ({ height, width, userToFollow, onDisconnect, }: FollowModeProps) => import("react/jsx-runtime").JSX.Element;
10
- export default FollowMode;
@@ -1,10 +0,0 @@
1
- import "./ToolIcon.scss";
2
- type LockIconProps = {
3
- title?: string;
4
- name?: string;
5
- checked: boolean;
6
- onChange?(): void;
7
- isMobile?: boolean;
8
- };
9
- export declare const HandButton: (props: LockIconProps) => import("react/jsx-runtime").JSX.Element;
10
- export {};
@@ -1,10 +0,0 @@
1
- import "./ToolIcon.scss";
2
- import type { JSX } from "react";
3
- export declare const ElementCanvasButton: (props: {
4
- title?: string;
5
- icon: JSX.Element;
6
- name?: string;
7
- checked: boolean;
8
- onChange?(): void;
9
- isMobile?: boolean;
10
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +0,0 @@
1
- import type { AppState } from "./types";
2
- export declare const resetCursor: (interactiveCanvas: HTMLCanvasElement | null) => void;
3
- export declare const setCursor: (interactiveCanvas: HTMLCanvasElement | null, cursor: string) => void;
4
- export declare const setEraserCursor: (interactiveCanvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
5
- export declare const setCursorForShape: (interactiveCanvas: HTMLCanvasElement | null, appState: Pick<AppState, "activeTool" | "theme">) => void;
@@ -1,18 +0,0 @@
1
- import type { ExcalidrawElement } from "@excalidraw/element/types";
2
- import type { AppState, Offsets, PointerCoords, Zoom } from "../types";
3
- export declare const centerScrollOn: ({ scenePoint, viewportDimensions, zoom, offsets, }: {
4
- scenePoint: PointerCoords;
5
- viewportDimensions: {
6
- height: number;
7
- width: number;
8
- };
9
- zoom: Zoom;
10
- offsets?: Offsets;
11
- }) => {
12
- scrollX: number;
13
- scrollY: number;
14
- };
15
- export declare const calculateScrollCenter: (elements: readonly ExcalidrawElement[], appState: AppState) => {
16
- scrollX: number;
17
- scrollY: number;
18
- };
@@ -1,12 +0,0 @@
1
- import type { AppState, NormalizedZoomValue } from "../types";
2
- export declare const getStateForZoom: ({ viewportX, viewportY, nextZoom, }: {
3
- viewportX: number;
4
- viewportY: number;
5
- nextZoom: NormalizedZoomValue;
6
- }, appState: AppState) => {
7
- scrollX: number;
8
- scrollY: number;
9
- zoom: {
10
- value: NormalizedZoomValue;
11
- };
12
- };
@@ -1,46 +0,0 @@
1
- import type { ExcalidrawElement } from "@excalidraw/element/types";
2
- import type { AppState, Offsets } from "./types";
3
- export declare const SCROLL_TO_CONTENT_ANIMATION_KEY = "animateScrollToContent";
4
- export type ScrollToContentOptions = ({
5
- fitToContent?: boolean;
6
- fitToViewport?: never;
7
- viewportZoomFactor?: number;
8
- animate?: boolean;
9
- duration?: number;
10
- } | {
11
- fitToContent?: never;
12
- fitToViewport?: boolean;
13
- /** when fitToViewport=true, how much screen should the content cover,
14
- * between 0.1 (10%) and 1 (100%) */
15
- viewportZoomFactor?: number;
16
- animate?: boolean;
17
- duration?: number;
18
- }) & {
19
- minZoom?: number;
20
- maxZoom?: number;
21
- canvasOffsets?: Offsets;
22
- };
23
- type Viewport = Pick<AppState, "scrollX" | "scrollY" | "zoom">;
24
- /**
25
- * Scrolls (and optionally zooms) the viewport so that the given target is in
26
- * view, optionally animating the transition.
27
- */
28
- export declare const scrollToElements: (state: AppState, target: readonly ExcalidrawElement[], onFrame: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "shouldCacheIgnoreZoom">) => void, opts?: ScrollToContentOptions) => void;
29
- /**
30
- * Interpolates the viewport from `from` to `target` at the (already-eased)
31
- * blend amount `factor` (0 = `from`, 1 = `target`).
32
- *
33
- * Zoom is interpolated geometrically (so it feels uniform), and rather than
34
- * tweening scrollX/scrollY directly we tween the *focal point* — the scene
35
- * point under the viewport center — and derive scroll from it. Mixing a linear
36
- * scroll with a geometric zoom makes the focal point swoop sideways
37
- * mid-animation (most visible when zooming out); gliding the focal point keeps
38
- * it steady. `width/2/zoom - scroll` is the inverse of `centerScrollOn` without
39
- * offsets, so factor 0/1 land exactly on `from`/`target`.
40
- */
41
- export declare const interpolateViewport: ({ from, target, factor, }: {
42
- from: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height">;
43
- target: Viewport;
44
- factor: number;
45
- }) => Viewport;
46
- export {};