@likecoin/epub-ts 0.3.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +64 -0
  2. package/dist/annotations.d.ts +159 -0
  3. package/dist/archive.d.ts +82 -0
  4. package/dist/book.d.ts +228 -0
  5. package/dist/container.d.ts +18 -0
  6. package/dist/contents.d.ts +351 -0
  7. package/dist/displayoptions.d.ts +20 -0
  8. package/dist/epub.cjs +10 -0
  9. package/dist/epub.cjs.map +1 -0
  10. package/dist/epub.d.ts +17 -0
  11. package/dist/epub.js +9500 -0
  12. package/dist/epub.js.map +1 -0
  13. package/dist/epub.umd.js +10 -0
  14. package/dist/epub.umd.js.map +1 -0
  15. package/dist/epubcfi.d.ts +116 -0
  16. package/dist/index.d.ts +8 -0
  17. package/dist/layout.d.ts +77 -0
  18. package/dist/locations.d.ts +117 -0
  19. package/dist/managers/continuous/index.d.ts +46 -0
  20. package/dist/managers/default/index.d.ts +117 -0
  21. package/dist/managers/helpers/snap.d.ts +63 -0
  22. package/dist/managers/helpers/stage.d.ts +41 -0
  23. package/dist/managers/helpers/views.d.ts +27 -0
  24. package/dist/managers/views/iframe.d.ts +114 -0
  25. package/dist/managers/views/inline.d.ts +65 -0
  26. package/dist/mapping.d.ts +97 -0
  27. package/dist/marks-pane/index.d.ts +40 -0
  28. package/dist/navigation.d.ts +108 -0
  29. package/dist/packaging.d.ts +104 -0
  30. package/dist/pagelist.d.ts +80 -0
  31. package/dist/rendition.d.ts +293 -0
  32. package/dist/resources.d.ts +97 -0
  33. package/dist/section.d.ts +88 -0
  34. package/dist/spine.d.ts +79 -0
  35. package/dist/store.d.ts +122 -0
  36. package/dist/themes.d.ts +103 -0
  37. package/dist/types.d.ts +269 -0
  38. package/dist/utils/constants.d.ts +59 -0
  39. package/dist/utils/core.d.ts +337 -0
  40. package/dist/utils/event-emitter.d.ts +6 -0
  41. package/dist/utils/hook.d.ts +30 -0
  42. package/dist/utils/mime.d.ts +5 -0
  43. package/dist/utils/path-utils.d.ts +14 -0
  44. package/dist/utils/path.d.ts +55 -0
  45. package/dist/utils/queue.d.ts +66 -0
  46. package/dist/utils/replacements.d.ts +11 -0
  47. package/dist/utils/request.d.ts +2 -0
  48. package/dist/utils/scrolltype.d.ts +2 -0
  49. package/dist/utils/url.d.ts +42 -0
  50. package/license +28 -0
  51. package/package.json +55 -0
@@ -0,0 +1,116 @@
1
+ import { EpubCFIStep, EpubCFIComponent } from './types';
2
+ /**
3
+ * Parsing and creation of EpubCFIs: http://www.idpf.org/epub/linking/cfi/epub-cfi.html
4
+
5
+ * Implements:
6
+ * - Character Offset: epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)
7
+ * - Simple Ranges : epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)
8
+
9
+ * Does Not Implement:
10
+ * - Temporal Offset (~)
11
+ * - Spatial Offset (@)
12
+ * - Temporal-Spatial Offset (~ + @)
13
+ * - Text Location Assertion ([)
14
+ * @class
15
+ @param {string | Range | Node } [cfiFrom]
16
+ @param {string | object} [base]
17
+ @param {string} [ignoreClass] class to ignore when parsing DOM
18
+ */
19
+ declare class EpubCFI {
20
+ str: string;
21
+ base: EpubCFIComponent | any;
22
+ spinePos: number;
23
+ range: boolean;
24
+ path: EpubCFIComponent | any;
25
+ start: EpubCFIComponent | null;
26
+ end: EpubCFIComponent | null;
27
+ id: string | null;
28
+ constructor(cfiFrom?: string | Range | Node | EpubCFI, base?: string | EpubCFIComponent, ignoreClass?: string);
29
+ /**
30
+ * Check the type of constructor input
31
+ * @private
32
+ */
33
+ checkType(cfi: string | Range | Node | EpubCFI | undefined): string | false;
34
+ /**
35
+ * Parse a cfi string to a CFI object representation
36
+ * @param {string} cfiStr
37
+ * @returns {object} cfi
38
+ */
39
+ parse(cfiStr: string): any;
40
+ parseComponent(componentStr: string): EpubCFIComponent;
41
+ parseStep(stepStr: string): EpubCFIStep | undefined;
42
+ parseTerminal(termialStr: string): {
43
+ offset: number | null;
44
+ assertion: string | null;
45
+ };
46
+ getChapterComponent(cfiStr: string): string;
47
+ getPathComponent(cfiStr: string): string | undefined;
48
+ getRange(cfiStr: string): [string, string] | false;
49
+ getCharecterOffsetComponent(cfiStr: string): string;
50
+ joinSteps(steps: EpubCFIStep[]): string;
51
+ segmentString(segment: EpubCFIComponent): string;
52
+ /**
53
+ * Convert CFI to a epubcfi(...) string
54
+ * @returns {string} epubcfi
55
+ */
56
+ toString(): string;
57
+ /**
58
+ * Compare which of two CFIs is earlier in the text
59
+ * @returns {number} First is earlier = -1, Second is earlier = 1, They are equal = 0
60
+ */
61
+ compare(cfiOne: string | EpubCFI, cfiTwo: string | EpubCFI): number;
62
+ step(node: Node): EpubCFIStep;
63
+ filteredStep(node: Node, ignoreClass: string): EpubCFIStep | undefined;
64
+ pathTo(node: Node, offset: number | null, ignoreClass?: string): EpubCFIComponent;
65
+ equalStep(stepA: EpubCFIStep, stepB: EpubCFIStep): boolean;
66
+ /**
67
+ * Create a CFI object from a Range
68
+ * @param {Range} range
69
+ * @param {string | object} base
70
+ * @param {string} [ignoreClass]
71
+ * @returns {object} cfi
72
+ */
73
+ fromRange(range: Range, base: string | EpubCFIComponent, ignoreClass?: string): Partial<EpubCFI>;
74
+ /**
75
+ * Create a CFI object from a Node
76
+ * @param {Node} anchor
77
+ * @param {string | object} base
78
+ * @param {string} [ignoreClass]
79
+ * @returns {object} cfi
80
+ */
81
+ fromNode(anchor: Node, base: string | EpubCFIComponent, ignoreClass?: string): Partial<EpubCFI>;
82
+ filter(anchor: Node, ignoreClass: string): Node | false;
83
+ patchOffset(anchor: Node, offset: number, ignoreClass: string): number;
84
+ normalizedMap(children: NodeListOf<ChildNode>, nodeType: number, ignoreClass: string): Record<number, number>;
85
+ position(anchor: Node): number;
86
+ filteredPosition(anchor: Node, ignoreClass: string): number;
87
+ stepsToXpath(steps: EpubCFIStep[]): string;
88
+ stepsToQuerySelector(steps: EpubCFIStep[]): string;
89
+ textNodes(container: Node, ignoreClass?: string): Node[];
90
+ walkToNode(steps: EpubCFIStep[], _doc?: Document, ignoreClass?: string): Node | undefined;
91
+ findNode(steps: EpubCFIStep[], _doc?: Document, ignoreClass?: string): Node | undefined;
92
+ fixMiss(steps: EpubCFIStep[], offset: number, _doc?: Document, ignoreClass?: string): {
93
+ container: Node;
94
+ offset: number;
95
+ };
96
+ /**
97
+ * Creates a DOM range representing a CFI
98
+ * @param {document} _doc document referenced in the base
99
+ * @param {string} [ignoreClass]
100
+ * @return {Range}
101
+ */
102
+ toRange(_doc?: Document, ignoreClass?: string): Range | null;
103
+ /**
104
+ * Check if a string is wrapped with "epubcfi()"
105
+ * @param {string} str
106
+ * @returns {boolean}
107
+ */
108
+ isCfiString(str: unknown): boolean;
109
+ generateChapterComponent(_spineNodeIndex: number, _pos: number | string, id?: string): string;
110
+ /**
111
+ * Collapse a CFI Range to a single CFI Position
112
+ * @param {boolean} [toStart=false]
113
+ */
114
+ collapse(toStart?: boolean): void;
115
+ }
116
+ export default EpubCFI;
@@ -0,0 +1,8 @@
1
+ import { default as Book } from './book';
2
+ import { default as EpubCFI } from './epubcfi';
3
+ import { default as Rendition } from './rendition';
4
+ import { default as Contents } from './contents';
5
+ import { default as Layout } from './layout';
6
+ import { default as ePub } from './epub';
7
+ export default ePub;
8
+ export { Book, EpubCFI, Rendition, Contents, Layout };
@@ -0,0 +1,77 @@
1
+ import { LayoutSettings, LayoutProps, IEventEmitter } from './types';
2
+ import { default as Contents } from './contents';
3
+ import { default as Section } from './section';
4
+ /**
5
+ * Figures out the CSS values to apply for a layout
6
+ * @class
7
+ * @param {object} settings
8
+ * @param {string} [settings.layout='reflowable']
9
+ * @param {string} [settings.spread]
10
+ * @param {number} [settings.minSpreadWidth=800]
11
+ * @param {boolean} [settings.evenSpreads=false]
12
+ */
13
+ declare class Layout implements IEventEmitter {
14
+ on: (type: string, fn: (...args: any[]) => void) => this;
15
+ off: (type: string, fn?: (...args: any[]) => void) => this;
16
+ emit: (type: string, ...args: any[]) => void;
17
+ settings: LayoutSettings;
18
+ name: string;
19
+ _spread: boolean;
20
+ _minSpreadWidth: number;
21
+ _evenSpreads: boolean;
22
+ _flow: string;
23
+ width: number;
24
+ height: number;
25
+ spreadWidth: number;
26
+ delta: number;
27
+ columnWidth: number;
28
+ gap: number;
29
+ divisor: number;
30
+ pageWidth: number;
31
+ props: LayoutProps;
32
+ constructor(settings: LayoutSettings);
33
+ /**
34
+ * Switch the flow between paginated and scrolled
35
+ * @param {string} flow paginated | scrolled
36
+ * @return {string} simplified flow
37
+ */
38
+ flow(flow?: string): string;
39
+ /**
40
+ * Switch between using spreads or not, and set the
41
+ * width at which they switch to single.
42
+ * @param {string} spread "none" | "always" | "auto"
43
+ * @param {number} min integer in pixels
44
+ * @return {boolean} spread true | false
45
+ */
46
+ spread(spread?: string, min?: number): boolean;
47
+ /**
48
+ * Calculate the dimensions of the pagination
49
+ * @param {number} _width width of the rendering
50
+ * @param {number} _height height of the rendering
51
+ * @param {number} _gap width of the gap between columns
52
+ */
53
+ calculate(_width: number, _height: number, _gap?: number): void;
54
+ /**
55
+ * Apply Css to a Document
56
+ * @param {Contents} contents
57
+ * @return {Promise}
58
+ */
59
+ format(contents: Contents, section?: Section, axis?: string): void;
60
+ /**
61
+ * Count number of pages
62
+ * @param {number} totalLength
63
+ * @param {number} pageLength
64
+ * @return {{spreads: Number, pages: Number}}
65
+ */
66
+ count(totalLength: number, pageLength?: number): {
67
+ spreads: number;
68
+ pages: number;
69
+ };
70
+ /**
71
+ * Update props that have changed
72
+ * @private
73
+ * @param {object} props
74
+ */
75
+ update(props: Partial<LayoutProps>): void;
76
+ }
77
+ export default Layout;
@@ -0,0 +1,117 @@
1
+ import { default as Queue } from './utils/queue';
2
+ import { default as EpubCFI } from './epubcfi';
3
+ import { IEventEmitter, RequestFunction } from './types';
4
+ import { default as Spine } from './spine';
5
+ import { default as Section } from './section';
6
+ /**
7
+ * Find Locations for a Book
8
+ * @param {Spine} spine
9
+ * @param {request} request
10
+ * @param {number} [pause=100]
11
+ */
12
+ declare class Locations implements IEventEmitter {
13
+ on: (type: string, fn: (...args: any[]) => void) => this;
14
+ off: (type: string, fn?: (...args: any[]) => void) => this;
15
+ emit: (type: string, ...args: any[]) => void;
16
+ spine: Spine;
17
+ request: RequestFunction;
18
+ pause: number;
19
+ q: Queue;
20
+ epubcfi: EpubCFI;
21
+ _locations: string[];
22
+ _locationsWords: {
23
+ cfi: string;
24
+ wordCount: number;
25
+ }[];
26
+ total: number;
27
+ break: number;
28
+ _current: number;
29
+ _wordCounter: number;
30
+ _currentCfi: string;
31
+ processingTimeout: ReturnType<typeof setTimeout> | undefined;
32
+ constructor(spine: Spine, request: RequestFunction, pause?: number);
33
+ /**
34
+ * Load all of sections in the book to generate locations
35
+ * @param {int} chars how many chars to split on
36
+ * @return {Promise<Array<string>>} locations
37
+ */
38
+ generate(chars?: number): Promise<string[]>;
39
+ createRange(): {
40
+ startContainer: Node | undefined;
41
+ startOffset: number | undefined;
42
+ endContainer: Node | undefined;
43
+ endOffset: number | undefined;
44
+ };
45
+ process(section: Section): Promise<string[]>;
46
+ parse(contents: Element, cfiBase: string, chars?: number): string[];
47
+ /**
48
+ * Load all of sections in the book to generate locations
49
+ * @param {string} startCfi start position
50
+ * @param {int} wordCount how many words to split on
51
+ * @param {int} count result count
52
+ * @return {object} locations
53
+ */
54
+ generateFromWords(startCfi?: string, wordCount?: number, count?: number): Promise<any[]>;
55
+ processWords(section: Section, wordCount: number, startCfi?: EpubCFI, count?: number): Promise<any>;
56
+ countWords(s: string): number;
57
+ parseWords(contents: Element, section: Section, wordCount: number, startCfi?: EpubCFI): {
58
+ cfi: string;
59
+ wordCount: number;
60
+ }[];
61
+ /**
62
+ * Get a location from an EpubCFI
63
+ * @param {EpubCFI} cfi
64
+ * @return {number}
65
+ */
66
+ locationFromCfi(cfi: string | EpubCFI): number;
67
+ /**
68
+ * Get a percentage position in locations from an EpubCFI
69
+ * @param {EpubCFI} cfi
70
+ * @return {number}
71
+ */
72
+ percentageFromCfi(cfi: string | EpubCFI): number | null;
73
+ /**
74
+ * Get a percentage position from a location index
75
+ * @param {number} location
76
+ * @return {number}
77
+ */
78
+ percentageFromLocation(loc: number): number;
79
+ /**
80
+ * Get an EpubCFI from location index
81
+ * @param {number} loc
82
+ * @return {EpubCFI} cfi
83
+ */
84
+ cfiFromLocation(loc: string | number): string | number;
85
+ /**
86
+ * Get an EpubCFI from location percentage
87
+ * @param {number} percentage
88
+ * @return {EpubCFI} cfi
89
+ */
90
+ cfiFromPercentage(percentage: number): string | number;
91
+ /**
92
+ * Load locations from JSON
93
+ * @param {json} locations
94
+ */
95
+ load(locations: string | string[]): string[];
96
+ /**
97
+ * Save locations to JSON
98
+ * @return {json}
99
+ */
100
+ save(): string;
101
+ getCurrent(): number;
102
+ setCurrent(curr: string | number): void;
103
+ /**
104
+ * Get the current location
105
+ */
106
+ get currentLocation(): number;
107
+ /**
108
+ * Set the current location
109
+ */
110
+ set currentLocation(curr: string | number);
111
+ /**
112
+ * Locations length
113
+ */
114
+ length(): number;
115
+ destroy(): void;
116
+ }
117
+ export default Locations;
@@ -0,0 +1,46 @@
1
+ import { defer, requestAnimationFrame } from '../../utils/core';
2
+ import { default as DefaultViewManager } from '../default';
3
+ import { default as Snap } from '../helpers/snap';
4
+ import { default as Section } from '../../section';
5
+ import { default as IframeView } from '../views/iframe';
6
+ import { default as Stage } from '../helpers/stage';
7
+ import { ManagerOptions, ReframeBounds } from '../../types';
8
+ declare class ContinuousViewManager extends DefaultViewManager {
9
+ snapper: Snap;
10
+ tick: typeof requestAnimationFrame;
11
+ scrollDeltaVert: number;
12
+ scrollDeltaHorz: number;
13
+ _scrolled: (...args: any[]) => void;
14
+ didScroll: boolean;
15
+ prevScrollTop: number;
16
+ prevScrollLeft: number;
17
+ scrollTimeout: ReturnType<typeof setTimeout>;
18
+ trimTimeout: ReturnType<typeof setTimeout>;
19
+ constructor(options: ManagerOptions);
20
+ display(section: Section, target?: string): Promise<any>;
21
+ fill(_full?: InstanceType<typeof defer>): Promise<any>;
22
+ moveTo(offset: {
23
+ left: number;
24
+ top: number;
25
+ }): void;
26
+ afterResized(view: IframeView): void;
27
+ removeShownListeners(view: IframeView): void;
28
+ add(section: Section): Promise<any>;
29
+ append(section: Section): any;
30
+ prepend(section: Section): any;
31
+ counter(bounds: ReframeBounds): void;
32
+ update(_offset?: number): Promise<any>;
33
+ check(_offsetLeft?: number, _offsetTop?: number): Promise<any>;
34
+ trim(): Promise<any>;
35
+ erase(view: IframeView, above?: IframeView[]): void;
36
+ addEventListeners(_stage?: Stage): void;
37
+ addScrollListeners(): void;
38
+ removeEventListeners(): void;
39
+ onScroll(): void;
40
+ scrolled(): void;
41
+ next(): void;
42
+ prev(): void;
43
+ updateFlow(flow: string): void;
44
+ destroy(): void;
45
+ }
46
+ export default ContinuousViewManager;
@@ -0,0 +1,117 @@
1
+ import { default as Mapping } from '../../mapping';
2
+ import { default as Queue } from '../../utils/queue';
3
+ import { default as Stage } from '../helpers/stage';
4
+ import { default as Views } from '../helpers/views';
5
+ import { default as Layout } from '../../layout';
6
+ import { default as Section } from '../../section';
7
+ import { default as Contents } from '../../contents';
8
+ import { default as IframeView } from '../views/iframe';
9
+ import { IEventEmitter, ManagerOptions, ViewSettings, ViewLocation, RequestFunction, SizeObject, ReframeBounds, LayoutProps } from '../../types';
10
+ declare class DefaultViewManager implements IEventEmitter {
11
+ name: string;
12
+ optsSettings: ManagerOptions;
13
+ View: new (section: Section, options?: ViewSettings) => IframeView;
14
+ request: RequestFunction;
15
+ renditionQueue: Queue;
16
+ q: Queue;
17
+ settings: ManagerOptions;
18
+ viewSettings: Omit<ViewSettings, "layout"> & {
19
+ layout?: Layout | LayoutProps;
20
+ };
21
+ rendered: boolean;
22
+ stage: Stage;
23
+ container: HTMLElement;
24
+ views: Views;
25
+ _bounds: {
26
+ left: number;
27
+ right: number;
28
+ top: number;
29
+ bottom: number;
30
+ width: number;
31
+ height: number;
32
+ };
33
+ _stageSize: SizeObject;
34
+ overflow: string;
35
+ layout: Layout;
36
+ mapping: Mapping;
37
+ location: ViewLocation[];
38
+ isPaginated: boolean;
39
+ scrollLeft: number;
40
+ scrollTop: number;
41
+ ignore: boolean;
42
+ writingMode: string;
43
+ _hasScrolled: boolean;
44
+ _onScroll: (...args: any[]) => void;
45
+ orientationTimeout: ReturnType<typeof setTimeout>;
46
+ resizeTimeout: ReturnType<typeof setTimeout>;
47
+ afterScrolled: ReturnType<typeof setTimeout>;
48
+ winBounds: {
49
+ top: number;
50
+ left: number;
51
+ right: number;
52
+ bottom: number;
53
+ width: number;
54
+ height: number;
55
+ };
56
+ on: IEventEmitter["on"];
57
+ off: IEventEmitter["off"];
58
+ emit: IEventEmitter["emit"];
59
+ constructor(options: ManagerOptions);
60
+ render(element: HTMLElement, size: SizeObject): void;
61
+ addEventListeners(): void;
62
+ removeEventListeners(): void;
63
+ destroy(): void;
64
+ onOrientationChange(_e?: Event): void;
65
+ onResized(_e?: Event): void;
66
+ resize(width?: number, height?: number, epubcfi?: string): void;
67
+ createView(section: Section, forceRight?: boolean): IframeView;
68
+ handleNextPrePaginated(forceRight: boolean, section: Section, action: Function): any;
69
+ display(section: Section, target?: string): Promise<any>;
70
+ afterDisplayed(view: IframeView): void;
71
+ afterResized(view: IframeView): void;
72
+ moveTo(offset: {
73
+ left: number;
74
+ top: number;
75
+ }, width?: number): void;
76
+ add(section: Section, forceRight?: boolean): Promise<any>;
77
+ append(section: Section, forceRight?: boolean): Promise<any>;
78
+ prepend(section: Section, forceRight?: boolean): Promise<any>;
79
+ counter(bounds: ReframeBounds): void;
80
+ next(): any;
81
+ prev(): any;
82
+ current(): IframeView | null;
83
+ clear(): void;
84
+ currentLocation(): ViewLocation[];
85
+ scrolledLocation(): ViewLocation[];
86
+ paginatedLocation(): ViewLocation[];
87
+ isVisible(view: IframeView, offsetPrev: number, offsetNext: number, _container?: {
88
+ left: number;
89
+ right: number;
90
+ top: number;
91
+ bottom: number;
92
+ width: number;
93
+ height: number;
94
+ }): boolean;
95
+ visible(): IframeView[];
96
+ scrollBy(x: number, y: number, silent?: boolean): void;
97
+ scrollTo(x: number, y: number, silent?: boolean): void;
98
+ onScroll(): void;
99
+ bounds(): {
100
+ left: number;
101
+ right: number;
102
+ top: number;
103
+ bottom: number;
104
+ width: number;
105
+ height: number;
106
+ };
107
+ applyLayout(layout: Layout): void;
108
+ updateLayout(): void;
109
+ setLayout(layout: Layout): void;
110
+ updateWritingMode(mode: string): void;
111
+ updateAxis(axis: string, forceUpdate?: boolean): void;
112
+ updateFlow(flow: string, defaultScrolledOverflow?: string): void;
113
+ getContents(): Contents[];
114
+ direction(dir?: string): void;
115
+ isRendered(): boolean;
116
+ }
117
+ export default DefaultViewManager;
@@ -0,0 +1,63 @@
1
+ import { IEventEmitter } from '../../types';
2
+ import { default as DefaultViewManager } from '../default/index';
3
+ import { default as Contents } from '../../contents';
4
+ import { default as Layout } from '../../layout';
5
+ declare class Snap implements IEventEmitter {
6
+ settings: {
7
+ duration: number;
8
+ minVelocity: number;
9
+ minDistance: number;
10
+ easing: (pos: number) => number;
11
+ [key: string]: any;
12
+ };
13
+ manager: DefaultViewManager;
14
+ layout: Layout;
15
+ fullsize: boolean;
16
+ element: HTMLElement;
17
+ scroller: HTMLElement | Window;
18
+ isVertical: boolean;
19
+ touchCanceler: boolean;
20
+ resizeCanceler: boolean;
21
+ snapping: boolean;
22
+ scrollLeft: number;
23
+ scrollTop: number;
24
+ startTouchX: number;
25
+ startTouchY: number;
26
+ startTime: number;
27
+ endTouchX: number;
28
+ endTouchY: number;
29
+ endTime: number;
30
+ _onResize: (...args: any[]) => void;
31
+ _onScroll: (...args: any[]) => void;
32
+ _onTouchStart: (...args: any[]) => void;
33
+ _onTouchMove: (...args: any[]) => void;
34
+ _onTouchEnd: (...args: any[]) => void;
35
+ _afterDisplayed: (...args: any[]) => void;
36
+ on: IEventEmitter["on"];
37
+ off: IEventEmitter["off"];
38
+ emit: IEventEmitter["emit"];
39
+ constructor(manager: DefaultViewManager, options?: Record<string, any>);
40
+ setup(manager: DefaultViewManager): void;
41
+ supportsTouch(): boolean;
42
+ disableScroll(): void;
43
+ enableScroll(): void;
44
+ addListeners(): void;
45
+ removeListeners(): void;
46
+ afterDisplayed(view: {
47
+ contents: Contents;
48
+ }): void;
49
+ triggerViewEvent(e: TouchEvent, contents: Contents): void;
50
+ onScroll(_e?: Event): void;
51
+ onResize(_e?: Event): void;
52
+ onTouchStart(e: TouchEvent): void;
53
+ onTouchMove(e: TouchEvent): void;
54
+ onTouchEnd(_e?: TouchEvent): void;
55
+ wasSwiped(): number;
56
+ needsSnap(): boolean;
57
+ snap(howMany?: number): Promise<void>;
58
+ smoothScrollTo(destination: number): Promise<void>;
59
+ scrollTo(left?: number, top?: number): void;
60
+ now(): number;
61
+ destroy(): void;
62
+ }
63
+ export default Snap;
@@ -0,0 +1,41 @@
1
+ import { StageOptions } from '../../types';
2
+ declare class Stage {
3
+ settings: StageOptions;
4
+ id: string;
5
+ container: HTMLDivElement;
6
+ wrapper: HTMLDivElement;
7
+ element: HTMLElement;
8
+ resizeFunc: () => void;
9
+ orientationChangeFunc: (e: Event) => void;
10
+ containerStyles: CSSStyleDeclaration;
11
+ containerPadding: {
12
+ left: number;
13
+ right: number;
14
+ top: number;
15
+ bottom: number;
16
+ };
17
+ sheet: CSSStyleSheet;
18
+ constructor(_options?: StageOptions);
19
+ create(options: StageOptions): HTMLDivElement;
20
+ wrap(container: HTMLElement): HTMLDivElement;
21
+ getElement(_element: HTMLElement | string): HTMLElement;
22
+ attachTo(what: HTMLElement | string): HTMLElement | void;
23
+ getContainer(): HTMLDivElement;
24
+ onResize(func: () => void): void;
25
+ onOrientationChange(func: (e: Event) => void): void;
26
+ size(width?: number | string | null, height?: number | string | null): {
27
+ width: number;
28
+ height: number;
29
+ };
30
+ bounds(): DOMRect | {
31
+ width: number;
32
+ height: number;
33
+ };
34
+ getSheet(): CSSStyleSheet;
35
+ addStyleRules(selector: string, rulesArray: Record<string, string>[]): void;
36
+ axis(axis: string): void;
37
+ direction(dir: string): void;
38
+ overflow(overflow: string): void;
39
+ destroy(): void;
40
+ }
41
+ export default Stage;
@@ -0,0 +1,27 @@
1
+ import { default as IframeView } from '../views/iframe';
2
+ import { default as Section } from '../../section';
3
+ declare class Views {
4
+ container: HTMLElement;
5
+ _views: IframeView[];
6
+ length: number;
7
+ hidden: boolean;
8
+ constructor(container: HTMLElement);
9
+ all(): IframeView[];
10
+ first(): IframeView | undefined;
11
+ last(): IframeView | undefined;
12
+ indexOf(view: IframeView): number;
13
+ slice(...args: [start?: number, end?: number]): IframeView[];
14
+ get(i: number): IframeView;
15
+ append(view: IframeView): IframeView;
16
+ prepend(view: IframeView): IframeView;
17
+ insert(view: IframeView, index: number): IframeView;
18
+ remove(view: IframeView): void;
19
+ destroy(view: IframeView): void;
20
+ forEach(callbackfn: (value: IframeView, index: number, array: IframeView[]) => void): void;
21
+ clear(): void;
22
+ find(section: Section): IframeView | undefined;
23
+ displayed(): IframeView[];
24
+ show(): void;
25
+ hide(): void;
26
+ }
27
+ export default Views;