ReorderController: its internal types

Classes

PassEnds

onPassEnd(listener) runs listener at the end of every Measure pass, and returns the unsubscribe.

Extends

  • Context.Service

Properties

onPassEnd
readonly onPassEnd: (listener) => () => void;

Run listener at the end of every Measure pass: once per pass, after every round's boxes are stored (a blocked pass and one whose flush triggered more rounds included). A listener that throws is logged and doesn't stop the pass or the others.

Parameters
listener

() => void

Returns

() => void

Interfaces

Rect

A box on screen, in client coordinates.

Properties

bottom
readonly bottom: number;
left
readonly left: number;
readonly right: number;
top
readonly top: number;

ReorderController

A Reorder group on the DOM.

Type Parameters

V

V

Properties

attach
readonly attach: (element) => void;

The group's element: its direction, and the scroller Auto-scroll looks for from it.

Parameters
element

Element

Returns

void

axis
readonly axis: () => Axis;

The app's axis, else the last detected one ("y" before the first).

Returns

Axis

detect
readonly detect: () => Axis;

The axis now: the app's, else detected from the items' boxes as they are, reporting nothing. A binding derives its axis with it when the app's is cleared.

Returns

Axis

dispose
readonly dispose: () => void;

Stops listening for the items' layouts and ends the auto-scroll. The Scope calls it.

Returns

void

group
readonly group: Group<V>;

Core's Reorder group (Reorder.move(group, value, toIndex) reorders in code).

item
readonly item: (value, element, onLift?) => ItemDriver;

The driver for the item with value; element is its element (for Auto-scroll, its label, its focus and its reveal), and onLift hears its keyboard lift start and end (the binding's whileDrag).

Parameters
value

V

element

() => Option<Element>

onLift?

(lifted) => void

Returns

ItemDriver

move
readonly move: (value, toIndex) => void;

Move value to toIndex in code (Reorder.move), and announce it.

Parameters
value

V

toIndex

number

Returns

void

valuesChanged
readonly valuesChanged: () => void;

The app's values changed: its items laid out in them (a Measure pass), so they animate to their new places.

Returns

void


ReorderControllerOptions

What a binding hands its group's controller.

Type Parameters

V

V

Properties

announcements?
readonly announcements?: () => Option<Announcements<V>>;

The group's announcements over the defaults, read at each announcement.

Returns

Option<Announcements<V>>

axis?
readonly axis?: () => Option<Axis>;

The app's axis, overriding detection; None to detect.

Returns

Option<Axis>

key?
readonly key?: (value) => unknown;

What makes two of the app's values one item, where its list makes them again (a refetch, a store's copy): the group matches by it (core's GroupOptions.key), and so does the controller, in an item's index, its element, its hold and its lift, and in its check of an order it asked for. So an item made again keeps its place, its drag and its keyboard lift. Left out, values match by identity.

Parameters
value

V

Returns

unknown

keyboard?
readonly keyboard?: () => boolean;

Whether the items reorder by keyboard, read at each key; false turns it off. On when left out.

Returns

boolean

keyedWith?
readonly keyedWith?: string;

How the binding keys its items, for the warning logged once per controller when an item registers with a value an item of this group unregistered in the same task (the signature of a list keyed by index): "key items with keyedWith". Solid's is "<For>"; by default "their value".

onAxis?
readonly onAxis?: (axis) => void;

Called when the detected axis changes (once the items are laid out, or ReorderController.resolve).

Parameters
axis

Axis

Returns

void

onHoldEnd?
readonly onHoldEnd?: (end) => void;

Hears each Reorder hold's end, once, whatever ended it; after onReorderEnd when it moved.

Parameters
end

HoldEnd<V>

Returns

void

onHoldStart?
readonly onHoldStart?: (start) => void;

Hears each Reorder hold's start: a drag of an item past its threshold, or a keyboard lift.

Parameters
start

HoldStart<V>

Returns

void

onReorder
readonly onReorder: (values) => void;

Receives a new order; the app sets values from it.

Parameters
values

V[]

Returns

void

onReorderEnd?
readonly onReorderEnd?: (end) => void;

Hears a user's reorder that changed the order, at its end: once a gesture, not at each step, as onReorder is. Not a keyboard cancel, which puts the order back, nor move.

Parameters
end

End<V>

Returns

void

values
readonly values: () => readonly V[];

The app's values, in order.

Returns

readonly V[]