Repeat.Args
const · packages/primitives/src/interaction/repeat.ts:69
const Args: Schema.Struct<{
readonly delayMs: Schema.Number
readonly intervalMs: Schema.Number
}>Primitives / foldkit-primitives/interaction
namespace · packages/primitives/src/interaction/repeat.ts:11
export * as Repeat from './repeat.js'Repeat: a held stepper. Pressing steps once, and holding on steps again every
intervalMs after delayMs, until the press ends or the parent says the
bound is reached. It reads the facts Press.events reports; the clock is a
Command on Effect's clock carrying a generation, so a release makes a late
Elapsed a no-op. A mouse or a key steps as it goes down; a finger or a pen
steps on release (a tap) or once held, so a scroll that starts on the button
never steps; a click no pointer made (a screen reader's) steps once. Stepped
and Ended are OutMessages the placement must handle.
Repeat.Argsconst · packages/primitives/src/interaction/repeat.ts:69
const Args: Schema.Struct<{
readonly delayMs: Schema.Number
readonly intervalMs: Schema.Number
}>Repeat.behaviorfunction · packages/primitives/src/interaction/repeat.ts:205
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>,
): <Target extends keyof Slots & string>(
options: BehaviorOptions<Input, Slots, Target>,
) => Behavior.NamedBehavior<
Slots,
Input,
ParentMessage,
A11y.ProvidedOn<Target, 'activation'>
>
<Slots>(
slots: SlotView.Unbound<Slots>,
): <Input extends { readonly [K in Field]: Model }, ParentMessage>(
options: BehaviorOptions<Input, Slots>,
) => Behavior.NamedBehavior<Slots, Input, ParentMessage>
}Attaches Press.events to the target, mapped into this placement's
Messages, and writes data-holding while the press is down. Press,
LongPress and Repeat on one slot are refused by the resolver (two Mounts
of one name), so a slot takes one of them.
Repeat.BehaviorOptionsinterface · packages/primitives/src/interaction/repeat.ts:189
interface BehaviorOptions<
Input,
Slots,
Target extends keyof Slots & string = keyof Slots & string,
> {
readonly target: Target
readonly disabled?: (input: Input) => boolean
}Repeat.bundleconst · packages/primitives/src/interaction/repeat.ts:131
const bundle: Bundle.Bundle<
'Repeat',
{ readonly delayMs: number; readonly intervalMs: number },
{
readonly holding: boolean
readonly pointerId: Option.Option<number>
readonly key: Option.Option<string>
readonly input: 'keyboard' | 'mouse' | 'pen' | 'touch' | 'virtual'
readonly count: number
readonly stopped: boolean
readonly generation: number
},
| { readonly _tag: 'Stopped' }
| { readonly _tag: 'Elapsed'; readonly generation: number }
| {
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 },
Out,
never,
never,
NoView,
{},
{}
>Repeat.Endedconst · packages/primitives/src/interaction/repeat.ts:59
const Ended: Schema.TaggedStruct<'Ended', { readonly count: Schema.Number }>A hold's steps ended, after count of them. A single step (a tap, a click) has no end of its own.
Repeat.Messageconst · packages/primitives/src/interaction/repeat.ts:33
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 Stopped: {}
}>Repeat.Modelconst · packages/primitives/src/interaction/repeat.ts:19
const Model: Schema.Struct<{
readonly holding: Schema.Boolean
readonly pointerId: Schema.OptionFromNullOr<Schema.Number>
readonly key: Schema.OptionFromNullOr<Schema.String>
readonly input: Schema.Literals<
readonly ['mouse', 'touch', 'pen', 'keyboard', 'virtual']
>
readonly count: Schema.Number
readonly stopped: Schema.Boolean
readonly generation: Schema.Number
}>Repeat.Outtype · packages/primitives/src/interaction/repeat.ts:62
type Out = Stepped | EndedRepeat.Steppedconst · packages/primitives/src/interaction/repeat.ts:51
const Stepped: Schema.TaggedStruct<
'Stepped',
{
readonly count: Schema.Number
readonly input: Schema.Literals<
readonly ['mouse', 'touch', 'pen', 'keyboard', 'virtual']
>
}
>