The type of the object it wraps.
The type of the object it wraps.
Create a bare selector. Prefer gradum (or g, gr, $), which caches one
selector per target and wires up GradumSelector.element for you. The instance returned is a
proxy, so properties not found on the selector fall through to the wrapped object.
ReadonlyconstrainersReadonlyactiveThe properties passed on to children created through GradumSelector.feedforward, letting a parent seed its descendants with shared defaults.
ReadonlychildReadonlychildrenReadonlysiblingReadonlysiblingsReadonlymvcReadonlydataReadonlyclosestReadonlyonA key-value store attached to the element, backed by its own GradumModel and
created on first read — so it is available whether or not the element has a model of its own. Use
it for flags that tools and behaviors read off an element: selectable, dragAndDroppable, and
the like. Assigning a plain object replaces the store's contents; assigning a model adopts it.
Reads participate in effect tracking once a signal exists for the key, so
metadata.makeSignal("flag") at setup makes metadata.get("flag") reactive inside an @effect.
Optionalclasses: string | string[]
String of classes separated by spaces, or array of strings.
Optionalforce: boolean
(Optional) Boolean that turns the toggle into a one way-only operation. If set to false, then the class will only be removed, but not added. If set to true, then token will only be added, but not removed.
Itself, allowing for method chaining.
Function
makeConstrainer
The name of the new constrainer.
Optionaloptions: MakeConstrainerOptions
Options parameter to configure the newly-created constrainer.
Itself for chaining.
Function
toggleConstrainer
Optionalconstrainer: string
The name of the constrainer to toggle. Defaults to the first active constrainer.
Optionalforce: boolean
If set, the constrainer's active state will be set to this value.
Itself for chaining.
Function
activateOnlyConstrainer
The constrainer name to activate as the single active constrainer. Defaults to the first active constrainer.
Itself for chaining.
Function
onConstrainerActivate
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
The delegate.
Function
onConstrainerDeactivate
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
The delegate.
Function
getConstrainerPriority
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
The constrainer priority.
Function
setConstrainerPriority
The priority value to set.
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
Itself for chaining.
Function
getConstrainerObjectList
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
The list of objects. To manipulate, check GradumNodeList.
Function
onConstrainerObjectListChange
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
The delegate.
Function
getConstrainerTriggerList
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
The list of trigger objects. To manipulate, check GradumNodeList.
Function
getConstrainerQueue
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
The current constrainer queue.
Function
getDefaultConstrainerQueue
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
The default constrainer queue.
Function
setDefaultConstrainerQueue
The queue (or list to build a queue from).
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
Itself for chaining.
Function
getObjectPassesForConstrainer
The object to query.
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
Number of passes already performed on this object.
Function
getMaxPassesForConstrainer
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
The maximum allowed passes.
Function
setMaxPassesForConstrainer
Maximum number of passes.
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
Itself for chaining.
Function
getObjectDataForConstrainer
The object to query.
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
The stored data object (or an empty object if none).
Function
setObjectDataForConstrainer
The object to update.
Optionaldata: Record<string, any>
The new data object to associate with this object.
Optionalconstrainer: string
The name of the targeted constrainer. Defaults to the first active constrainer.
Itself for chaining.
Function
addChecker
Configuration object, including the
checker callback to be executed, the name of the checker to access it later, the name of the attached
constrainer, and the priority of the checker.
Itself for chaining.
Function
checkConstrainer
Optionalproperties: ConstrainerCallbackProperties
Context passed to each checker.
Whether the constrainer passes all checks.
Function
checkConstrainersForEvent
Optionalproperties: ConstrainerCallbackProperties
Event context.
Whether all the checkers allowed the event to proceed.
Function
addMutator
Configuration object, including the
mutator callback to be executed, the name of the mutator to access it later, the name of the attached
constrainer, and the priority of the mutator.
Itself for chaining.
Function
mutate
The type of the value to mutate
Optionalproperties: ConstrainerMutatorProperties<Type>
Context object, including the
mutation to execute, and the input value to mutate.
The mutated result.
Function
addSolver
Configuration object, including the
solver callback to be executed, the name of the solver to access it later, the name of the attached
constrainer, and the priority of the solver.
Itself for chaining.
Function
solveConstrainer
Optionalproperties: ConstrainerCallbackProperties
Options object to configure the context.
Itself for chaining.
Function
solveConstrainersForEvent
Optionalproperties: ConstrainerCallbackProperties
Event context to pass to solvers.
Itself for chaining.
Function
setProperties
The HTML tag of the element (for accurate autocompletion of available properties).
The properties object.
OptionalsetOnlyBaseProperties: boolean
If set to true, will only set the base gradum properties (classes, text, style, id, children, parent, etc.) and ignore all other properties not explicitly defined in GradumProperties.
Itself, allowing for method chaining.
The element's fields, keyed by name.
Optionaloptions: CloneElementOptions
What to carry over to the copy.
The cloned element.
Optionaloptions: FeedforwardProperties
Properties to feed forward. Defaults to GradumSelector.defaultFeedforwardProperties.
The element, allowing for method chaining.
Function
on
The type of the element.
The type of the event.
The function that receives a notification.
Optionaloptions: ListenerOptions
An options object that specifies characteristics about the event listener.
Optionalmanager: GradumEventManager
The associated event manager. Defaults to the first created manager, or a new instantiated one if none already exist.
Itself, allowing for method chaining.
Function
onTool
The type of the element.
The type of the event.
The name of the tool. Set to null or undefined to check for listeners not bound to a tool.
The function that receives a notification.
Optionaloptions: ListenerOptions
An options object that specifies characteristics about the event listener.
Optionalmanager: GradumEventManager
The associated event manager. Defaults to the first created manager, or a new instantiated one if none already exist.
Itself, allowing for method chaining.
Function
executeAction
The type of the event.
The name of the tool. Set to null or undefined to fire listeners not bound to a tool.
The event to pass as parameter to the listeners.
Optionaloptions: ListenerOptions
Options object that specifies characteristics about the event listeners to fire.
Optionalmanager: GradumEventManager
The associated event manager. Defaults to the first created manager, or a new instantiated one if none already exist.
Function
hasListener
The type of the event. Set to null or undefined to get all event types.
The function that receives a notification.
Optionalmanager: GradumEventManager
The associated event manager. Defaults to the first created manager, or a new instantiated one if none already exist.
Whether the element has the given listener.
Function
hasToolListener
The type of the event. Set to null or undefined to get all event types.
The name of the tool the listener is attached to. Set to null or undefined to check for listeners not bound to a tool.
The function that receives a notification.
Optionalmanager: GradumEventManager
The associated event manager. Defaults to the first created manager, or a new instantiated one if none already exist.
Whether the element has the given listener.
Function
hasListenersByType
The type of the event. Set to null or undefined to get all event types.
OptionaltoolName: string
The name of the tool to consider (if any). Set to null or undefined to check for listeners not bound to a tool.
Optionalmanager: GradumEventManager
The associated event manager. Defaults to the first created manager, or a new instantiated one if none already exist.
Whether the element has a listener of this type.
Function
removeListener
The type of the event.
The function that receives a notification.
Optionalmanager: GradumEventManager
The associated event manager. Defaults to the first created manager, or a new instantiated one if none already exist.
Itself, allowing for method chaining.
Function
removeToolListener
The type of the event.
The name of the tool the listener is attached to. Set to null or undefined to check for listeners not bound to a tool.
The function that receives a notification.
Optionalmanager: GradumEventManager
The associated event manager. Defaults to the first created manager, or a new instantiated one if none already exist.
Itself, allowing for method chaining.
Function
removeListenersByType
The type of the event. Set to null or undefined to consider all types.
OptionaltoolName: string
The name of the tool associated (if any). Set to null or undefined to check for listeners not bound to a tool.
Optionalmanager: GradumEventManager
The associated event manager. Defaults to the first created manager, or a new instantiated one if none already exist.
Itself, allowing for method chaining.
Function
removeAllListeners
Optionalmanager: GradumEventManager
The associated event manager. Defaults to the first created manager, or a new instantiated one if none already exist.
Itself, allowing for method chaining.
Optionaloptions: PreventDefaultOptions
An options object to customize the behavior of the function.
Function
addToParent
The parent node to attach the element to.
Optionalindex: number
The position at which to add the element relative to the parent's child list. Leave undefined to add the element at the end.
OptionalreferenceList: Node[] | NodeListOf<Node>
The child list to
use as computation reference for index placement. Defaults to the parent's childrenArray.
Itself, allowing for method chaining.
Function
addChild
Optionalchildren: Node | Node[]
Array of (or single) child nodes.
Optionalindex: number
The position at which to add the child relative to the parent's child list. Leave undefined to add the child at the end.
OptionalreferenceList: Node[] | NodeListOf<Node>
The child list to
use as computation reference for index placement. Defaults to the node's childrenArray.
Itself, allowing for method chaining.
Function
removeChildAt
Itself, allowing for method chaining.
Function
childAt
The child at the given index, or null if the index is invalid.
Function
indexOfChild
The index of the child node in the provided list, or -1 if the child is not found.
Function
indexInParent
OptionalreferenceList: Node[]
The siblings list to use as computation
reference for index placement. Defaults to the node's siblings.
True if the children belong to the node, false otherwise.
Function
closest
The (valid) tag name.
The matching ancestor element, or null if no match is found.
The field names to remove.
Itself, allowing for method chaining.
Function
applyDefaults
Key/value map of defaults to apply on the object.
Optionaloptions: ApplyDefaultsOptions
Optional configuration for merging keys.
The same selector instance for chaining.
Function
setMvc
The properties to configure the MVC structure.
Itself, allowing for method chaining.
Function
initializeMvc
Itself, allowing for method chaining.
Function
getMvcDifference
The element's view type.
The element's data type.
The element's model type.
The element's emitter type.
Optionalproperties: MvcGenerationProperties<ViewType, DataType, ModelType, EmitterType>
The configuration to compare against.
A partial configuration of constructors describing pieces present in the current MVC but not in the provided configuration.
Computes the structural difference between the element's current MVC configuration and a provided configuration description. The comparison is constructor-based (not instance-based):
view, model, emitter), the constructors are compared.operators, handlers, interactors, tools, constrainers),
the result contains constructors present in the current MVC but absent from the provided configuration.Function
addOperator
The operator to add.
Itself, allowing for method chaining.
Function
removeOperator
The operator's key or instance to remove.
Itself, allowing for method chaining.
Function
addHandler
The handler to add.
Itself, allowing for method chaining.
Function
removeHandler
The handler's key or instance to remove.
Itself, allowing for method chaining.
Function
getInteractor
The interactor's key.
The interactor.
Function
addInteractor
The interactor to add.
Itself, allowing for method chaining.
Function
removeInteractor
The interactor's key or instance to remove.
Itself, allowing for method chaining.
Function
addTool
The tool to add.
Itself, allowing for method chaining.
Function
removeTool
The tool's key or instance to remove.
Itself, allowing for method chaining.
Function
getConstrainer
The constrainer's key.
The constrainer.
Function
addConstrainer
The constrainer to add.
Itself, allowing for method chaining.
Function
removeConstrainer
The constrainer's key or instance to remove.
Itself, allowing for method chaining.
Whether to show the element.
Optionaloptions: ReifectAppliedOptions<Shown>
Options controlling how the transition is applied.
Itself, allowing for method chaining.
Function
attachReifect
The reifect(s) to attach.
Itself, allowing for method chaining.
Function
detachReifect
The reifect(s) to detach.
Itself, allowing for method chaining.
Function
initializeReifect
The type of the reifect's states.
Optionalreifect: StatefulReifect<State>
The reifect to initialize.
Optionalstate: State
The state to initialize to (if the reifect is not stateless).
Optionaloptions: ReifectAppliedOptions<State>
Optional overrides for the default values.
Set to null to not set anything on the object.
Itself, allowing for method chaining.
Function
applyReifect
The type of the reifect's states.
The reifect to apply.
Optionalstate: State
The state to initialize to (if the reifect is not stateless).
Optionaloptions: ReifectAppliedOptions<State>
Optional overrides for the default values.
Set to null to not set anything on the object.
Itself, allowing for method chaining.
Function
toggleReifect
The type of the reifect's states.
The reifect to toggle.
Optionaloptions: ReifectAppliedOptions<State>
Optional overrides for the default values.
Set to null to not set anything on the object.
Itself, allowing for method chaining.
Function
reifectEnabledState
Optionalreifect: StatefulReifect
The target reifect.
The enabled state.
Function
enableReifect
The new state.
Optionalreifect: StatefulReifect
The target reifect.
Itself, allowing for method chaining.
Function
setStyle
A string representing the style attribute to set.
THe value to append.
Optionalinstant: boolean
If true, will set the fields directly. Otherwise, will set them on next animation frame.
Itself, allowing for method chaining.
Function
appendStyle
A string representing the style attribute to append to.
The value to append.
Optionalseparator: string
The separator to use between the existing and new values.
Optionalinstant: boolean
If true, will set the fields directly. Otherwise, will set them on next animation frame.
Itself, allowing for method chaining.
Function
setStyles
Acceptable styles to set.
Optionalinstant: boolean
If true, will set the fields directly. Otherwise, will set them on next animation frame.
Itself, allowing for method chaining.
Function
makeTool
The unique name of the tool to register under the manager. Reusing an existing
toolName will make this element another instance of toolName.
Optionaloptions: MakeToolOptions
Tool creation options (custom activation, click mode, key mapping, manager).
Itself for chaining.
Function
isTool
Optionalmanager: GradumEventManager
The associated event manager (defaults to GradumEventManager.instance).
True if the element is a tool, false otherwise.
Function
getToolNames
Optionalmanager: GradumEventManager
The associated event manager (defaults to GradumEventManager.instance).
The list of tool names.
Function
getToolName
Optionalmanager: GradumEventManager
The associated event manager (defaults to GradumEventManager.instance).
The first tool name, if any.
Function
onToolActivate
OptionaltoolName: string
The name of the tool.
Optionalmanager: GradumEventManager
The associated event manager (defaults to GradumEventManager.instance).
The delegate.
Function
onToolDeactivate
OptionaltoolName: string
The name of the tool.
Optionalmanager: GradumEventManager
The associated event manager (defaults to GradumEventManager.instance).
The delegate.
Function
addToolBehavior
The type of the event (e.g., "pointerdown", "click", custom gradum event).
The behavior function. Return true to stop propagation.
OptionaltoolName: string
Tool name to bind the behavior to. Defaults to this element's first tool.
Optionalmanager: GradumEventManager
The associated event manager (defaults to GradumEventManager.instance).
Itself for chaining.
Function
hasToolBehavior
The type of the event (e.g., "pointerdown", "click", custom gradum event).
OptionaltoolName: string
The tool name to check under. Defaults to this element's first tool.
Optionalmanager: GradumEventManager
The associated event manager (defaults to GradumEventManager.instance).
True if one or more behaviors are registered.
Function
removeToolBehaviors
The type of the event (e.g., "pointerdown", "click", custom gradum event).
OptionaltoolName: string
The tool name whose behaviors will be removed. Defaults to this element's first tool.
Optionalmanager: GradumEventManager
The associated event manager (defaults to GradumEventManager.instance).
Itself for chaining.
Function
applyTool
The name of the tool whose behaviors should run.
The type of the event (e.g., "pointerdown", "click", custom gradum event).
The triggering event instance.
Optionalmanager: GradumEventManager
The associated event manager (defaults to GradumEventManager.instance).
True if at least one behavior returned true (to stop propagation of the event).
Function
clearToolBehaviors
Optionalmanager: GradumEventManager
The associated event manager (defaults to GradumEventManager.instance).
Itself for chaining.
Function
embedTool
The node to manipulate when interacting with the tool element itself.
Optionalmanager: GradumEventManager
The associated manager (defaults to GradumEventManager.instance).
Itself for chaining.
Function
isEmbeddedTool
Optionalmanager: GradumEventManager
The associated manager (defaults to GradumEventManager.instance).
True if an embedded target is present.
Function
getEmbeddedToolTarget
Optionalmanager: GradumEventManager
The associated manager (defaults to GradumEventManager.instance).
The embedded tool's target node, if any.
Function
ignoreTool
The name of the tool to ignore.
Optionaltype: string
The type of the event. If undefined, all event types will be considered.
Optionalignore: boolean
Whether to ignore the tool. Defaults to true.
Optionalmanager: GradumEventManager
The associated manager (defaults to GradumEventManager.instance).
Itself for chaining.
Function
ignoreTool
Optionalignore: boolean
Whether to ignore the tools. Defaults to true.
Optionalmanager: GradumEventManager
The associated manager (defaults to GradumEventManager.instance).
Itself for chaining.
Function
isToolIgnored
The name of the tool to check for.
Optionaltype: string
The type of the event. If undefined, all event types will be considered.
Optionalmanager: GradumEventManager
The associated manager (defaults to GradumEventManager.instance).
Whether the tool is ignored for the provided event type.
GradumSelector
Description
Selector class that wraps an object and augments it with useful functions to manipulate it. It also proxies the object, so you can access properties and methods on the underlying object directly through the selector.