@fabwcie/free-drawing / @types/plugin
@types/plugin
Type Aliases
ListenedTarget
ListenedTarget = {
off(event,handler):unknown;on(event,handler):unknown; } |EventTarget
Defined in: packages/free-drawing/src/@types/plugin.ts:80
Object listened by a plugin (Plugin.listenTo): drawer (its events), konva node, or DOM element
PluginClass
PluginClass<
T> = (drawer) =>T&object
Defined in: packages/free-drawing/src/@types/plugin.ts:8
Class of a plugin, given to the plugins drawer option: created with the drawer, named and with its dependencies
Type Parameters
T
Type Declaration
pluginName
readonlypluginName:string
Unique name of the plugin (class names are changed by minification): key of drawer.plugins.get, requires
requires?
readonlyoptionalrequires?: readonly (PluginClass|string)[]
Plugins required, created and initialized before it: classes (added when missing) or names of given plugins
PluginCommand
PluginCommand =
object
Defined in: packages/free-drawing/src/@types/plugin.ts:36
Action of a plugin (Plugin.addCommand): command of the palette, shortcut shown in help, item of the context menu
Properties
contextMenu?
optionalcontextMenu?:PluginCommandMenu
Defined in: packages/free-drawing/src/@types/plugin.ts:46
Item of the context menu for selected shapes, or for the drawing (nothing selected)
icon?
optionalicon?:string
Defined in: packages/free-drawing/src/@types/plugin.ts:42
SVG markup of its icon, shown in the command palette
id
id:
string
Defined in: packages/free-drawing/src/@types/plugin.ts:38
English words, unique, searched in the command palette with the label
isAvailable?
optionalisAvailable?: () =>boolean
Defined in: packages/free-drawing/src/@types/plugin.ts:50
Command available now (shown and run by its shortcut), always by default
Returns
boolean
label
label:
string
Defined in: packages/free-drawing/src/@types/plugin.ts:40
Key of its text (translations of the plugin), or text
readOnly?
optionalreadOnly?:boolean
Defined in: packages/free-drawing/src/@types/plugin.ts:48
Does not modify the drawing (export, count...): also available in read only and while the plugin is disabled
run
run: () =>
void
Defined in: packages/free-drawing/src/@types/plugin.ts:52
Action, run once the palette or the menu is closed
Returns
void
shortcut?
optionalshortcut?:string
Defined in: packages/free-drawing/src/@types/plugin.ts:44
Keys running it (Ctrl+Shift+M, Alt+P: Ctrl is also Cmd), shown in palette, context menu and help (⇧⌘M, ⌥P on Apple devices)
PluginCommandMenu
PluginCommandMenu =
"selection"|"drawing"
Defined in: packages/free-drawing/src/@types/plugin.ts:31
Where a command of a plugin is shown in the context menu
PluginEntry
PluginEntry =
PluginClass| readonly [plugin:PluginClass,options?:object]
Defined in: packages/free-drawing/src/@types/plugin.ts:19
Plugin given to the plugins drawer option: its class, or its class with its options ([StampsPlugin, { max: 20 }]), read by Plugin.getOptions
PluginListener
PluginListener = () =>
void
Defined in: packages/free-drawing/src/@types/plugin.ts:77
Listener of a plugin removed by Plugin.destroy
Returns
void
PluginOptions
PluginOptions =
Record<string,object>
Defined in: packages/free-drawing/src/@types/plugin.ts:22
Options of plugins given by the app (pluginOptions drawer option), by plugin name, read by Plugin.getOptions
PluginRequirement
PluginRequirement =
PluginClass|string
Defined in: packages/free-drawing/src/@types/plugin.ts:25
Plugin required by another one: its class, or its name (plugin given to the plugins option)
PluginShapeType
PluginShapeType =
object
Defined in: packages/free-drawing/src/@types/plugin.ts:59
Type of the shapes of a plugin (Plugin.addShapeType): shapes having its name are named and shown by it in the layers panel and to screen readers (keyboard navigation)
Properties
icon?
optionalicon?:string
Defined in: packages/free-drawing/src/@types/plugin.ts:65
SVG markup of its icon, shown in the layers panel (else the icon of the shape of the library)
label
label:
string
Defined in: packages/free-drawing/src/@types/plugin.ts:63
Key of its text (translations of the plugin), or text: name of the type in the language of the drawer
name
name:
string
Defined in: packages/free-drawing/src/@types/plugin.ts:61
Name given to the shapes of the plugin (one word, next to a name of the library: shapeName.rect...)
RegisteredCommand
RegisteredCommand =
object
Defined in: packages/free-drawing/src/@types/plugin.ts:69
Command added by a plugin, with its plugin (availability: plugin enabled)
Properties
command
command:
PluginCommand
Defined in: packages/free-drawing/src/@types/plugin.ts:73
The command
plugin
plugin:
Plugin
Defined in: packages/free-drawing/src/@types/plugin.ts:71
Plugin adding it
WidgetClass
WidgetClass = (
drawer) =>BaseWidget
Defined in: packages/free-drawing/src/@types/plugin.ts:28
Class of a toolbar widget added by a plugin (Plugin.addWidget), created by the toolbar