pages-cook
Version:
web-portals
102 lines (101 loc) • 3.31 kB
TypeScript
import { Module } from './module';
import { Application } from './Application';
declare interface Animate {
el: Element;
duration: Function;
origin: Function;
}
declare interface ModuleStatus {
init: boolean;
preload: boolean;
prefetch: boolean;
prerender: boolean;
}
declare interface ModuleElements {
container: HTMLElement;
}
declare interface ModuleResources {
script?: Array<string>;
image?: Array<string>;
worker?: Array<string>;
video?: Array<string>;
audio?: Array<string>;
font?: Array<string>;
style?: Array<string>;
}
declare interface ModuleManifest {
config: ModuleConfig;
resources?: ModuleResources;
events?: ModuleEvents;
}
declare interface ModuleConfig {
title: string;
rel?: 'module' | 'frameworks' | 'system';
level: number;
source: {
src?: string;
html?: string;
};
timeout?: number;
render?: (target: HTMLElement) => void;
prerender?: Array<string>;
free: boolean;
animation?: string | boolean | Array<string> | Array<Function> | Function;
background?: boolean | 'auto';
singleFlow?: boolean;
index?: string;
limit?: number;
notFind?: string;
color?: string;
portal?: boolean;
events?: ModuleEvents;
capture?: string | ((resolve: {
path: string;
origin: string;
host: string;
search: string;
}, url: string) => boolean);
transient?: boolean;
allowHosts?: Array<string>;
apply?: Array<'smart-setTimeout' | 'smart-setInterval' | 'link-in-new-window' | 'tap-highlight' | ['tap-highlight', string]>;
inject?: (w: Window, c: ModuleConfig, a: Application) => void;
sandbox?: 'allow-same-origin' | 'allow-scripts' | 'allow-forms' | 'allow-modals' | 'allow-orientation-lock' | 'allow-popups' | 'allow-pointer-lock' | 'allow-popups-to-escape-sandbox' | 'allow-presentation' | 'allow-top-navigation' | 'allow-top-navigation-by-user-activation' | 'allow-downloads-without-user-activation' | 'allow-storage-access-by-user-activation' | 'allow-top-navigation-by-user-activation' | string;
}
declare interface ModuleEvents {
transformStart: () => void | boolean;
transformEnd: () => void;
start: () => void;
load: () => void;
loadError: () => void;
preload: () => void;
destroy: () => void;
}
declare interface TransformAnimateEvent {
x: number;
y: number;
in: Animate;
out: Animate;
view: Array<HTMLElement>;
width: number;
height: number;
viewport: Array<HTMLElement>;
modules: Array<Module>;
reverse: boolean;
direction: number;
backset: number;
origin: string | Array<number>;
attach: string | Array<number>;
touches: TouchEvent | undefined;
callback: Function;
}
declare interface TransformOptions {
index: string;
defaultIndex: string;
singleFlow?: boolean;
singleLock?: boolean;
notFound?: string;
limit?: number;
exists?: boolean;
defaultAnimation?: ModuleConfig['animation'];
}
export { TransformOptions, TransformAnimateEvent, Animate, ModuleStatus, ModuleElements, ModuleResources, ModuleManifest, ModuleEvents, ModuleConfig, Module, Application };