cyclejs-modal
Version:
An easy way to open custom modals in a cyclejs app
58 lines (57 loc) • 1.76 kB
TypeScript
import { Stream } from 'xstream';
import { VNode } from '@cycle/dom';
export declare type Sinks = any;
export declare type Sources = any;
export declare type Component = (s: Sources) => Sinks;
export interface Open {
type: 'open';
component: Component;
sources?: Sources;
backgroundOverlayClose?: boolean;
id?: string;
namespace?: Scope[];
}
export interface Close {
type: 'close';
count?: number;
namespace?: Scope[];
}
export declare type ModalAction = Open | Close;
export interface Options {
name?: string;
DOMDriverKey?: string;
center?: boolean;
modalContainerClass?: string;
wrapperClass?: string;
background?: string;
zIndex?: number;
}
export declare type Scope = string | number;
export interface SinksObject {
id: string | undefined;
namespace: Scope[];
sinks$: Stream<any>;
}
export declare class ModalSource {
private _namespace;
private _sinks$$;
constructor(_namespace: Scope[], _sinks$$?: Stream<SinksObject>);
select(id: string): ModalSource;
sinks(): Stream<any>;
sinks(driverNames: string[]): any;
isolateSource(source: ModalSource, scope: Scope): ModalSource;
isolateSink(modal$: Stream<ModalAction>, scope: Scope): Stream<{
namespace: (string | number)[];
type: "open";
component: Component;
sources?: any;
backgroundOverlayClose?: boolean;
id?: string;
} | {
namespace: (string | number)[];
type: "close";
count?: number;
}>;
}
export declare function modalify(main: Component, { name, DOMDriverKey, center, wrapperClass, modalContainerClass, background, zIndex }?: Options): Component;
export declare function centerHTML(children: VNode[]): VNode;