Primitives / foldkit-primitives/dom

Targets

const · packages/primitives/src/dom/targets.ts:45

const Targets: Mount.MountDefinitionWithArgs<
  'Targets',
  { attribute: Schema.String; preventDefault: Schema.Boolean },
  | { readonly _tag: 'TargetHovered'; readonly id: string | null }
  | {
      readonly _tag: 'TargetPressed'
      readonly id: string
      readonly shiftKey: boolean
      readonly altKey: boolean
      readonly ctrlKey: boolean
      readonly metaKey: boolean
    }
>

Which marked descendant of an element the pointer is over, and which one was pressed, as a Mount: one set of listeners on the container, not one per item. A descendant is marked by an attribute whose value is its id, such as a canvas's data-composition-node or a table's data-row. The nearest marked ancestor of the event's target, inside the container, is the one reported.

What hovering or pressing means (a selection, an outline, a menu) is the parent's update.