@myoc/math 0.19.522 → 0.19.524

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.
@@ -765,9 +765,9 @@ export declare const actionZoomToFitSelectionInViewport: {
765
765
  };
766
766
  captureUpdate: "EVENTUALLY";
767
767
  };
768
- keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
768
+ keyTest: undefined;
769
769
  } & {
770
- keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
770
+ keyTest?: undefined;
771
771
  };
772
772
  export declare const actionZoomToFitSelection: {
773
773
  name: "zoomToFitSelection";
@@ -956,9 +956,9 @@ export declare const actionZoomToFitSelection: {
956
956
  };
957
957
  captureUpdate: "EVENTUALLY";
958
958
  };
959
- keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
959
+ keyTest: undefined;
960
960
  } & {
961
- keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
961
+ keyTest?: undefined;
962
962
  };
963
963
  export declare const actionZoomToFit: {
964
964
  name: "zoomToFit";
@@ -1147,9 +1147,9 @@ export declare const actionZoomToFit: {
1147
1147
  };
1148
1148
  captureUpdate: "EVENTUALLY";
1149
1149
  };
1150
- keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
1150
+ keyTest: undefined;
1151
1151
  } & {
1152
- keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
1152
+ keyTest?: undefined;
1153
1153
  };
1154
1154
  export declare const actionToggleTheme: import("./types").Action<import("@excalidraw/element/types").Theme> & {
1155
1155
  keyTest?: ((event: React.KeyboardEvent | KeyboardEvent, appState: AppState, elements: readonly import("@excalidraw/element/types").ExcalidrawElement[], app: import("../types").AppClassProperties) => boolean) | undefined;
@@ -0,0 +1,16 @@
1
+ export declare const actionSmartZoom: {
2
+ name: "smartZoom";
3
+ label: string;
4
+ trackEvent: {
5
+ category: "toolbar";
6
+ };
7
+ icon: import("react/jsx-runtime").JSX.Element;
8
+ viewMode: true;
9
+ perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: unknown, app: import("../types").AppClassProperties) => {
10
+ captureUpdate: "NEVER";
11
+ };
12
+ keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
13
+ PanelComponent: ({ data, updateData }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
14
+ } & {
15
+ keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
16
+ };
@@ -18,7 +18,7 @@ export { actionNormaliseElements } from "./actionNormalise";
18
18
  export { actionFlipHorizontal, actionFlipVertical } from "./actionFlip";
19
19
  export { actionCopy, actionCut, actionCopyAsPng, actionCopyAsSvg, copyText, } from "./actionClipboard";
20
20
  export { actionToggleGridMode } from "./actionToggleGridMode";
21
- export { actionToggleZenMode } from "./actionToggleZenMode";
21
+ export { actionSmartZoom } from "./actionSmartZoom";
22
22
  export { actionToggleObjectsSnapMode } from "./actionToggleObjectsSnapMode";
23
23
  export { actionToggleArrowBinding } from "./actionToggleArrowBinding";
24
24
  export { actionToggleMidpointSnapping } from "./actionToggleMidpointSnapping";
@@ -1,4 +1,4 @@
1
1
  import type { SubtypeOf } from "@excalidraw/common/utility-types";
2
2
  import type { ActionName } from "./types";
3
- export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts" | "wrapSelectionInFrame" | "arrangeElements"> | "saveScene" | "imageExport" | "searchMenu" | "toolLock";
3
+ export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "objectsSnapMode" | "stats" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts" | "wrapSelectionInFrame" | "arrangeElements"> | "saveScene" | "imageExport" | "searchMenu" | "toolLock";
4
4
  export declare const getShortcutFromShortcutName: (name: ShortcutName, idx?: number) => string;
@@ -14,7 +14,7 @@ export type ActionResult = {
14
14
  type ActionFn<TData = any> = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: TData | undefined, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
15
15
  export type UpdaterFn = (res: ActionResult) => void;
16
16
  export type ActionFilterFn = (action: Action) => void;
17
- export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeBucketFillBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "arrangeElements" | "normaliseElements" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "createContainerFromText" | "wrapTextInContainer" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "smartZoom" | "toggleLassoTool" | "toggleShapeSwitch" | "togglePolygon";
17
+ export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeBucketFillBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "arrangeElements" | "normaliseElements" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "createContainerFromText" | "wrapTextInContainer" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "smartZoom" | "toggleLassoTool" | "toggleShapeSwitch" | "togglePolygon";
18
18
  export type PanelComponentProps = {
19
19
  elements: readonly ExcalidrawElement[];
20
20
  appState: UIAppState;
@@ -43,8 +43,7 @@ export declare const UndoRedoActions: ({ renderAction, className, }: {
43
43
  renderAction: ActionManager["renderAction"];
44
44
  className?: string;
45
45
  }) => import("react/jsx-runtime").JSX.Element;
46
- export declare const ExitZenModeButton: ({ actionManager, showExitZenModeBtn, }: {
47
- actionManager: ActionManager;
46
+ export declare const ExitZenModeButton: ({ showExitZenModeBtn, }: {
48
47
  showExitZenModeBtn: boolean;
49
48
  }) => import("react/jsx-runtime").JSX.Element;
50
49
  export declare const ExitViewModeButton: ({ actionManager, }: {
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
3
3
  import { LinearElementEditor, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
4
4
  import type { LocalPoint, Radians } from "@excalidraw/math";
5
- import type { ExcalidrawElement, ExcalidrawTextElement, NonDeleted, FileId, NonDeletedExcalidrawElement, ExcalidrawTextContainer, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
5
+ import type { ExcalidrawElement, ExcalidrawTextElement, NonDeleted, FileId, NonDeletedExcalidrawElement, ExcalidrawTextContainer, ExcalidrawFrameLikeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
6
6
  import type { Mutable } from "@excalidraw/common/utility-types";
7
7
  import { ActionManager } from "../actions/manager";
8
8
  import { History } from "../history";
@@ -124,6 +124,7 @@ declare class App extends React.Component<AppProps, AppState> {
124
124
  bucketFill: AppBucketFill;
125
125
  flowchart: AppFlowchart;
126
126
  cursor: AppCursor;
127
+ private zDragZoom;
127
128
  arrowText: AppArrowText;
128
129
  viewport: AppViewport;
129
130
  get lastViewportPosition(): {
@@ -392,7 +393,10 @@ declare class App extends React.Component<AppProps, AppState> {
392
393
  onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
393
394
  exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
394
395
  }) => Promise<void>;
395
- private openEyeDropper;
396
+ openEyeDropper: ({ type, swapPreviewOnAlt, }: {
397
+ type: "stroke" | "background";
398
+ swapPreviewOnAlt?: boolean;
399
+ }) => void;
396
400
  dismissLinearEditor: () => void;
397
401
  syncActionResult: (actionResult: ActionResult) => void;
398
402
  scheduleCapture: () => void;
@@ -812,6 +816,7 @@ declare class App extends React.Component<AppProps, AppState> {
812
816
  private maybeUpdateFrameToHighlightOnPointerMove;
813
817
  insertNewElements: (elements: readonly ExcalidrawElement[]) => void;
814
818
  insertNewElement: (element: ExcalidrawElement) => void;
819
+ private updateZDragZoom;
815
820
  private handleCanvasPointerMove;
816
821
  private handleEraser;
817
822
  private handleTouchMove;
@@ -849,7 +854,7 @@ declare class App extends React.Component<AppProps, AppState> {
849
854
  sceneY: number;
850
855
  width: number;
851
856
  height: number;
852
- }) => NonDeleted<ExcalidrawIframeElement>;
857
+ }) => NonDeleted<import("@excalidraw/element/types").ExcalidrawIframeElement>;
853
858
  insertEmbeddableElement: ({ sceneX, sceneY, link, }: {
854
859
  sceneX: number;
855
860
  sceneY: number;
@@ -896,6 +901,7 @@ declare class App extends React.Component<AppProps, AppState> {
896
901
  private maybeDragNewGenericElement;
897
902
  private maybeHandleCrop;
898
903
  private maybeHandleResize;
904
+ private getImageContextMenuItems;
899
905
  private getContextMenuItems;
900
906
  private handleWheel;
901
907
  getTextWysiwygSnappedToCenterPosition(x: number, y: number, appState: AppState, container?: ExcalidrawTextContainer | null): {
@@ -0,0 +1,27 @@
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,9 +1,11 @@
1
1
  import "./ToolIcon.scss";
2
2
  import "./MobileToolbar.scss";
3
+ import type { ActionManager } from "../actions/manager";
3
4
  import type { AppClassProperties, UIAppState } from "../types";
4
5
  type MobileToolbarProps = {
5
6
  app: AppClassProperties;
7
+ actionManager: ActionManager;
6
8
  setAppState: React.Component<any, UIAppState>["setState"];
7
9
  };
8
- export declare const MobileToolbar: ({ app, setAppState }: MobileToolbarProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const MobileToolbar: ({ app, actionManager, setAppState, }: MobileToolbarProps) => import("react/jsx-runtime").JSX.Element;
9
11
  export {};
@@ -1,10 +1,12 @@
1
1
  import type { AppClassProperties, AppProps, AppState, UIAppState } from "../types";
2
+ import type { ActionManager } from "../actions/manager";
2
3
  /** the main (desktop/tablet) toolbar island */
3
- export declare const Toolbar: ({ app, appState, setAppState, UIOptions, onPenModeToggle, onLockToggle, heading, }: {
4
+ export declare const Toolbar: ({ app, appState, setAppState, UIOptions, actionManager, onPenModeToggle, onLockToggle, heading, }: {
4
5
  app: AppClassProperties;
5
6
  appState: UIAppState;
6
7
  setAppState: React.Component<any, AppState>["setState"];
7
8
  UIOptions: AppProps["UIOptions"];
9
+ actionManager: ActionManager;
8
10
  onPenModeToggle: AppClassProperties["togglePenMode"];
9
11
  onLockToggle: () => void;
10
12
  heading: React.ReactNode;
@@ -3,9 +3,8 @@ export type ToolConfig = {
3
3
  icon: React.ReactNode;
4
4
  /** letter shortcut(s) — the first one is shown in tooltips */
5
5
  letterKey?: string | readonly string[];
6
- /** whether `letterKey` requires Shift to be held (e.g. Shift+X) */
6
+ /** whether `letterKey` requires Shift to be held */
7
7
  shiftKey?: boolean;
8
- numericKey?: string;
9
8
  /** whether the tool's shapes can be filled — fills the icon when active */
10
9
  fillable?: boolean;
11
10
  /**
@@ -41,14 +40,16 @@ export declare const TOOLS: {
41
40
  lasso: ToolConfig;
42
41
  };
43
42
  export type ToolbarToolType = keyof typeof TOOLS;
43
+ export declare const MYOC_SIMPLIFIED_MAIN_TOOL_TYPES: readonly ["selection", "freedraw", "text", "image", "eraser"];
44
+ export declare const MYOC_SIMPLIFIED_EXTRA_TOOL_TYPES: readonly ["autoshape", "rectangle", "diamond", "ellipse", "arrow", "line"];
44
45
  /**
45
46
  * tools that, when activated while already active, switch back to the
46
47
  * previously active tool (see `setActiveTool`'s `toggle` option)
47
48
  */
48
49
  export declare const TOGGLE_TOOLS: readonly (ToolType | "custom")[];
49
50
  export declare const getToolLetter: (type: ToolbarToolType) => string | undefined;
50
- /** human-readable shortcut hint, e.g. "R or 2", used in tooltips & aria */
51
- export declare const getToolShortcut: (type: ToolbarToolType) => string;
51
+ /** human-readable shortcut hint, e.g. "R", used in tooltips & aria */
52
+ export declare const getToolShortcut: (type: ToolbarToolType) => string | undefined;
52
53
  export declare const findShapeByKey: (key: string, app: AppClassProperties, shiftKey?: boolean) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "lasso" | "eraser" | "hand" | "laser" | "autoshape" | "bucketfill" | null;
53
54
  /**
54
55
  * Whether a toolbar entry activating the given tool renders disabled — true
@@ -111,6 +112,10 @@ export declare const FrameToolButton: {
111
112
  ({ app, activeTool, hideKeyBinding, hideShortcut, }: ToolButtonComponentProps): import("react/jsx-runtime").JSX.Element;
112
113
  displayName: string;
113
114
  };
115
+ export declare const AutoshapeToolButton: {
116
+ ({ app, activeTool, hideKeyBinding, hideShortcut, }: ToolButtonComponentProps): import("react/jsx-runtime").JSX.Element;
117
+ displayName: string;
118
+ };
114
119
  /**
115
120
  * The selection tool button — pointer-clicking it while the selection tool
116
121
  * is active switches to lasso.
@@ -56,7 +56,6 @@ export declare const LiveCollaborationTrigger: {
56
56
  displayName: string;
57
57
  };
58
58
  export declare const PreferencesToggleGridModeItem: () => import("react/jsx-runtime").JSX.Element;
59
- export declare const PreferencesToggleZenModeItem: () => import("react/jsx-runtime").JSX.Element;
60
59
  export declare const Preferences: {
61
60
  ({ children, additionalItems, }: {
62
61
  children?: React.ReactNode;
@@ -68,7 +67,6 @@ export declare const Preferences: {
68
67
  ToggleArrowBinding: () => import("react/jsx-runtime").JSX.Element;
69
68
  ToggleMidpointSnapping: () => import("react/jsx-runtime").JSX.Element;
70
69
  ToggleGridMode: () => import("react/jsx-runtime").JSX.Element;
71
- ToggleZenMode: () => import("react/jsx-runtime").JSX.Element;
72
70
  ToggleViewMode: () => import("react/jsx-runtime").JSX.Element | null;
73
71
  ToggleElementProperties: () => import("react/jsx-runtime").JSX.Element;
74
72
  displayName: string;
@@ -116,6 +116,13 @@ export type ImageStatus = {
116
116
  downloadError?: ImageDownloadErrorStatus | null;
117
117
  uploadProgress?: ImageUploadProgressStatus | null;
118
118
  };
119
+ export type RenderCustomizations = {
120
+ /**
121
+ * Host-controlled color for transient canvas traces whose visibility depends
122
+ * on the embedding app background, such as eraser and draw-to-shape trails.
123
+ */
124
+ traceColor?: string;
125
+ };
119
126
  export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser" | "autoshape" | "bucketfill";
120
127
  export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
121
128
  export type ActiveTool = {
@@ -797,10 +804,10 @@ export interface ExcalidrawProps {
797
804
  type: "custom";
798
805
  customType: string;
799
806
  };
800
- zenModeEnabled?: boolean;
801
807
  gridModeEnabled?: boolean;
802
808
  objectsSnapModeEnabled?: boolean;
803
809
  theme?: Theme;
810
+ renderCustomizations?: RenderCustomizations;
804
811
  name?: string;
805
812
  renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
806
813
  editorPreferences?: EditorPreferences;
@@ -970,6 +977,7 @@ export type AppClassProperties = {
970
977
  addElementsFromPaste: App["addElementsFromPaste"];
971
978
  togglePenMode: App["togglePenMode"];
972
979
  toggleLock: App["toggleLock"];
980
+ openEyeDropper: App["openEyeDropper"];
973
981
  setActiveTool: App["setActiveTool"];
974
982
  setOpenDialog: App["setOpenDialog"];
975
983
  insertEmbeddableElement: App["insertEmbeddableElement"];
@@ -57,6 +57,11 @@ export type SetViewportOptions = {
57
57
  * combination. See {@link ViewportOffsets}.
58
58
  */
59
59
  offsets?: ViewportOffsets;
60
+ /**
61
+ * Multiplier applied to fit zooms to leave extra breathing room around the
62
+ * target. Ignored for `fit: "none"`.
63
+ */
64
+ viewportZoomFactor?: number;
60
65
  };
61
66
  type Viewport = Pick<AppState, "scrollX" | "scrollY" | "zoom">;
62
67
  /**
@@ -73,7 +78,7 @@ export declare const constrainScrollState: (state: Pick<AppState, "scrollX" | "s
73
78
  * cancelling the other.
74
79
  */
75
80
  export declare const getViewportForZoomWithScrollConstraints: (opts: ZoomOptions, state: AppState) => Viewport;
76
- export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fit, minZoom, maxZoom, steppedZoom, }: {
81
+ export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fit, minZoom, maxZoom, steppedZoom, viewportZoomFactor, }: {
77
82
  bounds: SceneBounds;
78
83
  canvasOffsets?: Offsets;
79
84
  appState: Readonly<AppState>;
@@ -81,6 +86,7 @@ export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fit, m
81
86
  minZoom?: number;
82
87
  maxZoom?: number;
83
88
  steppedZoom?: boolean;
89
+ viewportZoomFactor?: number;
84
90
  }) => {
85
91
  appState: {
86
92
  scrollX: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myoc/math",
3
- "version": "0.19.522",
3
+ "version": "0.19.524",
4
4
  "type": "module",
5
5
  "types": "./dist/types/math/src/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -62,6 +62,6 @@
62
62
  "build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
63
63
  },
64
64
  "dependencies": {
65
- "@excalidraw/common": "npm:@myoc/common@0.19.522"
65
+ "@excalidraw/common": "npm:@myoc/common@0.19.524"
66
66
  }
67
67
  }
@@ -1,191 +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
- hoveredArrowTextAnchor: {
50
- elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
51
- anchor: "start" | "end" | "label";
52
- } | null;
53
- frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
54
- frameRendering: {
55
- enabled: boolean;
56
- name: boolean;
57
- outline: boolean;
58
- clip: boolean;
59
- };
60
- editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
61
- elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
62
- editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
63
- activeTool: {
64
- lastActiveTool: import("../types").ActiveTool | null;
65
- locked: boolean;
66
- fromSelection: boolean;
67
- } & import("../types").ActiveTool;
68
- preferredSelectionTool: {
69
- type: "selection" | "lasso";
70
- initialized: boolean;
71
- };
72
- penMode: boolean;
73
- penDetected: boolean;
74
- exportBackground: boolean;
75
- exportEmbedScene: boolean;
76
- exportWithDarkMode: boolean;
77
- exportScale: number;
78
- currentItemStrokeColor: string;
79
- currentItemBackgroundColor: string;
80
- currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
81
- currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
82
- currentItemStrokeStyle: import("@excalidraw/element/types").ExcalidrawElement["strokeStyle"];
83
- currentItemRoughness: number;
84
- currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
85
- currentItemOpacity: number;
86
- currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
87
- currentItemFontSize: number;
88
- currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
89
- currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
90
- currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
91
- currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
92
- currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
93
- currentItemArrowType: "sharp" | "round" | "elbow";
94
- viewBackgroundColor: string;
95
- scrollX: number;
96
- scrollY: number;
97
- scrollConstraints: import("../types").ScrollConstraints | null;
98
- cursorButton: "up" | "down";
99
- scrolledOutside: boolean;
100
- name: string | null;
101
- isResizing: boolean;
102
- isRotating: boolean;
103
- zoom: import("../types").Zoom;
104
- openMenu: "canvas" | null;
105
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
106
- openSidebar: {
107
- name: import("../types").SidebarName;
108
- tab?: import("../types").SidebarTabName;
109
- } | null;
110
- openDialog: null | {
111
- name: "imageExport" | "help" | "jsonExport";
112
- } | {
113
- name: "settings";
114
- } | {
115
- name: "elementLinkSelector";
116
- sourceElementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
117
- } | {
118
- name: "charts";
119
- data: import("../charts").Spreadsheet;
120
- rawText: string;
121
- };
122
- defaultSidebarDockedPreference: boolean;
123
- lastPointerDownWith: import("@excalidraw/element/types").PointerType;
124
- selectedElementIds: Readonly<{
125
- [id: string]: true;
126
- }>;
127
- hoveredElementIds: Readonly<{
128
- [id: string]: true;
129
- }>;
130
- previousSelectedElementIds: {
131
- [id: string]: true;
132
- };
133
- selectedElementsAreBeingDragged: boolean;
134
- shouldCacheIgnoreZoom: boolean;
135
- toast: {
136
- message: React.ReactNode;
137
- closable?: boolean;
138
- duration?: number;
139
- } | null;
140
- theme: import("@excalidraw/element/types").Theme;
141
- gridSize: number;
142
- gridStep: number;
143
- gridModeEnabled: boolean;
144
- viewModeEnabled: boolean;
145
- viewModeOnly: boolean;
146
- selectedGroupIds: {
147
- [groupId: string]: boolean;
148
- };
149
- editingGroupId: import("@excalidraw/element/types").GroupId | null;
150
- width: number;
151
- height: number;
152
- offsetTop: number;
153
- offsetLeft: number;
154
- fileHandle: FileSystemFileHandle | null;
155
- collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
156
- stats: {
157
- open: boolean;
158
- panels: number;
159
- };
160
- showHyperlinkPopup: false | "info" | "editor";
161
- selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
162
- snapLines: readonly import("../snapping").SnapLine[];
163
- originSnapOffset: {
164
- x: number;
165
- y: number;
166
- } | null;
167
- objectsSnapModeEnabled: boolean;
168
- isCropping: boolean;
169
- croppingElementId: import("@excalidraw/element/types").ExcalidrawElement["id"] | null;
170
- searchMatches: Readonly<{
171
- focusedId: import("@excalidraw/element/types").ExcalidrawElement["id"] | null;
172
- matches: readonly import("../types").SearchMatch[];
173
- }> | null;
174
- activeLockedId: string | null;
175
- lockedMultiSelections: {
176
- [groupId: string]: true;
177
- };
178
- bindMode: import("@excalidraw/element/types").BindMode;
179
- colorTopPicks: {
180
- elementStroke: readonly string[] | null;
181
- elementBackground: readonly string[] | null;
182
- bucketFill: readonly string[] | null;
183
- };
184
- };
185
- captureUpdate: "EVENTUALLY";
186
- };
187
- checked: (appState: Readonly<import("../types").UIAppState>) => boolean;
188
- predicate: (elements: readonly import("@excalidraw/element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
189
- } & {
190
- keyTest?: undefined;
191
- };