LongPress.Args
const · packages/primitives/src/interaction/long-press.ts:45
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:45
const Args: Schema.Struct<{ readonly thresholdMs: Schema.Number }>LongPress.behaviorfunction · packages/primitives/src/interaction/long-press.ts:130
function behavior<Field extends string>(
declared: Declared<typeof bundle, Field>,
): {
<Slots, Input extends { readonly [K in Field]: Model }, ParentMessage>(
bound: SlotView.Bound<Slots, Input, ParentMessage>,
): (
options: BehaviorOptions<Slots>,
) => Behavior.NamedBehavior<Slots, Input, ParentMessage>
<Slots>(
slots: SlotView.Unbound<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:120
interface BehaviorOptions<Slots> {
readonly target: keyof Slots & string
}LongPress.bundleconst · packages/primitives/src/interaction/long-press.ts:86
const bundle: Bundle.Bundle<
'LongPress',
{ readonly thresholdMs: number },
{
readonly holding: boolean
readonly pointerId: number | null
readonly key: string | null
readonly generation: number
},
| {
readonly _tag: 'Elapsed'
readonly generation: number
readonly pointerType: 'keyboard' | 'mouse' | 'pen' | 'touch' | 'virtual'
}
| {
readonly _tag: 'Clicked'
readonly detail: number
readonly modifiers: {
readonly shiftKey: boolean
readonly ctrlKey: boolean
readonly metaKey: boolean
readonly altKey: boolean
}
}
| {
readonly _tag: 'PointerDown'
readonly pointerId: number
readonly button: number
readonly pointerType: string
}
| {
readonly _tag: 'PointerUp'
readonly pointerId: number
readonly pointerType: string
readonly modifiers: {
readonly shiftKey: boolean
readonly ctrlKey: boolean
readonly metaKey: boolean
readonly altKey: boolean
}
}
| { readonly _tag: 'PointerCancelled'; readonly pointerId: number }
| { readonly _tag: 'KeyDown'; readonly key: string; readonly repeat: boolean }
| {
readonly _tag: 'KeyUp'
readonly key: string
readonly modifiers: {
readonly shiftKey: boolean
readonly ctrlKey: boolean
readonly metaKey: boolean
readonly altKey: boolean
}
}
| { readonly _tag: 'KeyCancelled'; readonly key: string },
{
readonly _tag: 'LongPressed'
readonly pointerType: 'keyboard' | 'mouse' | 'pen' | 'touch' | 'virtual'
},
never,
never,
NoView,
{},
{},
undefined
>LongPress.LongPressedconst · packages/primitives/src/interaction/long-press.ts:42
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 modifiers: Schema.Struct<{
readonly shiftKey: Schema.Boolean
readonly ctrlKey: Schema.Boolean
readonly metaKey: Schema.Boolean
readonly altKey: 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 modifiers: Schema.Struct<{
readonly shiftKey: Schema.Boolean
readonly ctrlKey: Schema.Boolean
readonly metaKey: Schema.Boolean
readonly altKey: Schema.Boolean
}>
}
readonly KeyCancelled: { readonly key: Schema.String }
readonly Clicked: {
readonly detail: Schema.Number
readonly modifiers: Schema.Struct<{
readonly shiftKey: Schema.Boolean
readonly ctrlKey: Schema.Boolean
readonly metaKey: Schema.Boolean
readonly altKey: 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
}>