@myoc/element 0.19.547 → 0.20.0

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 {};
@@ -1,7 +1,7 @@
1
1
  import type { AppClassProperties, AppProps, AppState, UIAppState } from "../types";
2
2
  import type { ActionManager } from "../actions/manager";
3
3
  /** the main (desktop/tablet) toolbar island */
4
- export declare const Toolbar: ({ app, appState, setAppState, UIOptions, actionManager, onPenModeToggle, onLockToggle, heading, }: {
4
+ export declare const Toolbar: ({ app, appState, setAppState, UIOptions, actionManager, onPenModeToggle, onLockToggle, heading, showPenMode, }: {
5
5
  app: AppClassProperties;
6
6
  appState: UIAppState;
7
7
  setAppState: React.Component<any, AppState>["setState"];
@@ -10,4 +10,5 @@ export declare const Toolbar: ({ app, appState, setAppState, UIOptions, actionMa
10
10
  onPenModeToggle: AppClassProperties["togglePenMode"];
11
11
  onLockToggle: () => void;
12
12
  heading: React.ReactNode;
13
+ showPenMode?: boolean;
13
14
  }) => import("react/jsx-runtime").JSX.Element;
@@ -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,43 @@ 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
+ editorInterface: EditorInterface;
715
+ region: ExcalidrawUIRegion;
716
+ orientation: Exclude<ExcalidrawUIOrientation, "auto">;
717
+ }) => React.ReactNode;
718
+ };
719
+ export type ExcalidrawUIFormFactorLayout = {
720
+ items?: Partial<Record<ExcalidrawUIItem, ExcalidrawUIItemLayout>>;
721
+ customItems?: readonly ExcalidrawUICustomItem[];
722
+ };
723
+ /** Independent host-owned layouts for each responsive editor form factor. */
724
+ export type ExcalidrawUILayout = {
725
+ desktop?: ExcalidrawUIFormFactorLayout;
726
+ tablet?: ExcalidrawUIFormFactorLayout;
727
+ mobile?: ExcalidrawUIFormFactorLayout;
728
+ };
698
729
  export interface ExcalidrawProps {
730
+ /**
731
+ * Host-controlled placement and visibility for editor UI. Each form factor
732
+ * has its own overrides; omitted values retain that form factor's defaults.
733
+ */
734
+ uiLayout?: ExcalidrawUILayout;
699
735
  className?: string;
700
736
  onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
701
737
  onThemeChange?: (theme: Theme | "system") => void;
@@ -1160,6 +1196,7 @@ export interface ExcalidrawImperativeAPI {
1160
1196
  setCursor: InstanceType<typeof App>["cursor"]["set"];
1161
1197
  resetCursor: InstanceType<typeof App>["cursor"]["reset"];
1162
1198
  toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
1199
+ setDesktopUIMode: InstanceType<typeof App>["setDesktopUIMode"];
1163
1200
  getEditorInterface: () => EditorInterface;
1164
1201
  /**
1165
1202
  * Disables rendering of frames (including element clipping), but currently
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myoc/element",
3
- "version": "0.19.547",
3
+ "version": "0.20.0",
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.547",
69
- "@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.547",
70
- "@excalidraw/math": "npm:@myoc/math@0.19.547",
68
+ "@excalidraw/common": "npm:@myoc/common@0.20.0",
69
+ "@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.20.0",
70
+ "@excalidraw/math": "npm:@myoc/math@0.20.0",
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;