createPress
Whether an element is pressed: true while a pointer is held down on it, or Enter or Space is held while it has focus, and false once it's released or the press is cancelled. To animate while it's pressed, give the element whileTap.
import { createPress } from "@wardic/solid"
const pressed = createPress()
<button ref={pressed}>{pressed() ? "Holding" : "Press and hold"}</button>On Solid 2, createPress() is a sensor, given to the element's ref. Given an element or a ward first, createPress(card) reads it instead, and gives back its reading alone: a ward's own press, true from its pressStart to its tap or tapCancel, or to a drag that takes the press over. On Solid 1, createPress(target) takes the element itself, so call it where the element exists, as createHover does.
An element that takes no focus of itself, such as a div, is given tabindex="0", so a keyboard can press it. On a server, and until the first press, it's false.
It brings the press Feature.
Coming from Motion
Motion has no press hook: it has whileTap and the tap callbacks, which Wardic has too. Motion's tap answers Enter on a focused element; Wardic's answers Space too.