@myoc/element 0.19.548 → 0.20.1

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.
@@ -29,12 +29,14 @@ export declare const CompactShapeActions: ({ appState, elementsMap, renderAction
29
29
  * overflow measurement that promotes duplicate/delete out of the popover when
30
30
  * there is room.
31
31
  */
32
- export declare const MobileShapeActions: ({ appState, elementsMap, renderAction, app, setAppState, }: {
32
+ export declare const MobileShapeActions: ({ appState, elementsMap, renderAction, app, setAppState, showUndo, showRedo, }: {
33
33
  appState: UIAppState;
34
34
  elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
35
35
  renderAction: ActionManager["renderAction"];
36
36
  app: AppClassProperties;
37
37
  setAppState: React.Component<any, AppState>["setState"];
38
+ showUndo?: boolean;
39
+ showRedo?: boolean;
38
40
  }) => import("react/jsx-runtime").JSX.Element;
39
41
  export declare const ZoomActions: ({ renderAction, }: {
40
42
  renderAction: ActionManager["renderAction"];
@@ -30,6 +30,7 @@ interface LayerUIProps {
30
30
  isCollaborating: boolean;
31
31
  generateLinkForSelection?: AppProps["generateLinkForSelection"];
32
32
  currentUserControls?: ExcalidrawProps["currentUserControls"];
33
+ uiLayout?: ExcalidrawProps["uiLayout"];
33
34
  }
34
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onPenModeToggle, showExitZenModeBtn, renderTopLeftUI, renderTopRightUI, renderCustomStats, UIOptions, onExportImage, renderWelcomeScreen, children, app, defaultUIEnabled, zoomUIEnabled, scrollBackToContentUIEnabled, isCollaborating, generateLinkForSelection, currentUserControls, }: LayerUIProps) => import("react/jsx-runtime").JSX.Element>;
35
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onPenModeToggle, showExitZenModeBtn, renderTopLeftUI, renderTopRightUI, renderCustomStats, UIOptions, onExportImage, renderWelcomeScreen, children, app, defaultUIEnabled, zoomUIEnabled, scrollBackToContentUIEnabled, isCollaborating, generateLinkForSelection, currentUserControls, uiLayout, }: LayerUIProps) => import("react/jsx-runtime").JSX.Element>;
35
36
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
3
  import type { ActionManager } from "../actions/manager";
4
- import type { AppClassProperties, AppState, UIAppState } from "../types";
4
+ import type { AppClassProperties, AppState, ExcalidrawProps, UIAppState } from "../types";
5
5
  import type { JSX } from "react";
6
6
  type MobileMenuProps = {
7
7
  appState: UIAppState;
@@ -18,6 +18,7 @@ type MobileMenuProps = {
18
18
  defaultUIEnabled: boolean;
19
19
  scrollBackToContentUIEnabled: boolean;
20
20
  app: AppClassProperties;
21
+ uiLayout?: ExcalidrawProps["uiLayout"];
21
22
  };
22
- export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, renderTopLeftUI, renderTopRightUI, renderSidebars, renderWelcomeScreen, defaultUIEnabled, scrollBackToContentUIEnabled, app, onPenModeToggle, }: MobileMenuProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, renderTopLeftUI, renderTopRightUI, renderSidebars, renderWelcomeScreen, defaultUIEnabled, scrollBackToContentUIEnabled, app, onPenModeToggle, uiLayout, }: MobileMenuProps) => import("react/jsx-runtime").JSX.Element;
23
24
  export {};
@@ -17,6 +17,7 @@ type ToolPopoverProps = {
17
17
  "data-testid": string;
18
18
  onToolChange: (type: string) => void;
19
19
  displayedOption: ToolOption;
20
+ shortcut?: string;
20
21
  };
21
- export declare const ToolPopover: ({ app, options, activeTool, defaultOption, "data-testid": dataTestId, onToolChange, displayedOption, }: ToolPopoverProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const ToolPopover: ({ app, options, activeTool, defaultOption, "data-testid": dataTestId, onToolChange, displayedOption, shortcut, }: ToolPopoverProps) => import("react/jsx-runtime").JSX.Element;
22
23
  export {};
@@ -1,7 +1,25 @@
1
1
  import type { AppClassProperties, AppProps, AppState, UIAppState } from "../types";
2
2
  import type { ActionManager } from "../actions/manager";
3
+ import type { ToolbarToolType } from "./Tools";
4
+ export type ExcalidrawToolbarOverflowItemName = ToolbarToolType | "objectsSnapMode" | "strokeEyedropper";
5
+ export declare const ObjectsSnapModeButton: ({ actionManager, app, }: {
6
+ actionManager: ActionManager;
7
+ app: AppClassProperties;
8
+ }) => import("react/jsx-runtime").JSX.Element | null;
9
+ export declare const StrokeEyeDropperButton: ({ app, }: {
10
+ app: AppClassProperties;
11
+ }) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const ExtraToolsDropdown: ({ app, activeTool, setAppState, UIOptions, isMyocSimplifiedMode, actionManager, overflowItems, }: {
13
+ app: AppClassProperties;
14
+ activeTool: UIAppState["activeTool"];
15
+ setAppState: React.Component<any, AppState>["setState"];
16
+ UIOptions: AppProps["UIOptions"];
17
+ isMyocSimplifiedMode: boolean;
18
+ actionManager: ActionManager;
19
+ overflowItems?: readonly ExcalidrawToolbarOverflowItemName[];
20
+ }) => import("react/jsx-runtime").JSX.Element;
3
21
  /** the main (desktop/tablet) toolbar island */
4
- export declare const Toolbar: ({ app, appState, setAppState, UIOptions, actionManager, onPenModeToggle, onLockToggle, heading, }: {
22
+ export declare const Toolbar: ({ app, appState, setAppState, UIOptions, actionManager, onPenModeToggle, onLockToggle, heading, showPenMode, }: {
5
23
  app: AppClassProperties;
6
24
  appState: UIAppState;
7
25
  setAppState: React.Component<any, AppState>["setState"];
@@ -10,4 +28,5 @@ export declare const Toolbar: ({ app, appState, setAppState, UIOptions, actionMa
10
28
  onPenModeToggle: AppClassProperties["togglePenMode"];
11
29
  onLockToggle: () => void;
12
30
  heading: React.ReactNode;
31
+ showPenMode?: boolean;
13
32
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
+ import type { PointerType } from "@excalidraw/element/types";
1
2
  import type { AppClassProperties, AppState, ToolType, UIAppState } from "../types";
2
3
  export type ToolConfig = {
3
4
  icon: React.ReactNode;
@@ -68,6 +69,30 @@ export type ToolButtonComponentProps = {
68
69
  */
69
70
  hideShortcut?: boolean;
70
71
  };
72
+ type ToolButtonBehavior = {
73
+ /**
74
+ * display the shortcut of another tool (tooltip, aria, keybinding badge) —
75
+ * e.g. the lasso button shows the selection shortcut, which activates it
76
+ * when lasso is the preferred selection tool
77
+ */
78
+ shortcutType?: ToolbarToolType;
79
+ /**
80
+ * custom activation — replaces the default track + `setActiveTool` (pen
81
+ * detection still runs before it)
82
+ */
83
+ onSelect?: (app: AppClassProperties, data: {
84
+ pointerType: PointerType | null;
85
+ }) => void;
86
+ };
87
+ /**
88
+ * Creates a toolbar button component for the given tool. Activation is
89
+ * uniform: track + `setActiveTool` (recording the previous tool for toggle
90
+ * tools), with pen detection on the first pen interaction.
91
+ */
92
+ export declare const createToolButton: (type: ToolbarToolType, behavior?: ToolButtonBehavior) => {
93
+ ({ app, activeTool, hideKeyBinding, hideShortcut, }: ToolButtonComponentProps): import("react/jsx-runtime").JSX.Element;
94
+ displayName: string;
95
+ };
71
96
  export declare const HandToolButton: {
72
97
  ({ app, activeTool, hideKeyBinding, hideShortcut, }: ToolButtonComponentProps): import("react/jsx-runtime").JSX.Element;
73
98
  displayName: string;
@@ -136,10 +161,11 @@ export declare const LassoToolButton: {
136
161
  * The selection ⇄ lasso popover used in compact (tablet) and mobile
137
162
  * toolbars; picking an option also makes it the preferred selection tool.
138
163
  */
139
- export declare const SelectionToolPopover: ({ app, activeTool, setAppState, }: {
164
+ export declare const SelectionToolPopover: ({ app, activeTool, setAppState, hideShortcut, }: {
140
165
  app: AppClassProperties;
141
166
  activeTool: UIAppState["activeTool"];
142
167
  setAppState: React.Component<any, AppState>["setState"];
168
+ hideShortcut?: boolean;
143
169
  }) => import("react/jsx-runtime").JSX.Element;
144
170
  /**
145
171
  * The freedraw ⇄ draw-shape popover used in compact (tablet) and mobile
@@ -149,3 +175,4 @@ export declare const FreedrawToolPopover: ({ app, activeTool, }: {
149
175
  app: AppClassProperties;
150
176
  activeTool: UIAppState["activeTool"];
151
177
  }) => import("react/jsx-runtime").JSX.Element;
178
+ export {};
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import type { EditorInterface } from "@excalidraw/common";
3
+ import "./UIRegionLayout.scss";
4
+ import type { ExcalidrawImperativeAPI, ExcalidrawUIFormFactorLayout, ExcalidrawUIItem, ExcalidrawUIOrientation, ExcalidrawUIRegion, UIAppState } from "../types";
5
+ export type UIRegionLayoutItem = {
6
+ id: ExcalidrawUIItem;
7
+ content: React.ReactNode;
8
+ defaultRegion: ExcalidrawUIRegion;
9
+ defaultOrder?: number;
10
+ defaultOrientation?: ExcalidrawUIOrientation;
11
+ islandGroup?: {
12
+ id: string;
13
+ className: string;
14
+ padding: number;
15
+ gap: number;
16
+ };
17
+ };
18
+ export declare const UIRegionLayout: ({ items, layout, app, appState, editorInterface, className, legacyBottomCenter, legacyBottomLeft, }: {
19
+ items: readonly UIRegionLayoutItem[];
20
+ layout?: ExcalidrawUIFormFactorLayout;
21
+ app: {
22
+ api: ExcalidrawImperativeAPI;
23
+ };
24
+ appState: UIAppState;
25
+ editorInterface: EditorInterface;
26
+ className?: string;
27
+ legacyBottomCenter?: React.ReactNode;
28
+ legacyBottomLeft?: React.ReactNode;
29
+ }) => import("react/jsx-runtime").JSX.Element;
30
+ export declare const getUIFormFactorLayout: (layout: {
31
+ desktop?: ExcalidrawUIFormFactorLayout;
32
+ tablet?: ExcalidrawUIFormFactorLayout;
33
+ mobile?: ExcalidrawUIFormFactorLayout;
34
+ } | undefined, editorInterface: Pick<EditorInterface, "formFactor">) => ExcalidrawUIFormFactorLayout | undefined;
@@ -695,7 +695,45 @@ export type UIConfig = {
695
695
  scrollBackToContent?: boolean;
696
696
  };
697
697
  };
698
+ export type ExcalidrawUIRegion = "topLeft" | "topCenter" | "topRight" | "middleLeft" | "middleRight" | "bottomLeft" | "bottomCenter" | "bottomRight";
699
+ export type ExcalidrawUIOrientation = "auto" | "horizontal" | "vertical";
700
+ /** Built-in controls that can be independently placed by `uiLayout`. */
701
+ export type ExcalidrawUIItem = "mainMenu" | "sidebarTrigger" | "hostTopLeftUI" | "hostTopRightUI" | "toolbar" | "stylesPanel" | "collaborators" | "stats" | "undo" | "redo" | "smartZoom" | "viewMode" | "zoom" | "penMode" | "help";
702
+ export type ExcalidrawUIItemLayout = {
703
+ region?: ExcalidrawUIRegion;
704
+ visible?: boolean;
705
+ order?: number;
706
+ orientation?: ExcalidrawUIOrientation;
707
+ };
708
+ export type ExcalidrawUICustomItem = ExcalidrawUIItemLayout & {
709
+ id: string;
710
+ region: ExcalidrawUIRegion;
711
+ render: (context: {
712
+ api: ExcalidrawImperativeAPI;
713
+ appState: UIAppState;
714
+ /** Current canvas zoom, updated reactively when the viewport zoom changes. */
715
+ zoom: AppState["zoom"];
716
+ editorInterface: EditorInterface;
717
+ region: ExcalidrawUIRegion;
718
+ orientation: Exclude<ExcalidrawUIOrientation, "auto">;
719
+ }) => React.ReactNode;
720
+ };
721
+ export type ExcalidrawUIFormFactorLayout = {
722
+ items?: Partial<Record<ExcalidrawUIItem, ExcalidrawUIItemLayout>>;
723
+ customItems?: readonly ExcalidrawUICustomItem[];
724
+ };
725
+ /** Independent host-owned layouts for each responsive editor form factor. */
726
+ export type ExcalidrawUILayout = {
727
+ desktop?: ExcalidrawUIFormFactorLayout;
728
+ tablet?: ExcalidrawUIFormFactorLayout;
729
+ mobile?: ExcalidrawUIFormFactorLayout;
730
+ };
698
731
  export interface ExcalidrawProps {
732
+ /**
733
+ * Host-controlled placement and visibility for editor UI. Each form factor
734
+ * has its own overrides; omitted values retain that form factor's defaults.
735
+ */
736
+ uiLayout?: ExcalidrawUILayout;
699
737
  className?: string;
700
738
  onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
701
739
  onThemeChange?: (theme: Theme | "system") => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myoc/element",
3
- "version": "0.19.548",
3
+ "version": "0.20.1",
4
4
  "type": "module",
5
5
  "types": "./dist/types/element/src/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -65,9 +65,9 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@discourse/gif": "1.0.0",
68
- "@excalidraw/common": "npm:@myoc/common@0.19.548",
69
- "@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.548",
70
- "@excalidraw/math": "npm:@myoc/math@0.19.548",
68
+ "@excalidraw/common": "npm:@myoc/common@0.20.1",
69
+ "@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.20.1",
70
+ "@excalidraw/math": "npm:@myoc/math@0.20.1",
71
71
  "thumbhash": "0.1.1"
72
72
  }
73
73
  }
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import "./FixedSideContainer.scss";
3
- type FixedSideContainerProps = {
4
- children: React.ReactNode;
5
- side: "top" | "left" | "right";
6
- className?: string;
7
- };
8
- export declare const FixedSideContainer: ({ children, side, className, }: FixedSideContainerProps) => import("react/jsx-runtime").JSX.Element;
9
- export {};
@@ -1,14 +0,0 @@
1
- import type { ActionManager } from "../../actions/manager";
2
- import type { UIAppState } from "../../types";
3
- declare const Footer: {
4
- ({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, defaultUIEnabled, zoomUIEnabled, }: {
5
- appState: UIAppState;
6
- actionManager: ActionManager;
7
- showExitZenModeBtn: boolean;
8
- renderWelcomeScreen: boolean;
9
- defaultUIEnabled: boolean;
10
- zoomUIEnabled: boolean;
11
- }): import("react/jsx-runtime").JSX.Element;
12
- displayName: string;
13
- };
14
- export default Footer;