import { type pointerid } from "./pointer"; import { PointerDevice } from "./pointer_device"; import { type _PointerStateSource, PointerState } from "./pointer_state"; type timestamp = number; type milliseconds = number; interface _PointerActivityTraceSource extends _PointerStateSource { readonly clientX: number; readonly clientY: number; readonly composedPath: Array; readonly isPrimary: boolean; readonly isTrusted: boolean; readonly offsetX: number; readonly offsetY: number; readonly pointerId: number; readonly pointerType: string; readonly target: Element; readonly timeStamp: number; readonly type: string; prev: _PointerActivityTraceSource | null; readonly raw: PointerEvent; } declare function _pointerActivityTraceSourceFrom(event: PointerEvent): _PointerActivityTraceSource; declare function _pointerActivityTraceFrom(source: _PointerActivityTraceSource, target: Element, prevTrace: PointerActivity.Trace | null): PointerActivity.Trace; /** * Represents a pointer activity. */ declare namespace PointerActivity { /** * Represents a `PointerEvent`. * * This is an immutable object. */ interface Trace { /** * Indicates the {@link https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp | `timeStamp`} property of the `PointerEvent`. */ readonly timeStamp: timestamp; /** * Indicates the {@link https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientX | `clientX`} property of the `PointerEvent`. */ readonly viewportX: number; /** * Indicates the {@link https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientY | `clientY`} property of the `PointerEvent`. */ readonly viewportY: number; /** * Indicates the x-coordinate in the bounding box (not a padding-box) of the {@link PointerActivity.target | target element} of the `PointerActivity`. */ readonly targetX: number; /** * Indicates the y-coordinate in the bounding box (not a padding-box) of the {@link PointerActivity.target | target element} of the `PointerActivity`. */ readonly targetY: number; /** * Indicates the difference from x-coordinate of the previous `PointerActivity.Trace`. */ readonly movementX: number; /** * Indicates the difference from y-coordinate of the previous `PointerActivity.Trace`. */ readonly movementY: number; /** * Indicates whether any of the following are true. * * - The left mouse button is pressed. * - The pen is in contact. * - The touch is in contact. */ readonly inContact: boolean; /** * Indicates the `PointerState` properties. */ readonly properties: PointerState; /** * Indicates the {@link PointerActivity.pointerId | pointer id} of the `PointerActivity` is pointer-captured by the {@link PointerActivity.target | target element} of the `PointerActivity`. */ readonly isCaptured: boolean; /** * References the source {@link https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent | `PointerEvent`} of `PointerActivity.Trace`. */ readonly source: PointerEvent; /** * References the `Element` that fired the source `PointerEvent`. */ readonly directlyOver: Element; } /** * Represents a pointer activity result. * * This is an immutable object. */ interface Result { /** * Indicates the relative distance from the start point of the `PointerActivity` to the end point of the `PointerActivity`. */ readonly movement: { x: number; y: number; length: number; angle: number; }; /** * Indicates the track length from the start point of the `PointerActivity` to the end point of the `PointerActivity`. */ readonly track: number; } } /** * Represents a pointer activity. * * An object that represents a sequence of `PointerEvent`s with the same `pointerId` from after `pointerenter` to `ponterleave`. */ interface PointerActivity { /** * Indicates the {@link https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId | `pointerId`} property of the `PointerEvent`. * * This value is never changed. */ readonly pointerId: pointerid; /** * Indicates the `PointerDevice`. * * This value is never changed. */ readonly device: PointerDevice; /** * Indicates the {@link https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary | `isPrimary`} property of the `PointerEvent`. * * This value is never changed. */ readonly isPrimary: boolean; /** * Indicates the monitoring target element of the {@link PointerActivityObserver | `PointerActivityObserver`}. * * This value is never changed. */ readonly target: Element | null; /** * Indicates the `timeStamp` property of this {@link PointerActivity.startTrace | `startTrace`} record. * * This value is never changed. */ readonly startTime: timestamp; /** * Indicates the elapsed time from {@link PointerActivity.startTrace | `startTrace`} record to latest `PointerActivity.Trace` record. * * This value is `0` when the instance is created; it keeps increasing while tracking the pointer. When the instance {@link PointerActivity.inProgress | `inProgress`} is set to `false`, this value is not changed thereafter. */ readonly duration: milliseconds; readonly movement: { x: number; y: number; length: number; angle: number; }; readonly track: number; /** * Returns the AsyncGenerator of `PointerActivity.Trace` records. */ [Symbol.asyncIterator](): AsyncGenerator; /** * The `Promise` that resolves to a `PointerActivity.Result`. */ readonly result: Promise; /** * Indicates whether that no {@link PointerActivity.endTrace | `endTrace`} record has been recorded. * * The value is `true` when the instance is created. Never changed after being changed to `false`. */ readonly inProgress: boolean; /** * Indicates the `PointerActivity.Trace` record before the {@link PointerActivity.startTrace | `startTrace`} record. * Set if the pointer is `pointerenter` from outside the boundaries of {@link PointerActivity.target | target element}. Otherwise, `null`. * * This value is never changed. */ readonly beforeTrace: PointerActivity.Trace | null; /** * Indicates the start `PointerActivity.Trace` record of the `PointerActivity`. * * This value is never changed. */ readonly startTrace: PointerActivity.Trace | null; /** * Indicates the end `PointerActivity.Trace` record of the `PointerActivity`. * * This value is `null` when the instance is created. When the instance {@link PointerActivity.inProgress | `inProgress`} is set to `false`, the `PointerActivity.Trace` is set to this value and this value is not changed thereafter. */ readonly endTrace: PointerActivity.Trace | null; } export { _pointerActivityTraceFrom, _pointerActivityTraceSourceFrom, _PointerActivityTraceSource, PointerActivity, }; //# sourceMappingURL=pointer_activity.d.ts.map