feat: add sidebar for libraries panel (#5274)

Co-authored-by: dwelle <luzar.david@gmail.com>
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
Ishtiaq Bhatti 2022-06-21 20:03:23 +05:00 committed by GitHub
parent 4712393b62
commit cdf352d4c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 782 additions and 241 deletions

View file

@ -162,6 +162,7 @@ export type AppState = {
offsetLeft: number;
isLibraryOpen: boolean;
isLibraryMenuDocked: boolean;
fileHandle: FileSystemHandle | null;
collaborators: Map<string, Collaborator>;
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<any>;
@ -349,18 +353,18 @@ type CanvasActions = {
saveAsImage?: boolean;
};
export type UIOptions = {
canvasActions?: CanvasActions;
};
export type AppProps = ExcalidrawProps & {
UIOptions: {
canvasActions: Required<CanvasActions> & { export: ExportOpts };
};
detectScroll: boolean;
handleKeyboardGlobally: boolean;
isCollaborating: boolean;
};
export type AppProps = Merge<
ExcalidrawProps,
{
UIOptions: {
canvasActions: Required<CanvasActions> & { 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<typeof App>["resetCursor"];
};
export type DeviceType = {
export type Device = Readonly<{
isSmScreen: boolean;
isMobile: boolean;
isTouchScreen: boolean;
};
canDeviceFitSidebar: boolean;
}>;