Skip to content

Commit

Permalink
chore: build
Browse files Browse the repository at this point in the history
  • Loading branch information
wadackel committed Mar 7, 2019
1 parent 5e537a3 commit 4113fbf
Show file tree
Hide file tree
Showing 20 changed files with 871 additions and 866 deletions.
2 changes: 1 addition & 1 deletion decls/__tests__/coordinate.browser.spec.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {};
export {};
2 changes: 1 addition & 1 deletion decls/__tests__/fixture.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const fixture = "\n<div id=\"container\">\n <ul>\n <li><a href=\"#content01\">Content 01</a></li>\n <li><a href=\"#content02\">Content 02</a></li>\n <li><a href=\"#content03\">Content 03</a></li>\n <li><a href=\"#content04\">Content 04</a></li>\n <li><a href=\"#content05\">Content 05</a></li>\n <li><a href=\"#footer\">Footer</a></li>\n </ul>\n <section id=\"content01\"><h2>Content 01</h2><a href=\"#\">page top</a></section>\n <section id=\"content02\"><h2>Content 02</h2><a href=\"#\">page top</a></section>\n <section id=\"content03\"><h2>Content 03</h2><a href=\"#\">page top</a></section>\n <section id=\"content04\"><h2>Content 04</h2><a href=\"#\">page top</a></section>\n <section id=\"content05\"><h2>Content 05</h2><a href=\"#\">page top</a></section>\n</div>\n";
export declare const fixture = "\n<div id=\"container\">\n <ul>\n <li><a href=\"#content01\">Content 01</a></li>\n <li><a href=\"#content02\">Content 02</a></li>\n <li><a href=\"#content03\">Content 03</a></li>\n <li><a href=\"#content04\">Content 04</a></li>\n <li><a href=\"#content05\">Content 05</a></li>\n <li><a href=\"#footer\">Footer</a></li>\n </ul>\n <section id=\"content01\"><h2>Content 01</h2><a href=\"#\">page top</a></section>\n <section id=\"content02\"><h2>Content 02</h2><a href=\"#\">page top</a></section>\n <section id=\"content03\"><h2>Content 03</h2><a href=\"#\">page top</a></section>\n <section id=\"content04\"><h2>Content 04</h2><a href=\"#\">page top</a></section>\n <section id=\"content05\"><h2>Content 05</h2><a href=\"#\">page top</a></section>\n</div>\n";
2 changes: 1 addition & 1 deletion decls/__tests__/index.browser.spec.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {};
export {};
2 changes: 1 addition & 1 deletion decls/__tests__/index.node.spec.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {};
export {};
14 changes: 7 additions & 7 deletions decls/animation/easings.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface EasingFunction {
(x: number, t: number, b: number, c: number, d: number, s?: number): number;
}
export interface Easings {
[name: string]: EasingFunction;
}
export declare const easings: Easings;
export interface EasingFunction {
(x: number, t: number, b: number, c: number, d: number, s?: number): number;
}
export interface Easings {
[name: string]: EasingFunction;
}
export declare const easings: Easings;
16 changes: 8 additions & 8 deletions decls/animation/requestAnimationFrame.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export interface RequestAnimationFrame {
(callback: (time: number) => void): number;
}
export interface CancelAnimationFrame {
(handle: number): void;
}
export declare const raf: RequestAnimationFrame;
export declare const caf: CancelAnimationFrame;
export interface RequestAnimationFrame {
(callback: (time: number) => void): number;
}
export interface CancelAnimationFrame {
(handle: number): void;
}
export declare const raf: RequestAnimationFrame;
export declare const caf: CancelAnimationFrame;
10 changes: 5 additions & 5 deletions decls/coordinate.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Offset } from './dom/offsets';
export interface Coordinate extends Offset {
relative: boolean;
}
export declare const parseCoordinate: (coordinate: any, enableVertical: boolean) => Coordinate | null;
import { Offset } from './dom/offsets';
export interface Coordinate extends Offset {
relative: boolean;
}
export declare const parseCoordinate: (coordinate: any, enableVertical: boolean) => Coordinate | null;
19 changes: 10 additions & 9 deletions decls/dom/dimensions.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export interface Size {
width: number;
height: number;
}
export declare const getSize: ($el: HTMLElement) => Size;
export declare const getViewportAndElementSizes: ($el: HTMLElement) => {
viewport: Size;
size: Size;
};
import { ScrollableElement } from 'src/types';
export interface Size {
width: number;
height: number;
}
export declare const getSize: ($el: HTMLElement) => Size;
export declare const getViewportAndElementSizes: ($el: ScrollableElement) => {
viewport: Size;
size: Size;
};
11 changes: 6 additions & 5 deletions decls/dom/events.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface EventListener {
(e: Event): void;
}
export declare const addEvent: ($el: Element, event: string, listener: EventListener, passive: boolean) => void;
export declare const removeEvent: ($el: Element, event: string, listener: EventListener, passive: boolean) => void;
import { ScrollableElement } from '../types';
export interface EventListener {
(e: Event): void;
}
export declare const addEvent: ($el: ScrollableElement, event: string, listener: EventListener, passive: boolean) => void;
export declare const removeEvent: ($el: ScrollableElement, event: string, listener: EventListener, passive: boolean) => void;
31 changes: 15 additions & 16 deletions decls/dom/offsets.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
export interface Offset {
top: number;
left: number;
}
export declare type Direction = 'x' | 'y';
export declare const directionMethodMap: {
y: string;
x: string;
};
export declare const directionPropMap: {
y: string;
x: string;
};
export declare const getScroll: ($el: Element, direction: Direction) => number;
export declare const setScroll: ($el: Element, offset: number, direction: Direction) => void;
export declare const getOffset: ($el: Element, $context: Element) => Offset;
import { ScrollableElement } from '../types';
export interface Offset {
top: number;
left: number;
}
export declare type Direction = 'x' | 'y';
export declare const directionMethodMap: {
[P in Direction]: 'scrollTop' | 'scrollLeft';
};
export declare const directionPropMap: {
[P in Direction]: 'pageXOffset' | 'pageYOffset';
};
export declare const getScroll: ($el: ScrollableElement, direction: Direction) => number;
export declare const setScroll: ($el: ScrollableElement, offset: number, direction: Direction) => void;
export declare const getOffset: ($el: Element, $context: ScrollableElement) => Offset;
13 changes: 7 additions & 6 deletions decls/dom/selectors.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Direction } from './offsets';
export declare const $$: (selector: string) => Element[];
export declare const $: (selector: string) => Element | null;
export declare const matches: ($el: Element, selector: string | Element) => boolean;
export declare const isRootContainer: ($el: Element) => boolean;
export declare const findScrollable: (selectors: string | Element, direction: Direction) => Element | null;
import { ScrollableElement } from '../types';
export declare const $$: (selector: string) => Element[];
export declare const $: (selector: string) => Element | null;
export declare const isElement: (obj: any) => obj is Element;
export declare const isWindow: ($el: ScrollableElement) => $el is Window;
export declare const isRootContainer: ($el: ScrollableElement) => boolean;
export declare const matches: ($el: Element, selector: string | Element) => boolean;
189 changes: 95 additions & 94 deletions decls/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,94 +1,95 @@
import { RequestAnimationFrame, CancelAnimationFrame } from './animation/requestAnimationFrame';
import { EasingFunction } from './animation/easings';
import { Offset } from './dom/offsets';
import { Options, PartialOptions } from './options';
export { Options, PartialOptions, EasingFunction, Offset, RequestAnimationFrame, CancelAnimationFrame };
export default class SweetScroll {
/**
* You can set Polyfill (or Ponyfill) for browsers that do not support requestAnimationFrame.
*/
static raf: RequestAnimationFrame;
static caf: CancelAnimationFrame;
/**
* SweetScroll instance factory.
*/
static create(options?: PartialOptions, container?: string | Element): SweetScroll;
/**
* Instance properties.
*/
private opts;
private $el;
private ctx;
/**
* Constructor
*/
constructor(options?: PartialOptions, container?: string | Element);
/**
* Scroll animation to the specified position.
*/
to(distance: any, options?: PartialOptions): void;
/**
* Scroll animation to specified left position.
*/
toTop(distance: any, options?: PartialOptions): void;
/**
* Scroll animation to specified top position.
*/
toLeft(distance: any, options?: PartialOptions): void;
/**
* Scroll animation to specified element.
*/
toElement($element: Element, options?: PartialOptions): void;
/**
* Stop the current scroll animation.
*/
stop(gotoEnd?: boolean): void;
/**
* Update options.
*/
update(options: PartialOptions): void;
/**
* Destroy instance.
*/
destroy(): void;
/**
* Callback methods.
*/
protected onBefore(_: Offset, __: Element | null): boolean | void;
protected onStep(_: number): void;
protected onAfter(_: Offset, __: Element | null): void;
protected onCancel(): void;
protected onComplete(_: boolean): void;
/**
* Start scrolling animation.
*/
protected start(opts: Options): void;
/**
* Handle each frame of the animation.
*/
protected loop: (time: number) => void;
/**
* Handle the completion of scrolling animation.
*/
protected complete(): void;
/**
* Callback function and method call.
*/
protected hook(options: Options, type: string, ...args: any[]): any;
/**
* Bind events of container element.
*/
protected bind(click: boolean, stop: boolean): void;
/**
* Unbind events of container element.
*/
protected unbind(click: boolean, stop: boolean): void;
/**
* Handling of container click event.
*/
protected handleClick: (e: Event) => void;
/**
* Handling of container stop events.
*/
protected handleStop: (e: Event) => void;
}
import { RequestAnimationFrame, CancelAnimationFrame } from './animation/requestAnimationFrame';
import { EasingFunction } from './animation/easings';
import { Offset } from './dom/offsets';
import { Options, PartialOptions } from './options';
import { ScrollableElement } from './types';
export { Options, PartialOptions, EasingFunction, Offset, RequestAnimationFrame, CancelAnimationFrame, };
export default class SweetScroll {
/**
* You can set Polyfill (or Ponyfill) for browsers that do not support requestAnimationFrame.
*/
static raf: RequestAnimationFrame;
static caf: CancelAnimationFrame;
/**
* SweetScroll instance factory.
*/
static create(options?: PartialOptions, container?: string | ScrollableElement): SweetScroll;
/**
* Instance properties.
*/
private opts;
private $el;
private ctx;
/**
* Constructor
*/
constructor(options?: PartialOptions, container?: string | ScrollableElement);
/**
* Scroll animation to the specified position.
*/
to(distance: any, options?: PartialOptions): void;
/**
* Scroll animation to specified left position.
*/
toTop(distance: any, options?: PartialOptions): void;
/**
* Scroll animation to specified top position.
*/
toLeft(distance: any, options?: PartialOptions): void;
/**
* Scroll animation to specified element.
*/
toElement($element: Element, options?: PartialOptions): void;
/**
* Stop the current scroll animation.
*/
stop(gotoEnd?: boolean): void;
/**
* Update options.
*/
update(options: PartialOptions): void;
/**
* Destroy instance.
*/
destroy(): void;
/**
* Callback methods.
*/
protected onBefore(_: Offset, __: Element | null): boolean | void;
protected onStep(_: number): void;
protected onAfter(_: Offset, __: Element | null): void;
protected onCancel(): void;
protected onComplete(_: boolean): void;
/**
* Start scrolling animation.
*/
protected start(opts: Options): void;
/**
* Handle each frame of the animation.
*/
protected loop: (time: number) => void;
/**
* Handle the completion of scrolling animation.
*/
protected complete(): void;
/**
* Callback function and method call.
*/
protected hook(options: Options, type: 'before' | 'after' | 'step' | 'cancel' | 'complete', ...args: any[]): any;
/**
* Bind events of container element.
*/
protected bind(click: boolean, stop: boolean): void;
/**
* Unbind events of container element.
*/
protected unbind(click: boolean, stop: boolean): void;
/**
* Handling of container click event.
*/
protected handleClick: (e: Event) => void;
/**
* Handling of container stop events.
*/
protected handleStop: (e: Event) => void;
}
Loading

0 comments on commit 4113fbf

Please sign in to comment.