LongPress.Args
const · packages/primitives/src/interaction/long-press.ts:40
const Args: Schema.Struct<{ readonly thresholdMs: Schema.Number }>Primitives / foldkit-primitives/interaction
namespace · packages/primitives/src/interaction/long-press.ts:8
export * as LongPress from './long-press.js'LongPress: holding an element down for thresholdMs is one fact. It reads
the same facts Press.events reports; the threshold is a Command on
Effect's clock carrying a generation, so a release before it fires makes
its Elapsed a no-op. LongPressed is an OutMessage the placement must
handle. A short press is Press's business, not this Bundle's.
LongPress.Argsconst · packages/primitives/src/interaction/long-press.ts:40
const Args: Schema.Struct<{ readonly thresholdMs: Schema.Number }>LongPress.behaviorfunction · packages/primitives/src/interaction/long-press.ts:124
function behavior<Field extends string>(
declared: Declared<typeof bundle, Field>,
): <Slots>(
slots: Slots,
) => <Input extends { readonly [K in Field]: Model }, ParentMessage>(
options: BehaviorOptions<Slots>,
) => Behavior.NamedBehavior<Slots, Input, ParentMessage>Attaches Press.events to the target, mapped into this placement's
Messages, and writes data-holding while the element is down. Press and
LongPress on one slot are refused by the resolver (two Mounts of one
name), so today a slot takes one of them.
LongPress.BehaviorOptionsinterface · packages/primitives/src/interaction/long-press.ts:114
interface BehaviorOptions<Slots> {
readonly target: keyof Slots & string
}LongPress.bundleconst · packages/primitives/src/interaction/long-press.ts:81
const bundle: Bundle.Bundle<
'LongPress',
{ readonly thresholdMs: number },
{
readonly holding: boolean
readonly pointerId: number | null
readonly key: string | null
readonly generation: number
},
| {
readonly _tag: 'Clicked'
readonly detail: number
readonly shiftKey: boolean
}
| {
readonly _tag: 'PointerDown'
readonly pointerId: number
readonly button: number
readonly pointerType: string
}
| {
readonly _tag: 'PointerUp'
readonly pointerId: number
readonly pointerType: string
readonly shiftKey: boolean
}
| { readonly _tag: 'PointerCancelled'; readonly pointerId: number }
| { readonly _tag: 'KeyDown'; readonly key: string; readonly repeat: boolean }
| { readonly _tag: 'KeyUp'; readonly key: string; readonly shiftKey: boolean }
| {
readonly _tag: 'Elapsed'
readonly generation: number
readonly pointerType: 'keyboard' | 'virtual' | 'mouse' | 'touch' | 'pen'
},
{
readonly _tag: 'LongPressed'
readonly pointerType: 'keyboard' | 'virtual' | 'mouse' | 'touch' | 'pen'
},
never,
never,
void,
{},
{}
>LongPress.LongPressedconst · packages/primitives/src/interaction/long-press.ts:37
const LongPressed: Schema.TaggedStruct<
'LongPressed',
{
readonly pointerType: Schema.Literals<
readonly ['mouse', 'touch', 'pen', 'keyboard', 'virtual']
>
}
>LongPress.Messageconst · packages/primitives/src/interaction/long-press.ts:26
const Message: MessageUnion<{
readonly PointerDown: {
readonly pointerId: Schema.Number
readonly button: Schema.Number
readonly pointerType: Schema.String
}
readonly PointerUp: {
readonly pointerId: Schema.Number
readonly pointerType: Schema.String
readonly shiftKey: Schema.Boolean
}
readonly PointerCancelled: { readonly pointerId: Schema.Number }
readonly KeyDown: {
readonly key: Schema.String
readonly repeat: Schema.Boolean
}
readonly KeyUp: {
readonly key: Schema.String
readonly shiftKey: Schema.Boolean
}
readonly Clicked: {
readonly detail: Schema.Number
readonly shiftKey: Schema.Boolean
}
readonly Elapsed: {
readonly generation: Schema.Number
readonly pointerType: Schema.Literals<
readonly ['mouse', 'touch', 'pen', 'keyboard', 'virtual']
>
}
}>LongPress.Modelconst · packages/primitives/src/interaction/long-press.ts:17
const Model: Schema.Struct<{
readonly holding: Schema.Boolean
readonly pointerId: Schema.NullOr<Schema.Number>
readonly key: Schema.NullOr<Schema.String>
readonly generation: Schema.Number
}>