@fabwcie/free-drawing / @types/ui
@types/ui
Type Aliases
AvailableTypes
AvailableTypes =
"neutral"|"info"|"warning"|"danger"|"error"
Defined in: packages/free-drawing/src/@types/ui.ts:50
Type of a toast message (drawer.toast(message, type)): neutral (default, no icon), info, warning and error (with their icon, warnings and errors announced at once by screen readers), danger (same as error)
Choice
Choice<
T> =object
Defined in: packages/free-drawing/src/@types/ui.ts:12
Choice of a group of buttons (options panels, menus, dialogs): its value and accessible name
Type Parameters
T
T
Value given by the button (color, width, style...)
Properties
label
label:
TranslationKey
Defined in: packages/free-drawing/src/@types/ui.ts:16
Translation key of its accessible name (label, tooltip)
value
value:
T
Defined in: packages/free-drawing/src/@types/ui.ts:14
Value given by the button
ColorPickerOptions
ColorPickerOptions =
object
Defined in: packages/free-drawing/src/@types/ui.ts:112
Options of a ColorPicker
Properties
attr
attr:
string
Defined in: packages/free-drawing/src/@types/ui.ts:116
Attribute of palette buttons, its value is the color
buttonClass
buttonClass:
string
Defined in: packages/free-drawing/src/@types/ui.ts:118
Class of palette buttons
colors
Defined in: packages/free-drawing/src/@types/ui.ts:114
Palette: color of each button, with the translation of its accessible name
i18n
i18n:
I18n
Defined in: packages/free-drawing/src/@types/ui.ts:124
Texts of drawer
onChange
onChange: (
color) =>void
Defined in: packages/free-drawing/src/@types/ui.ts:122
Color chosen with a button or the custom input
Parameters
color
Returns
void
transparent?
optionaltransparent?:boolean
Defined in: packages/free-drawing/src/@types/ui.ts:120
Transparent button (default false)
Command
Command =
object
Defined in: packages/free-drawing/src/@types/ui.ts:148
Command of palette
Properties
checked?
optionalchecked?:boolean
Defined in: packages/free-drawing/src/@types/ui.ts:160
State of a toggle (grid, zen mode...) or current choice (tool, language)
group
group:
TranslationKey
Defined in: packages/free-drawing/src/@types/ui.ts:154
Title of its group
icon?
optionalicon?:string
Defined in: packages/free-drawing/src/@types/ui.ts:156
SVG markup of its icon, shown before the label
id
id:
string
Defined in: packages/free-drawing/src/@types/ui.ts:150
English words, also searched
label
label:
string
Defined in: packages/free-drawing/src/@types/ui.ts:152
Translated name
run
run: () =>
void
Defined in: packages/free-drawing/src/@types/ui.ts:162
Action, run once the palette is closed
Returns
void
shortcut?
optionalshortcut?:string
Defined in: packages/free-drawing/src/@types/ui.ts:158
Keys doing the same (Ctrl+Shift+Z), shown at the end of the option (formatShortcut: ⇧⌘Z on Apple devices)
CommandGroup
CommandGroup = [
TranslationKey, (Omit<Command,"group"> |false|null|undefined)[]]
Defined in: packages/free-drawing/src/@types/ui.ts:168
Group of the command palette: its title and its commands, absent ones (false, null, undefined) not available
ConfirmModalOptions
ConfirmModalOptions =
object
Defined in: packages/free-drawing/src/@types/ui.ts:77
Options of ConfirmModal: message, button labels and actions of its buttons
Properties
cancelLabel?
optionalcancelLabel?:string
Defined in: packages/free-drawing/src/@types/ui.ts:81
Label of cancel button (focused on show)
confirmLabel?
optionalconfirmLabel?:string
Defined in: packages/free-drawing/src/@types/ui.ts:83
Label of confirm button
message?
optionalmessage?:string
Defined in: packages/free-drawing/src/@types/ui.ts:79
Translated texts by default
onCancel
onCancel: (
modal) =>void
Defined in: packages/free-drawing/src/@types/ui.ts:85
Click on cancel button, hides the dialog by default
Parameters
modal
Returns
void
onConfirm
onConfirm: (
modal) =>void
Defined in: packages/free-drawing/src/@types/ui.ts:87
Click on confirm button, clears the drawing and hides the dialog by default
Parameters
modal
Returns
void
ContextMenuItem
ContextMenuItem =
object
Defined in: packages/free-drawing/src/@types/ui.ts:173
Item of the context menu: shown in a context, action run once the menu is hidden
Properties
$item
$item:
HTMLButtonElement
Defined in: packages/free-drawing/src/@types/ui.ts:175
Button of the item
run
run: () =>
void
Defined in: packages/free-drawing/src/@types/ui.ts:179
Action of the item
Returns
void
visible
visible: () =>
boolean
Defined in: packages/free-drawing/src/@types/ui.ts:177
Item shown for the current selection or drawing
Returns
boolean
ContextMenuItemOptions
ContextMenuItemOptions =
object
Defined in: packages/free-drawing/src/@types/ui.ts:193
Item added to the context menu (ContextMenu.addSection: commands of plugins)
Properties
label
label:
string
Defined in: packages/free-drawing/src/@types/ui.ts:195
Key of its text, or text
run
run: () =>
void
Defined in: packages/free-drawing/src/@types/ui.ts:201
Action, run once the menu is hidden
Returns
void
shortcut?
optionalshortcut?:string
Defined in: packages/free-drawing/src/@types/ui.ts:197
Keys doing the same (Alt+P), shown at its end (formatShortcut: ⌥P on Apple devices)
visible
visible: () =>
boolean
Defined in: packages/free-drawing/src/@types/ui.ts:199
Item shown for the current selection or drawing
Returns
boolean
ContextMenuSection
ContextMenuSection =
object
Defined in: packages/free-drawing/src/@types/ui.ts:185
Section of the context menu: its items, separated from the next section
Properties
$section
$section:
HTMLElement
Defined in: packages/free-drawing/src/@types/ui.ts:187
Element of the section
items
items:
ContextMenuItem[]
Defined in: packages/free-drawing/src/@types/ui.ts:189
Items of the section
DropdownEventMap
DropdownEventMap =
object
Defined in: packages/free-drawing/src/@types/ui.ts:281
Events of a dropdown menu with the arguments of their listeners
Properties
drawer.dropdown.hide
drawer.dropdown.hide: []
Defined in: packages/free-drawing/src/@types/ui.ts:285
Deprecated
use dropdown.hide
dropdown.hide
dropdown.hide: []
Defined in: packages/free-drawing/src/@types/ui.ts:283
Menu hidden
fd.dropdown.hide
fd.dropdown.hide: []
Defined in: packages/free-drawing/src/@types/ui.ts:287
Deprecated
use dropdown.hide
EyeDropperConstructor
EyeDropperConstructor = () =>
object
Defined in: packages/free-drawing/src/@types/ui.ts:134
EyeDropper API of Chromium (not in the types of the dom): picks a color anywhere on the screen
Returns
open()
open():
Promise<EyeDropperResult>
Lets the user pick a color, rejected when cancelled (Escape)
Returns
Promise<EyeDropperResult>
EyeDropperResult
EyeDropperResult =
object
Defined in: packages/free-drawing/src/@types/ui.ts:128
Color picked on the screen by the EyeDropper API
Properties
sRGBHex
sRGBHex:
string
Defined in: packages/free-drawing/src/@types/ui.ts:130
Color picked, #rrggbb
EyeDropperWindow
EyeDropperWindow =
Window&object
Defined in: packages/free-drawing/src/@types/ui.ts:140
Window of a browser with the EyeDropper API
Type Declaration
EyeDropper?
optionalEyeDropper?:EyeDropperConstructor
EyeDropper API, undefined without (Firefox, Safari)
IconChoice
IconChoice<
T> =Choice<T> &object
Defined in: packages/free-drawing/src/@types/ui.ts:23
Choice shown by an icon
Type Parameters
T
T
Value given by the button
Type Declaration
icon
icon:
string
SVG markup of its icon
KeyboardLayoutNavigator
KeyboardLayoutNavigator =
Navigator&object
Defined in: packages/free-drawing/src/@types/ui.ts:220
Navigator with the Keyboard API (Chromium, not typed by TypeScript): characters of the keys of the layout
Type Declaration
keyboard?
optionalkeyboard?:object
Keyboard of the device, undefined out of Chromium
keyboard.getLayoutMap?
optionalgetLayoutMap?: () =>Promise<Iterable<[string,string]>>
Character of each physical key on the current layout (KeyQ: 'a' on AZERTY...)
Returns
Promise<Iterable<[string, string]>>
LayoutItemOptions
LayoutItemOptions =
object
Defined in: packages/free-drawing/src/@types/ui.ts:102
Options of an element added to a region of the interface (layout.add)
Properties
after?
optionalafter?:Element
Defined in: packages/free-drawing/src/@types/ui.ts:106
Placed right after this element of the region, else last
hideInZen?
optionalhideInZen?:boolean
Defined in: packages/free-drawing/src/@types/ui.ts:104
Hidden in zen mode
LayoutRegion
LayoutRegion =
"header"|"footerStart"|"footer"|"floating"
Defined in: packages/free-drawing/src/@types/ui.ts:97
Regions of the interface of a drawer:
header: top left (settings menu, layers button, position)footerStart: bottom left (zoom, undo / redo)footer: bottom, after its start (toolbar in the middle, help on the right)floating: over the canvas, placed by their component (menus, panels, overlays, dialogs, toasts, text editor)
ModalOptions
ModalOptions =
object
Defined in: packages/free-drawing/src/@types/ui.ts:55
Options of Modal dialogs, merged with defaultOptionsModal
Properties
backdrop?
optionalbackdrop?:boolean
Defined in: packages/free-drawing/src/@types/ui.ts:71
Dialog shown over a backdrop covering the drawer (default true)
bodyContent?
optionalbodyContent?:string
Defined in: packages/free-drawing/src/@types/ui.ts:63
HTML content of body
closeOnClickOutside?
optionalcloseOnClickOutside?:boolean
Defined in: packages/free-drawing/src/@types/ui.ts:67
Click out of the dialog hides it (default true)
closeOnEsc?
optionalcloseOnEsc?:boolean
Defined in: packages/free-drawing/src/@types/ui.ts:69
Escape key hides the dialog (default true)
footerContent?
optionalfooterContent?:string
Defined in: packages/free-drawing/src/@types/ui.ts:65
HTML content of footer (e.g. buttons)
id?
optionalid?:string
Defined in: packages/free-drawing/src/@types/ui.ts:57
Identifier of the dialog (creation time by default), not used by the dialog itself
showHeader?
optionalshowHeader?:boolean
Defined in: packages/free-drawing/src/@types/ui.ts:61
Header with title and close button (default true), else header removed
title?
optionaltitle?:string
Defined in: packages/free-drawing/src/@types/ui.ts:59
Title shown in header, names the dialog
ReplayState
ReplayState =
object
Defined in: packages/free-drawing/src/@types/ui.ts:271
State of a drawer before its replay, given back once it stops
Properties
position
position:
Vector2d
Defined in: packages/free-drawing/src/@types/ui.ts:273
Position of the stage (px)
scale
scale:
number
Defined in: packages/free-drawing/src/@types/ui.ts:275
Zoom level
tool
tool:
BaseWidget|null
Defined in: packages/free-drawing/src/@types/ui.ts:277
Active tool, null without
ReplayStep
ReplayStep =
object
Defined in: packages/free-drawing/src/@types/ui.ts:259
Shape drawn again by the replay of a drawing (see Replay)
Properties
apply
apply: (
progress) =>void
Defined in: packages/free-drawing/src/@types/ui.ts:267
Shows the copy at a progress of its appearance: 0 hidden, 1 as in the drawing
Parameters
progress
number
Returns
void
copy
copy:
DrawingShape
Defined in: packages/free-drawing/src/@types/ui.ts:263
Its copy in the selection layer, shown by the replay
duration
duration:
number
Defined in: packages/free-drawing/src/@types/ui.ts:265
Time of its appearance at speed 1 (ms)
shape
shape:
DrawingShape
Defined in: packages/free-drawing/src/@types/ui.ts:261
Shape of the drawing
Shortcut
Shortcut =
object
Defined in: packages/free-drawing/src/@types/ui.ts:205
Shortcut: action, keys (several: alternatives or second action), text after keys
Properties
after?
optionalafter?:string
Defined in: packages/free-drawing/src/@types/ui.ts:216
Translated text after keys, e.g. while drawing
keys
keys:
string[]
Defined in: packages/free-drawing/src/@types/ui.ts:212
Keys shown, each in a kbd element (alternatives with or, else a second action such as ungroup), written in English (Ctrl+Click, Delete): see formatShortcut
label
label:
string
Defined in: packages/free-drawing/src/@types/ui.ts:207
Translated action
or?
optionalor?:boolean
Defined in: packages/free-drawing/src/@types/ui.ts:214
Keys are alternatives, separated by translated "or"
ShortcutChoice
ShortcutChoice<
T> =IconChoice<T> &object
Defined in: packages/free-drawing/src/@types/ui.ts:41
Choice shown by an icon, with the keys doing the same (e.g. stacking order)
Type Parameters
T
T
Value given by the button
Type Declaration
shortcut
shortcut:
string
Keys doing the same (Ctrl+Up), shown in its tooltip (formatShortcut)
SlideshowOptions
SlideshowOptions =
object
Defined in: packages/free-drawing/src/@types/ui.ts:241
Options of a slideshow (see Slideshow.start)
Properties
fullscreen?
optionalfullscreen?:boolean
Defined in: packages/free-drawing/src/@types/ui.ts:243
Drawer shown on the whole screen while presenting, when the browser allows it (true by default)
SlideshowState
SlideshowState =
object
Defined in: packages/free-drawing/src/@types/ui.ts:247
State of a drawer before its slideshow, given back once it stops
Properties
position
position:
Vector2d
Defined in: packages/free-drawing/src/@types/ui.ts:249
Position of the stage (px)
scale
scale:
number
Defined in: packages/free-drawing/src/@types/ui.ts:251
Zoom level
size
size:
object
Defined in: packages/free-drawing/src/@types/ui.ts:255
Size of the stage (px), changed on the whole screen
height
height:
number
width
width:
number
tool
tool:
BaseWidget|null
Defined in: packages/free-drawing/src/@types/ui.ts:253
Active tool, null without
TextChoice
TextChoice<
T> =Choice<T> &object
Defined in: packages/free-drawing/src/@types/ui.ts:32
Choice shown by a short text (e.g. B for bold, XL for a font size)
Type Parameters
T
T
Value given by the button
Type Declaration
text
text:
string
Text of the button
ToastEventMap
ToastEventMap =
object
Defined in: packages/free-drawing/src/@types/ui.ts:291
Events of a toast with the arguments of their listeners
Properties
drawer.toast.hide
drawer.toast.hide: []
Defined in: packages/free-drawing/src/@types/ui.ts:295
Deprecated
use toast.hide
fd.toast.hide
fd.toast.hide: []
Defined in: packages/free-drawing/src/@types/ui.ts:297
Deprecated
use toast.hide
toast.hide
toast.hide: []
Defined in: packages/free-drawing/src/@types/ui.ts:293
Toast hidden
ViewArea
ViewArea =
object
Defined in: packages/free-drawing/src/@types/ui.ts:229
Part of the view where elements next to the selection are placed (selection menu, link editor), in px
Properties
bottom
bottom:
number
Defined in: packages/free-drawing/src/@types/ui.ts:237
Bottom edge, above the toolbar of the footer
left
left:
number
Defined in: packages/free-drawing/src/@types/ui.ts:231
Left edge
right
right:
number
Defined in: packages/free-drawing/src/@types/ui.ts:235
Right edge
top
top:
number
Defined in: packages/free-drawing/src/@types/ui.ts:233
Top edge