Handlers
Behaviors mixed into multiple components.
type AsyncEventHandler = (event: Event) => Promise<void>
interface DropHandled
extends HTMLElement {
drop: (dataTransfer: DataTransfer, clientX: number) => void
dropValid: (dataTransfer: DataTransfer) => boolean
}
interface EvaluatedHandled
extends HTMLElement {
evaluated?: boolean
signals: SignalsRecord
}
type ExpressHandler<T1, T2> = RequestHandler<UnknownRecord, T1, T2, UnknownRecord, UnknownRecord>
type ExpressJSHandler<T = PluginFunction> = RequestHandler<UnknownRecord, Returns<T>, Receives<T>, UnknownRecord, UnknownRecord>
interface Handled
extends HTMLElement, MediaMasherComponent {
connectHandlers: (mediaMasher: MediaMasherNode) => void
disconnectHandlers: () => void
mediaMasher: MediaMasherNode
}
type Handler<T1 = object, T2> = RequestHandler<UnknownRecord, DataOrError<T1>, T2, UnknownRecord, UnknownRecord>
interface HeadHandled
extends WithLabelOrNot, WithVisibility, HTMLElement {
head: OptionalContent
iconIds: Strings
label?: string
signals: SignalsRecord
variable: (name: string) => number
visibility: boolean
}
type PointerEventHandler = (event: PointerEvent) => void
interface SizeHandled
extends HTMLElement {
sizeById: Record<string, Size>
}
interface VisibilityHandled
extends HTMLElement, MediaMasherComponent {
mediaMasher: MediaMasherNode
visibilityById: Record<string, boolean>
}
/**
* Attach drag and drop handlers to
* element, which all
call its dropValid
* method during drag operations, and
its
* drop method if the drop is valid. Also
* adds or
removes 'dragging' from
* element's classList, to
reflect current
* validation state.
*/
class DropHandler {
connect: () => void
disconnect: () => void
handleDragEnter: (event: Event) => void
handleDragLeave: (event: Event) => void
handleDragOver: (event: Event) => void
handleDrop: (event: Event) => void
over: (value: boolean) => void
}
/**
* Sets element's boolean evaluated
* property, by
evaluating my evaluation
* property, which is a
string containing
* an expression containing signal
ids.
*/
class EvaluatedHandler {
connect: (value: string) => void
disconnect: () => void
handleDisabledSignal: (signal: Signal) => void
}
/**
* Populates element's head property, based
* on CSS values
returned from its
* variable method and iconIds property.
*
Updates the element's head property
* when corresponding
signals change.
*/
class HeadHandler {
connect: () => void
refreshPreview: () => void
}
/**
* Adds or removes 'selected' from
* element's classList,
as the value of my
* selected property changes.
*/
class SelectedHandler {
selected: (value: boolean) => void
}
/**
* Sets element's sizeById record, based on
* the current
size of its children, or
* the children of the root
passed to
* connect.
*/
class SizeHandler {
connect: (root?: Element) => void
disconnect: () => void
sizeObserve: (wasObserved: Record<Value, Element>, nowObserved: Record<Value, Element>) => void
sizeObserved: (entries: Array<ResizeObserverEntry>, observer: ResizeObserver) => void
}
/**
* Sets element's visibilityById record,
* based on the
current visibility of its
* children, or the children of
the root
* passed to connect.
*/
class VisibilityHandler {
connect: (root?: Element) => void
disconnect: () => void
observe: (wasObserved: Record<Value, Handled>, nowObserved: Record<Value, Handled>) => boolean
}