Skip to content

Interaction

Defined in: packages/core/src/interactions/types.ts:164

One named interaction: where to find its config on a trigger, and what to do.

name is the stable handler id this interaction is resolved by. The registry (InteractionRegistry.resolve/InteractionRegistry.has) and the attach boundary (attach.ts’s validateTrigger) resolve interactions by this name, closed-world: a name is either a built-in on the fixed allowlist or it is denied, never anything in between.

select is the only coupling to the schema’s shape, and it decides configured-ness: return undefined for absent or disabled. Callers must not assume a present key means enabled — hover.highlight is a plain boolean, so false is a present-but-off value.

Type ParameterDefault type
TConfigunknown
PropertyTypeDescriptionDefined in
create(deps) => InteractionRuntime<TConfig>Build this interaction’s per-EventHandler runtime. Remarks A factory, not a bare run, because interactions are not all fire-and-forget: highlight tracks which feature is lit per layer and has to unset it on several lifecycle events. That state must be per handler instance — the registry itself is module-level and shared — so each interaction closes over its own, and nothing leaks into EventHandler.packages/core/src/interactions/types.ts:177
namestring-packages/core/src/interactions/types.ts:165
select(trigger) => TConfig | undefined-packages/core/src/interactions/types.ts:166