diff --git a/src/components/Toolbar.scss b/src/components/Toolbar.scss
index fb2a32b1..e6831b45 100644
--- a/src/components/Toolbar.scss
+++ b/src/components/Toolbar.scss
@@ -1,26 +1,5 @@
@import "open-color/open-color.scss";
-
-@mixin toolbarButtonColorStates {
- .ToolIcon_type_radio,
- .ToolIcon_type_checkbox {
- & + .ToolIcon__icon:active {
- background: var(--color-primary-light);
- }
- &:checked + .ToolIcon__icon {
- background: var(--color-primary);
- --icon-fill-color: #{$oc-white};
- --keybinding-color: #{$oc-white};
- }
- &:checked + .ToolIcon__icon:active {
- background: var(--color-primary-darker);
- }
- }
-
- .ToolIcon__keybinding {
- bottom: 4px;
- right: 4px;
- }
-}
+@import "../css/variables.module";
.excalidraw {
.App-toolbar-container {
diff --git a/src/constants.ts b/src/constants.ts
index afb7ecf3..9bbacd8f 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -155,9 +155,19 @@ export const DEFAULT_UI_OPTIONS: AppProps["UIOptions"] = {
},
};
+// breakpoints
+// -----------------------------------------------------------------------------
+// sm screen
+export const MQ_SM_MAX_WIDTH = 640;
+// md screen
export const MQ_MAX_WIDTH_PORTRAIT = 730;
export const MQ_MAX_WIDTH_LANDSCAPE = 1000;
export const MQ_MAX_HEIGHT_LANDSCAPE = 500;
+// sidebar
+export const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
+// -----------------------------------------------------------------------------
+
+export const LIBRARY_SIDEBAR_WIDTH = parseInt(cssVariables.rightSidebarWidth);
export const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
diff --git a/src/css/styles.scss b/src/css/styles.scss
index 0de93901..920f7e7a 100644
--- a/src/css/styles.scss
+++ b/src/css/styles.scss
@@ -350,7 +350,6 @@
align-items: flex-start;
cursor: default;
pointer-events: none !important;
- z-index: 100;
:root[dir="ltr"] & {
left: 0.25rem;
@@ -391,6 +390,7 @@
.App-menu__left {
overflow-y: auto;
+ box-shadow: var(--shadow-island);
}
.dropdown-select {
@@ -449,6 +449,7 @@
bottom: 30px;
transform: translateX(-50%);
padding: 10px 20px;
+ pointer-events: all;
}
.help-icon {
@@ -567,6 +568,22 @@
display: none;
}
}
+
+ // use custom, minimalistic scrollbar
+ // (doesn't work in Firefox)
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+ ::-webkit-scrollbar-thumb {
+ background: var(--button-gray-2);
+ border-radius: 10px;
+ }
+ ::-webkit-scrollbar-thumb:hover {
+ background: var(--button-gray-3);
+ }
+ ::-webkit-scrollbar-thumb:active {
+ background: var(--button-gray-2);
+ }
}
.ErrorSplash.excalidraw {
diff --git a/src/css/variables.module.scss b/src/css/variables.module.scss
index 0d2c37f9..4c90fd13 100644
--- a/src/css/variables.module.scss
+++ b/src/css/variables.module.scss
@@ -6,8 +6,32 @@
}
}
+@mixin toolbarButtonColorStates {
+ .ToolIcon_type_radio,
+ .ToolIcon_type_checkbox {
+ & + .ToolIcon__icon:active {
+ background: var(--color-primary-light);
+ }
+ &:checked + .ToolIcon__icon {
+ background: var(--color-primary);
+ --icon-fill-color: #{$oc-white};
+ --keybinding-color: #{$oc-white};
+ }
+ &:checked + .ToolIcon__icon:active {
+ background: var(--color-primary-darker);
+ }
+ }
+
+ .ToolIcon__keybinding {
+ bottom: 4px;
+ right: 4px;
+ }
+}
+
$theme-filter: "invert(93%) hue-rotate(180deg)";
+$right-sidebar-width: "302px";
:export {
themeFilter: unquote($theme-filter);
+ rightSidebarWidth: unquote($right-sidebar-width);
}
diff --git a/src/data/restore.ts b/src/data/restore.ts
index 8b5ba433..24bfca79 100644
--- a/src/data/restore.ts
+++ b/src/data/restore.ts
@@ -283,6 +283,11 @@ export const restoreAppState = (
value: appState.zoom as NormalizedZoomValue,
}
: appState.zoom || defaultAppState.zoom,
+ // when sidebar docked and user left it open in last session,
+ // keep it open. If not docked, keep it closed irrespective of last state.
+ isLibraryOpen: nextAppState.isLibraryMenuDocked
+ ? nextAppState.isLibraryOpen
+ : false,
};
};
diff --git a/src/locales/en.json b/src/locales/en.json
index f6d887cf..b20f6a4e 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -120,7 +120,12 @@
"lockAll": "Lock all",
"unlockAll": "Unlock all"
},
- "statusPublished": "Published"
+ "statusPublished": "Published",
+ "sidebarLock": "Keep sidebar open"
+ },
+ "library": {
+ "hint_emptyLibrary": "Select an item on canvas to add it here, or install a library from the public repository, below.",
+ "hint_emptyPrivateLibrary": "Select an item on canvas to add it here."
},
"buttons": {
"clearReset": "Reset the canvas",
diff --git a/src/packages/excalidraw/CHANGELOG.md b/src/packages/excalidraw/CHANGELOG.md
index 8f5265db..c5030800 100644
--- a/src/packages/excalidraw/CHANGELOG.md
+++ b/src/packages/excalidraw/CHANGELOG.md
@@ -17,6 +17,8 @@ Please add the latest change on the top under the correct section.
#### Features
+- Add `[UIOptions.dockedSidebarBreakpoint]`(https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#dockedSidebarBreakpoint) to customize at which point to break from the docked sidebar [#5274](https://github.com/excalidraw/excalidraw/pull/5274).
+
- Added support for supplying user `id` in the Collaborator object (see `collaborators` in [`updateScene()`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#updateScene)), which will be used to deduplicate users when rendering collaborator avatar list. Cursors will still be rendered for every user. [#5309](https://github.com/excalidraw/excalidraw/pull/5309)
- Export API to [set](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#setCursor) and [reset](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#resetCursor) mouse cursor on the canvas [#5215](https://github.com/excalidraw/excalidraw/pull/5215).
diff --git a/src/packages/excalidraw/README_NEXT.md b/src/packages/excalidraw/README_NEXT.md
index 1cb7e617..d01d1280 100644
--- a/src/packages/excalidraw/README_NEXT.md
+++ b/src/packages/excalidraw/README_NEXT.md
@@ -639,7 +639,7 @@ This prop sets the name of the drawing which will be used when exporting the dra
#### `UIOptions`
-This prop can be used to customise UI of Excalidraw. Currently we support customising only [`canvasActions`](#canvasActions). It accepts the below parameters
+This prop can be used to customise UI of Excalidraw. Currently we support customising [`canvasActions`](#canvasActions) and [`dockedSidebarBreakpoint`](dockedSidebarBreakpoint). It accepts the below parameters
{ canvasActions: CanvasActions }
@@ -657,6 +657,12 @@ This prop can be used to customise UI of Excalidraw. Currently we support custom
| `theme` | boolean | true | Implies whether to show `Theme toggle` |
| `saveAsImage` | boolean | true | Implies whether to show `Save as image button` |
+##### `dockedSidebarBreakpoint`
+
+This prop indicates at what point should we break to a docked, permanent sidebar. If not passed it defaults to [`MQ_RIGHT_SIDEBAR_MAX_WIDTH_PORTRAIT`](https://github.com/excalidraw/excalidraw/blob/master/src/constants.ts#L167). If the `width` of the `excalidraw` container exceeds `dockedSidebarBreakpoint`, the sidebar will be dockable. If user choses to dock the sidebar, it will push the right part of the UI towards the left, making space for the sidebar as shown below.
+
+![image](https://user-images.githubusercontent.com/11256141/174664866-c698c3fa-197b-43ff-956c-d79852c7b326.png)
+
#### `exportOpts`
The below attributes can be set in `UIOptions.canvasActions.export` to customize the export dialog. If `UIOptions.canvasActions.export` is `false` the export button will not be rendered.
diff --git a/src/packages/excalidraw/index.tsx b/src/packages/excalidraw/index.tsx
index 936effdb..fc567a5c 100644
--- a/src/packages/excalidraw/index.tsx
+++ b/src/packages/excalidraw/index.tsx
@@ -44,6 +44,7 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
const canvasActions = props.UIOptions?.canvasActions;
const UIOptions: AppProps["UIOptions"] = {
+ ...props.UIOptions,
canvasActions: {
...DEFAULT_UI_OPTIONS.canvasActions,
...canvasActions,
diff --git a/src/tests/__snapshots__/contextmenu.test.tsx.snap b/src/tests/__snapshots__/contextmenu.test.tsx.snap
index 156a17f4..72c4defd 100644
--- a/src/tests/__snapshots__/contextmenu.test.tsx.snap
+++ b/src/tests/__snapshots__/contextmenu.test.tsx.snap
@@ -38,6 +38,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -211,6 +212,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -388,6 +390,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -726,6 +729,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -1064,6 +1068,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -1241,6 +1246,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -1454,6 +1460,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -1726,6 +1733,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -2082,6 +2090,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -2882,6 +2891,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -3220,6 +3230,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -3558,6 +3569,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -3976,6 +3988,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -4254,6 +4267,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -4613,6 +4627,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -4719,6 +4734,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -4803,6 +4819,7 @@ Object {
"gridSize": null,
"height": 100,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
diff --git a/src/tests/__snapshots__/regressionTests.test.tsx.snap b/src/tests/__snapshots__/regressionTests.test.tsx.snap
index 14270d1d..9716320c 100644
--- a/src/tests/__snapshots__/regressionTests.test.tsx.snap
+++ b/src/tests/__snapshots__/regressionTests.test.tsx.snap
@@ -38,6 +38,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -547,6 +548,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -1062,6 +1064,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": false,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -1922,6 +1925,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -2143,6 +2147,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -2649,6 +2654,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -2925,6 +2931,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -3102,6 +3109,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -3591,6 +3599,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -3848,6 +3857,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -4069,6 +4079,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -4334,6 +4345,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -4609,6 +4621,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -5031,6 +5044,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -5355,6 +5369,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -5654,6 +5669,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -5881,6 +5897,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -6058,6 +6075,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -6559,6 +6577,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -6907,6 +6926,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -9146,6 +9166,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -9544,6 +9565,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -9820,6 +9842,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -10057,6 +10080,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -10363,6 +10387,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -10540,6 +10565,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -10717,6 +10743,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -10894,6 +10921,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -11101,6 +11129,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -11308,6 +11337,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -11533,6 +11563,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -11740,6 +11771,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -11917,6 +11949,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -12124,6 +12157,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -12301,6 +12335,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -12478,6 +12513,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -12703,6 +12739,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -13497,6 +13534,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -13773,6 +13811,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -13881,6 +13920,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -13987,6 +14027,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -14167,6 +14208,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -14518,6 +14560,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -14735,6 +14778,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -15647,6 +15691,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -15753,6 +15798,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -16592,6 +16638,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -17039,6 +17086,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -17338,6 +17386,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -17446,6 +17495,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -17990,6 +18040,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
@@ -18096,6 +18147,7 @@ Object {
"gridSize": null,
"height": 768,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
diff --git a/src/tests/packages/__snapshots__/utils.test.ts.snap b/src/tests/packages/__snapshots__/utils.test.ts.snap
index 32f519c4..ebc6b9b2 100644
--- a/src/tests/packages/__snapshots__/utils.test.ts.snap
+++ b/src/tests/packages/__snapshots__/utils.test.ts.snap
@@ -38,6 +38,7 @@ Object {
"fileHandle": null,
"gridSize": null,
"isBindingEnabled": true,
+ "isLibraryMenuDocked": false,
"isLibraryOpen": false,
"isLoading": false,
"isResizing": false,
diff --git a/src/types.ts b/src/types.ts
index eb7e534c..21e4b164 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -162,6 +162,7 @@ export type AppState = {
offsetLeft: number;
isLibraryOpen: boolean;
+ isLibraryMenuDocked: boolean;
fileHandle: FileSystemHandle | null;
collaborators: Map;
showStats: boolean;
@@ -291,7 +292,10 @@ export interface ExcalidrawProps {
elements: readonly NonDeletedExcalidrawElement[],
appState: AppState,
) => JSX.Element;
- UIOptions?: UIOptions;
+ UIOptions?: {
+ dockedSidebarBreakpoint?: number;
+ canvasActions?: CanvasActions;
+ };
detectScroll?: boolean;
handleKeyboardGlobally?: boolean;
onLibraryChange?: (libraryItems: LibraryItems) => void | Promise;
@@ -349,18 +353,18 @@ type CanvasActions = {
saveAsImage?: boolean;
};
-export type UIOptions = {
- canvasActions?: CanvasActions;
-};
-
-export type AppProps = ExcalidrawProps & {
- UIOptions: {
- canvasActions: Required & { export: ExportOpts };
- };
- detectScroll: boolean;
- handleKeyboardGlobally: boolean;
- isCollaborating: boolean;
-};
+export type AppProps = Merge<
+ ExcalidrawProps,
+ {
+ UIOptions: {
+ canvasActions: Required & { export: ExportOpts };
+ dockedSidebarBreakpoint?: number;
+ };
+ detectScroll: boolean;
+ handleKeyboardGlobally: boolean;
+ isCollaborating: boolean;
+ }
+>;
/** A subset of App class properties that we need to use elsewhere
* in the app, eg Manager. Factored out into a separate type to keep DRY. */
@@ -377,7 +381,7 @@ export type AppClassProperties = {
}
>;
files: BinaryFiles;
- deviceType: App["deviceType"];
+ device: App["device"];
scene: App["scene"];
};
@@ -473,7 +477,9 @@ export type ExcalidrawImperativeAPI = {
resetCursor: InstanceType["resetCursor"];
};
-export type DeviceType = {
+export type Device = Readonly<{
+ isSmScreen: boolean;
isMobile: boolean;
isTouchScreen: boolean;
-};
+ canDeviceFitSidebar: boolean;
+}>;