@fabwcie/free-drawing / components/LibraryPanel
components/LibraryPanel
Classes
LibraryPanel
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:21
Panel of the library (library option, header button after the layers one, Alt+B): items shown by their preview, a click inserts one in the middle of the view, a drag onto the drawing inserts it there; the selection is added to it, the library is imported from and exported to files
Constructors
Constructor
new LibraryPanel(
drawer):LibraryPanel
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:50
Add the header button and the hidden panel, listen to the library, the selection, read only and language changes, and to items dropped on the drawing
Parameters
drawer
Drawer of the library
Returns
Properties
$addButton
$addButton:
HTMLButtonElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:31
Header button adding the selection to the library, enabled with a selection
$button
$button:
HTMLButtonElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:27
Header button showing / hiding the panel (Alt+B)
$buttonContainer
$buttonContainer:
HTMLDivElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:25
Container of the header button (hidden in zen mode)
$closeButton
$closeButton:
HTMLButtonElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:37
Header button closing the panel, focus back on the panel button
$empty
$empty:
HTMLParagraphElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:41
Message shown without items
$exportButton
$exportButton:
HTMLButtonElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:35
Header button exporting the library to a file, enabled with items
$hint
$hint:
HTMLParagraphElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:43
How to insert items
$importButton
$importButton:
HTMLButtonElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:33
Header button importing a library file
$list
$list:
HTMLUListElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:39
List of items, oldest first (arrow keys move between them)
$panel
$panel:
HTMLDivElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:29
Panel element (region named by its title): header, items, empty message, hint
drawer
drawer:
Drawer
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:23
Drawer of the library (drawer.library)
Methods
_close()
private_close():void
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:216
Hides the panel, focus back on its header button (close button, Escape)
Returns
void
_createHeaderButton()
private_createHeaderButton(icon,label,action):HTMLButtonElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:268
Icon button of the panel header, named by its translated label
Parameters
icon
string
SVG markup of the icon
label
"drawer.label" | "language.auto" | "toast.collaborationUnavailable" | "toast.collaborationFull" | "toast.collaborationTooBig" | "toast.canDraw" | "toast.viewOnly" | "toast.joinedViewOnly" | "toast.presentationStarted" | "toast.presentationEnded" | "toast.requestSent" | "toast.requestReceived" | "toast.requestRefused" | "toast.saveFailed" | "toast.saved" | "toast.styleCopied" | "toast.libraryImported" | "toast.libraryNotSaved" | "toast.loadFailed" | "toast.invalidFile" | "toast.linkCopied" | "toast.linkNotCopied" | "toast.invalidLink" | "toast.invalidShapeLink" | "toast.clipboardUnavailable" | "toast.exportFailed" | "toast.imageCopied" | "toast.storageCleared" | "toast.imageNotCopied" | "error.clipboardUnavailable" | "error.nothingToExport" | "error.notDrawingFile" | "error.notImage" | "error.damagedLink" | "error.drawingTooBig" | "error.imageNotCreated" | "error.serverUnreachable" | "error.notAllowed" | "error.storageFull" | "error.notLibraryFile" | "error.noDrawingInImage" | "error.insecurePage" | "error.roomKey" | "error.encryptionUnsupported" | "toast.selectionTool" | "modal.close" | "confirm.message" | "confirm.clearCanvas" | "confirm.clearStorage" | "confirm.stopCollaboration" | "confirm.leaveCollaboration" | "confirm.cancel" | "confirm.confirm" | "menu.label" | "menu.open" | "menu.saveAs" | "menu.save" | "menu.unsaved" | "menu.copyLink" | "menu.collaboration" | "menu.collaborationOn" | "menu.collaborationUsers" | "menu.export" | "menu.clearCanvas" | "menu.showGrid" | "menu.zenMode" | "menu.darkMode" | "menu.github" | "menu.githubLabel" | "menu.clearStorage" | "menu.background" | "menu.language" | "menu.commands" | "menu.preferences" | "preferences.title" | "preferences.autoSave" | "preferences.shapeRecognition" | "grid.style" | "grid.squares" | "grid.dots" | "grid.lines" | "grid.isometric" | "grid.styleCommand" | "preferences.wheel" | "wheel.zoom" | "wheel.pan" | "wheel.command" | "help.spaceDrag" | "help.wheelDrag" | "preferences.save" | "preferences.appearance" | "preferences.theme" | "preferences.light" | "preferences.dark" | "preferences.system" | "preferences.drawing" | "commands.search" | "commands.empty" | "commands.file" | "commands.language" | "color.white" | "color.lightGray" | "color.lightBlue" | "color.lightYellow" | "color.lightBeige" | "color.lightRed" | "color.lightGreen" | "color.black" | "color.red" | "color.green" | "color.blue" | "color.orange" | "color.yellow" | "color.pink" | "color.transparent" | "color.custom" | "color.pick" | "help.title" | "help.documentation" | "help.issue" | "help.shortcuts" | "help.tools" | "help.editor" | "help.view" | "help.or" | "help.selectAll" | "help.deleteSelection" | "help.duplicate" | "help.group" | "help.selectInGroup" | "help.constrainDrawing" | "help.whileDrawing" | "help.cancelDrawing" | "help.arrowUnlinked" | "help.constrainSelection" | "help.whileTransforming" | "help.move" | "help.forwardBackward" | "help.frontBack" | "help.lock" | "help.paste" | "help.open" | "help.save" | "help.export" | "help.grid" | "help.layers" | "help.layersSelect" | "help.snap" | "help.zoom" | "help.toolsConstrain" | "key.delete" | "key.arrows" | "key.click" | "key.space" | "key.wheel" | "key.ctrl" | "key.shift" | "key.alt" | "key.escape" | "key.enter" | "key.tab" | "key.home" | "key.end" | "key.backspace" | "toolbar.label" | "toolbar.moreTools" | "toolbar.keepTool" | "tools.pan" | "tools.selection" | "tools.brush" | "tools.eraser" | "tools.text" | "tools.note" | "tools.line" | "tools.square" | "tools.circle" | "tools.arrow" | "tools.image" | "tools.triangle" | "tools.diamond" | "tools.laser" | "tools.frame" | "zoom.label" | "zoom.out" | "zoom.in" | "zoom.reset" | "zoom.fit" | "zoom.selection" | "zoom.to100" | "history.label" | "history.undo" | "history.redo" | "position.label" | "position.recenter" | "context.paste" | "context.snap" | "context.lock" | "context.unlock" | "selectionMenu.label" | "action.duplicate" | "action.copyStyle" | "action.pasteStyle" | "library.title" | "library.add" | "library.empty" | "library.hint" | "library.insert" | "library.remove" | "library.import" | "library.export" | "library.close" | "library.shapes" | "search.label" | "search.count" | "search.none" | "slideshow.start" | "slideshow.presentFrom" | "slideshow.label" | "slideshow.previous" | "slideshow.next" | "slideshow.stop" | "slideshow.count" | "slideshow.slide" | "slideshow.slideTitled" | "slideshow.noFrames" | "slideshow.nextPrevious" | "slideshow.firstLast" | "slideshow.whilePresenting" | "replay.start" | "replay.label" | "replay.play" | "replay.pause" | "replay.restart" | "replay.speed" | "replay.stop" | "replay.count" | "replay.empty" | "replay.finished" | "replay.playPause" | "replay.step" | "replay.firstLast" | "replay.whileReplaying" | "navigation.description" | "navigation.text" | "navigation.shapes" | "navigation.from" | "navigation.to" | "navigation.link" | "navigation.locked" | "navigation.in" | "navigation.index" | "navigation.left" | "navigation.nextPrevious" | "navigation.enter" | "navigation.parent" | "navigation.leave" | "navigation.onDrawing" | "search.previous" | "search.next" | "search.close" | "action.group" | "action.ungroup" | "action.sendToBack" | "action.sendBackward" | "action.bringForward" | "action.bringToFront" | "action.delete" | "action.rotateRight" | "action.rotateLeft" | "action.flipHorizontal" | "action.flipVertical" | "action.insertImage" | "toast.imageFailed" | "action.alignLeft" | "action.alignCenter" | "action.alignRight" | "action.alignTop" | "action.alignMiddle" | "action.alignBottom" | "action.distributeHorizontal" | "action.distributeVertical" | "action.stackHorizontal" | "action.stackVertical" | "action.fitTextWidth" | "action.copyPng" | "action.copySvg" | "action.link" | "overlay.tool" | "overlay.selection" | "overlay.shape" | "overlay.brush" | "overlay.recognizeShapes" | "overlay.recognizeShapesHint" | "overlay.note" | "overlay.text" | "overlay.stroke" | "overlay.color" | "overlay.background" | "overlay.strokeWidth" | "overlay.strokeStyle" | "overlay.edges" | "overlay.arrowType" | "overlay.startHead" | "overlay.endHead" | "overlay.opacity" | "overlay.layers" | "overlay.align" | "overlay.distribute" | "overlay.actions" | "link.address" | "link.placeholder" | "link.open" | "link.remove" | "width.thin" | "width.medium" | "width.thick" | "width.extraThick" | "style.solid" | "style.dashed" | "style.dotted" | "edges.sharp" | "edges.round" | "edges.radius" | "edges.auto" | "arrow.straight" | "arrow.curved" | "arrow.elbow" | "arrowhead.none" | "arrowhead.arrow" | "arrowhead.triangle" | "arrowhead.dot" | "arrowhead.bar" | "text.fontFamily" | "text.fontSize" | "text.small" | "text.medium" | "text.large" | "text.extraLarge" | "text.style" | "text.bold" | "text.italic" | "text.underline" | "text.strikethrough" | "text.align" | "text.alignLeft" | "text.alignCenter" | "text.alignRight" | "layers.title" | "layers.group" | "layers.close" | "layers.empty" | "layers.drag" | "layers.shapesOf" | "layers.hide" | "layers.lock" | "layers.delete" | "layers.name" | "layers.toggle" | "layers.range" | "shapes.freehand" | "shapes.line" | "shapes.rect" | "shapes.ellipse" | "shapes.arrow" | "shapes.triangle" | "shapes.diamond" | "shapes.heart" | "shapes.cloud" | "shapes.star" | "shapes.hexagon" | "shapes.blockArrow" | "shapes.bubble" | "shapes.checkbox" | "shapes.shape" | "shapes.highlighter" | "shapes.frame" | "shapes.frameName" | "shapes.text" | "shapes.note" | "shapes.group" | "shapes.image" | "export.title" | "export.empty" | "export.options" | "export.selected" | "export.background" | "export.dark" | "export.withDrawing" | "export.scale" | "export.saveAs" | "export.saveFile" | "export.copy" | "export.preview" | "collab.title" | "collab.intro" | "collab.introInvited" | "collab.introJoined" | "collab.introJoinedOf" | "collab.name" | "collab.anonymous" | "collab.link" | "collab.copy" | "collab.qrCode" | "collab.start" | "collab.join" | "collab.stop" | "collab.leave" | "collab.live" | "collab.liveState" | "collab.connected" | "collab.connecting" | "collab.you" | "collab.invitedBy" | "collab.canDrawLabel" | "collab.canDraw" | "collab.newUsersCanDraw" | "collab.encrypted" | "collab.notEncrypted" | "collab.owner" | "collab.viewOnly" | "collab.present" | "collab.presenting" | "collab.follow" | "collab.followPresentation" | "collab.following" | "collab.youCanDraw" | "collab.youViewOnly" | "collab.requestEdit" | "collab.requestSent" | "collab.requests" | "collab.requestsCount" | "collab.accept" | "collab.refuse" | "collab.acceptLabel" | "collab.refuseLabel" | "collab.users" | "collab.settings"
Key of the accessible name and tooltip (translated again when language changes)
action
() => void
Run on click
Returns
HTMLButtonElement
Header button, to add to the header actions
_createItem()
private_createItem(item):HTMLLIElement
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:227
Row of an item: its preview and name inserting it (click, drag onto the drawing; not in read only), a button removing it
Parameters
item
Item of the library
Returns
HTMLLIElement
List item
_focusEnabled()
private_focusEnabled($buttons):void
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:207
Focus on the first enabled button, else on an enabled button of the panel: never on a disabled one (the focus would fall to the page)
Parameters
$buttons
HTMLButtonElement[]
Buttons to focus, in order of preference
Returns
void
_updateButtons()
private_updateButtons():void
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:191
Add button enabled with a selection, export button with items
Returns
void
isVisible()
isVisible():
boolean
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:147
Whether the panel is shown
Returns
boolean
True while the panel is shown
toggle()
toggle(
show?):void
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:155
Show or hide the panel (the layers panel, at the same place, is hidden)
Parameters
show?
boolean = ...
Toggle by default
Returns
void
update()
update():
void
Defined in: packages/free-drawing/src/components/LibraryPanel/LibraryPanel.ts:170
Items shown again (library, read only or language changed), with the state of the header buttons
Returns
void