UNPKG

mithril-materialized

Version:
33 lines (32 loc) 1.27 kB
import { FactoryComponent, Attributes } from 'mithril'; export interface PushpinOptions { /** Distance from top of page where element becomes fixed */ top?: number; /** Distance from bottom of page where element stops being fixed */ bottom?: number; /** Offset for calculations */ offset?: number; /** Called when pushpin position changes */ onPositionChange?: (position: 'pin-top' | 'pinned' | 'pin-bottom') => void; } export declare class Pushpin { el: HTMLElement; options: Required<PushpinOptions>; private state; private static defaults; private _updateElementPositionBound; constructor(el: HTMLElement, options?: PushpinOptions); static getInstance(el: HTMLElement): Pushpin | undefined; destroy(): void; _setupEventHandlers(): void; _removeEventHandlers(): void; _updateElementPosition(): void; _removePinClasses(): void; _updatePosition(): void; } export interface PushpinAttrs extends Attributes, PushpinOptions { /** Element selector or reference to attach pushpin to */ targetSelector?: string; } export declare const PushpinComponent: FactoryComponent<PushpinAttrs>; export declare const initPushpins: (selector?: string, options?: PushpinOptions) => Pushpin[];