1 | import { BScrollInstance } from './Instance';
|
2 | import { Options, DefOptions, OptionsConstructor } from './Options';
|
3 | import Scroller from './scroller/Scroller';
|
4 | import { ApplyOrder, EventEmitter } from '@better-scroll/shared-utils';
|
5 | import { UnionToIntersection } from './utils/typesHelper';
|
6 | interface PluginCtor {
|
7 | pluginName: string;
|
8 | applyOrder?: ApplyOrder;
|
9 | new (scroll: BScroll): any;
|
10 | }
|
11 | interface PluginItem {
|
12 | name: string;
|
13 | applyOrder?: ApplyOrder.Pre | ApplyOrder.Post;
|
14 | ctor: PluginCtor;
|
15 | }
|
16 | interface PluginsMap {
|
17 | [key: string]: boolean;
|
18 | }
|
19 | interface PropertyConfig {
|
20 | key: string;
|
21 | sourceKey: string;
|
22 | }
|
23 | declare type ElementParam = HTMLElement | string;
|
24 | export interface MountedBScrollHTMLElement extends HTMLElement {
|
25 | isBScrollContainer?: boolean;
|
26 | }
|
27 | export declare class BScrollConstructor<O = {}> extends EventEmitter {
|
28 | static plugins: PluginItem[];
|
29 | static pluginsMap: PluginsMap;
|
30 | scroller: Scroller;
|
31 | options: OptionsConstructor;
|
32 | hooks: EventEmitter;
|
33 | plugins: {
|
34 | [name: string]: any;
|
35 | };
|
36 | wrapper: HTMLElement;
|
37 | content: HTMLElement;
|
38 | [key: string]: any;
|
39 | static use(ctor: PluginCtor): typeof BScrollConstructor;
|
40 | constructor(el: ElementParam, options?: Options & O);
|
41 | setContent(wrapper: MountedBScrollHTMLElement): {
|
42 | valid: boolean;
|
43 | contentChanged: boolean;
|
44 | };
|
45 | private init;
|
46 | private applyPlugins;
|
47 | private handleAutoBlur;
|
48 | private eventBubbling;
|
49 | private refreshWithoutReset;
|
50 | proxy(propertiesConfig: PropertyConfig[]): void;
|
51 | refresh(): void;
|
52 | enable(): void;
|
53 | disable(): void;
|
54 | destroy(): void;
|
55 | eventRegister(names: string[]): void;
|
56 | }
|
57 | export interface BScrollConstructor extends BScrollInstance {
|
58 | }
|
59 | export interface CustomAPI {
|
60 | [key: string]: {};
|
61 | }
|
62 | declare type ExtractAPI<O> = {
|
63 | [K in keyof O]: K extends string ? DefOptions[K] extends undefined ? CustomAPI[K] : never : never;
|
64 | }[keyof O];
|
65 | export declare function createBScroll<O = {}>(el: ElementParam, options?: Options & O): BScrollConstructor & UnionToIntersection<ExtractAPI<O>>;
|
66 | export declare namespace createBScroll {
|
67 | var use: typeof BScrollConstructor.use;
|
68 | var plugins: PluginItem[];
|
69 | var pluginsMap: PluginsMap;
|
70 | }
|
71 | declare type createBScroll = typeof createBScroll;
|
72 | export interface BScrollFactory extends createBScroll {
|
73 | new <O = {}>(el: ElementParam, options?: Options & O): BScrollConstructor & UnionToIntersection<ExtractAPI<O>>;
|
74 | }
|
75 | export declare type BScroll<O = Options> = BScrollConstructor<O> & UnionToIntersection<ExtractAPI<O>>;
|
76 | export declare const BScroll: BScrollFactory;
|
77 | export {};
|