Skip to content

Commit

Permalink
fix type declarations for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
nickforddev committed Sep 7, 2020
1 parent c55bcd4 commit 325cd9b
Show file tree
Hide file tree
Showing 8 changed files with 5,274 additions and 2,930 deletions.
8,105 changes: 5,175 additions & 2,930 deletions package-lock.json

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions packages/freezeframe/dist/src/constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export declare const classes: {
SELECTOR: string;
CONTAINER: string;
LOADING_ICON: string;
IMAGE: string;
CANVAS: string;
READY: string;
INACTIVE: string;
ACTIVE: string;
CANVAS_READY: string;
RESPONSIVE: string;
OVERLAY: string;
};
export declare const defaultOptions: {
selector: string;
responsive: boolean;
trigger: string;
overlay: boolean;
warnings: boolean;
};
export declare const styleId = "ff-styles";
31 changes: 31 additions & 0 deletions packages/freezeframe/dist/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { SelectorOrNodes, Freeze, FreezeFrameOptions, RequireProps } from '../types';
declare class Freezeframe {
#private;
options: FreezeFrameOptions;
items: Freeze[];
$images: HTMLImageElement[];
private _eventListeners;
private get _stylesInjected();
constructor(target?: SelectorOrNodes | RequireProps<FreezeFrameOptions, 'selector'>, options?: FreezeFrameOptions);
private _init;
private _capture;
private _load;
private _setup;
private _wrap;
private _process;
private _ready;
private _attach;
private _addEventListener;
private _removeEventListener;
private _injectStylesheet;
private _emit;
private _toggleOn;
private _toggleOff;
private _toggle;
start(): this;
stop(): this;
toggle(): this;
on(event: string, cb: Function): this;
destroy(): void;
}
export default Freezeframe;
4 changes: 4 additions & 0 deletions packages/freezeframe/dist/src/templates.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export declare const stylesheet: () => string;
export declare const container: () => string;
export declare const canvas: () => string;
export declare const overlay: () => string;
13 changes: 13 additions & 0 deletions packages/freezeframe/dist/src/utils/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { SelectorOrNodes, FreezeFrameOptions } from '../../types/index';
export declare const pipe: (...fns: Function[]) => (...initArgs: any[]) => any;
export declare const formatMessage: (string: string) => string;
export declare const error: (message: string, ...args: any[]) => void;
export declare const warn: (message: string, ...args: any[]) => void;
export declare const isTouch: () => boolean;
export declare const parseFilename: (filePath: string) => string;
export declare const validateFilename: (filePath: string) => boolean;
export declare const normalizeElements: (selectorOrNodes: SelectorOrNodes) => Element | HTMLCollectionOf<Element> | NodeListOf<Element>;
export declare const validateElements: (elements: Element | Element[], _: any, options: FreezeFrameOptions) => any[];
export declare const dedupeImages: (images: HTMLImageElement[]) => HTMLImageElement[];
export declare const htmlToNode: (html: string) => HTMLElement;
export declare const wrapNode: ($el: HTMLElement, $wrapper: HTMLElement) => void;
27 changes: 27 additions & 0 deletions packages/freezeframe/dist/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export declare type RequireProps<T extends {}, K extends keyof T> = Omit<T, K> & {
[MK in K]-?: NonNullable<T[MK]>;
};
export declare type SelectorOrNodes = string | Element | HTMLCollectionOf<Element> | NodeListOf<Element>;
export declare type TriggerType = string | false;
export declare enum FreezeFrameEventTypes {
START = "start",
STOP = "stop",
TOGGLE = "toggle"
}
export interface FreezeFrameOptions {
selector?: SelectorOrNodes;
responsive?: boolean;
trigger?: TriggerType;
overlay?: boolean;
warnings?: boolean;
}
export interface Freeze {
$container: HTMLElement;
$canvas: HTMLCanvasElement;
$image: HTMLImageElement;
}
export interface FreezeFrameEvent {
$image: HTMLImageElement;
event: string;
listener: EventListenerOrEventListenerObject;
}
1 change: 1 addition & 0 deletions packages/freezeframe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "4.1.3",
"description": "Freezeframe is a library that automatically pauses animated .gifs and enables them to start animation on mouse hover or click",
"main": "/dist/freezeframe.min.js",
"types": "/dist/src/index.d.js",
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/plugin-proposal-class-properties": "^7.10.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/freezeframe/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"exclude": ["./tests/ts-intellisense"],
"compilerOptions": {
"outDir": "./dist/",
"declaration": true,
"declarationDir": "./dist/",
"noImplicitAny": true,
"module": "es2020",
"target": "es2015",
Expand Down

0 comments on commit 325cd9b

Please sign in to comment.